Commit Graph

11689 Commits

Author SHA1 Message Date
Matthias Clasen
6510b876d1 build: Add a missing dependency
Add the generated gdk headers to the sources for all the backends,
to guarantee that they are generated before the library is used.

Fixes: #6618
2024-04-11 15:47:38 -04:00
Matthias Clasen
4889199b14 Merge branch 'glarea-dispose-fix' into 'main'
dmabuf texture: Survive multiple disposes

Closes #6623

See merge request GNOME/gtk!7131
2024-04-11 18:20:12 +00:00
Luca Bacci
2e15225446 Merge branch 'remove-work-arounds' into 'main'
GdkWin32: Remove some work arounds that are not needed anymore

Closes #6614

See merge request GNOME/gtk!7114
2024-04-11 17:03:08 +00:00
Matthias Clasen
ed072b4b5d dmabuf texture: Survive multiple disposes
dispose can be called more than once, so be safe for that.
2024-04-11 12:45:24 -04:00
Matthias Clasen
06e905f87d Merge branch 'gtk-wlmod' into 'main'
Meson: Use wayland module

See merge request GNOME/gtk!7126
2024-04-11 01:29:29 +00:00
Xavier Claessens
95a8def7c2 Meson: Use wayland module 2024-04-10 11:43:04 -04:00
Matthias Clasen
8068111c6e Merge branch 'fix-xi2-input-source-type-debug-msg' into 'main'
xi2: Fix incorrect input source type in Input debug message

Closes #6619

See merge request GNOME/gtk!7120
2024-04-10 00:45:14 +00:00
Matthias Clasen
aed4ced032 Merge branch 'broadway-port-2972-3130' into 'main'
[gtk4] gdk/broadway: Port !2972 and !3130 from gtk3

See merge request GNOME/gtk!4467
2024-04-10 00:12:28 +00:00
Matthias Clasen
a63e9d38fb gdk: Add private convenience api
Add a function to get the monitor resolution.

We may use this information in the future to make font rendering
decisions.
2024-04-09 19:13:34 -04:00
Hansem Ro
d90dc7f75e xi2: Fix incorrect input source type in Input debug message
This drops cursor and eraser source names to account for their removal
from GdkInputSource so that GDK_DEBUG=input debug message correctly
prints source type in X11 environment.

Fixes: c1d90273 ("gdk: Drop GDK_SOURCE_ERASER")
Fixes: 3285f52d ("gdk: Drop GDK_SOURCE_CURSOR")
Closes: #6619
2024-04-08 10:15:00 -07:00
Matthias Clasen
2b09f5ea1e dmabuf: Reshuffle docs slightly
Move related parts together, for easier understanding.
2024-04-07 13:03:13 -04:00
Matthias Clasen
85f2e1ccd8 Add gdk_dmabuf_texture_builder_set_dmabuf
Private utility api.
2024-04-07 11:12:13 -04:00
Matthias Clasen
91b98bc9e2 Add a private header
Just cosmetic reshuffling.
2024-04-07 11:12:13 -04:00
Matthias Clasen
72e9f30937 subsurface: Add transforms
Allow to specify a D₂ transform when attaching a texture to a
subsurface, to handle flipped and rotated content. The Wayland
implementation handles these transforms by setting a buffer
transform on the subsurface.

All callers have been updated to pass GDK_TEXTURE_TRANSFORM_NORMAL.
2024-04-07 11:02:40 -04:00
Luca Bacci
3c94e91e5e GdkWin32: Do not clear surface contents when restoring from minimize
The code does not work anyway since we dropped WS_EX_LAYERED windows.
2024-04-06 10:58:40 +02:00
Luca Bacci
8a1bee1d79 GdkWin32: Don't explicitly set the transient owner as active
...when a transient child is hidden.

The system does that automatically
2024-04-06 10:58:25 +02:00
Luca Bacci
9297439de4 GdkWin32: Remove some work arounds that are not needed anymore
2cc650ce was added to work around some of the regressions
introduced by 79557271, but that commit was finally reverted
in 43476c09.

