Commit Graph

7729 Commits

Author SHA1 Message Date
Mosè Giordano
0e14822a22 Fix value of MAC_OS_X_VERSION_MAX_ALLOWED 2021-05-07 11:46:47 +01:00
Guido Günther
8c0b11998d gdk/wayland: Take transform into account when setting physical size
Width and height of a GdkMonitor are derived via wl_output which
talks about physical dimensions of a device and compositors usually
implement this as the untransformed values (e.g. weston, wlroots).

Since the GTK client has no way to figure out if a monitor was rotated,
transform the physical dimensions according to the applied wayland
transform to have the physical dimensions match the logical ones.

Mutter flips the physical dimensions itself but doesn't announce the
transform so this shouldn't break anything there.
2021-05-05 18:09:07 +02:00
Matthias Clasen
fa70d08387 Merge branch 'quartz-drag-crash' into 'gtk-3-24'
Ensure gdk_quartz_drag_source freed on all paths.

See merge request GNOME/gtk!3498
2021-05-04 16:17:13 +00:00
John Ralls
a6c3887736 Ensure gdk_quartz_drag_source freed on all paths.
New release function _gdk_quartz_drag_source_context_destroy_gtk_only
gets called when drag fails to start or is cancelled as well as
when it successfully completes.
2021-05-04 08:33:56 -07:00
Chun-wei Fan
1b1dee86a5 gdkglcontext-win32.c: Fix running with Mesa drivers
Some GL drivers such as Mesa-D3D12 do not allow one to call SetPixelFormat() on
a given HDC if one pixel format has been already set for it, so first check the
HDC with GetPixelFormat() to see whether a pixel format has already been set
with the HDC, and only attempt to acquire the pixel format if one has not been
set.

This will fix running with GL on Windows using the Mesa drivers.
2021-04-29 12:17:58 +08:00
Matthias Clasen
ca6794b2d8 Merge branch 'untrusted-beep-3' into 'gtk-3-24'
x11: Don't beep on untrusted displays

See merge request GNOME/gtk!3462
2021-04-21 10:12:19 +00:00
Matthias Clasen
9c84f7645e x11: Don't beep on untrusted displays
This can trigger BadAccess, and we don't
want that.

Fixes: #3862
2021-04-20 21:41:48 -04:00
Matthias Clasen
536da7a15c Fix a possible crash in gtk_show_uri
g_file_get_basename can return NULL.
Deal with it somehow.

Fixes: #3883
2021-04-19 16:52:55 -04:00
John Ralls
242b76a771 Add a public header for Cocoa access functions.
Some applications need to access gdk_quartz_window_get_nsview,
gdk_quartz_window_get_nswindow, and gdk_quartz_event_get_nsevent
so move these from the private gdkquartz-gtk-only.h to a new
header gdkquartz-cocoa-access.h. Don't include this header in
gdkquartz.h so that user code that doesn't need to access these
functins isn't required to compile with Objective C/C++.

Closes https://gitlab.gnome.org/GNOME/gtk/-/issues/1737
2021-04-16 16:56:55 -07:00
Matthias Clasen
3a70781d40 Merge branch 'fix_elcapitan_support' into 'gtk-3-24'
Fix building on OS X El Capitan 10.11

See merge request GNOME/gtk!3402
2021-04-16 20:02:09 +00:00
Chun-wei Fan
416e6b9cdd gdkglcontext-win32.c: Avoid C4715 warning
We can just group the code for the desktop GL codepath and the EGL
codepath a bit so that we can just have a single location where we
return TRUE upon a successful setup of our WGL/EGL context, and avoid
the C4715 warning that is considered an error when building with
GLib-2.68.x or later using Visual Studio, when we are building without
EGL support.
2021-04-16 15:08:41 +08:00
Matthias Clasen
c3503fcc84 x11: Be quiet on exit by default
The condition we check for to catch X servers going away
may not be accurate anymore, and the warning shows up in
logs, causing customers to be concerned. So, be quiet by
default, unless the user explicitly asked for a message.
2021-04-13 20:42:21 -04:00
Matthias Clasen
dfea8c31d9 wayland: Improve font setting fallback more
We may get a response from the portal that contains
no useful settings at all. In that case, we should
fallback as well.

