Compare commits

..

212 Commits

Author SHA1 Message Date
Matthias Clasen
320f27a202 4.14.5 2024-08-16 10:56:14 -04:00
Mikael Forsberg
cdb12e0e21 docs: Fix popover docs typo 2024-08-16 10:27:42 -04:00
Matthias Clasen
eb1d2a5b4d icon helper: Fix an argument order mishap
It seems that for a long time, no compiler saw it fit to warn
about this, even though they argument types are not the same.
2024-08-16 10:27:31 -04:00
Kjell Ahlstedt
f6c18cd031 docs: Improve gtk_window_set_interactive_debugging() docs
This function is recommended only if you override the default
key shortcuts for the Inspector.
2024-08-16 10:26:57 -04:00
Kjell Ahlstedt
ea97e89d81 docs: Improve gtk_window_set_interactive_debugging() docs
This function is recommended only if you override the default
key shortcuts for the inspector.
2024-08-16 10:26:51 -04:00
Matthias Clasen
1e99f00b77 widget: Fail properly in compute_transform
We don't currently support computing transforms across native
boundaries. This could be added by using gdk_popup_get_position_x/y.
For now, just fail in this case.

Related: #6355
2024-08-16 10:26:22 -04:00
Scrambled 777
2054dc9620 Update Hindi translation 2024-08-13 18:42:31 +00:00
Daniel Șerbănescu
cfbfaeae01 Update Romanian translation 2024-08-11 11:14:31 +00:00
Matthias Clasen
a4ccf4d7d4 Merge branch 'plug-gtask-leaks-gtk-4-14' into 'gtk-4-14'
[GTK 4.14] Plug GTask leaks

See merge request GNOME/gtk!7578
2024-08-08 01:29:14 +00:00
Sergey Bugaev
d0864b141f Plug GTask leaks
The error-prone pattern seems to be:

  GTask *task = g_task_new (...);

  if (condition)
    {
      g_task_return_... (task, ...);
      /* need g_object_unref (task) here! */
      return;
    }

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2024-08-07 20:39:40 +03:00
Emmanuele Bassi
5a13e2a183 Merge branch 'wip/dont-leak-egl-surface-14' into 'gtk-4-14'
[14] gdk/surface: Don't leak the EGLSurface

See merge request GNOME/gtk!7572
2024-08-07 16:20:51 +00:00
Matthias Clasen
d84c322f2a Merge branch 'gtk-4-14-backports' into 'gtk-4-14'
[GTK 4.14] Various backports (part 2)

See merge request GNOME/gtk!7553
2024-08-07 14:49:06 +00:00
Jonas Ådahl
6e10ea07fb gdk/surface: Don't leak the EGLSurface
Each time we create a new window, we create a new EGLSurface. Each time
we destroy a window, we failed to destroy the EGLSurface, due to passing
a GdkDisplay instead of a EGLDisplay to eglDestroySurface().

This effectively leaked not only the EGL surface metadata, but also the
associated DMA buffers. For applications where one opens and closes many
windows over the lifetime of the application, and where the application
runs for a long time; for example a terminal emulator server, this
causes a significant memory leak, as the memory will only ever be freed
once once the application process itself exits, if ever.

Fix this passing an actual EGLDisplay instead of an GdkDisplay, to
eglDestroySurface().
2024-08-07 16:03:59 +02:00
Jonas Ådahl
069b37cde9 gdk/surface: Don't leak the EGLSurface
Each time we create a new window, we create a new EGLSurface. Each time
we destroy a window, we failed to destroy the EGLSurface, due to passing
a GdkDisplay instead of a EGLDisplay to eglDestroySurface().

This effectively leaked not only the EGL surface metadata, but also the
associated DMA buffers. For applications where one opens and closes many
windows over the lifetime of the application, and where the application
runs for a long time; for example a terminal emulator server, this
causes a significant memory leak, as the memory will only ever be freed
once once the application process itself exits, if ever.

Fix this passing an actual EGLDisplay instead of an GdkDisplay, to
eglDestroySurface().
2024-08-07 15:07:16 +03:00
Benjamin Otte
7f2df18a10 iconhelper: Size no longer depends on scale
This is a leftover from GTK3 when iconhelper sizes depended on the
texture size.

Now we only need to queue a redraw with the new icon.

Fixes warnings about resizes during allocate caused by scale change
notification during allocation of GtkWindow.
2024-08-05 17:17:08 +03:00
Benjamin Otte
861aaa5baa windowcontrols: No need to listen to scale factor changes
This is a GTK3 leftover where the icons were manually drawn and sized.
Now that they're managed by actual widgets that enforce a correct size
that is independent of scale factor, this is no longer necessary.

Fixes warnings about resizes during allocate caused by scale change
notification during allocation of GtkWindow.
2024-08-05 17:16:49 +03:00
Arjan Molenaar
bf8b0ac8d4 macos: fix window transparency
Revert window decoration changes from
a6ce506714.
2024-08-05 17:16:23 +03:00
Matthias Clasen
71307b1b29 dmabuf: Fix the disjointness check
We were checking the wrong fds here.

This came up while toying with udmabuf and creating multi-plane
NV12 buffers.
2024-08-05 17:15:47 +03:00
Jeremy Bícha
4d93e39522 ci: avoid another date-dependent failure
Set the day before setting the month to avoid
failure when running the test on the 31st day of a month
2024-08-05 17:15:27 +03:00
Matthias Clasen
325cb8071f subsurface: Avoid a crash
When finalizing a subsurface, we need to make sure it is removed
from the sibling lists in its parent, or bad things will happen.

This should crashes seen in Epiphany nightly.

Fixes: #6891
2024-08-05 17:13:07 +03:00
Simon McVittie
eaa265c924 Avoid calling memcpy with n == 0
Some callers of these functions ask to copy 0 items from a NULL source,
which would be valid if they were copied in a loop (because NULL would
never be dereferenced), but is declared to be undefined behaviour for
Standard C memcpy. Guard the call to memcpy so that we only call it
if we have more than 0 items, and therefore should have a non-NULL
source pointer.

Detected by running a subset of the test suite with
-Dsanitize=address,undefined on x86_64.

Signed-off-by: Simon McVittie <smcv@debian.org>
2024-08-05 17:08:52 +03:00
Simon McVittie
d3dafb3998 gtktimsort: Avoid undefined behaviour on 32-bit
Shifting a 32-bit type by 32 bits is formally undefined behaviour,
even if it happens in code that is unreachable at runtime. Use a
compile-time check against GLib's GLIB_SIZEOF_SIZE_T, instead of hoping
a runtime check will be optimized away.

Signed-off-by: Simon McVittie <smcv@debian.org>
2024-08-05 17:08:39 +03:00
Simon McVittie
30df7d6082 gdk: Codify the requirement that gsize is pointer-sized
This is widely assumed, but is not guaranteed by Standard C, and is
known to be false on CHERI architectures (which have 64-bit sizes and
128-bit tagged pointers). Add a static assertion to ensure that GTK
will not build on platforms where this assumption does not hold.

As discussed on GNOME/gtk!7510, if GTK switches from gsize to uintptr_t
as its representation of the underlying bits in a pointer, GTK maintainers
would prefer that to be done project-wide so that it's done consistently,
after which this static assertion could be removed.

