Commit Graph

769 Commits

Author SHA1 Message Date
Matthias Clasen
9026289381 wayland: Port to new monitor api 2016-04-27 23:18:16 -04:00
Daniel Stone
210a747ff0 wayland: Ignore NoSymbol keys
NoSymbol is not a valid GDK symbol (it only has the concept of
VoidSymbol, for some reason, which is neither the same thing nor
produced by any sane keymap). Passing NoSymbol events through to GTK+
apps is unlikely to produce anything useful.

In particular, this meant VTE would scroll to the end of the buffer when
pressing Fn (required for Page Up/Down on Macs), as it was receiving a
keypress that wasn't a modifeir. This does not happen on X11, as the
KEY_FN keycode is above 255, so does not get sent to clients.

https://bugzilla.gnome.org/show_bug.cgi?id=764825
2016-04-27 14:00:30 +01:00
Carlos Garnacho
14967d8d7d wayland: Perform seat grab focus checks on native windows
We don't care about the specific (possibly client-side) window that
requested the focus here, only the toplevel. Fixes mistakenly sent
focus events when the grab happens inside the current focus window.

https://bugzilla.gnome.org/show_bug.cgi?id=762756
2016-04-27 13:29:19 +02:00
Jonas Ådahl
1a4f000f3b gdk/dnd: Don't use default display when getting cursor
Always associate a drag context with a GdkDisplay and use that when
getting a cursor for a given action.

If we don't do this, dragging on a window that doesn't use the default
display will make us use cursors from the wrong display.

https://bugzilla.gnome.org/show_bug.cgi?id=765565
2016-04-26 23:03:24 +08:00
Jonas Ådahl
145b626c2f wayland: Track orphaned dialogs per display
Don't track all orphaned dialogs globally, as mixing them up with each
other would in most cases trigger errors when we try to pass bogus
values to Wayland requests.

https://bugzilla.gnome.org/show_bug.cgi?id=765474
2016-04-26 08:38:18 -04:00
Jonas Ådahl
cb73becfb4 wayland: Clean up naming of GdkWaylandDisplay pointers
The naming of pointers to GdkWaylandDisplay's were inconsistent.
Running the following commands in gtk+/gdk/wayland illustrate the
inconsistency:

$ grep -r '\<display_wayland\>' *.[ch] | wc -l
195
$ grep -r '\<wayland_display\>' *.[ch] | wc -l
81

This patch renames all occurrences of "wayland_display" to
"display_wayland". This is also consistent with naming in the X11
backend. A couple of whitespace changes were done as well in places
where the rename was already done, that added line breaks to long lines
that stood out.

https://bugzilla.gnome.org/show_bug.cgi?id=765474
2016-04-26 08:38:18 -04:00
Christian Hergert
724d3be794 wayland: avoid jitter in keyboard repeat
When synthesizing keyboard repeat, we can potentially drift further from
the mark depending on the timing of the frame callback and how long it
took to deliver the event.

This patch attempts to reduce this by tracking from a stable epoch the
time of our next keyboard repeat.

https://bugzilla.gnome.org/show_bug.cgi?id=765567
2016-04-25 18:15:24 -07:00
Emmanuele Bassi
74f4e6e046 wayland: Bind the appropriate OpenGL API
If we want to use OpenGL ES with EGL then we need to bind the API before
creating the EGL context.
2016-04-25 12:29:37 +01:00
Emmanuele Bassi
7d1da94455 wayland: Add debugging notes for EGL context creation 2016-04-25 12:29:37 +01:00
Emmanuele Bassi
d40778f728 wayland: Honour GDK_GL=gles on context creation 2016-04-25 12:29:37 +01:00
Emmanuele Bassi
2849f2fc9a wayland: Implement asking for a GLES context
Wayland uses EGL, which allows us to ask for a GLES context.

https://bugzilla.gnome.org/show_bug.cgi?id=743746
2016-04-25 12:29:37 +01:00
Frediano Ziglio
cf14fea5a8 Save scancode inside GdkEventPrivate
Windows save in hardware_keycode an information which is not so low
level and some application require the hardware scancode.
As Windows provides this information save it in GdkEventPrivate
and provide a function to get this information.
For no Windows system the function return the hardware_keycode instead.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>

https://bugzilla.gnome.org/show_bug.cgi?id=765259
2016-04-21 22:35:47 -04:00
Rui Matos
deaf664ed2 wayland: Leave existing mods on map_virtual_modifiers
map_virtual_modifiers() is supposed to add the necessary virtual mods
but otherwise leave the mods that are passed in.

https://bugzilla.gnome.org/show_bug.cgi?id=765270
2016-04-19 21:14:20 +02:00
Matthias Clasen
b8a86e6ca4 wayland: Some more debug spew
Print the modifiers and their mapping out as well. This
information is contained in the keymap, but this is a bit
easier to digest.
2016-04-19 12:43:03 -04:00
Matthias Clasen
e7d84898ee wayland: Add debug output for keymaps
Use GDK_DEBUG=input to see your keymap sent over and over again.
Efficiency!
2016-04-19 12:23:51 -04:00
Carlos Garnacho
f7108d4d43 wayland: Improve checks when flushing scroll events
If we get gdk_wayland_seat_flush_frame_event() with no previous event to be
flushed, we fallback into the scroll event checks. However, there's no check
performed there as to whether it really scrolled, so it'd always send a smooth
scroll event with 0/0 deltas in this case.

