Commit Graph

10588 Commits

Author SHA1 Message Date
Florian Müllner
317209597d wayland/display: Don't force HighContrast icon theme
The theme is considered deprecated in favor of symbolic icons from
the regular theme.

Cherry-picked from main.
2022-06-08 14:33:07 -04:00
Carlos Garnacho
1cdb6ada4e 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

(cherry-picked from commit 4b41d4f78c)
2022-06-03 13:04:15 +02:00
Carlos Garnacho
56607e8cfe 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.

(cherry-picked from commit fb68600d88)
2022-06-03 13:03:58 +02:00
Benjamin Otte
53c02a1e84 broadway: Fix gcc 12 complaining 2022-05-28 08:12:37 -04:00
Matthias Clasen
75821de2d7 wayland: scale cursors to the right size
When loading cursors at scale, we expect the
cursor images to have a size of scale * size.
If we don't find such images, load them at their
unscaled size and scale them up ourselves.

Without this, cursors will appear in unexpected
sizes depending on scales and themes.

Related: #4746
2022-05-27 13:05:18 -04:00
Matthias Clasen
c47759bd3d wayland: Make cursors have the right size
The Wayland protocol requires that width and height
of cursor surfaces is an integer multiple of the
surface scale. Make it so.

Fixes: #4746
2022-05-27 06:59:17 -04:00
Matthias Clasen
c543206d79 wayland: Sanity check cursor image size
On Wayland it is a protocol violation to upload buffers with
dimensions that are not an integer multiple of the buffer scale.

Until recently, Mutter did not enforce this. When it started
doing so, some users started seeing crashes in GTK apps because the
cursor theme ended up with e.g. a 15x16 pixel image at scale of 2.

Add a small sanity check for this case.
2022-05-27 06:59:10 -04:00
Benjamin Otte
22288d9854 x11: Always update shadow size
Not updating shadow size unconditionally would lead to shadow size not
being set on map, which would lead mutter to think that we are a Window
without extents and then become confused when we suddenly set some.

Make sure that doesn't happen by always having shadows set on map, just
like GTK3.

Fixes #4136


(cherry picked from commit 213490099b)
2022-05-26 11:19:04 +00:00
Loïc Minier
394e0ab3be egl: Fix invalid format string
(cherry picked from commit 4f2b1b3cfc)
2022-05-13 21:05:58 +00:00
Christian Hergert
f737131d27 gdk/wayland: freeze popups when hidden
Previously, there was an issue with glitching after showing/hiding a
popover that was not also destroyed. This was due to the popover having
an update_freeze_count of zero after hiding the surface.

That resulted in it's toplevel continuously dropping frames such as during
high-frame-rate scrolling in textviews. This problem is much more visible
on high-frame-rate displays such as 120hz/144hz.

With this commit, we freeze the frame clock of the popup until it is
mapped again.
2022-05-11 16:32:17 -04:00
Matthias Clasen
55a4b4a174 gdk: Check OES_vertex_half_float GLES extension
This will be checked in the GL renderer.
2022-05-07 10:30:38 -04:00
Xavier Claessens
91c60dcac0 Remove #ifdef ENABLE_NLS
libintl API is guaranteed to always be available, glib will fallback to
proxy-libintl in case gettext is not found.
2022-04-21 19:18:00 -04:00
Dr. David Alan Gilbert
66117d1017 x11: Check return of gdk_x11_get_xatom_name_for_display
When given an invalid atom, gdk_x11_get_xatom_name_for_display can
return NULL and trigger a seg in gdk_x11_clipboard_formats_from_atoms.
Check for NULL.

Why I'm seeing a bad atom there is probably a separate question.
https://bugzilla.redhat.com/show_bug.cgi?id=2037786
2022-04-21 19:17:54 -04:00
Christian Hergert
cbd03cda56 gdk/gl: handle GL_RGBA/GL_UNSIGNED_NORMALIZED
WebKit's GTK 4 port can give us textures with an internal format of
GL_RGBA with GL_UNSIGNED_NORMALIZED and a bit-depth of 8. This fixes
warnings for every GdkGLTexture created/delivered to the GskGLRenderer.

The format is essentially the same as GL_RGBA8 since it is normalized
between 0.0..1.0 for 8-bit components.

