Commit Graph

7888 Commits

Author SHA1 Message Date
Po Lu
3a871c9184
Treat XKB_MOD_NAME_LOGO as super key
Based on !5088. See also #4913.
2022-12-07 17:34:17 +01:00
Matthias Clasen
3f1536632f wayland: Look for cursor themes in $HOME
We should look in the same places that libXcursor does,
so add $XDG_DATA_HOME/icons and $HOME/.icons to the list.

Fixes: #4080
2022-11-25 15:18:39 +01:00
Thomas Zajic
e413f5c432 Flush drawable surface when getting a pixbuf
When getting the drawable surface to get its pixels we should be
flushing the Cairo state, not mark it dirty.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4456
2022-11-23 11:37:14 +00:00
Matthias Clasen
b2ad8d2aba Dist gdk/wayland/cursor/meson.build
This file was missing from the 3.24.35 tarball.
Oops.
2022-11-23 06:24:40 -05:00
Matthias Clasen
f8d26e2acc Merge branch 'libwayland-cursor-in-tree-gtk-3-24' into 'gtk-3-24'
Make wayland load cursors on demand

See merge request GNOME/gtk!5192
2022-11-18 03:55:52 +00:00
Michael Catanzaro
2fcc114870 Merge branch 'gtk-3-gles' into 'gtk-3-24'
gdk_wayland_display_init_gl: use GLES API if required

See merge request GNOME/gtk!5062
2022-11-10 13:44:34 +00:00
Luca Bacci
66a199806c Make wayland load cursors on demand
Add and use a modified libwayland-cursor in-tree,
just as done in the main branch for GTK4
2022-11-04 15:16:06 +01:00
Luca Bacci
4432a03742 Revert "wayland/cursor: Sanity check cursor image size"
This reverts commit da4066774b.
2022-11-04 10:58:37 +01:00
Joan Bruguera
22c95cd1e9 gdk/wayland: Enable xdg-activation only if wayland-protocols >= 1.21
This way we can keep the same wayland-protocols requirement, so the latest GTK3
still builds on distributions shipping older versions of wayland-protocols,
such as Debian Bullseye.

Should fix CI builds as well.
2022-10-25 23:52:47 +02:00
Carlos Garnacho
3b25f9a662 gdk/wayland: Check the GdkSurface wl_surface before using it for activation
Double check the GdkSurface has a wl_surface before using it as the activation
token source, since we cannot use NULL surfaces here.

Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1862
Backport-of: 4b41d4f78ce71b60f0d51837cd1b6a1b346d679d
Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
2022-10-25 15:54:05 +02:00
Carlos Garnacho
7fa87abf8a gdk/wayland: Dispatch GdkAppLaunchContext activation token in its own queue
Use a separate queue to dispatch the token object exclusively, just like we
do on the GdkSurface activation paths.

Backport-of: fb68600d88d4d334f7da7d079b106a1ef14503a6
Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
2022-10-25 15:53:57 +02:00
Carlos Garnacho
45f0b5d052 wayland: Use xdg-activation for non-startup initiated focus requests
Currently, we have all the plumbing in place so that GTK consumes the
startup notification ID when focusing a window through the xdg-activation
protocol.

This however misses the case that a window might be requested to be
focused with no startup ID (i.e. via interaction with the application,
not through GApplication or other application launching logic).

In this case, we let the application create a token that will be
consumed by itself. The serial used is that from the last
interaction, so the compositor will still be able to do focus prevention
logic if it applies.

Since we already do have a last serial at hand, prefer xdg-activation
all the way over the now stale gtk-shell focusing support. The timestamp
argument becomes unused, but that is a weak argument to prefer the
private protocol over the standard one. The gtk-shell protocol support
is so far left for interaction with older Mutter.

Backport-of: 4dcacff3120d5c1cef888061dbc42f5fbe093a58
Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
2022-10-25 15:53:49 +02:00
Guido Günther
e80251e751 wayland: Keep startup_notification_id around long enough
When using xdg_activation we need to keep the id around until we send
the first activate to signal succesful startup.