We can now revert 2cc650ce as well.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/6614
2024-04-06 10:44:02 +02:00
Matthias Clasen
c5d05fdc88 wayland: Work around mutter deficiences
Add the environment variable NO_POINTER_VIEWPORT to force the use
of buffer scale for pointer surfaces. This is a temporary workaround
for https://gitlab.gnome.org/GNOME/mutter/-/issues/2633.
2024-04-05 11:13:24 +02:00
Matthias Clasen
1275a2cb8d wayland: Use a viewport for pointer surfaces
This should give us more flexibility for buffer size vs surface
size.

Unfortunately, mutter doesn't play along currently, so this is
only useful for kwin, weston or sway.
2024-04-04 01:07:28 +02:00
Matthias Clasen
67a6f343a0 wayland: Keep pointer_output_scale as double
We can round up to the next integer when we need to.
2024-04-04 01:07:28 +02:00
Matthias Clasen
d0f5644771 macos: Handle callback cursors
This implementation matches the X11 one closely.
2024-04-04 01:07:28 +02:00
Matthias Clasen
b1a3ac8330 win32: Handle callback cursors
This implementation matches the X11 one closely.
2024-04-04 01:07:28 +02:00
Matthias Clasen
80811069ac x11: Handle callback cursors
For these cursors, get the texture for the cursor image by
calling the callback. We always use scale 1.
2024-04-04 01:07:28 +02:00
Matthias Clasen
6e3dc1e669 wayland: Handle callback cursors
For these cursors, get the texture for the cursor image by
calling the callback. We don't do any caching of the cursor
images for now.
2024-04-04 01:07:28 +02:00
Matthias Clasen
d1aa0a74e4 gdk: Add callback cursors
Add a variant of GdkCursor that obtains the texture for the cursor
via a callback. The callback gives us the flexibility to handle
fractional scales and update the cursor for cursor theme size
changes as well as scale changes.
2024-04-04 01:07:28 +02:00
Carlos Garnacho
af4c9ea61e Merge branch 'provide-touch-serial-later' into 'main'
gdk/wayland: Proivde latest touch serial even after a touch ended

See merge request GNOME/gtk!5782
2024-04-03 08:43:03 +00:00
Chris Williams
979d0f4b1d wayland: Fix detection of empty settings portal response
The ReadAll method returns a one-element tuple, so
g_variant_n_children() is always 1.
2024-04-01 10:33:00 -04:00
Emmanuele Bassi
9509876f10 docs: Fix the reference link 2024-03-29 13:31:36 +00:00
Benjamin Otte
91e3bc4496 wayland: On hide, remove frame callbacks from subsurfaces
Fixes subsurfaces receiving frame callbacks while the surface is hidden
or already destroyed.

Fixes #6582
2024-03-28 20:29:06 +01:00
Matthias Clasen
c5f73cb406 Tweak the eglconfig description once more
Just always print the depth and stencil buffer depth,
for maximum clarity.
2024-03-27 16:30:27 +01:00
Luca Bacci
e6a86f61dc Merge branch 'fix-issue-3749' into 'main'
GdkWin32: Always set WS_MINIMIZEBOX on GdkToplevel

Closes #3749

See merge request GNOME/gtk!7072
2024-03-22 17:57:06 +00:00
Luca Bacci
8ffa681e02 GdkWin32: Always set WS_MINIMIZEBOX on GdkToplevel
Regardless if server-side decorated or not. This way the shell knows
that the window can be minimized.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3749
2024-03-22 16:47:59 +01:00
Matthias Clasen
f6c4d3731c dnd: Go back to using dnd-move as move cursor
The move cursor in Adwaita is stuck with the 4-headed arrow image
which isn't suitable for a dnd cursor.

