Commit Graph

11137 Commits

Author SHA1 Message Date
Benjamin Otte
428798b53f macos: toplevels have no parent 2023-04-26 21:03:34 +02:00
Benjamin Otte
4fa81cf70f win32: Move surface init code into ::constructed() 2023-04-26 21:03:34 +02:00
Benjamin Otte
9ac31fe0a0 win32: Abort on error
Returning NULL from a function that must not return NULL is not a good
idea.
2023-04-26 21:03:34 +02:00
Benjamin Otte
69fabb3ce9 win32: Remove outdated debug messages
They are not needed anymore as they print stuff that's no decided in
that function anymore.
2023-04-26 21:03:34 +02:00
Benjamin Otte
f59c230a96 win32: Move toplevel signal into the toplevel class 2023-04-26 21:03:34 +02:00
Benjamin Otte
80d99b893e broadway: Pass parent as a construct argument 2023-04-26 21:03:34 +02:00
Benjamin Otte
cbe89b955a x11: Get rid of sizes when constructing surfaces
Just call XCreateWindow with 0, 0, 1, 1 size.
2023-04-26 21:03:34 +02:00
Benjamin Otte
2d827978a6 x11: Remove unused variable 2023-04-26 21:03:34 +02:00
Benjamin Otte
b2e304189e wayland: Move surface initialization into constructed()
That way, it doesn't ned a specific init function.

Also chain up last, so that the generic initialization code can access a
fully initialized wayland surface.
2023-04-26 21:03:34 +02:00
Benjamin Otte
35c2d85468 wayland: Move toplevel-specific code into the toplevel
The display->toplevels tracking belongs to GdkWAylandToplevel.
2023-04-26 21:03:34 +02:00
Benjamin Otte
7ef5f6ef1a display: Remove x/y/w/h from create_surface() 2023-04-26 21:03:34 +02:00
Marc-André Lureau
ff9cd989c6 gdk/win32: fix defined but not used warnings
[30/1038] Compiling C object gdk/win32/libgdk-win32.a.p/gdkmain-win32.c.obj
../gdk/win32/gdkmain-win32.c:146:1: warning: 'gdk_win32_finalize_ole' defined but not used [-Wunused-function]
  146 | gdk_win32_finalize_ole (void)
      | ^~~~~~~~~~~~~~~~~~~~~~
../gdk/win32/gdkmain-win32.c:113:1: warning: 'gdk_win32_finalize_com' defined but not used [-Wunused-function]
  113 | gdk_win32_finalize_com (void)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-04-25 16:37:58 +04:00
Marc-André Lureau
5b69df96fe gdk/win32: fix hr set but not used
A number of warnings are produced:

[23/1038] Compiling C object gdk/win32/libgdk-win32.a.p/gdkinput-dmanipulation.c.obj
../gdk/win32/gdkinput-dmanipulation.c: In function 'reset_viewport':
../gdk/win32/gdkinput-dmanipulation.c:354:11: warning: variable 'hr' set but not used [-Wunused-but-set-variable]
  354 |   HRESULT hr;
      |           ^~

Try to do something sensible instead.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-04-25 16:37:58 +04:00
Marc-André Lureau
d8ead56b9c gdk/win32: fix g_string_free warning
../gdk/win32/gdkclipdrop-win32.c: In function 'transmute_cf_shell_id_list_to_text_uri_list':
C:/msys64/ucrt64/include/glib-2.0/glib/gstring.h:72:5: warning: ignoring return value of 'g_string_free_and_steal' declared with attribute 'warn_unused_result' [-Wunused-result]

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-04-25 16:14:57 +04:00
Marc-André Lureau
0e2d7111eb gdk/win32: fix GDK_NOTE redefined warning
In file included from ../gdk/win32/gdkdrag-win32.c:201:
../gdk/win32/gdkprivate-win32.h:45: warning: "GDK_NOTE" redefined
   45 | #define GDK_NOTE(type,action)                             \
      |
../gdk/win32/gdkdrag-win32.c:40: note: this is the location of the previous definition
   40 | #define GDK_NOTE(a,b)

Fixes: bc159207bd ("gdk: Drop old debug macros")

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-04-25 16:11:11 +04:00
Takao Fujiwara
26e3824d1d gdkdisplaymanager: Add missing nullable to display name 2023-04-25 12:08:08 +09:00
Benjamin Otte
104b5ef157 surface: reformat function
Make the function follow usual coding conventions.