Backport-of: 999509be619bfa0f50a549489b5ab5c890b574fa
Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
2022-10-25 15:53:36 +02:00
Guido Günther
54348c5270 wayland: xdg-activation: Don't assume there's a focus surface
Tools like gtk4-launch can't set surface on the activation token so
don't require it. If the compositor requires it we can't do anything
about it anyway. This avoids a critical:

   (gtk4-launch:23497): Gdk-CRITICAL **: 17:07:24.704: gdk_wayland_surface_get_wl_surface: assertion 'GDK_IS_WAYLAND_SURFACE (surface)' failed

Fixes: be4216e051 ("gdk/wayland: Support the xdg-activation wayland protocol")

Signed-off-by: Guido Günther <agx@sigxcpu.org>
Backport-of: 4d741bac98f906796d61eebfb4f74f5b1cecb2b6
Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
2022-10-25 15:53:26 +02:00
Carlos Garnacho
a79d6972e0 gdk/wayland: Support the xdg-activation wayland protocol
This protocol implements the IPC necessary to focus application
windows across launcher/launchee. Add support for it.
2022-10-25 15:50:02 +02:00
Emilio Cobos Álvarez
686864a118
[gtk3] [wayland] Fix hotspot positioning with scaled surface.
Fixes !5278 to behave the same way as X11.
2022-10-21 14:22:51 +02:00
Carlos Garnacho
5ea961ed93 gdk: Ensure GdkFrameClock::flush-events with uncompressed motion
Sometimes, there may be motion events left in the queue, because at the
time of handlign these motion events the GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS
phase is not requested.

Ensure that, when finding motion events on a window that does not disable
motion compression, the events are anyways flushed, so they can be processed
early by the window/widget event handlers.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4946
2022-10-03 16:42:40 +02:00
Emmanuele Bassi
1ad49f238c Merge branch 'wip/carlosg/translate-string-selections' into 'gtk-3-24'
wayland: Translate STRING/UTF8_STRING selection atoms to mimetypes

See merge request GNOME/gtk!5072
2022-10-03 09:06:51 +00:00
Carlos Garnacho
0c1ea92219 wayland: Translate STRING/UTF8_STRING selection atoms to mimetypes
Since the GDK API layer in 3.x is considerably tied to X11 details,
it makes sense to provide this bit of translation in case the app
uses these exclusively and does not use actual mimetype strings.
Provide this bit of translation of X11 selection atoms to mimetypes.

While at it, use the right zwp_primary_selection_source_v1 API with
primary selection data sources. From the looks of it, this just
happened to work.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5217
2022-10-03 10:35:48 +02:00
Jonas Ådahl
45ba6e9329 wayland: Add support for gtk_surface1_titlebar_gesture()
This adds a private GDK API that GTK calls using GDK_PRIVATE_CALL(). It
is more or less a copy of the GdkSurface::titlebar_gesture() API, and
achieves the same. If the backend or compositor doesn't support titlebar
gestures, the existing path is used as a fallback.
2022-09-30 22:38:03 +02:00
Dominique Martinet
0e5fe45ea2 gdk_wayland_display_init_gl: use GLES API if required
gdk_wayland_gl_context_realize properly checks for GLES and uses
eglBindAPI with the proper API, but before that init is always called
with regular GL interface which is not implemented for many embedded
devices.