See https://gitlab.gnome.org/GNOME/adwaita-icon-theme/-/issues/286
2024-03-21 21:36:38 -04:00
Matthias Clasen
5e9070145e wayland: Guarantee dnd-move as a cursor name
We need to go back to using this, since move is widely abused
and thus can't change its image to one thats appropriate for dnd.
2024-03-21 21:35:45 -04:00
Christian Hergert
53616a73e9 gdk/wayland: use wp_presentation for more accurate frame timings
This attempts to improve the accuracy for the "presentation_time" of an
individual GdkFrameTimings. That information is currently filled in as soon
as we get a frame callback. However, if presentation-time wayland protocol
is available, that will be used to supliment a more accurate time which
may improve future presentation-time predictions within GdkFrameClockIdle.

The protocol states that all related and sub surfaces will receive the
same information so it is safe that this could be registered for more
than just the toplevel. The information becomes idempotent.
2024-03-20 14:45:58 -07:00
Matthias Clasen
191f826075 wayland: Only set buffer scale if we can
We check this in some other places, so be consistent.
2024-03-19 22:22:53 -04:00
Matthias Clasen
5d52c43074 wayland: Check all required globals for subsurfaces
Before trying to use subsurfaces, make sure we have both
a subcompositor and a viewporter.
2024-03-19 22:22:53 -04:00
Matthias Clasen
f6a67aeb20 wayland: Check some required globals
This may be largely cosmetics, since these are core protocols that
are unlikely to ever be missing. But lets check anyway.
2024-03-19 17:28:25 -04:00
Matthias Clasen
7c04231255 Merge branch 'macos-remove-shadows' into 'main'
macos: Drop shadow related code from macos backend

See merge request GNOME/gtk!7048
2024-03-19 02:38:38 +00:00
Arjan Molenaar
08216dcee9 macos: Drop shadow related code from macos backend 2024-03-19 02:38:37 +00:00
Matthias Clasen
aa95b4f341 dnd: Use the default cursor during motion
When no action is selected, use the default cursor, and only
switch to one of the action-indicating cursors when we are over
a drop target.

Fixes: #6337
Fixes: #6511
2024-03-18 21:17:55 -04:00
Matthias Clasen
6abd9def55 Merge branch 'macos-popover-focus' into 'main'
macos: Fix IMContext for popovers

See merge request GNOME/gtk!7041
2024-03-17 16:55:52 +00:00
Benjamin Otte
195ebf6848 Merge branch 'wip/otte/gl-map-buffer' into 'main'
Add GLBuffer implementation w/ persistent mapping

See merge request GNOME/gtk!7042
2024-03-17 00:27:51 +00:00
Matthias Clasen
16ea91c1fe Merge branch 'macos-fullscreen-resize' into 'main'
macos: Cleanup fullscreen state

See merge request GNOME/gtk!7043
2024-03-16 21:27:29 +00:00
Benjamin Otte
96b800fa0c gl: Add buffer implementation using persistent mapping
If glBufferStorage() is available, we can replace our usage of
glBufferSubData() with persistently mapped storage via
glMappedBufferRange().

This has 1 disadvantage:

1. It's not supported everywhere, it requires GL 4.4 or
   GL_EXT_buffer_storage. But every GPU of the last 10 years should
   implement it. So we check for it and keep the old code.
   The old code can also be forced via GDK_GL_DISABLE=buffer-storage.

But it has 2 advantages:

1. It is what Vulkan does, so it unifies the two renderers' buffer
   handling.

2. It is a significant performance boost in use cases with large vertex
   buffers. Those are pretty rare, but do happen with lots of text at a
   small font size. An example would be a small font in a maximized VTE
   terminal or the overview in gnome-text-editor.

A custom benchmark tailored for this problem can be created with:

  tests/rendernode-create-tests 1000000 text.node

This creates a node file called "text.node" that draws 1 million text
nodes.
(Creating that test takes a minute or so. A smaller number may be useful
on less powerful hardware than my Intel Tigerlake laptop.)
The difference can then be compared via:

  tools/gtk4-rendernode-tool benchmark --runs=20 text.node
and
  GDK_GL_DISABLE=buffer-storage tools/gtk4-rendernode-tool benchmark --runs=20 text.node

For my laptop, the difference is:
before: 1.1s
after:  0.8s

