Commit Graph

197 Commits

Author SHA1 Message Date
Carlos Garnacho
7be6afe84d gdk: Depend less on gdk_event_get_device()
For the most part, we are interested in seats here.
2020-06-23 23:42:53 +02:00
Carlos Garnacho
5f29b8fcec gdk: Drop GdkGrabOwnership
We no longer expose such low level tweaks, this is essentially
unused.
2020-06-23 23:42:53 +02:00
Carlos Garnacho
59a8106373 gdk: Drop supports_multidevice API
Crossing events are now detached from widget state, all tricky consequences
from getting multiple crossing events are now somewhat moot. Resort to sending
all generated crossing events, and drop this barely (ever?) used API.
2020-06-23 23:42:53 +02:00
Emmanuele Bassi
1c856a208f Rename master and slave device
We already use the "logical/virtual" and "physical" names in the
documentation, there's no reason to use loaded terms just because X11
uses them.
2020-06-18 19:22:20 +01:00
Matthias Clasen
86eece78b1 gdk: Compress scroll events
Only return one accumulated scroll event per frame.
Compress them by adding up the deltas.

Still missing: a way to capture history, like
we do for motion events.

Fixes: #2800
2020-06-09 13:43:03 -04:00
Christoph Reiter
2d5cf2b4c4 Drop fallback-c89.c
We require a C compiler supporting C99 now. The main purpose of
these fallbacks was for MSVC. From what I can see this is now all supported
by MSVC 2015+ anyway.

The only other change this includes is to replace isnanf() with the
(type infering) C99 isnan() macro, because MSVC doesn't provide isnanf().
2020-05-31 17:09:23 +02:00
Yuri Chornoivan
01bd4cc4e1 Fix minor typos 2020-05-28 11:00:03 +03:00
Matthias Clasen
6d8153d8fd gdk: Short-circuit some surface setters
Don't call into the backends when the input region
or shadow width don't actually change. This avoid
distracting calls in debug logs, and just generally
is the right thing to do.
2020-05-20 10:55:27 -04:00
Rico Tzschichholz
ebaeb9f3b8 gdk: Preserve typed event parameter of GdkSurface:event signal for gir
In conjunction to https://gitlab.gnome.org/GNOME/gtk/merge_requests/1936
2020-05-20 08:48:34 +02:00
Emmanuele Bassi
dd4d6930b5 Use the right types for the GdkSurface::event arguments
We pass the GdkEvent as a pointer, because the autogenerated marshallers
don't know how to handle GTypeInstance-derived classes.

Since the GValue box that we use in the marshaller passes the GdkEvent
instance as is, we also need to acquire a reference before invoking the
closure, and release it afterwards, to ensure that the GdkEvent instance
survices the invocation.
2020-05-19 12:21:22 +01:00
Matthias Clasen
03829e191e docs: Tweak docs for gdk_surface_set_input_region 2020-05-17 21:46:54 -04:00
Matthias Clasen
71bad81aff gdk: Make gdk_drag_begin take doubles
This is a better fit to the way we treat coordinates
everywhere else.
2020-05-17 17:51:03 -04:00
Matthias Clasen
c0faf0c6b6 Merge branch 'toplevel-move-resize' into 'master'
Toplevel move resize

See merge request GNOME/gtk!1923
2020-05-17 19:15:46 +00:00
Matthias Clasen
1e8a58e367 gdk: Move the begin_move/resize_drag vfuncs around
Move these from GdkSurface to GdkToplevel, where they
belong. Update all backends.
2020-05-17 14:15:06 -04:00
Benjamin Otte
b353221185 Merge branch 'wip/otte/monitors' into 'master'
various GDK cleanups

See merge request GNOME/gtk!1920
2020-05-17 16:57:52 +00:00
Benjamin Otte
4c7914dc49 display: Remove unneeded getters
Applications can use the listmodel instead.
2020-05-17 07:32:37 +02:00
Benjamin Otte
0c6266fd1a surface: Remove gdk_surface_is_viewable()
It returns the same value as gdk_surface_get_mapped(), so use that
instead.
2020-05-17 00:41:44 +02:00
Matthias Clasen
8912a6eb75 gtk: Handle seatless displays
If you run weston with the headless backend, you get a Wayland
display with no seat, which is just fine by the protocol.