And while doing that, remove duplicate functionality.
2023-04-22 16:35:16 +02:00
Benjamin Otte
893862a51a surface: Refactor code
Move the early exit conditions to the top and turn them into early exits
instead of nesting if statements.
2023-04-22 16:33:35 +02:00
Benjamin Otte
823eb4c6d9 surface: Fold function into its only caller
No other changes
2023-04-22 16:29:58 +02:00
Benjamin Otte
be0ed15b40 surface: Stop maintaining an unused linked list
wat?
2023-04-22 16:27:27 +02:00
Benjamin Otte
040af44b00 surface: Remove in_update tracking
It's 2023, we use frame clocks now and don't have nested surface drawing
anymore.
2023-04-22 16:24:16 +02:00
Benjamin Otte
4154f87418 surface: Stop tracking the active update area
It's unused.
2023-04-22 16:10:24 +02:00
Marc-André Lureau
250414d6b3 gdk/win32: drop some unused variables
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-04-17 04:50:17 +00:00
Marc-André Lureau
d69cdf6c05 gdk: drop libangle GLES minimum version
GLES 2.0 version is fine now with current gtk according to B. Otte.
Let's use the same minimum requirement for all implementations.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-04-17 04:50:17 +00:00
Marc-André Lureau
9532657fa2 gdk: use GLES when on win32/ANGLE
When using GDK_DEBUG=gl-egl, we end up using GL, but that is not well supported:

Creating EGL context version 3.0 (debug:no, forward:no, legacy:yes, es:no)
Created EGL context[0000000000000004]
OpenGL version: 0.0 (legacy)
* GLSL version: (NULL)
* Max texture size: -1059701680
* Extensions checked:
 - GL_KHR_debug: no
 - GL_EXT_unpack_subimage: yes
 - OES_vertex_half_float: no

** (gtk4-demo.exe:14324): WARNING **: 19:16:41.468: Compile failure in
vertex shader:
ERROR: 0:7: 'gl_Position' : undeclared identifier
---8<---

Use GLES when EGL implementation is ANGLE.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-04-17 04:50:17 +00:00
Marc-André Lureau
3cb2115212 gdk: drop unused vertex_array_object
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-04-17 04:50:17 +00:00
Benjamin Otte
8965d6c7f8 gl: Only allow RGB(A)8 on GLES2
GLES2 has no idea what 16bit textures even are, let alone floating point.
2023-04-17 05:57:44 +02:00
Benjamin Otte
62951c7277 wayland: Don't leak all surfaces
X11 does add an extra reference to surfaces that gets released when the
DestroyNotify event arrives.
Wayland doesn't ave such an event, so that reference never gets
released.

This fixes a copy/paste error introduced in commit 590f3dfa1f.
2023-04-16 19:28:21 +02:00
Benjamin Otte
8e00f6e5e5 wayland: Don't insta-crash when a surface gets disposed
We want to remove the event queue from the list of event queues, not the
surface.
Otherwise the freed queue stays in the list and the next time an event
comes in, we access invalid memory.

Fixes thinko introduced in commit 7fafa5133b.

Luckily, we leak all surfaces, so this problem never occured.
2023-04-16 19:28:21 +02:00
Matthias Clasen
189aced844 wayland: Improve logging for primary selection 2023-04-15 15:02:52 +02:00
Georges Basile Stavracas Neto
9c013d40c1 gdk/vulkancontext: Use more appropriate present mode
Check if the driver supports MAILBOX and prefer using it; in its
absense, checkif the driver supports IMMEDIATE and prefer using
it; finally, if neither of them are supported, use the guaranteed
to be supported FIFO mode.
2023-04-13 13:54:45 -03:00
Benjamin Otte
cfaf1b3e71 x11: Remove commented outdated code
... and it's copy/paste into the win32 backend
2023-04-13 17:15:35 +02:00
Benjamin Otte
9763d83a9d gdk: Remove unused vfunc 2023-04-13 17:15:35 +02:00
Benjamin Otte
75bea01a86 wayland: Keep EGL window around when hidden
See previous commit:

We want to keep resources around as long as the surface exists.
2023-04-13 05:19:18 +02:00
Benjamin Otte
5d3cec5441 wayland: Don't destroy the wl_surface on hide()
We want to keep the wl_surface around, because surfaces create their
resources on construct and keep them until destroyed. See the HWND ond
Windows and the XWindow on X11.

This is relevant for graphics resources, where we want to have access
to the VkSurface and eglSurface while the GdkSurface is hidden.
We also want these surfaces to be permanent and not change during the
lifetime of the GdkSurface.

