Commit Graph

285 Commits

Author SHA1 Message Date
Jason Gerecke
6fd6ff2ea1 wayland: Add support for BTN_STYLUS3
BTN_STYLUS3 is defined by the Linux 4.15 kernel and is sent when the
third button on a stylus is pressed. At the moment, only Wacom's "Pro
Pen 3D" has three stylus buttons. Pressing this button triggers a button
8 event to be sent under X11, so we use the same mapping here.

https://bugzilla.gnome.org/show_bug.cgi?id=790033
2018-01-30 21:32:07 +01:00
Matthias Clasen
e151058dff Make gdk logging per-display
As far as possible, use per-display debug flags.

This will minimize the debug spew that we get from
the inspector if it is running on a separate display.
2018-01-14 17:05:04 -05:00
Matthias Clasen
d72508590b wayland: Set display on keymaps
This was forgotten so far: The display of keymaps
was NULL.
2018-01-12 09:23:59 -05:00
Benjamin Otte
b49a9b9933 dnd: Remove gdk_drag_get_selection()
Without selections, drags can't have them either.

Also included is removing the selection from GtkSelectionData.

Includes a bunch of crude cleanups to Wayland code that no longer has to
care about selection atoms.
2017-12-14 04:39:22 +01:00
Carlos Garnacho
8595e4b1d1 gdk: Figure out the GdkSeat of an event from the GdkDevice
Removes the need for gdk_event_set_seat() and the GdkSeat field from
GdkEventPrivate.
2017-12-14 00:58:32 +01:00
Carlos Garnacho
64decbfd74 gdk: Remove GdkEventType argument from GdkEvent union
It won't stand true anymore that the GdkEventType argument is the
first field of the GdkEvent* structs. All callers have been updated
to use event->any.type instead.
2017-12-14 00:58:32 +01:00
Carlos Garnacho
b9db0b55cb gdk: Refurbish GdkEvent struct hierarchy
Make all specific event structs contain a GdkEventAny, so the base
struct can be extended without modifying structs all over the place.
2017-12-14 00:58:32 +01:00
Benjamin Otte
4042d5f242 gdk: Remove ability to own a selection
With this, the GDK_EVENT_SELECTION_REQUEST and GDK_EVENT_SELECTION_CLEAR
and the associated GtkWidget signals are gone, too.
2017-12-13 23:39:02 +01:00
Carlos Garnacho
7531be3510 gdk: Add GDK_SEAT_CAPABILITY_TABLET_PAD
Tablet pads don't adapt really well to any other capability, so add a
distinct one to be able to query those properly.

https://bugzilla.gnome.org/show_bug.cgi?id=790920
2017-12-07 21:27:33 -05:00
Carlos Garnacho
4c45022ed0 gdk: Add gdk_seat_get_master_pointers()
Traditionally (and on most backends) there's a single master pointer driven
by all pointing devices. The notable exception is Wayland though, where
master pointing devices are created per capability in the case of
pointer/touch, and one for each drawing tablet.

This function call makes it easy to access all these.

https://bugzilla.gnome.org/show_bug.cgi?id=790920
2017-12-07 21:27:14 -05:00
Matthias Clasen
4a11baa372 gdk: Documentation improvements 2017-12-04 23:52:48 -08:00
Benjamin Otte
ff577e6c2c wayland: Add primary clipboard subclass
I decided to put this in a custom subclass, because then I could keep
the whole gtk primary protocol self-contained.

