Commit Graph

10638 Commits

Author SHA1 Message Date
Benjamin Otte
988e20cd53 frameclock: Run paint idle from flush idle
Don't return to the main loop, instead force a run of the paint idle.
The paint idle will know to skip all the phases that aren't requested.

This is critically important becuase gdksurface.c assumes the
FLUSH_EVENTS and RESUME_EVENTS phases are matched, and we cannot
guarantee that if we return to the main loop and let various reentrant
code change the frame clock state.

This would lead to bugs with events being paused and never unpaused
again or even crashes.

Fixes #4941
2022-07-10 21:33:32 +02:00
Benjamin Otte
813dd0a674 gdk: Replace GTK_USE_PORTAL env var with GDK_DEBUG flag
It's a debug flag, so make it clear that it is one.

Related: Clowns on the Arch wiki on
https://wiki.archlinux.org/title/Uniform_look_for_Qt_and_GTK_applications#Consistent_file_dialog
2022-06-24 03:14:50 +02:00
Matthias Clasen
0660bb834e Merge branch 'bad-popup-extents' into 'main'
[x11] Fix coordinate space of rect in gdk_x11_surface_get_frame_extents when called on popups.

See merge request GNOME/gtk!4820
2022-06-23 11:59:55 +00:00
Matthias Clasen
40e09cf2bb Merge branch 'wip/xdg-toplevel-bounds' into 'main'
wayland: Add supports for xdg_toplevel.bounds

See merge request GNOME/gtk!4261
2022-06-22 14:24:41 +00:00
Emilio Cobos Álvarez
5301a74bd3
[x11] Fix coordinate space of rect in gdk_x11_surface_get_frame_extents when called on popups.
If we take the early return we don't unscale this at the bottom of the
function, causing wrong coordinates in HiDPI screens.

This bug also affects GTK3 (I noticed this running Firefox tests on X).
2022-06-20 10:13:21 +02:00
Luca Bacci
83c780cfad GdkWin32: Add code for gtk-overlay-scrolling setting
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4899
2022-06-17 11:06:43 +02:00
Jonas Ådahl
de1a8c8d89 wayland: Add support for xdg_toplevel.bounds
The GdkToplevelSize struct already has the concept of "bounds", which
means the largest size a window should reasonably have. It's practically
the equivalent of the monitor the window is intended to be mapped on,
with the "struts" (e.g. panels) cut out. It's used by GTK to use this
information to calculate a default window size that is "lagom" (swedish;
not too large, not too small).
2022-06-13 22:12:55 +02:00
Florian Müllner
c3706ea9ec wayland/display: Don't force HighContrast icon theme
The theme is considered deprecated in favor of symbolic icons from
the regular theme.
2022-06-07 19:34:50 +02:00
Matthias Clasen
1f3674cf3e Merge branch 'matthiasc/for-main' into 'main'
gdk: Improve GdkTimeCoord docs

See merge request GNOME/gtk!4795
2022-06-06 13:12:15 +00:00
Matthias Clasen
c76069389c gdk: Improve GdkTimeCoord docs 2022-06-06 08:55:51 -04:00
Benjamin Otte
45422f7b61 Merge branch 'gl-api-es-fix' into 'main'
glcontext: Respect ES API when getting gl version from shared context

Closes #4763

See merge request GNOME/gtk!4687
2022-06-04 20:26:58 +00:00
Pablo Correa Gómez
c4feca1311
glcontext: Simplify get_required_version api
Simplify the API to just return the requirements that the user
has asked for. The rest of the code was undocumented and previously
used as a buggy source for a default value from internal code.
Since the buggy code is now fixed, remove all unnecessary cruft.
2022-06-04 20:48:40 +02:00
Pablo Correa Gómez
9426b20759
glcontext: Do not check for correctness in set_required_version
There are two reasons for this:
 * First, the refactored realize code now makes sure that no
   context with unsupported version is ever created.
 * Second, this code could bump into false possitives and negatives, since
   the user is not requested, nor expected to set_required_version
   in any specific order relative to set_allowed_apis. Therefore,
   some version could be rejected or accepted based on a set of
   allowed apis that the user has not yet correctly configured.
