Commit Graph

272 Commits

Author SHA1 Message Date
Alexander Larsson
590366f0e7 wayland: Don't use double buffers for wayland when not needed
If we got the release event for the last buffer then we're
fine with writing directly to the window surface, as wayland
will not be looing at it. This saves us from allocating
and copying more data.
2013-05-07 16:33:01 +02:00
Alexander Larsson
19560bf0d4 gdkwindow: Remove translate vfunc
This is not used anymore
2013-05-07 16:33:00 +02:00
Matthias Clasen
8af16c5d44 New visibility handling in gdk
Change the visibility handling to be the same way we do it in
GLib now. We pass -fvisibility=hidden to gcc and decorate public
functions with __attribute__((visibility("default"))).

This commit just does this for GDK, GTK+ will follow later.
2013-05-05 15:38:48 -04:00
Matthias Clasen
ca81028901 Add GDK_AVAILABLE_IN_ALL annotations in gdk
This is in preparation to modernizing our handing
of exported symbols.
2013-05-05 15:38:46 -04:00
Matthias Clasen
e61df371c9 Prevent criticals when initializing a Wayland display
When we call _gdk_wayland_display_load_cursor_theme during
the initial opening of the first display, gdk_setting_get does
not work yet, since it relies on the default display/screen
being set, which only happens after open returns.
Instead, just use the screen of this display.
2013-05-04 16:13:09 -04:00
Benjamin Otte
7470a280da wayland: Remove displaymanager implementation
This is an API break, but the wayland backend is unsupported, so we can
get away with it.
2013-05-02 16:14:59 +02:00
Benjamin Otte
a30b84f522 wayland: Don't add/remove displays manually
This code is handled by GdkDisplay itself these days.
2013-05-01 18:12:38 +02:00
Owen W. Taylor
b72cf9129c wayland: when possible, fill in actual and predicted presentation times
There is currently no Wayland protocol for providing presentation
timestamps or hints about when drawing will be presented onscreen.
However, by assuming the straightforward algorithm used by the
DRM backend to Weston, we can reverse engineer the right values.

https://bugzilla.gnome.org/show_bug.cgi?id=698864
2013-04-25 13:55:03 -04:00
Owen W. Taylor
23031defde wayland: fill in refresh_interval in GdkFrameTimings
Track the outputs that a window is on, and use the refresh rate from
a random one of those outputs for the refresh_interval in
GdkFrameTimings.

https://bugzilla.gnome.org/show_bug.cgi?id=698864
2013-04-25 13:50:01 -04:00
Owen W. Taylor
f1ce727b06 GdkWaylandWindow: Consolidate surface creation and destruction code
Combine duplicate code for creating and destroying surfaces.
To make the operation of the destroy() operation more obvious, the
destruction of the (fake) root window at display dispose time is
changed to not be a "foreign" destroy.

https://bugzilla.gnome.org/show_bug.cgi?id=698864
2013-04-25 13:49:47 -04:00
Owen W. Taylor
ca120a98e5 GdkWaylandWindow: synchronize frame drawing
Use wl_surface_frame() to get notification when the compositor paints
a frame, and use this to throttle drawing to the compositor's refresh
cycle.

https://bugzilla.gnome.org/show_bug.cgi?id=698864
2013-04-25 13:45:21 -04:00
Owen W. Taylor
c71fea568f GdkWindowWayland: make sure we attach the surface when repainting
Lazily creating the cairo surface that backs a window when we
first paint to it means that the call to
gdk_wayland_window_attach_image() in
gdk_wayland_window_process_updates_recurse() wasn't working the
first time a window was painted.

https://bugzilla.gnome.org/show_bug.cgi?id=698864
2013-04-25 13:45:12 -04:00
Owen W. Taylor
d5310f9367 GdkWindowWayland: draw, then damage, then commit
When exposing an area, we were individually damaging and committing
each rectangle, *before* drawing. Surprisingly, this almost worked.
Order things right and only commit once.

https://bugzilla.gnome.org/show_bug.cgi?id=698864
2013-04-25 13:45:06 -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
f345051d36 displaymanager: Emit display-opened directly
Instead of letting every backend do it manually.
2013-04-19 16:18:25 -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
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
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
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
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
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
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
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
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
Matthias Clasen
96982347b3 wayland: Clean up gdkwayland.h
Make this an include-only header
2013-04-08 22:32:50 -04:00
Matthias Clasen
6629e839d0 wayland: Implement gdk_keymap_get_modifier_state 2013-04-06 21:16:38 -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
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
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
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
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
Benjamin Otte
a6b29d73d7 gdkdisplay: Remove get_screen() and get_n_screens() vfuncs 2013-04-02 11:45:44 +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
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
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
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