Compare commits

...

639 Commits

Author SHA1 Message Date
Alexander Larsson
a0eac16cb8 gdkframeclock: Loop the layout phase if needed
In the case where the layout phase queued a layout we don't
want to progress to the paint phase with invalid allocations, so
we loop the layout. This shouldn't normally happen, but it may
happen in some edge cases like if user/wm resizes clash with
natural window size changes from a gtk widget. This should not
generally loop though, so we detect this after 4 cycles and
print a warning.

This was detected because of an issue in GtkWindow where it
seems to incorrectly handle the case of a user interactive resize.
It seems gtk_window_move_resize() believes that configure_request_size_changed
changed due to hitting some corner case so it calls
gtk_widget_queue_resize_no_redraw(), marking the window as need_alloc
after the layout phase. This commit fixes the issue, but we should
also look into if we can fix that.
2013-04-24 23:10:05 +02:00
Alexander Larsson
a0c95153f1 Change the way we draw (again)
We can't really just draw by walking down the widget hierarchy, as
this doesn't get the right clipping (so e.g. widgets doing cairo_paint
may draw outside the expected gdkwindow subarea) nor does it let
us paint window backgrounds.

So, we now do multiple draws for each widget, once for each expose event
although we still do it at the same base cairo_t that we get for the
toplevel native window.

We also collect all the windows of a widget so we can expose them inside
the same opacity group if needed.
2013-04-24 23:10:05 +02:00
Alexander Larsson
550175a99b gdkwindow: Change update_handler to invalidate_handler
The new name fits better, plus we also remove the return value, and
adds docs.
2013-04-24 23:10:05 +02:00
Alexander Larsson
26b93a8468 GtkViewport: Add offscreen surface based scrolling
Rather than scroll via XCopyArea (which we no longer do) we keep an
offscreen buffer of the scrolled area with some extra space outside
the visible area and when we expose the viewport we just blit the
offscreen to the right place.
2013-04-24 23:10:05 +02:00
Alexander Larsson
b47f774b74 gtkcontainer: Don't propagate draws to non-drawable widgets
This short-circuits the propagation a bit earlier and fixes
a crash when looking for has_native_window on non-realized widgets.
2013-04-24 23:10:05 +02:00
Alexander Larsson
cb98f90a38 Add gdk_window_set_update_handler
This lets you register callbacks for when child widgets invalidate
areas of the window read it and/or change it.

For instance, this lets you do rendering effects and keeping offscreen
caches uptodate.
2013-04-24 23:10:05 +02:00
Alexander Larsson
08c33ef953 gdkwindow: Simplify invalidation
Now that all windows are non-opaque we can simplify the invalidation
a lot. There is no need to clip the invalidate area to child regions,
because we will always redraw everything under all the children.
We only have to handle native childen specially.
2013-04-24 23:10:04 +02:00
Alexander Larsson
2fa0536564 gdkwindow: Remove implicit paints
We now only do one expose event per native window, so there will
only be one begin/end_paint() call. This means all the work with
implicit paints to combine the paints on a single double buffer
surface is unnecessary, so we can just delete it.
2013-04-24 23:10:04 +02:00
Alexander Larsson
a05fc8f5b9 Only handle exposes on native window, propagate to children via draw()
We now consider non-native windows non-opaque, which means any invalid
area in a subwindow will also be invalid all the way up to the nearest
native windows. We take advantage of this by ignoring all expose events
on non-native windows (which typically means just the toplevel) and instead
propagating down the draw() calls to children directly via
gtk_container_propagate_draw.

This is nice as it means we always draw widgets the same way, and it
will let us do some interesting ways in the future.

We also clean up the GtkWidget opacity handling as we can now always
rely on the draing happening via cairo.

NOTE: This change neuters gtk_widget_set_double_buffered for
widgets without native windows
2013-04-24 23:10:04 +02:00
Alexander Larsson
76615eba3a gdkwindow: Remove ancient USE_BACKING_STORE define
This is always set anyway.
2013-04-24 23:10:04 +02:00
Alexander Larsson
b498ef1793 gdkwindow: Simplify clip region calculations
Since we no longer make overlapping siblings affect clip_region we
can further simplify the clip region calculation and updating.
2013-04-24 23:10:04 +02:00
Alexander Larsson
89dd7353fc gdkwindow: Simplify clip region handling
Since we dropped the move region optimization there is really no need
to try carefully keep track of opaque non-overlapped regions, as we
don't use this information to trigger the optimization anymore.

So, by assuming that all windows are non-opaque we can vastly simplify
the clip region stuff. First of all, we don't need clip_region_with_children,
as each window will need to draw under all children anyway. Secondly, we
don't remove overlapping sibling areas from clip_region, as these are
all non-opaque anyway and we need to draw under them

Finally, we don't need to track the layered region anymore as its
essentially unused. The few times something like it is needed we can
compute it explicitly.

For the case of native children of widgets we may cause a repaint
under native windows that are guaranteed to be opaque, but these
will be clipped by the native child anyway.
2013-04-24 23:10:04 +02:00
Alexander Larsson
bcf751d33f gdkwindow: Remove translate vfunc
This is not used anymore
2013-04-24 23:10:04 +02:00
Alexander Larsson
9f8e06265b gdkwindow: Remove outstanding_moves stuff
Since we now never move regions directly on the window we can
remove all the stuff that track outstanding moves and flushes then.
2013-04-24 23:10:04 +02:00
Alexander Larsson
2a0377017c gdk: Don't ever do copies from the window
This basically neuters gdk_window_move_region, gdk_window_scroll
and gdk_window_move_resize, in that they now never copy any bits but
just invalidate the source and destination regions. This is a performance
loss, but the hope is that the simplifications it later allows will let
us recover this performance loss (which mainly affects scrolling).
2013-04-24 23:10:03 +02:00
Cosimo Cecchi
06c8e8fa43 docs: fix some typos in newly introduced methods 2013-04-24 13:10:54 -04:00
Nik Kalach
95ce57443c [l10n] Update Interlingua translation 2013-04-24 16:03:15 +02:00
Yaron Shahrabani
9544ae08af Updated Hebrew translation. 2013-04-24 10:08:19 +03:00
Yaron Shahrabani
648ef7f7fa Updated Hebrew translation. 2013-04-24 09:45:26 +03:00
Matthias Clasen
661f24736b widget-factory: Add new widgets
Add GtkStack and GtkRevealer to the second page in
gtk3-widget-factory.
2013-04-23 17:39:46 -04:00
Benjamin Otte
174664b235 overlay: Silence gcc warnings 2013-04-23 14:13:51 -04:00
Owen W. Taylor
8c68050af8 tests/scrolling-performance: Add a new test for GtkViewport performance
Add a test that takes four copies of the widget-factory widgets and
scrolls them around to test how smoothly we can scroll and draw.
2013-04-23 14:04:40 -04:00
Owen W. Taylor
b7063509f8 tests/animated-resizing: Split frame statistics out into a separate file
Split the code for computing frame rate and latency into a separate file
so we can use it from multiple tests.
2013-04-23 14:04:40 -04:00
Owen W. Taylor
0032b2dc5a GtkSpinButton: don't constantly recreate style contexts for buttons
Cache the style contexts for the up and down panels, instead of recreating
them each time they are drawn or size requested. GtkSpinButtons were
many times slower to draw than other widgets because of the constant
style matching.

https://bugzilla.gnome.org/show_bug.cgi?id=698682
2013-04-23 14:04:39 -04:00
Federico Mena Quintero
d9b9ba5da0 Merge branch 'places-sidebar' 2013-04-23 13:58:09 -04:00
Rafael Ferreira
8ca13c4679 Updated Brazilian Portuguese translation 2013-04-23 05:11:52 -03:00
Alexander Larsson
316d450421 Handle non-baseline supporting subclasses overriding baseline supporting classes
If a subclass (say a child of GtkButton) overrides the non-baseline
size request methods we need to call these, rather than the new
get_height_and_baseline_for_width method.

In order to handle this we make the default for this method to be
NULL, and instead check at runtime which method to call. If any
non-baseline vfunc has changed in a class but the baseline one
hasn't, then we can't use the baseline one.
2013-04-23 05:58:48 +02:00
Alexander Larsson
c7b4dd5f9d Add baseline functions to docs 2013-04-23 05:58:08 +02:00
Alexander Larsson
e8d4bfd04b Add baseline alignment functions to gtk.symbols 2013-04-23 05:58:08 +02:00
Alexander Larsson
e253a414b0 GtkLabel: Minor cleanup
Make sure we always compare for a set baseline in the same way.
I.e. baseline != -1, never baseline >= 0.
2013-04-23 05:58:08 +02:00
Alexander Larsson
ac8817d34b GtkWidget: Add missing Since docs 2013-04-23 05:58:08 +02:00
Alexander Larsson
c630804647 GtkImage: Reuse previously calculated baseline_align in draw()
No need to recalculate this every time we draw.
2013-04-23 05:58:08 +02:00
Alexander Larsson
43f1ac2b8f GtkBox: Add missing Since in docs 2013-04-23 05:58:08 +02:00
Alexander Larsson
ebbc7791dd GtkGrid: Add missing Since docs 2013-04-23 05:58:07 +02:00
Alexander Larsson
2b4c9983da Add tests/testbaseline 2013-04-23 05:58:07 +02:00
Alexander Larsson
f354cef61b GtkDialog: Baseline align buttons in action area 2013-04-23 05:58:07 +02:00
Alexander Larsson
8fbd6e2edc GtkEventBox: Support baseline alignment
This allows baselines to propagate from the child of the eventbox.
2013-04-23 05:58:07 +02:00
Alexander Larsson
e64c1f8929 GtkButtonBox: Support baseline alignment 2013-04-23 05:58:07 +02:00
Alexander Larsson
1df8d18ad2 GtkCheckButton and GtkRadioButton: Implement baseline alignment 2013-04-23 05:58:07 +02:00
Alexander Larsson
433c0c2134 GtkSpinButton: Support baseline alignment 2013-04-23 05:58:07 +02:00
Alexander Larsson
627685e2a2 GtkGrid: Support baseline alignment in GtkGrid
We support a local baseline in each row, as well as selecting
a specific row for the global baseline of the entire GtkGrid.
2013-04-23 05:58:07 +02:00
Alexander Larsson
72cd8b4dab GtkEntry: Support baselines 2013-04-23 05:58:06 +02:00
Alexander Larsson
d6684b5748 GtkButton: Add baseline align support 2013-04-23 05:58:06 +02:00
Alexander Larsson
7523b25942 GtkImage: Support baselines
This uses the current font metrics to guess the baseline of the image.
Without this any non-centered baseline in buttons with images look weird.
2013-04-23 05:50:38 +02:00
Alexander Larsson
6acc8c0817 GtkAlignment: Support baselines
We now report any baselines from the child, and allocate it.
Also, in the case of a baselign aligned child we ignore yscale/yalign
as that is not supportable.
2013-04-23 05:50:38 +02:00
Alexander Larsson
9a42942afb GtkBox: Add baseline alignment for horizontal boxes
Report a baseline based height and baseline whenever there
are children with ALIGN_BASELINE.

Assign baseline to childen in size_allocate. Either the one inherited
from the parent if set, or otherwise calculate one based on any
ALIGN_BASELINE children.
2013-04-23 05:50:38 +02:00
Alexander Larsson
1e1cf89e4f GtkLabel: Support baseline
Report the baseline in get_preferred_height_and_baseline_for_width().
2013-04-23 05:50:37 +02:00
Alexander Larsson
5ad618cb95 GtkSizeRequestCache: Don't store baselines in horizontal case
This saves memory for every widget (maximum 48 bytes per widget) at
a cost of a few duplicated codepaths in the size request cache.
2013-04-23 05:50:37 +02:00
Alexander Larsson
77e0f18eda Add GTK_DEBUG=baselines support
This draws red lines to show where the baselines are
2013-04-23 05:50:37 +02:00
Alexander Larsson
852cbb62b8 Initial support for baselines
This modifies the size machinery in order to allow baseline support.

We add a new widget vfunc get_preferred_height_and_baseline_for_width
which queries the normal height_for_width (or non-for-width if width
is -1) and additionally returns optional (-1 means "no baseline")
baselines for the minimal and natural heights.

We also add a new gtk_widget_size_allocate_with_baseline() which
baseline-aware containers can use to allocate children with a specific
baseline, either one inherited from the parent, or one introduced due
to requested baseline alignment in the container
itself. size_allocate_with_baseline() works just like a normal size
allocation, except the baseline gets recorded so that the child can
access it via gtk_widget_get_allocated_baseline() when it aligns
itself.

There are also adjust_baseline_request/allocation similar to the
allocation adjustment, and we extend the size request cache to also
store the baselines.
2013-04-23 05:50:37 +02:00
Alexander Larsson
f15bc7818e Add GTK_ALIGN_BASELINE to GtkAlign
Setting this means baseline aware containers should align the widget
according to the baseline. For other containers this behaves like
FILL.

In order to not suprise old code with a new enum value we always
return _FILL for _BASELINE unless you specifically request it via
gtk_widget_get_valign_with_baseline().
2013-04-23 05:47:31 +02:00
John Ralls
655c781b6e Fix automake warning about CFLAGS etc. being user variables 2013-04-22 15:48:35 -07:00
John Ralls
f0f07ad6d8 Remove get_atom_name and atom_intern
Completes aa9e974 for quartz
2013-04-22 15:48:35 -07:00
John Ralls
179004f0a7 Fix attempted inclusion of local headers with system brackets. 2013-04-22 15:48:34 -07:00
John Ralls
e58b19db04 gdk: Temporarily add -xobjective-c to CFLAGS
To enable compiling the quartz backend after a6a4428
2013-04-22 15:48:34 -07:00
Benjamin Otte
315261260c button: Implement height-for-width
https://bugzilla.gnome.org/show_bug.cgi?id=698433
2013-04-22 18:29:21 -04:00
Benjamin Otte
3450388ff0 sizerequest: Split out a common function 2013-04-22 18:29:01 -04:00
Cosimo Cecchi
009aadf378 window: remove unused code
We don't need to add these style classes.
2013-04-22 18:10:22 -04:00
Cosimo Cecchi
7bbbb01ff5 window: rework the CSD theming layer
Instead of having three different boxes and style classes, we can just
get away with the regular background box, plus a window-frame, which
contains the external frame, together with the window drop shadows.

GtkWindow now has special code to ensure the backing actual window is
allocated big enough to accomodate the shadows (using the shadow size
calculations introduced in the previous commit). We also use the margin
value to determine the size of the invisible borders (which can then be
different than the shadow).
2013-04-22 18:10:22 -04:00
Cosimo Cecchi
a44d6816d3 cssshadow: add a method to get the size of a shadows value
The method returns the size of each side of a GtkCssShadowsValue.
2013-04-22 18:10:21 -04:00
Cosimo Cecchi
7846bedebd window: factor out a gtk_window_get_maximized() function
Simplify code that does this same check over and over.
2013-04-22 18:10:21 -04:00
Cosimo Cecchi
87922575d3 window: remove title_border
We don't actually need this additional title border.
2013-04-22 18:10:21 -04:00
Federico Mena Quintero
0c1423d962 Remove GtkPlacesSidebar from our private Glade catalog
Now, Glade already knows about GtkPlacesSidebar AND MY MAD ICONS.
2013-04-22 17:00:08 -04:00
Ryan Lortie
ca0a18918c GtkModelMenuItem: add support for 'icon' attribute
Add support for icons on a GMenuModel.

https://bugzilla.gnome.org/show_bug.cgi?id=688820
2013-04-22 15:55:08 -04:00
Federico Mena Quintero
5322420145 Use friendlier property names for Glade 2013-04-22 15:46:59 -04:00
Piotr Drąg
66007d0ab6 Updated POTFILES.in and POTFILES.skip 2013-04-22 20:51:32 +02:00
Matthias Clasen
15bba87e9a Add new symbols
Add the GtkRevealer functions to gtk.symbols
2013-04-22 12:42:39 -04:00
Matthias Clasen
8ff96b3bb2 Do rtl flipping for GtkRevealer transitions 2013-04-22 12:42:39 -04:00
Matthias Clasen
86688c6fde Add a revealer example to gtk-demo
I tried to make a 'revealer ballet'. Judge for yourself if
I succeeded.
2013-04-22 12:42:39 -04:00
Matthias Clasen
aec62e1c10 Add docs for GtkRevealer 2013-04-22 12:42:38 -04:00
Matthias Clasen
d7f43c30a3 GtkRevealer: Add a fading animation
Using a container for this is not necessarily the most
elegant solution, but it lets us reuse the animation
machinery in GtkRevealer.
2013-04-22 12:42:38 -04:00
Matthias Clasen
0bd173e3d8 Forgotten file 2013-04-22 12:42:37 -04:00
Matthias Clasen
443459b52e Add GtkRevealer
This is a widget that can hide or show (ie reveal) its child
in an animated fashion.

This widget was initially developed in libgd.
2013-04-22 12:42:37 -04:00
Cosimo Cecchi
d82257e1c8 stack: fix a typo in docs 2013-04-22 11:20:06 -04:00
Matthias Clasen
b88c0d7387 Typo fix in GtkStack docs 2013-04-22 10:25:30 -04:00
Matthias Clasen
6d77bf66ac Typo fix in GtkStackSwitcher docs 2013-04-22 10:25:30 -04:00
Benjamin Otte
b8e4adfff9 Revert "Revert "gtkbin: Remove the silliest code on earth""
This reverts commit b164df7450.
2013-04-22 08:23:08 -04:00
Victor Ibragimov
361754b063 Tajik translation updated 2013-04-22 13:17:42 +05:00
Rafael Ferreira
b5912e61fd Updated Brazilian translation for UI and PO-Prop. 2013-04-22 05:00:18 -03:00
Tristan Van Berkom
e5b384f537 Updated private widget catalog to remove the reference to the shortcuts model
This model seems to be removed since Federico's places-sidebar work.
2013-04-22 15:55:20 +09:00
Tristan Van Berkom
b164df7450 Revert "gtkbin: Remove the silliest code on earth"
This reverts commit f4438a1ffc.

The calculation of the delta between parent and child widget
is required in order to automate height-for-width and width-for-height
requests for various GtkBin widgets.

GtkButton, GtkCheckButton, GtkRadioButton, etc, all have different
requests for space around the content which can not be satisfied
with a simple calculation of GtkContainer border-width.
2013-04-22 15:20:51 +09:00
Matthias Clasen
6186429f5f GtkStack: shorten a few parameter names
Looks better in the docs.
2013-04-21 23:13:16 -04:00
Matthias Clasen
a8123bf95e Forgot one place
Also change the property definition for transition-duration
to be uint instead of int.
2013-04-21 22:24:54 -04:00
Matthias Clasen
af6f874060 Add new places sidebar symbols 2013-04-21 22:00:06 -04:00
Matthias Clasen
b0cf4d057d Make transition-duration unsigned
The code doesn't deal with negative durations, so better
don't allow them.
2013-04-21 21:51:28 -04:00
Matthias Clasen
71f1f768cc Change transition-type property type
This is an enum, so declare the property as such.
2013-04-21 21:51:27 -04:00
Matthias Clasen
49511c7f42 Add a GtkStack example to gtk-demo 2013-04-21 21:51:27 -04:00
Matthias Clasen
85ccb93b9f GtkStack: warn if child names are not unique 2013-04-21 21:51:27 -04:00
Matthias Clasen
24bac24602 Add new symbols 2013-04-21 21:51:26 -04:00
Matthias Clasen
f83ba08f7f Add new api to the docs 2013-04-21 21:51:26 -04:00
Matthias Clasen
c37b30f317 GtkStack: add vertical slide transitions
We allow transitions that slide up or down.
2013-04-21 21:51:26 -04:00
Matthias Clasen
88cd26575d GtkStack: rtl flipping for animation
We switch slide-right and slight-left when in rtl.
2013-04-21 21:51:25 -04:00
Matthias Clasen
e72a78c4e6 Add a way to specify transition types on the fly
Add a gtk_stack_set_visible_child_full that takes a
transition type.
2013-04-21 21:51:25 -04:00
Matthias Clasen
8ca73e3258 Add docs for GtkStackSwitcher 2013-04-21 21:51:25 -04:00
Matthias Clasen
06f5b1e572 Add docs for GtkStack 2013-04-21 21:51:24 -04:00
Matthias Clasen
2e39c4bab8 Add GtkStack
Add separate GtkStack and GtkStackSwitcher widgets that are an
alternative to GtkNotebook. Additionally, GtkStack supports
animated transitions when changing pages.
These widgets were initially developed in libgd.
2013-04-21 21:51:24 -04:00
Federico Mena Quintero
57c4bcb369 Merge branch 'master' into places-sidebar 2013-04-21 18:21:37 -04:00
Federico Mena Quintero
9b91e06513 Oops, only show 'Connect to server' if the caller enabled it 2013-04-21 18:20:46 -04:00
Cosimo Cecchi
44ba055d03 window: don't forget to fetch title border when not on CSD
We still need to respect this border value even when we're not running
under CSD, since we support setting a custom titlebar in all cases.

The border/style magic in gtk_window_draw() really needs to be separated
out into logical pieces soon, but for now let's keep a consistent
behavior with the previous code.
2013-04-21 16:59:14 -04:00
Federico Mena Quintero
32abb29b32 Merge branch 'places-sidebar' 2013-04-21 15:51:49 -04:00
Cosimo Cecchi
a25e0a97d5 window: only account for decoration borders when we're client decorated 2013-04-21 14:44:24 -04:00
Federico Mena Quintero
9d8e3be6d7 Add a selected_volume argument to ::populate-popup
Nautilus needs this in order to implement a Format command for a volume's popup menu.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-21 12:41:33 -04:00
Matthias Clasen
1507ba79ec csd: Drop content_window
Instead of reparenting the content, use input-only windows to
set cursors and capture clicks on the window frame. This avoids
some of the problems that were introduced by content_window, such
as black flashes and non-working opacity.
2013-04-20 23:37:10 -04:00
Federico Mena Quintero
9ded1c0c99 Sync from nautilus commit 500770e8de18b07392ffa4435372525d5d03c688
Add a Connect to Server menu item, a show-connect-to-server property, and a show-connect-to-server signal.
2013-04-20 19:14:59 -04:00
Federico Mena Quintero
2d84ebeeb8 Remove the switch location timer during drag_leave
So that hovering in and out of the sidebar quickly doesn't cause a location change in the caller.
2013-04-20 16:21:33 -04:00
Federico Mena Quintero
fce1eedc23 Merge branch 'places-sidebar' 2013-04-20 16:00:00 -04:00
Cosimo Cecchi
e9c4dcd3f8 Sync from nautilus commit d2bfffc574c1e6305d862c041b35c9c45ba67674
Coding style fix.
2013-04-20 15:59:04 -04:00
Cosimo Cecchi
755e37ffdf Sync from nautilus commit 277a6a45bee8186b2493ad1b286234ac52f1aed8
Use gtk_tree_view_set_activate_on_single_click().
2013-04-20 15:58:55 -04:00
William Jon McCann
fa1f7d3f97 Sync nautilus commit 95400548176688f3d2f5e8888f48410756bd96b8
Switch location on hovering the places sidebar during a DnD operation -
kind of for spring-loaded folders.
2013-04-20 15:56:59 -04:00
Federico Mena Quintero
3c8cce8f87 Merge branch 'places-sidebar' 2013-04-20 14:56:16 -04:00
Federico Mena Quintero
3b34e70f13 Remove the drop feedback row a little time after drag_leave
Since ::drag-leave gets emitted before ::drag-drop, we can't just remove the drop feedback row
in drag-leave, as we *need* it during drag-drop.  So, we use the same trick as in testdnd.c - we
install a timeout handler in our drag-leave callback, and remove the feedback in the timeout callback.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-20 14:53:03 -04:00
Federico Mena Quintero
9c38ff7dfb Drop in the right place when the feedback row is active
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-20 14:53:03 -04:00
Federico Mena Quintero
3083308d1c Actually use the drop_state, instead of encoding things in new_bookmark_index
This lets us keep the new_bookmark_index untouched even when the drop state goes from armed to unarmed.
That will in turn let us drop in the right place...

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-20 11:42:04 -04:00
Victor Ibragimov
a1424d26b2 Tajik translation updated 2013-04-20 14:28:18 +05:00
Victor Ibragimov
6b502c3c84 Tajik translation update 2013-04-20 13:42:49 +05:00
Victor Ibragimov
cbddb3435e Updated translation for Tajik 2013-04-20 13:42:48 +05:00
Dimitris Spingos
abbf2d9564 Updated Greek translation 2013-04-20 05:42:43 +03:00
Matthias Clasen
bf5e57d2a7 po: Add a rule to generate files
This should help translators generate an updates pot file.
Just doing make -C po gtk30.pot should work now, no need to
build the entire module.
2013-04-19 20:11:41 -04:00
Matthias Clasen
34273f386e Strip XF86 from keyboard label msgids
The msgids have changed, but all the translations still apply.
2013-04-19 20:11:40 -04:00
Matthias Clasen
49c4ad2f00 Update keyname tables
This commit is very similar to 8c8853a1f5

We update the keynames.txt file from gdkkeynames.h, and we update
keynames-translate.txt to include all the keysym names that we want
to have translations for. Also strip the XF86 from the translatable
keysym names, since we are returning those names now from
gdk_keyval_name().

keyname-table.h is regenerated from these updated files.
2013-04-19 20:11:39 -04:00
Matthias Clasen
c4a17c8895 Keep XF86 keysym names working
These names are unfortunately stored in gsettings around
the world, so we can't really stop supporting them.
2013-04-19 20:11:39 -04:00
Matthias Clasen
606a626981 Add some tests for keysyms
Not very extensive, but we do test that XF86 keysym names
keep working.
2013-04-19 20:11:38 -04:00
Matthias Clasen
4be04743f1 Update gdkkeysyms.h header
Regenerate these files from the X11 keysymdef.h file, using
gdkkeysyms-update.pl. The only change is the addition of
GDK_KEY_AudioMicMute.
2013-04-19 20:11:38 -04:00
Federico Mena Quintero
cab1d6712d Merge branch 'places-sidebar' 2013-04-19 17:26:39 -05:00
Federico Mena Quintero
2db8e25cdb treeview: Use equal areas in the computation of drag dest row positions
We used to divide the row in thirds vertically, and use the outer thirds for GTK_TREE_VIEW_DROP_BEFORE and AFTER, respectively.

Now we use *fourths*.  This is so that we get equal areas for these:

  GTK_TREE_VIEW_DROP_BEFORE
  GTK_TREE_VIEW_DROP_INTO_OR_BEFORE
  GTK_TREE_VIEW_DROP_INTO_OR_AFTER
  GTK_TREE_VIEW_DROP_AFTER

This makes hovering tree rows much more positive.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-19 17:24:03 -05:00
Federico Mena Quintero
a1b9bf7fbc Adjust the drag destination row when it is above the currently highlighted row
This makes the feedback accurate and without hysteresis.  Haven't I written this code ten times before?

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-19 17:24:03 -05:00
Federico Mena Quintero
3815f5d956 Dropping on the feedback row is always possible
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-19 17:24:03 -05:00
Federico Mena Quintero
bc0a9a33b0 Add a temporary row for feedback when inserting a bookmark is possible
We'll prettify this gradually.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-19 17:23:55 -05:00
Victor Ibragimov
d4abd96879 [l10n] Add Tajik translation 2013-04-20 00:10:36 +02:00
Matthias Clasen
af48a81165 Revert "gdk: Update keynames list from gdkkeysyms.h"
This reverts commit 8c8853a1f5.
2013-04-19 17:10:39 -04:00
Benjamin Otte
a6a4428f23 gdk: Unvfuncify gdk_display_manager_open_display()
This looks like a pretty stupid patch, but it's only a step towards the
ultimate end goal: Get rid of all the displaymanagers.
2013-04-19 16:23:43 -04:00
Benjamin Otte
edfaeba32b Revert "wayland: Cache the discovery connection and reuse if possible"
This reverts commit 524ce7f88e.
2013-04-19 16:22:32 -04:00
Benjamin Otte
cadfa58801 wayland: Get rid of generic macros
They're unused.
2013-04-19 16:18:25 -04:00
Benjamin Otte
c1607c14d5 broadway: Get rid of generic macros
Use existing API instead.
2013-04-19 16:18:25 -04:00
Benjamin Otte
8c8853a1f5 gdk: Update keynames list from gdkkeysyms.h
grep \#define gdkkeysyms.h | sed "s/#define GDK_KEY_\(.*\) \(.*\)/\2
\1/" | grep -v \#define | sort > keynames.txt
./gen-keyname-table.pl keynames.txt keynames-translate.txt

https://bugzilla.gnome.org/show_bug.cgi?id=698385
2013-04-19 16:18:25 -04:00
Benjamin Otte
dd0fec4757 x11: Simplify function
Displays get made default displays automatically, so there's no need to
do it in the vfunc.
2013-04-19 16:18:25 -04:00
Benjamin Otte
f345051d36 displaymanager: Emit display-opened directly
Instead of letting every backend do it manually.
2013-04-19 16:18:25 -04:00
Benjamin Otte
edbace1045 quartz: Emit GdkDisplay::opened signal 2013-04-19 16:18:25 -04:00
Benjamin Otte
4a6ba8b253 win32: Emit GdkDisplay::opened signal 2013-04-19 16:18:25 -04:00
Benjamin Otte
01c6ecfb78 display: Add display to displaymanager later
Instead of GdkDisplay::init, only add the display to the display manager
in GdkDisplay::opened. This avoids spurious changes of the default
display in gtk_init() when we're trying to find the one that works and
try to open lots of different ones.
2013-04-19 16:18:25 -04:00
Benjamin Otte
c86ac95ebf display: Make opened signal have a vfunc
... instead of g_signal_connect()ing in every init function.
2013-04-19 16:18:25 -04:00
Benjamin Otte
1fa29835a7 gdk: Refactor function
Split out a GdkBackend type and iterate over it.
2013-04-19 16:18:25 -04:00
Matthias Clasen
264b4bf118 extract-strings: Deal with multiline strings
When putting out N_(...) macros, we must split multiline strings,
otherwise xgettext complains.
2013-04-19 15:22:03 -04:00
Matthias Clasen
4f65f69a60 Revert more POTFILES.in breakage 2013-04-19 14:39:23 -04:00
Piotr Drąg
beb4989c1b Revert adding .ui files to POTFILES.in
This breaks the build unfortunately. Developers will need to resolve that one.
2013-04-19 20:27:40 +02:00
Piotr Drąg
84126230fe Updated POTFILES.in
Oops.
2013-04-19 19:40:56 +02:00
Colin Walters
fd81f0a492 Remove "tg" from po/LINGUAS until po-properties is fixed
Commit dcad786ba0 introduced "tg" but
didn't add po-properties/tg.po, which is necessary in order for the
build to not break.

Therefore I'm removing tg until the file is added.
2013-04-19 13:27:22 -04:00
Piotr Drąg
62c826b992 Updated POTFILES.in 2013-04-19 19:18:52 +02:00
Federico Mena Quintero
624b352d77 Move the drop feedback code to stub functions
For now it is the old, simple call to gtk_tree_view_set_drag_dest_row().  We'll do something
fancier in the following commits.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-19 11:30:23 -05:00
Federico Mena Quintero
7d52dff5ec Add a DropState enum to the internal state of the sidebar
We want to show a little animation when a DnD operation is happening and the user hovers
between existing bookmarks.  The animation should indicate the user that he's about to
create a new bookmark from the file right there.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-19 11:20:13 -05:00
P. F. Chimento
29c7562ca7 doc: Documented icon-shadow CSS property
The docs say that text-shadow applies a drop shadow to both text
and icons, but icons need to use the icon-shadow property.

https://bugzilla.gnome.org/show_bug.cgi?id=698181
2013-04-19 10:19:25 -04:00
Matthias Clasen
163542f545 Fix mouse interaction in combo cell renderer
Pass the event on when calling gtk_cell_editable_start_editing.
https://bugzilla.gnome.org/show_bug.cgi?id=504901
2013-04-19 10:11:48 -04:00
Rob Bradford
524ce7f88e wayland: Cache the discovery connection and reuse if possible
This will prevent us opening, closing and reopening the same display
connection in the majority of cases.

https://bugzilla.gnome.org/show_bug.cgi?id=694465
2013-04-19 14:03:24 +01:00
Victor Ibragimov
3df715a511 Tajik Translation updated 2013-04-19 17:27:17 +05:00
Victor Ibragimov
dcad786ba0 Tajik translation added (translation is still in progress) 2013-04-19 17:23:35 +05:00
Ryan Lortie
a37ddbe74b menu binding docs: Link to insert_action_group()
It's pretty useless to make a menu without actions behind it and people
who are using gtk_menu_shell_bind_model() directly are probably not
interested in doing it the GtkApplicationWindow way (so they won't get
the "app" and "win" groups for free).  People are going to need to call
gtk_widget_insert_action_group(), so mention this in the docs to help
them along.
2013-04-18 07:11:15 -04:00
Christian Persch
9f0ee69552 bindings: Fix gtk_binding_entry_skip
This fixes a regression from commit 9a3466832c.

https://bugzilla.gnome.org/show_bug.cgi?id=695380
2013-04-17 13:21:44 +02:00
Benjamin Otte
0990c11a83 gdk: Unvfuncify generic key functions
This makes Wayland and X11 no longer call into XKB and libX11 for these
functions but use GDK's own copy of these functions, just like the
win32, quartz and broadway backends.
2013-04-16 15:30:14 +02:00
Benjamin Otte
065a8da87a gdk: Refactor default key vfuncs
Instead of copying them all over the place, keep a default
implementation around.
2013-04-16 15:30:14 +02:00
Benjamin Otte
441359b0a8 gdk: Refactor gdk_keyval_convert_case()
... so it doesn't export the function anymore.
2013-04-16 15:30:14 +02:00
Benjamin Otte
1651d9ac3e broadway: Delete 2 files doing nothing
A function was doing nothing but calling a function that was in its own
source file doing nothing but calling a function in its own source file
that did nothing.
2013-04-16 15:30:14 +02:00
Benjamin Otte
c2793d9c1d docs: Move property section docs to correct file 2013-04-16 15:30:14 +02:00
Juan Pablo Ugarte
1a06842425 GtkSwitch: moved focus drawing from outside border inside the handle. 2013-04-16 03:16:43 -03:00
Federico Mena Quintero
3b3eb4bdbc Merge branch 'merge-places-sidebar'
This is the new GtkPlacesSidebar widget, which is the sidebar used in
GtkFileChooser to display a list of places/folders that the user may
want to use.  File managers are encouraged to use this widget for
their own global list of folders.
2013-04-15 19:29:37 -05:00
Tristan Van Berkom
a6f9ef0d3a Load the file chooser's widgets from the .ui file
This is Tristan's *excellent* work, minus the old code for the shortcuts bar - that is all done
in GtkPlacesSidebar now.

The UI gets loaded from a Glade resource; most of the old code to create the UI by hand is gone.

There is still code for save_widgets_create(); this needs to be moved into the UI file, but it
is not a big deal.

gtk_file_chooser_default_init() calls a new post_process_ui() that takes care of all the things
that cannot be done directly in Glade.
2013-04-15 19:29:12 -05:00
Federico Mena Quintero
1d946367d3 For now, add GtkPlacesSidebar to the Glade catalog for private widgets
Although GtkPlacesSidebar is a public widget, we can't have that in Glade's general catalog
as this branch is not merged into GTK+ proper yet.  We'll move the widget to Glade's
catalog when this is done.
2013-04-15 19:29:12 -05:00
Federico Mena Quintero
c297d4de68 Add .ui file for GtkFileChooserDefault 2013-04-15 19:29:12 -05:00
Nik Kalach
e3a22b3eba Updated Interlingua translation 2013-04-15 21:43:17 +02:00
Benjamin Otte
aa9e974c86 gdk: Make atoms handled generically
This is another step towards making GdkDisplayManager backend-agnostic.

Most of the backends profit from this as their atom implementations
where generic anyway - x11 needed that to allow multiple X displays and
broadway, quartz and wayland don't have the concept of displays.

The X11 backend still did things, so I only #if 0'd some code but did
not actually update anything.
2013-04-15 15:43:27 +02:00
Benjamin Otte
a489f69e00 gdk: Remove unused function 2013-04-15 15:43:27 +02:00
Benjamin Otte
7ef508ff4a displaymanager: Handle list of displays in base class
This moves the add/remove_display() functions from the subclasses to
GdkDisplay and GdkDisplayManager. It also gets rid of the list_displays
vfunc.
2013-04-15 15:43:26 +02:00
Simon Kågedal Reimer
d29a441106 doc: Clarify gtk_widget_queue_draw_region() doc 2013-04-15 15:43:26 +02:00
Benjamin Otte
f7c0b025b9 displaymanager: Move set_default_display vfunc
... to GdkDisplayClass.make_default. It's only implemented by X11
anyway.
2013-04-15 15:43:26 +02:00
Benjamin Otte
839f402191 displaymanager: Handle the default display
... instead of having every backend do it on their own.
2013-04-15 15:43:26 +02:00
Alban Browaeys
ad764c8a58 print: disconnect source_changed_handler on printeroptionwidget finalize
Printing a web page without window.print (which still segfault),
that is Ctrl+P is fixed (does not attempt to execute the
source_changed_handler on a printeroptionwidget that has been
destroyed) by disconnecting this handler in the printeroptionwidget
finalize.

https://bugzilla.gnome.org/show_bug.cgi?id=696622
2013-04-14 20:20:14 -04:00
Volker Sobek
efaacea1d2 gtk-demo: Fix typo
https://bugzilla.gnome.org/show_bug.cgi?id=675649
2013-04-14 09:04:57 -04:00
Carlos Garcia Campos
c737e1d194 gtkprintjob: release the surface and backend before the output io channel
If the GtkPrintJob is freed too early when the surface has been created
but the job hasn't been sent to the printer, it's possible that the
file print backend tries to write to the io chaneel when it is already
closed. This produces runtime critical warnings:

GLib-CRITICAL **: g_io_channel_write_chars: assertion `channel->is_writeable' failed

https://bugzilla.gnome.org/show_bug.cgi?id=685420
2013-04-14 12:19:09 +02:00
Carlos Garcia Campos
2adacca119 gtkprintbackendfile: Fix infinite loop in _cairo_write()
It can happen if the io channel has been closed. In that case
g_io_channel_write_chars() returns early because of a g_return macro
that checks if the io channel is writable. When returning from g_return
macros, the bytes written output parameter is not updated and the error
is not filled, so the error is not detected and the written variable is
used uninitialized. We should check the return value of
g_io_channel_write_chars() to break the loop.

https://bugzilla.gnome.org/show_bug.cgi?id=685419
2013-04-14 12:19:09 +02:00
ammonkey
4445dce697 fix mem leak in gtk_drag_set_icon_surface, destroy pattern
https://bugzilla.gnome.org/show_bug.cgi?id=681446
2013-04-13 20:06:43 -04:00
Matthias Clasen
c60bfa40ad Precache more atoms
Add a few more entries to the list of precached atoms.
2013-04-13 19:48:38 -04:00
Matthias Clasen
bb4fca2486 wayland: Don't get the shell surface twice
Noticed by Pu Xingyu,
https://bugzilla.gnome.org/show_bug.cgi?id=697947
2013-04-13 17:20:05 -04:00
Matthias Clasen
83e104b093 Revert "Use natural size to set adjustment ranges"
This reverts commit 666d10ec76.

This change severely broke any treeviews without horizontal
scrollbars. Basically, ellipsization never kicks in, and instead
the treeview content just extends outside the visible area,
rendering it inaccessible. This broke e.g. the control-center
keyboard shortcuts panel, the gnome-disks device list, etc etc.
2013-04-13 16:24:10 -04:00
Matthias Clasen
ff56d02d7b csd: Don't use a content_window for o-r windows
This fixes drawing of dnd icons.
https://bugzilla.gnome.org/show_bug.cgi?id=697886
2013-04-12 22:49:40 -04:00
Rob Bradford
bff5b2ae3e wayland: Don't "probe" for a Wayland compositor if started from compositor
In the case that the client is started directly by the compositor the
WAYLAND_SOCKET environment variable is set containing the fd to use that was
created by a socketpair.

This environment variable is consumed by a call to wl_display_connect so a
second call will not take advantage of it.

https://bugzilla.gnome.org/show_bug.cgi?id=697673
2013-04-12 18:43:36 +01:00
Federico Mena Quintero
4d4904ed8a Move all of GtkFileChooserDefault's fields into a private structure
I love Emacs macros, by the way.
2013-04-11 22:44:19 -05:00
Federico Mena Quintero
b0eed8680c Move GtkFileChooserDefault to gtkfilechooserdefault.c
We will move all the fields to a private structure next.
2013-04-11 21:44:21 -05:00
Federico Mena Quintero
e2c9797994 Move GtkFileChooserWidgetPrivate to gtkfilechooserwidget.c
In addition, remove the unused "file_system" field from that
structure.
2013-04-11 20:51:09 -05:00
Federico Mena Quintero
70fce923bc Move GtkFileChooserDialogPrivate into gtkfilechooserdialog.c
We'll take private structures out of gtkfilechooserprivate.h and move
them to the appropriate place.
2013-04-11 20:46:47 -05:00
Federico Mena Quintero
456c318f6e Remove unused #define 2013-04-11 20:42:43 -05:00
Federico Mena Quintero
9a3bc21dc9 Don't include gtkfilechooserprivate.h from the file chooser's tests
We will make that file a fully private header; the tests have no
business poking inside the file chooser's internals at this point.
2013-04-11 20:40:05 -05:00
Federico Mena Quintero
d3985dec1d GtkPlacesSidebar: Hold a reference to the sidebar while a D-Bus proxy is being created
The creation is async, and the sidebar could be destroyed while the D-Bus proxy is being created.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-04-11 20:04:53 -05:00
Federico Mena Quintero
5b827c53e5 Merge branch 'places-sidebar' into master
This lands the GtkPlacesSidebar widget.  It is used in
GtkFileChooserDefault, and it can also be used by third-party
applications.
2013-04-11 19:45:12 -05:00
Federico Mena Quintero
21083978f0 Revert "GtkFileChooserDefault: Define children with a GtkBuilder template"
Having the changes for composite widget templates makes it impossible
to merge the places-sidebar branch.  So, we will merge that branch,
and *then* apply the changes for composite templates.

This reverts commit bf909f5615.
2013-04-11 16:47:38 -05:00
David King
b0121ed0a1 xi2: Improve pointer emulation debug reporting
Reporting "true" or "false" is nicer than the value of the flag.

https://bugzilla.gnome.org/show_bug.cgi?id=697795
2013-04-11 15:56:13 +01:00
Alexander Larsson
645f6435e5 gdkwindow: Handle updates created by outstanding moves in same update
If gdk_window_flush_outstanding_moves() creates new update area
we handle this directly in the same draw to avoid flashing.

This mainly affects win32 as X11 does its exposes from moves async.
However, its important for win32 since ScrollDC seems to sometimes
invalidate (and not copy) unexected regions.

http://bugzilla.gnome.org/show_bug.cgi?674051
2013-04-11 12:15:30 +02:00
Alexander Larsson
1884271f03 win32: Report ScrollDC update region directly
Rather than set the window update region and repaint this region
when we get a WM_PAINT we just directly add it to the update
region. No need to roundtrip via win32.

This lets us also make sure we do this drawing in the same update
cycle. This seems especially important on Win7, because ScrollDC
seems to act kind of weird there, not using bitblt in areas where
it seemingly could, which makes scrolling look really flashy.

http://bugzilla.gnome.org/show_bug-cgi?id=674051
2013-04-11 12:12:35 +02:00
Alexander Larsson
9011a79ed2 Make gdk_flush_outstanding_moves "reentrant"
If do_move_region_bits_on_impl causes updates they will propely
be moved by the outstanding moves we have not yet flushed.
2013-04-11 11:35:17 +02:00
Alexander Larsson
5ac3edf77f Update gtk.symbols
This fixes win32 build
2013-04-11 11:25:26 +02:00
Alexander Larsson
8c61659225 win32: Fix build
Need to take ".exe" into account for file dependencies on win32.
2013-04-11 11:25:26 +02:00
Alexander Larsson
781ad5a1bc win32: Make build with latest gdkdisplay changes 2013-04-11 11:25:25 +02:00
Carlos Garnacho
cc7b3985b3 xi2: Reset scroll valuators on synthesized crossing events
On crossing events resulting from moving windows (eg. workspace switch),
deviceid equals sourceid, so make those reset scroll valuators on all
slave devices to avoid misleading jumps in scroll events

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=690275
2013-04-10 20:18:09 +02:00
Matthias Clasen
c402e89299 csd: Use symbolic icons for window buttons
With symbolic icons, we can recolor the icons as needed, and we
can use icon shadows, etc.
2013-04-10 06:13:26 -04:00
Matthias Clasen
e2ec223cd7 Don't free a list that has not been initialized 2013-04-09 21:18:05 -04:00
Chris Cummins
6deff39f74 wayland: Use more explicit out parameter names
Prevent confusion between positional values and hotspot values.

Signed-off-by: Rob Bradford <rob@linux.intel.com>
2013-04-09 12:52:56 +01:00
Chris Cummins
e707eadaf2 Update GtkCssProvider box-shadow documentation
Non-inset box-shadows are no longer ignored by the GTK+ theming engine,
outset shadows are supported.

Signed-off-by: Rob Bradford <rob@linux.intel.com>
2013-04-09 12:52:52 +01:00
Chris Cummins
f478f16dba cds: enable outset shadows
Adds conditional code paths to GdkCssShadowValue for painting outset
shadows, and allows shadows to be applied in two passes (first outset
then inset). This can be used to draw csd shadows in outer window
borders.

https://bugzilla.gnome.org/show_bug.cgi?id=695998
Signed-off-by: Rob Bradford <rob@linux.intel.com>
2013-04-09 12:52:47 +01:00
Rob Bradford
b37d83e988 wayland: don't leave root window values uninitialised
Under Wayland we don't know the absolute position of the device but there are
some API calls that expect to get an root window position. Previously we were
not assigning any value to these out parameters potentially leaving the values
undefined.

This change returns the current surface relative position of the device.
2013-04-09 12:52:16 +01:00
Carlos Garnacho
7ffcd85d13 quartz: Fix call to missing symbol
This patch can be considered a leftover of commit 6f607fc8b4 ,
replace the no longer existing function with the GDK function
meant to replace it.

This was noticeable on regular clipboard operations in quartz
2013-04-09 12:38:46 +02:00
Benjamin Otte
c4dc0e8e40 window: Remember current size
Don't just look at previously remembered sizes, also look at the current
size.
This is useful for cases where the window was resized by the user or WM
and not by the application itself.

https://bugzilla.gnome.org/show_bug.cgi?id=696882
2013-04-09 12:09:12 +02:00
Benjamin Otte
70dbb14f89 window: Split out a function
We don't want to remember sizes in the not resizable case. Also a
function named "guess_default_size" should not look at previous sizes,
it should guess.
2013-04-09 12:09:12 +02:00
Benjamin Otte
33f1210f72 window: Remove an unused function.
Luckily, we don't need to support an implementation of a minimal WM for
linux-fb anymore (which is what this function was added for).
2013-04-09 12:09:12 +02:00
Benjamin Otte
72290fb538 docs: Fix Since tag for frame clock functions 2013-04-09 12:09:11 +02:00
Matthias Clasen
96982347b3 wayland: Clean up gdkwayland.h
Make this an include-only header
2013-04-08 22:32:50 -04:00
Benjamin Otte
21f11eb0e6 window: restore size after hide/show properly
Old code assumed the size was stored in widget.allocation. This is no
longer true as the allocation is cleared upon hide. However, we store
the last configure request, and that one tracks the last size, so we can
just use that number.

Sometimes things are so easy - once you figure them out...

https://bugzilla.gnome.org/show_bug.cgi?id=696882
2013-04-08 16:34:19 +02:00
Benjamin Otte
b662e96e7e plug: Don't unregister windows that were never registered
Fixes warnings when trying to unregister the socket window. The socket
window is foreign, so we shouldn't register it in the first place.

https://bugzilla.gnome.org/show_bug.cgi?id=697427
2013-04-08 16:34:19 +02:00
Colin Walters
5e7df8bf14 build: Fix srcdir != builddir 2013-04-08 10:16:58 -04:00
Matthias Clasen
d90ddf85f6 Extract strings from .ui files without intltool 2013-04-08 21:19:29 +09:00
Tristan Van Berkom
92a8c76b31 GtkVolumeButton: Define children with a GtkBuilder template 2013-04-08 21:19:29 +09:00
Tristan Van Berkom
36bacc4674 GtkFontButton: Define children with a GtkBuilder template 2013-04-08 21:19:29 +09:00
Tristan Van Berkom
4c81151a20 GtkFileChooserButton: Define children with a GtkBuilder template 2013-04-08 21:19:29 +09:00
Tristan Van Berkom
42f53ab58e GtkPathBar: Define children with a GtkBuilder template 2013-04-08 21:19:29 +09:00
Tristan Van Berkom
0f3ef7eea6 GtkColorEditor: Define children with a GtkBuilder template 2013-04-08 21:19:29 +09:00
Tristan Van Berkom
65080c6755 GtkColorPlane: Added construct-only properties to setup the adjustments.
This allows basic construction of this private type in GtkBuilder script,
so it can be used in the GtkColorEditor UI.
2013-04-08 21:19:29 +09:00
Tristan Van Berkom
9accb95b9f GtkPrintUnixDialog: Define children with a GtkBuilder template 2013-04-08 21:19:29 +09:00
Tristan Van Berkom
0f16d7c6d5 GtkPageSetupUnixDialog: Define children with a GtkBuilder template 2013-04-08 21:19:29 +09:00
Tristan Van Berkom
a58412027f GtkRecentChooserDefault: Define children with a GtkBuilder template 2013-04-08 21:19:29 +09:00
Tristan Van Berkom
6f8162a2e1 GtkFontChooserDialog: Define children with a GtkBuilder template 2013-04-08 21:19:29 +09:00
Tristan Van Berkom
21391027c4 GtkFontChooserWidget: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
b537e1badd GtkFileChooserDialog: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
bf909f5615 GtkFileChooserDefault: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
09b44d7ab5 GtkColorChooserDialog: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
d50516ebd7 GtkAppChooserDialog: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
ae690479a0 GtkAppChooserWidget: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
c6aa7cc92d GtkStatusbar: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
b9fd422aca GtkScaleButton: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
90cd240c6d GtkAssistant: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
3c39c388c9 GtkLockButton: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
67a2cdb303 GtkAboutDialog: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
56167944e5 GtkInfoBar: Define children with a GtkBuilder template 2013-04-08 21:19:28 +09:00
Tristan Van Berkom
671871b43e GtkMessageDialog: Define children with a GtkBuilder template 2013-04-08 21:19:27 +09:00
Tristan Van Berkom
33f6195d0e GtkDialog: Define children with a GtkBuilder template
As the first composite widget in GTK+, this patch also
adds some Makefile mechanics to list the ui files as
dependencies of the global GTK+ resources, and adds the
initial test case where composite classes should be tested.
2013-04-08 21:19:27 +09:00
Tristan Van Berkom
a41c628a3b Added directory with Glade catalog
This catalog can be used to work with GTK+'s private widget types,
this patch exposes a private function gtk_glade_catalog_init() which
Glade will use for the sole purpose of initializing some private widget
types in GTK+ that are referenced from various GTK+ composite widget
xml files.
2013-04-08 21:19:27 +09:00
Tristan Van Berkom
3b7fc8cdc9 Add Composite Child machinery and APIs to GtkWidget
This commit implements the needed machinery for GtkWidget
to build it's composite content from GtkBuilder XML and
adds the following API:

  o gtk_widget_init_template()

    An api to be called in instance initializers of any
    GtkWidget subclass that uses template XML to build it's components.

  o gtk_widget_class_set_template()

    API to associate GtkBuilder XML to a given GtkWidget subclass

  o gtk_widget_class_automate_child()

    API to declare an object built by GtkBuilder to be associated
    with an instance structure offset and automatically set.

 o gtk_widget_get_automated_child()

   API for bindings to fetch a child declared to be automated by
   gtk_widget_class_automate_child(), for the case where bindings
   do not generate GObjects under the hood and cannot use structure
   offsets to resolve composite object pointers.

 o gtk_widget_class_declare_callback[s]()

   Declare static functions to be used in signal callbacks from
   a given class's template XML

 o gtk_widget_class_set_connect_func()

   API for bindings to override the signal connection machinery
   for a given GtkWidget derived class.
2013-04-08 21:19:27 +09:00
Tristan Van Berkom
64b87824c7 GtkBuilder: Allow G_PARAM_CONSTRUCT properties to be set on internal children.
This patch allows properties of type G_PARAM_CONSTRUCT to be set
on internal children or explicitly constructed objects (built
with <constructor>) while previously, G_PARAM_CONSTRUCT properties
being set on already constructed objects would result in an misinformed
warning that "construct-only properties cannot be set".

G_PARAM_CONSTRUCT_ONLY properties are still refused as parameters
to already constructed children.
2013-04-08 21:19:27 +09:00
Tristan Van Berkom
b7da0d21f8 GtkBuilder: Add private _gtk_builder_extend_with_template()
This adds the definition of the <template> tag with some documentation
on the variant of the format.

_gtk_builder_extend_with_template() is to be used while GtkContainer
builds from composite templates. A couple of error codes are also added
to handle a few new possible failure cases.

DTD Files gtkbuilder.rnc and gtkbuilder.rng have been updated to include
the new <template> tag and it's attributes.
2013-04-08 21:19:27 +09:00
Tristan Van Berkom
82583640a2 GtkBuilder: Added api to allow private signal callbacks
In preperation for composite objects, for better encapsulation
the following APIs are added to allow handling of signals declared
in the XML with callbacks declared statically.

  o gtk_builder_add_callback_symbol[s]()

    Adds a symbol to the internal symbol hash

  o gtk_builder_lookup_symbol()

    Looks up a symbol, exposed in case added symbols are used
    in conjunction with gtk_builder_connect_signals_full()

The default implementation of gtk_builder_connect_signals() now
does not have a strong requirement on GModule (or a strong requirement
on symbols being declared in the global namespace). Instead GModule
is used as a fallback in the case that symbols are not declared
explicitly.
2013-04-08 21:19:27 +09:00
Tristan Van Berkom
4ec6d6006e Work around access to global resources without calling gtk_init()
Some utilities such as GIR and gtk-doc, initialize class vtables without
initializing GTK+, with composite templates accessing resources this
causes a hand full of unneeded warnings.

The workaround for now is the use a private function _gtk_ensure_resources()
which is both called while initializing GTK+, and at the beginning of
gtk_widget_class_set_template_from_resource() (the private function
ensures that the resource will only ever be registered GOnce).
2013-04-08 21:19:27 +09:00
Tristan Van Berkom
c6ab515735 Deprecate gtk_widget_push_composite_child & friends
Deprecate gtk_widget_push_composite_child, gtk_widget_pop_composite_child,
gtk_widget_set_composite_name, gtk_widget_get_composite_name.

This API is just bloat and was never useful, this patch deprecates
it and removes all internal calls to the composite child APIs
2013-04-08 21:19:27 +09:00
Tristan Van Berkom
38dc4733c0 GtkScale: Properly chain up in GtkBuildableIface->custom_finished()
This was causing <style> markup to be ignored when specified
on GtkScale types.
2013-04-08 21:18:47 +09:00
Matthias Clasen
6629e839d0 wayland: Implement gdk_keymap_get_modifier_state 2013-04-06 21:16:38 -04:00
Matthias Clasen
e47689d9ea csd: Implement hide-titlebar-when-maximized 2013-04-06 17:24:29 -04:00
Matthias Clasen
acf56b6cb3 wayland: Fix gdk_keymap_translate_keyboard_state
I was confusing indices and masks here, which made the modifier
translation go wrong. With this commit, accelerators work.
2013-04-06 17:03:27 -04:00
Bruce Cowan
905e4a58bd Updated British English translation 2013-04-06 17:14:06 +01:00
Matthias Clasen
1b2711cde2 wayland: Implement gdk_keymap_translate_keyboard_state 2013-04-06 10:48:57 -04:00
Matthias Clasen
eb9ab7aad4 wayland: Fix up key event translation
The is_modifier field is supposed to be set if the key
would act as a modifier, not if any modifiers are currently
active. To fix this, introduce a private
_gdk_wayland_keymap_key_is_modifier function.

At the same time, make the hardware_keycode field in key
events actually contain the hardware keycode, not a copy
of the keyval.
2013-04-06 10:48:57 -04:00
Matthias Clasen
c659f892ff trivial whitespace fix 2013-04-06 10:48:56 -04:00
Matthias Clasen
720ca63c5d wayland: Return NULL as the keyval name for 0
This is what the X11 backend does, and it makes the "NoSymbol"
disappear from menuitems that don't have an accelerator.
2013-04-06 10:48:56 -04:00
Aron Xu
94fe6cf870 Update Simplified Chinese translation 2013-04-06 22:30:15 +08:00
Wylmer Wang
44f2946408 Update Simplified Chinese translation 2013-04-06 22:18:38 +08:00
Tristan Van Berkom
909e82a2a6 GtkRecentChooserMenu: avoid accessing a NULL action
When the GtkActivatable sets the related action, the activatable
properties are sync'ed. In this case the null check is important
to avoid updating from a NULL action.
2013-04-06 18:46:20 +09:00
Tristan Van Berkom
fbb9447785 gtk_recent_chooser_set_filter: Allow NULL value to unset the filter.
While GtkRecentChooser implementations accept for the "filter" property
to unset the current filter, the API fires an unneeded assertion.

This patch removes the assertion.
2013-04-06 18:06:51 +09:00
Benjamin Otte
8687fbc15e reftests: Add a test for window default size
https://bugzilla.gnome.org/show_bug.cgi?id=697275
2013-04-06 10:47:55 +02:00
Benjamin Otte
70a0d1a32d tests: Remove multiscreen code from teststusicon 2013-04-06 10:47:55 +02:00
Benjamin Otte
4b75077ccd tests: Remove testmultiscreen example
There aren't multiple screens anymore, so no need to test that.

Multiple displays can be tested with gtk-demo and testgtk.
2013-04-06 10:47:55 +02:00
Benjamin Otte
06bd9200cd testgtk: Get rid of screen part in display & screen test 2013-04-06 10:47:55 +02:00
Benjamin Otte
ae2208cd5d gdk: Deprecate gdk_display_get_n_screens() 2013-04-06 10:47:55 +02:00
Benjamin Otte
f8b017faa8 x11: Simplify code for single-screen case 2013-04-06 10:47:55 +02:00
Benjamin Otte
b315868663 gtk: Simplify code for reduced screen count 2013-04-06 10:47:55 +02:00
Benjamin Otte
e255cf15fb icontheme: Remove unused function 2013-04-06 10:47:55 +02:00
Benjamin Otte
f2263afb19 gtk-demo: Remove multiscreen support
There's only one screen per display, so no need to let users select from
a list of that 1 screen.
2013-04-06 10:47:55 +02:00
Tristan Van Berkom
6a90c48ea6 GdkOffscreenWindow: Implement gdk_window_get_frame_extents()
This avoids crashes in gtk_window_get_position() whenever the GdkWindow
is offscreen.
2013-04-06 17:16:09 +09:00
Thomas Hindoe Paaboel Andersen
4e1c9f16a0 reftests/Makefile.am: remove whitespace following trailing backslash 2013-04-05 23:10:32 +02:00
Shankar Prasad
4bc720dea3 Updated kn translations 2013-04-06 00:25:09 +05:30
Alexander Larsson
9a79c3d643 broadway: Unsure we clear the grab on window hide 2013-04-05 17:07:04 +02:00
Alexander Larsson
a6a768437d broadway: Fix warning
Don't pass NULL source_device in grab/ungrab events
2013-04-05 17:07:03 +02:00
Shankar Prasad
10beebd2ab Updated kn translations 2013-04-05 19:20:14 +05:30
Tristan Van Berkom
c771a8a3a6 objects-finalize test: Blacklist gdk_pixbuf_simple_anim_iter_get_type() 2013-04-05 21:11:13 +09:00
Matthias Clasen
cdcc804730 wayland: Implement more keymap functions
This commit implements gdk_keymap_get_entries_for_keyval
and gdk_keymap_lookup_key.
2013-04-05 07:23:00 -04:00
Matthias Clasen
be1e57db1f wayland: Implement gdk_keymap_get_entries_for_keycode 2013-04-05 07:23:00 -04:00
Tristan Van Berkom
33b9865651 Added test case to assert all object types finalize properly.
The test case uses a weak ref to assert objects can finalize,
and then spins the main loop shortly after finalizing to assert
that the finalized object did not leak GSources into the main context
causing latent crashes.
2013-04-05 20:14:38 +09:00
Matthias Clasen
086789d015 wayland: Always initialize directions
I forgot to initialize directionm in gdk_wayland_keymap_new,
leading to crash.
2013-04-04 21:14:53 -04:00
Cosimo Cecchi
eff4be5673 build: bump required GLib version to 2.37.0 2013-04-04 17:17:34 -04:00
Balázs Úr
3d2bf3a530 Updated Hungarian translation 2013-04-04 21:49:01 +02:00
Cosimo Cecchi
de6eca952a bloatpad: add a test for GApplication's busy state
https://bugzilla.gnome.org/show_bug.cgi?id=672018
2013-04-04 13:17:12 -04:00
Alexander Larsson
a2c65d47b0 Fix gtk_window_set_opacity()
We *do* want to call gdk_window_set_opacity() on toplevels, because
this particular case does work.

https://bugzilla.gnome.org/show_bug.cgi?id=697263
2013-04-04 15:42:02 +02:00
Matthias Clasen
246f32a58d wayland: Emit ::direction-changed when appropriate
We always emit direction-changed when we get a new keymap, but
for state changes, we compare old and new direction and only
emit the signal when the direction actually changes.
2013-04-03 23:52:52 -04:00
Matthias Clasen
2f8f1ef485 wayland: Implement keymap direction
This is very similar to the X11 implementation.
2013-04-03 23:45:54 -04:00
Pavel Vasin
5d9c07a061 wayland: display: Fix memory leak
https://bugzilla.gnome.org/show_bug.cgi?id=696767
2013-04-03 19:20:57 -04:00
Pavel Vasin
edbb522f1f GtkHeaderBar: Fix memory leak
https://bugzilla.gnome.org/show_bug.cgi?id=696767
2013-04-03 19:20:54 -04:00
Sébastien Wilmet
14c9023a05 GtkWindow: fix notify of :attached-to
https://bugzilla.gnome.org/show_bug.cgi?id=697200
2013-04-03 19:32:21 +02:00
Alexander Larsson
8084e6e468 broadway: Ensure we allocate shm surface space early
This is nicer then getting random sigbus later
2013-04-03 15:58:42 +02:00
Alexander Larsson
c340dfeaf8 Broadway: Fix shm names
We were sometimes getting zero chars in the name, making them
shorter, due to an off-by-zero in the size.
2013-04-03 15:58:41 +02:00
Alexander Larsson
b7a1561fef broadway: destroy old surface before creating new one
We were not using the old one anyway, and this may in some cases
use less memory (although in most cases the server has a ref to the
surface anyway).
2013-04-03 15:58:40 +02:00
Cosimo Cecchi
a60ddd9a02 window: don't schedule a display of mnemonics if window has no modifier
When the window has no mnemonics modifier set, as in the case of a
GtkMenu, never schedule a display of mnemonics on focus-in.

Previously, for those windows, the GdkModifierType mask fetched from the
device would typically have been zero, leading to the

mnemonic_modifier == (mask & gtk_accelerator_get_default_mod_mask ())

check to succeed, so we would always trigger a display for popup menus.

https://bugzilla.gnome.org/show_bug.cgi?id=697144
2013-04-02 17:39:44 -04:00
Cosimo Cecchi
cfb1e56561 window: refactor a function
Instead of having maybe_set_mnemonics_visible(), separate the checks
from the actual scheduling of mnemonics display.

https://bugzilla.gnome.org/show_bug.cgi?id=697144
2013-04-02 17:39:43 -04:00
Cosimo Cecchi
58209e1138 window: rename functions dealing with mnemonic delayed display
Don't mention "auto mnemonics", since those methods are purely about
scheduling a delayed display, and that makes understanding the code a
bit harder.

https://bugzilla.gnome.org/show_bug.cgi?id=697144
2013-04-02 17:39:42 -04:00
Cosimo Cecchi
68b437eea2 window: reset timeout source id before setting property
gtk_window_set_mnemonics_visible() will try to g_source_remove() it
otherwise, which seems harmless, but conceptually wrong.

https://bugzilla.gnome.org/show_bug.cgi?id=697144
2013-04-02 17:39:39 -04:00
Wojciech Szczęsny
05cb110e0b Updated Polish translation 2013-04-02 16:05:33 +02:00
Rob Bradford
000ed99f3d gdkdisplay: Warn if asked for a non-zero screen not a zero screen
Following on from a6b29d73 this commit correctly warn if you try and use
deprecated multiple screen behaviour.
2013-04-02 12:04:22 +01:00
Benjamin Otte
e69e609bd7 style: Add missing deprecation markers
Some functions in gtkstyle.h were overlooked when we added the
GDK_DEPRECATED macros.

Also add IGNORE_DEPRECATIONS to the few remaining callers of those
functions.
2013-04-02 11:45:45 +02:00
Benjamin Otte
f47f94be42 window: Remove call to gtk_widget_reset_rc_styles()
First of all, that call is deprecated. Second, we don't have RC styles
anymore. Third, what that function does today is invalidate style
contexts, but that happens automatically when setting the screen on the
style context later.

So this function is completely unnecessary.
2013-04-02 11:45:44 +02:00
Benjamin Otte
a55f1f4e95 broadway: Mark deprecated function call
... to avoid gcc warning us. Ideally, we'd not call a deprecated
function here, but I'm lazy.
2013-04-02 11:45:44 +02:00
Benjamin Otte
dc132a9895 broadway: Don't use deprecated API 2013-04-02 11:45:44 +02:00
Benjamin Otte
225dec6940 celrendererspinner: Don't use deprecated API 2013-04-02 11:45:44 +02:00
Benjamin Otte
231520af8f widget: Get rid of deprecation warnings 2013-04-02 11:45:44 +02:00
Benjamin Otte
d80dedf46e testsensitive: Remove deprecated part 2013-04-02 11:45:44 +02:00
Benjamin Otte
a6b29d73d7 gdkdisplay: Remove get_screen() and get_n_screens() vfuncs 2013-04-02 11:45:44 +02:00
Matthias Clasen
88d59448ea Mention display:screen change in release notes 2013-04-01 23:05:51 -04:00
Ryan Lortie
45a94ccc88 tests: improve gtkmenu testcase
Don't just create a menushell and populate it with random data -- verify that
the resulting menu layout is actually correct.

This is introduced in a separate commit because the old code was failing this
part of the test.

https://bugzilla.gnome.org/show_bug.cgi?id=696468
2013-04-01 16:45:20 -04:00
Ryan Lortie
5617b58420 Introduce GtkMenuTracker
GtkMenuTracker folds a nested structure of sections in a GMenuModel into
a single linear menu, which it expresses to its user by means of 'insert
item at position' and 'remove item at position' callbacks.

The logic for where to insert separators and how to handle action
namespaces is contained within the tracker, removing the need to have
this logic duplicated in the 3 or 4 places that consume GMenuModel.

In comparison with the previous code, the tracker no longer completely
destroys and rebuilds menus every time a single change occurs.  As a
result, the new gtkmenu testcase now runs in approximately 3 seconds
instead of ~60 before.

https://bugzilla.gnome.org/show_bug.cgi?id=696468
2013-04-01 16:45:19 -04:00
Ryan Lortie
e250e52175 tests: add a test for gtk_menu_shell_bind()
Borrow the RandomMenu code from the GLib testsuite and hook it up to
gtk_menu_shell_bind().

https://bugzilla.gnome.org/show_bug.cgi?id=696468
2013-04-01 16:45:19 -04:00
Sébastien Wilmet
d599985a41 gtktextattributes: move comment above relevant struct
https://bugzilla.gnome.org/show_bug.cgi?id=697048
2013-04-01 21:12:49 +02:00
Sébastien Wilmet
a5f52afd38 GtkTextTagTable: simplify a bit the code
https://bugzilla.gnome.org/show_bug.cgi?id=697048
2013-04-01 21:12:49 +02:00
Sébastien Wilmet
97dfcc1073 GtkTextView: remove some dead code
https://bugzilla.gnome.org/show_bug.cgi?id=697048
2013-04-01 21:12:49 +02:00
Sébastien Wilmet
6f990fa7e4 gtktextattributes: explain what is "pg_bg"
I didn't know what "pg" stands for.

https://bugzilla.gnome.org/show_bug.cgi?id=697048
2013-04-01 21:12:49 +02:00
Sébastien Wilmet
3a8f70dd1e gtktextattributes: include the right headers
Some function prototypes in gtktexttagprivate.h are implemented in
gtktextattributes.c.

https://bugzilla.gnome.org/show_bug.cgi?id=697048
2013-04-01 21:12:49 +02:00
Sébastien Wilmet
fd84704d94 gtktexttypes: remove inline_byte_begins_utf8_char()
The function was used only in gtk_text_byte_begins_utf8_char().

https://bugzilla.gnome.org/show_bug.cgi?id=697048
2013-04-01 21:12:49 +02:00
Sébastien Wilmet
94f96cb2f9 Doc: fix dead link in the text widget overview
https://bugzilla.gnome.org/show_bug.cgi?id=697048
2013-04-01 21:12:49 +02:00
Sébastien Wilmet
090081ec23 Doc: move the GtkTextAttributes struct
It's more logical to have the GtkTextAttributes and GtkTextAppearance
structs together. And it creates a separation between gtk_text_tag and
gtk_text_attributes functions.

https://bugzilla.gnome.org/show_bug.cgi?id=697048
2013-04-01 21:12:49 +02:00
Alexander Larsson
40c3062d33 broadway: Use wss: on https: uris 2013-04-01 17:44:33 +02:00
Benjamin Otte
f73bf26df0 Deprecate gdk_get_display() 2013-04-01 14:20:47 +02:00
Benjamin Otte
cb2c47597e gdk: Shuffle code around
Make implementation, header and documentation be at the correct place.
2013-04-01 14:20:46 +02:00
Benjamin Otte
47a8c2f733 x11: Make display:screen relation 1:1
Only ever open the default screen.

If apps need support for multiple screens, they need to
gdk_display_open() them manually.
2013-04-01 14:20:46 +02:00
Benjamin Otte
e76cb9daca wayland: Remove unused variable 2013-04-01 14:20:46 +02:00
Matthias Clasen
28fab2eea2 Remove an unused filed in GdkWindowImplWayland
The unused toplevel_window_type field was copied over from
the X backend.
2013-03-31 22:46:31 -04:00
Matthias Clasen
cb4cf67a95 Remove an unused field in GdkWindowX11
The toplevel_window_type field was only ever set to -1, and
never used. The actual, used toplevel_window_type field lives
in GdkWindow.
2013-03-31 22:44:59 -04:00
Ville-Pekka Vainio
17c402c030 Finnish translation update by Jiri Grönroos 2013-03-31 20:27:56 +03:00
Carles Ferrando
07b035a8cc [l10n] Updated Catalan (Valencian) translation 2013-03-31 17:03:03 +02:00
Kristian Høgsberg
4252ac6d6c wayland: Set a wayland-client log handler to print errors we get 2013-03-30 14:20:00 -04:00
Kristian Høgsberg
8886c63a4e wayland: Don't error out on G_IO_HUP until we've read G_IO_IN data
We can get G_IO_HUP and G_IO_IN at the same time, if the compositor writes
data to us and then closes our connection.  Make sure that we dispatch events
always if we have G_IO_IN and then error out if we get G_IO_HUP after that.
2013-03-30 14:20:00 -04:00
Carles Ferrando
50097d5baa [l10n] Updated Catalan (Valencian) translation 2013-03-30 16:24:03 +01:00
Pau Iranzo
9f058ee9cb [l10n] Update Catalan translation 2013-03-30 16:23:35 +01:00
Matej Urbančič
8847f4851c Updated Slovenian translation 2013-03-30 11:13:50 +01:00
Matej Urbančič
b732f7ffe8 Updated Slovenian translation 2013-03-30 11:09:59 +01:00
Matej Urbančič
8229a29280 Updated Slovenian translation 2013-03-30 11:07:17 +01:00
Matej Urbančič
a9ccb18b41 Updated Slovenian translation 2013-03-30 09:47:45 +01:00
Alexander Larsson
e9b8b5c1f0 broadway: Reuse surfaces passed to server
This way we don't have to reopen all the time for pure updates,
and we can immediately unlink the shm file to avoid "leaking" them
on improper shutdown.
2013-03-29 14:09:47 +01:00
Alexander Larsson
c6baa9bc25 broadway: Move surface open to server
This way we can cache the last opened surface
2013-03-29 14:09:47 +01:00
Alexander Larsson
6ef8589a51 broadway: Make chrome work again 2013-03-29 14:09:47 +01:00
Alexander Larsson
8289f4cdc9 broadway: Add support for password authentication 2013-03-29 14:09:47 +01:00
Alexander Larsson
1148a375e5 broadway: Limit window resize based on window geometry 2013-03-29 14:09:47 +01:00
Alexander Larsson
71b4557210 broadway: Sync surface updates with paint clock
We now only update surface data after we have painted. Before we painted
in an idle, which meant we might send black data some times if we e.g.
resized the window and had not painted yet. Also, it means we're updating
less often to the daemon, saving resources.

We still have to queue a flush in the idle for non-draw operations,
otherwise e.g. resize of a toplevel will never be flushed if the clock
is frozen (e.g. during toplevel resize).
2013-03-29 14:09:47 +01:00
Alexander Larsson
a20cb3dd25 broadway: Ensure window sizes are synched right
We don't want to update the window size on configure event, only
the position, as the size is client side controlled. We were
updating to an old size during resizes which causes us to send
surfaces of the wrong size to the daemon.
2013-03-29 14:09:46 +01:00
Alexander Larsson
19e683e62a broadway: Clean up moveresize code 2013-03-29 14:09:46 +01:00
Alexander Larsson
0129876ed3 broadway: Remove leftover cruft that caused resize to fail
getTransientToplevel() doesn't exist anymore so this broke.
2013-03-29 14:09:46 +01:00
Alexander Larsson
e9906138e5 broadway: Fix mouse position typo 2013-03-29 14:09:46 +01:00
Benjamin Otte
0a82b79012 reftests: Add a reftest for color resolving errors
This checks the fixes in the last two commits.
2013-03-28 23:18:59 +01:00
Benjamin Otte
cbee390148 cssvalue: At cycle detection to color resolving
The following CSS would infloop:

@define-color self @self

as it would infinitely lookup the color named "self" and try to resolve
it. This patch adds detection of such cycles to the resolve function by
keeping a list of currently resolving colors in the cycle_list variable.
2013-03-28 23:18:59 +01:00
Benjamin Otte
c25d8e3aea cssvalue: Handle named colors not resolving
If a named color references a nonexistant named color, we didn't catch
that error and ended up crashing on a NULL-dereference.
This crashed Boxes, because its CSS referenced values from the theme
that didn't exist in any theme.
2013-03-28 23:18:59 +01:00
Benjamin Otte
dded6a0673 menuitem: Remove old themeing enhancement
CSS doesn't allow themeing parents based on the state of their children,
so this code just causes extra redraws today.
2013-03-28 23:18:59 +01:00
Benjamin Otte
d20ac0acf9 menushell: Remove unused header 2013-03-28 23:18:58 +01:00
Benjamin Otte
436af3fcb5 menu: Move enum declaration to correct header
That enum is used in GtkMenuShellClass, so put it there.
2013-03-28 23:18:58 +01:00
Benjamin Otte
030c65f299 tearoffmenuitem: Use public API, don't poke GtkMenuPrivate 2013-03-28 23:18:58 +01:00
Chris Cummins
b8ed3e9ef5 wayland: Implement animatable cursors
Cursor animations are handled on a per-device basis, with
GdkWaylandDevice updating the pointer surface for each frame.

https://bugzilla.gnome.org/show_bug.cgi?id=696429
2013-03-28 10:33:57 -04:00
Chris Cummins
4801977d80 wayland: Do not free wayland cursor buffers
The cursor buffer is only non-null when a cursor is created from pixbuf,
so it is not necessary to keep track of whether to free this buffer on
finalize.
2013-03-28 10:33:57 -04:00
Chris Cummins
c022cbae0d wayland: Differentiate wayland and pixbuf cursors
By keeping a pointer to the wl_cursor struct in GdkWaylandCursor, it is
no longer necessary to duplicate cursor data (width, height, hotspots,
etc.) between wl_cursor and GdkWaylandCursor.
2013-03-28 10:33:57 -04:00
Andika Triwidada
5fa97f70b4 Updated Indonesian translation of po-properties 2013-03-28 21:05:50 +07:00
Alexander Larsson
7df7e092b9 GtkOverlay: Respect overlay child min size
Never allocate an overlayed child less than its minimum request.
If the minimum doesn't fit we will gracefully clip via the
widget window.

https://bugzilla.gnome.org/show_bug.cgi?id=696623
2013-03-28 13:32:09 +01:00
Alexander Larsson
785a916267 GtkOverlay: Don't allocate child except in size_allocate
We were calling gtk_overlay_child_allocate() both in realize
and in add as we wanted to create and position the child windows
for the widgets. However, this call also actually called
gtk_widget_size_allocate() on the child, which it shouldn't. In some
cases the overlay is realized before being allocated, and thus it
will allocate the child at 0x0 which is an invalid size for it to be in.
In particular, if the child has margins set this will result in negative
allocations and warnings.

This fix splits out the allocation computation so that
gtk_overlay_create_child_window can use it without callers
having to call gtk_overlay_child_allocate() to move the windows.

https://bugzilla.gnome.org/show_bug.cgi?id=696623
2013-03-28 13:32:06 +01:00
Kristian Rietveld
6f607fc8b4 quartz: move atom/pasteboard type conversions functions to GDK
(cherry picked from commit a269c2f8d2)
2013-03-28 13:10:38 +01:00
Jan Arne Petersen
40c5d37340 docs: Add wayland documentation to Gdk reference 2013-03-27 21:04:05 +01:00
Kristian Høgsberg
abfa4bf0aa wayland: Use the wl_display_sync() request to track pending init roundtrips
Instead of maintaining the init refcount in regular event handlers that can
fire in case of hotplug or mode changes, use a dedicated sync callback
to wait for roundtrips.
2013-03-27 13:44:33 -04:00
Kristian Høgsberg
fc713dffb3 wayland: Pass most recent button press serial to set_popup_surface 2013-03-27 13:39:58 -04:00
Alexander Larsson
9cc64579c2 gdkwindow: Apply layered areas to the shape for native windows
If a window is overlapped by a layered (i.e. partially transparent)
window then that region will not disappear from the native window clip
region. This lets us handle compositing multiple layers of windows.

For native subwindows this doesn't really work. For them we apply the
clip region as a shape to the native window which lets us have client
side windows overlapping the native window. However, with the addition
of the layered stuff the "overlapped-by-alpha-csw" part got broken, as
this area is not removed from the clip region of the native window.

We fix this by also removing the layered area when applying the shape.
This means alpha and alpha backgrounds don't work over native windows,
but there is not much to do about that.

https://bugzilla.gnome.org/show_bug.cgi?id=696370
2013-03-27 12:02:27 +01:00
Alexander Larsson
6374873dcb gdkwindow: Add alpha_bg to window debug print 2013-03-27 12:02:25 +01:00
Matthias Clasen
93efaa5ebe Fix GtkApplicationWindow menubar placement
Since the menubar is part of the content, we need to give
it the content_window as parent window, to make things
work again.
https://bugzilla.gnome.org/show_bug.cgi?id=696561
2013-03-27 00:23:19 -04:00
Matthias Clasen
bdfd0d4638 Don't return FALSE from a non-boolean function
https://bugzilla.gnome.org/show_bug.cgi?id=696608
2013-03-26 23:30:10 -04:00
Matthias Clasen
4987728d7a wayland: Handle seat removal
Also, emit ::device-added and ::device-removed signals
as devices appear and disappear.
2013-03-26 22:57:46 -04:00
Matthias Clasen
28c865b4e2 wayland: Make monitor removal work
The global_removal argument is the _name_ of the object.
We were comparing it to the _object id_ of the object.
To fix this, store the name at the time the object is bound.
2013-03-26 22:16:15 -04:00
Matthias Clasen
ca09a600c3 wayland: Also emit monitors-changed when monitors are unplugged 2013-03-26 21:53:41 -04:00
Matthias Clasen
27e517a445 wayland: Also emit size-changed when appropriate
We need to be a bit more careful when updating the screen
size - the code that was there would not do the right thing
if e.g. the width of one monitor was reduced.
2013-03-26 21:47:49 -04:00
Matthias Clasen
0489fcffbe wayland: Emit monitors-changed when monitors change 2013-03-26 21:37:21 -04:00
Matthias Clasen
93e5d83a9d Don't decrement the init_ref_count towards -infinity
Once we are at zero, initialization is done.
2013-03-26 21:27:21 -04:00
Matthias Clasen
7069f6a251 Pimp up testheaderbar some more 2013-03-26 20:46:30 -04:00
Marek Černocký
119190959c Updated Czech translatio 2013-03-26 23:06:55 +01:00
Kristian Høgsberg
abe7dc6bb4 wayland: Set screen size to bounding box of all outputs
Don't hardcode 8192x8192.  We don't get this info from wayland, so we
compute it as we receive information about the available wl_outputs.

https://bugzilla.gnome.org/show_bug.cgi?id=692871
2013-03-26 17:32:15 -04:00
Kristian Høgsberg
a9e980e578 wayland: Roundtrip until we've receive initial input and output configuration
We use a ref-count mechanism to track whether parts of the init sequence
still needs round trips to receive remaining initial state.  Typically
we need a couple of roundtrips total to get the global list, then the
input and output configurations, but with the ref-count we avoid making
global assumptions like that.

https://bugzilla.gnome.org/show_bug.cgi?id=696340
2013-03-26 14:42:16 -04:00
Chun-wei Fan
b1aa23f4bd Bug 695895: Fix gtk3-demo on Windows
In commit 4e41577b, we are using g_content_type_is_a() to determine how
to display the demo resources in the right pane of the gtk3-demo program.

Use g_content_type_get_mime_type(), so that we can obtain the mime
type of the demo resources on all platforms, as g_content_type_guess()
returns a platform-specific string, as
https://developer.gnome.org/gio/2.35/gio-GContentType.html states.

As .ui files and .css files are normally registered with a different mime
type string on Windows, check for those strings as well.

This will ensure the demo resources can be properly displayed on Windows
as well.
2013-03-26 16:59:16 +08:00
Chun-wei Fan
be2c1ac316 Fix Visual Studio property sheets
The creation of the folder for the "installation" of a11y headers is wrong,
so fix that.
2013-03-26 11:58:33 +08:00
Daniel Korostil
78f2a3acc8 Added uk translation 2013-03-25 22:39:47 +02:00
Mario Blättermann
4c1bab777d [l10n] Updated German translation 2013-03-25 19:29:37 +01:00
Carlos Garcia Campos
5701681df4 gtkprintbackendcups: Fix a crash in avahi_create_browsers()
In avahi_request_printer_list() a new connection to the DBus system bus
is started asynchronously, but it's not cancellable and it's not taking
any reference of the GtkPrintBackendCups. This means that when the
callback is called, the object might have been destroyed already. We can
just pass the cancellable created and check for the cancelled error in
the callback before trying to use the GtkPrintBackendCups. The code to
cancel avahi operations and to unsibscribe from the DBus signals has
been moved from finalize to dispose to make sure it happens as soon as
possible.

https://bugzilla.gnome.org/show_bug.cgi?id=696553
2013-03-25 14:58:03 +01:00
Carlos Garcia Campos
b29cd63c38 gtkprintbackendcups: Fix a crash in gtk_print_backend_cups_finalize()
If GtkPrintBackendCups is finalized and cups_get_printer_list hasn't
been called, g_object_unref is called for the GDBusConnection pointer
that is NULL. Use g_clear_object() instead.

https://bugzilla.gnome.org/show_bug.cgi?id=696546
2013-03-25 14:40:50 +01:00
Alexandre Franke
54c137d1ea Update French translation 2013-03-25 12:07:06 +01:00
Shantha kumar
01bbf60a6b Tamil Translations Updated 2013-03-25 15:18:45 +05:30
Shantha kumar
f7b0cfdc10 Tamil Translations Updated 2013-03-25 15:18:30 +05:30
Ani Peter
05ea936f97 Completed for Malayalam 2013-03-25 14:03:52 +05:30
Matthias Clasen
920ee770ea wayland: Add toolbar settings 2013-03-24 20:21:50 -04:00
Luca Ferretti
613eab94cf [l10n] updated Italian translation 2013-03-24 20:57:35 +01:00
Jan Arne Petersen
8d884bb4fb wayland: Add support for custom surfaces
Allow to set a GdkWindow to use a custom surface instead of a
wl_shell_surface. It allows to register the surface as a custom type
with some Wayland interface.

https://bugzilla.gnome.org/show_bug.cgi?id=695861
2013-03-24 14:31:51 -04:00
Matthias Clasen
38eab78904 broadway: Don't use deprecated gdk_cursor_ref 2013-03-24 14:22:38 -04:00
Sébastien Wilmet
6cb2816c45 GtkWidget: add missing deprecation marks
https://bugzilla.gnome.org/show_bug.cgi?id=696138
2013-03-24 14:22:38 -04:00
Petr Kovar
f69236a6ba Update Czech translation 2013-03-24 19:19:45 +01:00
Sébastien Wilmet
30788062f7 GtkLabel: fix underlining of mnemonics
The underscore was shown in front of the mnemonic instead of underlining
it (e.g., _Save).

Thanks to Lars Uebernickel.

https://bugzilla.gnome.org/show_bug.cgi?id=674759
2013-03-24 15:07:40 +01:00
Ask H. Larsen
c2202e1a31 Updated Danish translation 2013-03-24 14:50:40 +01:00
Mario Blättermann
132fbe5602 [l10n] Updated German translation 2013-03-24 12:53:30 +01:00
Matthias Clasen
d1ad324d3d csd: Reparent the content
This lets us avoid problems with cursor changes.
2013-03-24 01:15:33 -04:00
Matthias Clasen
65cd2a59c3 Make gtk_init_check work as expected
When no GDK backend can be initialized (either because
GDK_BACKEND has been set to the wrong value, or the backends
are simply not included), the expectation is that gtk_init_check
should return FALSE, not error out.
This commit makes it so, by using gdk_display_manager_peek
instead of gdk_display_manager_get in code paths that are used
during initialization.
2013-03-23 19:41:39 -04:00
Matthias Clasen
48d8af85d0 Make gdk_display_open_default_libgtk_only more robust
Make this function return NULL if GDK could not be
initialized. We check this by seeing if there is a
display manager singleton.
2013-03-23 19:40:16 -04:00
Matthias Clasen
c5d7871eda Add gdk_display_manager_peek
Instead of failing with an error if no GDK backend is found like
gdk_display_manager_get(), the new peek function silently returns
NULL.
2013-03-23 19:39:58 -04:00
Matthias Clasen
97ebaee0e2 wayland: Remove a few unused variables 2013-03-23 18:31:20 -04:00
Matthias Clasen
9182eacadf wayland: Don't recreated keymaps on layout change
The GDK model for keymaps expects the keymap object to stay
around and emit a ::keys-changed signal. So, do that. This
should make layout changes work, but it remains untested since
weston does not support layout changes at runtime.

At the same time, plug a memory leak where GdkWaylandKeymap
forgot to free its xkb objects in finalize.
https://bugzilla.gnome.org/show_bug.cgi?id=696339
2013-03-23 18:04:15 -04:00
Tarnyko
0f59ff4550 win32: Bring back spinner animation
Define the spinner animation in css.
https://bugzilla.gnome.org/show_bug.cgi?id=696202
2013-03-23 17:42:55 -04:00
Matthias Clasen
c6d95a7bdc wayland: remove an unused variable 2013-03-23 17:29:28 -04:00
Matthias Clasen
a70acc03c5 wayland: Respect keymap repeat information
xkb has a function to tell us whether a key should be repeated
or not. Lets use that information.
2013-03-23 17:29:28 -04:00
Jorge Pérez Pérez
d22bdc8c0b Updated Aragonese translation 2013-03-23 22:19:11 +01:00
Colin Walters
4f0e9cbf81 gtktoolpalette: Only call gdk_atom_intern when we're constructed
Otherwise we end up trying to instantiate a display manager in
class_init which breaks introspection scanning.

https://bugzilla.gnome.org/show_bug.cgi?id=696457
2013-03-23 17:07:15 -04:00
Colin Walters
d6b4e84957 gdkkeys: Avoid instantiating a display manager if none exists
For introspection scanning which ends up calling class_init() which in
turn calls into the keybindings code, we can just use the fallback
keyval conversion code.

https://bugzilla.gnome.org/show_bug.cgi?id=696457
2013-03-23 17:07:15 -04:00
Marc-André Lureau
564b4e667a win32: do not crash on invalid utf8 conversion
g_utf8_to_utf16() is not guaranteed to succeed. Check the error
and return if it failed.

https://bugzilla.gnome.org/show_bug.cgi?id=696232
2013-03-23 15:50:09 -04:00
Tarnyko
7ffaab3f91 win32: Improve GtkAssistant theming
The highlighted color chosen for GtkAssistant header font
(deep blue) makes it hardly readable is most cases. Switch
to light gray.
https://bugzilla.gnome.org/show_bug.cgi?id=696171
2013-03-23 15:47:39 -04:00
Matthias Clasen
7c8c242e7e Expand testgrid to cover row/column removal 2013-03-23 15:43:38 -04:00
Matthias Clasen
cc86a7bb7e Add gtk_grid_remove_{row,column}
It is sometimes convenient to deal with entire rows or
columns at a time.
https://bugzilla.gnome.org/show_bug.cgi?id=695994
2013-03-23 15:43:37 -04:00
John Lindgren
666d10ec76 Use natural size to set adjustment ranges
This is an (unintentional) side effect of my changes to GtkTreeView's
get_preferred_size() implementation.  It seems odd to me that
GtkTreeView directly determines its own size when inside a
GtkScrolledWindow, but since it does, it should be using its natural
size, not its minimum size.
2013-03-23 19:49:03 +01:00
Vadim Godunko
55012318a6 Fix drawing of grid lines in RTL
The vertical grid lines were not properly positions in
RTL locales.
https://bugzilla.gnome.org/show_bug.cgi?id=696051
2013-03-23 14:01:35 -04:00
Matthias Clasen
d2c8b65fd9 wayland: Pick up more settings
With this commit, we pick up xft settings from GSettings
as well. Among other things, this makes the Large Text
setting work. Still to do: pick up fontconfig changes without
having all clients use up inotify watches for all font
directories.
2013-03-23 13:02:09 -04:00
Yuri Myasoedov
76dabc8551 Updated Russia translation 2013-03-23 20:04:57 +04:00
Tristan Van Berkom
1a088d3aba GtkBuilder: Fixed documentation
The documentation was referring to an <external-object> tag
which we never implemented
2013-03-23 20:44:12 +09:00
Matthias Clasen
ce7c6d58c2 Add gdk_set_allowed_backends
This new function allows programmatic control over the
GDK backends that will be used at runtime.
2013-03-23 00:48:26 -04:00
Matthias Clasen
832c698776 Implement GInitable in GdkBroadwayDisplayManager
Add GInitable implementation and fail the initialisation if it is not
possible to set up a broadway server.
2013-03-23 00:48:25 -04:00
Matthias Clasen
bfcf9e471d Implement GInitable in GdkX11DisplayManager
Add GInitable implementation and fail the initialisation if it is not
possible to connect to the display server.
2013-03-23 00:48:25 -04:00
Thomas Wood
09d0d32af0 wayland: implement GInitable and check the connection to the display server
Add GInitable implementation and fail the initialisation if it is not
possible to connect to the display server.

https://bugzilla.gnome.org/show_bug.cgi?id=694465
2013-03-22 22:25:32 -04:00
Thomas Wood
3a9de35a6c gdk: Implement GInitable on GdkDisplayManager
Add GInitable interface with a default implementation that always
succeeds. This allows backends to override the GInitable implementation
and add their own checks to determine if the backend can be loaded.  If
a backend cannot be loaded, GDK can attempt to load the next available
backend.

Since backends may need to read any relevant options (such as the
display flag) to determine if they can be created successfully, this
patch also removes calls that attempt to create the display manager
before the options have been parsed.

https://bugzilla.gnome.org/show_bug.cgi?id=694465
2013-03-22 22:23:39 -04:00
Matthias Clasen
75f4f7a471 Update cursor theme on wayland
Call the new new api from gtksettings.c when it changes, just
as we do for X11.
https://bugzilla.gnome.org/show_bug.cgi?id=696428
2013-03-22 20:33:47 -04:00
Matthias Clasen
c61956c592 wayland: Implement cursor theme changing
Add gdk_wayland_display_set_cursor_theme and implement it.
2013-03-22 20:30:51 -04:00
Matthias Clasen
8caf1ae7fd wayland: Respect cursor size setting
Respect the cursor size setting when loading the cursor theme.
2013-03-22 19:32:39 -04:00
Matthias Clasen
3278fb9990 wayland: Add cursor-size setting
This will be picked up by cursor themes soon.
2013-03-22 19:27:36 -04:00
Matthias Clasen
37843faea9 wayland: Avoid segfault when cursors are freed
The check for GDK_CURSOR_IS_PIXMAP was ineffective, since _all_
cursors have this type, from the looks of it. Instead, store
buffer ownership information separately.
2013-03-22 19:09:20 -04:00
Matthias Clasen
cc70ac104d wayland: Emit GdkKeymap::state-changed when appropriate
This makes the caps lock warning in password entries work.
2013-03-22 18:34:44 -04:00
Matthias Clasen
1ea760fbc9 wayland: Make key repeat configurable
These might be candidates for a future settings interface; until
then, we use GSettings directly. Note again that we are careful
to avoid a dependency on GNOME schemas.
2013-03-22 18:26:33 -04:00
Matthias Clasen
659ae5172f wayland: Factor out key repeat parameters
This is in preparation for picking these values up from
existing configuration.
2013-03-22 18:09:23 -04:00
Matthias Clasen
9846a37ee3 wayland: Drop an unused variable
The keymap member in GdkWaylandDisplay is not used at all,
so drop it.
2013-03-22 17:53:28 -04:00
Matthias Clasen
6c191b939d wayland: Fix key repeat
Key repeat under X is not affected by modifiers. And on some systems
(e.g my Thinkpad), NumLock is permanently on, rendering key repeat
nonfunctional. This commit changes the Wayland backend to do
key repeat regardless of modifiers.
http://bugzilla.gnome.org/show_bug.cgi?id=695497
2013-03-22 17:43:50 -04:00
Cosimo Cecchi
5568dcb53c appchooserbutton: filter out applications not supposed to be visible
Ensure NoDisplay=true applications don't end up in the list populated by
GtkAppChooserButton.

https://bugzilla.gnome.org/show_bug.cgi?id=696405
2013-03-22 15:27:41 -04:00
Rajesh Ranjan
70cfac0e9a hindi translation 2013-03-22 15:01:16 +05:30
Matthias Clasen
69f12b1090 Don't react to clicks in content
This breaks way too many things, and we explicitly trigger
drags from menubars and toolbars, where we want it.
2013-03-21 18:07:21 -04:00
Matthias Clasen
02a0759c5d csd: Make link activation work reliably
The label code was just letting some button press events bubble
up, which caused misbehaviour with the window dragging code.
https://bugzilla.gnome.org/show_bug.cgi?id=695506
2013-03-21 18:07:21 -04:00
Matthias Clasen
6eaa5ffa8a csd: Allow moving maximized windows
This make the nice 'snap off' feature of gnome-shell work
with client-side decorations. weston moves the maximized window
around, which is less ideal...
2013-03-21 18:07:21 -04:00
Thomas Hindoe Paaboel Andersen
c5145421af wayland: complete cursor_for_pixbuf
Finishes the implementation for loading cursors from pixbufs.

Gnome bug #696223
2013-03-21 18:00:23 -04:00
Kalev Lember
a2cd9983c3 win32: link with -lwinmm
... to resolve the timeBeginPeriod() / timeEndPeriod() symbols after
commit 5dbf814f0c.
2013-03-21 22:55:46 +01:00
Cosimo Cecchi
8fd9575ab6 window: don't add the background style class when drawing CSD elements
We already set it in init, so this is just redundant.
The additional window-content style class here is needed so that we can
distinguish between the full X window background and the background for
the actual window contents.
2013-03-21 16:32:00 -04:00
Cosimo Cecchi
4bcaadac51 window: add a "client-decorated" style class when the window is so
The theme might want to apply some specific theming to a client
decorated toplevel window, so add a style class for that.
2013-03-21 16:31:14 -04:00
Fran Diéguez
2d13802f62 Updated galician translations 2013-03-21 20:30:29 +01:00
Baurzhan Muftakhidinov
fc949e43de Updated Kazakh translation. 2013-03-22 00:24:25 +06:00
Kristian Høgsberg
a80998127c wayland: Clear current cusor on leave so we always set it on enter
Commit 0d9d808217 fixed the hotspot issue,
but commit f2cc52fddd then optimized away
cursor changes a little too aggressively.  We always need to set the
cursor on enter.  Make sure we clear the current cursor on leave so we
don't think it's already set on the next enter.

https://bugzilla.gnome.org/show_bug.cgi?id=695512
2013-03-21 08:54:42 -04:00
Matthias Clasen
5f48934943 Wayland: Read settings out of GSettings directly
Until we figure out where we want to go with settings under
Wayland, this makes GTK+ applications a lot easier to deal
with under Wayland.

Note that we are careful to deal with the absence of schemas,
so this does not introduce a dependency on GNOME settings.
2013-03-21 07:15:59 -04:00
Mario Blättermann
6a690211f6 [l10n] Updated German translation 2013-03-21 09:20:34 +01:00
Matthias Clasen
329f7af159 Fix DND
The removal of the Motif DND code accidentally changed the
value of the TARGET_DELETE enumeration value, breaking DND
pretty badly.
2013-03-21 00:00:19 -04:00
Matthias Clasen
2bc313c624 GtkColorChooserDialog: make alternative button order work
The alternative button order that we set did not actually
work, since the ok button did not have a response id.
Partial fix for
https://bugzilla.gnome.org/show_bug.cgi?id=695493
2013-03-21 00:00:19 -04:00
Kristian Høgsberg
f2cc52fddd wayland: Only set cursor when it changes 2013-03-20 22:59:06 -04:00
Kristian Høgsberg
62eb5d0358 wayland: Add a cursor cache
We avoid creating a new GdkCursor object every time
_gdk_wayland_display_get_cursor_for_name/type() is called.
2013-03-20 22:56:50 -04:00
Kristian Høgsberg
0d9d808217 wayland: Use the pointer enter serial when setting cursor surface
wl_pointer.set_cursor is rejected if the serial number doesn't match
the enter serial number for the wl_pointer.  We passed the right serial
number when setting the cursor surface in response to the enter event.
Later set_cursor requests fail, but we can still attach new buffers to
our cursor surface, which is why the cursor changed, but the hotspot
didn't update.  Clicking in the decoration results in a leave/enter pair
which triggers wl_pointer.set_cursor with the right serial. That's why
clicking the decoration sets the right cursor.

https://bugzilla.gnome.org/show_bug.cgi?id=695512
2013-03-20 22:56:43 -04:00
Matthias Clasen
98801b07b4 GtkColorChooser: Fix selection of colors
Prevent the new window dragging code from interfering with
selection of colors on button release, by handling button
presses we care about instead of letting them bubble up to
the window.
Partial fix for
https://bugzilla.gnome.org/show_bug.cgi?id=695493
2013-03-20 22:21:16 -04:00
Matthias Clasen
26d3fc311b wayland: Keep hotspot when changing cursors
We need to pass the delta between the old and new hotspot
when attaching the new cursor surface, to keep the hotspot
at the same position. We can't deal with this in the compositor,
since the set_cursor call already overwrites the old hotspot,
so the information is lost by the time the attach happens.
Unfortunately, we can't query the initial hotspot from
the compositor, so the first cursor change will make the
hotspot jump.
https://bugzilla.gnome.org/show_bug.cgi?id=695512
2013-03-20 22:21:15 -04:00
Gabor Kelemen
92e0132d38 Updated Hungarian translation 2013-03-21 00:32:51 +01:00
Matthias Clasen
da2a102adb GtkWindow: clean up button event handling
We were not translating event coordinates to the toplevel
window, thus the regions we determined were not right.
We were also not respecting the maximized state, and we
were unnecessarily refusing to handle events when not decorated.
https://bugzilla.gnome.org/show_bug.cgi?id=696197
2013-03-20 18:21:12 -04:00
Balázs Úr
13092b3f3b Updated Hungarian translation 2013-03-20 22:10:37 +01:00
ManojKumar Giri
b846805c29 Updated Odia Translation. 2013-03-20 19:28:12 +05:30
Federico Mena Quintero
0ae26b94f2 Remove a NULL-GError that is no longer useful
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-02-27 18:12:20 -06:00
Federico Mena Quintero
63b9598b51 Don't use inout ints in the drag-action-requested signal
It's not friendly to bindings, and we didn't need an inout parameter anyway.
We use a simple return value from the signal handler now.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-02-27 14:39:39 -06:00
Federico Mena Quintero
bc38811645 Remove a couple of FIXMEs 2013-02-27 14:17:10 -06:00
Federico Mena Quintero
a7213e3ccf Disallow drops on the recent:/// item
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-02-27 14:04:33 -06:00
Federico Mena Quintero
3363974c09 Remove temporary debugging code
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-02-27 14:04:23 -06:00
Federico Mena Quintero
0d95705bd5 GtkTreeView: Add some CSS for the 'dnd' style class so drawing the drag-dest-row works
The default CSS didn't have anything for GtkTreeView's 'dnd' style class.  So,
the call to gtk_render_frame() to draw the highlight frame for the drag-dest-row
was getting a border-width of 0, and nothing was drawn as a result.

Now we just copy the default from Adwaita, but make the border-radius 0, to make it
square like the rest of the Raleigh theme...
2013-02-27 13:51:19 -06:00
Federico Mena Quintero
6d94f8a56c Don't allow drops in unmounted volumes
Unmounted volumes don't have a URI yet, so we can use that to distinguish them
from within the DnD code.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-02-27 12:16:31 -06:00
Federico Mena Quintero
dbf98bcfeb Properly indicate when new bookmarks are being dropped between other bookmarks
We weren't handling the drag-URIs-as-bookmarks case in drag_motion_callback().

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-02-27 12:08:16 -06:00
Federico Mena Quintero
a46976fb79 Merge branch 'origin/master' into places-sidebar 2013-02-27 10:29:35 -06:00
Federico Mena Quintero
936045e82b Merge branch 'master' into places-sidebar
Conflicts:
	docs/reference/gtk/gtk-docs.sgml
	gtk/gtkfilechooserdefault.c
	gtk/org.gtk.Settings.FileChooser.gschema.xml
2013-02-13 20:37:36 -06:00
Federico Mena Quintero
04dbec4191 Allow dropping URIs as bookmarks between existing bookmarks
The before-drop machinery was already in place; here we implement the actual
dropping.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-02-05 14:44:58 -06:00
Federico Mena Quintero
46acb933cd Remove the accept-uri-drops property
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-01-29 01:16:09 -06:00
Federico Mena Quintero
fafec940b3 Redo the logic for computing drop positions
Instead of having an accept_uri_drops flag, we'll always advertise as accepting URI drops.
However, we'll see if the caller actually handles the drag-action-requested signal.  If it
does, we'll indeed allow performing file operations when URIs are dropped.  Otherwise,
we'll only allow creating bookmarks from dragged URIs.

Dragging URIs directly into a places item will cause the sidebar to check if the caller
allows file operations.  Dragging URIs between places items will cause the sidebar
to create bookmarks for those URIs instead.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-01-29 01:14:10 -06:00
Federico Mena Quintero
2a35574067 Whitespace cleanups 2013-01-29 01:02:57 -06:00
Federico Mena Quintero
4bff4b025b Reset the treeview drag dest row if the drop is not possible
This keeps the drop indicator line from 'sticking' if you drag a bookmark above
the Bookmarks heading.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-01-25 18:01:42 -06:00
Federico Mena Quintero
f3fb51e96b Remove TODO items that are done 2013-01-24 18:46:07 -06:00
Federico Mena Quintero
fc9489f381 Use GFile in the DnD signals instead of URIs
The rest of the public API works in terms of GFile, so remove this last remnant
of passing URIs around.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-01-21 17:59:44 -06:00
Cosimo Cecchi
a8f3465181 Add some missing annotations 2013-01-21 18:23:25 -05:00
Cosimo Cecchi
21a07a5760 Add GObject properties and C getters 2013-01-21 18:21:00 -05:00
Cosimo Cecchi
742a2f11a9 Remove useless style_set override 2013-01-21 18:04:14 -05:00
Cosimo Cecchi
f5b91b9176 Update TODO 2013-01-21 17:49:58 -05:00
Cosimo Cecchi
f59a618db9 Apply custom names to XDG dirs if possible
And make it possible to rename them
2013-01-21 17:49:01 -05:00
Cosimo Cecchi
03f220e4c2 Don't add built-in bookmarks twice 2013-01-21 17:49:01 -05:00
Cosimo Cecchi
35a56ba987 Add API to GtkBookmarksManager for built-in bookmarks
I.e. those that are added automatically from XDG dirs.
2013-01-21 17:32:02 -05:00
Cosimo Cecchi
aafd97be83 Mark a function as static 2013-01-21 17:12:48 -05:00
Cosimo Cecchi
7fa38fd6fb Use g_clear_object() 2013-01-21 17:07:12 -05:00
Cosimo Cecchi
a97a5d3049 Don't unconditionally unref potentially NULL objects
We already have != NULL checks here, so fold the unrefs inside.
2013-01-21 17:06:42 -05:00
Cosimo Cecchi
0523b2f719 Avoid an useless ref/unref
The GMount will be kept alive by the async operation itself.
2013-01-21 17:00:50 -05:00
Cosimo Cecchi
ceb631b60f Fix a FIXME about using symbolic icons
Use g_file_info_get_symbolic_icon() for it.
2013-01-21 16:57:27 -05:00
Cosimo Cecchi
2cf8970f91 Sync from Nautilus commit 463e8d1b1922474e4cf591a3029ea813804bd3e7
make sure to always notify when unmounting
2013-01-21 16:48:52 -05:00
Cosimo Cecchi
eea192adaa Sync from Nautilus commit 480b1daf8814063f348d0f75082353a2f6a3eab3
cancel the hostnamed proxy creation on dispose
2013-01-21 16:38:23 -05:00
Federico Mena Quintero
26a5391caa Add some missing docs for GtkPlacesSidebar
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-01-18 20:05:00 -06:00
Federico Mena Quintero
223a30d1b9 Add GtkPlacesSidebar to the gtk-doc machinery 2013-01-18 17:52:10 -06:00
Federico Mena Quintero
52d07c9148 Add toplevel docs for the sidebar
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-01-18 17:18:25 -06:00
Federico Mena Quintero
4cad0db95a Add docstrings for the signals
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-01-11 17:55:36 -06:00
Federico Mena Quintero
306dcd3956 Add missing docstrings to public functions 2013-01-10 20:07:27 -06:00
Federico Mena Quintero
8a4e96f8cd Oops, removed unused icon field 2013-01-10 19:37:24 -06:00
Federico Mena Quintero
da2e081786 Make the set_location()/get_location() API consistent
We used to have set_current_location() and get_selected_location(), with confusing
semantics.  Now they are symmetric, with the exception that if set_location() is
called with a location that is not shown in the sidebar, then it will both clear
the selection in the list and make get_selection() return NULL.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-01-10 18:12:15 -06:00
Federico Mena Quintero
0b4183234b New API, gtk_places_sidebar_set_open_flags()
This lets us handle the 'Open in new tab' and 'Open in new window' menu items
on our own, and allows callers to have less code to deal with each mode.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-01-10 16:19:03 -06:00
Federico Mena Quintero
439a770efa Use GtkTrashMonitor instead of an API to set the trash state
This lets us remove two entry points, gtk_places_sidebar_set_show_trash(),
and gtk_places_sidebar_set_trash_is_full().

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-01-10 15:06:01 -06:00
Federico Mena Quintero
ee261203cb Add a GtkTrashMonitor private API
This is analogous to NautilusTrashMonitor in that it just monitors trash:///
and is able to return the appropriate icon for the trash's current state.

Later we may want to move this utility object into GIO or something.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2013-01-10 14:36:27 -06:00
Federico Mena Quintero
ff041608ec Remove to-do items for Nautilus; they are done now 2013-01-08 16:34:15 -06:00
Federico Mena Quintero
8dd233dfac New public function to get the selected location from menu item callbacks
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-17 20:05:23 -06:00
Federico Mena Quintero
bfa1f4ac0b Emit the populate-popup signal so the caller can spice things up
Also, we factor out the process of getting the selected item's info out of
the liststore.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-14 21:44:50 -06:00
Federico Mena Quintero
d0d02357e0 Remove the Properties menu item
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-14 18:15:49 -06:00
Federico Mena Quintero
335ce0edc6 Remove the Empty Trash menu item
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-14 18:08:50 -06:00
Federico Mena Quintero
55927f273d Remove the multiple-tab/windows-supported APIs
We'll have the caller do these instead via the populate-popup signal.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-14 18:04:30 -06:00
Federico Mena Quintero
fc01ce0756 Rebuild the popup menu every time it is used
We'll need to rebuild it every time for the populate-popup signal.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-14 17:56:53 -06:00
Federico Mena Quintero
e00498fcd8 New signal populate-popup
Instead of conditionally creating contextual menu items like 'Show file properties',
we'll instead let the caller populate the popup menu, as is done for GtkEntry.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-14 11:57:49 -06:00
Federico Mena Quintero
42d239f6d5 Remove gtk_places_sidebar_set_show_cwd(), implement that in the file chooser
This removes more idiosyncratic API from the sidebar.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-11 15:52:17 -06:00
Federico Mena Quintero
c4f40a92ca Remove the GError from the shortcut-related functions
See https://bugzilla.gnome.org/show_bug.cgi?id=650363#c8 and the next comment; this
argument just makes the API harder to use without real benefit.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-11 15:29:11 -06:00
Federico Mena Quintero
72ce506cfc Rename signal location-selected to open-location
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-11 12:09:13 -06:00
Federico Mena Quintero
e4d5e66d44 Remove another to-do 2012-12-10 17:28:07 -06:00
Federico Mena Quintero
9124766d7b Implement the Search keyboard shortcut
We still lack a button to activate Search, like in Nautilus, but that will come later.

And with this, the last REMOVE_FOR_PLACES_SIDEBAR is gone!

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-10 17:26:53 -06:00
Federico Mena Quintero
bd28aad834 Remove unused code 2012-12-10 17:16:36 -06:00
Federico Mena Quintero
c1c1823634 Go back to our machinery for Recent files instead of reading recent:/// as-is
Reading recent:/// as-is is probably fine for OPEN mode.  But for SAVE mode, we want to present
a list of recent directories.  So, we go back to our old machinery for now; in the future
we'll probably just use recent:/// and extract the list of recent directories from there.

This also fixes showing the Recent item as highlighted when the file chooser starts up.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-10 17:14:12 -06:00
Federico Mena Quintero
016dd28a9f Remove an obsolete function 2012-12-10 16:05:18 -06:00
Federico Mena Quintero
c26293eacd Implement the Alt-number quick bookmark shortcuts
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-10 16:00:42 -06:00
Federico Mena Quintero
8b0aea9f3d Implement the Desktop keyboard shortcut
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-10 14:45:18 -06:00
Federico Mena Quintero
e6ba6e7e06 Implement the Home keyboard shortcut
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-10 14:23:06 -06:00
Federico Mena Quintero
f3beff7556 Implement the 'Add to bookmarks' command as before
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-10 14:18:00 -06:00
Federico Mena Quintero
0dca40e851 Remove an obsolete function 2012-12-10 14:09:40 -06:00
Federico Mena Quintero
976672ad4b Implement the application-side shortcuts in GtkFileChooserDefault
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-10 14:06:07 -06:00
Federico Mena Quintero
e4c70bb691 New machinery to add application-specific shortcuts
The file chooser needs them for gtk_file_chooser_add_shortcut_folder() and friends.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-07 13:42:39 -06:00
Federico Mena Quintero
19001bafaa One less to-do
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-06 12:11:30 -06:00
Federico Mena Quintero
1681cf9b16 Remove the old shortcuts pane code from GtkFileChooserDefault
Oh, the giant void.
I stare into it
and it makes me afraid
that I've screwed up.

But I know I haven't.
Because any remaining bugs
will be yours to fix.

Not mine.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-05 18:09:44 -06:00
Federico Mena Quintero
eecda25d64 Allow not setting a changed callback on GtkBookmarksManager 2012-12-05 18:03:54 -06:00
Federico Mena Quintero
489000ba9a Remove obsolete comment 2012-12-05 17:44:49 -06:00
Federico Mena Quintero
35866c8ac6 Sync from Nautilus commit bde2536ee72672c4cd58af7cbb3cf42a42962c21
Use ellipsis character instead of dots
2012-12-05 17:44:14 -06:00
Federico Mena Quintero
1bd5eeabb2 Sync from nautilus commit b2e8339d9f49770db0f6a523c8bf77b11d7eace3
Simplify setting eject icon

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-05 16:56:15 -06:00
Federico Mena Quintero
e7d6e788e3 Sync from nautilus commit 0177dd24a5f7f9f5302745a865eb970a35faa78c 2012-12-05 16:51:32 -06:00
Federico Mena Quintero
221095d287 Add list of pending things in GtkPlacesSidebar 2012-12-05 16:51:15 -06:00
Federico Mena Quintero
6fcf8a78ef Remove comments on things that Nautilus no longer needs to do 2012-12-04 18:25:44 -06:00
Federico Mena Quintero
be492a206f Use the right signal id
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-04 18:18:32 -06:00
Federico Mena Quintero
686814e0e6 Removed unneeded signal initiated-unmount
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-04 18:09:38 -06:00
Federico Mena Quintero
d257cd0270 Oops, forgot to commit this header file.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-04 18:08:52 -06:00
Federico Mena Quintero
b22e553095 Oops, signals returning an int must be G_SIGNAL_RUN_LAST
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-04 17:37:45 -06:00
Federico Mena Quintero
56331a4c43 Port code to add a bookmark for a volume
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-04 16:16:49 -06:00
Federico Mena Quintero
10b22e0ee2 New API to set whether URI drops are accepted
The file chooser will not accept dropping URIs in a shortcut item.  However, Nautilus will,
to perform normal DnD for files.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-04 12:57:48 -06:00
Federico Mena Quintero
4fe86f1d10 Emit drag-perform-drop when we need the caller to do the drop action
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-04 12:52:44 -06:00
Federico Mena Quintero
221ea9d4c5 New signal drag-perform-drop
The caller is supposed to take action with the specified URIs.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-04 12:44:46 -06:00
Federico Mena Quintero
f46b26d245 New signal drag-action-ask
We'll ask the caller to present a popup menu (or whatever) with the possible drag actions.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-03 18:15:41 -06:00
Federico Mena Quintero
a5184c2eb1 Emit drag-action-requested and feed the result to gdk_drag_status()
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-03 17:37:11 -06:00
Federico Mena Quintero
0a2f9b7313 New signal drag-action-requested
We'll use this signal to ask the caller about what drag action to indicate
when something is being hovered on an item in the places sidebar.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-03 17:32:10 -06:00
Federico Mena Quintero
08334f5258 Free URI lists
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-03 16:45:25 -06:00
Federico Mena Quintero
0a0eee816a Rename function for clarity
build_selection_list() -> build_uri_list()

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-12-03 16:41:02 -06:00
Federico Mena Quintero
e09b568b68 Remove the menu items to select recent-files or CWD
Per the gtk-devel meeting on 2012/11/29, we'll not have a UI in the file chooser dialog
to select between those modes.  Instead, we'll show that key in gtweaktool.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-11-30 11:08:08 -06:00
Federico Mena Quintero
c16654bb75 Ahem, read radio menu items like I knew how to do it
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-11-26 20:43:23 -06:00
Federico Mena Quintero
bd9532d23f Restore the originally-selected location when dynamically updating the bookmarks
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-11-24 11:18:23 -06:00
Federico Mena Quintero
637bd8f2b8 Oops, actually update the internal location of the places sidebar prior to notifying the caller
This is so that the sidebar will already know the URI of the location it is showing.  When
the caller asks the sidebar to change back to the same location, the call will be idempotent.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-11-24 10:59:48 -06:00
Federico Mena Quintero
b706e1b76b Highlight the currently-viewed location in the places sidebar
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-11-24 10:41:40 -06:00
Federico Mena Quintero
e0b30d013e Turn gtk_places_sidebar_set_current_uri() into _set_current_location()
To be consistent with the ::location-selected signal, which emits a GFile, we now also use a GFile
instead of a string URI in the inbound API.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-11-24 10:41:11 -06:00
Federico Mena Quintero
fc6bfcddde Actually switch to recent:/// in its key shortcut handler
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-11-23 13:24:55 -06:00
Federico Mena Quintero
f623329e95 Allow switching to recent:/// even though GIO thinks it is not a native file
That URI is not a native file, and so it would not show up if local_only=TRUE.
Add a special case for it so that recent:/// can always be visited.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-11-23 12:53:41 -06:00
Federico Mena Quintero
791bd3cec2 Update the widgets until all of them have been created
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-11-21 13:16:44 -06:00
Federico Mena Quintero
fe6814061d Add menu items to the places sidebar to configure the startup mode
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-11-21 13:16:43 -06:00
Federico Mena Quintero
e6b9ad404f Switch to Recent Files or $CWD at startup
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-11-21 13:16:43 -06:00
Federico Mena Quintero
043cac11f3 Add a new org.gtk.SettingsFileChooser startup-mode settings key
It has two possible values, 'recent' and 'cwd'.  We will use these to determine
whether to set the default starting mode, if a folder has not been pre-set,
to showing the Recent Files list or the current working directory.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-11-21 13:16:41 -06:00
Federico Mena Quintero
ec9bdc6397 New way to show in the sidebar
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-11-20 20:04:20 -06:00
Federico Mena Quintero
5741b0e661 Note about missing empty-trash functionality when unmounting a volume.
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-10-29 18:57:24 -06:00
Federico Mena Quintero
26a29c7877 Fix code to unmount volumes
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-10-29 18:53:41 -06:00
Federico Mena Quintero
de5f5b7cef Copy code from Nautilus to mount volumes
Instead of having a nested-callback scheme (to preserve internal API compatibility),
we use a direct callback from g_volume_mount().

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-10-29 14:28:12 -06:00
Federico Mena Quintero
18f3c4d94c Set GTK_STYLE_CLASS_SIDEBAR on the sidebar
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-10-29 12:40:42 -06:00
Federico Mena Quintero
84f218aaac Remove some more comments on things that Nautilus needs to do
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-10-26 18:53:09 -05:00
Federico Mena Quintero
a4cd479021 Remove some notes on things that Nautilus should do but already does
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-10-26 13:05:56 -05:00
Federico Mena Quintero
cdefdcb4ba Add a show-file-properties signal for Nautilus to use
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-10-22 18:21:17 -05:00
Federico Mena Quintero
e97869a69c Note on more things that Nautilus needs to do 2012-10-22 17:53:32 -05:00
Federico Mena Quintero
61a9a46bce Present error dialogs from the places sidebar 2012-10-22 17:52:27 -05:00
Federico Mena Quintero
d02f884d22 Oops, reorder the bookmarks list correctly
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-10-20 14:09:34 -05:00
Federico Mena Quintero
948a7be7f7 Enable code to reorder bookmarks by dragging 2012-10-20 14:00:50 -05:00
Federico Mena Quintero
eb40a6cc68 Sync from Nautilus commit b72d57b038e50172fac2fafdc6c26660378aab34
No changes (except a whitespace fix), for we already had a copy of
special_directory_get_gicon().
2012-10-20 13:34:23 -05:00
Federico Mena Quintero
2af5ce906e Add comment about missing way to get symbolic icons for bookmarks
Nautilus got the ability to do that in commit 0ed400b9c1692e42498bff3c10780073ec137f63.
Maybe we should just copy that code to here later.
2012-10-19 12:26:40 -05:00
Cosimo Cecchi
dc40569628 Sync from Nautilus: bookmark: remove unused GIcon argument to nautilus_bookmark_new()
We always pass NULL these days.
This is from nautilus commit 7aad4a33814e6e7fae5e762882db43452a575a83
2012-10-19 12:14:21 -05:00
William Jon McCann
03119a2b5d Sync from Nautilus - Fix leaks
https://bugzilla.gnome.org/show_bug.cgi?id=683769
This is from nautilus commit a755aa27c636561a1ab41066484cf9bcc97667f9
2012-10-19 12:12:19 -05:00
Federico Mena Quintero
1dfd0e8c9b Merge master into places-sidebar to keep up with development 2012-10-19 11:35:22 -05:00
Federico Mena Quintero
4de4d6a6a7 Use symbolic icons
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-11 16:05:29 -05:00
Federico Mena Quintero
ddefb8622c I guess I can call myself a coauthor of this now
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-11 15:45:56 -05:00
Federico Mena Quintero
e3d12e8295 Add machinery for Nautilus to set up the trash state
We add a method to say whether the trash is full/empty (to use the appropriate icon),
and a signal that the sidebar can use to request that the trash be emptied when
the user selects 'Empty trash' from the context menu.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-11 15:44:29 -05:00
Federico Mena Quintero
6868e0e239 Remove unused field
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-11 15:21:58 -05:00
Federico Mena Quintero
6ed2217eda Implement bookmark reordering, at least the core
The drag-and-drop part is missing; that still needs de-nautilus-ifying.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-11 15:17:03 -05:00
Federico Mena Quintero
8b1eb6db99 Factor out code to find a bookmark in the list of bookmarks
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-11 15:02:01 -05:00
Federico Mena Quintero
caf659e791 Add set_show_properties and set_show_trash APIs
Currently they default to false.  This also fixes warnings with uninitialized widgets
in bookmarks_check_popup_sensitivity().

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-11 14:33:47 -05:00
Federico Mena Quintero
992602e106 Make renaming bookmarks work
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-10 15:03:13 -05:00
Federico Mena Quintero
865e8d3aa4 Make removing bookmarks work
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-10 14:43:30 -05:00
Federico Mena Quintero
f05874a1f0 If a bookmark doesn't have an explicit label, use the display name of the file
We query the file info for display name and icon synchronously.  If it becomes a problem,
we'll make it async, more in line with NautilusBookmark.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-07 14:36:05 -05:00
Federico Mena Quintero
86c3274579 Connect to location-selected on the places sidebar, and actually switch folders\!
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-07 14:35:56 -05:00
Federico Mena Quintero
a7ea37f55d Sync with NautilusPlacesSidebar
This syncs the code up to commit 4b6abf644b from Nautilus.
This only refers to nautilus-places-sidebar.[ch].

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-07 11:11:20 -05:00
Federico Mena Quintero
abdef8aca0 Use the correct GTK_TYPE_PLACES_OPEN_MODE instead of a generic enum type
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-05 20:13:25 -05:00
Federico Mena Quintero
4fe3cd8f1e Create the places sidebar instead of the old custom treeview
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-05 19:48:16 -05:00
Federico Mena Quintero
2e9f9d2dc5 Fix compilation 2012-09-03 21:30:38 -05:00
Federico Mena Quintero
e49edba462 Add missing includes 2012-09-03 21:30:38 -05:00
Federico Mena Quintero
86c784e277 Fix compilation 2012-09-03 21:30:23 -05:00
Federico Mena Quintero
2aec19e907 #if out another bunch of stuff, to make the fucking thing compile 2012-09-03 20:56:18 -05:00
Federico Mena Quintero
c242e88a37 #if out a few things 2012-09-03 20:55:59 -05:00
Federico Mena Quintero
19ef71897d Add gtkplacessidebar.[ch] to Makefile.am and fix compilation errors
Signed-off-by: Federico Mena Quintero <federico@gnome.org>

Conflicts:
	gtk/Makefile.am
2012-09-03 20:55:52 -05:00
Federico Mena Quintero
4f9b06da56 Add a bunch of '#if DO_NOT_COMPILE' to remove nautilus-isms temporarily
This is just so that I can start compiling this file and testing it.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:54:49 -05:00
Federico Mena Quintero
b31b7e3ed4 Remove stale code to deal with preferences
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:54:44 -05:00
Federico Mena Quintero
5661b7b991 Don't leak the bookmarks when enumerating them
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:54:40 -05:00
Federico Mena Quintero
8f786e0b12 Insert bookmarks during drag-and-drop operations
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:54:37 -05:00
Federico Mena Quintero
9de31fc317 Replacement for nautilus_get_desktop_directory()
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:54:32 -05:00
Federico Mena Quintero
2aaf82cb24 Replacement for eel_pop_up_context_menu()
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:54:28 -05:00
Federico Mena Quintero
92e1b8e31f Replace eel_gtk_menu_append_separator()
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:54:24 -05:00
Federico Mena Quintero
cbd3c6ca12 Replace eel_create_spotlight_pixbuf()
We use the normal gtk_style_context_set_state() machinery to set a
prelighted state.  Hopefully even symbolic icons will be rendered
prelighted properly.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:54:19 -05:00
Federico Mena Quintero
f404eb41b5 Get icons for user-special directories
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:54:15 -05:00
Federico Mena Quintero
c942ed77d2 Use the correct icon for trash
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:54:11 -05:00
Federico Mena Quintero
3e26fda89b Replace an icon name with a macro
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:54:07 -05:00
Federico Mena Quintero
06a9d19f9a Don't use gtk_icon_theme_get_default(); use the screen-specific theme
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:54:03 -05:00
Federico Mena Quintero
76ec7fb005 Replacement for the NautilusIconInfo machinery
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:53:57 -05:00
Federico Mena Quintero
4759365590 New signal show-error-message
We need to ask the caller to pop up error messages for us, so it can do
it with its own conventions:  pick the right transient window, use a status
bar rather than a dialog, etc.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:53:53 -05:00
Federico Mena Quintero
a4ac2d5958 Replacement for eel_gtk_tree_view_set_activate_on_single_click()
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:53:49 -05:00
Federico Mena Quintero
28f44a3b71 Function to set whether to show the Desktop item
It sucks to have this as an app-settable option.  Maybe we should
make this a standard GSetting thing and be done with it.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:53:44 -05:00
Federico Mena Quintero
7be881982f Add functions to say whether multiple tabs/windows are supported
The file chooser will leave these off by default; file managers
like Nautilus will turn them on.

These control whether the places sidebar shows 'open in new tab' and similar
items in its context menu.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:53:38 -05:00
Federico Mena Quintero
01020ccc81 Replace an icon-size macro from Nautilus 2012-09-03 20:53:33 -05:00
Federico Mena Quintero
f68609f6fe Use macros for themed icon names
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:53:29 -05:00
Federico Mena Quintero
d027b2d3b1 Tentatively accept any drags of URI lists
Don't try to decide if the URIs are acceptable / not duplicates; the
idea is to let the user bookmark whatever he pleases.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:53:22 -05:00
Federico Mena Quintero
0f2f7ae5ee Use our own function to compute icon sizes
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:53:18 -05:00
Federico Mena Quintero
644d8e4b64 Replace nautilus_window_set_initiated_unmount() with an initiated-unmount signal
This signal just carries a boolean initiated_unmount argument, which
is meant to say True when the unmount/eject starts, and False when
the operation finishes.

We may want to rename all of this to unmount_started / stopped, etc.
I don't know if the caller needs to know about the mount_op in question,
or if it can be inferred from what the caller knows to be the current
shown location on the GtkPlacesSidebar.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:53:11 -05:00
Federico Mena Quintero
acccb10fd7 Remove the use of NautilusWindow
Now we just need to see if we need to replace calls to
nautilus_window_set_initiated_unmount() with a signal.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:53:07 -05:00
Federico Mena Quintero
6287ee4e8f Remove the last use of nautilus_window_slot_get_current_uri()
This is just sidebar->uri, the current URI in the sidebar.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:53:01 -05:00
Federico Mena Quintero
c2a922bfcb Replacement for nautilus_get_home_directory_uri()
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:52:55 -05:00
Federico Mena Quintero
0bc1be008c Make the main update_places() use GtkBookmarksManager
There are still some missing pieces to get the bookmark's icon,
and *maybe* to cull the list of bookmarks based on some criteria.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:52:51 -05:00
Federico Mena Quintero
0be8218608 Create the bookmarks manager from the places sidebar
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:52:46 -05:00
Federico Mena Quintero
b8b6d592e6 Cancel and disconnect from the bookmarks monitor when done
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:52:40 -05:00
Federico Mena Quintero
36969380b3 Read the legacy bookmarks file
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:52:27 -05:00
Federico Mena Quintero
163beca279 Remove the bookmarking bits from GtkFileSystem
Signed-off-by: Federico Mena Quintero <federico@gnome.org>

Conflicts:
	gtk/gtkfilesystem.c
2012-09-03 20:51:58 -05:00
Federico Mena Quintero
06bfe5bd43 Make GtkFileChooserButton use GtkBookmarksManager
It's unfortunate that now we have two instances of the bookmarks manager
for each GtkFileChooserButton; one for the button itself and one for the
underlying GtkFileChooserDefault.  We may refactor that in the future.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:42:36 -05:00
Federico Mena Quintero
60f8411998 Make gtk_places_sidebar_set_current_uri() handle NULL URIs to unselect all
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:42:31 -05:00
Federico Mena Quintero
30c2fc3dc0 Make GtkFileChooserDefault use GtkBookmarksManager
It no longer uses GtkFileSystem to deal with bookmarks.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:42:26 -05:00
Federico Mena Quintero
d0196e99e1 Split out a GtkBookmarksManager from gtkfilesystem.[ch]
We had the bookmarks machinery in GtkFileSystem for historical reasons.
Now, we'll keep this separately.  This will allow us to make the
bookmarks machinery public if needed in the future.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>

Conflicts:
	gtk/Makefile.am
2012-09-03 20:42:04 -05:00
Federico Mena Quintero
91b3ad95c6 Rename NautilusShortcutsModelFilter to ShortcutsModelFilter
It's unfortunate that we need a filter model to do the DnD stuff...

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:39:02 -05:00
Federico Mena Quintero
f2d46f3991 New 'location-selected' signal
Instead of directly calling the Nautilus machinery to open locations
in tabs or windows, we emit a signal which the caller must handle.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:38:59 -05:00
Federico Mena Quintero
5d1620f0c0 Add a GtkPlacesOpenMode enum to say how a shortcut should be opened
Nautilus lets you open things in the same tab, in a new tab, or in
a new window.  We will expose these semantics through an enum, as
part of an 'open' signal.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:38:55 -05:00
Federico Mena Quintero
4284d74b3f Remove the 'nautilus' prefix from some constants
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:38:51 -05:00
Federico Mena Quintero
1093e1433e Add gtk_places_sidebar_set_current_uri()
And remove the code that updated the current URI automatically based
on a NautilusWindow.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:38:42 -05:00
Federico Mena Quintero
554bb2e18a Connect to the volume monitor at the time of its creation
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:38:38 -05:00
Federico Mena Quintero
f7312ce63c Don't take a NautilusWindow argument in gtk_places_sidebar_new()
We will move the window-related initialization to ::map() or to a constructor.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:38:34 -05:00
Federico Mena Quintero
4484d750f5 Update the top comment in gtkplacessidebar.c
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:38:28 -05:00
Federico Mena Quintero
2f9964f48c Remove unused structs
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:38:24 -05:00
Federico Mena Quintero
c64d6b0c5a Export GtkPlacesSidebar and the Class types, for subclassing
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:38:20 -05:00
Federico Mena Quintero
f8fea85f9b Remove Nautilus includes
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:38:15 -05:00
Federico Mena Quintero
660bef2ec2 Replace 'NautilusPlacesSidebar' with 'GtkPlacesSidebar'
Function names are of course of the form gtk_places_sidebar_*() now.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-09-03 20:38:11 -05:00
Federico Mena Quintero
d2050e5812 Copy nautilus-places-sidebar.[ch] as gtkplacessidebar.[ch] 2012-09-03 20:38:03 -05:00
411 changed files with 86756 additions and 54162 deletions

View File

@@ -69,7 +69,17 @@ to that bug report.
Otherwise, enter a new bug report that describes the patch,
and attach the patch to that bug report.
Patches should be in unified diff form. (The -up option to GNU diff.)
Patches should be in unified diff form. (The -up option to GNU diff)
Even better are git-formatted patches. (Use git format-patch)
Release notes for 3.10
======================
* GDK has been changed to allow only a single screen per display.
Only the X11 backend had multiple screens before, and multi-screen
setups (not multi-monitor!) are very rare nowadays. If you really
need multiple X screens, open them as separate displays.
Release notes for 3.8
=====================

View File

@@ -576,7 +576,7 @@ copy ..\..\..\gtk\deprecated\gtkvseparator.h $(CopyDir)\include\gtk-$(ApiVersion
copy ..\..\..\gtk\deprecated\gtkvpaned.h $(CopyDir)\include\gtk-$(ApiVersion)\gtk\deprecated
mkdir $(CopyDir)\include\gtk-$(ApiVersion)\a11y
mkdir $(CopyDir)\include\gtk-$(ApiVersion)\gtk\a11y
copy ..\..\..\gtk\a11y\gtkarrowaccessible.h $(CopyDir)\include\gtk-$(ApiVersion)\gtk\a11y

View File

@@ -359,7 +359,7 @@ copy ..\..\..\gtk\deprecated\gtkvscrollbar.h $(CopyDir)\include\gtk-$(ApiVersion
copy ..\..\..\gtk\deprecated\gtkvseparator.h $(CopyDir)\include\gtk-$(ApiVersion)\gtk\deprecated&#x0D;&#x0A;
copy ..\..\..\gtk\deprecated\gtkvpaned.h $(CopyDir)\include\gtk-$(ApiVersion)\gtk\deprecated&#x0D;&#x0A;
mkdir $(CopyDir)\include\gtk-$(ApiVersion)\a11y&#x0D;&#x0A;
mkdir $(CopyDir)\include\gtk-$(ApiVersion)\gtk\a11y&#x0D;&#x0A;
copy ..\..\..\gtk\a11y\gtkarrowaccessible.h $(CopyDir)\include\gtk-$(ApiVersion)\gtk\a11y&#x0D;&#x0A;
copy ..\..\..\gtk\a11y\gtkbooleancellaccessible.h $(CopyDir)\include\gtk-$(ApiVersion)\gtk\a11y&#x0D;&#x0A;

View File

@@ -42,7 +42,7 @@ AC_CANONICAL_TARGET
m4_define([gtk_binary_version], [3.0.0])
# required versions of other packages
m4_define([glib_required_version], [2.35.3])
m4_define([glib_required_version], [2.37.0])
m4_define([pango_required_version], [1.32.4])
m4_define([atk_required_version], [2.7.5])
m4_define([cairo_required_version], [1.10.0])
@@ -350,7 +350,7 @@ if test "$enable_win32_backend" = "yes"; then
backend_immodules="$backend_immodules,ime"
GDK_WINDOWING="$GDK_WINDOWING
#define GDK_WINDOWING_WIN32"
GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid"
GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid -lwinmm"
AM_CONDITIONAL(USE_WIN32, true)
PANGO_PACKAGES="pangowin32 pangocairo"
else

View File

@@ -39,10 +39,12 @@ demos = \
pickers.c \
pixbufs.c \
printing.c \
revealer.c \
rotated_text.c \
search_entry.c \
sizegroup.c \
spinner.c \
stack.c \
stock_browser.c \
textview.c \
textscroll.c \
@@ -85,7 +87,7 @@ gsettings_SCHEMAS = \
@GSETTINGS_RULES@
demos.h: @REBUILD@ $(demos) geninclude.pl
$(AM_V_GEN) (here=`pwd` ; cd $(srcdir) && $(PERL) $$here/geninclude.pl $(demos)) > demos.h
$(AM_V_GEN) (here=`pwd` ; cd $(srcdir) && $(PERL) $$here/geninclude.pl $(demos)) > demos.h
gtk3_demo_SOURCES = \
$(demos) \
@@ -110,6 +112,8 @@ RESOURCES= $(demos) \
application.ui \
demo.ui \
menus.ui \
stack.ui \
revealer.ui \
theming.ui \
alphatest.png \
apple-red.png \

View File

@@ -1,24 +1,23 @@
/* Change Display
*
* Demonstrates migrating a window between different displays and
* screens. A display is a mouse and keyboard with some number of
* associated monitors. A screen is a set of monitors grouped
* into a single physical work area. The neat thing about having
* multiple displays is that they can be on a completely separate
* Demonstrates migrating a window between different displays.
* A display is a mouse and keyboard with some number of
* associated monitors. The neat thing about having multiple
* displays is that they can be on a completely separate
* computers, as long as there is a network connection to the
* computer where the application is running.
*
* Only some of the windowing systems where GTK+ runs have the
* concept of multiple displays and screens. (The X Window System
* is the main example.) Other windowing systems can only
* handle one keyboard and mouse, and combine all monitors into
* a single screen.
* concept of multiple displays. (The X Window System is the
* main example.) Other windowing systems can only handle one
* keyboard and mouse, and combine all monitors into
* a single display.
*
* This is a moderately complex example, and demonstrates:
*
* - Tracking the currently open displays and screens
* - Tracking the currently open displays
*
* - Changing the screen for a window
* - Changing the display for a window
*
* - Letting the user choose a window by clicking on it
*
@@ -45,11 +44,8 @@ struct _ChangeDisplayInfo
GtkSizeGroup *size_group;
GtkTreeModel *display_model;
GtkTreeModel *screen_model;
GtkTreeSelection *screen_selection;
GdkDisplay *current_display;
GdkScreen *current_screen;
};
/* These enumerations provide symbolic names for the columns
@@ -177,40 +173,11 @@ query_change_display (ChangeDisplayInfo *info)
"to move to the new screen");
if (toplevel)
gtk_window_set_screen (GTK_WINDOW (toplevel), info->current_screen);
gtk_window_set_screen (GTK_WINDOW (toplevel), gdk_display_get_screen (info->current_display, 0));
else
gdk_display_beep (gdk_screen_get_display (screen));
}
/* Fills in the screen list based on the current display
*/
static void
fill_screens (ChangeDisplayInfo *info)
{
gtk_list_store_clear (GTK_LIST_STORE (info->screen_model));
if (info->current_display)
{
gint n_screens = gdk_display_get_n_screens (info->current_display);
gint i;
for (i = 0; i < n_screens; i++)
{
GdkScreen *screen = gdk_display_get_screen (info->current_display, i);
GtkTreeIter iter;
gtk_list_store_append (GTK_LIST_STORE (info->screen_model), &iter);
gtk_list_store_set (GTK_LIST_STORE (info->screen_model), &iter,
SCREEN_COLUMN_NUMBER, i,
SCREEN_COLUMN_SCREEN, screen,
-1);
if (i == 0)
gtk_tree_selection_select_iter (info->screen_selection, &iter);
}
}
}
/* Called when the user clicks on a button in our dialog or
* closes the dialog through the window manager. Unless the
* "Change" button was clicked, we destroy the dialog.
@@ -320,28 +287,6 @@ display_changed_cb (GtkTreeSelection *selection,
-1);
else
info->current_display = NULL;
fill_screens (info);
}
/* Called when the selected row in the sceen list changes.
* Updates info->current_screen.
*/
static void
screen_changed_cb (GtkTreeSelection *selection,
ChangeDisplayInfo *info)
{
GtkTreeModel *model;
GtkTreeIter iter;
if (info->current_screen)
g_object_unref (info->current_screen);
if (gtk_tree_selection_get_selected (selection, &model, &iter))
gtk_tree_model_get (model, &iter,
SCREEN_COLUMN_SCREEN, &info->current_screen,
-1);
else
info->current_screen = NULL;
}
/* This function is used both for creating the "Display" and
@@ -446,37 +391,6 @@ create_display_frame (ChangeDisplayInfo *info)
return frame;
}
/* Creates the "Screen" frame in the main window.
*/
GtkWidget *
create_screen_frame (ChangeDisplayInfo *info)
{
GtkWidget *frame;
GtkWidget *tree_view;
GtkWidget *button_vbox;
GtkTreeViewColumn *column;
create_frame (info, "Screen", &frame, &tree_view, &button_vbox);
info->screen_model = (GtkTreeModel *)gtk_list_store_new (SCREEN_NUM_COLUMNS,
G_TYPE_INT,
GDK_TYPE_SCREEN);
gtk_tree_view_set_model (GTK_TREE_VIEW (tree_view), info->screen_model);
column = gtk_tree_view_column_new_with_attributes ("Number",
gtk_cell_renderer_text_new (),
"text", SCREEN_COLUMN_NUMBER,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (tree_view), column);
info->screen_selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree_view));
g_signal_connect (info->screen_selection, "changed",
G_CALLBACK (screen_changed_cb), info);
return frame;
}
/* Called when one of the currently open displays is closed.
* Remove it from our list of displays.
*/
@@ -580,12 +494,9 @@ destroy_info (ChangeDisplayInfo *info)
g_object_unref (info->size_group);
g_object_unref (info->display_model);
g_object_unref (info->screen_model);
if (info->current_display)
g_object_unref (info->current_display);
if (info->current_screen)
g_object_unref (info->current_screen);
g_free (info);
}
@@ -637,9 +548,6 @@ do_changedisplay (GtkWidget *do_widget)
frame = create_display_frame (info);
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
frame = create_screen_frame (info);
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
initialize_displays (info);
gtk_widget_show_all (info->window);

View File

@@ -55,6 +55,12 @@
<file preprocess="to-pixdata">gnome-fs-directory.png</file>
<file preprocess="to-pixdata">gnome-fs-regular.png</file>
</gresource>
<gresource prefix="/stack">
<file>stack.ui</file>
</gresource>
<gresource prefix="/revealer">
<file>revealer.ui</file>
</gresource>
<gresource prefix="/images">
<file>alphatest.png</file>
<file>floppybuddy.gif</file>
@@ -107,9 +113,11 @@
<file>pickers.c</file>
<file>pixbufs.c</file>
<file>printing.c</file>
<file>revealer.c</file>
<file>rotated_text.c</file>
<file>search_entry.c</file>
<file>sizegroup.c</file>
<file>stack.c</file>
<file>spinner.c</file>
<file>stock_browser.c</file>
<file>textview.c</file>

View File

@@ -403,7 +403,7 @@ static GtkWidget *create_text (GtkWidget **text_view, gboolean is_source);
static void
add_data_tab (const gchar *demoname)
{
gchar *resource_dir, *resource_name, *content_type;
gchar *resource_dir, *resource_name, *content_type, *content_mime;
gchar **resources;
GBytes *bytes;
GtkWidget *widget, *label;
@@ -427,17 +427,20 @@ add_data_tab (const gchar *demoname)
g_bytes_get_data (bytes, NULL),
g_bytes_get_size (bytes),
NULL);
content_mime = g_content_type_get_mime_type (content_type);
/* In theory we should look at all the mime types gdk-pixbuf supports
* and go from there, but we know what file types we've added.
*/
if (g_content_type_is_a (content_type, "image/png") ||
g_content_type_is_a (content_type, "image/gif") ||
g_content_type_is_a (content_type, "image/jpeg"))
if (g_content_type_is_a (content_mime, "image/png") ||
g_content_type_is_a (content_mime, "image/gif") ||
g_content_type_is_a (content_mime, "image/jpeg"))
{
widget = gtk_image_new_from_resource (resource_name);
}
else if (g_content_type_is_a (content_type, "text/plain"))
else if (g_content_type_is_a (content_mime, "text/plain") ||
g_content_type_is_a (content_mime, "application/x-ext-ui") ||
g_content_type_is_a (content_mime, "text/css"))
{
GtkTextBuffer *buffer;
GtkWidget *textview;
@@ -449,7 +452,8 @@ add_data_tab (const gchar *demoname)
}
else
{
g_warning ("Don't know how to display resource '%s' of type '%s'\n", resource_name, content_type);
g_warning ("Don't know how to display resource '%s' of type '%s'\n", resource_name, content_mime);
widget = NULL;
}
@@ -458,6 +462,7 @@ add_data_tab (const gchar *demoname)
gtk_widget_show (label);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, label);
g_free (content_mime);
g_free (content_type);
g_free (resource_name);
g_bytes_unref (bytes);

85
demos/gtk-demo/revealer.c Normal file
View File

@@ -0,0 +1,85 @@
/* Revealer
*
* GtkRevealer is a container that animates showing and hiding
* of its sole child with nice transitions.
*/
#include <gtk/gtk.h>
static GtkBuilder *builder;
static gint count = 0;
static void
change_direction (GtkRevealer *revealer)
{
gboolean revealed;
revealed = gtk_revealer_get_child_revealed (revealer);
gtk_revealer_set_reveal_child (revealer, !revealed);
}
static gboolean
reveal_one (gpointer data)
{
gchar *name;
GtkRevealer *revealer;
name = g_strdup_printf ("revealer%d", count);
revealer = (GtkRevealer *)gtk_builder_get_object (builder, name);
gtk_revealer_set_reveal_child (revealer, TRUE);
g_signal_connect (revealer, "notify::child-revealed",
G_CALLBACK (change_direction), NULL);
count++;
return count < 9;
}
static void
response_cb (GtkWidget *dialog,
gint response_id,
gpointer data)
{
gtk_widget_destroy (dialog);
}
GtkWidget *
do_revealer (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
GError *err = NULL;
if (!window)
{
builder = gtk_builder_new ();
gtk_builder_add_from_resource (builder, "/revealer/revealer.ui", &err);
if (err)
{
g_error ("ERROR: %s\n", err->message);
return NULL;
}
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "dialog1"));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
g_signal_connect (window, "response", G_CALLBACK (response_cb), NULL);
}
if (!gtk_widget_get_visible (window))
{
count = 0;
g_timeout_add (690, reveal_one, NULL);
gtk_widget_show_all (window);
}
else
{
gtk_widget_destroy (window);
window = NULL;
}
return window;
}

223
demos/gtk-demo/revealer.ui Normal file
View File

@@ -0,0 +1,223 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.6 -->
<object class="GtkDialog" id="dialog1">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="type_hint">dialog</property>
<property name="default_width">300</property>
<property name="default_height">300</property>
<property name="title">Revealer</property>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="dialog-action_area1">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button1">
<property name="label">gtk-close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<child>
<object class="GtkRevealer" id="revealer0">
<property name="visible">True</property>
<property name="transition-duration">2000</property>
<property name="transition-type">crossfade</property>
<child>
<object class="GtkImage" id="image0">
<property name="visible">True</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">6</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkRevealer" id="revealer1">
<property name="visible">True</property>
<property name="transition-duration">2000</property>
<property name="transition-type">slide-up</property>
<child>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">6</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkRevealer" id="revealer2">
<property name="visible">True</property>
<property name="transition-duration">2000</property>
<property name="transition-type">slide-right</property>
<child>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">6</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">3</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkRevealer" id="revealer3">
<property name="visible">True</property>
<property name="transition-duration">2000</property>
<property name="transition-type">slide-down</property>
<child>
<object class="GtkImage" id="image3">
<property name="visible">True</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">6</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">3</property>
</packing>
</child>
<child>
<object class="GtkRevealer" id="revealer4">
<property name="visible">True</property>
<property name="transition-duration">2000</property>
<property name="transition-type">slide-left</property>
<child>
<object class="GtkImage" id="image4">
<property name="visible">True</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">6</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkRevealer" id="revealer5">
<property name="visible">True</property>
<property name="transition-duration">2000</property>
<property name="transition-type">slide-up</property>
<child>
<object class="GtkImage" id="image5">
<property name="visible">True</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">6</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkRevealer" id="revealer6">
<property name="visible">True</property>
<property name="transition-duration">2000</property>
<property name="transition-type">slide-right</property>
<child>
<object class="GtkImage" id="image6">
<property name="visible">True</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">6</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">4</property>
<property name="top-attach">2</property>
</packing>
</child>
<child>
<object class="GtkRevealer" id="revealer7">
<property name="visible">True</property>
<property name="transition-duration">2000</property>
<property name="transition-type">slide-down</property>
<child>
<object class="GtkImage" id="image7">
<property name="visible">True</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">6</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">4</property>
</packing>
</child>
<child>
<object class="GtkRevealer" id="revealer8">
<property name="visible">True</property>
<property name="transition-duration">2000</property>
<property name="transition-type">slide-left</property>
<child>
<object class="GtkImage" id="image8">
<property name="visible">True</property>
<property name="icon-name">face-cool-symbolic</property>
<property name="icon-size">6</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">button1</action-widget>
</action-widgets>
</object>
</interface>

48
demos/gtk-demo/stack.c Normal file
View File

@@ -0,0 +1,48 @@
/* Stack
*
* GtkStack is a container that shows a single child at a time,
* with nice transitions when the visible child changes.
*
* GtkStackSwitcher adds buttons to control which child is visible.
*/
#include <gtk/gtk.h>
static GtkBuilder *builder;
GtkWidget *
do_stack (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
GError *err = NULL;
if (!window)
{
builder = gtk_builder_new ();
gtk_builder_add_from_resource (builder, "/stack/stack.ui", &err);
if (err)
{
g_error ("ERROR: %s\n", err->message);
return NULL;
}
gtk_builder_connect_signals (builder, NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window1"));
gtk_window_set_screen (GTK_WINDOW (window),
gtk_widget_get_screen (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
}
if (!gtk_widget_get_visible (window))
{
gtk_widget_show_all (window);
}
else
{
gtk_widget_destroy (window);
window = NULL;
}
return window;
}

82
demos/gtk-demo/stack.ui Normal file
View File

@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.6 -->
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<property name="title" translatable="yes">GtkStack</property>
<child>
<object class="GtkGrid" id="grid1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkStackSwitcher" id="switcher">
<property name="visible">True</property>
<property name="stack">stack</property>
<property name="halign">center</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
<child>
<object class="GtkStack" id="stack">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="transition-type">crossfade</property>
<child>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin-top">20</property>
<property name="margin-bottom">20</property>
<property name="resource">/application/gtk-logo-48.png</property>
</object>
<packing>
<property name="name">page1</property>
<property name="title" translatable="yes">Page 1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="checkbutton1">
<property name="label" translatable="yes">Page 2</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<property name="halign">center</property>
<property name="valign">center</property>
</object>
<packing>
<property name="name">page2</property>
<property name="title" translatable="yes">Page 2</property>
</packing>
</child>
<child>
<object class="GtkSpinner" id="spinner1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="active">True</property>
</object>
<packing>
<property name="name">page3</property>
<property name="icon-name">face-laugh-symbolic</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="width">1</property>
<property name="height">1</property>
</packing>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -85,7 +85,7 @@ scroll_to_bottom (GtkTextView *textview)
gtk_text_iter_set_line_offset (&iter, 0);
/* and place the mark at iter. the mark will stay there after we
* insert some text at the end because it has right gravity.
* insert some text at the end because it has left gravity.
*/
mark = gtk_text_buffer_get_mark (buffer, "scroll");
gtk_text_buffer_move_mark (buffer, mark, &iter);

View File

@@ -78,6 +78,35 @@ on_page_toggled (GtkToggleButton *button,
gtk_notebook_set_current_page (pages, page);
}
static void
spin_value_changed (GtkAdjustment *adjustment, GtkWidget *label)
{
GtkWidget *w;
gint v;
gchar *text;
v = (int)gtk_adjustment_get_value (adjustment);
if ((v % 3) == 0)
{
text = g_strdup_printf ("%d is a multiple of 3", v);
gtk_label_set_label (GTK_LABEL (label), text);
g_free (text);
}
w = gtk_widget_get_ancestor (label, GTK_TYPE_REVEALER);
gtk_revealer_set_reveal_child (GTK_REVEALER (w), (v % 3) == 0);
}
static void
dismiss (GtkWidget *button)
{
GtkWidget *w;
w = gtk_widget_get_ancestor (button, GTK_TYPE_REVEALER);
gtk_revealer_set_reveal_child (GTK_REVEALER (w), FALSE);
}
int
main (int argc, char *argv[])
{
@@ -86,6 +115,7 @@ main (int argc, char *argv[])
GtkWidget *widget;
GtkWidget *notebook;
gboolean dark = FALSE;
GtkAdjustment *adj;
gtk_init (&argc, &argv);
@@ -114,6 +144,14 @@ main (int argc, char *argv[])
widget = (GtkWidget*) gtk_builder_get_object (builder, "aboutmenuitem");
g_signal_connect (widget, "activate", G_CALLBACK (show_about), window);
widget = (GtkWidget*) gtk_builder_get_object (builder, "page2dismiss");
g_signal_connect (widget, "clicked", G_CALLBACK (dismiss), NULL);
widget = (GtkWidget*) gtk_builder_get_object (builder, "page2note");
adj = (GtkAdjustment *) gtk_builder_get_object (builder, "adjustment2");
g_signal_connect (adj, "value-changed",
G_CALLBACK (spin_value_changed), widget);
g_object_unref (G_OBJECT (builder));
gtk_widget_show (window);

View File

@@ -54,6 +54,23 @@ Vestibulum in tortor diam, quis aliquet quam. Praesent ut justo neque, tempus ru
Duis eu lectus quam. Vivamus eget metus a mauris molestie venenatis pulvinar eleifend nisi.
Nulla facilisi. Pellentesque at dolor sit amet purus dapibus pulvinar molestie quis neque.
Suspendisse feugiat quam quis dolor accumsan cursus. </property>
</object>
<object class="GtkTextBuffer" id="textbuffer2">
<property name="text">* Translation updates:
Aragonese
Assamese
Basque
Brazilian Portuguese
Dutch
German
Hebrew
Hungarian
Polish
Portuguese
Serbian
Slovenian
Spanish
Uyghur</property>
</object>
<object class="GtkAccelGroup" id="accelgroup1"/>
<object class="GtkWindow" id="window">
@@ -2146,30 +2163,158 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
</object>
</child>
<child>
<object class="GtkBox" id="page2">
<object class="GtkOverlay" id="page2">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<property name="border-width">6</property>
<child>
<object class="GtkBox" id="page2box1">
<child type="overlay">
<object class="GtkRevealer" id="page2revealer">
<property name="visible">True</property>
<property name="orientation">horizontal</property>
<property name="spacing">4</property>
<property name="halign">center</property>
<property name="valign">start</property>
<child>
<object class="GtkSpinButton" id="verticalspin1">
<object class="GtkFrame" id="page2frame">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="adjustment">adjustment2</property>
<property name="margin-top">2</property>
<child>
<object class="GtkBox" id="page2box">
<property name="visible">True</property>
<property name="margin-top">10</property>
<property name="margin-bottom">10</property>
<property name="margin-left">10</property>
<property name="margin-right">10</property>
<property name="spacing">20</property>
<child>
<object class="GtkLabel" id="page2note">
<property name="visible">True</property>
<property name="hexpand">True</property>
<property name="halign">start</property>
<property name="label">NEWS!</property>
</object>
</child>
<child>
<object class="GtkButton" id="page2dismiss">
<property name="visible">True</property>
<child>
<object class="GtkImage" id="page2dismissi">
<property name="visible">True</property>
<property name="icon-name">window-close-symbolic</property>
<property name="icon-size">0</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkGrid" id="page2grid">
<property name="visible">True</property>
<property name="column-homogeneous">True</property>
<property name="row-spacing">6</property>
<property name="column-spacing">6</property>
<property name="border-width">6</property>
<child>
<object class="GtkSpinButton" id="verticalspin2">
<object class="GtkBox" id="page2box1">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="orientation">vertical</property>
<property name="adjustment">adjustment1</property>
<property name="orientation">horizontal</property>
<property name="spacing">4</property>
<child>
<object class="GtkSpinButton" id="verticalspin1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="adjustment">adjustment2</property>
</object>
</child>
<child>
<object class="GtkSpinButton" id="verticalspin2">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="orientation">vertical</property>
<property name="adjustment">adjustment1</property>
</object>
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="filler1">
<property name="visible">True</property>
</object>
<packing>
<property name="left-attach">1</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="filler2">
<property name="visible">True</property>
</object>
<packing>
<property name="left-attach">2</property>
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkStackSwitcher" id="switcher">
<property name="visible">True</property>
<property name="stack">stack</property>
<property name="halign">center</property>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">1</property>
</packing>
</child>
<child>
<object class="GtkFrame" id="frame">
<property name="visible">True</property>
<property name="hexpand">False</property>
<child>
<object class="GtkStack" id="stack">
<property name="visible">True</property>
<property name="transition-type">crossfade</property>
<property name="transition-duration">1000</property>
<child>
<object class="GtkScrolledWindow" id="swo">
<property name="visible">True</property>
<property name="shadow-type">none</property>
<child>
<object class="GtkTextView" id="tvo">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="buffer">textbuffer2</property>
</object>
</child>
</object>
<packing>
<property name="name">page1</property>
<property name="icon-name">document-open-recent-symbolic</property>
<property name="title">News</property>
</packing>
</child>
<child>
<object class="GtkImage" id="imageo">
<property name="visible">True</property>
<property name="resource">/logos/gtk-logo-256.png</property>
</object>
<packing>
<property name="name">page2</property>
<property name="icon-name">system-shutdown-symbolic</property>
<property name="title">Logo</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">2</property>
</packing>
</child>
</object>
</child>

View File

@@ -43,6 +43,7 @@
<xi:include href="xml/pango_interaction.xml" />
<xi:include href="xml/cairo_interaction.xml" />
<xi:include href="xml/x_interaction.xml" />
<xi:include href="xml/wayland_interaction.xml" />
<xi:include href="xml/gdkapplaunchcontext.xml" />
<xi:include href="xml/gdktestutils.xml" />
</reference>

View File

@@ -10,6 +10,7 @@ gdk_parse_args
gdk_get_display_arg_name
gdk_notify_startup_complete
gdk_notify_startup_complete_with_id
gdk_set_allowed_backends
<SUBSECTION>
gdk_get_program_class
@@ -51,6 +52,7 @@ gdk_error_trap_pop_ignored
GDK_WINDOWING_X11
GDK_WINDOWING_WIN32
GDK_WINDOWING_QUARTZ
GDK_WINDOWING_WAYLAND
<SUBSECTION>
GDK_VERSION_3_0
@@ -170,6 +172,7 @@ GdkDisplayClass
<TITLE>GdkDisplayManager</TITLE>
GdkDisplayManager
gdk_display_manager_get
gdk_display_manager_peek
gdk_display_manager_get_default_display
gdk_display_manager_set_default_display
gdk_display_manager_list_displays
@@ -1126,6 +1129,54 @@ gdk_x11_window_get_type
gdk_window_impl_x11_get_type
</SECTION>
<SECTION>
<INCLUDE>gdk/gdkwayland.h</INCLUDE>
<TITLE>Wayland Interaction</TITLE>
<FILE>wayland_interaction</FILE>
gdk_wayland_device_get_wl_keyboard
gdk_wayland_device_get_wl_pointer
gdk_wayland_device_get_wl_seat
gdk_wayland_display_get_wl_compositor
gdk_wayland_display_get_wl_display
gdk_wayland_display_get_wl_shell
gdk_wayland_window_get_wl_shell_surface
gdk_wayland_window_get_wl_surface
gdk_wayland_window_set_use_custom_surface
<SUBSECTION Standard>
GDK_TYPE_WAYLAND_DEVICE
GDK_WAYLAND_DEVICE
GDK_WAYLAND_DEVICE_CLASS
GDK_WAYLAND_DEVICE_GET_CLASS
GDK_IS_WAYLAND_DEVICE
GDK_IS_WAYLAND_DEVICE_CLASS
GDK_TYPE_WAYLAND_DISPLAY
GDK_WAYLAND_DISPLAY
GDK_WAYLAND_DISPLAY_CLASS
GDK_WAYLAND_DISPLAY_GET_CLASS
GDK_IS_WAYLAND_DISPLAY
GDK_IS_WAYLAND_DISPLAY_CLASS
GDK_TYPE_WAYLAND_DISPLAY_MANAGER
GDK_WAYLAND_DISPLAY_MANAGER
GDK_WAYLAND_DISPLAY_MANAGER_CLASS
GDK_WAYLAND_DISPLAY_MANAGER_GET_CLASS
GDK_IS_WAYLAND_DISPLAY_MANAGER
GDK_IS_WAYLAND_DISPLAY_MANAGER_CLASS
GDK_TYPE_WAYLAND_WINDOW
GDK_WAYLAND_WINDOW
GDK_WAYLAND_WINDOW_CLASS
GDK_WAYLAND_WINDOW_GET_CLASS
GDK_IS_WAYLAND_WINDOW
GDK_IS_WAYLAND_WINDOW_CLASS
<SUBSECTION Private>
gdk_wayland_device_get_type
gdk_wayland_display_get_type
gdk_wayland_display_manager_get_type
gdk_wayland_window_get_type
</SECTION>
<SECTION>
<TITLE>Application launching</TITLE>
<FILE>gdkapplaunchcontext</FILE>

View File

@@ -54,6 +54,15 @@ Start your applications like this:
BROADWAY_DISPLAY=:5 gtk3-demo
</programlisting>
You can add password protection for your session by creating a file in
<filename>$XDG_CONFIG_HOME/broadway.passwd</filename> or <filename>$HOME/.config/broadway.passwd</filename>
with a crypt(3) style password hash.
A simple way to generate it is with openssl:
<programlisting>
openssl passwd -1 > ~/.config/broadway.passwd
</programlisting>
</para>
</refsect1>

View File

@@ -220,6 +220,7 @@
<xi:include href="xml/gtkfontbutton.xml" />
<xi:include href="xml/gtkfontchooserwidget.xml" />
<xi:include href="xml/gtkfontchooserdialog.xml" />
<xi:include href="xml/gtkplacessidebar.xml" />
</chapter>
<chapter id="LayoutContainers">
@@ -233,7 +234,10 @@
<xi:include href="xml/gtkpaned.xml" />
<xi:include href="xml/gtklayout.xml" />
<xi:include href="xml/gtknotebook.xml" />
<xi:include href="xml/gtkstack.xml" />
<xi:include href="xml/gtkstackswitcher.xml" />
<xi:include href="xml/gtkexpander.xml" />
<xi:include href="xml/gtkrevealer.xml" />
<xi:include href="xml/gtkoverlay.xml" />
<xi:include href="xml/gtkheaderbar.xml" />
<xi:include href="xml/gtkorientable.xml" />

View File

@@ -486,6 +486,8 @@ gtk_box_set_spacing
gtk_box_reorder_child
gtk_box_query_child_packing
gtk_box_set_child_packing
gtk_box_get_baseline_position
gtk_box_set_baseline_position
<SUBSECTION Standard>
GTK_BOX
GTK_IS_BOX
@@ -539,6 +541,9 @@ gtk_builder_get_objects
gtk_builder_expose_object
gtk_builder_connect_signals
gtk_builder_connect_signals_full
gtk_builder_add_callback_symbol
gtk_builder_add_callback_symbols
gtk_builder_lookup_callback_symbol
gtk_builder_set_translation_domain
gtk_builder_get_translation_domain
gtk_builder_get_type_from_name
@@ -2480,6 +2485,32 @@ GTK_PANED_GET_CLASS
gtk_paned_get_type
</SECTION>
<SECTION>
<FILE>gtkplacessidebar</FILE>
<TITLE>GtkPlacesSidebar</FILE>
GtkPlacesSidebar
GtkPlacesOpenFlags
gtk_places_sidebar_new
gtk_places_sidebar_set_open_flags
gtk_places_sidebar_set_location
gtk_places_sidebar_get_location
gtk_places_sidebar_set_show_desktop
gtk_places_sidebar_set_accept_uri_drops
gtk_places_sidebar_add_shortcut
gtk_places_sidebar_remove_shortcut
gtk_places_sidebar_list_shortcuts
gtk_places_sidebar_get_nth_bookmark
<SUBSECTION Standard>
GTK_PLACES_SIDEBAR
GTK_IS_PLACES_SIDEBAR
GTK_TYPE_PLACES_SIDEBAR
GTK_PLACES_SIDEBAR_CLASS
GTK_IS_PLACES_SIDEBAR_CLASS
GTK_PLACES_SIDEBAR_GET_CLASS
<SUBSECTION Private>
gtk_places_sidebar_get_type
</SECTION>
<SECTION>
<FILE>gtkplug</FILE>
<TITLE>GtkPlug</TITLE>
@@ -3576,11 +3607,11 @@ gtk_text_mark_get_type
<TITLE>GtkTextTag</TITLE>
GtkTextTag
GtkWrapMode
GtkTextAttributes
gtk_text_tag_new
gtk_text_tag_get_priority
gtk_text_tag_set_priority
gtk_text_tag_event
GtkTextAttributes
GtkTextAppearance
gtk_text_attributes_new
gtk_text_attributes_copy
@@ -5159,6 +5190,7 @@ gtk_widget_remove_tick_callback
gtk_widget_size_request
gtk_widget_get_child_requisition
gtk_widget_size_allocate
gtk_widget_size_allocate_with_baseline
gtk_widget_add_accelerator
gtk_widget_remove_accelerator
gtk_widget_set_accel_path
@@ -5291,6 +5323,7 @@ gtk_widget_get_allocated_width
gtk_widget_get_allocated_height
gtk_widget_get_allocation
gtk_widget_set_allocation
gtk_widget_get_allocated_baseline
gtk_widget_get_app_paintable
gtk_widget_get_can_default
gtk_widget_set_can_default
@@ -5351,8 +5384,10 @@ gtk_widget_get_preferred_height
gtk_widget_get_preferred_width
gtk_widget_get_preferred_height_for_width
gtk_widget_get_preferred_width_for_height
gtk_widget_get_preferred_height_and_baseline_for_width
gtk_widget_get_request_mode
gtk_widget_get_preferred_size
gtk_widget_get_preferred_size_and_baseline
gtk_distribute_natural_allocation
<SUBSECTION Alignment and Margins>
@@ -5360,6 +5395,7 @@ GtkAlign
gtk_widget_get_halign
gtk_widget_set_halign
gtk_widget_get_valign
gtk_widget_get_valign_with_baseline
gtk_widget_set_valign
gtk_widget_get_margin_left
gtk_widget_set_margin_left
@@ -5382,6 +5418,18 @@ gtk_widget_set_vexpand_set
gtk_widget_queue_compute_expand
gtk_widget_compute_expand
<SUBSECTION Templates>
gtk_widget_init_template
gtk_widget_class_set_template
gtk_widget_class_set_template_from_resource
gtk_widget_get_automated_child
gtk_widget_class_bind_child
gtk_widget_class_bind_child_internal
gtk_widget_class_automate_child
gtk_widget_class_bind_callback
gtk_widget_class_declare_callback
gtk_widget_class_set_connect_func
<SUBSECTION Standard>
GTK_WIDGET
GTK_IS_WIDGET
@@ -7238,6 +7286,8 @@ gtk_grid_attach_next_to
gtk_grid_get_child_at
gtk_grid_insert_row
gtk_grid_insert_column
gtk_grid_remove_row
gtk_grid_remove_column
gtk_grid_insert_next_to
gtk_grid_set_row_homogeneous
gtk_grid_get_row_homogeneous
@@ -7247,6 +7297,10 @@ gtk_grid_set_column_homogeneous
gtk_grid_get_column_homogeneous
gtk_grid_set_column_spacing
gtk_grid_get_column_spacing
gtk_grid_get_baseline_row
gtk_grid_set_baseline_row
gtk_grid_get_row_baseline_position
gtk_grid_set_row_baseline_position
<SUBSECTION Standard>
GtkGridClass
@@ -7521,3 +7575,48 @@ GTK_HEADER_BAR_GET_CLASS
<SUBSECTION Private>
gtk_header_bar_get_type
</SECTION>
<SECTION>
<FILE>gtkstack</FILE>
<TITLE>GtkStack</TITLE>
GtkStack
gtk_stack_new
gtk_stack_add_named
gtk_stack_add_titled
gtk_stack_set_visible_child
gtk_stack_get_visible_child
gtk_stack_set_visible_child_name
gtk_stack_get_visible_child_name
gtk_stack_set_visible_child_full
gtk_stack_set_homogeneous
gtk_stack_get_homogeneous
gtk_stack_set_transition_duration
gtk_stack_get_transition_duration
GtkStackTransitionType
gtk_stack_set_transition_type
gtk_stack_get_transition_type
</SECTION>
<SECTION>
<FILE>gtkstackswitcher</FILE>
<TITLE>GtkStackSwitcher</TITLE>
GtkStackSwitcher
gtk_stack_switcher_new
gtk_stack_switcher_set_stack
gtk_stack_switcher_get_stack
</SECTION>
<SECTION>
<FILE>gtkrevealer</FILE>
<TITLE>GtkRevealer</TITLE>
GtkRevealer
gtk_revealer_new
gtk_revealer_get_reveal_child
gtk_revealer_set_reveal_child
gtk_revealer_get_child_revealed
gtk_revealer_get_transition_duration
gtk_revealer_set_transition_duration
GtkRevealerTransitionType
gtk_revealer_get_transition_type
gtk_revealer_set_transition_type
</SECTION>

View File

@@ -461,6 +461,9 @@ nevertheless.
</varlistentry>
</variablelist>
Since 3.10, this environment variable can contain a comma-separated list
of backend names, which are tried in order. The list may also contain
a *, which means: try all remaining backends.
For more information about selecting backends, see the gdk_display_manager_get() function.
</para>
</formalpara>

View File

@@ -153,7 +153,7 @@ You can change the default attributes for a given #GtkTextView, and you can
apply tags that change the attributes for a region of text. For text features
that come from the theme &mdash; such as font and foreground color &mdash; use
standard #GtkWidget functions such as gtk_widget_modify_font() or
gtk_widget_override_text(). For other attributes there are dedicated methods on
gtk_widget_override_color(). For other attributes there are dedicated methods on
#GtkTextView such as gtk_text_view_set_tabs().
<informalexample><programlisting>

View File

@@ -34,6 +34,29 @@ change_fullscreen_state (GSimpleAction *action,
g_simple_action_set_state (action, state);
}
static void
change_busy_state (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
GtkWindow *window = user_data;
GApplication *application = G_APPLICATION (gtk_window_get_application (window));
/* do this twice to test multiple busy counter increases */
if (g_variant_get_boolean (state))
{
g_application_mark_busy (application);
g_application_mark_busy (application);
}
else
{
g_application_unmark_busy (application);
g_application_unmark_busy (application);
}
g_simple_action_set_state (action, state);
}
static void
change_justify_state (GSimpleAction *action,
GVariant *state,
@@ -94,6 +117,7 @@ static GActionEntry win_entries[] = {
{ "copy", window_copy, NULL, NULL, NULL },
{ "paste", window_paste, NULL, NULL, NULL },
{ "fullscreen", activate_toggle, NULL, "false", change_fullscreen_state },
{ "busy", activate_toggle, NULL, "false", change_busy_state },
{ "justify", activate_radio, "s", "'left'", change_justify_state }
};
@@ -356,6 +380,10 @@ bloat_pad_startup (GApplication *application)
" <attribute name='action'>win.fullscreen</attribute>"
" <attribute name='accel'>F11</attribute>"
" </item>"
" <item>"
" <attribute name='label' translatable='yes'>_Look Busy</attribute>"
" <attribute name='action'>win.busy</attribute>"
" </item>"
" </section>"
" </submenu>"
" <submenu id='time-menu'>"

View File

@@ -134,6 +134,7 @@ gdk_c_sources = \
gdkframeclockidle.c \
gdkpango.c \
gdkpixbuf-drawable.c \
gdkproperty.c \
gdkrectangle.c \
gdkrgba.c \
gdkscreen.c \
@@ -173,6 +174,7 @@ libgdk_3_la_LIBADD += x11/libgdk-x11.la
endif # USE_X11
if USE_QUARTZ
libgdk_3_la_CFLAGS = -xobjective-c
libgdk_3_la_LIBADD += quartz/libgdk-quartz.la
endif # USE_QUARTZ
@@ -369,7 +371,7 @@ dist-hook: ../build/win32/vs9/gdk.vcproj ../build/win32/vs10/gdk.vcxproj ../buil
done >libgdk.sourcefiles
$(CPP) -P - <$(top_srcdir)/build/win32/vs9/gdk.vcprojin >$@
rm libgdk.sourcefiles
../build/win32/vs10/gdk.vcxproj: ../build/win32/vs10/gdk.vcxprojin
for F in $(libgdk_3_la_SOURCES); do \
case $$F in \

View File

@@ -60,9 +60,7 @@ libgdk_broadway_la_SOURCES = \
gdkeventsource.c \
gdkeventsource.h \
gdkglobals-broadway.c \
gdkim-broadway.c \
gdkkeys-broadway.c \
gdkmain-broadway.c \
gdkproperty-broadway.c \
gdkscreen-broadway.c \
gdkscreen-broadway.h \
@@ -83,7 +81,7 @@ broadwayd_SOURCES = \
broadway-output.h \
broadway-output.c
broadwayd_LDADD = $(GDK_DEP_LIBS) -lrt
broadwayd_LDADD = $(GDK_DEP_LIBS) -lrt -lcrypt
MAINTAINERCLEANFILES = $(broadway_built_sources)
EXTRA_DIST += $(broadway_built_sources)

View File

@@ -317,6 +317,13 @@ broadway_output_get_next_serial (BroadwayOutput *output)
return output->serial;
}
void
broadway_output_set_next_serial (BroadwayOutput *output,
guint32 serial)
{
output->serial = serial;
}
/************************************************************************
* Core rendering operations *
@@ -471,6 +478,24 @@ broadway_output_new_surface(BroadwayOutput *output,
append_bool (output, is_temp);
}
void
broadway_output_request_auth (BroadwayOutput *output)
{
write_header (output, BROADWAY_OP_REQUEST_AUTH);
}
void
broadway_output_auth_ok (BroadwayOutput *output)
{
write_header (output, BROADWAY_OP_AUTH_OK);
}
void
broadway_output_disconnected (BroadwayOutput *output)
{
write_header (output, BROADWAY_OP_DISCONNECTED);
}
void
broadway_output_show_surface(BroadwayOutput *output, int id)
{

View File

@@ -23,6 +23,8 @@ BroadwayOutput *broadway_output_new (GOutputStream *out,
void broadway_output_free (BroadwayOutput *output);
int broadway_output_flush (BroadwayOutput *output);
int broadway_output_has_error (BroadwayOutput *output);
void broadway_output_set_next_serial (BroadwayOutput *output,
guint32 serial);
guint32 broadway_output_get_next_serial (BroadwayOutput *output);
void broadway_output_new_surface (BroadwayOutput *output,
int id,
@@ -31,6 +33,9 @@ void broadway_output_new_surface (BroadwayOutput *output,
int w,
int h,
gboolean is_temp);
void broadway_output_request_auth (BroadwayOutput *output);
void broadway_output_auth_ok (BroadwayOutput *output);
void broadway_output_disconnected (BroadwayOutput *output);
void broadway_output_show_surface (BroadwayOutput *output,
int id);
void broadway_output_hide_surface (BroadwayOutput *output,

View File

@@ -36,6 +36,9 @@ typedef enum {
BROADWAY_OP_SET_TRANSIENT_FOR = 'p',
BROADWAY_OP_PUT_RGB = 'i',
BROADWAY_OP_FLUSH = 'f',
BROADWAY_OP_REQUEST_AUTH = 'l',
BROADWAY_OP_AUTH_OK = 'L',
BROADWAY_OP_DISCONNECTED = 'D',
} BroadwayOpType;
typedef struct {

View File

@@ -2,6 +2,8 @@
#include "broadway-output.h"
#define _XOPEN_SOURCE /* for crypt */
#include <glib.h>
#include <glib/gprintf.h>
#include "gdktypes.h"
@@ -9,6 +11,10 @@
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <crypt.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
@@ -19,6 +25,7 @@ typedef struct BroadwayWindow BroadwayWindow;
struct _BroadwayServer {
GObject parent_instance;
char *password;
char *address;
int port;
GSocketService *service;
@@ -69,6 +76,7 @@ typedef struct HttpRequest {
struct BroadwayInput {
BroadwayServer *server;
BroadwayOutput *output;
GSocketConnection *connection;
GByteArray *buffer;
GSource *source;
@@ -76,6 +84,7 @@ struct BroadwayInput {
gint64 time_base;
gboolean proto_v7_plus;
gboolean binary;
gboolean active;
};
struct BroadwayWindow {
@@ -90,6 +99,9 @@ struct BroadwayWindow {
gint32 transient_for;
cairo_surface_t *last_surface;
char *cached_surface_name;
cairo_surface_t *cached_surface;
};
static void broadway_server_resync_windows (BroadwayServer *server);
@@ -100,6 +112,8 @@ static void
broadway_server_init (BroadwayServer *server)
{
BroadwayWindow *root;
char *passwd_file;
char *password, *p;
server->service = g_socket_service_new ();
server->pointer_grab_window_id = -1;
@@ -108,6 +122,22 @@ broadway_server_init (BroadwayServer *server)
server->id_ht = g_hash_table_new (NULL, NULL);
server->id_counter = 0;
passwd_file = g_build_filename (g_get_user_config_dir (),
"broadway.passwd", NULL);
if (g_file_get_contents (passwd_file,
&password, NULL, NULL))
{
p = strchr (password, '\n');
if (p)
*p = 0;
g_strstrip (password);
if (strlen (password) > 3)
server->password = password;
else
g_free (password);
}
root = g_new0 (BroadwayWindow, 1);
root->id = server->id_counter++;
root->width = 1024;
@@ -139,7 +169,7 @@ broadway_server_class_init (BroadwayServerClass * class)
object_class->finalize = broadway_server_finalize;
}
static void start_output (HttpRequest *request, gboolean proto_v7_plus, gboolean binary);
static void start (BroadwayInput *input);
static void
http_request_free (HttpRequest *request)
@@ -349,6 +379,14 @@ update_future_pointer_info (BroadwayServer *server, BroadwayInputPointerMsg *dat
server->future_mouse_in_toplevel = data->mouse_window_id;
}
static gboolean
verify_password (BroadwayServer *server, const char *password)
{
char *hash;
hash = crypt (password, server->password);
return strcmp (hash, server->password) == 0;
}
static void
parse_input_message (BroadwayInput *input, const char *message)
{
@@ -357,6 +395,22 @@ parse_input_message (BroadwayInput *input, const char *message)
char *p;
gint64 time_;
if (!input->active)
{
/* The input has not been activated yet, handle auth/start */
if (message[0] != 'l' ||
!verify_password (server, message+1))
{
broadway_output_request_auth (input->output);
broadway_output_flush (input->output);
}
else
start (input);
return;
}
memset (&msg, 0, sizeof (msg));
p = (char *)message;
@@ -570,7 +624,7 @@ parse_input (BroadwayInput *input)
}
break;
case BROADWAY_WS_CNX_PING:
broadway_output_pong (server->output);
broadway_output_pong (input->output);
break;
case BROADWAY_WS_CNX_PONG:
break; /* we never send pings, but tolerate pongs */
@@ -596,7 +650,8 @@ parse_input (BroadwayInput *input)
if (buf[0] != 0)
{
server->input = NULL;
if (server->input == input)
server->input = NULL;
broadway_input_free (input);
return;
}
@@ -613,7 +668,8 @@ parse_input (BroadwayInput *input)
if (len > 0 && buf[0] != 0)
{
server->input = NULL;
if (server->input == input)
server->input = NULL;
broadway_input_free (input);
break;
}
@@ -640,19 +696,16 @@ queue_process_input_at_idle (BroadwayServer *server)
}
static void
broadway_server_read_all_input_nonblocking (BroadwayServer *server)
broadway_server_read_all_input_nonblocking (BroadwayInput *input)
{
GInputStream *in;
gssize res;
guint8 buffer[1024];
GError *error;
BroadwayInput *input;
if (server->input == NULL)
if (input == NULL)
return;
input = server->input;
in = g_io_stream_get_input_stream (G_IO_STREAM (input->connection));
error = NULL;
@@ -668,7 +721,8 @@ broadway_server_read_all_input_nonblocking (BroadwayServer *server)
return;
}
server->input = NULL;
if (input->server->input == input)
input->server->input = NULL;
broadway_input_free (input);
if (res < 0)
{
@@ -686,7 +740,7 @@ broadway_server_read_all_input_nonblocking (BroadwayServer *server)
static void
broadway_server_consume_all_input (BroadwayServer *server)
{
broadway_server_read_all_input_nonblocking (server);
broadway_server_read_all_input_nonblocking (server->input);
/* Since we're parsing input but not processing the resulting messages
we might not get a readable callback on the stream, so queue an idle to
@@ -701,9 +755,10 @@ input_data_cb (GObject *stream,
{
BroadwayServer *server = input->server;
broadway_server_read_all_input_nonblocking (server);
broadway_server_read_all_input_nonblocking (input);
process_input_messages (server);
if (input->active)
process_input_messages (server);
return TRUE;
}
@@ -878,15 +933,14 @@ start_input (HttpRequest *request, gboolean binary)
gsize len;
GChecksum *checksum;
char *origin, *host;
BroadwayServer *server;
BroadwayInput *input;
const void *data_buffer;
gsize data_buffer_size;
GInputStream *in;
char *key_v7;
gboolean proto_v7_plus;
server = request->server;
GSocket *socket;
int flag = 1;
#ifdef DEBUG_WEBSOCKETS
g_print ("incoming request:\n%s\n", request->request->str);
@@ -1033,15 +1087,11 @@ start_input (HttpRequest *request, gboolean binary)
proto_v7_plus = FALSE;
}
if (server->input != NULL)
{
broadway_input_free (server->input);
server->input = NULL;
}
socket = g_socket_connection_get_socket (request->connection);
setsockopt (g_socket_get_fd (socket), IPPROTO_TCP,
TCP_NODELAY, (char *) &flag, sizeof(int));
input = g_new0 (BroadwayInput, 1);
input->server = request->server;
input->connection = g_object_ref (request->connection);
input->proto_v7_plus = proto_v7_plus;
@@ -1051,9 +1101,9 @@ start_input (HttpRequest *request, gboolean binary)
input->buffer = g_byte_array_sized_new (data_buffer_size);
g_byte_array_append (input->buffer, data_buffer, data_buffer_size);
server->input = input;
start_output (request, proto_v7_plus, binary);
input->output =
broadway_output_new (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
0, proto_v7_plus, binary);
/* This will free and close the data input stream, but we got all the buffered content already */
http_request_free (request);
@@ -1063,35 +1113,53 @@ start_input (HttpRequest *request, gboolean binary)
g_source_set_callback (input->source, (GSourceFunc)input_data_cb, input, NULL);
g_source_attach (input->source, NULL);
if (input->server->password)
{
broadway_output_request_auth (input->output);
broadway_output_flush (input->output);
}
else
start (input);
/* Process any data in the pipe already */
parse_input (input);
process_input_messages (server);
g_strfreev (lines);
}
static void
start_output (HttpRequest *request, gboolean proto_v7_plus, gboolean binary)
start (BroadwayInput *input)
{
GSocket *socket;
BroadwayServer *server;
int flag = 1;
socket = g_socket_connection_get_socket (request->connection);
setsockopt(g_socket_get_fd (socket), IPPROTO_TCP,
TCP_NODELAY, (char *) &flag, sizeof(int));
input->active = TRUE;
server = BROADWAY_SERVER (request->server);
server = BROADWAY_SERVER (input->server);
if (server->output)
{
broadway_output_disconnected (server->output);
broadway_output_flush (server->output);
}
if (server->input != NULL)
{
broadway_input_free (server->input);
server->input = NULL;
}
server->input = input;
if (server->output)
{
server->saved_serial = broadway_output_get_next_serial (server->output);
broadway_output_free (server->output);
}
server->output = input->output;
server->output =
broadway_output_new (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
server->saved_serial, proto_v7_plus, binary);
broadway_output_set_next_serial (server->output, server->saved_serial);
broadway_output_auth_ok (server->output);
broadway_output_flush (server->output);
broadway_server_resync_windows (server);
@@ -1099,6 +1167,8 @@ start_output (HttpRequest *request, gboolean proto_v7_plus, gboolean binary)
broadway_output_grab_pointer (server->output,
server->pointer_grab_window_id,
server->pointer_grab_owner_events);
process_input_messages (server);
}
static void
@@ -1349,6 +1419,12 @@ broadway_server_destroy_window (BroadwayServer *server,
server->toplevels = g_list_remove (server->toplevels, window);
g_hash_table_remove (server->id_ht,
GINT_TO_POINTER (id));
if (window->cached_surface_name != NULL)
g_free (window->cached_surface_name);
if (window->cached_surface != NULL)
cairo_surface_destroy (window->cached_surface);
g_free (window);
}
}
@@ -1583,6 +1659,11 @@ broadway_server_window_update (BroadwayServer *server,
window->width,
window->height);
g_assert (window->width == cairo_image_surface_get_width (window->last_surface));
g_assert (window->width == cairo_image_surface_get_width (surface));
g_assert (window->height == cairo_image_surface_get_height (window->last_surface));
g_assert (window->height == cairo_image_surface_get_height (surface));
if (server->output != NULL)
{
if (window->last_synced)
@@ -1739,6 +1820,86 @@ broadway_server_ungrab_pointer (BroadwayServer *server,
return serial;
}
static const cairo_user_data_key_t shm_cairo_key;
typedef struct {
void *data;
gsize data_size;
} ShmSurfaceData;
static void
shm_data_unmap (void *_data)
{
ShmSurfaceData *data = _data;
munmap (data->data, data->data_size);
g_free (data);
}
cairo_surface_t *
broadway_server_open_surface (BroadwayServer *server,
guint32 id,
char *name,
int width,
int height)
{
BroadwayWindow *window;
ShmSurfaceData *data;
cairo_surface_t *surface;
gsize size;
void *ptr;
int fd;
window = g_hash_table_lookup (server->id_ht,
GINT_TO_POINTER (id));
if (window == NULL)
return NULL;
if (window->cached_surface_name != NULL &&
strcmp (name, window->cached_surface_name) == 0)
return cairo_surface_reference (window->cached_surface);
size = width * height * sizeof (guint32);
fd = shm_open(name, O_RDONLY, 0600);
if (fd == -1)
{
perror ("Failed to shm_open");
return NULL;
}
ptr = mmap(0, size, PROT_READ, MAP_SHARED, fd, 0);
(void) close(fd);
shm_unlink (name);
if (ptr == NULL)
return NULL;
data = g_new0 (ShmSurfaceData, 1);
data->data = ptr;
data->data_size = size;
surface = cairo_image_surface_create_for_data ((guchar *)data->data,
CAIRO_FORMAT_RGB24,
width, height,
width * sizeof (guint32));
g_assert (surface != NULL);
cairo_surface_set_user_data (surface, &shm_cairo_key,
data, shm_data_unmap);
if (window->cached_surface_name != NULL)
g_free (window->cached_surface_name);
window->cached_surface_name = g_strdup (name);
if (window->cached_surface != NULL)
cairo_surface_destroy (window->cached_surface);
window->cached_surface = cairo_surface_reference (surface);
return surface;
}
guint32
broadway_server_new_window (BroadwayServer *server,
int x,

View File

@@ -78,5 +78,10 @@ gboolean broadway_server_window_move_resize (BroadwayServer *
int y,
int width,
int height);
cairo_surface_t * broadway_server_open_surface (BroadwayServer *server,
guint32 id,
char *name,
int width,
int height);
#endif /* __BROADWAY_SERVER__ */

View File

@@ -225,34 +225,16 @@ function flushSurface(surface)
context.save();
context.beginPath();
var minx;
var miny;
var maxx;
var maxy;
for (var j = 0; j < cmd.rects.length; j++) {
var rect = cmd.rects[j];
context.rect(rect.x, rect.y, rect.w, rect.h);
if (j == 0) {
minx = rect.x;
miny = rect.y;
maxx = rect.x + rect.w;
maxy = rect.y + rect.h;
} else {
if (rect.x < minx)
minx = rect.x;
if (rect.y < miny)
miny = rect.y;
if (rect.x + rect.w > maxx)
maxx = rect.x + rect.w;
if (rect.y + rect.h > maxy)
maxy = rect.y + rect.h;
}
}
context.clip();
context.globalCompositeOperation = "copy";
context.drawImage(context.canvas,
minx - cmd.dx, miny - cmd.dy, maxx - minx, maxy - miny,
minx, miny, maxx - minx, maxy - miny);
// This seems to break chrome when src overlaps dest
// But source-over should be fine for rgb surfaces anyway
//context.globalCompositeOperation = "copy";
context.drawImage(surface.canvas,
cmd.dx, cmd.dy);
context.restore();
break;
@@ -496,12 +478,6 @@ function cmdMoveResizeSurface(id, has_pos, x, y, has_size, w, h)
var xOffset = surface.x;
var yOffset = surface.y;
var transientToplevel = getTransientToplevel(surface);
if (transientToplevel) {
xOffset = surface.x - transientToplevel.x;
yOffset = surface.y - transientToplevel.y;
}
var element = surface.canvas;
if (surface.frame) {
element = surface.frame;
@@ -543,6 +519,21 @@ function handleCommands(cmd)
var command = cmd.get_char();
lastSerial = cmd.get_32();
switch (command) {
case 'l':
login ();
break;
case 'L':
if (loginDiv != null)
loginDiv.parentNode.removeChild(loginDiv);
start ();
break;
case 'D':
alert ("disconnected");
inputSocket = null;
break;
case 's': // create new surface
id = cmd.get_16();
x = cmd.get_16s();
@@ -742,8 +733,12 @@ BinCommands.prototype.get_32 = function() {
};
BinCommands.prototype.get_image_url = function() {
var size = this.get_32();
var png_blob = new Blob ([this.arraybuffer.slice (this.pos, this.pos + size)], {type:"image/png"});
var url = URL.createObjectURL(png_blob, {oneTimeOnly: true});
var png_blob = new Blob ([new Uint8Array (this.arraybuffer, this.pos, size)], {type:"image/png"});
var url;
if (window.webkitURL)
url = window.webkitURL.createObjectURL(png_blob);
else
url = window.URL.createObjectURL(png_blob, {oneTimeOnly: true});
this.pos = this.pos + size;
return url;
};
@@ -2590,7 +2585,7 @@ function onMouseWheel(ev)
var id = getSurfaceId(ev);
var pos = getPositionsFromEvent(ev, id);
var offset = ev.detail ? ev.detail : ev.wheelDelta;
var offset = ev.detail ? ev.detail : -ev.wheelDelta;
var dir = 0;
if (offset > 0)
dir = 1;
@@ -2631,6 +2626,47 @@ function newWS(loc) {
return ws;
}
function start()
{
setupDocument(document);
var w, h;
w = window.innerWidth;
h = window.innerHeight;
window.onresize = function(ev) {
var w, h;
w = window.innerWidth;
h = window.innerHeight;
sendInput ("d", [w, h]);
};
sendInput ("d", [w, h]);
}
var loginDiv = null;
function login()
{
if (loginDiv == null) {
var div = document.createElement('div');
document.body.appendChild(div);
div.innerHTML = "Please enter password<br>";
div.style.marginTop = "40px";
div.style.textAlign = "center";
var input = document.createElement("input");
input.setAttribute("type", "password");
div.appendChild(input);
input.focus ();
input.onkeyup = function(e) {
if (e.keyCode === 13 && input.value != "") {
inputSocket.send ("l" + input.value);
}
}
loginDiv = div;
} else {
alert ("Wrong password");
}
}
function connect()
{
var url = window.location.toString();
@@ -2639,7 +2675,7 @@ function connect()
var params = query_string[1].split("&");
}
var loc = window.location.toString().replace("http:", "ws:");
var loc = window.location.toString().replace("http:", "ws:").replace("https:", "wss:");
loc = loc.substr(0, loc.lastIndexOf('/')) + "/socket";
var supports_binary = newWS (loc + "-test").binaryType == "blob";
@@ -2652,23 +2688,13 @@ function connect()
ws.onopen = function() {
inputSocket = ws;
var w, h;
w = window.innerWidth;
h = window.innerHeight;
window.onresize = function(ev) {
var w, h;
w = window.innerWidth;
h = window.innerHeight;
sendInput ("d", [w, h]);
};
sendInput ("d", [w, h]);
};
ws.onclose = function() {
if (inputSocket != null)
alert ("disconnected");
inputSocket = null;
};
ws.onmessage = function(event) {
handleMessage(event.data);
};
setupDocument(document);
}

View File

@@ -140,62 +140,6 @@ region_from_rects (BroadwayRect *rects, int n_rects)
return region;
}
static const cairo_user_data_key_t shm_cairo_key;
typedef struct {
void *data;
gsize data_size;
} ShmSurfaceData;
static void
shm_data_unmap (void *_data)
{
ShmSurfaceData *data = _data;
munmap (data->data, data->data_size);
g_free (data);
}
cairo_surface_t *
open_surface (char *name, int width, int height)
{
ShmSurfaceData *data;
cairo_surface_t *surface;
gsize size;
void *ptr;
int fd;
size = width * height * sizeof (guint32);
fd = shm_open(name, O_RDONLY, 0600);
if (fd == -1)
{
perror ("Failed to shm_open");
return NULL;
}
ptr = mmap(0, size, PROT_READ, MAP_SHARED, fd, 0);
(void) close(fd);
if (ptr == NULL)
return NULL;
data = g_new0 (ShmSurfaceData, 1);
data->data = ptr;
data->data_size = size;
surface = cairo_image_surface_create_for_data ((guchar *)data->data,
CAIRO_FORMAT_RGB24,
width, height,
width * sizeof (guint32));
g_assert (surface != NULL);
cairo_surface_set_user_data (surface, &shm_cairo_key,
data, shm_data_unmap);
return surface;
}
void
add_client_serial_mapping (BroadwayClient *client,
guint32 client_serial,
@@ -337,9 +281,11 @@ client_handle_request (BroadwayClient *client,
cairo_region_destroy (area);
break;
case BROADWAY_REQUEST_UPDATE:
surface = open_surface (request->update.name,
request->update.width,
request->update.height);
surface = broadway_server_open_surface (server,
request->update.id,
request->update.name,
request->update.width,
request->update.height);
if (surface != NULL)
{
broadway_server_window_update (server,

View File

@@ -506,7 +506,7 @@ make_valid_fs_char (char c)
{
char chars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890";
return chars[c % sizeof (chars)];
return chars[c % (sizeof (chars) - 1)];
}
/* name must have at least space for 34 bytes */
@@ -582,6 +582,13 @@ _gdk_broadway_server_create_surface (int width,
res = ftruncate (fd, data->data_size);
g_assert (res != -1);
res = posix_fallocate (fd, 0, data->data_size);
if (res != 0)
{
shm_unlink (data->name);
g_error ("Not enough shared memory for window surface");
}
data->data = mmap(0, data->data_size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
(void) close(fd);

View File

@@ -116,7 +116,7 @@ gdk_broadway_device_get_state (GdkDevice *device,
{
gint x_int, y_int;
gdk_window_get_pointer (window, &x_int, &y_int, mask);
gdk_window_get_device_position (window, device, &x_int, &y_int, mask);
if (axes)
{
@@ -188,7 +188,7 @@ gdk_broadway_device_query_state (GdkDevice *device,
if (root_y)
*root_y = device_root_y;
if (win_x)
*win_x = device_root_y - toplevel->x;
*win_x = device_root_x - toplevel->x;
if (win_y)
*win_y = device_root_y - toplevel->y;
if (mask)
@@ -211,6 +211,29 @@ gdk_broadway_device_query_state (GdkDevice *device,
return;
}
void
_gdk_broadway_window_grab_check_unmap (GdkWindow *window,
gulong serial)
{
GdkDisplay *display = gdk_window_get_display (window);
GdkDeviceManager *device_manager;
GList *devices, *d;
device_manager = gdk_display_get_device_manager (display);
/* Get all devices */
devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
devices = g_list_concat (devices, gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_SLAVE));
devices = g_list_concat (devices, gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_FLOATING));
/* End all grabs on the newly hidden window */
for (d = devices; d; d = d->next)
_gdk_display_end_device_grab (display, d->data, serial, window, TRUE);
g_list_free (devices);
}
void
_gdk_broadway_window_grab_check_destroy (GdkWindow *window)
{

View File

@@ -55,8 +55,6 @@ G_DEFINE_TYPE (GdkBroadwayDisplay, gdk_broadway_display, GDK_TYPE_DISPLAY)
static void
gdk_broadway_display_init (GdkBroadwayDisplay *display)
{
_gdk_broadway_display_manager_add_display (gdk_display_manager_get (),
GDK_DISPLAY_OBJECT (display));
display->id_ht = g_hash_table_new (NULL, NULL);
}
@@ -173,7 +171,6 @@ _gdk_broadway_display_open (const gchar *display_name)
}
g_signal_emit_by_name (display, "opened");
g_signal_emit_by_name (gdk_display_manager_get (), "display-opened", display);
return display;
}
@@ -186,24 +183,6 @@ gdk_broadway_display_get_name (GdkDisplay *display)
return (gchar *) "Broadway";
}
static gint
gdk_broadway_display_get_n_screens (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
return 1;
}
static GdkScreen *
gdk_broadway_display_get_screen (GdkDisplay *display,
gint screen_num)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
g_return_val_if_fail (screen_num == 0, NULL);
return GDK_BROADWAY_DISPLAY (display)->screens[screen_num];
}
static GdkScreen *
gdk_broadway_display_get_default_screen (GdkDisplay *display)
{
@@ -257,9 +236,6 @@ gdk_broadway_display_dispose (GObject *object)
{
GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (object);
_gdk_broadway_display_manager_remove_display (gdk_display_manager_get (),
GDK_DISPLAY_OBJECT (object));
g_list_foreach (broadway_display->input_devices, (GFunc) g_object_run_dispose, NULL);
_gdk_screen_close (broadway_display->screens[0]);
@@ -394,8 +370,6 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
display_class->window_type = GDK_TYPE_BROADWAY_WINDOW;
display_class->get_name = gdk_broadway_display_get_name;
display_class->get_n_screens = gdk_broadway_display_get_n_screens;
display_class->get_screen = gdk_broadway_display_get_screen;
display_class->get_default_screen = gdk_broadway_display_get_default_screen;
display_class->beep = gdk_broadway_display_beep;
display_class->sync = gdk_broadway_display_sync;

View File

@@ -66,6 +66,8 @@ struct _GdkBroadwayDisplay
GdkWindow *active_offscreen_window;
GdkBroadwayServer *server;
gpointer move_resize_data;
};
struct _GdkBroadwayDisplayClass

View File

@@ -22,6 +22,7 @@
#include "config.h"
#include <stdlib.h>
#include "gdkdisplay-broadway.h"
#include "gdkbroadwaydisplaymanager.h"
#include "gdkprivate-broadway.h"
@@ -33,68 +34,63 @@ struct _GdkBroadwayDisplayManager
{
GdkDisplayManager parent;
GdkDisplay *default_display;
GSList *displays;
gboolean init_failed;
};
G_DEFINE_TYPE (GdkBroadwayDisplayManager, gdk_broadway_display_manager, GDK_TYPE_DISPLAY_MANAGER)
static void g_initable_iface_init (GInitableIface *iface);
static GdkDisplay *
gdk_broadway_display_manager_open_display (GdkDisplayManager *manager,
const gchar *name)
G_DEFINE_TYPE_WITH_CODE (GdkBroadwayDisplayManager, gdk_broadway_display_manager, GDK_TYPE_DISPLAY_MANAGER,
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, g_initable_iface_init))
static gboolean
gdk_broadway_display_manager_initable_init (GInitable *initable,
GCancellable *cancellable,
GError **error)
{
return _gdk_broadway_display_open (name);
const gchar *display_name;
gint port;
GdkBroadwayServer *server;
display_name = g_getenv ("BROADWAY_DISPLAY");
port = 0;
if (display_name != NULL)
{
if (*display_name == ':')
display_name++;
port = strtol(display_name, NULL, 10);
}
if (port == 0)
port = 1;
server = _gdk_broadway_server_new (port, NULL);
if (server == NULL)
{
GDK_BROADWAY_DISPLAY_MANAGER (initable)->init_failed = TRUE;
return FALSE;
}
g_object_unref (server);
return TRUE;
}
static GSList *
gdk_broadway_display_manager_list_displays (GdkDisplayManager *manager)
void
g_initable_iface_init (GInitableIface *iface)
{
GdkBroadwayDisplayManager *manager_broadway = GDK_BROADWAY_DISPLAY_MANAGER (manager);
return g_slist_copy (manager_broadway->displays);
}
static GdkDisplay *
gdk_broadway_display_manager_get_default_display (GdkDisplayManager *manager)
{
return GDK_BROADWAY_DISPLAY_MANAGER (manager)->default_display;
}
static void
gdk_broadway_display_manager_set_default_display (GdkDisplayManager *manager,
GdkDisplay *display)
{
GdkBroadwayDisplayManager *manager_broadway = GDK_BROADWAY_DISPLAY_MANAGER (manager);
manager_broadway->default_display = display;
}
#include "../gdkkeynames.c"
static gchar *
gdk_broadway_display_manager_get_keyval_name (GdkDisplayManager *manager,
guint keyval)
{
return _gdk_keyval_name (keyval);
}
static guint
gdk_broadway_display_manager_lookup_keyval (GdkDisplayManager *manager,
const gchar *name)
{
return _gdk_keyval_from_name (name);
iface->init = gdk_broadway_display_manager_initable_init;
}
static void
gdk_broadway_display_manager_init (GdkBroadwayDisplayManager *manager)
{
_gdk_broadway_windowing_init ();
}
static void
gdk_broadway_display_manager_finalize (GObject *object)
{
g_error ("A GdkBroadwayDisplayManager object was finalized. This should not happen");
if (!GDK_BROADWAY_DISPLAY_MANAGER (object)->init_failed)
g_error ("A GdkBroadwayDisplayManager object was finalized. This should not happen");
G_OBJECT_CLASS (gdk_broadway_display_manager_parent_class)->finalize (object);
}
@@ -102,45 +98,6 @@ static void
gdk_broadway_display_manager_class_init (GdkBroadwayDisplayManagerClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GdkDisplayManagerClass *manager_class = GDK_DISPLAY_MANAGER_CLASS (class);
object_class->finalize = gdk_broadway_display_manager_finalize;
manager_class->open_display = gdk_broadway_display_manager_open_display;
manager_class->list_displays = gdk_broadway_display_manager_list_displays;
manager_class->set_default_display = gdk_broadway_display_manager_set_default_display;
manager_class->get_default_display = gdk_broadway_display_manager_get_default_display;
manager_class->atom_intern = _gdk_broadway_display_manager_atom_intern;
manager_class->get_atom_name = _gdk_broadway_display_manager_get_atom_name;
manager_class->lookup_keyval = gdk_broadway_display_manager_lookup_keyval;
manager_class->get_keyval_name = gdk_broadway_display_manager_get_keyval_name;
}
void
_gdk_broadway_display_manager_add_display (GdkDisplayManager *manager,
GdkDisplay *display)
{
GdkBroadwayDisplayManager *manager_broadway = GDK_BROADWAY_DISPLAY_MANAGER (manager);
if (manager_broadway->displays == NULL)
gdk_display_manager_set_default_display (manager, display);
manager_broadway->displays = g_slist_prepend (manager_broadway->displays, display);
}
void
_gdk_broadway_display_manager_remove_display (GdkDisplayManager *manager,
GdkDisplay *display)
{
GdkBroadwayDisplayManager *manager_broadway = GDK_BROADWAY_DISPLAY_MANAGER (manager);
manager_broadway->displays = g_slist_remove (manager_broadway->displays, display);
if (manager_broadway->default_display == display)
{
if (manager_broadway->displays)
gdk_display_manager_set_default_display (manager, manager_broadway->displays->data);
else
gdk_display_manager_set_default_display (manager, NULL);
}
}

View File

@@ -247,7 +247,7 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
break;
case BROADWAY_EVENT_GRAB_NOTIFY:
case BROADWAY_EVENT_UNGRAB_NOTIFY:
_gdk_display_device_grab_update (display, display->core_pointer, NULL, message->base.serial);
_gdk_display_device_grab_update (display, display->core_pointer, display->core_pointer, message->base.serial);
break;
case BROADWAY_EVENT_CONFIGURE_NOTIFY:
@@ -256,10 +256,6 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
{
window->x = message->configure_notify.x;
window->y = message->configure_notify.y;
window->width = message->configure_notify.width;
window->height = message->configure_notify.height;
_gdk_window_update_size (window);
_gdk_broadway_window_resize_surface (window);
event = gdk_event_new (GDK_CONFIGURE);
event->configure.window = g_object_ref (window);

View File

@@ -1,38 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include "gdkmain.h"
#include "gdkinternals.h"
#include "gdkdisplay-broadway.h"
#include <locale.h>
#include <stdlib.h>
#include <string.h>
void
_gdk_broadway_initialize_locale (void)
{
}

View File

@@ -1,44 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include "config.h"
#include "gdkdisplay-broadway.h"
#include "gdkinternals.h"
#include "gdkprivate-broadway.h"
#include "gdkintl.h"
#include "gdkdeviceprivate.h"
#include <glib/gprintf.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
#include <errno.h>
void
_gdk_broadway_windowing_init (void)
{
_gdk_broadway_initialize_locale ();
}

View File

@@ -40,20 +40,6 @@
#include "gdkbroadwaywindow.h"
void _gdk_broadway_resync_windows (void);
void _gdk_broadway_windowing_init (void);
gchar * _gdk_broadway_display_manager_get_atom_name (GdkDisplayManager *manager,
GdkAtom atom);
void _gdk_broadway_display_manager_add_display (GdkDisplayManager *manager,
GdkDisplay *display);
void _gdk_broadway_display_manager_remove_display (GdkDisplayManager *manager,
GdkDisplay *display);
GdkAtom _gdk_broadway_display_manager_atom_intern_static_string (GdkDisplayManager *manager,
const gchar *atom_name);
GdkAtom _gdk_broadway_display_manager_atom_intern (GdkDisplayManager *manager,
const gchar *atom_name,
gboolean only_if_exists);
void _gdk_broadway_window_register_dnd (GdkWindow *window);
GdkDragContext * _gdk_broadway_window_drag_begin (GdkWindow *window,
@@ -92,6 +78,8 @@ gboolean _gdk_broadway_moveresize_configure_done (GdkDisplay *display,
void _gdk_broadway_selection_window_destroyed (GdkWindow *window);
void _gdk_broadway_window_grab_check_destroy (GdkWindow *window);
void _gdk_broadway_window_grab_check_unmap (GdkWindow *window,
gulong serial);
void _gdk_keymap_keys_changed (GdkDisplay *display);
gint _gdk_broadway_get_group_for_state (GdkDisplay *display,
@@ -101,8 +89,6 @@ void _gdk_keymap_add_virtual_modifiers_compat (GdkKeymap *keymap,
gboolean _gdk_keymap_key_is_modifier (GdkKeymap *keymap,
guint keycode);
void _gdk_broadway_initialize_locale (void);
void _gdk_broadway_screen_events_init (GdkScreen *screen);
GdkVisual *_gdk_broadway_screen_get_system_visual (GdkScreen * screen);
gint _gdk_broadway_screen_visual_get_best_depth (GdkScreen * screen);
@@ -217,9 +203,6 @@ void _gdk_broadway_window_resize_surface (GdkWindow *window);
void _gdk_broadway_cursor_update_theme (GdkCursor *cursor);
void _gdk_broadway_cursor_display_finalize (GdkDisplay *display);
#define GDK_SCREEN_DISPLAY(screen) (GDK_BROADWAY_SCREEN (screen)->display)
#define GDK_WINDOW_SCREEN(win) (GDK_WINDOW_IMPL_BROADWAY (((GdkWindow *)win)->impl)->screen)
#define GDK_WINDOW_DISPLAY(win) (GDK_BROADWAY_SCREEN (GDK_WINDOW_SCREEN (win))->display)
#define GDK_WINDOW_IS_BROADWAY(win) (GDK_IS_WINDOW_IMPL_BROADWAY (((GdkWindow *)win)->impl))
#endif /* __GDK_PRIVATE_BROADWAY_H__ */

View File

@@ -35,34 +35,6 @@
#include <string.h>
GdkAtom
_gdk_broadway_display_manager_atom_intern (GdkDisplayManager *manager,
const gchar *atom_name,
gboolean only_if_exists)
{
return _GDK_MAKE_ATOM (g_quark_from_string (atom_name));
}
GdkAtom
_gdk_broadway_display_manager_atom_intern_static_string (GdkDisplayManager *manager,
const gchar *atom_name)
{
return _GDK_MAKE_ATOM (g_quark_from_static_string (atom_name));
}
static const char *
get_atom_name (GdkAtom atom)
{
return g_quark_to_string (GPOINTER_TO_UINT(atom));
}
gchar *
_gdk_broadway_display_manager_get_atom_name (GdkDisplayManager *manager,
GdkAtom atom)
{
return g_strdup (get_atom_name (atom));
}
gboolean
_gdk_broadway_window_get_property (GdkWindow *window,
GdkAtom property,

View File

@@ -83,18 +83,16 @@ G_DEFINE_TYPE (GdkWindowImplBroadway,
gdk_window_impl_broadway,
GDK_TYPE_WINDOW_IMPL)
static guint dirty_flush_id = 0;
static gboolean
dirty_flush_idle (gpointer data)
static void
update_dirty_windows_and_sync (void)
{
GList *l;
GdkBroadwayDisplay *display;
dirty_flush_id = 0;
gboolean updated_surface;
display = GDK_BROADWAY_DISPLAY (gdk_display_get_default ());
updated_surface = FALSE;
for (l = display->toplevels; l != NULL; l = l->next)
{
GdkWindowImplBroadway *impl = l->data;
@@ -102,6 +100,7 @@ dirty_flush_idle (gpointer data)
if (impl->dirty)
{
impl->dirty = FALSE;
updated_surface = TRUE;
_gdk_broadway_server_window_update (display->server,
impl->id,
impl->surface);
@@ -110,16 +109,32 @@ dirty_flush_idle (gpointer data)
/* We sync here to ensure all references to the impl->surface memory
is done, as we may later paint new data in them. */
gdk_display_sync (GDK_DISPLAY (display));
if (updated_surface)
gdk_display_sync (GDK_DISPLAY (display));
else
gdk_display_flush (GDK_DISPLAY (display));
}
static guint flush_id = 0;
static gboolean
flush_idle (gpointer data)
{
flush_id = 0;
gdk_display_flush (gdk_display_get_default ());
return FALSE;
}
/* We need to flush in an idle rather than AFTER_PAINT, as the clock
is frozen during e.g. window resizes so the paint will not happen
and the window resize request is never flushed. */
static void
queue_dirty_flush (GdkBroadwayDisplay *display)
queue_flush (GdkWindow *window)
{
if (dirty_flush_id == 0)
dirty_flush_id = gdk_threads_add_idle (dirty_flush_idle, NULL);
if (flush_id == 0)
flush_id = gdk_threads_add_idle (flush_idle, NULL);
}
static void
@@ -197,6 +212,25 @@ _gdk_broadway_screen_init_root_window (GdkScreen * screen)
_gdk_window_update_size (broadway_screen->root_window);
}
static void
on_frame_clock_after_paint (GdkFrameClock *clock,
GdkWindow *window)
{
update_dirty_windows_and_sync ();
}
static void
connect_frame_clock (GdkWindow *window)
{
if (WINDOW_IS_TOPLEVEL (window))
{
GdkFrameClock *frame_clock = gdk_window_get_frame_clock (window);
g_signal_connect (frame_clock, "after-paint",
G_CALLBACK (on_frame_clock_after_paint), window);
}
}
void
_gdk_broadway_display_create_window_impl (GdkDisplay *display,
GdkWindow *window,
@@ -229,22 +263,21 @@ _gdk_broadway_display_create_window_impl (GdkDisplay *display,
g_assert (GDK_WINDOW_TYPE (window->parent) == GDK_WINDOW_ROOT);
broadway_display->toplevels = g_list_prepend (broadway_display->toplevels, impl);
connect_frame_clock (window);
}
void
_gdk_broadway_window_resize_surface (GdkWindow *window)
{
GdkWindowImplBroadway *impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
cairo_surface_t *old;
if (impl->surface)
{
old = impl->surface;
cairo_surface_destroy (impl->surface);
impl->surface = _gdk_broadway_server_create_surface (gdk_window_get_width (impl->wrapper),
gdk_window_get_height (impl->wrapper));
cairo_surface_destroy (old);
}
if (impl->ref_surface)
@@ -384,7 +417,7 @@ gdk_window_broadway_show (GdkWindow *window, gboolean already_mapped)
broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window));
if (_gdk_broadway_server_window_show (broadway_display->server, impl->id))
queue_dirty_flush (broadway_display);
queue_flush (window);
}
@@ -404,8 +437,12 @@ gdk_window_broadway_hide (GdkWindow *window)
_gdk_make_event (GDK_WINDOW (window), GDK_UNMAP, NULL, FALSE);
broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window));
_gdk_broadway_window_grab_check_unmap (window,
_gdk_broadway_server_get_next_serial (broadway_display->server));
if (_gdk_broadway_server_window_hide (broadway_display->server, impl->id))
queue_dirty_flush (broadway_display);
queue_flush (window);
_gdk_window_clear_update_area (window);
}
@@ -460,7 +497,7 @@ gdk_window_broadway_move_resize (GdkWindow *window,
with_move,
x, y,
window->width, window->height);
queue_dirty_flush (broadway_display);
queue_flush (window);
if (size_changed)
window->resize_count++;
}
@@ -545,6 +582,12 @@ gdk_broadway_window_set_geometry_hints (GdkWindow *window,
const GdkGeometry *geometry,
GdkWindowHints geom_mask)
{
GdkWindowImplBroadway *impl;
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
impl->geometry_hints = *geometry;
impl->geometry_hints_mask = geom_mask;
}
static void
@@ -610,7 +653,7 @@ gdk_window_broadway_set_device_cursor (GdkWindow *window,
{
_gdk_broadway_cursor_update_theme (cursor);
g_hash_table_replace (impl->device_cursor,
device, gdk_cursor_ref (cursor));
device, g_object_ref (cursor));
}
if (!GDK_WINDOW_DESTROYED (window))
@@ -992,6 +1035,8 @@ struct _MoveResizeData
gint moveresize_orig_width;
gint moveresize_orig_height;
long moveresize_process_time;
GdkWindowHints moveresize_geom_mask;
GdkGeometry moveresize_geometry;
BroadwayInputMsg *moveresize_pending_event;
};
@@ -999,20 +1044,19 @@ static MoveResizeData *
get_move_resize_data (GdkDisplay *display,
gboolean create)
{
GdkBroadwayDisplay *broadway_display;
MoveResizeData *mv_resize;
static GQuark move_resize_quark = 0;
if (!move_resize_quark)
move_resize_quark = g_quark_from_static_string ("gdk-window-moveresize");
broadway_display = GDK_BROADWAY_DISPLAY (display);
mv_resize = g_object_get_qdata (G_OBJECT (display), move_resize_quark);
mv_resize = broadway_display->move_resize_data;
if (!mv_resize && create)
{
mv_resize = g_new0 (MoveResizeData, 1);
mv_resize->display = display;
g_object_set_qdata (G_OBJECT (display), move_resize_quark, mv_resize);
broadway_display->move_resize_data = mv_resize;
}
return mv_resize;
@@ -1081,6 +1125,13 @@ update_pos (MoveResizeData *mv_resize,
w = MAX (w, 1);
h = MAX (h, 1);
if (mv_resize->moveresize_geom_mask)
{
gdk_window_constrain_size (&mv_resize->moveresize_geometry,
mv_resize->moveresize_geom_mask,
w, h, &w, &h);
}
gdk_window_move_resize (mv_resize->moveresize_window, x, y, w, h);
}
else
@@ -1135,7 +1186,7 @@ _gdk_broadway_moveresize_handle_event (GdkDisplay *display,
switch (event->base.type)
{
case 'm':
case BROADWAY_EVENT_POINTER_MOVE:
if (mv_resize->moveresize_window->resize_count > 0)
{
if (mv_resize->moveresize_pending_event)
@@ -1163,7 +1214,7 @@ _gdk_broadway_moveresize_handle_event (GdkDisplay *display,
finish_drag (mv_resize);
break;
case 'B':
case BROADWAY_EVENT_BUTTON_RELEASE:
update_pos (mv_resize,
event->pointer.root_x,
event->pointer.root_y);
@@ -1224,6 +1275,7 @@ create_moveresize_window (MoveResizeData *mv_resize,
gdk_window_show (mv_resize->moveresize_emulation_window);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
status = gdk_pointer_grab (mv_resize->moveresize_emulation_window,
FALSE,
GDK_BUTTON_RELEASE_MASK |
@@ -1231,6 +1283,7 @@ create_moveresize_window (MoveResizeData *mv_resize,
NULL,
NULL,
timestamp);
G_GNUC_END_IGNORE_DEPRECATIONS;
if (status != GDK_GRAB_SUCCESS)
{
@@ -1243,6 +1296,71 @@ create_moveresize_window (MoveResizeData *mv_resize,
mv_resize->moveresize_process_time = 0;
}
static void
calculate_unmoving_origin (MoveResizeData *mv_resize)
{
GdkRectangle rect;
gint width, height;
if (mv_resize->moveresize_geom_mask & GDK_HINT_WIN_GRAVITY &&
mv_resize->moveresize_geometry.win_gravity == GDK_GRAVITY_STATIC)
{
gdk_window_get_origin (mv_resize->moveresize_window,
&mv_resize->moveresize_orig_x,
&mv_resize->moveresize_orig_y);
}
else
{
gdk_window_get_frame_extents (mv_resize->moveresize_window, &rect);
gdk_window_get_geometry (mv_resize->moveresize_window,
NULL, NULL, &width, &height);
switch (mv_resize->moveresize_geometry.win_gravity)
{
case GDK_GRAVITY_NORTH_WEST:
mv_resize->moveresize_orig_x = rect.x;
mv_resize->moveresize_orig_y = rect.y;
break;
case GDK_GRAVITY_NORTH:
mv_resize->moveresize_orig_x = rect.x + rect.width / 2 - width / 2;
mv_resize->moveresize_orig_y = rect.y;
break;
case GDK_GRAVITY_NORTH_EAST:
mv_resize->moveresize_orig_x = rect.x + rect.width - width;
mv_resize->moveresize_orig_y = rect.y;
break;
case GDK_GRAVITY_WEST:
mv_resize->moveresize_orig_x = rect.x;
mv_resize->moveresize_orig_y = rect.y + rect.height / 2 - height / 2;
break;
case GDK_GRAVITY_CENTER:
mv_resize->moveresize_orig_x = rect.x + rect.width / 2 - width / 2;
mv_resize->moveresize_orig_y = rect.y + rect.height / 2 - height / 2;
break;
case GDK_GRAVITY_EAST:
mv_resize->moveresize_orig_x = rect.x + rect.width - width;
mv_resize->moveresize_orig_y = rect.y + rect.height / 2 - height / 2;
break;
case GDK_GRAVITY_SOUTH_WEST:
mv_resize->moveresize_orig_x = rect.x;
mv_resize->moveresize_orig_y = rect.y + rect.height - height;
break;
case GDK_GRAVITY_SOUTH:
mv_resize->moveresize_orig_x = rect.x + rect.width / 2 - width / 2;
mv_resize->moveresize_orig_y = rect.y + rect.height - height;
break;
case GDK_GRAVITY_SOUTH_EAST:
mv_resize->moveresize_orig_x = rect.x + rect.width - width;
mv_resize->moveresize_orig_y = rect.y + rect.height - height;
break;
default:
mv_resize->moveresize_orig_x = rect.x;
mv_resize->moveresize_orig_y = rect.y;
break;
}
}
}
static void
gdk_broadway_window_begin_resize_drag (GdkWindow *window,
GdkWindowEdge edge,
@@ -1253,12 +1371,15 @@ gdk_broadway_window_begin_resize_drag (GdkWindow *window,
guint32 timestamp)
{
MoveResizeData *mv_resize;
GdkWindowImplBroadway *impl;
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
if (GDK_WINDOW_DESTROYED (window) ||
!WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
return;
mv_resize = get_move_resize_data (GDK_WINDOW_DISPLAY (window), TRUE);
mv_resize = get_move_resize_data (gdk_window_get_display (window), TRUE);
mv_resize->is_resize = TRUE;
mv_resize->moveresize_button = button;
@@ -1267,12 +1388,14 @@ gdk_broadway_window_begin_resize_drag (GdkWindow *window,
mv_resize->moveresize_y = root_y;
mv_resize->moveresize_window = g_object_ref (window);
gdk_window_get_origin (mv_resize->moveresize_window,
&mv_resize->moveresize_orig_x,
&mv_resize->moveresize_orig_y);
mv_resize->moveresize_orig_width = gdk_window_get_width (window);
mv_resize->moveresize_orig_height = gdk_window_get_height (window);
mv_resize->moveresize_geom_mask = impl->geometry_hints_mask;
mv_resize->moveresize_geometry = impl->geometry_hints;
calculate_unmoving_origin (mv_resize);
create_moveresize_window (mv_resize, timestamp);
}
@@ -1328,7 +1451,6 @@ gdk_broadway_window_process_updates_recurse (GdkWindow *window,
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
impl->dirty = TRUE;
queue_dirty_flush (GDK_BROADWAY_DISPLAY (gdk_window_get_display (window)));
}
void
@@ -1348,56 +1470,6 @@ _gdk_broadway_window_queue_antiexpose (GdkWindow *window,
return TRUE;
}
static void
copy_region (cairo_surface_t *surface,
cairo_region_t *area,
gint dx,
gint dy)
{
cairo_t *cr;
cr = cairo_create (surface);
gdk_cairo_region (cr, area);
cairo_clip (cr);
/* NB: This is a self-copy and Cairo doesn't support that yet.
* So we do a litle trick.
*/
cairo_push_group (cr);
cairo_set_source_surface (cr, surface, dx, dy);
cairo_paint (cr);
cairo_pop_group_to_source (cr);
cairo_paint (cr);
cairo_destroy (cr);
}
void
_gdk_broadway_window_translate (GdkWindow *window,
cairo_region_t *area,
gint dx,
gint dy)
{
GdkWindowImplBroadway *impl;
GdkBroadwayDisplay *broadway_display;
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
if (impl->surface)
{
copy_region (impl->surface, area, dx, dy);
broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window));
if (_gdk_broadway_server_window_translate (broadway_display->server,
impl->id,
area, dx, dy))
queue_dirty_flush (broadway_display);
}
}
guint32
gdk_broadway_get_last_seen_time (GdkWindow *window)
{
@@ -1436,7 +1508,6 @@ gdk_window_impl_broadway_class_init (GdkWindowImplBroadwayClass *klass)
impl_class->input_shape_combine_region = gdk_window_broadway_input_shape_combine_region;
impl_class->set_static_gravities = gdk_window_broadway_set_static_gravities;
impl_class->queue_antiexpose = _gdk_broadway_window_queue_antiexpose;
impl_class->translate = _gdk_broadway_window_translate;
impl_class->destroy = _gdk_broadway_window_destroy;
impl_class->destroy_foreign = gdk_broadway_window_destroy_foreign;
impl_class->resize_cairo_surface = gdk_window_broadway_resize_cairo_surface;

View File

@@ -64,6 +64,9 @@ struct _GdkWindowImplBroadway
gint8 toplevel_window_type;
gboolean dirty;
gboolean last_synced;
GdkGeometry geometry_hints;
GdkWindowHints geometry_hints_mask;
};
struct _GdkWindowImplBroadwayClass

View File

@@ -275,9 +275,6 @@ gdk_pre_parse_libgtk_only (void)
else if (g_str_equal (rendering_mode, "recording"))
_gdk_rendering_mode = GDK_RENDERING_MODE_RECORDING;
}
/* Do any setup particular to the windowing system */
gdk_display_manager_get ();
}
@@ -328,6 +325,24 @@ gdk_parse_args (int *argc,
GDK_NOTE (MISC, g_message ("progname: \"%s\"", g_get_prgname ()));
}
/**
* gdk_get_display:
*
* Gets the name of the display, which usually comes from the
* <envar>DISPLAY</envar> environment variable or the
* <option>--display</option> command line option.
*
* Returns: the name of the display.
*
* Deprecated: 3.8: Call gdk_display_get_name (gdk_display_get_default ()))
* instead.
*/
gchar *
gdk_get_display (void)
{
return g_strdup (gdk_display_get_name (gdk_display_get_default ()));
}
/**
* gdk_get_display_arg_name:
*
@@ -353,7 +368,7 @@ gdk_get_display_arg_name (void)
*
* Opens the default display specified by command line arguments or
* environment variables, sets it as the default display, and returns
* it. gdk_parse_args must have been called first. If the default
* it. gdk_parse_args() must have been called first. If the default
* display has previously been set, simply returns that. An internal
* function that should not be used by applications.
*
@@ -367,6 +382,9 @@ gdk_display_open_default_libgtk_only (void)
g_return_val_if_fail (gdk_initialized, NULL);
if (gdk_display_manager_peek () == NULL)
return NULL;
display = gdk_display_get_default ();
if (display)
return display;

View File

@@ -101,6 +101,7 @@ gdk_display_is_closed
gdk_display_keyboard_ungrab
gdk_display_list_devices
gdk_display_manager_get
gdk_display_manager_peek
gdk_display_manager_get_default_display
gdk_display_manager_get_type
gdk_display_manager_list_displays
@@ -335,6 +336,7 @@ gdk_set_program_class
gdk_set_show_events
gdk_setting_action_get_type
gdk_setting_get
gdk_set_allowed_backends
gdk_status_get_type
gdk_synthesize_window_state
gdk_test_render_sync

View File

@@ -25,6 +25,7 @@
#include "gdkdisplayprivate.h"
#include "gdkdeviceprivate.h"
#include "gdkdisplaymanagerprivate.h"
#include "gdkevents.h"
#include "gdkwindowimpl.h"
#include "gdkinternals.h"
@@ -81,6 +82,36 @@ static guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (GdkDisplay, gdk_display, G_TYPE_OBJECT)
static void
gdk_display_real_make_default (GdkDisplay *display)
{
}
static void
device_removed_cb (GdkDeviceManager *device_manager,
GdkDevice *device,
GdkDisplay *display)
{
g_hash_table_remove (display->multiple_click_info, device);
g_hash_table_remove (display->device_grabs, device);
g_hash_table_remove (display->pointers_info, device);
/* FIXME: change core pointer and remove from device list */
}
static void
gdk_display_real_opened (GdkDisplay *display)
{
GdkDeviceManager *device_manager;
device_manager = gdk_display_get_device_manager (display);
g_signal_connect (device_manager, "device-removed",
G_CALLBACK (device_removed_cb), display);
_gdk_display_manager_add_display (gdk_display_manager_get (), display);
}
static void
gdk_display_class_init (GdkDisplayClass *class)
{
@@ -92,6 +123,9 @@ gdk_display_class_init (GdkDisplayClass *class)
class->get_app_launch_context = gdk_display_real_get_app_launch_context;
class->window_type = GDK_TYPE_WINDOW;
class->opened = gdk_display_real_opened;
class->make_default = gdk_display_real_make_default;
/**
* GdkDisplay::opened:
* @display: the object on which the signal is emitted
@@ -103,7 +137,8 @@ gdk_display_class_init (GdkDisplayClass *class)
g_signal_new (g_intern_static_string ("opened"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
0, NULL, NULL,
G_STRUCT_OFFSET (GdkDisplayClass, opened),
NULL, NULL,
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
@@ -157,29 +192,6 @@ free_device_grabs_foreach (gpointer key,
return TRUE;
}
static void
device_removed_cb (GdkDeviceManager *device_manager,
GdkDevice *device,
GdkDisplay *display)
{
g_hash_table_remove (display->multiple_click_info, device);
g_hash_table_remove (display->device_grabs, device);
g_hash_table_remove (display->pointers_info, device);
/* FIXME: change core pointer and remove from device list */
}
static void
gdk_display_opened (GdkDisplay *display)
{
GdkDeviceManager *device_manager;
device_manager = gdk_display_get_device_manager (display);
g_signal_connect (device_manager, "device-removed",
G_CALLBACK (device_removed_cb), display);
}
static void
gdk_display_init (GdkDisplay *display)
{
@@ -196,9 +208,6 @@ gdk_display_init (GdkDisplay *display)
display->multiple_click_info = g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) g_free);
g_signal_connect (display, "opened",
G_CALLBACK (gdk_display_opened), NULL);
}
static void
@@ -209,6 +218,8 @@ gdk_display_dispose (GObject *object)
device_manager = gdk_display_get_device_manager (GDK_DISPLAY (object));
_gdk_display_manager_remove_display (gdk_display_manager_get (), display);
g_list_free_full (display->queued_events, (GDestroyNotify) gdk_event_free);
display->queued_events = NULL;
display->queued_tail = NULL;
@@ -1415,12 +1426,6 @@ gdk_display_get_name (GdkDisplay *display)
return GDK_DISPLAY_GET_CLASS (display)->get_name (display);
}
gchar *
gdk_get_display (void)
{
return g_strdup (gdk_display_get_name (gdk_display_get_default ()));
}
/**
* gdk_display_get_n_screens:
* @display: a #GdkDisplay
@@ -1430,13 +1435,15 @@ gdk_get_display (void)
* Returns: number of screens.
*
* Since: 2.2
*
* Deprecated: 3.10: The number of screens is always 1.
*/
gint
gdk_display_get_n_screens (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
return GDK_DISPLAY_GET_CLASS (display)->get_n_screens (display);
return 1;
}
/**
@@ -1455,8 +1462,9 @@ gdk_display_get_screen (GdkDisplay *display,
gint screen_num)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
g_return_val_if_fail (screen_num == 0, NULL);
return GDK_DISPLAY_GET_CLASS (display)->get_screen (display, screen_num);
return gdk_display_get_default_screen (display);
}
/**

View File

@@ -45,6 +45,7 @@ GdkDisplay *gdk_display_open (const gchar *display_name);
const gchar * gdk_display_get_name (GdkDisplay *display);
GDK_DEPRECATED_IN_3_10
gint gdk_display_get_n_screens (GdkDisplay *display);
GdkScreen * gdk_display_get_screen (GdkDisplay *display,
gint screen_num);

View File

@@ -26,6 +26,7 @@
#include "gdkconfig.h"
#include "gdkdisplaymanagerprivate.h"
#include "gdkdisplayprivate.h"
#include "gdkinternals.h"
#include "gdkkeysprivate.h"
#include "gdkmarshalers.h"
@@ -33,26 +34,32 @@
#ifdef GDK_WINDOWING_X11
#include "x11/gdkx.h"
#include "x11/gdkprivate-x11.h"
#endif
#ifdef GDK_WINDOWING_QUARTZ
/* We immediately include gdkquartzdisplaymanager.h here instead of
* gdkquartz.h so that we do not have to enable -xobjective-c for the
* "generic" GDK source code.
/* When the gdk_quartz_display_open function is removed We can
* immediately include gdkquartzdisplaymanager.h here instead of
* gdkprivate-quartz.h so that we won't have to enable -xobjective-c
* for the "generic" GDK source code.
* #include "quartz/gdkquartzdisplaymanager.h"
*/
#include "quartz/gdkquartzdisplaymanager.h"
#include "quartz/gdkprivate-quartz.h"
#endif
#ifdef GDK_WINDOWING_BROADWAY
#include "broadway/gdkbroadwaydisplaymanager.h"
#include "broadway/gdkprivate-broadway.h"
#endif
#ifdef GDK_WINDOWING_WIN32
#include "win32/gdkwin32.h"
#include "win32/gdkprivate-win32.h"
#endif
#ifdef GDK_WINDOWING_WAYLAND
#include "wayland/gdkwayland.h"
#include "wayland/gdkprivate-wayland.h"
#endif
/**
@@ -125,7 +132,24 @@ static void gdk_display_manager_get_property (GObject *object,
static guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (GdkDisplayManager, gdk_display_manager, G_TYPE_OBJECT)
static void g_initable_iface_init (GInitableIface *iface);
G_DEFINE_TYPE_WITH_CODE (GdkDisplayManager, gdk_display_manager, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, g_initable_iface_init))
static gboolean
gdk_display_manager_initable_init (GInitable *initable,
GCancellable *cancellable,
GError **error)
{
return TRUE;
}
static void
g_initable_iface_init (GInitableIface *iface)
{
iface->init = gdk_display_manager_initable_init;
}
static void
gdk_display_manager_class_init (GdkDisplayManagerClass *klass)
@@ -135,8 +159,6 @@ gdk_display_manager_class_init (GdkDisplayManagerClass *klass)
object_class->set_property = gdk_display_manager_set_property;
object_class->get_property = gdk_display_manager_get_property;
klass->keyval_convert_case = _gdk_display_manager_real_keyval_convert_case;
/**
* GdkDisplayManager::display-opened:
* @manager: the object on which the signal is emitted
@@ -208,6 +230,50 @@ gdk_display_manager_get_property (GObject *object,
}
}
static const gchar *allowed_backends;
/**
* gdk_set_allowed_backends:
* @backends: a comma-separated list of backends
*
* Sets a list of backends that GDK should try to use.
*
* This can be be useful if your application does not
* work with certain GDK backends.
*
* By default, GDK tries all included backends.
*
* For example,
* <programlisting>
* gdk_set_allowed_backends ("wayland,quartz,*");
* </programlisting>
* instructs GDK to try the Wayland backend first,
* followed by the Quartz backend, and then all
* others.
*
* If the <envvar>GDK_BACKEND</envvar> environment variable
* is set, it determines what backends are tried in what
* order, while still respecting the set of allowed backends
* that are specified by this function.
*
* The possible backend names are x11, win32, quartz,
* broadway, wayland. You can also include a * in the
* list to try all remaining backends.
*
* This call must happen prior to gdk_display_open(),
* gtk_init(), gtk_init_with_args() or gtk_init_check()
* in order to take effect.
*
* Since: 3.10
*/
void
gdk_set_allowed_backends (const gchar *backends)
{
allowed_backends = g_strdup (backends);
}
static GdkDisplayManager *manager = NULL;
/**
* gdk_display_manager_get:
*
@@ -216,7 +282,8 @@ gdk_display_manager_get_property (GObject *object,
* When called for the first time, this function consults the
* <envar>GDK_BACKEND</envar> environment variable to find out which
* of the supported GDK backends to use (in case GDK has been compiled
* with multiple backends).
* with multiple backends). Applications can use gdk_set_allowed_backends()
* to limit what backends can be used.
*
* Returns: (transfer none): The global #GdkDisplayManager singleton;
* gdk_parse_args(), gdk_init(), or gdk_init_check() must have
@@ -227,42 +294,95 @@ gdk_display_manager_get_property (GObject *object,
GdkDisplayManager*
gdk_display_manager_get (void)
{
static GdkDisplayManager *manager = NULL;
gdk_display_manager_peek ();
if (!manager)
{
const gchar *backend;
if (manager == NULL)
g_error ("No GDK backend found (%s)", allowed_backends);
backend = g_getenv ("GDK_BACKEND");
return manager;
}
typedef struct _GdkBackend GdkBackend;
struct _GdkBackend {
const char *name;
GType (* get_backend_type) (void);
GdkDisplay * (* open_display) (const char *name);
};
GdkBackend gdk_backends[] = {
#ifdef GDK_WINDOWING_QUARTZ
if (backend == NULL || strcmp (backend, "quartz") == 0)
manager = g_object_new (gdk_quartz_display_manager_get_type (), NULL);
else
{ "quartz", gdk_quartz_display_manager_get_type, _gdk_quartz_display_open },
#endif
#ifdef GDK_WINDOWING_WIN32
if (backend == NULL || strcmp (backend, "win32") == 0)
manager = g_object_new (gdk_win32_display_manager_get_type (), NULL);
else
{ "win32", gdk_win32_display_manager_get_type, _gdk_win32_display_open },
#endif
#ifdef GDK_WINDOWING_X11
if (backend == NULL || strcmp (backend, "x11") == 0)
manager = g_object_new (gdk_x11_display_manager_get_type (), NULL);
else
{ "x11", gdk_x11_display_manager_get_type, _gdk_x11_display_open },
#endif
#ifdef GDK_WINDOWING_WAYLAND
if (backend == NULL || strcmp (backend, "wayland") == 0)
manager = g_object_new (gdk_wayland_display_manager_get_type (), NULL);
else
{ "wayland", gdk_wayland_display_manager_get_type, _gdk_wayland_display_open },
#endif
#ifdef GDK_WINDOWING_BROADWAY
if (backend == NULL || strcmp (backend, "broadway") == 0)
manager = g_object_new (gdk_broadway_display_manager_get_type (), NULL);
else
{ "broadway", gdk_broadway_display_manager_get_type, _gdk_broadway_display_open },
#endif
if (backend != NULL)
g_error ("Unsupported GDK backend: %s", backend);
else
g_error ("No GDK backend found");
/* NULL-terminating this array so we can use commas above */
{ NULL, NULL }
};
/**
* gdk_display_manager_peek:
*
* Gets the singleton #GdkDisplayManager object. If GDK could
* not be initialized, %NULL is returned.
*
* Returns: (transfer none): The global #GdkDisplayManager singleton,
* or %NULL if GDK could not be initialized. gdk_parse_args(),
* gdk_init(), or gdk_init_check() must have been called first
*
* Since: 3.10
*/
GdkDisplayManager *
gdk_display_manager_peek (void)
{
if (manager == NULL)
{
const gchar *backend_list;
gchar **backends;
gint i, j;
gboolean allow_any;
if (allowed_backends == NULL)
allowed_backends = "*";
allow_any = strstr (allowed_backends, "*") != NULL;
backend_list = g_getenv ("GDK_BACKEND");
if (backend_list == NULL)
backend_list = allowed_backends;
backends = g_strsplit (backend_list, ",", 0);
for (i = 0; manager == NULL && backends[i] != NULL; i++)
{
const gchar *backend = backends[i];
gboolean any = g_str_equal (backend, "*");
if (!allow_any && !any && !strstr (allowed_backends, backend))
continue;
for (j = 0; gdk_backends[j].name != NULL; j++)
{
if ((any && allow_any) ||
(any && strstr (allowed_backends, gdk_backends[j].name)) ||
g_str_equal (backend, gdk_backends[j].name))
{
GDK_NOTE (MISC, g_message ("Trying %s backend", gdk_backends[j].name));
manager = g_initable_new (gdk_backends[j].get_backend_type (), NULL, NULL, NULL);
if (manager)
break;
}
}
}
g_strfreev (backends);
}
return manager;
@@ -282,7 +402,7 @@ gdk_display_manager_get (void)
GdkDisplay *
gdk_display_manager_get_default_display (GdkDisplayManager *manager)
{
return GDK_DISPLAY_MANAGER_GET_CLASS (manager)->get_default_display (manager);
return manager->default_display;
}
/**
@@ -339,7 +459,10 @@ void
gdk_display_manager_set_default_display (GdkDisplayManager *manager,
GdkDisplay *display)
{
GDK_DISPLAY_MANAGER_GET_CLASS (manager)->set_default_display (manager, display);
manager->default_display = display;
if (display)
GDK_DISPLAY_GET_CLASS (display)->make_default (display);
g_object_notify (G_OBJECT (manager), "default-display");
}
@@ -359,7 +482,7 @@ gdk_display_manager_set_default_display (GdkDisplayManager *manager,
GSList *
gdk_display_manager_list_displays (GdkDisplayManager *manager)
{
return GDK_DISPLAY_MANAGER_GET_CLASS (manager)->list_displays (manager);
return g_slist_copy (manager->displays);
}
/**
@@ -378,71 +501,45 @@ GdkDisplay *
gdk_display_manager_open_display (GdkDisplayManager *manager,
const gchar *name)
{
return GDK_DISPLAY_MANAGER_GET_CLASS (manager)->open_display (manager, name);
guint i;
for (i = 0; gdk_backends[i].name != NULL; i++)
{
if (G_OBJECT_TYPE (manager) == gdk_backends[i].get_backend_type ())
{
return gdk_backends[i].open_display (name);
}
}
g_assert_not_reached ();
return NULL;
}
/**
* gdk_atom_intern:
* @atom_name: a string.
* @only_if_exists: if %TRUE, GDK is allowed to not create a new atom, but
* just return %GDK_NONE if the requested atom doesn't already
* exists. Currently, the flag is ignored, since checking the
* existance of an atom is as expensive as creating it.
*
* Finds or creates an atom corresponding to a given string.
*
* Returns: (transfer none): the atom corresponding to @atom_name.
*/
GdkAtom
gdk_atom_intern (const gchar *atom_name,
gboolean only_if_exists)
void
_gdk_display_manager_add_display (GdkDisplayManager *manager,
GdkDisplay *display)
{
GdkDisplayManager *manager = gdk_display_manager_get ();
if (manager->displays == NULL)
gdk_display_manager_set_default_display (manager, display);
return GDK_DISPLAY_MANAGER_GET_CLASS (manager)->atom_intern (manager, atom_name, TRUE);
manager->displays = g_slist_prepend (manager->displays, display);
g_signal_emit (manager, signals[DISPLAY_OPENED], 0, display);
}
/**
* gdk_atom_intern_static_string:
* @atom_name: a static string
*
* Finds or creates an atom corresponding to a given string.
*
* Note that this function is identical to gdk_atom_intern() except
* that if a new #GdkAtom is created the string itself is used rather
* than a copy. This saves memory, but can only be used if the string
* will <emphasis>always</emphasis> exist. It can be used with statically
* allocated strings in the main program, but not with statically
* allocated memory in dynamically loaded modules, if you expect to
* ever unload the module again (e.g. do not use this function in
* GTK+ theme engines).
*
* Returns: (transfer none): the atom corresponding to @atom_name
*
* Since: 2.10
*/
GdkAtom
gdk_atom_intern_static_string (const gchar *atom_name)
/* NB: This function can be called multiple times per display. */
void
_gdk_display_manager_remove_display (GdkDisplayManager *manager,
GdkDisplay *display)
{
GdkDisplayManager *manager = gdk_display_manager_get ();
manager->displays = g_slist_remove (manager->displays, display);
return GDK_DISPLAY_MANAGER_GET_CLASS (manager)->atom_intern (manager, atom_name, FALSE);
}
/**
* gdk_atom_name:
* @atom: a #GdkAtom.
*
* Determines the string corresponding to an atom.
*
* Returns: a newly-allocated string containing the string
* corresponding to @atom. When you are done with the
* return value, you should free it using g_free().
*/
gchar *
gdk_atom_name (GdkAtom atom)
{
GdkDisplayManager *manager = gdk_display_manager_get ();
return GDK_DISPLAY_MANAGER_GET_CLASS (manager)->get_atom_name (manager, atom);
if (manager->default_display == display)
{
if (manager->displays)
gdk_display_manager_set_default_display (manager, manager->displays->data);
else
gdk_display_manager_set_default_display (manager, NULL);
}
}

View File

@@ -43,6 +43,8 @@ G_BEGIN_DECLS
GType gdk_display_manager_get_type (void) G_GNUC_CONST;
GdkDisplayManager *gdk_display_manager_get (void);
GDK_AVAILABLE_IN_3_10
GdkDisplayManager *gdk_display_manager_peek (void);
GdkDisplay * gdk_display_manager_get_default_display (GdkDisplayManager *manager);
void gdk_display_manager_set_default_display (GdkDisplayManager *manager,
GdkDisplay *display);

View File

@@ -31,39 +31,26 @@ typedef struct _GdkDisplayManagerClass GdkDisplayManagerClass;
struct _GdkDisplayManager
{
GObject parent_instance;
GdkDisplay *default_display;
GSList *displays;
};
struct _GdkDisplayManagerClass
{
GObjectClass parent_class;
GSList * (*list_displays) (GdkDisplayManager *manager);
GdkDisplay * (*get_default_display) (GdkDisplayManager *manager);
void (*set_default_display) (GdkDisplayManager *manager,
GdkDisplay *display);
GdkDisplay * (*open_display) (GdkDisplayManager *manager,
const gchar *name);
/* FIXME the following should really be frontend-only, not vfuncs */
GdkAtom (*atom_intern) (GdkDisplayManager *manager,
const gchar *atom_name,
gboolean copy_name);
gchar * (*get_atom_name) (GdkDisplayManager *manager,
GdkAtom atom);
guint (*lookup_keyval) (GdkDisplayManager *manager,
const gchar *name);
gchar * (*get_keyval_name) (GdkDisplayManager *manager,
guint keyval);
void (*keyval_convert_case) (GdkDisplayManager *manager,
guint keyval,
guint *lower,
guint *upper);
/* signals */
void (*display_opened) (GdkDisplayManager *manager,
GdkDisplay *display);
};
void _gdk_display_manager_add_display (GdkDisplayManager *manager,
GdkDisplay *display);
void _gdk_display_manager_remove_display (GdkDisplayManager *manager,
GdkDisplay *display);
G_END_DECLS
#endif

View File

@@ -136,15 +136,13 @@ struct _GdkDisplayClass
GType window_type; /* type for native windows for this display, set in class_init */
const gchar * (*get_name) (GdkDisplay *display);
gint (*get_n_screens) (GdkDisplay *display);
GdkScreen * (*get_screen) (GdkDisplay *display,
gint screen_num);
GdkScreen * (*get_default_screen) (GdkDisplay *display);
void (*beep) (GdkDisplay *display);
void (*sync) (GdkDisplay *display);
void (*flush) (GdkDisplay *display);
gboolean (*has_pending) (GdkDisplay *display);
void (*queue_events) (GdkDisplay *display);
void (*make_default) (GdkDisplay *display);
GdkWindow * (*get_default_group) (GdkDisplay *display);
gboolean (*supports_selection_notification) (GdkDisplay *display);
gboolean (*request_selection_notification) (GdkDisplay *display,
@@ -239,6 +237,7 @@ struct _GdkDisplayClass
const gchar *text);
/* Signals */
void (*opened) (GdkDisplay *display);
void (*closed) (GdkDisplay *display,
gboolean is_error);
};

View File

@@ -384,6 +384,7 @@ gdk_frame_clock_paint_idle (void *data)
case GDK_FRAME_CLOCK_PHASE_LAYOUT:
if (priv->freeze_count == 0)
{
int iter;
#ifdef G_ENABLE_DEBUG
if ((_gdk_debug_flags & GDK_DEBUG_FRAMES) != 0)
{
@@ -394,11 +395,20 @@ gdk_frame_clock_paint_idle (void *data)
#endif /* G_ENABLE_DEBUG */
priv->phase = GDK_FRAME_CLOCK_PHASE_LAYOUT;
if (priv->requested & GDK_FRAME_CLOCK_PHASE_LAYOUT)
/* We loop in the layout phase, because we don't want to progress
* into the paint phase with invalid size allocations. This may
* happen in some situation like races between user window
* resizes and natural size changes.
*/
iter = 0;
while ((priv->requested & GDK_FRAME_CLOCK_PHASE_LAYOUT) &&
priv->freeze_count == 0 && iter++ < 4)
{
priv->requested &= ~GDK_FRAME_CLOCK_PHASE_LAYOUT;
g_signal_emit_by_name (G_OBJECT (clock), "layout");
}
if (iter == 4)
g_warning ("gdk-frame-clock: layout continuously requested, giving up after 4 tries");
}
case GDK_FRAME_CLOCK_PHASE_PAINT:
if (priv->freeze_count == 0)

View File

@@ -224,6 +224,7 @@ struct _GdkWindow
guint native_visibility : 2; /* the native visibility of a impl windows */
guint viewable : 1; /* mapped and all parents mapped */
guint applied_shape : 1;
guint in_update : 1;
GdkFullscreenMode fullscreen_mode;
/* The GdkWindow that has the impl, ref:ed if another window.
@@ -250,10 +251,6 @@ struct _GdkWindow
GdkCursor *cursor;
GHashTable *device_cursor;
GSList *implicit_paint;
GList *outstanding_moves;
cairo_region_t *shape;
cairo_region_t *input_shape;
@@ -269,6 +266,7 @@ struct _GdkWindow
guint num_offscreen_children;
GdkFrameClock *frame_clock; /* NULL to use from parent or default */
GdkWindowInvalidateHandlerFunc invalidate_handler;
};
#define GDK_WINDOW_TYPE(d) (((GDK_WINDOW (d)))->window_type)
@@ -346,8 +344,6 @@ void _gdk_screen_close (GdkScreen *screen);
void _gdk_cursor_destroy (GdkCursor *cursor);
extern const GOptionEntry _gdk_windowing_args[];
gchar *_gdk_windowing_substitute_screen_number (const gchar *display_name,
gint screen_number);
void _gdk_windowing_got_event (GdkDisplay *display,
GList *event_link,

View File

@@ -90,7 +90,10 @@ _gdk_keyval_from_name (const gchar *keyval_name)
gdk_key *found;
g_return_val_if_fail (keyval_name != NULL, 0);
if (strncmp (keyval_name,"XF86", 4) == 0)
keyval_name += 4;
found = bsearch (keyval_name, gdk_keys_by_name,
GDK_NUM_KEYS, sizeof (gdk_key),
gdk_keys_name_compare);

View File

@@ -189,25 +189,6 @@ gdk_keymap_init (GdkKeymap *keymap)
/* Other key-handling stuff
*/
/**
* gdk_keyval_convert_case:
* @symbol: a keyval
* @lower: (out): return location for lowercase version of @symbol
* @upper: (out): return location for uppercase version of @symbol
*
* Obtains the upper- and lower-case versions of the keyval @symbol.
* Examples of keyvals are #GDK_KEY_a, #GDK_KEY_Enter, #GDK_KEY_F1, etc.
*/
void
gdk_keyval_convert_case (guint symbol,
guint *lower,
guint *upper)
{
GdkDisplayManager *manager = gdk_display_manager_get ();
GDK_DISPLAY_MANAGER_GET_CLASS (manager)->keyval_convert_case (manager, symbol, lower, upper);
}
/**
* gdk_keyval_to_upper:
* @keyval: a key value.
@@ -693,6 +674,7 @@ gdk_keymap_get_modifier_mask (GdkKeymap *keymap,
return GDK_KEYMAP_GET_CLASS (keymap)->get_modifier_mask (keymap, intent);
}
#include "gdkkeynames.c"
/**
* gdk_keyval_name:
@@ -711,10 +693,7 @@ gdk_keymap_get_modifier_mask (GdkKeymap *keymap,
gchar *
gdk_keyval_name (guint keyval)
{
GdkDisplayManager *manager = gdk_display_manager_get ();
return GDK_DISPLAY_MANAGER_GET_CLASS (manager)->get_keyval_name (manager,
keyval);
return _gdk_keyval_name (keyval);
}
/**
@@ -733,20 +712,27 @@ gdk_keyval_name (guint keyval)
guint
gdk_keyval_from_name (const gchar *keyval_name)
{
GdkDisplayManager *manager = gdk_display_manager_get ();
return GDK_DISPLAY_MANAGER_GET_CLASS (manager)->lookup_keyval (manager,
keyval_name);
return _gdk_keyval_from_name (keyval_name);
}
/**
* gdk_keyval_convert_case:
* @symbol: a keyval
* @lower: (out): return location for lowercase version of @symbol
* @upper: (out): return location for uppercase version of @symbol
*
* Obtains the upper- and lower-case versions of the keyval @symbol.
* Examples of keyvals are #GDK_KEY_a, #GDK_KEY_Enter, #GDK_KEY_F1, etc.
*/
void
_gdk_display_manager_real_keyval_convert_case (GdkDisplayManager *manager,
guint symbol,
guint *lower,
guint *upper)
gdk_keyval_convert_case (guint symbol,
guint *lower,
guint *upper)
{
guint xlower = symbol;
guint xupper = symbol;
guint xlower, xupper;
xlower = symbol;
xupper = symbol;
/* Check for directly encoded 24-bit UCS characters: */
if ((symbol & 0xff000000) == 0x01000000)

View File

@@ -76,11 +76,6 @@ struct _GdkKeymap
GdkDisplay *display;
};
void _gdk_display_manager_real_keyval_convert_case (GdkDisplayManager *manager,
guint symbol,
guint *lower,
guint *upper);
G_END_DECLS
#endif

View File

@@ -2278,6 +2278,7 @@
#define GDK_TouchpadToggle 0x1008ffa9
#define GDK_TouchpadOn 0x1008ffb0
#define GDK_TouchpadOff 0x1008ffb1
#define GDK_AudioMicMute 0x1008ffb2
#define GDK_Switch_VT_1 0x1008fe01
#define GDK_Switch_VT_2 0x1008fe02
#define GDK_Switch_VT_3 0x1008fe03

View File

@@ -2287,6 +2287,7 @@
#define GDK_KEY_TouchpadToggle 0x1008ffa9
#define GDK_KEY_TouchpadOn 0x1008ffb0
#define GDK_KEY_TouchpadOff 0x1008ffb1
#define GDK_KEY_AudioMicMute 0x1008ffb2
#define GDK_KEY_Switch_VT_1 0x1008fe01
#define GDK_KEY_Switch_VT_2 0x1008fe02
#define GDK_KEY_Switch_VT_3 0x1008fe03

View File

@@ -65,15 +65,7 @@ void gdk_error_trap_pop_ignored (void);
const gchar * gdk_get_display_arg_name (void);
/**
* gdk_get_display:
*
* Gets the name of the display, which usually comes from the
* <envar>DISPLAY</envar> environment variable or the
* <option>--display</option> command line option.
*
* Returns: the name of the display.
*/
GDK_DEPRECATED_IN_3_8_FOR(gdk_display_get_name (gdk_display_get_default ()))
gchar* gdk_get_display (void);
#ifndef GDK_MULTIDEVICE_SAFE
@@ -117,6 +109,9 @@ void gdk_flush (void);
void gdk_disable_multidevice (void);
GDK_AVAILABLE_IN_3_10
void gdk_set_allowed_backends (const gchar *backends);
G_END_DECLS
#endif /* __GDK_MAIN_H__ */

View File

@@ -555,42 +555,6 @@ gdk_offscreen_window_queue_antiexpose (GdkWindow *window,
return FALSE;
}
static void
gdk_offscreen_window_translate (GdkWindow *window,
cairo_region_t *area,
gint dx,
gint dy)
{
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (window->impl);
if (offscreen->surface)
{
cairo_t *cr;
cr = cairo_create (offscreen->surface);
area = cairo_region_copy (area);
gdk_cairo_region (cr, area);
cairo_clip (cr);
/* NB: This is a self-copy and Cairo doesn't support that yet.
* So we do a litle trick.
*/
cairo_push_group (cr);
cairo_set_source_surface (cr, offscreen->surface, dx, dy);
cairo_paint (cr);
cairo_pop_group_to_source (cr);
cairo_paint (cr);
cairo_destroy (cr);
}
_gdk_window_add_damage (window, area);
}
static cairo_surface_t *
gdk_offscreen_window_resize_cairo_surface (GdkWindow *window,
cairo_surface_t *surface,
@@ -713,6 +677,16 @@ gdk_offscreen_window_process_updates_recurse (GdkWindow *window,
_gdk_window_process_updates_recurse (window, region);
}
static void
gdk_offscreen_window_get_frame_extents (GdkWindow *window,
GdkRectangle *rect)
{
rect->x = window->x;
rect->y = window->y;
rect->width = window->width;
rect->height = window->height;
}
static void
gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
{
@@ -742,7 +716,6 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
impl_class->input_shape_combine_region = gdk_offscreen_window_input_shape_combine_region;
impl_class->set_static_gravities = gdk_offscreen_window_set_static_gravities;
impl_class->queue_antiexpose = gdk_offscreen_window_queue_antiexpose;
impl_class->translate = gdk_offscreen_window_translate;
impl_class->destroy = gdk_offscreen_window_destroy;
impl_class->destroy_foreign = NULL;
impl_class->resize_cairo_surface = gdk_offscreen_window_resize_cairo_surface;
@@ -763,7 +736,7 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
impl_class->set_startup_id = gdk_offscreen_window_set_string;
impl_class->set_transient_for = gdk_offscreen_window_set_transient_for;
impl_class->get_root_origin = NULL;
impl_class->get_frame_extents = NULL;
impl_class->get_frame_extents = gdk_offscreen_window_get_frame_extents;
impl_class->set_override_redirect = NULL;
impl_class->set_accept_focus = NULL;
impl_class->set_focus_on_map = gdk_offscreen_window_set_boolean;

View File

@@ -29,6 +29,8 @@
G_BEGIN_DECLS
const char * _gdk_atom_name_const (GdkAtom atom);
void gdk_window_destroy_notify (GdkWindow *window);
void gdk_synthesize_window_state (GdkWindow *window,

254
gdk/gdkproperty.c Normal file
View File

@@ -0,0 +1,254 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2000 Red Hat, Inc.
* 2005 Imendio AB
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include "gdkproperty.h"
#include "gdkprivate.h"
/**
* SECTION:properties
* @Short_description: Functions to manipulate properties on windows
* @Title: Properties and Atoms
*
* Each window under X can have any number of associated
* <firstterm>properties</firstterm> attached to it.
* Properties are arbitrary chunks of data identified by
* <firstterm>atom</firstterm>s. (An <firstterm>atom</firstterm>
* is a numeric index into a string table on the X server. They are used
* to transfer strings efficiently between clients without
* having to transfer the entire string.) A property
* has an associated type, which is also identified
* using an atom.
*
* A property has an associated <firstterm>format</firstterm>,
* an integer describing how many bits are in each unit
* of data inside the property. It must be 8, 16, or 32.
* When data is transferred between the server and client,
* if they are of different endianesses it will be byteswapped
* as necessary according to the format of the property.
* Note that on the client side, properties of format 32
* will be stored with one unit per <emphasis>long</emphasis>,
* even if a long integer has more than 32 bits on the platform.
* (This decision was apparently made for Xlib to maintain
* compatibility with programs that assumed longs were 32
* bits, at the expense of programs that knew better.)
*
* The functions in this section are used to add, remove
* and change properties on windows, to convert atoms
* to and from strings and to manipulate some types of
* data commonly stored in X window properties.
*/
static GHashTable *names_to_atoms;
static GPtrArray *atoms_to_names;
static const gchar xatoms_string[] =
/* These are all the standard predefined X atoms */
"NONE\0"
"PRIMARY\0"
"SECONDARY\0"
"ARC\0"
"ATOM\0"
"BITMAP\0"
"CARDINAL\0"
"COLORMAP\0"
"CURSOR\0"
"CUT_BUFFER0\0"
"CUT_BUFFER1\0"
"CUT_BUFFER2\0"
"CUT_BUFFER3\0"
"CUT_BUFFER4\0"
"CUT_BUFFER5\0"
"CUT_BUFFER6\0"
"CUT_BUFFER7\0"
"DRAWABLE\0"
"FONT\0"
"INTEGER\0"
"PIXMAP\0"
"POINT\0"
"RECTANGLE\0"
"RESOURCE_MANAGER\0"
"RGB_COLOR_MAP\0"
"RGB_BEST_MAP\0"
"RGB_BLUE_MAP\0"
"RGB_DEFAULT_MAP\0"
"RGB_GRAY_MAP\0"
"RGB_GREEN_MAP\0"
"RGB_RED_MAP\0"
"STRING\0"
"VISUALID\0"
"WINDOW\0"
"WM_COMMAND\0"
"WM_HINTS\0"
"WM_CLIENT_MACHINE\0"
"WM_ICON_NAME\0"
"WM_ICON_SIZE\0"
"WM_NAME\0"
"WM_NORMAL_HINTS\0"
"WM_SIZE_HINTS\0"
"WM_ZOOM_HINTS\0"
"MIN_SPACE\0"
"NORM_SPACE\0"
"MAX_SPACE\0"
"END_SPACE\0"
"SUPERSCRIPT_X\0"
"SUPERSCRIPT_Y\0"
"SUBSCRIPT_X\0"
"SUBSCRIPT_Y\0"
"UNDERLINE_POSITION\0"
"UNDERLINE_THICKNESS\0"
"STRIKEOUT_ASCENT\0"
"STRIKEOUT_DESCENT\0"
"ITALIC_ANGLE\0"
"X_HEIGHT\0"
"QUAD_WIDTH\0"
"WEIGHT\0"
"POINT_SIZE\0"
"RESOLUTION\0"
"COPYRIGHT\0"
"NOTICE\0"
"FONT_NAME\0"
"FAMILY_NAME\0"
"FULL_NAME\0"
"CAP_HEIGHT\0"
"WM_CLASS\0"
"WM_TRANSIENT_FOR\0"
"CLIPBOARD\0" /* = 69 */;
static const gint xatoms_offset[] = {
0, 5, 13, 23, 27, 32, 39, 48, 57, 64, 76, 88,
100, 112, 124, 136, 148, 160, 169, 174, 182, 189, 195, 205,
222, 236, 249, 262, 278, 291, 305, 317, 324, 333, 340, 351,
360, 378, 391, 404, 412, 428, 442, 456, 466, 477, 487, 497,
511, 525, 537, 549, 568, 588, 605, 623, 636, 645, 656, 663,
674, 685, 695, 702, 712, 724, 734, 745, 754, 771
};
static void
ensure_atom_tables (void)
{
int i;
if (names_to_atoms)
return;
names_to_atoms = g_hash_table_new (g_str_hash, g_str_equal);
atoms_to_names = g_ptr_array_sized_new (G_N_ELEMENTS (xatoms_offset));
for (i = 0; i < G_N_ELEMENTS (xatoms_offset); i++)
{
g_hash_table_insert(names_to_atoms, (gchar *)xatoms_string + xatoms_offset[i], GINT_TO_POINTER (i));
g_ptr_array_add(atoms_to_names, (gchar *)xatoms_string + xatoms_offset[i]);
}
}
static GdkAtom
intern_atom_internal (const gchar *atom_name, gboolean allocate)
{
gpointer result;
gchar *name;
ensure_atom_tables ();
if (g_hash_table_lookup_extended (names_to_atoms, atom_name, NULL, &result))
return result;
result = GINT_TO_POINTER (atoms_to_names->len);
name = allocate ? g_strdup (atom_name) : (gchar *)atom_name;
g_hash_table_insert(names_to_atoms, name, result);
g_ptr_array_add(atoms_to_names, name);
return result;
}
/**
* gdk_atom_intern:
* @atom_name: a string.
* @only_if_exists: if %TRUE, GDK is allowed to not create a new atom, but
* just return %GDK_NONE if the requested atom doesn't already
* exists. Currently, the flag is ignored, since checking the
* existance of an atom is as expensive as creating it.
*
* Finds or creates an atom corresponding to a given string.
*
* Returns: (transfer none): the atom corresponding to @atom_name.
*/
GdkAtom
gdk_atom_intern (const gchar *atom_name,
gboolean only_if_exists)
{
g_return_val_if_fail (atom_name != NULL, GDK_NONE);
return intern_atom_internal (atom_name, TRUE);
}
/**
* gdk_atom_intern_static_string:
* @atom_name: a static string
*
* Finds or creates an atom corresponding to a given string.
*
* Note that this function is identical to gdk_atom_intern() except
* that if a new #GdkAtom is created the string itself is used rather
* than a copy. This saves memory, but can only be used if the string
* will <emphasis>always</emphasis> exist. It can be used with statically
* allocated strings in the main program, but not with statically
* allocated memory in dynamically loaded modules, if you expect to
* ever unload the module again (e.g. do not use this function in
* GTK+ theme engines).
*
* Returns: (transfer none): the atom corresponding to @atom_name
*
* Since: 2.10
*/
GdkAtom
gdk_atom_intern_static_string (const gchar *atom_name)
{
g_return_val_if_fail (atom_name != NULL, GDK_NONE);
return intern_atom_internal (atom_name, FALSE);
}
/**
* gdk_atom_name:
* @atom: a #GdkAtom.
*
* Determines the string corresponding to an atom.
*
* Returns: a newly-allocated string containing the string
* corresponding to @atom. When you are done with the
* return value, you should free it using g_free().
*/
gchar *
gdk_atom_name (GdkAtom atom)
{
return g_strdup (_gdk_atom_name_const (atom));
}
const gchar *
_gdk_atom_name_const (GdkAtom atom)
{
ensure_atom_tables ();
if (GPOINTER_TO_INT (atom) >= atoms_to_names->len)
return NULL;
return g_ptr_array_index (atoms_to_names, GPOINTER_TO_INT (atom));
}

File diff suppressed because it is too large Load Diff

View File

@@ -634,6 +634,26 @@ gboolean gdk_window_set_static_gravities (GdkWindow *window,
/* GdkWindow */
/**
* GdkWindowInvalidateHandlerFunc:
* @window: a #GdkWindow
* @region: a #cairo_region_t
*
* Whenever some area of the window is invalidated (directly in the
* window or in a child window) this gets called with @region in
* the coordinate space of @window. You can use @region to just
* keep track of the dirty region, or you can actually change
* @region in case you are doing display tricks like showing
* a child in multiple places.
*
* Since: 3.10
*/
typedef void (*GdkWindowInvalidateHandlerFunc) (GdkWindow *window,
cairo_region_t *region);
GDK_AVAILABLE_IN_3_10
void gdk_window_set_invalidate_handler (GdkWindow *window,
GdkWindowInvalidateHandlerFunc handler);
gboolean gdk_window_has_native (GdkWindow *window);
void gdk_window_set_type_hint (GdkWindow *window,
GdkWindowTypeHint hint);

View File

@@ -125,16 +125,6 @@ struct _GdkWindowImplClass
gboolean (* queue_antiexpose) (GdkWindow *window,
cairo_region_t *update_area);
/* Called to move @area inside @window by @dx x @dy pixels. @area is
* guaranteed to be inside @window. If part of @area is not invisible or
* invalid, it is this function's job to queue expose events in those
* areas.
*/
void (* translate) (GdkWindow *window,
cairo_region_t *area,
gint dx,
gint dy);
/* Called to do the windowing system specific part of gdk_window_destroy(),
*
* window: The window being destroyed

File diff suppressed because it is too large Load Diff

View File

@@ -1,28 +1,65 @@
XF86MonBrightnessUp
XF86MonBrightnessDown
XF86KbdBrightnessUp
XF86KbdBrightnessDown
XF86AudioMute
XF86AudioLowerVolume
XF86AudioRaiseVolume
XF86AudioPlay
XF86AudioStop
XF86AudioNext
XF86AudioPrev
XF86AudioRecord
XF86AudioPause
XF86AudioRewind
XF86AudioMedia
XF86ScreenSaver
XF86Battery
XF86Launch1
XF86Forward
XF86Back
XF86Sleep
XF86Hibernate
XF86WLAN
XF86WebCam
XF86Display
XF86TouchpadToggle
XF86WakeUp
XF86Suspend
BackSpace
Tab
Return
Pause
Scroll_Lock
Sys_Req
Escape
Multi_key
Home
Left
Up
Right
Down
Page_Up
Page_Down
End
Begin
Print
Insert
Num_Lock
KP_Space
KP_Tab
KP_Enter
KP_Home
KP_Left
KP_Up
KP_Right
KP_Down
KP_Page_Up
KP_Prior
KP_Page_Down
KP_Next
KP_End
KP_Begin
KP_Insert
KP_Delete
Delete
MonBrightnessUp
MonBrightnessDown
KbdBrightnessUp
KbdBrightnessDown
AudioMute
AudioLowerVolume
AudioRaiseVolume
AudioPlay
AudioStop
AudioNext
AudioPrev
AudioRecord
AudioPause
AudioRewind
AudioMedia
ScreenSaver
Battery
Launch1
Forward
Back
Sleep
Hibernate
WLAN
WebCam
Display
TouchpadToggle
WakeUp
Suspend

File diff suppressed because it is too large Load Diff

View File

@@ -21,7 +21,7 @@
#define __GDK_QUARTZ_DEVICE_MANAGER_CORE__
#include <gdkdevicemanagerprivate.h>
#include <gdkquartzdevicemanager-core.h>
#include "gdkquartzdevicemanager-core.h"
G_BEGIN_DECLS

View File

@@ -134,8 +134,7 @@ _gdk_quartz_display_open (const gchar *display_name)
_gdk_quartz_dnd_init ();
#endif
g_signal_emit_by_name (gdk_display_manager_get (),
"display_opened", _gdk_display);
g_signal_emit_by_name (_gdk_display, "opened");
return _gdk_display;
}
@@ -155,24 +154,6 @@ gdk_quartz_display_get_name (GdkDisplay *display)
return display_name;
}
static gint
gdk_quartz_display_get_n_screens (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
return 1;
}
static GdkScreen *
gdk_quartz_display_get_screen (GdkDisplay *display,
gint screen_num)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
g_return_val_if_fail (screen_num == 0, NULL);
return _gdk_screen;
}
static GdkScreen *
gdk_quartz_display_get_default_screen (GdkDisplay *display)
{
@@ -283,8 +264,6 @@ G_DEFINE_TYPE (GdkQuartzDisplay, gdk_quartz_display, GDK_TYPE_DISPLAY)
static void
gdk_quartz_display_init (GdkQuartzDisplay *display)
{
_gdk_quartz_display_manager_add_display (gdk_display_manager_get (),
GDK_DISPLAY_OBJECT (display));
}
static void
@@ -292,9 +271,6 @@ gdk_quartz_display_dispose (GObject *object)
{
GdkQuartzDisplay *display_quartz = GDK_QUARTZ_DISPLAY (object);
_gdk_quartz_display_manager_remove_display (gdk_display_manager_get (),
GDK_DISPLAY_OBJECT (object));
g_list_foreach (display_quartz->input_devices,
(GFunc) g_object_run_dispose, NULL);
@@ -323,8 +299,6 @@ gdk_quartz_display_class_init (GdkQuartzDisplayClass *class)
display_class->window_type = GDK_TYPE_QUARTZ_WINDOW;
display_class->get_name = gdk_quartz_display_get_name;
display_class->get_n_screens = gdk_quartz_display_get_n_screens;
display_class->get_screen = gdk_quartz_display_get_screen;
display_class->get_default_screen = gdk_quartz_display_get_default_screen;
display_class->beep = gdk_quartz_display_beep;
display_class->sync = gdk_quartz_display_sync;

View File

@@ -35,60 +35,11 @@
struct _GdkQuartzDisplayManager
{
GdkDisplayManager parent;
GdkDisplay *default_display;
GSList *displays;
};
G_DEFINE_TYPE (GdkQuartzDisplayManager, gdk_quartz_display_manager, GDK_TYPE_DISPLAY_MANAGER)
static GdkDisplay *
gdk_quartz_display_manager_open_display (GdkDisplayManager *manager,
const gchar *name)
{
return _gdk_quartz_display_open (name);
}
static GSList *
gdk_quartz_display_manager_list_displays (GdkDisplayManager *manager)
{
GdkQuartzDisplayManager *manager_quartz = GDK_QUARTZ_DISPLAY_MANAGER (manager);
return g_slist_copy (manager_quartz->displays);
}
static GdkDisplay *
gdk_quartz_display_manager_get_default_display (GdkDisplayManager *manager)
{
return GDK_QUARTZ_DISPLAY_MANAGER (manager)->default_display;
}
static void
gdk_quartz_display_manager_set_default_display (GdkDisplayManager *manager,
GdkDisplay *display)
{
GdkQuartzDisplayManager *manager_quartz = GDK_QUARTZ_DISPLAY_MANAGER (manager);
manager_quartz->default_display = display;
}
#include "../gdkkeynames.c"
static gchar *
gdk_quartz_display_manager_get_keyval_name (GdkDisplayManager *manager,
guint keyval)
{
return _gdk_keyval_name (keyval);
}
static guint
gdk_quartz_display_manager_lookup_keyval (GdkDisplayManager *manager,
const gchar *name)
{
return _gdk_keyval_from_name (name);
}
static void
gdk_quartz_display_manager_init (GdkQuartzDisplayManager *manager)
{
@@ -120,42 +71,4 @@ gdk_quartz_display_manager_class_init (GdkQuartzDisplayManagerClass *class)
GdkDisplayManagerClass *manager_class = GDK_DISPLAY_MANAGER_CLASS (class);
object_class->finalize = gdk_quartz_display_manager_finalize;
manager_class->open_display = gdk_quartz_display_manager_open_display;
manager_class->list_displays = gdk_quartz_display_manager_list_displays;
manager_class->set_default_display = gdk_quartz_display_manager_set_default_display;
manager_class->get_default_display = gdk_quartz_display_manager_get_default_display;
manager_class->atom_intern = _gdk_quartz_display_manager_atom_intern;
manager_class->get_atom_name = _gdk_quartz_display_manager_get_atom_name;
manager_class->lookup_keyval = gdk_quartz_display_manager_lookup_keyval;
manager_class->get_keyval_name = gdk_quartz_display_manager_get_keyval_name;
}
void
_gdk_quartz_display_manager_add_display (GdkDisplayManager *manager,
GdkDisplay *display)
{
GdkQuartzDisplayManager *manager_quartz = GDK_QUARTZ_DISPLAY_MANAGER (manager);
if (manager_quartz->displays == NULL)
gdk_display_manager_set_default_display (manager, display);
manager_quartz->displays = g_slist_prepend (manager_quartz->displays, display);
}
void
_gdk_quartz_display_manager_remove_display (GdkDisplayManager *manager,
GdkDisplay *display)
{
GdkQuartzDisplayManager *manager_quartz = GDK_QUARTZ_DISPLAY_MANAGER (manager);
manager_quartz->displays = g_slist_remove (manager_quartz->displays, display);
if (manager_quartz->default_display == display)
{
if (manager_quartz->displays)
gdk_display_manager_set_default_display (manager, manager_quartz->displays->data);
else
gdk_display_manager_set_default_display (manager, NULL);
}
}

View File

@@ -21,7 +21,7 @@
#define __GDK_QUARTZ_DND__
#include <gdkdndprivate.h>
#include <gdkquartzdnd.h>
#include "gdkquartzdnd.h"
#include <AppKit/AppKit.h>

View File

@@ -154,20 +154,6 @@ gint _gdk_quartz_display_text_property_to_utf8_list (GdkDisplay *disp
gchar * _gdk_quartz_display_utf8_to_string_target (GdkDisplay *displayt,
const gchar *str);
/* Display manager */
void _gdk_quartz_display_manager_add_display (GdkDisplayManager *manager,
GdkDisplay *display);
void _gdk_quartz_display_manager_remove_display (GdkDisplayManager *manager,
GdkDisplay *display);
/* Display manager methods - events */
GdkAtom _gdk_quartz_display_manager_atom_intern (GdkDisplayManager *manager,
const gchar *atom_name,
gboolean copy_name);
gchar * _gdk_quartz_display_manager_get_atom_name (GdkDisplayManager *manager,
GdkAtom atom);
/* Screen */
GdkScreen *_gdk_quartz_screen_new (void);
void _gdk_quartz_screen_update_window_sizes (GdkScreen *screen);

View File

@@ -148,26 +148,6 @@ intern_atom_internal (const gchar *atom_name, gboolean allocate)
return result;
}
GdkAtom
_gdk_quartz_display_manager_atom_intern (GdkDisplayManager *manager,
const gchar *atom_name,
gboolean copy_name)
{
return intern_atom_internal (atom_name, copy_name);
}
gchar *
_gdk_quartz_display_manager_get_atom_name (GdkDisplayManager *manager,
GdkAtom atom)
{
ensure_atom_tables ();
if (GPOINTER_TO_INT (atom) >= atoms_to_names->len)
return NULL;
return g_strdup (g_ptr_array_index (atoms_to_names, GPOINTER_TO_INT (atom)));
}
void
_gdk_quartz_window_delete_property (GdkWindow *window,
GdkAtom property)

View File

@@ -55,6 +55,10 @@ typedef enum
GdkOSXVersion gdk_quartz_osx_version (void);
GdkAtom gdk_quartz_pasteboard_type_to_atom_libgtk_only (NSString *type);
NSString *gdk_quartz_target_to_pasteboard_type_libgtk_only (const gchar *target);
NSString *gdk_quartz_atom_to_pasteboard_type_libgtk_only (GdkAtom atom);
G_END_DECLS
#define __GDKQUARTZ_H_INSIDE__

View File

@@ -301,16 +301,6 @@ gdk_quartz_screen_get_number (GdkScreen *screen)
return 0;
}
gchar *
_gdk_windowing_substitute_screen_number (const gchar *display_name,
int screen_number)
{
if (screen_number != 0)
return NULL;
return g_strdup (display_name);
}
static gint
gdk_quartz_screen_get_width (GdkScreen *screen)
{

View File

@@ -22,6 +22,7 @@
#include "gdkselection.h"
#include "gdkproperty.h"
#include "gdkquartz.h"
gboolean
_gdk_quartz_display_set_selection_owner (GdkDisplay *display,
@@ -171,3 +172,42 @@ _gdk_quartz_display_text_property_to_utf8_list (GdkDisplay *display,
}
}
GdkAtom
gdk_quartz_pasteboard_type_to_atom_libgtk_only (NSString *type)
{
if ([type isEqualToString:NSStringPboardType])
return gdk_atom_intern_static_string ("UTF8_STRING");
else if ([type isEqualToString:NSTIFFPboardType])
return gdk_atom_intern_static_string ("image/tiff");
else if ([type isEqualToString:NSColorPboardType])
return gdk_atom_intern_static_string ("application/x-color");
else if ([type isEqualToString:NSURLPboardType])
return gdk_atom_intern_static_string ("text/uri-list");
else
return gdk_atom_intern ([type UTF8String], FALSE);
}
NSString *
gdk_quartz_target_to_pasteboard_type_libgtk_only (const char *target)
{
if (strcmp (target, "UTF8_STRING") == 0)
return NSStringPboardType;
else if (strcmp (target, "image/tiff") == 0)
return NSTIFFPboardType;
else if (strcmp (target, "application/x-color") == 0)
return NSColorPboardType;
else if (strcmp (target, "text/uri-list") == 0)
return NSURLPboardType;
else
return [NSString stringWithUTF8String:target];
}
NSString *
gdk_quartz_atom_to_pasteboard_type_libgtk_only (GdkAtom atom)
{
gchar *target = gdk_atom_name (atom);
NSString *ret = gdk_quartz_target_to_pasteboard_type_libgtk_only (target);
g_free (target);
return ret;
}

View File

@@ -2237,49 +2237,6 @@ gdk_quartz_window_queue_antiexpose (GdkWindow *window,
return FALSE;
}
static void
gdk_quartz_window_translate (GdkWindow *window,
cairo_region_t *area,
gint dx,
gint dy)
{
cairo_region_t *invalidate, *scrolled;
GdkWindowImplQuartz *impl = (GdkWindowImplQuartz *)window->impl;
GdkRectangle extents;
cairo_region_get_extents (area, &extents);
[impl->view scrollRect:NSMakeRect (extents.x - dx, extents.y - dy,
extents.width, extents.height)
by:NSMakeSize (dx, dy)];
if (impl->needs_display_region)
{
cairo_region_t *intersection;
/* Invalidate already invalidated area that was moved at new
* location.
*/
intersection = cairo_region_copy (impl->needs_display_region);
cairo_region_intersect (intersection, area);
cairo_region_translate (intersection, dx, dy);
gdk_quartz_window_set_needs_display_in_region (window, intersection);
cairo_region_destroy (intersection);
}
/* Calculate newly exposed area that needs invalidation */
scrolled = cairo_region_copy (area);
cairo_region_translate (scrolled, dx, dy);
invalidate = cairo_region_copy (area);
cairo_region_subtract (invalidate, scrolled);
cairo_region_destroy (scrolled);
gdk_quartz_window_set_needs_display_in_region (window, invalidate);
cairo_region_destroy (invalidate);
}
static void
gdk_quartz_window_set_focus_on_map (GdkWindow *window,
gboolean focus_on_map)
@@ -3078,7 +3035,6 @@ gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
impl_class->input_shape_combine_region = gdk_window_quartz_input_shape_combine_region;
impl_class->set_static_gravities = gdk_window_quartz_set_static_gravities;
impl_class->queue_antiexpose = gdk_quartz_window_queue_antiexpose;
impl_class->translate = gdk_quartz_window_translate;
impl_class->destroy = gdk_quartz_window_destroy;
impl_class->destroy_foreign = gdk_quartz_window_destroy_foreign;
impl_class->resize_cairo_surface = gdk_window_quartz_resize_cairo_surface;

View File

@@ -31,6 +31,10 @@ TEST_PROGS += display
display_SOURCES = display.c
display_LDADD = $(progs_ldadd)
TEST_PROGS += keysyms
keysyms_SOURCES = keysyms.c
keysyms_LDADD = $(progs_ldadd)
CLEANFILES = \
cairosurface.png \
gdksurface.png

69
gdk/tests/keysyms.c Normal file
View File

@@ -0,0 +1,69 @@
#include <locale.h>
#include <gdk/gdk.h>
static void
test_keysyms_basic (void)
{
struct {
guint keyval;
const gchar *name;
const gchar *other_name;
} tests[] = {
{ GDK_KEY_space, "space", NULL },
{ GDK_KEY_a, "a", NULL },
{ GDK_KEY_Thorn, "Thorn", "THORN" },
{ GDK_KEY_Hangul_J_RieulTieut, "Hangul_J_RieulTieut", NULL },
{ GDK_KEY_Page_Up, "Page_Up", NULL },
{ GDK_KEY_KP_Multiply, "KP_Multiply", NULL },
{ GDK_KEY_MonBrightnessUp, "MonBrightnessUp", NULL },
{ 0, NULL }
};
gint i;
for (i = 0; tests[i].keyval != 0; i++)
{
g_assert_cmpstr (gdk_keyval_name (tests[i].keyval), ==, tests[i].name);
g_assert_cmpuint (gdk_keyval_from_name (tests[i].name), ==, tests[i].keyval);
if (tests[i].other_name)
g_assert_cmpuint (gdk_keyval_from_name (tests[i].other_name), ==, tests[i].keyval);
}
}
static void
test_keysyms_void (void)
{
g_assert_cmpuint (gdk_keyval_from_name ("NoSuchKeysym"), ==, GDK_KEY_VoidSymbol);
g_assert_cmpstr (gdk_keyval_name (GDK_KEY_VoidSymbol), ==, "0xffffff");
}
static void
test_keysyms_xf86 (void)
{
g_assert_cmpuint (gdk_keyval_from_name ("XF86MonBrightnessUp"), ==, GDK_KEY_MonBrightnessUp);
g_assert_cmpuint (gdk_keyval_from_name ("XF86MonBrightnessDown"), ==, GDK_KEY_MonBrightnessDown);
g_assert_cmpuint (gdk_keyval_from_name ("XF86KbdBrightnessUp"), ==, GDK_KEY_KbdBrightnessUp);
g_assert_cmpuint (gdk_keyval_from_name ("XF86KbdBrightnessDown"), ==, GDK_KEY_KbdBrightnessDown);
g_assert_cmpuint (gdk_keyval_from_name ("XF86Battery"), ==, GDK_KEY_Battery);
g_assert_cmpuint (gdk_keyval_from_name ("XF86Display"), ==, GDK_KEY_Display);
g_assert_cmpuint (gdk_keyval_from_name ("MonBrightnessUp"), ==, GDK_KEY_MonBrightnessUp);
g_assert_cmpuint (gdk_keyval_from_name ("MonBrightnessDown"), ==, GDK_KEY_MonBrightnessDown);
g_assert_cmpuint (gdk_keyval_from_name ("KbdBrightnessUp"), ==, GDK_KEY_KbdBrightnessUp);
g_assert_cmpuint (gdk_keyval_from_name ("KbdBrightnessDown"), ==, GDK_KEY_KbdBrightnessDown);
g_assert_cmpuint (gdk_keyval_from_name ("Battery"), ==, GDK_KEY_Battery);
g_assert_cmpuint (gdk_keyval_from_name ("Display"), ==, GDK_KEY_Display);
}
int main (int argc, char *argv[])
{
setlocale (LC_ALL, "");
g_test_init (&argc, &argv, NULL);
gdk_init (&argc, &argv);
g_test_add_func ("/keysyms/basic", test_keysyms_basic);
g_test_add_func ("/keysyms/void", test_keysyms_void);
g_test_add_func ("/keysyms/xf86", test_keysyms_xf86);
return g_test_run ();
}

View File

@@ -40,6 +40,8 @@ libgdkinclude_HEADERS = \
libgdkwaylandinclude_HEADERS = \
gdkwaylanddevice.h \
gdkwaylanddisplay.h \
gdkwaylanddisplaymanager.h \
gdkwaylandselection.h \
gdkwaylandwindow.h
-include $(top_srcdir)/git.mk

View File

@@ -51,9 +51,15 @@ struct _GdkWaylandCursor
GdkCursor cursor;
gchar *name;
guint serial;
int hotspot_x, hotspot_y;
int width, height;
struct wl_buffer *buffer;
struct
{
int hotspot_x, hotspot_y;
int width, height;
struct wl_buffer *buffer;
} pixbuf;
struct wl_cursor *wl_cursor;
};
struct _GdkWaylandCursorClass
@@ -65,12 +71,105 @@ G_DEFINE_TYPE (GdkWaylandCursor, _gdk_wayland_cursor, GDK_TYPE_CURSOR)
static guint theme_serial = 0;
struct cursor_cache_key
{
GdkCursorType type;
const char *name;
};
static void
add_to_cache (GdkWaylandDisplay *display, GdkWaylandCursor *cursor)
{
display->cursor_cache = g_slist_prepend (display->cursor_cache, cursor);
g_object_ref (cursor);
}
static gint
cache_compare_func (gconstpointer listelem,
gconstpointer target)
{
GdkWaylandCursor *cursor = (GdkWaylandCursor *) listelem;
struct cursor_cache_key* key = (struct cursor_cache_key *) target;
if (cursor->cursor.type != key->type)
return 1; /* No match */
/* Elements marked as pixmap must be named cursors
* (since we don't store normal pixmap cursors
*/
if (key->type == GDK_CURSOR_IS_PIXMAP)
return strcmp (key->name, cursor->name);
return 0; /* Match */
}
static GdkWaylandCursor*
find_in_cache (GdkWaylandDisplay *display,
GdkCursorType type,
const char *name)
{
GSList* res;
struct cursor_cache_key key;
key.type = type;
key.name = name;
res = g_slist_find_custom (display->cursor_cache, &key, cache_compare_func);
if (res)
return (GdkWaylandCursor *) res->data;
return NULL;
}
/* Called by gdk_wayland_display_finalize to flush any cached cursors
* for a dead display.
*/
void
_gdk_wayland_display_finalize_cursors (GdkWaylandDisplay *display)
{
g_slist_foreach (display->cursor_cache, (GFunc) g_object_unref, NULL);
g_slist_free (display->cursor_cache);
}
static gboolean
set_cursor_from_theme (GdkWaylandCursor *cursor, struct wl_cursor_theme *theme)
{
struct wl_cursor *c;
c = wl_cursor_theme_get_cursor (theme, cursor->name);
if (!c)
{
g_warning (G_STRLOC ": Unable to load %s from the cursor theme", cursor->name);
/* return the left_ptr cursor as a fallback */
c = wl_cursor_theme_get_cursor (theme, "left_ptr");
if (!c)
return FALSE;
}
cursor->wl_cursor = c;
return TRUE;
}
void
_gdk_wayland_display_update_cursors (GdkWaylandDisplay *display,
struct wl_cursor_theme *theme)
{
g_slist_foreach (display->cursor_cache, (GFunc) set_cursor_from_theme, theme);
}
static void
gdk_wayland_cursor_finalize (GObject *object)
{
GdkWaylandCursor *cursor = GDK_WAYLAND_CURSOR (object);
g_free (cursor->name);
if (cursor->pixbuf.buffer)
wl_buffer_destroy (cursor->pixbuf.buffer);
G_OBJECT_CLASS (_gdk_wayland_cursor_parent_class)->finalize (object);
}
@@ -83,20 +182,72 @@ gdk_wayland_cursor_get_image (GdkCursor *cursor)
struct wl_buffer *
_gdk_wayland_cursor_get_buffer (GdkCursor *cursor,
int *x,
int *y,
guint image_index,
int *hotspot_x,
int *hotspot_y,
int *w,
int *h)
{
GdkWaylandCursor *wayland_cursor = GDK_WAYLAND_CURSOR (cursor);
*x = wayland_cursor->hotspot_x;
*y = wayland_cursor->hotspot_y;
if (wayland_cursor->wl_cursor)
{
struct wl_cursor_image *image;
*w = wayland_cursor->width;
*h = wayland_cursor->height;
if (image_index >= wayland_cursor->wl_cursor->image_count)
{
g_warning (G_STRLOC " out of bounds cursor image [%d / %d]",
image_index,
wayland_cursor->wl_cursor->image_count - 1);
image_index = 0;
}
return wayland_cursor->buffer;
image = wayland_cursor->wl_cursor->images[image_index];
*hotspot_x = image->hotspot_x;
*hotspot_y = image->hotspot_y;
*w = image->width;
*h = image->height;
return wl_cursor_image_get_buffer (image);
}
else /* From pixbuf */
{
*hotspot_x = wayland_cursor->pixbuf.hotspot_x;
*hotspot_y = wayland_cursor->pixbuf.hotspot_y;
*w = wayland_cursor->pixbuf.width;
*h = wayland_cursor->pixbuf.height;
return wayland_cursor->pixbuf.buffer;
}
}
guint
_gdk_wayland_cursor_get_next_image_index (GdkCursor *cursor,
guint current_image_index,
guint *next_image_delay)
{
struct wl_cursor *wl_cursor = GDK_WAYLAND_CURSOR (cursor)->wl_cursor;
if (wl_cursor && wl_cursor->image_count > 1)
{
if (current_image_index >= wl_cursor->image_count)
{
g_warning (G_STRLOC " out of bounds cursor image [%d / %d]",
current_image_index, wl_cursor->image_count - 1);
current_image_index = 0;
}
/* Return the time to next image */
if (next_image_delay)
*next_image_delay = wl_cursor->images[current_image_index]->delay;
return (current_image_index + 1) % wl_cursor->image_count;
}
else
return current_image_index;
}
static void
@@ -115,29 +266,27 @@ _gdk_wayland_cursor_init (GdkWaylandCursor *cursor)
{
}
/* Use to implement from_pixbuf below */
#if 0
/* Used to implement from_pixbuf below */
static void
set_pixbuf (GdkWaylandCursor *cursor, GdkPixbuf *pixbuf)
set_pixbuf (gpointer argb_pixels, int width, int height, GdkPixbuf *pixbuf)
{
int stride, i, n_channels;
unsigned char *pixels, *end, *argb_pixels, *s, *d;
unsigned char *pixels, *end, *s, *d;
stride = gdk_pixbuf_get_rowstride(pixbuf);
pixels = gdk_pixbuf_get_pixels(pixbuf);
n_channels = gdk_pixbuf_get_n_channels(pixbuf);
argb_pixels = cursor->map;
#define MULT(_d,c,a,t) \
do { t = c * a + 0x7f; _d = ((t >> 8) + t) >> 8; } while (0)
if (n_channels == 4)
{
for (i = 0; i < cursor->height; i++)
for (i = 0; i < height; i++)
{
s = pixels + i * stride;
end = s + cursor->width * 4;
d = argb_pixels + i * cursor->width * 4;
end = s + width * 4;
d = argb_pixels + i * width * 4;
while (s < end)
{
unsigned int t;
@@ -153,11 +302,11 @@ set_pixbuf (GdkWaylandCursor *cursor, GdkPixbuf *pixbuf)
}
else if (n_channels == 3)
{
for (i = 0; i < cursor->height; i++)
for (i = 0; i < height; i++)
{
s = pixels + i * stride;
end = s + cursor->width * 3;
d = argb_pixels + i * cursor->width * 4;
end = s + width * 3;
d = argb_pixels + i * width * 4;
while (s < end)
{
d[0] = s[2];
@@ -171,84 +320,6 @@ set_pixbuf (GdkWaylandCursor *cursor, GdkPixbuf *pixbuf)
}
}
static GdkCursor *
create_cursor(GdkWaylandDisplay *display, GdkPixbuf *pixbuf, int x, int y)
{
GdkWaylandCursor *cursor;
int stride, fd;
char *filename;
GError *error = NULL;
struct wl_shm_pool *pool;
cursor = g_object_new (GDK_TYPE_WAYLAND_CURSOR,
"cursor-type", GDK_CURSOR_IS_PIXMAP,
"display", display,
NULL);
cursor->name = NULL;
cursor->serial = theme_serial;
cursor->x = x;
cursor->y = y;
if (pixbuf)
{
cursor->width = gdk_pixbuf_get_width (pixbuf);
cursor->height = gdk_pixbuf_get_height (pixbuf);
}
else
{
cursor->width = 1;
cursor->height = 1;
}
stride = cursor->width * 4;
cursor->size = stride * cursor->height;
fd = g_file_open_tmp("wayland-shm-XXXXXX", &filename, &error);
if (fd < 0)
{
g_critical (G_STRLOC ": Error opening temporary file for buffer: %s",
error->message);
g_error_free (error);
return NULL;
}
unlink (filename);
g_free (filename);
if (ftruncate(fd, cursor->size) < 0)
{
g_critical (G_STRLOC ": Error truncating file for buffer: %s",
g_strerror (errno));
close(fd);
return NULL;
}
cursor->map = mmap(NULL, cursor->size,
PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (cursor->map == MAP_FAILED)
{
g_critical (G_STRLOC ": Error mmap'ing file for buffer: %s",
g_strerror (errno));
close(fd);
return NULL;
}
if (pixbuf)
set_pixbuf (cursor, pixbuf);
else
memset (cursor->map, 0, 4);
cursor->buffer = wl_shm_create_buffer(display->shm,
fd,
cursor->width,
cursor->height,
stride, WL_SHM_FORMAT_ARGB8888);
close(fd);
return GDK_CURSOR (cursor);
}
#endif
GdkCursor *
_gdk_wayland_display_get_cursor_for_type (GdkDisplay *display,
GdkCursorType cursor_type)
@@ -277,10 +348,18 @@ _gdk_wayland_display_get_cursor_for_name (GdkDisplay *display,
{
GdkWaylandCursor *private;
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (display);
struct wl_cursor *cursor;
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
private = find_in_cache (wayland_display, GDK_CURSOR_IS_PIXMAP, name);
if (private)
{
/* Cache had it, add a ref for this user */
g_object_ref (private);
return (GdkCursor*) private;
}
private = g_object_new (GDK_TYPE_WAYLAND_CURSOR,
"cursor-type", GDK_CURSOR_IS_PIXMAP,
"display", display,
@@ -292,59 +371,73 @@ _gdk_wayland_display_get_cursor_for_name (GdkDisplay *display,
if (!name || g_str_equal (name, "blank_cursor"))
return GDK_CURSOR (private);
cursor = wl_cursor_theme_get_cursor (wayland_display->cursor_theme,
name);
if (!set_cursor_from_theme (private, wayland_display->cursor_theme))
return GDK_CURSOR (private);
if (!cursor)
{
g_warning (G_STRLOC ": Unable to load %s from the cursor theme", name);
/* return the left_ptr cursor as a fallback */
cursor = wl_cursor_theme_get_cursor (wayland_display->cursor_theme,
"left_ptr");
/* if the fallback failed to load, return a blank pointer */
if (!cursor)
return GDK_CURSOR (private);
}
/* TODO: Do something clever so we can do animated cursors - move the
* wl_pointer_set_cursor to a function here so that we can do the magic to
* iterate through
*/
private->hotspot_x = cursor->images[0]->hotspot_x;
private->hotspot_y = cursor->images[0]->hotspot_y;
private->width = cursor->images[0]->width;
private->height = cursor->images[0]->height;
private->buffer = wl_cursor_image_get_buffer(cursor->images[0]);
add_to_cache (wayland_display, private);
return GDK_CURSOR (private);
}
/* TODO: Needs implementing */
GdkCursor *
_gdk_wayland_display_get_cursor_for_pixbuf (GdkDisplay *display,
GdkPixbuf *pixbuf,
gint x,
gint y)
{
GdkWaylandCursor *private;
GdkWaylandCursor *cursor;
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY (display);
int stride;
size_t size;
gpointer data;
struct wl_shm_pool *pool;
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL);
g_return_val_if_fail (0 <= x && x < gdk_pixbuf_get_width (pixbuf), NULL);
g_return_val_if_fail (0 <= y && y < gdk_pixbuf_get_height (pixbuf), NULL);
private = g_object_new (GDK_TYPE_WAYLAND_CURSOR,
"cursor-type", GDK_CURSOR_IS_PIXMAP,
"display", display,
NULL);
cursor = g_object_new (GDK_TYPE_WAYLAND_CURSOR,
"cursor-type", GDK_CURSOR_IS_PIXMAP,
"display", wayland_display,
NULL);
cursor->name = NULL;
cursor->serial = theme_serial;
cursor->pixbuf.hotspot_x = x;
cursor->pixbuf.hotspot_y = y;
private->name = NULL;
private->serial = theme_serial;
if (pixbuf)
{
cursor->pixbuf.width = gdk_pixbuf_get_width (pixbuf);
cursor->pixbuf.height = gdk_pixbuf_get_height (pixbuf);
}
else
{
cursor->pixbuf.width = 1;
cursor->pixbuf.height = 1;
}
return GDK_CURSOR (private);
pool = _create_shm_pool (wayland_display->shm,
cursor->pixbuf.width,
cursor->pixbuf.height,
&size,
&data);
if (pixbuf)
set_pixbuf (data, cursor->pixbuf.width, cursor->pixbuf.height, pixbuf);
else
memset (data, 0, 4);
stride = cursor->pixbuf.width * 4;
cursor->pixbuf.buffer = wl_shm_pool_create_buffer (pool, 0,
cursor->pixbuf.width,
cursor->pixbuf.height,
stride,
WL_SHM_FORMAT_ARGB8888);
wl_shm_pool_destroy (pool);
return GDK_CURSOR (cursor);
}
void

View File

@@ -30,7 +30,6 @@
#include "gdkkeysyms.h"
#include "gdkdeviceprivate.h"
#include "gdkdevicemanagerprivate.h"
#include "gdkprivate-wayland.h"
#include <xkbcommon/xkbcommon.h>
#include <X11/keysym.h>
@@ -38,14 +37,13 @@
#include <sys/time.h>
#include <sys/mman.h>
typedef struct _GdkWaylandDeviceData GdkWaylandDeviceData;
typedef struct _DataOffer DataOffer;
typedef struct _GdkWaylandSelectionOffer GdkWaylandSelectionOffer;
struct _GdkWaylandDeviceData
{
guint32 id;
struct wl_seat *wl_seat;
struct wl_pointer *wl_pointer;
struct wl_keyboard *wl_keyboard;
@@ -55,7 +53,7 @@ struct _GdkWaylandDeviceData
GdkDevice *pointer;
GdkDevice *keyboard;
GdkCursor *cursor;
GdkKeymap *keymap;
GdkModifierType modifiers;
@@ -64,11 +62,17 @@ struct _GdkWaylandDeviceData
struct wl_data_device *data_device;
double surface_x, surface_y;
uint32_t time;
uint32_t enter_serial;
uint32_t button_press_serial;
GdkWindow *pointer_grab_window;
uint32_t pointer_grab_time;
guint32 repeat_timer;
guint32 repeat_key;
guint32 repeat_count;
GSettings *keyboard_settings;
guint cursor_timeout_id;
guint cursor_image_index;
DataOffer *drag_offer;
DataOffer *selection_offer;
@@ -104,8 +108,6 @@ typedef struct _GdkWaylandDeviceManagerClass GdkWaylandDeviceManagerClass;
struct _GdkWaylandDeviceManager
{
GdkDeviceManager parent_object;
GdkDevice *core_pointer;
GdkDevice *core_keyboard;
GList *devices;
};
@@ -145,38 +147,83 @@ gdk_wayland_device_get_state (GdkDevice *device,
}
}
static void
gdk_wayland_device_stop_window_cursor_animation (GdkWaylandDeviceData *wd)
{
if (wd->cursor_timeout_id > 0)
{
g_source_remove (wd->cursor_timeout_id);
wd->cursor_timeout_id = 0;
}
wd->cursor_image_index = 0;
}
static gboolean
gdk_wayland_device_update_window_cursor (GdkWaylandDeviceData *wd)
{
struct wl_buffer *buffer;
int x, y, w, h;
guint next_image_index, next_image_delay;
buffer = _gdk_wayland_cursor_get_buffer (wd->cursor, wd->cursor_image_index,
&x, &y, &w, &h);
wl_pointer_set_cursor (wd->wl_pointer,
wd->enter_serial,
wd->pointer_surface,
x, y);
wl_surface_attach (wd->pointer_surface, buffer, 0, 0);
wl_surface_damage (wd->pointer_surface, 0, 0, w, h);
wl_surface_commit (wd->pointer_surface);
next_image_index =
_gdk_wayland_cursor_get_next_image_index (wd->cursor,
wd->cursor_image_index,
&next_image_delay);
if (next_image_index != wd->cursor_image_index)
{
guint id;
/* Queue timeout for next frame */
id = g_timeout_add (next_image_delay,
(GSourceFunc)gdk_wayland_device_update_window_cursor,
wd);
wd->cursor_timeout_id = id;
wd->cursor_image_index = next_image_index;
}
else
wd->cursor_timeout_id = 0;
return FALSE;
}
static void
gdk_wayland_device_set_window_cursor (GdkDevice *device,
GdkWindow *window,
GdkCursor *cursor)
{
GdkWaylandDeviceData *wd = GDK_WAYLAND_DEVICE(device)->device;
GdkWaylandDisplay *wayland_display =
GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
struct wl_buffer *buffer;
int x, y, w, h;
if (cursor)
g_object_ref (cursor);
/* Setting the cursor to NULL means that we should use the default cursor */
if (!cursor)
{
/* FIXME: Is this the best sensible default ? */
cursor = _gdk_wayland_display_get_cursor_for_type (device->display,
GDK_LEFT_PTR);
GDK_LEFT_PTR);
}
buffer = _gdk_wayland_cursor_get_buffer (cursor, &x, &y, &w, &h);
wl_pointer_set_cursor (wd->wl_pointer,
_gdk_wayland_display_get_serial (wayland_display),
wd->pointer_surface,
x, y);
wl_surface_attach (wd->pointer_surface, buffer, 0, 0);
wl_surface_damage (wd->pointer_surface, 0, 0, w, h);
wl_surface_commit(wd->pointer_surface);
if (cursor == wd->cursor)
return;
g_object_unref (cursor);
gdk_wayland_device_stop_window_cursor_animation (wd);
if (wd->cursor)
g_object_unref (wd->cursor);
wd->cursor = g_object_ref (cursor);
gdk_wayland_device_update_window_cursor (wd);
}
static void
@@ -208,13 +255,11 @@ gdk_wayland_device_query_state (GdkDevice *device,
*root_window = gdk_screen_get_root_window (default_screen);
if (child_window)
*child_window = wd->pointer_focus;
/* Do something clever for relative here */
#if 0
/* TODO: Do something clever for relative here */
if (root_x)
*root_x = wd->x;
*root_x = wd->surface_x;
if (root_y)
*root_y = wd->y;
#endif
*root_y = wd->surface_y;
if (win_x)
*win_x = wd->surface_x;
if (win_y)
@@ -575,6 +620,7 @@ pointer_handle_enter (void *data,
device->surface_x = wl_fixed_to_double (sx);
device->surface_y = wl_fixed_to_double (sy);
device->enter_serial = serial;
_gdk_wayland_display_deliver_event (device->display, event);
@@ -619,6 +665,13 @@ pointer_handle_leave (void *data,
device, device->pointer_focus));
g_object_unref(device->pointer_focus);
if (device->cursor)
{
gdk_wayland_device_stop_window_cursor_animation (device);
g_object_unref (device->cursor);
device->cursor = NULL;
}
device->pointer_focus = NULL;
}
@@ -688,6 +741,8 @@ pointer_handle_button (void *data,
}
device->time = time;
if (state)
device->button_press_serial = serial;
event = gdk_event_new (state ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE);
event->button.window = g_object_ref (device->pointer_focus);
@@ -767,10 +822,12 @@ keyboard_handle_keymap (void *data,
uint32_t size)
{
GdkWaylandDeviceData *device = data;
if (device->keymap)
g_object_unref (device->keymap);
device->keymap = _gdk_wayland_keymap_new_from_fd (format, fd, size);
_gdk_wayland_keymap_update_from_fd (device->keymap, format, fd, size);
g_signal_emit_by_name (device->keymap, "keys-changed");
g_signal_emit_by_name (device->keymap, "state-changed");
g_signal_emit_by_name (device->keymap, "direction-changed");
}
static void
@@ -844,22 +901,6 @@ keyboard_handle_leave (void *data,
static gboolean
keyboard_repeat (gpointer data);
static GdkModifierType
get_modifier (struct xkb_state *state)
{
GdkModifierType modifiers = 0;
modifiers |= (xkb_state_mod_name_is_active (state, XKB_MOD_NAME_SHIFT, XKB_STATE_MODS_EFFECTIVE) > 0)?GDK_SHIFT_MASK:0;
modifiers |= (xkb_state_mod_name_is_active (state, XKB_MOD_NAME_CAPS, XKB_STATE_MODS_EFFECTIVE) > 0)?GDK_LOCK_MASK:0;
modifiers |= (xkb_state_mod_name_is_active (state, XKB_MOD_NAME_CTRL, XKB_STATE_MODS_EFFECTIVE) > 0)?GDK_CONTROL_MASK:0;
modifiers |= (xkb_state_mod_name_is_active (state, XKB_MOD_NAME_ALT, XKB_STATE_MODS_EFFECTIVE) > 0)?GDK_MOD1_MASK:0;
modifiers |= (xkb_state_mod_name_is_active (state, "Mod2", XKB_STATE_MODS_EFFECTIVE) > 0)?GDK_MOD2_MASK:0;
modifiers |= (xkb_state_mod_name_is_active (state, "Mod3", XKB_STATE_MODS_EFFECTIVE) > 0)?GDK_MOD3_MASK:0;
modifiers |= (xkb_state_mod_name_is_active (state, XKB_MOD_NAME_LOGO, XKB_STATE_MODS_EFFECTIVE) > 0)?GDK_MOD4_MASK:0;
modifiers |= (xkb_state_mod_name_is_active (state, "Mod5", XKB_STATE_MODS_EFFECTIVE) > 0)?GDK_MOD5_MASK:0;
return modifiers;
}
static void
translate_keyboard_string (GdkEventKey *event)
{
@@ -924,22 +965,48 @@ translate_keyboard_string (GdkEventKey *event)
}
}
static gboolean
get_key_repeat (GdkWaylandDeviceData *device,
guint *delay,
guint *interval)
{
gboolean repeat;
if (device->keyboard_settings)
{
repeat = g_settings_get_boolean (device->keyboard_settings, "repeat");
*delay = g_settings_get_uint (device->keyboard_settings, "delay");
*interval = g_settings_get_uint (device->keyboard_settings, "repeat-interval");
}
else
{
repeat = TRUE;
*delay = 400;
*interval = 80;
}
return repeat;
}
static gboolean
deliver_key_event(GdkWaylandDeviceData *device,
uint32_t time, uint32_t key, uint32_t state)
{
GdkEvent *event;
struct xkb_state *xkb_state;
struct xkb_keymap *xkb_keymap;
GdkKeymap *keymap;
xkb_keysym_t sym;
guint delay, interval;
keymap = device->keymap;
xkb_state = _gdk_wayland_keymap_get_xkb_state (keymap);
xkb_keymap = _gdk_wayland_keymap_get_xkb_keymap (keymap);
sym = xkb_state_key_get_one_sym (xkb_state, key);
device->time = time;
device->modifiers = get_modifier (xkb_state);
device->modifiers = gdk_keymap_get_modifier_state (keymap);
event = gdk_event_new (state ? GDK_KEY_PRESS : GDK_KEY_RELEASE);
event->key.window = device->keyboard_focus?g_object_ref (device->keyboard_focus):NULL;
@@ -947,10 +1014,9 @@ deliver_key_event(GdkWaylandDeviceData *device,
event->button.time = time;
event->key.state = device->modifiers;
event->key.group = 0;
event->key.hardware_keycode = sym;
event->key.hardware_keycode = key;
event->key.keyval = sym;
event->key.is_modifier = device->modifiers > 0;
event->key.is_modifier = _gdk_wayland_keymap_key_is_modifier (keymap, key);
translate_keyboard_string (&event->key);
@@ -962,6 +1028,12 @@ deliver_key_event(GdkWaylandDeviceData *device,
event->key.hardware_keycode, event->key.keyval,
event->key.string, event->key.state));
if (!xkb_keymap_key_repeats (xkb_keymap, key))
return FALSE;
if (!get_key_repeat (device, &delay, &interval))
return FALSE;
device->repeat_count++;
device->repeat_key = key;
@@ -974,10 +1046,6 @@ deliver_key_event(GdkWaylandDeviceData *device,
}
return FALSE;
}
else if (device->modifiers)
{
return FALSE;
}
else switch (device->repeat_count)
{
case 1:
@@ -988,11 +1056,11 @@ deliver_key_event(GdkWaylandDeviceData *device,
}
device->repeat_timer =
gdk_threads_add_timeout (400, keyboard_repeat, device);
gdk_threads_add_timeout (delay, keyboard_repeat, device);
return TRUE;
case 2:
device->repeat_timer =
gdk_threads_add_timeout (80, keyboard_repeat, device);
gdk_threads_add_timeout (interval, keyboard_repeat, device);
return FALSE;
default:
return TRUE;
@@ -1036,12 +1104,18 @@ keyboard_handle_modifiers (void *data,
GdkWaylandDeviceData *device = data;
GdkKeymap *keymap;
struct xkb_state *xkb_state;
PangoDirection direction;
keymap = device->keymap;
direction = gdk_keymap_get_direction (keymap);
xkb_state = _gdk_wayland_keymap_get_xkb_state (keymap);
device->modifiers = mods_depressed | mods_latched | mods_locked;
xkb_state_update_mask (xkb_state, mods_depressed, mods_latched, mods_locked, group, 0, 0);
g_signal_emit_by_name (keymap, "state-changed");
if (direction != gdk_keymap_get_direction (keymap))
g_signal_emit_by_name (keymap, "direction-changed");
}
static const struct wl_pointer_listener pointer_listener = {
@@ -1088,6 +1162,8 @@ seat_handle_capabilities(void *data, struct wl_seat *seat,
device_manager->devices =
g_list_prepend (device_manager->devices, device->pointer);
g_signal_emit_by_name (device_manager, "device-added", device->pointer);
}
else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && device->wl_pointer)
{
@@ -1097,11 +1173,12 @@ seat_handle_capabilities(void *data, struct wl_seat *seat,
device_manager->devices =
g_list_remove (device_manager->devices, device->pointer);
g_signal_emit_by_name (device_manager, "device-removed", device->pointer);
g_object_unref (device->pointer);
device->pointer = NULL;
}
if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !device->wl_keyboard)
if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !device->wl_keyboard)
{
device->wl_keyboard = wl_seat_get_keyboard(seat);
wl_keyboard_set_user_data(device->wl_keyboard, device);
@@ -1121,6 +1198,8 @@ seat_handle_capabilities(void *data, struct wl_seat *seat,
device_manager->devices =
g_list_prepend (device_manager->devices, device->keyboard);
g_signal_emit_by_name (device_manager, "device-added", device->keyboard);
}
else if (!(caps & WL_SEAT_CAPABILITY_KEYBOARD) && device->wl_keyboard)
{
@@ -1130,6 +1209,7 @@ seat_handle_capabilities(void *data, struct wl_seat *seat,
device_manager->devices =
g_list_remove (device_manager->devices, device->keyboard);
g_signal_emit_by_name (device_manager, "device-removed", device->keyboard);
g_object_unref (device->keyboard);
device->keyboard = NULL;
}
@@ -1145,9 +1225,25 @@ static const struct wl_seat_listener seat_listener = {
seat_handle_capabilities,
};
static void
init_settings (GdkWaylandDeviceData *device)
{
GSettingsSchemaSource *source;
GSettingsSchema *schema;
source = g_settings_schema_source_get_default ();
schema = g_settings_schema_source_lookup (source, "org.gnome.settings-daemon.peripherals.keyboard", FALSE);
if (schema != NULL)
{
device->keyboard_settings = g_settings_new_full (schema, NULL, NULL);
g_settings_schema_unref (schema);
}
}
void
_gdk_wayland_device_manager_add_device (GdkDeviceManager *device_manager,
struct wl_seat *wl_seat)
_gdk_wayland_device_manager_add_seat (GdkDeviceManager *device_manager,
guint32 id,
struct wl_seat *wl_seat)
{
GdkDisplay *display;
GdkWaylandDisplay *display_wayland;
@@ -1157,6 +1253,7 @@ _gdk_wayland_device_manager_add_device (GdkDeviceManager *device_manager,
display_wayland = GDK_WAYLAND_DISPLAY (display);
device = g_new0 (GdkWaylandDeviceData, 1);
device->id = id;
device->keymap = _gdk_wayland_keymap_new ();
device->display = display;
device->device_manager = device_manager;
@@ -1174,6 +1271,34 @@ _gdk_wayland_device_manager_add_device (GdkDeviceManager *device_manager,
device->pointer_surface =
wl_compositor_create_surface (display_wayland->compositor);
init_settings (device);
}
void
_gdk_wayland_device_manager_remove_seat (GdkDeviceManager *manager,
guint32 id)
{
GdkWaylandDeviceManager *device_manager = GDK_WAYLAND_DEVICE_MANAGER (manager);
GList *l;
for (l = device_manager->devices; l != NULL; l = l->next)
{
GdkWaylandDevice *wayland_device = l->data;
GdkWaylandDeviceData *device = wayland_device->device;
if (device->id == id)
{
seat_handle_capabilities (device, device->wl_seat, 0);
g_object_unref (device->keymap);
wl_surface_destroy (device->pointer_surface);
/* FIXME: destroy data_device */
g_clear_object (&device->keyboard_settings);
g_free (device);
break;
}
}
}
static void
@@ -1254,6 +1379,12 @@ _gdk_wayland_device_manager_new (GdkDisplay *display)
NULL);
}
uint32_t
_gdk_wayland_device_get_button_press_serial(GdkWaylandDeviceData *device)
{
return device->button_press_serial;
}
gint
gdk_wayland_device_get_selection_type_atoms (GdkDevice *gdk_device,
GdkAtom **atoms_out)

View File

@@ -34,6 +34,40 @@
#include "gdkkeysprivate.h"
#include "gdkprivate-wayland.h"
/**
* SECTION:wayland_interaction
* @Short_description: Wayland backend-specific functions
* @Title: Wayland Interaction
*
* The functions in this section are specific to the GDK Wayland backend.
* To use them, you need to include the <literal>&lt;gdk/gdkwayland.h&gt;</literal>
* header and use the Wayland-specific pkg-config files to build your
* application (either <literal>gdk-wayland-3.0</literal> or
* <literal>gtk+-wayland-3.0</literal>).
*
* To make your code compile with other GDK backends, guard backend-specific
* calls by an ifdef as follows. Since GDK may be built with multiple
* backends, you should also check for the backend that is in use (e.g. by
* using the GDK_IS_WAYLAND_DISPLAY() macro).
* |[
* #ifdef GDK_WINDOWING_WAYLAND
* if (GDK_IS_WAYLAND_DISPLAY (display))
* {
* /&ast; make Wayland-specific calls here &ast;/
* }
* else
* #endif
* #ifdef GDK_WINDOWING_X11
* if (GDK_IS_X11_DISPLAY (display))
* {
* /&ast; make X11-specific calls here &ast;/
* }
* else
* #endif
* g_error ("Unsupported GDK backend");
* ]|
*/
static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *wayland_display);
G_DEFINE_TYPE (GdkWaylandDisplay, gdk_wayland_display, GDK_TYPE_DISPLAY)
@@ -88,6 +122,29 @@ gdk_input_init (GdkDisplay *display)
g_list_free (list);
}
static void
init_sync_callback(void *data, struct wl_callback *callback, uint32_t serial)
{
GdkWaylandDisplay *display = data;
display->init_ref_count--;
wl_callback_destroy(callback);
}
static const struct wl_callback_listener init_sync_listener = {
init_sync_callback
};
static void
wait_for_roundtrip(GdkWaylandDisplay *display)
{
struct wl_callback *callback;
display->init_ref_count++;
callback = wl_display_sync(display->wl_display);
wl_callback_add_listener(callback, &init_sync_listener, display);
}
static void
gdk_registry_handle_global(void *data, struct wl_registry *registry, uint32_t id,
const char *interface, uint32_t version)
@@ -112,11 +169,18 @@ gdk_registry_handle_global(void *data, struct wl_registry *registry, uint32_t id
} else if (strcmp(interface, "wl_output") == 0) {
output =
wl_registry_bind(display_wayland->wl_registry, id, &wl_output_interface, 1);
_gdk_wayland_screen_add_output(display_wayland->screen, output);
_gdk_wayland_screen_add_output(display_wayland->screen, id, output);
/* We need another roundtrip to receive the modes and geometry
* events for the output, which gives us the physical properties
* and available modes on the output. */
wait_for_roundtrip(display_wayland);
} else if (strcmp(interface, "wl_seat") == 0) {
seat = wl_registry_bind(display_wayland->wl_registry, id, &wl_seat_interface, 1);
_gdk_wayland_device_manager_add_device (gdk_display->device_manager,
seat);
_gdk_wayland_device_manager_add_seat (gdk_display->device_manager, id, seat);
/* We need another roundtrip to receive the wl_seat capabilities
* event which informs us of available input devices on this
* seat. */
wait_for_roundtrip(display_wayland);
} else if (strcmp(interface, "wl_data_device_manager") == 0) {
display_wayland->data_device_manager =
wl_registry_bind(display_wayland->wl_registry, id,
@@ -130,9 +194,12 @@ gdk_registry_handle_global_remove(void *data,
uint32_t id)
{
GdkWaylandDisplay *display_wayland = data;
GdkDisplay *display = GDK_DISPLAY (display_wayland);
/* We don't know what this item is - try as an output */
_gdk_wayland_screen_remove_output_by_id (display_wayland->screen, id);
_gdk_wayland_device_manager_remove_seat (display->device_manager, id);
_gdk_wayland_screen_remove_output (display_wayland->screen, id);
/* FIXME: the object needs to be destroyed here, we're leaking */
}
static const struct wl_registry_listener registry_listener = {
@@ -140,6 +207,12 @@ static const struct wl_registry_listener registry_listener = {
gdk_registry_handle_global_remove
};
static void
log_handler(const char *format, va_list args)
{
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR, format, args);
}
GdkDisplay *
_gdk_wayland_display_open (const gchar *display_name)
{
@@ -147,6 +220,8 @@ _gdk_wayland_display_open (const gchar *display_name)
GdkDisplay *display;
GdkWaylandDisplay *display_wayland;
wl_log_set_handler_client(log_handler);
wl_display = wl_display_connect(display_name);
if (!wl_display)
return NULL;
@@ -164,7 +239,11 @@ _gdk_wayland_display_open (const gchar *display_name)
display_wayland->wl_registry = wl_display_get_registry(display_wayland->wl_display);
wl_registry_add_listener(display_wayland->wl_registry, &registry_listener, display_wayland);
wl_display_dispatch(display_wayland->wl_display);
/* We use init_ref_count to track whether some part of our
* initialization still needs a roundtrip to complete. */
wait_for_roundtrip(display_wayland);
while (display_wayland->init_ref_count > 0)
wl_display_roundtrip(display_wayland->wl_display);
display_wayland->event_source =
_gdk_wayland_display_event_source_new (display);
@@ -172,7 +251,6 @@ _gdk_wayland_display_open (const gchar *display_name)
gdk_input_init (display);
g_signal_emit_by_name (display, "opened");
g_signal_emit_by_name (gdk_display_manager_get(), "display_opened", display);
return display;
}
@@ -204,9 +282,7 @@ gdk_wayland_display_finalize (GObject *object)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (object);
/* Keymap */
if (display_wayland->keymap)
g_object_unref (display_wayland->keymap);
_gdk_wayland_display_finalize_cursors (display_wayland);
/* input GdkDevice list */
g_list_free_full (display_wayland->input_devices, g_object_unref);
@@ -224,22 +300,6 @@ gdk_wayland_display_get_name (GdkDisplay *display)
return "Wayland";
}
static gint
gdk_wayland_display_get_n_screens (GdkDisplay *display)
{
return 1;
}
static GdkScreen *
gdk_wayland_display_get_screen (GdkDisplay *display,
gint screen_num)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
g_return_val_if_fail (screen_num == 0, NULL);
return GDK_WAYLAND_DISPLAY (display)->screen;
}
static GdkScreen *
gdk_wayland_display_get_default_screen (GdkDisplay *display)
{
@@ -363,11 +423,6 @@ gdk_wayland_display_get_next_serial (GdkDisplay *display)
return ++serial;
}
void
_gdk_wayland_display_make_default (GdkDisplay *display)
{
}
/**
* gdk_wayland_display_broadcast_startup_message:
* @display: a #GdkDisplay
@@ -474,6 +529,8 @@ _gdk_wayland_display_get_keymap (GdkDisplay *display)
break;
}
g_list_free (list);
if (core_keyboard && tmp_keymap)
{
g_object_unref (tmp_keymap);
@@ -511,8 +568,6 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass * class)
display_class->window_type = gdk_wayland_window_get_type ();
display_class->get_name = gdk_wayland_display_get_name;
display_class->get_n_screens = gdk_wayland_display_get_n_screens;
display_class->get_screen = gdk_wayland_display_get_screen;
display_class->get_default_screen = gdk_wayland_display_get_default_screen;
display_class->beep = gdk_wayland_display_beep;
display_class->sync = gdk_wayland_display_sync;
@@ -564,27 +619,56 @@ gdk_wayland_display_init (GdkWaylandDisplay *display)
display->xkb_context = xkb_context_new (0);
}
void
gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
const gchar *name,
gint size)
{
GdkWaylandDisplay *wayland_display = GDK_WAYLAND_DISPLAY(display);
struct wl_cursor_theme *theme;
g_assert (wayland_display);
g_assert (wayland_display->shm);
theme = wl_cursor_theme_load (name, size, wayland_display->shm);
if (theme == NULL)
{
g_warning ("Failed to load cursor theme %s\n", name);
return;
}
_gdk_wayland_display_update_cursors (wayland_display, theme);
if (wayland_display->cursor_theme != NULL)
wl_cursor_theme_destroy (wayland_display->cursor_theme);
wayland_display->cursor_theme = theme;
}
static void
_gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *wayland_display)
{
guint w, h;
const gchar *theme_name;
guint size;
const gchar *name;
GValue v = G_VALUE_INIT;
g_assert (wayland_display);
g_assert (wayland_display->shm);
_gdk_wayland_display_get_default_cursor_size (GDK_DISPLAY (wayland_display),
&w, &h);
g_value_init (&v, G_TYPE_INT);
if (gdk_setting_get ("gtk-cursor-theme-size", &v))
size = g_value_get_int (&v);
else
size = 32;
g_value_unset (&v);
g_value_init (&v, G_TYPE_STRING);
if (gdk_setting_get ("gtk-cursor-theme-name", &v))
theme_name = g_value_get_string (&v);
name = g_value_get_string (&v);
else
theme_name = "default";
name = "default";
wayland_display->cursor_theme = wl_cursor_theme_load (theme_name,
w,
wayland_display->shm);
gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (wayland_display),
name, size);
g_value_unset (&v);
}

View File

@@ -42,9 +42,6 @@ struct _GdkWaylandDisplay
GdkDisplay parent_instance;
GdkScreen *screen;
/* Keyboard related information */
GdkKeymap *keymap;
/* input GdkDevice list */
GList *input_devices;
@@ -65,9 +62,12 @@ struct _GdkWaylandDisplay
struct wl_data_device_manager *data_device_manager;
struct wl_cursor_theme *cursor_theme;
GSList *cursor_cache;
GSource *event_source;
int init_ref_count;
struct xkb_context *xkb_context;
};

View File

@@ -27,17 +27,13 @@
#include "gdkwayland.h"
#include "gdkinternals.h"
#include <xkbcommon/xkbcommon.h>
struct _GdkWaylandDisplayManager
{
GdkDisplayManager parent;
GdkDisplay *default_display;
GSList *displays;
GHashTable *name_to_atoms;
guint next_atom;
gboolean init_failed;
};
struct _GdkWaylandDisplayManagerClass
@@ -45,179 +41,64 @@ struct _GdkWaylandDisplayManagerClass
GdkDisplayManagerClass parent_class;
};
G_DEFINE_TYPE (GdkWaylandDisplayManager, gdk_wayland_display_manager, GDK_TYPE_DISPLAY_MANAGER)
static void g_initable_iface_init (GInitableIface *iface);
G_DEFINE_TYPE_WITH_CODE (GdkWaylandDisplayManager, gdk_wayland_display_manager, GDK_TYPE_DISPLAY_MANAGER,
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, g_initable_iface_init))
static gboolean
gdk_wayland_display_manager_initable_init (GInitable *initable,
GCancellable *cancellable,
GError **error)
{
struct wl_display *wl_display;
/* Set by the compositor when launching a special client - and it gets reset
* by wl_display_connect so we must avoid calling it twice
*/
if (g_getenv ("WAYLAND_SOCKET"))
return TRUE;
/* check that a connection to the default display is possible */
wl_display = wl_display_connect (gdk_get_display_arg_name ());
if (!wl_display)
{
GDK_WAYLAND_DISPLAY_MANAGER (initable)->init_failed = TRUE;
return FALSE;
}
wl_display_disconnect (wl_display);
return TRUE;
}
void
g_initable_iface_init (GInitableIface *iface)
{
iface->init = gdk_wayland_display_manager_initable_init;
}
static void
gdk_wayland_display_manager_finalize (GObject *object)
{
g_error ("A GdkWaylandDisplayManager object was finalized. This should not happen");
if (GDK_WAYLAND_DISPLAY_MANAGER (object)->init_failed == FALSE)
g_error ("A GdkWaylandDisplayManager object was finalized. This should not happen");
G_OBJECT_CLASS (gdk_wayland_display_manager_parent_class)->finalize (object);
}
static GdkDisplay *
gdk_wayland_display_manager_open_display (GdkDisplayManager *manager,
const gchar *name)
{
return _gdk_wayland_display_open (name);
}
static GSList *
gdk_wayland_display_manager_list_displays (GdkDisplayManager *manager)
{
return g_slist_copy (GDK_WAYLAND_DISPLAY_MANAGER (manager)->displays);
}
static void
gdk_wayland_display_manager_set_default_display (GdkDisplayManager *manager,
GdkDisplay *display)
{
GDK_WAYLAND_DISPLAY_MANAGER (manager)->default_display = display;
_gdk_wayland_display_make_default (display);
}
static GdkDisplay *
gdk_wayland_display_manager_get_default_display (GdkDisplayManager *manager)
{
return GDK_WAYLAND_DISPLAY_MANAGER (manager)->default_display;
}
static GdkAtom
gdk_wayland_display_manager_atom_intern (GdkDisplayManager *manager_in,
const gchar *atom_name,
gboolean dup)
{
GdkWaylandDisplayManager *manager = GDK_WAYLAND_DISPLAY_MANAGER (manager_in);
GdkAtom atom;
gpointer data;
const gchar *atom_name_intern;
atom_name_intern = g_intern_string (atom_name);
data = g_hash_table_lookup (manager->name_to_atoms, atom_name_intern);
if (data)
{
atom = GDK_POINTER_TO_ATOM (data);
return atom;
}
atom = _GDK_MAKE_ATOM (manager->next_atom);
g_hash_table_insert (manager->name_to_atoms,
(gchar *)atom_name_intern,
GDK_ATOM_TO_POINTER (atom));
manager->next_atom++;
return atom;
}
static gchar *
gdk_wayland_display_manager_get_atom_name (GdkDisplayManager *manager_in,
GdkAtom atom)
{
GdkWaylandDisplayManager *manager = GDK_WAYLAND_DISPLAY_MANAGER (manager_in);
GHashTableIter iter;
gpointer key, value;
g_hash_table_iter_init (&iter, manager->name_to_atoms);
while (g_hash_table_iter_next (&iter, &key, &value))
{
if (GDK_POINTER_TO_ATOM (value) == atom)
return g_strdup (key);
}
return NULL;
}
static guint
gdk_wayland_display_manager_lookup_keyval (GdkDisplayManager *manager,
const gchar *keyval_name)
{
g_return_val_if_fail (keyval_name != NULL, 0);
return xkb_keysym_from_name (keyval_name, 0);
}
static gchar *
gdk_wayland_display_manager_get_keyval_name (GdkDisplayManager *manager,
guint keyval)
{
static char buf[128];
switch (keyval)
{
case GDK_KEY_Page_Up:
return "Page_Up";
case GDK_KEY_Page_Down:
return "Page_Down";
case GDK_KEY_KP_Page_Up:
return "KP_Page_Up";
case GDK_KEY_KP_Page_Down:
return "KP_Page_Down";
}
xkb_keysym_get_name(keyval, buf, sizeof (buf));
return buf;
}
static void
gdk_wayland_display_manager_class_init (GdkWaylandDisplayManagerClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GdkDisplayManagerClass *manager_class = GDK_DISPLAY_MANAGER_CLASS (class);
object_class->finalize = gdk_wayland_display_manager_finalize;
manager_class->open_display = gdk_wayland_display_manager_open_display;
manager_class->list_displays = gdk_wayland_display_manager_list_displays;
manager_class->set_default_display = gdk_wayland_display_manager_set_default_display;
manager_class->get_default_display = gdk_wayland_display_manager_get_default_display;
manager_class->atom_intern = gdk_wayland_display_manager_atom_intern;
manager_class->get_atom_name = gdk_wayland_display_manager_get_atom_name;
manager_class->lookup_keyval = gdk_wayland_display_manager_lookup_keyval;
manager_class->get_keyval_name = gdk_wayland_display_manager_get_keyval_name;
}
static struct {
const gchar *name;
guint atom_id;
} predefined_atoms[] = {
{ "NONE", 0 },
{ "PRIMARY", 1 },
{ "SECONDARY", 2 },
{ "ATOM", 4 },
{ "BITMAP", 5 },
{ "COLORMAP", 7 },
{ "DRAWABLE", 17 },
{ "INTEGER", 19 },
{ "PIXMAP", 20 },
{ "STRING", 31 },
{ "WINDOW", 33 },
{ "CLIPBOARD", 69 },
};
static void
gdk_wayland_display_manager_init (GdkWaylandDisplayManager *manager)
{
gint i;
manager->name_to_atoms = g_hash_table_new (NULL, NULL);
for (i = 0; i < G_N_ELEMENTS (predefined_atoms); i++)
{
GdkAtom atom;
const gchar *atom_name = predefined_atoms[i].name;
atom = _GDK_MAKE_ATOM (predefined_atoms[i].atom_id);
g_hash_table_insert (manager->name_to_atoms,
(gchar *)g_intern_static_string (atom_name),
GDK_ATOM_TO_POINTER (atom));
}
manager->next_atom =
predefined_atoms[G_N_ELEMENTS (predefined_atoms) - 1].atom_id + 1;
}
void
@@ -240,7 +121,7 @@ _gdk_wayland_display_manager_remove_display (GdkDisplayManager *manager,
manager_wayland->displays = g_slist_remove (manager_wayland->displays, display);
if (manager_wayland->default_display == display)
if (gdk_display_manager_get_default_display (manager) == display)
{
if (manager_wayland->displays)
gdk_display_manager_set_default_display (manager, manager_wayland->displays->data);

View File

@@ -57,9 +57,6 @@ gdk_event_source_check(GSource *base)
{
GdkWaylandEventSource *source = (GdkWaylandEventSource *) base;
if (source->pfd.revents & (G_IO_ERR | G_IO_HUP))
g_error ("Lost connection to wayland compositor");
if (source->display->event_pause_count > 0)
return FALSE;
@@ -153,9 +150,12 @@ _gdk_wayland_display_queue_events (GdkDisplay *display)
display_wayland = GDK_WAYLAND_DISPLAY (display);
source = (GdkWaylandEventSource *) display_wayland->event_source;
if (source->pfd.revents)
if (source->pfd.revents & G_IO_IN)
{
wl_display_dispatch(display_wayland->wl_display);
source->pfd.revents = 0;
}
if (source->pfd.revents & (G_IO_ERR | G_IO_HUP))
g_error ("Lost connection to wayland compositor");
}

View File

@@ -50,6 +50,9 @@ struct _GdkWaylandKeymap
struct xkb_keymap *xkb_keymap;
struct xkb_state *xkb_state;
PangoDirection *direction;
gboolean bidi;
};
struct _GdkWaylandKeymapClass
@@ -66,19 +69,36 @@ G_DEFINE_TYPE (GdkWaylandKeymap, _gdk_wayland_keymap, GDK_TYPE_KEYMAP)
static void
gdk_wayland_keymap_finalize (GObject *object)
{
GdkWaylandKeymap *keymap = GDK_WAYLAND_KEYMAP (object);
xkb_keymap_unref (keymap->xkb_keymap);
xkb_state_unref (keymap->xkb_state);
g_free (keymap->direction);
G_OBJECT_CLASS (_gdk_wayland_keymap_parent_class)->finalize (object);
}
static PangoDirection
gdk_wayland_keymap_get_direction (GdkKeymap *keymap)
{
return PANGO_DIRECTION_NEUTRAL;
GdkWaylandKeymap *keymap_wayland = GDK_WAYLAND_KEYMAP (keymap);
gint i;
for (i = 0; i < xkb_keymap_num_layouts (keymap_wayland->xkb_keymap); i++)
{
if (xkb_state_layout_index_is_active (keymap_wayland->xkb_state, i, XKB_STATE_LAYOUT_EFFECTIVE))
return keymap_wayland->direction[i];
}
return PANGO_DIRECTION_NEUTRAL;
}
static gboolean
gdk_wayland_keymap_have_bidi_layouts (GdkKeymap *keymap)
{
return FALSE;
GdkWaylandKeymap *keymap_wayland = GDK_WAYLAND_KEYMAP (keymap);
return keymap_wayland->bidi;
}
static gboolean
@@ -101,14 +121,45 @@ gdk_wayland_keymap_get_entries_for_keyval (GdkKeymap *keymap,
GdkKeymapKey **keys,
gint *n_keys)
{
if (n_keys)
*n_keys = 1;
if (keys)
struct xkb_keymap *xkb_keymap = GDK_WAYLAND_KEYMAP (keymap)->xkb_keymap;
GArray *retval;
guint keycode;
retval = g_array_new (FALSE, FALSE, sizeof (GdkKeymapKey));
for (keycode = 8; keycode < 255; keycode++) /* FIXME: min/max keycode */
{
*keys = g_new0 (GdkKeymapKey, 1);
(*keys)->keycode = keyval;
gint num_layouts, layout;
num_layouts = xkb_keymap_num_layouts_for_key (xkb_keymap, keycode);
for (layout = 0; layout < num_layouts; layout++)
{
gint num_levels, level;
num_levels = xkb_keymap_num_levels_for_key (xkb_keymap, keycode, layout);
for (level = 0; level < num_levels; level++)
{
const xkb_keysym_t *syms;
gint num_syms, sym;
num_syms = xkb_keymap_key_get_syms_by_level (xkb_keymap, keycode, layout, level, &syms);
for (sym = 0; sym < num_syms; sym++)
{
if (syms[sym] == keyval)
{
GdkKeymapKey key;
key.keycode = keycode;
key.group = layout;
key.level = level;
g_array_append_val (retval, key);
}
}
}
}
}
*n_keys = retval->len;
*keys = (GdkKeymapKey*) g_array_free (retval, FALSE);
return TRUE;
}
@@ -119,26 +170,119 @@ gdk_wayland_keymap_get_entries_for_keycode (GdkKeymap *keymap,
guint **keyvals,
gint *n_entries)
{
struct xkb_keymap *xkb_keymap = GDK_WAYLAND_KEYMAP (keymap)->xkb_keymap;
gint num_layouts, layout;
gint num_entries;
gint i;
num_layouts = xkb_keymap_num_layouts_for_key (xkb_keymap, hardware_keycode);
num_entries = 0;
for (layout = 0; layout < num_layouts; layout++)
num_entries += xkb_keymap_num_levels_for_key (xkb_keymap, hardware_keycode, layout);
if (n_entries)
*n_entries = 1;
*n_entries = num_entries;
if (keys)
{
*keys = g_new0 (GdkKeymapKey, 1);
(*keys)->keycode = hardware_keycode;
}
*keys = g_new0 (GdkKeymapKey, num_entries);
if (keyvals)
*keyvals = g_new0 (guint, num_entries);
i = 0;
for (layout = 0; layout < num_layouts; layout++)
{
*keyvals = g_new0 (guint, 1);
(*keyvals)[0] = hardware_keycode;
gint num_levels, level;
num_levels = xkb_keymap_num_levels_for_key (xkb_keymap, hardware_keycode, layout);
for (level = 0; level < num_levels; level++)
{
const xkb_keysym_t *syms;
int num_syms;
num_syms = xkb_keymap_key_get_syms_by_level (xkb_keymap, hardware_keycode, layout, 0, &syms);
if (keys)
{
(*keys)[i].keycode = hardware_keycode;
(*keys)[i].group = layout;
(*keys)[i].level = level;
}
if (keyvals && num_syms > 0)
(*keyvals)[i] = syms[0];
i++;
}
}
return TRUE;
return num_entries > 0;
}
static guint
gdk_wayland_keymap_lookup_key (GdkKeymap *keymap,
const GdkKeymapKey *key)
{
return key->keycode;
struct xkb_keymap *xkb_keymap = GDK_WAYLAND_KEYMAP (keymap)->xkb_keymap;
const xkb_keysym_t *syms;
int num_syms;
num_syms = xkb_keymap_key_get_syms_by_level (xkb_keymap,
key->keycode,
key->group,
key->level,
&syms);
if (num_syms > 0)
return syms[0];
else
return XKB_KEY_NoSymbol;
}
static guint32
get_xkb_modifiers (struct xkb_keymap *xkb_keymap,
GdkModifierType state)
{
guint32 mods = 0;
if (state & GDK_SHIFT_MASK)
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_SHIFT);
if (state & GDK_LOCK_MASK)
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_CAPS);
if (state & GDK_CONTROL_MASK)
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_CTRL);
if (state & GDK_MOD1_MASK)
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_ALT);
if (state & GDK_MOD2_MASK)
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod2");
if (state & GDK_MOD3_MASK)
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod3");
if (state & GDK_MOD4_MASK)
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_LOGO);
if (state & GDK_MOD5_MASK)
mods |= 1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod5");
return mods;
}
static GdkModifierType
get_gdk_modifiers (struct xkb_keymap *xkb_keymap,
guint32 mods)
{
GdkModifierType state = 0;
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_SHIFT)))
state |= GDK_SHIFT_MASK;
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_CAPS)))
state |= GDK_LOCK_MASK;
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_CTRL)))
state |= GDK_CONTROL_MASK;
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_ALT)))
state |= GDK_MOD1_MASK;
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod2")))
state |= GDK_MOD2_MASK;
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod3")))
state |= GDK_MOD3_MASK;
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, XKB_MOD_NAME_LOGO)))
state |= GDK_MOD4_MASK;
if (mods & (1 << xkb_keymap_mod_get_index (xkb_keymap, "Mod5")))
state |= GDK_MOD5_MASK;
return state;
}
static gboolean
@@ -148,24 +292,59 @@ gdk_wayland_keymap_translate_keyboard_state (GdkKeymap *keymap,
gint group,
guint *keyval,
gint *effective_group,
gint *level,
gint *effective_level,
GdkModifierType *consumed_modifiers)
{
struct xkb_keymap *xkb_keymap;
struct xkb_state *xkb_state;
guint32 modifiers;
guint32 consumed;
xkb_layout_index_t layout;
xkb_level_index_t level;
xkb_keysym_t sym;
g_return_val_if_fail (keymap == NULL || GDK_IS_KEYMAP (keymap), FALSE);
g_return_val_if_fail (group < 4, FALSE);
xkb_keymap = GDK_WAYLAND_KEYMAP (keymap)->xkb_keymap;
modifiers = get_xkb_modifiers (xkb_keymap, state);
xkb_state = xkb_state_new (xkb_keymap);
xkb_state_update_mask (xkb_state, modifiers, 0, 0, group, 0, 0);
layout = xkb_state_key_get_layout (xkb_state, hardware_keycode);
level = xkb_state_key_get_level (xkb_state, hardware_keycode, layout);
sym = xkb_state_key_get_one_sym (xkb_state, hardware_keycode);
consumed = modifiers & ~xkb_state_mod_mask_remove_consumed (xkb_state, hardware_keycode, modifiers);
xkb_state_unref (xkb_state);
if (keyval)
*keyval = hardware_keycode;
*keyval = sym;
if (effective_group)
*effective_group = 0;
if (level)
*level = 0;
*effective_group = layout;
if (effective_level)
*effective_level = level;
if (consumed_modifiers)
*consumed_modifiers = 0;
*consumed_modifiers = get_gdk_modifiers (xkb_keymap, consumed);
return TRUE;
}
static guint
gdk_wayland_keymap_get_modifier_state (GdkKeymap *keymap)
{
struct xkb_keymap *xkb_keymap = GDK_WAYLAND_KEYMAP (keymap)->xkb_keymap;
struct xkb_state *xkb_state = GDK_WAYLAND_KEYMAP (keymap)->xkb_state;
xkb_mod_mask_t mods;
mods = xkb_state_serialize_mods (xkb_state, XKB_STATE_MODS_EFFECTIVE);
return get_gdk_modifiers (xkb_keymap, mods);
}
static void
gdk_wayland_keymap_add_virtual_modifiers (GdkKeymap *keymap,
GdkModifierType *state)
@@ -196,6 +375,7 @@ _gdk_wayland_keymap_class_init (GdkWaylandKeymapClass *klass)
keymap_class->get_entries_for_keycode = gdk_wayland_keymap_get_entries_for_keycode;
keymap_class->lookup_key = gdk_wayland_keymap_lookup_key;
keymap_class->translate_keyboard_state = gdk_wayland_keymap_translate_keyboard_state;
keymap_class->get_modifier_state = gdk_wayland_keymap_get_modifier_state;
keymap_class->add_virtual_modifiers = gdk_wayland_keymap_add_virtual_modifiers;
keymap_class->map_virtual_modifiers = gdk_wayland_keymap_map_virtual_modifiers;
}
@@ -205,6 +385,75 @@ _gdk_wayland_keymap_init (GdkWaylandKeymap *keymap)
{
}
static void
update_direction (GdkWaylandKeymap *keymap)
{
gint num_layouts;
gint *rtl;
guint key;
gboolean have_rtl, have_ltr;
gint i;
num_layouts = xkb_keymap_num_layouts (keymap->xkb_keymap);
g_free (keymap->direction);
keymap->direction = g_new0 (PangoDirection, num_layouts);
rtl = g_new0 (gint, num_layouts);
for (key = 8; key < 255; key++) /* FIXME: min/max keycode */
{
gint layouts;
gint layout;
layouts = xkb_keymap_num_layouts_for_key (keymap->xkb_keymap, key);
for (layout = 0; layout < layouts; layout++)
{
const xkb_keysym_t *syms;
gint num_syms;
gint sym;
num_syms = xkb_keymap_key_get_syms_by_level (keymap->xkb_keymap, key, layout, 0, &syms);
for (sym = 0; sym < num_syms; sym++)
{
PangoDirection dir;
dir = pango_unichar_direction (xkb_keysym_to_utf32 (syms[sym]));
switch (dir)
{
case PANGO_DIRECTION_RTL:
rtl[layout]++;
break;
case PANGO_DIRECTION_LTR:
rtl[layout]--;
break;
default:
break;
}
}
}
}
have_rtl = have_ltr = FALSE;
for (i = 0; i < num_layouts; i++)
{
if (rtl[i] > 0)
{
keymap->direction[i] = PANGO_DIRECTION_RTL;
have_rtl = TRUE;
}
else
{
keymap->direction[i] = PANGO_DIRECTION_LTR;
have_ltr = TRUE;
}
}
if (have_rtl && have_ltr)
keymap->bidi = TRUE;
g_free (rtl);
}
GdkKeymap *
_gdk_wayland_keymap_new ()
{
@@ -225,34 +474,41 @@ _gdk_wayland_keymap_new ()
keymap->xkb_state = xkb_state_new (keymap->xkb_keymap);
xkb_context_unref (context);
update_direction (keymap);
return GDK_KEYMAP (keymap);
}
GdkKeymap *
_gdk_wayland_keymap_new_from_fd (uint32_t format,
uint32_t fd, uint32_t size)
void
_gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap,
uint32_t format,
uint32_t fd,
uint32_t size)
{
GdkWaylandKeymap *keymap;
GdkWaylandKeymap *keymap_wayland = GDK_WAYLAND_KEYMAP (keymap);
struct xkb_context *context;
char *map_str;
keymap = g_object_new (_gdk_wayland_keymap_get_type(), NULL);
context = xkb_context_new (0);
map_str = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
if (map_str == MAP_FAILED) {
close(fd);
return NULL;
if (map_str == MAP_FAILED)
{
close(fd);
return;
}
keymap->xkb_keymap = xkb_keymap_new_from_string (context, map_str, format, 0);
xkb_keymap_unref (keymap_wayland->xkb_keymap);
keymap_wayland->xkb_keymap = xkb_keymap_new_from_string (context, map_str, format, 0);
munmap (map_str, size);
close (fd);
keymap->xkb_state = xkb_state_new (keymap->xkb_keymap);
xkb_state_unref (keymap_wayland->xkb_state);
keymap_wayland->xkb_state = xkb_state_new (keymap_wayland->xkb_keymap);
xkb_context_unref (context);
return GDK_KEYMAP (keymap);
update_direction (keymap_wayland);
}
struct xkb_keymap *_gdk_wayland_keymap_get_xkb_keymap (GdkKeymap *keymap)
@@ -264,3 +520,23 @@ struct xkb_state *_gdk_wayland_keymap_get_xkb_state (GdkKeymap *keymap)
{
return GDK_WAYLAND_KEYMAP (keymap)->xkb_state;
}
gboolean
_gdk_wayland_keymap_key_is_modifier (GdkKeymap *keymap,
guint keycode)
{
struct xkb_keymap *xkb_keymap = GDK_WAYLAND_KEYMAP (keymap)->xkb_keymap;
struct xkb_state *xkb_state;
gboolean is_modifier;
is_modifier = FALSE;
xkb_state = xkb_state_new (xkb_keymap);
if (xkb_state_update_key (xkb_state, keycode, XKB_KEY_DOWN) & XKB_STATE_MODS_EFFECTIVE)
is_modifier = TRUE;
xkb_state_unref (xkb_state);
return is_modifier;
}

View File

@@ -40,18 +40,24 @@
#include "config.h"
#define GDK_SCREEN_DISPLAY(screen) (GDK_SCREEN_WAYLAND (screen)->display)
#define GDK_WINDOW_SCREEN(win) (gdk_window_get_screen (win))
#define GDK_WINDOW_DISPLAY(win) (GDK_SCREEN_WAYLAND (GDK_WINDOW_SCREEN (win))->display)
#define GDK_WINDOW_IS_WAYLAND(win) (GDK_IS_WINDOW_IMPL_WAYLAND (((GdkWindow *)win)->impl))
void _gdk_wayland_window_add_focus (GdkWindow *window);
void _gdk_wayland_window_remove_focus (GdkWindow *window);
GdkKeymap *_gdk_wayland_keymap_new (void);
GdkKeymap *_gdk_wayland_keymap_new_from_fd (uint32_t format,
uint32_t fd, uint32_t size);
void _gdk_wayland_keymap_update_from_fd (GdkKeymap *keymap,
uint32_t format,
uint32_t fd,
uint32_t size);
struct xkb_state *_gdk_wayland_keymap_get_xkb_state (GdkKeymap *keymap);
struct xkb_keymap *_gdk_wayland_keymap_get_xkb_keymap (GdkKeymap *keymap);
gboolean _gdk_wayland_keymap_key_is_modifier (GdkKeymap *keymap,
guint keycode);
void _gdk_wayland_display_finalize_cursors (GdkWaylandDisplay *display);
void _gdk_wayland_display_update_cursors (GdkWaylandDisplay *display,
struct wl_cursor_theme *theme);
GdkCursor *_gdk_wayland_display_get_cursor_for_type (GdkDisplay *display,
GdkCursorType cursor_type);
@@ -71,10 +77,14 @@ gboolean _gdk_wayland_display_supports_cursor_alpha (GdkDisplay *display);
gboolean _gdk_wayland_display_supports_cursor_color (GdkDisplay *display);
struct wl_buffer *_gdk_wayland_cursor_get_buffer (GdkCursor *cursor,
int *x,
int *y,
guint image_index,
int *hotspot_x,
int *hotspot_y,
int *w,
int *h);
guint _gdk_wayland_cursor_get_next_image_index (GdkCursor *cursor,
guint current_image_index,
guint *next_image_delay);
GdkDragProtocol _gdk_wayland_window_get_drag_protocol (GdkWindow *window,
GdkWindow **target);
@@ -125,10 +135,16 @@ gchar * _gdk_wayland_display_utf8_to_string_target (GdkDisplay *display,
const gchar *str);
GdkDeviceManager *_gdk_wayland_device_manager_new (GdkDisplay *display);
void _gdk_wayland_device_manager_add_device (GdkDeviceManager *device_manager,
struct wl_seat *seat);
void _gdk_wayland_device_manager_add_seat (GdkDeviceManager *device_manager,
guint32 id,
struct wl_seat *seat);
void _gdk_wayland_device_manager_remove_seat (GdkDeviceManager *device_manager,
guint32 id);
typedef struct _GdkWaylandDeviceData GdkWaylandDeviceData;
GdkKeymap *_gdk_wayland_device_get_keymap (GdkDevice *device);
uint32_t _gdk_wayland_device_get_button_press_serial(GdkWaylandDeviceData *device);
void _gdk_wayland_display_deliver_event (GdkDisplay *display, GdkEvent *event);
GSource *_gdk_wayland_display_event_source_new (GdkDisplay *display);
@@ -137,17 +153,17 @@ void _gdk_wayland_display_queue_events (GdkDisplay *display);
GdkAppLaunchContext *_gdk_wayland_display_get_app_launch_context (GdkDisplay *display);
GdkDisplay *_gdk_wayland_display_open (const gchar *display_name);
void _gdk_wayland_display_make_default (GdkDisplay *display);
GdkWindow *_gdk_wayland_screen_create_root_window (GdkScreen *screen,
int width,
int height);
GdkScreen *_gdk_wayland_screen_new (GdkDisplay *display);
void _gdk_wayland_screen_add_output (GdkScreen *scren,
void _gdk_wayland_screen_add_output (GdkScreen *screen,
guint32 id,
struct wl_output *output);
void _gdk_wayland_screen_remove_output_by_id (GdkScreen *screen,
guint32 id);
void _gdk_wayland_screen_remove_output (GdkScreen *screen,
guint32 id);
void _gdk_wayland_display_manager_add_display (GdkDisplayManager *manager,
GdkDisplay *display);
@@ -162,4 +178,10 @@ void _gdk_wayland_window_set_device_grabbed (GdkWindow *window,
guint32 _gdk_wayland_display_get_serial (GdkWaylandDisplay *wayland_display);
void _gdk_wayland_display_update_serial (GdkWaylandDisplay *wayland_display, guint32 serial);
struct wl_shm_pool * _create_shm_pool (struct wl_shm *shm,
int width,
int height,
size_t *buf_length,
void **data_out);
#endif /* __GDK_PRIVATE_WAYLAND_H__ */

View File

@@ -21,6 +21,7 @@
#include <string.h>
#include <glib.h>
#include <gio/gio.h>
#include "gdkscreenprivate.h"
#include "gdkvisualprivate.h"
#include "gdkdisplay.h"
@@ -38,6 +39,14 @@ typedef struct _GdkWaylandScreenClass GdkWaylandScreenClass;
#define GDK_IS_WAYLAND_SCREEN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WAYLAND_SCREEN))
#define GDK_WAYLAND_SCREEN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WAYLAND_SCREEN, GdkWaylandScreenClass))
typedef struct {
gboolean antialias;
gboolean hinting;
gint dpi;
const gchar *rgba;
const gchar *hintstyle;
} GsdXftSettings;
typedef struct _GdkWaylandMonitor GdkWaylandMonitor;
struct _GdkWaylandScreen
@@ -56,6 +65,9 @@ struct _GdkWaylandScreen
/* Xinerama/RandR 1.2 */
GPtrArray *monitors;
gint primary_monitor;
GHashTable *settings;
GsdXftSettings xft_settings;
};
struct _GdkWaylandScreenClass
@@ -67,6 +79,8 @@ struct _GdkWaylandScreenClass
struct _GdkWaylandMonitor
{
GdkWaylandScreen *screen;
guint32 id;
struct wl_output *output;
GdkRectangle geometry;
int width_mm;
@@ -133,6 +147,8 @@ gdk_wayland_screen_finalize (GObject *object)
deinit_multihead (GDK_SCREEN (object));
g_hash_table_destroy (screen_wayland->settings);
G_OBJECT_CLASS (_gdk_wayland_screen_parent_class)->finalize (object);
}
@@ -274,80 +290,375 @@ gdk_wayland_screen_broadcast_client_message (GdkScreen *screen,
{
}
static void
notify_setting (GdkScreen *screen,
const gchar *setting)
{
GdkEvent event;
event.type = GDK_SETTING;
event.setting.window = gdk_screen_get_root_window (screen);
event.setting.send_event = FALSE;
event.setting.action = GDK_SETTING_ACTION_CHANGED;
event.setting.name = (gchar *)setting;
gdk_event_put (&event);
}
typedef enum
{
GSD_FONT_ANTIALIASING_MODE_NONE,
GSD_FONT_ANTIALIASING_MODE_GRAYSCALE,
GSD_FONT_ANTIALIASING_MODE_RGBA
} GsdFontAntialiasingMode;
typedef enum
{
GSD_FONT_HINTING_NONE,
GSD_FONT_HINTING_SLIGHT,
GSD_FONT_HINTING_MEDIUM,
GSD_FONT_HINTING_FULL
} GsdFontHinting;
typedef enum
{
GSD_FONT_RGBA_ORDER_RGBA,
GSD_FONT_RGBA_ORDER_RGB,
GSD_FONT_RGBA_ORDER_BGR,
GSD_FONT_RGBA_ORDER_VRGB,
GSD_FONT_RGBA_ORDER_VBGR
} GsdFontRgbaOrder;
static gdouble
get_dpi_from_gsettings (GdkWaylandScreen *screen_wayland)
{
GSettings *interface_settings;
gdouble factor;
interface_settings = g_hash_table_lookup (screen_wayland->settings,
"org.gnome.desktop.interface");
if (interface_settings != NULL)
factor = g_settings_get_double (interface_settings, "text-scaling-factor");
else
factor = 1.0;
return 96.0 * factor;
}
static void
update_xft_settings (GdkScreen *screen)
{
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen);
GSettings *settings;
GsdFontAntialiasingMode antialiasing;
GsdFontHinting hinting;
GsdFontRgbaOrder order;
gboolean use_rgba = FALSE;
GsdXftSettings xft_settings;
settings = g_hash_table_lookup (screen_wayland->settings, "org.gnome.settings-daemon.plugins.xsettings");
if (settings)
{
antialiasing = g_settings_get_enum (settings, "antialiasing");
hinting = g_settings_get_enum (settings, "hinting");
order = g_settings_get_enum (settings, "rgba-order");
}
else
{
antialiasing = GSD_FONT_ANTIALIASING_MODE_GRAYSCALE;
hinting = GSD_FONT_HINTING_MEDIUM;
order = GSD_FONT_RGBA_ORDER_RGB;
}
xft_settings.antialias = (antialiasing != GSD_FONT_ANTIALIASING_MODE_NONE);
xft_settings.hinting = (hinting != GSD_FONT_HINTING_NONE);
xft_settings.dpi = get_dpi_from_gsettings (screen_wayland) * 1024; /* Xft wants 1/1024ths of an inch */
xft_settings.rgba = "rgb";
xft_settings.hintstyle = "hintfull";
switch (hinting)
{
case GSD_FONT_HINTING_NONE:
xft_settings.hintstyle = "hintnone";
break;
case GSD_FONT_HINTING_SLIGHT:
xft_settings.hintstyle = "hintslight";
break;
case GSD_FONT_HINTING_MEDIUM:
xft_settings.hintstyle = "hintmedium";
break;
case GSD_FONT_HINTING_FULL:
xft_settings.hintstyle = "hintfull";
break;
}
switch (order)
{
case GSD_FONT_RGBA_ORDER_RGBA:
xft_settings.rgba = "rgba";
break;
case GSD_FONT_RGBA_ORDER_RGB:
xft_settings.rgba = "rgb";
break;
case GSD_FONT_RGBA_ORDER_BGR:
xft_settings.rgba = "bgr";
break;
case GSD_FONT_RGBA_ORDER_VRGB:
xft_settings.rgba = "vrgb";
break;
case GSD_FONT_RGBA_ORDER_VBGR:
xft_settings.rgba = "vbgr";
break;
}
switch (antialiasing)
{
case GSD_FONT_ANTIALIASING_MODE_NONE:
xft_settings.antialias = FALSE;
break;
case GSD_FONT_ANTIALIASING_MODE_GRAYSCALE:
xft_settings.antialias = TRUE;
break;
case GSD_FONT_ANTIALIASING_MODE_RGBA:
xft_settings.antialias = TRUE;
use_rgba = TRUE;
}
if (!use_rgba)
xft_settings.rgba = "none";
if (screen_wayland->xft_settings.antialias != xft_settings.antialias)
{
screen_wayland->xft_settings.antialias = xft_settings.antialias;
notify_setting (screen, "gtk-xft-antialias");
}
if (screen_wayland->xft_settings.hinting != xft_settings.hinting)
{
screen_wayland->xft_settings.hinting = xft_settings.hinting;
notify_setting (screen, "gtk-xft-hinting");
}
if (screen_wayland->xft_settings.hintstyle != xft_settings.hintstyle)
{
screen_wayland->xft_settings.hintstyle = xft_settings.hintstyle;
notify_setting (screen, "gtk-xft-hintstyle");
}
if (screen_wayland->xft_settings.rgba != xft_settings.rgba)
{
screen_wayland->xft_settings.rgba = xft_settings.rgba;
notify_setting (screen, "gtk-xft-rgba");
}
if (screen_wayland->xft_settings.dpi != xft_settings.dpi)
{
screen_wayland->xft_settings.dpi = xft_settings.dpi;
notify_setting (screen, "gtk-xft-dpi");
}
}
typedef struct _TranslationEntry TranslationEntry;
struct _TranslationEntry {
const gchar *schema;
const gchar *key;
const gchar *setting;
GType type;
union {
const gchar *s;
gint i;
gboolean b;
} fallback;
};
static TranslationEntry translations[] = {
{ "org.gnome.desktop.interface", "gtk-theme", "gtk-theme-name" , G_TYPE_STRING, { .s = "Adwaita" } },
{ "org.gnome.desktop.interface", "icon-theme", "gtk-icon-theme-name", G_TYPE_STRING, { .s = "gnome" } },
{ "org.gnome.desktop.interface", "cursor-theme", "gtk-cursor-theme-name", G_TYPE_STRING, { .s = "Adwaita" } },
{ "org.gnome.desktop.interface", "cursor-size", "gtk-cursor-theme-size", G_TYPE_INT, { .i = 32 } },
{ "org.gnome.desktop.interface", "font-name", "gtk-font-name", G_TYPE_STRING, { .s = "Cantarell 11" } },
{ "org.gnome.desktop.interface", "cursor-blink", "gtk-cursor-blink", G_TYPE_BOOLEAN, { .b = TRUE } },
{ "org.gnome.desktop.interface", "cursor-blink-time", "gtk-cursor-blink-time", G_TYPE_INT, { .i = 1200 } },
{ "org.gnome.desktop.interface", "cursor-blink-timeout", "gtk-cursor-blink-timeout", G_TYPE_INT, { .i = 3600 } },
{ "org.gnome.desktop.interface", "menus-have-icons", "gtk-menu-images", G_TYPE_BOOLEAN, { .b = FALSE } },
{ "org.gnome.desktop.interface", "buttons-have-icons", "gtk-button-images", G_TYPE_BOOLEAN, { .b = FALSE } },
{ "org.gnome.desktop.interface", "gtk-im-module", "gtk-im-module", G_TYPE_STRING, { .s = "simple" } },
{ "org.gnome.desktop.interface", "enable-animations", "gtk-enable-animations", G_TYPE_BOOLEAN, { .b = TRUE } },
{ "org.gnome.desktop.interface", "show-input-method-menu", "gtk-show-input-method-menu", G_TYPE_BOOLEAN, { .b = FALSE } },
{ "org.gnome.desktop.interface", "show-unicode-menu", "gtk-show-unicode-menu", G_TYPE_BOOLEAN, { .b = FALSE } },
{ "org.gnome.desktop.interface", "automatic-mnemonics", "gtk-auto-mnemonics", G_TYPE_BOOLEAN, { .b = TRUE } },
{ "org.gnome.desktop.interface", "toolbar-style", "gtk-toolbar-style", G_TYPE_STRING, { .s = "both-horiz"} },
{ "org.gnome.desktop.interface", "toolbar-icons-size", "gtk-toolbar-icon-size", G_TYPE_STRING, { .s = "large"} },
{ "org.gnome.settings-daemon.peripherals.mouse", "double-click", "gtk-double-click-time", G_TYPE_INT, { .i = 250 } },
{ "org.gnome.settings-daemon.peripherals.mouse", "drag-threshold", "gtk-dnd-drag-threshold", G_TYPE_INT, {.i = 8 } },
{ "org.gnome.desktop.sound", "theme-name", "gtk-sound-theme-name", G_TYPE_STRING, { .s = "freedesktop" } },
{ "org.gnome.desktop.sound", "event-sounds", "gtk-enable-event-sounds", G_TYPE_BOOLEAN, { .b = TRUE } },
{ "org.gnome.desktop.sound", "input-feedback-sounds", "gtk-enable-input-feedback-sounds", G_TYPE_BOOLEAN, { . b = FALSE } },
{ "org.gnome.desktop.privacy", "recent-files-max-age", "gtk-recent-files-max-age", G_TYPE_INT, { .i = 30 } },
{ "org.gnome.desktop.privacy", "remember-recent-files", "gtk-recent-files-enabled", G_TYPE_BOOLEAN, { .b = TRUE } },
{ "org.gnome.settings-daemon.plugins.xsettings", "antialiasing", "gtk-xft-antialias", G_TYPE_NONE, { .i = 0 } },
{ "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 0 } },
{ "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 0 } },
{ "org.gnome.settings-daemon.plugins.xsettings", "rgba-order", "gtk-xft-rgba", G_TYPE_NONE, { .i = 0 } },
{ "org.gnome.desktop.interface", "text-scaling-factor", "gtk-xft-dpi" , G_TYPE_NONE, { .i = 0 } },
};
static TranslationEntry *
find_translation_entry_by_key (GSettings *settings, const gchar *key)
{
guint i;
gchar *schema;
g_object_get (settings, "schema", &schema, NULL);
for (i = 0; i < G_N_ELEMENTS (translations); i++)
{
if (g_str_equal (schema, translations[i].schema) &&
g_str_equal (key, translations[i].key))
{
g_free (schema);
return &translations[i];
}
}
g_free (schema);
return NULL;
}
static TranslationEntry *
find_translation_entry_by_setting (const gchar *setting)
{
guint i;
for (i = 0; i < G_N_ELEMENTS (translations); i++)
{
if (g_str_equal (setting, translations[i].setting))
return &translations[i];
}
return NULL;
}
static void
settings_changed (GSettings *settings,
const gchar *key,
GdkScreen *screen)
{
TranslationEntry *entry;
entry = find_translation_entry_by_key (settings, key);
if (entry != NULL)
{
if (entry->type != G_TYPE_NONE)
notify_setting (screen, entry->setting);
else
update_xft_settings (screen);
}
}
static void
init_settings (GdkScreen *screen)
{
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen);
GSettingsSchemaSource *source;
GSettingsSchema *schema;
GSettings *settings;
gint i;
screen_wayland->settings = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref);
source = g_settings_schema_source_get_default ();
for (i = 0; i < G_N_ELEMENTS (translations); i++)
{
if (g_hash_table_lookup (screen_wayland->settings, (gpointer)translations[i].schema) != NULL)
continue;
schema = g_settings_schema_source_lookup (source, translations[i].schema, FALSE);
if (schema != NULL)
{
settings = g_settings_new_full (schema, NULL, NULL);
g_signal_connect (settings, "changed",
G_CALLBACK (settings_changed), screen);
g_hash_table_insert (screen_wayland->settings, (gpointer)translations[i].schema, settings);
g_settings_schema_unref (schema);
}
}
update_xft_settings (screen);
}
static void
set_value_from_entry (GdkScreen *screen,
TranslationEntry *entry,
GValue *value)
{
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen);
GSettings *settings;
settings = (GSettings *)g_hash_table_lookup (screen_wayland->settings, entry->schema);
switch (entry->type)
{
case G_TYPE_STRING:
if (settings)
{
gchar *s;
s = g_settings_get_string (settings, entry->key);
g_value_set_string (value, s);
g_free (s);
}
else
{
g_value_set_static_string (value, entry->fallback.s);
}
break;
case G_TYPE_INT:
g_value_set_int (value, settings != NULL
? g_settings_get_int (settings, entry->key)
: entry->fallback.i);
break;
case G_TYPE_BOOLEAN:
g_value_set_boolean (value, settings != NULL
? g_settings_get_boolean (settings, entry->key)
: entry->fallback.b);
break;
case G_TYPE_NONE:
if (g_str_equal (entry->setting, "gtk-xft-antialias"))
g_value_set_int (value, screen_wayland->xft_settings.antialias);
else if (g_str_equal (entry->setting, "gtk-xft-hinting"))
g_value_set_int (value, screen_wayland->xft_settings.hinting);
else if (g_str_equal (entry->setting, "gtk-xft-hintstyle"))
g_value_set_static_string (value, screen_wayland->xft_settings.hintstyle);
else if (g_str_equal (entry->setting, "gtk-xft-rgba"))
g_value_set_static_string (value, screen_wayland->xft_settings.rgba);
else if (g_str_equal (entry->setting, "gtk-xft-dpi"))
g_value_set_int (value, screen_wayland->xft_settings.dpi);
else
g_assert_not_reached ();
break;
default:
g_assert_not_reached ();
}
}
static gboolean
gdk_wayland_screen_get_setting (GdkScreen *screen,
const gchar *name,
GValue *value)
{
TranslationEntry *entry;
g_return_val_if_fail (GDK_IS_SCREEN (screen), FALSE);
if (strcmp ("gtk-theme-name", name) == 0)
entry = find_translation_entry_by_setting (name);
if (entry != NULL)
{
const gchar *s = "Adwaita";
GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : %s\n", name, s));
g_value_set_static_string (value, s);
set_value_from_entry (screen, entry, value);
return TRUE;
}
if (strcmp ("gtk-cursor-theme-name", name) == 0)
{
const gchar *s = "Adwaita";
GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : %s\n", name, s));
g_value_set_static_string (value, s);
return TRUE;
}
else if (strcmp ("gtk-icon-theme-name", name) == 0)
{
const gchar *s = "gnome";
GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : %s\n", name, s));
g_value_set_static_string (value, s);
return TRUE;
}
else if (strcmp ("gtk-double-click-time", name) == 0)
{
gint i = 250;
GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : %d\n", name, i));
g_value_set_int (value, i);
return TRUE;
}
else if (strcmp ("gtk-double-click-distance", name) == 0)
{
gint i = 5;
GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : %d\n", name, i));
g_value_set_int (value, i);
return TRUE;
}
else if (strcmp ("gtk-dnd-drag-threshold", name) == 0)
{
gint i = 8;
GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : %d\n", name, i));
g_value_set_int (value, i);
return TRUE;
}
else if (strcmp ("gtk-split-cursor", name) == 0)
{
GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : FALSE\n", name));
g_value_set_boolean (value, FALSE);
return TRUE;
}
else if (strcmp ("gtk-alternative-button-order", name) == 0)
{
GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : TRUE\n", name));
g_value_set_boolean (value, TRUE);
return TRUE;
}
else if (strcmp ("gtk-alternative-sort-arrows", name) == 0)
{
GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : TRUE\n", name));
g_value_set_boolean (value, TRUE);
return TRUE;
}
else if (strcmp ("gtk-xft-dpi", name) == 0)
{
gint i = 96*1024;
GDK_NOTE(MISC, g_print("gdk_screen_get_setting(\"%s\") : TRUE\n", name));
g_value_set_int (value, i);
return TRUE;
}
}
return FALSE;
}
@@ -479,8 +790,8 @@ _gdk_wayland_screen_new (GdkDisplay *display)
screen_wayland = GDK_WAYLAND_SCREEN (screen);
screen_wayland->display = display;
screen_wayland->width = 8192;
screen_wayland->height = 8192;
screen_wayland->width = 0;
screen_wayland->height = 0;
screen_wayland->visual = gdk_wayland_visual_new (screen);
@@ -490,6 +801,7 @@ _gdk_wayland_screen_new (GdkDisplay *display)
screen_wayland->height);
init_multihead (screen);
init_settings (screen);
return screen;
}
@@ -541,6 +853,30 @@ _gdk_wayland_screen_init (GdkWaylandScreen *screen_wayland)
{
}
static void
update_screen_size (GdkWaylandScreen *screen_wayland)
{
gint width, height;
gint i;
width = height = 0;
for (i = 0; i < screen_wayland->monitors->len; i++)
{
GdkWaylandMonitor *monitor = screen_wayland->monitors->pdata[i];
width = MAX (width, monitor->geometry.x + monitor->geometry.width);
height = MAX (height, monitor->geometry.y + monitor->geometry.height);
}
if (screen_wayland->width != width ||
screen_wayland->height != height)
{
screen_wayland->width = width;
screen_wayland->height = width;
g_signal_emit_by_name (screen_wayland, "size-changed");
}
}
static void
output_handle_geometry(void *data,
struct wl_output *wl_output,
@@ -558,6 +894,12 @@ output_handle_geometry(void *data,
monitor->manufacturer = g_strdup (make);
monitor->output_name = g_strdup (model);
if (monitor->geometry.width != 0)
{
g_signal_emit_by_name (monitor->screen, "monitors-changed");
update_screen_size (monitor->screen);
}
}
static void
@@ -575,6 +917,9 @@ output_handle_mode(void *data,
monitor->geometry.width = width;
monitor->geometry.height = height;
g_signal_emit_by_name (monitor->screen, "monitors-changed");
update_screen_size (monitor->screen);
}
static const struct wl_output_listener output_listener =
@@ -584,21 +929,24 @@ static const struct wl_output_listener output_listener =
};
void
_gdk_wayland_screen_add_output (GdkScreen *screen,
_gdk_wayland_screen_add_output (GdkScreen *screen,
guint32 id,
struct wl_output *output)
{
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen);
GdkWaylandMonitor *monitor = g_new0(GdkWaylandMonitor, 1);
monitor->id = id;
monitor->output = output;
monitor->screen = screen_wayland;
g_ptr_array_add(screen_wayland->monitors, monitor);
wl_output_add_listener(output, &output_listener, monitor);
}
void
_gdk_wayland_screen_remove_output_by_id (GdkScreen *screen,
guint32 id)
_gdk_wayland_screen_remove_output (GdkScreen *screen,
guint32 id)
{
GdkWaylandScreen *screen_wayland = GDK_WAYLAND_SCREEN (screen);
int i;
@@ -607,9 +955,12 @@ _gdk_wayland_screen_remove_output_by_id (GdkScreen *screen,
{
GdkWaylandMonitor *monitor = screen_wayland->monitors->pdata[i];
if (wl_proxy_get_id ((struct wl_proxy *)monitor->output) == id)
if (monitor->id == id)
{
g_ptr_array_remove (screen_wayland->monitors, monitor);
g_signal_emit_by_name (screen_wayland, "monitors-changed");
update_screen_size (screen_wayland);
break;
}
}

View File

@@ -31,52 +31,10 @@
#include <gdk/wayland/gdkwaylanddevice.h>
#include <gdk/wayland/gdkwaylanddisplay.h>
#include <gdk/wayland/gdkwaylanddisplaymanager.h>
#include <gdk/wayland/gdkwaylandselection.h>
#include <gdk/wayland/gdkwaylandwindow.h>
G_BEGIN_DECLS
typedef struct _GdkWaylandDisplayManager GdkWaylandDisplayManager;
typedef struct _GdkWaylandDisplayManagerClass GdkWaylandDisplayManagerClass;
#define GDK_TYPE_WAYLAND_DISPLAY_MANAGER (gdk_wayland_display_manager_get_type())
#define GDK_WAYLAND_DISPLAY_MANAGER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_DISPLAY_MANAGER, GdkWaylandDisplayManager))
#define GDK_WAYLAND_DISPLAY_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WAYLAND_DISPLAY_MANAGER, GdkWaylandDisplayManagerClass))
#define GDK_IS_WAYLAND_DISPLAY_MANAGER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_DISPLAY_MANAGER))
#define GDK_IS_WAYLAND_DISPLAY_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WAYLAND_DISPLAY_MANAGER))
#define GDK_WAYLAND_DISPLAY_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WAYLAND_DISPLAY_MANAGER, GdkWaylandDisplayManagerClass))
GType gdk_wayland_display_manager_get_type (void);
#if defined (GTK_COMPILATION) || defined (GDK_COMPILATION)
#define gdk_wayland_device_get_selection_type_atoms gdk_wayland_device_get_selection_type_atoms_libgtk_only
int
gdk_wayland_device_get_selection_type_atoms (GdkDevice *device,
GdkAtom **atoms_out);
typedef void (*GdkDeviceWaylandRequestContentCallback) (GdkDevice *device, const gchar *data, gsize len, gpointer userdata);
#define gdk_wayland_device_request_selection_content gdk_wayland_device_request_selection_content_libgtk_only
gboolean
gdk_wayland_device_request_selection_content (GdkDevice *device,
const gchar *requested_mime_type,
GdkDeviceWaylandRequestContentCallback cb,
gpointer userdata);
typedef gchar *(*GdkDeviceWaylandOfferContentCallback) (GdkDevice *device, const gchar *mime_type, gssize *len, gpointer userdata);
#define gdk_wayland_device_offer_selection_content gdk_wayland_device_offer_selection_content_libgtk_only
gboolean
gdk_wayland_device_offer_selection_content (GdkDevice *gdk_device,
const gchar **mime_types,
gint nr_mime_types,
GdkDeviceWaylandOfferContentCallback cb,
gpointer userdata);
#define gdk_wayland_device_clear_selection_content gdk_wayland_device_clear_selection_content_libgtk_only
gboolean
gdk_wayland_device_clear_selection_content (GdkDevice *gdk_device);
#endif
G_END_DECLS
#undef __GDKWAYLAND_H_INSIDE__
#endif /* __GDK_WAYLAND_H__ */

View File

@@ -47,6 +47,9 @@ GType gdk_wayland_display_get_type (void);
struct wl_display *gdk_wayland_display_get_wl_display (GdkDisplay *display);
struct wl_compositor *gdk_wayland_display_get_wl_compositor (GdkDisplay *display);
struct wl_shell *gdk_wayland_display_get_wl_shell (GdkDisplay *display);
void gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
const gchar *theme,
gint size);
G_END_DECLS

View File

@@ -0,0 +1,50 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_WAYLAND_DISPLAY_MANAGER_H__
#define __GDK_WAYLAND_DISPLAY_MANAGER_H__
#if !defined (__GDKWAYLAND_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkwayland.h> can be included directly."
#endif
#include <gdk/gdk.h>
G_BEGIN_DECLS
typedef struct _GdkWaylandDisplayManager GdkWaylandDisplayManager;
typedef struct _GdkWaylandDisplayManagerClass GdkWaylandDisplayManagerClass;
#define GDK_TYPE_WAYLAND_DISPLAY_MANAGER (gdk_wayland_display_manager_get_type())
#define GDK_WAYLAND_DISPLAY_MANAGER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_DISPLAY_MANAGER, GdkWaylandDisplayManager))
#define GDK_WAYLAND_DISPLAY_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_WAYLAND_DISPLAY_MANAGER, GdkWaylandDisplayManagerClass))
#define GDK_IS_WAYLAND_DISPLAY_MANAGER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_WAYLAND_DISPLAY_MANAGER))
#define GDK_IS_WAYLAND_DISPLAY_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_WAYLAND_DISPLAY_MANAGER))
#define GDK_WAYLAND_DISPLAY_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_WAYLAND_DISPLAY_MANAGER, GdkWaylandDisplayManagerClass))
GType gdk_wayland_display_manager_get_type (void);
G_END_DECLS
#endif /* __GDK_WAYLAND_DISPLAY_MANAGER_H__ */

View File

@@ -0,0 +1,69 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#ifndef __GDK_WAYLAND_SELECTION_H__
#define __GDK_WAYLAND_SELECTION_H__
#if !defined (__GDKWAYLAND_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkwayland.h> can be included directly."
#endif
#include <gdk/gdk.h>
G_BEGIN_DECLS
#if defined (GTK_COMPILATION) || defined (GDK_COMPILATION)
#define gdk_wayland_device_get_selection_type_atoms gdk_wayland_device_get_selection_type_atoms_libgtk_only
int
gdk_wayland_device_get_selection_type_atoms (GdkDevice *device,
GdkAtom **atoms_out);
typedef void (*GdkDeviceWaylandRequestContentCallback) (GdkDevice *device, const gchar *data, gsize len, gpointer userdata);
#define gdk_wayland_device_request_selection_content gdk_wayland_device_request_selection_content_libgtk_only
gboolean
gdk_wayland_device_request_selection_content (GdkDevice *device,
const gchar *requested_mime_type,
GdkDeviceWaylandRequestContentCallback cb,
gpointer userdata);
typedef gchar *(*GdkDeviceWaylandOfferContentCallback) (GdkDevice *device, const gchar *mime_type, gssize *len, gpointer userdata);
#define gdk_wayland_device_offer_selection_content gdk_wayland_device_offer_selection_content_libgtk_only
gboolean
gdk_wayland_device_offer_selection_content (GdkDevice *gdk_device,
const gchar **mime_types,
gint nr_mime_types,
GdkDeviceWaylandOfferContentCallback cb,
gpointer userdata);
#define gdk_wayland_device_clear_selection_content gdk_wayland_device_clear_selection_content_libgtk_only
gboolean
gdk_wayland_device_clear_selection_content (GdkDevice *gdk_device);
#endif
G_END_DECLS
#endif /* __GDK_WAYLAND_SELECTION_H__ */

View File

@@ -47,6 +47,8 @@ GType gdk_wayland_window_get_type (void);
struct wl_surface *gdk_wayland_window_get_wl_surface (GdkWindow *window);
struct wl_shell_surface *gdk_wayland_window_get_wl_shell_surface (GdkWindow *window);
void gdk_wayland_window_set_use_custom_surface (GdkWindow *window);
G_END_DECLS
#endif /* __GDK_WAYLAND_WINDOW_H__ */

View File

@@ -95,8 +95,6 @@ struct _GdkWindowImplWayland
GdkCursor *cursor;
gint8 toplevel_window_type;
struct wl_surface *surface;
struct wl_shell_surface *shell_surface;
unsigned int mapped : 1;
@@ -140,6 +138,8 @@ struct _GdkWindowImplWayland
{
int width, height;
} saved_fullscreen, saved_maximized;
gboolean use_custom_surface;
};
struct _GdkWindowImplWaylandClass
@@ -152,7 +152,6 @@ G_DEFINE_TYPE (GdkWindowImplWayland, _gdk_window_impl_wayland, GDK_TYPE_WINDOW_I
static void
_gdk_window_impl_wayland_init (GdkWindowImplWayland *impl)
{
impl->toplevel_window_type = -1;
}
void
@@ -387,7 +386,7 @@ gdk_wayland_cairo_surface_destroy (void *p)
}
static struct wl_shm_pool *
struct wl_shm_pool *
_create_shm_pool (struct wl_shm *shm,
int width,
int height,
@@ -561,17 +560,15 @@ gdk_wayland_window_map (GdkWindow *window)
{
GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
GdkWindowImplWayland *parent;
GdkWaylandDisplay *wayland_display =
GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
GdkWindow *transient_for;
if (!impl->mapped)
if (!impl->mapped && !impl->use_custom_surface)
{
/* Popup menus can appear without a transient parent, which means they
* cannot be positioned properly on Wayland. This attempts to guess the
* surface they should be positioned with by finding the surface beneath
* the device that created the grab for the popup window */
* the device that created the grab for the popup window
*/
if (!impl->transient_for && impl->hint == GDK_WINDOW_TYPE_HINT_POPUP_MENU)
{
transient_for = gdk_device_get_window_at_position (impl->grab_device, NULL, NULL);
@@ -589,6 +586,7 @@ gdk_wayland_window_map (GdkWindow *window)
{
struct wl_seat *grab_input_seat = NULL;
GdkWindowImplWayland *tmp_impl;
GdkWaylandDeviceData *device;
parent = GDK_WINDOW_IMPL_WAYLAND (transient_for->impl);
@@ -614,10 +612,10 @@ gdk_wayland_window_map (GdkWindow *window)
impl->hint == GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU ||
impl->hint == GDK_WINDOW_TYPE_HINT_COMBO))
{
device = wl_seat_get_user_data(grab_input_seat);
wl_shell_surface_set_popup (impl->shell_surface,
grab_input_seat,
_gdk_wayland_display_get_serial (wayland_display),
_gdk_wayland_device_get_button_press_serial(device),
parent->surface,
window->x, window->y, 0);
}
@@ -710,15 +708,23 @@ gdk_wayland_window_show (GdkWindow *window, gboolean already_mapped)
XSERVER_TIME_IS_LATER (display_wayland->user_time, impl->user_time))
gdk_wayland_window_set_user_time (window, impl->user_time);
impl->surface = wl_compositor_create_surface(display_wayland->compositor);
wl_surface_set_user_data(impl->surface, window);
if (!impl->surface)
{
impl->surface = wl_compositor_create_surface(display_wayland->compositor);
wl_surface_set_user_data(impl->surface, window);
}
impl->shell_surface = wl_shell_get_shell_surface (display_wayland->shell,
impl->surface);
wl_shell_surface_add_listener(impl->shell_surface,
&shell_surface_listener, window);
if (!impl->shell_surface &&
!impl->use_custom_surface &&
display_wayland->shell)
{
impl->shell_surface = wl_shell_get_shell_surface (display_wayland->shell,
impl->surface);
wl_shell_surface_add_listener(impl->shell_surface,
&shell_surface_listener, window);
}
gdk_window_set_type_hint (window, impl->hint);
gdk_window_set_type_hint (window, impl->hint);
_gdk_make_event (window, GDK_MAP, NULL, FALSE);
event = _gdk_make_event (window, GDK_VISIBILITY_NOTIFY, NULL, FALSE);
@@ -740,10 +746,17 @@ gdk_wayland_window_hide (GdkWindow *window)
{
if (impl->shell_surface)
wl_shell_surface_destroy(impl->shell_surface);
if (impl->surface)
wl_surface_destroy(impl->surface);
if (impl->use_custom_surface)
{
wl_surface_attach (impl->surface, NULL, 0, 0);
wl_surface_commit (impl->surface);
}
else if (impl->surface)
{
wl_surface_destroy(impl->surface);
impl->surface = NULL;
}
impl->shell_surface = NULL;
impl->surface = NULL;
cairo_surface_destroy(impl->server_surface);
impl->server_surface = NULL;
impl->mapped = FALSE;
@@ -769,10 +782,17 @@ gdk_window_wayland_withdraw (GdkWindow *window)
{
if (impl->shell_surface)
wl_shell_surface_destroy(impl->shell_surface);
if (impl->surface)
wl_surface_destroy(impl->surface);
if (impl->use_custom_surface)
{
wl_surface_attach (impl->surface, NULL, 0, 0);
wl_surface_commit (impl->surface);
}
else if (impl->surface)
{
wl_surface_destroy(impl->surface);
impl->surface = NULL;
}
impl->shell_surface = NULL;
impl->surface = NULL;
cairo_surface_destroy(impl->server_surface);
impl->server_surface = NULL;
impl->mapped = FALSE;
@@ -989,15 +1009,6 @@ gdk_wayland_window_queue_antiexpose (GdkWindow *window,
return FALSE;
}
static void
gdk_wayland_window_translate (GdkWindow *window,
cairo_region_t *area,
gint dx,
gint dy)
{
_gdk_window_invalidate_for_expose (window, area);
}
static void
gdk_wayland_window_destroy (GdkWindow *window,
gboolean recursing,
@@ -1364,8 +1375,12 @@ gdk_wayland_window_fullscreen (GdkWindow *window)
if (impl->fullscreen)
return;
if (!impl->shell_surface)
return;
impl->saved_fullscreen.width = gdk_window_get_width (window);
impl->saved_fullscreen.height = gdk_window_get_height (window);
wl_shell_surface_set_fullscreen (impl->shell_surface,
WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT,
0,
@@ -1387,6 +1402,9 @@ gdk_wayland_window_unfullscreen (GdkWindow *window)
if (!impl->fullscreen)
return;
if (!impl->shell_surface)
return;
wl_shell_surface_set_toplevel (impl->shell_surface);
gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FULLSCREEN, 0);
gdk_wayland_window_configure (window,
@@ -1515,6 +1533,9 @@ gdk_wayland_window_begin_resize_drag (GdkWindow *window,
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (!impl->shell_surface)
return;
wl_shell_surface_resize (impl->shell_surface,
gdk_wayland_device_get_wl_seat (device),
_gdk_wayland_display_get_serial (wayland_display),
@@ -1544,6 +1565,9 @@ gdk_wayland_window_begin_move_drag (GdkWindow *window,
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (!impl->shell_surface)
return;
wl_shell_surface_move (impl->shell_surface,
gdk_wayland_device_get_wl_seat (device),
_gdk_wayland_display_get_serial (wayland_display));
@@ -1693,7 +1717,6 @@ _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
impl_class->input_shape_combine_region = gdk_window_wayland_input_shape_combine_region;
impl_class->set_static_gravities = gdk_window_wayland_set_static_gravities;
impl_class->queue_antiexpose = gdk_wayland_window_queue_antiexpose;
impl_class->translate = gdk_wayland_window_translate;
impl_class->destroy = gdk_wayland_window_destroy;
impl_class->destroy_foreign = gdk_window_wayland_destroy_foreign;
impl_class->resize_cairo_surface = gdk_window_wayland_resize_cairo_surface;
@@ -1813,3 +1836,69 @@ gdk_wayland_window_get_wl_shell_surface (GdkWindow *window)
return impl->shell_surface;
}
/**
* gdk_wayland_window_set_use_custom_surface:
* @window: (type GdkWaylandWindow): a #GdkWindow
*
* Marks a #GdkWindow as a custom Wayland surface. The application is
* expected to register the surface as some type of surface using
* some Wayland interface.
*
* Agood example would be writing a panel or on-screen-keyboard as an
* out-of-process helper - as opposed to having those in the compositor
* process. In this case the underlying surface isn't a wl_shell
* surface and the panel or OSK client need to identify the wl_surface
* as a panel or OSK to the compositor. The assumption is that the
* compositor will expose a private interface to the special client
* that lets the client identify the wl_surface as a panel or such.
*
* This function should be called before a #GdkWindow is shown. This is
* best done by connecting to the #GtkWidget::realized signal:
*
* <informalexample>
* <programlisting>
* static void
* widget_realize_cb (GtkWidget *widget)
* {
* GdkWindow *window;
* struct wl_surface *surface;
* struct input_panel_surface *ip_surface;
*
* window = gtk_widget_get_window (widget);
* gdk_wayland_window_set_custom_surface (window);
*
* surface = gdk_wayland_window_get_wl_surface (window);
* ip_surface = input_panel_get_input_panel_surface (input_panel, surface);
* input_panel_surface_set_panel (ip_surface);
* }
*
* static void
* setup_window (GtkWindow *window)
* {
* g_signal_connect (window, "realize", G_CALLBACK (widget_realize_cb), NULL);
* }
* </programlisting>
* </informalexample>
*
* Since: 3.10
*/
void
gdk_wayland_window_set_use_custom_surface (GdkWindow *window)
{
GdkWindowImplWayland *impl;
GdkWaylandDisplay *display;
g_return_if_fail (GDK_IS_WAYLAND_WINDOW (window));
impl = GDK_WINDOW_IMPL_WAYLAND (window->impl);
if (!impl->surface)
{
display = GDK_WAYLAND_DISPLAY (gdk_window_get_display (window));
impl->surface = wl_compositor_create_surface (display->compositor);
wl_surface_set_user_data (impl->surface, window);
}
impl->use_custom_surface = TRUE;
}

View File

@@ -215,8 +215,7 @@ _gdk_win32_display_open (const gchar *display_name)
/* Precalculate display name */
(void) gdk_display_get_name (_gdk_display);
g_signal_emit_by_name (gdk_display_manager_get (),
"display_opened", _gdk_display);
g_signal_emit_by_name (_gdk_display, "opened");
GDK_NOTE (MISC, g_print ("... _gdk_display now set up\n"));
@@ -299,24 +298,6 @@ gdk_win32_display_get_name (GdkDisplay *display)
return display_name_cache;
}
static gint
gdk_win32_display_get_n_screens (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
return 1;
}
static GdkScreen *
gdk_win32_display_get_screen (GdkDisplay *display,
gint screen_num)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
g_return_val_if_fail (screen_num == 0, NULL);
return _gdk_screen;
}
static GdkScreen *
gdk_win32_display_get_default_screen (GdkDisplay *display)
{
@@ -663,8 +644,6 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
display_class->window_type = GDK_TYPE_WIN32_WINDOW;
display_class->get_name = gdk_win32_display_get_name;
display_class->get_n_screens = gdk_win32_display_get_n_screens;
display_class->get_screen = gdk_win32_display_get_screen;
display_class->get_default_screen = gdk_win32_display_get_default_screen;
display_class->beep = gdk_win32_display_beep;
display_class->sync = gdk_win32_display_sync;

View File

@@ -38,48 +38,6 @@ struct _GdkWin32DisplayManagerClass
G_DEFINE_TYPE (GdkWin32DisplayManager, gdk_win32_display_manager, GDK_TYPE_DISPLAY_MANAGER)
static GdkDisplay *
gdk_win32_display_manager_open_display (GdkDisplayManager *manager,
const gchar *name)
{
return _gdk_win32_display_open (name);
}
static GSList *
gdk_win32_display_manager_list_displays (GdkDisplayManager *manager)
{
return g_slist_append (NULL, gdk_display_get_default ());
}
static GdkDisplay *
gdk_win32_display_manager_get_default_display (GdkDisplayManager *manager)
{
return _gdk_win32_display_open (NULL);
}
static void
gdk_win32_display_manager_set_default_display (GdkDisplayManager *manager,
GdkDisplay *display)
{
g_assert (gdk_display_get_default () == display);
}
#include "../gdkkeynames.c"
static gchar *
gdk_win32_display_manager_get_keyval_name (GdkDisplayManager *manager,
guint keyval)
{
return _gdk_keyval_name (keyval);
}
static guint
gdk_win32_display_manager_lookup_keyval (GdkDisplayManager *manager,
const gchar *name)
{
return _gdk_keyval_from_name (name);
}
static void
gdk_win32_display_manager_init (GdkWin32DisplayManager *manager)
{
@@ -104,16 +62,11 @@ static void
gdk_win32_display_manager_class_init (GdkWin32DisplayManagerClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GdkDisplayManagerClass *manager_class = GDK_DISPLAY_MANAGER_CLASS (class);
object_class->finalize = gdk_win32_display_manager_finalize;
manager_class->open_display = gdk_win32_display_manager_open_display;
manager_class->list_displays = gdk_win32_display_manager_list_displays;
manager_class->set_default_display = gdk_win32_display_manager_set_default_display;
manager_class->get_default_display = gdk_win32_display_manager_get_default_display;
#if 0
manager_class->atom_intern = _gdk_win32_display_manager_atom_intern;
manager_class->get_atom_name = _gdk_win32_display_manager_get_atom_name;
manager_class->lookup_keyval = gdk_win32_display_manager_lookup_keyval;
manager_class->get_keyval_name = gdk_win32_display_manager_get_keyval_name;
#endif
}

View File

@@ -150,6 +150,7 @@ _gdk_win32_window_change_property (GdkWindow *window,
guchar *ucptr;
wchar_t *wcptr, *p;
glong wclen;
GError *err = NULL;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
@@ -193,7 +194,13 @@ _gdk_win32_window_change_property (GdkWindow *window,
return;
}
wcptr = g_utf8_to_utf16 ((char *) data, nelements, NULL, &wclen, NULL);
wcptr = g_utf8_to_utf16 ((char *) data, nelements, NULL, &wclen, &err);
if (err != NULL)
{
g_warning ("Failed to convert utf8: %s", err->message);
g_clear_error (&err);
return;
}
wclen++; /* Terminating 0 */
size = wclen * 2;

Some files were not shown because too many files have changed in this diff Show More