Fixes #4783
2022-04-21 19:15:05 -04:00
Sebastian Keller
018bbd6774 surface: Use correct display when destroying a surface for depth switch
When surface depth switches from non-high-depth to high-depth (or vice
versa) the current surface has to be destroyed before a new one can be
created for this window. eglDestroySurface however was getting passed a
GdkDisplay, rather than the EGLDisplay it expects. As a result the old
surface did not get destroyed and the new surface could not be created
causing rendering to freeze.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4773
2022-04-21 19:14:32 -04:00
Luca Bacci
88db5509a3 GdkWin32: Generate crossing event after button release
Fixes #4813
2022-04-08 15:26:48 +02:00
Luca Bacci
7538ff9798 GdkWin32: Correct generation of crossing events when holding an implicit grab
Fixes #4722
2022-04-08 15:26:37 +02:00
Luca Bacci
c0a60ece97 GdkWin32: Report serial for events 2022-04-08 15:26:26 +02:00
Luca Bacci
c799b05f2a Merge branch 'backport-4406-4.6' into 'gtk-4-6'
gdkclipboard-win32.c: Fix call to gdk_clipboard_claim_remote() (backport MR !4604 to gtk-4-6)

See merge request GNOME/gtk!4608
2022-04-08 08:30:48 +00:00
Christian Hergert
d468dd2f3b Merge branch 'sumibi-yakitori/fix-minimize-window-macos' into 'main'
macos: Fix problem that window cannot be minimized by user operation

Closes #4811

See merge request GNOME/gtk!4613

(cherry picked from commit d75147db0a)

d3cf7088 macos: Skip running `showAndMakeKey` when a window is minimized by user action
2022-04-04 18:53:35 +00:00
Christian Hergert
029fc0fdef Merge branch 'sumibi-yakitori/fix-maximize-window-macos' into 'main'
macos: prohibit fullscreen transition if in transtion

This prevents performing additional fullscreen transitions while
a transition is already in progress.

Closes #4808

See merge request GNOME/gtk!4612

(cherry picked from commit 15b7a4572b)

69a0a5cf macos: Prohibit changing the full-screen state of a window during a full-screen transition
229e4b58 macos: Corrected code style
2022-04-03 22:15:16 +00:00
Chun-wei Fan
edd8d55b42 gdkclipboard-win32.c: Fix call to gdk_clipboard_claim_remote()
The call to gdk_win32_clipboard_request_contentformats() can return NULL even
without an error condition being hit (such as when the system clipboard is
empty), so check whether the returned GdkContentFormat pointer is not NULL
before calling gdk_clipboard_claim_remote(), which expects it to be not NULL,
otherwise we face a warning from that funtion and the subsequent
g_object_unref().

This at least partially fixes issue #4796.
2022-04-01 10:28:37 +08:00
Matthias Clasen
8a12628af9 Merge branch 'wip/carlosg/backports-4-6' into 'gtk-4-6'
Backport fixes to 4.6

See merge request GNOME/gtk!4577
2022-03-17 01:50:18 +00:00
Christian Hergert
73d5f7061b macos: exclude popups from window list
This probably only matters if you do window list integration for the global
menu on macOS.
2022-03-16 12:25:10 -07:00
Christian Hergert
ccbaa020ff macos: pass events to foreign windows 2022-03-16 12:25:10 -07:00
Christian Hergert
a9c89fa23e macos: dont steal key window from NSPanel
Or we risk making it really difficult to use native file choosers.
2022-03-16 12:25:10 -07:00
Christian Hergert
36730537cc macos: fix window level for popups
This comment isn't really accurate anymore it seems, so we can start
setting the proper stacking order for popups now.
2022-03-16 12:25:10 -07:00
Christian Hergert
9456f6eea1 macos: fix attachment of popups to parents
We had code to do it and it never actually got used correctly. This ensures
that the popup services are attached to the parents so that they get proper
stacking orders when displayed. Additionally, it fixes popups from being
shown as their own windows in Exposé.
2022-03-16 12:25:10 -07:00
Christian Hergert
2c630a74cd macos: fix window activation during shadow click-through
If we are clicking through the shadow of a window, we need to take special
care to not raise the old window on mouseUp. This is normally done by the
display server for us, so we need to use the proper API that is public to
handle this (rather than CGSSetWindowTags()). Doing so requires us to
dispatch the event to the NSView and then cancel the activcation from
the mouseDown: event there.
2022-03-16 12:25:10 -07:00
Christian Hergert
9462b3fea2 macos: select new key window after processing events
If we closed a key window in response to events, we need to denote another
window as the new key window. This is easiest to do from an idle so that
we don't clobber notification pairs of "did resign"/"did become" key
window.