Fixes: #3838
2021-04-07 14:30:48 -04:00
Matthias Clasen
a3ff6e279c wayland: Improve font setting fallback
When we don't get stettings from the portal, the current
fallback is 'awful fonts'. There is no need for that. Instead,
set the fallback values to grayscale antialiasing with slight
hinting.
2021-04-07 08:43:08 -04:00
René de Hesselle
8627a9a569 Fix building on OS X El Capitan 10.11
The preprocessor directives for proper OS version support are missing
their last digit, rendering the checks defunct.

Improves on https://gitlab.gnome.org/GNOME/gtk/-/issues/3592 but does
not fully fix as other issues have surfaced down the line.
2021-04-05 22:20:25 +02:00
Robert Mader
86ef0e6094 gdk/wayland: Defer processing of globals closures
... until all globals have been received.

The dependency tracking introduced in 4e9be39518 only allows to
specify required globals and processes the closures as soon as
the requirements have been met. There are, however, also optional
dependencies - most notably the primary_selection protocol.
Currently we rely on the fact that compositors like Mutter announce
it before `wl_seat`, even though the order is not specified in
the spec.

Process globals closures only after all globals have been announced,
so optional dependencies can be accommodated.

Closes https://gitlab.gnome.org/GNOME/gtk/-/issues/3791
2021-03-30 15:10:04 +02:00
Matthias Clasen
71c64e650d Merge branch 'gtk-3-24-minimize-no-decorations' into 'gtk-3-24'
GDK quartz: Keep window without decoration miniaturizable

See merge request GNOME/gtk!3281
2021-03-27 03:32:07 +00:00
Olivier Fourdan
39db784704 x11/dnd: Ignore XErrors from the COW
The DnD code for X11 adds the composite overlay window (aka COW) to the
cache.

Yet the X11 requests to get and release the COW may trigger XErrors that
we ought to ignore otherwise the client will abort.

Fixes: #3715
2021-03-22 15:35:13 +01:00
Matthias Clasen
1ce5494ffd wayland: Pass layout information in key events
We were always setting group to 0, causing accelerator
interpretation to always go off the first configured
layout, not the active one.

Fixes: #1825
2021-03-15 14:48:05 -04:00
Matthias Clasen
b94955e614 Merge branch 'gdk-win32-use-window-from-point-api' into 'gtk-3-24'
GdkWin32: Fix mouse events in presence of transparent windows on the desktop

See merge request GNOME/gtk!2767
2021-03-11 01:10:20 +00:00
Cédric Krier
238bb38249 Keep window without decoration miniaturizable
Closes #2345
2021-03-10 16:08:14 +01:00
Knuckx
d7d6098281 WinTab - Add support for Wheel/Rotation axis - Rebase and fix conflicts for merge 2021-03-05 23:35:29 +00:00
Steven Calwas
86d38e6ae2 Fix window unresponsive to mouse after app-switch w/drawing tablet
Partially fixes issue #2191 regarding switching to another app while
hovering a stylus over a drawing tablet causes subsequent mouse
clicks in the app to be ignored. I was not able to reproduce the
other behavior described in #2191 concerning tiling a window.
2021-03-05 14:37:29 -05:00
Matthias Clasen
94befed65f Merge branch 'issue1549' into 'gtk-3-24'
Handle Wintab cursors that are recognized after GDK app init

See merge request GNOME/gtk!2458
2021-03-05 18:53:42 +00:00
Luca Bacci
fa2ae10599
Fix leak of event structures
Inside generate_button_event, if _gdk_input_ignore_core is > 0 we
leak an event structure. Fix that.
2021-03-01 10:51:38 +01:00
Sebastian Dröge
ac69c05a31 Use the proper cairo.Format type instead of overriding to gint via annotations in gdk_window_create_similar_surface() 2021-02-20 12:43:53 +02:00
Carlos Garnacho
4d30400987 gdk/wayland: Look for font settings recursively
Use the infrastructure already available to look up keys, instead.
This does the right thing and looks up the setting across all
sources.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3680
2021-02-18 16:51:28 +01:00
Robert Mader
d3316a37ed wayland/window: Add API to add extra surfaces for frame callbacks
This is useful when clients use subsurfaces independently of GDK.
For example if a client creates a subsurface that covers a GdkWindow
entirely. If this subsurface is opaque, Wayland compositors may not
emit callbacks for the surface of the GdkWindow any more.
Adding the covering subsurface via this new API ensures the
GdkWindow will continue to update in this case.
2021-02-12 13:18:29 +01:00
Jonas Ådahl
ddb9bae3d4 Merge branch 'gtk-surface-release-3-24' into 'gtk-3-24'
Support gtk-shell surface release destructor