Related: !7021
2024-03-16 20:55:26 +01:00
Arjan Molenaar
4fd848c9de macos: Retrieve NSEvents based on event properties
We cannot depend on the exact event, since some events (e.g. for popups)
are rewritten. Therefore we need to determine the NSEvent based on
heuristics. The usual suspects are event type, device and timestamp.

This allows us to fix IMContext for popups.
2024-03-16 17:25:38 +01:00
Benjamin Otte
afd5ea53d8 vulkan: Rename env var from GDK_VULKAN_SKIP to GDK_VULKAN_DISABLE
It's a better name.
2024-03-16 14:03:36 +01:00
Benjamin Otte
f725bdad25 gl: Move GL_ARB_base_instance check
It's a GLContext feature check, not a GpuRenderer thing.

So put it there.
2024-03-16 13:52:28 +01:00
Benjamin Otte
4e453acd4f gl: Remove the BGRA feature
Nobody is using it anymore now that we have format tracking for all
formats.
2024-03-16 13:44:02 +01:00
Benjamin Otte
3a04542146 gl: Add GDK_GL_DISABLE env var
This allows disabling certain GL features for testing, same as with
Vulkan.
2024-03-16 13:44:02 +01:00
Benjamin Otte
d6a1eb1b2f gl: Split out function
This splits feature checks into its own function.

Which in turn allows splitting the check from the actual reaction to the
flags.
2024-03-16 13:44:02 +01:00
Benjamin Otte
802110bfe5 vulkan: Change function prototype
The function cannot return an error, so don't make that possible.
2024-03-16 13:44:02 +01:00
Benjamin Otte
141769fb46 gl: Turn has_foo flags into GdkGLFeatures
The goal is to have it mirror GdkVulkanFeatures, and in particular
having an environment variable to turn individual flags off.
2024-03-16 13:44:02 +01:00
Benjamin Otte
0fdb6a9243 gl: Remove an unnecessary make_current()
This function is called only from make_current() after all, so the
context is already current.
2024-03-16 13:44:02 +01:00
Matthias Clasen
cb374efb9a Merge branch 'matthiasc/for-main' into 'main'
gdk: Describe egl formats more precisely

See merge request GNOME/gtk!7037
2024-03-16 02:12:16 +00:00
Matthias Clasen
8334d21c87 gdk: Describe egl formats more precisely
Mention the presence of a depth of stencil buffer.

Related: #6542
2024-03-15 21:52:23 -04:00
Arjan Molenaar
3f8f6f6792 macos: Let host determine window sizes
Clean up lastUnfullscreenFrame attribute, as we do not really
need it. The application knows what to resize to.
2024-03-15 21:55:44 +01:00
Matthias Clasen
a9dfec8478 glcontext: Don't call get_instance_private (NULL)
ubsan does not like this.

See a9175e0c03 for a detailed explanation.
2024-03-15 13:06:34 -04:00
Benjamin Otte
8df6e2cdaf frameclock: Make timings history dynamic
Keep at least 1 second of frame timings.

This is necessary for 2 reasons - a real one and a fun one.

First, with the difference in monitor refresh rates, we can have 48Hz
latops as well as 240Hz high refresh rate monitors. That's a factor of
4, and tracking frame rates in both situations reliably is kind of hard
- either we track over too many frames and the fps take a lot of time to
adjust, or we track too little time and the fps fluctuate wildly.

Second, when benchmarking with GDK_DEBUG=no-vsync with a somewhat fast
renderer (*cough*Vulkan*cough*) frame rates can go into insane dimensions
and only very few frames are actually getting presentation times
reported. So to report accurate frame rates in those cases, we need a
*very* large history that can be 1000s of times larger than the usual
history. And that's just a waste for normal usage.
2024-03-10 10:27:36 +01:00
Benjamin Otte
2861ab38ac frameclock: Report accurate fps instead of too low
Previously, our reported fps numbers could be too low when the start
timings weren't complete. In that case we would use the frame time, but
the frame time is the time when the frame was rendered, which is quite a
few milliseconds before it is presented.

So in that case we would not report the difference in presentation
times, but the difference from start of rendering. However, those times
are way more variable and can smear over the whole frame because they
depend on when we received the frame callbacks to high priority GSources
as well as our own render time predictions.