This should be mostly harmless, but still, we should only end up emitting scroll
events if those really happened.
2016-04-18 14:14:33 +01:00
Carlos Garnacho
bfcd9a2193 wayland: Do not check the pointer focus when receiving wl_pointer.frame
The frame event is also meant to compress wl_pointer.leave events, at this
point the focus surface will be definitely NULL. In the end, wl_pointer.frame
should flush the last composed event despite the pointer focus.

https://bugzilla.gnome.org/show_bug.cgi?id=765065
2016-04-18 14:14:33 +01:00
Matthias Clasen
6664008815 wayland: Make virtual modifier mapping more similar to X
Ignore virtual modifiers that are mapped to Mod1 (as Meta
often is), to avoid interfering with our fix interpretation
of Mod1 as Alt.
2016-04-17 01:50:23 -04:00
Matthias Clasen
5ba8a25d29 wayland: Fix the map_virtual_modifiers implementation
We were not stripping real modifiers out, and thus always
thought there's a conflict when the passed in modifiers
included any real modifiers.
2016-04-16 23:16:12 -04:00
Matthias Clasen
64c2a65cc0 wayland: Implement virtual modifiers
Since Wayland is using libxkbcommon, it inherits X unfortunate
real/virtual modifier distinction, so we have to do the same
gymnastics we do for X to map between the two.

This should fix matching of accelerators using virtual modifiers
(modulo gnome-shell bugs regarding the handling of Super).

https://bugzilla.gnome.org/show_bug.cgi?id=764424
2016-04-15 22:22:48 -04:00
Matthias Clasen
0d64582688 wayland: Keyboard don't have x/y
These axes are not very useful in the first place, but on a
keyboard they just don't make any sense at all.
2016-04-09 17:31:39 -04:00
Matthias Clasen
9044f78751 Move GdkDeviceTool into its own files 2016-04-09 15:48:34 -04:00
Carlos Garnacho
057ae4ace0 wayland: Propagate slider/rotation axes from tools to devices 2016-04-08 17:34:29 +02:00
Carlos Garnacho
6628ffd686 wayland: Check the tablet manager before creating a wp_tablet_seat
This makes things non-crashy if the compositor doesn't provide wp_tablet_manager
2016-04-06 17:29:11 +02:00
Carlos Garnacho
cd1604ae1c wayland: Hook tablets to GdkSeat
Those are now also grabbed togetther with other master pointers,
so everything is able to interoperate on eg. popups triggered by
other devices.
2016-04-06 16:12:13 +02:00
Carlos Garnacho
fb32f11e3d wayland: Translate pen buttons into button events
up/down already take GDK_BUTTON_PRIMARY, we translate BTN_STYLUS(2)
into GDK_BUTTON_MIDDLE/SECONDARY.
2016-04-06 16:12:12 +02:00
Stephen Chandler Paul
4f6bc82052 Wayland: Translate wl_tablet.down/up into button events
These are sent with button=GDK_BUTTON_PRIMARY, axes must be also
included in these events, in addition to motion ones.
2016-04-06 16:12:12 +02:00
Stephen Chandler Paul
0f6be24e28 Wayland: Translate tool axes in motion events
On wayland, such axes are per-tool, we must update device capabilities
on the fly as new tools enter proximity, first the slave device so
it matches the current tool, and then the master device so it looks
the same than the current slave device.
2016-04-06 16:12:12 +02:00
Stephen Chandler Paul
72884a274c Wayland: Implement proximity/crossing/motion event emission on tablets
Each tablet will update its own GdkWaylandPointerData separately. This
commit only adds plain motion event emission so far, no axes are managed
yet.
2016-04-06 16:12:12 +02:00
Stephen Chandler Paul
7cc0850a5a Wayland: Add initial support for drawing tablets
Only the management of tablets and tools is added so far. No tablet events
are yet interpreted.

As it's been the tradition in GTK+, erasers are split into their own device,
whereas the rest of the tools are meant to be routed through the
GDK_SOURCE_PEN device. Both pen/eraser devices are slaves to a master
pointer device, separate to wl_pointer's. This is so each tablet can
maintain its own cursor/positioning accounting.

Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
2016-04-06 16:12:12 +02:00
Carlos Garnacho
45b4d765c0 wayland: Refactor master pointer data into a separate struct
This will enable multiple "pointers" to have separate data here.
Will come out useful when adding support for tablets, as they
will have a separate cursor for all purposes.
2016-04-06 16:12:12 +02:00
Stephen Chandler Paul
af894af386 gdkcursor-wayland.c: Minor indentation fix
Changed the tabs to spaces

Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
2016-04-06 16:12:12 +02:00
Olivier Fourdan
be6784c7ea wayland: Do not resize with the same size
gnome-control-center is calling gtk_window_resize() on configure-event
signals which leads to a busy loop.

