Commit Graph

11188 Commits

Author SHA1 Message Date
Carlos Garnacho
c523c68cef gdk: Include pads in GDK_SEAT_CAPABILITY_ALL
The GDK_SEAT_CAPABILITY_TABLET_PAD stood awkwardly out of the
ALL value. Even though it's not a keyboard, its focus has more
resemblance to it, so it should be part of this group together
with keyboards.
2023-06-14 01:42:53 +02:00
Carlos Garnacho
9f4320a4ac gdk/wayland: Create pad devices on enter
We were creating the pad device on wp_tablet_pad.done, but
at that time we do not know what tablet it is associated with,
thus we cannot get appropriate vid/pid/name properties for it.

To get that, we need to wait for the pad to enter a surface,
at that time we do know what tablet it is associated with, so
we can get better information about the device.

There are pads that may plausibly "change" tablet between
one .enter event and the next (e.g. Wacom Express Key Remote),
but this situation is highly unlikely. The pad devices created
are thus persistent until that situation happens.
2023-06-14 01:42:53 +02:00
Luca Bacci
cf980cdefb Merge branch 'focus-modal-windows' into 'main'
win32: Focus modal windows when clicking on unfocused parent

See merge request GNOME/gtk!6051
2023-06-12 13:55:45 +00:00
Luca Bacci
51265e2367 Merge branch 'center-dialogs' into 'main'
win32: Center newly created transient windows

Closes #5407

See merge request GNOME/gtk!6050
2023-06-12 13:53:00 +00:00
Matthias Clasen
53af7208e6 gdk: Fix an oversight in GdkContentFormats
When clearing a builder, reset the counts to 0.

Otherwise valgrind spots uninitialized memory
use in our testsuite.
2023-06-09 08:17:34 -04:00
dgsasha
84840f1f2e win32: Center newly created transient windows
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5407
2023-06-08 16:42:27 -04:00
Marco Trevisan
d2638f0955 Merge branch 'wip/otte/fix-glx' into 'main'
glx: Ignore all errors

See merge request GNOME/gtk!6065
2023-06-06 10:56:55 +00:00
Benjamin Otte
e580dcf18d glx: Fake an X request to make GLX hack work
Sometimes, GLX can decide to use the previous request serial when faking
XErrors via __glXSendError() (look through the Mesa sources to enjoy).
This can cause the error trap we just installed to not feel responsible
for the error. And that makes GDK decide to immediately abort the
application.
That is not what we or GLX want.

So we use a no-op X Request to bump the request number so that when GLX
does its shenanigans, it uses a serial that our error trap will catch.

Fixes a crash in mutter's CI which apparently manages to drive GLX
without an X server.
2023-06-06 05:20:34 +02:00
Benjamin Otte
14e44f36bf glx: Move error trap even further out
This way we only create one error trap for all attempts to create a
context instead of up to 3.
2023-06-06 05:20:34 +02:00
Benjamin Otte
1e60ad1430 glx: Ignore all errors
In error cases, glXCreateContextAttribsARB() will always return NULL so
it is enough to run the loop until the first non-NULL context is
returned.

And at that point, we can just look at the return value and ignore all
errors.
2023-06-06 05:20:34 +02:00
Matthias Clasen
51f4ad55cf wayland: Free seat globals in dispose
This matches what we do for the display globals.
2023-06-05 20:50:09 -04:00
Matthias Clasen
94d65f6ef1 gdk: Dispose seats when a display is closed
We dispose the display itself. It does not make
sense to hold onto seat resources beyond that point.
2023-06-05 20:50:09 -04:00
Matthias Clasen
c3f446a95a wayland: Don't leak all globals 2023-06-05 20:50:09 -04:00
Matthias Clasen
ad8e5c3a39 wayland: Drop an unused field
Nobody is using the wl_input_device field.
2023-06-05 20:50:09 -04:00
Matthias Clasen
a9f9fb2022 gl: Free all tracked buffers
This was overlooked when the number of tracked
buffers was bumped from 2 to 4 in 46e3454eb7.
2023-06-04 22:17:56 -04:00
Benjamin Otte
fd5d15004e Merge branch 'wip/otte/vulkan' into 'main'
Vulkan hacking going overboard