This happened in particular with GDK_DEBUG=no-vsync and could report
number that are off by a factor of 2.

Now we skip any incomplete frames, because those frames never have
presentation times reported. This makes it theoretically more likely to
not being able to report fps at all, but I'd rather have no fps than fps
off by a factor of 2.
2024-03-10 10:27:36 +01:00
Matthias Clasen
62d44b6bc7 wayland: Add window sizes to debug spew
This may help for tracking down issues.
2024-03-09 12:43:33 -05:00
Christian Hergert
84a304e66e gdk/frameclock: add mark when we discover frames may drop
If we discover that some number of frames have passed that perhaps should
not have, leave a mark for the profiler.
2024-03-08 14:41:59 -08:00
Ivan Molodetskikh
a5955106ea Fix xdg-foreign check
It was checking for xdg-foreign v1 instead of "v1 or v2".
2024-03-08 17:28:35 +04:00
Christian Hergert
d83faf82d7 Merge branch 'macos-move-maximized' into 'main'
macos: Fix moving maximized windows

Closes #6436

See merge request GNOME/gtk!6914
2024-03-05 21:53:26 +00:00
Matthias Clasen
85b1959714 Merge branch 'wip/fl/macos-cursor-from-texture' into 'main'
gdk: Implement cursor from texture on MacOS

See merge request GNOME/gtk!6981
2024-03-05 21:34:30 +00:00
Matthias Clasen
0edfafdfdf Merge branch 'macos-maximized-window' into 'main'
macos: Fix window state of initially maximized windows

Closes #5898

See merge request GNOME/gtk!6882
2024-03-05 11:35:49 +00:00
Fabio Lagalla
8080d9e7c1 gdk: Implement cursor from texture on MacOS
This is done with a NSCursor whose content is an NSImage. Image pixels are filled by a NSBitmap, and the format is premultiplied RGBA. So we can just use the texture downloader with GDK_MEMORY_R8G8B8A8_PREMULTIPLIED format.
2024-03-05 10:26:27 +01:00
Matthias Clasen
b1ccb4103d Grr, vulkan
The can always make it worse with another define.
2024-03-02 21:47:49 -05:00
Matthias Clasen
66ba1f76ba vulkan: Add another error code
Handle VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR.
2024-03-02 20:20:16 -05:00
Christian Hergert
2a98928286 gdk/gdkglcontext: include duration of eglSwapBuffers 2024-03-02 00:03:57 +00:00
Philip Withnall
a9175e0c03 gdkdisplay: Don’t call _get_instance_private(NULL)
While it’s documented as being safe, it triggers warnings from ubsan.
While we work out the best way to deal with that inside the
implementation of `G_ADD_PRIVATE` in GLib, let’s pragmatically just
short-circuit the code which triggers the warning here. This is helpful
because `gdk_display_get_debug_flags()` is called from a number of
locations within GTK, so is likely to be hit if anyone is running a UI
app under ubsan.

See https://gitlab.gnome.org/GNOME/glib/-/issues/3267#note_2033550

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: https://gitlab.gnome.org/GNOME/glib/-/issues/3267
2024-03-01 12:16:31 +00:00
Matthias Clasen
c739b9fe7f Merge branch 'wip/kabus/misc-leaks2' into 'main'
general: Fix leaks

See merge request GNOME/gtk!6951
2024-02-28 12:35:02 +00:00
Khalid Abu Shawarib
44fa748826 general: Fix leaks 2024-02-27 22:01:41 +03:00
Matthias Clasen
dfed398371 Merge branch 'gtk4-edge-tiling-resize-fix' into 'main'
[gtk4/wayland] Infer edge constraints from tiled edges.

See merge request GNOME/gtk!6745
2024-02-27 17:39:04 +00:00
Matthias Clasen
854e40c60c wayland: Fix handling of output scales more
It turns out that the workaround in 7b380b2ffc was insufficient.
During initialization, we end up calling apply_monitor_changes()
while xdg_output is set, but xdg_output_geometry isn't. Be more
careful and prevent that from wreaking havoc with negative scales.