The other option would have been reusing GdkWaylandClipboard, but that
didn't seem worth it, especially because that code needs to interact
with the DND machinery, while the primary doesn't.
2017-12-03 05:46:49 +01:00
Benjamin Otte
82002eabfe wayland: Implement reading the clipboard
We now keep track of what's in the clipboard and allow people to read
its contents.
2017-12-03 05:46:49 +01:00
Benjamin Otte
00192266a1 wayland: Add skeleton for a GdkClipboardWayland
Creates the source file and a custom subclass and makes sure it's used
by GDK.
2017-12-03 05:46:49 +01:00
Benjamin Otte
437d70f569 gdk: Get rid of owner change events
They're unused now.
2017-12-03 05:46:49 +01:00
Carlos Garnacho
7decad177c gdk/wayland: Emit GdkSeat::device-added/removed
Those were never sent in this backend...
2017-11-27 19:51:38 +01:00
Matthias Clasen
1884558470 wayland: Drop GdkWaylandDeviceManager
This object had no functionality left.
2017-11-25 11:04:15 -05:00
Matthias Clasen
da8bcc7ed9 wayland: Stop deriving from GdkDeviceManager
We can just derive from GObject.
2017-11-25 11:04:15 -05:00
Matthias Clasen
fd958939be Drop the GdkDeviceManager::display property
Move this to the backends, and stop deriving
from GdkDeviceManager.
2017-11-25 11:04:15 -05:00
Matthias Clasen
0ec491ea9d Drop the get_client_pointer vfunc
There is no api using this anymore.
2017-11-25 11:04:15 -05:00
Matthias Clasen
b6a634fe38 Drop the list_devices vfunc
We no longer have api that uses this.
2017-11-25 11:04:15 -05:00
Matthias Clasen
efbcb38fdf wayland: Stop emitting devicemanager signals
Nobody is listening to these signals anymore.
2017-11-25 11:04:15 -05:00
Benjamin Otte
e9629a5149 wayland: Fix initial cursor
Make sure the initial cursor isn't random which would happen due to an
early exit when cursor == pointer->cursor triggered because both were
NULL.
2017-11-15 19:07:17 +01:00
Benjamin Otte
4c4e914806 gdk: Replace GDK_NONE with NULL 2017-11-15 19:07:17 +01:00
Benjamin Otte
ed1b6a9bed gdkwindow: Remove event_mask arguments from constructors 2017-11-13 23:41:38 +01:00
Matthias Clasen
6261f5f7b8 wayland: Drop the root window
We can just keep a list of toplevels in the display.
2017-11-06 18:52:37 -05:00
Matthias Clasen
2eb78a2374 wayland: Stop using gdk_display_get_root_window
We can just use the display field directly.
2017-11-05 19:44:39 -05:00
Matthias Clasen
909330f347 wayland: Fix animated cursors
We must reset the image delay when stopping the timeout,
otherwise the code setting it up thinks it is still running.

This fixes cursor animation only working for the very first
enter of a widget with an animated cursor, as seen in the
cursors example in gtk4-demo.
2017-11-05 11:27:06 -05:00
Benjamin Otte
9323d098a6 gdk: Cursors no longer have a display
Change constructors to reflect that.

While doing so, also add a fallback argument to the cursor constructors,
so it is now possible to create cursors with fallback.
2017-11-04 00:07:13 +01:00
Benjamin Otte
ec824b9e50 wayland: Redo cursor handling
This is in line with the X11 changes last patch.
2017-11-04 00:07:13 +01:00
Matthias Clasen
5bd8884bf8 Stop providing the owner in GdkEventOwnerChange
This information is rarely useful, and it is one
of the last places where we create foreign windows.
2017-11-01 22:53:24 -04:00
Matthias Clasen
3a5b478e0f wayland: Some cursor cleanups
Remove methods that are not used.
2017-11-01 22:35:19 -04:00
Matthias Clasen
0f9e9a9ec2 wayland: No more screen
This gets rid of the GdkWaylandScreen object and all
remnants of GdkScreen in the wayland backend.
2017-11-01 19:44:29 -04:00
Matthias Clasen
67cea50383 Drop gdk_get_default_root_window
This is a trivial convenience function, and it is barely used.
2017-10-31 21:30:59 -04:00
Matthias Clasen
a3cffa5072 Drop GdkScreen from GdkDevice apis
Returning the screen does not add anything here and
GdkScreen is going away.
2017-10-31 12:30:38 -04:00
Matthias Clasen
525e2a7944 gdk: Stop using gdk_event_set_screen
Use gdk_event_set_display instead.
2017-10-30 22:22:00 -04:00
Benjamin Otte
43c212ac28 build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:

1. Add all missing enums to the switch statement
  or
2. Cast the switch argument to a uint to avoid having to do that (mostly
   for GdkEventType).

I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.

