Compare commits

...

2372 Commits

Author SHA1 Message Date
Khalid Abu Shawarib
af9567b221 gtk/columnview: Invert resizing drag direction in RTL
Reverse the side of column resizing drag handle in RTL and change
the base for drag coordinates and the column resizing caluculations.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/6049
2024-04-13 22:24:51 +03:00
Khalid Abu Shawarib
e411b14105 gtk/columnview: Invert horizontal translation in RTL
Part of https://gitlab.gnome.org/GNOME/gtk/-/issues/6049
2024-04-13 21:50:19 +03:00
Khalid Abu Shawarib
55f908279f gtk/range: Invert autoscroll properly
This inverts autoscroll properly in Right-to-Left.

part of https://gitlab.gnome.org/GNOME/gtk/-/issues/6049
2024-04-13 21:50:19 +03:00
Khalid Abu Shawarib
e3a416bf2b gtk/scrollbar: Mark range as flippable
This inverts both the gesture interaction and physical placment of
the scrollbar in Right-to-Left.

Part of https://gitlab.gnome.org/GNOME/gtk/-/issues/6049
2024-04-13 21:50:19 +03:00
Benjamin Otte
afe61e28e0 Merge branch 'wip/p3732/no-additional-grid-tile' into 'main'
grid-view: make footer tile file empty space

Closes #6076

See merge request GNOME/gtk!6370
2024-04-13 15:35:43 +00:00
Peter Eisenmann
4f3f3c9ae2 grid-view: make footer tile file empty space 2024-04-13 15:35:42 +00:00
Matthias Clasen
e699685003 Merge branch 'mr7057-preparation' into 'main'
gdk/wayland: Make the surface handle empty commits

See merge request GNOME/gtk!7133
2024-04-12 15:54:33 +00:00
Robert Mader
9583195e96 gdk/wayland: Make the surface handle empty commits
In order to avoid some code duplication and ensure the Cairo and
Vulkan implementations behave like the GL one.
2024-04-12 17:04:54 +02:00
Matthias Clasen
a526f0770e Merge branch 'warning-fix' into 'main'
gdk/gsk: Fix a couple of maybe-uninitialized warnings

See merge request GNOME/gtk!7132
2024-04-12 11:55:04 +00:00
Philip Withnall
707e492f0d 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-12 12:08:03 +01:00
Philip Withnall
680dba6524 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-12 12:03:29 +01:00
Matthias Clasen
d1bb1d091c Merge branch 'gdk-build-dep-fix' into 'main'
build: Add a missing dependency

Closes #6618

See merge request GNOME/gtk!7127
2024-04-11 20:57:34 +00:00
Matthias Clasen
6510b876d1 build: Add a missing dependency
Add the generated gdk headers to the sources for all the backends,
to guarantee that they are generated before the library is used.

Fixes: #6618
2024-04-11 15:47:38 -04:00
Matthias Clasen
e376941e49 Merge branch 'scrollbar_accessible_range' into 'main'
a11y: Implement GtkAccessibleRange for scrollbars

Closes gnome-control-center#2994

See merge request GNOME/gtk!7129
2024-04-11 18:20:49 +00:00
Matthias Clasen
4889199b14 Merge branch 'glarea-dispose-fix' into 'main'
dmabuf texture: Survive multiple disposes

Closes #6623

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

Closes #6614

See merge request GNOME/gtk!7114
2024-04-11 17:03:08 +00:00
Matthias Clasen
9dad71513c glarea: Clean up dispose
We were getting our gl and dmabuf texture mixed up and ending
up freeing the Texture structs while they were still used as
callback data for dmabuf texture destroys. Avoid that by keeping
separate pointers for the gl and dmabuf textures.

Fixes: #6623
2024-04-11 12:48:01 -04:00
Matthias Clasen
ed072b4b5d dmabuf texture: Survive multiple disposes
dispose can be called more than once, so be safe for that.
2024-04-11 12:45:24 -04:00
Boyuan Yang
7ffc4e0a21 Update Chinese (China) translation 2024-04-11 15:46:08 +00:00
Emmanuele Bassi
b9403f4f5b Apply review suggestions 2024-04-11 14:04:12 +00:00
Lukáš Tyrychtr
9f1aa3141b a11y: Implement GtkAccessibleRange for scrollbars
Fixes gnome-control-center#2994
2024-04-11 14:25:42 +02:00
Matthias Clasen
06e905f87d Merge branch 'gtk-wlmod' into 'main'
Meson: Use wayland module

See merge request GNOME/gtk!7126
2024-04-11 01:29:29 +00:00
Xavier Claessens
2ba8dcebff Apply 1 suggestion(s) to 1 file(s) 2024-04-10 15:52:42 +00:00
Xavier Claessens
95a8def7c2 Meson: Use wayland module 2024-04-10 11:43:04 -04:00
Matthias Clasen
777799070d Merge branch 'simplify_widget_accessible_get_bounds' into 'main'
a11y: Simplify GtkWidget's GtkAccessible.get_bounds implementation

See merge request GNOME/gtk!7128
2024-04-10 15:40:44 +00:00
Lukáš Tyrychtr
0f83a9550b Proper rounding 2024-04-10 15:46:39 +02:00
Lukáš Tyrychtr
17f2443350 a11y: Simplify GtkWidget's GtkAccessible.get_bounds implementation
We can use the result from gtk_widget_get_bounds for the coordinates as well.
2024-04-10 15:32:16 +02:00
Matthias Clasen
6bfc995097 Merge branch 'matthiasc/for-main' into 'main'
docs: Update some links

See merge request GNOME/gtk!7125
2024-04-10 01:04:14 +00:00
Matthias Clasen
8068111c6e Merge branch 'fix-xi2-input-source-type-debug-msg' into 'main'
xi2: Fix incorrect input source type in Input debug message

Closes #6619

See merge request GNOME/gtk!7120
2024-04-10 00:45:14 +00:00
Matthias Clasen
6e1c47b021 Merge branch 'improve_gtkeditabledelegate_docs' into 'main'
GtkEditable: Document the usage restrictions of gtk_editable_delegate_get_accessible_platform_state

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

See merge request GNOME/gtk!4467
2024-04-10 00:12:28 +00:00
Matthias Clasen
96160ea5dc docs: Update some links
Use docs.gtk.org for all the documentation that is hosted there.
2024-04-09 20:00:00 -04:00
Matthias Clasen
c76c07ddfe Merge branch 'matthiasc/for-main' into 'main'
testsuite: Cosmetics

See merge request GNOME/gtk!7124
2024-04-09 23:41:01 +00:00
Matthias Clasen
7b82dc7ac5 inspector: Show monitor resolution 2024-04-09 19:14:01 -04:00
Matthias Clasen
a63e9d38fb gdk: Add private convenience api
Add a function to get the monitor resolution.

We may use this information in the future to make font rendering
decisions.
2024-04-09 19:13:34 -04:00
Matthias Clasen
cc8db1805d gsk: Be safer against bad font options
Some combinations of hint-style and hint-metrics lead to bad glyph
placement in the glyph cache, so avoid them.
2024-04-09 19:12:49 -04:00
Matthias Clasen
948532f3c9 Deprecate gtk_widget_set/get_font_options
cairo font options are too low-level, and setting them directly
prevents us from doing smarter things for font rendering.
2024-04-09 19:12:41 -04:00
Matthias Clasen
8f39f8d827 testsuite: Add another test
This test checks that pango attributes can be specified in serialized
form.
2024-04-09 19:06:31 -04:00
Matthias Clasen
5e28c05121 testsuite: Cosmetics
Make the builder parser test less verbose.
2024-04-09 19:06:12 -04:00
Matthias Clasen
32d15a5858 Merge branch 'builder-gtkshortcutaction-warning' into 'main'
builder: Show warning for invalid action on GtkShortcut

See merge request GNOME/gtk!7121
2024-04-09 20:36:59 +00:00
Benjamin Otte
460eaac1f4 Merge branch 'wip/otte/for-main' into 'main'
vulkan: Handle generating mipmaps for 1x1 images

Closes #6553

See merge request GNOME/gtk!7073
2024-04-09 16:25:20 +00:00
Benjamin Otte
02d7817632 demo: Use get_fps() in fishbowl demo
Hopefully that leads to somewhat more reliable fps measurements
2024-04-09 17:39:36 +02:00
Benjamin Otte
3080e2974d gpu: ceil() offscreen size before generating offscreen
The goal is to generate an offscreen at 1x scale.
When not ceil()ing the numbers the offscreen code would do it *and*
adjust the scale accordingly, so we'd end up with something like a
1.01x scale.

And that would cause the code to reenter this codepath with the goal to
generate an offscreen at 1x scale.
And indeed, this would lead to infinite recursion.

Tests included.

Fixes #6553
2024-04-09 17:39:32 +02:00
Juliano de Souza Camargo
be9d98ed38 Update Brazilian Portuguese translation 2024-04-09 13:31:35 +00:00
Leônidas Araújo
944274bc58 Update Brazilian Portuguese translation
(cherry picked from commit 235388fdcd)
2024-04-09 13:26:40 +00:00
Sabri Ünal
b555e909c4 Update Turkish translation 2024-04-09 09:55:55 +00:00
Matthijs Velsink
c0b813940e 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 02:41:57 +02:00
Benjamin Otte
9fe9ea34fd vulkan: Handle generating mipmaps for 1x1 images
Testcase included.
2024-04-08 21:06:54 +02:00
Hansem Ro
d90dc7f75e xi2: Fix incorrect input source type in Input debug message
This drops cursor and eraser source names to account for their removal
from GdkInputSource so that GDK_DEBUG=input debug message correctly
prints source type in X11 environment.

Fixes: c1d90273 ("gdk: Drop GDK_SOURCE_ERASER")
Fixes: 3285f52d ("gdk: Drop GDK_SOURCE_CURSOR")
Closes: #6619
2024-04-08 10:15:00 -07:00
Matthias Clasen
f36f1b9829 Merge branch 'dmabuf-glarea' into 'main'
One approach to dmabufs in glarea

See merge request GNOME/gtk!7116
2024-04-07 17:24:33 +00:00
Matthias Clasen
2b09f5ea1e dmabuf: Reshuffle docs slightly
Move related parts together, for easier understanding.
2024-04-07 13:03:13 -04:00
Matthias Clasen
f51c82a2aa gtk-demo: Use offload for shadertoy
This is an easy way to verify that GtkGLArea delivers dmabufs
now, and it might have some practical uses to offload gl area.
2024-04-07 13:03:13 -04:00
Matthias Clasen
11d3be278d glarea: Return dmabuf textures
Export the GL texture as a dmabuf if we can, and provide the
texture in that form.
2024-04-07 13:03:13 -04:00
Benjamin Otte
cc98282caa Merge branch 'shortcutmanager-fix-phase-changes' into 'main'
shortcutmanager: Handle propagation phase changes of added controllers

Closes #6246

See merge request GNOME/gtk!7115
2024-04-07 15:45:51 +00:00
Matthias Clasen
85f2e1ccd8 Add gdk_dmabuf_texture_builder_set_dmabuf
Private utility api.
2024-04-07 11:12:13 -04:00
Matthias Clasen
91b98bc9e2 Add a private header
Just cosmetic reshuffling.
2024-04-07 11:12:13 -04:00
Matthias Clasen
704ee6a9d0 offload: Determine output transforms
When we look for the texture to attach to the subsurface, keep
track of transforms we see along the way, and look at their scale
component to determine if the texture needs to be flipped.
We currently don't allow rotations here.

This fixes glarea rendering being upside-down when offloaded.
2024-04-07 11:12:06 -04:00
Matthias Clasen
72e9f30937 subsurface: Add transforms
Allow to specify a D₂ transform when attaching a texture to a
subsurface, to handle flipped and rotated content. The Wayland
implementation handles these transforms by setting a buffer
transform on the subsurface.

All callers have been updated to pass GDK_TEXTURE_TRANSFORM_NORMAL.
2024-04-07 11:02:40 -04:00
Matthijs Velsink
aadaf4adf2 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-07 16:29:08 +02:00
Yaron Shahrabani
d83ad6b505 Update Hebrew translation
(cherry picked from commit b19247e4ef)
2024-04-06 13:19:11 +00:00
Piotr Drąg
b647d1a58c Update Polish translation 2024-04-06 12:32:39 +02:00
Luca Bacci
3c94e91e5e GdkWin32: Do not clear surface contents when restoring from minimize
The code does not work anyway since we dropped WS_EX_LAYERED windows.
2024-04-06 10:58:40 +02:00
Luca Bacci
8a1bee1d79 GdkWin32: Don't explicitly set the transient owner as active
...when a transient child is hidden.

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

We can now revert 2cc650ce as well.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/6614
2024-04-06 10:44:02 +02:00
Danial Behzadi
68cff3b108 Update Persian translation
(cherry picked from commit 58d48cd3e5)
2024-04-05 12:40:53 +00:00
Matthias Clasen
84846aace7 Merge branch 'matthiasc/for-main' into 'main'
wayland: Work around mutter deficiences

See merge request GNOME/gtk!7112
2024-04-05 09:47:34 +00:00
Athmane MOKRAOUI
7bd93730d1 Update Kabyle translation 2024-04-05 09:16:50 +00:00
Matthias Clasen
c5d05fdc88 wayland: Work around mutter deficiences
Add the environment variable NO_POINTER_VIEWPORT to force the use
of buffer scale for pointer surfaces. This is a temporary workaround
for https://gitlab.gnome.org/GNOME/mutter/-/issues/2633.
2024-04-05 11:13:24 +02:00
Asier Sarasua Garmendia
f6ff2cd1cb Update Basque translation
(cherry picked from commit e54ecf5e32)
2024-04-05 08:43:42 +00:00
Matthias Clasen
9b0060e84d Merge branch 'matthiasc/for-main' into 'main'
Bump the cairo dep

See merge request GNOME/gtk!7110
2024-04-05 08:00:56 +00:00
Matthias Clasen
8d5633cb88 Drop code handling old cairo
We require cairo 1.18 now, so know that we will get subpixel
positioning for text, and have a little less uncertainty in
our font rendering.
2024-04-05 09:00:22 +02:00
Matthias Clasen
f74b1d48b6 Merge branch 'update-gtkswitch-state-docs' into 'main'
docs: Clarify state and active properties in GtkSwitch

Closes #6600

See merge request GNOME/gtk!7109
2024-04-05 06:57:16 +00:00
Matthias Clasen
27ebf756fe Bump the cairo dep
Require cairo 1.18, now that we have this stable release.
2024-04-05 08:01:39 +02:00
Dylan McCall
631da2e723 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-04 20:29:07 -07:00
Matthias Clasen
b5531d3d6f Merge branch 'michaelweghorn/a11y_atspi_getcharacterextents_getoffsetatpoint_fixes' into 'main'
a11y atspi: Misc fixes for AT-SPI Text methods GetCharacterExtents, GetRangeExtents and GetOffsetAtPoint

See merge request GNOME/gtk!7104
2024-04-04 22:28:50 +00:00
Martin
5e6bc41fdd Update Slovenian translation 2024-04-04 22:15:05 +00:00
Matthias Clasen
d0581af2af Merge branch 'matthiasc/for-main' into 'main'
printing: Add context to some strings

See merge request GNOME/gtk!7107
2024-04-04 16:15:30 +00:00
Artur S0
cec746804d Update Russian translation 2024-04-04 15:36:42 +00:00
Matthias Clasen
ade1aaa8be printing: Add context to some strings
The job priority strings need context to disambiguate them from
similar short strings elsewhere.
2024-04-04 16:56:50 +02:00
Matthias Clasen
345d23898d Merge branch 'matthiasc/for-main' into 'main'
Add context to some translatable strings

Closes #6609

See merge request GNOME/gtk!7105
2024-04-04 14:38:06 +00:00
Matthias Clasen
415717276a Merge branch 'fix-spinbutton-updates' into 'main'
Revert "spinbutton: Tangential refactoring, small fix"

Closes #6599

See merge request GNOME/gtk!7103
2024-04-04 13:27:56 +00:00
Matthias Clasen
cebe640bce Add context to some translatable strings
This was requested by Alexandre Franke.

Fixes: #6609
2024-04-04 15:25:07 +02:00
Emmanuele Bassi
73084b761f Apply code style fixes from review 2024-04-04 13:05:24 +00:00
Athmane MOKRAOUI
eb13ecfbe7 Update Kabyle translation 2024-04-04 12:13:23 +00:00
Matthias Clasen
85c4507609 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 14:11:10 +02:00
Matthias Clasen
fcb6c8e447 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 14:00:25 +02:00
Michael Weghorn
0b27f39c2b a11y atspi: Don't require GtkWidget for GetOffsetAtPoint
Use the existing `gtk_at_spi_translate_coordinates_to_accessible`
to translate the coordinates passed as parameters to AT-SPI
Text's GetOffsetAtPoint method instead of having a
custom GtkWidget-specific translation.

This makes this work for non-GtkWidget GtkAccessibles
as well, and also adds support for parent-relative
coordinates (ATSPI_COORD_TYPE_PARENT).
2024-04-04 13:53:49 +02:00
Michael Weghorn
2101f880af a11 atspi: Fix type for GetOffsetAtPoint result
With the fix from the previous commit in place,
trying to use the GetOffsetAtPoint AT-SPI Text method
from Accerciser's IPython console with the gtk4-demo
Hypertext example would still give this error:

    In [46]: acc.queryText().getCharacterExtents(5, pyatspi.XY_WINDOW)
    Out[46]: (58, 20, 5, 19)
    In [47]: acc.queryText().getOffsetAtPoint(59, 21, pyatspi.XY_WINDOW)
    ---------------------------------------------------------------------------
    Error                                     Traceback (most recent call last)
    Cell In[47], line 1
    ----> 1 acc.queryText().getOffsetAtPoint(59, 21, pyatspi.XY_WINDOW)

    File /usr/lib/python3/dist-packages/pyatspi/text.py:346, in Text.getOffsetAtPoint(self, x, y, coordType)
        331 def getOffsetAtPoint(self, x, y, coordType):
        332         """
        333         Get the offset of the character at a given onscreen coordinate.
        334         The coordinate system used to interpret x and y is determined
       (...)
        344         -1 if the point is outside the bounds of any glyph.
        345         """
    --> 346         return Atspi.Text.get_offset_at_point(self.obj, x, y, coordType)

    Error: atspi_error: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken. (1)

and the gtk4-demo output would show the actual problem:

    (gtk4-demo:563491): GLib-GIO-WARNING **: 13:18:27.652: Type of return value is incorrect: expected '(i)', got '(u)'

Fix this by returning an int as expected.

With this in place, the result is now as expected:

    In [48]: acc.queryText().getCharacterExtents(5, pyatspi.XY_WINDOW)
    Out[48]: (58, 20, 5, 19)
    In [49]: acc.queryText().getOffsetAtPoint(59, 21, pyatspi.XY_WINDOW)
    Out[49]: 5
2024-04-04 13:52:28 +02:00
Michael Weghorn
2cc241732d a11y atspi: Fix input variant type for Text's GetOffsetAtPoint
Trying to use the AT-SPI Text GetOffsetAtPoint method
didn't work.

For example, trying to use it from Accerciser's IPython
console with the gtk4-demo Hypertext example, would
give this error:

    In [45]: acc.queryText().getOffsetAtPoint(59, 21, pyatspi.XY_WINDOW)
    ---------------------------------------------------------------------------
    Error                                     Traceback (most recent call last)
    Cell In[45], line 1
    ----> 1 acc.queryText().getOffsetAtPoint(59, 21, pyatspi.XY_WINDOW)

    File /usr/lib/python3/dist-packages/pyatspi/text.py:346, in Text.getOffsetAtPoint(self, x, y, coordType)
        331 def getOffsetAtPoint(self, x, y, coordType):
        332         """
        333         Get the offset of the character at a given onscreen coordinate.
        334         The coordinate system used to interpret x and y is determined
       (...)
        344         -1 if the point is outside the bounds of any glyph.
        345         """
    --> 346         return Atspi.Text.get_offset_at_point(self.obj, x, y, coordType)

    Error: atspi_error: Unsupported coordinate space (1)

and the gtk4-demo output would show the actual problem:

    (gtk4-demo:562820): GLib-CRITICAL **: 13:14:10.862: the GVariant format string '(i&s)' has a type of '(is)' but the given value has a type of '(iiu)'

    (gtk4-demo:562820): GLib-CRITICAL **: 13:14:10.863: g_variant_get: assertion 'valid_format_string (format_string, TRUE, value)' failed

Specify the proper type, which gets us one step further at least.
2024-04-04 13:50:13 +02:00
Michael Weghorn
c01782b0a9 a11y atspi: Reuse helper to translate text coords
Instead of reimplementing translating coordinates
relative to a GtkAccessible in a way that requires
that the GtkAccessible is a GtkWidget, reuse the
existing helper function
`gtk_at_spi_translate_coordinates_from_accessible`
in the implementations of AT-SPI Text methods
GetCharacterExtents and GetRangeExtents.

This makes the implementation work for non-GtkWidget
GtkAccessibles, adds support for parent-relative
coordinates (ATSPI_COORD_TYPE_PARENT)
and also fixes an issue with incorrect extents
being reported in a quick test with the "Hypertext"
sample from gtk4-demo.

Sample for querying extents in Accerciser's IPython
console for the Hypertext sample previously gave this
result:

    In [39]: acc.queryText().getCharacterExtents(5, pyatspi.XY_WINDOW)
    Out[39]: (58, 20, -53, -1)

Now, a positive width and height are returned as expected and
the result matches the one when using the GTK 3 version
in gtk3-demo:

    In [1]: acc.queryText().getCharacterExtents(5, pyatspi.XY_WINDOW)
    Out[1]: (58, 20, 5, 19)
2024-04-04 13:50:13 +02:00
Michael Weghorn
a62831562f a11y atspi: Move helpers for coord translation to gtkatspiutils
Move the (so far) local helper functions used for the
AT-SPI Component method implementations,
`translate_coordinates_from_accessible` and
`translate_coordinates_to_accessible` to
`gtkatspiutilsprivate` and add a "gtk_at_spi_"
prefix to the function names.

This will allow to reuse them elsewhere in
upcoming commits.
2024-04-04 13:50:06 +02:00
Matthias Clasen
40dd81e1a4 Merge branch 'drop-redundant-a11y-code' into 'main'
a11y: Drop the per-widget text implementations

See merge request GNOME/gtk!6924
2024-04-04 10:03:15 +00:00
Matthias Clasen
a9f3a52c18 Drop some per-widget a11y text implementations
We still keep the editable implementation, since not all our
editable widgets implement GtkAccessibleText yet, but the label,
inscription and textview implementations are unused.
2024-04-04 10:14:46 +02:00
Matthias Clasen
0978912922 Merge branch 'macos-color-picker' into 'main'
macos: color picker

Closes #5137

See merge request GNOME/gtk!7099
2024-04-04 06:56:08 +00:00
Matthias Clasen
3c9923d395 Merge branch 'a11y-text-work' into 'main'
a11y: Implement GetOffsetAtPoint

See merge request GNOME/gtk!7004
2024-04-04 05:31:17 +00:00
Matthias Clasen
0296f49eb0 Merge branch 'dynamic-cursor' into 'main'
gdk: Add dynamic cursors

See merge request GNOME/gtk!7067
2024-04-04 05:30:54 +00:00
Matthias Clasen
4b7a550366 Merge branch 'bump-pango-dep' into 'main'
Bump the pango dep

Closes #6554

See merge request GNOME/gtk!7100
2024-04-04 05:29:56 +00:00
Matthias Clasen
37e18b784e gtk-demo: Add a callback cursor
Make one of the GTK logo cursors in the cursors demo use a callback
cursor that follows the cursor theme size, to show that that is
possible.
2024-04-04 01:07:28 +02:00
Matthias Clasen
1275a2cb8d wayland: Use a viewport for pointer surfaces
This should give us more flexibility for buffer size vs surface
size.

Unfortunately, mutter doesn't play along currently, so this is
only useful for kwin, weston or sway.
2024-04-04 01:07:28 +02:00
Matthias Clasen
67a6f343a0 wayland: Keep pointer_output_scale as double
We can round up to the next integer when we need to.
2024-04-04 01:07:28 +02:00
Matthias Clasen
a98e6bff85 Add a test app
This app has a dynamic cursor that is the GTK logo, loaded from
an SVG to make it come out at the nominal size of the cursor
theme, while taking fractional scaling into account.
2024-04-04 01:07:28 +02:00
Matthias Clasen
d0f5644771 macos: Handle callback cursors
This implementation matches the X11 one closely.
2024-04-04 01:07:28 +02:00
Matthias Clasen
b1a3ac8330 win32: Handle callback cursors
This implementation matches the X11 one closely.
2024-04-04 01:07:28 +02:00
Matthias Clasen
80811069ac x11: Handle callback cursors
For these cursors, get the texture for the cursor image by
calling the callback. We always use scale 1.
2024-04-04 01:07:28 +02:00
Matthias Clasen
6e3dc1e669 wayland: Handle callback cursors
For these cursors, get the texture for the cursor image by
calling the callback. We don't do any caching of the cursor
images for now.
2024-04-04 01:07:28 +02:00
Matthias Clasen
d1aa0a74e4 gdk: Add callback cursors
Add a variant of GdkCursor that obtains the texture for the cursor
via a callback. The callback gives us the flexibility to handle
fractional scales and update the cursor for cursor theme size
changes as well as scale changes.
2024-04-04 01:07:28 +02:00
Matthias Clasen
7a6fb09179 inscription: Add tests for gtk_accessible_text_get_offset
Test that we get the expected values on an inscription.
2024-04-04 01:05:38 +02:00
Matthias Clasen
5732c5e3d0 label: Add tests for gtk_accessible_text_get_offset
Test that we get the expected values on a label.
2024-04-04 01:05:38 +02:00
Matthias Clasen
79fb3d9b0c textview: Implement gtk_accessible_text_get_offset
This is relatively straightforward, reusing existing infrastructure.
2024-04-04 01:05:31 +02:00
Matthias Clasen
17455054f1 text: Implement gtk_accessible_text_get_offset
Reusing existing infrastructure as much as possible.
2024-04-04 01:04:47 +02:00
Matthias Clasen
763f51cb98 inscription: Implement gtk_accessible_text_get_offset
This is copying the corresponding code from GtkLabel.
2024-04-04 01:04:13 +02:00
Matthias Clasen
9fb78603ec label: Implement gtk_accessible_text_get_offset
We can reuse existing infrastructure for this.
2024-04-04 01:03:33 +02:00
Matthias Clasen
f802be88e9 a11y: Use gtk_accessible_text_get_offset
Implement GetOffsetAtPoint using gtk_accessible_text_get_offset.
2024-04-04 01:02:42 +02:00
Matthias Clasen
b9d2049991 a11y: Add gtk_accessible_text_get_offset
This is not implemented yet.
2024-04-04 01:02:41 +02:00
Matthias Clasen
cfe3558610 a11y: Add GetOffsetAtPoint
We don't handle it yet.
2024-04-04 01:00:25 +02:00
Matthias Clasen
35d15de3b6 label: Fix provider info lifecycle
This is a follow-up fix to a48df87a85, which was insufficient.
2024-04-04 01:00:25 +02:00
Matthias Clasen
23a336df0e Bump the pango dep
Require pango 1.52, and drop the fallback code.

Fixes: #6554
2024-04-04 00:56:24 +02:00
Matthias Clasen
bacdc735a4 Merge branch 'a11y-text-work2' into 'main'
a11y: Add gtk_accessible_text_get_extents

See merge request GNOME/gtk!7006
2024-04-03 22:55:30 +00:00
Matthias Clasen
19a168446e textview: Implement gtk_accessible_text_get_extents
There is some question if this needs to be clipped to widget extents
- if the textview is in a scrolled window, we can easily return
extents here that go beyond the window or event the screen.
2024-04-04 00:29:24 +02:00
Matthias Clasen
47ec7bc66d text: Implement gtk_accessible_text_get_extents
Using existing infrastructure.
2024-04-04 00:29:24 +02:00
Matthias Clasen
b4178870dd inscription: Implement gtk_accessible_text_get_extents
Using existing infrastructure.
2024-04-04 00:29:24 +02:00
Matthias Clasen
03ef792802 label: Implement gtk_accessible_text_get_extents
Using existing infrastructure.
2024-04-04 00:29:24 +02:00
Matthias Clasen
7955efef6c atspi: Use gtk_accessible_text_get_extents
Implement the GetCharacterExtents and GetRangeExtents methods of
the atspi Text interface using the new GtkAccessibleText api.
2024-04-04 00:29:24 +02:00
Matthias Clasen
3134003376 a11y: Add gtk_accessible_text_get_extents
This will be used to implement GetRangeExtents in atspi.
2024-04-04 00:29:24 +02:00
Matthias Clasen
a508860d1f Merge branch 'matthiasc/for-main' into 'main'
Start 4.15 development

See merge request GNOME/gtk!7098
2024-04-03 22:04:11 +00:00
Arjan Molenaar
c835ca41e0 macos: Pick color with NSColorSampler
NSColorSampler is the easiest way to pick a color.
It does require macOS 10.15+ to work.
2024-04-03 21:10:20 +02:00
Arjan Molenaar
2d5eafd014 macos: Add skeleton for color picker 2024-04-03 21:01:24 +02:00
Matthias Clasen
9b34878208 Merge branch 'cursor-demo-cosmetics' into 'main'
gtk-demo: Cosmetic changes

See merge request GNOME/gtk!7068
2024-04-03 14:08:38 +00:00
Matthias Clasen
4b1b956d27 Start 4.15 development 2024-04-03 15:53:49 +02:00
Matthias Clasen
0dd58c4d1b gtk-demo: Cosmetic changes
Remove the periods from the tooltips in the cursor demo.
Tooltips are better without periods.
2024-04-03 14:39:51 +02:00
Matthias Clasen
4b2b6d6212 Merge branch 'matthiasc/for-main' into 'main'
Post-release version bump

See merge request GNOME/gtk!7097
2024-04-03 12:23:07 +00:00
Matthias Clasen
2cdb53d524 Post-release version bump 2024-04-03 14:19:31 +02:00
Matthias Clasen
4f7721e742 Merge branch 'matthiasc/for-main' into 'main'
4.14.2

See merge request GNOME/gtk!7096
2024-04-03 12:18:20 +00:00
Matthias Clasen
29c29b0e64 4.14.2 2024-04-03 12:20:34 +02:00
Matthias Clasen
3d7fc0a598 Merge branch 'cff-font-hinting' into 'main'
gsk: Use hinted extents

Closes #6577 and #6568

See merge request GNOME/gtk!7086
2024-04-03 10:12:47 +00:00
Matthias Clasen
9e3e0052dc Merge branch 'fix_accessible_text_changed_notifications' into 'main'
a11y: Provide correct end offset for GtkText text insertions

Closes libadwaita#824

See merge request GNOME/gtk!7075
2024-04-03 09:37:52 +00:00
Yaron Shahrabani
5ecfcaec0d Update Hebrew translation 2024-04-03 09:13:56 +00:00
Matthias Clasen
cc24401dfb Drop unused private API
We are not using gsk_get_unhinted_glyph_string_extents anymore.
2024-04-03 10:53:55 +02:00
Matthias Clasen
f445d8b518 gsk: Use hinted extents
This works better for cff fonts, where hinting is not as local as
what the autohinter does for ttf fonts, and it does not seem to
have negative effects.

Fixes: #6577
Fixes: #6568
2024-04-03 10:52:13 +02:00
Carlos Garnacho
af4c9ea61e Merge branch 'provide-touch-serial-later' into 'main'
gdk/wayland: Proivde latest touch serial even after a touch ended

See merge request GNOME/gtk!5782
2024-04-03 08:43:03 +00:00
Matthias Clasen
4a75c288b2 Merge branch 'cff-font-hinting2' into 'main'
gsk: Keep metrics hinting on when rendering

See merge request GNOME/gtk!7093
2024-04-02 08:48:07 +00:00
Andre Klapper
89fca57e68 Docs / README: Fix issue tracker URL
Link to public Issues overview page instead of a 404 New Issue page
when you are not already logged into GNOME GitLab.
2024-04-02 10:10:11 +02:00
Matthias Clasen
d50b780551 gsk: Keep metrics hinting on when rendering
It turns out that we mispositioned glyphs with some cff fonts
when metrics hinting is off, and hinting is on. Since we don't
fully understand the interactions of these settings at this point,
lets preserve metrics hinting as it was on the font we got.

This at least gives folks a workaround for when they experience
clipped rendering with cff fonts: Turn on hint-metrics.

We forced hint metrics off here because it made Pango do some
creative wfh for hex boxes at small sizes, but I've dropped that
on the Pango side.
2024-04-02 09:10:46 +02:00
Matthias Clasen
f4a8787219 Merge branch 'empty-settings-portal' into 'main'
wayland: Fix detection of empty settings portal response

See merge request GNOME/gtk!7090
2024-04-02 06:44:08 +00:00
Chris Williams
979d0f4b1d wayland: Fix detection of empty settings portal response
The ReadAll method returns a one-element tuple, so
g_variant_n_children() is always 1.
2024-04-01 10:33:00 -04:00
Matthias Clasen
5af7c7d0f2 Merge branch 'matthiasc/for-main' into 'main'
ci: Avoid silly date-dependent failures

See merge request GNOME/gtk!7088
2024-03-31 13:59:11 +00:00
Matthias Clasen
90aff59826 Merge branch 'no-fc-build' into 'main'
Fix build without fontconfig

Closes #6591

See merge request GNOME/gtk!7087
2024-03-31 13:58:21 +00:00
Matthias Clasen
f0f3ea1b3e Fix build without fontconfig
We were missing some ifdefs for Windows builds.

Fixes: #6591
2024-03-31 13:08:01 +02:00
Matthias Clasen
f4b7f5de2f ci: Avoid silly date-dependent failures
GtkCalendar defaults to the current date, and things get murky
if the current day is number 30 or 31 in a month. Avoid these
problems.
2024-03-31 09:57:50 +02:00
Danial Behzadi
ca5af396b0 Update Persian translation 2024-03-30 20:31:19 +00:00
Ekaterine Papava
9f56be3551 Update Georgian translation 2024-03-30 18:26:28 +00:00
Martin
389f41ead7 Update Slovenian translation 2024-03-30 17:03:18 +00:00
Yuri Chornoivan
62108f8c30 Update Ukrainian translation 2024-03-30 09:27:21 +00:00
Matthias Clasen
d3206f9b67 Merge branch 'inspector-font-settings' into 'main'
inspector: Add font settings

See merge request GNOME/gtk!7085
2024-03-30 09:14:59 +00:00
Emmanuele Bassi
9b81f4cc31 Merge branch 'ebassi/doc-fixes' into 'main'
docs: Fix the reference link

See merge request GNOME/gtk!7084
2024-03-29 14:56:41 +00:00
Matthias Clasen
a864084a4e inspector: Add font settings
Add dedicated UI for font-related settings.

This makes debugging font rendering easier.
2024-03-29 15:55:36 +01:00
Matthias Clasen
ba44464d2a inspector: Cosmetics
Line up the scale+entry rows better.
2024-03-29 15:55:36 +01:00
Emmanuele Bassi
9509876f10 docs: Fix the reference link 2024-03-29 13:31:36 +00:00
Matthias Clasen
f79549f5fc Merge branch 'typo-fix' into 'main'
docs: Corrected typo on gtkDirectoryList description

See merge request GNOME/gtk!7083
2024-03-29 06:47:37 +00:00
maxrdz
bfb451ff4d docs: Corrected typo on gtkDirectoryList description 2024-03-28 22:56:18 -07:00
Benjamin Otte
edfbfb2ba7 Merge branch 'wip/otte/msys-build' into 'main'
Fix msys CI build

Closes #6580

See merge request GNOME/gtk!7082
2024-03-28 20:50:24 +00:00
Benjamin Otte
6aa37a116d build: Install vulkan-headers on msys CI
Apparently those are 2 packages.

Fixes #6580
2024-03-28 21:09:44 +01:00
Benjamin Otte
a34c018592 build: Use "meson setup" instead of just "meson"
Gets rid of a warning.
2024-03-28 21:09:44 +01:00
Benjamin Otte
710d8b948b build: Remove stray file
How did that one get here?
2024-03-28 21:09:44 +01:00
Benjamin Otte
3df85581d5 Merge branch 'wip/otte/6582' into 'main'
wayland: On hide, remove frame callbacks from subsurfaces

Closes #6582

See merge request GNOME/gtk!7081
2024-03-28 19:59:29 +00:00
Benjamin Otte
91e3bc4496 wayland: On hide, remove frame callbacks from subsurfaces
Fixes subsurfaces receiving frame callbacks while the surface is hidden
or already destroyed.

Fixes #6582
2024-03-28 20:29:06 +01:00
Sabri Ünal
1f5df481a5 Update Turkish translation 2024-03-28 14:35:29 +00:00
Matthias Clasen
768522ce7f Merge branch 'matthiasc/for-main' into 'main'
icontheme: Trust the compiler

See merge request GNOME/gtk!7076
2024-03-28 00:02:50 +00:00
Benjamin Otte
5f4e5db91b Merge branch 'gtklistitemwidget-focus' into 'main'
gtk: Fix GtkListItemWidget focus chain

Closes #6340

See merge request GNOME/gtk!6777
2024-03-27 21:35:56 +00:00
Matthias Clasen
c5f73cb406 Tweak the eglconfig description once more
Just always print the depth and stencil buffer depth,
for maximum clarity.
2024-03-27 16:30:27 +01:00
Lukáš Tyrychtr
86c4a9b3bd a11y: Provide correct end offset for GtkText text insertions
Fixes libadwaita#824
2024-03-27 16:24:32 +01:00
Matthias Clasen
fb915dc8da NEWS: Updates 2024-03-27 14:18:16 +01:00
Matthias Clasen
7a2569be14 icontheme: Trust the compiler
Just trust the compiler to replace strlen (literal) by the length.
2024-03-27 14:18:16 +01:00
Athmane MOKRAOUI
b1eed1c153 Add Kabyle translation 2024-03-26 11:34:22 +00:00
Martin
fac6f6c712 Update Slovenian translation 2024-03-24 23:19:54 +00:00
Martin
3f1fc798f0 Update Slovenian translation 2024-03-24 23:17:49 +00:00
Luca Bacci
e6a86f61dc Merge branch 'fix-issue-3749' into 'main'
GdkWin32: Always set WS_MINIMIZEBOX on GdkToplevel

Closes #3749

See merge request GNOME/gtk!7072
2024-03-22 17:57:06 +00:00
Matthias Clasen
2799632c02 Merge branch 'scalefix' into 'main'
GtkScale: improving symmetry and value positioning

Closes #5171

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

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3749
2024-03-22 16:47:59 +01:00
Matthias Clasen
154035e76f Merge branch 'entry-progress' into 'main'
theme: Make sure progress in entries is visible

Closes #6201

See merge request GNOME/gtk!7071
2024-03-22 15:00:48 +00:00
Matthias Clasen
1d4c664bfa theme: Make sure progress in entries is visible
Give the trough a min height, so it doesn't shrink to nothing.

Fixes: #6201
2024-03-22 09:34:11 -04:00
Matthias Clasen
85a650afce Merge branch 'dnd-cursor-malaise' into 'main'
wayland: Guarantee dnd-move as a cursor name

See merge request GNOME/gtk!7070
2024-03-22 02:15:32 +00:00
Matthias Clasen
f6c4d3731c dnd: Go back to using dnd-move as move cursor
The move cursor in Adwaita is stuck with the 4-headed arrow image
which isn't suitable for a dnd cursor.

See https://gitlab.gnome.org/GNOME/adwaita-icon-theme/-/issues/286
2024-03-21 21:36:38 -04:00
Matthias Clasen
5e9070145e wayland: Guarantee dnd-move as a cursor name
We need to go back to using this, since move is widely abused
and thus can't change its image to one thats appropriate for dnd.
2024-03-21 21:35:45 -04:00
Matthias Clasen
81ced841dd Merge branch 'matthiasc/for-main' into 'main'
inspector: Show presentation time protocol

See merge request GNOME/gtk!7069
2024-03-21 12:35:33 +00:00
Matthias Clasen
9837a9dcfd inspector: Show presentation time protocol
We have a list of all the used Wayland protocols and their versions
in the inspector. Lets keep it up-to-date.
2024-03-21 07:29:58 -04:00
Matthias Clasen
1704ec3c7d Merge branch 'wip/chergert/presentation-time' into 'main'
gdk/wayland: implement client side of presentation-time

See merge request GNOME/gtk!6987
2024-03-21 11:28:19 +00:00
Matthias Clasen
c70a326055 Merge branch 'matthiasc/for-main' into 'main'
Sync cursor images with Adwaita

See merge request GNOME/gtk!7065
2024-03-21 02:37:35 +00:00
Christian Hergert
53616a73e9 gdk/wayland: use wp_presentation for more accurate frame timings
This attempts to improve the accuracy for the "presentation_time" of an
individual GdkFrameTimings. That information is currently filled in as soon
as we get a frame callback. However, if presentation-time wayland protocol
is available, that will be used to supliment a more accurate time which
may improve future presentation-time predictions within GdkFrameClockIdle.

The protocol states that all related and sub surfaces will receive the
same information so it is safe that this could be registered for more
than just the toplevel. The information becomes idempotent.
2024-03-20 14:45:58 -07:00
Jordan Petridis
2d3a3d6a78 Merge branch 'alatiera/ci-vulkan' into 'main'
flatpak-build.sh: Do not disable vulkan

See merge request GNOME/gtk!7066
2024-03-20 20:15:54 +00:00
Jordan Petridis
6ca9e5987b flatpak-build.sh: Do not disable vulkan
In a94d7abf0d we removed
the explicit disable from the manifest.

Now we should also have the CI build the vulkan render as well.
2024-03-20 21:18:13 +02:00
Matthias Clasen
2c1590001f Sync cursor images with Adwaita
Several cursor metaphors were changes in Adwaita. Update our docs
and the Cursors demo to match.
2024-03-20 13:19:12 -04:00
Matthias Clasen
82aee038e9 Merge branch 'alatiera/ci-vulkan' into 'main'
flatpak demos: Enable vulkan backend

See merge request GNOME/gtk!7064
2024-03-20 14:46:04 +00:00
Jordan Petridis
a94d7abf0d flatpak demos: Enable vulkan backend
glslc is now in the Sdk itself

https://gitlab.gnome.org/GNOME/gnome-build-meta/-/merge_requests/2640
2024-03-20 15:47:42 +02:00
Matthias Clasen
3b87903889 Merge branch 'wayland-min-version' into 'main'
wayland: Check some required globals

See merge request GNOME/gtk!7062
2024-03-20 02:57:06 +00:00
Matthias Clasen
191f826075 wayland: Only set buffer scale if we can
We check this in some other places, so be consistent.
2024-03-19 22:22:53 -04:00
Matthias Clasen
5d52c43074 wayland: Check all required globals for subsurfaces
Before trying to use subsurfaces, make sure we have both
a subcompositor and a viewporter.
2024-03-19 22:22:53 -04:00
Matthias Clasen
f6a67aeb20 wayland: Check some required globals
This may be largely cosmetics, since these are core protocols that
are unlikely to ever be missing. But lets check anyway.
2024-03-19 17:28:25 -04:00
Jordi Mas
370e2f0940 Update Catalan translation 2024-03-19 21:37:20 +01:00
Alexandre Franke
2ec9fc26d3 Update French translation 2024-03-19 13:06:37 +00:00
Matthias Clasen
c2d898d462 Merge branch 'fix-macos-typo' into 'main'
quartz: Fix a crash

See merge request GNOME/gtk!7059
2024-03-19 03:11:58 +00:00
Matthias Clasen
7c04231255 Merge branch 'macos-remove-shadows' into 'main'
macos: Drop shadow related code from macos backend

See merge request GNOME/gtk!7048
2024-03-19 02:38:38 +00:00
Arjan Molenaar
08216dcee9 macos: Drop shadow related code from macos backend 2024-03-19 02:38:37 +00:00
Matthias Clasen
9817df12ff quartz: Fix a crash
This was an oversight in 816f8807a3.
2024-03-18 21:51:24 -04:00
Matthias Clasen
5b0e8eb574 Merge branch 'fix-macos-typo' into 'main'
macos: Fix a typo in the appmenu handling code

See merge request GNOME/gtk!7055
2024-03-19 01:49:08 +00:00
Matthias Clasen
cecde85faa Merge branch 'drag-cursor-tweak' into 'main'
dnd: Use the default cursor during motion

Closes #6337 and #6511

See merge request GNOME/gtk!7058
2024-03-19 01:46:35 +00:00
Matthias Clasen
aa95b4f341 dnd: Use the default cursor during motion
When no action is selected, use the default cursor, and only
switch to one of the action-indicating cursors when we are over
a drop target.

Fixes: #6337
Fixes: #6511
2024-03-18 21:17:55 -04:00
Matthias Clasen
816f8807a3 macos: Fix a typo in the appmenu handling code
We were using APP_DATA in one place, and APP_MENU in the other.
Just stop using object data for this.
2024-03-18 18:49:55 -04:00
Martin
26d3c407b3 Update Slovenian translation 2024-03-18 17:36:52 +00:00
Matthias Clasen
a973e8ea8d Merge branch 'gl-offload-fixes' into 'main'
gl: Handle offloads in offscreen context better

Closes #6551

See merge request GNOME/gtk!7053
2024-03-18 15:22:22 +00:00
Matthias Clasen
b007597c58 Merge branch 'macos-application-demo' into 'main'
Revert "macos: fix weird menubar rendering."

Closes #6524

See merge request GNOME/gtk!7052
2024-03-18 14:40:45 +00:00
Matthias Clasen
1e83a44c93 gl: Handle offloads in offscreen context better
Back out of offloading below if we are in an offscreen context,
since the hole will get lost in the offscreen.

Fixes: #6551
2024-03-18 08:41:31 -04:00
Matthias Clasen
e1406d2e95 Merge branch 'matthiasc/for-main' into 'main'
gsk: Avoid some allocations

See merge request GNOME/gtk!7047
2024-03-18 12:26:37 +00:00
Matthias Clasen
259ad83de9 macos: Fix up app menu support
We were forgetting to add the newly loaded app menu to the
combined menubar. Pointed out by Dominik Reichardt in #6524.

Fixes: #6524
2024-03-18 07:50:30 -04:00
Daniel Rusek
2fe467983c Update Czech translation 2024-03-18 11:30:47 +00:00
Matthias Clasen
b4f5432d5a gtk4-demo: Clean up the application demo
This partially reverts ca1c570c21.
2024-03-17 22:29:22 -04:00
Matthias Clasen
4fe4523c49 Revert "macos: fix weird menubar rendering."
This reverts commit 75868dfee4.
2024-03-17 22:29:22 -04:00
Matthias Clasen
ee4a56ed4a settings: Mention the macOS implementation 2024-03-17 21:44:02 -04:00
Matthias Clasen
2408e227aa Add another xfail for clipped compare tests
These just keep happening.
2024-03-17 21:30:36 -04:00
Matthias Clasen
144cd2d91c gsk: Avoid some allocations
We can use a static font options object and allocate it only once.
2024-03-17 21:30:36 -04:00
Matthias Clasen
6abd9def55 Merge branch 'macos-popover-focus' into 'main'
macos: Fix IMContext for popovers

See merge request GNOME/gtk!7041
2024-03-17 16:55:52 +00:00
Martin
f5685cc0ae Update Slovenian translation 2024-03-17 10:28:21 +00:00
Martin
54bd03573e Update Slovenian translation 2024-03-17 10:26:36 +00:00
Matthias Clasen
bc81b33990 Merge branch 'matthiasc/for-main' into 'main'
Forgotten file

See merge request GNOME/gtk!7046
2024-03-17 03:05:56 +00:00
Matthias Clasen
de764d61ef Forgotten file 2024-03-16 22:26:22 -04:00
Matthias Clasen
68fa9bcf2e Merge branch 'matthiasc/for-main' into 'main'
4.14.1

See merge request GNOME/gtk!7045
2024-03-17 02:11:30 +00:00
Matthias Clasen
2f124bc712 Post-release version bump 2024-03-16 22:10:26 -04:00
Matthias Clasen
c648bb7b19 NEWS: Updates 2024-03-16 20:52:15 -04:00
Matthias Clasen
90956b15d9 docs: Small tweaks 2024-03-16 20:52:15 -04:00
Benjamin Otte
195ebf6848 Merge branch 'wip/otte/gl-map-buffer' into 'main'
Add GLBuffer implementation w/ persistent mapping

See merge request GNOME/gtk!7042
2024-03-17 00:27:51 +00:00
Benjamin Otte
0615b48318 Merge branch 'wip/otte/VYycQTm2HrM' into 'main'
gpu: Sort passes correctly

Closes #6318

See merge request GNOME/gtk!7044
2024-03-16 23:08:05 +00:00
Benjamin Otte
aff34e8d1b gpu: Sort passes correctly
In a very particular situation, it could happen that our renderpass
reordering did not work out.
Consider this nesting of renderpasses (indentation indicates subpasses):

pass A
  subpass of A
pass B
  subpass of B

Out reordering code would reorder this as:

subpass of B
subpass of A
pass A
pass B

Which doesn't sound too bad, the subpasses happen before the passes
after all.

However, a subpass might be a pass that converts the image for a texture
stored in the texture cache and then updates the cached image.
If "subpass of A" is such a pass *and* if "subpass of B" then renders
with exactly this texture, then "subpass of B" will use the result of
"subpass of A" as a source.

The fix is to ensure that subpasses stay ordered, too.

The new order moves subpasses right before their parent pass, so the
order of the example now looks like:

subpass of A
pass A
subpass of B
pass B

The place where this would happen most common was when drawing thumbnail
images in Nautilus, the GTK filechooser or Fractal.
Those images are usually PNG files, which are straight alpha. They are then
drawn with a drop shadow, which requires an offscreen for drawing as
well as those images as premultipled sources, so lots of subpasses happen.
If there is then a redraw with a somewhat tricky subregion, then the
slicing of the region code could end up generating 2 passes that each draw
half of the thumbnail image - the first pass drawing the top half and the
second pass drawing the bottom half.
And due to the bug the bottom half would then be drawn from the
offscreen before the actual contents of the offscreen would be drawn,
leading to a corrupt bottom part of the image.

Test included.

Fixes: #6318
2024-03-16 23:44:59 +01:00
Matthias Clasen
c05bb504ff Merge branch 'accessible-leaks' into 'main'
Fix leaks of GtkAccessible and GtkATContext

See merge request GNOME/gtk!7031
2024-03-16 21:39:43 +00:00
Benjamin Otte
47307dc7c1 vulkan: Prefer cached buffer memory
We write the buffers in small chunks, and we even sometimes read it. So
prefer it when it's cached.

Speeds up the text benchmarks by a factor of 3x on my dedicated GPU.
2024-03-16 22:32:49 +01:00
Matthias Clasen
16ea91c1fe Merge branch 'macos-fullscreen-resize' into 'main'
macos: Cleanup fullscreen state

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

This has 1 disadvantage:

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

But it has 2 advantages:

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

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

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

  tests/rendernode-create-tests 1000000 text.node

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

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

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

Related: !7021
2024-03-16 20:55:26 +01:00
Benjamin Otte
e7a2baf78c gpu: Remove unused arguments
It's not just unused, it's also wrong.

We are reading from the buffer when reallocating the vertex buffer
and memcpy()ing the old into the new buffer - at that point we read from
it.
2024-03-16 19:46:37 +01:00
Matthias Clasen
438d86fcf5 gsk: Move the buffer upload counter
Move the sysprof counter for buffer uploads to the generic
code, so it works for both ngl and Vulkan. This partially
reverts commit ecf1b7c18a.
2024-03-16 19:39:16 +01:00
Arjan Molenaar
4fd848c9de macos: Retrieve NSEvents based on event properties
We cannot depend on the exact event, since some events (e.g. for popups)
are rewritten. Therefore we need to determine the NSEvent based on
heuristics. The usual suspects are event type, device and timestamp.

This allows us to fix IMContext for popups.
2024-03-16 17:25:38 +01:00
Matthias Clasen
a23a7d4149 Merge branch 'maze-demo' into 'main'
demos: Make the maze demo non-resizable

Closes #6549

See merge request GNOME/gtk!7040
2024-03-16 14:41:27 +00:00
Matthias Clasen
1cbdf88b0f Merge branch 'debug-cleanup' into 'main'
gsk: Fix a typo

See merge request GNOME/gtk!7039
2024-03-16 14:41:16 +00:00
Benjamin Otte
0a0feef57d Merge branch 'wip/otte/gdk-gl-disable' into 'main'
Rework GL feature handling

See merge request GNOME/gtk!7038
2024-03-16 14:25:11 +00:00
Matthias Clasen
2701a2bfdd demos: Make the maze demo non-resizable
It isn't playable if the entrance/exit don't reach the edge
of the window.

Fixes: #6549
2024-03-16 10:08:37 -04:00
Benjamin Otte
2aea75f426 testsuite: Run the plain test without any args
Never do nothing.
2024-03-16 14:53:22 +01:00
Matthias Clasen
b1fb7cd4ae gsk: Drop unused debug flags
The 'surface', 'sync' and 'opengl' flags are not used anywhere.
2024-03-16 09:44:57 -04:00
Matthias Clasen
33ffe28236 docs: Clarify GSK_DEBUG=vulkan
Make it clearer what this debug flag does.
2024-03-16 09:44:57 -04:00
Matthias Clasen
fd90b56df6 gsk: Move and clarify a debug message
Move the only error message in the OPENGL category to RENDERER,
and make it clearer what and how.
2024-03-16 09:44:57 -04:00
Benjamin Otte
43373e6350 gpu: Rename env var GSK_GPU_SKIP to GSK_GPU_DISABLE
See previous commits.
2024-03-16 14:11:08 +01:00
Benjamin Otte
afd5ea53d8 vulkan: Rename env var from GDK_VULKAN_SKIP to GDK_VULKAN_DISABLE
It's a better name.
2024-03-16 14:03:36 +01:00
Benjamin Otte
f725bdad25 gl: Move GL_ARB_base_instance check
It's a GLContext feature check, not a GpuRenderer thing.

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

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

See merge request GNOME/gtk!7036
2024-03-16 09:43:06 +00:00
Matthias Clasen
cb374efb9a Merge branch 'matthiasc/for-main' into 'main'
gdk: Describe egl formats more precisely

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

Related: #6542
2024-03-15 21:52:23 -04:00
Matthias Clasen
6e132463f1 Merge branch 'matthiasc/for-main' into 'main'
glcontext: Don't call get_instance_private (NULL)

See merge request GNOME/gtk!7035
2024-03-15 21:59:49 +00:00
Arjan Molenaar
3f8f6f6792 macos: Let host determine window sizes
Clean up lastUnfullscreenFrame attribute, as we do not really
need it. The application knows what to resize to.
2024-03-15 21:55:44 +01:00
Benjamin Otte
93cdcc5e88 gpu: Merge multiple ops into one ShaderOp
When ops get allocated that use the same stats as the last op, put them
into the same ShaderOp. This reduces the number of ShaderOps we need to
record, which has 3 benefits:

1. It's less work when iterating over all the ops.
   This isn't a big win, but it makes submit() and print() run a bit
   faster.
2. We don't need to manage data per-op.
   This is a large win because we don't need to ref/unref descriptors
   as much anymore, and refcounting is visible on profiles.
3. We save memory.
   This is a pretty big win because we iterate over ops a lot, and when
   the array is large enough (I've managed to write testcases that makes
   it grow to over 4GB) it kills all the caches and that's bad.

The main benefit of all this are glyphs, which used to emit 1 ShaderOp
per glyph and can now end up with 1 ShaderOp for multiple text nodes,
even if those text nodes use different fonts or colors - because they
can all share the same ColorizeOp.
2024-03-15 20:25:02 +01:00
Matthias Clasen
d51912c0b4 gsk: Add gsk_gpu_frame_get_last_op
This function will be used in the future to find the previous
op during node processing, so we can make optimization decisions
based on that.
2024-03-15 20:25:02 +01:00
Benjamin Otte
bad6e1e102 gpu: Change the way we merge draw calls
With potentially multiple ops per ShaderOp, we may encounter situations
where 1 ShaderOp contains more ops than we want to merge. (With
GSK_GPU_SKIP=merge, we don't want to merge at all.)

So we still merge the ShaderOps (now unconditionally), but we then run
a loop that potentially splits the merged ops again - exactly at the
point we want to.

This way we can merge ops inside of ShaderOps and merge ShaderOps, but
still have the draw calls contain the exact number of ops we want.
2024-03-15 20:25:02 +01:00
Benjamin Otte
28a8dc5a14 gpu: Add GskGpuShaderOp.n_ops
This just introduces the variable and sets it to 1 everywhere.

The ultimate goal is to allow one ShaderOp to collect multiple ops into
one, thereby saving memory in the ops array and leading to faster
performance.
2024-03-15 19:49:17 +01:00
Benjamin Otte
975cdd8c30 gpu: Remove unused return value from function
Technically, an alloc() function should return what it allocated. But
the return value is never used.

Maybe we should rename the function?
2024-03-15 19:49:17 +01:00
Benjamin Otte
153b78e2bc gpu: Add a ShaderOp.print_instance vfunc
... and add gsk_shader_op_print() to do the generic stuff.
2024-03-15 19:49:17 +01:00
Benjamin Otte
de2b10e46c gpu: Set variable to NULL after freeing
Saw this while reviewing code.
2024-03-15 19:49:17 +01:00
Matthias Clasen
7cf4414f4a ci: Drop some unnecessary packages
We don't use at, at-spi or the docbook stylesheets.
2024-03-15 13:06:54 -04:00
Matthias Clasen
a9dfec8478 glcontext: Don't call get_instance_private (NULL)
ubsan does not like this.

See a9175e0c03 for a detailed explanation.
2024-03-15 13:06:34 -04:00
Matthias Clasen
60ddf7c421 Merge branch 'wip/smcv/no-zink-when-screen-scraping' into 'main'
testsuite: Force Mesa to use software GL when asserting about stderr

Closes #6478

See merge request GNOME/gtk!6949
2024-03-15 17:05:12 +00:00
Tim Sabsch
1922174c9f Update German translation 2024-03-14 20:36:56 +00:00
Changwoo Ryu
3c39c5259e Update Korean translation 2024-03-14 10:57:06 +00:00
Matthias Clasen
f5a6d93939 Merge branch 'wip/otte/who-framed-roger-rabbit' into 'main'
Don't reuse frames while they're in use

See merge request GNOME/gtk!7030
2024-03-14 10:21:34 +00:00
Benjamin Otte
30dddf2412 gpu: Refactor waiting for frames
Instead of having renderer API to wait for any number of frames, just
have gsk_gpu_frame_wait() to wait for a single frame.

This unifies behavior on Vulkan and GL, because unlike Vulkan, GL does
not allow waiting for multiple fences.

To make up for it, we replace waiting for multiple frames with finding
the frame with the earliest timestamp and waiting for that one.

Also implement wait() for GL.
2024-03-14 06:06:33 +01:00
Elliott Sales de Andrade
19a9215e4f Fix leaks of GtkAccessible and GtkATContext
These variables are all assigned from function calls that are transfer
full, so they need an unref.
2024-03-14 00:50:17 -04:00
Benjamin Otte
b43950d0f7 gpu: Don't reuse frames while they're in use
This copies the Vulkan idea of using a fence at the end of command
submission and waiting until it gets signaled before reusing the frame.

This frees up the GL driver from doing the work of making buffers etc
reusable and instead allocates new ones when they're still in use and is
a pretty massive performance win.
2024-03-14 04:53:12 +01:00
Matthias Clasen
6e5a183c98 Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Skip gl shader when necessary

Closes #6538

See merge request GNOME/gtk!7029
2024-03-14 01:29:32 +00:00
Matthias Clasen
d224110b48 gtk-demo: Skip the transitions demo when necessary
This demo uses GL shader nodes which only work with the GL renderer,
therefore skip the demo unless the GL renderer is in use.

Fixes: #6538
2024-03-13 21:02:17 -04:00
Matthias Clasen
8f356c2e8c gtk-demo: Skip gl shader when necessary
GL shader nodes only work with the GL renderer, therefore skip
the Shader in the list unless the GL renderer is in use.

Fixes: #6538
2024-03-13 21:02:10 -04:00
Matthias Clasen
139ed2c900 Merge branch 'textview-cursor-anchor' into 'main'
textview: Fix cursor/anchor mixup when retrieving surrounding text

Closes #6460

See merge request GNOME/gtk!6929
2024-03-14 00:07:41 +00:00
Matthias Clasen
32e21d5402 Merge branch 'speedup-inner-loop' into 'main'
Simplify our inner loop

See merge request GNOME/gtk!7026
2024-03-13 12:41:43 +00:00
Marek Kasik
fb3d8b8523 printing: Avoid accessing freed printers
Print backend can be disposed together with all its printers
as a reaction to user stopping enumeration of printers.
Adding a weak pointer help us to detect that the backend
was disposed and hence the backend and its printers should not
be used anymore.

Fixes #6265
2024-03-13 11:17:42 +01:00
Matthias Clasen
380523b41b gsk: Eschew more divisions
Pull out a pango_scale_inv constant, and use it.
2024-03-13 01:26:14 -04:00
Matthias Clasen
2fda256bb0 gsk: Avoid some unnecessary calls
Most of the time, the image we get for the glyphs will be the
same (the atlas), so avoid adding it to the descriptor set over
and over, and check first if have to. This matches what the
pattern variant of this function already does.
2024-03-13 01:03:32 -04:00
Matthias Clasen
c71a66b6f6 gsk: Simplify our inner loop
Pull out the if-else and precompute things before the loop.
2024-03-13 01:03:31 -04:00
Matthias Clasen
cb92778478 gsk: Drop the glyph-align flag
It wasn't doing anymore what it was designed for, and we are not
sure that we need it.
2024-03-13 01:00:49 -04:00
Matthias Clasen
ab67936a64 Merge branch 'matthiasc/for-main' into 'main'
Drop an unused header

See merge request GNOME/gtk!7025
2024-03-13 04:44:07 +00:00
Matthias Clasen
0ae2c1a8a7 Drop an unused header
This came in with a GskPath-related merge, but it isn't used
anywhere. So drop it for now.
2024-03-12 22:14:31 -04:00
Matthias Clasen
4e166f39fe Merge branch 'matthiasc/for-main' into 'main'
Some small fixes and improvements

See merge request GNOME/gtk!7022
2024-03-12 20:52:48 +00:00
Matthias Clasen
5f79958716 gsk: Simplify some code
Just initialize the rect directly. This matches better what the
pattern variant of this method does, and it also has the nice
side-effect of eliminating the handling of negative scales in
gsk_rect_scale, which we don't need here, since our scales are

always positive.
2024-03-12 16:13:42 -04:00
Matthias Clasen
aee0af34af filechooser: Assert that a string isn't NULL
It shouldn't ever be NULL, but lets make that explicit. since I've
been seeing crash reports that look like people are getting NULL
here.
2024-03-12 14:58:13 -04:00
Matthias Clasen
7e32eb2e98 entry: Add some tests for editable implementation
Test some of the editable api that is used in the filechooser
entry, since people are seeing crashes there.
2024-03-12 14:58:13 -04:00
Matthias Clasen
7ea7d5c390 Merge branch '6520_dont_drag_hidden_paned_handle' into 'main'
paned: don't claim drag-begin on invisible handle

Closes #6520

See merge request GNOME/gtk!7016
2024-03-12 15:46:53 +00:00
Matthias Clasen
e3e9dda429 Merge branch 'macos_ci' into 'main'
Maintenance update for macOS Intel CI

See merge request GNOME/gtk!7005
2024-03-12 15:45:59 +00:00
Matthias Clasen
a3ab25bf1d Merge branch 'wip/chergert/defer-cache-cleanup' into 'main'
gtk/textview: defer GtkTextLineDisplay finalization

See merge request GNOME/gtk!7019
2024-03-12 15:42:30 +00:00
Artur S0
095dec9238 Update Russian translation 2024-03-12 13:25:35 +00:00
Daniel Rusek
0e34365139 Update Czech translation 2024-03-12 12:40:43 +00:00
Matthias Clasen
88a62564f1 Merge branch 'matthiasc/for-main' into 'main'
Matthiasc/for main

See merge request GNOME/gtk!7020
2024-03-12 12:14:27 +00:00
Matthias Clasen
6ac94dc5c3 Post-release version bump 2024-03-12 08:12:52 -04:00
Matthias Clasen
5a9a0874bd 4.14.0 2024-03-12 07:52:13 -04:00
Matthias Clasen
91992111c3 Merge branch 'matthiasc/for-main' into 'main'
gsk: Rework font reloading again

See merge request GNOME/gtk!7018
2024-03-12 11:47:20 +00:00
Daniel Mustieles
120d874805 Update Spanish translation 2024-03-12 08:35:58 +00:00
Matthias Clasen
9454bad891 gsk: Rework font reloading again
Make a single gsk_reload_font helper that can tweak both
scale and font options, so we can ensure that our scaled
font has hint-metrics turned off (pango pays attention to
hint metrics when sizing and rendering hex boxes, and that
hurts us.
2024-03-12 00:45:14 -04:00
Christian Hergert
9cb410fd9b gtk/textview: defer GtkTextLineDisplay finalization
Defer the finalization of our GtkTextLineDisplay until we've completed
processing the current frame. Otherwise we risk doing additional work that
could cause us to miss our frame deadline.
2024-03-11 21:05:35 -07:00
Matthias Clasen
0f3fbed13c Merge branch 'wip/otte/for-main' into 'main'
Don't offscreen subsurface nodes

Closes #6499

See merge request GNOME/gtk!7009
2024-03-11 23:33:24 +00:00
Matthias Clasen
43ee9746bd Merge branch 'matthiasc/for-main' into 'main'
gsk: Avoid some roundf calls

See merge request GNOME/gtk!7017
2024-03-11 23:21:27 +00:00
Matthias Clasen
7283c5c22f gsk: Avoid some roundf calls
It seems that gcc has a hard time using intrinsics for round,
so help it out by using floor (x + .5).
2024-03-11 17:41:39 -04:00
Matthias Clasen
8b71fe4af6 Add an xfail for a rounded-clip test
This needs some changes in how we prevent offscreens from getting
too big. Filed as #6532.
2024-03-11 17:08:33 -04:00
René de Hesselle
b627fb5970 ci: Install ninja from wheel for Big Sur runner
This avoids building it on the Big Sur Intel runner (because of
Python 3.8) which would require us to provide cmake.
2024-03-11 21:30:37 +01:00
Matthias Clasen
be3ad1ef99 Merge branch 'wip/chergert/fix-6529' into 'main'
gtk/imcontext: fix ABI break via activate_osk_with_event

Closes #6529

See merge request GNOME/gtk!7015
2024-03-11 20:15:35 +00:00
g.willems
54264a9f78 paned: don't claim drag-begin on invisible handle
Paned handles are hidden when any of its children are hidden too,
but drag events were still accepted around the (virtual) handle position.

Instead, deny drag-begin when handle is hidden.

Fixes #6520
Closes #6520
2024-03-11 20:39:47 +01:00
Matthias Clasen
65380c66bd Merge branch 'matthiasc/for-main' into 'main'
label: Don't forget to clear select info

See merge request GNOME/gtk!7012
2024-03-11 19:35:51 +00:00
Matthias Clasen
8c96991ce0 Merge branch 'text-view-cursor-blink' into 'main'
textview: Match cursor blink behavior of GtkText

Closes #6515

See merge request GNOME/gtk!7014
2024-03-11 19:13:09 +00:00
Christian Hergert
07a44993ac gtk/imcontext: fix ABI break via activate_osk_with_event
Fixes #6529
2024-03-11 12:06:22 -07:00
Matthias Clasen
60d2d25463 Merge branch 'wip/public-activate-osk' into 'main'
gtkimcontext: Make gtk_im_context_activate_osk() public

See merge request GNOME/gtk!7013
2024-03-11 17:59:42 +00:00
Carlos Garnacho
907f99b176 gtkimcontextwayland: Drop the implicit gesture
Expect all users to call gtk_im_context_activate_osk() to get
on-screen keyboard features.
2024-03-11 18:04:16 +01:00
Carlos Garnacho
ce6aa73c64 gtkimcontext: Make gtk_im_context_activate_osk() public
Make this API public so that foreign "text" widgets (e.g. VteTerminal)
have a chance to integrate this logic into their own event controllers,
without having to craft the behavior of their own gestures around the
built-in IM gesture.

In order to make it most useful for other backends, a GdkEvent argument
and a boolean return value were added. This might be useful information
for other platforms than Wayland, e.g. all investigation seems to hint
that on Windows only the a11y keyboard is available programmatically
via app launching, so the IM method implementation would need to set
up its own policies for showing up the OSK (e.g. on touch events).
2024-03-11 18:04:14 +01:00
Matthias Clasen
257bef85d0 textview: Match cursor blink behavior of GtkText
This makes the conditions in cursor_blinks() more similar to
what GtkText does, and fixes adds the same notify handler for
has-focus, so we start blinking when requires. Crucially, we
also no longer try to blink when unmapped, which should fix
a epiphany crash.

Fixes: #6515
2024-03-11 11:34:40 -04:00
Matthias Clasen
a48df87a85 label: Don't forget to clear select info
This was showing up as crashes in the testsuite, where a later
test runs the mainloop, and that causes Wayland to claim the
primary selection on a widget that is already disposed.
2024-03-11 08:31:41 -04:00
Matthias Clasen
fe4cd7cf0f Merge branch 'matthiasc/for-main' into 'main'
Add more offload tests

See merge request GNOME/gtk!7010
2024-03-11 02:31:13 +00:00
Matthias Clasen
229b34d478 Add more offload tests
These test various clip scenarios.
2024-03-10 22:08:44 -04:00
Benjamin Otte
1985f2c9ad gpu: Make intersecting rounded rect with NONE clip always succeed
This is a tricky topic, because it can make the clip bounds grow, so
previously we were trying to be careful.

However, this can cause perfectly trivial intersections to fail that are
caused by redraw diff regions.
And in the worst case, that means we offscreen in places where we
absolutely do not want to offscreen - in subtrees with subsurface nodes.

Fixes #6499
2024-03-11 01:39:40 +01:00
Benjamin Otte
01d57a7566 gpu: Initial clip is always NONE
We scissor the initial clip (which is why it's an integer rect that is
assigned to the scissor). And if we scissor, the result is a NONE clip.
2024-03-11 01:39:40 +01:00
Benjamin Otte
7a4b2c10c7 gpu: contained clip is a rectangular clip, too
So we can treat it like rect clip and promote it to NONE after a
successful scissor.
2024-03-11 01:39:40 +01:00
Benjamin Otte
208b2d37b6 gpu: Clarify clip types
CLIP_TYPE_NONE is valid if the clip is implemented by the scissor rect.

We always have a scissor rect and there's no way to draw outside of it.

In theory that means we can reset the clip to NONE at any point we
wish if we know nodes are contained inside a certain pixel-aligned
rectangle we can clip.
In practice that's probably quite hard...
2024-03-11 01:39:40 +01:00
Benjamin Otte
ef98912779 nodeparser: Print subsurface nodes properly
The nodes actually end.

Tests included.
2024-03-11 01:39:40 +01:00
Matthias Clasen
b1e3b18ede Merge branch 'matthiasc/for-main' into 'main'
ci: Add more xfails

See merge request GNOME/gtk!7007
2024-03-10 23:57:42 +00:00
Matthias Clasen
0194cadbc0 ci: Add more xfails
The gradient tests are prone to rounding errors when clipped,
so fail them.
2024-03-10 16:53:12 -04:00
Matthias Clasen
b4dfc4adfc NEWS: Updates 2024-03-10 13:45:57 -04:00
Ask Hjorth Larsen
fd556ec377 Update Danish translation 2024-03-10 17:33:33 +00:00
Matthias Clasen
1dbc1d67f5 Merge branch 'wip/otte/correct-fps' into 'main'
Fix fps display

See merge request GNOME/gtk!7003
2024-03-10 17:31:46 +00:00
Balázs Úr
8790c83a76 Update Hungarian translation 2024-03-10 15:56:09 +00:00
Brage Fuglseth
6b202fb838 Update Norwegian Bokmål translation 2024-03-10 13:15:47 +00:00
Fran Dieguez
f69476435f Update Galician translation 2024-03-10 10:34:28 +00:00
Benjamin Otte
8df6e2cdaf frameclock: Make timings history dynamic
Keep at least 1 second of frame timings.

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

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

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

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

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

Now we skip any incomplete frames, because those frames never have
presentation times reported. This makes it theoretically more likely to
not being able to report fps at all, but I'd rather have no fps than fps
off by a factor of 2.
2024-03-10 10:27:36 +01:00
Benjamin Otte
23c2122c13 inspector: Handle more digits in fps overlay
The fps used to get garbled when hitting >=10,000fps. That's quite
unlikely to happen for long periods, but it can happen for short bursts
(like after alt-tabbing).

So just handle more digits to make the display survive those corner cases.
2024-03-10 10:27:36 +01:00
Benjamin Otte
5b83ffa4a0 inspector: Make background width match fps number
Previously, we drew the same width no matter how many digits the fps
number had, which left a lot of empty space.

But we can use some quite simple math to avoid that by just shrinking
the background by the width of the non-rendered glyphs.
2024-03-10 10:27:35 +01:00
Matthias Clasen
cf8e3157a7 Merge branch 'matthiasc/for-main' into 'main'
Add another path fill test

Closes #4553 and #5423

See merge request GNOME/gtk!7001
2024-03-09 18:21:19 +00:00
Matthias Clasen
7323172755 ci: Add xfails for gl rotation+opacity problems
These are the topic of #6525. Lets xfail them for now.
2024-03-09 13:02:56 -05:00
Matthias Clasen
cfee8f4b11 tests: Cosmetics 2024-03-09 12:43:33 -05:00
Matthias Clasen
7ae099c94c inspector: Tweak the size groups page
Make the page scroll, and modernize it slightly. Also, fix a
case of missing top margin.

Fixes: #4553
2024-03-09 12:43:33 -05:00
Matthias Clasen
42298d8ab1 inspector: Deal with long action names
Make the action list scroll horizontally, and make the name
column resizable.

Fixes: #5423
2024-03-09 12:43:33 -05:00
Matthias Clasen
68912698f1 inspector: Drop the Window Scale spin
We don't really expect backends to make this settable, and
fractional scaling makes this more complicated anyway. The
scale values can be seen on the General tab, for the monitor,
and on the surface for each toplevel.
2024-03-09 12:43:33 -05:00
Matthias Clasen
c8c56f8d42 inspector: Use GtkFontDialogButton
A small step towards respecting our own deprecations. While we
are at it, make the control only select the font family, since
that is the intention of the font setting. Font style and size
are under the control of the css, and we have a font scale slider
right below to influence font size globally.
2024-03-09 12:43:33 -05:00
Matthias Clasen
7f48b5a05c inspector: Show the linux dmabuf Wayland protocol
This was overlooked when dmabuf support was added.
2024-03-09 12:43:33 -05:00
Matthias Clasen
1e5e977b37 gsk: Minor reshuffling
Hide the temporary unhinted font object behind the private API.
There might be a way to implement this without instantiating a
font, at some point.
2024-03-09 12:43:33 -05:00
Matthias Clasen
62d44b6bc7 wayland: Add window sizes to debug spew
This may help for tracking down issues.
2024-03-09 12:43:33 -05:00
Matthias Clasen
862afeffe0 Add another path fill test
This uses the other fill rule.
2024-03-09 07:03:55 -05:00
Matthias Clasen
92f9195015 Merge branch 'matthiasc/for-main' into 'main'
Update the docs for gtk-xft-rgba

See merge request GNOME/gtk!7000
2024-03-09 04:50:09 +00:00
Matthias Clasen
fc6e08082b tests: Make compare-render less repetitive
Only run the unmodified comparison if --plain is passed
on the commandline.
2024-03-08 22:27:14 -05:00
Matthias Clasen
af7516b797 Update the docs for gtk-xft-rgba
Clarify that this setting has no effect.
2024-03-08 21:37:10 -05:00
Matthias Clasen
3f1821e372 Merge branch 'matthiasc/for-main' into 'main'
gsk: Make uber shader handle fonts the same

See merge request GNOME/gtk!6995
2024-03-09 02:19:25 +00:00
Matthias Clasen
b569470b87 Stop setting rgb antialiasing in font options
We don't support subpixel antialiasing, so setting font options
to that effect won't do any good.
2024-03-08 20:44:42 -05:00
Matthias Clasen
f1a3235039 Add tests for uber rendering
Add a --colorflip option to the compare-render test. This applies
a color matrix to the node, which has the intended side-effect of
convincing the Vulkan renderer to use its uber shader, so we get
test results comparing the uber output to its non-uber siblings.
2024-03-08 20:44:42 -05:00
Matthias Clasen
34e90005af Don't forget to unrealize the renderer
This causes a critical warning.
2024-03-08 20:44:42 -05:00
Matthias Clasen
4f1cc8ec6d gsk: Make uber shader handle fonts the same
The code converting text nodes for the uber shader was missing
some of the recent font handling improvements. Make things match.

Related: #6514
2024-03-08 20:44:42 -05:00
Matthias Clasen
5242205a65 gsk: Ignore transforms for font handling
We were turning off hinting and subpixel positioning if the
transform isn't 2D affine. The idea behind this was that transforms
likely indicate animations, and for animations, this may reduce
jitter. But the heuristic of transform==animation is not very
reliable, and we pay for this with a jump from hinted to unhinted
at the beginning and end of it. Also, the heuristic does not even
work for the most relevant 'animation' we have today: scrolling.

So, lets drop this for now. We can revisit it later.
2024-03-08 20:44:42 -05:00
Matthias Clasen
59633a6781 Add an xfail
This is causing sporadic ci failures, so file an issue and xfail it.
2024-03-08 20:44:42 -05:00
Matthias Clasen
d82316edda Merge branch 'cache-get-hinted-font' into 'main'
gsk: cache sequentially requested hinted fonts

See merge request GNOME/gtk!6999
2024-03-09 01:10:18 +00:00
Matthias Clasen
0815640b22 Merge branch 'mark-for-dropped-frames' into 'main'
gdk/frameclock: add mark when we discover frames may drop

See merge request GNOME/gtk!6998
2024-03-09 01:03:13 +00:00
Matthias Clasen
26de2eae20 Merge branch 'ngl-buffer-upload-counter' into 'main'
add counter for ngl buffer uploads

See merge request GNOME/gtk!6997
2024-03-08 23:50:03 +00:00
Matthias Clasen
8fa358c4d4 Merge branch 'avoid-extraneous-uploads' into 'main'
gsk/gpu: avoid unnecessary buffer uploads

See merge request GNOME/gtk!6996
2024-03-08 23:48:52 +00:00
Christian Hergert
fc72449228 gsk: cache sequentially requested hinted fonts
When getting the hinted version of fonts, they often come in sequentially.
This helps reduce overhead in many sequential gtk_text_node_new() on with
fractional scaling as you see from GtkSourceView.
2024-03-08 15:40:26 -08:00
Christian Hergert
84a304e66e gdk/frameclock: add mark when we discover frames may drop
If we discover that some number of frames have passed that perhaps should
not have, leave a mark for the profiler.
2024-03-08 14:41:59 -08:00
Christian Hergert
ecf1b7c18a gsk/gpu: add counter for ngl buffer uploads
It's helpful to know how much we're uploading from Sysprof captures.
2024-03-08 14:17:31 -08:00
Christian Hergert
a7c5b53f46 gsk/gpu: avoid unnecessary buffer uploads
Some maps are used for read only and do not require uploading contents
back to the GPU afterwards. In other cases, we can often upload less than
the fully allocated buffer size.
2024-03-08 13:55:57 -08:00
Rūdolfs Mazurs
09736dde93 Update Latvian translation 2024-03-08 21:02:45 +00:00
Matthias Clasen
66c00dc9f3 Merge branch 'docs-iconcache' into 'main'
docs/iconcache.txt: fix ICON_FLAGS

Closes #6489

See merge request GNOME/gtk!6993
2024-03-08 16:20:55 +00:00
Kirill Primak
3eacf8bd39 docs/iconcache.txt: fix ICON_FLAGS
The documented icon flags didn't match the actual constants used by GTK when
reading and updating icon theme cache files. Fix the values of flags in the
documentation.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/6489
2024-03-08 18:42:11 +03:00
Matthias Clasen
34e9ef9e78 Merge branch 'fix-foreign-check' into 'main'
Fix xdg-foreign check

See merge request GNOME/gtk!6994
2024-03-08 14:20:50 +00:00
Ivan Molodetskikh
a5955106ea Fix xdg-foreign check
It was checking for xdg-foreign v1 instead of "v1 or v2".
2024-03-08 17:28:35 +04:00
Andika Triwidada
ea0cfed735 Update Indonesian translation 2024-03-07 08:44:46 +00:00
Matthias Clasen
f312d1ee6a Merge branch 'gtk-at-spi-context-typo' into 'main'
Fix documentation typo

See merge request GNOME/gtk!6991
2024-03-07 04:30:53 +00:00
Robert Ancell
69b6f4cf4f Fix documentation typo 2024-03-07 15:17:33 +13:00
Matthias Clasen
d7e1c377fe Merge branch 'matthiasc/for-main' into 'main'
ci: Update xfails

See merge request GNOME/gtk!6990
2024-03-07 01:56:05 +00:00
Matthias Clasen
cc17577763 Merge branch 'fix-emoji-pres' into 'main'
emoji: Fix presentation selector handling

See merge request GNOME/gtk!6986
2024-03-07 00:23:41 +00:00
Matthias Clasen
ef4ae61c66 ci: Update xfails
A number of the xfails that were added for the new renderers have
been fixed.
2024-03-06 19:03:43 -05:00
Matthias Clasen
e04ea3f311 Merge branch 'fix-mis-scaled-text' into 'main'
gsk: Fix mis-scaled text rendering

Closes #6504

See merge request GNOME/gtk!6977
2024-03-06 23:22:42 +00:00
Matthias Clasen
77a2cd4d8d gsk: Fix mis-scaled text rendering
This was happening when rotated text was partially redrawn.

A test that failed before this change is included.

Fixes: #6504
2024-03-06 17:52:35 -05:00
Matthias Clasen
0986981d1a gpu: Empty clip is still empty after transform
When transforming an empty clip, it stays empty.

Previously, we were setting it to CONTAINED, but that's wrong, because
the bounds are not contained in the clip, the clip is contained in the bounds.

This reverts part of commit a51c6aed47.

Related: !6692
2024-03-06 17:52:22 -05:00
Benjamin Otte
913f850f83 Merge branch 'wip/otte/for-main' into 'main'
Update "snapshot: linear-gradients cannot be affine-transformed"

See merge request GNOME/gtk!6989
2024-03-06 22:44:48 +00:00
Benjamin Otte
ed31da3730 Update "snapshot: linear-gradients cannot be affine-transformed"
This is a better fix for commit 7ed6c39862.

The linear-gradient-nonorthogonal-linear-gradient test tests this.

Related: !6692
2024-03-06 22:35:30 +01:00
Benjamin Otte
428ff6c4ab Merge branch 'wip/otte/for-main' into 'main'
snapshot: Fix wrong nodes with transformed shadows

See merge request GNOME/gtk!6988
2024-03-06 21:06:49 +00:00
Benjamin Otte
53786841cc snapshot: Fix wrong nodes with transformed shadows
Test included.

The test is disabled for Cairo because the Cairo blurring code can't
deal with scaling, which makes things come out wrong for the test that
checks that we do the right thing with the blur radius when scaling.

Related: !6977
2024-03-06 21:52:16 +01:00
Vincent Chatelain
8f8ece44a8 Update French translation 2024-03-06 19:00:59 +00:00
Anders Jonsson
41a892b958 Update Swedish translation 2024-03-06 17:50:54 +00:00
Baurzhan Muftakhidinov
b494ed5876 Update Kazakh translation 2024-03-06 03:10:20 +00:00
Josh Brobst
7b589f991d emoji: Fix presentation selector handling
The emoji presentation selector (FE0F) was being appended to every emoji
sequence inserted by GtkEmojiChooser and GtkEmojiCompletion, often
leading to invalid sequences. Modify the emoji data to include FE0F
only when necessary, and change skin tone handling to account for cases
where the generic (no tone) variation needs a presentation selector.
2024-03-05 18:44:55 -05:00
Christian Hergert
d83faf82d7 Merge branch 'macos-move-maximized' into 'main'
macos: Fix moving maximized windows

Closes #6436

See merge request GNOME/gtk!6914
2024-03-05 21:53:26 +00:00
Matthias Clasen
cd46016238 Merge branch 'preserve-font-dpi' into 'main'
gsk: Preserve dpi when modifying fonts

Closes #6508

See merge request GNOME/gtk!6985
2024-03-05 21:43:00 +00:00
Matthias Clasen
f2a3218455 Merge branch 'wip/chergert/fix-textviewchild-double-draw' into 'main'
textview: only snapshot GtkTextViewChild once

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

See merge request GNOME/gtk!6981
2024-03-05 21:34:30 +00:00
Matthias Clasen
b23600ae4b gsk: Preserve dpi when modifying fonts
When scaling a font or changing font options, we need to be
careful to preserve the dpi as well, otherwise the rendering
might leak out of the node bounds, leading to spectacular
glitches.

Fixes: #6508
2024-03-05 16:22:26 -05:00
Christian Hergert
bdc43b8fca textview: only snapshot GtkTextViewChild once
This was causing double snapshotting of textview children because the
parent snapshot will also iterate and snapshot children.
2024-03-05 11:41:11 -08:00
Matthias Clasen
da2ef6911f Merge branch 'ebassi/accessible-text-util' into 'main'
Rename GtkAccessibleText private header

See merge request GNOME/gtk!6982
2024-03-05 13:23:11 +00:00
Emmanuele Bassi
0626246367 a11y: Add utilify method for text attributes
Simplify the AT-SPI implementation by having a convenience function to
extract the text attributes of a GtkAccessibleText, with or without the
default attributes.
2024-03-05 12:23:17 +00:00
Matthias Clasen
0edfafdfdf Merge branch 'macos-maximized-window' into 'main'
macos: Fix window state of initially maximized windows

Closes #5898

See merge request GNOME/gtk!6882
2024-03-05 11:35:49 +00:00
Bruce Cowan
1863b79fb3 Update British English translation 2024-03-05 11:35:24 +00:00
Emmanuele Bassi
9aa90f8df0 Rename GtkAccessibleText private header
Follow the existing naming convention, and drop the hyphen.
2024-03-05 11:00:20 +00:00
Fabio Lagalla
8080d9e7c1 gdk: Implement cursor from texture on MacOS
This is done with a NSCursor whose content is an NSImage. Image pixels are filled by a NSBitmap, and the format is premultiplied RGBA. So we can just use the texture downloader with GDK_MEMORY_R8G8B8A8_PREMULTIPLIED format.
2024-03-05 10:26:27 +01:00
Matej Urbančič
f432ee775f Update Slovenian translation 2024-03-04 21:51:10 +00:00
Matthias Clasen
77f9cb11a9 Merge branch 'wip/chergert/for-main' into 'main'
gsk/gpu: add profiler node for shader loading

See merge request GNOME/gtk!6978
2024-03-04 21:36:37 +00:00
Asier Sarasua Garmendia
d92e3cb864 Update Basque translation 2024-03-04 19:58:53 +00:00
Matthias Clasen
733fa156b9 Merge branch 'ebassi/accessible-text-default-attrs' into 'main'
a11y: Add GtkAccessibleText.get_default_attributes

See merge request GNOME/gtk!6973
2024-03-04 19:54:33 +00:00
Christian Hergert
d181d53762 gsk/gpu: add profiler node for shader loading
This is helpful when tracking down why a frameclock cycle took so long. In
quick recordings it seems to often correlate with a shader compile.
2024-03-04 11:54:13 -08:00
Emmanuele Bassi
644e6f8ebe Consolidate TextView/TextBuffer attribute serialization
Use dictionaries of string pairs instead of abusing GVariant; we can
convert the dictionary into a GVariant when we send the data over the
wire.
2024-03-04 19:13:29 +00:00
Matthias Clasen
0b4c695d65 Merge branch 'hinting-proper-positioning' into 'main'
gsk: Handle hinted fonts better

Closes #6502

See merge request GNOME/gtk!6966
2024-03-03 23:27:00 +00:00
Matthias Clasen
448287bd58 Merge branch 'camelCaseNick/a11y-text-contents-at' into 'main'
a11y: implement get_contents_at for Gtk.Text, Gtk.TextView, Gtk.Inscription

See merge request GNOME/gtk!6971
2024-03-03 23:03:13 +00:00
Benjamin Otte
5e6aff69c6 Merge branch 'wip/otte/for-main' into 'main'
demos: shadertoy only handles GL

See merge request GNOME/gtk!6976
2024-03-03 22:38:22 +00:00
Benjamin Otte
d88e616711 demos: shadertoy only handles GL
If somebody wants to add GLES support, go for it.

For now we enforce GL.
2024-03-03 22:20:44 +00:00
Aurimas Černius
0e5c94a094 Update Lithuanian translation 2024-03-03 20:47:02 +00:00
Brage Fuglseth
bb0aeec99c Update Norwegian Bokmål translation 2024-03-03 20:08:02 +00:00
Matthias Clasen
880e3ef289 Add tests for glyph positioning
These tests check that we round glyph positions to integral device
pixel coordinates when hinting is enabled, and to device subpixel
positions if it isn't.
2024-03-03 14:28:19 -05:00
Sabri Ünal
94a09263d7 Update Turkish translation 2024-03-03 18:22:30 +00:00
Markus Göllnitz
ab9106ac89 testsuite: test for implementation of accessible_text_get_contents_at
Signed-off-by: Markus Göllnitz <camelcasenick@bewares.it>
2024-03-03 19:13:40 +01:00
Markus Göllnitz
ff6451a77e a11y: implement get_contents_at for Gtk.TextView
Signed-off-by: Markus Göllnitz <camelcasenick@bewares.it>
2024-03-03 19:13:40 +01:00
Matthias Clasen
4f2d63b8ac gsk: Handle hinted fonts better
Enforce the following rules:
- No hinting or subpixel positioning in transformed context
- glyph-align determines if we use integral or fractional
  device pixel positions
- For hinting, always use an integral y position (the hinter
  assumes integral positions, and only operates vertically).
2024-03-03 13:08:29 -05:00
Matthias Clasen
81c97f0910 gsk: Add a private helper
Add a function to get the hint style of a font.
2024-03-03 13:08:29 -05:00
Matthias Clasen
d1b52cc292 gsk: Preserve the antialiasing setting of the font
When we get an unhinted font for text node extents, don't change
the antialiasing setting. It doesn't affect the extents we get
here, but if we later need an unhinted font for rendering, the
one we create this way will be the right one, so it will already
exist.
2024-03-03 13:08:29 -05:00
Matthias Clasen
ddedb39329 gsk: Tweak gsk_get_hinted_font slightly
Make it possible to preserve some of the fonts original options.
2024-03-03 13:08:29 -05:00
Matthias Clasen
d45987e637 Merge branch 'fallback-to-gl+llvmpipe' into 'main'
Don't fall back to cairo for software rendering

See merge request GNOME/gtk!6975
2024-03-03 17:54:07 +00:00
Matthias Clasen
b95eceea60 Don't fall back to cairo for software rendering
The experience with gl+llvmpipe is not great, in particular on
fractional scales. But it is less broken than cairo in that
situation.
2024-03-03 12:28:20 -05:00
Emmanuele Bassi
2774e80fc4 a11y: Ensure that attributes are unique before sending them
The default attributes are overridden by the run attributes.
2024-03-03 17:08:39 +00:00
Matthias Clasen
7c207c4868 Merge branch 'matthiasc/for-main' into 'main'
Improve subpixel positioning tests

See merge request GNOME/gtk!6974
2024-03-03 16:33:46 +00:00
Matthias Clasen
c6c8abcf21 Improve subpixel positioning tests
We want to test subpixel positioning, so turn off hinting, since
hinting and subpixel positioning are opposing forces.

This does not currently change test outcomes, but it will prevent
the tests from breaking in the future when we make changes to
improve hinting.
2024-03-03 11:19:04 -05:00
Emmanuele Bassi
a59c967675 a11y: Implement AtspiText.GetDefaultAttributes
The new GtkAccessibleText.get_default_attributes() vfunc gives us the
ability to implement this AT-SPI method.
2024-03-03 15:17:53 +00:00
Emmanuele Bassi
c3329f5fcc a11y: Implement AtspiText.GetAttributeRun for AccessibleText
GetAttributeRun works like GetAttributes, but it allows including the
default text attributes.

See: !6971, GNOME/orca#477
2024-03-03 15:17:53 +00:00
Emmanuele Bassi
4f06e46759 a11y: Implement get_default_attributes for TextView 2024-03-03 15:17:53 +00:00
Emmanuele Bassi
7e522a8c55 a11y: Implement get_default_attributes for Text 2024-03-03 15:17:52 +00:00
Emmanuele Bassi
d9447fd2e7 a11y: Implement get_default_attributes for Label 2024-03-03 15:17:52 +00:00
Emmanuele Bassi
95214f3697 a11y: Implement get_default_attributes for Inscription 2024-03-03 15:17:52 +00:00
Emmanuele Bassi
fe64c998f8 a11y: Add GtkAccessibleText.get_default_attributes
Accessible text attributes come in two flavours:

- the run attributes, which apply to a text from a given offset
- the default attributes, which apply to the whole text

The default attributes are used to gather the initial values for every
text attribute, while the run attributes operate additively.

We currently have a getter for the former, but we lack one for the
latter.
2024-03-03 15:17:52 +00:00
Markus Göllnitz
84582ad762 a11y: implement get_contents_at for Gtk.Inscription
Signed-off-by: Markus Göllnitz <camelcasenick@bewares.it>
2024-03-03 15:52:26 +01:00
Matthias Clasen
fcc7a58058 Merge branch 'gst-cmp-float' into 'main'
gstreamer: Use G_APPROX_VALUE to compare floats

See merge request GNOME/gtk!6972
2024-03-03 14:16:47 +00:00
Matthias Clasen
8a48becb7e Cosmetics 2024-03-03 08:56:32 -05:00
Robert Mader
465446430e gstreamer: Use G_APPROX_VALUE to compare floats
Mainly to silence compiler warnings.
2024-03-03 14:35:27 +01:00
Luming Zh
4060c43ae7 Update Chinese (China) translation 2024-03-03 11:17:20 +00:00
Markus Göllnitz
4ec9a2a330 a11y: implement get_contents_at for Gtk.Text
There are users of GetStringAtOffset, such as Orca.

Signed-off-by: Markus Göllnitz <camelcasenick@bewares.it>
2024-03-03 04:37:01 +01:00
Matthias Clasen
90c017a762 Merge branch 'matthiasc/for-main' into 'main'
Grr, vulkan

See merge request GNOME/gtk!6970
2024-03-03 03:03:19 +00:00
Matthias Clasen
e011434223 Update tests for version number bump 2024-03-02 22:02:36 -05:00
Matthias Clasen
b1ccb4103d Grr, vulkan
The can always make it worse with another define.
2024-03-02 21:47:49 -05:00
Matthias Clasen
8033809f8b Merge branch 'matthiasc/for-main' into 'main'
vulkan: Add another error code

See merge request GNOME/gtk!6969
2024-03-03 01:26:44 +00:00
Matthias Clasen
66ba1f76ba vulkan: Add another error code
Handle VK_ERROR_INVALID_VIDEO_STD_PARAMETERS_KHR.
2024-03-02 20:20:16 -05:00
Matthias Clasen
0ca822c716 Merge branch 'matthiasc/for-main' into 'main'
4.13.9

See merge request GNOME/gtk!6968
2024-03-03 00:57:14 +00:00
Matthias Clasen
4ac288c1b4 Post-release version build 2024-03-02 19:56:09 -05:00
Matthias Clasen
64316ab185 4.13.9 2024-03-02 19:30:26 -05:00
Matthias Clasen
4d90a693ae Merge branch 'scaled-font' into 'main'
gsk: Use a scaled font for glyph rendering

See merge request GNOME/gtk!6936
2024-03-03 00:23:43 +00:00
Matthias Clasen
0c5f943783 Merge branch 'matthiasc/for-main' into 'main'
NEWS: Updates

See merge request GNOME/gtk!6967
2024-03-02 23:54:29 +00:00
Matthias Clasen
42fc165b94 Add glyph hinting tests
Add tests that demonstrate different rendering with and without
hinting, to prove that hinting has an effect.
2024-03-02 18:41:06 -05:00
Matthias Clasen
20a4e3f351 Add glyph antialiasing test
This test checks that the antialias font option has the indended
effect.
2024-03-02 18:41:02 -05:00
Matthias Clasen
f3f90e1d71 Add a glyph scaling test
The glyph in this test has extents that will be made smaller
by hinting, which poses some challenge for our renderers.

The scaled glyph rendering is too big for the 'small texture'
text setup, so we allow the test to fail there.
2024-03-02 18:39:14 -05:00
Matthias Clasen
b018da2acd gsk: Accept font options in node files
The goal is to fix all the context that influences the rendering
of text nodes in the node file. This will help with better font
testing.

The newly accepted properties are

hint-style: none/slight/full
antialias: none/gray

We are omitting font options and values that aren't supported
in GSK or have no influence on the rendering.

Note that these settings will get incorporated in the PangoFont
that gets set on the resulting text node.

Parser tests included.
2024-03-02 18:39:14 -05:00
Matthias Clasen
ab5f3f59ce gsk: Use unhinted extents for text nodes
We need precise bounds. And while hinting might shift the rendering
around from these bounds by a fraction of a pixel, we account for
this in the places where it matters: when determining diff regions,
when sizing offscreens, and when determining the size of atlas
regions for glyphs.
2024-03-02 18:39:14 -05:00
Matthias Clasen
0127217e10 gsk: Add a way to get a (un)hinted font
Add a function to change the cairo font options of a font to
to the given values while keeping everything else the same.

We use pango api for this if available.

Note that this is not a fully general api, but tailored to the
needs of GSK. We don't allow setting hint-metrics (because it
only influences layout, not rendering) or subpixel-mode (since
we don't have component alpha available).
2024-03-02 18:39:14 -05:00
Matthias Clasen
16a476fe22 gsk: Stop passing scale to glyph upload op
It is always 1.0 now, so there is no point. Instead of the scale,
print the font when doing verbose logging.
2024-03-02 18:39:14 -05:00
Matthias Clasen
c8ca6930c5 gsk: Use a scaled font for glyph rendering
This changes the approach we take to rendering glyphs in the
presence of a scale transform: Instead of scaling the extents
and rendering to an image surface with device scale, simply
create a scaled font and use it for extents and rendering.

This avoids clipping problems with scaling of extents in
the presence of hinting.
2024-03-02 18:39:14 -05:00
Matthias Clasen
c4f33f36de gsk: Add a way to get a scaled font
Add a function to change the size of a font while keeping everything
else the same. We use pango api for this if available.
2024-03-02 18:39:14 -05:00
Matthias Clasen
0543c48862 NEWS: Updates 2024-03-02 18:27:33 -05:00
Yaron Shahrabani
fcb17a86e6 Update Hebrew translation 2024-03-02 22:15:37 +00:00
Yuri Chornoivan
5633b5b637 Update Ukrainian translation 2024-03-02 20:40:15 +00:00
Artur S0
f7eaf69d67 Update Russian translation 2024-03-02 19:55:29 +00:00
Piotr Drąg
32411943ea Update Polish translation 2024-03-02 17:08:11 +01:00
Jiri Grönroos
58fa5d7617 Update Finnish translation 2024-03-02 16:03:12 +00:00
Ekaterine Papava
f9ee1967f4 Update Georgian translation 2024-03-02 15:53:04 +00:00
Danial Behzadi
6a376f0a30 Update Persian translation 2024-03-02 15:32:03 +00:00
Piotr Drąg
66826c26db Update POTFILES.in 2024-03-02 16:19:28 +01:00
Matthias Clasen
8d1e37789e Merge branch 'broken-hexboxes' into 'main'
gsk: problems with hex boxes

See merge request GNOME/gtk!6963
2024-03-02 00:04:29 +00:00
Matthias Clasen
6c39a5946e Merge branch 'wip/chergert/for-main' into 'main'
gdk/gdkglcontext: include duration of eglSwapBuffers

See merge request GNOME/gtk!6964
2024-03-02 00:03:58 +00:00
Christian Hergert
2a98928286 gdk/gdkglcontext: include duration of eglSwapBuffers 2024-03-02 00:03:57 +00:00
Matthias Clasen
c7806eb908 gsk: Fix handling of hex boxes
The pango code that is drawing hex boxes, invisible glyphs, etc,
is depending on the width being set in the PangoGlyphInfo. Once
we set that, everything falls into place.

Testcase included.
2024-03-01 16:51:58 -05:00
Matthias Clasen
9015734e65 Merge branch 'matthiasc/for-main' into 'main'
gsk: Make glyph parsing more flexible

See merge request GNOME/gtk!6962
2024-03-01 17:49:46 +00:00
Matthias Clasen
f5159e1ecb gsk: Make glyph parsing more flexible
It is a bit annoying that one has to specify the glyph width
when specifying glyphs numerically for a text node, since this
information really is part of the font.

Make the parser more flexible, and allow to specify just the glyph
ids, without an explicit width. In this case, the width will be
determined from the font.

With this, glyphs can now be specified in any of the follwing
ways:

glyphs: "ABC";              (ASCII)
glyphs: 23, 45, 1001;       (Glyph IDs)
glyphs: 23 10, 100 11.1;    (Glyph IDs and advance widths)
glyphs: 23 10 1 2 color;    (with offsets and flags)

Tests have been updated to cover these variants.
2024-03-01 11:22:28 -05:00
Matthias Clasen
aec2f50d82 testsuite: Add a forgotten test 2024-03-01 09:23:41 -05:00
Matthias Clasen
74860f7602 Merge branch 'debug-flags-ubsan' into 'main'
gdkdisplay: Don’t call _get_instance_private(NULL)

See merge request GNOME/gtk!6961
2024-03-01 13:10:30 +00:00
Philip Withnall
a9175e0c03 gdkdisplay: Don’t call _get_instance_private(NULL)
While it’s documented as being safe, it triggers warnings from ubsan.
While we work out the best way to deal with that inside the
implementation of `G_ADD_PRIVATE` in GLib, let’s pragmatically just
short-circuit the code which triggers the warning here. This is helpful
because `gdk_display_get_debug_flags()` is called from a number of
locations within GTK, so is likely to be hit if anyone is running a UI
app under ubsan.

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

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

Helps: https://gitlab.gnome.org/GNOME/glib/-/issues/3267
2024-03-01 12:16:31 +00:00
Matthias Clasen
e1c56555af Merge branch 'camelCaseNick/editable-accessible-crash' into 'main'
a11y: support multiple levels of editable delegations in AT-SPI text

See merge request GNOME/gtk!6960
2024-03-01 04:12:23 +00:00
Matthias Clasen
24120c8fd0 Merge branch 'matthiasc/for-main' into 'main'
testsuite: Plug some leaks

See merge request GNOME/gtk!6959
2024-03-01 03:56:06 +00:00
Markus Göllnitz
f284331f79 a11y: support multiple levels of editable delegations in AT-SPI text
Gtk.Editable.get_delegate is allowed to return another
delegating Gtk.Editable. However, the AT-SPI text
implementationn for Gtk.Editables does not handle
delegate chaining.

In the wild, you will find a Gtk.Text as the delegate of
a Gtk.SpinButton, that is in turn the delegate of an
Adw.SpinRow in libadwaita.

Note: This does not handle the more dangerous possibility
of a delegate loop when built with G_DISABLE_ASSERT,
otherwise stops after the arbitrarily chosen number of
six steps of delegation.

Signed-off-by: Markus Göllnitz <camelcasenick@bewares.it>
2024-03-01 04:14:58 +01:00
Matthias Clasen
a82de96e1a Add a testsuite for nodeparser tests
This helps when changing the node parser.
2024-02-29 21:59:04 -05:00
Matthias Clasen
eba9b116ed Merge branch 'camelCaseNick/text-accessible-segv' into 'main'
a11y: handle no selection ranges for AT-SPI text

Closes #6488

See merge request GNOME/gtk!6958
2024-02-29 03:52:10 +00:00
Markus Göllnitz
1f89b3c7df a11y: handle no selection ranges for AT-SPI text 2024-02-29 03:52:10 +00:00
Matthias Clasen
c739b9fe7f Merge branch 'wip/kabus/misc-leaks2' into 'main'
general: Fix leaks

See merge request GNOME/gtk!6951
2024-02-28 12:35:02 +00:00
Matthias Clasen
556b729b97 Merge branch 'matthiasc/for-main' into 'main'
gsk: Serialize fonts with absolute size

See merge request GNOME/gtk!6953
2024-02-28 12:08:59 +00:00
Matthias Clasen
9fd5558acd Update nodeparser tests
The node serialization code now prints fonts with pixel sizes.
Update affected tests.
2024-02-27 23:46:33 -05:00
Matthias Clasen
b7422c0f62 nodeparser: Change default font
Use Cantarell 15px instead of Cantarell 11, ot make roundtrip
tests easier to read.
2024-02-27 23:45:46 -05:00
Emmanuele Bassi
ace684c7ab Merge branch 'wip/chergert/for-main' into 'main'
a11y/atspi: make TextCaretMoved match GTK 3 / ATK

See merge request GNOME/gtk!6956
2024-02-28 01:15:53 +00:00
Christian Hergert
752e704e99 accessibletext: handle NULL gracefully from get_contents_at()
This fixes a g_critical() internally with GtkTextView when running orca.
2024-02-27 16:40:48 -08:00
Christian Hergert
8c7e13746b a11y/atspi: make TextCaretMoved match GTK 3 / ATK
When testing VTE on GTK 3 using ATK, the variant parameter is <0> instead
of <''> on the wire. Make that match to increase the chances that tooling
will hit the same expectations.
2024-02-27 16:35:29 -08:00
Matthias Clasen
c2311c7154 gsk: Serialize fonts with absolute size
This is more often what we want. Our testcases tend to have
pixel sizes, and we want to preserve then when resaving the
test files.
2024-02-27 14:10:10 -05:00
Khalid Abu Shawarib
44fa748826 general: Fix leaks 2024-02-27 22:01:41 +03:00
Matthias Clasen
dfed398371 Merge branch 'gtk4-edge-tiling-resize-fix' into 'main'
[gtk4/wayland] Infer edge constraints from tiled edges.

See merge request GNOME/gtk!6745
2024-02-27 17:39:04 +00:00
Matthias Clasen
962ba49a8e Merge branch 'wip/chergert/for-main' into 'main'
textview: always set n_ranges out parameter

See merge request GNOME/gtk!6950
2024-02-27 02:19:40 +00:00
Christian Hergert
5811e443f8 textview: always set n_ranges out parameter 2024-02-26 17:49:03 -08:00
Aurimas Černius
f55e1392d4 Update Lithuanian translation 2024-02-26 20:56:00 +00:00
Daniel Mustieles
0fbe5ba40c Update Spanish translation 2024-02-26 15:25:40 +00:00
Matthias Clasen
980ea63d78 Merge branch 'video-cursor-timeout' into 'main'
video: Install the hide cursor timeout later

Closes #6264

See merge request GNOME/gtk!6948
2024-02-26 14:45:02 +00:00
Simon McVittie
85cf995af7 testsuite: Force Mesa to use software GL when asserting about stderr
In an autobuilder environment, there will typically be no hardware GPU
available, so Mesa will fall back from hardware to Zink to software
rendering. Unfortunately, Zink logs to stderr during loading if no
hardware GPUs are available. This particular test asserts that stderr
has desired contents, which means Zink's extra output causes the test
to fail. We can bypass this by disabling use of Zink.

Resolves: https://gitlab.gnome.org/GNOME/gtk/-/issues/6478
Signed-off-by: Simon McVittie <smcv@debian.org>
2024-02-26 13:23:11 +00:00
Matthias Clasen
dcc3533363 video: Install the hide cursor timeout later
We were installing the timeout in root, but removing it in unmap,
which could lead to trouble if we ever dispose a GtkVideo widget
without mapping it.

Fixes: #6264
2024-02-26 08:17:27 -05:00
Matthias Clasen
28964aa0a4 Merge branch 'search-entry-input-hints-property-since-marker' into 'main'
Add missing `Since` marker to `GtkSearchEntry:input-hints`

See merge request GNOME/gtk!6947
2024-02-26 12:26:33 +00:00
Matthias Clasen
7fd8a0ac99 Merge branch 'michaelweghorn/fix_at_spi_socket_doc' into 'main'
a11y: Fix gtk_at_spi_socket_new doc

See merge request GNOME/gtk!6946
2024-02-26 12:21:34 +00:00
Sebastian Dröge
d919ed4e4b Add missing Since marker to GtkSearchEntry:input-hints 2024-02-26 11:09:50 +02:00
Matej Urbančič
61ec6fb5eb Update Slovenian translation 2024-02-26 09:00:38 +00:00
Michael Weghorn
237eb8bb90 a11y: Fix gtk_at_spi_socket_new doc 2024-02-26 07:52:19 +01:00
Matthias Clasen
ff57cd9331 Merge branch 'gtk-jan2024_docs_tweaks' into 'main'
docs: Clarify child objects in GtkBuilder

See merge request GNOME/gtk!6945
2024-02-26 03:05:22 +00:00
Matthias Clasen
c97d02f487 docs: Mention child properties in builder docs
Clarify that there is no need for <child> if we have a property.
2024-02-25 21:46:11 -05:00
Matthias Clasen
36ced69ebf Merge branch 'matthiasc/for-main' into 'main'
Make one of the tests more robust

See merge request GNOME/gtk!6944
2024-02-26 01:36:15 +00:00
Matthias Clasen
427a52a9ad Make one of the tests more robust
The text-mixed-color-nocairo test was using a 20pt font, which
results in 16.6 pixels, which is prone to triggering rounding
errors and problems with fractional node bounds. Make it use
20px instead.
2024-02-25 20:03:35 -05:00
Matthias Clasen
9b5aee0d1b Cosmetics 2024-02-25 18:20:22 -05:00
Matthias Clasen
ee5afdf919 Merge branch 'fix-inhibit-idle-warning' into 'main'
application: Prevent a warning

Closes #6470

See merge request GNOME/gtk!6942
2024-02-25 14:05:11 +00:00
Rūdolfs Mazurs
49a6b5d50a Update Latvian translation 2024-02-25 13:36:27 +00:00
Matthias Clasen
dd7a0cbeb7 application: Prevent a warning
When we've handled a inhibit idle request via Wayland, there is
no need to call into the D-Bus inhibit api unless there's other
inhibit flags to handle.

Fixes: #6470
2024-02-25 08:21:05 -05:00
Sabri Ünal
38d808f3e2 Update Turkish translation 2024-02-25 13:08:46 +00:00
Andika Triwidada
16a608b9e5 Update Indonesian translation 2024-02-25 09:18:45 +00:00
Asier Sarasua Garmendia
f1ff37e970 Update Basque translation 2024-02-25 06:41:43 +00:00
Baurzhan Muftakhidinov
71c68f5f36 Update Kazakh translation 2024-02-25 04:41:15 +00:00
Matthias Clasen
0d3265edc7 Merge branch 'more-monitor-madness' into 'main'
wayland: Fix handling of output scales more

Closes #6472

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

Fixes: #6472
2024-02-24 20:56:19 -05:00
Logan Rathbone
882387a62a docs: Cross-reference GtkExpression binding method in GtkBuilder docs
The GtkBuilder docs previously only explained the GBinding methodology.
2024-02-24 13:54:35 -05:00
Logan Rathbone
73f7370ead docs: Clarify GtkExpression usage in .ui files 2024-02-24 13:54:35 -05:00
Logan Rathbone
8e9241f3ba docs: Remove unnecessary fetching of adjustment in :output code example 2024-02-24 13:54:35 -05:00
Logan Rathbone
3c67931f5f docs: Clarify child objects in GtkBuilder
Also, document the GListStore special case.
2024-02-24 13:54:34 -05:00
Yaron Shahrabani
06f3b5dfd4 Update Hebrew translation 2024-02-24 16:37:47 +00:00
Matthias Clasen
05acb70d1c Merge branch 'matthiasc/for-main' into 'main'
wayland: Fix handling of output scales

See merge request GNOME/gtk!6940
2024-02-24 12:00:16 +00:00
Matthias Clasen
7b380b2ffc wayland: Fix handling of output scales
Wayland protocols, in their wisdom, replaced xdg_output_done
with wl_output_done, just to make it more fun to handle multiple
protocol versions.
2024-02-23 22:50:58 -05:00
Matthias Clasen
f6e4b964b7 Merge branch 'gdkenums-formats' into 'main'
gdk: Improve docs for GdkMemoryFormat

See merge request GNOME/gtk!6939
2024-02-24 01:18:11 +00:00
Matthias Clasen
0b2d08f076 Merge branch 'fix-since-flag' into 'main'
gtkenums: Set since tag on POPOVER_MENU_SLIDING

See merge request GNOME/gtk!6938
2024-02-24 01:10:15 +00:00
Maximiliano Sandoval
1ad1a9fe4a gdkenums: Backtick the formats in docs 2024-02-24 01:12:59 +01:00
Maximiliano Sandoval
fe15db92bd gdkenums: Add docs for missing formats 2024-02-24 01:12:57 +01:00
Maximiliano Sandoval
682b7773fc gdkenums: Document Since tags for memory formats 2024-02-24 00:43:21 +01:00
Maximiliano Sandoval
9055b6c6e5 gtkenums: Set since tag on POPOVER_MENU_SLIDING
See d05f47a695 (note_2024930).
2024-02-24 00:19:18 +01:00
Danial Behzadi
9fd56dc5ad Update Persian translation 2024-02-23 20:50:54 +00:00
Matthias Clasen
1ec7f2bbcd Merge branch 'bilelmoussaoui/icons' into 'main'
icons: Set is_symbolic in IconPaintable.new_for_file

See merge request GNOME/gtk!6937
2024-02-23 20:42:45 +00:00
Bilal Elmoussaoui
4eb7208e35 icons: Set is_symbolic in IconPaintable.new_for_file
Otherwise symbolic icons won't be recognized as such.
Currently, in apps like Icon Library / App Icon Preview. Trying to
render the generated on-fly symbolic icons, require caching them in a
directory that mimics an icon theme and updating the search path of the
default gtk::IconTheme. That is mostly because
Gtk.IconPaintable.new_for_file wouldn't set is-symbolic even if the
passed file is a symbolic icon.
This would allow us to remove all the hacks in our apps
2024-02-23 18:43:06 +01:00
Andi Chandler
1ad88f7662 Update British English translation 2024-02-23 17:09:53 +00:00
Yuri Chornoivan
96b30073cf Update Ukrainian translation 2024-02-23 07:48:03 +00:00
Matthias Clasen
456956a2bd Merge branch 'matthiasc/for-main' into 'main'
entrybuffer: Fix some ubsan warnings

See merge request GNOME/gtk!6934
2024-02-23 01:47:25 +00:00
Matthias Clasen
4c794505da Merge branch 'michaelweghorn/a11y_report_empty_string' into 'main'
a11y: Report empty string as such

See merge request GNOME/gtk!6933
2024-02-23 01:06:10 +00:00
Gergo Koteles
34028ea31e GtkScale: move value in line with the through.
The value is between the through and the markups, and appears scattered.

Move it in line with the through.

Fixes: #5171
2024-02-23 02:04:24 +01:00
Gergo Koteles
4244314a40 GtkScale: add symmetry border to the scales without markups
The scales with marks require css adjustments for center positioning.

Add border to the other side to make it symmetrical.

Fixes: #5171
2024-02-23 01:58:47 +01:00
Matthias Clasen
f627c9443e wayland: Quiet an ubsan complaint
unsigned char is promoted to int, which lacks the 32nd bit to
make 0xff << 24 work. Explicitly cast to unsigned int to make
it clear what we want to happen.
2024-02-22 19:57:02 -05:00
Matthias Clasen
06fa9befe0 tree model: Fix some ubsan warnings
memcpy() does not accept NULL as arguments.
2024-02-22 19:27:33 -05:00
Matthias Clasen
a95dc5d609 entrybuffer: Fix some ubsan warnings
memcpy() does not accept NULL as argument.
2024-02-22 19:27:07 -05:00
Sebastian Keller
575bd64698 textview: Fix cursor/anchor mixup when retrieving surrounding text
Previously the code for calculating the cursor and anchor for the
flipped case was mixed up with the logic for the non-flipped case.

Additionally make the code more readable by making the anchor/selection
bound the start and the cursor/insert the end of a selection. Thus a
selection made from left to right goes from start to end. Selections
from right to left, i.e. end to start are considered flipped.

Also update the test to use the correct cursor/anchor and change some
variable names to make it more readable.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/6460
2024-02-22 20:49:10 +01:00
Ekaterine Papava
2abe588e91 Update Georgian translation 2024-02-22 18:50:15 +00:00
Fran Dieguez
ecdee288a7 Update Galician translation 2024-02-22 18:20:06 +00:00
Michael Weghorn
e363fcca3c a11y: Report empty string as such
While the text data returned by the `get_contents`
function from the `GtkAccessibleTextInterface` does not
have to be NUL-terminated,
`gtk_accessible_text_get_contents` returns the
text contents as NUL-terminated UTF-8 data.

An empty string (returned as empty, i.e. size = 0,
but not NULL GBytes* data by `get_contents`) is valid, and
therefore also needs to be NUL-terminated, so do this.

Without this, e.g. querying the text of an empty paragraph
in the Gtk 4 variant of LibreOffice with the newly added
GtkAccessibleInterface implementation [1] gives an incorrect
result.

Previous sample use in Accerciser's IPython console:

    In [24]: acc.queryText().getText(0, -1)
    Out[24]: '[Invalid UTF-8]'

With this change in place, it now returns an empty
string as expected:

    In [25]: acc.queryText().getText(0, -1)
    Out[25]: ''

[1] https://git.libreoffice.org/core/commit/e268efd612d12ae9a459d6b9d0cb23220f025163
2024-02-22 18:16:37 +01:00
Matthias Clasen
f46fb7c6fc Merge branch 'multilanguage-searching' into 'main'
Multilanguage searching for GtkEmojiChooser

This makes the Emoji chooser search look for strings in both
the current locale (if available), and in English. Each resource
file now contains the locale+English data. To accommodate the
changed dataset and schema, the recent-emoji settings key has
been renamed to recently-used-emoji.

See merge request GNOME/gtk!6804
2024-02-22 17:09:23 +00:00
Sudip Shil
985d964a34 Multilanguage searching for GtkEmojiChooser 2024-02-22 17:09:23 +00:00
Matthias Clasen
2a0286c19c Merge branch 'ebassi/issue-6462' into 'main'
a11y: Add "terminal" role

Closes #6462

See merge request GNOME/gtk!6932
2024-02-22 15:33:33 +00:00
Emmanuele Bassi
9a05af61e8 a11y: Map GTK terminal role to AT-SPI
AT-SPI has a terminal role for virtual terminals.

Fixes: #6462
2024-02-22 14:46:11 +00:00
Emmanuele Bassi
68d2e9c068 a11y: Add "terminal" role
Not in the WAI-ARIA spec, but UI toolkits have terminal widgets.
2024-02-22 14:46:11 +00:00
Ekaterine Papava
89ba937fd3 Update Georgian translation 2024-02-22 13:57:24 +00:00
Emmanuele Bassi
840cd6f10f Merge branch 'michaelweghorn/a11y_fix_atspi_getcharacteratoffset' into 'main'
a11y: Fix offset handling for AT-SPI GetCharacterAtOffset

See merge request GNOME/gtk!6931
2024-02-22 13:16:42 +00:00
Yuri Chornoivan
cccfc1a38d Update Ukrainian translation 2024-02-22 12:53:09 +00:00
Michael Weghorn
ff26aa2fa7 a11y: Fix offset handling for AT-SPI GetCharacterAtOffset
The text retrieved using `gtk_accessible_text_get_contents`
already contains only the character at the given offset,
and so the character is at index 0 in `str`, rather than at
the same offset again, so adjust this accordingly.

With this in place, querying the character in a
LibreOffice paragraph consisting of the text
"Hello world." now gives the expected results
with a pending LibreOffice change [1] to support
the new GtkAccessibleText interface:

    In [1]: text  = acc.queryText()
    In [2]: text.getCharacterAtOffset(0)
    Out[2]: 72
    In [3]: text.getCharacterAtOffset(1)
    Out[3]: 101
    In [4]: text.getCharacterAtOffset(2)
    Out[4]: 108
    In [5]: text.getCharacterAtOffset(3)
    Out[5]: 108
    In [6]: text.getCharacterAtOffset(4)
    Out[6]: 111

Previously, this would only work correctly
for an index of 0:

    In [1]: text = acc.queryText()
    In [2]: text.getCharacterAtOffset(0)
    Out[2]: 72
    In [3]: text.getCharacterAtOffset(1)
    Out[3]: 0
    In [4]: text.getCharacterAtOffset(2)
    Out[4]: 0
    In [5]: text.getCharacterAtOffset(3)
    Out[5]: 0
    In [6]: text.getCharacterAtOffset(4)
    Out[6]: 0

[1] https://gerrit.libreoffice.org/c/core/+/163733
2024-02-22 13:11:01 +01:00
Danial Behzadi
7192e67a6f Update Persian translation 2024-02-22 11:49:08 +00:00
Matthias Clasen
5354b91e64 Merge branch 'rendernode-tool-compare' into 'main'
rendernode tool: Add a compare command

See merge request GNOME/gtk!6930
2024-02-22 11:34:51 +00:00
Matthias Clasen
c9c6b7bb2a rendernode tool: Add a compare command
This command can be used to compare the rendering of a node
to a reference image. It can also be used to compare the
renderings of two nodes, or to compare two images.
2024-02-21 22:27:32 -05:00
Matthias Clasen
c93fa922dc Merge branch 'x11-shadow-fix' into 'main'
x11: Shadows require compositing

Closes #6464

See merge request GNOME/gtk!6928
2024-02-21 22:58:41 +00:00
Jordi Mas
8d7bfa2628 Update Catalan translation 2024-02-21 21:16:32 +01:00
Matthias Clasen
e6a4cc8ba2 x11: Shadows require compositing
We can only do client-side shadows if we have an rgba visual
and a compositing wm.

Fallout from 6e7893d5.

Fixes: #6464
2024-02-21 12:35:02 -05:00
Matthias Clasen
7926ee68b8 Merge branch 'matthiasc/for-main' into 'main'
editable: Less draconian preconditions

Closes #6463

See merge request GNOME/gtk!6927
2024-02-21 12:37:04 +00:00
Matthias Clasen
239d47791d editable: Less draconian preconditions
Getting or deleting an empty string should be ok, and we do it
ourselves, e.g. in the file chooser.

Fixes: #6463
2024-02-21 07:14:44 -05:00
Daniel Mustieles
33f210bc85 Update Spanish translation 2024-02-21 11:38:09 +00:00
Matthias Clasen
021aae84dd Post-release version bump 2024-02-20 15:02:39 -05:00
Matthias Clasen
e8508762f5 4.13.8 2024-02-20 15:02:39 -05:00
Matej Urbančič
a0bbdfbeee Update Slovenian translation 2024-02-20 19:42:53 +00:00
Matthias Clasen
f6561fc401 NEWS: Updates 2024-02-20 14:33:41 -05:00
Matthias Clasen
dfe56c8b70 Merge branch 'ebassi/accessible-text' into 'main'
a11y: Add GtkAccessibleText interface

Closes #5912

See merge request GNOME/gtk!6666
2024-02-20 19:22:02 +00:00
Matthias Clasen
7f29b466be Test the accessible implementation for GtkTextView 2024-02-20 13:53:08 -05:00
Matthias Clasen
8f5a185ae5 Test the accessible implementation for GtkInscription 2024-02-20 13:53:08 -05:00
Matthias Clasen
309b28fa2c Test the accessible implementation for GtkText 2024-02-20 13:53:08 -05:00
Matthias Clasen
e9f311e6b6 Test the accessible implementation for GtkLabel 2024-02-20 13:53:08 -05:00
Matthias Clasen
045262282b Implement GtkAccessibleText for GtkTextView 2024-02-20 13:53:08 -05:00
Matthias Clasen
a44701faa2 Implement GtkAccessibleText for GtkText 2024-02-20 13:53:08 -05:00
Matthias Clasen
eeee3151b6 Implement GtkAccessibleText in GtkInscription 2024-02-20 13:53:08 -05:00
Matthias Clasen
0cd077e80f Implement GtkAccessibleText for GtkLabel 2024-02-20 13:53:08 -05:00
Matthias Clasen
0e9b098f4e a11y: Add signals to GtkTestAtContext
Add signals, so we can check that text caret/selection/content
updates make it to the backend as expected.
2024-02-20 13:53:08 -05:00
Emmanuele Bassi
40b5002338 a11y: Emit the ATSPI text change notification events
Emit the signals on the D-Bus connection object, if one is available.
2024-02-20 13:53:08 -05:00
Emmanuele Bassi
28fd3fbf50 a11y: Emit the ATSPI caret and selection events
Provide an ATSPI implementation for the update_caret_position() and
update_selection_bound() virtual functions.
2024-02-20 13:53:08 -05:00
Matthias Clasen
10c782b106 a11y: Translate GtkAccessibleText to AT-SPI
Handle GtkAccessibleText in our translation layer, as far as
possible.
2024-02-20 13:53:08 -05:00
Matthias Clasen
5dd1803288 Merge branch 'x11_coords-relative-to-root' into 'main'
x11: Read window position relative to root window rather than parent

See merge request GNOME/gtk!6918
2024-02-20 18:18:41 +00:00
Matthias Clasen
7e9f2e2311 Merge branch 'editable-check-text' into 'main'
Add additional check for NULL text in GtkEditable

See merge request GNOME/gtk!6174
2024-02-20 18:15:42 +00:00
Matthias Clasen
610a5d6c0d a11y: Use the right enumeration type
The GtkAccessibleTextGranularity enum matches the corresponding ATSPI
one.
2024-02-20 12:19:56 -05:00
Matthias Clasen
5453628491 Don't forget to serialize overlines 2024-02-20 12:19:56 -05:00
Matthias Clasen
6e0596e122 a11y: Hoist Pango integration API up into GTK
We are going to use it in the AccessibleText implementations, so there's
no need to have it under a11y.

Also, change the apis from taking a GVariantBuilder to just return
plain arrays.
2024-02-20 12:19:56 -05:00
Matthias Clasen
0ca8d74842 a11y: Add GtkAccessibleText interface
The AccessibleText interface is meant to be implemented by widgets and
other accessible objects that expose selectable, navigatable, or rich
text to assistive technologies.

This kind of text is not covered by the plain accessible name and
description, as it contains things like a caret, or text attributes.

This commit adds a stub GtkAccessibleText with its basic virtual
functions; the interface will be implemented by widgets like GtkLabel,
GtkInscription, GtkText, and GtkTextView. A further commit will ensure
that the AT-SPI implementation will convert from GTK to AT-SPI through a
generic (internal API); and, finally, we'll remove the widget type
checks in the AT-SPI implementation of GtkATContext, and only check for
GtkAccessibleText.

Fixes: #5912
2024-02-20 12:19:48 -05:00
Matthias Clasen
04f8170841 Merge branch 'camelCaseNick/search-entry-input-hint-and-purpose' into 'main'
searchentry: pass through text's input-purpose and -hints as properties

See merge request GNOME/gtk!6921
2024-02-20 12:36:07 +00:00
Markus Göllnitz
1124793702 searchentry: pass through text's input-purpose and -hints as properties
The use cases for and reasons of having Gtk.SearchEntries
is wide range. Thus, it makes sense to let users of it
manually set input-purpose and input-hints for improved
input method support there.

see: https://gitlab.gnome.org/GNOME/Initiatives/-/issues/50

Signed-off-by: Markus Göllnitz <camelcasenick@bewares.it>
2024-02-20 04:10:23 +01:00
Matthias Clasen
8d4b0f05da Merge branch 'matthiasc/for-main' into 'main'
editable: Improve preconditions

See merge request GNOME/gtk!6920
2024-02-19 20:23:11 +00:00
Matthias Clasen
ca8ba8ce87 text:t Small fixes
gtk_editable_delete_text() takes a half-open interval, and accepts
an end_pos of -1 to mean 'all the way'. The GtkText implementation
was not handling these details correctly.
2024-02-19 15:04:42 -05:00
Matthias Clasen
849e3403cd editable: Improve preconditions
Check that the positions we're given make sense.
2024-02-19 15:04:39 -05:00
Matthias Clasen
02a7a30978 Merge branch 'disable-depth-test' into 'main'
GL, NGL: Disable depth test

Closes #6401

See merge request GNOME/gtk!6917
2024-02-19 19:14:36 +00:00
Luca Bacci
79568d2944 gpu: Disable GL_DEPTH_TEST
The call to enable depth testing was copied from the GL
renderer, but it's not needed.

Fixes #6401
2024-02-19 18:16:35 +01:00
Luca Bacci
ae45be7875 GL renderer: Disable GL_DEPTH_TEST
It was introduced in bbfe4324 to support GtkGLArea. It's not
needed anymore

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

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

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

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

References:

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

See #6401
2024-02-19 18:15:52 +01:00
Matthias Clasen
785aaa8c03 Merge branch 'fix_6454' into 'main'
a11y: Don't mark properties changed for unrealized AT contexts

Closes #6454

See merge request GNOME/gtk!6919
2024-02-19 16:42:36 +00:00
Lukáš Tyrychtr
1d7983da05 a11y: Don't mark properties changed for unrealized AT contexts
That might cause, for example, a description change notification for a widget
which was not seen by the AT previously.

Fixes #6454.
2024-02-19 16:54:11 +01:00
Ben Mather
cb652c7f0f x11: Read window position relative to root window rather than parent
This fixes monitor enter and leave events on X11, and probably other
things.  Previously, it looks like the coordinates were relative to the
top left corner of the window shadow and so never changed.
2024-02-19 14:21:57 +00:00
Matthias Clasen
a2b84fc98a Merge branch 'macos_arm' into 'main'
Add macOS CI for Apple Silicon

See merge request GNOME/gtk!6915
2024-02-19 12:29:09 +00:00
René de Hesselle
0d9bbc9d64 ci: Check for SDKROOT environment variable
The SDKROOT variable is _the_ "master switch" to set the target
OS version (much stricter compared to MACOSX_DEPLOYMENT_TARGET alone),
yet it has no impact on the output of 'xcodebuild -showsdks'.

Also rename the script to 'macos', it's not being called 'osx' anymore
since 2016 (Sierra).
2024-02-18 20:40:20 +01:00
René de Hesselle
6fd5e5f61c ci: Add job for Apple Silicon
This marks the beginning of transitioning to the arm64 architecture as
the default. The x86_64 job remains present but is being phased out of
24/7 operations, i.e. the job is now on-demand only.
2024-02-18 20:39:57 +01:00
René de Hesselle
b7285bd688 ci: Update meson and ninja to latest versions 2024-02-18 20:39:50 +01:00
René de Hesselle
938e50c876 ci: Use auditable sources for pkg-config and bison
We need to provide pkg-config and bison to build the introspection
feature. They were previously pre-installed on the runner and are now
provided by dedicated projects for better reproducability
to get away from "works on my machine".
2024-02-18 20:39:31 +01:00
René de Hesselle
e76bfcf2f6 ci: Remove pygobject, pycairo and cmake
They are not required anymore.

Use the system's Python 3 as we no longer need to match the version
with the externally provided wheels for pygobject and pycairo
(courtesy of Inkscape's CI that also runs on that machine).
2024-02-18 20:39:25 +01:00
Arjan Molenaar
ee06ac3ad2 macos: determine zoomed state via NSWindow isZoomed
With our custom logic out of the way, this just works.
Maximized state is also update on move, since a moved maximized
window is no longer considered maximized in macOS land.
2024-02-18 14:33:26 +01:00
Arjan Molenaar
19a8870f76 macos: use native zoom/unzoom logic
In macOS, when moving a maximized window, it's not automatically
restored to its default size.

In addition, GdkMacosWindow should not check surface layout properties,
since those properties are lagging, e.i. are set after the (native)
window state has been updated.
2024-02-18 14:33:26 +01:00
Asier Sarasua Garmendia
d828f2477e Update Basque translation 2024-02-18 07:47:54 +00:00
Arjan Molenaar
99a3a7e94e macos: deduplicate compute_size logic
It's used in `present` currently. Need to figure out if it really
belongs there: in Wayland no size computation is done in the
`present` handler.
2024-02-17 22:47:47 +01:00
Aurimas Černius
4d2bad4c11 Update Lithuanian translation 2024-02-17 21:23:13 +00:00
Yaron Shahrabani
ed14df9738 Update Hebrew translation 2024-02-17 21:06:04 +00:00
Arjan Molenaar
a516441513 macos: Fix window state of initially maximized windows
GdkSurface maintains state that shadows the actual window state.
This state is not always updated in the macos backend.

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

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

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

See merge request GNOME/gtk!6869
2024-02-17 14:06:10 +00:00
Matthias Clasen
bc83969f6b Merge branch 'macos_ci' into 'main'
Build more things in macOS CI

See merge request GNOME/gtk!6908
2024-02-17 14:05:42 +00:00
René de Hesselle
dff8e34bc9 ci: Refactor job to use flags 2024-02-17 14:31:51 +01:00
René de Hesselle
6d9662cf8d ci: Do not set c++11 for macOS 2024-02-17 14:31:51 +01:00
René de Hesselle
2e6b32083e ci: Enable simd for libjpeg-turbo on macOS 2024-02-17 14:31:51 +01:00
René de Hesselle
b4b42a462a ci: Enable pixman tests for macOS 2024-02-17 14:31:51 +01:00
René de Hesselle
a48a2a3dc9 ci: Build testsuite for macOS
To make it work on macOS, do not add typelibdir to GI_TYPELIB_PATH.
While this change affects all the other jobs as well, it appears to
be of no consequence.
2024-02-17 14:31:51 +01:00
René de Hesselle
9628599620 ci: Build examples for macOS 2024-02-17 14:31:51 +01:00
René de Hesselle
3a4d5ff5c3 ci: Build demos for macOS 2024-02-17 14:31:51 +01:00
Juliano de Souza Camargo
e7fa2571ca Update Brazilian Portuguese translation
(cherry picked from commit 4b0d3d8326)
2024-02-17 12:15:11 +00:00
Matthias Clasen
ad719a9c47 Merge branch 'ink-rect-fixaroo' into 'main'
gsk: Stop padding text node bounds

See merge request GNOME/gtk!6912
2024-02-16 20:30:45 +00:00
Benjamin Otte
0c4ea9bc7c Merge branch 'wip/otte/for-main' into 'main'
gpu: External textures are never mipmap'able

See merge request GNOME/gtk!6911
2024-02-16 20:11:06 +00:00
Matthias Clasen
24de5ffd4e gsk: Stop padding text node bounds
This should not be necessary, provided that the ink extents that
pango provides are accurate.

Update affected tests.
2024-02-16 14:45:20 -05:00
Benjamin Otte
4933bc505f gpu: External textures are never mipmap'able
We were just assuming they were if the format matches.

Fixes crashes in Webkit where the external texture is actually a dmabuf
imported as an EGL image.
2024-02-16 20:16:38 +01:00
Matthias Clasen
ecbee35f93 Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Add keywords to some demos

See merge request GNOME/gtk!6910
2024-02-16 16:37:07 +00:00
Matthias Clasen
5552b5c0ec ci: Add another xfail
This is reported in
https://gitlab.gnome.org/GNOME/gtk/-/issues/6450
2024-02-16 11:13:57 -05:00
Matthias Clasen
2baa899e32 NEWS: Add a new about mesa versions 2024-02-16 10:55:05 -05:00
Matthias Clasen
aaaddd1b47 testsuite: Mark the randomized path tests as flaky
They are, and having them run in ci is counterproductive for now.
2024-02-16 10:24:58 -05:00
Matthias Clasen
d4d4c7e119 gtk-demo: Add keywords to some demos
Folks had trouble finding the 'suggestion entry' demo.
2024-02-16 10:13:55 -05:00
Matthias Clasen
ea33264a87 Merge branch 'wip/abono/meson-dma-buf' into 'main'
meson: Don't make linux/dma-buf.h a requirement for Linux

See merge request GNOME/gtk!6904
2024-02-16 14:40:21 +00:00
Alessandro Bono
4054f33221 meson: Don't fail when linux/dma-buf.h is missing
We just don't define HAVE_DMABUF in this case.
2024-02-16 14:04:46 +01:00
Alessandro Bono
b6767d2eef meson: Decouple linux/dma-buf.h and libdrm checks
Currently dmabuf_dep is found when the following conditions are met:
 - linux/dma-buf.h is present;
 - libdrm is found.

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

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

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

Given that now we unconditionally require libdrm on Linux, HAVE_DMABUF
depends only on the linux/dma-buf.h presence.
2024-02-16 14:01:44 +01:00
Matthias Clasen
90d84a2af8 Merge branch 'michaelweghorn/a11y_fix_accessible_at_point' into 'main'
a11y: Return the actual object at the point requested by AT-SPI "GetAccessibleAtPoint"

Closes #6448

See merge request GNOME/gtk!6909
2024-02-15 18:10:53 +00:00
Alessandro Bono
eb34311c2c meson: Sort alphabetically 2024-02-15 18:25:27 +01:00
Michael Weghorn
ea7ddc031c a11y: Fix bounds check for AT-SPI GetAccessibleAtPoint
In `accessible_at_point`, fix the check whether the
given point is inside of the accessible's bounds.

For that to be the case, the point's x coordinate
must be somewhere between the X position of the
accessible's bounds and that position + width.
(Likewise for the y coordinate and the height.)

the previous check would only work correctly
for children located at a relative location
of (0, 0) within the parent.

With this and the previous commit in place,
the (extended) example from issue #6448 now gives
the expected result:
an accessible object in whose bounds include
requested point (50, 50) lies:

    In [19]: acc.queryComponent().getExtents(pyatspi.WINDOW_COORDS)
    Out[19]: [0, 0, 800, 600]
    In [20]: acc.queryComponent().getAccessibleAtPoint(50, 50, pyatspi.WINDOW_COORDS)
    Out[20]: <Atspi.Accessible object at 0x7fae500e9180 (AtspiAccessible at 0x33455b0)>
    In [21]: acc.queryComponent().getAccessibleAtPoint(50, 50, pyatspi.WINDOW_COORDS).queryComponent().getExtents(pyatspi.WINDOW_COORDS)
    Out[21]: [6, 1, 68, 49]

Fixes: #6448
2024-02-15 18:11:55 +01:00
Michael Weghorn
1ff17f1a7e a11y: Ensure accessible queried by GetAccessibleAtPoint is realized
In the the handling of the "GetAccessibleAtPoint" AT-SPI Component
method, make sure that the context of the accessible at the
given point is realized so that a reference can be returned.

Otherwise, the called `gtk_at_spi_context_to_ref` will return
a null ref instead.

The same is already done in the handling for other AT-SPI methods,
(s. "GetRelationSet", "GetChildren", "GetChildAtIndex" in
gtk/a11y/gtkatspicontext.c).

With this in place, an accessible will be returned.
It's not necessarily the one that's really at the requested location,
but that's a different issue that will be addressed in a separate
commit.

With this in place, example from issue #6448 now gives this result
when using Accerciser's IPython console:

    In [16]: acc.queryComponent().getExtents(pyatspi.WINDOW_COORDS)
    Out[16]: [0, 0, 800, 600]
    In [17]: acc.queryComponent().getAccessibleAtPoint(50, 50, pyatspi.WINDOW_COORDS)
    Out[17]: <Atspi.Accessible object at 0x7fae500e8540 (AtspiAccessible at 0x308bf40)>
    In [18]: acc.queryComponent().getAccessibleAtPoint(50, 50, pyatspi.WINDOW_COORDS).queryComponent().getExtents(pyatspi.WINDOW_COORDS)
    Out[18]: [683, 1, 111, 49]

-> an accessible is returned now, but its rectangle starts at
X coordinate 683, so the requested point (50, 50) is not in its
bounding box.

Issue: #6448
2024-02-15 18:11:09 +01:00
Fran Dieguez
8232ab4440 Update Galician translation 2024-02-15 02:26:47 +00:00
Matthias Clasen
bb82e3e1fb Merge branch 'matthiasc/for-main' into 'main'
testsuite: Drop duplicated rounded-rect tests

See merge request GNOME/gtk!6907
2024-02-14 20:21:47 +00:00
Benjamin Otte
1702cdaff6 Merge branch 'wip/otte/for-main' into 'main'
gpu: Render enough of a scaled texture offscreen

Closes #6428 and #6439

See merge request GNOME/gtk!6902
2024-02-14 19:30:58 +00:00
Matthias Clasen
a4583b03a1 testsuite: Drop duplicated rounded-rect tests
No need to test this twice in a row.
2024-02-14 14:12:43 -05:00
Benjamin Otte
b12169776e testsuite: Print random clip rect
That makes it in test log output, which helps when figuring out why a
test failed if the node was not saved/is already deleted.
2024-02-14 20:12:05 +01:00
Benjamin Otte
85f85bbec8 build: Keep artifacts from asan build
We want to be able to investigate occasional failure results, in
particular those with randomness.
2024-02-14 20:12:05 +01:00
Benjamin Otte
afc7b46264 gpu: Add an epsilon before ceil()ing for offscreen size
Avoids getting the scale wrong when due to a rounding error our
pixel-aligned rectangle is 5.000000003px big and we ceil() to 6px
and produce blurry output.

Fixes #6439
2024-02-14 20:11:59 +01:00
Benjamin Otte
86db9e2ce0 gsk: Use gsk_rect_scale() in more places 2024-02-14 20:11:30 +01:00
Benjamin Otte
1afc7a9210 testsuite: Add a test for scaled texture clipping
This tests that the result is suitably clipped for doing linear
blending - the rightmost green pixel that is technically offscreen
is blending into the red pixel and turning the test yellow.

Cairo gets this wrong for some reason I didn't investigate.
2024-02-14 20:11:30 +01:00
Benjamin Otte
cb6c720d37 gpu: Render enough of a scaled texture offscreen
We were not thinking about pixel alignment and the potential later
linear blend for the final composite.

Fixes #6428
2024-02-14 20:11:29 +01:00
Matthias Clasen
35eae8751f Merge branch 'fix-rounded-rect-intersection' into 'main'
Add more rounded-rect intersection tests

Closes #6440

See merge request GNOME/gtk!6905
2024-02-14 18:59:32 +00:00
Matthias Clasen
a246d1a995 ci: Add an xfail
Add an xfail for the issue reported in #6444.
2024-02-14 13:32:37 -05:00
Jordi Mas
718d68eccd Update Catalan translation 2024-02-14 17:36:19 +01:00
Matthias Clasen
fb4023af22 Fix rounded rect intersection code
The code was written under the assumption that the corners of
the rounded rect are disjoint. If they aren't, there are a few
more cases to consider.

Fixes: #6440
2024-02-14 10:37:56 -05:00
Matthias Clasen
370ecd5d15 Add more rounded-rect intersection tests
Add rounded rect intersection tests with difficult rounded rects
where the corners are not disjoint (the 'evil eye').

The first half of these tests were provided by Benjamin Otte
in #6440, the other half was added by me to cover the flipped
version of the evil eye.
2024-02-14 10:37:56 -05:00
Matthias Clasen
fdff21ae13 testsuite: Don't use g_test_init
g_test_init has the ugly habit of aborting if G_DISABLE_ASSERT
is defined, and we want to run our tests in a release build too.

Use gtk_test_init instead, which works around this issue.
2024-02-14 10:37:56 -05:00
Matthias Clasen
69500f356e Merge branch 'normalize-node-bounds' into 'main'
Add gsk_rect_normalize

Closes #6435

See merge request GNOME/gtk!6901
2024-02-14 02:08:11 +00:00
Matthias Clasen
3b794c4951 Add a test for node bounds normalization
This tests the fixes in the previous commits for some node types.
2024-02-13 20:06:16 -05:00
Matthias Clasen
72614fdb67 gsk: Normalize node bounds upon creation
We lost this when a bunch of rect code was inlined in
commit 36314f28e2, and as it turns out, that broke some
applications. So, bring it back.

Fixes: #6435
2024-02-13 20:06:16 -05:00
Matthias Clasen
230ee92857 Add gsk_rect_normalize
This is an inline version of graphene_rect_normalize_in_place.
2024-02-13 20:06:16 -05:00
Daniel Rusek
c6c952477a Update Czech translation 2024-02-14 01:04:19 +00:00
Matthias Clasen
fd4f22bba5 Merge branch 'matthiasc/for-main' into 'main'
tests: Remove xfails for tests that work now

See merge request GNOME/gtk!6900
2024-02-13 23:54:23 +00:00
Matthias Clasen
1e8d7c7891 tests: Add a new xfail for a failing test
This is filed as #6439
2024-02-13 18:35:13 -05:00
Matthias Clasen
73316a83c4 tests: Remove xfails for tests that work now
We fixed some things, yay.
2024-02-13 17:31:18 -05:00
Matthias Clasen
b2d22d8125 Merge branch 'wip/abono/fallthrough' into 'main'
gsk: Remove unnecessary G_GNUC_FALLTHROUGH

See merge request GNOME/gtk!6898
2024-02-13 22:17:50 +00:00
Benjamin Otte
afb75bedfe Merge branch 'wip/otte/for-main' into 'main'
gpu: Don't oversize node image

Closes #6380 and #6425

See merge request GNOME/gtk!6899
2024-02-13 21:14:20 +00:00
Benjamin Otte
ee34781a13 gpu: Pixel-align the blur rectangle
Fixes blurriness in shadows.

Not sure to do a proper test for this feature. Usually proper pixel
alignment is tested by drawing a crips line and checking that it is
indeed crisp. But we are testing the blur operation here...

Fixes #6380
2024-02-13 21:56:01 +01:00
Benjamin Otte
9fc80a0bd5 gpu: Update blur code to newer internal API
The recommended way to draw offscreens has been init_draw() for a bit,
but apparently this code wasn't updated.
2024-02-13 21:56:01 +01:00
Benjamin Otte
d4203d147a testsuite: Add a test for shadow offset clipping 2024-02-13 21:56:01 +01:00
Benjamin Otte
a1dda0ec3c gpu: Adjust shadows clip by shadow offset
When computing the clip of the shadow rect, don't forget that it will
ultimately be offset by the shadow offset.

Fixes #6425
2024-02-13 21:56:01 +01:00
Benjamin Otte
f9b66dff8b testsuite: Add a test for shadows with large offset
This was causing crashes in the GPU renderer.

Related: #6425
2024-02-13 21:56:01 +01:00
Benjamin Otte
dbbc16947f gpu: Handle one layer of NULL return
This isn't really a useful thing in itself, because none of the callers
handle the NULL return.
But the resulting crash is easier to debug when it's a NULL image than
when add_node() is called on an uninitializes NodeProcessor.
2024-02-13 21:56:01 +01:00
Benjamin Otte
dc47abc60e gpu: Don't oversize node image
There's no need - even if given clip bounds - to render the parts
outside the node.

So clip to the node bounds.
2024-02-13 21:56:01 +01:00
Alessandro Bono
ca9ba3cc80 gsk: Remove unnecessary G_GNUC_FALLTHROUGH
In GSK the following pattern is used four times:
```
  switch (self->filter)
    {
      default:
        g_assert_not_reached ();
        G_GNUC_FALLTHROUGH;
      case GSK_GPU_BLIT_LINEAR:
        filter = GL_LINEAR;
        break;

      case GSK_GPU_BLIT_NEAREST:
        filter = GL_NEAREST;
        break;
    }
```
The G_GNUC_FALLTHROUGH macro is not required. When G_DISABLE_ASSERT
is defined the body of the `default` case is empty, thus there is
no need. When G_DISABLE_ASSERT is not defined the body of the `default`
case contains g_assert_not_reached() thus it won't fallthrough.

This resolves the following:
```
[221/1379] Compiling C object gsk/libgsk.a.p/gpu_gskgpublitop.c.o
[...]
error: fallthrough annotation in unreachable code [-Werror,-Wimplicit-fallthrough]
1 error generated.
```
2024-02-13 18:29:03 +01:00
Artur S0
59f6218426 Update Russian translation 2024-02-13 16:32:44 +00:00
Matthias Clasen
f533d08537 Merge branch 'matthiasc/for-main' into 'main'
gpu: Print globals when being verbose

See merge request GNOME/gtk!6897
2024-02-13 14:00:30 +00:00
Matthias Clasen
230aa7899e Merge branch 'wip/abono/dma-buf' into 'main'
dmabufformats: Include gdkdmabuffourccprivate.h

See merge request GNOME/gtk!6896
2024-02-13 13:59:26 +00:00
Alessandro Bono
cc51604267 dmabufformats: Include gdkdmabuffourccprivate.h
It includes a fallback list of fourccs. Otherwise we might miss some
DRM_FORMAT definition.

This happens in SLES12:
```
../testsuite/gdk/dmabufformats.c: In function ‘test_dmabuf_formats_basic’:
../testsuite/gdk/dmabufformats.c:29:56: error: ‘DRM_FORMAT_ABGR16161616F’ undeclared (first use in this function); did you mean ‘DRM_FORMAT_ABGR2101010’?
   29 |   g_assert_true (gdk_dmabuf_formats_contains (formats, DRM_FORMAT_ABGR16161616F, DRM_FORMAT_MOD_LINEAR));
```
2024-02-13 14:15:32 +01:00
Alessandro Bono
3b2622267d testdmabuf: Include gdkdmabuffourccprivate.h
It includes a fallback list of fourccs. Otherwise we might miss some
DRM_FORMAT definition.
2024-02-13 14:15:32 +01:00
Alessandro Bono
4fc05e7c64 dmabuftexture: Include gdkdmabuffourccprivate.h
It includes a fallback list of fourccs. Otherwise we might miss some
DRM_FORMAT definition.
2024-02-13 14:15:32 +01:00
Alessandro Bono
4e680cae48 gtkgstsink: Include gdkdmabuffourccprivate.h
It includes a fallback list of fourccs. Otherwise we might miss some
DRM_FORMAT definition.
2024-02-13 14:15:32 +01:00
Alessandro Bono
d957e40a63 gdkglcontext: Include gdkdmabuffourccprivate.h
It includes a fallback list of fourccs. Otherwise we might miss some
DRM_FORMAT definition.
2024-02-13 14:15:32 +01:00
Alessandro Bono
d1bc8e580d gdkdmabuffourccprivate: Include config.h
Do so before checking HAVE_DMABUF presence.
2024-02-13 14:15:32 +01:00
Sabri Ünal
5dadee1591 Update Turkish translation 2024-02-13 12:10:05 +00:00
Matthias Clasen
ea7a61a763 gpu: Print globals when being verbose
This can be helpful to see that there is an enormous scale blowing
things up. We omit the matrix, since it is 16 floats that are hard
to interpret at a glance.
2024-02-13 06:59:58 -05:00
Matthias Clasen
8bd6927daf Merge branch 'dboles/CSSProvider-to_string-load_from_string' into 'main'
CSSProvider: Mention non-deprecated fn @ to_string

See merge request GNOME/gtk!6894
2024-02-12 23:32:23 +00:00
Matthias Clasen
67912c1051 Merge branch 'inspector-gl-extensions' into 'main'
gl: Check for the right extension name

See merge request GNOME/gtk!6893
2024-02-12 22:55:05 +00:00
Matthias Clasen
6314a5240d inspector: Show more gl extensions 2024-02-12 16:57:46 -05:00
Daniel Boles
e7f55d8706 CSSProvider: Mention non-deprecated fn @ to_string
load_from_data() is deprecated, so don't cite it in to_string(); rather,
mention load_from_string() instead.
2024-02-12 21:28:24 +00:00
Matthias Clasen
671756cb13 Merge branch 'llvmpipe-be-gone' into 'main'
gsk: Don't use gpu renderers with llvmpipe

See merge request GNOME/gtk!6890
2024-02-12 21:16:48 +00:00
Matthias Clasen
7cf567b4f9 gl: Check for the right extension name
The extension is called GL_OES_vertex_half_float.
2024-02-12 16:13:54 -05:00
Yuri Chornoivan
82e695d94a Update Ukrainian translation 2024-02-12 20:09:57 +00:00
Matthias Clasen
2104d7b062 fixup! gsk: Don't use gpu renderers with llvmpipe 2024-02-12 14:41:14 -05:00
Matthias Clasen
6c4739a2f1 gsk: Don't use gpu renderers with llvmpipe
Unless the renderer has been explicitly selected via the
GSK_RENDERER environment variable, don't use it with llvmpipe.

It is important that we allow explicit setting to override
this, so we can continue to use ngl in ci, where we don't
have hw and want to test with llvmpipe.

This should address many of the "performance is terrible in
GNOME OS" complaints that are coming from people running in
VMs, etc.
2024-02-12 14:19:57 -05:00
Matthias Clasen
f858daeca4 node-editor: Don't help too much
This was somehow duplicated when the reload action was added.
2024-02-12 14:19:21 -05:00
Matthias Clasen
efa0033fb4 inspector: Spell out Vulkan device types
We know what these are, no need to be mysterious about it.
2024-02-12 14:19:21 -05:00
Matthias Clasen
546378e65c Merge branch 'no_duplicate_descriptions' into 'main'
a11y: When using the tooltip for accessible name, don't use it for description

See merge request GNOME/gtk!6829
2024-02-12 17:04:43 +00:00
Matthias Clasen
a997dea414 Merge branch 'link-to-code-formatting-changed' into 'main'
clang-format: The link to code formatting has changed

See merge request GNOME/gtk!6891
2024-02-12 17:03:37 +00:00
Danial Behzadi
e75af999dc Update Persian translation 2024-02-12 15:56:40 +00:00
Ahmed Baizid
e8dcbbe86f clang-format: The link to code formatting has changed 2024-02-12 15:51:41 +01:00
Matthias Clasen
3c048caa30 Merge branch 'wip/nacho/scale-button-has-frame' into 'main'
scalebutton: add api to get/set whether it has a frame

See merge request GNOME/gtk!6779
2024-02-12 14:19:45 +00:00
Matthias Clasen
925d2ba9ae Merge branch 'wip/otte/for-main' into 'main'
gpu: Avoid offscreens for disjoint containers

See merge request GNOME/gtk!6889
2024-02-12 12:58:14 +00:00
Ekaterine Papava
645070ef7f Update Georgian translation 2024-02-12 11:41:10 +00:00
Benjamin Otte
2fe1f47e6d gpu: Avoid offscreens for disjoint containers
When opacity is set but the container is disjoint - ie no children
overlap - don't redirect into an offscreen, because it's not necessary.
2024-02-12 08:34:18 +01:00
Matthias Clasen
db8f87d539 Post-release version bump 2024-02-11 22:45:59 -05:00
Matthias Clasen
a75d97c788 4.13.7 2024-02-11 22:38:52 -05:00
Matthias Clasen
ea9e414ad6 Skip one more failing clipped render test 2024-02-11 22:38:52 -05:00
Matthias Clasen
c1bcbcdee5 Merge branch 'offload-padding' into 'main'
offload: handle dmabufs with viewports

See merge request GNOME/gtk!6833
2024-02-12 03:12:46 +00:00
Robert Mader
8f293f3153 gstreamer: Bump required version for offloading
This version is guaranteed to have all features in place.
2024-02-11 21:50:50 -05:00
Matthias Clasen
70380661fe testdmabuf: Test dmabuf viewports
Allow specifying padding via --padding. The argument to --padding
is a string of up to 4 comma-separated numbers, for the left, right,
top, bottom padding. If less numbers are given, the remaining ones
are set to zero.

This commit also includes an image that can be used for testing with

testdmabuf --padding 20,20,20,20 NV12 padded.png
2024-02-11 21:49:34 -05:00
Matthias Clasen
d91d0f1c0a gstreamer: Pass viewport along
Obtain the viewport from gstreamer, and pass it to the paintable
implemenation, which adds a clip node around the texture to enforce
the viewport.
2024-02-11 21:44:47 -05:00
Matthias Clasen
1db696be79 offload: Find and use source rectangle
Look for nodes like subsurface { clip { texture {} } }, and use
the clip to provide a source rectangle for subsetting the texture.

Update affected tests, and add a new one.
2024-02-11 21:44:47 -05:00
Matthias Clasen
9a30ea1f69 subsurface: Have a source rectangle
This will let us use a subset of the full texture, which can
be necessary in the case that converters put padding around
content in dmabufs. The naming follows the Wayland viewporter
spec.

For now, make all callers pass the full texture rect.
2024-02-11 21:44:27 -05:00
Matthias Clasen
0495359eca subsurface: Rename rect to dest
We are going to introduce another rect, so better to be clear in
naming. We are following the naming of the Wayland viewporter spec
and call the rectangle that we drawing into the dest(ination).
2024-02-11 21:43:51 -05:00
Matthias Clasen
1995b9d92c Merge branch 'wip/otte/offload' into 'main'
Rework offload diff handling

See merge request GNOME/gtk!6879
2024-02-12 02:33:14 +00:00
Matthias Clasen
29c0babdda Merge branch 'matthiasc/for-main' into 'main'
testdmabuf: Add another shortcut

See merge request GNOME/gtk!6888
2024-02-12 02:15:22 +00:00
Matthias Clasen
5b55456b75 Rework diffing one more time
Pass the surface along. We need it to identify the inspector case
in gsk_subsurface_node_diff.
2024-02-11 20:48:59 -05:00
Matthias Clasen
70205f59a4 Merge branch 'render-clip-tests' into 'main'
gsk: Add a clip variant to compare tests

See merge request GNOME/gtk!6880
2024-02-12 01:45:55 +00:00
Matthias Clasen
df7889d7f3 testdmabuf: Add another shortcut
Make the picture not expand, and add Ctrl-S to toggle the
horizontal alignment between start and center. This makes the
offloaded picture move under the overlaid controls, or out
from under them, triggering some offloading transitions.
2024-02-11 20:43:56 -05:00
Matthias Clasen
26c25cc6b7 Simplify gsk_subsurface_node_diff
Most of the time, the subsurfaces will be the same. And if they
aren't, can_diff() will return FALSE anyway.
2024-02-11 20:24:28 -05:00
Matthias Clasen
2cf90b6158 tests: Add a note
Point out a little gotcha.
2024-02-11 20:24:28 -05:00
Matthias Clasen
f8e89f2224 offload: Do diff collection later
We were collecting diffs based on the can_offload/can_raise
information, but attaching the texture to the subsurface can
fail (e.g. if its not a dmabuf texture), in which case can_offload
turned out to be wrong. So move the diff collection to the end
and do it based on the whether we actually succeeded in attaching
the texture.
2024-02-11 20:24:28 -05:00
Benjamin Otte
30afac9a6b offload: No need to pass the offload to the diff
We can just check if the subsurfaces contain content - and if they do,
they will be offloading and we can ignore the diff.

This essentially reverts 48740de71a
2024-02-11 20:24:28 -05:00
Benjamin Otte
dac56dd757 offload: Change the way we compute damage regions
Instead of relying on diffing subsurface nodes, we track damage
generated by offloaded contents inside GskOffload.

There are 3 stages a subsurface node can be in:

1. not offloaded
   Drawing is done by the renderer
2. offloaded above
   The renderer draws nothing
3. offloaded below
   The renderer needs to punch a hole.

Whenever the stage changes, we need to repaint.
And that can happen without the subsurface's contents changing, like
when a widget is put above the subsurface and it needs to to go from
offloaded above to below.

So we now recruit GskOffload for tracking these changes, instead of
relying on the subsurface diffing.

But we still need the subsurface diffing code to work for the
non-offloaded case, because then the offloading code is not used.
So we keep using it whenever that happens.

Not that when a subsurface transitions between being offloaded and not
being offloaded, we may diff it twice - once in the offload code and
once in the node diffing - but that shouldn't matter.
2024-02-11 20:24:28 -05:00
Benjamin Otte
e4ca3a285e gsk: Split out a function
I want to use it elsewhere.

I didn't come up with a better name, if anyone knows one, please
rename.
2024-02-11 20:24:28 -05:00
Benjamin Otte
30b5a33444 rendernode: Fix subsurface diff code 2024-02-11 20:24:28 -05:00
Benjamin Otte
e647ebae87 rendernode: Do full diff when starting/stopping offload
When a subsurface goes from not offloaded to offloaded (or vice versa),
we need to add the whole node to the diff region, because we switch from
whatever contents were drawn to a punched hole.
2024-02-11 20:24:28 -05:00
Matthias Clasen
0b34af438f ci: Add more xfails
These showed up in ci.
2024-02-11 20:22:16 -05:00
Matthias Clasen
a9949a102b Merge branch 'matthiasc/for-main' into 'main'
gsk: Make matrix transforms roundtrip better

See merge request GNOME/gtk!6886
2024-02-12 01:18:34 +00:00
Matthias Clasen
90296dab76 Merge branch 'wip/otte/for-main' into 'main'
dmabuf: Make init_dmabuf() restore the previous GL context

Closes #6398

See merge request GNOME/gtk!6887
2024-02-12 01:04:14 +00:00
Matthias Clasen
ed605f01a2 testsuite: Give up on cairo for clipping tests
Cairo has a number of problems with clipping, such as

https://gitlab.freedesktop.org/cairo/cairo/-/issues/821
https://gitlab.gnome.org/GNOME/gtk/-/issues/6426
https://gitlab.gnome.org/GNOME/gtk/-/issues/6427

These require cairo fixes that are hard to come by, given
the maintainership situation. And since these the clipping
tests are randomized, such failures will pop up randomly,
making it very frustrating to deal with ci.

So lets focus these tests on the places where it is easier
to get fixes, and run the clipping tests only for the
other renderers.
2024-02-11 19:50:18 -05:00
Matthias Clasen
bed3c6f807 ci: Add xfails for some known issues
Add xfails for failing compare tests where we have known issues,
and annotate them.
2024-02-11 19:50:18 -05:00
Matthias Clasen
f6221835ef build: Compactify compare test setup
Make a loop over the variants we have, rather than duplicating
so much code.
2024-02-11 19:50:18 -05:00
Matthias Clasen
7e9ce1b266 compare-render: Add a --plain argument
This is entirely ignored, but having an argument to specify
for 'run tests as-is' makes the meson code simpler.
2024-02-11 19:50:18 -05:00
Matthias Clasen
c40f29cb54 build: Drop an unused array 2024-02-11 19:50:18 -05:00
Matthias Clasen
d7afa91023 gsk: Add a clip variant to compare tests
This creates a random clip rect and applies it as a clip node.

Currently, a bunch of the tests fail and need tracking down.
2024-02-11 19:50:18 -05:00
Matthias Clasen
9bd6d431af ci: Capture generated node files for gsk tests
For some of the compare render variations (mask, clip, etc), it
can be quite useful to have the generated node file around to
reproduce the problem.
2024-02-11 19:41:21 -05:00
Benjamin Otte
f126986c2b dmabuf: Make init_dmabuf() restore the previous GL context
Random code can call that function and cause unexpected GL context
changes. This is especially bad because it can happen nested.

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

Fixes #6398
2024-02-12 01:39:32 +01:00
Matthias Clasen
865564b32f gsk: Make matrix transforms roundtrip better
When we parse a 2D matrix, we produce a 2D transform, and we
can easily regenerate a 2D matrix from it.

Tests included.
2024-02-11 19:39:19 -05:00
Benjamin Otte
3ae6da10b1 Merge branch 'wip/otte/for-main' into 'main'
Fix pixel alignment on fractional scales

See merge request GNOME/gtk!6885
2024-02-11 20:10:33 +00:00
Benjamin Otte
1b9002afd3 ngl: Check for GL 3.3
The default check is still for GL 3.0 and we don't support that.
2024-02-11 20:04:54 +01:00
Benjamin Otte
9e72260c3b testsuite: Add a compare test for non-integer repeat children
This encodes the problems from the harmless looking example from
  https://blog.gtk.org/2024/01/28/new-renderers-for-gtk/
in a form that we can test.

Unsurprisingly it doesn't work on GL and Cairo.
2024-02-11 20:04:54 +01:00
Benjamin Otte
9d52b4e269 testsuite: Add another test for pixel alignment
Tests the rounding fixes from the previous commit.

I'm not disabling it on GL because it succeeds - but that is somewhat by
accident I guess.
2024-02-11 20:04:54 +01:00
Benjamin Otte
6ed4eece04 gpu: debug-print the used shader clip
When using GSK_DEBUG=verbose, print the clip mode used in the shader.

Use cute little unicode indicators to not overload the debug output.
2024-02-11 20:04:54 +01:00
Benjamin Otte
cfaddb5d47 gpu: Use nodprocessor infrastructure for offscreening
The just copied over function can just use the same infrastructure as
the other functions we already have that create slightly adjusted
offscreens.
2024-02-11 20:04:54 +01:00
Benjamin Otte
7c861d8b59 gpu: Don't clip again after already clipping
The 2 callers of gsk_gpu_get_node_as_image() were already computing the
minimum clip region and in particular aligning it to the pixel grid, so
intersecting with node bounds again was causing that alignment to be
busted.
2024-02-11 20:04:54 +01:00
Benjamin Otte
1c3457adfb gpu: Fix sizing of fractionally scaled backbuffer
When using a window size and scale that don't multiply to an integer, we
were using the wrong method to adjust it.

The Wayland fractional scaling spec just says:

> For toplevel surfaces, the size is rounded halfway away from zero.

This is meant to be interpreted as "create a large enough buffer to hold
partial pixels) and the compositor will blend it mapping to the pixel
grid" even if that means the buffer slightly overhangs.

Example:
A 11 units wide window at 150% will need a 11 * 1.5 = 16.5 pixel wide
buffer. This should be rounded to 17 pixels but rendered as if only 16.5
pixels are occupied by the window, not as if all 17 pixels are occupied.
2024-02-11 20:04:54 +01:00
Benjamin Otte
a2e46c4d39 gpu: Move function
It is only used by the nodeprocessor, so put it where it belongs.
2024-02-11 20:04:54 +01:00
Benjamin Otte
df1d024059 Revert "gpu: Fix scale fluctuation"
This commit is wrong.
It does achieve what it sets out to do, but the method doesn't work.

It confused multiple things in one commit, the commit message only
describes the symptoms it tries to fix and not why the fix is correct,
it includes no tests and it wsn't properly reviewed.

Related: !6871
2024-02-11 20:04:54 +01:00
Carlos Garnacho
e492dac7fe Merge branch 'gtk4_crash_tablet_pad_remove' into 'main'
gdk/wayland: Clear current_tablet on pad leave

See merge request GNOME/gtk!6883
2024-02-11 17:07:14 +00:00
Colin Kinloch
fabe0516fa gdk/wayland: Clear current_tablet on pad leave
Fixes crash when handling tablet pad removal event after the
current_tablet has already been freed.
2024-02-11 14:52:30 +00:00
Matthias Clasen
84971b9076 Merge branch 'gtkcalendar-issue-2440' into 'main'
GtkCalendar: Add missing accessors

See merge request GNOME/gtk!6849
2024-02-11 14:40:30 +00:00
Ahmed Baïzid
5efc33fe65 GtkCalendar: Add missing accessors 2024-02-11 14:40:30 +00:00
Matthias Clasen
52c228fd9e Merge branch 'macos-dmabuf-tests' into 'main'
macos: skip dmabuf tests

See merge request GNOME/gtk!6874
2024-02-11 13:48:33 +00:00
Matthias Clasen
674b5b808e Merge branch 'gtkcalendar-doc-mentions-gdate' into 'main'
GtkCalendar: Remove a mention of GDate from the doc

See merge request GNOME/gtk!6876
2024-02-11 12:39:04 +00:00
Matthias Clasen
af62aa4497 Apply 1 suggestion(s) to 1 file(s) 2024-02-11 12:04:21 +00:00
Matthias Clasen
137a7096c3 Merge branch 'announcement-priority-docs-fix' into 'main'
Fix docs for GtkAccessibleAnnouncementPriority

See merge request GNOME/gtk!6881
2024-02-11 12:01:46 +00:00
Arjan Molenaar
703e5ab9a8 dmabuf: Skip dmabuf tests for macOS
Dmabuf is not supported for macOS.
2024-02-11 11:27:13 +01:00
Sebastian Dröge
e2dc94d0e8 Fix docs for GtkAccessibleAnnouncementPriority 2024-02-11 11:19:56 +02:00
Matthias Clasen
b821103d1e Merge branch 'sonny/fix-gtkimage.file-desc' into 'main'
gtk: Fix GtkImage.file description

See merge request GNOME/gtk!6878
2024-02-10 21:54:21 +00:00
Sonny Piers
b40c9d8dcd gtk: Fix GtkImage.file description 2024-02-10 22:01:51 +01:00
Matthias Clasen
87b66de109 Merge branch 'mip_size' into 'main'
gsk: Fix blit sizes while generating mipmaps on vk

See merge request GNOME/gtk!6875
2024-02-10 19:13:36 +00:00
Ahmed Baizid
e934a8984d GtkCalendar: Remove a mention of GDate from the doc 2024-02-10 19:15:40 +01:00
g.willems
fa3bbed200 GdkWin32: implement surface's icon_list property setter
The 'icon_list' implementation of gtk+3 was somehow dropped
during the early conversion of GdkWindow to GdkSurface for gtk4.
Add it again, with minor tweaks to support GdkSurface.

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

This allows 'gtk_window_set_icon_name()' to work on win32.
2024-02-10 18:53:39 +01:00
M Henning
d08412aaa4 gsk: Fix blit sizes while generating mipmaps on vk
A few lines later we already had the correct equation for the size.
See vulkan 1.3 spec section 12.3.2 "Image Mip Level Sizing"
2024-02-10 10:59:44 -05:00
Matthias Clasen
56e7c4ab50 Merge branch 'matthiasc/for-main' into 'main'
testdmabuf: Make overlay more challenging

See merge request GNOME/gtk!6873
2024-02-10 12:42:21 +00:00
Matthias Clasen
3be03ea56f testdmabuf: Make overlay more challenging
Put both changing and unchanging widgets in the overlay, to
test our offloading code harder.
2024-02-10 07:09:28 -05:00
Matthias Clasen
ac65495434 Merge branch 'fix-scale-fluctuation' into 'main'
gpu: Fix scale fluctuation

See merge request GNOME/gtk!6871
2024-02-10 12:08:52 +00:00
Matthias Clasen
3a26e29795 Merge branch 'drop-ffmpeg' into 'main'
Drop ffmpeg support

Closes #5581

See merge request GNOME/gtk!6872
2024-02-10 11:53:41 +00:00
Sabri Ünal
21f64b987a Update Turkish translation 2024-02-10 09:47:13 +00:00
Matthias Clasen
da227386ad Drop ffmpeg support
The experimental ffmpeg media backend  hasn't been building for a
year, and nobody showed up with a patch to make it build again.

Fixes: #5581
2024-02-09 22:32:58 -05:00
Matthias Clasen
1ac82528d9 gpu: Fix scale fluctuation
We want to use a viewport that gives us the right scale back.
This fixes problems where glyph lookups were inefficient because
the scale part of the key would fluctuate ever so slightly.
2024-02-09 19:49:54 -05:00
Matthias Clasen
50fb19b10d Merge branch 'matthiasc/for-main' into 'main'
offload: Small optimization

See merge request GNOME/gtk!6868
2024-02-09 22:53:26 +00:00
Matthias Clasen
7c38945abf Merge branch 'testsuite_fix_recentmanager_win32' into 'main'
testsuite: fix recentmanager failure on win32

See merge request GNOME/gtk!6656
2024-02-09 22:46:51 +00:00
Matthias Clasen
be2dcdd897 offload: Fix our tree walk
We were not finding an overlaid spinner, since it is implemented
as a texture in a (most of the time) non-affine transform, and
we were aborting our treewalk when we see such transforms.

Instead, don't abort the walk on any transforms, but check if we
are in an affine context before deciding to offload a subsurface.
2024-02-09 12:43:38 -05:00
Matthias Clasen
16f91fc5d2 Merge branch 'matthiasc/for-main' into 'main'
testdmabuf: Use a spinner as overlay

See merge request GNOME/gtk!6867
2024-02-09 17:24:32 +00:00
Matthias Clasen
46cb0c5fc8 offload: Small optimization
Don't transform bounds more often than necessary.
2024-02-09 12:19:16 -05:00
Matthias Clasen
49e0ae8742 testdmabuf: Use a spinner as overlay
Thats a bigger challenge, and it breaks.
2024-02-09 11:50:51 -05:00
Matthias Clasen
933ce71ec6 Merge branch 'matthiasc/for-main' into 'main'
testsuite: Plug a memory leak

See merge request GNOME/gtk!6866
2024-02-09 12:35:41 +00:00
Matthias Clasen
149e884658 NEWS: Updates 2024-02-09 00:13:21 -05:00
Matthias Clasen
4b34c10d05 testsuite: Plug a memory leak 2024-02-09 00:07:34 -05:00
Matthias Clasen
e4ec066337 Merge branch 'gtk-gtk_accessible_announce' into 'main'
a11y: Introduce an API for requesting speech from a screen reader

See merge request GNOME/gtk!6864
2024-02-09 05:06:02 +00:00
Matthias Clasen
b734614aed Merge branch 'matthiasc/for-main' into 'main'
testdmabuf: Be more dynamic

See merge request GNOME/gtk!6865
2024-02-09 04:50:39 +00:00
Matthias Clasen
7880095fd8 Stylistic cleanups 2024-02-08 23:31:33 -05:00
Matthias Clasen
53519d7da1 Merge branch 'gtk-accessible_component_refactor' into 'main'
a11y: Implement AtSPIComponent in terms of GtkAccessible

See merge request GNOME/gtk!6862
2024-02-09 04:30:43 +00:00
Matthias Clasen
d418b0984c testdmabuf: Be more dynamic
Add shortcuts for triggering various changes:

- F11 toggles fullscreen
- Ctrl-O toggles an overlay
- Ctrl-F flips the texture
2024-02-08 23:28:57 -05:00
Benjamin Otte
e20b0b2a35 Merge branch 'wip/otte/for-main' into 'main'
vulkan: Vulkan requires listing of all dependencies

Closes #6375 and #6412

See merge request GNOME/gtk!6863
2024-02-09 04:14:00 +00:00
Lukáš Tyrychtr
28cec6c9a7 Expand documentation for medium and high priority announcements 2024-02-08 23:07:49 -05:00
Lukáš Tyrychtr
887d5307ca Apply review feedback, namely:
* Add a forgotten since annotation
* Map the GTK's announcement priority explicitly
2024-02-08 23:07:49 -05:00
Lukáš Tyrychtr
f6c84a435e Don't use ARIA terminology 2024-02-08 23:07:49 -05:00
Lukáš Tyrychtr
bff31f58a8 Expand the docs on when you would want to use this API 2024-02-08 23:07:49 -05:00
Lukáš Tyrychtr
3921398e66 a11y: Introduce an API for requesting speech from a screen reader
Sometimes, say, for some status changes communicated otherwise only visually,
you want a way how to send a message to a screen reader.

This patch implements such API, along with a message priority modeled similarly
to ARIA's live region politeness values.

We are intentionally not copying the AtkLive enum, as the value of ATK_NONE
makes no sense for announcements.
2024-02-08 23:07:48 -05:00
Lukáš Tyrychtr
f30c3d8133 a11y: Implement AtSPIComponent in terms of GtkAccessible
This implements AtSPIComponent for all GtkAccessible objects,not only for
GtkWidget ones. This stops surprising Orca when performing flat review, as it
can now query the bounds for the entire tree.
2024-02-08 22:31:13 -05:00
Benjamin Otte
9c0ca8803d gpu: Punch hole with a clear again
This reinstates the clear op when possible so we can avoid blending
changes and benefit for large areas, when the clip is appropriate.

Related: #6375
2024-02-09 04:28:32 +01:00
Benjamin Otte
5b184a10a9 gpu: Add a CLEAR blend mode for subsurface hole punching
The previous code was ignoring non-scissor clips, which would make it
overeager at punching holes.

It also was not working with fractional coordinates.

Fixes #6375
2024-02-09 04:28:32 +01:00
Alice Mikhaylenko
0bfd4b232b testsuite: Add a compare test for previous commit
Test that scaled border nodes properly scale their offsets.

Related: #6412
2024-02-09 04:28:32 +01:00
Benjamin Otte
269662c888 gpu: Scale the border offset
The shader was forgetting to apply global scale to the offset, which
would cause lines to be offset improperly on hidpi.

Fixes #6412
2024-02-09 04:28:32 +01:00
Benjamin Otte
9c87dd503a testdmabuf: Vulkan requires listing of all dependencies
Shuts up the validation layer.
2024-02-09 04:28:32 +01:00
Benjamin Otte
f2ec3e336f vulkan: Vulkan requires listing of all dependencies
So we list them.
Vulkan can be soooooo stupid.

Shuts up the validation layer.
2024-02-09 04:28:32 +01:00
Matthias Clasen
691ea8f11a Merge branch 'implement_accessible_text_for_bare_gtk_text' into 'main'
a11y: Expose AT-SPI Text on a bare GTkText

Closes libadwaita#798

See merge request GNOME/gtk!6857
2024-02-09 02:15:09 +00:00
Matthias Clasen
f9ba19c4de Apply review feedback 2024-02-09 01:50:06 +00:00
Matthias Clasen
1319f41d46 Merge branch 'device-pixels' into 'main'
Add a devicepixels test

See merge request GNOME/gtk!6861
2024-02-09 01:44:02 +00:00
Matthias Clasen
da024cfc90 Make devicepixels center its image
Also, add a fullscreen toggle action.
2024-02-08 15:31:38 -05:00
Matthias Clasen
6c6577dd6b Add a devicepixels test
This is a very simple test that tries out rendering
textures 1:1 to device pixels.
2024-02-08 14:52:59 -05:00
Matthias Clasen
bfdd738d0b Merge branch 'context-version' into 'main'
gpu: Print actually checked GLES version

See merge request GNOME/gtk!6860
2024-02-08 18:37:29 +00:00
Guido Günther
3cce78d02c gpu: Print actually checked GLES version
We check for 3.0 not 2.0.
2024-02-08 16:24:50 +01:00
Matthias Clasen
5cc952fa3f Merge branch 'gbsneto/a11y-copyright' into 'main'
a11y: Fix copyright headers

See merge request GNOME/gtk!6859
2024-02-08 15:01:41 +00:00
Georges Basile Stavracas Neto
7271eff628 a11y: Fix copyright headers
It's supposed to be a joint copyright.
2024-02-08 09:13:01 -03:00
Matthias Clasen
42bc89688c Merge branch 'macos-native-key-bindings' into 'main'
Inform backends if events have been handled

Closes #2914 and #5637

See merge request GNOME/gtk!6750
2024-02-08 10:48:35 +00:00
Lukáš Tyrychtr
a4ff25485c a11y: Expose AT-SPI Text on a bare GTkText
Previously, only EditableText was exposed, which does not make much sense.

Fixes https://gitlab.gnome.org/GNOME/libadwaita/-/issues/798
2024-02-08 09:53:55 +01:00
Matthias Clasen
55f6517751 Merge branch 'matthiasc/for-main' into 'main'
gdk: Add some subsurface tests

See merge request GNOME/gtk!6856
2024-02-08 00:21:51 +00:00
Matthias Clasen
cefa09f74f gdk: Add another assertion
Bad things happen if you attach a subsurface above itself, so
catch that case.
2024-02-07 17:41:38 -05:00
Matthias Clasen
906661d40b gdk: Add some subsurface tests
Test that the stacking order is properly maintained.
2024-02-07 17:41:07 -05:00
Matthias Clasen
32abe5b8bb gdk: Drop nonexisting api form headers 2024-02-07 17:33:20 -05:00
Matthias Clasen
cb9de9a48e Merge branch 'matthiasc/for-main' into 'main'
Fix subsurface stacking

See merge request GNOME/gtk!6855
2024-02-07 21:59:37 +00:00
Matthias Clasen
d823502af7 Fix subsurface stacking
This wasn't working :(
2024-02-07 16:23:51 -05:00
Matthias Clasen
62774c2e53 Merge branch 'matthiasc/for-main' into 'main'
Revert "gstreamer: Add more debug spew"

See merge request GNOME/gtk!6854
2024-02-07 20:28:29 +00:00
Matthias Clasen
b885d288cc Revert "gstreamer: Add more debug spew"
This reverts commit 67e50a6cfd.
2024-02-07 15:26:08 -05:00
Benjamin Otte
da36a6a5d2 Merge branch 'wip/otte/for-main' into 'main'
video: Don't try to play no media stream

See merge request GNOME/gtk!6853
2024-02-07 18:44:58 +00:00
Matthias Clasen
09ac592114 Merge branch 'matthiasc/for-main' into 'main'
gstreamer: Simplify dmabuf code

See merge request GNOME/gtk!6852
2024-02-07 18:21:25 +00:00
Benjamin Otte
19fccb13c3 gpu: GL < 4.0 needs the ifelse ladder for textures
GL 4.0 (section 4.1.7) allows dynamically uniform expressions as texture
indexes, GL 3.3 (again section 4.1.7) requires constants.

Related: #6401
2024-02-07 19:09:07 +01:00
Matthias Clasen
c654cb0f37 testsuite: Add a suite for offload tests 2024-02-07 12:38:18 -05:00
Matthias Clasen
6dfa6fe442 testdmabuf: Add a --fullscreen option
This may help in getting a scanout tranche.
2024-02-07 12:38:18 -05:00
Matthias Clasen
a61c7f7871 gdk: Split off dmabuf format tests
The dmabuf texture tests are failing, so we don't run them in
ci, but the format tests are perfectly fine, so split them off.

Add some tests for GdkDmabufFormatsBuilder and for the new
gdk_dmabuf_formats_equal(), too.
2024-02-07 12:38:18 -05:00
Matthias Clasen
8e4a235f56 dmabuf: Add gdk_dmabuf_formats_equal
Not much to say here, this is an obvious function.

We rely on formats being sorted.
2024-02-07 12:38:18 -05:00
Matthias Clasen
3cb1b9d4cb wayland: Drop GdkWaylandSubsurface.above_parent
This is now tracked in GdkSubsurface.
2024-02-07 12:38:18 -05:00
Matthias Clasen
eaf944938b surface: Keep subsurface stacking order
It is useful for us to know this, in particular the topmost
subsurface, to determine the right dmabuf formats.
2024-02-07 12:38:18 -05:00
Matthias Clasen
930fb24053 Merge branch 'macos_build_tests' into 'main'
Build tests in macOS CI

See merge request GNOME/gtk!6836
2024-02-07 17:30:00 +00:00
Arjan Molenaar
12069d2b91 macos: hand event to NSApp if it's not handled by us
This way default key bindings such as `Cmd+\`` (change window)
and `Ctrl+F2` (focus menu), can be activate with default shortcuts.
2024-02-07 16:36:36 +01:00
Arjan Molenaar
d3666f7b28 main: Propagate event handled state up backend
Expose information about if an event is handled to the backends.
This will allow a backend to deal with unhandled events, such as
macOS' default key bindings.
2024-02-07 16:36:26 +01:00
Matthias Clasen
67e50a6cfd gstreamer: Add more debug spew 2024-02-07 14:43:01 +00:00
Matthias Clasen
9e05ce18d9 gstreamer: Simplify dmabuf code
We don't need a property here, we can just get the formats from
the display.
2024-02-07 14:41:28 +00:00
Matthias Clasen
a77598d6ec display: Add missing introspection attribute 2024-02-07 14:41:28 +00:00
Matthias Clasen
9a2ba3053b Cosmetics 2024-02-07 14:41:28 +00:00
Matthias Clasen
7e71f1197b NEWS: Updates 2024-02-07 14:41:28 +00:00
Benjamin Otte
4e091b1791 video: Don't try to play no media stream
Avoids 2 criticals.
2024-02-07 15:28:09 +01:00
Matthias Clasen
dcebddc908 Merge branch 'wip/corey/file-chooser-startup' into 'main'
filechooserwidget fix slow load time

See merge request GNOME/gtk!6846
2024-02-07 07:28:18 +00:00
Matthias Clasen
6f67991e0e Merge branch 'matthiasc/for-main' into 'main'
node-editor: Make crash handling more robust

See merge request GNOME/gtk!6845
2024-02-07 07:26:41 +00:00
Benjamin Otte
9bc4585247 Merge branch 'wip/otte/for-main' into 'main'
x11: Fix memleak

Closes #6404

See merge request GNOME/gtk!6847
2024-02-07 06:52:08 +00:00
Benjamin Otte
305ef51684 x11: Fix memleak
Fixes #6404
2024-02-07 07:03:59 +01:00
Quentin PAGÈS
0c61610699 Update Occitan translation 2024-02-06 20:11:37 +00:00
Corey Berla
99dd6c579d filechooserwidget: Reuse timzezone
It's wasteful to call _local api's multiple times.
2024-02-06 11:36:27 -08:00
Corey Berla
8f3d85007b filechooserwidget: Limit recent folders to default limit 2024-02-06 11:36:27 -08:00
Corey Berla
7823e8120d filechooserwidget: Load recent files in bulk
We add recent files one at a time which is incredibly wasteful.
This is most obvious when the action is SAVE or OPEN_FOLDER because
we aren't limiting the number of recent files (as we are with OPEN),
so for me it took about 5 seconds to open a file dialog with OPEN_FOLDER
since the default location is recents.
2024-02-06 11:36:22 -08:00
Matthias Clasen
5ff7b37b61 NEWS: Updates 2024-02-06 18:41:47 +00:00
Matthias Clasen
d3e4d310b2 node-editor: Improve the crash warning
Hint in the text how to reenable auto-reload. A button for this
is not practical in the notification itself, since it will just
crash again if you reenable it without editing the content.
2024-02-06 18:41:47 +00:00
Matthias Clasen
77c115c224 node-editor: Make crash handling more robust
Handle cases where the crash only happens in render(), and not
in reload().
2024-02-06 18:41:47 +00:00
Matthias Clasen
c76fd1548e Merge branch 'dont-typo-fix' into 'main'
tools: Add missing contraction in string

See merge request GNOME/gtk!6843
2024-02-06 16:52:05 +00:00
Matthias Clasen
da142e02be Merge branch 'gbsneto/atspi-socket' into 'main'
AT-SPI socket

See merge request GNOME/gtk!6827
2024-02-06 16:47:41 +00:00
Matthias Clasen
8602745858 Merge branch 'wip/alice/typo' into 'main'
display-wayland: Fix a typo

See merge request GNOME/gtk!6844
2024-02-06 16:42:40 +00:00
Georges Basile Stavracas Neto
3e3eda416c build: Generate gtk-atspi.pc with better description
Not much to see, but this coded in such a way that potential new a11y
APIs are exposed with a nice description in their pkg-config file as
well.
2024-02-05 15:17:42 -03:00
Georges Basile Stavracas Neto
140ad373f7 atcontext: Realize child if parent is realized
When an unrealized GtkATContext (that doesn't come from a GtkWidget) is
attached to a realized parent, nothing happens. That's because, while
GtkWidget is able to realize itself at the appropriate times, that may
not be true for non-widget accessibles.

Realize the child AT context if the parent is realized, when manually
attaching the AT context to a parent.
2024-02-05 15:10:39 -03:00
Georges Basile Stavracas Neto
7e9c18c16e a11y: Expose the Component object for GtkAtSpiSocket
This allows reporting the proper geometry for the AT. This is a simple
implementation that simply uses the extents of the first GtkWidget that
is parent of the GtkAtSpiSocket accessible.

GTK does not support completely detached accessible trees, so a parent
GtkWidget is guaranteed to exist. Assert that in code.
2024-02-05 15:10:36 -03:00
Georges Basile Stavracas Neto
88b3e8552a a11y: Introduce GtkAtSpiSocket
This is a GtkAccessible object that represents a connection to a remote
plug object. It is particular to the AT-SPI backend, which is why it's
made to fail when gtk_at_context_create() creates anything that is not
a GtkAtSpiContext.

The resulting accessible object created by GtkAtSpiSocket only ever has
1 child, which is the remote accessible plug object. This remote object
cannot be represented by an actual GtkAccessible instance without
copying over its contents, which is unfeasible; therefore, add special
cases in exactly 3 places in GtkAtSpiContext to handle this.

This object is made so that WebKitGTK, which renders web pages and keeps
the a11y tree of the DOM page in a separate process, can be bridged to
the GTK4 UI process.
2024-02-05 15:10:15 -03:00
Alice Mikhaylenko
a6f9bab8f3 display-wayland: Fix a typo 2024-02-05 19:42:55 +04:00
Anders Jonsson
12e15c0ee0 tools: Add missing contraction in string 2024-02-05 00:23:29 +01:00
Benjamin Otte
9216779963 Merge branch 'wip/otte/for-main' into 'main'
rendernode: Implement diff() for repeat nodes

Closes #6389

See merge request GNOME/gtk!6842
2024-02-04 21:15:49 +00:00
Benjamin Otte
2e669099a6 testsuite: Add a test for previous commit
Related: #6389
2024-02-04 21:57:13 +01:00
Benjamin Otte
2a3a5753c1 gpu: Don't optimize too much
The rect clip can only be ignored if the scissor rect is contained in
the clip. But sometimes it isn't.

Fixes #6389
2024-02-04 21:57:13 +01:00
Benjamin Otte
88bed27f85 blurop: Print the blur radius 2024-02-04 21:57:13 +01:00
Benjamin Otte
b49b055183 rendernode: Implement diff() for repeat nodes
If the children have an empty diff and the repeat nodes' sizes are
equal, the diff is empty.
2024-02-04 21:57:13 +01:00
Piotr Drąg
988c7d1626 Update POTFILES.in 2024-02-04 13:12:12 +01:00
Matthias Clasen
f9acf3bb20 Merge branch 'wip/chergert/disable-dmabuf-on-macos' into 'main'
tests: require linux for dmabuf test

See merge request GNOME/gtk!6839
2024-02-02 23:46:08 +00:00
Christian Hergert
1b0f2cfeb8 tests: require linux for dmabuf test 2024-02-02 12:59:13 -08:00
René de Hesselle
26a342279f Allow macOS CI for runner's maintainer 2024-02-01 23:42:44 +01:00
René de Hesselle
ed38d9b662 Run testdmabuf only on Linux
This test includes a Linux-specific header and therefore breaks on
non-Linux OS.

This change fixes building the tests on macOS and therefore enables
that in CI by not disabling them anymore.
2024-02-01 23:36:03 +01:00
Georges Basile Stavracas Neto
e8b249281d build: Generate gtk-atspi.pc 2024-02-01 11:17:02 -03:00
Luca Bacci
5483821ea0 Merge branch 'gdk-win32-empty-frame' into 'main'
GdkWin32: Implement GdkDrawContext::empty_frame() vfunc

See merge request GNOME/gtk!6831
2024-01-31 12:39:11 +00:00
Matthias Clasen
05e25557e1 Merge branch 'gtk4-monitor-size' into 'main'
[gtk4/wayland] Fix GdkMonitor sizes on Mutter without fractional scaling.

See merge request GNOME/gtk!6832
2024-01-31 10:14:41 +00:00
Matthias Clasen
f80989332f inspector: Better monitor information
Show the fractional scale if we have one, and pixels.

Only Wayland has fractional scales, and for monitors, we have
to derive it from the logical and physical resolution of the
monitor. Not ideal, but it works.
2024-01-30 20:56:16 -05:00
Matthias Clasen
8df8d0bd5d monitor: Add gdk_monitor_get_scale
This matches the surface api we have, and closes an api gap.
2024-01-30 20:56:08 -05:00
Matthias Clasen
ea6ad66ee3 wayland: Small fixup to monitor size handling
The first time this function is called, has_xdg_output() returns
true, but haven't yet received all the xdg-output events, so wait
for that to be done. Otherwise, the logical size is 0, and nothing
useful comes from that.
2024-01-30 20:54:31 -05:00
Emilio Cobos Álvarez
5ceb9a7692 [gtk4/wayland] Fix GdkMonitor sizes on Mutter without fractional scaling.
This fixes a problem that is apparent in
https://bugzilla.mozilla.org/show_bug.cgi?id=1869724, but that also
reproduces on any GTK application as described in
https://bugzilla.mozilla.org/show_bug.cgi?id=1869724#c16.

xdg_output sizes might be physical if the compositor doesn't scale them,
it seems. So to report the correct logical geometry in GDK pixels, we
need to detect this case. We do this by checking whether the wl_output
size matches the xdg_output size.
2024-01-30 20:10:36 -05:00
Benjamin Otte
216dbf1e88 Merge branch 'wip/otte/dmabuf-disjoint' into 'main'
dmabuf: Fix disjoint detection

See merge request GNOME/gtk!6830
2024-01-30 18:17:33 +00:00
Matthias Clasen
ff4db4ed71 Merge branch 'macos-file-filter-pixbufs' into 'main'
macos: Add pixbuf formats similar to mime-types

Closes #5296

See merge request GNOME/gtk!6754
2024-01-30 16:56:52 +00:00
Luca Bacci
57dde7e877 GdkWin32: Implement GdkDrawContext::empty_frame() vfunc 2024-01-30 16:23:28 +01:00
Benjamin Otte
9581d060d2 dmabuf: Fix disjoint detection
According to the Mesa developers, the correct way to determine
disjointness is to check the actual inode of the fd because dup()ing can
cause these duplications to happen when planes are carelessly copied or
when planes are sent over dbus or other unix sockets.

Related: https://bugs.webkit.org/show_bug.cgi?id=267578
2024-01-30 15:19:34 +01:00
Lukáš Tyrychtr
b4069ba15b a11y: When using the tooltip for accessible name, don't use it for description
This removes a superfluous duplicate descriptions for the cases
where the tooltip was used for the name as well.
This aligns the behavior more to what browsers do.
2024-01-30 14:35:25 +01:00
Georges Basile Stavracas Neto
63e44a34ae gtk/a11y: Install empty gtk/a11y/gtkatspi.h header
The header doesn't include anything other than gtk.h itself, but
next commits will populate this with some extra includes.
2024-01-30 10:03:40 -03:00
Georges Basile Stavracas Neto
afbd7cfe55 build: Install gtkconfig.h header
With GTK_ACCESSIBILITY_ATSPI as its sole define for now. This will
allow clients to conditionally include gtk/a11y/gtkatspi.h if they
need to use the AT-SPI specific functions.
2024-01-30 10:03:40 -03:00
Matthias Clasen
ead1b36afd Merge branch 'macos-empty-frame' into 'main'
[macos] Add callbacks for Gdk.DrawContext.empty_frame

See merge request GNOME/gtk!6819
2024-01-30 01:06:14 +00:00
Benjamin Otte
1ffa01b38a Merge branch 'contentview-step1-finished' into 'main'
[macos] Use system shadow on macOS

Closes #6255

See merge request GNOME/gtk!6785
2024-01-29 18:09:33 +00:00
Matthias Clasen
f93601ed2b Merge branch 'cache-weak-unref' into 'main'
gpu: Fix a problem with texture caches

Closes #6377

See merge request GNOME/gtk!6824
2024-01-29 13:24:56 +00:00
Matthias Clasen
e1722777e5 Merge branch 'drag-out-of-fullscreen' into 'main'
gtk: Make window handles work when attached to fullscreen windows

See merge request GNOME/gtk!6825
2024-01-29 13:15:46 +00:00
Matthias Clasen
24850dff0e Merge branch 'fix-gc-context' into 'main'
gpu: Call make current before gc

Closes #6366

See merge request GNOME/gtk!6826
2024-01-29 13:13:43 +00:00
Matthias Clasen
d790268031 gsk: Move gc calls
maybe_gc() may make a different context current, so do it before
the renderer has made its own context current.
2024-01-29 08:12:27 -05:00
Matthias Clasen
89712fc750 gpu: Fix syntax confusion. 2024-01-29 08:12:27 -05:00
Matthias Clasen
9b62a5c931 gpu: Drop an unused argument
The timestamp wasn't used in atlas creation.
2024-01-29 08:12:27 -05:00
Matthias Clasen
fbf3836502 gpu: Drop excessive logging
This was logging every frame, which is too much.
2024-01-29 08:12:27 -05:00
Matthias Clasen
8d80f97597 gpu: free non-atlased glyphs
"Only free glyphs when their atlas is freed" works great for
glyphs that are on an atlas. Don't forget the others.
2024-01-29 08:12:27 -05:00
Matthias Clasen
e6ec8133a5 gpu: Don't weak unref too much
We can reach the code that removes the item from the hash table
before or after the weak unref has triggered. Just leave the
weakref in place and let it do its thing, if it hasn't gone
off yet. That matches what we do in free.

Fixes: #6377
2024-01-29 08:11:25 -05:00
Matthias Clasen
6b436fdbbb gsk: Move gc calls
maybe_gc() may make a different context current, so do it before
the renderer has made its own context current.
2024-01-29 07:49:59 -05:00
Matthias Clasen
7b2b5469eb gpu: Call make current before gc
We do gc in a timeout, when an arbitrary GL context might be
current, so we need to make sure its ours and we don't free
random textures in another context.

Fixes: #6366
2024-01-29 07:39:57 -05:00
Benjamin Otte
3fc325d799 Merge branch 'dmabuf-texture-gst-v4l2' into 'main'
gstsink: Add support for DMABuf import and graphics offload

See merge request GNOME/gtk!6618
2024-01-29 11:06:11 +00:00
Ben Mather
dee6742931 gtk: Allow windows to be dragged out of fullscreen using a window handle
Window handles allow windows to be dragged from maximized to restored,
but when the window is fullscreen they do nothing.  With this change,
windows will be unfullscreened when dragged.
2024-01-29 09:51:16 +00:00
Robert Mader
d2097d0449 gstsink: Add support for DMABuf import and graphics offload
By implementing support for `GdkDmabufTextureBuilder` and
`GstVideoInfoDmaDrm`. This allows zero-copy video playback on Wayland
when paired with hardware video decoding.

Can be tested with `gtk4-demo --run=video_player`
2024-01-28 19:09:41 +01:00
Matthias Clasen
c7f00d51eb Merge branch 'wayland-empty-frame' into 'main'
wayland: Add a way to check if a surface is dirty

See merge request GNOME/gtk!6822
2024-01-28 17:02:29 +00:00
Matthias Clasen
f5308dfbec wayland: Commit empty frames if needed
If we have outstanding double-buffered state (other than the
buffer itself), commit a frame even if its 'empty'.
2024-01-28 11:44:16 -05:00
Matthias Clasen
1097e1349c wayland: Add a way to check if a surface is dirty
We keep various pieces of double-buffered state on our side,
and then explicitly sync it over to the Wayland side.

Add a function to find out if we have any.
2024-01-28 11:44:16 -05:00
Benjamin Otte
d577e4421e Merge branch 'gpu-cache-fixes' into 'main'
gpu: Caching fixes

See merge request GNOME/gtk!6817
2024-01-28 16:13:25 +00:00
Matthias Clasen
1bac8b439a gpu: Be more aggressive about cache gc
Count dead pixels in textures (ie the number of pixels in GPU
textures that are no longer backed by an alive GdkTexture object),
and when the there's too many, do a gc before rendering the next
frame.
2024-01-28 11:00:07 -05:00
Matthias Clasen
ee52e98b7d gpu: Redo texture caching
Count the uses of cached texture - from the device (via the linked
list) and from the texture (via render data / weak ref), and only
free the item once the use count reaches zero.
2024-01-28 10:50:46 -05:00
Matthias Clasen
5e4eda15c9 gpu: Trigger cache gc from the renderer
Instead of forever running a timeout to do gc, ensure the timeout
is scheduled whenever we render a frame (this is done by calling
gsk_gpu_device_maybe_gc () before gsk_gpu_frame_render (), and
gsk_gpu_device_queue_gc () after).
2024-01-28 10:50:19 -05:00
Matthias Clasen
e861ea4bd2 gpu: Add a knob for cache GC
Read the GSK_CACHE_TIMEOUT environment variable to override the
default 15s timeout for cache gc. This is mainly meant for debugging.

Since we don't really need two knobs, reuse the gc timeout value
for the max age of items too.
2024-01-28 10:49:57 -05:00
Matthias Clasen
8009ed3a3c gpu: Add more details to debug spew
Print the number of items in the cache hash tables.
2024-01-27 19:50:45 -05:00
Matthias Clasen
1d95a171f6 gpu: Don't forget to unage cached textures
Whenever we successfully looking up a cached item, we need to
call use() on it to mark it as fresh.
2024-01-27 19:50:41 -05:00
Matthias Clasen
e0136b283a Cosmetics 2024-01-27 19:49:58 -05:00
Matthias Clasen
42867c7a3c Cosmetics 2024-01-27 19:49:57 -05:00
Ekaterine Papava
40f20fee3d Update Georgian translation 2024-01-27 17:15:52 +00:00
Matthias Clasen
63e814a45f Merge branch 'matthiasc/for-main' into 'main'
node-editor: Make the crash warning work

Closes #6370

See merge request GNOME/gtk!6820
2024-01-27 16:43:08 +00:00
Matthias Clasen
c1270cf52b gpu: Fix a crash in vulkan
The node processing wasn't skipping 0-size nodes when using the
uber shader, leading to assertions down the road. Since the ngl
renderer doesn't use uber shaders, this only affects vulkan.

Test included.

Fixes: #6370
2024-01-27 10:30:38 -05:00
Matthias Clasen
f2ec2f2a58 node-editor: Make the crash warning work
In some cases, we leave behind both an autosave and an
autosave-unsafe file, so check for the unsafe one first.
2024-01-27 10:21:26 -05:00
Benjamin Otte
e67bb62b1f Merge branch 'wip/otte/6363' into 'main'
gpu: Add support for MacOS default framebuffer

See merge request GNOME/gtk!6815
2024-01-27 15:15:38 +00:00
Arjan Molenaar
c17ac8c599 Add empty callbacks for Gdk.DrawContext.empty_frame on macOS 2024-01-27 15:34:59 +01:00
Matthias Clasen
ee8a800763 Merge branch 'matthiasc/for-main' into 'main'
nodeparser: Fix a font handling mishap

See merge request GNOME/gtk!6818
2024-01-27 08:30:37 +00:00
Matthias Clasen
746cfe48b0 nodeparser: Fix a font handling mishap
When we don't have an embedded font file via a url, then we want
to parse fonts "as normal", i.e. allow fallback for aliases like
"Monospace 10". This was broken when the url support was added.
Make it work again.

Update affected tests. In particular, the output of the text-fail
test goes back to be the same it was before the url changes.
2024-01-26 23:54:58 -05:00
Benjamin Otte
3a93d52718 gpu: Add support for MacOS default framebuffer
This adds the same code as the GL renderer used to allow backends to
redirect rendering to a different framebuffer.

Related: #6363
2024-01-26 16:55:49 +01:00
Benjamin Otte
1994e1940c Merge branch 'wip/otte/6363' into 'main'
gpu: Don't use layout binding in old GL versions

Closes #6363

See merge request GNOME/gtk!6814
2024-01-26 15:46:08 +00:00
Benjamin Otte
d74855fe9f gpu: Don't use layout binding in old GL versions
GL needs version 4.2 before it supports explicit bindings. We use GLES
usually, and Mesa supports GL 4.6, so we didn't hit this case before.

However, MacOS does use GL and Mac OS is stuck on GL 4.1.

Fixes #6363
2024-01-26 14:17:16 +01:00
Emmanuele Bassi
979749a3bc Merge branch 'ewlsh/add-accessible-relation-list' into 'main'
gtk: Add AccessibleList to enable relations in bindings

Closes #6358

See merge request GNOME/gtk!6807
2024-01-26 10:52:26 +00:00
Fran Dieguez
29c7725416 Update Galician translation 2024-01-26 09:57:16 +00:00
Matthias Clasen
3abf6acb16 Post-release version bump 2024-01-25 16:25:26 -05:00
Matthias Clasen
df8cf0e030 Use software rendering for testsuite runs
We need to force software rendering, or test failures will cause
meson dist to fail.
2024-01-25 16:25:26 -05:00
Matthias Clasen
7952b2a0bc 4.13.6 2024-01-25 16:25:26 -05:00
Matthias Clasen
c98e568583 Merge branch 'ngl-by-default' into 'main'
gsk: Change the default renderer

See merge request GNOME/gtk!6809
2024-01-25 20:41:32 +00:00
Matthias Clasen
f90e77d173 gdk: Enable fractional scaling for GL by default
The ngl renderer has good support for fractional scaling, so we
can enable this by default now.

If you are using the gl renderer, you can disable fractional
scaling with the

GDK_DEBUG=gl-no-fractional

environment variable.
2024-01-25 14:41:04 -05:00
Matthias Clasen
98e3fca284 gsk: Change the default renderer
The intent of this change to get wider testing and verify that the
new renderers are production-ready. If significant problems show
up, we will revert this change for 4.14.

The new preference order is ngl > gl > vulkan > cairo.

The gl renderer is still there because we need it to support gles2
systems, and vulkan still has some rough edges in application support
(no gl area support, webkit only works with gl).

If you need to override the default renderer choice, you can
still use the GSK_RENDERER environment variable.
2024-01-25 14:41:04 -05:00
Benjamin Otte
a7c98227e6 Merge branch 'wip/antoniof/fix-section-tiles' into 'main'
gtklistitemmanager fixes

See merge request GNOME/gtk!6805
2024-01-25 19:31:35 +00:00
Benjamin Otte
f2856e494c Merge branch 'wip/otte/for-main' into 'main'
gpu: Fix variable

See merge request GNOME/gtk!6812
2024-01-25 19:26:44 +00:00
Benjamin Otte
dc1f12682c testsuite: Add a test for zero width borders
See previous commit for an explanation of the problem.

This test actually draws a rounded border, but the rounding is clipped
away. What is remaining is the 4 corners of the border, where the
top/bottom color is red and the left/right color is green. But because
the bottom/right side has a width of zero, the result should be all red.
2024-01-25 19:39:34 +01:00
Benjamin Otte
502fb250ab gpu: Fix zero-width border corner rendering
When a border side has a width of 0 but we're having rounded corners, we
draw content in the edges of that side, and naturally pick its color.
That is wrong though, when the width is zero, we're supposed to keep
using the color of the other side in that corner.

So do that.

Fixes the border-corner-zero-width-rendering.ui reftest.
2024-01-25 19:39:34 +01:00
Benjamin Otte
7d7d3ff35c gpu: Fix variable
I had a test that allocated over 4GB of ops and...
2024-01-25 19:08:32 +01:00
António Fernandes
9fb449793d listitemmanager: Fix section change handler mistake
The statement is not doing what it was meant to do.

gtk_list_item_manager_get_nth (self, position, &offset) returns the
tile for a given position, and if the tile maps to more than 1 item,
the offset indicates how far into that tile the given position is.

So position - offset would give us the position of this tile. It
doesn't make sense to subtract it from n_items.

Instead, we should be adding the offset to compensate for having
landed too early in the list, such that we successfully reach
position + n_items.
2024-01-25 17:35:56 +00:00
António Fernandes
3d88c44803 listitemmanager: Don't doubly-recycle widget
When there is a duplicate item in the hash table of deleted items, we:

1. Unparent the unparent the old `widget` value (gtk_widget_unparent is
   passed as `GDestroyNotify value_destroy_func` for the hastable).
2. Set the new `widget` value in the hashtable.
3. Also set the same `widget` in the recycled queue.

This means the same widget is found in the 2 containers and, therefore,
the same widget may be returned twice by gtk_list_item_change_get().
Alternatively, this means we may reuse the item by taking it from the
hashtable and reassigning it to a tile, but then it ends up getting
unparented by gtk_list_item_change_finish(). Or we don't take it at
all and end up calling gtk_widget_unparent()` on it twice, which may
result in use-after-free on the second call the parent was holding the
last reference.

This was introduced by 76d601631d

Previously, gtk_list_item_manager_release_list_item() would just emit
the warning but otherwise do nothing. Let's restore that behavior.
2024-01-25 17:35:56 +00:00
António Fernandes
b05000d8bd listitemmanager: Remove section when adding at its end
We are failing to go from this:

    [ BLUE ] [ RED ]

...to this:

    [ BLUE GREEN YELLOW ] [ RED ]

...where '[' and ']' represent section header and footer.

Instead, the result is...

    [ BLUE ] [ GREEN YELLOW ] [ RED ]

... despite the first 3 items belonging to the same section according
to the section model. This leaves the view in an inconsistent state
and, ultimately, to crashes the non-removed footer.

Indeed, when receiving items-changed(1,0,2), we call `append_items()`
which inserts a new tile before the tile at `1` (which was RED), and
then notices there is a HEADER right befo-re it, so it flags both it
and the corresponding FOOTER as unmatched:

    [ BLUE ] ( GREEN-YELLOW RED )

... where '(' and ')' represent unmatched header and footer.

Problem is subsequent code in `release_items()` doesn't even touch
the section boundary footer-header pair ('] ('), because they are
belong in the tracked interval (visible items). And `ensure_items()`
proceeds to match the header with a new footer, producing the result
described above.

To handle this correctly, `append_items()` must delete the section
boundary, and flag as unmatched both the HEADER of the section before
and the FOOTER of section after (whose respective footer and header
has been marked for removal):

    ( BLUE . . GREEN-YELLOW RED )

... where '.' represents tiles marked for removal.

This way, `release_items()` will release the removed footer-header
section boundary, and `ensure_items()` is going to reinstate new
section remove the section boundary at the correct place, resulting
in the expected behavior:

    [ BLUE GREEN YELLOW ] [ RED ]
2024-01-25 17:22:32 +00:00
António Fernandes
4b45adaf39 testsuite: Test inserting items at sections
We are not catching bugs when inserting if we're right at a boundary.

This because we never add or remove items from a section. We only ever
add or remove whole sections.

Introduce a test which inserts items at a random position inside of a
section.
2024-01-25 17:16:00 +00:00
Maximiliano Sandoval
6f2d33369b docs: Add favicons
Requires gi-docgen main.
2024-01-25 17:06:24 +01:00
Matthias Clasen
e08727fa47 Merge branch 'gpu-cache-stats' into 'main'
gpu: cache eviction

Closes #6346

See merge request GNOME/gtk!6784
2024-01-25 15:08:36 +00:00
Matthias Clasen
7624e6621a gpu: Add profiler marks around cache gc 2024-01-25 09:41:49 -05:00
Matthias Clasen
cdddb6cb96 gpu: Print more detailed cache statistics
Print out stale glyphs and dead pixel ratios.
2024-01-25 09:41:49 -05:00
Matthias Clasen
f6c01a7674 gpu: Fix ordering problem in clear_cache()
We must free the glyphs before their atlases, since we now maintain
the dead pixel count of the atlas when glyphs are freed.
2024-01-25 09:41:49 -05:00
Matthias Clasen
ffa5bf1b7d gpu: Fix atlas freeing
We need to unset current_atlas if we free that one.
2024-01-25 09:41:49 -05:00
Matthias Clasen
4c6e623ec5 gpu: Keep track of atlas use
Count how many dead pixels we have, and free the atlas if more than
half of its pixels are dead.

As part of this, change when glyphs are freed. We now keep them
in the hash table until their atlas is freed and we only do dead
pixel accounting when should_collect is called. This keeps the
glyphs available for use from the cache as long as are in the atlas.

If a stale glyph is sused, we 'revive' it by removing its pixels
from the dead.

This matches more closely what the gl renderer does.
2024-01-25 09:41:48 -05:00
Matthias Clasen
621ef0703a gpu: Make atlas freeing more robust
Currently, we don't free an atlas before all its glyphs are gone,
but we might revisit that in the future, so be prepared for it.
2024-01-25 09:40:58 -05:00
Matthias Clasen
f514caadb0 gpu: Evict stale glyphs from the cache
Same story as for textures: if it hasn't been used for 4 seconds,
it is stale and can go.
2024-01-25 09:40:58 -05:00
Matthias Clasen
4d92093c67 gpu: Fix texture eviction
If we gc a cached texture for which the GdkTexture is still alive,
the cached texture object will remain accessible via the render
data, so need to make sure not to leave a dangling pointer behind
here.
2024-01-25 09:40:58 -05:00
Matthias Clasen
bd9ea05ebb gpu: Evict stale textures from the cache
This is straightforward. If a texture hasn't been used for 4 seconds,
we consider it stale, and drop it the next time gc comes around.

The choice of 4 seconds is arbitrary.

Fixes: #6346
2024-01-25 09:40:58 -05:00
Matthias Clasen
e8599bd36e gpu: Start doing cache gc
Call the gc function periodically from a timeout to collect
stale cached items.
2024-01-25 09:40:58 -05:00
Matthias Clasen
1accd0c1ba gpu: Print some cache stats
This reuses the GLYPHCACHE debug flag that is used for the same
purpose in the gl renderer.
2024-01-25 09:40:58 -05:00
Matthias Clasen
14488041bc gpu: Add a static assertion
Stating the obvious, maybe.
2024-01-25 09:40:58 -05:00
Emmanuele Bassi
c11b29583e Merge branch 'gbsneto/a11y-cleanups-1' into 'main'
Unassorted a11y cleanups

See merge request GNOME/gtk!6808
2024-01-25 12:58:34 +00:00
Arjan Molenaar
9467243ac3 Properly unset the use_client_shadow flag 2024-01-25 13:11:13 +01:00
Evan Welsh
32f1f7280b gtk: Add AccessibleList to enable relations in bindings
Bindings need a boxed type to "wrap" lists of Gtk.Accessible objects.

Closes #6358
2024-01-25 03:39:49 -08:00
Yosef Or Boczko
ff81104834 Update Hebrew translation 2024-01-25 11:35:41 +00:00
Arjan Molenaar
6e7893d527 Let GdkDisplay decide if shadows should be drawn
Replace the `#ifdef` blocks by a backend call.
2024-01-25 12:09:10 +01:00
Arjan Molenaar
6efe5eefd3 Differentiate between compositing and frame extents support
* If the WM supports compositing, we can use CSD with rounded corners.
* If the WM supports frame extents, we can use client side shadows.
2024-01-24 21:57:44 +01:00
Fran Dieguez
3fd869a8ba Update Galician translation 2024-01-24 00:33:44 +00:00
Georges Basile Stavracas Neto
d337eed643 a11y/atspicontext: Remove empty constructed override
It does nothing.
2024-01-23 19:09:57 -03:00
Georges Basile Stavracas Neto
296d44159b a11y/atspi/root: Chain up to finalize
The gtk_at_spi_root_finalize() function currently chains up to
dispose(),
which is probably a copy-paste mistake since gtk_at_spi_root_dispose()
exists and also chains up to dispose().

Chain up to finalize().
2024-01-23 19:09:57 -03:00
Georges Basile Stavracas Neto
4ce9f9b3ac gtk/atcontext: Cleanup a11y backends list
Declaring a separate entry for Wayland and X11 is not very useful when
both just end up calling the same constructor. Also, in theory, this
can cause the Wayland entry to be picked up on X11 if both backends
are enabled (which is the common case).

Not that it matters, since the 'name' field is unused.

Nonetheless, clean it up to be a single entry
2024-01-23 19:09:57 -03:00
Georges Basile Stavracas Neto
9fb37229a1 atcontext: Remove end sentinel from array
This array is iterated using G_N_ELEMENTS(), which means it always
iterates a well known number of times.

Remove the sentinel.
2024-01-23 19:09:57 -03:00
Georges Basile Stavracas Neto
c8299f5b3e atcontext: Move variable declaration to top
This conforms better to the GTK C coding style.
2024-01-23 19:09:57 -03:00
Georges Basile Stavracas Neto
f019a325ef atcontext: Use size_t for loop iterator
G_N_ELEMENTS() returns a division of two size_t values, which results
in a size_t value.

This is just a cleanup, no functional change.
2024-01-23 19:09:57 -03:00
Matthias Clasen
0d69b723fc Merge branch 'matthiasc/for-main' into 'main'
Clean up some accidents

See merge request GNOME/gtk!6802
2024-01-23 11:47:52 +00:00
Benjamin Otte
d632258abb Merge branch 'wip/otte/subpixel-positioning' into 'main'
Add subpixel positioning for GPU renderer

See merge request GNOME/gtk!6799
2024-01-23 06:38:32 +00:00
Benjamin Otte
969fc17737 testsuite: Disable test on cairo
With the --repeat version of this test, Cairo needs to draw partially
clipped glyphs. However, there's a bug in Cairo where it doesn't account
for the subpixel positioning when clipping, so the glyphs get cut off at
the edge.

This is filed as https://gitlab.freedesktop.org/cairo/cairo/-/issues/821
2024-01-23 07:12:33 +01:00
Benjamin Otte
ada0ea0f68 testsuite: Add subpixel positioning test for hidpi
On hidpi (ie scaled by 2x) we want to align to the pixel grid, not the
unit grid.

The GL renderer currently gets that wrong, so it's disabled here.
2024-01-23 06:17:14 +01:00
Benjamin Otte
fff912efd3 testsuite: Add a test for subpixel positioning
Draw a grid of 21x21 box glyphs.

Each glyph is offset by n/20 pixels in the x and y direction.

The background color is carefully selected to be divisible by 16, so
that when the box glyph is subpixel positioned by 1/4th of a pixel
offset from the pixel grid in either direction, the result will be an
edge pixel whose color value can be computed exactly.

Cairo still rounds this wrong for color values >= 128 which is why we
use a dark gray that guarantees the resulting color values are all <128.
2024-01-23 06:17:14 +01:00
Benjamin Otte
c31b6ff1d5 gpu: Implement subpixel positioning
This makes glyph rendering match the Cairo and GL renderers.
2024-01-23 06:17:14 +01:00
Benjamin Otte
cf4b9dcb4d gpu: Align glyphs to the pixel grid
Add GSK_GPU_SKIP=glyph-align to turn off the glyph aligning.

FIXME: Should this be handled by the renderer at all or should we rely
on higher rendering layers to align glyphs properly?

This is kind of a tricky question just like with texture-scale nodes and
NEAREST filtering, because rendernodes can be embedded in other nodes
that disturb the pixel grid.
2024-01-23 06:17:14 +01:00
Benjamin Otte
549c8aec4a testsuite: Add tests for the recent repeat node fixes
Make sure to test horizontal and vertical versions, because who knows...
2024-01-23 06:17:14 +01:00
Benjamin Otte
b7f7487b53 cairo: Fix wrong offset when tiling repeat nodes 2024-01-23 06:17:14 +01:00
Benjamin Otte
dfc34b7295 gpu: Offset tiles properly
When drawing repeat nodes as tiles, this could result in wrong
renderings when the tiles were clipped wrong.
2024-01-23 06:17:14 +01:00
Matthias Clasen
83230766b2 Avoid a strdup
Not that it matters, but it looks cleaner that way.
2024-01-23 00:08:15 -05:00
Matthias Clasen
3bd1f491d1 node-editor: Remove some dead code
We ended up not needing a map implementation after all.
Remove the vestiges.
2024-01-23 00:07:23 -05:00
Matthias Clasen
2c1562630d Revert an accidental change
This snuck in with some recent cleanups.
2024-01-23 00:07:23 -05:00
Benjamin Otte
3451c2e72c Merge branch 'wip/otte/for-main' into 'main'
gsk: Respect offscreen_for_opacity of first child

Closes #6350

See merge request GNOME/gtk!6800
2024-01-22 17:52:33 +00:00
Benjamin Otte
00be97e741 gsk: Respect offscreen_for_opacity of first child
The container node constructor forgot to initialize that value from the
first child.

Testcase included.

Fixes #6350
2024-01-22 18:22:50 +01:00
Arjan Molenaar
f947aafc2e Reset window transparency and shadow properties
... so that if a window is unrealized and realized again
that you end up in a stable form.
2024-01-22 16:22:56 +01:00
Arjan Molenaar
3e9f2aa4bb Differentiate between transparency and client side shadows
Transparency we need to support rounded corners. Client-side
shadows we need on platforms where the window manager does not
do them (mainly Wayland and X11). On platforms that support shadows
by default (macOS, Windows), we can just use them.
2024-01-22 16:22:56 +01:00
Paul Rouget
a6ce506714 [macos] Use FullSizeContent for CSD 2024-01-22 16:22:36 +01:00
Matthias Clasen
9b9e8b385e Merge branch 'matthiasc/for-main' into 'main'
Tweak profiling strings

See merge request GNOME/gtk!6796
2024-01-22 13:46:52 +00:00
Emmanuele Bassi
d3f30e73d0 Merge branch 'gtypes-doc-fix' into 'main'
droptarget: Fix GType in doc strings

See merge request GNOME/gtk!6798
2024-01-22 12:15:31 +00:00
Alexandre Franke
257706ba0a Update French translation
(cherry picked from commit 92862dfeec)
2024-01-22 12:09:29 +00:00
Guido Günther
2bc38e103d droptarget: Fix GType in doc strings
While we have several `GType`s the actual type name is still singular.
2024-01-22 12:30:56 +01:00
Benjamin Otte
60b3e5cac1 Merge branch 'wip/otte/for-main' into 'main'
gpu: Handle a full cache

See merge request GNOME/gtk!6797
2024-01-22 07:48:36 +00:00
Benjamin Otte
d14932474b testsuite: clip the node
Clip from 1025px (which is what this test is about) to 1024px because the
GLES2 renderer in CI otherwise scales its repeat node offscreen for the
--repeat version of this test and that conveniently produces off-by-one
misrenderings everywhere.

However, we need to keep the image large enough so that all the glyphs
are actually rendered and not skipped which would not overflow the
cache.
2024-01-22 08:30:16 +01:00
Benjamin Otte
f0982e2683 testsuite: Overflow slices of glyph cache
This test is specifically engineered to trigger an overflow in the glyph
renderer that was theorized on IRC with an earlier patchset.

If only one slice was available, and that slice was not high enough to
hold the glyph we were trying to put in there, it would allocate a slice
that was too small. The check for the size was missing.

So now add a test that fills up all the slices in the glyph cache apart
from one and than tries to add one final glyph that is too large for the
last slice.
2024-01-22 07:47:35 +01:00
Benjamin Otte
d8fbaf5d4f testsuite: Add a test to exhaust the glyph cache
See previous commit.
2024-01-22 07:47:10 +01:00
Benjamin Otte
183d712252 gpu: Handle a full cache
Previously, we only checked if the cache had exhausted the maximum
number of slices.
But we also need to check that the height of the slices doesn't exceed
the height of the texture.
2024-01-22 07:47:10 +01:00
Benjamin Otte
3eb5447376 rendernodeparser: Improve error handling for font parsing
After the node-editor crashed on me once too often, I decided to take a
good hard look at the parsing code and add a bunch of weird corner
cases into the testsuite.

That meant redoing the parser so that the error paths cause neither
crashes nor duplicated or wrong error messages.
2024-01-22 07:47:10 +01:00
Benjamin Otte
976c5077b9 css: Add gtk_css_parser_has_url()
This function wasn't needed so far so I didn't add it.
The next commits will use it.

I made has_url() return TRUE for the BAD_URL token, even though a
BAD_URL is not a valid URL. But parsing code will almost always want to
treat these tokesn the same way it would treat otherwise bad urls, so
returning TRUE here makes it go own the right error path in calling
code.
2024-01-22 07:47:10 +01:00
Benjamin Otte
4e00384830 testsuite: Remove duplicate newline 2024-01-22 07:47:10 +01:00
Matthias Clasen
f779832861 Tweak profiling strings
Capitalize our mark names, and use GTK as category.

The justification is: it looks better in sysprof.
2024-01-21 14:02:08 -05:00
Matthias Clasen
a482cb5d25 Merge branch 'matthiasc/for-main' into 'main'
gl: Fix text carets going missing on NVidia

Closes #6348

See merge request GNOME/gtk!6795
2024-01-21 14:42:54 +00:00
Matthias Clasen
f781039aa2 gsk: Add a testcase for underlines and carets
The gl renderer has an optimization where it uses the glyph atlas
to render color nodes that show up in the middle of text (e.g. for
underlines and carets). This adds a simple test for that scenario,
which hits this codepath.
2024-01-21 09:29:57 -05:00
Matthias Clasen
6e8a70ada1 Drop gdk_gl_context_has_bgra
This private api turned out to be more problematic than useful,
and it isn't used anymore.
2024-01-21 08:29:33 -05:00
Matthias Clasen
c43294c837 gl: Fix text carets going missing on NVidia
Use the same logic for uploading the 'corner pixel' that we use
for uploading glyphs, since that works.

Fixes: #6348
2024-01-21 08:22:47 -05:00
Matthias Clasen
761995ce3c Merge branch 'bilelmoussaoui/file-fixes' into 'main'
gtk: Allow a nullable file in FileChooser.set_current_folder

See merge request GNOME/gtk!6794
2024-01-21 12:01:33 +00:00
Bilal Elmoussaoui
d164dd3146 gtk: Allow a nullable file in FileChooser.set_current_folder
To match the annotation
2024-01-21 09:36:30 +01:00
Matthias Clasen
4b9b55ab17 Merge branch 'gl-fix-big-glyphs' into 'main'
gl: Avoid a use-after-free

Closes #6347

See merge request GNOME/gtk!6791
2024-01-20 19:16:56 +00:00
Artur S0
6e9767c7c1 Update Russian translation 2024-01-20 18:59:41 +00:00
Matthias Clasen
b2f783b70b gl: Avoid a use-after-free
This only happens with big, non-atlased glyphs, so it is rare, but
it gets triggered by the Masking demo in gtk4-demo.

Fixes: #6347
2024-01-20 13:33:54 -05:00
Matthias Clasen
5a68426c9a Merge branch 'bilelmoussaoui/gi-stuff' into 'main'
gi/docs: Document GtkGraphicsOffloadEnabled

See merge request GNOME/gtk!6790
2024-01-20 17:48:21 +00:00
Bilal Elmoussaoui
32d77fa874 gi/docs: Document GtkGraphicsOffloadEnabled
Mostly to add since annotation
2024-01-20 17:18:26 +00:00
Matthias Clasen
8d00af6351 Merge branch 'matthiasc/for-main' into 'main'
gsk: Inline some more rect functions

See merge request GNOME/gtk!6789
2024-01-20 17:11:48 +00:00
Matthias Clasen
a91a0720f5 gl: Consistently use float apis 2024-01-20 11:52:42 -05:00
Matthias Clasen
f01208ad94 gpu: Consistently use ceilf
There was a mix of ceil() and ceilf() calls here, but the arguments
are always floats, so use ceilf() throughout.
2024-01-20 11:33:59 -05:00
Matthias Clasen
56b955f819 roundedrect: Use fabsf
The arguments are floats.
2024-01-20 11:33:59 -05:00
Matthias Clasen
0d7761269c gpu: Use gsk_rect_scale 2024-01-20 11:33:59 -05:00
Matthias Clasen
9ebaafa2af gsk: Inline some more rect functions
When we use graphene_rect_scale, the rect is always normalized,
so we can avoid some overhead here.
2024-01-20 11:33:59 -05:00
Matthias Clasen
25ea6beb39 inspector: Fix a typo 2024-01-20 09:38:53 -05:00
Matthias Clasen
905bb2c6fd Merge branch 'matthiasc/for-main' into 'main'
gpu: Cosmetics

See merge request GNOME/gtk!6788
2024-01-20 13:51:43 +00:00
Matthias Clasen
b4b7e9b040 gpu: Fix up gc
Make the gc loop free the the right item.
2024-01-20 08:04:43 -05:00
Matthias Clasen
c3fcf0f7b0 gpu: Plug a memory leak
This looks like just a leftover line.
2024-01-20 08:02:20 -05:00
Matthias Clasen
60fc48e71f gpu: Cosmetics
s/timestsamp/timestamp/
2024-01-20 08:01:59 -05:00
Danial Behzadi
01d9886eea Update Persian translation 2024-01-20 11:22:43 +00:00
Danial Behzadi
a97231c8bf Update Persian translation
(cherry picked from commit 58425405d2)
2024-01-20 11:13:44 +00:00
Matthias Clasen
8ac8a027b2 Merge branch 'wip/no-seat' into 'main'
Fix possible crashers if no seats are available

See merge request GNOME/gtk!6787
2024-01-20 03:30:12 +00:00
Carlos Garnacho
070f3a61ac gdk/wayland: Bail out on titlebar gestures with no seat
This API might be called programmatically at a time that there's no
seats, handle this situation by returning FALSE in the GDK API.

Related: https://gitlab.gnome.org/GNOME/gtk/-/issues/6335
2024-01-20 01:27:27 +01:00
Carlos Garnacho
022347fa85 gdk/wayland: Avoid activation paths with no seats
When a toplevel is focused programmatically and there is no
underlying seat, we cannot attempt to focus it with no
focus to be obtained, nor serials serials to use.

Related: https://gitlab.gnome.org/GNOME/gtk/-/issues/6335
2024-01-20 01:27:27 +01:00
Matthias Clasen
ebb6076aca Merge branch 'matthiasc/for-main' into 'main'
inspector: Update logging tab

See merge request GNOME/gtk!6783
2024-01-19 16:46:06 +00:00
Matthias Clasen
7b66bc45aa Cosmetics
Add some vim modelines.
2024-01-19 09:26:32 -05:00
Matthias Clasen
698aa7c0f3 inspector: Update logging tab
The verbose flag was missing in the gsk section.
2024-01-19 09:26:32 -05:00
Matthias Clasen
70699efc71 Merge branch 'matthiasc/for-main' into 'main'
Automate profile setting

See merge request GNOME/gtk!6781
2024-01-19 03:49:58 +00:00
Matthias Clasen
cebc95f253 Automate profile setting
We can derive whether we are build a developement snapshot or
a stable version from the minor version number. So do that.
This way, we'll get the devel profile selected in the nightly
SDK, which will make the commit sha appear in the inspector,
which is useful to determine what nightly users are testing.
2024-01-18 21:26:39 -05:00
Matthias Clasen
f9c6bd125b Merge branch 'inspector-git-sha' into 'main'
build: Move demo header generation

See merge request GNOME/gtk!6780
2024-01-19 01:41:40 +00:00
Matthias Clasen
4733ca193b inspector: Show git sha for the build 2024-01-18 20:22:00 -05:00
Matthias Clasen
c7b345f73e build: Move and rename demo_conf.h header
We want to use the same header in the inspector, so move it to
the toplevel. And since it is no longer for demos only, rename
it to profile_conf.h, and also rename the build option back
to profile.
2024-01-18 20:20:58 -05:00
Matthias Clasen
1fbc61f2cb Merge branch 'static_text_widgets_are_not_special' into 'main'
a11y: Remove special handling of accessible names for static text widgets

See merge request GNOME/gtk!6776
2024-01-18 16:01:29 +00:00
Matthias Clasen
565694ede5 Merge branch 'wip/chergert/fix-expression-weak-ref-uaf' into 'main'
expression: use indirection to safely finalize object expression

See merge request GNOME/gtk!6778
2024-01-18 16:00:55 +00:00
Ignacio Casal Quinteiro
3b96cf3789 scalebutton: add api to get/set whether it has a frame 2024-01-18 09:58:05 +01:00
Christian Hergert
0df03b054d expression: guard against UAF with indirection
When using g_object_weak_ref(), it is important that you can discover
weather or not it is safe to call g_object_weak_unref(). That is
problematic if you use a naked pointer to structure. Additionally,
if a GWeakRef is used, and things are not cleaned up carefully,
GObject itself will try to write to it. So ensuring that the GWeakRef
is cleared safely before the owning struct is finalized is paramount.
That is difficult if you are unsure wheather or not your weak_ref
callback has been called.

This introduces WeakRefGuard which is an indirection pointer that is
cleared on the first unref. There are only ever two references. When
the owning struct is finalized or the weak ref callback is called, an
unref will occur and the guard will clear the data pointer.
2024-01-17 19:25:31 -08:00
Christian Hergert
73d01d3130 expression: release target if evaulation fails
Related #6341
2024-01-17 19:25:00 -08:00
Matthias Clasen
80f3357117 Merge branch 'dboles/Notebook-DropTarget-GTK4' into 'main'
Notebook: Update doc on how to accept dropped tabs

See merge request GNOME/gtk!6450
2024-01-18 02:28:18 +00:00
Kévin Commaille
e6046e9493 gtk: Fix GtkListItemWidget focus chain
It would not check if the focus child can handle the focus,
so it wouldn't be possible to navigate through each focusable descendant

Fixes #6340
2024-01-17 15:14:12 +01:00
Lukáš Tyrychtr
d5b34aecdd a11y: Remove special handling of accessible names for static text widgets
By doing this, we gain the capability to send notifications when their
accessible names change. Also, it simplifies the accessible name
generation logic.
2024-01-17 12:49:38 +01:00
Matthias Clasen
d16d2135e6 Merge branch 'demos-fix-commit-sha' into 'main'
Flatpak demos fix missing commit sha

See merge request GNOME/gtk!6774
2024-01-17 02:51:35 +00:00
Matthias Clasen
53b52abd30 Merge branch 'matthiasc/for-main' into 'main'
Shrink the repeat-repeats tests

See merge request GNOME/gtk!6775
2024-01-17 02:40:22 +00:00
Matthias Clasen
e55e9e3b36 Shrink the repeat-repeats tests
This was triggering timeouts in ci.
2024-01-16 20:58:02 -05:00
Matthias Clasen
9f9cea219f Merge branch 'dnd-cursor-names' into 'main'
dnd: Use standard cursor names

Closes #6337

See merge request GNOME/gtk!6770
2024-01-17 01:33:41 +00:00
Matthias Clasen
dbee1a8160 dnd: Use standard cursor names
The css spec doesn't cover the fringe 'ask' feature of DND, but
apart from that, we should use the names in the spec.

Fixes: #6337
2024-01-16 19:45:53 -05:00
Matthias Clasen
133cd87bdf Merge branch 'ebassi/doc-fixes' into 'main'
docs: Clean up the note on nVidia on Windows

See merge request GNOME/gtk!6773
2024-01-17 00:20:35 +00:00
Benjamin Otte
9f8e84cb60 Merge branch 'wip/otte/for-main' into 'main'
gl: BGRA formats need a different internal format

Closes #6333

See merge request GNOME/gtk!6772
2024-01-16 21:21:17 +00:00
Emmanuele Bassi
b8057b088e docs: Clean up the note on nVidia on Windows
Turn the URL to the nVidia forums into an actual link, and put the whole
paragraph into an aside.
2024-01-16 20:14:21 +00:00
Jan Willem Eriks
cf8cca8724 Flatpak builds pass the commit sha as environment variable
This variable is refrenced at build-aux/meson/gen-demo-header.py but never passed to the flatpak builder.
This fixes that the flatpak build don't have their commit in the about window.
2024-01-16 20:45:01 +01:00
Benjamin Otte
d97767014c gl: BGRA formats need a different internal format
In GLES, BGRA is still done by GL_EXT_texture_format_BGRA8888 which is
an extension that is older than GLES 2.0.

And back then, internal formats had to be specified unsized. And when
that was changed with GLES3, nobody updated the extension.
However, on OpenGL, this extension doesn't exist, and internal formats
need to be sized.

So let's use different internal formats depending on GL version.

Fixes #6333
2024-01-16 20:35:20 +01:00
Benjamin Otte
2f974a1f5a gl: Split internal format for GdkMemoryFormat into GL/GLES
This commit just duplicates the struct.

It's separate because it's just a bunch of boilerplate.
2024-01-16 20:35:20 +01:00
Benjamin Otte
4e2c7d5eb0 gl: Require GL/GLES flag when looking up memory formats
This code just adds the argument to the function and fixes all callers.

It's separate because it's just a bunch of boilerplate.
2024-01-16 20:35:20 +01:00
Emmanuele Bassi
a5d1cb93ef Merge branch 'ebassi/flatpak-no-vulkan' into 'main'
ci: Really disable Vulkan for Flatpak bundles

See merge request GNOME/gtk!6769
2024-01-16 16:31:38 +00:00
Emmanuele Bassi
401b902cbf ci: Really disable Vulkan for Flatpak bundles
We don't use the config options from the manifest to build GTK.
2024-01-16 15:56:58 +00:00
Matthias Clasen
9f2778b97c Merge branch 'fallback-6298' into 'main'
popovermenu: Add default sliding flag

See merge request GNOME/gtk!6746
2024-01-16 13:41:58 +00:00
Matthias Clasen
ed4eeb8adb Merge branch 'wip/chergert/fix-object-expression-notify' into 'main'
expression: combine GWeakNotify and GWeakRef for object expression

Closes #5542 and #6220

See merge request GNOME/gtk!6763
2024-01-16 13:34:08 +00:00
Matthias Clasen
fb36d30685 Merge branch 'custom-font-url' into 'main'
gsk: Keep a fontmap reference in text nodes

See merge request GNOME/gtk!6759
2024-01-16 13:04:13 +00:00
Matthias Clasen
385b9a7241 gsk: Serialize custom fonts with url
If we see custom fonts when serializeing text nodes, write data
url that contains the font file, the first time we see it.

This does not add blobs standard fonts, like Cantarell or Monospace.

Update all affected nodeparser tests.
2024-01-16 07:04:45 -05:00
Matthias Clasen
c2abf30c46 Revert "node-editor: Make test fonts available"
This reverts commit 4882514234.

We can now put custom fonts into node files, so there is
no more need for this.
2024-01-16 07:04:45 -05:00
Matthias Clasen
50a47f55d9 Revert "rendernode-tool: Make test fonts available"
This reverts commit cdbfb35067.

We can now put custom fonts into node files, so there is
no more need for this.
2024-01-16 07:04:45 -05:00
Matthias Clasen
cd7fe772a7 tests: Drop fontconfig setup for custom fonts
We are putting custom fonts into node files now, so there is
no more need for this.
2024-01-16 07:04:45 -05:00
Matthias Clasen
317bba756e Port existing gsk tests to embedded custom fonts
Make all the tests using custom fonts use the new url syntax.
2024-01-16 07:04:45 -05:00
Matthias Clasen
2212049e8f Merge branch 'wip/otte/for-main' into 'main'
Fix infinite loop in zenity

See merge request GNOME/gtk!6767
2024-01-16 11:36:34 +00:00
Matthias Clasen
0f26a006ee Merge branch 'revert-364eec24' into 'main'
Revert "Merge branch 'demos-enable-vulkan' into 'main'"

See merge request GNOME/gtk!6766
2024-01-16 10:15:52 +00:00
Benjamin Otte
3c451b3ec7 columnview: Make sure cells disconnect from their column
When a cell is removed from the columnview, we need to make sure it s
not just removed from the cell (via unset_parent()) but also from the
column.

Previously, we were doing this from dispose(), but this is broken
because dispose() only runs when the refcount goes to zero. But if some
code still has a reference for whatever reason, this won't happen.

So now we do it explicitly together with unset_parent().
2024-01-16 07:20:23 +01:00
Benjamin Otte
323adf9aa8 Revert "gtkcolumnviewcellwidget: move cleanup from dispose to unroot"
This reverts commit ff262c081e.

This is a wrong fix because it triggers when the columnview gets
unrooted but the cell keeps existing. Later, when the columnview gets
re-rooted, the cell is still there but thinks it has no column.

And that's bad.
2024-01-16 06:59:15 +01:00
Benjamin Otte
70f0cde730 tests: Fix gio API usage
Related: glib!3261
2024-01-16 06:22:43 +01:00
Christian Hergert
14e78663ee expression: combine GWeakNotify and GWeakRef for bind expression
This does the same thing to GtkExpressionBind that was done to
GtkExpressionObject. Use a GWeakRef to ensure we're working with a valid
object instead of relying on when our weak pointer and/or notify callback.
2024-01-15 20:59:27 -08:00
Christian Hergert
d8279209a2 expression: retrieve next pointer before notifying closure
Any time we call back into user code we risk re-entrancy issues. Get the
next pointer for the list before calling back into notifiers.
2024-01-15 20:41:45 -08:00
Christian Hergert
a0527ff0bd expression: combine GWeakNotify and GWeakRef for object expression
When using a GtkObjectExpression multiple times in the same GtkBuilder
template, we can run into a situation where we are in disposal but have
not yet had our callback notified.

This attempts to improve on that situation by using something I've done in
other projects for years. Combine both GWeakNotify and GWeakRef. Only use
the GWeakRef to get an object instance rather than relying on the
GWeakNotify alone.

By doing this, we can avoid trying to remove an object weak reference for
an object that is in disposal and causing runtime warnings.

Fixes #5542
Fixes #6220
2024-01-15 19:29:29 -08:00
Matthias Clasen
771ea81715 Merge branch 'fix-doc-link' into 'main'
docs: Update link to GitLab documentation

See merge request GNOME/gtk!6764
2024-01-16 01:49:34 +00:00
Emmanuele Bassi
f22a3f9ec6 Revert "Merge branch 'demos-enable-vulkan' into 'main'"
This reverts merge request !6724
2024-01-16 00:45:00 +00:00
Matthias Clasen
246876a404 Add a test for font-related node parser errors
This tests the behaviors implemented in the previous commit.
2024-01-15 18:58:17 -05:00
Matthias Clasen
27a086b5f0 Add a test for new text node syntax
Add a test that checks that font: properties can be parsed without
error, both with and without the optional url.
2024-01-15 18:58:17 -05:00
Matthias Clasen
8158945de9 gsk: Allow custom fonts in node files
This will let us store complete test fonts inside node files,
as data: urls. You can also use a file: url to refer to a local
file.

The syntax is as follows:

text {
  font: "FONT DESCRIPTION" url("data:font/ttf;base64,FONT DATA");
}

with the url being optional.
2024-01-15 18:58:17 -05:00
Matthias Clasen
1c85141612 gsk: Keep a fontmap reference in text nodes
A PangoFont keeps a weak reference to its fontmap. In addition,
keep a strong reference in GskTextNode, so we can be sure that
custom font maps won't go away before the node is finalized.
2024-01-15 18:25:15 -05:00
Matthias Clasen
690381672b tests: Fix up test font naming
The entry for the family name in the name table has nameID=1, not
nameID=0, so we were relying on the filename to be just right.
Oops.
2024-01-15 18:25:15 -05:00
Matthias Clasen
3d7ff44dc5 Cosmetics 2024-01-15 18:25:15 -05:00
Florian Müllner
a518c59098 docs: Update link to GitLab documentation
The original link no longer works, so update the reference to
point to the currently correct location.
2024-01-15 21:41:15 +01:00
Benjamin Otte
1dd5e92499 Merge branch 'unroot' into 'main'
gtkcolumnviewcellwidget: move cleanup from dispose to unroot

Closes #6200

See merge request GNOME/gtk!6758
2024-01-15 14:13:09 +00:00
Matthias Clasen
fbd3c5ebd0 Merge branch 'matthiasc/for-main' into 'main'
Update the node format docs

See merge request GNOME/gtk!6761
2024-01-15 13:00:51 +00:00
Matthias Clasen
48dc7df5b7 Update the node format docs
Mention the new syntax for naming and reusing textures.
2024-01-15 07:46:18 -05:00
Emmanuele Bassi
0c4c90d606 Merge branch 'stackpage-auto-cleanup' into 'main'
stack: Add automatic cleanup for GtkStackPage

See merge request GNOME/gtk!6760
2024-01-15 11:33:07 +00:00
Guido Günther
da954d20f9 stack: Add automatic cleanup for GtkStackPage
Useful when iterating over the pages via g_list_model_get_item ().
2024-01-15 11:48:21 +01:00
tszymanski
ff262c081e gtkcolumnviewcellwidget: move cleanup from dispose to unroot
No longer gets stuck in an infinite loop.

Fixes #6200
2024-01-14 15:38:21 -08:00
Matthias Clasen
c6967234de Merge branch 'matthiasc/for-main' into 'main'
gsk: Inline some more rect functions

See merge request GNOME/gtk!6755
2024-01-14 22:37:02 +00:00
Matthias Clasen
cdbfb35067 rendernode-tool: Make test fonts available
We are likely to use the tool with node files from out testsuite,
which may now refer to custom test fonts, so make them available
in the same way as in the node editor.

If in doubt, you can set GTK_SOURCE_DIR to make the tool find the
fonts.
2024-01-14 16:58:05 -05:00
Matthias Clasen
53e17ab14e Merge branch 'node-editor-autosave' into 'main'
node-editor: Add an auto-reload property

See merge request GNOME/gtk!6757
2024-01-14 21:51:19 +00:00
Matthias Clasen
550e98090a node-editor: Redo crash recovery UX
Switch from a dialog to an in-app notification, and make use
of the new auto-reload property for it.
2024-01-14 14:40:51 -05:00
Matthias Clasen
2771befdd9 node-editor: Add a menu items for auto reloading
Expose the auto-reload property as a toggle action, and add
a menu item for it.
2024-01-14 14:40:51 -05:00
Matthias Clasen
911730493d node-editor: Add an auto-reload property
This is not exposed anywhere yet.
2024-01-14 14:40:51 -05:00
Maximiliano Sandoval
d05f47a695 popovermenu: Add default sliding flag
Also add missing annotation.

Continuation of https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6298
2024-01-14 16:32:20 +01:00
Quentin PAGÈS
11dc15207e Update Occitan translation 2024-01-14 11:32:22 +00:00
Arjan Molenaar
6d0cef41b4 macos: fix memory leak in pattern rule conversion
No need to retain the pattern.
2024-01-14 10:18:36 +01:00
Arjan Molenaar
caf389c4e5 macos: Add pixbuf formats similar to mime-types
Both mime-type and pixbuf-formats rules use
`g_content_type_from_mime_type()` to convert their (mime) types
to native UTI types.

So it's just enough to convert the file types associated
with pixbuf-formats to a NSArray of NSStrings.
2024-01-14 10:18:25 +01:00
Matthias Clasen
4ea748a676 Merge branch 'matthiasc/for-main' into 'main'
Add another font rendering test

See merge request GNOME/gtk!6752
2024-01-14 01:16:57 +00:00
Matthias Clasen
b78d2a7f75 Add another font rendering test
This one tests that we handle glyphs with lsb correctly wrt. to
positioning.
2024-01-13 17:47:27 -05:00
Arjan Molenaar
1237fd9ab5 Add non-NULL check for gtk_editable_set_text() 2024-01-13 21:43:37 +01:00
Arjan Molenaar
1e5a9eb7b9 Be lenient with input text
Allow text to be NULL, but treat it as an empty string in order to
avoid segfaults.

Use the same method already used by GtkLabel to avoid NULL being
used as text.
2024-01-13 21:43:37 +01:00
Arjan Molenaar
41fc0955f6 Add additional check for NULL text
Although text should be a string, it is possible that
(e.g via language bindings) a NULL text is entered.
When this happens, the app just crashes.

This changes adds a not-NULL check for text input to ensure that
whatever is provided is valid.
2024-01-13 21:43:36 +01:00
Benjamin Otte
1fd9e1e916 Merge branch 'wip/otte/benchmark' into 'main'
Add gtk-rendernode-tool benchmark

See merge request GNOME/gtk!6751
2024-01-13 17:20:45 +00:00
Benjamin Otte
24ceb47cbc tools: Add the new benchmark command to the docs 2024-01-13 17:22:57 +01:00
Benjamin Otte
8872e1cbb0 tools: Add gtk-rendernode-tool benchmark
A simple tool that runs gsk_renderer_render_texture() a few times with
every renderer and prints the results.
2024-01-13 17:22:57 +01:00
Benjamin Otte
c1e2ffac83 tools: Split out a function
There's a function now that creates a renderer by name - and allows NULL
for the default renderer
2024-01-13 17:22:57 +01:00
Piotr Drąg
17df646663 Update POTFILES.in 2024-01-13 13:29:25 +01:00
Ngọc Quân Trần
6f8fae590f Update Vietnamese translation
(cherry picked from commit cbc44e202a)
2024-01-13 07:19:30 +00:00
Matthias Clasen
4146db0003 Merge branch 'matthiasc/for-main' into 'main'
glarea: Add some details to the docs

Closes #6317

See merge request GNOME/gtk!6749
2024-01-13 03:17:05 +00:00
Matthias Clasen
9c228cc634 glarea: Add some details to the docs
Mention that the rendering is integrated into the GTK scene graph
as a texture and that the initial framebuffer contents are
transparent.

Fixes: #6317
2024-01-12 21:58:44 -05:00
Matthias Clasen
df2cdb6913 Merge branch 'node-editor-autosave' into 'main'
node-editor: Add autosave

See merge request GNOME/gtk!6748
2024-01-13 02:30:06 +00:00
Matthias Clasen
22a5447039 docs: Document new node-editor options 2024-01-12 21:13:51 -05:00
Matthias Clasen
a2475051fa Merge branch 'use-modifier-none' into 'main'
Use GDK_NO_MODIFIER_MASK in default prop values

See merge request GNOME/gtk!6747
2024-01-13 01:55:12 +00:00
Matthias Clasen
d41fb7c5a6 node-editor: Add commandline options
Add --reset to remove the autosave file. While we're at it, also
add --version.
2024-01-12 20:50:34 -05:00
Matthias Clasen
3b28c46595 node-editor: Add autosave
Save the buffer contents to a file in ~/.cache/gtk4-node-editor
and restore it on startup.
2024-01-12 20:50:34 -05:00
Maximiliano Sandoval
f57300b924 Use GDK_NO_MODIFIER_MASK in default prop values 2024-01-13 01:30:02 +01:00
Emilio Cobos Álvarez
2f5278a139 [gtk4/wayland] Infer edge constraints from tiled edges.
This is the Gtk4 version of !6742, which fixes the same bug as described
there.
2024-01-12 22:40:22 +01:00
Matthias Clasen
c146f225ff Merge branch 'big-glyph-test' into 'main'
gsk: Fix big glyphs getting clipped

See merge request GNOME/gtk!6744
2024-01-12 21:31:35 +00:00
Matthias Clasen
9f4f65be4a gsk: Add test for clipped big glyphs
Tests the fix in the previous commit 93715b963e.

Sadly, the flipped variant of this test fails with the cairo
renderer, so it is marked as -nocairo. All the other renderers
pass it.
2024-01-12 16:02:05 -05:00
Matthias Clasen
93715b963e gsk: Fix big glyphs getting clipped
We were inadvertedly shifting the rendering by one pixel.
2024-01-12 15:55:27 -05:00
Benjamin Otte
c1407f2ca6 Merge branch 'wip/otte/for-main' into 'main'
gpu: Remove unnecessary optimization

Closes #6322

See merge request GNOME/gtk!6743
2024-01-12 19:23:46 +00:00
Benjamin Otte
3b299f574d testsuite: Add a test for contained clips
Related: #6322
2024-01-12 20:06:04 +01:00
Benjamin Otte
a51c6aed47 gpu: Introduce "contained" clip
This clip is different from "none" in that the bounds rect cannot be
ignored and that potential drawing outside the clip must be avoided.

In particular it means that clip nodes cannot be discarded if they
encompass the full clip region.

Fixes #6322
2024-01-12 20:06:04 +01:00
Benjamin Otte
b552cf74dd gpu: Remove unnecessary optimization
Every branch in the switch is so optimized that it does this check
early anyway, so there's no need to have it as an extra step.
2024-01-12 20:06:04 +01:00
Matthias Clasen
0be0265751 Merge branch 'ebassi/doc-since-fix' into 'main'
docs: Add missing Since to gtk-show-status-shapes setting

See merge request GNOME/gtk!6741
2024-01-12 15:04:05 +00:00
Matthias Clasen
207dd6fe0d Merge branch 'matthiasc/for-main' into 'main'
gsk: Fix up test names to include 'compare'

See merge request GNOME/gtk!6739
2024-01-12 14:38:46 +00:00
Emmanuele Bassi
a87ff8d556 docs: Add missing Since to gtk-show-status-shapes setting 2024-01-12 12:54:54 +00:00
Matthias Clasen
153cb8316e gsk: Fix up test names to include 'compare' 2024-01-11 23:19:29 -05:00
Matthias Clasen
7ad7c0d8c1 Merge branch 'switch-shapes' into 'main'
switch: Follow "switch-shapes" setting

Closes #5354

See merge request GNOME/gtk!6731
2024-01-11 19:19:58 +00:00
Benjamin Otte
61595af586 Merge branch 'ngl-backbuffer-leak' into 'main'
ngl: Don't leak the backbuffer

See merge request GNOME/gtk!6736
2024-01-11 11:16:31 +00:00
Matthias Clasen
d240c35850 ngl: Don't leak the backbuffer
Clear it in unrealize, just like the vulkan renderer does with
its targets.
2024-01-10 23:08:01 -05:00
Matthias Clasen
d276eb9e9a Merge branch 'test-font-tweaks' into 'main'
tests: Change the way custom fonts are handled

See merge request GNOME/gtk!6734
2024-01-11 03:33:15 +00:00
Matthias Clasen
afe4cbf26d tests: Change the way custom fonts are handled
Instead of setting FONTCONFIG_FILE to a custom font configuration,
pass the directory containing the fonts as TEST_FONTS and use
FcConfigAppFontAddDir to add them to the default font configuration.
2024-01-10 22:18:37 -05:00
Matthias Clasen
76e5ef6937 Merge branch 'node-editor-tweaks' into 'main'
node-editor: Make test fonts available

See merge request GNOME/gtk!6733
2024-01-11 02:55:50 +00:00
Matthias Clasen
0ed43f66a9 docs: Beef up the node-editor man page
Mention the GTK_SOURCE_DIR environment variable in the man page.
2024-01-10 21:10:36 -05:00
Matthias Clasen
4882514234 node-editor: Make test fonts available
Add the directory containing test fonts for gsk tests to the
font configuration, so that node files from the testsuite using
these fonts just work.
2024-01-10 21:10:36 -05:00
Matthias Clasen
a15e87d2a6 Merge branch 'mixed-color-test' into 'main'
gsk: Add another font text

See merge request GNOME/gtk!6732
2024-01-11 01:50:09 +00:00
Matthias Clasen
cc92b9b19f gsk: Add another font text
This is similar to text-mixed-color, but it uses the COLRv1 table,
to test our support for this font technology.
2024-01-10 19:44:55 -05:00
Florian Müllner
bf0120f73d switch: Follow "show-status-shapes" setting
Whether or not switches include shapes to indicate their ON/OFF
state is currently controlled by the stylesheet (in particular
the HighContrast style).

However there are use cases for both using the HighContrast style
without shapes, and for using shapes with the regular stylesheet,
so follow the newly added "show-status-shapes" setting instead.

https://gitlab.gnome.org/GNOME/gtk/-/issues/5354
2024-01-11 01:33:16 +01:00
Matthias Clasen
7f06eed8da Merge branch 'hc-cleanup' into 'main'
wayland/display: Don't notify "icon-theme" on high-contrast changes

See merge request GNOME/gtk!6730
2024-01-10 21:38:55 +00:00
Matthias Clasen
dc30044829 Merge branch 'gpu-fix-mixed-color-text' into 'main'
gpu: Fix handling of mixed-color text runs

See merge request GNOME/gtk!6725
2024-01-10 18:11:23 +00:00
Matthias Clasen
781fe2d7fa gsk: Add a compare test for mixed color runs
This tests the fixes in aa82190da659b5 and dcaa2c4ccb182c74cb40.

The test uses a custom font named 'text-mixed-color' which contains
six glyphs that are just boxes. Glyphs 1, 2, 3 are just plain glyphs,
and glyphs 4, 5, 6 are color glyphs in red, green and blue.

The glyphs are mapped to the characters A, B, C, D, E, F.

The test is currently disabled for cairo, since it has some issues
with transformed color glyphs.
2024-01-10 12:49:08 -05:00
Florian Müllner
b8a61f7899 wayland/display: Don't notify "icon-theme" on high-contrast changes
Since commit c3706ea9ec, the "high-contrast" setting no longer
forces the "HighContrast" icon theme.
2024-01-10 15:46:46 +01:00
Matthias Clasen
a44ca6756a gpu: Use the right format for atlases
The glyph atlas format needs to match the cairo memory format.
NGL was getting this wrong, causing color glyphs to have their
red and blue swapped.
2024-01-10 08:00:15 -05:00
Matthias Clasen
490a9f193d gpu: Fix handling of mixed color text runs
We need to decide per-glyph whether to use coloring or texture ops.
2024-01-10 08:00:15 -05:00
Matthias Clasen
754d364efd gsk: Allow custom fonts in tests
The commit adds a custom fontconfig configuration in
testsuite/gsk/fonts/fonts.conf and sets the FONTCONFIG_FILE
environment variable for the gsk compare tests to point at it.

To use a custom font in tests, just drop it into the
testsuite/gsk/fonts/ directory.

The font configuration includes the system configuration,
so existing tests should not be affected.
2024-01-10 07:58:19 -05:00
Benjamin Otte
4939f0bb75 Merge branch 'wip/otte/for-main' into 'main'
contour: Fix stroke bounds for rect contour

See merge request GNOME/gtk!6728
2024-01-10 01:05:22 +00:00
Carlos Garnacho
7537d80047 Merge branch 'wip/show-tablet-cursor' into 'main'
gdk/wayland: reset cursor_is_default on proximity out

Closes #6312

See merge request GNOME/gtk!6720
2024-01-10 00:55:32 +00:00
Benjamin Otte
c5bdf0a995 testsuite: Add tests for pixel grid accuracy
See previous commit for details.
2024-01-10 01:33:49 +01:00
Peter Hutterer
04870fc1a1 gdk/wayland: Reset cursor_is_default on proximity out
For tablet tools if we have NULL cursor, we use the default cursor
instead. This provides us with a tablet cursor when an application never
sets the cursor.

However, on proximity out when we clear said cursor we also
need to toggle off cursor_is_default, otherwise on the next proximity in
we assume we already have a cursor and never update it again.

This leads to an invisible cursor over GTK application when the tablet
tool is brought into proximity over the widget (but not when moving into
the widget from the outside).

Closes: #6312
2024-01-10 00:25:01 +00:00
Matthias Clasen
43e5bc795a Merge branch 'log_whitespace' into 'main'
Add missing space to warning

See merge request GNOME/gtk!6729
2024-01-10 00:06:05 +00:00
Spencer Burris
f3ec58d290 Add missing space to warning 2024-01-09 16:57:26 -07:00
Benjamin Otte
5b3d14e15b gpu: respect pixel grid for Cairo rendering
Make sure fallbacks and fill/stroke masks use image surfaces with the
same pixel grid as the target if possible.

Fixes blurriness with some path renderings.
2024-01-10 00:13:52 +01:00
Benjamin Otte
131ab11f5c testsuite: Check that pixel grid math respects offsets 2024-01-10 00:13:52 +01:00
Benjamin Otte
a2eb467663 gpu: Change rect_round_pixels() to take an offset
We need to respect the offset when converting to the pixel grid, so pass
the current offset into the function.

Also move the rounded out of gsk_gpu_get_node_as_image() and into the 2
callers, because the offset is not passed into the function and I see no
reason to change that.
2024-01-10 00:13:52 +01:00
Benjamin Otte
06f85ee566 contour: Fix stroke bounds for rect contour
There's no tests for stroke bounds, oh no!
2024-01-09 23:27:55 +01:00
Benjamin Otte
aab40ad6a2 gpu: Fix text coordinates in the ubershader 2024-01-09 23:27:55 +01:00
Matthias Clasen
364eec24b1 Merge branch 'demos-enable-vulkan' into 'main'
Enable vulkan on the flatpak demos.

See merge request GNOME/gtk!6724
2024-01-08 20:53:25 +00:00
Jan Willem Eriks
f1fe21e009 Enable vulkan on the flatpak demos.
Since ed12c0cd5a enabled vulkan by default also build the demos with Vulkan enabled.
2024-01-08 19:01:02 +01:00
Artur S0
126cbccddf Update Russian translation 2024-01-08 13:43:52 +00:00
Benjamin Otte
26cf74de5c Merge branch 'wip/otte/for-main' into 'main'
Wip/otte/for main

See merge request GNOME/gtk!6721
2024-01-08 11:48:43 +00:00
Benjamin Otte
2ecb8c08dc testsuite: Add a test for borders inside opacity
Tests the latest fix.
2024-01-08 11:17:09 +01:00
Matthias Clasen
ce7cc942e4 gpu: Use opacity for border colors
We were computing the right colors, but forgot to use them.
2024-01-08 11:17:09 +01:00
Benjamin Otte
a0e9d93b4c testsuite: Add a test for previous fix
Fill a rectangle with fractional coordinates << 1.0 but scale it up so
that it ends up being nice integers.

Makes sure that nobody does any bad rounding here.
2024-01-08 11:17:09 +01:00
Benjamin Otte
017aea1952 gl: Fix rendering of nodes with fractional offsets
We can't just be floored by fractions, especially not when we have a
massive scale factor.

Fixes rendering of paintable gtk-demo.
2024-01-08 09:28:26 +01:00
Benjamin Otte
63d7b22924 demo: Port the paintable demo to paths 2024-01-08 09:28:26 +01:00
Benjamin Otte
3f3629154c gpu: clip to redraw region rects instead of extents
Instead of using the bounds of the clip region, emit individual
renderpasses for each rectangle of the clip region.

The benefit of this depends on how many pixels the clip region covers,
but for widget factory it reduces the required rendering by a huge
amount.

This is now the best clipping renderer - Cairo doesn't clip at all and
GL clips based on the extents.
2024-01-08 09:28:26 +01:00
Benjamin Otte
c3cfabfa96 gpu: Respect the initial scissor clip in the clip region
Previously, we would set a scissor rect when doing a partial redraw, but
we would not clip the nodes based on that rectangle.

Do that now.

This massively reduces the amount of ops we emit for small redraws.
2024-01-08 09:28:26 +01:00
Ekaterine Papava
cd9525afc9 Update Georgian translation 2024-01-08 04:13:07 +00:00
Matthias Clasen
4d76beb59c Merge branch 'matthiasc/for-main' into 'main'
Matthiasc/for main

See merge request GNOME/gtk!6717
2024-01-08 02:46:11 +00:00
Matthias Clasen
59578c6d18 Fix typos throughout
These were pointed out by codespell.
2024-01-07 20:44:05 -05:00
Matthias Clasen
7bf8669d97 gdk: Cosmetics 2024-01-07 19:31:01 -05:00
Matthias Clasen
e1156ea636 gtk: Cosmetics 2024-01-07 18:32:05 -05:00
Matthias Clasen
82f601253e gtk: Cosmetics 2024-01-07 18:31:09 -05:00
Matthias Clasen
96e710a76f Post-release version bump 2024-01-07 11:18:47 -05:00
Matthias Clasen
a45b66e1ca Merge branch 'matthiasc/for-main' into 'main'
ci: Fix test names

See merge request GNOME/gtk!6716
2024-01-07 14:55:46 +00:00
Matthias Clasen
325b0010e4 NEWS: Updates 2024-01-07 09:40:43 -05:00
Matthias Clasen
bf14a5f70b ci: Fix test names
Don't call the offload test 'parser ...'.
2024-01-07 09:40:43 -05:00
Matthias Clasen
532e887c88 Merge branch 'wip/otte/vulkan-api' into 'main'
Vulkan and new renderer related API changes

See merge request GNOME/gtk!6715
2024-01-07 14:40:05 +00:00
Benjamin Otte
7830535c04 vulkan: Guard dmabuf code with HAVE_DMABUF 2024-01-07 15:07:15 +01:00
Benjamin Otte
440c207146 build: Enable Vulkan on msys CI 2024-01-07 14:47:22 +01:00
Benjamin Otte
ed12c0cd5a build: Enable Vulkan by default
It's still possible to disable via -Dvulkan=disabled

We force-disable it on Mac OS.

I don't know how to best handle it on Windows. Technically we don't need
it, because the Vulkan stuff we want is about dmabufs, but I have no
idea how to convince the build system to toggle the default to
"disabled" on Windows, so it has to stay enabled for now.
2024-01-07 14:47:22 +01:00
Benjamin Otte
543c7ae52a vulkan: Disable gdk_surface_create_vulkan_context()
... and deprecate it.

It will now always return NULL and error out.

We do not want to expose any Vulkan internals in the public API.
2024-01-07 14:47:22 +01:00
Benjamin Otte
3ac50b81f2 vulkan: Make gdk_display_create_vulkan_context() take a surface
This is so we can deprecate gdk_surface_create_vulkan_context() which is
public API in the next commit.
2024-01-07 14:47:22 +01:00
Benjamin Otte
6bac377fa5 gdk: Don't include vulkan.h in public API anymore 2024-01-07 14:47:22 +01:00
Benjamin Otte
3bb1c2298f gsk: Emit deprecation warning for #include <gsk/gl/gskglrenderer.h>
This is a bit hacky, but it seems to work.

Note: It doesn't work inside GTK because GTK_COMPILATION during the
whole build.
2024-01-07 14:47:22 +01:00
Benjamin Otte
637f6cc81b gtk: Don't #include <gsk/gl/gskglrenderer.h> 2024-01-07 14:47:22 +01:00
Benjamin Otte
0ba8903fa5 testsuite: Don't #include <gsk/gl/gskglrenderer.h> 2024-01-07 14:47:22 +01:00
Benjamin Otte
ee14b96c28 node-editor: Don't #include <gsk/gl/gskglrenderer.h> 2024-01-07 14:47:22 +01:00
Benjamin Otte
cf86a01b65 gsk: Include GL renderer in gsk.h
Same as the Vulkan renderer
2024-01-07 14:47:22 +01:00
Benjamin Otte
f57e211ba9 node-editor: Use gsk_renderer_realize_for_display()
... in all the places where we used realize (NULL) before.
2024-01-07 14:47:22 +01:00
Benjamin Otte
e2c8b7fa6c testsuite: Use gsk_renderer_realize_for_display()
... in all the places where we used realize (NULL) before.
2024-01-07 14:47:22 +01:00
Benjamin Otte
b486588883 dmabuf: Use gsk_renderer_realize_for_display()
We want to use the correct display when realizing our dmabuf
downloaders.

It's a good thing that the inspector doesn't use dmabufs, isn't it?
2024-01-07 14:47:22 +01:00
Benjamin Otte
d0bf33339e API: Add gsk_renderer_realize_for_display()
This makes realizing a renderer without a surface explicit.

And more importantly, it allows passing a different display than the
default one.
2024-01-07 14:47:22 +01:00
Benjamin Otte
df09975753 renderer: Pass the display as part of the vfunc
We allow realizing renderers without surfaces. But they still need a
display, so pass it explicitly.
2024-01-07 14:47:22 +01:00
Benjamin Otte
d21467e2e8 gdk: Remove all VulkanContext API
All API for GdkVulkanContext gets removed here. It was experimental and
it's not a good API. So get rid of it.
2024-01-07 14:47:22 +01:00
Benjamin Otte
c8529df309 inspector: Use Vulkan without a context
This means we don't need to include gdkvulkancontext.h and it means we
don't initialize Vulkan if it isn't initialized yet.

Should we?
Should we add a button maybe?

No idea.
2024-01-07 14:47:22 +01:00
Benjamin Otte
5f03053569 gsk: include Vulkan renderer in public header
The Vulkan renderer can just be public API, because it doesn't expose
any Vulkan-specific APIs.
And it can just exist when compiled without Vulkan, because it can fail
to realize.

Also move get rid of the gsk/vulkan/gskvulkanrenderer.h header. It was
experimental and isn't necessary now that the renderer is included via
gsk.h.
2024-01-07 14:47:22 +01:00
Benjamin Otte
1dbd74e181 Merge branch 'wip/otte/gpu' into 'main'
Add new unified renderer

See merge request GNOME/gtk!6588
2024-01-07 07:44:16 +00:00
Matthias Clasen
c8ae2d9002 testsuite: Add NGL and Vulkan renderer to compare tests
Add a testsuite called gsk-compare-vulkan to run
the gsk renderer tests with the Vulkan renderer and
gsk-compare-ngl to run them with the NGL renderer.

To run the tests locally, you can do:

meson test -C_build --suite gsk-compare-vulkan
2024-01-07 08:18:36 +01:00
Benjamin Otte
03cd652063 gpu: Disable the ubershader when shaders aren't nonuniform
If shaders don't support nonuniform indexing, we emulate it via if/else
ladders (or switch ladders) which get inlined by the GLSL compiles and
massively blow up the code.

And that makes compilation of the shaders take minutes and results in
shader code that isn't necessarily faster.

So we disable it on GL entirely and on Vulkan if the required features
aren't available.

As it's only an optimization and does not fall back to Cairo anymore,
this should be fine.
2024-01-07 08:18:36 +01:00
Matthias Clasen
c0d49f296e Update docs
Update the docs for environment variables that we parse to include
GDK_VULKAN_SKIP and GSK_GPU_SKIP.
2024-01-07 07:22:53 +01:00
Benjamin Otte
1723ab34e1 gpu: Setup attribute locations
Make the generator generate calls for the correct glBindAttribLocation()
calls.

Usually this was done correctly, but we can't rely on it. So do it
explicitly.
2024-01-07 07:22:53 +01:00
Benjamin Otte
55dbf0accb gpu: Add GSK_GPU_SKIP=blit
This allows bypassing all blit operations using gsk_gpu_blit_op()
in favor of shaders.
2024-01-07 07:22:53 +01:00
Benjamin Otte
b3d044a0b1 gpu: Add more assertions to blitop
The blitop is nasty, so we should make sure we have supported images
when using it.
2024-01-07 07:22:53 +01:00
Benjamin Otte
2fef71da5c gpu: Generate mipmap by default when downscaling too much
When downscaling more than 2x in either dimension, force mipmap use for
the texture in a texture node.
It improves the quality of textures but takes extra work.

The GL renderer does this, too (for textures that aren't in the icon cache).

This can be disabled via GSK_GPU_SKIP=mipmap.

Fixes the big-checkerboard-scaled-down2 test.
2024-01-07 07:22:53 +01:00
Benjamin Otte
48c1f5fd27 gpu: Add supersampling for gradients
Unless GSK_GPU_SKIP=gradients is given, we sample every point 4x instead
of 1x. That makes the shader run slower (by roughly a factor of 2.5x)
but it improves quality quite a bit.
2024-01-07 07:22:53 +01:00
Benjamin Otte
6e4a526ddf gpu: Add a blend mode shader
I'm a bit unsure about using the zero rect in the fallback situtation
where one image doesn't exist, but it seems to work.

This removes the last pattern-only rendernode and with that the last
fallback usage with disabled ubershader.
2024-01-07 07:22:53 +01:00
Benjamin Otte
d11886e7ac gpu: Use variations in the blur shader
Have one variation for colorizing to a shadow color and another
variation that just blurs.
2024-01-07 07:22:53 +01:00
Benjamin Otte
177b19a2da gpu: Use variations in the straight-alpha shader
This way we can toggle opacity handling on/off.

THe shader slowly turns into a fancy texture op - but I don't want to
rename it to "fancytexture" just yet.
2024-01-07 07:22:53 +01:00
Benjamin Otte
f943469fc9 gpu: Use variations for radial gradients 2024-01-07 07:22:53 +01:00
Benjamin Otte
59d062cb3d gpu: Use variations for the mask mode 2024-01-07 07:22:53 +01:00
Benjamin Otte
8032e30a76 gpu: Make linear gradients use variations 2024-01-07 07:22:53 +01:00
Benjamin Otte
2e81e4d452 gpu: Make box shadow shader use variations
Use it do differentiate between inset and outset shadows.
2024-01-07 07:22:53 +01:00
Benjamin Otte
d900407a18 gpu: Introduce the concept of "variation"
A variation is a #define/specialization constant that every shader can
use to specialize itself as it sees fit.

This commit adds the infrastrcture, future commits will add
implementations.
2024-01-07 07:22:53 +01:00
Benjamin Otte
64e5c76323 png: Don't set a size limit when saving
gdk_texture_save_to_png_bytes() cannot fail, so ensure that it doesn't.

Testsuite has been updated to check for this case.

Note that we do not load the PNG file that we generate here.
Loading is a lot more scary than saving after all.
If people want to load oversized PNG files, they should use a real PNG
loader.
2024-01-07 07:22:53 +01:00
Benjamin Otte
b9651606d3 gpu: Add a cross-fade shader 2024-01-07 07:22:53 +01:00
Benjamin Otte
2a5f6fdde5 gpu: Handle a clipping cornercase properly
If we enter the situation where we need to redirect the clipping to an
offscreen, make sure that:

* the ubershader gets only used when beneficial

* we size the offscreen properly and don't let it grow infinitely.

Fixes the clip-intersection-fail-opacity test
2024-01-07 07:22:53 +01:00
Benjamin Otte
6dbbd65ef8 gpu: Handle opacity in the Cairo path
Fixes random calls to add_fallback_node() from code that wants to handle
opacity.

Also makes Cairo nodes work with opacity, of course.
2024-01-07 07:22:53 +01:00
Benjamin Otte
9947760d87 gpu: Handle alpha in image_op() wrapper
There are various places where the alpha is implicitly assumed to be
handled, so just handle it.

As a bonus, this simplifies a bunch of code and makes the texture node
rendering work with alpha.
2024-01-07 07:22:53 +01:00
Benjamin Otte
493b83ff24 gpu: Optimize box-shadow shader
Like in the border shader, don't draw the (potentially large for the
window's shadow) inside part that is transparent.
2024-01-07 07:22:53 +01:00
Benjamin Otte
b65f6eef59 gpu: Replace a fallback with offscreens
Use an offscreen and mask it if the clips get too complicated.

Technically, the code could be improved to set the rounded clip on the
offscreen instead of rendering it as a mask, but that would require more
sophisticated tracking of clip regions by respecting the scissor, and
the current clip handling can't do that yet.

This removes one of the last places where the GPU renderer was still
using Cairo fallbacks.
2024-01-07 07:22:53 +01:00
Benjamin Otte
f6ff0ee18c gpu: Add gsk_gpu_node_processor_add_images()
This is for generating descriptors for more than 1 image. The arguments
for this function are very awkward, but I couldn't come up with better
ones and the function isn't that important.

And the calling places still look a lot nicer now.
2024-01-07 07:22:53 +01:00
Benjamin Otte
b388c066dc gpu: Add gsk_gpu_node_processor_init_draw/finish_draw()
These initialize/finish an offscreen and start drawing to it.

It simplifies the process of using offscreens quite a bit that way.
2024-01-07 07:22:53 +01:00
Benjamin Otte
9fe011b98f gpu: Add stroke support
Same as for fill nodes, we render the stroke to a mask and then run a
mask shader.

The color node child optimization is included already.
2024-01-07 07:22:53 +01:00
Benjamin Otte
89ab3a8146 gpu: Optimize solid color fills 2024-01-07 07:22:53 +01:00
Benjamin Otte
5dcaca9b3c gpu: Add fill node support
For now this uses Cairo to generate a mask and then runs a mask op.

This is different from just using fallback in that the child is rendered
with the GPU and not via fallback.
2024-01-07 07:22:53 +01:00
Benjamin Otte
69c8278558 gpu: Add a radial gradient shader
This is mainly copy/paste, so now this almost identical gradient code
exists 3 times.
That's kinda suboptimal.
2024-01-07 07:22:53 +01:00
Benjamin Otte
0e9b967bf9 gpu: Add a conic gradient shader 2024-01-07 07:22:53 +01:00
Benjamin Otte
0c32a94d8e gpu: Split linear gradient shader into 2 parts
A generic part that can be shared by all gradient shaders that does the
color stop handling and a gradient-specific part that needs to be
implemented individually by each gradient implementation.
2024-01-07 07:22:53 +01:00
Benjamin Otte
6d20f4bc60 gpu: Change the cairo upload op prototype
Make it take a draw function instead of a node.

This way, we can draw more fancy stuff with Cairo.
2024-01-07 07:22:53 +01:00
Benjamin Otte
8361949ba1 gpu: Handle >7 color stops
If there are more than 7 color stops, we can split the gradient into
multiple gradients with color stops like so:
  0, 1, 2, 3, 4, 5, transparent
  transparent, 6, 7, 8, 9, 10, transparent
  ...
  transparent, n-2, n-1, n
and use the new BLEND_ADD to draw them on top of each other.

Adapt the testcae that tests this to use colors that work with the fancy
algorithm we use now, so that BLEND_ADD and transitions to transparent
do not cause issues.
2024-01-07 07:22:52 +01:00
Benjamin Otte
8372bc00bd gpu: Make the ubershader use the correct coordinates
Instead of scaled coordinates, use the unscaled ones.

This ensure that gradients get computed correctly as they are not safe
against nonorthogonal transforms - like scales with different scale
factors.
2024-01-07 07:22:52 +01:00
Benjamin Otte
5cf3c70db0 gpu: Make blend modes configurable
For now, we only have OVER and ADD blend modes. This commit doesn't use
ADD, it just sets up all the machinery and refactors things.
2024-01-07 07:22:52 +01:00
Benjamin Otte
a031011e5e gpu: Add a linear-gradient shader
The shader can only deal with up to 7 color stops - but that's good
enough for the real world.

Plus, we have the uber shader.

And if that fails, we can still fall back to Cairo.

The code also doesn't handle repeating linear gradients yet.
2024-01-07 07:22:52 +01:00
Benjamin Otte
bd901896ee gpu: Add a mask shader
This shader can take over from the ubershader. And it can be used
instead of launching the ubershader when no offscreens are necessary.

Also includes an optimization that uses the colorize shader when
appropriate.
2024-01-07 07:22:52 +01:00
Benjamin Otte
cb5c994cd9 rgba: Add a few macros
... and use them.

Those macros hopefully make code more readable.
2024-01-07 07:22:52 +01:00
Benjamin Otte
39a0e27513 gpu: Use ubershader for repeat nodes when possible 2024-01-07 07:22:52 +01:00
Benjamin Otte
832ddb31b7 gpu: Add a repeat node renderer
The ubershader has some corner cases where it can't be used, in
particular when the child is massively larger than the repeat node and
the repeat node is used to clip lots of the source.
2024-01-07 07:22:52 +01:00
Benjamin Otte
8bdc7a3289 renderer: Add Vulkan renderer to the list of renderers
It's better than the Cairo renderer, so use it instead.

It's still only picked once GL fails, so it will probably only ever be
picked when people use GDK_DEBUG=gl-disable, but at least it will be
picked.
2024-01-07 07:22:52 +01:00
Benjamin Otte
57521e6242 renderer: Split function
per-backend renderers and GL renderers are a different thing, so treat
them as such.

Also, try the GL renderer unconditionally. The renderer initialization
code will take care of GL not being available.
2024-01-07 07:22:52 +01:00
Benjamin Otte
93d681ae77 vulkan: Add a Vulkan downloader
This is using the Vulkan renderer.

It also allows claiming support for all the formats that only Vulkan
supports, but that neither GL nor native mmap can handle.
2024-01-07 07:22:52 +01:00
Benjamin Otte
a9b27a7de0 gpu: Implement a GdkDmabufDownloader 2024-01-07 07:22:52 +01:00
Benjamin Otte
41d80ac277 gpu: Add a boolean flag allow_dmabuf to the downloadop
It can be set to force the downloadop to not create dmabuf textures.
2024-01-07 07:22:52 +01:00
Benjamin Otte
cf9b8231bd gpu: Update to memoryformat Vulkan code
The existing code for setting up formats was copied from the old Vulkan
renderer and never updated.
2024-01-07 07:22:52 +01:00
Benjamin Otte
3b6035a46d testsuite: Add new renderers to the scaling test 2024-01-07 07:22:52 +01:00
Benjamin Otte
c7a69882d3 gpu: Reorganize format handling
Add GSK_GPU_IMAGE_RENDERABLE and GSK_GPU_IMAGE_FILTERABLE and make sure
to check formats for this feature.

This requires reorganizing code to actually do this work instead of just
pretending formats are supported.

This fixes GLES upload tests with NGL.
2024-01-07 07:22:52 +01:00
Benjamin Otte
e5cd813a24 gpu: Add debug messages
Add FALLBACK debug messages when a texture upload format is not
supported.
2024-01-07 07:22:52 +01:00
Benjamin Otte
62d917eb08 vulkan: Use vulkan feature flags for incremental present
I did it because it unifies the code.

But it also gains the benefit of being debuggable because it can
now be turned off via GDK_VULKAN_SKIP=incremental-present
2024-01-07 07:22:52 +01:00
Benjamin Otte
d4c4e4bbc5 gpu: sync dmabufs via semaphores
This ensures both that we signal a semaphore for a dmabuf when we export
an image and that we import semaphores for dmabufs and wait on them.

Fixes Vulkan node-editor displaying the Vulkan renderer in the sidebar.
2024-01-07 07:22:52 +01:00
Benjamin Otte
cfcc9658b2 gpu: Make VulkanRealDescriptor keep the frame
There's too much interaction between the two to warrant not having it
around.
2024-01-07 07:22:52 +01:00
Benjamin Otte
d8a0cd24d7 gpu: Add support for blend modes 2024-01-07 07:22:52 +01:00
Benjamin Otte
496ecd68f2 gpu: Make Vulkan renderer provide dmabuf textures
Make gsk_renderer_render_texture() create a dmabuf texture if that is
possible.

If it isn't (ie if we're not on Linux or if dmabufs are otherwise not
working) fall back to the previous code of creating a memory texture.
2024-01-07 07:22:52 +01:00
Benjamin Otte
683878c733 gpu: Add gsk_gpu_device_create_download_image()
This way, we can differentiate between regular offscreens and images
that are meant to be used for gsk_renderer_render_texture() or similar.
2024-01-07 07:22:52 +01:00
Benjamin Otte
38c0e2bdf6 gpu: Update the pipeline cache
When a new shader was compiled, queue a save of the pipeline cache.
2024-01-07 07:22:52 +01:00
Benjamin Otte
f0fc2709d6 gpu: Implement support for multiple storage buffers
When using the uber shader a lot, we may overflow the (only 16kB large)
storage buffer.

Stop crashing when that happens and instead just allocate a new one.
2024-01-07 07:22:52 +01:00
Benjamin Otte
1b38cbd410 gpu: Handle storage buffers via descriptors
This makes the (currently single) storage buffer handled by
GskGpuDescriptors.
A side effect is that we now have support for multiple buffers in place.
We just have to use it.

Mixed into this commit is a complete rework of the pattern writer.
Instead of writing straight into the buffer (complete with repeatedly
backtracking when we have to do offscreens), write into a temporary
buffer and copy into the storage buffer on committing.
2024-01-07 07:22:52 +01:00
Georges Basile Stavracas Neto
c2ec97e922 gpu/renderer: Improve scale detection
The GL branch should eventually call into gdk_gl_context_get_scale(),
which is what checks for GDK_DEBUG=gl-fractional; whereas the Vulkan
branch needs no change.
2024-01-07 07:22:52 +01:00
Benjamin Otte
90a278ce46 gpu: Rename some descriptors APIs
We want tosupport buffers here, too, so make the names unambiguous.
2024-01-07 07:22:52 +01:00
Benjamin Otte
2a5fe8cd0c gpu: Only run uber shaders if beneficial
If we have the choice between running the ubershader or a normal shader
with offscreens, make the choice depend on if the ubershader would
offscreen anyway.
If so, just run the normal shader.

This really gets rid of all ubershader invocations in Adwaita
widget-factory.
2024-01-07 07:22:52 +01:00
Benjamin Otte
42d89a0ff1 gpu: Add a color matrix shader
This allows avoiding the uber shader in 2 important cases:

1. opacity - and Adwaita uses that a lot
2. color-matrix - it's used for symbolic icons
2024-01-07 07:22:52 +01:00
Benjamin Otte
9f65cdf3aa gpu: Add support for subsurfaces 2024-01-07 07:22:52 +01:00
Benjamin Otte
35bc08da5e gpu: Rework caching layer
Instead of using an enum, use a usual custom class struct like we use
for GskGpuOp.

As a side effect of that refactoring, the display gained a hash table
for textures where we can't use the render data because the texture is
used in multiple renderers.
The goal here is that a texture is always cached and we can ensure that
there is a 1:1 relation between textures and their GskGpuImage. This is
important in particular for external textures - like dmabufs - where we
absolutely don't want 2 images with 2 device memories, and where we use
toggle references to keep them alive.
2024-01-07 07:22:52 +01:00
Benjamin Otte
723c2493b2 gpu: Handle opacity in a bunch of nodes 2024-01-07 07:22:52 +01:00
Benjamin Otte
245e51099f gpu: Add optimization for opacity nodes
Track the global opacity and allow nodes to handle it themselves.

If the nodes don't, fall back to what we did previously: Use the
ubershader.
2024-01-07 07:22:52 +01:00
Benjamin Otte
a06cd6a821 gpu: Make the uber shader handle affine transforms
Fixes the last (non-blur) Nautilus offscreens in Nautilus.
2024-01-07 07:22:52 +01:00
Benjamin Otte
1c509be875 gpu: Replace clip node fallback with uber or offscreen
We don't need to use a fallback here anymore, we have enough code by now
to do this smarter.
2024-01-07 07:22:52 +01:00
Benjamin Otte
9894417a09 gpu: Split out a function
We want to use it elsewhere.
2024-01-07 07:22:52 +01:00
Benjamin Otte
51f218c877 gpu: Replace fallback with offscreen
We don't need to fallback with transform nodes when the clip is
too complex. We can redirect to an offscreen instead, which doesn't have
a clip.
2024-01-07 07:22:52 +01:00
Benjamin Otte
a8bb0a0ee1 gpu: Split out a function
I want to use it in more places.
2024-01-07 07:22:52 +01:00
Benjamin Otte
b7414dfbdd gpu: Be stricter about texture units
Reserve 3 texture units per immutable sampler (because that's the
maximum per YUV sampler).
Ensure that the max-sampler calculations always include the immutable
samplers, too.
2024-01-07 07:22:52 +01:00
Benjamin Otte
057479c284 gpu: Improve memory handling on Vulkan
We now handle the case where memory is not HOST_CACHED.

We also track the memory type now so we can avoid mapping image memory
that is not HOST_CACHED and use buffer transfers instead.
2024-01-07 07:22:52 +01:00
Benjamin Otte
c5a01cd14b gpu: Make the texture ladder handle 32 textures
So now we can put more textures in one descriptor set even if dynamic
indexing isn't supported.
2024-01-07 07:22:52 +01:00
Benjamin Otte
719ff9eca9 gpu: Require Vulkan 1.2 shaders for dynamic indexing
Shader compilers struggle with compiling code that indexes texture
arrays by indexes, so keep the fallback shaders simple and don't do that
there.

There's not much of a performance difference anyway between those two
methods.
2024-01-07 07:22:52 +01:00
Benjamin Otte
d50e235753 gpu: Add back single descriptors set usage with descriptor indexing 2024-01-07 07:22:51 +01:00
Benjamin Otte
ae2020aca2 gpu: Make descriptor-indexing optional
Do extra work if it's not available.
2024-01-07 07:22:51 +01:00
Benjamin Otte
450524f6cf gpu: Remove UPDATE_AFTER_BIND flag
We don't update after binding.
2024-01-07 07:22:51 +01:00
Benjamin Otte
be09cebb09 gpu: Handle multiple image descriptors
In the case where descriptor indexing is not enabled and the number of
max images is small (or we use extensive amounts of immutable samplers),
we need to be able to switch descriptors.

This patch makes that possible.
2024-01-07 07:22:51 +01:00
Benjamin Otte
6230ff0fc4 gpu: Cache GL state
That way we don't need to setup the textures and program for every
command.
2024-01-07 07:22:51 +01:00
Benjamin Otte
1733671295 gpu: Add a CommandState struct to the command vfuncs
This way, we can make it writable and track things like the active
textures and the current program.

We don't do that yet, but we can.
2024-01-07 07:22:51 +01:00
Benjamin Otte
78a7127b96 gpu: Handle missing support nor nonuniform texture accesses
We compile custom shaders for Vulkan 1.0 that don't require the
extension.

We  also ensure that our accesses are uniform by only executing one
shader at a time.
2024-01-07 07:22:51 +01:00
Benjamin Otte
94063cbe92 gpu: Change the meson code for how SPIR-V is built
This does the same thing, but in a way that's a bit more flexible.
And it prepares the next commit...
2024-01-07 07:22:51 +01:00
Benjamin Otte
96e579501f gpu: Add GDK_VULKAN_SKIP env var
The variable forces skipping of optional Vulkan features. This is useful
for testing.

Also debug-print the features in use.
2024-01-07 07:22:51 +01:00
Benjamin Otte
98c88780bc gpu: Set max samplers/buffers based on features
If we run older code, we don't have enough samplers and buffers
available. So make sure to reflect that.
2024-01-07 07:22:51 +01:00
Benjamin Otte
7dcb7d7d0f gpu: Add Vulkan feature flags for more advanced features
Code continues if those features aren't available, buit is probably
broken.
2024-01-07 07:22:51 +01:00
Benjamin Otte
95e36af46b gpu: Update shader code for different buffer/sampler sizes
Use specialization constants for that.
2024-01-07 07:22:51 +01:00
Benjamin Otte
47a13e601f gpu: Make PipelineLayout objects do more things
Let the objects track the number of samplers or buffers needed.

This is a required step for making Vulkan work with less featureful
(read: mobile) implementations.
2024-01-07 07:22:51 +01:00
Benjamin Otte
a301f18ebf gpu: Track position fwidth explicitly
This is relevant went encountering repeat nodes, where the repeat cutoff
will make the fwidth of the position go wild otherwise.

Gradients require more work now, because we need to compute offsets
twice - once for the pixel, once for the offst.
2024-01-07 07:22:51 +01:00
Benjamin Otte
6cbf4667a4 gpu: Add support for dmabuf import to GL 2024-01-07 07:22:51 +01:00
Benjamin Otte
ef20b706e2 gpu: Prepare GL rendering for samplerExternalEOS
Carry an n_external_textures variable around when selecting programs and
compile different programs for different amounts of external textures.

For now, this code is unused, but dmabufs will need it.
2024-01-07 07:22:51 +01:00
Benjamin Otte
979e4207f3 gpu: Add importing of GL textures to the GL renderer
syncing with the GLsync is kind of a hack (because we just do it on
import), but it works.
2024-01-07 07:22:51 +01:00
Benjamin Otte
c29237c75d gpu: Add support for texture-scale nodes
This adds GSK_GPU_IMAGE_CAN_MIPMAP and GSK_GPU_IMAGE_MIPMAP flags and
support to ensure_image() and image creation functions for creating a
mipmapped image.

Mipmaps are created using the new mipmap op that uses
glGenerateMipmap() on GL and equivalent blit ops on Vulkan.

This is then used to ensure the image is mipmapped when rendering it
with a texture-scale node.
2024-01-07 07:22:51 +01:00
Benjamin Otte
99aa5f398b gpu: Add blitting support
Add GSK_GPU_IMAGE_NO_BLIT flag for textures that can't be blitted from.

Use a blit op to do image copies otherwise.
2024-01-07 07:22:51 +01:00
Benjamin Otte
1858d955de testsuite: Add a test to check scaling behavior
Various GL texture formats do not support linear scaling or mipmap
generation.

Add a test that checks this.
2024-01-07 07:22:51 +01:00
Benjamin Otte
3e5af3afce testsuite: Update memorytexture text to use new renderers
1. Refactor checks for GL support

2. Add NGL and Vulkan
2024-01-07 07:22:51 +01:00
Benjamin Otte
b4a1ed2a70 gpu: Add straight alpha support
Add a GSK_GPU_IMAGE_STRAIGHT_ALPHA and use it for images that have
straight alpha.
Make sure those images get passed through a premultiplying pass with
the new straight alpha shader.

Also remove the old Postprocess flags from the Vulkan image that were a
leftover from copying that code from the old Vulkan renderer.
2024-01-07 07:22:51 +01:00
Benjamin Otte
f05a8927f3 gpu: Work around Ycbcr not working with dynamically uniform indices
There's a well hidden line in the spec that says in
https://registry.khronos.org/vulkan/specs/1.3/html/chap15.html#interfaces-resources-descset

  If the combined image sampler enables sampler Y′CBCR conversion,
  it **must** be indexed only by constant integral expressions when
  aggregated into arrays in shader code, irrespective of the
  shaderSampledImageArrayDynamicIndexing feature.

So we'll use the same trick that we use for old GL here and do an
if dance that gives us dynamically uniform expressions.
2024-01-07 07:22:51 +01:00
Benjamin Otte
a2368803fa gpu: Add dmabuf import for Vulkan
This now uses all the previously added features to allow displaying YUV
images.

Also add a utility function that turns an image into a toggle ref for a
texture. This makes sure that reffing the image also refs the texture
and that ensures that textures stay alive as long as the image is in
use.
2024-01-07 07:22:51 +01:00
Benjamin Otte
ee93f88268 vulkan: Add support for enumerating dmabuf formats
This code does not add a downloader, so we do not claim support for all
the new formats.

It just queries the formats. But this can be used to import dmabufs
directly into the Vulkaan renderer.
2024-01-07 07:22:51 +01:00
Benjamin Otte
32d35b1d01 gpu: Handle flags for images
For now, the flags are just there because, and nobody uses them yet.
The only flag is EXTERNAL, which for now I'm using for YUV buffers,
though it's a bit undefined what that means.
2024-01-07 07:22:51 +01:00
Benjamin Otte
528e246f1a gpu: Add a mipmap sampler
It's not used yet, but the sampler infrastructure needs to be expanded,
so I decided to split this out to easier find regressions.
2024-01-07 07:22:51 +01:00
Benjamin Otte
03f820d26c gpu: Add support for immutable samplers to Vulkan
Images can now have samplers - meaning they must be rendered with that
sampler. It also means that sampler must be handled as an immutable
sampler in descriptorsets.
These samplers can be created with a samplerYcbcrConversion, so code has
been added to pass that conversion when creating the imageview.

Also add code to GskVulkanFrame to track immutable samplers.

Nobody is making use of this yet.
2024-01-07 07:22:51 +01:00
Benjamin Otte
bf39fa3b3b gpu: Hook up immutable samplers to shaders
Define an array with a compile-time-constant variable size for the
immutable samplers.

A bunch of work is necessary to ensure that at least one element is in
the sampler array, because the GLSL code
  sampler2D immutable_textures[0];
is invalid.
2024-01-07 07:22:51 +01:00
Benjamin Otte
d2229e2aed gpu: Add GskVulkanPipelineLayout
This allows having different layouts sothat we can support immutable
samplers, whcih are required for multiplane and YUV formats.

We don't use them yet.
2024-01-07 07:22:51 +01:00
Benjamin Otte
9eac147426 gpu: Add a cache for YcbcrConversions
We index them only by VkFormat for now because we don't have another
differentiator.

It's unused so far.
2024-01-07 07:22:51 +01:00
Benjamin Otte
1b1abba313 gpu: Add an "external" allocator to Vulkan
The allocator is supposed to be used with externally allocated vkMemory
objects that are meant to be freed normally - in particular dmabufs.
2024-01-07 07:22:51 +01:00
Benjamin Otte
223d1343de gpu: Add GdkDisplay::vulkan_features
use it to collect the optional features we are interested in and turn
them on only if available.

For now we add the dmabuf features, but we don't use them yet.
2024-01-07 07:22:51 +01:00
Benjamin Otte
f0f6af1cf8 gpu: Create Vulkan samplers on-demand 2024-01-07 07:22:51 +01:00
Benjamin Otte
82eed5d672 gpu: Make Vulkan image formats check use newer functions
This is just an update of all vkGetFoo() calls to use vkGetFoo2().
2024-01-07 07:22:51 +01:00
Benjamin Otte
38f64c2357 gpu: Move caching to the upload_texture() function
So when uploading a texture, we will automatically put it into the cache
now.
2024-01-07 07:22:51 +01:00
Benjamin Otte
daadaf8448 gpu: Factor out uploading textures into a vfunc
This way GL and Vulkan can run custom code to import GL textures and
dmabufs.

This function also decides if and how to cache the textures it creates.
2024-01-07 07:22:51 +01:00
Benjamin Otte
e86fa6a072 gpu: Apply clip to ubershader bounds
Fixes excessive bounds when using the ubershader for huge nodes
contained inside clip nodes.
2024-01-07 07:22:51 +01:00
Benjamin Otte
1b3eb3ecd1 gpu: Fail to create images that are too big
It's up to the renderers to handle the NULL return value.
2024-01-07 07:22:51 +01:00
Benjamin Otte
94539e6f08 gpu: Allow texture uploads to fail
The main reason here is that we want to not fail when the texture size
is larger than the supported GpuImage size.

When that happens, for now we just fallback slowly - ulitmately to
drawing with Cairo, which is going to be clipped.
2024-01-07 07:22:51 +01:00
Benjamin Otte
f5af3fe933 gpu: Add render_texture() fallback impl for huge sizes
This copies over the GLRenderer approach of step-by-step filling a
memorytexture.

It just adds some extra niceties by respecting the best format.
2024-01-07 07:22:51 +01:00
Benjamin Otte
bbad290518 gpu: Add gsk_gpu_device_get_max_image_size()
... and initialize it properly.
2024-01-07 07:22:51 +01:00
Benjamin Otte
334e380d31 gpu: Handle overlapping rounded rect corners
Have a fallback in place for the most egregious abuses of rounded
corners, like
  0 0 50 50 / 50 0
and the like.

Fixes obscure border colors.
2024-01-07 07:22:51 +01:00
Benjamin Otte
d8db673fb7 gpu: Add a box shadow shader
Code was inspired mainly by
  https://madebyevan.com/shaders/fast-rounded-rectangle-shadows/
and
  https://pcwalton.github.io/_posts/2015-12-21-drawing-css-box-shadows-in-webrender.html

So far the results aren't cached, that's the task of future commits.
2024-01-07 07:22:51 +01:00
Benjamin Otte
268ad54c6a gpu: Add a rounded color shader
There's multiple uses I want it for:

1. Generating the box-shadow area for blurring
2. Generating masks for rounded-rect masking
3. Optimizing the common use case of rounded-clip + color

Only the last one is implemented in this commit.
2024-01-07 07:22:50 +01:00
Benjamin Otte
64a67ac3a8 gpu: Turn globals into macros
This way, we can be more flexible in refactoring how we handle globals
(guess what we're gonna do next).
2024-01-07 07:22:50 +01:00
Benjamin Otte
74ac95dc32 gpu: Don't try to be smart
Don't try to use all those fancy GL features like glMapBuffer() and
such. Just malloc() some buffer memory and glBufferSubData() it later.

That works everywhere and is faster than (almost?) any combination of
fancy new buffer APIs. And yes I'm frustrated because I played with
those flags and none of them were better than this.

Doubles the framerate on my discrete AMD GPU.
2024-01-07 07:22:50 +01:00
Benjamin Otte
7f817fce0a gpu: Use GL_STREAM_DRAW for the push constants buffer
This seems to hit a bunch of optimizations and makes push constants
slightly faster.
2024-01-07 07:22:50 +01:00
Benjamin Otte
5549a7ab5f gpu: Merge ops on GL, too
Just like on Vulkan, try to minimize the glDrawArrays() calls by merging
adjacent ops.
2024-01-07 07:22:50 +01:00
Benjamin Otte
53821da4d6 gpu: Refactor image handling
Introduce a new GskGpuImageDescriptors object that tracks descriptors
for a set of images that can be managed by the GPU.
Then have each GskGpuShaderOp just reference the descriptors object they are
using, so that the coe can set things up properly.

To reference an image, the ops now just reference their descriptor -
which is the uint32 we've been sending to the shaders since forever.
2024-01-07 07:22:50 +01:00
Benjamin Otte
f518d780ed gpu: Add atlas support
... and use it for glyphs.
2024-01-07 07:22:50 +01:00
Benjamin Otte
9045431bde gpu: Add a GL optimization
Use glDrawArraysInstancedBaseInstance() to draw. (Yay for GL naming.)
That allows setting up the offset in the vertex array without having to
glVertexAttribPointer() everything again.

However, this is only supported since GL 4.2 and not at all in stock GLES,
so we need to have code that can work without it.
Fortunately, it is mandatory in Vulkan, so every recent GPU supports it.
And if that GPU has a proper driver, it will also expose the GL extension
for it.
(Hint: You can check https://opengles.gpuinfo.org/listextensions.php for
how many proper drivers exist outside of Mesa.)
2024-01-07 07:22:50 +01:00
Benjamin Otte
8271687ef6 gpu: Make border shader usable for inset/outset
... and use it for those when unblurred.
2024-01-07 07:22:50 +01:00
Benjamin Otte
8043d4d6e0 gpu: Add GSK_GPU_SKIP=merge
Disables merging of ops for vkCmdDraw().
2024-01-07 07:22:50 +01:00
Benjamin Otte
e7a59d92ac gpu: Add GSK_GPU_SKIP env var
The env var allows skipping various optimizations in the GPU shader.

This is useful for testing during development when trying to figure
out how to make a renderer as fast as possible.

We could also use it to enable/disable optimizations depending on GL
version or so, but I didn't think about that too much yet.
2024-01-07 07:22:50 +01:00
Benjamin Otte
e3bac4063c gpu: Copy the clear trick from the Vulkan shader
When drawing opaque color regions that are large enough, use
vkCmdClearAttachments()/glClear() instead of a shader. This speeds up
background rendering on particular on older GPUs.

See the commit messages of
  bb2cd7225e
  ce042f7ba1
  0edd7547c1
for a further discussion of performance impacts.
2024-01-07 07:22:50 +01:00
Benjamin Otte
48012a1ce4 gpu: Add a color shader
We don't want to use the pattern shader for simple colors, slow GPUs do
not like this at all.
2024-01-07 07:22:50 +01:00
Benjamin Otte
63f6e75b38 gpu: Implement blur nodes
With the work already done with shadow nodes, this one was easy.
2024-01-07 07:22:50 +01:00
Benjamin Otte
23c1ec07e7 gpu: Implement shadow nodes 2024-01-07 07:22:50 +01:00
Benjamin Otte
7431a58617 gpu: Change sorting for ops
The previous algorithm would reverse the order of subpasses, whcih leads
to unexpected behavior if dependent subpasses are not added as children
of a subpass, but just as a previous subpass - like when a subpass is
used multiple times later.

An example for this is a shadow node with multiple shadows - the source
of the shadow is used by the multiple shadows.

So ensure that adjacent subpasses stay in the same order.
2024-01-07 07:22:50 +01:00
Benjamin Otte
30e9d98f0d gpu: Add a "transparent" sampler
This is using the equivalent of EXTEND_NONE, but I wasn't sure what to
call it.

It's unused atm.
2024-01-07 07:22:50 +01:00
Benjamin Otte
43d0b0fb3c gpu: Turn off optimizing in glslc
The code generated by glslc -O is optimized worse by Mesa than
code generated unoptimized.

So generate unoptimized code until somebody figures out what's going
wrong here.
2024-01-07 07:22:50 +01:00
Benjamin Otte
d47c8613b0 gpu: Add support for mask patterns 2024-01-07 07:22:50 +01:00
Benjamin Otte
e01311a565 gpu: Add support for cross-fades 2024-01-07 07:22:50 +01:00
Benjamin Otte
0876089f8f gpu: Add repeat nodes
They're done using the pattern shader.

The pattern shader now gained a stack where vec4's can be pushed and
popped back later, which allows storing the position before computing
the new position inside the repeat node's child.
2024-01-07 07:22:50 +01:00
Benjamin Otte
b7a8c2207e gpu: Introduce gsk_texture() shader function/macro
Due to GLES and old GL not allowing non-constant texture array
lookups,we need to turn the array lookup into a big switch statementin
those versions, and that requires putting the texture() call into that
switch.

But with that trick, we can use texture IDs in GLSL.
2024-01-07 07:22:50 +01:00
Benjamin Otte
5ab8fde0bc gpu: Add colorize shader
... and use it for glyphs.

The name is a slight variation of the "coloring" name from the GL
renderer.
The functionality is exactly what the "glyph" shader from the Vulkan
renderer does.
2024-01-07 07:22:50 +01:00
Benjamin Otte
d1d1af1a62 gpu: Improve conic gradient rendering
1. Compute the fwidth() twice with offset offsets
   That way, we avoid glitches at the boundary between 0.0 and 1.0,
   because by offsetting it by 0.5, that boundary goes away.
   Then we take the min() of both which gives us the one we care about.

2. Set the gradient to repeating
   By doing that, we don't get values at the 0.0/1.0 boundary clamped,
   but things smoothly transition.
   This smoothes the line at that boundary and makes it look just like
   every other line.
2024-01-07 07:22:50 +01:00
Benjamin Otte
88618952c5 gpu: Round offscreens to pixel boundaries
Instead of strictly rounding to the given clip rectangle, increase the
rectangle to the next pixel boundary.

Also add docs that the clip_bounds do not influence the actual size of
the returned image.
2024-01-07 07:22:50 +01:00
Benjamin Otte
92d1df94fa gpu: Add GskGpuPatternWriter
It's just an object that encapsulates everything needed to create (the
data for) a pattern op.

It also clarifies which code does what, because now the NodeProcessor
and the PatternWriter are 2 different things.
2024-01-07 07:22:50 +01:00
Benjamin Otte
187db92a88 gpu: Make shader image access a vfunc
That allows shaders to handle textures differently.

In particularly, it will allow the pattern shader to take a huge amount
of textures.
2024-01-07 07:22:50 +01:00
Benjamin Otte
a9b8551e70 gpu: Add clip pattern
So now we can clip inside an opacity node without needing fallback.
2024-01-07 07:22:50 +01:00
Benjamin Otte
0cac75aff1 gpu: Passthrough subsurface nodes
We don't support subsurfaces for now, so we can just ignore the nodes.
2024-01-07 07:22:50 +01:00
Benjamin Otte
6cf3f6ebff gpu: Add support for debug nodes
Passthrough is always easy.
2024-01-07 07:22:50 +01:00
Benjamin Otte
3efe1bef93 gpu: Add a border shader
Pretty much a copy of the Vulkan border shader.

A notable change is that the input arguments are changed, because GL
gets confused if you put a mat4 at the end.
2024-01-07 07:22:50 +01:00
Benjamin Otte
16c804c5e3 gpu: Handle nested buffer writes
when doing get_node_as_image(), that may spawn a new buffer writer that
writes into the samme buffer when rendering an offscreen with patterns.

So as a more or less hacky workaround, we now abort the current buffer
write and restart it once we've created the image.
2024-01-07 07:22:50 +01:00
Benjamin Otte
28f4666366 gpu: Implement conic gradients 2024-01-07 07:22:50 +01:00
Benjamin Otte
72a5927d38 gpu: Add radial gradients 2024-01-07 07:22:50 +01:00
Benjamin Otte
7473617ffb gpu: Add linear gradients to pattern shader
This copy/pastes the gist of the Vulkan gradient renderer.
2024-01-07 07:22:50 +01:00
Benjamin Otte
7d43e4e56a gpu: Add glyphs support
This is very rudimentary, but it's a step in the direction of getting
text going.

There's lots of things missing still.
2024-01-07 07:22:50 +01:00
Benjamin Otte
8fd2a267ae gpu: Add a utility function for colors in patterns
... and use it.
2024-01-07 07:22:50 +01:00
Benjamin Otte
3809e6efb9 gpu: Add color-matrix handling to pattern shader 2024-01-07 07:22:50 +01:00
Benjamin Otte
9224efd95e gpu: Make pattern creation always succeed
If creation fails, create an offscreen image instead and draw that as a
texture.

Because offscreens basically always succeed, we can pretty much assume
success everywhere - apart from pattern creation functions that also
create images, because they can run out of shader space.
2024-01-07 07:22:50 +01:00
Benjamin Otte
4cbd384e39 gpu: Have a get_node_as_pattern() function
... and use it to replace all the individual parts of code that get the
node as a pattern.
2024-01-07 07:22:50 +01:00
Benjamin Otte
12010a597b gpu: Add a texture pattern
Needs a lot of infrastructure for handling images, but we're handling
images now.
2024-01-07 07:22:50 +01:00
Benjamin Otte
720ac700b3 gpu: Move the pattern code into the nodeprocessor
We need the nodeprocessor infrastructure to create patterns, so keeping
it in a different source file would just cause header headaches.
2024-01-07 07:22:50 +01:00
Benjamin Otte
373a6ab9f1 gpu: Add a texture cache
... and use it when drawing textures.

We'll need it in other places later, but for now that's what we have.
2024-01-07 07:22:50 +01:00
Benjamin Otte
57c1c95e75 gpu: Make frames carry a timestamp
Frames now carry a timestamp for when they are used.

This is mainly intended to attach timestamps to cached items (textures
or glyphs), but it could in theory also be used when profiling.

We use wallclock time here, not server time, because it's cheaper and
because we're more intereseted in the local machine we're rendering on.
2024-01-07 07:22:50 +01:00
Benjamin Otte
ffc117564b gpu: Make patterns do opacity nodes
Of course, for now this only works for opacity nodes that contain color
nodes, but we're still building up to ore useful stuff here.
2024-01-07 07:22:50 +01:00
Benjamin Otte
ee3367697d gpu: Move pattern code into its own file
Now we can extend the pattern creation easily - and we can add new
patterns quickly later.

Plus, we need to keep this file in sync with pattern.glsl and it's neat
when those 2 files reference only each other.
2024-01-07 07:22:50 +01:00
Benjamin Otte
c6e19f0384 gpu: Add float array to shaders and add an ubershader
... and use it for a naive color node implementation using both
so I can test it actually works.
2024-01-07 07:22:50 +01:00
Benjamin Otte
9df265acdc gpu: Clip fallback nodes to current clip
Avoids uploading parts of the node that aren't visible.
2024-01-07 07:22:49 +01:00
Benjamin Otte
461d9b4052 gpu: Set scissor rect before clearing
The render area that restricts clearing on Vulkan needs to be respected
by the GL renderer, too.
2024-01-07 07:22:49 +01:00
Benjamin Otte
0ed45c5f40 gpu: Move global syncing out
This is necessary so that fallback code can properly sync itself,
instead of just add_node().

Fixes a bunch of glitches when fallbacks would be used.
2024-01-07 07:22:49 +01:00
Benjamin Otte
73ac2d0a1c gpu: Add a flip_y argument to shader execution
Because GL flips its shit sometimes (ie when it's the framebuffer),
pass the height of the target as the flip variable, so commands
that need to operate on the pixels can flip the y axis around this value.
2024-01-07 07:22:49 +01:00
Benjamin Otte
57ab670991 gpu: Add handling for (rounded) clip node(s)
This is again mostly a copy of the Vulkan renderer.

It's a bit awkward codewise with the new invalidation framework,
because we need to cache the previous values individually now,
but it's a lot more finegrained, and we don't emit globals multiple
times when clips are nested.
2024-01-07 07:22:49 +01:00
Benjamin Otte
e2b5e0d17d gpu: Add scissor operation
Nothing is using it yet (we don't do clipping) apart from initializing
the scissor rect at startup.
2024-01-07 07:22:49 +01:00
Benjamin Otte
77e05a4240 gpu: Add support for transform nodes
This essentially copies the Vulkan renderer machinery, but adapts it to
the new handling with pending globals.
2024-01-07 07:22:49 +01:00
Benjamin Otte
97c5bb284b gpu: Document the coordinate systems we use 2024-01-07 07:22:49 +01:00
Benjamin Otte
286b473f55 gpu: Add gsk_gpu_image_get_projection_matrix()
... and use it to initialize the "proper" projection matrix to use in
shaders.

The resulting viewport will go from top left (0,0) to bottom right
(width, height) and the z clipping plane will go from -10000 to 10000.
2024-01-07 07:22:49 +01:00
Benjamin Otte
1152c93778 gpu: Handle container nodes
Now everything is slower because we upload every other node
individually!
2024-01-07 07:22:49 +01:00
Benjamin Otte
1a85d569e3 gpu: Add ability to run shaders
This heaves over an inital chunk of code from the Vulkan renderer to
execute shaders.

The only shader that exists for now is a shader that draws a single
texture.
We use that to replace the blit op we were doing before.
2024-01-07 07:22:49 +01:00
Benjamin Otte
bd114ab1a8 inspector: Learn about new renderers 2024-01-07 07:22:49 +01:00
Benjamin Otte
7a1f764910 gsk: Add new renderers to the GSK_RENDERER env var
Use:
  "ngl" for the new GL renderer
  "vulkan" for the new Vulkan renderer
2024-01-07 07:22:49 +01:00
Benjamin Otte
10f934f782 node-editor: Add the new renderer(s) 2024-01-07 07:22:49 +01:00
Benjamin Otte
97c60b84c8 gl: Undeprecate the NGL renderer for now
It's used for the new GPU renderer.
2024-01-07 07:22:49 +01:00
Benjamin Otte
bf89431464 gpu: Use gdk_draw_context_empty_frame() when appropriate
It's a new function, so make use of it.
2024-01-07 07:22:49 +01:00
Benjamin Otte
9ddae8aebc gpu: Add outline of new GPU renderer
For now, it just renders using cairo, uploads the result to the GPU,
blits it onto the framebuffer and then is happy.

But it can do that using Vulkan and using GL (no idea which version).

The most important thing still missing is shaders.

It also has a bunch of copy/paste from the Vulkan renderer that isn't
used yet.
But I didn't want to rip it out and then try to copy it back later
2024-01-07 07:22:49 +01:00
Benjamin Otte
e3c70645f9 vulkan: Turn Vulkan instances into init/ref/unref
This is not yet used.
2024-01-07 07:22:49 +01:00
Benjamin Otte
1e54e838e0 vulkan: Remove GskVulkanRenderer
We want to introduce a new one next.

Technically, this breaks API, because gsk_vulkan_renderer_new() is going
away, but practically, we're gonna bring it back once we introduce that
renderer in a few commits.
2024-01-07 07:22:49 +01:00
Benjamin Otte
40854f2ae9 gsk: Add header guard to missing header 2024-01-07 07:22:49 +01:00
Matthias Clasen
5e8e877f95 Merge branch 'matthiasc/for-main' into 'main'
rect: Annotate some functions as pure

See merge request GNOME/gtk!6713
2024-01-06 22:47:49 +00:00
Matthias Clasen
99844c8ccf rect: Annotate some functions as pure
gdk_rectangle_equal and gdk_rectangle_contains_point are pure.
2024-01-06 17:18:18 -05:00
Matthias Clasen
8418e4276a Merge branch 'matthiasc/for-main' into 'main'
gdk: Make a warning more useful

See merge request GNOME/gtk!6712
2024-01-06 20:43:43 +00:00
Matthias Clasen
7693e7133d inspector: Reorder the general tab
Put the devices below the monitors, for a more logical arrangement.
2024-01-06 09:49:37 -05:00
Matthias Clasen
e56f9dbeb8 inspector: Drop a size group
All this size group did was causing values to be needlessly
ellipsized. Drop it.
2024-01-06 09:49:37 -05:00
Matthias Clasen
282d66a604 inspector: Clean up the general tab
Put the Wayland protocols, GL and Vulkan extensions behind expanders,
so we have less scrolling surface by default.
2024-01-06 09:49:37 -05:00
Matthias Clasen
3f513f3cc7 x11: Add a forgotten empty_frame implementation
This was causing warnings when using GLX.
2024-01-06 09:36:25 -05:00
Matthias Clasen
854910cc17 gdk: Make a warning more useful
We can just print out what is missing where, instead of a riddle.
2024-01-06 09:36:25 -05:00
Matthias Clasen
6bc7ec3d4d Merge branch 'fix-docs-links' into 'main'
docs: Fix: gdk->gtk links

See merge request GNOME/gtk!6711
2024-01-05 20:10:33 +00:00
Matthias Clasen
bda6530fea docs: Fix: gsk->gtk links
gi-docgen can only generate links for dependencies, so we have
to manually expand to a relative url here.
2024-01-05 14:57:16 -05:00
Matthias Clasen
6227592dfa docs: Fix: gdk->gtk and gdk->gsk links
gi-docgen can only generate links for dependencies, so we have
to manually expand to a relative url here.

fixup
2024-01-05 14:57:07 -05:00
Matthias Clasen
bc066de998 Merge branch 'wip/chergert/fix-6308' into 'main'
texthistory: fix potential NULL dereference

Closes #6308

See merge request GNOME/gtk!6709
2024-01-05 16:43:19 +00:00
Benjamin Otte
68980a5e3b Merge branch 'wip/otte/for-main' into 'main'
testsuite: Add a test for a recent mipmap generation bug

See merge request GNOME/gtk!6710
2024-01-05 07:28:19 +00:00
Benjamin Otte
f200e8b132 reftests: Add a testcase for GtkGLArea::allowed-apis
See code comments for how it uses GL commands that should fail with GLES.

Related: !6520
2024-01-05 07:30:38 +01:00
Benjamin Otte
dde2d9b545 gl: Don't initialize texture storage in wrong format
We're calling glTexImage2D() right after with the correct format.

So add the special format "0" to avoid intializing the texture memory.
2024-01-05 07:20:32 +01:00
Benjamin Otte
ac64948efd testsuite: Add a test for a recent mipmap generation bug
Tests the fix in ab1fba6fdc.

Related: #6298
Related: !6704
2024-01-05 07:20:32 +01:00
Christian Hergert
dfe2141227 texthistory: fix potential NULL dereference
Fixes #6308
2024-01-04 09:40:04 -08:00
Emmanuele Bassi
1e1c973d71 Merge branch 'ebassi/doc-link-fixes' into 'main'
docs: Use second level headings for sections

See merge request GNOME/gtk!6708
2024-01-04 14:48:38 +00:00
Emmanuele Bassi
b69898228d docs: Use second level headings for sections
The first level heading should be reserved for the class description.
2024-01-04 13:48:29 +00:00
Emmanuele Bassi
9c71469c67 docs: Fix link to GtkLabel.set_mnemonic_widget() 2024-01-04 13:48:06 +00:00
Emmanuele Bassi
a8b1c90303 docs: Fix link to GtkSnapshot.restore() 2024-01-04 13:47:29 +00:00
Matthias Clasen
69ffaab09f Merge branch 'reduce-shortcuts-searchentry-width' into 'main'
shortcutswindow: Reduce default width of search entry

See merge request GNOME/gtk!6707
2024-01-04 13:42:18 +00:00
Mohammed Sadiq
9730d44252 shortcutswindow: Reduce default width of search entry
Reduce the default width of search entry so that it fits on smaller
screens (ie, screens having 360px or less width).  Also, set max width
to the old value of 40, so that the search entry will have the same
old size if window width permits.

This commit won't make any difference on larger screens.
2024-01-04 18:51:42 +05:30
Matthias Clasen
f99e725391 Merge branch 'fix-dropdown-checkmark' into 'main'
dropdown: Fix initial checkmark

Closes #6305

See merge request GNOME/gtk!6705
2024-01-04 03:22:25 +00:00
Matthias Clasen
8e4a42a214 dropdown: Fix initial checkmark
When the ::bind signal is emitted, the list item may not be added
to the list view yet, so we can't consult the widget hierarchy at
that point to decide whether to show or hide the icon. List for
notify::root instead.

Fixes: #6305
2024-01-03 14:58:49 -05:00
Matthias Clasen
603de8361c Merge branch 'mipmap-fixes' into 'main'
Mipmap handling fixes

Closes #6298

See merge request GNOME/gtk!6704
2024-01-03 18:06:23 +00:00
Matthias Clasen
51fd7cf35a Merge branch 'wip/otte/for-main' into 'main'
testsuite: Replace g_random_*() with g_test_rand_*()

See merge request GNOME/gtk!6703
2024-01-03 17:50:29 +00:00
Matthias Clasen
ab1fba6fdc gl: When loading a texture, really create a mipmap
If we need a mipmap, and we find an existing texture that can't
mipmap, we need to recreate it.
2024-01-03 12:26:13 -05:00
Matthias Clasen
cfa53de9af gl: Check if texture has a mipmap
When reusing an exiting texture, check if it has a mipmap, in case
we need one.
2024-01-03 12:22:28 -05:00
Matthias Clasen
3ebbcc981a Annotate gtk_ordering_from_cmpfunc as skip
We do extra work here to make the introspection scanner pick up
the docs for the static inline function, but that doesn't make the
function actually work in language bindings, so mark it as skip.

Fixes: #6298
2024-01-03 11:43:37 -05:00
Benjamin Otte
96a71d515b gl: Track if mipmap generation is allowed
... and if it isn't, switch to a format that does allow mipmaps.
2024-01-03 16:56:43 +01:00
Benjamin Otte
b830ca8fab gl: Pass correct format/type to function
Instead of querying the format again and potentially coming out with a
different format, use the one we queried in the calling function.
2024-01-03 16:56:31 +01:00
Benjamin Otte
825c97be6c glcontext: Mark RGB16F as not renderable
According to EXT_color_buffer_half_float it should be renderable, but it
fails to glGenerateMipmap() with Mesa 23.3 so just pretend it's not
renderable until that is fixed.

Fixes CI from failing.
2024-01-03 16:05:25 +01:00
Benjamin Otte
25f99f35f6 glcontext: RGB32F is not renderable
I naively assumed the EXT_color_buffer_float and
EXT_color_buffer_half_float extensions would mirror each other, but they
do not. The float extension explicitly excludes RGB32F from the
renderable formats.
2024-01-03 16:05:25 +01:00
Benjamin Otte
b719f3bd60 glcontext: Fix a mixup of flags
I swapped RENDERABLE and FILTERABLE when building this table.
2024-01-03 16:05:25 +01:00
Benjamin Otte
b16d01e018 testsuite: Replace g_random_*() with g_test_rand_*()
... in the whole testsuite
2024-01-03 16:05:25 +01:00
Matthias Clasen
c56360f20b Merge branch 'matthiasc/for-main' into 'main'
gsk: Mark some subsurface node apis as skip

See merge request GNOME/gtk!6702
2024-01-03 14:09:38 +00:00
Matthias Clasen
726d5b25e8 Merge branch 'bilelmoussaoui/add-missing-annotations' into 'main'
gi: Add missing Since annotations

See merge request GNOME/gtk!6701
2024-01-03 13:35:44 +00:00
Matthias Clasen
681aac7317 gsk: Mark some subsurface node apis as skip
These are not usable outside of GTK, so lets not burden bindings
with them.

I'll keep the get_child() function exposed, since it is needed to
iterate over node trees containing subsurface nodes.
2024-01-03 07:53:27 -05:00
Bilal Elmoussaoui
2cd550cdbc gi: Add missing Since annotations 2024-01-03 08:49:39 +01:00
Benjamin Otte
766048b8e4 Merge branch 'wip/otte/for-main' into 'main'
testsuite: Add a test for conic gradients

See merge request GNOME/gtk!6700
2024-01-03 04:37:00 +00:00
Benjamin Otte
63615c05bc rendernode: Allocate right amount of memory
asan randomly failed when this almost correct code wasn't quite correct.

Hopefully this is the correct incantation to compute the size.

Related: glib#205
2024-01-03 05:01:08 +01:00
Benjamin Otte
cdf5d08294 rendernode: Fix a memleak 2024-01-03 04:58:08 +01:00
Benjamin Otte
3e4d0b69d4 gdkpng: Make the png loader safer against overflows
Load images that result in a texture >4GB in size.

And now let me keep playing with my 60k x 60k image, thanks.
I'm trying to OOM my GPU.
2024-01-03 04:11:35 +01:00
Benjamin Otte
7742434dde rendernode: Allow drawing oversized textures
Create surfaces for tiles of the image and then combine those tiles.

Use an offscreen and OPERATOR_ADD to avoid seams.
2024-01-03 04:11:35 +01:00
Benjamin Otte
f0e6c03d94 testsuite: Add a test for pixel alignment of offscreens
The test ensures that offscreens render to the same pixel grid as the
actual image, and they are not offset by fractions of a pixel.

The Cairo renderer fails here because Cairo's clipping code rounds pixel
values wrong.
2024-01-03 04:11:35 +01:00
Benjamin Otte
09882701c2 rendernode: Fix various places where clip was double applied
This is mostly untested and a result of reading the code.

The main effect here happens when a node was drawn that didn't start on
an integer boundary, which is very rare.
However, with specially crafted tests and when using fractional scaling,
this can happen.

This happened most often when clipping by the node bounds to restrict a
push_group() call. Enlarge that rectangle to fall on a pixel boundary.
2024-01-03 04:11:35 +01:00
Benjamin Otte
a19bc6620a rendernode: Apply the same radius for begin and end
Somebody fixed the end() call but not the begin() call when the too
large blur radius was fixed.
2024-01-03 04:11:35 +01:00
Benjamin Otte
da5de1ba99 nodeparser: Fix SEGV in shadows parsing code
Testcase included

The code was writing invalid memory, so this might not have always
crashed, but I did my best to write the test so it causes a SEGV.

Also included is a fix for the testsuite where the expected result was
wrong.
2024-01-03 04:11:35 +01:00
Benjamin Otte
e9d2f832a1 testsuite: Add a test for a clipping cornercase
If the new clip cannot intersect with the old clip and there is a global
opacity setting, things can go wrong.

So test that they don't.
2024-01-03 04:11:35 +01:00
Benjamin Otte
4fac0f713a testsuite: Add clipped overly large paths
... to make sure that renderers clip any masks they generate for paths.
2024-01-03 04:11:35 +01:00
Benjamin Otte
fff8198393 testsuite: GTK_MODULES doesn't exist anymore 2024-01-03 04:11:34 +01:00
Benjamin Otte
df2cbb4e9f testsuite: make compare-render --replay store results
The replayed node/images weren't saved.

I wanted to check that an optimization is done when replaying a test,
but without a saved node file, I couldn't.
2024-01-03 04:11:34 +01:00
Benjamin Otte
2990c1d8d8 testsuite: Add a test for conic gradients
Make all colorstops red, so that it's obvious what color each pixel is.
2024-01-03 04:11:34 +01:00
Benjamin Otte
4b5adcd374 testsuite: Fix CRC error in reference image
How did that get there?
2024-01-03 04:11:34 +01:00
Matthias Clasen
0b861cf159 Post-release version bump 2023-12-30 21:31:43 -05:00
Matthias Clasen
b7e770c8fc 4.13.4 2023-12-30 20:54:59 -05:00
Matthias Clasen
71bbba45cc Don't close the display in compare-render
It is not material to this test, and it causes some hard to
understand problem with fontconfigs use of mmap, leading to
a sporadic segfaults in pangos fontconfig thread.
2023-12-30 20:54:37 -05:00
Matthias Clasen
2da5ca4b42 gsk: Temporarily disable a test
This test fails on my system currently, since rawhide libpng appears
to have changed the encoding of pngs so that the texture nodes no
longer match the reference. This will be a problem as long as our
ci systems have an older libpng, so disable this test for now.
2023-12-30 20:54:37 -05:00
Emmanuele Bassi
02d5f6a629 Merge branch 'spinbutton-activate' into 'main'
Add activate, activates-default to spinbutton

See merge request GNOME/gtk!6550
2023-12-30 16:51:18 +00:00
PBS
fe224c3ad9 spinbutton: Add activate signal
Add a new activate signal that fires when enter is pressed after
editing, and make the default handler activate the default widget if
activates-default is set.
2023-12-30 14:34:49 +00:00
PBS
3d898af736 spinbutton: Tangential refactoring, small fix
* 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.

* Factorise gtk_spin_button_snap into two parts (snapping + setting),
  and make gtk_spin_button_snap only perform the snapping part.

* Avoid duplicate calls to gtk_adjustment_get_{lower/upper} and
  reinvention of CLAMP macro.
2023-12-30 14:34:49 +00:00
PBS
686d0f8d64 spinbutton: Add activates-default property
Add boilerplate for a new property, albeit one that does nothing yet.
2023-12-30 14:34:49 +00:00
Yaron Shahrabani
bad4327e72 Update Hebrew translation 2023-12-28 11:42:19 +00:00
Benjamin Otte
156cd7e967 Merge branch 'wip/otte/for-main' into 'main'
stroke: Turn stroke copy intialization into a macro

See merge request GNOME/gtk!6698
2023-12-28 07:01:07 +00:00
Benjamin Otte
28b552ad8c rendernode: Remove unnecessary save/restore 2023-12-28 07:35:47 +01:00
Benjamin Otte
c2fda3144d testsuite: Add a radial gradient test
All colors are idential so that the test doesn't fail due to rendering
differences.
2023-12-28 07:35:46 +01:00
Benjamin Otte
1e19629ce1 testsuite: Add a testcase for extensive rounded clips
The GL renderer can't handle this, so it's excluded.
2023-12-28 07:35:46 +01:00
Benjamin Otte
c7b4347342 roundedrect: Fix an intersection cornercase
These 2 rectangles used to intersect fine:
  0 0 50 50 / 50 0
  0 0 50 50 / 0 50
But the computed result was:
  0 0 50 50 / 50
which is not a valid rectangle, because the corners overlap.

Make sure such rectangles return NOT_REPRESENTABLE.

The above rectangle has been added to the testsuite.
2023-12-28 07:35:46 +01:00
Benjamin Otte
1c3e8d5280 testsuite: Add stroke tests
Same as the recent fill tests, just with strokes.
2023-12-28 07:35:46 +01:00
Benjamin Otte
ed8bca1548 path: Make gsk_path_to_string() work in non-US locales 2023-12-28 07:35:46 +01:00
Benjamin Otte
e1ca4b4569 testsuite: Add opacity handling test for fill nodes 2023-12-28 07:35:46 +01:00
Benjamin Otte
34392ca018 testsuite: Add a test filling 3d content
Checks that a simple Cairo fallback cannot be used.
2023-12-28 07:35:46 +01:00
Benjamin Otte
0c3c8a6a85 stroke: Turn stroke copy intialization into a macro
That way I can use it in static initializers.
2023-12-28 07:35:46 +01:00
Matthias Clasen
ea5768cb42 Merge branch 'wip/otte/for-main' into 'main'
rendernode: Use different hilights

See merge request GNOME/gtk!6694
2023-12-27 22:15:05 +00:00
Matthias Clasen
6683909dda Merge branch 'wip/sophie-h/native-nullables' into 'main'
gtk: Add nullables in native

Closes #6301

See merge request GNOME/gtk!6696
2023-12-27 22:13:49 +00:00
Luca Bacci
e4e0c27f58 Merge branch 'fix-wgl-leak' into 'main'
GdkWin32: Do not create multiple WGL contexts for the dummy window

Closes #6285

See merge request GNOME/gtk!6688
2023-12-27 15:43:54 +00:00
Luca Bacci
4e5456c8c3 GdkWin32: Do not create multiple WGL contexts for the dummy window
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/6285
2023-12-27 16:26:06 +01:00
Sophie Herold
4563f9353a gtk: Add nullables in native
GdkSurface and GskRenderer are not available before realized. Therefore mark
functions returning them in GtkNative as nullable.

Closes #6301
2023-12-27 13:59:03 +01:00
Matthias Clasen
906b88067a Merge branch 'matthiasc/for-main' into 'main'
Add a few annotations

See merge request GNOME/gtk!6695
2023-12-27 12:34:50 +00:00
Matthias Clasen
062902c003 Add a few annotations
Add a few pure, const and malloc annotations. These were suggested
by the gcc -Wsuggest-attribute option.
2023-12-26 21:57:04 -05:00
Matthias Clasen
6d57bbe7dd Fix a typo 2023-12-26 21:54:48 -05:00
Benjamin Otte
0c036c0c21 inspector: Make the "show fallbacks" actually do the right thing
After reshuffling debug categories, that toggle didn't do what was
expected anymore. Fix that.

Also clarify the message and add a tooltip.
2023-12-26 17:28:08 +01:00
Benjamin Otte
af014007f4 gl: Remove old Cairo fallback drawing code
We use gsk_render_node_draw_fallback() now which does all of that for
us.
2023-12-26 17:28:08 +01:00
Benjamin Otte
3f97ba2041 gsk: Clarify debug category messages a bit
After discussion on IRC about debug messages:

 - FALLBACK is meant to be used for printing stuff about fallbacks
   (Cairo, offscreens, conversion when uploading, etc)
 - CAIRO is for overdrawing everything drawn with Cairo
2023-12-26 17:28:08 +01:00
Benjamin Otte
4ce08a7b89 rendernode: Use different hilights
When hilighting Cairo nodes, use a different hilight color than when
hilighting other nodes.

This allows differentiating application use of Cairo (via nodes) from
renderer use of Cairo (via fallback).
2023-12-26 17:28:08 +01:00
Benjamin Otte
914e9bc316 Merge branch 'wip/otte/lots-of-tests' into 'main'
Lots of rendering tests and fixes

See merge request GNOME/gtk!6692
2023-12-26 15:22:35 +00:00
Benjamin Otte
9a5490c0cc Merge branch 'wip/otte/for-main' into 'main'
gsk: Repurpose GSK_DEBUG=cairo

See merge request GNOME/gtk!6693
2023-12-26 05:11:01 +00:00
Benjamin Otte
1385ffd2c2 gsk: Repurpose GSK_DEBUG=cairo
Use it to overlay an error pattern over all Cairo drawing done by
renderers.

This has 2 purposes:
1. It allows detecting fallbacks in GPU renderers.
2. Application code can use it to detect where it is using Cairo
   drawing.

As such, it is meant to trigger both with cairo nodes as well as when
renderers fallback for regular nodes.

The old use of the debug flag - which were 2 not very useful print
statements - was removed.
2023-12-26 05:31:05 +01:00
Benjamin Otte
a28915bffb testsuite: Disable all failing tests on GL renderer
Of all the recently added tests, disable the ones that fail on the GL
renderer, so that CI passes.
2023-12-26 05:03:25 +01:00
Benjamin Otte
2af5f7ffd1 testsuite: Limit compare --mask tests to 1000x1000
There are some tests that generate large images.

However, if we mask that image, we might have to generate offscreens
both for the source and for the mask.
And if we do that, it can take a long time. And especially on CI with
software rendering, that can quickly become noticable and result in
timeouts.
2023-12-26 05:03:25 +01:00
Benjamin Otte
e1bae384f0 testsuite: Add a shadow test
This test tests that shadows that are offset to outside the clip region
but where the blur goes back into the clip region get correctly drawn
and not optimized away.

To view what the test actually draws, remove at least the color-matrix
- it's only used so the blurring algorithm doesn't cause different
results - and maybe also the clip node.
2023-12-26 05:03:24 +01:00
Benjamin Otte
12a97ef422 testsuite: Add a forgotten test
The test existed in git but wasn't hooked up. So let's do that by:

1. Adding it to the build
2. Adapting it a bit so rounding errors really don't trigger (as the
   original commit claimed they shouldn't).
3. Re-renaming it because this was actually about 3d gradients
2023-12-26 05:03:24 +01:00
Benjamin Otte
9a6d6e80b5 testsuite: Add a nonorthogonal linear-gradient transform
The actual gradient line is covered by blocks, so there are no
artifacts. But if a renderer screws this up, the blue/red will seep
through these blocks.
2023-12-26 05:03:24 +01:00
Benjamin Otte
7ed6c39862 snapshot: linear-gradients cannot be affine-transformed
When different scale factors are used to transform a diagonal
linear gradient, the angle between the gradient line and its
perpendicular is no longer a right angle, which makes the
gradient come out different.

So it is necessary to use transform nodes in that case so that the
correct gradient gets rendered.

Technically, the code could check if the scales are equal or the
gradient line is horizontal/vertical, but I don't think that's worth it.
2023-12-26 05:03:24 +01:00
Benjamin Otte
57a4500bae rendernode: Don't mark impure functions as pure
Functions with out arguments can never be pure, because they write to a
pointer.

But pure functions must have no side effects.
2023-12-26 05:03:24 +01:00
Benjamin Otte
b01ed4ce39 rendernode: Set better size for mask nodes
Mask nodes are transparent outside of the intersection of source and
mask, unless the mask ode is inverted alpha.

Set the bounds accordingly.

Tests have been updated accordingly.
2023-12-26 05:03:24 +01:00
Benjamin Otte
2b142a59a1 testsuite: Add compare tests for mask modes inside an opacity node 2023-12-26 05:03:24 +01:00
Benjamin Otte
20c81d90c9 testsuite: Add yet another repeat node test
This one tests that when no offscreen is created for repeating but we
drw everything individually, we still respect the clip set via
child_bounds.
2023-12-26 05:03:24 +01:00
Benjamin Otte
3167a5b4d6 testsuite: Rewrite the --repeat option
* Don't grow the size too much - clip the size to 1000x1000
 * Add an offset, so the repeating doesn't always start top left
2023-12-26 05:03:24 +01:00
Benjamin Otte
f5584b178d testsuite: Add a test for repeat node offscreen scaling
Ensure that the offscreens for repeat nodes pick the right xscale and
yscale so that they render pixel-aligned.
2023-12-26 05:03:24 +01:00
Benjamin Otte
332fd1b840 testsuite: Add a repeat testcase
This test tests multiple things:

1. That huge contents are properly clipped by repeat nodes, even if the
   repeat happens in the visible part
2. That repeating only horizontally or only vertically is done quickly
   via offscreens when lots of repeating is done
2023-12-26 05:03:23 +01:00
Benjamin Otte
5e85b1aa02 testsuite: Add a repeat test
Ensures that repeating actually causes repeating in the renderer by
repeating a 1x1 image a lot.
2023-12-26 05:03:23 +01:00
Benjamin Otte
7f7254f10b testsuite: Add a repeat test for child bounds
Test that if the child is a texture that extends the child bounds, that
extension does not get repeated when rendering.

This can easily happen when the child is not drawn as an offscreen, but
instead the texture cache is consulted and no check for matching size is
done.
2023-12-26 05:03:23 +01:00
Benjamin Otte
72c58ccd7d testsuite: Add another test
This test ensures that offscreens for cross-fade children are properly
clipped and that the renderers can deal with the two not overlapping.
2023-12-26 05:03:23 +01:00
Benjamin Otte
f574cc2936 testsuite: Add test for gradients
Test that it can do 64 color stops.

Should ensure that renderers either can do unlimited amounts or have
fallbacks in place.
2023-12-26 05:03:23 +01:00
Benjamin Otte
2b59c4cf16 testsuite: Test we don't crash with overly large nodes
... when these nodes are used as children of a complex transform nodes
and we lose the clip.
2023-12-26 05:03:23 +01:00
Benjamin Otte
72b35a32fd testsuite: Fix corner case when testing repeats
When we test repeat nodes, make sure we round the size of the original
node up to an integer.
The reference image for the node is a rounded up, so when we generate a
new reference image we cannot deal with anything else.

Fixes huge-width test with --repeat.
2023-12-26 05:03:23 +01:00
Benjamin Otte
97b78cede0 testsuite: Unify renderer exclusion naming
Instead of using "-3d" to exclude Cairo rendering, use "-no$renderer" to
allow excluding any renderer.
And because we use contains() for the check, we can exclude multiple
renderers by naming the test sth like "test-nogl-nocairo.node"
2023-12-26 05:03:23 +01:00
Benjamin Otte
653d1eec55 testsuite: Add a variant of an existing test
This variant ccreates a huge node in the clipped region and tests that
renderers properly clip it away.
2023-12-26 04:25:11 +01:00
Benjamin Otte
4cc2a660e3 testsuite: Add a render test for a recent segfault
Renderer tend to ignore the clip when offscreening the child of a blur
node. So make a test that oversizes that child.
2023-12-26 04:25:11 +01:00
Benjamin Otte
6ab6109149 rendernode: Redo repeat handling
The previous approach could lead to offscreens that were too large and
cause errors.
2023-12-25 19:12:57 +01:00
Matthias Clasen
e93acc5762 Merge branch 'fix-focus-events' into 'main'
main: Fix a corner case in crossing events

See merge request GNOME/gtk!6690
2023-12-23 19:23:54 +00:00
Matthias Clasen
290c02b123 window: Fix focus event generation
Sync the code in gtkwindow.c that generates focus change events
with the similar code in gtkmain.c that generates crossing events.

This fixes assertion failures that would trigger in nautilus when
opening a folder.
2023-12-23 13:00:29 -05:00
Matthias Clasen
64db415e67 main: Fix a corner case in crossing events
We don't want to set a misleading descendent in the case that
we don't have a shared ancestor at all (because the old and the
new targets are on different toplevels).
2023-12-23 13:00:29 -05:00
Matthias Clasen
ed7ff78a0d Merge branch 'enums-docs' into 'main'
docs: Improve docs for enums

See merge request GNOME/gtk!6609
2023-12-22 15:50:10 +00:00
Maximiliano Sandoval R.
e857f0a3af Add Since annotations to enums
Doing this in a way that is picked up by gobject-introspection
requires splitting off new enum members into separate doc
comments, which is a bit unfortunate.
2023-12-22 08:47:47 -05:00
Matthias Clasen
9e8adb9792 Merge branch 'wip/snwh/symbolic-assets-sync' into 'main'
gtk: Update symbolic icons with newer assets from Adwaita

See merge request GNOME/gtk!6686
2023-12-21 19:31:09 +00:00
Benjamin Otte
4e84312a5a Merge branch 'wip/otte/for-main' into 'main'
dmabuf: Let the EGL code initialize GL

See merge request GNOME/gtk!6685
2023-12-21 18:03:36 +00:00
Sam Hewitt
5d84b757e2 gtk: Update symbolic icons with newer assets from Adwaita 2023-12-21 14:11:21 -03:30
Benjamin Otte
c21ca4811e vulkan: Require Vulkan 1.3
Some dmabuf formats were added in Vulkan 1.3.

Note that this does not require the Vulkan drivers to be version 1.3 -
it just means compilation against libvulkan 1.3
2023-12-21 17:21:54 +01:00
Benjamin Otte
96152303a6 dmabuf: Let the EGL code initialize GL
The EGL downloader initialization already calls prepare_gl(), so no need
to call it in init_dmabuf_formats(), too.
2023-12-21 17:21:52 +01:00
Matthias Clasen
fe07337e02 Merge branch 'ebassi/scrolled-window-doc-fix' into 'main'
docs: Clarify behaviour of GtkScrolledWindow child accessors

See merge request GNOME/gtk!6683
2023-12-21 12:30:14 +00:00
Matthias Clasen
312c0f0b3b Merge branch 'fix-crossing-events' into 'main'
main: Fix crossing event setup

Closes #6279

See merge request GNOME/gtk!6684
2023-12-20 21:50:33 +00:00
Matthias Clasen
adc9cc568e main: Check crossing invariants on both legs
We were calling check_crossing_invariants for the ascending
part, but not for the descending part. Fix that.
2023-12-20 15:26:05 -05:00
Matthias Clasen
3e59b0b582 Fix a typo
This unfortunate typo made it so we never actually checked
the crossing invariants.
2023-12-20 15:26:05 -05:00
Matthias Clasen
6a5ee99c23 main: Fix crossing event setup
We were not determining the new descendent correctly. And since
our invariants check was ineffective, nobody noticed until now.

Fixes: #6279
2023-12-20 15:25:50 -05:00
Matthias Clasen
8fda63c85e Merge branch 'pragma-once-header-cleanup' into 'main'
media: Convert headers to #pragma once

See merge request GNOME/gtk!6682
2023-12-20 18:38:42 +00:00
Emmanuele Bassi
eccf0a6905 docs: Clarify behaviour of GtkScrolledWindow child accessors
Right now, it's mentioned only in the class description of
GtkScrolledWindow that the accessors of the child property don't
necessarily roundtrip.

Let's make it more clear by expanding the documentation of the setter,
getter, and property.

See: #6275
2023-12-20 17:50:30 +00:00
Matthias Clasen
cfa9dc6162 testsuite: Use #pragma once consistently 2023-12-20 10:55:14 -05:00
Matthias Clasen
9f068866e2 examples: Use #pragma once consistently
It is our current coding style.
2023-12-20 10:29:45 -05:00
Matthias Clasen
0d03e570b0 tests: Use #pragma once consistently
Its the current coding style.
2023-12-20 10:25:41 -05:00
Matthias Clasen
0dcf31292d icon-browser: Use #pragma once consistently
That is the current coding style.
2023-12-20 10:24:05 -05:00
Matthias Clasen
4ab18b6657 gtk4-demo: Use #pragma once consistently
This is our current coding style.
2023-12-20 09:55:11 -05:00
Matthias Clasen
957d96102a gtk: Use #pragma once consistently
One header snuck in missing it.
2023-12-20 09:52:04 -05:00
Matthias Clasen
d21a691f44 node-editor: Convert headers to #pragma once
That is our current coding style.
2023-12-20 09:51:19 -05:00
Matthias Clasen
ae5ea8e495 printing: Convert headers to #pragma once
That is our current coding style.
2023-12-20 09:44:29 -05:00
Matthias Clasen
bbabb1973c media: Convert headers to #pragma once
This is our current coding style.
2023-12-20 09:43:54 -05:00
Benjamin Otte
d2a85abf79 Merge branch 'wip/otte/dmabuf-refactoring' into 'main'
dmabuf refactoring

See merge request GNOME/gtk!6678
2023-12-20 10:25:29 +00:00
Benjamin Otte
74620ffc46 dmabufdownloader: Add a close() function
We need to unrealize renderers before unreffing them. This vfunc takes
care of that.
2023-12-20 10:59:25 +01:00
Benjamin Otte
ce04dfad41 renderer: Move function into only caller
The convert_texture() path only works for the GL renderer, the new
renderers potentially use dmabuf textures as result of render_texture(),
so they need to be smarter here.
2023-12-20 10:59:25 +01:00
Benjamin Otte
568eed9477 dmabuf: Turn the downloader into an interface
This way, we can move the actual downloader code into GSK - by just
implementing the interface in the GskGLRenderer.
2023-12-20 10:59:25 +01:00
Benjamin Otte
26561ab2e7 dmabuf: Refactor downloader vfuncs
This is in preparation for future commits. It also makes the API
clearer.
2023-12-20 01:51:46 +01:00
Benjamin Otte
26060b1be2 dmabuf: move DmabufTexture typedef
Preparation work.
2023-12-20 01:51:46 +01:00
Benjamin Otte
210c71b856 egl: Split out a function
This makes no sense by itself, but we want to create the EGLImage at
DmabufTexture construction so that we can actually reject dmabufs that
we can't create EGLImages for.

This will make it possible to bail when the stride limitation for AMD
GPUs hits.
2023-12-20 01:51:46 +01:00
Benjamin Otte
7206060450 dmabuf: Move thread marshalling into DmabufTexture
All downloaders are going to need this, it would make no sense if they
all need to duplicate that code.
2023-12-20 01:51:46 +01:00
Matthias Clasen
31cd2b19cd Merge branch 'macos-pre-10.13' into 'main'
gdk/macos: fix builds on macOS before 10.13

Closes #5738

See merge request GNOME/gtk!5813
2023-12-19 01:20:18 +00:00
Matthias Clasen
857de33937 Merge branch 'michaelweghorn/a11y_add_article_and_comment_roles' into 'main'
a11y: Add article and comment roles

See merge request GNOME/gtk!6646
2023-12-19 01:19:17 +00:00
Matthias Clasen
3d9d4031d6 Merge branch '0bsd-license' into 'main'
Add Zero-Clause BSD license

See merge request GNOME/gtk!6643
2023-12-19 01:12:38 +00:00
Benjamin Otte
738b48c660 dmabufegl: Remove unsued argument from function 2023-12-18 23:34:47 +01:00
Emmanuele Bassi
cce5f691e2 Merge branch 'ebassi/issue-6273' into 'main'
Fix typo in GtkAspectFrame.yalign accessor

Closes #6273

See merge request GNOME/gtk!6676
2023-12-18 19:24:05 +00:00
Emmanuele Bassi
ad4f2de86c Fix typo in GtkAspectFrame.yalign accessor
Copy-paste error.

Fixes: #6273
2023-12-18 19:03:53 +00:00
Matthias Clasen
9166e90bd4 Merge branch 'gles-glyph-upload' into 'main'
gsk: Fix icon and glyph upload with GLES

Closes #6216

See merge request GNOME/gtk!6674
2023-12-18 12:34:58 +00:00
Matthias Clasen
6ad15fe6d0 gsk: Fix icon and glyph upload with GLES
We can't avoid a copy here, unfortunately.

Fixes: #6216
2023-12-17 21:53:10 -05:00
Benjamin Otte
66b992c3c0 dmabuf: Change the way downloaders work
Instead of having an add_formats() function, make the get_downloader()
function add the formats.

This allows putting the actual downloader in a different place from the
initialization code.
2023-12-16 21:36:21 +01:00
Benjamin Otte
b19f71dd24 dmabuf: Add Vulkan formats to the large table
This is done without testing, just doing my best to map all the DRM
formats to VkFormats.

Once people start using them, they'll figure it out when it's wrong.
(Somebody needs to write a testsuite.)
2023-12-16 19:16:50 +01:00
Benjamin Otte
cccec91b66 memoryformat: Put dmabuf fourccs into the big format table
I'm concentrating the data about memory formats, and this part was
missing.
2023-12-16 17:01:42 +01:00
Matthias Clasen
cd6e8d9e5b Merge branch 'straight-alpha-dmabuf' into 'main'
memoryformat: Expand docs

See merge request GNOME/gtk!6669
2023-12-16 13:05:13 +00:00
Benjamin Otte
00566261b2 dmabuf: Explode the DmabufFormatInfo array
it's growing more and mroe, and it gets too wide and unreadable
otherwise.
2023-12-16 09:21:20 +01:00
Benjamin Otte
888b9ee352 dmabuf: Don't use a downloader for builtin downloads
When we use the builtin downloads via mmap(), it's a special case where
we don't need to initialize subsystems and query them for support. We
know what we can and can't do.

Also, we want to use these formats with the lowest priority but pick the
downloader first for supported formats, and queueing it in the
downloaders list doesn't reflect that. So don't do it.
2023-12-16 09:21:19 +01:00
Benjamin Otte
f0eceb4aa3 dmabuf: Remove out argument
The format is the same everywhere, so instead of letting every
implementation do the same thing, do it in a central place instead.
2023-12-16 09:20:36 +01:00
Benjamin Otte
ff082a7758 memoryformat: Add Vulkan format information
This is not used yet, but I want to add it, so that it exists.

That way, when we add new formats, people don't forget to add the Vulkan
formats.
2023-12-16 09:20:36 +01:00
Benjamin Otte
f357623170 memoryformat: Fix broken swizzle values
I can't copy/paste.
2023-12-16 09:20:29 +01:00
Matthias Clasen
bd3afd1006 testdmabuf: Add a --unpremultiplied option
This lets us test handling of straight-alpha dmabufs.
2023-12-15 07:40:27 -05:00
Matthias Clasen
79009d4158 gsk: Handle straight-alpha dmabufs
This omission was noticed by Benjamin Otte. Add a premultiply
uniform to the external shader, and add a separate premultiply
shader for the non-external case.
2023-12-15 07:40:27 -05:00
Benjamin Otte
b782f80311 Merge branch 'testsuite_fix_display_x11_on_win32' into 'main'
testsuite: don't run x11-specific tests if disabled

See merge request GNOME/gtk!6657
2023-12-14 01:57:13 +00:00
Matthias Clasen
c48a3152f0 memoryformat: Expand docs
This captures some irc exchanges about the intended use of
the new memory format apis.
2023-12-13 12:44:20 -05:00
Emmanuele Bassi
d2d2fb4b50 Merge branch 'michaelweghorn/a11y_atspi_map_row_col_index_text' into 'main'
a11y atspi: Map GTK_ACCESSIBLE_RELATION_{COL,ROW}_INDEX_TEXT to AT-SPI

See merge request GNOME/gtk!6563
2023-12-13 14:48:10 +00:00
Benjamin Otte
81adf6be22 dmabuf: Add gdk_dmabuf_fourcc_is_yuv()
In the future, we want to be using GdkColorState instead, but for now,
let's use this.

Also remove a duplicate entry in the list of formats.
2023-12-13 05:54:06 +01:00
Benjamin Otte
ff9c9e05c3 Merge branch 'testsuite_fix_icontheme_win32_v2' into 'main'
testsuite: fix icontheme test failure on win32 [v2]

See merge request GNOME/gtk!6664
2023-12-12 23:54:43 +00:00
g.willems
e3f39bf0c3 testsuite: only run x11-specific tests if x11 enabled
Some testcases rely on X11 support, which is not always available,
typically on win32.
Skip them if the x11 backend is disabled.
2023-12-12 21:29:03 +01:00
g.willems
d692243727 testsuite: fix icontheme test failure on win32
g_str_has_suffix() fails due to different path separators.
Compare URIs instead.
2023-12-12 21:25:16 +01:00
Benjamin Otte
6ad9db0bf0 Merge branch 'texture-diff-against-distant-ancestors' into 'main'
texture: Enable texture diff against arbitrarily distant ancestors

See merge request GNOME/gtk!6644
2023-12-12 01:46:05 +00:00
Benjamin Otte
486157f6bf Merge branch 'wip/otte/for-main' into 'main'
testsuite: Add a test for opacity + color-matrix nodes

See merge request GNOME/gtk!6659
2023-12-12 01:05:00 +00:00
Benjamin Otte
5ca4ab3aaa dmabuf: Add gdk_dmabuf_import/export_sync_fd()
Vulkan needs this.

This code is following the code that compositors with Wayland support -
like wlroots - are doing.

The code was introduced to Linux in
https://lore.kernel.org/dri-devel/20220506180216.2095060-1-jason@jlekstrand.net/
2023-12-12 01:49:41 +01:00
Benjamin Otte
a37b3fb691 dmabuf: Add gdk_dmabuf_ioctl()
The function is a copy of libdrm's drmIoctl() and handles EINTR and
EAGAIN error.s

Use it for the sync ioctls in the dmabuf mmaping calls.
2023-12-12 01:49:41 +01:00
Benjamin Otte
c414889cfa testsuite: Make memorytexture test work with GLES < 3.1
Previously, the code was skipping various tests and not skipping others
that it should.

Fix both of these cases.
2023-12-12 01:49:41 +01:00
Benjamin Otte
4dfc07ef57 memoryformat: Fix variable types
Use the same types that GL uses.
2023-12-12 01:49:41 +01:00
Benjamin Otte
cf4b0a27f8 glcontext: Only swizzle when we can
Don't use the recently added swizzle optimization if we're using a GL
version that is too old to support swizzling (GLES 2).
2023-12-12 01:49:41 +01:00
Benjamin Otte
393ee574b6 gl: Print debug for CPU conversions of textures
When the GL renderer cannot upload a given format, print a FALLBACK
debug message with the failed format and the alternative that was
picked, for example:

Unsupported format b8g8r8a8, converting on CPU to b8g8r8a8-premultiplied

Makes it easier to figure out what's happening, especially when using
old GLES versions that don't support all formats.
2023-12-12 01:49:41 +01:00
Benjamin Otte
e3c85be53f memoryformat: Add gdk_memory_format_get_fallbacks()
Track fallback formats to use in the memoryformat directly instead of
using in the GL uploading code.

First of all, this allows sharing the code and ensuring all our
renderers use the same fallback mechanism.

But also, this allows tracking fallbacks per-format which is useful
because the fallback formats aren't really a tree. We want to make
FLOAT16 fall back to FLOAT32 when not available, but we also want
FLOAT32 fall back to FLOAT16.
By tracking the fallbacks per-format, we can achieve that.
2023-12-12 01:49:40 +01:00
Benjamin Otte
0f5fda2277 memoryformat: Introduce new (private) API
Add gdk_memory_format_get_premultiplied() and
gdk_memory_format_get_straight() which return the matching
premultiplied/straight format.

Use this to pick the premultiplied format when uploading GL textures.

And remove the duplication in the dmabuf code, where we can now use
these functions instead of tracking both the premultiplied and straight
alpha versions.
2023-12-12 01:49:40 +01:00
Benjamin Otte
0889037959 gltexture: Use the right format to download
When the format is set correctly, which it should be, we should just use
it.

So do that.
2023-12-12 01:49:40 +01:00
Benjamin Otte
ee56ad792c memoryformat: Fix 2 broken formats
They are straight alpha, and the GL renderer isn't using them yet, so
existing code is not affected.
2023-12-12 01:49:40 +01:00
Benjamin Otte
5688b7b4bb gl: Add a new alternative format
Add an "RGBA" format that just maps to the swizzled version of the
default format.

This way, BGR gets mapped to RGB + swizzling first before trying to map
it to the default format for the depth.

The benefit here is that this format has the same memory width, so
uploading/downloading code can treat it equivalent to the original
format and there's no conversion neccessary later.
2023-12-12 01:49:40 +01:00
Luca Bacci
df1802f756 Merge branch 'gdkwin32_support_debug_default-settings' into 'main'
gdk/win32: support default-settings debug flag

See merge request GNOME/gtk!6658
2023-12-11 23:15:38 +00:00
Benjamin Otte
84de90756d memoryformat: Make the big array more readable
Prefix the struct members with their name, similar to how our Vulkan
code looks.
2023-12-11 22:11:28 +01:00
Benjamin Otte
cb5a8a76da Merge branch '6261-gtkstringlist-lacks-item-type-and-n-items' into 'main'
stringlist: Introduce :item-type and :n-items

Closes #6261

See merge request GNOME/gtk!6662
2023-12-11 18:18:49 +00:00
António Fernandes
26c35c00e1 stringlist: Introduce :item-type and :n-items
While not required by the GListModel interface, they are a useful
convention which is already implemented by other GListModel public
implementation in GTK, particularly for use in expressions and
bindings.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/6261
2023-12-11 17:36:52 +00:00
Emmanuele Bassi
5d4879aae7 Merge branch 'wip/typo' into 'main'
gtk-demo: Fix typo

See merge request GNOME/gtk!6661
2023-12-11 13:58:27 +00:00
Carlos Garnacho
39b08b82ca gtk-demo: Fix typo
Close the quotes in alert dialog message.
2023-12-11 14:22:30 +01:00
Benjamin Otte
2b6e7147d6 build: Sort alphabetically 2023-12-11 07:33:26 +01:00
Benjamin Otte
3a1349e8ef gl: Make gdk_memory_format_gl_format() no longer check support
Now that we have gdk_gl_context_get_memory_flags() and code can use that
function, make the code do that.

Remove support checks from gdk_memory_format_gl_format().

This is an initial naive port that doesn't try to make use of the finer-grained
flags yet.
2023-12-11 07:33:26 +01:00
Benjamin Otte
5485d806c5 glcontext: Add gdk_gl_context_get_memory_flags()
Checks which features of a given memory format are supported by
the current GL implementation.

We check:
 * usable: Can be used as a texture with NEAREST filter
 * renderable: Can be used as a render target
 * filterable: Can be used with GL_LINEAR

In normal GL, all formats are all of these things, but GLES is a lot
more picky.

So far nobody uses this.
2023-12-11 07:33:26 +01:00
Benjamin Otte
6e7c499408 testsuite: Don't create nodes with negative size
If width or height are too small, only create one mask node.

The previous math would create the 2nd node with negative width/height.
2023-12-11 07:33:26 +01:00
Benjamin Otte
c341da32aa gsk: Set correct blur radius for cairo shadows 2023-12-11 07:33:26 +01:00
Benjamin Otte
d39ec8c09e gsk: Quality of life improvements for Cairo rendering
1. Check for an empty clip region before push/pop_group() calls

2. Remove save/restore() pairs as the vfunc invocation does so already.
2023-12-11 07:33:26 +01:00
Benjamin Otte
e3299e38df cairo: Handle clipped blur content
This is the result of experimenting with corner cases when blurring.

The result is a test that tests when the child of a blur node is
clipped out but the blurred child is not, the blurred parts are still
visible.

This immediately broke the cairo renderer, so the fix is included.
2023-12-11 07:33:24 +01:00
Benjamin Otte
8fd02f6fa2 subsurface: Do not punch holes for subsurfaces that are above
If a subsurface is not below, it is visible no matter what the opaque
region is.

Also, we don't need to care about transparency in the subsurface if we
ignore it anyway. So this is a win-win.
2023-12-11 07:32:06 +01:00
Benjamin Otte
9bc0ad9a13 gdk: Handle subsurface opaque region with transparency
We accept transparent subsurfaces for passthrough now, when they are
above the surface.
But we did not unset the opaque region to empty when the texture is
transprent.
2023-12-11 07:32:06 +01:00
Benjamin Otte
19171c7a89 testsuite: Add a test for opacity + color-matrix nodes
These are 2x2 combinations that:
1. Use a texture child node vs a color child node
   This should force an offscreen vs straight up use a texture.
2. Switch opacity and color-matrix
   Either put the color matrix into the opacity node or put the opacity
   into the color matrix.

This is worth testing because renderers often combine opacity into the
color matrix to avoid offscreens.

And they do that because applications often create faded out symbolic
images, which end up as a combination of these nodes.
2023-12-09 19:32:39 +01:00
Benjamin Otte
abf942efe5 dmabuf: Don't leak the display 2023-12-09 19:32:39 +01:00
g.willems
f96c72c4b3 testsuite: fix recentmanager failure on win32
Replace unsupported and deprecated 'g_test_trap_fork' by 'g_test_subprocess'.
Force 'gtk-recent-files-enabled' to TRUE.
2023-12-09 18:08:03 +01:00
g.willems
dfe7afdb04 gdk/win32: support default-settings debug flag 2023-12-09 17:59:24 +01:00
Ben Mather
1629b072fe texture: Enable texture diff against arbitrarily distant ancestors 2023-12-08 11:29:56 +00:00
Matthias Clasen
0b0a5a52af Merge branch 'docs_clarify_gtk_drop_down_get_selected_item' into 'main'
docs: Clarify how to obtain strings from GtkDropDown

See merge request GNOME/gtk!6647
2023-12-08 10:20:12 +00:00
Matthias Clasen
75d259eedf Merge branch 'fix-label-docs' into 'main'
Docs: Fix unfenced HTML tag in GtkLabel docs

See merge request GNOME/gtk!6650
2023-12-08 10:17:59 +00:00
FeRD (Frank Dana)
6fec018cbd Docs: Fix unfenced HTML tag in GtkLabel docs 2023-12-08 02:29:10 -05:00
Matthias Clasen
6d9c950b82 Merge branch 'ebassi/inhibit-reason-fallback' into 'main'
Add fallback string for empty inhibit reason

See merge request GNOME/gtk!6648
2023-12-08 04:06:11 +00:00
Emmanuele Bassi
0933ea63c5 Add fallback string for empty inhibit reason
The public gtk_application_inhibit() API allows a NULL reason argument,
and we have a fallback in place when going through the session manager
proxy; when using the inhibit D-Bus API directly, though, we're just
passing a potentially NULL value to g_variant_new_string(), which will
rightfully complain.
2023-12-07 11:55:20 +00:00
Logan Rathbone
8cb594696e docs: Clarify how to obtain strings from GtkDropDown 2023-12-07 00:03:04 -05:00
Michael Weghorn
ab7592ee4f a11y: Add article and comment roles
Add new accessible roles
GTK_ACCESSIBLE_ROLE_ARTICLE and
GTK_ACCESSIBLE_ROLE_COMMENT.

ARIA has corresponding roles as well [1] [2],
with the article role being the superclass role
of the comment role.

Acccording to the ARIA spec, the article role
has the document role as superclass role and
the name can be set by the author.

For the comment role, the name can be set by the
author or come from the content.

The ARIA spec for the comment contains this sentence [2]:

> If the author has not explicitly declared aria-level, aria-posinset, or
> aria-setsize for a comment element, user agents MUST automatically
> compute the missing values and expose them to assistive technologies.

However, these properties are not listed as "Required States and
Properties" in the following table for that role. Potentially
the above requirement only applies for the first of the two
possible described cases of how the relationship between comments
and the commented content can be set, so don't hard-require
these attributes in the a11y overlay's
`check_widget_accessibility_errors` either.

[1] https://w3c.github.io/aria/#article
[2] https://w3c.github.io/aria/#comment
2023-12-06 15:36:50 +01:00
Matthias Clasen
9d7389aea7 Merge branch 'emoji-15.1' into 'main'
emoji: Update data to CLDR v44

See merge request GNOME/gtk!6642
2023-12-06 11:26:05 +00:00
Nazar Mokrynskyi
994644ffe7 Add Zero-Clause BSD license 2023-12-04 07:05:43 +02:00
Jeremy Bícha
76a1f1714d emoji: Update data to CLDR v44
Based on emojibase v15.3.0

Contains the changes in Unicode 15.1

https://unicode.org/versions/Unicode15.1.0/
https://cldr.unicode.org/index/downloads/cldr-44
https://github.com/milesj/emojibase/blob/emojibase-data%4015.3.0/packages/data/CHANGELOG.md
2023-12-03 16:32:42 -05:00
Yaron Shahrabani
9af08e17e0 Update Hebrew translation 2023-12-03 13:32:37 +00:00
Boyuan Yang
276afbca92 Update Chinese (China) translation 2023-12-03 01:40:50 +00:00
Yaron Shahrabani
0342d23dbe Update Hebrew translation
(cherry picked from commit cde309d9fa)
2023-12-02 22:12:14 +00:00
Matthias Clasen
1c10837b21 Merge branch 'matthiasc/for-main' into 'main'
Revert "Merge branch 'rgba-new-from-string' into 'main'"

See merge request GNOME/gtk!6640
2023-12-02 05:43:12 +00:00
Matthias Clasen
7cc5d5c7a5 Revert "Merge branch 'rgba-new-from-string' into 'main'"
This reverts commit 77f40d7508, reversing
changes made to b969f4649d.

It turns out we did not have agreement on this after all.
2023-12-02 10:55:35 +05:45
Matthias Clasen
6a59326dbf Merge branch 'emoji-15' into 'main'
emoji: Update data to CLDR v43

See merge request GNOME/gtk!6639
2023-12-02 02:12:17 +00:00
Yaron Shahrabani
1968f331d9 Update Hebrew translation 2023-12-01 21:02:25 +00:00
Jeremy Bícha
bf35836350 emoji: Update data to CLDR v43
Based on emojibase v15.2.0

Contains the changes in Unicode 15.0

https://unicode.org/versions/Unicode15.0.0/
https://cldr.unicode.org/index/downloads/cldr-43
https://github.com/milesj/emojibase/blob/emojibase-data%4015.2.0/packages/data/CHANGELOG.md
2023-12-01 15:57:02 -05:00
Daniel Rusek
036629a491 Update Czech translation 2023-11-30 18:26:58 +00:00
Arjan Molenaar
8cabf59cf3 Merge branch 'macos-secure-restore' into 'main'
macos: Add method that denotes secure restorable state

See merge request GNOME/gtk!6632
2023-11-30 15:17:04 +00:00
Arjan Molenaar
6a4b238641 macos: Add method that denotes secure restorable state
Fix process injection vulnerability on macOS.
2023-11-29 12:30:30 +01:00
Matthias Clasen
d4d0239ae7 Merge branch 'macos-fix-function-signature' into 'main'
Fix function signature warning on macOS

See merge request GNOME/gtk!6628
2023-11-29 00:53:31 +00:00
Matthias Clasen
a30f32db8d Merge branch '6236_fix_modify_textbuffer_in_irreversible' into 'main'
gtktexthistory: allow setting the modified flag in irreversible action

Closes #6236

See merge request GNOME/gtk!6626
2023-11-28 23:51:51 +00:00
Arjan Molenaar
6948a74d72 Fix function signature warning
No arguments -> void
2023-11-28 21:24:10 +01:00
Matthias Clasen
14ec255812 Merge branch 'gles-texture-slice-fixes' into 'main'
gsk: Be more careful about texture slice formats

See merge request GNOME/gtk!6627
2023-11-28 20:07:44 +00:00
Matthias Clasen
00ebd51d06 gsk: Be more careful about texture slice formats
We need to make sure that all our textures have the same memory
format, or we'll run into trouble in the upload code, at least
on GLES, which isn't as forgiving about format mismatches.

Related: #6238
2023-11-28 14:16:21 -05:00
g.willems
7de528b487 gtktexthistory: allow set modified in irreversible action
Allow setting the modified flag, but skip propagating the history state update
as it will be done by gtk_text_history_end_irreversible_action().

Fixes #6236
Closes #6236
2023-11-28 19:57:11 +01:00
Matthias Clasen
77f40d7508 Merge branch 'rgba-new-from-string' into 'main'
Add convenience function gdk_rgba_new_from_string()

See merge request GNOME/gtk!6599
2023-11-28 17:56:21 +00:00
Danial Behzadi
b969f4649d Update Persian translation 2023-11-28 08:47:40 +00:00
FeRD (Frank Dana)
f4f25e584c Fix docs function reference 2023-11-27 21:16:44 -05:00
FeRD (Frank Dana)
b049a3501a Additional review fixes 2023-11-27 19:44:24 -05:00
Emmanuele Bassi
0114fad8a5 Style/doc fixes from review 2023-11-28 00:42:19 +00:00
Matthias Clasen
afafac6878 Merge branch 'matthiasc/for-main' into 'main'
Use O_CLOEXEC instead of FD_CLOEXEC

See merge request GNOME/gtk!6624
2023-11-27 23:10:35 +00:00
Matthias Clasen
108eb43b01 gsk: Add some more proiler marks
These should help us determine if time is spent converting or
uploading textures.
2023-11-27 17:50:28 -05:00
Matthias Clasen
6961c1fe4a Use O_CLOEXEC instead of FD_CLOEXEC
GLib is complaining vocally about this.
2023-11-27 17:50:18 -05:00
Matthias Clasen
606d150e0b Merge branch 'matthiasc/for-main' into 'main'
wayland: Be more careful when loading cursors

See merge request GNOME/gtk!6622
2023-11-27 21:01:16 +00:00
Matthias Clasen
96f7bb99a7 css: Fix opacity handling
We were using the invert value for opacity.
2023-11-27 15:30:37 -05:00
Matthias Clasen
b937c17985 wayland: Be more careful when loading cursors
Make sure we don't access the cursor_images array out of bounds.

Related: #6234
2023-11-27 13:58:38 -05:00
Emmanuele Bassi
79cb370f81 Merge branch 'gtk_font_dialog_choose_font_and_features_finish_fix' into 'main'
GtkFontDialog: fix annotation for choose_font_and_features_finish

See merge request GNOME/gtk!6621
2023-11-27 17:53:38 +00:00
Val Och
154b73723f GtkFontDialog: fix annotation for choose_font_and_features_finish
Parameters in question have callee-allocated semantics.
2023-11-27 19:48:48 +03:00
Artur S0
c0efed4e4a Update Russian translation 2023-11-27 16:16:29 +00:00
Matthias Clasen
4402676aa2 Merge branch 'update-ci-images' into 'main'
ci: Update the fedora image for F39

See merge request GNOME/gtk!6620
2023-11-27 15:25:57 +00:00
Matthias Clasen
9bf4a45d47 Merge branch 'matthiasc/for-main' into 'main'
Matthiasc/for main

See merge request GNOME/gtk!6619
2023-11-27 14:59:30 +00:00
Matthias Clasen
85ce343816 ci: Update the fedora image for F39
This will hopefully help with getting the gpu renderer tests
to work.
2023-11-27 09:51:14 -05:00
FeRD (Frank Dana)
114d0621aa Fix coding style issues 2023-11-26 16:19:06 -05:00
Matthias Clasen
d595aff52d coding style: Mention the available stack size 2023-11-26 09:07:38 -05:00
Matthias Clasen
d72fd951e1 Quiet a compiler warning 2023-11-26 08:47:51 -05:00
Matthias Clasen
78706e3fbe Merge branch 'clarify_template_builder_docs' into 'main'
docs: Clarify how to refer to instances created by <template>

See merge request GNOME/gtk!6605
2023-11-25 18:03:08 +00:00
Matthias Clasen
98b796a371 Merge branch 'ci-run-less-tests' into 'main'
ci: Pick up reports for all test setups

See merge request GNOME/gtk!6616
2023-11-25 18:01:50 +00:00
Matthias Clasen
c99f62aef1 Merge branch 'wip/dnd-fixes' into 'main'
DnD fixes

See merge request GNOME/gtk!6608
2023-11-25 17:59:39 +00:00
Matthias Clasen
8754247a90 Merge branch 'wip/otte/dmabuf' into 'main'
dmabuf: A bunch of cleanups

See merge request GNOME/gtk!6610
2023-11-25 17:58:11 +00:00
Matthias Clasen
fd12707162 Merge branch 'doc-fixes' into 'main'
Docs: Misc Fixes

See merge request GNOME/gtk!6615
2023-11-25 17:55:47 +00:00
Matthias Clasen
34bca0ff56 Merge branch 'gtk4-portal-close' into 'main'
[gtk4] Fix file chooser and open uri portal close.

See merge request GNOME/gtk!6613
2023-11-25 17:19:31 +00:00
Matthias Clasen
c668519d07 ci: Handle deprecation warnings in report scripts 2023-11-25 11:21:48 -05:00
Matthias Clasen
454e6eadc6 ci: Rebalance test runs
Move x11 to the debug build, and make it a full run.
2023-11-25 11:03:15 -05:00
Matthias Clasen
e248a01fbd ci: Run less tests
Our test setups are mostly about varying the rendering environment
(different backends, or renderers, etc). Therefore, we don't need
to duplicate the runs of the css or node parser or path tests.
Just run the gdk and gsk-gl tests under all setups.
2023-11-25 10:37:39 -05:00
Matthias Clasen
e2bd7defa4 ci: Tweak the run-tests script
The main change here is to pass the suites to run as an explicit
argument. This is in preparation for running less tests.
2023-11-25 10:37:39 -05:00
Matthias Clasen
855fa6d523 ci: Produce a junit report for asan too 2023-11-25 10:37:39 -05:00
Matthias Clasen
7c620ac2b7 ci: Pick up reports for all test setups
We added a wayland_gl test setup recently, and all the setups
have to be listed manually in .gitlab-ci.yml.
2023-11-25 09:21:16 -05:00
Maximiliano Sandoval R.
d96f2f54e9 stylecontext: Properly anotate Deprecated 2023-11-25 15:02:06 +01:00
Maximiliano Sandoval R.
71c2ee3530 gskenums: Add Since to missing enum values
Use same Since annotation as elsewhere
2023-11-25 15:01:53 +01:00
Maximiliano Sandoval R.
5e415ee916 gskenums: Don't break the docstring 2023-11-25 15:00:40 +01:00
Maximiliano Sandoval R.
e163021b8f debug: Document missing enum 2023-11-25 15:00:14 +01:00
Benjamin Otte
1bf88f1d81 Merge branch 'wip/otte/for-main' into 'main'
Revert commits that disabled the testsuite

See merge request GNOME/gtk!6614
2023-11-25 12:31:21 +00:00
Benjamin Otte
72d2b8e546 Revert "ci: Tweak the run-tests script"
This reverts commit 9aadc2b860.
2023-11-25 13:09:50 +01:00
Benjamin Otte
37f7f3d60c Revert "wip: ci: rework the test runs"
This reverts commit c679ba9ebf.
2023-11-25 13:09:50 +01:00
Benjamin Otte
8d1443994b Revert "ci: Run less tests"
This reverts commit 5a8a839921.
2023-11-25 13:09:49 +01:00
FeRD (Frank Dana)
39db73dff1 Add gdk_rgba_new_from_string()
Signed-off-by: FeRD (Frank Dana) <ferdnyc@gmail.com>
2023-11-24 22:19:39 -05:00
Emilio Cobos Álvarez
68cf5f2cf3 [gtk4] gtkopenuriportal: Fix portal close signal.
Same fix. The other instance of this pattern in gtkapplication-dbus.c
does it right.
2023-11-25 03:49:58 +01:00
Emilio Cobos Álvarez
77c4097c86 [gtk4] GtkFileChooserNative: Fix portal close.
This makes closing a portal file chooser work.

Fixes the GTK4 bits of #6225.
2023-11-25 03:47:28 +01:00
Benjamin Otte
d7bc4c719b dmabuf: Remove unused headers 2023-11-25 01:44:34 +01:00
Benjamin Otte
725857e15b dmabuf: Add a fallback list of fourccs
That way, we can work with older libdrm versions.

The list was generated via a bit of sed and grep from the current
dmabuf-fourcc.h, which is why I put it into its own file and included
all the formats, no matter how old they are.
2023-11-25 01:44:34 +01:00
Benjamin Otte
50ee872978 dmabuf: Add gdk_dmabuf_get_fourcc()
Returns the fourcc for a given GdkMemoryFormat.

Not sure if this is the best name, but I didn't know a better one.
2023-11-25 01:44:34 +01:00
Benjamin Otte
b6c82c6b54 dmabuf: Add all formats
Add the matching GdkMemoryFormat for all dmabuf formats.

This way, we don't fall back to RGBA8 for 10- and 16-bit formats that we
don't support natively when EGL or Vulkan use them.

Also includes corrections for a few mixups.
2023-11-25 01:44:34 +01:00
Benjamin Otte
1bf94b045c dmabuf: Refactor function
1. Don't require passing in a GdkDisplay

2. return TRUE/FALSE if a format was found, so calling code can
   decide how to handle failure itself
2023-11-25 01:44:34 +01:00
Matthias Clasen
13bfe188b5 Merge branch 'matthiasc/for-main' into 'main'
frameclock: Inline a few things

See merge request GNOME/gtk!6607
2023-11-25 00:04:57 +00:00
Matthias Clasen
f21175b3d0 frameclock: Inline a few things
There is no need to call type-checking getters in a loop.
2023-11-24 17:53:34 -05:00
Carlos Garnacho
d78475372f gtk: Obey GTK grabs on DnD events
Make DnD events get directed to the right places (and most
importantly, not to the wrong places) when happening over
modal parts of the UI.

Fixes DnD started from popovers being able to drop on their
modal toplevel.
2023-11-24 23:37:20 +01:00
Carlos Garnacho
988b9de210 gdk/wayland: Pass surface-relative coordinates in DnD events
Make this event behave like the other regular events, and emit
coordinates based on native surfaces. Fixes DnD over popovers
finding the correct coordinates.
2023-11-24 23:35:45 +01:00
Carlos Garnacho
0c19ef6c2c gdk/wayland: Improve recent serial lookup
This function takes an event, so the place(s) that do
not have one readily available can only pass NULL, so
the serial lookup will only work for the pointer.

Pass a device (plus optional sequence) to this function,
as these places do at least have the corresponding
GdkDevice at hand.

Fixes serial lookups for DnD, for other devices than
pointers (e.g. tablets, or touch).
2023-11-24 23:30:36 +01:00
Matthias Clasen
2bfd4a88d6 Fix some more static analysis warnings 2023-11-24 16:36:46 -05:00
Matthias Clasen
de3eeb4970 Merge branch 'docs_clarify_nested_lookup_tags' into 'main'
docs: Clarify that <lookup> tags can be nested.

See merge request GNOME/gtk!6606
2023-11-24 21:22:47 +00:00
Logan Rathbone
5c2e2977e0 docs: Clarify that <lookup> tags can be nested. 2023-11-24 15:52:32 -05:00
Logan Rathbone
24f3ec0949 docs: Clarify how to refer to instances created by <template> 2023-11-24 14:44:12 -05:00
Matthias Clasen
bcab0e4254 Merge branch 'none-bitfield' into 'main'
gdk-enums: Add GDK_NO_MODIFIER_MASK

See merge request GNOME/gtk!6602
2023-11-24 18:33:56 +00:00
Matthias Clasen
253955c017 Merge branch 'ebassi/docs-content-files' into 'main'
Add content_base_url to the docs project files

See merge request GNOME/gtk!6604
2023-11-24 18:19:06 +00:00
Maximiliano Sandoval R.
3a8834a437 gdk-enums: Add GDK_NO_MODIFIER_MASK 2023-11-24 18:04:56 +01:00
Emmanuele Bassi
48ea2ecac3 docs: Add content_base_url
Newer versions of gi-docgen support linking the rendered content files
to its source inside the repository, just like a symbol docblock.
2023-11-24 16:50:41 +00:00
Emmanuele Bassi
6d0b31128b docs: Update the user support information
The IRC channel is on Libera and there's a Matrix room.
2023-11-24 16:50:41 +00:00
Emmanuele Bassi
0b519bc353 docs: Clarify title of the Initialization content file 2023-11-24 16:50:41 +00:00
Emmanuele Bassi
bb756b35a2 docs: Remove duplicate titles 2023-11-24 16:50:41 +00:00
Emmanuele Bassi
7ba7ab1e3d docs: Fix links to the 2.x to 4 migration guide
The GTK3 migration guide is on docs.gtk.org, these days; and the
3.x to 4 migration guide is in the same location as this file.
2023-11-24 16:50:41 +00:00
Emmanuele Bassi
f73a7e29ca docs: Use consistent style for content metadata 2023-11-24 16:50:41 +00:00
Emmanuele Bassi
2eb6e3d4c5 docs: Clean up the key value content file
Use a more descriptive title, add links to the API, add code elements,
and align the text a bit better.
2023-11-24 16:50:41 +00:00
Matthias Clasen
b28cf76f11 Merge branch 'matthiasc/for-main' into 'main'
Matthiasc/for main

See merge request GNOME/gtk!6603
2023-11-24 16:09:19 +00:00
Matthias Clasen
36314f28e2 gsk: Some more rect inlining 2023-11-24 10:35:57 -05:00
Matthias Clasen
b7a1b1d7ee Fix some static analysis warnings 2023-11-24 10:35:57 -05:00
Matthias Clasen
57e382b59c Merge branch 'sumibi-yakitori/fix-mouse-cursor-on-macos' into 'main'
macos: Change to send motion events to NSApp

Closes #6134

See merge request GNOME/gtk!6451
2023-11-24 13:06:53 +00:00
Matthias Clasen
a35a885902 Merge branch 'file-launcher-writable' into 'main'
file laucher: Add a writable property

Closes #4247

See merge request GNOME/gtk!6600
2023-11-23 00:13:19 +00:00
Matthias Clasen
5fa3a2a39f file laucher: Add a writable property
If GtkFileLauncher:writable is TRUE, we ask the openuri portal
to make the file writable for the handler that it launches.

Fixes: #4247
2023-11-22 17:43:10 -05:00
Matthias Clasen
7f53b3d3f4 openuri portal: Introduce flags 2023-11-22 17:30:37 -05:00
Matthias Clasen
9b25257cbf Merge branch 'matthiasc/for-main' into 'main'
Address various static analysis complaints

See merge request GNOME/gtk!6598
2023-11-22 11:49:57 +00:00
Matthias Clasen
a90a6c4517 Address various static analysis complaints
These were picked out of the scan_build logs in ci.
2023-11-22 00:07:47 -05:00
Matthias Clasen
e69f062c99 Merge branch 'testsuite-leaks' into 'main'
testsuite: Don't leak so much

See merge request GNOME/gtk!6597
2023-11-22 04:48:42 +00:00
Matthias Clasen
210c7f25ad testsuite: Leak even less
A memory leak spotted by asan.
2023-11-21 23:21:55 -05:00
Matthias Clasen
9695791f7b testsuite: Don't leak so much
My subsurface attach code was leaking all the nodes. Oops.
2023-11-21 23:21:55 -05:00
Matthias Clasen
ca0da0dd83 Merge branch 'matthiasc/for-main' into 'main'
ci: Run less tests

See merge request GNOME/gtk!6596
2023-11-22 03:41:15 +00:00
Matthias Clasen
5a8a839921 ci: Run less tests
Our test setups are mostly about varying the rendering environment
(different backends, or renderers, etc). Therefore, we don't need
to duplicate the runs of the css or node parser or path tests.
Just run the gdk and gsk-gl tests under all setups.
2023-11-21 22:20:47 -05:00
Matthias Clasen
eb84171cda Merge branch 'testsuite-improvements' into 'main'
ci: Tweak the run-tests script

See merge request GNOME/gtk!6587
2023-11-21 19:31:15 +00:00
Benjamin Otte
5608a8978e Merge branch 'picture-integral-size' into 'main'
picture: Keep paintable size integral

See merge request GNOME/gtk!6593
2023-11-21 19:30:53 +00:00
Matthias Clasen
efefdbd5c0 Merge branch 'no-fractional-offload' into 'main'
wayland: Don't offload with fractional scales

See merge request GNOME/gtk!6592
2023-11-21 19:28:03 +00:00
Matthias Clasen
6bea059424 Merge branch 'subsurface-api-tweaks' into 'main'
subsurface: Replace place_above/below

See merge request GNOME/gtk!6595
2023-11-21 18:52:07 +00:00
Matthias Clasen
c99c06f0da wayland: Careful offloading with fractional scales
Sadly, subsurface positioning is undefined in this case. We'll
trust the compositor to not mess up if the device coordinates
after applying the scale are integral, but otherwise, we'll
decline.
2023-11-21 13:47:10 -05:00
Matthias Clasen
bda8f5393d wayland: Allow attaching (some) non-opaque textures
Allow translucent textures when we are raising the subsurface.
2023-11-21 13:24:04 -05:00
Matthias Clasen
160fa969d4 subsurface: Replace place_above/below
Instead, do it all in attach(), which becomes more and more like
ConfigureWindow. This is good, because it will let us take the
above-ness into account when making decisions about attaching.
2023-11-21 13:24:04 -05:00
Benjamin Otte
edf33a6617 Merge branch 'wip/otte/for-main' into 'main'
subsurface: Don't marka failure as success

See merge request GNOME/gtk!6594
2023-11-21 17:01:54 +00:00
Benjamin Otte
86587a9328 subsurface: Don't marka failure as success
There was one branch in the success case that turned it into a failure,
yet we were still reporting a success (and discarding the buffer).

Don't do that.
2023-11-21 17:31:40 +01:00
Matthias Clasen
8691d471d0 picture: Keep paintable size integral
Without this, offloading is very hit-and-miss, since you need
to hit the few size combinations where you get an exact integral
size when preserving the aspect ratio.
2023-11-21 11:14:15 -05:00
Matthias Clasen
463b6dd1fd Merge branch 'egl-device-info' into 'main'
EGL: Print out the device info

See merge request GNOME/gtk!6590
2023-11-21 05:04:35 +00:00
Matthias Clasen
88e1f77f90 EGL: Print out the device info
This may become more relevant info, with dmabuf formats being
tied to specific devices.
2023-11-20 23:40:00 -05:00
Matthias Clasen
1ee488f445 Merge branch 'matthiasc/for-main' into 'main'
wayland: Move subsurface creation code

See merge request GNOME/gtk!6589
2023-11-21 00:04:02 +00:00
Matthias Clasen
eae0e15b9d wayland: Move subsurface creation code
This belongs with all the other subsurface handling.
2023-11-20 18:01:09 -05:00
Matthias Clasen
00d551bda8 Merge branch 'drop-legacy-gl' into 'main'
Drop the gl-legacy debug value

See merge request GNOME/gtk!6585
2023-11-20 13:31:27 +00:00
Matthias Clasen
2dcec44714 Drop the nograbs debug value
This was only used in the x11 backend, and I haven't seen it
actively recommended for debugging anything in ages.
2023-11-20 08:02:03 -05:00
Matthias Clasen
f04c819439 Drop the gl-legacy debug value
The consensus is that we can do without this.
2023-11-20 08:02:02 -05:00
Matthias Clasen
c679ba9ebf wip: ci: rework the test runs 2023-11-19 21:26:04 -05:00
Matthias Clasen
9aadc2b860 ci: Tweak the run-tests script
The main change here is to pass the suite to run as an explicit
argument. This is in preparation for running less tests.
2023-11-19 21:26:04 -05:00
Emmanuele Bassi
e4370cc95e Merge branch 'matthiasc/for-main' into 'main'
file dialog: Return an error if no file is selected

Closes #6139

See merge request GNOME/gtk!6586
2023-11-19 18:29:57 +00:00
Matthias Clasen
22ceb018fb file dialog: Return an error if no file is selected
This was brought as a problem for bindings in #6139.

Fixes: #6139
2023-11-19 12:46:56 -05:00
Matthias Clasen
833d307695 Merge branch 'default-to-gles' into 'main'
Use GLES by default

Closes #6170

See merge request GNOME/gtk!6520
2023-11-19 16:14:04 +00:00
Piotr Drąg
e8afb5e210 Update Polish translation 2023-11-19 15:34:46 +01:00
Matthias Clasen
b916c4dac1 ci: Reshuffle test setups
Add a wayland_gl setup that explicitly uses desktop GL, and rename
wayland_gles to wayland_gles2 (since that is what it does).

In ci, make the fedora-x86_64 runner run tests with wayland_gl
and wayland_gles2, and make the fedora-release runner run test
with wayland and x11.
2023-11-19 08:24:38 -05:00
Matthias Clasen
699c6d6159 Use GLES by default
With the advent of dmabuf support, using GLES has become more
attractive, since we can use its external texture support to
support more dmabuf formats.

You can go back to the previous preference order by setting

    GDK_DEBUG=gl-prefer-gl
2023-11-19 08:07:03 -05:00
Matthias Clasen
025b846fce Add a debug value to prefer desktop GL
This will be used in the next commit, when we change the default
preference to be GLES.
2023-11-19 08:07:02 -05:00
Matthias Clasen
fcdbab3f69 gl: Tweak debug values for GL api selection
Replace GDK_DEBUG=gl-gles with GDK_DEBUG=gl-disable-gl, and add
a GDK_DEBUG=gl-disable-gles to match.
2023-11-19 08:07:02 -05:00
Matthias Clasen
d7eac7a6ad Merge branch 'cssselector-alloc' into 'main'
css: Don't allocate needlessly while processing selectors

See merge request GNOME/gtk!6584
2023-11-19 12:46:57 +00:00
Matthias Clasen
52dbb3f372 css: Don't allocate needlessly while processing selectors
The recursive subdivide_info function works by soring the
selector infos it gets into 2 (or 3) buckets: exact matches,
matches, and remaining. Then it recurses on the matches and
remaining buckets. This can be done without allocating extra
arrays, by sorting the given array in the right way.

This needs some serious testing.

Fixes: #6583
2023-11-18 18:12:10 -05:00
Piotr Drąg
7dc38ca12f Update Polish translation 2023-11-18 17:15:18 +01:00
Matthias Clasen
e858924d03 Merge branch 'matthiasc/for-main' into 'main'
inspector: Update the logging tab

See merge request GNOME/gtk!6581
2023-11-18 15:26:33 +00:00
Matthias Clasen
852aab1576 inspector: Update the logging tab
There's two new values here, Dmabuf and Offload.
2023-11-18 09:54:43 -05:00
Matthias Clasen
5eb42815ed Merge branch 'subsurface-aboveness' into 'main'
offload: Keep was-raised for each subsurface

Closes #6214

See merge request GNOME/gtk!6580
2023-11-18 13:42:27 +00:00
Luca Bacci
0b853f62ed Merge branch '6203_gdk_win32_precalculate_keymap' into 'main'
GdkWin32: precalculate keymap at display opening

Closes #6203

See merge request GNOME/gtk!6566
2023-11-18 13:24:21 +00:00
Matthias Clasen
fb969f5431 offload: Raise all subsurfaces that can be
If two subsurfaces don't overlap and aren't otherwise obstructed,
we can just raise them  both.

Tests included.
2023-11-18 08:19:43 -05:00
Matthias Clasen
ef6ed31853 offload: Drop unused api 2023-11-18 08:19:43 -05:00
Matthias Clasen
c57245b73c diff: Take above-ness into account
We need to include the full area if a subsurface
above-ness changes, since we only punch holes if
it is above.

Fixes: #6214
2023-11-18 08:19:43 -05:00
Matthias Clasen
f9fd78b67e offload: Keep was-raised for each subsurface
We need this information for proper diffing.
2023-11-18 08:19:43 -05:00
Matthias Clasen
00a63a9fcf offload tests: Fix the simple test
This was expecting the wrong 'above'. Oops.
2023-11-18 08:19:43 -05:00
Matthias Clasen
b4ae2377b3 offload tests: Make --verbose work
When passing a directory via G_TEST_SRCDIR, still pay attention
to --verbose, and print out each file thats tests. This lets us
quickly pin down which test fails.
2023-11-18 08:19:43 -05:00
Matthias Clasen
392977d670 offload tests: fix output 2023-11-18 08:18:29 -05:00
Matthias Clasen
5a29e2704c Merge branch 'dmabuf-separate-alpha-formats' into 'main'
dmabuf: Add support for separate alpha formats

See merge request GNOME/gtk!6571
2023-11-18 07:41:44 +00:00
Matthias Clasen
ec6c52680e Merge branch 'michaelweghorn/a11y_align_paragraph_super_role_with_aria' into 'main'
a11y: Align paragraph's super role with ARIA

See merge request GNOME/gtk!6579
2023-11-17 12:02:53 +00:00
Sveinn í Felli
d850161b2f Update Icelandic translation
(cherry picked from commit e608a18043)
2023-11-17 10:36:10 +00:00
Michael Weghorn
1a3504469d a11y: Align paragraph's super role with ARIA
As the commit message in

    commit 9f078bd5c9
    Author: Michael Weghorn <m.weghorn@posteo.de>
    Date:   Mon Sep 25 10:41:42 2023 +0200

        a11y: Add paragraph role

already says, the super role of the paragraph role
in ARIA is the section role [1]. But then, that commit
accidently set the structure role for the super role,
so fix that now.

[1] https://www.w3.org/TR/wai-aria-1.2/#paragraph
2023-11-17 07:46:55 +01:00
Matthias Clasen
be0546bb39 testdmabuf: Support a separate-alpha format
This helps with verifying the support for these formats
in gdkdmabuf.c.
2023-11-16 20:54:16 -05:00
Matthias Clasen
d4a569057f Cosmetics: Typo fix 2023-11-16 20:54:15 -05:00
Matthias Clasen
c5727df568 dmabuf: Add support for separate alpha formats
Support dmabuf formats with alpha in a separate plane.

Related: #6208
2023-11-16 20:53:52 -05:00
Benjamin Otte
7406cea257 Merge branch 'wip/otte/for-main' into 'main'
wayland: Don't create a new wl_buffer if the texture didn't change

See merge request GNOME/gtk!6577
2023-11-16 23:54:57 +00:00
Benjamin Otte
de3f55fc5f testdmabuf: Use Vulkan to create dmabufs
This is somewhat hacky, but good enough for testing.

And it's definitely better than needing to chmod files owned by root.
2023-11-17 00:22:27 +01:00
Benjamin Otte
010ff81b2f wayland: Don't create a new wl_buffer if the texture didn't change
Avoids flickering in Mutter - which is probably a mutter bug.

But it also reduces traffic, so it's a good thing anyway.
2023-11-17 00:22:27 +01:00
Matthias Clasen
c94ec8b658 Merge branch 'michaelweghorn/bump_version' into 'main'
Bump version in meson.build to 4.13.4

See merge request GNOME/gtk!6574
2023-11-16 19:04:59 +00:00
Michael Weghorn
9c1ae5374d Bump version in meson.build to 4.13.4
... as commit 3a88522a19 did
for the NEWS file after the 4.13.3 release
(tag "4.13.3", commit 358cd28d09).
2023-11-16 17:02:44 +01:00
Matthias Clasen
4a018de0a1 Merge branch 'michaelweghorn/a11y_add_blockquote_role' into 'main'
a11y: Add block quote role

See merge request GNOME/gtk!6539
2023-11-16 14:25:01 +00:00
Matthias Clasen
23e50bb21d Merge branch 'main' into 'main'
Fix warnings when compiling with -pedantic

See merge request GNOME/gtk!6570
2023-11-15 23:00:41 +00:00
madmurphy
a8e3e747df Fix warnings when compiling with -pedantic 2023-11-15 23:00:41 +00:00
Matthias Clasen
7fd90853f8 Merge branch 'matthiasc/for-main' into 'main'
video: Hide controls and cursor in fullscreen

Closes #6210

See merge request GNOME/gtk!6572
2023-11-15 20:46:38 +00:00
Matthias Clasen
01aa4989f8 Merge branch 'wip/wjt/gtkgraphicsoffload-docs-typo' into 'main'
gtkgraphicsoffload: fix documentation typo

See merge request GNOME/gtk!6573
2023-11-15 20:46:15 +00:00
Will Thompson
d4fee23ff6 gtkgraphicsoffload: fix documentation typo 2023-11-15 19:45:17 +00:00
Matthias Clasen
b878949f00 video: Hide controls and cursor in fullscreen
Be a bit more aggressive about hiding the controls, and also
hide the cursor if we are paying a video and are fullscreen.

Fixes: #6210
2023-11-15 14:24:39 -05:00
Matthias Clasen
3a88522a19 Post-release version bump 2023-11-15 10:07:50 -05:00
Matthias Clasen
358cd28d09 4.13.3 2023-11-15 09:44:44 -05:00
Matthias Clasen
6eb6b0cb50 Cosmetics: typo fix 2023-11-15 06:45:52 -05:00
Matthias Clasen
c81954120a Merge branch 'fix-giodesktopappinfo-check' into 'main'
Revert "Conditional check for gdesktopappinfo header"

See merge request GNOME/gtk!6568
2023-11-15 05:13:08 +00:00
Matthias Clasen
4bdc44f4af Revert "Conditional check for gdesktopappinfo header"
This reverts commit 13b94dab10.

As pointed out in #6557, this commit is broken and causes
gio/gdesktopappinfo.h to never be found.
2023-11-14 23:45:17 -05:00
Matthias Clasen
3ab7b2d7ce Merge branch 'va-fixes-reported-by-pvs' into 'main'
Fix issues spotted by PVS-Studio

See merge request GNOME/gtk!6558
2023-11-15 00:27:08 +00:00
Matthias Clasen
429056c214 Merge branch 'wip/otte/for-mclasen' into 'main'
gl: Don't punch hole if the subsurface is above

See merge request GNOME/gtk!6567
2023-11-15 00:26:45 +00:00
Benjamin Otte
acecf519bc offload: Reject non-integer rectangles
We shouldn't just fudge with coordinates if we want accurate rendering.
2023-11-14 21:55:10 +01:00
Benjamin Otte
b2fbdcda41 subsurface: Report better error messages when rejecting textures 2023-11-14 21:54:38 +01:00
Benjamin Otte
1b08fda93e renderer: Remove offload argument from render()
It turns out it's not needed, because all relevant information for
subsurfaces is already available by querying the subsurface itself.
2023-11-14 21:54:35 +01:00
Benjamin Otte
f6b6176ec0 gl: Handle subsurfaces without GskOffload 2023-11-14 21:51:07 +01:00
Luca Bacci
2803189afd Merge branch 'gdkwin32_modernize_clipboard' into 'main'
GdkWin32: switch to new clipboard API

Closes #442

See merge request GNOME/gtk!6560
2023-11-14 20:09:55 +00:00
g.willems
ad08c1444a win32: precalculate keymap at display opening
The default keymap and keymap layouts are calculated on request.
If done once a surface is setup and listening at win32 events,
we may then enter in a recursive loop.
To avoid this, precalculate the keymap as soon as displays are open.

Fixes #6203
Closes #6203
2023-11-14 20:26:05 +01:00
Benjamin Otte
ef77a6fa73 gl: Don't punch hole if the subsurface is above
Saves some work.
2023-11-14 20:22:24 +01:00
Matthias Clasen
667f02ecd8 Merge branch 'matthiasc/for-main' into 'main'
Updates

See merge request GNOME/gtk!6562
2023-11-14 17:49:04 +00:00
Benjamin Otte
160f632668 Merge branch 'wip/otte/for-main' into 'main'
renderer: Remove priv->root_node

See merge request GNOME/gtk!6565
2023-11-14 14:43:47 +00:00
Benjamin Otte
653bf46494 offload: Refactor texture finding
It's the same code, but with way more debose debug messages.
2023-11-14 15:04:38 +01:00
Benjamin Otte
46d4c70cd7 offload: Only print one debug message
... when failing to create the wl_buffer.
2023-11-14 15:04:38 +01:00
Benjamin Otte
4920ac4a57 offload: Move a debug message
If we fail to attach a buffer, we don't want to print this.
2023-11-14 15:04:38 +01:00
Benjamin Otte
5bdc9f71fd renderer: Remove priv->root_node
It's not used anywhere.
2023-11-14 15:04:38 +01:00
Benjamin Otte
c92761b184 Merge branch 'wip/otte/for-main' into 'main'
Add a debug node for CSS outlines

See merge request GNOME/gtk!6564
2023-11-14 13:39:38 +00:00
Benjamin Otte
9185f15cd9 renderer: Add a supports_offload flag
This flag must be set when creating the class or offloading
will be disabled for this renderer.

Set that flag for the GL renderer.

Fixes the Cairo and Vulkan renderer not showing Video.
2023-11-14 13:06:05 +01:00
Benjamin Otte
efec30babb renderer: Don't crash with offload disabled 2023-11-14 13:06:05 +01:00
Benjamin Otte
190e7da317 wayland: Don't g_warning() on expected error
Print a GDK_DEBUG() message instead.
2023-11-14 13:06:05 +01:00
Benjamin Otte
28d38cd730 Add a debug node for CSS outlines
All the other CSS render operations have one, so outlines should, too.

This was found by tracking down a random border node in a rendering.
2023-11-14 13:06:05 +01:00
Michael Weghorn
d7a72493ae a11y atspi: Map GTK_ACCESSIBLE_RELATION_{COL,ROW}_INDEX_TEXT to AT-SPI
Map GTK_ACCESSIBLE_RELATION_COL_INDEX_TEXT and
GTK_ACCESSIBLE_RELATION_ROW_INDEX_TEXT to the
corresponding AT-SPI object attributes
"colindextext" and "rowindextext", as it is specified
e.g. in the Core Accessibility Mappings 1.2 for the
corresponding attributes [1] [2].

Orca makes use of these object attributes in web browsers
and since recently also for LibreOffice [3] and is
planning to use that more globally.

[1] https://www.w3.org/TR/core-aam-1.2/#ariaColIndexText
[2] https://www.w3.org/TR/core-aam-1.2/#ariaRowIndexText
[3] 3c056cd7b5
2023-11-14 12:18:47 +01:00
Benjamin Otte
7299c9baa9 Merge branch 'andyholmes/get-default-size' into 'main'
gtk: fix NULL pointer dereference

See merge request GNOME/gtk!6559
2023-11-14 11:08:53 +00:00
Andrey Kutejko
540a83327f Fix issues spotted by PVS-Studio 2023-11-14 08:56:40 +01:00
Matthias Clasen
04d41eaa66 Updates 2023-11-13 23:53:24 -05:00
Matthias Clasen
524d681496 Merge branch 'dmabuf-passthrough' into 'main'
dmabuf passthrough

Closes #6132

See merge request GNOME/gtk!6533
2023-11-14 03:20:12 +00:00
Matthias Clasen
44d977844b testsuite: Add offload tests
These tests come in two variants.

The first takes .node and .offload file, parses the node file,
and compares the resulting subsurface attachments to expected results.

The second variant takes two .node/.offload file pairs and a .diff
file, parses the node files, compares the resulting subsurface
attachments, and then diffs the nodes, comparing the resulting
area to the region in the .diff file.
2023-11-13 18:41:53 -06:00
Matthias Clasen
6259800f5a Merge branch 'matthiasc/for-main' into 'main'
gsk: Robustness fix

See merge request GNOME/gtk!6561
2023-11-13 23:36:58 +00:00
Matthias Clasen
d3a5aa5304 testdmabuf: Use GtkGraphicsOffload 2023-11-13 22:27:51 +01:00
Matthias Clasen
d32ab7544d gtk-demo: Enable offload in the video player 2023-11-13 22:27:51 +01:00
Matthias Clasen
e2e7c931c5 gtk: Use GtkGraphicsOffload in GtkVideo
Video playback is one of the main use cases for graphics offload,
so it makes a lot of sense to do it in GtkVideo.
2023-11-13 22:27:51 +01:00
Matthias Clasen
e202348380 gtk: Add GtkGraphicsOffload
This is new widget that will attempt to pass through the content
of its child via a subsurface. This is mostly meant for internal
use, but the minimal api is available.
2023-11-13 22:27:51 +01:00
Matthias Clasen
ba5403da17 gtk: Add gtk_snapshot_push_subsurface
This is currently private api.
2023-11-13 22:17:36 +01:00
Matthias Clasen
904d44074f gsk gl: Handle subsurfaces during rendering
During rendering, restack offloaded subsurfaces below the main
surface, and clear the area so they peek through. After rendering,
raise the last subsurface if we haven't drawn over it.
2023-11-13 22:17:36 +01:00
Matthias Clasen
c636baf6f5 gsk gl: Make it possible to clear a rectangle
Add a blend mode to the draw command, so it can draw transparent
black. This will be used to erase the area on top of a subsurface
when we do passthrough.
2023-11-13 22:17:36 +01:00
Matthias Clasen
b7c2528ad1 gsk: Prepare subsurface offload
Use a GskOffloadInfo to update subsurfaces (and collect info about
them). Pass that info to both the diff and the render vfuncs.
2023-11-13 22:17:36 +01:00
Matthias Clasen
48740de71a gsk: Add a subsurface mode to node diffing
Add an extra argument to pass offload info to the diffing code.
This is then used for diffing subsurface nodes differently,
depending on their offloading status.
2023-11-13 22:17:35 +01:00
Matthias Clasen
34c16b0df2 gsk: Add code to offload to subsurfaces
This code walks the node tree, finds subsurface nodes, determines
if we can offload to the subsurface, and if yes, does so. This
isn't used yet.
2023-11-13 22:17:35 +01:00
Matthias Clasen
d0a675ab01 gsk: Add subsurface nodes
Also show them in the inspector recorder, with some information.
2023-11-13 22:17:35 +01:00
Matthias Clasen
0e0bf8ed47 gsk: Add a debug flag for graphics offload
Add GSK_DEBUG=offload-disable to disable graphics offload via
attaching of dmabufs to subsurfaces. This is not used anywhere yet.
2023-11-13 22:17:35 +01:00
Matthias Clasen
00d7d4b17b wayland: Implement empty_frame in draw contexts 2023-11-13 22:17:35 +01:00
Matthias Clasen
9eef566b54 gdk: Introduce empty frames in GdkDrawContext
We need a way to commit pending subsurface changes, even when no
drawing happened for the frame. empty_frame() is that way.
2023-11-13 22:17:35 +01:00
Matthias Clasen
272168c94b inspector: Add a subsurface overlay
We have to be careful to not draw over the subsurface area with
our highlighting, otherwise this would interfere with raising
unobstructed subsurfaces.
2023-11-13 22:17:35 +01:00
Matthias Clasen
ca054bfdc9 wayland: Request frame callbacks on subsurfaces
We need this for the case when the subsurface completely covers
up the main surface. Without it, we just stop updating.
2023-11-13 22:17:35 +01:00
Matthias Clasen
59dbfb0843 wayland: Implement subsurface api
This is not used anywhere yet.
2023-11-13 22:17:35 +01:00
Matthias Clasen
223e27e7dc gdk: Add private subsurface api
Add api to allow creating subsurfaces, attaching textures to them,
and changing the stacking order.

This is just the api, there is no implementation yet.
2023-11-13 22:17:35 +01:00
Matthias Clasen
efe1415429 gdk: Add a debug flag for subsurfaces
You can now use GDK_DEBUG=offload to get debug spew about
subsurfaces and graphics offload.
2023-11-13 22:17:35 +01:00
Matthias Clasen
489723916d wayland: Get format info for dmabufs
For now, all we do with it is dump the formats if you
set GDK_DEBUG=misc. In the future, this will be used
when attaching dmabufs to subsurfaces.
2023-11-13 22:17:35 +01:00
Matthias Clasen
e8894ad383 gsk: Robustness fix
I was seeing empty regions being passed as scissor.
2023-11-13 22:17:35 +01:00
Matthias Clasen
9423d6261a gtk: Use some more inline helpers 2023-11-13 22:17:35 +01:00
Matthias Clasen
b766f92026 gsk: Use some more inline helpers 2023-11-13 22:17:35 +01:00
Matthias Clasen
a37aacf4e4 Add another inline rect helper 2023-11-13 22:17:35 +01:00
Matthias Clasen
93959ef7df gsk: Robustness fix
I was seeing empty regions being passed as scissor.
2023-11-13 22:16:07 +01:00
Matthias Clasen
209a1a69cc gtk: Use some more inline helpers 2023-11-13 22:15:57 +01:00
Matthias Clasen
982f965ea8 gsk: Use some more inline helpers 2023-11-13 22:15:45 +01:00
Matthias Clasen
f7fc90daa0 Add another inline rect helper 2023-11-13 22:15:35 +01:00
g.willems
a58424588f win32: switch to new clipboard API
This is a backport of !1143 to gtk4.

SetClipboardViewer() API is obsolete is prone to clipboard chain breaks
from other applications.
Use recommended AddClipboardFormatListener() instead.

Fixes #442
2023-11-13 21:29:48 +01:00
Andy Holmes
f8c9b3394b gtk: fix NULL pointer dereference
`gtk_window_get_default_size()` claims width/height are optional-out
arguments, but defers to `gtk_window_get_remembered_size()` which
may dereference a NULL-pointer.

Since `gtk_window_get_remembered_size()` is only called by
`gtk_window_get_default_size()`, collapse it into the latter
and perform the NULL check there.
2023-11-13 12:05:31 -08:00
Benjamin Otte
ce4d8cc6d9 Merge branch 'wip/otte/tree-indent' into 'main'
theme: Halve indentation of trees

See merge request GNOME/gtk!6553
2023-11-13 16:16:38 +00:00
Matthias Clasen
c85766ac71 Merge branch 'matthiasc/for-main' into 'main'
dmabuf: Add a debug message for format fallback

See merge request GNOME/gtk!6556
2023-11-12 12:59:22 +00:00
Matthias Clasen
b24ae31716 dmabuf: Improve consistency of debug messages
Make sure all our dmabuf debug messages are display-scoped so the
inspector doesn't trigger them, use the same formatting throughout,
and improve consistency of wording here and there.
2023-11-12 13:02:58 +01:00
Matthias Clasen
7cf805c8b3 dmabuf: Add a debug message for format fallback
This may be helpful in pinpointing why a dmabuf format behaves
unexpectedly.
2023-11-12 11:24:37 +01:00
Matthias Clasen
1f62c693cd Merge branch 'nv12-opaque' into 'main'
dmabuf: NV12 is opaque

See merge request GNOME/gtk!6555
2023-11-11 23:47:59 +00:00
Matthias Clasen
6ae9cbfe0f dmabuf: NV12 is opaque
Getting this wrong matters, since we won't offload textures in
non-opaque formats. Found by Robert Mader. At the same time,
unify the two places we have for mapping from fourcc to memory
format.
2023-11-11 23:56:01 +01:00
Benjamin Otte
7803aad872 theme: Halve indentation of trees
Deep trees quickly add so much empty space on the left, so that it gets
really hard to read after an indentation level of ~10.

By halving, we still keep the visual clarity of indenting but we can now
handle twice as many indentation levels, ie ~20.

It is what sysprof has been using, and it also feels right in the
inspector.
2023-11-11 10:34:57 +01:00
Ekaterine Papava
cc2d3fa7d6 Update Georgian translation 2023-11-09 09:41:14 +00:00
Benjamin Otte
a9e4993184 Merge branch 'wip/otte/enable-debug' into 'main'
Remove G_ENABLE_DEBUG around debug checks

See merge request GNOME/gtk!6546
2023-11-07 15:12:11 +00:00
Benjamin Otte
33703bfe01 Merge branch 'wip/otte/for-main' into 'main'
dmabuf: Set same YUV colorspace as elsewhere

See merge request GNOME/gtk!6548
2023-11-07 05:11:10 +00:00
Benjamin Otte
7ba5cf5309 inspector: Add more info about GL
Print all the variables queryable via glGetString().

And remove them from the Windows backend.
2023-11-07 05:33:48 +01:00
Benjamin Otte
bb890f6004 inspector: Don't list unused EGL extension
We don't use that extension and I don't even know what it is about -
which is a good reason to get rid of showing it.
2023-11-07 05:12:57 +01:00
Benjamin Otte
1c7a0e7a15 inspector: Use right name for Vulkan validation layer
The name got changed a while ago, so let's reflect that.
2023-11-07 05:12:57 +01:00
Benjamin Otte
cd7e1c1387 dmabuf: Modify gdk_gl_context_import_dmabuf()
Move a bunch of code - namely the target selection - into the function.

I want to use the same code in the NGL renderer, so no need to duplicate
it.
2023-11-07 05:12:57 +01:00
Benjamin Otte
a2e1e727c5 testsuite: Make texture-scale-magnify tests have roundable numbers
Use a number that's 2^N * 255 to get floating point awesomeness combined
with uint8_t awesomeness.

Fixes rounding errors in samplers.
2023-11-07 05:12:57 +01:00
Benjamin Otte
61207f81c3 dmabuf: Set same YUV colorspace as elsewhere
We use ITU.601 full range everywhere, so ensure it's used here, too.
2023-11-07 05:12:57 +01:00
Benjamin Otte
f624586a75 testsuite: Don't skip test
The test now works without debugging as debug messages are always
available.
2023-11-05 11:16:23 +01:00
Benjamin Otte
1a93967e1f gdk: Remove debug modes in gdk_debug_parse_var()
Always support all variables.
2023-11-05 11:16:23 +01:00
Benjamin Otte
310ab7b531 Remove G_ENABLE_DEBUG around debug checks
It started out as busywork, but it does many separate things. If I could
start over, I'd take them apart into multiple commits:

1. Remove G_ENABLE_DEBUG around GDK_DEBUG_*() calls
   This is not needed at all, the calls themselves take care of it.

2. Remove G_ENABLE_DEBUG around profiling code
   This now enables profiling support in release builds.

3. Stop poking _gdk_debug_flags and use GDK_DEBUG_CHECK()
   This was old code that was never updated.

4. Make !G_ENABLE_DEBUG turn off GDK_DEBUG_CHECK()
   The code used to
     #define GDK_DEBUG_CHECK(...) false
     #define GDK_DEBUG(...)
   which would compile away all the code inside those macros. This
   means a lot of variable definitions and debug utility functions
   would suddenly no longer be used and cause compiler errors.
2023-11-05 11:16:23 +01:00
Benjamin Otte
d55801c8ba debug: Turn gdk_debug_message() into a function
1. MSVC can't deal with the nonstandard ##__VA_ARGS__

2. It allows setting a breakpoint on it.
2023-11-05 10:21:54 +01:00
Matthias Clasen
b1809bfd88 Merge branch 'matthiasc/for-main' into 'main'
print dialog: Improve local fallback

See merge request GNOME/gtk!6547
2023-11-04 23:20:53 +00:00
Matthias Clasen
deb8a35ea0 print dialog: Improve local fallback
We need to set embed-page-setup for the paper size and orientation
combos to work.
2023-11-05 01:00:39 +02:00
Jordi Mas i Hernandez
c5ce24c82c Update Catalan translation 2023-11-04 18:28:38 +00:00
Artur S0
54815e4771 Update Russian translation 2023-11-04 02:09:09 +00:00
Matthias Clasen
5a99790a87 Merge branch 'examples-gtk-widget-show' into 'main'
docs: Replace deprecated gtk_widget_show with gtk_widget_set_visible

See merge request GNOME/gtk!6538
2023-11-03 15:29:39 +00:00
Matthias Clasen
8aa7174bfb Merge branch 'faster-fps-overlay' into 'main'
inspector: Speed up the fps overlay

See merge request GNOME/gtk!6544
2023-11-01 22:44:44 +00:00
Benjamin Otte
9df5e3cbd6 inspector: Replace "no glyph" with space glyph
This makes right-aligning the text work again.
2023-11-01 21:57:56 +01:00
Benjamin Otte
8b5194c016 inspector: Use the right font for the fps overlay
Initialize the font only when we have a widget that provides it. That
way we don't pick a terrible default font, but the widget's preferred
one.
2023-11-01 21:32:55 +01:00
Matthias Clasen
9a63172cf5 Some minor fpsoverlay improvements
Avoid some allocations.
2023-11-01 14:45:57 -04:00
Matthias Clasen
3ade9ae184 inspector: Speed up the fps overlay
Do less work!
2023-11-01 14:00:42 -04:00
Benjamin Otte
76349ff6e5 Merge branch 'wip/otte/for-main' into 'main'
testsuite: Add render test for texture placement

See merge request GNOME/gtk!6543
2023-11-01 14:36:07 +00:00
Benjamin Otte
dd530b45e2 gstmediafile: Handle premultiplied alpha
1. Check GStreamer caps for premultiplied alpha and select
   GdkMemoryFormat accordingly

2. Set a GdkMemoryFormat for GL textures

Fixes the video in widget-factory being treated as premultiplied when it
isn't.
2023-11-01 08:01:27 +01:00
Benjamin Otte
00ce51472c testsuite: Add render test for texture placement
Make sure that texture nodes sample from the texture properly.
2023-11-01 08:01:27 +01:00
Matthias Clasen
b6bcbeae23 Merge branch 'matthiasc/for-main' into 'main'
inspector: Show more EGL extensions

See merge request GNOME/gtk!6542
2023-10-31 23:12:54 +00:00
Robert Ancell
cf86cc1184 docs: Use gtk_window_present instead of gtk_widget_set_visible 2023-11-01 10:54:33 +13:00
Matthias Clasen
b503b60a49 inspector: Show more EGL extensions
We care about these now.
2023-10-31 17:53:25 -04:00
Matthias Clasen
5850055b68 Merge branch 'progressbar_overflow_fix' into 'main'
GtkProgressBar: Fix: progress can overflow trough

See merge request GNOME/gtk!6445
2023-10-31 11:22:32 +00:00
Matthias Clasen
b224e66a9f Merge branch 'scale_overflow_fix' into 'main'
GtkScale: Fix: highlight can overflow trough

Closes #5751

See merge request GNOME/gtk!6444
2023-10-31 11:22:02 +00:00
Michael Weghorn
bbb0150383 a11y: Add block quote role
Add a new GTK_ACCESSIBLE_ROLE_BLOCK_QUOTE role
for block quotes/block quotations.

ARIA has a corresponding "blockquote" role as well. [1]

The role is used e.g. in document editors
like LibreOffice or web browsers like Firefox.

According to the ARIA spec (§ 5.2.8.4, [2]), the
blockquote role is among those that can be named by
the author, and the superclass role is section. [1]

Related change for LibreOffice making use of the new
role: [3]

[1] https://www.w3.org/TR/wai-aria-1.2/#blockquote
[2] https://www.w3.org/TR/wai-aria-1.2/#namefromauthor
[3] https://gerrit.libreoffice.org/c/core/+/158685
2023-10-31 09:33:06 +01:00
Robert Ancell
8aef682079 docs: Replace deprecated gtk_widget_show with gtk_widget_set_visible 2023-10-31 13:27:26 +13:00
Benjamin Otte
fe4b7a5159 Merge branch 'wip/otte/for-main' into 'main'
rendernode-tool: Add --undecorated to show command

See merge request GNOME/gtk!6537
2023-10-31 00:23:18 +00:00
Benjamin Otte
7ba4ba05e1 gl: Fix padding in icon library
The previous code would not pad the left side with the left column of
pixels but with the top row.

Test attached.
2023-10-31 00:50:00 +01:00
Benjamin Otte
85e1088171 gsk: Fix texture-scale node Cairo drawing
The code was interpreting x/y coordinates wrong sometimes and causing
things to not be drawn at the correct offset.

Testcase included.
2023-10-31 00:36:27 +01:00
Benjamin Otte
c1ed034367 rendernode: Use an exisiting function instead of reimplementing it 2023-10-31 00:36:27 +01:00
Benjamin Otte
cc3e25b163 testsuite: Be more resistant against rounding errors
Make a test use numbers that are less likely to cause rounding
issues in GPUs (read: use powers of 2).
2023-10-31 00:36:27 +01:00
Benjamin Otte
bdb3e345c8 testsuite: Add test for scaling texture-scale node
Finally figured out a way to test that a texture-scale node using
NEAREST that is upscaled using a transform node doesn't use NEAREST but
LINEAR.
2023-10-31 00:36:27 +01:00
Benjamin Otte
a30e9dcfeb testsuite: Add a test for nearest vs linear scales 2023-10-31 00:36:27 +01:00
Benjamin Otte
76007c4d09 rendernode-tool: Add --undecorated to show command
This is to get exactly just the rendernode drawn when testing, and not
any extra drawing code.
2023-10-31 00:36:27 +01:00
Matthias Clasen
020ef51cb0 Merge branch 'matthiasc/for-main' into 'main'
Revert "glcontext: Better debug spew"

See merge request GNOME/gtk!6536
2023-10-29 19:04:26 +00:00
Matthias Clasen
1914adc344 dmabuf: Don't check for image storage
I was wrong about this extension, and it isn't even a GL extension
to begin with, so revert all this.
2023-10-29 14:45:20 -04:00
Matthias Clasen
6e236b9459 Revert "gl context: Check for more GL extensions"
This reverts commit b8b5835fc6.
2023-10-29 14:44:46 -04:00
Matthias Clasen
11715760f9 Revert "glcontext: Better debug spew"
This reverts commit 30e14f73fa.
2023-10-29 14:44:29 -04:00
Matthias Clasen
f19c08ffda Merge branch 'add-view-grid-symbolic-icon' into 'main'
icons: Add view-grid-symbolic

Closes #6184

See merge request GNOME/gtk!6534
2023-10-29 15:32:27 +00:00
Kleis Auke Wolthuizen
d0f76b6ab4 widget-factory: Remove insert-image icon
This icon is already present in the hicolor icon theme.
2023-10-28 20:25:53 +02:00
Kleis Auke Wolthuizen
4c7206343a widget-factory: Remove view-grid-symbolic icon
No longer needed as it's included in the hicolor icon theme now.
2023-10-28 20:25:53 +02:00
Kleis Auke Wolthuizen
dfae2cb3a5 icons: Add view-grid-symbolic
This showed up as missing icon in the file chooser when used with
the hicolor icon theme.

Resolves: https://gitlab.gnome.org/GNOME/gtk/-/issues/6184
2023-10-28 20:05:27 +02:00
Matthias Clasen
de74d38039 Merge branch 'improve-msvc-force-include' into 'main'
MSVC builds: Improve build process (was: MSVC builds: Always enable items from msvc_recommended_pragmas.h)

See merge request GNOME/gtk!6114
2023-10-27 22:11:06 +00:00
Matthias Clasen
fb20542fcc Merge branch 'fix_name_computation' into 'main'
a11y: When using rule 2.E for computing accessible name, use it only if appropriate

See merge request GNOME/gtk!6495
2023-10-27 17:32:14 +00:00
Lukáš Tyrychtr
a26e289d5c Adjust tests 2023-10-26 09:44:59 +02:00
Lukáš Tyrychtr
892d3b9530 a11y: When using rule 2.E for computing accessible name, use it only if appropriate
We were using it in all cases, so, we were using it to compute descriptions,
and also for non-embedded controls. That was overriding descriptions
set, for example, in Gnome settings, and was causing the value of spinboxes
to be read multiple times.
2023-10-26 09:40:30 +02:00
Chun-wei Fan
8477dcfeff builds: Require -Zc:preprocessor for Visual Studio debug builds
This flag is actually required for the debugging code to successfully build,
so check that it is really there for debug-enabled Visual Studio builds.
2023-10-26 10:40:17 +08:00
Chun-wei Fan
25835afd9c MSVC Builds: Don't enable -utf-8 explicitly
We already require a Meson release that enables -utf-8 by default, so we don't
really need to explicitly enable it here.
2023-10-26 10:40:17 +08:00
Matthias Clasen
06dda4e12b Merge branch 'memory-format-swizzle-check' into 'main'
gl: Check all swizzle values

See merge request GNOME/gtk!6524
2023-10-26 02:38:35 +00:00
Chun-wei Fan
26edfe6d18 build: Add msvc_recommended_pragmas.h
We really always want to force-include msvc_recommended_pragmas.h to check for
things at compile time so that we can avoid stuff like missing includes or
attempting to return a value in a function that is supposed to have a
void-return-type.

The current problem is that, as indicated in the Visual Studio CI job, that we
couldn't locate msvc_recommended_pragmas.h during the build if GLib is built
as a subproject, and/or when msvc_recommended_pragmas.h is not in the paths
indicated by %INCLUDE%, meaning that the aforementioned issues would not be
caught by CI, which will then break builds on Visual Studio for people when
msvc_recommended_pragmas.h is found during their builds.

It would also be nice to be quiet from the warnings that we can really
disregard anyways.

So, add a copy of msvc_recommended_pragmas.h from GLib and update the build
files to look for it in build-aux/msvc, so that it can always be used during
the build, especially by the CI.
2023-10-26 10:38:14 +08:00
Matthias Clasen
4a749aee6e Fix swizzle values for some memory formats
For opaque formats with 3 channels, we should use the default
GL_ALPHA, but for opaque formats with an ignored 4th channel,
we must use GL_ONE.
2023-10-25 21:39:52 -04:00
Matthias Clasen
99a8417142 Merge branch 'add-bn-hi-po-translated' into 'main'
translated bn.po and hi.po

See merge request GNOME/gtk!6530
2023-10-25 16:34:19 +00:00
Matthias Clasen
20e2075a10 Merge branch 'allow-implicit-modifiers' into 'main'
Allow implicit modifiers

See merge request GNOME/gtk!6529
2023-10-25 02:52:49 +00:00
Matthias Clasen
d8c649b57f Merge branch 'matthiasc/for-main' into 'main'
dmabuf: No mipmaps for dmabuf textures

See merge request GNOME/gtk!6531
2023-10-25 02:43:19 +00:00
Matthias Clasen
bb2b8bf2c3 dmabuf: Refine the handling of implicit modifiers
If all formats with a given fourcc are external, treat the
fourcc with implicit modifiers as external too, following a
sugestion by Benjamin Otte.
2023-10-24 22:33:45 -04:00
Matthias Clasen
eb048c91be dmabuf: Allow implicit modifiers
Remove all the roadblocks we've put up to keep implicit modifiers
out. Our importing code already handles them as a signal that says
'No modifiers, please!'. Now we just hope for the best and pass
things along.

This is necessary since some drivers won't produce any explicit
modifiers.
2023-10-24 22:33:45 -04:00
Matthias Clasen
358779dfb2 dmabuf: No mipmaps for dmabuf textures
Calling glGenerateMipmap on imported dmabufs does not work, so
don't do it.
2023-10-24 22:03:31 -04:00
Matthias Clasen
8f90ddb906 dmabuf: Cache egl formats
Only call eglQueryDmaBufModifiersEXT once, and reuse the results.
2023-10-24 21:53:09 -04:00
Matthias Clasen
ed54aa8acf Merge branch 'matthiasc/for-main' into 'main'
Fix annotations

See merge request GNOME/gtk!6522
2023-10-24 15:04:16 +00:00
Matthias Clasen
a90ffb117f docs: Some additions
Add a link to the kernel docs about dmabufs.
2023-10-24 10:50:46 -04:00
Matthias Clasen
29681717ed Fix annotations
It is always org.gtk.Property, even if we are in gdk.
2023-10-24 07:16:42 -04:00
sudip
e0cd2b756f translated bn.po and hi.po
Resolves:https://gitlab.gnome.org/GNOME/gtk/-/issues/6164
2023-10-24 16:20:24 +05:30
Matthias Clasen
2c85060b5f Merge branch 'msvc-for-main' into 'main'
Few small fixes for Visual Studio builds

See merge request GNOME/gtk!6521
2023-10-24 10:44:22 +00:00
Chun-wei Fan
864c5b4608 testsuite: Disable dmabuftexture test on Windows
It's not meaningful there.
2023-10-24 14:08:16 +08:00
Chun-wei Fan
1ab501649e gsk/gskcurve.c: Avoid returning value in void-retype function
This is considered a compiler error with later GLib releases with Visual Studio
builds, so avoid that.
2023-10-24 13:18:26 +08:00
Benjamin Otte
2d874e601c Merge branch 'wip/otte/for-main' into 'main'
gl: Remove optimization that does the wrong thing

See merge request GNOME/gtk!6528
2023-10-24 02:51:02 +00:00
Benjamin Otte
c9b83dfa1d testsuite: Add a test for texture-scale filters
Check that the right filter is chosen and that that filter is
implemented correctly.

The test is disabled for Cairo because Cairo (or rather Pixman)
doesn't follow the filtering specifications for GL/Vulkan and in
particular the nearest filter picks a different pixel.
2023-10-24 01:41:25 +02:00
Benjamin Otte
dd7a38069f gl: Remove optimization that does the wrong thing
Drawing a texture-scale node like a texture node when the filter is set
to "linear" doesn't work, because the texture node switches to
trilinear when mipmaps are available.
2023-10-24 01:37:38 +02:00
Benjamin Otte
51a181af7a Merge branch 'wip/otte/for-main' into 'main'
dmabuf: Seek back to the start

See merge request GNOME/gtk!6526
2023-10-23 19:57:21 +00:00
Benjamin Otte
8fcd9bc0c4 gl: Make sure render_texture() sets the right format for high depth
Setting the format got lost when converting this coe to the texture
builder, because that codepaths avods the texture sniffing and always
uses RGBA8.
2023-10-23 21:22:17 +02:00
Benjamin Otte
e2edf693f5 gdk: Make float32 report its true depth
I have no idea how this is the only value that is wrong.
2023-10-23 21:22:17 +02:00
Benjamin Otte
323300e92a dmabuf: Seek back to the start
https://docs.kernel.org/driver-api/dma-buf.html recommends doing that,
so we do that.
2023-10-23 17:57:57 +02:00
Benjamin Otte
e688be1cff gdk: Add some debug messages around dmabuf initialization 2023-10-23 17:57:57 +02:00
Guillaume Bernard
611d5cf844 Update French translation
(cherry picked from commit 3b8c1189f4)
2023-10-23 15:22:29 +00:00
Matthias Clasen
677e78bdce gl: Check all swizzle values
There is no reason not check the alpha swizzle for being different
from its default value. I am thinking about implementing RGBx
upload with a swizzle of rgb1, and that would break here.
2023-10-23 07:55:39 -04:00
Matthias Clasen
51cb1aeb4e Merge branch 'matthiasc/for-main' into 'main'
Matthiasc/for main

See merge request GNOME/gtk!6519
2023-10-23 04:11:04 +00:00
Matthias Clasen
625eb508e8 dmabuftexturebuilder: Fix doc formatting 2023-10-22 23:24:46 -04:00
Matthias Clasen
2718e1715d display: Add details to the docs 2023-10-22 23:24:27 -04:00
Matthias Clasen
6ddcad6b33 dmabuf: Update a comment 2023-10-22 23:14:07 -04:00
Matthias Clasen
0c23997f70 Merge branch 'matthiasc/for-main' into 'main'
Cosmetics

See merge request GNOME/gtk!6518
2023-10-23 03:13:41 +00:00
Matthias Clasen
4d1ef63009 gsk: Ensure dmabuf formats are initialized
We just poking at display members here, there is no guarantee that
dmabuf formats have been initialized. So do it explicitly.

This prevents a crash in the inspector when viewing a recorded frame
containing a dmabuf texture, since the inspector uses a separate
display connection.
2023-10-22 22:48:18 -04:00
Matthias Clasen
30e14f73fa glcontext: Better debug spew
Print out all the extensions we checked.
2023-10-22 22:41:53 -04:00
Matthias Clasen
39e205aa78 dmabuf: Don't print unsupported formats
We were confusingly printing "supported format" for dmabuf formats
that we end up not adding to our list of supported formats. Don't
do that, it is confusing. At the same time, we shuold print out
the linear formats we support via mmap.
2023-10-22 22:29:44 -04:00
Matthias Clasen
f0ec1660c1 Make testdmabuf fall back to memfd
If we can't open /dev/dma_heap/system, fall back to using memfd_create.
It does not let us make a 'proper' dmabuf, but it is good enough to
test our handling of linear buffers in various formats.
2023-10-22 22:18:30 -04:00
Matthias Clasen
79f98f3a13 Cosmetics
Typo fix.
2023-10-22 22:18:30 -04:00
Benjamin Otte
5f0557027d Merge branch 'wip/otte/for-main' into 'main'
dmabuf: Add NV16, NV61, NV24 and NV42

See merge request GNOME/gtk!6517
2023-10-23 01:49:30 +00:00
Benjamin Otte
a579e3bc6d build: Fix up header includes
These weren't fixed in the merge request in
  https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6489
to the change from
  https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6514
2023-10-23 03:12:09 +02:00
Benjamin Otte
8f70f4b85e dmabuf: Add support for 3 plane YUV formats 2023-10-23 02:54:23 +02:00
Benjamin Otte
911198cddd dmabuf: Add NV16, NV61, NV24 and NV42
and sanitize them and NV21.
2023-10-23 02:54:23 +02:00
Matthias Clasen
ca5247a995 Post-release version bump 2023-10-22 19:04:54 -04:00
Matthias Clasen
004a881521 4.13.2 2023-10-22 18:58:50 -04:00
Matthias Clasen
65993ed0e0 Merge branch 'dont-claim-external-formats' into 'main'
dmabuf: We don't support external formats on GL

See merge request GNOME/gtk!6516
2023-10-22 22:40:48 +00:00
Matthias Clasen
a4d0a5bda5 dmabuf: We don't support external formats on GL
Filter out external-only formats unless we are on GLES.
2023-10-22 17:54:18 -04:00
Matthias Clasen
33bc276639 Merge branch 'dmabuf-texture-gl-downloader' into 'main'
dmabuf: Add an EGL downloader

See merge request GNOME/gtk!6489
2023-10-22 21:13:58 +00:00
Matthias Clasen
06822581f7 gsk: Use external textures
When we are running under GLES, we can use GL_TEXTURE_EXTERNAL_OES
to support YUV formats.

Since we don't want to deal with the combinatorial explosion of
compiling all our shaders with all combinations  of sampler2D vs
samplerExternalOES for all their textures, we copy the external
textures to a regular texture before using them.
2023-10-22 16:50:43 -04:00
Matthias Clasen
976143fbe9 gsk: Add a shader for external textures
This shader uses samplerExternalOES to sample an external texture
and blit it into a 'normal' texture. It only works in GLES, but
we won't use it outside of GLES.
2023-10-22 16:42:17 -04:00
Matthias Clasen
9fd4feef0c gsk: Use some GLES extensions
Allow our shaders to use samplerExternalOES, by declaring
that we use the relevant extension. Unfortunately, this
only works for gles, and requires different extensions for
gles2 and gles3. Yay
2023-10-22 16:42:17 -04:00
Matthias Clasen
5eed13bd07 gsk: Define GSK_GLES3 if we have gles3
The compiler defines GSK_GLES only for gles2. Add another define
for gles3, so we can differentiate where we need to.

This took a week to find!
2023-10-22 16:42:17 -04:00
Matthias Clasen
d02d45dd8d gsk: Allow shaders without clip variants
Add a GSK_GL_DEFINE_PROGRAM_NO_CLIP, which is like
GSK_GL_DEFINE_PROGRAM but compiles the shader just once,
with NO_CLIP defined.

This will be used in the future for shaders that do
texture conversion.
2023-10-22 16:42:17 -04:00
Matthias Clasen
13d0e311b7 gsk: Prepare for external textures
Prepare the plumbing in the GL renderer for textures that use
target GL_TEXTURE_EXTERNAL_OES. These need to use a special sampler,
so make sure our sampler machinery does not run over it.
2023-10-22 16:42:17 -04:00
Matthias Clasen
52254f755f gsk: Support dmabuf textures
Defer handling of dmabuf textures to the driver,
and add the necessary code in load_texture.
2023-10-22 16:42:17 -04:00
Matthias Clasen
494154beb6 dmabuf: Add an EGL downloader
Add an implementation of GdkDmabufDownloader that uses
gsk_renderer_render_texture + GL texture download.

Since gsk isn't threadsafe, we do the download in the main thread,
taking care to not disturb the current GL context of whatever is
going on there at the time.

And since gsk renderers are expensive to create, we cache it
in the display.

Note that gsk does not yet have any special support for
dmabuf textures, so for now, they will always get downloaded
and then reuploaded as GL textures.
2023-10-22 16:42:17 -04:00
Matthias Clasen
adde188eca gsk: Add a helper for converting textures
This is a simple helper that feed a GdkTexture
through a renderer and returns the resulting
texture. This will be used to convert dmabuf
textures to 'native' textures.
2023-10-22 16:39:24 -04:00
Matthias Clasen
8fb0ab2b43 gl context: Add private dmabuf API
Add API to import a dmabuf into a texture,
and to export a texture to a dmabuf.

All this is implemented using the relevant
EGL and GL extensions.
2023-10-22 16:39:24 -04:00
Matthias Clasen
b8b5835fc6 gl context: Check for more GL extensions
These will be used in future commits.
2023-10-22 16:39:24 -04:00
Matthias Clasen
463307655c display: Check for more EGL extensions
We are going to rely on this in future commits.
2023-10-22 16:39:24 -04:00
Matthias Clasen
d17d8e04a6 Add a few dmabuf texture tests
Test some basic import and export of dmabufs.

For now, put the test into the 'failing' suite,
since it does not work in CI, and also fails
on AMD hw.
2023-10-22 16:39:24 -04:00
Matthias Clasen
d8d1dfd8f3 Merge branch 'matthiasc/for-main' into 'main'
gsk: Restore bigendian support

See merge request GNOME/gtk!6515
2023-10-22 20:34:30 +00:00
Matthias Clasen
f581280811 gsk: Restore bigendian support
Restore the bigendian support that was lost in b0e26873f6,
by just not using GL_BGRA with GLES on bigendian. Should be a
very rare combination, but still.
2023-10-22 16:19:31 -04:00
Benjamin Otte
3a9aea44df Merge branch 'wip/otte/for-main' into 'main'
build: Change where we get drm_fourcc.h from

See merge request GNOME/gtk!6514
2023-10-22 19:33:27 +00:00
Benjamin Otte
e05764806a build: Change where we get drm_fourcc.h from
The canonical source for userspace is libdrm, not kernel headers.

Fixes compilation on Arch Linux.
2023-10-22 20:40:20 +02:00
Benjamin Otte
5ca65f04fe Merge branch 'wip/otte/for-main' into 'main'
dmabuf: Allow downloaders to fail initialization

See merge request GNOME/gtk!6513
2023-10-22 17:19:16 +00:00
Benjamin Otte
32ba1e389c build: Check for drm/drm_fourcc.h too
It's part of the kernel headers package so I did not check for libdrm.

As a side effect I checked the #define to HAVE_DMABUF.
2023-10-22 17:27:11 +02:00
Benjamin Otte
beb9e0c906 dmabuf: Add gdk_dmabuf_is_disjoint()
No users yet, but Vulkan will use this later. So have it available
already.
2023-10-22 17:03:15 +02:00
Benjamin Otte
98f02f6221 dmabuf: Reject the INVALID modifier
Trying to use it is a programming error, applications should have code
that uses real modifiers.

Also add a check to the formatsbuilder so our code doesn't include the
invalid modifier by accident.

We don't really know how to deal with it, so better force applications
to figure out what to do.
2023-10-22 17:03:15 +02:00
Benjamin Otte
13848969f4 dmabuf: Allow downloaders to fail initialization
When adding the formats of a downloader, allow them to return FALSE to
mean "This method is not supported", which is a useful way to opt out
when checking GL or Vulkan extensions and finding out that the desired
one isn't supported.
2023-10-22 17:03:13 +02:00
Matthias Clasen
0817dfe67f Merge branch 'matthiasc/for-main' into 'main'
dmabuf: Give downloaders a name

See merge request GNOME/gtk!6511
2023-10-21 23:42:10 +00:00
Matthias Clasen
9e3f537a15 dmabuf: Give downloaders a name
Add name to the downloader struct, and add it
to the debug spew for newly created dmabuf
textures.
2023-10-21 19:19:21 -04:00
Matthias Clasen
612e0e29f9 Merge branch 'matthiasc/for-main' into 'main'
testdmabuf: Add a --download-to option

See merge request GNOME/gtk!6510
2023-10-21 21:39:36 +00:00
Matthias Clasen
e1cbc96b8c testdmabuf: Add a --download-to option
The next option we add will tilt the balance
towards GOptionContext.
2023-10-21 17:26:53 -04:00
Matthias Clasen
410240fe7b Merge branch 'matthiasc/for-main' into 'main'
Cosmetics

See merge request GNOME/gtk!6509
2023-10-21 20:34:36 +00:00
Matthias Clasen
73cf3a92f9 cosmetics 2023-10-21 16:10:09 -04:00
Matthias Clasen
dd15122ccb dmabuf: Add some debug spew 2023-10-21 14:44:28 -04:00
Benjamin Otte
5299f1384f Merge branch 'wip/otte/for-main' into 'main'
dmabuf: Require valid fds for all planes

See merge request GNOME/gtk!6508
2023-10-21 15:15:57 +00:00
Benjamin Otte
58a0e4ffaa testdmabuf: Add --disjoint and --undecorated
The code now by default puts all planes into the same fd - like
v4l does, too.

The old behavior of one fd per plane can be enabled via --disjoint.

Also, am --undecorated option has been added so that the window
isn't decorated and all that the renderer has to do is display the
dmabuf.
This is useful when debugging just the dmabuf rendering.
2023-10-21 17:02:05 +02:00
Benjamin Otte
7ab9056c11 testdmabuf: Fix NV12
The code was computing the wrong size.
2023-10-21 16:42:16 +02:00
Benjamin Otte
2d9fbb16bc testdmabuf: Use the actual pixel
The previous code would subsample the luma channel, too. Don't do that.
2023-10-21 16:42:15 +02:00
Benjamin Otte
cbfd8542c6 dmabuf: Require valid fds for all planes
This seems to be what everyone does, so we should do it, too.

Previously it was assumed that an fd of -1 would mean reusing the
previous fd with a different offset, but that seems to be uncommon.
2023-10-21 16:42:15 +02:00
Piotr Drąg
7679504134 Update POTFILES.in 2023-10-21 14:14:02 +02:00
Sabri Ünal
446d461ad2 Update Turkish translation 2023-10-21 09:16:05 +00:00
Matthias Clasen
5b6fcfe8c9 Merge branch 'misc-dmabuf-fixes' into 'main'
Make a test app with dma heaps

See merge request GNOME/gtk!6507
2023-10-21 02:06:20 +00:00
Matthias Clasen
59ce7ab222 dmabuf: Improve the debug message
Printing the format can only help.
2023-10-20 20:03:27 -04:00
Matthias Clasen
0992837b08 dmabuf: Fix the mmap logic
We want to unmap the buffers we mapped in
the first loop, so pass the right pointers
here.
2023-10-20 20:03:11 -04:00
Matthias Clasen
aca02916ad dmabuf: Fix NV12 import
We were not seeking in the right fd,
so our sizes were wrong, and crashes
happened.
2023-10-20 19:53:33 -04:00
Matthias Clasen
98e883f9b4 Make a test app with dma heaps
This uses the dma-heap kernel api to create a dma-buf
and use it for a GdkDmabufTexture. It supports a few
formats to test how well GL conversion of YUV works.

The YUV code is adapted from weston tests.
2023-10-20 19:53:33 -04:00
Matthias Clasen
2c66aa0c15 Merge branch 'matthiasc/for-main' into 'main'
dmabuf: Fix format mapping for RGB formats

See merge request GNOME/gtk!6506
2023-10-20 23:44:52 +00:00
Matthias Clasen
8843c0d504 dmabuf: Fix format mapping for RGB formats
The channel order was reversed.
2023-10-20 19:22:00 -04:00
Matthias Clasen
8858f1c9ec Merge branch 'xrgb-formats' into 'main'
Add XRGB memory formats

Closes #6172

See merge request GNOME/gtk!6505
2023-10-20 22:34:19 +00:00
Matthias Clasen
a1c5c20e2c dmabuf: Add xrgb formats 2023-10-20 18:14:45 -04:00
Matthias Clasen
1da674423d vulkan: Add xrgb formats
For now, we just fall back to RGB.
2023-10-20 18:14:45 -04:00
Matthias Clasen
10250a0a6a Add XRGB memory formats
These are not uncommon in dmabufs,
and supporting them is easy.

Fixes: #6172
2023-10-20 17:58:06 -04:00
Matthias Clasen
c0a2f9fbc3 Merge branch 'missing-argb-format' into 'main'
Add GDK_MEMORY_A8B8G8R8_PREMULTIPLIED

See merge request GNOME/gtk!6504
2023-10-20 21:12:43 +00:00
Matthias Clasen
bd974b08b3 Add GDK_MEMORY_A8B8G8R8_PREMULTIPLIED
We did have 4 ordering variations of ARGB straight,
but only 3 premultiplied. Add the missing one.

Update all the places where we switch over memory formats.
2023-10-20 16:42:40 -04:00
Matthias Clasen
d289c0d4f1 Merge branch 'matthiasc/for-main' into 'main'
rendernodeparser: Use private memoryformat api

See merge request GNOME/gtk!6502
2023-10-20 14:00:55 +00:00
Matthias Clasen
f4722289f7 Merge branch 'more-bgra' into 'main'
gsk: Use has_bgra in more places

See merge request GNOME/gtk!6500
2023-10-20 13:43:51 +00:00
Benjamin Otte
389af3591c Merge branch 'wip/otte/for-main' into 'main'
dmabuf refactoring

See merge request GNOME/gtk!6503
2023-10-20 12:48:53 +00:00
Benjamin Otte
008d9e5327 vulkan: Actually check for GDK_DEBUG=vulkan-disable
The dmabuf code would happily init Vulkan even if it was told we don't
want it.
2023-10-20 14:26:59 +02:00
Benjamin Otte
09723d79c6 dmabuf: Support YUYV and friends
Same as the NV12 support, but necessary for the poor people stuck on
Intel laptops.
2023-10-20 14:26:59 +02:00
Benjamin Otte
4586af5876 dmabuf: Add support for NV12 and NV21
This is as-good-as-necessary and doesn't do any fancy colorspace magic
or chroma whatevering.

That's a task for the future.
2023-10-20 14:26:59 +02:00
Benjamin Otte
193d9cd31a dmabuf: Improve download
1. Split out the download function from the mmap'ing of the plane(s)

2. Make the code mmap() all the planes

3. Determine size using lseek() as documented by libdrm, instead of
   trying to guess it from the format.

4. Fix some bugs, like switcheroos of width and height
2023-10-20 14:26:59 +02:00
Benjamin Otte
f29303dea7 dmabuf: Allocate the intermediate buffer properly.
We should use the stride from the buffer's format, not from the dmabuf.
2023-10-20 14:26:59 +02:00
Benjamin Otte
4e47d0d71e dmabuf: Ensure the number of planes is sane
Make it a programming error when setting planes to 0 and throw a GError
if somebody uses more than GDK_DMABUF_MAX_PLANES.
2023-10-20 14:26:59 +02:00
Benjamin Otte
dd8c6e9f51 dmabuf: Add gdk_dmabuf_sanitize()
Tries to sanitize the dmabuf to conform to the values expected
by Vulkan/EGL which should also be the values expected by
Wayland compositors

We put these sanitized values into the GdkDmabufTexture, by
sanitizing the input from GdkDmabufTextureBuilder, which are
controlled by the callers.

Things we do here:

1. Disallow any dmabuf format that we do not know.

1. Treat the INVALID modifier the same as LINEAR.

2. Ignore all other modifiers.

3. Try and fix various inconsistencies between V4L and Mesa,
   like NV12.

*** WARNING ***

This function is not absolutely perfect, you do not have a
perfect dmabuf afterwards.

In particular, it doesn't check sizes.
2023-10-20 13:58:22 +02:00
Matthias Clasen
65676150c4 rendernodeparser: Use private memoryformat api
No need to open-code a list of all formats here,
we can just use the private depth api to do this
much simpler.
2023-10-20 07:41:53 -04:00
Matthias Clasen
b0e26873f6 gsk: Use has_bgra in more places
The glyph and icon libaries were also checking for GLES to
decide if data needs to be transformed from BGRA to RGBA.

Use the new has_bgra getter instead.

This will probably break on bigendian, because the
GL_BGRA + GL_UNSIGNED_BYTE combination is not equivalent
to the cairo format on bigendian, but this was already
broken for the gl format information that we get from
gdk_memory_format_gl_format.
2023-10-20 07:39:08 -04:00
Matthias Clasen
f4a67ebcbb Merge branch 'gles-vao' into 'main'
glcontext: Add api to check for vertex arrays

Closes #6173

See merge request GNOME/gtk!6501
2023-10-20 10:52:53 +00:00
Matthias Clasen
000c876953 gsk: Use vertex arrays when we can
Use the new has_vertex_arrays api to determine
whether we can use vertex arrays in GL.`

Fixes: #6173
2023-10-19 22:43:20 -04:00
Matthias Clasen
b8ffceaebb glcontext: Add api to check for vertex arrays
Vertex arrays are available in GL and in GLES >= 3.

We don't check for the GLES extension that provided
vertex arrays in older GLES, since that requires
using different API.

This api avoids version checks all over the place.
2023-10-19 22:43:13 -04:00
Matthias Clasen
148b8e5cd8 Merge branch 'gles-bgra' into 'main'
memoryformat: Check for BGRA support in GL

Closes #6171

See merge request GNOME/gtk!6498
2023-10-19 21:34:44 +00:00
Matthias Clasen
583ad47b03 memoryformat: Check for BGRA support
Check for whether the GL context we are using
supports uploads with GL_BGRA before returning
that memory format.

Fixes: #6171
2023-10-19 16:44:18 -04:00
Matthias Clasen
b95d8ebdd3 memoryformat: Change some private API
Make gdk_memory_format_gl_format take the GdkGLContext,
instead of just a gles boolean. This will let us
check for extensions that may be needed for certain
formats.

Update all callers.
2023-10-19 16:44:18 -04:00
Benjamin Otte
677a601d11 Merge branch 'wip/otte/for-main' into 'main'
dmabuf: Init the dmabuf subsystem before creating texture

See merge request GNOME/gtk!6499
2023-10-19 19:30:23 +00:00
Benjamin Otte
194db51fba dmabuf: Make Builder::display non-nullable
We always have a display - the default display - so there's no need to
accept NULL.

Plus, we need a display when building the texture, so accepthing NULL
wouldn't even make sense.

Includes update to defaultvalue test.
2023-10-19 20:51:51 +02:00
Matthias Clasen
d55fa0dfef glcontext: Check for GL_EXT_texture_format_BGRA8888
Check for this GLES extension and add a private getter.
2023-10-19 13:55:18 -04:00
Benjamin Otte
612b5416af dmabuf: Init the dmabuf subsystem before creating texture
We did not do that, so when the dmabuf building looked at the list of
downloaders, it was empty and the result was an error. That's not good.
2023-10-19 19:12:46 +02:00
Matthias Clasen
54637ae3b3 Merge branch 'matthiasc/for-main' into 'main'
gdk: Add an annotation

Closes #6167

See merge request GNOME/gtk!6496
2023-10-19 15:35:22 +00:00
Matthias Clasen
014adb841e gdk: Add an annotation
We are returning interned strings here, and
g-i seems to have trouble interpreting the const,
so lets help it out by being more explicit with
our annotations.

Fixes: #6167
2023-10-19 10:06:53 -04:00
Benjamin Otte
a5c6a40b3c Merge branch 'wip/otte/for-main' into 'main'
testsuite: fix "empty" linear-gradient compare test

See merge request GNOME/gtk!6493
2023-10-19 12:30:56 +00:00
Benjamin Otte
402a51b876 testsuite: Use a better opacity in the test
Using the default opacity of 0.5 makes it unclear if 0xFF should be
mapped to 0x7F or 0x80.

0.6 should hopefully map to 0x99 always.
2023-10-19 13:38:47 +02:00
Benjamin Otte
d1e091279c testsuite: fix "empty" linear-gradient compare test
We need to provide color stops to avoid rounding errors with different
shaders.

That makes the empty linear gradient somewhat less empty, but I think
it's the emptiest we can make it.
2023-10-19 13:38:47 +02:00
Matthias Clasen
7325121c63 Merge branch 'matthiasc/for-main' into 'main'
gsk: Cosmetics

See merge request GNOME/gtk!6490
2023-10-17 03:50:40 +00:00
Matthias Clasen
31abe56b7a gsk: Cosmetics 2023-10-16 23:32:37 -04:00
Matthias Clasen
ca3fd16039 Merge branch 'matthiasc/for-main' into 'main'
dmabuf: Add a display getter

See merge request GNOME/gtk!6488
2023-10-17 02:45:33 +00:00
Matthias Clasen
4417509515 dmabuf: Add a display getter
Add private api to get the display of
a dmabuf texture. We will need it in
the following commit.
2023-10-16 22:29:20 -04:00
Matthias Clasen
9dc2e554e5 dmabuf: Tweak error messages 2023-10-16 22:29:10 -04:00
Matthias Clasen
bfb01f5a4b Merge branch 'dmabuf-downloader' into 'main'
dmabuf: Split out GdkDmabuf and GdkDmabufDownloader

See merge request GNOME/gtk!6487
2023-10-16 23:31:21 +00:00
Benjamin Otte
570e80a9ff dmabuf: Split out GdkDmabuf and GdkDmabufDownloader
GdkDmabuf is a struct encapsulating all the values of a dmabuf, so
nothing to see here.

GdkDmabufDownloader is a vtable for a thing that can download dmabufs.
For now only one implementation exists, so this just looks like a ton
of work for no benefit.

The only neat thing is that gdkdmabuftexture.c got a whole lot tidier.
2023-10-16 18:56:52 -04:00
Artur S0
6d90d25a74 Update Russian translation 2023-10-16 11:57:47 +00:00
Matthias Clasen
a7f6e65291 Merge branch 'matthiasc/for-main' into 'main'
Add a dmabuf debug flag

See merge request GNOME/gtk!6486
2023-10-15 16:43:45 +00:00
Matthias Clasen
59641b3c7b docs: Sync the list of debug flags
Make the docs for GDK_DEBUG match current reality.
2023-10-15 12:00:23 -04:00
Matthias Clasen
2f842b087c dmabuf: Cosmetics 2023-10-15 12:00:23 -04:00
Matthias Clasen
699f6a7993 Add a dmabuf debug flag
Add a new debug flag for dmabuf-related information,
and use it in gdkdmabuftexture.c.

This will let us separate out dmabuf debug spew from
opengl debug spew.
2023-10-15 11:05:32 -04:00
Matthias Clasen
f04ba3bc60 Merge branch 'remove_ref_sink_on_gtk_filter' into 'main'
gtkfilechooserwidget: Replace g_object_ref_sink () with g_object_ref () on file filter

See merge request GNOME/gtk!6484
2023-10-15 11:28:29 +00:00
Matthias Clasen
09aac114d4 Merge branch 'fix-title-truncation' into 'main'
Fix window titles unexpectedly getting truncated

See merge request GNOME/gtk!6472
2023-10-15 11:27:40 +00:00
Matthias Clasen
9132600e1f Merge branch 'gbsneto/filechoosernativeportal-reverse' into 'main'
filechooserportal: Reverse file list

See merge request GNOME/gtk!6482
2023-10-15 11:26:25 +00:00
Matthias Clasen
5dcd6c7e12 Merge branch 'matthiasc/for-main' into 'main'
dmabufformatsbuilder: Make it work

See merge request GNOME/gtk!6485
2023-10-15 03:38:25 +00:00
Matthias Clasen
9f8d34ab01 dmabufformatsbuilder: Make it work
The qsort arguments were mixed up, leading to nonsense.
2023-10-14 23:04:00 -04:00
sid
7a4580fa89 gtkfilechooserwidget: Replace g_object_ref_sink () with g_object_ref () on file filter
GtkFileFilter doesn't inherit from GInitiallyUnowned anymore.
2023-10-14 21:54:49 +00:00
Matthias Clasen
45a7617cc8 Merge branch 'wip/otte/dmabuf-cleanups' into 'main'
Various dmabuf reworks

See merge request GNOME/gtk!6483
2023-10-14 20:54:27 +00:00
Benjamin Otte
57d8cc08a3 gdk: Add GDK_DEBUG=dmabuf-disable
I chose the name for consistency with gl-disable and vulkan-disable.
2023-10-14 22:30:17 +02:00
Benjamin Otte
1ca067a478 dmabuf: Add a GError to gdk_dmabuf_texture_builder_build() 2023-10-14 22:30:17 +02:00
Benjamin Otte
7a13e4f9b9 docs: Remove docs for private GdkDmabufFormat struct
This is a leftover from the design of the GdkDmabufFormats struct.
2023-10-14 22:30:17 +02:00
Benjamin Otte
d101e17608 dmabuf: Use the new FormatsBuilder to initialize formats 2023-10-14 22:30:17 +02:00
Benjamin Otte
203a4fc45e dmabufformats: Add GdkDmabufFormatsBuilder
This is a utility object that helps in constructing GdkDmabufFormats.
2023-10-14 22:29:10 +02:00
Benjamin Otte
a9823e05bb array: constify the additions array
We can only do that for by-value arrays, because compilers get confused
with const when there's too many dereferences going on.
2023-10-14 22:11:44 +02:00
Benjamin Otte
6f5833df28 dmabufformats: Mark a bunch of functions as pure 2023-10-14 22:11:44 +02:00
Sabri Ünal
5631ab6711 Update Turkish translation 2023-10-14 07:08:23 +00:00
Georges Basile Stavracas Neto
62fedf4eed filechooserportal: Reverse file list
To avoid O(n²) behaviour, GtkFileChooserNativePortal uses the
classic prepend tatict. However, it does not reverse the file
list after building it.

It's not a big deal since the portal does not specify the order
in which the files are sent. But it's nice nonetheless to send
the file list in the order in which files were passed originally.

Reversing the list has no meaningful performance impact.

Patch originally made by Bastien Nocera.

See https://github.com/flatpak/xdg-desktop-portal/issues/548
2023-10-13 16:12:12 -03:00
Emmanuele Bassi
c274d073e0 Merge branch 'mzur-main-patch-48638' into 'main'
Fix docs for gtk_color_dialog_button_get_rgba

Closes #6155

See merge request GNOME/gtk!6479
2023-10-13 09:54:56 +00:00
Martin Zurowietz
8dda753505 Fix docs for gtk_color_dialog_button_get_rgba
The signal was incorrectly called "notify::color" but
it is "notify::rgba".

Resolves https://gitlab.gnome.org/GNOME/gtk/-/issues/6155
2023-10-13 06:57:05 +00:00
Matthias Clasen
4e66df79c4 Merge branch 'michaelweghorn/a11y_send_dbus_reply_on_set_current_value' into 'main'
a11y atspi: Send proper dbus reply when (not) changing value

Closes #6150

See merge request GNOME/gtk!6476
2023-10-12 14:05:49 +00:00
Emmanuele Bassi
71c7e61162 Merge branch 'michaelweghorn/a11y_dont_confuse_char_and_byte_count' into 'main'
a11y atspi: Don't use char count as byte count

Closes #6151

See merge request GNOME/gtk!6477
2023-10-12 13:40:40 +00:00
Michael Weghorn
e39ecbf16d a11y atspi: Don't use char count as byte count
As mentioned in

    commit 368f2af634
    Author: Matthias Clasen <mclasen@redhat.com>
    Date:   Mon Oct 2 08:47:53 2023 -0400

        a11y: Be safe against non-UTF8 text

, the string insertion APIs take string + length
and only insert up to `length` bytes of the
given string.

The AT-SPI "TextChanged" event however
is using a character count, and `emit_text_changed`
also gets called with the character count
along with the string.

However, `g_strndup` used in `emit_text_changed`
so far takes a byte count, not a character count.

Adapt `emit_text_changed` to just use the
passed text as is and make it the responsibility
of the callers to pass only the actually
inserted/removed string.

Most of the callers in `gtk/a11y/gtkatspitext.c`
already did that. Adapt two missing ones to do
likewise.

Fixes: #6151
2023-10-12 11:58:32 +02:00
Michael Weghorn
0dbd2bd09e a11y atspi: Send proper dbus reply when (not) changing value
`gtk_accessible_range_default_set_current_value` needs
to return TRUE independent of whether the value was
actually changed, since that return value is required
for the proper dbus reply to be sent to AT-SPI.

Fixes a crash/assertion seen e.g. with the "Hypertext" gtk4-demo
example when trying to change "CurrentValue" for the
level bar via the AT-SPI Value interface:

    GLib-GIO:ERROR:../../../gio/gdbusconnection.c:4354:invoke_set_property_in_idle_cb: assertion failed: (error != NULL)
    Bail out! GLib-GIO:ERROR:../../../gio/gdbusconnection.c:4354:invoke_set_property_in_idle_cb: assertion failed: (error != NULL)
    Aborted

Fixes: #6150
2023-10-12 09:09:53 +02:00
Matthias Clasen
1297cc188d Merge branch 'add-six-lang' into 'main'
add hi-ja-et-fi-nb-th for gtkemojichooser

See merge request GNOME/gtk!6475
2023-10-11 22:13:54 +00:00
Benjamin Otte
e584d17aad Merge branch 'dmabuf-texture-api' into 'main'
Add API for dmabuf textures

See merge request GNOME/gtk!6463
2023-10-11 20:25:50 +00:00
Matthias Clasen
4936965fb6 display: Get supported dmabuf formats
These are the dmabuf formats that we can import
into a GL context as an EGLImage, and successfully
download.

We skip the GdkDisplay:dmabuf-formats property
in the default value tests, since the nominal
default value is NULL, but the actual value is
constructed on demand.
2023-10-11 15:43:01 -04:00
Matthias Clasen
e9cc53796e build: Error out if linux/dma-buf.h isn't found
This should always be present on Linux.
2023-10-11 15:43:01 -04:00
Matthias Clasen
c93efe85dd Add GdkDmabufTexture
Add an implementation of GdkDmabufTexture.

For now, this implementation is rather minimal,
since we need a roundtrip through GL to convert
most nottrivial formats.
2023-10-11 15:43:01 -04:00
Matthias Clasen
44daa847ff Merge branch 'michaelweghorn/a11y_convert_negative_index_on_text_deletion' into 'main'
a11y: Convert negative text deletion index to actual offset

Closes #6149

See merge request GNOME/gtk!6473
2023-10-11 19:32:11 +00:00
Matthias Clasen
d23e13aced Add GdkDmabufTextureBuilder
Add a builder for a new GdkTexture subclass that
wraps dmabuf buffers on Linux. For now, this is
just an API. The implementation will follow in
subsequent commits.
2023-10-11 14:54:21 -04:00
Matthias Clasen
40102a2b61 Add GdkDmabufFormats
This is an immutable struct containing information
about supported dma-buf formats and their properties.
2023-10-11 14:53:06 -04:00
sudip
49fbbfb6cc add hi-ja-et-fi-nb-th for gtkemojichooser 2023-10-12 00:07:59 +05:30
Michael Weghorn
fefd856d67 a11y: Convert negative text deletion index to actual offset
`gtk_editable_delete_text` can be called with a
negative `end_pos`, in which case the characters
from the start pos to the end of the text are
removed. [1]

It e.g. gets called this way from
`gtk_editable_set_text`.

So far, that negative index was not converted,
but passed as is in the AT-SPI callback
`delete_text_cb` when calling the `text_changed`
handler (`emit_text_changed` in
`gtk/a11y/gtkatspicontext.c`) which just uses the
index as is, also in it's call to `g_strndup`,
resulting in a crash when negative indices are
used.

Fix this by converting negative values to the
actual end index in `delete_text_cb` before
calling the handler.

[1] https://docs.gtk.org/gtk3/method.Editable.delete_text.html

Fixes: #6149
2023-10-11 15:51:17 +02:00
Sergey Bugaev
39dab6d7bd widget: Queue a resize on Pango context changes
Updating a Pango context can influence the layout of widget, in
particular that of a GtkLabel, not only its rendering. Make sure to
queue a resize when updating the context.

In particular, this fixes window titles getting suddenly truncated when
moving a window from a HiDPI display to a low DPI one, after
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6190 has made font
hinting depend on the widget scale. With hinting enabled on low DPI,
the Pango layout needs ever so slightly more width to not get truncated.
There is plenty of space in the header bar that could be allocated to
the label, but for that to happen, it needs to know to queue a resize.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-10-11 15:39:37 +03:00
Matthias Clasen
7b5b78b065 Merge branch 'fix-a11y-text-signals-again' into 'main'
a11y: Avoid a crash

Closes #6146

See merge request GNOME/gtk!6470
2023-10-11 01:06:55 +00:00
Matthias Clasen
005b5042f6 Merge branch 'demo-frame-time' into 'main'
demo: Use the frame time for animation

See merge request GNOME/gtk!6468
2023-10-11 00:39:38 +00:00
Matthias Clasen
b5149a483f Merge branch 'wip/chergert/update-stb' into 'main'
gsk/gl: update stb_rect_pack()

See merge request GNOME/gtk!6466
2023-10-11 00:38:36 +00:00
Matthias Clasen
15c43e5284 a11y: Avoid a crash
It is not safe to access text[end],
if text may not be NUL-terminated.

Fixes: #6146
2023-10-10 18:54:27 -04:00
Matthias Clasen
fc4c0f769c Merge branch 'no-enums-in-bitfields' into 'main'
Stop using enums in bitfields

See merge request GNOME/gtk!6467
2023-10-10 22:48:11 +00:00
Sergey Bugaev
e8ecbb2009 demo: Use the frame time for animation
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-10-10 11:38:13 +03:00
Sergey Bugaev
964affb1cc Stop using enums in bitfields
The C standard does not specify whether the underlying type of an enum
is signed or unsigned, and until C23 there was no way to control this
explicitly. GCC appears to make enums unsigned unless there is a
negative value among cases of the enum, in which case it becomes signed.
MSCV appears to make enums signed by default.

A bitfield of an enum type (which is not specificied in the C standard
either) behaves as if it was an instance of a numeric type with a
reduced value range. Specifically, a 'signed int val : 2;' bitfield will
have the possible values of -2, -1, 0, and 1, with the usual wraparound
behavior for the values that don't fit (although this too is
implementation-defined).

This causes the following issue, if we have:

typedef enum
{
  GTK_ZERO,
  GTK_ONE,
  GTK_TWO
} GtkFoo;

struct _GtkBar
{
  GtkFoo foo : 2;
};

and then assign bar.foo = GTK_TWO and read it back, it will have the
expected value of 2 (aka GTK_TWO) on GCC, but a value of -2 (not
matching any of the enum variants) on MSVC.

There does not seem to be any way to influence signedness of an enum
prior to C23, nor is there a 'unsigned GtkFoo foo : 2;' syntax. The only
remaining options seems to be never using enums in bitfields, which is
what this change implements.

In practice, this fixes GdkPipeIOStream crashing with an assertion when
trying to copy-paste in-app in MSVC builds on GTK.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-10-10 11:23:08 +03:00
Christian Hergert
05b51af2d5 gsk/gl: update stb_rect_pack() 2023-10-09 22:42:57 -07:00
Emmanuele Bassi
28e51c763b Merge branch 'disable_ccache_macos' into 'main'
Disable ccache in macOS job

See merge request GNOME/gtk!6458
2023-10-09 12:23:31 +00:00
Matthias Clasen
ebf8e18319 Merge branch 'add-bn' into 'main'
add bengali language bn.data for gtkemojichooser

See merge request GNOME/gtk!6459
2023-10-09 03:03:10 +00:00
Christian Hergert
d8bbe1c296 testsuite/gsk: add render test for mask(texture|color) 2023-10-06 10:52:53 -07:00
Christian Hergert
c1417d3d4a gsk/gl: add fast path for texture masking color
This is useful for colorizing in the same fashion we do for the glyph
texture atlas. In fact, for small GdkTexture, you will end up in something
like the icon texture atlas.

The primary motivator for this optimization is to draw various glyph-like
features from VTE such as many forms of boxes, lines, arrows, etc.
2023-10-05 20:30:00 -07:00
René de Hesselle
3b4359d76d ci: Disable ccache in macOS job
As it turns out, ccache accelerates the build so much that it can
trigger a race condition in the gobject-introspection subproject. This
only surfaced recently as the introspection feature was previously
disabled due to missing build time dependencies.

The race condition surfaces as follows: the build breaks because
gobject-introspection starts to build Gdk-4.0.gir before
GdkPixbuf-2.0.gir, despite Gdk-4.0.gir depending on GdkPixbuf-2.0.gir.
2023-10-04 20:07:47 +02:00
sudip
16806294e3 add bengali language bn.data for gtkemojichooser 2023-10-04 18:52:10 +05:30
Luca Bacci
822425072b Merge branch '5724_gdk_win32_ignore_invalid_client_rect' into 'main'
Gdk4 Win32: ignore invalid client rects

Closes #5724

See merge request GNOME/gtk!6414
2023-10-04 07:58:55 +00:00
Emmanuele Bassi
7cc1283a26 Merge branch 'macos_introspec' into 'main'
Enable introspection in macOS CI

Closes Infrastructure/Infrastructure#935

See merge request GNOME/gtk!6453
2023-10-03 22:46:23 +00:00
René de Hesselle
f4198706d1 Enable introspection in macOS CI
This requires providing pkg-config and bison as well as pre-built
wheels for Pycairo and PyGObject to make it work.
2023-10-03 21:00:14 +02:00
sumibi-yakitori
37a5ad3a53 Fix coding style 2023-10-04 03:30:32 +09:00
Jordi Mas i Hernandez
8478ba66fe Update Catalan translation
(cherry picked from commit d6fecef605)
2023-10-03 06:56:01 +00:00
sumibi-yakitori
00e4dab1ef macos: change to send motion events to NSApp
This fix addresses a problem where the mouse cursor cannot be changed after it becomes a resize indicator, even in non-CSD windows
2023-10-03 08:14:27 +09:00
Matthias Clasen
1d58de6ffb Merge branch 'a11y-textview-crash' into 'main'
a11y: Be safe against non-UTF8

Closes #6131

See merge request GNOME/gtk!6448
2023-10-02 17:34:21 +00:00
Daniel Boles
473881357c Notebook: Update doc on how to accept dropped tabs
It was still giving out-of-date info about how GTK3 did this. Update per
reading the current code, so readers have proper guidance on doing this.
2023-10-02 16:39:49 +01:00
Emmanuele Bassi
f5cec5c0f2 Apply 1 suggestion(s) to 1 file(s) 2023-10-02 13:16:17 +00:00
Matthias Clasen
368f2af634 a11y: Be safe against non-UTF8 text
The string we're passed here may not be zero-terminated
since our text insertion APIs take string + length. So
So be safe and copy the text we are interested in if
necessary.

Fixes: #6131
2023-10-02 08:49:41 -04:00
Matthias Clasen
66a9fee071 a11y: Emit text-changed after the insertion
This is necessary, since it is the default handler
that positions the iter at the inserted text, which
is what we assume here.
2023-10-02 08:49:31 -04:00
Matthias Clasen
6e0ac83d99 Merge branch 'print-dialog-revision' into 'main'
print dialog: Some API revisions

See merge request GNOME/gtk!6443
2023-10-01 14:01:33 +00:00
Matthias Clasen
12ad6b3157 gtk-demo: Add a demo for printing a stream
Add a Print button to the path fill demo,
and implement it using gtk_print_dialog_print.
2023-10-01 09:30:38 -04:00
Matthias Clasen
fda9fd5ced print dialog: Some API revisions
Make gtk_print_dialog_setup_finish return a GtkPrintSetup
object, which encapsulates all the data that needs to be
transferred between the setup and print calls, and make
the print_file and print methods take an extra GtkPrintSetup
argument.

Change the print call to return an output stream, rather
than take an input stream. The results are now returned
when the output stream is closed.

With some further cleanup, this makes the GtkPrintDialog
object a proper builder object - you can create multiple
print dialogs from the same GtkPrintDialog object, in
parallel, and they won't interfere with each other.
2023-10-01 09:30:38 -04:00
Matthias Clasen
029ce83a69 print dialog: Cosmetics
Some minor cleanups.
2023-09-30 21:30:22 -04:00
Matthias Clasen
5ced6be416 printjob: Work with non-seekable fds
We want to pass a pipe fd in the future,
and those aren't seekable.
2023-09-30 21:30:22 -04:00
Matthias Clasen
bbda833b01 demos: Cosmetics 2023-09-30 21:30:15 -04:00
Jonas Ådahl
c86bc00330 Merge branch 'master' into 'main'
GdkSurface: prevent popups from appearing offscreen in edge cases

See merge request GNOME/gtk!5320
2023-09-30 15:03:33 +00:00
Mazhar Hussain
8367411785 GtkProgressBar: Fix: progress can overflow trough
For visual explanation, visit https://gitlab.gnome.org/GNOME/gtk/-/issues/5751
The linked issue tracker is for GtkScale but GtkProgressBar has the exact same problem as well
2023-09-30 14:11:47 +05:00
Mazhar Hussain
17e37dc42a GtkScale: Fix: highlight can overflow trough
For visual explanation, visit https://gitlab.gnome.org/GNOME/gtk/-/issues/5751
2023-09-30 13:39:00 +05:00
Matthias Clasen
68755c0fd2 Post-release version bump 2023-09-28 10:49:46 -04:00
Matthias Clasen
9090c28125 4.13.1 2023-09-28 09:50:16 -04:00
Matthias Clasen
3a3244891e Merge branch 'wip-print-dialog' into 'main'
wip: print dialog api

See merge request GNOME/gtk!5484
2023-09-28 01:18:26 +00:00
Matthias Clasen
b55117334c gtk-demo: Add a print dialog 2023-09-27 20:50:52 -04:00
Matthias Clasen
02e5c7b9ad Add a print dialog
Add a simplified print api that only supports
printing preexisting pdf content. For now, it
only has a portal implementation.
2023-09-27 20:50:52 -04:00
Matthias Clasen
7268167f4c Merge branch 'matthiasc/for-main' into 'main'
print portal: Report errors properly

See merge request GNOME/gtk!6441
2023-09-27 21:52:13 +00:00
Matthias Clasen
93c7502cf7 printer: Add private search api 2023-09-27 17:37:11 -04:00
Matthias Clasen
789705cfe4 print portal: Report errors properly
The portal printoperation inmplementation
relies on the file printbackend to be available.
If it isn't, we should report a proper error
status insetad of running into assertions deep
inside the printoperation code.
2023-09-27 17:33:34 -04:00
Emmanuele Bassi
741471a1f8 Merge branch 'michaelweghorn/a11y_add_paragraph_role' into 'main'
a11y: Add paragraph role

See merge request GNOME/gtk!6432
2023-09-27 12:20:19 +00:00
Matthias Clasen
f8da751cc2 Merge branch 'wip/chergert/rendernode-type-checks-for-refcount' into 'main'
gsk: remove excessive type checking within GSK

See merge request GNOME/gtk!6439
2023-09-27 12:12:18 +00:00
Matthias Clasen
8174842d9f Merge branch 'wip/chergert/rendernode-type-check' into 'main'
gsk/gl: remove TypeNode conformity checking for renderjob

See merge request GNOME/gtk!6438
2023-09-27 12:10:52 +00:00
Matthias Clasen
e872952f36 Merge branch 'mcatanzaro/#6122' into 'main'
printoperation: fix case where operation may complete multiple twice

Closes #6122

See merge request GNOME/gtk!6437
2023-09-27 10:37:23 +00:00
Christian Hergert
b010e46d13 gsk/gl: remove TypeNode conformity checking for renderjob
We don't need to be calling type node conformity checking from the tight
loop of the renderjob. Hoist that into the private header and use that
intead through via the Class pointer.
2023-09-26 18:36:56 -07:00
Christian Hergert
eb646a8e8b gsk: remove excessive type checking within GSK
Anything that includes gskrendernodeprivate.h will get an alternate form
of ref/unref for render nodes which does not need to do type checking on
the parameter. We can expect that things are correct within GTK itself and
this saves excessive amounts of TypeNode conformities checking.
2023-09-26 18:28:34 -07:00
Michael Catanzaro
1e2975147d printoperation: fix some strange line spacing 2023-09-26 19:28:12 -05:00
Michael Catanzaro
653c10e8b6 printoperation: add some assertions
Let's assert that we schedule the idle callback exactly once.

These assertions are not perfect because if the callback executes before
we schedule it, then the assertion itself would be a use-after-free,
since I'm using the PrinterFinder to track whether the callback that
frees it has been scheduled. But in practice when using loupe's print
dialog, I was noticing the callback scheduled twice before it was
executed. The assertion would have caught this problem.
2023-09-26 19:25:41 -05:00
Michael Catanzaro
dfbafdf047 printoperation: fix another case where operation may complete twice
This is a little tricky. At first, I thought we had a codepath where we
fail to schedule the idle that completes the print operation: if we take
the gtk_print_backend_printer_list_is_done path for each printer
backend, then printer_list_done_cb() is never executed and we never
schedule the idle. But in fact, in this case, then backends == NULL at
the bottom of find_printer(), and we'll schedule the idle there, so it's
OK. Except it's not really OK, because we'll schedule it even if a
printer was already found, resulting in the callback completing twice
and a double free.

Simplify this. Schedule the idle in find_printer() only if there are
*initially* no backends, not also if all backends are immediately ready
and already removed from consideration. Instead, always call
printer_list_done_cb() for every backend in find_printer_init(). After
the previous commit, printer_list_done_cb() will schedule the idle when
appropriate.

printer_list_done_cb() additionally disconnects signals that we did not
connect in this codepath, but it does so using
g_signal_handlers_disconnect_by_func, which is harmless. Otherwise, the
only extra work it's doing is scheduling the idle, and that's exactly
what find_printer_init() is missing.
2023-09-26 19:08:46 -05:00
Michael Catanzaro
d8c821a851 printoperation: fix case where operation may complete multiple twice
If we are the final backend, then after removing ourselves there is no
backend remaining. We will schedule the idle even if it has already been
scheduled. This idle is required to run exactly once and executing it
twices results in a double free that crashes loupe when printing. It
also causes the user callback to execute twice, which could cause
similar problems.

Fixes #6122
2023-09-26 18:47:01 -05:00
Matthias Clasen
83376648d7 Merge branch 'wip/chergert/fix-clips-uaf' into 'main'
Fix potential UAF in renderjob clipping

See merge request GNOME/gtk!6436
2023-09-26 21:59:56 +00:00
Christian Hergert
089c34fa03 gsk/gl: use GdkArrayImpl for tracking modelview
Like the previous change, this uses GdkArrayImpl instead of GArray for
tracking modelview changes. This is less important than clip tracking
simple due to being used less, but it keeps the implementation synchronous
with the Clip tracking code.
2023-09-26 13:58:38 -07:00
Christian Hergert
c846f8d745 gsk/gl: use GdkArrayImpl for Clip tracking
We can end up spending a lot of time in g_array_maybe_expand() through the
use of g_array_set_size() for clip tracking. That is somewhat due to the
simple nature of GArray being size-dynamic. Instead, we can use
GdkArrayImpl and let the compiler do what it does best to elide some
work and hoist other work into the calling function.

This also fixes a potential UAF in gsk_gl_render_job_push_contained_clip().
2023-09-26 13:58:35 -07:00
Emmanuele Bassi
79ebd76ac8 Merge branch 'wip/chergert/fix-gdkarrayimpl-from-c++' into 'main'
gdk: add missing G_END_DECLS to gdkarrayimpl.c

See merge request GNOME/gtk!6435
2023-09-26 18:48:02 +00:00
Christian Hergert
6eb9836eb0 gdk: add missing G_END_DECLS to gdkarrayimpl.c 2023-09-26 10:46:21 -07:00
Matthias Clasen
4a8f8a6eea Merge branch 'broadway-renderer-leak' into 'main'
broadway: Plug a leak in the GSK renderer

Closes #6120

See merge request GNOME/gtk!6434
2023-09-26 15:13:38 +00:00
Emmanuele Bassi
3ea723730b broadway: Do not add an extra reference when caching textures
We just created a GdkTexture, so we don't need to acquire a reference if
we're transferring the ownership to the node cache.
2023-09-26 14:44:05 +01:00
Emmanuele Bassi
90be2baf8b broadway: Plug another leak
When getting a colorized texture we're downloading the texture as a
Cairo surface, and then feeding it to another texture, but we never drop
the reference of the new surface.
2023-09-26 14:40:37 +01:00
Emmanuele Bassi
0b64fa88a1 docs: Clarify the behaviour of gdk_texture_new_for_surface()
Cairo surfaces are not GObject instances, so we should be more explicit
in the behaviour of the memory management, to avoid leaks.
2023-09-26 12:57:52 +01:00
Emmanuele Bassi
c6cc446e63 broadway: Plug a leak in the GSK renderer
We are leaking the Cairo image surface when creating a new node.

Fixes: #6120
2023-09-26 12:49:32 +01:00
Benjamin Otte
0cad37760e Merge branch 'wip/otte/for-main' into 'main'
treeview: Fix crash in assertion

Closes #6114

See merge request GNOME/gtk!6433
2023-09-26 09:29:08 +00:00
Benjamin Otte
e720008dca glcontext: Add gdk_gl_context_get_glsl_version_string()
This is in preparation for the new renderer.
2023-09-26 11:08:59 +02:00
Benjamin Otte
9c636a6136 array: Compute new size properly
Using "1 << x" means that we are shifting a signed 32bit integer, but we
want a gsize, which is an unsigned 64bit integer.

So now we don't overflow anymore if the array reaches a size of 2GB.
2023-09-26 11:08:59 +02:00
Benjamin Otte
1e24aa425e gdk: Fix compiler warning
gcc's -Wlto-type-mismatch found the hack, where we copied the wrong
prototype.
2023-09-26 11:08:59 +02:00
Benjamin Otte
a8c597005a treeview: Fix crash in assertion
The fix in commit a267dfac5d is wrong.
The function can return FALSE in normal operation.

Instead do a check for node == NULL that gracefully returns FALSE instead.

Fixes: #6114
2023-09-26 11:08:32 +02:00
Aurimas Černius
97a781b380 Update Lithuanian translation
(cherry picked from commit 61276e9a76)
2023-09-25 19:58:12 +00:00
Rafael Fontenelle
313cadefe6 Update Brazilian Portuguese translation
(cherry picked from commit 90b8dcdf33)
2023-09-25 12:58:47 +00:00
Michael Weghorn
9f078bd5c9 a11y: Add paragraph role
Add new GTK_ACCESSIBLE_ROLE_PARAGRAPH role
for paragraphs.

ARIA has a paragraph role as well.

The paragraph role is used e.g. in document editors
like LibreOffice or web browsers like Firefox.

According to the ARIA spec [1], naming paragraphs
is forbidden (§ 5.2.8.6), and the superclass role
is section.

This role will be more useful once a way to expose
the textual data via the AT-SPI Text interface is
also available (s. issue #5912 [2]).

[1] https://www.w3.org/TR/wai-aria-1.2/
[2] https://gitlab.gnome.org/GNOME/gtk/-/issues/5912
2023-09-25 11:30:14 +02:00
Matthias Clasen
8ff4e27103 Merge branch 'wip/alice/dialog-crash' into 'main'
dialog: Check header bar type before calling track_default_decoration()

Closes #6116

See merge request GNOME/gtk!6430
2023-09-24 13:24:49 +00:00
Matthias Clasen
8389ca633d Merge branch 'matthiasc/for-main' into 'main'
tests: Split off some path utilities

See merge request GNOME/gtk!6431
2023-09-24 13:07:45 +00:00
Matthias Clasen
18fbec0fe1 Improve FOO_DEBUG=help output
Explain the all value a bit better.
2023-09-24 08:33:22 -04:00
Alice Mikhaylenko
eb0a00067d dialog: Check header bar type before calling track_default_decoration()
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/6116
2023-09-24 15:38:19 +04:00
Alice Mikhaylenko
91216408e5 header-bar: Add a precondition to track_default_decoration() 2023-09-24 15:21:55 +04:00
Matthias Clasen
6da5b8cb25 tests: Split off some path utilities
Thes can be reused in different test sources.
2023-09-23 15:28:35 -04:00
Kristjan SCHMIDT
7bee7bf5fc Update Esperanto translation
(cherry picked from commit ecc42c506b)
2023-09-23 16:41:38 +00:00
Danial Behzadi
fac66ade01 Update Persian translation 2023-09-23 15:29:04 +00:00
Matthias Clasen
96eae5f62e Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Fix a refcounting mishap

Closes #6113

See merge request GNOME/gtk!6427
2023-09-23 13:20:04 +00:00
Matthias Clasen
1cc99847f4 Deprecate gtk_window_present_with_time
It is often difficult or impossible to get a suitable
timestamp. Instead, we should do the right thing in
the simpler API.

See #6095
2023-09-23 08:06:47 -04:00
Matthias Clasen
d8b14cd3e3 gtk-demo: Fix a refcounting mishap
gtk_font_dialog_button_new's argument is
transfer full.

Fixes: #6113
2023-09-23 07:47:09 -04:00
Matthias Clasen
0c80eb5afb Merge branch 'matthiasc/for-main' into 'main'
Remove sysprof leftovers

See merge request GNOME/gtk!6425
2023-09-22 22:01:31 +00:00
Matthias Clasen
fdcb1d92c5 Remove sysprof leftovers
This is a followup to 5dd0d39a6b.
2023-09-22 17:33:09 -04:00
Matthias Clasen
d65dc6c730 Merge branch 'matthiasc/for-main' into 'main'
path-tool: Fix the restrict command

See merge request GNOME/gtk!6424
2023-09-22 00:21:22 +00:00
Matthias Clasen
c721c4d6ef path-tool: Fix the restrict command 2023-09-21 15:36:25 -04:00
Matthias Clasen
1a7ba3c512 Merge branch 'update-cursor-images' into 'main'
docs: Update cursor images

See merge request GNOME/gtk!6422
2023-09-21 18:54:04 +00:00
Matthias Clasen
25ee1a7784 Merge branch 'drop-performance-tests' into 'main'
Drop performance tests

Closes #6112

See merge request GNOME/gtk!6421
2023-09-21 17:59:08 +00:00
kramo
0b2cebe3d8 docs: Update cursor images 2023-09-21 19:51:11 +02:00
Matthias Clasen
5dd0d39a6b Drop performance tests
These were an experient, and not actively used,
and libsysprof has been changing api so they broke.

Fixes: #6112
2023-09-21 13:14:48 -04:00
Matthias Clasen
9f3ff427c1 Merge branch 'matthiasc/for-main' into 'main'
contour: Simplify add_segment for circles

See merge request GNOME/gtk!6420
2023-09-21 16:51:37 +00:00
Matthias Clasen
14e60d21ac ci: Skip the headless tests
Despite waiting for a long time, these still
regularly time out on slow runners.
2023-09-21 12:17:47 -04:00
Matthias Clasen
65c3796135 Merge branch 'ebassi/doc-fixes' into 'main'
docs: Add a link to the DropDown:selected property

See merge request GNOME/gtk!6419
2023-09-21 15:50:50 +00:00
Matthias Clasen
25acc26531 contour: Simplify add_segment for circles
We no longer need to translate path points.
2023-09-21 11:40:25 -04:00
Emmanuele Bassi
859bf8b15d docs: Mention for what GtkStringObject:string is useful 2023-09-21 15:28:37 +01:00
Emmanuele Bassi
e0bf96f329 docs: Link GtkStringObject from GtkStringList
A frequently asked question is: "what is the object type inside a
GtkStringList", so let's make the answer more obvious.
2023-09-21 15:27:35 +01:00
Emmanuele Bassi
11c5ea1fec docs: Add a link to the DropDown:selected property
The main description is a bit too coy, and some newcomers don't
understand the concept of properties and notification.
2023-09-21 15:20:46 +01:00
Daniel Rusek
bc063350ef Update Czech translation 2023-09-21 12:42:28 +00:00
Luca Bacci
347b0317e5 Merge branch 'fix-issue-6080' into 'main'
GdkWin32: Unref GdkMonitor after calling gdk_monitor_invalidate ()

Closes #6080

See merge request GNOME/gtk!6411
2023-09-21 12:41:55 +00:00
Matthias Clasen
72d832a4f3 Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Update some ifdefed code

See merge request GNOME/gtk!6416
2023-09-21 02:53:33 +00:00
Matthias Clasen
76df3ade18 gtk-demo: Update some ifdefed code
This was from a time when we had arcs.
2023-09-20 22:12:09 -04:00
Matthias Clasen
d849a53b98 contour: Fix get_closest_point for circles 2023-09-20 22:11:47 -04:00
Matthias Clasen
ef6d3af6b9 Merge branch 'revert-sassc-wrapdb' into 'main'
Revert "build-aux/flatpak: use sassc from wrapdb"

See merge request GNOME/gtk!6415
2023-09-20 22:46:33 +00:00
Christoph Reiter
f513914306 Revert "meson: Move libsass/sassc subprojects to use wrapdb"
This reverts commit 7eb999720a.
2023-09-19 21:28:28 +02:00
Christoph Reiter
7135f80094 Revert "build-aux/flatpak: use sassc from wrapdb"
This reverts commit cac0cb7f02.

This doesn't work since CI currently mixes flatpak-builder and the host git repo
and doesn't download the gtk sources, so all subprojects are missing.
2023-09-19 21:27:46 +02:00
Matthias Clasen
ef82e0ce4e Merge branch 'matthiasc/for-main' into 'main'
gtk4-demo: Fix a crash

Closes #6107

See merge request GNOME/gtk!6413
2023-09-19 19:12:58 +00:00
Matthias Clasen
1910834f8f Merge branch 'sassc-wrapdb' into 'main'
meson: Move libsass/sassc subprojects to use wrapdb

See merge request GNOME/gtk!6410
2023-09-19 18:49:50 +00:00
Matthias Clasen
f94a0624fa gtk4-demo: Fix a crash
This conversion of GtkStatusbar was a bit too
quick.

Fixes: #6107
2023-09-19 14:47:59 -04:00
G.Willems
4c46f5a8f7 GdkWin32: ignore invalid client rects
Gdk-Win32 uses GetClientRect() internally to query the surfaces coordinates,
but this API may fail in some transient contexts (observed when iconifying
a maximized window).
Check if the rect area is null, and don't update the surface position in
that case. This will keep the current surface size, until Win32 notifies
the new valid window state later.
This prevents using a nulled next_layout for toplevel size computation,
which would break widgets allocation once notified on gtk side.

Fixes #5724
Closes #5724
2023-09-19 20:29:04 +02:00
Luca Bacci
17c59d6da6 GdkWin32: Unref GdkMonitor after calling gdk_monitor_invalidate ()
Ensure that we have a reference when calling gdk_monitor_invalidate ()

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/6080
2023-09-19 18:46:41 +02:00
Andre Klapper
56c0aa596e DOAP: Replace non-existing mailing lists with GNOME Discourse URL 2023-09-19 18:21:17 +02:00
Sabri Ünal
a1c73a9b2e Update Turkish translation 2023-09-19 15:36:36 +00:00
Christoph Reiter
cac0cb7f02 build-aux/flatpak: use sassc from wrapdb
Instead of building the projects from my forks, build them as gtk
subprojects.

To avoid meson hitting the network for those wraps, add the required
files as extra sources and put them into subprojects/packagecache,
so meson can find them at build time.
2023-09-19 17:25:28 +02:00
Christoph Reiter
7eb999720a meson: Move libsass/sassc subprojects to use wrapdb
They were pointing to my personal fork, but I've now added
them to wrapdb:

* https://github.com/mesonbuild/wrapdb/pull/1153
* https://github.com/mesonbuild/wrapdb/pull/1185
2023-09-19 16:51:53 +02:00
Nathan Follens
05e15241b4 Update Dutch translation
(cherry picked from commit d66f590a86)
2023-09-19 12:31:41 +00:00
Boyuan Yang
a730867778 Update Chinese (China) translation 2023-09-19 01:47:20 +00:00
Matthias Clasen
8513621709 Merge branch 'wip/carlosg/for-main' into 'main'
Some fixes

Closes #5820, #6098, and #5529

See merge request GNOME/gtk!6407
2023-09-18 22:28:10 +00:00
Carlos Garnacho
14d99bacbc gdk/wayland: Use toplevel surface for activation
At the moment of launching/activating an application, the
keyboard focus may be on a transient surface that quickly
disappears after activation. If this happens, and the
compositor handles surface destruction before the activated
application gets to reply, the activation request may be
deemed outdated, and the "demands attention" paths be taken.

Peek the toplevel from the focus surface, as that has larger
guarantees to remain valid for the whole duration of the
operation.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5820
2023-09-18 22:04:32 +02:00
Carlos Garnacho
cbbd3e8fc3 demos: Add step/page-increment to path_walk demo spinbutton
It had 0 defaults, so it didn't get to spin when interacted.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/6098
2023-09-18 20:09:42 +02:00
Carlos Garnacho
8fa45d5fef gtkwindow: Pick a suitable widget to continue the implicit grab
When a widget in the GtkPointerFocus stack becomes insensitive, we've
so far broken the implicit grab entirely. This has the side effect of
breaking accounting of the active state on the widgets that are
ancestors of the widget that became insensitive.

The easiest, and most consistent thing to do (i.e. giving widgets
in the GtkPointerFocus stack certain level of isolation wrt state
changes in other widgets) is to transfer the implicit grab to the
topmost actor of the GtkPointerFocus stack that can keep handling
events.

This fixes the unbalanced accounting of active state on ancestors
of widgets becoming insensitive, and avoids thorny questions about
how to handle implicit active state with broken implicit grabs.
2023-09-18 19:53:33 +02:00
Carlos Garnacho
3e1706679c gtkwindow: Clear active state on sensitiveness changes
When altering the broken implicit grab due to sensitiveness changes,
also ensure to clear the active state from the affected actors. This
fixes unbalanced implicit active state accounting on the widgets going
insensitive.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5529
2023-09-18 19:50:53 +02:00
Carlos Garnacho
7f359e31c6 gtkmain: Drop redundant code
The common ancestor is already figured out at the beginning of the
function, no need to find it again.
2023-09-18 16:56:29 +02:00
Rūdolfs Mazurs
e4af2c4d80 Update Latvian translation
(cherry picked from commit 7b6b31f0d8)
2023-09-18 13:29:58 +00:00
Matthias Clasen
2d121c07c9 Merge branch 'default_theme_relative_font_sizes' into 'main'
theme: use relative font sizes

See merge request GNOME/gtk!6372
2023-09-18 11:16:10 +00:00
Matthias Clasen
cc904698a6 Merge branch 'matthiasc/for-main' into 'main'
contour: Make circles and rounded rects match

See merge request GNOME/gtk!6405
2023-09-18 11:14:39 +00:00
Matthias Clasen
a5fdd1228f Merge branch 'focus-on-click' into 'main'
Focus-on-click improvements

See merge request GNOME/gtk!6336
2023-09-18 10:41:52 +00:00
Sergey Bugaev
271d7632cb text: Respect focus-on-click property
It does make sense to have GtkText not focus on click in some cases,
such as when its editable property is set to false.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-09-18 12:03:54 +03:00
Sergey Bugaev
a8613377a5 colorbutton, fontbutton: Propagate focus-on-click to inner buttons
These widgets wrap a GtkButton internally. Make it possible to prevent
the inner button from grabbing focus on click by propagating the value
of the focus-on-click property from the widget to the inner button.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-09-18 12:03:54 +03:00
Benjamin Otte
d7cf5c2b1b Merge branch 'wip/otte/for-main' into 'main'
gl: gradients should transition in unpremultiplied space

See merge request GNOME/gtk!6406
2023-09-18 06:20:32 +00:00
Benjamin Otte
95865cb1bf gsk: Fix clipping error when drawing shadows
When shadows were offset - in particular when offset so the original
source was out of bounds of the result - the drawing code would create a
pattern for it that didn't include enough of it to compose a shadow.

Fix that by not creating those patterns anymore, but instead drawing the
source (potentially multiple times) at the required offsets.

While that does more drawing, it simplifies the shadow node draw code,
and that's the primary goal of the Cairo rendering.

Test included.
2023-09-18 07:53:03 +02:00
Benjamin Otte
0b813de72a gl: gradients should transition in unpremultiplied space
So make the gradient shaders do that.
2023-09-18 07:53:03 +02:00
Matthias Clasen
9c159cf129 path: Tweak printing a bit more
We are dealing with floats here, so using
g_ascii_dtostr isn't really the best.

Update affected tests.
2023-09-17 22:35:33 -04:00
Matthias Clasen
957d494090 contour: Make circles and rounded rects match
Make sure that we print the weights in the
same way (as floats).

Update affected tests.
2023-09-17 20:32:32 -04:00
Matthias Clasen
968b4237a9 Merge branch 'matthiasc/for-main' into 'main'
path: Fix parsing rounded rects

See merge request GNOME/gtk!6404
2023-09-17 21:19:42 +00:00
Matthias Clasen
f67c57b1f8 path: Fix parsing rounded rects
We were messing up the bottom left corner.

Test included.
2023-09-17 17:01:44 -04:00
Matthias Clasen
84f8c2d91d Merge branch 'matthiasc/for-main' into 'main'
inspector: Don't set a NULL fontdesc

Closes #5988

See merge request GNOME/gtk!6403
2023-09-17 19:17:28 +00:00
Matthias Clasen
8f1d8d7cb5 path: Split off gskpathparse.c
This is a standalone piece of code,
and nicely fits into its own source file.
2023-09-17 12:29:46 -04:00
Matthias Clasen
e98d9d62eb inspector: Don't set a NULL fontdesc
The font dialog button does not like that.

Fixes: #5988
2023-09-17 10:19:05 -04:00
Matthias Clasen
5a0b65c611 Merge branch 'path-builder-simplify' into 'main'
pathbuilder: Simplify degenerate curves

See merge request GNOME/gtk!6402
2023-09-17 13:55:32 +00:00
Matthias Clasen
5777587e7a docs: Add details for GskPathBuilder
Mention that GskPathBuilder will simplify
added Bézier curves.
2023-09-17 09:31:59 -04:00
Matthias Clasen
ecfc661054 Adapt tests to new path builder behavior
Some tests were expecting to get elevated curves
from GskPathBuilder. But they won't, anymore.
2023-09-17 08:53:10 -04:00
Emmanuele Bassi
e00722dee6 Merge branch 'submenu_reporting' into 'main'
a11y: When a menu item opens a submenu, set its expandable state

See merge request GNOME/gtk!5850
2023-09-17 11:02:33 +00:00
Piotr Drąg
5af21e70ec Update Polish translation 2023-09-17 12:15:52 +02:00
Matthias Clasen
7e13cfea91 path builder: Handle degenerate cubics
Replace cubics by lines or quadratics
when possible, and split at cusps.
2023-09-17 00:23:53 -04:00
Matthias Clasen
68b4d9c35e Add gsk_curve_get_cusps 2023-09-17 00:23:53 -04:00
Matthias Clasen
1f3b69e7db path builder: Handle degenerate conics
Do the same we do for quads here. Also,
conics with weight 1 are just quads.
2023-09-17 00:23:53 -04:00
Matthias Clasen
ca63552cf8 path builder: Handle degenerate quads
Quads that have a cusp need to be replaced by
two lines.
2023-09-17 00:23:53 -04:00
Matthias Clasen
a6d2d983b8 Add gsk_bounding_box_get_corner
This will be used in the following commits.
2023-09-16 21:57:31 -04:00
Matthias Clasen
7cd97192e5 pathbuilder: Simplify degenerate curves
When a quadratic or conic has identical points,
replace it with a line.
2023-09-16 14:32:12 -04:00
Matthias Clasen
8ac8bca52a Fix an indentation mishap 2023-09-16 13:39:21 -04:00
Benjamin Otte
cf8f6d254e Merge branch 'wip/otte/for-main' into 'main'
treemodelfilter: Yes gcc, both if branches are empty

See merge request GNOME/gtk!6401
2023-09-16 17:07:10 +00:00
Benjamin Otte
a267dfac5d treeview: No gcc, node is not NULL
... so I'll add an assertion just for you.
2023-09-16 12:18:58 -04:00
Benjamin Otte
745b28ef38 treemodelfilter: Yes gcc, both if branches are empty
... if assertions are disabled.
2023-09-16 12:17:57 -04:00
Matthias Clasen
5c27899efa Merge branch 'matthiasc/for-main' into 'main'
NEWS: Updates

See merge request GNOME/gtk!6400
2023-09-16 15:23:02 +00:00
Matthias Clasen
fd006592b5 Merge branch 'wip/corey/file-chooser-columns' into 'main'
File Chooser Move Column Visible to Column Header Menu

See merge request GNOME/gtk!6377
2023-09-16 14:27:52 +00:00
Matthias Clasen
201f27fe19 NEWS: Updates 2023-09-16 09:52:18 -04:00
Matthias Clasen
36c4dc8aea Merge branch 'contour-cosmetics' into 'main'
contour: Fixes for circles

See merge request GNOME/gtk!6399
2023-09-16 13:18:29 +00:00
Matthias Clasen
f0bd0c3e50 contour: Add more tests for circles
Cover the radius 0 case, in particular.
2023-09-16 08:31:52 -04:00
Matthias Clasen
4d71ff6da1 contour: Fixes for circles
Make circle contours use 'foreach coordinates' for
its points. This works here, but not for general
conics. As with the other custom contours, avoid
emitting collapsed conics.
2023-09-16 08:27:18 -04:00
Matthias Clasen
6d16776e27 tests: Cosmetics 2023-09-16 08:27:08 -04:00
Piotr Drąg
7cdff6bbb3 Update Polish translation 2023-09-16 13:34:39 +02:00
Martin
bf43859bdc Update Slovenian translation
(cherry picked from commit f0e0332ada)
2023-09-16 10:12:14 +00:00
Matthias Clasen
4b45f8415f Merge branch 'contour-cosmetics' into 'main'
contour: Fixes for rects and rounded rects

See merge request GNOME/gtk!6397
2023-09-15 22:30:13 +00:00
Matthias Clasen
86e0d5c13e Merge branch 'switch-rtl' into 'main'
switch: Respect text direction

Closes #1489

See merge request GNOME/gtk!6396
2023-09-15 21:59:15 +00:00
Matthias Clasen
d21ee115d0 Update private path tests
Our parser only recognizes 'complete' rounded
rects, so don't test roundtrips for incomplete
ones.
2023-09-15 16:46:23 -04:00
Matthias Clasen
2dd8e3b0eb contour: Add more tests for rounded rects
This is covering special cases where some
of the curves are omitted.
2023-09-15 16:46:23 -04:00
Matthias Clasen
6d001f79f9 contour: Fixes for rounded rects
Similar to the fixes for rect contours:
Handle all the special cases where empty curves
are omitted, and omit 'empty' curves in foreach.
2023-09-15 16:31:09 -04:00
Matthias Clasen
eb6ca8f39a contour: Add more tests for rects
Spot-check the special cases:
rects with zero height or width.
2023-09-15 16:31:09 -04:00
Matthias Clasen
abebd92b19 contour: Fixes for rect contours
Handle all the special cases (zero width and/or height),
and omit 'empty' curves in foreach.
2023-09-15 16:31:09 -04:00
Matthias Clasen
014ca76334 docs: Add details
Spell out what gsk_path_point_get_tangent does
if there is no tangent: we return 0,0.
2023-09-15 16:31:09 -04:00
Matthias Clasen
a520f9fcf7 pathbuilder: Skip trivial curves
Don't add quads, cubics or conics that collapse
to a single point. This matches what we do for
lines.
2023-09-15 16:31:09 -04:00
Matthias Clasen
de724b2a57 contour: Fix some corner cases
Adding segments of rects or rounded rects was
not working right in cases where some of the
curves are trivial. Fix that.
2023-09-15 16:31:09 -04:00
Matthias Clasen
061637f4eb contour: Small refactoring
Move some utilities out.
2023-09-15 16:31:09 -04:00
Matthias Clasen
dab1897d4e contour: Circle cosmetics 2023-09-15 16:31:09 -04:00
Andre Klapper
9ebb030c78 CONTRIBUTING: No more mailing lists; list Matrix/Discourse as irc.gnome.org is defunct 2023-09-15 22:26:44 +02:00
Benjamin Otte
93477ec019 Merge branch 'wip/otte/for-main' into 'main'
rendernode: Shadow nodes need offscreen for opacity

See merge request GNOME/gtk!6382
2023-09-15 16:08:42 +00:00
Benjamin Otte
f2a71898b1 array: Add gdk_array_steal()
Like gdk_array_clear() but returns the previous contents.
2023-09-15 16:34:00 +02:00
Benjamin Otte
24048dce43 render-node-tool: Actually load files properly 2023-09-15 16:34:00 +02:00
Benjamin Otte
41af8ee2e2 testsuite: Add another test
his is the opposite of the test in 1502c21e97.

Also change the numbers in that test so it doesn't need a ref file.

Related: #6075
2023-09-15 16:34:00 +02:00
Benjamin Otte
60c20fa6ed vulkan: Require Vulkan 1.2
We need to inist on the nonuniform access beuing available and that
requires Vulkan 1.2.

Also simplifies the descriptor indexing stuff, because that's all part
of Vulkan 1.2, too.
2023-09-15 16:34:00 +02:00
Benjamin Otte
5152c13081 vulkan: Change rounded_rect_shrink()
Same fix as with the GL renderer
2023-09-15 16:34:00 +02:00
Benjamin Otte
e9089f65e3 gl: Change rounded_rect_shrink()
The code now follows gsk_rounded_rect_shrink() and with it the behavior
of the Cairo renderer and Webkit.

The old code did what the GL renderer and Cairo do, but I consider that
wrong.

I did not test Chrome.

Test attached
2023-09-15 16:34:00 +02:00
Benjamin Otte
9aaec91f95 css: Snapshot opacity filter as opacity node
We were using color-matrix because it was easier, but opacity can often
be optimized when color-matrix needs offscreens.
2023-09-15 03:46:27 +02:00
Benjamin Otte
1c971c595f glrenderer: Shadows without offset do exist
Not for opaque contents, but stuff can be semi-transparent.

Testcase included.
2023-09-15 03:46:27 +02:00
Benjamin Otte
f8627755b5 rendernode: Shadow nodes need offscreen for opacity
Otherwise the shadow will not be properly computed as opaque regions
become translucent after applying opacity.

Testcase included.
2023-09-15 03:46:27 +02:00
Benjamin Otte
55ae8dc39e gsk: Move GskRoundedRect typedef
typedef should go into *types.h headers so that other headers only need
to include those.
2023-09-15 03:46:27 +02:00
Matthias Clasen
dd7d145249 Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Add sound to the path maze

See merge request GNOME/gtk!6395
2023-09-14 18:24:09 +00:00
Sergey Bugaev
0b2c249de3 switch: Fix CSS nodes documentation
A switch contains two GtkImage's whose nodes are named 'image',
not 'label'.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-09-14 19:35:00 +03:00
Sergey Bugaev
ea6b95f60d switch: Respect text direction
In RTL, we want the active state to mean the handle is on the left.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/1489

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-09-14 19:35:00 +03:00
Matthias Clasen
ed44f37de4 gtk-demo: Add sound to the path maze
Its a game, after all.
2023-09-14 11:32:22 -04:00
Matthias Clasen
3780a5ed6a Merge branch 'fix_visit_file' into 'main'
gtkfilechooserwidget: fix "Visit file" not scrolling to file

Closes #5799

See merge request GNOME/gtk!6392
2023-09-14 03:01:11 +00:00
Nelson Benítez León
fec3f0191a gtkfilechooserwidget: fix "Visit file" not scrolling to file
In the "Recent" view of GtkFileChooser widget, when right
clicking and selecting "Visit file" action, the action was
failing to scroll to target file.

Fix that by using gtk_column_view_scroll_to() which can
select, focus and scroll to the file.

Fixes #5799
2023-09-13 23:47:47 +01:00
Matthias Clasen
359fa99945 Merge branch 'fun-renderer-bug' into 'main'
gl renderer: Keep track of source

Closes #6094

See merge request GNOME/gtk!6391
2023-09-13 21:31:30 +00:00
Matthias Clasen
5441ed2227 Merge branch 'mcatanzaro/put-event' into 'main'
Fix documentation of gdk_display_put_event()

See merge request GNOME/gtk!6383
2023-09-13 21:27:22 +00:00
Matthias Clasen
ec1a1d0e34 gl renderer: Don't assume an atlas
The source uniform may or may not point
to a glyph atlas. The optimization we do
for color nodes is only possible if it does,
so check this.

Fixes: #6094
2023-09-13 16:56:47 -04:00
Matthias Clasen
8f4fb45715 gl renderer: Keep track of source
We have an optimization that depends on having
the source be a glyph atlas, so keep track of
that information in the render job.
2023-09-13 16:55:01 -04:00
Matthias Clasen
9db2288064 Merge branch 'matthiasc/for-main' into 'main'
rendernode: Fix handling of color glyphs

See merge request GNOME/gtk!6390
2023-09-13 20:14:41 +00:00
Matthias Clasen
1502c21e97 rendernode: Fix handling of color glyphs
The rendernode parser was mixing up its flags.

Test included.

Related: #6075
2023-09-13 15:37:57 -04:00
Matthias Clasen
408dd4b34d Merge branch 'macos' into 'main'
macOS: Clamp damage region to surface size

Closes #5812 and #6038

See merge request GNOME/gtk!6388
2023-09-13 15:33:01 +00:00
Luca Bacci
609e1f54ef macOS: Clamp damage region to surface size
...in _gdk_macos_cairo_context_begin_frame ()

GdkMacosCairoContext needs regions that are clamped to the
actual surface size.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5812
2023-09-13 17:13:33 +02:00
Luca Bacci
f49d0fbbf6 macOS: Fix typos 2023-09-13 16:53:27 +02:00
Michael Catanzaro
dde47b7966 Fix documentation of gdk_display_put_event()
This function is deprecated, but we should still document it properly.
It appends, not prepends. This is clear enough from its implementation,
but also we have practical experience with WebKit in:

https://github.com/WebKit/WebKit/pull/8663

Matthias prefers to avoid the prepend, append, start, and end
terminology altogether.
2023-09-13 08:19:11 -05:00
Matthias Clasen
f84da62740 Merge branch 'wip/corey/gridcell' into 'main'
gtkfilechoosercell: Don't use ColumnViewCell

See merge request GNOME/gtk!6378
2023-09-12 19:47:09 +00:00
Matthias Clasen
cbfbe6dc23 Merge branch 'baseline-fixes' into 'main'
Baseline & measuring fixes

See merge request GNOME/gtk!6373
2023-09-12 19:46:12 +00:00
Corey Berla
2c63a34791 Apply 1 suggestion(s) to 1 file(s) 2023-09-12 17:05:33 +00:00
Matthias Clasen
9ab07553a3 Merge branch 'wip/fix-suspend-state' into 'main'
wayland: Bind correct xdg_wm_base version

See merge request GNOME/gtk!6385
2023-09-12 16:51:50 +00:00
Rafael Fontenelle
c29fb838e9 Update Brazilian Portuguese translation
(cherry picked from commit 066b101c57)
2023-09-12 16:42:31 +00:00
Jonas Ådahl
aecc76d916 wayland: Bind correct xdg_wm_base version
Otherwise we won't get the suspend state.
2023-09-12 21:51:59 +08:00
Michael Catanzaro
713a5188cf Fix typo 2023-09-08 11:46:26 -05:00
Changwoo Ryu
911f3bf555 Update Korean translation
(cherry picked from commit 1abfeff0d1)
2023-09-07 16:59:49 +00:00
Benjamin Otte
c752598a3d Merge branch 'wip/otte/for-main' into 'main'
Various fixes

Closes #6083

See merge request GNOME/gtk!6380
2023-09-07 16:10:46 +00:00
Benjamin Otte
9dfdb1b65b rendernode-tool: Fix array size
Also add an assertion, so things explode properly if we forget to
update the array size when adding new nodes, instead of writing random
memory.
2023-09-07 16:19:20 +02:00
Benjamin Otte
a05a021fd1 rendernode: Fix Cairo rendering of repeating gradients
Cairo and the GL renderer have a different idea of how to handle
transitioning of colors outside the defined range.

Consider these stops:
  black 50%, white 50%

What color is at 0%?

Cairo would transition between the last and first stop, ie it'd do a
white-to-black transition and end up at rgb(0.5,0.5,0.5) at 0%.
GL would behave as it would for non-repeating gradients and use black
for the range [0%..50%] and white for [50%..100%].
The web would rescale the range so the first stop would be at 0% and
the last stop would be at 100%, so this gradient would be illegal.

Considering that it's possible for code to transition between the
different behaviors by adding explicit stops at 0%/100%, I could choose
any method.
So I chose the simplest one, which is what the GL renderer does and
which treats repeating and non-repeating gradients the same.

Tests attached.
2023-09-07 16:19:20 +02:00
Benjamin Otte
9ffd7840ba pathpoint: Add G_GNUC_EXTENSION to struct definition
This allows compilation with gcc -pedantic.

GTKmm uses this as part of their recommended compiler flags.

Fixes #6083
2023-09-07 16:19:20 +02:00
Daniel Rusek
dd64084b44 Update Czech translation 2023-09-07 13:42:13 +00:00
Bruce Cowan
21277a37d6 Update British English translation
(cherry picked from commit c71f8d0838)
2023-09-06 11:39:24 +00:00
Corey Berla
ddc7e36543 gtkfilechoosercell: Don't use ColumnViewCell
This partially reverts ccae75022b.
Since FileChooserCell is used for ColumnView and GridView we should
treat the list item as a GtkListItem, not a ColumnViewCell otherwise
the menu fails to generate properly.
2023-09-05 12:45:34 -07:00
Corey Berla
f429dff03e gtkfilechooserwidget: Move column menu items to the column header menu
The main menu is too long and the column options belong in the column
header menu to begin with.  Since this is only available in column
view, we should always show the menu items.
2023-09-05 12:24:27 -07:00
Corey Berla
6f07c6a3f1 gtkfilechooserwidget: Use property actions for column visibility
It's a lot less code
2023-09-05 12:24:27 -07:00
Corey Berla
4cb4aa1029 gtkfilechooserwidget: Bind column visibility to settings
It's less hacky and lets us drop even more code in the next commit.
2023-09-05 12:24:27 -07:00
Matthias Clasen
cecab7801e Merge branch 'point-color' into 'main'
Point color

See merge request GNOME/gtk!6374
2023-09-04 06:03:22 +00:00
Matthias Clasen
ea7fd1ff5a contour: Fixup for 1-point contours
If we return a path point for a 1-point contour,
make it { n, 0, 1 }.
2023-09-04 00:55:21 +02:00
Matthias Clasen
ad474a60c0 path-tool: Update docs 2023-09-03 23:47:10 +02:00
Matthias Clasen
1e8e7e0c00 path-tool: Make render match show 2023-09-03 23:47:10 +02:00
Matthias Clasen
1e9e8d24c3 path-tool: Add a --point-color option 2023-09-03 23:47:10 +02:00
Matthias Clasen
9bd9b6f2ca contour: Make sure stroke bounds are sufficient 2023-09-03 23:04:47 +02:00
Aurimas Černius
913a6ddcc9 Update Lithuanian translation
(cherry picked from commit 5d54bb1359)
2023-09-03 18:20:17 +00:00
Sergey Bugaev
31da6f60d0 entry, searchentry: Fix measuring baseline
If the entry has icons, we may end up increasing our minimum and natural
height compared to the values the text child returned. In that case, we
should also adjust the baseline values to account for the text being
shifted down.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-09-03 21:07:52 +03:00
Sergey Bugaev
c4c118e425 centerlayout: Fix measuring in presence of baselines
The measure logic (unlike the allocation logic) was enforcing strict
baseline alignment of child widgets even if no child widget had valign
set to baseline. This was causing GtkCenterLayout to request more size
than it actually needed.

Instead, bring the logic closer to that of GtkBoxLayout by introducing
explicit have_baseline and align_baseline variables. We track and report
baseline if have_baseline gets set, but it only affects our reported
minimum and natural sizes if align_baseline ends up set, which happens
if there's a child widget that has valign set to either one of the two
baseline values, and itself reports a valid baseline.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-09-03 21:07:52 +03:00
Ask Hjorth Larsen
02599acf4d Update Danish translation
(cherry picked from commit cc4d94d197)
2023-09-03 14:34:00 +00:00
Piotr Drąg
6a653e4675 Update POTFILES.in 2023-09-02 12:56:56 +02:00
Amn Alam
29e92d6a0e Update Punjabi translation 2023-09-02 04:21:39 +00:00
Ekaterine Papava
b4fcc8b5f0 Update Georgian translation 2023-09-02 03:26:30 +00:00
G.Willems
b00333c603 theme: use relative font sizes
This allows text to properly scale when changing the default font size.
2023-09-02 00:04:54 +02:00
Matthias Clasen
63614727a3 Merge branch 'matthiasc/for-main' into 'main'
path-tool: Factor out dash parsing

See merge request GNOME/gtk!6369
2023-08-31 12:06:47 +00:00
Matthias Clasen
061a56d213 path-tool: Add a way to show controls 2023-08-31 03:19:25 -04:00
Matthias Clasen
3f63ba36ce path-tool: Factor out dash parsing
No need to do this in two places.
2023-08-31 03:19:17 -04:00
Davide Ferracin
d9b96c34be Update Italian translation
(cherry picked from commit 043c89dbe2)
2023-08-30 08:36:02 +00:00
Matthias Clasen
39a8c64624 Merge branch 'matthiasc/for-main' into 'main'
curve: Add a vfunc for get_at_length

See merge request GNOME/gtk!6366
2023-08-30 02:42:54 +00:00
Matthias Clasen
360b77cc50 curve: Add a vfunc for get_at_length
We can do this precisely for lines, so lets do it.
2023-08-29 22:09:59 -04:00
Matthias Clasen
1186eff1b7 Merge branch 'gtk-compose-test-case-single-char' into 'main'
composetable: Accept short compose sequences

See merge request GNOME/gtk!6358
2023-08-29 19:46:00 +00:00
Matthias Clasen
0b8582ccba Merge branch 'gsk-header-cleanup' into 'main'
gsk: Clean up standalone headers

See merge request GNOME/gtk!6364
2023-08-29 19:11:36 +00:00
Matthias Clasen
dc2914e1f9 composetable: Warn for things we can't handle
The compose table stores the keyvals to match against
in a guint16 array, so it can't handle directly encoded
Unicode codepoints (which have a high bit set). Warn
if we encounter those.
2023-08-29 13:32:32 -04:00
Matthias Clasen
a0d8678a9c composetable: Accept short compose sequences
Followup to 8931169e00. That commit did
not do enough work to actually accept sequences
of lenth 1, as pointed by Mike Fabian.
2023-08-29 13:30:05 -04:00
Mike FABIAN
c8a43da526 Add test case for single char compose sequence 2023-08-29 13:30:05 -04:00
Matthias Clasen
90ee05ae64 gsk: Clean up standalone headers
We require folks to include gskglrenderer.h in order
to create a GL renderer. So we be careful to only
include header in gskglrenderer.h that won't trigger
ugly warnings.

See !6363
2023-08-29 12:58:30 -04:00
Matthias Clasen
67a7602080 Merge branch 'tests-svg-dimensions' into 'main'
testsuite/gsk: add explicit dimensions to <svg> elements

See merge request GNOME/gtk!6359
2023-08-29 04:43:22 +00:00
Matthias Clasen
37db270d19 Merge branch 'contour-foreach' into 'main'
Drop tolerance from gsk_contour_foreach

See merge request GNOME/gtk!6361
2023-08-29 01:58:39 +00:00
Matthias Clasen
f3312f677b measure: Cosmetics 2023-08-28 21:14:28 -04:00
Matthias Clasen
05547d98d6 path: Cosmetics
Reorganize this source file into sections.
2023-08-28 21:13:58 -04:00
Matthias Clasen
11b219bc61 Drop tolerance from gsk_contour_foreach
There is no decomposition going on for any contours,
and the tolerance argument is entirely unused.
Decomposition and tolerance is handled entirely
in gskpath.c by its trampoline.
2023-08-28 20:52:22 -04:00
Matthias Clasen
5721c3cb8f demos: Drop an unused variable 2023-08-28 20:50:38 -04:00
Fran Dieguez
f90ca697af Update Galician translation 2023-08-28 22:36:51 +00:00
Michael Orlitzky
7a0e27b6e8 testsuite/gsk: add explicit dimensions to <svg> elements
Without an explicit width, height, and viewBox, there is no single
correct way to render an SVG. In the absense of said information,
librsvg is capable of making a guess by rendering the SVG to a Cairo
surface and then analyzing that surface; however, this process is
merely heuristic.

There are three GTK tests for SVG images that are missing dimensions.
While this is not a violation of the SVG specification, it does
implicitly couple the test to the librsvg rendering heuristic. In this
commit we add that dimension information so that the expected result
is unambiguous.
2023-08-28 17:14:18 -04:00
Matthias Clasen
e81aa18c82 Merge branch 'closest-point-distance' into 'main'
Change gsk_path_get_closest_point to return distance

See merge request GNOME/gtk!6357
2023-08-28 15:53:51 +00:00
Matthias Clasen
827bbc0cc1 Change gsk_path_get_closest_point to return distance
We already compute it, so lets return it.
Bindings seems fine with this change - they
already return (success, point) as a tuple
anyway.
2023-08-28 11:22:30 -04:00
Matthias Clasen
7095a67910 Merge branch 'matthiasc/for-main' into 'main'
path-tool: Add a reverse command

See merge request GNOME/gtk!6356
2023-08-28 04:38:42 +00:00
Matthias Clasen
dcbca3f0d7 path-tool: Add a reverse command
It does what it says.
2023-08-28 00:27:29 -04:00
Matthias Clasen
702d7c238a Merge branch 'matthiasc/for-main' into 'main'
contour: Simplify gsk_circle_contour_foreach

See merge request GNOME/gtk!6355
2023-08-28 04:18:48 +00:00
Matthias Clasen
5a3ed65ad8 Improve precondition checks for path points
Add a helper function for checking that a
path point is valid for a path, and use it.
2023-08-28 00:07:50 -04:00
Matthias Clasen
2e24a9ece4 Make GskPathPoint public
The contents are still /*< private >*/, but we
let our tests and the debugger see them, which
helps.
2023-08-28 00:07:50 -04:00
Matthias Clasen
2a17320314 Limit rect variation in path builder
Make gsk_path_builder_add_rect always
produce a clockwise rectangle. This matches
what we do for circles and rounded rects,
which also go clockwise. Note that we
still need to allow negative widths in
the contour code, to implement reverse().
2023-08-28 00:07:50 -04:00
Matthias Clasen
0dbff14555 Allow circles with radius of zero
Not very useful, but we allow rects with
width and height of zero, so lets be consistent.
Curvature is infinite for such contours.

Tests included.
2023-08-28 00:07:50 -04:00
Matthias Clasen
c5d89d00f1 Merge branch 'zbrown/tooltips' into 'main'
tooltip: don't cross native boundaries

Closes #1234, #5998, gnome-calendar#1038, and nautilus#3063

See merge request GNOME/gtk!6346
2023-08-28 03:25:44 +00:00
Matthias Clasen
6f3be310f4 contour: Simplify gsk_circle_contour_foreach
Use the same approach as the rounded rect contour.
2023-08-27 21:31:40 -04:00
Matthias Clasen
0ea6b70d55 Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Add a few path benchmarks

See merge request GNOME/gtk!6353
2023-08-27 23:45:59 +00:00
Matthias Clasen
2ca9982b91 rect contour: Avoid nans in corner cases
The length of rect contours can be zero,
so we much check before we divide.
2023-08-27 19:17:02 -04:00
Matthias Clasen
a40282b2fb Add gsk_path_point_print
Another private debug API.
2023-08-27 19:06:39 -04:00
Matthias Clasen
ad9fb1e101 Improve quad and conic decomposition
If the control point is equal to either
start or end, just emit a line. This improves
the rendering of rounded rectangles with such
corners.
2023-08-27 16:57:03 -04:00
Matthias Clasen
02a9652af4 Use a more compact representation for circles
Print circles as M-o-o-o-o-z.
2023-08-27 14:32:21 -04:00
Matthias Clasen
6f823d2d0d gtk-demo: Add a few path benchmarks
The Tiger and Graph examples in the fishbowl test
path handling.
2023-08-27 12:59:10 -04:00
Matthias Clasen
a5c9cd5657 Merge branch 'rectangle-contour' into 'main'
Add a rectangle contour

See merge request GNOME/gtk!6351
2023-08-27 16:46:12 +00:00
Matthias Clasen
21ab5b6fa3 Merge branch 'matthiasc/for-main' into 'main'
Add a test for rectangle segments

See merge request GNOME/gtk!6352
2023-08-27 16:45:58 +00:00
Benjamin Otte
2582fd45e4 demos: Add cute maze demo 2023-08-27 12:45:25 -04:00
Matthias Clasen
0a28a5d53a Add a rectangle contour
Add a contour that optimizes some things for
rectangles. Also add rectangle detection to the
path parser, and add tests similar to what we
have for the other special contours.
2023-08-27 12:36:56 -04:00
Matthias Clasen
ddd4855bbc Add a test for rectangle segments 2023-08-27 12:36:30 -04:00
Matthias Clasen
204216e3d5 Merge branch 'matthiasc/for-main' into 'main'
Drop unused code

See merge request GNOME/gtk!6350
2023-08-27 16:19:16 +00:00
Matthias Clasen
1e6a124665 Correct the docs of gsk_path_builder_add_rect
The path does *not* always go clockwise!
2023-08-27 12:18:36 -04:00
Matthias Clasen
78c5aff956 Test special contours harder
Check that the start- and endpoint work
as expected and verify that their winding
numbers match the ones of the standard contour,
and are negated when the contour is reversed.
2023-08-27 11:47:40 -04:00
Matthias Clasen
8d1844135b path: Add a comment 2023-08-27 10:10:08 -04:00
Matthias Clasen
b5dd9dae0d rounded rect contour: Fix an oversight
The close operation takes 2 points, so our array
was one too short. Oops.
2023-08-27 10:09:32 -04:00
Matthias Clasen
ebcb518e4f Cosmetics 2023-08-27 09:50:16 -04:00
Matthias Clasen
b7ea22f168 Drop unused code
Nobody is calling gsk_contour_get_start_end, so drop
this internal API.
2023-08-27 09:39:59 -04:00
Matthias Clasen
f0b3381660 Merge branch 'rounded-rect-contour' into 'main'
path: Add a rounded rect contour

See merge request GNOME/gtk!6347
2023-08-27 13:36:53 +00:00
Matthias Clasen
0796c72049 Add roundtrip tests for rounded rect contours
These should survive roundtrips through the
path parser as well now.
2023-08-27 09:31:17 -04:00
Matthias Clasen
822e988efe path: Recognize rounded rects when parsing
We can look out for M-L-O-L-O-L-O-L-O-Z patterns
with matching numbers.
2023-08-27 09:31:17 -04:00
Matthias Clasen
cee043f977 Add a rounded rect contour
This special contour takes advantage of its
rounded-rect-ness for speeding up bounding
boxes and winding numbers. It falls back
to the standard contour code for everything
else.
2023-08-27 09:29:19 -04:00
Matthias Clasen
b420540b15 Merge branch 'matthiasc/for-main' into 'main'
Simplify the path spinner demo

See merge request GNOME/gtk!6349
2023-08-27 13:27:50 +00:00
Matthias Clasen
031c0ec3e5 pathpoint: Add some debug API
Add a private gsk_path_point_to_string that
can be called in the debugger if you want
to see the contents of a GskPathPoint and
are too lazy to cast it to GskRealPathPoint
yourself.
2023-08-27 09:14:47 -04:00
Matthias Clasen
43b6822eb0 Add roundtrip tests for special contours
So far, we only have a circle contour.
Check that it survives a roundtrip through
gsk_path_to_string and gsk_path_parse.
2023-08-27 09:14:03 -04:00
Matthias Clasen
ba3a657c48 contour: Add some debug API
Add a private  way to get the class of a contour,
so we can test that roundtrips through gsk_path_parse
work as expected.
2023-08-27 09:13:32 -04:00
Matthias Clasen
5f2f116c28 circle contour: Fix a typo 2023-08-27 07:43:55 -04:00
Matthias Clasen
1db75e521d Simplify the path spinner demo
The transforms were obscuring a simple
calculation here.
2023-08-27 07:43:55 -04:00
Matthias Clasen
2297a353b8 Merge branch 'circle-contour' into 'main'
path: Add a circle contour

See merge request GNOME/gtk!6345
2023-08-27 11:12:51 +00:00
Matthias Clasen
80903e5f44 Merge branch 'bilelmoussaoui/gi' into 'main'
gi: Add missing since annotation

See merge request GNOME/gtk!6348
2023-08-27 11:05:31 +00:00
Bilal Elmoussaoui
7342ce5bca gi: Add missing since annotation 2023-08-27 08:17:00 +00:00
Matthias Clasen
167b38dfa1 contour: Some reactoring
Make a default print implementation, and use it.
2023-08-26 23:42:52 -04:00
Matthias Clasen
ead88c36ec path: Add circle tests 2023-08-26 23:42:52 -04:00
Matthias Clasen
b8a3d7fa00 path: Recognize circles when parsing
We can look out for the tell-tale
M-O-O-O-O-Z and turn it into a circle
contour.
2023-08-26 23:42:52 -04:00
Matthias Clasen
0fce24674a path: Add a circle contour
This special contour takes advantage of the
circle definition to speed up things like
hit testing and closest point determination.
2023-08-26 23:42:52 -04:00
Zander Brown
739084e9bc tooltip: don't cross native boundaries
When walking the tree looking for tooltips we shouldn't cross from, say,
a popover to it's parent window

Fix: https://gitlab.gnome.org/GNOME/gtk/-/issues/1234
Fix: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1038
Fix: https://gitlab.gnome.org/GNOME/gtk/-/issues/5998
Fix: https://gitlab.gnome.org/GNOME/nautilus/-/issues/3063
See: https://gitlab.gnome.org/GNOME/console/-/issues/318
2023-08-27 02:36:51 +01:00
Matthias Clasen
99ad585252 Merge branch 'measure-speedups' into 'main'
contour: Stop doing the roundtrip test

See merge request GNOME/gtk!6342
2023-08-27 01:13:41 +00:00
Matthias Clasen
949b6692ac Merge branch 'matthiasc/for-main' into 'main'
Drop unused code

See merge request GNOME/gtk!6344
2023-08-26 16:46:49 +00:00
Piotr Drąg
eb0479d8ed Update POTFILES.in and POTFILES.skip 2023-08-26 17:52:22 +02:00
Matthias Clasen
6defdb4e8a Drop unused code
we are not using any gsk_spline functions currently.
2023-08-26 11:29:09 -04:00
Matthias Clasen
9fdad6d4ee Make randomized path tests less precise
Bump the epsilon in test_split to make these
tests survive longer. They still fail eventually,
unfortunately.
2023-08-26 11:23:02 -04:00
Matthias Clasen
b6e285844f Make curve tests pass 2023-08-26 11:22:58 -04:00
Matthias Clasen
c989a06718 pathmeasure: compute samples on demand
Only do the work for a curve the first time
we need it. This should greatly speed up
use cases where you only create a measure
to get the length of the path.
2023-08-26 10:23:02 -04:00
Matthias Clasen
1c8bd8658d curve: Cosmetics 2023-08-26 10:23:02 -04:00
Matthias Clasen
ab50cba4e9 curve: Reduce the order of our approximation
Use 24 samples instead of 32.
2023-08-26 10:23:02 -04:00
Matthias Clasen
57918813e2 contour: Stop doing the roundtrip test
Doing inverse arclength computations is
a very high overhead operation. And the
tests still pass without it.
2023-08-26 09:39:49 -04:00
Matthias Clasen
a4df8d8818 Merge branch 'path-node-tests' into 'main'
css: Replace border rendering code with GskPath

See merge request GNOME/gtk!6341
2023-08-26 12:13:04 +00:00
Matthias Clasen
4b00cfc1ce Merge branch 'macos_ci' into 'main'
Disable macOS CI for forks

See merge request GNOME/gtk!6337
2023-08-26 11:43:57 +00:00
Matthias Clasen
889688c978 Add more fill and stroke node tests 2023-08-26 07:39:23 -04:00
Matthias Clasen
0bf1ae033d Document node format for stroke and fill nodes 2023-08-26 07:39:23 -04:00
Jordi Mas
994afcaeed Update Catalan translation 2023-08-26 09:50:31 +02:00
Matthias Clasen
b69cc832ef Merge branch 'path-tool-restrict' into 'main'
path-tool: Add a restrict command

See merge request GNOME/gtk!6340
2023-08-26 04:24:06 +00:00
Matthias Clasen
81c8d1dd28 path-tool: Add length to info output
This requires GskPathMeasure.
2023-08-25 22:26:54 -04:00
Matthias Clasen
32d00ca9ed path-tool: Add a restrict command
This lets you subset a path between two given lengths.
2023-08-25 22:26:54 -04:00
René de Hesselle
2782daadb4 ci: Do not create macOS jobs for forks
The runner is not available in forks (on purpose / for security
reasons), so jobs created there will be stuck indefinitely until they
timeout and fail the pipeline, which is undesireable.

That also means that the initial goal to enable macOS jobs for all MRs
is out of reach: if you are an external contributor (read: non-project
member), your MR pipelines run in your fork, therefore have no access
to the runner.
2023-08-26 01:56:59 +02:00
Lukáš Tyrychtr
02cdb36421 Document what to do if the preconditions can not be met 2023-05-22 12:22:18 +02:00
Lukáš Tyrychtr
b3d4d70bc1 GtkEditable: Document the usage restrictions of gtk_editable_delegate_get_accessible_platform_state
The API is not always useful, because it depends on the position of the
delegated to widget in the widget tree, so document that.
2023-05-22 12:22:18 +02:00
Lukáš Tyrychtr
afbcbb8404 a11y: When a menu item opens a submenu, set its expandable state
To help distinguish submenu opening items, mark them as expandable.
Previously, they only indicated that they had a popup, which is too general.
2023-04-19 11:18:48 +02:00
Peter Williams
90183b3588 gdk/macos: fix builds on macOS before 10.13
Nothing profound here, just need to get some of the workarounds
into the right places.
2023-04-10 14:21:49 -04:00
Jonas Dreßler
e5ffbb19c0 gdk/wayland: Proivde latest touch serial even after a touch ended
When grabbing the seat for an xdg popup using xdg_popup_grab() in response
to a touch-end event, we request the grab a little late and the touch is no
longer being tracked by gdkseat. This means that
_gdk_wayland_seat_get_last_implicit_grab_serial() right now can not provide
us with the serial for that touchpoint, because that serial was stored on
the GdkWaylandTouchData that is already gone.

To still provide the compositor a valid serial in that case, store the
serial of the latest touchpoint more persistently in GdkWaylandSeat itself,
so that we can still access it when the touchpoint has already ended.
2023-04-03 15:12:55 +02:00
Campbell Jones
5c00dc7ef4 GdkSurface: prevent popups from appearing offscreen in edge cases
This commit adds a single additional condition to the maybe_flip_position
function in gdksurface.c. If a popup's unflipped position is below the
bounds of its containing area, the popup uses its flipped position
instead. This prevents tooltips from appearing below the bounds of the
screen when a small widget is positioned very close to the bottom edge of
the screen, such as in Budgie and XFCE panel applets.
2023-01-07 11:08:33 -05:00
Maxim Zakharov
715c0bfc0a gdk/broadway: Port !2972 and !3130 from gtk3
!2972 fixes touchscreen events processing
 !3130 adds support for Android/Chrome on-screen keyboard
2022-02-11 09:29:57 +11:00
1346 changed files with 158941 additions and 75663 deletions

View File

@@ -1,4 +1,4 @@
# See https://wiki.apertis.org/Guidelines/Coding_conventions#Code_formatting
# See https://www.apertis.org/policies/coding_conventions/#code-formatting
BasedOnStyle: GNU
AlwaysBreakAfterDefinitionReturnType: All
BreakBeforeBinaryOperators: None

View File

@@ -26,7 +26,7 @@ variables:
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled -Dbuild-testsuite=true -Dintrospection=enabled"
MESON_TEST_TIMEOUT_MULTIPLIER: 3
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v48"
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v49"
workflow:
rules:
@@ -66,7 +66,8 @@ style-check-diff:
junit:
- "${CI_PROJECT_DIR}/_build/report-x11.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland_gles.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland_gl.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland_gles2.xml"
- "${CI_PROJECT_DIR}/_build/report-broadway.xml"
name: "gtk-${CI_COMMIT_REF_NAME}"
paths:
@@ -77,6 +78,7 @@ style-check-diff:
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*/*.node"
- "${CI_PROJECT_DIR}/_build/testsuite/tools/output/*/*"
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*/*.png"
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*/*.node"
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*/*.syscap"
- "${CI_PROJECT_DIR}/_build/testsuite/headless/*/*.log"
- "${CI_PROJECT_DIR}/_build_hello/meson-logs"
@@ -103,8 +105,9 @@ fedora-x86_64:
${FEATURE_FLAGS}
_build
- meson compile -C _build
- .gitlab-ci/run-tests.sh _build wayland
- .gitlab-ci/run-tests.sh _build wayland_gles
- .gitlab-ci/run-tests.sh _build x11 gtk
# only repeat test runs that are likely affected by test setups
- .gitlab-ci/run-tests.sh _build wayland_gl gtk:gdk,gtk:gsk-gl
release-build:
extends: .build-fedora-default
@@ -129,7 +132,9 @@ release-build:
- meson install -C _build
- PKG_CONFIG_PATH=${CI_PROJECT_DIR}/_install/lib64/pkgconfig:${CI_PROJECT_DIR}/_install/share/pkgconfig meson setup _build_hello examples/hello
- LD_LIBRARY_PATH=${CI_PROJECT_DIR}/_install/lib64 meson compile -C _build_hello
- .gitlab-ci/run-tests.sh _build x11
- .gitlab-ci/run-tests.sh _build wayland gtk
# only repeat test runs that are likely affected by test setups
- .gitlab-ci/run-tests.sh _build wayland_gles2 gtk:gdk,gtk:gsk-gl
fedora-clang:
extends: .build-fedora-default
@@ -205,46 +210,54 @@ msys2-mingw64:
paths:
- "${CI_PROJECT_DIR}/_build/gtkdll.tar.gz"
macos-x86_64:
macos:
rules:
# run merge request pipelines
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
# do not run in forks
- if: $CI_PROJECT_NAMESPACE == "GNOME"
# Do not run in forks as the runner is not available there.
# (except for dehesselle who maintains the runner)
- if: $CI_PROJECT_NAMESPACE != "GNOME" && $CI_PROJECT_NAMESPACE != "dehesselle"
when: never
- if: $RUNNER == "macosintel"
variables:
SDKROOT: /opt/sdks/MacOSX10.13.4.sdk
NINJA_PKG: $CI_API_V4_URL/projects/30745/packages/generic/ninja_macos/v1.11.1.1+9/ninja-1.11.1.1-cp38-cp38-macosx_11_0_x86_64.whl
when: manual
allow_failure: true
- if: $RUNNER == "macosarm"
variables:
SDKROOT: /opt/sdks/MacOSX11.3.sdk
NINJA_PKG: ninja==1.11.1.1
stage: build
parallel:
matrix:
- RUNNER: [ "macosintel", "macosarm" ]
tags:
- macosintel
- ${RUNNER}
needs: []
variables:
MESON_FORCE_BACKTRACKE: 1
EXTRA_MESON_FLAGS: ""
BACKEND_FLAGS: "-Dx11-backend=false -Dbroadway-backend=true"
FEATURE_FLAGS: "-Dmedia-gstreamer=disabled -Dintrospection=enabled -Dgobject-introspection:werror=false"
TMPDIR: /Users/Shared/work/tmp
SDKROOT: /opt/sdks/MacOSX10.13.4.sdk
CCACHE_DIR: /Users/Shared/work/ccache
PIP_CACHE_DIR: /Users/Shared/build/cache
PIPENV_CACHE_DIR: $PIP_CACHE_DIR
PYTHONPYCACHEPREFIX: $PIP_CACHE_DIR
before_script:
- bash .gitlab-ci/show-info-osx.sh
- .gitlab-ci/show-info-macos.sh
- python3 -m venv .venv
- ln -s /opt/cmake/CMake.app/Contents/bin/cmake .venv/bin
- ln -s /opt/ccache/ccache .venv/bin
# Building the introspection feature requires pkg-config and bison.
- curl -L $CI_API_V4_URL/projects/30437/packages/generic/pkgconfig/v0.29.2+10/pkg-config-0.29.2+10_$(uname -m).tar.xz | tar -C .venv -xJ
- curl -L $CI_API_V4_URL/projects/30438/packages/generic/bison/v3.8.2+3/bison-3.8.2+3_$(uname -m).tar.xz | tar -C .venv -xJ
- source .venv/bin/activate
- pip3 install meson==1.2.0
- pip3 install ninja==1.11.1
- pip3 install meson==1.3.2 $NINJA_PKG
# We're not setting up ccache here on purpose as it accelerates the build
# so much that it triggers race conditions in the gobject-introspection
# subproject.
script:
- meson setup ${COMMON_MESON_FLAGS}
-Dx11-backend=false
-Dbroadway-backend=true
-Dmacos-backend=true
-Dmedia-gstreamer=disabled
-Dintrospection=disabled
-Dcpp_std=c++11
-Dpixman:tests=disabled
-Dlibjpeg-turbo:simd=disabled
-Dbuild-demos=false
-Dbuild-tests=false
-Dbuild-examples=false
-Dbuild-testsuite=false
- meson setup
${COMMON_MESON_FLAGS}
${EXTRA_MESON_FLAGS}
${BACKEND_FLAGS}
${FEATURE_FLAGS}
_build
- meson compile -C _build
artifacts:
@@ -418,13 +431,7 @@ asan-build:
-Df16c=disabled
_build
- ninja -C _build
- .gitlab-ci/run-tests.sh _build wayland
- .gitlab-ci/run-tests.sh _build wayland_gles
- .gitlab-ci/run-tests.sh _build x11
artifacts:
when: always
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
- .gitlab-ci/run-tests.sh _build wayland gtk
reference:
image: $FEDORA_IMAGE
@@ -474,3 +481,4 @@ publish-docs:
- "curl -X POST -F token=${PAGES_TRIGGER_TOKEN} -F ref=docs-gtk-org https://gitlab.gnome.org/api/v4/projects/665/trigger/pipeline"
rules:
- if: $CI_COMMIT_REF_NAME == "main"

View File

@@ -1,9 +1,7 @@
FROM fedora:38
FROM fedora:39
RUN dnf -y install \
adwaita-icon-theme \
atk-devel \
at-spi2-atk-devel \
avahi-gobject-devel \
cairo-devel \
cairo-gobject-devel \
@@ -18,7 +16,6 @@ RUN dnf -y install \
dejavu-sans-mono-fonts \
desktop-file-utils \
diffutils \
docbook-style-xsl \
elfutils-libelf-devel \
expat-devel \
fribidi-devel \

View File

@@ -27,7 +27,7 @@ flatpak build ${builddir} meson \
-Ddemo-profile=devel \
_flatpak_build
flatpak build ${builddir} ninja -C _flatpak_build install
flatpak build --env=CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA ${builddir} ninja -C _flatpak_build install
flatpak-builder \
--user --disable-rofiles-fuse \

View File

@@ -324,7 +324,7 @@ for line in args.infile:
units.append(unit)
report = {}
report['date'] = datetime.datetime.utcnow()
report['date'] = datetime.datetime.now(datetime.UTC)
report['locale_date'] = report['date'].strftime("%c")
report['project_name'] = args.project_name
report['backend'] = args.backend

View File

@@ -44,7 +44,7 @@ outfile = args.output
testsuites = ET.Element('testsuites')
testsuites.set('id', '{}/{}'.format(args.job_id, args.branch))
testsuites.set('package', args.project_name)
testsuites.set('timestamp', datetime.datetime.utcnow().isoformat(timespec='minutes'))
testsuites.set('timestamp', datetime.datetime.now(datetime.UTC).isoformat(timespec='minutes'))
suites = {}
for line in args.infile:

View File

@@ -1,28 +1,31 @@
#!/bin/bash
set +x
set -x
set +e
srcdir=$( pwd )
builddir=$1
backend=$2
setup=$2
suite=$3
multiplier=${MESON_TEST_TIMEOUT_MULTIPLIER:-1}
# Ignore memory leaks lower in dependencies
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp:print_suppressions=0:detect_leaks=0:allocator_may_return_null=1
export G_SLICE=always-malloc
case "${backend}" in
x11)
case "${setup}" in
x11*)
xvfb-run -a -s "-screen 0 1024x768x24 -noreset" \
meson test -C ${builddir} \
--quiet \
--timeout-multiplier "${multiplier}" \
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--setup=${setup} \
--suite=${suite//,/ --suite=} \
--no-suite=failing \
--no-suite=${setup}_failing \
--no-suite=flaky \
--no-suite=headless \
--no-suite=gsk-compare-broadway
# Store the exit code for the CI run, but always
@@ -41,18 +44,19 @@ case "${backend}" in
--quiet \
--timeout-multiplier "${multiplier}" \
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--setup=${setup} \
--suite=${suite//,/ --suite=} \
--no-suite=failing \
--no-suite=${setup}_failing \
--no-suite=flaky \
--no-suite=${backend}_failing \
--no-suite=headless \
--no-suite=gsk-compare-broadway
exit_code=$?
kill ${compositor}
;;
broadway)
broadway*)
export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
${builddir}/gdk/broadway/gtk4-broadwayd :5 &
@@ -63,17 +67,19 @@ case "${backend}" in
--quiet \
--timeout-multiplier "${multiplier}" \
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--setup=${setup} \
--suite=${suite//,/ --suite=} \
--no-suite=failing \
--no-suite=${setup}_failing \
--no-suite=flaky \
--no-suite=headless \
--no-suite=gsk-compare-opengl
kill ${server}
;;
*)
echo "Failed to add ${backend} to .gitlab-ci/run-tests.sh"
echo "Failed to add ${setup} to .gitlab-ci/run-tests.sh"
exit 1
;;
@@ -83,17 +89,17 @@ cd ${builddir}
$srcdir/.gitlab-ci/meson-junit-report.py \
--project-name=gtk \
--backend="${backend}" \
--backend="${setup}" \
--job-id="${CI_JOB_NAME}" \
--output="report-${backend}.xml" \
"meson-logs/testlog-${backend}.json"
--output="report-${setup}.xml" \
"meson-logs/testlog-${setup}.json"
$srcdir/.gitlab-ci/meson-html-report.py \
--project-name=gtk \
--backend="${backend}" \
--backend="${setup}" \
--job-id="${CI_JOB_NAME}" \
--reftest-output-dir="testsuite/reftests/output/${backend}" \
--output="report-${backend}.html" \
"meson-logs/testlog-${backend}.json"
--reftest-output-dir="testsuite/reftests/output/${setup}" \
--output="report-${setup}.html" \
"meson-logs/testlog-${setup}.json"
exit $exit_code

View File

@@ -3,6 +3,11 @@
set -eux -o pipefail
xcodebuild -version || :
xcodebuild -showsdks || :
if [ -z "$SDKROOT" ]; then
xcodebuild -showsdks || :
else
echo "SDKROOT = $SDKROOT"
fi
system_profiler SPSoftwareDataType || :

View File

@@ -6,7 +6,7 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliar
:: FIXME: make warnings fatal
pip3 install --upgrade --user meson~=0.64 || goto :error
meson setup -Dbackend_max_links=1 -Ddebug=false -Dmedia-gstreamer=disabled _build || goto :error
meson setup -Dbackend_max_links=1 -Ddebug=false -Dmedia-gstreamer=disabled -Dvulkan=disabled _build || goto :error
ninja -C _build || goto :error
goto :EOF

View File

@@ -33,7 +33,9 @@ pacman --noconfirm -S --needed \
mingw-w64-$MSYS2_ARCH-gst-plugins-bad-libs \
mingw-w64-$MSYS2_ARCH-shared-mime-info \
mingw-w64-$MSYS2_ARCH-python-gobject \
mingw-w64-$MSYS2_ARCH-shaderc
mingw-w64-$MSYS2_ARCH-shaderc \
mingw-w64-$MSYS2_ARCH-vulkan \
mingw-w64-$MSYS2_ARCH-vulkan-headers
mkdir -p _ccache
export CCACHE_BASEDIR="$(pwd)"
@@ -43,11 +45,10 @@ export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
ccache --zero-stats
ccache --show-stats
export CCACHE_DISABLE=true
meson \
meson setup \
-Dx11-backend=false \
-Dwayland-backend=false \
-Dwin32-backend=true \
-Dvulkan=disabled \
-Dintrospection=enabled \
-Dgtk:werror=true \
_build

View File

@@ -35,8 +35,7 @@ The issue tracker is meant to be used for actionable issues only.
You should not open a new issue for security related questions.
When in doubt, send an email to the [security](mailto:security@gnome.org)
mailing list.
When in doubt, follow [security](https://security.gnome.org/).
### Bug reports
@@ -214,7 +213,7 @@ Closes #1234
`git commit -a --author "Joe Coder <joe@coder.org>"` and `--signoff`.
- If your commit is addressing an issue, use the
[GitLab syntax](https://docs.gitlab.com/ce/user/project/issues/automatic_issue_closing.html)
[GitLab syntax](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
to automatically close the issue when merging the commit with the upstream
repository:
@@ -244,13 +243,11 @@ people committing to GTK to follow a few rules:
code, you should always ask. If your change is minor and you've been
working on GTK for a while it probably isn't necessary to ask. But when
in doubt, ask. Even if your change is correct, somebody may know a
better way to do things. If you are making changes to GTK, you should
be subscribed to the [gtk-devel](https://mail.gnome.org/mailman/listinfo/gtk-devel-list)
mailing list; this is a good place to ask about intended changes.
The `#gtk` IRC channel on irc.gnome.org is also a good place to find GTK
developers to discuss changes, but if you live outside of the EU/US time
zones, an email to the gtk-devel mailing list is the most certain and
preferred method.
better way to do things.
The `gtk` [room on matrix](https://matrix.to/#/#gtk:gnome.org) is also a
good place to find GTK developers to discuss changes, but if you live
outside of the EU/US time zones, the [gtk tag on the GNOME Discourse instance](https://discourse.gnome.org/tag/gtk)
is the most certain and preferred method.
0. Ask _first_.

640
NEWS
View File

@@ -1,6 +1,636 @@
Overview of Changes in 4.13.1, xx-xx-xxxx
Overview of Changes in 4.15.0, xx-xx-xxxx
=========================================
Overview of Changes in 4.14.2, 03-04-2024
=========================================
* GtkScale:
- Improve positioning of values in some cases
* Theme:
- Make progress in entries visible
* Accessibility:
- Fix text insertion handling
* GDK:
- dnd: Use the default cursor durion motion
- dnd: Use a better cursor for indicating the move action
* GSK:
- gl: Handle offloads in offscreen context better
- Fix text rendering problems with some fonts
* Wayland:
- Tighten up some protocol version checks
- Use the presentation time protocol
- Fix a crash with subsurfaces
- Improve settings portal handling
* macOS:
- Fix up the app menu support
* Windows:
- Fix problems with minimization
- Fix build without fontconfig
* Debugging:
- Add font settings in the inspector
* Demos:
- Clean up the application demo
- Update cursor images for the cursor demo
* Translation updates:
Catalan
Czech
French
Georgian
Hebrew
Persian
Slovenian
Turkish
Ukrainian
Overview of Changes in 4.14.1, 16-03-2024
=========================================
* GtkTextView:
- Fix a mixup of cursor and anchor when retrieving surrounding text
in input methods
* Printing:
- Avoid accessing freed printers
* Accessibility:
- Fix memory leaks
* GDK:
- Rename the GDK_VULKAN_SKIP environment variable to GDK_VULKAN_DISABLE
- Add a GDK_GL_DISABLE environment variable
* GSK:
- Rename the GSK_GPU_SKIP environment variable to GSK_GPU_DISABLE
- Speed up handling of repeated ops, which should help for text
- Speed up the inner loop of text node conversion
- Drop the glyph-align optimization flag
- ngl: Avoid reusing frames while they are in use
- Fix flickering thumbnails in nautilus
- Speed up buffer handling in both ngl and Vulkan
* Demos:
- Skip demos using gl shaders when we're not using the gl renderer
* Build:
- Fix some ubsan warnings
- Avoid zink in ci since it spams stderr
* Translation updates:
Czech
German
Korean
Russian
Overview of Changes in 4.14.0, 12-03-2024
=========================================
Note: The new renderers and dmabuf support are using graphics drivers
in different ways than the old gl renderer, and trigger new driver bugs,
(see for example https://gitlab.gnome.org/GNOME/gtk/-/issues/6418 and
https://gitlab.gnome.org/GNOME/gtk/-/issues/6388). Therefore, it is
recommended to use the latest mesa release (24.x) with the new renderers.
* GtkTextView:
- Don't snapshot children twice
- Don't blink the cursor when hidden
* GtkEmojiChooser:
- Fix presentation selector handling
* GtkSnapshot:
- Fix wrong nodes with transformed shadows
* GtkIMContext:
- Make gtk_im_context_activate_osk public
* Accessibility:
- Implement get_contents_at for all our text widgets
- Add GtkAccessibleText.get_default_attributes
* GSK:
- Don't fall back to cairo for software rendering. gl+llvmpipe is better
- Round vertical glyph position to a device pixel position if the font is hinted
- Fix problems with clip handling
- Make vulkan and ngl match their font handling
- Fix some corner-cases with offloading and clips
- Fix problem with rendering of missing glyphs in hinted fonts
* MacOs:
- Implement cursor-from-texture
* Translation updates:
Basque
British English
French
Indonesian
Kazakh
Latvian
Lithuanian
Norwegian Bokmål
Slovenian
Spanish
Turkish
Overview of Changes in 4.13.9, 02-03-2024
=========================================
* GtkEditable:
- Fix preconditions to be not too strict
* GtkEmojiChooser:
- Support search in the locale as well as in English
* GtkIconTheme:
- Make gtk_icon_paintable_new_for_file support symbolics
* GtkVideo:
- Fix a problem with cursor handling that could lead to crashes
* Accessibility:
- Fix GetCharacterAtOffset implementation
- Add a Terminal role
- Make TextCaretMoved match gtk3
- Support multiple levels of GtkEditable delegates
* GSK:
- Make the node parser more flexible for text nodes
- Change the way font scaling is handled to avoid clipping
- Fix handling of missing glyphs in the new renderers
* X11:
- Don't claim to support shadows without a compositor
* Wayland:
- Fix handling of output scales
* Tools:
- Add a compare command to gtk4-rendernode-tool
* Build:
- Fix some ubsan complaints
* Translation updates:
Basque
British English
Catalan
Finnish
Galician
Georgian
Hebrew
Indonesian
Kazakh
Latvian
Lithuanian
Persian
Polish
Russian
Slovenian
Spanish
Turkish
Ukrainian
Overview of Changes in 4.13.8, 20-02-2024
=========================================
* Accessibility:
- Add a GtkAccessibleText interface for allowing 3rd party
text widgets (notably vte) to be accessible
- Avoid duplicate accessible descriptions
- Fix GetAccessibleAtPoint
* GSK:
- Avoid offscreens for disjoint containers
- Don't use the gpu renderers with llvmpipe
- Fix various rendering issues found by tests
- Allow unnormalized node bounds again
- Fix a broken case of rounded-rect intersection
- Fix handling of external textures in gpu renderers
- Make gpu renderers work with WGL on Windows
* build:
- Allow building without dmabuf support on (old) Linux
* X11:
- Fix monitor enter/leave signals
* Translation updates:
Basque
Brazilian Portuguese
Catalan
Czech
Galician
Georgian
Hebrew
Lithuanian
Persian
Russian
Turkish
Ukrainian
Overview of Changes in 4.13.7, 11-02-2024
=========================================
* GtkFileChooser:
- Speed up opening
* GtkCalendar:
- Add some missing setters and getters
* Accessibility:
- Add socket support for webkit accessibility
- Implement AT-SPI text for GtkText
- Implement AT-SPI component generically
- Add an announce API
* GSK:
- Make the ngl renderer work on macOS
- Fix a crash in the vulkan renderer
- Make nodeparser allow aliases for fonts again
- Implement cache eviction for glyph and texture caches
- Fix ngl shaders to work on GL < 4.0
- Require GL 3.3 for the ngl renderer
- Fix problems with scaled shadows
- Fix problems with holes for underlaid subsurfaces
- Improve handling of scales and glyph cache efficiency
* Media:
- Support dmabufs in the gstreamer backend. This allows
zero-copy video playback on Wayland when paired with
hardware video decoding
- Drop the experimental ffmpeg backend. It hasn't been
building for a year
* Wayland:
- Commit empty frames if and double-buffered state is pending
- Fix monitor size information when using mutter without
the scale-monitor-framebuffer setting
- Clear the current tablet on tab leave, fixing a crash
* macOS:
- Propagate unhandled input events back to the OS
* Tools:
- Make the crash handling in gtk4-node-editor more robust
* Translation updates
Galician
Georgian
Occitan
Turkish
Overview of Changes in 4.13.6, 25-01-2024
=========================================
This release changes the ngl renderer to be the default renderer.
The intent of this change is to get wider testing and verify that
the new renderers are production-ready. If significant problems
show up, we will revert this change for 4.14.
You can still override the renderer choice using the GSK_RENDERER
environment variable.
Since ngl can handle fractional scaling much better than the old gl
renderer, we allow fractional scaling by default with gl now. If you
are using the old gl renderer (e.g. because your system is limited to
GLES2), you can disable fractional scaling by setting the GDK_DEBUG
environment variable to include the gl-no-fractional key.
* GtkColumnView:
- Fix infinite loops in dispose
- Fix problems with weak ref cycles in GtkExpression
* GtkListView:
- Fix some corner cases with sections during insertions and deletions
- Don't double-recycle widgets
* GtkStack:
- Add automatic cleanup for GtkStackPage
* GDK:
- Use standard cursor names for drag cursors
- Enable fractional scaling with gl by default
* GSK:
- Many fixes and improvements to the unified renderers:
- Fix text rendering with the uber shader
- Fix rounding issues with fractional scales
- Fix some memory leaks
- Many text rendering fixes
- Implement subpixel positioning for glyphs
- Support custom fonts in node files
- Add tests for font rendering
- Fix drawing of repeat nodes
- Implement subpixels positioning
- Evict stale textures, glyphs and atlases from the cache
- Some fixes and improvements to the GL renderer:
- Fix problems with GLES on Nvidia
- Avoid a crash in the mask demo
- Respect opacity of the first child node in containers
- Some fixes and improvements to the fallback renderer:
- Fix drawing of repeat nodes
- Make ngl the default renderer
* Wayland:
- Fix problems with tablet cursors
- Fix problems without seats
* Accessibility:
- Respect a separate "show-status-shapes setting
- Fix change notification for accessible names on some widgets
* Inspector:
- Show the git commit in devel builds
* Tools:
- Make gtk4-node-editor autosave its contents
- Add a benchmark command to gtk4-rendernode-tool
* Translation updates:
French
Galician
Georgian
Occitan
Persian
Russian
Vietnamese
Overview of Changes in 4.13.5, 07-01-2024
=========================================
This release adds two new GSK renderers called vulkan and ngl,
that are built from the same sources. The new renderers can
handle many corner cases correctly that the current gl renderer
does not handle, and they offer advantages such as antialiasing
and supersampled gradients.
The new renderers are still considered experimental, and GTK
will only use them if they are explicitly selected using the
GSK_RENDERER environment variable.
As part of this work, the GSK include files have been rearranged.
It is no longer necessary to include renderer-specific headers for
ngl and vulkan (and doing so will trigger deprecation warnings),
and their constructors are always available.
The previously available experimental GdkVulkanContext APIs and
the old Vulkan renderer have been removed.
Vulkan is now enabled by default, and Linux distributions should
build GTK with Vulkan support. This requires the glslc shader
compiler as a new dependency.
Vulkan is now also used for dmabuf support.
* GtkDropdown:
- Fix display of initial selection
* GtkShortcutsWindow:
- Make the window adapt to smaller screen widths
* GtkTextView:
- Fix a possible NULL dereference in history
* GDK:
- Make the png loader safer against overflows
* GL:
- Fix some errors in handling of texture formats and mipmaps
Overview of Changes in 4.13.4, 30-12-2023
=========================================
* GtkFileDialog:
- Return an error if no file is selected
* GtkFileLauncher:
- Add a writable property
* GtkFileChooserNative:
- Make closing portal file dialogs work
* GtkEmojiChooser:
- Update Emoji data to CLDR v43
* GtkStringList:
- Add item-type and n-itmes properties
* Input:
- Respect GTK grabs on DND events
- Fix crossing event generation for enter/leave
* Wayland:
- Avoid recreating wl_buffers needlessly
- Be more careful when loading cursors
* Dmabuf:
- Add support for all Dmabuf formats
- Tweak the offload code a bit, allow offloading translucent
textures, as long as they are raised. Decline to offload
with fractional scales.
* Accessibility:
- Add a few more accessible roles
* GL:
- Use GLES by default
- Tweak GDK_DEBUG values. The new values are
gl-disable-gl, gl-disable-gles and gl-prefer-gl.
The gl-legacy and nograbs values have been dropped.
* Css:
- Reduce memory consumption during theme loading
- Fix opacity handling
* Theme:
- Refresh some of the included symbolic icons
* MacOs:
- Silence secure-restore message
* Build:
- Require Vulkan 1.3
* Translation updates:
Chinese (China)
Czech
Hebrew
Icelandic
Polish
Russian
Overview of Changes in 4.13.3, 15-11-2023
=========================================
* GtkGraphicsOffload: A new widget to support passthrough
of dmabuf textures with subsurfaces on Wayland
* GtkListView:
- reduce tree indentation
* GtkInspector:
- Show more GL information
- Add a subsurface overlay
- Improve the fps overlay
* GDK
- Allow implicit modifiers for dmabufs
- Support more dmabuf formats: NV16, NV61, NV24, NV42
and 3-plane YUV formats
* GSK
- Fix padding of icons in the GL atlas
- Fix handling of texture-scale nodes in cairo
- Treat texture-scale nodes more faithfully in GL
* Accessibility:
- Tweak the accessible name computation for corner cases
* The GTK/GDK/GSK_DEBUG environment variables now
work in productions as well as in debug builds
* Translation updates
Catalan
French
Russian
Overview of Changes in 4.13.2, 22-10-2023
=========================================
* GtkPrintdialog:
- New async-style api to replace GtkPrintOperation
* GtkEmojiChooser:
- Add more languages: Bengali, Hindi, Japanese, Finnish,
Thai and Norwegian bokmål
* Accessibility:
- Fix some utf8 handling issues
* GDK:
- Add support for dmabuf textures, with GdkDmabufTextureBuilder
- Add a few more supported memory formats for textures
* GSK:
- Add a fast-path for masking color
- Add support for importing dmabuf textures
- Handle GLES better by using some extensions
* Translation updates:
Catalan
Russian
Turkish
Overview of Changes in 4.13.1, 28-09-2023
=========================================
* GtkTooltip:
- Don't cross native boundaries when looking for tooltips
* GtkCenterLayout, GtkEntry, GtkSearchEntry:
- Fix some issues with baseline handling
* GtkColorButton, GtkFontButton:
- Propagate focus-on-click
* GtkFileChooser:
- Make "Visit file" scroll to the file
* GtkSwitch:
- Respect text direction
* GtkWindow:
- Don't assume titlebars are GtkHeaderBars
* Printing:
- Fix some problems with the portal implementation
- Add a new simple print API: GtkPrintDialog
* Paths:
- GskPathMeasure performance has been improved
- Add custom contours for circles, rounded rectangles and rectangles
- Simplify GskPathPoint handling
- gsk_path_point_get_closest_point now returns the distance as well
- Make GskPathBuilder simplify curves
* Input:
- Handle (some) single-key compose sequences
- Fix active state tracking with sensitivity changes and grabs
* GSK:
- Make the repeated gradients match between GL and cairo
- Make rounded rect shrinking match between Vulkan, GL and cairo
- Fix parsing of text nodes with color glyphs
- Restrict an optimization to the cases where it is crrect
- Fix rendering of shadows with opacity
- The Vulkan renderer now requires Vulkan 1.2
- GL: Transition gradients unpremultiplied
- GL: Fix clipping of shadows
- GL: Some optimizations
- Broadway: Fix memory leaks in the renderer
* Wayland:
- Make activation more reliable
* macOS:
- Clamp damage regions to the surface size
* Tools:
- gtk4-path-tool gained restrict and reverse commands
- gtk4-path-tool show and render can show control points
* Demos:
- Add a demo for hit testing with paths
* Build:
- Fix build problems with C++ compilers
* Deprecations:
- gtk_window_present_with_time
* Translation updates
Brazilian Portuguese
British English
Catalan
Chinese (China)
Czech
Danish
Dutch
Esperanto
Galician
Georgian
Italian
Korean
Latvian
Lithuanian
Persian
Polish
Punjabi
Slovenian
Turkish
Overview of Changes in 4.13.0, 25-08-2023
=========================================
@@ -263,7 +893,7 @@ Overview of Changes in 4.11.4, 03-07-2023
- Center newly created transient windows
* Vulkan:
- Add antialising for gradients
- Add antialiasing for gradients
- Do less work on clipped away nodes
- Redo image uploading
- Support different image depths and formats
@@ -1247,7 +1877,7 @@ Overview of Changes in 4.7.0, 07-05-2022
- Event handling fixes
- Fix keyboard input on popovers
- Support OpenGL-based video playback
- Suport fullscreen
- Support fullscreen
- Improve native filechoooser size allocation
- Use CALayer and IOSurface for rendering
- Use a per-monitor CVDisplayLink
@@ -1644,7 +2274,7 @@ Overview of Changes in 4.4.0
- Activate when moving focus
* GtkLabel:
- Propertly ignore double underscores for mnemonics
- Properly ignore double underscores for mnemonics
* GtkPopoverMenu:
- Fix focus cycling
@@ -2191,7 +2821,7 @@ Overview of Changes in 4.1.0
- Set sort arrows in CSS
- Set menu button arrows in CSS
- Make scrollbars larger
- Supprt circular menubuttons
- Support circular menubuttons
* CSS:
- Implement transform-origin

View File

@@ -125,7 +125,7 @@ version, for example `gtk-4-10`.
How to report bugs
------------------
Bugs should be reported on the [issues page](https://gitlab.gnome.org/GNOME/gtk/issues/new).
Bugs should be reported on the [issues page](https://gitlab.gnome.org/GNOME/gtk/issues/).
In the bug report please include:

View File

@@ -185,7 +185,6 @@
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Ddemo-profile=devel"
],

View File

@@ -114,7 +114,6 @@
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Ddemo-profile=devel"
],

View File

@@ -114,7 +114,6 @@
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Ddemo-profile=devel"
],
@@ -131,7 +130,6 @@
"env" : {
"DBUS_SESSION_BUS_ADDRESS" : "''",
"GSK_RENDERER" : "opengl",
"GDK_DEBUG" : "vulkan-disable",
"G_ENABLE_DEBUG" : "true"
}
}

View File

@@ -114,7 +114,6 @@
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Ddemo-profile=devel"
],
@@ -131,7 +130,6 @@
"env" : {
"DBUS_SESSION_BUS_ADDRESS" : "''",
"GSK_RENDERER" : "opengl",
"GDK_DEBUG" : "vulkan-disable",
"G_ENABLE_DEBUG" : "true"
}
}

View File

@@ -0,0 +1,41 @@
#ifndef _MSC_VER
#pragma error "This header is for Microsoft VC or clang-cl only."
#endif /* _MSC_VER */
/* Make MSVC more pedantic, this is a recommended pragma list
* from _Win32_Programming_ by Rector and Newcomer.
*/
#ifndef __clang__
#pragma warning(error:4002) /* too many actual parameters for macro */
#pragma warning(error:4003) /* not enough actual parameters for macro */
#pragma warning(1:4010) /* single-line comment contains line-continuation character */
#pragma warning(error:4013) /* 'function' undefined; assuming extern returning int */
#pragma warning(1:4016) /* no function return type; using int as default */
#pragma warning(error:4020) /* too many actual parameters */
#pragma warning(error:4021) /* too few actual parameters */
#pragma warning(error:4027) /* function declared without formal parameter list */
#pragma warning(error:4029) /* declared formal parameter list different from definition */
#pragma warning(error:4033) /* 'function' must return a value */
#pragma warning(error:4035) /* 'function' : no return value */
#pragma warning(error:4045) /* array bounds overflow */
#pragma warning(error:4047) /* different levels of indirection */
#pragma warning(error:4049) /* terminating line number emission */
#pragma warning(error:4053) /* An expression of type void was used as an operand */
#pragma warning(error:4071) /* no function prototype given */
#pragma warning(disable:4101) /* unreferenced local variable */
#pragma warning(error:4150)
/* G_NORETURN */
#pragma warning(error:4646) /* function declared with __declspec(noreturn) has non-void return type */
#pragma warning(error:4715) /* 'function': not all control paths return a value */
#pragma warning(error:4098) /* 'void' function returning a value */
#pragma warning(disable:4244) /* No possible loss of data warnings */
#pragma warning(disable:4305) /* No truncation from int to char warnings */
#pragma warning(error:4819) /* The file contains a character that cannot be represented in the current code page */
#endif /* __clang__ */
/* work around Microsoft's premature attempt to deprecate the C-Library */
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_NONSTDC_NO_WARNINGS

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -35,7 +35,7 @@ show_action_dialog (GSimpleAction *action)
{
GtkAlertDialog *dialog;
dialog = gtk_alert_dialog_new ("You activated action: \"%s\n",
dialog = gtk_alert_dialog_new ("You activated action: \"%s\"",
g_action_get_name (G_ACTION (action)));
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
@@ -223,7 +223,7 @@ delete_messages (gpointer data)
static void
pop_message (GtkWidget *status)
{
GList *messages = (GList *) g_object_get_data (G_OBJECT (status), "messages");
GList *messages = (GList *) g_object_steal_data (G_OBJECT (status), "messages");
if (messages)
{
@@ -241,7 +241,7 @@ static void
push_message (GtkWidget *status,
const char *message)
{
GList *messages = (GList *) g_object_get_data (G_OBJECT (status), "messages");
GList *messages = (GList *) g_object_steal_data (G_OBJECT (status), "messages");
gtk_label_set_label (GTK_LABEL (status), message);
messages = g_list_prepend (messages, g_strdup (message));

View File

@@ -18,8 +18,7 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __BLUR_OVERLAY_H__
#define __BLUR_OVERLAY_H__
#pragma once
#include <gtk/gtk.h>
@@ -60,5 +59,3 @@ void blur_overlay_set_child (BlurOverlay *overlay,
GtkWidget *widget);
G_END_DECLS
#endif /* __BLUR_OVERLAY_H__ */

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 985 B

After

Width:  |  Height:  |  Size: 1019 B

View File

@@ -15,12 +15,54 @@ 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"));
@@ -29,6 +71,10 @@ 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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -116,6 +116,7 @@
<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>
@@ -127,6 +128,7 @@
<file>fishbowl.ui</file>
<file>gtkfishbowl.c</file>
<file>gtkfishbowl.h</file>
<file>tiger.node</file>
</gresource>
<gresource prefix="/frames">
<file>frames.ui</file>
@@ -336,6 +338,7 @@
<file>panes.c</file>
<file>password_entry.c</file>
<file>path_fill.c</file>
<file>path_maze.c</file>
<file>path_spinner.c</file>
<file>path_walk.c</file>
<file>path_text.c</file>

View File

@@ -75,7 +75,9 @@ query_tooltip (GtkWidget *widget,
gtk_grid_attach (GTK_GRID (grid), label, 0, 2, 1, 1);
precision = 1;
s = NULL;
do {
g_free (s);
s = g_strdup_printf ("%.*f", precision, self->scale);
l = strlen (s) - 1;
while (s[l] == '0')

View File

@@ -18,8 +18,7 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __DEMO_TAGGED_ENTRY_H__
#define __DEMO_TAGGED_ENTRY_H__
#pragma once
#include <gtk/gtk.h>
@@ -57,5 +56,3 @@ void demo_tagged_entry_tag_set_has_close_button (DemoTaggedEntryTag *
gboolean has_close_button);
G_END_DECLS
#endif /* __DEMO_TAGGED_ENTRY_H__ */

View File

@@ -34,7 +34,7 @@ transition (GtkWidget *widget,
{
DemoWidget *self = DEMO_WIDGET (widget);
DemoLayout *demo_layout = DEMO_LAYOUT (gtk_widget_get_layout_manager (widget));
gint64 now = g_get_monotonic_time ();
gint64 now = gdk_frame_clock_get_frame_time (frame_clock);
gtk_widget_queue_allocate (widget);
@@ -66,11 +66,13 @@ clicked (GtkGestureClick *gesture,
gpointer data)
{
DemoWidget *self = data;
GdkFrameClock *frame_clock;
if (self->tick_id != 0)
return;
self->start_time = g_get_monotonic_time ();
frame_clock = gtk_widget_get_frame_clock (GTK_WIDGET (self));
self->start_time = gdk_frame_clock_get_frame_time (frame_clock);
self->tick_id = gtk_widget_add_tick_callback (GTK_WIDGET (self), transition, NULL, NULL);
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -11,6 +11,9 @@
#include "gtkgears.h"
#include "gskshaderpaintable.h"
#include "nodewidget.h"
#include "graphwidget.h"
const char *const css =
".blurred-button {"
" box-shadow: 0px 0px 5px 10px rgba(0, 0, 0, 0.5);"
@@ -71,14 +74,7 @@ create_blurred_button (void)
static GtkWidget *
create_font_button (void)
{
GtkFontDialog *dialog;
GtkWidget *button;
dialog = gtk_font_dialog_new ();
button = gtk_font_dialog_button_new (dialog);
g_object_unref (dialog);
return button;
return gtk_font_dialog_button_new (gtk_font_dialog_new ());
}
static GtkWidget *
@@ -188,6 +184,12 @@ create_cogs (void)
return picture;
}
static gboolean
check_cogs (GtkFishbowl *fb)
{
return GSK_IS_GL_RENDERER (gtk_native_get_renderer (gtk_widget_get_native (GTK_WIDGET (fb))));
}
static void
mapped (GtkWidget *w)
{
@@ -208,36 +210,55 @@ create_menu_button (void)
return w;
}
static GtkWidget *
create_tiger (void)
{
return node_widget_new ("/fishbowl/tiger.node");
}
static GtkWidget *
create_graph (void)
{
return graph_widget_new ();
}
static const struct {
const char *name;
GtkWidget * (*create_func) (void);
GtkWidget * (* create_func) (void);
gboolean (* check) (GtkFishbowl *fb);
} widget_types[] = {
{ "Icon", create_icon },
{ "Button", create_button },
{ "Blurbutton", create_blurred_button },
{ "Fontbutton", create_font_button },
{ "Levelbar", create_level_bar },
{ "Label", create_label },
{ "Spinner", create_spinner },
{ "Spinbutton", create_spinbutton },
{ "Video", create_video },
{ "Gears", create_gears },
{ "Switch", create_switch },
{ "Menubutton", create_menu_button },
{ "Shader", create_cogs },
{ "Icon", create_icon, NULL },
{ "Button", create_button, NULL },
{ "Blurbutton", create_blurred_button, NULL },
{ "Fontbutton", create_font_button, NULL },
{ "Levelbar", create_level_bar, NULL },
{ "Label", create_label, NULL },
{ "Spinner", create_spinner, NULL },
{ "Spinbutton", create_spinbutton, NULL },
{ "Video", create_video, NULL },
{ "Gears", create_gears, NULL },
{ "Switch", create_switch, NULL },
{ "Menubutton", create_menu_button, NULL },
{ "Shader", create_cogs, check_cogs },
{ "Tiger", create_tiger, NULL },
{ "Graph", create_graph, NULL },
};
static int selected_widget_type = -1;
static const int N_WIDGET_TYPES = G_N_ELEMENTS (widget_types);
static void
static gboolean
set_widget_type (GtkFishbowl *fishbowl,
int widget_type_index)
{
GtkWidget *window;
if (widget_type_index == selected_widget_type)
return;
return TRUE;
if (widget_types[widget_type_index].check != NULL &&
!widget_types[widget_type_index].check (fishbowl))
return FALSE;
selected_widget_type = widget_type_index;
@@ -247,6 +268,8 @@ set_widget_type (GtkFishbowl *fishbowl,
window = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (fishbowl)));
gtk_window_set_title (GTK_WINDOW (window),
widget_types[selected_widget_type].name);
return TRUE;
}
G_MODULE_EXPORT void
@@ -254,14 +277,17 @@ fishbowl_next_button_clicked_cb (GtkButton *source,
gpointer user_data)
{
GtkFishbowl *fishbowl = user_data;
int new_index;
int new_index = selected_widget_type;
if (selected_widget_type + 1 >= N_WIDGET_TYPES)
new_index = 0;
else
new_index = selected_widget_type + 1;
do
{
if (new_index + 1 >= N_WIDGET_TYPES)
new_index = 0;
else
new_index = new_index + 1;
set_widget_type (fishbowl, new_index);
}
while (!set_widget_type (fishbowl, new_index));
}
G_MODULE_EXPORT void
@@ -269,14 +295,18 @@ fishbowl_prev_button_clicked_cb (GtkButton *source,
gpointer user_data)
{
GtkFishbowl *fishbowl = user_data;
int new_index;
int new_index = selected_widget_type;
if (selected_widget_type - 1 < 0)
new_index = N_WIDGET_TYPES - 1;
else
new_index = selected_widget_type - 1;
do
{
if (new_index - 1 < 0)
new_index = N_WIDGET_TYPES - 1;
else
new_index = new_index - 1;
set_widget_type (fishbowl, new_index);
}
while (!set_widget_type (fishbowl, new_index));
}
G_MODULE_EXPORT void

View File

@@ -600,8 +600,8 @@ update_display (void)
if (s->len > 0)
{
pango_font_description_set_variations (desc, s->str);
g_string_free (s, TRUE);
}
g_string_free (s, TRUE);
font_desc = pango_font_description_to_string (desc);
@@ -1586,7 +1586,7 @@ update_font_variations (void)
}
gtk_grid_attach (GTK_GRID (demo->variations_grid), combo, 1, -1, 3, 1);
g_signal_connect (combo, "notify::selecte", G_CALLBACK (instance_changed), NULL);
g_signal_connect (combo, "notify::selected", G_CALLBACK (instance_changed), NULL);
demo->instance_combo = combo;
}

View File

@@ -15,8 +15,7 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_FONT_PLANE_H__
#define __GTK_FONT_PLANE_H__
#pragma once
#include <gtk/gtk.h>
@@ -60,5 +59,3 @@ GtkWidget * gtk_font_plane_new (GtkAdjustment *width_adj,
GtkAdjustment *weight_adj);
G_END_DECLS
#endif /* __GTK_FONT_PLANE_H__ */

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,153 @@
#include "graphwidget.h"
struct _GraphWidget
{
GtkWidget parent_instance;
GskPath *path;
GskStroke *stroke;
GdkRGBA color;
guint tick_cb;
guint64 start_time;
double period;
double amplitude;
};
struct _GraphWidgetClass
{
GtkWidgetClass parent_class;
};
G_DEFINE_TYPE (GraphWidget, graph_widget, GTK_TYPE_WIDGET)
static void
update_path (GraphWidget *self,
float amplitude)
{
graphene_point_t p[20];
GskPathBuilder *builder;
g_clear_pointer (&self->path, gsk_path_unref);
for (int i = 0; i < 20; i++)
{
p[i].x = 10 * i;
p[i].y = 50;
if (i % 4 == 1 || i % 4 == 2)
{
if (i % 8 < 4)
p[i].y += amplitude;
else
p[i].y -= amplitude;
}
}
builder = gsk_path_builder_new ();
gsk_path_builder_move_to (builder, p[0].x, p[0].y);
for (int i = 0; i < 20; i += 4)
gsk_path_builder_cubic_to (builder,
p[i+1].x, p[i+1].y,
p[i+2].x, p[i+2].y,
p[i+3].x, p[i+3].y);
self->path = gsk_path_builder_free_to_path (builder);
}
static gboolean
tick_cb (GtkWidget *widget,
GdkFrameClock *frame_clock,
gpointer user_data)
{
GraphWidget *self = GRAPH_WIDGET (widget);
guint64 now;
double angle;
now = gdk_frame_clock_get_frame_time (frame_clock);
if (self->start_time == 0)
self->start_time = now;
angle = 360 * (now - self->start_time) / (double)(self->period * G_TIME_SPAN_MINUTE);
update_path (self, sin (angle) * self->amplitude);
gtk_widget_queue_draw (widget);
return G_SOURCE_CONTINUE;
}
static void
graph_widget_init (GraphWidget *self)
{
self->color.red = g_random_double_range (0, 1);
self->color.green = g_random_double_range (0, 1);
self->color.blue = g_random_double_range (0, 1);
self->color.alpha = 1;
self->period = g_random_double_range (0.5, 1);
self->amplitude = g_random_double_range (10, 25);
self->stroke = gsk_stroke_new (2);
update_path (self, 0);
self->start_time = 0;
self->tick_cb = gtk_widget_add_tick_callback (GTK_WIDGET (self), tick_cb, NULL, NULL);
}
static void
graph_widget_dispose (GObject *object)
{
GraphWidget *self = GRAPH_WIDGET (object);
g_clear_pointer (&self->path, gsk_path_unref);
gsk_stroke_free (self->stroke);
G_OBJECT_CLASS (graph_widget_parent_class)->dispose (object);
}
static void
graph_widget_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GraphWidget *self = GRAPH_WIDGET (widget);
gtk_snapshot_append_stroke (snapshot, self->path, self->stroke, &self->color);
}
static void
graph_widget_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
if (orientation == GTK_ORIENTATION_HORIZONTAL)
*minimum = *natural = 200;
else
*minimum = *natural = 100;
}
static void
graph_widget_class_init (GraphWidgetClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
object_class->dispose = graph_widget_dispose;
widget_class->snapshot = graph_widget_snapshot;
widget_class->measure = graph_widget_measure;
}
GtkWidget *
graph_widget_new (void)
{
return g_object_new (GRAPH_TYPE_WIDGET, NULL);
}

View File

@@ -0,0 +1,8 @@
#pragma once
#include <gtk/gtk.h>
#define GRAPH_TYPE_WIDGET (graph_widget_get_type ())
G_DECLARE_FINAL_TYPE (GraphWidget, graph_widget, GRAPH, WIDGET, GtkWidget)
GtkWidget * graph_widget_new (void);

View File

@@ -17,8 +17,7 @@
* Authors: Matthias Clasen <mclasen@redhat.com>
*/
#ifndef __GSK_SHADER_PAINTABLE_H__
#define __GSK_SHADER_PAINTABLE_H__
#pragma once
#include <gdk/gdk.h>
#include <gsk/gsk.h>
@@ -42,5 +41,3 @@ void gsk_shader_paintable_update_time (GskShaderPaintable *self
int time_idx,
gint64 frame_time);
G_END_DECLS
#endif /* __GSK_SHADER_PAINTABLE_H__ */

138
demos/gtk-demo/gtk-logo.svg Normal file
View File

@@ -0,0 +1,138 @@
<?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>

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@@ -456,43 +456,33 @@ gtk_fishbowl_do_update (GtkFishbowl *fishbowl)
{
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
GdkFrameClock *frame_clock;
GdkFrameTimings *start, *end;
gint64 start_counter, end_counter;
gint64 n_frames, expected_frames;
gint64 start_timestamp, end_timestamp;
GdkFrameTimings *end;
gint64 end_counter;
double fps, expected_fps;
gint64 interval;
frame_clock = gtk_widget_get_frame_clock (GTK_WIDGET (fishbowl));
if (frame_clock == NULL)
return;
start_counter = gdk_frame_clock_get_history_start (frame_clock);
end_counter = gdk_frame_clock_get_frame_counter (frame_clock);
start = gdk_frame_clock_get_timings (frame_clock, start_counter);
for (end = gdk_frame_clock_get_timings (frame_clock, end_counter);
end_counter > start_counter && end != NULL && !gdk_frame_timings_get_complete (end);
end = gdk_frame_clock_get_timings (frame_clock, end_counter))
end_counter--;
if (end_counter - start_counter < 4)
fps = gdk_frame_clock_get_fps (frame_clock);
if (fps <= 0.0)
return;
start_timestamp = gdk_frame_timings_get_presentation_time (start);
end_timestamp = gdk_frame_timings_get_presentation_time (end);
if (start_timestamp == 0 || end_timestamp == 0)
{
start_timestamp = gdk_frame_timings_get_frame_time (start);
end_timestamp = gdk_frame_timings_get_frame_time (end);
}
n_frames = end_counter - start_counter;
priv->framerate = ((double) n_frames) * G_USEC_PER_SEC / (end_timestamp - start_timestamp);
priv->framerate = ((int)(priv->framerate * 100))/100.0;
priv->framerate = fps;
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_FRAMERATE]);
if (!priv->benchmark)
return;
end_counter = gdk_frame_clock_get_frame_counter (frame_clock);
for (end = gdk_frame_clock_get_timings (frame_clock, end_counter);
end != NULL && !gdk_frame_timings_get_complete (end);
end = gdk_frame_clock_get_timings (frame_clock, end_counter))
end_counter--;
if (end == NULL)
return;
interval = gdk_frame_timings_get_refresh_interval (end);
if (interval == 0)
{
@@ -500,16 +490,16 @@ gtk_fishbowl_do_update (GtkFishbowl *fishbowl)
if (interval == 0)
return;
}
expected_frames = round ((double) (end_timestamp - start_timestamp) / interval);
expected_fps = (double) G_USEC_PER_SEC / interval;
if (n_frames >= expected_frames)
if (fps > (expected_fps - 1))
{
if (priv->last_benchmark_change > 0)
priv->last_benchmark_change *= 2;
else
priv->last_benchmark_change = 1;
}
else if (n_frames + 1 < expected_frames)
else if (0.95 * fps < expected_fps)
{
if (priv->last_benchmark_change < 0)
priv->last_benchmark_change--;

View File

@@ -15,8 +15,7 @@
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GTK_FISHBOWL_H__
#define __GTK_FISHBOWL_H__
#pragma once
#include <gtk/gtk.h>
@@ -65,5 +64,3 @@ void gtk_fishbowl_set_creation_func (GtkFishbowl *fishbowl,
GtkFishCreationFunc creation_func);
G_END_DECLS
#endif /* __GTK_FISHBOWL_H__ */

View File

@@ -1,5 +1,4 @@
#ifndef __GTK_GEARS_H__
#define __GTK_GEARS_H__
#pragma once
#include <gtk/gtk.h>
@@ -44,5 +43,3 @@ void gtk_gears_set_fps_label (GtkGears *gears,
G_END_DECLS
#endif /* __GTK_GEARS_H__ */

View File

@@ -1,5 +1,4 @@
#ifndef __GTK_SHADER_BIN_H__
#define __GTK_SHADER_BIN_H__
#pragma once
#include <gtk/gtk.h>
@@ -19,5 +18,3 @@ void gtk_shader_bin_set_child (GtkShaderBin *self,
GtkWidget *gtk_shader_bin_get_child (GtkShaderBin *self);
G_END_DECLS
#endif /* __GTK_SHADER_BIN_H__ */

View File

@@ -1,5 +1,4 @@
#ifndef __GTK_SHADER_STACK_H__
#define __GTK_SHADER_STACK_H__
#pragma once
#include <gtk/gtk.h>
@@ -19,5 +18,3 @@ void gtk_shader_stack_set_active (GtkShaderStack *self,
int index);
G_END_DECLS
#endif /* __GTK_SHADER_STACK_H__ */

View File

@@ -116,7 +116,9 @@ static gboolean gtk_shadertoy_tick (GtkWidget *widget,
GtkWidget *
gtk_shadertoy_new (void)
{
return g_object_new (gtk_shadertoy_get_type (), NULL);
return g_object_new (gtk_shadertoy_get_type (),
"allowed-apis", GDK_GL_API_GL,
NULL);
}
static void

View File

@@ -1,5 +1,4 @@
#ifndef __GTK_SHADERTOY_H__
#define __GTK_SHADERTOY_H__
#pragma once
#include <gtk/gtk.h>
@@ -30,5 +29,3 @@ void gtk_shadertoy_set_image_shader (GtkShadertoy *shadertoy,
const char *shader);
G_END_DECLS
#endif /* __GTK_SHADERTOY_H__ */

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -354,6 +354,7 @@ do_images (GtkWidget *do_widget)
gicon = g_themed_icon_new_with_default_fallbacks ("battery-caution-charging-symbolic");
image = gtk_image_new_from_gicon (gicon);
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
g_object_unref (gicon);
gtk_frame_set_child (GTK_FRAME (frame), image);

View File

@@ -1,5 +1,4 @@
#ifndef LANGUAGE_NAMES_H
#define LANGUAGE_NAMES_H
#pragma once
#include <pango/pango.h>
@@ -9,5 +8,3 @@ const char * get_language_name (PangoLanguage *language);
const char * get_language_name_for_tag (guint32 tag);
G_END_DECLS
#endif

View File

@@ -1,4 +1,5 @@
/* Lists/Selections
* #Keywords: suggestion, completion
*
* The GtkDropDown widget is a modern alternative to GtkComboBox.
* It uses list models instead of tree models, and the content is

View File

@@ -24,7 +24,7 @@
#include "demos.h"
#include "fontify.h"
#include "demo_conf.h"
#include "profile_conf.h"
static GtkWidget *info_view;
static GtkWidget *source_view;
@@ -827,13 +827,25 @@ demo_search_changed_cb (GtkSearchEntry *entry,
gtk_filter_changed (filter, GTK_FILTER_CHANGE_DIFFERENT);
}
static gboolean
demo_can_run (GtkWidget *window,
const char *name)
{
if (name != NULL && strcmp (name, "gltransition") == 0)
return GSK_IS_GL_RENDERER (gtk_native_get_renderer (GTK_NATIVE (window)));
return TRUE;
}
static GListModel *
create_demo_model (void)
create_demo_model (GtkWidget *window)
{
GListStore *store = g_list_store_new (GTK_TYPE_DEMO);
DemoData *demo = gtk_demos;
GtkDemo *d;
gtk_widget_realize (window);
d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
d->name = "main";
d->title = "GTK Demo";
@@ -845,16 +857,20 @@ create_demo_model (void)
while (demo->title)
{
d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
DemoData *children = demo->children;
DemoData *children = demo->children;
d->name = demo->name;
d->title = demo->title;
d->keywords = demo->keywords;
d->filename = demo->filename;
d->func = demo->func;
if (demo_can_run (window, demo->name))
{
d = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
g_list_store_append (store, d);
d->name = demo->name;
d->title = demo->title;
d->keywords = demo->keywords;
d->filename = demo->filename;
d->func = demo->func;
g_list_store_append (store, d);
}
if (children)
{
@@ -862,15 +878,19 @@ create_demo_model (void)
while (children->title)
{
GtkDemo *child = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
if (demo_can_run (window, children->name))
{
GtkDemo *child = GTK_DEMO (g_object_new (GTK_TYPE_DEMO, NULL));
child->name = children->name;
child->title = children->title;
child->keywords = children->keywords;
child->filename = children->filename;
child->func = children->func;
child->name = children->name;
child->title = children->title;
child->keywords = children->keywords;
child->filename = children->filename;
child->func = children->func;
g_list_store_append (G_LIST_STORE (d->children_model), child);
}
g_list_store_append (G_LIST_STORE (d->children_model), child);
children++;
}
}
@@ -936,7 +956,7 @@ activate (GApplication *app)
search_bar = GTK_WIDGET (gtk_builder_get_object (builder, "searchbar"));
g_signal_connect (search_bar, "notify::search-mode-enabled", G_CALLBACK (clear_search), NULL);
listmodel = create_demo_model ();
listmodel = create_demo_model (window);
treemodel = gtk_tree_list_model_new (G_LIST_MODEL (listmodel),
FALSE,
TRUE,

View File

@@ -2,7 +2,7 @@
<interface>
<menu id="menubar">
<submenu>
<attribute name="label" translatable="yes">_Application</attribute>
<attribute name="label" translatable="yes">_File</attribute>
<section>
<item>
<attribute name="label" translatable="yes">_New</attribute>
@@ -33,7 +33,7 @@
</section>
</submenu>
<submenu>
<attribute name="label" translatable="yes">_File</attribute>
<attribute name="label" translatable="yes">_Preferences</attribute>
<section>
<item>
<attribute name="label" translatable="yes">_Prefer Dark Theme</attribute>

View File

@@ -73,6 +73,7 @@ demos = files([
'panes.c',
'password_entry.c',
'path_fill.c',
'path_maze.c',
'path_spinner.c',
'path_walk.c',
'path_text.c',
@@ -140,6 +141,8 @@ extra_demo_sources = files([
'unicode-names.c',
'suggestionentry.c',
'language-names.c',
'nodewidget.c',
'graphwidget.c',
])
if os_unix
@@ -233,7 +236,7 @@ foreach flag: common_cflags
endif
endforeach
gtkdemo_deps += [ demo_conf_h ]
gtkdemo_deps += [ profile_conf_h ]
executable('gtk4-demo',
sources: [demos, demos_h, extra_demo_sources, gtkdemo_resources],

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1,76 @@
#include "nodewidget.h"
struct _NodeWidget
{
GtkWidget parent_instance;
GskRenderNode *node;
};
struct _NodeWidgetClass
{
GtkWidgetClass parent_class;
};
G_DEFINE_TYPE (NodeWidget, node_widget, GTK_TYPE_WIDGET)
static void
node_widget_init (NodeWidget *self)
{
}
static void
node_widget_dispose (GObject *object)
{
NodeWidget *self = NODE_WIDGET (object);
gsk_render_node_unref (self->node);
G_OBJECT_CLASS (node_widget_parent_class)->dispose (object);
}
static void
node_widget_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
NodeWidget *self = NODE_WIDGET (widget);
gtk_snapshot_append_node (snapshot, self->node);
}
static void
node_widget_class_init (NodeWidgetClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
object_class->dispose = node_widget_dispose;
widget_class->snapshot = node_widget_snapshot;
}
GtkWidget *
node_widget_new (const char *resource)
{
NodeWidget *self;
GBytes *bytes;
GskRenderNode *node;
graphene_rect_t bounds;
float scale;
GskTransform *transform;
self = g_object_new (NODE_TYPE_WIDGET, NULL);
bytes = g_resources_lookup_data (resource, 0, NULL);
node = gsk_render_node_deserialize (bytes, NULL, NULL);
g_bytes_unref (bytes);
gsk_render_node_get_bounds (node, &bounds);
scale = MIN (100.0/bounds.size.width, 100.0/bounds.size.height);
transform = gsk_transform_scale (NULL, scale, scale);
self->node = gsk_transform_node_new (node, transform);
gsk_transform_unref (transform);
gsk_render_node_unref (node);
return GTK_WIDGET (self);
}

View File

@@ -0,0 +1,8 @@
#pragma once
#include <gtk/gtk.h>
#define NODE_TYPE_WIDGET (node_widget_get_type ())
G_DECLARE_FINAL_TYPE (NodeWidget, node_widget, NODE, WIDGET, GtkWidget)
GtkWidget * node_widget_new (const char *file);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -53,7 +53,9 @@ gtk_nuclear_snapshot (GtkSnapshot *snapshot,
double rotation)
{
#define RADIUS 0.3
cairo_t *cr;
GskPathBuilder *builder;
GskPath *path;
GskStroke *stroke;
double size;
gtk_snapshot_append_color (snapshot,
@@ -61,24 +63,29 @@ gtk_nuclear_snapshot (GtkSnapshot *snapshot,
&GRAPHENE_RECT_INIT (0, 0, width, height));
size = MIN (width, height);
cr = gtk_snapshot_append_cairo (snapshot,
&GRAPHENE_RECT_INIT ((width - size) / 2.0,
(height - size) / 2.0,
size, size));
gdk_cairo_set_source_rgba (cr, foreground);
cairo_translate (cr, width / 2.0, height / 2.0);
cairo_scale (cr, size, size);
cairo_rotate (cr, rotation);
cairo_arc (cr, 0, 0, 0.1, - G_PI, G_PI);
cairo_fill (cr);
gtk_snapshot_save (snapshot);
cairo_set_line_width (cr, RADIUS);
cairo_set_dash (cr, (double[1]) { RADIUS * G_PI / 3 }, 1, 0.0);
cairo_arc (cr, 0, 0, RADIUS, - G_PI, G_PI);
cairo_stroke (cr);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (width / 2.0, height / 2.0));
gtk_snapshot_scale (snapshot, size, size);
gtk_snapshot_rotate (snapshot, rotation);
cairo_destroy (cr);
builder = gsk_path_builder_new ();
gsk_path_builder_add_circle (builder, graphene_point_zero (), 0.1);
path = gsk_path_builder_free_to_path (builder);
gtk_snapshot_append_fill (snapshot, path, GSK_FILL_RULE_WINDING, foreground);
gsk_path_unref (path);
stroke = gsk_stroke_new (RADIUS);
gsk_stroke_set_dash (stroke, (float[1]) { RADIUS * G_PI / 3 }, 1);
builder = gsk_path_builder_new ();
gsk_path_builder_add_circle (builder, graphene_point_zero(), RADIUS);
path = gsk_path_builder_free_to_path (builder);
gtk_snapshot_append_stroke (snapshot, path, stroke, foreground);
gsk_path_unref (path);
gsk_stroke_free (stroke);
gtk_snapshot_restore (snapshot);
}
/* Here, we implement the functionality required by the GdkPaintable interface */

View File

@@ -1,5 +1,4 @@
#ifndef __PAINTABLE_H__
#define __PAINTABLE_H__
#pragma once
#include <gtk/gtk.h>
@@ -13,5 +12,3 @@ void gtk_nuclear_snapshot (GtkSnapshot *snapshot,
GdkPaintable * gtk_nuclear_icon_new (double rotation);
GdkPaintable * gtk_nuclear_animation_new (gboolean draw_background);
GtkMediaStream *gtk_nuclear_media_stream_new (void);
#endif /* __PAINTABLE_H__ */

View File

@@ -70,7 +70,7 @@ gtk_nuclear_animation_snapshot (GdkPaintable *paintable,
? &(GdkRGBA) { 0.9, 0.75, 0.15, 1.0 } /* yellow */
: &(GdkRGBA) { 0, 0, 0, 0 }, /* transparent */
width, height,
2 * G_PI * nuclear->progress / MAX_PROGRESS);
360 * nuclear->progress / MAX_PROGRESS);
}
static GdkPaintable *
@@ -85,7 +85,7 @@ gtk_nuclear_animation_get_current_image (GdkPaintable *paintable)
* Luckily we added the rotation property to the nuclear icon
* object previously, so we can just return an instance of that one.
*/
return gtk_nuclear_icon_new (2 * G_PI * nuclear->progress / MAX_PROGRESS);
return gtk_nuclear_icon_new (360 * nuclear->progress / MAX_PROGRESS);
}
static GdkPaintableFlags

View File

@@ -76,7 +76,7 @@ gtk_nuclear_media_stream_snapshot (GdkPaintable *paintable,
&(GdkRGBA) { 0, 0, 0, 1 }, /* black */
&(GdkRGBA) { 0.9, 0.75, 0.15, 1.0 }, /* yellow */
width, height,
2 * G_PI * nuclear->progress / DURATION);
360 * nuclear->progress / DURATION);
}
static GdkPaintable *
@@ -85,7 +85,7 @@ gtk_nuclear_media_stream_get_current_image (GdkPaintable *paintable)
GtkNuclearMediaStream *nuclear = GTK_NUCLEAR_MEDIA_STREAM (paintable);
/* Same thing as with the animation */
return gtk_nuclear_icon_new (2 * G_PI * nuclear->progress / DURATION);
return gtk_nuclear_icon_new (360 * nuclear->progress / DURATION);
}
static GdkPaintableFlags

View File

@@ -2,10 +2,13 @@
*
* This demo shows how to use GskPath to draw shapes that are (a bit)
* more complex than a rounded rectangle.
*
* It also demonstrates printing to a stream with GtkPrintDialog.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <cairo-pdf.h>
#include "paintable.h"
@@ -165,6 +168,89 @@ gtk_logo_paintable_new (void)
return GDK_PAINTABLE (self);
}
static cairo_status_t
write_cairo (void *closure,
const unsigned char *data,
unsigned int length)
{
GOutputStream *stream = closure;
gsize written;
GError *error = NULL;
if (!g_output_stream_write_all (stream, data, length, &written, NULL, &error))
{
g_print ("Error writing pdf stream: %s\n", error->message);
g_error_free (error);
return CAIRO_STATUS_WRITE_ERROR;
}
return CAIRO_STATUS_SUCCESS;
}
static void
print_ready (GObject *source,
GAsyncResult *result,
gpointer data)
{
GtkPrintDialog *dialog = GTK_PRINT_DIALOG (source);
GError *error = NULL;
GOutputStream *stream;
GtkSnapshot *snapshot;
GdkPaintable *paintable;
GskRenderNode *node;
cairo_surface_t *surface;
cairo_t *cr;
stream = gtk_print_dialog_print_finish (dialog, result, &error);
if (stream == NULL)
{
g_print ("Failed to get output stream: %s\n", error->message);
g_error_free (error);
return;
}
snapshot = gtk_snapshot_new ();
paintable = gtk_picture_get_paintable (GTK_PICTURE (data));
gdk_paintable_snapshot (paintable, snapshot, 100, 100);
node = gtk_snapshot_free_to_node (snapshot);
surface = cairo_pdf_surface_create_for_stream (write_cairo, stream, 100, 100);
cr = cairo_create (surface);
gsk_render_node_draw (node, cr);
cairo_destroy (cr);
cairo_surface_destroy (surface);
gsk_render_node_unref (node);
if (!g_output_stream_close (stream, NULL, &error))
{
g_print ("Error from close: %s\n", error->message);
g_error_free (error);
}
g_object_unref (stream);
}
static void
print (GtkButton *button,
gpointer data)
{
GtkWidget *picture = data;
GtkPrintDialog *dialog;
dialog = gtk_print_dialog_new ();
gtk_print_dialog_print (dialog,
GTK_WINDOW (gtk_widget_get_root (picture)),
NULL,
NULL,
print_ready,
picture);
g_object_unref (dialog);
}
GtkWidget *
do_path_fill (GtkWidget *do_widget)
{
@@ -172,12 +258,21 @@ do_path_fill (GtkWidget *do_widget)
if (!window)
{
GtkWidget *header, *button, *label;
GtkWidget *picture;
GdkPaintable *paintable;
window = gtk_window_new ();
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
gtk_window_set_default_size (GTK_WINDOW (window), 100, 100);
gtk_window_set_title (GTK_WINDOW (window), "Fill and Stroke");
header = gtk_header_bar_new ();
button = gtk_button_new_from_icon_name ("printer-symbolic");
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), button);
label = gtk_label_new ("Fill and Stroke");
gtk_widget_add_css_class (label, "title");
gtk_header_bar_set_title_widget (GTK_HEADER_BAR (header), label);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
paintable = gtk_logo_paintable_new ();
@@ -186,6 +281,8 @@ do_path_fill (GtkWidget *do_widget)
gtk_picture_set_can_shrink (GTK_PICTURE (picture), FALSE);
g_object_unref (paintable);
g_signal_connect (button, "clicked", G_CALLBACK (print), picture);
gtk_window_set_child (GTK_WINDOW (window), picture);
}

369
demos/gtk-demo/path_maze.c Normal file
View File

@@ -0,0 +1,369 @@
/* Path/Maze
*
* This demo shows how to use a GskPath to create a maze and use
* gsk_path_get_closest_point() to check the mouse stays
* on the path.
*
* It also shows off the performance of GskPath (or not) as this
* is a rather complex path.
*/
#include "config.h"
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "paintable.h"
#define MAZE_GRID_SIZE 20
#define MAZE_STROKE_SIZE_ACTIVE (MAZE_GRID_SIZE - 4)
#define MAZE_STROKE_SIZE_INACTIVE (MAZE_GRID_SIZE - 12)
#define MAZE_WIDTH 31
#define MAZE_HEIGHT 21
#define GTK_TYPE_MAZE (gtk_maze_get_type ())
G_DECLARE_FINAL_TYPE (GtkMaze, gtk_maze, GTK, MAZE, GtkWidget)
struct _GtkMaze
{
GtkWidget parent_instance;
int width;
int height;
GskPath *path;
GskPathMeasure *measure;
GdkPaintable *background;
gboolean active;
};
struct _GtkMazeClass
{
GtkWidgetClass parent_class;
};
G_DEFINE_TYPE (GtkMaze, gtk_maze, GTK_TYPE_WIDGET)
static void
gtk_maze_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
GtkMaze *self = GTK_MAZE (widget);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
*minimum = *natural = self->width;
else
*minimum = *natural = self->height;
}
static void
gtk_maze_snapshot (GtkWidget *widget,
GdkSnapshot *snapshot)
{
GtkMaze *self = GTK_MAZE (widget);
double width = gtk_widget_get_width (widget);
double height = gtk_widget_get_height (widget);
GskStroke *stroke;
stroke = gsk_stroke_new (MAZE_STROKE_SIZE_INACTIVE);
if (self->active)
gsk_stroke_set_line_width (stroke, MAZE_STROKE_SIZE_ACTIVE);
gsk_stroke_set_line_join (stroke, GSK_LINE_JOIN_ROUND);
gsk_stroke_set_line_cap (stroke, GSK_LINE_CAP_ROUND);
gtk_snapshot_push_stroke (snapshot, self->path, stroke);
gsk_stroke_free (stroke);
if (self->background)
{
gdk_paintable_snapshot (self->background, snapshot, width, height);
}
else
{
gtk_snapshot_append_linear_gradient (snapshot,
&GRAPHENE_RECT_INIT (0, 0, width, height),
&GRAPHENE_POINT_INIT (0, 0),
&GRAPHENE_POINT_INIT (width, height),
(GskColorStop[8]) {
{ 0.0, { 1.0, 0.0, 0.0, 1.0 } },
{ 0.2, { 1.0, 0.0, 0.0, 1.0 } },
{ 0.3, { 1.0, 1.0, 0.0, 1.0 } },
{ 0.4, { 0.0, 1.0, 0.0, 1.0 } },
{ 0.6, { 0.0, 1.0, 1.0, 1.0 } },
{ 0.7, { 0.0, 0.0, 1.0, 1.0 } },
{ 0.8, { 1.0, 0.0, 1.0, 1.0 } },
{ 1.0, { 1.0, 0.0, 1.0, 1.0 } }
},
8);
}
gtk_snapshot_pop (snapshot);
}
static void
gtk_maze_dispose (GObject *object)
{
GtkMaze *self = GTK_MAZE (object);
g_clear_pointer (&self->path, gsk_path_unref);
g_clear_pointer (&self->measure, gsk_path_measure_unref);
if (self->background)
{
g_signal_handlers_disconnect_matched (self->background, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, self);
g_clear_object (&self->background);
}
G_OBJECT_CLASS (gtk_maze_parent_class)->dispose (object);
}
static void
gtk_maze_class_init (GtkMazeClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = gtk_maze_dispose;
widget_class->measure = gtk_maze_measure;
widget_class->snapshot = gtk_maze_snapshot;
}
static void
celebrate (gboolean win)
{
char *path;
GtkMediaStream *stream;
if (win)
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "complete.oga", NULL);
else
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "suspend-error.oga", NULL);
stream = gtk_media_file_new_for_filename (path);
gtk_media_stream_set_volume (stream, 1.0);
gtk_media_stream_play (stream);
g_signal_connect (stream, "notify::ended", G_CALLBACK (g_object_unref), NULL);
g_free (path);
}
static void
pointer_motion (GtkEventControllerMotion *controller,
double x,
double y,
GtkMaze *self)
{
GskPathPoint point;
float distance;
if (!self->active)
return;
if (gsk_path_get_closest_point (self->path,
&GRAPHENE_POINT_INIT (x, y),
INFINITY,
&point,
&distance))
{
if (distance < MAZE_STROKE_SIZE_ACTIVE / 2.f)
return;
}
celebrate (FALSE);
self->active = FALSE;
gtk_widget_queue_draw (GTK_WIDGET (self));
}
static void
pointer_leave (GtkEventControllerMotion *controller,
GtkMaze *self)
{
if (!self->active)
{
self->active = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (self));
}
}
static void
gtk_maze_init (GtkMaze *self)
{
GtkEventController *controller;
controller = GTK_EVENT_CONTROLLER (gtk_event_controller_motion_new ());
g_signal_connect (controller, "motion", G_CALLBACK (pointer_motion), self);
g_signal_connect (controller, "leave", G_CALLBACK (pointer_leave), self);
gtk_widget_add_controller (GTK_WIDGET (self), controller);
self->active = TRUE;
}
static void
gtk_maze_set_path (GtkMaze *self,
GskPath *path)
{
g_clear_pointer (&self->path, gsk_path_unref);
g_clear_pointer (&self->measure, gsk_path_measure_unref);
self->path = gsk_path_ref (path);
self->measure = gsk_path_measure_new (path);
gtk_widget_queue_draw (GTK_WIDGET (self));
}
GtkWidget *
gtk_maze_new (GskPath *path,
GdkPaintable *background,
int width,
int height)
{
GtkMaze *self;
self = g_object_new (GTK_TYPE_MAZE, NULL);
gtk_maze_set_path (self, path);
gsk_path_unref (path);
self->background = background;
if (self->background)
{
g_signal_connect_swapped (self->background, "invalidate-contents", G_CALLBACK (gtk_widget_queue_draw), self);
g_signal_connect_swapped (self->background, "invalidate-size", G_CALLBACK (gtk_widget_queue_resize), self);
}
self->width = width;
self->height = height;
return GTK_WIDGET (self);
}
static void
add_point_to_maze (GtkBitset *maze,
GskPathBuilder *builder,
guint x,
guint y)
{
gboolean set[4] = { FALSE, FALSE, FALSE, FALSE };
guint dir;
gtk_bitset_add (maze, y * MAZE_WIDTH + x);
while (TRUE)
{
set[0] = set[0] || x == 0 || gtk_bitset_contains (maze, y * MAZE_WIDTH + x - 1);
set[1] = set[1] || y == 0 || gtk_bitset_contains (maze, (y - 1) * MAZE_WIDTH + x);
set[2] = set[2] || x + 1 == MAZE_WIDTH || gtk_bitset_contains (maze, y * MAZE_WIDTH + x + 1);
set[3] = set[3] || y + 1 == MAZE_HEIGHT || gtk_bitset_contains (maze, (y + 1) * MAZE_WIDTH + x);
if (set[0] && set[1] && set[2] && set[3])
return;
do
{
dir = g_random_int_range (0, 4);
}
while (set[dir]);
switch (dir)
{
case 0:
gsk_path_builder_move_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
gsk_path_builder_line_to (builder, (x - 0.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
add_point_to_maze (maze, builder, x - 1, y);
break;
case 1:
gsk_path_builder_move_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
gsk_path_builder_line_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y - 0.5) * MAZE_GRID_SIZE);
add_point_to_maze (maze, builder, x, y - 1);
break;
case 2:
gsk_path_builder_move_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
gsk_path_builder_line_to (builder, (x + 1.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
add_point_to_maze (maze, builder, x + 1, y);
break;
case 3:
gsk_path_builder_move_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
gsk_path_builder_line_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y + 1.5) * MAZE_GRID_SIZE);
add_point_to_maze (maze, builder, x, y + 1);
break;
default:
g_assert_not_reached ();
break;
}
}
}
static GskPath *
create_path_for_maze (GtkWidget *widget)
{
GskPathBuilder *builder;
GtkBitset *maze;
builder = gsk_path_builder_new ();
maze = gtk_bitset_new_empty ();
/* make sure the outer lines are unreachable:
* Set the full range, then remove the center again. */
gtk_bitset_add_range (maze, 0, MAZE_WIDTH * MAZE_HEIGHT);
gtk_bitset_remove_rectangle (maze, MAZE_WIDTH + 1, MAZE_WIDTH - 2, MAZE_HEIGHT - 2, MAZE_WIDTH);
/* Fill the maze */
add_point_to_maze (maze, builder, MAZE_WIDTH / 2, MAZE_HEIGHT / 2);
/* Add start and stop lines */
gsk_path_builder_move_to (builder, 1.5 * MAZE_GRID_SIZE, -0.5 * MAZE_GRID_SIZE);
gsk_path_builder_line_to (builder, 1.5 * MAZE_GRID_SIZE, 1.5 * MAZE_GRID_SIZE);
gsk_path_builder_move_to (builder, (MAZE_WIDTH - 1.5) * MAZE_GRID_SIZE, (MAZE_HEIGHT - 1.5) * MAZE_GRID_SIZE);
gsk_path_builder_line_to (builder, (MAZE_WIDTH - 1.5) * MAZE_GRID_SIZE, (MAZE_HEIGHT + 0.5) * MAZE_GRID_SIZE);
gtk_bitset_unref (maze);
return gsk_path_builder_free_to_path (builder);
}
GtkWidget *
do_path_maze (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *maze;
GtkMediaStream *stream;
GskPath *path;
window = gtk_window_new ();
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
gtk_window_set_title (GTK_WINDOW (window), "Follow the maze with the mouse");
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
#if 0
stream = gtk_media_file_new_for_resource ("/images/gtk-logo.webm");
#else
stream = gtk_nuclear_media_stream_new ();
#endif
gtk_media_stream_play (stream);
gtk_media_stream_set_loop (stream, TRUE);
path = create_path_for_maze (window);
maze = gtk_maze_new (path,
GDK_PAINTABLE (stream),
MAZE_WIDTH * MAZE_GRID_SIZE,
MAZE_HEIGHT * MAZE_GRID_SIZE);
gtk_window_set_child (GTK_WINDOW (window), maze);
}
if (!gtk_widget_get_visible (window))
gtk_window_present (GTK_WINDOW (window));
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@@ -9,6 +9,8 @@
#include "paintable.h"
#undef SHOW_CONTROLS
#define GTK_TYPE_SPINNER_PAINTABLE (gtk_spinner_paintable_get_type ())
G_DECLARE_FINAL_TYPE (GtkSpinnerPaintable, gtk_spinner_paintable, GTK, SPINNER_PAINTABLE, GObject)
@@ -56,9 +58,9 @@ gtk_spinner_paintable_get_intrinsic_height (GdkPaintable *paintable)
static void
gtk_spinner_paintable_snapshot (GdkPaintable *paintable,
GdkSnapshot *snapshot,
double width,
double height)
GdkSnapshot *snapshot,
double width,
double height)
{
GtkSpinnerPaintable *self = GTK_SPINNER_PAINTABLE (paintable);
@@ -150,6 +152,7 @@ static gboolean
add_controls (GskPathOperation op,
const graphene_point_t *pts,
gsize n_pts,
float weight,
gpointer data)
{
GskPathBuilder *builder = data;
@@ -166,7 +169,7 @@ add_controls (GskPathOperation op,
break;
case GSK_PATH_QUAD:
case GSK_PATH_ARC:
case GSK_PATH_CONIC:
gsk_path_builder_line_to (builder, pts[1].x, pts[1].y);
gsk_path_builder_line_to (builder, pts[2].x, pts[2].y);
break;
@@ -190,32 +193,21 @@ update_path (GtkSpinnerPaintable *self)
{
GskPathBuilder *builder;
GskPathPoint start, end;
GskTransform *t;
graphene_point_t p, p0, p1;
graphene_point_t p0, p1;
float start_angle, end_angle;
p = GRAPHENE_POINT_INIT (40, 0);
start_angle = self->angle;
end_angle = fmod (self->angle + 360 * self->completion / 100, 360);
t = gsk_transform_translate (
gsk_transform_rotate (
gsk_transform_translate (NULL, &GRAPHENE_POINT_INIT (50, 50)),
start_angle),
&GRAPHENE_POINT_INIT (-50, -50));
gsk_transform_transform_point (t, &p, &p0);
t = gsk_transform_translate (
gsk_transform_rotate (
gsk_transform_translate (NULL, &GRAPHENE_POINT_INIT (50, 50)),
end_angle),
&GRAPHENE_POINT_INIT (-50, -50));
gsk_transform_transform_point (t, &p, &p1);
p0 = GRAPHENE_POINT_INIT (50 + 40 * cos (M_PI * start_angle / 180),
50 + 40 * sin (M_PI * start_angle / 180));
p1 = GRAPHENE_POINT_INIT (50 + 40 * cos (M_PI * end_angle / 180),
50 + 40 * sin (M_PI * end_angle / 180));
g_clear_pointer (&self->path, gsk_path_unref);
gsk_path_get_closest_point (self->circle, &p0, INFINITY, &start);
gsk_path_get_closest_point (self->circle, &p1, INFINITY, &end);
gsk_path_get_closest_point (self->circle, &p0, INFINITY, &start, NULL);
gsk_path_get_closest_point (self->circle, &p1, INFINITY, &end, NULL);
builder = gsk_path_builder_new ();
gsk_path_builder_add_segment (builder, self->circle, &start, &end);

View File

@@ -501,15 +501,13 @@ pointer_motion (GtkEventControllerMotion *controller,
GtkPathWidget *self)
{
GskPathPoint point;
graphene_point_t pos;
if (gsk_path_get_closest_point (self->line_path,
&GRAPHENE_POINT_INIT (x, y),
INFINITY,
&point))
&point,
NULL))
{
gsk_path_point_get_position (&point, self->line_path, &pos);
gtk_widget_queue_draw (GTK_WIDGET (self));
}
}

View File

@@ -11,6 +11,8 @@
<property name="lower">0</property>
<property name="upper">5000</property>
<property name="value">500</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
</property>
</object>

View File

@@ -1,8 +1,9 @@
/* Pickers and Launchers
* #Keywords: GtkColorDialog, GtkFontDialog, GtkFileDialog, GtkFileLauncher, GtkUriLauncher
* #Keywords: GtkColorDialog, GtkFontDialog, GtkFileDialog, GtkPrintDialog, GtkFileLauncher, GtkUriLauncher
*
* The dialogs are mainly intended for use in preference dialogs.
* They allow to select colors, fonts and applications.
* They allow to select colors, fonts and files. There is also a
* print dialog.
*
* The launchers let you open files or URIs in applications that
* can handle them.
@@ -11,11 +12,13 @@
#include <gtk/gtk.h>
static GtkWidget *app_picker;
static GtkWidget *print_button;
static void
set_file (GFile *file,
gpointer data)
{
GFileInfo *info;
char *name;
if (!file)
@@ -31,6 +34,13 @@ set_file (GFile *file,
gtk_widget_set_sensitive (app_picker, TRUE);
g_object_set_data_full (G_OBJECT (app_picker), "file", g_object_ref (file), g_object_unref);
info = g_file_query_info (file, "standard::content-type", 0, NULL, NULL);
if (strcmp (g_file_info_get_content_type (info), "application/pdf") == 0)
{
gtk_widget_set_sensitive (print_button, TRUE);
g_object_set_data_full (G_OBJECT (print_button), "file", g_object_ref (file), g_object_unref);
}
}
static void
@@ -47,6 +57,10 @@ file_opened (GObject *source,
{
g_print ("%s\n", error->message);
g_error_free (error);
gtk_widget_set_sensitive (app_picker, FALSE);
g_object_set_data (G_OBJECT (app_picker), "file", NULL);
gtk_widget_set_sensitive (print_button, FALSE);
g_object_set_data (G_OBJECT (print_button), "file", NULL);
}
set_file (file, data);
@@ -114,6 +128,53 @@ open_app (GtkButton *picker)
g_object_unref (launcher);
}
static void
print_file_done (GObject *source,
GAsyncResult *result,
gpointer data)
{
GtkPrintDialog *dialog = GTK_PRINT_DIALOG (source);
GError *error = NULL;
GCancellable *cancellable;
unsigned int id;
cancellable = g_task_get_cancellable (G_TASK (result));
id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (cancellable), "timeout"));
if (id)
g_source_remove (id);
if (!gtk_print_dialog_print_file_finish (dialog, result, &error))
{
g_print ("%s\n", error->message);
g_error_free (error);
}
}
static void
print_file (GtkButton *picker)
{
GtkWindow *parent = GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (picker)));
GtkPrintDialog *dialog;
GCancellable *cancellable;
GFile *file;
unsigned int id;
file = G_FILE (g_object_get_data (G_OBJECT (picker), "file"));
dialog = gtk_print_dialog_new ();
cancellable = g_cancellable_new ();
id = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT,
20,
abort_mission, g_object_ref (cancellable), g_object_unref);
g_object_set_data (G_OBJECT (cancellable), "timeout", GUINT_TO_POINTER (id));
gtk_print_dialog_print_file (dialog, parent, NULL, file, cancellable, print_file_done, NULL);
g_object_unref (cancellable);
g_object_unref (dialog);
}
static void
open_uri_done (GObject *source,
GAsyncResult *result,
@@ -234,8 +295,14 @@ do_pickers (GtkWidget *do_widget)
gtk_widget_set_sensitive (app_picker, FALSE);
g_signal_connect (app_picker, "clicked", G_CALLBACK (open_app), NULL);
gtk_box_append (GTK_BOX (picker), app_picker);
gtk_grid_attach (GTK_GRID (table), picker, 1, 2, 1, 1);
print_button = gtk_button_new_from_icon_name ("printer-symbolic");
gtk_widget_set_tooltip_text (print_button, "Print file");
gtk_widget_set_sensitive (print_button, FALSE);
g_signal_connect (print_button, "clicked", G_CALLBACK (print_file), NULL);
gtk_box_append (GTK_BOX (picker), print_button);
gtk_grid_attach (GTK_GRID (table), picker, 1, 2, 1, 1);
label = gtk_label_new ("URI:");
gtk_widget_set_halign (label, GTK_ALIGN_START);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -1,5 +1,4 @@
#ifndef __PUZZLE_PIECE_H__
#define __PUZZLE_PIECE_H__
#pragma once
#include <gtk/gtk.h>
@@ -19,5 +18,3 @@ GdkPaintable * gtk_puzzle_piece_new (GdkPaintable *puzzle,
GdkPaintable * gtk_puzzle_piece_get_puzzle (GtkPuzzlePiece *self);
guint gtk_puzzle_piece_get_x (GtkPuzzlePiece *self);
guint gtk_puzzle_piece_get_y (GtkPuzzlePiece *self);
#endif /* __PUZZLE_PIECE_H__ */

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -1,5 +1,4 @@
#ifndef SCRIPT_NAMES_H
#define SCRIPT_NAMES_H
#pragma once
#include <glib.h>
@@ -9,5 +8,3 @@ const char * get_script_name (GUnicodeScript script);
const char * get_script_name_for_tag (guint32 tag);
G_END_DECLS
#endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.4 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), shadertoy);
gtk_aspect_frame_set_child (GTK_ASPECT_FRAME (aspect), gtk_graphics_offload_new (shadertoy));
sw = gtk_scrolled_window_new ();
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (sw), 250);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 844 B

After

Width:  |  Height:  |  Size: 1.1 KiB

2218
demos/gtk-demo/tiger.node Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 823 B

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -139,6 +139,7 @@ do_video_player (GtkWidget *do_widget)
video = gtk_video_new ();
gtk_video_set_autoplay (GTK_VIDEO (video), TRUE);
gtk_video_set_graphics_offload (GTK_VIDEO (video), GTK_GRAPHICS_OFFLOAD_ENABLED);
gtk_window_set_child (GTK_WINDOW (window), video);
title = gtk_header_bar_new ();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -4,7 +4,7 @@
#include "iconbrowserapp.h"
#include "iconbrowserwin.h"
#include "demo_conf.h"
#include "profile_conf.h"
struct _IconBrowserApp
{

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