What we can - and must - destroy however are the xdg surfaces, because
those handle visibility on screen.
And we also need to ensure no buffer is attached, so that during the
next creation of the xdg surface we don't get a protocol error.
2023-04-13 04:23:35 +02:00
Benjamin Otte
891242920e wayland: Split out a function
We have a create_wl_surface(), create a matching destroy_wl_surface().
2023-04-13 02:56:12 +02:00
Benjamin Otte
b375f17f09 wayland: Remove useless function
gdk_wayland_surface_maybe_resize() just calls
gdk_wayland_surface_update_size(), so make all callers call that one
instead.

The check that it does is done by the other function again.
2023-04-13 02:48:47 +02:00
Benjamin Otte
ec69990126 wayland: Remove an old workaround
This workaround - were it ever to trigger - is broken today. It destroys
the wl_surface and all associated structs but does not recreate the
xdg_popup or xdg_toplevel struct, so it would cause a hidden window.

The workaround looked a lot different when it was introduced in commit
83b54bab57, too - both in what it did and
in what the vfuncs did that it called.
2023-04-13 02:44:05 +02:00
Georges Basile Stavracas Neto
5c27a0dd2b vulkan: Support fractional scaling
Basically what GL does, but without any debug or feature flag
to gatekeep it, since the Vulkan backend itself is experimental
already.

Ceil surface sizes, and floor coordinates, to the fractional scale
value.
2023-04-03 11:10:27 -03:00
Matthias Clasen
5e95c22844 wayland: Be more careful about scale-factor
Only emit notify::scale-factor if it actually
changes. This potentially avoids a lot of work
in GTK (reloading icons, etc).
2023-04-02 13:23:19 -04:00
Matthias Clasen
70269a5aee docs: Add some details 2023-04-02 13:18:51 -04:00
Matthias Clasen
4746ffc4eb Make fractional scaling for GL opt-in
Fractional scaling with the GL renderer is
experimental for now, so we disable it unless
GDK_DEBUG=gl-fractional is set.

This will give us time to work out the kinks.
2023-04-02 11:05:57 -04:00
Matthias Clasen
fa58dd9256 Use fractional scale for the GL renderer
This commit combines changes in the Wayland backend,
the GL context frontend, and the GL renderer to switch
them all to use the fractional scale.

In the Wayland backend, we now use the fractional scale
to size the EGL window.

In the GL frontend code, we use the fractional scale to
scale the damage region and surface in begin/end_frame.

And in the GL renderer, we replace gdk_surface_get_scale_factor()
with gdk_surface_get_scale().
2023-04-02 09:22:56 -04:00
Matthias Clasen
76ac91512b Deprecate gdk_surface_create_similar_surface
This function is part of the cairo drawing API and
we are moving away from that. Update all callers.
2023-04-01 23:09:19 -04:00
Matthias Clasen
075bea788b Add gdk_surface_get_scale
Add a scale property to GdkSurface and use the
fractional scale for it on Wayland.
2023-04-01 19:09:16 -04:00
Benjamin Otte
6d4d9af14e wayland: Use fractional scaling with the Cairo renderer
Cairo can do that, so just enable it:

 * Create surfaces with the correct fractionally scaled size.
 * Set the Cairo surface's device scale to that number.
2023-04-01 20:05:06 +02:00
Benjamin Otte
84b235aac1 wayland: Allow creating fractional Cairo surfaces
We don't do that yet, because the buffer scale code can't deal with it,
but we can do it now.
2023-04-01 20:05:05 +02:00
Benjamin Otte
1a71e82fc5 wayland: Use wp_viewport to set buffer scale
Instead of setting the buffer scale via the buffer-scale command, set it
via the viewport.

This technically allows setting fractional scales, but we're not doing
that.
2023-04-01 20:05:01 +02:00
Benjamin Otte
8dd5d649b8 wayland: Use GdkFractionalScale for surface scale
We still always round it to integers when we read it, but we store it as a fraction.

So we could now use it for fractional scaling.
2023-04-01 18:23:38 +02:00
Benjamin Otte
40ac6f22a3 wayland: Introduce GdkFractionalScale type
We want to use it later for various things, this just adds the
infrastructure we will need.
2023-04-01 18:23:38 +02:00
Matthias Clasen
ffdbb9077c wayland: Some debug spew tweaks 2023-04-01 09:31:12 -04:00
Benjamin Otte
54e8bd898a wayland: Add support for the fractional scale protocol
April fools!

No, really.
The fractional scale protocol is just a way to track the surface scale,
but not a way to draw fractional content.
This commit uses it for that, so tht we don't rely on tracking outputs.