2022-06-04 20:48:40 +02:00
Pablo Correa Gómez
f97cff1454
glcontext-glx: Refactor realize function
Mimic the behavior of the egl context creation by stablishing
some sane logic for the api and version used. Split the decision
of the type of context (api, legacy) and the creation of a context
of a certain version and all its properties.
2022-06-04 20:48:40 +02:00
Pablo Correa Gómez
549a2b4c86
glcontext: Refactor realize function, fix interaction with shared context 2022-06-04 20:48:40 +02:00
Pablo Correa Gómez
f4f0daa113
macosglcontext: Do not rely on default from get_required_version
get_required_version cannot warranty to return any default. Instead,
fetch the user requisites clipped by the requirements in our backend.
2022-06-04 20:48:40 +02:00
Pablo Correa Gómez
d4f8a80f2a
glcontext-win32-wgl: Respect user required version, use display as minimum
By setting and then getting the required version in a context, the code
was not respecting user requirements. Instead, simply get the requested
version by the user clipped by the requirements (display version)
2022-06-04 20:48:40 +02:00
Pablo Correa Gómez
8d175801d7
glcontext: Add internal get_clipped_version function
It is useful for backends to get user set preferences while
ensuring the correctness of the result, which will be always
greater or equal than the minimum version provided
2022-06-04 20:48:40 +02:00
Pablo Correa Gómez
6bc3ecbe56
glcontext: Improve get_version documentation 2022-06-04 20:48:29 +02:00
Carlos Garnacho
4b41d4f78c 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
2022-06-02 23:08:40 +02:00
Carlos Garnacho
fb68600d88 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.
2022-06-02 23:08:40 +02:00
Pablo Correa Gómez
826fdc4a80
glcontext: Improve documentation on get_use_es api 2022-05-30 20:48:47 +02:00
Matthias Clasen
5507b3f8c1 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 12:26:45 -04:00
Matthias Clasen
23f92ca1c2 Merge branch 'wayland-cursor-scale' into 'main'
wayland: Sanity check cursor image size

Closes #4746

See merge request GNOME/gtk!4761
2022-05-27 10:58:12 +00:00
Matthias Clasen
34a9bc4632 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-26 22:29:37 -04:00
Matthias Clasen
d603164ec2 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-26 22:29:37 -04:00
Matthias Clasen
c089912a52 Merge branch 'wip/otte/for-main' into 'main'
x11: Always update shadow size

Closes #4136

See merge request GNOME/gtk!4758
2022-05-26 10:03:39 +00:00
Benjamin Otte
213490099b 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
2022-05-26 04:38:29 +02:00
Luca Bacci
7752467847 Drop pointer_emulated discrete scroll events
GTK4 has had smooth scroll events since the beginning, so we
prefer not to emit emulated discrete scroll events at all
2022-05-24 12:30:49 +00:00
Luca Bacci
8514457d0f Wayland: Only send smooth scroll events for tablet tools 2022-05-24 12:30:49 +00:00
Luca Bacci
8a6d6fe6b1 DirectManipulation: Account for DPI scale 2022-05-24 11:37:06 +02:00
Luca Bacci
288dd406e0 GdkWin32: Plug memory leak 2022-05-19 08:49:05 +02:00
Luca Bacci
8f19099f1a GdkWin32: Add support for DirectManipulation
Adds support for Precision TouchPads (PTPs) gestures
and scroll events.
2022-05-15 14:37:55 +02:00
Benjamin Otte
926eb161f8 broadway: Fix gcc 12 complaining 2022-05-14 16:53:44 +02:00
Matthias Clasen
4278e91a46 Merge branch 'texture-fixes' into 'main'
Fixes for gdk_memory_texture_new_subtexture

