Compare commits

..

507 Commits

Author SHA1 Message Date
Matthias Clasen c476c45007 gsk: Maintain clip info for glyph nodes
We can determine once whether we are contained, instead of doing
it again for every glyph.

The performance impact of this is hard to measure.
2024-02-25 18:26:00 -05:00
Matthias Clasen 5d05270ca7 gsk: Don't add images needlessly
Most likely, the image for all glyphs will be the same atlas,
so check first before calling the add_image function, which
will loop over all images.

This matches what the pattern code does for glyph nodes.

The performance impact of this is hard to measure.
2024-02-25 18:25:42 -05:00
Matthias Clasen 34fb85afd1 gsk: Split the glyph cache
Do the glyph cache lookup in two steps: First find a cache for
the given font+scale, then look up the glyph+flags. Since
font+scale change much less frequently (in particular, they are
the same for all glyphs in a text node), it makes sense to keep
the result of the last lookup around and check if it still fits.

Here are changes in running widget-factory with no-vsync:

                                      before    after
gsk_gpu_device_lookup_glyph_image     1.43%     1.02%
g_hash_table_lookup                   0.76%     0.43%
gsk_gpu_cached_glyph_equal            0.28%     0.21%
2024-02-25 13:47:32 -05:00
Matthias Clasen 05bc4a86c7 gsk: Keep scaled fonts around
Create the scaled font on demand, only when we need to render a glyph,
and keep it around while processing the remaining glyphs in the text
node, rather than recreating it over and over.
2024-02-25 09:35:56 -05:00
Matthias Clasen 93302cc42d 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-02-25 09:35:56 -05:00
Matthias Clasen 976f45e614 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-02-25 09:35:56 -05:00
Matthias Clasen befccc943a 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-02-25 09:35:55 -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
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 https://gitlab.gnome.org/GNOME/gtk/-/commit/d05f47a695f450ee81e4daae40de8a953283a273#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
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
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
Asier Sarasua Garmendia d828f2477e Update Basque translation 2024-02-18 07:47:54 +00: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
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
Ignacio Casal Quinteiro 3b96cf3789 scalebutton: add api to get/set whether it has a frame 2024-01-18 09:58:05 +01: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
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
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
358 changed files with 30944 additions and 12216 deletions
+1 -1
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
+32 -36
View File
@@ -78,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"
@@ -209,51 +210,52 @@ msys2-mingw64:
paths:
- "${CI_PROJECT_DIR}/_build/gtkdll.tar.gz"
macos-x86_64:
macos:
rules:
# Do not run in forks as the runner is not available there.
- if: $CI_PROJECT_NAMESPACE == "GNOME"
# (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
when: manual
allow_failure: true
- if: $RUNNER == "macosarm"
variables:
SDKROOT: /opt/sdks/MacOSX11.3.sdk
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
PIP_CACHE_DIR: /Users/Shared/build/cache
PIPENV_CACHE_DIR: $PIP_CACHE_DIR
PYTHONPYCACHEPREFIX: $PIP_CACHE_DIR
EXTRA_MESON_FLAGS: "-Dgobject-introspection:werror=false"
before_script:
# Not using ccache on purpose as it accelerates the build so much that it
# can trigger race conditions in the gobject-introspection subproject.
- bash .gitlab-ci/show-info-osx.sh
- /opt/macports/bin/python3.10 -m venv .venv
- ln -s /opt/cmake/CMake.app/Contents/bin/cmake .venv/bin
- ln -s /opt/pkg-config/bin/pkg-config .venv/bin
- ln -s /opt/bison/bin/bison .venv/bin
- .gitlab-ci/show-info-macos.sh
- python3 -m venv .venv
# 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 /Users/Shared/build/pkgs/PyGObject-3.44.0-cp310-cp310-macosx_10_13_x86_64.whl
/Users/Shared/build/pkgs/pycairo-1.23.0-cp310-cp310-macosx_10_13_x86_64.whl
- pip3 install meson==1.3.2 ninja==1.11.1.1
# 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}
${EXTRA_MESON_FLAGS}
-Dx11-backend=false
-Dbroadway-backend=true
-Dmacos-backend=true
-Dmedia-gstreamer=disabled
-Dintrospection=enabled
-Dcpp_std=c++11
-Dpixman:tests=disabled
-Dlibjpeg-turbo:simd=disabled
-Dbuild-demos=false
-Dbuild-tests=false
-Dbuild-examples=false
-Dbuild-testsuite=false
${BACKEND_FLAGS}
${FEATURE_FLAGS}
_build
- meson compile -C _build
artifacts:
@@ -428,13 +430,6 @@ asan-build:
_build
- ninja -C _build
- .gitlab-ci/run-tests.sh _build wayland gtk
artifacts:
when: always
reports:
junit:
- "${CI_PROJECT_DIR}/_build/report-wayland.xml"
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
reference:
image: $FEDORA_IMAGE
@@ -484,3 +479,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"
@@ -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 || :
+177 -1
View File
@@ -1,6 +1,182 @@
Overview of Changes in 4.13.6, xx-xx-xxxx
Overview of Changes in 4.13.9, xx-xx-xxxx
=========================================
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.0) with the new renderers.
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
=========================================
+1
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
+59 -65
View File
@@ -68,8 +68,9 @@ struct _NodeEditorWindow
GArray *errors;
guint update_timeout;
gboolean auto_reload;
gboolean mark_as_safe_pending;
gulong after_paint_handler;
};
struct _NodeEditorWindowClass
@@ -245,6 +246,41 @@ highlight_text (NodeEditorWindow *self)
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "no-hyphens", &start, &end);
}
static void
mark_autosave_as_unsafe (void)
{
char *path1 = NULL;
char *path2 = NULL;
path1 = get_autosave_path ("-unsafe");
path2 = get_autosave_path (NULL);
g_rename (path2, path1);
}
static void
mark_autosave_as_safe (void)
{
char *path1 = NULL;
char *path2 = NULL;
path1 = get_autosave_path ("-unsafe");
path2 = get_autosave_path (NULL);
g_rename (path1, path2);
}
static void
after_paint (GdkFrameClock *clock,
NodeEditorWindow *self)
{
if (self->mark_as_safe_pending)
{
self->mark_as_safe_pending = FALSE;
mark_autosave_as_safe ();
}
}
static void
reload (NodeEditorWindow *self)
{
@@ -253,6 +289,8 @@ reload (NodeEditorWindow *self)
float scale;
GskRenderNode *big_node;
mark_autosave_as_unsafe ();
text = get_current_text (self->text_buffer);
bytes = g_bytes_new_take (text, strlen (text));
@@ -314,6 +352,8 @@ reload (NodeEditorWindow *self)
}
g_clear_pointer (&big_node, gsk_render_node_unref);
self->mark_as_safe_pending = TRUE;
}
static void
@@ -1125,9 +1165,6 @@ node_editor_window_finalize (GObject *object)
{
NodeEditorWindow *self = (NodeEditorWindow *)object;
if (self->update_timeout)
g_source_remove (self->update_timeout);
g_array_free (self->errors, TRUE);
g_clear_pointer (&self->node, gsk_render_node_unref);
@@ -1172,6 +1209,7 @@ static void
node_editor_window_realize (GtkWidget *widget)
{
NodeEditorWindow *self = NODE_EDITOR_WINDOW (widget);
GdkFrameClock *frameclock;
GTK_WIDGET_CLASS (node_editor_window_parent_class)->realize (widget);
@@ -1199,14 +1237,24 @@ node_editor_window_realize (GtkWidget *widget)
node_editor_window_add_renderer (self,
gsk_cairo_renderer_new (),
"Cairo");
frameclock = gtk_widget_get_frame_clock (widget);
self->after_paint_handler = g_signal_connect (frameclock, "after-paint",
G_CALLBACK (after_paint), self);
}
static void
node_editor_window_unrealize (GtkWidget *widget)
{
NodeEditorWindow *self = NODE_EDITOR_WINDOW (widget);
GdkFrameClock *frameclock;
guint i;
frameclock = gtk_widget_get_frame_clock (widget);
g_signal_handler_disconnect (frameclock, self->after_paint_handler);
self->after_paint_handler = 0;
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (self->renderers)); i ++)
{
gpointer item = g_list_model_get_item (G_LIST_MODEL (self->renderers), i);
@@ -1567,23 +1615,6 @@ edit_action_cb (GtkWidget *widget,
node_editor_window_edit (self, &start);
}
static void
node_editor_window_map (GtkWidget *widget)
{
char *path;
GTK_WIDGET_CLASS (node_editor_window_parent_class)->map (widget);
path = get_autosave_path (NULL);
if (g_file_test (path, G_FILE_TEST_EXISTS))
{
g_free (path);
return;
}
g_free (path);
}
static void
node_editor_window_set_property (GObject *object,
guint prop_id,
@@ -1660,8 +1691,6 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
widget_class->realize = node_editor_window_realize;
widget_class->unrealize = node_editor_window_unrealize;
widget_class->map = node_editor_window_map;
properties[PROP_AUTO_RELOAD] = g_param_spec_boolean ("auto-reload", NULL, NULL,
TRUE,
G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_STATIC_NAME);
@@ -1765,16 +1794,16 @@ set_initial_text (NodeEditorWindow *self)
path = get_autosave_path (NULL);
path1 = get_autosave_path ("-unsafe");
if (g_file_get_contents (path, &initial_text, &len, NULL))
{
gtk_text_buffer_set_text (self->text_buffer, initial_text, len);
g_free (initial_text);
}
else if (g_file_get_contents (path1, &initial_text, &len, NULL))
if (g_file_get_contents (path1, &initial_text, &len, NULL))
{
self->auto_reload = FALSE;
gtk_revealer_set_reveal_child (GTK_REVEALER (self->crash_warning), TRUE);
gtk_text_buffer_set_text (self->text_buffer, initial_text, len);
g_free (initial_text);
}
else if (g_file_get_contents (path, &initial_text, &len, NULL))
{
gtk_text_buffer_set_text (self->text_buffer, initial_text, len);
g_free (initial_text);
}
@@ -1825,41 +1854,6 @@ autosave_contents (NodeEditorWindow *self)
g_free (contents);
}
static void
mark_autosave_as_safe (void)
{
char *path1 = NULL;
char *path2 = NULL;
path1 = get_autosave_path ("-unsafe");
path2 = get_autosave_path (NULL);
g_rename (path1, path2);
}
static gboolean
update_timeout_cb (gpointer data)
{
NodeEditorWindow *self = data;
self->update_timeout = 0;
mark_autosave_as_safe ();
return G_SOURCE_REMOVE;
}
static void
initiate_autosave (NodeEditorWindow *self)
{
autosave_contents (self);
if (self->update_timeout != 0)
g_source_remove (self->update_timeout);
self->update_timeout = g_timeout_add (100, update_timeout_cb, self);
}
static void
node_editor_window_init (NodeEditorWindow *self)
{
@@ -1924,7 +1918,7 @@ node_editor_window_init (NodeEditorWindow *self)
set_initial_text (self);
g_signal_connect_swapped (self->text_buffer, "changed", G_CALLBACK (initiate_autosave), self);
g_signal_connect_swapped (self->text_buffer, "changed", G_CALLBACK (autosave_contents), self);
if (g_getenv ("GSK_RENDERER"))
{
+1 -4
View File
@@ -10,10 +10,6 @@
<attribute name="label" translatable="yes">_Help</attribute>
<attribute name="action">app.help</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Help</attribute>
<attribute name="action">app.help</attribute>
</item>
<item>
<attribute name="label" translatable="yes">_Inspector</attribute>
<attribute name="action">app.inspector</attribute>
@@ -213,6 +209,7 @@
<property name="halign">1</property>
<property name="label" translatable="1">The application may have crashed.
As a precaution, auto-loading has been turned off.
You can turn it back on in the menu.
</property>
</object>
</child>
+2
View File
@@ -25,6 +25,8 @@ base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/"
[extra]
content_images = [
"../images/favicon.svg",
"../images/favicon-192x192.png",
"images/gtk-logo.svg",
]
urlmap_file = "urlmap.js"
+2
View File
@@ -24,6 +24,8 @@ base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/"
[extra]
content_images = [
"../images/favicon.svg",
"../images/favicon-192x192.png",
"images/gtk-logo.svg",
]
urlmap_file = "urlmap.js"
+2
View File
@@ -67,6 +67,8 @@ content_files = [
"macos.md",
]
content_images = [
"../images/favicon.svg",
"../images/favicon-192x192.png",
"images/gtk-logo.svg",
"images/rotated-text.png",
"images/default_cursor.png",
+2
View File
@@ -36,6 +36,8 @@ content_files = [
"paths.md",
]
content_images = [
"../images/favicon.svg",
"../images/favicon-192x192.png",
"gtk-logo.svg",
"images/arc-dark.png",
"images/arc-light.png",
+1 -1
View File
@@ -234,7 +234,7 @@ By default, GTK will try to build with support for the Vulkan graphics
API in addition to cairo and OpenGL. This option can be used to explicitly
control whether Vulkan should be used.
### `media-gstreamer` and `media-ffmpeg`
### `media-gstreamer`
By default, GTK will try to build the gstreamer backend for
media playback support. These options can be used to explicitly
@@ -13,6 +13,7 @@ SYNOPSIS
| **gtk4-rendernode-tool** <COMMAND> [OPTIONS...] <FILE>
|
| **gtk4-rendernode-tool** benchmark [OPTIONS...] <FILE>
| **gtk4-rendernode-tool** compare [OPTIONS...] <FILE1> <FILE2>
| **gtk4-rendernode-tool** info [OPTIONS...] <FILE>
| **gtk4-rendernode-tool** render [OPTIONS...] <FILE> [<FILE>]
| **gtk4-rendernode-tool** show [OPTIONS...] <FILE>
@@ -75,7 +76,21 @@ and prints the runtimes.
the execution of the commands on the GPU. It can be useful to use this flag to test
command submission performance.
Compare
^^^^^^^
The ``compare`` command compares the rendering of a node with a reference image,
or the renderings of two nodes, or two images. If any differences are found, the
exit code is 1. If the images are identical, it is 0.
``--renderer=RENDERER``
Use the given renderer.
``--output=FILE``
Save the differences as a png image in ``FILE``.
``--quiet``
Don't write results to stdout.`
+2
View File
@@ -85,6 +85,8 @@ content_files = [
"visual_index.md",
]
content_images = [
"../images/favicon.svg",
"../images/favicon-192x192.png",
"images/aboutdialog.png",
"images/action-bar.png",
"images/appchooserbutton.png",
+11 -4
View File
@@ -126,8 +126,8 @@ available on the system.
### `GTK_MEDIA`
Specifies what backend to load for [class@Gtk.MediaFile]. The possible values
depend on what options GTK was built with, and can include 'gstreamer',
'ffmpeg' and 'none'. If set to 'none', media playback will be unavailable.
depend on what options GTK was built with, and can include 'gstreamer'
and 'none'. If set to 'none', media playback will be unavailable.
The special value 'help' can be used to obtain a list of all supported
media backends.
@@ -220,8 +220,8 @@ A number of options affect behavior instead of logging:
`gl-disable`
: Disable OpenGL support
`gl-fractional`
: Enable fractional scaling for OpenGL. This is experimental
`gl-no-fractional`
: Disable fractional scaling for OpenGL.
`gl-debug`
: Insert debugging information in OpenGL
@@ -460,6 +460,13 @@ disable certain optimizations of the "ngl" and "vulkan" renderer.
The special value `all` can be used to turn on all values. The special
value `help` can be used to obtain a list of all supported values.
### `GSK_CACHE_TIMEOUT`
Overrides the timeout for cache GC in the "ngl" and "vulkan" renderers.
The value can be -1 to disable GC entirely, 0 to force GC to happen
before every frame, or a positive number to do GC in a timeout every
n seconds. The default timeout is 15 seconds.
### `GSK_MAX_TEXTURE_SIZE`
Limit texture size to the minimum of this value and the OpenGL limit
Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" version="1.0" width="88.572334" height="96.050743" id="svg6843">
<defs id="defs6845"/>
<g transform="translate(-19.822308,-16.115941)" id="layer1">
<path d="M 20.88413,30.82696 53.816977,55.527708 107.33282,39.060543 70.587303,17.177763 20.88413,30.82696 z" id="path6976" 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-opacity:1;stroke-dasharray:none;display:inline"/>
<path d="m 22.94243,82.287118 -2.0583,-51.460158 32.932847,24.700748 0,55.577152 L 22.94243,82.287118 z" id="path6978" 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-opacity:1;stroke-dasharray:none;display:inline"/>
<path d="m 53.816977,111.10486 49.399213,-20.58416 4.11663,-51.460157 -53.515843,16.467165 0,55.577152 z" id="path6980" 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-opacity:1;stroke-dasharray:none;display:inline"/>
<path d="M 23.216626,81.319479 70.48573,67.361442 103.38422,90.444516" id="path6982" style="fill:none;stroke:#ffffff;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"/>
<path d="m 70.434539,17.875593 0,49.109284" id="path6984" style="fill:#babdb6;fill-rule:evenodd;stroke:#ffffff;stroke-width:1.25;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

+2 -4
View File
@@ -123,7 +123,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
{ "portals", GDK_DEBUG_PORTALS, "Force use of portals" },
{ "no-portals", GDK_DEBUG_NO_PORTALS, "Disable use of portals" },
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" },
{ "gl-fractional", GDK_DEBUG_GL_FRACTIONAL, "Enable fractional scaling for OpenGL (experimental)" },
{ "gl-no-fractional", GDK_DEBUG_GL_NO_FRACTIONAL, "Disable fractional scaling for OpenGL" },
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
{ "gl-disable-gl", GDK_DEBUG_GL_DISABLE_GL, "Only allow OpenGL GLES API" },
{ "gl-disable-gles", GDK_DEBUG_GL_DISABLE_GLES, "Don't allow OpenGL GLES API" },
@@ -222,7 +222,6 @@ gdk_parse_debug_var (const char *variable,
}
else
{
char *val = g_strndup (p, q - p);
for (i = 0; i < nkeys; i++)
{
if (strlen (keys[i].key) == q - p &&
@@ -233,8 +232,7 @@ gdk_parse_debug_var (const char *variable,
}
}
if (i == nkeys)
fprintf (stderr, "Unrecognized value \"%s\". Try %s=help\n", val, variable);
g_free (val);
fprintf (stderr, "Unrecognized value \"%.*s\". Try %s=help\n", (int) (q - p), p, variable);
}
p = q;
+1 -1
View File
@@ -43,7 +43,7 @@ typedef enum {
GDK_DEBUG_PORTALS = 1 << 14,
GDK_DEBUG_NO_PORTALS = 1 << 15,
GDK_DEBUG_GL_DISABLE = 1 << 16,
GDK_DEBUG_GL_FRACTIONAL = 1 << 17,
GDK_DEBUG_GL_NO_FRACTIONAL= 1 << 17,
GDK_DEBUG_GL_DISABLE_GL = 1 << 19,
GDK_DEBUG_GL_DISABLE_GLES = 1 << 20,
+63 -7
View File
@@ -77,6 +77,7 @@ enum
PROP_0,
PROP_COMPOSITED,
PROP_RGBA,
PROP_SHADOW_WIDTH,
PROP_INPUT_SHAPES,
PROP_DMABUF_FORMATS,
LAST_PROP
@@ -111,6 +112,7 @@ struct _GdkDisplayPrivate {
guint rgba : 1;
guint composited : 1;
guint shadow_width: 1;
guint input_shapes : 1;
GdkDebugFlags debug_flags;
@@ -144,6 +146,10 @@ gdk_display_get_property (GObject *object,
g_value_set_boolean (value, gdk_display_is_rgba (display));
break;
case PROP_SHADOW_WIDTH:
g_value_set_boolean (value, gdk_display_supports_shadow_width (display));
break;
case PROP_INPUT_SHAPES:
g_value_set_boolean (value, gdk_display_supports_input_shapes (display));
break;
@@ -243,6 +249,18 @@ gdk_display_class_init (GdkDisplayClass *class)
TRUE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
* GdkDisplay:shadow-width: (attributes org.gtk.Property.get=gdk_display_supports_shadow_width)
*
* %TRUE if the display supports extensible frames.
*
* Since: 4.14
*/
props[PROP_SHADOW_WIDTH] =
g_param_spec_boolean ("shadow-width", NULL, NULL,
TRUE,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
* GdkDisplay:input-shapes: (attributes org.gtk.Property.get=gdk_display_supports_input_shapes)
*
@@ -254,7 +272,7 @@ gdk_display_class_init (GdkDisplayClass *class)
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
* GdkDisplay:dmabuf-formats:
* GdkDisplay:dmabuf-formats: (attributes org.gtk.Property.get=gdk_display_get_dmabuf_formats)
*
* The dma-buf formats that are supported on this display
*
@@ -391,6 +409,7 @@ gdk_display_init (GdkDisplay *display)
priv->composited = TRUE;
priv->rgba = TRUE;
priv->shadow_width = TRUE;
priv->input_shapes = TRUE;
}
@@ -1363,7 +1382,7 @@ gdk_display_init_gl (GdkDisplay *self)
return;
}
gdk_profiler_end_mark (before2, "realize OpenGL context", NULL);
gdk_profiler_end_mark (before2, "Realize OpenGL context", NULL);
/* Only assign after realize, so GdkGLContext::realize() can use
* gdk_display_get_gl_context() == NULL to differentiate between
@@ -1373,7 +1392,7 @@ gdk_display_init_gl (GdkDisplay *self)
gdk_gl_backend_use (GDK_GL_CONTEXT_GET_CLASS (context)->backend_type);
gdk_profiler_end_mark (before, "initialize OpenGL", NULL);
gdk_profiler_end_mark (before, "Init OpenGL", NULL);
}
/**
@@ -1768,7 +1787,6 @@ gdk_display_init_egl (GdkDisplay *self,
{
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
G_GNUC_UNUSED gint64 start_time2;
int major, minor;
if (!gdk_gl_backend_can_be_used (GDK_GL_EGL, error))
@@ -1795,7 +1813,6 @@ gdk_display_init_egl (GdkDisplay *self,
return FALSE;
}
start_time2 = GDK_PROFILER_CURRENT_TIME;
if (!eglInitialize (priv->egl_display, &major, &minor))
{
priv->egl_display = NULL;
@@ -1804,7 +1821,6 @@ gdk_display_init_egl (GdkDisplay *self,
_("Could not initialize EGL display"));
return FALSE;
}
gdk_profiler_end_mark (start_time2, "eglInitialize", NULL);
if (major < GDK_EGL_MIN_VERSION_MAJOR ||
(major == GDK_EGL_MIN_VERSION_MAJOR && minor < GDK_EGL_MIN_VERSION_MINOR))
@@ -1894,7 +1910,7 @@ gdk_display_init_egl (GdkDisplay *self,
g_free (ext);
}
gdk_profiler_end_mark (start_time, "init EGL", NULL);
gdk_profiler_end_mark (start_time, "Init EGL", NULL);
return TRUE;
}
@@ -2125,6 +2141,46 @@ gdk_display_set_rgba (GdkDisplay *display,
g_object_notify_by_pspec (G_OBJECT (display), props[PROP_RGBA]);
}
/**
* gdk_display_supports_shadow_width: (attributes org.gtk.Method.get_property=shadow-width)
* @display: a `GdkDisplay`
*
* Returns whether it's possible for a surface to draw outside of the window area.
*
* If %TRUE is returned the application decides if it wants to draw shadows.
* If %FALSE is returned, the compositor decides if it wants to draw shadows.
*
* Returns: %TRUE if surfaces can draw shadows or
* %FALSE if the display does not support this functionality.
*
* Since: 4.14
*/
gboolean
gdk_display_supports_shadow_width (GdkDisplay *display)
{
GdkDisplayPrivate *priv = gdk_display_get_instance_private (display);
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
return priv->shadow_width;
}
void
gdk_display_set_shadow_width (GdkDisplay *display,
gboolean shadow_width)
{
GdkDisplayPrivate *priv = gdk_display_get_instance_private (display);
g_return_if_fail (GDK_IS_DISPLAY (display));
if (priv->shadow_width == shadow_width)
return;
priv->shadow_width = shadow_width;
g_object_notify_by_pspec (G_OBJECT (display), props[PROP_SHADOW_WIDTH]);
}
static void
device_removed_cb (GdkSeat *seat,
GdkDevice *device,
+2
View File
@@ -63,6 +63,8 @@ GDK_AVAILABLE_IN_ALL
gboolean gdk_display_is_composited (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
gboolean gdk_display_is_rgba (GdkDisplay *display);
GDK_AVAILABLE_IN_4_14
gboolean gdk_display_supports_shadow_width (GdkDisplay *display);
GDK_AVAILABLE_IN_ALL
gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
+2
View File
@@ -257,6 +257,8 @@ void gdk_display_set_composited (GdkDisplay *display
gboolean composited);
void gdk_display_set_input_shapes (GdkDisplay *display,
gboolean input_shapes);
void gdk_display_set_shadow_width (GdkDisplay *display,
gboolean shadow_width);
void gdk_display_add_seat (GdkDisplay *display,
GdkSeat *seat);
+25 -1
View File
@@ -2329,18 +2329,42 @@ gdk_dmabuf_sanitize (GdkDmabuf *dest,
* @dmabuf: a sanitized GdkDmabuf
*
* A dmabuf is considered disjoint if it uses more than
* 1 file descriptor.
* 1 inode.
* Multiple file descriptors may exist when the creator
* of the dmabuf just dup()ed once for every plane...
*
* Returns: %TRUE if the dmabuf is disjoint
**/
gboolean
gdk_dmabuf_is_disjoint (const GdkDmabuf *dmabuf)
{
struct stat first_stat;
unsigned i;
/* First, do a fast check */
for (i = 1; i < dmabuf->n_planes; i++)
{
if (dmabuf->planes[0].fd != dmabuf->planes[i].fd)
break;
}
if (i == dmabuf->n_planes)
return FALSE;
/* We have different fds, do the fancy check instead */
if (fstat (dmabuf->planes[0].fd, &first_stat) != 0)
return TRUE;
for (i = 1; i < dmabuf->n_planes; i++)
{
struct stat plane_stat;
if (fstat (dmabuf->planes[0].fd, &plane_stat) != 0)
return TRUE;
if (first_stat.st_ino != plane_stat.st_ino)
return TRUE;
}
+12 -1
View File
@@ -154,6 +154,7 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
gboolean retval = FALSE;
GError *error = NULL;
GskRenderer *renderer;
GdkGLContext *previous;
g_assert (display->egl_dmabuf_formats == NULL);
g_assert (display->egl_external_formats == NULL);
@@ -161,6 +162,7 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
if (!gdk_display_prepare_gl (display, NULL))
return NULL;
previous = gdk_gl_context_get_current ();
formats = gdk_dmabuf_formats_builder_new ();
external = gdk_dmabuf_formats_builder_new ();
@@ -172,7 +174,11 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
gdk_dmabuf_formats_builder_add_formats (builder, display->egl_dmabuf_formats);
if (!retval)
return NULL;
{
if (previous)
gdk_gl_context_make_current (previous);
return NULL;
}
renderer = gsk_gl_renderer_new ();
@@ -181,10 +187,15 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
g_warning ("Failed to realize GL renderer: %s", error->message);
g_error_free (error);
g_object_unref (renderer);
if (previous)
gdk_gl_context_make_current (previous);
return NULL;
}
if (previous)
gdk_gl_context_make_current (previous);
return GDK_DMABUF_DOWNLOADER (renderer);
}
+38
View File
@@ -217,3 +217,41 @@ gdk_dmabuf_formats_peek_formats (GdkDmabufFormats *self)
{
return self->formats;
}
/**
* gdk_dmabuf_formats_equal:
* @formats1: (nullable): a `GdkDmabufFormats`
* @formats2: (nullable): another `GdkDmabufFormats`
*
* Returns whether @formats1 and @formats2 contain the
* same dmabuf formats, in the same order.
*
* Returns: `TRUE` if @formats1 and @formats2 are equal
*
* Since: 4.14
*/
gboolean
gdk_dmabuf_formats_equal (const GdkDmabufFormats *formats1,
const GdkDmabufFormats *formats2)
{
if (formats1 == formats2)
return TRUE;
if (formats1 == NULL || formats2 == NULL)
return FALSE;
if (formats1->n_formats != formats2->n_formats)
return FALSE;
for (gsize i = 0; i < formats1->n_formats; i++)
{
GdkDmabufFormat *f1 = &formats1->formats[i];
GdkDmabufFormat *f2 = &formats2->formats[i];
if (f1->fourcc != f2->fourcc ||
f1->modifier != f2->modifier)
return FALSE;
}
return TRUE;
}
+4
View File
@@ -51,4 +51,8 @@ gboolean gdk_dmabuf_formats_contains (GdkDmabufFormats *formats
guint32 fourcc,
guint64 modifier) G_GNUC_PURE;
GDK_AVAILABLE_IN_4_14
gboolean gdk_dmabuf_formats_equal (const GdkDmabufFormats *formats1,
const GdkDmabufFormats *formats2);
G_END_DECLS
+2 -1
View File
@@ -1,6 +1,7 @@
#pragma once
#ifdef HAVE_DMABUF
#include "config.h"
#ifdef HAVE_DRM_FOURCC_H
#include <drm_fourcc.h>
#endif
+1 -1
View File
@@ -33,7 +33,7 @@
/**
* GdkDmabufTexture:
*
* A `GdkTexture` representing a dma-buf object.
* A `GdkTexture` representing a DMA buffer.
*
* To create a `GdkDmabufTexture`, use the auxiliary
* [class@Gdk.DmabufTextureBuilder] object.
+177 -42
View File
@@ -309,67 +309,202 @@ typedef enum
* The color values are premultiplied with the alpha value.
* @GDK_MEMORY_R8G8B8A8_PREMULTIPLIED: 4 bytes; for red, green, blue, alpha
* The color values are premultiplied with the alpha value.
* @GDK_MEMORY_A8B8G8R8_PREMULTIPLIED: 4 bytes; for alpha, blue, green, red,
* The color values are premultiplied with the alpha value. Since 4.14
* @GDK_MEMORY_B8G8R8A8: 4 bytes; for blue, green, red, alpha.
* @GDK_MEMORY_A8R8G8B8: 4 bytes; for alpha, red, green, blue.
* @GDK_MEMORY_R8G8B8A8: 4 bytes; for red, green, blue, alpha.
* @GDK_MEMORY_A8B8G8R8: 4 bytes; for alpha, blue, green, red.
* @GDK_MEMORY_B8G8R8X8: 4 bytes; for blue, green, red, unused. Since 4.14
* @GDK_MEMORY_X8R8G8B8: 4 bytes; for unused, red, green, blue. Since 4.14
* @GDK_MEMORY_R8G8B8X8: 4 bytes; for red, green, blue, unused. Since 4.14
* @GDK_MEMORY_X8B8G8R8: 4 bytes; for unused, blue, green, red. Since 4.14
* @GDK_MEMORY_R8G8B8: 3 bytes; for red, green, blue. The data is opaque.
* @GDK_MEMORY_B8G8R8: 3 bytes; for blue, green, red. The data is opaque.
* @GDK_MEMORY_R16G16B16: 3 guint16 values; for red, green, blue. Since: 4.6
* @GDK_MEMORY_R16G16B16A16_PREMULTIPLIED: 4 guint16 values; for red, green,
* blue, alpha. The color values are premultiplied with the alpha value.
* Since: 4.6
* @GDK_MEMORY_R16G16B16A16: 4 guint16 values; for red, green, blue, alpha.
* Since: 4.6
* @GDK_MEMORY_R16G16B16_FLOAT: 3 half-float values; for red, green, blue.
* The data is opaque. Since: 4.6
* @GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED: 4 half-float values; for
* red, green, blue and alpha. The color values are premultiplied with
* the alpha value. Since: 4.6
* @GDK_MEMORY_R16G16B16A16_FLOAT: 4 half-float values; for red, green,
* blue and alpha. Since: 4.6
* @GDK_MEMORY_B32G32R32_FLOAT: 3 float values; for blue, green, red.
* The data is opaque. Since: 4.6
* @GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED: 4 float values; for
* red, green, blue and alpha. The color values are premultiplied with
* the alpha value. Since: 4.6
* @GDK_MEMORY_R32G32B32A32_FLOAT: 4 float values; for red, green, blue and
* alpha. Since: 4.6
* @GDK_MEMORY_G8A8_PREMULTIPLIED: 2 bytes; for grayscale, alpha. The color
* values are premultiplied with the alpha value. Since: 4.12
* @GDK_MEMORY_G8A8: 2 bytes; for grayscale, alpha. Since: 4.12
* @GDK_MEMORY_G8: One byte; for grayscale. The data is opaque.
* Since: 4.12
* @GDK_MEMORY_G16A16_PREMULTIPLIED: 2 guint16 values; for grayscale, alpha.
* The color values are premultiplied with the alpha value. Since: 4.12
* @GDK_MEMORY_G16A16: 2 guint16 values; for grayscale, alpha. Since: 4.12
* @GDK_MEMORY_G16: One guint16 value; for grayscale. The data is opaque.
* Since: 4.12
* @GDK_MEMORY_A8: One byte; for alpha.
* Since: 4.12
* @GDK_MEMORY_A16: One guint16 value; for alpha.
* Since: 4.12
* @GDK_MEMORY_N_FORMATS: The number of formats. This value will change as
* more formats get added, so do not rely on its concrete integer.
* @GDK_MEMORY_R32G32B32_FLOAT: 3 float values; for red, green, blue.
*
* `GdkMemoryFormat` describes formats that image data can have in memory.
*
* It describes formats by listing the contents of the memory passed to it.
* So GDK_MEMORY_A8R8G8B8 will be 1 byte (8 bits) of alpha, followed by a
* So `GDK_MEMORY_A8R8G8B8` will be 1 byte (8 bits) of alpha, followed by a
* byte each of red, green and blue. It is not endian-dependent, so
* CAIRO_FORMAT_ARGB32 is represented by different `GdkMemoryFormats`
* `CAIRO_FORMAT_ARGB32` is represented by different `GdkMemoryFormats`
* on architectures with different endiannesses.
*
* Its naming is modelled after
* [VkFormat](https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VkFormat)
* for details).
*/
/**
* GDK_MEMORY_A8B8G8R8_PREMULTIPLIED:
*
* 4 bytes; for alpha, blue, green, red, The color values are premultiplied with
* the alpha value.
*
* Since: 4.14
*/
/**
* GDK_MEMORY_B8G8R8X8:
*
* 4 bytes; for blue, green, red, unused.
*
* Since: 4.14
*/
/**
* GDK_MEMORY_X8R8G8B8:
*
* 4 bytes; for unused, red, green, blue.
*
* Since: 4.14
*/
/**
* GDK_MEMORY_R8G8B8X8:
*
* 4 bytes; for red, green, blue, unused.
*
* Since: 4.14
*/
/**
* GDK_MEMORY_X8B8G8R8:
*
* 4 bytes; for unused, blue, green, red.
*
* Since: 4.14
*/
/**
* GDK_MEMORY_R16G16B16:
*
* 3 guint16 values; for red, green, blue.
*
* Since: 4.6
*/
/**
* GDK_MEMORY_R16G16B16A16_PREMULTIPLIED:
*
* 4 guint16 values; for red, green, blue, alpha. The color values are
* premultiplied with the alpha value.
*
* Since: 4.6
*/
/**
* GDK_MEMORY_R16G16B16A16:
*
* 4 guint16 values; for red, green, blue, alpha.
*
* Since: 4.6
*/
/**
* GDK_MEMORY_R16G16B16_FLOAT:
*
* 3 half-float values; for red, green, blue. The data is opaque.
*
* Since: 4.6
*/
/**
* GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED:
*
* 4 half-float values; for red, green, blue and alpha. The color values are
* premultiplied with the alpha value.
*
* Since: 4.6
*/
/**
* GDK_MEMORY_R16G16B16A16_FLOAT:
*
* 4 half-float values; for red, green, blue and alpha.
*
* Since: 4.6
*/
/**
* GDK_MEMORY_B32G32R32_FLOAT:
*
* 3 float values; for blue, green, red. The data is opaque.
*
* Since: 4.6
*/
/**
* GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED:
*
* 4 float values; for red, green, blue and alpha. The color values are
* premultiplied with the alpha value.
*
* Since: 4.6
*/
/**
* GDK_MEMORY_R32G32B32A32_FLOAT:
*
* 4 float values; for red, green, blue and alpha.
*
* Since: 4.6
*/
/**
* GDK_MEMORY_G8A8_PREMULTIPLIED:
*
* 2 bytes; for grayscale, alpha. The color values are premultiplied with the
* alpha value.
*
* Since: 4.12
*/
/**
* GDK_MEMORY_G8A8:
*
* 2 bytes; for grayscale, alpha.
*
* Since: 4.12
*/
/**
* GDK_MEMORY_G8:
*
* One byte; for grayscale. The data is opaque.
*
* Since: 4.12
*/
/**
* GDK_MEMORY_G16A16_PREMULTIPLIED:
*
* 2 guint16 values; for grayscale, alpha. The color values are premultiplied
* with the alpha value.
*
* Since: 4.12
*/
/**
* GDK_MEMORY_G16A16:
*
* 2 guint16 values; for grayscale, alpha.
*
* Since: 4.12
*/
/**
* GDK_MEMORY_G16:
*
* One guint16 value; for grayscale. The data is opaque.
*
* Since: 4.12
*/
/**
* GDK_MEMORY_A8:
*
* One byte; for alpha.
*
* Since: 4.12
*/
/**
* GDK_MEMORY_A16:
*
* One guint16 value; for alpha.
*
* Since: 4.12
*/
/**
* GDK_MEMORY_A16_FLOAT:
*
* One half-float value; for alpha.
*
* Since: 4.12
*/
/**
* GDK_MEMORY_A32_FLOAT:
*
* One float value; for alpha.
*
* Since: 4.12
*/
typedef enum {
GDK_MEMORY_B8G8R8A8_PREMULTIPLIED,
GDK_MEMORY_A8R8G8B8_PREMULTIPLIED,
+4 -4
View File
@@ -477,18 +477,18 @@ check_event_sanity (GdkEvent *event)
}
#endif
void
gboolean
_gdk_event_emit (GdkEvent *event)
{
#ifdef G_ENABLE_DEBUG
if (!check_event_sanity (event))
return;
return FALSE;
#endif
if (gdk_drag_handle_source_event (event))
return;
return TRUE;
gdk_surface_handle_event (event);
return gdk_surface_handle_event (event);
}
/*********************************************
+9 -9
View File
@@ -619,16 +619,16 @@ typedef enum
GdkEvent* _gdk_event_unqueue (GdkDisplay *display);
void _gdk_event_emit (GdkEvent *event);
GList* _gdk_event_queue_find_first (GdkDisplay *display);
void _gdk_event_queue_remove_link (GdkDisplay *display,
GList *node);
GList* _gdk_event_queue_append (GdkDisplay *display,
GdkEvent *event);
gboolean _gdk_event_emit (GdkEvent *event);
GList* _gdk_event_queue_find_first (GdkDisplay *display);
void _gdk_event_queue_remove_link (GdkDisplay *display,
GList *node);
GList* _gdk_event_queue_append (GdkDisplay *display,
GdkEvent *event);
void _gdk_event_queue_handle_motion_compression (GdkDisplay *display);
void gdk_event_queue_handle_scroll_compression (GdkDisplay *display);
void _gdk_event_queue_flush (GdkDisplay *display);
void _gdk_event_queue_handle_motion_compression (GdkDisplay *display);
void gdk_event_queue_handle_scroll_compression (GdkDisplay *display);
void _gdk_event_queue_flush (GdkDisplay *display);
double * gdk_event_dup_axes (GdkEvent *event);
+5 -5
View File
@@ -687,7 +687,7 @@ _gdk_frame_clock_emit_update (GdkFrameClock *frame_clock)
g_signal_emit (frame_clock, signals[UPDATE], 0);
gdk_profiler_end_mark (before, "frameclock update", NULL);
gdk_profiler_end_mark (before, "Frameclock update", NULL);
}
void
@@ -699,7 +699,7 @@ _gdk_frame_clock_emit_layout (GdkFrameClock *frame_clock)
g_signal_emit (frame_clock, signals[LAYOUT], 0);
gdk_profiler_end_mark (before, "frameclock layout", NULL);
gdk_profiler_end_mark (before, "Frameclock layout", NULL);
}
void
@@ -711,7 +711,7 @@ _gdk_frame_clock_emit_paint (GdkFrameClock *frame_clock)
g_signal_emit (frame_clock, signals[PAINT], 0);
gdk_profiler_end_mark (before, "frameclock paint", NULL);
gdk_profiler_end_mark (before, "Frameclock paint", NULL);
}
void
@@ -811,12 +811,12 @@ _gdk_frame_clock_add_timings_to_profiler (GdkFrameClock *clock,
{
if (timings->drawn_time != 0)
{
gdk_profiler_add_mark (1000 * timings->drawn_time, 0, "drawn window", NULL);
gdk_profiler_add_mark (1000 * timings->drawn_time, 0, "Drawn window", NULL);
}
if (timings->presentation_time != 0)
{
gdk_profiler_add_mark (1000 * timings->presentation_time, 0, "presented window", NULL);
gdk_profiler_add_mark (1000 * timings->presentation_time, 0, "Presented window", NULL);
}
gdk_profiler_set_counter (fps_counter, gdk_frame_clock_get_fps (clock));
+1 -1
View File
@@ -694,7 +694,7 @@ gdk_frame_clock_paint_idle (void *data)
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
priv->sleep_serial = get_sleep_serial ();
gdk_profiler_end_mark (before, "frameclock cycle", NULL);
gdk_profiler_end_mark (before, "Frameclock cycle", NULL);
return FALSE;
}
+5 -17
View File
@@ -79,6 +79,7 @@
#include "gdkdebugprivate.h"
#include "gdkdisplayprivate.h"
#include "gdkdmabufeglprivate.h"
#include "gdkdmabuffourccprivate.h"
#include "gdkmemoryformatprivate.h"
#include "gdkmemorytextureprivate.h"
#include "gdkprofilerprivate.h"
@@ -98,10 +99,6 @@
#include <epoxy/egl.h>
#endif
#ifdef HAVE_DMABUF
#include <drm_fourcc.h>
#endif
#include <math.h>
#define DEFAULT_ALLOWED_APIS GDK_GL_API_GL | GDK_GL_API_GLES
@@ -386,7 +383,7 @@ gdk_gl_context_create_egl_context (GdkGLContext *context,
else if (epoxy_has_egl_extension (egl_display, "EGL_EXT_swap_buffers_with_damage"))
priv->eglSwapBuffersWithDamage = (gpointer) epoxy_eglGetProcAddress ("eglSwapBuffersWithDamageEXT");
gdk_profiler_end_mark (start_time, "realize GdkWaylandGLContext", NULL);
gdk_profiler_end_mark (start_time, "Create EGL context", NULL);
return api;
}
@@ -593,7 +590,7 @@ gdk_gl_context_get_scale (GdkGLContext *self)
scale = gdk_surface_get_scale (surface);
display = gdk_gl_context_get_display (self);
if (!(gdk_display_get_debug_flags (display) & GDK_DEBUG_GL_FRACTIONAL))
if (gdk_display_get_debug_flags (display) & GDK_DEBUG_GL_NO_FRACTIONAL)
scale = ceil (scale);
return scale;
@@ -669,7 +666,7 @@ gdk_gl_context_real_end_frame (GdkDrawContext *draw_context,
egl_surface = gdk_surface_get_egl_surface (surface);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "EGL", "swap buffers");
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "EGL swap buffers", NULL);
if (priv->eglSwapBuffersWithDamage)
{
@@ -1718,7 +1715,7 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
}
priv->has_half_float = gdk_gl_context_check_version (context, "3.0", "3.0") ||
epoxy_has_gl_extension ("OES_vertex_half_float");
epoxy_has_gl_extension ("GL_OES_vertex_half_float");
priv->has_sync = gdk_gl_context_check_version (context, "3.2", "3.0") ||
epoxy_has_gl_extension ("GL_ARB_sync") ||
@@ -2042,15 +2039,6 @@ gdk_gl_context_has_sync (GdkGLContext *self)
return priv->has_sync;
}
/* Return if GL_BGRA works with glTexImage2D */
gboolean
gdk_gl_context_has_bgra (GdkGLContext *self)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
return priv->has_bgra;
}
/* Return if glGenVertexArrays, glBindVertexArray and glDeleteVertexArrays
* can be used
*/
-2
View File
@@ -171,8 +171,6 @@ gboolean gdk_gl_context_has_vertex_half_float (GdkGLContext
gboolean gdk_gl_context_has_sync (GdkGLContext *self) G_GNUC_PURE;
gboolean gdk_gl_context_has_bgra (GdkGLContext *self) G_GNUC_PURE;
gboolean gdk_gl_context_has_vertex_arrays (GdkGLContext *self) G_GNUC_PURE;
double gdk_gl_context_get_scale (GdkGLContext *self);
+74 -2
View File
@@ -26,6 +26,8 @@
#include "gdkenumtypes.h"
#include "gdkrectangle.h"
#include <math.h>
/**
* GdkMonitor:
*
@@ -46,6 +48,7 @@ enum {
PROP_MODEL,
PROP_CONNECTOR,
PROP_SCALE_FACTOR,
PROP_SCALE,
PROP_GEOMETRY,
PROP_WIDTH_MM,
PROP_HEIGHT_MM,
@@ -70,6 +73,8 @@ static void
gdk_monitor_init (GdkMonitor *monitor)
{
monitor->scale_factor = 1;
monitor->scale = 1.0;
monitor->scale_set = FALSE;
monitor->valid = TRUE;
}
@@ -107,6 +112,10 @@ gdk_monitor_get_property (GObject *object,
g_value_set_int (value, monitor->scale_factor);
break;
case PROP_SCALE:
g_value_set_double (value, monitor->scale);
break;
case PROP_GEOMETRY:
g_value_set_boxed (value, &monitor->geometry);
break;
@@ -233,13 +242,28 @@ gdk_monitor_class_init (GdkMonitorClass *class)
* GdkMonitor:scale-factor: (attributes org.gtk.Property.get=gdk_monitor_get_scale_factor)
*
* The scale factor.
*
* The scale factor is the next larger integer,
* compared to [property@Gdk.Surface:scale].
*/
props[PROP_SCALE_FACTOR] =
g_param_spec_int ("scale-factor", NULL, NULL,
0, G_MAXINT,
1, G_MAXINT,
1,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
* GdkMonitor:scale: (attributes org.gtk.Property.get=gdk_monitor_get_scale)
*
* The scale of the monitor.
*
* Since: 4.14
*/
props[PROP_SCALE] =
g_param_spec_double ("scale", NULL, NULL,
1., G_MAXDOUBLE, 1.,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
* GdkMonitor:geometry: (attributes org.gtk.Property.get=gdk_monitor_get_geometry)
*
@@ -346,7 +370,7 @@ gdk_monitor_get_display (GdkMonitor *monitor)
* display coordinate space.
*
* The returned geometry is in application pixels, not in
* device pixels (see [method@Gdk.Monitor.get_scale_factor]).
* device pixels (see [method@Gdk.Monitor.get_scale]).
*/
void
gdk_monitor_get_geometry (GdkMonitor *monitor,
@@ -472,6 +496,29 @@ gdk_monitor_get_scale_factor (GdkMonitor *monitor)
return monitor->scale_factor;
}
/**
* gdk_monitor_get_scale: (attributes org.gtk.Method.get_property=scale)
* @monitor: a `GdkMonitor`
*
* Gets the internal scale factor that maps from monitor coordinates
* to device pixels.
*
* This can be used if you want to create pixel based data for a
* particular monitor, but most of the time youre drawing to a surface
* where it is better to use [method@Gdk.Surface.get_scale] instead.
*
* Returns: the scale
*
* Since: 4.14
*/
double
gdk_monitor_get_scale (GdkMonitor *monitor)
{
g_return_val_if_fail (GDK_IS_MONITOR (monitor), 1.);
return monitor->scale;
}
/**
* gdk_monitor_get_refresh_rate: (attributes org.gtk.Method.get_property=refresh-rate)
* @monitor: a `GdkMonitor`
@@ -583,12 +630,37 @@ void
gdk_monitor_set_scale_factor (GdkMonitor *monitor,
int scale_factor)
{
g_return_if_fail (scale_factor >= 1);
if (monitor->scale_set)
return;
if (monitor->scale_factor == scale_factor)
return;
monitor->scale_factor = scale_factor;
monitor->scale = scale_factor;
g_object_notify (G_OBJECT (monitor), "scale-factor");
g_object_notify (G_OBJECT (monitor), "scale");
}
void
gdk_monitor_set_scale (GdkMonitor *monitor,
double scale)
{
g_return_if_fail (scale >= 1.);
monitor->scale_set = TRUE;
if (monitor->scale == scale)
return;
monitor->scale = scale;
monitor->scale_factor = (int) ceil (scale);
g_object_notify (G_OBJECT (monitor), "scale");
g_object_notify (G_OBJECT (monitor), "scale-factor");
}
void
+2
View File
@@ -77,6 +77,8 @@ GDK_AVAILABLE_IN_ALL
const char * gdk_monitor_get_connector (GdkMonitor *monitor);
GDK_AVAILABLE_IN_ALL
int gdk_monitor_get_scale_factor (GdkMonitor *monitor);
GDK_AVAILABLE_IN_4_14
double gdk_monitor_get_scale (GdkMonitor *monitor);
GDK_AVAILABLE_IN_ALL
int gdk_monitor_get_refresh_rate (GdkMonitor *monitor);
GDK_AVAILABLE_IN_ALL
+5 -1
View File
@@ -44,6 +44,8 @@ struct _GdkMonitor {
int refresh_rate;
GdkSubpixelLayout subpixel_layout;
gboolean valid;
double scale;
gboolean scale_set;
};
struct _GdkMonitorClass {
@@ -64,7 +66,9 @@ void gdk_monitor_set_physical_size (GdkMonitor *monitor,
int width_mm,
int height_mm);
void gdk_monitor_set_scale_factor (GdkMonitor *monitor,
int scale);
int scale_factor);
void gdk_monitor_set_scale (GdkMonitor *monitor,
double scale);
void gdk_monitor_set_refresh_rate (GdkMonitor *monitor,
int refresh_rate);
void gdk_monitor_set_subpixel_layout (GdkMonitor *monitor,
+7 -6
View File
@@ -32,6 +32,7 @@
#include "version/gdkversionmacros.h"
#include "gdkframeclockprivate.h"
#define CATEGORY "GTK"
gboolean
gdk_profiler_is_running (void)
@@ -50,7 +51,7 @@ void
const char *message)
{
#ifdef HAVE_SYSPROF
sysprof_collector_mark (begin_time, duration, "gtk", name, message);
sysprof_collector_mark (begin_time, duration, CATEGORY, name, message);
#endif
}
@@ -60,7 +61,7 @@ void
const char *message)
{
#ifdef HAVE_SYSPROF
sysprof_collector_mark (begin_time, GDK_PROFILER_CURRENT_TIME - begin_time, "gtk", name, message);
sysprof_collector_mark (begin_time, GDK_PROFILER_CURRENT_TIME - begin_time, CATEGORY, name, message);
#endif
}
@@ -74,7 +75,7 @@ void
#ifdef HAVE_SYSPROF
va_list args;
va_start (args, message_format);
sysprof_collector_mark_vprintf (begin_time, duration, "gtk", name, message_format, args);
sysprof_collector_mark_vprintf (begin_time, duration, CATEGORY, name, message_format, args);
va_end (args);
#endif /* HAVE_SYSPROF */
}
@@ -88,7 +89,7 @@ void
#ifdef HAVE_SYSPROF
va_list args;
va_start (args, message_format);
sysprof_collector_mark_vprintf (begin_time, GDK_PROFILER_CURRENT_TIME - begin_time, "gtk", name, message_format, args);
sysprof_collector_mark_vprintf (begin_time, GDK_PROFILER_CURRENT_TIME - begin_time, CATEGORY, name, message_format, args);
va_end (args);
#endif /* HAVE_SYSPROF */
}
@@ -103,7 +104,7 @@ guint
counter.id = sysprof_collector_request_counters (1);
counter.type = SYSPROF_CAPTURE_COUNTER_DOUBLE;
counter.value.vdbl = 0.0;
g_strlcpy (counter.category, "gtk", sizeof counter.category);
g_strlcpy (counter.category, CATEGORY, sizeof counter.category);
g_strlcpy (counter.name, name, sizeof counter.name);
g_strlcpy (counter.description, description, sizeof counter.name);
@@ -125,7 +126,7 @@ guint
counter.id = sysprof_collector_request_counters (1);
counter.type = SYSPROF_CAPTURE_COUNTER_INT64;
counter.value.v64 = 0;
g_strlcpy (counter.category, "gtk", sizeof counter.category);
g_strlcpy (counter.category, CATEGORY, sizeof counter.category);
g_strlcpy (counter.name, name, sizeof counter.name);
g_strlcpy (counter.description, description, sizeof counter.name);
+108 -8
View File
@@ -20,6 +20,7 @@
#include "gdksubsurfaceprivate.h"
#include "gdksurfaceprivate.h"
#include "gdktexture.h"
#include "gsk/gskrectprivate.h"
G_DEFINE_TYPE (GdkSubsurface, gdk_subsurface, G_TYPE_OBJECT)
@@ -55,19 +56,106 @@ gdk_subsurface_get_parent (GdkSubsurface *subsurface)
return subsurface->parent;
}
static void
remove_subsurface (GdkSubsurface *subsurface)
{
GdkSurface *parent = subsurface->parent;
if (parent->subsurfaces_above == subsurface)
parent->subsurfaces_above = subsurface->sibling_above;
if (parent->subsurfaces_below == subsurface)
parent->subsurfaces_below = subsurface->sibling_below;
if (subsurface->sibling_above)
subsurface->sibling_above->sibling_below = subsurface->sibling_below;
if (subsurface->sibling_below)
subsurface->sibling_below->sibling_above = subsurface->sibling_above;
subsurface->sibling_above = NULL;
subsurface->sibling_below = NULL;
}
static void
insert_subsurface (GdkSubsurface *subsurface,
gboolean above,
GdkSubsurface *sibling)
{
GdkSurface *parent = subsurface->parent;
subsurface->above_parent = sibling->above_parent;
if (above)
{
subsurface->sibling_above = sibling->sibling_above;
sibling->sibling_above = subsurface;
subsurface->sibling_below = sibling;
if (subsurface->sibling_above)
subsurface->sibling_above->sibling_below = subsurface;
if (parent->subsurfaces_below == sibling)
parent->subsurfaces_below = subsurface;
}
else
{
subsurface->sibling_below = sibling->sibling_below;
sibling->sibling_below = subsurface;
subsurface->sibling_above = sibling;
if (subsurface->sibling_below)
subsurface->sibling_below->sibling_above = subsurface;
if (parent->subsurfaces_above == sibling)
parent->subsurfaces_above = subsurface;
}
}
gboolean
gdk_subsurface_attach (GdkSubsurface *subsurface,
GdkTexture *texture,
const graphene_rect_t *rect,
const graphene_rect_t *source,
const graphene_rect_t *dest,
gboolean above,
GdkSubsurface *sibling)
{
GdkSurface *parent = subsurface->parent;
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
g_return_val_if_fail (GDK_IS_TEXTURE (texture), FALSE);
g_return_val_if_fail (rect != NULL, FALSE);
g_return_val_if_fail (source != NULL &&
gsk_rect_contains_rect (&GRAPHENE_RECT_INIT (0, 0,
gdk_texture_get_width (texture),
gdk_texture_get_height (texture)),
source), FALSE);
g_return_val_if_fail (dest != NULL, FALSE);
g_return_val_if_fail (sibling != subsurface, FALSE);
g_return_val_if_fail (sibling == NULL || GDK_IS_SUBSURFACE (sibling), FALSE);
g_return_val_if_fail (sibling == NULL || sibling->parent == subsurface->parent, FALSE);
return GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface, texture, rect, above, sibling);
remove_subsurface (subsurface);
if (sibling)
{
insert_subsurface (subsurface, above, sibling);
}
else
{
sibling = above ? parent->subsurfaces_above : parent->subsurfaces_below;
if (sibling)
{
insert_subsurface (subsurface, !above, sibling);
}
else
{
subsurface->above_parent = above;
if (above)
parent->subsurfaces_above = subsurface;
else
parent->subsurfaces_below = subsurface;
}
}
return GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface, texture, source, dest, above, sibling);
}
void
@@ -75,6 +163,8 @@ gdk_subsurface_detach (GdkSubsurface *subsurface)
{
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
remove_subsurface (subsurface);
GDK_SUBSURFACE_GET_CLASS (subsurface)->detach (subsurface);
}
@@ -87,13 +177,23 @@ gdk_subsurface_get_texture (GdkSubsurface *subsurface)
}
void
gdk_subsurface_get_rect (GdkSubsurface *subsurface,
graphene_rect_t *rect)
gdk_subsurface_get_source (GdkSubsurface *subsurface,
graphene_rect_t *source)
{
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
g_return_if_fail (rect != NULL);
g_return_if_fail (source != NULL);
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_rect (subsurface, rect);
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_source (subsurface, source);
}
void
gdk_subsurface_get_dest (GdkSubsurface *subsurface,
graphene_rect_t *dest)
{
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
g_return_if_fail (dest != NULL);
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_dest (subsurface, dest);
}
gboolean
@@ -101,5 +201,5 @@ gdk_subsurface_is_above_parent (GdkSubsurface *subsurface)
{
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), TRUE);
return GDK_SUBSURFACE_GET_CLASS (subsurface)->is_above_parent (subsurface);
return subsurface->above_parent;
}
+16 -7
View File
@@ -41,6 +41,10 @@ struct _GdkSubsurface
GdkSurface *parent;
int ref_count;
gboolean above_parent;
GdkSubsurface *sibling_above;
GdkSubsurface *sibling_below;
};
@@ -50,14 +54,16 @@ struct _GdkSubsurfaceClass
gboolean (* attach) (GdkSubsurface *subsurface,
GdkTexture *texture,
const graphene_rect_t *rect,
const graphene_rect_t *source,
const graphene_rect_t *dest,
gboolean above,
GdkSubsurface *sibling);
void (* detach) (GdkSubsurface *subsurface);
GdkTexture * (* get_texture) (GdkSubsurface *subsurface);
void (* get_rect) (GdkSubsurface *subsurface,
graphene_rect_t *rect);
gboolean (* is_above_parent) (GdkSubsurface *subsurface);
void (* get_source) (GdkSubsurface *subsurface,
graphene_rect_t *source);
void (* get_dest) (GdkSubsurface *subsurface,
graphene_rect_t *dest);
};
GType gdk_subsurface_get_type (void) G_GNUC_CONST;
@@ -65,13 +71,16 @@ GType gdk_subsurface_get_type (void) G_GNUC_CONST;
GdkSurface * gdk_subsurface_get_parent (GdkSubsurface *subsurface);
gboolean gdk_subsurface_attach (GdkSubsurface *subsurface,
GdkTexture *texture,
const graphene_rect_t *rect,
const graphene_rect_t *source,
const graphene_rect_t *dest,
gboolean above,
GdkSubsurface *sibling);
void gdk_subsurface_detach (GdkSubsurface *subsurface);
GdkTexture * gdk_subsurface_get_texture (GdkSubsurface *subsurface);
void gdk_subsurface_get_rect (GdkSubsurface *subsurface,
graphene_rect_t *rect);
void gdk_subsurface_get_source (GdkSubsurface *subsurface,
graphene_rect_t *source);
void gdk_subsurface_get_dest (GdkSubsurface *subsurface,
graphene_rect_t *dest);
gboolean gdk_subsurface_is_above_parent (GdkSubsurface *subsurface);
+2 -2
View File
@@ -2839,7 +2839,7 @@ add_event_mark (GdkEvent *event,
class = g_type_class_ref (GDK_TYPE_EVENT_TYPE);
value = g_enum_get_value (class, event_type);
g_type_class_unref (class);
kind = value ? value->value_nick : "event";
kind = value ? value->value_nick : "Event";
switch ((int) event_type)
{
@@ -2909,7 +2909,7 @@ add_event_mark (GdkEvent *event,
break;
}
gdk_profiler_add_mark (time, end_time - time, "event", message ? message : kind);
gdk_profiler_add_mark (time, end_time - time, "Event", message ? message : kind);
g_free (message);
#endif
+6 -2
View File
@@ -99,6 +99,12 @@ struct _GdkSurface
GdkSeat *current_shortcuts_inhibited_seat;
GPtrArray *subsurfaces;
/* We keep the subsurfaces above and below the surface in two linked
* lists, which start here.
*/
GdkSubsurface *subsurfaces_above;
GdkSubsurface *subsurfaces_below;
};
struct _GdkSurfaceClass
@@ -345,8 +351,6 @@ void gdk_surface_request_motion (GdkSurface *surface);
gboolean gdk_surface_supports_edge_constraints (GdkSurface *surface);
GdkSubsurface * gdk_surface_create_subsurface (GdkSurface *surface);
void gdk_surface_destroy_subsurface (GdkSurface *surface,
GdkSubsurface *subsurface);
gsize gdk_surface_get_n_subsurfaces (GdkSurface *surface);
GdkSubsurface * gdk_surface_get_subsurface (GdkSurface *surface,
gsize idx);
+3
View File
@@ -142,6 +142,9 @@ gdk_toplevel_size_set_min_size (GdkToplevelSize *size,
* The shadow width corresponds to the part of the computed surface size
* that would consist of the shadow margin surrounding the window, would
* there be any.
*
* Shadow width should only be set if
* [method@Gtk.Display.supports_shadow_width] is %TRUE.
*/
void
gdk_toplevel_size_set_shadow_width (GdkToplevelSize *size,
+23 -2
View File
@@ -593,7 +593,8 @@ physical_device_check_features (VkPhysicalDevice device,
v12_features.shaderStorageBufferArrayNonUniformIndexing)
*out_features |= GDK_VULKAN_FEATURE_NONUNIFORM_INDEXING;
if (ycbcr_features.samplerYcbcrConversion)
if (ycbcr_features.samplerYcbcrConversion ||
physical_device_supports_extension (device, VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME))
*out_features |= GDK_VULKAN_FEATURE_YCBCR;
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME) &&
@@ -1466,13 +1467,27 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_SWAPCHAIN_EXTENSION_NAME);
if (features & GDK_VULKAN_FEATURE_DESCRIPTOR_INDEXING)
g_ptr_array_add (device_extensions, (gpointer) VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME);
if (features & GDK_VULKAN_FEATURE_YCBCR)
{
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME);
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_MAINTENANCE_1_EXTENSION_NAME);
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_BIND_MEMORY_2_EXTENSION_NAME);
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME);
}
if (features & GDK_VULKAN_FEATURE_DMABUF)
{
g_assert (features & GDK_VULKAN_FEATURE_YCBCR);
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME);
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME);
g_ptr_array_add (device_extensions, (gpointer) VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME);
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME);
}
if (features & (GDK_VULKAN_FEATURE_SEMAPHORE_IMPORT | GDK_VULKAN_FEATURE_SEMAPHORE_EXPORT))
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME);
{
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME);
}
if (features & GDK_VULKAN_FEATURE_INCREMENTAL_PRESENT)
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME);
@@ -1613,6 +1628,12 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
g_ptr_array_add (used_extensions, (gpointer) VK_EXT_DEBUG_REPORT_EXTENSION_NAME);
have_debug_report = TRUE;
}
if (g_str_equal (extensions[i].extensionName, VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME))
g_ptr_array_add (used_extensions, (gpointer) VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME);
if (g_str_equal (extensions[i].extensionName, VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME))
g_ptr_array_add (used_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME);
if (g_str_equal (extensions[i].extensionName, VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME))
g_ptr_array_add (used_extensions, (gpointer) VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME);
}
uint32_t n_layers;
+1 -1
View File
@@ -237,7 +237,7 @@ gdk_load_jpeg (GBytes *input_bytes,
g_bytes_unref (bytes);
gdk_profiler_end_mark (before, "jpeg load", NULL);
gdk_profiler_end_mark (before, "Load jpeg", NULL);
return texture;
}
+1 -1
View File
@@ -304,7 +304,7 @@ gdk_load_png (GBytes *bytes,
{
gint64 end = GDK_PROFILER_CURRENT_TIME;
if (end - before > 500000)
gdk_profiler_add_mark (before, end - before, "png load", NULL);
gdk_profiler_add_mark (before, end - before, "Load png", NULL);
}
return texture;
+1 -1
View File
@@ -504,7 +504,7 @@ gdk_load_tiff (GBytes *input_bytes,
{
gint64 end = GDK_PROFILER_CURRENT_TIME;
if (end - before > 500000)
gdk_profiler_add_mark (before, end - before, "tiff load", NULL);
gdk_profiler_add_mark (before, end - before, "Load tiff", NULL);
}
return texture;
+14 -6
View File
@@ -398,8 +398,7 @@ typedef NSString *CALayerContentsGravity;
* in from a display-side change. We need to request a layout in
* addition to the configure event.
*/
if (GDK_IS_MACOS_TOPLEVEL_SURFACE (gdk_surface) &&
GDK_MACOS_TOPLEVEL_SURFACE (gdk_surface)->decorated)
if (GDK_IS_MACOS_TOPLEVEL_SURFACE (gdk_surface))
gdk_surface_request_layout (GDK_SURFACE (gdk_surface));
}
@@ -875,12 +874,21 @@ typedef NSString *CALayerContentsGravity;
{
NSWindowStyleMask style_mask = [self styleMask];
[self setHasShadow:decorated];
if (decorated)
style_mask |= NSWindowStyleMaskTitled;
{
style_mask &= ~NSWindowStyleMaskFullSizeContentView;
[self setTitleVisibility:NSWindowTitleVisible];
}
else
style_mask &= ~NSWindowStyleMaskTitled;
{
style_mask |= NSWindowStyleMaskFullSizeContentView;
[self setTitleVisibility:NSWindowTitleHidden];
}
[self setTitlebarAppearsTransparent:!decorated];
[[self standardWindowButton:NSWindowCloseButton] setHidden:!decorated];
[[self standardWindowButton:NSWindowMiniaturizeButton] setHidden:!decorated];
[[self standardWindowButton:NSWindowZoomButton] setHidden:!decorated];
[self setStyleMask:style_mask];
}
+6
View File
@@ -271,6 +271,11 @@ _gdk_macos_cairo_context_end_frame (GdkDrawContext *draw_context,
[CATransaction commit];
}
static void
_gdk_macos_cairo_context_empty_frame (GdkDrawContext *draw_context)
{
}
static void
_gdk_macos_cairo_context_surface_resized (GdkDrawContext *draw_context)
{
@@ -287,6 +292,7 @@ _gdk_macos_cairo_context_class_init (GdkMacosCairoContextClass *klass)
draw_context_class->begin_frame = _gdk_macos_cairo_context_begin_frame;
draw_context_class->end_frame = _gdk_macos_cairo_context_end_frame;
draw_context_class->empty_frame = _gdk_macos_cairo_context_empty_frame;
draw_context_class->surface_resized = _gdk_macos_cairo_context_surface_resized;
cairo_context_class->cairo_create = _gdk_macos_cairo_context_cairo_create;
+1
View File
@@ -625,6 +625,7 @@ gdk_macos_display_init (GdkMacosDisplay *self)
gdk_display_set_composited (GDK_DISPLAY (self), TRUE);
gdk_display_set_input_shapes (GDK_DISPLAY (self), FALSE);
gdk_display_set_rgba (GDK_DISPLAY (self), TRUE);
gdk_display_set_shadow_width (GDK_DISPLAY (self), FALSE);
}
GdkDisplay *
+8 -1
View File
@@ -734,7 +734,14 @@ gdk_macos_event_source_dispatch (GSource *source,
if (event)
{
_gdk_event_emit (event);
gboolean handled = _gdk_event_emit (event);
if (!handled)
{
NSEvent *nsevent = _gdk_macos_display_get_nsevent (event);
if (nsevent != NULL)
[NSApp sendEvent: nsevent];
}
gdk_event_unref (event);
}
+6
View File
@@ -545,6 +545,11 @@ gdk_macos_gl_context_end_frame (GdkDrawContext *context,
[CATransaction commit];
}
static void
gdk_macos_gl_context_empty_frame (GdkDrawContext *draw_context)
{
}
static void
gdk_macos_gl_context_surface_resized (GdkDrawContext *draw_context)
{
@@ -667,6 +672,7 @@ gdk_macos_gl_context_class_init (GdkMacosGLContextClass *klass)
draw_context_class->begin_frame = gdk_macos_gl_context_begin_frame;
draw_context_class->end_frame = gdk_macos_gl_context_end_frame;
draw_context_class->empty_frame = gdk_macos_gl_context_empty_frame;
draw_context_class->surface_resized = gdk_macos_gl_context_surface_resized;
gl_class->get_damage = gdk_macos_gl_context_get_damage;
+1 -1
View File
@@ -219,7 +219,7 @@ gdk_deps = [
platform_gio_dep,
pangocairo_dep,
vulkan_dep,
dmabuf_dep,
libdrm_dep,
png_dep,
tiff_dep,
jpeg_dep,
+4 -4
View File
@@ -266,10 +266,10 @@ _XcursorReadUInt (XcursorFile *file, XcursorUInt *u)
if ((*file->read) (file, bytes, 4) != 4)
return XcursorFalse;
*u = ((bytes[0] << 0) |
(bytes[1] << 8) |
(bytes[2] << 16) |
(bytes[3] << 24));
*u = ((((unsigned int)(bytes[0])) << 0) |
(((unsigned int)(bytes[1])) << 8) |
(((unsigned int)(bytes[2])) << 16) |
(((unsigned int)(bytes[3])) << 24));
return XcursorTrue;
}
+2 -2
View File
@@ -186,7 +186,7 @@ gdk_wayland_cairo_context_end_frame (GdkDrawContext *draw_context,
gdk_wayland_surface_attach_image (surface, self->paint_surface, painted);
gdk_wayland_surface_request_frame (surface);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit");
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
gdk_wayland_surface_commit (surface);
gdk_wayland_surface_notify_committed (surface);
@@ -206,7 +206,7 @@ gdk_wayland_cairo_context_empty_frame (GdkDrawContext *draw_context)
gdk_wayland_surface_sync (surface);
gdk_wayland_surface_request_frame (surface);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit");
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
gdk_wayland_surface_commit (surface);
gdk_wayland_surface_notify_committed (surface);
}
+50 -34
View File
@@ -1253,7 +1253,7 @@ _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland)
gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (display_wayland), name, size);
g_value_unset (&v);
gdk_profiler_end_mark (before, "wayland", "load cursor theme");
gdk_profiler_end_mark (before, "Wayland cursor theme load", NULL);
}
@@ -1795,7 +1795,7 @@ static TranslationEntry translations[] = {
{ FALSE, "org.gnome.desktop.wm.preferences", "action-middle-click-titlebar", "gtk-titlebar-middle-click", G_TYPE_STRING, { .s = "none" } },
{ FALSE, "org.gnome.desktop.wm.preferences", "action-right-click-titlebar", "gtk-titlebar-right-click", G_TYPE_STRING, { .s = "menu" } },
{ FALSE, "org.gnome.desktop.a11y", "always-show-text-caret", "gtk-keynav-use-caret", G_TYPE_BOOLEAN, { .b = FALSE } },
{ FALSE, "org.gnome.desktop.a11y.interface", "high-contrast", "high-contast", G_TYPE_NONE, { .b = FALSE } },
{ FALSE, "org.gnome.desktop.a11y.interface", "high-contrast", "high-contrast", G_TYPE_NONE, { .b = FALSE } },
{ FALSE, "org.gnome.desktop.a11y.interface", "show-status-shapes", "gtk-show-status-shapes", G_TYPE_BOOLEAN, { .b = FALSE } },
/* Note, this setting doesn't exist, the portal and gsd fake it */
{ FALSE, "org.gnome.fontconfig", "serial", "gtk-fontconfig-timestamp", G_TYPE_NONE, { .i = 0 } },
@@ -2430,15 +2430,49 @@ apply_monitor_change (GdkWaylandMonitor *monitor)
{
GDK_DEBUG (MISC, "monitor %d changed position %d %d, size %d %d",
monitor->id,
monitor->x, monitor->y,
monitor->width, monitor->height);
monitor->output_geometry.x, monitor->output_geometry.y,
monitor->output_geometry.width, monitor->output_geometry.height);
gdk_monitor_set_geometry (GDK_MONITOR (monitor),
&(GdkRectangle) {
monitor->x, monitor->y,
monitor->width, monitor->height });
GdkRectangle logical_geometry;
gboolean needs_scaling = FALSE;
double scale;
if (monitor_has_xdg_output (monitor) &&
monitor->xdg_output_geometry.width != 0 &&
monitor->xdg_output_geometry.height != 0)
{
logical_geometry = monitor->xdg_output_geometry;
needs_scaling = logical_geometry.width == monitor->output_geometry.width &&
logical_geometry.height == monitor->output_geometry.height;
}
else
{
logical_geometry = monitor->output_geometry;
needs_scaling = TRUE;
}
if (needs_scaling)
{
int scale_factor = gdk_monitor_get_scale_factor (GDK_MONITOR (monitor));
logical_geometry.y /= scale_factor;
logical_geometry.x /= scale_factor;
logical_geometry.width /= scale_factor;
logical_geometry.height /= scale_factor;
scale = scale_factor;
}
else
{
scale = MAX (monitor->output_geometry.width / (double) logical_geometry.width,
monitor->output_geometry.height / (double) logical_geometry.height);
}
gdk_monitor_set_geometry (GDK_MONITOR (monitor), &logical_geometry);
gdk_monitor_set_connector (GDK_MONITOR (monitor), monitor->name);
gdk_monitor_set_description (GDK_MONITOR (monitor), monitor->description);
gdk_monitor_set_scale (GDK_MONITOR (monitor), scale);
monitor->wl_output_done = FALSE;
monitor->xdg_output_done = FALSE;
@@ -2456,8 +2490,8 @@ xdg_output_handle_logical_position (void *data,
GDK_DEBUG (MISC, "handle logical position xdg-output %d, position %d %d",
monitor->id, x, y);
monitor->x = x;
monitor->y = y;
monitor->xdg_output_geometry.x = x;
monitor->xdg_output_geometry.y = y;
}
static void
@@ -2471,8 +2505,8 @@ xdg_output_handle_logical_size (void *data,
GDK_DEBUG (MISC, "handle logical size xdg-output %d, size %d %d",
monitor->id, width, height);
monitor->width = width;
monitor->height = height;
monitor->xdg_output_geometry.width = width;
monitor->xdg_output_geometry.height = height;
}
static void
@@ -2558,8 +2592,8 @@ output_handle_geometry (void *data,
make, model,
transform_to_string (transform));
monitor->x = x;
monitor->y = y;
monitor->output_geometry.x = x;
monitor->output_geometry.y = y;
switch (transform)
{
@@ -2603,28 +2637,12 @@ output_handle_scale (void *data,
int32_t scale)
{
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data;
GdkRectangle previous_geometry;
int previous_scale;
int width;
int height;
GDK_DEBUG (MISC, "handle scale output %d, scale %d", monitor->id, scale);
gdk_monitor_get_geometry (GDK_MONITOR (monitor), &previous_geometry);
previous_scale = gdk_monitor_get_scale_factor (GDK_MONITOR (monitor));
/* Set the scale from wl_output protocol, regardless of xdg-output support */
gdk_monitor_set_scale_factor (GDK_MONITOR (monitor), scale);
if (monitor_has_xdg_output (monitor))
return;
width = previous_geometry.width * previous_scale;
height = previous_geometry.height * previous_scale;
monitor->width = width / scale;
monitor->height = height / scale;
if (should_update_monitor (monitor))
apply_monitor_change (monitor);
}
@@ -2638,7 +2656,6 @@ output_handle_mode (void *data,
int refresh)
{
GdkWaylandMonitor *monitor = (GdkWaylandMonitor *)data;
int scale;
GDK_DEBUG (MISC, "handle mode output %d, size %d %d, rate %d",
monitor->id, width, height, refresh);
@@ -2646,9 +2663,8 @@ output_handle_mode (void *data,
if ((flags & WL_OUTPUT_MODE_CURRENT) == 0)
return;
scale = gdk_monitor_get_scale_factor (GDK_MONITOR (monitor));
monitor->width = width / scale;
monitor->height = height / scale;
monitor->output_geometry.width = width;
monitor->output_geometry.height = height;
gdk_monitor_set_refresh_rate (GDK_MONITOR (monitor), refresh);
if (should_update_monitor (monitor) || !monitor_has_xdg_output (monitor))
+1 -2
View File
@@ -87,9 +87,8 @@ static void
gdk_wayland_gl_context_empty_frame (GdkDrawContext *draw_context)
{
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
if (impl->has_pending_subsurface_commits)
if (gdk_wayland_surface_needs_commit (surface))
{
gdk_wayland_surface_sync (surface);
gdk_wayland_surface_request_frame (surface);
+4 -5
View File
@@ -31,11 +31,10 @@ struct _GdkWaylandMonitor {
gboolean added;
struct zxdg_output_v1 *xdg_output;
/* Size and position, can be either from wl_output or xdg_output */
int32_t x;
int32_t y;
int32_t width;
int32_t height;
/* Raw wl_output data */
GdkRectangle output_geometry;
/* Raw xdg_output data */
GdkRectangle xdg_output_geometry;
char *name;
char *description;
gboolean wl_output_done;
+1 -1
View File
@@ -1012,7 +1012,7 @@ gdk_wayland_surface_create_xdg_popup (GdkWaylandPopup *wayland_popup,
}
}
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit");
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
wl_surface_commit (impl->display_server.wl_surface);
if (GDK_IS_POPUP (surface))
+1
View File
@@ -129,6 +129,7 @@ guint _gdk_wayland_cursor_get_next_image_index (GdkWaylandDisplay *display,
guint *next_image_delay);
void gdk_wayland_surface_sync (GdkSurface *surface);
gboolean gdk_wayland_surface_needs_commit (GdkSurface *surface);
void gdk_wayland_surface_commit (GdkSurface *surface);
void gdk_wayland_surface_notify_committed (GdkSurface *surface);
void gdk_wayland_surface_request_frame (GdkSurface *surface);
+4 -1
View File
@@ -3629,7 +3629,10 @@ tablet_pad_handle_leave (void *data,
wp_tablet_pad, surface);
if (pad->current_tablet)
pad->current_tablet->pads = g_list_remove (pad->current_tablet->pads, pad);
{
pad->current_tablet->pads = g_list_remove (pad->current_tablet->pads, pad);
pad->current_tablet = NULL;
}
}
static void
+1 -2
View File
@@ -22,12 +22,11 @@ struct _GdkWaylandSubsurface
GdkTexture *texture;
cairo_rectangle_int_t dest;
graphene_rect_t source;
struct wl_region *opaque_region;
struct wl_callback *frame_callback;
gboolean above_parent;
};
struct _GdkWaylandSubsurfaceClass
+46 -34
View File
@@ -152,7 +152,8 @@ get_wl_buffer (GdkWaylandSubsurface *self,
static gboolean
gdk_wayland_subsurface_attach (GdkSubsurface *sub,
GdkTexture *texture,
const graphene_rect_t *rect,
const graphene_rect_t *source,
const graphene_rect_t *dest,
gboolean above,
GdkSubsurface *sibling)
{
@@ -166,8 +167,8 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
graphene_rect_t device_rect;
cairo_rectangle_int_t device_dest;
if (sib)
will_be_above = sib->above_parent;
if (sibling)
will_be_above = sibling->above_parent;
else
will_be_above = above;
@@ -177,30 +178,37 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
return FALSE;
}
self->dest.x = rect->origin.x;
self->dest.y = rect->origin.y;
self->dest.width = rect->size.width;
self->dest.height = rect->size.height;
self->dest.x = dest->origin.x;
self->dest.y = dest->origin.y;
self->dest.width = dest->size.width;
self->dest.height = dest->size.height;
self->source.origin.x = source->origin.x;
self->source.origin.y = source->origin.y;
self->source.size.width = source->size.width;
self->source.size.height = source->size.height;
scale = gdk_fractional_scale_to_double (&parent->scale);
device_rect.origin.x = rect->origin.x * scale;
device_rect.origin.y = rect->origin.y * scale;
device_rect.size.width = rect->size.width * scale;
device_rect.size.height = rect->size.height * scale;
device_rect.origin.x = dest->origin.x * scale;
device_rect.origin.y = dest->origin.y * scale;
device_rect.size.width = dest->size.width * scale;
device_rect.size.height = dest->size.height * scale;
device_dest.x = device_rect.origin.x;
device_dest.y = device_rect.origin.y;
device_dest.width = device_rect.size.width;
device_dest.height = device_rect.size.height;
if (self->dest.x != rect->origin.x ||
self->dest.y != rect->origin.y ||
self->dest.width != rect->size.width ||
self->dest.height != rect->size.height)
if (self->dest.x != dest->origin.x ||
self->dest.y != dest->origin.y ||
self->dest.width != dest->size.width ||
self->dest.height != dest->size.height)
{
GDK_DISPLAY_DEBUG (gdk_surface_get_display (sub->parent), OFFLOAD,
"Non-integer coordinates %g %g %g %g for %dx%d texture, hiding subsurface %p",
rect->origin.x, rect->origin.y,
rect->size.width, rect->size.height,
dest->origin.x, dest->origin.y,
dest->size.width, dest->size.height,
gdk_texture_get_width (texture),
gdk_texture_get_height (texture),
self);
@@ -296,6 +304,11 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
{
wl_subsurface_set_position (self->subsurface, self->dest.x, self->dest.y);
wp_viewport_set_destination (self->viewport, self->dest.width, self->dest.height);
wp_viewport_set_source (self->viewport,
wl_fixed_from_double (self->source.origin.x),
wl_fixed_from_double (self->source.origin.y),
wl_fixed_from_double (self->source.size.width),
wl_fixed_from_double (self->source.size.height));
if (buffer)
{
@@ -322,8 +335,6 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
wl_subsurface_place_above (self->subsurface, sib->surface);
else
wl_subsurface_place_below (self->subsurface, sib->surface);
self->above_parent = sib->above_parent;
}
else
{
@@ -333,7 +344,6 @@ gdk_wayland_subsurface_attach (GdkSubsurface *sub,
else
wl_subsurface_place_below (self->subsurface,
GDK_WAYLAND_SURFACE (sub->parent)->display_server.wl_surface);
self->above_parent = above;
}
wl_surface_commit (self->surface);
@@ -373,23 +383,27 @@ gdk_wayland_subsurface_get_texture (GdkSubsurface *sub)
}
static void
gdk_wayland_subsurface_get_rect (GdkSubsurface *sub,
graphene_rect_t *rect)
gdk_wayland_subsurface_get_dest (GdkSubsurface *sub,
graphene_rect_t *dest)
{
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
rect->origin.x = self->dest.x;
rect->origin.y = self->dest.y;
rect->size.width = self->dest.width;
rect->size.height = self->dest.height;
dest->origin.x = self->dest.x;
dest->origin.y = self->dest.y;
dest->size.width = self->dest.width;
dest->size.height = self->dest.height;
}
static gboolean
gdk_wayland_subsurface_is_above_parent (GdkSubsurface *sub)
static void
gdk_wayland_subsurface_get_source (GdkSubsurface *sub,
graphene_rect_t *source)
{
GdkWaylandSubsurface *self = (GdkWaylandSubsurface *)sub;
GdkWaylandSubsurface *self = GDK_WAYLAND_SUBSURFACE (sub);
return self->above_parent;
source->origin.x = self->source.origin.x;
source->origin.y = self->source.origin.y;
source->size.width = self->source.size.width;
source->size.height = self->source.size.height;
}
static void
@@ -403,8 +417,8 @@ gdk_wayland_subsurface_class_init (GdkWaylandSubsurfaceClass *class)
subsurface_class->attach = gdk_wayland_subsurface_attach;
subsurface_class->detach = gdk_wayland_subsurface_detach;
subsurface_class->get_texture = gdk_wayland_subsurface_get_texture;
subsurface_class->get_rect = gdk_wayland_subsurface_get_rect;
subsurface_class->is_above_parent = gdk_wayland_subsurface_is_above_parent;
subsurface_class->get_source = gdk_wayland_subsurface_get_source;
subsurface_class->get_dest = gdk_wayland_subsurface_get_dest;
};
static void
@@ -478,8 +492,6 @@ gdk_wayland_surface_create_subsurface (GdkSurface *surface)
wl_region_add (sub->opaque_region, 0, 0, G_MAXINT, G_MAXINT);
wl_surface_set_opaque_region (sub->surface, sub->opaque_region);
sub->above_parent = TRUE;
GDK_DISPLAY_DEBUG (display, OFFLOAD, "Subsurface %p of surface %p created", sub, impl);
return GDK_SUBSURFACE (sub);
+26 -11
View File
@@ -199,20 +199,20 @@ get_egl_window_size (GdkSurface *surface,
GdkDisplay *display = gdk_surface_get_display (surface);
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
if (GDK_DISPLAY_DEBUG_CHECK (display, GL_FRACTIONAL))
{
GDK_DISPLAY_DEBUG (display, OPENGL, "Using fractional scale %g for EGL window", gdk_fractional_scale_to_double (&impl->scale));
*width = gdk_fractional_scale_scale (&impl->scale, surface->width),
*height = gdk_fractional_scale_scale (&impl->scale, surface->height);
}
else
if (GDK_DISPLAY_DEBUG_CHECK (display, GL_NO_FRACTIONAL))
{
GDK_DISPLAY_DEBUG (display, OPENGL, "Using integer scale %d for EGL window", gdk_fractional_scale_to_int (&impl->scale));
*width = surface->width * gdk_fractional_scale_to_int (&impl->scale);
*height = surface->height * gdk_fractional_scale_to_int (&impl->scale);
}
else
{
GDK_DISPLAY_DEBUG (display, OPENGL, "Using fractional scale %g for EGL window", gdk_fractional_scale_to_double (&impl->scale));
*width = gdk_fractional_scale_scale (&impl->scale, surface->width),
*height = gdk_fractional_scale_scale (&impl->scale, surface->height);
}
}
void
@@ -274,7 +274,7 @@ gdk_wayland_surface_frame_callback (GdkSurface *surface,
GdkFrameClock *clock = gdk_surface_get_frame_clock (surface);
GdkFrameTimings *timings;
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "frame event");
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland frame event", NULL);
GDK_DISPLAY_DEBUG (GDK_DISPLAY (display_wayland), EVENTS, "frame %p", surface);
g_clear_pointer (&impl->frame_callback, wl_callback_destroy);
@@ -646,9 +646,12 @@ gdk_wayland_surface_sync_opaque_region (GdkSurface *surface)
cairo_region_t *region = cairo_region_copy (impl->opaque_region);
for (gsize i = 0; i < gdk_surface_get_n_subsurfaces (surface); i++)
{
GdkWaylandSubsurface *sub = (GdkWaylandSubsurface *)gdk_surface_get_subsurface (surface, i);
if (sub->above_parent)
GdkSubsurface *subsurface = gdk_surface_get_subsurface (surface, i);
GdkWaylandSubsurface *sub = (GdkWaylandSubsurface *) subsurface;
if (subsurface->above_parent)
continue;
if (sub->texture != NULL)
cairo_region_subtract_rectangle (region, &sub->dest);
}
@@ -746,6 +749,18 @@ gdk_wayland_surface_sync (GdkSurface *surface)
gdk_wayland_surface_sync_viewport (surface);
}
gboolean
gdk_wayland_surface_needs_commit (GdkSurface *surface)
{
GdkWaylandSurface *self = GDK_WAYLAND_SURFACE (surface);
return self->has_pending_subsurface_commits ||
self->opaque_region_dirty ||
self->input_region_dirty ||
self->buffer_scale_dirty ||
self->viewport_dirty;
}
static void
gdk_wayland_surface_fractional_scale_preferred_scale_cb (void *data,
struct wp_fractional_scale_v1 *fractional_scale,
+1 -1
View File
@@ -830,7 +830,7 @@ gdk_wayland_surface_create_xdg_toplevel (GdkWaylandToplevel *wayland_toplevel)
maybe_set_gtk_surface_dbus_properties (wayland_toplevel);
maybe_set_gtk_surface_modal (wayland_toplevel);
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "wayland", "surface commit");
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
wl_surface_commit (wayland_surface->display_server.wl_surface);
}
+6
View File
@@ -153,6 +153,11 @@ gdk_win32_cairo_context_end_frame (GdkDrawContext *draw_context,
g_clear_pointer (&self->window_surface, cairo_surface_destroy);
}
static void
gdk_win32_cairo_context_empty_frame (GdkDrawContext *draw_context)
{
}
static cairo_t *
gdk_win32_cairo_context_cairo_create (GdkCairoContext *context)
{
@@ -182,6 +187,7 @@ gdk_win32_cairo_context_class_init (GdkWin32CairoContextClass *klass)
draw_context_class->begin_frame = gdk_win32_cairo_context_begin_frame;
draw_context_class->end_frame = gdk_win32_cairo_context_end_frame;
draw_context_class->empty_frame = gdk_win32_cairo_context_empty_frame;
cairo_context_class->cairo_create = gdk_win32_cairo_context_cairo_create;
}
+21 -10
View File
@@ -892,11 +892,11 @@ pixbuf_to_hicon (GdkPixbuf *pixbuf,
int x,
int y);
static GdkWin32HCursor *
gdk_win32hcursor_create_for_texture (GdkWin32Display *display,
GdkTexture *texture,
int x,
int y)
HICON
_gdk_win32_create_hicon_for_texture (GdkTexture *texture,
gboolean is_icon,
int x,
int y)
{
cairo_surface_t *surface;
GdkPixbuf *pixbuf;
@@ -906,13 +906,24 @@ gdk_win32hcursor_create_for_texture (GdkWin32Display *display,
surface = gdk_texture_download_surface (texture);
width = cairo_image_surface_get_width (surface);
height = cairo_image_surface_get_height (surface);
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, width, height);
icon = pixbuf_to_hicon (pixbuf, FALSE, x, y);
icon = pixbuf_to_hicon (pixbuf, is_icon, x, y);
g_object_unref (pixbuf);
return icon;
}
static GdkWin32HCursor *
gdk_win32hcursor_create_for_texture (GdkWin32Display *display,
GdkTexture *texture,
int x,
int y)
{
HICON icon = _gdk_win32_create_hicon_for_texture (texture, FALSE, x, y);
return gdk_win32_hcursor_new (display, (HCURSOR) icon, TRUE);
}
+1
View File
@@ -1064,6 +1064,7 @@ gdk_win32_display_check_composited (GdkWin32Display *display)
}
gdk_display_set_composited (GDK_DISPLAY (display), composited);
gdk_display_set_shadow_width (GDK_DISPLAY (display), composited);
}
static void
+6
View File
@@ -117,6 +117,11 @@ gdk_win32_gl_context_egl_begin_frame (GdkDrawContext *draw_context,
GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_egl_parent_class)->begin_frame (draw_context, depth, update_area);
}
static void
gdk_win32_gl_context_egl_empty_frame (GdkDrawContext *draw_context)
{
}
static void
gdk_win32_gl_context_egl_class_init (GdkWin32GLContextClass *klass)
{
@@ -127,6 +132,7 @@ gdk_win32_gl_context_egl_class_init (GdkWin32GLContextClass *klass)
draw_context_class->begin_frame = gdk_win32_gl_context_egl_begin_frame;
draw_context_class->end_frame = gdk_win32_gl_context_egl_end_frame;
draw_context_class->empty_frame = gdk_win32_gl_context_egl_empty_frame;
}
static void
+20 -4
View File
@@ -116,6 +116,11 @@ gdk_win32_gl_context_wgl_end_frame (GdkDrawContext *draw_context,
SwapBuffers (hdc);
}
static void
gdk_win32_gl_context_wgl_empty_frame (GdkDrawContext *draw_context)
{
}
static void
gdk_win32_gl_context_wgl_begin_frame (GdkDrawContext *draw_context,
GdkMemoryDepth depth,
@@ -126,7 +131,7 @@ gdk_win32_gl_context_wgl_begin_frame (GdkDrawContext *draw_context,
GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_wgl_parent_class)->begin_frame (draw_context, depth, update_area);
}
#define PIXEL_ATTRIBUTES 17
#define PIXEL_ATTRIBUTES 21
static int
get_wgl_pfd (HDC hdc,
@@ -171,10 +176,19 @@ get_wgl_pfd (HDC hdc,
pixelAttribs[i++] = WGL_ALPHA_BITS_ARB;
pixelAttribs[i++] = 8;
pixelAttribs[i++] = WGL_DEPTH_BITS_ARB;
pixelAttribs[i++] = 0;
pixelAttribs[i++] = WGL_STENCIL_BITS_ARB;
pixelAttribs[i++] = 0;
pixelAttribs[i++] = WGL_ACCUM_BITS_ARB;
pixelAttribs[i++] = 0;
/* end of "Update PIXEL_ATTRIBUTES above if any groups are added here!" */
pixelAttribs[i++] = 0; /* end of pixelAttribs */
g_assert (i <= PIXEL_ATTRIBUTES);
g_assert (i == PIXEL_ATTRIBUTES);
if (!wglMakeCurrent (display_win32->dummy_context_wgl.hdc,
display_win32->dummy_context_wgl.hglrc))
@@ -200,7 +214,7 @@ get_wgl_pfd (HDC hdc,
pfd->iPixelType = PFD_TYPE_RGBA;
pfd->cColorBits = GetDeviceCaps (hdc, BITSPIXEL);
pfd->cAlphaBits = 8;
pfd->dwLayerMask = PFD_MAIN_PLANE;
pfd->iLayerType = PFD_MAIN_PLANE;
best_pf = ChoosePixelFormat (hdc, pfd);
}
@@ -599,7 +613,7 @@ set_wgl_pixformat_for_hdc (GdkWin32Display *display_win32,
{
gboolean skip_acquire = FALSE;
gboolean set_pixel_format_result = FALSE;
PIXELFORMATDESCRIPTOR pfd;
PIXELFORMATDESCRIPTOR pfd = {0};
/* one is only allowed to call SetPixelFormat(), and so ChoosePixelFormat()
* one single time per window HDC
@@ -809,6 +823,8 @@ gdk_win32_gl_context_wgl_class_init (GdkWin32GLContextWGLClass *klass)
draw_context_class->begin_frame = gdk_win32_gl_context_wgl_begin_frame;
draw_context_class->end_frame = gdk_win32_gl_context_wgl_end_frame;
draw_context_class->empty_frame = gdk_win32_gl_context_wgl_empty_frame;
gobject_class->dispose = gdk_win32_gl_context_wgl_dispose;
}
+5
View File
@@ -211,6 +211,11 @@ Win32Cursor * win32_cursor_theme_get_cursor (Win32CursorTheme *theme,
void win32_cursor_theme_destroy (Win32CursorTheme *theme);
Win32CursorTheme *_gdk_win32_display_get_cursor_theme (GdkWin32Display *win32_display);
HICON _gdk_win32_create_hicon_for_texture (GdkTexture *texture,
gboolean is_icon,
int x,
int y);
gboolean _gdk_win32_display_has_pending (GdkDisplay *display);
void _gdk_win32_display_queue_events (GdkDisplay *display);
+78
View File
@@ -4308,6 +4308,82 @@ gdk_win32_surface_set_shadow_width (GdkSurface *window,
impl->shadow_y = top + bottom;
}
static void
gdk_win32_surface_set_icon_list (GdkSurface *surface,
GList *textures)
{
GdkTexture *texture, *big_texture, *small_texture;
gint big_diff, small_diff;
gint big_w, big_h, small_w, small_h;
gint w, h;
gint dw, dh, diff;
HICON small_hicon, big_hicon;
GdkWin32Surface *impl;
if (GDK_SURFACE_DESTROYED (surface))
return;
impl = GDK_WIN32_SURFACE (surface);
/* ideal sizes for small and large icons */
big_w = GetSystemMetrics (SM_CXICON);
big_h = GetSystemMetrics (SM_CYICON);
small_w = GetSystemMetrics (SM_CXSMICON);
small_h = GetSystemMetrics (SM_CYSMICON);
/* find closest sized icons in the list */
big_texture = NULL;
small_texture = NULL;
big_diff = 0;
small_diff = 0;
while (textures)
{
texture = (GdkTexture*) textures->data;
w = gdk_texture_get_width (texture);
h = gdk_texture_get_height (texture);
dw = ABS (w - big_w);
dh = ABS (h - big_h);
diff = dw*dw + dh*dh;
if (big_texture == NULL || diff < big_diff)
{
big_texture = texture;
big_diff = diff;
}
dw = ABS (w - small_w);
dh = ABS (h - small_h);
diff = dw*dw + dh*dh;
if (small_texture == NULL || diff < small_diff)
{
small_texture = texture;
small_diff = diff;
}
textures = textures->next;
}
if (big_texture == NULL || small_texture == NULL)
return;
/* Create the icons */
big_hicon = big_texture ? _gdk_win32_create_hicon_for_texture (big_texture, TRUE, 0, 0) : NULL;
small_hicon = small_texture ? _gdk_win32_create_hicon_for_texture (small_texture, TRUE, 0, 0) : NULL;
/* Set the icons */
SendMessage (GDK_SURFACE_HWND (surface), WM_SETICON, ICON_BIG,
(LPARAM)big_hicon);
SendMessage (GDK_SURFACE_HWND (surface), WM_SETICON, ICON_SMALL,
(LPARAM)small_hicon);
/* Store the icons, destroying any previous icons */
if (impl->hicon_big)
GDI_CALL (DestroyIcon, (impl->hicon_big));
impl->hicon_big = big_hicon;
if (impl->hicon_small)
GDI_CALL (DestroyIcon, (impl->hicon_small));
impl->hicon_small = small_hicon;
}
double
_gdk_win32_surface_get_scale (GdkSurface *surface)
@@ -4738,6 +4814,8 @@ gdk_win32_toplevel_set_property (GObject *object,
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_ICON_LIST:
gdk_win32_surface_set_icon_list (surface, g_value_get_pointer (value));
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
break;
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
+6
View File
@@ -74,6 +74,11 @@ gdk_win32_vulkan_context_begin_frame (GdkDrawContext *draw_context,
GDK_DRAW_CONTEXT_CLASS (gdk_win32_vulkan_context_parent_class)->begin_frame (draw_context, depth, update_area);
}
static void
gdk_win32_vulkan_context_empty_frame (GdkDrawContext *draw_context)
{
}
static void
gdk_win32_vulkan_context_class_init (GdkWin32VulkanContextClass *klass)
{
@@ -82,6 +87,7 @@ gdk_win32_vulkan_context_class_init (GdkWin32VulkanContextClass *klass)
context_class->create_surface = gdk_win32_vulkan_context_create_surface;
draw_context_class->begin_frame = gdk_win32_vulkan_context_begin_frame;
draw_context_class->empty_frame = gdk_win32_vulkan_context_empty_frame;
}
static void
+10
View File
@@ -1429,6 +1429,9 @@ gdk_x11_display_open (const char *display_name)
int ignore;
int maj, min;
char *cm_name;
gboolean frame_extents;
gboolean rgba;
gboolean composited;
XInitThreads ();
@@ -1643,6 +1646,13 @@ gdk_x11_display_open (const char *display_name)
gdk_x11_get_xatom_by_name_for_display (display, cm_name)) != None);
g_free (cm_name);
frame_extents = gdk_x11_screen_supports_net_wm_hint (gdk_x11_display_get_screen (display),
g_intern_static_string ("_GTK_FRAME_EXTENTS"));
rgba = gdk_display_is_rgba (display);
composited = gdk_display_is_composited (display);
gdk_display_set_shadow_width (display, frame_extents && rgba && composited);
gdk_display_emit_opened (display);
return display;
+4 -1
View File
@@ -316,7 +316,10 @@ gdk_x11_gl_context_glx_get_damage (GdkGLContext *context)
for (i = 0; i < buffer_age - 1; i++)
{
if (context->old_updated_area[i] == NULL)
return GDK_GL_CONTEXT_CLASS (gdk_x11_gl_context_glx_parent_class)->get_damage (context);
{
cairo_region_destroy (damage);
return GDK_GL_CONTEXT_CLASS (gdk_x11_gl_context_glx_parent_class)->get_damage (context);
}
cairo_region_union (damage, context->old_updated_area[i]);
}
+6 -1
View File
@@ -2655,6 +2655,7 @@ gdk_x11_surface_get_geometry (GdkSurface *surface,
{
GdkX11Surface *impl;
Window root;
Window child;
int tx;
int ty;
guint twidth;
@@ -2669,7 +2670,11 @@ gdk_x11_surface_get_geometry (GdkSurface *surface,
XGetGeometry (GDK_SURFACE_XDISPLAY (surface),
GDK_SURFACE_XID (surface),
&root, &tx, &ty, &twidth, &theight, &tborder_width, &tdepth);
XTranslateCoordinates (GDK_SURFACE_XDISPLAY (surface),
GDK_SURFACE_XID (surface),
root, 0, 0, &tx, &ty, &child);
if (x)
*x = tx / impl->surface_scale;
if (y)
+5 -6
View File
@@ -1066,8 +1066,7 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self,
gsk_gl_profiler_begin_gpu_region (self->gl_profiler);
gsk_profiler_timer_begin (self->profiler, self->metrics.cpu_time);
glEnable (GL_DEPTH_TEST);
glDepthFunc (GL_LEQUAL);
glDisable (GL_DEPTH_TEST);
/* Pre-multiplied alpha */
glEnable (GL_BLEND);
@@ -1608,8 +1607,8 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
if (gdk_profiler_is_running ())
{
gdk_profiler_add_markf (start_time, GDK_PROFILER_CURRENT_TIME-start_time,
"Download Texture chunk",
gdk_profiler_end_markf (start_time,
"Download texture chunk",
"Tile %dx%d Size %dx%d", x, y, width, height);
start_time = GDK_PROFILER_CURRENT_TIME;
}
@@ -1654,8 +1653,8 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
g_bytes_unref (bytes);
if (gdk_profiler_is_running ())
gdk_profiler_add_markf (start_time, GDK_PROFILER_CURRENT_TIME-start_time,
"Upload Texture chunk",
gdk_profiler_end_markf (start_time,
"Upload texture chunk",
"Tile %dx%d Size %dx%d", x, y, width, height);
}
+2 -2
View File
@@ -424,7 +424,7 @@ gsk_gl_driver_load_programs (GskGLDriver *self,
failure:
g_clear_object (&compiler);
gdk_profiler_end_mark (start_time, "load programs", NULL);
gdk_profiler_end_mark (start_time, "Load GL programs", NULL);
return ret;
}
@@ -477,7 +477,7 @@ gsk_gl_driver_new (GskGLCommandQueue *command_queue,
self->icons_library = gsk_gl_icon_library_new (self);
self->shadows_library = gsk_gl_shadow_library_new (self);
gdk_profiler_end_mark (before, "create GskGLDriver", NULL);
gdk_profiler_end_mark (before, "Create GL driver", NULL);
return g_steal_pointer (&self);
}
+2 -6
View File
@@ -119,11 +119,7 @@ gsk_gl_glyph_library_init_atlas (GskGLTextureLibrary *self,
memset (pixel_data, 255, sizeof pixel_data);
if (!gdk_gl_context_has_bgra (gdk_gl_context_get_current ())
#if G_BYTE_ORDER == G_BIG_ENDIAN
|| gdk_gl_context_get_use_es (gdk_gl_context_get_current ())
#endif
)
if (gdk_gl_context_get_use_es (gdk_gl_context_get_current ()))
{
gl_format = GL_RGBA;
gl_type = GL_UNSIGNED_BYTE;
@@ -380,7 +376,7 @@ gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary *self,
{
char message[64];
g_snprintf (message, sizeof message, "Size %dx%d", width, height);
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Upload Glyph", message);
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Upload glyph", message);
}
}
+1 -1
View File
@@ -211,6 +211,6 @@ gsk_gl_icon_library_add (GskGLIconLibrary *self,
{
char message[64];
g_snprintf (message, sizeof message, "Size %dx%d", width, height);
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Upload Icon", message);
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Upload icon", message);
}
}
+33 -33
View File
@@ -830,8 +830,8 @@ rounded_rect_scale_corners (const GskRoundedRect *rect,
{
for (guint i = 0; i < G_N_ELEMENTS (out_rect->corner); i++)
{
out_rect->corner[i].width = rect->corner[i].width * fabs (scale_x);
out_rect->corner[i].height = rect->corner[i].height * fabs (scale_y);
out_rect->corner[i].width = rect->corner[i].width * fabsf (scale_x);
out_rect->corner[i].height = rect->corner[i].height * fabsf (scale_y);
}
if (scale_x < 0)
@@ -1173,8 +1173,8 @@ gsk_gl_render_job_visit_as_fallback (GskGLRenderJob *job,
{
float scale_x = job->scale_x;
float scale_y = job->scale_y;
int surface_width = ceilf (node->bounds.size.width * fabs (scale_x));
int surface_height = ceilf (node->bounds.size.height * fabs (scale_y));
int surface_width = ceilf (node->bounds.size.width * fabsf (scale_x));
int surface_height = ceilf (node->bounds.size.height * fabsf (scale_y));
GdkTexture *texture;
cairo_surface_t *surface;
cairo_surface_t *rendered_surface;
@@ -1203,7 +1203,7 @@ gsk_gl_render_job_visit_as_fallback (GskGLRenderJob *job,
surface_width,
surface_height);
cairo_surface_set_device_scale (rendered_surface, fabs (scale_x), fabs (scale_y));
cairo_surface_set_device_scale (rendered_surface, fabsf (scale_x), fabsf (scale_y));
cr = cairo_create (rendered_surface);
cairo_save (cr);
@@ -1217,16 +1217,16 @@ gsk_gl_render_job_visit_as_fallback (GskGLRenderJob *job,
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
surface_width,
surface_height);
cairo_surface_set_device_scale (surface, fabs (scale_x), fabs (scale_y));
cairo_surface_set_device_scale (surface, fabsf (scale_x), fabsf (scale_y));
cr = cairo_create (surface);
/* We draw upside down here, so it matches what GL does. */
cairo_save (cr);
cairo_scale (cr, scale_x < 0 ? -1 : 1, scale_y < 0 ? 1 : -1);
cairo_translate (cr, scale_x < 0 ? - surface_width / fabs (scale_x) : 0,
scale_y < 0 ? 0 : - surface_height / fabs (scale_y));
cairo_translate (cr, scale_x < 0 ? - surface_width / fabsf (scale_x) : 0,
scale_y < 0 ? 0 : - surface_height / fabsf (scale_y));
cairo_set_source_surface (cr, rendered_surface, 0, 0);
cairo_rectangle (cr, 0, 0, surface_width / fabs (scale_x), surface_height / fabs (scale_y));
cairo_rectangle (cr, 0, 0, surface_width / fabsf (scale_x), surface_height / fabsf (scale_y));
cairo_fill (cr);
cairo_restore (cr);
cairo_destroy (cr);
@@ -1432,10 +1432,10 @@ blur_node (GskGLRenderJob *job,
offscreen->texture_id = blur_offscreen (job,
offscreen,
texture_width * fabs (scale_x),
texture_height * fabs (scale_y),
blur_radius * fabs (scale_x),
blur_radius * fabs (scale_y));
texture_width * fabsf (scale_x),
texture_height * fabsf (scale_y),
blur_radius * fabsf (scale_x),
blur_radius * fabsf (scale_y));
init_full_texture_region (offscreen);
}
@@ -2019,9 +2019,9 @@ result_is_axis_aligned (GskTransform *transform,
for (guint i = 0; i < 4; i++)
{
p = graphene_quad_get_point (&q, i);
if (fabs (p->x - b1.x) > FLT_EPSILON && fabs (p->x - b2.x) > FLT_EPSILON)
if (fabsf (p->x - b1.x) > FLT_EPSILON && fabsf (p->x - b2.x) > FLT_EPSILON)
return FALSE;
if (fabs (p->y - b1.y) > FLT_EPSILON && fabs (p->y - b2.y) > FLT_EPSILON)
if (fabsf (p->y - b1.y) > FLT_EPSILON && fabsf (p->y - b2.y) > FLT_EPSILON)
return FALSE;
}
@@ -2304,8 +2304,8 @@ gsk_gl_render_job_visit_blurred_inset_shadow_node (GskGLRenderJob *job,
&offscreen,
texture_width,
texture_height,
blur_radius * fabs (scale_x),
blur_radius * fabs (scale_y));
blur_radius * fabsf (scale_x),
blur_radius * fabsf (scale_y));
gsk_gl_driver_release_render_target (job->driver, render_target, TRUE);
@@ -2501,8 +2501,8 @@ gsk_gl_render_job_visit_blurred_outset_shadow_node (GskGLRenderJob *job,
do_slicing = TRUE;
}
texture_width = (int)ceil ((scaled_outline.bounds.size.width + blur_extra) * scale_x);
texture_height = (int)ceil ((scaled_outline.bounds.size.height + blur_extra) * scale_y);
texture_width = (int)ceilf ((scaled_outline.bounds.size.width + blur_extra) * scale_x);
texture_height = (int)ceilf ((scaled_outline.bounds.size.height + blur_extra) * scale_y);
scaled_outline.bounds.origin.x = extra_blur_pixels_x;
scaled_outline.bounds.origin.y = extra_blur_pixels_y;
@@ -2577,8 +2577,8 @@ gsk_gl_render_job_visit_blurred_outset_shadow_node (GskGLRenderJob *job,
&offscreen,
texture_width,
texture_height,
blur_radius * fabs (scale_x),
blur_radius * fabs (scale_y));
blur_radius * fabsf (scale_x),
blur_radius * fabsf (scale_y));
gsk_gl_shadow_library_insert (job->driver->shadows_library,
&scaled_outline,
@@ -2834,7 +2834,7 @@ gsk_gl_render_job_visit_cross_fade_node (GskGLRenderJob *job,
offscreen_end.reset_clip = TRUE;
offscreen_end.bounds = &node->bounds;
gsk_gl_render_job_set_modelview (job, gsk_transform_scale (NULL, fabs (job->scale_x), fabs (job->scale_y)));
gsk_gl_render_job_set_modelview (job, gsk_transform_scale (NULL, fabsf (job->scale_x), fabsf (job->scale_y)));
if (!gsk_gl_render_job_visit_node_with_offscreen (job, start_node, &offscreen_start))
{
@@ -2964,7 +2964,7 @@ gsk_gl_render_job_visit_text_node (GskGLRenderJob *job,
const PangoFont *font = gsk_text_node_get_font (node);
const PangoGlyphInfo *glyphs = gsk_text_node_get_glyphs (node, NULL);
const graphene_point_t *offset = gsk_text_node_get_offset (node);
float text_scale = MAX (fabs (job->scale_x), fabs (job->scale_y)); /* TODO: Fix for uneven scales? */
float text_scale = MAX (fabsf (job->scale_x), fabsf (job->scale_y)); /* TODO: Fix for uneven scales? */
guint num_glyphs = gsk_text_node_get_num_glyphs (node);
float x = offset->x + job->offset_x;
float y = offset->y + job->offset_y;
@@ -3263,7 +3263,7 @@ gsk_gl_render_job_visit_blend_node (GskGLRenderJob *job,
bottom_offscreen.force_offscreen = TRUE;
bottom_offscreen.reset_clip = TRUE;
gsk_gl_render_job_set_modelview (job, gsk_transform_scale (NULL, fabs (job->scale_x), fabs (job->scale_y)));
gsk_gl_render_job_set_modelview (job, gsk_transform_scale (NULL, fabsf (job->scale_x), fabsf (job->scale_y)));
/* TODO: We create 2 textures here as big as the blend node, but both the
* start and the end node might be a lot smaller than that. */
@@ -3344,8 +3344,8 @@ gsk_gl_render_job_texture_mask_for_color (GskGLRenderJob *job,
gboolean use_mipmap;
guint16 cc[4];
use_mipmap = (scale_x * fabs (job->scale_x)) < 0.5 ||
(scale_y * fabs (job->scale_y)) < 0.5;
use_mipmap = (scale_x * fabsf (job->scale_x)) < 0.5 ||
(scale_y * fabsf (job->scale_y)) < 0.5;
rgba_to_half (rgba, cc);
gsk_gl_render_job_upload_texture (job, texture, use_mipmap, &offscreen);
@@ -3396,7 +3396,7 @@ gsk_gl_render_job_visit_mask_node (GskGLRenderJob *job,
mask_offscreen.reset_clip = TRUE;
mask_offscreen.do_not_cache = TRUE;
gsk_gl_render_job_set_modelview (job, gsk_transform_scale (NULL, fabs (job->scale_x), fabs (job->scale_y)));
gsk_gl_render_job_set_modelview (job, gsk_transform_scale (NULL, fabsf (job->scale_x), fabsf (job->scale_y)));
/* TODO: We create 2 textures here as big as the mask node, but both
* nodes might be a lot smaller than that.
@@ -3664,8 +3664,8 @@ gsk_gl_render_job_visit_texture (GskGLRenderJob *job,
float scale_y = bounds->size.height / texture->height;
gboolean use_mipmap;
use_mipmap = (scale_x * fabs (job->scale_x)) < 0.5 ||
(scale_y * fabs (job->scale_y)) < 0.5;
use_mipmap = (scale_x * fabsf (job->scale_x)) < 0.5 ||
(scale_y * fabsf (job->scale_y)) < 0.5;
if G_LIKELY (texture->width <= max_texture_size &&
texture->height <= max_texture_size)
@@ -4322,7 +4322,7 @@ gsk_gl_render_job_visit_node_with_offscreen (GskGLRenderJob *job,
gsk_gl_render_job_push_modelview (job, transform);
gsk_transform_unref (transform);
gsk_gl_render_job_transform_bounds (job, offscreen->bounds, &viewport);
graphene_rect_scale (&viewport, downscale_x, downscale_y, &viewport);
gsk_rect_scale (&viewport, downscale_x, downscale_y, &viewport);
}
if (downscale_x == 1)
@@ -4416,7 +4416,7 @@ gsk_gl_render_job_visit_node_with_offscreen (GskGLRenderJob *job,
float scale_x = flipped_x ? - downscale_x : downscale_x;
float scale_y = flipped_y ? - downscale_y : downscale_y;
graphene_rect_scale (&job->current_clip->rect.bounds, scale_x, scale_y, &new_clip.bounds);
gsk_rect_scale (&job->current_clip->rect.bounds, scale_x, scale_y, &new_clip.bounds);
rounded_rect_scale_corners (&job->current_clip->rect, &new_clip, scale_x, scale_y);
gsk_gl_render_job_push_clip (job, &new_clip);
reset_clip = TRUE;
@@ -4544,7 +4544,7 @@ gsk_gl_render_job_render (GskGLRenderJob *job,
gsk_gl_render_job_visit_node (job, root);
gdk_gl_context_pop_debug_group (job->command_queue->context);
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Build GL command queue", "");
gdk_profiler_end_mark (start_time, "Build GL command queue", "");
#if 0
/* At this point the atlases have uploaded content while we processed
@@ -4562,7 +4562,7 @@ gsk_gl_render_job_render (GskGLRenderJob *job,
gdk_gl_context_push_debug_group (job->command_queue->context, "Executing command queue");
gsk_gl_command_queue_execute (job->command_queue, surface_height, scale, job->region, job->default_framebuffer);
gdk_gl_context_pop_debug_group (job->command_queue->context);
gdk_profiler_add_mark (start_time, GDK_PROFILER_CURRENT_TIME-start_time, "Execute GL command queue", "");
gdk_profiler_end_mark (start_time, "Execute GL command queue", "");
}
static int
+2 -4
View File
@@ -117,9 +117,8 @@ gsk_gl_texture_library_real_compact (GskGLTextureLibrary *self,
g_hash_table_iter_remove (&iter);
dropped++;
}
if (periodic_scan)
entry->accessed = FALSE;
else if (periodic_scan)
entry->accessed = FALSE;
}
}
@@ -440,7 +439,6 @@ gsk_gl_texture_library_pack (GskGLTextureLibrary *self,
entry->texture = texture;
entry->is_atlased = FALSE;
entry->accessed = TRUE;
entry->area.x = padding / (float) (padding + width + padding);
entry->area.y = padding / (float) (padding + height + padding);
entry->area.x2 = (padding + width) / (float) (padding + width + padding);
+8 -1
View File
@@ -125,6 +125,12 @@ gsk_gl_device_create_atlas_image (GskGpuDevice *device,
height);
}
static void
gsk_gl_device_make_current (GskGpuDevice *device)
{
gdk_gl_context_make_current (gdk_display_get_gl_context (gsk_gpu_device_get_display (device)));
}
static void
gsk_gl_device_finalize (GObject *object)
{
@@ -151,6 +157,7 @@ gsk_gl_device_class_init (GskGLDeviceClass *klass)
gpu_device_class->create_atlas_image = gsk_gl_device_create_atlas_image;
gpu_device_class->create_upload_image = gsk_gl_device_create_upload_image;
gpu_device_class->create_download_image = gsk_gl_device_create_download_image;
gpu_device_class->make_current = gsk_gl_device_make_current;
object_class->finalize = gsk_gl_device_finalize;
}
@@ -235,7 +242,7 @@ gsk_gl_device_get_for_display (GdkDisplay *display,
if (!gdk_gl_context_check_version (context, "3.0", "3.0"))
{
g_set_error (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
_("OpenGL ES 2.0 is not supported by this renderer."));
_("OpenGL ES 3.0 is not supported by this renderer."));
return NULL;
}
+1 -2
View File
@@ -144,8 +144,7 @@ gsk_gl_frame_submit (GskGpuFrame *frame,
glEnable (GL_SCISSOR_TEST);
glEnable (GL_DEPTH_TEST);
glDepthFunc (GL_LEQUAL);
glDisable (GL_DEPTH_TEST);
glEnable (GL_BLEND);
if (vertex_buffer)
+11 -1
View File
@@ -43,7 +43,7 @@ gsk_gl_image_finalize (GObject *object)
{
GskGLImage *self = GSK_GL_IMAGE (object);
if (self->framebuffer_id)
if (self->texture_id && self->framebuffer_id)
glDeleteFramebuffers (1, &self->framebuffer_id);
if (self->owns_texture)
@@ -70,6 +70,7 @@ gsk_gl_image_init (GskGLImage *self)
GskGpuImage *
gsk_gl_image_new_backbuffer (GskGLDevice *device,
GdkGLContext *context,
GdkMemoryFormat format,
gsize width,
gsize height)
@@ -95,6 +96,13 @@ gsk_gl_image_new_backbuffer (GskGLDevice *device,
/* texture_id == 0 means backbuffer */
/* Check for non-standard framebuffer binding as we might not be using
* the default framebuffer on systems like macOS where we've bound an
* IOSurface to a GL_TEXTURE_RECTANGLE. Otherwise, no scissor clip will
* be applied in the command queue causing overdrawing.
*/
self->framebuffer_id = GDK_GL_CONTEXT_GET_CLASS (context)->get_default_framebuffer (context);
return GSK_GPU_IMAGE (self);
}
@@ -187,6 +195,8 @@ gsk_gl_image_new_for_texture (GskGLDevice *device,
if (format != real_format)
flags = GSK_GPU_IMAGE_NO_BLIT |
(gdk_memory_format_alpha (format) == GDK_MEMORY_ALPHA_STRAIGHT ? GSK_GPU_IMAGE_STRAIGHT_ALPHA : 0);
else
flags &= ~(GSK_GPU_IMAGE_CAN_MIPMAP | GSK_GPU_IMAGE_MIPMAP);
gsk_gpu_image_setup (GSK_GPU_IMAGE (self),
flags | extra_flags,
+1
View File
@@ -11,6 +11,7 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (GskGLImage, gsk_gl_image, GSK, GL_IMAGE, GskGpuImage)
GskGpuImage * gsk_gl_image_new_backbuffer (GskGLDevice *device,
GdkGLContext *context,
GdkMemoryFormat format,
gsize width,
gsize height);
+1
View File
@@ -28,6 +28,7 @@ gsk_gpu_blend_mode_op_print (GskGpuOp *op,
instance = (GskGpuBlendmodeInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
gsk_gpu_print_op (string, indent, "blend-mode");
gsk_gpu_print_shader_info (string, shader->clip);
gsk_gpu_print_rect (string, instance->rect);
gsk_gpu_print_image_descriptor (string, shader->desc, instance->bottom_id);
gsk_gpu_print_enum (string, GSK_TYPE_BLEND_MODE, shader->variation);
+6
View File
@@ -36,6 +36,9 @@ gsk_gpu_blend_op_print (GskGpuOp *op,
case GSK_GPU_BLEND_ADD:
gsk_gpu_print_string (string, "add");
break;
case GSK_GPU_BLEND_CLEAR:
gsk_gpu_print_string (string, "clear");
break;
default:
g_assert_not_reached ();
break;
@@ -72,6 +75,9 @@ gsk_gpu_blend_op_gl_command (GskGpuOp *op,
case GSK_GPU_BLEND_ADD:
glBlendFunc (GL_ONE, GL_ONE);
break;
case GSK_GPU_BLEND_CLEAR:
glBlendFunc (GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
break;
default:
g_assert_not_reached ();
break;
-2
View File
@@ -85,7 +85,6 @@ gsk_gpu_blit_op_vk_command (GskGpuOp *op,
{
default:
g_assert_not_reached ();
G_GNUC_FALLTHROUGH;
case GSK_GPU_BLIT_LINEAR:
filter = VK_FILTER_LINEAR;
break;
@@ -160,7 +159,6 @@ gsk_gpu_blit_op_gl_command (GskGpuOp *op,
{
default:
g_assert_not_reached ();
G_GNUC_FALLTHROUGH;
case GSK_GPU_BLIT_LINEAR:
filter = GL_LINEAR;
break;
+2
View File
@@ -31,6 +31,8 @@ gsk_gpu_blur_op_print (GskGpuOp *op,
instance = (GskGpuBlurInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
gsk_gpu_print_op (string, indent, "blur");
gsk_gpu_print_shader_info (string, shader->clip);
g_string_append_printf (string, "%g,%g ", instance->blur_direction[0], instance->blur_direction[1]);
gsk_gpu_print_rect (string, instance->rect);
gsk_gpu_print_image_descriptor (string, shader->desc, instance->tex_id);
gsk_gpu_print_newline (string);
+1
View File
@@ -36,6 +36,7 @@ gsk_gpu_border_op_print (GskGpuOp *op,
instance = (GskGpuBorderInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
gsk_gpu_print_op (string, indent, "border");
gsk_gpu_print_shader_info (string, shader->clip);
gsk_gpu_print_rounded_rect (string, instance->outline);
gsk_gpu_print_rgba (string, (const float *) &instance->border_colors[0]);
+1
View File
@@ -31,6 +31,7 @@ gsk_gpu_box_shadow_op_print (GskGpuOp *op,
instance = (GskGpuBoxshadowInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
gsk_gpu_print_op (string, indent, shader->variation & VARIATION_INSET ? "inset-shadow" : "outset-shadow");
gsk_gpu_print_shader_info (string, shader->clip);
gsk_gpu_print_rounded_rect (string, instance->outline);
gsk_gpu_print_rgba (string, instance->color);
g_string_append_printf (string, "%g %g %g %g ",
+1
View File
@@ -27,6 +27,7 @@ gsk_gpu_colorize_op_print (GskGpuOp *op,
instance = (GskGpuColorizeInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
gsk_gpu_print_op (string, indent, "colorize");
gsk_gpu_print_shader_info (string, shader->clip);
gsk_gpu_print_rect (string, instance->rect);
gsk_gpu_print_image_descriptor (string, shader->desc, instance->tex_id);
gsk_gpu_print_rgba (string, instance->color);
+1
View File
@@ -27,6 +27,7 @@ gsk_gpu_color_matrix_op_print (GskGpuOp *op,
instance = (GskGpuColormatrixInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
gsk_gpu_print_op (string, indent, "color-matrix");
gsk_gpu_print_shader_info (string, shader->clip);
gsk_gpu_print_rect (string, instance->rect);
gsk_gpu_print_image_descriptor (string, shader->desc, instance->tex_id);
gsk_gpu_print_newline (string);
+1
View File
@@ -28,6 +28,7 @@ gsk_gpu_color_op_print (GskGpuOp *op,
instance = (GskGpuColorInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
gsk_gpu_print_op (string, indent, "color");
gsk_gpu_print_shader_info (string, shader->clip);
gsk_gpu_print_rect (string, instance->rect);
gsk_gpu_print_rgba (string, instance->color);
gsk_gpu_print_newline (string);
+1
View File
@@ -29,6 +29,7 @@ gsk_gpu_conic_gradient_op_print (GskGpuOp *op,
instance = (GskGpuConicgradientInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
gsk_gpu_print_op (string, indent, "conic-gradient");
gsk_gpu_print_shader_info (string, shader->clip);
gsk_gpu_print_rect (string, instance->rect);
gsk_gpu_print_newline (string);
}
+1
View File
@@ -27,6 +27,7 @@ gsk_gpu_cross_fade_op_print (GskGpuOp *op,
instance = (GskGpuCrossfadeInstance *) gsk_gpu_frame_get_vertex_data (frame, shader->vertex_offset);
gsk_gpu_print_op (string, indent, "cross-fade");
gsk_gpu_print_shader_info (string, shader->clip);
gsk_gpu_print_rect (string, instance->rect);
gsk_gpu_print_image_descriptor (string, shader->desc, instance->start_id);
gsk_gpu_print_image_descriptor (string, shader->desc, instance->end_id);
+397 -204
View File
@@ -8,8 +8,10 @@
#include "gdk/gdkdisplayprivate.h"
#include "gdk/gdktextureprivate.h"
#include "gdk/gdkprofilerprivate.h"
#include "gsk/gskdebugprivate.h"
#include "gsk/gskprivate.h"
#define MAX_SLICES_PER_ATLAS 64
@@ -17,13 +19,12 @@
#define MAX_ATLAS_ITEM_SIZE 256
G_STATIC_ASSERT (MAX_ATLAS_ITEM_SIZE < ATLAS_SIZE);
#define MAX_DEAD_PIXELS (ATLAS_SIZE * ATLAS_SIZE / 2)
#define CACHE_GC_TIMEOUT 1 /* seconds */
#define CACHE_TIMEOUT 15 /* seconds */
#define CACHE_MAX_AGE (G_TIME_SPAN_SECOND * 4) /* 4 seconds, in µs */
G_STATIC_ASSERT (MAX_ATLAS_ITEM_SIZE < ATLAS_SIZE);
G_STATIC_ASSERT (MAX_DEAD_PIXELS < ATLAS_SIZE * ATLAS_SIZE);
typedef struct _GskGpuCached GskGpuCached;
typedef struct _GskGpuCachedClass GskGpuCachedClass;
@@ -32,13 +33,35 @@ typedef struct _GskGpuCachedGlyph GskGpuCachedGlyph;
typedef struct _GskGpuCachedTexture GskGpuCachedTexture;
typedef struct _GskGpuDevicePrivate GskGpuDevicePrivate;
typedef struct _GlyphKey GlyphKey;
struct _GlyphKey
{
typedef struct {
PangoFont *font;
float scale;
} FontCacheKey;
typedef struct {
PangoGlyph glyph;
GskGpuGlyphLookupFlags flags;
float scale;
} GlyphCacheKey;
typedef struct {
FontCacheKey key;
GHashTable *cache;
} FontGlyphCache;
static void
font_glyph_cache_free (gpointer data)
{
FontGlyphCache *cache = data;
g_object_unref (cache->key.font);
g_hash_table_unref (cache->cache);
g_free (cache);
}
static FontGlyphCache no_font_cache = {
.key = { .font = NULL, .scale = -1 },
.cache = NULL
};
struct _GskGpuDevicePrivate
@@ -49,16 +72,15 @@ struct _GskGpuDevicePrivate
GskGpuCached *first_cached;
GskGpuCached *last_cached;
guint cache_gc_source;
int cache_timeout; /* in seconds, or -1 to disable gc */
GHashTable *texture_cache;
GHashTable *glyph_cache;
FontGlyphCache *last_font_cache;
GskGpuCachedAtlas *current_atlas;
struct {
GlyphKey key;
GskGpuCachedGlyph *value;
} front[256];
/* atomic */ gsize dead_texture_pixels;
};
G_DEFINE_TYPE_WITH_PRIVATE (GskGpuDevice, gsk_gpu_device, G_TYPE_OBJECT)
@@ -79,14 +101,15 @@ struct _GskGpuCachedClass
struct _GskGpuCached
{
const GskGpuCachedClass *class;
GskGpuCachedAtlas *atlas;
GskGpuCached *next;
GskGpuCached *prev;
gint64 timestamp;
gboolean stale;
guint pixels; /* For glyphs, pixels. For atlases, dead pixels */
unsigned int stale : 1;
unsigned int pixels : 31; /* For glyphs and textures, pixels. For atlases, dead pixels */
};
static inline void
@@ -167,6 +190,19 @@ gsk_gpu_cached_use (GskGpuDevice *device,
mark_as_stale (cached, FALSE);
}
static inline gboolean
gsk_gpu_cached_is_old (GskGpuDevice *device,
GskGpuCached *cached,
gint64 timestamp)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (device);
if (priv->cache_timeout < 0)
return FALSE;
else
return timestamp - cached->timestamp > priv->cache_timeout * G_TIME_SPAN_SECOND;
}
/* }}} */
/* {{{ CachedAtlas */
@@ -233,91 +269,6 @@ gsk_gpu_cached_atlas_new (GskGpuDevice *device)
return self;
}
/* This rounds up to the next number that has <= 2 bits set:
* 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, ...
* That is roughly sqrt(2), so it should limit waste
*/
static gsize
round_up_atlas_size (gsize num)
{
gsize storage = g_bit_storage (num);
num = num + (((1 << storage) - 1) >> 2);
num &= (((gsize) 7) << storage) >> 2;
return num;
}
static gboolean
gsk_gpu_cached_atlas_allocate (GskGpuCachedAtlas *atlas,
gsize width,
gsize height,
gsize *out_x,
gsize *out_y)
{
gsize i;
gsize waste, slice_waste;
gsize best_slice;
gsize y, best_y;
gboolean can_add_slice;
best_y = 0;
best_slice = G_MAXSIZE;
can_add_slice = atlas->n_slices < MAX_SLICES_PER_ATLAS;
if (can_add_slice)
waste = height; /* Require less than 100% waste */
else
waste = G_MAXSIZE; /* Accept any slice, we can't make better ones */
for (i = 0, y = 0; i < atlas->n_slices; y += atlas->slices[i].height, i++)
{
if (atlas->slices[i].height < height || ATLAS_SIZE - atlas->slices[i].width < width)
continue;
slice_waste = atlas->slices[i].height - height;
if (slice_waste < waste)
{
waste = slice_waste;
best_slice = i;
best_y = y;
if (waste == 0)
break;
}
}
if (best_slice >= i && i == atlas->n_slices)
{
if (!can_add_slice)
return FALSE;
if (y + height > ATLAS_SIZE)
return FALSE;
atlas->n_slices++;
if (atlas->n_slices == MAX_SLICES_PER_ATLAS)
atlas->slices[i].height = ATLAS_SIZE - y;
else
atlas->slices[i].height = MIN (round_up_atlas_size (MAX (height, 4)), ATLAS_SIZE - y);
atlas->slices[i].width = 0;
best_y = y;
best_slice = i;
}
g_assert (best_slice < MAX_SLICES_PER_ATLAS);
*out_x = atlas->slices[best_slice].width;
*out_y = best_y;
atlas->slices[best_slice].width += width;
g_assert (atlas->slices[best_slice].height >= height);
g_assert (atlas->slices[best_slice].width <= ATLAS_SIZE);
g_assert (best_y + atlas->slices[best_slice].height <= ATLAS_SIZE);
return TRUE;
}
/* }}} */
/* {{{ CachedTexture */
@@ -325,7 +276,14 @@ struct _GskGpuCachedTexture
{
GskGpuCached parent;
/* atomic */ GdkTexture *texture;
/* atomic */ int use_count; /* We count the use by the device (via the linked
* list) and by the texture (via render data or
* weak ref.
*/
gsize *dead_pixels_counter;
GdkTexture *texture;
GskGpuImage *image;
};
@@ -333,14 +291,37 @@ static void
gsk_gpu_cached_texture_free (GskGpuDevice *device,
GskGpuCached *cached)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (device);
GskGpuCachedTexture *self = (GskGpuCachedTexture *) cached;
gboolean texture_still_alive;
gpointer key, value;
texture_still_alive = g_atomic_pointer_exchange (&self->texture, NULL) != NULL;
g_clear_object (&self->image);
if (!texture_still_alive)
g_free (self);
if (g_hash_table_steal_extended (priv->texture_cache, self->texture, &key, &value))
{
/* If the texture has been reused already, we put the entry back */
if ((GskGpuCached *) value != cached)
g_hash_table_insert (priv->texture_cache, key, value);
}
/* If the cached item itself is still in use by the texture, we leave
* it to the weak ref or render data to free it.
*/
if (g_atomic_int_dec_and_test (&self->use_count))
{
g_free (self);
return;
}
}
static inline gboolean
gsk_gpu_cached_texture_is_invalid (GskGpuCachedTexture *self)
{
/* If the use count is less than 2, the orignal texture has died,
* and the memory may have been reused for a new texture, so we
* can't hand out the image that is for the original texture.
*/
return g_atomic_int_get (&self->use_count) < 2;
}
static gboolean
@@ -348,7 +329,10 @@ gsk_gpu_cached_texture_should_collect (GskGpuDevice *device,
GskGpuCached *cached,
gint64 timestamp)
{
return timestamp - cached->timestamp > CACHE_MAX_AGE;
GskGpuCachedTexture *self = (GskGpuCachedTexture *) cached;
return gsk_gpu_cached_is_old (device, cached, timestamp) ||
gsk_gpu_cached_texture_is_invalid (self);
}
static const GskGpuCachedClass GSK_GPU_CACHED_TEXTURE_CLASS =
@@ -358,16 +342,19 @@ static const GskGpuCachedClass GSK_GPU_CACHED_TEXTURE_CLASS =
gsk_gpu_cached_texture_should_collect
};
/* Note: this function can run in an arbitrary thread, so it can
* only access things atomically
*/
static void
gsk_gpu_cached_texture_destroy_cb (gpointer data)
{
GskGpuCachedTexture *cache = data;
gboolean cache_still_alive;
GskGpuCachedTexture *self = data;
cache_still_alive = g_atomic_pointer_exchange (&cache->texture, NULL) != NULL;
if (!gsk_gpu_cached_texture_is_invalid (self))
g_atomic_pointer_add (self->dead_pixels_counter, ((GskGpuCached *) self)->pixels);
if (!cache_still_alive)
g_free (cache);
if (g_atomic_int_dec_and_test (&self->use_count))
g_free (self);
}
static GskGpuCachedTexture *
@@ -381,18 +368,19 @@ gsk_gpu_cached_texture_new (GskGpuDevice *device,
if (gdk_texture_get_render_data (texture, device))
gdk_texture_clear_render_data (texture);
else if ((self = g_hash_table_lookup (priv->texture_cache, texture)))
{
g_hash_table_remove (priv->texture_cache, texture);
g_object_weak_unref (G_OBJECT (texture), (GWeakNotify) gsk_gpu_cached_texture_destroy_cb, self);
}
g_hash_table_remove (priv->texture_cache, texture);
self = gsk_gpu_cached_new (device, &GSK_GPU_CACHED_TEXTURE_CLASS, NULL);
self->texture = texture;
self->image = g_object_ref (image);
((GskGpuCached *)self)->pixels = gsk_gpu_image_get_width (image) * gsk_gpu_image_get_height (image);
self->dead_pixels_counter = &priv->dead_texture_pixels;
self->use_count = 2;
if (!gdk_texture_set_render_data (texture, device, self, gsk_gpu_cached_texture_destroy_cb))
{
g_object_weak_ref (G_OBJECT (texture), (GWeakNotify) gsk_gpu_cached_texture_destroy_cb, self);
g_hash_table_insert (priv->texture_cache, texture, self);
}
@@ -406,7 +394,8 @@ struct _GskGpuCachedGlyph
{
GskGpuCached parent;
GlyphKey key;
FontGlyphCache *font_cache;
GlyphCacheKey glyph_key;
GskGpuImage *image;
graphene_rect_t bounds;
@@ -419,10 +408,17 @@ gsk_gpu_cached_glyph_free (GskGpuDevice *device,
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (device);
GskGpuCachedGlyph *self = (GskGpuCachedGlyph *) cached;
FontGlyphCache *font_cache;
g_hash_table_remove (priv->glyph_cache, self);
font_cache = self->font_cache;
g_hash_table_remove (font_cache->cache, self);
if (g_hash_table_size (font_cache->cache) == 0)
{
if (priv->last_font_cache == font_cache)
priv->last_font_cache = &no_font_cache;
g_hash_table_remove (priv->glyph_cache, font_cache);
}
g_object_unref (self->key.font);
g_object_unref (self->image);
g_free (self);
@@ -433,22 +429,47 @@ gsk_gpu_cached_glyph_should_collect (GskGpuDevice *device,
GskGpuCached *cached,
gint64 timestamp)
{
if (timestamp - cached->timestamp > CACHE_MAX_AGE)
mark_as_stale (cached, TRUE);
if (gsk_gpu_cached_is_old (device, cached, timestamp))
{
if (cached->atlas)
mark_as_stale (cached, TRUE);
else
return TRUE;
}
/* Glyphs are only collected when their atlas is freed */
return FALSE;
}
static guint
gsk_gpu_cached_font_hash (gconstpointer data)
{
const FontGlyphCache *cache = data;
const FontCacheKey *key = &cache->key;
return GPOINTER_TO_UINT (key->font) ^ ((guint) key->scale * PANGO_SCALE);
}
static gboolean
gsk_gpu_cached_font_equal (gconstpointer v1,
gconstpointer v2)
{
const FontGlyphCache *c1 = v1;
const FontCacheKey *key1 = &c1->key;
const FontGlyphCache *c2 = v2;
const FontCacheKey *key2 = &c2->key;
return key1->font == key2->font &&
key1->scale == key2->scale;
}
static guint
gsk_gpu_cached_glyph_hash (gconstpointer data)
{
const GskGpuCachedGlyph *glyph = data;
const GlyphCacheKey *key = &glyph->glyph_key;
return GPOINTER_TO_UINT (glyph->key.font) ^
glyph->key.glyph ^
(glyph->key.flags << 24) ^
((guint) glyph->key.scale * PANGO_SCALE);
return key->glyph ^ (key->flags << 24);
}
static gboolean
@@ -457,11 +478,11 @@ gsk_gpu_cached_glyph_equal (gconstpointer v1,
{
const GskGpuCachedGlyph *glyph1 = v1;
const GskGpuCachedGlyph *glyph2 = v2;
const GlyphCacheKey *key1 = &glyph1->glyph_key;
const GlyphCacheKey *key2 = &glyph2->glyph_key;
return glyph1->key.font == glyph2->key.font
&& glyph1->key.glyph == glyph2->key.glyph
&& glyph1->key.flags == glyph2->key.flags
&& glyph1->key.scale == glyph2->key.scale;
return key1->glyph == key2->glyph &&
key1->flags == key2->flags;
}
static const GskGpuCachedClass GSK_GPU_CACHED_GLYPH_CLASS =
@@ -494,7 +515,9 @@ print_cache_stats (GskGpuDevice *self)
stale_glyphs++;
}
else if (cached->class == &GSK_GPU_CACHED_TEXTURE_CLASS)
textures++;
{
textures++;
}
else if (cached->class == &GSK_GPU_CACHED_ATLAS_CLASS)
{
double ratio;
@@ -514,24 +537,29 @@ print_cache_stats (GskGpuDevice *self)
if (ratios->len > 0)
g_string_append (ratios, ")");
gdk_debug_message ("cached items\n"
gdk_debug_message ("Cached items\n"
" glyphs: %5u (%u stale)\n"
" textures: %5u\n"
" textures: %5u (%u in hash)\n"
" atlases: %5u%s",
glyphs, stale_glyphs, textures, atlases, ratios->str);
glyphs, stale_glyphs,
textures, g_hash_table_size (priv->texture_cache),
atlases, ratios->str);
g_string_free (ratios, TRUE);
}
void
static void
gsk_gpu_device_gc (GskGpuDevice *self,
gint64 timestamp)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
GskGpuCached *cached, *prev;
gint64 before G_GNUC_UNUSED = GDK_PROFILER_CURRENT_TIME;
gsk_gpu_device_make_current (self);
/* We walk the cache from the end so we don't end up with prev
* begin a leftover glyph on the atlas we are freeing
* being a leftover glyph on the atlas we are freeing
*/
for (cached = priv->last_cached; cached != NULL; cached = prev)
{
@@ -540,8 +568,54 @@ gsk_gpu_device_gc (GskGpuDevice *self,
gsk_gpu_cached_free (self, cached);
}
g_atomic_pointer_set (&priv->dead_texture_pixels, 0);
if (GSK_DEBUG_CHECK (GLYPH_CACHE))
print_cache_stats (self);
gdk_profiler_end_mark (before, "Glyph cache GC", NULL);
}
static gboolean
cache_gc_cb (gpointer data)
{
GskGpuDevice *self = data;
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
GSK_DEBUG (GLYPH_CACHE, "Periodic GC");
gsk_gpu_device_gc (self, g_get_monotonic_time ());
priv->cache_gc_source = 0;
return G_SOURCE_REMOVE;
}
void
gsk_gpu_device_maybe_gc (GskGpuDevice *self)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
gsize dead_texture_pixels;
if (priv->cache_timeout < 0)
return;
dead_texture_pixels = GPOINTER_TO_SIZE (g_atomic_pointer_get (&priv->dead_texture_pixels));
if (priv->cache_timeout == 0 || dead_texture_pixels > 1000000)
{
GSK_DEBUG (GLYPH_CACHE, "Pre-frame GC (%lu dead pixels)", dead_texture_pixels);
gsk_gpu_device_gc (self, g_get_monotonic_time ());
}
}
void
gsk_gpu_device_queue_gc (GskGpuDevice *self)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
if (priv->cache_timeout > 0 && !priv->cache_gc_source)
priv->cache_gc_source = g_timeout_add_seconds (priv->cache_timeout, cache_gc_cb, self);
}
static void
@@ -607,20 +681,13 @@ gsk_gpu_device_init (GskGpuDevice *self)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
priv->glyph_cache = g_hash_table_new (gsk_gpu_cached_glyph_hash,
gsk_gpu_cached_glyph_equal);
priv->glyph_cache = g_hash_table_new_full (gsk_gpu_cached_font_hash,
gsk_gpu_cached_font_equal,
NULL,
font_glyph_cache_free);
priv->texture_cache = g_hash_table_new (g_direct_hash,
g_direct_equal);
}
static gboolean
cache_gc_source_callback (gpointer data)
{
GskGpuDevice *self = data;
gsk_gpu_device_gc (self, g_get_monotonic_time ());
return G_SOURCE_CONTINUE;
priv->last_font_cache = &no_font_cache;
}
void
@@ -629,11 +696,38 @@ gsk_gpu_device_setup (GskGpuDevice *self,
gsize max_image_size)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
const char *str;
priv->display = g_object_ref (display);
priv->max_image_size = max_image_size;
priv->cache_timeout = CACHE_TIMEOUT;
priv->cache_gc_source = g_timeout_add_seconds (CACHE_GC_TIMEOUT, cache_gc_source_callback, self);
str = g_getenv ("GSK_CACHE_TIMEOUT");
if (str != NULL)
{
gint64 value;
GError *error = NULL;
if (!g_ascii_string_to_signed (str, 10, -1, G_MAXINT, &value, &error))
{
g_warning ("Failed to parse GSK_CACHE_TIMEOUT: %s", error->message);
g_error_free (error);
}
else
{
priv->cache_timeout = (int) value;
}
}
if (GSK_DEBUG_CHECK (GLYPH_CACHE))
{
if (priv->cache_timeout < 0)
gdk_debug_message ("Cache GC disabled");
else if (priv->cache_timeout == 0)
gdk_debug_message ("Cache GC before every frame");
else
gdk_debug_message ("Cache GC timeout: %d seconds", priv->cache_timeout);
}
}
GdkDisplay *
@@ -672,6 +766,12 @@ gsk_gpu_device_create_upload_image (GskGpuDevice *self,
return GSK_GPU_DEVICE_GET_CLASS (self)->create_upload_image (self, with_mipmap, format, width, height);
}
void
gsk_gpu_device_make_current (GskGpuDevice *self)
{
GSK_GPU_DEVICE_GET_CLASS (self)->make_current (self);
}
GskGpuImage *
gsk_gpu_device_create_download_image (GskGpuDevice *self,
GdkMemoryDepth depth,
@@ -681,10 +781,91 @@ gsk_gpu_device_create_download_image (GskGpuDevice *self,
return GSK_GPU_DEVICE_GET_CLASS (self)->create_download_image (self, depth, width, height);
}
/* This rounds up to the next number that has <= 2 bits set:
* 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, ...
* That is roughly sqrt(2), so it should limit waste
*/
static gsize
round_up_atlas_size (gsize num)
{
gsize storage = g_bit_storage (num);
num = num + (((1 << storage) - 1) >> 2);
num &= (((gsize) 7) << storage) >> 2;
return num;
}
static gboolean
gsk_gpu_cached_atlas_allocate (GskGpuCachedAtlas *atlas,
gsize width,
gsize height,
gsize *out_x,
gsize *out_y)
{
gsize i;
gsize waste, slice_waste;
gsize best_slice;
gsize y, best_y;
gboolean can_add_slice;
best_y = 0;
best_slice = G_MAXSIZE;
can_add_slice = atlas->n_slices < MAX_SLICES_PER_ATLAS;
if (can_add_slice)
waste = height; /* Require less than 100% waste */
else
waste = G_MAXSIZE; /* Accept any slice, we can't make better ones */
for (i = 0, y = 0; i < atlas->n_slices; y += atlas->slices[i].height, i++)
{
if (atlas->slices[i].height < height || ATLAS_SIZE - atlas->slices[i].width < width)
continue;
slice_waste = atlas->slices[i].height - height;
if (slice_waste < waste)
{
waste = slice_waste;
best_slice = i;
best_y = y;
if (waste == 0)
break;
}
}
if (best_slice >= i && i == atlas->n_slices)
{
gsize slice_height;
if (!can_add_slice)
return FALSE;
slice_height = round_up_atlas_size (MAX (height, 4));
if (slice_height > ATLAS_SIZE - y)
return FALSE;
atlas->n_slices++;
if (atlas->n_slices == MAX_SLICES_PER_ATLAS)
slice_height = ATLAS_SIZE - y;
atlas->slices[i].width = 0;
atlas->slices[i].height = slice_height;
best_y = y;
best_slice = i;
}
*out_x = atlas->slices[best_slice].width;
*out_y = best_y;
atlas->slices[best_slice].width += width;
g_assert (atlas->slices[best_slice].width <= ATLAS_SIZE);
return TRUE;
}
static void
gsk_gpu_device_ensure_atlas (GskGpuDevice *self,
gboolean recreate,
gint64 timestamp)
gboolean recreate)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
@@ -699,14 +880,13 @@ gsk_gpu_device_get_atlas_image (GskGpuDevice *self)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
gsk_gpu_device_ensure_atlas (self, FALSE, g_get_monotonic_time ());
gsk_gpu_device_ensure_atlas (self, FALSE);
return priv->current_atlas->image;
}
static GskGpuImage *
gsk_gpu_device_add_atlas_image (GskGpuDevice *self,
gint64 timestamp,
gsize width,
gsize height,
gsize *out_x,
@@ -717,12 +897,12 @@ gsk_gpu_device_add_atlas_image (GskGpuDevice *self,
if (width > MAX_ATLAS_ITEM_SIZE || height > MAX_ATLAS_ITEM_SIZE)
return NULL;
gsk_gpu_device_ensure_atlas (self, FALSE, timestamp);
gsk_gpu_device_ensure_atlas (self, FALSE);
if (gsk_gpu_cached_atlas_allocate (priv->current_atlas, width, height, out_x, out_y))
return priv->current_atlas->image;
gsk_gpu_device_ensure_atlas (self, TRUE, timestamp);
gsk_gpu_device_ensure_atlas (self, TRUE);
if (gsk_gpu_cached_atlas_allocate (priv->current_atlas, width, height, out_x, out_y))
return priv->current_atlas->image;
@@ -742,10 +922,12 @@ gsk_gpu_device_lookup_texture_image (GskGpuDevice *self,
if (cache == NULL)
cache = g_hash_table_lookup (priv->texture_cache, texture);
if (cache && cache->image)
return g_object_ref (cache->image);
if (!cache || !cache->image || gsk_gpu_cached_texture_is_invalid (cache))
return NULL;
return NULL;
gsk_gpu_cached_use (self, (GskGpuCached *) cache, timestamp);
return g_object_ref (cache->image);
}
void
@@ -769,59 +951,74 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
GskGpuGlyphLookupFlags flags,
float scale,
graphene_rect_t *out_bounds,
graphene_point_t *out_origin)
graphene_point_t *out_origin,
PangoFont **out_scaled_font)
{
GskGpuDevicePrivate *priv = gsk_gpu_device_get_instance_private (self);
GskGpuCachedGlyph lookup = {
.key.font = font,
.key.glyph = glyph,
.key.flags = flags,
.key.scale = scale
FontGlyphCache font_lookup = {
.key = { .font = font, .scale = scale }
};
GskGpuCachedGlyph *cache;
GskGpuCachedGlyph glyph_lookup = {
.glyph_key = { .glyph = glyph, .flags = flags }
};
FontGlyphCache *font_cache = NULL;
GskGpuCachedGlyph *cache = NULL;
PangoRectangle ink_rect;
graphene_rect_t rect;
graphene_point_t origin;
GskGpuImage *image;
gsize atlas_x, atlas_y, padding;
guint64 timestamp = gsk_gpu_frame_get_timestamp (frame);
guint front_index = glyph & 0xFF;
float subpixel_x, subpixel_y;
PangoFont *scaled_font;
if (memcmp (&lookup.key, &priv->front[front_index], sizeof (GlyphKey)) == 0)
if (priv->last_font_cache->key.font == font &&
priv->last_font_cache->key.scale == scale)
font_cache = priv->last_font_cache;
else
font_cache = g_hash_table_lookup (priv->glyph_cache, &font_lookup);
if (font_cache)
{
cache = priv->front[front_index].value;
cache = g_hash_table_lookup (font_cache->cache, &glyph_lookup);
if (cache)
{
gsk_gpu_cached_use (self, (GskGpuCached *) cache, gsk_gpu_frame_get_timestamp (frame));
gsk_gpu_cached_use (self, (GskGpuCached *) cache, timestamp);
*out_bounds = cache->bounds;
*out_origin = cache->origin;
*out_bounds = cache->bounds;
*out_origin = cache->origin;
priv->last_font_cache = font_cache;
return cache->image;
return cache->image;
}
}
else
{
font_cache = g_new (FontGlyphCache, 1);
font_cache->key.font = g_object_ref (font);
font_cache->key.scale = scale;
font_cache->cache = g_hash_table_new (gsk_gpu_cached_glyph_hash,
gsk_gpu_cached_glyph_equal);
g_hash_table_insert (priv->glyph_cache, font_cache, font_cache);
}
cache = g_hash_table_lookup (priv->glyph_cache, &lookup);
if (cache)
{
memcpy (&priv->front[front_index].key, &lookup.key, sizeof (GlyphKey));
priv->front[front_index].value = cache;
priv->last_font_cache = font_cache;
gsk_gpu_cached_use (self, (GskGpuCached *) cache, timestamp);
if (*out_scaled_font)
scaled_font = *out_scaled_font;
else
scaled_font = gsk_get_scaled_font (font, scale);
*out_bounds = cache->bounds;
*out_origin = cache->origin;
return cache->image;
}
pango_font_get_glyph_extents (font, glyph, &ink_rect, NULL);
origin.x = floor (ink_rect.x * scale / PANGO_SCALE);
origin.y = floor (ink_rect.y * scale / PANGO_SCALE);
rect.size.width = ceil ((ink_rect.x + ink_rect.width) * scale / PANGO_SCALE) - origin.x;
rect.size.height = ceil ((ink_rect.y + ink_rect.height) * scale / PANGO_SCALE) - origin.y;
subpixel_x = (flags & 3) / 4.f;
subpixel_y = ((flags >> 2) & 3) / 4.f;
pango_font_get_glyph_extents (scaled_font, glyph, &ink_rect, NULL);
origin.x = floor (ink_rect.x * 1.0 / PANGO_SCALE + subpixel_x);
origin.y = floor (ink_rect.y * 1.0 / PANGO_SCALE + subpixel_y);
rect.size.width = ceil ((ink_rect.x + ink_rect.width) * 1.0 / PANGO_SCALE + subpixel_x) - origin.x;
rect.size.height = ceil ((ink_rect.y + ink_rect.height) * 1.0 / PANGO_SCALE + subpixel_y) - origin.y;
padding = 1;
image = gsk_gpu_device_add_atlas_image (self,
timestamp,
rect.size.width + 2 * padding, rect.size.height + 2 * padding,
&atlas_x, &atlas_y);
if (image)
@@ -840,19 +1037,18 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
cache = gsk_gpu_cached_new (self, &GSK_GPU_CACHED_GLYPH_CLASS, NULL);
}
cache->key.font = g_object_ref (font),
cache->key.glyph = glyph,
cache->key.flags = flags,
cache->key.scale = scale,
cache->bounds = rect,
cache->image = image,
cache->font_cache = font_cache;
cache->glyph_key.glyph = glyph;
cache->glyph_key.flags = flags;
cache->bounds = rect;
cache->image = image;
cache->origin = GRAPHENE_POINT_INIT (- origin.x + subpixel_x,
- origin.y + subpixel_y);
((GskGpuCached *) cache)->pixels = (rect.size.width + 2 * padding) * (rect.size.height + 2 * padding);
cache->origin = GRAPHENE_POINT_INIT (- origin.x + (flags & 3) / 4.f,
- origin.y + ((flags >> 2) & 3) / 4.f);
gsk_gpu_upload_glyph_op (frame,
cache->image,
font,
scaled_font,
glyph,
&(cairo_rectangle_int_t) {
.x = rect.origin.x - padding,
@@ -860,18 +1056,15 @@ gsk_gpu_device_lookup_glyph_image (GskGpuDevice *self,
.width = rect.size.width + 2 * padding,
.height = rect.size.height + 2 * padding,
},
scale,
&GRAPHENE_POINT_INIT (cache->origin.x + padding,
cache->origin.y + padding));
g_hash_table_insert (priv->glyph_cache, cache, cache);
gsk_gpu_cached_use (self, (GskGpuCached *) cache, timestamp);
memcpy (&priv->front[front_index].key, &lookup.key, sizeof (GlyphKey));
priv->front[front_index].value = cache;
g_hash_table_insert (font_cache->cache, cache, cache);
gsk_gpu_cached_use (self, (GskGpuCached *) cache, gsk_gpu_frame_get_timestamp (frame));
*out_bounds = cache->bounds;
*out_origin = cache->origin;
*out_scaled_font = scaled_font;
return cache->image;
}
+7 -5
View File
@@ -41,6 +41,8 @@ struct _GskGpuDeviceClass
GdkMemoryDepth depth,
gsize width,
gsize height);
void (* make_current) (GskGpuDevice *self);
};
GType gsk_gpu_device_get_type (void) G_GNUC_CONST;
@@ -48,9 +50,8 @@ GType gsk_gpu_device_get_type (void) G
void gsk_gpu_device_setup (GskGpuDevice *self,
GdkDisplay *display,
gsize max_image_size);
void gsk_gpu_device_gc (GskGpuDevice *self,
gint64 timestamp);
void gsk_gpu_device_maybe_gc (GskGpuDevice *self);
void gsk_gpu_device_queue_gc (GskGpuDevice *self);
GdkDisplay * gsk_gpu_device_get_display (GskGpuDevice *self);
gsize gsk_gpu_device_get_max_image_size (GskGpuDevice *self);
GskGpuImage * gsk_gpu_device_get_atlas_image (GskGpuDevice *self);
@@ -69,7 +70,7 @@ GskGpuImage * gsk_gpu_device_create_download_image (GskGpuD
GdkMemoryDepth depth,
gsize width,
gsize height);
void gsk_gpu_device_make_current (GskGpuDevice *self);
GskGpuImage * gsk_gpu_device_lookup_texture_image (GskGpuDevice *self,
GdkTexture *texture,
gint64 timestamp);
@@ -95,7 +96,8 @@ GskGpuImage * gsk_gpu_device_lookup_glyph_image (GskGpuD
GskGpuGlyphLookupFlags flags,
float scale,
graphene_rect_t *out_bounds,
graphene_point_t *out_origin);
graphene_point_t *out_origin,
PangoFont **out_scaled_font);
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GskGpuDevice, g_object_unref)

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