The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
2017-10-06 21:23:39 +02:00
Carlos Garnacho
d271b135bb gdk/wayland: Drop emission of emulated scroll events
A wl_pointer.frame can now only result on one scroll event
being emitted.
2017-09-19 18:39:03 +02:00
Matthias Clasen
9859f8f69f Allow passing a NULL window to gdk_device_query_state
Interpret NULL as "root window" here - we only have one
screen nowadays, so there is no choice involved, and this
will let us avoid dealing with the root window in the
fontend code.
2017-08-11 15:45:24 -04:00
Matthias Clasen
c409fca703 Drop root windows from some internal apis
_gdk_device_query_state was needlessly shuffling
root windows around.
2017-08-11 15:45:23 -04:00
Olivier Fourdan
ac61aedae9 wayland: add shortcut inhibitor support
This adds support for the shortcut inhibitor protocol in gdk/wayland
backend.

A shortcut inhibitor request is issued from the gdk wayland backend for
both the older, deprecated API gdk_device_grab() and the new gdk seat
API gdk_seat_grab(), but only if the requested capability is for the
keyboard only.

https://bugzilla.gnome.org/show_bug.cgi?id=783343
2017-08-02 12:37:23 +02:00
Carlos Garnacho
8f33385d62 wayland: Clear tablet tool cursor on proximity out
This ensures that the tablet tool will get the cursor updated even if it
happens to fall within the same window again on the next proximity in.

https://bugzilla.gnome.org/show_bug.cgi?id=785375
2017-07-26 13:09:04 +02:00
Carlos Garnacho
5b9adfba46 wayland: Observe GDK_SEAT_CAPABILITY_TABLET_STYLUS on gdk_seat_get_slaves()
This flag wasn't being honored so far...
2017-07-26 13:08:36 +02:00
Jason Gerecke
837c2002e9 wayland: Implement support for tablet wheel scrolling
Adds support for creating scroll events from Wayland tablet wheel events.
Even though no Wacom tablet puck has a smooth-scrolling wheel, both event
types need to be generated to make the upper layers happy.

https://bugzilla.gnome.org/show_bug.cgi?id=783716
2017-07-20 14:27:28 +02:00
Carlos Garnacho
3be5aae56a wayland: Make function to create scroll event more generic
Add GdkWaylandPointerData and GdkDevice arguments so it can be
used across master devices.

https://bugzilla.gnome.org/show_bug.cgi?id=783716
2017-07-20 14:27:28 +02:00
Jason Gerecke
8419b51cc3 wayland: Get implicit grab serial information from tablet devices
If a tablet device is used to perform actions like window moving or resizing,
GTK must provide the correct implicit grab serial number over Wayland to Mutter
in order for the action to succeed. This commit adds tablet support to the
implicit serial getters.

https://bugzilla.gnome.org/show_bug.cgi?id=777333
2017-07-20 14:27:28 +02:00
Carlos Garnacho
6781d2109d gdk: Set vid/pid on wayland tablets
This was missed so far... Use %.4x format, in order to behave just
the same than X11.
2017-06-16 19:38:04 +02:00
Dan Torop
a23ad61a25 wayland: selectively cancel key repeat on key release
Under Wayland, when multiple keys are pressed and the user releases a
key, key repeat should continue unless the key released is the one
currently repeating.

In the case of:

- key1 press
- key1 repeat
- key2 press -> key1 repeat stopped
- key2 repeat
- key2 release

The behavior should be to cancel keyboard repeat, though key1 is still
held down. This is consistent with prior X11/XWayland behavior.

The following also must work:

- key1 press
- key2 press
- key2 release
- key2 press
- key1 release
- key2 should continue to repeat

The fix for bug #778019 should continue to work:

- key1 press
- key1 repeat
- key2 press -> key1 repeat stopped
- key1 release
- key2 should repeat

The choice to change the counter nkeys to the flag repeat_active
helps to solve the second test case.

https://bugzilla.gnome.org/show_bug.cgi?id=781285
2017-06-02 19:13:03 +02:00
Emmanuele Bassi
739588cc3c wayland: Add declaration of private get_type() function 2017-04-28 23:03:14 +01:00
Emmanuele Bassi
7619c9c739 wayland: Mark private function as static 2017-04-28 22:47:29 +01:00