This was fixed in GTK 4 with commit 482845b02705 ("wayland: Remove
initial GL API bind"), but that commit cannot easily be applied because
the current version queries some GL properties during init so we would
need to backport more for it to be applicable.

This patch takes the minimal approach of initializing GLES context,
allowing the gtk3 demo OpenGL test (and real applications) to work
when GDK_GL=gles is set.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3028
2022-09-28 14:34:41 +09:00
Luca Bacci
8f0d580cf9 GdkWin32: Fix subclassing for GdkWin32Selection 2022-09-26 14:28:03 +02:00
Vlad Zahorodnii
965aa2e65f gdk/wayland: Update selection's offer before updating dnd targets
gdk_wayland_drop_context_update_targets gets targets from the
selection's offer. In order to ensure that the drop context has
up-to-date targets, update the selection's offer before updating
targets.

This fixes drag-and-drop not working reliably when running Firefox in
Plasma Wayland session.
2022-09-23 11:12:41 +03:00
Nate Eldredge
8984b13d84 Recognize "stylus" devices as GDK_SOURCE_PEN
Add "stylus" to the list of substrings in a device name that cause it to be recognized
as a GDK_SOURCE_PEN device (previously "wacom", "pen" and "eraser").  Some devices
just use "stylus" in their name, and are otherwise recognized as
GDK_SOURCE_TOUCHSCREEN instead.

Fixes #4394.
2022-09-17 15:06:27 +02:00
Matthias Clasen
9baae419f6 x11: Add a precondition
Trying to be helpful.
2022-09-09 14:50:39 -04:00
John Ralls
7a56fa276b [quartz] find_toplevel_under_pointer should not return _gdk_root
The macOS WM has no root window. We fake one with a 1x1 window at the
origin that has no associated NSWindow. If the pointer is not on a
realized GdkWindow the hierarchical search will place it in the root
window even if it's nowhere near it. That's not valid, but returning it
from find_toplevel_under_pointer prevents Gdk from discovering when the
pointer is really over a GdkWindow. Return NULL instead so that the window
discovery is re-performed.
2022-08-22 08:58:08 -07:00
Matthias Clasen
84db04e6e1 Merge branch 'static-builds-hinstance' into 'gtk-3-24'
GdkWin32: Add support for static builds

See merge request GNOME/gtk!4538
2022-08-18 18:05:36 +00:00
Carlos Garnacho
2c65884a5e gdk/wayland: Drop motion hint mask from seat grab event masks
At best, it's just an awkward event mask sitting there for a backend
that does not need it. At worst, this may result in motion events being
eaten away in the right set of circumstances.

Avoid the pointer motion hint mask, and rely on events being further
than hints.

Related: https://gitlab.gnome.org/GNOME/gimp/-/merge_requests/534#note_1526935
2022-08-12 01:54:08 +02:00
Chun-wei Fan
3bd0e8ff2e gdk/broadway/Makefile.am: Correct build variable
They should be enclosed by $() not ${}.
2022-08-05 16:50:48 +08:00
John Ralls
09dd73feeb [quartz] Remove extra reference on layer's cairo_surface. 2022-06-30 15:27:03 -07:00
John Ralls
f48bed22db [quartz] shouldInheritContentsScale from 10.7+ instead of 10.14+. 2022-06-30 15:25:50 -07:00
Florian Müllner
b19269c9c1 wayland/screen: Don't force HighContrast icon theme
The theme is considered deprecated in favor of symbolic icons from
the regular theme.
2022-06-23 15:49:03 +02:00
Matthias Clasen
26ef6917c8 Merge branch 'bad-popup-extents-gtk3' into 'gtk-3-24'
[gtk3] [x11] Fix coordinate space of rect in gdk_x11_window_get_frame_extents when called on popups.

See merge request GNOME/gtk!4821
2022-06-23 12:00:11 +00:00
John Ralls
56d9dc95d9 [quartz] Fix build on macOS versions before 10.14.
shouldInheritContentScale was introduced in 10.14.
2022-06-20 17:15:49 -07:00
Emilio Cobos Álvarez
c43e3c4339
[gtk3] [x11] Fix coordinate space of rect in gdk_x11_window_get_frame_extents when called on popups.
This is the same fix as !4820, but applied to the gtk 3 branch.
2022-06-20 10:43:06 +02:00
Luca Bacci
b121fe8d51 GdkWin32: Add code for gtk-overlay-scrolling setting
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4899
2022-06-17 11:04:54 +02:00
John Ralls
a2c54c739e [quartz] Ensure valid GdkWindowImplQuartz references.
In case of an offscreen window find its onscreen embedder, and NULL
any GdkWindowImpl that's not quartz, checking all return values.

This replaces 16ded683, removing its unnecessary search_for_nearest
functions.

Any unchecked cast of a GdkWindowImpl to GdkWindowImplQuartz risks at
least getting an invalid member reference, not just the ones in
gdk_quartz_window_get_foo, and all calls to gdk_quartz_window_get_foo need
to be checked, not just Gtk's internal calls. The motivation was that
transient_for was getting set on a Gimp offscreen window and that caused a
crash in raise_transient.
2022-06-09 13:22:59 -07:00
John Ralls
749c863073 [quartz] Ensure GdkWindowQuartz members are either valid or NULL. 2022-06-09 13:22:59 -07:00
John Ralls
a5ad547b8b [quartz] ensure that the copy region is fully enclosed by the drawn surface. 2022-06-09 13:22:59 -07:00
John Ralls
8d4c4cdca4 [quartz] Handle scale changes using NSView::shouldInheritContentsScale.
Includes creating the CVPixelBuffer to supply the layer contents when
creating the cairo_image_surface, which reduces the number of them created
at the wrong scale.
2022-06-09 13:22:59 -07:00
Lukas Oberhuber
16ded6835c macos: Fix to offscreen window selections in Gimp 2.99 2022-05-27 21:26:50 +00:00
Matthias Clasen
75d3095a6b Merge branch 'wayland-cursor-size' into 'gtk-3-24'
wayland/cursor: Sanity check cursor image size

See merge request GNOME/gtk!4381
2022-05-27 11:02:22 +00:00
Emmanuele Bassi
1cf58407be Merge branch 'dont-dist-gresource-srcs' into 'gtk-3-24'
Don't dist some generated sources

See merge request GNOME/gtk!4738
2022-05-25 13:22:23 +00:00
Luca Bacci
02b40fd64d Merge branch 'msvcproj-nmake-install' into 'gtk-3-24'
Cleanup Visual Studio project files a bit

See merge request GNOME/gtk!4734
2022-05-25 08:23:58 +00:00
John Ralls
b94ed34f9c [quartz] Manage implementation surface lifetime.
To prevent leaking cairo surfaces while persisting the parts that
don't need to be redrawn.
2022-05-19 17:02:55 -07:00
John Ralls
df94d0168d Use a CVPixelBuffer instead of a CGImage. 2022-05-19 16:58:39 -07:00
John Ralls
be60902805 Draw window to image_surface and apply to CALayer. 2022-05-19 16:52:59 -07:00
John Ralls
2d3eb0c6a7 [quartz] Draw needs_display_region if available 2022-05-19 16:46:35 -07:00
John Ralls
8182c978db quartz: add CVDisplayLink based frame clock
This uses CVDisplayLink to drive the GdkFrameClock. A GdkWindow
can register a frame callback to thaw their frame clock as necessary
based on the next notification from CVDisplayLink.

CVDisplayLink notifies us on a high-priority thread. We use the same
NSEventas gdkeventloop-quartz.c to wakeup the main loop. This is done
so that we don’t pathologically wake up the select thread to then
continue notifying the main loop.

We use an embedded GList node in the GdkWindowImplQuartz so that we
can avoid allocating any lists or arrays for pending frame callbacks.
Compare this to the same design in GdkWindow for children.
2022-05-19 16:29:01 -07:00
Chun-wei Fan
ff847c43ad Drop win32/Makefile.msvc-introspection
We no longer use the autotools 'dist-hook' to generate the items that we
need to build introspection with the Visual Studio projects, so drop the
autotools files and bits that we had to support this.  So, for
introspection on Visual Studio via the project files, it is purely via
NMake at this point.
2022-05-19 11:33:25 +08:00