Commit Graph

2695 Commits

Author SHA1 Message Date
Yuri Chornoivan
c0cf839729 Fix minor typos 2020-06-18 10:47:16 +03:00
Matthias Clasen
2c82151d65 gdk: Drop axis labels
This was only ever implemented on X11, and the labels
here were atom names, so unlikely to be useful for
anything interesting.
2020-06-10 07:36:30 -04:00
Matthias Clasen
ea7c9b93ea x11: Stop setting device keys
This is very vestigial functionality, and basically
unused.
2020-06-09 15:05:55 -04:00
Ray Strode
972134abe4 x11: Defer _NET_WM_FRAME_DRAWN update until frame usable by compositor
With the vendor provided Nvidia driver there is a small window of time
after drawing to a GL surface before the updates to that surface
can be used by the compositor.

Drawing is already coordinated with the compositor through the frame
synchronization protocol detailed here:

https://fishsoup.net/misc/wm-spec-synchronization.html

Unfortunately, at the moment, GdkX11Surface tells the compositor the
frame is ready immediately after drawing to the surface, not later,
when it's consumable by the compositor.

This commit defers announcing the frame as ready until it's consumable
by the compositor. It does this by listening for the X server to announce
damage events associated with the frame drawing.  It tries to find the
right damage event by waiting until fence placed at buffer swap time
signals.
2020-06-05 10:01:13 -04:00
Ray Strode
f8770b78ea x11: Factor out some of frame sync code into subroutines
This commit moves some of the end frame sync counter handling
code to subroutines.

It's a minor readability win, but the main motivation is to
make it easier in a subsequent commit to defer updating the
sync counter until a more appropriate time.
2020-06-05 10:01:13 -04:00
Ray Strode
10f2b11fda x11: Add back support for the damage extension
commit 14bf58ec5d dropped support
for using the DAMAGE extension since there was no code that
needed it.

We're going to need it again, however, to address an NVidia
vendor driver issue.

This commit does the plumbing to add it back.
2020-06-05 10:01:13 -04:00
Yuri Chornoivan
01bd4cc4e1 Fix minor typos 2020-05-28 11:00:03 +03:00
Matthias Clasen
e14322137f gdk: Drop the GdkByteOrder enum
Move it to the private gdkvisual-x11.h header, which
is the only place where its used.
2020-05-26 19:45:01 -04:00
Matthias Clasen
f27d855c68 gdk: Drop the GdkEventMask enum
This is not used in public api anymore.
Some of the backends still use it internally,
so keep it in gdkinternals.h for now.
2020-05-26 19:39:31 -04:00
Christian Hergert
fa08d848ca device: remove get_toplevel from surface_at_position vfunc
This is not used anymore now that surfaces are always toplevel in the
semantics of GdkWindow where child windows were available. We can drop
that and simplify the vfunc just a bit more.

Fixes #2765
2020-05-19 13:07:38 -07:00
Olivier Fourdan
93f9138c9b x11: update inhibit shortcuts on grab broken
On X11, shortcuts inhibition is emulated using a grab on the keyboard.

So if another widget ungrabs the keyboard behind our back (for example
when a popup window is dismissed) that effectively disables the effects
of the shortcut inhibition on the surface and we need to update the
shortcut inhibition status accordingly.

Check for "grab-broken" events on the surface and clear existing
shortcuts inhibition for the matching seat, so that the client can be
notified and may decide to re-enable shortcut inhibition if desired.
2020-05-19 14:51:25 +02:00
Matthias Clasen
d6818475d7 gdk: Simplify gdk_display_supports_input_shapes
Make this a display property, and do away with
the vfunc in favor of a private setter, to match
how we handle other display characteristics.
2020-05-17 22:05:24 -04:00
Matthias Clasen
287c40276a gdk: Drop gdk_display_supports_shapes
The apis to set shapes on surfaces are gone,
so there is no point in providing this information
on GdkDisplay.
2020-05-17 21:52:15 -04:00
Matthias Clasen
5916ae5ec4 x11: Avoid some frontend api use
We can just use our backend information directly.
2020-05-17 21:47:22 -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
34d7e25a1f x11: Fix up for last merge 2020-05-17 19:21:28 +02: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
9a30019268 display: Remove the monitor signals
Applications can listen to GdkDisplay:monitors::items-changed if they
want to track monitor changes.
2020-05-17 07:10:34 +02:00
Benjamin Otte
972276436f x11: Directly notify surfaces of monitor changes
Do not use signals.
2020-05-17 07:10:34 +02:00
Benjamin Otte
e81a1db48c monitor: Add gdk_monitor_set_geometry()
Make it replace gdk_monitor_set_size() and gdk_monitor_set_position()
which used to be called in pairs anyway.
2020-05-17 07:10:34 +02:00
Benjamin Otte
33a4442988 x11: Remove unused change tracking
Change tracking now works automatically via GdkMonitor.
2020-05-17 05:14:24 +02:00
Benjamin Otte
14bf58ec5d x11: Remove XDamage dependency
It's not used.
2020-05-17 02:14:58 +02:00
Benjamin Otte
d4731a4ab4 x11: Remove gdk_x11_register_standard_event_type()
It's not used anymore since GdkX11Display::xevent exists.
2020-05-17 01:02:17 +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
Alexander Larsson
fed071ca96 GdkX11DragSurface: set visible state and invalidate on present
Without this we won't actually draw the surface.
2020-05-14 14:33:57 +02:00
Alexander Larsson
bca4af360d X11 dnd: Calculate relative coords right in events
GdkSurface.x/y is mostly 0, we need to look atht GdkX11Surface->abs_x/y.
2020-05-14 11:46:33 +02:00
Alexander Larsson
e702d42597 x11 drag: Fix mapped error
In the gtk-demo drag-and-drop demo i can't drag anything, all I get
is:

(gtk4-demo:358993): Gdk-CRITICAL **: 09:36:19.617: Surface 0x7e1bb0 has not been mapped in GdkSeatGrabPrepareFunc

This is because GdkX11Drag.ipc_surface is not considered mapped, even
though we called gdk_x11_surface_show() on it, because the
GDK_SURFACE_STATE_WITHDRAWN flag is still set.

I added calls to gdk_synthesize_surface_state() to match what
e.g. show_popup() and gdk_x11_toplevel_present() does.
2020-05-14 09:54:34 +02:00
Benjamin Otte
dd7d76f389 gdk: Add gdk_display_get_monitors()
Returns a GListModel of GDK_TYPE_MONITOR.

This will replace the current andling of monitors in GdkDisplay.
2020-05-13 07:00:35 +02:00
Benjamin Otte
7ff69e9356 x11: Use a GListStore for the monitors 2020-05-13 05:22:18 +02:00
Benjamin Otte
c0c8e93d90 display: Remove gdk_display_get_last_seen_time()
Replace the only usage - in the X11 backend - with an X11-specific call.
2020-05-13 04:48:22 +02:00
Matthias Clasen
c66f2ca9eb x11: Avoid a critical in clipboard data transfer
The handler we are calling here asserts that it gets
an interned string as mime_type. So give it one.

Fixes: #2736
2020-05-12 21:31:19 -04:00
Matthias Clasen
99c3928cec keymap: Cache key info
We currently calling gdk_display_map_keyval up to
once per key event per shortcut trigger, and that function
does an expensive loop over the entire keymap and
allocates an array. Avoid this by caching the entries
in a single array, and have a lookup table for finding
the entries for a keyval.

To do this, change the GdkKeymap.get_entries_for_keyval
signature, and change the ::keys-changed signal to be
RUN_FIRST, since we want to clear the cache in the class
handler before running signal handlers. These changes are
possible now, since keymaps are no longer public API.
2020-04-30 13:05:52 -04:00
Matthias Clasen
3c987f073e Remove GdkGeometry from public API
The api to configure surfaces is now GdkToplevelLayout
and GdkPopupLayout. Unfortunately, there's still quite
a bit of internal use of GdkGeometry that will take some
time to clean up, so move it go gdkinternals.h for now.
2020-04-19 10:41:18 -04: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
Olivier Fourdan
86f295f929 x11: emit ::enter/leave-monitor
For the X11 backend, keep a list of monitors for which the surface
intersects the monitor area.

Whenever the X11 surface is configured, check against the list of
monitors to determine whether it enters a new monitor or if it left a
monitor, to emit the corresponding ::enter/leave-monitor signals just
like a Wayland compositor would.

As monitors can be added, removed or reconfigured at any time, redo
those checks whenever any of these events occur.
2020-04-16 16:23:57 +02:00
Emmanuele Bassi
2f0016eb08 Rename gdkx11keys.h
The header is now private, so it should follow the same naming scheme
for private GDK-X11 headers.
2020-04-07 18:12:58 +01:00
Emmanuele Bassi
f87291cac2 Hide GdkX11Keymap's GType function
It's not a public object.
2020-04-07 18:10:01 +01:00
Emmanuele Bassi
37c3ba2645 Do not parse all GDK-X11 source files
We don't need all of them, only the ones that contain public API. This
allows us to reduce the chance of a stray symbol getting incorrectly
added to the introspection data.
2020-04-07 18:06:08 +01:00
Matthias Clasen
f7f103a322 gdk: Remove gdk_keymap_get_modifier_mask
This function is no longer public and no longer used.
2020-04-06 16:32:03 -04:00
Matthias Clasen
dce8d251c6 keymap: Remove virtual modifier mapping functions
These are not used anymore.

Drop the vfuncs and their implementations in the
broadway, x11, wayland and win32 backends as well.
2020-04-06 16:32:03 -04:00
Matthias Clasen
89ad7893ad gdk: Make GdkKeymap a private api
We have replacement apis in GdkDevice and GdkDisplay.
2020-04-06 16:32:03 -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
Matthias Clasen
b02db72e17 Rename GDK_MOD1_MASK to GDK_ALT_MASK
We've hardcoded Mod1 = Alt for a long time, there is
no need to keep the confusing naming around anymore.
2020-04-06 01:40:49 -04:00
Matthias Clasen
13213c710f x11: Notify new device properties 2020-04-06 01:40:49 -04:00
Olivier Fourdan
83027c68f1 x11: Implement inhibit_system_shortcuts API
On X11, there is no such equivalent to the inhibit shortcut protocol
found on Wayland.

To implement the inhibit_system_shortcuts API on X11, we emulate the
same behavior using grabs on the keyboard.

To avoid keeping active grabs on the keyboard that would affect other
X11 applications even when the surface isn't focused, the X11
implementation takes care of releasing the grabs as soon as the toplevel
loses focus.
2020-03-30 18:25:36 +02:00
Olivier Fourdan
44931a66df x11: Use gdk_x11_* rather than gdk_wayland_*
Rename the local functions for the x11 backend as gdk_x11_* rather than
gdk_wayland_*
2020-03-30 18:25:36 +02:00
Matthias Clasen
9ccd514682 x11: Don't use g_object_unref on events
Events are not object anymore.
2020-03-28 14:28:36 -04:00