This also allows magnifiers etc to send us a larger (integer) scale if
they would like that, that is not represented by the outputs.
2023-04-01 12:57:03 +02:00
Benjamin Otte
b4492a97bf wayland: Use wl_seat_get_version() 2023-04-01 02:22:21 +02:00
Benjamin Otte
6f93f52b56 wayland: Use zwp_pointer_gestures_v1_get_version() 2023-04-01 02:22:21 +02:00
Benjamin Otte
68b8c5cd99 wayland: Use gtk_shell1_get_version()
... or correct gtk_surface1_get_version() alternative.
2023-04-01 02:22:21 +02:00
Benjamin Otte
9d99259cbd wayland: Use wl_data_device_manager_get_version() 2023-04-01 02:22:21 +02:00
Benjamin Otte
55b5c847f7 wayland: Use zxdg_output_manager_v1_get_version() 2023-04-01 02:22:21 +02:00
Benjamin Otte
3d3d22e844 wayland: Remove unused variable
Also, Wayland has get_version() functions, so if we ever need it, we can
use that.
2023-04-01 02:22:21 +02:00
Benjamin Otte
ae2c28af89 wayland: Check correct interface
buffer scale is a surface property, so check the version of the surface
interface, not the compositor one.
2023-04-01 02:22:21 +02:00
Benjamin Otte
c7499a33fd wayland: Use wl_compositor_get_version()
Wayland has functions to check versions, so use those.
2023-04-01 02:22:21 +02:00
Benjamin Otte
c97b489316 wayland: Use proper macro
Wayland has macros to check required versions. Use those instead of
custom ones.
2023-04-01 02:22:21 +02:00
Matthias Clasen
a1c5a806b3 Convert headers to #pragma once
The conversion was done by guard2one.
2023-03-31 15:11:10 -04:00
Georges Basile Stavracas Neto
6e80c8b07e gdk/vulkancontext: Accept Khronos validation layers
The Lunarg validation layers seem to have been deprecated in favour
of the Khronos ones. There's no reason not to have both, to accept
loading both - simultaneously, even.
2023-03-30 17:13:35 -03:00
Georges Basile Stavracas Neto
c0449e3245 gdk/vulkancontext: Pass all painted rects
Instead of passing a single, potentially massive rectangle that is
just the extents of the damage rect, collect and pass all damage
rects individually.
2023-03-30 17:13:35 -03:00
Georges Basile Stavracas Neto
8217b6e484 gdk/wayland/surface: Track and apply buffer scale
Add a new flag to track whether buffer scale is dirty or not,
and centralize calling wl_surface_set_buffer_scale() in a single
place: gdk_wayland_surface_sync_buffer_scale().

gdk_wayland_surface_sync_buffer_scale() is only called by
gdk_wayland_surface_sync(), which itself is called by the GL,
Vulkan, and Cairo contexts, right before submitting a frame.
This ensure that each frame has an up-to-date buffer scale.

This mimics how opaque and input regions are tracked.
2023-03-30 16:32:50 -03:00
Matthias Clasen
65dc4cac86 wayland: Fix corner cases in positioning
We were not handling some cases correctly.
This was making the dropdown in the gtk-demo
image-scaling demo appear in the top left
corner.
2023-03-28 20:37:54 -04:00
Matthias Clasen
ea572227f0 Merge branch 'wayland-popup-anchor' into 'main'
wayland: Comply with protocol requirements

See merge request GNOME/gtk!5723
2023-03-28 15:36:34 +00:00
Matthias Clasen
a8d8724a02 gdk: Avoid a pointless indirection
Don't use g_fprintf if GLib is using system printf
anyway.
2023-03-27 21:56:41 -04:00
Matthias Clasen
321877e94b gdk: Improve logging for backends
Log more when trying backends.
2023-03-27 21:42:10 -04:00
Matthias Clasen
68d629f84d Merge branch 'bilelmoussaoui/gi-docs' into 'main'
docs: Fix various broken links

See merge request GNOME/gtk!5734
2023-03-27 19:53:33 +00:00
Bilal Elmoussaoui
d1c43b94ef docs: Fix various broken links 2023-03-27 21:29:08 +02:00
Jonas Ådahl
c88f2caa04 wayland/popup: Handle late received reposition feedback
If we map, reposition, unmap, remap, the reposition feedback from the
last time a popup was mapped might be received while we're dealing with
the new version of the popup. At this point, the old reposition token
has no meating, so lets drop it. Also reset the reposition tokens when
creating new protocol objects, so that the reposition token are as if
we're in the initial state.