We have a sorted set of surfaces by display server stacking, so we can
take the first one we come across that is already mapped and re-show it
to become key/main.
2022-03-16 12:25:10 -07:00
Christian Hergert
d62313e75c macos: request layout with server-side decoration
If we have server-side decorations we might need to request a layout in
response to the resize notification. We don't need to do this in other
cases because we already handle that in the process of doing the resize
(and that code is that way because of delayed delivery of NSNotification).
2022-03-16 12:25:10 -07:00
Christian Hergert
023bf9aea7 macos: fix resize when using server-side decorations
If we are using NSWindow titled windows, we don't end up waking up the
frame clock when the window is resized on the display server. This ensures
that we do that after getting a notification of resize.
2022-03-16 12:25:10 -07:00
Christian Hergert
4bc593c761 macos: set main window in addition to key
If we are showing the window, we might also want to make it the main
window for the application when shown.
2022-03-16 12:25:10 -07:00
Christian Hergert
f47e6dda78 macos: make transient-for key window when hiding surface
This only handled the popover case before and not the transient-for case.
2022-03-16 12:25:10 -07:00
Christian Hergert
5c2d9d6f19 macos: actually drop unnecessary momentum events
These would get passed along to the NSApplication which we don't really
need to have happen. Denote it as such.
2022-03-16 12:25:10 -07:00
Christian Hergert
5efa8071d6 macos: queue all pending events
Rather than process these a single event at a time, queue all of the
outstanding events from the NSEvent queue.
2022-03-16 12:25:10 -07:00
Christian Hergert
659832ccab macos: drop enter/exit when in manual drag/resize
If we are in a manual resize/drag then we don't want to generate crossing
events as they can just confuse things.
2022-03-16 12:25:10 -07:00
Christian Hergert
913f6d4a4f macos: allow dropping NSEvent without propagation
There are cases we might want to consume a NSEvent without creating a
GdkEvent or passing it along to the NSApplication for processing. This
creates a new value we can use and check against to propagate that without
having to do out parameters at the slightly odd invalid pointer value for
a GdkEvent (similar to how MMAP_FAILED is done).
2022-03-16 12:25:10 -07:00
Christian Hergert
cb386ec2a2 macos: do not focus new window when resigning main
This can get in the way of how we track changes while events are actively
processing. Instead, we may want to delay this until the next main loop
idle and then check to see if we have a main window as the NSNotification
may have come in right after this.
2022-03-16 12:25:10 -07:00
Christian Hergert
2f873052f9 macos: fix cursor blink time
The value from settings is for the duration of the blink period, not the
timeout. This fixes the blink lasting longer than 10 seconds.
2022-03-16 12:25:10 -07:00
Christian Hergert
60aceb984f macos: require input region to become key
Some things cannot become key windows (like tooltips). We can use the
input_region existence to determine if we should allow it as a key window.
2022-03-16 12:25:10 -07:00
Christian Hergert
9dbd79f2d8 macos: clear window stack before requesting motion
We want to ensure that we recalculate the sort order of windows before
processing the motion. Generally this would be done in response from the
display server in GdkMacosWindow, but I've seen it possible to race there.
2022-03-16 12:25:10 -07:00
Christian Hergert
0aabf47f09 macos: invalidate surface contents when mapping 2022-03-16 12:25:10 -07:00
Christian Hergert
2961cc44c5 macos: move children when monitor changes
We can rely on other code to move monitors, but specifically with children
we want to try harder to move them as a group and keep positioning in tact.
2022-03-16 12:25:09 -07:00
Christian Hergert
46da364289 macos: make move_resize possibly idempotent
We need to handle the case where we might be racing against an incoming
configure event due to how notifications are queued from the display
server. Rather than calling configure (and possibly causing other things
to move around) this just queries the display server directly for the
coordinates that we care about.

Additionally, we can display:NO as we are in control of all the display
process now using CALayer.
2022-03-16 12:25:09 -07:00
Christian Hergert
cb99370ce4 macos: handle transient-for from configure
We failed to handle the toplevel with transient-for case here which could
cause our X/Y calculations to be off in other areas such as best monitor
detection.
2022-03-16 12:25:09 -07:00
Christian Hergert
c2d1a21f9c macos: use parent frame clock again
We do actually need the parent frame clock here because it is the way we
ensure that we get layout called for our popup surfaces at the same time
as the parent surface.
2022-03-16 12:25:09 -07:00
Christian Hergert
edc6790fbb macos: reduce chances for layout cycles
We need to be more careful about when we request a layout because it can
cause us to get into a layout cycle at maximum frame rate.
2022-03-16 12:25:09 -07:00
Christian Hergert
b0d7889b20 macos: improve initial placement of toplevels with parent
This doesn't appear to happen much, but if it does it is nice to setup
the window placement initially. Generally, transient-for is set after
the creation of the toplevel rather than here.
2022-03-16 12:25:09 -07:00
Christian Hergert
867f2de194 macos: leave a note about monitor configuration
It can be helpful to see what the range of monitor values is when emulating
the GDK coordinate system.
2022-03-16 12:25:09 -07:00