See merge request GNOME/gtk!4724
2022-05-13 16:38:45 +00:00
Matthias Clasen
f33c521836 Fixes for gdk_memory_texture_new_subtexture
There were several mistakes here.

The width of subtextures was set to the width of
the main texture, the data size wasn't properly
calculated, and the preconditions were inverted.
Yay us!
2022-05-13 09:30:46 -04:00
Loïc Minier
4f2b1b3cfc egl: Fix invalid format string 2022-05-12 09:06:20 -04:00
Sophie Herold
a546ae32d7 Remove all nicks and blurbs from param specs
Those property features don't seem to be in use anywhere.
They are redundant since the docs cover the same information
and more. They also created unnecessary translation work.

Closes #4904
2022-05-11 18:16:29 +02:00
Pablo Correa Gómez
0f21f6c273 glcontext: Make the creation of EGL context more obvious
By splitting it into its own function it becomes more that the
EGL code is a shared implementation.
2022-05-10 12:29:08 +02:00
Christian Hergert
4bf07aeef9 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-10 07:28:25 +03:00
Matthias Clasen
dacca9ece0 Merge branch 'check-half-float' into 'main'
gdk: Check OES_vertex_half_float GLES extension

See merge request GNOME/gtk!4689
2022-05-06 18:02:05 +00:00
Luca Bacci
66a0e0a59e GdkWin32: Send smooth scroll events
Bring back smooth scroll events as the issues mentioned
in [1] do not occur anymore. Also rework code style and
comments.

References:

  [1] GTK4: Scrolling hides mouse on windows
      https://gitlab.gnome.org/GNOME/gtk/-/issues/3581

  [2] Why are mouse wheel messages delivered to the focus window
      instead of the window under the mouse?
      https://devblogs.microsoft.com/oldnewthing/20160420-00/?p=93325
2022-05-06 15:01:59 +02:00
Matthias Clasen
158963ff77 gdk: Check OES_vertex_half_float GLES extension
This will be checked in the GL renderer.
2022-05-05 13:21:25 -04:00
Jonas Ådahl
f1551a87f6 x11: Trap errors happening when getting output properties
This is to avoid getting X11 errors (thus aborting/exiting with a
failure) during rapid hotplugs, which may happen during e.g. CI testing.
2022-05-02 17:28:36 +02:00
Luca Bacci
cb0c1b3f08 GdkWin32: Generate crossing event after button release
Fixes #4813
2022-04-06 20:27:46 +02:00
Luca Bacci
91f200167e GdkWin32: Correct generation of crossing events when holding an implicit grab
Fixes #4722
2022-04-06 20:27:32 +02:00
Luca Bacci
2b6fb005a8 GdkWin32: Report serial for events 2022-04-06 19:45:50 +02:00
Hemidark
0c44851848 gdk: always populate GDK_AXIS_{X,Y} in merged event history
Since GdkTimeCoord stores only axis values, prior to this change,
if a device didn't report GDK_AXIS_X or GDK_AXIS_Y, the history
attached to merged motion events wouldn't contain any positional
information.

Commit 6012276093 already addressed
this issue for devices without tools by storing the event position
in GdkTimeCoord using GDK_AXIS_X and GDK_AXIS_Y and augmenting the
GdkTimeCoord's axis bitmask accordingly.

This change generalizes that workaround to all devices. Note that
if a device DOES report values for GDK_AXIS_X and GDK_AXIS_Y, those
values won't be overwritten.

Closes #4809
2022-04-05 15:35:12 -07:00
Christian Hergert
d75147db0a 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
2022-04-04 18:53:19 +00:00
sumibi-yakitori
d3cf7088b3 macos: Skip running showAndMakeKey when a window is minimized by user action
When a window is minimized by user action, the `showAndMakeKey` method is not executed when idle. This prevents the window from being un-minimized immediately.
And allow programmatic minimization of a window by un-minimizing them in `_gdk_macos_toplevel_surface_present`

Closes #4811
2022-04-05 01:06:44 +09:00