Compare commits

...

303 Commits

Author SHA1 Message Date
Hugo Carvalho f502d3a6c4 Update Portuguese translation 2024-05-09 16:03:58 +00:00
Martin c75fba08ea Update Slovenian translation 2024-03-24 23:18:46 +00:00
Marek Kasik f9997de151 printing: Avoid accessing freed printers
Print backend can be disposed together with all its printers
as a reaction to user stopping enumeration of printers.
Adding a weak pointer help us to detect that the backend
was disposed and hence the backend and its printers should not
be used anymore.

Fixes #6265
2024-03-13 11:21:02 +01:00
Balázs Úr 501e0ad4eb Update Hungarian translation 2024-02-23 00:38:56 +00:00
Andi Chandler 27d1af6e8e Update British English translation 2024-02-21 19:58:59 +00:00
Jordi Mas i Hernandez d84a17526f Update Catalan translation 2024-02-18 12:21:30 +00:00
Juliano de Souza Camargo 4b0d3d8326 Update Brazilian Portuguese translation 2024-02-17 12:15:04 +00:00
Piotr Drąg 26df07717e Update Polish translation 2024-02-11 15:19:40 +01:00
Christian Kirbach 12d01bc36a Update German translation 2024-02-06 08:53:39 +00:00
Kukuh Syafaat f83514c639 Update Indonesian translation 2024-02-06 04:11:30 +00:00
Yaron Shahrabani 24b0d08249 Update Hebrew translation 2024-02-02 08:52:34 +00:00
Aurimas Černius 3dad92b380 Update Lithuanian translation 2024-01-30 20:51:03 +00:00
Sabri Ünal a345df255d Update Turkish translation 2024-01-22 12:40:12 +00:00
Alexandre Franke 92862dfeec Update French translation 2024-01-22 12:09:15 +00:00
Artur S0 5a021e229f Update Russian translation 2024-01-20 19:01:53 +00:00
Florentina Mușat a48424c249 Update Romanian translation 2024-01-20 18:31:18 +00:00
Danial Behzadi 466da30208 Update Persian translation 2024-01-20 11:25:27 +00:00
Danial Behzadi 58425405d2 Update Persian translation 2024-01-20 11:13:32 +00:00
Yuri Chornoivan af984f2503 Update Ukrainian translation 2024-01-18 17:42:57 +00:00
Anders Jonsson b94a3eeb1c Update Swedish translation 2024-01-18 07:13:55 +00:00
Ekaterine Papava 26ff449343 Update Georgian translation 2024-01-18 06:09:41 +00:00
Matthias Clasen 750c2ff7fb Post-release version bump 2024-01-17 23:05:21 -05:00
Matthias Clasen 48f6ffad7f 4.12.5 2024-01-17 22:50:47 -05:00
Benjamin Otte 508970a7fa tests: Fix gio API usage
Related: glib!3261
2024-01-17 22:32:14 -05:00
Florian Müllner 9d57e9bce4 docs: Update link to GitLab documentation
The original link no longer works, so update the reference to
point to the currently correct location.
2024-01-17 22:31:29 -05:00
Guido Günther 616a685818 stack: Add automatic cleanup for GtkStackPage
Useful when iterating over the pages via g_list_model_get_item ().
2024-01-17 22:31:05 -05:00
Matthias Clasen a09e6f4f5c glarea: Add some details to the docs
Mention that the rendering is integrated into the GTK scene graph
as a texture and that the initial framebuffer contents are
transparent.

Fixes: #6317
2024-01-17 22:30:23 -05:00
Christian Hergert 1db48174b4 texthistory: fix potential NULL dereference
Fixes #6308
2024-01-17 22:26:14 -05:00
Mohammed Sadiq 67690f69e9 shortcutswindow: Reduce default width of search entry
Reduce the default width of search entry so that it fits on smaller
screens (ie, screens having 360px or less width).  Also, set max width
to the old value of 40, so that the search entry will have the same
old size if window width permits.

This commit won't make any difference on larger screens.
2024-01-17 22:25:59 -05:00
Matthias Clasen 9ba39ff7aa dropdown: Fix initial checkmark
When the ::bind signal is emitted, the list item may not be added
to the list view yet, so we can't consult the widget hierarchy at
that point to decide whether to show or hide the icon. List for
notify::root instead.

Fixes: #6305
2024-01-17 22:25:48 -05:00
Matthias Clasen 3420a12104 Annotate gtk_ordering_from_cmpfunc as skip
We do extra work here to make the introspection scanner pick up
the docs for the static inline function, but that doesn't make the
function actually work in language bindings, so mark it as skip.

Fixes: #6298
2024-01-17 22:25:29 -05:00
Benjamin Otte cbb0cbb5bd rendernode: Allocate right amount of memory
asan randomly failed when this almost correct code wasn't quite correct.

Hopefully this is the correct incantation to compute the size.

Related: glib#205
2024-01-17 22:24:57 -05:00
Benjamin Otte a302672ca8 rendernode: Fix a memleak 2024-01-17 22:24:34 -05:00
Benjamin Otte 6e93cd8803 gdkpng: Make the png loader safer against overflows
Load images that result in a texture >4GB in size.

And now let me keep playing with my 60k x 60k image, thanks.
I'm trying to OOM my GPU.
2024-01-17 22:24:12 -05:00
Benjamin Otte 2223abd432 roundedrect: Fix an intersection cornercase
These 2 rectangles used to intersect fine:
  0 0 50 50 / 50 0
  0 0 50 50 / 0 50
But the computed result was:
  0 0 50 50 / 50
which is not a valid rectangle, because the corners overlap.

Make sure such rectangles return NOT_REPRESENTABLE.

The above rectangle has been added to the testsuite.
2024-01-17 22:22:44 -05:00
Emmanuele Bassi 58861ef18e docs: Clarify behaviour of GtkScrolledWindow child accessors
Right now, it's mentioned only in the class description of
GtkScrolledWindow that the accessors of the child property don't
necessarily roundtrip.

Let's make it more clear by expanding the documentation of the setter,
getter, and property.

See: #6275
2024-01-17 22:20:02 -05:00
Emmanuele Bassi fa817ae092 Fix typo in GtkAspectFrame.yalign accessor
Copy-paste error.

Fixes: #6273
2024-01-17 22:19:26 -05:00
Carlos Garnacho 9c804b3fd7 gtk-demo: Fix typo
Close the quotes in alert dialog message.
2024-01-17 22:18:15 -05:00
FeRD (Frank Dana) db0a97f374 Docs: Fix unfenced HTML tag in GtkLabel docs 2024-01-17 22:17:17 -05:00
Emmanuele Bassi a78439a42c Add fallback string for empty inhibit reason
The public gtk_application_inhibit() API allows a NULL reason argument,
and we have a fallback in place when going through the session manager
proxy; when using the inhibit D-Bus API directly, though, we're just
passing a potentially NULL value to g_variant_new_string(), which will
rightfully complain.
2024-01-17 22:17:05 -05:00
g.willems 0347ea896b gtktexthistory: allow set modified in irreversible action
Allow setting the modified flag, but skip propagating the history state update
as it will be done by gtk_text_history_end_irreversible_action().

Fixes #6236
Closes #6236
2024-01-17 22:15:48 -05:00
Matthias Clasen cf0d017682 Use O_CLOEXEC instead of FD_CLOEXEC
GLib is complaining vocally about this.
2024-01-17 22:15:25 -05:00
Matthias Clasen 9ad7f3cd60 css: Fix opacity handling
We were using the invert value for opacity.
2024-01-17 22:14:45 -05:00
Matthias Clasen 9afe65bc7f wayland: Be more careful when loading cursors
Make sure we don't access the cursor_images array out of bounds.

Related: #6234
2024-01-17 22:14:35 -05:00
Val Och c1b9a575b7 GtkFontDialog: fix annotation for choose_font_and_features_finish
Parameters in question have callee-allocated semantics.
2024-01-17 22:14:21 -05:00
Emilio Cobos Álvarez 6854078338 [gtk4] gtkopenuriportal: Fix portal close signal.
Same fix. The other instance of this pattern in gtkapplication-dbus.c
does it right.
2024-01-17 22:13:27 -05:00
Emilio Cobos Álvarez a64c2ed6f0 [gtk4] GtkFileChooserNative: Fix portal close.
This makes closing a portal file chooser work.

Fixes the GTK4 bits of #6225.
2024-01-17 22:13:20 -05:00
Benjamin Otte a0c632b0d3 columnview: Make sure cells disconnect from their column
When a cell is removed from the columnview, we need to make sure it s
not just removed from the cell (via unset_parent()) but also from the
column.

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

So now we do it explicitly together with unset_parent().
2024-01-17 22:09:37 -05:00
Matthias Clasen 38b14c8b0b Merge branch 'fix-wgl-leak-backport-to-gtk-4-12' into 'gtk-4-12'
GdkWin32: Do not create multiple WGL contexts for the dummy window [4.12]

See merge request GNOME/gtk!6697
2024-01-18 03:06:35 +00:00
Ngọc Quân Trần cbc44e202a Update Vietnamese translation 2024-01-13 07:19:18 +00:00
Emmanuele Bassi 081b8af597 Merge branch 'ebassi/doc-link-fixes-stable' into 'gtk-4-12'
Backport doc fixes from main

See merge request GNOME/gtk!6740
2024-01-12 13:16:41 +00:00
Emmanuele Bassi 39f7f8615b docs: Fix link to GtkSnapshot.restore() 2024-01-12 12:50:51 +00:00
Emmanuele Bassi d310c9dd92 docs: Fix link to GtkLabel.set_mnemonic_widget() 2024-01-12 12:50:37 +00:00
Matthias Clasen dbe1804c3a docs: Fix: gdk->gtk and gdk->gsk links
gi-docgen can only generate links for dependencies, so we have
to manually expand to a relative url here.

fixup
2024-01-12 12:46:03 +00:00
Carlos Garnacho cbf471436a Merge branch 'gtk-4-12-backports' into 'gtk-4-12'
[4.12 backport] gdk/wayland: Reset cursor_is_default on proximity out

See merge request GNOME/gtk!6738
2024-01-12 11:16:45 +00:00
Peter Hutterer 5216670901 gdk/wayland: Reset cursor_is_default on proximity out
For tablet tools if we have NULL cursor, we use the default cursor
instead. This provides us with a tablet cursor when an application never
sets the cursor.

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

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

Closes: #6312
(cherry picked from commit 04870fc1a1)
2024-01-12 11:57:56 +10:00
Matej Urbančič 274f485248 Update Slovenian translation 2023-12-27 20:44:50 +00:00
Luca Bacci 0345e80770 GdkWin32: Do not create multiple WGL contexts for the dummy window
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/6285
2023-12-27 16:31:34 +01:00
Asier Sarasua Garmendia 5ccbcbbec8 Update Basque translation 2023-12-24 07:29:58 +00:00
Jürgen Benvenuti 7608c5cc88 Update German translation 2023-12-23 22:01:03 +00:00
Matthias Clasen 4774ebca20 Merge branch 'backport-4-12' into 'gtk-4-12'
[4.12] Backport a few Windows and macOS fixes

See merge request GNOME/gtk!6679
2023-12-21 12:31:04 +00:00
sumibi-yakitori 2666cc8cba Fix coding style 2023-12-19 15:51:08 +02:00
sumibi-yakitori b7cda90b5f macos: change to send motion events to NSApp
This fix addresses a problem where the mouse cursor cannot be changed after it becomes a resize indicator, even in non-CSD windows
2023-12-19 15:50:54 +02:00
Peter Williams 3447ea8ca3 gdk/macos: fix builds on macOS before 10.13
Nothing profound here, just need to get some of the workarounds
into the right places.
2023-12-19 15:46:00 +02:00
g.willems 40c009852d testsuite: only run x11-specific tests if x11 enabled
Some testcases rely on X11 support, which is not always available,
typically on win32.
Skip them if the x11 backend is disabled.
2023-12-19 15:45:24 +02:00
g.willems 6cdff5ba2b testsuite: fix icontheme test failure on win32
g_str_has_suffix() fails due to different path separators.
Compare URIs instead.
2023-12-19 15:44:41 +02:00
g.willems 18a18d9e7d gdk/win32: support default-settings debug flag 2023-12-19 15:43:14 +02:00
Arjan Molenaar fbcc280b6a macos: Add method that denotes secure restorable state
Fix process injection vulnerability on macOS.
2023-12-19 15:32:44 +02:00
g.willems 4b350db909 win32: precalculate keymap at display opening
The default keymap and keymap layouts are calculated on request.
If done once a surface is setup and listening at win32 events,
we may then enter in a recursive loop.
To avoid this, precalculate the keymap as soon as displays are open.

Fixes #6203
Closes #6203
2023-12-19 15:31:07 +02:00
g.willems 8ec7c3bc21 win32: switch to new clipboard API
This is a backport of !1143 to gtk4.

SetClipboardViewer() API is obsolete is prone to clipboard chain breaks
from other applications.
Use recommended AddClipboardFormatListener() instead.

Fixes #442
2023-12-19 15:30:43 +02:00
Yaron Shahrabani 2bf58d486d Update Hebrew translation 2023-12-09 21:59:53 +00:00
Matthias Clasen 58960c890d Merge branch 'gtk-4-12-emoji-15.1' into 'gtk-4-12'
emoji: Update data to CLDR v44

See merge request GNOME/gtk!6645
2023-12-08 07:03:34 +00:00
Aurimas Černius 7a0e8ade38 Update Lithuanian translation 2023-12-07 20:55:22 +00:00
Jeremy Bícha e42befb76b emoji: Update data to CLDR v44
Based on emojibase v15.3.0

Contains the changes in Unicode 15.1

https://unicode.org/versions/Unicode15.1.0/
https://cldr.unicode.org/index/downloads/cldr-44
https://github.com/milesj/emojibase/blob/emojibase-data%4015.3.0/packages/data/CHANGELOG.md
(cherry picked from commit 76a1f1714d)
2023-12-06 07:55:42 -05:00
Jeremy Bícha f947f23687 emoji: Update data to CLDR v43
Based on emojibase v15.2.0

Contains the changes in Unicode 15.0

https://unicode.org/versions/Unicode15.0.0/
https://cldr.unicode.org/index/downloads/cldr-43
https://github.com/milesj/emojibase/blob/emojibase-data%4015.2.0/packages/data/CHANGELOG.md
(cherry picked from commit bf35836350)
2023-12-06 07:55:23 -05:00
sudip 322d9e5c3f add hi-ja-et-fi-nb-th for gtkemojichooser
(cherry picked from commit 49fbbfb6cc)
2023-12-06 07:55:11 -05:00
sudip 4b2145475e add bengali language bn.data for gtkemojichooser
(cherry picked from commit 16806294e3)
2023-12-06 07:55:03 -05:00
Matthias Clasen e22cc913c5 Merge branch 'wip/sophie-h/backport-mr-6586' into 'gtk-4-12'
Backport "file dialog: Return an error if no file is selected"

See merge request GNOME/gtk!6641
2023-12-04 01:29:57 +00:00
Matthias Clasen ba3e8eee8b file dialog: Return an error if no file is selected
This was brought as a problem for bindings in #6139.

Fixes: #6139
2023-12-03 12:34:36 +01:00
Boyuan Yang 8f91167c30 Update Chinese (China) translation 2023-12-03 01:38:52 +00:00
Daniel Rusek 8da82c6206 Update Czech translation 2023-11-30 18:24:11 +00:00
Emin Tufan Çetin e3fb8f341b Update Turkish translation 2023-11-30 14:16:12 +00:00
Danial Behzadi 6772527a3d Update Persian translation 2023-11-28 08:43:15 +00:00
Artur S0 f5a8a09f38 Update Russian translation 2023-11-27 16:11:47 +00:00
Kukuh Syafaat e4a6889254 Update Indonesian translation 2023-11-26 16:07:50 +00:00
Bruce Cowan 80545f9842 Update British English translation 2023-11-23 19:35:19 +00:00
Jordi Mas i Hernandez fd96444174 Update Catalan translation 2023-11-23 06:29:40 +00:00
Florentina Mușat 1691df5234 Update Romanian translation 2023-11-20 13:14:56 +00:00
Piotr Drąg f78e5ad8c2 Update Polish translation 2023-11-19 15:37:26 +01:00
Anders Jonsson 01a373eca6 Update Swedish translation 2023-11-19 10:18:41 +00:00
Yuri Chornoivan e1ed8fd8f6 Update Ukrainian translation 2023-11-18 18:54:10 +00:00
Piotr Drąg 3aaa1724b0 Update Polish translation 2023-11-18 17:07:41 +01:00
Ekaterine Papava 5ac70b2662 Update Georgian translation 2023-11-18 03:13:32 +00:00
Matthias Clasen 66ed0c11c2 Post-release version bump 2023-11-17 15:40:02 -05:00
Matthias Clasen 0cdb58af49 4.12.4 2023-11-17 15:29:11 -05:00
madmurphy 103a9ed396 Fix warnings when compiling with -pedantic 2023-11-17 15:28:58 -05:00
Benjamin Otte 674071a981 Add a debug node for CSS outlines
All the other CSS render operations have one, so outlines should, too.

This was found by tracking down a random border node in a rendering.
2023-11-17 15:28:58 -05:00
Andy Holmes 6937fcad9e gtk: fix NULL pointer dereference
`gtk_window_get_default_size()` claims width/height are optional-out
arguments, but defers to `gtk_window_get_remembered_size()` which
may dereference a NULL-pointer.

Since `gtk_window_get_remembered_size()` is only called by
`gtk_window_get_default_size()`, collapse it into the latter
and perform the NULL check there.
2023-11-17 15:28:58 -05:00
Benjamin Otte a159293c69 inspector: Replace "no glyph" with space glyph
This makes right-aligning the text work again.
2023-11-17 15:28:58 -05:00
Benjamin Otte 64ecfd656e inspector: Use the right font for the fps overlay
Initialize the font only when we have a widget that provides it. That
way we don't pick a terrible default font, but the widget's preferred
one.
2023-11-17 15:28:58 -05:00
Matthias Clasen 84343d30fb Some minor fpsoverlay improvements
Avoid some allocations.
2023-11-17 15:28:58 -05:00
Matthias Clasen 5587ee1027 inspector: Speed up the fps overlay
Do less work!
2023-11-17 15:28:58 -05:00
Robert Ancell 3b30862e00 docs: Replace deprecated gtk_widget_show with gtk_widget_set_visible 2023-11-17 14:59:31 -05:00
Benjamin Otte 9f8cf5b0bd gl: Fix padding in icon library
The previous code would not pad the left side with the left column of
pixels but with the top row.

Test attached.
2023-11-17 14:59:02 -05:00
Benjamin Otte 013a06f596 gsk: Fix texture-scale node Cairo drawing
The code was interpreting x/y coordinates wrong sometimes and causing
things to not be drawn at the correct offset.

Testcase included.
2023-11-17 14:58:53 -05:00
Benjamin Otte b88a652567 rendernode-tool: Add --undecorated to show command
This is to get exactly just the rendernode drawn when testing, and not
any extra drawing code.
2023-11-17 14:55:26 -05:00
Kleis Auke Wolthuizen e2b6433799 widget-factory: Remove insert-image icon
This icon is already present in the hicolor icon theme.
2023-11-17 14:55:02 -05:00
Kleis Auke Wolthuizen ec200a333b widget-factory: Remove view-grid-symbolic icon
No longer needed as it's included in the hicolor icon theme now.
2023-11-17 14:54:53 -05:00
Kleis Auke Wolthuizen ff1c503735 icons: Add view-grid-symbolic
This showed up as missing icon in the file chooser when used with
the hicolor icon theme.

Resolves: https://gitlab.gnome.org/GNOME/gtk/-/issues/6184
2023-11-17 14:54:42 -05:00
Lukáš Tyrychtr d4b0d395a1 Adjust tests 2023-11-17 14:54:30 -05:00
Lukáš Tyrychtr e660e922fe a11y: When using rule 2.E for computing accessible name, use it only if appropriate
We were using it in all cases, so, we were using it to compute descriptions,
and also for non-embedded controls. That was overriding descriptions
set, for example, in Gnome settings, and was causing the value of spinboxes
to be read multiple times.
2023-11-17 14:54:21 -05:00
Chun-wei Fan 287436a26d builds: Require -Zc:preprocessor for Visual Studio debug builds
This flag is actually required for the debugging code to successfully build,
so check that it is really there for debug-enabled Visual Studio builds.
2023-11-17 14:54:13 -05:00
Chun-wei Fan cb644a6d23 MSVC Builds: Don't enable -utf-8 explicitly
We already require a Meson release that enables -utf-8 by default, so we don't
really need to explicitly enable it here.
2023-11-17 14:54:06 -05:00
Chun-wei Fan 8d92e0fb6f build: Add msvc_recommended_pragmas.h
We really always want to force-include msvc_recommended_pragmas.h to check for
things at compile time so that we can avoid stuff like missing includes or
attempting to return a value in a function that is supposed to have a
void-return-type.

The current problem is that, as indicated in the Visual Studio CI job, that we
couldn't locate msvc_recommended_pragmas.h during the build if GLib is built
as a subproject, and/or when msvc_recommended_pragmas.h is not in the paths
indicated by %INCLUDE%, meaning that the aforementioned issues would not be
caught by CI, which will then break builds on Visual Studio for people when
msvc_recommended_pragmas.h is found during their builds.

It would also be nice to be quiet from the warnings that we can really
disregard anyways.

So, add a copy of msvc_recommended_pragmas.h from GLib and update the build
files to look for it in build-aux/msvc, so that it can always be used during
the build, especially by the CI.
2023-11-17 14:53:54 -05:00
Matthias Clasen 0bf68f1372 Fix swizzle values for some memory formats
For opaque formats with 3 channels, we should use the default
GL_ALPHA, but for opaque formats with an ignored 4th channel,
we must use GL_ONE.
2023-11-17 14:53:41 -05:00
sudip 722953737d translated bn.po and hi.po
Resolves:https://gitlab.gnome.org/GNOME/gtk/-/issues/6164
2023-11-17 14:53:17 -05:00
Benjamin Otte d17eca052d gl: Remove optimization that does the wrong thing
Drawing a texture-scale node like a texture node when the filter is set
to "linear" doesn't work, because the texture node switches to
trilinear when mipmaps are available.
2023-11-17 14:52:07 -05:00
Benjamin Otte 101296ac0e gl: Make sure render_texture() sets the right format for high depth
Setting the format got lost when converting this coe to the texture
builder, because that codepaths avods the texture sniffing and always
uses RGBA8.
2023-11-17 14:51:56 -05:00
Benjamin Otte 7c9ef05c7c gdk: Make float32 report its true depth
I have no idea how this is the only value that is wrong.
2023-11-17 14:51:37 -05:00
Artur S0 1afad435a7 Update Russian translation 2023-11-04 02:05:59 +00:00
Luca Bacci e935b25a57 Merge branch 'invalid-client-rects-4-12' into 'gtk-4-12'
[4.12] GdkWin32: ignore invalid client rects