This fixes an issue where we'd get stuck if repeatedly smashing a button
that'd create popups that'd immediately get dismissed by the compositor.
2023-03-27 21:27:44 +02:00
Emmanuele Bassi
506206e1bd Merge branch 'ebassi/compute-size-annotation' into 'main'
Remove wrong annotation for GdkToplevel::compute-size

See merge request GNOME/gtk!5725
2023-03-27 11:43:34 +00:00
Ludovico de Nittis
d2672db648 wayland: Try to open the display even if XDG_RUNTIME_DIR is unset
Since Wayland 1.15, it is now possible to use absolute paths in
"WAYLAND_DISPLAY".
In that scenario, having a valid "XDG_RUNTIME_DIR" is not a requirement
anymore.

For this reason we remove the "XDG_RUNTIME_DIR" check and we let
`wl_display_connect()` decide if our environment is correct.

Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
2023-03-27 11:53:57 +02:00
Emmanuele Bassi
8dddddfe8c Remove wrong annotation from GdkDragSurface::compute-size
Just like GdkToplevel::compute-size, the size argument of the signal is
given to the handlers by GDK; it's not an out argument meant to be
allocated by the caller.
2023-03-26 15:50:22 +01:00
Emmanuele Bassi
a08c31e71f Remove wrong annotation for GdkToplevel::compute-size
The size argument is passed to the signal by the GDK surface machinery,
as is: it's not going to be allocated by the caller (since it's a
signal), and it's not an out argument.
2023-03-26 15:48:44 +01:00
Matthias Clasen
3a5282abe1 wayland: Don't crash without xdg_activation_v1
If the compositor does not support this protocol,
we can't use it.

Fixes: #5701
2023-03-26 10:11:14 -04:00
Matthias Clasen
b81f9d3f94 wayland: Comply with protocol requirements
If you send a bad anchor rect to mutter, it crashes.
Thats not great, so lets not do that.
2023-03-26 09:47:46 -04:00
Matthias Clasen
a70b85ef76 Merge branch 'wayland-cursor-size' into 'main'
wayland: Don't crash on cursor size 0

Closes #5700

See merge request GNOME/gtk!5721
2023-03-26 01:01:04 +00:00
Matthias Clasen
7adbbe6f35 wayland: Don't crash on cursor size 0
The cursor-theme-size setting is documented as
'0 means the default size'. Make it so by using
size 24 if we see a 0. Its better than crashing.

Fixes: #5700
2023-03-25 20:25:51 -04:00
Matthias Clasen
0efd6cd23e docs: Add another cross reference
Refer to the new coordinate system overview
from the GdkEvent docs.
2023-03-25 15:06:19 -04:00
Matthias Clasen
c51387d62b Merge branch 'matthiasc/for-main' into 'main'
Fix up criticals from GdkGLTexture

See merge request GNOME/gtk!5712
2023-03-24 15:53:55 +00:00
Matthias Clasen
5c558c0091 Fix up criticals from GdkGLTexture
I broke this in 4291f27b56.
I overlooked that there may not be a current context.
2023-03-24 11:29:38 -04:00
Chun-wei Fan
627ee674e5 GDK-Win32: Add wrapper functions for calling core wgl* functions
We might be dealing with GL contexts from different threads, which have more
gotchas when we are using libepoxy, so in case the function pointers for
these are invalidated by wglMakeCurrent() calls outside of GTK/GDK, such as
in GstGL, we want to use these functions that are directly linked to
opengl32.dll provided by the system/ICD, by linking to opengl32.lib.

This will ensure that we will indeed call the "correct" wgl* functions that
we need.

This should help fix issue #5685.
2023-03-24 18:43:23 +08:00
Matthias Clasen
7cb7e0ab35 gl: Add a private way to query mipmap status
Make GdkGLTexture determine if the texture has
a mipmap, and provide private API to query this
information.

This check is done in gdkgltexture.c instead of
gskgldriver.c, since we're already binding the
texture here for other reasons, so it is easy
to query a few more things.
2023-03-23 23:16:54 -04:00
Matthias Clasen
4291f27b56 gltexture: Try harder to determine the format
We can query these things as long as the texture ID
is valid in the current context.
2023-03-23 22:56:06 -04:00
Matthias Clasen
75f9379cd5 Merge branch 'alatiera/fedora-bump' into 'main'
ci: Use Fedora 38 as the base