See merge request GNOME/gtk!2074
2021-01-29 16:21:09 +00:00
Matthias Clasen
a8c12a4c96 Merge branch 'gtk-3-24' into 'gtk-3-24'
Adds support for Android/Chrome on-screen keyboard

See merge request GNOME/gtk!3130
2021-01-29 00:59:15 +00:00
Maxim Zakharov
b31a80cd64 Adds support for Android/Chrome on-screen keyboard
Adds event listener for input events; converts input data into
key press and key release commands depending on inputType of the event.
2021-01-29 11:23:51 +11:00
Carlos Garnacho
02a02fac56 gdk/wayland: Mark matched settings from the portal as valid
Commit e6209de962 added some checks on TranslationEntry.valid in
order to figure out whether using the new font settings or the
old g-s-d ones. However that's only set in the non-sandboxed case.

This makes sandboxed applications fallback to the old (and also
non-existing with modern g-s-d) settings, possibly resulting in
ugly defaults being picked.

Fix this by also marking TranslationEntry elements as valid when
using the settings portal, precisely those entries that we are able
to read and match with our own table.
2021-01-14 16:09:27 +01:00
Carlos Garnacho
7ab4c9a68b Merge branch 'fix-tablet-3.24' into 'gtk-3-24'
Wayland: Fix segfault when receiving tablet/touch events for surfaces that have already been destroyed client-side

See merge request GNOME/gtk!2809
2021-01-10 13:18:15 +00:00
wisp3rwind
19a740e277 Wayland: ignore touch/tablet events on destroyed surfaces
When destroying a wl_surface (e.g. when a window or menu is closed), the
surface may continue to exist in the compositor slightly longer than on
the client side. In that case, the surface can still receive input
events, which need to be ignored gracefully.
In particular, this prevents segfaulting on wl_surface_get_user_data()
in that situation.

Reported in
https://gitlab.gnome.org/GNOME/gtk/-/issues/3296

The same issue for pointers/keyboards was reported in
https://bugzilla.gnome.org/show_bug.cgi?id=693338

and fixed with in
bfd7137ffb
3625f17857
a8fc099a72
2021-01-10 12:00:28 +01:00
Carlos Garnacho
cae5e60113 Merge branch 'avoid-pointer-reset' into 'gtk-3-24'
wayland: avoid set_cursor() when unchanged or invisible

See merge request GNOME/gtk!2822
2021-01-06 19:53:30 +00:00
Matthias Clasen
c87b21351c Merge branch 'workaround-win32-intel-blit' into 'gtk-3-24'
gdkglcontext-win32.c: Workaround Intel glBlitFramebuffer() issues

See merge request GNOME/gtk!2996
2021-01-06 16:13:02 +00:00
Chun-wei Fan
79e512ab0b gdkglcontext-win32.c: Workaround Intel glBlitFramebuffer() issues
Intel OpenGL drivers have an issue where the results of a series of
glBlitFramebuffer() can delay updating the display, when we use GDK_GL=always,
which is manifested when attempting to enter text in text boxes.

This attempts to work around this issue by requiring a glFlush() call and a
retry to the same glBlitFramebuffer() calls to avoid delays in keystrokes when
using GDK_GL=always and when not using libANGLE OpenGL/ES emulation, when an
Intel OpenGL driver is being used.

Special thanks to Lukas K. for the analysis and coming up with a workaround,
which this patch builds upon.

Fixes issue 3487
2020-12-23 19:01:31 +08:00
Maxim Zakharov
ba845fa7b2 fix touchscreen events processing in broadway.js
Makes event listeners active explicitly if supported; corrects
handling for deleted surfaces preventing javascript errors in
accessing deleted objects; makes event identifiers unique for
broadwayd when executing in Chrome on Android.

Partially fixes #1493
2020-12-18 12:22:47 +11:00
Adrien Plazas
c4f8eb7ec9 gdkpixbuf-drawable: Free the pixbuf on Cairo error
This avoids leaking the pixbuf.
2020-12-14 16:18:45 +01:00
wisp3rwind
cf7f7df10c wayland: avoid set_cursor() when unchanged or invisible
In pointer_surface_update_scale(), only rescale the cursor surface when
the scale has actually changed and the cursor is on at least one output.

fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3350

Right now, this issue is not completely understood, so it might also
involve some questionable handling of cursor surface by sway/wlroots.