Fixes: #6472
2024-02-24 20:56:19 -05:00
Matthias Clasen
7b380b2ffc wayland: Fix handling of output scales
Wayland protocols, in their wisdom, replaced xdg_output_done
with wl_output_done, just to make it more fun to handle multiple
protocol versions.
2024-02-23 22:50:58 -05:00
Maximiliano Sandoval
1ad1a9fe4a
gdkenums: Backtick the formats in docs 2024-02-24 01:12:59 +01:00
Maximiliano Sandoval
fe15db92bd
gdkenums: Add docs for missing formats 2024-02-24 01:12:57 +01:00
Maximiliano Sandoval
682b7773fc
gdkenums: Document Since tags for memory formats 2024-02-24 00:43:21 +01:00
Matthias Clasen
f627c9443e wayland: Quiet an ubsan complaint
unsigned char is promoted to int, which lacks the 32nd bit to
make 0xff << 24 work. Explicitly cast to unsigned int to make
it clear what we want to happen.
2024-02-22 19:57:02 -05:00
Matthias Clasen
e6a4cc8ba2 x11: Shadows require compositing
We can only do client-side shadows if we have an rgba visual
and a compositing wm.

Fallout from 6e7893d5.

Fixes: #6464
2024-02-21 12:35:02 -05:00
Matthias Clasen
5dd1803288 Merge branch 'x11_coords-relative-to-root' into 'main'
x11: Read window position relative to root window rather than parent

See merge request GNOME/gtk!6918
2024-02-20 18:18:41 +00:00
Matthias Clasen
02a7a30978 Merge branch 'disable-depth-test' into 'main'
GL, NGL: Disable depth test

Closes #6401

See merge request GNOME/gtk!6917
2024-02-19 19:14:36 +00:00
Luca Bacci
73e8b39bc6 WGL: Initialize PIXELFORMATDESCRIPTOR structure 2024-02-19 18:16:35 +01:00
Luca Bacci
72b2938e43 WGL: Request that no depth, stencil and accum buffers be created
Unspecified attributes are not interpreted as "leave this feature out",
rather as "pick a default value". For depth, stencil and accum bits the
defaults may be different than 0. For example, with AMD drivers we get:

 * WGL_DEPTH_BITS_ARB:   32
 * WGL_STENCIL_BITS_ARB: 8
 * WGL_ACCUM_BITS_ARB:   0

Set the attributes to 0 as a hint that depth, stencil and accum buffers
should not be created.

The driver may still create them (matching criteria is "minimum" [1]),
but that's outside of our control (and unlikely to happen).

References:

 [1] - WGL_ARB_pixel_format specification
       https://registry.khronos.org/OpenGL/extensions/ARB/WGL_ARB_pixel_format.txt

See #6401
2024-02-19 18:15:52 +01:00
Ben Mather
cb652c7f0f x11: Read window position relative to root window rather than parent
This fixes monitor enter and leave events on X11, and probably other
things.  Previously, it looks like the coordinates were relative to the
top left corner of the window shadow and so never changed.
2024-02-19 14:21:57 +00:00
Arjan Molenaar
ee06ac3ad2 macos: determine zoomed state via NSWindow isZoomed
With our custom logic out of the way, this just works.
Maximized state is also update on move, since a moved maximized
window is no longer considered maximized in macOS land.
2024-02-18 14:33:26 +01:00
Arjan Molenaar
19a8870f76 macos: use native zoom/unzoom logic
In macOS, when moving a maximized window, it's not automatically
restored to its default size.

In addition, GdkMacosWindow should not check surface layout properties,
since those properties are lagging, e.i. are set after the (native)
window state has been updated.
2024-02-18 14:33:26 +01:00
Arjan Molenaar
99a3a7e94e macos: deduplicate compute_size logic
It's used in `present` currently. Need to figure out if it really
belongs there: in Wayland no size computation is done in the
`present` handler.
2024-02-17 22:47:47 +01:00
Arjan Molenaar
a516441513 macos: Fix window state of initially maximized windows
GdkSurface maintains state that shadows the actual window state.
This state is not always updated in the macos backend.