gdk_display_get_default_seat() returns NULL in this case. Various
widgets assume that we always have a seat with a keyboard and a
pointer, since that is what X guarantees. Make things survive
without that, so we can run the testsuite under a headless
Wayland compositor.
2020-05-15 14:11:53 -04:00
Carlos Garnacho
2bd8124b5d gdk/wayland: Keep track of implicit grabs
Tracking of those broke sometime along the gdk cleanups, so we
started missing some GDK_GRAB_BROKEN events from being emitted
(eg. after a button press/implicit grab triggers an active grab).

Implicit grabs are only added if there's no prior grab (either
implicit through other button presses, or explicit), in order to
keep accounting correct, make those prevail.
2020-05-12 14:14:39 +02:00
Corentin Noël
076b2f11d2 docs: Fix several missing references in the documentation
This fixes several typos and missing references
2020-05-11 19:26:20 +02:00
Timm Bäder
27b4b5ee32 surface: remove double assignment 2020-05-05 08:20:10 +02:00
Jonas Ådahl
0a79eb02ac surface: Hide chained autohiding popups together
When we autohide a popup surface with a grab, hide all other auto hiding
popups up the popup chain. The end result is that when you click outside
a menu with submenus open, the whole menu chain is dismissed.
2020-04-18 22:33:52 +02:00
Emmanuele Bassi
f28aa1ba02 Restructure the GdkEvent type hierarchy
GdkEvent has been a "I-can't-believe-this-is-not-OOP" type for ages,
using a union of sub-types. This has always been problematic when it
comes to implementing accessor functions: either you get generic API
that takes a GdkEvent and uses a massive switch() to determine which
event types have the data you're looking for; or you create namespaced
accessors, but break language bindings horribly, as boxed types cannot
have derived types.

The recent conversion of GskRenderNode (which had similar issues) to
GTypeInstance, and the fact that GdkEvent is now a completely opaque
type, provide us with the chance of moving GdkEvent to GTypeInstance,
and have sub-types for GdkEvent.

The change from boxed type to GTypeInstance is pretty small, all things
considered, but ends up cascading to a larger commit, as we still have
backends and code in GTK trying to access GdkEvent structures directly.
Additionally, the naming of the public getter functions requires
renaming all the data structures to conform to the namespace/type-name
pattern.
2020-04-16 19:54:02 +01:00
Matthias Clasen
8e9406a082 Move key event rewriting
Stop rewriting key and focus events on the GDK side.
Instead deliver them as they are, and propagate them
from the root on the gtk side, in gtkmain.c. And
stop complaining about focus events on popups - we
can just ignore them if we have no use for them.
2020-04-15 14:56:32 -04:00
Matthias Clasen
d27adb10a0 surface: Document coordinate systems a bit
Mention that sizes are in application pixels.

Also, remove some X11-specific docs.
2020-04-13 09:29:11 -04:00
Matthias Clasen
3ee18b88b9 gdk: Add ::enter/leave-monitor signals
These are useful to keep track of what monitors a window is on.
2020-04-13 07:54:31 -04:00
Matthias Clasen
0a96a483c6 gdk: Redo key events
Add all of the keyboard translation results in the key event,
so we can translate the keyboard state at the time the event
is created, and avoid doing state translation at match time.

We actually need to carry two sets of translation results,
since we ignore CapsLock when matching accelerators, in
gdk_event_matches().

At the same time, drop the scancode field - it is only ever
set on win32, and is basically unused in GTK.