See merge request GNOME/gtk!5688
2023-03-20 14:39:15 +00:00
Jordan Petridis
f9b2d3104a vulkan: Update error codes enum 2023-03-20 16:16:30 +02:00
Bilal Elmoussaoui
aa0cd3a553 g-i: Add since annotation to GdkSurfaceSize 2023-03-20 08:14:25 +00:00
Matthias Clasen
88dd6e630e broadway: Don't cause traffic when disconnecting
The recently added transient-for support was causing
roundtrips when a client with transients disconnects,
leading to assertion failures. Avoid that.
2023-03-17 11:00:35 -04:00
Benjamin Otte
ef3c515cf1 rowstrides are gsize, not int
gdk-pixbuf got that wrong, don't repeat that mistake.
2023-03-16 21:40:02 +01:00
Benjamin Otte
707c63c6f9 win32: Fix rowstride math 2023-03-16 21:40:02 +01:00
Ivan Molodetskikh
54e36f6b73 wayland: Reset pending offset in GL path
Otherwise GL surfaces that redraw without changing the hotspot have it
applied on top every frame and quickly slide away.

The cairo path and the X11 backend do not have this bug.
2023-03-15 16:11:40 -07:00
Matthias Clasen
c2965aed35 Merge branch 'dragsurface-resize' into 'main'
Fix drag surfaces ignoring size updates on Wayland and X11

See merge request GNOME/gtk!5597
2023-03-15 02:59:19 +00:00
Ivan Molodetskikh
11d9bbfd6e x11/surface: Get current drag surface size with compute-size signal
Query and update size of drag surfaces, similarly to how it's done for
the Wayland backend in the previous commit.
2023-03-14 19:41:44 -07:00
Ivan Molodetskikh
f63fc91b0e wayland/dragsurface: Get current size with compute-size signal
GdkDragSurface-backed widgets are not parented to an existing widget,
unlike popovers, and like toplevels. This means that there's nobody to
actively call gdk_drag_surface_present() to update the size, and
GdkDragSurface should do it on its own, just like GdkToplevel.

This commit implements this for the Wayland backend.
2023-03-14 19:41:44 -07:00
Ivan Molodetskikh
c3dde05d33 dragsurface: Add compute-size signal
Similarly to GdkToplevel, GdkDragSurface's compute-size should be called
by backends to query the current surface size, and should be connected
to by widget implementations (like GtkDragIcon) to report the current
size.

GdkDragSurface-backed widgets are not parented to an existing widget,
unlike popovers, and like toplevels. This means that there's nobody to
actively call gdk_drag_surface_present() to update the size, and
GdkDragSurface should do it on its own, just like GdkToplevel.
2023-03-14 19:41:44 -07:00
Matthias Clasen
45434d501c Add GdkDragSurfaceSize
This helper type will be used in the next commit for a new compute-size
request on GdkDragSurface. It is analogous in spirit to GdkToplevelSize.
2023-03-14 19:41:44 -07:00
Matthias Clasen
b74d483f01 Merge branch 'matthiasc/for-main' into 'main'
gl: Print max texture size in debug output

See merge request GNOME/gtk!5654
2023-03-15 02:32:37 +00:00
Matthias Clasen
9a2cc79286 gl: Print max texture size in debug output
This is useful information.
2023-03-14 22:13:37 -04:00
Matthias Clasen
98ff6c0d4d gdk: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
15d73a1adb macos: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
6f93baf420 win32: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
5cca7488d4 x11: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
93edb08094 Start 4.12 development 2023-03-14 11:16:30 -04:00
Bilal Elmoussaoui
23408f6dbf GLTexture: Add GL_RGB format support 2023-03-13 13:59:17 +00:00
Jonas Ådahl
f2a0a8b8be x11/surface: Clear compute_size idle source also when destroying
Doing it on hide() is not enough, since in some edge cases we didn't
ever actually map, we just attempted to compute the size, e.g. in
response to a ConfigureNotify event, then the window was destroyed.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2678
2023-03-10 23:34:50 +01:00
Benjamin Otte
7fff188557 wayland: Don't crash during DND with Cairo renderer
Attaching buffers with offsets is forbidden now and nobody
checked the Cairo renderer.
2023-03-07 20:16:59 -05:00
William Roy
aaeec84d75 Fix compile_resources present source directory
In certain scenarios, address the issue where gnome.compile_resources 
fails to transmit the present source directory. This is most notably 
visible with MSBuild.
2023-03-07 21:59:50 +00:00
Jonas Ådahl
4500fa633b wayland: Destroy xdg_surface after role
The split-up of gdksurface-wayland.c introduced a protocol violation
when it didn't make sure xdg_surface was destroyed after the role
objects (xdg_popup / xdg_toplevel). Fix that.