At the time of writing, GLib makes the same assumption (GNOME/glib#2842),
but GLib contributors are gradually removing it (mostly by replacing gsize
with uintptr_t where a pointer-sized quantity is needed). Finishing
that work in GLib would be a prerequisite for being able to make GTK
work on the affected platforms.

Signed-off-by: Simon McVittie <smcv@debian.org>
2024-08-05 17:06:10 +03:00
Simon McVittie
96bcf0a961 tests: Fix signature of GtkTestATContext::update-selection-bound handlers
The signal is declared in GtkTestATContext with 0 parameters, but these
handlers were written as if the signal had one `guint` parameter.
On some architectures this accidentally works as intended, but on
others (reproduced on i386 and riscv64) the test tries to use arbitrary
stack contents as the `TestData *` and crashes when it tries to
dereference the resulting non-pointer.

Resolves: https://gitlab.gnome.org/GNOME/gtk/-/issues/6490
Signed-off-by: Simon McVittie <smcv@debian.org>
2024-08-05 17:03:20 +03:00
Pablo Correa Gómez
54e9130320 gtkspinbutton: Set number input hint for text field if numeric
The main reason to do this is so that the OSK shows a numeric touchpad
instead of the regular keyboard when the spin button only accepts
numbers
2024-08-05 17:01:07 +03:00
Matthias Clasen
211a00e5e0 Merge branch 'gtk-4-14-backports' into 'gtk-4-14'
Backport 7237 and 7492 into 4.14

See merge request GNOME/gtk!7503
2024-07-27 01:39:42 +00:00
g.willems
66dc220e81 tooltip: query tooltip on widget under pointer only
When changing the tooltip text or markup of widget A, we simulate a
motion event on that widget to update the display.
But if there is an active tooltip on widget B, then the current code
belives we moved the pointer from B to A thus hides/shows the tooltip
of B alternatively.

Instead, simulate the motion event on the widget currently under the pointer.
This will avoid flickering if we keep the pointer over widget B.

Fixes #6674
Closes #6674

(cherry picked from commit d665274eb1)
2024-07-27 02:12:51 +03:00
Arjan Molenaar
15b8380210 macos: Propagate the create-folders option also for Open panels
When opening a folder, it may come in handy to create a folder.

Fixes #6872.

(cherry picked from commit 6bbda619f9)
2024-07-27 02:11:40 +03:00
Matthias Clasen
edb31b0a67 Merge branch 'gtk-4-14-backports' into 'gtk-4-14'
[GTK 4.14] Various backports

See merge request GNOME/gtk!7491
2024-07-25 12:35:08 +00:00
Marco Trevisan (Treviño)
0784067c0b gdkdmabufformats: Add autoptr definition 2024-07-25 13:20:19 +03:00
Sergey Bugaev
d6b2c2cb1f urilauncher: Fix use-after-free on GCC < 12
Building GTK with GCC 8 results in the following warning:

  gtk/gtkurilauncher.c: In function ‘gtk_uri_launcher_launch’:
  gtk/gtkurilauncher.c:315:3: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
     else
     ^~~~
  gtk/gtkurilauncher.c:317:1: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
   G_GNUC_BEGIN_IGNORE_DEPRECATIONS
   ^~~

In the compiled code, gtk_show_uri_full () is invoked whether the portal
branch is taken or not, leading to use-after-free of the task.

It looks like GCC in versions older than 12 treats the _Pragma(s) that
G_GNUC_BEGIN_IGNORE_DEPRECATIONS expands to as C-level statements, and
therefore the pragma takes up the 'else' statement slot.

See https://godbolt.org/z/e5zqbaqxo for a simple reproducer.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2024-07-25 13:20:19 +03:00
Jie Liu
63d38c0cc2 Ignore grabbing tablet devices without pads or tools
Signed-off-by: Jie Liu <liujie01@kylinos.cn>
2024-07-25 13:20:19 +03:00
Christian Hergert
9a1eb3eb61 columnview: check column visibility when measuring
We only want to measure visible columns so that they may consume the
maximum width available to the widget. This fixes a situation where hidden
columns would cause less-than the whole width to be allocated. Additionally
that fixes warnings where some widgets expect more horizontal space than
they would ultimately be allocated.
2024-07-25 13:20:19 +03:00
Balló György
bafc36aca6 Add missing icon
The fullcolor 'document-save' icon is used in the print dialog for the
'Print to File' element.
2024-07-25 13:20:19 +03:00
Matthias Clasen
54980e2b45 expander: Don't leave dangling a11y relations
If we unparent the widget, we should sever a11y relations too.
Otherwise, an a11y implementation might follow them and be surprised
to find a parentless widget (and not in a good way).

Updated tests to not check the relation on an unexpanded expander.
2024-07-25 13:20:19 +03:00
Matthias Clasen
f424b6bdf1 gsk: Avoid a crash
The subsurface in subsurface nodes can be NULL, so check before
poking at it.
2024-07-25 13:20:19 +03:00
Matthijs Velsink
90803c52e3 popover: Fix invalid width/height check in layout
Commit a4cc95b2 introduced a check in layout() that closes the popover
if the width or height is smaller than the minimum width or height,
respectively. However, that was using gtk_widget_get_preferred_size(),
which finds out the minimum height for the minimum width and vice versa,
but not the minimum height for the layout width and vice versa. So,
certain popovers were not showing, even though they would not have
generated a critical to begin with.

To fix this, we copy the logic from gtk_widget_allocate() that generates
the criticals, and use that to check if we have a good width/height for
the popover native or not.

Closes #6826
2024-07-25 13:20:19 +03:00
Matthijs Velsink
0e13ef1f00 popover: Take shadow size into account in measure
Commit b9487997 introduced shadows for GtkPopover. These are correctly
subtracted while allocating the child widget, but the child is not
measured with those shadows subtracted (as is correctly done for the
arrow). This can give criticals, for example with some wrapping labels.

To fix this, we subtract the shadow size from the `for_size` before
passing it to the measure() of the child widget.

Closes #5782
Fixes #6796
2024-07-25 13:20:19 +03:00
Matthias Clasen
2e9785db8a snapshot: Don't crash and don't leak
We were trying to handle a NULL mask child, unsuccessfully.

Pointed out by Niels De Graef.
2024-07-25 13:20:19 +03:00
Matthias Clasen
acbddd6634 dnd: Avoid a critical
There is no way for callers of this function to find out if
the drop is still the same, so spewing a critical if it isn't
seems useless. Just quietly do nothing.
2024-07-25 13:20:19 +03:00
Matthias Clasen
aecf2011df popover: Hide if we don't get enough size
If the compositor does not give us our min size, we have to
disappear, or we risk criticals from underallocating widgets.
2024-07-25 13:20:19 +03:00
Fabio Lagalla
ca36537f14 gdk: Implement fullscreen on selected monitor on macos
The feature was apparently missing, as monitors were always fullscreened at the surface best monitor.

Keep using best monitor if the selected monitor is not specified, otherwise move the window to the selected monitor before going fullscreen.
2024-07-25 13:20:19 +03:00
Matthias Clasen
97e3b55712 popover: Recompute shape more often
We want to recompute the shape when the attachment position has
changed, since that might require the arrow to be repositioned.
2024-07-25 13:20:19 +03:00
cameron
ef21b56e30 Fix Harfbuzz subset dependency not found in wrap
Add harfbuzz subset to the harfbuzz wrap file so Meson can find the
dependency.
2024-07-25 13:20:19 +03:00
Matthias Clasen
605b11cdb6 wayland: Add missing listeners
Now that we are using version 6 of the compositor interface,
we need to have preferred scale and bufer transform callbacks
everywhere.
2024-07-25 13:20:19 +03:00
gayathri.berli@ibm.com
4aabd7a402 changes to fix the memorytexture regression 2024-07-25 13:10:30 +03:00
g.willems
ca78d245c7 range: fix highlight clipping
Clipping on padding box prevents the scale highlight to fully paint itself
over the scale trough, including its border.
Use the border box instead.

Fixes #6332
2024-07-25 13:10:30 +03:00
g.willems
f886aa3ac3 progressbar: fix highlight clipping
Clipping using OVERFLOW_HIDDEN relies on widget's padding box.
This prevents the highlight to paint itself over the trough's borders.

Use the border box instead, with a custom snapshot implementation.

Fixes #6332
2024-07-25 13:10:30 +03:00
Benjamin Otte
2746d3386d testsuite: Shrink maximum texture size in test
1MB textures can lead to 20s runtimes - which with asan CI being a lot
slower can be a loooong time and cause timeouts.

Limiting them to 16kB still allows hitting max texture size sometimes
but makes sure the test only runs for 3-4s worst case.
I hope that doesn't trigger timeouts even under asan.
2024-07-25 13:10:30 +03:00
Georges Basile Stavracas Neto
aaba54051f filechooserwidget: Plug a bunch of GtkBitset leaks
gtk_selection_model_get_selection() is transfer full, and the returned
bitset must be freed by the caller. GtkFileChooserWidget freed none of
them.

Unref the bitsets.

Related: https://gitlab.gnome.org/GNOME/xdg-desktop-portal-gnome/-/issues/91
2024-07-25 13:10:30 +03:00
g.willems
6a6da0ba81 win32: Guarantee dnd-move as a cursor name
gdk currently falls back to the default cursor, which may not be
approriate for rendering a DnD move.
2024-07-25 13:10:30 +03:00
Alice Mikhaylenko
ac25e96aa1 spinner: Only set :checked state when mapped
Avoid doing the animation while it's invisible.

See https://gitlab.gnome.org/GNOME/gtk/-/issues/1025
2024-07-25 13:10:29 +03:00
Benjamin Otte
c459af78ff vulkan: Add a missing extension
We need to enable this one, too.

Thanks validation layers!
2024-07-25 13:10:29 +03:00
Dr. David Alan Gilbert
3a9bd9bd8a gdk: Remove unused struct 'XPointerUngrabInfo'
'XPointerUngrabInfo' appears unused since
commit 26cbf87d7d ("New approach for grab tracking code")
Remove it.

Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
2024-07-25 13:10:29 +03:00
Lukáš Tyrychtr
81e10228fe a11y: Realize the AT context before firing a children added event for it
This allows, with some other changes, AdwToasts to be read on appearance by Orca.
2024-07-24 14:59:23 +03:00
Benjamin Otte
eee0b1ecdd dmabuf: Ref previous context
In case the context's only reference was held by being the current
context, setting the new context would free it.

Resetting it later would then be a use-after-free.

Fixes #6694
2024-07-24 14:58:50 +03:00
Doğukan Korkmaztürk
7a3c6b77ef vulkan: Recreate swapchain when it is necessary or beneficial
Currently, GTK does not check the result of vkAcquireNextImageKHR() and
assumes that it always succeeds. As a result, the vkQueuePresentKHR() is
unconditionally set to wait for the semaphore passed to
vkAcquireNextImageKHR() earlier.

However, if vkAcquireNextImageKHR() fails for some reason, the semaphore
passed to it does not get signalled. This causes the presentation
command to wait for the semaphore to be signalled indefinitely, which
causes GTK to hang.

This change adds error handling around vkAcquireNextImageKHR() to make
GTK recreate the Vulkan swapchain when it is necessary or beneficial and
helps avoiding situations that could cause indefinite waits.
2024-07-24 14:58:27 +03:00
Georges Basile Stavracas Neto
85da031684 gtk-demo: Remove set-but-unused variable 2024-07-24 14:55:40 +03:00
Georges Basile Stavracas Neto
11381d8e64 win32/vulkancontext: Remove unused variable
Silences a compiler warning.
2024-07-24 14:54:54 +03:00
Georges Basile Stavracas Neto
f1d4cf9760 win32/wgl: Initialize hwnd to NULL
Otherwise there's a valid code path that may return it uninitialized.
2024-07-24 14:54:43 +03:00
Georges Basile Stavracas Neto
e9a35fe3f5 win32/cursor: Ignore GdkPixbuf deprecation warning
Seems harmless to ignore this for now, other bits of code also ignore
this.
2024-07-24 14:54:18 +03:00
Robert Ancell
ca1bb23edc glcontext: Remove duplicate check for GL version 2024-07-24 14:52:29 +03:00
Michael Weghorn
4061e9ed92 a11y atspi: Improve mapping for container roles
GTK_ACCESSIBLE_ROLE_GENERIC is for
"a nameless container that has no semantic meaning of its own",
for which AT-SPI role ATSPI_ROLE_PANEL [1]
("A generic container that is often used to group
objects.") fits better than ATSPI_ROLE_FILLER
("A object that fills up space in a user interface."),
so map to this one.

With this in place, widgets like GtkBox are again
reported with the panel role on AT-SPI level after
commit a86923de94
("a11y: Change the role for many containers"),
whose commit message suggests that the change
on the AT-SPI level was unintended.

For GTK_ACCESSIBLE_ROLE_GROUP, use the corresponding
ATSPI_ROLE_GROUPING ("A group of related widgets.
This group typically has a label.").

[1] https://docs.gtk.org/atspi2/enum.Role.html
2024-07-24 14:50:25 +03:00
Chao-Hsiung Liao
7b4780e2aa Update Chinese (Taiwan) translation 2024-07-16 13:01:10 +00:00
Pawan Chitrakar
d4a57811c7 Update Nepali translation 2024-07-14 07:40:45 +00:00
Pawan Chitrakar
4c97bde1ef Update Nepali translation 2024-07-11 09:52:13 +00:00
Chao-Hsiung Liao
25ac3c42e6 Update Chinese (Taiwan) translation 2024-07-08 22:56:49 +00:00
Danial Behzadi
74f368bc02 Update Persian translation 2024-06-28 22:10:17 +00:00
Matthias Clasen
0b3520049d Merge branch 'null-tile-cherry-pick-4-14' into 'gtk-4-14'
Cherry-pick Empty Listbase Crash Fix to 4.14

See merge request GNOME/gtk!7381
2024-06-27 01:22:33 +00:00
Matthias Clasen
e59c462f27 Merge branch '4-14-no-c-format' into 'gtk-4-14'
gtkfilechooserwidget: Mark string as no-c-format

See merge request GNOME/gtk!7377
2024-06-27 00:11:31 +00:00
Benjamin Otte
de52518018 columnview: Actually check the listview in return_if_fail()
This was missed when adding return_if_fail()s in
172cdf8e21.

Related: !7240
2024-06-25 23:50:33 +03:00
Khalid Abu Shawarib
bf47031699 listbase: Return early on non-existent scroll position 2024-06-25 23:50:30 +03:00
Anders Jonsson
a258f2b993 gtkfilechooserwidget: Mark string as no-c-format
gettext 0.22 recognizes %b as a C string format which
not is true for date strings, so explicitly mark as
no-c-format.

(cherry picked from commit 5df9b1cb5b)
2024-06-23 06:43:44 +02:00
Милош Поповић
0d007345b8 Update Serbian translation 2024-06-20 17:40:22 +00:00
Fran Dieguez
29bbd1f329 Update Galician translation 2024-06-11 21:00:59 +00:00
Rachida SACI
1892761b46 Update Kabyle translation 2024-06-07 02:24:11 +00:00
Matthias Clasen
b237d76b1a Merge branch 'michaelweghorn/gtk-4-14_a11y_label_name' into 'gtk-4-14'
a11y: Use text instead of label for GtkLabel's a11y name [GTK 4.14 backport]

See merge request GNOME/gtk!7317
2024-05-31 20:00:04 +00:00
Michael Weghorn
3143ab887e a11y: Use text instead of label for GtkLabel's a11y name
Update the `GTK_ACCESSIBLE_PROPERTY_LABEL` property
in `gtk_label_set_text_internal` using the new text
instead of using the label in
`gtk_label_set_label_internal`.

While the `label` "includes any embedded underlines
indicating mnemonics and Pango markup" [1], the
`text` is the "text is as it appears on screen" [2],
which is more suitable for the accessible name.

With this in place, the text is reported as the
accessible name again after

    commit d5b34aecdd
    Date:   Wed Jan 17 12:49:38 2024 +0100

        a11y: Remove special handling of accessible names for static text widgets

[1] https://docs.gtk.org/gtk4/method.Label.get_label.html
[2] https://docs.gtk.org/gtk4/method.Label.get_text.html

Fixes: #6732
Fixes: #6735
(cherry picked from commit 317e68a58c)
2024-05-30 07:55:44 +02:00
Matthias Clasen
1dbea91db4 Merge branch 'wip/xdg-dialog-4-14' into 'gtk-4-14'
gdk/wayland: Implement support for xdg-dialog Wayland protocol [4.14]

See merge request GNOME/gtk!7256
2024-05-29 23:16:34 +00:00
Matthias Clasen
355a9f4d13 Merge branch 'gtk-4-14-backports' into 'gtk-4-14'
[4.14] macOS backports

See merge request GNOME/gtk!7292
2024-05-29 23:14:49 +00:00
Matthias Clasen
0512da0ad4 Merge branch 'windows-fixes-backport' into 'gtk-4-14'
Backport: 32-bit Windows build and runtime fixes for NGL and Vulkan

See merge request GNOME/gtk!7307
2024-05-29 20:39:14 +00:00
Chun-wei Fan
9c478afbd7 gskvulkandevice.c: Put Vk[Pipeline|RenderPass] in structures
This way, we can simply duplicate the keys as separate pointers to store
the corresponding Vulkan handles so that we can safely hash them, as
Vulkan handles may or may not be pointers depending on the target
platform.

This will fix builds on 32-bit Windows at least.
2024-05-29 18:44:18 +08:00
Chun-wei Fan
757e35cf67 gdkvulkancontext.c: Use pointers to hash VkShaderModule
VkShaderModule's may or may not be pointers depending on the target
platform, so use pointers to hash those handles to be safe, and retrieve
them from hashes accordingly.

Fixes build on 32-bit Windows at least.
2024-05-29 18:44:06 +08:00
Chun-wei Fan
1029238d59 gskvulkanmemory.c: Use VK_NULL_HANDLE for VkDeviceMemory
...rather than NULL, so that things will build fine on non-LLP, non-64-bit
systems.
2024-05-29 18:43:55 +08:00
Chun-wei Fan
2312949713 gsk: Call glDeleteSync() directly
This function does not use the standard __cdecl calling convention on
Windows, meaning using g_clear_pointer() on it directly will cause
crashes on 32-bit Windows.  Just call it directly if the GLsync it uses
exists.
2024-05-29 18:43:38 +08:00
Benjamin Otte
79bf324468 Merge branch 'cherry-pick-3c149142' into 'gtk-4-14'
gsk: use the correct memory type index

See merge request GNOME/gtk!7291
2024-05-23 18:24:03 +00:00
Michael Catanzaro
d0641a656c text: fix critical in paste_received
Here we calculate the length only in the truncate_multiline condition.
Then we pass pos - 1 to gtk_accessible_text_update_contents() as the end
position, triggering this critical that checks to ensure start <= end.
Fix it by always calculating the length of the string that we insert.

This is the first bug fixed as a result of enabling fatal criticals by
default in Epiphany! 🎉

Fixes #6734


(cherry picked from commit eb4993d3fb)
2024-05-23 16:09:42 +00:00
Carlos Garnacho
726a6a883a gdk/wayland: Implement support for xdg-dialog Wayland protocol
This protocol lifts some functionality from the gtk-shell protocol,
namely the ability to tag dialogs as modal. Ensure to use this
new protocol if available for the task, instead of the gtk-shell
protocol.
2024-05-23 12:16:14 +02:00
Carlos Garnacho
a9513b6200 build: Handle in-tree copies of wayland protocols
Convert the array managing the Wayland protocols to contain
dictionary objects for each of the protocol definitions, in order
to make it easier to extend for extra keys in them.

And also add one such extra 'required' key, so that we can
optionally build protocols depending on the wayland-protocol
version detected at runtime. This is necessary to add fallbacks
for upstream protocols without necessarily bumping GTK dependency,
some versioning handling of private protocols was added too
for this purpose, so we can have in-tree copies of them.
2024-05-23 12:16:09 +02:00
Mat
605d1e4043 gdkmacossurface: Set surface before accessing it
Silences the following critial:
_gdk_macos_surface_update_fullscreen_state: assertion
'GDK_IS_MACOS_SURFACE (self)' failed
2024-05-23 01:40:48 +03:00
Mat
e29d84abdb macos: Take shadows into account when positioning popups
Otherwise popups will be misaligned. This becomes noticeable when larger
shadows are used, like in libadwaita.

Regression in 08216dcee9
2024-05-23 01:40:03 +03:00
Thomas Holder
32c765088d macOS: Dock "Quit" invokes "app.quit" action
Allows the application to handle "Dock icon > Quit" the same as
"Application menu > Quit".

Requires GtkApplication's `register-session` property.

Suitable replacement for gtk-mac-integration's
`NSApplicationBlockTermination` signal.
2024-05-23 01:39:30 +03:00
Benjamin Otte
3ae9c7381b Merge branch 'wip/otte/for-main' into 'main'
gsk: use the correct memory type index

See merge request GNOME/gtk!7287

(cherry picked from commit 3c1491423a)

130a6fe0 gsk: use the correct memory type index
2024-05-22 22:07:30 +00:00
Matthias Clasen
db444e6d4a Merge branch 'inspector-hint-style-crash' into 'gtk-4-14'
[GTK 4.14] inspector: Prevent crash when hint style isn't set

See merge request GNOME/gtk!7277
2024-05-21 11:06:37 +00:00
Mat
f426ac6f54 inspector: Prevent crash when hint style isn't set
The hint style can be null, e.g. on macOS.
2024-05-20 23:31:39 +03:00
Matthias Clasen
a2fc5eb3f8 inspector: Avoid writing settings back needlessly
We were a bit careless and were writing some values back to the
GtkSettings on init, possibly with rounding errors. Avoid that.
2024-05-20 22:48:27 +03:00
Balázs Úr
b76c2967e3 Update Hungarian translation 2024-05-19 23:42:17 +00:00
Jordi Mas i Hernandez
27d75be15e Update Catalan translation 2024-05-15 19:53:51 +00:00
Jordi Mas i Hernandez
8ccc36c389 Update Catalan translation 2024-05-15 18:02:46 +00:00
Matthias Clasen
995eb418a3 gsk: Speed up mask nodes with cairo
Switch symbolc icon drawing from color-matrix to mask nodes
make the performance of the iconscroll demo crater (from 60fps
to 10fps).

Apply the same optimization we already have for color-matrix
nodes when drawing mask nodes. This gets us back to 60fps.

Fixes: #6700
2024-05-10 21:41:43 -04:00
Hugo Carvalho
d73d5819d5 Update Portuguese translation 2024-05-09 16:03:20 +00:00
Hugo Carvalho
40e99590e7 Update Portuguese translation 2024-05-09 16:01:45 +00:00
Hugo Carvalho
a249b58094 Update Portuguese translation 2024-05-04 22:22:28 +00:00
Matthias Clasen
93bb2200f4 Post-release version bump 2024-05-02 22:07:13 -04:00
Matthias Clasen
8593797a6f 4.14.4 2024-05-02 19:33:26 -04:00
Matthias Clasen
dd2349aa0b Merge branch '4-14-backports' into 'gtk-4-14'
roaring: Fix some ubsan warnings

See merge request GNOME/gtk!7219
2024-05-02 17:16:40 +00:00
Christian Hergert
4d8bb515fb undo: fix off-by-one when prepending to inline string
This fixes the conditional in istring_prepend() to match other uses,
notably to match istring_append().

Fixes #6684
2024-05-01 20:57:51 -04:00
Matthias Clasen
957ff91fa5 Revert "gdk/frameclock: add mark when we discover frames may drop"
This reverts commit 84a304e66e.

This produces marks that are confusing to me. They don't correlate
with actual gaps in the frame cycle and often overlap with regular
'window presented' marks. Also, the function we are emitting these
marks from is called from the get_frame_time getter, and we
definitely don't want to emit marks from there.
2024-05-01 20:57:51 -04:00
Matthias Clasen
839128200f a11y: Drop the Focus event from the interface too
We don't use it anymore.
2024-05-01 20:57:51 -04:00
Matthias Clasen
8926fa3473 a11y: Stop emitting Focus events
These have been deprecated for a long time, and we have been asked
to stop emitting them.

Related: #454
2024-05-01 20:57:51 -04:00
Matthias Clasen
a1abdc2c06 gtk-demo: Better accessibility for the sidebar
Add an accessible description saying how many search reasults
we have. This is an experiment.

Related: #6678
2024-05-01 20:57:51 -04:00
Matthias Clasen
2acd04e5b3 vulkan: Don't forget to update the cache size
In order for the size change check to make sense, vk_pipeline_cache_size
needs to correspond to the size of the cache we last wrote to disk.

We were forgetting to update it after saving the cache, so the
check was ineffective.
2024-05-01 20:57:51 -04:00
Matthias Clasen
2aabbdf069 x11: Implement a missing method
Vulkan on X11 was getting spew for missing an empty_frame
implementation.
2024-05-01 20:57:51 -04:00
Benjamin Otte
fa88ca15c0 dmabuf: Use narrow range instead of full range
It's way more common, and Mutter uses it, too.

Avoid visual glitches when going in/out of offload.

Fixes #6672
2024-05-01 20:57:51 -04:00
Matthias Clasen
d9b64c7952 More consistency fixes for texture utils
Be consistent about filename vs path.
2024-05-01 20:57:51 -04:00
Matthias Clasen
2ca10228b3 All non-integral scales in texture utils
This might be used with fractional scales in the future.
2024-05-01 20:57:51 -04:00
Matthias Clasen
16f8b79567 scaler: Consistency fixes
Follow the pattern that we use in GDK:
scale_factor = int
scale = double
2024-05-01 20:57:51 -04:00
Matthias Clasen
4c133b4c2a Consistency fixes for texture utils
Use the with_fg naming consistently.
2024-05-01 20:57:51 -04:00
Matthias Clasen
4e1ca384a4 testsuite: Make offload tests more robust
Skip the offload tests when we find ourselves in situations
where offloading won't work.
2024-05-01 20:57:51 -04:00
Matthias Clasen
e37e44a6bd reftests: Stop using xpm images
We are phasing out the fringe pixbuf loaders, so xpm is going
away as a default-supported image format.
2024-05-01 20:51:58 -04:00
Matthias Clasen
e10f26fc8a docs: Clarify the cairo interaction section
This was giving outdated advice.
2024-05-01 20:51:58 -04:00
Matthias Clasen
d09a678165 Speed up symbolic svg loading
If the svg doesn't use the symbolic style classes, we can avoid
loading it multiple times.

This brought the time for loading system-run-symbolic at 256@2
from 6.8ms down to 2ms.
2024-05-01 20:51:58 -04:00
Matthias Clasen
378758e68b Reencode all our symbolic pngs
This adds the only-foreground information and will let us use
these symbolics more efficiently.
2024-05-01 20:51:58 -04:00
Matthias Clasen
64923b3e60 Add 'only foreground' to texture utility api
Add an 'only_fg' argument to all our internal texture utility
api, so GtkIconTheme can find out if a symbolic png or svg uses
colors beyond the foreground or not.

This information is used in gtk_symbolic_paintable_snapshot_symbolic
to optimize rendering of such symbolic icons.
2024-05-01 20:51:58 -04:00
Matthias Clasen
dd91a70241 loaders: Make it possible to load png options
We want to store some metadata in our symbolic pngs, so make it
possible to get options when loading a png, along with the texture.

Update all callers.
2024-05-01 20:51:58 -04:00
Matthias Clasen
8f335ee14a Small optimization
Avoid copying a potentially large blob more than necessary.
2024-05-01 20:51:58 -04:00
Joshua Lee
b46dfb84e5 path builder: Fix doc typo 2024-05-01 20:51:58 -04:00
Benjamin Otte
90ca47464a reftests: Use longer words when testing wrapping
"Hello" might be shorter than "Hi Ho" in some fonts and then that one
gets wrapped, too.

So choose perfectly cromulent words for this purpose instead.
2024-05-01 20:51:58 -04:00
Benjamin Otte
73d46edf73 glcontext: Split dmabuf import codepaths
Use different codepaths for known formats vs unknown formats.

Be more careful with unknown formats and always import them as
GL_TEXTURE_EXTERNAL_OES when possible (GL can't do EXTERNAL) to avoid
problems.

This is a more defensive approach towards older drivers that don't
support modifiers.

This fixes importing YUV textures on AMD Gen8.

Another approach would be to check for YUV and never try
GL_TEXTURE_2D with them, but I decided to go this way first.

Fixes #6668
2024-05-01 20:51:58 -04:00
Benjamin Otte
b0f305e6ba gpu: Handle tiny offscreens
Due to rounding errors, it is possible after intersecting a lot of
rectangles to end up with a tiny size for an offscreen. And because we
allow an epsilon before ceil()ing to an integer (see commit afc7b46264
for details) it is now possible that we end up with a size of 0.

Avoid that by always enforcing a minimum size of 1px.

Test included

The test uses a different codepath to arrive at the same problem - it
specifies the small size instead of triggering it via rounding errors
and clipping like the original bug (and most likely the more common case
to encounter this problem.

Fixes #6656
2024-05-01 20:51:58 -04:00
Benjamin Otte
179c696405 path: document enum 2024-05-01 20:51:58 -04:00
Matthias Clasen
d33daf311c atcontext: Add a few missing values
Add a missing value to the naming array, and sort the recent additions
alphabetically.

Fixes: #6575
2024-05-01 20:51:58 -04:00
Matthias Clasen
0aef967f31 label: Report errors
Print a warning when launching a handler fails.
2024-05-01 20:51:58 -04:00
Matthias Clasen
9a95f45416 linkbutton: Report errors
Print a warning when launching a handler fails.

Fixes: #6446
2024-05-01 20:51:58 -04:00
Matthias Clasen
4e44b78a20 listview: Fix some oversights
The list factory widget was notifying the wrong properties.
2024-05-01 20:51:58 -04:00
Matthias Clasen
a1537e608e gsk: Add a warning for inefficient texture import
With GSK_DEBUG=fallback, warn if a non-memory texture has to be
downloaded for importing it into Vulkan or GL.
2024-05-01 20:51:58 -04:00
Sebastian Dröge
aa90a3cb94 Don't crash if snapshotting a GtkGraphicsOffload without child 2024-05-01 20:51:58 -04:00
Chun-wei Fan
23a046c1f8 gskvulkandescriptors.c: Don't return value from void-rettype function
Fixes builds on Visual Studio with Vulkan enabled, as later GLib releases
consider this as an error on Visual Studio builds.
2024-05-01 20:51:58 -04:00
Chun-wei Fan
43910ae33c GStreamer media backend: Fix building and running on Windows
Visual Studio (and possibly other non-GCC compilers) do not like
uses of #-preprocessor directives in macro usage (warning C5101: use of
preprocessor directive in function-like macro argument list is undefined
behavior is also shown), so fix the build by defining another macro
accordingly.
2024-05-01 20:51:58 -04:00
Matthias Clasen
10345e134f macos: Respect the default-settings debug key
This makes our behavior more consistent across platforms.
The suggestion came up in discussion in #6545.
2024-05-01 20:51:58 -04:00
Sebastian Wick
830ba15ab7 gdk: Consider XDG_ACTIVATION_TOKEN for the startup notification id
We prefer it over the old DESKTOP_STARTUP_ID environment variable if we
have it and it is valid.

We have to stash and unset XDG_ACTIVATION_TOKEN in addition to
DESKTOP_STARTUP_ID now as well. This makes sure that we don't call any
library functions which might rely on some environment variables. This
way unsetting the environment variables is safe and we can then
afterwards validate and print warnings.
2024-05-01 20:51:58 -04:00
Alice Mikhaylenko
2da17eede2 csstokenizer: Fix an out of bounds when reading an ident followed by EOF 2024-05-01 20:51:58 -04:00
Matthias Clasen
d4ed30bacc testsuite: Fix another ubsan warning
The expression here was a bit too dense for ubsan to figure out
what branches aren't hit.
2024-05-01 20:51:58 -04:00
Matthias Clasen
5118324c03 lsan: Don't suppress glib and gio leaks
These are useful to see and not all that common.
2024-05-01 20:51:58 -04:00
Matthias Clasen
40d55cb4a7 gtk: Fix more ubsan warnings
Most of these are calling a get_instance_private() function before
checking that the object isn't NULL.
2024-05-01 20:51:58 -04:00
Matthias Clasen
176a34ea9c wayland: Fix an ubsan warning
dev_t requires 8-byte alignment, so we need to use memcpy.
2024-05-01 20:51:58 -04:00
Matthias Clasen
e6cff9d7c5 inspector: Fix an ubsan warning
These values are too big for int, so cast them to double.
2024-05-01 20:51:58 -04:00
Matthias Clasen
e117f6abb5 roaring: Fix some ubsan warnings
Avoid warnings about memcpy (NULL, NULL, 0).
2024-05-01 20:51:58 -04:00
Rachida SACI
fa15170fd4 Update Kabyle translation 2024-05-01 14:56:18 +00:00
Artur S0
ad1103ee0d Update Russian translation 2024-04-29 11:55:14 +00:00
Christian Kirbach
3aefbef59a Update German translation 2024-04-28 19:03:21 +00:00
Matthias Clasen
4e34059e52 Merge branch 'amolenaar/macos-event-propagation-backport' into 'gtk-4-14'
[backport] macos: Avoid repeatedly sending events back to macOS

See merge request GNOME/gtk!7182
2024-04-26 18:28:32 +00:00
Arjan Molenaar
df9a90a83a macos: Add some docs for the different NSEvent getters 2024-04-25 19:16:37 +02:00
Arjan Molenaar
1af4a47491 macos: fix in-app native shortcuts (again)
Popping an event of the queue in the IMContext handler
prevents it from being forwarded to the NSApp, in case the
(key) event was not handled by IMContext.

So I reverted to a mix of the original (4.13) and new (4.14.1) behavior
for fetching events: NSEvent lookup for IMContext uses loose matching,
so it can work with rewritten events. When sending events to NSApp, only
we're checking for an exact match.

Now in-app keyboard shortcuts (e.g. Ctrl-F2) work from within text
fields again.
2024-04-25 19:16:11 +02:00
Arjan Molenaar
79451fcb72 macos: Avoid repeatedly sending events back to macOS
in the old approach it was possible that one NSEvent was
sent to the underlying NSApp multiple times. This resulted in
those events being forwarded to our (glib) event queue again.

The visual result was that no screen updates were done. Under the hood
the application was very busy with passing events around.

By popping the events off of our event queue, we make sure they're sent
only once.
2024-04-25 19:15:45 +02:00
Benjamin Otte
88586e27a3 Merge branch 'cherry-pick-e9dcf816' into 'gtk-4-14'
vulkan/image: Use GENERAL for initial layout of DMA-BUF textures

See merge request GNOME/gtk!7180
2024-04-24 21:53:29 +00:00
Benjamin Otte
5d6e74357c Merge branch 'gbsneto/vulkan-dmabuf-general' into 'main'
vulkan/image: Use GENERAL for initial layout of DMA-BUF textures

See merge request GNOME/gtk!7179

(cherry picked from commit e9dcf8167c)

3aa6c27c vulkan/image: Use GENERAL for initial layout of DMA-BUF textures
2024-04-24 20:57:33 +00:00
Changwoo Ryu
e1dafd7a5d Update Korean translation 2024-04-23 11:33:38 +00:00
Andika Triwidada
66de0cddfa Update Indonesian translation 2024-04-23 07:25:55 +00:00
Luca Bacci
74abebb214 Merge branch 'backport-win32-fixes' into 'gtk-4-14'
[4.14] GdkWin32: Remove some work arounds that are not needed anymore

See merge request GNOME/gtk!7156
2024-04-22 13:22:36 +00:00
Matthias Clasen
680de2d8ad Merge branch 'gtk-4-14-backports' into 'gtk-4-14'
docs: Improve a reference

See merge request GNOME/gtk!7163
2024-04-21 23:32:02 +00:00
Sebastian Dröge
161aebe09a Drop return value annotation of gtk_graphics_offload_new()
A floating reference is returned, not a full reference. By having no
annotation, like for all other widget constructors, the correct default
is used again.
2024-04-21 14:58:04 -04:00
Matthias Clasen
f0075f2ad6 docs: Improve a reference
DConf is not what we use, it is actually GSettings.

Fixes: #6635
2024-04-21 14:57:28 -04:00
Luca Bacci
64e512054c 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-20 16:03:39 +03:00
Luca Bacci
cde8ceae49 GdkWin32: Don't explicitly set the transient owner as active
...when a transient child is hidden.

The system does that automatically
2024-04-20 16:03:25 +03:00
Luca Bacci
9b8826f8a7 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-20 16:03:07 +03:00
Aurimas Černius
49046f5c34 Update Lithuanian translation 2024-04-20 10:39:32 +00:00
Matthias Clasen
2c5eb581ca Post-release version bump 2024-04-18 22:00:05 -04:00
Matthias Clasen
686a629f98 4.14.3 2024-04-18 21:30:02 -04:00
Andi Chandler
e26c5945a9 Update British English translation 2024-04-18 22:44:44 +00:00
Matthias Clasen
a9119bb394 Merge branch '4-14-backports' into 'gtk-4-14'
Various cherry-picks for GTK 4.14

See merge request GNOME/gtk!7150
2024-04-18 16:59:03 +00:00
Boyuan Yang
8039a96b49 Update Chinese (China) translation 2024-04-18 14:16:59 +00:00
Matthias Clasen
3f03834ad6 NEWS: Updates 2024-04-17 22:09:59 -04:00
oreo639
ec14f9a4c6 x11: Remove last_wmspec_check_time
In fetch_net_wm_check_window(), before updating the wmspec_check_window, a
check is performed to verify a 15s difference between last_wmspec_check_time
and the current monotonic time.

The comment suggests that this check is done to ensure that it doesn't check
for a new check window repeatedly over and over again. While that was the case
origionally, currently the last_wmspec_check_time only gets updated when
wmspec_check_window is set, which is already checked earlier, making the time
check useless.

This check causes issues on cold boots where gtk4 applications are not able
to obtain the wmspec_check_window until 15 seconds after boot, making gtk
unable to check for extended wm_hints during that time.

Fixes: #6558
2024-04-17 22:02:18 -04:00
Emmanuele Bassi
421938816f docs: Update contribution guide
- Fix link to the security policy
- Drop the confusing note about SSH access (with the old URL)
- Use modern idiomatic Meson subcommands for configuring and building
- Use `git switch` instead of `git checkout`
- Specify that you should always use merge requests, not patches
- Link to the handbook instead of the wiki
2024-04-17 22:01:31 -04:00
Christian Hergert
a2336d908f rendernode-tool: add support for rendering to PDF 2024-04-17 22:01:18 -04:00
Matthias Clasen
f2588532c0 wayland: Cosmetics
Don't clear the same pointer twice.
2024-04-17 22:00:39 -04:00
Peter Eisenmann
62603dd80e grid-view: make footer tile file empty space 2024-04-17 22:00:28 -04:00
Matthias Clasen
e890503143 gsk: Fix a minor type mismatch
Use the same types in the declaration of gsk_standard_contour_init.

Fixes: #6628
2024-04-17 21:59:50 -04:00
Matthias Clasen
2d3979fbb5 docs: Update some links
Use docs.gtk.org for all the documentation that is hosted there.
2024-04-17 21:59:23 -04:00
Philip Withnall
913dd8cdc4 gsk: Fix a maybe-uninitialized warning
The compiler (gcc 13.2) thinks that `t` could be used uninitialised.
That’s obviously not the case, because there’s always going to be at
least one loop iteration due to the initial values of `t1` and `t2`.

Change the loop to a `do…while` to make that a bit clearer to the
compiler without making any functional changes to the code.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-04-17 21:59:08 -04:00
Philip Withnall
8eb051f6df gdk: Fix a maybe-uninitialized warning
If there somehow end up being no `supported_versions`, `ctx` would end
up being dereferenced before being initialised. While I think that’s
unlikely, the compiler doesn’t know that, so let’s just initialise the
variable unconditionally.

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
2024-04-17 21:59:00 -04:00
Matthias Clasen
7e2cb727b8 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-17 21:58:48 -04:00
Matthias Clasen
918b5e9bc1 dmabuf texture: Survive multiple disposes
dispose can be called more than once, so be safe for that.
2024-04-17 21:58:28 -04:00
Hansem Ro
497da6b301 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-17 21:56:35 -04:00
Matthijs Velsink
137be79931 shortcutmanager: Track propagation phase of added controllers
GtkShortcutManager allows adding controllers to it. For the default
implementation, they get added to one of two models, based on the
propagation phase (either GTK_PHASE_CAPTURE or GTK_PHASE_BUBBLE).

However, when a controller is removed, its presence in the manager gets
checked against the current propagation phase of the controller, which
may have changed from when it was added. This can lead to crashes if the
controller was not disposed properly since it still has a reference in
one of the two models of the GtkShortcutManager.

To fix this, add a callback for `notify::propagation-phase`, which
removes the controller from all possible models and readds it again with
its current phase. This callback is only disconnected permanently when
the controller is manually removed with
`gtk_shortcut_manager_default_remove_controller()`.

Closes #6246
2024-04-17 21:56:07 -04:00
Dylan McCall
49e145ba70 docs: Clarify state and active properties in GtkSwitch
Remove duplicate descriptions of the switch's appearance, describe more
particularly how the default signal handler for `GtkSwitch::state-set`
behaves, and add a suggestion that the `state` property should
only be set when communicating a delayed state change.

Fixes #6600
2024-04-17 21:55:32 -04:00
Anders Jonsson
f920f51300 Update Swedish translation 2024-04-14 11:21:57 +00:00
Lukáš Tyrychtr
55e8d0ce60 a11y: Implement GtkAccessibleRange for scrollbars
Fixes gnome-control-center#2994
2024-04-12 10:46:49 +02:00
Matthias Clasen
2d423c0289 Merge branch 'builder-warning-backport' into 'gtk-4-14'
builder: Show warning for invalid action on GtkShortcut

See merge request GNOME/gtk!7123
2024-04-09 22:51:50 +00:00
Matthijs Velsink
315a03759a builder: Show warning for invalid action on GtkShortcut
The parsing for a `GTK_TYPE_SHORTCUT_ACTION` on a GtkShortcut in a
builder file can fail, resulting in a `NULL` GtkShortcutAction. This
currently does not result in any warnings, potentially making typos in
builder files tricky to debug.

Since `gtk_shortcut_action_parse_builder()` already sets an error if it
fails, we can just use that and simply return false.
2024-04-09 18:11:08 -04:00
Matthias Clasen
7d323b862e Merge branch 'cherry-pick-460eaac1' into 'gtk-4-14'
Merge branch 'wip/otte/for-main' into 'main'

See merge request GNOME/gtk!7122
2024-04-09 17:57:16 +00:00
Benjamin Otte
56b4ef80c4 Merge branch 'wip/otte/for-main' into 'main'
vulkan: Handle generating mipmaps for 1x1 images

Closes #6553

See merge request GNOME/gtk!7073

(cherry picked from commit 460eaac1f4)

9fe9ea34 vulkan: Handle generating mipmaps for 1x1 images
3080e297 gpu: ceil() offscreen size before generating offscreen
02d78176 demo: Use get_fps() in fishbowl demo
2024-04-09 16:40:00 +00:00
Leônidas Araújo
235388fdcd Update Brazilian Portuguese translation 2024-04-09 13:26:34 +00:00
Sabri Ünal
f62c1b367d Update Turkish translation 2024-04-09 09:56:06 +00:00
Yaron Shahrabani
b19247e4ef Update Hebrew translation 2024-04-06 13:19:07 +00:00
Piotr Drąg
9f7925fb52 Update Polish translation 2024-04-06 12:32:19 +02:00
Danial Behzadi
58d48cd3e5 Update Persian translation 2024-04-05 12:40:45 +00:00
Athmane MOKRAOUI
65e843ee67 Update Kabyle translation 2024-04-05 09:19:35 +00:00
Asier Sarasua Garmendia
e54ecf5e32 Update Basque translation 2024-04-05 08:43:37 +00:00
Martin
b9b3f29f42 Update Slovenian translation 2024-04-04 22:16:16 +00:00
Ekaterine Papava
b233b2372d Update Georgian translation 2024-04-04 19:08:17 +00:00
Yuri Chornoivan
c59d73e1e6 Update Ukrainian translation 2024-04-04 19:03:24 +00:00
Matthias Clasen
646c758f67 Merge branch 'more-context-4-14' into 'gtk-4-14'
printing: Add context to some strings

See merge request GNOME/gtk!7108
2024-04-04 17:02:53 +00:00
Matthias Clasen
7fa3711986 printing: Add context to some strings
The job priority strings need context to disambiguate them from
similar short strings elsewhere.
2024-04-04 18:18:00 +02:00
Matthias Clasen
675649ebea Merge branch 'stable-backports' into 'gtk-4-14'
Revert "gsk: Avoid some allocations"

See merge request GNOME/gtk!7106
2024-04-04 14:44:54 +00:00
Matthias Clasen
0d510ef057 Add context to some translatable strings
This was requested by Alexandre Franke.

Fixes: #6609
2024-04-04 15:33:52 +02:00
Matthias Clasen
cd556c3811 spinbutton: Fix a corner case
Fix a bug where a zero increment would make the value unsettable,
when the more natural operation is to allow any value to be set.
2024-04-04 15:33:37 +02:00
Matthias Clasen
eeca751fdc Revert "spinbutton: Tangential refactoring, small fix"
This reverts commit 3d898af736.

The commit caused a regression where, depending on the update policy,
we would not apply value changes at all.

Fixes: #6599
2024-04-04 15:33:28 +02:00
Athmane MOKRAOUI
118bcb5688 Update Kabyle translation 2024-04-04 12:40:03 +00:00
Matthias Clasen
248631a2dd Merge branch 'work-with-old-pango' into 'gtk-4-14'
Revert "gsk: Avoid some allocations"

See merge request GNOME/gtk!7101
2024-04-04 11:59:17 +00:00
Matthias Clasen
96aa58e9b0 Revert "gsk: Avoid some allocations"
This reverts commit 144cd2d91c.

This commit is causing problems when using GTK 4.14 with
Pango 1.51.

Fixes: #6606
2024-04-04 12:30:00 +02:00
341 changed files with 21082 additions and 21405 deletions

View File

@@ -445,8 +445,9 @@ reference:
--force-fallback-for=gdk-pixbuf,pango
-Dintrospection=enabled
-Ddocumentation=true
-Dgtk_doc=true
-Dgdk-pixbuf:gtk_doc=true
-Dpango:documentation=true
-Dpango:gtk_doc=true
-Dbuild-demos=false
-Dbuild-examples=false
-Dbuild-tests=false

View File

@@ -24,7 +24,7 @@ flatpak build ${builddir} meson \
-Dbuild-examples=false \
-Dintrospection=disabled \
-Dbuild-demos=true \
-Dprofile=devel \
-Ddemo-profile=devel \
_flatpak_build
flatpak build --env=CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA ${builddir} ninja -C _flatpak_build install

177
NEWS
View File

@@ -1,12 +1,72 @@
Overview of Changes in 4.15.1, xx-xx-xxxx
Overview of Changes in 4.14.5, 16-08-2024
=========================================
* GtkSpinner:
- Only set :checked state when mapped to avoid animation overhead
* GtkFileChooserWidget:
- Plug memory leaks
* GtkProgressBar, GtkRange:
- Fix hightlight clipping
* GtkSpinButton:
- Set number input hint for numeric spin buttons
* GtkPopover:
- Recompute the sampe more often
- Handle allocation corner cases better
* GtkIconTheme:
- Fix an argument order mishap that could lead to wrong icon selection
* Accessibility:
- Use text instead of label for GtkLabesl accessible name
- Improve the role mapping for containers
- Realize the AT context when needed to fix AdwToast
- Fix handling or relations in GtkExpander
* GDK:
- Don't leak EGLSurfaces
* GSK:
- Speed up mask nodes with cairo
* Vulkan:
- Recreate the swapchain when necessary or beneficial
* Wayland:
- Support the xdg-dialog protocol
* macOS:
- Make Dock>Quit invoke the "app.quit" action
- Take shadows into account when positioning popups
- Propagate create-folder to Open panels
* Windows:
- Backport build and runtime fixes for 32bit Windows
- Ensure the dnd-move cursor exists
* Translation updates
Catalan
Chinese (Taiwan)
Galician
Hindi
Hungarian
Kabyle
Nepali
Persian
Portuguese
Romanian
Serbian
Overview of Changes in 4.14.4, 02-05-2024
=========================================
* GtkGraphicsOffload:
- Don't crash without a child
* CSS:
- Support the :root selector
* Icontheme:
- Make symbolic svg loading more efficient
- Handle color-free symbolics more efficiently
@@ -17,141 +77,56 @@ Overview of Changes in 4.15.1, xx-xx-xxxx
* GDK:
- Support XDG_ACTIVATION_TOKEN
- dmabuf: Be more defensive when importing unknown formats to GL
- dmabuf: Be more defensive when importing unknown formats to G
- dmabuf: Use narrow range for YUV
* GSK:
- Improve logging for GDK_DEBUG=offload
- Improve logging for GSK_DEBUG=renderer
- gpu: Warn about inefficient texture import
- gpu: Handle tiny offscreens correctly
- vulkan: Add profiler marks in various places
- vulkan: Fix a problem with imported dmabufs showing up black
* Wayland:
- Use wl_compositor version 6
* X11:
- Implement a missing method
- gpu: Handle tiny offscreens correctl
* Build:
- Fix many ubsan warnings
- Fix many ubsan warning
* Debugging:
- Show more texture details in the recorder
* macOS:
* macOS
- Fix problems with events handed back to the OS
- Respect GDK_DEBUG=default-settings
* Translation updates:
German
Indonesian
Kabyle
Korean
Turkish
Lithuanian
Russian
Overview of Changes in 4.15.0, 21-04-2024
Overview of Changes in 4.14.3, 18-04-2024
=========================================
This release changes the default GSK renderer to be Vulkan, on
Wayland. Other platforms still use ngl.
The intent of this change is to get wider testing and verify that
Vulkan drivers are good enough for us to rely on. If significant
problems show up, we will revert this change for 4.16.
You can still override the renderer choice using the GSK_RENDERER
environment variable.
---
This release also changes font rendering settings by introducing
a new high-level gtk-font-rendering settings which gives GTK more
freedom to decide on font rendering.
You can still use the low-level font-related settings by changing
the new property to 'manual'.
---
* GtkColumnView:
- Fix infinite loops in dispose
- Fix problems with weak ref cycles in GtkExpression
* GtkListView:
* GtkShortcutManager:
- Track the propagation phase of added controllers
* GtkGLArea:
- Produce dmabuf textures, so graphics offload is possible
* GtkTextView:
- Support text shadows
* GtkGraphicsOffload:
- Add a black-background property
* Settings:
- Add a new gtk-font-rendering setting
* Accessibility:
- Add support for GetRangeExtents to GtkAccessibleText
- Add support for GetOffsetAtPoint to GtkAccessibleText
- Implement GtkAccessibleRange for scrollbars
* GDK:
- Add a callback-based cursor API
* GSK:
- Use the Vulkan renderer by default
- Avoid an infinite recursion with offscreens in some cases
- Optimize graphics offload to make it more likely that compositors
can use direct scanout
* X11:
- Fix some confusing debug messages
- Drop a no-longer-relevant optimization that was interfering with
getting the current window manager capabilities
* macOS:
- Implement the color picker for macOS 10.15+
* Debugging:
- Snow monitor resolution in the inspector
* Demos:
- Use graphics offload in the shadertoy demo
- Show more reliable fps numbers in the fishbowl demo
* Tools:
- Support generating pdf in gtk4-rendernode-tool
* Build:
- Require pango 1.52
- Require cairo 1.18
- Add a missing dependency that was causing build failures
- Drop deprecated build options:
gtk_doc -> documentation
update_screenshots -> screenshots
demo-profile -> profile
demos -> build-demos
* Deprecations:
- gdk_widget_set/get_font_options
- gdk_wayland/x11_display_set_cursor_theme
* Translation updates:
Basque
Brazilian Portuguese
British English
Chinese (China)
Georgian
Hebrew
Kabyle
Persian
Polish
Russian
Slovenian
Swedish
Turkish
Ukrainian
Overview of Changes in 4.14.2, 03-04-2024

View File

@@ -186,7 +186,7 @@
"config-opts" : [
"--libdir=/app/lib",
"-Dbuildtype=debugoptimized",
"-Dprofile=devel"
"-Ddemo-profile=devel"
],
"sources" : [
{

View File

@@ -115,7 +115,7 @@
"config-opts" : [
"--libdir=/app/lib",
"-Dbuildtype=debugoptimized",
"-Dprofile=devel"
"-Ddemo-profile=devel"
],
"sources" : [
{

View File

@@ -115,7 +115,7 @@
"config-opts" : [
"--libdir=/app/lib",
"-Dbuildtype=debugoptimized",
"-Dprofile=devel"
"-Ddemo-profile=devel"
],
"sources" : [
{

View File

@@ -115,7 +115,7 @@
"config-opts" : [
"--libdir=/app/lib",
"-Dbuildtype=debugoptimized",
"-Dprofile=devel"
"-Ddemo-profile=devel"
],
"sources" : [
{

View File

@@ -15,54 +15,12 @@ on_destroy (gpointer data)
window = NULL;
}
static GdkTexture *
cursor_callback (GdkCursor *cursor,
int cursor_size,
double scale,
int *width,
int *height,
int *hotspot_x,
int *hotspot_y,
gpointer data)
{
GdkPixbuf *pixbuf;
GdkTexture *texture;
GError *error = NULL;
int scaled_size;
scaled_size = ceil (cursor_size * scale);
pixbuf = gdk_pixbuf_new_from_resource_at_scale ("/cursors/images/gtk-logo.svg",
scaled_size, scaled_size,
TRUE,
&error);
if (!pixbuf)
{
g_print ("%s\n", error->message);
g_error_free (error);
return NULL;
}
texture = gdk_texture_new_for_pixbuf (pixbuf);
g_object_unref (pixbuf);
*width = cursor_size;
*height = cursor_size;
*hotspot_x = 18 * cursor_size / 32.0;
*hotspot_y = 2 * cursor_size / 32.0;
return texture;
}
GtkWidget *
do_cursors (GtkWidget *do_widget)
{
if (!window)
{
GtkBuilder *builder;
GtkWidget *logo_callback;
GdkCursor *cursor;
builder = gtk_builder_new_from_resource ("/cursors/cursors.ui");
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
@@ -71,10 +29,6 @@ do_cursors (GtkWidget *do_widget)
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (on_destroy), NULL);
logo_callback = GTK_WIDGET (gtk_builder_get_object (builder, "logo_callback"));
cursor = gdk_cursor_new_from_callback (cursor_callback, NULL, NULL, NULL);
gtk_widget_set_cursor (logo_callback, cursor);
g_object_unref (cursor);
g_object_unref (builder);
}

File diff suppressed because it is too large Load Diff

View File

@@ -116,7 +116,6 @@
<file>w_resize_cursor.png</file>
<file>zoom_in_cursor.png</file>
<file>zoom_out_cursor.png</file>
<file>gtk-logo.svg</file>
</gresource>
<gresource prefix="/dnd">
<file>dnd.css</file>

View File

@@ -363,9 +363,7 @@ insert_markup_idle (gpointer data)
if (g_get_monotonic_time () - begin > G_TIME_SPAN_MILLISECOND)
{
guint id;
id = g_idle_add (insert_markup_idle, data);
g_source_set_name_by_id (id, "[gtk-demo] insert_markup_idle");
g_idle_add (insert_markup_idle, data);
return G_SOURCE_REMOVE;
}
@@ -400,9 +398,7 @@ parse_markup_idle (gpointer data)
do {
if (g_get_monotonic_time () - begin > G_TIME_SPAN_MILLISECOND)
{
guint id;
id = g_idle_add (parse_markup_idle, data);
g_source_set_name_by_id (id, "[gtk-demo] parse_markup_idle");
g_idle_add (parse_markup_idle, data);
return G_SOURCE_REMOVE;
}

View File

@@ -1,138 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="128"
height="128"
id="svg6843"
sodipodi:version="0.32"
inkscape:version="0.92.4 5da689c313, 2019-01-14"
version="1.0"
sodipodi:docname="gtk-logo.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
inkscape:export-filename="/home/ebassi/Pictures/gtk-logo-256.png"
inkscape:export-xdpi="192"
inkscape:export-ydpi="192">
<defs
id="defs6845">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="-50 : 600 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="700 : 600 : 1"
inkscape:persp3d-origin="300 : 400 : 1"
id="perspective13" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="2.8284271"
inkscape:cx="69.874353"
inkscape:cy="64.313526"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:document-units="px"
inkscape:grid-bbox="true"
width="128px"
height="128px"
showguides="true"
inkscape:guide-bbox="true"
inkscape:window-width="1920"
inkscape:window-height="1016"
inkscape:window-x="0"
inkscape:window-y="27"
inkscape:window-maximized="1">
<inkscape:grid
type="xygrid"
id="grid7947" />
</sodipodi:namedview>
<metadata
id="metadata6848">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
<dc:date />
<dc:creator>
<cc:Agent>
<dc:title />
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent>
<dc:title />
</cc:Agent>
</dc:rights>
<dc:publisher>
<cc:Agent>
<dc:title />
</cc:Agent>
</dc:publisher>
<dc:identifier />
<dc:source />
<dc:relation />
<dc:language />
<dc:subject>
<rdf:Bag />
</dc:subject>
<dc:coverage />
<dc:description />
<dc:contributor>
<cc:Agent>
<dc:title />
</cc:Agent>
</dc:contributor>
<cc:license
rdf:resource="" />
</cc:Work>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
sodipodi:nodetypes="ccccc"
id="path6976"
d="M 20.88413,30.82696 L 53.816977,55.527708 L 107.33282,39.060543 L 70.587303,17.177763 L 20.88413,30.82696 z"
style="fill:#729fcf;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline" />
<path
id="path6978"
d="M 22.94243,82.287118 L 20.88413,30.82696 L 53.816977,55.527708 L 53.816977,111.10486 L 22.94243,82.287118 z"
style="fill:#e40000;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline" />
<path
id="path6980"
d="M 53.816977,111.10486 L 103.21619,90.5207 L 107.33282,39.060543 L 53.816977,55.527708 L 53.816977,111.10486 z"
style="fill:#7fe719;fill-opacity:1;fill-rule:evenodd;stroke:#ffffff;stroke-width:2.12364459;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;display:inline" />
<path
sodipodi:nodetypes="ccc"
id="path6982"
d="M 23.216626,81.319479 L 70.48573,67.361442 L 103.38422,90.444516"
style="opacity:1;fill:none;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
<path
sodipodi:nodetypes="cc"
id="path6984"
d="M 70.434539,17.875593 L 70.434539,66.984877"
style="opacity:1;fill:#babdb6;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 4.8 KiB

View File

@@ -120,7 +120,7 @@ create_shadertoy_window (GtkWidget *do_widget)
gtk_box_append (GTK_BOX (box), aspect);
shadertoy = new_shadertoy ("/shadertoy/alienplanet.glsl");
gtk_aspect_frame_set_child (GTK_ASPECT_FRAME (aspect), gtk_graphics_offload_new (shadertoy));
gtk_aspect_frame_set_child (GTK_ASPECT_FRAME (aspect), shadertoy);
sw = gtk_scrolled_window_new ();
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (sw), 250);

View File

@@ -330,7 +330,6 @@ stroke bounds of the path.
| offset | `<point>` | 0 0 | non-default |
| hint-style | `<hint style>` | slight | non-default |
| antialias | `<antialias>` | gray | non-default |
| hint-metrics | `<hint metrics>` | off | non-default |
Creates a node like `gsk_text_node_new()` with the given properties.
@@ -347,7 +346,6 @@ font, an error node will be returned.
Possible values for hint-style are none, slight or full.
Possible value for antialias are none or gray.
Possible value for hint-metrics are on or off.
### texture

View File

@@ -74,7 +74,6 @@ in a selector, widget names must be prefixed with a &num; character.
| E:not(selector) | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#negation) | |
| E:dir(ltr), E:dir(rtl) | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#the-dir-pseudo) | |
| E:drop(active) | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#drag-pseudos) | |
| E:root | [CSS Selector Level 3](https://www.w3.org/TR/selectors-3/#root-pseudo) | |
| E F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#descendent-combinators) | |
| E > F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#child-combinators) | |
| E ~ F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#general-sibling-combinators) | |

View File

@@ -56,30 +56,6 @@ follows:
1 value:
: all
## Custom Properties
GTK supports custom properties as defined in the
[CSS Custom Properties for Cascading Variables](https://www.w3.org/TR/css-variables-1)
spec.
Custom properties are defined as follows:
```css
--prop: red;
```
and used via the `var` keyword:
```css
color: var(--prop);
```
Custom properties can have a fallback for when the referred property is invalid:
```css
color: var(--prop, green);
```
## Colors
GTK extends the CSS syntax with several additional ways to specify colors.

View File

@@ -8,10 +8,6 @@ gtk4-broadwayd
The Broadway display server
---------------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------
| **gtk4-broadwayd** [OPTIONS...] <DISPLAY>

View File

@@ -8,10 +8,6 @@ gtk4-builder-tool
GtkBuilder File Utility
-----------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------
| **gtk4-builder-tool** <COMMAND> [OPTIONS...] <FILE>

View File

@@ -8,9 +8,6 @@ gtk4-demo-application
Demonstrate GtkApplication
--------------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------

View File

@@ -8,10 +8,6 @@ gtk4-demo
Demonstrate GTK widgets
-----------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------

View File

@@ -8,10 +8,6 @@ gtk4-encode-symbolic-svg
Symbolic icon conversion utility
--------------------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------

View File

@@ -8,10 +8,6 @@ gtk4-icon-browser
List themed icons
-----------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------

View File

@@ -8,10 +8,6 @@ gtk4-launch
Launch an application
---------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------

View File

@@ -8,10 +8,6 @@ gtk4-node-editor
Editor render nodes
-----------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------

View File

@@ -8,10 +8,6 @@ gtk4-path-tool
GskPath Utility
-----------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------
| **gtk4-path-tool** <COMMAND> [OPTIONS...] <PATH>

View File

@@ -8,10 +8,6 @@ gtk4-query-settings
Print name and value of GTK settings
------------------------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------

View File

@@ -8,10 +8,6 @@ gtk4-rendernode-tool
GskRenderNode Utility
-----------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------
| **gtk4-rendernode-tool** <COMMAND> [OPTIONS...] <FILE>
@@ -49,14 +45,13 @@ without any titlebar.
Rendering
^^^^^^^^^
The ``render`` command saves a rendering of the rendernode as a png, tiff or svg
image or as pdf document. The name of the file to write can be specified as a second
FILE argument.
The ``render`` command saves a rendering of the rendernode as a png or tiff image.
The name of the file to write can be specified as a second FILE argument.
``--renderer=RENDERER``
Use the given renderer. Use ``--renderer=help`` to get a information
about possible values for the ``RENDERER``.
about poassible values for the ``RENDERER``.
Benchmark
^^^^^^^^^
@@ -98,4 +93,4 @@ exit code is 1. If the images are identical, it is 0.
``--quiet``
Don't write results to stdout.
Don't write results to stdout.`

View File

@@ -8,10 +8,6 @@ gtk4-update-icon-cache
Icon theme caching utility
--------------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------

View File

@@ -8,10 +8,6 @@ gtk4-widget-factory
Showcase GTK widgets and styles
-------------------------------
:Version: GTK
:Manual section: 1
:Manual group: GTK commands
SYNOPSIS
--------

View File

@@ -80,7 +80,7 @@ if get_option('man-pages') and rst2man.found()
[ 'gtk4-path-tool', '1', ],
]
if get_option('build-demos')
if get_option('demos')
rst_files += [
[ 'gtk4-demo', '1', ],
[ 'gtk4-demo-application', '1', ],

View File

@@ -217,10 +217,6 @@ A number of options affect behavior instead of logging:
`no-portals`
: Disable use of [portals](https://docs.flatpak.org/en/latest/portals.html)
`force-offload`
: Force graphics offload for all textures, even when slower. This allows
to debug offloading in the absence of dmabufs.
`gl-disable`
: Disable OpenGL support

View File

@@ -155,7 +155,6 @@ Each property name is part of the `GtkAccessibleProperty` enumeration.
| %GTK_ACCESSIBLE_PROPERTY_VALUE_MIN | “aria-valuemin” | double |
| %GTK_ACCESSIBLE_PROPERTY_VALUE_NOW | “aria-valuenow” | double |
| %GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT | “aria-valuetext” | translatable string |
| %GTK_ACCESSIBLE_PROPERTY_HELP_TEXT | N/A | translatable string |
#### List of accessible relations
@@ -217,10 +216,6 @@ are accessible as part of the development process. The GTK Inspector shows
the accessible attributes of each widget, and also provides an overlay that
can highlight accessibility issues.
If you support some non-standard keyboard interactions for a widget, you
**should** set an appropriate `GTK_ACCESSIBLE_PROPERTY_HELP_TEXT` to help
discoverability of the behavior.
It is possible to set accessible attributes in UI files as well:
```xml
<object class="GtkButton" id="button1">

View File

@@ -91,31 +91,6 @@ const GDK_META_MASK = 1 << 28;
var useDataUrls = window.location.search.includes("datauri");
/* check if we are on Android and using Chrome */
var isAndroidChrome = false;
{
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf("android") > -1 && ua.indexOf("chrom") > -1) {
isAndroidChrome = true;
}
}
/* check for the passive option for Event listener */
let passiveSupported = false;
try {
const options = {
get passive() { // This function will be called when the browser
// attempts to access the passive property.
passiveSupported = true;
return false;
}
};
window.addEventListener("test", null, options);
window.removeEventListener("test", null, options);
} catch(err) {
passiveSupported = false;
}
/* This base64code is based on https://github.com/beatgammit/base64-js/blob/master/index.js which is MIT licensed */
var b64_lookup = [];
@@ -240,32 +215,11 @@ function logStackTrace(len) {
log(callstack[i]);
}
/* Helper functions for touch identifier to make it unique on Android */
var globalTouchIdentifier = Math.round(Date.now() / 1000);
function touchIdentifierStart(tId)
{
if (isAndroidChrome) {
if (tId == 0) {
return ++globalTouchIdentifier;
}
return globalTouchIdentifier + tId;
}
return tId;
}
function touchIdentifier(tId)
{
if (isAndroidChrome) {
return globalTouchIdentifier + tId;
}
return tId;
}
var grab = new Object();
grab.surface = null;
grab.ownerEvents = false;
grab.implicit = false;
var keyDownList = [];
var inputList = [];
var lastSerial = 0;
var lastX = 0;
var lastY = 0;
@@ -1033,14 +987,7 @@ function handleDisplayCommands(display_commands)
break;
case DISPLAY_OP_DELETE_SURFACE:
var id = cmd[1];
if (id == surfaceWithMouse) {
surfaceWithMouse = 0;
}
if (id == realSurfaceWithMouse) {
realSurfaceWithMouse = 0;
firstTouchDownId = null;
}
delete surfaces[id];
delete surfaces[id];
break;
case DISPLAY_OP_CHANGE_TEXTURE:
var image = cmd[1];
@@ -1424,14 +1371,8 @@ function getEffectiveEventTarget (id) {
function updateKeyboardStatus() {
if (fakeInput != null && showKeyboardChanged) {
showKeyboardChanged = false;
if (showKeyboard) {
if (isAndroidChrome) {
fakeInput.blur();
fakeInput.value = ' '.repeat(80); // TODO: Should be exchange with broadway server
// to bring real value here.
}
if (showKeyboard)
fakeInput.focus();
}
else
fakeInput.blur();
}
@@ -2983,19 +2924,6 @@ function pushKeyEvent(fev) {
keyDownList.push(fev);
}
function copyInputEvent(ev) {
var members = ['inputType', 'data'], i, obj = {};
for (i = 0; i < members.length; i++) {
if (typeof ev[members[i]] !== "undefined")
obj[members[i]] = ev[members[i]];
}
return obj;
}
function pushInputEvent(fev) {
inputList.push(fev);
}
function getKeyEvent(keyCode, pop) {
var i, fev = null;
for (i = keyDownList.length-1; i >= 0; i--) {
@@ -3094,29 +3022,6 @@ function handleKeyUp(e) {
keysym = fev.keysym;
else {
//log("Key event (keyCode = " + ev.keyCode + ") not found on keyDownList");
if (isAndroidChrome && (ev.keyCode == 229)) {
var i, fev = null, len = inputList.length, str;
for (i = 0; i < len; i++) {
fev = inputList[i];
switch(fev.inputType) {
case "deleteContentBackward":
sendInput(BROADWAY_EVENT_KEY_PRESS, [65288, lastState]);
sendInput(BROADWAY_EVENT_KEY_RELEASE, [65288, lastState]);
break;
case "insertText":
if (fev.data !== undefined) {
for (let sym of fev.data) {
sendInput(BROADWAY_EVENT_KEY_PRESS, [sym.codePointAt(0), lastState]);
sendInput(BROADWAY_EVENT_KEY_RELEASE, [sym.codePointAt(0), lastState]);
}
}
break;
default:
break;
}
}
inputList.splice(0, len);
}
keysym = 0;
}
@@ -3125,16 +3030,6 @@ function handleKeyUp(e) {
return cancelEvent(ev);
}
function handleInput (e) {
var fev = null, ev = (e ? e : window.event), keysym = null, suppress = false;
fev = copyInputEvent(ev);
pushInputEvent(fev);
// Stop keypress events just in case
return cancelEvent(ev);
}
function onKeyDown (ev) {
updateForEvent(ev);
return handleKeyDown(ev);
@@ -3150,11 +3045,6 @@ function onKeyUp (ev) {
return handleKeyUp(ev);
}
function onInput (ev) {
updateForEvent(ev);
return handleInput(ev);
}
function cancelEvent(ev)
{
ev = ev ? ev : window.event;
@@ -3186,14 +3076,13 @@ function onMouseWheel(ev)
}
function onTouchStart(ev) {
ev.preventDefault();
event.preventDefault();
updateKeyboardStatus();
updateForEvent(ev);
for (var i = 0; i < ev.changedTouches.length; i++) {
var touch = ev.changedTouches.item(i);
var touchId = touchIdentifierStart(touch.identifier);
var origId = getSurfaceId(touch);
var id = getEffectiveEventTarget (origId);
@@ -3201,7 +3090,7 @@ function onTouchStart(ev) {
var isEmulated = 0;
if (firstTouchDownId == null) {
firstTouchDownId = touchId;
firstTouchDownId = touch.identifier;
isEmulated = 1;
if (realSurfaceWithMouse != origId || id != surfaceWithMouse) {
@@ -3216,54 +3105,52 @@ function onTouchStart(ev) {
}
}
sendInput (BROADWAY_EVENT_TOUCH, [0, id, touchId, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
sendInput (BROADWAY_EVENT_TOUCH, [0, id, touch.identifier, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
}
}
function onTouchMove(ev) {
ev.preventDefault();
event.preventDefault();
updateKeyboardStatus();
updateForEvent(ev);
for (var i = 0; i < ev.changedTouches.length; i++) {
var touch = ev.changedTouches.item(i);
var touchId = touchIdentifier(touch.identifier);
var origId = getSurfaceId(touch);
var id = getEffectiveEventTarget (origId);
var pos = getPositionsFromEvent(touch, id);
var isEmulated = 0;
if (firstTouchDownId == touchId) {
if (firstTouchDownId == touch.identifier) {
isEmulated = 1;
}
sendInput (BROADWAY_EVENT_TOUCH, [1, id, touchId, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
sendInput (BROADWAY_EVENT_TOUCH, [1, id, touch.identifier, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
}
}
function onTouchEnd(ev) {
ev.preventDefault();
event.preventDefault();
updateKeyboardStatus();
updateForEvent(ev);
for (var i = 0; i < ev.changedTouches.length; i++) {
var touch = ev.changedTouches.item(i);
var touchId = touchIdentifier(touch.identifier);
var origId = getSurfaceId(touch);
var id = getEffectiveEventTarget (origId);
var pos = getPositionsFromEvent(touch, id);
var isEmulated = 0;
if (firstTouchDownId == touchId) {
if (firstTouchDownId == touch.identifier) {
isEmulated = 1;
firstTouchDownId = null;
}
sendInput (BROADWAY_EVENT_TOUCH, [2, id, touchId, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
sendInput (BROADWAY_EVENT_TOUCH, [2, id, touch.identifier, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
}
}
@@ -3280,11 +3167,11 @@ function setupDocument(document)
document.onkeyup = onKeyUp;
if (document.addEventListener) {
document.addEventListener('DOMMouseScroll', onMouseWheel, passiveSupported ? { passive: false, capture: false } : false);
document.addEventListener('mousewheel', onMouseWheel, passiveSupported ? { passive: false, capture: false } : false);
document.addEventListener('touchstart', onTouchStart, passiveSupported ? { passive: false, capture: false } : false);
document.addEventListener('touchmove', onTouchMove, passiveSupported ? { passive: false, capture: false } : false);
document.addEventListener('touchend', onTouchEnd, passiveSupported ? { passive: false, capture: false } : false);
document.addEventListener('DOMMouseScroll', onMouseWheel, false);
document.addEventListener('mousewheel', onMouseWheel, false);
document.addEventListener('touchstart', onTouchStart, false);
document.addEventListener('touchmove', onTouchMove, false);
document.addEventListener('touchend', onTouchEnd, false);
} else if (document.attachEvent) {
element.attachEvent("onmousewheel", onMouseWheel);
}
@@ -3350,14 +3237,12 @@ function connect()
};
var iOS = /(iPad|iPhone|iPod)/g.test( navigator.userAgent );
if (iOS || isAndroidChrome) {
if (iOS) {
fakeInput = document.createElement("input");
fakeInput.type = "text";
fakeInput.style.position = "absolute";
fakeInput.style.left = "-1000px";
fakeInput.style.top = "-1000px";
document.body.appendChild(fakeInput);
if (isAndroidChrome)
fakeInput.addEventListener('input', onInput, passiveSupported ? { passive: false, capture: false } : false);
}
}

View File

@@ -43,6 +43,14 @@
#include <fribidi.h>
/* GTK has a general architectural assumption that gsize is pointer-sized
* (equivalent to uintptr_t), making it non-portable to architectures like
* CHERI where that isn't true. If a future release relaxes that
* assumption, changes will be needed in numerous places.
* See also https://gitlab.gnome.org/GNOME/glib/-/issues/2842 for the
* equivalent in GLib, which would be a prerequisite. */
G_STATIC_ASSERT (sizeof (gsize) == sizeof (void *));
G_STATIC_ASSERT (G_ALIGNOF (gsize) == G_ALIGNOF (void *));
/**
* GDK_WINDOWING_X11:
@@ -122,7 +130,6 @@ static const GdkDebugKey gdk_debug_keys[] = {
{ "portals", GDK_DEBUG_PORTALS, "Force use of portals" },
{ "no-portals", GDK_DEBUG_NO_PORTALS, "Disable use of portals" },
{ "force-offload", GDK_DEBUG_FORCE_OFFLOAD, "Force graphics offload for all textures" },
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" },
{ "gl-no-fractional", GDK_DEBUG_GL_NO_FRACTIONAL, "Disable fractional scaling for OpenGL" },
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },

View File

@@ -156,9 +156,6 @@ gdk_cursor_finalize (GObject *object)
g_clear_object (&cursor->texture);
g_clear_object (&cursor->fallback);
if (cursor->destroy)
cursor->destroy (cursor->data);
G_OBJECT_CLASS (gdk_cursor_parent_class)->finalize (object);
}
@@ -256,11 +253,6 @@ gdk_cursor_hash (gconstpointer pointer)
hash ^= g_str_hash (cursor->name);
else if (cursor->texture)
hash ^= g_direct_hash (cursor->texture);
else if (cursor->callback)
{
hash ^= g_direct_hash (cursor->callback);
hash ^= g_direct_hash (cursor->data);
}
hash ^= (cursor->hotspot_x << 8) | cursor->hotspot_y;
@@ -289,10 +281,6 @@ gdk_cursor_equal (gconstpointer a,
ca->hotspot_y != cb->hotspot_y)
return FALSE;
if (ca->callback != cb->callback ||
ca->data != cb->data)
return FALSE;
return TRUE;
}
@@ -367,45 +355,6 @@ gdk_cursor_new_from_texture (GdkTexture *texture,
NULL);
}
/**
* gdk_cursor_new_from_callback:
* @callback: the `GdkCursorGetTextureCallback`
* @data: data to pass to @callback
* @destroy: destroy notify for @data
* @fallback: (nullable): the `GdkCursor` to fall back to when
* this one cannot be supported
*
* Creates a new callback-based cursor object.
*
* Cursors of this kind produce textures for the cursor
* image on demand, when the @callback is called.
*
* Returns: (nullable): a new `GdkCursor`
*
* Since: 4.16
*/
GdkCursor *
gdk_cursor_new_from_callback (GdkCursorGetTextureCallback callback,
gpointer data,
GDestroyNotify destroy,
GdkCursor *fallback)
{
GdkCursor *cursor;
g_return_val_if_fail (callback != NULL, NULL);
g_return_val_if_fail (fallback == NULL || GDK_IS_CURSOR (fallback), NULL);
cursor = g_object_new (GDK_TYPE_CURSOR,
"fallback", fallback,
NULL);
cursor->callback = callback;
cursor->data = data;
cursor->destroy = destroy;
return cursor;
}
/**
* gdk_cursor_get_fallback: (attributes org.gtk.Method.get_property=fallback)
* @cursor: a `GdkCursor`
@@ -510,22 +459,3 @@ gdk_cursor_get_hotspot_y (GdkCursor *cursor)
return cursor->hotspot_y;
}
GdkTexture *
gdk_cursor_get_texture_for_size (GdkCursor *cursor,
int cursor_size,
double scale,
int *width,
int *height,
int *hotspot_x,
int *hotspot_y)
{
if (cursor->callback == NULL)
return NULL;
return cursor->callback (cursor,
cursor_size, scale,
width, height,
hotspot_x, hotspot_y,
cursor->data);
}

View File

@@ -51,52 +51,6 @@ GDK_AVAILABLE_IN_ALL
GdkCursor* gdk_cursor_new_from_name (const char *name,
GdkCursor *fallback);
/**
* GdkCursorGetTestureCallback:
* @cursor: the `GdkCursor`
* @cursor_size: the nominal cursor size, in application pixels
* @scale: the device scale
* @width: (out): return location for the actual cursor width,
* in application pixels
* @height: (out): return location for the actual cursor height,
* in application pixels
* @hotspot_x: (out): return location for the hotspot X position,
* in application pixels
* @hotspot_y: (out): return location for the hotspot Y position,
* in application pixels
* @data: User data for the callback
*
* The type of callback used by a dynamic `GdkCursor` to generate
* a texture for the cursor image at the given @cursor_size
* and @scale.
*
* The actual cursor size in application pixels may be different
* from @cursor_size x @cursor_size, and will be returned in
* @width, @height. The returned texture should have a size that
* corresponds to the actual cursor size, in device pixels (i.e.
* application pixels, multiplied by @scale).
*
* This function may fail and return `NULL`, in which case
* the fallback cursor will be used.
*
* Returns: (nullable) (transfer full): the cursor image, or
* `NULL` if none could be produced.
*/
typedef GdkTexture * (* GdkCursorGetTextureCallback) (GdkCursor *cursor,
int cursor_size,
double scale,
int *width,
int *height,
int *hotspot_x,
int *hotspot_y,
gpointer data);
GDK_AVAILABLE_IN_4_16
GdkCursor * gdk_cursor_new_from_callback (GdkCursorGetTextureCallback callback,
gpointer data,
GDestroyNotify destroy,
GdkCursor *fallback);
GDK_AVAILABLE_IN_ALL
GdkCursor * gdk_cursor_get_fallback (GdkCursor *cursor);
GDK_AVAILABLE_IN_ALL

View File

@@ -44,10 +44,6 @@ struct _GdkCursor
GdkTexture *texture;
int hotspot_x;
int hotspot_y;
GdkCursorGetTextureCallback callback;
gpointer data;
GDestroyNotify destroy;
};
struct _GdkCursorClass
@@ -59,13 +55,5 @@ guint gdk_cursor_hash (gconstpointer
gboolean gdk_cursor_equal (gconstpointer a,
gconstpointer b);
GdkTexture * gdk_cursor_get_texture_for_size (GdkCursor *cursor,
int cursor_size,
double scale,
int *width,
int *height,
int *hotspot_x,
int *hotspot_y);
G_END_DECLS

View File

@@ -44,7 +44,7 @@ typedef enum {
GDK_DEBUG_NO_PORTALS = 1 << 15,
GDK_DEBUG_GL_DISABLE = 1 << 16,
GDK_DEBUG_GL_NO_FRACTIONAL= 1 << 17,
GDK_DEBUG_FORCE_OFFLOAD = 1 << 18,
GDK_DEBUG_GL_DISABLE_GL = 1 << 19,
GDK_DEBUG_GL_DISABLE_GLES = 1 << 20,
GDK_DEBUG_GL_PREFER_GL = 1 << 21,

View File

@@ -2361,7 +2361,7 @@ gdk_dmabuf_is_disjoint (const GdkDmabuf *dmabuf)
{
struct stat plane_stat;
if (fstat (dmabuf->planes[0].fd, &plane_stat) != 0)
if (fstat (dmabuf->planes[i].fd, &plane_stat) != 0)
return TRUE;
if (first_stat.st_ino != plane_stat.st_ino)

View File

@@ -207,7 +207,8 @@ gdk_dmabuf_formats_new (GdkDmabufFormat *formats,
self->n_formats = n_formats;
self->formats = g_new (GdkDmabufFormat, n_formats);
memcpy (self->formats, formats, n_formats * sizeof (GdkDmabufFormat));
if (n_formats != 0)
memcpy (self->formats, formats, n_formats * sizeof (GdkDmabufFormat));
return self;
}

View File

@@ -55,4 +55,6 @@ GDK_AVAILABLE_IN_4_14
gboolean gdk_dmabuf_formats_equal (const GdkDmabufFormats *formats1,
const GdkDmabufFormats *formats2);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (GdkDmabufFormats, gdk_dmabuf_formats_unref);
G_END_DECLS

View File

@@ -25,7 +25,6 @@
#include "gdkdmabufformatsbuilderprivate.h"
#include "gdkdmabuffourccprivate.h"
#include "gdkdmabufprivate.h"
#include "gdkdmabuftexturebuilderprivate.h"
#include "gdktextureprivate.h"
#include <gdk/gdkglcontext.h>
#include <gdk/gdkgltexturebuilder.h>

View File

@@ -25,7 +25,6 @@
#include "gdkdisplay.h"
#include "gdkenumtypes.h"
#include "gdkdmabuftextureprivate.h"
#include "gdkdmabuftexturebuilderprivate.h"
#include <cairo-gobject.h>
@@ -949,20 +948,22 @@ gdk_dmabuf_texture_builder_set_update_region (GdkDmabufTextureBuilder *self,
*
* Builds a new `GdkTexture` with the values set up in the builder.
*
* It is a programming error to call this function if any mandatory property has not been set.
* It is a programming error to call this function if any mandatory
* property has not been set.
*
* Not all formats defined in the `drm_fourcc.h` header are supported. You can use
* [method@Gdk.Display.get_dmabuf_formats] to get a list of supported formats. If the
* format is not supported by GTK, %NULL will be returned and @error will be set.
* If the dmabuf is not supported by GTK, %NULL will be returned and @error will be set.
*
* The `destroy` function gets called when the returned texture gets released.
*
* It is possible to call this function multiple times to create multiple textures,
* possibly with changing properties in between.
*
* It is the responsibility of the caller to keep the file descriptors for the planes
* open until the created texture is no longer used, and close them afterwards (possibly
* using the @destroy notify).
*
* It is possible to call this function multiple times to create multiple textures,
* possibly with changing properties in between.
* Not all formats defined in the `drm_fourcc.h` header are supported. You can use
* [method@Gdk.Display.get_dmabuf_formats] to get a list of supported formats.
*
* Returns: (transfer full) (nullable): a newly built `GdkTexture` or `NULL`
* if the format is not supported
@@ -1003,19 +1004,3 @@ gdk_dmabuf_texture_builder_get_dmabuf (GdkDmabufTextureBuilder *self)
{
return &self->dmabuf;
}
void
gdk_dmabuf_texture_builder_set_dmabuf (GdkDmabufTextureBuilder *self,
const GdkDmabuf *dmabuf)
{
gdk_dmabuf_texture_builder_set_fourcc (self, dmabuf->fourcc);
gdk_dmabuf_texture_builder_set_modifier (self, dmabuf->modifier);
gdk_dmabuf_texture_builder_set_n_planes (self, dmabuf->n_planes);
for (unsigned int i = 0; i < dmabuf->n_planes; i++)
{
gdk_dmabuf_texture_builder_set_fd (self, i, dmabuf->planes[i].fd);
gdk_dmabuf_texture_builder_set_stride (self, i, dmabuf->planes[i].stride);
gdk_dmabuf_texture_builder_set_offset (self, i, dmabuf->planes[i].offset);
}
}

View File

@@ -1,14 +0,0 @@
#pragma once
#include "gdkdmabuftexturebuilder.h"
#include "gdkdmabufprivate.h"
G_BEGIN_DECLS
const GdkDmabuf * gdk_dmabuf_texture_builder_get_dmabuf (GdkDmabufTextureBuilder *builder);
void gdk_dmabuf_texture_builder_set_dmabuf (GdkDmabufTextureBuilder *builder,
const GdkDmabuf *dmabuf);
G_END_DECLS

View File

@@ -7,6 +7,8 @@
G_BEGIN_DECLS
const GdkDmabuf * gdk_dmabuf_texture_builder_get_dmabuf (GdkDmabufTextureBuilder *builder);
GdkTexture * gdk_dmabuf_texture_new_from_builder (GdkDmabufTextureBuilder *builder,
GDestroyNotify destroy,
gpointer data,

View File

@@ -744,11 +744,3 @@ gdk_monitor_set_description (GdkMonitor *monitor,
g_object_notify_by_pspec (G_OBJECT (monitor), props[PROP_DESCRIPTION]);
}
#define MM_PER_INCH 25.4
double
gdk_monitor_get_dpi (GdkMonitor *monitor)
{
return MAX ((monitor->geometry.width * monitor->scale) / (monitor->width_mm / MM_PER_INCH),
(monitor->geometry.height * monitor->scale) / (monitor->height_mm / MM_PER_INCH));
}

View File

@@ -76,7 +76,6 @@ void gdk_monitor_set_subpixel_layout (GdkMonitor *monitor,
void gdk_monitor_invalidate (GdkMonitor *monitor);
void gdk_monitor_set_description (GdkMonitor *monitor,
const char *description);
double gdk_monitor_get_dpi (GdkMonitor *monitor);
G_END_DECLS

View File

@@ -98,9 +98,9 @@ gdk_rgba_free (GdkRGBA *rgba)
* Returns: %TRUE if the @rgba is clear
*/
gboolean
(gdk_rgba_is_clear) (const GdkRGBA *rgba)
gdk_rgba_is_clear (const GdkRGBA *rgba)
{
return _gdk_rgba_is_clear (rgba);
return rgba->alpha < ((float) 0x00ff / (float) 0xffff);
}
/**
@@ -115,9 +115,9 @@ gboolean
* Returns: %TRUE if the @rgba is opaque
*/
gboolean
(gdk_rgba_is_opaque) (const GdkRGBA *rgba)
gdk_rgba_is_opaque (const GdkRGBA *rgba)
{
return _gdk_rgba_is_opaque (rgba);
return rgba->alpha > ((float)0xff00 / (float)0xffff);
}
#define SKIP_WHITESPACES(s) while (*(s) == ' ') (s)++;
@@ -368,10 +368,21 @@ gdk_rgba_hash (gconstpointer p)
* Returns: %TRUE if the two colors compare equal
*/
gboolean
(gdk_rgba_equal) (gconstpointer p1,
gconstpointer p2)
gdk_rgba_equal (gconstpointer p1,
gconstpointer p2)
{
return _gdk_rgba_equal (p1, p2);
const GdkRGBA *rgba1, *rgba2;
rgba1 = p1;
rgba2 = p2;
if (rgba1->red == rgba2->red &&
rgba1->green == rgba2->green &&
rgba1->blue == rgba2->blue &&
rgba1->alpha == rgba2->alpha)
return TRUE;
return FALSE;
}
/**

View File

@@ -43,34 +43,5 @@
gboolean gdk_rgba_parser_parse (GtkCssParser *parser,
GdkRGBA *rgba);
#define gdk_rgba_is_clear(rgba) _gdk_rgba_is_clear (rgba)
#define gdk_rgba_is_opaque(rgba) _gdk_rgba_is_opaque (rgba)
#define gdk_rgba_equal(p1, p2) _gdk_rgba_equal (p1, p2)
static inline gboolean
_gdk_rgba_is_clear (const GdkRGBA *rgba)
{
return rgba->alpha < ((float) 0x00ff / (float) 0xffff);
}
static inline gboolean
_gdk_rgba_is_opaque (const GdkRGBA *rgba)
{
return rgba->alpha > ((float)0xff00 / (float)0xffff);
}
static inline gboolean
_gdk_rgba_equal (gconstpointer p1,
gconstpointer p2)
{
const GdkRGBA *rgba1 = p1;
const GdkRGBA *rgba2 = p2;
return rgba1->red == rgba2->red &&
rgba1->green == rgba2->green &&
rgba1->blue == rgba2->blue &&
rgba1->alpha == rgba2->alpha;
}
G_END_DECLS

View File

@@ -29,11 +29,14 @@ gdk_subsurface_init (GdkSubsurface *self)
{
}
static void remove_subsurface (GdkSubsurface *subsurface);
static void
gdk_subsurface_finalize (GObject *object)
{
GdkSubsurface *subsurface = GDK_SUBSURFACE (object);
remove_subsurface (subsurface);
g_ptr_array_remove (subsurface->parent->subsurfaces, subsurface);
g_clear_object (&subsurface->parent);
@@ -48,14 +51,6 @@ gdk_subsurface_class_init (GdkSubsurfaceClass *class)
object_class->finalize = gdk_subsurface_finalize;
}
/*< private >
* gdk_subsurface_get_parent:
* @subsurface: a `GdkSubsurface`
*
* Returns the parent surface of @subsurface.
*
* Returns: the parent surface
*/
GdkSurface *
gdk_subsurface_get_parent (GdkSubsurface *subsurface)
{
@@ -116,41 +111,15 @@ insert_subsurface (GdkSubsurface *subsurface,
}
}
/*< private >
* gdk_subsurface_attach:
* @subsurface: the `GdkSubsurface`
* @texture: the texture to attach. This typically has to be a `GdkDmabufTexture`
* @source: the source rectangle (i.e. the subset of the texture) to display
* @dest: the dest rectangle, in application pixels, relative to the parent surface.
* It must be integral in application and device pixels, or attaching will fail
* @transform: the transform to apply to the texture contents before displaying
* @background: (nullable): the background rectangle, in application pixels relative
* to the parent surface. This tells GDK to put a black background of this
* size below the subsurface. It must be integral in application and device pixels,
* or attaching will fail
* @above: whether the subsurface should be above its sibling
* @sibling: (nullable): the sibling subsurface to stack relative to, or `NULL` to
* stack relative to the parent surface
*
* Attaches content to a subsurface.
*
* This function takes all the necessary arguments to determine the subsurface
* configuration, including its position, size, content, background and stacking.
*
* Returns: `TRUE` if the attaching succeeded
*/
gboolean
gdk_subsurface_attach (GdkSubsurface *subsurface,
GdkTexture *texture,
const graphene_rect_t *source,
const graphene_rect_t *dest,
GdkTextureTransform transform,
const graphene_rect_t *background,
gboolean above,
GdkSubsurface *sibling)
{
GdkSurface *parent = subsurface->parent;
gboolean result;
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
g_return_val_if_fail (GDK_IS_TEXTURE (texture), FALSE);
@@ -164,15 +133,6 @@ gdk_subsurface_attach (GdkSubsurface *subsurface,
g_return_val_if_fail (sibling == NULL || GDK_IS_SUBSURFACE (sibling), FALSE);
g_return_val_if_fail (sibling == NULL || sibling->parent == subsurface->parent, FALSE);
result = GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface,
texture,
source,
dest,
transform,
background,
above,
sibling);
remove_subsurface (subsurface);
if (sibling)
@@ -198,17 +158,9 @@ gdk_subsurface_attach (GdkSubsurface *subsurface,
}
}
return result;
return GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface, texture, source, dest, above, sibling);
}
/*< private >
* gdk_subsurface_detach:
* @subsurface: a `GdkSubsurface`
*
* Hides the subsurface.
*
* To show it again, you need to call gdk_subsurface_attach().
*/
void
gdk_subsurface_detach (GdkSubsurface *subsurface)
{
@@ -219,14 +171,6 @@ gdk_subsurface_detach (GdkSubsurface *subsurface)
GDK_SUBSURFACE_GET_CLASS (subsurface)->detach (subsurface);
}
/*< private >
* gdk_subsurface_get_texture:
* @subsurface: a `GdkSubsurface`
*
* Gets the texture that is currently displayed by the subsurface.
*
* Returns: (nullable): the texture that is displayed
*/
GdkTexture *
gdk_subsurface_get_texture (GdkSubsurface *subsurface)
{
@@ -235,138 +179,30 @@ gdk_subsurface_get_texture (GdkSubsurface *subsurface)
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_texture (subsurface);
}
/*< private >
* gdk_subsurface_get_source_rect:
* @subsurface: a `GdkSubsurface`
* @rect: (out caller-allocates): return location for the rectangle
*
* Returns the source rect that was specified in the most recent
* gdk_subsurface_attach() call for @subsurface.
*/
void
gdk_subsurface_get_source_rect (GdkSubsurface *subsurface,
graphene_rect_t *rect)
gdk_subsurface_get_source (GdkSubsurface *subsurface,
graphene_rect_t *source)
{
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
g_return_if_fail (rect != NULL);
g_return_if_fail (source != NULL);
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_source_rect (subsurface, rect);
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_source (subsurface, source);
}
/*< private >
* gdk_subsurface_get_texture_rect:
* @subsurface: a `GdkSubsurface`
* @rect: (out caller-allocates): return location for the rectangle
*
* Returns the texture rect that was specified in the most recent
* gdk_subsurface_attach() call for @subsurface.
*/
void
gdk_subsurface_get_texture_rect (GdkSubsurface *subsurface,
graphene_rect_t *rect)
gdk_subsurface_get_dest (GdkSubsurface *subsurface,
graphene_rect_t *dest)
{
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
g_return_if_fail (rect != NULL);
g_return_if_fail (dest != NULL);
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_texture_rect (subsurface, rect);
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_dest (subsurface, dest);
}
/*< private >
* gdk_subsurface_is_above_parent:
* @subsurface: a `GdkSubsurface`
*
* Returns whether the subsurface is above the parent surface
* or below. Note that a subsurface can be above its parent
* surface, and still be covered by sibling subsurfaces.
*
* Returns: `TRUE` if @subsurface is above its parent
*/
gboolean
gdk_subsurface_is_above_parent (GdkSubsurface *subsurface)
{
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), TRUE);
return subsurface->above_parent;
}
/*< private>
* gdk_subsurface_get_sibling:
* @subsurface: the `GdkSubsurface`
* @above: whether to get the subsurface above
*
* Returns the subsurface above (or below) @subsurface in
* the stacking order.
*
* Returns: the sibling, or `NULL` if there is none.
*/
GdkSubsurface *
gdk_subsurface_get_sibling (GdkSubsurface *subsurface,
gboolean above)
{
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), NULL);
if (above)
return subsurface->sibling_above;
else
return subsurface->sibling_below;
}
/*< private >
* gdk_subsurface_get_transform:
* @subsurface: a `GdkSubsurface`
*
* Returns the transform that was specified in the most recent call to
* gdk_subsurface_attach() call for @subsurface.
*
* Returns: the transform
*/
GdkTextureTransform
gdk_subsurface_get_transform (GdkSubsurface *subsurface)
{
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), GDK_TEXTURE_TRANSFORM_NORMAL);
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_transform (subsurface);
}
/*< private >
* gdk_subsurface_get_background_rect:
* @subsurface: a `GdkSubsurface`
* @rect: (out caller-allocates): return location for the rectangle
*
* Obtains the background rect that was specified in the most recent
* gdk_subsurface_attach() call for @subsurface.
*
* Returns: `TRUE` if @subsurface has a background
*/
gboolean
gdk_subsurface_get_background_rect (GdkSubsurface *subsurface,
graphene_rect_t *rect)
{
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
g_return_val_if_fail (rect != NULL, FALSE);
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_background_rect (subsurface, rect);
}
/*< private >
* gdk_subsurface_get_bounds:
* @subsurface: a `GdkSubsurface`
* @bounds: (out caller-allocates): return location for the bounds
*
* Returns the bounds of the subsurface.
*
* The bounds are the union of the texture and background rects.
*/
void
gdk_subsurface_get_bounds (GdkSubsurface *subsurface,
graphene_rect_t *bounds)
{
graphene_rect_t background;
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
g_return_if_fail (bounds != NULL);
gdk_subsurface_get_texture_rect (subsurface, bounds);
if (gdk_subsurface_get_background_rect (subsurface, &background))
graphene_rect_union (bounds, &background, bounds);
}

View File

@@ -47,68 +47,42 @@ struct _GdkSubsurface
GdkSubsurface *sibling_below;
};
typedef enum {
GDK_TEXTURE_TRANSFORM_NORMAL,
GDK_TEXTURE_TRANSFORM_90,
GDK_TEXTURE_TRANSFORM_180,
GDK_TEXTURE_TRANSFORM_270,
GDK_TEXTURE_TRANSFORM_FLIPPED,
GDK_TEXTURE_TRANSFORM_FLIPPED_90,
GDK_TEXTURE_TRANSFORM_FLIPPED_180,
GDK_TEXTURE_TRANSFORM_FLIPPED_270,
} GdkTextureTransform;
struct _GdkSubsurfaceClass
{
GObjectClass parent_class;
gboolean (* attach) (GdkSubsurface *subsurface,
GdkTexture *texture,
const graphene_rect_t *source,
const graphene_rect_t *dest,
GdkTextureTransform transform,
const graphene_rect_t *bg,
gboolean above,
GdkSubsurface *sibling);
void (* detach) (GdkSubsurface *subsurface);
GdkTexture * (* get_texture) (GdkSubsurface *subsurface);
void (* get_source_rect) (GdkSubsurface *subsurface,
graphene_rect_t *rect);
void (* get_texture_rect) (GdkSubsurface *subsurface,
graphene_rect_t *rect);
GdkTextureTransform
(* get_transform) (GdkSubsurface *subsurface);
gboolean (* get_background_rect) (GdkSubsurface *subsurface,
graphene_rect_t *rect);
gboolean (* attach) (GdkSubsurface *subsurface,
GdkTexture *texture,
const graphene_rect_t *source,
const graphene_rect_t *dest,
gboolean above,
GdkSubsurface *sibling);
void (* detach) (GdkSubsurface *subsurface);
GdkTexture * (* get_texture) (GdkSubsurface *subsurface);
void (* get_source) (GdkSubsurface *subsurface,
graphene_rect_t *source);
void (* get_dest) (GdkSubsurface *subsurface,
graphene_rect_t *dest);
};
GType gdk_subsurface_get_type (void) G_GNUC_CONST;
GType gdk_subsurface_get_type (void) G_GNUC_CONST;
GdkSurface * gdk_subsurface_get_parent (GdkSubsurface *subsurface);
GdkSurface * gdk_subsurface_get_parent (GdkSubsurface *subsurface);
gboolean gdk_subsurface_attach (GdkSubsurface *subsurface,
GdkTexture *texture,
const graphene_rect_t *source,
const graphene_rect_t *dest,
gboolean above,
GdkSubsurface *sibling);
void gdk_subsurface_detach (GdkSubsurface *subsurface);
GdkTexture * gdk_subsurface_get_texture (GdkSubsurface *subsurface);
void gdk_subsurface_get_source (GdkSubsurface *subsurface,
graphene_rect_t *source);
void gdk_subsurface_get_dest (GdkSubsurface *subsurface,
graphene_rect_t *dest);
gboolean gdk_subsurface_is_above_parent (GdkSubsurface *subsurface);
gboolean gdk_subsurface_attach (GdkSubsurface *subsurface,
GdkTexture *texture,
const graphene_rect_t *source,
const graphene_rect_t *dest,
GdkTextureTransform transform,
const graphene_rect_t *background,
gboolean above,
GdkSubsurface *sibling);
void gdk_subsurface_detach (GdkSubsurface *subsurface);
GdkTexture * gdk_subsurface_get_texture (GdkSubsurface *subsurface);
void gdk_subsurface_get_source_rect (GdkSubsurface *subsurface,
graphene_rect_t *rect);
void gdk_subsurface_get_texture_rect (GdkSubsurface *subsurface,
graphene_rect_t *rect);
gboolean gdk_subsurface_is_above_parent (GdkSubsurface *subsurface);
GdkSubsurface * gdk_subsurface_get_sibling (GdkSubsurface *subsurface,
gboolean above);
GdkTextureTransform
gdk_subsurface_get_transform (GdkSubsurface *subsurface);
gboolean gdk_subsurface_get_background_rect (GdkSubsurface *subsurface,
graphene_rect_t *rect);
void gdk_subsurface_get_bounds (GdkSubsurface *subsurface,
graphene_rect_t *bounds);
G_END_DECLS

View File

@@ -1123,8 +1123,10 @@ gdk_surface_set_egl_native_window (GdkSurface *self,
if (priv->egl_surface != NULL)
{
GdkDisplay *display = gdk_surface_get_display (self);
gdk_gl_context_clear_current_if_surface (self);
eglDestroySurface (gdk_surface_get_display (self), priv->egl_surface);
eglDestroySurface (gdk_display_get_egl_display (display), priv->egl_surface);
priv->egl_surface = NULL;
}

View File

@@ -29,7 +29,6 @@
#include "gdkdmabuffourccprivate.h"
#include "gdkdmabuftextureprivate.h"
#include "gdkdisplayprivate.h"
#include "gdkprofilerprivate.h"
#include <glib/gi18n-lib.h>
#include <math.h>
@@ -58,9 +57,6 @@ static const GdkDebugKey gsk_vulkan_feature_keys[] = {
*
* Support for `GdkVulkanContext` is platform-specific and context creation
* can fail, returning %NULL context.
*
* Deprecated: 4.14: GTK does not expose any Vulkan internals. This
* struct is a leftover that was accidentally exposed.
*/
typedef struct _GdkVulkanContextPrivate GdkVulkanContextPrivate;
@@ -607,7 +603,8 @@ physical_device_check_features (VkPhysicalDevice device)
features |= GDK_VULKAN_FEATURE_YCBCR;
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME) &&
physical_device_supports_extension (device, VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME))
physical_device_supports_extension (device, VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME) &&
physical_device_supports_extension (device, VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME))
features |= GDK_VULKAN_FEATURE_DMABUF;
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME))
@@ -1129,7 +1126,6 @@ gdk_display_load_pipeline_cache (GdkDisplay *display)
static gboolean
gdk_vulkan_save_pipeline_cache (GdkDisplay *display)
{
G_GNUC_UNUSED gint64 begin_time = GDK_PROFILER_CURRENT_TIME;
GError *error = NULL;
VkDevice device;
VkPipelineCache cache;
@@ -1144,13 +1140,14 @@ gdk_vulkan_save_pipeline_cache (GdkDisplay *display)
GDK_VK_CHECK (vkGetPipelineCacheData, device, cache, &size, NULL);
if (size == 0)
return TRUE;
if (size == display->vk_pipeline_cache_size)
{
GDK_DEBUG (VULKAN, "pipeline cache size (%zu bytes) unchanged, skipping save", size);
return TRUE;
}
data = g_malloc (size);
if (GDK_VK_CHECK (vkGetPipelineCacheData, device, cache, &size, data) != VK_SUCCESS)
{
@@ -1170,7 +1167,7 @@ gdk_vulkan_save_pipeline_cache (GdkDisplay *display)
file = gdk_vulkan_get_pipeline_cache_file (display);
GDK_DEBUG (VULKAN, "Saving pipeline cache of size %lu to %s", size, g_file_peek_path (file));
GDK_DEBUG (VULKAN, "Saving pipeline cache to %s", g_file_peek_path (file));
if (!g_file_replace_contents (file,
data,
@@ -1185,7 +1182,7 @@ gdk_vulkan_save_pipeline_cache (GdkDisplay *display)
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WRONG_ETAG))
{
VkPipelineCache new_cache;
GDK_DEBUG (VULKAN, "Pipeline cache file modified, merging into current");
new_cache = gdk_display_load_pipeline_cache (display);
if (new_cache)
@@ -1212,10 +1209,6 @@ gdk_vulkan_save_pipeline_cache (GdkDisplay *display)
return FALSE;
}
gdk_profiler_end_markf (begin_time,
"Save Vulkan pipeline cache", "%s size %lu",
g_file_peek_path (file), size);
g_object_unref (file);
g_free (data);
g_free (display->vk_pipeline_cache_etag);
@@ -1260,11 +1253,6 @@ gdk_display_create_pipeline_cache (GdkDisplay *display)
},
NULL,
&display->vk_pipeline_cache);
GDK_DEBUG (VULKAN, "Creating empty pipeline cache");
}
else
{
GDK_DEBUG (VULKAN, "Loading pipeline cache (%lu bytes)", display->vk_pipeline_cache_size);
}
}
@@ -1374,7 +1362,6 @@ static gboolean
gdk_display_create_vulkan_device (GdkDisplay *display,
GError **error)
{
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
uint32_t i, j, k;
const char *override;
gboolean list_devices;
@@ -1517,6 +1504,7 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME);
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME);
g_ptr_array_add (device_extensions, (gpointer) VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME);
g_ptr_array_add (device_extensions, (gpointer) VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME);
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME);
@@ -1583,8 +1571,6 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
"Hum, what? This should not happen.")));
}
gdk_profiler_end_mark (start_time, "Create Vulkan device", NULL);
return TRUE;
}
}
@@ -1623,7 +1609,6 @@ static gboolean
gdk_display_create_vulkan_instance (GdkDisplay *display,
GError **error)
{
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
uint32_t i;
GPtrArray *used_extensions;
GPtrArray *used_layers;
@@ -1785,8 +1770,6 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
display->vk_shader_modules = g_hash_table_new (g_str_hash, g_str_equal);
gdk_profiler_end_mark (start_time, "Create Vulkan instance", NULL);
return TRUE;
}
@@ -1857,8 +1840,9 @@ gdk_display_unref_vulkan (GdkDisplay *display)
{
g_free (key);
vkDestroyShaderModule (display->vk_device,
value,
*((VkShaderModule *)value),
NULL);
g_free (value);
}
g_hash_table_unref (display->vk_shader_modules);
@@ -1986,13 +1970,13 @@ VkShaderModule
gdk_display_get_vk_shader_module (GdkDisplay *self,
const char *resource_name)
{
VkShaderModule shader;
VkShaderModule *shader;
GError *error = NULL;
GBytes *bytes;
shader = g_hash_table_lookup (self->vk_shader_modules, resource_name);
if (shader)
return shader;
return *shader;
bytes = g_resources_lookup_data (resource_name, 0, &error);
if (bytes == NULL)
@@ -2002,6 +1986,7 @@ gdk_display_get_vk_shader_module (GdkDisplay *self,
return VK_NULL_HANDLE;
}
shader = g_new0 (VkShaderModule, 1);
if (GDK_VK_CHECK (vkCreateShaderModule, self->vk_device,
&(VkShaderModuleCreateInfo) {
.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
@@ -2009,18 +1994,20 @@ gdk_display_get_vk_shader_module (GdkDisplay *self,
.pCode = (uint32_t *) g_bytes_get_data (bytes, NULL),
},
NULL,
&shader) == VK_SUCCESS)
shader) == VK_SUCCESS)
{
g_hash_table_insert (self->vk_shader_modules, g_strdup (resource_name), shader);
}
else
{
shader = VK_NULL_HANDLE;
g_free (shader);
return VK_NULL_HANDLE;
}
g_bytes_unref (bytes);
return shader;
return *shader;
}
#else /* GDK_RENDERING_VULKAN */

View File

@@ -785,20 +785,13 @@ typedef NSString *CALayerContentsGravity;
if (decorated)
{
style_mask &= ~NSWindowStyleMaskFullSizeContentView;
[self setTitleVisibility:NSWindowTitleVisible];
style_mask |= NSWindowStyleMaskTitled;
}
else
{
style_mask |= NSWindowStyleMaskFullSizeContentView;
[self setTitleVisibility:NSWindowTitleHidden];
style_mask &= ~NSWindowStyleMaskTitled;
}
[self setTitlebarAppearsTransparent:!decorated];
[[self standardWindowButton:NSWindowCloseButton] setHidden:!decorated];
[[self standardWindowButton:NSWindowMiniaturizeButton] setHidden:!decorated];
[[self standardWindowButton:NSWindowZoomButton] setHidden:!decorated];
[self setStyleMask:style_mask];
}

View File

@@ -22,7 +22,6 @@
#include <string.h>
#include "gdkmacoscursor-private.h"
#include "gdkcursorprivate.h"
@interface NSCursor()
-(long long)_coreCursorType;
@@ -218,25 +217,9 @@ _gdk_macos_cursor_get_ns_cursor (GdkCursor *cursor)
if (name == NULL)
{
GdkTexture *texture;
int hotspot_x, hotspot_y;
texture = gdk_cursor_get_texture (cursor);
hotspot_x = gdk_cursor_get_hotspot_x (cursor);
hotspot_y = gdk_cursor_get_hotspot_y (cursor);
if (texture == NULL)
{
int size = 32; // FIXME
int width, height;
texture = gdk_cursor_get_texture_for_size (cursor, size, 1,
&width, &height,
&hotspot_x, &hotspot_y);
}
nscursor = create_cursor_from_texture (texture, hotspot_x, hotspot_y);
nscursor = create_cursor_from_texture (gdk_cursor_get_texture (cursor),
gdk_cursor_get_hotspot_x (cursor),
gdk_cursor_get_hotspot_y (cursor));
return nscursor;
}
}

View File

@@ -176,6 +176,7 @@ void _gdk_macos_display_set_drop (GdkMacosDisp
GdkDrop *drop);
void _gdk_macos_display_position_surface (GdkMacosDisplay *self,
GdkMacosSurface *surface,
GdkMonitor *monitor,
int *x,
int *y);

View File

@@ -82,6 +82,7 @@ has_surface_at_origin (const GList *surfaces,
static void
_gdk_macos_display_position_toplevel (GdkMacosDisplay *self,
GdkMacosSurface *surface,
GdkMonitor *selected_monitor,
int *x,
int *y)
{
@@ -95,7 +96,11 @@ _gdk_macos_display_position_toplevel (GdkMacosDisplay *self,
g_assert (GDK_IS_MACOS_TOPLEVEL_SURFACE (surface));
mouse = [NSEvent mouseLocation];
monitor = _gdk_macos_display_get_monitor_at_display_coords (self, mouse.x, mouse.y);
if (!selected_monitor)
monitor = _gdk_macos_display_get_monitor_at_display_coords (self, mouse.x, mouse.y);
else
monitor = selected_monitor;
gdk_macos_monitor_get_workarea (monitor, &workarea);
/* First place at top-left of current monitor */
@@ -104,7 +109,7 @@ _gdk_macos_display_position_toplevel (GdkMacosDisplay *self,
surface_rect.x = workarea.x + ((workarea.width - surface_rect.width) / 2);
surface_rect.y = workarea.y + ((workarea.height - surface_rect.height) / 2);
_gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (surface->best_monitor), &surface_rect);
_gdk_macos_monitor_clamp (GDK_MACOS_MONITOR (selected_monitor ? selected_monitor : surface->best_monitor), &surface_rect);
*x = surface_rect.x;
*y = surface_rect.y;
@@ -138,6 +143,7 @@ _gdk_macos_display_position_toplevel (GdkMacosDisplay *self,
void
_gdk_macos_display_position_surface (GdkMacosDisplay *self,
GdkMacosSurface *surface,
GdkMonitor *monitor,
int *x,
int *y)
{
@@ -151,5 +157,5 @@ _gdk_macos_display_position_surface (GdkMacosDisplay *self,
if (transient_for != NULL)
_gdk_macos_display_position_toplevel_with_parent (self, surface, GDK_MACOS_SURFACE (transient_for), x, y);
else
_gdk_macos_display_position_toplevel (self, surface, x, y);
_gdk_macos_display_position_toplevel (self, surface, monitor, x, y);
}

View File

@@ -96,12 +96,12 @@ _gdk_macos_drag_surface_constructed (GObject *object)
defer:NO
screen:screen];
_gdk_macos_surface_set_native (self, window);
[window setOpaque:NO];
[window setBackgroundColor:[NSColor clearColor]];
[window setDecorated:NO];
_gdk_macos_surface_set_native (self, window);
frame_clock = _gdk_frame_clock_idle_new ();
gdk_surface_set_frame_clock (surface, frame_clock);
g_object_unref (frame_clock);

View File

@@ -52,6 +52,7 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
GdkRectangle bounds;
GdkRectangle final_rect;
int x, y;
int shadow_left, shadow_right, shadow_top, shadow_bottom;
g_assert (GDK_IS_MACOS_POPUP_SURFACE (self));
g_assert (layout != NULL);
@@ -68,10 +69,19 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
monitor = _gdk_macos_surface_get_best_monitor (GDK_MACOS_SURFACE (self));
gdk_macos_monitor_get_workarea (monitor, &bounds);
gdk_popup_layout_get_shadow_width (layout,
&shadow_left,
&shadow_right,
&shadow_top,
&shadow_bottom);
gdk_surface_layout_popup_helper (GDK_SURFACE (self),
width,
height,
0, 0, 0, 0, /* shadow-left/right/top/bottom */
shadow_left,
shadow_right,
shadow_top,
shadow_bottom,
monitor,
&bounds,
self->layout,
@@ -306,14 +316,14 @@ _gdk_macos_popup_surface_constructed (GObject *object)
defer:NO
screen:screen];
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
[window setOpaque:NO];
[window setBackgroundColor:[NSColor clearColor]];
[window setDecorated:NO];
[window setExcludedFromWindowsMenu:YES];
[window setLevel:NSPopUpMenuWindowLevel];
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
gdk_surface_set_frame_clock (surface, gdk_surface_get_frame_clock (surface->parent));
GDK_END_MACOS_ALLOC_POOL;

View File

@@ -261,7 +261,30 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
if (gdk_toplevel_layout_get_fullscreen (layout, &fullscreen))
{
if (fullscreen)
_gdk_macos_toplevel_surface_fullscreen (self);
{
GdkMonitor *fullscreen_monitor =
gdk_toplevel_layout_get_fullscreen_monitor (layout);
if (fullscreen_monitor)
{
int x = 0, y = 0;
_gdk_macos_display_position_surface (GDK_MACOS_DISPLAY (display),
GDK_MACOS_SURFACE (self),
fullscreen_monitor,
&x, &y);
GDK_DEBUG (MISC, "Moving toplevel \"%s\" to %d,%d",
GDK_MACOS_SURFACE (self)->title ?
GDK_MACOS_SURFACE (self)->title :
"untitled",
x, y);
_gdk_macos_surface_move (GDK_MACOS_SURFACE (self), x, y);
}
_gdk_macos_toplevel_surface_fullscreen (self);
}
else
_gdk_macos_toplevel_surface_unfullscreen (self);
}
@@ -274,6 +297,7 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
_gdk_macos_display_position_surface (GDK_MACOS_DISPLAY (display),
GDK_MACOS_SURFACE (self),
gdk_toplevel_layout_get_fullscreen_monitor (layout),
&x, &y);
GDK_DEBUG (MISC, "Placing new toplevel \"%s\" at %d,%d",
@@ -591,11 +615,11 @@ _gdk_macos_toplevel_surface_constructed (GObject *object)
defer:NO
screen:screen];
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
/* Allow NSWindow to go fullscreen */
[window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
frame_clock = _gdk_frame_clock_idle_new ();
gdk_surface_set_frame_clock (surface, frame_clock);
g_object_unref (frame_clock);
@@ -657,6 +681,7 @@ _gdk_macos_toplevel_surface_attach_to_parent (GdkMacosToplevelSurface *self)
_gdk_macos_display_clear_sorting (GDK_MACOS_DISPLAY (surface->display));
_gdk_macos_display_position_surface (GDK_MACOS_DISPLAY (surface->display),
GDK_MACOS_SURFACE (surface),
NULL,
&x, &y);
_gdk_macos_surface_move (GDK_MACOS_SURFACE (surface), x, y);
}

View File

@@ -198,8 +198,17 @@ static void
gdk_wayland_cairo_context_empty_frame (GdkDrawContext *draw_context)
{
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
gdk_wayland_surface_handle_empty_frame (surface);
if (!impl->has_pending_subsurface_commits)
return;
gdk_wayland_surface_sync (surface);
gdk_wayland_surface_request_frame (surface);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
gdk_wayland_surface_commit (surface);
gdk_wayland_surface_notify_committed (surface);
}
static void

View File

@@ -236,6 +236,7 @@ gdk_wayland_clipboard_read_async (GdkClipboard *clipboard,
{
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("No compatible transfer format found"));
g_object_unref (task);
return;
}
/* offer formats should be empty if we have no offer */
@@ -246,6 +247,7 @@ gdk_wayland_clipboard_read_async (GdkClipboard *clipboard,
if (!g_unix_open_pipe (pipe_fd, O_CLOEXEC, &error))
{
g_task_return_error (task, error);
g_object_unref (task);
return;
}
@@ -253,6 +255,7 @@ gdk_wayland_clipboard_read_async (GdkClipboard *clipboard,
stream = g_unix_input_stream_new (pipe_fd[0], TRUE);
close (pipe_fd[1]);
g_task_return_pointer (task, stream, g_object_unref);
g_object_unref (task);
}
static GInputStream *

View File

@@ -155,19 +155,15 @@ static const struct wl_buffer_listener buffer_listener = {
struct wl_buffer *
_gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
GdkCursor *cursor,
double desired_scale,
gboolean use_viewporter,
guint desired_scale,
guint image_index,
int *hotspot_x,
int *hotspot_y,
int *width,
int *height,
double *scale)
int *scale)
{
GdkTexture *texture;
int desired_scale_factor;
desired_scale_factor = (int) ceil (desired_scale);
if (gdk_cursor_get_name (cursor))
{
@@ -178,7 +174,7 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
c = gdk_wayland_cursor_load_for_name (display,
_gdk_wayland_display_get_cursor_theme (display),
desired_scale_factor,
desired_scale,
gdk_cursor_get_name (cursor));
if (c && c->image_count > 0)
{
@@ -195,7 +191,7 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
image = c->images[image_index];
cursor_scale = desired_scale_factor;
cursor_scale = desired_scale;
if ((image->width % cursor_scale != 0) ||
(image->height % cursor_scale != 0))
{
@@ -215,7 +211,7 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
return wl_cursor_image_get_buffer (image);
}
}
else if (gdk_cursor_get_texture (cursor))
else
{
cairo_surface_t *surface;
struct wl_buffer *buffer;
@@ -230,7 +226,7 @@ from_texture:
gdk_texture_get_width (texture),
gdk_texture_get_height (texture),
&GDK_FRACTIONAL_SCALE_INIT_INT (1));
gdk_texture_download (texture,
cairo_image_surface_get_data (surface),
cairo_image_surface_get_stride (surface));
@@ -254,50 +250,11 @@ from_texture:
return buffer;
}
else
{
if (!use_viewporter)
*scale = desired_scale_factor;
else
*scale = desired_scale;
texture = gdk_cursor_get_texture_for_size (cursor,
display->cursor_theme_size,
*scale,
width,
height,
hotspot_x,
hotspot_y);
if (texture)
{
cairo_surface_t *surface;
struct wl_buffer *buffer;
surface = gdk_wayland_display_create_shm_surface (display,
gdk_texture_get_width (texture),
gdk_texture_get_height (texture),
&GDK_FRACTIONAL_SCALE_INIT_INT (1));
gdk_texture_download (texture,
cairo_image_surface_get_data (surface),
cairo_image_surface_get_stride (surface));
cairo_surface_mark_dirty (surface);
buffer = _gdk_wayland_shm_surface_get_wl_buffer (surface);
wl_buffer_add_listener (buffer, &buffer_listener, surface);
g_object_unref (texture);
return buffer;
}
}
if (gdk_cursor_get_fallback (cursor))
return _gdk_wayland_cursor_get_buffer (display,
gdk_cursor_get_fallback (cursor),
gdk_cursor_get_fallback (cursor),
desired_scale,
use_viewporter,
image_index,
hotspot_x, hotspot_y,
width, height,

View File

@@ -62,7 +62,6 @@ struct _GdkWaylandPointerData {
uint32_t grab_time;
struct wl_surface *pointer_surface;
struct wp_viewport *pointer_surface_viewport;
guint cursor_is_default: 1;
GdkCursor *cursor;
guint cursor_timeout_id;
@@ -70,7 +69,7 @@ struct _GdkWaylandPointerData {
guint cursor_image_delay;
guint touchpad_event_sequence;
double current_output_scale;
guint current_output_scale;
GSList *pointer_surface_outputs;
/* Accumulated event data for a pointer frame */

View File

@@ -260,25 +260,18 @@ gdk_wayland_device_update_surface_cursor (GdkDevice *device)
GdkWaylandPointerData *pointer =
gdk_wayland_device_get_pointer (wayland_device);
struct wl_buffer *buffer;
int x, y, w, h;
double scale;
int x, y, w, h, scale;
guint next_image_index, next_image_delay;
gboolean retval = G_SOURCE_REMOVE;
GdkWaylandTabletData *tablet;
gboolean use_viewport;
tablet = gdk_wayland_seat_find_tablet (seat, device);
use_viewport = pointer->pointer_surface_viewport != NULL;
if (g_getenv ("NO_POINTER_VIEWPORT"))
use_viewport = FALSE;
if (pointer->cursor)
{
buffer = _gdk_wayland_cursor_get_buffer (GDK_WAYLAND_DISPLAY (seat->display),
pointer->cursor,
pointer->current_output_scale,
use_viewport,
pointer->cursor_image_index,
&x, &y, &w, &h, &scale);
}
@@ -317,16 +310,7 @@ gdk_wayland_device_update_surface_cursor (GdkDevice *device)
if (buffer)
{
wl_surface_attach (pointer->pointer_surface, buffer, 0, 0);
if (use_viewport)
{
wp_viewport_set_source (pointer->pointer_surface_viewport,
wl_fixed_from_int (0),
wl_fixed_from_int (0),
wl_fixed_from_double (w * scale),
wl_fixed_from_double (h * scale));
wp_viewport_set_destination (pointer->pointer_surface_viewport, w, h);
}
else if (wl_surface_get_version (pointer->pointer_surface) >= WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION)
if (wl_surface_get_version (pointer->pointer_surface) >= WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION)
wl_surface_set_buffer_scale (pointer->pointer_surface, scale);
wl_surface_damage (pointer->pointer_surface, 0, 0, w, h);
wl_surface_commit (pointer->pointer_surface);

View File

@@ -97,6 +97,7 @@
#define OUTPUT_VERSION_WITH_DONE 2
#define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3
#define OUTPUT_VERSION 3
#define XDG_WM_DIALOG_VERSION 1
#ifdef HAVE_TOPLEVEL_STATE_SUSPENDED
#define XDG_WM_BASE_VERSION 6
@@ -105,9 +106,6 @@
#endif
static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland);
static void _gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
const char *name,
int size);
G_DEFINE_TYPE (GdkWaylandDisplay, gdk_wayland_display, GDK_TYPE_DISPLAY)
@@ -287,6 +285,97 @@ static const struct wl_shm_listener wl_shm_listener = {
wl_shm_format
};
static void
linux_dmabuf_done (void *data,
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1)
{
GDK_DEBUG (MISC, "dmabuf feedback done");
}
static void
linux_dmabuf_format_table (void *data,
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
int32_t fd,
uint32_t size)
{
GdkWaylandDisplay *display_wayland = data;
display_wayland->linux_dmabuf_n_formats = size / 16;
display_wayland->linux_dmabuf_formats = mmap (NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
GDK_DEBUG (MISC, "got dmabuf format table (%lu entries)", display_wayland->linux_dmabuf_n_formats);
}
static void
linux_dmabuf_main_device (void *data,
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
struct wl_array *device)
{
dev_t dev G_GNUC_UNUSED;
memcpy (&dev, device->data, sizeof (dev_t));
GDK_DEBUG (MISC, "got dmabuf main device: %u %u", major (dev), minor (dev));
}
static void
linux_dmabuf_tranche_done (void *data,
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1)
{
GDK_DEBUG (MISC, "dmabuf feedback tranche done");
}
static void
linux_dmabuf_tranche_target_device (void *data,
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
struct wl_array *device)
{
dev_t dev G_GNUC_UNUSED;
memcpy (&dev, device->data, sizeof (dev_t));
GDK_DEBUG (MISC, "got dmabuf tranche target device: %u %u", major (dev), minor (dev));
}
static void
linux_dmabuf_tranche_formats (void *data,
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
struct wl_array *indices)
{
GdkWaylandDisplay *display_wayland = data;
GDK_DEBUG (MISC, "got dmabuf tranche formats (%lu entries):", indices->size / sizeof (guint16));
guint16 *pos;
wl_array_for_each (pos, indices)
{
LinuxDmabufFormat *fmt G_GNUC_UNUSED = &display_wayland->linux_dmabuf_formats[*pos];
uint32_t f G_GNUC_UNUSED = fmt->fourcc;
uint64_t m G_GNUC_UNUSED = fmt->modifier;
GDK_DEBUG (MISC, " %.4s:%#" G_GINT64_MODIFIER "x", (char *) &f, m);
}
}
static void
linux_dmabuf_tranche_flags (void *data,
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
uint32_t flags)
{
GDK_DEBUG (MISC,
"got dmabuf tranche flags: %s",
flags & ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT ? "scanout" : "");
}
static const struct zwp_linux_dmabuf_feedback_v1_listener linux_dmabuf_feedback_listener = {
linux_dmabuf_done,
linux_dmabuf_format_table,
linux_dmabuf_main_device,
linux_dmabuf_tranche_done,
linux_dmabuf_tranche_target_device,
linux_dmabuf_tranche_formats,
linux_dmabuf_tranche_flags,
};
static void
server_decoration_manager_default_mode (void *data,
struct org_kde_kwin_server_decoration_manager *manager,
@@ -353,7 +442,7 @@ gdk_registry_handle_global (void *data,
{
display_wayland->compositor =
wl_registry_bind (display_wayland->wl_registry, id,
&wl_compositor_interface, MIN (version, 6));
&wl_compositor_interface, MIN (version, 5));
}
else if (strcmp (interface, "wl_shm") == 0)
{
@@ -363,14 +452,12 @@ gdk_registry_handle_global (void *data,
}
else if (strcmp (interface, "zwp_linux_dmabuf_v1") == 0 && version >= 4)
{
struct zwp_linux_dmabuf_feedback_v1 *feedback;
display_wayland->linux_dmabuf =
wl_registry_bind (display_wayland->wl_registry, id, &zwp_linux_dmabuf_v1_interface, version);
feedback = zwp_linux_dmabuf_v1_get_default_feedback (display_wayland->linux_dmabuf);
display_wayland->dmabuf_formats_info = dmabuf_formats_info_new (GDK_DISPLAY (display_wayland),
"default",
feedback);
display_wayland->linux_dmabuf_feedback =
zwp_linux_dmabuf_v1_get_default_feedback (display_wayland->linux_dmabuf);
zwp_linux_dmabuf_feedback_v1_add_listener (display_wayland->linux_dmabuf_feedback,
&linux_dmabuf_feedback_listener, display_wayland);
_gdk_wayland_display_async_roundtrip (display_wayland);
}
else if (strcmp (interface, "xdg_wm_base") == 0)
@@ -382,6 +469,13 @@ gdk_registry_handle_global (void *data,
{
display_wayland->zxdg_shell_v6_id = id;
}
else if (strcmp (interface, "xdg_wm_dialog_v1") == 0)
{
display_wayland->xdg_wm_dialog =
wl_registry_bind (display_wayland->wl_registry, id,
&xdg_wm_dialog_v1_interface,
MIN (version, XDG_WM_DIALOG_VERSION));
}
else if (strcmp (interface, "gtk_shell1") == 0)
{
display_wayland->gtk_shell =
@@ -524,13 +618,7 @@ gdk_registry_handle_global (void *data,
&wp_presentation_interface,
MIN (version, 1));
}
else if (strcmp (interface, wp_single_pixel_buffer_manager_v1_interface.name) == 0)
{
display_wayland->single_pixel_buffer =
wl_registry_bind (display_wayland->wl_registry, id,
&wp_single_pixel_buffer_manager_v1_interface,
MIN (version, 1));
}
g_hash_table_insert (display_wayland->known_globals,
GUINT_TO_POINTER (id), g_strdup (interface));
@@ -741,9 +829,10 @@ gdk_wayland_display_dispose (GObject *object)
g_clear_pointer (&display_wayland->fractional_scale, wp_fractional_scale_manager_v1_destroy);
g_clear_pointer (&display_wayland->viewporter, wp_viewporter_destroy);
g_clear_pointer (&display_wayland->presentation, wp_presentation_destroy);
g_clear_pointer (&display_wayland->single_pixel_buffer, wp_single_pixel_buffer_manager_v1_destroy);
g_clear_pointer (&display_wayland->linux_dmabuf, zwp_linux_dmabuf_v1_destroy);
g_clear_pointer (&display_wayland->dmabuf_formats_info, dmabuf_formats_info_free);
g_clear_pointer (&display_wayland->linux_dmabuf_feedback, zwp_linux_dmabuf_feedback_v1_destroy);
if (display_wayland->linux_dmabuf_formats)
munmap (display_wayland->linux_dmabuf_formats, display_wayland->linux_dmabuf_n_formats * 16);
g_clear_pointer (&display_wayland->shm, wl_shm_destroy);
g_clear_pointer (&display_wayland->wl_registry, wl_registry_destroy);
@@ -1045,7 +1134,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
display_class->get_monitors = gdk_wayland_display_get_monitors;
display_class->get_monitor_at_surface = gdk_wayland_display_get_monitor_at_surface;
display_class->get_setting = gdk_wayland_display_get_setting;
display_class->set_cursor_theme = _gdk_wayland_display_set_cursor_theme;
display_class->set_cursor_theme = gdk_wayland_display_set_cursor_theme;
}
static void
@@ -1118,22 +1207,11 @@ get_cursor_theme (GdkWaylandDisplay *display_wayland,
* @size: the size to use for cursors
*
* Sets the cursor theme for the given @display.
*
* Deprecated: 4.16: Use the cursor-related properties of
* [GtkSettings](../gtk4/class.Settings.html) to set the cursor theme
*/
void
gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
const char *name,
int size)
{
_gdk_wayland_display_set_cursor_theme (display, name, size);
}
static void
_gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
const char *name,
int size)
{
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY(display);
struct wl_cursor_theme *theme;
@@ -1202,7 +1280,7 @@ _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland)
else
name = "default";
_gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (display_wayland), name, size);
gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (display_wayland), name, size);
g_value_unset (&v);
gdk_profiler_end_mark (before, "Wayland cursor theme load", NULL);
@@ -1738,7 +1816,6 @@ static TranslationEntry translations[] = {
{ FALSE, "org.gnome.desktop.interface", "font-hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 1 } },
{ FALSE, "org.gnome.desktop.interface", "font-hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 1 } },
{ FALSE, "org.gnome.desktop.interface", "font-rgba-order", "gtk-xft-rgba", G_TYPE_NONE, { .i = 0 } },
{ FALSE, "org.gnome.desktop.interface", "font-rendering", "gtk-font-rendering", G_TYPE_ENUM, { .i = 0 } },
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "antialiasing", "gtk-xft-antialias", G_TYPE_NONE, { .i = 1 } },
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 1 } },
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 1 } },
@@ -1830,7 +1907,6 @@ apply_portal_setting (TranslationEntry *entry,
entry->fallback.s = g_intern_string (g_variant_get_string (value, NULL));
break;
case G_TYPE_INT:
case G_TYPE_ENUM:
entry->fallback.i = g_variant_get_int32 (value);
break;
case G_TYPE_BOOLEAN:
@@ -2080,9 +2156,6 @@ set_value_from_entry (GdkDisplay *display,
case G_TYPE_BOOLEAN:
g_value_set_boolean (value, entry->fallback.b);
break;
case G_TYPE_ENUM:
g_value_set_enum (value, entry->fallback.i);
break;
case G_TYPE_NONE:
if (g_str_equal (entry->setting, "gtk-fontconfig-timestamp"))
g_value_set_uint (value, (guint)entry->fallback.i);
@@ -2133,11 +2206,6 @@ set_value_from_entry (GdkDisplay *display,
? g_settings_get_boolean (settings, entry->key)
: entry->fallback.b);
break;
case G_TYPE_ENUM:
g_value_set_enum (value, settings && entry->valid
? g_settings_get_enum (settings, entry->key)
: entry->fallback.i);
break;
case G_TYPE_NONE:
if (g_str_equal (entry->setting, "gtk-fontconfig-timestamp"))
g_value_set_uint (value, (guint)entry->fallback.i);

View File

@@ -40,7 +40,7 @@
#include <gdk/wayland/fractional-scale-v1-client-protocol.h>
#include <gdk/wayland/viewporter-client-protocol.h>
#include <gdk/wayland/presentation-time-client-protocol.h>
#include <gdk/wayland/single-pixel-buffer-v1-client-protocol.h>
#include <gdk/wayland/xdg-dialog-v1-client-protocol.h>
#include <glib.h>
#include <gdk/gdkkeys.h>
@@ -49,7 +49,6 @@
#include "gdkdisplayprivate.h"
#include "gdkwaylanddevice.h"
#include "gdkdmabuf-wayland-private.h"
#include "cursor/wayland-cursor.h"
#include <epoxy/egl.h>
@@ -74,6 +73,13 @@ typedef enum _GdkWaylandShellVariant
GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6
} GdkWaylandShellVariant;
typedef struct
{
uint32_t fourcc;
uint32_t padding;
uint64_t modifier;
} LinuxDmabufFormat;
struct _GdkWaylandDisplay
{
GdkDisplay parent_instance;
@@ -99,9 +105,12 @@ struct _GdkWaylandDisplay
struct wl_compositor *compositor;
struct wl_shm *shm;
struct zwp_linux_dmabuf_v1 *linux_dmabuf;
DmabufFormatsInfo *dmabuf_formats_info;
struct zwp_linux_dmabuf_feedback_v1 *linux_dmabuf_feedback;
gsize linux_dmabuf_n_formats;
LinuxDmabufFormat *linux_dmabuf_formats;
struct xdg_wm_base *xdg_wm_base;
struct zxdg_shell_v6 *zxdg_shell_v6;
struct xdg_wm_dialog_v1 *xdg_wm_dialog;
struct gtk_shell1 *gtk_shell;
struct wl_data_device_manager *data_device_manager;
struct wl_subcompositor *subcompositor;
@@ -120,7 +129,6 @@ struct _GdkWaylandDisplay
struct wp_fractional_scale_manager_v1 *fractional_scale;
struct wp_viewporter *viewporter;
struct wp_presentation *presentation;
struct wp_single_pixel_buffer_manager_v1 *single_pixel_buffer;
GList *async_roundtrips;

View File

@@ -1,77 +0,0 @@
/*
* gdkdmabuf-wayland.h
*
* Copyright 2023 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "config.h"
#include <stdint.h>
#include <wayland-client.h>
#include <wayland-egl.h>
#include <glib.h>
#include <gdk/gdkkeys.h>
#include <gdk/gdksurface.h>
G_BEGIN_DECLS
typedef struct
{
uint32_t fourcc;
uint32_t padding;
uint64_t modifier;
} DmabufFormat;
typedef struct
{
dev_t target_device;
guint32 flags;
gsize n_formats;
DmabufFormat *formats;
} DmabufTranche;
typedef struct
{
dev_t main_device;
GPtrArray *tranches;
} DmabufFormats;
typedef struct DmabufFormatsInfo DmabufFormatsInfo;
struct DmabufFormatsInfo
{
GdkDisplay *display;
char *name;
struct zwp_linux_dmabuf_feedback_v1 *feedback;
gsize n_dmabuf_formats;
DmabufFormat *dmabuf_format_table;
DmabufFormats *dmabuf_formats;
DmabufFormats *pending_dmabuf_formats;
DmabufTranche *pending_tranche;
};
DmabufFormatsInfo * dmabuf_formats_info_new (GdkDisplay *display,
const char *name,
struct zwp_linux_dmabuf_feedback_v1 *feedback);
void dmabuf_formats_info_free (DmabufFormatsInfo *info);
G_END_DECLS

View File

@@ -1,241 +0,0 @@
#include "config.h"
#include "gdkdmabuf-wayland-private.h"
#include "gdkdebugprivate.h"
#include "gdkdmabufformatsprivate.h"
#include "gdkdmabufformatsbuilderprivate.h"
#include "gdkdmabufformatsprivate.h"
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/sysmacros.h>
#include "linux-dmabuf-unstable-v1-client-protocol.h"
static DmabufTranche *
dmabuf_tranche_new (void)
{
return g_new0 (DmabufTranche, 1);
}
static void
dmabuf_tranche_free (DmabufTranche *tranche)
{
g_free (tranche->formats);
g_free (tranche);
}
static DmabufFormats *
dmabuf_formats_new (void)
{
DmabufFormats *formats;
formats = g_new0 (DmabufFormats, 1);
formats->tranches = g_ptr_array_new_with_free_func ((GDestroyNotify) dmabuf_tranche_free);
return formats;
}
static void
dmabuf_formats_free (DmabufFormats *formats)
{
g_ptr_array_unref (formats->tranches);
g_free (formats);
}
static void
update_dmabuf_formats (DmabufFormatsInfo *info)
{
DmabufFormats *formats = info->dmabuf_formats;
GDK_DISPLAY_DEBUG (info->display, MISC,
"dmabuf format table (%lu entries)", info->n_dmabuf_formats);
GDK_DISPLAY_DEBUG (info->display, MISC,
"dmabuf main device: %u %u",
major (formats->main_device),
minor (formats->main_device));
for (gsize i = 0; i < formats->tranches->len; i++)
{
DmabufTranche *tranche = g_ptr_array_index (formats->tranches, i);
GDK_DISPLAY_DEBUG (info->display, MISC,
"dmabuf tranche target device: %u %u",
major (tranche->target_device),
minor (tranche->target_device));
GDK_DISPLAY_DEBUG (info->display, MISC,
"dmabuf%s tranche (%lu entries):",
tranche->flags & ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT ? " scanout" : "",
tranche->n_formats);
for (gsize j = 0; j < tranche->n_formats; j++)
{
GDK_DISPLAY_DEBUG (info->display, MISC,
" %.4s:%#" G_GINT64_MODIFIER "x",
(char *) &(tranche->formats[j].fourcc),
tranche->formats[j].modifier);
}
}
}
static void
linux_dmabuf_done (void *data,
struct zwp_linux_dmabuf_feedback_v1 *feedback)
{
DmabufFormatsInfo *info = data;
g_clear_pointer (&info->dmabuf_formats, dmabuf_formats_free);
info->dmabuf_formats = info->pending_dmabuf_formats;
info->pending_dmabuf_formats = NULL;
update_dmabuf_formats (info);
}
static void
linux_dmabuf_format_table (void *data,
struct zwp_linux_dmabuf_feedback_v1 *feedback,
int32_t fd,
uint32_t size)
{
DmabufFormatsInfo *info = data;
if (info->dmabuf_formats)
munmap (info->dmabuf_formats, sizeof (DmabufFormat) * info->n_dmabuf_formats);
info->n_dmabuf_formats = size / 16;
info->dmabuf_format_table = mmap (NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
}
static void
linux_dmabuf_main_device (void *data,
struct zwp_linux_dmabuf_feedback_v1 *feedback,
struct wl_array *device)
{
DmabufFormatsInfo *info = data;
dev_t dev;
memcpy (&dev, device->data, sizeof (dev_t));
g_assert (info->pending_dmabuf_formats == NULL);
info->pending_dmabuf_formats = dmabuf_formats_new ();
info->pending_dmabuf_formats->main_device = dev;
}
static void
linux_dmabuf_tranche_done (void *data,
struct zwp_linux_dmabuf_feedback_v1 *feedback)
{
DmabufFormatsInfo *info = data;
g_ptr_array_add (info->pending_dmabuf_formats->tranches,
info->pending_tranche);
info->pending_tranche = NULL;
}
static void
linux_dmabuf_tranche_target_device (void *data,
struct zwp_linux_dmabuf_feedback_v1 *feedback,
struct wl_array *device)
{
DmabufFormatsInfo *info = data;
dev_t dev;
DmabufTranche *tranche;
memcpy (&dev, device->data, sizeof (dev_t));
g_assert (info->pending_tranche == NULL);
tranche = dmabuf_tranche_new ();
tranche->target_device = dev;
info->pending_tranche = tranche;
}
static void
linux_dmabuf_tranche_formats (void *data,
struct zwp_linux_dmabuf_feedback_v1 *feedback,
struct wl_array *indices)
{
DmabufFormatsInfo *info = data;
DmabufTranche *tranche;
int i;
guint16 *pos;
g_assert (info->pending_tranche != NULL);
tranche = info->pending_tranche;
tranche->n_formats = indices->size / sizeof (guint16);
tranche->formats = g_new (DmabufFormat, tranche->n_formats);
i = 0;
wl_array_for_each (pos, indices)
{
tranche->formats[i++] = info->dmabuf_format_table[*pos];
}
}
static void
linux_dmabuf_tranche_flags (void *data,
struct zwp_linux_dmabuf_feedback_v1 *feedback,
uint32_t flags)
{
DmabufFormatsInfo *info = data;
DmabufTranche *tranche;
g_assert (info->pending_tranche != NULL);
tranche = info->pending_tranche;
tranche->flags = flags;
}
static const struct zwp_linux_dmabuf_feedback_v1_listener feedback_listener = {
linux_dmabuf_done,
linux_dmabuf_format_table,
linux_dmabuf_main_device,
linux_dmabuf_tranche_done,
linux_dmabuf_tranche_target_device,
linux_dmabuf_tranche_formats,
linux_dmabuf_tranche_flags,
};
DmabufFormatsInfo *
dmabuf_formats_info_new (GdkDisplay *display,
const char *name,
struct zwp_linux_dmabuf_feedback_v1 *feedback)
{
DmabufFormatsInfo *info;
info = g_new0 (DmabufFormatsInfo, 1);
info->display = display;
info->name = g_strdup (name);
info->feedback = feedback;
if (info->feedback)
zwp_linux_dmabuf_feedback_v1_add_listener (info->feedback,
&feedback_listener, info);
return info;
}
void
dmabuf_formats_info_free (DmabufFormatsInfo *info)
{
g_free (info->name);
g_clear_pointer (&info->feedback, zwp_linux_dmabuf_feedback_v1_destroy);
if (info->dmabuf_format_table)
{
munmap (info->dmabuf_format_table, info->n_dmabuf_formats * 16);
info->dmabuf_format_table = NULL;
}
g_clear_pointer (&info->dmabuf_formats, dmabuf_formats_free);
g_clear_pointer (&info->pending_dmabuf_formats, dmabuf_formats_free);
g_clear_pointer (&info->pending_tranche, dmabuf_tranche_free);
g_free (info);
}

View File

@@ -203,6 +203,7 @@ gdk_wayland_drop_read_async (GdkDrop *drop,
{
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("No compatible transfer format found"));
g_object_unref (task);
return;
}
@@ -211,6 +212,7 @@ gdk_wayland_drop_read_async (GdkDrop *drop,
if (!g_unix_open_pipe (pipe_fd, O_CLOEXEC, &error))
{
g_task_return_error (task, error);
g_object_unref (task);
return;
}
@@ -218,6 +220,7 @@ gdk_wayland_drop_read_async (GdkDrop *drop,
stream = g_unix_input_stream_new (pipe_fd[0], TRUE);
close (pipe_fd[1]);
g_task_return_pointer (task, stream, g_object_unref);
g_object_unref (task);
}
static GInputStream *

View File

@@ -88,7 +88,14 @@ gdk_wayland_gl_context_empty_frame (GdkDrawContext *draw_context)
{
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
gdk_wayland_surface_handle_empty_frame (surface);
if (gdk_wayland_surface_needs_commit (surface))
{
gdk_wayland_surface_sync (surface);
gdk_wayland_surface_request_frame (surface);
gdk_wayland_surface_commit (surface);
gdk_wayland_surface_notify_committed (surface);
}
}
static void

View File

@@ -335,6 +335,7 @@ gdk_wayland_primary_read_async (GdkClipboard *clipboard,
{
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("No compatible transfer format found"));
g_object_unref (task);
return;
}
/* offer formats should be empty if we have no offer */
@@ -345,6 +346,7 @@ gdk_wayland_primary_read_async (GdkClipboard *clipboard,
if (!g_unix_open_pipe (pipe_fd, O_CLOEXEC, &error))
{
g_task_return_error (task, error);
g_object_unref (task);
return;
}
@@ -352,6 +354,7 @@ gdk_wayland_primary_read_async (GdkClipboard *clipboard,
stream = g_unix_input_stream_new (pipe_fd[0], TRUE);
close (pipe_fd[1]);
g_task_return_pointer (task, stream, g_object_unref);
g_object_unref (task);
}
static GInputStream *

View File

@@ -116,14 +116,13 @@ void gdk_wayland_display_system_bell (GdkDisplay *display,
struct wl_buffer *_gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
GdkCursor *cursor,
double desired_scale,
gboolean use_viewporter,
guint desired_scale,
guint image_index,
int *hotspot_x,
int *hotspot_y,
int *w,
int *h,
double *scale);
int *scale);
guint _gdk_wayland_cursor_get_next_image_index (GdkWaylandDisplay *display,
GdkCursor *cursor,
guint scale,
@@ -131,7 +130,7 @@ guint _gdk_wayland_cursor_get_next_image_index (GdkWaylandDisplay *display,
guint *next_image_delay);
void gdk_wayland_surface_sync (GdkSurface *surface);
void gdk_wayland_surface_handle_empty_frame (GdkSurface *surface);
gboolean gdk_wayland_surface_needs_commit (GdkSurface *surface);
void gdk_wayland_surface_commit (GdkSurface *surface);
void gdk_wayland_surface_notify_committed (GdkSurface *surface);
void gdk_wayland_surface_request_frame (GdkSurface *surface);

View File

@@ -781,8 +781,8 @@ pointer_handle_motion (void *data,
{
double x, y;
gdk_event_get_position (event, &x, &y);
gdk_debug_message ("motion %f %f, seat %p state %d",
x, y, seat, gdk_event_get_modifier_state (event));
g_message ("motion %f %f, seat %p state %d",
x, y, seat, gdk_event_get_modifier_state (event));
}
if (wl_seat_get_version (seat->wl_seat) < WL_POINTER_HAS_FRAME)
@@ -1664,7 +1664,7 @@ touch_handle_down (void *data,
{
double xx, yy;
gdk_event_get_position (event, &xx, &yy);
gdk_debug_message ("touch begin %f %f", xx, yy);
g_message ("touch begin %f %f", xx, yy);
}
_gdk_wayland_display_deliver_event (seat->display, event);
@@ -1699,7 +1699,7 @@ touch_handle_up (void *data,
{
double x, y;
gdk_event_get_position (event, &x, &y);
gdk_debug_message ("touch end %f %f", x, y);
g_message ("touch end %f %f", x, y);
}
_gdk_wayland_display_deliver_event (seat->display, event);
@@ -1747,7 +1747,7 @@ touch_handle_motion (void *data,
{
double xx, yy;
gdk_event_get_position (event, &xx, &yy);
gdk_debug_message ("touch update %f %f", xx, yy);
g_message ("touch update %f %f", xx, yy);
}
_gdk_wayland_display_deliver_event (seat->display, event);
@@ -1841,9 +1841,9 @@ emit_gesture_swipe_event (GdkWaylandSeat *seat,
{
double x, y;
gdk_event_get_position (event, &x, &y);
gdk_debug_message ("swipe event %d, coords: %f %f, seat %p state %d",
gdk_event_get_event_type (event), x, y, seat,
gdk_event_get_modifier_state (event));
g_message ("swipe event %d, coords: %f %f, seat %p state %d",
gdk_event_get_event_type (event), x, y, seat,
gdk_event_get_modifier_state (event));
}
_gdk_wayland_display_deliver_event (seat->display, event);
@@ -1936,10 +1936,10 @@ emit_gesture_pinch_event (GdkWaylandSeat *seat,
{
double x, y;
gdk_event_get_position (event, &x, &y);
gdk_debug_message ("pinch event %d, coords: %f %f, seat %p state %d",
gdk_event_get_event_type (event),
x, y, seat,
gdk_event_get_modifier_state (event));
g_message ("pinch event %d, coords: %f %f, seat %p state %d",
gdk_event_get_event_type (event),
x, y, seat,
gdk_event_get_modifier_state (event));
}
_gdk_wayland_display_deliver_event (seat->display, event);
@@ -2030,10 +2030,10 @@ emit_gesture_hold_event (GdkWaylandSeat *seat,
{
double x, y;
gdk_event_get_position (event, &x, &y);
gdk_debug_message ("hold event %d, coords: %f %f, seat %p state %d",
gdk_event_get_event_type (event),
x, y, seat,
gdk_event_get_modifier_state (event));
g_message ("hold event %d, coords: %f %f, seat %p state %d",
gdk_event_get_event_type (event),
x, y, seat,
gdk_event_get_modifier_state (event));
}
_gdk_wayland_display_deliver_event (seat->display, event);
@@ -3767,7 +3767,8 @@ pointer_surface_update_scale (GdkDevice *device)
GdkWaylandDevice *wayland_device = GDK_WAYLAND_DEVICE (device);
GdkWaylandPointerData *pointer =
gdk_wayland_device_get_pointer (wayland_device);
double scale;
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
guint32 scale;
GSList *l;
if (wl_surface_get_version (pointer->pointer_surface) < WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION)
@@ -3782,8 +3783,8 @@ pointer_surface_update_scale (GdkDevice *device)
scale = 1;
for (l = pointer->pointer_surface_outputs; l != NULL; l = l->next)
{
GdkMonitor *monitor = gdk_wayland_display_get_monitor_for_output (seat->display, l->data);
scale = MAX (scale, gdk_monitor_get_scale (monitor));
guint32 output_scale = gdk_wayland_display_get_output_scale (display_wayland, l->data);
scale = MAX (scale, output_scale);
}
if (pointer->current_output_scale == scale)
@@ -3866,9 +3867,25 @@ pointer_surface_leave (void *data,
pointer_surface_update_scale (device);
}
static void
pointer_surface_preferred_buffer_scale (void *data,
struct wl_surface *wl_surface,
int32_t factor)
{
}
static void
pointer_surface_preferred_buffer_transform (void *data,
struct wl_surface *wl_surface,
uint32_t transform)
{
}
static const struct wl_surface_listener pointer_surface_listener = {
pointer_surface_enter,
pointer_surface_leave
pointer_surface_leave,
pointer_surface_preferred_buffer_scale,
pointer_surface_preferred_buffer_transform,
};
static void
@@ -3878,7 +3895,6 @@ gdk_wayland_pointer_data_finalize (GdkWaylandPointerData *pointer)
g_clear_object (&pointer->cursor);
wl_surface_destroy (pointer->pointer_surface);
g_slist_free (pointer->pointer_surface_outputs);
g_clear_pointer (&pointer->pointer_surface_viewport, wp_viewport_destroy);
}
static void
@@ -4058,9 +4074,12 @@ gdk_wayland_seat_grab (GdkSeat *seat,
{
GdkWaylandTabletData *tablet = l->data;
gdk_wayland_device_maybe_emit_grab_crossing (tablet->logical_device,
surface,
evtime);
if (tablet->current_tool)
{
gdk_wayland_device_maybe_emit_grab_crossing (tablet->logical_device,
surface,
evtime);
}
_gdk_display_add_device_grab (display,
tablet->logical_device,
@@ -4242,9 +4261,6 @@ init_pointer_data (GdkWaylandPointerData *pointer_data,
wl_surface_add_listener (pointer_data->pointer_surface,
&pointer_surface_listener,
logical_device);
if (display_wayland->viewporter)
pointer_data->pointer_surface_viewport = wp_viewporter_get_viewport (display_wayland->viewporter, pointer_data->pointer_surface);
}
void

View File

@@ -2,7 +2,6 @@
#include "gdksubsurfaceprivate.h"
#include "wayland-client-protocol.h"
typedef struct _GdkWaylandSubsurface GdkWaylandSubsurface;
typedef struct _GdkWaylandSubsurfaceClass GdkWaylandSubsurfaceClass;
@@ -24,17 +23,10 @@ struct _GdkWaylandSubsurface
GdkTexture *texture;
cairo_rectangle_int_t dest;
graphene_rect_t source;
enum wl_output_transform transform;
struct wl_region *opaque_region;
struct wl_callback *frame_callback;
struct wl_surface *bg_surface;
struct wl_subsurface *bg_subsurface;
struct wp_viewport *bg_viewport;
cairo_rectangle_int_t bg_rect;
gboolean bg_attached;
};
struct _GdkWaylandSubsurfaceClass

View File

@@ -25,8 +25,6 @@
#include "gdkdmabuftextureprivate.h"
#include "gdksurface-wayland-private.h"
#include "gdksubsurfaceprivate.h"
#include "gdkdebugprivate.h"
#include "gsk/gskrectprivate.h"
#include "linux-dmabuf-unstable-v1-client-protocol.h"
@@ -48,55 +46,10 @@ gdk_wayland_subsurface_finalize (GObject *object)
g_clear_pointer (&self->viewport, wp_viewport_destroy);
g_clear_pointer (&self->subsurface, wl_subsurface_destroy);
g_clear_pointer (&self->surface, wl_surface_destroy);
g_clear_pointer (&self->bg_viewport, wp_viewport_destroy);
g_clear_pointer (&self->bg_subsurface, wl_subsurface_destroy);
g_clear_pointer (&self->bg_surface, wl_surface_destroy);
G_OBJECT_CLASS (gdk_wayland_subsurface_parent_class)->finalize (object);
}
static void
shm_buffer_release (void *data,
struct wl_buffer *buffer)
{
cairo_surface_t *surface = data;
/* Note: the wl_buffer is destroyed as cairo user data */
cairo_surface_destroy (surface);
}
static const struct wl_buffer_listener shm_buffer_listener = {
shm_buffer_release,
};
static struct wl_buffer *
get_shm_wl_buffer (GdkWaylandSubsurface *self,
GdkTexture *texture)
{
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SUBSURFACE (self)->parent));
int width, height;
cairo_surface_t *surface;
GdkTextureDownloader *downloader;
struct wl_buffer *buffer;
width = gdk_texture_get_width (texture);
height = gdk_texture_get_height (texture);
surface = gdk_wayland_display_create_shm_surface (display, width, height, &GDK_FRACTIONAL_SCALE_INIT_INT (1));
downloader = gdk_texture_downloader_new (texture);
gdk_texture_downloader_download_into (downloader,
cairo_image_surface_get_data (surface),
cairo_image_surface_get_stride (surface));
gdk_texture_downloader_free (downloader);
buffer = _gdk_wayland_shm_surface_get_wl_buffer (surface);
wl_buffer_add_listener (buffer, &shm_buffer_listener, surface);
return buffer;
}
static void
dmabuf_buffer_release (void *data,
struct wl_buffer *buffer)
@@ -143,8 +96,8 @@ static const struct zwp_linux_buffer_params_v1_listener params_listener = {
};
static struct wl_buffer *
get_dmabuf_wl_buffer (GdkWaylandSubsurface *self,
GdkTexture *texture)
get_wl_buffer (GdkWaylandSubsurface *self,
GdkTexture *texture)
{
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SUBSURFACE (self)->parent));
const GdkDmabuf *dmabuf;
@@ -195,138 +148,23 @@ get_dmabuf_wl_buffer (GdkWaylandSubsurface *self,
return buffer;
}
static struct wl_buffer *
get_wl_buffer (GdkWaylandSubsurface *self,
GdkTexture *texture)
{
GdkDisplay *display = gdk_surface_get_display (GDK_SUBSURFACE (self)->parent);
struct wl_buffer *buffer = NULL;
if (GDK_IS_DMABUF_TEXTURE (texture))
buffer = get_dmabuf_wl_buffer (self, texture);
if (GDK_DISPLAY_DEBUG_CHECK (display, FORCE_OFFLOAD))
{
if (!buffer)
buffer = get_shm_wl_buffer (self, texture);
}
return buffer;
}
static void
sp_buffer_release (void *data,
struct wl_buffer *buffer)
{
wl_buffer_destroy (buffer);
}
static const struct wl_buffer_listener sp_buffer_listener = {
sp_buffer_release,
};
static struct wl_buffer *
get_sp_buffer (GdkWaylandSubsurface *self)
{
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SUBSURFACE (self)->parent));
struct wl_buffer *buffer = NULL;
if (display->single_pixel_buffer)
buffer = wp_single_pixel_buffer_manager_v1_create_u32_rgba_buffer (display->single_pixel_buffer,
0, 0, 0, 0xffffffffU);
if (buffer)
wl_buffer_add_listener (buffer, &sp_buffer_listener, self);
return buffer;
}
static inline enum wl_output_transform
gdk_texture_transform_to_wl (GdkTextureTransform transform)
{
return (enum wl_output_transform) transform;
}
static inline GdkTextureTransform
wl_output_transform_to_gdk (enum wl_output_transform transform)
{
return (GdkTextureTransform) transform;
}
static void
ensure_bg_surface (GdkWaylandSubsurface *self)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (GDK_SUBSURFACE (self)->parent);
GdkDisplay *display = gdk_surface_get_display (GDK_SUBSURFACE (self)->parent);
GdkWaylandDisplay *disp = GDK_WAYLAND_DISPLAY (display);
struct wl_region *region;
if (self->bg_surface)
return;
self->bg_surface = wl_compositor_create_surface (disp->compositor);
self->bg_subsurface = wl_subcompositor_get_subsurface (disp->subcompositor,
self->bg_surface,
impl->display_server.wl_surface);
self->bg_viewport = wp_viewporter_get_viewport (disp->viewporter, self->bg_surface);
/* We are opaque */
wl_surface_set_opaque_region (self->bg_surface, self->opaque_region);
/* No input, please */
region = wl_compositor_create_region (disp->compositor);
wl_surface_set_input_region (self->bg_surface, region);
wl_region_destroy (region);
}
static inline gboolean
scaled_rect_is_integral (const graphene_rect_t *rect,
float scale,
graphene_rect_t *device_rect)
{
cairo_rectangle_int_t device_int;
gsk_rect_scale (rect, scale, scale, device_rect);
device_int.x = device_rect->origin.x;
device_int.y = device_rect->origin.y;
device_int.width = device_rect->size.width;
device_int.height = device_rect->size.height;
return device_int.x == device_rect->origin.x &&
device_int.y == device_rect->origin.y &&
device_int.width == device_rect->size.width &&
device_int.height == device_rect->size.height;
}
static gboolean
gdk_wayland_subsurface_attach (GdkSubsurface *sub,
GdkTexture *texture,
const graphene_rect_t *source,
const graphene_rect_t *dest,
GdkTextureTransform transform,
const graphene_rect_t *background,
gboolean above,
GdkSubsurface *sibling)
{
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
GdkWaylandSurface *parent = GDK_WAYLAND_SURFACE (sub->parent);
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (sub->parent));
struct wl_buffer *buffer = NULL;
gboolean result = FALSE;
GdkWaylandSubsurface *sib = sibling ? GDK_WAYLAND_SUBSURFACE (sibling) : NULL;
gboolean will_be_above;
double scale;
graphene_rect_t device_rect;
gboolean has_background;
enum wl_output_transform tf;
gboolean dest_changed = FALSE;
gboolean source_changed = FALSE;
gboolean transform_changed = FALSE;
gboolean stacking_changed = FALSE;
gboolean needs_commit = FALSE;
gboolean background_changed = FALSE;
gboolean needs_bg_commit = FALSE;
cairo_rectangle_int_t device_dest;
if (sibling)
will_be_above = sibling->above_parent;
@@ -339,133 +177,69 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
return FALSE;
}
self->dest.x = dest->origin.x;
self->dest.y = dest->origin.y;
self->dest.width = dest->size.width;
self->dest.height = dest->size.height;
self->source.origin.x = source->origin.x;
self->source.origin.y = source->origin.y;
self->source.size.width = source->size.width;
self->source.size.height = source->size.height;
scale = gdk_fractional_scale_to_double (&parent->scale);
device_rect.origin.x = dest->origin.x * scale;
device_rect.origin.y = dest->origin.y * scale;
device_rect.size.width = dest->size.width * scale;
device_rect.size.height = dest->size.height * scale;
device_dest.x = device_rect.origin.x;
device_dest.y = device_rect.origin.y;
device_dest.width = device_rect.size.width;
device_dest.height = device_rect.size.height;
if (self->dest.x != dest->origin.x ||
self->dest.y != dest->origin.y ||
self->dest.width != dest->size.width ||
self->dest.height != dest->size.height)
{
self->dest.x = dest->origin.x;
self->dest.y = dest->origin.y;
self->dest.width = dest->size.width;
self->dest.height = dest->size.height;
dest_changed = TRUE;
}
if (!gsk_rect_equal (&self->source, source))
{
self->source.origin.x = source->origin.x;
self->source.origin.y = source->origin.y;
self->source.size.width = source->size.width;
self->source.size.height = source->size.height;
source_changed = TRUE;
}
tf = gdk_texture_transform_to_wl (transform);
if (self->transform != tf)
{
self->transform = tf;
transform_changed = TRUE;
}
if (sibling != gdk_subsurface_get_sibling (sub, above) ||
will_be_above != gdk_subsurface_is_above_parent (sub))
stacking_changed = TRUE;
if (self->texture == NULL)
{
dest_changed = TRUE;
source_changed = TRUE;
transform_changed = TRUE;
stacking_changed = TRUE;
}
scale = gdk_fractional_scale_to_double (&parent->scale);
if (background)
{
background_changed =
!self->bg_attached ||
self->bg_rect.x != background->origin.x ||
self->bg_rect.y != background->origin.y ||
self->bg_rect.width != background->size.width ||
self->bg_rect.height != background->size.height;
self->bg_rect.x = background->origin.x;
self->bg_rect.y = background->origin.y;
self->bg_rect.width = background->size.width;
self->bg_rect.height = background->size.height;
}
else
{
background_changed = self->bg_attached;
self->bg_rect.x = 0;
self->bg_rect.y = 0;
self->bg_rect.width = 0;
self->bg_rect.height = 0;
}
has_background = self->bg_rect.width > 0 && self->bg_rect.height > 0;
if (has_background)
ensure_bg_surface (self);
if (!scaled_rect_is_integral (dest, 1, &device_rect))
{
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
"[%p] 🗙 Non-integral coordinates %g %g %g %g",
self,
"Non-integer coordinates %g %g %g %g for %dx%d texture, hiding subsurface %p",
dest->origin.x, dest->origin.y,
dest->size.width, dest->size.height);
}
else if (!scaled_rect_is_integral (dest, scale, &device_rect))
{
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
"[%p] 🗙 Non-integral device coordinates %g %g %g %g (scale %.2f)",
self,
device_rect.origin.x, device_rect.origin.y,
device_rect.size.width, device_rect.size.height,
scale);
}
else if (background && !scaled_rect_is_integral (background, 1, &device_rect))
{
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
"[%p] 🗙 Non-integral background coordinates %g %g %g %g",
self,
background->origin.x, background->origin.y,
background->size.width, background->size.height);
}
else if (background && !scaled_rect_is_integral (background, scale, &device_rect))
{
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
"[%p] 🗙 Non-integral background device coordinates %g %g %g %g (scale %.2f)",
self,
device_rect.origin.x, device_rect.origin.y,
device_rect.size.width, device_rect.size.height,
scale);
}
else if (!GDK_IS_DMABUF_TEXTURE (texture) &&
!GDK_DISPLAY_DEBUG_CHECK (gdk_surface_get_display (sub->parent), FORCE_OFFLOAD))
{
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
"[%p] 🗙 %s (%dx%d) is not a GdkDmabufTexture",
self,
G_OBJECT_TYPE_NAME (texture),
dest->size.width, dest->size.height,
gdk_texture_get_width (texture),
gdk_texture_get_height (texture));
gdk_texture_get_height (texture),
self);
}
else if (device_dest.x != device_rect.origin.x ||
device_dest.y != device_rect.origin.y ||
device_dest.width != device_rect.size.width ||
device_dest.height != device_rect.size.height)
{
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
"Non-integral device coordinates %g %g %g %g (fractional scale %.2f), hiding subsurface %p",
device_rect.origin.x, device_rect.origin.y,
device_rect.size.width, device_rect.size.width,
scale,
self);
}
else if (!GDK_IS_DMABUF_TEXTURE (texture))
{
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
"%dx%d %s is not a GdkDmabufTexture, hiding subsurface %p",
gdk_texture_get_width (texture),
gdk_texture_get_height (texture),
G_OBJECT_TYPE_NAME (texture),
self);
}
else if (!will_be_above &&
gdk_memory_format_alpha (gdk_texture_get_format (texture)) != GDK_MEMORY_ALPHA_OPAQUE &&
!has_background)
gdk_memory_format_alpha (gdk_texture_get_format (texture)) != GDK_MEMORY_ALPHA_OPAQUE)
{
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
"[%p] 🗙 Non-opaque texture (%dx%d) below",
self,
"Cannot offload non-opaque %dx%d texture below, hiding subsurface %p",
gdk_texture_get_width (texture),
gdk_texture_get_height (texture));
}
else if (has_background && !display->single_pixel_buffer)
{
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
"[%p] 🗙 Texture has background, but no single-pixel buffer support",
gdk_texture_get_height (texture),
self);
}
else
@@ -494,13 +268,10 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
}
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
"[%p] %s Attaching texture (%dx%d) at %d %d %d %d",
self,
will_be_above
? (has_background ? "" : "")
: (has_background ? "" : ""),
"Attached %dx%d texture to subsurface %p at %d %d %d %d",
gdk_texture_get_width (texture),
gdk_texture_get_height (texture),
self,
self->dest.x, self->dest.y,
self->dest.width, self->dest.height);
result = TRUE;
@@ -508,53 +279,35 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
else
{
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
"[%p] 🗙 Failed to create wl_buffer",
"Compositor failed to create wl_buffer for %dx%d texture, hiding subsurface %p",
gdk_texture_get_width (texture),
gdk_texture_get_height (texture),
self);
}
}
else
{
if (dest_changed)
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
"[%p] %s Moving texture (%dx%d) to %d %d %d %d",
self,
will_be_above
? (has_background ? "" : "")
: (has_background ? "" : ""),
gdk_texture_get_width (texture),
gdk_texture_get_height (texture),
self->dest.x, self->dest.y,
self->dest.width, self->dest.height);
buffer = NULL;
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
"Moved %dx%d texture in subsurface %p to %d %d %d %d",
gdk_texture_get_width (texture),
gdk_texture_get_height (texture),
self,
self->dest.x, self->dest.y,
self->dest.width, self->dest.height);
result = TRUE;
}
}
if (result)
{
if (transform_changed)
{
wl_surface_set_buffer_transform (self->surface, self->transform);
needs_commit = TRUE;
}
if (dest_changed)
{
wl_subsurface_set_position (self->subsurface, self->dest.x, self->dest.y);
wp_viewport_set_destination (self->viewport, self->dest.width, self->dest.height);
needs_commit = TRUE;
}
if (source_changed)
{
wp_viewport_set_source (self->viewport,
wl_fixed_from_double (self->source.origin.x),
wl_fixed_from_double (self->source.origin.y),
wl_fixed_from_double (self->source.size.width),
wl_fixed_from_double (self->source.size.height));
needs_commit = TRUE;
}
wl_subsurface_set_position (self->subsurface, self->dest.x, self->dest.y);
wp_viewport_set_destination (self->viewport, self->dest.width, self->dest.height);
wp_viewport_set_source (self->viewport,
wl_fixed_from_double (self->source.origin.x),
wl_fixed_from_double (self->source.origin.y),
wl_fixed_from_double (self->source.size.width),
wl_fixed_from_double (self->source.size.height));
if (buffer)
{
@@ -563,95 +316,39 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
0, 0,
gdk_texture_get_width (texture),
gdk_texture_get_height (texture));
needs_commit = TRUE;
}
if (has_background)
{
if (background_changed)
{
wl_subsurface_set_position (self->bg_subsurface, self->bg_rect.x, self->bg_rect.y);
wp_viewport_set_destination (self->bg_viewport, self->bg_rect.width, self->bg_rect.height);
needs_bg_commit = TRUE;
}
if (!self->bg_attached)
{
self->bg_attached = TRUE;
wp_viewport_set_source (self->bg_viewport,
wl_fixed_from_int (0),
wl_fixed_from_int (0),
wl_fixed_from_int (1),
wl_fixed_from_int (1));
wl_surface_attach (self->bg_surface, get_sp_buffer (self), 0, 0);
wl_surface_damage_buffer (self->bg_surface, 0, 0, 1, 1);
needs_bg_commit = TRUE;
}
}
else
{
if (self->bg_attached)
{
self->bg_attached = FALSE;
wl_surface_attach (self->bg_surface, NULL, 0, 0);
needs_bg_commit = TRUE;
}
}
result = TRUE;
}
else
{
if (g_set_object (&self->texture, NULL))
{
wl_surface_attach (self->surface, NULL, 0, 0);
needs_commit = TRUE;
}
g_set_object (&self->texture, NULL);
if (self->bg_attached)
{
self->bg_attached = FALSE;
wl_surface_attach (self->bg_surface, NULL, 0, 0);
needs_bg_commit = TRUE;
}
wl_surface_attach (self->surface, NULL, 0, 0);
}
if (stacking_changed)
if (sib)
{
if (sib)
{
if (above)
wl_subsurface_place_above (self->subsurface, sib->surface);
else
wl_subsurface_place_below (self->subsurface, sib->surface);
}
if (above)
wl_subsurface_place_above (self->subsurface, sib->surface);
else
{
if (above)
wl_subsurface_place_above (self->subsurface,
GDK_WAYLAND_SURFACE (sub->parent)->display_server.wl_surface);
else
wl_subsurface_place_below (self->subsurface,
GDK_WAYLAND_SURFACE (sub->parent)->display_server.wl_surface);
}
needs_commit = TRUE;
if (self->bg_attached)
{
wl_subsurface_place_below (self->bg_subsurface, self->surface);
needs_bg_commit = TRUE;
}
wl_subsurface_place_below (self->subsurface, sib->surface);
}
else
{
if (above)
wl_subsurface_place_above (self->subsurface,
GDK_WAYLAND_SURFACE (sub->parent)->display_server.wl_surface);
else
wl_subsurface_place_below (self->subsurface,
GDK_WAYLAND_SURFACE (sub->parent)->display_server.wl_surface);
}
if (needs_commit)
wl_surface_commit (self->surface);
wl_surface_commit (self->surface);
if (needs_bg_commit)
wl_surface_commit (self->bg_surface);
((GdkWaylandSurface *)sub->parent)->has_pending_subsurface_commits = needs_commit || needs_bg_commit;
GDK_WAYLAND_SURFACE (sub->parent)->opaque_region_dirty = stacking_changed || dest_changed || background_changed;
((GdkWaylandSurface *)sub->parent)->has_pending_subsurface_commits = TRUE;
GDK_WAYLAND_SURFACE (sub->parent)->opaque_region_dirty = TRUE;
return result;
}
@@ -663,7 +360,7 @@ gdk_wayland_subsurface_detach (GdkSubsurface *sub)
if (sub->parent == NULL)
{
g_warning ("Can't detach from destroyed subsurface %p", self);
g_warning ("Can't draw to destroyed subsurface %p", self);
return;
}
@@ -672,13 +369,6 @@ gdk_wayland_subsurface_detach (GdkSubsurface *sub)
wl_surface_set_opaque_region (self->surface, self->opaque_region);
wl_surface_commit (self->surface);
if (self->bg_attached)
{
wl_surface_attach (self->bg_surface, NULL, 0, 0);
wl_surface_commit (self->bg_surface);
self->bg_attached = FALSE;
}
((GdkWaylandSurface *)sub->parent)->has_pending_subsurface_commits = TRUE;
GDK_WAYLAND_SURFACE (sub->parent)->opaque_region_dirty = TRUE;
}
@@ -692,49 +382,27 @@ gdk_wayland_subsurface_get_texture (GdkSubsurface *sub)
}
static void
gdk_wayland_subsurface_get_texture_rect (GdkSubsurface *sub,
graphene_rect_t *rect)
gdk_wayland_subsurface_get_dest (GdkSubsurface *sub,
graphene_rect_t *dest)
{
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
rect->origin.x = self->dest.x;
rect->origin.y = self->dest.y;
rect->size.width = self->dest.width;
rect->size.height = self->dest.height;
dest->origin.x = self->dest.x;
dest->origin.y = self->dest.y;
dest->size.width = self->dest.width;
dest->size.height = self->dest.height;
}
static void
gdk_wayland_subsurface_get_source_rect (GdkSubsurface *sub,
graphene_rect_t *rect)
gdk_wayland_subsurface_get_source (GdkSubsurface *sub,
graphene_rect_t *source)
{
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
rect->origin.x = self->source.origin.x;
rect->origin.y = self->source.origin.y;
rect->size.width = self->source.size.width;
rect->size.height = self->source.size.height;
}
static GdkTextureTransform
gdk_wayland_subsurface_get_transform (GdkSubsurface *sub)
{
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
return wl_output_transform_to_gdk (self->transform);
}
static gboolean
gdk_wayland_subsurface_get_background_rect (GdkSubsurface *sub,
graphene_rect_t *rect)
{
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
rect->origin.x = self->bg_rect.x;
rect->origin.y = self->bg_rect.y;
rect->size.width = self->bg_rect.width;
rect->size.height = self->bg_rect.height;
return rect->size.width > 0 && rect->size.height > 0;
source->origin.x = self->source.origin.x;
source->origin.y = self->source.origin.y;
source->size.width = self->source.size.width;
source->size.height = self->source.size.height;
}
static void
@@ -748,10 +416,8 @@ gdk_wayland_subsurface_class_init (GdkWaylandSubsurfaceClass *class)
subsurface_class->attach = gdk_wayland_subsurface_attach;
subsurface_class->detach = gdk_wayland_subsurface_detach;
subsurface_class->get_texture = gdk_wayland_subsurface_get_texture;
subsurface_class->get_source_rect = gdk_wayland_subsurface_get_source_rect;
subsurface_class->get_texture_rect = gdk_wayland_subsurface_get_texture_rect;
subsurface_class->get_transform = gdk_wayland_subsurface_get_transform;
subsurface_class->get_background_rect = gdk_wayland_subsurface_get_background_rect;
subsurface_class->get_source = gdk_wayland_subsurface_get_source;
subsurface_class->get_dest = gdk_wayland_subsurface_get_dest;
};
static void

View File

@@ -54,8 +54,6 @@
#include "linux-dmabuf-unstable-v1-client-protocol.h"
#include "presentation-time-client-protocol.h"
#include "gsk/gskrectprivate.h"
/**
* GdkWaylandSurface:
@@ -659,7 +657,6 @@ static void
gdk_wayland_surface_sync_opaque_region (GdkSurface *surface)
{
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface));
struct wl_region *wl_region = NULL;
if (!impl->display_server.wl_surface)
@@ -682,21 +679,16 @@ gdk_wayland_surface_sync_opaque_region (GdkSurface *surface)
continue;
if (sub->texture != NULL)
{
graphene_rect_t bounds;
cairo_rectangle_int_t rect;
gdk_subsurface_get_bounds (subsurface, &bounds);
gsk_rect_to_cairo_grow (&bounds, &rect);
cairo_region_subtract_rectangle (region, &rect);
}
cairo_region_subtract_rectangle (region, &sub->dest);
}
wl_region = wl_region_from_cairo_region (display, region);
wl_region = wl_region_from_cairo_region (GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)),
region);
cairo_region_destroy (region);
}
else
wl_region = wl_region_from_cairo_region (display, impl->opaque_region);
wl_region = wl_region_from_cairo_region (GDK_WAYLAND_DISPLAY (gdk_surface_get_display (surface)),
impl->opaque_region);
}
wl_surface_set_opaque_region (impl->display_server.wl_surface, wl_region);
@@ -783,7 +775,7 @@ gdk_wayland_surface_sync (GdkSurface *surface)
gdk_wayland_surface_sync_viewport (surface);
}
static gboolean
gboolean
gdk_wayland_surface_needs_commit (GdkSurface *surface)
{
GdkWaylandSurface *self = GDK_WAYLAND_SURFACE (surface);
@@ -795,20 +787,6 @@ gdk_wayland_surface_needs_commit (GdkSurface *surface)
self->viewport_dirty;
}
void
gdk_wayland_surface_handle_empty_frame (GdkSurface *surface)
{
if (!gdk_wayland_surface_needs_commit (surface))
return;
gdk_wayland_surface_sync (surface);
gdk_wayland_surface_request_frame (surface);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
gdk_wayland_surface_commit (surface);
gdk_wayland_surface_notify_committed (surface);
}
static void
gdk_wayland_surface_fractional_scale_preferred_scale_cb (void *data,
struct wp_fractional_scale_v1 *fractional_scale,
@@ -821,11 +799,6 @@ gdk_wayland_surface_fractional_scale_preferred_scale_cb (void *data,
gdk_wayland_surface_update_size (surface,
surface->width, surface->height,
&GDK_FRACTIONAL_SCALE_INIT (scale));
GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS,
"preferred fractional scale, surface %p scale %f",
surface,
gdk_fractional_scale_to_double (&GDK_FRACTIONAL_SCALE_INIT (scale)));
}
static const struct wp_fractional_scale_v1_listener fractional_scale_listener = {
@@ -842,8 +815,8 @@ surface_enter (void *data,
GdkDisplay *display = gdk_surface_get_display (surface);
GdkMonitor *monitor;
GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS,
"surface enter, surface %p output %p", surface, output);
GDK_DISPLAY_DEBUG(gdk_surface_get_display (surface), EVENTS,
"surface enter, surface %p output %p", surface, output);
impl->display_server.outputs = g_slist_prepend (impl->display_server.outputs, output);
@@ -875,38 +848,9 @@ surface_leave (void *data,
gdk_surface_leave_monitor (surface, monitor);
}
static void
surface_preferred_buffer_scale (void *data,
struct wl_surface *wl_surface,
int32_t factor)
{
GdkSurface *surface = GDK_SURFACE (data);
GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS,
"preferred buffer scale, surface %p scale %d",
surface, factor);
}
static void
surface_preferred_buffer_transform (void *data,
struct wl_surface *wl_surface,
uint32_t transform)
{
GdkSurface *surface = GDK_SURFACE (data);
const char *transform_name[] = {
"normal", "90", "180", "270", "flipped", "flipped-90", "flipped-180", "flipped-270"
};
GDK_DISPLAY_DEBUG (gdk_surface_get_display (surface), EVENTS,
"preferred buffer transform, surface %p transform %s",
surface, transform_name[transform]);
}
static const struct wl_surface_listener surface_listener = {
surface_enter,
surface_leave,
surface_preferred_buffer_scale,
surface_preferred_buffer_transform,
surface_leave
};
static void

View File

@@ -37,6 +37,7 @@
#include <wayland/presentation-time-client-protocol.h>
#include <wayland/xdg-shell-unstable-v6-client-protocol.h>
#include <wayland/xdg-foreign-unstable-v2-client-protocol.h>
#include <wayland/xdg-dialog-v1-client-protocol.h>
#include <stdlib.h>
#include <stdio.h>
@@ -84,6 +85,7 @@ struct _GdkWaylandToplevel
struct gtk_surface1 *gtk_surface;
struct xdg_toplevel *xdg_toplevel;
struct zxdg_toplevel_v6 *zxdg_toplevel_v6;
struct xdg_dialog_v1 *xdg_dialog;
} display_server;
GdkWaylandToplevel *transient_for;
@@ -205,6 +207,7 @@ gdk_wayland_toplevel_clear_saved_size (GdkWaylandToplevel *toplevel)
static void maybe_set_gtk_surface_dbus_properties (GdkWaylandToplevel *wayland_toplevel);
static void maybe_set_gtk_surface_modal (GdkWaylandToplevel *wayland_toplevel);
static gboolean maybe_set_xdg_dialog_modal (GdkWaylandToplevel *wayland_toplevel);
static void
gdk_wayland_toplevel_hide_surface (GdkWaylandSurface *wayland_surface)
@@ -215,6 +218,7 @@ gdk_wayland_toplevel_hide_surface (GdkWaylandSurface *wayland_surface)
g_clear_pointer (&toplevel->display_server.xdg_toplevel, xdg_toplevel_destroy);
g_clear_pointer (&toplevel->display_server.zxdg_toplevel_v6, zxdg_toplevel_v6_destroy);
g_clear_pointer (&toplevel->display_server.xdg_dialog, xdg_dialog_v1_destroy);
if (toplevel->display_server.gtk_surface)
{
@@ -877,7 +881,8 @@ gdk_wayland_surface_create_xdg_toplevel (GdkWaylandToplevel *wayland_toplevel)
gdk_wayland_toplevel_set_application_id (GDK_TOPLEVEL (wayland_toplevel), app_id);
maybe_set_gtk_surface_dbus_properties (wayland_toplevel);
maybe_set_gtk_surface_modal (wayland_toplevel);
if (!maybe_set_xdg_dialog_modal (wayland_toplevel))
maybe_set_gtk_surface_modal (wayland_toplevel);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
wl_surface_commit (wayland_surface->display_server.wl_surface);
@@ -1089,12 +1094,40 @@ maybe_set_gtk_surface_modal (GdkWaylandToplevel *wayland_toplevel)
}
static gboolean
maybe_set_xdg_dialog_modal (GdkWaylandToplevel *wayland_toplevel)
{
GdkWaylandDisplay *display_wayland =
GDK_WAYLAND_DISPLAY (gdk_surface_get_display (GDK_SURFACE (wayland_toplevel)));
if (!display_wayland->xdg_wm_dialog)
return FALSE;
if (!is_realized_toplevel (GDK_WAYLAND_SURFACE (wayland_toplevel)))
return FALSE;
if (!wayland_toplevel->display_server.xdg_dialog)
{
wayland_toplevel->display_server.xdg_dialog =
xdg_wm_dialog_v1_get_xdg_dialog (display_wayland->xdg_wm_dialog,
wayland_toplevel->display_server.xdg_toplevel);
}
if (GDK_SURFACE (wayland_toplevel)->modal_hint)
xdg_dialog_v1_set_modal (wayland_toplevel->display_server.xdg_dialog);
else
xdg_dialog_v1_unset_modal (wayland_toplevel->display_server.xdg_dialog);
return TRUE;
}
static void
gdk_wayland_toplevel_set_modal_hint (GdkWaylandToplevel *wayland_toplevel,
gboolean modal)
{
GDK_SURFACE (wayland_toplevel)->modal_hint = modal;
maybe_set_gtk_surface_modal (wayland_toplevel);
if (!maybe_set_xdg_dialog_modal (wayland_toplevel))
maybe_set_gtk_surface_modal (wayland_toplevel);
}
void

View File

@@ -77,8 +77,16 @@ static void
gdk_vulkan_context_wayland_empty_frame (GdkDrawContext *context)
{
GdkSurface *surface = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (context));
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
gdk_wayland_surface_handle_empty_frame (surface);
if (!impl->has_pending_subsurface_commits)
return;
gdk_wayland_surface_sync (surface);
gdk_wayland_surface_request_frame (surface);
gdk_wayland_surface_commit (surface);
gdk_wayland_surface_notify_committed (surface);
}
static void

View File

@@ -48,7 +48,7 @@ GDK_AVAILABLE_IN_ALL
struct wl_display *gdk_wayland_display_get_wl_display (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
struct wl_compositor *gdk_wayland_display_get_wl_compositor (GdkDisplay *display);
GDK_DEPRECATED_IN_4_16
GDK_AVAILABLE_IN_ALL
void gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
const char *name,
int size);
@@ -60,7 +60,7 @@ void gdk_wayland_display_set_startup_notification_id (GdkDisp
GDK_AVAILABLE_IN_ALL
gboolean gdk_wayland_display_query_registry (GdkDisplay *display,
const char *global);
const char *global);
GDK_AVAILABLE_IN_4_4
gpointer gdk_wayland_display_get_egl_display (GdkDisplay *display);

View File

@@ -8,7 +8,6 @@ gdk_wayland_sources = files([
'gdkdevice-wayland.c',
'gdkdevicepad-wayland.c',
'gdkdisplay-wayland.c',
'gdkdmabuf-wayland.c',
'gdkdrag-wayland.c',
'gdkdragsurface-wayland.c',
'gdkdrop-wayland.c',
@@ -48,36 +47,156 @@ gdk_wayland_deps = [
wlegldep,
]
wlmod = import('unstable-wayland')
wayland_scanner = find_program('wayland-scanner')
# Fields:
# - name: protocol name
# - stability: protocol stability ('private', 'stable' or 'unstable')
# - version: protocol version
# - required: wayland_protocols version check
proto_sources = [
'protocol/gtk-shell.xml',
'protocol/server-decoration.xml',
wlmod.find_protocol('primary-selection', state: 'unstable', version: 1),
wlmod.find_protocol('pointer-gestures', state: 'unstable', version: 1),
wlmod.find_protocol('viewporter', state: 'stable'),
wlmod.find_protocol('xdg-shell', state: 'unstable', version: 6),
wlmod.find_protocol('xdg-shell', state: 'stable'),
wlmod.find_protocol('xdg-foreign', state: 'unstable', version: 1),
wlmod.find_protocol('xdg-foreign', state: 'unstable', version: 2),
wlmod.find_protocol('tablet', state: 'unstable', version: 2),
wlmod.find_protocol('keyboard-shortcuts-inhibit', state: 'unstable', version: 1),
wlmod.find_protocol('xdg-output', state: 'unstable', version: 1),
wlmod.find_protocol('idle-inhibit', state: 'unstable', version: 1),
wlmod.find_protocol('xdg-activation', state: 'staging', version: 1),
wlmod.find_protocol('fractional-scale', state: 'staging', version: 1),
wlmod.find_protocol('linux-dmabuf', state: 'unstable', version: 1),
wlmod.find_protocol('presentation-time', state: 'stable'),
wlmod.find_protocol('single-pixel-buffer', state: 'staging', version: 1),
{
'name': 'gtk-shell',
'stability': 'private',
},
{
'name': 'primary-selection',
'stability': 'unstable',
'version': 1,
},
{
'name': 'pointer-gestures',
'stability': 'unstable',
'version': 1,
},
{
'name': 'viewporter',
'stability': 'stable',
},
{
'name': 'xdg-shell',
'stability': 'unstable',
'version': 6,
},
{
'name': 'xdg-shell',
'stability': 'stable',
},
{
'name': 'xdg-foreign',
'stability': 'unstable',
'version': 1,
},
{
'name': 'xdg-foreign',
'stability': 'unstable',
'version': 2,
},
{
'name': 'tablet',
'stability': 'unstable',
'version': 2,
},
{
'name': 'keyboard-shortcuts-inhibit',
'stability': 'unstable',
'version': 1,
},
{
'name': 'server-decoration',
'stability': 'private',
},
{
'name': 'xdg-output',
'stability': 'unstable',
'version': 1,
},
{
'name': 'idle-inhibit',
'stability': 'unstable',
'version': 1,
},
{
'name': 'xdg-activation',
'stability': 'staging',
'version': 1,
},
{
'name': 'fractional-scale',
'stability': 'staging',
'version': 1,
},
{
'name': 'linux-dmabuf',
'stability': 'unstable',
'version': 1,
},
{
'name': 'presentation-time',
'stability': 'stable',
'version': 1,
},
{
'name': 'xdg-dialog',
'stability': 'staging',
'version': 1,
'required': '>=1.36',
},
{
'name': 'xdg-dialog',
'stability': 'private',
'version': 1,
'required': '<1.36',
},
]
gdk_wayland_gen_headers = []
foreach p: proto_sources
# Returns a list [.c, .h]
gen = wlmod.scan_xml(p)
assert(gen.length() == 2)
gdk_wayland_sources += gen[0]
gdk_wayland_gen_headers += gen[1]
proto_name = p.get('name')
proto_stability = p.get('stability')
if wlprotocolsdep.version().version_compare(p.get('required', '>=0'))
if proto_stability == 'stable'
output_base = proto_name
input = files(join_paths(wlproto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base)))
elif proto_stability == 'staging'
proto_version = p.get('version')
output_base = '@0@-v@1@'.format(proto_name, proto_version)
input = files(join_paths(wlproto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base)))
elif proto_stability == 'private'
if p.has_key('version')
output_base = '@0@-v@1@'.format(proto_name, p.get('version'))
else
output_base = proto_name
endif
input = files('protocol/@0@.xml'.format(output_base))
else
proto_version = p.get('version')
output_base = '@0@-@1@-v@2@'.format(proto_name, proto_stability, proto_version)
input = files(join_paths(wlproto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base)))
endif
gdk_wayland_gen_headers += custom_target('@0@ client header'.format(output_base),
input: input,
output: '@0@-client-protocol.h'.format(output_base),
command: [
wayland_scanner,
'client-header',
'@INPUT@', '@OUTPUT@',
],
)
gdk_wayland_sources += custom_target('@0@ source'.format(output_base),
input: input,
output: '@0@-protocol.c'.format(output_base),
command: [
wayland_scanner,
'private-code',
'@INPUT@', '@OUTPUT@',
],
)
endif
endforeach
libgdk_wayland = static_library('gdk-wayland',

View File

@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="xdg_dialog_v1">
<copyright>
Copyright © 2023 Carlos Garnacho
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
</copyright>
<interface name="xdg_wm_dialog_v1" version="1">
<description summary="create dialogs related to other toplevels">
The xdg_wm_dialog_v1 interface is exposed as a global object allowing
to register surfaces with a xdg_toplevel role as "dialogs" relative to
another toplevel.
The compositor may let this relation influence how the surface is
placed, displayed or interacted with.
Warning! The protocol described in this file is currently in the testing
phase. Backward compatible changes may be added together with the
corresponding interface version bump. Backward incompatible changes can
only be done by creating a new major version of the extension.
</description>
<enum name="error">
<entry name="already_used" value="0"
summary="the xdg_toplevel object has already been used to create a xdg_dialog_v1"/>
</enum>
<request name="destroy" type="destructor">
<description summary="destroy the dialog manager object">
Destroys the xdg_wm_dialog_v1 object. This does not affect
the xdg_dialog_v1 objects generated through it.
</description>
</request>
<request name="get_xdg_dialog">
<description summary="create a dialog object">
Creates a xdg_dialog_v1 object for the given toplevel. See the interface
description for more details.
Compositors must raise an already_used error if clients attempt to
create multiple xdg_dialog_v1 objects for the same xdg_toplevel.
</description>
<arg name="id" type="new_id" interface="xdg_dialog_v1"/>
<arg name="toplevel" type="object" interface="xdg_toplevel"/>
</request>
</interface>
<interface name="xdg_dialog_v1" version="1">
<description summary="dialog object">
A xdg_dialog_v1 object is an ancillary object tied to a xdg_toplevel. Its
purpose is hinting the compositor that the toplevel is a "dialog" (e.g. a
temporary window) relative to another toplevel (see
xdg_toplevel.set_parent). If the xdg_toplevel is destroyed, the xdg_dialog_v1
becomes inert.
Through this object, the client may provide additional hints about
the purpose of the secondary toplevel. This interface has no effect
on toplevels that are not attached to a parent toplevel.
</description>
<request name="destroy" type="destructor">
<description summary="destroy the dialog object">
Destroys the xdg_dialog_v1 object. If this object is destroyed
before the related xdg_toplevel, the compositor should unapply its
effects.
</description>
</request>
<request name="set_modal">
<description summary="mark dialog as modal">
Hints that the dialog has "modal" behavior. Modal dialogs typically
require to be fully addressed by the user (i.e. closed) before resuming
interaction with the parent toplevel, and may require a distinct
presentation.
Clients must implement the logic to filter events in the parent
toplevel on their own.
Compositors may choose any policy in event delivery to the parent
toplevel, from delivering all events unfiltered to using them for
internal consumption.
</description>
</request>
<request name="unset_modal">
<description summary="mark dialog as not modal">
Drops the hint that this dialog has "modal" behavior. See
xdg_dialog_v1.set_modal for more details.
</description>
</request>
</interface>
</protocol>

View File

@@ -21,7 +21,6 @@
#include "gdkcursor.h"
#include "gdkwin32.h"
#include "gdktextureprivate.h"
#include "gdkcursorprivate.h"
#include "gdkdisplay-win32.h"
@@ -37,6 +36,7 @@ static struct {
{ "appstarting", IDC_APPSTARTING },
{ "arrow", IDC_ARROW },
{ "cross", IDC_CROSS },
{ "dnd-move", IDC_ARROW },
{ "hand", IDC_HAND },
{ "help", IDC_HELP },
{ "ibeam", IDC_IBEAM },
@@ -1484,7 +1484,6 @@ gdk_win32_display_get_win32hcursor (GdkWin32Display *display,
GdkWin32Display *win32_display = GDK_WIN32_DISPLAY (display);
GdkWin32HCursor *win32hcursor;
const char *cursor_name;
GdkTexture *texture;
GdkCursor *fallback;
g_return_val_if_fail (cursor != NULL, NULL);
@@ -1498,32 +1497,14 @@ gdk_win32_display_get_win32hcursor (GdkWin32Display *display,
return win32hcursor;
cursor_name = gdk_cursor_get_name (cursor);
texture = gdk_cursor_get_texture (cursor);
if (cursor_name)
win32hcursor = gdk_win32hcursor_create_for_name (display, cursor_name);
else if (texture)
else
win32hcursor = gdk_win32hcursor_create_for_texture (display,
texture,
gdk_cursor_get_texture (cursor),
gdk_cursor_get_hotspot_x (cursor),
gdk_cursor_get_hotspot_y (cursor));
else
{
int size = display->cursor_theme_size;
int width, height, hotspot_x, hotspot_y;
texture = gdk_cursor_get_texture_for_size (cursor, size, 1,
&width, &height,
&hotspot_x, &hotspot_y);
if (texture)
{
win32hcursor = gdk_win32hcursor_create_for_texture (display,
texture,
hotspot_x,
hotspot_y);
g_object_unref (texture);
}
}
if (win32hcursor != NULL)
{

View File

@@ -1016,6 +1016,7 @@ gdk_win32_drop_read_async (GdkDrop *drop,
{
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("No compatible transfer format found"));
g_object_unref (task);
g_clear_pointer (&drop_win32->dropfiles_list, g_free);
return;
@@ -1025,6 +1026,7 @@ gdk_win32_drop_read_async (GdkDrop *drop,
drop_win32->dropfiles_list = NULL;
g_object_set_data (G_OBJECT (stream), "gdk-dnd-stream-contenttype", (gpointer) "text/uri-list");
g_task_return_pointer (task, stream, g_object_unref);
g_object_unref (task);
return;
}
@@ -1035,6 +1037,7 @@ gdk_win32_drop_read_async (GdkDrop *drop,
{
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
_("GDK surface 0x%p is not registered as a drop target"), gdk_drop_get_surface (drop));
g_object_unref (task);
return;
}
@@ -1042,6 +1045,7 @@ gdk_win32_drop_read_async (GdkDrop *drop,
{
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
_("Target context record 0x%p has no data object"), tctx);
g_object_unref (task);
return;
}
@@ -1061,6 +1065,7 @@ gdk_win32_drop_read_async (GdkDrop *drop,
{
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("No compatible transfer format found"));
g_object_unref (task);
return;
}
@@ -1080,6 +1085,7 @@ gdk_win32_drop_read_async (GdkDrop *drop,
{
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
_("IDataObject_GetData (0x%x) failed, returning 0x%lx"), fmt.cfFormat, hr);
g_object_unref (task);
return;
}
@@ -1092,6 +1098,7 @@ gdk_win32_drop_read_async (GdkDrop *drop,
if (data == NULL)
{
ReleaseStgMedium (&storage);
g_object_unref (task);
return;
}
@@ -1112,12 +1119,14 @@ gdk_win32_drop_read_async (GdkDrop *drop,
{
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_FAILED,
_("Failed to transmute DnD data W32 format 0x%x to %p (%s)"), pair->w32format, pair->contentformat, pair->contentformat);
g_object_unref (task);
return;
}
stream = g_memory_input_stream_new_from_data (data, data_len, g_free);
g_object_set_data (G_OBJECT (stream), "gdk-dnd-stream-contenttype", (gpointer) pair->contentformat);
g_task_return_pointer (task, stream, g_object_unref);
g_object_unref (task);
}
static GInputStream *

View File

@@ -797,6 +797,7 @@ gdk_x11_clipboard_read_async (GdkClipboard *clipboard,
{
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("No compatible transfer format found"));
g_object_unref (task);
return;
}

View File

@@ -274,22 +274,11 @@ gdk_x11_cursor_create_for_name (GdkDisplay *display,
* will have to be handled by the application (GTK applications can learn
* about cursor theme changes by listening for change notification
* for the corresponding `GtkSetting`).
*
* Deprecated: 4.16: Use the cursor-related properties of
* [GtkSettings](../gtk4/class.Settings.html) to set the cursor theme
*/
void
gdk_x11_display_set_cursor_theme (GdkDisplay *display,
const char *theme,
const int size)
{
_gdk_x11_display_set_cursor_theme (display, theme, size);
}
void
_gdk_x11_display_set_cursor_theme (GdkDisplay *display,
const char *theme,
const int size)
{
#if defined(HAVE_XCURSOR) && defined(HAVE_XFIXES) && XFIXES_MAJOR >= 2
GdkX11Screen *x11_screen;
@@ -381,33 +370,11 @@ gdk_x11_display_get_xcursor (GdkDisplay *display,
if (gdk_cursor_get_name (cursor))
xcursor = gdk_x11_cursor_create_for_name (display, gdk_cursor_get_name (cursor));
else if (gdk_cursor_get_texture (cursor))
else
xcursor = gdk_x11_cursor_create_for_texture (display,
gdk_cursor_get_texture (cursor),
gdk_cursor_get_hotspot_x (cursor),
gdk_cursor_get_hotspot_y (cursor));
else
{
int size;
GdkTexture *texture;
int width, height;
int hotspot_x, hotspot_y;
size = XcursorGetDefaultSize (GDK_DISPLAY_XDISPLAY (display));
texture = gdk_cursor_get_texture_for_size (cursor, size, 1,
&width, &height,
&hotspot_x, &hotspot_y);
if (texture)
{
xcursor = gdk_x11_cursor_create_for_texture (display,
texture,
hotspot_x,
hotspot_y);
g_object_unref (texture);
}
}
if (xcursor != None)
{

View File

@@ -1776,11 +1776,6 @@ _gdk_x11_display_is_root_window (GdkDisplay *display,
return GDK_SCREEN_XROOTWIN (display_x11->screen) == xroot_window;
}
struct XPointerUngrabInfo {
GdkDisplay *display;
guint32 time;
};
static void
device_grab_update_callback (GdkDisplay *display,
gpointer data,
@@ -3078,7 +3073,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
display_class->get_monitors = gdk_x11_display_get_monitors;
display_class->get_setting = gdk_x11_display_get_setting;
display_class->set_cursor_theme = _gdk_x11_display_set_cursor_theme;
display_class->set_cursor_theme = gdk_x11_display_set_cursor_theme;
class->xevent = gdk_event_source_xevent;

View File

@@ -233,6 +233,7 @@ gdk_x11_drop_read_async (GdkDrop *drop,
{
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
_("No compatible transfer format found"));
g_object_unref (task);
return;
}

View File

@@ -206,10 +206,6 @@ GdkFilterReturn
gdk_surface_cache_shape_filter (const XEvent *xevent,
gpointer data);
void _gdk_x11_display_set_cursor_theme (GdkDisplay *display,
const char *theme,
const int size);
void _gdk_x11_cursor_display_finalize (GdkDisplay *display);
void _gdk_x11_surface_register_dnd (GdkSurface *window);

View File

@@ -88,7 +88,7 @@ GDK_AVAILABLE_IN_ALL
void gdk_x11_display_set_program_class (GdkDisplay *display,
const char *program_class);
GDK_DEPRECATED_IN_4_16
GDK_AVAILABLE_IN_ALL
void gdk_x11_display_set_cursor_theme (GdkDisplay *display,
const char *theme,
const int size);

View File

@@ -127,7 +127,7 @@ gsk_gl_glyph_library_init_atlas (GskGLTextureLibrary *self,
else
{
gl_format = GL_BGRA;
gl_type = GL_UNSIGNED_BYTE;
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
}
glBindTexture (GL_TEXTURE_2D, atlas->texture_id);
@@ -293,7 +293,7 @@ gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary *self,
{
pixel_data = cairo_image_surface_get_data (surface);
gl_format = GL_BGRA;
gl_type = GL_UNSIGNED_BYTE;
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
}
glPixelStorei (GL_UNPACK_ROW_LENGTH, stride / 4);

View File

@@ -125,7 +125,7 @@ gsk_gl_icon_library_add (GskGLIconLibrary *self,
{
pixel_data = surface_data;
gl_format = GL_BGRA;
gl_type = GL_UNSIGNED_BYTE;
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
}
texture_id = GSK_GL_TEXTURE_ATLAS_ENTRY_TEXTURE (icon_data);

View File

@@ -4013,7 +4013,7 @@ gsk_gl_render_job_visit_subsurface_node (GskGLRenderJob *job,
/* Clear the area so we can see through */
GskGLCommandBatch *batch;
guint16 color[4];
rgba_to_half (&GDK_RGBA_TRANSPARENT, color);
rgba_to_half (&(GdkRGBA){0,0,0,0}, color);
batch = gsk_gl_command_queue_get_batch (job->command_queue);
batch->draw.blend = 0;

View File

@@ -70,7 +70,10 @@ gsk_gl_frame_cleanup (GskGpuFrame *frame)
if (self->sync)
{
glClientWaitSync (self->sync, 0, -1);
g_clear_pointer (&self->sync, glDeleteSync);
/* can't use g_clear_pointer() on glDeleteSync(), see MR !7294 */
glDeleteSync (self->sync);
self->sync = NULL;
}
self->next_texture_slot = 0;

View File

@@ -19,7 +19,7 @@ static gint64 profiler_buffer_uploads;
static void
gsk_gpu_buffer_class_init (GskGpuBufferClass *klass)
{
profiler_buffer_uploads_id = gdk_profiler_define_int_counter ("buffer-uploads", "Number of bytes uploaded to GPU");
profiler_buffer_uploads_id = gdk_profiler_define_int_counter ("ngl-buffer-uploads", "Number of bytes uploaded to GPU");
}
static void

View File

@@ -546,7 +546,7 @@ gsk_gpu_device_maybe_gc (GskGpuDevice *self)
if (priv->cache_timeout == 0 || dead_texture_pixels > 1000000)
{
GSK_DEBUG (GLYPH_CACHE, "Pre-frame GC (%" G_GSIZE_FORMAT " dead pixels)", dead_texture_pixels);
GSK_DEBUG (GLYPH_CACHE, "Pre-frame GC (%lu dead pixels)", dead_texture_pixels);
gsk_gpu_device_gc (self, g_get_monotonic_time ());
}
}
@@ -907,7 +907,6 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
gsize atlas_x, atlas_y, padding;
float subpixel_x, subpixel_y;
PangoFont *scaled_font;
cairo_hint_metrics_t hint_metrics;
cache = g_hash_table_lookup (priv->glyph_cache, &lookup);
if (cache)
@@ -919,15 +918,7 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
return cache->image;
}
/* The combination of hint-style != none and hint-metrics == off
* leads to broken rendering with some fonts.
*/
if (gsk_font_get_hint_style (font) != CAIRO_HINT_STYLE_NONE)
hint_metrics = CAIRO_HINT_METRICS_ON;
else
hint_metrics = CAIRO_HINT_METRICS_DEFAULT;
scaled_font = gsk_reload_font (font, scale, hint_metrics, CAIRO_HINT_STYLE_DEFAULT, CAIRO_ANTIALIAS_DEFAULT);
scaled_font = gsk_reload_font (font, scale, CAIRO_HINT_METRICS_DEFAULT, CAIRO_HINT_STYLE_DEFAULT, CAIRO_ANTIALIAS_DEFAULT);
subpixel_x = (flags & 3) / 4.f;
subpixel_y = ((flags >> 2) & 3) / 4.f;

View File

@@ -249,7 +249,13 @@ gsk_gl_texture_data_free (gpointer user_data)
gdk_gl_context_make_current (data->context);
g_clear_pointer (&data->sync, glDeleteSync);
/* can't use g_clear_pointer() on glDeleteSync(), see MR !7294 */
if (data->sync)
{
glDeleteSync (data->sync);
data->sync = NULL;
}
glDeleteTextures (1, &data->texture_id);
g_object_unref (data->context);

View File

@@ -9,7 +9,6 @@
#include "gdk/gdkdisplayprivate.h"
#include "gdk/gdkvulkancontextprivate.h"
#include "gdk/gdkprofilerprivate.h"
struct _GskVulkanDevice
{
@@ -81,6 +80,7 @@ struct _PipelineCacheKey
GskGpuShaderClip clip;
GskGpuBlend blend;
VkFormat format;
VkPipeline pipeline;
};
struct _RenderPassCacheKey
@@ -88,6 +88,7 @@ struct _RenderPassCacheKey
VkFormat format;
VkImageLayout from_layout;
VkImageLayout to_layout;
VkRenderPass render_pass;
};
static guint
@@ -297,8 +298,10 @@ gsk_vulkan_pipeline_layout_unref (GskVulkanDevice *self,
g_hash_table_iter_init (&iter, layout->pipeline_cache);
while (g_hash_table_iter_next (&iter, &key, &value))
{
vkDestroyPipeline (display->vk_device,
((PipelineCacheKey *)key)->pipeline,
NULL);
g_free (key);
vkDestroyPipeline (display->vk_device, value, NULL);
}
g_hash_table_unref (layout->pipeline_cache);
@@ -463,8 +466,10 @@ gsk_vulkan_device_finalize (GObject *object)
g_hash_table_iter_init (&iter, self->render_pass_cache);
while (g_hash_table_iter_next (&iter, &key, &value))
{
vkDestroyRenderPass (display->vk_device,
((RenderPassCacheKey *)key)->render_pass,
NULL);
g_free (key);
vkDestroyRenderPass (display->vk_device, value, NULL);
}
g_hash_table_unref (self->render_pass_cache);
@@ -824,6 +829,7 @@ gsk_vulkan_device_get_vk_render_pass (GskVulkanDevice *self,
VkImageLayout to_layout)
{
RenderPassCacheKey cache_key;
RenderPassCacheKey *cached_result;
VkRenderPass render_pass;
GdkDisplay *display;
@@ -832,9 +838,9 @@ gsk_vulkan_device_get_vk_render_pass (GskVulkanDevice *self,
.from_layout = from_layout,
.to_layout = to_layout,
};
render_pass = g_hash_table_lookup (self->render_pass_cache, &cache_key);
if (render_pass)
return render_pass;
cached_result = g_hash_table_lookup (self->render_pass_cache, &cache_key);
if (cached_result)
return cached_result->render_pass;
display = gsk_gpu_device_get_display (GSK_GPU_DEVICE (self));
@@ -878,7 +884,10 @@ gsk_vulkan_device_get_vk_render_pass (GskVulkanDevice *self,
NULL,
&render_pass);
g_hash_table_insert (self->render_pass_cache, g_memdup (&cache_key, sizeof (RenderPassCacheKey)), render_pass);
cached_result = g_memdup (&cache_key, sizeof (RenderPassCacheKey));
cached_result->render_pass = render_pass;
g_hash_table_insert (self->render_pass_cache, cached_result, cached_result);
return render_pass;
}
@@ -946,13 +955,11 @@ gsk_vulkan_device_get_vk_pipeline (GskVulkanDevice *self,
VkRenderPass render_pass)
{
PipelineCacheKey cache_key;
PipelineCacheKey *cached_result;
VkPipeline pipeline;
GdkDisplay *display;
const char *version_string;
char *vertex_shader_name, *fragment_shader_name;
G_GNUC_UNUSED gint64 begin_time = GDK_PROFILER_CURRENT_TIME;
const char *clip_name[] = { "NONE", "RECT", "ROUNDED" };
const char *blend_name[] = { "OVER", "ADD", "CLEAR" };
cache_key = (PipelineCacheKey) {
.op_class = op_class,
@@ -961,9 +968,9 @@ gsk_vulkan_device_get_vk_pipeline (GskVulkanDevice *self,
.blend = blend,
.format = format,
};
pipeline = g_hash_table_lookup (layout->pipeline_cache, &cache_key);
if (pipeline)
return pipeline;
cached_result = g_hash_table_lookup (layout->pipeline_cache, &cache_key);
if (cached_result)
return cached_result->pipeline;
display = gsk_gpu_device_get_display (GSK_GPU_DEVICE (self));
if (gsk_vulkan_device_has_feature (self, GDK_VULKAN_FEATURE_DYNAMIC_INDEXING) &&
@@ -1129,31 +1136,12 @@ gsk_vulkan_device_get_vk_pipeline (GskVulkanDevice *self,
NULL,
&pipeline);
gdk_profiler_end_markf (begin_time,
"Create Vulkan pipeline", "%s version=%s variation=%u clip=%s blend=%s format=%u",
op_class->shader_name,
version_string + 1,
variation,
clip_name[clip],
blend_name[blend],
format);
GSK_DEBUG (SHADERS,
"Create Vulkan pipeline (%s %s, %u/%s/%s/%u) for layout (%" G_GSIZE_FORMAT "/%" G_GSIZE_FORMAT "/%" G_GSIZE_FORMAT ")",
op_class->shader_name,
version_string + 1,
variation,
clip_name[clip],
blend_name[blend],
format,
layout->setup.n_buffers,
layout->setup.n_samplers,
layout->setup.n_immutable_samplers);
g_free (fragment_shader_name);
g_free (vertex_shader_name);
g_hash_table_insert (layout->pipeline_cache, g_memdup (&cache_key, sizeof (PipelineCacheKey)), pipeline);
cached_result = g_memdup (&cache_key, sizeof (PipelineCacheKey));
cached_result->pipeline = pipeline;
g_hash_table_insert (layout->pipeline_cache, cached_result, cached_result);
gdk_display_vulkan_pipeline_cache_updated (display);
return pipeline;
@@ -1261,7 +1249,7 @@ gsk_vulkan_device_find_allocator (GskVulkanDevice *self,
g_assert (found < properties.memoryTypeCount);
return gsk_vulkan_allocator_ref (gsk_vulkan_device_get_allocator (self, i, &properties.memoryTypes[i]));
return gsk_vulkan_allocator_ref (gsk_vulkan_device_get_allocator (self, found, &properties.memoryTypes[found]));
}
GskVulkanAllocator *

View File

@@ -178,7 +178,7 @@ gsk_vulkan_buddy_allocator_alloc (GskVulkanAllocator *allocator,
if (self->cache.vk_memory)
{
*alloc = self->cache;
self->cache.vk_memory = NULL;
self->cache.vk_memory = VK_NULL_HANDLE;
}
else
{
@@ -240,7 +240,7 @@ restart:
alloc->size <<= 1;
if (slot == 0)
{
if (self->cache.vk_memory == NULL)
if (self->cache.vk_memory == VK_NULL_HANDLE)
self->cache = *alloc;
else
gsk_vulkan_free (self->allocator, alloc);

View File

@@ -29,7 +29,6 @@
#include "gskdebugprivate.h"
#include "gskrendernodeprivate.h"
#include "gdksurfaceprivate.h"
#include "gdkrgbaprivate.h"
#include <graphene.h>
@@ -56,90 +55,33 @@ struct _GskOffload
GskOffloadInfo *last_info;
};
static GdkTextureTransform
find_texture_transform (GskTransform *transform)
{
float sx, sy, dx, dy;
g_assert (gsk_transform_get_category (transform) >= GSK_TRANSFORM_CATEGORY_2D_AFFINE);
gsk_transform_to_affine (transform, &sx, &sy, &dx, &dy);
if (sx > 0)
{
if (sy > 0)
return GDK_TEXTURE_TRANSFORM_NORMAL;
else
return GDK_TEXTURE_TRANSFORM_FLIPPED_180;
}
else
{
if (sy > 0)
return GDK_TEXTURE_TRANSFORM_FLIPPED;
else
return GDK_TEXTURE_TRANSFORM_180;
}
}
static GdkTexture *
find_texture_to_attach (GskOffload *self,
const GskRenderNode *subsurface_node,
graphene_rect_t *out_texture_rect,
graphene_rect_t *out_source_rect,
gboolean *has_background,
GdkTextureTransform *out_texture_transform)
find_texture_to_attach (GskOffload *self,
GdkSubsurface *subsurface,
const GskRenderNode *node,
graphene_rect_t *out_clip)
{
GdkSubsurface *subsurface;
const GskRenderNode *node;
gboolean has_clip = FALSE;
graphene_rect_t clip;
GskTransform *transform = NULL;
GdkTexture *ret = NULL;
*has_background = FALSE;
*out_texture_transform = GDK_TEXTURE_TRANSFORM_NORMAL;
subsurface = gsk_subsurface_node_get_subsurface (subsurface_node);
node = subsurface_node;
for (;;)
{
switch ((int) GSK_RENDER_NODE_TYPE (node))
switch ((int)GSK_RENDER_NODE_TYPE (node))
{
case GSK_DEBUG_NODE:
node = gsk_debug_node_get_child (node);
break;
case GSK_SUBSURFACE_NODE:
node = gsk_subsurface_node_get_child (node);
break;
case GSK_CONTAINER_NODE:
if (gsk_container_node_get_n_children (node) == 1)
if (gsk_container_node_get_n_children (node) != 1)
{
node = gsk_container_node_get_child (node, 0);
break;
GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD,
"Can't offload subsurface %p: too much content, container with %d children",
subsurface, gsk_container_node_get_n_children (node));
return NULL;
}
else if (gsk_container_node_get_n_children (node) == 2)
{
GskRenderNode *child = gsk_container_node_get_child (node, 0);
graphene_rect_t bounds;
gsk_transform_transform_bounds (transform, &child->bounds, &bounds);
if (GSK_RENDER_NODE_TYPE (child) == GSK_COLOR_NODE &&
gsk_rect_equal (&bounds, &subsurface_node->bounds) &&
gdk_rgba_equal (gsk_color_node_get_color (child), &GDK_RGBA_BLACK))
{
*has_background = TRUE;
node = gsk_container_node_get_child (node, 1);
break;
}
}
GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD,
"[%p] 🗙 Too much content, container with %d children",
subsurface, gsk_container_node_get_n_children (node));
goto out;
node = gsk_container_node_get_child (node, 0);
break;
case GSK_TRANSFORM_NODE:
{
@@ -149,10 +91,10 @@ find_texture_to_attach (GskOffload *self,
{
char *s = gsk_transform_to_string (t);
GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD,
"[%p] 🗙 Transform %s is not just scale/translate",
"Can't offload subsurface %p: transform %s is not just scale/translate",
subsurface, s);
g_free (s);
goto out;
return NULL;
}
if (has_clip)
@@ -162,8 +104,6 @@ find_texture_to_attach (GskOffload *self,
gsk_transform_unref (inv);
}
transform = gsk_transform_transform (transform, gsk_transform_ref (t));
node = gsk_transform_node_get_child (node);
}
break;
@@ -177,13 +117,12 @@ find_texture_to_attach (GskOffload *self,
if (!gsk_rect_intersection (c, &clip, &clip))
{
GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD,
"[%p] 🗙 Empty clip", subsurface);
goto out;
"Can't offload subsurface %p: empty clip", subsurface);
return NULL;
}
}
else
{
gsk_transform_transform_bounds (transform, &node->bounds, out_texture_rect);
clip = *c;
has_clip = TRUE;
}
@@ -196,8 +135,6 @@ find_texture_to_attach (GskOffload *self,
{
GdkTexture *texture = gsk_texture_node_get_texture (node);
*out_texture_transform = find_texture_transform (transform);
if (has_clip)
{
float dx = node->bounds.origin.x;
@@ -207,36 +144,29 @@ find_texture_to_attach (GskOffload *self,
gsk_rect_intersection (&node->bounds, &clip, &clip);
out_source_rect->origin.x = (clip.origin.x - dx) * sx;
out_source_rect->origin.y = (clip.origin.y - dy) * sy;
out_source_rect->size.width = clip.size.width * sx;
out_source_rect->size.height = clip.size.height * sy;
out_clip->origin.x = (clip.origin.x - dx) * sx;
out_clip->origin.y = (clip.origin.y - dy) * sy;
out_clip->size.width = clip.size.width * sx;
out_clip->size.height = clip.size.height * sy;
}
else
{
gsk_transform_transform_bounds (transform, &node->bounds, out_texture_rect);
out_source_rect->origin.x = 0;
out_source_rect->origin.y = 0;
out_source_rect->size.width = gdk_texture_get_width (texture);
out_source_rect->size.height = gdk_texture_get_height (texture);
out_clip->origin.x = 0;
out_clip->origin.y = 0;
out_clip->size.width = gdk_texture_get_width (texture);
out_clip->size.height = gdk_texture_get_height (texture);
}
ret = texture;
goto out;
return texture;
}
default:
GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD,
"[%p] 🗙 Only textures supported (found %s)",
"Can't offload subsurface %p: Only textures supported but found %s",
subsurface, g_type_name_from_instance ((GTypeInstance *) node));
goto out;
return NULL;
}
}
out:
g_clear_pointer (&transform, gsk_transform_unref);
return ret;
}
static void
@@ -476,8 +406,7 @@ visit_node (GskOffload *self,
if (info->can_raise)
{
if (gsk_rect_intersects (&transformed_bounds, &info->texture_rect) ||
gsk_rect_intersects (&transformed_bounds, &info->background_rect))
if (gsk_rect_intersects (&transformed_bounds, &info->dest))
{
GskRenderNodeType type = GSK_RENDER_NODE_TYPE (node);
@@ -488,7 +417,7 @@ visit_node (GskOffload *self,
type != GSK_DEBUG_NODE)
{
GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD,
"[%p] Lowering because a %s overlaps",
"Can't raise subsurface %p because a %s overlaps",
info->subsurface,
g_type_name_from_instance ((GTypeInstance *) node));
info->can_raise = FALSE;
@@ -502,6 +431,7 @@ visit_node (GskOffload *self,
switch (GSK_RENDER_NODE_TYPE (node))
{
case GSK_BORDER_NODE:
case GSK_COLOR_NODE:
case GSK_CONIC_GRADIENT_NODE:
case GSK_LINEAR_GRADIENT_NODE:
case GSK_REPEATING_LINEAR_GRADIENT_NODE:
@@ -511,7 +441,6 @@ visit_node (GskOffload *self,
case GSK_TEXTURE_NODE:
case GSK_TEXTURE_SCALE_NODE:
case GSK_CAIRO_NODE:
case GSK_COLOR_NODE:
case GSK_INSET_SHADOW_NODE:
case GSK_OUTSET_SHADOW_NODE:
case GSK_GL_SHADER_NODE:
@@ -525,7 +454,7 @@ visit_node (GskOffload *self,
case GSK_MASK_NODE:
case GSK_FILL_NODE:
case GSK_STROKE_NODE:
break;
break;
case GSK_CLIP_NODE:
{
@@ -622,42 +551,39 @@ complex_clip:
case GSK_SUBSURFACE_NODE:
{
GdkSubsurface *subsurface = gsk_subsurface_node_get_subsurface (node);
GskTransform *transform;
GskOffloadInfo *info = find_subsurface_info (self, subsurface);
transform = self->transforms ? (GskTransform *) self->transforms->data : NULL;
if (info == NULL)
{
GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD,
"[%p] 🗙 Unknown subsurface",
"Can't offload: unknown subsurface %p",
subsurface);
}
else if (!self->current_clip->is_fully_contained)
{
GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD,
"[%p] 🗙 Clipped",
"Can't offload subsurface %p: clipped",
subsurface);
}
else if (gsk_transform_get_category (transform) < GSK_TRANSFORM_CATEGORY_2D_AFFINE)
else if (self->transforms &&
gsk_transform_get_category ((GskTransform *)self->transforms->data) < GSK_TRANSFORM_CATEGORY_2D_AFFINE)
{
GDK_DISPLAY_DEBUG (gdk_surface_get_display (self->surface), OFFLOAD,
"[%p] 🗙 Non-affine transform",
"Can't offload subsurface %p: non-affine transform",
subsurface);
}
else
{
gboolean has_background;
graphene_rect_t clip;
info->texture = find_texture_to_attach (self, node, &info->texture_rect, &info->source_rect, &has_background, &info->transform);
info->texture = find_texture_to_attach (self, subsurface, gsk_subsurface_node_get_child (node), &clip);
if (info->texture)
{
info->can_offload = TRUE;
info->can_raise = TRUE;
transform_bounds (self, &info->texture_rect, &info->texture_rect);
info->has_background = has_background;
transform_bounds (self, &node->bounds, &info->background_rect);
info->source = clip;
transform_bounds (self, &node->bounds, &info->dest);
info->place_above = self->last_info ? self->last_info->subsurface : NULL;
self->last_info = info;
}
@@ -680,6 +606,7 @@ gsk_offload_new (GdkSurface *surface,
GskRenderNode *root,
cairo_region_t *diff)
{
GdkDisplay *display = gdk_surface_get_display (surface);
GskOffload *self;
self = g_new0 (GskOffload, 1);
@@ -696,12 +623,9 @@ gsk_offload_new (GdkSurface *surface,
for (gsize i = 0; i < self->n_subsurfaces; i++)
{
GskOffloadInfo *info = &self->subsurfaces[i];
graphene_rect_t rect;
info->subsurface = gdk_surface_get_subsurface (self->surface, i);
info->was_offloaded = gdk_subsurface_get_texture (info->subsurface) != NULL;
info->was_above = gdk_subsurface_is_above_parent (info->subsurface);
info->had_background = gdk_subsurface_get_background_rect (info->subsurface, &rect);
}
if (self->n_subsurfaces > 0)
@@ -718,28 +642,23 @@ gsk_offload_new (GdkSurface *surface,
for (gsize i = 0; i < self->n_subsurfaces; i++)
{
GskOffloadInfo *info = &self->subsurfaces[i];
graphene_rect_t old_bounds;
graphene_rect_t bounds;
graphene_rect_t old_dest;
gdk_subsurface_get_bounds (info->subsurface, &old_bounds);
gdk_subsurface_get_dest (info->subsurface, &old_dest);
if (info->can_offload)
{
if (info->can_raise)
info->is_offloaded = gdk_subsurface_attach (info->subsurface,
info->texture,
&info->source_rect,
&info->texture_rect,
info->transform,
info->has_background ? &info->background_rect : NULL,
&info->source,
&info->dest,
TRUE, NULL);
else
info->is_offloaded = gdk_subsurface_attach (info->subsurface,
info->texture,
&info->source_rect,
&info->texture_rect,
info->transform,
info->has_background ? &info->background_rect : NULL,
&info->source,
&info->dest,
info->place_above != NULL,
info->place_above);
}
@@ -747,29 +666,34 @@ gsk_offload_new (GdkSurface *surface,
{
info->is_offloaded = FALSE;
if (info->was_offloaded)
gdk_subsurface_detach (info->subsurface);
{
GDK_DISPLAY_DEBUG (display, OFFLOAD, "Hiding subsurface %p", info->subsurface);
gdk_subsurface_detach (info->subsurface);
}
}
info->is_above = info->is_offloaded && gdk_subsurface_is_above_parent (info->subsurface);
gdk_subsurface_get_bounds (info->subsurface, &bounds);
if (info->is_offloaded && gdk_subsurface_is_above_parent (info->subsurface))
{
GDK_DISPLAY_DEBUG (display, OFFLOAD, "Raising subsurface %p", info->subsurface);
info->is_above = TRUE;
}
if (info->is_offloaded != info->was_offloaded ||
info->is_above != info->was_above ||
(info->is_offloaded && !gsk_rect_equal (&bounds, &old_bounds)))
(info->is_offloaded && !gsk_rect_equal (&info->dest, &old_dest)))
{
/* We changed things, need to invalidate everything */
cairo_rectangle_int_t rect;
cairo_rectangle_int_t int_dest;
if (info->is_offloaded)
{
gsk_rect_to_cairo_grow (&bounds, &rect);
cairo_region_union_rectangle (diff, &rect);
gsk_rect_to_cairo_grow (&info->dest, &int_dest);
cairo_region_union_rectangle (diff, &int_dest);
}
if (info->was_offloaded)
{
gsk_rect_to_cairo_grow (&old_bounds, &rect);
cairo_region_union_rectangle (diff, &rect);
gsk_rect_to_cairo_grow (&old_dest, &int_dest);
cairo_region_union_rectangle (diff, &int_dest);
}
}

Some files were not shown because too many files have changed in this diff Show More