However, irrespective of that issue, this patch avoids unnecessary calls to the
compositor, and there should be no drawback: Whenever the pointer enters
a new output, pointer_surface_update_scale() will be called again, such
that correct scaling of the cursor is still ensured.

There is a slight difference: When the cursor leaves the last output,
previously the image was reset to scale factor 1. Now, it keeps whatever
was last. That might be more sensible than the previous behaviour,
assuming that it's likely that when the cursor enter an output again, it
has the same scaling. Alternatively, if one cares about resource usage
at this level, it might make more sense to destroy the surface then
rescaling to 1.
2020-11-13 16:20:02 +01:00
Luca Bacci
67be62aeaf
GdkWin32: Fix mouse events in presence of transparent windows on the desktop
In gdkdevice-win32.c we are interested in knowing which window
receives mouse input at a specific location.

Only WindowFromPoint is the right API for the task, other API's
(such as (Real)ChildWindowFromPoint(Ex)) have shortcomings because
they are really designed for other purposes. For example, only
WindowFromPoint is able to look through transparent layered windows.

So even if we want to find a direct child we have to use
WindowFromPoint and then walk up the hierarchy.

Fixes: #370, #417
See: !2767
2020-11-11 14:34:40 +01:00
Jonas Ådahl
ba31560970 wayland: Bail loudly if invalid geometry is set
There is some bug somewhere where the geometry ends up being correct.
Mutter didn't handle this gracefully, and is to be changed to simply
respect the protocol and error out the client that sends bogus data.

Prepare for this by instead of sending bogus data, complain loudly if it
would happen dropping the invalid geometry on the floor instead of
sending it.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/1527
2020-11-11 10:17:59 +01:00
kai-berlin
bd4b55ddbf broadway: Set modifier state of scroll events
Set modifier state of scroll events, so Ctrl-scroll
works.

Fixes: #2733
2020-11-03 19:43:21 -05:00
Sam Bazley
a91de44755 gdk: Fix parent relative background crash
When setting a window's background to ParentRelative on X11, the window
depths must match to avoid a BadMatch error. Query the X server for the
parent window rather that relying on the parent passed to
gtk_window_new() to prevent crashes with reparented windows.

Fixes: #3288
2020-10-27 18:29:21 +00:00
John Ralls
d0b09a8823 [imquartz] Set the filter key to passthrough regardless of selector.
Remove all of the selectors. They just set the passthrough anyway so
there's not much point to maintaining them and they weren't the
complete set of possible selectors.
2020-10-13 14:36:12 -07:00
LRN
69b43edd55 Merge branch 'w32-transient-ordering-rollback' into 'gtk-3-24'
GDK W32: transient Z-order rollback

See merge request GNOME/gtk!1769
2020-10-08 05:16:11 +00:00
Matthias Clasen
88e8a5272e Merge branch 'cursor-docs' into 'gtk-3-24'
gdkcursor: Add annotations for gdk_cursor_new_for_display()

See merge request GNOME/gtk!2640
2020-09-29 13:32:36 +00:00
Philip Withnall
4d5368e56e gdkcursor: Add annotations for gdk_cursor_new_for_display()
It can fail on Wayland, and is also (transfer full).

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2020-09-29 14:05:38 +01:00
Robert Mader
5bd8f8c5a3 gdk/wayland: Add support for primary-selection-unstable-v1
Additionally to gtk_primary_selection, the gtk-private predecessor,
support the upstream unstable protocol.

This allows the primary selection to work on Kwin and potentially
other compositors, as well as dropping the private version eventually.

Closes https://gitlab.gnome.org/GNOME/gtk/-/issues/2591
2020-09-27 13:40:40 +02:00
Jonas Ådahl
a184b5bf51 wayland: Emit dummy configure event when resizing while fixed
When a fixed size is active (e.g. the window is maximized),
gtk_window_resize() shouldn't take immediate effect, so the request was
dropped. This made GTK unhappy if this happened, it will freeze updating
the window until it received the new size it demanded.

Handle this by being nice and emitting a dummy GDK_CONFIGURE event with
the old size where we previously ignored it. It won't resize the window
immediately, so it shouldn't have a visible effect, and the size GTK
requested is still saved away for when the window is unmaximized, but
emitting the event will make GTK receive the event it expects.

We still drop the request on the floor, e.g. if we still haven't seen
the initial configuration, just as we do when actually doing the resize.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2907
2020-09-07 17:57:32 +02:00