In our case, when a window is initially maximized, `setFrame:display:`
was called and `inMaximizeTransition` was set.  However,
`windowDidEndLiveResize:` was never called and `inMaximizeTransition`
was never unset, making the application think the window is still
maximized.

Additionally, `windowShouldZoom:toFrame:` is only called when the window
is maximized, not when it's unmaximized.

By checking and setting the state in `windowDidResize:` we can at least
be sure that the internal maximized state is only set if the window
takes up all desktop space: the screen's visible frame.
2024-02-17 21:04:50 +01:00
Matthias Clasen
d75abc9104 Merge branch 'win32_gtk4_set_icon_list' into 'main'
GdkWin32: implement surface's "icon_list" property setter

See merge request GNOME/gtk!6869
2024-02-17 14:06:10 +00:00
Alessandro Bono
b6767d2eef meson: Decouple linux/dma-buf.h and libdrm checks
Currently dmabuf_dep is found when the following conditions are met:
 - linux/dma-buf.h is present;
 - libdrm is found.

This is because Linux dmabuf support requires drm_fourcc.h which is part
of libdrm.

However, dmabuf_dep is used for two purposes:
 - define HAVE_DMABUF to state dmabuf support;
 - ensure the presence of drm_fourcc.h for gdk and for the
   media-gstreamer module.

Decouple this, unconditionally check for libdrm and require it on
Linux. Then, use libdrm_dep only to state the drm_fourcc.h presence.

Given that now we unconditionally require libdrm on Linux, HAVE_DMABUF
depends only on the linux/dma-buf.h presence.
2024-02-16 14:01:44 +01:00
Alessandro Bono
d957e40a63 gdkglcontext: Include gdkdmabuffourccprivate.h
It includes a fallback list of fourccs. Otherwise we might miss some
DRM_FORMAT definition.
2024-02-13 14:15:32 +01:00
Alessandro Bono
d1bc8e580d gdkdmabuffourccprivate: Include config.h
Do so before checking HAVE_DMABUF presence.
2024-02-13 14:15:32 +01:00
Matthias Clasen
7cf567b4f9 gl: Check for the right extension name
The extension is called GL_OES_vertex_half_float.
2024-02-12 16:13:54 -05:00
Matthias Clasen
9a30ea1f69 subsurface: Have a source rectangle
This will let us use a subset of the full texture, which can
be necessary in the case that converters put padding around
content in dmabufs. The naming follows the Wayland viewporter
spec.

For now, make all callers pass the full texture rect.
2024-02-11 21:44:27 -05:00
Matthias Clasen
0495359eca subsurface: Rename rect to dest
We are going to introduce another rect, so better to be clear in
naming. We are following the naming of the Wayland viewporter spec
and call the rectangle that we drawing into the dest(ination).
2024-02-11 21:43:51 -05:00
Benjamin Otte
f126986c2b dmabuf: Make init_dmabuf() restore the previous GL context
Random code can call that function and cause unexpected GL context
changes. This is especially bad because it can happen nested.

Fixes the NGL renderer breaking in the inspector when importing a dmabuf
initializes the dmabuf backend which creates a GL renderer which creates
a GL context and makes it current causing the NGL renderer to break when
it continues rendering.

Fixes #6398
2024-02-12 01:39:32 +01:00
Colin Kinloch
fabe0516fa gdk/wayland: Clear current_tablet on pad leave
Fixes crash when handling tablet pad removal event after the
current_tablet has already been freed.
2024-02-11 14:52:30 +00:00
g.willems
fa3bbed200 GdkWin32: implement surface's icon_list property setter
The 'icon_list' implementation of gtk+3 was somehow dropped
during the early conversion of GdkWindow to GdkSurface for gtk4.
Add it again, with minor tweaks to support GdkSurface.

Share the GdkTexture-to-HICON internal API with GdkCursor.

This allows 'gtk_window_set_icon_name()' to work on win32.
2024-02-10 18:53:39 +01:00