See merge request GNOME/gtk!5992
2023-06-04 18:21:21 +00:00
Benjamin Otte
0f1b039306 vulkan: Implement bindless texture rendering
Instead of having a descriptor set per operation, we just have one
descriptor set and bind all our images into it.

Then the shaders get to use an index into the large texture array
instead.

Getting this to work - because it's a Vulkan extension that needs to be
manually enabled, even though it's officially part of Vulkan 1.2 - is
insane.
2023-06-04 19:42:01 +02:00
Matthias Clasen
85bafbdff0 wayland: Don't leak cursor structs
Found by gcc's -fanalyzer.
2023-06-04 07:58:24 -04:00
Matthias Clasen
c380d17621 Revert "gdk/x11: Also grab keyboard during XDnD grabs"
This reverts commit ae94417f80.
2023-06-03 12:25:25 -04:00
Matthias Clasen
686d18dfc2 x11: Stop using passive grabs
The keynav that this implements is half-broken under
xwayland anyway, and it confused and complicates things
on the compositor side.
2023-06-03 12:25:25 -04:00
Benjamin Otte
0a1702ae99 Merge branch 'wip/otte/fix-glx' into 'main'
glx: Trap errors inside loop

Closes #5857

See merge request GNOME/gtk!6056
2023-06-03 16:19:09 +00:00
Benjamin Otte
0016fea36b glx: Trap errors inside loop
Instead of trapping errors for the whole loop trying to create GL
contexts, trap them once per GL context.

Apparently GLX does throw an error when a too high version is requested
and doesn't just return NULL and then that error lingers when we try
lower versions.

Fixes #5857
2023-06-03 18:03:56 +02:00
dgsasha
b7e3a231b4 win32: Focus modal windows when clicking on unfocused parent 2023-06-02 12:33:03 -04:00
Matthias Clasen
c8c895d160 Merge branch 'trap-bad-rr-errors' into 'main'
x11: Trap XRandr errors when getting outputs during init and update

See merge request GNOME/gtk!6046
2023-06-02 11:31:45 +00:00
Luca Bacci
acbd7f212e Merge branch 'for-main' into 'main'
GdkWin32 Cleanup

See merge request GNOME/gtk!5714
2023-06-02 09:34:48 +00:00
Marco Trevisan (Treviño)
f2a2889153 x11: Trap XRandr errors when getting outputs during init and update
We may try to update the XRR outputs and Crtcs when they're changing in
the server, and so we may get BadRROutput that we're currently not
handling properly.

As per this, use traps and check whether we got errors, and if we did
let's ignore the current output.

It's not required to call init_randr13() again because if we got errors
it's very likely that there's a change coming that will be notified at
next iteration during which we'll repeat the init actions.
2023-06-02 00:30:14 +02:00
sumibi-yakitori
1fce2b1e06 Fix an issue where min_version was not being used as the minimum version required by GTK 2023-06-01 23:05:44 +09:00
sumibi-yakitori
7b8a5235d4 Fix a bug in error checking conditions. This avoids unintentional Legacy of the created OpenGL context 2023-06-01 16:46:24 +09:00
sumibi-yakitori
3c9b3ead6f The GL version reported by epoxy seems to depend on the current GL context, so the GL context to create should be the one determined by gdk_gl_context_get_matching_version 2023-06-01 16:43:57 +09:00
Matthias Clasen
39f4d5ccf7 gltexturebuilder: Update the docs
We do handle unpremultiplied alpha correctly (albeit
non-optimally) now.
2023-05-31 14:39:07 -04:00
Luca Bacci
24af4b48cc GdkWin32: Remove unused functions 2023-05-31 12:15:57 +02:00
Luca Bacci
1c8caf745f GdkWin32: Remove declarations of unused types from gdkprivate-win32.h 2023-05-31 12:15:57 +02:00
Luca Bacci
395d80f131 GdkWin32: Remove declarations of unexisting functions from gdkprivate-win32.h 2023-05-31 12:15:57 +02:00
Luca Bacci
74229572e7 GdkWin32: Remove defines for old MinGW headers 2023-05-31 12:15:57 +02:00
Luca Bacci
cbb3d3f177 GdkWin32: Remove _gdk_display_hdc global variable 2023-05-31 12:15:57 +02:00
Luca Bacci
8861d0eb53 GdkWin32: Turn a few functions to static
When used only in the source file they're defined in.
Also remove the corresponding declarations from
gdkrivate-win32.h.
2023-05-31 12:15:57 +02:00
Luca Bacci
a23bc894e9 GdkWin32: Remove unused debug functions
* _gdk_win32_print_paletteentries
 * _gdk_win32_print_system_palette
 * _gdk_win32_print_hpalette
 * _gdk_win32_drag_protocol_to_string
 * _gdk_win32_data_to_string
 * _gdk_win32_gdkrectangle_to_string
 * _gdk_win32_cairo_region_to_string
 * _gdk_win32_surface_description