See merge request GNOME/gtk!6545
2023-11-03 21:23:50 +00:00
G.Willems c69e19c9c5 GdkWin32: ignore invalid client rects
Gdk-Win32 uses GetClientRect() internally to query the surfaces coordinates,
but this API may fail in some transient contexts (observed when iconifying
a maximized window).
Check if the rect area is null, and don't update the surface position in
that case. This will keep the current surface size, until Win32 notifies
the new valid window state later.
This prevents using a nulled next_layout for toplevel size computation,
which would break widgets allocation once notified on gtk side.

Fixes #5724
Closes #5724
2023-11-03 22:51:47 +02:00
Matthias Clasen fe9abc78c0 Merge branch 'wip/chergert/for-4-12' into 'gtk-4-12'
cherry-pick bgra/vertex-array checks to 4.12

See merge request GNOME/gtk!6541
2023-10-31 21:35:51 +00:00
Matthias Clasen a65dc12392 gsk: Use vertex arrays when we can
Use the new has_vertex_arrays api to determine
whether we can use vertex arrays in GL.`

Fixes: #6173
2023-10-31 13:46:32 -07:00
Matthias Clasen f725e3f992 glcontext: Add api to check for vertex arrays
Vertex arrays are available in GL and in GLES >= 3.

We don't check for the GLES extension that provided
vertex arrays in older GLES, since that requires
using different API.

This api avoids version checks all over the place.
2023-10-31 13:46:32 -07:00
Matthias Clasen 5ff9316ec2 gsk: Restore bigendian support
Restore the bigendian support that was lost in b0e26873f6,
by just not using GL_BGRA with GLES on bigendian. Should be a
very rare combination, but still.
2023-10-31 13:46:32 -07:00
Matthias Clasen 41dbb7a757 gsk: Use has_bgra in more places
The glyph and icon libaries were also checking for GLES to
decide if data needs to be transformed from BGRA to RGBA.

Use the new has_bgra getter instead.

This will probably break on bigendian, because the
GL_BGRA + GL_UNSIGNED_BYTE combination is not equivalent
to the cairo format on bigendian, but this was already
broken for the gl format information that we get from
gdk_memory_format_gl_format.
2023-10-31 13:46:32 -07:00
Matthias Clasen 9c6a4c3d28 glcontext: Check for GL_EXT_texture_format_BGRA8888
Check for this GLES extension and add a private getter.
2023-10-31 13:46:32 -07:00
Guillaume Bernard 3b8c1189f4 Update French translation 2023-10-23 15:22:24 +00:00
Sabri Ünal aaea063c96 Update Turkish translation 2023-10-21 09:15:46 +00:00
Matthias Clasen 24670df0f0 Merge branch 'macos_ci' into 'gtk-4-12'
Backport macOS CI to 4-12 to use new runner

See merge request GNOME/gtk!6497
2023-10-19 16:18:53 +00:00
René de Hesselle 9753fc3b82 gdk: Use subpixel_layout on macOS
(cherry picked from commit 9aeb5be8ad)
2023-10-19 17:26:44 +02:00
Jayson Reis 1c58913f6a gdk: Remove a leftover reference to the renamed variable prefers_high_depth
(cherry picked from commit aa888c0b3f)
2023-10-19 17:26:44 +02:00
René de Hesselle 0f8b9c73cd ci: Backport CI yaml from main
This makes the CI yaml identical to the one in main, which changes
two things:
- modernize workflow configuration
- use a new macOS runner for macOS CI
2023-10-19 17:11:35 +02:00
Florentina Mușat b108e8b91a Update Romanian translation 2023-10-18 18:14:42 +00:00
Daniel Mustieles 06b39de159 Update Spanish translation 2023-10-17 15:09:53 +00:00
Matthias Clasen 761af75b1d Merge branch 'no-emus-in-bitfields-4.12' into 'gtk-4-12'
[4.12] Stop using enums in bitfields

See merge request GNOME/gtk!6491
2023-10-17 10:30:00 +00:00
Sergey Bugaev 3e2ef5037a Stop using enums in bitfields
The C standard does not specify whether the underlying type of an enum
is signed or unsigned, and until C23 there was no way to control this
explicitly. GCC appears to make enums unsigned unless there is a
negative value among cases of the enum, in which case it becomes signed.
MSCV appears to make enums signed by default.

A bitfield of an enum type (which is not specificied in the C standard
either) behaves as if it was an instance of a numeric type with a
reduced value range. Specifically, a 'signed int val : 2;' bitfield will
have the possible values of -2, -1, 0, and 1, with the usual wraparound
behavior for the values that don't fit (although this too is
implementation-defined).

This causes the following issue, if we have:

typedef enum
{
  GTK_ZERO,
  GTK_ONE,
  GTK_TWO
} GtkFoo;

struct _GtkBar
{
  GtkFoo foo : 2;
};

and then assign bar.foo = GTK_TWO and read it back, it will have the
expected value of 2 (aka GTK_TWO) on GCC, but a value of -2 (not
matching any of the enum variants) on MSVC.

There does not seem to be any way to influence signedness of an enum
prior to C23, nor is there a 'unsigned GtkFoo foo : 2;' syntax. The only
remaining options seems to be never using enums in bitfields, which is
what this change implements.

In practice, this fixes GdkPipeIOStream crashing with an assertion when
trying to copy-paste in-app in MSVC builds on GTK.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-10-17 11:40:51 +03:00
Artur S0 f0448a3708 Update Russian translation 2023-10-16 11:56:09 +00:00
Sabri Ünal 7df8dbc64d Update Turkish translation 2023-10-14 07:06:07 +00:00
Jordi Mas i Hernandez d6fecef605 Update Catalan translation 2023-10-03 06:55:50 +00:00
Matthias Clasen 02a94c9462 Post-release version bump 2023-09-28 08:23:37 -04:00
Matthias Clasen 11ef4c8f43 4.12.3 2023-09-28 08:03:14 -04:00
Matthias Clasen 03679fe6bf print portal: Report errors properly
The portal printoperation inmplementation
relies on the file printbackend to be available.
If it isn't, we should report a proper error
status insetad of running into assertions deep
inside the printoperation code.
2023-09-27 20:42:45 -04:00
Christian Hergert 0030c572d4 gsk/gl: remove TypeNode conformity checking for renderjob
We don't need to be calling type node conformity checking from the tight
loop of the renderjob. Hoist that into the private header and use that
intead through via the Class pointer.
2023-09-27 20:42:45 -04:00
Christian Hergert 28e97f028a gsk: remove excessive type checking within GSK
Anything that includes gskrendernodeprivate.h will get an alternate form
of ref/unref for render nodes which does not need to do type checking on
the parameter. We can expect that things are correct within GTK itself and
this saves excessive amounts of TypeNode conformities checking.
2023-09-27 20:42:45 -04:00
Michael Catanzaro 6d371f0594 printoperation: fix some strange line spacing 2023-09-27 20:42:45 -04:00
Michael Catanzaro cbfbaef4cb printoperation: add some assertions
Let's assert that we schedule the idle callback exactly once.

These assertions are not perfect because if the callback executes before
we schedule it, then the assertion itself would be a use-after-free,
since I'm using the PrinterFinder to track whether the callback that
frees it has been scheduled. But in practice when using loupe's print
dialog, I was noticing the callback scheduled twice before it was
executed. The assertion would have caught this problem.
2023-09-27 20:42:45 -04:00
Michael Catanzaro 39560c0914 printoperation: fix another case where operation may complete twice
This is a little tricky. At first, I thought we had a codepath where we
fail to schedule the idle that completes the print operation: if we take
the gtk_print_backend_printer_list_is_done path for each printer
backend, then printer_list_done_cb() is never executed and we never
schedule the idle. But in fact, in this case, then backends == NULL at
the bottom of find_printer(), and we'll schedule the idle there, so it's
OK. Except it's not really OK, because we'll schedule it even if a
printer was already found, resulting in the callback completing twice
and a double free.

Simplify this. Schedule the idle in find_printer() only if there are
*initially* no backends, not also if all backends are immediately ready
and already removed from consideration. Instead, always call
printer_list_done_cb() for every backend in find_printer_init(). After
the previous commit, printer_list_done_cb() will schedule the idle when
appropriate.

printer_list_done_cb() additionally disconnects signals that we did not
connect in this codepath, but it does so using
g_signal_handlers_disconnect_by_func, which is harmless. Otherwise, the
only extra work it's doing is scheduling the idle, and that's exactly
what find_printer_init() is missing.
2023-09-27 20:42:45 -04:00
Michael Catanzaro 29a243e3d7 printoperation: fix case where operation may complete multiple twice
If we are the final backend, then after removing ourselves there is no
backend remaining. We will schedule the idle even if it has already been
scheduled. This idle is required to run exactly once and executing it
twices results in a double free that crashes loupe when printing. It
also causes the user callback to execute twice, which could cause
similar problems.

Fixes #6122
2023-09-27 20:42:45 -04:00
Christian Hergert d4d0883a92 gsk/gl: use GdkArrayImpl for tracking modelview
Like the previous change, this uses GdkArrayImpl instead of GArray for
tracking modelview changes. This is less important than clip tracking
simple due to being used less, but it keeps the implementation synchronous
with the Clip tracking code.
2023-09-27 20:42:45 -04:00
Christian Hergert 3698cadcd2 gsk/gl: use GdkArrayImpl for Clip tracking
We can end up spending a lot of time in g_array_maybe_expand() through the
use of g_array_set_size() for clip tracking. That is somewhat due to the
simple nature of GArray being size-dynamic. Instead, we can use
GdkArrayImpl and let the compiler do what it does best to elide some
work and hoist other work into the calling function.

This also fixes a potential UAF in gsk_gl_render_job_push_contained_clip().
2023-09-27 20:42:45 -04:00
Christian Hergert 412a12032f gdk: add missing G_END_DECLS to gdkarrayimpl.c 2023-09-27 20:42:45 -04:00
Emmanuele Bassi 9c4edaa5a0 broadway: Do not add an extra reference when caching textures
We just created a GdkTexture, so we don't need to acquire a reference if
we're transferring the ownership to the node cache.
2023-09-27 20:42:45 -04:00
Emmanuele Bassi 098796e0e6 broadway: Plug another leak
When getting a colorized texture we're downloading the texture as a
Cairo surface, and then feeding it to another texture, but we never drop
the reference of the new surface.
2023-09-27 20:42:45 -04:00
Emmanuele Bassi 6938d5aff2 docs: Clarify the behaviour of gdk_texture_new_for_surface()
Cairo surfaces are not GObject instances, so we should be more explicit
in the behaviour of the memory management, to avoid leaks.
2023-09-27 20:42:45 -04:00
Emmanuele Bassi 17c979caf1 broadway: Plug a leak in the GSK renderer
We are leaking the Cairo image surface when creating a new node.

Fixes: #6120
2023-09-27 20:42:45 -04:00
Benjamin Otte bbe7e8555d array: Compute new size properly
Using "1 << x" means that we are shifting a signed 32bit integer, but we
want a gsize, which is an unsigned 64bit integer.

So now we don't overflow anymore if the array reaches a size of 2GB.
2023-09-27 20:42:45 -04:00
Benjamin Otte df4f716ea0 gdk: Fix compiler warning
gcc's -Wlto-type-mismatch found the hack, where we copied the wrong
prototype.
2023-09-27 20:42:44 -04:00
Benjamin Otte 3942590e7f treeview: Fix crash in assertion
The fix in commit a267dfac5d is wrong.
The function can return FALSE in normal operation.

Instead do a check for node == NULL that gracefully returns FALSE instead.

Fixes: #6114
2023-09-27 20:42:44 -04:00
Matthias Clasen 9fb934b9fc Improve FOO_DEBUG=help output
Explain the all value a bit better.
2023-09-27 20:42:44 -04:00
Alice Mikhaylenko 60d0213ce0 dialog: Check header bar type before calling track_default_decoration()
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/6116
2023-09-27 20:42:44 -04:00
Alice Mikhaylenko 88013bbdab header-bar: Add a precondition to track_default_decoration() 2023-09-27 20:42:44 -04:00
Matthias Clasen 3ab67d852b gtk-demo: Fix a refcounting mishap
gtk_font_dialog_button_new's argument is
transfer full.

Fixes: #6113
2023-09-27 20:42:44 -04:00
Emmanuele Bassi f3daa0ee08 docs: Mention for what GtkStringObject:string is useful 2023-09-27 20:42:44 -04:00
Emmanuele Bassi 60560e5277 docs: Link GtkStringObject from GtkStringList
A frequently asked question is: "what is the object type inside a
GtkStringList", so let's make the answer more obvious.
2023-09-27 20:42:44 -04:00
Emmanuele Bassi 8cb6b9b385 docs: Add a link to the DropDown:selected property
The main description is a bit too coy, and some newcomers don't
understand the concept of properties and notification.
2023-09-27 20:42:44 -04:00
Jürgen Benvenuti cfd9cb3e9f Update German translation 2023-09-26 20:37:59 +00:00
Aurimas Černius 61276e9a76 Update Lithuanian translation 2023-09-25 19:58:03 +00:00
Rafael Fontenelle 90b8dcdf33 Update Brazilian Portuguese translation 2023-09-25 12:58:37 +00:00
Piotr Drąg 38bd0b07f3 Update Polish translation 2023-09-24 14:16:38 +02:00
Kristjan SCHMIDT ecc42c506b Update Esperanto translation 2023-09-23 16:41:34 +00:00
Danial Behzadi 052c2c1d16 Update Persian translation 2023-09-23 15:15:29 +00:00
Balázs Úr 28099aa1b5 Update Hungarian translation 2023-09-22 22:25:30 +00:00
Asier Sarasua Garmendia dea3324217 Update Basque translation 2023-09-21 17:28:05 +00:00
Yuri Chornoivan 8e090a8a0c Update Ukrainian translation 2023-09-21 16:21:33 +00:00
Baurzhan Muftakhidinov f6d4b7b04b Update Kazakh translation 2023-09-21 15:28:54 +00:00
Luca Bacci b4c7d1d065 Merge branch 'fix-issue-6080-gtk-4-12' into 'gtk-4-12'
GdkWin32: Unref GdkMonitor after calling gdk_monitor_invalidate () [4.12]

See merge request GNOME/gtk!6412
2023-09-21 12:42:02 +00:00
Daniel Rusek b440ba8e8c Update Czech translation 2023-09-21 12:40:07 +00:00
Fran Dieguez 9be96c8f5d Update Galician translation 2023-09-21 10:14:55 +00:00
Daniel Mustieles f6488b83cc Updated Spanish translation 2023-09-21 11:33:07 +02:00
Daniel Mustieles 5e17b56135 Updated Spanish translation 2023-09-21 11:32:58 +02:00
Ekaterine Papava 0c3d86865b Update Georgian translation 2023-09-21 03:44:05 +00:00
Emin Tufan Çetin f814b2f636 Update Turkish translation 2023-09-20 23:56:15 +00:00
Anders Jonsson ffdce120e7 Update Swedish translation 2023-09-20 20:58:08 +00:00
Matthias Clasen 5ac7778407 Post-release version bump 2023-09-20 16:29:26 -04:00
Matthias Clasen d6b966ba32 4.12.2 2023-09-20 16:17:25 -04:00
Matthias Clasen 0a72ca9cc1 gtk4-demo: Fix a crash
This conversion of GtkStatusbar was a bit too
quick.

Fixes: #6107
2023-09-19 16:32:27 -04:00
Carlos Garnacho 1f774e2044 gdk/wayland: Use toplevel surface for activation
At the moment of launching/activating an application, the
keyboard focus may be on a transient surface that quickly
disappears after activation. If this happens, and the
compositor handles surface destruction before the activated
application gets to reply, the activation request may be
deemed outdated, and the "demands attention" paths be taken.

Peek the toplevel from the focus surface, as that has larger
guarantees to remain valid for the whole duration of the
operation.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5820
2023-09-19 16:32:27 -04:00
Carlos Garnacho abf22e3edd gtkwindow: Pick a suitable widget to continue the implicit grab
When a widget in the GtkPointerFocus stack becomes insensitive, we've
so far broken the implicit grab entirely. This has the side effect of
breaking accounting of the active state on the widgets that are
ancestors of the widget that became insensitive.

The easiest, and most consistent thing to do (i.e. giving widgets
in the GtkPointerFocus stack certain level of isolation wrt state
changes in other widgets) is to transfer the implicit grab to the
topmost actor of the GtkPointerFocus stack that can keep handling
events.

This fixes the unbalanced accounting of active state on ancestors
of widgets becoming insensitive, and avoids thorny questions about
how to handle implicit active state with broken implicit grabs.
2023-09-19 16:32:27 -04:00
Carlos Garnacho ff0d7443ee gtkwindow: Clear active state on sensitiveness changes
When altering the broken implicit grab due to sensitiveness changes,
also ensure to clear the active state from the affected actors. This
fixes unbalanced implicit active state accounting on the widgets going
insensitive.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5529
2023-09-19 16:32:27 -04:00
Carlos Garnacho 70bf8ca928 gtkmain: Drop redundant code
The common ancestor is already figured out at the beginning of the
function, no need to find it again.
2023-09-19 16:32:27 -04:00
Sergey Bugaev c071c73ce0 text: Respect focus-on-click property
It does make sense to have GtkText not focus on click in some cases,
such as when its editable property is set to false.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-09-19 16:32:27 -04:00
Sergey Bugaev 83112f942c colorbutton, fontbutton: Propagate focus-on-click to inner buttons
These widgets wrap a GtkButton internally. Make it possible to prevent
the inner button from grabbing focus on click by propagating the value
of the focus-on-click property from the widget to the inner button.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-09-19 16:32:27 -04:00
Benjamin Otte 152c09ee86 gsk: Fix clipping error when drawing shadows
When shadows were offset - in particular when offset so the original
source was out of bounds of the result - the drawing code would create a
pattern for it that didn't include enough of it to compose a shadow.

Fix that by not creating those patterns anymore, but instead drawing the
source (potentially multiple times) at the required offsets.

While that does more drawing, it simplifies the shadow node draw code,
and that's the primary goal of the Cairo rendering.

Test included.
2023-09-19 16:32:27 -04:00
Benjamin Otte 521f8a11d8 gl: gradients should transition in unpremultiplied space
So make the gradient shaders do that.
2023-09-19 16:32:27 -04:00
Matthias Clasen 5a8f1a7aa0 inspector: Don't set a NULL fontdesc
The font dialog button does not like that.

Fixes: #5988
2023-09-19 16:32:27 -04:00
Benjamin Otte 122a989009 treeview: No gcc, node is not NULL
... so I'll add an assertion just for you.
2023-09-19 16:32:27 -04:00
Benjamin Otte 4305adf9e0 treemodelfilter: Yes gcc, both if branches are empty
... if assertions are disabled.
2023-09-19 16:32:27 -04:00
Benjamin Otte e711c92196 render-node-tool: Actually load files properly 2023-09-19 16:32:27 -04:00
Benjamin Otte 6f89d258b0 gl: Change rounded_rect_shrink()
The code now follows gsk_rounded_rect_shrink() and with it the behavior
of the Cairo renderer and Webkit.

The old code did what the GL renderer and Cairo do, but I consider that
wrong.

I did not test Chrome.

Test attached
2023-09-19 16:32:27 -04:00
Benjamin Otte 17c3a1ed73 css: Snapshot opacity filter as opacity node
We were using color-matrix because it was easier, but opacity can often
be optimized when color-matrix needs offscreens.
2023-09-19 16:32:27 -04:00
Benjamin Otte a0bd59e76d glrenderer: Shadows without offset do exist
Not for opaque contents, but stuff can be semi-transparent.

Testcase included.
2023-09-19 16:32:27 -04:00
Benjamin Otte 77d5b5e94f rendernode: Shadow nodes need offscreen for opacity
Otherwise the shadow will not be properly computed as opaque regions
become translucent after applying opacity.

Testcase included.
2023-09-19 16:32:27 -04:00
Sergey Bugaev 2873d7e046 switch: Fix CSS nodes documentation
A switch contains two GtkImage's whose nodes are named 'image',
not 'label'.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-09-19 16:32:27 -04:00
Sergey Bugaev 86d2bf746c switch: Respect text direction
In RTL, we want the active state to mean the handle is on the left.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/1489

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-09-19 16:32:27 -04:00
Matthias Clasen ca02190e47 gl renderer: Don't assume an atlas
The source uniform may or may not point
to a glyph atlas. The optimization we do
for color nodes is only possible if it does,
so check this.

Fixes: #6094
2023-09-19 16:32:27 -04:00
Matthias Clasen 09de769304 gl renderer: Keep track of source
We have an optimization that depends on having
the source be a glyph atlas, so keep track of
that information in the render job.
2023-09-19 16:32:27 -04:00
Matthias Clasen 53cb64351d rendernode: Fix handling of color glyphs
The rendernode parser was mixing up its flags.

Test included.

Related: #6075
2023-09-19 16:32:27 -04:00
Luca Bacci 6f0a2bd973 macOS: Fix typos 2023-09-19 16:32:27 -04:00
Michael Catanzaro f6b96186d8 Fix documentation of gdk_display_put_event()
This function is deprecated, but we should still document it properly.
It appends, not prepends. This is clear enough from its implementation,
but also we have practical experience with WebKit in:

https://github.com/WebKit/WebKit/pull/8663

Matthias prefers to avoid the prepend, append, start, and end
terminology altogether.
2023-09-19 16:32:27 -04:00
Jonas Ådahl 5a6074814c wayland: Bind correct xdg_wm_base version
Otherwise we won't get the suspend state.
2023-09-19 16:32:27 -04:00
Michael Catanzaro 56edb0c9fb Fix typo 2023-09-19 16:32:27 -04:00
Benjamin Otte 373d2d2682 rendernode-tool: Fix array size
Also add an assertion, so things explode properly if we forget to
update the array size when adding new nodes, instead of writing random
memory.
2023-09-19 16:32:27 -04:00
Benjamin Otte 552a7dc308 rendernode: Fix Cairo rendering of repeating gradients
Cairo and the GL renderer have a different idea of how to handle
transitioning of colors outside the defined range.

Consider these stops:
  black 50%, white 50%

What color is at 0%?

Cairo would transition between the last and first stop, ie it'd do a
white-to-black transition and end up at rgb(0.5,0.5,0.5) at 0%.
GL would behave as it would for non-repeating gradients and use black
for the range [0%..50%] and white for [50%..100%].
The web would rescale the range so the first stop would be at 0% and
the last stop would be at 100%, so this gradient would be illegal.

Considering that it's possible for code to transition between the
different behaviors by adding explicit stops at 0%/100%, I could choose
any method.
So I chose the simplest one, which is what the GL renderer does and
which treats repeating and non-repeating gradients the same.

Tests attached.
2023-09-19 15:23:24 -04:00
Sergey Bugaev 6ffbaa6bb0 entry, searchentry: Fix measuring baseline
If the entry has icons, we may end up increasing our minimum and natural
height compared to the values the text child returned. In that case, we
should also adjust the baseline values to account for the text being
shifted down.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-09-19 15:20:57 -04:00
Sergey Bugaev 317b64e599 centerlayout: Fix measuring in presence of baselines
The measure logic (unlike the allocation logic) was enforcing strict
baseline alignment of child widgets even if no child widget had valign
set to baseline. This was causing GtkCenterLayout to request more size
than it actually needed.

Instead, bring the logic closer to that of GtkBoxLayout by introducing
explicit have_baseline and align_baseline variables. We track and report
baseline if have_baseline gets set, but it only affects our reported
minimum and natural sizes if align_baseline ends up set, which happens
if there's a child widget that has valign set to either one of the two
baseline values, and itself reports a valid baseline.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-09-19 15:20:47 -04:00
G.Willems b0c1658642 theme: use relative font sizes
This allows text to properly scale when changing the default font size.
2023-09-19 15:20:09 -04:00
Matthias Clasen 0df887014f composetable: Warn for things we can't handle
The compose table stores the keyvals to match against
in a guint16 array, so it can't handle directly encoded
Unicode codepoints (which have a high bit set). Warn
if we encounter those.
2023-09-19 15:19:51 -04:00
Matthias Clasen 8957f9f5a8 composetable: Accept short compose sequences
Followup to 8931169e00. That commit did
not do enough work to actually accept sequences
of lenth 1, as pointed by Mike Fabian.
2023-09-19 15:19:35 -04:00
Mike FABIAN f495f9cf7d Add test case for single char compose sequence 2023-09-19 15:19:27 -04:00
Matthias Clasen f1e09eb692 gsk: Clean up standalone headers
We require folks to include gskglrenderer.h in order
to create a GL renderer. So we be careful to only
include header in gskglrenderer.h that won't trigger
ugly warnings.

See !6363
2023-09-19 15:19:10 -04:00
Michael Orlitzky 2eb6194604 testsuite/gsk: add explicit dimensions to <svg> elements
Without an explicit width, height, and viewBox, there is no single
correct way to render an SVG. In the absense of said information,
librsvg is capable of making a guess by rendering the SVG to a Cairo
surface and then analyzing that surface; however, this process is
merely heuristic.

There are three GTK tests for SVG images that are missing dimensions.
While this is not a violation of the SVG specification, it does
implicitly couple the test to the librsvg rendering heuristic. In this
commit we add that dimension information so that the expected result
is unambiguous.
2023-09-19 15:18:51 -04:00
Sergey Bugaev 6171070153 snapshot, gsktransform: Mention that rotation happens around (0, 0)
...and not around the center of the render node, as one could expect
given that the render node syntax for rotation, transform: rotate(90);,
happens to match the CSS syntax for the same thing, and CSS does rotate
around the center by default.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-09-19 15:16:38 -04:00
Sergey Bugaev 7e931fca41 snapshot: Fix push_repeat () with empty child bounds
The logic would confuse empty child bounds (in which case nothing should
get rendered) with NULL child bounds (in which case the child node's own
bounds should get used). In fact, if the child bounds are empty, we can
discard the descendant render nodes completely, getting a nice little
optimization.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-09-19 15:16:25 -04:00
Matthias Clasen 2117afbbb5 demo: Fix a bug without GL
The gears widget was just not unrealizing properly
when GL is not available. Fix that.

Fixes: #6059
2023-09-19 15:15:53 -04:00
Luca Bacci 7062a374ee GdkWin32: Unref GdkMonitor after calling gdk_monitor_invalidate ()
Ensure that we have a reference when calling gdk_monitor_invalidate ()

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/6080
2023-09-19 18:52:39 +02:00
Nathan Follens d66f590a86 Update Dutch translation 2023-09-19 12:31:33 +00:00
Boyuan Yang 1f00d62610 Update Chinese (China) translation 2023-09-19 01:39:41 +00:00
Boyuan Yang b6458ebe8c Update Chinese (China) translation 2023-09-19 01:35:49 +00:00
Rūdolfs Mazurs 7b6b31f0d8 Update Latvian translation 2023-09-18 13:29:49 +00:00
Martin f0e0332ada Update Slovenian translation 2023-09-16 10:12:05 +00:00
Luca Bacci 41bf17dd45 Merge branch 'macos-gtk-4-12' into 'gtk-4-12'
macOS: Clamp damage region to surface size [GTK 4.12]

See merge request GNOME/gtk!6389
2023-09-13 16:46:41 +00:00
Milo Casagrande a590ee5412 Update Italian translation 2023-09-13 16:28:30 +00:00
Luca Bacci 01ab69659d macOS: Clamp damage region to surface size
...in _gdk_macos_cairo_context_begin_frame ()

GdkMacosCairoContext needs regions that are clamped to the
actual surface size.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5812
2023-09-13 17:39:51 +02:00
Luca Bacci 71116b3e60 Merge branch 'gtk-4-12-ssd' into 'gtk-4-12'
[4.12] win32: Fix minimize and maximize buttons missing on ssd

See merge request GNOME/gtk!6367
2023-09-13 13:37:39 +00:00
Rafael Fontenelle 066b101c57 Update Brazilian Portuguese translation 2023-09-12 16:42:23 +00:00
Daniel Mustieles e36e55c78b Updated Spanish translation 2023-09-11 10:49:42 +02:00
Andika Triwidada 5677c6b932 Update Indonesian translation 2023-09-09 15:06:05 +00:00
Changwoo Ryu 1abfeff0d1 Update Korean translation 2023-09-07 16:59:43 +00:00
Daniel Rusek c781acb084 Update Czech translation 2023-09-07 13:38:39 +00:00
Balázs Úr 93f7fe39e5 Update Hungarian translation 2023-09-05 19:13:36 +00:00
Fran Dieguez db6b68a0f3 Update Galician translation 2023-09-03 18:57:27 +00:00
Aurimas Černius 5d54bb1359 Update Lithuanian translation 2023-09-03 18:20:12 +00:00
Ask Hjorth Larsen cc4d94d197 Update Danish translation 2023-09-03 14:33:55 +00:00
Philipp Kiemle 222ef97d3a Update German translation 2023-09-01 22:19:17 +00:00
dgsasha 03f6684dc3 win32: Fix minimize and maximize buttons missing on ssd
Completely fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5142
2023-08-30 13:53:49 +03:00
Matthias Clasen e001b421ad Merge branch 'zbrown/tooltips' into 'gtk-4-12'
tooltip: don't cross native boundaries (cherry-pick to 4.12)

See merge request GNOME/gtk!6360
2023-08-29 01:59:16 +00:00
Zander Brown 1145504075 tooltip: don't cross native boundaries
When walking the tree looking for tooltips we shouldn't cross from, say,
a popover to it's parent window

Fix: https://gitlab.gnome.org/GNOME/gtk/-/issues/1234
Fix: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/1038
Fix: https://gitlab.gnome.org/GNOME/gtk/-/issues/5998
Fix: https://gitlab.gnome.org/GNOME/nautilus/-/issues/3063
See: https://gitlab.gnome.org/GNOME/console/-/issues/318
See: https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/6346
2023-08-29 01:48:26 +01:00
Asier Sarasua Garmendia 065769eb42 Update Basque translation 2023-08-28 14:49:08 +00:00
Daniel Mustieles 8de2a8f40a Update Spanish translation 2023-08-28 10:24:46 +00:00
Fran Dieguez 7cf377ee61 Update Galician translation 2023-08-27 19:47:33 +00:00
Jiri Grönroos dbf2432114 Update Finnish translation 2023-08-27 14:42:06 +00:00
Sabri Ünal 54bee945c6 Update Turkish translation 2023-08-26 18:32:59 +00:00
Jordi Mas 05bf962b20 Update Catalan translation 2023-08-26 09:48:16 +02:00
Matthias Clasen 1d4ab0681f Post-release version bump 2023-08-25 22:30:12 -04:00
Baurzhan Muftakhidinov d1c634586a Update Kazakh translation 2023-08-25 15:53:58 +00:00
Matthias Clasen b51a3980f3 4.12.1 2023-08-25 09:18:10 -04:00
Anders Jonsson 77adacae8d Update Swedish translation 2023-08-24 15:38:43 +00:00
Matthias Clasen e6ad258b06 Updates 2023-08-24 10:52:35 -04:00
Piotr Drąg b9c88bd6c0 Update Polish translation 2023-08-24 16:47:45 +02:00
Matthias Clasen 8f1a2820b7 Revert "PopoverMenu: Make :flags a property for use in UI…"
This reverts commit acd874ec55.

This adds new API, therefore not suitable for 4.12.
2023-08-24 10:39:04 -04:00
Matthias Clasen beb5ede18a menubutton: Don't assume the root is a window
The only thing this assumption does is cause
criticals, so remove it.

Fixes: #6055
2023-08-24 10:28:05 -04:00
Michael Catanzaro 2e2857df32 notebook: fix critical when switching page
It's expected that gtk_widget_get_root() will return NULL if the widget
tree does not contain a root widget. I don't know what that means or why
it happens, but it's true in gnome-control-center's network panel when
displaying the OpenVPN configuration dialog. We need to handle it.

Fixes #6056
2023-08-24 10:27:44 -04:00
Simon McVittie 8a4bde62da tests: Accept slightly different numeric results
FLT_EPSILON is the distance between 1.0 and the next distinct floating
point number, and doesn't necessarily have anything to do with the
precision we can expect from a series of floating-point calculations.
Experimentally, 1e-6 is achievable, even on platforms with unusual
floating point implementations like i387.

Resolves: https://gitlab.gnome.org/GNOME/gtk/-/issues/6051
Bug-Debian: https://bugs.debian.org/1050076
Signed-off-by: Simon McVittie <smcv@debian.org>
2023-08-24 10:27:18 -04:00
Matthias Clasen ff56029ccc wayland: Don't assume the shell protocol
The gtk_shell proxy will be NULL if the compositor
is not gnome-shell. Handle that without crashing.

Fixes: #6048
2023-08-24 10:27:02 -04:00
Bilal Elmoussaoui 0f67d61379 gi: Fix missing namespace 2023-08-24 10:26:40 -04:00
Georges Basile Stavracas Neto 8605a073ea ci: Limit parallel linking on Windows CI
Linking on Windows can easily run out of memory, and limiting it
to a single link operation (i.e. disabling parallelization) should
be enough to avoid this problem.
2023-08-24 10:26:23 -04:00
Khalid Abu Shawarib c6302477c0 gdk/x11/clipboard: Fix Slist leak 2023-08-24 10:26:16 -04:00
Benjamin Otte 6cabd44a2b build: Add -Woverride-init
That's a gcc warning (clang has the equivalent -Winitializer-overrides,
but that one is included in -Wall) that complains about things like:

  VkOffset3D offset = { .x = pt.x, .x = pt.y, .y = 0 };

So you don't have to spend a few hours trying to understand what's going
on before realizing your copy/paste skills are substandard.
2023-08-24 10:25:59 -04:00
Benjamin Otte 012388da32 build: GSK doesn't depend on gdk-pixbuf 2023-08-24 10:25:36 -04:00
Benjamin Otte 004f061dca build: Don't use configure_file() when custom_target() works
These two files don't need to be built when configuring, they are only
needed during build.
2023-08-24 10:25:23 -04:00
Benjamin Otte cf644739e4 widget: Remove unused headers from gtkwidget.h
... and put them back in places where they are needed.
2023-08-24 10:25:15 -04:00
Sergey Bugaev cb89b3a9e7 paintable: Implement gdk_paintable_default_get_current_image ()
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-08-24 10:24:50 -04:00
G.Willems c018af3023 gtktexthistory: restore 'modified' flag on redo
When redoing a history entry, its `is_modified` flag is not
reflected to the history state tracker. So GtkTextBuffers may
expose a modified=FALSE status, despite a change was actually
applied to the buffer.

For the undo case, an `is_modified_set` flag was set on the last
entry of the undo queue when a change of the modified state of
the history is requested. This commit does the same on the first
entry of the redo queue.

Closes #5777
2023-08-24 10:24:41 -04:00
Daniel Boles acd874ec55 PopoverMenu: Make :flags a property for use in UI…
…files, or other cases other than calling new_from_model_full(), which
generally makes it far easier to experiment with the effect of flags,
including by changing the value of the property in the Inspector.

fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/6030#note_1818229
2023-08-24 10:24:28 -04:00
Daniel Boles 70733d60f6 Popover: Fix & add to CSS nodes documentation
* The `.background` class gets put on `popover`, not `content`
* Use backticks to style node and class names with monospace
* Link to GtkPopoverMenu
* Add to PopoverMenu a bit outlining how items and sections look in CSS.
2023-08-24 10:24:06 -04:00
Matthias Clasen e3d18ad7a1 build: Drop some unused variables
We are not using gtk_private_packages at all,
so drop it.
2023-08-24 10:23:54 -04:00
Alexandros Theodotou 3a55f750bc gsk: Update docs for gtk_snapshot_append_layout
Mention how to get the current theme's foreground color.
2023-08-24 10:23:31 -04:00
Sergey Bugaev e069a8053f rendernode, snapshot: Slightly expand color matrix docs
Based on reverse engineering the color node and contrary to my
expectations, the matrix/offset is expressed in, and applied to,
unpremultiplied colors. The colors are being explicitly
unpremultiplied, transformed according to the matrix/offset, and
premultiplied back (see color_matrix.glsl). The matrix is getting
transposed.

Also, copy the same blurb to the corresponding GtkSnapshot function.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-08-24 10:23:23 -04:00
Sergey Bugaev 582d368653 snapshot: Fix merging color matrix nodes
The code was appliying the matrices in the wrong order: we have to apply
the inner node's matrix first, and the outer one second. Due to the
matrices being implicitly transposed, the matrix multiplication was done
in the right order, yet the wrong matrix was being mutliplied by the
wrong offset vector.

To make the code a little easier to follow, create explicit variables
for the resulting matrix and offset (instead of reusing matrix2 and
offset2), and fix & expand the comment to document how matrix
transposition factors into this.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-08-24 10:23:13 -04:00
Philip Chimento 294bc262cd introspection: Remove 'caller-allocates' from POD types
The (out caller-allocates) and (out callee-allocates) annotations are
meant for structured or pointer types. Plain old data types are just
regular out parameters and don't need the annotation about who allocates
them.

See glib!2005, gjs#570
2023-08-24 10:22:56 -04:00
Xavier Claessens 494b25388a meson: Add x11_dep to gtk4-x11 requires 2023-08-24 10:22:33 -04:00
Xavier Claessens f87426f7eb meson: Add wayland-client to gtk4-wayland requires 2023-08-24 10:22:21 -04:00
Daniel Boles 1be06ea339 SignalListItemFactory: small doc grammar+sense fix
* "to to" => "to"
* "a object" => "an object"
* "its new prop is about to be unset" => "its prop is about to be unset"
2023-08-24 10:22:07 -04:00
Alice Mikhaylenko 05f39307b2 menubutton: Fix focus on the internal gizmo
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/6025
2023-08-24 10:21:21 -04:00
Daniel Boles 0a50e1e663 Inspector: Fix ! flash on select widget @ obj tree
Widgets are flashed by the window when it receives Tree::object-selected
- but we were emitting said signal from select_object(), i.e. if we were
made to select by an external caller. We should also emit it if the user
interactively selects an item, so the window receives+flashes the widget

fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/6022
2023-08-24 10:21:11 -04:00
Joshua Lee 0270c9e5a9 fontdialogbutton: Make activatable 2023-08-24 10:20:59 -04:00
Joshua Lee c2c92b8335 colordialogbutton: Make activatable 2023-08-24 10:20:53 -04:00
Matthias Clasen 6acb8c4e9c text: Track user changes better
Make all the action signal handlers call
begin/end_change(), so we can rely on
change_count being >0 to check later if
an action is user-initiated or programmatic.

Fixes: #6018
2023-08-24 10:20:39 -04:00
Benjamin Otte 84204a0215 gl: Pass swizzle array directly
There's no need to pass pointers to arrays, as arrays are already
pointers.
2023-08-24 10:20:03 -04:00
Benjamin Otte db545439c0 columnview: Fix refcounting woes
The new code did not deal with the GtkScrollInfo properly.

Related: #6002
2023-08-24 10:19:49 -04:00
Benjamin Otte 5f02d8fac5 gdkcontext: Make has_unpack_subimage() do the version check
Makes the code look simpler when we actually use that function.
2023-08-24 10:19:41 -04:00
Benjamin Otte 7dba2a021e treeviewcolumn: Set ascending class for ascending order
The alternative button order confused the code and so the "ascending"
class was set for descending order by default, not when alternate order
is set.
2023-08-24 10:19:23 -04:00
Qiu Wenbo 1394a82507 macos: use NSPopUpButton for filter selection in native filechooser
On macOS 14, NSComboBox can't popup the dropdown list of filters. That
makes native filechooser on macOS completed broken. And NSComboBox is
more complex since it is a widget focused on edit capability.
NSPopUpButton is more suitable for plain selectable dropdown list.

Fixes: 4986

Signed-off-by: Qiu Wenbo <qiuwenbo@kylinos.com.cn>
2023-08-24 10:19:04 -04:00
Qiu Wenbo 0997d39a06 filefilter: fix UTI type conversion on macOS
GContentType on macOS switched to UTI since glib 2.51. We should not assume it as MIME type anymore.

Fixes: #4986

Signed-off-by: Qiu Wenbo <qiuwenbo@kylinos.com.cn>
2023-08-24 10:18:55 -04:00
Daniel Boles efb3477dc9 docs: Add/fix some links; avoid pluralisation
Appending `s` breaks the [type@NS.Object] notation, so fix that in
ListHeader. Add links to ListItem and Overlay, and avoid appending `s`
after `backtick`s just for consistency with the [type@NS.Object] issue.
2023-08-24 10:18:28 -04:00
Jeremy Bícha 23f055f7b0 print: Update printerprivate header location for cpdb backend
This fixes the print-cpdb build option
2023-08-24 10:18:10 -04:00
Jeremy Bícha 4d99dbc48d test-calendar: Update timezone name
Debian no longer provides the MET timezone
but instead provides geographical region and city name
2023-08-24 10:18:00 -04:00
Xi Ruoyao 6b8e098f34 print: Revert "Start sorting apart includes" change for gtkprinteroptionprivate.h
The print backends needs the functions in gtkprinteroptionprivate.h to
be exported.

Fixes #6003.
2023-08-24 10:17:32 -04:00
tszymanski 5844ed5b12 gtkgridview: return empty area for empty tiles during scroll 2023-08-24 10:16:48 -04:00
Hari Rana 44ef8db93a section-accessibility: Close tag 2023-08-24 10:16:32 -04:00
Matthias Clasen 9e4f2b16e0 Post-release version bump 2023-08-24 10:14:29 -04:00
260 changed files with 53126 additions and 45104 deletions
+35 -11
View File
@@ -30,8 +30,16 @@ variables:
workflow:
rules:
- if: $CI_COMMIT_TAG
# run merge request pipelines
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
# do not run branch pipelines if corresponding merge requests exist...
# (this avoids duplicate pipelines)
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
when: never
# ...but otherwise run branch pipelines
- if: $CI_COMMIT_BRANCH
# run tag pipelines
- if: $CI_COMMIT_TAG
default:
retry:
@@ -197,28 +205,44 @@ msys2-mingw64:
paths:
- "${CI_PROJECT_DIR}/_build/gtkdll.tar.gz"
macos:
# Sadly, this fails regularly, and its failure is never enlightening
allow_failure: true
macos-x86_64:
rules:
# Do not run in forks as the runner is not available there.
- if: $CI_PROJECT_NAMESPACE == "GNOME"
stage: build
tags:
- macos
- macosintel
needs: []
variables:
MESON_FORCE_BACKTRACKE: 1
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
- pip3 install --user meson~=1.0
- pip3 install --user ninja
- export PATH=/Users/gitlabrunner/Library/Python/3.7/bin:$PATH
- export MESON_FORCE_BACKTRACE=1
- /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
- 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
script:
- meson setup ${COMMON_MESON_FLAGS}
- meson setup
${COMMON_MESON_FLAGS}
${EXTRA_MESON_FLAGS}
-Dx11-backend=false
-Dbroadway-backend=true
-Dmacos-backend=true
-Dmedia-gstreamer=disabled
-Dintrospection=disabled
-Dintrospection=enabled
-Dcpp_std=c++11
-Dpixman:tests=disabled
-Dlibjpeg-turbo:simd=disabled
+1 -1
View File
@@ -6,7 +6,7 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliar
:: FIXME: make warnings fatal
pip3 install --upgrade --user meson~=0.64 || goto :error
meson -Ddebug=false -Dmedia-gstreamer=disabled _build || goto :error
meson setup -Dbackend_max_links=1 -Ddebug=false -Dmedia-gstreamer=disabled _build || goto :error
ninja -C _build || goto :error
goto :EOF
+1 -1
View File
@@ -214,7 +214,7 @@ Closes #1234
`git commit -a --author "Joe Coder <joe@coder.org>"` and `--signoff`.
- If your commit is addressing an issue, use the
[GitLab syntax](https://docs.gitlab.com/ce/user/project/issues/automatic_issue_closing.html)
[GitLab syntax](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
to automatically close the issue when merging the commit with the upstream
repository:
+215
View File
@@ -1,3 +1,218 @@
Overview of Changes in 4.12.6, xx-xx-xxxx
=========================================
Overview of Changes in 4.12.5, 17-01-2024
=========================================
* GtkColumnView:
- Fix a crash on dispose
* GtkEmojiChooser:
- Update to CLDR v44
- Add more translations
* GtkFileDialog:
- Return an error if no file is selected
- Make closing the portal file chooser work
* GtkDropDown:
- Fix display of the initial checkmark
* GtkShortcutsWindow:
- Reduce the minimum width
* GDK:
- Make the png loader safer against overflow
* Windows:
- Use new clipboard api
* Wayland:
- Fix cursor handling with graphics tablets
* macOS:
- Silence secure-restore message
- Fix build on macOS < 10.13
* Translation updates
Basque
British English
Catalan
Chinese (China)
Czech
Georgian
German
Hebrew
Indonesian
Lithuanian
Persian
Polish
Romanian
Russian
Slovenian
Swedish
Turkish
Ukrainian
Vietnamese
Overview of Changes in 4.12.4, 17-11-2023
=========================================
* a11y:
- Tweak name computation for some corner cases
* gdk:
- gl: Improve our use of GLES a bit (use vertex arrays and
GL_BGRA if available)
- Fix some errors in our memory format tables
* gsk:
- gl: handle texture-scale nodes more faithfully
- gl: Fix icon padding in the atlas
* Windows:
- Stop relying on glib for build configuration
* Tools:
- Add a --undecorated option to gtk4-rendernode-tool
* Translation updates
Catalan
French
Romanian
Russian
Spanish
Turkish
Overview of Changes in 4.12.3, 28-09-2023
=========================================
* GtkWindow:
- Don't assume titlebars are GtkHeaderBar
* GtkTreeView:
- Fix a crash in gtk_tree_view_is_blank_at_pos
* printing:
- Fix some issues with the portal implementation
* GSK:
- Some optimizations in the GL renderer
- Fix memory leaks in the Broadway renderer
* demos:
- Fix a crash in gtk4-demo
* Translation updates
Basque
Brazilian Portuguese
Czech
Galician
Georgian
German
Hungarian
Kazakh
Lithuanian
Persian
Polish
Spanish
Swedish
Turkish
Overview of Changes in 4.12.2, 20-09-2023
=========================================
* GtkTooltip:
- Don't cross native boundaries when looking for tooltips
* GtkCenterLayout, GtkEntry, GtkSearchEntry:
- Fix some issues with baseline handling
* GtkSwitch:
- Respect text direction
* Theme:
- Use relative font sizes
* GSK:
- Make repeated gradients match between GL and cairo
- Make rounded rect shrinking match between Vulkan, GL and cairo
- Fix parsing of text nodes with color glyphs
- Restrict an optimization to the cases where it is correct
- Fix rendering of shadows with opacity
* macOS:
- Clamp damage regions to the surface size
* Windows:
- Fix missing minimize and maximize buttons
* Translation updates
Basque
Brazilian Portuguese
Catalan
Chinese (China)
Czech
Danish
Dutch
Finnish
Galician
German
Hungarian
Italian
Kazakh
Latvian
Lithuanian
Slovenian
Spanish
Turkish
Overview of Changes in 4.12.1, 25-08-2023
=========================================
* GtkGridView:
- Fix a crash when scrolling
* GtkColumnView:
- Fix a refcounting issue in the new scroll_to api
* GtkTreeView
- Fix style classes for sort arrows
* GtkEntry:
- Improve tracking of user changes (for undo)
* GtkNotebook:
- Fix a critical when switching pages
* GtkColor/FontDialogButton:
- Make these widgets activatable
* GtkMenuButton:
- Fix problems with focus handling
- Fix problems with DND
* Printing
- Fix the cpdb backend build
* MacOS:
- Make file filters work again
* GSK:
- Fix issues with color matrix nodes
* Wayland:
- Fix a crash with compositors other than gnome-shell
* Translation updates:
Polish
Swedish
Overview of Changes in 4.12.0, 05-08-2023
=========================================
+41
View File
@@ -0,0 +1,41 @@
#ifndef _MSC_VER
#pragma error "This header is for Microsoft VC or clang-cl only."
#endif /* _MSC_VER */
/* Make MSVC more pedantic, this is a recommended pragma list
* from _Win32_Programming_ by Rector and Newcomer.
*/
#ifndef __clang__
#pragma warning(error:4002) /* too many actual parameters for macro */
#pragma warning(error:4003) /* not enough actual parameters for macro */
#pragma warning(1:4010) /* single-line comment contains line-continuation character */
#pragma warning(error:4013) /* 'function' undefined; assuming extern returning int */
#pragma warning(1:4016) /* no function return type; using int as default */
#pragma warning(error:4020) /* too many actual parameters */
#pragma warning(error:4021) /* too few actual parameters */
#pragma warning(error:4027) /* function declared without formal parameter list */
#pragma warning(error:4029) /* declared formal parameter list different from definition */
#pragma warning(error:4033) /* 'function' must return a value */
#pragma warning(error:4035) /* 'function' : no return value */
#pragma warning(error:4045) /* array bounds overflow */
#pragma warning(error:4047) /* different levels of indirection */
#pragma warning(error:4049) /* terminating line number emission */
#pragma warning(error:4053) /* An expression of type void was used as an operand */
#pragma warning(error:4071) /* no function prototype given */
#pragma warning(disable:4101) /* unreferenced local variable */
#pragma warning(error:4150)
/* G_NORETURN */
#pragma warning(error:4646) /* function declared with __declspec(noreturn) has non-void return type */
#pragma warning(error:4715) /* 'function': not all control paths return a value */
#pragma warning(error:4098) /* 'void' function returning a value */
#pragma warning(disable:4244) /* No possible loss of data warnings */
#pragma warning(disable:4305) /* No truncation from int to char warnings */
#pragma warning(error:4819) /* The file contains a character that cannot be represented in the current code page */
#endif /* __clang__ */
/* work around Microsoft's premature attempt to deprecate the C-Library */
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_NONSTDC_NO_WARNINGS
+3 -3
View File
@@ -35,7 +35,7 @@ show_action_dialog (GSimpleAction *action)
{
GtkAlertDialog *dialog;
dialog = gtk_alert_dialog_new ("You activated action: \"%s\n",
dialog = gtk_alert_dialog_new ("You activated action: \"%s\"",
g_action_get_name (G_ACTION (action)));
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
@@ -223,7 +223,7 @@ delete_messages (gpointer data)
static void
pop_message (GtkWidget *status)
{
GList *messages = (GList *) g_object_get_data (G_OBJECT (status), "messages");
GList *messages = (GList *) g_object_steal_data (G_OBJECT (status), "messages");
if (messages)
{
@@ -241,7 +241,7 @@ static void
push_message (GtkWidget *status,
const char *message)
{
GList *messages = (GList *) g_object_get_data (G_OBJECT (status), "messages");
GList *messages = (GList *) g_object_steal_data (G_OBJECT (status), "messages");
gtk_label_set_label (GTK_LABEL (status), message);
messages = g_list_prepend (messages, g_strdup (message));
+1 -8
View File
@@ -71,14 +71,7 @@ create_blurred_button (void)
static GtkWidget *
create_font_button (void)
{
GtkFontDialog *dialog;
GtkWidget *button;
dialog = gtk_font_dialog_new ();
button = gtk_font_dialog_button_new (dialog);
g_object_unref (dialog);
return button;
return gtk_font_dialog_button_new (gtk_font_dialog_new ());
}
static GtkWidget *
+14 -14
View File
@@ -840,24 +840,24 @@ gtk_gears_unrealize (GtkWidget *widget)
GtkGearsPrivate *priv = gtk_gears_get_instance_private ((GtkGears *) widget);
gtk_gl_area_make_current (glarea);
if (gtk_gl_area_get_error (glarea) != NULL)
return;
if (gtk_gl_area_get_error (glarea) == NULL)
{
/* Release the resources associated with OpenGL */
if (priv->gear_vbo[0] != 0)
glDeleteBuffers (1, &(priv->gear_vbo[0]));
/* Release the resources associated with OpenGL */
if (priv->gear_vbo[0] != 0)
glDeleteBuffers (1, &(priv->gear_vbo[0]));
if (priv->gear_vbo[1] != 0)
glDeleteBuffers (1, &(priv->gear_vbo[1]));
if (priv->gear_vbo[1] != 0)
glDeleteBuffers (1, &(priv->gear_vbo[1]));
if (priv->gear_vbo[2] != 0)
glDeleteBuffers (1, &(priv->gear_vbo[2]));
if (priv->gear_vbo[2] != 0)
glDeleteBuffers (1, &(priv->gear_vbo[2]));
if (priv->vao != 0)
glDeleteVertexArrays (1, &priv->vao);
if (priv->vao != 0)
glDeleteVertexArrays (1, &priv->vao);
if (priv->program != 0)
glDeleteProgram (priv->program);
if (priv->program != 0)
glDeleteProgram (priv->program);
}
priv->ModelViewProjectionMatrix_location = 0;
priv->NormalMatrix_location = 0;
Binary file not shown.

Before

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 127 B

@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><path d="M3.384 3h3.231c.213 0 .385.224.385.502v2.996C7 6.776 6.828 7 6.615 7h-3.23C3.17 7 3 6.776 3 6.498V3.502C3 3.224 3.17 3 3.384 3zm6 0h3.231c.213 0 .385.224.385.502v2.996c0 .278-.172.502-.385.502h-3.23C9.17 7 9 6.776 9 6.498V3.502C9 3.224 9.17 3 9.384 3zm-6 6h3.231c.213 0 .385.224.385.502v2.996c0 .278-.172.502-.385.502h-3.23C3.17 13 3 12.776 3 12.498V9.502C3 9.224 3.17 9 3.384 9zm6 0h3.231c.213 0 .385.224.385.502v2.996c0 .278-.172.502-.385.502h-3.23C9.17 13 9 12.776 9 12.498V9.502C9 9.224 9.17 9 9.384 9z" style="marker:none" overflow="visible" color="#000" fill="#474747"/></svg>

Before

Width:  |  Height:  |  Size: 654 B

@@ -25,14 +25,12 @@
<file>icons/16x16/actions/format-justify-fill-symbolic.symbolic.png</file>
<file>icons/16x16/actions/format-justify-left-symbolic.symbolic.png</file>
<file>icons/16x16/actions/format-justify-right-symbolic.symbolic.png</file>
<file>icons/16x16/actions/insert-image.png</file>
<file>icons/16x16/actions/insert-link-symbolic.symbolic.png</file>
<file>icons/16x16/actions/send-to-symbolic.symbolic.png</file>
<file>icons/16x16/actions/star-new-symbolic.symbolic.png</file>
<file>icons/16x16/actions/view-continuous-symbolic.symbolic.png</file>
<file>icons/16x16/actions/view-dual-symbolic.symbolic.png</file>
<file>icons/16x16/actions/view-fullscreen-symbolic.symbolic.png</file>
<file>icons/16x16/actions/view-grid-symbolic.symbolic.png</file>
<file>icons/16x16/actions/view-paged-symbolic.symbolic.png</file>
<file>icons/16x16/actions/zoom-in-symbolic.symbolic.png</file>
<file>icons/16x16/actions/zoom-in.png</file>
@@ -88,7 +86,6 @@
<file>icons/scalable/actions/view-dual-symbolic.svg</file>
<file>icons/scalable/actions/view-paged-symbolic.svg</file>
<file>icons/scalable/actions/view-fullscreen-symbolic.svg</file>
<file>icons/scalable/actions/view-grid-symbolic.svg</file>
<file>icons/scalable/actions/zoom-in-symbolic.svg</file>
<file>icons/scalable/actions/zoom-original-symbolic.svg</file>
<file>icons/scalable/actions/zoom-out-symbolic.svg</file>
+5 -6
View File
@@ -41,7 +41,7 @@ activate (GtkApplication* app,
window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Window");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
}
int
@@ -183,7 +183,7 @@ activate (GtkApplication *app,
gtk_box_append (GTK_BOX (box), button);
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
}
int
@@ -331,8 +331,7 @@ activate (GtkApplication *app,
*/
gtk_grid_attach (GTK_GRID (grid), button, 0, 1, 2, 1);
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
}
int
@@ -554,7 +553,7 @@ activate (GtkApplication *app,
g_signal_connect (press, "pressed", G_CALLBACK (pressed), drawing_area);
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
}
int
@@ -631,7 +630,7 @@ activate (GtkApplication *app,
button = gtk_builder_get_object (builder, "quit");
g_signal_connect_swapped (button, "clicked", G_CALLBACK (quit_cb), window);
gtk_widget_show (GTK_WIDGET (window));
gtk_widget_set_visible (GTK_WIDGET (window), TRUE);
/* We do not need the builder any more */
g_object_unref (builder);
@@ -35,6 +35,11 @@ Showing
The ``show`` command displays the rendernode.
``--undecorated``
Removes window decorations. This is meant for rendering of exactly the rendernode
without any titlebar.
Rendering
^^^^^^^^^
+1 -1
View File
@@ -49,7 +49,7 @@ main (int argc, char **argv)
// ...
// Show the application window
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
// Enter the main event loop, and wait for user interaction
while (!done)
+1 -1
View File
@@ -222,7 +222,7 @@ It is possible to set accessible attributes in UI files as well:
<accessibility>
<property name="label">Download</property>
<relation name="labelled-by">label1</relation>
/accessibility>
</accessibility>
</object>
```
+1 -1
View File
@@ -263,7 +263,7 @@ gdk_parse_debug_var (const char *variable,
if (debug_enabled || keys[i].always_enabled)
fprintf (stderr, " %s%*s%s\n", keys[i].key, (int)(max_width - strlen (keys[i].key)), " ", keys[i].help);
}
fprintf (stderr, " %s%*s%s\n", "all", max_width - 3, " ", "Enable all values");
fprintf (stderr, " %s%*s%s\n", "all", max_width - 3, " ", "Enable all values. Other given values are subtracted");
fprintf (stderr, " %s%*s%s\n", "help", max_width - 4, " ", "Print this help");
fprintf (stderr, "\nMultiple values can be given, separated by : or space.\n");
}
+3 -1
View File
@@ -151,7 +151,7 @@ gdk_array(reserve) (GdkArray *self,
return;
size = gdk_array(get_size) (self);
new_size = 1 << g_bit_storage (MAX (GDK_ARRAY_REAL_SIZE (n), 16) - 1);
new_size = ((gsize) 1) << g_bit_storage (MAX (GDK_ARRAY_REAL_SIZE (n), 16) - 1);
#ifdef GDK_ARRAY_PREALLOC
if (self->start == self->preallocated)
@@ -286,3 +286,5 @@ gdk_array(get) (const GdkArray *self,
#undef GDK_ARRAY_TYPE_NAME
#undef GDK_ARRAY_NO_MEMSET
#endif
G_END_DECLS
+3 -2
View File
@@ -529,8 +529,9 @@ gdk_clipboard_get_content (GdkClipboard *clipboard)
* exit. Depending on the platform, the functionality may not be available
* unless a "clipboard manager" is running.
*
* This function is called automatically when a [class@Gtk.Application] is
* shut down, so you likely don't need to call it.
* This function is called automatically when a
* [GtkApplication](../gtk4/class.Application.html)
* is shut down, so you likely don't need to call it.
*/
void
gdk_clipboard_store_async (GdkClipboard *clipboard,
+2 -1
View File
@@ -47,7 +47,8 @@
* Cursors by themselves are not very interesting: they must be bound to a
* window for users to see them. This is done with [method@Gdk.Surface.set_cursor]
* or [method@Gdk.Surface.set_device_cursor]. Applications will typically
* use higher-level GTK functions such as [method@Gtk.Widget.set_cursor] instead.
* use higher-level GTK functions such as [gtk_widget_set_cursor()](../gtk4/method.Widget.set_cursor.html)
* instead.
*
* Cursors are not bound to a given [class@Gdk.Display], so they can be shared.
* However, the appearance of cursors may vary when used on different
+3 -4
View File
@@ -473,8 +473,7 @@ gdk_display_get_event (GdkDisplay *display)
* @display: a `GdkDisplay`
* @event: (transfer none): a `GdkEvent`
*
* Appends the given event onto the front of the event
* queue for @display.
* Adds the given event to the event queue for @display.
*
* Deprecated: 4.10: This function is only useful in very
* special situations and should not be used by applications.
@@ -1149,9 +1148,9 @@ _gdk_display_get_next_serial (GdkDisplay *display)
* Indicates to the GUI environment that the application has
* finished loading, using a given identifier.
*
* GTK will call this function automatically for [class@Gtk.Window]
* GTK will call this function automatically for [GtkWindow](../gtk4/class.Window.html)
* with custom startup-notification identifier unless
* [method@Gtk.Window.set_auto_startup_notification]
* [gtk_window_set_auto_startup_notification()](../gtk4/method.Window.set_auto_startup_notification.html)
* is called to disable that feature.
*
* Deprecated: 4.10: Using [method@Gdk.Toplevel.set_startup_id] is sufficient
+2 -2
View File
@@ -298,8 +298,8 @@ gdk_draw_context_get_surface (GdkDrawContext *context)
*
* When using GTK, the widget system automatically places calls to
* gdk_draw_context_begin_frame() and gdk_draw_context_end_frame() via the
* use of [class@Gsk.Renderer]s, so application code does not need to call
* these functions explicitly.
* use of [GskRenderer](../gsk4/class.Renderer.html)s, so application code
* does not need to call these functions explicitly.
*/
void
gdk_draw_context_begin_frame (GdkDrawContext *context,
+4 -2
View File
@@ -166,7 +166,8 @@ gdk_frame_clock_class_init (GdkFrameClockClass *klass)
*
* Animations should be updated using [method@Gdk.FrameClock.get_frame_time].
* Applications can connect directly to this signal, or use
* [method@Gtk.Widget.add_tick_callback] as a more convenient interface.
* [gtk_widget_add_tick_callback()](../gtk4/method.Widget.add_tick_callback.html)
* as a more convenient interface.
*/
signals[UPDATE] =
g_signal_new (g_intern_static_string ("update"),
@@ -203,7 +204,8 @@ gdk_frame_clock_class_init (GdkFrameClockClass *klass)
*
* The frame is repainted. GDK normally handles this internally and
* emits [signal@Gdk.Surface::render] signals which are turned into
* [signal@Gtk.Widget::snapshot] signals by GTK.
* [GtkWidget::snapshot](../gtk4/signal.Widget.snapshot.html) signals
* by GTK.
*/
signals[PAINT] =
g_signal_new (g_intern_static_string ("paint"),
+39 -3
View File
@@ -109,6 +109,7 @@ typedef struct {
guint has_sync : 1;
guint has_unpack_subimage : 1;
guint has_debug_output : 1;
guint has_bgra : 1;
guint extensions_checked : 1;
guint debug_enabled : 1;
guint forward_compatible : 1;
@@ -1528,13 +1529,16 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
if (gdk_gl_context_get_use_es (context))
{
priv->has_unpack_subimage = epoxy_has_gl_extension ("GL_EXT_unpack_subimage");
priv->has_unpack_subimage = gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)) ||
epoxy_has_gl_extension ("GL_EXT_unpack_subimage");
priv->has_khr_debug = epoxy_has_gl_extension ("GL_KHR_debug");
priv->has_bgra = epoxy_has_gl_extension ("GL_EXT_texture_format_BGRA8888");
}
else
{
priv->has_unpack_subimage = TRUE;
priv->has_khr_debug = epoxy_has_gl_extension ("GL_KHR_debug");
priv->has_bgra = TRUE;
/* We asked for a core profile, but we didn't get one, so we're in legacy mode */
if (!gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 2)))
@@ -1566,7 +1570,8 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
" - GL_KHR_debug: %s\n"
" - GL_EXT_unpack_subimage: %s\n"
" - half float: %s\n"
" - sync: %s",
" - sync: %s\n"
" - bgra: %s",
gdk_gl_context_get_use_es (context) ? "OpenGL ES" : "OpenGL",
gdk_gl_version_get_major (&priv->gl_version), gdk_gl_version_get_minor (&priv->gl_version),
priv->is_legacy ? "legacy" : "core",
@@ -1575,7 +1580,8 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
priv->has_khr_debug ? "yes" : "no",
priv->has_unpack_subimage ? "yes" : "no",
priv->has_half_float ? "yes" : "no",
priv->has_sync ? "yes" : "no");
priv->has_sync ? "yes" : "no",
priv->has_bgra ? "yes" : "no");
}
#endif
@@ -1811,6 +1817,36 @@ 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
*/
gboolean
gdk_gl_context_has_vertex_arrays (GdkGLContext *self)
{
GdkGLContextPrivate *priv = gdk_gl_context_get_instance_private (self);
switch (priv->api)
{
case GDK_GL_API_GL:
return TRUE;
case GDK_GL_API_GLES:
return gdk_gl_version_get_major (&priv->gl_version) >= 3;
default:
g_return_val_if_reached (FALSE);
}
}
/* This is currently private! */
/* When using GL/ES, don't flip the 'R' and 'B' bits on Windows/ANGLE for glReadPixels() */
gboolean
+4
View File
@@ -155,6 +155,10 @@ 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);
G_END_DECLS
+2 -2
View File
@@ -153,7 +153,7 @@ gdk_gl_texture_find_format (gboolean use_es,
if (gdk_memory_format_alpha (format) != alpha)
continue;
if (!gdk_memory_format_gl_format (format, use_es, gl_major, gl_minor, &q_internal_format, &q_format, &q_type, &q_swizzle))
if (!gdk_memory_format_gl_format (format, use_es, gl_major, gl_minor, &q_internal_format, &q_format, &q_type, q_swizzle))
continue;
if (q_format != gl_format || q_type != gl_type)
@@ -188,7 +188,7 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
FALSE,
major, minor,
&gl_internal_format,
&gl_format, &gl_type, &gl_swizzle))
&gl_format, &gl_type, gl_swizzle))
{
if (download->stride == expected_stride &&
download->format == format)
+8 -8
View File
@@ -423,7 +423,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
G_ALIGNOF (guchar),
GDK_MEMORY_U8,
{ 0, 0, 0, 0 },
{ GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
{ GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
r8g8b8_to_float,
r8g8b8_from_float,
},
@@ -433,7 +433,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
G_ALIGNOF (guchar),
GDK_MEMORY_U8,
{ 0, 0, G_MAXUINT, G_MAXUINT },
{ GL_RGB8, GL_BGR, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
{ GL_RGB8, GL_BGR, GL_UNSIGNED_BYTE, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
b8g8r8_to_float,
b8g8r8_from_float,
},
@@ -443,7 +443,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
G_ALIGNOF (guint16),
GDK_MEMORY_U16,
{ 0, 0, 3, 0 },
{ GL_RGB16, GL_RGB, GL_UNSIGNED_SHORT, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
{ GL_RGB16, GL_RGB, GL_UNSIGNED_SHORT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
r16g16b16_to_float,
r16g16b16_from_float,
},
@@ -473,7 +473,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
G_ALIGNOF (guint16),
GDK_MEMORY_FLOAT16,
{ 0, 0, 3, 0 },
{ GL_RGB16F, GL_RGB, GL_HALF_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
{ GL_RGB16F, GL_RGB, GL_HALF_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
r16g16b16_float_to_float,
r16g16b16_float_from_float,
},
@@ -503,7 +503,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
G_ALIGNOF (float),
GDK_MEMORY_FLOAT32,
{ 0, 0, 3, 0 },
{ GL_RGB32F, GL_RGB, GL_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ONE } },
{ GL_RGB32F, GL_RGB, GL_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
r32g32b32_float_to_float,
r32g32b32_float_from_float,
},
@@ -511,7 +511,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
GDK_MEMORY_ALPHA_PREMULTIPLIED,
16,
G_ALIGNOF (float),
TRUE,
GDK_MEMORY_FLOAT32,
{ 0, 0, 3, 0 },
{ GL_RGBA32F, GL_RGBA, GL_FLOAT, { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA } },
r32g32b32a32_float_to_float,
@@ -739,12 +739,12 @@ gdk_memory_format_gl_format (GdkMemoryFormat format,
guint *out_internal_format,
guint *out_format,
guint *out_type,
GLint (*out_swizzle)[4])
GLint out_swizzle[4])
{
*out_internal_format = memory_formats[format].gl.internal_format;
*out_format = memory_formats[format].gl.format;
*out_type = memory_formats[format].gl.type;
memcpy (out_swizzle, &memory_formats[format].gl.swizzle, sizeof(GLint) * 4);
memcpy (out_swizzle, memory_formats[format].gl.swizzle, sizeof(GLint) * 4);
if (gles)
{
+1 -1
View File
@@ -52,7 +52,7 @@ gboolean gdk_memory_format_gl_format (GdkMemoryFormat
guint *out_internal_format,
guint *out_format,
guint *out_type,
GLint (*out_gizzle)[4]);
GLint out_gizzle[4]);
void gdk_memory_convert (guchar *dest_data,
gsize dest_stride,
+21 -3
View File
@@ -24,11 +24,16 @@
#include "gdksnapshotprivate.h"
#include "gdkprivate.h"
#include <graphene.h>
/* HACK: So we don't need to include any (not-yet-created) GSK or GTK headers */
GdkSnapshot * gtk_snapshot_new (void);
void gtk_snapshot_push_debug (GdkSnapshot *snapshot,
const char *message,
...) G_GNUC_PRINTF (2, 3);
void gtk_snapshot_pop (GdkSnapshot *snapshot);
GdkPaintable * gtk_snapshot_free_to_paintable (GdkSnapshot *snapshot,
const graphene_size_t *size);
/**
* GdkPaintable:
@@ -102,9 +107,21 @@ gdk_paintable_default_snapshot (GdkPaintable *paintable,
static GdkPaintable *
gdk_paintable_default_get_current_image (GdkPaintable *paintable)
{
g_warning ("FIXME: implement by snapshotting at default size and returning a GskRendererNodePaintable");
int width, height;
GdkSnapshot *snapshot;
return paintable;
/* No need to check whether the paintable is static, as
* gdk_paintable_get_current_image () takes care of that already. */
width = gdk_paintable_get_intrinsic_width (paintable);
height = gdk_paintable_get_intrinsic_height (paintable);
if (width <= 0 || height <= 0)
return gdk_paintable_new_empty (width, height);
snapshot = gtk_snapshot_new ();
gdk_paintable_snapshot (paintable, snapshot, width, height);
return gtk_snapshot_free_to_paintable (snapshot, NULL);
}
static GdkPaintableFlags
@@ -664,7 +681,8 @@ gdk_empty_paintable_init (GdkEmptyPaintable *self)
* This is often useful for implementing the
* [vfunc@Gdk.Paintable.get_current_image] virtual function
* when the paintable is in an incomplete state (like a
* [class@Gtk.MediaStream] before receiving the first frame).
* [GtkMediaStream](../gtk4/class.MediaStream.html) before receiving
* the first frame).
*
* Returns: (transfer full): a `GdkPaintable`
*/
+1 -1
View File
@@ -40,7 +40,7 @@ struct _GdkIOPipe
GCond cond;
guchar *buffer;
gsize size;
GdkIOPipeState state : 2;
guint state : 2; /* GdkIOPipeState */
guint input_closed : 1;
guint output_closed : 1;
};
+3 -3
View File
@@ -56,9 +56,9 @@
* [method@Gdk.Popup.get_position_x], [method@Gdk.Popup.get_position_y],
* [method@Gdk.Popup.get_rect_anchor] and [method@Gdk.Popup.get_surface_anchor]
* after the popup has been presented. This can be used to adjust the rendering.
* For example, [class@Gtk.Popover] changes its arrow position accordingly.
* But you have to be careful avoid changing the size of the popover, or it
* has to be presented again.
* For example, [GtkPopover](../gtk4/class.Popover.html) changes its arrow position
* accordingly. But you have to be careful avoid changing the size of the popover,
* or it has to be presented again.
*/
struct _GdkPopupLayout
+1 -1
View File
@@ -26,7 +26,7 @@
*
* Base type for snapshot operations.
*
* The subclass of `GdkSnapshot` used by GTK is [class@Gtk.Snapshot].
* The subclass of `GdkSnapshot` used by GTK is [GtkSnapshot](../gtk4/class.Snapshot.html).
*/
G_DEFINE_ABSTRACT_TYPE (GdkSnapshot, gdk_snapshot, G_TYPE_OBJECT)
+3 -3
View File
@@ -56,7 +56,7 @@
* A `GdkSurface` is a rectangular region on the screen.
*
* Its a low-level object, used to implement high-level objects
* such as [class@Gtk.Window] or [class@Gtk.Dialog] in GTK.
* such as [GtkWindow](../gtk4/class.Window.html).
*
* The surfaces you see in practice are either [iface@Gdk.Toplevel] or
* [iface@Gdk.Popup], and those interfaces provide much of the required
@@ -1700,7 +1700,7 @@ gdk_surface_get_device_position (GdkSurface *surface,
* For toplevel surfaces, withdraws them, so they will no longer be
* known to the window manager; for all surfaces, unmaps them, so
* they wont be displayed. Normally done automatically as
* part of [method@Gtk.Widget.hide].
* part of [gtk_widget_hide()](../gtk4/method.Widget.hide.html).
*/
void
gdk_surface_hide (GdkSurface *surface)
@@ -2620,7 +2620,7 @@ gdk_surface_get_scale (GdkSurface *surface)
* GTK will update this property automatically if the @surface background
* is opaque, as we know where the opaque regions are. If your surface
* background is not opaque, please update this property in your
* [vfunc@Gtk.Widget.css_changed] handler.
* [GtkWidgetClass.css_changed](../gtk4/vfunc.Widget.css_changed.html) handler.
*/
void
gdk_surface_set_opaque_region (GdkSurface *surface,
+5 -3
View File
@@ -345,7 +345,9 @@ gdk_texture_init (GdkTexture *self)
*
* Creates a new texture object representing the surface.
*
* @surface must be an image surface with format `CAIRO_FORMAT_ARGB32`.
* The @surface must be an image surface with format `CAIRO_FORMAT_ARGB32`.
*
* The newly created texture will acquire a reference on the @surface.
*
* Returns: a new `GdkTexture`
*/
@@ -364,7 +366,7 @@ gdk_texture_new_for_surface (cairo_surface_t *surface)
* cairo_image_surface_get_stride (surface),
(GDestroyNotify) cairo_surface_destroy,
cairo_surface_reference (surface));
texture = gdk_memory_texture_new (cairo_image_surface_get_width (surface),
cairo_image_surface_get_height (surface),
GDK_MEMORY_DEFAULT,
@@ -819,7 +821,7 @@ gdk_texture_set_render_data (GdkTexture *self,
GDestroyNotify notify)
{
g_return_val_if_fail (data != NULL, FALSE);
if (self->render_key != NULL)
return FALSE;
+7 -6
View File
@@ -377,8 +377,9 @@ gdk_toplevel_lower (GdkToplevel *toplevel)
*
* Sets keyboard focus to @surface.
*
* In most cases, [method@Gtk.Window.present_with_time] should be
* used on a [class@Gtk.Window], rather than calling this function.
* In most cases, [gtk_window_present_with_time()](../gtk4/method.Window.present_with_time.html)
* should be used on a [GtkWindow](../gtk4/class.Window.html), rather than
* calling this function.
*/
void
gdk_toplevel_focus (GdkToplevel *toplevel,
@@ -437,8 +438,8 @@ gdk_toplevel_set_title (GdkToplevel *toplevel,
* Sets the startup notification ID.
*
* When using GTK, typically you should use
* [method@Gtk.Window.set_startup_id] instead of this
* low-level function.
* [gtk_window_set_startup_id()](../gtk4/method.Window.set_startup_id.html)
* instead of this low-level function.
*/
void
gdk_toplevel_set_startup_id (GdkToplevel *toplevel,
@@ -461,8 +462,8 @@ gdk_toplevel_set_startup_id (GdkToplevel *toplevel,
* allows the window manager to do things like center @surface
* on @parent and keep @surface above @parent.
*
* See [method@Gtk.Window.set_transient_for] if youre using
* [class@Gtk.Window] or [class@Gtk.Dialog].
* See [gtk_window_set_transient_for()](../gtk4/method.Window.set_transient_for.html)
* if youre using [GtkWindow](../gtk4/class.Window.html).
*/
void
gdk_toplevel_set_transient_for (GdkToplevel *toplevel,
+11 -5
View File
@@ -137,8 +137,9 @@ gdk_load_png (GBytes *bytes,
png_struct *png = NULL;
png_info *info;
guint width, height;
gsize i, stride;
int depth, color_type;
int interlace, stride;
int interlace;
GdkMemoryFormat format;
guchar *buffer = NULL;
guchar **row_pointers = NULL;
@@ -263,9 +264,14 @@ gdk_load_png (GBytes *bytes,
}
bpp = gdk_memory_format_bytes_per_pixel (format);
stride = width * bpp;
if (stride % 8)
stride += 8 - stride % 8;
if (!g_size_checked_mul (&stride, width, bpp) ||
!g_size_checked_add (&stride, stride, (8 - stride % 8) % 8))
{
g_set_error (error,
GDK_TEXTURE_ERROR, GDK_TEXTURE_ERROR_TOO_LARGE,
_("Image stride too large for image size %ux%u"), width, height);
return NULL;
}
buffer = g_try_malloc_n (height, stride);
row_pointers = g_try_malloc_n (height, sizeof (char *));
@@ -281,7 +287,7 @@ gdk_load_png (GBytes *bytes,
return NULL;
}
for (int i = 0; i < height; i++)
for (i = 0; i < height; i++)
row_pointers[i] = &buffer[i * stride];
png_read_image (png, row_pointers);
+10
View File
@@ -188,6 +188,14 @@ copy_surface_data (GdkMacosBuffer *from,
}
}
static void
clamp_region_to_surface (cairo_region_t *region,
GdkSurface *surface)
{
cairo_rectangle_int_t rectangle = {0, 0, surface->width, surface->height};
cairo_region_intersect_rectangle (region, &rectangle);
}
static void
_gdk_macos_cairo_context_begin_frame (GdkDrawContext *draw_context,
GdkMemoryDepth depth,
@@ -205,6 +213,8 @@ _gdk_macos_cairo_context_begin_frame (GdkDrawContext *draw_context,
surface = GDK_MACOS_SURFACE (gdk_draw_context_get_surface (draw_context));
buffer = _gdk_macos_surface_get_buffer (surface);
clamp_region_to_surface (region, GDK_SURFACE (surface));
_gdk_macos_buffer_set_damage (buffer, region);
_gdk_macos_buffer_set_flipped (buffer, FALSE);
-4
View File
@@ -27,10 +27,6 @@
G_BEGIN_DECLS
#ifndef AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER
typedef NSString *NSPasteboardType;
#endif
#define GDK_TYPE_MACOS_CLIPBOARD (_gdk_macos_clipboard_get_type())
G_DECLARE_FINAL_TYPE (GdkMacosClipboard, _gdk_macos_clipboard, GDK, MACOS_CLIPBOARD, GdkClipboard)
+1 -1
View File
@@ -90,7 +90,7 @@ struct _GdkMacosDisplay
/* Note if we have a key window that is not a GdkMacosWindow
* such as a NSPanel used for native dialogs.
*/
guint key_window_is_foregin : 1;
guint key_window_is_foreign : 1;
};
struct _GdkMacosDisplayClass
+8
View File
@@ -1265,6 +1265,14 @@ _gdk_macos_display_translate (GdkMacosDisplay *self,
_gdk_macos_display_clear_sorting (self);
}
}
else if (is_motion_event(event_type))
{
NSWindow *orig_window = [nsevent window];
if (orig_window && GDK_IS_MACOS_WINDOW (orig_window))
[NSApp sendEvent:nsevent];
}
return fill_event (self, window, nsevent, x, y);
}
+3 -3
View File
@@ -424,7 +424,7 @@ select_key_in_idle_cb (gpointer data)
self->select_key_in_idle = 0;
/* Don't steal focus from NSPanel, etc */
if (self->key_window_is_foregin)
if (self->key_window_is_foreign)
return G_SOURCE_REMOVE;
if (self->keyboard_surface == NULL)
@@ -941,7 +941,7 @@ _gdk_macos_display_get_surfaces (GdkMacosDisplay *self)
NSArray *array = [NSApp orderedWindows];
GQueue sorted = G_QUEUE_INIT;
self->key_window_is_foregin = FALSE;
self->key_window_is_foreign = FALSE;
for (id obj in array)
{
@@ -949,7 +949,7 @@ _gdk_macos_display_get_surfaces (GdkMacosDisplay *self)
GdkMacosSurface *surface;
if ([nswindow isKeyWindow])
self->key_window_is_foregin = !GDK_IS_MACOS_WINDOW (nswindow);
self->key_window_is_foreign = !GDK_IS_MACOS_WINDOW (nswindow);
if (!GDK_IS_MACOS_WINDOW (nswindow))
continue;
+1 -3
View File
@@ -27,9 +27,7 @@
#include "gdkmacosdisplay.h"
#include "gdkmacossurface.h"
#import <OpenGL/OpenGL.h>
#import <OpenGL/gl3.h>
#import <AppKit/AppKit.h>
#import <epoxy/gl.h>
G_BEGIN_DECLS
+1 -2
View File
@@ -21,7 +21,6 @@
#include "gdkconfig.h"
#include <OpenGL/gl3.h>
#include <OpenGL/CGLIOSurface.h>
#include <QuartzCore/QuartzCore.h>
@@ -499,7 +498,7 @@ gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
gdk_gl_context_make_current (GDK_GL_CONTEXT (self));
gdk_macos_gl_context_allocate (self);
GDK_DRAW_CONTEXT_CLASS (gdk_macos_gl_context_parent_class)->begin_frame (context, prefers_high_depth, region);
GDK_DRAW_CONTEXT_CLASS (gdk_macos_gl_context_parent_class)->begin_frame (context, depth, region);
gdk_gl_context_make_current (GDK_GL_CONTEXT (self));
CHECK_GL (NULL, glBindFramebuffer (GL_FRAMEBUFFER, self->fbo));
+1 -1
View File
@@ -331,7 +331,7 @@ _gdk_macos_monitor_reconfigure (GdkMacosMonitor *self)
gdk_monitor_set_physical_size (GDK_MONITOR (self), width_mm, height_mm);
gdk_monitor_set_scale_factor (GDK_MONITOR (self), scale_factor);
gdk_monitor_set_refresh_rate (GDK_MONITOR (self), refresh_rate);
gdk_monitor_set_subpixel_layout (GDK_MONITOR (self), GDK_SUBPIXEL_LAYOUT_UNKNOWN);
gdk_monitor_set_subpixel_layout (GDK_MONITOR (self), subpixel_layout);
self->workarea = [screen visibleFrame];
+4
View File
@@ -26,6 +26,10 @@
G_BEGIN_DECLS
#ifndef AVAILABLE_MAC_OS_X_VERSION_10_13_AND_LATER
typedef NSString *NSPasteboardType;
#endif
@interface GdkMacosPasteboardItemDataProvider : NSObject <NSPasteboardItemDataProvider>
{
GdkContentProvider *_contentProvider;
+1 -1
View File
@@ -400,7 +400,7 @@ _gdk_macos_pasteboard_register_drag_types (NSWindow *window)
gdk_content_formats_get_gtypes (formats, &n_gtypes);
if (n_gtypes)
[ret addObject:NSPasteboardTypeURL];
[ret addObject:PTYPE(URL)];
gdk_content_formats_unref (formats);
}
+18 -5
View File
@@ -46,6 +46,21 @@ static const struct xdg_activation_token_v1_listener token_listener = {
token_done,
};
static struct wl_surface *
peek_launcher_toplevel (GdkSeat *seat)
{
struct wl_surface *wl_surface = NULL;
GdkSurface *focus_surface;
focus_surface = gdk_wayland_device_get_focus (gdk_seat_get_keyboard (seat));
while (focus_surface && focus_surface->parent)
focus_surface = focus_surface->parent;
if (focus_surface)
wl_surface = gdk_wayland_surface_get_wl_surface (focus_surface);
return wl_surface;
}
static char *
gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context,
GAppInfo *info,
@@ -62,7 +77,6 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
struct wl_event_queue *event_queue;
struct wl_surface *wl_surface = NULL;
GdkWaylandSeat *seat;
GdkSurface *focus_surface;
AppLaunchData app_launch_data = { 0 };
event_queue = wl_display_create_queue (display->wl_display);
@@ -78,9 +92,7 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
_gdk_wayland_seat_get_last_implicit_grab_serial (seat, NULL),
gdk_wayland_seat_get_wl_seat (GDK_SEAT (seat)));
focus_surface = gdk_wayland_device_get_focus (gdk_seat_get_keyboard (GDK_SEAT (seat)));
if (focus_surface)
wl_surface = gdk_wayland_surface_get_wl_surface (focus_surface);
wl_surface = peek_launcher_toplevel (GDK_SEAT (seat));
if (wl_surface)
xdg_activation_token_v1_set_surface (token, wl_surface);
@@ -93,7 +105,8 @@ gdk_wayland_app_launch_context_get_startup_notify_id (GAppLaunchContext *context
id = app_launch_data.token;
wl_event_queue_destroy (event_queue);
}
else if (gtk_shell1_get_version (display->gtk_shell) >= GTK_SHELL1_NOTIFY_LAUNCH_SINCE_VERSION)
else if (display->gtk_shell &&
gtk_shell1_get_version (display->gtk_shell) >= GTK_SHELL1_NOTIFY_LAUNCH_SINCE_VERSION)
{
id = g_uuid_string_random ();
gtk_shell1_notify_launch (display->gtk_shell, id);
+1 -1
View File
@@ -245,7 +245,7 @@ gdk_wayland_clipboard_read_async (GdkClipboard *clipboard,
g_task_set_task_data (task, (gpointer) mime_type, NULL);
if (!g_unix_open_pipe (pipe_fd, FD_CLOEXEC, &error))
if (!g_unix_open_pipe (pipe_fd, O_CLOEXEC, &error))
{
g_task_return_error (task, error);
return;
+1 -1
View File
@@ -175,7 +175,7 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
_gdk_wayland_display_get_cursor_theme (display),
desired_scale,
gdk_cursor_get_name (cursor));
if (c)
if (c && c->image_count > 0)
{
struct wl_cursor_image *image;
int cursor_scale;
+8 -1
View File
@@ -96,6 +96,12 @@
#define XDG_ACTIVATION_VERSION 1
#define OUTPUT_VERSION 3
#ifdef HAVE_TOPLEVEL_STATE_SUSPENDED
#define XDG_WM_BASE_VERSION 6
#else
#define XDG_WM_BASE_VERSION 5
#endif
static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland);
G_DEFINE_TYPE (GdkWaylandDisplay, gdk_wayland_display, GDK_TYPE_DISPLAY)
@@ -638,7 +644,8 @@ _gdk_wayland_display_open (const char *display_name)
wl_registry_bind (display_wayland->wl_registry,
display_wayland->xdg_wm_base_id,
&xdg_wm_base_interface,
MIN (display_wayland->xdg_wm_base_version, 4));
MIN (display_wayland->xdg_wm_base_version,
XDG_WM_BASE_VERSION));
xdg_wm_base_add_listener (display_wayland->xdg_wm_base,
&xdg_wm_base_listener,
display_wayland);
+1 -1
View File
@@ -210,7 +210,7 @@ gdk_wayland_drop_read_async (GdkDrop *drop,
g_task_set_task_data (task, (gpointer) mime_type, NULL);
if (!g_unix_open_pipe (pipe_fd, FD_CLOEXEC, &error))
if (!g_unix_open_pipe (pipe_fd, O_CLOEXEC, &error))
{
g_task_return_error (task, error);
return;
+1 -1
View File
@@ -348,7 +348,7 @@ gdk_wayland_primary_read_async (GdkClipboard *clipboard,
g_task_set_task_data (task, (gpointer) mime_type, NULL);
if (!g_unix_open_pipe (pipe_fd, FD_CLOEXEC, &error))
if (!g_unix_open_pipe (pipe_fd, O_CLOEXEC, &error))
{
g_task_return_error (task, error);
return;
+1
View File
@@ -2880,6 +2880,7 @@ tablet_tool_handle_proximity_out (void *data,
gdk_device_update_tool (tablet->stylus_device, NULL);
g_clear_object (&tablet->pointer_info.cursor);
tablet->pointer_info.cursor_is_default = FALSE;
}
static double *
+8
View File
@@ -672,10 +672,18 @@ xdg_toplevel_configure_bounds (void *data,
toplevel->pending.has_bounds = TRUE;
}
static void
xdg_toplevel_wm_capabilities (void *data,
struct xdg_toplevel *xdg_toplevel,
struct wl_array *capabilities)
{
}
static const struct xdg_toplevel_listener xdg_toplevel_listener = {
xdg_toplevel_configure,
xdg_toplevel_close,
xdg_toplevel_configure_bounds,
xdg_toplevel_wm_capabilities,
};
static void
+3
View File
@@ -127,3 +127,6 @@ libgdk_wayland = static_library('gdk-wayland',
link_with: [ libwayland_cursor, ],
dependencies: [ gdk_deps, gdk_wayland_deps ],
)
# Used to generate pkg-config Requires
wayland_public_deps = [wlclientdep]
+7 -37
View File
@@ -149,7 +149,7 @@ GTK might also call gdk_clipboard_store_async(), which instructs
the W32 backend to put the data into the OS clipboard manager by
sending WM_RENDERALLFORMATS to itself and then handling it normally.
Every time W32 backend gets WM_DRAWCLIPBOARD or WM_CLIPBOARDUPDATE,
Every time W32 backend gets WM_CLIPBOARDUPDATE,
it calls GetUpdatedClipboardFormats() and GetClipboardSequenceNumber()
and caches the results of both. These calls do not require the clipboard
to be opened.
@@ -245,7 +245,7 @@ When clipboard owner changes, the old owner receives WM_DESTROYCLIPBOARD message
the clipboard thread schedules a call to gdk_clipboard_claim_remote()
in the main thread, with an empty list of formats,
to indicate that the clipboard is now owned by a remote process.
Later the OS will send WM_DRAWCLIPBOARD or WM_CLIPBOARDUPDATE to indicate
Later the OS will send WM_CLIPBOARDUPDATE to indicate
the new clipboard contents (see above).
DND:
@@ -416,8 +416,6 @@ struct _GdkWin32ClipboardThread
*/
HWND clipboard_opened_for;
HWND hwnd_next_viewer;
/* We can't peek the queue or "unpop" queue items,
* so the items that we can't act upon (yet) got
* to be stored *somewhere*.
@@ -1171,7 +1169,7 @@ inner_clipboard_window_procedure (HWND hwnd,
switch (message)
{
case WM_DESTROY: /* remove us from chain */
case WM_DESTROY: /* unregister the clipboard listener */
{
if (clipboard_thread_data == NULL)
{
@@ -1179,34 +1177,15 @@ inner_clipboard_window_procedure (HWND hwnd,
return DefWindowProcW (hwnd, message, wparam, lparam);
}
ChangeClipboardChain (hwnd, clipboard_thread_data->hwnd_next_viewer);
RemoveClipboardFormatListener (hwnd);
PostQuitMessage (0);
return 0;
}
case WM_CHANGECBCHAIN:
{
HWND hwndRemove = (HWND) wparam; /* handle of window being removed */
HWND hwndNext = (HWND) lparam; /* handle of next window in chain */
if (clipboard_thread_data == NULL)
{
g_warning ("Clipboard thread got an actionable message with no thread data");
return DefWindowProcW (hwnd, message, wparam, lparam);
}
if (hwndRemove == clipboard_thread_data->hwnd_next_viewer)
clipboard_thread_data->hwnd_next_viewer = hwndNext == hwnd ? NULL : hwndNext;
else if (clipboard_thread_data->hwnd_next_viewer != NULL)
return SendMessage (clipboard_thread_data->hwnd_next_viewer, message, wparam, lparam);
return 0;
}
case WM_DESTROYCLIPBOARD:
{
return 0;
}
case WM_CLIPBOARDUPDATE:
case WM_DRAWCLIPBOARD:
{
HWND hwnd_owner;
HWND hwnd_opener;
@@ -1272,9 +1251,6 @@ inner_clipboard_window_procedure (HWND hwnd,
g_idle_add_full (G_PRIORITY_DEFAULT, clipboard_owner_changed, NULL, NULL);
}
if (clipboard_thread_data->hwnd_next_viewer != NULL)
return SendMessage (clipboard_thread_data->hwnd_next_viewer, message, wparam, lparam);
/* clear error to avoid confusing SetClipboardViewer() return */
SetLastError (0);
@@ -1386,7 +1362,7 @@ inner_clipboard_window_procedure (HWND hwnd,
* OpenClipboard() is required/possible
*/
GDK_NOTE (DND,
g_print (" SetClipboardData (%s, %p)",
g_print (" SetClipboardData (%s, %p)\n",
_gdk_win32_cf_to_string (wparam),
returned_render->main_thread_data_handle));
@@ -1426,7 +1402,7 @@ _clipboard_window_procedure (HWND hwnd,
}
/*
* Creates a hidden window and adds it to the clipboard chain
* Creates a hidden window and add a clipboard listener
*/
static gboolean
register_clipboard_notification ()
@@ -1452,9 +1428,8 @@ register_clipboard_notification ()
goto failed;
SetLastError (0);
clipboard_thread_data->hwnd_next_viewer = SetClipboardViewer (clipboard_thread_data->clipboard_window);
if (clipboard_thread_data->hwnd_next_viewer == NULL && GetLastError() != NO_ERROR)
if (AddClipboardFormatListener (clipboard_thread_data->clipboard_window) == FALSE)
{
DestroyWindow (clipboard_thread_data->clipboard_window);
goto failed;
@@ -1462,11 +1437,6 @@ register_clipboard_notification ()
g_idle_add_full (G_PRIORITY_DEFAULT, clipboard_window_created, (gpointer) clipboard_thread_data->clipboard_window, NULL);
/* FIXME: http://msdn.microsoft.com/en-us/library/ms649033(v=VS.85).aspx */
/* This is only supported by Vista, and not yet by mingw64 */
/* if (AddClipboardFormatListener (hwnd) == FALSE) */
/* goto failed; */
return TRUE;
failed:
+13 -6
View File
@@ -286,15 +286,16 @@ _gdk_win32_display_init_monitors (GdkWin32Display *win32_display)
GdkMonitor *ex_monitor;
w32_ex_monitor = GDK_WIN32_MONITOR (g_list_model_get_item (win32_display->monitors, i));
g_object_unref (w32_ex_monitor);
ex_monitor = GDK_MONITOR (w32_ex_monitor);
if (!w32_ex_monitor->remove)
continue;
if (w32_ex_monitor->remove)
{
w32_ex_monitor->hmonitor = NULL;
g_list_store_remove (G_LIST_STORE (win32_display->monitors), i);
gdk_monitor_invalidate (ex_monitor);
}
w32_ex_monitor->hmonitor = NULL;
g_list_store_remove (G_LIST_STORE (win32_display->monitors), i);
gdk_monitor_invalidate (ex_monitor);
g_object_unref (w32_ex_monitor);
}
for (i = 0; i < new_monitors->len; i++)
@@ -547,6 +548,9 @@ _gdk_win32_display_open (const char *display_name)
g_signal_emit_by_name (_gdk_display, "opened");
/* Precalculate keymap, see #6203 */
(void) _gdk_win32_display_get_keymap (_gdk_display);
GDK_NOTE (MISC, g_print ("... _gdk_display now set up\n"));
return _gdk_display;
@@ -1169,6 +1173,9 @@ gdk_win32_display_get_setting (GdkDisplay *display,
const char *name,
GValue *value)
{
if (gdk_display_get_debug_flags (display) & GDK_DEBUG_DEFAULT_SETTINGS)
return FALSE;
return _gdk_win32_get_setting (name, value);
}
+12 -1
View File
@@ -2857,7 +2857,10 @@ gdk_event_translate (MSG *msg,
break;
case WM_SYSCOMMAND:
switch (msg->wParam)
/* From: https://learn.microsoft.com/en-us/windows/win32/menurc/wm-syscommand?redirectedfrom=MSDN
* To obtain the correct result when testing the value of wParam,
* an application must combine the value 0xFFF0 with the wParam value by using the bitwise AND operator. */
switch (msg->wParam & 0xFFF0)
{
case SC_MINIMIZE:
case SC_RESTORE:
@@ -2964,6 +2967,14 @@ gdk_event_translate (MSG *msg,
windowpos = (WINDOWPOS *) msg->lParam;
windowpos->cx = our_mmi.ptMaxSize.x;
windowpos->cy = our_mmi.ptMaxSize.y;
if (!_gdk_win32_surface_lacks_wm_decorations (window) &&
!(windowpos->flags & SWP_NOCLIENTSIZE) &&
window->width == impl->next_layout.configured_width &&
window->height == impl->next_layout.configured_height)
{
impl->inhibit_configure = TRUE;
}
}
impl->maximizing = FALSE;
-4
View File
@@ -126,9 +126,6 @@ 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);
}
static int
gdk_init_dummy_wgl_context (GdkWin32Display *display_win32);
#define PIXEL_ATTRIBUTES 17
static int
@@ -178,7 +175,6 @@ get_wgl_pfd (HDC hdc,
pixelAttribs[i++] = 0; /* end of pixelAttribs */
g_assert (i <= PIXEL_ATTRIBUTES);
best_pf = gdk_init_dummy_wgl_context (display_win32);
if (!wglMakeCurrent (display_win32->dummy_context_wgl.hdc,
display_win32->dummy_context_wgl.hglrc))
+5 -8
View File
@@ -1230,18 +1230,11 @@ get_effective_window_decorations (GdkSurface *window,
*decoration |= GDK_DECOR_MINIMIZE;
return TRUE;
}
else if (impl->hint_flags & GDK_HINT_MAX_SIZE)
{
*decoration = GDK_DECOR_ALL | GDK_DECOR_MAXIMIZE;
*decoration |= GDK_DECOR_MINIMIZE;
return TRUE;
}
else
{
*decoration = (GDK_DECOR_ALL | GDK_DECOR_MINIMIZE | GDK_DECOR_MAXIMIZE);
*decoration = GDK_DECOR_ALL;
return TRUE;
}
@@ -4449,6 +4442,10 @@ _gdk_win32_surface_request_layout (GdkSurface *surface)
{
_gdk_win32_get_window_rect (surface, &rect);
/* Keep current position if rect is invalid (i.e. queried in bad context) */
if (rect.right == rect.left || rect.bottom == rect.top)
return;
impl->next_layout.configured_width = (rect.right - rect.left + scale - 1) / scale;
impl->next_layout.configured_height = (rect.bottom - rect.top + scale - 1) / scale;
+3 -1
View File
@@ -201,7 +201,7 @@ gdk_x11_clipboard_formats_to_targets (GdkContentFormats *formats)
continue;
if (g_str_equal (mime_types[i], special_targets[j].mime_type))
targets = g_slist_prepend (targets, (gpointer) g_intern_string (special_targets[j].x_target));
targets = g_slist_prepend (targets, (gpointer) g_intern_static_string (special_targets[j].x_target));
}
targets = g_slist_prepend (targets, (gpointer) mime_types[i]);
}
@@ -238,6 +238,8 @@ gdk_x11_clipboard_formats_to_atoms (GdkDisplay *display,
for (l = targets; l; l = l->next)
atoms[i++] = gdk_x11_get_xatom_by_name_for_display (display, l->data);
g_slist_free (targets);
return atoms;
}
+2
View File
@@ -86,3 +86,5 @@ libgdk_x11 = static_library('gdk-x11',
] + common_cflags,
dependencies: [ gdk_deps, gdk_x11_deps, ],
)
x11_public_deps = [x11_dep]
+7 -2
View File
@@ -451,7 +451,7 @@ get_colorized_texture (GdkTexture *texture,
const graphene_matrix_t *color_matrix,
const graphene_vec4_t *color_offset)
{
cairo_surface_t *surface = gdk_texture_download_surface (texture);
cairo_surface_t *surface;
cairo_surface_t *image_surface;
graphene_vec4_t pixel;
guint32* pixel_data;
@@ -473,6 +473,7 @@ get_colorized_texture (GdkTexture *texture,
return g_object_ref (colorized->texture);
}
surface = gdk_texture_download_surface (texture);
image_surface = cairo_surface_map_to_image (surface, NULL);
data = cairo_image_surface_get_data (image_surface);
width = cairo_image_surface_get_width (image_surface);
@@ -534,6 +535,8 @@ get_colorized_texture (GdkTexture *texture,
colorized_list, (GDestroyNotify)colorized_texture_free_list);
}
cairo_surface_destroy (surface);
return colorized_texture;
}
@@ -609,7 +612,7 @@ gsk_broadway_renderer_add_node (GskRenderer *renderer,
}
texture = gdk_texture_new_for_surface (image_surface);
g_ptr_array_add (self->node_textures, g_object_ref (texture)); /* Transfers ownership to node_textures */
g_ptr_array_add (self->node_textures, texture); /* Transfers ownership to node_textures */
texture_id = gdk_broadway_display_ensure_texture (display, texture);
add_rect (nodes, &node->bounds, offset_x, offset_y);
@@ -898,6 +901,8 @@ gsk_broadway_renderer_add_node (GskRenderer *renderer,
add_float (nodes, width);
add_float (nodes, height);
add_uint32 (nodes, texture_id);
cairo_surface_destroy (surface);
}
}
+6 -7
View File
@@ -1070,7 +1070,7 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self,
glBlendFunc (GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glBlendEquation (GL_FUNC_ADD);
if (!gdk_gl_context_get_use_es (self->context))
if (gdk_gl_context_has_vertex_arrays (self->context))
{
glGenVertexArrays (1, &vao_id);
glBindVertexArray (vao_id);
@@ -1257,7 +1257,7 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self,
}
glDeleteBuffers (1, &vbo_id);
if (!gdk_gl_context_get_use_es (self->context))
if (gdk_gl_context_has_vertex_arrays (self->context))
glDeleteVertexArrays (1, &vao_id);
gdk_profiler_set_int_counter (self->metrics.n_binds, n_binds);
@@ -1456,7 +1456,7 @@ memory_format_gl_format (GdkMemoryFormat data_format,
guint *gl_internalformat,
guint *gl_format,
guint *gl_type,
GLint (*gl_swizzle)[4])
GLint gl_swizzle[4])
{
GdkMemoryDepth depth;
@@ -1577,7 +1577,7 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
&gl_internalformat,
&gl_format,
&gl_type,
&gl_swizzle);
gl_swizzle);
gdk_texture_downloader_init (&downloader, texture);
gdk_texture_downloader_set_format (&downloader, data_format);
@@ -1595,8 +1595,7 @@ gsk_gl_command_queue_do_upload_texture_chunk (GskGLCommandQueue *self,
{
glTexSubImage2D (GL_TEXTURE_2D, 0, x, y, width, height, gl_format, gl_type, data);
}
else if (stride % bpp == 0 &&
(gdk_gl_context_check_version (self->context, NULL, "3.0") || gdk_gl_context_has_unpack_subimage (self->context)))
else if (stride % bpp == 0 && gdk_gl_context_has_unpack_subimage (self->context))
{
glPixelStorei (GL_UNPACK_ROW_LENGTH, stride / bpp);
@@ -1684,7 +1683,7 @@ gsk_gl_command_queue_upload_texture_chunks (GskGLCommandQueue *self,
&gl_internalformat,
&gl_format,
&gl_type,
&gl_swizzle);
gl_swizzle);
glTexImage2D (GL_TEXTURE_2D, 0, gl_internalformat, width, height, 0, gl_format, gl_type, NULL);
+4 -2
View File
@@ -1601,8 +1601,9 @@ create_texture_from_texture_destroy (gpointer data)
}
GdkTexture *
gsk_gl_driver_create_gdk_texture (GskGLDriver *self,
guint texture_id)
gsk_gl_driver_create_gdk_texture (GskGLDriver *self,
guint texture_id,
GdkMemoryFormat format)
{
GskGLTextureState *state;
GdkGLTextureBuilder *builder;
@@ -1630,6 +1631,7 @@ gsk_gl_driver_create_gdk_texture (GskGLDriver *self,
builder = gdk_gl_texture_builder_new ();
gdk_gl_texture_builder_set_context (builder, self->command_queue->context);
gdk_gl_texture_builder_set_id (builder, texture_id);
gdk_gl_texture_builder_set_format (builder, format);
gdk_gl_texture_builder_set_width (builder, texture->width);
gdk_gl_texture_builder_set_height (builder, texture->height);
gdk_gl_texture_builder_set_sync (builder, state->sync);
+2 -1
View File
@@ -149,7 +149,8 @@ void gsk_gl_driver_begin_frame (GskGLDriver *s
void gsk_gl_driver_end_frame (GskGLDriver *self);
void gsk_gl_driver_after_frame (GskGLDriver *self);
GdkTexture * gsk_gl_driver_create_gdk_texture (GskGLDriver *self,
guint texture_id);
guint texture_id,
GdkMemoryFormat format);
void gsk_gl_driver_cache_texture (GskGLDriver *self,
const GskTextureKey *key,
guint texture_id);
+8 -5
View File
@@ -119,7 +119,11 @@ gsk_gl_glyph_library_init_atlas (GskGLTextureLibrary *self,
memset (pixel_data, 255, sizeof pixel_data);
if (gdk_gl_context_get_use_es (gdk_gl_context_get_current ()))
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
)
{
gl_format = GL_RGBA;
gl_type = GL_UNSIGNED_BYTE;
@@ -127,9 +131,8 @@ gsk_gl_glyph_library_init_atlas (GskGLTextureLibrary *self,
else
{
gl_format = GL_BGRA;
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
gl_type = GL_UNSIGNED_BYTE;
}
glBindTexture (GL_TEXTURE_2D, atlas->texture_id);
glTexSubImage2D (GL_TEXTURE_2D, 0,
@@ -277,7 +280,7 @@ gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary *self,
g_assert (texture_id > 0);
if G_UNLIKELY (gdk_gl_context_get_use_es (gdk_gl_context_get_current ()))
if (G_UNLIKELY (!gdk_gl_context_has_bgra (gdk_gl_context_get_current ())))
{
pixel_data = free_data = g_malloc (width * height * 4);
gdk_memory_convert (pixel_data, width * 4,
@@ -294,7 +297,7 @@ gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary *self,
{
pixel_data = cairo_image_surface_get_data (surface);
gl_format = GL_BGRA;
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
gl_type = GL_UNSIGNED_BYTE;
}
glPixelStorei (GL_UNPACK_ROW_LENGTH, stride / 4);
+7 -3
View File
@@ -111,7 +111,11 @@ gsk_gl_icon_library_add (GskGLIconLibrary *self,
gdk_gl_context_push_debug_group_printf (gdk_gl_context_get_current (),
"Uploading texture");
if (gdk_gl_context_get_use_es (gdk_gl_context_get_current ()))
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
)
{
pixel_data = free_data = g_malloc (width * height * 4);
gdk_memory_convert (pixel_data, width * 4,
@@ -125,7 +129,7 @@ gsk_gl_icon_library_add (GskGLIconLibrary *self,
{
pixel_data = surface_data;
gl_format = GL_BGRA;
gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
gl_type = GL_UNSIGNED_BYTE;
}
texture_id = GSK_GL_TEXTURE_ATLAS_ENTRY_TEXTURE (icon_data);
@@ -144,6 +148,7 @@ gsk_gl_icon_library_add (GskGLIconLibrary *self,
gl_format, gl_type,
pixel_data);
/* Padding left */
glPixelStorei (GL_UNPACK_ROW_LENGTH, width);
glTexSubImage2D (GL_TEXTURE_2D, 0,
packed_x, packed_y + 1,
1, height,
@@ -157,7 +162,6 @@ gsk_gl_icon_library_add (GskGLIconLibrary *self,
pixel_data);
/* Padding right */
glPixelStorei (GL_UNPACK_ROW_LENGTH, width);
glPixelStorei (GL_UNPACK_SKIP_PIXELS, width - 1);
glTexSubImage2D (GL_TEXTURE_2D, 0,
packed_x + width + 1, packed_y + 1,
+10 -3
View File
@@ -332,6 +332,7 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
GskGLRenderJob *job;
GdkTexture *texture;
guint texture_id;
GdkMemoryFormat gdk_format;
int width, height, max_size;
int format;
@@ -375,9 +376,15 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
if (gsk_render_node_get_preferred_depth (root) != GDK_MEMORY_U8 &&
gdk_gl_context_check_version (self->context, "3.0", "3.0"))
format = GL_RGBA32F;
{
gdk_format = GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED;
format = GL_RGBA32F;
}
else
format = GL_RGBA8;
{
format = GL_RGBA8;
gdk_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED;
}
gdk_gl_context_make_current (self->context);
@@ -394,7 +401,7 @@ gsk_gl_renderer_render_texture (GskRenderer *renderer,
#endif
gsk_gl_render_job_render_flipped (job, root);
texture_id = gsk_gl_driver_release_render_target (self->driver, render_target, FALSE);
texture = gsk_gl_driver_create_gdk_texture (self->driver, texture_id);
texture = gsk_gl_driver_create_gdk_texture (self->driver, texture_id, gdk_format);
gsk_gl_driver_end_frame (self->driver);
gsk_gl_render_job_free (job);
+1 -1
View File
@@ -20,7 +20,7 @@
#pragma once
#include <gsk/gskrenderer.h>
#include <gsk/gsk.h>
G_BEGIN_DECLS
+102 -72
View File
@@ -65,6 +65,14 @@ typedef struct _GskGLRenderClip
guint is_fully_contained : 1;
} GskGLRenderClip;
#define GDK_ARRAY_NAME clips
#define GDK_ARRAY_TYPE_NAME Clips
#define GDK_ARRAY_ELEMENT_TYPE GskGLRenderClip
#define GDK_ARRAY_BY_VALUE 1
#define GDK_ARRAY_PREALLOC 16
#define GDK_ARRAY_NO_MEMSET
#include "gdk/gdkarrayimpl.c"
typedef struct _GskGLRenderModelview
{
GskTransform *transform;
@@ -77,6 +85,14 @@ typedef struct _GskGLRenderModelview
graphene_matrix_t matrix;
} GskGLRenderModelview;
#define GDK_ARRAY_NAME modelviews
#define GDK_ARRAY_TYPE_NAME Modelviews
#define GDK_ARRAY_ELEMENT_TYPE GskGLRenderModelview
#define GDK_ARRAY_BY_VALUE 1
#define GDK_ARRAY_PREALLOC 16
#define GDK_ARRAY_NO_MEMSET
#include "gdk/gdkarrayimpl.c"
struct _GskGLRenderJob
{
/* The context containing the framebuffer we are drawing to. Generally this
@@ -117,12 +133,12 @@ struct _GskGLRenderJob
/* An array of GskGLRenderModelview updated as nodes are processed. The
* current modelview is the last element.
*/
GArray *modelview;
Modelviews modelview;
/* An array of GskGLRenderClip updated as nodes are processed. The
* current clip is the last element.
*/
GArray *clip;
Clips clip;
/* Our current alpha state as we process nodes */
float alpha;
@@ -142,6 +158,8 @@ struct _GskGLRenderJob
const GskGLRenderModelview *current_modelview;
GskGLProgram *current_program;
guint source_is_glyph_atlas : 1;
/* If we should be rendering red zones over fallback nodes */
guint debug_fallback : 1;
@@ -191,6 +209,22 @@ static gboolean gsk_gl_render_job_visit_node_with_offscreen (GskGLRenderJob
const GskRenderNode *node,
GskGLRenderOffscreen *offscreen);
static inline GskGLRenderClip *
clips_grow_one (Clips *clips)
{
guint len = clips_get_size (clips);
clips_set_size (clips, len + 1);
return clips_get (clips, len);
}
static inline GskGLRenderModelview *
modelviews_grow_one (Modelviews *modelviews)
{
guint len = modelviews_get_size (modelviews);
modelviews_set_size (modelviews, len + 1);
return modelviews_get (modelviews, len);
}
static inline int
get_target_format (GskGLRenderJob *job,
const GskRenderNode *node)
@@ -236,7 +270,7 @@ gsk_rounded_rect_shrink_to_minimum (GskRoundedRect *self)
static inline gboolean G_GNUC_PURE
node_supports_2d_transform (const GskRenderNode *node)
{
switch (gsk_render_node_get_node_type (node))
switch (GSK_RENDER_NODE_TYPE (node))
{
case GSK_COLOR_NODE:
case GSK_OPACITY_NODE:
@@ -296,7 +330,7 @@ node_supports_transform (const GskRenderNode *node)
* opacity or color matrix.
*/
switch (gsk_render_node_get_node_type (node))
switch (GSK_RENDER_NODE_TYPE (node))
{
case GSK_COLOR_NODE:
case GSK_OPACITY_NODE:
@@ -460,15 +494,10 @@ gsk_gl_render_job_set_modelview (GskGLRenderJob *job,
GskGLRenderModelview *modelview;
g_assert (job != NULL);
g_assert (job->modelview != NULL);
job->driver->stamps[UNIFORM_SHARED_MODELVIEW]++;
g_array_set_size (job->modelview, job->modelview->len + 1);
modelview = &g_array_index (job->modelview,
GskGLRenderModelview,
job->modelview->len - 1);
modelview = modelviews_grow_one (&job->modelview);
modelview->transform = transform;
@@ -493,26 +522,17 @@ gsk_gl_render_job_push_modelview (GskGLRenderJob *job,
GskGLRenderModelview *modelview;
g_assert (job != NULL);
g_assert (job->modelview != NULL);
g_assert (transform != NULL);
job->driver->stamps[UNIFORM_SHARED_MODELVIEW]++;
g_array_set_size (job->modelview, job->modelview->len + 1);
modelview = modelviews_grow_one (&job->modelview);
modelview = &g_array_index (job->modelview,
GskGLRenderModelview,
job->modelview->len - 1);
if G_LIKELY (job->modelview->len > 1)
if G_LIKELY (modelviews_get_size (&job->modelview) > 1)
{
GskGLRenderModelview *last;
GskGLRenderModelview *last = job->modelview.end - 2;
GskTransform *t = NULL;
last = &g_array_index (job->modelview,
GskGLRenderModelview,
job->modelview->len - 2);
/* Multiply given matrix with our previous modelview */
t = gsk_transform_translate (gsk_transform_ref (last->transform),
&(graphene_point_t) {
@@ -546,8 +566,7 @@ gsk_gl_render_job_pop_modelview (GskGLRenderJob *job)
const GskGLRenderModelview *head;
g_assert (job != NULL);
g_assert (job->modelview);
g_assert (job->modelview->len > 0);
g_assert (modelviews_get_size (&job->modelview) > 0);
job->driver->stamps[UNIFORM_SHARED_MODELVIEW]++;
@@ -558,11 +577,11 @@ gsk_gl_render_job_pop_modelview (GskGLRenderJob *job)
gsk_transform_unref (head->transform);
job->modelview->len--;
job->modelview.end--;
if (job->modelview->len >= 1)
if (modelviews_get_size (&job->modelview) >= 1)
{
head = &g_array_index (job->modelview, GskGLRenderModelview, job->modelview->len - 1);
head = job->modelview.end - 1;
job->scale_x = head->scale_x;
job->scale_y = head->scale_y;
@@ -582,14 +601,12 @@ gsk_gl_render_job_push_clip (GskGLRenderJob *job,
GskGLRenderClip *clip;
g_assert (job != NULL);
g_assert (job->clip != NULL);
g_assert (rect != NULL);
job->driver->stamps[UNIFORM_SHARED_CLIP_RECT]++;
g_array_set_size (job->clip, job->clip->len + 1);
clip = clips_grow_one (&job->clip);
clip = &g_array_index (job->clip, GskGLRenderClip, job->clip->len - 1);
memcpy (&clip->rect, rect, sizeof *rect);
clip->is_rectilinear = gsk_rounded_rect_is_rectilinear (rect);
clip->is_fully_contained = FALSE;
@@ -604,16 +621,13 @@ gsk_gl_render_job_push_contained_clip (GskGLRenderJob *job)
GskGLRenderClip *old_clip;
g_assert (job != NULL);
g_assert (job->clip != NULL);
g_assert (job->clip->len > 0);
g_assert (clips_get_size (&job->clip) > 0);
job->driver->stamps[UNIFORM_SHARED_CLIP_RECT]++;
old_clip = &g_array_index (job->clip, GskGLRenderClip, job->clip->len - 1);
clip = clips_grow_one (&job->clip);
old_clip = clips_get (&job->clip, clips_get_size (&job->clip) - 2);
g_array_set_size (job->clip, job->clip->len + 1);
clip = &g_array_index (job->clip, GskGLRenderClip, job->clip->len - 1);
memcpy (&clip->rect.bounds, &old_clip->rect.bounds, sizeof (graphene_rect_t));
memset (clip->rect.corner, 0, sizeof clip->rect.corner);
clip->is_rectilinear = TRUE;
@@ -626,12 +640,11 @@ static void
gsk_gl_render_job_pop_clip (GskGLRenderJob *job)
{
g_assert (job != NULL);
g_assert (job->clip != NULL);
g_assert (job->clip->len > 0);
g_assert (clips_get_size (&job->clip) > 0);
job->driver->stamps[UNIFORM_SHARED_CLIP_RECT]++;
job->current_clip--;
job->clip->len--;
job->clip.end--;
}
static inline void
@@ -713,7 +726,7 @@ gsk_gl_render_job_transform_bounds (GskGLRenderJob *job,
GskTransformCategory category;
g_assert (job != NULL);
g_assert (job->modelview->len > 0);
g_assert (modelviews_get_size (&job->modelview) > 0);
g_assert (rect != NULL);
g_assert (out_rect != NULL);
@@ -1208,12 +1221,12 @@ gsk_gl_render_job_visit_as_fallback (GskGLRenderJob *job,
{
cairo_move_to (cr, 0, 0);
cairo_rectangle (cr, 0, 0, node->bounds.size.width, node->bounds.size.height);
if (gsk_render_node_get_node_type (node) == GSK_CAIRO_NODE)
if (GSK_RENDER_NODE_TYPE (node) == GSK_CAIRO_NODE)
cairo_set_source_rgba (cr, 0.3, 0, 1, 0.25);
else
cairo_set_source_rgba (cr, 1, 0, 0, 0.25);
cairo_fill_preserve (cr);
if (gsk_render_node_get_node_type (node) == GSK_CAIRO_NODE)
if (GSK_RENDER_NODE_TYPE (node) == GSK_CAIRO_NODE)
cairo_set_source_rgba (cr, 0.3, 0, 1, 1);
else
cairo_set_source_rgba (cr, 1, 0, 0, 1);
@@ -1256,6 +1269,7 @@ done:
GL_TEXTURE_2D,
GL_TEXTURE0,
texture_id);
job->source_is_glyph_atlas = FALSE;
gsk_gl_render_job_draw_offscreen_rect (job, &node->bounds);
gsk_gl_render_job_end_draw (job);
@@ -1321,6 +1335,7 @@ blur_offscreen (GskGLRenderJob *job,
GL_TEXTURE_2D,
GL_TEXTURE0,
offscreen->texture_id);
job->source_is_glyph_atlas = FALSE;
gsk_gl_program_set_uniform1f (job->current_program,
UNIFORM_BLUR_RADIUS, 0,
blur_radius_x);
@@ -1350,6 +1365,7 @@ blur_offscreen (GskGLRenderJob *job,
GL_TEXTURE_2D,
GL_TEXTURE0,
pass1->texture_id);
job->source_is_glyph_atlas = FALSE;
gsk_gl_program_set_uniform1f (job->current_program,
UNIFORM_BLUR_RADIUS, 0,
blur_radius_y);
@@ -1457,7 +1473,8 @@ gsk_gl_render_job_visit_color_node (GskGLRenderJob *job,
batch = gsk_gl_command_queue_get_batch (job->command_queue);
/* Limit the size, or we end up with a coordinate overflow somewhere. */
if (node->bounds.size.width < 300 &&
if (job->source_is_glyph_atlas &&
node->bounds.size.width < 300 &&
node->bounds.size.height < 300 &&
batch->any.kind == GSK_GL_COMMAND_KIND_DRAW &&
batch->any.program == program->id)
@@ -1502,7 +1519,7 @@ gsk_gl_render_job_visit_linear_gradient_node (GskGLRenderJob *job,
const graphene_point_t *start = gsk_linear_gradient_node_get_start (node);
const graphene_point_t *end = gsk_linear_gradient_node_get_end (node);
int n_color_stops = gsk_linear_gradient_node_get_n_color_stops (node);
gboolean repeat = gsk_render_node_get_node_type (node) == GSK_REPEATING_LINEAR_GRADIENT_NODE;
gboolean repeat = GSK_RENDER_NODE_TYPE (node) == GSK_REPEATING_LINEAR_GRADIENT_NODE;
float x1 = job->offset_x + start->x;
float x2 = job->offset_x + end->x;
float y1 = job->offset_y + start->y;
@@ -1575,7 +1592,7 @@ gsk_gl_render_job_visit_radial_gradient_node (GskGLRenderJob *job,
float end = gsk_radial_gradient_node_get_end (node);
float hradius = gsk_radial_gradient_node_get_hradius (node);
float vradius = gsk_radial_gradient_node_get_vradius (node);
gboolean repeat = gsk_render_node_get_node_type (node) == GSK_REPEATING_RADIAL_GRADIENT_NODE;
gboolean repeat = GSK_RENDER_NODE_TYPE (node) == GSK_REPEATING_RADIAL_GRADIENT_NODE;
float scale = 1.0f / (end - start);
float bias = -start * scale;
@@ -1664,6 +1681,7 @@ gsk_gl_render_job_visit_clipped_child (GskGLRenderJob *job,
GL_TEXTURE_2D,
GL_TEXTURE0,
offscreen.texture_id);
job->source_is_glyph_atlas = FALSE;
gsk_gl_render_job_draw_offscreen_rect (job, clip);
gsk_gl_render_job_end_draw (job);
}
@@ -1719,7 +1737,7 @@ gsk_gl_render_job_visit_rounded_clip_node (GskGLRenderJob *job,
* which both have rounded corners.
*/
if (job->clip->len <= 1)
if (clips_get_size (&job->clip) <= 1)
need_offscreen = FALSE;
else if (gsk_rounded_rect_contains_rect (&job->current_clip->rect, &transformed_clip.bounds))
need_offscreen = FALSE;
@@ -1754,6 +1772,7 @@ gsk_gl_render_job_visit_rounded_clip_node (GskGLRenderJob *job,
GL_TEXTURE_2D,
GL_TEXTURE0,
offscreen.texture_id);
job->source_is_glyph_atlas = FALSE;
gsk_gl_render_job_draw_offscreen (job, &node->bounds, &offscreen);
gsk_gl_render_job_end_draw (job);
}
@@ -2119,6 +2138,7 @@ gsk_gl_render_job_visit_transform_node (GskGLRenderJob *job,
offscreen.texture_id,
linear_filter ? GL_LINEAR : GL_NEAREST,
linear_filter ? GL_LINEAR : GL_NEAREST);
job->source_is_glyph_atlas = FALSE;
gsk_gl_render_job_draw_offscreen (job, &child->bounds, &offscreen);
gsk_gl_render_job_end_draw (job);
}
@@ -2328,6 +2348,7 @@ gsk_gl_render_job_visit_blurred_inset_shadow_node (GskGLRenderJob *job,
GL_TEXTURE_2D,
GL_TEXTURE0,
blurred_texture_id);
job->source_is_glyph_atlas = FALSE;
gsk_gl_render_job_draw_offscreen (job, &node->bounds, &offscreen);
gsk_gl_render_job_end_draw (job);
}
@@ -2593,6 +2614,7 @@ gsk_gl_render_job_visit_blurred_outset_shadow_node (GskGLRenderJob *job,
GL_TEXTURE_2D,
GL_TEXTURE0,
blurred_texture_id);
job->source_is_glyph_atlas = FALSE;
gsk_gl_program_set_uniform_rounded_rect (job->current_program,
UNIFORM_OUTSET_SHADOW_OUTLINE_RECT, 0,
&transformed_outline);
@@ -2618,6 +2640,7 @@ gsk_gl_render_job_visit_blurred_outset_shadow_node (GskGLRenderJob *job,
GL_TEXTURE_2D,
GL_TEXTURE0,
blurred_texture_id);
job->source_is_glyph_atlas = FALSE;
gsk_gl_program_set_uniform_rounded_rect (job->current_program,
UNIFORM_OUTSET_SHADOW_OUTLINE_RECT, 0,
&transformed_outline);
@@ -2783,8 +2806,8 @@ static inline gboolean G_GNUC_PURE
equal_texture_nodes (const GskRenderNode *node1,
const GskRenderNode *node2)
{
if (gsk_render_node_get_node_type (node1) != GSK_TEXTURE_NODE ||
gsk_render_node_get_node_type (node2) != GSK_TEXTURE_NODE)
if (GSK_RENDER_NODE_TYPE (node1) != GSK_TEXTURE_NODE ||
GSK_RENDER_NODE_TYPE (node2) != GSK_TEXTURE_NODE)
return FALSE;
if (gsk_texture_node_get_texture (node1) !=
@@ -2855,6 +2878,7 @@ gsk_gl_render_job_visit_cross_fade_node (GskGLRenderJob *job,
GL_TEXTURE_2D,
GL_TEXTURE1,
offscreen_end.texture_id);
job->source_is_glyph_atlas = FALSE;
gsk_gl_program_set_uniform1f (job->current_program,
UNIFORM_CROSS_FADE_PROGRESS, 0,
progress);
@@ -2901,6 +2925,7 @@ gsk_gl_render_job_visit_opacity_node (GskGLRenderJob *job,
GL_TEXTURE_2D,
GL_TEXTURE0,
offscreen.texture_id);
job->source_is_glyph_atlas = FALSE;
gsk_gl_render_job_draw_offscreen (job, &node->bounds, &offscreen);
gsk_gl_render_job_end_draw (job);
}
@@ -3042,6 +3067,7 @@ gsk_gl_render_job_visit_text_node (GskGLRenderJob *job,
GL_TEXTURE_2D,
GL_TEXTURE0,
texture_id);
job->source_is_glyph_atlas = TRUE;
last_texture = texture_id;
}
@@ -3084,7 +3110,7 @@ gsk_gl_render_job_visit_shadow_node (GskGLRenderJob *job,
/* Shadow nodes recolor every pixel of the source texture, but leave the alpha in tact.
* If the child is a color matrix node that doesn't touch the alpha, we can throw that away. */
if (gsk_render_node_get_node_type (shadow_child) == GSK_COLOR_MATRIX_NODE &&
if (GSK_RENDER_NODE_TYPE (shadow_child) == GSK_COLOR_MATRIX_NODE &&
!color_matrix_modifies_alpha (shadow_child))
shadow_child = gsk_color_matrix_node_get_child (shadow_child);
@@ -3104,7 +3130,7 @@ gsk_gl_render_job_visit_shadow_node (GskGLRenderJob *job,
continue;
if (shadow->radius == 0 &&
gsk_render_node_get_node_type (shadow_child) == GSK_TEXT_NODE)
GSK_RENDER_NODE_TYPE (shadow_child) == GSK_TEXT_NODE)
{
if (dx != 0 || dy != 0)
{
@@ -3138,10 +3164,6 @@ gsk_gl_render_job_visit_shadow_node (GskGLRenderJob *job,
offscreen.was_offscreen = TRUE;
}
else if (dx == 0 && dy == 0)
{
continue; /* Invisible anyway */
}
else
{
offscreen.bounds = &shadow_child->bounds;
@@ -3162,6 +3184,7 @@ gsk_gl_render_job_visit_shadow_node (GskGLRenderJob *job,
GL_TEXTURE_2D,
GL_TEXTURE0,
offscreen.texture_id);
job->source_is_glyph_atlas = FALSE;
rgba_to_half (&shadow->color, color);
gsk_gl_render_job_draw_offscreen_with_color (job, &bounds, &offscreen, color);
gsk_gl_render_job_end_draw (job);
@@ -3218,6 +3241,7 @@ gsk_gl_render_job_visit_blur_node (GskGLRenderJob *job,
GL_TEXTURE_2D,
GL_TEXTURE0,
offscreen.texture_id);
job->source_is_glyph_atlas = FALSE;
gsk_gl_render_job_draw_coords (job,
min_x, min_y, max_x, max_y,
0, 1, 1, 0,
@@ -3268,6 +3292,7 @@ gsk_gl_render_job_visit_blend_node (GskGLRenderJob *job,
GL_TEXTURE_2D,
GL_TEXTURE0,
bottom_offscreen.texture_id);
job->source_is_glyph_atlas = FALSE;
gsk_gl_render_job_draw_offscreen (job, &node->bounds, &bottom_offscreen);
gsk_gl_render_job_end_draw (job);
}
@@ -3290,6 +3315,7 @@ gsk_gl_render_job_visit_blend_node (GskGLRenderJob *job,
GL_TEXTURE_2D,
GL_TEXTURE1,
top_offscreen.texture_id);
job->source_is_glyph_atlas = FALSE;
gsk_gl_program_set_uniform1i (job->current_program,
UNIFORM_BLEND_MODE, 0,
gsk_blend_node_get_blend_mode (node));
@@ -3352,6 +3378,7 @@ gsk_gl_render_job_visit_mask_node (GskGLRenderJob *job,
GL_TEXTURE_2D,
GL_TEXTURE1,
mask_offscreen.texture_id);
job->source_is_glyph_atlas = FALSE;
gsk_gl_program_set_uniform1i (job->current_program,
UNIFORM_MASK_MODE, 0,
gsk_mask_node_get_mask_mode (node));
@@ -3388,6 +3415,7 @@ gsk_gl_render_job_visit_color_matrix_node (GskGLRenderJob *job,
GL_TEXTURE_2D,
GL_TEXTURE0,
offscreen.texture_id);
job->source_is_glyph_atlas = FALSE;
gsk_gl_program_set_uniform_matrix (job->current_program,
UNIFORM_COLOR_MATRIX_COLOR_MATRIX, 0,
gsk_color_matrix_node_get_color_matrix (node));
@@ -3470,6 +3498,7 @@ gsk_gl_render_job_visit_gl_shader_node (GskGLRenderJob *job,
GL_TEXTURE_2D,
GL_TEXTURE0 + i,
offscreens[i].texture_id);
job->source_is_glyph_atlas = FALSE;
gsk_gl_program_set_uniform2f (program,
UNIFORM_CUSTOM_SIZE, 0,
node->bounds.size.width,
@@ -3604,6 +3633,7 @@ gsk_gl_render_job_visit_texture (GskGLRenderJob *job,
offscreen.has_mipmap ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR,
GL_LINEAR,
offscreen.sync);
job->source_is_glyph_atlas = FALSE;
gsk_gl_render_job_draw_offscreen (job, bounds, &offscreen);
gsk_gl_render_job_end_draw (job);
}
@@ -3641,6 +3671,7 @@ gsk_gl_render_job_visit_texture (GskGLRenderJob *job,
slice->texture_id,
use_mipmap ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR,
GL_LINEAR);
job->source_is_glyph_atlas = FALSE;
gsk_gl_render_job_draw_coords (job,
x1, y1, x2, y2,
@@ -3687,12 +3718,6 @@ gsk_gl_render_job_visit_texture_scale_node (GskGLRenderJob *job,
GskTextureKey key;
guint texture_id;
if (filter == GSK_SCALING_FILTER_LINEAR)
{
gsk_gl_render_job_visit_texture (job, texture, bounds);
return;
}
gsk_gl_render_job_untransform_bounds (job, &job->current_clip->rect.bounds, &clip_rect);
if (!graphene_rect_intersection (bounds, &clip_rect, &clip_rect))
@@ -3759,6 +3784,7 @@ gsk_gl_render_job_visit_texture_scale_node (GskGLRenderJob *job,
min_filter,
mag_filter,
sync);
job->source_is_glyph_atlas = FALSE;
gsk_gl_render_job_draw_coords (job,
0, 0, clip_rect.size.width, clip_rect.size.height,
u0, v0, u1, v1,
@@ -3800,6 +3826,7 @@ gsk_gl_render_job_visit_texture_scale_node (GskGLRenderJob *job,
slice->texture_id,
min_filter,
mag_filter);
job->source_is_glyph_atlas = FALSE;
gsk_gl_render_job_draw_coords (job,
slice_bounds.origin.x,
slice_bounds.origin.y,
@@ -3832,6 +3859,7 @@ render_texture:
GL_TEXTURE_2D,
GL_TEXTURE0,
texture_id);
job->source_is_glyph_atlas = FALSE;
gsk_gl_render_job_draw_coords (job,
job->offset_x + clip_rect.origin.x,
job->offset_y + clip_rect.origin.y,
@@ -3884,6 +3912,7 @@ gsk_gl_render_job_visit_repeat_node (GskGLRenderJob *job,
GL_TEXTURE_2D,
GL_TEXTURE0,
offscreen.texture_id);
job->source_is_glyph_atlas = FALSE;
gsk_gl_program_set_uniform4f (job->current_program,
UNIFORM_REPEAT_CHILD_BOUNDS, 0,
(node->bounds.origin.x - child_bounds->origin.x) / child_bounds->size.width,
@@ -3918,7 +3947,7 @@ gsk_gl_render_job_visit_node (GskGLRenderJob *job,
if (!gsk_gl_render_job_update_clip (job, &node->bounds, &has_clip))
return;
switch (gsk_render_node_get_node_type (node))
switch (GSK_RENDER_NODE_TYPE (node))
{
case GSK_BLEND_NODE:
gsk_gl_render_job_visit_blend_node (job, node);
@@ -3971,12 +4000,12 @@ gsk_gl_render_job_visit_node (GskGLRenderJob *job,
if (i + 1 < n_children &&
job->current_clip->is_fully_contained &&
gsk_render_node_get_node_type (child) == GSK_ROUNDED_CLIP_NODE)
GSK_RENDER_NODE_TYPE (child) == GSK_ROUNDED_CLIP_NODE)
{
const GskRenderNode *grandchild = gsk_rounded_clip_node_get_child (child);
const GskRenderNode *child2 = children[i + 1];
if (gsk_render_node_get_node_type (grandchild) == GSK_COLOR_NODE &&
gsk_render_node_get_node_type (child2) == GSK_BORDER_NODE &&
if (GSK_RENDER_NODE_TYPE (grandchild) == GSK_COLOR_NODE &&
GSK_RENDER_NODE_TYPE (child2) == GSK_BORDER_NODE &&
gsk_border_node_get_uniform_color (child2) &&
rounded_rect_equal (gsk_rounded_clip_node_get_clip (child),
gsk_border_node_get_outline (child2)))
@@ -4122,7 +4151,7 @@ gsk_gl_render_job_visit_node_with_offscreen (GskGLRenderJob *job,
return FALSE;
}
if (gsk_render_node_get_node_type (node) == GSK_TEXTURE_NODE &&
if (GSK_RENDER_NODE_TYPE (node) == GSK_TEXTURE_NODE &&
!offscreen->force_offscreen)
{
GdkTexture *texture = gsk_texture_node_get_texture (node);
@@ -4370,6 +4399,7 @@ gsk_gl_render_job_render_flipped (GskGLRenderJob *job,
GL_TEXTURE_2D,
GL_TEXTURE0,
texture_id);
job->source_is_glyph_atlas = FALSE;
gsk_gl_render_job_draw_rect (job, &job->viewport);
gsk_gl_render_job_end_draw (job);
}
@@ -4494,8 +4524,8 @@ gsk_gl_render_job_new (GskGLDriver *driver,
job = g_new0 (GskGLRenderJob, 1);
job->driver = g_object_ref (driver);
job->command_queue = job->driver->command_queue;
job->clip = g_array_sized_new (FALSE, FALSE, sizeof (GskGLRenderClip), 16);
job->modelview = g_array_sized_new (FALSE, FALSE, sizeof (GskGLRenderModelview), 16);
clips_init (&job->clip);
modelviews_init (&job->modelview);
job->framebuffer = framebuffer;
job->clear_framebuffer = !!clear_framebuffer;
job->default_framebuffer = default_framebuffer;
@@ -4545,16 +4575,16 @@ gsk_gl_render_job_free (GskGLRenderJob *job)
job->current_modelview = NULL;
job->current_clip = NULL;
while (job->modelview->len > 0)
while (job->modelview.end > job->modelview.start)
{
GskGLRenderModelview *modelview = &g_array_index (job->modelview, GskGLRenderModelview, job->modelview->len-1);
GskGLRenderModelview *modelview = job->modelview.end-1;
g_clear_pointer (&modelview->transform, gsk_transform_unref);
job->modelview->len--;
job->modelview.end--;
}
g_clear_object (&job->driver);
g_clear_pointer (&job->region, cairo_region_destroy);
g_clear_pointer (&job->modelview, g_array_unref);
g_clear_pointer (&job->clip, g_array_unref);
modelviews_clear (&job->modelview);
clips_clear (&job->clip);
g_free (job);
}
+3 -3
View File
@@ -75,10 +75,10 @@ void main() {
if (offset < next_offset) {
float f = (offset - curr_offset) / (next_offset - curr_offset);
vec4 curr_color = gsk_premultiply(get_color(i));
vec4 next_color = gsk_premultiply(get_color(i + 1));
vec4 curr_color = get_color(i);
vec4 next_color = get_color(i + 1);
vec4 color = mix(curr_color, next_color, f);
gskSetScaledOutputColor(color, u_alpha);
gskSetScaledOutputColor(gsk_premultiply(color), u_alpha);
return;
}
}
+3 -3
View File
@@ -97,10 +97,10 @@ void main() {
if (offset < next_offset) {
float f = (offset - curr_offset) / (next_offset - curr_offset);
vec4 curr_color = gsk_premultiply(get_color(i));
vec4 next_color = gsk_premultiply(get_color(i + 1));
vec4 curr_color = get_color(i);
vec4 next_color = get_color(i + 1);
vec4 color = mix(curr_color, next_color, f);
gskSetScaledOutputColor(color, u_alpha);
gskSetScaledOutputColor(gsk_premultiply (color), u_alpha);
return;
}
}
+2
View File
@@ -28,6 +28,8 @@ gsk_rounded_rect_shrink (GskRoundedRect r, vec4 amount)
if (r.corner_points1.zw == r.bounds.zy) new_corner_points1.zw = new_bounds.zy;
if (r.corner_points2.xy == r.bounds.zw) new_corner_points2.xy = new_bounds.zw;
if (r.corner_points2.zw == r.bounds.xw) new_corner_points2.zw = new_bounds.xw;
new_corner_points1 = clamp (new_corner_points1, new_bounds.xyxy, new_bounds.zwzw);
new_corner_points2 = clamp (new_corner_points2, new_bounds.xyxy, new_bounds.zwzw);
return GskRoundedRect (new_bounds, new_corner_points1, new_corner_points2);
}
+3 -3
View File
@@ -77,10 +77,10 @@ void main() {
if (offset < next_offset) {
float f = (offset - curr_offset) / (next_offset - curr_offset);
vec4 curr_color = gsk_premultiply(get_color(i));
vec4 next_color = gsk_premultiply(get_color(i + 1));
vec4 curr_color = get_color(i);
vec4 next_color = get_color(i + 1);
vec4 color = mix(curr_color, next_color, f);
gskSetScaledOutputColor(color, u_alpha);
gskSetScaledOutputColor(gsk_premultiply(color), u_alpha);
return;
}
}
+12 -7
View File
@@ -287,15 +287,21 @@ gsk_render_node_alloc (GskRenderNodeType node_type)
* Returns: (transfer full): the `GskRenderNode` with an additional reference
*/
GskRenderNode *
gsk_render_node_ref (GskRenderNode *node)
(gsk_render_node_ref) (GskRenderNode *node)
{
g_return_val_if_fail (GSK_IS_RENDER_NODE (node), NULL);
g_atomic_ref_count_inc (&node->ref_count);
return node;
return _gsk_render_node_ref (node);
}
void
_gsk_render_node_unref (GskRenderNode *node)
{
if G_UNLIKELY (g_atomic_ref_count_dec (&node->ref_count))
GSK_RENDER_NODE_GET_CLASS (node)->finalize (node);
}
/**
* gsk_render_node_unref:
* @node: (transfer full): a `GskRenderNode`
@@ -306,12 +312,11 @@ gsk_render_node_ref (GskRenderNode *node)
* freed.
*/
void
gsk_render_node_unref (GskRenderNode *node)
(gsk_render_node_unref) (GskRenderNode *node)
{
g_return_if_fail (GSK_IS_RENDER_NODE (node));
if (g_atomic_ref_count_dec (&node->ref_count))
GSK_RENDER_NODE_GET_CLASS (node)->finalize (node);
_gsk_render_node_unref (node);
}
+55 -36
View File
@@ -245,6 +245,13 @@ gsk_linear_gradient_node_draw (GskRenderNode *node,
if (gsk_render_node_get_node_type (node) == GSK_REPEATING_LINEAR_GRADIENT_NODE)
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_REPEAT);
if (self->stops[0].offset > 0.0)
cairo_pattern_add_color_stop_rgba (pattern,
0.0,
self->stops[0].color.red,
self->stops[0].color.green,
self->stops[0].color.blue,
self->stops[0].color.alpha);
for (i = 0; i < self->n_stops; i++)
{
cairo_pattern_add_color_stop_rgba (pattern,
@@ -254,6 +261,13 @@ gsk_linear_gradient_node_draw (GskRenderNode *node,
self->stops[i].color.blue,
self->stops[i].color.alpha);
}
if (self->stops[self->n_stops-1].offset < 1.0)
cairo_pattern_add_color_stop_rgba (pattern,
1.0,
self->stops[self->n_stops-1].color.red,
self->stops[self->n_stops-1].color.green,
self->stops[self->n_stops-1].color.blue,
self->stops[self->n_stops-1].color.alpha);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
@@ -559,13 +573,29 @@ gsk_radial_gradient_node_draw (GskRenderNode *node,
else
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_PAD);
for (i = 0; i < self->n_stops; i++)
if (self->stops[0].offset > 0.0)
cairo_pattern_add_color_stop_rgba (pattern,
self->stops[i].offset,
self->stops[i].color.red,
self->stops[i].color.green,
self->stops[i].color.blue,
self->stops[i].color.alpha);
0.0,
self->stops[0].color.red,
self->stops[0].color.green,
self->stops[0].color.blue,
self->stops[0].color.alpha);
for (i = 0; i < self->n_stops; i++)
{
cairo_pattern_add_color_stop_rgba (pattern,
self->stops[i].offset,
self->stops[i].color.red,
self->stops[i].color.green,
self->stops[i].color.blue,
self->stops[i].color.alpha);
}
if (self->stops[self->n_stops-1].offset < 1.0)
cairo_pattern_add_color_stop_rgba (pattern,
1.0,
self->stops[self->n_stops-1].color.red,
self->stops[self->n_stops-1].color.green,
self->stops[self->n_stops-1].color.blue,
self->stops[self->n_stops-1].color.alpha);
gsk_cairo_rectangle (cr, &node->bounds);
cairo_translate (cr, self->center.x, self->center.y);
@@ -1805,6 +1835,7 @@ gsk_texture_scale_node_draw (GskRenderNode *node,
cairo_matrix_init_scale (&matrix,
gdk_texture_get_width (self->texture) / node->bounds.size.width,
gdk_texture_get_height (self->texture) / node->bounds.size.height);
cairo_matrix_translate (&matrix, -node->bounds.origin.x, -node->bounds.origin.y);
cairo_pattern_set_matrix (pattern, &matrix);
cairo_pattern_set_filter (pattern, filters[self->filter]);
@@ -1812,23 +1843,15 @@ gsk_texture_scale_node_draw (GskRenderNode *node,
cairo_pattern_destroy (pattern);
cairo_surface_destroy (surface);
cairo_rectangle (cr2, 0, 0, node->bounds.size.width, node->bounds.size.height);
gsk_cairo_rectangle (cr2, &node->bounds);
cairo_fill (cr2);
cairo_destroy (cr2);
cairo_save (cr);
pattern = cairo_pattern_create_for_surface (surface2);
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_PAD);
cairo_matrix_init_identity (&matrix);
cairo_matrix_translate (&matrix,
-node->bounds.origin.x,
-node->bounds.origin.y);
cairo_pattern_set_matrix (pattern, &matrix);
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_set_source_surface (cr, surface2, 0, 0);
cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_PAD);
cairo_surface_destroy (surface2);
gsk_cairo_rectangle (cr, &node->bounds);
@@ -3838,11 +3861,12 @@ gsk_color_matrix_node_class_init (gpointer g_class,
* Creates a `GskRenderNode` that will drawn the @child with
* @color_matrix.
*
* In particular, the node will transform the operation
* In particular, the node will transform colors by applying
*
* pixel = color_matrix * pixel + color_offset
* pixel = transpose(color_matrix) * pixel + color_offset
*
* for every pixel.
* for every pixel. The transformation operates on unpremultiplied
* colors, with color components ordered R, G, B, A.
*
* Returns: (transfer full) (type GskColorMatrixNode): A new `GskRenderNode`
*/
@@ -4401,18 +4425,8 @@ gsk_shadow_node_draw (GskRenderNode *node,
cairo_t *cr)
{
GskShadowNode *self = (GskShadowNode *) node;
cairo_pattern_t *pattern;
gsize i;
cairo_save (cr);
/* clip so the push_group() creates a small surface */
gsk_cairo_rectangle (cr, &self->child->bounds);
cairo_clip (cr);
cairo_push_group (cr);
gsk_render_node_draw (self->child, cr);
pattern = cairo_pop_group (cr);
cairo_restore (cr);
cairo_save (cr);
/* clip so the blur area stays small */
gsk_cairo_rectangle (cr, &node->bounds);
@@ -4421,27 +4435,32 @@ gsk_shadow_node_draw (GskRenderNode *node,
for (i = 0; i < self->n_shadows; i++)
{
GskShadow *shadow = &self->shadows[i];
cairo_pattern_t *pattern;
/* We don't need to draw invisible shadows */
if (gdk_rgba_is_clear (&shadow->color))
continue;
cairo_save (cr);
gdk_cairo_set_source_rgba (cr, &shadow->color);
cr = gsk_cairo_blur_start_drawing (cr, shadow->radius, GSK_BLUR_X | GSK_BLUR_Y);
cairo_save (cr);
cairo_translate (cr, shadow->dx, shadow->dy);
cairo_push_group (cr);
gsk_render_node_draw (self->child, cr);
pattern = cairo_pop_group (cr);
gdk_cairo_set_source_rgba (cr, &shadow->color);
cairo_mask (cr, pattern);
cairo_pattern_destroy (pattern);
cairo_restore (cr);
cr = gsk_cairo_blur_finish_drawing (cr, shadow->radius, &shadow->color, GSK_BLUR_X | GSK_BLUR_Y);
cairo_restore (cr);
}
cairo_set_source (cr, pattern);
cairo_paint (cr);
cairo_restore (cr);
gsk_render_node_draw (self->child, cr);
cairo_pattern_destroy (pattern);
cairo_restore (cr);
}
static void
@@ -4562,7 +4581,7 @@ gsk_shadow_node_new (GskRenderNode *child,
self = gsk_render_node_alloc (GSK_SHADOW_NODE);
node = (GskRenderNode *) self;
node->offscreen_for_opacity = child->offscreen_for_opacity;
node->offscreen_for_opacity = TRUE;
self->child = gsk_render_node_ref (child);
self->n_shadows = n_shadows;
+13 -3
View File
@@ -2856,8 +2856,18 @@ base64_encode_with_linebreaks (const guchar *data,
+1 is needed for trailing \0, also check for unlikely integer overflow */
g_return_val_if_fail (len < ((G_MAXSIZE - 1) / 4 - 1) * 3, NULL);
max = (len / 3 + 1) * 4 + 1;
max += 2 * (max / 76);
/* The glib docs say:
*
* The output buffer must be large enough to fit all the data that will
* be written to it. Due to the way base64 encodes you will need
* at least: (@len / 3 + 1) * 4 + 4 bytes (+ 4 may be needed in case of
* non-zero state). If you enable line-breaking you will need at least:
* ((@len / 3 + 1) * 4 + 4) / 76 + 1 bytes of extra space.
*/
max = (len / 3 + 1) * 4;
max += ((len / 3 + 1) * 4 + 4) / 76 + 1;
/* and the null byte */
max += 1;
out = g_malloc (max);
@@ -3019,7 +3029,7 @@ gsk_text_node_serialize_glyphs (GskRenderNode *node,
string_append_double (p, (double) glyphs[i].geometry.y_offset / PANGO_SCALE);
if (!glyphs[i].attr.is_cluster_start)
g_string_append (p, " same-cluster");
if (!glyphs[i].attr.is_color)
if (glyphs[i].attr.is_color)
g_string_append (p, " color");
}
+14
View File
@@ -21,6 +21,9 @@ extern GType gsk_render_node_types[];
#define GSK_IS_RENDER_NODE_TYPE(node,type) \
(G_TYPE_INSTANCE_GET_CLASS ((node), GSK_TYPE_RENDER_NODE, GskRenderNodeClass)->node_type == (type))
#define GSK_RENDER_NODE_TYPE(node) \
(G_TYPE_INSTANCE_GET_CLASS ((node), GSK_TYPE_RENDER_NODE, GskRenderNodeClass)->node_type)
struct _GskRenderNode
{
GTypeInstance parent_instance;
@@ -57,6 +60,8 @@ GType gsk_render_node_type_register_static (const char
gpointer gsk_render_node_alloc (GskRenderNodeType node_type);
void _gsk_render_node_unref (GskRenderNode *node);
gboolean gsk_render_node_can_diff (const GskRenderNode *node1,
const GskRenderNode *node2) G_GNUC_PURE;
void gsk_render_node_diff (GskRenderNode *node1,
@@ -87,6 +92,15 @@ gboolean gsk_container_node_is_disjoint (const GskRenderNode
gboolean gsk_render_node_use_offscreen_for_opacity (const GskRenderNode *node);
#define gsk_render_node_ref(node) _gsk_render_node_ref(node)
#define gsk_render_node_unref(node) _gsk_render_node_unref(node)
static inline GskRenderNode *
_gsk_render_node_ref (GskRenderNode *node)
{
g_atomic_ref_count_inc (&node->ref_count);
return node;
}
G_END_DECLS
+24 -13
View File
@@ -46,22 +46,12 @@
#include <math.h>
static void
gsk_rounded_rect_normalize_in_place (GskRoundedRect *self)
static float
gsk_rounded_rect_get_corner_scale_factor (GskRoundedRect *self)
{
float factor = 1.0;
float corners;
guint i;
graphene_rect_normalize (&self->bounds);
for (i = 0; i < 4; i++)
{
self->corner[i].width = MAX (self->corner[i].width, 0);
self->corner[i].height = MAX (self->corner[i].height, 0);
}
/* clamp border radius, following CSS specs */
corners = self->corner[GSK_CORNER_TOP_LEFT].width + self->corner[GSK_CORNER_TOP_RIGHT].width;
if (corners > self->bounds.size.width)
factor = MIN (factor, self->bounds.size.width / corners);
@@ -78,6 +68,26 @@ gsk_rounded_rect_normalize_in_place (GskRoundedRect *self)
if (corners > self->bounds.size.height)
factor = MIN (factor, self->bounds.size.height / corners);
return factor;
}
static void
gsk_rounded_rect_normalize_in_place (GskRoundedRect *self)
{
float factor;
guint i;
graphene_rect_normalize (&self->bounds);
for (i = 0; i < 4; i++)
{
self->corner[i].width = MAX (self->corner[i].width, 0);
self->corner[i].height = MAX (self->corner[i].height, 0);
}
/* clamp border radius, following CSS specs */
factor = gsk_rounded_rect_get_corner_scale_factor (self);
for (i = 0; i < 4; i++)
graphene_size_scale (&self->corner[i], factor, &self->corner[i]);
}
@@ -812,7 +822,8 @@ gsk_rounded_rect_intersection (const GskRoundedRect *a,
check_corner (a, b,
GSK_CORNER_BOTTOM_RIGHT,
right, bottom,
result))
result) &&
gsk_rounded_rect_get_corner_scale_factor (result) >= 1.0)
return GSK_INTERSECTION_NONEMPTY;
return GSK_INTERSECTION_NOT_REPRESENTABLE;
+2 -1
View File
@@ -857,7 +857,8 @@ normalize_angle (float angle)
* @next: (nullable) (transfer full): the next transform
* @angle: the rotation angle, in degrees (clockwise)
*
* Rotates @next @angle degrees in 2D - or in 3D-speak, around the z axis.
* Rotates @next @angle degrees in 2D - or in 3D-speak, around the Z axis.
* The rotation happens around the origin point of (0, 0).
*
* Returns: (nullable): The new transform
*/
+1 -6
View File
@@ -97,10 +97,6 @@ if have_vulkan
endif
gsk_private_vulkan_shaders = []
# This is an odd split because we use configure_file() below to workaround
# a limitation in meson preventing using custom_target() with gnome.compile_resources()
# and that requires file paths, but we also need to have dependencies during development
# on constantly regenerated files.
gsk_private_vulkan_compiled_shaders = []
gsk_private_vulkan_compiled_shaders_deps = []
gsk_private_vulkan_shader_headers = []
@@ -148,7 +144,7 @@ if get_variable('broadway_enabled')
])
endif
gsk_resources_xml = configure_file(output: 'gsk.resources.xml',
gsk_resources_xml = custom_target(output: 'gsk.resources.xml',
input: 'gen-gsk-gresources-xml.py',
command: [
find_program('gen-gsk-gresources-xml.py'),
@@ -184,7 +180,6 @@ gsk_deps = [
pango_dep,
cairo_dep,
cairo_csi_dep,
pixbuf_dep,
libgdk_dep,
]
+1 -1
View File
@@ -18,7 +18,7 @@
#pragma once
#include <gdk/gdk.h>
#include <gsk/gskrenderer.h>
#include <gsk/gsk.h>
#ifdef GDK_RENDERING_VULKAN
+7 -7
View File
@@ -93,12 +93,12 @@ foreach shader: gsk_private_vulkan_shaders
endforeach
foreach shader: gsk_private_vulkan_vertex_shaders
shader_header = configure_file(output: '@0@.h'.format(shader),
input: shader,
command: [
find_program('generate-header.py'),
'@INPUT@',
],
capture: true)
shader_header = custom_target(output: '@0@.h'.format(shader),
input: shader,
command: [
find_program('generate-header.py'),
'@INPUT@',
],
capture: true)
gsk_private_vulkan_shader_headers += shader_header
endforeach
+3
View File
@@ -290,6 +290,9 @@ gtk_color_button_init (GtkColorButton *button)
button->button = gtk_button_new ();
g_signal_connect (button->button, "clicked", G_CALLBACK (gtk_color_button_clicked), button);
g_object_bind_property (button, "focus-on-click",
button->button, "focus-on-click",
0);
gtk_widget_set_parent (button->button, GTK_WIDGET (button));
button->swatch = g_object_new (GTK_TYPE_COLOR_SWATCH,
+4 -2
View File
@@ -454,7 +454,8 @@ gtk_dialog_constructed (GObject *object)
}
g_list_free (children);
_gtk_header_bar_track_default_decoration (GTK_HEADER_BAR (priv->headerbar));
if (GTK_IS_HEADER_BAR (priv->headerbar))
_gtk_header_bar_track_default_decoration (GTK_HEADER_BAR (priv->headerbar));
}
else
{
@@ -1397,7 +1398,8 @@ gtk_dialog_buildable_add_child (GtkBuildable *buildable,
else if (g_str_equal (type, "titlebar"))
{
priv->headerbar = GTK_WIDGET (child);
_gtk_header_bar_track_default_decoration (GTK_HEADER_BAR (priv->headerbar));
if (GTK_IS_HEADER_BAR (priv->headerbar))
_gtk_header_bar_track_default_decoration (GTK_HEADER_BAR (priv->headerbar));
gtk_window_set_titlebar (GTK_WINDOW (buildable), priv->headerbar);
}
else if (g_str_equal (type, "action"))
+3
View File
@@ -594,6 +594,9 @@ gtk_font_button_init (GtkFontButton *font_button)
font_button->button = gtk_button_new ();
g_signal_connect (font_button->button, "clicked", G_CALLBACK (gtk_font_button_clicked), font_button);
g_object_bind_property (font_button, "focus-on-click",
font_button->button, "focus-on-click",
0);
font_button->font_label = gtk_label_new (_("Font"));
gtk_widget_set_hexpand (font_button->font_label, TRUE);
font_button->size_label = gtk_label_new ("14");
+2
View File
@@ -734,10 +734,12 @@ gtk_tree_model_filter_build_level (GtkTreeModelFilter *filter,
g_assert (filter->priv->child_model != NULL);
/* Avoid building a level that already exists */
#ifndef G_DISABLE_ASSERT
if (parent_level)
g_assert (parent_elt->children == NULL);
else
g_assert (filter->priv->root == NULL);
#endif
if (filter->priv->in_row_deleted)
return;
+6
View File
@@ -12834,6 +12834,12 @@ gtk_tree_view_is_blank_at_pos (GtkTreeView *tree_view,
gtk_tree_model_get_iter (priv->model, &iter, real_path);
_gtk_tree_view_find_node (tree_view, real_path, &tree, &node);
if (node == NULL)
{
if (!path)
gtk_tree_path_free (real_path);
return TRUE;
}
/* Check if there's an expander arrow at (x, y) */
if (real_column == priv->expander_column
+4 -4
View File
@@ -937,13 +937,13 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
if ((!alternative && priv->sort_order == GTK_SORT_ASCENDING) ||
(alternative && priv->sort_order == GTK_SORT_DESCENDING))
{
gtk_widget_remove_css_class (arrow, "descending");
gtk_widget_add_css_class (arrow, "ascending");
gtk_widget_remove_css_class (arrow, "ascending");
gtk_widget_add_css_class (arrow, "descending");
}
else
{
gtk_widget_remove_css_class (arrow, "ascending");
gtk_widget_add_css_class (arrow, "descending");
gtk_widget_remove_css_class (arrow, "descending");
gtk_widget_add_css_class (arrow, "ascending");
}
}
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.

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