Fixes: 2a463baed0 ("wayland: Rearrange the surface code")
2023-03-05 20:55:41 +01:00
Benjamin Otte
98eac8ac83 Fixes for gdk_memory_texture_new_subtexture checks
There were several mistakes here.
2023-03-03 11:24:46 -06:00
Carlos Garnacho
ae94417f80 gdk/x11: Also grab keyboard during XDnD grabs
The drag source must handle events and messaging, this also
includes keyboard handling for accessibility and cancellation.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5604
2023-02-18 23:02:22 +01:00
Jonas Ådahl
53c3f497f1 wayland: Clean up some dead code 2023-02-17 12:03:58 +01:00
Jonas Ådahl
3183a21347 wayland/glcontext: Don't call wl_surface.offset on old objects
The availability of wl_surface.offset depends on the compositor, so we
can't call it unconditionally. Add a version check to so we only call
offset if we know we won't raise a protocol error.

Fixes: 0eb791eaaa ("Make mask nodes more versatile")
2023-02-17 12:03:27 +01:00
Matthias Clasen
9a539cec57 Merge branch 'mask-modes' into 'main'
Make mask nodes more versatile

See merge request GNOME/gtk!5521
2023-02-15 00:57:17 +00:00
Matthias Clasen
0eb791eaaa Make mask nodes more versatile
Add a GskMaskMode enumeration and implement it
in the GL and cairo renderers.
2023-02-14 19:07:01 -05:00
Benjamin Otte
cca5de3c7f memorytexture: Export less private API
It's not needed anymore with GdkTextureDownloader now.
2023-02-15 00:39:18 +01:00
Benjamin Otte
c9f54ca371 texture: Export gdk_texture_get_format()
The API docs outline why quite well.

This should make it possible to do saving of textures to image files
without any private API with the same featureset that GTK uses.

Also remove the gsktextureprivate.h include where
gdk_texture_get_format() was the only reason for it.
2023-02-15 00:39:18 +01:00
Benjamin Otte
ce0123ea58 docs: Link from gdk_texture_download() to GdkTextureDownloader 2023-02-15 00:39:18 +01:00
Benjamin Otte
b30af72125 tiff: Use GdkTexureDownloader when saving 2023-02-15 00:39:18 +01:00
Benjamin Otte
eb45b8083a png: Use GdkTexureDownloader when saving 2023-02-15 00:39:18 +01:00
Benjamin Otte
f05d801e28 jpeg: Use GdkTexureDownloader when saving 2023-02-15 00:39:18 +01:00
Benjamin Otte
4afec951c7 pixbuf: Use GdkTextureDownloader when downloading pixbufs 2023-02-15 00:39:18 +01:00
Benjamin Otte
51ed1442a2 gdk: Add GdkTextureDownloader
It's the new object that allows more control about accessing texture
data.
2023-02-15 00:39:18 +01:00
Benjamin Otte
01ff6c1c22 memorytexture: Use right size for GBytes
The GBytes were created with the wrong size.

Nobody seems to have looked at it.
2023-02-14 23:42:17 +01:00
Jonas Ådahl
b2a2bf819d wayland/launch-context: Use dispatch helper
Otherwise we risk a busy loop if e.g. the pipe broke.
2023-02-11 23:14:53 +01:00
Jonas Ådahl
dd9433b50e wayland: Add event queue dispatch helper
Dispatch failing should always fatal; use a helper to centralize the
error handling everywhere.
2023-02-11 23:13:39 +01:00
Matthias Clasen
04c3af537c Merge branch 'wip/handle-more-wl-dispatch-failures' into 'main'
wayland: Handle dispatch failing in a couple of more places

See merge request GNOME/gtk!5495
2023-02-11 19:56:45 +00:00
Matthias Clasen
d497e721c9 gdkevents.c: Fix up folding
The modeline was lost at some point,
and superfluous spacing inserted.
2023-02-11 08:59:51 -05:00
Jonas Ådahl
a7fb9a6865 wayland: Handle dispatch failing in a couple of more places
Without doing this, we'll end up with risking GTK processes sitting
eating 100% CPU instead of just exit(1):ing.
2023-02-11 11:42:21 +01:00
Carlos Garnacho
824e983372 gdk/x11: Reset all scroll valuators on enter
We no longer need to make much distinction between multiple logical
devices, plus it breaks esp. with the Xwayland input device distribution.
Just iterate across all devices and reset their scroll valuators.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4160
2023-02-04 13:13:19 +01:00
Carlos Garnacho
4005eb8fe8 gdk/wayland: Rename gdkkeys-wayland.c file
Since it contains the GdkKeymap implementation, give it a more
obvious name.
2023-02-03 16:15:34 +01:00
Carlos Garnacho
1d4ceac2c5 gdk/wayland: "Split" GdkWaylandDevice implementation out
This is a bit spaghetti right now, since seats and devices were
heavily entangled there are a number of crossed private API calls that
should ideally not be there.