Avoids such a busy loop by not re-configuring a window with the same
size, unless this is coming from and xdg-shell configure.

bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=764374
2016-04-05 18:22:40 +02:00
Matthias Clasen
9bfc8371fe wayland: Remove an unused vfunc 2016-04-03 18:18:17 -04:00
Matthias Clasen
59e40f3d6f wayland: Remove unused field 2016-04-03 18:18:17 -04:00
Carlos Garnacho
2784eacf00 wayland: Avoid NULL slave devices in GdkSeat::get_slaves
Just because we're asked for a capability, it doesn't mean we have
it.
2016-04-01 19:10:36 +02:00
Matthias Clasen
4c698bc824 wayland: Print out more debug info
Print out the subpixel layout and frame rates that the compositor
sends us.
2016-03-31 20:31:00 -04:00
Matthias Clasen
59d8cba482 wayland: Get min/max keycode from xkb keymap
Instead of hardcoding 8/255 here.
2016-03-26 18:48:27 -04:00
Matthias Clasen
1057f249bd wayland: Add debug output for pixel formats
Use GDK_DEBUG=misc to see information about wl_shm pixel formats
supported by the compositor.
2016-03-26 16:08:01 -04:00
Matthias Clasen
c6cdddd68d wayland: Fix up visual implementation
Don't return visuals that don't match the requested depth
and/or visual type.
2016-03-26 14:58:48 -04:00
Matthias Clasen
e48e29db3b wayland: Fully initialize the visual
The pixel details (mask, shift and precision) are supposed to
be filled in for TrueColor visuals.
2016-03-26 10:10:57 -04:00
Christian Hergert
c48bc48dda wayland: avoid dropping surfaces when possible
If the configure-event gives us the same size as we had before,
which is common for animation resizes, then try to keep the
existing buffer around. This saves us a memfd_create() syscall
on every frame.

https://bugzilla.gnome.org/show_bug.cgi?id=763350
2016-03-21 22:03:20 -04:00
Carlos Garnacho
219eedd7c8 wayland: Rename internal functions with misleading naming
Now that GdkWaylandDeviceData is gone, the functions prefixed
"gdk_wayland_device_" and taking a GdkWaylandSeat as first
parameter feel out of place. Renaming those makes it more obvious
that it's seat functions.

https://bugzilla.gnome.org/show_bug.cgi?id=763859
2016-03-21 17:15:59 +01:00
Carlos Garnacho
1597f31eba wayland: Remove GdkWaylandDataDevice typedef
It's no longer used.

https://bugzilla.gnome.org/show_bug.cgi?id=763859
2016-03-21 17:15:59 +01:00
Carlos Garnacho
81f0d23744 wayland: Replace all remaining uses of GdkWaylandDeviceData
And use GdkWaylandSeat in all of those. The variable names have also
been updated.

https://bugzilla.gnome.org/show_bug.cgi?id=763859
2016-03-21 17:15:59 +01:00
Carlos Garnacho
c9f9163544 wayland: Remove GdkWaylandDeviceData pointer in GdkWaylandDevice
It's the same than gdk_device_get_seat() nowadays. Also, rename the
usages of GdkWaylandDeviceData to GdkWaylandSeat in the functions
affected by the removal.

https://bugzilla.gnome.org/show_bug.cgi?id=763859
2016-03-21 17:15:59 +01:00
Matthias Clasen
068d382689 dnd: Hide the drag window when we're done
We were just relying on the drag context finalize() to destroy
the window. But with garbage-collected bindings, that might
not happen as soon as we like, so explicitly hide the window
when the drag ends successfully.

https://bugzilla.gnome.org/show_bug.cgi?id=763659
2016-03-21 11:26:24 -04:00
Matthias Clasen
de4cb363c2 Document gdk_wayland_seat_get_wl_seat 2016-03-20 22:49:33 -04:00
Carlos Garnacho
2923f69d3c gdkdnd: Add private means to commit the drag status
The way gdk_drag_status() may be called multiple times during the
processing of drag and drop events throughout the widget hierarchy
brings some superfluous messaging going in, esp. when it's the last
request the one we want to honor, yet we emit messaging requests on
all.

This is barely appreciable in the X11 backend, but due to the design
of the wayland protocol, quick series of changes like this it have
some self-amplificating consequences which may end up flooding the
connection.

We can delegate this to a late "commit" call, performed within GDK
event management. This way gdk_drag_status() calls may be cached
and only result in windowing messaging once per ::drag-motion or
::drag-data-received event. Emitting the final status will also
avoid spurious action changes on the compositor and the other peer.

https://bugzilla.gnome.org/show_bug.cgi?id=763298
2016-03-14 16:50:36 +01:00
Jonas Ådahl
8fb7f50028 wayland: Add request focus support via gtk_shell
A gtk_surface.present request was added to gtk_surface which takes
timestamp from some input event, and uses that timestamp to figure out
whether the window can be presented or not. If we don't have a
timestamp, we should just give up instead of making up our own,
otherwise we might steal someones focus.

https://bugzilla.gnome.org/show_bug.cgi?id=763037
2016-03-10 12:31:15 +08:00