2023-05-31 12:15:57 +02:00
Matthias Clasen
f29c7e76f5 gltexture: Use proper alignment for downloads 2023-05-30 22:35:45 -04:00
Matthias Clasen
876b439d4a Merge branch 'matthiasc/conversion-tests' into 'main'
Texture format work

See merge request GNOME/gtk!6035
2023-05-31 00:13:51 +00:00
Matthias Clasen
4f6d7c69a1 gltexturebuilder: Document format expectations
Provide some details about storage and alpha handling.
2023-05-30 19:46:13 -04:00
Matthias Clasen
1c72f46eed gltexture: Rewrite downloading code
For non-gles, make it handle unpremultiplied formats,
and everything else, by downloading the texture in its
preferred format and, in most cases, doing a
gdk_memory_convert afterwards.

For gles, keep using glReadPixels, but handle cases
where the gl read format doesn't match the texture
format by doing the necessary swizzling before calling
gdk_memory_convert.
2023-05-30 15:57:18 -04:00
Matthias Clasen
0f61c52593 gdk: Simplify gdk_memory_format_gl_format
Make the callers of this function check for
straight alpha themselves, and only do the
version compatibility check here. This makes
the function usable in contexts where straight
alpha is acceptable.
2023-05-30 14:49:45 -04:00
Sophie Herold
894a4bda85 gdk: Support gray/alpha in PNG loader 2023-05-30 14:41:01 -04:00
Sophie Herold
2b88505ca4 gdk: Support gray/alpha in TIFF loader
Use PHOTOMETRIC_MINISBLACK for grayscale image
2023-05-30 14:41:01 -04:00
Sophie Herold
ef8c835762 gsk: Support swizzle for gray and alpha formats
Swizzling is needed to display one channel memory formats
as gray etc.
2023-05-30 14:41:01 -04:00
Sophie Herold
50115d70c6 gdk: Add grayscale and alpha memory formats 2023-05-30 14:41:01 -04:00
Luca Bacci
1a058a41c9 Do not keep HINSTANCE variables around
Use &__ImageBase for the GTK DLL and GetModuleHandle (NULL)
for the application module. Then remove DllMain as it's not
necessary anymore.

References:

 [1] Accessing the current module's HINSTANCE from a static library:
     https://devblogs.microsoft.com/oldnewthing/20041025-00/?p=37483
2023-05-30 19:31:54 +02:00
Marco Trevisan (Treviño)
be4f6ff3da gdkselectioninputstream-x11: Explicitly handle stream ownership in signal
The display xevent signal connection takes the ownership of the stream
until we get a valid event, so it should manage the stream lifetime.

So make this clearer, by automatically removing the stream reference
when we disconnect from the xevent signal handler.
2023-05-30 17:59:19 +02:00
Marco Trevisan (Treviño)
4fcf899852 gdkselectioninputstream-x11: Make it clearer how we manage the stream ownership
It gets unreffed during gdk_x11_selection_input_stream_complete, so use
APIs that make this clearer.
2023-05-30 17:54:29 +02:00
Marco Trevisan (Treviño)
371e860184 gtkselectioninputstream-x11: Do not add an extra reference to the returned stream
We create a new stream during gdk_x11_selection_input_stream_new_async()
then such stream is referenced when passed to the task via
g_task_return_pointer(), so there's no need to reference it again before
returning it, or we'd end up leaking.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4892
2023-05-30 17:50:56 +02:00