Let this be a first step, so more bits may move from the seat
implementation to devices.
2023-02-03 16:15:34 +01:00
Carlos Garnacho
a5246a6856 gdk/wayland: Split GdkDevicePad wayland implementation
This now lives in its own C file.
2023-02-03 16:08:07 +01:00
Carlos Garnacho
af00beb772 gdk/wayland: Move struct declarations to header
These will be used from outside the main file, after we are
done splitting it.
2023-02-03 16:00:01 +01:00
Carlos Garnacho
e5cd9354d5 gdk/wayland: Move GdkWaylandDevice data to private struct
Before splitting this object, avoid leaking details in its struct.
2023-02-03 15:58:11 +01:00
Carlos Garnacho
6426ab7466 gdk/wayland: Rename gdkdevice-wayland.c to gdkseat-wayland.c
This file, event though a clump of input-y objects, has more of
seats than anything else. Rename it so that we can start splitting
these objects out of it.
2023-02-03 15:58:11 +01:00
Matthias Clasen
50998b0ee9 Merge branch 'drag-icon-robustness' into 'main'
dragicon: Handle files without info

See merge request GNOME/gtk!5460
2023-02-03 13:19:26 +00:00
Carlos Garnacho
d228bae365 Merge branch 'drag-button-issue' into 'main'
Fix button mask calculation for Wayland

Closes #5561

See merge request GNOME/gtk!5468
2023-02-03 09:28:01 +00:00
Benjamin Otte
c17049c6d1 Merge branch 'wip/otte/gl-is-current' into 'main'
gdk: Add private GLContext::is_current() check

Closes #5392

See merge request GNOME/gtk!5463
2023-02-02 21:56:32 +00:00
Arjan Molenaar
f000baf0d6
wayland: Fix button mask for button 2 and 3
Wayland and GTK order mouse button 2 and 3 differently.

Fixes #5561.
2023-02-02 21:48:58 +01:00
Matthias Clasen
8911ed5d9b Merge branch 'monitor-description' into 'main'
Add GdkMonitor::description

See merge request GNOME/gtk!5466
2023-02-02 14:12:23 +00:00
Carlos Garnacho
7ad74ad6c3 gdk/wayland: Deprecate GdkDisplay windowing-specific for startup IDs
This is currently just used as a convenience storage of the startup ID
between the GtkApplication and the GtkWindow (after it's ready to notify
on it).

This could be untangled in the GTK layers so there is no involvement
from GDK in keeping the startup ID around, in the mean time just deprecate
these gdk_wayland* API calls.
2023-02-02 12:50:59 +01:00
Matthias Clasen
4e62350232 wayland: Set up monitor descriptions
We get this information in the xdg_output protocol.
2023-02-02 12:32:28 +01:00
Matthias Clasen
2c883a70e2 Add GdkMonitor::description
This is the right string to when showing
monitors in the UI.
2023-02-02 12:32:28 +01:00
Matthias Clasen
3dfeb2fd37 monitor: Document connector names better 2023-02-02 12:32:28 +01:00
Matthias Clasen
12057c8a30 gltexture: Small refactoring
We do this in two places, so factor out
the dropping of GL resources into a helper.
2023-02-02 10:01:36 +01:00
Matthias Clasen
8796950651 Deprecate more startup-notification API 2023-02-02 08:30:32 +01:00
Benjamin Otte
c6cef6db52 gdk: Add private GLContext::is_current() check
... and use this check in gdk_gl_context_make_current() and
gdk_gl_context_get_current() to make sure the context really is still
current.

The context no longer being current can happen when external GL
implementations make their own contexts current in the same threads GDK
contexts are used in.
And that can happen for example by WebKit.

Theoretically, this should also allow external EGL code to run in X11
applications when GDK chooses to use GLX, but I didn't try it.

Fixes #5392
2023-02-02 04:23:51 +01:00
Benjamin Otte
fdea27c04d win32: Remove unused variable 2023-02-02 04:23:51 +01:00