Update all callers.
2020-04-06 15:13:54 -04:00
Olivier Fourdan
a07a69e24e gdk: add internal gdk_surface_get_seat_from_event()
This can come handy to get the seat from a surface/event.
2020-03-30 18:25:36 +02:00
Matthias Clasen
1576cced0f Drop GdkToplevel:accept-focus/:focus-on-map
These properties were only ever implemented in the
X11 backend. If you want to use them, just use the
X properties directly.
2020-03-14 19:28:00 -04:00
Matthias Clasen
25b90907ad surface: document gdk_surface_translate_coordinates 2020-03-12 15:30:11 -04:00
Matthias Clasen
f020d77a23 Move fullscreen-mode to GdkToplevel 2020-03-12 15:30:11 -04:00
Matthias Clasen
81be6ff46b Move edge-constraints to GdkToplevel 2020-03-12 15:30:11 -04:00
Matthias Clasen
8b57092958 surface: Drop gdk_surface_show
No longer used.
2020-03-12 15:30:10 -04:00
Matthias Clasen
90dfca290c gdk: Drop surface-type
We have interfaces for surface subtypes now.
2020-03-12 15:30:10 -04:00
Matthias Clasen
70e45aa229 surface: Stop using surface types 2020-03-12 15:30:10 -04:00
Matthias Clasen
c00ec402c1 surface: Don't implement subtypes in the frontend
These are now provided by the backend.
2020-03-12 15:30:10 -04:00
Matthias Clasen
b3cabe638f Drop gdk_surface_set_opacity 2020-03-12 14:56:21 -04:00
Matthias Clasen
d6be419050 Drop gdk_surface_show and gdk_surface_resize
We can now use GdkDragIcon api for the last cases
where this was used.
2020-03-12 14:56:21 -04:00
Matthias Clasen
b25be8a42f Add a GdkDragSurface interface
This will provide functionality specific to drag icons.
2020-03-12 14:56:21 -04:00
Matthias Clasen
3a4e647b2d surface: Drop redundant toplevel api
The toplevel functionality to keep is moving to
GdkToplevel, and unused functions can go.
2020-03-12 14:56:21 -04:00
Matthias Clasen
dfbde3da4f Introduce GdkToplevel
This is a new interface for toplevel surfaces.
2020-03-12 14:56:20 -04:00
Matthias Clasen
b2ae6ce8ff surface: Rename gdk_surface_input_shape_combine_region
There is no shape combining going on anymore, so
call this just gdk_surface_set_input_region, and
remove the offset arguments too. All callers pass
0 anyway.

Update all callers and implementations.
2020-03-11 19:35:56 -04:00
Matthias Clasen
dc4f7515bd surface: Drop popup api
We have the GdkPopup interface now.
2020-03-11 19:35:55 -04:00
Matthias Clasen
530dd5a940 surface: Implement GdkPopup
This is not quite right, and only temporary, since
it makes GDK_IS_POPUP (surface) true for every surface.

Eventually, the implementation will be moved to the
backends.
2020-03-11 19:35:55 -04:00
Matthias Clasen
78d71eb439 Simplify surface move/drag api
Drop the with_device variants, and always pass a device.
2020-03-11 19:35:55 -04:00
Matthias Clasen
6fb50ccd0d Drop gdk_surface_is_visible
It has been replaced by gdk_surface_get_mapped.
2020-02-24 19:07:03 -05:00
Matthias Clasen
96b7c5f575 Add gdk_surface_get_mapped
Returns the value of the ::mapped property. This is
a direct replacement for gtk_surface_is_visible.
2020-02-24 17:59:12 -05:00
Matthias Clasen
ec76f65d09 surface: Add a getter for autohide 2020-02-24 14:38:42 -05:00
Matthias Clasen
6be9e44786 gdk: Drop GdkDevice::input-mode and rename ::input-source
Drop the input-mode, since it only makes sense for
floating devices, which we don't have anymore. And renamt
::input-source to ::source, to match the getter.

Update all users.
2020-02-24 14:38:42 -05:00
Matthias Clasen
9ce6e98487 device: Add missing getters
This adds getters for a few properties that were
missing them, and renames the input-mode and input-source
properties to match their existing getters.
2020-02-24 08:40:16 -05:00