Compare commits

...

3599 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
Matthias Clasen
fef69881a7 4.12.0 2023-08-05 00:01:26 -04:00
Matthias Clasen
be0eaa64ed Merge branch 'matthiasc/for-main' into 'main'
build: Rename docs build options

See merge request GNOME/gtk!6239
2023-08-05 03:37:05 +00:00
Matthias Clasen
62087b1ab5 README: Some updates 2023-08-04 22:30:13 -04:00
Matthias Clasen
6af55a31d7 build: Rename docs build options
Rename gtk_doc to documentation and update_screenshots
to screenshots. The old names are still accepted.
2023-08-04 22:30:13 -04:00
Matthias Clasen
8e57818a52 Merge branch 'wip/otte/scroll-to' into 'main'
a scroll_to() for list widgets

See merge request GNOME/gtk!6227
2023-08-05 02:20:38 +00:00
Benjamin Otte
a447c439f4 inspector: Use scroll_to() in the object tree search 2023-08-05 03:51:55 +02:00
Benjamin Otte
2120ef38d9 columnview: Implement gtk_column_view_scroll_to()
It's basically the listview version, but with an (optional) column to do
cell-based scrolling/focusing.
2023-08-05 03:51:54 +02:00
Matthias Clasen
6077ea4f48 Add gtk_grid_view_scroll_to
This does the same as gtk_list_view_scroll_to, just
for a grid view.
2023-08-05 03:51:53 +02:00
Benjamin Otte
c278c78378 gtk-demo: Make arrowing in suggestionentry scroll the dropdown 2023-08-05 03:51:53 +02:00
Benjamin Otte
b64dc75e3a listview: Implement gtk_list_view_scroll_to()
This adds a flags enum so we can also do select/focus at the same time.

It's implemented in GtkListBase, so adding support forgridview should be
easy.
2023-08-05 03:51:53 +02:00
Benjamin Otte
447c07bf5e viewport: Use gtk_viewport_scroll_to() for focus scrolling 2023-08-05 03:51:51 +02:00
Benjamin Otte
2a5f1dc6c7 viewport: Add gtk_viewport_scroll_to()
First implementation of GtkScrollInfo
2023-08-05 03:51:50 +02:00
Benjamin Otte
105be5a457 gtk: Add GtkScrollInfo
This struct carries information about scrolling a scrollable, so that
individual scrollables can share this struct for their scrolling APIs.

For now, there's not much information here, we're still trying to cook
up an API that works well.
2023-08-05 03:51:50 +02:00
Matthias Clasen
0b6b6b0984 Merge branch 'format' into 'main'
adjustment: Properly use <code> tag

See merge request GNOME/gtk!6238
2023-08-05 00:20:21 +00:00
Hari Rana
a0429c8218 adjustment: Properly use <code> tag 2023-08-04 19:51:22 -04:00
Yuri Chornoivan
56649007d0 Update Ukrainian translation 2023-08-04 19:43:39 +00:00
Matthias Clasen
42d0590d80 Merge branch 'more-deprecation-cleanup' into 'main'
Drop old style deprecation handling

See merge request GNOME/gtk!6237
2023-08-04 14:57:30 +00:00
Matthias Clasen
ce4fbcef8e examples: More deprecation cleanup
Remove GtkDialog use from bloatpad.
2023-08-04 09:47:49 -04:00
Matthias Clasen
7c8171f069 Drop old style deprecation handling
We don't use this anymore.
2023-08-04 08:38:55 -04:00
Matthias Clasen
33fe93d9f2 examples: Deprecation cleanup 2023-08-04 08:38:00 -04:00
Matthias Clasen
a8d092f978 Merge branch 'matthiasc/for-main' into 'main'
wayland: Fix gtk-shell protocol handling

See merge request GNOME/gtk!6236
2023-08-04 12:34:30 +00:00
Matthias Clasen
645043d5a2 wayland: Fix gtk-shell protocol handling
The protocol spec isn't clear about the relationship
between the capability enum and the uint in the capability
event.

Fix things to use the same relationship as mutter.
2023-08-04 07:57:33 -04:00
Matthias Clasen
c6693b7fb7 Merge branch 'matthiasc/for-main' into 'main'
build: Set the default visibility

See merge request GNOME/gtk!6235
2023-08-04 11:48:10 +00:00
Matthias Clasen
5c4bb1f93b build: Set the default visibility
While working on deprecation cleanups, I noticed
that removing GDK_DEPRECATED_IN... from headers
does not have the effect of making the symbols
disappear, since we were forgetting to set the
default visibility to hidden.
2023-08-04 06:15:13 -04:00
Matthias Clasen
d05628c66a testsuite: Don't rely on default visibility
The builder test was relying on default visiblity
for non-static functions. Make it explicit that we
want to export these functions, so the test keeps
working when we change the default visibility.
2023-08-04 06:15:13 -04:00
Matthias Clasen
0e2db8090b Merge branch 'deprecation-cleanups' into 'main'
gtk-demo: Deprecation cleanup

See merge request GNOME/gtk!6233
2023-08-04 02:34:10 +00:00
Matthias Clasen
b4ab398e0d constraint-editor: Deprecation cleanup
Drop all uses of deprecated API.
2023-08-03 22:15:27 -04:00
Matthias Clasen
26018107d6 print-editor: Deprecation cleanup
Drop all uses of deprecated API.
2023-08-03 22:15:27 -04:00
Matthias Clasen
3e066a0a15 gtk-demo: Deprecation cleanup
Remove many uses of deprecated api in gtk4-demo.

Remaining uses are demos of wholly deprecated objects
that will just be dropped in GTK5.
2023-08-03 22:15:27 -04:00
Matthias Clasen
23222a97fc Merge branch 'wip/alice/center-layout' into 'main'
centerlayout: Fix child sizing

See merge request GNOME/gtk!6234
2023-08-04 01:10:09 +00:00
Alice Mikhaylenko
d4a5872fb0 centerlayout: Invert :shrink-center-last
Make what it does match its name.
2023-08-04 04:34:48 +04:00
Alice Mikhaylenko
24714cb91c centerlayout: Fix child sizing
For some reason the start/end child size is restricted to
(width - title width) / 2. This is generally unexpected, so stop doing
that.
2023-08-04 02:00:28 +04:00
Artur So
b51d8a22ef Update Russian translation 2023-08-03 16:06:21 +00:00
Matthias Clasen
aa0afab960 Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Use GtkBuilderScope more

See merge request GNOME/gtk!6232
2023-08-03 14:39:56 +00:00
Matthias Clasen
111269019f Merge branch 'bilelmoussaoui/gi' into 'main'
gtk: Add missing since annotations

See merge request GNOME/gtk!6231
2023-08-03 13:43:27 +00:00
Matthias Clasen
f0d974c6f5 AUTHORS: Some updates 2023-08-02 20:14:02 +00:00
Matthias Clasen
d30adc48d4 RELEASE-HOWTO: Some updates 2023-08-02 20:07:00 +00:00
Matthias Clasen
40d3b30770 gtk-demo: Use GtkBuilderScope more
Under circumstances I haven't fully tracked down,
these demos refuse to run, failing to locate their
callbacks. So use the machinery we have, and set up
a GtkBuilderCScope for each of the problematic cases.
2023-08-02 19:49:03 +00:00
Bilal Elmoussaoui
2e7291d0e7 gtk: Add missing since annotations
Follow up of 7f946eff01
2023-08-02 18:19:23 +00:00
Matthias Clasen
48d1dfd195 Merge branch 'gdk-win32-cleanup' into 'main'
GdkWin32 cleanup

See merge request GNOME/gtk!6230
2023-08-02 17:09:41 +00:00
Matthias Clasen
caeccfd2da Merge branch 'cetner-layout-compute-expand' into 'main'
Fix computing expand in GtkCenterLayout

See merge request GNOME/gtk!6229
2023-08-02 16:24:46 +00:00
Luca Bacci
a9082fa5fa GdkWin32: Remove unused members from GdkWin32Surface 2023-08-02 18:08:31 +02:00
Luca Bacci
eb10af0dac GdkWin32: No need to set the active keyboard layout
It's already done as part of GdkWin32Keymap initialization
(in update_keymap ())
2023-08-02 18:08:31 +02:00
Luca Bacci
3387dc8ec3 GdkWin32: Remove gdk_synchronize 2023-08-02 18:08:10 +02:00
Matthias Clasen
f663617724 Merge branch 'ebassi/hint-font-lodpi' into 'main'
Enable subpixel positioning for text only on high scaling factors

See merge request GNOME/gtk!6190
2023-08-02 15:56:08 +00:00
Sergey Bugaev
b42760da4d centerlayout: Fix computing expand
It was calling get_hexpand () / get_vexpand (), which only get whether
the expand properties are set on the widget itself. Use
compute_expand (), which properly walks the widget tree and finds
whether exapnd is set on the widget or any of its descendants.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-08-02 18:43:45 +03:00
Matthias Clasen
ea72e7e5b3 reftests: Fix one reftest
The xalign property of GtkLabel defaults to 0.5,
meaning that the contents will be centered, which
is not what GtkInscription does.
2023-08-02 16:32:40 +01:00
Matthias Clasen
a51003661e label: Another tweak to wrapping handling
This fixes a few reftests that were failing after
the previous change because they ended up with x == -1.
2023-08-02 16:32:15 +01:00
Matthias Clasen
f13c8a3cb4 Merge branch 'radioactiveman-main-patch-77429' into 'main'
docs: Fix typo

See merge request GNOME/gtk!6226
2023-08-02 03:25:19 +00:00
Thomas Lange
51e617daf3 docs: Fix typo 2023-08-01 23:51:34 +00:00
Matthias Clasen
f9f96637d7 Merge branch 'wip/sophie-h/ask' into 'main'
filelauncher: Add 'ask' property

Closes #5942

See merge request GNOME/gtk!6225
2023-08-01 19:52:51 +00:00
Sophie Herold
1df5857b07 filelauncher: Add 'always-ask' property
The 'ask' property is part of the portal. It forces always asking
the user with which app to open a file.

Closes #5942
2023-08-01 20:39:20 +02:00
Danial Behzadi
d637398ab0 Update Persian translation 2023-08-01 05:53:37 +00:00
Ekaterine Papava
20ead71c0b Update Georgian translation 2023-08-01 04:05:01 +00:00
Benjamin Otte
abcfa21c12 Merge branch 'wip/otte/vulkan-for-main' into 'main'
inspector: Make the measure map buttons work again

Closes #5992

See merge request GNOME/gtk!6223
2023-07-31 22:52:46 +00:00
Benjamin Otte
424c4b4150 inspector: Make the measure map buttons work again
The show/hide => set_visible() cleanups had broken things.

Fixes #5992
2023-08-01 00:14:53 +02:00
Benjamin Otte
5d18ea621d Merge branch 'wip/otte/vulkan-for-main' into 'main'
vulkan: Remove unused variable

See merge request GNOME/gtk!6222
2023-07-31 15:14:37 +00:00
Benjamin Otte
e00e6f3d5d vulkan: Clear Cairo surfaces on upload
The memory isn't guaranteed to be all zeroes and we don't want glitches.
2023-07-31 16:51:03 +02:00
Benjamin Otte
e98ae233fc vulkan: Fix a memleak 2023-07-31 16:51:03 +02:00
Benjamin Otte
2ad11e12d4 vulkan: Plug a memleak
Yay, we no longer leak swapchain images
2023-07-31 16:51:03 +02:00
Benjamin Otte
3f16f7e0d4 rendernode-tool: Add another magic format
Make .svg use the Cairo renderer to save to an SVG file.

It's useful when comparing rendering behavior and times with
web browsers (as long as one is aware that browsers build a full
DOM tree out of those SVGs).
2023-07-31 16:51:03 +02:00
Benjamin Otte
166777dd55 rendernode-tool: Move code
No functional changes yet.
2023-07-31 16:51:03 +02:00
Benjamin Otte
c8f385e3bc vulkancontext: Do proper refcounting
- fix a memleak
- call unref() instead of new()
- remove idle handler on dispose

What was I doing when I wrote the pipeline cache code?
2023-07-31 16:51:03 +02:00
Benjamin Otte
89b4f12b38 vulkan: Plug a memleak 2023-07-31 16:51:03 +02:00
Benjamin Otte
ae509406f1 memorytexture: Add a check
Sophie Herold was running into this problem while coding, so let's help
people by catching it early.
2023-07-31 16:51:03 +02:00
Benjamin Otte
1aa7f18b23 vulkan: Remove unused variable
It's only used when printing debug stuff. Debug stuff is not that
important.
2023-07-31 16:51:03 +02:00
Benjamin Otte
cf39c80fe2 docs: Update for recent rendernode-tool changes 2023-07-31 16:51:03 +02:00
Danial Behzadi
24fe66a5f3 Update Persian translation 2023-07-30 23:15:41 +00:00
Balázs Úr
51b786b799 Update Hungarian translation 2023-07-30 20:52:37 +00:00
Matthias Clasen
9685030632 Merge branch 'gtk-wip/inactive-state' into 'main'
gtk: Add suspended window state

See merge request GNOME/gtk!6221
2023-07-30 11:39:49 +00:00
Emmanuele Bassi
09be7f65d5 Add a single test runner
Running the whole test suite is not fun, and the magic incantations for
running a specific backend are too complicated to remember.
2023-07-30 13:29:36 +03:00
Emmanuele Bassi
2f4d931d0d label: Let Pango align the layout
Just like GtkInscription does since commit 883011f2. The layout offsets
are maintained as floats, and only converted to integers when exposing
them to callers.
2023-07-30 13:26:27 +03:00
Emmanuele Bassi
61df8d941b Fix indentation in GtkInscription 2023-07-30 13:25:50 +03:00
Matthias Clasen
327c93066d build: Don't require bleeding-edge wayland-protocols
The 1.32 wayland-protocols release is not in distribution
builds yet, so a hard dependency on it is not helpful.
2023-07-30 11:40:09 +03:00
Jonas Ådahl
7f946eff01 gtk: Add suspended window state
This is implemented using a new xdg_toplevel `suspended` state, and is
meant for allowing applications to know when they can stop doing
unnecessary work and thus save power.

In the other backends, the `suspended` state is set at the same time as
`minimized` as it's the closest there is to traditional windowing
systems.
2023-07-30 11:40:09 +03:00
Benjamin Otte
03a8b9cf17 Merge branch 'no-list-items' into 'main'
listitemmanager: Handle null roots in get_nearest_tile

Closes #5970

See merge request GNOME/gtk!6220
2023-07-29 23:15:13 +00:00
Emmanuele Bassi
ba89a22a4d Enable subpixel positioning for text only on high scaling factors
With our current font rendering stack, subpixel positioning simply does
not look good on non-HiDPI displays compared to font hinting.

While we have a setting as a way to restore font hinting, it's fairly
clunky to use with sandboxed applications, since it requires injecting a
settings.ini file in every application's configuration directory, or
adding the user's own configuration directory into the sandbox.

As a workaround, we can check the scaling factor used by GTK, and only
enable subpixel positioning if the factor is greater than one.
2023-07-29 11:14:57 +03:00
tszymanski
657c018242 listitemmanager: Handle null roots in get_nearest_tile
Rubberbanding still fails with "No item" warnings, but it no longer
crashes.

Closes #5970
2023-07-28 19:12:46 -07:00
Danial Behzadi
83db8e41a6 Update Persian translation 2023-07-29 01:58:52 +00:00
Yuri Chornoivan
57e7112781 Update Ukrainian translation 2023-07-28 17:32:38 +00:00
Yuri Chornoivan
96f92ee207 Update Ukrainian translation 2023-07-28 17:31:22 +00:00
Matthias Clasen
5c8bd49383 Merge branch 'matthiasc/for-main' into 'main'
glyph cache: Add debug output

See merge request GNOME/gtk!6163
2023-07-28 08:51:14 +00:00
Matthias Clasen
e82bdd8c0d Merge branch 'dboles/issue5946' into 'main'
MenuSectionBox: use-markup on labels of submenus

Closes #5946

See merge request GNOME/gtk!6209
2023-07-28 08:47:33 +00:00
Yosef Or Boczko
72f52751c2 Update Hebrew translation 2023-07-28 07:13:47 +00:00
Matthias Clasen
98269a29b1 Merge branch 'fix-issue-5775-gtk4' into 'main'
GtkApplicationImplDBus: Cancel DBus method calls on shutdown

Closes #5775

See merge request GNOME/gtk!6181
2023-07-28 07:11:52 +00:00
Matthias Clasen
8bb968bc01 Merge branch 'dboles/range_highlight_with_page_size' into 'main'
Range: Fix hilight not drawn to value if page-size

Closes #5976

See merge request GNOME/gtk!6206
2023-07-28 06:13:27 +00:00
Matthias Clasen
c61313cbfe build: Check for objcopy options
Check that objcopy understands the --set-section-alignment
option that we are now using.
2023-07-28 09:06:14 +03:00
Matthias Clasen
96145ae8ed tools: Update the docs
Mention that the render command can produce png or tiff
images.
2023-07-28 09:06:14 +03:00
Benjamin Otte
1f848bf9fd rendernode-tool: Save to tiff
If the save filename ends in .tiff, save to tiff instead.

For now this is a sneaky autodetect feature, not sure if/how to make it
more explicit.
2023-07-28 09:06:14 +03:00
Matthias Clasen
7a8a27bd60 ci: Mark the clipboard test as flaky
Lets give up on trying to run this successfully
in ci. More green in more places!
2023-07-28 09:06:14 +03:00
Matthias Clasen
3e9c47e6f7 glyph cache: Add debug output
Show the size of data uploaded per glyph.
2023-07-28 09:06:14 +03:00
Matthias Clasen
69cf0a75c5 gdk: Build fix 2023-07-28 09:06:14 +03:00
Matthias Clasen
a8d3aa133c Merge branch 'wip/chergert/fix-objcopy' into 'main'
demo: use --set-section-alignment when using objcopy

See merge request GNOME/gtk!6218
2023-07-28 06:01:43 +00:00
Ekaterine Papava
e1d4385026 Update Georgian translation 2023-07-28 04:48:23 +00:00
Christian Hergert
7cc29ce236 demo: use --set-section-alignment when using objcopy
If we don't set the alignment then there is a chance that it ends up
commonly on a 4-byte boundary and GResources will have to malloc/memcpy
the static data.

With --set-section-alignment (which takes a byte offset not ^2) available
in objcopy >= 2.33 we ensure that expectation is met.
2023-07-27 17:09:43 -07:00
Matthias Clasen
f998505e27 Merge branch 'zbrown/fix-inspector' into 'main'
inspector: drop overlooked reference

See merge request GNOME/gtk!6215
2023-07-27 20:55:24 +00:00
Matthias Clasen
64f50b33e4 Merge branch 'wip/chergert/fix-inspector' into 'main'
inspector: fix runtime errors with missing widgets

Closes #5986

See merge request GNOME/gtk!6217
2023-07-26 20:16:35 +00:00
Christian Hergert
bc20af2741 inspector: fix runtime errors with missing widgets
Fixes #5986
2023-07-26 12:15:21 -07:00
Matthias Clasen
25f61dd5d5 Merge branch 'alatiera/doc-links' into 'main'
docs: getting_started: Update links to some guides

See merge request GNOME/gtk!6216
2023-07-26 12:55:31 +00:00
Jordan Petridis
0e5f2cd6f6 docs: getting_started: Update links to some guides 2023-07-26 15:37:13 +03:00
Zander Brown
5aef534871 inspector: drop overlooked reference
Fix: 0751f59ee8
2023-07-26 06:19:22 +01:00
Benjamin Otte
f0f7613adb Merge branch 'zbrown/pending' into 'main'
filterlistmodel: emit ::notify::pending after ::items-changed

See merge request GNOME/gtk!6213
2023-07-26 04:39:13 +00:00
Zander Brown
72a1bd64e6 filterlistmodel: emit ::notify::pending after ::items-changed 2023-07-26 05:03:28 +01:00
Balázs Meskó
bd1b3447c4 Update Hungarian translation
(cherry picked from commit 7a3a82749b)
2023-07-25 23:43:12 +00:00
Matthias Clasen
6653f2b4c3 Merge branch 'fix-file-dialog-assert' into 'main'
filedialog: Don't assert too much

Closes #5975

See merge request GNOME/gtk!6207
2023-07-24 21:52:57 +00:00
Matthias Clasen
b00b0902ca Merge branch 'pgriffis/fix-no-introspection-build' into 'main'
build: Fix building with introspection disabled and testsuite enabled

See merge request GNOME/gtk!6210
2023-07-24 21:11:17 +00:00
Patrick Griffis
59941930f7 build: Fix building with introspection disabled and testsuite enabled
The headless tests are written in Python and need g-i.
2023-07-23 19:30:30 -05:00
Sébastien Le Roux
c12a09d24e MenuSectionBox: use-markup on labels of submenus
To use markup label in menu items, when the menu item has a submenu.

Small additions to 'gtk/gtkmenusectionbox.c' to set the markup attribute
for menu items with submenus.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5946
2023-07-23 20:32:54 +01:00
Matthias Clasen
79721d64ad filedialog: Don't assert too much
The GtkFileDialog code was asserting that
we get exactly one file back. But the function
is nullable anyway, so lets just return NULL
if we don't have a file.

Fixes: #5975
2023-07-23 12:33:47 -04:00
Daniel Boles
62e68f72d6 Range: Fix hilight not drawn to value if page-size
If we have a non-zero Adjustment:page-size, the actual amount we draw is
reduced by that page-size. We account for this in various places, but we
did not when deciding how far to allocate the highlight widget, so we
were drawing the highlight not far enough, falling short of the value.
This fixes by subtracting the page-size from the drawn range here too.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5976
2023-07-23 11:11:40 +01:00
Benjamin Otte
0b1bcf8bee Merge branch 'wip/otte/vulkan-for-main' into 'main'
tools: No need for --force when specifying filename

See merge request GNOME/gtk!6205
2023-07-22 21:48:29 +00:00
Matthias Clasen
477fb8fdfb Merge branch 'drop-touchscreen-debug' into 'main'
Drop GTK_DEBUG_TOUCHSCREEN

Closes #5893

See merge request GNOME/gtk!6204
2023-07-22 21:48:14 +00:00
Benjamin Otte
1bd820fc60 vulkan: Clean up renderpass/offscreen creation
Instead of scale and whatnot, pass:
1. The image size
2. The viewport to map to that image size
and compute everything else from there.

In particular, we set the Vulkan viewport to the image dimensions
instead of the viewport size.

All of this makes things a lot simpler while keeping the required
functionality.
2023-07-22 23:30:15 +02:00
Benjamin Otte
a4247f1358 vulkan: Plug a memleak
This one was introduced in 4d9e7d30b0.
2023-07-22 23:30:15 +02:00
Benjamin Otte
00b5df6b06 vulkan: Plug a memleak
This one was introduced in cd84f5a56e.
2023-07-22 23:30:15 +02:00
Benjamin Otte
1e75fc35c8 tools: No need for --force when specifying filename
If people specify the filename, they should know what they're doing.

If they don't, abort if the guessed filename already exists and insist
on the user explicitly giving it.
2023-07-22 23:30:15 +02:00
Matthias Clasen
0751f59ee8 Drop GTK_DEBUG_TOUCHSCREEN
This flag was never doing much, and is only raising
the wrong expectations. Remove it.

Fixes: #5893
2023-07-22 16:43:20 -04:00
Matthias Clasen
b5b797b0aa Merge branch 'textview-keynav-backspace' into 'main'
textview: Match entry behavior for backspace

Closes #3417

See merge request GNOME/gtk!6203
2023-07-22 15:45:42 +00:00
Matthias Clasen
ddfe9f15af Merge branch 'fix-issue-5965' into 'main'
gtktextview: return early when resetting gesture / event controller

Closes #5965

See merge request GNOME/gtk!6200
2023-07-22 13:51:32 +00:00
Matthias Clasen
9929726eb2 textview: Match entry behavior for backspace
As pointed out in #3417, there is a long-standing
difference in how GtkEntry and GtkTextView treat
Ctrl-Shift-Backspace (and other variations): GtkEntry
always operates on the selection first, if it exists.
GtkTextView only handled plain Backspace that way, and
ignores the selection for other variations.

There is no good reason for this difference, so just
remove it and make GtkTextView behave the same as
GtkEntry.

Fixes: #3417
2023-07-22 09:40:17 -04:00
Ekaterine Papava
1aa6e721ae Update Georgian translation 2023-07-22 13:24:50 +00:00
Ngọc Quân Trần
87d2ce1332 Update Vietnamese translation 2023-07-22 08:54:03 +00:00
Daniel Boles
6260a33e8e Merge branch 'dboles/PopoverMenu-png' into 'main'
Fix broken image menu.png in Gtk.PopoverMenu intro

See merge request GNOME/gtk!6187
2023-07-22 08:43:25 +00:00
Daniel Boles
2024913cc2 Merge branch 'dboles/for-main' into 'main'
tools: Replace references to GTK+ with GTK no plus

See merge request GNOME/gtk!6199
2023-07-22 08:43:06 +00:00
Ngọc Quân Trần
0978a794ac Update Vietnamese translation
(cherry picked from commit e944cd8916)
2023-07-22 08:16:29 +00:00
Benjamin Otte
da51c90d5c Merge branch 'wip/otte/vulkan-for-main' into 'main'
gsk: Add gskrectprivate.h

See merge request GNOME/gtk!6201
2023-07-22 02:43:11 +00:00
Benjamin Otte
b1b8a98568 gdk: Add function to query alpha format for depth
It's meant to be used in renderers.
2023-07-22 01:33:44 +02:00
Benjamin Otte
4a8122f685 gdk: Make A8 and A16 formats premultiplied
The relevant question here is about details, because we have to choose
if we declare alpha-only formats as having their (nonexistant) color
channels premultiplied or not, so that the code paths using them can do
the right thing.

Because we are premultiplied by default, it makes sense to treat alpha
like that, because then the alpha-only code doesn't need to do
workarounds for straight alpha.

Where this is relevant of course is when expanding the alpha channel
into color channels, where we want to end up with white.
So make sure we do color = alpha there instead of color = 1 like we did
before.
2023-07-22 01:33:44 +02:00
Benjamin Otte
7a58439977 memoryformat: Copy idea from tiff code
The static assertion makes sure that newer formats get added.
2023-07-22 01:33:44 +02:00
Benjamin Otte
27fbdcbecb gdk: Add A16_FLOAT and A32_FLOAT formats
We need them for mask-only textures.

For tiffs, we convert the formats to RGBA (the idea that tiff can save
everything needs to be buried I guess) as tiffs can't do alpha-only.
2023-07-22 01:33:44 +02:00
Benjamin Otte
5bd13ccf15 vulkan: Remove unused struct 2023-07-22 01:33:44 +02:00
Benjamin Otte
d30a9e7fa9 gsk: Add gskrectprivate.h
Add a bunch of inline functions for graphene_rectangle_t.

We use those quite extensively in tight loops so making them as fast as
possible via inlining has massive benefits.

The current render-heavy benchmark I am playing (th paris-30k in node-editor)
went from 49fps to 85fps on my AMD.
2023-07-22 01:33:44 +02:00
Benjamin Otte
6e75e26a0c vulkan: Add new error code 2023-07-22 01:33:44 +02:00
Efstathios Iosifidis
6562338502 Update Greek translation
(cherry picked from commit 9d633773b0)
2023-07-21 22:29:53 +00:00
Luca Bacci
cd5cdad31d GtkApplicationImplDBus: Cancel DBus method calls on shutdown
We do that for method calls where we pass a valid GAsyncReadyCallback

Fixes #5775
2023-07-21 16:49:22 +02:00
Luca Bacci
5da01ec4af gtktextview: return early when resetting gesture / event controller
Fixes #5965
2023-07-21 15:33:45 +02:00
Daniel Boles
8da96b9353 tools: Replace references to GTK+ with GTK no plus 2023-07-21 12:05:25 +01:00
Matthias Clasen
e042db9348 Merge branch 'render-tool' into 'main'
Add gtk4-render-tool

See merge request GNOME/gtk!6197
2023-07-21 10:56:14 +00:00
Matthias Clasen
601011ccc0 Add a gtk4-rendernode-tool
This is meant to work with serialized render nodes.
2023-07-21 06:26:11 -04:00
Daniel Boles
5958abae1d Merge branch 'dboles/for-main' into 'main'
ShortcutController: Add links to docs, fix heading

See merge request GNOME/gtk!6198
2023-07-21 09:35:30 +00:00
Daniel Boles
a056063395 ShortcutController: Add links to docs, fix heading
to be "as GtkBuildable", not "as a GtkBuildable", as no other file uses
the latter.
2023-07-21 10:01:56 +01:00
Matthias Clasen
537669e2b0 Merge branch 'wip/kabus/calendar-select-signal' into 'main'
gtk/calendar: Avoid emision of day-selected signal from nav buttons

Closes #5769

See merge request GNOME/gtk!6196
2023-07-21 03:38:58 +00:00
Khalid Abu Shawarib
216a368f22 gtk/calendar: Avoid emision of day-selected signal from nav buttons 2023-07-21 03:38:58 +00:00
Matthias Clasen
fd4da47125 gdk: Drop unnecessary conditionals
We require GLib 2.76 now.
2023-07-20 15:18:13 -04:00
Matthias Clasen
411e0c5fbd tools: Use #pragma once
We are trying to be consistent about this.
2023-07-20 15:18:13 -04:00
Matthias Clasen
e523d3a50e tools: Drop unnecessary conditionals
We require GLib 2.76 now.
2023-07-20 15:18:13 -04:00
Matthias Clasen
99d6a15049 Merge branch 'gtk-fix-issue-4990' into 'main'
Add check for large compose files

Closes #4990

See merge request GNOME/gtk!6195
2023-07-20 17:39:06 +00:00
Matthias Clasen
7fb6c04e99 Make the new compose table test work
This just copies what we do already for other
tests that check parser failures.
2023-07-20 11:48:13 -04:00
Benjamin Otte
08fd9e1f2e Merge branch 'wip/otte/vulkan-for-main' into 'main'
vulkan: Various smallish things

See merge request GNOME/gtk!6193
2023-07-19 19:51:57 +00:00
Benjamin Otte
dd641867a2 vulkan: Be more careful with supported images
Now that we can upload all these fancy formats, we need to make sure
that we actually can.
2023-07-19 21:30:35 +02:00
Benjamin Otte
2cbe89de7d memoryformat: fast-path copies of the same format
Basically, memcpy() asap if possible.

This happens a lot in Vulkan, where we gdk_memory_conert() image
data from memory textures straight into the VulkanBuffer.

And usually we support the format.
2023-07-19 21:30:35 +02:00
Benjamin Otte
4d9e7d30b0 vulkan: Add premultiply step to texture upload
When a GdkMemoryFormat is not supported natively and there's
postprocessing required, add a way to mark a VulkanImage as such via the
new postprocess flags.

Also allow texting such iamges only with new_for_upload() and detect
when that is the case and then run a postprocessing step that converts
that image to a suitable format.
This is done with a new "convert" shader/op.

This now supports all formats natively, no conversions happen on the CPU
anymore (unless the GPU is old).
2023-07-19 21:30:35 +02:00
Benjamin Otte
65224f4533 vulkan: Change fallback formats
Always fall back to a format that isn't swizzled.

That way it can be used as a target format for rendering.
2023-07-19 21:30:35 +02:00
Benjamin Otte
cd84f5a56e vulkan: Split renderpass op into 2
Add an explicit begin() and an end() op. For now, this looks like
overkill, but it allows doing renderpasses with custom ops that are not
meant to render a rendernode.

Examples for this are pre/postprocessing passes or 2-pass blur.
2023-07-19 21:30:35 +02:00
Benjamin Otte
4311d17cb1 vulkan: Don't store the renderpass
It's only used when parsing.
2023-07-19 21:30:35 +02:00
Benjamin Otte
11a0646281 vulkan: Pass rectangles where no regions are used
The API was using regions because it always had. But all the code ever
did was get the extents of the region.

So simplify everything by using rectangles everywhere.
2023-07-19 21:30:35 +02:00
Benjamin Otte
492507af11 vulkan: Stop keeping the context around
These days, we can query it with gsk_vulkan_render_get_context().

Makes quite a few functions require one less argument.
And it also makes the GskVulkanRenderPass empty. Gotta figure out what
to do with it.
2023-07-19 21:30:35 +02:00
Benjamin Otte
67a3929583 vulkan: Remove unused stuff fom renderpass
... and move it to the one place where it is used.
2023-07-19 21:30:35 +02:00
Benjamin Otte
413d3819cf vulkan: Free storage buffer when disposing render object
This caused a lot of leaked memory on the GPU when rendering textures.
(Read: inside node-editor)
2023-07-19 21:30:35 +02:00
Benjamin Otte
0f289fddf7 vulkan: Fix leaks with pipeline cache
In particular, we were leaking the actual cache and then created a new
one.
2023-07-19 21:30:35 +02:00
Benjamin Otte
92038d6b7f build: Move the glslc check into the top meson file
Put it with the other Vulkan checks, so it's easy to find.
2023-07-19 21:30:35 +02:00
Benjamin Otte
6e27579d1f vulkan: Remove the pre-compiled shaders
Instead, build-depnd on glslc to build them.

glslc is available in all important distros for a while:
  Fedora >= 28
  Ubuntu >= 23.04
  Debian >= 12
  Arch
  Opensuse >= 15.2
  msys2
are the ones I checked.

So we can depend on it and avoid having to deal with keeping spirv files
up-to-date in all commits.

It's also 700kB of data, and not updating it helps.
2023-07-19 21:30:35 +02:00
Benjamin Otte
390a104ddd ci: Include glslc for Vulkan builds 2023-07-19 21:30:29 +02:00
Luca Bacci
31727a4ec5 Add test for large compose file
See #4990
2023-07-19 17:49:05 +02:00
Luca Bacci
add197bcf7 Add check for large compose files
Fixes #4990
2023-07-19 17:47:22 +02:00
Daniel Boles
e73c4fe133 Merge branch 'dboles/theme-no-backdrop-list-view-text' into 'main'
theme: Don't dim text in backdropped list/listview

See merge request GNOME/gtk!6175
2023-07-19 13:02:28 +00:00
Benjamin Otte
2e6b7b5b78 Merge branch 'wip/otte/vulkan-for-main' into 'main'
vulkan: Make RenderOps into proper structs

See merge request GNOME/gtk!6188
2023-07-16 12:22:35 +00:00
Benjamin Otte
90e933a6aa vulkan: Rebuild the shaders
Just to be sure I didn't forget rebuilding some shader at some point.
2023-07-16 13:52:15 +02:00
Benjamin Otte
e7549f3359 vulkan: Redo barriers
We now store all the relevant state of the image inside the VulkanImage
struct, so we can delay barriers for as long as possible.

Whenever we want to use an image, we call the new
gsk_vulkan_image_transition() and it will add a barrier to the desired
state if one is necessary.
2023-07-16 13:16:43 +02:00
Benjamin Otte
fee497f9e1 vulkan: Track the current pipeline stage of images
This way, we can in theory properly transition images because we know
which stage to transition from.

IN practice this is happening in future commits.
2023-07-16 13:16:43 +02:00
Benjamin Otte
ef4930723b vulkan: Handle images in the ShaderOp
This looks more convoluted in this commit, but future commits will
hopefully make up for it.
2023-07-16 13:16:43 +02:00
Benjamin Otte
a8ff291a12 vulkan: Make clip type an enum
and add gsk_vulkan_shader_op_alloc() that sets it properly.
2023-07-16 13:16:43 +02:00
Benjamin Otte
f366ccc0b2 vulkan: Introduce GskVulkanShaderOp
It's the new base class for shaders now.

We're doing deep inheritance now, woohoo!

Also, port all the shader ops to it.
2023-07-16 13:16:43 +02:00
Benjamin Otte
ca69fd2b7a vulkan: Remove GskVulkanUploader
... and all the remaining functions still using it.

It's all unused and has been replaced by upload and download ops.

With this change, all GPU operations now go via GskVulkanOp.command()
and no more side channels exist.
2023-07-16 13:16:43 +02:00
Benjamin Otte
db2029d931 vulkan: Add GskVulkanDownloadOp
This op queues a download of an image. The image will only be available
once the commands finished executing, so it requires waiting for the
render to finish, which makes the API a bit awkward.

Included is also a download_png_op() useful for debugging.
2023-07-16 13:16:43 +02:00
Benjamin Otte
6f2fd001a0 vulkan: Properly update image layouts
The render pass ops were not updating the image's layout to the final
layout when a render pass ends.

Fix that.

Also make the layouts explicit arguments to the render pass op.
2023-07-16 13:16:43 +02:00
Benjamin Otte
3327a6ba08 vulkan: Simplify render API
Merge reset() and draw() into a single render() function.

Also clean up some naming on the way.
2023-07-16 13:16:43 +02:00
Benjamin Otte
4954e6962f vulkan: Remove the VulkanOp.upload() vfunc
It's not used anymore.
2023-07-16 13:16:43 +02:00
Benjamin Otte
93db1cc89e vulkan: Add an UploadGlyphOp
Now all the uploads have their own op.
2023-07-16 13:16:43 +02:00
Benjamin Otte
68b337d457 vulkan: Split out a function
Split out the function that uploads using a buffer, so that it can be
used with an area to only update parts of the image.

That feature is not used yet, but will be in future commits.
2023-07-16 13:16:43 +02:00
Benjamin Otte
0d5e54986a vulkan: Remove unused functions 2023-07-16 13:16:43 +02:00
Benjamin Otte
822641c161 vulkan: Merge the two upload ops
Now they both use the same upload code.
2023-07-16 13:16:43 +02:00
Benjamin Otte
385ab74922 vulkan: Merge te 2 upload ops
They are about to share a ton of code, sothey should be in the same
source file.

This commit just does the copying, no functional changes.
2023-07-16 13:16:43 +02:00
Benjamin Otte
fcf65c7caa vulkan: Fold functions into only caller
Now that the VulkanOp does begin/end of render passes, there's no need
to have a renderpass function for it anymore.
2023-07-16 13:16:43 +02:00
Benjamin Otte
ece4e59e99 tests: Reduce number of random fonts
We were clowing through all the Pango caches for no benefit.

It made the test generation stuck in fontconfig loops instead of
quickly generating tests.

So don't do that and limit the different fonts to some reasonable list
of options.
2023-07-16 13:16:43 +02:00
Benjamin Otte
6eea08ff99 vulkan: Don't merge too many drawing commands
If a command takes too long to execute, Vulkan drivers will think they
are inflooping and abort what they were doing.

For the simple color shader with smallish nodes, this happens around
10M instances, as tested with the output of
  ./tests/rendernode-create-tests 10000000 colors.node

So just limit it to way lower, so that we barely never hit it, ut still
pick a big number so this optimization stays noticable.
2023-07-16 13:16:43 +02:00
Benjamin Otte
372dcba9c9 vulkan: Simplify
The renderpassop always has a matching end op, so there is no need to
check for the end of operations and emit one manually.
2023-07-16 13:16:43 +02:00
Benjamin Otte
af817a3362 vulkan: Merge function into only caller
The renderpass reshuffling means we can move a bunch of functions now.

This is one of them.
2023-07-16 13:16:43 +02:00
Benjamin Otte
0edd7547c1 vulkan: Don't try that hard to use clear
For small regions, the optimization doesn't matter that much, so we
don't need to do lots of work on the CPU.

In particular, this should catch icons and their backgrounds (32x32),
but I was generous in selecting the number.

Gets my discrete AMD on widget-factory back to the 1900fps it had before
this optimization while making the driver clock the GPU's shader at
1.7GHz instead of the 2.1GHz it used before.
2023-07-16 13:16:43 +02:00
Benjamin Otte
ce042f7ba1 vulkan: Try really hard to use clear
Using clear avoids the shader engine (see last commit), so if we can get
pixels out of it, we should.

So we detect the overlap with the rounded corners of the clip region and
emit shaders for those, but then use Clear() for the rest.

With this in place, widget-factory on my integrated Intel TigerLake gets
a 60% performance boost.
2023-07-16 13:16:41 +02:00
Benjamin Otte
bb2cd7225e vulkan: Add a clear op
The op emits a vkCmdClearAttachments() with a given color. That can be
used with color nodes that are pixel-aligned and opaque to significantly
speed up rendering when the window background is a solid color.

However, currently this fails a bit outside of fullscreen when rounded
clip rectangles are in use to draw rounded corners.
2023-07-16 13:16:15 +02:00
Benjamin Otte
5e1fd56345 vulkan: Adapt a function
I want to use it for more operations when we can break those down to
operations on the pixels directly, and this function is what's needed
for that.
2023-07-16 12:13:00 +02:00
Benjamin Otte
c72588748b vulkan: Implement direct upload for the cairo op 2023-07-16 12:13:00 +02:00
Benjamin Otte
48e1d48e7f vulkan: Upload cairo images "directly"
Instead of using the upload vfunc and going via the code in
GskVulkanImage, copy/paste the relevant code into the command() vfunc.

This is meant to achieve multiple things:
1. Get rid of GskVulkanUploader and its own command buffer and general
   non-integration with operations.
2. Get rid of GskVulkanOp:upload()
3. Get the upload/download code machinery for GskVulkanImage and put it
   with the actual operations.

The current code can't do direct upload/download, that will follow in a
future commit.
2023-07-16 12:13:00 +02:00
Benjamin Otte
70a12c4efb vulkan: Split out a function
This is refactoring for future changes.
2023-07-16 12:13:00 +02:00
Benjamin Otte
6f76c37fed vulkan: Emit a renderpass op
... instead of doing the equivalent things manually by creating a
RenderPass and calling the relevant functions.

Now all renderpass operations are indeed stored in ops.

Also reshuffle the command emission code, because we no longer need to
emit the ops for the base renderpass.

As a result we only submit a single command buffer containing all the
render passes instead of once per render pass.
We also bind vertex buffers and descriptor sets only once now at the
start instead of once per renderpass.
2023-07-16 12:13:00 +02:00
Benjamin Otte
cc5cab65a1 vulkan: Sort the ops
Use the OpClass.stage to order operations:

1. Put upload ops first
   This way we can ensure they are executed first.
2. Move subpasses for offscreens in front of the pass using them.
2023-07-16 12:13:00 +02:00
Benjamin Otte
f3823eff87 vulkan: Store a pointer to the first op
This is not yet useful, but will be soon.
2023-07-16 12:13:00 +02:00
Benjamin Otte
13d6e691c2 vulkan: Indent verbose prints again
This feature was lost when refactoring, restore it.
2023-07-16 12:13:00 +02:00
Benjamin Otte
0bf16d738e vulkan: Rename offscreenp to renderpassop
They should be used for all renderpasses, not just offscreens.
2023-07-16 12:13:00 +02:00
Benjamin Otte
2aba50efa0 vulkan: Move the render ops to the Render
This is a massive refactoring because it collects all the renderops
of all renderpasses into one long array in the Render object.

Lots of code in there is still flaky and needs cleanup. That will
follow in further commits.

Other than that it does work fine though.
2023-07-16 12:13:00 +02:00
Benjamin Otte
63ad234391 vulkan: Batch together multiple draw calls
If multiple instances of the same op appear in order, we can emit one
vkCmdDraw() for all of them together.

So do that.
2023-07-16 12:13:00 +02:00
Benjamin Otte
21d2372396 vulkan: Unify some functions
All the ops that just execute a shader do pretty much the same stuff, so
put it all in a single function that they all call.

It's basically faking a base class for them.
2023-07-16 12:13:00 +02:00
Benjamin Otte
c0b185bee9 vulkan: Make Op->command() return the next op
This way, ops can batch themselves.

They don't dothat yet, but you know where this is going...
2023-07-16 12:13:00 +02:00
Benjamin Otte
da4a4f6a25 vulkan: Add a Stage enum
It's declaring at which stage this command should run. So far nothing is
using it, but that will follow in future commits.
2023-07-16 12:13:00 +02:00
Benjamin Otte
d7764cc6b3 vulkan: Bind descriptor sets early
Simplfies the code and doesn't change anything.
2023-07-16 12:13:00 +02:00
Benjamin Otte
a6b2bcbf24 vulkan: Remove unused arguments from Op vfuncs
Makes code a lot simpler.
2023-07-16 12:13:00 +02:00
Benjamin Otte
7fa159e94a vulkan: Cache VkRenderPasses in render object
Instead of recreating the same renderpass object in every frame and for
every offscreen, just reuse it.

Technically, we can save this per-renderer or even per-display (it
should really be cached by VkDevice), but we have no infrastructure for
that.
2023-07-16 12:13:00 +02:00
Benjamin Otte
05c9f3442c vulkan: Rename function
The function name gsk_vulkan_render_get_pipeline() had been used for
GskVulkanPipeline. Since those are gone now, we can use that name for
VkPipelines.
2023-07-16 12:13:00 +02:00
Benjamin Otte
cef87b102c vulkan: Cache framebuffer in image
Instead of recreating them every frame for every render pass, reuse the
same framebuffer.
2023-07-16 12:13:00 +02:00
Benjamin Otte
70c9521cae vulkan: Put the vertex buffer into the render object
Renderpasses get recreated every frame, but we keep render objects
around. So if we keep the vertex buffer in the render object, we can
also keep it around and just reuse it.

Also, we only need one buffer for all the render passes, which is
another bonus.

The initial buffer size is chosen at 128kB. Maximized Nautilus,
gnome-text-editor with an open file and widget-factory take ~100kB when
doing a full redraw. Other apps are between 30-50kB usually.

So I chose a value that is not too big, but catches ~90% of cases.
2023-07-16 12:13:00 +02:00
Benjamin Otte
1abcf3d48a vulkan: Add an offscreen end op
This is basically a fancy no-op for now, but reordering of ops will need
it to indicate end of offscreen commands.
2023-07-16 12:13:00 +02:00
Benjamin Otte
6363f27f95 vulkan: Don't intern strings
Interning strings is slow, especially if we can instead do direct
pointer compares.

Also refactor the pipeline lookup code a bit to make use of the
refactored code.
2023-07-16 12:13:00 +02:00
Benjamin Otte
f35053b837 vulkan: Add VulkanOp->next
Set it after creating all the ops and then use it for iterating.

Note that we cannot set it while creating the ops because the array may
be realloc()ed into a different memory region which would invalidate all
the pointers.

It currently has no use, but that will come later.

Also put the typedefs into headers in gsk/vulkan, they have nthing to do
outside that directory.
2023-07-16 12:13:00 +02:00
Benjamin Otte
d669e3ab6a vulkan: Remove all the semaphores
They aren't necessary with just one queue.
2023-07-16 12:13:00 +02:00
Benjamin Otte
5707551b79 vulkan: Remove unused stuff from render object
Neither cleanup images nor multiple renderpasses are used anymore since
both of those are now handled inside the render ops.
2023-07-16 12:13:00 +02:00
Benjamin Otte
a7c247bccd vulkan: Pass the node when setting up
Remove the function to add a node from both the GskVulkanRender and the
GskVulkanRenderPass.

That means they are both now meant to draw exactly one node.
2023-07-16 12:13:00 +02:00
Benjamin Otte
d86d4c5597 vulkan: Add infrastructure for printing ops
... and add a GSK_DEBUG=verbose setting making use of it.
2023-07-16 12:13:00 +02:00
Benjamin Otte
73f1dfc762 vulkan: Repurpose mask shader
Use if for mask nodes to do the generic source image + mask image
operation with the 4 available mask modes.
2023-07-16 12:13:00 +02:00
Benjamin Otte
a621bd066b vulkan: Remove op.get_pipeline()
It's unused now that GskVulkanPipeline is gone.
2023-07-16 12:13:00 +02:00
Benjamin Otte
143ca0e17d vulkan: Remove GskVulkanPipeline
Pipelines are handled differently now.
2023-07-16 12:13:00 +02:00
Benjamin Otte
58c318a4dc vulkan: Add gskvulkanprivate.h
It's the new place for all the common stuff.

Because the old place is about to go away.
2023-07-16 12:13:00 +02:00
Benjamin Otte
210cb3eecd vulkan: Turn push constants into an op
This removes the last remaining original op from the gskvulkanrenderpass.c,
so that file got some cleanup, too.
2023-07-16 12:13:00 +02:00
Benjamin Otte
6e6fa3daed vulkan: Make glyphs use new node ops
This is a rudimentary - but working - port.
Glyph uploads are still using the old machinery, a bunch of functions
still exist that probably aren't necessary anymore and each glyph emits
its own node.

This will need to be improved in further commits.
2023-07-16 12:13:00 +02:00
Benjamin Otte
2d6ebbb4d5 vulkan: Add a glyph shader
This shader is an updated version of the mask shader, but I want to use
the mask name for the mask node and that's a different functionality.

Also, add an operation for it and partially implement the mask node
using it, so we can test that this shader works.

Replacing the shader used for text rendering is the next step.
2023-07-16 12:12:59 +02:00
Benjamin Otte
efa4cae949 vulkan: Remove hacky function arguments
They're unused now that we removed the old render ops.
2023-07-16 12:12:36 +02:00
Benjamin Otte
5e72914c48 vulkan: Port linear gradient to new ops
This was the last user of GskVulkanOpRender, so delete that one, too.
2023-07-16 12:12:36 +02:00
Benjamin Otte
f3aab662c3 vulkan: Make border shader use new ops 2023-07-16 12:12:36 +02:00
Benjamin Otte
c598fa9147 vulkan: Add a blur op and use it
This removes the last old user of offscreens, so those functions are now
gone, too.
2023-07-16 12:12:36 +02:00
Benjamin Otte
b2296a1918 vulkan: Port inset and outset shadow to new ops 2023-07-16 12:12:36 +02:00
Benjamin Otte
594595d9cd vulkan: Port blend mode to new ops 2023-07-16 12:12:36 +02:00
Benjamin Otte
9ac36aeb42 vulkan: Add cross-fade op
The benefit here is that we can now properly cross-fade when one of
start/end is fully clipped out by just replacing it with an opacity op
for the other.

This was not possible with the old way we did things.
2023-07-16 12:12:36 +02:00
Benjamin Otte
a61fe61318 vulkan: Factor out call to opacity op
I want to reuse it for crossfades (see next commit).
2023-07-16 12:12:36 +02:00
Benjamin Otte
99085605a8 vulkan: Convert color op to new method
This is a straightforward and simple port.
2023-07-16 12:12:36 +02:00
Benjamin Otte
9da1055575 vulkan: Create pipeline differently for ops
Instead of creating a pipeline GObject, just ask for the VkPipeline.

And instead of having the Op handle it, just let the renderpass look
up/create the relevant pipeline while creating commands so that it can
insert vkCmdBindPipeline calls as-needed.
2023-07-16 12:12:36 +02:00
Benjamin Otte
b049990356 Revert "vulkan: Always render clip extents"
This reverts commit 0f184d3270.

The renderer is good enough to make use of the clip region.

Or rather: If it isn't, the renderpass should take care of that, not the
render object.
2023-07-16 12:12:36 +02:00
Benjamin Otte
8207c548cc vulkan: Combine textures and samplers again
This reverts most of commit f420c143e0
again because it turns out GPUs like combined images and samplers.

But: The one thing we don't revert is allowing the C code to select any
combination of sampler and image:
gsk_vulkan_render_get_image_descriptor() now takes a 2nd argument
specifying the sampler.

This allows the same flexibility as before, we just combine things
early.

This change was inspired by
https://developer.nvidia.com/blog/vulkan-dos-donts/
2023-07-16 12:12:36 +02:00
Benjamin Otte
83960622e3 vulkan: Store shaders in the display
Have a resource path => vkShaderModule hash table instead of doing fancy
custom objects.

A benefit is that shader modules are now shared between all renderers
and pipelines.
2023-07-16 12:12:36 +02:00
Benjamin Otte
7cf7870254 vulkan: Initialize ops differently
Instead of creating the op manually, just pass in the renderpass and
have the op created from there.

This way ops aren't really initialized anymore, they are more appended
to the queue, so instead of foo_op_init() we can just call the function
foo_op().
2023-07-16 12:12:36 +02:00
Benjamin Otte
7763e883d6 vulkan: Use VkPipeline instead of GskVulkanPipeline
This is in preparation for getting rid of GskVulkanPipelines.
2023-07-16 12:12:36 +02:00
Benjamin Otte
8bacfad171 vulkan: Use new ops for repeat nodes
The new code always uses an offscreen, even for children that are
exactly fitting texture nodes.
I would have had to write more code and didn't consider it worth it,
especially because it would have required complicating the
get_as_image() function.

This was the last node using the texture pipeline.
2023-07-16 12:12:36 +02:00
Benjamin Otte
53e7277584 vulkan: Implement fallback using new nodes
With Cairo upload and texture nodes being available, we can do that now.
2023-07-16 12:12:36 +02:00
Benjamin Otte
e43b7902be vulkan: Pass bounds to texture op
This way the node can do the normalization (and maybe stop doing it
in the future).
2023-07-16 12:12:36 +02:00
Benjamin Otte
f1d81bb7df vulkan: Add a Cairo upload node
... and use it for cairo nodes.
2023-07-16 12:12:36 +02:00
Benjamin Otte
84cf6de36d vulkan: Port opacity to new ops 2023-07-16 12:12:36 +02:00
Benjamin Otte
aaa219497b vulkan: Add offscreen and color-matrix op
.. and use them for color-matrix operations.
2023-07-16 12:12:36 +02:00
Benjamin Otte
8515224921 vulkan: Split out a function
We'll need it elsewhere soon.
2023-07-16 12:12:36 +02:00
Benjamin Otte
f53da409e5 vulkan: Add an argument to vfunc
We need this in the future.
2023-07-16 12:12:36 +02:00
Benjamin Otte
b45a2025d9 vulkan: Remove nonexisting function from header 2023-07-16 12:12:36 +02:00
Benjamin Otte
0946b0b333 vulkan: Split out a function
Making that function externally usable allows having render passes
managed externally.

Also remove a nonexisting function from the header.
2023-07-16 12:12:36 +02:00
Benjamin Otte
1d9ad55c54 vulkan: Use new ops for TextureScale nodes 2023-07-16 12:12:36 +02:00
Benjamin Otte
94a64329c2 vulkan: Add new renderops for texture rendering
Adds 2 ops:

- Upload
  Creates a new Vulkan image and uploads data into it

- Texture
  Draws a given image

These 2 ops are then used for GskTextureNodes.
2023-07-16 12:12:36 +02:00
Benjamin Otte
ba502a5009 vulkan: Split texture caching code
Instead of having one function that gets the image for the texture and
uploads it if it doesn't exist yet, make it 2 functions:

One to get the texture if it exists.
One to assign an uploaded image to the texture.

This way, we can potentially do the upload ourselves.
2023-07-16 12:12:36 +02:00
Benjamin Otte
e1d2477485 vulkan: Actually run the op_finish()
It's a no-op for all current ops, so it isn't really necessary. But
that's about to change.
2023-07-16 12:12:36 +02:00
Benjamin Otte
2fef53b154 vulkan: Pass context, not uploader
We don't need the uploader when creating the image, only when uploading.
2023-07-16 12:12:36 +02:00
Benjamin Otte
742ef96748 vulkan: Create the first real VulkanOp
Split out the scissor op into its own implementation as a proof of
concept of how ops are meant to look when they are actually working.
2023-07-16 12:12:36 +02:00
Benjamin Otte
8d928ad340 vulkan: Allocate render ops differently
Allocate the memory up front instead of passing the Op into it.

This way, we can split ops into their own source file and use
init/finish style to use them.
2023-07-16 12:12:36 +02:00
Benjamin Otte
32e123fa67 vulkan: Invent a new abstraction
GskVulkanOp is meant to be a proper abstraction of operations
the Vulkan renderer will be doing.

For now it's an atrocious clunky piece of junk wedged into the
renderpass codebase.

It's so temporary that I didn't even adjust indentation of the code.
2023-07-16 12:12:36 +02:00
Benjamin Otte
df0dd296e9 vulkan: Use the actual RenderOp type
... instead of the generic one.

This is again preparation for future changes.
2023-07-16 12:12:36 +02:00
Benjamin Otte
34e13556b4 vulkan: Use a byte array for render ops
This allows allocating only as much memory as is needed for each op.

We don't do that yet, this is still preparation.
2023-07-16 12:12:36 +02:00
Benjamin Otte
bdbb1398db vulkan: Split out a function
This is preparation for future changes.
2023-07-16 12:12:36 +02:00
Daniel Boles
9fbd582951 Fix broken image menu.png in Gtk.PopoverMenu intro
The previous menu.png appears to be just a wide transparent box. Let's
just replace it with a snip of a popover menu from the widget-factory.
2023-07-16 09:33:07 +01:00
Emmanuele Bassi
b00ca0d699 Merge branch 'dboles/EventControllerKeyModifiersDocs' into 'main'
EventControllerKey: doc fixes re Modifiers

See merge request GNOME/gtk!6186
2023-07-14 14:04:47 +00:00
Daniel Boles
8c4245da2f EventControllerKey: Remove redundant/unliked "See"
Saying "See [Thing]" is not very helpful without it being a link to
Thing, and we already get that for free as the "Type:" of the param.
2023-07-14 14:22:57 +01:00
Daniel Boles
7e7aa17484 EventControllerKey: Remove wrong signal arg, which
caused the resulting parameter to be called keyval, but it must be state
2023-07-14 14:22:25 +01:00
Ekaterine Papava
4e6a04152b Update Georgian translation 2023-07-14 11:48:35 +00:00
Emmanuele Bassi
fb56929791 Merge branch 'nielsdg/fix-sectionmodel-signal-doc' into 'main'
sectionmodel: Fix GIR comment for sections-changed

See merge request GNOME/gtk!6185
2023-07-13 23:40:03 +00:00
Niels De Graef
c9022ac2d5 sectionmodel: Fix GIR comment for sections-changed
Make sure to end the signal name with a colon so GIR recognizes the
signal. This should also fix the problem that the documentation for that
signal is currently missing in the rendered gi-docgen output.
2023-07-14 01:03:21 +02:00
Benjamin Otte
0b6392c0a8 Merge branch 'vulkan-resize-fix' into 'main'
vulkan: Wait for device to be idle before create/recreating swapchain

See merge request GNOME/gtk!6183
2023-07-13 13:19:29 +00:00
José Roberto de Souza
526c0404c2 vulkan: Wait for device to be idle before create/recreating swapchain
Wait for device to be idle because this function is also called in
window resizes.
And if we destroy old swapchain it also destroy the old VkImages,
those images could be in use by a vulkan render.

This fixes a issue reported in Mesa repository when running
GTK with Xe KMD.

Fixes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9044
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
2023-07-13 05:40:55 -07:00
Matthias Clasen
cdacfc5a21 Merge branch 'fix-validate-crash' into 'main'
buildertool: Exit orderly

Closes #5948

See merge request GNOME/gtk!6182
2023-07-12 20:11:46 +00:00
Matthias Clasen
ab809d1dc3 buildertool: Exit orderly
The validate command does need a display connection,
for better or worse. So exit in an orderly fashion
if we don't have one, instead of crashing.

Fixes: #5948
2023-07-12 15:49:11 -04:00
Benjamin Otte
6dd9048c6d Merge branch 'wip/otte/for-main' into 'main'
textbtree: Remove unnecessary check

See merge request GNOME/gtk!6179
2023-07-11 00:04:17 +00:00
Benjamin Otte
3523d56122 vulkan: Change the clip intersection check
Intersection with a roudned clip takes too long.

Instead, rename the function to may_intersect() to be clear about what
it does and then just intersect with the regular rectangle.
2023-07-11 01:39:25 +02:00
Benjamin Otte
5c601b673e vulkan: intersect rects also for CLIP_NONE
If we don't clip anything, we stil have bounds - either the framebuffer
size or (more likely) the scissor rect. And we don't want to draw
anything that is outside these bounds.

So clip in those cases, too.

Stops gtk4-demo --run=listbox from trying to render the whole listbox
instead of only the visible parts.
2023-07-10 06:32:01 +02:00
Benjamin Otte
465a34e6b0 rendernode: Implement proper GSK_IS_RENDERNODE()
Use G_TYPE_CHECK_INSTANCE_TYPE() instead of just checking for != NULL.
After all, this is a GTypeInstance.

Also fixes some gcc complaints when checking
  node == NULL || GSK_IS_RENDERNODE (node)
which gcc was convinced would be always true.
2023-07-10 06:32:01 +02:00
Benjamin Otte
aa82a400df textbtree: Remove unnecessary check
Since a93614409e we don't allocate the
stack anymore, so this NULL check is unnecessary now - and it's flagged
by compilers.
2023-07-10 06:32:01 +02:00
Daniel Boles
4d673e9c9a theme: Don't dim text in backdropped list/listview
We have largely moved away from changing styles when :backdropped, aside
for some things in HeaderBars and Buttons. So we probably should not be
automatically dimming text in labels in list[view]s anymore either, as
that introduces differences if text happens to be in such widgets vs not
2023-07-09 09:49:25 +01:00
Matthias Clasen
1f3db35271 Merge branch 'dboles/image-notify-storage-type' into 'main'
Image—Notify when :storage-type changes from EMPTY

See merge request GNOME/gtk!6170
2023-07-07 01:15:56 +00:00
Emmanuele Bassi
18cce46ed2 Merge branch 'wip/corey/listitemleak' into 'main'
gtklistitemmanager: Stop leaking item

Closes #5940

See merge request GNOME/gtk!6171
2023-07-06 23:57:16 +00:00
Corey Berla
e78148bae5 gtklistitemmanager: Stop leaking item
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5940
2023-07-06 16:24:29 -07:00
Daniel Boles
41237509ad Image—Notify when :storage-type changes from EMPTY
PROP_STORAGE_TYPE was only notified if it was changing *to* EMPTY, in
gtk_image_clear_internal(). We did not notify when it changes *from*
EMPTY to something non-empty. We should as not doing so is confusing,
e.g. if a user wants to bind :storage-type to :visible if non-empty,
which I just did! So, in functions that apply an ImageType, now notify.

Also do so in gtk_image_set_from_definition, declared in imageprivate.h,
even though none of the function there are currently used anywhere.
(Should they be removed?)
2023-07-06 23:08:20 +01:00
Yosef Or Boczko
576e8a2090 Update Hebrew translation 2023-07-06 09:38:02 +00:00
Matthias Clasen
d0f77c1db4 Merge branch 'wip/carlosg/switch-stylus-buttons' into 'main'
gdk/wayland: Switch behavior of BTN_STYLUS/STYLUS2 as middle/right click

Closes #5935

See merge request GNOME/gtk!6168
2023-07-05 23:38:38 +00:00
Carlos Garnacho
e28ff79bec gdk/wayland: Switch behavior of BTN_STYLUS/STYLUS2 as middle/right click
This mapping of stylus evdev input event codes into GDK button numbers
makes gdk/wayland inconsistent with gdk/x11, so depending on the backend
the same button middle-click pastes or right-click pops up menus.

Make the wayland backend consistent with X11, so that a GNOME wayland
session gets these buttons consistently mapped across all kinds of
clients.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5935
2023-07-05 16:54:54 +02:00
Daniel Boles
dccf6b55bd GdkTexture: Don't mention private new_from_surface
The stuff about Cairo Surfaces is in gdktextureprivate.h, & so end users
will not be able to use them; we shouldn't confuse by implying they can.
2023-07-05 12:07:33 +01:00
Daniel Boles
d5ea376e7b docs/list-widget: links, DirList, correct Sections
* Add links to various symbols.
* Mention DirectoryList in the "ready-made choices available" section.
* Don't say that GridView can display headers: it makes no attempt to.
2023-07-05 12:02:08 +01:00
Matthias Clasen
40707a6af0 Merge branch 'ebassi/issue-5934' into 'main'
Lower the Python requirement

Closes #5934

See merge request GNOME/gtk!6167
2023-07-05 10:57:45 +00:00
Emmanuele Bassi
9b71c9dfc6 Do not use bleeding edge Python
The match operator was added in Python 3.10, which is a bit too new for
some downstreams.

While at it, let's fix the flake8 errors and warnings.

Fixes: #5934
2023-07-05 10:19:18 +01:00
Emmanuele Bassi
64308317f8 Add flake8 configuration file
Ignore long lines; most of our Python scripts generate code or other
types of files, which makes long lines a necessity.

We should validate all our Python script in our CI as well.
2023-07-05 10:12:20 +01:00
Daniel Boles
f920723eae AlertDialog: Remove spurious/unmatched backtick 2023-07-04 22:42:50 +01:00
Daniel Boles
c581f4c96f ListBase: Fix a typo 2023-07-04 19:44:56 +01:00
Matthias Clasen
4998c90b10 Merge branch 'update-uac-script-format' into 'main'
tools/generate-uac-manifest.py: Fix formatting (unify with copy in GLib)

See merge request GNOME/gtk!6164
2023-07-03 23:37:36 +00:00
Benjamin Otte
412b23a146 Merge branch 'wip/otte/for-main' into 'main'
gsk: Catch values < 0 before bad things happen

See merge request GNOME/gtk!6165
2023-07-03 20:40:30 +00:00
Benjamin Otte
c179013790 testsuite: Add a test for mask out of bounds effects
Inverted alpha masks have an effect on the source, even if the mask
doesn't cover the source at all - or worse, is completely clipped out.

The GL renderer handles this fine, but Cairo and Vulkan had
optimizations that got this wrong.
2023-07-03 22:02:44 +02:00
Benjamin Otte
c6eb7fd483 gsk: Fix luminance in Cairo and GL renderer
In particular, fix the combination of luminance and alpha. We want to do
  mask = luminance * alpha
and for inverted
  mask = (1.0 - luminance) * alpha
so add a test that makes sure we do that and then fix the code and
existing tests to conform to it.
2023-07-03 22:02:44 +02:00
Benjamin Otte
7c58370673 rendernode: Work around a Cairo bug
When color-matrix modifying a clear surface, the surface would remain
clear according to Cairo.

That's very unfortunate when we prepare a mask for inverted-alpha
masking.
2023-07-03 22:02:44 +02:00
Benjamin Otte
84737a5159 build: Include the right things
If we build our own targets, we need to include those.

This is only relevant when adding new shaders because meson will
complain that the (unused) sources don't exist as it tries to include
those.
And that will make the build.ninja file not be generated which would
have build those shaders and would have allowed to copy them into the
sources.

Note that this makes builds with glslc not care about all the shader
files being included with the sources, but we have CI to check that.
2023-07-03 22:02:44 +02:00
Benjamin Otte
48804c81f3 rendernode: Mask nodes with different modes are different
So treat them as such.

Fixes the node editor not updating when I edit the mask mode.
2023-07-03 22:02:44 +02:00
Benjamin Otte
c79ec355af gsk: Catch values < 0 before bad things happen
In particular, catch radius values being < 0 by return_if_fail()ing in
the rendernode creation code, and by erroring out in the rendernode
parser.

I try too much dumb stuff in the node editor.
2023-07-03 22:02:44 +02:00
Benjamin Otte
ce5d74d7df glcontext: Fix typo in Apple extension name 2023-07-03 22:02:44 +02:00
Matthias Clasen
5bcc943ec3 Post-release version bump 2023-07-03 14:56:49 -04:00
Matthias Clasen
f5d68bb586 4.11.4 2023-07-03 14:12:53 -04:00
Chun-wei Fan
6d1537647c tools/generate-uac-manifest.py: Fix formatting
As this script is now also used in GLib, unify the formatting between
GLib and GTK. Make the formatting of the script conformant to the
Black[1] tool, as GLib requires, and add a copyright header to this
script.

[1]: https://black.readthedocs.io/en/stable/, see also
$(glibsrcroot)/.gitlab-ci/run-bash.sh
2023-07-03 12:50:55 +08:00
Matthias Clasen
ae2c10996a Merge branch 'fix_atcontext_refleaks' into 'main'
a11y: Fix some GtkATContext reference leaks

See merge request GNOME/gtk!6160
2023-07-01 18:06:19 +00:00
Barnabás Pőcze
81e9de3778 a11y: Fix some GtkATContext reference leaks
`gtk_accessible_get_at_context()` is transfer-full, so the returned
reference needs to be dropped. This was missing in a couple places.
2023-07-01 16:40:11 +02:00
Chun-wei Fan
42a704fefb Merge branch 'gdk-win32-input-fixes' into 'main'
GdkWin32 input fixes

Closes #5877

See merge request GNOME/gtk!6131
2023-06-30 04:33:08 +00:00
Matthias Clasen
e57eaf16b4 Merge branch 'wip/chergert/map-as-sectionmodel' into 'main'
maplistmodel: implement GtkSectionModel

See merge request GNOME/gtk!6154
2023-06-30 01:50:07 +00:00
Matthias Clasen
9aabb0e98d Add section model tests for GtkMapListModel 2023-06-29 21:30:11 -04:00
Matthias Clasen
9590a5f45e maplistmodel: Handle the ::sections-changed signal
Wrapper section models need to listen to and pass
on the ::sections-changed signal from the underlying
model.
2023-06-29 21:29:11 -04:00
Daniel Boles
7bee50c4f6 Image: Fix missing closing backtick 2023-06-29 14:33:29 +01:00
Matthias Clasen
bad2324318 Merge branch 'dboles/gtk-demo_dnd_dark' into 'main'
gtk-demo/dnd: Fix, generalise detecting dark theme

See merge request GNOME/gtk!6157
2023-06-29 10:26:41 +00:00
Matthias Clasen
dd15accb79 Merge branch 'matthiasc/for-main' into 'main'
build: Try harder to work with nongnu ld

See merge request GNOME/gtk!6159
2023-06-28 23:31:41 +00:00
Matthias Clasen
1d1f35576a build: Try harder to work with nongnu ld
Only try to be fast with gnu ld.
2023-06-28 16:54:34 -04:00
Daniel Boles
15458b5af3 gtk-demo/dnd: Fix, generalise detecting dark theme
Our default theme is now Default, not Adwaita, & HighContrastInverse was
renamed to Default-hc. So these checks did not work anymore. Rather than
hard-coding the new names, & possibly running into the same issue again,
we can just look for the convention of appending -dark to the theme name
and/or the Settings:prefer-dark-theme prop. The latter, we can & likely
SHOULD also apply to all themes - not just ours as before. We also check
for the :dark suffix as that means the theme variant - & before checking
GtkSettings check the GTK_THEME env var, just as GtkSettings itself does
2023-06-28 14:40:06 +01:00
Matthias Clasen
5ffe9a68ed Merge branch 'matthiasc/for-main' into 'main'
build: Move objcopy checks to one place

Closes #5672

See merge request GNOME/gtk!6156
2023-06-28 12:06:49 +00:00
Matthias Clasen
f341bd563b build: Look for ld.bfd
The objcopy+ld approach to fast resource building
relies on behavior that is specific to the binutils
linker, and does not work with the llvm one.

Therefore, check for ld.bfd. We still fall back
to trying with just ld, since I'm not 100% sure
if binutils unconditionally installs ld.bfd.

Fixes: #5672
2023-06-28 07:12:07 -04:00
Matthias Clasen
70edacc68d build: Move objcopy checks to one place
We were doing the same thing in three places.
Move it to the toplevel meson.build, so we
can change it in one place.
2023-06-28 07:11:51 -04:00
Matthias Clasen
091176ae48 Updates 2023-06-28 06:47:32 -04:00
Matthias Clasen
d9cfb94a80 Merge branch 'fix_dropdown_set_expression' into 'main'
GtkDropDown: Force redisplay of the drop-down items after expression change

See merge request GNOME/gtk!6145
2023-06-28 09:57:04 +00:00
Lukáš Tyrychtr
3c7ca28f1f dropdown: Handle expression changes
The expression is used by the default factory, so we
need to track whether we are using the default factory
and recreate it if the expression changes.
2023-06-28 08:18:01 +02:00
Matthias Clasen
25e518326c Merge branch 'matthiasc/for-main' into 'main'
Plug a memory leak in gsk_render_node_serialize

See merge request GNOME/gtk!6155
2023-06-28 02:42:47 +00:00
Matthias Clasen
a853307fb7 ci: Ignore more leaks in dependencies
libxkbcommon shows up quite a bit in leak sanitizer
reports. Ignore it.
2023-06-27 22:08:22 -04:00
Matthias Clasen
0ae541671d gsk: Plug a memory leak in mask node fallback
We were forgetting to free the mask pattern.
Found by asan.
2023-06-27 21:54:15 -04:00
Matthias Clasen
ef0d6c7290 gsk: Plug a memory leak in the gl renderer
Found by asan.
2023-06-27 21:52:08 -04:00
Matthias Clasen
2217509701 Plug a memory leak in gsk tests
Pointed out by asan.
2023-06-27 21:48:12 -04:00
Matthias Clasen
16e46a73f3 Plug a memory leak in gsk_render_node_serialize
This was introduced in 0d6a6a5997 with named
textures.
2023-06-27 21:43:17 -04:00
Christian Hergert
32a3690a3c maplistmodel: implement GtkSectionModel
This just wraps the underlying GListModel if it is a GtkSectionModel.
2023-06-27 18:08:20 -07:00
Benjamin Otte
526771751f Merge branch 'dboles/issue5922-DropTarget-reject-enter-critical' into 'main'
DropTarget: Fix critical if `reject()` drop before `::enter`

Closes #5922

See merge request GNOME/gtk!6152
2023-06-27 21:30:03 +00:00
Daniel Boles
dfa6591675 DropTarget: Fix critical if reject drop pre-enter
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5922

The docs of `Gtk.DropTarget::accept` say this:
> If the decision whether the drop will be accepted or rejected depends
> on the data, [`::accept`] should return `TRUE`, [`:preload`] should be
> set and the value should be inspected via the `::notify:value` signal,
> calling `gtk_drop_target_reject()` if required.

But this pattern causes a CRITICAL, given these steps:
* Create a `DragSource` and `DropTarget`
* Keep the default `::accept` handler and set `:preload` to `TRUE`
* Connect to `notify::value` and therein call `DropTarget.reject()`
* CRITICAL at `DropTarget.enter()`→`Drop.get_actions()` on NULL instance

We should let the documented case work without a CRITICAL or worse, null
deref. And per @otte on the bug, we should bail earlier before `::enter`
& setting `GTK_STATE_FLAG_DROP_ACTIVE`; neither should occur if rejected

This fixes that, by checking after `start_drop()` when notifications are
thawed, whether any handler has `reject()`ed & set our `drop` to `NULL`.
2023-06-27 21:37:32 +01:00
Daniel Boles
6252517aac DropTarget: Fix if block indented 1 step too far 2023-06-27 21:37:20 +01:00
Matthias Clasen
51e440fa03 Merge branch 'fix-asan-ifunc' into 'main'
Fix fp16 with asan

See merge request GNOME/gtk!6153
2023-06-27 19:55:28 +00:00
Matthias Clasen
d82fb6f20a Fix fp16 with asan
The IFUNC resolvers that we are using here get
run early, before asan had a chance to set up its
plumbing, and therefore things go badly if they
are compiled with asan. Turning it off makes things
work again.

The gcc bug tracking this problem:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110442

Thanks to Jakub Jelinek and Florian Weimer for
analyzing this and recommending the workaround.
2023-06-27 15:17:56 -04:00
Matthias Clasen
44de6a6cbe Merge branch 'wip/sadiq/fix-use-after-free' into 'main'
gldriver: Fix a possible use-after-free

See merge request GNOME/gtk!6151
2023-06-27 18:46:28 +00:00
Mohammed Sadiq
64e27cd87d gldriver: Fix a possible use-after-free
g_hash_table_insert() frees the given key if it already exists
in the hashtable.  But since we use the same pointer in the
following line, it will result in use-after-free.

So instead, insert the key only if it doesn't exist.
2023-06-27 22:45:07 +05:30
Benjamin Otte
60e75f8a2a Merge branch 'wip/otte/for-vulkan' into 'main'
vulkan: Generate vertex array headers from shaders

See merge request GNOME/gtk!6149
2023-06-27 16:20:29 +00:00
Matthias Clasen
57eda94dde Merge branch 'matthiasc/for-main' into 'main'
gtk4-builder-tool: Fix naming

See merge request GNOME/gtk!6150
2023-06-27 11:24:08 +00:00
Matthias Clasen
723fb6c8be gtk4-builder-tool: Fix naming
We install the tool as gtk4-builder-tool, so that
is what it should call itself.

String change.
2023-06-27 07:09:04 -04:00
Benjamin Otte
6c85ed1ba1 vulkan: Generate vertex array headers from shaders
The script is pretty dumb but it does its job.
2023-06-27 07:11:48 +02:00
Benjamin Otte
2e58274f23 vulkan: Rename crossfade => cross-fade
Preparation for the future.
2023-06-27 06:46:57 +02:00
Benjamin Otte
4ade0afe03 vulkan: Rename blendmode to blend-mode
Preparation for future changes, nothing to see here.
2023-06-27 06:46:57 +02:00
Benjamin Otte
93fb45c689 Merge branch 'wip/otte/vulkan-for-main' into 'main'
vulkan: Add a pipeline cache

See merge request GNOME/gtk!6148
2023-06-26 18:52:48 +00:00
Benjamin Otte
684a015c98 vulkan: Add a pipeline cache
Make the display handle the cache, because we only need one.

We store the cache in
  $CACHE_DIR/gtk-4.0/vulkan-pipeline-cache/$UUID.$VERSION
so we regenerate caches for each different device (different UUID) and
each different driver version.

We also keep track of the etag of the cache file, so if 2 different
applications update the cache, we can detect that.
Vulkan allows merging caches, so the 2nd app reloads the new cache file
and merges it into its cache before saving.
2023-06-26 20:28:11 +02:00
Matthias Clasen
f7fcd2e425 Merge branch 'main' into 'main'
Add settable search match mode in dropdown

See merge request GNOME/gtk!6146
2023-06-26 18:18:14 +00:00
Matthias Clasen
c6c637fe21 Merge branch 'matthiasc/for-main' into 'main'
buildertool: Make render an alias for screenshot

See merge request GNOME/gtk!6147
2023-06-26 15:38:32 +00:00
Matthias Clasen
33fc4d6495 buildertool: Make render an alias for screenshot
Its a more neutral name and will align better with
other tools.
2023-06-26 10:58:35 -04:00
al_SeveR
33ff927522 Add settable search match mode in dropdown 2023-06-26 14:14:39 +00:00
Leônidas Araújo
2d39cdbff8 Update Brazilian Portuguese translation
(cherry picked from commit 98a2aae5ac)
2023-06-26 13:08:53 +00:00
Daniel Boles
8d675810e8 GtkText: Link to descendents/monospace CSS nodes
Change the descendent classes from `monospace`-without-links to links.
Add `monospace` around the names of CSS nodes and classes for clarity.
2023-06-26 13:05:39 +01:00
Matthias Clasen
8b25481c26 widget-factory: Set a11y labels on scale buttons
Just to check that this works now.
2023-06-25 22:28:23 -04:00
Ekaterine Papava
5fdf96f496 Update Georgian translation 2023-06-25 13:39:03 +00:00
Matthias Clasen
b61991a023 Merge branch 'gtkstack_fix_pages_param_check' into 'main'
stack: fix pages list bounds check

See merge request GNOME/gtk!6141
2023-06-24 12:08:18 +00:00
G.Willems
91d302a201 stack: fix pages list bounds check
Fix integer underflow when children->len is 0.
Add missing bounds check in select_item()
2023-06-24 03:05:37 +02:00
Matthias Clasen
35a1a62d50 Merge branch 'ebassi/builder-docs' into 'main'
docs: Clean up section on UI definitions

See merge request GNOME/gtk!6139
2023-06-23 23:45:05 +00:00
Matthias Clasen
ac7a4cb94c Merge branch 'wip/chergert/gdatetime-from-gtkbuilder' into 'main'
builder: add support for parsing GDateTime

See merge request GNOME/gtk!6140
2023-06-23 23:43:28 +00:00
Christian Hergert
bacd7ef92f builder: add support for parsing GDateTime
This will parse a <property/> containing the ISO 8601 format for a date
for use in GDateTime properties. For example:

  <property name="sampled-at">2023-06-23T00:00:00.00</property>
2023-06-23 14:11:37 -07:00
Emmanuele Bassi
980dc44f4a docs: Clean up section on UI definitions
The current documentation is narrative, but it lacks examples and proper
formatting, which makes it harder to read and visually scan.

Let's split off paragraphs and sections, so they can be easily linkend,
and add a few examples for each description.
2023-06-23 14:31:57 +01:00
Daniel Boles
2d648f84a9 docs/ref/gtk/running: Mention GDK_DEBUG=no-portals
It was omitted from !5336
2023-06-23 14:24:47 +01:00
Daniel Boles
aef0943f61 FileDialog: Fix typos of "inital" to "initial" 2023-06-23 13:50:53 +01:00
Matthias Clasen
3e146171cb Merge branch 'dboles/FileDialog_initial-folder_from_initial-file' into 'main'
Fix FileDialog: initial-file doesnʼt set initial-folder

See merge request GNOME/gtk!6137
2023-06-23 01:14:15 +00:00
Matthias Clasen
24bbaceaa4 Merge branch 'always-more-a11y-fixes' into 'main'
scalebutton: Use the group role

See merge request GNOME/gtk!6138
2023-06-23 01:06:57 +00:00
Matthias Clasen
318cf132e9 a11y: Extend the nested button hack to volume buttons 2023-06-22 18:37:10 -04:00
Matthias Clasen
8bbc143ed1 scalebutton: Use the group role
This is needed for accessible labels to work.
2023-06-22 18:36:39 -04:00
Daniel Boles
220d130c0f FileDialog: initial-file didnʼt set initial-folder
We always set :initial-folder to NULL and then notified about that,
instead of setting it to the folder of the :initial-file as we say.
2023-06-22 22:33:14 +01:00
Jordi Mas
e28a32a7c7 Update Catalan translation 2023-06-22 21:00:28 +02:00
Matthias Clasen
88f8b77d77 Merge branch 'matthiasc/for-main' into 'main'
docs: Mention GtkAccessibleRange

See merge request GNOME/gtk!6136
2023-06-22 02:40:08 +00:00
Matthias Clasen
1066374909 docs: Mention GtkAccessibleRange
In the accessibility docs about custom widgets,
mention GtkAccessibleRange as the best way to
implement custom range widgets.
2023-06-21 22:15:59 -04:00
Matthias Clasen
34a2595dfb Merge branch 'more-a11y-fixes' into 'main'
widget: Don't let abstract role slip through

See merge request GNOME/gtk!6135
2023-06-22 00:47:03 +00:00
Matthias Clasen
76fcd5cf25 Add another a11y test
This one catches the lingering 'widget' role
that only happens when widgets are realized
and rooted.
2023-06-21 19:55:46 -04:00
Matthias Clasen
32e6ed4eca a11y: Use group role for color and font buttons
This is needed since generic does not allow naming.
2023-06-21 19:55:46 -04:00
Matthias Clasen
2983c0be70 widget: Don't let abstract role slip through
When there isn't an accessible role set on the
instance or in class_init, we want to default
to 'generic'. There was one place where we
failed to do so.
2023-06-21 16:18:33 -04:00
Matthias Clasen
e0bf6585de Cosmetics: typo fix 2023-06-21 16:18:33 -04:00
Daniel Boles
c045b0be4c Settings: prop typo => "No description available."
Fix the typo so that we'll actually get documentation for
gtk-entry-select-on-focus.
2023-06-21 20:48:17 +01:00
Matthias Clasen
d8c094944a Merge branch 'more-a11y-fixes' into 'main'
a11y: Don't forget to space-separate computed names

See merge request GNOME/gtk!6134
2023-06-21 18:52:35 +00:00
Matthias Clasen
510bf86268 Add another a11y test
Test that roles come out right for custom widgets.
2023-06-21 14:24:52 -04:00
Matthias Clasen
f3bea027a0 Dropdown: Explicitly set a role
For some reason I haven't been able to track down,
the listitemwidget comes up wit the abstract widget
role otherwise.
2023-06-21 14:17:52 -04:00
Matthias Clasen
bce3b6f34a aboutdialog: Fix roles one more time
We are more picky about generic, so use group.
2023-06-21 13:47:59 -04:00
Matthias Clasen
01274dfbb9 shortcutswindow: Fix up roles and labels again 2023-06-21 13:18:58 -04:00
Matthias Clasen
533a2cf9ec a11y: Don't forget to space-separate computed names
This was overlooked in one place.
2023-06-21 13:18:07 -04:00
Luca Bacci
43af0ee514 Define this_module with (void) argument
Fixes a compiler warning about K&R (old-style) function definition
2023-06-21 16:18:40 +02:00
Luca Bacci
3912d6aba9 GdkWin32: Fix keyboard state for WinPointer input
The dwKeyStates field of the POINTER_INFO structure
is always set to 0, no matter what. Use GetKeyState
instead.

Forward-port of !4327 to GTK4
2023-06-21 16:18:01 +02:00
Luca Bacci
871685e271 GdkWin32: Use double coordinates for mouse events
Mouse coordinates reported by the system are still integers,
but go sub-pixel when dividing by the window scale factor.
2023-06-21 16:07:55 +02:00
Luca Bacci
5e9daa9728 GdkWin32: Unscaled coordinates in current_root_x, current_root_y
Also modify gdk_win32_surface_do_move_resize_drag() to take
unscaled root coordinates.

Fixes #5877
2023-06-21 16:01:42 +02:00
Luca Bacci
412bc1713a GdkWin32: Keep track of the last cursor position in move / resize contexts
...and avoid doing any work if the position hasn't changed.
2023-06-21 15:31:48 +02:00
Matthias Clasen
5dbc5bbf22 Merge branch 'wip/antoniof/my-mistake' into 'main'
Fix my a mistake

See merge request GNOME/gtk!6130
2023-06-21 12:01:00 +00:00
António Fernandes
79c999cf76 columnviewrowwidget: Reset roles on teardown
This was added to the wrong file in e245883f91

Fix the mistake.
2023-06-21 12:23:39 +01:00
Matthias Clasen
e375bc8838 Merge branch 'wip/antoniof/columnviewrow-accessible-label' into 'main'
columnviewrow: Add accessible-label and -description

Closes #5903

See merge request GNOME/gtk!6129
2023-06-21 10:22:41 +00:00
Matthias Clasen
79505f940b Merge branch 'always-more-a11y-fixes' into 'main'
range: Don't use an abstract role

See merge request GNOME/gtk!6127
2023-06-21 10:07:57 +00:00
Matthias Clasen
0f087deb2a Merge branch 'bump-glib' into 'main'
Bump GLib requirement to 2.76.0

See merge request GNOME/gtk!6128
2023-06-21 10:07:40 +00:00
António Fernandes
e245883f91 columnviewrow: Add accessible-label and -description
Echoing the same changes introduced for GtkListItem by these commits:
* df8d28f5fe
* f2b682dd9c

Resolves https://gitlab.gnome.org/GNOME/gtk/-/issues/5903
2023-06-21 10:27:39 +01:00
Chun-wei Fan
4e9bd13892 Visual Studio: Remove workarounds for <= glib-2.74.x
We now need glib-2.76.0 or later, which removes our needs for the workarounds
that we need to build the media backends against GLib-2.74.x or earlier, so
clean up things a bit.
2023-06-21 12:29:38 +08:00
Chun-wei Fan
65e9b8fe66 glib.wrap: Use 2.76.0
We are now using APIs that were introduced in 2.75.x, so let's use glib-2.76.0
here for our glib subproject.

Update the build and gobject-introspection items accordingly
2023-06-21 12:27:41 +08:00
Matthias Clasen
e9f870fee6 Make generic really the default role
If nothing else has been set for the instance
or the class, return GTK_ACCESSIBLE_ROLE_GENERIC.
2023-06-20 22:02:37 -04:00
Matthias Clasen
e5e5966934 frame: Use the group role 2023-06-20 21:58:55 -04:00
Matthias Clasen
5c407365e3 ci: Use the current build options for flatpaks
These were changed a while ago.
2023-06-20 20:49:29 -04:00
Matthias Clasen
7e251d81c2 a11y: Fix the stack switcher selection implementation
This was listening for signals on the wrong object.
2023-06-20 20:49:29 -04:00
Matthias Clasen
92d1d52c59 NEWS: updates 2023-06-20 20:49:29 -04:00
Matthias Clasen
ef436e4dce range: Don't use an abstract role
This snuck through, because the range wasn't
setting any role at all, it just ends up using
the initial, abstract role of widget.
2023-06-20 20:49:29 -04:00
Benjamin Otte
1a07e336bf Merge branch 'wip/otte/for-vulkan' into 'main'
vulkan: Fix a bunch of validation-layer complaints

See merge request GNOME/gtk!6126
2023-06-20 18:38:41 +00:00
Benjamin Otte
169355f771 vulkan: Rebuild the precompiled shaders
We forgot that with all the changes.
2023-06-20 20:17:06 +02:00
Benjamin Otte
299c6a3d6f vulkan: Take offscreen fromat from context
We want to create offscreens in compatible formats, and in particular we
want to ideally use the same format as rendering would use.
2023-06-20 20:15:12 +02:00
Benjamin Otte
17698bfd2e vulkan: Use 3 descriptor sets, not 3 bindings
It turns out variable length is only supported for the last binding in
a set, not for every binding.
So we need to create one set for each of our arrays.

[ VUID-VkDescriptorSetLayoutBindingFlagsCreateInfo-pBindingFlags-03004 ] Object 0: handle = 0x33a9f10, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xd3f353a | vkCreateDescriptorSetLayout(): pBindings[0] has VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT but 0 is the largest value of all the bindings. The Vulkan spec states: If an element of pBindingFlags includes VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT, then all other elements of VkDescriptorSetLayoutCreateInfo::pBindings must have a smaller value of binding (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkDescriptorSetLayoutBindingFlagsCreateInfo-pBindingFlags-03004)
2023-06-20 20:15:12 +02:00
Benjamin Otte
377592cb62 vulkan: Use the right flags
Somebody (me) had flipped the 2 flags in commit ba28971a18:

[ VUID-vkCmdCopyBufferToImage-srcBuffer-00174 ] Object 0: handle = 0x3cfaac0, type = VK_OBJECT_TYPE_COMMAND_BUFFER; Object 1: handle = 0x430000000043, type = VK_OBJECT_TYPE_BUFFER; | MessageID = 0xe1b276a1 | Invalid usage flag for VkBuffer 0x430000000043[] used by vkCmdCopyBufferToImage. In this case, VkBuffer should have VK_BUFFER_USAGE_TRANSFER_SRC_BIT set during creation. The Vulkan spec states: srcBuffer must have been created with VK_BUFFER_USAGE_TRANSFER_SRC_BIT usage flag (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-vkCmdCopyBufferToImage-srcBuffer-00174)
2023-06-20 20:15:12 +02:00
Benjamin Otte
015cebc046 vulkan: Set descriptorBindingStorageBufferUpdateAfterBind
It's necessary now that we use storage buffers for gradients:

[ VUID-VkDescriptorSetLayoutBindingFlagsCreateInfo-descriptorBindingStorageBufferUpdateAfterBind-03008 ] Object 0: handle = 0x1e72d70, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x943cc552 | vkCreateDescriptorSetLayout(): pBindings[0] can't have VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT for VK_DESCRIPTOR_TYPE_STORAGE_BUFFER since descriptorBindingStorageBufferUpdateAfterBind is not enabled. The Vulkan spec states: If VkPhysicalDeviceDescriptorIndexingFeatures::descriptorBindingStorageBufferUpdateAfterBind is not enabled, all bindings with descriptor type VK_DESCRIPTOR_TYPE_STORAGE_BUFFER must not use VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkDescriptorSetLayoutBindingFlagsCreateInfo-descriptorBindingStorageBufferUpdateAfterBind-03008)
2023-06-20 20:15:12 +02:00
Benjamin Otte
0a5e5023a8 vulkan: Remove unused declaration from shader 2023-06-20 20:15:12 +02:00
Matthias Clasen
a9b8ad6181 Merge branch 'always-more-a11y-fixes' into 'main'
Add a comment about accessible naming

See merge request GNOME/gtk!6125
2023-06-20 17:13:51 +00:00
Matthias Clasen
7331683c01 a11y: Improve name computation
We only want to settle on subtree content
if it provides nonempty text. Otherwise,
the tooltip should still win.

This was clarified in the current Editor Draft
of the accessible name computation spec.
2023-06-20 12:34:51 -04:00
Matthias Clasen
cca6a66518 a11y: Fix tests
The change to make hidden follow mappedness
means that we now need to arrange for our
test cases to be mapped.
2023-06-20 12:33:02 -04:00
Matthias Clasen
891462e5af Add some more a11y tests
Check that the hidden state is as it should be.
2023-06-20 11:05:22 -04:00
Matthias Clasen
95cd6fe206 menubutton: Remove all the labelled-by relations
This was a bit much, and should not be necessary anymore,
now that our name computation handles nested buttons.
2023-06-20 10:58:18 -04:00
Matthias Clasen
63534fd9eb widget: Fix accessible hidden state
Make this track the widgets' mapped state
instead of visible. Also, set hidden to FALSE
initially, since the accessible name computation
checks for hidden==FALSE.
2023-06-20 10:40:12 -04:00
Matthias Clasen
e836e3380e Add a comment about accessible naming
Put a note on why there are a few differences
to ARIA.
2023-06-20 06:54:59 -04:00
Matthias Clasen
f693beab57 NEWS: Updates 2023-06-20 06:54:40 -04:00
Matthias Clasen
2d2df42a94 Merge branch 'listitem-a11y' into 'main'
listitem: Add accessible-label and -description

See merge request GNOME/gtk!6123
2023-06-20 09:55:58 +00:00
Matthias Clasen
fb0a4fa457 a11y: Stop recommending tab list labels
There is no good way to set an explicit label
on the tab list of a GtkNotebook, so showing
a blue overlay on it is annoying more than
helpful.

This is another little deviation from the ARIA
authoring guidelines.
2023-06-19 22:20:05 -04:00
Matthias Clasen
be0003c108 a11y: Stop recommending against listitem labels
Due to the way listviews are set up, there is not
much of an alternative to setting labels on the
listitems, so don't recommend against doing it.

This is a little deviation from the ARIA authoring
guidelines.
2023-06-19 22:20:05 -04:00
Matthias Clasen
eb1e24a5bf gizmo: Stop using abstract roles
This was overlooked.
2023-06-19 22:20:05 -04:00
Matthias Clasen
a3e98558d3 gtk-demo: Some a11y improvements
Add missing labels to the applauncher demo
and the clocks demo.
2023-06-19 22:19:54 -04:00
Matthias Clasen
f2b682dd9c listitemwidget: Clean up in teardown 2023-06-19 21:50:45 -04:00
Matthias Clasen
b826ef4f4d Merge branch 'a11y-work' into 'main'
A11y role changes

See merge request GNOME/gtk!6101
2023-06-20 01:23:13 +00:00
Matthias Clasen
a2fdeb99e0 gtk-demo: Improve a11y for applauncher
Use the new listitem properties to make
orca read the selected item in the applauncher
demo.
2023-06-19 21:21:55 -04:00
Matthias Clasen
df8d28f5fe listitem: Add accessible-label and -description
Add properties to GtkListItem to set the accessible
label and description of the listitem widget. This
is important, since orca will read these if the
listitem widget ends up with the focus.
2023-06-19 21:21:55 -04:00
Matthias Clasen
838c51cc92 a11y: Add the ARIA ontology
Add a helper function to find out which roles are
superclasses of each other.

This isn't used yet (apart from the existing use for
ranges), but it might be in the future.
2023-06-19 18:38:58 -04:00
Matthias Clasen
315ded687c Docs: update 2023-06-19 18:38:58 -04:00
Matthias Clasen
6855346269 a11y: Treat widget and window as abstract roles
We no longer use these, so we can enforce
that they are abstract.
2023-06-19 18:38:58 -04:00
Matthias Clasen
c2d6f900d9 window: Use application as accessible role
ARIA deems the window role to be abstract,
so lets use the application role instead.

Update affected tests.
2023-06-19 18:38:58 -04:00
Matthias Clasen
85c2d5f14e Add the application role
ARIA has this role. We left it out initially, but
it is an ok fit for toplevel windows, and better
than window, since that is meant to be abstract.
2023-06-19 18:38:58 -04:00
Matthias Clasen
b3eb912cf3 Use generic as default accessible role
The ARIA specs want widget to be abstract role.
We should respect that and use 'generic' instead.
2023-06-19 18:38:58 -04:00
Matthias Clasen
81d9205369 widget: Warn for abstract accessible roles
These should not be used for widgets, so warn if
they are passed to gtk_widget_set_accessible_role()
or gtk_widget_class_set_accessible_role().
2023-06-19 18:38:32 -04:00
Matthias Clasen
152a335cee Add gtk_accessible_role_is_abstract
Move this code from the a11y overlay in the inspector.
It will be used more widely, going forward.
2023-06-19 18:30:41 -04:00
Matthias Clasen
b84650c2a3 Add another a11y test 2023-06-19 18:30:41 -04:00
Matthias Clasen
722bea2943 Merge branch 'a11y-defeat' into 'main'
Give up on warning ATs into submission

See merge request GNOME/gtk!6121
2023-06-19 21:06:13 +00:00
Matthias Clasen
6c337b949d Merge branch 'fix-issue-5899' into 'main'
GtkFileChooserWidget: Fix condition on visit action

Closes #5899

See merge request GNOME/gtk!6103
2023-06-19 20:52:15 +00:00
Matthias Clasen
db97a35dc7 a11y: Remove the unrealized warning
This warning triggers quite a lot when opening
a window while orca is running, which clearly
shows that what it warns about happens in
practice. But fixing it is reentry hell, and
not a battle I'm up for today.
2023-06-19 16:41:39 -04:00
Matthias Clasen
c2fda63b0d Give up on warning ATs into submission
Its been more than a decade since Wayland
has not supported screen coordinates. Clearly
spamming every apps stderr with warnings is
never going to make ATs stop asking for screen
coordinates.

Just give up. Go home
2023-06-19 16:41:20 -04:00
Benjamin Otte
5da64e9e34 Merge branch 'unaligned-access' into 'main'
gtk: Align key_size up to key_align

Closes #5907

See merge request GNOME/gtk!6120
2023-06-19 20:26:18 +00:00
Matt Turner
3f360aa883 gtk: Align key_size up to key_align
Avoids unaligned accesses when e.g. the key_size is 12 and key_align is
8. We need to round the key size up to 16 to ensure that all keys are
appropriately aligned.

This manifested as a failure in the `gtk:gtk / sorter` unit test on
sparc.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5907
2023-06-19 15:55:09 -04:00
Matt Turner
a444045386 gtk: Pass G_ALIGNOF (...) to gtk_sort_keys_new
The sizeof and G_ALIGNOF are often, but not always, identical.
2023-06-19 15:54:51 -04:00
Daniel Boles
584a807ed6 Widget: Also mention get_height in get_alloc depʼn
The deprecation notice seems to have been copied from
get_allocated_width(), but for get_allocation() height is also relevant.
2023-06-19 20:29:23 +01:00
Matthias Clasen
72e5697804 Merge branch 'redo-a11y-name-computation' into 'main'
Reimplement a11y name computation

See merge request GNOME/gtk!6119
2023-06-19 17:49:22 +00:00
Matthias Clasen
93aff8a129 Add more name computation tests
Test the fallback for range values.

This was not working at all before
the previous commit.
2023-06-19 12:40:33 -04:00
Matthias Clasen
c3cfaab479 a11y: Fix name computation for ranges
There were two problems here:

First, the code was checking for the abstract
range role, instead of its subclasses.

Second, the code was calling a string value
getter on a number value. Oops.
2023-06-19 12:40:32 -04:00
Matthias Clasen
663e3d0811 Add tests for accessible name computation 2023-06-19 12:38:51 -04:00
Matthias Clasen
2dc35ec0c1 a11y: Quietly allow realizing unrooted at context
We can't set the display if we don't have a root,
but the default display is more than good enough
for the tests which otherwise would need to do
quite a bit more setup work to make their test
widgets rooted.
2023-06-19 12:38:51 -04:00
Matthias Clasen
a791f235e6 a11y: Only allow get_name/description when realized
These functions rely on self->accessible_role
being set, and that is only the case for realized
contexts.

In practice, this is not a problem. Contexts are
realized before ATs can get their names or descriptions,
and the inspector realizes contexts too, nowadays.

The only place where this caused a hickup is the
testsuite.
2023-06-19 12:38:51 -04:00
Matthias Clasen
7df9cc1b47 label: Stop overriding accessible label
There's no need to, the accessible name computation
picks the content up where it is allowed (and not
overridden by explicit attributes).
2023-06-19 12:38:51 -04:00
Matthias Clasen
4449344fad a11y: Reimplement name computation
Reimplement the name computation to follow the spec
(https://www.w3.org/TR/accname-1.2) more closely.

Also, unify the functions for name and description,
since their only difference is which property/relation
they use.
2023-06-19 12:38:51 -04:00
Matthias Clasen
e1c9f50d26 a11y: Cosmetics
No need to have two code paths doing the same.
2023-06-19 12:38:51 -04:00
Matthias Clasen
1f029229dc Merge branch 'a11y-inspector-tweaks' into 'main'
Move the a11y naming data into gtk proper

See merge request GNOME/gtk!6118
2023-06-19 16:21:31 +00:00
Matthias Clasen
a80dd28e35 a11y: Move naming data to gtkatcontext.c
This is in preparation for using this information
in the name computation.
2023-06-19 11:17:47 -04:00
Matthias Clasen
16077fbdac inspector: Tweak the a11y overlay
Shorten the warnings, and lower some of the
errors to 'not recommended' (where the authoring
guidelines say 'do not label', but aria doesn't
prohibit labels outright).
2023-06-19 11:17:47 -04:00
Matthias Clasen
1906bb5263 a11y: Update the name-prohibited list
ARIA has the time role in this as well.

It does not matter in practice since we don't
have a widget with this role, but lets match
the specs.
2023-06-19 11:17:47 -04:00
Matthias Clasen
a8b907a33c a11y: Cover the printer option widget case too
This is another case of nested control, in this
case it goes two levels deep. Since we already
have this hack, lets use it for all the cases.
This avoids some more complicated workaround.
2023-06-19 11:17:47 -04:00
Matthias Clasen
f2a2e97004 docs: Add guidance on container roles
Provide some guidance on whether group or generic
is a more suitable role for containers.
2023-06-19 11:17:47 -04:00
Matthias Clasen
a86923de94 a11y: Change the role for many containers
The group role that we've used before has some
implications of semantic grouping, whereas these
containers are mainly about layout, so use the
generic role instead.

This should not affect the translation to AT-SPI
at all.

The affected containers are: box, grid, centerbox,
scrolledwindow, viewport, windowhandle, aspectframe.

The role of GtkTreeExpander has been changed to
button instead, since it acts as a button.
2023-06-19 11:15:48 -04:00
Matthias Clasen
4412f25c9f a11y: Treat none and presentation the same
ARIA says these roles are aliases, so treat them
the same.
2023-06-19 11:15:48 -04:00
Benjamin Otte
c40588886b Merge branch 'wip/otte/for-vulkan' into 'main'
vulkan: Add support for different image formats

See merge request GNOME/gtk!6117
2023-06-19 14:30:50 +00:00
Benjamin Otte
4045a0edd1 vulkan: Check for descriptor indexing extension
By checking if the extension is supported and avoiding devices when it
isn't, we avoid critical warnings later.
2023-06-19 15:08:00 +02:00
Benjamin Otte
636591c080 vulkan: Refactor function
Instead of checking for one specific extension, instead pass the
extension to check for by name.

This way we can reuse it for different extensions.
2023-06-19 15:08:00 +02:00
Benjamin Otte
aa6c670f15 vulkan: Add support for high bit depth 2023-06-19 15:08:00 +02:00
Benjamin Otte
746d0d8fde vulkan: Don't create unnecessary render passes
Pass the render pass to the pipeline creation function instead of
creating an extra one just for pipeline creation.
2023-06-19 15:08:00 +02:00
Benjamin Otte
35b09c727a vulkan: Put the framebuffer in the renderpass
... instead of having fancy caching.

That caching is complicated and it's not necessary.
2023-06-19 15:08:00 +02:00
Benjamin Otte
c35f491795 vulkan: Store the VkFormat in GskVulkanImage
... and use that info when creating renderpasses.
2023-06-19 15:08:00 +02:00
Benjamin Otte
5b64ca7e0a vulkan: Pick high depth texture for high depth nodes
If a node has a higher depth, pick the RGBA format that has that depth
as the texture format we're renderig to with render_texture().

Support for adapting the swapchain is not part of this.
2023-06-19 15:08:00 +02:00
Benjamin Otte
d61737ac7a vulkan: Add format fallback
When a GdkMemoryFormat isn't supported, pick close formats that have a
higher chance of being supported.
Make sure this works recursively and the whole loop always ends up at
R8G8B8A8_UNORM because that one is mandatory.

Roughly, follow these rules:
1. Drop the unpremultiplied
2. Expand channels to include all of RGBA
3. pick swizzle that is RGBA
4. pick next largest depth
5. pick R8G8B8A8_UNORM
2023-06-19 15:08:00 +02:00
Benjamin Otte
ba28971a18 vulkan: Allow mapping images as "read" and/or "write"
This way, we unify the code paths for memory access to textures.

We also technically gain the ability to modify images, though I have no
use case for this.
2023-06-19 15:08:00 +02:00
Benjamin Otte
7b4846bc25 vulkan: Pass format to offscreen creation function
That way, the offscreen can create images of different types.

Its not used in this commit, but will come in handy when we want to
support high bit depth.
2023-06-19 15:08:00 +02:00
Benjamin Otte
eb3ccfb404 vulkan: Remove gsk_vulkan_image_new_for_framebuffer()
Use gsk_vulkan_image_new_for_offscreen() instead, it does the same thing
pretty much.
2023-06-19 15:08:00 +02:00
Benjamin Otte
e4c37ceb34 vulkan: Allow uploading in different formats
This requires quite some code because Vulkan may not support all the
formats and then we need to detect that and fallback properly.
2023-06-19 15:08:00 +02:00
Benjamin Otte
dae1e2b117 vulkan: Create the view in vulkan_image_new()
All callers want it created anyway.

Plus, we can consolidate things in future commits.
2023-06-19 15:08:00 +02:00
Benjamin Otte
49c2366121 testsuite: Unify skipping memorytexture test
... and make it handle more cases of failure, in particular OpenGL and
Vulkan being unsupported by the system.
2023-06-19 15:08:00 +02:00
Emmanuele Bassi
76efe45552 Merge branch 'more-a11y-tweaks' into 'main'
A11y improvements

See merge request GNOME/gtk!6116
2023-06-19 12:53:10 +00:00
Matthias Clasen
1489c764cb docs: Expand role docs
Clarify that presentation and none
can be used interchangeably.
2023-06-19 08:28:54 -04:00
Matthias Clasen
d5a6d09348 dropdown: Use presentation instead of none 2023-06-19 08:28:54 -04:00
Benjamin Otte
ae89f6e6c0 testsuite: Add a vulkan method to memorytexure test
This uses the newly added NULL-surface renderer.
2023-06-19 14:13:03 +02:00
Benjamin Otte
63edecd857 vulkan: Make gsk_renderer_realize() work with NULL surface
Pretty much copy what GL does and just use the default display to create
GPU-related resources without the need for a display.

This also adds gdk_display_create_vulkan_context() but I've
kept it private because the Vulkan API is generally considered in flux,
in particular with our pending attempts to redo how renderers work.
2023-06-19 14:13:03 +02:00
Benjamin Otte
515e1642a4 vulkan: Actually reset the buffer size
Fixes a bug introduced in d1135f9e3c.

Luckily the buffer was large enough that all my testing didn't catch it
because it took a few minutes to overflow.
2023-06-19 14:13:03 +02:00
Benjamin Otte
177ee89b99 vulkan: Renaming fix
This rename was a long time ago...
2023-06-19 14:13:03 +02:00
Matthias Clasen
94f5d2db0d modelbutton: Set a11y shortcuts 2023-06-19 08:09:49 -04:00
Matthias Clasen
d562c86638 printdialog: Some a11y improvements
Add proper roles and labels in some places.
2023-06-19 08:09:49 -04:00
Matthias Clasen
64ff528fe1 printdialog: Give the page range entry a label
This is mainly to pacify the a11y checker.
2023-06-19 08:09:49 -04:00
Matthias Clasen
5993a2a16e notebook: Make sure tabs are labelled 2023-06-19 08:09:49 -04:00
Matthias Clasen
ff20b3f303 windowcontrols: Cosmetics 2023-06-19 08:09:49 -04:00
Matthias Clasen
05ea3470e5 dropdown: Avoid accessibility warnings
The image here is just presentational.
2023-06-19 08:09:49 -04:00
Matthias Clasen
28e1f288c3 infobar: Improve a11y labelling
Treat the close button the same way we treat
the window close button, wrt. to accessibility.
2023-06-19 08:09:48 -04:00
Matthias Clasen
8d9a59f698 gtk-demo: Miscellaneous a11y improvements 2023-06-19 08:09:48 -04:00
Emmanuele Bassi
60a170db88 Merge branch 'a11y-remove-value-opt' into 'main'
a11y: Remove an overzealous optimisation

Closes #5886

See merge request GNOME/gtk!6115
2023-06-19 11:46:19 +00:00
Matthias Clasen
32550fd6fc a11y: Remove an overzealous optimisation
The result of calling update_property needs
to be that the property is marked as set
afterward, even if the value we pass happens
to match the default value.

After this change, scrollbars have value-now
show up as zero in the accessiblity page of
the inspector, even when that matches the lower
bound.

Test included.

Fixes: #5886
2023-06-19 07:22:32 -04:00
Matthias Clasen
12fb249dc6 Merge branch 'a11y-nest-button-redux' into 'main'
Revert "dropdown: Shuffle accessible roles around"

See merge request GNOME/gtk!6111
2023-06-18 15:42:06 +00:00
Matthias Clasen
c3904e8a27 Merge branch 'main' into 'main'
Revert "Use gsk_matrix_transform_point3d consistently"

Closes #5902

See merge request GNOME/gtk!6112
2023-06-18 13:19:07 +00:00
Benjamin Otte
799fd4f4a3 Merge branch 'wip/otte/for-main' into 'main'
memoryformat: Add gdk_memory_format_get_depth()

See merge request GNOME/gtk!6110
2023-06-18 13:14:57 +00:00
Benjamin Otte
090cd2238a gdk: Replace prefers_high_depth with depth
Now that we track depth, we can also pass it into the GDK frame code.

For now it's just passed along, code acts the same as with
prefers_high_depth.
2023-06-18 14:28:39 +02:00
Benjamin Otte
8b8dfcdfb4 rendernode: Change to gsk_render_node_get_preferred_depth()
Instead of just tracking preferred_high_depth(), track the actual depth
we'd like to have.
2023-06-18 14:26:18 +02:00
Benjamin Otte
9015ed1c43 memoryformat: Add gdk_memory_format_get_depth()
Replace gdk_memory_format_prefers_high_depth with the more generic
gdk_memory_format_get_depth() that returns the depth of the individual
channels.

Also make the GL renderer use that to pick the generic F16 format
instead of immediately going for F32 when uploading textures.
2023-06-18 14:26:18 +02:00
Benjamin Otte
1a6d60b7d7 inspector: Handle a11y being disabled 2023-06-18 14:26:18 +02:00
Yiğit Burak
603d9e091c Revert "Use gsk_matrix_transform_point3d consistently"
Revert commit 440d56a4
2023-06-18 15:14:23 +03:00
Matthias Clasen
743b27571d a11y: Special-case nested buttons
Special-case nested buttons in our name computation,
since it is hard to reconcile all the a11y attributes
being on the wrapper, but the focus ending up on the
button inside.

This is a pragmatic approach that works. The only
downside is that the wrapper and the button end up
with the same name+description, but at least orca
seems to only read the focus elements' ones.
2023-06-18 08:12:31 -04:00
Matthias Clasen
30c38951b9 Revert "colordialogbutton: Shuffle accessible roles around"
This reverts commit 343b9d246f.

Unfortunately, this makes it so that the focus ends up on
the 'generic' accessible, not the one with the label, and
orca remains quiet.
2023-06-18 07:35:52 -04:00
Matthias Clasen
11d7052a40 Revert "dropdown: Shuffle accessible roles around"
This reverts commit 5ec0b07baf.

Unfortunately, this makes it so that the focus ends up on
the 'generic' accessible, not the one with the label, and
orca remains quiet.
2023-06-18 07:34:50 -04:00
Matthias Clasen
48d719e58e Merge branch 'matthiasc/for-main' into 'main'
testsuite: Add some more a11y tests

See merge request GNOME/gtk!6109
2023-06-18 03:03:33 +00:00
Matthias Clasen
5ec0b07baf dropdown: Shuffle accessible roles around
Make the internal toggle button generic, so that
the a11y checker doesn't complain about it not
having a label. And mark the icons in the popup
as presentational.
2023-06-17 22:40:17 -04:00
Matthias Clasen
343b9d246f colordialogbutton: Shuffle accessible roles around
Make the color button itself take the button role,
and make the internal toggle button just be generic.

This solves the problem that labelled-by relations
that are set up in ui files via mnemonics point at
the toplevel, not the toggle button.
2023-06-17 22:40:17 -04:00
Matthias Clasen
de622c592d gtk-demo: a11y improvements
Make the clipboard demo come up clean in the
a11y checker.
2023-06-17 22:39:56 -04:00
Matthias Clasen
c2735f98b4 testsuite: Add some more a11y tests
Test that overriding roles works, both
via g_object_new, and via ui files.
2023-06-17 22:00:55 -04:00
Matthias Clasen
7669198d2c Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Fix a crash

Closes #4522

See merge request GNOME/gtk!6108
2023-06-18 01:47:50 +00:00
Emmanuele Bassi
6bf4ad866f Apply suggestions from review 2023-06-17 21:26:53 -04:00
Matthias Clasen
d705a7effa video: Make the overlay clickable
And add missing accessible labels at the same time.

Fixes: #4522
2023-06-17 19:30:08 -04:00
Matthias Clasen
407304f2ed inspector: Cosmetic fixes
Align the values on the a11y page to the right.
2023-06-17 19:30:08 -04:00
Matthias Clasen
21fa1d67ce mediacontrols: Add accessible labels 2023-06-17 19:29:53 -04:00
Matthias Clasen
a9f8ec71a4 gtk-demo: Misc a11y improvements 2023-06-17 19:29:53 -04:00
Matthias Clasen
caa8fb4fac gtk-demo: Fix a crash
This was broken in 6b2c088a29.
2023-06-17 17:56:41 -04:00
Matthias Clasen
d59fc3da3c Merge branch 'matthiasc/for-main' into 'main'
colordialogbutton: Sync color

See merge request GNOME/gtk!6107
2023-06-17 21:20:10 +00:00
Matthias Clasen
cbdcf64e4d inspector: Limit the width of a11y page
Ellipsize labels that can contain long
content to prevent a super-wide window.
2023-06-17 16:50:36 -04:00
Matthias Clasen
e251e7583f gtk-demo: Misc a11y fixes
Add some missing labels.
2023-06-17 16:50:36 -04:00
Matthias Clasen
158a3d4f04 inspector: Realize AT ontexts
Otherwise we don't get change notification...
2023-06-17 14:50:01 -04:00
Matthias Clasen
efeff41501 a11y: Set has-popup consistently
Set the has-popup property when a widget
has a context menu.
2023-06-17 12:18:34 -04:00
Matthias Clasen
80c4d4f51d colordialogbutton: Sync color
Make sure the color of the swatch and the button
are initially in sync. As a side-effect, this
ensures that the swatch has its accessible label
computed at the outset.
2023-06-17 11:52:37 -04:00
Matthias Clasen
115f60796f gtk-demo: Cosmetics 2023-06-17 11:52:37 -04:00
Matthias Clasen
7e62bdbf26 Merge branch 'matthiasc/for-main' into 'main'
Don't use "Tab list" as an accessible label

Closes #4839

See merge request GNOME/gtk!6106
2023-06-17 15:44:21 +00:00
Luca Bacci
16bdaa11ce GtkFileChooserWidget: Use GTK_INVALID_LIST_POSITION
...instead of G_MAXUINT
2023-06-17 15:51:22 +02:00
Luca Bacci
46afb4a9a4 GtkFileChooserWidget: Fix condition on visit action
Fixes #5899
2023-06-17 15:50:50 +02:00
Matthias Clasen
775e8dc43d Don't use "Tab list" as an accessible label
It does not add any extra information.

Fixes: #4839
2023-06-17 08:46:41 -04:00
Benjamin Otte
cc603bf657 Merge branch 'dropdown-sections' into 'main'
dropdown: Add section support

See merge request GNOME/gtk!6102
2023-06-17 06:41:30 +00:00
Matthias Clasen
0652e05e0b gtk-demo: Add an example for dropdown sections
Make one of the dropdowns in the Selections
demo have sections.
2023-06-16 21:13:26 -04:00
Matthias Clasen
1347d23658 dropdown: Add section support
Add a header-factory property and pass it through
to the listview in the popup.
2023-06-16 21:13:26 -04:00
Matthias Clasen
3cf349eb6e Merge branch 'fix-c4013' into 'main'
gtkprintoperation-win32.c: Fix build

See merge request GNOME/gtk!6099
2023-06-16 16:38:22 +00:00
Matthias Clasen
53503e3f19 Merge branch 'a11y-computed-name' into 'main'
atcontext: Update name computation

See merge request GNOME/gtk!6088
2023-06-16 16:30:51 +00:00
Daniel Boles
8106dc0f46 reference/gtk/coordinates: Fix typos of “widget’s” 2023-06-15 17:40:08 +01:00
Matthias Clasen
8dec07b6c4 Merge branch 'better_gtkstacksidebar' into 'main'
GtkStackSidebar: Explicitly mark the sidebar items as labeled by the labels

See merge request GNOME/gtk!6100
2023-06-15 12:54:20 +00:00
Lukáš Tyrychtr
29cf15a444 GtkStackSidebar: Explicitly mark the sidebar items as labeled by the labels
That improves the reading of the GtkStackSidebar widget considerably.
Previously, Orca would not read the items at all, now it does.
2023-06-15 14:29:31 +02:00
Chun-wei Fan
abe5eda0f0 gtkprintoperation-win32.c: Fix build
Include the needed headers so that we don't break the build with C4013
warnings, which are treated as errors if msvc_recommended_pragmas.h is
found during build configuration.
2023-06-15 18:50:10 +08:00
Benjamin Otte
fa98e2baf3 Merge branch 'listitem' into 'main'
signallistitemfactory: finish prototype change

See merge request GNOME/gtk!6098
2023-06-15 10:10:55 +00:00
Matthias Clasen
e5eba26eac Merge branch 'no_random_screen_coords' into 'main'
gtkatspicomponent: Don't return unitialized stack data as screen positions of widgets

See merge request GNOME/gtk!6097
2023-06-15 10:02:19 +00:00
Marc-André Lureau
611439aad7 signallistitemfactory: finish prototype change
Complete the API change from commit be1729b316 ("signallistitemfactory:
Update signal prototype").

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-06-15 09:52:34 +02:00
Lukáš Tyrychtr
cb3045bf38 gtkatspicomponent: Don't return unitialized stack data as screen positions of widgets
We can not compute the correct value, but that does not mean we should return
basically random values from an unitialized stack space.

Rather than that behavior, return zeros concistently.
2023-06-15 09:06:30 +02:00
Benjamin Otte
447d1fab62 Merge branch 'wip/otte/vulkan-for-main' into 'main'
vulkan: Move some code

See merge request GNOME/gtk!6096
2023-06-14 06:01:47 +00:00
Benjamin Otte
9836389fde vulkan: Repurpose debug flags for image uploads
Now that we don't use the old environment variables anymore to force
staging buffer/image uploads, we don't need them.

However, we do autodetect the fast path for avoiding a staging buffer
now, and we might want to be able to turn that off for testing.

So add GSK_DEBUG=staging that does exactly that.
2023-06-14 03:34:07 +02:00
Benjamin Otte
7f26f5a160 vulkan: Remove gsk_vulkan_image_new_from_data()
This is unused now that all the code uses map/unmap.

The only thing that map/unmap doesn't do that the old code did, was use
a staging image instead as alternative to a staging buffer for image
uploads.

However, that code is not necessary for anything, so I'm sure we can do
without.
2023-06-14 03:34:07 +02:00
Benjamin Otte
6a009b7182 vulkan: Add upload fastpath
If the memory heap that the GPU uses allows CPU access
(which is the case on basically every integrated GPU, including phones),
we can avoid a staging buffer and write directly into the image memory.

Check for this case and do that automatically.

Unfortunately we need to change the image format we use from
VK_IMAGE_TILING_OPTIMAL to VK_IMAGE_TILING_LINEAR, I haven't found a way
around that yet.
2023-06-14 03:34:07 +02:00
Benjamin Otte
17dd100f43 vulkan: Add gsk_vulkan_memory_can_map()
.. nd use it to assert memory is mappable when mapping it.
2023-06-14 03:34:07 +02:00
Benjamin Otte
49c2c2da1a vulkan: Use map/unmap for fallback images 2023-06-14 03:34:07 +02:00
Benjamin Otte
f88b1cef21 vulkan: Render fallback into vulkan memory
Use the new map/unmap image upload method for Cairo node drawing:
1. map() the memory
2. create an image surface or that memory
3. draw to that image surface
4. success

There's no longer a need for Cairo to allocate image memory.
2023-06-14 03:34:07 +02:00
Benjamin Otte
c27e412ff1 vulkan: Use new upload method for texture uploads
gsk_vulkan_image_new_from_texture() now uses the direct copy via
gdk_texture_downloader_download_into().
2023-06-14 03:34:07 +02:00
Benjamin Otte
0c72f19cb1 vulkan: Add a new way to upload data into images
As an alternative to gsk_vulkan_image_new_from_data() that
takes a given data and creates an image from it, add a 3 step process:
  gsk_vulkan_image_new_for_upload()
  gsk_vulkan_image_map_memory()
  /* put data into memory */
  gsk_vulkan_image_unmap_memory()

The benefit of this approach is that it potentially avoids a copy;
instead of creating a buffer to pass and writing the data into it before
then memcpy()ing it into the image, the data can be written straight
into image memory.

So far, only the staging buffer upload is implemented.

There are also no users, those come in the next commit(s).
2023-06-14 03:34:07 +02:00
Benjamin Otte
cb4e92946b vulkan: Move some code
Add gsk_vulkan_image_new_from_texture() and use it.

Also rewrite the actual code from using Cairo surfaces to using
GdkTextureDownloader.
2023-06-14 03:34:07 +02:00
Benjamin Otte
e7c86f4608 vulkan: Constify upload function 2023-06-14 03:34:07 +02:00
Matthias Clasen
4d026857dc Merge branch 'wip/carlosg/pad-detection' into 'main'
gdk/wayland: Create pad devices on enter

See merge request GNOME/gtk!6094
2023-06-14 00:10:32 +00:00
Carlos Garnacho
c523c68cef gdk: Include pads in GDK_SEAT_CAPABILITY_ALL
The GDK_SEAT_CAPABILITY_TABLET_PAD stood awkwardly out of the
ALL value. Even though it's not a keyboard, its focus has more
resemblance to it, so it should be part of this group together
with keyboards.
2023-06-14 01:42:53 +02:00
Carlos Garnacho
9f4320a4ac gdk/wayland: Create pad devices on enter
We were creating the pad device on wp_tablet_pad.done, but
at that time we do not know what tablet it is associated with,
thus we cannot get appropriate vid/pid/name properties for it.

To get that, we need to wait for the pad to enter a surface,
at that time we do know what tablet it is associated with, so
we can get better information about the device.

There are pads that may plausibly "change" tablet between
one .enter event and the next (e.g. Wacom Express Key Remote),
but this situation is highly unlikely. The pad devices created
are thus persistent until that situation happens.
2023-06-14 01:42:53 +02:00
Matthias Clasen
8f6cc19fdb Merge branch 'mcatanzaro/gtk-show-uri-deprecated-for' into 'main'
Change recommended replacement for gtk_show_uri()

See merge request GNOME/gtk!6093
2023-06-13 18:28:32 +00:00
Matthias Clasen
9831632fbd a11y docs: Some updates
Clarify what UI properties go into the name computation,
and mention the inspector tools for accessiblity.
2023-06-13 14:12:16 -04:00
Michael Catanzaro
bef1c69254 Change recommended replacement for gtk_show_uri()
Problem is GtkFileLauncher is unable to handle all the types of URIs
that are supported by gtk_show_uri(), e.g. help: URIs. GtkUriLauncher
avoids this problem.

Another problem is that GtkUriLauncher is just generally a better choice
for launching URIs, since you don't have to create a GFile in order to
use it. Porting code is slightly simpler.

The documentation still mentions both GtkFileLauncher and GtkUriLauncher
as options, but most people will use whatever the compiler recommends
when it prints the deprecation warning.
2023-06-13 13:03:04 -05:00
Carlos Garnacho
f381cdef5b Merge branch 'window-clear-resize_cursor-on' into 'main'
window: Clear resize_cursor on leave notify events

See merge request GNOME/gtk!6090
2023-06-13 11:39:04 +00:00
Michel Dänzer
f8fd04402e window: Clear resize_cursor on leave notify events
When the pointer leaves the window surface, gtk_window_capture_motion
will not be called anymore, so priv->resize_cursor may remain non-NULL
indefinitely without this.

If update_cursor is later called (via gtk_window_maybe_update_cursor) on
a virtual enter notify event (e.g. because the pointer entered a
descendant surface), it would previously re-set the window surface
cursor to priv->resize_cursor, which could result in the wrong cursor
shape being shown for descendant surfaces.

This affected mutter-x11-frames, see
https://gitlab.freedesktop.org/xorg/xserver/-/issues/1557.

One could also say that if the pointer leaves the window surface, it's
trivially not over any window edge.
2023-06-13 12:01:29 +02:00
Matthias Clasen
e5f570045e Merge branch 'matthiasc/for-main' into 'main'
Matthiasc/for main

See merge request GNOME/gtk!6091
2023-06-12 19:18:49 +00:00
Matthias Clasen
4bee0e2454 ci: Collect artifacts from the asan build 2023-06-12 14:54:28 -04:00
Matthias Clasen
fb6ce30fb4 listitemmanager: Quiet a compiler warning 2023-06-12 14:54:21 -04:00
Matthias Clasen
11108ed048 Merge branch 'a11y-overlay' into 'main'
inspector: Add an a11y overlay

Closes #5883

See merge request GNOME/gtk!6085
2023-06-12 17:56:26 +00:00
Matthias Clasen
deac44962a Fix a crash in gtk-demo
Fixes #5889
2023-06-12 12:12:49 -04:00
Daniel Boles
0f6219c9ca docs/reference/gtk/running: Incl GDK_DEBUG=portals
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5871
2023-06-12 16:29:52 +01:00
Luca Bacci
cf980cdefb Merge branch 'focus-modal-windows' into 'main'
win32: Focus modal windows when clicking on unfocused parent

See merge request GNOME/gtk!6051
2023-06-12 13:55:45 +00:00
Luca Bacci
51265e2367 Merge branch 'center-dialogs' into 'main'
win32: Center newly created transient windows

Closes #5407

See merge request GNOME/gtk!6050
2023-06-12 13:53:00 +00:00
Daniel Rusek
f1484df60a Update Czech translation 2023-06-12 13:14:31 +00:00
Matthias Clasen
92a8cf3f29 inspector: Add an a11y overlay
Add an overlay that shows a11y issues.

For now, this checks for:
 - abstract roles being used
 - elements without labels
 - required attributes
 - required context
2023-06-12 07:31:49 -04:00
Alice Mikhaylenko
5a877c8d43 menubutton: Horizontally expand child
Set hexpand on the outer box so we don't propagate that expand.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5883
2023-06-12 07:31:49 -04:00
Alice Mikhaylenko
1ffaf486af menubutton: Normalize label layout
- Remove unnecessary halign=center and hexpand=0 dance
- Set hexpand=false on the outer box so we don't propagate hexpand
2023-06-12 07:31:49 -04:00
Matthias Clasen
9c3e514d3f Merge branch 'misc-a11y-fixes' into 'main'
Various a11y improvements

See merge request GNOME/gtk!6089
2023-06-12 01:48:04 +00:00
Matthias Clasen
1b829c7d01 gtk4-demo: Some a11y improvements
Add some labels in the pickers demo.
2023-06-11 20:29:25 -04:00
Matthias Clasen
0f39069be1 filechooser: Some accessibility improvements 2023-06-11 20:29:25 -04:00
Matthias Clasen
bc27b54367 togglebutton: Set a11y properties on realize
The pressed property is required, so we need to
make sure that it is set.
2023-06-11 20:29:25 -04:00
Matthias Clasen
9e784f47c9 fontchooser: Add one more accessible property 2023-06-11 20:29:25 -04:00
Matthias Clasen
ade66c84ed aboutdialog: Set some accessible properties 2023-06-11 20:29:25 -04:00
Matthias Clasen
57c34fca96 menubutton: Set accessible relations
In the case where we create the popover, mark it
as labelled by the button.
2023-06-11 20:29:25 -04:00
Matthias Clasen
10e91f6281 shortcutswindow: Add some accessible properties 2023-06-11 20:29:25 -04:00
Matthias Clasen
aada893352 passwordentry: Change an accessible role
The caps-lock icon is really an alert. Maybe
this is in vain, since orca ignores these images.
2023-06-11 20:29:25 -04:00
Matthias Clasen
79847f20c4 atcontext: Change the way we handle fallback
The tooltip text should only be considered after
all other means are exhausted. but it can be used
for both the name and the description.

See https://www.w3.org/TR/accname-1.2/
2023-06-11 20:27:31 -04:00
Matthias Clasen
22548785b0 atcontext: Update name computation
Implement this sentence from the "Accessible Name
and Description Computation 1.2" spec:

    If the root node's role prohibits naming,
    return the empty string ("").

See https://www.w3.org/TR/accname-1.2/
2023-06-11 20:27:22 -04:00
Matthias Clasen
2349f13f45 Merge branch 'wip/alice/menu-button' into 'main'
menubutton: Horizontally expand child

Closes #5883

See merge request GNOME/gtk!6084
2023-06-11 15:14:02 +00:00
Matthias Clasen
084b4361b6 Merge branch 'master' into 'main'
Reset chars_changed_stamp in _gtk_text_btree_unref

Closes #5544

See merge request GNOME/gtk!6087
2023-06-11 11:12:52 +00:00
Daniel Boles
d0ebd42e3e Popover: If can't get widget rect, zero output ptr
cherry-pick of commit a6d40b610b

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/893#note_1766079
2023-06-11 11:46:36 +01:00
Bart Jacobs
a4330aae38 Reset chars_changed_stamp in _gtk_text_btree_unref
This causes an "Invalid text buffer iterator" warning to be produced if a TextIter is used after the TextBuffer is disposed.
2023-06-11 08:57:41 +00:00
Benjamin Otte
a02fc2d290 Merge branch 'wip/otte/for-main' into 'main'
mediafile: Load extension at startup with GTK_MEDIA

See merge request GNOME/gtk!6086
2023-06-11 02:19:13 +00:00
Benjamin Otte
9df935591c vulkan: Handle new nodes being added correctly
When nodes are added, nothing was warning us that we need to bump
N_RENDER_NODES.

Make sure that that's no longer necessary by refactoring the code to
remove the define.
2023-06-11 03:54:50 +02:00
Benjamin Otte
1f8045ddbe vulkan: Do intersection check for every node
This is more expensive, but it finds more cases, and in particular it
catches corner cases like empty nodes or fully clipped nodes that might
otherwise make the kernel throw signals in our direction.
2023-06-11 03:54:50 +02:00
Benjamin Otte
82ba8c848b vulkan: Handle empty rects in intersects_rect()
Apart from the none case, this was already handled, so we just check if
the rect is empty now.
2023-06-11 03:15:08 +02:00
Benjamin Otte
cf48f83709 mediafile: Load extension at startup with GTK_MEDIA
When the GTK_MEDIA env var is set, check at startup that it works, not
only when the first MediaFile is instantiated.

This has the fortunate side effect that it prints help output for
GTK_MEDIA=help at startup, too.
2023-06-11 03:14:55 +02:00
Matthias Clasen
9d79982677 Merge branch 'fontchooser-a11y' into 'main'
button: Improve accessible setup

See merge request GNOME/gtk!6081
2023-06-10 20:29:45 +00:00
Alice Mikhaylenko
27599d688e menubutton: Horizontally expand child
Set hexpand on the outer box so we don't propagate that expand.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5883
2023-06-11 00:02:15 +04:00
Alice Mikhaylenko
c0d8716366 menubutton: Normalize label layout
- Remove unnecessary halign=center and hexpand=0 dance
- Set hexpand=false on the outer box so we don't propagate hexpand
2023-06-11 00:01:19 +04:00
Benjamin Otte
3681144768 Merge branch 'wip/otte/for-main' into 'main'
testsuite: Add another test to the listitemmanager

See merge request GNOME/gtk!6083
2023-06-10 18:51:05 +00:00
Benjamin Otte
c2fef6f6fd listitemmanager: All sections without widgets are unmatched
We were failing to mark sections when both the start and end of the
untracked area fell on a section boundary.

Fixes testsuite failure in
https://gitlab.gnome.org/GNOME/gtk/-/jobs/2878290
2023-06-10 20:25:20 +02:00
Benjamin Otte
f06cfa2967 testsuite: Print update after changes, not before
This way, we don't do an empty print at the start and don't miss a print
at the end.
2023-06-10 20:25:20 +02:00
Benjamin Otte
2cbee7cf86 testsuite: Check that removing listitem trackers works properly
We remove them at the end, so just to be sure, check again.

(Guess if I added this check because removing failed.)
2023-06-10 20:25:20 +02:00
Benjamin Otte
f5cdd6fa32 testsuite: Add another test to the listitemmanager
Ensure the itemmanager doesn't lose any widgets by ensuring that the
tiles with widgets do account for all children of the list widget.
2023-06-10 20:25:20 +02:00
Matthias Clasen
c49c971f47 colorchooser: Improve accessibility
Set up missing accessible relations, labels and roles.
2023-06-10 13:59:32 -04:00
Matthias Clasen
4746e0bdc4 Merge branch 'matthiasc/for-main' into 'main'
inspector: Fix an oversight

See merge request GNOME/gtk!6082
2023-06-10 16:15:20 +00:00
Matthias Clasen
f20ef5a0fc fontchooser: Improve accessibility
Set up missing accessible relations, labels and roles.
2023-06-10 11:29:12 -04:00
Matthias Clasen
cf30a4f304 button: Improve accessible setup
With the current approach, we get duplicate labels
in the accessible name: _Cancel Cancel. Change things
around to always set the labelled-by accessible relation
if we have a label, and not the label accessible property.
2023-06-10 11:29:12 -04:00
Matthias Clasen
ca189cb5f5 inspector: Fix an oversight
There is no margin property, so don't set it.
2023-06-10 11:09:50 -04:00
Matthias Clasen
5e07710f5a Merge branch 'textview-ctrl-backspace' into 'main'
textview: Improve word navigation

Closes #737

See merge request GNOME/gtk!6080
2023-06-10 13:33:10 +00:00
Matthias Clasen
46bb5837e2 textview: Improve word navigation
Both Ctrl-Left and Ctrl-Backspace were failing
to step over a non-word at the beginning of
the line. Fix this to match GtkEntry behavior.

Fixes: #737
2023-06-10 09:05:34 -04:00
Matthias Clasen
1888f1e422 Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Change sidebar tab behavior

Closes #3543

See merge request GNOME/gtk!6079
2023-06-10 11:03:02 +00:00
Matthias Clasen
e606313ad1 gtk-demo: Change sidebar tab behavior
Change the sidebar to use the 'item' tab
behavior.

Fixes: #3543
2023-06-10 00:02:29 -04:00
Matthias Clasen
b69bfe3799 testsuite: More memleak fixes 2023-06-09 23:23:32 -04:00
Matthias Clasen
5d07c71dd2 builder: Cosmetics 2023-06-09 23:23:32 -04:00
Matthias Clasen
8155b08de8 Merge branch 'matthiasc/for-main' into 'main'
inspector: Cosmetics

See merge request GNOME/gtk!6078
2023-06-10 03:17:14 +00:00
Matthias Clasen
0790f24773 gtk: Plug a memory leak 2023-06-09 22:40:38 -04:00
Matthias Clasen
5f02631812 gsk: Fully free mask nodes
We were forgetting to chain up in finalize.  Oops
2023-06-09 22:40:38 -04:00
Matthias Clasen
c8133ecb50 gsk: Plug a memory leak 2023-06-09 22:40:38 -04:00
Matthias Clasen
b439398d09 testsuite: Plug some memory leaks 2023-06-09 22:40:38 -04:00
Matthias Clasen
fcb9048043 inspector: Show computed values in a11y tab
Show the name and description in the a11y tab.
These are not direct property values, but computed
according to ARIA rules.
2023-06-09 21:05:17 -04:00
Matthias Clasen
5816e2fe51 inspector: Cosmetics
Don't use technobabble like "fps overlay" in the UI.
2023-06-09 20:10:56 -04:00
Matthias Clasen
298fed6d94 Merge branch 'filechooser-sort-directories-first' into 'main'
FileChooser: Sort directories before files by default

See merge request GNOME/gtk!4284
2023-06-09 19:10:58 +00:00
Matthias Clasen
0557b29f5b Merge branch 'matthiasc/for-main' into 'main'
Avoid deprecation warnings from GTK_ALIGN_BASELINE_FILL

Closes #5875

See merge request GNOME/gtk!6077
2023-06-09 14:18:51 +00:00
Matthias Clasen
4c65bdf707 Fix some typos in gtk.supp
Actually ignore the media module leak.
2023-06-09 08:28:36 -04:00
Matthias Clasen
351d747909 print: Drop one use of private api
We added public api for the foreground color
for just this case, so use it.
2023-06-09 08:23:09 -04:00
Matthias Clasen
53af7208e6 gdk: Fix an oversight in GdkContentFormats
When clearing a builder, reset the counts to 0.

Otherwise valgrind spots uninitialized memory
use in our testsuite.
2023-06-09 08:17:34 -04:00
Matthias Clasen
c67f3c5038 Avoid deprecation warnings from GTK_ALIGN_BASELINE_FILL
We have to be careful to only use GDK_ALIGN_BASELINE_FILL when
permitted by GDK_VERSION_MAX_ALLOWED because gtkenums.h is a
public header.

Fixes: #5875
I don't think we can avoid conditional compilation here, because the old definition is going to cause deprecated declaration warnings unless you define an old GDK_VERSION_MIN_REQUIRED.
2023-06-09 08:17:34 -04:00
Daniel Boles
1bee1cd180 DrawingArea: Document Widget.get_color, !StyleCont
StyleContext is deprecated. To just get foreground colour we now have a
method on Widget, so use that in this example, instead of StyleContext.
2023-06-09 13:02:40 +01:00
Piotr Drąg
e77a17b227 Update POTFILES.in and POTFILES.skip 2023-06-09 13:22:17 +02:00
Benjamin Otte
d8b4249ee9 Merge branch 'wip/otte/for-main' into 'main'
testsuite: Set GIO_USE_VFS=local everywhere

See merge request GNOME/gtk!6076
2023-06-09 00:47:26 +00:00
Matthias Clasen
da47d9cc3d Merge branch 'print-subdir' into 'main'
Move printing code to its own directory

See merge request GNOME/gtk!6067
2023-06-09 00:32:45 +00:00
Benjamin Otte
53bebd2ed1 testsuite: Set GIO_USE_VFS=local everywhere
And do so centrally, not randomly in individual tests.

(Hopefully) fixes spurious test failures in CI.

Related: #5867
2023-06-09 02:29:24 +02:00
Benjamin Otte
ca9f0abdd8 Merge branch 'wip/otte/for-main' into 'main'
testsuite: Make memorytexture tests random

See merge request GNOME/gtk!6075
2023-06-08 23:54:07 +00:00
Matthias Clasen
8497f97dec print: Reimplement collate preview
Redo this with widgets instead of cairo drawing.
The new private widget is called GtkPageThumbnail.
2023-06-08 19:51:28 -04:00
Matthias Clasen
f22788a3a8 print: Drop some private api use 2023-06-08 19:51:28 -04:00
Matthias Clasen
a30e0fad1f Move resources too 2023-06-08 19:51:28 -04:00
Benjamin Otte
f033b6c2c6 testsuite: Don't always loop in memorytexture tests
When running the tests, only run the random (and potentially large) size
download test once instead of 10 times.

There's no real benefit in doing that, both because it's unlikely to
fail only in the 2nd or 9th run and because the sizes are picked
randomly.

This also speeds up the test massively as the download test was
dominating the runtime.
2023-06-09 01:12:32 +02:00
Benjamin Otte
45656ba426 testsuite: Make memorytexture tests random
Instead of picking a few numbers in advance and running them through the
test gauntlet every time, pick the random numbers at runtime.

This both increases the test coverage in that it ultimately tests more
combinations across many runs and it reduces the runtime of individual
runs because every tun only runs the download tests twice (with 1px and
the random size) instead of 5 times.

And that speedup benefits the CI, where the asan runs would cause this
test to timeout sometimes.
2023-06-09 01:12:32 +02:00
Benjamin Otte
83efe2b66c Merge branch 'wip/otte/for-vulkan' into 'main'
vulkan: Fancy gradients

See merge request GNOME/gtk!6073
2023-06-08 21:57:07 +00:00
dgsasha
84840f1f2e win32: Center newly created transient windows
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5407
2023-06-08 16:42:27 -04:00
Benjamin Otte
2883f4b7a2 vulkan: Antialiasing for linear gradients
Shaders are complicated now...
2023-06-08 22:16:18 +02:00
Benjamin Otte
0a0f0d9e7e testsuite: Add a test for repeating gradients
Make sure scaling the image also scales the color stop lookup.
2023-06-08 22:16:18 +02:00
Benjamin Otte
e3cc3f7841 vulkan: Make gradient shader use buffers
This allows putting any number of color stops into the buffer, so
fallbacks with too many stops are no longer necessary.
2023-06-08 21:53:06 +02:00
Benjamin Otte
d1135f9e3c vulkan: Add support for storage buffers
And add a default storage buffer that is used for per-frame temporary
data.

So far nothing is using this code, this is just infrastructure.
2023-06-08 21:53:06 +02:00
Benjamin Otte
2d89dfea29 vulkan: Switch GLSL version to 450
We need more modern features soon.
2023-06-08 21:53:06 +02:00
Benjamin Otte
89f20c2fb6 vulkan: Only update descriptor sets with contents
If one of the descriptor sets doesn't have any items, don't include it
in the sets passed to vkUpdateDescriptorSets().

This has no effect right now, because we either have both images and
samplers or neither, but it will become relevant once we also support
buffers.
2023-06-08 21:53:06 +02:00
Matthias Clasen
c019eb9eea print: Some more include cleanup 2023-06-07 15:35:12 -04:00
Matthias Clasen
216e415186 Update POTFILES.in
The moving the printing sources needs to
be reflected here.
2023-06-07 14:41:46 -04:00
Matthias Clasen
28fb91e85e Merge branch 'matthiasc/for-main' into 'main'
Fix a compiler warning

See merge request GNOME/gtk!6070
2023-06-07 15:11:29 +00:00
Matthias Clasen
7f3d4fa66e ci: Mark asan as must-pass
The asan test run seems to pass pretty
reliably now, so lets keep it that way.
2023-06-07 10:54:48 -04:00
Matthias Clasen
0505c8fac9 Fix a compiler warning
Compilers these days are very picky about
their NULLs.
2023-06-07 10:39:24 -04:00
Benjamin Otte
ccb7c9057a Merge branch 'wip/otte/for-main' into 'main'
gtk-demo: Remove random numbers

See merge request GNOME/gtk!6069
2023-06-07 14:21:32 +00:00
Benjamin Otte
ac6f18da12 gtk-demo: make the sidebar request proper width
- 25 chars sounds about right for the texts we use
- don't use min width so we allow shrinking the widget (large text or
  small mobile devices)
- ellipsize the text instead of clipping it.
2023-06-07 16:00:44 +02:00
Benjamin Otte
0d7069452b gtk-demo: Remove random numbers
There were 3 different random numbers set to determine the sidebar width
and all of them were wrong. Remove them.

Instead, propagate the natural width of the listitems.
2023-06-07 16:00:44 +02:00
Matthias Clasen
5aa62b6273 Fix a compiler warning
Compilers these days are very picky about
their NULLs.
2023-06-07 07:41:30 -04:00
Matthias Clasen
41d03c68f8 Make introspection build 2023-06-07 07:41:16 -04:00
Matthias Clasen
30ff352960 print: Maintain compatibility
gtkunixprint.h is a public header, that needs
to keep being installed in the same location.
2023-06-07 07:16:26 -04:00
Matthias Clasen
2adc017048 print: Start sorting apart includes
Use gtk/gtk.h in the print sources, so that it
becomes apparent where we are using private apis.
2023-06-07 00:18:14 -04:00
Matthias Clasen
d1aae4bffa print: Move all the remaining sources
Move the unix- and Windows-specific print
sources to the gtk/print subdirectory.
2023-06-07 00:06:33 -04:00
Matthias Clasen
434a747d42 print: Move frontend sources
Move the cross-platform printing sources
to the gtk/print subdirectory.
2023-06-06 23:21:19 -04:00
Matthias Clasen
50cf1c08dd print: Install headers in a subdir
This is a first step towards isolating the printing
code within gtk.
2023-06-06 23:16:09 -04:00
Matthias Clasen
caaeaedf1f Merge branch 'matthiasc/for-main' into 'main'
Drop gtkunixprint-autocleanups.h

See merge request GNOME/gtk!6066
2023-06-07 03:14:17 +00:00
Matthias Clasen
19362522e0 print: Rename private headers
Rename private print-related headers to follow our
naming conventions:
gtkprintutils.h -> gtkprintutilsprivate.h
gtkprinteroption.h -> gtkprinteroptionprivate.h
gtkprinteroptionset.h => gtkprinteroptionsetprivate.h
gtkprinteroptionwidget.h -> gtkprinteroptionwidgetprivate.h
2023-06-06 22:32:18 -04:00
Matthias Clasen
50c3ea064b Drop gtkunixprint-autocleanups.h
Move these definitions where they belong
and git rid of an auxiliary header we don't
need anymore.
2023-06-06 22:18:12 -04:00
Matthias Clasen
84e345adac Merge branch 'matthiasc/for-main' into 'main'
ci: More asan test runs

See merge request GNOME/gtk!6064
2023-06-06 11:17:32 +00:00
Marco Trevisan
d2638f0955 Merge branch 'wip/otte/fix-glx' into 'main'
glx: Ignore all errors

See merge request GNOME/gtk!6065
2023-06-06 10:56:55 +00:00
Benjamin Otte
e580dcf18d glx: Fake an X request to make GLX hack work
Sometimes, GLX can decide to use the previous request serial when faking
XErrors via __glXSendError() (look through the Mesa sources to enjoy).
This can cause the error trap we just installed to not feel responsible
for the error. And that makes GDK decide to immediately abort the
application.
That is not what we or GLX want.

So we use a no-op X Request to bump the request number so that when GLX
does its shenanigans, it uses a serial that our error trap will catch.

Fixes a crash in mutter's CI which apparently manages to drive GLX
without an X server.
2023-06-06 05:20:34 +02:00
Benjamin Otte
14e44f36bf glx: Move error trap even further out
This way we only create one error trap for all attempts to create a
context instead of up to 3.
2023-06-06 05:20:34 +02:00
Benjamin Otte
1e60ad1430 glx: Ignore all errors
In error cases, glXCreateContextAttribsARB() will always return NULL so
it is enough to run the loop until the first non-NULL context is
returned.

And at that point, we can just look at the return value and ignore all
errors.
2023-06-06 05:20:34 +02:00
Matthias Clasen
2c67d9f7cf ci: Build less for asan
The asan build is all about running the tests
with asan, so lets not waste time building
demos and examples.
2023-06-05 22:05:16 -04:00
Matthias Clasen
4bcaeab4dc ci: More asan test runs 2023-06-05 21:47:36 -04:00
Matthias Clasen
97a4cc301a Merge branch 'matthiasc/for-main' into 'main'
Revert "ci: More verbose output from asan"

See merge request GNOME/gtk!6063
2023-06-06 01:37:47 +00:00
Matthias Clasen
baaa748248 ci: Disable headless tests under asan
Our use of LD_PRELOAD for these tests does not
sit right with asan, so just skip them in this
case.
2023-06-05 21:15:31 -04:00
Matthias Clasen
cf69fecc87 ci: Tweak asan options
Allow the allocator to return NULL, so our
g_try_malloc tests don't fail.
2023-06-05 21:09:51 -04:00
Matthias Clasen
29ad2c1247 ci: Turn off LeakSanitizer
When it is enabled, almost every report from asan is
"LeakSanitizer has encountered a fatal error."
So try without.
2023-06-05 20:56:53 -04:00
Matthias Clasen
1450789052 ci: Reenable asan builds
This is an attempts to catch sporadic ci failures.
2023-06-05 20:55:00 -04:00
Matthias Clasen
51f4ad55cf wayland: Free seat globals in dispose
This matches what we do for the display globals.
2023-06-05 20:50:09 -04:00
Matthias Clasen
94d65f6ef1 gdk: Dispose seats when a display is closed
We dispose the display itself. It does not make
sense to hold onto seat resources beyond that point.
2023-06-05 20:50:09 -04:00
Matthias Clasen
c3f446a95a wayland: Don't leak all globals 2023-06-05 20:50:09 -04:00
Matthias Clasen
ad8e5c3a39 wayland: Drop an unused field
Nobody is using the wl_input_device field.
2023-06-05 20:50:09 -04:00
Matthias Clasen
6b26a4f9be Revert "ci: More verbose output from asan"
This reverts commit 4f65c121b7.
2023-06-05 14:52:15 -04:00
Matthias Clasen
40f215ea46 Post-release version bump 2023-06-05 07:39:28 -04:00
Matthias Clasen
55dd5f4780 4.11.3 2023-06-05 07:26:41 -04:00
Matthias Clasen
1e878d3928 Merge branch 'search-entry-allocation' into 'main'
text: Make the placeholder non-intrusive

See merge request GNOME/gtk!6060
2023-06-05 10:17:46 +00:00
Benjamin Otte
66c57a8f4e Merge branch 'wip/otte/for-main' into 'main'
testsuite: Adapt color-matrix testcase

See merge request GNOME/gtk!6018
2023-06-05 04:07:27 +00:00
Benjamin Otte
ee22f8f52f stringsorter: Handle NULL strings
NULL is a valid string GValue, so we need to handle it.
The utf8 normalizing and collating functions do not, so we better catch
it early.
2023-06-05 05:33:07 +02:00
Benjamin Otte
9070c457d6 testsuite: Make clipped-repeat test work universally
Cover the rounded corners so that they cause no visible difference in
the end result.
2023-06-05 05:33:07 +02:00
Benjamin Otte
bba324ce30 rendernode: Scale repeat offscreens properly
Respect the matrix in use at time of encountering a repeat node so that
the offscreen uses roughly the same device pixel density as the target.

Fixes the handling of the clipped-repeat test.
2023-06-05 05:33:07 +02:00
Benjamin Otte
c322ab34c7 rendernode: Use cairo_set_device_offset()
Simplifies the code.
2023-06-05 05:33:07 +02:00
Benjamin Otte
8c5e046574 testsuite: Adapt color-matrix testcase
Make it use an alpha value that is well defined, ie 0.4 instead of 0.5.

0.4 * 255 = 102
0.5 * 255 = 127.5

This avoids rounding issues where some math may cause the resulting
alpha value to be 127, and some other math ends up with 128.
2023-06-05 05:33:07 +02:00
Benjamin Otte
8860a2a688 testsuite: fix memleak
Also use the actual diff command we found instead of searching for it
again.
2023-06-05 05:33:07 +02:00
Matthias Clasen
5ca40c3660 Merge branch 'matthiasc/for-main' into 'main'
gl: Free all tracked buffers

See merge request GNOME/gtk!6061
2023-06-05 03:03:01 +00:00
Matthias Clasen
a9f9fb2022 gl: Free all tracked buffers
This was overlooked when the number of tracked
buffers was bumped from 2 to 4 in 46e3454eb7.
2023-06-04 22:17:56 -04:00
Matthias Clasen
a8a49d270b searchentry: Improve size allocation
We want to always reserve space for the clear icon,
but let the text widget use that space when the icon
isn't shown. A plain box layout can't do that, so
do our own size allocation.
2023-06-04 21:50:35 -04:00
Matthias Clasen
419c431f29 text: Make the placeholder non-intrusive
We never want to let the placeholder cause
the widget to grow, so set its max-width-chars
to a small value to make it ellipsize.
2023-06-04 21:47:11 -04:00
Benjamin Otte
fd5d15004e Merge branch 'wip/otte/vulkan' into 'main'
Vulkan hacking going overboard

See merge request GNOME/gtk!5992
2023-06-04 18:21:21 +00:00
Benjamin Otte
5409f0b350 vulkan: Create multiple render objects
Sometimes the GPU is still busy when the next frame starts (like when
no-vsync benchmarking), so we need to keep all those resources alone and
create new ones.
That's what the render object is for, so we just create another one.

However, when we create too many, we'll starve the CPU. So we'll limit
it. Currently, that limit is at 4, but I've never reached it (I've also
not starved the GPU yet), so that number may want to be set lower/higher
in the future.

Note that this is different from the number of outstanding buffers, as
those are not busy on the GPU but on the compositor, and as such a
buffer may have not finished rendering but have been returend from the
compositor (very busy GPU) or have finished rendering but not been
returned from the compositor (very idle GPU).
2023-06-04 19:42:01 +02:00
Benjamin Otte
f1b1aacc34 vulkan: Stop differentiating rounded from cicular corners
Our shaders can handle both, so don'ttry to tell them apart anymore.

Removes a lot of unnecessary fallbacks.
2023-06-04 19:42:01 +02:00
Benjamin Otte
e7201968d6 vulkan: Cleanup: Initialize constants at the top 2023-06-04 19:42:01 +02:00
Benjamin Otte
67f2ad817e vulkan: Add support for texture-scale nodes 2023-06-04 19:42:01 +02:00
Benjamin Otte
f420c143e0 vulkan: Split textures and samplers
The idea here is that we can do more complex combinations and use that
to support texture-scale nodes or use fancy texture formats (suc as
YUV).

I'm not sure this is actually necessary, but for now it gives more
flexibility.
2023-06-04 19:42:01 +02:00
Benjamin Otte
1cf6dfab2f vulkan: Add a hackish way to handle empty children
For blend and crossfade nodes, one of the children may exist and
influence the rendering, while the other does not.

Previously, we would skip the node, which would cause the required
rendering to not happen. We now send a valid texture id for the
invalid offscreen, thereby actually rendering the required parts.

Fixes the blend-invisible-child compare test

Current state for compare tests:
Ok:                 397
Expected Fail:      0
Fail:               26
Unexpected Pass:    0
Skipped:            2
Timeout:            0
2023-06-04 19:42:01 +02:00
Benjamin Otte
330a8b1cdb vulkan: Convert blend shader
Same work as crossfade shader pretty much.
2023-06-04 19:42:01 +02:00
Benjamin Otte
8d19db6732 vulkan: Update the cross-fade shader
This also fixes it rendering weird things when the bounds of start and
end node don't match.
2023-06-04 19:42:01 +02:00
Benjamin Otte
0f1b039306 vulkan: Implement bindless texture rendering
Instead of having a descriptor set per operation, we just have one
descriptor set and bind all our images into it.

Then the shaders get to use an index into the large texture array
instead.

Getting this to work - because it's a Vulkan extension that needs to be
manually enabled, even though it's officially part of Vulkan 1.2 - is
insane.
2023-06-04 19:42:01 +02:00
Benjamin Otte
b791aa0301 vulkan: Clip using scissors
If we have a rectangular clip without transforms, we can use
scissoring. This works particularly well because it allows intersecting
rounded rectangles with regular rectangles in all cases:
Use the scissor rect for the rectangle and the normal clipping code for
the rounded rectangle.
2023-06-04 19:42:01 +02:00
Benjamin Otte
7fd94c1828 vulkan: Make scissoring an explicit operation
The idea is to use it for clip nodes when they are integer-aligned.

To do that, we need to track the scissor rect in the parse state, so we
do that, too.

Also move the viewport offset out of the projection matrix, as it is
part of the transform between clip and scissor, so it needs to live in
the offset.
2023-06-04 19:42:01 +02:00
Benjamin Otte
dd4c1167b2 vulkan: Remove unneeded struct member
We can use gsk_vulkan_pipeline_get_vertex_stride() whenever we need that
value.
2023-06-04 19:42:01 +02:00
Benjamin Otte
d411912396 vulkan: Bind vertex buffers only once
We can index into the same buffer from every pipeline due to the aligned
buffer writes (see previous commit).

So we do that.
2023-06-04 19:42:01 +02:00
Benjamin Otte
0e93ad8671 vulkan: Align vertex data
We align the data to a multiple of vertex stride, that way we use more
memory, but we could compute an offset into the vertex buffer without
changing the offset.
2023-06-04 19:42:01 +02:00
Benjamin Otte
d98991a0ad vulkan: Set offsets when counting
We can set the vertex offset while counting the data, this gets rid of
the need of passing all the counting machinery into the actual data
collection code.
2023-06-04 19:42:01 +02:00
Benjamin Otte
1f7dcc1286 vulkan: Simplify switch statement
All branches do the same thing now, so pull them all into the same
branch.
2023-06-04 19:42:01 +02:00
Benjamin Otte
328cdf7b2a vulkan: Simplify collect_vertex_data()
We don't have any size arguments to it, so don't use them.
2023-06-04 19:42:01 +02:00
Benjamin Otte
79a227bc64 vulkan: Remove a function from pipeline impls
That function is available already in the structs we feed to Vulkan.

Store it from there and reuse it.
2023-06-04 19:42:01 +02:00
Benjamin Otte
0fee26252c vulkan: Don't draw fully clipped nodes
... if they are container nodes. Other nodes will get culled by the
vertex shader.
2023-06-04 19:42:01 +02:00
Benjamin Otte
d48b6b9ad5 vulkan: Add optimization for transforms
When attempting a complex transform, check if the clip can be ignored
and do that if possible.

That way we don't cause fallbacks when transforming the clip is too
complex.
2023-06-04 19:42:01 +02:00
Benjamin Otte
d4618ea8a6 vulkan: Don't crash with overly large nodes
... when these nodes are used as children of a complex transform nodes
and we lose the clip.
2023-06-04 19:42:01 +02:00
Benjamin Otte
a73530f952 vulkan: Update texture shader to do AA 2023-06-04 19:42:01 +02:00
Benjamin Otte
3e620a8fe5 vulkan: Split generic code off
No need to duplicate code in shaders when it can be shared.
2023-06-04 19:42:01 +02:00
Benjamin Otte
6d8c8199d9 vulkan: Use rounded rect APIs to improve clips
There are a bunch of intersection APIs available these days.
Let's use them.
2023-06-04 19:42:01 +02:00
Benjamin Otte
968ceb71d5 gsk: Add (private) gsk_rounded_rect_intersection()
The idea is that for a rectangle intersection, each corner of the
result is either entirely part of one original rectangle or it is
an intersection point.

By detecting those 2 cases and treating them differently, we can
simplify the code to compare rounded rectangles.
2023-06-04 19:42:01 +02:00
Benjamin Otte
7f5504bea4 vulkan: Set the initial clip rect
Instead of rendering unclipped, set the clip region to the extents of
the current clip region.
2023-06-04 19:42:01 +02:00
Benjamin Otte
4b2b239550 vulkan: Only draw one rect
Instead of emitting the render commands once per rectangle of the clip
region, just emit them once with the region's extents.

This is generally faster because it emits fewer commands to the GPU,
even though it may touch significantly more pixels.

For a proper method, we'd need to record the commands per clip rectangle
instead of emitting all of them all the time.
2023-06-04 19:42:01 +02:00
Benjamin Otte
23c10d434c vulkan: Use CLAMP_TO_EDGE in sampler
We don't want to clamp to the border, that causes fade-outs at the
edges.
2023-06-04 19:42:01 +02:00
Benjamin Otte
87c9503293 vulkan: Rewrite AA shaders to respect scale
The border and color shaders - the ones that do AA - now multiply their
coordinates by the scale factor, which gives them better rounding
capabilities.

This in particular improves the case where they are used in fractional
scaling situations, where the scale is defined at the root element.
2023-06-04 19:42:01 +02:00
Benjamin Otte
76634cb68b vulkan: Don't allocate no descriptor sets
If we don't need them, exit early.

Shuts up the validation layers when running simple denos without
textures.
2023-06-04 19:42:01 +02:00
Benjamin Otte
52eefdb7d9 vulkan: Only use a single pipeline layout
There's no need to use 3 different ones when they are compatible.
2023-06-04 19:42:01 +02:00
Benjamin Otte
ea9f0a3372 vulkan: Don't cull vertices
We end up with the backside, when we scale(-1) and we still want it to
be visible, just flipped.
2023-06-04 19:42:01 +02:00
Benjamin Otte
8561ff37c4 vulkan: Use scale factor for offscreens and fallbacks
Previously, we just used the defaultscale factor, but now that we're
having it available in push constants, we can read it back for creating
offscreens and rendering fallbacks.

So do that.
2023-06-04 19:42:01 +02:00
Benjamin Otte
a09580b9ef vulkan: Split scale from matrix
Now, the scale is no longer part of the matrix. This allows shaders to
transform points by the scale which increases accuracy for antialiasing.
2023-06-04 19:42:01 +02:00
Benjamin Otte
0511227379 vulkan: Keep the modelview as a GskTransform
This allows doing more optimized math on it.
2023-06-04 19:42:01 +02:00
Benjamin Otte
4183ce0b52 vulkan: Split modelview and projection
This is adding extra work, but the benefits should become visible
in future commits.
2023-06-04 19:42:01 +02:00
Benjamin Otte
57222cc64c vulkan: Add scale to push constants
This way, it can be pushed to the shaders
2023-06-04 19:42:01 +02:00
Benjamin Otte
b3c1284382 vulkan: Move scale into the state object 2023-06-04 19:42:01 +02:00
Benjamin Otte
b02e054592 vulkan: Add offset to the Vulkan clip checks
This was forgotten when tracking the offset was added, so code was
actually selecting the wrong shaders.
2023-06-04 19:42:01 +02:00
Benjamin Otte
870ee06d1f vulkan: Move offset into the state object 2023-06-04 19:42:01 +02:00
Benjamin Otte
8d586be693 vulkan: Add a new GskVulkanParseState
It's a 1:1 replacement for GskVulkanPushConstants, just without the
indirection through a different file.

GskVulkanPushConstants as a struct is gone now.
The file still exists to handle the push_constants operation.
2023-06-04 19:42:01 +02:00
Benjamin Otte
94ab11b999 vulkan: Don't store push constants in RenderOp
Instead, only store the values that are needed.
2023-06-04 19:42:01 +02:00
Benjamin Otte
9b1dcd3872 vulkan: Split out gsk_vulkan_render_pass_append_push_constants()
Simplifies the code and makes future refactoring easier
2023-06-04 19:42:01 +02:00
Benjamin Otte
c37171f4d6 vulkan: Pass values to push directly
Don't require a GskVulkanPushConstants there.
2023-06-04 19:42:01 +02:00
Benjamin Otte
c479f93372 vulkan: Add a static assert
We don't want to make the push constants larger than what the spec
guarantees. And that is 128 bytes, see value for
maxPushConstantsSize in table 55 of
https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#limits-minmax
2023-06-04 19:42:01 +02:00
Benjamin Otte
186e056c56 vulkan: Handle clip properly for offscreens
This was broken in the last commit.
2023-06-04 19:42:01 +02:00
Benjamin Otte
d8b9c3ae96 vulkan: Track offset in the renderpass
This avoids emitting lots of push constant updates as most of the
transforms we have are simple translations to adjust drawing for the
next widget.
2023-06-04 19:42:01 +02:00
Benjamin Otte
5de6f12e88 vulkan: Pass scale to offscreens
Create offscreens with enough pixels for the given scale and ensure
the scale is passed on.

This improves text rendering on offscreens quite a bit.
2023-06-04 19:42:01 +02:00
Benjamin Otte
5422c12577 vulkan: Clean up scale handling
1. Use a graphene_vec2_t
2. Ensure it's always positive
3. Don't break with fallback

The scale value is nothing more than an indication of how many pixels to
assume per unit of a node.
2023-06-04 19:42:01 +02:00
Benjamin Otte
bb145b9bc1 vulkan: Fix typo 2023-06-04 19:42:01 +02:00
Benjamin Otte
a55fda0b49 vulkan: Don't store unused matrices
We can compute it when needed, so do that.
2023-06-04 19:42:01 +02:00
Benjamin Otte
5b93a32f90 vulkan: Remove unneeded argument
The initial matrix can be computed as needed, so we don't need to
precompute it.
2023-06-04 19:42:01 +02:00
Benjamin Otte
495ee1be3d vulkan: Don't explode without vertex data
If no buffer has any vertex data (read: if nothing gets drawn), don't
try to allocate a 0 bytes buffer.
2023-06-04 19:42:01 +02:00
Benjamin Otte
7f1bd1f047 vulkan: Handle empty child bounds in repeat node
Also add test to the testsuite for it.
2023-06-04 19:42:01 +02:00
Benjamin Otte
da147dca92 vulkan: Fix repeat nodes 2023-06-04 19:42:01 +02:00
Benjamin Otte
8ba5ff98aa vulkan: Don't transform the viewport rect
We don't want to render the offscreen trnsformed, we want to render it
as-is.

We lose the correct scale factor, but that requires some separate work,
so for now it gets a bit blurry on hidpi.
2023-06-04 19:42:01 +02:00
Benjamin Otte
34f4493c36 vulkan: Make quarks global variables
I don't want to ensure there's a RenderPass available everywhere and
recreate the quarks in each, I just want to use them.
2023-06-04 19:42:01 +02:00
Benjamin Otte
314923d4b5 vulkan: Split out a function
We can now create offscreens explicitly.
2023-06-04 19:42:00 +02:00
Benjamin Otte
d2f45dae96 vulkan: offscreens are used as color attachments
... so set the corresponding flag.

Also name the function "new_for_offscreen()" because thats what this
function is about, "texture" is ambiguous.
2023-06-04 19:42:00 +02:00
Benjamin Otte
0e31cf9542 vulkan: compute new modelview directly
no need to go through a GskTransform
2023-06-04 19:42:00 +02:00
Benjamin Otte
af901a10e3 vulkan: Make border shader handle fractional widths
We were rounding widths properly, make sure we always round up.
2023-06-04 19:42:00 +02:00
Benjamin Otte
3d1a607367 vulkan: Don't round corners when growing rounded rect
If the corner is set to 0, keep it there.
2023-06-04 19:42:00 +02:00
Benjamin Otte
1be21a33d9 vulkan: Rewrite rounded rectangle to use SDF distance
We can use this to properly compute distance in scaled situations.
We also now compute coverage with (imperfect) antialiasing.
2023-06-04 19:42:00 +02:00
Benjamin Otte
64bcdb713c vulkan: Start rework on shaders to allow antialiased drawing
This introduces the rect object and adds a rect_distance() and
rect_coverage() function.

_distance() returns the signed distance tp the rectangle.
_coverage() returns the coverage of a pixel centered at that position.

Note that the pixel size is computed using dFdx/dFdy.
2023-06-04 19:42:00 +02:00
Benjamin Otte
4a868736f9 vulkan: Render whole texture
When the node bounds were a non-integer size, the texture would get
ceil()ed pixels, but various viewport or scissor computations might
floor() instead, leaving the right/bottom row of pixels untouched.
Make sure those functions ceil(), too.
2023-06-04 19:42:00 +02:00
Benjamin Otte
cfeaa0ac72 renderer: return_if_fail() if the given texture size is 0
All renderers SEGV currently when that happens.
2023-06-04 19:42:00 +02:00
Matthias Clasen
b44ef07e22 Merge branch 'matthiasc/for-main' into 'main'
wayland: Don't leak cursor structs

See merge request GNOME/gtk!6058
2023-06-04 17:35:04 +00:00
Ekaterine Papava
7f119b5ad2 Update Georgian translation 2023-06-04 14:45:45 +00:00
Matthias Clasen
d427933c61 testsuite: Improve test coverage 2023-06-04 09:04:25 -04:00
Matthias Clasen
85bafbdff0 wayland: Don't leak cursor structs
Found by gcc's -fanalyzer.
2023-06-04 07:58:24 -04:00
Matthias Clasen
7ae7356284 NEWS: Cosmetics 2023-06-04 07:58:24 -04:00
Matthias Clasen
444d5fa500 Merge branch 'drop-x11-dnd-keynav' into 'main'
x11: Stop using passive grabs

See merge request GNOME/gtk!6055
2023-06-03 19:38:24 +00:00
Matthias Clasen
c380d17621 Revert "gdk/x11: Also grab keyboard during XDnD grabs"
This reverts commit ae94417f80.
2023-06-03 12:25:25 -04:00
Matthias Clasen
686d18dfc2 x11: Stop using passive grabs
The keynav that this implements is half-broken under
xwayland anyway, and it confused and complicates things
on the compositor side.
2023-06-03 12:25:25 -04:00
Benjamin Otte
0a1702ae99 Merge branch 'wip/otte/fix-glx' into 'main'
glx: Trap errors inside loop

Closes #5857

See merge request GNOME/gtk!6056
2023-06-03 16:19:09 +00:00
Benjamin Otte
0016fea36b glx: Trap errors inside loop
Instead of trapping errors for the whole loop trying to create GL
contexts, trap them once per GL context.

Apparently GLX does throw an error when a too high version is requested
and doesn't just return NULL and then that error lingers when we try
lower versions.

Fixes #5857
2023-06-03 18:03:56 +02:00
Matthias Clasen
7ef46293aa Merge branch 'wip/antoniof/boxlayout-baseline-optional' into 'main'
boxlayout: Don't always reserve height for baseline alignment

Closes #5863

See merge request GNOME/gtk!6053
2023-06-03 11:01:40 +00:00
António Fernandes
6b59c138b2 boxlayout: Don't always reserve height for baseline alignment
Otherwise an horizontal box may have a larger minumum height than
any of its children even though non of them is baseline-aligned.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5863
2023-06-02 20:18:56 +01:00
dgsasha
b7e3a231b4 win32: Focus modal windows when clicking on unfocused parent 2023-06-02 12:33:03 -04:00
Matthias Clasen
c8c895d160 Merge branch 'trap-bad-rr-errors' into 'main'
x11: Trap XRandr errors when getting outputs during init and update

See merge request GNOME/gtk!6046
2023-06-02 11:31:45 +00:00
Luca Bacci
acbd7f212e Merge branch 'for-main' into 'main'
GdkWin32 Cleanup

See merge request GNOME/gtk!5714
2023-06-02 09:34:48 +00:00
Marco Trevisan (Treviño)
f2a2889153 x11: Trap XRandr errors when getting outputs during init and update
We may try to update the XRR outputs and Crtcs when they're changing in
the server, and so we may get BadRROutput that we're currently not
handling properly.

As per this, use traps and check whether we got errors, and if we did
let's ignore the current output.

It's not required to call init_randr13() again because if we got errors
it's very likely that there's a change coming that will be notified at
next iteration during which we'll repeat the init actions.
2023-06-02 00:30:14 +02:00
Matthias Clasen
a4ae215309 Merge branch 'sumibi-yakitori/fix-glcontext-macos' into 'main'
macOS: Fix problems with OpenGL context creation on macOS

Closes #5811

See merge request GNOME/gtk!6044
2023-06-01 20:58:22 +00:00
Daniel Boles
fa16ba12cf Window: Copy caveats from :*visible to the setters 2023-06-01 20:31:22 +01:00
Daniel Boles
ec2421b187 Window: Fix wrong case in property attribute which
rendered the literal text `org.gtk.MEthod.set_property	focus-visible`.
2023-06-01 20:26:57 +01:00
sumibi-yakitori
1fce2b1e06 Fix an issue where min_version was not being used as the minimum version required by GTK 2023-06-01 23:05:44 +09:00
Matthias Clasen
38bf843de8 Merge branch 'wip/alice/muxer-fix' into 'main'
actionmuxer: Correctly notify actions after reparenting

Closes #5861

See merge request GNOME/gtk!6043
2023-06-01 10:54:33 +00:00
sumibi-yakitori
7b8a5235d4 Fix a bug in error checking conditions. This avoids unintentional Legacy of the created OpenGL context 2023-06-01 16:46:24 +09:00
sumibi-yakitori
3c9b3ead6f The GL version reported by epoxy seems to depend on the current GL context, so the GL context to create should be the one determined by gdk_gl_context_get_matching_version 2023-06-01 16:43:57 +09:00
Alice Mikhaylenko
1549ec5f9b actionmuxer: Correctly notify actions after reparenting
When registering an observer, we send a notification and for that we need
to query the action's state and param type. When setting up a muxer parent,
same thing happens, except the action is queried on the parent instead.

This means that the muxer will notify observers about the parent's actions,
but not about its own.

Add a test to verify it works.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5861
2023-06-01 06:39:44 +04:00
Matthias Clasen
4339e8e464 Merge branch 'matthiasc/for-main' into 'main'
gsk: Support straight alpha textures

See merge request GNOME/gtk!6041
2023-05-31 19:14:07 +00:00
Matthias Clasen
39f4d5ccf7 gltexturebuilder: Update the docs
We do handle unpremultiplied alpha correctly (albeit
non-optimally) now.
2023-05-31 14:39:07 -04:00
Matthias Clasen
957fa87fce gsk: Support straight alpha textures
This is not the optimal way of doing it: we're
reuploading the texture with client-side conversion.
But it fits nicely into our current handling of mipmaps.

We can do better once we use shaders for colorspace
conversions.
2023-05-31 14:37:33 -04:00
Matthias Clasen
e8bdd46d8d Merge branch 'a11y-crash' into 'main'
label: Fix crashes when executing a11y actions

See merge request GNOME/gtk!6034
2023-05-31 12:27:49 +00:00
Erik Schilling
d03b27b441 label: Fix crashes when executing a11y actions 2023-05-31 12:27:48 +00:00
Matthias Clasen
f4cbe26af3 Merge branch 'more-texture-tests' into 'main'
testsuite: Add more download tests

See merge request GNOME/gtk!6038
2023-05-31 12:01:31 +00:00
Luca Bacci
24af4b48cc GdkWin32: Remove unused functions 2023-05-31 12:15:57 +02:00
Luca Bacci
1c8caf745f GdkWin32: Remove declarations of unused types from gdkprivate-win32.h 2023-05-31 12:15:57 +02:00
Luca Bacci
395d80f131 GdkWin32: Remove declarations of unexisting functions from gdkprivate-win32.h 2023-05-31 12:15:57 +02:00
Luca Bacci
74229572e7 GdkWin32: Remove defines for old MinGW headers 2023-05-31 12:15:57 +02:00
Luca Bacci
cbb3d3f177 GdkWin32: Remove _gdk_display_hdc global variable 2023-05-31 12:15:57 +02:00
Luca Bacci
8861d0eb53 GdkWin32: Turn a few functions to static
When used only in the source file they're defined in.
Also remove the corresponding declarations from
gdkrivate-win32.h.
2023-05-31 12:15:57 +02:00
Luca Bacci
a23bc894e9 GdkWin32: Remove unused debug functions
* _gdk_win32_print_paletteentries
 * _gdk_win32_print_system_palette
 * _gdk_win32_print_hpalette
 * _gdk_win32_drag_protocol_to_string
 * _gdk_win32_data_to_string
 * _gdk_win32_gdkrectangle_to_string
 * _gdk_win32_cairo_region_to_string
 * _gdk_win32_surface_description
2023-05-31 12:15:57 +02:00
Luca Bacci
156e25b6aa Update manifest XML for the GTK DLL 2023-05-31 12:15:49 +02:00
Matthias Clasen
96f6787a3e testsuite: Add more download tests
Add some odd-sized texture sizes to the
download tests, to trigger alignment issues
in the various upload code paths. And add
a size that is bigger than the max-texture-size
we force in one of our test setups.

To compensate, reduce the number of
runs per size from 20 to 10.
2023-05-30 23:01:20 -04:00
Matthias Clasen
cc665f29ea testsuite: Plug a memory leak 2023-05-30 22:37:03 -04:00
Matthias Clasen
8d2047c824 testsuite: Use proper alignment when uploading to GL 2023-05-30 22:36:41 -04:00
Matthias Clasen
a79da8b655 Improve test coverage for GdkGLTexture 2023-05-30 22:36:10 -04:00
Matthias Clasen
f29c7e76f5 gltexture: Use proper alignment for downloads 2023-05-30 22:35:45 -04:00
Matthias Clasen
29867e7ae1 NEWS: Updates 2023-05-30 20:21:13 -04:00
Matthias Clasen
876b439d4a Merge branch 'matthiasc/conversion-tests' into 'main'
Texture format work

See merge request GNOME/gtk!6035
2023-05-31 00:13:51 +00:00
Matthias Clasen
4f6d7c69a1 gltexturebuilder: Document format expectations
Provide some details about storage and alpha handling.
2023-05-30 19:46:13 -04:00
Matthias Clasen
2bf2635635 testsuite: Exclude some formats on GLES
GLES < 3.2 has some problems with 16-bit formats,
so exclude these from our download tests.
2023-05-30 19:46:13 -04:00
Matthias Clasen
67ed09f5ae testsuite: Add tests for native GL textures
Create GL textures in gray and GA formats
and check that we can download from them
successfully.
2023-05-30 19:46:13 -04:00
Matthias Clasen
1c72f46eed gltexture: Rewrite downloading code
For non-gles, make it handle unpremultiplied formats,
and everything else, by downloading the texture in its
preferred format and, in most cases, doing a
gdk_memory_convert afterwards.

For gles, keep using glReadPixels, but handle cases
where the gl read format doesn't match the texture
format by doing the necessary swizzling before calling
gdk_memory_convert.
2023-05-30 15:57:18 -04:00
Matthias Clasen
f5e7a1d4cc Merge branch 'fix-selection-input-stream-leak' into 'main'
gtkselectioninputstream-x11: Do not leak the stream and double-free the EOF bytes marker

Closes #4892

See merge request GNOME/gtk!6037
2023-05-30 19:10:49 +00:00
Matthias Clasen
0f61c52593 gdk: Simplify gdk_memory_format_gl_format
Make the callers of this function check for
straight alpha themselves, and only do the
version compatibility check here. This makes
the function usable in contexts where straight
alpha is acceptable.
2023-05-30 14:49:45 -04:00
Matthias Clasen
a4bae6a62d gsk: Use matching memory format
memory_format_gl_format returns the new memory
format if it made a change, we should not drop
that on the floor.
2023-05-30 14:41:01 -04:00
Sophie Herold
d141ac5adf gdk: Add gray/alpha memory formats to testsuite 2023-05-30 14:41:01 -04:00
Sophie Herold
894a4bda85 gdk: Support gray/alpha in PNG loader 2023-05-30 14:41:01 -04:00
Sophie Herold
2b88505ca4 gdk: Support gray/alpha in TIFF loader
Use PHOTOMETRIC_MINISBLACK for grayscale image
2023-05-30 14:41:01 -04:00
Sophie Herold
ef8c835762 gsk: Support swizzle for gray and alpha formats
Swizzling is needed to display one channel memory formats
as gray etc.
2023-05-30 14:41:01 -04:00
Sophie Herold
50115d70c6 gdk: Add grayscale and alpha memory formats 2023-05-30 14:41:01 -04:00
Luca Bacci
1a058a41c9 Do not keep HINSTANCE variables around
Use &__ImageBase for the GTK DLL and GetModuleHandle (NULL)
for the application module. Then remove DllMain as it's not
necessary anymore.

References:

 [1] Accessing the current module's HINSTANCE from a static library:
     https://devblogs.microsoft.com/oldnewthing/20041025-00/?p=37483
2023-05-30 19:31:54 +02:00
Marco Trevisan (Treviño)
be4f6ff3da gdkselectioninputstream-x11: Explicitly handle stream ownership in signal
The display xevent signal connection takes the ownership of the stream
until we get a valid event, so it should manage the stream lifetime.

So make this clearer, by automatically removing the stream reference
when we disconnect from the xevent signal handler.
2023-05-30 17:59:19 +02:00
Marco Trevisan (Treviño)
4fcf899852 gdkselectioninputstream-x11: Make it clearer how we manage the stream ownership
It gets unreffed during gdk_x11_selection_input_stream_complete, so use
APIs that make this clearer.
2023-05-30 17:54:29 +02:00
Marco Trevisan (Treviño)
371e860184 gtkselectioninputstream-x11: Do not add an extra reference to the returned stream
We create a new stream during gdk_x11_selection_input_stream_new_async()
then such stream is referenced when passed to the task via
g_task_return_pointer(), so there's no need to reference it again before
returning it, or we'd end up leaking.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4892
2023-05-30 17:50:56 +02:00
Marco Trevisan (Treviño)
bce1e0bfdd gtkselectioninputstream-x11: Do not add unreffed bytes to the chunks queue
This should never happen, but we may exit the loop because of count value
with an unreffed bytes pointer being added back to the chunks queue.
2023-05-30 17:43:57 +02:00
Marco Trevisan (Treviño)
468d2cb7f2 gtkselectioninputstream-x11: Do not add EOF marker twice to the chunks queue
We were adding the same EOF marker two times back to the chunks queue,
one implicitly, and the other time could happen when exiting the loop.
2023-05-30 17:42:59 +02:00
Jordi Mas
b520a5ceda Update Catalan translation 2023-05-30 06:41:10 +02:00
Matthias Clasen
e6bc82cff5 Merge branch 'fix_gtkstack_crash' into 'main'
GtkStack: Fix a potential crash in gtk_stack_get_first_accessible_child

See merge request GNOME/gtk!6031
2023-05-29 23:38:05 +00:00
Matthias Clasen
d021aa7bd2 Merge branch 'macos-fixes' into 'main'
For main

See merge request GNOME/gtk!6032
2023-05-29 23:37:22 +00:00
Benjamin Otte
3dc3d03a08 testsuite: Add conversion tests
Ensure we can convert from any format to any other format.
2023-05-30 00:42:10 +02:00
Benjamin Otte
788bd575d6 testsuite: Disable certain texture download tests
The GL renderers like to premultiply content that isn't, and due to the
data loss with alpha == 0 (transparent white, transparent black and
transparent anything are all represented by (0, 0, 0, 0) when
premultiplied) these values cannot be converted back.
2023-05-30 00:42:10 +02:00
Benjamin Otte
94a2dc4c47 testsuite: Update memorytexture test for TextureDownloader
There is no longer a need to use gdk_texture_download() and force
conversion to ARGB8 format. We can download the pixels in the original
format again.

That way we avoid testing the conversion code and avoid having to deal
with differences in representable colors.

However, some formats do do conversions, so we allow pixel comparisons
to be accurate (requires 16bit comparison accuracy) or inaccurate (we
only care about 8bit).
Note that for the default RGBA formats, this is identical and means they
need to be bit-exact the same, no matter what.
But the higher bit depth formats may be more different - floating point
can even have different values with high accuracy (the float mantissa is
23 bit, we only care about 16).
2023-05-30 00:42:10 +02:00
Benjamin Otte
169a7f83e6 testsuite: Imitate gdk_memory_convert() correctly
The formula use to compute pixel values from GdkRGBA floats was slightly
adapted some time ago, copy that adaptation
2023-05-30 00:39:46 +02:00
Luca Bacci
703494c7fa testsuite: rename 'wait' function to 'timed_loop'
When compiling for macOS, CLang errors out because a non-static
wait function is declared in sys/wait.h.
2023-05-29 16:43:28 +02:00
Luca Bacci
d642072603 Check for NULL groups in gtk_action_muxer_get_group ()
The groups hash table is initialized lazily when inserting
the first GActionGroup (gtk_action_muxer_insert ()). Do as
all surrounding code does and check for NULL before using
groups.

This avoids triggering a warning
2023-05-29 16:43:28 +02:00
Lukáš Tyrychtr
ab7a4f64cb GtkStack: Fix a potential crash in gtk_stack_get_first_accessible_child
This one can occur when the stack has no pages.
2023-05-29 15:14:51 +02:00
Luca Bacci
21c53a1969 Merge branch 'win32-monitors' into 'main'
GdkWin32Monitor fixes

See merge request GNOME/gtk!6015
2023-05-29 09:50:30 +00:00
Matthias Clasen
ae2dd1d907 Merge branch 'matthiasc/for-main' into 'main'
css: Add a test for non-ASCII font family

See merge request GNOME/gtk!6028
2023-05-28 17:58:38 +00:00
Matthias Clasen
f10c234361 css: Add a test for non-ASCII font family
This came up in #5852, so make sure that it works.
2023-05-28 07:57:40 -04:00
Matthias Clasen
3a650bff66 Merge branch 'matthiasc/for-main' into 'main'
Annotate more enum additions

See merge request GNOME/gtk!6027
2023-05-28 11:41:48 +00:00
Matthias Clasen
e9f622b81f listitemmanager: Small docs clarifications
If we write docs for private functions,
lets make them relevant.
2023-05-28 07:19:02 -04:00
Matthias Clasen
a85ad2ce67 Annotate more enum additions
We have the technology now, lets use it.
2023-05-28 07:19:02 -04:00
Daniel Boles
2af7e45860 MenuButton: Always mention child@always-show-arrow
get_always_show_arrow() did not mention at all that the custom child is
relevant. set_always_show_arrow() only did in the blurb, not for the arg
2023-05-28 11:35:44 +01:00
Matthias Clasen
2741e00210 Merge branch 'test-sections' into 'main'
testsections: A testbed for sections

See merge request GNOME/gtk!6025
2023-05-28 01:54:06 +00:00
Matthias Clasen
495411e16d testsections: A testbed for sections
Add a simple test client that lets us compare
and explore the section handling in listview
and gridview.
2023-05-27 21:30:14 -04:00
Matthias Clasen
9880f9d16a Merge branch 'slice-sections' into 'main'
Beef up our section models

Closes #5854

See merge request GNOME/gtk!6009
2023-05-28 01:00:04 +00:00
Matthias Clasen
5c1c22156c sortlistmodel: Optimize signals
When we emit items-changed due to a section
sorter change, don't also emit sections-changed.
Instead make the items-changed signal cover the
whole range.

Tests included.
2023-05-27 20:37:28 -04:00
Matthias Clasen
d7e8c52d37 Merge branch 'fix-section-sorter-keys' into 'main'
sortlistmodel: Fix handling of section sort keys

Closes #5854

See merge request GNOME/gtk!6024
2023-05-27 23:37:35 +00:00
Matthias Clasen
c3d3e2d47b sortlistmodel: Fix handling of section sort keys
When the section sorter changes, we need to update
the keys, otherwise the sorter will continue to report
the old sections.

This code is currently a bit suboptimal, since the
creation of sort keys and section sort keys are
muddled together.

Fixes: #5854
2023-05-27 19:09:05 -04:00
Matthias Clasen
9c1049e710 multiselection: Pass through sections-changed
If our underlying model emits sections-changed,
we need to pass it on.

Add a test for this too.
2023-05-27 17:27:19 -04:00
Matthias Clasen
a1352a88ff singleselection: Pass through sections-changed
If our underlying model emits sections-changed,
we need to pass it on.

Add a test for this too.
2023-05-27 17:27:19 -04:00
Matthias Clasen
8825917140 noselection: Pass through sections-changed
If our underlying model emits sections-changed,
we need to pass it on.

Add a test for this too.
2023-05-27 17:27:19 -04:00
Matthias Clasen
ba8d4902b5 filterlistmodel: Pass through sections-changed
If our underlying model emits sections-changed,
we need to pass it on.

Add a test for this too.
2023-05-27 17:27:19 -04:00
Matthias Clasen
8f3d3ca587 slicelistmodel: Pass through sections
Implement GtkSectionModel in the obvious way.

Tests included.
2023-05-27 17:27:19 -04:00
Matthias Clasen
aeba1e08e8 sortlistmodel: Emit sections-changed
When a new section sorter is set, potentially
all sections have changed. So emit sections-changed
for all items.

Tests included.
2023-05-27 17:27:19 -04:00
Matthias Clasen
9f47bfe193 sortlistmodel: Fix handling of section sort keys
When the section sorter changes, we need to update
    the keys, otherwise the sorter will continue to report
    the old sections.

    This code is currently a bit suboptimal, since the
    creation of sort keys and section sort keys are
    muddled together.

    Fixes: #5854
2023-05-27 17:27:19 -04:00
Benjamin Otte
43417e9e55 Merge branch 'columnview-sections' into 'main'
Columnview sections

See merge request GNOME/gtk!6006
2023-05-27 18:51:12 +00:00
Matthias Clasen
bbb7446e93 Merge branch 'matthiasc/for-main' into 'main'
docs: Cosmetics

See merge request GNOME/gtk!6023
2023-05-27 18:42:34 +00:00
Matthias Clasen
6623baeb52 docs: Cosmetics 2023-05-27 14:40:49 -04:00
Matthias Clasen
d90b09f8c3 Merge branch 'matthiasc/for-main' into 'main'
sortlistmodel: Cosmetics

See merge request GNOME/gtk!6022
2023-05-27 18:30:37 +00:00
Matthias Clasen
bcae6271df Merge branch 'handle-sections-changed' into 'main'
wip: list widgets: handle sections-changed

See merge request GNOME/gtk!6011
2023-05-27 17:55:00 +00:00
Matthias Clasen
fc524ed346 Cosmetics
Fix copy-paste errors in line 1.
2023-05-27 13:51:39 -04:00
Matthias Clasen
c80a0c0e85 sortlistmodel: Cosmetics
Make the set_[section]_sorter functions a bit more symmetric.
2023-05-27 13:47:46 -04:00
Matthias Clasen
7572f2ed87 columnview: Add section plumbing
Add a header-factory property, and pass it through
to the listview.
2023-05-27 13:39:55 -04:00
Matthias Clasen
54ec750238 Merge branch 'matthiasc/for-main' into 'main'
gtk: Annotate new enum values

See merge request GNOME/gtk!6021
2023-05-27 13:35:27 +00:00
Matthias Clasen
5d78cf6546 Merge branch 'wip/kabus/popover-direction' into 'main'
gtk/popover: Flip anchoring direction in RTL

Closes #5847

See merge request GNOME/gtk!6020
2023-05-27 13:19:28 +00:00
Khalid Abu Shawarib
d329b00bda gtk/popover: Flip anchoring direction in RTL 2023-05-27 13:19:28 +00:00
Matthias Clasen
ddf1ea9917 gtk: Annotate new enum values
We have decorators now to tell compilers when
enum values were added, so lets use them for the
new GtkAlign values.
2023-05-27 08:02:15 -04:00
Matthias Clasen
215f60e450 listitemmanager: Listen to sections-changed
And recreate header and footer tiles as needed.

This commit was tested using a sortlistmodel, changing
the section sorter from sorting only by first char
to sorting by the first two chars, which changes
the number of sections, but leaves the alphabetic
order of items unchanged.
2023-05-27 06:33:50 -04:00
Sabri Ünal
87070e0bdd Update Turkish translation 2023-05-26 22:48:53 +00:00
Matthias Clasen
19f51b5de2 Merge branch 'docs/gdk-RGBA-parse' into 'main'
docs: add HSL to Gdk.RGBA.parse

See merge request GNOME/gtk!6017
2023-05-25 17:40:08 +00:00
FineFindus
2d8c112f08 docs: add HSL to Gdk.RGBA.parse
Update the Gdk.RGBA.parse docs to reflect the ability to parse HSL, which has been added in 4.5.0.
2023-05-25 17:16:55 +02:00
Matthias Clasen
f1901081a6 NEWS: Updates 2023-05-24 22:03:48 -04:00
Jason Francis
cf79ad4433 win32: implement fullscreen_on_monitor
Track the HMONITOR so it can be used by the toplevel layout.
2023-05-24 18:48:37 -04:00
Benjamin Otte
d912628583 Merge branch 'wip/otte/for-main' into 'main'
2 GDK GL XWayland improvements

See merge request GNOME/gtk!6014
2023-05-24 22:22:48 +00:00
Jason Francis
f254ab700c win32: Invalidate inactive monitors
Without this, there are still GdkMonitors present for displays that are
present but disconnected (such as when a laptop disables the internal
display to connect to an external monitor).
2023-05-24 17:34:34 -04:00
Benjamin Otte
c7b62d89e3 glx: Implement support for EXT_swap_control
XWayland (at least on gnome-shell) does not support SGI_swap_control,
which we were using to unset the swap interval.

It does support EXT_swap_control though, which is the more modern
version of the same thing, so this commit adds support for that.

And now GDK_DEBUG=no-vsync gives me >1000fps instead of just 60fps,
2023-05-24 21:44:43 +02:00
Benjamin Otte
46e3454eb7 gl: Update tracked buffers from 2 to 4
With XWayland and direct scanout it is possible that some apps get into
a situation where more than 2 buffers are in flight and in that case we
want to be able to still track the change regions for those buffers.

Usually 3 buffers are in use, so we go one higher, just to be safe.
2023-05-24 21:44:43 +02:00
Benjamin Otte
7573a9d2a7 gl: Rewrite update area tracking code
Make it more generic. That way we could dynamically change the number of
buffers we track.

We don't do that yet though.
2023-05-24 21:44:29 +02:00
Carlos Garnacho
d24d193301 Merge branch 'lores-scroll-mid-detent' into 'main'
Send low-res scroll event in the middle of the wheel detent

See merge request GNOME/gtk!5128
2023-05-24 14:23:47 +00:00
José Expósito
e61938793a gtkeventcontrollerscroll: Send lores scroll in the middle of the detent
Some mice send a value slightly lower than 120 for some detents. The
current approach waits until a value of 120 is reached before sending a
low-resolution scroll event.

For example, the MX Master 3 sends a value of 112 in some detents:

              detent                   detent
    |                        |                       |
                        ^    ^                    ^
                        112  REL_WHEEL            224

As illustrated, only one event was sent but two were expected. However,
sending the low-resolution scroll event in the middle plus the existing
heuristics to reset the accumulator solve this issue:

              detent                   detent
    |                        |                       |
                ^          ^             ^          ^
                REL_WHEEL  112           REL_WHEEL  224

Send low-resolution scroll events in the middle of the detent to solve
this problem.

Related to https://gitlab.gnome.org/GNOME/mutter/-/issues/2469
2023-05-24 13:42:49 +00:00
Matthias Clasen
2f584c16f0 Merge branch 'reomveunused' into 'main'
widget: Don't include gtkpopover.h

See merge request GNOME/gtk!6012
2023-05-23 23:49:25 +00:00
Maximiliano Sandoval R
2565a28e59 widget: Don't include gtkpopover.h
It is not used.
2023-05-23 23:43:15 +02:00
Emmanuele Bassi
793a2b2a70 Merge branch 'zbrown/marshallers' into 'main'
marshallers: fix up some mistypes in drags

See merge request GNOME/gtk!6010
2023-05-23 13:50:26 +00:00
Matthias Clasen
146223cd74 Merge branch 'fix-menu-padding' into 'main'
menus: Avoid unnecessary right padding

Closes #5839

See merge request GNOME/gtk!6008
2023-05-22 20:50:56 +00:00
Daniel Boles
d8e7f0a8a9 MenuButton: Fix small grammar-o/match related syms 2023-05-22 21:39:36 +01:00
Matthias Clasen
a9adf7163f menus: Avoid unnecessary right padding
We are using placeholders in the 'check' column
that are put in a size group, so that they all
take the same space once a check or radio is shown.

Unfortunately, for the inline-buttons option, we
were using a GtkBuiltinIcon as placeholder, and those
respect the -gtk-icon-size CSS property and take
a minimum size of 16px. Use a GtkGizmo instead to
get the expected result of no extra padding unless
there's a check or radio.

Fixes: #5839
2023-05-22 16:16:45 -04:00
Matthias Clasen
10825cdc72 Merge branch 'matthiasc/for-main' into 'main'
widget-factory: Align some widgets better

See merge request GNOME/gtk!6007
2023-05-22 13:17:58 +00:00
Matthias Clasen
3b105a637c widget-factory: Align some widgets better 2023-05-22 08:36:13 -04:00
Matthias Clasen
fdbc203690 Merge branch 'wip/kabus/date-leak' into 'main'
gtk/recentmanager: Fix date leak

Closes #5842

See merge request GNOME/gtk!6005
2023-05-22 12:25:24 +00:00
Khalid Abu Shawarib
26c583227e gtk/recentmanager: Fix date leak 2023-05-22 12:25:24 +00:00
Арсений Засыпкин
1ea0bebf15 Update Russian translation 2023-05-22 12:18:13 +00:00
Matthias Clasen
ca0e27ec9d Merge branch 'matthiasc/for-main' into 'main'
Improve section model docs

See merge request GNOME/gtk!6003
2023-05-21 23:57:48 +00:00
Matthias Clasen
5edf9fc449 Merge branch 'fm-showitems' into 'main'
filelauncher: Use ShowItems to show in File Manager

Closes #5842

See merge request GNOME/gtk!5997
2023-05-21 23:22:57 +00:00
Matthias Clasen
534f11e317 Improve section model docs
Mention sections in the list widget overview,
and document the list models that support sections.
2023-05-21 19:20:08 -04:00
Zander Brown
d8cffa9350 marshallers: fix up some mistypes in drags
Fix: ff330668cf
2023-05-21 19:14:45 +01:00
Matthias Clasen
60dfa777f0 Merge branch 'gdk-introspection-fix' into 'main'
introspection: Include deprecated gdk api in gir

See merge request GNOME/gtk!5999
2023-05-21 14:25:59 +00:00
Matthias Clasen
d6fc0d6c94 gdk: Fix up introspection build
Referring to files across directories is not
easy, we need to use files() in just the right
way to make this work.
2023-05-21 09:46:49 -04:00
Matthias Clasen
4e71bd92aa introspection: Include deprecated gdk api in gir
This was overlooked in when the headers were moved
in ed265f6a7e.
2023-05-21 09:39:13 -04:00
Matthias Clasen
8aec42244e Merge branch 'ebassi/build-introspection' into 'main'
ci: Add introspection to the feature flags

See merge request GNOME/gtk!6000
2023-05-21 12:20:12 +00:00
Emmanuele Bassi
6ff36977f4 ci: Add introspection to the feature flags
It should be enabled by default, if we ever want to catch issues.
2023-05-21 12:22:50 +01:00
Matthias Clasen
ed84ccdaca Merge branch 'docs-css-fix' into 'main'
Fix typo in CSS docs

See merge request GNOME/gtk!5998
2023-05-21 11:02:45 +00:00
Arjan Molenaar
d9ec27ab29 Fix typo in CSS docs 2023-05-21 12:11:19 +02:00
Matthias Clasen
ca744b925e Merge branch 'list-tile-gc' into 'main'
Add gtk_list_item_manager_gc_tiles

See merge request GNOME/gtk!5995
2023-05-21 00:51:00 +00:00
Matthias Clasen
53c63673e4 gridview: Use gtk_list_item_manager_gc_tiles
This simplifies the code a bit.
2023-05-20 19:50:11 -04:00
Matthias Clasen
431458ed78 listview: Use gtk_list_item_manager_gc_tiles
This simplifies the code a bit.
2023-05-20 19:50:11 -04:00
Matthias Clasen
56cfef3544 testsuite: Use gtk_list_item_manager_gc_tiles
Use this  new api instead of open-coding it.

Also, assert that it merges consecutive
multi-item tiles.
2023-05-20 19:50:11 -04:00
Calvin Walton
be897646b1 filelauncher: Use ShowItems to show in File Manager
The non-portal fallback method for launching a file manager to show the
file in its parent directory was incorrectly using the `ShowFolders`
method (open a folder) instead of `ShowItems` (open the parent directory
and show the file).

The `show_item` function (previously `show_folder`) had an unused
`callback` parameter; it has been removed and the type of the parameter
containing the GTask has been renamed and now uses the correct type
instead of gpointer to reduce the amount of casting required.

Fixes GNOME/gtk#5842
2023-05-20 19:40:09 -04:00
Matthias Clasen
e23358e09f Merge branch 'matthiasc/for-main' into 'main'
Cosmetics

See merge request GNOME/gtk!5996
2023-05-20 23:22:56 +00:00
Matthias Clasen
833e1bdcf6 Cosmetics
Fix some typos.
2023-05-20 19:03:41 -04:00
Matthias Clasen
0091425729 listitemmanager: Stop exporting tile_gc
This function is now just used internally,
so make it static.
2023-05-20 18:59:16 -04:00
Matthias Clasen
b1c2a1c015 listitemmanager: Use gc_tiles
Replace an open-coded version of this function
with a call to gtk_list_item_manager_gc_tiles.
2023-05-20 18:59:16 -04:00
Matthias Clasen
31d03f9f26 Add gtk_list_item_manager_gc_tiles
This will allow us to simplify size allocation
code in listview and gridview.
2023-05-20 16:17:11 -04:00
Benjamin Otte
3beaf0962c Merge branch 'drop-filler-tiles' into 'main'
Drop the FILLER tile type

See merge request GNOME/gtk!5993
2023-05-20 17:18:53 +00:00
Matthias Clasen
48e49b4c50 gridview: Update factories in set_factory
Call update_factories() so the children get their
factories properly updated.

This matches what GtkListView does.
2023-05-20 12:53:39 -04:00
Matthias Clasen
1d4f383ba5 Drop the FILLER tile type
It is not used anymore.
2023-05-20 12:28:19 -04:00
Matthias Clasen
8cb3e01eef gridview: Stop using a filler tile
We can just use the footer to fill that space.
2023-05-20 12:28:19 -04:00
Matthias Clasen
42a0dcc7e4 gridview: Add an assertion
The want to use the footer tile at the end
to fill leftover space at the bottome right.

So lets assert that we actually dealing with
a footer tile, just in case something changes
in the future that might have us end up with
some other kind of tile.
2023-05-20 12:26:51 -04:00
Matthias Clasen
e9731fc99b Add some tile helpers 2023-05-20 12:26:39 -04:00
Matthias Clasen
2890557236 Revert "gridview: GC tiles first"
This reverts commit e121a5ca6f.

The tile that was causing the critical in #5836
(what that commit was about) was a FILLER, and we
are getting rid of FILLER tiles here. Which will
avoid the issue in a more elegant way.
2023-05-20 12:25:33 -04:00
Matthias Clasen
43a22bb350 Cosmetics
Use the proper g_assert variant.
2023-05-20 07:39:21 -04:00
Matthias Clasen
cd9c277820 Merge branch 'ci-clang-build' into 'main'
ci: Add a clang build

See merge request GNOME/gtk!5987
2023-05-18 19:10:52 +00:00
Matthias Clasen
42a12f1788 ci: Add a clang build
This is meant to catch build errors with clang.
2023-05-18 14:39:46 -04:00
Matthias Clasen
5f39820729 cups: Silence a compiler warning
Bitfields should be unsigned int.
2023-05-18 14:39:46 -04:00
Matthias Clasen
c2a8620660 gsk: Mark some variables as unused
Hopefully that shuts up clang.
2023-05-18 13:29:28 -04:00
Asier Sarasua Garmendia
647d5e17c1 Update Basque translation
(cherry picked from commit a6931a66c5)
2023-05-18 16:31:00 +00:00
Matthias Clasen
d87b9ee4c5 Merge branch 'matthiasc/for-main' into 'main'
roaring: Mark a variable as unused

See merge request GNOME/gtk!5990
2023-05-18 13:35:17 +00:00
Matthias Clasen
70ba00ae53 testsuite: Make this test compile
clang did not like this creative use of
strings at all. Rightfully so.
2023-05-18 08:40:50 -04:00
Matthias Clasen
c4fb473d4b roaring: Mark a variable as unused
Otherwise clang complains.
2023-05-18 08:34:48 -04:00
Matthias Clasen
b4fbd74f98 Merge branch 'fina/scrolled-window-measure' into 'main'
scrolledwindow: Propagate child measure size whenever possible

Closes #5838

See merge request GNOME/gtk!5986
2023-05-18 12:26:05 +00:00
Fina Wilke
7fae0bc0de scrolledwindow: Propagate child measure size whenever possible
In height-for-width and hscrollbar-policy = never, we can provide
the child with a proper for_size when measuring it. The same is true for
width-for-height and vscrollbar-policy = never.

This allows for accurately measuring the size of eg. wrapping labels.
2023-05-18 13:25:20 +02:00
Benjamin Otte
89b61eeec4 Merge branch 'listview-factory-leak' into 'main'
listview: Don't leak the factories

See merge request GNOME/gtk!5989
2023-05-17 18:57:28 +00:00
Matthias Clasen
e2492dd568 gridview: Don't leak the factory 2023-05-17 14:32:55 -04:00
Matthias Clasen
ca000287fc listview: Don't leak the factories 2023-05-17 14:17:47 -04:00
Benjamin Otte
ff14fea672 Merge branch 'fix-gridview-critical' into 'main'
gridview: GC tiles first

Closes #5836

See merge request GNOME/gtk!5988
2023-05-17 17:04:43 +00:00
Matthias Clasen
e121a5ca6f gridview: GC tiles first
Before checking that there are no tiles,
we need to gc any possibly leftover filler
tiles.

Fixes: #5836
2023-05-17 12:31:16 -04:00
Matthias Clasen
e79851502c Merge branch 'pathbar-early-return-on-cancellation' into 'main'
pathbar: Fail setting the path on cancellation

Closes #5792

See merge request GNOME/gtk!5982
2023-05-17 10:15:26 +00:00
Matthias Clasen
0132ab046b Merge branch 'matthiasc/for-main' into 'main'
Reduce pixbuf helpers

See merge request GNOME/gtk!5984
2023-05-17 10:14:44 +00:00
Matthias Clasen
c2ba1d69a1 Rename pixbuf utils to texture utils
That is what this is now.
2023-05-16 22:00:08 -04:00
Matthias Clasen
847739aed7 Reduce pixbuf helpers
Concentrate pixbuf handling in gdkpixbufutils.c.
2023-05-16 21:56:22 -04:00
Matthias Clasen
4d66598f31 Merge branch 'matthiasc/for-main' into 'main'
gsk: Cosmetics

See merge request GNOME/gtk!5983
2023-05-17 00:58:48 +00:00
Matthias Clasen
2ec1bd7248 Merge branch 'gl-renderer-more-defensive' into 'main'
gsk: Stop setting uniforms when we are out of batches

See merge request GNOME/gtk!5981
2023-05-17 00:29:40 +00:00
Benjamin Otte
646d1a8923 Merge branch 'wip/otte/ci-emergency' into 'main'
CI: Actually build our code

See merge request GNOME/gtk!5980
2023-05-17 00:19:06 +00:00
Matthias Clasen
4a8a6e9f70 gsk: Don't build unused functions
The only caller is #if 0 ed, so don't build
these functions.
2023-05-16 20:13:57 -04:00
Matthias Clasen
0a9d25c9e8 gsk: Cosmetics
Get the context from the driver.
2023-05-16 20:13:57 -04:00
Matthias Clasen
188677724c Improve test coverage for property lookup models 2023-05-16 20:13:57 -04:00
Olivier Crête
22cd3ea268 pathbar: Fail setting the path on cancellation
The cancellation path already clears the GCancellable, if we let it
continue, it causes a later assertion, so just exit early in this case
and hope a new path has been set.

Fixes: #5792
2023-05-17 01:10:23 +01:00
Matthias Clasen
71a231b71d gsk: Stop setting uniforms when we are out of batches
When the command queue is out of batches, there is
no point in doing further work like allocating uniforms.

This helps us avoid assertions in the uniform code
that we would hit when we run out of uniform space
too.
2023-05-16 20:03:19 -04:00
Benjamin Otte
112fe06323 glrenderer: Remove unused function
Thanks, macos CI.

(We should have a Fedora clang build.)
2023-05-17 01:52:42 +02:00
Benjamin Otte
8bcb918de5 tests: Remove some tests
They are failing to build because they use deprecated functions and
nobody thinks they're worth fixing.
2023-05-17 01:24:22 +02:00
Benjamin Otte
6f6293c38c CI: Actually build our code
Commit 3090795351 accidentally caused all
CI builds (or at least the ones with -Werror) to no longer build tests,
examples and demos, so none of them had made sure that they compile.
2023-05-17 00:56:23 +02:00
Matthias Clasen
1b885cc317 Merge branch 'fix-gsk-assertions' into 'main'
gsk: Fix a crash

See merge request GNOME/gtk!5979
2023-05-16 22:20:51 +00:00
Matthias Clasen
9dd83ab354 gsk: Fix a crash
When we start ignoring batches, we must do it everywhere,
or we may run into assertions. This was triggered by an
enormous text node tree produced by tests/rendernode-create.
2023-05-16 17:33:21 -04:00
Matthias Clasen
0bbc6f8932 Merge branch 'ebassi/issue-5837' into 'main'
Fix various compiler warnings with GCC 13

Closes #5837

See merge request GNOME/gtk!5977
2023-05-16 21:28:29 +00:00
Emmanuele Bassi
1ad4c04b2a Replace deprecated CSS loading API
Use gtk_css_provider_load_from_string() when loading CSS from C
strings.
2023-05-16 16:59:05 -04:00
Emmanuele Bassi
0bbe68db0b Implement GtkSelectionModel for GtkNotebookPages
The documentation says that the model returned by
gtk_notebook_get_pages() implements the GtkSelectionModel interface, but
checking the history confirms this is a lie.

Instead of fixing the documentation, we can easily make it true, and
reduce the differences between GtkNotebook and GtkStack.

Fixes: #5837
2023-05-16 16:59:05 -04:00
Emmanuele Bassi
b2a3a5e226 Fix various compiler warnings with GCC 13
There are various null dereference warnings in GtkListItemManager that
make the build noisy.
2023-05-16 16:59:05 -04:00
Matthias Clasen
0434ad3bd9 Merge branch 'no-deprecations-in-demos' into 'main'
demos: Stop using deprecated api

See merge request GNOME/gtk!5978
2023-05-16 20:51:01 +00:00
Matthias Clasen
9d3046f187 Merge branch 'matthiasc/for-main' into 'main'
Matthiasc/for main

See merge request GNOME/gtk!5975
2023-05-16 20:42:27 +00:00
Matthias Clasen
6b2c088a29 demos: Stop using deprecated api
Use texture apis instead of pixbuf ones.
2023-05-16 16:25:59 -04:00
Matthias Clasen
4efc736a6e Merge branch 'wip/otte/for-main' into 'main'
gdk: Clamp frame region to surface size

Closes #5812

See merge request GNOME/gtk!5976
2023-05-16 17:25:17 +00:00
Benjamin Otte
2b0e3a5b1a nodeparser: Move an error check
By putting the check earlier, it will be emitted for the right token.
2023-05-16 18:53:53 +02:00
Benjamin Otte
bac41ce644 node-editor: Print default renderer in title
If there is a value passed to GSK_RENDERER, display it in the window
title.

This is mostly so that when I show off screenshots, people know what
renderer I'm using.
2023-05-16 18:53:53 +02:00
Benjamin Otte
2b0ad09423 vulkan: Make projection matrix match GL
Vulkan has a different initial coordinate system to GL.

GL:
(-1, 1, -1) +------+.
            |`.    | `.
            |  `·--|---·
            |   :  |   :
            +------+.  :
             `. :    `.:
               `·------· (1, -1, 1)

Vulkan:
(-1, -1, 0) +------+.
            |`.    | `.
            |  `·--|---·
            |   :  |   :
            +------+.  :
             `. :    `.:
               `·------· (1, 1, 1)

so adjust the near and far plane we pass to
graphene_matrix_init_ortho() to make it end up with the same
projection as the GL renderer.
2023-05-16 18:53:27 +02:00
Benjamin Otte
f5955feea1 testsuite: Add crossfade-clip-both-children test
This one tests a crossfade between two non-overlapping nodes with a clip
region that covers neither of the two nodes.

This tests that renderers can deal with clip regions that doesn't
overlap nodes in a situation where they will most likely want to create
an offscreen.
As offscreens are typically clipped to the clip region, this would cause
an empty offscreen and that can cause failures.
2023-05-16 18:53:27 +02:00
Benjamin Otte
853e8719c6 testsuite: Add clip-translate-offscreen test
This was an experiment where an offscreen was translated inside an
existing clip.

Because renderers try to limit offscreens to the clip rect, this is
interesting, because they might get the translation wrong.
2023-05-16 18:53:27 +02:00
Benjamin Otte
8d528350b9 rendernode: clip when drawing shadows
Ensures the shadow stays small.
2023-05-16 18:53:27 +02:00
Benjamin Otte
d51c92f54d build: Make shaders depend on their includes
This does not do any proper dependency tracking, it just makes every
shader depend on every include shader.

But that's good enough for now.
2023-05-16 18:53:27 +02:00
Benjamin Otte
b9bd7124c0 vulkan: Fix typo in clipping code 2023-05-16 18:53:27 +02:00
Benjamin Otte
14f67550d0 build: Add a new gcc 13 warning
We don't trigger it and it's a useful warning. So let's use it.
2023-05-16 18:53:27 +02:00
Benjamin Otte
ee6ef41e71 css: Remove crashy resource:// optimization
Using gdk_texture_new_from_resource() is not valid here because we are
not sure if the given resource is valid.

Plus, the previous optimization is no longer relevant, because we are
not using gdk_pixbuf_new_from_resource() anymore - which was what this
optimization was about before it was ported to GdkTexture.

Test attached.
2023-05-16 18:53:27 +02:00
Benjamin Otte
fde3d2cd50 testsuite: Add testcase for z clipping
the near and far clipping plane are at -10000 and 10000 respectively.
Test that the renderers respect that.
2023-05-16 18:53:27 +02:00
Benjamin Otte
099955b0c0 gridview: Add border-spacing where it was missed
We were computing column widths without taking border-spacing into
account, making them slightly too big.
2023-05-16 18:53:09 +02:00
Benjamin Otte
b530ade8c6 gdk: Clamp frame region to surface size
The region may be larger than the surface's size, but many rendering
APIs require the size to be clamped.

Fixes #5812
2023-05-16 18:53:09 +02:00
Matthias Clasen
3a9234dadc Cosmetics 2023-05-16 12:33:12 -04:00
Matthias Clasen
3e27232028 Improve test coverage for sorters 2023-05-16 12:33:12 -04:00
Matthias Clasen
c2676ad785 Improve test coverage for GtkPropertyLookupListModel 2023-05-16 12:33:12 -04:00
Matthias Clasen
4a1598dc2a Merge branch 'fix-property-lookup-model' into 'main'
Fix a few bugs in GtkPropertyLookupListModel

See merge request GNOME/gtk!5974
2023-05-16 16:31:35 +00:00
Matthias Clasen
5f70b00bea Fix a few bugs in GtkPropertyLookupListModel
Fix bugs in property types.
2023-05-16 12:00:08 -04:00
Matthias Clasen
3377460fb8 Merge branch 'matthiasc/for-main' into 'main'
gdk: Drop some unused private api

See merge request GNOME/gtk!5973
2023-05-16 12:48:40 +00:00
Matthias Clasen
05a0aca5ab Improve test coverage for GtkStringSorter 2023-05-15 23:21:06 -04:00
Matthias Clasen
9463e0f56c Only build iconcache validator if it is used 2023-05-15 23:06:07 -04:00
Matthias Clasen
1c308431a6 Drop unneeded exports from gdkpixbufutils.c 2023-05-15 23:05:52 -04:00
Matthias Clasen
fb996f6e6d Drop an unused include 2023-05-15 23:05:52 -04:00
Matthias Clasen
edfd37dfe2 docs: Mention pixbufs in the migration guide 2023-05-15 23:05:52 -04:00
Matthias Clasen
4bede73f62 Deprecate from-pixbuf apis for widgets
We want to drop GdkPixbuf from our apis.
These have easy replacements already, so
lets deprecate them.
2023-05-15 23:05:52 -04:00
Matthias Clasen
0b59290bad gdk: Drop some unused private api 2023-05-15 20:30:38 -04:00
Matthias Clasen
e8c7d0e5ec Merge branch 'wip/corey/filesystemmodel' into 'main'
filesystemmodel: Ignore changes on the parent directory

Closes #4233

See merge request GNOME/gtk!5970
2023-05-16 00:09:56 +00:00
Matthias Clasen
3fb06ca29d Merge branch 'matthiasc/for-main' into 'main'
tools: Cosmetics

See merge request GNOME/gtk!5972
2023-05-16 00:02:15 +00:00
Matthias Clasen
013401b594 Fix texture tests with GLES
No sync for you if you're using GLES.
2023-05-15 19:11:35 -04:00
Matthias Clasen
484c4bdf22 Merge branch 'deprecate-pixbuf-apis' into 'main'
gdk: Deprecated some pixbuf apis

See merge request GNOME/gtk!5971
2023-05-15 23:03:42 +00:00
Corey Berla
133231e12b filesystemmodel: Ignore changes on the parent directory
The filesystemmodel tracks changes and additions to child files
through G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED.  This event will also
occur if the parent directory is changed.  Since the parent directory
doesn't exist in the model, it creates a non-existent item.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4233
2023-05-15 15:50:40 -07:00
Corey Berla
ef2024736d filechooserwidget: Stop leaking file system models 2023-05-15 15:50:32 -07:00
Matthias Clasen
ed265f6a7e gdk: Deprecated some pixbuf apis
These are already documented as 'don't use
in new apis'. Lets make it official and
deprecate them properly.
2023-05-15 18:22:37 -04:00
Matthias Clasen
0152286fa0 Improve test coverage for GdkGLContext 2023-05-15 16:49:12 -04:00
Corey Berla
4ef560d3b8 .gitignore: Ignore .flatpak-builder directory 2023-05-15 13:08:56 -07:00
Matthias Clasen
343472931d Cosmetics
Linkify a reference.
2023-05-15 15:25:11 -04:00
Matthias Clasen
41b606b16d Add tests for GdkTextureDownloader 2023-05-15 15:24:56 -04:00
Matthias Clasen
f83c00c928 Test gltexture update functionality 2023-05-15 12:50:28 -04:00
Matthias Clasen
f497cb2b6e Improve gdk test coverage 2023-05-15 11:56:31 -04:00
Matthias Clasen
2f8c0b7aec tools: Cosmetics
Make gtk-builder-tool screenshot be quiet unless
it had to make up a filename. And tweak --help
output a bit.
2023-05-15 08:03:20 -04:00
Matthias Clasen
d517b25ea3 Merge branch 'export-handles-properly' into 'main'
Add testfilelauncher

See merge request GNOME/gtk!5968
2023-05-15 10:12:29 +00:00
Matthias Clasen
37345670c8 Add testfilelauncher
This is a test to use GtkFileLauncher a bit
more intensively than usual.
2023-05-15 00:20:24 -04:00
Matthias Clasen
89d993b6ec wayland: Try harder to be compatible
We can keep the old unexport_handle api working
in the case that there is only a single exported
handle.
2023-05-15 00:20:24 -04:00
Matthias Clasen
250a5c0dfd Deprecate gdk_wayland_toplevel_unexport_handle
It doesn't do anything anymore, and is no longer
used internally. The replacement is
gdk_wayland_toplevel_drop_exported_handled().
2023-05-15 00:20:24 -04:00
Matthias Clasen
af3ceb5755 wayland: Reimplement exporting
Change things so that every call to export_handle
creates a new handle, and unexport_handle destroys
the handle that it is given.
2023-05-14 23:49:44 -04:00
Matthias Clasen
982a696311 wayland: Give toplevels a destroy hook
We will need to do some cleanup before the
wl_surface is destroyed, so add a hook for that.
2023-05-14 23:49:44 -04:00
Matthias Clasen
e5f1e4545d gdk: Change the private export handle api
Make unexport_handle take the handle, so we
can in the future deal with multiple exports.

Update the one caller in gtkwindow.c to pass
the handle.
2023-05-14 23:49:44 -04:00
Matthias Clasen
bf87a40b20 wayland: Add new backend api
Add an alternative to unexport_handle that
does take the handle.
2023-05-14 23:49:44 -04:00
Matthias Clasen
18b8baaf25 Merge branch 'input-doc-fixes' into 'main'
GTK reference docs: Some fixes

See merge request GNOME/gtk!5969
2023-05-14 21:49:10 +00:00
Matthias Clasen
4c69192837 gtk: Change the private export handle api
Make unexport_handle take the handle, which will
let us deal with multiple exports in the future.

Update all callers to store their handle, and
pass it to unexport_handle.
2023-05-14 17:19:45 -04:00
FeRD (Frank Dana)
c01be6cac7 doc/actions: Fix end-of-file :
The actions document ended with a : where there used to be a period,
seemingly a bug in the conversion from XML. Replace that : with a
period, and remove another spurious : inserted during the conversion.
2023-05-14 17:01:38 -04:00
FeRD (Frank Dana)
8b4e7a638c docs/input: <kbd>␣</kbd> => <kbd>Space</kbd>
- Switch to semantic newlines, where adding <kbd> caused wrapped text
  to grow wider than 80 characters on some lines.
2023-05-14 16:23:41 -04:00
FeRD (Frank Dana)
59acec21d4 docs/input-handling: A few more <kbd> wrappings
- Format a few missed keypresses/combos using <kbd>
- Switch to semantic newlines for those (paragraphs, bullet points)
2023-05-14 16:20:33 -04:00
Matthias Clasen
38f610f85e Fix a typo 2023-05-14 13:26:14 -04:00
Matthias Clasen
5393173afa wayland: Remove some unused fields 2023-05-14 13:06:00 -04:00
Matthias Clasen
951b448e90 Merge branch 'matthiasc/for-main' into 'main'
Add a README to examples/hello

See merge request GNOME/gtk!5967
2023-05-14 16:58:44 +00:00
Matthias Clasen
51ad2a55a8 gdk: Add an assertion
We simply overwrite any previous region,
so assert that the field was NULL before.
2023-05-14 07:50:11 -04:00
Matthias Clasen
e50209a535 Add more texture load tests
Add some tests for handling of failures.

The test data here is taking from gdk-pixbufs
tests/test-images/fail directory, excluding anything
but png, tiff and jpg images.
2023-05-14 07:50:11 -04:00
Matthias Clasen
d6430995ad Improve gdk test coverage
Test the loadable icon implementation of GdkTexture.
2023-05-14 07:50:11 -04:00
FeRD (Frank Dana)
9b1026886b docs/input-handling: Don't leave reader hanging
Strangely, the document's last sentence ended with a colon,
giving the impression there's missing text that should follow.
There is not.

Even more strange, it's _always_ ended with a colon,
ever since the file was converted from XML
(in commit 10cd539104).

BUT, the XML file it was converted _from_ ended that same sentence
with a period! I have no idea where the colon came from.
2023-05-14 05:29:18 -04:00
Matthias Clasen
cea15fc63e Improve gdk test coverage
Add tests for GdkToplevvelLayout and
GdkPopupLayout.
2023-05-13 21:56:29 -04:00
Matthias Clasen
f99fbab24f docs: Mention the current build options
Some of these got renamed recently.
2023-05-13 21:56:29 -04:00
Matthias Clasen
6acd4361ab ci: Stop using deprecated build options
demos got renamed to build-demos.
2023-05-13 21:56:29 -04:00
Matthias Clasen
05f488011a Add a README to examples/hello
Just so nobody wonders why there's a meson.build
in this subdirectory.
2023-05-13 21:56:29 -04:00
Georges Basile Stavracas Neto
ef7679235a Merge branch 'revert-78f68d79' into 'main'
Revert "Merge branch 'gbsneto/css-parser-annotation' into 'main'"

See merge request GNOME/gtk!5965
2023-05-14 00:37:47 +00:00
Matthias Clasen
d65f9b298c Merge branch 'new-css-load-apis' into 'main'
Add new css provider load apis

See merge request GNOME/gtk!5966
2023-05-14 00:27:23 +00:00
Matthias Clasen
5c9de08159 Deprecate gtk_css_provider_load_From_data 2023-05-13 20:00:36 -04:00
Matthias Clasen
f2a297f56d Stop using gtk_css_provider_load_from_data 2023-05-13 19:59:17 -04:00
Matthias Clasen
a1d9cb8ad6 Add new css provider load apis
gtk_css_provider_load_from_data has turned out
to be problematic for language bindings. Add two
new variants, from_string and from_bytes, to
replace it.
2023-05-13 19:46:29 -04:00
Emmanuele Bassi
8da911db81 Revert "Merge branch 'gbsneto/css-parser-annotation' into 'main'"
This reverts merge request !5964
2023-05-13 21:53:04 +00:00
Georges Basile Stavracas Neto
78f68d7992 Merge branch 'gbsneto/css-parser-annotation' into 'main'
gtk/css-provider: Add back array length annotation

See merge request GNOME/gtk!5964
2023-05-13 20:51:00 +00:00
Georges Basile Stavracas Neto
8a190b200b gtk/css-provider: Add back array length annotation
This partially reverts commit 93a875bf20.

Removing this annotation broke bindings, which now treat the
length of the array as a standalone parameter.

This broke Spiel, and probably other non-C apps that rely on
GtkCssProvider through bindings.
2023-05-13 17:18:21 -03:00
Matthias Clasen
e72b4ae6e2 Merge branch 'more-marshaller-cleanup' into 'main'
Add missing va marshallers

See merge request GNOME/gtk!5963
2023-05-13 19:46:30 +00:00
Daniel Boles
9f1f4850fe Widget: Fix doubled word need, missing possessives 2023-05-13 18:17:17 +01:00
Matthias Clasen
0b9e5e6db4 Drop duplication between marshallers
gtk and gdk have their own marshallers, for historic
reasons. But there's no reason to duplicate the same
code here.

Eventually, we should just move all marshallers to
the same place.
2023-05-13 12:50:45 -04:00
Matthias Clasen
2cd5b4df1b Add missing va marshallers
Whenever we pass a marshaller to g_signal_new,
call g_signal_set_va_marshaller with the corresponding
va marshaller.
2023-05-13 12:38:24 -04:00
Matthias Clasen
57a070fc8d Merge branch 'marshaller-cleanup' into 'main'
Avoid generic marshallers

See merge request GNOME/gtk!5962
2023-05-13 15:35:14 +00:00
Matthias Clasen
ccc6b7165e Drop unused marshallers
This list was found by a combination of
grep, sed, and sort.
2023-05-13 11:15:49 -04:00
Matthias Clasen
ff330668cf Avoid generic marshallers
The libffi-based generic marshallers give sysprof
difficulties in getting good stacktraces, so avoid
them.
2023-05-13 11:15:49 -04:00
Matthias Clasen
63f9e5453d Merge branch 'matthiasc/for-main' into 'main'
popover: Stop making assumptions about corners

See merge request GNOME/gtk!5961
2023-05-13 12:40:35 +00:00
Matthias Clasen
f849823a07 popover: Stop making assumptions about corners
The popover tail drawing code was just assuming that
the corner values are numbers. Which they won't, anymore.
2023-05-13 07:36:35 -04:00
Matthias Clasen
9a2d6d6d88 Improve css parser test coverage 2023-05-13 07:36:28 -04:00
Matthias Clasen
72c37d566c Merge branch 'matthiasc/for-main' into 'main'
css: Fix transition of font features

See merge request GNOME/gtk!5957
2023-05-13 02:02:48 +00:00
Matthias Clasen
01c0d5e04b Merge branch 'volumemedia' into 'main'
mediacontrols: Set valign=center on volume button

See merge request GNOME/gtk!5955
2023-05-13 01:43:59 +00:00
Matthias Clasen
57dd88ee53 testsuite: Cosmetics 2023-05-12 19:52:42 -04:00
Matthias Clasen
8c92c619de Test the deprecation support
Test gtk4-builder-tool validate --deprecations
2023-05-12 19:52:42 -04:00
Matthias Clasen
78d2002965 Add tests for gtk4-builder-tool enumerate 2023-05-12 19:52:42 -04:00
Matthias Clasen
25c4acb6d2 Add tests for hsv<>rgb conversion 2023-05-12 19:52:42 -04:00
Matthias Clasen
0a3dac10c6 Improve test coverage for the css parser 2023-05-12 19:52:42 -04:00
Matthias Clasen
c9afcd31c2 css: Improve transition test coverage 2023-05-12 19:52:42 -04:00
Matthias Clasen
3565facdaf css: Fix initial rotate transform value 2023-05-12 19:52:42 -04:00
Matthias Clasen
494cff94d6 css: Make some corner values static
Provide static value for uniform corners
with lengths from 0 to 8px. This covers
the majority of corners in widget-factory.
2023-05-12 15:00:13 -04:00
Matthias Clasen
17644b12a5 css: More static length values
Make all length values from 0px to 8px available
as static values. This will help with cutting
down on the number of corner values (we have a
lot of 5px corners).
2023-05-12 14:50:02 -04:00
Matthias Clasen
54ff5d8edd Revert "css: Simplify default values"
This reverts commit 1efa39672b.

We want to use corner values for corner properties.
2023-05-12 14:50:02 -04:00
Matthias Clasen
b18320fe05 Revert "csscornervalue: Accept other values if x == y"
This reverts commit 1f2f2777e1.

It broke transitioning of corner values.
2023-05-12 14:50:02 -04:00
Jordi Mas
0ce60ad214 Update Catalan translation 2023-05-12 19:42:35 +02:00
Matthias Clasen
76642f2bf9 css: Correct initial shadow filter values
This was using numbers instead of lengths,
causing confusion in the transition code.
2023-05-12 13:15:35 -04:00
Guillaume Bernard
fcac150641 Update French translation 2023-05-12 13:24:14 +00:00
Matthias Clasen
4d13c61aaf css: Fix transition of font features
If we store ints as values, we better use
g_hash_table_lookup_extended, or zeros will
show up as missing values.
2023-05-12 09:13:00 -04:00
Matthias Clasen
09bab2b2df Improve css parser test coverage 2023-05-12 08:38:39 -04:00
Maximiliano Sandoval R
b44f43e996 mediacontrols: Set valign=center on volume button
To match the play button.
2023-05-12 11:35:53 +02:00
Daniel Boles
52fa641dff Overlay: Add minimal doc blurb for property :child 2023-05-12 10:30:37 +01:00
Matthias Clasen
a3ebc0329d Improve test coverage for list models 2023-05-11 23:24:23 -04:00
Matthias Clasen
8dc04d3fc8 Merge branch 'matthiasc/for-main' into 'main'
Add a little wait to focus tests

See merge request GNOME/gtk!5954
2023-05-12 02:41:26 +00:00
Matthias Clasen
ba64e5588d Add a little wait to focus tests
I don't know exactly why, but this seems
to help the tests not fail on X11.
2023-05-11 22:24:10 -04:00
Matthias Clasen
fcdcdb7e78 Merge branch 'matthiasc/for-main' into 'main'
ci: Use the same options for the scan-build job

See merge request GNOME/gtk!5953
2023-05-12 02:08:37 +00:00
Matthias Clasen
3d5789a66e Merge branch 'validate-uris' into 'main'
urilauncher: Validate the uri

Closes #5829

See merge request GNOME/gtk!5952
2023-05-12 00:19:07 +00:00
Matthias Clasen
59343e4efb gtk-demo: Rename the new Settings demo
"v2" does not look great in the sidebar.
Lets call this "Alternative Settings".
2023-05-11 20:14:58 -04:00
Matthias Clasen
41219ae489 gtk-demo: Fix a typo 2023-05-11 19:53:42 -04:00
Matthias Clasen
7055250692 ci: Stop special-casing broadway
We are not running the broadway tests anymore,
so no need to special-case them in the run-test.sh
script either.
2023-05-11 19:53:03 -04:00
Matthias Clasen
98f63d09c0 ci: Use the same options for the scan-build job
In particular, not building the tests should
help cutting down on time spent linking.
2023-05-11 19:53:03 -04:00
Matthias Clasen
85b9a6f1b0 urilauncher: Validate the uri
We don't want to send nonsense to the portal.

Fixes: #5829
2023-05-11 18:34:26 -04:00
Matthias Clasen
3353eac289 Merge branch 'fix-focus-tests' into 'main'
spinbutton: Update baseline child

See merge request GNOME/gtk!5950
2023-05-11 22:28:46 +00:00
Matthias Clasen
cdc135f11d Merge branch 'shortcuts-focus' into 'main'
theme: Show focus in shortcuts windows

See merge request GNOME/gtk!5951
2023-05-11 20:16:07 +00:00
Matthias Clasen
069ce48ac5 theme: Show focus in shortcuts windows
The individual items are now focusable,
so we need to show a focus ring, otherwise
this is just confusing.
2023-05-11 15:58:15 -04:00
Matthias Clasen
625c7c3d26 widgetfocus: Sort children better for TAB
When tabbing in a box, we really want to sort
children just along the main axis. Make it so.
2023-05-11 15:35:27 -04:00
Matthias Clasen
4ea2aac561 spinbutton: Update baseline child
When the orientation changes, the entry changes
position, so we need to update baseline-child to match.
2023-05-11 15:34:44 -04:00
Matthias Clasen
e88e31dde2 Merge branch 'balance-ci-jobs' into 'main'
ci: Balance the work between jobs

See merge request GNOME/gtk!5949
2023-05-11 13:47:56 +00:00
Matthias Clasen
fb2e67638d testsuite: Simplify shader test
Simplify the shader to something GLES
will successfully compile.
2023-05-11 09:20:25 -04:00
Matthias Clasen
f11dd83ab5 Merge branch 'matthiasc/for-main' into 'main'
gsk: Dispose the driver when the display is closed

See merge request GNOME/gtk!5948
2023-05-11 13:11:56 +00:00
Matthias Clasen
92804b5b55 Drop the duplicate x11 testsuite run
We currently run the testsuite against x11 in both
the debug and release builds. Once ought to
be enough.
2023-05-11 08:52:48 -04:00
Matthias Clasen
87e7ea6080 ci: Balance the work between jobs
The fedora-x86-64 build does not only build with debug,
it also does the hello build, and it runs the testsuite
multiple times.

Move the hello build to the fedora release build. The idea
is that this lets us do more work in parallel, and spend
less time waiting for the longest-running ci job.
2023-05-11 08:39:38 -04:00
Matthias Clasen
b1945b38e8 ci: Drop the broadway test run
We are ignoring failures here, and nobody is working
on fixing them. And the failures end up at the end
of the log, adding annoyance to finding the actual
failures.
2023-05-11 08:34:14 -04:00
Matthias Clasen
13ca3187f2 testsuite: fix another surface unref warning 2023-05-11 06:40:57 -04:00
Matthias Clasen
18fd506360 build: Cosmetics 2023-05-11 06:13:42 -04:00
Matthias Clasen
9faf1a0377 gsk: Comment out some debug code
The calls of these functions are #ifdef'ed out,
so no point in compiling these functions.
2023-05-11 06:13:42 -04:00
Matthias Clasen
1a9c03449e gtk: Don't drop too many references
We only have one reference to the surface,
and it is dropped by gdk_surface_destroy.

All the users of surfaces in gtk had the same
bug: they were all stealing an extra reference
to drop - the one that the renderer was leaking
until recently.
2023-05-11 06:13:03 -04:00
Matthias Clasen
aee214b09d gsk: Fix some renderer gotchas
unrealize() needs to clean up the surface that was set
in realize(), and both need to emit property change
notification.
2023-05-10 20:21:54 -04:00
Matthias Clasen
dc3003bc4d gsk: Improve test coverage
Add more tests for gsk transforms, render node
and renderer apis.
2023-05-10 20:21:31 -04:00
Matthias Clasen
845f4b1536 gsk: Drop an unused function 2023-05-10 20:21:12 -04:00
Matthias Clasen
abbb3a2da6 testsuite: Close displays in the gsk tests
This gives us better coverage of the dispose
codepath for a driver that has actually been
used.
2023-05-10 20:21:12 -04:00
Matthias Clasen
1a93efecf3 gsk: Dispose the driver when the display is closed
This was the intention, but the object data by itself
does not achieve that: We do run dispose on the display
when it is closed, but object data is only cleared in
finalize. So listen to the ::closed signal and remove
the driver ourselves.

Fix up the drivers dispose implementation enough for
that to actually work.
2023-05-10 20:21:12 -04:00
Matthias Clasen
440d56a44f Use gsk_matrix_transform_point3d consistently 2023-05-10 20:21:12 -04:00
Matthias Clasen
f10603e97d Merge branch 'matthiasc/for-main' into 'main'
tests: Stop copying the tool tests

See merge request GNOME/gtk!5947
2023-05-10 10:38:07 +00:00
Matthias Clasen
9a9257d7be tests: Don't disable vertex arrays
It doesn't work, and that makes tests fail.
2023-05-09 23:02:48 -04:00
Matthias Clasen
5c10f2b4cd Improve coverage for half-float fallbacks 2023-05-09 23:02:30 -04:00
Matthias Clasen
ba6a618d44 build: Rename another option 2023-05-09 21:41:27 -04:00
Matthias Clasen
5fbeea3870 build: Deprecate an option
Rename the demos option to build-demos, to match
the other options for building optional parts.
2023-05-09 21:34:05 -04:00
Matthias Clasen
27368a418a build: Require meson 0.63
This is needed for option deprecation.
2023-05-09 21:34:05 -04:00
Matthias Clasen
676cd1e673 tests: Stop copying the tool tests
No point in doing that, and the meson feature
we are using here is deprecated.
2023-05-09 21:21:39 -04:00
Matthias Clasen
d6a4c65bfa Post-release version bump 2023-05-09 20:48:33 -04:00
Matthias Clasen
4695f583c1 4.11.2 2023-05-09 20:46:21 -04:00
Matthias Clasen
fa88d738dc Update baseline docs a bit 2023-05-09 18:59:11 -04:00
Matthias Clasen
7841248c1d Merge branch 'deprecate-align-value' into 'main'
Deprecate GTK_ALIGN_BASELINE

See merge request GNOME/gtk!5946
2023-05-09 20:53:59 +00:00
Matthias Clasen
ef5f34c985 Update tests 2023-05-09 16:36:07 -04:00
Matthias Clasen
1dfa54c117 Deprecate GTK_ALIGN_BASELINE
We can deprecated enum values now.
2023-05-09 14:28:26 -04:00
Matthias Clasen
ff920d98ec Use GTK_ALIGN_BASELINE_FILL
Replace GTK_ALIGN_BASELINE with its new name
everywhere.
2023-05-09 14:28:26 -04:00
Matthias Clasen
91ca6d0851 Merge branch 'wip/ebassi/gen-version-macros' into 'main'
Generate version and deprecation macros at build time

See merge request GNOME/gtk!5945
2023-05-09 18:23:40 +00:00
Emmanuele Bassi
cdeeb3275a build: Internal tests must set GTK_COMPILATION
Otherwise they won't be able to use the appropriate function visibility
on Windows.
2023-05-09 19:01:21 +01:00
Emmanuele Bassi
9d68bebdd1 Minimize the amount of inclusions in public headers
Public headers should mainly include gdktypes.h, which already include
the symbol visibility and versioning macros; we can also modify
gdktypes.h to include the enumerations.
2023-05-09 17:36:59 +01:00
Matthias Clasen
526ddfa866 Merge branch 'wip/otte/sections' into 'main'
Add GtkSectionModel

See merge request GNOME/gtk!5818
2023-05-09 16:36:55 +00:00
Matthias Clasen
d7b9d35c02 Use #pragma once
We switched over to using #pragma once, so lets
use it consistently, in generated headers as well.
2023-05-09 16:43:35 +01:00
Matthias Clasen
383c404792 Drop the gdk/gdkversionmacros.h header
It was just added to avoid touching too many files.
Touching them now.
2023-05-09 16:43:35 +01:00
Emmanuele Bassi
33d0cfd4f8 demos: Drop symbol visibility macros from demo types
Since the corresponding source files do not include "config.h", and are
not compiled with `GTK_COMPILATION`, they will generate the wrong symbol
exporting under Windows.
2023-05-09 16:43:35 +01:00
Emmanuele Bassi
43311f3a80 build: Minor style nitpicks 2023-05-09 16:43:35 +01:00
Emmanuele Bassi
265bc90524 build: Use Meson's gnu_symbol_visibility
Instead of injecting `-fvisibility=hidden` depending on a compiler check
ourselves, let Meson do it for us.

This also avoids us having to filter `-fvisibility=hidden` when reusing
the common compiler flags.
2023-05-09 16:43:25 +01:00
Matthias Clasen
197d921347 Add a missing file 2023-05-09 16:43:25 +01:00
Matthias Clasen
3d5529760a Fix install location 2023-05-09 16:43:25 +01:00
Matthias Clasen
3a2c4be44b Use GTK_COMPILATION throughout
It is a bit ugly that it doesn't fit the neat
namespace schema, but it is what we use everywhere.
2023-05-09 16:43:25 +01:00
Matthias Clasen
e216f469a1 Don't excessively define GDK_EXTERN
Once is enough.
2023-05-09 16:43:25 +01:00
Matthias Clasen
5ae25519a7 Make it build
Fix the circular dependency by moving the generated
headers to gdk/version/, and build that directory
first.

Misc other fixes, such as putting the custom targets
as sources, not depedencies, and using the correct
major version in the generator script.
2023-05-09 16:43:25 +01:00
Emmanuele Bassi
4d1f7a476d Generate version and deprecation macros at build time
Let's poach the same script used by GLib to avoid having to add all the
version macros by hand every time we increment the GTK version.

This is a work in progress:

- need to rename the GLIB_STATIC_COMPILATION check
- circular dependency: libgtkcss depends on gdkversionmacros.h, but libgdk
  depends on libgtkcss
2023-05-09 16:43:25 +01:00
Benjamin Otte
a959fba18a Merge branch 'wip/otte/no-vsync' into 'main'
Add GDK_DEBUG=no-vsync

See merge request GNOME/gtk!5944
2023-05-09 15:16:43 +00:00
Benjamin Otte
c88ac79437 listview: Make inertness not depend on factory
The inertness concept introduced in 62e9d1e470 assumed a listview was
inert when no factory was set. This has 2 problems:

1. columnview uses a listview without factories.

2. header factory being set but factory not being set technically makes
   the listiew inert - but should it?

So for now, make inertness only depend on visibility and root.
A side benefit is that this matches columnview semantics.
2023-05-09 17:03:35 +02:00
Benjamin Otte
ddefbfa8b5 gtk-demo: Add alternative settings demo
This one displays a long list of all settings with sections and allows
filtering the list to quickly search for keys.
2023-05-09 17:03:35 +02:00
Benjamin Otte
435a405c55 gtk-demo: Split out code from the settings demo
I want to add another demo using settings and share relevant code.
2023-05-09 17:01:20 +02:00
Benjamin Otte
e1ed9f10c6 theme: Add some random CSS for section headers 2023-05-09 17:00:40 +02:00
Benjamin Otte
46adfbef4f listitemmanager: Create header items for sections
Now, finally, listitemmanager has all the necessary support to make
section headers work.
2023-05-09 17:00:40 +02:00
Benjamin Otte
53bfcf7f0a listview: GtkListHeader and gtk_list_view_set_header_factory()
Adds infrastructure for handling factories for list headers.

For now, listitemmanager doesn't instantiate them, so they aren't used.
2023-05-09 17:00:40 +02:00
Benjamin Otte
76d601631d listitemmanager: Add GtkListItemChange
... for tracking widgets during changes.

This just pulls all the different disjointed parts into one struct with
a sensible API.
2023-05-09 17:00:40 +02:00
Benjamin Otte
38844fef4d listitemmanager: Add GtkListHeaderBase and vfuncs
This is plumbing for section handling.

The vfuncs don't do anything, this is just the infrastructure.
2023-05-09 17:00:40 +02:00
Benjamin Otte
03ac6611c1 listitembase: exit early
When update() is called but no values are changed, exit early.
2023-05-09 17:00:40 +02:00
Benjamin Otte
0ff88346cd listitemmanager: Make sections configurable
Add a gtk_list_item_manager_set_has_sections() (default: FALSE) that
requires explicit turning on for the listitemmanager to gain section
support.
2023-05-09 17:00:40 +02:00
Benjamin Otte
a73256e5c9 listitemmanager: Add/remove sections as needed
When ensuring widgets, ensure that their section is known. This will
be relevant when we use section widgets.

Also ensure that sections that don't cover any widget get destroyed.
2023-05-09 17:00:40 +02:00
Benjamin Otte
5d2605a151 testsuite: assert widgets are in matched sections
All widgets that we display should have their sections known, so assert
that that is the case.
2023-05-09 17:00:40 +02:00
Benjamin Otte
40a7ec73a9 testsuite: Add a print function for the listitemmanager
This is very useful when debugging.
2023-05-09 17:00:40 +02:00
Benjamin Otte
ccbe762103 listitemmanager: Add gtk_list_tile_get_next_skip()
... and gtk_list_tile_get_previous_skip() and use them.

Allows skipping over REMOVED and FILLER tiles which makes the code a lot
more readable.
2023-05-09 17:00:40 +02:00
Benjamin Otte
88d5c9a5e1 listitemmanager: Add gtk_list_tile_set_type() 2023-05-09 17:00:39 +02:00
Benjamin Otte
6df8eafc3a testsuite: Add verbose output to listitemmanager test 2023-05-09 17:00:39 +02:00
Benjamin Otte
8e69c5c89c listitemmanager: Properly handle sections during add/remove
We don't insert sections ourselves yet, but we handle the existing one
when items get added or removed.
2023-05-09 17:00:39 +02:00
Benjamin Otte
8bf6498265 listitemmanager: Augment header/footer info 2023-05-09 17:00:39 +02:00
Benjamin Otte
e680abc723 listitemmanager: Add section tiles
For now, we just have a HEADER at the start and a FOOTER at the end.
That's hard enough to get right.
2023-05-09 17:00:39 +02:00
Benjamin Otte
cecaede610 testsuite: Improve listitemmanager test
It now has trackers!
2023-05-09 17:00:39 +02:00
Benjamin Otte
81e7e67cef listitemmanager: Add tile types
We have a FILLER and a REMOVED type now.

Also makes gc() more sensitive to types.
2023-05-09 17:00:39 +02:00
Benjamin Otte
35543f60d9 listitemmanager: Add a type to tiles
There's only one type for now, but hey, you have to start somewhere.
2023-05-09 17:00:39 +02:00
Benjamin Otte
7856c52882 testsuite: Add tests for sections to filterlistmodel 2023-05-09 17:00:39 +02:00
Matthias Clasen
568023e6e6 Add a test for filterlistmodel sections 2023-05-09 17:00:39 +02:00
Matthias Clasen
cabb2625f5 filterlistmodel: Support sections
Propagate sections from the child model to
the filter model.
2023-05-09 17:00:39 +02:00
Benjamin Otte
5f64f1c8df sortlistmodel: add a fast path for get_section() 2023-05-09 17:00:39 +02:00
Benjamin Otte
41faddea40 testsuite: Add section tests to sortlistmodel test 2023-05-09 17:00:39 +02:00
Matthias Clasen
a09146df5a Add a test for sortlistmodel sections 2023-05-09 17:00:39 +02:00
Benjamin Otte
bd7ee3f3e1 sortlistmodel: Implement GtkSectionModel
The get_section() implementation is a slow and steady implementation
that has to be careful to not screw up when an incremental sort is only
partially sorted.
2023-05-09 17:00:39 +02:00
Benjamin Otte
ff6c5ad710 flattenlistmodel: Implement GtkSectionModel
Each child model is reported as one section.
2023-05-09 17:00:39 +02:00
Benjamin Otte
bd999c72c9 Implement GtkSectionModel for all selection models 2023-05-09 17:00:39 +02:00
Benjamin Otte
45c9e7aff4 Add GtkSectionModel
Prototyping the interface to be used for sections in listview, so people
can review and play with it.
2023-05-09 17:00:39 +02:00
Benjamin Otte
d24291db98 testsuite: Add a listitemmanager test 2023-05-09 17:00:39 +02:00
Matthias Clasen
661022f2eb Merge branch 'reftest-msvc' into 'main'
reftest-snapshot.c: Fix running reftests on Visual Studio

See merge request GNOME/gtk!5937
2023-05-09 14:48:18 +00:00
Matthias Clasen
168eb941a1 Merge branch 'inspect-a11y-bounds' into 'main'
Inspector accessibility pane improvements

See merge request GNOME/gtk!5941
2023-05-09 14:47:51 +00:00
Benjamin Otte
961a6c12ec wayland: Don't assert when requesting another frame
When GDK_DEBUG=no-vsync is on, we might have more than one outstanding
frame. Don't assert when that hapens. Just request a frame callback for
the first and skip the others.
2023-05-09 16:29:41 +02:00
Benjamin Otte
c227493c65 frameclock: Keep more history
Not all frames get timing info with GDK_DEBUG=no-vsync, so make sure
that even when we render tons of frames, the one frame that does get
timing info is still there when the timing info arrives.

I set it to 128 from 16 now.
This is roughly good enough to go to 5000fps from on a 60Hz monitor.
2023-05-09 16:29:41 +02:00
Benjamin Otte
30acf00bf8 gtk-demo: Update fps with higher priority
We want to make sure to always update it, so make sure it has a higher
priority than redraws.
2023-05-09 16:29:41 +02:00
Benjamin Otte
02e2a6f311 gdk: Add GDK_DEBUG=no-vsync
That turns off waiting and freezing in the frame clock and in
surfaces and triggers redraws asap.
2023-05-09 16:29:41 +02:00
Benjamin Otte
fa42e02a76 frameclock: Add gdk_frame_clock_idle_is_frozen()
This is in preparation for a future commit.

Also turn some macros into inline functions and pass the clock instead
of its priv pointer.
2023-05-09 16:29:37 +02:00
Matthias Clasen
c85b3a8d35 Merge branch 'fix-wgl' into 'main'
Few fixes for WGL after recent updates

Closes #5808

See merge request GNOME/gtk!5936
2023-05-09 12:51:29 +00:00
Matthias Clasen
285685044f Merge branch 'fix-gsk-crash' into 'main'
Fix a refcounting mishap in gsk

Closes #5823

See merge request GNOME/gtk!5943
2023-05-09 11:29:11 +00:00
Matthias Clasen
97bc4f77c6 gsk: Fix a refcounting mishap
This may fix #5823
2023-05-09 06:56:09 -04:00
Chun-wei Fan
0073ee29da gdkglcontext-win32-wgl.c: Always request alpha bits
...when we are using wglChoosePixelFormatARHB().  This ensures that we
hvae a HDC with a pixel format that will really support alpha bits, as
we did for the traditional ChoosePixelFormat().

Thanks to Patrick Zacharias for testing and pointing things out.
2023-05-09 18:15:23 +08:00
Benjamin Otte
e9ed5e21ef win32: Turn off multisampling
We know we draw beautiful Windows, but drawing them once is totally
enough.
2023-05-09 18:15:23 +08:00
Benjamin Otte
c37786af36 win32: Actually increase the counter
We were sending random junk to ChoosePixelFormat().

Also assert that we don't overflow the array. That might be usefu to
know if we carelessly add attributes later.
2023-05-09 18:15:23 +08:00
Chun-wei Fan
a7b09e19f1 GDK/Win32: Use dummy WGL contexts more
... for creating the actual WGL contexts, so that we can cut down on the
number of times where we need to create the base, legacy WGL contexts in
order to create the WGL contexts with attributes.  We could just use the
dummy context that we have to make it current to create the needed
WGL contexts.
2023-05-09 18:15:23 +08:00
Chun-wei Fan
50ef36d387 gdkglcontext-win32-wgl.c: Fix using wglChoosePixelFormatARB()
If we are querying the best supported pixel format for our HDC via
wglChoosePixelFormatARB() (i.e. we have the WGL_ARB_pixel_format extension),
it may return a pixel format that is different from the pixel format that we
used for the dummy context that we have setup, in order to, well, run
wglChoosePixelFormatARB(), which sadly requires a WGL context (HGLRC) to be
current in order to use it, which means the dummy HDC already has a pixel
format that has been set (notice that each HDC is only allowed to have its
pixel format to be set *once*). This is notably the case on Intel display
drivers.

Since we are emulating surfaceless GL contexts, we are using the dummy GL
context (and thus dummy HDC that is derived from the notification HWND used in
GdkWin32Display) for doing that, we would get into trouble if th actual HDC
from the GdkWin32Surface has a different pixel format set.

So, as a result, in order to fix this situation, we do the following:

* Create yet another dummy HWND in order to grab the HDC to query for the
  capabilities the GL drivers support, and to call wglChoosePixelFormatARB() as
  appropriate (or ChoosePixelFormat()) for the final pixel format that we use.
* Ditch the dummy GL context, HDC and HWND after obtaining the pixel format.
* Then set the final pixel format that we obtained onto the HDC that is derived
  from the HWND used in GdkWin32Display for notifications, which will become our
  new dummy HDC.
* Create a new dummy HGLRC for use with the new dummy HDC to emulate surfaceless
  GL support.
2023-05-09 18:15:23 +08:00
Luca Bacci
347561fa68 Merge branch 'fix-5808' into 'main'
gdkglcontext-win32-wgl.c: Fix WGL context realization on 32-bit

Closes #5808

See merge request GNOME/gtk!5942
2023-05-09 07:59:17 +00:00
Chun-wei Fan
d02ae09124 gdkglcontext-win32-wgl.c: Fix WGL context realization on 32-bit
We are currently using g_clear_pointer() on the intermediate WGL contexts
(HGLRC)'s that we need to create in the way, which means that we need to ensure
that the correct calling convention for wglDeleteContext() is being applied.

To be absolutely safe about it, use the gdk_win32_private_wglDeleteContext()
calls, which will in turn call wglDeleteContext() directly from opengl32.dll
(using the OpenGL headers from the Windows SDK) instead of going via libepoxy,
which will assure us that the correct calling convention is applied.

Fixes issue #5808.
2023-05-09 11:47:28 +08:00
Jason Francis
f3996a1a66 inspector: show GtkAccessible bounds in a11y pane 2023-05-08 21:33:04 -04:00
Jason Francis
1181ecbf0e inspector: hide a11y object path when not using AT-SPI backend 2023-05-08 21:31:21 -04:00
Benjamin Otte
d948ac62e4 Merge branch 'wip/otte/for-main' into 'main'
Revert "TEST TEST TEST"

See merge request GNOME/gtk!5940
2023-05-08 18:19:03 +00:00
Benjamin Otte
507e346ff1 Revert "TEST TEST TEST"
This reverts commit 97aff588d5.

That was a test commit for demonstrating things that shouldn't have made
it into main.

So throw it out again.
2023-05-08 19:51:08 +02:00
Emmanuele Bassi
98e6ed474f Merge branch 'new-align-value' into 'main'
filterchooser: Maintain filter combo visibility

See merge request GNOME/gtk!5939
2023-05-08 15:07:26 +00:00
Matthias Clasen
ade316eaee filterchooser: Maintain filter combo visibility
This code broke when it was ported to listmodels
since we always have a non-NULL lis model of filters.
It can just be empty.
2023-05-08 10:42:09 -04:00
Matthias Clasen
1e48843616 Merge branch 'new-align-value' into 'main'
Introduce GTK_ALIGN_BASELINE_FILL/CENTER

See merge request GNOME/gtk!5935
2023-05-08 13:28:15 +00:00
Matthias Clasen
58a5de6f5d testsuite: Handle duplicate enum values
Our notify tests would fall over if there was
a duplicate enum value (within the first 10 values).

Make it handle that, by skipping the duplicate value.
2023-05-08 07:00:34 -04:00
Chun-wei Fan
a9ca72695f reftest-snapshot.c: Fix running reftests on Visual Studio
On Visual Studio-like builds, shove a ".dll" suffix for the reftest
module so that we look for the correct DLL when running the tests.
2023-05-08 15:10:17 +08:00
Matthias Clasen
082ba6d7c8 Introduce GTK_ALIGN_BASELINE_FILL/CENTER
It turns out that the old behavior of GTK_ALIGN_BASELINE
was actually used in libadwaita, so bring it back, and
introduce a new GtkAlign value for the new behavior.
2023-05-07 21:26:09 -04:00
Matthias Clasen
61ff647f71 Merge branch 'node-editor-smarts' into 'main'
node-editor: Add some editor smarts

See merge request GNOME/gtk!5934
2023-05-07 13:59:42 +00:00
Matthias Clasen
823f56d263 Cleanup 2023-05-07 09:32:09 -04:00
Matthias Clasen
87332920d5 node-editor: Add some editor smarts
Allow control-clicks on some fields to bring up
a more specific UI. This functionality is also
available via Ctrl-E and the context menu.

At this point, it can edit colors, fonts and
files in some places, as well as a few enums.
2023-05-07 09:19:44 -04:00
Matthias Clasen
d2a358206c Fix a typo in the node format definition 2023-05-07 09:19:44 -04:00
Matthias Clasen
51ea08aa9c Merge branch 'wip/exalm/action-fixes' into 'main'
modelbutton: Fix a use after free when unsetting accel

See merge request GNOME/gtk!5933
2023-05-07 12:12:57 +00:00
Alice Mikhaylenko
380b63fede modelbutton: Fix a use after free when unsetting accel
gtk_widget_remove_controller() already destroys the controller.
2023-05-07 15:21:16 +04:00
Matthias Clasen
df93875c0c Merge branch 'matthiasc/for-main' into 'main'
rendernodeparser: Handle shader nodes better

See merge request GNOME/gtk!5930
2023-05-07 00:58:05 +00:00
Matthias Clasen
5a156e6b5f rendernodeparser: Handle shader nodes better
Avoid criticals when editing shader nodes in
the node editor.
2023-05-06 14:33:45 -04:00
Matthias Clasen
0e488b3dfe Merge branch 'headless-test-logging' into 'main'
ci: Improve headless test logging

See merge request GNOME/gtk!5929
2023-05-06 13:28:06 +00:00
Matthias Clasen
8495e0e412 Add a test for quick key events 2023-05-06 09:09:13 -04:00
Matthias Clasen
c9b0ca0de7 ci: Improve headless test logging 2023-05-06 09:02:25 -04:00
Benjamin Otte
2a950dec71 Merge branch 'wip/otte/update-texture' into 'main'
Add texture update regions

See merge request GNOME/gtk!5880
2023-05-06 00:59:25 +00:00
Matthias Clasen
d6c80d4f35 Merge branch 'tiled-states' into 'main'
Fix a corner-case in window states

Closes #5809

See merge request GNOME/gtk!5926
2023-05-05 23:58:08 +00:00
Matthias Clasen
e41cc99474 Merge branch 'wip/kabus/column-id-leak' into 'main'
gtk/columnviewcolumn: Fix id leak

See merge request GNOME/gtk!5927
2023-05-05 23:55:34 +00:00
Matthias Clasen
61fe5ac684 Handle the opposite case too
Just in case.
2023-05-05 19:40:42 -04:00
Khalid Abu Shawarib
1cf3f492b8 gtk/columnviewcolumn: Fix id leak
Add a free that was missing in commit 3e2b962a
2023-05-05 22:18:16 +00:00
Matthias Clasen
54fed96f8c Fix a corner-case in window states
Remove detailed tiled states when not tiled.

Fixes: #5809
2023-05-05 16:47:43 -04:00
Matthias Clasen
e2d659d5c2 Merge branch 'matthiasc/for-main' into 'main'
ci: Bump timeouts for headless tests

See merge request GNOME/gtk!5925
2023-05-05 20:34:39 +00:00
Matthias Clasen
8ad1189b0b ci: Bump timeouts for headless tests 2023-05-05 16:21:54 -04:00
Matthias Clasen
b5b7e1f2b4 Merge branch 'matthiasc/for-main' into 'main'
Add a masked variation to gsk tests

See merge request GNOME/gtk!5924
2023-05-05 20:12:12 +00:00
Matthias Clasen
e56a539363 Add a masked variation to gsk tests
This improves test coverage for mask nodes.
2023-05-05 15:05:08 -04:00
Matthias Clasen
5f91bb81ed Merge branch 'matthiasc/for-main' into 'main'
node-editor: Be a bit better about saving

See merge request GNOME/gtk!5923
2023-05-05 18:50:16 +00:00
Matthias Clasen
1fba59f1d1 node-editor: Be a bit better about saving
When we have a file, suggest it for saving.
This has the side benefit of giving us a test case
for gtk_file_dialog_set_initial_file.
2023-05-05 14:18:40 -04:00
Matthias Clasen
68a2ca7e85 Merge branch 'matthiasc/for-main' into 'main'
gsk: Add a few assertions

See merge request GNOME/gtk!5922
2023-05-05 17:48:14 +00:00
Matthias Clasen
93ccf08c81 ci: Bump timeouts of headless tests 2023-05-05 12:05:10 -04:00
Matthias Clasen
e9f5a3e9e2 gsk: Introduce a constant
We need this number in a couple of places,
so pull it out as a constant.
2023-05-05 12:05:10 -04:00
Matthias Clasen
2b85c49fb1 gsk: Add a few assertions
Make sure we don't overflow our fixed-size arrays.
2023-05-05 12:05:10 -04:00
Matthias Clasen
d7c3235cd0 gsk: Add some debug helpers 2023-05-05 12:05:09 -04:00
Matthias Clasen
ea94bac79e Merge branch 'better-masks' into 'main'
gsk: Avoid some offscreens

See merge request GNOME/gtk!5921
2023-05-05 15:56:16 +00:00
Matthias Clasen
63713c3b68 Merge branch 'fix-typo' into 'main'
gtkapplication-quartz: fix typo

Closes #5807

See merge request GNOME/gtk!5920
2023-05-05 15:39:46 +00:00
Matthias Clasen
81fd9741ff gsk: Better handling of offscreens
Take the scale into account for sizing the
offscreens for masks, blends and cross-fades.
2023-05-05 11:37:23 -04:00
Luca Bacci
c7523cecf1 gtkapplication-quartz: fix typo
Fixes #5807
2023-05-05 16:26:26 +02:00
Matthias Clasen
ce6569d1a6 gsk: Avoid some offscreens
We don't have to be too conservative when checking
if a rect is contained in a rounded rect, we have
a precise api for this.
2023-05-04 22:30:12 -04:00
Matthias Clasen
852f46df19 Remove a no longer building test 2023-05-04 20:53:15 -04:00
Matthias Clasen
d82f603fcb Merge branch 'smalltexture-plus-gles' into 'main'
Merge wayland_smalltexture and wayland_gles

See merge request GNOME/gtk!5917
2023-05-04 21:12:40 +00:00
Matthias Clasen
5e8e4130a5 Skip another failing gsk test with small textures 2023-05-04 15:36:57 -04:00
Matthias Clasen
f81aa14d93 Merge wayland_smalltexture and wayland_gles
We don't really need to have two full separate
test runs for these conditions, so combine them
into one test setup.
2023-05-04 15:13:09 -04:00
Matthias Clasen
81db6e9e61 Merge branch 'headless-tests' into 'main'
Get the headless monitor test to work in ci

See merge request GNOME/gtk!5915
2023-05-04 15:51:21 +00:00
Matthias Clasen
ac0311b621 ci: Mark headless monitor test as working 2023-05-04 11:39:35 -04:00
Matthias Clasen
f41e58d179 ci: Make run-docker run work
We want to have a writable volume and the same user
inside the container.
2023-05-04 11:38:55 -04:00
Matthias Clasen
d288931b45 More debug spew
Lets see what MUTTER_DEBUG=screen-cast says.
2023-05-04 11:38:55 -04:00
Matthias Clasen
03adeecfa3 Add generous waits
These tests work in the smae container locally.
Perhaps this is down to timing?
2023-05-04 11:38:55 -04:00
Matthias Clasen
5439f4596c Merge branch 'headless-tests' into 'main'
Add headless tests using mutter

See merge request GNOME/gtk!5908
2023-05-04 04:20:11 +00:00
Matthias Clasen
f98d1a6474 Mark the headless monitor test as failing
This is failing because I can't figure out
how to make wireplumber and pipewire work
in ci enough to let me add a new monitor :(

As usual, the test works fine locally.
2023-05-03 23:53:14 -04:00
Matthias Clasen
57e6aae80a Try to fix dnd tests 2023-05-03 23:27:09 -04:00
Matthias Clasen
f23eaafc85 Typo fix 2023-05-03 23:27:09 -04:00
Matthias Clasen
926b26e9fc headless tests: Add debug spew
Trying to track down what is going on with our
missing monitors.
2023-05-03 23:27:09 -04:00
Matthias Clasen
88f27c423c ci: Launch pipewire and wireplumber
The headless tests require pipewire and wireplumber
for screencast sessions to work. So launch them.
2023-05-03 23:27:09 -04:00
Matthias Clasen
30342896d0 Use python3
No /usr/bin/python in our CI image :(
2023-05-03 23:27:09 -04:00
Matthias Clasen
be8e203edc Make the headless input tests work
These needed some updates and workarounds.

They are now part of the testsuite and can
be run like this:

    meson test -Cbuild --suite headless
2023-05-03 23:27:09 -04:00
Matthias Clasen
623c93ccc8 Disable a11y for the headless tests
Otherwise, we go off activating things and end up
failing to launch systemd.
2023-05-03 23:27:09 -04:00
Matthias Clasen
34d8beaf4f Add a dnd test to the headless tests 2023-05-03 23:27:09 -04:00
Matthias Clasen
983b6ce341 Use headless mutter for input tests
Add some input tests that are using headless
mutter, and python with our in-tree gir files.

So far, test that we can roundtrip key events,
and move the pointer around.
2023-05-03 23:27:09 -04:00
Matthias Clasen
771df47820 Use headless mutter for monitor tests
Add some monitor tests that are using headless
mutter, and python with our in-tree gir files.

So far, we test that we get expected signals
when monitors are added and removed.
2023-05-03 23:27:09 -04:00
Matthias Clasen
3c218687e3 Merge branch 'ci-update-meson' into 'main'
ci: Use newer meson

See merge request GNOME/gtk!5914
2023-05-04 02:57:23 +00:00
Matthias Clasen
37fb370a5d ci: Remove the hack 2023-05-03 22:32:00 -04:00
Matthias Clasen
1cc9413383 ci: Use newer meson 2023-05-03 20:18:58 -04:00
Matthias Clasen
bfea39ab2f ci: Add meson back to the fedora image 2023-05-03 20:18:58 -04:00
Matthias Clasen
84d6f023b5 ci: Add pipewire-gstreamer too 2023-05-03 20:18:58 -04:00
Matthias Clasen
7fe04a7122 ci: Add pipewire to the image
And its buddy, wireplumber.

But we don't need gnome-desktop-testing
anymore, now that installed tests are gone.
2023-05-03 20:18:58 -04:00
Matthias Clasen
19cea99007 Merge branch 'matthiasc/for-main' into 'main'
ci: Stop running failing tests

See merge request GNOME/gtk!5913
2023-05-03 19:54:24 +00:00
Matthias Clasen
1c4ad78d52 Merge branch 'stop-running-failing-tests' into 'main'
ci: Stop running failing tests

See merge request GNOME/gtk!5912
2023-05-03 19:33:35 +00:00
Matthias Clasen
955a7e643e ci: Produce less terminal output
Pass --quiet to meson test.
Less is more, in this case.
2023-05-03 15:32:50 -04:00
Matthias Clasen
b85a137a68 Fix scan-build warning 2023-05-03 15:32:19 -04:00
Matthias Clasen
d17ca6b451 ci: Stop running the unstable test setups
This is just duplicating all our test runs,
for no discernible gain.
2023-05-03 15:11:53 -04:00
Matthias Clasen
da7040874e ci: Stop running failing tests
This makes the test output much harder to read,
and is just a waste of time.
2023-05-03 14:42:10 -04:00
Danial Behzadi
6f9c4c894d Update Persian translation
(cherry picked from commit 954011ef80)
2023-05-03 09:01:04 +00:00
Benjamin Otte
cc7a35cd30 Merge branch 'wip/otte/for-main' into 'main'
build: Use generated SPIR-V files

Closes #5798

See merge request GNOME/gtk!5910
2023-05-02 18:09:13 +00:00
Benjamin Otte
f841621348 css: Don't transition to currentColor
Transition to the color that is in use instead.

Fixes crashes because currentColor is not an RGBA color and
therefor could not be queried later.

Fixes #5798
2023-05-02 19:50:31 +02:00
Benjamin Otte
f99ecd3739 vulkan: Compute offscreen texture coords properly
Most of the time we want to compute them based on the child node we
render to the offscreen, but not always.
For blend and cross-fade nodes, they need to be computed based on the
node's bounds.

Fixes widget-factory page fade animation weirdly resizing the fading
pages.
2023-05-02 19:44:06 +02:00
Matthias Clasen
5eb7e550d1 Merge branch 'matthiasc/for-main' into 'main'
Expand gtk_init docs

Closes #5781

See merge request GNOME/gtk!5909
2023-05-02 17:42:29 +00:00
Matthias Clasen
8d33f2a511 Add a comment to pango.wrap
So we remember the next time we try to
switch to stable dependencies.
2023-05-02 13:18:49 -04:00
Matthias Clasen
27b0321dec Expand gtk_init docs
Make it clear that some aspects of GApplication
functionality happen before startup.

Fixes: #5781
2023-05-02 13:18:49 -04:00
Matthias Clasen
538605eccb Merge branch 'matthiasc/for-main' into 'main'
Don't build fribidi docs

See merge request GNOME/gtk!5906
2023-05-02 13:29:20 +00:00
Matthias Clasen
81f5967587 Make run-test.sh easier to use locally
Set a default timeout multiplier so we don't
have to rememver obscure environment variables.
2023-05-02 06:38:30 -04:00
Matthias Clasen
771437acf9 Go back to fribidi master
Fribidi 1.0.12 does not work as a subproject :(
2023-05-02 06:22:44 -04:00
Matthias Clasen
a3da58133e Don't build fribidi docs
There's no need for that. This matches what pango does.
2023-05-02 06:22:24 -04:00
Benjamin Otte
9b558b50b8 vulkan: Rebuild SPIR-V files
It's been a while since somebody last compiled them, glslc should be
somewhat newer by now.
2023-05-02 08:47:10 +02:00
Benjamin Otte
7ce2eeac47 build: Use generated SPIR-V files
We weren't looking in the build dir for generated files.

Actually make sure that we look in the build dir *first*, otherwise
glib-compile-resources will still use the wrong files.
2023-05-02 08:41:43 +02:00
Matthias Clasen
182dccb8f0 Use pango main as subproject
This is necessary to get the latest pango docs
built in ci.
2023-05-01 23:55:21 -04:00
Matthias Clasen
17d2ba94d6 stop using deprecated pango api 2023-05-01 23:49:42 -04:00
Matthias Clasen
5bac4f13a0 ci: Add mutter to the fedora image
This is in preparation for trying to use mutter --headless
in ci.
2023-05-01 21:11:01 -04:00
Benjamin Otte
97aff588d5 TEST TEST TEST
Add some random updates to the GL Area, so that funky testing can be
done with the GLArea and Gears gtk-demo.
2023-05-02 00:30:58 +02:00
Benjamin Otte
e4040adbe7 rendernode: Implement texture diffing for scale nodes 2023-05-02 00:30:58 +02:00
Benjamin Otte
6506a3bc9c texturebuilder: Add ::udpate-region and ::update-texture 2023-05-02 00:30:58 +02:00
Matthias Clasen
64f9d82506 Merge branch 'gsk-flip-tests' into 'main'
more gsk tests

See merge request GNOME/gtk!5811
2023-05-01 21:06:32 +00:00
Matthias Clasen
b83f3d871f Merge branch 'matthiasc/for-main' into 'main'
Cosmetics: Unset baseline too

See merge request GNOME/gtk!5904
2023-05-01 20:41:13 +00:00
Matthias Clasen
a235b59089 Skip some tests with small textures
When textures are too large, we will scale them down
to fit the max texture size, which will cause comparisons
to fail.
2023-05-01 16:29:45 -04:00
Benjamin Otte
1883035d34 texture: Add gdk_texture_diff()
... and use it in rendernodes.

Setting up textures for diffing is done via gdk_texture_set_diff() which
should only be used during texture construction.

Note that the pointers to next/previous are allowed to dangle if one of
the textures is finalized, but that's fine because we always check both
textures' links to each other before we consider the pointer valid.
2023-05-01 22:24:14 +02:00
Matthias Clasen
0ca6471df4 Cosmetics: Unset baseline too
We set width and height to 0 when unrealizing
a widget. No reason to let the baseline value
linger.
2023-05-01 16:15:11 -04:00
Matthias Clasen
98dde97f20 Merge branch 'better-switch-docs' into 'main'
switch: Expand the docs

See merge request GNOME/gtk!5903
2023-05-01 20:03:44 +00:00
Matthias Clasen
9bd9847b3f switch: Expand the docs
Add more text and explanation around active vs state,
since people seem easily confused by it.
2023-05-01 15:15:53 -04:00
Matthias Clasen
b79d4a3a22 gsk: Fix rendering big textures with offsets
When slicing the texture, the GL renderer was
forgetting to apply the viewport origin. This
shows up when rendering things with negative
scales, leading to negative origins.
2023-05-01 14:46:30 -04:00
Matthias Clasen
33ab588d4e Improve test coverage
Check that our two rounded rect intersection functions agree.
2023-05-01 13:58:42 -04:00
Matthias Clasen
7200a93a88 gsk: Give up on one test
The rounded-clip-in-clip-3d test fails in GL when
flipped. Given that it was already excluded from cairo,
and also fails cairo when flipped, give up on it for now.
2023-05-01 13:45:20 -04:00
Matthias Clasen
319762b908 gsk: Extract scales properly from 2D transforms
We have the code to do it properly.
2023-05-01 13:45:20 -04:00
Matthias Clasen
e453a989df Improve rounded rect intersection
Move the rounded rect/rect intersection code to
gskroundedrect.c, make it more precise, and add
tests for it.

Update the callers in the GL renderer.
2023-05-01 13:45:20 -04:00
Matthias Clasen
f56328a6cc gsk: Fix mask transform handling
We must reset the modelview transform when
offscreen, or else we end up applying
it twice.
2023-05-01 13:45:20 -04:00
Matthias Clasen
f29b24517e Add a test for rotated blend nodes 2023-05-01 13:45:20 -04:00
Matthias Clasen
552df197c4 gsk: Fix blend transform handling
We must reset the modelview transform when
rendering offscreen, or else we end up applying
it twice.
2023-05-01 13:45:20 -04:00
Matthias Clasen
f6e47b7eb0 Add a test for rotated cross-fade nodes
This one checks that we don't apply the modelview
transform twice with cross-fades.
2023-05-01 13:45:13 -04:00
Matthias Clasen
4214067d52 gsk: Fix cross-fade transform handling
We must reset the modelview transform when
rendering offscreen, or else we end up applying
it twice.
2023-05-01 13:44:55 -04:00
Matthias Clasen
d9a2b74b4a gsk: More fixes
Work towards handling negative scales and
denormalized rects everywhere.
2023-05-01 13:43:33 -04:00
Matthias Clasen
21df62f428 Add another test 2023-05-01 13:43:33 -04:00
Matthias Clasen
4e501d2d44 gsk: Transform rounded rects better 2023-05-01 13:43:33 -04:00
Matthias Clasen
5afd5cfec7 Add another gsk test 2023-05-01 13:43:33 -04:00
Matthias Clasen
ad65db901a gsk: Normalize rects in GLSL
Our coverage computation only works for well-behaved
rects and rounded rects. But our modelview transform
might flip x or y around, causing things to fail.

Add functions to normalize rects and rounded rects,
and use it whenever we transform a rounded rect in GLSL.
2023-05-01 13:43:33 -04:00
Matthias Clasen
406b1e2e03 testsuite: Fix gsk test
The repeated tests were not careful enough to produce
the correct reference image to match what the repeat
node does.

With these changes, all cairo tests pass.
2023-05-01 13:43:33 -04:00
Matthias Clasen
f1729affa8 testsuite: Add more gsk tests
Add separate suites for running the gsk compare-render
tests with the --flip, --rotate or --repeat options.
A bunch of these fail currently, and need diagnosis.
2023-05-01 13:35:35 -04:00
Matthias Clasen
3b2ba8ed99 Add more gsk tests
Add options to the gsk compare-render test for
modifying the node (and do a matching change to
the reference image).

flip: negative scale flipping things horizontally
rotate: 90 degree rotation
repeat: 2x2 grid
2023-05-01 13:35:35 -04:00
Matthias Clasen
386c3ac34f Add another transform test
Test that transforming bounds with negative scales
works as expected.
2023-05-01 13:35:22 -04:00
Matthias Clasen
d92c6406d1 Merge branch 'displaymanager-warning-fix' into 'main'
Avoid a bad warning

See merge request GNOME/gtk!5901
2023-05-01 16:56:40 +00:00
Matthias Clasen
d666f4ab7f Avoid a bad warning
This isn't what we intended, and it breaks CI for
various projects.
2023-05-01 10:40:26 -04:00
Georges Basile Stavracas Neto
5df360f436 Merge branch 'alatiera/vulkan-headers-fix' into 'main'
vulkan: Correct error enum version guards

See merge request GNOME/gtk!5900
2023-05-01 14:00:43 +00:00
Jordan Petridis
0197149ba3 vulkan: Correct error enum version guards
Vulkan 218 introduced these errors by they were marked as
the beta till version 238.

00671c64ba (diff-e222ae95c2b0d5082b94d6086fb1c24da18ee31384c1a39840df3b9152023ee6)

Followup to f9b2d3104a
2023-05-01 09:41:35 +03:00
Matthias Clasen
b310ab7304 Merge branch 'matthiasc/for-main' into 'main'
docs: Migration guide updates

See merge request GNOME/gtk!5899
2023-04-30 22:39:57 +00:00
Matthias Clasen
062e3da57d Merge branch 'emojichooser-variation-fix' into 'main'
emojichooser: Avoid extraneous variation selectors

See merge request GNOME/gtk!5898
2023-04-30 22:29:11 +00:00
Matthias Clasen
cdbd931dba docs: Migration guide updates
Mention various widget size apis going away.
2023-04-30 18:21:46 -04:00
Matthias Clasen
2f96a08b3f gsk: Plug a few memory leaks 2023-04-30 18:21:23 -04:00
Matthias Clasen
c1fc6c35cf emojichooser: Avoid extraneous variation selectors
Only add a variation selector if there isn't one already.
2023-04-30 11:56:43 -04:00
Daniel Boles
060992aeba migrating-3to4: Fix unescaped ptr * used as italic 2023-04-30 16:55:31 +01:00
Daniel Boles
2c15d563e2 gtk-demo/listbox: Fix 0 space between nick & date,
by restoring the right-alignment that gtk-3-24 has here, but we had lost
– I guess because we dropped the default child expand and pack-end props
2023-04-30 16:39:16 +01:00
Daniel Boles
2dd7ab2a50 Inscription|InfoBar: Fix small cosmetic issue@docs 2023-04-30 16:05:11 +01:00
Daniel Boles
0736fef585 Merge branch 'dboles/expander-css-nodes-doc' into 'main'
Expander: Clarify/format “CSS nodes” documentation

See merge request GNOME/gtk!5896
2023-04-30 11:37:55 +00:00
Daniel Boles
0442fc2b55 Expander: Clarify/format CSS nodes documentation
Use backticks to highlight the node names, mention the box, and clarify
that the arrow referred to in the last sentence is the `expander` node.
2023-04-30 11:56:07 +01:00
Matthias Clasen
27c621695e Merge branch 'deprecated-get-allocated-width' into 'main'
Deprecated get allocated width

See merge request GNOME/gtk!5894
2023-04-29 18:55:45 +00:00
Matthias Clasen
1a237ef6a8 Merge branch 'box-baseline-child' into 'main'
boxlayout: Add a baseline child property

See merge request GNOME/gtk!5891
2023-04-29 18:30:59 +00:00
Matthias Clasen
e7ba8e7e9a Deprecate gtk_widget_get_allocated_width 2023-04-29 14:30:21 -04:00
Matthias Clasen
14279785e6 tests: Stop using gtk_widget_get_allocated_width 2023-04-29 14:30:21 -04:00
Matthias Clasen
5b6f8d7002 gtk4-demo: Stop using gtk_widget_get_allocated_size 2023-04-29 14:30:21 -04:00
Matthias Clasen
71a752490a popover: Stop using gtk_widget_get_allocated_width 2023-04-29 14:30:21 -04:00
Matthias Clasen
3f4f37661c placesview: Stop using gtk_widget_get_allocated_width 2023-04-29 14:30:21 -04:00
Matthias Clasen
5bc5a6f2cd placessidebar: Stop using gtk_widget_get_allocated_width 2023-04-29 14:30:21 -04:00
Matthias Clasen
1a90724de9 columnview: Stop using gtk_widget_get_allocated_width 2023-04-29 14:30:21 -04:00
Matthias Clasen
f8f91095a3 Merge branch 'matthiasc/for-main' into 'main'
widget: Cosmetics

See merge request GNOME/gtk!5892
2023-04-29 18:29:14 +00:00
Benjamin Otte
6cc1548c5f Merge branch 'wip/carlosg/x11-artifacts' into 'main'
gdk/x11: Invalidate whole surface after size change

See merge request GNOME/gtk!5857
2023-04-29 18:11:21 +00:00
Matthias Clasen
30b12ff890 docs: Mention baselines
Add a paragraph about baselines to the coordinates overview.
2023-04-29 13:48:03 -04:00
Matthias Clasen
b9931e9573 widget: Cosmetics
Rename allocated_size_baseline to allocated_baseline,
to match better with the other allocated_ fields.
2023-04-29 13:47:51 -04:00
Matthias Clasen
cab8981c57 spinbutton: Use GtkBoxLayout:baseline-child
This makes it so that vertical spin buttons are
properly aligned to the baseline.
2023-04-29 13:28:55 -04:00
Matthias Clasen
b6786b8a49 Revert "spinbutton: Use a grid layout"
This reverts commit d648a7721e.
2023-04-29 13:28:55 -04:00
Matthias Clasen
2d9ae241d5 boxlayout: Add a baseline child property
In horizontal layout, we line up the baselines of all children to find
how much space we need above and below the box baseline.

In vertical layout, we need to pick one child to inherit the baseline
from, which is what the new GtkBoxLayout:baseline-child property is
about. It is the equivalent of GtkGridLayout:baseline-row.
2023-04-29 13:28:55 -04:00
Daniel Boles
a24a924a6b EventController: Fix type "even propagation"→event 2023-04-29 18:12:30 +01:00
Matthias Clasen
825eb93509 Remove more debug spew 2023-04-29 11:46:16 -04:00
Matthias Clasen
a8a0850b64 Merge branch 'matthiasc/for-main' into 'main'
entry: Ignore the baseline when centering

See merge request GNOME/gtk!5889
2023-04-29 14:16:42 +00:00
Matthias Clasen
03f388d099 widget: Don't set baselines when unused
When we are not doing baseline alignment, don't pass
a baseline to the allocated widget. This helps because
a number of widgets (GtkLabel, GtkEntry, etc) always
position their text on the given baseline.
2023-04-29 09:52:34 -04:00
Matthias Clasen
92205744d2 entry: Ignore the baseline when centering
GtkEntry was always placing its text on the baseline,
even when the valign said something else.
2023-04-29 09:52:34 -04:00
Matthias Clasen
f6f3a78dd9 Merge branch 'matthiasc/for-main' into 'main'
theme: Reinstate switch labels in hc

See merge request GNOME/gtk!5888
2023-04-29 12:27:23 +00:00
Matthias Clasen
76698e5de8 testbaseline2: Don't set height-requests
Widget with height requests have their baselines
ignored. Oops.
2023-04-29 08:01:11 -04:00
Matthias Clasen
21260e8ed4 theme: Reinstate switch labels in hc
Since we show them in GNOME shell, show them here too.

The comment that says "only show these in the a11y
theme" was still there, but we were always hiding them.
2023-04-29 08:01:03 -04:00
Carlos Garnacho
24302315fb gdk/x11: Invalidate whole surface after size change
The Expose events following a ConfigureNotify may arrive at
a time that we did not resize the surface yet, making these
expose events a no-op. Even though gsk/gtk take care of the
window content itself, this might lead to unrendered portions
of the window shadow.

This may be seen with GSK_RENDERER=cairo and GDK_BACKEND=x11,
attempting to tile a window (e.g. gtk4-demo) left or right.
The window will show black rectangles or other artifacts in
the window shadow areas that correspond to the newly painted
portions (as the window needs to expand vertically).

In order to fix this with a similar behavior to Wayland,
consider ourselves the whole surface invalidated after resize,
in order to ensure everything is painted from scratch.
2023-04-29 11:51:32 +02:00
Fabio Tomat
fc9642ce2a Update Friulian translation 2023-04-29 08:57:53 +00:00
Benjamin Otte
c542351a73 Merge branch 'wip/otte/for-main' into 'main'
wayland: Use wl_surface_damage_buffer() in Cairo

See merge request GNOME/gtk!5886
2023-04-29 03:43:45 +00:00
Benjamin Otte
3198330188 rendernode: Add diffing for affine transforms
This will be needed most importantly for inverted textures,
like in GLArea.
2023-04-29 05:10:51 +02:00
Benjamin Otte
11aaa29a69 wayland: Use wl_surface_damage_buffer() in Cairo
... when it is available.

Also introduce the new function gdk_rectangle_transform_affine(), which
looks like overkill for this purpose, but I'm about to use it elsewhere.
2023-04-29 05:07:03 +02:00
Matthias Clasen
d1a25178fd Merge branch 'matthiasc/for-main' into 'main'
shortcutswindow: Avoid criticals

See merge request GNOME/gtk!5885
2023-04-29 01:15:58 +00:00
Matthias Clasen
092745161c shortcutswindow: Avoid criticals
No point in resetting accessible relations
when we are in finalize.
2023-04-28 20:44:18 -04:00
Matthias Clasen
0da4a92298 Merge branch 'clarify-swapped-default-object-signal' into 'main'
builder: Clarify default "swapped" value when "object" is set for signals

See merge request GNOME/gtk!4514
2023-04-28 23:00:31 +00:00
Matthias Clasen
8b816d3b03 Merge branch 'gtkshortcutswindow_a11y' into 'main'
GtkShortcutsWindow: Allow a screen reader user to browse the available shortcuts

See merge request GNOME/gtk!5042
2023-04-28 22:57:10 +00:00
Matthias Clasen
63b50f48a9 Merge branch 'harmonize-would_drop' into 'main'
Harmonize would_drop() replacement for g_log_writer_default_would_drop()

See merge request GNOME/gtk!4935
2023-04-28 22:55:42 +00:00
Matthias Clasen
8b91762c42 Merge branch 'deprecate-get-allocation' into 'main'
Deprecate get allocation

See merge request GNOME/gtk!5882
2023-04-28 22:49:42 +00:00
Matthias Clasen
01f39d8522 README: Updates
Drop the section that talked about main and how to update
local checkouts - its been 2 years, people should have gotten
around to it by now. Add some general git hints instead.
2023-04-28 17:31:12 -04:00
Benjamin Otte
e94416054c Merge branch 'wip/otte/for-main' into 'main'
Fix hangs on Wayland

Closes #5761

See merge request GNOME/gtk!5884
2023-04-28 21:22:12 +00:00
Benjamin Otte
b4c859c011 wayland: Set EGL swap interval to 0.
There's no need for EGL to do any timing, we do it in GTK already.

This fixes hangs in Mesa when we hide a surface after a SwapBuffers()
but before the frame callback arrives.
If we then reshow the surface and immediately render to it, Mesa would
still have a frame callback from before the hiding and forever poll()
waiting for the compositor to send the callback.

Fixes #5761
2023-04-28 22:40:39 +02:00
Benjamin Otte
45216e1c88 wayland: Disconnect the frame callback when hiding
Do not leave spurious frame callbacks around wen hiding surfaces.
Instead, store the callback and remove it.
2023-04-28 22:21:42 +02:00
Daniel Boles
7bea2685e1 migrating-3to4: Don't mention removed Box method &
donʼt mention its renamed successor either, as that has its own section
later. We could have another sentence paragraph like ‘In the case of
GtkBox, the pack methods have been renamed to X and lost the trailing
arguments Y’, but that wonʼt help people prepare still on GTK3, which is
the point in the affected section… so just remove the misleading relic.
2023-04-28 21:14:37 +01:00
Matthias Clasen
b7d1774c56 Merge branch 'matthiasc/for-main' into 'main'
Cosmetics

See merge request GNOME/gtk!5883
2023-04-28 20:09:17 +00:00
Matthias Clasen
3afd91ea06 Updates 2023-04-28 16:02:18 -04:00
Matthias Clasen
d7dd6ca552 Cosmetics 2023-04-28 15:36:37 -04:00
Matthias Clasen
9c40e8b873 Deprecate gtk_widget_get_allocated_baseline 2023-04-28 15:26:16 -04:00
Matthias Clasen
b201d66981 Stop using gtk_widget_get_allocated_baseline
Use gtk_widget_get_baseline instead.
2023-04-28 15:25:58 -04:00
Matthias Clasen
3ea289751d Add gtk_widget_get_baseline
This is just a renaming of gtk_widget_get_allocated_baseline
that fits better with gtk_widget_get_width/height.
2023-04-28 15:18:13 -04:00
Matthias Clasen
8205c7032a Deprecate gtk_widget_get_allocation 2023-04-28 15:05:39 -04:00
Matthias Clasen
ba379c928b flowbox: Use deprecation guards around get_allocation 2023-04-28 15:05:39 -04:00
Matthias Clasen
5306ef12f4 inspector: Show bounds instead of allocation 2023-04-28 15:05:39 -04:00
Matthias Clasen
be62147dee scrolledwindow: Stop using gtk_widget_get_allocation 2023-04-28 15:05:39 -04:00
Matthias Clasen
627ce3d447 textutil: Stop using gtk_widget_get_allocation 2023-04-28 15:05:39 -04:00
Matthias Clasen
79119e64f9 tetview: Stop using gtk_widget_get_allocation 2023-04-28 15:05:39 -04:00
Matthias Clasen
37b2b3cb83 text: Stop using gtk_widget_get_allocation 2023-04-28 15:05:39 -04:00
Boyuan Yang
731c1be9e0 Update Chinese (China) translation 2023-04-28 18:51:56 +00:00
Benjamin Otte
76777cdd18 Merge branch 'wip/otte/texturebuilder' into 'main'
Add GdkGLTextureBuilder

See merge request GNOME/gtk!5862
2023-04-28 15:58:10 +00:00
Matthias Clasen
bdec7782b4 Merge branch 'baseline-fixes' into 'main'
boxlayout: Fix baselines a bit

See merge request GNOME/gtk!5879
2023-04-28 14:40:57 +00:00
Matthias Clasen
55f5edffd1 More docs for BASELINE
Add some more details to the docs for GTK_ALIGN_BASELINE.
2023-04-28 09:21:15 -04:00
Matthias Clasen
bb961d062a widget: Handle baseline better
When adjusting allocations, treat BASELINE more like CENTER
than like FILL. The results are better, in particular for
controls like entries or switches, which we never want to
scale up vertically, but still want to align to the baseline.
2023-04-28 09:13:49 -04:00
Matthias Clasen
38ffd099eb image: Simplify baseline handling
We guarantee that the out arguments of the measure
vfunc are non-NULL, no need to check.
2023-04-28 09:12:22 -04:00
Matthias Clasen
12af75df9b switch: Fix up baseline handling
We need to report a baseline for baseline alignment
to work...
2023-04-28 08:52:05 -04:00
Matthias Clasen
d648a7721e spinbutton: Use a grid layout
A grid layout lets us get the baseline right in
vertical orientation, by setting a baseline row.

It would be nice if the box layout supported this
as well, but currently it doesn't, and adding that
feature isn't trivial.
2023-04-28 08:50:12 -04:00
Matthias Clasen
e187587643 boxlayout: Fix baselines a bit
When we are not doing height-for-width, we still
need to line up baselines.
2023-04-28 08:50:12 -04:00
Matthias Clasen
3766f1da8b Add another baseline test client 2023-04-28 08:50:12 -04:00
Matthias Clasen
92a9f8cd7e gldriver: Add a sync when creating textures 2023-04-28 06:23:45 +02:00
Matthias Clasen
b9a7e5fa85 gstreamer: Defer the sync
Don't sync right when we receive the buffer,
pass it along with the texture to be executed
later in the renderer.
2023-04-28 06:23:45 +02:00
Matthias Clasen
bec0afa61b glarea: Synchronize
Create a fence object and pass it along when
creating the GL texture, so that the GL renderer
can wait for the texture to be ready.
2023-04-28 06:23:40 +02:00
Matthias Clasen
bedc3dba7e filechooser: Plug a memory leak 2023-04-27 13:42:03 +02:00
Matthias Clasen
7c4acac135 Add some more valgrind suppressions 2023-04-27 13:42:03 +02:00
Matthias Clasen
0bb6988c0e columnview: Plug a memory leak
g_list_model_get_item strikes again.
2023-04-27 13:42:03 +02:00
Matthias Clasen
df3622b295 filechooser: Plug a memory leak
We own references to the columns. Drop them.
2023-04-27 13:42:03 +02:00
Matthias Clasen
df9f3fc694 filechoosernative: Plug a memory leak
Unref all the GVariants.
2023-04-27 13:42:03 +02:00
Matthias Clasen
39b3b2444b filedialog: Plug a memory leak
We own a reference to the native dialog,
and we need to drop it when we're done.
2023-04-27 13:42:03 +02:00
Matthias Clasen
c237643b24 node-editor: Plug a memory leak 2023-04-27 13:42:03 +02:00
Matthias Clasen
cc682a96d9 notebook: Drop an unused variable 2023-04-27 13:42:03 +02:00
Matthias Clasen
051b463c9a Fix various bitfield warnings
clang rightly complains about using gboolean
as type for bitfields, since it is signed.
Avoid that.
2023-04-27 13:42:03 +02:00
Matthias Clasen
8292b846d5 gsk: Synchronize when using textures
Pass the GLsync object from texture into our
command queue, and when executing the queue,
wait on the sync object the first time we
use its associated texture.
2023-04-27 06:57:02 +02:00
Matthias Clasen
6efaa79e3c gltexture: Synchronize when downloading
If the GL texture has a sync object, wait
on it before downloading the data.
2023-04-27 06:57:02 +02:00
Matthias Clasen
92eb845482 gltexture: Optionally take a sync object
Add a new function to TextureBuilder that takes a GLsync that
requires internal code to wait on before using the texture.

Somewhat sneakily, we don't take the sync if syncs are not supported by
the current GL context.
As public API has no code to query the sync for the destroy notify, this
is fine and it means we don't have to do the check every time we want to
call gdk_texture_get_sync() internally.
2023-04-27 06:55:37 +02:00
Matthias Clasen
5071e6154c glcontext: Add a way to check for GLsync 2023-04-27 06:54:49 +02:00
Benjamin Otte
18a4b2475e gltexture: Deprecate gdk_gl_texture_new()
Use GdkGLTextureBuilder instead.
2023-04-27 06:40:47 +02:00
Benjamin Otte
76e5fd0ece glrenderer: Port to GdkGLTextureBuilder 2023-04-27 06:40:47 +02:00
Benjamin Otte
fa44d258d0 media-gstreamer: Port to GdkGLTextureBuilder
This is a rudimentary port that does not take advantage of all the cool
new formats that we could support now.
2023-04-27 06:40:47 +02:00
Benjamin Otte
778979cf0e testsuite: Use GLTextureBuilder 2023-04-27 06:40:47 +02:00
Benjamin Otte
053a4d2e9d glarea: Port to GdkGLTextureBuilder 2023-04-27 06:40:47 +02:00
Benjamin Otte
aae7b2c8a8 texturebuilder: Pass the destroy notify to the build() function
This is more compatible with bindings that want to create per-object
callbacks and not have their callbacks reused over different build()
calls.
2023-04-27 06:40:47 +02:00
Benjamin Otte
e37fbaf13a texturebuilder: Add ::format and ::has-mipmap
We were trying to deduce that previously. Now we have explicit API
2023-04-27 06:40:47 +02:00
Benjamin Otte
e4f4cfaf14 gdk: Add GdkGLTextureBuilder
Building GL textures is complicated, so create an object to make them.

So far, this object just contains the functionality of
gdk_gl_texture_new(), but that will change in the future.
2023-04-27 06:40:47 +02:00
Matthias Clasen
9ae0a3865c Merge branch 'matthiasc/for-main' into 'main'
Fix the build with clang

See merge request GNOME/gtk!5876
2023-04-27 04:37:12 +00:00
Benjamin Otte
3b5a2d60c7 Merge branch 'wip/otte/gl-version' into 'main'
Make sure highest possible version GLContext is created

See merge request GNOME/gtk!5870
2023-04-27 00:39:19 +00:00
Benjamin Otte
9254ab8503 wgl: Improve error messages when GL init fails
In particular, we want to get the GL version, when the Windows box/VM
has an unsuitable GL implementation.

This is somewhat helpful in analyzing failures to bring up GL on
machines where users claim GL does work.
2023-04-27 02:19:25 +02:00
Benjamin Otte
d6afcee1e4 wgl: Create context during WGL initialization
This way, we can realize it and either print success information about
it or return NULL if that fails.

This makes it more likely that we fail early, which means we can then
initialize EGL.
2023-04-27 02:16:46 +02:00
Benjamin Otte
c71ca481c1 win32: Get rid of display->gl_version
We can just query the display's GL context.

And it's not used otherwise anymore.
2023-04-27 02:13:33 +02:00
Benjamin Otte
8ef38c46b5 win32: Refactor context creation
This refactor achieves the following:

 * check GL version against proper matching context version
   In particular, for legacy contexts, we now actually check
 * make sure the actual version is set, even for legacy contexts
 * make sure set_is_legacy() is set properly
2023-04-27 02:13:33 +02:00
Benjamin Otte
4333d754b8 gdk: Add workaround for Visual Studio
apparently casting something to itself makes it not constant.
2023-04-27 02:13:33 +02:00
Benjamin Otte
9f82d537b0 mac: Properly set GLContext.is_legacy() 2023-04-27 02:13:32 +02:00
Benjamin Otte
7c7a3d67ca glcontext: assert all contexts set the version on realize()
Now that all contexts do that, insist that they keep doing it.

And because they keep doing it, we can support querying the GL version
from gdk_gl_context_get_version() without requiring the context to be
made current.
2023-04-27 02:13:32 +02:00
Benjamin Otte
d33b82249b mac: Try all different OpenGL profiles
.. and pick the best one that is supported.

Also make sure that the resulting context has at least the desired
version, otherwise bail.
2023-04-27 02:13:32 +02:00
Benjamin Otte
5f833f1d31 glcontext: Compute matching version the simple way
Do it all in one function instead of requiring two different ones.
2023-04-27 02:13:32 +02:00
Benjamin Otte
b8958419e6 win32: Make sure highest possible GL version is created
Mirror EGL here.
2023-04-27 02:13:32 +02:00
Benjamin Otte
919c90182f win32: Pass the version properly through the creation stack
We were using major/minor instead of GdkGLVersion.

And we were resetting back to 0 and ignoring the required min version
which we should not do.
2023-04-27 02:13:32 +02:00
Benjamin Otte
ab2a548479 glx: Make sure highest possible GL version is created
Mirror EGL here.
2023-04-27 02:13:32 +02:00
Benjamin Otte
34662fc4b0 egl: Make sure highest possible GL version is created
The EGL spec states:

    The context returned must be the specified version, or a later
    version which is backwards compatible with that version.
    Even if a later version is returned, the specified version
    must correspond to a defined version of the client API.

GTK has so far been relying on EGL implementations returning a
later version, because that is what Mesa does.
But ANGLE does not do that and only provides the minimum version, which
means Windows EGL has been forced to use a lower EGL version for no
reason.

So fix this and try versions in order from highest to lowest.
2023-04-27 02:13:32 +02:00
Benjamin Otte
5b376cedcf gdk: Move GdkGLAPI enum into gdkenums.h 2023-04-27 02:13:32 +02:00
Benjamin Otte
3aefed39b1 glcontext: Use GdkGLVersion elsewhere
... and add a convenience API to generate GL versions from strings to
make the gdk_gl_context_check() API nicer.
2023-04-27 02:13:32 +02:00
Benjamin Otte
f86429177a gdk: Introduce GdkGLVersion
... and use it.

Makes the code simpler.
2023-04-27 02:13:32 +02:00
Benjamin Otte
dacfed3e11 win32: Remove an outdated check
We require GL 3.0, so checking for less than 2.0 makes no sense anymore.
2023-04-27 02:13:32 +02:00
Matthias Clasen
8fb2ee7d67 Fix a crash
Fix an oversight from c87b193d2a.
2023-04-27 00:09:18 +02:00
Benjamin Otte
29e7186829 Merge branch 'wip/otte/treelistmodel-madness' into 'main'
treelistmodel: Be safer during collapsing

See merge request GNOME/gtk!5875
2023-04-26 22:06:40 +00:00
Matthias Clasen
951e3b3d6b Fix the build with clang
This broke our macos ci.
2023-04-26 23:54:43 +02:00
Benjamin Otte
3c76f3fb58 treelistmodel: Delay notifies from TreeListRow
Don't notify during destruction, notify afterwards.
This way we don't call into user code from a half-destructed node.

Note that this changes the order in which those notifies happen when
collapsing a large tree: From parent node before child nodes to child
nodes before parent node.

No actual use case for this, just thought it would be safer.
2023-04-26 23:40:56 +02:00
Benjamin Otte
8766a6fab2 treelistmodel: Be safer during collapsing
While we are collapsing a subtree, some signal handlers may not be
disconnected while we are doing this. By adding this check and not
giving those nodes no longer access to the model, we can stop it from
modifying it while we are trying to collapse stuff.

Fixes some crashes in gnome-builder.
2023-04-26 23:30:37 +02:00
Benjamin Otte
f52975c220 Merge branch 'wip/otte/surface-surgery' into 'main'
refactor internal surface API

See merge request GNOME/gtk!5846
2023-04-26 21:03:24 +00:00
Daniel Boles
abd4a57031 3to4: Fix we said we replace doubles with doubles,
when what we are replacing are ints!
2023-04-26 21:30:10 +01:00
Benjamin Otte
9d0448756f display: Remove ::create_surface() vfunc
Instead, have a toplevel_type and popup_type in GdkDisplay and
call g_object_new() with those types.
2023-04-26 21:03:34 +02:00
Benjamin Otte
03d7ce3287 wayland: Set default title in toplevel_init() 2023-04-26 21:03:34 +02:00
Benjamin Otte
f2083d36a1 macos: Add surface from ::constructed() 2023-04-26 21:03:34 +02:00
Benjamin Otte
cb642bec25 gdk: Remove GDK_SURFACE_DRAG enum member
I want to remove the whole enum, but this value was used all over the
place. So removing it first ensures I didn't forget anything.
2023-04-26 21:03:34 +02:00
Benjamin Otte
8c530264f7 wayland: Create drag surface directly
... instead of going through create_surface().
2023-04-26 21:03:34 +02:00
Benjamin Otte
d99042dd91 wayland: Remove struct member
It's unused.
2023-04-26 21:03:34 +02:00
Benjamin Otte
486196c979 x11: Add private gdk_x11_drag_surface_new()
... and use it.
2023-04-26 21:03:34 +02:00
Benjamin Otte
83faacabe3 x11: Set frame clock in ::constructed 2023-04-26 21:03:34 +02:00
Benjamin Otte
31aae62f9a x11: Move window construction to ::constructed() 2023-04-26 21:03:34 +02:00
Benjamin Otte
726be8e2b2 broadway: Create gdk_broadway_drag_surface_new()
... and use it.
2023-04-26 21:03:34 +02:00
Benjamin Otte
ab0fa08d8e win32: Create gdk_win32_draw_surface_new()
... and use it.
2023-04-26 21:03:34 +02:00
Benjamin Otte
42cea18f3e macos: Set frame clock in ::constructed 2023-04-26 21:03:34 +02:00
Benjamin Otte
44e54e1b4c broadway: Set frame clock in ::constructed
... instead of passing it to g_object_new().
2023-04-26 21:03:34 +02:00
Benjamin Otte
a79ae95e7e broadway: Move surface init code into ::constructed() 2023-04-26 21:03:34 +02:00
Benjamin Otte
77fe9116af win32: Set frame clock in constructed()
... instead of passing it as construct argument.
2023-04-26 21:03:34 +02:00
Benjamin Otte
808cde74be wayland: Construct the frame clock in the surface
... instead of passing it to g_object_new().
2023-04-26 21:03:34 +02:00
Benjamin Otte
13120ccf9d surface: Make gdk_surface_set_frame_clock() available
... to backends.

That way, frame clocks can be constructed by the backends' surface
implementations and dont need to be passed in as construct arguments.

Also add an assertion that they are indeed constructed.
2023-04-26 21:03:34 +02:00
Benjamin Otte
a306401023 macos: Move native window creation to ::constructed()
That way, it doesn't need a specific init function.

Also chain up last, so that the generic initialization code in
GdkSurface::constructed can access a fully initialized macos surface.
2023-04-26 21:03:34 +02:00
Benjamin Otte
7e18a1cea7 macos: Don't pass sizes to macos_surface_new()
They're 0, 0, 100, 100 always, so just use those values everywhere.
2023-04-26 21:03:34 +02:00
Benjamin Otte
9a6e6be785 macos: Create drag surface directly
Do not go via macos_surface_new().
2023-04-26 21:03:34 +02:00
Benjamin Otte
093a4e83d5 macos: Move construction stuff into ::constructed 2023-04-26 21:03:34 +02:00
Benjamin Otte
428798b53f macos: toplevels have no parent 2023-04-26 21:03:34 +02:00
Benjamin Otte
4fa81cf70f win32: Move surface init code into ::constructed() 2023-04-26 21:03:34 +02:00
Benjamin Otte
9ac31fe0a0 win32: Abort on error
Returning NULL from a function that must not return NULL is not a good
idea.
2023-04-26 21:03:34 +02:00
Benjamin Otte
69fabb3ce9 win32: Remove outdated debug messages
They are not needed anymore as they print stuff that's no decided in
that function anymore.
2023-04-26 21:03:34 +02:00
Benjamin Otte
f59c230a96 win32: Move toplevel signal into the toplevel class 2023-04-26 21:03:34 +02:00
Benjamin Otte
80d99b893e broadway: Pass parent as a construct argument 2023-04-26 21:03:34 +02:00
Benjamin Otte
cbe89b955a x11: Get rid of sizes when constructing surfaces
Just call XCreateWindow with 0, 0, 1, 1 size.
2023-04-26 21:03:34 +02:00
Benjamin Otte
2d827978a6 x11: Remove unused variable 2023-04-26 21:03:34 +02:00
Benjamin Otte
b2e304189e wayland: Move surface initialization into constructed()
That way, it doesn't ned a specific init function.

Also chain up last, so that the generic initialization code can access a
fully initialized wayland surface.
2023-04-26 21:03:34 +02:00
Benjamin Otte
35c2d85468 wayland: Move toplevel-specific code into the toplevel
The display->toplevels tracking belongs to GdkWAylandToplevel.
2023-04-26 21:03:34 +02:00
Benjamin Otte
7ef5f6ef1a display: Remove x/y/w/h from create_surface() 2023-04-26 21:03:34 +02:00
Matthias Clasen
9364da673f Merge branch 'application-signal-cleanup' into 'main'
application: Clean up signal handlers

See merge request GNOME/gtk!5872
2023-04-26 13:11:43 +00:00
Matthias Clasen
c87b193d2a application: Clean up signal handlers
This is the right thing to do and might help for #5775.
2023-04-26 14:15:31 +02:00
Matthias Clasen
045ab0f107 Merge branch 'win32-warnings' into 'main'
Fix some win32 warnings

See merge request GNOME/gtk!5868
2023-04-26 06:58:09 +00:00
Matthias Clasen
27d9023ac8 Merge branch 'pathbar-webdav-root' into 'main'
pathbar: Handle webdav where is the root is a path

Closes #2866

See merge request GNOME/gtk!5830
2023-04-26 06:50:10 +00:00
Matthias Clasen
8a82e1b8b4 Merge branch 'matthiasc/for-main' into 'main'
gsk: Don't misuse bitwise operators

See merge request GNOME/gtk!5869
2023-04-26 06:49:32 +00:00
Matthias Clasen
8e695f7c56 Merge branch 'modelbutton-no-click-outside' into 'main'
gtkmodelbutton: Ignore releases outside of the button

Closes #5760

See merge request GNOME/gtk!5852
2023-04-26 05:56:31 +00:00
Fran Dieguez
1f886668ce Update Galician translation
(cherry picked from commit 7470bc01f2)
2023-04-25 23:22:28 +00:00
Sebastian Keller
a678e9fdd9 gtkmodelbutton: Ignore releases outside of the button
This is also how regular buttons behave. Otherwise releasing on a
different menu item would register a click on the item that was
originally pressed. In these cases it is better to not register a click
at all.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5760
2023-04-25 19:28:42 +02:00
Matthias Clasen
74c0171edf gsk: Don't misuse bitwise operators
We should use && for booleans, not &=.
2023-04-25 16:43:02 +02:00
Matthias Clasen
248d13d8dc Merge branch 'matthiasc/for-main' into 'main'
gsk: Don't misuse bitwise operators

See merge request GNOME/gtk!5867
2023-04-25 12:48:13 +00:00
Marc-André Lureau
2d11d3f8d3 gtk/win32: fix usage of deprecated function
[106/939] Compiling C object gtk/libgtk.a.p/gtkimcontextime.c.obj
../gtk/gtkimcontextime.c: In function 'gtk_im_context_ime_set_preedit_font':
../gtk/gtkimcontextime.c:780:3: warning: 'gtk_widget_get_style_context' is deprecated [-Wdeprecated-declarations]
  780 |   font_desc = gtk_css_style_get_pango_font (gtk_style_context_lookup_style (gtk_widget_get_style_context (context_ime->client_widget)));

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-04-25 16:37:58 +04:00
Marc-André Lureau
ff9cd989c6 gdk/win32: fix defined but not used warnings
[30/1038] Compiling C object gdk/win32/libgdk-win32.a.p/gdkmain-win32.c.obj
../gdk/win32/gdkmain-win32.c:146:1: warning: 'gdk_win32_finalize_ole' defined but not used [-Wunused-function]
  146 | gdk_win32_finalize_ole (void)
      | ^~~~~~~~~~~~~~~~~~~~~~
../gdk/win32/gdkmain-win32.c:113:1: warning: 'gdk_win32_finalize_com' defined but not used [-Wunused-function]
  113 | gdk_win32_finalize_com (void)

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-04-25 16:37:58 +04:00
Marc-André Lureau
5b69df96fe gdk/win32: fix hr set but not used
A number of warnings are produced:

[23/1038] Compiling C object gdk/win32/libgdk-win32.a.p/gdkinput-dmanipulation.c.obj
../gdk/win32/gdkinput-dmanipulation.c: In function 'reset_viewport':
../gdk/win32/gdkinput-dmanipulation.c:354:11: warning: variable 'hr' set but not used [-Wunused-but-set-variable]
  354 |   HRESULT hr;
      |           ^~

Try to do something sensible instead.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-04-25 16:37:58 +04:00
Marc-André Lureau
d8ead56b9c gdk/win32: fix g_string_free warning
../gdk/win32/gdkclipdrop-win32.c: In function 'transmute_cf_shell_id_list_to_text_uri_list':
C:/msys64/ucrt64/include/glib-2.0/glib/gstring.h:72:5: warning: ignoring return value of 'g_string_free_and_steal' declared with attribute 'warn_unused_result' [-Wunused-result]

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-04-25 16:14:57 +04:00
Marc-André Lureau
0e2d7111eb gdk/win32: fix GDK_NOTE redefined warning
In file included from ../gdk/win32/gdkdrag-win32.c:201:
../gdk/win32/gdkprivate-win32.h:45: warning: "GDK_NOTE" redefined
   45 | #define GDK_NOTE(type,action)                             \
      |
../gdk/win32/gdkdrag-win32.c:40: note: this is the location of the previous definition
   40 | #define GDK_NOTE(a,b)

Fixes: bc159207bd ("gdk: Drop old debug macros")

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-04-25 16:11:11 +04:00
Matthias Clasen
2263db6259 gsk: Don't misuse bitwise operators
We should use || for booleans, not |=.
2023-04-25 13:45:37 +02:00
Matthias Clasen
ec318e911c Merge branch 'label_get_active_uri' into 'main'
Fix hovered link URI not returned by gtk_label_get_current_uri

See merge request GNOME/gtk!5864
2023-04-25 11:22:34 +00:00
Matthias Clasen
ed69435a1b Merge branch 'icontheme-has-icon-consistency' into 'main'
icontheme: make has_(g)icon consistent with lookup

Closes #5709

See merge request GNOME/gtk!5865
2023-04-25 07:49:12 +00:00
Matthias Clasen
e111f688c2 Merge branch 'null-display' into 'main'
gdkdisplaymanager: Add missing nullable to display name

See merge request GNOME/gtk!5866
2023-04-25 07:46:21 +00:00
Takao Fujiwara
26e3824d1d gdkdisplaymanager: Add missing nullable to display name 2023-04-25 12:08:08 +09:00
velsinki
e20a5e1bc1 icontheme: make has_(g)icon consistent with lookup
Make `gtk_icon_theme_has_icon` and `gtk_icon_theme_has_gicon` also
consider unthemed icons. This makes their behavior consistent with the
actual (documented) lookup behavior.

Fixes: #5709 and makes the workaround in nautilus@b643a00b obsolete
2023-04-24 23:38:20 +02:00
Chris Mayo
66cfeb3ad1 Fix hovered link URI not returned by gtk_label_get_current_uri
This is needed for a query-tooltip handler, as mentioned in the
documentation, when there has been a hover timeout.

Maintain the previous behaviour when the link is clicked and follow the
existing documentation regarding selectable labels.

A notify::cursor handler can now also be used to retrieve the URI of the
link under the cursor.
2023-04-24 19:35:47 +01:00
Matthias Clasen
63d7756658 Merge branch 'ebassi/button-can-shrink' into 'main'
Add GtkButton:can-shrink

See merge request GNOME/gtk!5552
2023-04-24 12:28:12 +00:00
Emmanuele Bassi
e28676869e Add GtkMenuButton:can-shrink
Map the GtkMenuButton property to the underlying GtkButton widget.
2023-04-24 11:09:01 +01:00
Sabri Ünal
fabfc1eefa Update Turkish translation 2023-04-23 21:12:44 +00:00
Benjamin Otte
72016341c6 Merge branch 'wip/otte/for-main' into 'main'
surface: Clean up drawing code

See merge request GNOME/gtk!5861
2023-04-22 15:10:02 +00:00
Benjamin Otte
104b5ef157 surface: reformat function
Make the function follow usual coding conventions.

And while doing that, remove duplicate functionality.
2023-04-22 16:35:16 +02:00
Benjamin Otte
893862a51a surface: Refactor code
Move the early exit conditions to the top and turn them into early exits
instead of nesting if statements.
2023-04-22 16:33:35 +02:00
Benjamin Otte
823eb4c6d9 surface: Fold function into its only caller
No other changes
2023-04-22 16:29:58 +02:00
Benjamin Otte
be0ed15b40 surface: Stop maintaining an unused linked list
wat?
2023-04-22 16:27:27 +02:00
Benjamin Otte
040af44b00 surface: Remove in_update tracking
It's 2023, we use frame clocks now and don't have nested surface drawing
anymore.
2023-04-22 16:24:16 +02:00
Benjamin Otte
4154f87418 surface: Stop tracking the active update area
It's unused.
2023-04-22 16:10:24 +02:00
Aleksandr Melman
27e3ac5fc5 Update Russian translation 2023-04-22 12:03:07 +00:00
Piotr Drąg
eaaddd2647 Update Polish translation 2023-04-22 11:16:24 +02:00
Matthias Clasen
6d0659a83a Merge branch 'gtkfilesystemmodel-emit-items-changed-on-modifying-attributes' into 'main'
filesystemmodel: Emit items-changed when modifying attributes

Closes #5758

See merge request GNOME/gtk!5853
2023-04-22 05:54:58 +00:00
Olivier Crête
0ce6bc677e filesystemmodel: Emit items-changed when modifying attributes 2023-04-22 05:54:57 +00:00
Matthias Clasen
b579a39a47 Merge branch 'wip/corey/file-chooser-signal' into 'main'
Port filechooserwidget to GtkSignalListItemFactory

See merge request GNOME/gtk!5858
2023-04-22 05:26:43 +00:00
Corey Berla
aeaaead2bd filechoosercell: Drop show-time property
Now that we are using GtkSignalListItemFactory, the convoluted show-time
property is no longer necessary.
2023-04-21 08:14:32 -07:00
Corey Berla
056237fc04 filechooserwidget: Port to GtkSignalListItemFactory
BuilderListItemFactory isn't quite suited for our purposes, primarily
because you can't pass user data to BuilderListItemFactory.  Because
we can't get the data we are using a workaround to get the
GtkFileChooserWidget ancestory, which used to work, but with the
recent list view changes no longer doesn't.  Use GtkSignalListItemFactory
with the GtkFileChooserWidget as the user data.
2023-04-21 08:14:32 -07:00
Corey Berla
1a7e808c27 Revert "filechooser: Set date and time after cell is a child of filechooserwidget"
This reverts commit 2a70093a30.

This fix was incomplete, the actual fix	is to use signal factory.
2023-04-21 08:14:24 -07:00
Corey Berla
3de47fa5c6 Revert "filechoosercell: Store type_format in filechoosercell"
This reverts commit dd407dab00.

This fix was incomplete, the actual fix is to use signal factory.
2023-04-21 08:14:14 -07:00
Hugo Carvalho
9f7c8f7d42 Update Portuguese translation
(cherry picked from commit 5bc3284dd8)
2023-04-21 14:30:55 +00:00
Yosef Or Boczko
feb3254a6a Update Hebrew translation 2023-04-21 09:10:12 +00:00
Benjamin Otte
03b71a9759 Merge branch 'wip/otte/for-main' into 'main'
testsuite: Be less verbose in accessor-apis test

Closes #5763

See merge request GNOME/gtk!5851
2023-04-20 21:50:44 +00:00
Benjamin Otte
f393f70ee2 listbase: Don't warn on scroll in empty list
Empty lists can still be scrolled if the scroll happens in the same
frame as the emptying of the list.

Related: #5763
2023-04-20 23:33:28 +02:00
Benjamin Otte
75c47755e3 adjustment: sanity-check values when setting them
It's not enough to sanitize values when starting an animation, as the
adjustment can reconfigure itself while the animation runs.
So as a simple way to handle this, we sanitize every value right before
setting it, too.

In the future we might also want to look at sanitizing start/end values
of the animation.

Fixes #5763
2023-04-20 23:33:28 +02:00
Benjamin Otte
e47c076048 adjustment: Split out a function 2023-04-20 23:33:28 +02:00
Matthias Clasen
6ecd57eba8 Merge branch 'dark_theme_fix_hover_toolbar_buttons' into 'main'
theme: fix 'hover' and 'check' colors for buttons under .toolbar

See merge request GNOME/gtk!5844
2023-04-20 20:08:31 +00:00
Matthias Clasen
8b3831d43a Merge branch 'dark_theme_increase_selection_color' into 'main'
Increase contrast for text entry selection color on dark theme

See merge request GNOME/gtk!5843
2023-04-20 20:08:01 +00:00
Benjamin Otte
39583e40ef testsuite: Allow accessors in interfaces
There are a lot of cases where properties are implemented in classes but
the getters for these exist in an interface that class implements.

A common Example is g_list_model_get_n_items() being the getter for
GtkWhateverListModel::n-items.
But also property implementations that don't use override_property()
(usually because they have a different default) are handled by this.
2023-04-20 17:47:54 +02:00
Benjamin Otte
be5f225022 testsuite: Be less verbose in accessor-apis test
Only print the tried names when --verbose is passed to the test.
2023-04-20 17:47:54 +02:00
Emin Tufan Çetin
427ed50759 Update Turkish translation 2023-04-19 13:22:31 +00:00
Matthias Clasen
9892243df6 Merge branch 'mask-node-transforms' into 'main'
Fix a comment

See merge request GNOME/gtk!5848
2023-04-19 07:44:45 +00:00
Matthias Clasen
83091c4f15 gsk: Use explicit switches
This makes it harder to forget to add new
node types here.
2023-04-19 09:19:12 +02:00
Matthias Clasen
503a5de7d1 gsk: Mask nodes support 2d transforms
When adding mask nodes, I overlooked that
we have two separate functions for determining
what transforms a node supports without offlines.

Since we claim that mask nodes support general
transform, they must certainly support 2d transforms
as well.
2023-04-19 08:13:55 +02:00
Matthias Clasen
d7d75f0b26 Fix a comment
I tried to improve things in d67101d46e,
but I made it worse. The original note was meant
to be removed. Pointed out be Sebastian Bacher.
2023-04-19 07:49:36 +02:00
Benjamin Otte
40ac37245d Merge branch 'angle-gles' into 'main'
gdk: prefer GLES when on win32/ANGLE

See merge request GNOME/gtk!5829
2023-04-17 11:56:03 +00:00
Marc-André Lureau
250414d6b3 gdk/win32: drop some unused variables
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-04-17 04:50:17 +00:00
Marc-André Lureau
d69cdf6c05 gdk: drop libangle GLES minimum version
GLES 2.0 version is fine now with current gtk according to B. Otte.
Let's use the same minimum requirement for all implementations.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-04-17 04:50:17 +00:00
Marc-André Lureau
9532657fa2 gdk: use GLES when on win32/ANGLE
When using GDK_DEBUG=gl-egl, we end up using GL, but that is not well supported:

Creating EGL context version 3.0 (debug:no, forward:no, legacy:yes, es:no)
Created EGL context[0000000000000004]
OpenGL version: 0.0 (legacy)
* GLSL version: (NULL)
* Max texture size: -1059701680
* Extensions checked:
 - GL_KHR_debug: no
 - GL_EXT_unpack_subimage: yes
 - OES_vertex_half_float: no

** (gtk4-demo.exe:14324): WARNING **: 19:16:41.468: Compile failure in
vertex shader:
ERROR: 0:7: 'gl_Position' : undeclared identifier
---8<---

Use GLES when EGL implementation is ANGLE.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-04-17 04:50:17 +00:00
Marc-André Lureau
3cb2115212 gdk: drop unused vertex_array_object
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2023-04-17 04:50:17 +00:00
Benjamin Otte
dd7c85adc3 Merge branch 'wip/otte/for-main' into 'main'
glrenderer: Don't try to use float framebuffers on GLES2

See merge request GNOME/gtk!5845
2023-04-17 04:49:59 +00:00
Benjamin Otte
8965d6c7f8 gl: Only allow RGB(A)8 on GLES2
GLES2 has no idea what 16bit textures even are, let alone floating point.
2023-04-17 05:57:44 +02:00
Benjamin Otte
d7309a009c glrenderer: Don't try to use float framebuffers on GLES2
GLES doesn't know what that is.
2023-04-17 05:57:44 +02:00
Nelson Benítez León
bd9b117517 theme: more contrast for text entry selection color on dark theme
Part of #5725
2023-04-16 16:33:54 -04:00
Nelson Benítez León
a309a56acf theme: fix 'hover' and 'check' colors for buttons under .toolbar
Buttons under .toolbar were using for their 'hover', 'active'
and 'check' colors the default ones from %button_basic_flat
which are very dimmed, so we explicitly darken them.

Part of #5725
2023-04-16 16:16:10 -04:00
Matthias Clasen
b6fac448d7 Merge branch 'matthiasc/for-main' into 'main'
Try harder to fix focus tests

See merge request GNOME/gtk!5842
2023-04-16 20:00:46 +00:00
Matthias Clasen
765f55dfbe testsuite: Skip focus tests when necessary
If our window does not get focus, we can't reliably
test things that depend on widgets being focused.
2023-04-16 20:58:26 +02:00
Matthias Clasen
bebaad3e1f Merge branch 'ccook/doc-changes' into 'main'
Two corrections that show up in docs

See merge request GNOME/gtk!5838
2023-04-16 18:16:36 +00:00
Matthias Clasen
db6a116d49 Try harder to fix focus tests
The focus test now asserts that its window is active.
So we should not run them in parallel with other tests,
since those might steal the focus.
2023-04-16 20:08:03 +02:00
Benjamin Otte
a299656c60 Merge branch 'wip/otte/alt.wl_surface.die.die.die' into 'main'
wayland: Don't leak all surfaces

See merge request GNOME/gtk!5840
2023-04-16 18:02:33 +00:00
Benjamin Otte
27fd0b907d testsuite: Fix broken test to not unref surfaces twice
The test doesn't hold 2 references, it holds only one.

The reason one unref can cause a leak is that some backends - like X11 -
only destroy the surface once the DestroyNotify event from the X server
has come in.
2023-04-16 19:28:21 +02:00
Benjamin Otte
62951c7277 wayland: Don't leak all surfaces
X11 does add an extra reference to surfaces that gets released when the
DestroyNotify event arrives.
Wayland doesn't ave such an event, so that reference never gets
released.

This fixes a copy/paste error introduced in commit 590f3dfa1f.
2023-04-16 19:28:21 +02:00
Benjamin Otte
8e00f6e5e5 wayland: Don't insta-crash when a surface gets disposed
We want to remove the event queue from the list of event queues, not the
surface.
Otherwise the freed queue stays in the list and the next time an event
comes in, we access invalid memory.

Fixes thinko introduced in commit 7fafa5133b.

Luckily, we leak all surfaces, so this problem never occured.
2023-04-16 19:28:21 +02:00
Matthias Clasen
ff141a1ed4 Merge branch 'ccook/gtklabel-doc-changes' into 'main'
GtkLabel doc corrections

See merge request GNOME/gtk!5839
2023-04-16 17:07:49 +00:00
Matthias Clasen
25a10f502e Merge branch 'focus-testsuite-fixes' into 'main'
text: Fix fallout from focus changes

See merge request GNOME/gtk!5841
2023-04-16 07:36:11 +00:00
Matthias Clasen
585fb497c1 testsuite: Actually wait for focus
We were failing to properly iterate the main
context here. Oops.
2023-04-16 09:11:24 +02:00
Matthias Clasen
c57e5811f1 tests: Check is-focus instead of has-focus
We are not presenting windows here.
2023-04-16 08:50:35 +02:00
Matthias Clasen
940a2b6923 text: Fix fallout from focus changes
We don't get proper notification for when the toplevel
is-active property changes, so monitor has-focus, and
update cursor blinking.
2023-04-16 08:49:20 +02:00
Cam Cook
3277e2ee3e | method | current | suggestion |
|---------------------------------------------------------------------------------------|-----------------------------------------------------------------|----------------------------------------------------------------------|
| [get_attributes](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklabel.c#L3242) | "use`pango_layout_get_attribute (gtk_label_get_layout (self))`" | "use`pango_layout_get_attributes (gtk_label_get_layout (self))`" [1] |
| [set_yalign](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklabel.c#L5897)     | "(attributes org.gtk.Method.get_property=yalign)"               | "(attributes org.gtk.Method.set_property=yalign)"                    |
| [get_yalign](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklabel.c#L5923)     | "(attributes org.gtk.Method.set_property=yalign)"               | "(attributes org.gtk.Method.get_property=yalign)"                    |
| [set_ellipsize](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklabel.c#L3892)  | "to ellipsizei"                                                 | "to ellipsize"                                                       |
| [get_attributes](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklabel.c#L3239) | "from the labels markup"                                        | "from the label's markup"                                            |

[1] https://docs.gtk.org/Pango/method.Layout.get_attributes.html
2023-04-15 21:48:27 -04:00
Cam Cook
3e8489fea5 | method | current | suggestion |
|-------------------------------------------------------------------------------------------------|------------------------------------------------------------|-----------------------------------------------------------|
| [Entry/set_invisible_char](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkentry.c#L2101) | "(attributes org.gtk.Method.sets_property=invisible-char)" | "(attributes org.gtk.Method.set_property=invisible-char)" |
| [FlowBox::activate](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkflowbox.c#L541)       | "This can be happen either by"                             | "This can happen either by"                               |
2023-04-15 12:41:13 -04:00
Cam Cook
1035640020 Revert "Two corrections and added method linking that show up in docs"
This reverts commit c7f30ecdfd.
2023-04-15 12:40:22 -04:00
Matthias Clasen
6cee73d100 Merge branch 'wip/otte/gles-fixes' into 'main'
GLES 2 fixes

See merge request GNOME/gtk!5837
2023-04-15 16:27:16 +00:00
Matthias Clasen
e4c43901c1 Merge branch 'matthiasc/for-main' into 'main'
window: Don't mark widget prematurely as has-focus

See merge request GNOME/gtk!5836
2023-04-15 16:09:32 +00:00
Cam Cook
c7f30ecdfd Two corrections and added method linking that show up in docs
| method                                                                                          | current                                                    | suggestion                                                |
|-------------------------------------------------------------------------------------------------|------------------------------------------------------------|-----------------------------------------------------------|
| [Entry/set_invisible_char](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkentry.c#L2101) | "(attributes org.gtk.Method.sets_property=invisible-char)" | "(attributes org.gtk.Method.set_property=invisible-char)" |
| [FlowBox::activate](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkflowbox.c#L541)       | "This can be happen either by"                             | "This can happen either by"                               |

| method                                                                                                    | current                                                | suggestion                                                   |
|-----------------------------------------------------------------------------------------------------------|--------------------------------------------------------|--------------------------------------------------------------|
| [Box/get_baseline_position](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkbox.c#L461)             | "value set by gtk_box_set_baseline_position()."        | "value set by [method@Gtk.Box.set_baseline_position]."       |
| [Box/get_spacing](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkbox.c#L412)                       | "value set by gtk_box_set_spacing()."                  | "value set by [method@Gtk.Box.set_spacing]."                 |
| [CenterBox/get_baseline_position](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkcenterbox.c#L528) | "value set by gtk_center_box_set_baseline_position()." | "value set by [method@Gtk.CenterBox.set_baseline_position]." |
| [Entry/get_activates_default](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkentry.c#L2296)        | "value set by gtk_entry_set_activates_default()."      | "value set by [method@Gtk.Entry.set_activates_default]."     |
| [Entry/get_alignment](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkentry.c#L2380)                | "value set by gtk_entry_set_alignment()."              | "value set by [method@Gtk.Entry.set_alignment]."             |
| [Entry/get_extra_menu](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkentry.c#L3727)               | "set with gtk_entry_set_extra_menu()."                 | "set with [method@Gtk.Entry.set_extra_menu]."                |
| [Entry/get_has_frame](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkentry.c#L2340)                | "value set by gtk_entry_set_has_frame()."              | "value set by [method@Gtk.Entry.set_has_frame]."             |
| [Entry/get_progress_pulse_step](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkentry.c#L3372)      | "set with gtk_entry_set_progress_pulse_step()."        | "set with [method@Gtk.Entry.set_progress_pulse_step]."       |
| [Fixed/get_child_transform](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkfixed.c#L314)           | "set using gtk_fixed_set_child_transform()."           | "set using [method@Gtk.Fixed.set_child_transform]."          |
2023-04-15 12:08:46 -04:00
Benjamin Otte
b64f7050ba testsuite: Make GLES testsuite run use GLES 2
We want to support GLES 2, so make sure we test that support.

Also force-disable common extensions we don't explicitly check for and
don't want to accidentally use.
2023-04-15 17:55:20 +02:00
Benjamin Otte
d37b9619e2 gles: Don't use vertex array objects
They're not needed and GLES doesn't technically support them, even
though GTK had been using them via epoxy sneakily using the
GL_OES_vertex_array_object extension behind our back.
2023-04-15 17:55:20 +02:00
Matthias Clasen
4a22e681b3 text: Only claim primary when focused
It does not make sense otherwise, and has unfortunate
side-effects on Wayland.
2023-04-15 15:02:52 +02:00
Matthias Clasen
189aced844 wayland: Improve logging for primary selection 2023-04-15 15:02:52 +02:00
Matthias Clasen
d90cb02570 window: Don't mark widget prematurely as has-focus
has-focus is defined is-focus && toplevel::is-active.
We were forgetting to look at is_active when handling
focus widget changes.
2023-04-15 14:58:57 +02:00
Matthias Clasen
4246c7bafd Merge branch 'better-snapshot-nodes-docs' into 'main'
gtk: Improve documentation on returned nodes for snapshot

Closes #5747

See merge request GNOME/gtk!5831
2023-04-15 10:51:39 +00:00
Matthias Clasen
d67101d46e Tweak the wording 2023-04-15 10:35:12 +00:00
Benjamin Otte
60f3cc398a Merge branch 'wip/otte/for-main' into 'main'
inspector: Don't randomly emit application signals

See merge request GNOME/gtk!5834
2023-04-15 03:40:00 +00:00
Benjamin Otte
e010cd242c listlistmodel: Add a cache
Cache the last looked up item and use it for looking up the next item if
it's closest. This massively speeds up iteration over the model, because
each call to get_item() will be adjacent to the previous one.

Improves performance of the inspector quite a bit.
2023-04-15 05:27:47 +02:00
Benjamin Otte
41454b63b4 testsuite: Add some more exhaustive testing to listlistmodel 2023-04-15 05:27:47 +02:00
Benjamin Otte
f458951745 inspector: Don't randomly emit application signals
When the variant-editor emits a callback, it might not actually have
edited the value in question. Try to detect that by only emitting
signals if the value changed.
2023-04-15 05:27:47 +02:00
Benjamin Otte
ef3793ec37 Merge branch 'gbsneto/vulkan-buffer-release' into 'main'
gsk/vulkan/render: Download image before reset

See merge request GNOME/gtk!5832
2023-04-14 23:28:55 +00:00
Georges Basile Stavracas Neto
94b1a78378 gsk/vulkan/render: Download image before reset
gsk_vulkan_render_download_target() currently resets the uploader
objects before downloading the image that it produces. This is
problematic because there might be unreleased buffers and images
in the command queue.

In particular, this can make validation layers complain about the
glyph atlas - of all things! - upload buffer being released while
still being used by the command queue.

Fix that by resetting the uploader after downloading the image.
2023-04-14 16:43:04 -03:00
Marco Trevisan (Treviño)
584fd36a5f gtk: Improve documentation on returned nodes for snapshot
Closes: #5747
2023-04-14 18:05:21 +02:00
Emmanuele Bassi
4ea818fee6 Add GtkButton:can-shrink
For certain kinds of layouts, especially ones where one or both sizes of
a top level is constrained by physical limits, it's acceptable to have
buttons that rely on the minimum size of their contents, rather than the
natural size. It is left to the application authors, or the localization
teams, to ensure that things like translations and font sizes do not
result in a broken UI.
2023-04-14 15:00:07 +01:00
Olivier Crête
c271cd1a3f pathbar: Handle webdav where is the root is a path
Our webdav server has a root which is davs://mynextcloud/remote.php/webdav
When once creates a GFile out of or out of a subdirectory, and one call
g_file_get_parent(), it recurses too far up and try to query
davs://mynextcloud/remote.php which fails, resulting in a broken pathbar.

To fix that, before querying the metadata of each element of the path,
I query the "enclosing mount", then use it's root to compare the GFile
against.

With the right GMount, we can also fix the icon drawing code in the
pathbar for network drives.
2023-04-13 17:54:57 -06:00
Matthias Clasen
64a1969293 Merge branch 'fix_scalebutton_orientation' into 'main'
ScaleButton: fix CSS name in documentation, fix orientation doing nothing

See merge request GNOME/gtk!5819
2023-04-13 20:44:23 +00:00
Matthias Clasen
2baab9732c Merge branch 'check-openuri-portal-version' into 'main'
openuriportal: Detect if the interface isn't there

Closes #5733

See merge request GNOME/gtk!5826
2023-04-13 20:44:03 +00:00
Georges Basile Stavracas Neto
8134daf843 Merge branch 'gbsneto/vulkan-mailbox' into 'main'
gdk/vulkancontext: Use more appropriate present mode

See merge request GNOME/gtk!5828
2023-04-13 17:07:59 +00:00
Georges Basile Stavracas Neto
9c013d40c1 gdk/vulkancontext: Use more appropriate present mode
Check if the driver supports MAILBOX and prefer using it; in its
absense, checkif the driver supports IMMEDIATE and prefer using
it; finally, if neither of them are supported, use the guaranteed
to be supported FIFO mode.
2023-04-13 13:54:45 -03:00
Benjamin Otte
d798372a53 Merge branch 'wip/otte/for-main' into 'main'
x11: Remove commented outdated code

See merge request GNOME/gtk!5827
2023-04-13 15:34:48 +00:00
Benjamin Otte
cfaf1b3e71 x11: Remove commented outdated code
... and it's copy/paste into the win32 backend
2023-04-13 17:15:35 +02:00
Benjamin Otte
9763d83a9d gdk: Remove unused vfunc 2023-04-13 17:15:35 +02:00
Benjamin Otte
5f82a496cb Merge branch 'wip/otte/wl-gloria-gaynor' into 'main'
wayland: Make wl_surface survive until surface is desstroyed

See merge request GNOME/gtk!5825
2023-04-13 15:12:07 +00:00
Matthias Clasen
0c35015c44 Merge branch 'wip/exalm/print-dialog' into 'main'
printunixdialog: Remove a redundant style class

See merge request GNOME/gtk!5823
2023-04-13 05:39:08 +00:00
Matthias Clasen
3da0572078 openuriportal: Detect if the interface isn't there
Check the portal version number before trying to use
it. Most importantly, this will detect the case where
the interface isn't supported at all, since the proxy
will report a version of 0 in that case.

Fixes: #5733
2023-04-13 07:24:38 +02:00
Matthias Clasen
c649d8a4ec Merge branch 'bilelmoussaoui/g-i' into 'main'
g-i: Fix GtkGLArea type name

See merge request GNOME/gtk!5824
2023-04-13 04:37:45 +00:00
Benjamin Otte
75bea01a86 wayland: Keep EGL window around when hidden
See previous commit:

We want to keep resources around as long as the surface exists.
2023-04-13 05:19:18 +02:00
Benjamin Otte
5d3cec5441 wayland: Don't destroy the wl_surface on hide()
We want to keep the wl_surface around, because surfaces create their
resources on construct and keep them until destroyed. See the HWND ond
Windows and the XWindow on X11.

This is relevant for graphics resources, where we want to have access
to the VkSurface and eglSurface while the GdkSurface is hidden.
We also want these surfaces to be permanent and not change during the
lifetime of the GdkSurface.

What we can - and must - destroy however are the xdg surfaces, because
those handle visibility on screen.
And we also need to ensure no buffer is attached, so that during the
next creation of the xdg surface we don't get a protocol error.
2023-04-13 04:23:35 +02:00
Benjamin Otte
891242920e wayland: Split out a function
We have a create_wl_surface(), create a matching destroy_wl_surface().
2023-04-13 02:56:12 +02:00
Benjamin Otte
b375f17f09 wayland: Remove useless function
gdk_wayland_surface_maybe_resize() just calls
gdk_wayland_surface_update_size(), so make all callers call that one
instead.

The check that it does is done by the other function again.
2023-04-13 02:48:47 +02:00
Benjamin Otte
ec69990126 wayland: Remove an old workaround
This workaround - were it ever to trigger - is broken today. It destroys
the wl_surface and all associated structs but does not recreate the
xdg_popup or xdg_toplevel struct, so it would cause a hidden window.

The workaround looked a lot different when it was introduced in commit
83b54bab57, too - both in what it did and
in what the vfuncs did that it called.
2023-04-13 02:44:05 +02:00
Bilal Elmoussaoui
aec5a5739e g-i: Fix GtkGLArea type name 2023-04-12 18:12:40 +00:00
Alexander Mikhaylenko
ac9e0039b8 printunixdialog: Remove a redundant style class
.view does absolutely nothing in Default style since the whole box is
covered with a GtkNotebook which has its own background, and adds an
unwanted background onto the tab strip in Adwaita.
2023-04-12 21:09:25 +04:00
Matthias Clasen
4574b21fd6 Merge branch 'dialogs-force-window-destruction' into 'main'
gtk/dialogs: Destroy the window promptly on finish async function

Closes #5741

See merge request GNOME/gtk!5820
2023-04-12 13:54:13 +00:00
Marco Trevisan (Treviño)
31c5961c4f gtk/dialogs: Destroy the window promptly on finish async function
Some bindings (GJS!) could add temporary references to the GAsyncResult
argument that we return, and thus to the GTask, which may cause the
dialog not to close when the finish function is called (but at garbage
collection instead!).

To prevent this, just manually destroy the window (by removing the task
data), so that we are not bound to the GTask lifetime anymore.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5741
2023-04-12 15:39:39 +02:00
Matthias Clasen
8fc3f06155 Merge branch 'filechooserentry-fixes' into 'main'
filechooserentry: Make filtering work again

Closes #5743

See merge request GNOME/gtk!5822
2023-04-12 10:38:04 +00:00
Matthias Clasen
5327203201 Merge branch 'wip/carlosg/multi-click-text-view' into 'main'
textview: Reset press counter if double/triple clicking on a different line

See merge request GNOME/gtk!5821
2023-04-12 10:11:16 +00:00
Matthias Clasen
8442fce962 Merge branch 'touch-no-double-click-threshold' into 'main'
gestureclick: Don't use threshold for touch

Closes #5580

See merge request GNOME/gtk!5798
2023-04-12 10:10:31 +00:00
Matthias Clasen
d8b46c16cc Merge branch 'stylus-fixes' into 'main'
gtk-demo: Test stylus-only mode

See merge request GNOME/gtk!5804
2023-04-12 10:10:11 +00:00
Matthias Clasen
4df7273266 filechooserentry: Plug a memory leak 2023-04-12 12:09:02 +02:00
Matthias Clasen
2b8fd89fd5 filechooserentry: Make filtering work again
We need to look at the filchooser::filtered-out
attribute to know which files the filesystem model
has filtered away.

Fixes: #5743
2023-04-12 12:08:43 +02:00
Carlos Garnacho
5b9a7863cf textview: Reset press counter if double/triple clicking on a different line
If we click close enough between lines, and with the maximum distances applied
by GtkGestureClick we could jump between lines when handling double/triple
click for word/line selection.

Ensure that the whole operation stays in the same line and reset the
gesture/counter if we do move between lines, so we start from scratch in the
new line.
2023-04-12 11:27:41 +02:00
G.Willems
d625ff8106 scalebutton: fix orientation not applied to scale 2023-04-11 23:54:06 +02:00
G.Willems
5ecd8a1c10 scalebutton: fix CSS name in documentation 2023-04-11 22:06:54 +02:00
Matthias Clasen
e9f7a9b8e6 Merge branch 'matthiasc/for-main' into 'main'
filechooser: Fix the gridview

See merge request GNOME/gtk!5817
2023-04-11 06:10:56 +00:00
Matthias Clasen
93b1130c07 filechooser: Fix the gridview
2a70093a30 was a bit overeager in its porting
to GtkColumnViewCell. The gridview needs to keep its
list items.
2023-04-11 07:41:09 +02:00
Matthias Clasen
db48cd6467 Merge branch 'wip/corey/file-chooser-widget' into 'main'
More fixes to filechooserwidget

See merge request GNOME/gtk!5815
2023-04-11 05:32:38 +00:00
Matthias Clasen
ba43a126b9 Merge branch 'wip/corey/filesystemmodel' into 'main'
filesystemmodel: Notify correct position removed in remove_file()

See merge request GNOME/gtk!5814
2023-04-11 05:27:24 +00:00
Corey Berla
2a70093a30 filechooser: Set date and time after cell is a child of filechooserwidget
The date/time column relies on the filechooserwidget to format the date
properly.  During bind, the filechoosercell, get the filechooserwidget
ancestor, but now due to changes in the listview, the cell isn't a
child of the filechooserwidget at that point.  Since this is deeply
ingrained into the filechooserwidget, let's keep the same behavior,
but move it to filechoosercell in realize.  Alternatively, we could have
used a signal factory (with the file chooser widget as the user data),
but that would have been a major overhaul.
2023-04-10 18:02:35 -07:00
Corey Berla
dd407dab00 filechoosercell: Store type_format in filechoosercell
The format of the type column depends on the the type_format, which
is stored in the filechooserwidget.  We get that setting by looking
for the filechooserwidget ancestor, which no longer works after recent
changes to the list views (it was fragile to begin with).  At one point,
the setting appears to have been dynamic, but now it is only loading
from GSettings, so let's simply do the same within FileChooserCell.
2023-04-10 18:02:35 -07:00
Corey Berla
ccae75022b filechooserwidget: Finish port to GtkColumnViewCell
Some missing updates from f5dea9a3c2
2023-04-10 18:02:24 -07:00
Corey Berla
faac2f7894 filesystemmodel: Notify correct position removed in remove_file()
32247bc50e made several changes to account for the
fact that we no longer have a NULL editable at the beginning of the list
model.  The commit mistakenly left out one change in remove_file(),
which causes the wrong file to be removed.
2023-04-10 12:56:08 -07:00
Matthias Clasen
d00b78d283 Merge branch 'matthiasc/for-main' into 'main'
node-editor: Typo fixes

See merge request GNOME/gtk!5812
2023-04-10 14:28:38 +00:00
Matthias Clasen
3eee1c0724 node-editor: Typo fixes
Fix some typos in the node format documentation.
2023-04-10 16:04:17 +02:00
Matthias Clasen
5e6bc681a3 Merge branch 'scrolled-window-critical' into 'main'
scrolledwindow: Avoid a critical

See merge request GNOME/gtk!5809
2023-04-10 05:50:20 +00:00
Matthias Clasen
87e16f3ad9 testsuite: Check widget properties better
Check that setting a property after resetting
it works. An instance of this was fixed in the
previous commit.
2023-04-10 00:24:57 -04:00
Matthias Clasen
aa9e83876d scrolledwindow: Avoid a critical
When setting the child property to NULL, we also need
to unset auto_added_viewport, to avoid triggering a
critical when setting it again.
2023-04-10 00:22:20 -04:00
Matthias Clasen
d8796b3075 Merge branch 'warn-show-destoyed-window' into 'main'
Show a warning when a destroyed window is shown

See merge request GNOME/gtk!5122
2023-04-09 20:16:52 +00:00
Matthias Clasen
cefd720789 Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Add a keyword

See merge request GNOME/gtk!5805
2023-04-09 13:02:55 +00:00
Matthias Clasen
d4a34b1a0b gtk-demo: Stop using gtk_widget_get_allocation 2023-04-09 08:38:14 -04:00
Matthias Clasen
b7f48b7763 gtk-demo: Add a keyword
Make the demo using the 'bluroverlay' come up when you type 'blur'.
2023-04-09 08:38:14 -04:00
Matthias Clasen
61a0d06310 Merge branch 'matthiasc/for-main' into 'main'
range: Fix a copy-paste error

See merge request GNOME/gtk!5803
2023-04-09 12:37:44 +00:00
Matthias Clasen
e12669e230 gesture stylus: Fix condition
Now that the paint demo lets us test this, it has
become apparent that this condition is wrong, and
we don't get the expected events if stylus-only is
FALSE.
2023-04-09 08:35:03 -04:00
Matthias Clasen
7f906bef06 gtk-demo: Work without stylus
In the paint demo, don't assume that the event
backlog contains pressure. It won't, if we are
working with a plain old mouse.
2023-04-09 08:35:03 -04:00
Matthias Clasen
5970a14217 gtk-demo: Test stylus-only mode
Add a checkbutton to toggle the stylus-only
mode of GtkGestureStylus, so we can test this.
2023-04-09 08:35:03 -04:00
Matthias Clasen
34b6d46276 placessidebar: Stop using gtk_widget_get_allocation 2023-04-09 06:48:27 -04:00
Matthias Clasen
8957d4cb4f coloreditor: Stop using gtk_widget_get_allocation 2023-04-09 06:48:27 -04:00
Matthias Clasen
95f5c7beb6 range: Fix a copy-paste error
This was showing up as the alpha popup in
the color editor not being positioned correctly.
2023-04-09 06:48:27 -04:00
Benjamin Otte
3907711a49 Merge branch 'gbsneto/vulkan-glyph-fixes' into 'main'
Vulkan glyph fixes

See merge request GNOME/gtk!5802
2023-04-09 00:07:16 +00:00
Georges Basile Stavracas Neto
496c8f4a11 gsk/vulkan/glyphcache: Rework glyphs
The current implementation of the glyph cache deals with atlases by
padding them with 1 pixel at the beginning, at the end, and between
each glyph.

That's cool and all, however, there's a very subtle problem with
this approach: the contents of the atlas are garbage, so this padding
is filled with garbage memory!

Rework the Vulkan glyph cache to draw each and every glyph in a
surface that has 1 pixel border of padding around it. Ensure the
surface is completely black by drawing a rectangle before handing
it to Pango to draw the glyph. Update tx and ty to pick the texture
position adjusted to the 1 pixel padding. The atlas now starts at
position (0, 0), since each glyph individually contains its own padding.

To improve legibility, add a PADDING define and use it everywhere.
2023-04-08 20:13:13 -03:00
Georges Basile Stavracas Neto
8b6f69946c gsk/vulkan/pipeline: Simplify pipeline creation
Nothing uses gsk_vulkan_pipeline_new_full() anymore.
2023-04-08 20:13:13 -03:00
Georges Basile Stavracas Neto
48129298f0 gsk/vulkan: Use default blend factors
Vulkan renders text using VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA and
VK_BLEND_FACTOR_SRC_ALPHA, but that implies per-channel alpha
blending, which currently produces the wrong results when blending
glyphs with the images beneath them.

Use the default pipeline constructors, which implies using the
ONE and ONE_MINUS_SRC_ALPHA.
2023-04-08 20:13:13 -03:00
Georges Basile Stavracas Neto
c77c8d6309 gsk/vulkan: Cosmetics
Reorder code to match the order used in shaders.
2023-04-08 20:13:13 -03:00
Matthias Clasen
2c3f82fd01 Tweak the wording of the message. 2023-04-08 16:14:52 +00:00
Matthias Clasen
5f4a6210c2 gestureclick: Use drag threshold for updates 2023-04-07 17:57:14 -04:00
Matthias Clasen
c0fa9e80aa gestureclick: Don't use threshold for touch
When determining double-clicks, don't use the distance
threshold for touch events. It is very hard to double
touch reliably within a few pixels of the same position.

Fixes: #5580
2023-04-07 17:57:14 -04:00
Matthias Clasen
99251c0c8f Merge branch 'wip/carlosg/popover-ungrab-on-unmap' into 'main'
gtkpopover: Move GTK grabs to map/unmap

Closes #5730

See merge request GNOME/gtk!5801
2023-04-07 20:24:24 +00:00
Carlos Garnacho
1709538756 gtkpopover: Move GTK grabs to map/unmap
Typically, a popover gets mapped when shown and unmapped when
hidden. A situation there that breaks is where the popover gets
recursively unmapped/unrealized when its root is destroyed.

In that situation, the popover does however unmap (without being
hidden first), moving the GTK grab from show/hide to map/unmap
will handle the previous situations, plus this one.

Fixes things being unclickable if e.g. a modal dialog got a
popover popped up, then got closed via Alt-F4.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5730
2023-04-07 22:12:41 +02:00
Matthias Clasen
da5433e140 Merge branch 'inspector-action-fixes' into 'main'
actionmuxer: Make the compiler warn

See merge request GNOME/gtk!5800
2023-04-07 18:05:19 +00:00
Matthias Clasen
36c1003328 inspector: Redo the actions list
Make the actions list implement GtkActionObserver
for the muxer case, and make updates work.
2023-04-07 13:45:45 -04:00
Matthias Clasen
3eabcde868 inspector: Simplify the action editor
No need to listen for changes, the actions list
code will do so and tell us to update.
2023-04-07 13:45:12 -04:00
Matthias Clasen
7664048779 inspector: Add ActionHolder::changed
We will use this signal to communicate
action changes to the action list widgetry.
2023-04-07 13:17:22 -04:00
Matthias Clasen
8648ecf889 inspector: Cosmetics
Make the variant editor use a checkbutton
instead of a togglebutton.
2023-04-07 13:17:22 -04:00
Matthias Clasen
f1a01fb973 actionmuxer: Add a precondition
This helps with debugging the inspectors action
handling.
2023-04-07 12:53:57 -04:00
Alexander Shopov
b549a52f54 Update Bulgarian translation
(cherry picked from commit f15aa82eaf)
2023-04-07 16:27:04 +00:00
Matthias Clasen
6c97667be1 inspector: Be more careful
Tweak the variant-editor code to handle some
cases more explicitly.
2023-04-07 09:16:21 -04:00
Matthias Clasen
ce597cf034 inspector: Plug a memory leak 2023-04-07 08:55:40 -04:00
Matthias Clasen
cdcb55da58 inspector: Be safer when handling actions
Those query apis are serious about not ignoring
their return value, and may not set their our
arguments to anything if they return FALSE.
2023-04-07 08:52:51 -04:00
Matthias Clasen
b8d02c9398 actionmuxer: Make the compiler warn
Warn when the boolean return isn't used, since we
may not initialize the out arguments in the FALSE
case (see the previous commits).
2023-04-07 08:03:46 -04:00
Matthias Clasen
d97514ec67 textview: Handle a return value 2023-04-07 08:03:46 -04:00
Matthias Clasen
a96df553e0 Merge branch '5729_fix_inspector_crash' into 'main'
inspector: fix crash caused by uninitialized GVariant

Closes #5729

See merge request GNOME/gtk!5799
2023-04-07 12:01:22 +00:00
Nelson Benítez León
ed8148bd07 inspector: fix crash caused by uninitialized GVariant
we were not checking the return gboolean of
gtk_action_muxer_query_action() which was
returning FALSE for the crash case, meaning
it didn't set the passed in GVariant, but
we were still using it as it was non-null.

Fixes #5729
2023-04-06 20:05:53 -04:00
Matthias Clasen
e0dbc6a0ee Merge branch 'media-controls' into 'main'
mediacontrols: Add tooltip text to play button

See merge request GNOME/gtk!5794
2023-04-06 17:59:54 +00:00
Matthias Clasen
fb91418edd Merge branch 'alert_dialog_role_mapping_fix' into 'main'
a11y: Map GTK_ACCESSIBLE_ROLE_ALERT_DIALOG to ATSPI_ROLE_ALERT

See merge request GNOME/gtk!5796
2023-04-06 17:59:05 +00:00
Matthias Clasen
154ff6fe03 Merge branch 'matthiasc/for-main' into 'main'
glarea: Fix property notification

See merge request GNOME/gtk!5797
2023-04-06 15:06:26 +00:00
Matthias Clasen
a65dc036b1 glarea: Fix property notification
This was broken in 9c26262e3e.
2023-04-06 10:37:58 -04:00
Maximiliano Sandoval R
62865bc52d mediacontrols: Add tooltip text to play button
This makes the button accessible.
2023-04-06 16:16:41 +02:00
Lukáš Tyrychtr
19b280be4c a11y: Map GTK_ACCESSIBLE_ROLE_ALERT_DIALOG to ATSPI_ROLE_ALERT
By doing this, alert dialogs will be read automatically, or at least
they should be, because a screen reader know that these are special.
2023-04-06 13:55:16 +02:00
Matthias Clasen
9608e4e503 Merge branch 'wip/exalm/centerlayout-shrink' into 'main'
centerlayout/box: Add :shrink-center-last

See merge request GNOME/gtk!5790
2023-04-05 22:23:19 +00:00
Matthias Clasen
1859193c5d Merge branch 'wip/exalm/shortcuts' into 'main'
Add style classes to standard dialogs

See merge request GNOME/gtk!5791
2023-04-05 22:05:33 +00:00
Alexander Mikhaylenko
9138d91c1c pagesetupunixdialog: Add "pagesetup" style class 2023-04-06 00:58:38 +04:00
Alexander Mikhaylenko
f1dff40391 fontchooserdialog: Add "fontchooser" style class 2023-04-06 00:58:38 +04:00
Alexander Mikhaylenko
fff98d94f9 filechooserdialog: Add "filechooser" style class 2023-04-06 00:58:38 +04:00
Alexander Mikhaylenko
1d0f0d4229 colorchooserdialog: Add "colorchooser" style class 2023-04-06 00:58:38 +04:00
Alexander Mikhaylenko
80a11b1a1c appchooserdialog: Add "appchooser" style class 2023-04-06 00:58:38 +04:00
Alexander Mikhaylenko
399ee3db3f shortcutswindow: Add "shortcuts" style class 2023-04-06 00:58:38 +04:00
Alexander Mikhaylenko
c40fa8db98 centerbox: Expose GtkCenterLayout:shrink-center-last 2023-04-05 16:15:49 +04:00
Alexander Mikhaylenko
8fd9de23bb centerlayout: Add :shrink-center-last
Allow to prioritize start and end children and have them keep their natural
size instead of center child if possible.

See https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/5552#note_1708864
2023-04-05 16:15:49 +04:00
Matthias Clasen
450490bcf6 Merge branch 'ebassi/listbox-dispose' into 'main'
listbox: Unbind the model before removing children

See merge request GNOME/gtk!5789
2023-04-05 02:35:20 +00:00
Emmanuele Bassi
fb3f817f69 listbox: Unbind the model before removing children
Calling gtk_list_box_remove_all() is a no-op with a bound model; after
the introduction of the remove_all() method in 49e56fc7, we were left
with row widgets after the dispose() call chained up.

We could restore the explicit unparenting inside dispose() instead of
calling remove_all(), but since the bound list model is provided by the
user of GtkListBox, it's more appropriate to unbind it in the dispose()
implementation, to avoid any potential reference cycle (especially in
higher level languages that have no explicit reference acquisition).

We clean up the bound model, and its associated state, if any; and then
we remove all the row widgets that are left.
2023-04-04 13:47:36 +01:00
Matthias Clasen
6a2f715250 Merge branch 'glarea-allowed-apis' into 'main'
glarea: Add GtkGLArea::allowed-apis

Closes #5330

See merge request GNOME/gtk!5786
2023-04-04 03:14:21 +00:00
Matthias Clasen
b1f0ca7dc4 gtk-demo: Update the GLArea examples 2023-04-03 23:05:38 -04:00
Matthias Clasen
9c26262e3e glarea: Add GtkGLArea::allowed-apis
Add api that mirrors the new GdkGLContext api
for selecting OpenGL variants, and deprecate
the old use_es api.

Fixes: #5330
2023-04-03 23:05:38 -04:00
Matthias Clasen
7723045e9a Merge branch 'matthiasc/for-main' into 'main'
expander: Fix the css docs

Closes #5723

See merge request GNOME/gtk!5787
2023-04-04 02:50:08 +00:00
Matthias Clasen
a9a6371ceb Merge branch 'node-editor-things' into 'main'
Revert "rendernodepaintable: Provide accurate aspect ratio"

See merge request GNOME/gtk!5788
2023-04-04 02:47:39 +00:00
Matthias Clasen
6182f4a332 node-editor: Improve the scaling
We only want to scale the main rendering, not whats
shown in the sidebar. Also, make the scale logarithmic.
2023-04-03 22:33:34 -04:00
Matthias Clasen
9ccde8b913 rendernodepaintable: Preserve aspect ratio in snapshot()
This is the better fix.
2023-04-03 22:33:34 -04:00
Matthias Clasen
70e56f0dea Revert "rendernodepaintable: Provide accurate aspect ratio"
This reverts commit 52a8492887.

It turned out to be the wrong fix.
2023-04-03 22:33:34 -04:00
Matthias Clasen
8785391238 expander: Fix the css docs
The docs were not matching reality since the
css node names were changed in 6d20fe0b.

Fixes: #5723
2023-04-03 19:33:31 -04:00
Benjamin Otte
231b12124e Merge branch 'wip/otte/for-main' into 'main'
rendernode: Remove instance_init() function

See merge request GNOME/gtk!5785
2023-04-03 18:14:51 +00:00
Matthias Clasen
409c6556ec Merge branch 'bilelmoussaoui/return-fix' into 'main'
gtk: Fix *_get_tab_behaviour return type

See merge request GNOME/gtk!5784
2023-04-03 18:04:08 +00:00
Benjamin Otte
4d86954fb5 rendernode: Cosmetics
Simplify a function.
2023-04-03 19:27:58 +02:00
Benjamin Otte
6e8c3fc3ff rendernode: Get rid of GskRenderNodeTypeInfo
Instead, use class_init functions.
2023-04-03 19:27:58 +02:00
Benjamin Otte
0d139a81c7 rendernode: Remove instance_init() function
It's not used.
2023-04-03 19:27:58 +02:00
Bilal Elmoussaoui
d56815e98e gtk: Fix *_get_tab_behaviour return type 2023-04-03 18:55:04 +02:00
Matthias Clasen
9752395a1d Post-release version bump 2023-04-03 10:54:11 -04:00
Matthias Clasen
7467701818 4.11.1 2023-04-03 10:40:16 -04:00
Matthias Clasen
d82559345a NEWS: Updates 2023-04-03 10:36:40 -04:00
Matthias Clasen
ac61376c32 Add comment on versions
Some versions are specfied in multiple places.
Add a reminder to update all places.
2023-04-03 10:35:36 -04:00
Benjamin Otte
362bdaa852 Merge branch 'gbsneto/vulkan-layout-fixes' into 'main'
Vulkan fractional scale support, image layout and clip region fixes, cleanups

See merge request GNOME/gtk!5783
2023-04-03 14:27:24 +00:00
Georges Basile Stavracas Neto
5c27a0dd2b vulkan: Support fractional scaling
Basically what GL does, but without any debug or feature flag
to gatekeep it, since the Vulkan backend itself is experimental
already.

Ceil surface sizes, and floor coordinates, to the fractional scale
value.
2023-04-03 11:10:27 -03:00
Georges Basile Stavracas Neto
db1d278100 gsk/vulkan/renderpass: Don't scale scissor and render area
The rects passed to the clip region are in buffer coordinates, and
must not be scaled. Consider the following scenario: Wayland, with
a 1024x768@2 window. That gives us a 2048x1536 raw image. To setup
the Vulkan render pass code, we'd scale 2048x1536 *again*, to an
unreasonable 4196x3072, which is (1) incorrect and (2) really
incorrect and (3) can lead to crashes at best, full GPU resets
at worst - and a GPU reset is incredibly not fun!

Now that we pass the right clip regions at the right coordinates
at all times, remove the extra scaling from the render pass.
2023-04-03 10:59:45 -03:00
Georges Basile Stavracas Neto
dde029c3d1 gsk/vulkan: Cosmetics
No functional changes. Use a variable that already exists instead
of calling gdk_draw_context_get_surface() again. Cleanup some
newlines.
2023-04-03 10:59:45 -03:00
Georges Basile Stavracas Neto
a2a05acc6b gsk/vulkan/renderer: Pass appropriate clip region
This part of the Vulkan renderer is almost exactly equal to the GL
renderer, and the GL renderer already does that since at least
2a38cecd33. Copy that into the Vulkan renderer.

A nice side effect from this commit is that resizing a window now
actually works again.

Sneak in a trivial cleanup by using a variable to hold the draw
index.
2023-04-03 10:59:45 -03:00
Georges Basile Stavracas Neto
840c72d74d gsk/vulkan/buffer: Pass aligned memory value
This was a tricky one to figure out, but it's pretty simple to
understand (I hope!).

So, this AMD card I'm using requires buffer memory sizes to be
aligned to 16 bytes. Intel is aligned to 4 bytes I think, but
AMD - or at least this AMD model in particular - uses 16 bytes
for alignment.

When creating a a particular texture (I did not determin which one
specifically!) a buffer of size 1276 bytes is requested.

1276 / 16 = 79.75, which is clearly not aligned to the required
16 bytes.

We request Vulkan to create a buffer of 1276 bytes for us, it
figures out that it's not aligned, and creates a buffer of 1280
bytes, which is aligned. The extra 4 bytes are wasted, but that's
okay. We immediately query this buffer for this exact information,
using vkGetBufferMemoryRequirements(), and proceed to create actual
memory to back this buffer up.

The buffer tells us we must use 1280 bytes, so we pass 1280 bytes
and everyone is happy, right? Of course not. We pass 1276 bytes,
and Vulkan is subtly unhappy at us.

Fix that by passing the value that Vulkan asks us to use, i.e.,
the size returned by vkGetBufferMemoryRequirements().
2023-04-03 10:59:45 -03:00
Georges Basile Stavracas Neto
56c643306a gsk/vulkan/glyphcache: Ceil glyph surface size
This is what GL does, and for a reason: it can lead to width or
height for very small glyphs. Also, switch to dividing by a float
(1024.0) instead of an integer (1024).
2023-04-03 10:59:45 -03:00
Georges Basile Stavracas Neto
57587c00b4 gsk/vulkanimage: Set buffer row length and height
This doesn't make any difference now, but will allow us to copy
subregions more easily. This is not obvious, but here's a quick
explanation:

Leaving 'bufferRowLength' and 'bufferImageHeight' implies that
Vulkan will assume the size passed in the 'imageExtent' field.
Right now, this assumption is correct - the only user of this
function is the glyph cache, and it only copies and uploads
exact rects. Next commits will change that assumption, so we
must pass 'buffer*' fields, and tell Vulkan, "this part of the
buffer represents an image of width x height, and I want the
subregion (x, y, smallerWidth, smallerHeight) of this image".
2023-04-03 10:59:45 -03:00
Georges Basile Stavracas Neto
724d07ef8a gsk/vulkan/image: Use UNDEFINED for initial layout
When creating an image using gsk_vulkan_image_new_for_framebuffer(),
it passes VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL.

However, this is a mistake. The spec demands that the initial
layout must be either VK_IMAGE_LAYOUT_UNDEFINED or
VK_IMAGE_LAYOUT_PREINITIALIZED.

Apparently this was an oversight from commit b97fb75146, since the
commit message even documents that, and all other calls pass either
VK_IMAGE_LAYOUT_UNDEFINED or VK_IMAGE_LAYOUT_PREINITIALIZED.

Create framebuffer images using VK_IMAGE_LAYOUT_UNDEFINED, which is
what was originally expected.
2023-04-03 10:59:45 -03:00
Matthias Clasen
79b0e594cd Merge branch 'listbox-remove-all' into 'main'
gtklistbox: Add remove_all()

See merge request GNOME/gtk!5779
2023-04-03 10:29:13 +00:00
Matthias Clasen
6ef3d77b9a Merge branch 'zbrown/bump-protocols' into 'main'
build: We need wayland-protocols 1.31

See merge request GNOME/gtk!5780
2023-04-03 10:28:44 +00:00
Aleksandr Melman
26b36e68f4 Update Russian translation 2023-04-03 07:29:46 +00:00
Zander Brown
405c703aa0 build: We need wayland-protocols 1.31
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/5767
2023-04-03 01:12:54 +00:00
Christopher Davis
b34625363a gtkflowbox: Add remove_all()
Removing all items from containers is a common use case.
Without this applications needed to implement this manually.
It makes senses to handle it here.
2023-04-02 20:17:46 -04:00
Christopher Davis
49e56fc7b3 gtklistbox: Add remove_all()
Adds a function to remove all children from
a GtkListBox. This way app developers don't need to
implement this themselves.
2023-04-02 19:46:02 -04:00
Georges Basile Stavracas Neto
a33ddd54ac gsk/vulkan/image: Cosmetics 2023-04-02 19:29:55 -03:00
Benjamin Otte
39863d1a15 Merge branch 'wip/otte/for-main' into 'main'
tooltipwindow: Cast the correct object

See merge request GNOME/gtk!5774
2023-04-02 19:14:05 +00:00
Matthias Clasen
f7554f3a97 Merge branch 'docs-updates' into 'main'
docs: Document new environment variables

See merge request GNOME/gtk!5777
2023-04-02 18:43:55 +00:00
Benjamin Otte
8054f33fa4 tooltipwindow: Cast the correct object
the tooltipwindow is in the userdata.
2023-04-02 20:29:52 +02:00
Matthias Clasen
def6a78c88 Merge branch 'scale-factor-cleanup' into 'main'
wayland: Be more careful about scale-factor

See merge request GNOME/gtk!5775
2023-04-02 18:09:26 +00:00
Matthias Clasen
9b2a49b7b5 NEWS: Updates 2023-04-02 13:54:42 -04:00
Matthias Clasen
e84ebfbf29 docs: Document new environment variables
Add GSK_MAX_TEXTURE_SIZE and GDK_DEBUG=gl-fractional
to the docs.
2023-04-02 13:52:56 -04:00
Matthias Clasen
80ccfd2138 Merge branch 'ccook/gtkiter-doc-changes' into 'main'
Documentation corrections for GtkTextIter

See merge request GNOME/gtk!5776
2023-04-02 17:43:03 +00:00
Matthias Clasen
5e95c22844 wayland: Be more careful about scale-factor
Only emit notify::scale-factor if it actually
changes. This potentially avoids a lot of work
in GTK (reloading icons, etc).
2023-04-02 13:23:19 -04:00
Matthias Clasen
70269a5aee docs: Add some details 2023-04-02 13:18:51 -04:00
Cam Cook
0b861ac7a5 Documentation corrections for GtkTextIter
| method                                                                                                     | current                                                       | suggestion                                                      |
|------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------|-----------------------------------------------------------------|
| [backward_visible_cursor_position](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3785) | "Moves @iter forward to the previous visible cursor position" | "Moves @iter backward to the previous visible cursor position." |
| [get_offset](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L595)                        | "Use [method@Gtk,TextBuffer.get_iter_at_offset]"              | "Use [method@Gtk.TextBuffer.get_iter_at_offset]"                |
| [starts_tag](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L1201)                       | "returns %TRUE, [method@Gtk.TextIter.has_tag"                 | "returns %TRUE, [method@Gtk.TextIter.has_tag] "                 |

| method                                                                                                 | current                                             | suggestion                                                |
|--------------------------------------------------------------------------------------------------------|-----------------------------------------------------|-----------------------------------------------------------|
| [backward_cursor_position](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3715)     | "Like gtk_text_iter_forward_cursor_position()"      | "Like [method@Gtk.TextIter.forward_cursor_position]"      |
| [backward_find_char](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L4483)           | "Same as gtk_text_iter_forward_find_char()"         | "Same as [method@Gtk.TextIter.forward_find_char]"         |
| [backward_search](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L5295)              | "Same as gtk_text_iter_forward_search()"            | "Same as [method@Gtk.TextIter.forward_search]"            |
| [backward_sentence_starts](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3611)     | "Calls gtk_text_iter_backward_sentence_start()"     | "Calls [method@Gtk.TextIter.backward_sentence_start]"     |
| [backward_visible_word_starts](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3421) | "Calls gtk_text_iter_backward_visible_word_start()" | "Calls [method@Gtk.TextIter.backward_visible_word_start]" |
| [backward_word_starts](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3345)         | "Calls gtk_text_iter_backward_word_start()"         | "Calls [method@Gtk.TextIter.backward_word_start]"         |
| [forward_sentence_ends](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3591)        | "Calls gtk_text_iter_forward_sentence_end()"        | "Calls [method@Gtk.TextIter.forward_sentence_end]"        |
| [forward_to_end](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L4131)               | "gtk_text_iter_get_char() called on"                | "[method@Gtk.TextIter.get_char] called on"                |
| [forward_visible_word_ends](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3403)    | "Calls gtk_text_iter_forward_visible_word_end()"    | "Calls [method@Gtk.TextIter.forward_visible_word_end]"    |
| [forward_word_ends](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3327)            | "Calls gtk_text_iter_forward_word_end()"            | " Calls [method@Gtk.TextIter.forward_word_end]"           |
| [is_end](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L1664)                       | "gtk_text_iter_is_end() is the most efficient"      | "[method@Gtk.TextIter.is_end] is the most efficient"    |
| [set_line_index](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3900)               | "Same as gtk_text_iter_set_line_offset()"           | "Same as [method@Gtk.TextIter.set_line_offset]"         |
| [set_visible_line_index](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3987)       | "Like gtk_text_iter_set_line_index()"               | "Like [method@Gtk.TextIter.set_line_index]"             |
| [set_visible_line_offset](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3946)      | "Like gtk_text_iter_set_line_offset()"              | "Like [method@Gtk.TextIter.set_line_offset]"            |
2023-04-02 13:12:21 -04:00
Matthias Clasen
1a1f71f394 NEWS: Updates 2023-04-02 13:05:34 -04:00
Benjamin Otte
461e562ec9 Merge branch 'dropdown-inertness' into 'main'
dropdown: Fix to work with recent listview changes

See merge request GNOME/gtk!5773
2023-04-02 16:59:10 +00:00
Cam Cook
9d5330336b Documentation corrections for GtkTextIter
| method                                                                                                     | current                                                       | suggestion                                                      |
|------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------|-----------------------------------------------------------------|
| [backward_visible_cursor_position](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3785) | "Moves @iter forward to the previous visible cursor position" | "Moves @iter backward to the previous visible cursor position." |
| [get_offset](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L595)                        | "Use [method@Gtk,TextBuffer.get_iter_at_offset]"              | "Use [method@Gtk.TextBuffer.get_iter_at_offset]"                |
| [starts_tag](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L1201)                       | "returns %TRUE, [method@Gtk.TextIter.has_tag"                 | "returns %TRUE, [method@Gtk.TextIter.has_tag] "                 |

| method                                                                                                 | current                                             | suggestion                                                |
|--------------------------------------------------------------------------------------------------------|-----------------------------------------------------|-----------------------------------------------------------|
| [backward_cursor_position](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3715)     | "Like gtk_text_iter_forward_cursor_position()"      | "Like [method@Gtk.TextIter.forward_cursor_position]"      |
| [backward_find_char](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L4483)           | "Same as gtk_text_iter_forward_find_char()"         | "Same as [method@Gtk.TextIter.forward_find_char]"         |
| [backward_search](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L5295)              | "Same as gtk_text_iter_forward_search()"            | "Same as [method@Gtk.TextIter.forward_search]"            |
| [backward_sentence_starts](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3611)     | "Calls gtk_text_iter_backward_sentence_start()"     | "Calls [method@Gtk.TextIter.backward_sentence_start]"     |
| [backward_visible_word_starts](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3421) | "Calls gtk_text_iter_backward_visible_word_start()" | "Calls [method@Gtk.TextIter.backward_visible_word_start]" |
| [backward_word_starts](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3345)         | "Calls gtk_text_iter_backward_word_start()"         | "Calls [method@Gtk.TextIter.backward_word_start]"         |
| [forward_sentence_ends](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3591)        | "Calls gtk_text_iter_forward_sentence_end()"        | "Calls [method@Gtk.TextIter.forward_sentence_end]"        |
| [forward_to_end](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L4131)               | "gtk_text_iter_get_char() called on"                | "[method@Gtk.TextIter.get_char] called on"                |
| [forward_visible_word_ends](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3403)    | "Calls gtk_text_iter_forward_visible_word_end()"    | "Calls [method@Gtk.TextIter.forward_visible_word_end]"    |
| [forward_word_ends](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3327)            | "Calls gtk_text_iter_forward_word_end()"            | " Calls [method@Gtk.TextIter.forward_word_end]"           |
| [is_end](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L1664)                       | "gtk_text_iter_is_end() is the most efficient"      | "[method@Gtk.TextBuffer.is_end] is the most efficient"    |
| [set_line_index](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3900)               | "Same as gtk_text_iter_set_line_offset()"           | "Same as [method@Gtk.TextBuffer.set_line_offset]"         |
| [set_visible_line_index](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3987)       | "Like gtk_text_iter_set_line_index()"               | "Like [method@Gtk.TextBuffer.set_line_index]"             |
| [set_visible_line_offset](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextiter.c#L3946)      | "Like gtk_text_iter_set_line_offset()"              | "Like [method@Gtk.TextBuffer.set_line_offset]"            |
2023-04-02 12:51:29 -04:00
Matthias Clasen
1068808742 dropdown: Fix to work with recent listview changes
Introduce our own 'inertness' for the list item widget
that shows the selected value inside the button.
2023-04-02 12:36:03 -04:00
Matthias Clasen
d6a27a41c2 Merge branch 'gl-fractional-scale' into 'main'
Make fractional scaling work with the GL renderer

See merge request GNOME/gtk!5770
2023-04-02 15:29:32 +00:00
Matthias Clasen
4746ffc4eb Make fractional scaling for GL opt-in
Fractional scaling with the GL renderer is
experimental for now, so we disable it unless
GDK_DEBUG=gl-fractional is set.

This will give us time to work out the kinks.
2023-04-02 11:05:57 -04:00
Matthias Clasen
493055d6b2 Merge branch 'matthiasc/for-main' into 'main'
examples: Update for deprecations

See merge request GNOME/gtk!5772
2023-04-02 15:02:24 +00:00
Matthias Clasen
fa58dd9256 Use fractional scale for the GL renderer
This commit combines changes in the Wayland backend,
the GL context frontend, and the GL renderer to switch
them all to use the fractional scale.

In the Wayland backend, we now use the fractional scale
to size the EGL window.

In the GL frontend code, we use the fractional scale to
scale the damage region and surface in begin/end_frame.

And in the GL renderer, we replace gdk_surface_get_scale_factor()
with gdk_surface_get_scale().
2023-04-02 09:22:56 -04:00
Matthias Clasen
519cde95f0 gsk: Cosmetics
Rename scale_factor to scale in various places,
now that it is no longer an int but a float.
2023-04-02 09:06:56 -04:00
Matthias Clasen
01108d4148 gsk: Pass scale as float to the command queue 2023-04-02 09:06:56 -04:00
Matthias Clasen
7d4c757c58 examples: Update for deprecations
Stop using gdk_surface_create_similar_surface here.
2023-04-02 09:06:02 -04:00
Matthias Clasen
33b1624a9f Merge branch 'deprecate-similar-surface' into 'main'
popover: Stop using gdk_surface_create_similar_surface

See merge request GNOME/gtk!5771
2023-04-02 10:55:15 +00:00
Yuri Chornoivan
f20e6a81d2 Update Ukrainian translation 2023-04-02 06:19:55 +00:00
Matthias Clasen
76ac91512b Deprecate gdk_surface_create_similar_surface
This function is part of the cairo drawing API and
we are moving away from that. Update all callers.
2023-04-01 23:09:19 -04:00
Matthias Clasen
afed6f92ef popover: Stop using gdk_surface_create_similar_surface
Just create the cairo image surface ourselves.
2023-04-01 23:08:36 -04:00
Matthias Clasen
b02729a58e Merge branch 'inspector-fractional-scale' into 'main'
Add gdk_surface_get_scale

See merge request GNOME/gtk!5769
2023-04-01 23:31:39 +00:00
Matthias Clasen
ed9f0c0eb8 inspector: Show surface scale
For Wayland surfaces, show the fractional scale
if we have it.
2023-04-01 19:11:00 -04:00
Matthias Clasen
075bea788b Add gdk_surface_get_scale
Add a scale property to GdkSurface and use the
fractional scale for it on Wayland.
2023-04-01 19:09:16 -04:00
Benjamin Otte
378df6556b Merge branch 'wip/otte/listitem-focus' into 'main'
GtkColumnView factories and focus rework

See merge request GNOME/gtk!5728
2023-04-01 19:33:00 +00:00
Matthias Clasen
d10e228ae0 inspector: Show the viewporter too 2023-04-01 14:53:12 -04:00
Benjamin Otte
4086913795 gtk-demo: Port to GtkColumnViewCell 2023-04-01 20:49:40 +02:00
Benjamin Otte
f5dea9a3c2 filechooserwidget: Port to ColumnViewCell 2023-04-01 20:49:40 +02:00
Benjamin Otte
5af3c2b2ec testcolumnview: Port to GtkColumnViewCell 2023-04-01 20:49:40 +02:00
Benjamin Otte
7a4ad81ed6 columnview: Add GtkColumnViewCell
This splits GtkListItem into 2 objects.

It is fully backwards compatible.

Using GtkListItem for GtkColumnView is now de-facto deprecated.
2023-04-01 20:49:40 +02:00
Benjamin Otte
e76d615d5f builderlistitemfactory: Allow subclasses
It's going to be used with the new GtkColumnViewCell objects, so that
it's backwards compatible with ui file factories that use GtkListItem.
2023-04-01 20:49:40 +02:00
Benjamin Otte
beba8be6b5 builder: Allow template parsing to be used with subclasses
Whenn setting gtk_builder_set_allow_template_parents(), the builder
instance will accept
  <template class="GtkWidget">
for a GtkBox instance.

It's going to be used with the new GtkColumnViewCell objects, so that
it's backwards compatible with ui file factories that use GtkListItem.
2023-04-01 20:49:40 +02:00
Benjamin Otte
170d49f067 columnviewcell: Ignore ::activatable and ::selectable for cells
This is a row property, not a cell property.
2023-04-01 20:49:40 +02:00
Benjamin Otte
c74ab7aaec columnviewcellwidget: Untangle from GtkListItemWidget
This is step 1 in switching cells to their own ListItem subclass.
2023-04-01 20:49:40 +02:00
Benjamin Otte
00cb4c66cf testdatatable: Add a --pages option
That way, local scrolling is available and the scrolling isn't random.

Recycling should now involve reordering the recycled widgets instead of
just keeping their order because all of them got recycled.
2023-04-01 20:49:40 +02:00
Benjamin Otte
708e067617 columnviewcellwidget: Ensure for_size is large enough
When clipping, we still need to do proper size requests.
2023-04-01 20:49:40 +02:00
Benjamin Otte
a29cf74e05 columnviewcellwidget: Rewrite width unadjusting
Use GtkCssBoxes for that purpose. No more scary CSS math necessary in
the widget.
2023-04-01 20:49:40 +02:00
Benjamin Otte
c760131f6f filechooser: Set a row-factory
This way, we can toggle per-row selectability and ensure files are not
selectable in select-folder mode.
2023-04-01 20:49:40 +02:00
Benjamin Otte
880aea513f columnview: Add gtk_column_view_add_row_factory()
This allows setting a factory to toggle per-row properties.

Implemented are selectable, focusable and activatable.
These are meant to supercede the per-cell selectable and activatable
properties, which make no sense individually.

The focus property makes it possible to focus rows instead of cells,
which is the default behavior.
2023-04-01 20:49:40 +02:00
Benjamin Otte
d1bc552b5f columnview: Implement inertness
This properly implements the same behavior as
62e9d1e470 and avoids randomly losing
factories.

Oops.
2023-04-01 20:49:40 +02:00
Benjamin Otte
e8f0aa6ef8 columnviewrowwidget: Don't discard items in unroot()
Follows 3411b0306ee3b88038abdc736adf60bd004c7b7a and
3fb10ff2d8.
2023-04-01 20:49:40 +02:00
Benjamin Otte
1a6afebbda columnview: Rename to GtkColumnViewCellWidget
Just like with Row/RowWidget, I want to use Cell/CellWidget.
2023-04-01 20:49:40 +02:00
Benjamin Otte
7cfab4edf2 columnview: Add GtkColumnViewRow
There is no way to set it yet, this is just to prove that it works.

It also changes the focus behavior of rows. They are now always
focusable - unless turned off by the factory once that is possible.
2023-04-01 20:49:40 +02:00
Benjamin Otte
04c049ee54 listitem: Add a backwards compatibility workaround
I want to avoid turning the :focusable property into a tristate at all
costs, but that third state is what we had before the property.
2023-04-01 20:49:40 +02:00
Benjamin Otte
5f1b8a31c2 treeexpander: Add docs note about setting GtkListItem::focusable 2023-04-01 20:49:40 +02:00
Benjamin Otte
87059d53a6 columnviewcell: Cells should not be focusable by default 2023-04-01 20:49:40 +02:00
Benjamin Otte
ce531ce280 listview: Add GtkListItem::focusable property
This makes the question if a listitem can be focused or not an explicit
decision by application developers.

Previously an item could be focused if it was selectable and no child or
grandchild was focusable - so if you put a label and icon into it, the
item was focusable, but if you put a GtkTreeExpander or a GtkButton into
it, the item wasn't. This needs to be decided explicitly now.

Technically this is an API break, because the previous behavior does not
exist anymore.
But I really don't want to make this a tristate (focusable, not
focusable, automatic), because then binding it to other things gets
hard, and because all the other focusable proeprties are booleans, too,
and working with them gets a lot harder.

Related: #3910
2023-04-01 20:49:40 +02:00
Benjamin Otte
eb0541c9d1 columnviewcell: Cells aren't selectable or activatable
Rows are.
2023-04-01 20:49:40 +02:00
Benjamin Otte
3048100617 listitem: Use GDK_DECLARE_INTERNAL_TYPE 2023-04-01 20:49:40 +02:00
Matthias Clasen
60921db76f Merge branch 'matthiasc/for-main' into 'main'
inspector: Update some misc info rows

See merge request GNOME/gtk!5768
2023-04-01 18:36:39 +00:00
Matthias Clasen
f7600a62e4 Merge branch 'wip/otte/fractional-cairo' into 'main'
wayland: Enable fractional scaling with the Cairo renderer

See merge request GNOME/gtk!5767
2023-04-01 18:35:33 +00:00
Georges Basile Stavracas Neto
70e6bcce16 Merge branch 'gbsneto/mildly-mid-vulkan-fixes' into 'main'
Vulkan transform / scale fixes

See merge request GNOME/gtk!5757
2023-04-01 18:23:12 +00:00
Matthias Clasen
a4dc0a74fd inspector: Update some misc info rows 2023-04-01 14:21:41 -04:00
Benjamin Otte
6d4d9af14e wayland: Use fractional scaling with the Cairo renderer
Cairo can do that, so just enable it:

 * Create surfaces with the correct fractionally scaled size.
 * Set the Cairo surface's device scale to that number.
2023-04-01 20:05:06 +02:00
Benjamin Otte
84b235aac1 wayland: Allow creating fractional Cairo surfaces
We don't do that yet, because the buffer scale code can't deal with it,
but we can do it now.
2023-04-01 20:05:05 +02:00
Benjamin Otte
ea82f50d13 build: Bump wayland-protocols requirement
The new fractional-scale support requires v1.31
2023-04-01 20:05:05 +02:00
Benjamin Otte
1a71e82fc5 wayland: Use wp_viewport to set buffer scale
Instead of setting the buffer scale via the buffer-scale command, set it
via the viewport.

This technically allows setting fractional scales, but we're not doing
that.
2023-04-01 20:05:01 +02:00
Georges Basile Stavracas Neto
f3b8bd8a98 gsk/gl/renderjob: Decompose matrix for 3D transforms
While this can be more expensive, it's also correct.
2023-04-01 14:47:29 -03:00
Georges Basile Stavracas Neto
ee1730dd49 gsk/vulkan/renderpass: Update scales from transform node
Retrieve the scale from the transform node, and store it as long
as the transform node is being visited. This applies the proper
scale to text nodes.
2023-04-01 14:47:29 -03:00
Georges Basile Stavracas Neto
e0aaf9bc83 gsk/vulkan/renderpass: Refactor scale
Instead of tracking a single scale, track x and y scales separately.
Factor out gsk_vulkan_render_pass_new() into a private function that
receives both scales, and pass 'scale_factor' for both.
2023-04-01 14:46:56 -03:00
Matthias Clasen
63318dcd66 NEWS: Updates 2023-04-01 12:38:38 -04:00
Benjamin Otte
8dd5d649b8 wayland: Use GdkFractionalScale for surface scale
We still always round it to integers when we read it, but we store it as a fraction.

So we could now use it for fractional scaling.
2023-04-01 18:23:38 +02:00
Benjamin Otte
40ac6f22a3 wayland: Introduce GdkFractionalScale type
We want to use it later for various things, this just adds the
infrastructure we will need.
2023-04-01 18:23:38 +02:00
Matthias Clasen
1262477e17 Merge branch 'always_expose_showing' into 'main'
a11y: Set ATSPI_STATE_SHOWING for all widgets, not only for windows

Closes #5194

See merge request GNOME/gtk!5738
2023-04-01 14:41:42 +00:00
Matthias Clasen
afe3f0ef0c Merge branch 'matthiasc/for-main' into 'main'
inspector: Improve display of paths

See merge request GNOME/gtk!5766
2023-04-01 14:14:31 +00:00
Matthias Clasen
258fb091dc inspector: Improve display of paths
The values in the path section are long and generally
ellipsized. It does not make sense to reserve extra
space that the labels don't need.
2023-04-01 09:52:31 -04:00
Matthias Clasen
7aca807b15 Merge branch 'wayland-details' into 'main'
inspector: Show Wayland protocols

See merge request GNOME/gtk!5765
2023-04-01 13:51:40 +00:00
Matthias Clasen
ffdbb9077c wayland: Some debug spew tweaks 2023-04-01 09:31:12 -04:00
Matthias Clasen
23268e84b3 inspector: Show Wayland protocols
This could be useful for somebody.
2023-04-01 09:31:12 -04:00
Matthias Clasen
16c1acc539 Merge branch 'bilelmoussaoui-main-patch-24659' into 'main'
docs: Improve GtkLabel rendering

See merge request GNOME/gtk!5764
2023-04-01 12:48:19 +00:00
Nathan Follens
3393813949 Update Dutch translation 2023-04-01 12:29:11 +00:00
Bilal Elmoussaoui
e95c50ca4e docs: Improve GtkLabel rendering
By adding some missing links & avoid the browser
from rendering the entities as their equivalent symbols
2023-04-01 12:06:11 +00:00
Benjamin Otte
a3f216be00 Merge branch 'wip/otte/fractional-scale' into 'main'
wayland: Add support for the fractional scale protocol

See merge request GNOME/gtk!5763
2023-04-01 11:39:32 +00:00
Benjamin Otte
54e8bd898a wayland: Add support for the fractional scale protocol
April fools!

No, really.
The fractional scale protocol is just a way to track the surface scale,
but not a way to draw fractional content.
This commit uses it for that, so tht we don't rely on tracking outputs.

This also allows magnifiers etc to send us a larger (integer) scale if
they would like that, that is not represented by the outputs.
2023-04-01 12:57:03 +02:00
Benjamin Otte
2fb11765c7 Merge branch 'wip/otte/wayland-versions' into 'main'
wayland: Use proper get_version() functions

See merge request GNOME/gtk!5761
2023-04-01 00:52:11 +00:00
Benjamin Otte
b4492a97bf wayland: Use wl_seat_get_version() 2023-04-01 02:22:21 +02:00
Benjamin Otte
6f93f52b56 wayland: Use zwp_pointer_gestures_v1_get_version() 2023-04-01 02:22:21 +02:00
Benjamin Otte
68b8c5cd99 wayland: Use gtk_shell1_get_version()
... or correct gtk_surface1_get_version() alternative.
2023-04-01 02:22:21 +02:00
Benjamin Otte
9d99259cbd wayland: Use wl_data_device_manager_get_version() 2023-04-01 02:22:21 +02:00
Benjamin Otte
55b5c847f7 wayland: Use zxdg_output_manager_v1_get_version() 2023-04-01 02:22:21 +02:00
Benjamin Otte
3d3d22e844 wayland: Remove unused variable
Also, Wayland has get_version() functions, so if we ever need it, we can
use that.
2023-04-01 02:22:21 +02:00
Benjamin Otte
ae2c28af89 wayland: Check correct interface
buffer scale is a surface property, so check the version of the surface
interface, not the compositor one.
2023-04-01 02:22:21 +02:00
Benjamin Otte
c7499a33fd wayland: Use wl_compositor_get_version()
Wayland has functions to check versions, so use those.
2023-04-01 02:22:21 +02:00
Benjamin Otte
c97b489316 wayland: Use proper macro
Wayland has macros to check required versions. Use those instead of
custom ones.
2023-04-01 02:22:21 +02:00
Matthias Clasen
ce86ec5599 CODING-STYLE: Updates
We switched to using #pragma once in headers,
document that.
2023-03-31 20:17:12 -04:00
Matthias Clasen
27230ccb01 Merge branch 'pragma-once' into 'main'
Convert headers to #pragma once

See merge request GNOME/gtk!5759
2023-03-31 23:52:01 +00:00
Matthias Clasen
a1c5a806b3 Convert headers to #pragma once
The conversion was done by guard2one.
2023-03-31 15:11:10 -04:00
Georges Basile Stavracas Neto
b1a8c0e686 gsk/vulkan/renderpass: Factor out node implementations
This is mostly a cosmetic change, and the goal is twofold:

 1. Make it easier to spot unimplemented render node types; and
 2. Prepare for a small rework

The implementation for each node now lives in specific functions,
like the GL renderer; unlike the GL renderer, however, we use a
node type vtable to map GskRenderNodeType → implementation. Render
node without an implementation map to NULL, and use the fallback
implementation. Render nodes that fail any check and return FALSE
also use fallback implementation.
2023-03-31 14:00:33 -03:00
Benjamin Otte
515f39f161 Merge branch 'wip/otte/for-main' into 'main'
various fixes

See merge request GNOME/gtk!5756
2023-03-31 15:58:03 +00:00
Benjamin Otte
dbff49b5a7 listbase: Clear any newly set adjustments
The scrolling code assumes the adjustment values are up to date or
it crashes and before we've run size_allocate() we haven't update them.

Fixes a crash in the gtk-demo scrollinfo that would set the adjustments
with random values (via ScrolledWindow.set_child()) and then scroll in a
tick callback right before the (first) size_allocate().
2023-03-31 17:35:48 +02:00
Benjamin Otte
6f4175345f widget: Shortcut widget not repositioning
If a widget doesn't move positions during gtk_widget_reposition(),
detect it early.

This is especially beneficial in the inspector.
2023-03-31 17:35:48 +02:00
Matthias Clasen
bd29bed785 Merge branch 'gbsneto/easy-vulkan-fixes' into 'main'
Easy Vulkan cleanups and fixes

See merge request GNOME/gtk!5753
2023-03-31 13:25:30 +00:00
Alexander Shopov
cf2c955b12 Update Bulgarian translation
(cherry picked from commit 3458ebf8c9)
2023-03-31 10:04:32 +00:00
Matthias Clasen
ad8684431e Merge branch 'more-property-notification' into 'main'
filedialog: Make filters nullable

See merge request GNOME/gtk!5755
2023-03-31 01:54:52 +00:00
Matthias Clasen
4e17900b9a testsuite: Check more property notification
Handle more value types.
2023-03-30 21:39:55 -04:00
Matthias Clasen
fdce10fb96 Make adjustment setters behave 2023-03-30 21:39:55 -04:00
Matthias Clasen
3b96b053ad models: Fix up property notifications
We were emitting redundant notifications
for the ::model property.
2023-03-30 20:18:19 -04:00
Matthias Clasen
82b188c8fb filedialog: Make filters nullable
It should be possible to reset a property
to its default value.
2023-03-30 20:17:28 -04:00
Matthias Clasen
ef45004d14 Merge branch 'more-notify-tests' into 'main'
testsuite: Clean up some exclusions

See merge request GNOME/gtk!5752
2023-03-30 23:34:48 +00:00
Benjamin Otte
8566622748 Merge branch 'gbsneto/wayland-buffer-scale-creation' into 'main'
gdk/wayland/surface: Track and apply buffer scale

See merge request GNOME/gtk!5751
2023-03-30 21:59:45 +00:00
Matthias Clasen
577195a243 Make widget property setters behave
We want to allow setting a property to its
current value, while still having a precondition
for widget->parent being NULL otherwise.
2023-03-30 17:32:38 -04:00
Georges Basile Stavracas Neto
6e80c8b07e gdk/vulkancontext: Accept Khronos validation layers
The Lunarg validation layers seem to have been deprecated in favour
of the Khronos ones. There's no reason not to have both, to accept
loading both - simultaneously, even.
2023-03-30 17:13:35 -03:00
Georges Basile Stavracas Neto
c85599e2e8 gsk/vulkanglyphcache: Cleanup maths
A trivial cleanup to match what the GL renderer does
2023-03-30 17:13:35 -03:00
Georges Basile Stavracas Neto
981e94505c vulkan/glyphcache: Add padding around ink rect
This is what the GL renderer does, and it gets rid of the cutout
characters.
2023-03-30 17:13:35 -03:00
Georges Basile Stavracas Neto
c0449e3245 gdk/vulkancontext: Pass all painted rects
Instead of passing a single, potentially massive rectangle that is
just the extents of the damage rect, collect and pass all damage
rects individually.
2023-03-30 17:13:35 -03:00
Georges Basile Stavracas Neto
8217b6e484 gdk/wayland/surface: Track and apply buffer scale
Add a new flag to track whether buffer scale is dirty or not,
and centralize calling wl_surface_set_buffer_scale() in a single
place: gdk_wayland_surface_sync_buffer_scale().

gdk_wayland_surface_sync_buffer_scale() is only called by
gdk_wayland_surface_sync(), which itself is called by the GL,
Vulkan, and Cairo contexts, right before submitting a frame.
This ensure that each frame has an up-to-date buffer scale.

This mimics how opaque and input regions are tracked.
2023-03-30 16:32:50 -03:00
Matthias Clasen
2650c4e974 testsuite: Check more property notification
We can easily check some object types
such as widgets.
2023-03-30 14:13:19 -04:00
Matthias Clasen
87f9e8a4c1 testsuite: Clean up some exclusions
Drop some exclusions from the notify test.
The tests work fine for these objects.
2023-03-30 14:13:19 -04:00
Matthias Clasen
54b895341c listitem: Fix a notification problem
We were notifying ::item when ::child is
changed. Oops
2023-03-30 14:13:19 -04:00
Lukáš Tyrychtr
878b80806e a11y: Set ATSPI_STATE_SHOWING for all widgets, not only for windows
According to the at-spi2 docs, for a widget to be considered visible,
it needs both the showing and visible states. Many applications rely on that,
for example the flat review functionality of Orca.

this fixes #5194
2023-03-30 10:07:36 +02:00
Matthias Clasen
5ee0e19568 Merge branch 'matthiasc/for-main' into 'main'
emojichooser: Stop using gtk_widget_get_allocation

See merge request GNOME/gtk!5749
2023-03-30 02:45:56 +00:00
Matthias Clasen
fc573491b2 emojichooser: Stop using gtk_widget_get_allocation
Replace all uses with gtk_widget_compute_bounds.
2023-03-29 21:14:24 -04:00
Matthias Clasen
5e9405887e Merge branch 'fix-popover-positioning' into 'main'
wayland: Fix corner cases in positioning

See merge request GNOME/gtk!5741
2023-03-29 20:12:29 +00:00
Matthias Clasen
49778fda3e Merge branch 'matthiasc/for-main' into 'main'
Add some more keysyms tests

See merge request GNOME/gtk!5745
2023-03-29 12:05:58 +00:00
Matthias Clasen
dbefc330bd Add some more keysyms tests
Spot-check a few keypad symbols.
2023-03-29 07:35:24 -04:00
Matthias Clasen
31ebe42d2e testsuite: Update a test
cacecd2fb5 changed a warning message that
some tests check for. Oops.
2023-03-29 07:34:27 -04:00
Benjamin Otte
8fd526a194 Merge branch 'wip/otte/filechooser-fixes' into 'main'
filechooser fixes

See merge request GNOME/gtk!5746
2023-03-29 11:28:28 +00:00
Benjamin Otte
1449e487d3 Merge branch 'wip/otte/node-naming' into 'main'
node format: Allow naming textures and nodes

See merge request GNOME/gtk!5740
2023-03-29 11:28:15 +00:00
Benjamin Otte
889870546f filechoosercell: Remove position property
Instead, query the position from the listitem
2023-03-29 10:42:49 +02:00
Benjamin Otte
82e308b635 filechoosercell: Remove selected property
Instead, query the selected state from the listitem.
2023-03-29 10:42:49 +02:00
Benjamin Otte
0834dc50aa filechooser: Select via action
Don't fudge around poking through the listview, trying to get a model
and selecting it directly. Instead, use the proper way and activate the
"listitem.select" action.
2023-03-29 10:42:49 +02:00
Benjamin Otte
cbef6a9258 listbase: Select via action
Instead of directly calling select_item(), trigger the select-item
action of the focused child.

We do this convoluted calling into the widget because that way
GtkListItem::selectable gets respected, which is what one would expect.

Plus, this code is usually triggered via keybindings, and this way the
ListBase keybindings work identical to the ListItem keybindings.
2023-03-29 10:42:49 +02:00
Matthias Clasen
c5a53f235a Merge branch 'wip/otte/trelistmodel-fixage' into 'main'
treelistmodel: Don't add items in reverse

Closes #5707

See merge request GNOME/gtk!5744
2023-03-29 02:23:46 +00:00
Benjamin Otte
47ba29bc14 docs: Document additions to the node format 2023-03-29 03:53:52 +02:00
Benjamin Otte
9dd050ff30 testsuite: Add parsing tests for node and texture naming 2023-03-29 03:53:52 +02:00
Benjamin Otte
0d6a6a5997 rendernodeparser: Detect duplicates and print them by name
If we encounter a node or texture the 1st time and they are going
to be used again, give them a name.

Then, when encountering them again, print them by name instead
of duplicating them.
2023-03-29 03:53:52 +02:00
Benjamin Otte
5a0c4de07f rendernodeparser: Add support for reusing nodes
We extend the syntax for nodes from:
  <node-type> { ... }
to
  <node-type> { ... }
  <node-type> <string> { ... }
  <string>;
where the first is the same as before, the 2nd defines a named node and
the last references a previously defined node.
Or to give an example:
  color "node" {
    bounds: 0 0 10 10;
    color: red;
  }
  transform {
    bounds: 20 0 10 10;
    child: "node";
  }
This will draw the red box twice, once at (0,0) and once at
(20,0).

The intended use for this is both shortening generated node files as
well as allowing to write tests that reuse nodes, in particular when
dealing with caches.
2023-03-29 03:53:52 +02:00
Benjamin Otte
348a68599a rendernodeparser: Add support for reusing textures
We extend the syntax for textures from just:
  <url>
to
  [<string>] <url>
  <string>
where the first defines a named texture while the second references a
texture.
Or to give an example:
  texture {
    bounds: 0 0 10 10;
    texture: "foo" url("foo.png");
  }
  texture {
    bounds: 20 0 10 10;
    texture: "foo";
  }
This will draw the texture "foo.png" twice, once at (0,0) and once at
(20,0).

The intended use for this is both shortening generated node files as
well as allowing to write tests that reuse textures, in particular when
mixing them in texture and texture-scale nodes.
2023-03-29 03:53:52 +02:00
Benjamin Otte
8590b1ef11 rendernodeparser: Add a Context object
... and pass it through all the parsing functions.

So far it's unused, this is just the plumbing.
2023-03-29 03:53:52 +02:00
Benjamin Otte
d1f27c281d rendernodeparser: Split out a function
This code was copy/pasted, so unify it.
2023-03-29 03:53:52 +02:00
Benjamin Otte
76ff2f5410 rendernodeparser: Emit error when failing to resolve URL 2023-03-29 03:53:52 +02:00
Benjamin Otte
1605b07ff5 rendernodeparser: Failing to parse a string is an error
Testcase included.
2023-03-29 03:53:52 +02:00
Benjamin Otte
cc9de42e70 testsuite: Fix broken test
The test was referencing a nonexisting image.

Plus, node parsing cannot reference relative URLs.
2023-03-29 03:53:52 +02:00
Kévin Commaille
cd860beb38 Add a test for splicing treelistmodel 2023-03-29 03:32:51 +02:00
Benjamin Otte
1718db144e treelistmodel: Don't add items in reverse
This was broken since commit bf55685000
where we started to track items.

Fixes #5707
2023-03-29 03:32:48 +02:00
Matthias Clasen
65dc4cac86 wayland: Fix corner cases in positioning
We were not handling some cases correctly.
This was making the dropdown in the gtk-demo
image-scaling demo appear in the top left
corner.
2023-03-28 20:37:54 -04:00
Matthias Clasen
ea572227f0 Merge branch 'wayland-popup-anchor' into 'main'
wayland: Comply with protocol requirements

See merge request GNOME/gtk!5723
2023-03-28 15:36:34 +00:00
Alexandre Franke
ac96384260 Update French translation 2023-03-28 10:25:01 +00:00
Matthias Clasen
db9883584d Merge branch 'matthiasc/for-main' into 'main'
gdk: Improve logging for backends

Closes #5704

See merge request GNOME/gtk!5737
2023-03-28 10:19:31 +00:00
Matthias Clasen
435bc70886 Merge branch 'sumibi-yakitori/fix-texture-filter' into 'main'
glrenderer: Fix to prevent creation of GL_TEXTURE_MAG_FILTER filters with incorrect values

See merge request GNOME/gtk!5729
2023-03-28 02:17:39 +00:00
Matthias Clasen
a8d8724a02 gdk: Avoid a pointless indirection
Don't use g_fprintf if GLib is using system printf
anyway.
2023-03-27 21:56:41 -04:00
Matthias Clasen
a2d20a5dc0 docs: Some tweaks 2023-03-27 21:55:36 -04:00
Matthias Clasen
cacecd2fb5 Improve an error message
We were producing a misleading error message
when gtk_init() fails.

Fixes: #5704
2023-03-27 21:44:56 -04:00
Matthias Clasen
321877e94b gdk: Improve logging for backends
Log more when trying backends.
2023-03-27 21:42:10 -04:00
Benjamin Otte
ffb5d129f9 Merge branch 'wip/otte/for-main' into 'main'
clenaup

See merge request GNOME/gtk!5736
2023-03-27 22:28:07 +00:00
Benjamin Otte
51e3a1c7d2 columnviewcell: Remove root/unroot stuff
Instead, do that work on creation/dispose.

This is a followup to 3fb10ff2d8.
2023-03-27 23:37:01 +02:00
Benjamin Otte
706e1c2f6f columnviewcell: Remove "visible" property setting
Since 7ad693f865 we only create cells for
visible rows and don't just toggle visibility.

This is a leftover from that change.
2023-03-27 23:37:01 +02:00
Benjamin Otte
a44847e81e enums: Move G_END_DECLS to the end of the file 2023-03-27 23:37:01 +02:00
Matthias Clasen
68d629f84d Merge branch 'bilelmoussaoui/gi-docs' into 'main'
docs: Fix various broken links

See merge request GNOME/gtk!5734
2023-03-27 19:53:33 +00:00
Matthias Clasen
f002e23a37 Merge branch 'wip/reset-repositioned-after-handling' into 'main'
wayland/popup: Handle late received reposition feedback

See merge request GNOME/gtk!5735
2023-03-27 19:51:47 +00:00
Bilal Elmoussaoui
d1c43b94ef docs: Fix various broken links 2023-03-27 21:29:08 +02:00
Jonas Ådahl
c88f2caa04 wayland/popup: Handle late received reposition feedback
If we map, reposition, unmap, remap, the reposition feedback from the
last time a popup was mapped might be received while we're dealing with
the new version of the popup. At this point, the old reposition token
has no meating, so lets drop it. Also reset the reposition tokens when
creating new protocol objects, so that the reposition token are as if
we're in the initial state.

This fixes an issue where we'd get stuck if repeatedly smashing a button
that'd create popups that'd immediately get dismissed by the compositor.
2023-03-27 21:27:44 +02:00
Emmanuele Bassi
506206e1bd Merge branch 'ebassi/compute-size-annotation' into 'main'
Remove wrong annotation for GdkToplevel::compute-size

See merge request GNOME/gtk!5725
2023-03-27 11:43:34 +00:00
Matthias Clasen
cb298fbe23 Merge branch 'wayland_display' into 'main'
wayland: Try to open the display even if XDG_RUNTIME_DIR is unset

See merge request GNOME/gtk!5732
2023-03-27 11:38:14 +00:00
Ludovico de Nittis
d2672db648 wayland: Try to open the display even if XDG_RUNTIME_DIR is unset
Since Wayland 1.15, it is now possible to use absolute paths in
"WAYLAND_DISPLAY".
In that scenario, having a valid "XDG_RUNTIME_DIR" is not a requirement
anymore.

For this reason we remove the "XDG_RUNTIME_DIR" check and we let
`wl_display_connect()` decide if our environment is correct.

Signed-off-by: Ludovico de Nittis <ludovico.denittis@collabora.com>
2023-03-27 11:53:57 +02:00
Benjamin Otte
3008f4babc Merge branch 'wip/otte/listview-inert' into 'main'
listview: Add concept of inertness

See merge request GNOME/gtk!5731
2023-03-27 05:48:12 +00:00
Benjamin Otte
aba1be6faf gridview: Add concept of inertness
An inert gridview is a gridview that does not use the factory. This
allows faster updates because no calls into user code need to happen.

A gridview is inert when either:
 - It is not rooted.
 - It is not visible.
 - No factory is set (that one is obvious)

The gridview does not need to be inert without a model, as that case is
handled by the item manager.

This should allow Nautilus to keep both the gridview and the columnview
around, and just gtk_widget_hide() the unused widget.

The code for now does not disable the item manager, as some
functionality of the item manager is required to allow setting scroll
positions and such.
But that is a place where more gains could be found if profiling showed
that was useful to do.
2023-03-27 07:08:44 +02:00
Benjamin Otte
62e9d1e470 listview: Add concept of inertness
An inert listview is a listview that does not use the factory. This
allows faster updates because no calls into user code need to happen.

A listview is inert when either:
 - It is not rooted.
 - It is not visible.
 - No factory is set (that one is obvious)

The listview does not need to be inert without a model, as that case is
handled by the item manager.

This should allow Nautilus to keep both the gridview and the columnview
around, and just gtk_widget_hide() the unused widget.

The code for now does not disable the item manager, as some
functionality of the item manager is required to allow setting scroll
positions and such.
But that is a place where more gains could be found if profiling showed
that was useful to do.
2023-03-27 07:08:44 +02:00
Benjamin Otte
3fb10ff2d8 listfactorywidget: Stop trying to be smart
The widget would teardown the factory on unroot to avoid unnecessary
work when it isn't shown.

However, recycling may reposition widgets, and repositioning widgets
does a unroot/root.

We don't want to recycle widgets then.
2023-03-27 07:08:44 +02:00
Benjamin Otte
924fd195ab gtk-demo: Set tab behavior for settings demo 2023-03-27 07:08:44 +02:00
Benjamin Otte
66cb79f62e magnifier: Don't check for visibility
gtk_widget_queue_draw() already does that.
2023-03-27 07:08:44 +02:00
sumibi-yakitori
cf9c49dcb1 glrenderer: Fix to prevent creation of GL_TEXTURE_MAG_FILTER filters with incorrect values 2023-03-27 04:53:04 +09:00
Benjamin Otte
8cf3a95d8c Merge branch 'wip/otte/tab-behavior' into 'main'
listview: Add ::tab-behavior to list widgets

See merge request GNOME/gtk!5710
2023-03-26 19:10:29 +00:00
Benjamin Otte
0f55defe56 columnview: Add GtkColumnView::tab-behavior
Also make sure that GTK_LIST_TAB_CELL works by implementing support for
it in the row widget.
2023-03-26 20:29:47 +02:00
Benjamin Otte
8b0731b34f gridview: Add GtkGridView::tab-behavior 2023-03-26 20:29:47 +02:00
Benjamin Otte
c0ca71e9f4 listview: Add GtkListView::tab-behavior
The implementation lives (as always) in GtkListBase.

This is a feature request from the Nautilus developers, who currently do
some hacks to emulate that behavior and it apparently only breaks
sometimes.
2023-03-26 20:29:47 +02:00
Matthias Clasen
c86cf6340e Merge branch 'scrolled-window-signal-disconnnect' into 'main'
scrolledwindow: Disconnect the right handler

Closes #5684

See merge request GNOME/gtk!5726
2023-03-26 15:15:49 +00:00
Matthias Clasen
844a4bab8d scrolledwindow: Disconnect the right handler
We connect gtk_scrolled_window_update_use_indicators
as signal handler in realize(), but we were disconnecting
gtk_scrolled_window_sync_use_indicators in unrealize.

Spotted by Milan Crha.

Fixes: #5684
2023-03-26 10:57:01 -04:00
Emmanuele Bassi
8dddddfe8c Remove wrong annotation from GdkDragSurface::compute-size
Just like GdkToplevel::compute-size, the size argument of the signal is
given to the handlers by GDK; it's not an out argument meant to be
allocated by the caller.
2023-03-26 15:50:22 +01:00
Emmanuele Bassi
a08c31e71f Remove wrong annotation for GdkToplevel::compute-size
The size argument is passed to the signal by the GDK surface machinery,
as is: it's not going to be allocated by the caller (since it's a
signal), and it's not an out argument.
2023-03-26 15:48:44 +01:00
Matthias Clasen
3cdb639210 Merge branch 'wayland-startup-notification-crash' into 'main'
wayland: Don't crash without xdg_activation_v1

Closes #5701

See merge request GNOME/gtk!5724
2023-03-26 14:36:57 +00:00
Matthias Clasen
3a5282abe1 wayland: Don't crash without xdg_activation_v1
If the compositor does not support this protocol,
we can't use it.

Fixes: #5701
2023-03-26 10:11:14 -04:00
Matthias Clasen
b81f9d3f94 wayland: Comply with protocol requirements
If you send a bad anchor rect to mutter, it crashes.
Thats not great, so lets not do that.
2023-03-26 09:47:46 -04:00
Matthias Clasen
a70b85ef76 Merge branch 'wayland-cursor-size' into 'main'
wayland: Don't crash on cursor size 0

Closes #5700

See merge request GNOME/gtk!5721
2023-03-26 01:01:04 +00:00
Benjamin Otte
e27b3f1eae Merge branch 'wip/otte/for-main' into 'main'
popover: Fix typo

See merge request GNOME/gtk!5720
2023-03-26 00:26:31 +00:00
Matthias Clasen
7adbbe6f35 wayland: Don't crash on cursor size 0
The cursor-theme-size setting is documented as
'0 means the default size'. Make it so by using
size 24 if we see a 0. Its better than crashing.

Fixes: #5700
2023-03-25 20:25:51 -04:00
Benjamin Otte
5973df22aa gtk-demo: Rename dropdown demo
It's the listview selections demo, so use that name.
2023-03-26 01:06:18 +01:00
Benjamin Otte
32ff37f070 gtk-demo: Rename image scaling demo to image_scaling
This just means renaming the C file, but it makes --run=image_scaling
actually do what I'd expect.
2023-03-26 01:02:17 +01:00
Benjamin Otte
da9b19804d popover: Fix typo
The typo causs gnome-shell to crah, which is somewhat suboptimal.

It was introduced in 1a9c7a4b1f.
2023-03-26 01:02:17 +01:00
Matthias Clasen
13b0ed08a3 Merge branch 'coordinate-docs' into 'main'
docs: Add some cross references

See merge request GNOME/gtk!5719
2023-03-25 21:21:00 +00:00
Matthias Clasen
a9e37c6f2c Incorporate review feedback 2023-03-25 16:22:45 -04:00
Matthias Clasen
3d35b848d1 docs: Use our own box model illustration
This one has a dark mode too.
2023-03-25 16:16:34 -04:00
Matthias Clasen
de3b37d80c Tweak 2023-03-25 15:29:55 -04:00
Matthias Clasen
1e5dd5db71 Tweak 2023-03-25 15:27:23 -04:00
Matthias Clasen
7bd0fbb47e More review feedback 2023-03-25 15:26:33 -04:00
Matthias Clasen
0efd6cd23e docs: Add another cross reference
Refer to the new coordinate system overview
from the GdkEvent docs.
2023-03-25 15:06:19 -04:00
Matthias Clasen
2e26932925 docs: Apply review feedback
Clarify some points in the coordinate overview.
2023-03-25 15:05:28 -04:00
Matthias Clasen
0b3c979719 Docs: Cosmetics
Align section heading better. Now they all follow
the "Using GTK..." pattern.
2023-03-25 12:17:20 -04:00
Matthias Clasen
653749e4ae docs: Add some cross references
Refer to the new coordinate system overview
from a couple of places where it is useful.
2023-03-25 12:16:51 -04:00
Matthias Clasen
63ed2a13bf docs: Add a section about coordinate systems 2023-03-25 12:10:58 -04:00
Matthias Clasen
3f93a51146 Merge branch 'deprecate-translate-coordinates' into 'main'
Deprecate gtk_widget_translate_coordinates

Closes #5697

See merge request GNOME/gtk!5717
2023-03-25 14:33:14 +00:00
Matthias Clasen
78c8e58ee8 Drop gtk_widget_get_surface_allocation
This private api is confusing, and no longer used.
2023-03-25 10:14:35 -04:00
Matthias Clasen
cf03552b04 entrycompletion: Stop using gtk_widget_get_surface_allocation
We only need the width of the widgets' bounds
here anyway, so just use gtk_widget_compute_bounds.
2023-03-25 10:14:35 -04:00
Matthias Clasen
1a9c7a4b1f popover: Stop using gtk_widget_get_surface_allocation
The function is going away, and the computation
here was wrong anyway. Instead, add a helper that
properly computes the pointing-to rect in surface
coordinates and use it everywhere.
2023-03-25 10:14:35 -04:00
Matthias Clasen
b23ac5c8da Deprecate gtk_widget_translate_coordinates
Update all (non-deprecated) callers to use
gtk_widget_compute_point instead.

Fixes: #5697
2023-03-25 10:14:35 -04:00
Matthias Clasen
1ba5ea60cb Merge branch 'matthiasc/for-main' into 'main'
testsuite: Add some GL texture tests

See merge request GNOME/gtk!5715
2023-03-25 13:59:06 +00:00
Matthias Clasen
81e61b9abf Merge branch 'popover-bounds-trouble' into 'main'
textview: Give the magnifier correct coordinates

Closes #5695

See merge request GNOME/gtk!5716
2023-03-24 22:59:05 +00:00
Matthias Clasen
d2693ba66e magnifier: Correct position of area
The widget paintable uses the widgets bounds
as intrinsic size, so we need to offset from
that to the allocation, which is what the
coordinates are relative to.
2023-03-24 16:05:32 -04:00
Matthias Clasen
9db08c7a86 texthandle: Correct placement of handles
Text handles had the same problem as popovers.
They were interpreting their pointing-to rectangle
relative to the widgets bounds, when it is meant
to be relative to the widgtets allocation.

While we touch this code, rewrite it to use
gtk_widget_compute_point.
2023-03-24 16:05:05 -04:00
Matthias Clasen
fb3fe7a353 popover: Correct placement of popovers
When we don't have a pointing-to rectangle, we want to place
the popover wrt to the parents bounds. But if we have a
pointing-to rectangle, it is relative to the widgets allocation,
which is different from the bounds.

We were not handling the second case correctly, leading to context
menus in the text view being mispositioned by the widgets CSS padding.

While we are touching this code, rewrite it to handle transforms.

Fixes: #5695
2023-03-24 15:57:17 -04:00
Matthias Clasen
644b8a4214 testsuite: Add some GL texture tests
Tests creation and upload/download of GL
textures in various contexts.
2023-03-24 13:57:16 -04:00
Matthias Clasen
a8b92935d9 testsuite: Cosmetics 2023-03-24 13:57:16 -04:00
Matthias Clasen
c51387d62b Merge branch 'matthiasc/for-main' into 'main'
Fix up criticals from GdkGLTexture

See merge request GNOME/gtk!5712
2023-03-24 15:53:55 +00:00
Chun-wei Fan
d209f55677 Merge branch 'alternative-fix-5685' into 'main'
GDK/Win32: Use wgl* functions directly as needed (fix #5685)

Closes #5685

See merge request GNOME/gtk!5702
2023-03-24 15:30:01 +00:00
Matthias Clasen
5c558c0091 Fix up criticals from GdkGLTexture
I broke this in 4291f27b56.
I overlooked that there may not be a current context.
2023-03-24 11:29:38 -04:00
Matthias Clasen
a83f36f4f6 Merge branch 'matthiasc/for-main' into 'main'
docs: Some updates

See merge request GNOME/gtk!5711
2023-03-24 14:45:35 +00:00
Matthias Clasen
f0a2d77e0f docs: Improve markup for keys
Consistently use <kbd>x</kbd> to render keys in the docs
and use + for key combinations.
2023-03-24 10:30:07 -04:00
Matthias Clasen
ce983c9495 docs: Some updates
Fix some links ot point to docs.gtk.org.
2023-03-24 08:56:06 -04:00
Matthias Clasen
91b19854c4 inspector: Cosmetics 2023-03-24 08:17:51 -04:00
Chun-wei Fan
b5ebe270c3 gtkgstsink.c: Drop workarounds needed for Windows
Since we are making GdkGLContext call the core wgl*() functions directly
instead of via libepoxy, drop the workarounds that we needed for notifying
libepoxy that wglMakeCurrent() outside of GDK/GTK was called.

This way, we clean up the code, and as a result, we can use the GstGL
APIs like the other platforms to query what GL api that is to be used.

For ensuring that things work between different threads, we now call
gdk_gl_context_clear_current() in place of calling wglMakeCurrent(xxx,
NULL), so that we make sure that there is no current GL context on a
thread outside of GstGL's thread, which Windows does not like.
2023-03-24 18:50:49 +08:00
Chun-wei Fan
627ee674e5 GDK-Win32: Add wrapper functions for calling core wgl* functions
We might be dealing with GL contexts from different threads, which have more
gotchas when we are using libepoxy, so in case the function pointers for
these are invalidated by wglMakeCurrent() calls outside of GTK/GDK, such as
in GstGL, we want to use these functions that are directly linked to
opengl32.dll provided by the system/ICD, by linking to opengl32.lib.

This will ensure that we will indeed call the "correct" wgl* functions that
we need.

This should help fix issue #5685.
2023-03-24 18:43:23 +08:00
Benjamin Otte
a8b211ff15 Merge branch 'wip/otte/for-main' into 'main'
listview: Activatable means activate

See merge request GNOME/gtk!5709
2023-03-24 05:18:08 +00:00
Benjamin Otte
8c0152a1af columnview: Don't infloop when a cell is grab_focus()ed
Whoopsie.

Broken since 30d4629043.
2023-03-24 05:43:13 +01:00
Benjamin Otte
bbfaebd1cd listview: Activatable means activate
Fix a typo that prevented activatable widgets from activating since the
refactoring in 608be08b0d.
2023-03-24 05:43:13 +01:00
Matthias Clasen
65acf8500f Merge branch 'mipmap-tracking' into 'main'
gsk: Avoid copying GL texture in more cases

See merge request GNOME/gtk!5704
2023-03-24 03:43:21 +00:00
Matthias Clasen
22ea1af569 gsk: Avoid copying GL texture in more cases
When the GL texture already has a mipmap, we don't
have to download and reupload it to generate one.

We differentiate the handling for texture scale nodes,
where we do want to force the mipmap creation even if
it requires us to reupload the GL texture, and plain
texture nodes, where we just take advantage of a
preexisting mipmap to allow trilinear filtering for
downscaling, or create one if we have to upload the
texture anyway.
2023-03-23 23:17:54 -04:00
Matthias Clasen
7cb7e0ab35 gl: Add a private way to query mipmap status
Make GdkGLTexture determine if the texture has
a mipmap, and provide private API to query this
information.

This check is done in gdkgltexture.c instead of
gskgldriver.c, since we're already binding the
texture here for other reasons, so it is easy
to query a few more things.
2023-03-23 23:16:54 -04:00
Matthias Clasen
48491c6a04 Merge branch 'check-widget-on-destruction' into 'main'
gtkwidget: Do a type-check in gtk_widget_in_destruction()

See merge request GNOME/gtk!5708
2023-03-24 03:03:31 +00:00
Matthias Clasen
4291f27b56 gltexture: Try harder to determine the format
We can query these things as long as the texture ID
is valid in the current context.
2023-03-23 22:56:06 -04:00
Marco Trevisan (Treviño)
07197a299f gtkwidget: Do a type-check in gtk_widget_in_destruction()
Given it can be called during a widget destruction, it's safer to do a
type-check before crashing.

See: https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/1727
2023-03-24 03:31:07 +01:00
Boyuan Yang
3dc0ee7483 Update Chinese (China) translation 2023-03-23 18:46:30 +00:00
Emmanuele Bassi
9f4013c5b4 Merge branch 'fix-a11y-leak2' into 'main'
Don't leak all AT contexts

Closes #5690

See merge request GNOME/gtk!5700
2023-03-23 11:07:18 +00:00
Benjamin Otte
4e9369585d Merge branch 'wip/otte/listview-cleanups' into 'main'
listview refactoring and new stuff

See merge request GNOME/gtk!5701
2023-03-23 05:38:29 +00:00
Benjamin Otte
30d4629043 columnview: Handle focus movement properly
- grab_focus() on a row (happens with scroll_to()) keeps the focus
  column intact if possible.
- <Tab> and <Shift-Tab> move through the cells in order, and move
  to the next row when at the end.
- <Up> an <Down> move to the next/prev row, keeping the same column
  focused.
- <Left> and <Right> move to the prev/next cell, if one is available.
  If not, they stay where they are.
2023-03-23 04:51:50 +01:00
Benjamin Otte
78e72ad1de columnview: add a (private) focus-column
Make setting the focus column scroll to it, too.
2023-03-23 04:51:20 +01:00
Benjamin Otte
8e17abb8fe columnviewrowwidget: Handle left/right arrow keys
Make it move focus just like GtkWindow would.

Otherwise the listview will (try to) handle it and move focus between
cells - which doesn't do anything for lists and only works with grids.
2023-03-23 04:45:03 +01:00
Benjamin Otte
fa7a5773d4 listbase: Only grab_focus() if the cursor moved
If there is no movement, grab_focus() on the already focused widget
just causes weird inconsistencies and we don't want those.
2023-03-23 04:45:03 +01:00
Benjamin Otte
7285830dfb columnviewrow: Handle focus movement properly
Handle backwards tab properly and deal with left right arrows.
2023-03-23 04:45:03 +01:00
Benjamin Otte
817732ded9 listitemwidget: Only take a single child 2023-03-23 04:45:03 +01:00
Benjamin Otte
3a6bfe9e9d columnviewrowwidget: Drop unneeded stuff
Also remove the GtkColumnListItemFactory and GtkColumnViewLayout
objects by folding them into GtkColumnViewRowWidget.
2023-03-23 04:45:03 +01:00
Benjamin Otte
bea7d5d318 columnview: Add GtkColumnViewRowWidget
This is a copy/paste of GtkListItemWidget for now.

Modifications will happen in future commits.
2023-03-23 04:45:03 +01:00
Benjamin Otte
608be08b0d listview: Add private GtkListFactoryWidget
This is a split of GtkListItemWidget into the generic parts of factory
using widgets.

On top of it there's GtkListItemWidget, which takes care of GtkListItem.
2023-03-23 04:45:03 +01:00
Benjamin Otte
107133ec6d listview: Move ::factory out of the item manager
It's a listitemwidget property, and the item manager manages the items,
not the widgets.
2023-03-23 04:45:03 +01:00
Benjamin Otte
4ecda13fbd listview: Move ::single-click-activate out of the item manager
It's a listitemwidget property, and the item manager manages the items,
not the widgets.
2023-03-23 04:45:03 +01:00
Benjamin Otte
ccacf80f47 listitemmanager: Create widgets via vfunc
We now have listitemmanager just create GtkListItemBase objects via
vfunc and use them.
2023-03-23 04:45:03 +01:00
Benjamin Otte
1f3a2734eb listitemwidget: split out GtkListItemBase
There's 2 reasons for this:

1. Adding a custom widget for columnview rows
2. Using this as base class for sections
2023-03-23 04:45:03 +01:00
Benjamin Otte
a18760a094 itemmananger: Remove the user data
Use the widget instead. They're the same anyway.
2023-03-23 04:45:03 +01:00
Benjamin Otte
e85270b051 listbase: Privatize 2 functions
They're not used outside of GtkListBase, so no use to have them in the
header.

Requires moving one function up in the source now that the forward
declaration is missing.
2023-03-23 04:45:03 +01:00
Benjamin Otte
27c01cfa49 listitemmanager: Clean up header
Remove all unused functions and an unused macro.
2023-03-23 04:45:03 +01:00
Matthias Clasen
7b22983be5 Don't leak all AT contexts
create_at_context was confused - it stored a reference
to the newly created context in priv->context, but then
also returned a reference, and the caller stored that
in priv->context again.

Change it to only return a reference.

Fixes: #5690
2023-03-22 23:41:40 -04:00
Matthias Clasen
57ec758d81 Merge branch 'texture-scale-test' into 'main'
gsk: Add a test for scaled textures

See merge request GNOME/gtk!5686
2023-03-23 02:42:28 +00:00
Bruce Cowan
2ab3610df8 Update British English translation
(cherry picked from commit d80cecec06)
2023-03-22 15:46:23 +00:00
Matthias Clasen
724ecf3b51 Merge branch 'ebassi/ensure-file-chooser-types' into 'main'
Ensure GtkFileChooserCell's type

See merge request GNOME/gtk!5696
2023-03-22 10:48:55 +00:00
Emmanuele Bassi
b2e8158c7a Ensure GtkFileChooserCell's type
Otherwise anything that dlopen()'s GTK will have a bad day.

See: https://discourse.gnome.org/t/strange-filechooserdialog-behaviour-in-gtk-4-10/14435
2023-03-22 10:29:57 +00:00
Matthias Clasen
9dcc1943b3 gsk: Improve slice handling
Upload slices in chunks, instead of copying
enormous amounts of memory.
2023-03-22 00:15:32 -04:00
Matthias Clasen
c3ee8d2699 gsk: Add more flexible texture upload
Add a command queue function to create a
GL texture by uploading several GdkTextures
at given positions.
This lets us 'piece together' textures.
2023-03-22 00:15:04 -04:00
Matthias Clasen
24720307bb gsk: Tweak one test to pass
Clip away the problematic corners in this
artificial texture scaling test. The GL renderer
has problems getting them perfect.
2023-03-22 00:15:04 -04:00
Matthias Clasen
50969d7923 gsk: Drop debug code 2023-03-22 00:15:04 -04:00
Matthias Clasen
5de8e9ec6e gsk: Drop some unused arguments
All callers of the slice apis pass 0 for
min_rows and min_cols. So just drop these.
2023-03-22 00:14:43 -04:00
Matthias Clasen
d1fc44d3a6 gsk: Use overlapping slices
Store texture coordinates for each slice
instead of assuming 0,0,1,1, and generate
overlapping slices to allow for proper mipmaps.

This almost fixes trilinear filtering with
sliced textures.
2023-03-22 00:14:43 -04:00
Matthias Clasen
61b9be1c1a gsk: Add a test for scaled textures
GL and cairo disagree on this one, and have forever.
Whee!
2023-03-22 00:14:16 -04:00
Matthias Clasen
8f73a7c690 gsk: Cosmetics 2023-03-22 00:14:16 -04:00
Matthias Clasen
c237957ef0 Merge branch 'matthiasc/for-main' into 'main'
a11y: Add a test for gtk_accessible_role_to_name

See merge request GNOME/gtk!5694
2023-03-22 00:24:52 +00:00
Matthias Clasen
d04690d05c a11y: Add a test for gtk_accessible_role_to_name
This should prevent !5693 from happening again
in the future.
2023-03-21 20:06:37 -04:00
Matthias Clasen
f8bfb5fec2 Merge branch 'fix_gtk_accessible_role_to_name_crash' into 'main'
fix crash with gtk_accessible_role_to_name and GTK_ACCESSIBLE_ROLE_TOGGLE_BUTTON

See merge request GNOME/gtk!5693
2023-03-21 18:05:50 +00:00
Caolán McNamara
2a78734aef fix crash with gtk_accessible_role_to_name and GTK_ACCESSIBLE_ROLE_TOGGLE_BUTTON
presumably since:

commit de80f503e4
Date:   Thu Feb 23 14:22:20 2023 +0100

    a11y: Introduce a dedicated role for toggle buttons
2023-03-21 15:04:12 +00:00
Benjamin Otte
ee6aae93d5 Merge branch 'wip/otte/for-main' into 'main'
checkbutton: Only andle arrow focus if we're in a group

See merge request GNOME/gtk!5692
2023-03-21 13:26:09 +00:00
Benjamin Otte
fb2a17a972 testsuite: Add a treelistmodel test
This one exhaustively tests reusing the same model as a child model for
many nodes.
This tracks that multiple items-changed signals emitted at the same time
(or multiple handlers for one such signal) doesn't put the treelistmodel
in an inconsistent state while it is handling all of them.

I'm not sure this (ab)use of treelistmodel should be officially
supported, but it works today, so let's test it to see if we can keep it
working.
2023-03-21 14:10:17 +01:00
Benjamin Otte
1c64438b12 checkbutton: Only andle arrow focus if we're in a group
If there is no other widget in the group that we can focus, don't focus
and activate ourselves.

Otherwise the arrow keys on checkbuttons toggle the checkbutton.
2023-03-21 14:10:17 +01:00
Matthias Clasen
634bea777f Merge branch 'disabled-picture-opacity-fix' into 'main'
theme: Use 0.5 opacity for disabled pictures

Closes #5683

See merge request GNOME/gtk!5689
2023-03-20 23:06:44 +00:00
Marco Trevisan (Treviño)
a2076dd537 theme: Use 0.5 opacity for disabled pictures
If a GtkImage is using an icon we use a gtk-icon-filter to se the icon
opacity when in insensitive state, however when using other kinds of
pictures we do not apply the same style leading to an inconsistent
result.

Closes: #5683
2023-03-20 23:46:08 +01:00
Matthias Clasen
75f9379cd5 Merge branch 'alatiera/fedora-bump' into 'main'
ci: Use Fedora 38 as the base

See merge request GNOME/gtk!5688
2023-03-20 14:39:15 +00:00
Jordan Petridis
f9b2d3104a vulkan: Update error codes enum 2023-03-20 16:16:30 +02:00
Jordan Petridis
679657cc0f ci: Use Fedora 38 as the base 2023-03-20 16:16:24 +02:00
Matthias Clasen
d712bdcd6d Merge branch 'bilelmoussaoui-main-patch-49195' into 'main'
g-i: Add since annotation to GdkSurfaceSize

See merge request GNOME/gtk!5687
2023-03-20 11:23:21 +00:00
Bilal Elmoussaoui
aa0cd3a553 g-i: Add since annotation to GdkSurfaceSize 2023-03-20 08:14:25 +00:00
Matthias Clasen
244d36d3f4 Merge branch 'mipmap-more' into 'main'
gsk: Use mipmaps when it is beneficial

See merge request GNOME/gtk!5685
2023-03-20 02:04:21 +00:00
Matthias Clasen
a19cf02b16 gsk: Use mipmaps when it is beneficial
If a texture node ends up getting scaled
down a lot, it helps to use trilinear filtering.
2023-03-19 21:45:30 -04:00
Benjamin Otte
56b904f1e6 Merge branch 'wip/otte/for-main' into 'main'
treelistmodel: Clear item in right place

Closes #5681

See merge request GNOME/gtk!5682
2023-03-19 17:07:53 +00:00
Benjamin Otte
dd1e76e601 treelistmodel: Clear item in right place
Items should be cleared when the node is discarded, not when the node's
children are discarded - which can also happen when a node is collapsed.

Fixes an error introduced in 9048e391b6

Fixes #5681
2023-03-19 17:38:38 +01:00
Matthias Clasen
e850dc81ba Merge branch 'texture-scale-tests' into 'main'
node-editor: Embed textures in testcases

See merge request GNOME/gtk!5681
2023-03-19 14:54:34 +00:00
Matthias Clasen
942c8eec73 ci: Make reports for all setups 2023-03-19 10:21:19 -04:00
Matthias Clasen
e7bb7785fa testsuite: Improve setup name consistency
Rename the 'waylandgles' test setup to 'wayland_gles'.
2023-03-19 10:19:00 -04:00
Matthias Clasen
9705ccbe2f ci: Run tests with small textures 2023-03-19 10:16:19 -04:00
Matthias Clasen
ace2122d45 testsuite: Add a test setup for slicing
Add a 'wayland_smalltexture' test setup that forces
the max texture size to be 1024, which lets us test
the texture slicing codepaths.
2023-03-19 10:15:22 -04:00
Matthias Clasen
80730a4014 testsuite: Add some texture tests
In constrast to our other tests, these use
textures that are big enough to force slicing
with setting GSK_MAX_TEXTURE_SIZE, which we
will use in the following commits to improve
test coverage.
2023-03-19 10:05:52 -04:00
Matthias Clasen
0a3eceb15d node-editor: Embed textures in testcases
It is useless to have node files with references
to external files in the testsuite, so turn such
textures into data urls by doing a serialization
roundtrip.
2023-03-19 10:04:46 -04:00
Benjamin Otte
f211a2177f Merge branch 'wip/otte/for-main' into 'main'
Fix inspector doing weird stuff

Closes #5646

See merge request GNOME/gtk!5678
2023-03-19 06:23:46 +00:00
Benjamin Otte
c463685286 treelistmodel: Clarify docs
No user knows that we have an internal function called
gtk_tree_list_row_destroy() that gets called when a row gets removed
from the treelistmodel.

So everyone was probably just making stuff up about what "destroy"
means.

Related: #5646
2023-03-19 06:55:05 +01:00
Benjamin Otte
bf55685000 treelistmodel: Track the item in the row
That way, we can return the item even after the row is removed. This is
particularly relevant in ListItemFactory::unbind callbacks because they
often use gtk_tree_list_row_get_item() and user code never tracks
changes to this property.

A side effect of this is that the item will survive until the row gets
destroyed, but that's what users expect anyway, so we can live with it.

Related: #5646
2023-03-19 06:55:05 +01:00
Benjamin Otte
9048e391b6 treelistmodel: Cache the item
This is a good idea to avoid reentrancy problems when any child model
(or potentially more than one child model) has started emitting
items-changed but the emission hasn't arrived in this model yet.

At tat point, we'd get_item() the wrong item from those models.

We want to avoid such cases of reentrancy.

Related: #5646
2023-03-19 06:55:05 +01:00
Benjamin Otte
f4be5c80c6 cssnode: Refer the correct previous item
We disconnect from old_previous, not from the new previous.

Related: #5646
2023-03-19 06:55:01 +01:00
Matthias Clasen
e8ea1b3c8b Merge branch 'wip/matthiasc/samplers' into 'main'
glrenderer: Handle filters differently

See merge request GNOME/gtk!5676
2023-03-19 01:54:57 +00:00
Benjamin Otte
17c877659c glrenderer: Support GL without samplers
We cheat and just set the texture parameters instead and hope nothing
explodes.
So far it didn't.

This is only needed to support GLES 2.0 so it's quite a limited set of
hardware these days.
2023-03-18 21:33:17 -04:00
Benjamin Otte
b5345b7f25 glrenderer: Handle filters differently
Instead of uploading a texture once per filter, ensure textures are
uploaded as little as possible and use samplers instead to switch
different filters.

Sometimes we have to reupload a texture unfortunately, when it is an
external one and we want to create mipmaps.
2023-03-18 21:33:17 -04:00
Matthias Clasen
b59d45c5c7 Merge branch 'docs-tweaks' into 'main'
dropdown: tweak the docs

See merge request GNOME/gtk!5677
2023-03-18 22:56:22 +00:00
Matthias Clasen
0fb5331c31 docs: Cosmetics 2023-03-18 10:25:58 -04:00
Matthias Clasen
9a7bf66ed4 docs: Tweaks
Tweak the wording in the list widget overview to
fix some typos and make things read more smoothly.
2023-03-18 10:25:58 -04:00
Matthias Clasen
628157e44e dropdown: tweak the docs
Add a link to the list widget overview.
2023-03-18 10:25:58 -04:00
Piotr Drąg
3f5e1589e2 Update POTFILES.in and POTFILES.skip 2023-03-18 12:32:00 +01:00
Matthias Clasen
be8a77171d Merge branch 'matthiasc/for-main' into 'main'
gsk: Drop texture subsetting

See merge request GNOME/gtk!5675
2023-03-18 04:25:25 +00:00
Matthias Clasen
d31ba5f551 gsk: Drop texture subsetting
We don't do this for unfiltered textures either,
and with working slicing, it isn't needed.
2023-03-18 00:10:38 -04:00
Matthias Clasen
fb6e432afb Merge branch 'matthiasc/for-main' into 'main'
Stop binding textdomain for -properties

See merge request GNOME/gtk!5674
2023-03-18 03:55:56 +00:00
Matthias Clasen
ee7c0ed1e8 Stop binding textdomain for -properties
We don't have these translations anymore.
2023-03-17 23:35:45 -04:00
Matthias Clasen
376f1053ec Merge branch 'fix-excessive-texture-uploads' into 'main'
gsk: Avoid reuploading textures too much

See merge request GNOME/gtk!5673
2023-03-18 02:47:04 +00:00
Matthias Clasen
8aa095c4d7 gsk: Avoid reuploading textures too much
When filtering changes for an already-cached
texture, we need to clear the render data
before setting the new one, otherwise it
does not take and we end up reuploading
the texture every frame.
2023-03-17 22:31:10 -04:00
Matthias Clasen
f96d041246 Merge branch 'matthiasc/for-main' into 'main'
gtk4-builder-tool: Localization fixes

See merge request GNOME/gtk!5672
2023-03-18 02:22:43 +00:00
Matthias Clasen
2dc17aeca9 gtk4-builder-tool: Localization fixes
Be consistent about marking strings for
translation. And make locatization actually
work by including gi18n-lib.h instead of gi18n.h.
2023-03-17 22:04:25 -04:00
Danial Behzadi
fda2010a9e Update Persian translation
(cherry picked from commit f55cbf5643)
2023-03-18 01:10:52 +00:00
Matthias Clasen
ac799542ee Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Reset properties when the image changes

See merge request GNOME/gtk!5671
2023-03-17 16:32:28 +00:00
Matthias Clasen
060ab606a2 gtk-demo: Reset properties when the image changes 2023-03-17 11:49:57 -04:00
Matthias Clasen
a1c02161ba Merge branch 'texture-scale-slicing' into 'main'
gsk: Be more careful when slicing

Closes #5664

See merge request GNOME/gtk!5667
2023-03-17 15:44:07 +00:00
Matthias Clasen
3877a2e533 gsk: Drop texture subsetting
We don't do this for unfiltered textures either,
and with working slicing, it isn't needed.
2023-03-17 11:25:38 -04:00
Matthias Clasen
158facc2ca Merge branch 'broadway-disconnect-fix' into 'main'
broadway: Don't cause traffic when disconnecting

See merge request GNOME/gtk!5670
2023-03-17 15:14:44 +00:00
Matthias Clasen
88dd6e630e broadway: Don't cause traffic when disconnecting
The recently added transient-for support was causing
roundtrips when a client with transients disconnects,
leading to assertion failures. Avoid that.
2023-03-17 11:00:35 -04:00
Matthias Clasen
8d839c96d9 Merge branch 'fix-broadway-docs' into 'main'
docs: Update broadway docs

Closes #5662

See merge request GNOME/gtk!5669
2023-03-17 13:17:19 +00:00
Matthias Clasen
31ec095ec7 docs: Update broadway docs
Using Broadway without broadwayd hasn't worked since 2013...

Fixes: #5662
2023-03-17 09:00:10 -04:00
Matthias Clasen
b14a134a46 gsk: Add slicing to texture scale nodes
This makes it possible to use large textures
with filtering.

Fixes: #5664
2023-03-17 00:51:05 -04:00
Matthias Clasen
f3b0aa27ea gsk: Be more careful when slicing
We can only reuse existing slices if they
have the right filtering.
2023-03-17 00:50:01 -04:00
Benjamin Otte
fe2b6dd246 Merge branch 'wip/otte/for-main' into 'main'
Various fixes

Closes #5669

See merge request GNOME/gtk!5665
2023-03-17 00:37:52 +00:00
Benjamin Otte
565c9aed94 Merge branch 'gridview-filler-tile-fix' into 'main'
gridview: Fix condition for adding filler tiles

See merge request GNOME/gtk!5664
2023-03-16 23:50:13 +00:00
Benjamin Otte
9a4decc30f gldriver: Quick workaround for filter mismatch
We should really use texture views or samplers to handle this case for
shared textures, but this at least makes NEAREST not break.
2023-03-17 00:43:21 +01:00
Benjamin Otte
036f5816ac listitem: Claim sequence when handling an event
See my rants on IRC for why we definitely need to claim gestures by
default in GTK5.

Fixes #5669
2023-03-16 22:45:11 +01:00
Алексей Шилин
65b6150e78 gridview: Fix condition for adding filler tiles
Code above ensures that i is always in [0, n_columns - 1] range, so
the condition was always true, which resulted in filler tile always
being added to the grid. As the result, an empty row appeared at the
end of the grid if the number of columns divided the number of items.

Only add filler tile if last row is not full, i.e. when i > 0.
2023-03-17 00:21:09 +03:00
Matthias Clasen
664e3b737a Merge branch 'fix_next_accessible_sibling_after_refcounts' into 'main'
a11y: Fix the logic in gtk_accessible_get_next_accessible_sibling which decided whether we will use the overridden sibling on the context.

See merge request GNOME/gtk!5659
2023-03-16 21:12:20 +00:00
Matthias Clasen
428a2707b5 Merge branch 'label-file-links' into 'main'
label: Use GtkFileLauncher for file URI

Closes #5671

See merge request GNOME/gtk!5661
2023-03-16 21:07:29 +00:00
Benjamin Otte
fbc8bfb303 Merge branch 'wip/otte/for-main' into 'main'
Various small fixes

Closes #5380

See merge request GNOME/gtk!5662
2023-03-16 20:59:17 +00:00
Benjamin Otte
a0382ef495 listview: Fix culling issues when using CSS padding
We were culling children based on the content box, but clipping via
overflow happens on the padding box, so we need to use that one instead.

Fixes issues with items not being visible / disappearing in Nautilus
when they are near the border.

Resolves #5380
2023-03-16 21:40:02 +01:00
Benjamin Otte
ef3c515cf1 rowstrides are gsize, not int
gdk-pixbuf got that wrong, don't repeat that mistake.
2023-03-16 21:40:02 +01:00
Benjamin Otte
707c63c6f9 win32: Fix rowstride math 2023-03-16 21:40:02 +01:00
Matthias Clasen
18f91df7d8 label: Use GtkFileLauncher for file URI
The GtkUriLauncher calls into the openuri portal, which distinguishes
between files, directories, and URI. The GtkFileLauncher contains logic
to deal with this, because it can already handle the file and folder
differences.

If we have a file:// URI it's easier to create a GFile out of it, and
use the GtkFileLauncher API, while leaving the GtkUriLauncher API for
every other URI scheme.

Same fix as de3c1d0c73, for GtkLabel.

Fixes: #5671
2023-03-16 16:06:49 -04:00
Matthias Clasen
cf332e2efa Merge branch 'ebassi/issue-5671' into 'main'
linkbutton: Use GtkFileLauncher for file URI

Closes #5671

See merge request GNOME/gtk!5658
2023-03-16 16:51:29 +00:00
Lukáš Tyrychtr
3addbe23f3 Always drop the reference of the ATContext 2023-03-16 17:15:08 +01:00
Lukáš Tyrychtr
771b7d6caa a11y: Fix the logic in gtk_accessible_get_next_accessible_sibling which
decided whether we will use the overridden sibling on the context.
2023-03-16 15:16:32 +01:00
Emmanuele Bassi
de3c1d0c73 linkbutton: Use GtkFileLauncher for file URI
The GtkUriLauncher calls into the openuri portal, which distinguishes
between files, directories, and URI. The GtkFileLauncher contains logic
to deal with this, because it can already handle the file and folder
differences.

If we have a file:// URI it's easier to create a GFile out of it, and
use the GtkFileLauncher API, while leaving the GtkUriLauncher API for
every other URI scheme.

Fixes: #5671
2023-03-16 12:22:21 +00:00
Guillaume Bernard
bb88f69b20 Update French translation
(cherry picked from commit 904e6a03a5)
2023-03-16 10:24:37 +00:00
Matthias Clasen
d72a6167ed Merge branch 'max-texture-size' into 'main'
gsk: Add a way to limit texture sizes

See merge request GNOME/gtk!5656
2023-03-16 03:03:41 +00:00
Benjamin Otte
fc83d263ab Merge branch 'drag-gl-wayland-hotspot-fix' into 'main'
wayland: Reset pending offset in GL path

See merge request GNOME/gtk!5657
2023-03-15 23:36:44 +00:00
Ivan Molodetskikh
54e36f6b73 wayland: Reset pending offset in GL path
Otherwise GL surfaces that redraw without changing the hotspot have it
applied on top every frame and quickly slide away.

The cairo path and the X11 backend do not have this bug.
2023-03-15 16:11:40 -07:00
Ivan Molodetskikh
8d96b12cc7 testdndresize: Add non-resizing redrawing GL surface
The GL Wayland drag surface code path has a bug where it does not reset
the hotspot, so if a GL-backed draw surface redraws without resizing or
resetting the hotspot, it moves away. The next commit will fix that, but
this commit adds a test for that.
2023-03-15 16:09:51 -07:00
Matthias Clasen
d1256648f4 gsk: Use linear filtering for sliced textures
We use linear for unsliced textures, so we need
to do the same for sliced ones.
2023-03-15 17:50:01 -04:00
Matthias Clasen
2322fecf3b gsk: Fix texture slicing
We were just returning NULL for slices
here, which wasn't the intention.
2023-03-15 15:45:01 -04:00
Matthias Clasen
2e2c41cef6 gsk: Fix handling of large textures
When the texture is too large, actually
shrink the size to max_texture_size.
2023-03-15 15:33:32 -04:00
Matthias Clasen
895d427c6a gsk: Add a way to limit texture sizes
Allow to set max texture size using the
GSK_MAX_TEXTURE_SIZE environment variable.

We only allow to lower the max (for obvious
reasons), and we don't allow values smaller
than 512 (since our atlases use that size).
2023-03-15 14:35:57 -04:00
Matthias Clasen
c2965aed35 Merge branch 'dragsurface-resize' into 'main'
Fix drag surfaces ignoring size updates on Wayland and X11

See merge request GNOME/gtk!5597
2023-03-15 02:59:19 +00:00
Ivan Molodetskikh
11d9bbfd6e x11/surface: Get current drag surface size with compute-size signal
Query and update size of drag surfaces, similarly to how it's done for
the Wayland backend in the previous commit.
2023-03-14 19:41:44 -07:00
Ivan Molodetskikh
f63fc91b0e wayland/dragsurface: Get current size with compute-size signal
GdkDragSurface-backed widgets are not parented to an existing widget,
unlike popovers, and like toplevels. This means that there's nobody to
actively call gdk_drag_surface_present() to update the size, and
GdkDragSurface should do it on its own, just like GdkToplevel.

This commit implements this for the Wayland backend.
2023-03-14 19:41:44 -07:00
Ivan Molodetskikh
e041646bfc dragicon: Handle compute-size
Compute our size when requested by the backend. This makes GtkDragIcons
actually recompute their size when it changes, instead of getting stuck
with the first size and potentially underallocating.
2023-03-14 19:41:44 -07:00
Ivan Molodetskikh
c3dde05d33 dragsurface: Add compute-size signal
Similarly to GdkToplevel, GdkDragSurface's compute-size should be called
by backends to query the current surface size, and should be connected
to by widget implementations (like GtkDragIcon) to report the current
size.

GdkDragSurface-backed widgets are not parented to an existing widget,
unlike popovers, and like toplevels. This means that there's nobody to
actively call gdk_drag_surface_present() to update the size, and
GdkDragSurface should do it on its own, just like GdkToplevel.
2023-03-14 19:41:44 -07:00
Matthias Clasen
45434d501c Add GdkDragSurfaceSize
This helper type will be used in the next commit for a new compute-size
request on GdkDragSurface. It is analogous in spirit to GdkToplevelSize.
2023-03-14 19:41:44 -07:00
Matthias Clasen
b74d483f01 Merge branch 'matthiasc/for-main' into 'main'
gl: Print max texture size in debug output

See merge request GNOME/gtk!5654
2023-03-15 02:32:37 +00:00
Ivan Molodetskikh
cd5af8c0d9 tests: Add resizing drag icon test
The test can verify that dynamic drag icon resizing and hotspot
adjustment work as intended.
2023-03-14 19:31:49 -07:00
Matthias Clasen
9a2cc79286 gl: Print max texture size in debug output
This is useful information.
2023-03-14 22:13:37 -04:00
Matthias Clasen
cc7d996a5c Merge branch 'add_visited_state' into 'main'
a11y: Add GTK_ACCESSIBLE_STATE_VISITED

See merge request GNOME/gtk!5616
2023-03-15 01:24:18 +00:00
Aleksandr Melman
79e7078949 Update Russian translation 2023-03-14 20:47:29 +00:00
Matthias Clasen
53cfbbbb65 Merge branch 'drop-gslice' into 'main'
Drop gslice

See merge request GNOME/gtk!5634
2023-03-14 19:22:28 +00:00
Matthias Clasen
bc592c92be inspector: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
6d380cdfb4 css: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
61d53b6402 tests: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
fe79c7db16 testsuite: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
bcb0882208 modules: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
a36123c802 gtk: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
9f88dba162 gsk: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
98ff6c0d4d gdk: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
15d73a1adb macos: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
6f93baf420 win32: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
5cca7488d4 x11: Stop using g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
83d14bfa98 CODING-STYLE: Drop mention of g_slice 2023-03-14 14:56:42 -04:00
Matthias Clasen
f0c076619d Merge branch 'wip/exalm/boxed-list' into 'main'
theme: Port .boxed-list style from libadwaita

See merge request GNOME/gtk!4806
2023-03-14 18:54:54 +00:00
Benjamin Otte
a05b73cb05 Merge branch 'wip/hadess/children-left-msg' into 'main'
gtk: Fix "children left" warning with fatal warnings

See merge request GNOME/gtk!5652
2023-03-14 16:31:44 +00:00
Alexander Mikhaylenko
b4dc7f29d4 theme: Port .boxed-list style from libadwaita
Consistently use it for boxed lists in inspector and gtk-demo.

Fixes issues like https://gitlab.gnome.org/GNOME/gtk/-/issues/3145
2023-03-14 20:16:51 +04:00
Bastien Nocera
4f1ea18c10 gtk: Fix "children left" warning with fatal warnings
When fatal warnings were turned on, the developer would never see which
widgets were left as children to the widget that triggered the warning as
those were printed in separate g_warning calls.

Print a single warning with all the info so runs with fatal warnings
aren't left without any info.
2023-03-14 16:45:59 +01:00
Matthias Clasen
7c60fb88b0 Merge branch 'matthiasc/for-main' into 'main'
Start 4.12 development

See merge request GNOME/gtk!5651
2023-03-14 15:33:20 +00:00
Matthias Clasen
93edb08094 Start 4.12 development 2023-03-14 11:16:30 -04:00
Martin
7a0e8f2b8b Update Slovenian translation 2023-03-14 12:43:31 +00:00
Matthias Clasen
7ed8c5b6c7 Post-release version bump 2023-03-14 08:16:30 -04:00
Matthias Clasen
d776ad789d 4.10.1 2023-03-14 07:50:49 -04:00
Daniel
86bbc13a61 Updated Spanish translation 2023-03-14 12:43:00 +01:00
Matthias Clasen
664ce48a4c Merge branch 'matthiasc/for-main' into 'main'
gsk: Mark mask nodes as 'supports transforms'

See merge request GNOME/gtk!5650
2023-03-14 05:30:17 +00:00
Matthias Clasen
42f1b623bf css: Small speedups 2023-03-14 01:14:57 -04:00
Matthias Clasen
6b7f0266ac icontheme: Silence a compiler warning 2023-03-14 01:14:57 -04:00
Matthias Clasen
ad84ee8352 tests: Add more tests for texture scale nodes 2023-03-14 01:14:57 -04:00
Matthias Clasen
c035384fc8 gsk: Mark mask nodes as 'supports transforms'
Just like blur nodes, the renderer can handle
these without creating an extra offscreen.
2023-03-14 01:14:57 -04:00
Matthias Clasen
7b1644b2d0 Merge branch 'fix-texture-scale-rotation' into 'main'
gtk4-demo: Polish the image scaling demo

See merge request GNOME/gtk!5649
2023-03-14 05:08:37 +00:00
Benjamin Otte
aaac380053 Merge branch 'bilelmoussaoui-main-patch-31679' into 'main'
GLTexture: Add GL_RGB format support

See merge request GNOME/gtk!5647
2023-03-14 05:03:13 +00:00
Matthias Clasen
dcc6cb8f1c gsk: Fix rotated texture scale nodes
This was causing us to render rotated texture scale
nodes to an unclipped offscreen, bringing 'giant
intermediate texture' problems back.
2023-03-14 05:36:08 +01:00
Matthias Clasen
0c1ec82a74 gtk4-demo: Add a tooltip to image scaling
Show some information about the values.
2023-03-14 05:36:08 +01:00
Matthias Clasen
3eb9afb0ca gtk4-demo: Polish the image scaling demo
Make the scale binding bidirectional again, fix up
the ranges and the sensitivity of the actions, and
add a mark for the unscaled position.
2023-03-14 05:36:08 +01:00
Jürgen Benvenuti
36037a2ee8 Update German translation 2023-03-13 18:30:32 +00:00
Bilal Elmoussaoui
23408f6dbf GLTexture: Add GL_RGB format support 2023-03-13 13:59:17 +00:00
Matthias Clasen
413abef01d Merge branch 'more-scaled-texture-fixes' into 'main'
Fix gtk_snapshot_append_scaled_texture

See merge request GNOME/gtk!5638
2023-03-13 08:58:58 +00:00
Matthias Clasen
4f8743a537 Merge branch 'matthiasc/for-main' into 'main'
gtk4-demo: Fix rotation handling in image scaling

See merge request GNOME/gtk!5643
2023-03-13 07:55:52 +00:00
Matthias Clasen
e24d4ba5db gtk4-demo: Use gtk_snapshot_append_scaled_texture 2023-03-13 08:54:13 +01:00
Matthias Clasen
118361a085 Fix gtk_snapshot_append_scaled_texture
This was doing the wrong thing with transforms.
2023-03-13 08:45:12 +01:00
Matthias Clasen
7bdb146473 docs: Details about texture scale nodes
Add some more details about filtering, to
clarify things a bit.
2023-03-13 08:38:58 +01:00
Matthias Clasen
517b4d584c gtk4-demo: Scale logarithmically in image scaling 2023-03-13 08:21:10 +01:00
Matthias Clasen
88d9244b98 gtk4-demo: Fix rotation handling in image scaling
We weren't sizing the widget correctly in rotated
cases.
2023-03-13 08:11:29 +01:00
Hugo Carvalho
fb4ae235a5 Update Portuguese translation 2023-03-13 00:06:26 +00:00
Fran Dieguez
b7c5c04c65 Update Galician translation 2023-03-12 23:19:49 +00:00
Aurimas Černius
bea38c1b4b Update Lithuanian translation 2023-03-12 20:01:39 +00:00
Alexander Shopov
d5a36a718f Update Bulgarian translation 2023-03-12 18:36:38 +00:00
Ask Hjorth Larsen
1c785f512f Updated Danish translation 2023-03-12 16:24:18 +01:00
Matthias Clasen
bc65b96e9c Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Add rotation to the scaling demo

Closes #5659

See merge request GNOME/gtk!5641
2023-03-12 10:20:04 +00:00
Asier Sarasua Garmendia
943851ab64 Update Basque translation 2023-03-12 09:35:14 +00:00
Matthias Clasen
352b8cb70e columnview: Be more defensive
I am not sure how we can have no listitem here,
but better to be safe than sorry.

Fixes: #5659
2023-03-12 08:25:58 +01:00
Matthias Clasen
dc50c790c5 gtk-demo: Add rotation to the scaling demo
Closing in on eog :)
2023-03-12 08:25:58 +01:00
Sabri Ünal
6dd273c3f1 Update Turkish translation 2023-03-11 16:03:32 +00:00
Anders Jonsson
bc397b047e Update Swedish translation 2023-03-11 15:47:38 +00:00
Piotr Drąg
80f3fe4031 Update Polish translation 2023-03-11 15:14:42 +01:00
Matthias Clasen
6f0976bace Merge branch 'matthiasc/for-main' into 'main'
inspector: Force a full redraw for debug nodes

See merge request GNOME/gtk!5640
2023-03-11 11:56:23 +00:00
Matthias Clasen
61ad0147bd inspector: Force a full redraw for debug nodes
Without this, debug nodes randomly are missing
in the tree, where we are reusing older render
nodes.
2023-03-11 12:43:38 +01:00
Matthias Clasen
582e74737c Merge branch 'matthiasc/for-main' into 'main'
themes: Avoid ':' in custom target names

Closes #5280

See merge request GNOME/gtk!5639
2023-03-11 10:21:13 +00:00
Matthias Clasen
aafe8f4b38 themes: Avoid ':' in custom target names
For whatever reason, meson decides to use custom
target names in the file system, and on Windows,
the ':' is causing trouble here. So avoid it.

Fixes: #5280
2023-03-11 11:03:43 +01:00
Marek Černocký
2d695b6dcc Update Czech translation 2023-03-11 08:52:49 +00:00
Ekaterine Papava
3a423749e2 Update Georgian translation 2023-03-11 05:39:09 +00:00
Benjamin Otte
97d53b1e86 Merge branch 'wip/otte/rendernode-export' into 'main'
rendernode: Register SVG serializer

See merge request GNOME/gtk!5637
2023-03-11 00:26:18 +00:00
Balázs Úr
50d7727881 Update Hungarian translation 2023-03-10 23:47:38 +00:00
Matthias Clasen
d564549f65 Merge branch 'wip/x11-create-destroy-without-show-show-hide' into 'main'
x11/surface: Clear compute_size idle source also when destroying

See merge request GNOME/gtk!5636
2023-03-10 23:40:50 +00:00
Matthias Clasen
bf1a5d99cf Merge branch 'cache-scaled-texture' into 'main'
gsk: Cache scaled texture

Closes #5642

See merge request GNOME/gtk!5633
2023-03-10 23:38:50 +00:00
Benjamin Otte
7c96003471 node-editor: Add more export options
Auto-detect tiff and svg and if those are chosen, save to that format.
2023-03-11 00:08:44 +01:00
Benjamin Otte
fc74eed425 rendernode: Register PNG serializer
This allows dropping or copy/pasting rendernodes into apps that accept
images.
2023-03-11 00:08:44 +01:00
Matthias Clasen
89d131de56 gtk4-demo: Add tooltips to the menu demo
Not great UI, but better than nothing.
2023-03-11 00:07:07 +01:00
Matthias Clasen
a35dc8dda6 Rename the menu demo
At this point, the Menu demo is more about scaling images
than about menus, so rename it to Image Scaling.
2023-03-11 00:03:05 +01:00
Benjamin Otte
0db9677b3a rendernode: Register SVG serializer
This allows dropping or copy/pasting rendernodes into apps that accept
SVGs.

Not sure how useful this is because we advertise text/plain from
rendernodes already and we prefer that.
2023-03-10 23:53:50 +01:00
Matthias Clasen
f00659d97f gtk-demo: Add a file chooser to the menu demo
So we can try this with bigger images.
2023-03-10 23:51:17 +01:00
Jonas Ådahl
f2a0a8b8be x11/surface: Clear compute_size idle source also when destroying
Doing it on hide() is not enough, since in some edge cases we didn't
ever actually map, we just attempted to compute the size, e.g. in
response to a ConfigureNotify event, then the window was destroyed.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2678
2023-03-10 23:34:50 +01:00
Matthias Clasen
0f02040292 gsk: Cache scaled texture
Keep the texture we create for texture scale nodes.

Fixes: #5642
2023-03-10 21:09:27 +01:00
Yuri Chornoivan
4014e956cd Update Ukrainian translation 2023-03-10 19:24:32 +00:00
Benjamin Otte
6029c006b3 Merge branch 'wip/otte/filefilter-name' into 'main'
filefilter: If not given a name, deduce one

See merge request GNOME/gtk!5630
2023-03-10 17:11:25 +00:00
Jiri Grönroos
9ca2289547 Update Finnish translation 2023-03-10 17:03:35 +00:00
Matthias Clasen
72454a7113 Merge branch 'reverse-file-chooser-recent-files-sort-order' into 'main'
filerchooser: Show Recent files in inverse order

See merge request GNOME/gtk!5625
2023-03-10 16:40:50 +00:00
Matthias Clasen
e3dc282cc1 Merge branch 'wip/otte/listview-border-spacing' into 'main'
Implement CSS border-spacing support for listview and gridview

See merge request GNOME/gtk!5626
2023-03-10 16:39:05 +00:00
Matthias Clasen
5f24218123 Merge branch 'file-chooser-selectability2' into 'main'
file system model: Store selectability

See merge request GNOME/gtk!5582
2023-03-10 16:37:41 +00:00
Matthias Clasen
feebd68dd3 Merge branch 'notify_after_value_change' into 'main'
a11y: Notify assistive technologies when a GTK_ACCESSIBLE_PROPERTY_VALUE_NOW changes on a widget

See merge request GNOME/gtk!5624
2023-03-10 16:36:41 +00:00
Lukáš Tyrychtr
acf3f6beda a11y: Notify assistive technologies when a GTK_ACCESSIBLE_PROPERTY_VALUE_NOW changes on a widget
This fixes silent sliders and similar controls when their value is changed.
2023-03-10 16:36:39 +00:00
Benjamin Otte
5c9fb3a636 filefilter: If not given a name, deduce one
Otherwise we end up with a critical when cosntructing the GVariant and
the portal claims our filter is for "[Invalid UTF-8]".

Test included
2023-03-10 17:10:30 +01:00
Benjamin Otte
6a874e6887 gridview: Add border-spacing support
omg, this is complicated code.
2023-03-10 17:03:33 +01:00
Benjamin Otte
4b73be18c7 gridview: Introduce column size functions
This is in preparation for border-spacing integration.
2023-03-10 17:03:33 +01:00
Benjamin Otte
670cf6201d gridview: Use gtk_list_item_manager_get_nearest_tile()
Simplifies gtk_grid_view_get_position_from_allocation() a bit because we
can omit the bounds shenanigan.
2023-03-10 17:03:33 +01:00
Benjamin Otte
196372f124 listview: Support CSS border-spacing
Hopefully the code can deal with gaps between the tiles.

We use gtk_list_item_manager_get_nearest_tile() when necessary.
2023-03-10 17:03:21 +01:00
Matthias Clasen
310662516b filechooser: Set selectability for list items
We propagate this from the list items to the
GtkListItems. Twisty!
2023-03-10 15:40:43 +01:00
Matthias Clasen
70b430edff filechooser: Dim non-selectable items 2023-03-10 15:40:43 +01:00
Matthias Clasen
c8a720aaa5 columview: Propagate activatable and selectable
When any of the cells is not activatable or selectable,
make the row not have those properties either.
2023-03-10 15:40:43 +01:00
Matthias Clasen
85d6f39ac7 filechooser: Inform the model about selectability
In folder modes, we don't want to select files.
2023-03-10 15:40:43 +01:00
Matthias Clasen
a916e00dac filesystemmodel: Store selectability
This will be used later on.
2023-03-10 15:40:40 +01:00
Matthias Clasen
913798b1d0 Merge branch 'file-chooser-selection' into 'main'
filechooser: Don't automatically select a file

See merge request GNOME/gtk!5572
2023-03-10 14:25:36 +00:00
Fabio Tomat
70fe37cf1b Update Friulian translation 2023-03-10 07:49:25 +00:00
Benjamin Otte
5583fa60c1 listitemmanager: Add gtk_list_item_manager_get_nearest_tile()
... and make the tile finding code use distance.

This also changes how gtk_list_item_manager_get_tile_at() finds the
right tile, so this is a custom commit for bisectability.

gtk_list_item_manager_get_nearest_tile() isn't used yet.
2023-03-10 05:35:17 +01:00
Benjamin Otte
97e3c65251 listview: Move bounds check into base class
This way, listview and gridview don't need to check if the rect is out
of bounds and nothing is selected, a quick rectangle_intersect() does
the job for them.
2023-03-10 05:26:28 +01:00
Benjamin Otte
334ca12d78 listview: Return an allocation for unallcoated items
Just get the position right and give them a height of 0px, that should
be good enough.

If we don't do that, code will think the item doesn't exist, which is
not what we want.
2023-03-10 05:26:28 +01:00
Ray Strode
442fa8d972 filerchooser: Show Recent files in inverse order
When looking at Recent files in the file chooser, it makes more
sense to show the recent files on top.

This commit flips the sort order for that case.
2023-03-09 15:42:16 -05:00
Matthias Clasen
12858114a2 Merge branch 'more-size-allocation-fixes' into 'main'
widget: Skip popovers in allocation

See merge request GNOME/gtk!5615
2023-03-08 22:26:51 +00:00
Matthias Clasen
4f6133e00a Merge branch 'wip/chergert/fix-const-preserving-text-iter-order' into 'main'
textlinedisplaycache: fix const-preserving gtk_text_iter_order()

See merge request GNOME/gtk!5620
2023-03-08 22:06:04 +00:00
Matthias Clasen
9ca3a52bf0 Merge branch 'file_chooser_stuff' into 'main'
filechooser: two small changes

See merge request GNOME/gtk!5619
2023-03-08 21:57:13 +00:00
Christian Hergert
40d99839d6 textlinedisplaycache: fix const-preserving gtk_text_iter_order() 2023-03-08 13:00:08 -08:00
Barnabás Pőcze
111e8d2808 filechooser: Do not look up parents of directories
If the `GtkRecentInfo` represents a directory, simply use it, and
do not try to find its parent in `_gtk_file_chooser_extract_recent_folders()`.

For example, there is an entry in my recently-used database
from the Amberol music player about the folder I have opened
with it, but the folder is not listed on the "Recent" tab of
the file chooser widget, only its parent. After this change,
the directory itself is shown.
2023-03-08 20:46:17 +01:00
Barnabás Pőcze
9b0b3029a6 filechooser: Use gtk_recent_info_is_local() for filtering
There is already a function for determining if URI
has the "file" scheme, so use that.
2023-03-08 20:04:41 +01:00
Matthias Clasen
f743b95161 Merge branch 'ebassi/issue-5650' into 'main'
Filter recently used files in the file chooser

Closes #5650

See merge request GNOME/gtk!5618
2023-03-08 18:45:10 +00:00
Matthias Clasen
bdd35c1695 Merge branch 'fix-msvc-older-glib' into 'main'
modules/media: Fix Visual Studio builds with older GLib (<= 2.74.x)

See merge request GNOME/gtk!5605
2023-03-08 18:44:46 +00:00
Matthias Clasen
2f273ba76a widget: Skip popovers in allocation
Native widgets get allocated via their surface,
so can skip them here. This avoids criticals when
re-mapping a popover for the second time, as can
be seen e.g. in the 'Selections' demo in gtk4-demo.
2023-03-08 13:40:51 -05:00
Matthias Clasen
a2d14632de widget: Stop propagating alloc_needed beyond popovers
This should not be necessary, since popovers get
their new size from present_popup via the compositor.
2023-03-08 13:40:48 -05:00
Benjamin Otte
7a3e130efd widget: Remove goto usage in widget_allocate() 2023-03-08 13:40:37 -05:00
Benjamin Otte
c8d356a250 widget: Split out gtk_widget_ensure_allocate_on_children()
allocate() should not be calling into ensure_allocate(), they do a similar job.
In the end, the code does the same work, but it should be easier to follow now.
2023-03-08 13:40:31 -05:00
Matthias Clasen
ffb7177c2e widget: Simplify size allocation
Don't call ensure_allocate if we've just
done size_allocate. This makes criticals
from reshowing popovers go away.
2023-03-08 13:39:54 -05:00
Emmanuele Bassi
8b2202cd56 Filter recently used files in the file chooser
Since it's a file selection widget, we should only list recently used
files that point to a file.

Fixes: #5650
2023-03-08 18:08:24 +00:00
Matthias Clasen
14a5c78d80 Merge branch 'wip/carlosg/reuse-search-engine' into 'main'
gtkfilechooser: Keep GtkSearchEngine around for longer

See merge request GNOME/gtk!5617
2023-03-08 12:58:43 +00:00
Carlos Garnacho
5fd2a6c8f3 gtkfilechooser: Keep GtkSearchEngine around for longer
Currently the GtkSearchEngine is torn down every time the search
is stopped, which also means between typed characters. This
prevents any of the optimizations that the GtkSearchEngine can
do in the long run.

Let the GtkSearchEngine stay around for longer, and only be
disposed after search is cancelled, the filechooser moves
onto a different mode than search, or is otherwise unmapped/disposed.

While at it, remove an unused struct field.
2023-03-08 13:23:56 +01:00
Matthias Clasen
6cb6f4a50f Merge branch 'wip/carlosg/recursive-file-search' into 'main'
searchengine: Improve performance for recursive search

Closes #4133

See merge request GNOME/gtk!5611
2023-03-08 11:56:41 +00:00
Carlos Garnacho
7b909fb310 searchengine: Do not fight filechooser search mode sorting
Provide the hits in an order that is more easily consumed by the
filechooser, and less jarring when populating.
2023-03-08 11:33:10 +01:00
Carlos Garnacho
d12bea03d2 searchengine: Bail out on the first character
Again on massive filesystems, the very first character
is likely to bring a likewise massive amount of search
results that we need to maybe query info for, then create
icons and widgets for. While it's impressive we can do
that, it's also expensive and likely pointless, for the
first character.

Typing a second character is however very likely to
considerably reduce the amount of items to categorize and
show. So start actually searching from there.

Testing on a filesystem with 1434099 files indexed, trying 5
semi-random 1 character searches (n, h, t, i, o) returns on
average 168K items (min. 78771, max. 331471), trying 5
semi-random 2 character searches (no, he, th, in, on)
returns on average 34K items (min. 11133, max. 94961),
which is a more approachable set.

Doing this is enough that typing on a filechooser search
entry feels completely fluid.
2023-03-08 11:33:10 +01:00
Carlos Garnacho
deacc63d54 searchengine: Ensure some GFileInfo fields
The search provider should make it sure there are some
specific GFileInfo fields set. Fix the mimetype extraction
from the query, and use that to fill in the missing gaps
the best we can.
2023-03-08 11:33:10 +01:00
Carlos Garnacho
ead121a3c1 searchengine: Drop non-recursive search
Recursive search seems to be the hardcoded default, go with it.
2023-03-08 11:33:10 +01:00
Carlos Garnacho
de4725dbd5 searchengine: Populate filesystem model in an idle
When starting a search over a very populated filesystem, it
is possible that typing the first chars will return a too
high number of results. Even though iterating through the
cursor is in itself very fast, extracting the GIO information
from those many files at once is not going to be as fast.

In order to increase interactivity (i.e. not make things
possibly sluggish) iterate the cursor in an idle function
and add search results to the filechooser model little by little.

If the user keeps typing (as it is likely will happen), there
will be better chances to cancel and proceed to the next
query timely. If not, the results will be there soon enough.
2023-03-08 11:32:44 +01:00
Lukáš Tyrychtr
662f35562b GtkLinkButton: Set the visited state when appropriate 2023-03-08 09:24:35 +01:00
Lukáš Tyrychtr
9517d3d135 a11y: Add GTK_ACCESSIBLE_STATE_VISITED
This state is used for visited link-like widgets.
It has no ARIA equivalent, e. g. can not be set programmatically, but it
exists in the browser environment as well.
2023-03-08 09:24:08 +01:00
Matthias Clasen
7f5504523f Merge branch 'check_null_gfile_location' into 'main'
filechooser: Fix memory leaks

See merge request GNOME/gtk!5610
2023-03-08 03:19:00 +00:00
Matthias Clasen
40b154bf28 Merge branch 'matthiasc/for-main' into 'main'
build: Handle introspection a bit better

See merge request GNOME/gtk!5614
2023-03-08 03:02:16 +00:00
Barnabás Pőcze
f0e4293b83 filechooser: Fix memory leaks
The returned strings from `file_chooser_get_location()` were never freed.
2023-03-08 03:59:10 +01:00
Matthias Clasen
87f820287a build: Handle introspection a bit better
Error out if introspection is requested,
but g-ir-scanner isn't found.

And if introspection isn't explicitly disabled
but is required for building the docs, build it.
2023-03-07 21:49:24 -05:00
Matthias Clasen
30586d75ac Merge branch 'matthiasc/for-main' into 'main'
filechooser: Handle pathless files

See merge request GNOME/gtk!5613
2023-03-08 02:31:19 +00:00
Matthias Clasen
7a1573a381 Merge branch 'expose_checkable_state' into 'main'
a11y: When an accessible has GTK_STATE_CHECKED, set its ATSPI_STATE_CHECKABLE as well

See merge request GNOME/gtk!5602
2023-03-08 02:07:39 +00:00
Matthias Clasen
bc42955a13 filechooser: Handle pathless files
g_file_get_path() can return NULL. Make our
getter for file locations handle that case.

Related: !5610
2023-03-07 20:54:31 -05:00
Matthias Clasen
cdc008763b Merge branch 'matthiasc/for-main' into 'main'
wayland: Don't crash during DND with Cairo renderer

See merge request GNOME/gtk!5612
2023-03-08 01:46:43 +00:00
Benjamin Otte
7fff188557 wayland: Don't crash during DND with Cairo renderer
Attaching buffers with offsets is forbidden now and nobody
checked the Cairo renderer.
2023-03-07 20:16:59 -05:00
Benjamin Otte
69238c1197 text: Don't crash when somebody drops NULL 2023-03-07 20:16:59 -05:00
Emmanuele Bassi
574380c744 Merge branch 'wroy-main-patch-03255' into 'main'
MSBuild: Fix gnome.compile_resources current source directory

See merge request GNOME/gtk!5609
2023-03-07 23:48:25 +00:00
Emmanuele Bassi
d1fc1adae7 Apply suggestion to use '/' over join_paths 2023-03-07 22:40:17 +00:00
Carlos Garnacho
64697ea95b searchengine: Improve performance for recursive search
As fancy as property paths are, recursive resolution of files
to a location increases the big O complexity enough that it's
not a great option on large homedirs with many indexed files.

Ensure the files are from the right location through a URI
prefix match, which does hits an index. This may dramatically
improve performance on large indexed trees.

Testing this query in an isolated testcase with a total
1434099 indexed files shows that it can run more than 1500 times
per second in this computer (an average of 15200 queries in
several 10 second runs), which presumably is a tad faster than
anyone can type.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4133
2023-03-07 23:18:46 +01:00
William Roy
aaeec84d75 Fix compile_resources present source directory
In certain scenarios, address the issue where gnome.compile_resources 
fails to transmit the present source directory. This is most notably 
visible with MSBuild.
2023-03-07 21:59:50 +00:00
Matthias Clasen
5822ba76d0 Merge branch 'unbreak-combobox' into 'main'
combobox: Avoid extra queue_resize()

Closes #5644

See merge request GNOME/gtk!5608
2023-03-07 19:10:51 +00:00
Ask Hjorth Larsen
a6ad8ebe0c Updated Danish translation 2023-03-07 20:02:40 +01:00
Ivan Molodetskikh
55faea1046 combobox: Avoid extra queue_resize()
width-request already ensures it's above the minimum width, so avoid an
extra queue_resize() when setting size request to (-1, -1).

This is the same way as GtkDropDown works. This also unbreaks
GtkComboBox after the recent allocation fix in
75a417e337.

Incidentally, this also makes GtkComboBox actually resize its popup as
intended (that was broken before).

I don't think this is ultimately the final fix, sometimes I still get
allocation warnings. But the proper fix will probably involve changing
some more allocation machinery around popovers. This is good enough for
now.
2023-03-07 09:55:30 -08:00
Matthias Clasen
21ee81823e Merge branch 'window-signals' into 'main'
window: Disconnect the ::compute-size handler

See merge request GNOME/gtk!5606
2023-03-07 13:15:21 +00:00
Matthias Clasen
9efd8ef201 window: Disconnect the ::compute-size handler
All the other signal handlers are connected in
realize and disconnected in unrealize, but the
::compute-size handler was forgotten.

This was notices in !5597.
2023-03-07 06:40:25 -05:00
Chun-wei Fan
432e8664e1 modules/media: Fix Visual Studio builds with older GLib
The current definitions of the g_io_module_*() symbols do not build on
Visual Studio when building against GLib earlier than 2.75.0 due to the
way how these symbols are decorated in the GLib headers, as Visual Studio
does not allow symbols that were previously marked with 'extern' (or so)
to be marked with anything that is symantically different later.

As a result, if we are using Visual Studio and glib-2.74.x or earlier,
override _GLIB_EXTERN as appropriate in the modules/media sources before
including the GIO headers.  This sadly, means that we need a
configure-time check as it would have been too late if we checked the
GLib version using G_VERSION_CHECK macro, as the GIO headers would have
been included already.

There are similar items in the print backends, but we will not attempt
to update these files as they are not meant to be built for Windows.
2023-03-07 15:36:42 +08:00
Matthias Clasen
6d2c5e51e0 Merge branch 'expose_landmark_role' into 'main'
a11y: Expose GTK_ACCESSIBLE_ROLE_LANDMARK to AtSPI2

See merge request GNOME/gtk!5601
2023-03-06 17:49:05 +00:00
Lukáš Tyrychtr
b669295fd8 a11y: When an accessible has GTK_STATE_CHECKED, set its ATSPI_STATE_CHECKABLE as well
This allows, for example, checkable list itemss.
2023-03-06 17:15:54 +01:00
Lukáš Tyrychtr
96e6332d28 a11y: Expose GTK_ACCESSIBLE_ROLE_LANDMARK to AtSPI2 2023-03-06 16:45:19 +01:00
Marek Černocký
59549d0665 Update Czech translation 2023-03-06 11:57:22 +00:00
Emmanuele Bassi
3e3158ce12 Merge branch 'wip/exalm/template' into 'main'
widget: Use the correct template in dispose_template()

See merge request GNOME/gtk!5600
2023-03-06 11:00:04 +00:00
Matthias Clasen
cfc2de4e3d Merge branch 'main' into 'main'
removed duplicate function call

See merge request GNOME/gtk!5545
2023-03-06 05:52:00 +00:00
Matthias Clasen
343852af7b Merge branch 'matthiasc/for-main' into 'main'
macos: Fix type func generation

See merge request GNOME/gtk!5596
2023-03-06 05:50:36 +00:00
Matthias Clasen
51902bbce8 Merge branch 'wip/fix-wl-destruct-order' into 'main'
wayland: Destroy xdg_surface after role

See merge request GNOME/gtk!5598
2023-03-06 05:08:44 +00:00
Alexander Mikhaylenko
9b3fb66bd4 widget: Use the correct template in dispose_template()
In derivable classes, the widget's class can be different from the one
dispose_template() was called for, which can lead to failing the
template != NULL check at best, undefined behavior at worst.

Since we already pass the correct GType into the function, just use that
instead.
2023-03-06 05:37:53 +04:00
Benjamin Otte
3ccf63b3c0 Merge branch 'wip/otte/for-main' into 'main'
inspector: Make really sure we don't inspect ourselves

See merge request GNOME/gtk!5599
2023-03-05 23:49:15 +00:00
Benjamin Otte
4655226907 inspector: Make really sure we don't inspect ourselves
The problem here is that new windows appear in the list before the
window's dispay gets set and we don't update the filter when the
display changes (would need watches support for the filtermodel).

So add this somewhat hacky method.
2023-03-06 00:13:53 +01:00
Jonas Ådahl
4500fa633b wayland: Destroy xdg_surface after role
The split-up of gdksurface-wayland.c introduced a protocol violation
when it didn't make sure xdg_surface was destroyed after the role
objects (xdg_popup / xdg_toplevel). Fix that.

Fixes: 2a463baed0 ("wayland: Rearrange the surface code")
2023-03-05 20:55:41 +01:00
Matthias Clasen
be11202538 macos: Fix type func generation
We were checking for gdk_quartz even though
the sysbols are now all called gdk_macos. Oops.
2023-03-05 10:17:52 -08:00
Benjamin Otte
0fa1e71ef0 Merge branch 'wip/otte/for-main' into 'main'
cssnode: Don't crash the inspector

See merge request GNOME/gtk!5595
2023-03-05 17:53:18 +00:00
Benjamin Otte
987b9cec3f testsuite: Add tests for the unknown enums
See commit 40e7a265a7
2023-03-05 18:35:02 +01:00
Benjamin Otte
a77beb39a1 testsuite: Add empty test for new node 2023-03-05 18:33:37 +01:00
Benjamin Otte
ac8e053ab6 cssnode: Don't crash the inspector
Don't misinform the observing listmodel that CSS nodes were removed that
weren't actually removed, but just moved. Otherwise the observer would
think it has run out of items when it really hasn't.
2023-03-05 18:33:37 +01:00
Matthias Clasen
986275239f Merge branch 'matthiasc/for-main' into 'main'
meson: Mention testsuite in summary

See merge request GNOME/gtk!5594
2023-03-05 16:51:23 +00:00
Matthias Clasen
2ee1273244 meson: Mention testsuite in summary
This was broken out from the 'tests' toggle,
so list it separately.
2023-03-05 08:10:12 -08:00
Matthias Clasen
248027a366 Merge branch 'expose_error_message_relation' into 'main'
a11y: Expose GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE to AtSPI2

See merge request GNOME/gtk!5588
2023-03-05 16:08:38 +00:00
Benjamin Otte
c823432eef Merge branch 'wip/otte/listview2' into 'main'
listview: GtkListTile

See merge request GNOME/gtk!5584
2023-03-05 15:53:43 +00:00
Matthias Clasen
98ac2de649 Merge branch 'matthiasc/for-main' into 'main'
ci: Disable the testsuite in flatpak builds

See merge request GNOME/gtk!5593
2023-03-05 15:46:13 +00:00
Matthias Clasen
1cee54009a ci: Disable the testsuite in flatpak builds
No need to build the testsuite when we are
just producing flatpaks.
2023-03-05 07:26:17 -08:00
Benjamin Otte
80b7c60150 listbase: Remove nonexisting function from header 2023-03-05 15:23:20 +00:00
Benjamin Otte
e8c5a771e5 gridview: Add a filler tile for empty space
That stupid space in the bottom right when n_items isn't a multiple of
n_columns needs its own tile, or we'll get errors about not finding a
tile.

So make one.
2023-03-05 15:23:20 +00:00
Benjamin Otte
882dcda53b columnview: Clear the sorter first thing in dispose
Otherwise, when removing the columns, each column will trigger a
sorter::changed signal emission.

And because sorters are often still connected to a sortlistmodel, we
can't skip that emission and need to do it.
But we only need to do it once.
2023-03-05 15:23:20 +00:00
Benjamin Otte
b488fae893 listview: Handle emptying of views
The previous check does not longer work.

When a model gets all items deleted, there will still be existing tiles
until the next time garbage collection is run.
So do that before checking if the list is empty.
2023-03-05 15:23:20 +00:00
Benjamin Otte
b962defc11 listview: Remove an unused member variable
It's only used in the allocate function, so make it a local varaible
there.
2023-03-05 15:23:20 +00:00
Benjamin Otte
9ee0696923 listview: Simplify a vfunc
Instead of making it 2 vfuncs for getting horizontal and vertical area,
make it one vfunc to get the area.

Also rewrite the implementations to use the tile's area instead of
trying to deduce things with fancy math.
2023-03-05 15:23:20 +00:00
Benjamin Otte
f3c53ae69d listview: Simplify allocation
With the Tile changes, a lot of stuff does no longer need to be
duplicated between listview and gridview. Move it to ListBase instead.
2023-03-05 15:23:20 +00:00
Benjamin Otte
8aea6fc1b5 gridview: Remove an unused member variable
It's only used during size_allocate(), so make it a local variable
there.
2023-03-05 15:23:20 +00:00
Benjamin Otte
d949afb80e listitemmanager: Add a split vfunc and use it
Instead of randomly changing tiles, the listitemmanager gains a split
vfunc that listview and gridview implement so they can keep their tile
areas intact. The listitemmanager will now conform to these rules:

1. Never delete a tile.
   This ensures that all areas stay intact.

2. Never change the n_items of a tile other than setting them to 0.
   This causes "empty" areas to appear, but listview/gridview can
   easily check for them by checking for tile->n_items == 0.
   gtk_list_tile_gc() will get rid of them.

3. Adding items always creates new tiles that are added with empty area.
   That way they don't interrupt any existing machinery until the next
   allocation.

4. Adding/removing widgets has no effect on areas
   This is useful in particular when scrolling where new widgets are
   moving between tiles. When the manager moves the widgets, it may
   split some areas, but will not remove any existing tiles, so the
   whole area stays intact and the list can deal with further scroll
   events before an allocation.

This improve the situation for #3334
2023-03-05 15:23:20 +00:00
Benjamin Otte
08c583b1b3 listview: Add gc'ing
This is in preparation for the following reorg of the listitemmanager,
it should not have any effect now.
2023-03-05 15:23:20 +00:00
Benjamin Otte
1c663cb340 listitemmanager: Remove unused functionality
Both ListView and GridView use GtkListTile now, so no need anymore for
custom machinery.
2023-03-05 15:23:20 +00:00
Benjamin Otte
776910d03d gridview: Redo tile management
Instead of the custom size property, use the new tile size.

Also introduce the ability to split tiles, so that gridview can split a
layout that would look like (question mark denoting cells without a
widget, which in this case would be a single tile)

█ █ █ ? ?
? ? ? ? ?
? ? ? ? ?
? ? ?

into 3 rectangular tiles like so:

█ █ █ A A
B B B B B
B B B B B
C C C

This of course also means we need to be able to merge those tiles again
when cells got added/deleted or the gridview was resized. For that job,
gtk_list_tile_gc() exists now, which removes tiles without items and
merges adjacent tiles without widgets.
2023-03-05 15:23:20 +00:00
Benjamin Otte
c82b2d86c0 listview: Get rid of ListRow and its height
Use the tiles' area instead.
2023-03-05 15:23:20 +00:00
Benjamin Otte
3ca4acdc1a list: Allow storing size in the ListTile
... and use it to handle ListView allocations.

Nothing spectacular, just proof of concept.

The code introduces the idea that every tile stores its area (others
would call it "allocation", but I avoided that because tiles aren't
widgets). This should allow moving lots of code into gtklistbase.c and
not require special handling inside ListView and GridView.

And that in turn hopefully makes it easier to add more features (like
sections and so on.)
2023-03-05 15:23:20 +00:00
Benjamin Otte
c705dba2ee list: Make GtkListTile more prominent
* Instead of using a gpointer to refer to it, use the GtkListTile type.

* Use gtk_list_tile_get_foo() instead of
  gtk_list_item_manager_get_tile_foo() naming.
2023-03-05 15:23:20 +00:00
Benjamin Otte
55ad241f43 list: Rename GtkListItemManagerItem => GtkListTile
That's a good description for what the job of those elements is:
They're a tile in the lists scrollable area.
2023-03-05 15:23:20 +00:00
Benjamin Otte
d3efd80b90 rendernodepaintable: Allow the node to be NULL
This can happen when creating paintables from GtkSnapshot when nothing
was drawn.
2023-03-05 15:23:20 +00:00
Jordi Mas
a899c0af6e Update Catalan translation 2023-03-05 09:44:49 +01:00
Matthias Clasen
f8fb30b555 Post-release version bump 2023-03-04 13:47:37 -08:00
Matthias Clasen
47aa0dcc7f 4.10.0 2023-03-04 08:28:12 -08:00
Emmanuele Bassi
32f0723bf0 Merge branch 'ebassi/file-info-attributes' into 'main'
Check for attributes being available before querying them

See merge request GNOME/gtk!5592
2023-03-04 16:04:04 +00:00
Matthias Clasen
90a3584c1d Merge branch 'wip/otte/dont-scale-or-it-breaks' into 'main'
Add a test for lots of texture scaling and fix the fallout

See merge request GNOME/gtk!5509
2023-03-04 15:57:49 +00:00
Emmanuele Bassi
891b6dc4a9 Check for attributes being available before querying them
GLib 2.75 started checking if a GFileInfo was created with the attribute
we're querying, instead of failing silently and leaving us in an
inconsistent state.

Turns out that GtkFileChooserWidget, GtkFileSystemModel, and GtkPathBar
trip the newly introduced check.
2023-03-04 15:28:53 +00:00
Emmanuele Bassi
c6ff7400a8 Merge branch 'wip/chergert/fix-action-activation-crash' into 'main'
inspector: be defensive against out parameters

See merge request GNOME/gtk!5591
2023-03-04 15:16:59 +00:00
Emmanuele Bassi
6620b7de92 Merge branch 'ebassi/stack-page-fix' into 'main'
a11y: Fix GtkStackPage first accessible child

See merge request GNOME/gtk!5590
2023-03-04 15:16:34 +00:00
Aleksandr Melman
d58071b4c1 Update Russian translation 2023-03-04 15:05:45 +00:00
Piotr Drąg
f38df62e2b Update Polish translation 2023-03-04 15:59:29 +01:00
Benjamin Otte
0581e38b09 testsuite: Add a test for stripes
The GL renderer was creating sripes for nodes that were scaled in
particular ways, probably due to rounding errors.

This testsuite focuses on one of those stripes to make sure they are
gone.
2023-03-04 02:50:38 +01:00
Emmanuele Bassi
74a00319dd a11y: Use weak references for GtkATContext cached accessibles
The accessible objects already own the GtkATContext, let's avoid a
reference cycle.
2023-03-03 22:07:09 +00:00
Matthias Clasen
611788fb53 stack: Don't recreate at contexts in dispose
This is the same protection we have in
GtkWidgetAccessible.
2023-03-03 22:07:09 +00:00
Emmanuele Bassi
500128d186 a11y: Plug reference leaks
The gtk_accessible_get_at_context() getter is now transfer full, which
means we need to drop the reference when getting the GtkATContext.
2023-03-03 22:07:09 +00:00
Christian Hergert
32cf104167 inspector: be defensive against out parameters
Set initial state to NULL so that we don't risk accessing an unset out
parameter.

Fixes a crash when activating certain actions.
2023-03-03 12:17:32 -08:00
Emmanuele Bassi
9b98426e71 a11y: Simplify bookkeeping while iterating accessible children 2023-03-03 18:02:22 +00:00
Emmanuele Bassi
9820d25cf9 a11y: Fix GtkStackPage first accessible child
The first accessible child is the child widget of the GtkStackPage, not
the first child of the widget.
2023-03-03 18:02:22 +00:00
Benjamin Otte
8bbf220fdf testsuite: Add a test for large scale nodes
This test fails if we naively create fullscale
intermediate offscreens. This was fixed in the
previous commits.

This tests the fixes in 22ba6b1f33 (for
cairo) and 3a0152b65f (for GL).
2023-03-03 11:33:57 -06:00
Matthias Clasen
3a0152b65f gl: Respect clip wehn drawing scale nodes
Use the same approach and only create an offscreen
that is big enough for the clipped part of the scaled
texture.

If the clipped part is still too large for a single
texture, we give up and just render the texture without
filters (using the regular texture rendering code path
which supports slicing).

The following commit will add the texture-scale-magnify-10000x
test which fails without this fix.
2023-03-03 11:32:08 -06:00
Benjamin Otte
22ba6b1f33 rendernode: Respect clip when drawing scale nodes
Scale nodes can use large scale factors and we don't want to create
insanely huge Cairo surfaces.

A subsequent commit will add the texture-scale-magnify-10000x
test which fails without this fix.
2023-03-03 11:31:31 -06:00
Benjamin Otte
718b5d5fe7 rendernode: Clarify some Cairo stuff
Split out a function to make it more obvious what's going on.
2023-03-03 11:24:46 -06:00
Benjamin Otte
88dd64551c rendernode: Don't do unnecessary stuff
Cairo surfaces are created transparent.

And even if they weren't, overdrawing with transparency wouldn't erase
what's in the surface because it's a no-op.

It would require CAIRO_OPERATOR_CLEAR or CAIRO_OPERATOR_SOURCE.
2023-03-03 11:24:46 -06:00
Benjamin Otte
98eac8ac83 Fixes for gdk_memory_texture_new_subtexture checks
There were several mistakes here.
2023-03-03 11:24:46 -06:00
Changwoo Ryu
dbb2cb22ca Update Korean translation 2023-03-03 15:36:03 +00:00
Lukáš Tyrychtr
71dbb5090e a11y: Expose GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE to AtSPI2
Also, update the AtSPI2 relations to match the 1.26 version of AtSPI2.
2023-03-03 15:15:59 +01:00
Matthias Clasen
4b46097748 Merge branch 'ebassi/accessible-transfer-full' into 'main'
Mark Accessible getters as transfer full

Closes #5615

See merge request GNOME/gtk!5586
2023-03-03 09:46:51 +00:00
Emmanuele Bassi
eb0f33d76b Mark Accessible getters as transfer full
GtkAccessible implementations in C can get away returning objects just
by shuffling pointers around, but higher level languages prefer using
full ownership transfer in virtual functions.

Fixes: #5615
2023-03-03 02:13:26 +00:00
Emmanuele Bassi
828f686fc9 Merge branch 'expose_details_relation' into 'main'
a11y: Expose GTK_ACCESSIBLE_RELATION_DETAILS to at-spi2

See merge request GNOME/gtk!5580
2023-03-03 01:55:48 +00:00
Emmanuele Bassi
681f8bed19 Merge branch 'fix_section_role' into 'main'
a11y: Fix mapping of GTK_ACCESSIBLE_ROLE_PRESENTATION

See merge request GNOME/gtk!5576
2023-03-03 01:54:51 +00:00
Matthias Clasen
5fe32a46a0 Merge branch 'ebassi/atcontext-dispose' into 'main'
a11y: Clear the accessible tree in GtkATContext

See merge request GNOME/gtk!5587
2023-03-03 01:54:38 +00:00
Emmanuele Bassi
e3548bb9ad Revert "stack: clear accessible parent when removing child"
This reverts commit 40d4441fd8.

The accessible parent of the child widget in a GtkStackPage is cleared
when the GtkATContext gets disposed, so we don't need to unset it
ourselves. This also avoids a temporary vivification of the GtkATContext
during dispose.
2023-03-03 01:39:24 +00:00
Emmanuele Bassi
61506648bf a11y: Clear the accessible tree in GtkATContext
We acquire a reference on the accessible objects, so we need to release
it when disposing the GtkATContext.
2023-03-03 01:38:27 +00:00
Balázs Úr
621b3b51ea Update Hungarian translation 2023-03-03 00:35:25 +00:00
Matthias Clasen
784ba8bf12 Merge branch 'matthiasc/for-main' into 'main'
impcontextsimple: Return from GTask

See merge request GNOME/gtk!5585
2023-03-03 00:19:38 +00:00
Matthias Clasen
d968659b43 impcontextsimple: Return from GTask
GLib complains about this now, so do it.
2023-03-02 16:18:45 -05:00
Emmanuele Bassi
48d3db8daa Merge branch 'leak-fix' into 'main'
gtkatspicontext: Fix a leak of a floating GVariant

See merge request GNOME/gtk!5583
2023-03-01 20:41:53 +00:00
Philip Withnall
ca702b4596 gtkatspicontext: Fix a leak of a floating GVariant
If the early return path in `emit_property_changed()` is taken, and
`value` is floating, it will be leaked. Fix that by sinking `value` on
entry to the function.

Spotted by asan:
```
Direct leak of 128 byte(s) in 2 object(s) allocated from:
    #0 0x7f44774ba6af in __interceptor_malloc (/lib64/libasan.so.8+0xba6af)
    #1 0x7f44764c941a in g_malloc ../../source/glib/glib/gmem.c:130
    #2 0x7f44764f6d8a in g_slice_alloc ../../source/glib/glib/gslice.c:252
    #3 0x7f447654655d in g_variant_alloc ../../source/glib/glib/gvariant-core.c:565
    #4 0x7f447654664c in g_variant_new_from_bytes ../../source/glib/glib/gvariant-core.c:608
    #5 0x7f4476536ed5 in g_variant_new_take_string ../../source/glib/glib/gvariant.c:1307
    #6 0x7f4475c75ada in gtk_at_spi_context_state_change ../../source/gtk4/gtk/a11y/gtkatspicontext.c:1112
    #7 0x7f44758ee194 in gtk_at_context_update ../../source/gtk4/gtk/gtkatcontext.c:694
    #8 0x7f44758dbfcf in gtk_accessible_update_property ../../source/gtk4/gtk/gtkaccessible.c:326
    #9 0x7f4475b5abe3 in gtk_widget_set_tooltip_text ../../source/gtk4/gtk/gtkwidget.c:9740
    #10 0x58439d in gs_updates_page_update_ui_state ../../source/gnome-software/src/gs-updates-page.c:302
    #11 0x5857dc in gs_updates_page_set_state ../../source/gnome-software/src/gs-updates-page.c:403
    #12 0x5879f1 in gs_updates_page_load ../../source/gnome-software/src/gs-updates-page.c:636
    #13 0x58822d in gs_updates_page_reload ../../source/gnome-software/src/gs-updates-page.c:678
    #14 0x50ff48 in gs_page_reload ../../source/gnome-software/src/gs-page.c:731
    #15 0x5491ce in gs_shell_reload_cb ../../source/gnome-software/src/gs-shell.c:830
    #16 0x7f4477363f54 in g_cclosure_marshal_VOID__VOID ../../source/glib/gobject/gmarshal.c:117
    #17 0x7f447735e0ad in g_closure_invoke ../../source/glib/gobject/gclosure.c:832
    #18 0x7f4477391f3f in signal_emit_unlocked_R ../../source/glib/gobject/gsignal.c:3802
    #19 0x7f4477390c13 in g_signal_emit_valist ../../source/glib/gobject/gsignal.c:3555
    #20 0x7f4477391324 in g_signal_emit ../../source/glib/gobject/gsignal.c:3612
    #21 0x7f447705b3c3 in gs_plugin_loader_reload_delay_cb ../../source/gnome-software/lib/gs-plugin-loader.c:1538
    #22 0x7f44764bd140 in g_timeout_dispatch ../../source/glib/glib/gmain.c:5054
    #23 0x7f44764b9eb1 in g_main_dispatch ../../source/glib/glib/gmain.c:3460
    #24 0x7f44764bb72c in g_main_context_dispatch ../../source/glib/glib/gmain.c:4200
    #25 0x7f44764bba15 in g_main_context_iterate ../../source/glib/glib/gmain.c:4276
    #26 0x7f44764bbbfa in g_main_context_iteration ../../source/glib/glib/gmain.c:4343
    #27 0x7f44769ef655 in g_application_run ../../source/glib/gio/gapplication.c:2589
    #28 0x4f2da5 in main ../../source/gnome-software/src/gs-main.c:49
    #29 0x7f4474e4a50f in __libc_start_call_main (/lib64/libc.so.6+0x2750f)
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2023-03-01 19:42:33 +00:00
robxnano
5a5a36151a filechooser: Don't automatically select a file
When the folder changes, do not select the first item in the list,
so if the user enters a folder and then clicks the accept button,
the current folder is returned instead of the selected one.
To maintain consistency with the previous implementation, when a
folder in the path bar is clicked the previously-entered folder is
selected, and when the file chooser is in open file mode the first
item is always selected.

See #5438
2023-03-01 13:56:52 +00:00
Lukáš Tyrychtr
c91ba630a7 a11y: Expose GTK_ACCESSIBLE_RELATION_DETAILS to at-spi2
This particular relation was not exposed to at-spi2.
Exposing it required adding a missing at-spi2 relation variant, but it was introduced
in at-spi2-core 2.26, so that's likely safe as well.
2023-03-01 13:53:39 +01:00
Matthias Clasen
bc99ab38ce Merge branch 'matthiasc/for-main' into 'main'
inspector: Remove debug spew

See merge request GNOME/gtk!5579
2023-03-01 12:36:49 +00:00
Matthias Clasen
fe8c262351 inspector: Remove debug spew 2023-03-01 06:32:52 -05:00
Lukáš Tyrychtr
1b000b5586 a11y: Fix mapping of GTK_ACCESSIBLE_ROLE_PRESENTATION
It was, for some reason, mapped to ATSPI_ROLE_SECTION, and GTK_ACCESSIBLE_ROLE_SECTION was mapped to
ATSPI_ROLE_FILLER, so the mapping is reversed. So, reverse it and make it correct.
2023-03-01 11:07:09 +01:00
Benjamin Otte
1b4f240883 Merge branch 'wip/otte/default-size-docs' into 'main'
window: Clarify docs for default-size

See merge request GNOME/gtk!5569
2023-03-01 10:06:34 +00:00
Benjamin Otte
496f68376b window: Clarify docs for default-size 2023-03-01 10:06:32 +00:00
Matthias Clasen
f019ff5287 Merge branch 'textbuffer-foreground-property' into 'main'
textbuffer: Use correct foreground color property

See merge request GNOME/gtk!5574
2023-03-01 02:46:05 +00:00
Mat
c08e739996 textbuffer: Use correct foreground color property
The 'foreground-rgba' property should be used instead of 'foreground',
since the latter is not readable.
2023-03-01 04:14:19 +02:00
Emmanuele Bassi
8eb3c55709 Merge branch 'wip/chergert/fix-stack-page-leak' into 'main'
stack: clear accessible parent when removing child

Closes #5626

See merge request GNOME/gtk!5571
2023-02-28 23:24:57 +00:00
Christian Hergert
40d4441fd8 stack: clear accessible parent when removing child
Without this, the GtkStackPage may not reach a reference count of zero
and therefore will be leaked.

Fixes #5626
2023-02-28 15:08:20 -08:00
Benjamin Otte
471ebabd77 Merge branch 'gbsneto/filechooser-fixes' into 'main'
Fix GtkFileThumbnail thumbnail query

See merge request GNOME/gtk!5570
2023-02-28 18:04:40 +00:00
Georges Basile Stavracas Neto
d8b7c909ea filethumbnail: Set filechooser::queried after querying
Setting this attribute after querying, but before receiving the
results, can lead to inappropriate behaviour. This can be reproduced
by dragging the scrollbar very quickly in a large directory; after
going up and down a few times, some thumbnails will be wrong.

Without this branch, "wrong" means they'll show the completely wrong
icon or thumbnail, e.g. a folder icon in a video file. With previous
commit, "wrong" means they'll be empty even when there is a thumbnail
available.

The sequence of events that triggers this is as follows:

 1. GtkListItem receives a GFileInfo object and passes it to
    GtkFileThumbnail via expressions

 2. `get_thumbnail()` is called, doesn't find a thumbnail

 3. `filechooser::queried` is not set yet, so it is set to TRUE
      and we call `g_file_query_info_async()`

 4. **Before `thumbnail_queried_cb` is called**, a new GFileInfo
    is set, and we cancel the query initiated in the previous
    step

 5. We now have a GFileInfo with `filechooser::queried` set to
    TRUE, and no thumbnail!

This commit fixes that by only setting the `filechooser::queried`
attribute after the icon is queried. We need to set it in two
situations: when the query is successful, or when the error is
not G_IO_ERROR_CANCELLED. That's because the query was cancelled,
we didn't really perform it!
2023-02-28 14:18:30 -03:00
Georges Basile Stavracas Neto
158165f769 filethumbnail: Clear image on failure
Unset the image if we fail to find the appropriate icon, regardless
of the reason of the failure. Prevents the thumbnail to misrepresent
the GFileInfo it's supposed to represent.
2023-02-28 13:52:12 -03:00
Georges Basile Stavracas Neto
2d90031dab filethumbnail: Cosmetics
Remove an empty newline
2023-02-28 13:50:08 -03:00
Matthias Clasen
2a862c05a1 Merge branch 'matthiasc/for-main' into 'main'
inspector: Look for icon themes in system data dirs

See merge request GNOME/gtk!5567
2023-02-28 16:35:48 +00:00
Matthias Clasen
93b6c7863b Merge branch 'main' into 'main'
Update docs/reference/gtk/getting_started.md

See merge request GNOME/gtk!5558
2023-02-28 16:23:26 +00:00
Matthias Clasen
090f45a589 Merge branch 'wip/exalm/buildable' into 'main'
builderparser: Don't exit too early on nested custom tags

See merge request GNOME/gtk!5566
2023-02-28 16:21:19 +00:00
Alexander Mikhaylenko
ca737b1411 testsuite: Add a GtkBuildable custom tag test
Just test that it doesn't error out during parsing.
2023-02-28 17:51:38 +04:00
Matthias Clasen
b2af4006ba inspector: Look for icon themes in system data dirs
For some reason, these were not included, and they should.
2023-02-28 07:18:42 -05:00
Matthias Clasen
5d3942e5fa NEWS: Updates 2023-02-28 06:53:26 -05:00
Alexander Mikhaylenko
2bcc3cfb33 builderparser: Don't exit too early on nested custom tags
Currently nested custom tags work only as long as the element names differ
from the root one. If it's same, for example:

<condition type="any">
  <condition type="max-width">600</condition>
  <condition type="max-height">600</condition>
</condition>

then it will fail. Meanwhile the same tags wrapped into <conditions> would
work.

The problem is that custom tag parsing is considered finished as soon as we
encounter a closing tag with the same element name. So instead, track the
nesting level.
2023-02-28 14:46:14 +04:00
Matthias Clasen
a7a498e803 Merge branch 'alloc-needed-on-child-fix' into 'main'
widget: Reset alloc_needed_on_child before allocating children

See merge request GNOME/gtk!5564
2023-02-28 10:40:02 +00:00
Ivan Molodetskikh
75a417e337 widget: Reset alloc_needed_on_child before allocating children
Reset alloc_needed_on_child *before* allocating the children. This is
because some child's size_allocate() may call queue_allocate(), which
will bubble up alloc_needed_on_child. An example of this happening is
with GtkScrollable implementations, which are supposed to configure
their adjustments in size_allocate(), which will cause GtkScrollbar's
GtkRange to notice and queue_allocate() on itself.

If we reset alloc_needed_on_child after this happens, then our children
will have a lingering alloc_needed_on_child and will not receive an
allocation.

This commit fixes widgets occasionally losing an allocation when this
scenario happens.
2023-02-27 21:38:42 -08:00
Matthias Clasen
dbaaa59758 Merge branch 'fix-text-undo-disabling' into 'main'
text: Fix disabling of history

Closes #5622

See merge request GNOME/gtk!5565
2023-02-28 02:39:30 +00:00
Matthias Clasen
73ba043b02 text: Make editable API irreversible
Programmatic changes to the entry contents should
not become part of the undo history.

Sadly, the editable implementations are also used
in the code paths that we use for user-initiated changes,
so we have to be careful to only set them as
irreversible if we are not already in a user action.

Fixes: #5622
2023-02-27 19:43:11 -05:00
Matthias Clasen
61e4eadbce text: Fix disabling of history
Keep a separate boolean for enable-undo, and
disable the history if it is false, or the entry
is not using visible text, or isn't editable.

Related to: #5622
2023-02-27 19:17:08 -05:00
Matthias Clasen
0db2d0bc07 Merge branch 'expose_autocomplete' into 'main'
a11y: Expose GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE

See merge request GNOME/gtk!5563
2023-02-27 16:49:00 +00:00
Emmanuele Bassi
cd10e5dd1a Verbiage Change 2023-02-27 16:32:35 +00:00
Lukáš Tyrychtr
c57d6c5575 a11y: Expose GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE
Previously, it was not exposed at all, now it at least somewhat is.
2023-02-27 15:27:07 +01:00
Emmanuele Bassi
73057b267e Merge branch 'expose_has_popup' into 'main'
a11y: Expose GTK_ACCESSIBLE_PROPERTY_HAS_POPUP

See merge request GNOME/gtk!5562
2023-02-27 14:20:44 +00:00
Lukáš Tyrychtr
9d4bb77263 a11y: Expose GTK_ACCESSIBLE_PROPERTY_HAS_POPUP
This property was not exposed before, not it is.
2023-02-27 14:10:11 +01:00
Emmanuele Bassi
0d6cee9763 Merge branch 'expose_multi_selectable' into 'main'
a11y: Expose GTK_ACCESSIBLE_PROPERTY_MULTI_SELECTABLE to at-spi2

See merge request GNOME/gtk!5561
2023-02-27 12:41:11 +00:00
Lukáš Tyrychtr
b33bfe26fe a11y: Expose GTK_ACCESSIBLE_PROPERTY_MULTI_SELECTABLE to at-spi2
Previously, this property was not exposed to the a11y backend, now, it is.
2023-02-27 13:24:56 +01:00
Emmanuele Bassi
0cacaa08f5 Merge branch 'expose_required' into 'main'
a11y: Expose GTK_ACCESSIBLE_PROPERTY_REQUIRED to at-spi2

See merge request GNOME/gtk!5560
2023-02-27 11:30:59 +00:00
Lukáš Tyrychtr
cbf4a546b4 a11y: Expose GTK_ACCESSIBLE_PROPERTY_REQUIRED to at-spi2
Up until now, this property was silently not exposed to assistive technologies.
2023-02-27 12:17:58 +01:00
Emmanuele Bassi
03732c1d48 Merge branch 'fix_invalid_role_mapping' into 'main'
a11y: Map GTK_ACCESSIBLE_STATE_INVALID to ATSPI_STATE_INVALID_ENTRY

See merge request GNOME/gtk!5559
2023-02-27 11:02:40 +00:00
Lukáš Tyrychtr
568cf21486 a11y: Map GTK_ACCESSIBLE_STATE_INVALID to ATSPI_STATE_INVALID_ENTRY
Previously, it was mapped to ATSPI_STATE_INVALID. However, that state
is used for some internal errors, and not user errors, so use the correct
one for that purpose.
2023-02-27 11:40:46 +01:00
Bobby Neal
f11d647aa4 Update docs/reference/gtk/getting_started.md 2023-02-26 17:04:17 +00:00
Hugo Carvalho
49feaf465d Update Portuguese translation 2023-02-26 16:20:29 +00:00
Matthias Clasen
9b0afd8bff Merge branch 'pickers-demo-dnd' into 'main'
gtk4-demo: Accept file dnd in the pickers demo

See merge request GNOME/gtk!5556
2023-02-26 13:44:30 +00:00
Matthias Clasen
495ca72232 gtk4-demo: Accept file dnd in the pickers demo
Easy to add and expected of a file picker.
2023-02-26 08:28:38 -05:00
Alexander Shopov
e6f4464a3d Update Bulgarian translation 2023-02-26 08:48:06 +00:00
Anders Jonsson
cb0e4ee2be Update Swedish translation 2023-02-25 21:57:36 +00:00
Matthias Clasen
6f7b6ad61a Merge branch 'ebassi/button-no-check' into 'main'
Remove unused code in GtkButton

See merge request GNOME/gtk!5553
2023-02-25 13:41:52 +00:00
Emmanuele Bassi
1e599c9141 Remove unused code in GtkButton
GtkButton still has some code checking if the instance passed to
gtk_button_set_label() is a GtkCheckButton; GtkCheckButton is not a
GtkButton any more.
2023-02-24 14:38:39 +00:00
Yosef Or Boczko
4cf42eb19c Update Hebrew translation 2023-02-24 09:57:37 +00:00
Matthias Clasen
b0fc2f99ba Merge branch 'mcatanzaro/#5619' into 'main'
filesystemmodel: fix crash when file is removed

Closes #5619

See merge request GNOME/gtk!5550
2023-02-23 16:24:06 +00:00
Emmanuele Bassi
2b4dd182c1 Merge branch 'add_toggle_button_role' into 'main'
a11y: Introduce a dedicated role for toggle buttons

See merge request GNOME/gtk!5549
2023-02-23 15:22:16 +00:00
Michael Catanzaro
c141d0a70a filesystemmodel: fix crash when file is removed
In 32247bc50e node_get_for_file() was
changed to return GTK_INVALID_LIST_POSITION rather than 0 when the file
is untracked. Most call sites were updated accordingly, but this one was
missed.

Fixes #5619
2023-02-23 09:20:03 -06:00
Lukáš Tyrychtr
6fa8033c7c Use the correct role for GtkToggleButton 2023-02-23 15:02:29 +01:00
Lukáš Tyrychtr
de80f503e4 a11y: Introduce a dedicated role for toggle buttons
Up until now, toggle buttons were presented as regular push buttons.
That's the approach used by the ARIA specification, however, our platform
accessibility backend, at-spi2, can not represent accessibe states with values,
so we can not represent the design pattern precisely enough for screen readers.
If, in future, the a11y backends gain this capability, we might consider again
removing this role.
2023-02-23 14:22:20 +01:00
Matthias Clasen
41b67c4722 Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Fix the shortcuts-window demo

See merge request GNOME/gtk!5548
2023-02-23 01:03:41 +00:00
Matthias Clasen
1eae87621d gtk-demo: Fix the shortcuts-window demo
Presenting the shortcutswindow got lost
in fb8e52f0c9. Oops.
2023-02-22 14:57:47 -05:00
Fran Dieguez
5f502601c8 Update Galician translation 2023-02-22 17:23:21 +00:00
Sabri Ünal
04d23c5cb9 Update Turkish translation 2023-02-22 11:41:36 +00:00
Philipp Kiemle
d9b6f814ad Update German translation 2023-02-22 10:34:50 +00:00
Matthias Clasen
871c46591a Merge branch 'improve_gtknotebook_a11y' into 'main'
GtkNotebook: Improve the labels of notebook pages for a11y

See merge request GNOME/gtk!5546
2023-02-21 16:48:28 +00:00
Lukáš Tyrychtr
d906b456a8 GtkNotebook: Improve the labels of notebook pages for a11y 2023-02-21 15:29:00 +01:00
Michael J. Baars
32bc7ce987 removed duplicate function call 2023-02-21 13:28:15 +01:00
Daniel
cad5771a66 Updated Spanish translation 2023-02-21 12:07:49 +01:00
Emmanuele Bassi
378f1421f0 Merge branch 'main' into 'main'
button: Remove nullable annotation for new_from_icon_name()

Closes #5606

See merge request GNOME/gtk!5544
2023-02-20 21:30:05 +00:00
Philipp Hörist
a209a73c69 button: Remove nullable annotation for new_from_icon_name()
This makes it more consistent with set_icon_name() which
does also not accept NULL.

Fixes #5606
2023-02-20 20:33:42 +01:00
Matthias Clasen
624458df9d Merge branch 'builder-tool-child-properties' into 'main'
gtk4-builder-tool: Prefer child properties

Closes #5609

See merge request GNOME/gtk!5543
2023-02-20 13:12:27 +00:00
Matthias Clasen
fbfbaa484d Merge branch 'matthiasc/for-main' into 'main'
filechooser: Fix paned limits

See merge request GNOME/gtk!5542
2023-02-20 13:04:33 +00:00
Matthias Clasen
3de10847b9 gtk4-builder-tool: Prefer child properties
Rewrite <child> elements to use child properties
where that is easily possible.

Fixes: #5609
2023-02-19 21:48:56 -05:00
Kukuh Syafaat
8be601da4f Update Indonesian translation 2023-02-20 01:20:48 +00:00
Matthias Clasen
07b9a6fb75 filechooser: Fix paned limits
The intention of the ui file was to not let
the paned shrink both children down to nothing,
but using <child> for the children effectively
overrides the setting of the shrink properties.
Fix that by using child properties instead of
<child>.
2023-02-19 19:12:30 -05:00
Matthias Clasen
5105d607de Merge branch 'builder-tool-template-parent' into 'main'
builder-tool: Try harder to find template parents

Closes #5232

See merge request GNOME/gtk!5541
2023-02-20 00:05:06 +00:00
Matthias Clasen
a9f03be588 builder-tool: Try harder to find template parents
This will make it work (in some cases) to add extra
libraries via LD_PRELOAD.

Based on work by Julian Sparber,
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/5084

Fixes: #5232
2023-02-19 18:17:34 -05:00
Asier Sarasua Garmendia
d67bdb96ad Update Basque translation 2023-02-19 20:44:24 +00:00
Yuri Chornoivan
c8f4535ed2 Update Ukrainian translation 2023-02-19 20:23:35 +00:00
Aurimas Černius
21cbf98942 Update Lithuanian translation 2023-02-19 19:06:03 +00:00
Emmanuele Bassi
300540f6b8 Merge branch 'texturescalenode-type-annotations' into 'main'
Fix self-`(type)` annotations for `TextureScaleNode` methods

See merge request GNOME/gtk!5539
2023-02-19 17:18:01 +00:00
Sebastian Dröge
323ba14dde Fix self-(type) annotations for TextureScaleNode methods 2023-02-19 19:00:34 +02:00
Matthias Clasen
aaee1ee5bd Merge branch 'fix_custom_accessible_hierarchy' into 'main'
Allow setting accessible parent and next sibling

See merge request GNOME/gtk!5517
2023-02-19 16:15:49 +00:00
Matthias Clasen
70a711882c Fix the build 2023-02-19 15:26:27 +00:00
Matthias Clasen
5717b95cad Miscellaneous formatting and documentation fixes 2023-02-19 15:09:25 +00:00
Matthias Clasen
1b0f324be5 Merge branch 'missing-since-markers' into 'main'
Add two missing `Since` markers

See merge request GNOME/gtk!5537
2023-02-19 14:56:51 +00:00
Sebastian Dröge
ca93512106 Add two missing Since markers 2023-02-19 11:18:15 +02:00
Ekaterine Papava
fbd4f06ee2 Update Georgian translation 2023-02-19 05:48:04 +00:00
Benjamin Otte
d553f6941d Merge branch 'wip/otte/for-main' into 'main'
listview: Measure children only, not self

See merge request GNOME/gtk!5535
2023-02-19 05:33:59 +00:00
Matthias Clasen
2173b7ccaa Merge branch 'matthiasc/for-main' into 'main'
Drop some unnecessary includes

See merge request GNOME/gtk!5536
2023-02-19 05:01:53 +00:00
Matthias Clasen
ca6642deed Drop some unnecessary includes 2023-02-18 23:42:04 -05:00
Benjamin Otte
be6a4722c0 listview: Measure children only, not self
The previous code would include CSS padding/margin/border in the
measurement and that is wrong.

Until commit a96c75ff02 this was not actually visible, but afterwards
listitems were allocated 16px too wide.

Test included
2023-02-19 05:41:29 +01:00
Matthias Clasen
3b3b63062d Revert "Merge branch 'inscription-single-line' into 'main'"
This reverts commit 7ec90abf24, reversing
changes made to ec49a912aa.

We did not have agreement on this after all.
2023-02-18 19:04:00 -05:00
Matthias Clasen
7ec90abf24 Merge branch 'inscription-single-line' into 'main'
inscription: Add single-line-mode property

Closes #5444

See merge request GNOME/gtk!5504
2023-02-18 23:34:17 +00:00
Matthias Clasen
ec49a912aa Merge branch 'wip/carlosg/dnd-x11-keys' into 'main'
gdk/x11: Also grab keyboard during XDnD grabs

Closes #5604

See merge request GNOME/gtk!5533
2023-02-18 22:20:30 +00:00
Carlos Garnacho
ae94417f80 gdk/x11: Also grab keyboard during XDnD grabs
The drag source must handle events and messaging, this also
includes keyboard handling for accessibility and cancellation.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5604
2023-02-18 23:02:22 +01:00
Matthias Clasen
24a6803958 Merge branch 'matthiasc/for-main' into 'main'
gtksearchentry: Apply header capitalization to the "Clear entry" tooltip

See merge request GNOME/gtk!5532
2023-02-18 21:10:16 +00:00
Automeris naranja
4073371416 gtksearchentry: Apply header capitalization to the "Clear entry" tooltip
HIG advises to use header capitalization in tooltip texts.

https://developer.gnome.org/hig/patterns/feedback/tooltips.html
2023-02-18 15:53:54 -05:00
Matthias Clasen
e5a391c0b9 Merge branch 'matthiasc/for-main' into 'main'
securememory: use function checks

Closes #5070

See merge request GNOME/gtk!5531
2023-02-18 17:21:15 +00:00
Matthias Clasen
6cb612ac15 gtk-demo: Fix build without sincos
We are getting into trouble here if
sincos isn't detected but still present
in headers. Avoid that.

Also fix the other copy of gtkgears.c.
2023-02-18 10:41:02 -05:00
Matthias Clasen
9f64202a60 meson: Consolidate function checks
Put all the function checks in one place.
Remove functions we don't actually use,
and add ones that we have #ifdefs for in
in the code. Also add enough includes to
make these checks actually work.

Fixes: #5070
2023-02-18 09:37:36 -05:00
Matthias Clasen
19c362f638 securememory: use function checks
Checking for getpagesize in meson.build is
useless if we don't check the resulting define
in the code. So do that.
2023-02-18 09:34:50 -05:00
Matthias Clasen
e51fa8b65b Merge branch 'matthiasc/for-main' into 'main'
printing: Avoid getrandom

See merge request GNOME/gtk!5530
2023-02-17 22:39:04 +00:00
Matthias Clasen
06d3bbafaf printing: Avoid getrandom
GLib has perfectly serviceable random number
apis, and this breaks the macOs build.
2023-02-17 17:20:44 -05:00
Matthias Clasen
da8a1f4683 Merge branch 'scalebutton-active-since-marker' into 'main'
Add missing `Since` marker to `GtkScaleButton:active`

See merge request GNOME/gtk!5529
2023-02-17 19:54:03 +00:00
Sebastian Dröge
ad7d9bc409 Add missing Since marker to GtkScaleButton:active 2023-02-17 19:41:55 +02:00
Emmanuele Bassi
94cde8d702 Merge branch 'ebassi/ci-update-v41' into 'main'
ci: Update image

See merge request GNOME/gtk!5528
2023-02-17 12:55:50 +00:00
Emmanuele Bassi
ec7b1f7208 ci: Add no-cache option to run-docker.sh script
Use `run-docker.sh build --no-cache` to discard the cached layers if you
need to rebuild the image without modifying the Dockerfile.
2023-02-17 12:24:09 +00:00
Emmanuele Bassi
864fbf89cd ci: Update image
Refresh the Fedora base (still at 37), and add the Python packaging
module for gi-docgen.
2023-02-17 12:24:09 +00:00
Emmanuele Bassi
b8e928d703 Merge branch 'matthiasc/for-main' into 'main'
mask: Fix glsl

See merge request GNOME/gtk!5527
2023-02-17 12:23:36 +00:00
Matthias Clasen
0b4d41698b mask: Fix glsl 2023-02-17 06:26:42 -05:00
Matthias Clasen
a9eca60b84 Merge branch 'wip/fix-mask-modes-regression' into 'main'
wayland/glcontext: Don't call wl_surface.offset on old objects

See merge request GNOME/gtk!5526
2023-02-17 11:25:06 +00:00
Jonas Ådahl
53c3f497f1 wayland: Clean up some dead code 2023-02-17 12:03:58 +01:00
Jonas Ådahl
3183a21347 wayland/glcontext: Don't call wl_surface.offset on old objects
The availability of wl_surface.offset depends on the compositor, so we
can't call it unconditionally. Add a version check to so we only call
offset if we know we won't raise a protocol error.

Fixes: 0eb791eaaa ("Make mask nodes more versatile")
2023-02-17 12:03:27 +01:00
Matthias Clasen
07f090f947 Merge branch 'test-invisible-text' into 'main'
Add a test for invisible text navigation

See merge request GNOME/gtk!5525
2023-02-17 03:01:42 +00:00
Matthias Clasen
ad111087cc Add a test for invisible text navigation
This shows that (at least some) things
work as expected.

See: #1811
2023-02-16 14:27:44 -05:00
Jürgen Benvenuti
5092581be8 Update German translation 2023-02-16 17:18:16 +00:00
Matthias Clasen
b261f7f533 Merge branch 'nielsdg/set-action-enabled-doc-ref' into 'main'
widget: mention action_set_enabled in install_action

See merge request GNOME/gtk!5524
2023-02-16 11:24:15 +00:00
Niels De Graef
779f9e5071 widget: mention action_set_enabled in install_action
When looking at `gtk_widget_class_install_action()`, it isn't
immediately obvious how actions can be enabled or disabled. Add a
reference to the `gtk_widget_action_set_enabled()` method so people have
a quick link to that.
2023-02-16 08:47:06 +01:00
Matthias Clasen
b07d9d1912 Merge branch 'alatiera/flatpak-ci' into 'main'
ci: Build and publish aarch64 flatpaks

Closes #5594

See merge request GNOME/gtk!5523
2023-02-15 19:54:32 +00:00
Jordan Petridis
7b4692bcb0 ci: Add a simple auto-retry policy 2023-02-15 21:38:24 +02:00
Jordan Petridis
f0a2b6f165 ci: Build and publish aarch64 flatpaks
Close GNOME/gtk#5594
2023-02-15 21:19:56 +02:00
Jordan Petridis
2dc6efd9ce ci: Switch from only/except to rules: keyword
It's more flexible and allows us to combine the flatpak jobs
2023-02-15 21:10:40 +02:00
Emmanuele Bassi
1f4adb60bb Merge branch 'fix-annotations' into 'main'
Fix a couple incorrect annotations for optional parameters

See merge request GNOME/gtk!5503
2023-02-15 16:27:11 +00:00
Lukáš Tyrychtr
f507dd4962 Allow updating the next accessible sibling for a GtkAccessible 2023-02-15 12:29:16 +01:00
Matthias Clasen
1bdb368e8b Merge branch 'more-mask-modes' into 'main'
rendernodeparser: Fix mask mode handling

See merge request GNOME/gtk!5522
2023-02-15 03:54:01 +00:00
Matthias Clasen
aec4bfcf3b gsk: Add a node parser test for mask modes 2023-02-14 21:47:54 -05:00
Matthias Clasen
7e18c2849b gsk: Add a render test for mask modes 2023-02-14 21:47:54 -05:00
Matthias Clasen
351abadee7 Make make not fallback match GL
We were not handling the inverted-luminance
case the same way, and it caused a test to
fail. Yay for tests.
2023-02-14 21:47:54 -05:00
Matthias Clasen
951db28f71 rendernodeparser: Fix mask mode handling
I had forgotten inverted-luminance, and also
to print an error.
2023-02-14 21:01:12 -05:00
Benjamin Otte
40e7a265a7 rendernodeparser: Print an error when failing to parse an enum 2023-02-14 21:01:12 -05:00
Matthias Clasen
9a539cec57 Merge branch 'mask-modes' into 'main'
Make mask nodes more versatile

See merge request GNOME/gtk!5521
2023-02-15 00:57:17 +00:00
Matthias Clasen
724cf6bd70 Merge branch 'wip/cdavis/menubutton-active' into 'main'
menubutton: Add `active` property and getter/setter

See merge request GNOME/gtk!5506
2023-02-15 00:44:17 +00:00
Matthias Clasen
5e4b43dcce Merge branch 'wip/otte/downloader' into 'main'
Add GdkTextureDownloader

See merge request GNOME/gtk!5515
2023-02-15 00:41:26 +00:00
Matthias Clasen
fa43282695 Merge branch 'wip/otte/disable-style-check' into 'main'
CI: Don't run style-check-diff by default

See merge request GNOME/gtk!5520
2023-02-15 00:36:53 +00:00
Benjamin Otte
662c251cd0 demo: Spice up the mask demo
Also use all the mask modes, weeeee!
2023-02-14 19:07:01 -05:00
Matthias Clasen
0d97d03fc1 Document mask node parser format 2023-02-14 19:07:01 -05:00
Matthias Clasen
cb0aaf0b2c Add more mask node tests 2023-02-14 19:07:01 -05:00
Matthias Clasen
0eb791eaaa Make mask nodes more versatile
Add a GskMaskMode enumeration and implement it
in the GL and cairo renderers.
2023-02-14 19:07:01 -05:00
Benjamin Otte
073c836f96 CI: Don't run style-check-diff by default
We don't use it most of the time and it's also confusing to new contributors who think it's important to fix it.

Keep it for manual runs, so that interested people can just click a button to see the results. It also makes it easy to turn back on later.
2023-02-14 23:53:02 +00:00
Matthias Clasen
0a0a03d913 Merge branch 'fix_4258' into 'main'
Don't tell the screen reader that a button is related to an image which has no useful label

Closes #4258

See merge request GNOME/gtk!4665
2023-02-14 23:50:18 +00:00
Lukáš Tyrychtr
d43724f5fc Don't tell the screen reader that a button is related to an image which has no useful label 2023-02-14 23:50:18 +00:00
Matthias Clasen
abf3cdb187 Merge branch 'cpdb' into 'main'
Update dependencies for CPDB print backend

Closes #5589

See merge request GNOME/gtk!5518
2023-02-14 23:48:43 +00:00
Benjamin Otte
cca5de3c7f memorytexture: Export less private API
It's not needed anymore with GdkTextureDownloader now.
2023-02-15 00:39:18 +01:00
Benjamin Otte
774696011d glrenderer: Use GdkTexureDownloader 2023-02-15 00:39:18 +01:00
Benjamin Otte
c9f54ca371 texture: Export gdk_texture_get_format()
The API docs outline why quite well.

This should make it possible to do saving of textures to image files
without any private API with the same featureset that GTK uses.

Also remove the gsktextureprivate.h include where
gdk_texture_get_format() was the only reason for it.
2023-02-15 00:39:18 +01:00
Benjamin Otte
ce0123ea58 docs: Link from gdk_texture_download() to GdkTextureDownloader 2023-02-15 00:39:18 +01:00
Benjamin Otte
b30af72125 tiff: Use GdkTexureDownloader when saving 2023-02-15 00:39:18 +01:00
Benjamin Otte
eb45b8083a png: Use GdkTexureDownloader when saving 2023-02-15 00:39:18 +01:00
Benjamin Otte
f05d801e28 jpeg: Use GdkTexureDownloader when saving 2023-02-15 00:39:18 +01:00
Benjamin Otte
4afec951c7 pixbuf: Use GdkTextureDownloader when downloading pixbufs 2023-02-15 00:39:18 +01:00
Benjamin Otte
51ed1442a2 gdk: Add GdkTextureDownloader
It's the new object that allows more control about accessing texture
data.
2023-02-15 00:39:18 +01:00
Benjamin Otte
01ff6c1c22 memorytexture: Use right size for GBytes
The GBytes were created with the wrong size.

Nobody seems to have looked at it.
2023-02-14 23:42:17 +01:00
Fran Dieguez
73f3ea9511 Update Galician translation 2023-02-14 20:04:07 +00:00
Emmanuele Bassi
f1311dc053 Merge branch 'gsk-render-node-type-abi-breakage' into 'main'
gsk: Move new 4.10 `GskRenderNodeType`s to the end instead of inserting them in the middle

See merge request GNOME/gtk!5519
2023-02-14 19:28:36 +00:00
Sebastian Dröge
a252aadadf gsk: Move new 4.10 GskRenderNodeTypes to the end instead of inserting them in the middle 2023-02-14 21:04:41 +02:00
tinytrebuchet
300670dad4 Update dependencies for CPDB print backend
Require cpdb-frontend 2.x for building CPDB print backend.
2023-02-14 23:39:13 +05:30
Matthias Clasen
44c95d3c96 Merge branch 'kjellahl/clang' into 'main'
gskglrenderjob: Fix compilation with clang

See merge request GNOME/gtk!5516
2023-02-14 14:18:29 +00:00
Lukáš Tyrychtr
d566771262 Preserve the correct a11y tree in GtkStack
Now, when we can, ensure that the GtkStackPage is the parent of its widget.
2023-02-14 14:44:20 +01:00
Lukáš Tyrychtr
5f72b51105 Allow setting accessible parent and sibling explicitly
This allows to maintain the correct a11y hierarchy even when it contains
objects which are only GtkAccessibles.
2023-02-14 14:43:57 +01:00
Hugo Carvalho
e0afd22c84 Update Portuguese translation 2023-02-14 11:39:50 +00:00
Kjell Ahlstedt
869ab1cd1b gskglrenderjob: Fix compilation with clang 2023-02-14 10:29:25 +01:00
Matthias Clasen
730593fab5 Merge branch 'texttag_textview_documentation' into 'main'
Update TextTag and TextView indent Documentation

See merge request GNOME/gtk!5507
2023-02-14 00:08:39 +00:00
Matthias Clasen
d0798c9526 Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Fix hotspot handling in dnd

See merge request GNOME/gtk!5513
2023-02-14 00:03:55 +00:00
Matthias Clasen
e6dfb8732a gtk-demo: Fix hotspot handling in dnd
We were not remembering the pointer coordinates.
2023-02-13 18:39:45 -05:00
Aurimas Černius
453ef8c7e1 Update Lithuanian translation 2023-02-13 21:07:37 +00:00
Sabri Ünal
819595d1a9 Update Turkish translation 2023-02-13 18:08:05 +00:00
Andre Klapper
306276b689 Fix invalid markup in Belarusian UI translation 2023-02-13 18:32:03 +01:00
Emmanuele Bassi
bb15a7ef46 Merge branch 'faq-updates' into 'main'
faq: Some updates

See merge request GNOME/gtk!5512
2023-02-13 14:50:35 +00:00
Matthias Clasen
cd0fe13dae faq: Add a question about parallel UIs 2023-02-13 08:54:36 -05:00
Matthias Clasen
3dcea74e85 faq: Don't number questions
The numbering makes it unnecessarily hard to add
and remove questions, and does not really seem
necessary. Just use bullets.
2023-02-13 08:52:04 -05:00
Matthias Clasen
537c2f6c7a faq: Some updates
Miscellaneous tweaks and changes, after reading
the whole thing.
2023-02-13 08:52:03 -05:00
Matthias Clasen
72379f64e9 Merge branch 'fix-font-chooser-filter' into 'main'
Fix an assertion in GtkFontChooserWidget when setting a filter.

See merge request GNOME/gtk!5511
2023-02-13 12:41:48 +00:00
Akira TAGOH
4532c3020b Fix an assertion in GtkFontChooserWidget when setting a filter. 2023-02-13 12:49:02 +09:00
Kukuh Syafaat
b60bd8a73d Update Indonesian translation 2023-02-13 02:47:33 +00:00
Matthias Clasen
37f12e4bf9 Post-release version bump 2023-02-12 21:04:15 -05:00
Matthias Clasen
8967b2da01 4.9.4 2023-02-12 20:36:13 -05:00
Matthias Clasen
dfb019509d docs: Document new build options 2023-02-12 20:36:13 -05:00
Matthias Clasen
a770b429ec Merge branch 'fix-gst-gl-use' into 'main'
gstreamer: Fix gl context use

Closes #5586

See merge request GNOME/gtk!5508
2023-02-13 00:41:51 +00:00
Matthias Clasen
7430bd7780 gstreamer: Fix gl context use
We were not activating the context in which
we want to wait for the fence. This caused
a stream of critical warnings.

Fixes: #5586
2023-02-12 19:29:04 -05:00
Jacob Mealey
272a40a01a Update TextTag and TextView indent Documentation
Change the documentation for both to be in line with Pango documentation
specifically regarding hanging indentation.
2023-02-12 23:12:51 +00:00
Matthias Clasen
f121f607ae Merge branch 'search_entry_placeholder' into 'main'
gtksearchentry: Add getter/setter for placeholder text

See merge request GNOME/gtk!4312
2023-02-12 22:06:36 +00:00
Christopher Davis
ff45145eac menubutton: Add active property and getter/setter
GtkMenuButton currently does not provide a way to tell
if it's open programmatically. The existing methods,
`popup()` and `popdown()`, do not expose any state
to callers. If someone wanted to know whether or not
a menubutton was open, they needed the popover. Given
that GtkMenuButton can manage the popovers itself,
that's not always an option for app developers.

This commit adds the `active` property and associated
methods, where `gtk_menu_button_set_active ()` replaces
both `gtk_menu_popup ()` and `gtk_menu_popdown ()`.
This addition also mirrors changes in other places,
Such as `GtkWidget:visible` vs `show()`/`hide()`.
2023-02-12 16:47:59 -05:00
Matthias Clasen
83c5f5ff0f Apply 4 suggestion(s) to 2 file(s) 2023-02-13 06:47:06 +09:00
Alexandros Theodotou
87d21dc5c9 gtksearchentry: Add getter/setter for placeholder text 2023-02-13 06:46:31 +09:00
Matthias Clasen
cef7e6b741 Merge branch 'mark-deprecations' into 'main'
docs: Mark various deprecations

See merge request GNOME/gtk!5502
2023-02-12 21:44:00 +00:00
Yuri Chornoivan
84b5e94ffd Update Ukrainian translation 2023-02-12 17:56:09 +00:00
Matthias Clasen
679d510059 Merge branch 'template-child-dispose-order' into 'main'
gtk: Set widget template children to NULL before destroy unref

See merge request GNOME/gtk!4611
2023-02-12 16:36:52 +00:00
Marco Melorio
d2755e0385 inscription: Add single-line-mode property
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5444.
2023-02-12 17:35:56 +01:00
Matthias Clasen
0c2b437643 Merge branch 'main' into 'main'
Add note about widgets implementing the interface adding the `horizontal`/`vertical` CSS classes

See merge request GNOME/gtk!5391
2023-02-12 16:28:12 +00:00
madmurphy
0764cf0c9c Add note about widgets implementing the interface adding the horizontal/vertical CSS classes 2023-02-12 16:28:12 +00:00
Marco Melorio
2504215459 docs: Mark everything in GtkVolumeButton as deprecated 2023-02-12 17:20:11 +01:00
Marco Melorio
d45db3a961 docs: Mark everything in GtkStatusBar as deprecated 2023-02-12 17:20:11 +01:00
Matthias Clasen
557a1ed879 Merge branch 'no-more-lpr' into 'main'
printing: Drop the lpr backend

See merge request GNOME/gtk!5500
2023-02-12 15:29:27 +00:00
Matthias Clasen
c28b6a3ee6 Merge branch 'texture-atlas-crash' into 'main'
gl: Avoid a crash in the texture library

Closes #5175

See merge request GNOME/gtk!5501
2023-02-12 15:28:06 +00:00
Marco Melorio
b34c139028 docs: Mark everything in GtkLockButton as deprecated 2023-02-12 16:12:17 +01:00
Matthias Clasen
dd22e2aea9 printing: Drop the lpr backend
We want to consolidate and get to fewer print
backends (ideally only one), and the future is cpdb.
2023-02-12 10:10:06 -05:00
Marco Melorio
6e6f2f652c docs: Mark everything in GtkCellAreaContext as deprecated 2023-02-12 16:09:39 +01:00
Marco Melorio
3aac70f245 docs: Mark everything in GtkAssistant as deprecated 2023-02-12 16:09:25 +01:00
Matthias Clasen
7f3ea15d80 Update POTFILES.in 2023-02-12 10:09:22 -05:00
Matthias Clasen
d3dfdd214f gl: Avoid a crash in the texture library
entry->texture can be NULL, so check before
using it.

Fixes: #5175
2023-02-12 10:01:11 -05:00
Matthias Clasen
b6c3cf4eee gl: Maintain state when truncating
When we truncate the command queue because it
is too big, we were messing up our state accounting
and running into criticals as a consequence.

This can be reproduced by opening a well-populated
fishbowl demo in the inspectors recorder.

Fixes: #5188
2023-02-12 09:56:32 -05:00
Matthias Clasen
157ef1d395 Deprecate GtkVolumeButton
Too specialized.
2023-02-12 09:48:49 -05:00
Matthias Clasen
d0263f563a NEWS: Updates 2023-02-12 09:21:38 -05:00
Matthias Clasen
83b48bb25f Merge branch 'mask-nodes-rebased' into 'main'
gsk: Introduce mask nodes

See merge request GNOME/gtk!5497
2023-02-12 14:11:47 +00:00
Matthias Clasen
81e9eca256 Merge branch 'nacho/scalebutton-active' into 'main'
gtkscalebutton: add active property

See merge request GNOME/gtk!5492
2023-02-12 14:01:27 +00:00
Ignacio Casal Quinteiro
44c2d585b8 gtkscalebutton: add active property 2023-02-12 14:01:26 +00:00
Matthias Clasen
348803af7d Add a mask node demo 2023-02-12 08:35:25 -05:00
Matthias Clasen
c8bfea7aa1 Add a test for mask nodes 2023-02-12 08:35:25 -05:00
Matthias Clasen
8f47e885f0 Add gtk_snapshot_push_mask 2023-02-12 08:35:25 -05:00
Matthias Clasen
a9f50f1f7a gl: Support mask nodes
Add a shader for masking.
2023-02-12 08:35:25 -05:00
Matthias Clasen
0d58e5365d gsk: Introduce mask nodes
Add GskMaskNode, and support it in the render node
parser, in the inspector and in GtkSnapshot.

The rendering is just fallback for now.

Based on old work by Timm Bäder.
2023-02-12 08:35:25 -05:00
Ekaterine Papava
d00d4c4475 Update Georgian translation 2023-02-12 12:30:05 +00:00
Piotr Drąg
a6e7c38236 Update POTFILES.in 2023-02-12 13:20:48 +01:00
Matthias Clasen
eee7e59265 Merge branch 'fix_editable_label' into 'main'
Remove timeout when disposing GtkEditableLabel

Closes #5584

See merge request GNOME/gtk!5499
2023-02-12 02:55:45 +00:00
Matthias Clasen
c2cb1ffe9e Merge branch 'wip/wl-dispatch-helper' into 'main'
wayland: Add event queue dispatch helper

See merge request GNOME/gtk!5498
2023-02-12 01:01:29 +00:00
Alexandros Theodotou
d918a77d34 Remove timeout when disposing GtkEditableLabel
Fixes: #5584
2023-02-12 09:45:07 +09:00
Matthias Clasen
2285ef3824 Merge branch 'scaled-textures' into 'main'
Scaled textures

See merge request GNOME/gtk!5488
2023-02-11 22:16:43 +00:00
Jonas Ådahl
b2a2bf819d wayland/launch-context: Use dispatch helper
Otherwise we risk a busy loop if e.g. the pipe broke.
2023-02-11 23:14:53 +01:00
Jonas Ådahl
dd9433b50e wayland: Add event queue dispatch helper
Dispatch failing should always fatal; use a helper to centralize the
error handling everywhere.
2023-02-11 23:13:39 +01:00
Matthias Clasen
67c53e46f9 Add gtk_snapshot_append_scaled_texture
This is the snapshot api corresponding to
gsk_texture_scale_node_new.
2023-02-11 15:09:38 -05:00
Matthias Clasen
238e7ec351 Add a test for scaled textures 2023-02-11 15:09:38 -05:00
Matthias Clasen
d916659781 gl: Handle GskTextureScaleNodes 2023-02-11 15:09:38 -05:00
Matthias Clasen
82c02574f1 gl: Make texture slicing more flexible
Allow to specify the filtering to use for the slices,
and allow forcing the number of slices. This will be
used in the next commit.
2023-02-11 15:09:38 -05:00
Matthias Clasen
26e6d2106b gl: Pass filters down from visit_texture_node
For now, we always pass GL_LINEAR.
2023-02-11 15:09:38 -05:00
Matthias Clasen
625ffa2d96 gtk-demo: Add filtering to the zoom demo 2023-02-11 15:09:38 -05:00
Matthias Clasen
dd3eedd510 gtk-demo: Rewrite the zoom demo slightly
Use a texture directly instead of a paintable.
This will be used in the following commit to
introduce filters.
2023-02-11 15:09:38 -05:00
Matthias Clasen
dc3a72cf38 nodeparser: Support texture-scale nodes 2023-02-11 15:09:38 -05:00
Matthias Clasen
b937c19dd4 gsk: Introduce GskTextureScaleNode 2023-02-11 15:09:38 -05:00
Matthias Clasen
04c3af537c Merge branch 'wip/handle-more-wl-dispatch-failures' into 'main'
wayland: Handle dispatch failing in a couple of more places

See merge request GNOME/gtk!5495
2023-02-11 19:56:45 +00:00
Matthias Clasen
cc43f5dcde gsk: Generate mipmaps when requested
If the min_filter requires it, call
glGenerateMipmap for our textures.
2023-02-11 09:29:03 -05:00
Matthias Clasen
c74d7afce5 gsk: Don't limit filters too much
GL does not allow mipmapping for mag filters,
but it doesn't have a problem with it for min
filters.
2023-02-11 09:29:03 -05:00
Matthias Clasen
52e18eb7fb Merge branch 'matthiasc/for-main' into 'main'
gdkevents.c: Fix up folding

See merge request GNOME/gtk!5496
2023-02-11 14:18:42 +00:00
Matthias Clasen
c0b5b4b8c1 gskrendernodeimpl.c: Use folding
Instead of homegrown markup.
2023-02-11 09:00:07 -05:00
Matthias Clasen
d497e721c9 gdkevents.c: Fix up folding
The modeline was lost at some point,
and superfluous spacing inserted.
2023-02-11 08:59:51 -05:00
Jonas Ådahl
a7fb9a6865 wayland: Handle dispatch failing in a couple of more places
Without doing this, we'll end up with risking GTK processes sitting
eating 100% CPU instead of just exit(1):ing.
2023-02-11 11:42:21 +01:00
Marek Kašík
2365d9be18 Merge branch 'cpdb' into 'main'
New CPDB print backend for GTK Print Dialog

See merge request GNOME/gtk!4930
2023-02-10 23:10:20 +00:00
tinytrebuchet
41b60bbd6c New CPDB print backend for GTK Print Dialog
The Common Print Dialog Backends (CPDB) concept has GUI-toolkit-independent
backends for each print technology (CUPS, Print to File, cloud printing
services, ...) and each print dialog (GTK, Qt, Chromium, ...) is supposed
to use this backend, so that changes in print technologies can be centrally
and quickly covered by changing the backends and everything new gets available
in all print dialogs.

This commit provides a GTK print dialog backend to add support for the CPDB
concept. It communicates with all installed CPDB backends and so gives support
for all these print technologies to the GTK print dialog.

To make use of CPDB the GTK print dialog is supposed to be installed with this
backend and the 'Print To File' backend, and not any others to prevent printer
duplication.
2023-02-11 01:13:48 +05:30
Emin Tufan Çetin
f0d3d011ea Update Turkish translation 2023-02-10 05:57:42 +00:00
Cameron White
0cb3555a65 Fix a couple incorrect annotations for optional parameters
The 'optional' annotation should be used in these cases rather than 'nullable'.
NULL can provided to ignore these output parameters, but the function is
not setting the output parameter to NULL.
2023-02-09 22:46:43 -05:00
Matthias Clasen
48e141a42c Merge branch 'avoid-criticals-tracker' into 'main'
searchengine: Avoid criticals when tracker init failed

See merge request GNOME/gtk!5489
2023-02-09 19:43:31 +00:00
Gaël Bonithon
6215b38e64 searchengine: Emit a simple warning when tracker init failed
Failure is allowed by nature of GInitable, and this avoids unnecessary
crashing of programs running with G_DEBUG=fatal-criticals.
2023-02-09 19:46:30 +01:00
Gaël Bonithon
41490f9624 searchengine: Add missing sanity check 2023-02-09 19:25:04 +01:00
Vasil Pupkin
45e6e9a7d1 Update Belarusian translation 2023-02-08 21:48:28 +00:00
Matthias Clasen
9991d6834d Merge branch 'stop-testing-pixbuf-formats' into 'main'
Drop pixbuf format tests

See merge request GNOME/gtk!5486
2023-02-07 18:48:39 +00:00
Matthias Clasen
ddf8c4dd1a Drop pixbuf format tests
We have our own loaders for the formats we
always want to support, so we don't need to
check for what gdk-pixbuf supports.
2023-02-07 07:54:22 -05:00
Matthias Clasen
970072ef65 Merge branch 'file-dialog-fixes' into 'main'
filedialog: Robustness fixes

See merge request GNOME/gtk!5485
2023-02-07 12:42:09 +00:00
Matthias Clasen
f8321029fc filedialog: Robustness fixes
This code was not working well.
2023-02-06 23:16:17 +01:00
Matthias Clasen
f83cab01ec filechooserportal: Fix an oversight 2023-02-06 20:28:35 +01:00
Sabri Ünal
8a74770ec1 Update Turkish translation 2023-02-06 09:19:35 +00:00
Matthias Clasen
39c503c108 Merge branch 'matthiasc/for-main' into 'main'
CONTRIBUTING: Updates

See merge request GNOME/gtk!5483
2023-02-06 06:53:14 +00:00
Matthias Clasen
fc32b8242b CONTRIBUTING: Updates
Mention matrix instead of irc, and ask
for display/graphics as essential info
in issues.
2023-02-06 07:35:11 +01:00
Piotr Drąg
7c2b4eb0e7 Update Polish translation 2023-02-05 15:22:00 +01:00
Matthias Clasen
d8b0aea6b7 Merge branch 'rename-openuri-portal' into 'main'
Use a Gtk prefix for dbus-generated code

Closes #5572

See merge request GNOME/gtk!5482
2023-02-05 08:27:09 +00:00
Matthias Clasen
190d8ef8ff Use a Gtk prefix for dbus-generated code
Copying this file from GIO without renaming it
was not the greatest idea in retrospect.

Fixes: #5572
2023-02-05 09:09:22 +01:00
Cheng-Chia Tseng
15e9194b59 Update Chinese (Taiwan) translation 2023-02-04 16:28:15 +00:00
Matthias Clasen
0257da6cc0 Post-release version bump 2023-02-04 17:01:51 +01:00
Matthias Clasen
907f878c9f make-release: Explicily enable introspection 2023-02-04 16:31:55 +01:00
Matthias Clasen
b2071cdeb5 4.9.3 2023-02-04 16:16:54 +01:00
Matthias Clasen
1a292bf8ab Merge branch 'wip/carlosg/scroll-fix' into 'main'
gdk/x11: Reset all scroll valuators on enter

Closes #4160

See merge request GNOME/gtk!5479
2023-02-04 13:14:02 +00:00
Matthias Clasen
7e07d63a6c Merge branch 'ebassi/stack-at-context' into 'main'
a11y: Clear the GtkATContext in a single step

See merge request GNOME/gtk!5477
2023-02-04 12:37:20 +00:00
Carlos Garnacho
824e983372 gdk/x11: Reset all scroll valuators on enter
We no longer need to make much distinction between multiple logical
devices, plus it breaks esp. with the Xwayland input device distribution.
Just iterate across all devices and reset their scroll valuators.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4160
2023-02-04 13:13:19 +01:00
Matthias Clasen
9e5417c6c7 Merge branch 'wip/carlosg/wayland-device-refactor' into 'main'
Refactor some wayland code

See merge request GNOME/gtk!5473
2023-02-04 07:48:33 +00:00
Matthias Clasen
e94dae8536 Merge branch 'rgba-free-checked' into 'main'
gtktextview: Avoid calling gdk_rgba_free for NULL values

See merge request GNOME/gtk!5474
2023-02-04 07:48:24 +00:00
Matthias Clasen
0dd163254d Merge branch 'ebassi/accessible-editable' into 'main'
a11y: Simplify GtkAccessible implementation for editables

See merge request GNOME/gtk!5475
2023-02-04 07:47:36 +00:00
Emmanuele Bassi
341ecab41a a11y: Clear the GtkATContext in a single step
There's no need to unrealize the GtkATContext inside dispose() and then
drop its reference inside finalize().
2023-02-03 17:11:22 +01:00
Marco Trevisan (Treviño)
9eac7ed8b9 gtktextview: Avoid calling gdk_rgba_free for NULL values
Related to glib#2908
2023-02-03 16:41:56 +01:00
Carlos Garnacho
4005eb8fe8 gdk/wayland: Rename gdkkeys-wayland.c file
Since it contains the GdkKeymap implementation, give it a more
obvious name.
2023-02-03 16:15:34 +01:00
Carlos Garnacho
1d4ceac2c5 gdk/wayland: "Split" GdkWaylandDevice implementation out
This is a bit spaghetti right now, since seats and devices were
heavily entangled there are a number of crossed private API calls that
should ideally not be there.

Let this be a first step, so more bits may move from the seat
implementation to devices.
2023-02-03 16:15:34 +01:00
Carlos Garnacho
a5246a6856 gdk/wayland: Split GdkDevicePad wayland implementation
This now lives in its own C file.
2023-02-03 16:08:07 +01:00
Lukáš Tyrychtr
11d235d165 a11y: Simplify GtkAccessible implementation for editables
This commit implements the idea brought up in #5032, and provides a
simple function for GtkEditable implementations using a delegate object.
The accessible state is proxied from the outher GtkEditable to the
delegate.
2023-02-03 16:08:06 +01:00
Carlos Garnacho
af00beb772 gdk/wayland: Move struct declarations to header
These will be used from outside the main file, after we are
done splitting it.
2023-02-03 16:00:01 +01:00
Carlos Garnacho
e5cd9354d5 gdk/wayland: Move GdkWaylandDevice data to private struct
Before splitting this object, avoid leaking details in its struct.
2023-02-03 15:58:11 +01:00
Carlos Garnacho
6426ab7466 gdk/wayland: Rename gdkdevice-wayland.c to gdkseat-wayland.c
This file, event though a clump of input-y objects, has more of
seats than anything else. Rename it so that we can start splitting
these objects out of it.
2023-02-03 15:58:11 +01:00
Matthias Clasen
b710df6f45 Merge branch 'file-chooser-context-menu' into 'main'
filechooser: Fix context menus

Closes #5554

See merge request GNOME/gtk!5472
2023-02-03 13:39:21 +00:00
Matthias Clasen
50998b0ee9 Merge branch 'drag-icon-robustness' into 'main'
dragicon: Handle files without info

See merge request GNOME/gtk!5460
2023-02-03 13:19:26 +00:00
Matthias Clasen
92c2c68c7b filechooser: Fix context menus
We only want to show the file list context menu
when we are over the file list.

Fixes: #5554
2023-02-03 14:17:34 +01:00
Matthias Clasen
c2f5b64b5d Merge branch 'ebassi/public-accessible' into 'main'
Make GtkAccessible public

Closes #4240

See merge request GNOME/gtk!5470
2023-02-03 11:31:06 +00:00
Matthias Clasen
460bf6d8b9 inspector: Show if accessibles aren't realized
This prevents confusion and makes it clear
what is going on.
2023-02-03 11:49:17 +01:00
Emmanuele Bassi
a0dff87c86 a11y: Documentation and code style fixes 2023-02-03 11:49:17 +01:00
Emmanuele Bassi
3015b9f120 a11y: Fix get_bounds() implementation
Don't allocate graphene_rect_t, and fix the size retrieval.
2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
01549e3c91 Take the widget transform into account when computing the bounds for a11y 2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
bc48bfc2b6 a11y: Use a DOM-like API for iterating accessible objects
The `get_child_at_index()` API model comes from AT-SPI, and it's not an
efficient design, especially when coupled with large widgets.

Replace `get_child_at_index()` with `get_first_accessible_child()` and
`get_next_accessible_sibling()`.

That allows efficiently retrieving all the children, simplifies the
implementation of GtkAccessible in GtkWidget and closely resembeles the
GtkWidget API.

Getting the last child and previous sibling for iterating backwards is
not a part of the interface at the moment, but they can be added at a
later date.

Note that this change required tracking the next stack page in
GtkStackPage.
2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
6100258ba2 a11y: Rename GtkAccessible.get_parent
Avoid a collision when the type implementing the GtkAccessible interface
already has a `get_parent()` method—like GtkWidget.
2023-02-03 11:49:17 +01:00
Emmanuele Bassi
e083bd7920 Apply trivial review suggestions 2023-02-03 11:49:17 +01:00
Emmanuele Bassi
e915546b44 Add versioned symbol annotations 2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
b6cfe35940 Style fixes
Documentation and coding style updates.
2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
4cd9fd9b15 stack: Use a pointer array for children
Reduce our dependency on linked lists; pointer arrays are better at
cache locality.

Additionally, we can avoid quadratic behaviors when finding a child at a
given index.
2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
6f8cab0e9d Style fix 2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
6eb9161906 Improve documentation 2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
d13695f586 a11y: Implement new GtkAccessible vfuncs in GtkStack
Implement the virtual a11y children for GtkStack.
2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
749919c551 Update API docs 2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
58980e0b4a Make GtkAccessible public
Out of tree classes need to be able to implement the GtkAccessible
interface, in order to implement custom accessible objects.

Fixes: #4240
2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
5813a5cace a11y: Add bounds rectangle to GtkAccessible
Make the bounds calculation part of the accessible interface.

Bounds are used by ATs like Orca to implement features like Flat Review:

https://help.gnome.org/users/orca/stable/howto_flat_review.html.en

Or to determine the area of a non-presentational widget.
2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
f88b777fe5 widget: Implement new GtkAccessible vfuncs 2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
a80af681b8 a11y: Skip non-presentable objects
Don't get confused with non-presentable objects when iterating the list
of children.
2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
94695bb276 a11y: Use GtkAccessible for tree traversal
Remove the widget tree dependence from GtkAtSpiContext.
2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
be36113826 a11y: Implement the new GtkAccessible vfuncs
Implement the gtk_accessible functions and begin removing the old widget
based tree calls.
2023-02-03 11:49:17 +01:00
Lukáš Tyrychtr
5dfbaa53fc a11y: Add DOM-like API to GtkAccessible
Add get_parent and get_child_at_index to GtkAccessible so we can
decouple the a11y tree from the widget tree.
2023-02-03 11:49:17 +01:00
Matthias Clasen
a13ddcb67b Merge branch 'filechooser-sidebar' into 'main'
placessidebar: Make all rows ellipsize

Closes #4710

See merge request GNOME/gtk!5471
2023-02-03 09:41:21 +00:00
Carlos Garnacho
d228bae365 Merge branch 'drag-button-issue' into 'main'
Fix button mask calculation for Wayland

Closes #5561

See merge request GNOME/gtk!5468
2023-02-03 09:28:01 +00:00
Matthias Clasen
463f12a3bb placessidebar: Make all rows ellipsize
Otherwise, we end up with a single long row
pushing the content of all the other rows
off to the left, which is much worse than
ellipsizing.

Fixes: #4710
2023-02-03 10:00:03 +01:00
Matthias Clasen
3f87b130ba NEWS: Updates 2023-02-03 09:26:50 +01:00
Benjamin Otte
c17049c6d1 Merge branch 'wip/otte/gl-is-current' into 'main'
gdk: Add private GLContext::is_current() check

Closes #5392

See merge request GNOME/gtk!5463
2023-02-02 21:56:32 +00:00
Arjan Molenaar
f000baf0d6 wayland: Fix button mask for button 2 and 3
Wayland and GTK order mouse button 2 and 3 differently.

Fixes #5561.
2023-02-02 21:48:58 +01:00
Arjan Molenaar
aef4c50155 Allow all mouse buttons to be used for the drawingarea demo
So we can test if the drag gesture works with all mouse buttons.
2023-02-02 21:29:45 +01:00
Matthias Clasen
2a1e4b8621 Merge branch 'matthiasc/for-main' into 'main'
Matthiasc/for main

See merge request GNOME/gtk!5467
2023-02-02 17:36:44 +00:00
Matthias Clasen
cabd18fba0 textbtree: Fix a compiler warning 2023-02-02 17:15:28 +01:00
Matthias Clasen
1da4782262 gsk: Fix a compiler warning 2023-02-02 17:15:28 +01:00
Matthias Clasen
8911ed5d9b Merge branch 'monitor-description' into 'main'
Add GdkMonitor::description

See merge request GNOME/gtk!5466
2023-02-02 14:12:23 +00:00
Matthias Clasen
294b659dc1 Merge branch 'wip/carlosg/deprecations' into 'main'
Some deprecations and cleanups

See merge request GNOME/gtk!5465
2023-02-02 14:11:58 +00:00
Carlos Garnacho
7ad74ad6c3 gdk/wayland: Deprecate GdkDisplay windowing-specific for startup IDs
This is currently just used as a convenience storage of the startup ID
between the GtkApplication and the GtkWindow (after it's ready to notify
on it).

This could be untangled in the GTK layers so there is no involvement
from GDK in keeping the startup ID around, in the mean time just deprecate
these gdk_wayland* API calls.
2023-02-02 12:50:59 +01:00
Carlos Garnacho
bb777507ce gtkmodelbutton: Avoid gtk_gesture_set_sequence_state()
It is not necessary for this widget to know about the specific
sequence that is interacting.
2023-02-02 12:50:59 +01:00
Carlos Garnacho
1e1d79d4f7 gtktextview: Avoid gtk_gesture_set_sequence_state()
Use gtk_gesture_set_state() as this widget does not need specific
knowledge on the sequence being used for interaction.
2023-02-02 12:50:59 +01:00
Carlos Garnacho
a254a4529f gtkscrolledwindow: Clean up input handling a bit
These pieces were added in commit 8d2f81cca4, but are no longer
necessary since there's no capture_button_press special behavior
toggle.

This can be simplified again.
2023-02-02 12:50:59 +01:00
Matthias Clasen
e7bd691532 inspector: Show monitor descriptions 2023-02-02 12:32:28 +01:00
Matthias Clasen
4e62350232 wayland: Set up monitor descriptions
We get this information in the xdg_output protocol.
2023-02-02 12:32:28 +01:00
Matthias Clasen
2c883a70e2 Add GdkMonitor::description
This is the right string to when showing
monitors in the UI.
2023-02-02 12:32:28 +01:00
Matthias Clasen
3dfeb2fd37 monitor: Document connector names better 2023-02-02 12:32:28 +01:00
Carlos Garnacho
3ba3e8286f gtkwindowhandle: Refactor click handling a bit
Do not get a GdkEvent first and foremost, and only do that in the
parts where the GdkEvent is absolutely necessary (i.e. popping up
the WM menu for the window).
2023-02-02 11:21:22 +01:00
Carlos Garnacho
fbf4817ef5 gtkgesture: Deprecate gtk_gesture_set_sequence_state()
We can abstract widgets about the specific ongoing sequences that
are triggering a GtkGesture. This used to be more necessary in
GTK3 world where complex widgets might have required handling
different events in different areas, but in GTK4 world that would
be done with multiple widgets.

This is no longer necessary to carry forward.
2023-02-02 11:21:22 +01:00
Carlos Garnacho
db43e0669f gtkscrolledwindow: Avoid gtk_gesture_set_sequence_state()
This widget does not require special knowledge about the ongoing
event sequences, just make it use gtk_gesture_set_state() generically.
2023-02-02 11:21:22 +01:00
Carlos Garnacho
386c77b13d gtkwindowhandle: Avoid gtk_gesture_set_sequence_state()
It does not require special knowledge about the ongoing event
sequences, and it can instead trust the event controller. Make
it use gtk_gesture_set_state() generically.
2023-02-02 11:21:21 +01:00
Matthias Clasen
e6998dffe8 Merge branch 'small-gltexture-cleanup' into 'main'
gltexture: Small refactoring

See merge request GNOME/gtk!5464
2023-02-02 09:16:09 +00:00
Matthias Clasen
12057c8a30 gltexture: Small refactoring
We do this in two places, so factor out
the dropping of GL resources into a helper.
2023-02-02 10:01:36 +01:00
Matthias Clasen
b7c422cb98 ci: Stop running the asan build every time
It fails because of address sanitizer crashes,
and takes a long time. It is not that useful
in this shape.
2023-02-02 09:07:10 +01:00
Matthias Clasen
1c76f6586b Update po/POTFILES.in
Deprecations affect this file.
2023-02-02 09:05:31 +01:00
Matthias Clasen
d43968f7b6 Fix a deprecation warning 2023-02-02 09:03:26 +01:00
Matthias Clasen
26650787e1 main: Compiler warnin gfixes 2023-02-02 08:44:53 +01:00
Matthias Clasen
b4ef072188 icontheme: Compiler warning fixes 2023-02-02 08:44:28 +01:00
Matthias Clasen
3858c5282c Deprecate GtkAssistant
It is a dialog-like toplevel, and libadwaita has
replacement parts (like AdwCarousel).
2023-02-02 08:39:25 +01:00
Matthias Clasen
1ff8dad8ec Deprecate GtkLockButton
This is a very specialized widget, and should really just
live with the applications where it is used.
2023-02-02 08:39:25 +01:00
Matthias Clasen
d8cb11ec4a Deprecate GtkStatusbar
The design patterns using statusbar are no longer popular,
and it is pretty easy to make a statusbar yourself with boxes
and labels, if you need one. The only thing special about
GtkStatusbar was its window resize handle, but that has
been gone for a long time.
2023-02-02 08:39:24 +01:00
Matthias Clasen
8796950651 Deprecate more startup-notification API 2023-02-02 08:30:32 +01:00
Benjamin Otte
c6cef6db52 gdk: Add private GLContext::is_current() check
... and use this check in gdk_gl_context_make_current() and
gdk_gl_context_get_current() to make sure the context really is still
current.

The context no longer being current can happen when external GL
implementations make their own contexts current in the same threads GDK
contexts are used in.
And that can happen for example by WebKit.

Theoretically, this should also allow external EGL code to run in X11
applications when GDK chooses to use GLX, but I didn't try it.

Fixes #5392
2023-02-02 04:23:51 +01:00
Benjamin Otte
fdea27c04d win32: Remove unused variable 2023-02-02 04:23:51 +01:00
Fran Dieguez
a52f9d6def Update Galician translation 2023-02-01 19:12:29 +00:00
Benjamin Otte
ee272646c9 Merge branch 'fix-gltexture-confusion' into 'main'
gltexture: Use the right context

See merge request GNOME/gtk!5461
2023-02-01 18:47:28 +00:00
Matthias Clasen
6655177a0b Cosmetics 2023-02-01 18:38:22 +01:00
Daniel Mustieles
cb78f0d10a Update Spanish translation 2023-02-01 15:28:00 +00:00
Matthias Clasen
1cb621633c gltexture: Use the right context
When checking characteristics of the context
for downloading, we were using self->context,
even though we are using a possibly different
context for downloading.

Pass the right context along and use it.
2023-02-01 11:32:07 +01:00
Kukuh Syafaat
ce25efeee7 Update Indonesian translation 2023-02-01 03:14:46 +00:00
Matthias Clasen
375b554924 Merge branch 'fix-gst-sync' into 'main'
gst: Fix synchronization

See merge request GNOME/gtk!5459
2023-01-31 12:28:27 +00:00
Matthias Clasen
69eed999bb gst: Rename a field for clarity
gst_gdk_context is clearer than gst_app_context. Maybe
2023-01-30 15:01:31 -05:00
Matthias Clasen
cab5f2bd8d Merge branch 'file-chooser-dnd-crash' into 'main'
filechooserwidget: Fix file chooser crash when dropping empty file list

See merge request GNOME/gtk!5456
2023-01-30 19:28:24 +00:00
Fina Wilke
35e3c22832 filechooserwidget: Fix file chooser crash when dropping empty file list 2023-01-30 19:28:24 +00:00
Matthias Clasen
92612c2265 filetransfer: Be more careful around files
File may not have paths, and we should handle
that without incident. While we are at it, add
some logging so GDK_DEBUG=dnd gives us enough
output to see what is going on.
2023-01-30 14:03:13 -05:00
Matthias Clasen
4e1b46a7ec dragicon: Handle files without info
g_file_query_info can (and does) fail,
occasionally. Handle it.
2023-01-30 14:03:13 -05:00
Matthias Clasen
55f7f7d0ee gst: Fix synchronization
It does not make sense to sync and wait in the
same context, that is just a no-op. The intention
of this code clearly was to sync in the gst
context, and wait in the gdk one.

That also matches what the gtk sink implementation
in gstreamer does.
2023-01-30 12:04:49 -05:00
Matthias Clasen
442cd4a369 Merge branch 'password-entry-unrealize' into 'main'
passwordentry: Fix an asymmetry

Closes #5285

See merge request GNOME/gtk!5457
2023-01-30 12:29:33 +00:00
Matthias Clasen
53af41e2fa passwordentry: Fix an asymmetry
When connecting a signal in realize,
we should disconnect in unrealize.

Fixes: #5285
2023-01-29 22:39:28 -05:00
Matthias Clasen
c43e1f3d0a gsk: Quiet a compiler warning 2023-01-28 21:13:10 -05:00
Jürgen Benvenuti
32e855ad61 Update German translation 2023-01-28 19:59:19 +00:00
Benjamin Otte
034a8a5501 Merge branch 'tooltip-size-simplification' into 'main'
tooltip: Don't play games with max-width-chars

Closes #4470 and #5521

See merge request GNOME/gtk!5455
2023-01-28 18:26:00 +00:00
Matthias Clasen
1e9dbf2df0 tooltip: Prevent too-wide tooltip windows
Set the label to expand, so it actually fills
the width that we allocated for it, instead
of shrinking back to the minimum width for
its height.

Fixes: #5521
2023-01-28 13:07:26 -05:00
Matthias Clasen
dce21f06dd tooltip: Don't play games with max-width-chars
Setting max-width-chars to the number of characters
in the string works ok only as long as the average
char width we get from Pango matches reality. Sadly
that seems not always the case, and this code was
causing short Chinese tooltips to always be broken
into two lines.

Fixes: #4470
2023-01-28 13:06:30 -05:00
Piotr Drąg
56c1c4152f Update POTFILES.in 2023-01-28 14:05:01 +01:00
Matthias Clasen
a9d2fa296e Merge branch 'position-as-double' into 'main'
Boyscouting: fix position type in `gtk_drag_source_drag_begin()`

See merge request GNOME/gtk!5437
2023-01-28 03:24:19 +00:00
Carlos Garnacho
5bccb106c2 Merge branch 'work/zzag/activation-token-dbus' into 'main'
wayland: Fix handling of activation-token in org.freedesktop.Application requests

See merge request GNOME/gtk!5151
2023-01-28 00:44:25 +00:00
Yuri Chornoivan
45086487f1 Update Ukrainian translation 2023-01-27 19:23:39 +00:00
Vlad Zahorodnii
65f03121a4 wayland: Fix handling of activation-token in org.freedesktop.Application requests
At the moment, GTK applications search for "desktop-startup-id" in the
platform data on Wayland , but desktop environments such as plasma set
"activation-token" property instead as indicated in the spec:

    activation-token: This should be a string of the same value as would
    be stored in the XDG_ACTIVATION_TOKEN environment variable, as specified
    by the XDG Activation protocol for Wayland.

https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#dbus
2023-01-27 19:20:53 +00:00
Carlos Garnacho
09769193d7 Merge branch 'wip/carlosg/broadway-fix' into 'main'
gdk/broadway: Add deprecation guards around gdk_display_put_event()

See merge request GNOME/gtk!5450
2023-01-27 19:20:28 +00:00
Carlos Garnacho
7f8acf960b gdk/broadway: Add deprecation guards around gdk_display_put_event()
This went missing.
2023-01-27 19:59:36 +01:00
Matthias Clasen
ee0e026237 Merge branch 'fix_5551' into 'main'
object_tree.c: One gtk_list_item_get_child call is redundant

Closes #5551

See merge request GNOME/gtk!5449
2023-01-27 16:22:17 +00:00
Matthias Clasen
6bfd581a72 Merge branch 'wip/sophie-h/scrolled-window-propagate-event' into 'main'
scrolledWindow: Propagate event for no scrolling

See merge request GNOME/gtk!5447
2023-01-27 14:54:33 +00:00
Lukáš Tyrychtr
7b6f254e64 object_tree.c: One gtk_list_item_get_child call is redundant
Fixes #5551
2023-01-27 15:43:33 +01:00
Hugo Carvalho
47955cfe62 Update Portuguese translation 2023-01-27 14:26:32 +00:00
Sophie Herold
e62ca17f88 scrolledWindow: Propagate event for no scrolling 2023-01-26 20:12:10 +01:00
Matthias Clasen
c24ba58acb Merge branch 'broadway-modal-hint' into 'main'
[GTK4] gdk/broadway: Implements modal hint for Broadway surface

See merge request GNOME/gtk!4428
2023-01-26 02:44:54 +00:00
Matthias Clasen
30987168fb Merge branch 'fix_5543' into 'main'
GtkCssProvider: fix element type in docs

Closes #5543

See merge request GNOME/gtk!5441
2023-01-25 13:08:07 +00:00
Lukáš Tyrychtr
93a875bf20 Actually, the annotation is not needed in this case 2023-01-25 11:46:53 +01:00
Yosef Or Boczko
aac3bf581a Update Hebrew translation 2023-01-25 08:15:09 +00:00
Matthias Clasen
869f07521c Merge branch 'macos-fix-popups' into 'main'
macos: Fix popup event handling

Closes #5528

See merge request GNOME/gtk!5436
2023-01-24 16:37:23 +00:00
Matthias Clasen
7e392a1186 Merge branch 'wip/abono/gtk-switch-state-off' into 'main'
gtkswitch: Allow to set state FALSE while keeping active TRUE

See merge request GNOME/gtk!5442
2023-01-24 16:08:57 +00:00
Alessandro Bono
53d87e42a5 gtkswitch: Decouple set_state with set_active.
Allow the user to set a state that doesn't reflect the active property.
2023-01-24 14:55:16 +01:00
Arjan Molenaar
6757a1b409 macos: Propagate events for child surfaces
Before, popup windows did not respond to mouse clicks.
This change fixes that.

Fixes #5528.
2023-01-24 09:07:33 +01:00
Maxim Zakharov
115738dd2f remove unused variable 2023-01-24 11:41:27 +11:00
Matthias Clasen
5caa66ffb7 Merge branch 'macos-native-dnd' into 'main'
macos: DnD Drag support

Closes #3423

See merge request GNOME/gtk!5416
2023-01-23 22:01:30 +00:00
Emmanuele Bassi
7df73c4fd2 Use wording from a suggestion 2023-01-23 11:50:28 +00:00
Lukáš Tyrychtr
1ea5a08c8f GtkCssProvider: fix element type in docs
The method takes an array of char, which actually is UTF-8, so make the docs say so.
Fixes #5543
2023-01-23 12:12:00 +01:00
Matthias Clasen
9c669cbe90 Merge branch 'matthiasc/for-main' into 'main'
iconhelper: Handle GtkSymbolicPaintable

See merge request GNOME/gtk!5440
2023-01-22 18:36:11 +00:00
Matthias Clasen
1a5184bc85 iconhelper: Handle GtkSymbolicPaintable
If we are given a GtkSymbolicPaintable,
treat it as symbolic.
2023-01-22 13:18:18 -05:00
Jordi Mas
8f2ad8f154 Update Catalan translation 2023-01-21 16:58:51 +01:00
Arjan Molenaar
d6ef39b9a2 macos: remove dead code 2023-01-21 15:22:13 +01:00
Arjan Molenaar
52f6acd398 macos: Send dragging events directly to the display
Instead of adding events to the application event queue, dispatch
them directly to the right display. We know this when the event is
to be dispatched.

This is the same as used for the `sendEvent` method in `GdkMacosWindow`.

To achieve this I factored out the generic NSEvent to GdkEvent translation.
We can send an event directly, when we receive it in the GdkMacosWindow
directly from the OS.
2023-01-21 14:54:12 +01:00
Ekaterine Papava
2f894bb4ef Update Georgian translation 2023-01-20 16:04:31 +00:00
Matthias Clasen
2509fe0d17 Merge branch 'matthiasc/for-main' into 'main'
Cosmetics

See merge request GNOME/gtk!5434
2023-01-17 21:37:39 +00:00
Matthias Clasen
83a5611ce8 settings: Modernize the code
Drop some things that are no longer relevant,
and make this code look like modern GObject code.
2023-01-17 15:19:50 -05:00
Arjan Molenaar
136c1ccd2c macos: Update event source doc
Update the documentation with the interaction pattern we
need to support DnD.
2023-01-17 16:37:21 +01:00
Arjan Molenaar
16e23b3f9e macos: align functions in gdkmacosdrag-private.h 2023-01-17 16:12:57 +01:00
Matthias Clasen
af088d5e11 settings: Drop object_list
This code came from a time when we were installing
additional settings at runtime. We no longer do that,
so this code is unnecessary.
2023-01-17 08:30:37 -05:00
Matthias Clasen
a6e1c5c96a modules: Cosmetics
Use g_strv_length, instead of open-coding it.
2023-01-17 07:47:28 -05:00
Matthias Clasen
3c8c54ed15 stylecascade: Avoid some allocations 2023-01-17 07:39:51 -05:00
Arjan Molenaar
628aeda7ee macos: Provide the right drag action
We should use the drag action/operation provided by the
drag handlers, not rely on our internal bookkeeping.
2023-01-16 23:21:35 +01:00
Arjan Molenaar
2669dc269b macos: Default kCFRunLoopAllActivities
It's actually a mask, but we'll keep it in to
avoid compiler warnings.
2023-01-16 20:28:38 +01:00
Matthias Clasen
c4d3d72c57 Merge branch 'fix-hidpi-pictures' into 'main'
picture: Fix hi-dpi image handling

See merge request GNOME/gtk!5430
2023-01-16 14:32:01 +00:00
Matthias Clasen
cd79159420 picture: Fix hi-dpi image handling
The idea behind this code was to let scalable
images (i.e. mainly SVGs) provide twice as much
detail when the scale is 2. But we were also
using a scaler for pngs, causing them to be too
small on a hidpi screen. Fix that.

Note that there are cases where you want scaling
for pngs (when you display them scaled down, so
the image has 'hidden' detail). But we are not
attempting to handle that situation automatically.
2023-01-16 08:48:37 -05:00
Arjan Molenaar
1bc63eeadb macos: Queue events during drag
By passing the events during a (midal-ish) drag operation to the main loop,
we're able to keep up with what's happening. This allows the internal
drag state (GtkDragSource) to be updated and be done when the drag is
done.
2023-01-16 14:47:49 +01:00
Emin Tufan Çetin
071c6c60c0 Update Turkish translation 2023-01-15 22:47:27 +00:00
Matthias Clasen
fc24f401b7 Merge branch 'matthiasc/for-main' into 'main'
Use GtkUriLauncher where appropriate

See merge request GNOME/gtk!5432
2023-01-15 18:48:22 +00:00
Matthias Clasen
6c96e51b07 Use GtkUriLauncher where appropriate
GtkLabel, GtkLinkButton and GtkAboutDialog
all have a uri, not a file, so it makes more
sense to use a GtkUriLauncher.
2023-01-15 13:26:53 -05:00
Matthias Clasen
e703163bc4 Merge branch 'uri-launcher-demo' into 'main'
urilauncher: Fix finish function mismatch

See merge request GNOME/gtk!5431
2023-01-15 17:47:18 +00:00
Matthias Clasen
ad549cbded gtk-demo: Add a uri launcher demo 2023-01-15 11:58:43 -05:00
Matthias Clasen
673beef210 urilauncher: Fix finish function mismatch
We need to call the finish function that
matches the async function.
2023-01-15 11:58:09 -05:00
Matthias Clasen
55baa1f2e1 Merge branch 'docs-escape-xml-tag' into 'main'
Escape GtkBuilder XML tag in comment with backtick

Closes #5312

See merge request GNOME/gtk!5429
2023-01-15 15:12:28 +00:00
Arjan Molenaar
1d8a23e97b macos: Provide fallback pasteboard for gtype Dnd
The Drag data should pass through the macos pasteboard system.
We need to provide some pasteboard type. Let's make it a "URL",
which is a pretty generic type anyway.
2023-01-15 10:03:47 +01:00
Arjan Molenaar
422b4b6561 macos: No need to drag handle events
This is handled by the DraggingSource object.
2023-01-15 10:03:47 +01:00
Arjan Molenaar
27ee8b23fd macos: No need to grab a seat
The macOS DnD logic will take over anyway.
2023-01-15 10:03:47 +01:00
Arjan Molenaar
b9847795a7 macos: Support dragging from GdkMacosWindow
The handling is done similar to drag targets.
Note that dragging is a modal action on macos: no events
are sent to the main window. This could cause trouble when
we finish the drag, and not finish the gesture in GTK.
2023-01-15 10:01:56 +01:00
sunce
b13f05537b Escape GtkBuilder XML tag in comment with backtick
Escape XML tags in gi-docgen oriented comment e.g. from <child> to
`<child>`, so that they don't become HTML tag on the final webpage.
This fix includes everything from commit ff46ea64 and #5312.

Fixes #5312
2023-01-15 16:55:18 +08:00
Arjan Molenaar
757d1916ae Fix dx, dy position in gtk_drag_source_drag_begin
Coordinates are double. This change avoid an unneeded cast.
2023-01-15 09:52:43 +01:00
Matthias Clasen
0834dac6ee Merge branch 'matthiasc/for-main' into 'main'
widgetfactory: Load textures in threads

See merge request GNOME/gtk!5428
2023-01-15 04:12:47 +00:00
Matthias Clasen
3c31f72219 texture: Update docs
Document that we support TIFF as well.
2023-01-14 22:48:57 -05:00
Matthias Clasen
a0f63160d6 widgetfactory: Load textures in threads
It is useful to show how this is done, even
though the images here are not terribly large.
2023-01-14 22:38:20 -05:00
Matthias Clasen
c99d85954a Merge branch 'nielsdg/gtkwidgetactionactivatefunc-nullable-variant' into 'main'
Add missing nullable to GtkWidgetActionActivateFunc

See merge request GNOME/gtk!5424
2023-01-15 00:46:11 +00:00
Matthias Clasen
33f31d06f9 Merge branch 'uri-launcher' into 'main'
filelauncher: Plug a memory leak

See merge request GNOME/gtk!5425
2023-01-14 22:59:01 +00:00
Matthias Clasen
bf4b40f17e docs: Update deprecations for gtk_show_uri
We have a better replacement now.
2023-01-14 17:39:28 -05:00
Matthias Clasen
7aba9e3295 urilauncher: Add cross-references to the docs 2023-01-14 17:39:28 -05:00
Matthias Clasen
3080cb7acd Add GtkUriLauncher 2023-01-14 17:39:28 -05:00
Matthias Clasen
4b404f0dea Add g_openuri_portal_open_uri_async
This avoids a roundtrip through GFile and
thus works with random uri schemes.
2023-01-14 14:32:51 -05:00
Matthias Clasen
0c1c0524c7 openuri: Some reshuffling
This is in preparation of adding a method
that takes a uri instead of a GFile.
2023-01-14 14:32:51 -05:00
Matthias Clasen
b58ef290dc filelauncher: Plug a memory leak
Oops
2023-01-14 14:32:51 -05:00
Niels De Graef
1387fba7f8 Add missing nullable to GtkWidgetActionActivateFunc
The `GVariant` that is passed on to the `GtkWidgetActionActivateFunc`
can be `NULL` in case the parameter type is also `NULL`, so mark it
nullable.
2023-01-14 15:30:15 +01:00
Matthias Clasen
34b9ec5be2 Merge branch 'matthiasc/for-main' into 'main'
Fix a compiler warning

See merge request GNOME/gtk!5423
2023-01-14 05:30:10 +00:00
Matthias Clasen
cefdfbd894 icontheme: Streamline the suffix handling code 2023-01-14 00:14:43 -05:00
Matthias Clasen
3676ddbdff icontheme: Avoid some allocations
When loading icon themes, we can reuse memory
instead of allocating and freeing in a loop.
2023-01-14 00:14:43 -05:00
Matthias Clasen
7c1a0e0c15 icontheme: Keep a single string set
Instead of keeping a GtkStringSet per IconTheme,
just make one for the whole GtkIconTheme.

This avoids loops of the themes in some places, and
due to the overlap in icon names between the themes,
it reduces the amount of memory we use for the icon
names with Adwaita+hicolor from 5+4 chunks to 6 chunks.
2023-01-14 00:14:43 -05:00
Matthias Clasen
19bb043a85 testsuite: Fix various compiler warnings
These are mostly dead stores that clang
isn't happy with.
2023-01-14 00:14:43 -05:00
Matthias Clasen
fecc80b59c Fix a compiler warning
Clang things that timings can be NULL here,
and I think it might be right.
2023-01-14 00:14:41 -05:00
Matthias Clasen
1648dc36f8 Merge branch 'wip/corey/fix-docs' into 'main'
docs: Fix dependency names

See merge request GNOME/gtk!5422
2023-01-14 04:23:34 +00:00
Matthias Clasen
a27a2cbf40 Merge branch 'matthiasc/for-main' into 'main'
Silence a compiler warning

See merge request GNOME/gtk!5421
2023-01-14 00:18:50 +00:00
Corey Berla
e418656a04 docs: Fix dependency names
When gi-docgen added the "related" key, it also began checking
that the dependencies were actually dependencies otherwise they aren't
listed as dependencies.  The capitalization needs to match the
namespace.
2023-01-13 14:24:33 -08:00
Matthias Clasen
d4ec1afe44 Merge branch 'fix-spinner-stop' into 'main'
gtkcssanimatedstyle: Fix return of new_advance()

Closes #4426

See merge request GNOME/gtk!5420
2023-01-13 20:14:25 +00:00
Arjan Molenaar
420be8fb0f macos: run glib idle functions when in nested run loop
It looks like DnD starts a nested run loop. We still have to run our
GLib handlers, so animations work.
2023-01-13 20:03:55 +01:00
Christian Hergert
9c3629653f macos: abstract pasteboard for use in clipboard and drag
This will allow us to share a single NSPasteboardItem and data provider
implementation for both GdkClipboard and GdkDrag.
2023-01-13 20:03:55 +01:00
Christian Hergert
eb5cf831b1 macos: refactor pasteboard components into separate module
This will make it easier to reuse from drag integration so that we don't
require clipboards for everything.

We will need to subclass the pasteboard provider twice, however, both
for clipboard and dragging.
2023-01-13 20:03:55 +01:00
Matteo Percivaldi
374d97008b gtkcssanimatedstyle: Fix return of new_advance()
This was causing animation and transition to stop randomly and reset
their state to initial state.

This issue has existed since commit
7b68bdb831.

Closes #4426
2023-01-13 18:08:56 +01:00
Matthias Clasen
fecc923c2c Silence compiler warnings
Clang complains that these are dead stores.
They are, indeed.
2023-01-13 12:07:40 -05:00
Matthias Clasen
703ed608c0 Fix a compiler warning
Clang things that load_error might be NULL here.
It may be right.
2023-01-13 12:07:40 -05:00
Matthias Clasen
99f07c7c0a Fix a compiler warning
Clang things that timings can be NULL here,
and I think it might be right.
2023-01-13 12:07:40 -05:00
Matthias Clasen
51b4d70b8f gridview: Add a few assertions
Just to help static analysis out.

self->n_columns can't ever be 0, since
we clamp it between min_columns and
max_columns, with min_columns always
being at least one.
2023-01-13 12:07:40 -05:00
Matthias Clasen
746d12fc43 Silence a compiler warning
Clang was complaining that we never use the
value stored in mime_type. Just don't store it,
we are only interested in the side-effect
(interning the string).
2023-01-13 12:07:40 -05:00
Matthias Clasen
96ce9e10b8 Merge branch 'faster-ci' into 'main'
Add a build-testsuite option

See merge request GNOME/gtk!5419
2023-01-13 12:57:15 +00:00
Matthias Clasen
3090795351 ci: Try to speed up builds a bit
Don't build demos and tests, and only build
the testsuite where we want to run it.
2023-01-13 07:26:41 -05:00
Matthias Clasen
815b54f3df Update the build documentation 2023-01-13 07:15:15 -05:00
Matthias Clasen
9ad27e4371 Add a build-testsuite option
This will let us run the testsuite in ci without
having to build all the manual tests.
2023-01-13 07:14:33 -05:00
Matthias Clasen
a6e1804474 Merge branch 'macos-werror' into 'main'
CI: turn on -Werror for MacOS build

See merge request GNOME/gtk!5418
2023-01-13 03:08:36 +00:00
Benjamin Otte
7ae549e253 CI: turn on -Werror for MacOS build
The build is error-free and we want to keep it that way.

We'd also like to make Timm do real work instead of having to fix clang
warnings all the time and this build is a clang build.
2023-01-12 20:12:37 -05:00
Matthias Clasen
434d8ef0ea Merge branch 'wip/chergert/fix-macos-warnings' into 'main'
Fixes a few compilation warnings on macOS

See merge request GNOME/gtk!5415
2023-01-13 00:10:48 +00:00
Matthias Clasen
31a6d73635 Merge branch 'ebassi/pin-gi' into 'main'
Add gobject-introspection as a subproject

See merge request GNOME/gtk!5414
2023-01-12 23:35:23 +00:00
Christian Hergert
958ecf2855 gdk/macos: fix warning about _coreCursorType 2023-01-12 13:22:47 -08:00
Christian Hergert
fb12ad807a gsk/gl: fix warning when join_sources() is unused 2023-01-12 13:22:25 -08:00
Christian Hergert
965c52d369 gdk: fix warning when !HAVE_EGL 2023-01-12 13:22:02 -08:00
Emmanuele Bassi
474872563f Add gobject-introspection as a subproject
We pin GLib, so we must also pin g-i to the same version, otherwise
we'll get weird mismatches during development.
2023-01-12 17:56:37 +00:00
Matthias Clasen
b92e52bf0e Merge branch 'matthiasc/for-main' into 'main'
css: Avoid some allocations

See merge request GNOME/gtk!5413
2023-01-12 15:20:49 +00:00
Matthias Clasen
d226dc3812 iconcache: Be a bit less wasteful 2023-01-12 00:36:18 -05:00
Matthias Clasen
46e0fde606 css: Avoid more allocations for tokens
Make short string tokens static.
2023-01-12 00:12:09 -05:00
Matthias Clasen
1e7f525e0e css: Avoid some allocations
Avoid duplicating the function name just
for an error message.
2023-01-12 00:12:09 -05:00
Matthias Clasen
d43e0fb9a7 css: Avoid allocation for tokens
All valid dimensions are short, so store
the dimension inside the token.
2023-01-12 00:11:46 -05:00
Matthias Clasen
6fb6f47fc8 css: Avoid some allocations
Reuse the name_buffer for reading strings.
2023-01-12 00:11:11 -05:00
Matthias Clasen
0f7d8e04d8 css: Some inlining 2023-01-12 00:11:10 -05:00
Matthias Clasen
c9fca559dc Cosmetics 2023-01-12 00:11:10 -05:00
Matthias Clasen
b9d1b5d6a3 icontheme: Bit a bit less wasteful 2023-01-12 00:11:10 -05:00
Emin Tufan Çetin
5f75ba46a5 Update Turkish translation 2023-01-11 07:01:44 +00:00
Emin Tufan Çetin
2507301983 Update Turkish translation 2023-01-11 05:41:40 +00:00
Matthias Clasen
41aeff331d texthistory: Avoid g_autofree
msvc does not like it, unfortunately.
2023-01-10 22:20:57 -05:00
Matthias Clasen
3aab48ec16 Merge branch 'wip/chergert/fix-5506' into 'main'
istring: fix istring_prepend() on malloc transition

Closes #5506

See merge request GNOME/gtk!5411
2023-01-11 02:39:32 +00:00
Christian Hergert
ad0348b85e texthistory: add debugging helpers to print undo stack
This is helpful to have when tracking down issues like #5506.
2023-01-10 13:36:16 -08:00
Christian Hergert
6a134551b9 istring: fix istring_prepend() on malloc transition
When transitioning from internal to malloc, the strings were placed in
the wrong order to g_strconcat(). This fixes an issue with undo where
if you hit the boundary in just the right way, your undo stack will do
unexpected things.

Fixes #5506
2023-01-10 13:32:38 -08:00
Matthias Clasen
0e1ae6ad11 Merge branch 'matthiasc/for-main' into 'main'
Add some more text undo tests

See merge request GNOME/gtk!5410
2023-01-10 19:05:13 +00:00
Aleksandr Melman
5baf4b4b2e Update Russian translation 2023-01-10 12:57:03 +00:00
Matthias Clasen
63560061e8 Add some more text undo tests
Unsuccessfully trying to reproduce #5506.
2023-01-10 07:34:55 -05:00
Matthias Clasen
be721f5797 Merge branch 'matthiasc/for-main' into 'main'
Deprecate gdk_display_put_event

See merge request GNOME/gtk!5409
2023-01-09 21:15:08 +00:00
Matthias Clasen
0073bb79a7 Deprecate gdk_display_put_event
The documentation already tells you not to
use this function.

Ifdef the remaining users in the X11 backend.
2023-01-09 15:46:25 -05:00
Matthias Clasen
f59b506674 Merge branch 'macos-stable-dnd' into 'main'
macos: Drag and drop should not freeze applications

See merge request GNOME/gtk!5291
2023-01-09 11:52:50 +00:00
Matthias Clasen
88b4404296 Merge branch 'wip/corey/popover-accel' into 'main'
gtkmodelbutton: Ensure that accel label is always aligned to end

Closes #5504

See merge request GNOME/gtk!5407
2023-01-09 10:58:14 +00:00
Corey Berla
e20bc7723a gtkmodelbutton: Ensure that accel label is always aligned to end
When the model button just has a text label and accel text,
the button fills and the accel label is implicitly aigned to end.
When there's also a icon, even though it's not shown (because
icons are only shown if there's no text), the button doesn't fill
and the accel ends up not aligned (assuming one of the other buttons
is longer). Ensure that the accel label is aligned to the end.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5504
2023-01-08 22:32:22 -08:00
Emmanuele Bassi
7edf8841fb Merge branch 'a11y_check_null_path' into 'main'
a11y: Avoid crashing if GtkAtSpiContext::path is NULL

See merge request GNOME/gtk!5405
2023-01-09 00:14:21 +00:00
Emmanuele Bassi
6b5b7eab04 Merge branch 'doc-improvements' into 'main'
Two docs improvements

See merge request GNOME/gtk!5406
2023-01-08 22:16:49 +00:00
Marco Melorio
c775262e9d docs: Improve gtk_window_present description
Move most of the documentation from gtk_window_present_with_time and
also reword it a bit to make it more understandable.
2023-01-08 22:41:19 +01:00
Marco Melorio
553fde9761 docs: Don't mention deprecated API in gtk_widget_set_visible
That statement is true, but since that API is deprecated, it doesn't
need to be there anymore to avoid confusing people.
2023-01-08 21:49:28 +01:00
Barnabás Pőcze
f2593dec4b a11y: Use fallback logic when GApplication has no DBus object path
Use the fallback logic to generate the base path for the GtkAtSpiRoot
if the GApplication has no DBus object path to guarantee that
the base path will not stay NULL.
2023-01-08 19:58:54 +01:00
Barnabás Pőcze
ab5a6ed0f1 a11y: Check if path is NULL when removing from cache
`gtk_at_spi_cache_add_context()` checks if the GtkAtSpiContext's path
is NULL before inserting the context object into the hash table.
Do the same in `gtk_at_spi_cache_remove_context()` to avoid a NULL
pointer dereference in `g_str_hash()` during the hash table lookup
if a context with NULL path is removed. That can happen when the
GtkAtSpiRoot::base_path is NULL, which, in turn, can happen if
`g_application_get_dbus_object_path()` returns NULL.

  ==394047==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fd1966f8b84 bp 0x7fff11e3ded0 sp 0x7fff11e3de58 T0)
  ==394047==The signal is caused by a READ memory access.
  ==394047==Hint: address points to the zero page.
      #0 0x7fd1966f8b84 in g_str_hash (/usr/lib/libglib-2.0.so.0+0x37b84)
      #1 0x7fd1966f9c09 in g_hash_table_contains (/usr/lib/libglib-2.0.so.0+0x38c09)
      #2 0x7fd196062c10 in gtk_at_spi_cache_remove_context ../gtk/a11y/gtkatspicache.c:447
      #3 0x7fd19606e0a9 in gtk_at_spi_root_unregister ../gtk/a11y/gtkatspiroot.c:653
      #4 0x7fd196067f58 in gtk_at_spi_context_unrealize ../gtk/a11y/gtkatspicontext.c:1559
      #5 0x7fd195ced97f in gtk_at_context_unrealize ../gtk/gtkatcontext.c:668
      #6 0x7fd195f5576e in gtk_widget_unroot_at_context ../gtk/gtkwidget.c:2399
      #7 0x7fd195f55bd2 in gtk_widget_unroot ../gtk/gtkwidget.c:2499
      ...
2023-01-08 19:56:49 +01:00
Matthias Clasen
dd3cdc52f5 Fix code style 2023-01-08 14:41:11 +00:00
Matthias Clasen
5a3156a8b7 gdk: Update docs
Update the docs for gdk_display_get_monitor_at_surface.
2023-01-07 21:35:29 -05:00
Matthias Clasen
a4c2f19155 Merge branch 'gdk-display-get-monitor-is-nullable' into 'main'
gdkdisplay: Document get_monitor_at_surface can return NULL

Closes #5075

See merge request GNOME/gtk!4917
2023-01-07 20:39:04 +00:00
Matthias Clasen
be8fb1e9b8 Merge branch 'more-filesystemmodel-cleanups' into 'main'
filesystemmodel: Crop tree model cruft

See merge request GNOME/gtk!5402
2023-01-07 18:42:14 +00:00
Matthias Clasen
52c97dbf67 Merge branch 'win-file-ext' into 'main'
filechoosernativewin32: Set default extension

See merge request GNOME/gtk!5266
2023-01-07 18:14:37 +00:00
robxnano
57ebf26f15 filechoosernativewin32: Set default extension 2023-01-07 18:14:36 +00:00
Matthias Clasen
32247bc50e filesystemmodel: Drop tree model cruft
We no longer need the placeholder item for the
editable, so drop it.
2023-01-07 12:22:25 -05:00
Matthias Clasen
ad940bc892 filesystemmodel: Rename private header 2023-01-07 12:01:15 -05:00
Matthias Clasen
7d34e7e0f7 Merge branch 'filesystemmodel-cleanups' into 'main'
filesystemmodel: Cleanup unused defines

See merge request GNOME/gtk!5401
2023-01-07 14:36:20 +00:00
Georges Basile Stavracas Neto
b2f43076bd gtkfilesystemmodel: Use g_clear_* helpers
Saves some code.
2023-01-07 09:17:37 -05:00
Georges Basile Stavracas Neto
202e889577 filesystemmodel: Use G_DECLARE_FINAL_TYPE()
Clean up boilerplate. It's a private object anyway.
2023-01-07 09:17:37 -05:00
Georges Basile Stavracas Neto
a8690c84ab filesystemmodel: Cosmetics
Adjust code style, and shuffle some functions around. Remove
unhelpful doc comments.
2023-01-07 09:17:15 -05:00
Matthias Clasen
35244f4b59 filesystemmodel: Use g_set_object 2023-01-07 09:12:44 -05:00
Georges Basile Stavracas Neto
503c3ec04d filesystemmodel: Make function private to gtkfilesystemmodel.c
The _gtk_file_system_model_update_file() function is not used outside
GtkFileSystemModel, so no need to expose it in the header.

Shuffle it around in code, and remove it from the header.
2023-01-07 08:44:40 -05:00
Georges Basile Stavracas Neto
4a5a466975 filesystemmodel: Cleanup unused defines
They were made unused with the removal of GtkTreeModel interface
implementation.
2023-01-07 08:44:34 -05:00
Matthias Clasen
e694511da3 Merge branch 'werror-fixes' into 'main'
gtk-launch: Remove compile-time warning

See merge request GNOME/gtk!5400
2023-01-07 13:22:20 +00:00
Matthias Clasen
0a94827b9c Merge branch 'wip/corey/calendar' into 'main'
calendar: Fix marked days

See merge request GNOME/gtk!5399
2023-01-07 13:11:01 +00:00
Corey Berla
735cf301a4 calendar: Set marked days immediately
The marked days are set only as part of gtk_calendar_select_day().
This is insufficient, especially because the day-selected signal
is emitted after the marked days are set in gtk_calendar_select_day().
2023-01-06 20:37:54 -08:00
Corey Berla
e8a29f90d1 calendar: Only apply the marked_day to the current month
The marked day gets applied to the current month, and either the previous
or subsequent month if they are visible within the current month.
This doesn't make any sense and likely was an accidental regression
in a6f9052cf1.  Clarify the docs.
2023-01-06 20:21:35 -08:00
Corey Berla
182cc74834 calendar: Add css style for marked days
As part of a6f9052cf1, marked days lost
their style, essentially making that function worthless.  Previously,
they were simply bolded, but that doesn't give them proper justice.
2023-01-06 20:21:35 -08:00
Matthias Clasen
7801dd8944 Merge branch 'wip/phako/fix-activate-action-annotation' into 'main'
widget: Mark format as nullable in activate_action

See merge request GNOME/gtk!4653
2023-01-07 01:06:00 +00:00
Matthias Clasen
38e090f5c1 Merge branch 'main' into 'main'
Fix a typo

See merge request GNOME/gtk!5170
2023-01-07 00:59:32 +00:00
Benjamin Otte
998c382037 build: Turn off tautological-constant-out-of-range-compare warning
This issues a warning when an enum value is compared to a value that is
out of range for the enum.

We do this a lot, either when using -1 for undefined values or when
comparing array sizes to enum values like so:

  enum {
    ONE,
    TWO,
    THREE
  } some_enum_value;
  const char *names= { "one", "two", "three" };

  g_assert (some_enum_value < G_N_ELEMENTS (names));
2023-01-06 19:46:58 -05:00
Benjamin Otte
ac81e71f78 gtk-launch: Fix unused variable warning on macOS 2023-01-06 19:46:58 -05:00
Benjamin Otte
de271c9a30 ci: Disable -Werror on all subprojects
Would be nice if meson had a nicer way of doing this, but...
2023-01-06 19:46:58 -05:00
Benjamin Otte
bf3cf8bb29 glcontext: Avoid gcc warning on non-egl build 2023-01-06 19:46:58 -05:00
Benjamin Otte
63fa5b7f52 gtk-launch: Remove compile-time warning
This warning causes a -Werror build to fail.
2023-01-06 19:46:58 -05:00
Matthias Clasen
96add330f5 Merge branch 'wayland-surface-split3' into 'main'
Split gdksurface-wayland.c

See merge request GNOME/gtk!5217
2023-01-06 22:35:34 +00:00
Matthias Clasen
44aa6a891a Drop gdkpopup-wayland-private.h
It is empty now.
2023-01-06 17:02:03 -05:00
Matthias Clasen
7a30a21405 waylandsurface: Introduce a few vfuncs 2023-01-06 17:00:45 -05:00
Matthias Clasen
2b3eadcfa4 waylandpopup: Drop unused exports 2023-01-06 16:50:20 -05:00
Matthias Clasen
352443d5a5 waylandtoplevel: Drop unused exports 2023-01-06 16:50:20 -05:00
Matthias Clasen
3574fde770 More cleanups 2023-01-06 16:50:20 -05:00
Matthias Clasen
793689789c Misc cleanups
Detangle compute_size, among other things.
2023-01-06 16:50:19 -05:00
Matthias Clasen
120396fa40 wip: Split off GdkWaylandPopup
Like the GdkWaylandToplevel split-off, this needs some
more cleanup.
2023-01-06 16:50:19 -05:00
Matthias Clasen
d61ec38974 wip: Split off GdkWaylandToplevel
This still needs some more cleanup.
2023-01-06 16:50:19 -05:00
Matthias Clasen
2a463baed0 wayland: Rearrange the surface code 2023-01-06 16:50:19 -05:00
Matthias Clasen
348acde6bd wayland: Split public headers
Split gdkwaylandsurface.h into itself,
gdkwaylandtoplevel.h and gdkwaylandpopup.h.
This is in preparation for splitting the
types for real.
2023-01-06 13:47:34 -05:00
Matthias Clasen
5ba793842b wayland: Split display_server sub-structs
Move these to GdkWaylandToplevel and GdkWaylandPopup
as appropriate.
2023-01-06 13:47:34 -05:00
Matthias Clasen
149b608bfc wayland: Move next_layout into popup and toplevel
This is where it belongs.
2023-01-06 13:47:34 -05:00
Matthias Clasen
3348ea81f2 wayland: Move pending toplevel state to GdkWaylandToplevel
Another toplevel-only thing.
2023-01-06 13:47:34 -05:00
Matthias Clasen
63e69131bd wayland: Move input_grab_seat to GdkWaylandPopup
This is popup-only functionality.
2023-01-06 13:47:34 -05:00
Matthias Clasen
d42a34b0b3 wayland: Move reposition_token to GdkWaylandPopup
This is only used for popups, so move it there.
2023-01-06 13:47:34 -05:00
Matthias Clasen
5ee10fc669 wayland: Move shortcuts_inhibitors to GdkWaylandToplevel
Another toplevel-only feature.
2023-01-06 13:47:22 -05:00
Matthias Clasen
b0a4917ce4 wayland: Move imported_transient_for to GdkWaylandToplevel
Another toplevel-only thing.
2023-01-06 13:47:22 -05:00
Matthias Clasen
47e22d6301 wayland: Move geometry hints to GdkWaylandToplevel
Another toplevel-only thing.
2023-01-06 13:47:12 -05:00
Matthias Clasen
b970b60503 wayland: Move title to GdkWaylandToplevel
This is a toplevel property.
2023-01-06 13:47:06 -05:00
Matthias Clasen
7406f8165d wayland: Move drag surfaces to their own file 2023-01-06 13:46:58 -05:00
Matthias Clasen
9435e689c3 wayland: Drop create_dnd_surface
It is only used in one place.
2023-01-06 13:46:58 -05:00
Matthias Clasen
66c947b86b Merge branch 'swap-3-4' into 'main'
docs: Place example-{3,4} in numerical order

See merge request GNOME/gtk!5319
2023-01-06 18:06:55 +00:00
Matthias Clasen
ad1af87834 Merge branch 'gtk4-fix-xdg-activation-set-surface' into 'main'
gdk/wayland: set requesting surface to xdg-activation

See merge request GNOME/gtk!5293
2023-01-06 14:03:01 +00:00
Matthias Clasen
68700f8722 Merge branch 'drop-file-dialog-shortcuts' into 'main'
filedialog: Drop shortcut folders

See merge request GNOME/gtk!5396
2023-01-06 13:35:14 +00:00
Matthias Clasen
f76270167c Merge branch 'wip/otte/for-5496' into 'main'
filedialog: Never set the chooser's file

Closes #5496

See merge request GNOME/gtk!5393
2023-01-06 13:34:55 +00:00
Matthias Clasen
2a442c4fbb Merge branch 'macos-command-symbol' into 'main'
macos: Use Command key symbol in Keyboard shortcuts window

See merge request GNOME/gtk!5296
2023-01-06 13:17:36 +00:00
Matthias Clasen
9356dfc404 filedialog: Drop shortcut folders
The filechooser portal does not support this,
and we are defaulting to using the portal now.
Lets not offer a non-functional API.
2023-01-06 07:40:57 -05:00
Matthias Clasen
7eb8439047 Merge branch 'matthiasc/for-main' into 'main'
testfiledialog: Be more lenient

See merge request GNOME/gtk!5395
2023-01-06 12:34:10 +00:00
Matthias Clasen
0ccf9ad8fc testfiledialog: Be more lenient
Accept both open_multiple and open-multiple.
2023-01-06 07:12:36 -05:00
Arjan Molenaar
c52978dfa4 macos: Command should not come from gettext
Instead, just provide the right character.

See also
https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkaccelgroup.c#L916.
2023-01-06 12:08:55 +01:00
Matthias Clasen
52dfa54301 Merge branch 'test-file-dialog' into 'main'
Test file dialog

See merge request GNOME/gtk!5394
2023-01-06 04:28:28 +00:00
Matthias Clasen
b6f9e00a9e Add a test for GtkFileDialog 2023-01-05 23:13:58 -05:00
Matthias Clasen
8780aa02d7 filedialog: Cosmetics 2023-01-05 23:06:31 -05:00
Benjamin Otte
8d5a39d765 Merge branch 'wip/corey/dnd-use-cursor' into 'main'
Fix accidental DnD

See merge request GNOME/gtk!5275
2023-01-05 22:39:26 +00:00
Benjamin Otte
446e6a8d62 filedialog: Never set the chooser's file
Instead, get by with setting the name and hope the filechooser figures
things out by itself.

Fixes #5496
2023-01-05 21:30:15 +01:00
Matthias Clasen
9b1bee99b8 Merge branch 'openuri-activation-token' into 'main'
Pass an activation token to OpenURI

See merge request GNOME/gtk!5389
2023-01-05 14:06:14 +00:00
Matthias Clasen
77cf0f1719 Merge branch 'filechooser-multi-folder' into 'main'
filechooser: Don't assert for possible cases

Closes #5494

See merge request GNOME/gtk!5392
2023-01-05 14:01:35 +00:00
Matthias Clasen
fc1f1366b4 filechooser: Don't assert for possible cases
switch_to_selected_folder can be called when the
selection contains more than one item. Handle it
like it used to be handled: switch to the first
folder we find.

Fixes: #5494
2023-01-05 08:41:33 -05:00
Matthias Clasen
6efd1a9dad Pass an activation token to OpenURI
The OpenURI portal can take an activation_token
nowadays. So it give one.
2023-01-04 16:39:24 -05:00
Matthias Clasen
8349ae2bc4 x11: Make a call NULL-safe
Make it safe to call gdk_x11_app_launch_context_get_startup_notify_id
with a NULL info.
2023-01-04 16:37:31 -05:00
Matthias Clasen
7c5c843b5b Merge branch 'matthiasc/for-main' into 'main'
Drop gtkmain.c from POTFILES

See merge request GNOME/gtk!5390
2023-01-04 17:22:54 +00:00
Matthias Clasen
bc11bc4f8d Drop gtkmain.c from POTFILES
No longer any translations here.
2023-01-04 12:03:01 -05:00
Matthias Clasen
be24e4a1f7 Merge branch 'deprecate-toggled' into 'main'
Deprecate gtk_toggle_button_toggled

See merge request GNOME/gtk!5388
2023-01-04 12:57:32 +00:00
Matthias Clasen
918ff1d0f4 Deprecate gtk_toggle_button_toggled
The function is documented as useless.
2023-01-04 07:32:51 -05:00
Anders Jonsson
20723613bc Update Swedish translation 2023-01-04 12:32:38 +00:00
Matthias Clasen
604aafe15d Merge branch 'wip/carlosg/startup-vs-focus' into 'main'
Consider startup vs focus requests for the Wayland platform

See merge request GNOME/gtk!5386
2023-01-03 15:14:35 +00:00
Carlos Garnacho
4041ca0f69 gdkdisplay: Deprecate gdk_display_notify_startup_complete()
We have various layers where we store the startup ID for a request,
since this API does not have a GdkToplevel that we can refer about
for the Wayland platform, this is the most obvious candidate to
start untangling these various layers.

Deprecate this call, it is already unused in the gtk/ side.
2023-01-03 14:58:33 +01:00
Carlos Garnacho
3526d8b299 gtkapplication: Do not call gdk_display_notify_startup_complete()
This should do nothing worthwhile anymore, the X11/Wayland GtkApplication
implementations do already pass the startup ID from the platform_data
via windowing specific APIs, and the application handling the request
via show()/present() should trigger the activation request.
2023-01-03 14:58:33 +01:00
Carlos Garnacho
e8adfa2a88 gtkwindow: Shuffle gdk_toplevel_set_startup_id() calls
While this used to be tangential to windows showing or requesting
focus, the xdg-activation Wayland protocol does merge both concepts
together.

But also, for a correct interaction with the compositor, the
toolkit should ideally merge the activation request resulting from
both into the same one, so that the gdk_toplevel_focus() request
replies to the startup token that started the application and
correct focus-stealing prevention/etc happens, instead making up
one just in time for the focus request.

This kind of requires doing things in the right order, a show()
request on the GtkWindow should activate any pending activation
token on the toplevel, a present() request should additionally
create a new token if there was none pending. And
xdg_activation_v1_activate() should happen once on both.

Shuffle the gdk_toplevel_set_startup_id() calls so that this
happens in the right order for Wayland, while making X11 happy
too.
2023-01-03 14:58:33 +01:00
Carlos Garnacho
7fab1b85ad gdk/x11: Emit "remove" s-n message from gdk_toplevel_set_startup_id
In the way towards deprecating gdk_display_notify_startup_complete(),
make gdk_toplevel_set_startup_id() on X11 perform this piece of messaging
itself. It should be harmless that the message is emitted twice, if
callers do still use that API.
2023-01-03 14:58:25 +01:00
Carlos Garnacho
5aeabdb3d4 gdk/wayland: Perform xdg_activation on gdk_toplevel_set_startup_id
This call has everything to perform activation as specified by the
xdg_activation protocol, notably a surface to activate as opposed to
gdk_display_notify_startup_complete().

Make activation happen here, so that the surface gets activated when
its gets a startup ID assigned.
2023-01-03 14:57:49 +01:00
Carlos Garnacho
6f01f846dc gtkwindow: Minor refactor
Move the handling of the startup ID to a separate function, since
this will be called from several places.
2023-01-03 14:57:44 +01:00
Matthias Clasen
3c4f6144a0 Merge branch 'fix-introspection' into 'main'
meson.build: build introspection according to option only

See merge request GNOME/gtk!5382
2023-01-03 11:56:49 +00:00
Alexander Kanavin
ae71d338d7 meson.build: build introspection according to option only
The way the check is written, if the build is native, then the
introspection option has no effect.

Particularly yocto project does want to disable introspection in
native builds and enable it in cross builds (both via the option),
and without this patch the former is not possible.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
2023-01-03 08:26:07 +01:00
Matthias Clasen
8b469a2727 Merge branch 'nullable-gdk' into 'main'
gdk_display_open: Mark arg as nullable

See merge request GNOME/gtk!5380
2023-01-03 00:25:55 +00:00
Matthias Clasen
53813f24f0 Merge branch 'matthiasc/for-main' into 'main'
ci: Enable introspection for the docs build

See merge request GNOME/gtk!5383
2023-01-02 21:53:58 +00:00
Matthias Clasen
1fde83f12b Merge branch 'direction-from-language' into 'main'
Determine direction from language

See merge request GNOME/gtk!5385
2023-01-02 21:50:54 +00:00
Matthias Clasen
1f7783224b Determine direction from language
We can determine the direction to return here
without relying on translations, by using pango
and HarfBuzz apis to go
language -> script -> direction.
2023-01-02 16:30:27 -05:00
Matthias Clasen
0d04ceda76 Merge branch 'ccook/doc-changes-2' into 'main'
Various documentation suggests across a few domains.

See merge request GNOME/gtk!5384
2023-01-02 20:40:54 +00:00
Cam Cook
9396ccf9ff Various documentation suggests across a few domains.
| domain | current | suggestion |
|--------|---------|------------|
| [GtkSeparator](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkseparator.c#L39)    | "`![An example GtkSeparator](separators.png)`" | "`![An example GtkSeparator](separator.png)`" [1] |
| [GtkTextBuffer](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextbuffer.c#L4885)  | "if there is an redoable action" | "if there is a redoable action" |
| [GtkTextBuffer/get_enable_undo](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextbuffer.c#L5005) | (Renders `No description available.`) | "Returns: %TRUE if undoing and redoing changes to the buffer is allowed." [3] |
| [GtkTextBuffer/get_max_undo_levels](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextbuffer.c#L5102) | (Renders `No description available.`)| "Returns: The max number of undo levels allowed (0 indicates unlimited)." |
| [GtkTextBuffer](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextbuffer.c#L3874) | "with gtk_text_buffer_add_selection_clipboard()." | "with [method@Gtk.TextBuffer.add_selection_clipboard]" |
| [GtkTextBuffer](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextbuffer.c#L3494) | "it will automatically toggled" | "it will automatically toggle" |

* [1] See : [separator.png](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/docs/reference/gtk/images/separator.png), [gtk4.toml.in](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/docs/reference/gtk/gtk4.toml.in#L218), [visual_index.md](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/docs/reference/gtk/visual_index.md?plain=1#L16)
* [2] Taken from `enable-undo` [property description](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextbuffer.c#L516)

* [GtkTextMark/gtk_text_mark_set_visible](https://docs.gtk.org/gtk4/method.TextMark.set_visible.html) is defined in [GtkTextMark's header](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextmark.h#L93), but implemented in [GtkTextBTree](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtktextbtree.c#L3036).
  * Other than being kind of confusing, this causes `gtk_text_mark_set_visible()`'s doc to not render where it expects it to.
2023-01-02 13:47:55 -05:00
Matthias Clasen
5a68639788 ci: Enable introspection for the docs build
It is required, so lets not rely on defaults.
2023-01-02 11:27:22 -05:00
Matthias Clasen
85df554ec1 Fix compiler warnings 2023-01-02 11:18:54 -05:00
Matthias Clasen
8776ebfe90 Merge branch 'dependency-review' into 'main'
Dependency review

See merge request GNOME/gtk!5381
2023-01-02 16:14:24 +00:00
Matthias Clasen
83eee03b0f build: Use the current gdk-pixbuf as subproject
This commit has fixes for subproject use that we need,
and is not in a release yet.
2023-01-02 10:57:52 -05:00
Matthias Clasen
d7bba4ebac build: Use libcloudproviders 0.3.1 as subproject 2023-01-02 10:57:52 -05:00
Matthias Clasen
40e2b5b153 build Use current libepoxy as subproject
We need recent fixes for graphene subproject use,
so use the current HEAD of master until there is
a release with these fixes.
2023-01-02 10:57:52 -05:00
Matthias Clasen
f7a7313758 build: Use the current graphene as subproject
We need recent fixes for graphene subproject use,
so use the current HEAD of master until there is
a release with these fixes.
2023-01-02 10:57:52 -05:00
Matthias Clasen
2d9ce0357f build: Use wayland 1.21.0 as subproject 2023-01-02 10:57:52 -05:00
Matthias Clasen
0ea05896df build: Use wayland-protocols 1.25 as subproject 2023-01-02 10:57:52 -05:00
Matthias Clasen
8c638df147 build: Use pango 1.50.12 as subproject 2023-01-02 10:57:52 -05:00
Matthias Clasen
6605ded4c9 build: Use fribidi 1.0.12 as subproject 2023-01-02 10:57:52 -05:00
Matthias Clasen
ba1a9530c8 build: Use cairo 1.17.6 as subproject
We don't want to use cairo 1.16, since it is
too old, so use 1.17.6 for now until there
is a stable 1.18 release.
2023-01-02 10:57:52 -05:00
Matthias Clasen
a9fcea369e build: Use glib 2.74.4 as subproject
This is the latest stable release.
2023-01-02 10:57:44 -05:00
Matthias Clasen
ca2787fbba build: Pass gobject_types=true to graphene
This is required for graphene-gobject to be built.
2023-01-02 09:15:59 -05:00
Matthias Clasen
6d2c897dfc build: Bump introspection dep to 1.72
This should be kept in sync with glib.
2023-01-02 09:15:56 -05:00
Matthias Clasen
01f81b2d77 build: Bump graphene req to 1.10
So we don't require an unstable version.
2023-01-02 09:15:56 -05:00
Sabri Ünal
8a3c5c63e8 Update Turkish translation 2023-01-02 13:58:10 +00:00
Maximiliano Sandoval R
b688f47776 gdk_display_open: Mark arg as nullable 2023-01-02 11:49:06 +01:00
Matthias Clasen
e126110ae0 Merge branch 'wide-inspector' into 'main'
inspector: Avoid super-wide window

See merge request GNOME/gtk!5379
2022-12-31 20:07:45 +00:00
Matthias Clasen
f98406b080 Merge branch 'annotate-dialog-deprecation' into 'main'
docs: Annotate GtkDialog deprecation

See merge request GNOME/gtk!5376
2022-12-31 20:07:20 +00:00
Matthias Clasen
40a2910262 inspector: Avoid super-wide window
Ellipsize values that can get long, to avoid
forcing an excessively wide window.
2022-12-31 12:30:40 -05:00
Marco Melorio
ec84077486 docs: Annotate GtkDialog deprecations 2022-12-30 15:37:11 +01:00
Benjamin Otte
188f9269b7 Merge branch 'wip/corey/list-item-visible' into 'main'
listitemwidget: Setup factory only once the widget is visible

See merge request GNOME/gtk!5374
2022-12-29 22:21:43 +00:00
Corey Berla
7ad693f865 gtkcolumnviewcolumn: Only create cells when the column is visible
It's a big performance drag to create many cells (and their associated
widgets) for columns that may never be shown. Only create cells
is the column is visible, and subsequently create/remove cells
when in column_set_visible.
2022-12-29 11:11:40 -08:00
Yosef Or Boczko
913e3680f3 Update Hebrew translation 2022-12-27 21:46:52 +00:00
Matthias Clasen
f3ad6015c6 Merge branch 'wip/corey/notify-drop-value' into 'main'
gtkdroptarget: Notify value property on local drag

See merge request GNOME/gtk!5372
2022-12-27 16:45:16 +00:00
Corey Berla
4e694c1824 gtkdroptarget: Notify value property on local drag
The value property is only getting notified when it's unset
or when it's set from gdk_drop_real_value_async().  Make sure
to always notify :value when its changed
2022-12-27 08:11:53 -08:00
Matthias Clasen
0214cb5b1b Post-release version bump 2022-12-26 07:22:39 -05:00
Matthias Clasen
12bd668f4d 4.9.2 2022-12-26 06:41:21 -05:00
Matthias Clasen
f7fb069e2f Updates 2022-12-25 09:25:45 -05:00
Matthias Clasen
7213bf5b09 Merge branch 'wip/otte/for-main' into 'main'
GtkDialog: Various API changes

See merge request GNOME/gtk!5251
2022-12-24 15:14:17 +00:00
Matthias Clasen
5eb4a3af0d filedialog: Handle initial-folder being NULL
This showed up as test failure in ci.
2022-12-24 09:01:16 -05:00
Benjamin Otte
c4c747d2ad alertdialog: Rephrase docs for show() a bit
In particular, discuss what to do about cancellables.

Related: !5326
2022-12-24 07:56:57 -05:00
Benjamin Otte
671fad5f34 filedialog: Clarify interaction of :filters and :default-filter 2022-12-24 07:56:57 -05:00
Benjamin Otte
1b9c45b660 filedialog: Rename :current-filter to :default-filter
The last "current" removed from properties. None of these are current.
2022-12-24 07:56:57 -05:00
Benjamin Otte
e2f730c0bf filedialog: Add gtk_file_dialog_set_initial_file()
A shortcut for setting initial-folder and initial-name at the same time.

We can remove all arguments from the actual async calls this way.
2022-12-24 07:56:57 -05:00
Benjamin Otte
8a2d35b9fb filedialog: Add gtk_file_dialog_set_initial_name() 2022-12-24 07:56:57 -05:00
Benjamin Otte
26cec4a021 filedialog: Rename current-folder to initial-folder
It's not the current one - unlike in GtkFileChooser - because there are
no live updates. So we use a more descriptive name.
2022-12-24 07:56:57 -05:00
Benjamin Otte
8d8e83afa2 fontdialog: Handle Escape better
Closing the dialog by hitting Escape should
have the same effect as clicking the cancel
button. Make it so.
2022-12-24 07:56:57 -05:00
Benjamin Otte
381bb84f3d alertdialog: Bring the GError back
Make sure we have a GError, so that dismissing and cancelling can be
separated.
2022-12-24 07:56:57 -05:00
Benjamin Otte
977fedfdf1 dialog: GTK_DIALOG_ERROR_ABORTED => GTK_DIALOG_ERROR_CANCELLED
This is done via the GCancellable, so let's call it cancelling.
2022-12-24 07:56:57 -05:00
Benjamin Otte
8957302bd4 dialog: GTK_DIALOG_ERROR_CANCELLED => GTK_DIALOG_ERROR_DISMISSED
The term "cancelling" is used with GCancellable, a user clicking a close
button is not that.
User input is usually described as "dismissing", so we use that term.
2022-12-24 07:56:57 -05:00
Benjamin Otte
8a7f739f9f directorylist: Always add standard::name
glib can't figure out how to do that, so we need to do that ourselves.
2022-12-24 07:56:57 -05:00
Matthias Clasen
fce4810fb4 Merge branch 'ccook/doc-changes-1' into 'main'
Various spelling mistakes across a few domains that show up in documentation.

See merge request GNOME/gtk!5370
2022-12-24 12:52:19 +00:00
Matthias Clasen
d5ba76a82c Merge branch 'wip/carlosg/autohide-checks-on-x11' into 'main'
gdk/surface: Handle clicks outside client surfaces

See merge request GNOME/gtk!5369
2022-12-24 12:50:09 +00:00
Cam Cook
1cd44ec7b7 Make stylecheck happy 2022-12-23 11:21:18 -05:00
Cam Cook
424d56830a Merge remote-tracking branch 'upstream/main' into ccook/doc-changes-1 2022-12-23 11:02:18 -05:00
Cam Cook
7fc4d02851 Various spelling mistakes across a few domains that show up in documentation.
| domain | current | suggestion |
|--------|---------|------------|
| [GtkAspectFrame](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkaspectframe.c#L457)    | "requistion of the child" | "requisition of the child" |
| [GtkPaned](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkpaned.c#L2500)               | "(attributes org.gtk.Method.set_propery=wide-handle)" | "(attributes org.gtk.Method.set_property=wide-handle)"|
| [GtkPopover](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkpopover.c#L2484)           | "with gtk_popover_set_offset()." | "with [method@Gtk.Popover.set_offset()]." |
| [GtkPopoverMenu](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkpopovermenu.c#L859)    | "with gtk_popover_menu_add_child()" | "with [method@Gtk.PopoverMenu.add_child()]" |
| [GtkSelectionModel](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkselectionmodel.c#L316) | "the queired range" | "the queried range" |
| [GtkScrolledWindow](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkscrolledwindow.c#L76) | "automatically removed hen" | "automatically removed when"|
| [GtkSearchBar](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtksearchbar.c#L425)         | "Connects the \`GtkEditable widget" | "Connects the `GtkEditable` widget" |
2022-12-23 11:01:07 -05:00
Carlos Garnacho
e7f798dcf5 gdk/surface: Handle clicks outside client surfaces
The owner_events=TRUE grab makes GDK on X11 see events happening
outside every client window as received on the grab window.
Additionally check that the pointer is inside the grab window
(i.e. it received GDK_CROSSING_NORMAL crossing events for the
core pointer) in order to handle clicks happening outside client
windows.

These new paths are expected to be a no-op on Wayland, and to
also work for touchscreen input on X11, due to emulated pointer
events.
2022-12-23 16:12:03 +01:00
Yuri Chornoivan
f6bd63c9ad Update Ukrainian translation 2022-12-23 13:49:23 +00:00
Matthias Clasen
99320f99c3 Merge branch 'wip/ignazp/clipboard_eol' into 'main'
clipboard: improve EOL conversion of plain text

See merge request GNOME/gtk!5367
2022-12-22 13:31:07 +00:00
Ignazio Pillai
8ecb624934 clipboard: improve EOL conversion of plain text
Handle the case of clipboard text with CR line endings
2022-12-22 12:55:30 +01:00
Matthias Clasen
123eebb93d Merge branch 'tweak-gtkfilechooser-button-tooltips' into 'main'
GtkFileChooser: Tweak Grid View & List View button tooltips

See merge request GNOME/gtk!5345
2022-12-21 12:39:53 +00:00
Emmanuele Bassi
b6596d5313 Merge branch 'remove_a11y_name_fallback' into 'main'
Don't present GTK class names to assistive technologies even as a fallback

Closes gnome-control-center#2244

See merge request GNOME/gtk!5365
2022-12-21 11:06:20 +00:00
Lukáš Tyrychtr
ffe333a21f Don't present GTK class names to assistive technologies even as a fallback
A screen reader user is not interested in GTK internals, for example,
he does not care whether a button is an image button or not,
and a screen reader will report the fact that it is a button anyway.
Same applies for GtkEntry widgets, for example.

This actually is sufficient to fix gnome-control-center#2244.
And, according to the discussion in #5145, it should be fine.
2022-12-21 11:35:46 +01:00
Matthias Clasen
257ca10eb1 Merge branch 'file-nullable' into 'main'
filelauncher: Make set_file argument nullable

See merge request GNOME/gtk!5357
2022-12-21 03:23:58 +00:00
Benjamin Otte
ae097d9674 Merge branch 'wip/antoniof/listbase-rubberband-better-fix' into 'main'
listbase: Cancel rubberband if not handling drag

See merge request GNOME/gtk!4831
2022-12-21 01:14:57 +00:00
Luca Bacci
1659c59410 Merge branch 'include-hicolor-index-theme-as-resource-rebased' into 'main'
Include hicolor index.theme as a resource (rebased)

Closes #5303

See merge request GNOME/gtk!5361
2022-12-20 16:08:11 +00:00
Luca Bacci
cf91e09d75 Include hicolor index.theme as a resource
index.theme file copied from upstream xdg/default-icon-theme
repository at tag 0.17:

https://gitlab.freedesktop.org/xdg/default-icon-theme/-/tree/0.17

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5303
2022-12-20 16:30:00 +01:00
Emmanuele Bassi
020636c49f Merge branch 'revert-09691ead' into 'main'
Revert "Merge branch 'include-hicolor-index-theme-as-resource' into 'main'"

See merge request GNOME/gtk!5360
2022-12-20 15:22:28 +00:00
Luca Bacci
59df956f4f Revert "Merge branch 'include-hicolor-index-theme-as-resource' into 'main'"
This reverts merge request !5341
2022-12-20 13:23:51 +00:00
Matthias Clasen
09691ead4c Merge branch 'include-hicolor-index-theme-as-resource' into 'main'
Include hicolor index.theme as a resource

Closes #5303

See merge request GNOME/gtk!5341
2022-12-20 12:24:25 +00:00
Maximiliano Sandoval R
18a7f715c4 filelauncher: Make set_file argument nullable 2022-12-20 11:08:47 +01:00
Aleksandr Melman
d1347bbf33 Update Russian translation 2022-12-20 09:33:25 +00:00
Matthias Clasen
1b816c91d0 Merge branch 'fix-asan-more' into 'main'
ci: Disable f16c for asan

See merge request GNOME/gtk!5356
2022-12-20 06:04:46 +00:00
Matthias Clasen
5df0cbfa69 ci: Disable f16c for asan
It appears that f16c crashes asan instantly.
2022-12-20 00:43:59 -05:00
Matthias Clasen
47b5d0d546 Merge branch 'no-more-installed-tests' into 'main'
build: Drop the install-tests option

See merge request GNOME/gtk!5352
2022-12-20 05:33:56 +00:00
Matthias Clasen
4f65c121b7 ci: More verbose output from asan 2022-12-20 00:32:51 -05:00
Matthias Clasen
a0de7884cd Merge branch 'another-flaky-reftest' into 'main'
ci: Declare a reftest as flaky

See merge request GNOME/gtk!5354
2022-12-20 05:07:51 +00:00
Matthias Clasen
b5b9cb189f Merge branch 'macos-ci-is-iffy' into 'main'
ci: Mark macos build as allow-fail

See merge request GNOME/gtk!5355
2022-12-20 05:02:25 +00:00
Matthias Clasen
ee2152ff5c ci: Mark macos build as allow-fail
It fails too often, and it never does us
any good.
2022-12-19 23:55:13 -05:00
Matthias Clasen
d8d5cace2a ci: Declare a reftest as flaky
fixed-widget-stacking is failing frequently due
to a blinking cursor showing up in one of the
windows in ci.
2022-12-19 23:52:51 -05:00
Matthias Clasen
21e9a508bd Merge branch 'fix-gtk_doc=true' into 'main'
meson: Require gi-docgen when gtk_doc is required

See merge request GNOME/gtk!5351
2022-12-20 04:17:22 +00:00
Matthias Clasen
3121f88265 build: Drop the install-tests option
We no longer use installed tests in CI,
so lets reap the benefit and simplify
our build setup for tests.
2022-12-19 23:12:47 -05:00
Matthias Clasen
b56224fc16 Merge branch 'fix-introspection-test-deps' into 'main'
build: Lift gir and build_gir to toplevel

See merge request GNOME/gtk!5350
2022-12-20 04:04:17 +00:00
Nirbheek Chauhan
4346a33a63 meson: Require gi-docgen when gtk_doc is required
Fixes build with only `-Dgtk_doc=true` without
`-Dintrospection=enabled`:

    Program gi-docgen found: NO
    Configuring gdk4.toml using configuration

    docs/reference/gdk/meson.build:13:2: ERROR: Tried to use not-found external program in "command"

`introspection` is `auto` by default.

The rest of the docs build is only contingent on
`if get_option('gtk_doc')` so we should use the same restriction here.

We check for `build_gir` below already, and the gi-docgen subproject
itself does not need gobject-introspection so it's fine to do it like
this.
2022-12-20 09:27:48 +05:30
Matthias Clasen
596f59f471 tests: Maybe skip introspection tests
If we don't find the python gi module,
skip the introspection test.
2022-12-19 22:38:38 -05:00
Matthias Clasen
d758754f20 build: Lift gir and build_gir to toplevel
build_gir is used in multiple subdirectories,
so it is a bit nasty that it is defined in
one too.
2022-12-19 22:38:38 -05:00
Emmanuele Bassi
e049b6992d Merge branch 'ebassi/ci-image-for-main' into 'main'
Various CI fixes

See merge request GNOME/gtk!5349
2022-12-20 03:37:43 +00:00
Emmanuele Bassi
ca0bae2196 ci: Don't cache subprojects
We're downloading them anyway.
2022-12-20 02:41:52 +00:00
Matthias Clasen
a920c0d2de Merge branch 'wip/gtk4-fix-delete-surrounding' into 'main'
gtkimcontextwayland: Convert byte based offset to char based offset in delete_surrounding_text

See merge request GNOME/gtk!5254
2022-12-20 02:40:14 +00:00
Emmanuele Bassi
0db3666d3c tests: Add shorthand-entry-border to the flaky suite
This test fairly consistently times out when running in a contended CI.
2022-12-20 02:18:25 +00:00
Emmanuele Bassi
2b808bf849 ci: Remove installed-tests job
Installed tests require access to the system prefix, and thus a
system-wide installation of Meson, which we don't have.

We're going to restore this job at a later date.
2022-12-20 01:56:28 +00:00
Emmanuele Bassi
737342ef23 ci: Don't use builddep to install Wayland build dependencies
We don't want to bring undefined dependencies into the image.

Additionally, Wayland depends on Meson, and we don't want to use
Fedora's version of Meson.
2022-12-20 01:54:57 +00:00
Emmanuele Bassi
cf709473f7 ci: Update the Fedora image 2022-12-20 01:54:57 +00:00
Alynx Zhou
ad83d616c4 gtkimcontextwayland: Convert byte based offset to char based offset in delete_surrounding_text
ClutterInputFocus/GtkIMContext uses char based offset for
delete_surrounding, however, text_input_v3 uses byte based offset for
it. Currently only GTK with mutter can work correctly via text_input_v3
because they both forget to convert between char based offset and byte
based offset.

This commit fixes it in GTK by converting byte based offset to char
based offset with the UTF-8 encoded surrounding text.

Fixes <https://gitlab.gnome.org/GNOME/gtk/-/issues/4566>.
2022-12-20 09:51:08 +08:00
Matthias Clasen
98bb14a849 Merge branch 'meson-subproject-usage-fixes' into 'main'
Various fixes for using gtk4 as a meson subproject

See merge request GNOME/gtk!5347
2022-12-20 01:50:47 +00:00
António Fernandes
efbd228940 listbase: Cancel rubberband if not handling drag
If the drag events are claimed by another gesture (e.g. a GtkDragSource
in an item widget), list base still commits a rubberband selection, for
a rubberband which wasn't even visible yet. This is a problem for the
GNOME Files application which needs both rubberbanding and drag-n-drop.

My previous fix[0] was enough for the case where the event sequence is
claimed right before the first GtkDragGesture::drag-update emission,
but it's useless if the event is claimed later (e.g. after the drag
treashold), because a rubberband already exists by that time.

Therefore, the complete solution requres checking whether the event
sequence is no longer being handled by our gesture, and commit the
selection changes only if it is, but otherwise cleanup the rubberband.

This is what GtkFlowBox does already, so let's do the same here.

[0] commit dc4540fae9
2022-12-18 21:31:31 -10:00
Nirbheek Chauhan
64c8da1bdd ci: Always update subprojects to latest revision
Otherwise we're not actually updating anything. `meson subprojects
download` will skip subprojects that already exist.
2022-12-19 09:08:28 +05:30
Nirbheek Chauhan
7242408d60 ci: Fix fedora-mingw64 job 2022-12-19 03:09:11 +05:30
Nirbheek Chauhan
9c6dd9b3b5 ci: Update meson version used for vs2017 job 2022-12-19 03:09:11 +05:30
Nirbheek Chauhan
cd77936265 meson: Fix find_program and subproject usage
Dummy dependencies are not required to execute a subproject
automatically for providing a program, nor do you need to explicitly
call subproject() to do that.

A `[provide]` section in the wrap file is enough.
2022-12-19 03:09:11 +05:30
Nirbheek Chauhan
53c37cfc17 meson: Stop using fallback: kwarg for deps that don't need it
Subprojects that use meson.override_dependency() do not require the
caller to provide the dependency variable name inside the subproject.

We also don't want to provide the *subproject* name, because the
subproject name can be `pango-1.50.12` instead of `pango` when using
wrap-file to download the tarball instead of using wrap-git. This
causes the pango subproject to be executed twice when using gtk as
a subproject inside gstreamer (which uses pango-1.50.12 as
a wrap-file).

All the dependencies we use can be switched in this way, but the
remaining ones need to be changed to use meson.override_dependency()
first.
2022-12-19 03:09:11 +05:30
Nirbheek Chauhan
1a1f92178e meson: Update gitlab.gnome.org SSH server names
Also switch the wrap file style to use spaces around `=` which is the
canonical style used by wrapdb now.
2022-12-18 21:42:03 +05:30
Nirbheek Chauhan
6b111a9fda meson: Remove redundant, duplicate, harfbuzz check 2022-12-18 21:42:03 +05:30
Nirbheek Chauhan
cc6b0c5750 meson: Always look for both cmake and pkgconfig names
The is_msvc_like change is wrong; it used a false correlation between
"compiler being used" and "dependency method" by saying that on
Windows, when building with MSVC, you will only use CMake to find png,
jpeg, tiff.

You can use pkgconfig to find these deps on Windows with MSVC -- when
the deps have been built with Autotools or Meson (with MSVC). You can
also find these deps using CMake on other platforms like macOS or
Linux.

The solution is simple: just search for both names on all platforms,
and just search for the pkgconfig name first.
2022-12-18 21:42:03 +05:30
Matthias Clasen
235f01952c Merge branch 'nirbheek/fix-build-with-latest-glib' into 'main'
gdk: Fix g_set_str version check

See merge request GNOME/gtk!5348
2022-12-18 16:07:11 +00:00
Nirbheek Chauhan
e2291259bb gdk: Fix g_set_str version check
The function was added to glib in 2.75.1. This fixes gtk's build with
the glib main branch.
2022-12-18 11:29:10 +05:30
sunflowerskater
6b71ccdb43 GtkFileChooser: Tweak Grid View & List View button tooltips
The tooltips from the Grid View & List View buttons are unnecessarily long and look different from the tooltips used in Nautilus.

This commit makes the tooltips to be consistent with Nautilus and, consequently, makes them shorter.
2022-12-17 18:21:10 -03:00
Matthias Clasen
c81a793f63 Merge branch 'wip/cdavis/file-dialog-accept-label' into 'main'
gtkfiledialog: Allow devs to set custom accept labels

Closes #5421

See merge request GNOME/gtk!5339
2022-12-16 17:04:00 +00:00
Christopher Davis
143229f829 gtkfiledialog: Allow devs to set custom accept labels
Accept labels can be used for additional context regarding
the purpose of a file. The old GtkFileChooser APIs allowed
developers to set it, but the initial FileDialog API was missing
this functionality.

This commit adds `gtk_file_dialog_set_accept_label ()` to
restore the missing functionality.

Closes https://gitlab.gnome.org/GNOME/gtk/-/issues/5421
2022-12-16 10:16:52 -05:00
Christopher Davis
3e86bc65f5 gdkprivate: Add compatibility shim for g_set_str()
Allows us to make use of this API without depending
on bleeding-edge glib
2022-12-16 10:16:52 -05:00
Luca Bacci
b563736b66 Include hicolor index.theme as a resource
index.theme file copied from upstream xdg/default-icon-theme
repository at tag 0.17:

https://gitlab.freedesktop.org/xdg/default-icon-theme/-/tree/0.17

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5303
2022-12-16 14:58:59 +01:00
Matthias Clasen
2442ed87fe Merge branch 'matthiasc/for-main' into 'main'
Silence a compiler warning

See merge request GNOME/gtk!5340
2022-12-16 12:30:26 +00:00
Matthias Clasen
6cb5f20942 Silence a compiler warning 2022-12-16 00:12:44 -05:00
Matthias Clasen
aafc6279a3 Merge branch 'ebassi/ci-image-for-main' into 'main'
ci: Install Meson in the build jobs

See merge request GNOME/gtk!5335
2022-12-16 03:55:18 +00:00
Matthias Clasen
2154460139 Merge branch 'no-portals' into 'main'
Add GDK_DEBUG=no-portals

Closes #5441

See merge request GNOME/gtk!5336
2022-12-15 16:27:33 +00:00
Matthias Clasen
ef17a44876 Merge branch 'deprecate-show-hide' into 'main'
Deprecate gtk_widget_show/hide

See merge request GNOME/gtk!5278
2022-12-15 14:53:48 +00:00
Matthias Clasen
8eace1c385 Merge branch 'check-button-radio-docs' into 'main'
gtkcheckbutton: Document how to keep track of changes for radio buttons

See merge request GNOME/gtk!5328
2022-12-15 00:25:08 +00:00
Benjamin Otte
1f001a8f6a Merge branch 'wip/corey/listbase-focus' into 'main'
listbase: Use set_focus_child properly

Closes #5433 and #5432

See merge request GNOME/gtk!5169
2022-12-14 19:06:57 +00:00
Emmanuele Bassi
a2b00f7ea7 ci: Install tests in a separate prefix
Avoid using `sudo` in the installed-tests CI job, since we're installing
Meson as the current user.
2022-12-14 19:02:23 +00:00
Pablo Correa Gómez
42ba97eb5c gtkcheckbutton: Document how to keep track of changes for radio buttons 2022-12-14 20:02:07 +01:00
Matthias Clasen
e5560c1535 Add GDK_DEBUG=no-portals
Fixes: #5441
2022-12-14 13:50:20 -05:00
Emmanuele Bassi
7fca091371 ci: Redefine PATH 2022-12-14 18:39:34 +00:00
Corey Berla
93e591fdf1 listbase: Use set_focus_child properly
The EventControllerFocus on the list item, updates the list base focus
tracker and scrolled to position any time the list item enters focus.
This works when interacting within a single window, but has unexpected
results when changing focus between multiple windows.

Instead of using the focus controller workaround, just make
gtk_list_base_update_focus_tracker the set_focus_child vfunc

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5433
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5432
2022-12-14 07:56:57 -10:00
Corey Berla
7081bfc614 listbase: Split scroll_to_item for reuse 2022-12-14 07:51:34 -10:00
Emmanuele Bassi
cd7627ed02 ci: Consistently use meson subcommands
meson setup:
  configuration
meson compile:
  compilation
meson install
  installation

Do not use ninja directly, and do not use `meson` as a synonym for
`meson setup`.
2022-12-14 17:44:27 +00:00
Emmanuele Bassi
ce9069c85f build: Add known to be failing gsk comparison tests
The unaligned-offscreen and upside-down-label-3d tests are failing after
upgrading our CI images, seemingly because of some font rendering issue
that is hard to track. Let's use the "failing" testsuite mechanism that
we also use for the reftests.
2022-12-14 17:40:04 +00:00
Emmanuele Bassi
6e0def6474 ci: Install Meson in the build jobs
We use the latest 0.64 even if we depend on 0.60 because of fixes in the
subproject command.
2022-12-14 17:13:03 +00:00
Matthias Clasen
a471a8b57c Merge branch 'ebassi/gidocgen-update' into 'main'
ci: Update the gi-docgen dependencies

See merge request GNOME/gtk!5263
2022-12-14 16:24:48 +00:00
Georges Basile Stavracas Neto
b0f65ead84 Merge branch 'gbsneto/filechooser-grid-view' into 'main'
Add GtkGridView to the filechooser

Closes #233

See merge request GNOME/gtk!5163
2022-12-14 14:47:21 +00:00
Matthias Clasen
e3f805f169 Merge branch 'appdialog' into 'main'
Add GtkAppDialog

See merge request GNOME/gtk!5284
2022-12-14 13:24:20 +00:00
Luca Bacci
48bcae99af Merge branch 'gdk-win32-fix-native-decoration-resize' into 'main'
GdkWin32: Fix resizes with native decorations

Closes #5142, #5088, and #5090

See merge request GNOME/gtk!5096
2022-12-14 13:13:14 +00:00
Danial Behzadi
355b42b373 Update Persian translation
(cherry picked from commit aabae92482)
2022-12-14 12:33:20 +00:00
Luca Bacci
0bdf30dfbf Merge branch 'gdk-win32-modal-handling' into 'main'
GdkWin32: Do not use MA_NOACTIVATEANDEAT

Closes #5297 and #5326

See merge request GNOME/gtk!5208
2022-12-14 10:08:42 +00:00
Corey Berla
e8f70be2c1 Merge branch 'wip/otte/for-5422' into 'main'
contentserializer: Serialize to file:// if possible

Closes #5422

See merge request GNOME/gtk!5330
2022-12-14 01:56:04 +00:00
Benjamin Otte
ea056d261f contentserializer: Serialize to file:// if possible
Try to get a native file:// URI instead of any other GVFS
scheme, for interoperability with apps only handling file:// URIs.

This is what GTK3 Nautilus and Thunar do, so apps should be tuned
for this behavior.

See also https://bugzilla.xfce.org/show_bug.cgi?id=13845

Fixes: #5422
2022-12-14 02:33:45 +01:00
Matthias Clasen
c2c99a163a Merge branch 'stylanydev' into 'main'
Gtk.GestureStylus: implement `anydev` property

See merge request GNOME/gtk!4707
2022-12-13 19:34:12 +00:00
Matthias Clasen
eec8cf1309 Deprecate gtk_widget_show/hide
gtk_widget_set_visible does the same job.
2022-12-13 13:46:02 -05:00
Matthias Clasen
18e0eaa9d6 tests: Stop using gtk_widget_show/hide 2022-12-13 13:46:02 -05:00
Matthias Clasen
b8962fcba7 examples: Stop using gtk_widget_show/hide 2022-12-13 13:46:02 -05:00
Matthias Clasen
fba4cea2e8 testsuite: Stop using gtk_widget_show/hide 2022-12-13 13:46:02 -05:00
Georges Basile Stavracas Neto
8cf9810240 pathbar: Reimplement using GtkBox
The path bar does a lot of manual management of buttons, mostly to
be able to show navigation arrows when there's not enough space to
show the full path.

Since the GTK4 migration, this is slightly broken in some cases, due
to the 'need_sliders' variable being always set to TRUE. Furthermore,
after the introduction of the Recent button as a special cased fake
root, the allocation of the buttons is generating warnings.

Reimplement the path bar as a GtkBox, inside a GtkScrolledWindow.
This mimics what Nautilus does, and allows us to make navigation more
predictable, and remove most of the complexity from GtkPathBar. It
also prevents it from generating allocation warnings.

The path bar itself now doesn't override GtkWidget.measure nor
GtkWidget.allocate; instead, it delegates layout to the GtkBinLayout
layout manager.

CSS is adjusted to account for the changed hierarchy of buttons.
2022-12-13 14:45:15 -03:00
Georges Basile Stavracas Neto
f0a76f2ca8 filechooserwidget: Improve grid cell visuals
Use a GtkLabel instead of a GtkInscription to get filenames better
displayed within the available space.
2022-12-13 14:45:15 -03:00
Georges Basile Stavracas Neto
358d9d72d1 filechooserwidget: Don't check operation mode for tooltip
There's no way this could ever have been correct. We always want to
show the tooltip, and it's basically always available.
2022-12-13 14:45:15 -03:00
Sam Hewitt
aabb8dce91 filechooser: Add hover styles to the gridview children 2022-12-13 14:45:15 -03:00
Georges Basile Stavracas Neto
80736d782b filechooserwidget: Add toggle view button clone in search
It's positioned and looks exactly like the browse_toggle_view_button,
but due to the way things are organized, we cannot simply reuse that
button.

Add a clone of browse_toggle_view_button in the search entry page of
the toolbar stack. Make it toggle the same action as of the original
button, and bind the icon name and tooltip texts to it too.
2022-12-13 14:45:15 -03:00
Georges Basile Stavracas Neto
1464289710 filechooserwidget: Show pathbar in recent mode
As per design direction, show the pathbar in recent mode.
2022-12-13 14:45:15 -03:00
Georges Basile Stavracas Neto
72c676aecb pathbar: Special case recent button
Soon pathbar will be shown on the Recent mode, with a static
path pointing to, well, Recent, so special case it in the
GtkPathBar with a static icon.
2022-12-13 14:45:15 -03:00
Corey Berla
c717d10dda filechooserwidget: Hide ColumnView settings in GridView 2022-12-13 14:45:15 -03:00
Matthias Clasen
ee5324359d filechooser: Save and restore view type
With this, the filechooser comes up with the
same view (grid or list) that it had the last
time you used it.
2022-12-13 14:45:15 -03:00
Georges Basile Stavracas Neto
10338a5237 filechooserwidget: Rename callback
It's shared between both column and grid views now.
2022-12-13 14:45:15 -03:00
Georges Basile Stavracas Neto
1c5caf53b6 filechooserwidget: Implement 'keynav-failed' for grid view
It's exactly the same as of the column view. Since we're sharing
the callback now, rename it to browse_files_view_keynav_failed_cb.
2022-12-13 14:45:15 -03:00
Georges Basile Stavracas Neto
0bb6377a3a filechooserwidget: Use correct view in various places
Most of the pointer comparisons against 'browse_files_column_view'
should actually be performed against the current view widget. As
it turns out, it weren't that many places after all.
2022-12-13 14:45:15 -03:00
Georges Basile Stavracas Neto
ce12ab8307 style: Improve filechooser grid view slightly 2022-12-13 14:45:15 -03:00
Georges Basile Stavracas Neto
27613e3bc5 filechooserwidget: Add a grid view
Add a grid view outside of the widgetry tree. The grid view mimics
the column view using bindings, so we only need to manage the column
view.

Also add a button in the path bar section to toggle the view. This
is handled as a new 'toggle-view' action in the file chooser.

The way switching between views currently work is by setting either
the column or grid view as the child of the GtkScrolledWindow. This
has the benefit of unmapping the unused view, which is nice and can
avoid some tricky situations with thumbnails.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/233
2022-12-13 14:45:15 -03:00
Georges Basile Stavracas Neto
a9be0be32b filethumbnail: Add 'icon-size' property
This will be used by future commits so that we can reuse this widget
in the file chooser grid view.
2022-12-13 14:45:15 -03:00
Matthias Clasen
6b83ded8f0 Merge branch 'harfbuzz-dep' into 'main'
build: Use a stable harfbuzz

See merge request GNOME/gtk!5327
2022-12-13 16:15:43 +00:00
Matthias Clasen
cc23ef6eae build: Use a stable harfbuzz
We don't need the latest harfbuzz.
Stick to 4.0 for now.
2022-12-13 09:29:16 -05:00
Arjan Molenaar
089d0caa5e macos: Fix freeze on drag
A Drag surface does not have a parent surface. Therefore, if we initialize
it with one, it's inheriting the frame clock from the parent, but the
drag surface is not linked to the parent. Once the drag surface is destroyed,
it's disposing the frame clock, which results in a "frozen" application.
2022-12-13 15:19:04 +01:00
Arjan Molenaar
d0c4413033 macos: Explicitly ungrab seat when drag is done or finalized
This is an extra safeguard that avoids grabbing resources longer than
nessecary. It also ensures the resource is removed from the drag,
so it is not freed again.
2022-12-13 15:19:04 +01:00
Arjan Molenaar
410fa9871f Remove old dragImage code
New code (macOS 10+ should support the NSDraggingSource protocol:
https://developer.apple.com/documentation/appkit/nsdraggingsource.
2022-12-13 15:19:04 +01:00
Matthias Clasen
eba9c4e4c3 gtk-demo: Update the pickers demo 2022-12-13 07:49:10 -05:00
Matthias Clasen
f94e9d26b5 gtk: Update all callers 2022-12-13 07:49:02 -05:00
Matthias Clasen
69cc4b42cf filelauncher: Add a file property 2022-12-13 07:48:35 -05:00
Matthias Clasen
66b4f2a9dd Merge branch 'docs/default-args' into 'main'
docs: Emphasize requirement to provide filenames as arguments

See merge request GNOME/gtk!5322
2022-12-13 12:17:07 +00:00
andy5995
99d6eb9cb4 docs: Emphasize requirement to give filenames as arguments
(related to #5430)
2022-12-12 23:40:07 -06:00
Matthias Clasen
631b0fa9fd Merge branch 'sunflowerskater-main-patch-64457' into 'main'
appchooser: Rename "application" to "app"

See merge request GNOME/gtk!5323
2022-12-12 16:48:56 +00:00
sunflowerskater
e319b14dc2 appchooserbutton: Rename "application" to "app"
This change is a part of an initiative to use the word "app" instead of "application" in the UI:

Teams/Design/initiatives#123
2022-12-11 19:20:12 -03:00
sunflowerskater
c96fefd7f5 appchooserwidget: Rename "application" to "app"
This change is a part of an initiative to use the word "app" instead of "application" in the UI:

https://gitlab.gnome.org/Teams/Design/initiatives/-/issues/123
2022-12-11 19:13:51 -03:00
sunflowerskater
b1a9afbdba appchooser: Rename "application" to "app"
This change is a part of an initiative to use the word "app" instead of "application" in the UI: https://gitlab.gnome.org/Teams/Design/initiatives/-/issues/123
2022-12-11 20:05:54 +00:00
Matthias Clasen
6bed0cfb5a Merge branch 'popover-present-docs' into 'main'
popover: Clarify docs

See merge request GNOME/gtk!5318
2022-12-11 04:03:10 +00:00
Matthias Clasen
973a8752ab Merge branch 'ebassi/image-dispose' into 'main'
Do not change the notification queue inside finalization

Closes #5420

See merge request GNOME/gtk!5321
2022-12-11 04:02:49 +00:00
Matthias Clasen
db3b216ad1 Merge branch 'builder-scope-note' into 'main'
builderscope: Add a note for implementors

See merge request GNOME/gtk!5317
2022-12-11 01:07:21 +00:00
Emmanuele Bassi
b3b5a5064e Do not change the notification queue inside finalization
Notifications are not going to be emitted during the finalization, and
GObject will warn if you try to acquire and release a reference to the
notification queue when the reference count of an object has reached
zero.

Fixes: #5420
2022-12-11 00:36:03 +00:00
andy5995
9fd4b215ee docs: Place example-{3,4} in numerical order 2022-12-10 17:39:09 -06:00
Matthias Clasen
5c70f2ae9b builderscope: Add a note for implementors
Recommend that scope implementations should fall
back to or derive from GtkBuilderCScope in order
to not lose GTK's type-guessing machinery.

Related: #5398
2022-12-10 17:12:02 -05:00
Matthias Clasen
5df9f4016e popover: Clarify docs
gtk_popover_present() is a misleadingly named
function, so at least give it clear docs that
tell people to use gtk_popover_popup() instead.
2022-12-10 16:36:00 -05:00
Matthias Clasen
6f7a4b67c2 Merge branch 'docs/deprecated-G_APPLICATION_FLAGS_NONE' into 'main'
docs: Update deprecated G_APPLICATION_FLAGS_NONE in examples

See merge request GNOME/gtk!5315
2022-12-10 20:53:09 +00:00
andy5995
6e7ecb02f1 docs: Update deprecated G_APPLICATION_FLAGS_NONE 2022-12-10 01:12:13 -06:00
Matthias Clasen
146cf0bdd4 Merge branch 'deprecate-keys-changed' into 'main'
treeview: Drop a few unused variables

See merge request GNOME/gtk!5314
2022-12-09 19:03:01 +00:00
Matthias Clasen
00bdad23b0 Deprecate gtk_show_uri
This API has been superseded by GtkFileLauncher.
2022-12-09 13:36:28 -05:00
Matthias Clasen
8ff3217712 gtk: Stop using gtk_show_uri
Replace all uses of gtk_show_uri
with GtkFileLauncher.
2022-12-09 13:36:28 -05:00
Matthias Clasen
7a50e31b8d gtk-demo: Add a GtkFileLauncher demo
Replace the deprecated app chooser button by a
button that calls gtk_file_launcher_launch.
2022-12-09 13:25:02 -05:00
Matthias Clasen
1d9ee050f4 Add GtkFileLauncher
This is a replacement for gtk_show_uri_full,
which can open a GFile in an application, or
open its containing folder in a file manager.
2022-12-09 13:25:02 -05:00
Matthias Clasen
40d54ad3eb window: Deprecate the ::keys-changed signal 2022-12-09 13:14:27 -05:00
Matthias Clasen
a9b387b37b tests: Silence a compiler warning 2022-12-09 13:13:24 -05:00
Matthias Clasen
12f9883599 treeview: Drop a few unused variables
Compilers get pickier every year...
2022-12-09 13:12:47 -05:00
Matthias Clasen
4e23fe896e composetable: Drop an unused variable 2022-12-09 13:09:34 -05:00
Olga Smirnova
0effe1fd07 Add Interlingue translation 2022-12-09 17:24:41 +00:00
Matthias Clasen
a07bf1a047 Merge branch 'dialog-fixes' into 'main'
filechooserwidget: Fixes

See merge request GNOME/gtk!5311
2022-12-09 16:22:00 +00:00
Matthias Clasen
42cd230d44 openuriportal: Better error handling
Nested async calls are always a challenge.

Hopefully, things are straightened out now,
and we report GTK_DIALOG_ERROR errors for
the cases we care about.
2022-12-09 11:05:48 -05:00
Matthias Clasen
bc8e19fcd0 openuriportal: Add a check function
Add private API to check whether the portal
is available.
2022-12-09 11:05:48 -05:00
Matthias Clasen
ae29fee903 openuriportal: Support OpenDirectory
This required an extra argument. Update all callers.
2022-12-09 11:05:48 -05:00
Matthias Clasen
7ad0bae12f openuriportal: Cosmetics
There were some copy-paste errors.
2022-12-09 11:05:48 -05:00
Matthias Clasen
3e11ea9ddf fontdialog: Improve docs
Be more specific about possible errors.
2022-12-09 11:05:48 -05:00
Matthias Clasen
5b6c98d589 colordialog: Improve the docs
Be more specific about possible errors.
2022-12-09 11:05:48 -05:00
Matthias Clasen
57082e2e40 fontdialog: Don't forget to propagate errors
Oops.
2022-12-09 11:05:48 -05:00
Matthias Clasen
45e3e1594f fontdialogbutton: Survive window closing
If the parent window of the button gets destroyed
while the dialog is open, we cancel the async op,
but we need to be a little more careful about not
stepping on glass.
2022-12-09 11:05:48 -05:00
Matthias Clasen
637ef84d04 colordialogbutton: Survive window closing
If the parent window of the button gets destroyed
while the dialog is open, we cancel the async op,
but we need to be a little more careful about not
stepping on glass.
2022-12-09 11:05:48 -05:00
Matthias Clasen
b297baed32 fontdialog: Unset check cancellable 2022-12-09 11:05:48 -05:00
Matthias Clasen
c45f172e79 colordialog: Unset check cancellable 2022-12-09 11:05:48 -05:00
Matthias Clasen
417382375b filedialog: Report cancellation propertly
Unless we prevent it, GTask will always report
cancellation as G_IO_ERROR_CANCELLED. But we
want GTK_DIALOG_ERROR_ABORTED for this case.
2022-12-09 11:05:48 -05:00
Matthias Clasen
2e90a752eb filechooserwidget: Fixes
Fix a memory leak in the file manager launch path.
2022-12-09 11:05:48 -05:00
Matthias Clasen
abe5181b10 Merge branch 'wip/corey/column-view-header' into 'main'
columnviewtitle: Prevent header clicks from propagating

Closes #5425

See merge request GNOME/gtk!5306
2022-12-09 15:28:58 +00:00
Matthias Clasen
585b6a3637 Merge branch 'matthiasc/node-editor-srcdir' into 'main'
node-editor: Redo saving location

Closes #5403

See merge request GNOME/gtk!5310
2022-12-09 15:22:00 +00:00
Matthias Clasen
3007b0fd7f Remove leftover debug spew 2022-12-09 10:04:42 -05:00
Matthias Clasen
96b9ac84f8 node-editor: Redo saving location
Determine the location to save testcases in dynamically,
trying first a GTK_SOURCE_DIR environment variable
and then the current directory as the GTK source dir,
ultimatively falling back to just saving in the current
directory.

This avoids leaking details of the build environment
into the produced artifacts and should make GTK builds
more reproducible.

Fixes: #5403
2022-12-09 09:35:32 -05:00
Matthias Clasen
860c2f8ddd Merge branch 'fix-file-dialog-title' into 'main'
filedialog: Use title if set

Closes #5415

See merge request GNOME/gtk!5308
2022-12-08 13:16:55 +00:00
Matthias Clasen
de83d57e14 filedialog: Use title if set
This broken when the code was reshuffled into
the switch.

Fixes: #5415
2022-12-08 07:57:16 -05:00
Matthias Clasen
9de963e8b4 Merge branch 'wip/carlosg/stale-timeout' into 'main'
gdk/x11: Clear all data in GdkSurfaceX11 finalization

See merge request GNOME/gtk!5303
2022-12-08 12:18:37 +00:00
Matthias Clasen
5e92c26b9a Merge branch 'macos-unused-vars' into 'main'
macos: remove unused variables from macos code

See merge request GNOME/gtk!5290
2022-12-08 12:17:13 +00:00
Matthias Clasen
8c7b9c30de Merge branch 'ccook/spelling-changes' into 'main'
Various spelling mistakes across a few domains that show up in documentation.

See merge request GNOME/gtk!5292
2022-12-08 12:16:22 +00:00
Cam Cook
6bfb35f047 Various spelling mistakes across a few domains that show up in documentation. 2022-12-08 12:16:22 +00:00
Matthias Clasen
53c3cce5e4 Merge branch 'emoji-recent-empty' into 'main'
emojichooser: Actually disable the recent section

See merge request GNOME/gtk!5305
2022-12-08 12:09:26 +00:00
Luca Bacci
acd7d739f5 GdkWin32: Fix resizes with native decorations
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5142
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5088
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5090
2022-12-08 11:41:05 +01:00
Corey Berla
33e7774743 columnviewtitle: Prevent header clicks from propagating
The header in GtkColumnView has multiple event handlers
there is a ::pressed handler in GtkColumnView for
resizing the columns in CAPTURE as well as a motion
and drag controller.  The ::release handler is in
GtkColumnViewTitle.   We can't claim the event in the
existing handlers because then the ::release handler will
never get called.  Currently, however, all clicks get propagated
to the ColumnView from the header which can be problematic.
Since we don't usually want the clicks from the header
handled on the view, claim it in the BUBBLE phase.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5425
2022-12-07 10:25:09 -10:00
Guido Günther
89c816a614 emojichooser: Actually disable the recent section
The loop sets empty = FALSE when there are emojis but for that
to work we need to initialize the value to TRUE initially.

Fixes: 7928532bc5
2022-12-07 19:33:59 +01:00
Carlos Garnacho
c24358cfbc gdk/x11: Clear all data in GdkSurfaceX11 finalization
Currently, the GdkSurfaceX11 implementation relies that the upper
layers hid the surface before destruction, and that no
GdkSurfaceClass.compute_resize happened between them. If these
circumstances happened, there would be a compute_size timeout left
dangling after the surface got destroyed, poking at incorrect data
later on. Something that looks like this was reported in the
recent mutter-x11-frames "SSD frames server":

    mutter-x11-frames:423016): GLib-GObject-WARNING **: 19:41:16.869: invalid unclassed pointer in cast to 'GtkWindow'

    Thread 1 "mutter-x11-fram" received signal SIGTRAP, Trace/breakpoint trap.
    g_logv (log_domain=0x7ffff7f7c4f8 "GLib-GObject", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=<optimized out>) at ../../../glib/gmessages.c:1433
    1433	../../../glib/gmessages.c: No such file or directory.
    (gdb) bt
    #0  g_logv (log_domain=0x7ffff7f7c4f8 "GLib-GObject", log_level=G_LOG_LEVEL_WARNING, format=<optimized out>, args=<optimized out>) at ../../../glib/gmessages.c:1433
    #1  0x00007ffff73470ff in g_log (log_domain=log_domain@entry=0x7ffff7f7c4f8 "GLib-GObject", log_level=log_level@entry=G_LOG_LEVEL_WARNING, format=format@entry=0x7ffff7f84da8 "invalid unclassed pointer in cast to '%s'")
        at ../../../glib/gmessages.c:1471
    #2  0x00007ffff7f72892 in g_type_check_instance_cast (type_instance=type_instance@entry=0x5555558e04b0, iface_type=<optimized out>) at ../../../gobject/gtype.c:4144
    #3  0x00007ffff791e77d in toplevel_compute_size (toplevel=<optimized out>, size=0x7fffffffe170, widget=0x5555558e04b0) at ../../../gtk/gtkwindow.c:4227
    #4  0x00007ffff7f4f3b0 in g_closure_invoke (closure=0x555555898cc0, return_value=return_value@entry=0x0, n_param_values=2, param_values=param_values@entry=0x7fffffffdeb0, invocation_hint=invocation_hint@entry=0x7fffffffde30)
        at ../../../gobject/gclosure.c:832
    #5  0x00007ffff7f62076 in signal_emit_unlocked_R
        (node=node@entry=0x55555588feb0, detail=detail@entry=0, instance=instance@entry=0x55555560e990, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7fffffffdeb0)
        at ../../../gobject/gsignal.c:3796
    #6  0x00007ffff7f68bf5 in g_signal_emit_valist (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>, var_args=var_args@entry=0x7fffffffe050) at ../../../gobject/gsignal.c:3549
    #7  0x00007ffff7f68dbf in <emit signal ??? on instance 0x55555560e990 [GdkX11Toplevel]> (instance=<optimized out>, signal_id=<optimized out>, detail=detail@entry=0) at ../../../gobject/gsignal.c:3606
    #8  0x00007ffff7a8de96 in gdk_toplevel_notify_compute_size (toplevel=<optimized out>, size=size@entry=0x7fffffffe170) at ../../../gdk/gdktoplevel.c:112
    #9  0x00007ffff7a4b15a in compute_toplevel_size (surface=surface@entry=0x55555560e990 [GdkX11Toplevel], update_geometry=update_geometry@entry=1, width=width@entry=0x7fffffffe220, height=height@entry=0x7fffffffe224)
        at ../../../gdk/x11/gdksurface-x11.c:281
    #10 0x00007ffff7a4c3b2 in compute_size_idle (user_data=0x55555560e990) at ../../../gdk/x11/gdksurface-x11.c:356
    #11 0x00007ffff733f67f in g_main_dispatch (context=0x55555563f6e0) at ../../../glib/gmain.c:3444
    #12 g_main_context_dispatch (context=context@entry=0x55555563f6e0) at ../../../glib/gmain.c:4162
    #13 0x00007ffff733fa38 in g_main_context_iterate (context=0x55555563f6e0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../../../glib/gmain.c:4238
    #14 0x00007ffff733fcef in g_main_loop_run (loop=loop@entry=0x5555560874a0) at ../../../glib/gmain.c:4438
    #15 0x0000555555557de0 in main (argc=<optimized out>, argv=<optimized out>) at ../src/frames/main.c:68

It perhaps makes sense to warn in these situations, but either way
it sounds like gdk_surface_x11_finalize() could enforce the correct
behavior by ensuring there is no dangling timeouts/data. This commit
does that.
2022-12-07 13:16:36 +01:00
Arjan Molenaar
19aaa8fee5 macos: Use Command key symbol for meta
Show the Apple Command symbol ⌘ as keyboard shortcut for the Meta key on macos,
similar to GtkAccelGroup.
2022-12-05 21:00:42 +01:00
Joan Bruguera
43c1a433aa gdk/wayland: set requesting surface to xdg-activation
The argument to xdg_activation_token_v1_set_surface is documented to be the
surface requesting the activation, not the surface to be activated, which is
given later when calling xdg_activation_v1_activate.
(c.f. 36cee4bdbc)

Use the same logic as in gdk_wayland_app_launch_context_get_startup_notify_id,
i.e. if we have a surface with focus, set that, otherwise set NULL.

This fixes requesting urgent/focus on wlroots (compositors like Sway, etc.),
which was blocked as the surface requesting the activation didn't have focus.

Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
2022-12-04 23:33:34 +00:00
Arjan Molenaar
097d87e502 Cleanup: remove unused variables from macos code
Remove unused variables. In case if Cairo code it would
allocate memory, which would result in a memory leak.
2022-12-04 12:50:20 +01:00
Benjamin Otte
a9c9678e1f Merge branch 'workaround-glx-issue' into 'main'
GLX: Add extra glXMakeContextCurrent () call to work around a DRI issue

Closes #4499, #5387, and #5170

See merge request GNOME/gtk!5285
2022-12-02 15:32:22 +00:00
Luca Bacci
f788e994a9 GLX: Add extra glXMakeContextCurrent () call to work around a DRI issue
Reference: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7808

Fixes #4499, #5387, #5170
2022-12-02 14:20:43 +01:00
Benjamin Otte
c977f5cbb0 Merge branch 'wip/corey/tree-expander-bug' into 'main'
Improve treeexpanders

See merge request GNOME/gtk!5282
2022-11-30 19:06:12 +00:00
Corey Berla
c541de3e05 list: Remove active state handling in listitemwidget and treeexpander
Active state is handled by main now.  It appears that listitem and
treeexpander handled it manually (probably before main did).  This
is unnecessary now, so let's remove it.
2022-11-30 10:48:14 -08:00
Corey Berla
fdfd76774e treeexpander: Scroll to expanded item
If the anchor is below the expanded item, the expanded item will
go out of view if there are sufficient children items.  This is not
ideal, so make sure to scroll to the item to ensure it remains in
view.
2022-11-30 09:43:20 -08:00
Corey Berla
7eac27e5ee listitemwidget: Add listitem.scroll-to action
This is the matching action for list.scroll-to-item
2022-11-30 09:43:20 -08:00
Corey Berla
847b3261fc treeexpander: Toggle expand on release instead of pressed
With the introduction of the hide-expander property, I noticed that
the active state would persist in many cases because the release
signal was never emitted.  In gtk3 tree expanders, expanded
on release.  gtk4 expanded on press to match window explorer.
Per irc chat, the designers didn't have a strong preference
for press or release.  In order to keep consistency and
fix this bug, let's move back to release.
2022-11-30 09:41:18 -08:00
Corey Berla
63a655e345 treeexpander: Fix typo and GestureClick type
"canceled" should be "cancelled".  Also, "cancel" is a signal on
GtkGesture.
2022-11-29 20:52:46 -08:00
Corey Berla
ff8d88b097 dragsource: Add a timeout before starting a drag
No one wants a drag that happens in less than 100ms (if so, it's
probably accidental).
2022-11-29 20:06:21 -08:00
Emmanuele Bassi
75454adbe2 Merge branch 'ebassi/for-main' into 'main'
docs: Fix property cross-links in GtkTreeExpander

See merge request GNOME/gtk!5279
2022-11-29 14:08:13 +00:00
Emmanuele Bassi
9bce5f0462 docs: Fix property cross-links in GtkTreeExpander 2022-11-29 13:49:35 +00:00
Matthias Clasen
d2158e825b Merge branch 'matthiasc/for-main' into 'main'
testsuite: Skip tests that miss charset support

See merge request GNOME/gtk!5277
2022-11-29 12:09:33 +00:00
Matthias Clasen
36a4bb0341 Merge branch 'ccook/spelling-fixes' into 'main'
docfix: Various spelling errors that show up in docs

See merge request GNOME/gtk!5272
2022-11-29 08:57:48 +00:00
Matthias Clasen
be324cc665 testsuite: Skip tests that miss charset support
This came up when running the tests in a fresh
toolbox missing the glibc-gconv-extra package.
2022-11-29 03:52:27 -05:00
Matthias Clasen
d9f4bd5490 Merge branch 'wip/corey/at-spi-context' into 'main'
atspicontext: Cache empty atspi bus address

See merge request GNOME/gtk!5276
2022-11-29 07:51:23 +00:00
Matthias Clasen
23a3bf7a3c Merge branch 'show-hide-cleanup' into 'main'
gtk: Stop using gtk_widget_show/hide

See merge request GNOME/gtk!5273
2022-11-29 07:30:04 +00:00
Corey Berla
44e297488f atspicontext: Log more helpful warnings when the a11y bus doesn't exist 2022-11-28 17:02:18 -08:00
Corey Berla
8072d202e3 atspicontext: Cache empty atspi bus address
We are caching the bus address as data on the display object when it
exists, but fail to set the data when the bus address doesn't exist.
That causing excessive calls to GetAddress when the accesssbility
bus doesn't exist. Make sure to cache a non-existent accessibility
bus by setting the "" string.
2022-11-28 17:02:13 -08:00
Matthias Clasen
b82fa26373 Merge branch 'matthiasc/for-main' into 'main'
Revert "builder: Stop using GtkBuildable.get_id"

See merge request GNOME/gtk!5274
2022-11-28 23:08:58 +00:00
Matthias Clasen
f624897589 Merge branch 'wip/carlosg/osk-activation-in-widgets' into 'main'
Handle OSK activation in GtkText/GtkTextView widgets

See merge request GNOME/gtk!5269
2022-11-28 19:43:19 +00:00
Matthias Clasen
a46bee1285 Revert "builder: Stop using GtkBuildable.get_id"
This reverts commit 92edd4c476.

This commit changed behavior that GNOME Builder relies on.
2022-11-28 14:36:47 -05:00
Matthias Clasen
1ee39d7555 tools: Stop using gtk_widget_show/hide 2022-11-28 14:34:55 -05:00
Matthias Clasen
1018b43724 constraint editor: Stop using gtk_widget_show/hide 2022-11-28 14:34:55 -05:00
Matthias Clasen
c823ea4a70 icon browser: Stop using gtk_widget_show/hide 2022-11-28 14:34:55 -05:00
Matthias Clasen
fb8e52f0c9 gtk-demo: Stop using gtk_widget_show/hide 2022-11-28 14:34:55 -05:00
Matthias Clasen
352ace83bc widget-factory: Stop using gtk_widget_show/hide 2022-11-28 14:34:55 -05:00
Matthias Clasen
f339cc276c gtk: Stop using gtk_widget_show/hide
gtk_widget_set_visible and gtk_window_present
are better alternatives, and calling gtk_widget_show
on newly created widgets is no longer necessary
anyway.
2022-11-28 14:34:55 -05:00
Cam Cook
5b45efb49b Merge remote-tracking branch 'origin' into ccook/spelling-fixes 2022-11-28 12:34:38 -05:00
Benjamin Otte
57ac4740b3 Merge branch 'wip/corey/tree-expander' into 'main'
treeexpander: Add hide-expander and indent-for-depth properties

Closes #4969

See merge request GNOME/gtk!5268
2022-11-28 15:53:17 +00:00
Carlos Garnacho
929a51addb imcontextwayland: Set up OSK activation gesture on non text widgets
With GtkText and GtkTextView (and in extension, all their subclasses)
handling OSK activation activation, this gesture is only useful for
all text input widgets that are not subclasses of these 2 widgets,
e.g. the VTEs and crosswords of the world.

These still do need a hand in handling OSK activation, so only
set up the gesture for such cases.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
6cbb7b848a gtktextview: Invoke OSK on button/touch taps that move/undo selection
If the ::release handler is invoked, the press/release happened without
drags in between. Additionally check that there is no selection at all.

This makes OSK invoked on taps that move the caret around, while tapping
in the selection invokes edition popup and text handles without bringing
in the OSK.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
ed81c265ac gtktextview: Claim drag gesture after an actual selection change
This way, the drag gesture lets the click gesture ::release handler
happen if there was no actual changes to the selected text (i.e.
too short drags). This matches the ::release handler behavior match
the situations in which the OSK was being invoked by the wayland
GtkIMContext.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
ee6d9478c8 gtktext: Invoke OSK on button/touch taps that move/undo selection
If the ::release handler is invoked, the press/release happened without
drags in between. Additionally check that the press did not happen within
the selection, and that there is no selection at all.

This makes OSK invoked on taps that move the caret around, while tapping
in the selection invokes edition popup and text handles without bringing
in the OSK.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
76d80f7544 gtktext: Claim drag gesture after an actual selection change
This way, the drag gesture lets the click gesture ::release handler
happen if there was no actual changes to the selected text (i.e.
too short drags). This matches the ::release handler behavior match
the situations in which the OSK was being invoked by the wayland
GtkIMContext.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
e3b0d57ce7 imcontextwayland: Implement activate_osk() vmethod
This method does explicitly what the builtin GtkClickGesture in
the IM context is doing implicitly. The gesture will be dropped
after porting is done.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
6d0f7a2d31 immulticontext: Implement activate_osk() vmethod
The multicontext lets this call go through to the active
underlying GtkIMContext.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
459583ba9e imcontext: Add private activate_osk() vmethod
This method is so far private for both external GtkIMContext
implementations and external GtkIMContext users, and is meant
to activate the OSK in the environments where this may happen.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
59af80ab8b Revert "gtktext: Claim gesture more selectively"
This reverts commit ae54374a51.
2022-11-28 15:46:41 +01:00
Matthias Clasen
005574b1b2 Merge branch 'bilelmoussaoui/gi-since' into 'main'
g-i: Add missing since annotations

See merge request GNOME/gtk!5271
2022-11-28 11:17:51 +00:00
Bilal Elmoussaoui
0919320086 g-i: Add missing since annotations 2022-11-28 07:54:48 +00:00
Corey Berla
72bc97fff5 treeexpander: Minor formatting changes 2022-11-27 19:39:20 -08:00
Corey Berla
648b38761c treeexpander: Add indent-for-depth property
When set to TRUE, indent-for-depth indents each level of
depth with an additional indent
2022-11-27 19:36:20 -08:00
Corey Berla
2b578a24e4 treeexpander: Add hide-expander property
When set to TRUE hide-expander hides the expander icon in a
GtkTreeListRow.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4969
2022-11-27 19:36:11 -08:00
Matthias Clasen
90c986e493 Merge branch 'wip/corey/spi-logging' into 'main'
atspicontext: Log failure to connect to a11y

See merge request GNOME/gtk!5270
2022-11-28 01:29:10 +00:00
Matthias Clasen
ed6798e94c Merge branch 'work/zzag/wl-output-release' into 'main'
gdk/wayland: Prefer wl_output_release() over wl_output_destroy()

See merge request GNOME/gtk!5243
2022-11-27 22:21:29 +00:00
Corey Berla
16fd72e606 atspicontext: Log failure to connect to a11y
GTK depends on the a11y infrastructure to be in place unless GTK_A11Y is
set to none.  It appears that despite that, users attempt to
get around the a11y requirement without setting GTK_A11Y.
This can cause, amongst other issues, performance problems
with gtk applications.  Log failure to connect to the a11y
bus.
2022-11-27 14:13:13 -08:00
Matthias Clasen
3dae22efdb Merge branch 'fix-keymap-notify' into 'main'
Don't emit ::notify from a getter

See merge request GNOME/gtk!5267
2022-11-27 19:04:13 +00:00
Cam Cook
b876b4f568 | domain | current | suggestion |
|--------|---------|------------|
| [GtkListBox](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklistbox.c#L1469)| (attributes org.gtk.Metthod.get_property=activate-on-single-click) | (attributes org.gtk.Method.get_property=activate-on-single-click) |
2022-11-27 07:42:12 -05:00
Cam Cook
dd780b3ce0 | domain | current | suggestion |
|--------|---------|------------|
| [GtkHeaderBar](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkheaderbar.c#L780) | "specifies a icon" | "specifies an icon" |
2022-11-27 06:49:40 -05:00
Cam Cook
0663758566 | domain | current | suggestion |
|--------|---------|------------|
| [GtkGridView](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkgridview.c#L1241)             | "Sets the imodel to use." | "Sets the model to use." |
2022-11-27 06:30:30 -05:00
Cam Cook
ccfe889ba9 Merge branch 'main' into ccook/spelling-fixes 2022-11-27 06:30:04 -05:00
Matthias Clasen
fe56f3413a Don't emit ::notify from a getter
GdkX11Keymap ddetermines the direction of the
keymap on demand, and was emitting notify::direction
2022-11-26 21:53:33 -05:00
Cam Cook
47bbc7e944 | domain | current | suggestion |
|--------|---------|------------|
| (GtkLevel](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklevelbar.c#L1139)     | "between [property@Gtk.LevelBar:min-value[" | "between [property@Gtk.LevelBar:min-value]"|
2022-11-26 14:51:34 -05:00
Cam Cook
c89cdb680d | domain | current | suggestion |
|--------|---------|------------|
| [GtkLevel](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklevelbar.c#L1104)     | "Returns the \`min-value of the \`GtkLevelBar\`." | "Returns the \`min-value\' of the \`GtkLevelBar\`."|
2022-11-26 14:35:40 -05:00
Cam Cook
d19426d399 | domain | current | suggestion |
|--------|---------|------------|
| [GtkLabel](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklabel.c#L3142)        | "the [property@Gtk.Label:use-underline property]" | "the [property@Gtk.Label:use-underline] property" |
2022-11-26 13:32:27 -05:00
Matthias Clasen
3b9eba6d9a Merge branch 'wip/corey/demo-file-dialog' into 'main'
gtk-demo: Application demo use open_finish()

See merge request GNOME/gtk!5264
2022-11-26 18:11:41 +00:00
Corey Berla
586c3c3cbd gtk-demo: Application demo use open_finish() 2022-11-26 18:11:40 +00:00
Emmanuele Bassi
cc546d7af1 build: Add a check argument to run_command()
Silence a Meson warning.
2022-11-26 15:18:42 +00:00
Emmanuele Bassi
03db707f3c vulkan: Add missing enumeration
Check for VK_ERROR_COMPRESSION_EXHAUSTED_EXT.
2022-11-26 15:18:42 +00:00
Emmanuele Bassi
a8cd2750f7 ci: Download the subprojects
Updating the subprojects will apparently fail if they haven't been
downloaded.
2022-11-26 15:18:42 +00:00
Emmanuele Bassi
ffad21a9d6 ci: Use Fedora 37 as the base
New stable release means new CI failures.
2022-11-26 14:04:07 +00:00
Matthias Clasen
b5644c2596 Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Cosmetics

See merge request GNOME/gtk!5265
2022-11-26 13:15:28 +00:00
Cam Cook
cb303895aa Various spelling mistakes (and one use of the wrong verb) across a few domains that show up in documentation.
| domain | current | suggestion |
|--------|---------|------------|
| [GtkBitset](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkbitset.c#L363)       | "Value to add" | "Value to remove" |
| [GtkEntry](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkentry.c#L3626)        | "\`GtkEntry"   | "\`GtkEntry\`"    |
| [GtkEntry](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkentry.c#L3566)        | "will be applies" | "will be applied" |
| [GtkEntry](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkentry.c#L2232)        | "is is in" | "is in" |
| [GtkInfoBar](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/deprecated/gtkinfobar.c#L772) | "in the info bars’s action area" | "in the info bar’s action area |
| [GtkLabel](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklabel.c#L3210)        | "Gets the labels attribute list." | "Gets the label's attribute list."
2022-11-26 06:54:47 -05:00
Matthias Clasen
e5cf55bdb4 gtk-demo: Cosmetics 2022-11-26 06:40:47 -05:00
Emmanuele Bassi
5419f1f2f0 ci: Update the gi-docgen dependencies
The python3-toml package is deprecated, and replaced by python3-tomli.
At least, until we bump up the dependency to Fedora 37: then we can
depend on Python 3.11, and its TOML parser in the standard library.

See also: https://gitlab.gnome.org/GNOME/gi-docgen/-/merge_requests/168
2022-11-25 17:50:21 +00:00
Matthias Clasen
79a2e31635 Merge branch 'bilelmoussaoui/g-i' into 'main'
g-i: Add missing since annotation

See merge request GNOME/gtk!5259
2022-11-25 14:43:19 +00:00
Matthias Clasen
56dfc6c5ba Merge branch 'wip/smcv/xfail' into 'main'
testsuite: Avoid using should_fail

See merge request GNOME/gtk!5248
2022-11-25 14:40:33 +00:00
Bilal Elmoussaoui
5ede8dd1eb g-i: Add missing since annotation 2022-11-25 10:16:37 +00:00
Matthias Clasen
4fdeec118a Merge branch 'dialog-improvements' into 'main'
gtk-demo: Test cancellation support for file dialog

See merge request GNOME/gtk!5257
2022-11-25 03:48:04 +00:00
Matthias Clasen
e73f0f6974 file dialog: Handle Escape better
Closing the dialog by hitting Escape should
have the same effect as clicking the cancel
button. Make it so.
2022-11-24 10:29:43 -05:00
Matthias Clasen
ff14c51950 color dialog: Handle Escape better
Closing the dialog by hitting Escape should
have the same effect as clicking the cancel
button. Make it so.
2022-11-24 10:29:03 -05:00
Matthias Clasen
4fa53bd041 gtk-demo: Test cancellation support for file dialog
Add a timeout that closes the file dialog after
20 seconds, to test programmatic cancellation.
2022-11-24 10:26:43 -05:00
Simon McVittie
94b57a967c testsuite: Don't create .test files for flaky or failing tests
These tests can be run manually, but are not suitable for use as an
acceptance test, so let's not make frameworks like Debian's autopkgtest
run these when they run ginsttest-runner in the most obvious way.

Signed-off-by: Simon McVittie <smcv@debian.org>
2022-11-24 13:46:33 +00:00
Simon McVittie
957dd49ef7 testsuite: Use separate setups for unstable tests instead of should_fail
There are two possible interpretations of "expected failure": either
the test *must* fail (exactly the inverse of an ordinary test, with
success becoming failure and failure becoming success), or the test
*may* fail (with success intended, but failure possible in some
environments). Autotools had the second interpretation, which seems
more useful in practice, but Meson has the first.

Instead of using should_fail, we can put the tests in one of two new
suites: "flaky" is intended for tests that succeed or fail unpredictably
according to the test environment or chance, while "failing" is for
tests that ought to succeed but currently never do as a result of a
bug or missing functionality. With a sufficiently new version of Meson,
the flaky and failing tests are not run by default, but can be requested
by running a setup that does not exclude them, with a command like:

    meson test --setup=x11_unstable --suite=flaky --suite=failing

As a bonus, now that we're setting up setups and their excluded suites
programmatically, the gsk-compare-broadway tests are also excluded by
default when running the test setup for a non-broadway backend.

When running the tests in CI, --suite=gtk overrides the default
exclude_suites, so we have to specify --no-suite=flaky and
--no-suite=failing explicitly.

This arrangement is inspired by GNOME/glib!2987, which was contributed
by Marco Trevisan.

Signed-off-by: Simon McVittie <smcv@debian.org>
2022-11-24 13:46:33 +00:00
Matthias Clasen
5e534306e4 Merge branch 'deprecate-infobar' into 'main'
Deprecate GtkInfoBar

See merge request GNOME/gtk!5246
2022-11-24 03:43:11 +00:00
Matthias Clasen
d3fbe80510 Merge branch 'wip/carlosg/gsk-clipping' into 'main'
gsk: Extend the blur radius for outset shadow extents

See merge request GNOME/gtk!5247
2022-11-23 22:38:49 +00:00
Vlad Zahorodnii
433734de21 gdk/wayland: Improve readability of wl_output binding code
Provide OUTPUT_VERSION macro to indicate the implemented version of
wl_output in gtk rather than use a magical number.
2022-11-23 22:53:00 +02:00
Carlos Garnacho
b9448b06b4 gsk: Extend the blur radius for outset shadow extents
By dividing the blur radius to obtain the clip radius, we may end up
with halved values that result in an overshunk clip mask. Extend this
so that we ensure to cover the last pixel.

Fixes artifacts seen with the cairo renderer in X11 when resizing
windows horizontally, a black 1px high line would be seen in the
top of the window due to these outset bounds being used in clipping.

More mysteriously, also seems to fix resize lag in the GL renderer
(also X11), if e.g. the bottom-right corner of a window is resized
diagonally in bottom-left -> top-right direction, or
bottom-right -> top-left.

Related: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2175#note_1599335
2022-11-23 19:27:49 +01:00
Matthias Clasen
942f8d4b4b Deprecate GtkInfoBar
This widget has a dialog-like API, which is something
we want to get rid of in GTK 5, and libadwaita has
a replacement with AdwBanner incoming.
2022-11-23 13:00:09 -05:00
Carlos Garnacho
35744d87a2 gsk: Also ceil() top side when converting graphene to cairo rectangles
The outset border for all sides is ceil()ed, except for the top side.
Most often values are already nicely rounded here, but this seems an
oversight.
2022-11-23 18:56:45 +01:00
Florian "sp1rit"​
6dd939f13e improved docs of Gtk.GestureStylus 2022-11-23 09:09:50 +01:00
Florian "sp1rit"​
c85fbcea55 adjusted stylus-only code to fit gtk code conventions 2022-11-23 08:59:29 +01:00
Vlad Zahorodnii
261bcd40bd gdk/wayland: Prefer wl_output_release() over wl_output_destroy()
By using wl_output_release(), GDK lets the compositor to clean up the
output global more nicely.

For example, currently, most compositors remove the global and then
destroy it later after N seconds expire. With this, the compositor could
experiment with destroying the output global once all its resources are
destroyed.
2022-11-22 14:12:22 +02:00
Matthias Clasen
200f31f285 Merge branch 'work/zzag/wl-output-cleanup' into 'main'
gdk/wayland: Destroy zxdg_output_v1 upon GdkWaylandMonitor destruction

See merge request GNOME/gtk!5242
2022-11-22 12:01:43 +00:00
Vlad Zahorodnii
1d94aefe2b gdk/wayland: Clear GdkWaylandMonitor::output using g_clear_pointer()
Use g_clear_pointer() to make tear down code consistent.
2022-11-22 11:23:08 +02:00
Vlad Zahorodnii
e82e7823a8 gdk/wayland: Destroy zxdg_output_v1 upon GdkWaylandMonitor destruction
It prevents potentially leaking memory.
2022-11-22 11:18:32 +02:00
Florian "sp1rit"​
789778105d gtk: gtkgesturestylus: implemented stylus-only property
this allows setting a Gtk.GestureStylus to a state, where it can be
used to handle non-stylus devices (e.g. mice).
This might be useful for applications that handle stylus input, but
want to allow falling back to a mice, if the user is unable to provide
stylus input.
2022-11-22 09:13:35 +01:00
Florian "sp1rit"​
c36685bf60 gdk: gdkevents: added NULL check to gdk_event_get_axes
this is to prevent gdk from causing a segfault, when getting event axes
for events that don't have them (i.e. attempting to get pressure from a
mice input device).
2022-11-22 09:13:32 +01:00
Matthias Clasen
0de172f03d Merge branch 'file-filter-properties' into 'main'
filefilter: Add properties for the criteria

See merge request GNOME/gtk!5241
2022-11-22 04:00:40 +00:00
Matthias Clasen
d34ac99916 filefilter: Add properties for the criteria
Add construct-only properties for patterns,
suffixes and mime-types. This provides an
alternative way to specify these in ui files.

Related: #5350
2022-11-21 22:44:03 -05:00
Matthias Clasen
055f3e5d97 Merge branch 'color-picker-portal' into 'main'
colorpicker: Always try the portal first

See merge request GNOME/gtk!5240
2022-11-21 19:46:17 +00:00
Matthias Clasen
205b718fe5 colorpicker: Always try the portal first
It does not hurt., and going forward, we want to
prefer portals.
2022-11-21 14:26:29 -05:00
Matthias Clasen
01ae136a4c Merge branch 'bilelmoussaoui/g-i' into 'main'
g-i: add missing array annotation to AlertDialog.set_buttons

See merge request GNOME/gtk!5234
2022-11-21 10:49:05 +00:00
Matthias Clasen
74806ed324 Merge branch 'fix-upside-down-labels' into 'main'
gsk: Avoid a crash with negative scales

See merge request GNOME/gtk!5236
2022-11-21 10:48:29 +00:00
Matthias Clasen
83839cb219 Merge branch 'drop-buildable-get-id' into 'main'
builder: Stop using GtkBuildable.get_id

See merge request GNOME/gtk!5239
2022-11-21 10:35:16 +00:00
Matthias Clasen
f22db024a8 Merge branch 'stringlist-prop' into 'main'
stringlist: Add a construct-only strings property

See merge request GNOME/gtk!5238
2022-11-21 10:34:54 +00:00
Matthias Clasen
e357ff6055 Drop gtk_widget_buildable_parser_finished
No need to have this no-op implementation.
This was the only implementation of this vfunc
in GTK.
2022-11-20 14:36:35 -05:00
Matthias Clasen
92edd4c476 builder: Stop using GtkBuildable.get_id
Drop the only implementation of this vfunc,
and stop using it. It isn't needed, and the
only implementation did the same thing GtkBuilder
does anyway.
2022-11-20 14:35:36 -05:00
Matthias Clasen
f0aefe2f7f stringlist: Add a construct-only strings property
This enables creating string lists in ui files
without using custom markup.

Related: #5350
2022-11-20 14:07:45 -05:00
Matthias Clasen
8f24072354 Merge branch 'center-box-props' into 'main'
centerbox: Add properties for child widgets

See merge request GNOME/gtk!5237
2022-11-20 18:25:12 +00:00
Matthias Clasen
8dc89ba3d8 centerbox: Add properties for child widgets
This provides and alternative to add children
in ui files.

Related: #5350
2022-11-20 12:54:31 -05:00
Matthias Clasen
b441c684ab gsk: Avoid a crash with negative scales
Don't crash when both scale_x and scale_y are -1.

A test is included.
2022-11-20 12:13:02 -05:00
Bilal Elmoussaoui
97d76417fa g-i: add missing array annotation to AlertDialog.(s|g)et_buttons 2022-11-19 14:33:19 +01:00
Matthias Clasen
ab530b9e5a Merge branch 'builder-parse-attributes' into 'main'
builder: Parse PangoAttrList values

See merge request GNOME/gtk!5228
2022-11-19 02:49:23 +00:00
Matthias Clasen
21a69e7107 Merge branch 'wip/carlosg/osk-activation' into 'main'
gtktext: Claim gesture more selectively

Closes #5351

See merge request GNOME/gtk!5230
2022-11-18 19:33:55 +00:00
Matthias Clasen
d45155364e Merge branch 'kjellahl/menubar' into 'main'
gtk_popover_menu_bar_set_menu_model(): Accept model == NULL

See merge request GNOME/gtk!5232
2022-11-18 19:33:37 +00:00
Matthias Clasen
4a71957c1f Merge branch 'shorter-im-context-ids' into 'main'
immmodule: Warn if GTK_IM_MODULE is bad

See merge request GNOME/gtk!5229
2022-11-18 19:33:17 +00:00
Matthias Clasen
e53c9e4832 Merge branch 'wayland-foreign-v2' into 'main'
wayland: Also support the v2 of the importer

See merge request GNOME/gtk!5231
2022-11-18 18:00:42 +00:00
Matthias Clasen
b3821b19b5 wayland: Also support the v2 of the importer
Commit 0ba8e16e14 added support for the export
part of zxdg_foreign_v2, but neglected that the importer
has a v2 as well. Support it.
2022-11-18 12:10:56 -05:00
Kjell Ahlstedt
8911015549 gtkpopovermenubar: Make model nullable
The description of gtk_popover_menu_bar_new_from_model() and
gtk_popover_menu_bar_set_menu_model() says that model is nullable.
Make it so.
2022-11-18 18:09:42 +01:00
Carlos Garnacho
f1168c5012 gdksurface: Do not consider GDK_TOUCH_END/CANCEL as popup-dismiss worthy
GDK_TOUCH_END deserves the same treatment than GDK_BUTTON_RELEASE, since it's
subject to the same circumstances (popping up a menu on long press would be
immediately dismissed on release if we handled them there). Ideally, we would
want to match releases that we obtained a press for while grabbed, but as
the popup is also dismissed on GDK_BUTTON_PRESS/GDK_TOUCH_BEGIN, there's no
use for this tracking.

And GDK_TOUCH_CANCEL sounds weird as a reason to dismiss popups, just like
crossing events would.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2512
2022-11-18 17:56:14 +01:00
Carlos Garnacho
ae54374a51 gtktext: Claim gesture more selectively
Even though button 1 (or touch down) presses do most often have
an effect in one way or another (starting drag, moving focus,
starting selection, ...), there is one situation that they do
immediately nothing: When clicking on the entry does not move
the text caret around. Dragging might start a selection, but
the entry did not do anything just yet, and an immediate
button/touch release should remain at "did nothing".

And that is precisely the hint that the Wayland IM context's click
gesture takes, clicks that do not scroll nor move the caret around,
having the GtkText not claim the gesture in that situation makes
the IM gesture able to do its thing without in-fighting.

This is typically not a problem when the GtkText is embedded in
another GtkEditable implementation (e.g. GtkEntry), since the
IM gesture is inactive and capturing from the parent widget, so
gets a pass that it otherwise doesn't get when both gestures are
in the same widget. This makes it work regardless of GtkText not
being a child of a composite widget, like NautilusQueryEditor
and AdwRowEntry.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5351
2022-11-18 17:56:14 +01:00
Matthias Clasen
64b8a8740f Merge branch 'wip/fix-tiling-without-gtk-shell' into 'main'
wayland/surface: Set the tiling state from xdg-shell too

See merge request GNOME/gtk!5227
2022-11-18 16:33:25 +00:00
Matthias Clasen
1f97714293 immodule: Accept 'simple' and 'none'
Everybody (including myself) gets this wrong,
so accept 'simple' and 'none' as shorthands
for the official IDs 'gtk-im-context-simple'
and 'gtk-im-context-none'.
2022-11-18 11:18:48 -05:00
Matthias Clasen
9af8c6fb25 immmodule: Warn if GTK_IM_MODULE is bad
If we don't find an immodule matching the
ids in the GTK_IM_MODULE envvar, print a
warning.
2022-11-18 11:18:48 -05:00
Matthias Clasen
9682085e09 builder: Parse PangoAttrList values
Allow specifying PangoAttrList properties in the
serialized format supported by pango_attr_list_to_string().

Test included.
2022-11-18 10:42:50 -05:00
Jonas Ådahl
07a59da6e4 wayland/surface: Set the tiling state from xdg-shell too
We plumbed it from the gtk-shell configure event, but didn't for the
equivalent state passed via xdg_toplevel.configure.
2022-11-18 13:11:25 +01:00
Matthias Clasen
dfbaeefc64 Merge branch 'matthiasc/for-main' into 'main'
gsk: Add an assertion to help static analysis

See merge request GNOME/gtk!5224
2022-11-18 05:22:44 +00:00
Matthias Clasen
9cbfbbdf39 stringsorter: Fix one case of collation handling
When not ignoring case, and not collating, we were
returning sort keys that were already freed. Oops.

Pointed out by clang.
2022-11-18 00:04:23 -05:00
Matthias Clasen
8c1a041104 gdk: Fix possible memory errors
clang complained that we may end up jumping
to the cleanup code without initializing data
in the jpeg code. Always initialize data to
NULL to prevent that eventuality.
2022-11-18 00:04:23 -05:00
Matthias Clasen
95fc5109bb composetable: Fix a memory leak
Pointed out by clang.
2022-11-18 00:04:23 -05:00
Matthias Clasen
ce57150203 gsk: Add an assertion to help static analysis
clang gets wild ideas about negative radii otherwise.
2022-11-18 00:04:23 -05:00
Matthias Clasen
203685a46a Merge branch 'matthiasc/for-main' into 'main'
Fix spelling errors

See merge request GNOME/gtk!5223
2022-11-18 04:56:57 +00:00
Matthias Clasen
ebe6d52252 Drop redundant glib version checks
We require GLib 2.72 now.
2022-11-17 22:49:56 -05:00
Matthias Clasen
60aaf38f39 gdk: Clean up gdkprivate.h
Move apis to more specific headers.
2022-11-17 22:49:56 -05:00
Matthias Clasen
2bab8cca5f gdk: Rename GDK_SURFACE_TEMP
We use this value only for drag surfaces, so call it that.
2022-11-17 22:49:56 -05:00
Matthias Clasen
b12d31d189 Fix spelling errors
These were pointed out by codespell.
2022-11-17 22:49:45 -05:00
Matthias Clasen
0d2161ee40 Merge branch 'file-dialog-portals' into 'main'
file dialog: Use portals

See merge request GNOME/gtk!5221
2022-11-18 03:49:30 +00:00
Matthias Clasen
cda06f375e Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Add some keywords

See merge request GNOME/gtk!5220
2022-11-17 20:53:51 +00:00
Matthias Clasen
b0148972fd filedialog: Use portals
We want this new API to be portal-first.
Make it so.
2022-11-17 15:52:53 -05:00
Matthias Clasen
ea3c58f0ec gtk-demo: Add folders to the clipboard demo
This is handy for testing a case where folder
dnd does not work with the file transfer portal.

See #5348
2022-11-17 06:31:09 -05:00
Matthias Clasen
af8ad1efe8 gtk-demo: Add some keywords
Make sure that dnd and drag-and-drop yield the right
(and the same) set of demos.
2022-11-17 05:50:34 -05:00
Matthias Clasen
12a50735da Merge branch 'ccook/doc-spelling-fixes' into 'main'
doc fix: various spelling mistakes corrected

See merge request GNOME/gtk!5215
2022-11-17 10:28:38 +00:00
Luca Bacci
7c62eaa528 Merge branch 'win32-hotspot' into 'main'
gdk/win32: fix cursor hotspot

See merge request GNOME/gtk!5216
2022-11-17 09:06:55 +00:00
Cam Cook
2a14753739 Merge branch 'main' into ccook/doc-spelling-fixes 2022-11-16 23:23:42 -05:00
Cam Cook
4ccc3b53eb doc/spelling changes: gtkselectionmodel.c, 'call this when the* selection changes' 2022-11-16 23:20:50 -05:00
Matthias Clasen
793954055e Merge branch 'radioactiveman-main-patch-52462' into 'main'
label: Fix markup doc example

See merge request GNOME/gtk!5201
2022-11-17 03:46:43 +00:00
Thomas Lange
7adf720f08 label: Fix markup doc example 2022-11-17 03:46:01 +00:00
Emmanuele Bassi
dc168767b0 Merge branch 'ebassi/list-doc-links' into 'main'
docs: Add links to the list widgets table

See merge request GNOME/gtk!5210
2022-11-16 21:51:59 +00:00
Matthias Clasen
501577196a Merge branch 'matthiasc/for-main' into 'main'
Inspector: Add a missing event type

See merge request GNOME/gtk!5218
2022-11-16 19:24:54 +00:00
Matthias Clasen
69d59d9b8b Merge branch 'filechooser-set-choice-fix' into 'main'
filechooser: Fix gtk_file_chooser_set_choice again

Closes #5346

See merge request GNOME/gtk!5219
2022-11-16 19:23:05 +00:00
robxnano
adc0264dac filechooser: Fix gtk_file_chooser_set_choice again
If the choice was in the form of a GtkDropDown, the code failed to
find the widget and so the choice never got set. Fixes #5346.
2022-11-16 18:07:20 +00:00
Marc-André Lureau
437a359f1b gdk/win32: fix cursor hotspot
This seems to be a regression from commit c06b1cc103 "Win32: Re-work cursor handling".

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-11-16 11:50:56 +04:00
Matthias Clasen
4eb017904b Alertdialog: Cosmetics 2022-11-15 10:36:32 +00:00
Matthias Clasen
5aeb6c31c0 events: Drop an unused variable 2022-11-15 10:26:25 +00:00
Matthias Clasen
c9df9978d2 Inspector: Add a missing event type
We did not have a name for the new touchpad hold
events.

To prevent this from happening again in the future,
add a static assertion.
2022-11-15 07:18:41 +01:00
Cam Cook
d1bb927286 Documentation fix: Various spelling mistakes (and one use of the wrong verb) across a few domains that show up in documentation.
| domain | current | suggestion |
|--------|---------|------------|
| [GtkButton](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkbutton.c#L691)       | "Buttons can has a flat appearance" | "Buttons can have a flat appearance" |
| [GtkCenterBox](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkcenterbox.c#L275) | "pas %NULL" | "pass %NULL" |
| [GtkEditable](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkeditable.c#L466)   | "the text to append" | "the text to insert" |
| [GtkFlowbox](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkflowbox.c#L4921)    | "the are equal" | "they are equal" |
| [GtkSelectionModel](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkselectionmodel.c#L550) | "Call this when a the selection changes" | "Call this when a selection changes" |
| [GtkWIndow](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkwindow.c#L5321)                | "(e.g. the user or the window manager" | "(e.g. the user or the window manager)" |
2022-11-13 11:55:05 -05:00
Emmanuele Bassi
bd66198b88 docs: Add more links to the list widgets description 2022-11-11 11:30:41 +00:00
Emmanuele Bassi
5193846787 docs: Add links to the list widgets table
Make it easier for readers to go to the appropriate replacement for the
old GtkTreeView-and-friends API.
2022-11-11 11:21:17 +00:00
Matthias Clasen
2daea9e459 Merge branch 'focus-no-parent' into 'main'
focus: fall back to old behaviour if we didn't focus anything

See merge request GNOME/gtk!5189
2022-11-11 10:29:00 +00:00
Matthias Clasen
2d48793641 Merge branch 'docs-update' into 'main'
docs: Update Common Questions section on list views

See merge request GNOME/gtk!5209
2022-11-11 10:28:11 +00:00
Arjan Molenaar
920f49e993 Fix typo in 4 to 5 migration page 2022-11-10 22:41:26 +01:00
Arjan Molenaar
29d7f93e38 Update Common Questions section on tree views
Point users to GtkListView instead of the
deprecated GtkTreeView.
2022-11-10 22:41:26 +01:00
Matthias Clasen
df5a13806d Merge branch 'gdkwaylandtoplevel' into 'main'
gdk/wayland/surface: Move more members to `GdkWaylandPopup` and `GdkWaylandToplevel`

See merge request GNOME/gtk!4227
2022-11-10 13:58:24 +00:00
Luca Bacci
aebbf7cc61 Merge branch 'win32-inhibit' into 'main'
gdk-win32: implement basic inhibit-system-shortcuts

See merge request GNOME/gtk!5206
2022-11-10 11:18:23 +00:00
Luca Bacci
26c524a578 GdkWin32: Do not use MA_NOACTIVATEANDEAT
GTK knows when a surface is modally blocked and automatically drops
button press and release events, so do not block input in advance
from WM_MOUSEACTIVATE.
2022-11-10 09:27:24 +01:00
Matthias Clasen
fc8ef02bb5 Merge branch 'export-handle-refactor' into 'main'
Refactor surface handle export

See merge request GNOME/gtk!5205
2022-11-10 08:00:07 +00:00
Marc-André Lureau
cf04a3c99d gdk-win32: implement basic inhibit-system-shortcuts
This is largely adapted from commit 83027c68f1 ("11: Implement
inhibit_system_shortcuts API"), with similar rationale:

    To implement the inhibit_system_shortcuts API on X11, we emulate the
    same behavior using grabs on the keyboard.

    To avoid keeping active grabs on the keyboard that would affect
    other X11 applications even when the surface isn't focused, the X11
    implementation takes care of releasing the grabs as soon as the
    toplevel loses focus.

Note that Windows has low-level keyboard hooks that could help achieve
the expected behaviour. This is implemented by spice-gtk & gtk-vnc for
example, but correctness isn't obvious. I left a TODO comment.

This patch helps implementing remote desktop widgets with GTK4, since
currently on win32 backend Alt-Tab and such are always left to the
system unless there is keyboard grab (which can't be requested by the
client API anymore, afaict).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-11-09 19:29:03 +04:00
Matthias Clasen
43d6682e45 wayland: Reimplement export_handle
Reimplement the backend API on top of the new async
calls.
2022-11-09 16:28:30 +01:00
Matthias Clasen
d1bdc36331 window: fixups 2022-11-09 16:28:30 +01:00
Matthias Clasen
dcc3b638aa wayland: fixups 2022-11-09 16:28:30 +01:00
Matthias Clasen
4b40aeb0c6 wayland: Support the v2 protocol in both places
The old api should better support both versions of the
foreign protocol too.
2022-11-09 16:28:29 +01:00
Matthias Clasen
0ba8e16e14 wayland: Add zxdg_foreign_v2 protocol support 2022-11-09 16:28:29 +01:00
Matthias Clasen
f9982a61e6 window: Use gdk_toplevel_export_handle 2022-11-09 16:28:29 +01:00
Matthias Clasen
1c99ed542a Add gdk_toplevel_export_handle
This code is backend-specific, and should not live
in gtkwindow.c.
2022-11-09 16:28:29 +01:00
Marc-André Lureau
a92aea4c0e gdk-win32: fix unused variable warnings
../gdk/win32/gdksurface-win32.c: In function 'gdk_win32_get_window_size_and_position_from_client_rect':
../gdk/win32/gdksurface-win32.c:3753:20: warning: unused variable 'impl' [-Wunused-variable]
 3753 |   GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
      |                    ^~~~
../gdk/win32/gdksurface-win32.c: In function 'gdk_win32_surface_get_queued_window_rect':
../gdk/win32/gdksurface-win32.c:5129:20: warning: unused variable 'impl' [-Wunused-variable]
 5129 |   GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-11-09 19:19:44 +04:00
Matthias Clasen
956100017c Merge branch 'wayland_display_geometry' into 'main'
wayland: calculate union of geometry of all monitors for toplevel bounds

See merge request GNOME/gtk!4790
2022-11-08 16:29:15 +00:00
Matthias Clasen
514ec8942d Merge branch 'cursor-size' into 'main'
GtkSettings: Provide settings in logical pixels also on X11

Closes #5223 and #5230

See merge request GNOME/gtk!5172
2022-11-08 16:27:06 +00:00
Matthias Clasen
7caa211d6a Merge branch 'wip/carlosg/back-forward-mask' into 'main'
gdk/wayland: Fix button mask calculation on button events

Closes #5301

See merge request GNOME/gtk!5191
2022-11-08 16:14:18 +00:00
Matthias Clasen
cb7b57635b Merge branch 'add-link-to-docs' into 'main'
Link the file mentioned as a reference for key values

See merge request GNOME/gtk!5198
2022-11-08 16:05:59 +00:00
Matthias Clasen
9e28a407df Merge branch 'ebassi/since-for-main' into 'main'
docs: Add deprecation notices for properties

See merge request GNOME/gtk!5204
2022-11-08 16:01:11 +00:00
Matthias Clasen
a5780beba7 Merge branch 'ccook/gtk_aspect_frame_doc_fix' into 'main'
doc/comment fix: @self misspelled as self@

See merge request GNOME/gtk!5200
2022-11-08 15:28:08 +00:00
Matthias Clasen
304f1e43af Merge branch 'matthiasc/for-main' into 'main'
Add new printf patterns to make-pot

See merge request GNOME/gtk!5188
2022-11-08 15:23:03 +00:00
Emmanuele Bassi
5a51cbe673 docs: Add deprecation notices for properties 2022-11-08 10:45:09 +00:00
Matthias Clasen
901c968b97 Merge branch 'fix-color-dialog-button-new' into 'main'
colordialogbutton: Actually accept NULL

Closes #5321

See merge request GNOME/gtk!5202
2022-11-07 14:51:34 +00:00
Matthias Clasen
2c6ac137a3 gtk-demo: Improve language handlng
In the font features demo, don't add a
item for the default language to the dropdown,
that does not make sense.
2022-11-07 15:42:38 +01:00
Matthias Clasen
5bd264d532 gtk-demo: Add a few mssing language names 2022-11-07 15:42:38 +01:00
Matthias Clasen
e908a117a9 gtk4-demo: Tweak the pickers demo
Redo the file picker a bit.
2022-11-07 15:42:38 +01:00
Matthias Clasen
14a97accf1 po: Match make-pot
We are not normally using the gtk40-pot target to
generate the gtk40.pot file. On the off chance that
somebody does, lets make sure we pass the same
arguments to xgettext here as in the make-pot script
that is used on damn lies.
2022-11-07 15:42:38 +01:00
Matthias Clasen
e619d45ddc Add a test for picker button constructors
This turns out to be hard enough that a test
is useful.
2022-11-07 15:32:51 +01:00
Matthias Clasen
e00b96053b colordialogbutton: Actually accept NULL
As pointed out in #5321, my previous fix was not
good enough.

Fixes: #5321
2022-11-07 15:24:13 +01:00
Colin Kinloch
293b91e515 wayland: calculate union of geometry of all monitors for toplevel bounds
Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
2022-11-07 11:08:18 +00:00
Cam Cook
ed16946685 doc/comment fix: the ref to @self was misspelled as self@ for gtkaspectframe.h/gtk_aspect_frame_get_child
Noticed this while reviewing the gi-docgen docs for GtkAspectFrame while developing some java bindings.
It's my understanding that @self was intended; as it would cause gi-docgen to interpret it as a reference to
the the GtkAspectFrame pointer named 'self'.
2022-11-06 17:59:23 -05:00
Matthias Clasen
18ee4d97fc Merge branch 'fix-color-button-new' into 'main'
color/fontdialogbutton: Fix constructors

Closes #5321

See merge request GNOME/gtk!5199
2022-11-06 13:36:49 +00:00
Matthias Clasen
466db31aac color/fontdialogbutton: Fix constructors
The arguments were meant to be nullable.
Make it so!

Fixes: #5321
2022-11-06 14:12:02 +01:00
Pedro Sader Azevedo
32e138689e Link the file mentioned as a reference for key values 2022-11-06 01:54:38 +00:00
Balázs Úr
06409cf18f Update Hungarian translation 2022-11-05 22:21:06 +00:00
Goran Vidović
0041329f4d Update Croatian translation 2022-11-05 18:55:57 +00:00
Matthias Clasen
d1c943153c Merge branch 'make-pot-update' into 'main'
Add new printf patterns to make-pot

See merge request GNOME/gtk!5197
2022-11-05 10:50:51 +00:00
Matthias Clasen
baac6ef871 Add new printf patterns to make-pot
This script is used to extract our strings for translators
on damn lines, and passing these flags to xgettext makes
it put a hint into the pot file about strings that are
used as printf format strings.
2022-11-05 11:23:53 +01:00
Luca Bacci
b209e5117d Merge branch 'gdk-win32-settings-rework' into 'main'
GdkWin32 settings rework

See merge request GNOME/gtk!5193
2022-11-04 16:00:25 +00:00
Luca Bacci
440929daea GdkWin32: Add more GDK_NOTE calls for settings 2022-11-04 16:11:27 +01:00
Luca Bacci
1506de5669 GdkWin32: Set the "gtk-hint-font-metrics" property
Helps for https://gitlab.gnome.org/GNOME/gtk/-/issues/5257
2022-11-04 16:03:11 +01:00
Luca Bacci
41f9f1d623 GdkWin32: Set the "gtk-cursor-blink" setting 2022-11-04 15:57:25 +01:00
Luca Bacci
24047d7f61 GdkWin32: Set the "gtk-cursor-theme-size" setting
Note that we have to set the logical value, that's why
we use GetSystemMetrics and not GetSystemMetricsForDpi.
2022-11-04 15:56:20 +01:00
Luca Bacci
45681c4fe5 GdkWin32: Detect the high contrast setting
And set the theme name accordingly ("Default-hc")
2022-11-04 15:54:02 +01:00
Luca Bacci
95c121b6d6 GdkWin32: Fix leak of screen HDC 2022-11-04 15:41:11 +01:00
Luca Bacci
6b569afdfe GdkWin32: Remove special-casing for old Pango versions
We require Pango 1.50 now
2022-11-04 15:35:04 +01:00
Luca Bacci
429017ad16 GdkWin32: Remove old code 2022-11-04 15:31:40 +01:00
Luca Bacci
fe1d86f23c GdkWin32: Sort settings alphabetically 2022-11-04 15:30:12 +01:00
Adam Williamson
e07f8ef506 focus: fall back to old behaviour if we didn't focus anything
8455b9ac74 seems to have introduced a problem where we can wind
up focusing no widget at all if the `while (parent)` loop doesn't
find a widget it can successfully move the focus to. This 'fixes'
that by falling back to doing the previous thing if we make it
all the way through that loop without moving the focus. Thanks to
@coreyberla for a hint to improve the implementation.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2022-11-02 09:32:32 -07:00
Carlos Garnacho
ece28bea74 gdk/wayland: Fix button mask calculation on button events
There's 2 things broken here:
- The mask was calculated on top of the GDK button (i.e. skipping
  4-7 buttons), so GDK_BUTTON4_MASK and GDK_BUTTON5_MASK were not
  assigned. This is now calculated on the (continuous) BTN_ evcodes
  so it is guaranteed that the next 2 physical buttons (i.e.
  back/forward) get these two places in the mask assigned.
- Furthermore, these buttons would be pushed to places in the
  modifier mask that they didn't belong to. It is now checked hard
  that only the first 5 buttons enable a modifier flag.

Overall, this ensures that no event masks with bonkers values are
forwarded, and that no stale implicit grabs are left after additional
buttons are pressed.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5301
2022-11-02 17:17:43 +01:00
Sabri Ünal
a272887c34 Update Turkish translation 2022-11-02 06:06:38 +00:00
Nathan Follens
c4c9a44d7a Update Dutch translation
(cherry picked from commit 381c056070)
2022-11-01 23:10:53 +00:00
Luca Bacci
ac60bc6095 X11: Provide settings in logical pixels
This makes GtkSettings values on X11 match what we get on
other backends.

Reporting size settings in logical pixels (i.e for scale
== 1) is useful for properly supporting mixed-DPI setups.
As X11 doesn't support mixed-DPI setups anyway, XSettings
doesn't bother providing logical values. Thus we scale
from physical to logical values ourselves.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5223
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5230
2022-11-01 13:09:28 +01:00
Matthias Clasen
9c5ba5544e Post-release version bump 2022-10-31 22:22:06 -04:00
Matthias Clasen
0af8d7cf06 4.9.1 2022-10-31 22:07:15 -04:00
Matthias Clasen
fcf00391b4 Merge branch 'matthiasc/for-main' into 'main'
Revert "modules: Fix build on Visual Studio"

See merge request GNOME/gtk!5187
2022-11-01 01:09:51 +00:00
Matthias Clasen
16b95939f9 gdk: Bump the jpeg malloc limit
Bump the limit for memory use during jpeg loading
to 1GB, matching what gdk-pixbuf has for this.
2022-10-31 20:35:15 -04:00
Matthias Clasen
0a6f3944a0 Revert "modules: Fix build on Visual Studio"
This reverts commit acd9c12667.

This commit breaks the build with GLib main on all platforms,
and defining _GLIB_EXTERN arguably invades the GLib namespace.

A different fix for msvc will have to be found.
2022-10-31 20:20:32 -04:00
Matthias Clasen
1a8ff606f2 Merge branch 'matthiasc/for-main' into 'main'
Be consistent in preconditions for async API

See merge request GNOME/gtk!5186
2022-10-31 21:15:10 +00:00
Matthias Clasen
030e8c0bf9 Be consistent in preconditions for async API
Do the same checks in all our finish functions.
2022-10-31 16:40:54 -04:00
Aleksandr Melman
4b29972d31 Update Russian translation 2022-10-31 12:30:25 +00:00
Matthias Clasen
d1bff928f6 Merge branch 'ebassi/since-for-main' into 'main'
Ebassi/since for main

See merge request GNOME/gtk!5185
2022-10-30 23:22:19 +00:00
Emmanuele Bassi
d665b0e042 docs: Add missing Deprecated annotations 2022-10-30 20:08:39 +00:00
Emmanuele Bassi
37fadb20a9 docs: Add missing Since annotations 2022-10-30 20:08:21 +00:00
Matthias Clasen
1c3f179a20 Merge branch 'matthiasc/for-main' into 'main'
alertdialog: Small refactoring

See merge request GNOME/gtk!5184
2022-10-30 13:29:35 +00:00
Matthias Clasen
5cb84afaa9 Add a test for POTFILES.in
Add a test that runs make-pot. This will only pass
if you've updated po/POTFILES.in and .skip after
moving source files around.

Unfortunately, it won't catch new source files that
are missing.
2022-10-30 08:52:02 -04:00
Matthias Clasen
a36bf22134 alertdialog: Small refactoring
Move the deprecated code out into its own function.
2022-10-30 08:52:02 -04:00
Piotr Drąg
8ef8514036 Update POTFILES.in 2022-10-30 12:34:21 +01:00
Matthias Clasen
c1b1e96a9a Merge branch 'deprecate-gtkdialog2' into 'main'
Deprecate GtkDialog

See merge request GNOME/gtk!5182
2022-10-29 20:39:18 +00:00
Matthias Clasen
9948053cd7 Deprecate GtkDialog
GtkDialog is too flexible in terms of UI (headerbars vs action bar,
etc), and has archaic APIs. It is time to retire it.
2022-10-29 15:27:53 -04:00
Matthias Clasen
f1af8046d0 Merge branch 'matthiasc/for-main' into 'main'
Docs updates

See merge request GNOME/gtk!5180
2022-10-29 19:22:50 +00:00
Matthias Clasen
8324a93c73 Update docs
Mention new deprecations in the future migration guide.
2022-10-29 14:14:59 -04:00
Matthias Clasen
251dcc2f86 Merge branch 'async-dialog-api2' into 'main'
Add new async APIs to replace chooser dialogs

See merge request GNOME/gtk!5174
2022-10-29 17:52:13 +00:00
Matthias Clasen
2ca168d680 NEWS: Updates 2022-10-29 13:31:41 -04:00
Matthias Clasen
f54ab91ff3 Deprecate GtkFileChooser and implementations
These are being replaced by GtkFileDialog.

This commit only moves the headers for GtkFileChooserWidget and
GtkFileChooserDialog to deprecated/, and keeps the implementations
in gtk/, since they will eventually be salvaged into a private
GtkFileChooserWindow.
2022-10-29 13:31:41 -04:00
Matthias Clasen
66b062a976 Deprecate GtkMessageDialog
It is getting replaced by GtkAlertDialog

This commit only moves the header to deprecated/,
and keeps the implementation in gtk/, since it will
eventually be salvaged into a private, dialog-free
widget.
2022-10-29 13:31:41 -04:00
Matthias Clasen
15572b0183 Deprecate GtkFontChooser and implementations
These are being replaced by GtkFontDialog
and GtkFontDialogButton

This commit only moves the headers for GtkFontChooserWidget and
GtkFontChooserDialog to deprecated/, and keeps the implementations
in gtk/, since they will eventually be salvaged into a private
GtkFontChooserWindow.
2022-10-29 13:31:41 -04:00
Matthias Clasen
a51a6a3ee2 Deprecate GtkColorChooser and implementations
These are being replaced by GtkColorDialog
and GtkColorDialogButton.

This commit only moves the headers for GtkColorChooserWidget
and GtkColorChooserDialog to deprecated/, and keeps the
implementations in gtk/, since they will eventually be
salvaged into a private GtkColorChooserWindow.
2022-10-29 13:31:41 -04:00
Matthias Clasen
8bee62dd36 examples: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
4248380538 print-editor: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
e7de4c1f99 node-editor: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
d620197ae1 constraint-editor: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
ad2552ee43 widget-factory: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
756888a53d gtk-demo: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
99e1643cdd gtk-demo: Rewrite the pickers demo
This needs some more work. For now, just have
very simple test cases for some of the new async
APIs.
2022-10-29 13:31:41 -04:00
Matthias Clasen
9839aca0bd inspector: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
9ab732ce2d gtk: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
6ed2d2b232 Add GtkFileDialog
Add an async API for picking a file, together with
a builder object for it. This is meant to replace direct
use of GtkFileChooserDialog.
2022-10-29 13:31:41 -04:00
Matthias Clasen
cccc74786f Add GtkAlertDialog
This is replacing GtkMessageDialog with an
async API for showing informational messages.
2022-10-29 13:31:41 -04:00
Matthias Clasen
aeacc8f3c5 Add GtkFontDialogButton
This is like GtkColorDialogButton, but for fonts.
2022-10-29 13:31:41 -04:00
Matthias Clasen
7d0ebe02db Add GtkFontDialog
This is similar to GtkColorDialog, but for fonts.
2022-10-29 13:31:41 -04:00
Matthias Clasen
655675e6a1 Add GtkColorDialogButton
This is a new color button implementation
built around GtkColorDialog.
2022-10-29 13:02:15 -04:00
Matthias Clasen
f877f33c19 Add GtkColorDialog
Add an async API for picking a color, together with
a builder object for it. This is meant to replace direct
use of GtkColorChooserDialog.
2022-10-29 10:18:37 -04:00
Matthias Clasen
2fce117d15 Add GtkDialogError
This error domain will be used by async apis
in future commits.
2022-10-29 10:18:37 -04:00
Matthias Clasen
bd5dedce12 fontchooser: Add a way to set a GtkFilter
We keep this private, since the chooser apis
are going away. This will be used in GtkFontDialog.
2022-10-29 10:18:37 -04:00
Matthias Clasen
bdc91c2339 messagedialog: Cosmetics 2022-10-28 22:23:04 -04:00
Matthias Clasen
8be7515610 Merge branch 'matthiasc/for-main' into 'main'
ci: Try to fix the macos build

See merge request GNOME/gtk!5179
2022-10-29 02:08:19 +00:00
Matthias Clasen
2cef677aef ci: Require macos to build again 2022-10-28 21:39:13 -04:00
Matthias Clasen
a2e2673809 ci: Try to fix the macos build
It seems that libjpeg-turbo first finds nasm,
and then doesn't find it. Turn off simd to keep
it from looking for it in the first place.
2022-10-28 21:07:58 -04:00
Matthias Clasen
2c844e961f Merge branch 'matthiasc/for-main' into 'main'
printeroptionwidget: Drop unused include

See merge request GNOME/gtk!5178
2022-10-28 23:41:03 +00:00
Matthias Clasen
5c9d68a550 printeroptionwidget: Drop unused include 2022-10-28 18:24:48 -04:00
Matthias Clasen
0248a7e43f Merge branch 'matthiasc/for-main' into 'main'
gtk4-demo: Avoid a critical from a11y code

See merge request GNOME/gtk!5177
2022-10-28 16:20:18 +00:00
Matthias Clasen
b972decf82 gtk4-demo: Avoid a critical from a11y code
Even though we want to be accessible,
we must not divide by zero.
2022-10-28 12:02:23 -04:00
Emmanuele Bassi
66ec091461 Merge branch 'bilelmoussaoui/file-chooser-gi' into 'main'
g-i: Add missing since annotation

See merge request GNOME/gtk!5175
2022-10-27 17:06:22 +00:00
Bilal Elmoussaoui
6ca33c639e g-i: Add missing since annotation 2022-10-27 15:38:14 +00:00
Matthias Clasen
a13a681910 Merge branch 'revert-9c919ffa462dd4511da0bfd19d36d2e15c51651b-main' into 'main'
Revert "treepopover: Do not propagate natural width of content"

See merge request GNOME/gtk!5171
2022-10-26 18:22:43 +00:00
Mat
f6eb84189f Revert "treepopover: Do not propagate natural width of content"
This reverts commit 9c919ffa46.
2022-10-26 13:58:10 +03:00
Hodong
30525835f3 Fix a typo 2022-10-25 19:40:30 +00:00
Matthias Clasen
114e2b607b Merge branch 'ebassi/glade-docs' into 'main'
docs: Remove mentions of Glade

See merge request GNOME/gtk!5168
2022-10-25 00:39:57 +00:00
Emmanuele Bassi
21bc2c5078 docs: Remove mentions of Glade
Glade does not support GTK4, so we should not link to it when discussing
developing GTK4 applications.
2022-10-24 20:11:50 +01:00
Aaron Erhardt
2fde4c9a5f Show a warning when a destroyed window is shown
Showing a destroyed window might cause an application to
behave in an unexpected manner. For example, showing a
dialog after it has been closed by the user might cause the
application to freeze. The warning will help developers to
track down the issue.

Signed-off-by: Aaron Erhardt <aaron.erhardt@t-online.de>
2022-10-16 14:24:27 +02:00
Ian Douglas Scott
dac7a4f6e7 gdk/wayland/surface: Remove SURFACE_IS_TOPLEVEL
Always defined to `TRUE`.
2022-09-26 14:26:18 -07:00
Ian Douglas Scott
3679207e09 gdk/wayland/surface: Move more members to GdkWaylandToplevel 2022-09-26 14:26:18 -07:00
Ian Douglas Scott
46d1d54f5a gdk/wayland/surface: Make gtk_surface related functions take toplevel
These are only used with `GdkWaylandToplevel`, so it should be a function
taking that, and ultimately move to that struct.
2022-09-26 14:26:18 -07:00
Ian Douglas Scott
3131c50b82 gdk/wayland/surface: Make some toplevel functions take GdkWaylandToplevel 2022-09-26 14:26:18 -07:00
Ian Douglas Scott
c2063a623a gdk/wayland/surface: Move some variables to GdkWaylandPopup 2022-09-26 14:26:16 -07:00
Ian Douglas Scott
3e267c3285 gdk/wayland/surface: Make popup functions take GdkWaylandPopup
This will allow them to use member variables from that struct.
Ultimately, `GdkWaylandPopup` should be moved to its own file.
2022-09-26 14:22:37 -07:00
Ian Douglas Scott
887da8f931 gdk/wayland/surface: Don't wrap gdk_wayland_surface_* for toplevel vfuncs
As far as I'm aware, these only exist with `gdk_wayland_surface_` names
for historical reasons, before these types were split.

This way, those functions will be able to access members of the
`GdkWaylandToplevel` struct. And it just saves a few lines of code.
2022-09-26 14:22:37 -07:00
Lukáš Tyrychtr
33e5d2c307 GtkShortcutsWindow: Allow a screen reader user to browse the available shortcuts
That required making the shortcuts focusable and with a meaningful
accessibility labels.
2022-09-21 15:34:17 +02:00
Hannes Müller
f23c124af2 Harmonize would_drop() replacement for g_log_writer_default_would_drop()
Reuse a better to read would_drop() from ./testsuite/reftests/gtk-reftest.c
in ./tools/gtk-builder-tool.c

Fixed wrong indentation in ./testsuite/reftests/gtk-reftest.c
2022-08-08 20:12:50 +02:00
Ondřej Míchal
818ca63d35 gdkdisplay: Document get_monitor_at_surface can return NULL
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5075
2022-08-01 12:54:13 +02:00
Maxim Zakharov
2290c2bb23 gdk/broadway: Implements modal hint for Broadway surface
Ensures modal window is raised above parent; does return focus to
parent window when transient child window is closed.

That solves problems with overlapped modal window and focus loss in
complex multi window UI.
2022-05-17 15:18:30 +10:00
Jason Francis
3fc7c97979 gtk: Set widget template children to NULL before destroy unref 2022-05-14 10:13:39 -04:00
Jens Georg
b9551a8952 Remove obsolete "or %NULL" documentation 2022-04-20 15:15:51 +02:00
Jens Georg
e600fcbcc5 widget: Mark format as nullable in activate_action
The doc and the code allow it to be NULL
2022-04-19 10:17:39 +02:00
vanadiae
b4b185d53d builder: Clarify default "swapped" value when "object" is set for signals
I encountered this issue where I casted user_data to my self type, but it
showed me they were actually swapped when I set the "object" signal attribute.
After checking the source code which confirms this, it is a good idea to
properly document that convenient behaviour.
2022-02-24 23:04:20 +01:00
Jami Kettunen
cfef21501c FileChooser: Sort directories before files by default
This imho is what most people[1][2] would expect to be the default in
modern times; considering this also cannot be "easily" configured
outside of the cli utilities gsettings or dconf it should just be the
default.

[1] https://superuser.com/questions/843615/gtk-3-14-file-chooser-folders-first
[2] https://askubuntu.com/questions/789505/can-i-choose-to-not-sort-directories-before-files-on-file-open-dialogs
2021-12-25 15:16:11 +02:00
2491 changed files with 247527 additions and 136130 deletions

2
.flake8 Normal file
View File

@@ -0,0 +1,2 @@
[flake8]
ignore = E501

1
.gitignore vendored
View File

@@ -1 +1,2 @@
/subprojects/*/
.flatpak-builder/

View File

@@ -22,29 +22,43 @@ stages:
# Common variables
variables:
COMMON_MESON_FLAGS: "-Dwerror=true -Dglib:werror=false -Dpango:werror=false -Dgtk-doc:werror=false -Dwayland-protocols:werror=false -Dsysprof:werror=false -Dwayland:werror=false"
COMMON_MESON_FLAGS: "-Dwerror=true -Dcairo:werror=false -Dgi-docgen:werror=false -Dgraphene:werror=false -Dlibepoxy:werror=false -Dlibsass:werror=false -Dpango:werror=false -Dsassc:werror=false -Dgdk-pixbuf:werror=false -Dglib:werror=false -Dlibcloudproviders:werror=false -Dlibpng:werror=false -Dlibtiff:werror=false -Dsysprof:werror=false -Dwayland-protocols:werror=false -Dharfbuzz:werror=false -Dfreetype2:werror=false -Dfontconfig:werror=false -Dfribidi:werror=false -Dlibffi:werror=false -Dlibjpeg-turbo:werror=false -Dmutest:werror=false -Dpixman:werror=false -Dproxy-libintl:werror=false"
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled -Dbuild-testsuite=true -Dintrospection=enabled"
MESON_TEST_TIMEOUT_MULTIPLIER: 3
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v38"
FLATPAK_IMAGE: "quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master"
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v48"
.only-default:
only:
- branches
except:
- tags
workflow:
rules:
# 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:
max: 2
when:
- 'runner_system_failure'
- 'stuck_or_timeout_failure'
- 'scheduler_failure'
- 'api_failure'
interruptible: true
style-check-diff:
extends: .only-default
image: $FEDORA_IMAGE
stage: check
allow_failure: true
when: manual
script:
- .gitlab-ci/run-style-check-diff.sh
.build-fedora-default:
extends: .only-default
image: $FEDORA_IMAGE
artifacts:
when: always
@@ -52,6 +66,7 @@ style-check-diff:
junit:
- "${CI_PROJECT_DIR}/_build/report-x11.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland_gles.xml"
- "${CI_PROJECT_DIR}/_build/report-broadway.xml"
name: "gtk-${CI_COMMIT_REF_NAME}"
paths:
@@ -63,16 +78,12 @@ style-check-diff:
- "${CI_PROJECT_DIR}/_build/testsuite/tools/output/*/*"
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*/*.png"
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*/*.syscap"
- "${CI_PROJECT_DIR}/_build/testsuite/headless/*/*.log"
- "${CI_PROJECT_DIR}/_build_hello/meson-logs"
cache:
key: "$CI_JOB_NAME"
paths:
- _ccache/
- subprojects/gdk-pixbuf/
- subprojects/glib/
- subprojects/graphene/
- subprojects/libepoxy/
- subprojects/pango/
fedora-x86_64:
extends: .build-fedora-default
@@ -82,19 +93,18 @@ fedora-x86_64:
EXTRA_MESON_FLAGS: "--buildtype=debug --default-library=both"
script:
- .gitlab-ci/show-info-linux.sh
- meson subprojects update
- mkdir _install
- meson --prefix=${CI_PROJECT_DIR}/_install
${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
- export PATH="$HOME/.local/bin:$PATH"
- meson subprojects download
- meson subprojects update --reset
- meson setup
${COMMON_MESON_FLAGS}
${EXTRA_MESON_FLAGS}
${BACKEND_FLAGS}
${FEATURE_FLAGS}
_build
- meson compile -C _build
- meson install -C _build
- PKG_CONFIG_PATH=${CI_PROJECT_DIR}/_install/lib64/pkgconfig:${CI_PROJECT_DIR}/_install/share/pkgconfig meson setup _build_hello examples/hello
- LD_LIBRARY_PATH=${CI_PROJECT_DIR}/_install/lib64 meson compile -C _build_hello
- .gitlab-ci/run-tests.sh _build x11
- .gitlab-ci/run-tests.sh _build wayland
- .gitlab-ci/run-tests.sh _build waylandgles
- .gitlab-ci/run-tests.sh _build broadway
- .gitlab-ci/run-tests.sh _build wayland_gles
release-build:
extends: .build-fedora-default
@@ -104,12 +114,43 @@ release-build:
EXTRA_MESON_FLAGS: "--buildtype=release"
script:
- .gitlab-ci/show-info-linux.sh
- meson subprojects update
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
- export PATH="$HOME/.local/bin:$PATH"
- meson subprojects download
- meson subprojects update --reset
- mkdir _install
- meson setup
--prefix=${CI_PROJECT_DIR}/_install
${COMMON_MESON_FLAGS}
${EXTRA_MESON_FLAGS}
${BACKEND_FLAGS}
${FEATURE_FLAGS}
_build
- ninja -C _build
- meson compile -C _build
- meson install -C _build
- PKG_CONFIG_PATH=${CI_PROJECT_DIR}/_install/lib64/pkgconfig:${CI_PROJECT_DIR}/_install/share/pkgconfig meson setup _build_hello examples/hello
- LD_LIBRARY_PATH=${CI_PROJECT_DIR}/_install/lib64 meson compile -C _build_hello
- .gitlab-ci/run-tests.sh _build x11
fedora-clang:
extends: .build-fedora-default
stage: build
needs: []
variables:
EXTRA_MESON_FLAGS: "--buildtype=release"
script:
- .gitlab-ci/show-info-linux.sh
- export PATH="$HOME/.local/bin:$PATH"
- export CC=clang
- meson subprojects download
- meson subprojects update --reset
- meson setup
${COMMON_MESON_FLAGS}
${EXTRA_MESON_FLAGS}
${BACKEND_FLAGS}
${FEATURE_FLAGS}
_build
- meson compile -C _build
fedora-mingw64:
extends: .build-fedora-default
stage: build
@@ -128,37 +169,14 @@ fedora-mingw64:
# mingw64-graphene (rawhide)
script:
- .gitlab-ci/show-info-linux.sh
- meson subprojects update
- mkdir _build && cd _build
- mingw64-meson -Dintrospection=disabled -Dgraphene:introspection=disabled
- ninja
installed-tests:
extends: .build-fedora-default
stage: build
needs: []
variables:
EXTRA_MESON_FLAGS: "--prefix=/usr --libdir=/usr/lib64 -Dinstall-tests=true"
G_TEST_ACCESSIBLE: 1
script:
- .gitlab-ci/show-info-linux.sh
- meson subprojects update
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} ${BACKEND_FLAGS} ${FEATURE_FLAGS}
_build
- ninja -C _build
- sudo ninja -C _build install
- dbus-run-session xvfb-run -a -s "-screen 0 1024x768x24"
gnome-desktop-testing-runner
--report-directory=_build/installed-tests-report/failed/
--parallel=0
gtk-4.0
artifacts:
paths:
- "_build/installed-tests-report/"
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=1.0
- meson subprojects download
- meson subprojects update --reset
- meson -Dintrospection=disabled -Dgraphene:introspection=disabled _build
- meson compile -C _build
.mingw-defaults:
extends: .only-default
stage: build
tags:
- win32-ps
@@ -187,41 +205,62 @@ msys2-mingw64:
paths:
- "${CI_PROJECT_DIR}/_build/gtkdll.tar.gz"
macos:
extends: .only-default
only:
- branches@GNOME/gtk
macos-x86_64:
rules:
# Do not run in forks as the runner is not available there.
- if: $CI_PROJECT_NAMESPACE == "GNOME"
stage: build
allow_failure: true
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==0.60.3
- 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 -Dx11-backend=false
- 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
-Dbuild-demos=false
-Dbuild-tests=false
-Dbuild-examples=false
-Dbuild-testsuite=false
_build
- ninja -C _build
- meson compile -C _build
artifacts:
when: always
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
vs2017-x64:
extends: .only-default
# TODO: Uncomment this when ready to merge.
#only:
# - branches@GNOME/gtk
# rules:
# - if: $CI_PROJECT_NAMESPACE == "GNOME"
stage: build
tags:
- win32-ps
@@ -234,7 +273,7 @@ vs2017-x64:
- "${CI_PROJECT_DIR}/_build/meson-logs"
.flatpak-defaults:
image: $FLATPAK_IMAGE
image: "quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master"
stage: flatpak
allow_failure: true
tags:
@@ -244,65 +283,67 @@ vs2017-x64:
- "${APPID}-dev.flatpak"
- 'repo.tar'
expire_in: 1 day
rules:
# Only build Flatpak bundles automatically on main
- if: $CI_COMMIT_BRANCH == "main"
- if: $CI_COMMIT_BRANCH != "main"
when: "manual"
script:
- bash -x ./.gitlab-ci/flatpak-build.sh "${APPID}"
# Manual jobs, for branches and MRs
.flatpak-manual:
extends: .flatpak-defaults
when: manual
# Only build Flatpak bundles automatically on main
.flatpak-main:
extends: .flatpak-defaults
only:
- main
flatpak-manual:demo:
extends: .flatpak-manual
flatpak:demo:
extends: '.flatpak-defaults'
needs: []
variables:
APPID: org.gtk.Demo4
flatpak-main:demo:
extends: .flatpak-main
flatpak:demo:aarch64:
extends: '.flatpak-defaults'
needs: []
tags:
- flatpak-aarch64
variables:
APPID: org.gtk.Demo4
flatpak-manual:widget-factory:
extends: .flatpak-manual
flatpak:widget-factory:
extends: '.flatpak-defaults'
needs: []
variables:
APPID: org.gtk.WidgetFactory4
flatpak-main:widget-factory:
extends: .flatpak-main
flatpak:widget-factory:aarch64:
extends: '.flatpak-defaults'
needs: []
tags:
- flatpak-aarch64
variables:
APPID: org.gtk.WidgetFactory4
flatpak-manual:icon-browser:
extends: .flatpak-manual
flatpak:icon-browser:
extends: '.flatpak-defaults'
needs: []
variables:
APPID: org.gtk.IconBrowser4
flatpak-main:icon-browser:
extends: .flatpak-main
flatpak:icon-browser:aarch64:
extends: '.flatpak-defaults'
needs: []
tags:
- flatpak-aarch64
variables:
APPID: org.gtk.IconBrowser4
flatpak-manual:node-editor:
extends: .flatpak-manual
flatpak:node-editor:
extends: '.flatpak-defaults'
needs: []
variables:
APPID: org.gtk.gtk4.NodeEditor
flatpak-main:node-editor:
extends: .flatpak-main
flatpak:node-editor:aarch64:
extends: '.flatpak-defaults'
needs: []
tags:
- flatpak-aarch64
variables:
APPID: org.gtk.gtk4.NodeEditor
@@ -311,23 +352,35 @@ flatpak-main:node-editor:
# https://gitlab.gnome.org/GNOME/Initiatives/-/wikis/DevOps-with-Flatpak
nightly demo:
extends: '.publish_nightly'
dependencies: ['flatpak-main:demo']
needs: ['flatpak-main:demo']
needs: ['flatpak:demo']
nightly demo aarch64:
extends: '.publish_nightly'
needs: ['flatpak:demo:aarch64']
nightly factory:
extends: '.publish_nightly'
dependencies: ['flatpak-main:widget-factory']
needs: ['flatpak-main:widget-factory']
needs: ['flatpak:widget-factory']
nightly factory aarch64:
extends: '.publish_nightly'
needs: ['flatpak:widget-factory:aarch64']
nightly icon-browser:
extends: '.publish_nightly'
dependencies: ['flatpak-main:icon-browser']
needs: ['flatpak-main:icon-browser']
needs: ['flatpak:icon-browser']
nightly icon-browser aarch64:
extends: '.publish_nightly'
needs: ['flatpak:icon-browser:aarch64']
nightly node-editor:
extends: '.publish_nightly'
dependencies: ['flatpak-main:node-editor']
needs: ['flatpak-main:node-editor']
needs: ['flatpak:node-editor']
nightly node-editor aarch64:
extends: '.publish_nightly'
needs: ['flatpak:node-editor:aarch64']
static-scan:
image: $FEDORA_IMAGE
@@ -336,15 +389,21 @@ static-scan:
variables:
EXTRA_MESON_FLAGS: "--buildtype=debug"
script:
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} _scan_build
- export PATH="$HOME/.local/bin:$PATH"
- meson setup
${COMMON_MESON_FLAGS}
${EXTRA_MESON_FLAGS}
${BACKEND_FLAGS}
${FEATURE_FLAGS}
_scan_build
- ninja -C _scan_build scan-build
artifacts:
paths:
- _scan_build/meson-logs
allow_failure: true
# Run tests with the address sanitizer. We need to turn off introspection,
# since it is incompatible with asan
# Run tests with the address sanitizer. We need to turn off introspection
# and f16c, since they are incompatible with asan
asan-build:
image: $FEDORA_IMAGE
tags: [ asan ]
@@ -352,22 +411,46 @@ asan-build:
needs: []
variables:
script:
- CC=clang meson --buildtype=debugoptimized -Db_sanitize=address -Db_lundef=false -Dintrospection=disabled _build
- export PATH="$HOME/.local/bin:$PATH"
- CC=clang meson setup
--buildtype=debugoptimized
-Db_sanitize=address
-Db_lundef=false
-Dbuild-demos=false
-Dbuild-tests=false
-Dbuild-examples=false
-Dintrospection=disabled
-Df16c=disabled
_build
- ninja -C _build
- .gitlab-ci/run-tests.sh _build wayland
- .gitlab-ci/run-tests.sh _build wayland_gles
- .gitlab-ci/run-tests.sh _build x11
artifacts:
when: always
paths:
- _build/meson-logs
allow_failure: true
- "${CI_PROJECT_DIR}/_build/meson-logs"
reference:
image: $FEDORA_IMAGE
stage: docs
needs: []
variables:
EXTRA_MESON_FLAGS: "--buildtype=release --force-fallback-for=gdk-pixbuf,pango"
script:
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS} -Dgtk_doc=true -Dgdk-pixbuf:gtk_doc=true -Dpango:gtk_doc=true _build
- export PATH="$HOME/.local/bin:$PATH"
- meson setup
${COMMON_MESON_FLAGS}
--buildtype=release
--force-fallback-for=gdk-pixbuf,pango
-Dintrospection=enabled
-Ddocumentation=true
-Dgtk_doc=true
-Dgdk-pixbuf:gtk_doc=true
-Dpango:gtk_doc=true
-Dbuild-demos=false
-Dbuild-examples=false
-Dbuild-tests=false
-Dbuild-testsuite=false
_build
- meson compile -C _build
- mkdir -p _reference/
- mv _build/docs/reference/gdk/gdk4/ _reference/gdk4/
@@ -390,9 +473,9 @@ reference:
publish-docs:
image: fedora:latest
stage: publish
interruptible: false
needs: ['reference']
script:
- "curl -X POST -F token=${PAGES_TRIGGER_TOKEN} -F ref=docs-gtk-org https://gitlab.gnome.org/api/v4/projects/665/trigger/pipeline"
only:
refs:
- main
rules:
- if: $CI_COMMIT_REF_NAME == "main"

View File

@@ -1,4 +1,4 @@
FROM fedora:36
FROM fedora:38
RUN dnf -y install \
adwaita-icon-theme \
@@ -18,7 +18,9 @@ RUN dnf -y install \
dejavu-sans-mono-fonts \
desktop-file-utils \
diffutils \
docbook-style-xsl \
elfutils-libelf-devel \
expat-devel \
fribidi-devel \
gcc \
gcc-c++ \
@@ -30,7 +32,8 @@ RUN dnf -y install \
glib2-static \
glibc-devel \
glibc-headers \
gnome-desktop-testing \
glslc \
gnupg2 \
gobject-introspection-devel \
graphene-devel \
graphviz \
@@ -71,18 +74,22 @@ RUN dnf -y install \
mesa-libEGL-devel \
mesa-libGLES-devel \
meson \
mutter \
ninja-build \
pango-devel \
pcre-devel \
pcre-static \
pipewire \
pipewire-gstreamer \
python3 \
python3-docutils \
python3-gobject \
python3-jinja2 \
python3-markdown \
python3-packaging \
python3-pip \
python3-pydbus \
python3-pygments \
python3-toml \
python3-typogrify \
python3-wheel \
redhat-rpm-config \
@@ -93,9 +100,8 @@ RUN dnf -y install \
weston \
weston-libs \
which \
wireplumber \
xorg-x11-server-Xvfb \
&& dnf install -y 'dnf-command(builddep)' \
&& dnf builddep -y wayland \
&& dnf clean all
# Enable sudo for wheel users

View File

@@ -20,10 +20,11 @@ flatpak build ${builddir} meson \
-Dx11-backend=true \
-Dwayland-backend=true \
-Dbuild-tests=false \
-Dbuild-testsuite=false \
-Dbuild-examples=false \
-Dintrospection=disabled \
-Ddemos=true \
-Dprofile=devel \
-Dbuild-demos=true \
-Ddemo-profile=devel \
_flatpak_build
flatpak build ${builddir} ninja -C _flatpak_build install

View File

@@ -23,6 +23,7 @@ push=0
list=0
print_help=0
no_login=0
no_cache=0
while (($# > 0)); do
case "${1%%=*}" in
@@ -34,6 +35,7 @@ while (($# > 0)); do
--base|-b) read_arg base "$@" || shift;;
--version|-v) read_arg base_version "$@" || shift;;
--no-login) no_login=1;;
--no-cache) no_cache=1;;
*) echo -e "\e[1;31mERROR\e[0m: Unknown option '$1'"; exit 1;;
esac
shift
@@ -103,11 +105,21 @@ TAG="${REGISTRY}/gnome/gtk/${base}:${base_version}"
if [ $build == 1 ]; then
echo -e "\e[1;32mBUILDING\e[0m: ${base} as ${TAG}"
${CMD} build \
${format} \
--build-arg HOST_USER_ID="$UID" \
--tag "${TAG}" \
--file "${base}.Dockerfile" .
if [ $no_cache == 0 ]; then
${CMD} build \
${format} \
--build-arg HOST_USER_ID="$UID" \
--tag "${TAG}" \
--file "${base}.Dockerfile" .
else
${CMD} build \
${format} \
--no-cache \
--build-arg HOST_USER_ID="$UID" \
--tag "${TAG}" \
--file "${base}.Dockerfile" .
fi
exit $?
fi
@@ -126,7 +138,8 @@ if [ $run == 1 ]; then
echo -e "\e[1;32mRUNNING\e[0m: ${base} as ${TAG}"
${CMD} run \
--rm \
--volume "$(pwd)/..:/home/user/app" \
--userns=keep-id \
--volume "$(pwd)/..:/home/user/app:rw,z" \
--workdir "/home/user/app" \
--tty \
--interactive "${TAG}" \

32
.gitlab-ci/run-single-test.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/sh
#
builddir=$1
suite=$2
unit=$3
echo "** builddir: ${builddir}"
echo "** suite: ${suite}"
echo "** unit: ${unit}"
export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
weston --backend=headless-backend.so --socket=wayland-5 --idle-time=0 &
compositor=$!
export WAYLAND_DISPLAY=wayland-5
meson test -C ${builddir} \
--print-errorlogs \
--setup=wayland \
--suite=${suite} \
--no-suite=failing \
--no-suite=flaky \
--no-suite=wayland_failing \
--no-suite=gsk-compare-broadway \
--verbose \
"${unit}"
exit_code=$?
kill ${compositor}
exit ${exit_code}

View File

@@ -6,19 +6,23 @@ set +e
srcdir=$( pwd )
builddir=$1
backend=$2
multiplier=${MESON_TEST_TIMEOUT_MULTIPLIER:-1}
# Ignore memory leaks lower in dependencies
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp:print_suppressions=0
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp:print_suppressions=0:detect_leaks=0:allocator_may_return_null=1
export G_SLICE=always-malloc
case "${backend}" in
x11)
xvfb-run -a -s "-screen 0 1024x768x24 -noreset" \
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--quiet \
--timeout-multiplier "${multiplier}" \
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=failing \
--no-suite=flaky \
--no-suite=gsk-compare-broadway
# Store the exit code for the CI run, but always
@@ -26,7 +30,7 @@ case "${backend}" in
exit_code=$?
;;
wayland)
wayland*)
export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
weston --backend=headless-backend.so --socket=wayland-5 --idle-time=0 &
@@ -34,31 +38,17 @@ case "${backend}" in
export WAYLAND_DISPLAY=wayland-5
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--quiet \
--timeout-multiplier "${multiplier}" \
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=failing \
--no-suite=flaky \
--no-suite=${backend}_failing \
--no-suite=gsk-compare-broadway
exit_code=$?
kill ${compositor}
;;
waylandgles)
export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
weston --backend=headless-backend.so --socket=wayland-6 --idle-time=0 &
compositor=$!
export WAYLAND_DISPLAY=wayland-6
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=gsk-compare-broadway
exit_code=$?
kill ${compositor}
;;
@@ -70,14 +60,15 @@ case "${backend}" in
export BROADWAY_DISPLAY=:5
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--quiet \
--timeout-multiplier "${multiplier}" \
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=failing \
--no-suite=flaky \
--no-suite=gsk-compare-opengl
# don't let Broadway failures fail the run, for now
exit_code=0
kill ${server}
;;
@@ -91,17 +82,18 @@ esac
cd ${builddir}
$srcdir/.gitlab-ci/meson-junit-report.py \
--project-name=gtk \
--backend=${backend} \
--job-id="${CI_JOB_NAME}" \
--output=report-${backend}.xml \
meson-logs/testlog-${backend}.json
--project-name=gtk \
--backend="${backend}" \
--job-id="${CI_JOB_NAME}" \
--output="report-${backend}.xml" \
"meson-logs/testlog-${backend}.json"
$srcdir/.gitlab-ci/meson-html-report.py \
--project-name=gtk \
--backend=${backend} \
--job-id="${CI_JOB_NAME}" \
--reftest-output-dir="testsuite/reftests/output/${backend}" \
--output=report-${backend}.html \
meson-logs/testlog-${backend}.json
--project-name=gtk \
--backend="${backend}" \
--job-id="${CI_JOB_NAME}" \
--reftest-output-dir="testsuite/reftests/output/${backend}" \
--output="report-${backend}.html" \
"meson-logs/testlog-${backend}.json"
exit $exit_code

View File

@@ -5,8 +5,8 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliar
@echo on
:: FIXME: make warnings fatal
pip3 install --upgrade --user meson==0.60.3 || goto :error
meson -Ddebug=false -Dmedia-gstreamer=disabled _build || goto :error
pip3 install --upgrade --user meson~=0.64 || goto :error
meson setup -Dbackend_max_links=1 -Ddebug=false -Dmedia-gstreamer=disabled _build || goto :error
ninja -C _build || goto :error
goto :EOF

View File

@@ -32,7 +32,8 @@ pacman --noconfirm -S --needed \
mingw-w64-$MSYS2_ARCH-fribidi \
mingw-w64-$MSYS2_ARCH-gst-plugins-bad-libs \
mingw-w64-$MSYS2_ARCH-shared-mime-info \
mingw-w64-$MSYS2_ARCH-python-gobject
mingw-w64-$MSYS2_ARCH-python-gobject \
mingw-w64-$MSYS2_ARCH-shaderc
mkdir -p _ccache
export CCACHE_BASEDIR="$(pwd)"

45
AUTHORS
View File

@@ -7,7 +7,7 @@ Peter Mattis <petm@xcf.berkeley.edu>
Spencer Kimball <spencer@xcf.berkeley.edu>
Josh MacDonald <jmacd@xcf.berkeley.edu>
The Team that build GTK 2 (in alphabetical order)
The team that build GTK 2 (in alphabetical order)
-------------------------------------------------
Shawn T. Amundson <amundson@gtk.org>
Jerome Bolliet <bolliet@gtk.org>
@@ -28,9 +28,8 @@ Jay Painter <jpaint@gtk.org>
Manish Singh <manish@gtk.org>
Owen Taylor <otaylor@gtk.org>
The current team (GTK 3 and 4)
------------------------------
The team that built GTK 3
-------------------------
Jonas Ådahl <jadahl@gmail.com>
Tim Bäder <mail@baedert.org>
Emmanuele Bassi <ebassi@gnome.org>
@@ -40,6 +39,16 @@ Carlos Garnacho <mrgarnacho@gmail.com>
Alexander Larsson <alexl@redhat.com>
Benjamin Otte <otte@gnome.org>
The current team (GTK 4)
------------------------
Jonas Ådahl <jadahl@gmail.com>
Emmanuele Bassi <ebassi@gnome.org>
Christian Hergert <chergert@gnome.org>
Chun-wei Fan <fanchunwei@src.gnome.org>
Matthias Clasen <mclasen@redhat.com>
Carlos Garnacho <mrgarnacho@gmail.com>
Benjamin Otte <otte@gnome.org>
There are many others who have contributed patches; we thank them,
GTK is much better because of them.
@@ -49,35 +58,15 @@ Over time, GTK has incorporated some pieces of software which
started as independent projects. We list the original authors here:
MS-Windows theme engine
-----------------------
Raymond Penners
Dom Lachowicz
Pixbuf theme engine
-------------------
Owen Taylor
IME input method
----------------
Takuro Ashie
Kazuki IWAMOTO
Mac OS X backend
----------------
MacOS backend
-------------
Anders Carlsson
DirectFB backend
----------------
Denis Oliver Kropp
Sven Neumann
Mike Emmel
gtkparasite
-----------
GtkInspector (originally gtkparasite)
-------------------------------------
Christian Hammond

View File

@@ -21,7 +21,7 @@ many things that we value:
Please, do not use the issue tracker for support questions. If you have
questions on how to use GTK effectively, you can use:
- the `#gtk` IRC channel on irc.gnome.org
- the `gtk` [room on matrix](https://matrix.to/#/#gtk:gnome.org)
- the [gtk tag on the GNOME Discourse instance](https://discourse.gnome.org/tag/gtk)
You can also look at the GTK tag on [Stack
@@ -44,6 +44,7 @@ If you're reporting a bug make sure to list:
0. which version of GTK are you using?
0. which operating system are you using?
0. what display and graphics driver are you using?
0. the necessary steps to reproduce the issue
0. the expected outcome
0. a description of the behavior; screenshots are also welcome
@@ -213,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:

1004
NEWS

File diff suppressed because it is too large Load Diff

View File

@@ -67,6 +67,13 @@ building for:
- [Graphene](https://github.com/ebassi/graphene)
- [Xkb-common](https://github.com/xkbcommon/libxkbcommon)
If you are building the Wayland backend, you will also need:
- Wayland-client
- Wayland-protocols
- Wayland-cursor
- Wayland-EGL
If you are building the X11 backend, you will also need:
- Xlib, and the following X extensions:
@@ -79,32 +86,24 @@ If you are building the X11 backend, you will also need:
- xdamage
- xcomposite
If you are building the Wayland backend, you will also need:
- Wayland-client
- Wayland-protocols
- Wayland-cursor
- Wayland-EGL
Once you have all the necessary dependencies, you can build GTK by using
Meson:
```sh
$ meson _build .
$ cd _build
$ ninja
$ meson setup _build
$ meson compile -C_build
```
You can run the test suite using:
```sh
$ meson test
$ meson test -C_build
```
And, finally, you can install GTK using:
```
$ sudo ninja install
$ sudo meson install -C_build
```
Complete information about installing GTK and related libraries
@@ -116,19 +115,12 @@ docs/reference/gtk/html/gtk-building.html
Or [online](https://docs.gtk.org/gtk4/building.html)
Default branch renamed to `main`
--------------------------------
Building from git
-----------------
The default development branch of GTK has been renamed to `main`.
To update your local checkout, use:
```sh
git checkout master
git branch -m master main
git fetch
git branch --unset-upstream
git branch -u origin/main
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main
```
The GTK sources are hosted on [gitlab.gnome.org](http://gitlab.gnome.org). The main
development branch is called `main`, and stable branches are named after their minor
version, for example `gtk-4-10`.
How to report bugs
------------------

View File

@@ -187,7 +187,7 @@
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Dprofile=devel"
"-Ddemo-profile=devel"
],
"sources" : [
{

View File

@@ -116,7 +116,7 @@
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Dprofile=devel"
"-Ddemo-profile=devel"
],
"sources" : [
{

View File

@@ -116,7 +116,7 @@
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Dprofile=devel"
"-Ddemo-profile=devel"
],
"sources" : [
{

View File

@@ -116,7 +116,7 @@
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Dprofile=devel"
"-Ddemo-profile=devel"
],
"sources" : [
{

View File

@@ -0,0 +1,201 @@
#!/usr/bin/env python3
#
# SPDX-FileCopyrightText: 2022 Collabora Inc.
# 2023 Emmanuele Bassi
#
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# Original author: Xavier Claessens <xclaesse@gmail.com>
import argparse
import textwrap
from pathlib import Path
# Disable line length warnings as wrapping the C code templates would be hard
# flake8: noqa: E501
def gen_versions_macros(args, current_major_version, current_minor_version, current_micro_version):
with args.out_path.open("w", encoding="utf-8") as ofile, args.in_path.open(
"r", encoding="utf-8"
) as ifile:
for line in ifile.readlines():
if "@GDK_VERSIONS@" in line:
ofile.write(
textwrap.dedent(
f"""\
/**
* GDK_MAJOR_VERSION:
*
* The major version component of the library's version, e.g. "1" for "1.2.3".
*/
#define GDK_MAJOR_VERSION ({current_major_version})
/**
* GDK_MINOR_VERSION:
*
* The minor version component of the library's version, e.g. "2" for "1.2.3".
*/
#define GDK_MINOR_VERSION ({current_minor_version})
/**
* GDK_MICRO_VERSION:
*
* The micro version component of the library's version, e.g. "3" for "1.2.3".
*/
#define GDK_MICRO_VERSION ({current_micro_version})
"""
)
)
for minor in range(0, current_minor_version + 2, 2):
ofile.write(
textwrap.dedent(
f"""\
/**
* GDK_VERSION_{current_major_version}_{minor}:
*
* A macro that evaluates to the {current_major_version}.{minor} version of GTK, in a format
* that can be used by the C pre-processor.
*
* Since: {current_major_version}.{minor}
*/
#define GDK_VERSION_{current_major_version}_{minor} (G_ENCODE_VERSION ({current_major_version}, {minor}))
"""
)
)
else:
ofile.write(line)
def gen_visibility_macros(args, current_major_version, current_minor_version, current_micro_version):
"""
Generates a set of macros for each minor stable version of GTK
- GDK_DEPRECATED
- GDK_DEPRECATED_IN_…
- GDK_DEPRECATED_MACRO_IN_…
- GDK_DEPRECATED_ENUMERATOR_IN_…
- GDK_DEPRECATED_TYPE_IN_…
- GDK_AVAILABLE_IN_ALL
- GDK_AVAILABLE_IN_…
- GDK_AVAILABLE_STATIC_INLINE_IN_…
- GDK_AVAILABLE_MACRO_IN_…
- GDK_AVAILABLE_ENUMERATOR_IN_…
- GDK_AVAILABLE_TYPE_IN_…
- GDK_UNAVAILABLE(maj,min)
- GDK_UNAVAILABLE_STATIC_INLINE(maj,min)
"""
ns = args.namespace
with args.out_path.open("w", encoding="utf-8") as f:
f.write(
textwrap.dedent(
f"""\
#pragma once
#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined({ns}_STATIC_COMPILATION)
# define _{ns}_EXPORT __declspec(dllexport)
# define _{ns}_IMPORT __declspec(dllimport)
#elif __GNUC__ >= 4
# define _{ns}_EXPORT __attribute__((visibility("default")))
# define _{ns}_IMPORT
#else
# define _{ns}_EXPORT
# define _{ns}_IMPORT
#endif
#ifdef GTK_COMPILATION
# define _{ns}_API _{ns}_EXPORT
#else
# define _{ns}_API _{ns}_IMPORT
#endif
#define _{ns}_EXTERN _{ns}_API extern
#define {ns}_VAR _{ns}_EXTERN
#define {ns}_AVAILABLE_IN_ALL _{ns}_EXTERN
#ifdef GDK_DISABLE_DEPRECATION_WARNINGS
#define {ns}_DEPRECATED _{ns}_EXTERN
#define {ns}_DEPRECATED_FOR(f) _{ns}_EXTERN
#define {ns}_UNAVAILABLE(maj,min) _{ns}_EXTERN
#define {ns}_UNAVAILABLE_STATIC_INLINE(maj,min)
#else
#define {ns}_DEPRECATED G_DEPRECATED _{ns}_EXTERN
#define {ns}_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _{ns}_EXTERN
#define {ns}_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _{ns}_EXTERN
#define {ns}_UNAVAILABLE_STATIC_INLINE(maj,min) G_UNAVAILABLE(maj,min)
#endif
"""
)
)
for minor in range(0, current_minor_version + 2, 2):
f.write(
textwrap.dedent(
f"""
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_{minor}
#define {ns}_DEPRECATED_IN_{current_major_version}_{minor} {ns}_DEPRECATED
#define {ns}_DEPRECATED_IN_{current_major_version}_{minor}_FOR(f) {ns}_DEPRECATED_FOR (f)
#define {ns}_DEPRECATED_MACRO_IN_{current_major_version}_{minor} GDK_DEPRECATED_MACRO
#define {ns}_DEPRECATED_MACRO_IN_{current_major_version}_{minor}_FOR(f) GDK_DEPRECATED_MACRO_FOR (f)
#define {ns}_DEPRECATED_ENUMERATOR_IN_{current_major_version}_{minor} GDK_DEPRECATED_ENUMERATOR
#define {ns}_DEPRECATED_ENUMERATOR_IN_{current_major_version}_{minor}_FOR(f) GDK_DEPRECATED_ENUMERATOR_FOR (f)
#define {ns}_DEPRECATED_TYPE_IN_{current_major_version}_{minor} GDK_DEPRECATED_TYPE
#define {ns}_DEPRECATED_TYPE_IN_{current_major_version}_{minor}_FOR(f) GDK_DEPRECATED_TYPE_FOR (f)
#else
#define {ns}_DEPRECATED_IN_{current_major_version}_{minor} _{ns}_EXTERN
#define {ns}_DEPRECATED_IN_{current_major_version}_{minor}_FOR(f) _{ns}_EXTERN
#define {ns}_DEPRECATED_MACRO_IN_{current_major_version}_{minor}
#define {ns}_DEPRECATED_MACRO_IN_{current_major_version}_{minor}_FOR(f)
#define {ns}_DEPRECATED_ENUMERATOR_IN_{current_major_version}_{minor}
#define {ns}_DEPRECATED_ENUMERATOR_IN_{current_major_version}_{minor}_FOR(f)
#define {ns}_DEPRECATED_TYPE_IN_{current_major_version}_{minor}
#define {ns}_DEPRECATED_TYPE_IN_{current_major_version}_{minor}_FOR(f)
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_{current_major_version}_{minor}
#define {ns}_AVAILABLE_IN_{current_major_version}_{minor} {ns}_UNAVAILABLE ({current_major_version}, {minor})
#define {ns}_AVAILABLE_STATIC_INLINE_IN_{current_major_version}_{minor} GDK_UNAVAILABLE_STATIC_INLINE ({current_major_version}, {minor})
#define {ns}_AVAILABLE_MACRO_IN_{current_major_version}_{minor} GDK_UNAVAILABLE_MACRO ({current_major_version}, {minor})
#define {ns}_AVAILABLE_ENUMERATOR_IN_{current_major_version}_{minor} GDK_UNAVAILABLE_ENUMERATOR ({current_major_version}, {minor})
#define {ns}_AVAILABLE_TYPE_IN_{current_major_version}_{minor} GDK_UNAVAILABLE_TYPE ({current_major_version}, {minor})
#else
#define {ns}_AVAILABLE_IN_{current_major_version}_{minor} _{ns}_EXTERN
#define {ns}_AVAILABLE_STATIC_INLINE_IN_{current_major_version}_{minor}
#define {ns}_AVAILABLE_MACRO_IN_{current_major_version}_{minor}
#define {ns}_AVAILABLE_ENUMERATOR_IN_{current_major_version}_{minor}
#define {ns}_AVAILABLE_TYPE_IN_{current_major_version}_{minor}
#endif
"""
)
)
def main():
parser = argparse.ArgumentParser()
parser.add_argument("gtk_version", help="Current GLib version")
subparsers = parser.add_subparsers()
versions_parser = subparsers.add_parser(
"versions-macros", help="Generate versions macros"
)
versions_parser.add_argument("in_path", help="input file", type=Path)
versions_parser.add_argument("out_path", help="output file", type=Path)
versions_parser.set_defaults(func=gen_versions_macros)
visibility_parser = subparsers.add_parser(
"visibility-macros", help="Generate visibility macros"
)
visibility_parser.add_argument("namespace", help="Macro namespace")
visibility_parser.add_argument("out_path", help="output file", type=Path)
visibility_parser.set_defaults(func=gen_visibility_macros)
args = parser.parse_args()
version = [int(i) for i in args.gtk_version.split(".")]
args.func(args, version[0], version[1], version[2])
if __name__ == "__main__":
main()

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

View File

@@ -202,43 +202,36 @@ constraint_editor_window_load (ConstraintEditorWindow *self,
}
static void
open_response_cb (GtkNativeDialog *dialog,
int response,
ConstraintEditorWindow *self)
open_response_cb (GObject *source,
GAsyncResult *result,
void *user_data)
{
gtk_native_dialog_hide (dialog);
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
ConstraintEditorWindow *self = user_data;
GFile *file;
if (response == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_open_finish (dialog, result, NULL);
if (file)
{
GFile *file;
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
constraint_editor_window_load (self, file);
g_object_unref (file);
}
gtk_native_dialog_destroy (dialog);
}
static void
open_cb (GtkWidget *button,
ConstraintEditorWindow *self)
{
GtkFileChooserNative *dialog;
GtkFileDialog *dialog;
GFile *cwd;
dialog = gtk_file_chooser_native_new ("Open file",
GTK_WINDOW (self),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Load",
"_Cancel");
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
GFile *cwd = g_file_new_for_path (".");
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), cwd, NULL);
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "Open file");
cwd = g_file_new_for_path (".");
gtk_file_dialog_set_initial_folder (dialog, cwd);
g_object_unref (cwd);
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), self);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
gtk_file_dialog_open (dialog, GTK_WINDOW (self), NULL, open_response_cb, self);
g_object_unref (dialog);
}
static void
@@ -294,22 +287,23 @@ serialize_model (GListModel *list)
static void
save_response_cb (GtkNativeDialog *dialog,
int response,
ConstraintEditorWindow *self)
save_response_cb (GObject *source,
GAsyncResult *result,
void *user_data)
{
gtk_native_dialog_hide (dialog);
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
ConstraintEditorWindow *self = user_data;
GFile *file;
if (response == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_save_finish (dialog, result, NULL);
if (file)
{
GListModel *model;
GFile *file;
char *text;
GError *error = NULL;
model = constraint_view_get_model (CONSTRAINT_VIEW (self->view));
text = serialize_model (model);
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
g_file_replace_contents (file, text, strlen (text),
NULL, FALSE,
G_FILE_CREATE_NONE,
@@ -318,46 +312,38 @@ save_response_cb (GtkNativeDialog *dialog,
&error);
if (error != NULL)
{
GtkWidget *message_dialog;
GtkAlertDialog *alert;
message_dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))),
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
"Saving failed");
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message_dialog),
"%s", error->message);
g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (message_dialog);
alert = gtk_alert_dialog_new ("Saving failed");
gtk_alert_dialog_set_detail (alert, error->message);
gtk_alert_dialog_show (alert,
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))));
g_object_unref (alert);
g_error_free (error);
}
g_free (text);
g_object_unref (file);
}
gtk_native_dialog_destroy (dialog);
}
static void
save_cb (GtkWidget *button,
ConstraintEditorWindow *self)
{
GtkFileChooserNative *dialog;
GtkFileDialog *dialog;
GFile *cwd;
dialog = gtk_file_chooser_native_new ("Save constraints",
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
GTK_FILE_CHOOSER_ACTION_SAVE,
"_Save",
"_Cancel");
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
GFile *cwd = g_file_new_for_path (".");
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), cwd, NULL);
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "Save constraints");
cwd = g_file_new_for_path (".");
gtk_file_dialog_set_initial_folder (dialog, cwd);
g_object_unref (cwd);
g_signal_connect (dialog, "response", G_CALLBACK (save_response_cb), self);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
gtk_file_dialog_save (dialog,
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
NULL,
save_response_cb, self);
g_object_unref (dialog);
}
static void
@@ -440,7 +426,7 @@ edit_constraint (ConstraintEditorWindow *win,
g_signal_connect (editor, "done", G_CALLBACK (constraint_editor_done), win);
gtk_widget_show (window);
gtk_window_present (GTK_WINDOW (window));
}
static void
@@ -473,7 +459,7 @@ edit_guide (ConstraintEditorWindow *win,
gtk_window_set_child (GTK_WINDOW (window), GTK_WIDGET (editor));
g_signal_connect (editor, "done", G_CALLBACK (guide_editor_done), win);
gtk_widget_show (window);
gtk_window_present (GTK_WINDOW (window));
}
static void
@@ -497,6 +483,8 @@ constraint_editor_window_class_init (ConstraintEditorWindowClass *class)
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
g_type_ensure (CONSTRAINT_VIEW_TYPE);
object_class->dispose = constraint_editor_window_dispose;
gtk_widget_class_set_template_from_resource (widget_class,

View File

@@ -20,8 +20,7 @@
#include "config.h"
#include "constraint-editor.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
#include "constraint-view.h"
struct _ConstraintEditor
{
@@ -66,7 +65,7 @@ static const char *
get_target_name (GtkConstraintTarget *target)
{
if (target == NULL)
return "super";
return "Super";
else if (GTK_IS_WIDGET (target))
return gtk_widget_get_name (GTK_WIDGET (target));
else if (GTK_IS_CONSTRAINT_GUIDE (target))
@@ -80,62 +79,29 @@ constraint_target_combo (GListModel *model,
GtkWidget *combo,
gboolean is_source)
{
GtkStringList *targets;
int i;
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "super", "Super");
targets = gtk_string_list_new (NULL);
gtk_string_list_append (targets, "Super");
if (model)
{
for (i = 0; i < g_list_model_get_n_items (model); i++)
{
GObject *item = g_list_model_get_object (model, i);
const char *name;
if (GTK_IS_CONSTRAINT (item))
continue;
name = get_target_name (GTK_CONSTRAINT_TARGET (item));
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), name, name);
gtk_string_list_append (targets, get_target_name (GTK_CONSTRAINT_TARGET (item)));
g_object_unref (item);
}
}
}
static void
constraint_attribute_combo (GtkWidget *combo,
gboolean is_source)
{
if (is_source)
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "none", "None");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "left", "Left");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "right", "Right");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "top", "Top");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "bottom", "Bottom");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "start", "Start");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "end", "End");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "width", "Width");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "height", "Height");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "center-x", "Center X");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "center-y", "Center Y");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "baseline", "Baseline");
}
static void
constraint_relation_combo (GtkWidget *combo)
{
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "le", "");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "eq", "=");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "ge", "");
}
static void
constraint_strength_combo (GtkWidget *combo)
{
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "weak", "Weak");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "medium", "Medium");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "strong", "Strong");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "required", "Required");
gtk_drop_down_set_model (GTK_DROP_DOWN (combo), G_LIST_MODEL (targets));
g_object_unref (targets);
}
static gpointer
@@ -147,7 +113,7 @@ get_target (GListModel *model,
if (id == NULL)
return NULL;
if (strcmp ("super", id) == 0)
if (strcmp ("Super", id) == 0)
return NULL;
for (i = 0; i < g_list_model_get_n_items (model); i++)
@@ -171,16 +137,65 @@ get_target (GListModel *model,
return NULL;
}
static GtkConstraintAttribute
get_target_attr (const char *id)
static void
select_target (GtkDropDown *combo,
const char *target_name)
{
GtkConstraintAttribute attr;
GEnumClass *class = g_type_class_ref (GTK_TYPE_CONSTRAINT_ATTRIBUTE);
GEnumValue *value = g_enum_get_value_by_nick (class, id);
attr = value->value;
g_type_class_unref (class);
GListModel *model = gtk_drop_down_get_model (combo);
return attr;
for (unsigned int i = 0; i < g_list_model_get_n_items (model); i++)
{
GtkStringObject *s = g_list_model_get_item (model, i);
g_object_unref (s);
if (strcmp (target_name, gtk_string_object_get_string (s)) == 0)
{
gtk_drop_down_set_selected (GTK_DROP_DOWN (combo), i);
return;
}
}
}
static GtkConstraintAttribute
get_attr (unsigned int id)
{
switch (id)
{
case 0: return GTK_CONSTRAINT_ATTRIBUTE_NONE;
case 1: return GTK_CONSTRAINT_ATTRIBUTE_LEFT;
case 2: return GTK_CONSTRAINT_ATTRIBUTE_RIGHT;
case 3: return GTK_CONSTRAINT_ATTRIBUTE_TOP;
case 4: return GTK_CONSTRAINT_ATTRIBUTE_BOTTOM;
case 5: return GTK_CONSTRAINT_ATTRIBUTE_START;
case 6: return GTK_CONSTRAINT_ATTRIBUTE_END;
case 7: return GTK_CONSTRAINT_ATTRIBUTE_WIDTH;
case 8: return GTK_CONSTRAINT_ATTRIBUTE_HEIGHT;
case 9: return GTK_CONSTRAINT_ATTRIBUTE_CENTER_X;
case 10: return GTK_CONSTRAINT_ATTRIBUTE_CENTER_Y;
case 11: return GTK_CONSTRAINT_ATTRIBUTE_BASELINE;
default: g_assert_not_reached ();
}
}
static unsigned int
get_attr_id (GtkConstraintAttribute attr)
{
switch (attr)
{
case GTK_CONSTRAINT_ATTRIBUTE_NONE: return 0;
case GTK_CONSTRAINT_ATTRIBUTE_LEFT: return 1;
case GTK_CONSTRAINT_ATTRIBUTE_RIGHT: return 2;
case GTK_CONSTRAINT_ATTRIBUTE_TOP: return 3;
case GTK_CONSTRAINT_ATTRIBUTE_BOTTOM: return 4;
case GTK_CONSTRAINT_ATTRIBUTE_START: return 5;
case GTK_CONSTRAINT_ATTRIBUTE_END: return 6;
case GTK_CONSTRAINT_ATTRIBUTE_WIDTH: return 7;
case GTK_CONSTRAINT_ATTRIBUTE_HEIGHT: return 8;
case GTK_CONSTRAINT_ATTRIBUTE_CENTER_X: return 9;
case GTK_CONSTRAINT_ATTRIBUTE_CENTER_Y: return 10;
case GTK_CONSTRAINT_ATTRIBUTE_BASELINE: return 11;
default: g_assert_not_reached ();
}
}
static const char *
@@ -195,15 +210,27 @@ get_attr_nick (GtkConstraintAttribute attr)
}
static GtkConstraintRelation
get_relation (const char *id)
get_relation (unsigned int id)
{
GtkConstraintRelation relation;
GEnumClass *class = g_type_class_ref (GTK_TYPE_CONSTRAINT_RELATION);
GEnumValue *value = g_enum_get_value_by_nick (class, id);
relation = value->value;
g_type_class_unref (class);
switch (id)
{
case 0: return GTK_CONSTRAINT_RELATION_LE;
case 1: return GTK_CONSTRAINT_RELATION_EQ;
case 2: return GTK_CONSTRAINT_RELATION_GE;
default: g_assert_not_reached ();
}
}
return relation;
static unsigned int
get_relation_id (GtkConstraintRelation relation)
{
switch (relation)
{
case GTK_CONSTRAINT_RELATION_LE: return 0;
case GTK_CONSTRAINT_RELATION_EQ: return 1;
case GTK_CONSTRAINT_RELATION_GE: return 2;
default: g_assert_not_reached ();
}
}
static const char *
@@ -234,15 +261,29 @@ get_relation_display_name (GtkConstraintRelation relation)
}
static GtkConstraintStrength
get_strength (const char *id)
{
GtkConstraintStrength strength;
GEnumClass *class = g_type_class_ref (GTK_TYPE_CONSTRAINT_STRENGTH);
GEnumValue *value = g_enum_get_value_by_nick (class, id);
strength = value->value;
g_type_class_unref (class);
get_strength (unsigned int id)
{
switch (id)
{
case 0: return GTK_CONSTRAINT_STRENGTH_WEAK;
case 1: return GTK_CONSTRAINT_STRENGTH_MEDIUM;
case 2: return GTK_CONSTRAINT_STRENGTH_STRONG;
case 3: return GTK_CONSTRAINT_STRENGTH_REQUIRED;
default: g_assert_not_reached ();
}
}
return strength;
static unsigned int
get_strength_id (GtkConstraintStrength strength)
{
switch (strength)
{
case GTK_CONSTRAINT_STRENGTH_WEAK: return 0;
case GTK_CONSTRAINT_STRENGTH_MEDIUM: return 1;
case GTK_CONSTRAINT_STRENGTH_STRONG: return 2;
case GTK_CONSTRAINT_STRENGTH_REQUIRED: return 3;
default: g_assert_not_reached ();
}
}
static const char *
@@ -294,7 +335,7 @@ static void
create_constraint (GtkButton *button,
ConstraintEditor *editor)
{
const char *id;
gpointer obj;
gpointer target;
GtkConstraintAttribute target_attr;
gpointer source;
@@ -305,25 +346,27 @@ create_constraint (GtkButton *button,
int strength;
GtkConstraint *constraint;
id = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->target));
target = get_target (editor->model, id);
id = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->target_attr));
target_attr = get_target_attr (id);
obj = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (editor->target));
if (obj)
target = get_target (editor->model, gtk_string_object_get_string (GTK_STRING_OBJECT (obj)));
else
target = NULL;
target_attr = get_attr (gtk_drop_down_get_selected (GTK_DROP_DOWN (editor->target_attr)));
id = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source));
source = get_target (editor->model, id);
id = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source_attr));
source_attr = get_target_attr (id);
obj = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (editor->source));
if (obj)
source = get_target (editor->model, gtk_string_object_get_string (GTK_STRING_OBJECT (obj)));
else
source = NULL;
source_attr = get_attr (gtk_drop_down_get_selected (GTK_DROP_DOWN(editor->source_attr)));
id = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->relation));
relation = get_relation (id);
relation = get_relation (gtk_drop_down_get_selected (GTK_DROP_DOWN (editor->relation)));
multiplier = g_ascii_strtod (gtk_editable_get_text (GTK_EDITABLE (editor->multiplier)), NULL);
constant = g_ascii_strtod (gtk_editable_get_text (GTK_EDITABLE (editor->constant)), NULL);
id = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->strength));
strength = get_strength (id);
strength = get_strength (gtk_drop_down_get_selected (GTK_DROP_DOWN (editor->strength)));
constraint = gtk_constraint_new (target, target_attr,
relation,
@@ -338,12 +381,9 @@ create_constraint (GtkButton *button,
static void
source_attr_changed (ConstraintEditor *editor)
{
const char *id;
id = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source_attr));
if (strcmp (id, "none") == 0)
if (get_attr (gtk_drop_down_get_selected (GTK_DROP_DOWN (editor->source_attr))) == GTK_CONSTRAINT_ATTRIBUTE_NONE)
{
gtk_combo_box_set_active (GTK_COMBO_BOX (editor->source), -1);
gtk_drop_down_set_selected (GTK_DROP_DOWN (editor->source), GTK_INVALID_LIST_POSITION);
gtk_editable_set_text (GTK_EDITABLE (editor->multiplier), "");
gtk_widget_set_sensitive (editor->source, FALSE);
gtk_widget_set_sensitive (editor->multiplier, FALSE);
@@ -409,7 +449,7 @@ update_preview (ConstraintEditor *editor)
GString *str;
const char *name;
const char *attr;
char *relation;
const char *relation;
const char *multiplier;
const char *constant;
double c, m;
@@ -419,23 +459,22 @@ update_preview (ConstraintEditor *editor)
str = g_string_new ("");
name = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->target));
attr = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->target_attr));
relation = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (editor->relation));
name = gtk_string_object_get_string (GTK_STRING_OBJECT (gtk_drop_down_get_selected_item (GTK_DROP_DOWN (editor->target))));
attr = get_attr_nick (get_attr (gtk_drop_down_get_selected ((GTK_DROP_DOWN (editor->target_attr)))));
relation = get_relation_nick (get_relation (gtk_drop_down_get_selected (GTK_DROP_DOWN (editor->relation))));
if (name == NULL)
name = "[ ]";
g_string_append_printf (str, "%s.%s %s ", name, attr, relation);
g_free (relation);
constant = gtk_editable_get_text (GTK_EDITABLE (editor->constant));
c = g_ascii_strtod (constant, NULL);
attr = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source_attr));
attr = get_attr_nick (get_attr (gtk_drop_down_get_selected (GTK_DROP_DOWN (editor->source_attr))));
if (strcmp (attr, "none") != 0)
{
name = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source));
name = gtk_string_object_get_string (GTK_STRING_OBJECT (gtk_drop_down_get_selected_item (GTK_DROP_DOWN (editor->source))));
multiplier = gtk_editable_get_text (GTK_EDITABLE (editor->multiplier));
m = g_ascii_strtod (multiplier, NULL);
@@ -463,12 +502,18 @@ update_preview (ConstraintEditor *editor)
static void
update_button (ConstraintEditor *editor)
{
const char *target = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->target));
const char *source = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source));
const char *source_attr = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->source_attr));
gpointer obj;
const char *target;
const char *source;
GtkConstraintAttribute source_attr = get_attr (gtk_drop_down_get_selected (GTK_DROP_DOWN (editor->source_attr)));
if (target &&
(source || (source_attr && get_target_attr (source_attr) == GTK_CONSTRAINT_ATTRIBUTE_NONE)))
obj = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (editor->target));
target = obj ? gtk_string_object_get_string (GTK_STRING_OBJECT (obj)) : NULL;
obj = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (editor->source));
source = obj ? gtk_string_object_get_string (GTK_STRING_OBJECT (obj)) : NULL;
if (target && (source || (source_attr == GTK_CONSTRAINT_ATTRIBUTE_NONE)))
gtk_widget_set_sensitive (editor->button, TRUE);
else
gtk_widget_set_sensitive (editor->button, FALSE);
@@ -486,12 +531,7 @@ constraint_editor_constructed (GObject *object)
ConstraintEditor *editor = CONSTRAINT_EDITOR (object);
constraint_target_combo (editor->model, editor->target, FALSE);
constraint_attribute_combo (editor->target_attr, FALSE);
constraint_relation_combo (editor->relation);
constraint_target_combo (editor->model, editor->source, TRUE);
constraint_attribute_combo (editor->source_attr, TRUE);
constraint_strength_combo (editor->strength);
if (editor->constraint)
{
@@ -499,30 +539,24 @@ constraint_editor_constructed (GObject *object)
GtkConstraintAttribute attr;
GtkConstraintRelation relation;
GtkConstraintStrength strength;
const char *nick;
char *val;
double multiplier;
double constant;
target = gtk_constraint_get_target (editor->constraint);
nick = get_target_name (target);
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->target), nick);
select_target (GTK_DROP_DOWN (editor->target), get_target_name (target));
attr = gtk_constraint_get_target_attribute (editor->constraint);
nick = get_attr_nick (attr);
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->target_attr), nick);
gtk_drop_down_set_selected (GTK_DROP_DOWN (editor->target_attr), get_attr_id (attr));
target = gtk_constraint_get_source (editor->constraint);
nick = get_target_name (target);
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->source), nick);
select_target (GTK_DROP_DOWN (editor->source), get_target_name (target));
attr = gtk_constraint_get_source_attribute (editor->constraint);
nick = get_attr_nick (attr);
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->source_attr), nick);
gtk_drop_down_set_selected (GTK_DROP_DOWN (editor->source_attr), get_attr_id (attr));
relation = gtk_constraint_get_relation (editor->constraint);
nick = get_relation_nick (relation);
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->relation), nick);
gtk_drop_down_set_selected (GTK_DROP_DOWN (editor->relation), get_relation_id (relation));
multiplier = gtk_constraint_get_multiplier (editor->constraint);
val = g_strdup_printf ("%g", multiplier);
@@ -535,17 +569,16 @@ constraint_editor_constructed (GObject *object)
g_free (val);
strength = gtk_constraint_get_strength (editor->constraint);
nick = get_strength_nick (strength);
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->strength), nick);
gtk_drop_down_set_selected (GTK_DROP_DOWN (editor->strength), get_strength_id (strength));
gtk_button_set_label (GTK_BUTTON (editor->button), "Apply");
}
else
{
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->target_attr), "left");
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->source_attr), "left");
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->relation), "eq");
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->strength), "required");
gtk_drop_down_set_selected (GTK_DROP_DOWN (editor->target_attr), get_attr_id (GTK_CONSTRAINT_ATTRIBUTE_LEFT));
gtk_drop_down_set_selected (GTK_DROP_DOWN (editor->source_attr), get_attr_id (GTK_CONSTRAINT_ATTRIBUTE_LEFT));
gtk_drop_down_set_selected (GTK_DROP_DOWN (editor->relation), get_relation_id (GTK_CONSTRAINT_RELATION_EQ));
gtk_drop_down_set_selected (GTK_DROP_DOWN (editor->strength), get_strength_id (GTK_CONSTRAINT_STRENGTH_REQUIRED));
gtk_editable_set_text (GTK_EDITABLE (editor->multiplier), "1.0");
gtk_editable_set_text (GTK_EDITABLE (editor->constant), "0.0");

View File

@@ -1,5 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkStringList" id="targets">
<items>
<item>None</item>
<item>Left</item>
<item>Right</item>
<item>Top</item>
<item>Bottom</item>
<item>Start</item>
<item>End</item>
<item>Width</item>
<item>Height</item>
<item>Center X</item>
<item>Center Y</item>
<item>Baseline</item>
</items>
</object>
<template class="ConstraintEditor" parent="GtkWidget">
<child>
<object class="GtkGrid" id="grid">
@@ -19,9 +35,9 @@
</object>
</child>
<child>
<object class="GtkComboBoxText" id="target">
<signal name="changed" handler="update_preview" swapped="yes"/>
<signal name="changed" handler="update_button" swapped="yes"/>
<object class="GtkDropDown" id="target">
<signal name="notify::selected" handler="update_preview" swapped="yes"/>
<signal name="notify::selected" handler="update_button" swapped="yes"/>
<layout>
<property name="column">1</property>
<property name="row">1</property>
@@ -29,8 +45,9 @@
</object>
</child>
<child>
<object class="GtkComboBoxText" id="target_attr">
<signal name="changed" handler="update_preview" swapped="yes"/>
<object class="GtkDropDown" id="target_attr">
<property name="model">targets</property>
<signal name="notify::selected" handler="update_preview" swapped="yes"/>
<layout>
<property name="column">2</property>
<property name="row">1</property>
@@ -47,8 +64,17 @@
</object>
</child>
<child>
<object class="GtkComboBoxText" id="relation">
<signal name="changed" handler="update_preview" swapped="yes"/>
<object class="GtkDropDown" id="relation">
<signal name="notify::selected" handler="update_preview" swapped="yes"/>
<property name="model">
<object class="GtkStringList">
<items>
<item>≤</item>
<item>=</item>
<item>≥</item>
</items>
</object>
</property>
<layout>
<property name="column">1</property>
<property name="row">2</property>
@@ -65,9 +91,9 @@
</object>
</child>
<child>
<object class="GtkComboBoxText" id="source">
<signal name="changed" handler="update_preview" swapped="yes"/>
<signal name="changed" handler="update_button" swapped="yes"/>
<object class="GtkDropDown" id="source">
<signal name="notify::selected" handler="update_preview" swapped="yes"/>
<signal name="notify::selected" handler="update_button" swapped="yes"/>
<layout>
<property name="column">1</property>
<property name="row">3</property>
@@ -75,10 +101,11 @@
</object>
</child>
<child>
<object class="GtkComboBoxText" id="source_attr">
<signal name="changed" handler="update_preview" swapped="yes"/>
<signal name="changed" handler="source_attr_changed" swapped="yes"/>
<signal name="changed" handler="update_button" swapped="yes"/>
<object class="GtkDropDown" id="source_attr">
<property name="model">targets</property>
<signal name="notify::selected" handler="update_preview" swapped="yes"/>
<signal name="notify::selected" handler="source_attr_changed" swapped="yes"/>
<signal name="notify::selected" handler="update_button" swapped="yes"/>
<layout>
<property name="column">2</property>
<property name="row">3</property>
@@ -131,7 +158,17 @@
</object>
</child>
<child>
<object class="GtkComboBoxText" id="strength">
<object class="GtkDropDown" id="strength">
<property name="model">
<object class="GtkStringList">
<items>
<item>Weak</item>
<item>Medium</item>
<item>Strong</item>
<item>Required</item>
</items>
</object>
</property>
<layout>
<property name="column">1</property>
<property name="row">6</property>

View File

@@ -21,8 +21,6 @@
#include "guide-editor.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
struct _GuideEditor
{
GtkWidget parent_instance;
@@ -59,25 +57,30 @@ static guint signals[LAST_SIGNAL];
G_DEFINE_TYPE(GuideEditor, guide_editor, GTK_TYPE_WIDGET);
static void
guide_strength_combo (GtkWidget *combo)
static GtkConstraintStrength
get_strength (unsigned int id)
{
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "weak", "Weak");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "medium", "Medium");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "strong", "Strong");
gtk_combo_box_text_append (GTK_COMBO_BOX_TEXT (combo), "required", "Required");
switch (id)
{
case 0: return GTK_CONSTRAINT_STRENGTH_WEAK;
case 1: return GTK_CONSTRAINT_STRENGTH_MEDIUM;
case 2: return GTK_CONSTRAINT_STRENGTH_STRONG;
case 3: return GTK_CONSTRAINT_STRENGTH_REQUIRED;
default: g_assert_not_reached ();
}
}
static GtkConstraintStrength
get_strength (const char *id)
static unsigned int
get_strength_id (GtkConstraintStrength strength)
{
GtkConstraintStrength strength;
GEnumClass *class = g_type_class_ref (GTK_TYPE_CONSTRAINT_STRENGTH);
GEnumValue *value = g_enum_get_value_by_nick (class, id);
strength = value->value;
g_type_class_unref (class);
return strength;
switch (strength)
{
case GTK_CONSTRAINT_STRENGTH_WEAK: return 0;
case GTK_CONSTRAINT_STRENGTH_MEDIUM: return 1;
case GTK_CONSTRAINT_STRENGTH_STRONG: return 2;
case GTK_CONSTRAINT_STRENGTH_REQUIRED: return 3;
default: g_assert_not_reached ();
}
}
static const char *
@@ -118,11 +121,11 @@ static void
create_guide (GtkButton *button,
GuideEditor *editor)
{
const char *id;
int strength;
const char *name;
int w, h;
GtkConstraintGuide *guide;
unsigned int id;
if (editor->guide)
guide = g_object_ref (editor->guide);
@@ -144,7 +147,7 @@ create_guide (GtkButton *button,
h = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (editor->max_height));
gtk_constraint_guide_set_max_size (guide, w, h);
id = gtk_combo_box_get_active_id (GTK_COMBO_BOX (editor->strength));
id = gtk_drop_down_get_selected (GTK_DROP_DOWN (editor->strength));
strength = get_strength (id);
gtk_constraint_guide_set_strength (guide, strength);
@@ -191,14 +194,9 @@ guide_editor_constructed (GObject *object)
{
GuideEditor *editor = GUIDE_EDITOR (object);
guide_strength_combo (editor->strength);
g_signal_connect (editor->min_width, "input", G_CALLBACK (min_input), NULL);
g_signal_connect (editor->min_height, "input", G_CALLBACK (min_input), NULL);
g_signal_connect (editor->max_width, "input", G_CALLBACK (max_input), NULL);
g_signal_connect (editor->max_height, "input", G_CALLBACK (max_input), NULL);
if (editor->guide)
@@ -224,8 +222,7 @@ guide_editor_constructed (GObject *object)
gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->max_height), h);
strength = gtk_constraint_guide_get_strength (editor->guide);
nick = get_strength_nick (strength);
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->strength), nick);
gtk_drop_down_set_selected (GTK_DROP_DOWN (editor->strength), get_strength_id (strength));
gtk_button_set_label (GTK_BUTTON (editor->button), "Apply");
}
@@ -245,7 +242,7 @@ guide_editor_constructed (GObject *object)
gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->max_width), G_MAXINT);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->max_height), G_MAXINT);
gtk_combo_box_set_active_id (GTK_COMBO_BOX (editor->strength), "medium");
gtk_drop_down_set_selected (GTK_DROP_DOWN (editor->strength), get_strength_id (GTK_CONSTRAINT_STRENGTH_MEDIUM));
gtk_button_set_label (GTK_BUTTON (editor->button), "Create");
}

View File

@@ -167,7 +167,17 @@
</object>
</child>
<child>
<object class="GtkComboBoxText" id="strength">
<object class="GtkDropDown" id="strength">
<property name="model">
<object class="GtkStringList">
<items>
<item>Weak</item>
<item>Medium</item>
<item>Strong</item>
<item>Required</item>
</items>
</object>
</property>
<layout>
<property name="column">1</property>
<property name="row">4</property>

View File

@@ -9,7 +9,7 @@ constraint_editor_sources = [
constraint_editor_resources = gnome.compile_resources('constraint_editor_resources',
'constraint-editor.gresource.xml',
source_dir: '.',
source_dir: meson.current_source_dir(),
)
executable('gtk4-constraint-editor',

View File

@@ -33,22 +33,12 @@ static void create_window (GApplication *app, const char *contents);
static void
show_action_dialog (GSimpleAction *action)
{
const char *name;
GtkWidget *dialog;
GtkAlertDialog *dialog;
name = g_action_get_name (G_ACTION (action));
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
"You activated action: \"%s\"",
name);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
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);
}
static void
@@ -67,7 +57,7 @@ show_action_infobar (GSimpleAction *action,
text = g_strdup_printf ("You activated radio action: \"%s\".\n"
"Current value: %s", name, value);
gtk_label_set_text (GTK_LABEL (window->message), text);
gtk_widget_show (window->infobar);
gtk_widget_set_visible (window->infobar, TRUE);
g_free (text);
}
@@ -90,43 +80,38 @@ activate_new (GSimpleAction *action,
}
static void
open_response_cb (GtkNativeDialog *dialog,
int response_id,
gpointer user_data)
open_response_cb (GObject *source,
GAsyncResult *result,
gpointer user_data)
{
GtkFileChooserNative *native = user_data;
GApplication *app = g_object_get_data (G_OBJECT (native), "app");
GtkWidget *message_dialog;
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
GApplication *app = G_APPLICATION (user_data);
GFile *file;
char *contents;
GError *error = NULL;
if (response_id == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_open_finish (dialog, result, &error);
if (file)
{
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (native));
char *contents;
if (g_file_load_contents (file, NULL, &contents, NULL, NULL, &error))
{
create_window (app, contents);
g_free (contents);
}
else
{
message_dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Error loading file: \"%s\"",
error->message);
g_signal_connect (message_dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (message_dialog);
g_error_free (error);
}
}
gtk_native_dialog_destroy (GTK_NATIVE_DIALOG (native));
g_object_unref (native);
if (error)
{
GtkAlertDialog *alert;
alert = gtk_alert_dialog_new ("Error loading file: \"%s\"", error->message);
gtk_alert_dialog_show (alert, NULL);
g_object_unref (alert);
g_error_free (error);
}
g_object_unref (app);
}
@@ -136,21 +121,11 @@ activate_open (GSimpleAction *action,
gpointer user_data)
{
GApplication *app = user_data;
GtkFileChooserNative *native;
GtkFileDialog *dialog;
native = gtk_file_chooser_native_new ("Open File",
NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Open",
"_Cancel");
g_object_set_data_full (G_OBJECT (native), "app", g_object_ref (app), g_object_unref);
g_signal_connect (native,
"response",
G_CALLBACK (open_response_cb),
native);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (native));
dialog = gtk_file_dialog_new ();
gtk_file_dialog_open (dialog, NULL, NULL, open_response_cb, g_object_ref (app));
g_object_unref (dialog);
}
static void
@@ -239,6 +214,41 @@ activate_quit (GSimpleAction *action,
}
}
static void
delete_messages (gpointer data)
{
g_list_free_full ((GList *)data, g_free);
}
static void
pop_message (GtkWidget *status)
{
GList *messages = (GList *) g_object_steal_data (G_OBJECT (status), "messages");
if (messages)
{
char *message = messages->data;
messages = g_list_remove (messages, message);
g_object_set_data_full (G_OBJECT (status), "messages",
messages, delete_messages);
gtk_label_set_label (GTK_LABEL (status), message);
}
}
static void
push_message (GtkWidget *status,
const char *message)
{
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));
g_object_set_data_full (G_OBJECT (status), "messages",
messages, delete_messages);
}
static void
update_statusbar (GtkTextBuffer *buffer,
DemoApplicationWindow *window)
@@ -249,7 +259,7 @@ update_statusbar (GtkTextBuffer *buffer,
GtkTextIter iter;
/* clear any previous message, underflow is allowed */
gtk_statusbar_pop (GTK_STATUSBAR (window->status), 0);
pop_message (window->status);
count = gtk_text_buffer_get_char_count (buffer);
@@ -263,7 +273,7 @@ update_statusbar (GtkTextBuffer *buffer,
msg = g_strdup_printf ("Cursor at row %d column %d - %d chars in document",
row, col, count);
gtk_statusbar_push (GTK_STATUSBAR (window->status), 0, msg);
push_message (window->status, msg);
g_free (msg);
}
@@ -320,7 +330,7 @@ static GActionEntry win_entries[] = {
static void
clicked_cb (GtkWidget *widget, DemoApplicationWindow *window)
{
gtk_widget_hide (window->infobar);
gtk_widget_set_visible (window->infobar, FALSE);
}
static void

View File

@@ -76,8 +76,13 @@
</object>
</child>
<child>
<object class="GtkStatusbar" id="status">
<object class="GtkLabel" id="status">
<property name="hexpand">1</property>
<property name="xalign">0</property>
<property name="margin-start">2</property>
<property name="margin-end">2</property>
<property name="margin-top">2</property>
<property name="margin-bottom">2</property>
<layout>
<property name="column">0</property>
<property name="row">3</property>

View File

@@ -7,6 +7,8 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *progress_bar = NULL;
static gboolean
@@ -140,7 +142,6 @@ create_page3 (GtkWidget *assistant)
label = gtk_label_new ("This is a confirmation page, press 'Apply' to apply changes");
gtk_widget_show (label);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), label);
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label, GTK_ASSISTANT_PAGE_CONFIRM);
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label, TRUE);
@@ -157,11 +158,14 @@ create_page4 (GtkWidget *assistant)
gtk_widget_set_margin_start (progress_bar, 40);
gtk_widget_set_margin_end (progress_bar, 40);
gtk_widget_show (progress_bar);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), progress_bar);
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), progress_bar, GTK_ASSISTANT_PAGE_PROGRESS);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), progress_bar, "Applying changes");
gtk_accessible_update_property (GTK_ACCESSIBLE (progress_bar),
GTK_ACCESSIBLE_PROPERTY_LABEL, "Applying changes",
-1);
/* This prevents the assistant window from being
* closed while we're "busy" applying changes.
*/
@@ -199,7 +203,7 @@ do_assistant (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (assistant))
gtk_widget_show (assistant);
gtk_widget_set_visible (assistant, TRUE);
else
gtk_window_destroy (GTK_WINDOW (assistant));

View File

@@ -116,7 +116,8 @@ effective_align (GtkAlign align,
return direction == GTK_TEXT_DIR_RTL ? GTK_ALIGN_START : GTK_ALIGN_END;
case GTK_ALIGN_FILL:
case GTK_ALIGN_CENTER:
case GTK_ALIGN_BASELINE:
case GTK_ALIGN_BASELINE_FILL:
case GTK_ALIGN_BASELINE_CENTER:
default:
return align;
}
@@ -258,7 +259,8 @@ blur_overlay_get_child_position (BlurOverlay *overlay,
case GTK_ALIGN_END:
alloc->x += width - alloc->width;
break;
case GTK_ALIGN_BASELINE:
case GTK_ALIGN_BASELINE_FILL:
case GTK_ALIGN_BASELINE_CENTER:
default:
g_assert_not_reached ();
break;
@@ -281,7 +283,8 @@ blur_overlay_get_child_position (BlurOverlay *overlay,
case GTK_ALIGN_END:
alloc->y += height - alloc->height;
break;
case GTK_ALIGN_BASELINE:
case GTK_ALIGN_BASELINE_FILL:
case GTK_ALIGN_BASELINE_CENTER:
default:
g_assert_not_reached ();
break;
@@ -297,12 +300,13 @@ blur_overlay_snapshot (GtkWidget *widget,
GtkWidget *main_widget;
GskRenderNode *main_widget_node = NULL;
GtkWidget *child;
GtkAllocation main_alloc;
int width, height;
cairo_region_t *clip = NULL;
int i;
main_widget = BLUR_OVERLAY (widget)->main_widget;
gtk_widget_get_allocation (widget, &main_alloc);
width = gtk_widget_get_width (widget);
height = gtk_widget_get_height (widget);
for (child = gtk_widget_get_first_child (widget);
child != NULL;
@@ -315,7 +319,7 @@ blur_overlay_snapshot (GtkWidget *widget,
if (blur > 0)
{
GtkAllocation alloc;
cairo_rectangle_int_t rect;
graphene_rect_t bounds;
if (main_widget_node == NULL)
@@ -327,8 +331,8 @@ blur_overlay_snapshot (GtkWidget *widget,
main_widget_node = gtk_snapshot_free_to_node (child_snapshot);
}
gtk_widget_get_allocation (child, &alloc);
graphene_rect_init (&bounds, alloc.x, alloc.y, alloc.width, alloc.height);
if (!gtk_widget_compute_bounds (child, gtk_widget_get_parent (child), &bounds))
graphene_rect_init (&bounds, 0, 0, 0, 0);
gtk_snapshot_push_blur (snapshot, blur);
gtk_snapshot_push_clip (snapshot, &bounds);
gtk_snapshot_append_node (snapshot, main_widget_node);
@@ -337,13 +341,17 @@ blur_overlay_snapshot (GtkWidget *widget,
if (clip == NULL)
{
cairo_rectangle_int_t rect;
rect.x = rect.y = 0;
rect.width = main_alloc.width;
rect.height = main_alloc.height;
rect.width = width;
rect.height = height;
clip = cairo_region_create_rectangle (&rect);
}
cairo_region_subtract_rectangle (clip, (cairo_rectangle_int_t *)&alloc);
rect.x = floor (bounds.origin.x);
rect.y = floor (bounds.origin.y);
rect.width = ceil (bounds.origin.x + bounds.size.width - rect.x);
rect.height = ceil (bounds.origin.y + bounds.size.height - rect.y);
cairo_region_subtract_rectangle (clip, &rect);
}
}

View File

@@ -51,15 +51,11 @@ struct _BlurOverlayClass
GtkAllocation *allocation);
};
GDK_AVAILABLE_IN_ALL
GType blur_overlay_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GtkWidget *blur_overlay_new (void);
GDK_AVAILABLE_IN_ALL
void blur_overlay_add_overlay (BlurOverlay *overlay,
GtkWidget *widget,
double blur);
GDK_AVAILABLE_IN_ALL
void blur_overlay_set_child (BlurOverlay *overlay,
GtkWidget *widget);

View File

@@ -1,5 +1,5 @@
/* Builder
* #Keywords: GMenu, GtkPopoverMenuBar, GtkBuilder, GtkStatusBar, GtkShortcutController, toolbar
* #Keywords: GMenu, GtkPopoverMenuBar, GtkBuilder, GtkShortcutController, toolbar
*
* Demonstrates a traditional interface, loaded from a XML description,
* and shows how to connect actions to the menu items and toolbar buttons.
@@ -37,22 +37,30 @@ remove_timeout (gpointer data)
g_source_remove (id);
}
static gboolean
pop_status (gpointer data)
static int
pop_message (gpointer data)
{
gtk_statusbar_pop (GTK_STATUSBAR (data), 0);
g_object_set_data (G_OBJECT (data), "timeout", NULL);
GtkWidget *status = data;
gtk_label_set_label (GTK_LABEL (status), "");
g_object_set_data (G_OBJECT (status), "timeout", GUINT_TO_POINTER (0));
return G_SOURCE_REMOVE;
}
static void
status_message (GtkStatusbar *status,
const char *text)
status_message (GtkWidget *status,
const char *text)
{
guint id;
gtk_statusbar_push (GTK_STATUSBAR (status), 0, text);
id = g_timeout_add (5000, pop_status, status);
id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (status), "timeout"));
if (id)
g_source_remove (id);
gtk_label_set_text (GTK_LABEL (status), text);
id = g_timeout_add (5000, pop_message, status);
g_object_set_data_full (G_OBJECT (status), "timeout", GUINT_TO_POINTER (id), remove_timeout);
}
@@ -65,7 +73,7 @@ help_activate (GSimpleAction *action,
GtkWidget *status;
status = GTK_WIDGET (g_object_get_data (G_OBJECT (user_data), "status"));
status_message (GTK_STATUSBAR (status), "Help not available");
status_message (status, "Help not available");
}
static void
@@ -78,7 +86,7 @@ not_implemented (GSimpleAction *action,
text = g_strdup_printf ("Action “%s” not implemented", g_action_get_name (G_ACTION (action)));
status = GTK_WIDGET (g_object_get_data (G_OBJECT (user_data), "status"));
status_message (GTK_STATUSBAR (status), text);
status_message (status, text);
g_free (text);
}
@@ -168,7 +176,7 @@ do_builder (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -1,4 +1,5 @@
/* Clipboard
* #Keywords: drag-and-drop, dnd
*
* GdkClipboard is used for clipboard handling. This demo shows how to
* copy and paste text, images, colors or files to and from the clipboard.
@@ -50,10 +51,10 @@ copy_button_clicked (GtkStack *source_stack,
}
else if (strcmp (visible_child_name, "Color") == 0)
{
GdkRGBA color;
const GdkRGBA *color;
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (visible_child), &color);
gdk_clipboard_set (clipboard, GDK_TYPE_RGBA, &color);
color = gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (visible_child));
gdk_clipboard_set (clipboard, GDK_TYPE_RGBA, color);
}
else if (strcmp (visible_child_name, "File") == 0)
{
@@ -215,37 +216,71 @@ file_button_set_file (GtkButton *button,
}
static void
file_chooser_response (GtkNativeDialog *dialog,
int response,
GtkButton *button)
file_chooser_response (GObject *source,
GAsyncResult *result,
gpointer user_data)
{
gtk_native_dialog_hide (dialog);
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
GtkButton *button = GTK_BUTTON (user_data);
GFile *file;
if (response == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_open_finish (dialog, result, NULL);
if (file)
{
GFile *file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
file_button_set_file (button, file);
g_object_unref (file);
update_copy_button_sensitivity (gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_STACK));
}
gtk_native_dialog_destroy (dialog);
}
static void
open_file_cb (GtkWidget *button)
{
GtkFileChooserNative *chooser;
GtkFileDialog *dialog;
chooser = gtk_file_chooser_native_new ("Choose a file",
GTK_WINDOW (gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW)),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Open",
"_Cancel");
dialog = gtk_file_dialog_new ();
g_signal_connect (chooser, "response", G_CALLBACK (file_chooser_response), button);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (chooser));
gtk_file_dialog_open (dialog,
GTK_WINDOW (gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW)),
NULL,
file_chooser_response, button);
g_object_unref (dialog);
}
static void
folder_chooser_response (GObject *source,
GAsyncResult *result,
gpointer user_data)
{
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
GtkButton *button = GTK_BUTTON (user_data);
GFile *file;
file = gtk_file_dialog_select_folder_finish (dialog, result, NULL);
if (file)
{
file_button_set_file (button, file);
g_object_unref (file);
update_copy_button_sensitivity (gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_STACK));
}
}
static void
open_folder_cb (GtkWidget *button)
{
GtkFileDialog *dialog;
dialog = gtk_file_dialog_new ();
gtk_file_dialog_select_folder (dialog,
GTK_WINDOW (gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW)),
NULL,
folder_chooser_response, button);
g_object_unref (dialog);
}
static void
@@ -346,6 +381,7 @@ do_clipboard (GtkWidget *do_widget)
gtk_builder_cscope_add_callback (scope, source_changed_cb);
gtk_builder_cscope_add_callback (scope, text_changed_cb);
gtk_builder_cscope_add_callback (scope, open_file_cb);
gtk_builder_cscope_add_callback (scope, open_folder_cb);
gtk_builder_cscope_add_callback (scope, on_drop);
gtk_builder_cscope_add_callback (scope, drag_prepare);
builder = gtk_builder_new ();
@@ -369,7 +405,7 @@ do_clipboard (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -4,6 +4,9 @@
<object class="GtkWindow" id="window">
<property name="resizable">1</property>
<property name="title">Clipboard</property>
<accessibility>
<relation name="described-by">label</relation>
</accessibility>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
@@ -13,7 +16,7 @@
<property name="margin-bottom">12</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel">
<object class="GtkLabel" id="label">
<property name="label">“Copy” will copy the selected data the clipboard, “Paste” will show the current clipboard contents. You can also drag the data to the bottom.</property>
<property name="wrap">1</property>
<property name="max-width-chars">40</property>
@@ -24,6 +27,9 @@
<property name="spacing">12</property>
<child>
<object class="GtkDropDown" id="source_chooser">
<accessibility>
<property name="label">Source Type</property>
</accessibility>
<property name="valign">center</property>
<property name="model">
<object class="GtkStringList">
@@ -32,6 +38,7 @@
<item>Color</item>
<item>Image</item>
<item>File</item>
<item>Folder</item>
</items>
</object>
</property>
@@ -53,6 +60,9 @@
<property name="name">Text</property>
<property name="child">
<object class="GtkEntry" id="source_text">
<accessibility>
<property name="label">Text Drag Source</property>
</accessibility>
<property name="valign">center</property>
<signal name="notify::text" handler="text_changed_cb" object="copy_button"/>
<property name="text">Copy this!</property>
@@ -64,7 +74,14 @@
<object class="GtkStackPage">
<property name="name">Color</property>
<property name="child">
<object class="GtkColorButton" id="source_color">
<object class="GtkColorDialogButton" id="source_color">
<accessibility>
<property name="label">Color Drag Source</property>
</accessibility>
<property name="dialog">
<object class="GtkColorDialog">
</object>
</property>
<property name="valign">center</property>
<property name="rgba">purple</property>
</object>
@@ -82,14 +99,17 @@
</style>
<child>
<object class="GtkToggleButton" id="image_rose">
<accessibility>
<property name="label">Photo Drag Source</property>
</accessibility>
<property name="active">1</property>
<child>
<object class="GtkDragSource">
<signal name="prepare" handler="drag_prepare"/>
</object>
</child>
<child>
<object class="GtkImage">
<accessibility>
<property name="label">Portland Rose Photo</property>
</accessibility>
<style>
<class name="large-icons"/>
</style>
@@ -100,6 +120,9 @@
</child>
<child>
<object class="GtkToggleButton" id="image_floppy">
<accessibility>
<property name="label">Icon Drag Source</property>
</accessibility>
<property name="group">image_rose</property>
<child>
<object class="GtkDragSource">
@@ -108,6 +131,9 @@
</child>
<child>
<object class="GtkImage">
<accessibility>
<property name="label">Floppy Buddy Icon</property>
</accessibility>
<style>
<class name="large-icons"/>
</style>
@@ -118,6 +144,9 @@
</child>
<child>
<object class="GtkToggleButton" id="image_logo">
<accessibility>
<property name="label">SVG Drag Source</property>
</accessibility>
<property name="group">image_floppy</property>
<child>
<object class="GtkDragSource">
@@ -126,6 +155,9 @@
</child>
<child>
<object class="GtkImage">
<accessibility>
<property name="label">gtk-demo logo</property>
</accessibility>
<style>
<class name="large-icons"/>
</style>
@@ -143,6 +175,9 @@
<property name="name">File</property>
<property name="child">
<object class="GtkButton" id="source_file">
<accessibility>
<property name="label">File Drag Source</property>
</accessibility>
<child>
<object class="GtkDragSource">
<property name="propagation-phase">capture</property>
@@ -162,6 +197,33 @@
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">Folder</property>
<property name="child">
<object class="GtkButton" id="source_folder">
<accessibility>
<property name="label">Folder Drag Source</property>
</accessibility>
<child>
<object class="GtkDragSource">
<property name="propagation-phase">capture</property>
<signal name="prepare" handler="drag_prepare"/>
</object>
</child>
<property name="valign">center</property>
<property name="child">
<object class="GtkLabel">
<property name="label">—</property>
<property name="xalign">0</property>
<property name="ellipsize">start</property>
</object>
</property>
<signal name="clicked" handler="open_folder_cb"/>
</object>
</property>
</object>
</child>
</object>
</child>
<child>
@@ -196,7 +258,7 @@
</object>
</child>
<child>
<object class="GtkLabel">
<object class="GtkLabel" id="paste_label">
<property name="xalign">0</property>
<binding name="label">
<lookup name="visible-child-name" type="GtkStack">
@@ -223,6 +285,9 @@
<property name="name">Text</property>
<property name="child">
<object class="GtkLabel">
<accessibility>
<relation name="labelled-by">paste_label</relation>
</accessibility>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="xalign">0</property>
@@ -236,6 +301,9 @@
<property name="name">Image</property>
<property name="child">
<object class="GtkImage">
<accessibility>
<relation name="labelled-by">paste_label</relation>
</accessibility>
<property name="halign">end</property>
<property name="valign">center</property>
<style>
@@ -254,6 +322,9 @@
<property name="valign">center</property>
<child>
<object class="GtkColorSwatch">
<accessibility>
<relation name="labelled-by">paste_label</relation>
</accessibility>
<property name="accessible-role">img</property>
<property name="can-focus">0</property>
<property name="selectable">0</property>
@@ -269,6 +340,9 @@
<property name="name">File</property>
<property name="child">
<object class="GtkLabel">
<accessibility>
<relation name="labelled-by">paste_label</relation>
</accessibility>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="xalign">0</property>

View File

@@ -449,7 +449,7 @@ do_combobox (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -277,7 +277,7 @@ do_constraints (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -66,7 +66,7 @@ do_constraints_builder (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -229,7 +229,7 @@ do_constraints_interactive (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -152,7 +152,7 @@ do_constraints_vfl (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -68,7 +68,7 @@ do_css_accordion (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -6,8 +6,6 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
show_parsing_error (GtkCssProvider *provider,
GtkCssSection *section,
@@ -49,20 +47,23 @@ css_text_changed (GtkTextBuffer *buffer,
gtk_text_buffer_remove_all_tags (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
gtk_css_provider_load_from_data (provider, text, -1);
gtk_css_provider_load_from_string (provider, text);
g_free (text);
}
static void
clear_provider (gpointer data)
{
GtkStyleProvider *provider = data;
gtk_style_context_remove_provider_for_display (gdk_display_get_default (), provider);
}
static void
apply_css (GtkWidget *widget, GtkStyleProvider *provider)
{
GtkWidget *child;
gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT);
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
apply_css (child, provider);
gtk_style_context_add_provider_for_display (gdk_display_get_default (), provider, G_MAXUINT);
g_object_set_data_full (G_OBJECT (widget), "provider", provider, clear_provider);
}
GtkWidget *
@@ -81,6 +82,7 @@ do_css_basics (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "CSS Basics");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
gtk_widget_add_css_class (window, "demo");
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
text = gtk_text_buffer_new (NULL);
@@ -115,7 +117,7 @@ do_css_basics (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -4,23 +4,24 @@
* anymore. :)
*/
/* This CSS resets all properties to their defaults values
* and overrides all user settings and the theme in use */
@import url("resource://css_basics/reset.css");
/* This resets all properties to their defaults values
* and overrides all user settings and the theme in use
*/
@import url("resource://css_shadows/reset.css");
/* Set a very futuristic style by default */
* {
.demo * {
color: green;
font-family: Monospace;
border: 1px solid;
}
window {
window.demo {
background-color: white;
}
/* Make sure selections are visible */
selection {
.demo selection {
background-color: darkGreen;
color: black;
}

View File

@@ -50,7 +50,7 @@ update_css_for_blend_mode (GtkCssProvider *provider,
blend_mode,
blend_mode);
gtk_css_provider_load_from_data (provider, css, -1);
gtk_css_provider_load_from_string (provider, css);
g_bytes_unref (bytes);
g_free (css);
@@ -139,7 +139,7 @@ do_css_blendmodes (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -6,8 +6,6 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
show_parsing_error (GtkCssProvider *provider,
GtkCssSection *section,
@@ -50,33 +48,23 @@ css_text_changed (GtkTextBuffer *buffer,
gtk_text_buffer_remove_all_tags (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
gtk_css_provider_load_from_data (provider, text, -1);
gtk_css_provider_load_from_string (provider, text);
g_free (text);
}
static void
drawing_area_draw (GtkDrawingArea *da,
cairo_t *cr,
int width,
int height,
gpointer data)
clear_provider (gpointer data)
{
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (da));
GtkStyleProvider *provider = data;
gtk_render_background (context, cr, 0, 0, width, height);
gtk_render_frame (context, cr, 0, 0, width, height);
gtk_style_context_remove_provider_for_display (gdk_display_get_default (), provider);
}
static void
apply_css (GtkWidget *widget, GtkStyleProvider *provider)
{
GtkWidget *child;
gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT);
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
apply_css (child, provider);
gtk_style_context_add_provider_for_display (gdk_display_get_default (), provider, G_MAXUINT);
g_object_set_data_full (G_OBJECT (widget), "provider", provider, clear_provider);
}
GtkWidget *
@@ -95,16 +83,17 @@ do_css_multiplebgs (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "Multiple Backgrounds");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
gtk_widget_add_css_class (window, "demo");
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
overlay = gtk_overlay_new ();
gtk_window_set_child (GTK_WINDOW (window), overlay);
child = gtk_drawing_area_new ();
/* Don't set a draw_func, since we are only interested in CSS drawing,
* which happens automatically.
*/
gtk_widget_set_name (child, "canvas");
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (child),
drawing_area_draw,
NULL, NULL);
gtk_overlay_set_child (GTK_OVERLAY (overlay), child);
child = gtk_button_new ();
@@ -155,7 +144,7 @@ do_css_multiplebgs (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -7,8 +7,6 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
show_parsing_error (GtkCssProvider *provider,
GtkCssSection *section,
@@ -51,20 +49,23 @@ css_text_changed (GtkTextBuffer *buffer,
gtk_text_buffer_remove_all_tags (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
gtk_css_provider_load_from_data (provider, text, -1);
gtk_css_provider_load_from_string (provider, text);
g_free (text);
}
static void
clear_provider (gpointer data)
{
GtkStyleProvider *provider = data;
gtk_style_context_remove_provider_for_display (gdk_display_get_default (), provider);
}
static void
apply_css (GtkWidget *widget, GtkStyleProvider *provider)
{
GtkWidget *child;
gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT);
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
apply_css (child, provider);
gtk_style_context_add_provider_for_display (gdk_display_get_default (), provider, G_MAXUINT);
g_object_set_data_full (G_OBJECT (widget), "provider", provider, clear_provider);
}
GtkWidget *
@@ -83,6 +84,7 @@ do_css_pixbufs (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "Animated Backgrounds");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
gtk_widget_add_css_class (window, "demo");
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
@@ -124,7 +126,7 @@ do_css_pixbufs (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -50,7 +50,7 @@
100% { background-size: 12px, 96px, 12px, 96px, 12px, 96px, 12px, 96px, auto; }
}
window {
window.demo {
background-image: url("resource://css_pixbufs/images/apple-red.png"),
url("resource://css_pixbufs/images/gnome-applets.png"),
url("resource://css_pixbufs/images/gnome-calendar.png"),
@@ -66,11 +66,11 @@ window {
}
/* Make the text editor has a nice style */
.view, scrollbar, separator {
window.demo .view, scrollbar, separator {
color: black;
background-color: rgba(255,255,255,0.5);
}
.view:selected {
window.demo .view:selected {
background-color: rgba(127,127,255,0.5);
}

View File

@@ -5,8 +5,6 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
show_parsing_error (GtkCssProvider *provider,
GtkCssSection *section,
@@ -48,20 +46,23 @@ css_text_changed (GtkTextBuffer *buffer,
gtk_text_buffer_remove_all_tags (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
gtk_css_provider_load_from_data (provider, text, -1);
gtk_css_provider_load_from_string (provider, text);
g_free (text);
}
static void
clear_provider (gpointer data)
{
GtkStyleProvider *provider = data;
gtk_style_context_remove_provider_for_display (gdk_display_get_default (), provider);
}
static void
apply_css (GtkWidget *widget, GtkStyleProvider *provider)
{
GtkWidget *child;
gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT);
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
apply_css (child, provider);
gtk_style_context_add_provider_for_display (gdk_display_get_default (), provider, G_MAXUINT);
g_object_set_data_full (G_OBJECT (widget), "provider", provider, clear_provider);
}
static GtkWidget *
@@ -101,6 +102,7 @@ do_css_shadows (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "Shadows");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
gtk_widget_add_css_class (window, "demo");
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
paned = gtk_paned_new (GTK_ORIENTATION_VERTICAL);
@@ -142,7 +144,7 @@ do_css_shadows (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_window_present (GTK_WINDOW (window));
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -5,12 +5,13 @@
*/
/* This CSS resets all properties to their defaults values
* and overrides all user settings and the theme in use */
* and overrides all user settings and the theme in use
*/
@import url("resource://css_shadows/reset.css");
@import url("resource://css_shadows/cssview.css");
/* Get a nice background for the window */
.background {
window.demo.background {
background-color: #4870bc;
background-image: linear-gradient(to left, transparent, rgba(255,255,255,.07) 50%, transparent 50%),
linear-gradient(to left, transparent, rgba(255,255,255,.13) 50%, transparent 50%),
@@ -19,7 +20,7 @@
background-size: 29px, 59px, 73px, 109px;
}
button {
window.demo button {
color: black;
padding: 10px;
border-radius: 5px;
@@ -27,18 +28,15 @@ button {
border: 1px transparent solid;
}
button:hover {
window.demo button:hover {
text-shadow: 3px 3px 5px alpha(black, 0.75);
-gtk-icon-shadow: 3px 3px 5px alpha(black, 0.75);
box-shadow: 3px 3px 5px alpha(black, 0.5) inset;
border: solid 1px alpha(black, 0.75);
}
button:active {
window.demo button:active {
padding: 11px 9px 9px 11px;
text-shadow: 1px 1px 2.5px alpha(black, 0.6);
-gtk-icon-shadow: 1px 1px 2.5px alpha(black, 0.6);
}

View File

@@ -1,21 +1,21 @@
/* Make the text editor has a nice style */
.view {
window.demo .view {
color: #2e3436;
font-family: Monospace;
background-color: alpha(white, 0.30);
}
.view:selected {
window.demo .view:selected {
color: white;
background-color: #4a90d9;
}
scrollbar trough,
window.demo scrollbar trough,
.scrollbars-junction {
background-color: alpha(white, 0.80);
}
scrollbar slider {
window.demo scrollbar slider {
border-width: 3px;
border-style: solid;
border-radius: 10px;
@@ -24,11 +24,11 @@ scrollbar slider {
background-color: #999;
}
scrollbar slider:hover {
window.demo scrollbar slider:hover {
background-color: #555;
}
paned separator {
window.demo paned separator {
background-color: alpha(white, 0.80);
background-image: linear-gradient(transparent, transparent 1px, #999 1px, #999 4px, transparent 4px);
background-size: 40px auto;
@@ -36,6 +36,6 @@ paned separator {
background-position: center;
}
paned separator:hover {
window.demo paned separator:hover {
background-image: linear-gradient(transparent, transparent 1px, #555 1px, #555 4px, transparent 4px);
}

View File

@@ -33,7 +33,7 @@ do_cursors (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -43,7 +43,7 @@
<file>cssview.css</file>
<file>reset.css</file>
</gresource>
<gresource prefix="/dropdown">
<gresource prefix="/listview_selections">
<file>suggestionentry.h</file>
<file>suggestionentry.c</file>
<file>suggestionentry.css</file>
@@ -195,6 +195,9 @@
<gresource prefix="/listview_settings">
<file>listview_settings.ui</file>
</gresource>
<gresource prefix="/listview_settings2">
<file>listview_settings2.ui</file>
</gresource>
<gresource prefix="/listview_ucd_data/">
<file>ucdnames.data</file>
</gresource>
@@ -215,6 +218,12 @@
<file>demo3widget.h</file>
<file>demo3widget.ui</file>
</gresource>
<gresource prefix="/mask">
<file>demo4widget.c</file>
<file>demo4widget.h</file>
<file>hsla.h</file>
<file>hsla.c</file>
</gresource>
<gresource prefix="/paintable_svg">
<file>svgpaintable.h</file>
<file>svgpaintable.c</file>
@@ -268,7 +277,6 @@
<file>cursors.c</file>
<file>dialog.c</file>
<file>drawingarea.c</file>
<file>dropdown.c</file>
<file>dnd.c</file>
<file>editable_cells.c</file>
<file>entry_completion.c</file>
@@ -292,6 +300,7 @@
<file>iconscroll.c</file>
<file>iconview.c</file>
<file>iconview_edit.c</file>
<file>image_scaling.c</file>
<file>images.c</file>
<file>infobar.c</file>
<file>layoutmanager.c</file>
@@ -304,14 +313,16 @@
<file>listview_clocks.c</file>
<file>listview_filebrowser.c</file>
<file>listview_minesweeper.c</file>
<file>listview_selections.c</file>
<file>listview_settings.c</file>
<file>listview_settings2.c</file>
<file>listview_ucd.c</file>
<file>listview_weather.c</file>
<file>listview_words.c</file>
<file>list_store.c</file>
<file>main.c</file>
<file>markup.c</file>
<file>menu.c</file>
<file>mask.c</file>
<file>overlay.c</file>
<file>overlay_decorative.c</file>
<file>paint.c</file>

View File

@@ -208,7 +208,13 @@
</object>
</child>
<child>
<object class="GtkStatusbar" id="statusbar1"/>
<object class="GtkLabel" id="statusbar1">
<property name="xalign">0</property>
<property name="margin-start">2</property>
<property name="margin-end">2</property>
<property name="margin-top">2</property>
<property name="margin-bottom">2</property>
</object>
</child>
</object>
</child>

View File

@@ -3,16 +3,20 @@
enum
{
PROP_PAINTABLE = 1,
PROP_SCALE
PROP_TEXTURE = 1,
PROP_FILTER,
PROP_SCALE,
PROP_ANGLE,
};
struct _Demo3Widget
{
GtkWidget parent_instance;
GdkPaintable *paintable;
GdkTexture *texture;
float scale;
float angle;
GskScalingFilter filter;
GtkWidget *menu;
};
@@ -24,10 +28,86 @@ struct _Demo3WidgetClass
G_DEFINE_TYPE (Demo3Widget, demo3_widget, GTK_TYPE_WIDGET)
static gboolean
query_tooltip (GtkWidget *widget,
int x,
int y,
gboolean keyboard_mode,
GtkTooltip *tooltip,
gpointer data)
{
Demo3Widget *self = DEMO3_WIDGET (widget);
GtkWidget *grid;
GtkWidget *label;
char *s, *s2;
const char *filter[] = { "Linear", "Nearest", "Trilinear" };
int precision, l;
grid = gtk_grid_new ();
gtk_grid_set_column_spacing (GTK_GRID (grid), 12);
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
label = gtk_label_new ("Texture");
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
s = g_strdup_printf ("%d\342\200\206\303\227\342\200\206%d",
gdk_texture_get_width (self->texture),
gdk_texture_get_height (self->texture));
label = gtk_label_new (s);
g_free (s);
gtk_label_set_xalign (GTK_LABEL (label), 1);
gtk_grid_attach (GTK_GRID (grid), label, 1, 0, 1, 1);
label = gtk_label_new ("Rotation");
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);
s = g_strdup_printf ("%.1f", self->angle);
if (g_str_has_suffix (s, ".0"))
s[strlen (s) - 2] = '\0';
s2 = g_strconcat (s, "\302\260", NULL);
label = gtk_label_new (s2);
g_free (s2);
g_free (s);
gtk_label_set_xalign (GTK_LABEL (label), 1);
gtk_grid_attach (GTK_GRID (grid), label, 1, 1, 1, 1);
label = gtk_label_new ("Scale");
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_grid_attach (GTK_GRID (grid), label, 0, 2, 1, 1);
precision = 1;
do {
s = g_strdup_printf ("%.*f", precision, self->scale);
l = strlen (s) - 1;
while (s[l] == '0')
l--;
if (s[l] == '.')
s[l] = '\0';
precision++;
} while (strcmp (s, "0") == 0);
label = gtk_label_new (s);
g_free (s);
gtk_label_set_xalign (GTK_LABEL (label), 1);
gtk_grid_attach (GTK_GRID (grid), label, 1, 2, 1, 1);
label = gtk_label_new ("Filter");
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_grid_attach (GTK_GRID (grid), label, 0, 3, 1, 1);
label = gtk_label_new (filter[self->filter]);
gtk_label_set_xalign (GTK_LABEL (label), 1);
gtk_grid_attach (GTK_GRID (grid), label, 1, 3, 1, 1);
gtk_tooltip_set_custom (tooltip, grid);
return TRUE;
}
static void
demo3_widget_init (Demo3Widget *self)
{
self->scale = 1.f;
self->angle = 0.f;
self->filter = GSK_SCALING_FILTER_LINEAR;
gtk_widget_init_template (GTK_WIDGET (self));
}
@@ -36,7 +116,7 @@ demo3_widget_dispose (GObject *object)
{
Demo3Widget *self = DEMO3_WIDGET (object);
g_clear_object (&self->paintable);
g_clear_object (&self->texture);
gtk_widget_dispose_template (GTK_WIDGET (self), DEMO3_TYPE_WIDGET);
@@ -49,21 +129,35 @@ demo3_widget_snapshot (GtkWidget *widget,
{
Demo3Widget *self = DEMO3_WIDGET (widget);
int x, y, width, height;
double w, h;
double w, h, w2, h2;
width = gtk_widget_get_width (widget);
height = gtk_widget_get_height (widget);
w = self->scale * gdk_paintable_get_intrinsic_width (self->paintable);
h = self->scale * gdk_paintable_get_intrinsic_height (self->paintable);
w2 = w = self->scale * gdk_texture_get_width (self->texture);
h2 = h = self->scale * gdk_texture_get_height (self->texture);
x = MAX (0, (width - ceil (w)) / 2);
y = MAX (0, (height - ceil (h)) / 2);
if (G_APPROX_VALUE (self->angle, 90.f, FLT_EPSILON) ||
G_APPROX_VALUE (self->angle, 270.f, FLT_EPSILON))
{
double s = w2;
w2 = h2;
h2 = s;
}
x = (width - ceil (w2)) / 2;
y = (height - ceil (h2)) / 2;
gtk_snapshot_push_clip (snapshot, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_save (snapshot);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
gdk_paintable_snapshot (self->paintable, snapshot, w, h);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (w2 / 2, h2 / 2));
gtk_snapshot_rotate (snapshot, self->angle);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (- w / 2, - h / 2));
gtk_snapshot_append_scaled_texture (snapshot,
self->texture,
self->filter,
&GRAPHENE_RECT_INIT (0, 0, w, h));
gtk_snapshot_restore (snapshot);
gtk_snapshot_pop (snapshot);
}
@@ -78,14 +172,26 @@ demo3_widget_measure (GtkWidget *widget,
int *natural_baseline)
{
Demo3Widget *self = DEMO3_WIDGET (widget);
int width, height;
int size;
if (orientation == GTK_ORIENTATION_HORIZONTAL)
size = gdk_paintable_get_intrinsic_width (self->paintable);
else
size = gdk_paintable_get_intrinsic_height (self->paintable);
width = gdk_texture_get_width (self->texture);
height = gdk_texture_get_height (self->texture);
*minimum = *natural = self->scale * size;
if (G_APPROX_VALUE (self->angle, 90.f, FLT_EPSILON) ||
G_APPROX_VALUE (self->angle, 270.f, FLT_EPSILON))
{
int s = width;
width = height;
height = s;
}
if (orientation == GTK_ORIENTATION_HORIZONTAL)
size = width;
else
size = height;
*minimum = *natural = (int) ceil (self->scale * size);
}
static void
@@ -103,6 +209,8 @@ demo3_widget_size_allocate (GtkWidget *widget,
gtk_popover_present (GTK_POPOVER (self->menu));
}
static void update_actions (Demo3Widget *self);
static void
demo3_widget_set_property (GObject *object,
guint prop_id,
@@ -113,14 +221,32 @@ demo3_widget_set_property (GObject *object,
switch (prop_id)
{
case PROP_PAINTABLE:
g_clear_object (&self->paintable);
self->paintable = g_value_dup_object (value);
case PROP_TEXTURE:
g_clear_object (&self->texture);
self->texture = g_value_dup_object (value);
self->scale = 1.f;
self->angle = 0.f;
self->filter = GSK_SCALING_FILTER_LINEAR;
update_actions (self);
gtk_widget_queue_resize (GTK_WIDGET (object));
g_object_notify (object, "scale");
g_object_notify (object, "angle");
g_object_notify (object, "filter");
break;
case PROP_SCALE:
self->scale = g_value_get_float (value);
update_actions (self);
gtk_widget_queue_resize (GTK_WIDGET (object));
break;
case PROP_ANGLE:
self->angle = fmodf (g_value_get_float (value), 360.f);
gtk_widget_queue_resize (GTK_WIDGET (object));
break;
case PROP_FILTER:
self->filter = g_value_get_enum (value);
gtk_widget_queue_resize (GTK_WIDGET (object));
break;
@@ -140,14 +266,22 @@ demo3_widget_get_property (GObject *object,
switch (prop_id)
{
case PROP_PAINTABLE:
g_value_set_object (value, self->paintable);
case PROP_TEXTURE:
g_value_set_object (value, self->texture);
break;
case PROP_SCALE:
g_value_set_float (value, self->scale);
break;
case PROP_ANGLE:
g_value_set_float (value, self->angle);
break;
case PROP_FILTER:
g_value_set_enum (value, self->filter);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -169,6 +303,14 @@ pressed_cb (GtkGestureClick *gesture,
gtk_popover_popup (GTK_POPOVER (self->menu));
}
static void
update_actions (Demo3Widget *self)
{
gtk_widget_action_set_enabled (GTK_WIDGET (self), "zoom.in", self->scale < 1024.);
gtk_widget_action_set_enabled (GTK_WIDGET (self), "zoom.out", self->scale > 1./1024.);
gtk_widget_action_set_enabled (GTK_WIDGET (self), "zoom.reset", self->scale != 1.);
}
static void
zoom_cb (GtkWidget *widget,
const char *action_name,
@@ -178,19 +320,30 @@ zoom_cb (GtkWidget *widget,
float scale;
if (g_str_equal (action_name, "zoom.in"))
scale = MIN (10, self->scale * M_SQRT2);
scale = MIN (1024., self->scale * M_SQRT2);
else if (g_str_equal (action_name, "zoom.out"))
scale = MAX (0.01, self->scale / M_SQRT2);
else
scale = MAX (1./1024., self->scale / M_SQRT2);
else if (g_str_equal (action_name, "zoom.reset"))
scale = 1.0;
gtk_widget_action_set_enabled (widget, "zoom.in", scale < 10);
gtk_widget_action_set_enabled (widget, "zoom.out", scale > 0.01);
gtk_widget_action_set_enabled (widget, "zoom.reset", scale != 1);
else
g_assert_not_reached ();
g_object_set (widget, "scale", scale, NULL);
}
static void
rotate_cb (GtkWidget *widget,
const char *action_name,
GVariant *parameter)
{
Demo3Widget *self = DEMO3_WIDGET (widget);
int angle;
g_variant_get (parameter, "i", &angle);
g_object_set (widget, "angle", fmodf (self->angle + angle, 360.f), NULL);
}
static void
demo3_widget_class_init (Demo3WidgetClass *class)
{
@@ -205,40 +358,55 @@ demo3_widget_class_init (Demo3WidgetClass *class)
widget_class->measure = demo3_widget_measure;
widget_class->size_allocate = demo3_widget_size_allocate;
g_object_class_install_property (object_class, PROP_PAINTABLE,
g_param_spec_object ("paintable", "Paintable", "Paintable",
GDK_TYPE_PAINTABLE,
g_object_class_install_property (object_class, PROP_TEXTURE,
g_param_spec_object ("texture", NULL, NULL,
GDK_TYPE_TEXTURE,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_SCALE,
g_param_spec_float ("scale", "Scale", "Scale",
0.0, 10.0, 1.0,
g_param_spec_float ("scale", NULL, NULL,
1./1024., 1024., 1.0,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_ANGLE,
g_param_spec_float ("angle", NULL, NULL,
0.0, 360.0, 0.0,
G_PARAM_READWRITE));
g_object_class_install_property (object_class, PROP_FILTER,
g_param_spec_enum ("filter", NULL, NULL,
GSK_TYPE_SCALING_FILTER, GSK_SCALING_FILTER_LINEAR,
G_PARAM_READWRITE));
/* These are the actions that we are using in the menu */
gtk_widget_class_install_action (widget_class, "zoom.in", NULL, zoom_cb);
gtk_widget_class_install_action (widget_class, "zoom.out", NULL, zoom_cb);
gtk_widget_class_install_action (widget_class, "zoom.reset", NULL, zoom_cb);
gtk_widget_class_install_action (widget_class, "rotate", "i", rotate_cb);
gtk_widget_class_set_template_from_resource (widget_class, "/menu/demo3widget.ui");
gtk_widget_class_bind_template_child (widget_class, Demo3Widget, menu);
gtk_widget_class_bind_template_callback (widget_class, pressed_cb);
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_IMG);
}
GtkWidget *
demo3_widget_new (const char *resource)
{
Demo3Widget *self;
GdkPixbuf *pixbuf;
GdkPaintable *paintable;
GdkTexture *texture;
pixbuf = gdk_pixbuf_new_from_resource (resource, NULL);
paintable = GDK_PAINTABLE (gdk_texture_new_for_pixbuf (pixbuf));
texture = gdk_texture_new_from_resource (resource);
self = g_object_new (DEMO3_TYPE_WIDGET, "paintable", paintable, NULL);
self = g_object_new (DEMO3_TYPE_WIDGET,
"texture", texture,
"has-tooltip", TRUE,
NULL);
g_object_unref (pixbuf);
g_object_unref (paintable);
g_signal_connect (self, "query-tooltip", G_CALLBACK (query_tooltip), NULL);
g_object_unref (texture);
return GTK_WIDGET (self);
}

View File

@@ -12,10 +12,21 @@
<attribute name="label">11</attribute>
<attribute name="action">zoom.reset</attribute>
</item>
<item>
<attribute name="label">Rotate</attribute>
<attribute name="action">rotate</attribute>
<attribute name="target" type="i">90</attribute>
</item>
</menu>
<template class="Demo3Widget">
<accessibility>
<property name="label">Demo image</property>
</accessibility>
<child>
<object class="GtkPopoverMenu" id="menu">
<accessibility>
<property name="label">Context menu</property>
</accessibility>
<property name="has-arrow">0</property>
<property name="menu-model">model</property>
</object>

View File

@@ -0,0 +1,226 @@
#include <math.h>
#include "demo4widget.h"
#include "hsla.h"
enum
{
PROP_0,
PROP_PROGRESS,
};
struct _Demo4Widget
{
GtkWidget parent_instance;
PangoLayout *layout;
GskColorStop stops[8];
gsize n_stops;
double progress;
guint tick;
};
struct _Demo4WidgetClass
{
GtkWidgetClass parent_class;
};
G_DEFINE_TYPE (Demo4Widget, demo4_widget, GTK_TYPE_WIDGET)
static void
rotate_color (GdkRGBA *rgba)
{
GdkHSLA hsla;
_gdk_hsla_init_from_rgba (&hsla, rgba);
hsla.hue -= 1;
_gdk_rgba_init_from_hsla (rgba, &hsla);
}
static gboolean
rotate_colors (GtkWidget *widget,
GdkFrameClock *clock,
gpointer user_data)
{
Demo4Widget *self = DEMO4_WIDGET (widget);
for (unsigned int i = 0; i < self->n_stops; i++)
rotate_color (&self->stops[i].color);
gtk_widget_queue_draw (widget);
return G_SOURCE_CONTINUE;
}
static void
demo4_widget_init (Demo4Widget *self)
{
PangoFontDescription *desc;
self->progress = 0.5;
self->n_stops = 8;
self->stops[0].offset = 0;
self->stops[0].color = (GdkRGBA) { 1, 0, 0, 1 };
for (unsigned int i = 1; i < self->n_stops; i++)
{
GdkHSLA hsla;
self->stops[i].offset = i / (double)(self->n_stops - 1);
_gdk_hsla_init_from_rgba (&hsla, &self->stops[i - 1].color);
hsla.hue += 360.0 / (double)(self->n_stops - 1);
_gdk_rgba_init_from_hsla (&self->stops[i].color, &hsla);
}
self->layout = gtk_widget_create_pango_layout (GTK_WIDGET (self), "123");
desc = pango_font_description_from_string ("Cantarell Bold 210");
pango_layout_set_font_description (self->layout, desc);
pango_font_description_free (desc);
self->tick = gtk_widget_add_tick_callback (GTK_WIDGET (self), rotate_colors, NULL, NULL);
}
static void
demo4_widget_dispose (GObject *object)
{
Demo4Widget *self = DEMO4_WIDGET (object);
g_clear_object (&self->layout);
gtk_widget_remove_tick_callback (GTK_WIDGET (self), self->tick);
G_OBJECT_CLASS (demo4_widget_parent_class)->dispose (object);
}
static void
demo4_widget_snapshot_content (GtkWidget *widget,
GtkSnapshot *snapshot,
GskMaskMode mode)
{
Demo4Widget *self = DEMO4_WIDGET (widget);
int width, height, layout_width, layout_height;
double scale;
width = gtk_widget_get_width (widget);
height = gtk_widget_get_height (widget);
gtk_snapshot_push_mask (snapshot, mode);
pango_layout_get_pixel_size (self->layout, &layout_width, &layout_height);
scale = MIN ((double) width / layout_width, (double) height / layout_height);
gtk_snapshot_translate (snapshot,
&GRAPHENE_POINT_INIT ((width - scale * layout_width) / 2,
(height - scale * layout_height) / 2));
gtk_snapshot_scale (snapshot, scale, scale);
gtk_snapshot_append_layout (snapshot, self->layout, &(GdkRGBA) { 0, 0, 0, 1 });
gtk_snapshot_pop (snapshot);
gtk_snapshot_append_linear_gradient (snapshot,
&GRAPHENE_RECT_INIT (0, 0, width, height),
&GRAPHENE_POINT_INIT (0, 0),
&GRAPHENE_POINT_INIT (width, height),
self->stops,
self->n_stops);
gtk_snapshot_pop (snapshot);
}
static void
demo4_widget_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
Demo4Widget *self = DEMO4_WIDGET (widget);
int width, height;
width = gtk_widget_get_width (widget);
height = gtk_widget_get_height (widget);
gtk_snapshot_push_mask (snapshot, GSK_MASK_MODE_INVERTED_LUMINANCE);
gtk_snapshot_append_linear_gradient (snapshot,
&GRAPHENE_RECT_INIT (0, 0, width, height),
&GRAPHENE_POINT_INIT (0, 0),
&GRAPHENE_POINT_INIT (width, 0),
(GskColorStop[2]) {
{ MAX (0.0, self->progress - 5.0 / width), { 1, 1, 1, 1 } },
{ MIN (1.0, self->progress + 5.0 / width), { 0, 0, 0, 1 } }
}, 2);
gtk_snapshot_pop (snapshot);
demo4_widget_snapshot_content (widget, snapshot, GSK_MASK_MODE_INVERTED_ALPHA);
gtk_snapshot_pop (snapshot);
gtk_snapshot_push_mask (snapshot, GSK_MASK_MODE_LUMINANCE);
gtk_snapshot_append_linear_gradient (snapshot,
&GRAPHENE_RECT_INIT (0, 0, width, height),
&GRAPHENE_POINT_INIT (0, 0),
&GRAPHENE_POINT_INIT (width, 0),
(GskColorStop[2]) {
{ MAX (0.0, self->progress - 5.0 / width), { 1, 1, 1, 1 } },
{ MIN (1.0, self->progress + 5.0 / width), { 0, 0, 0, 1 } }
}, 2);
gtk_snapshot_pop (snapshot);
demo4_widget_snapshot_content (widget, snapshot, GSK_MASK_MODE_ALPHA);
gtk_snapshot_pop (snapshot);
}
static void
demo4_widget_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
Demo4Widget *self = DEMO4_WIDGET (object);
switch (prop_id)
{
case PROP_PROGRESS:
self->progress = g_value_get_double (value);
gtk_widget_queue_draw (GTK_WIDGET (object));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
demo4_widget_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
Demo4Widget *self = DEMO4_WIDGET (object);
switch (prop_id)
{
case PROP_PROGRESS:
g_value_set_double (value, self->progress);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
demo4_widget_class_init (Demo4WidgetClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
object_class->dispose = demo4_widget_dispose;
object_class->get_property = demo4_widget_get_property;
object_class->set_property = demo4_widget_set_property;
widget_class->snapshot = demo4_widget_snapshot;
g_object_class_install_property (object_class, PROP_PROGRESS,
g_param_spec_double ("progress", NULL, NULL,
0.0, 1.0, 0.5,
G_PARAM_READWRITE));
}
GtkWidget *
demo4_widget_new (void)
{
return g_object_new (DEMO4_TYPE_WIDGET, NULL);
}

View File

@@ -0,0 +1,8 @@
#pragma once
#include <gtk/gtk.h>
#define DEMO4_TYPE_WIDGET (demo4_widget_get_type ())
G_DECLARE_FINAL_TYPE (Demo4Widget, demo4_widget, DEMO4, WIDGET, GtkWidget)
GtkWidget * demo4_widget_new (void);

View File

@@ -8,6 +8,8 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *window = NULL;
static GtkWidget *entry1 = NULL;
static GtkWidget *entry2 = NULL;
@@ -27,7 +29,7 @@ message_dialog_clicked (GtkButton *button,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
ngettext ("Has been shown once", "Has been shown %d times", i), i);
g_signal_connect (dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
gtk_window_present (GTK_WINDOW (dialog));
i++;
}
@@ -114,7 +116,7 @@ interactive_dialog_clicked (GtkButton *button,
data, (GClosureNotify) g_free,
0);
gtk_widget_show (dialog);
gtk_window_present (GTK_WINDOW (dialog));
}
GtkWidget *
@@ -184,7 +186,7 @@ do_dialog (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -70,7 +70,7 @@ set_color (CanvasItem *item,
css = g_strdup_printf ("#%s { background: %s; }", name, str);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, css, -1);
gtk_css_provider_load_from_string (provider, css);
gtk_style_context_add_provider_for_display (gtk_widget_get_display (item->label), GTK_STYLE_PROVIDER (provider), 700);
item->provider = GTK_STYLE_PROVIDER (provider);
@@ -109,15 +109,21 @@ static void
apply_transform (CanvasItem *item)
{
GskTransform *transform;
graphene_rect_t bounds;
double x, y;
x = gtk_widget_get_allocated_width (item->label) / 2.0;
y = gtk_widget_get_allocated_height (item->label) / 2.0;
item->r = sqrt (x*x + y*y);
/* Add css padding and margin */
if (!gtk_widget_compute_bounds (item->label, item->label, &bounds))
return;
x = bounds.size.width / 2.;
y = bounds.size.height / 2.;
item->r = sqrt (x * x + y * y);
transform = gsk_transform_translate (NULL, &(graphene_point_t) { item->r, item->r });
transform = gsk_transform_rotate (transform, item->angle + item->delta);
transform = gsk_transform_translate (transform, &(graphene_point_t) { -x, -y });
transform = gsk_transform_translate (transform, &GRAPHENE_POINT_INIT (-x, -y));
gtk_fixed_set_child_transform (GTK_FIXED (item->fixed), item->label, transform);
gsk_transform_unref (transform);
@@ -156,27 +162,39 @@ click_done (GtkGesture *gesture)
gtk_widget_insert_after (item, canvas, last_child);
}
/* GtkSettings treats `GTK_THEME=foo:dark` as theme name `foo`, variant `dark`,
* and our embedded CSS files let `foo-dark` work as an alias for `foo:dark`. */
static gboolean
has_dark_suffix (const char *theme)
{
return g_str_has_suffix (theme, ":dark") ||
g_str_has_suffix (theme, "-dark");
}
/* So we can make a good guess whether the current theme is dark by checking for
* either: it is suffixed `[:-]dark`, or Settings:…prefer-dark-theme is TRUE. */
static gboolean
theme_is_dark (void)
{
const char *env_theme;
GtkSettings *settings;
char *theme;
gboolean prefer_dark;
gboolean dark;
/* Like GtkSettings, 1st see if theme is overridden by environment variable */
env_theme = g_getenv ("GTK_THEME");
if (env_theme != NULL)
return has_dark_suffix (env_theme);
/* If not, test Settings:…theme-name in the same way OR :…prefer-dark-theme */
settings = gtk_settings_get_default ();
g_object_get (settings,
"gtk-theme-name", &theme,
"gtk-application-prefer-dark-theme", &prefer_dark,
NULL);
if ((strcmp (theme, "Adwaita") == 0 && prefer_dark) || strcmp (theme, "HighContrastInverse") == 0)
dark = TRUE;
else
dark = FALSE;
dark = prefer_dark || has_dark_suffix (theme);
g_free (theme);
return dark;
}
@@ -324,7 +342,7 @@ canvas_item_start_editing (CanvasItem *item)
GtkWidget *canvas = gtk_widget_get_parent (GTK_WIDGET (item));
GtkWidget *entry;
GtkWidget *scale;
double x, y;
graphene_point_t p;
if (item->editor)
return;
@@ -350,12 +368,17 @@ canvas_item_start_editing (CanvasItem *item)
gtk_box_append (GTK_BOX (item->editor), scale);
gtk_widget_translate_coordinates (GTK_WIDGET (item), canvas, 0, 0, &x, &y);
gtk_fixed_put (GTK_FIXED (canvas), item->editor, x, y + 2 * item->r);
if (!gtk_widget_compute_point (GTK_WIDGET (item), canvas, &GRAPHENE_POINT_INIT (0, 0), &p))
graphene_point_init (&p, 0, 0);
gtk_fixed_put (GTK_FIXED (canvas), item->editor, p.x, p.y + 2 * item->r);
gtk_widget_grab_focus (entry);
}
typedef struct {
double x, y;
} Hotspot;
static GdkContentProvider *
prepare (GtkDragSource *source,
double x,
@@ -363,6 +386,8 @@ prepare (GtkDragSource *source,
{
GtkWidget *canvas;
GtkWidget *item;
Hotspot *hotspot;
graphene_point_t p;
canvas = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (source));
item = gtk_widget_pick (canvas, x, y, GTK_PICK_DEFAULT);
@@ -373,6 +398,13 @@ prepare (GtkDragSource *source,
g_object_set_data (G_OBJECT (canvas), "dragged-item", item);
hotspot = g_new (Hotspot, 1);
if (!gtk_widget_compute_point (canvas, item, &GRAPHENE_POINT_INIT (x, y), &p))
graphene_point_init (&p, x, y);
hotspot->x = p.x;
hotspot->y = p.y;
g_object_set_data_full (G_OBJECT (canvas), "hotspot", hotspot, g_free);
return gdk_content_provider_new_typed (GTK_TYPE_WIDGET, item);
}
@@ -383,12 +415,14 @@ drag_begin (GtkDragSource *source,
GtkWidget *canvas;
CanvasItem *item;
GdkPaintable *paintable;
Hotspot *hotspot;
canvas = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (source));
item = CANVAS_ITEM (g_object_get_data (G_OBJECT (canvas), "dragged-item"));
hotspot = (Hotspot *) g_object_get_data (G_OBJECT (canvas), "hotspot");
paintable = canvas_item_get_drag_icon (item);
gtk_drag_source_set_icon (source, paintable, item->r, item->r);
gtk_drag_source_set_icon (source, paintable, hotspot->x, hotspot->y);
g_object_unref (paintable);
gtk_widget_set_opacity (GTK_WIDGET (item), 0.3);
@@ -726,7 +760,7 @@ do_dnd (GtkWidget *do_widget)
GtkCssProvider *provider;
GString *css;
button = gtk_color_button_new ();
button = gtk_color_dialog_button_new (gtk_color_dialog_new ());
g_object_unref (g_object_ref_sink (button));
provider = gtk_css_provider_new ();
@@ -741,7 +775,7 @@ do_dnd (GtkWidget *do_widget)
g_string_append_printf (css, ".canvasitem.%s { background: %s; }\n", colors[i], colors[i]);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, css->str, css->len);
gtk_css_provider_load_from_string (provider, css->str);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
800);
@@ -800,7 +834,7 @@ do_dnd (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -334,11 +334,17 @@ do_drawingarea (GtkWidget *do_widget)
gtk_widget_set_vexpand (frame, TRUE);
gtk_box_append (GTK_BOX (vbox), frame);
da = gtk_drawing_area_new ();
da = g_object_new (GTK_TYPE_DRAWING_AREA,
"accessible-role", GTK_ACCESSIBLE_ROLE_IMG,
NULL);
gtk_frame_set_child (GTK_FRAME (frame), da);
gtk_accessible_update_relation (GTK_ACCESSIBLE (da),
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
-1);
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 100);
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), 100);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), groups_draw, NULL, NULL);
gtk_frame_set_child (GTK_FRAME (frame), da);
/*
* Create the scribble area
@@ -352,17 +358,23 @@ do_drawingarea (GtkWidget *do_widget)
gtk_widget_set_vexpand (frame, TRUE);
gtk_box_append (GTK_BOX (vbox), frame);
da = gtk_drawing_area_new ();
da = g_object_new (GTK_TYPE_DRAWING_AREA,
"accessible-role", GTK_ACCESSIBLE_ROLE_IMG,
NULL);
gtk_frame_set_child (GTK_FRAME (frame), da);
gtk_accessible_update_relation (GTK_ACCESSIBLE (da),
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
-1);
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 100);
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), 100);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), scribble_draw, NULL, NULL);
gtk_frame_set_child (GTK_FRAME (frame), da);
g_signal_connect (da, "resize",
G_CALLBACK (scribble_resize), NULL);
drag = gtk_gesture_drag_new ();
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (drag), GDK_BUTTON_PRIMARY);
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (drag), 0);
gtk_widget_add_controller (da, GTK_EVENT_CONTROLLER (drag));
g_signal_connect (drag, "drag-begin", G_CALLBACK (drag_begin), da);
@@ -372,7 +384,7 @@ do_drawingarea (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_window_present (GTK_WINDOW (window));
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -409,7 +409,7 @@ do_editable_cells (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -95,6 +95,13 @@ do_entry_completion (GtkWidget *do_widget)
entry = gtk_entry_new ();
gtk_box_append (GTK_BOX (vbox), entry);
gtk_accessible_update_relation (GTK_ACCESSIBLE (entry),
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
-1);
gtk_accessible_update_property (GTK_ACCESSIBLE (entry),
GTK_ACCESSIBLE_PROPERTY_AUTOCOMPLETE, GTK_ACCESSIBLE_AUTOCOMPLETE_LIST,
-1);
/* Create the completion object */
completion = gtk_entry_completion_new ();
@@ -115,7 +122,7 @@ do_entry_completion (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -43,10 +43,14 @@ do_entry_undo (GtkWidget *do_widget)
entry = gtk_entry_new ();
gtk_editable_set_enable_undo (GTK_EDITABLE (entry), TRUE);
gtk_box_append (GTK_BOX (vbox), entry);
gtk_accessible_update_relation (GTK_ACCESSIBLE (entry),
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
-1);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -22,11 +22,15 @@ validate_more_details (GtkEntry *entry,
{
gtk_widget_set_tooltip_text (GTK_WIDGET (entry), "Must have details first");
gtk_widget_add_css_class (GTK_WIDGET (entry), "error");
gtk_accessible_update_state (GTK_ACCESSIBLE (entry),
GTK_ACCESSIBLE_STATE_INVALID, GTK_ACCESSIBLE_INVALID_TRUE,
-1);
}
else
{
gtk_widget_set_tooltip_text (GTK_WIDGET (entry), "");
gtk_widget_remove_css_class (GTK_WIDGET (entry), "error");
gtk_accessible_reset_state (GTK_ACCESSIBLE (entry), GTK_ACCESSIBLE_STATE_INVALID);
}
}
@@ -42,12 +46,20 @@ mode_switch_state_set (GtkSwitch *sw,
if (!state ||
(gtk_range_get_value (GTK_RANGE (scale)) > 50))
{
gtk_widget_hide (label);
gtk_widget_set_visible (label, FALSE);
gtk_switch_set_state (sw, state);
gtk_accessible_reset_relation (GTK_ACCESSIBLE (sw), GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE);
gtk_accessible_reset_state (GTK_ACCESSIBLE (sw), GTK_ACCESSIBLE_STATE_INVALID);
}
else
{
gtk_widget_show (label);
gtk_widget_set_visible (label, TRUE);
gtk_accessible_update_relation (GTK_ACCESSIBLE (sw),
GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE, label,
-1);
gtk_accessible_update_state (GTK_ACCESSIBLE (sw),
GTK_ACCESSIBLE_STATE_INVALID, GTK_ACCESSIBLE_INVALID_TRUE,
-1);
}
return TRUE;
@@ -65,7 +77,7 @@ level_scale_value_changed (GtkRange *range,
!gtk_switch_get_state (GTK_SWITCH (sw)) &&
(gtk_range_get_value (range) > 50))
{
gtk_widget_hide (label);
gtk_widget_set_visible (label, FALSE);
gtk_switch_set_state (GTK_SWITCH (sw), TRUE);
}
else if (gtk_switch_get_state (GTK_SWITCH (sw)) &&
@@ -73,6 +85,9 @@ level_scale_value_changed (GtkRange *range,
{
gtk_switch_set_state (GTK_SWITCH (sw), FALSE);
}
gtk_accessible_reset_relation (GTK_ACCESSIBLE (sw), GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE);
gtk_accessible_reset_state (GTK_ACCESSIBLE (sw), GTK_ACCESSIBLE_STATE_INVALID);
}
GtkWidget *
@@ -113,7 +128,7 @@ do_errorstates (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -43,21 +43,22 @@ do_expander (GtkWidget *do_widget)
if (!window)
{
toplevel = GTK_WIDGET (gtk_widget_get_root (do_widget));
window = gtk_message_dialog_new_with_markup (GTK_WINDOW (toplevel),
0,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"<big><b>%s</b></big>",
"Something went wrong");
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (window),
"Here are some more details "
"but not the full story.");
area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (window));
label = gtk_widget_get_last_child (area);
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "Expander");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (toplevel));
area = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
gtk_widget_set_margin_start (area, 10);
gtk_widget_set_margin_end (area, 10);
gtk_widget_set_margin_top (area, 10);
gtk_widget_set_margin_bottom (area, 10);
gtk_window_set_child (GTK_WINDOW (window), area);
label = gtk_label_new ("<big><b>Something went wrong</b></big>");
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
gtk_box_append (GTK_BOX (area), label);
label = gtk_label_new ("Here are some more details but not the full story");
gtk_label_set_wrap (GTK_LABEL (label), FALSE);
gtk_widget_set_vexpand (label, FALSE);
gtk_box_append (GTK_BOX (area), label);
expander = gtk_expander_new ("Details:");
gtk_widget_set_vexpand (expander, TRUE);
@@ -120,7 +121,7 @@ do_expander (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_window_present (GTK_WINDOW (window));
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -199,7 +199,7 @@ do_filtermodel (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -71,7 +71,7 @@ create_blurred_button (void)
static GtkWidget *
create_font_button (void)
{
return gtk_font_button_new ();
return gtk_font_dialog_button_new (gtk_font_dialog_new ());
}
static GtkWidget *
@@ -299,7 +299,7 @@ do_fishbowl (GtkWidget *do_widget)
if (provider == NULL)
{
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, css, -1);
gtk_css_provider_load_from_string (provider, css);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
@@ -308,11 +308,20 @@ do_fishbowl (GtkWidget *do_widget)
if (!window)
{
GtkBuilder *builder;
GtkBuilderScope *scope;
GtkWidget *bowl;
g_type_ensure (GTK_TYPE_FISHBOWL);
builder = gtk_builder_new_from_resource ("/fishbowl/fishbowl.ui");
scope = gtk_builder_cscope_new ();
gtk_builder_cscope_add_callback (GTK_BUILDER_CSCOPE (scope), fishbowl_prev_button_clicked_cb);
gtk_builder_cscope_add_callback (GTK_BUILDER_CSCOPE (scope), fishbowl_next_button_clicked_cb);
gtk_builder_cscope_add_callback (GTK_BUILDER_CSCOPE (scope), fishbowl_changes_toggled_cb);
gtk_builder_cscope_add_callback (GTK_BUILDER_CSCOPE (scope), format_header_cb);
builder = gtk_builder_new ();
gtk_builder_set_scope (builder, scope);
gtk_builder_add_from_resource (builder, "/fishbowl/fishbowl.ui", NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
@@ -324,10 +333,11 @@ do_fishbowl (GtkWidget *do_widget)
gtk_widget_realize (window);
g_object_unref (builder);
g_object_unref (scope);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -160,7 +160,7 @@ do_fixed (GtkWidget *do_widget)
demo_window = create_demo_window (do_widget);
if (!gtk_widget_get_visible (demo_window))
gtk_widget_show (demo_window);
gtk_widget_set_visible (demo_window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (demo_window));

View File

@@ -742,7 +742,7 @@ do_flowbox (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -21,6 +21,8 @@
#include "script-names.h"
#include "language-names.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/* {{{ ScriptLang object */
G_DECLARE_FINAL_TYPE (ScriptLang, script_lang, SCRIPT, LANG, GObject)
@@ -256,10 +258,10 @@ swap_colors (void)
GdkRGBA fg;
GdkRGBA bg;
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (demo->foreground), &fg);
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (demo->background), &bg);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (demo->foreground), &bg);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (demo->background), &fg);
fg = *gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (demo->foreground));
bg = *gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (demo->background));
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (demo->foreground), &bg);
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (demo->background), &fg);
}
static void
@@ -268,8 +270,8 @@ font_features_reset_basic (void)
gtk_adjustment_set_value (demo->size_adjustment, 20);
gtk_adjustment_set_value (demo->letterspacing_adjustment, 0);
gtk_adjustment_set_value (demo->line_height_adjustment, 1);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (demo->foreground), &(GdkRGBA){0.,0.,0.,1.});
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (demo->background), &(GdkRGBA){1.,1.,1.,1.});
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (demo->foreground), &(GdkRGBA){0.,0.,0.,1.});
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (demo->background), &(GdkRGBA){1.,1.,1.,1.});
}
static void
@@ -277,7 +279,7 @@ update_basic (void)
{
PangoFontDescription *desc;
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (demo->font));
desc = gtk_font_dialog_button_get_font_desc (GTK_FONT_DIALOG_BUTTON (demo->font));
gtk_adjustment_set_value (demo->size_adjustment,
pango_font_description_get_size (desc) / (double) PANGO_SCALE);
@@ -588,7 +590,7 @@ update_display (void)
end = PANGO_ATTR_INDEX_TO_TEXT_END;
}
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (demo->font));
desc = gtk_font_dialog_button_get_font_desc (GTK_FONT_DIALOG_BUTTON (demo->font));
value = gtk_adjustment_get_value (demo->size_adjustment);
pango_font_description_set_size (desc, value * PANGO_SCALE);
@@ -679,7 +681,7 @@ update_display (void)
GdkRGBA rgba;
char *fg, *bg, *css;
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (demo->foreground), &rgba);
rgba = *gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (demo->foreground));
attr = pango_attr_foreground_new (65535 * rgba.red,
65535 * rgba.green,
65535 * rgba.blue);
@@ -692,7 +694,7 @@ update_display (void)
pango_attr_list_insert (attrs, attr);
fg = gdk_rgba_to_string (&rgba);
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (demo->background), &rgba);
rgba = *gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (demo->background));
bg = gdk_rgba_to_string (&rgba);
css = g_strdup_printf (".font_features_background { caret-color: %s; background-color: %s; }", fg, bg);
gtk_css_provider_load_from_data (demo->provider, css, strlen (css));
@@ -767,7 +769,6 @@ update_display (void)
gtk_label_set_attributes (GTK_LABEL (demo->the_label), attrs);
g_free (font_desc);
pango_font_description_free (desc);
g_free (features);
pango_attr_list_unref (attrs);
g_free (text);
@@ -779,7 +780,7 @@ get_pango_font (void)
PangoFontDescription *desc;
PangoContext *context;
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (demo->font));
desc = gtk_font_dialog_button_get_font_desc (GTK_FONT_DIALOG_BUTTON (demo->font));
context = gtk_widget_get_pango_context (demo->font);
return pango_context_load_font (context, desc);
@@ -831,17 +832,17 @@ update_script_combo (void)
GHashTable *tags;
GHashTableIter iter;
TagPair *pair;
char *lang;
PangoLanguage *language;
const char *lang;
hb_tag_t active;
lang = gtk_font_chooser_get_language (GTK_FONT_CHOOSER (demo->font));
language = gtk_font_dialog_button_get_language (GTK_FONT_DIALOG_BUTTON (demo->font));
lang = pango_language_to_string (language);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
active = hb_ot_tag_from_language (hb_language_from_string (lang, -1));
G_GNUC_END_IGNORE_DEPRECATIONS
g_free (lang);
store = g_list_store_new (script_lang_get_type ());
pango_font = get_pango_font ();
@@ -854,11 +855,6 @@ update_script_combo (void)
pair->lang_tag = 0;
g_hash_table_add (tags, pair);
pair = g_new (TagPair, 1);
pair->script_tag = HB_OT_TAG_DEFAULT_SCRIPT;
pair->lang_tag = HB_OT_TAG_DEFAULT_LANGUAGE;
g_hash_table_add (tags, pair);
if (hb_font)
{
hb_tag_t tables[2] = { HB_OT_TAG_GSUB, HB_OT_TAG_GPOS };
@@ -970,9 +966,6 @@ update_features (void)
/* set feature presence checks from the font features */
if (gtk_drop_down_get_selected (GTK_DROP_DOWN (demo->script_lang)) == 0)
return;
selected = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (demo->script_lang));
if (selected->lang_tag == 0) /* None is selected */
@@ -980,8 +973,8 @@ update_features (void)
for (l = demo->feature_items; l; l = l->next)
{
FeatureItem *item = l->data;
gtk_widget_show (item->feat);
gtk_widget_show (gtk_widget_get_parent (item->feat));
gtk_widget_set_visible (item->feat, TRUE);
gtk_widget_set_visible (gtk_widget_get_parent (item->feat), TRUE);
if (strcmp (item->name, "xxxx") == 0)
gtk_check_button_set_active (GTK_CHECK_BUTTON (item->feat), TRUE);
}
@@ -992,8 +985,8 @@ update_features (void)
for (l = demo->feature_items; l; l = l->next)
{
FeatureItem *item = l->data;
gtk_widget_hide (item->feat);
gtk_widget_hide (gtk_widget_get_parent (item->feat));
gtk_widget_set_visible (item->feat, FALSE);
gtk_widget_set_visible (gtk_widget_get_parent (item->feat), FALSE);
if (strcmp (item->name, "xxxx") == 0)
gtk_check_button_set_active (GTK_CHECK_BUTTON (item->feat), TRUE);
}
@@ -1001,11 +994,13 @@ update_features (void)
pango_font = get_pango_font ();
hb_font = pango_font_get_hb_font (pango_font);
g_print ("language %s\n", selected->langname);
if (hb_font)
{
hb_tag_t tables[2] = { HB_OT_TAG_GSUB, HB_OT_TAG_GPOS };
hb_face_t *hb_face;
char *feat;
const char *feat;
hb_face = hb_font_get_face (hb_font);
@@ -1027,9 +1022,6 @@ update_features (void)
char buf[5];
hb_tag_to_string (features[j], buf);
buf[4] = 0;
#if 0
g_print ("%s present in %s\n", buf, i == 0 ? "GSUB" : "GPOS");
#endif
if (g_str_has_prefix (buf, "ss") || g_str_has_prefix (buf, "cv"))
{
@@ -1079,15 +1071,15 @@ update_features (void)
if (item->tag == features[j])
{
gtk_widget_show (item->feat);
gtk_widget_show (gtk_widget_get_parent (item->feat));
gtk_widget_set_visible (item->feat, TRUE);
gtk_widget_set_visible (gtk_widget_get_parent (item->feat), TRUE);
if (GTK_IS_CHECK_BUTTON (item->feat))
{
GtkWidget *def = GTK_WIDGET (g_object_get_data (G_OBJECT (item->feat), "default"));
if (def)
{
gtk_widget_show (def);
gtk_widget_show (gtk_widget_get_parent (def));
gtk_widget_set_visible (def, TRUE);
gtk_widget_set_visible (gtk_widget_get_parent (def), TRUE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (def), TRUE);
}
else
@@ -1098,7 +1090,7 @@ update_features (void)
}
}
feat = gtk_font_chooser_get_font_features (GTK_FONT_CHOOSER (demo->font));
feat = gtk_font_dialog_button_get_font_features (GTK_FONT_DIALOG_BUTTON (demo->font));
if (feat)
{
for (l = demo->feature_items; l; l = l->next)
@@ -1124,8 +1116,6 @@ update_features (void)
}
}
}
g_free (feat);
}
}
@@ -1304,18 +1294,18 @@ add_axis (hb_face_t *hb_face,
axis_label = gtk_label_new (name);
gtk_widget_set_halign (axis_label, GTK_ALIGN_START);
gtk_widget_set_valign (axis_label, GTK_ALIGN_BASELINE);
gtk_widget_set_valign (axis_label, GTK_ALIGN_BASELINE_FILL);
gtk_grid_attach (GTK_GRID (demo->variations_grid), axis_label, 0, i, 1, 1);
adjustment = gtk_adjustment_new (value, ax->min_value, ax->max_value,
1.0, 10.0, 0.0);
axis_scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adjustment);
gtk_scale_add_mark (GTK_SCALE (axis_scale), ax->default_value, GTK_POS_TOP, NULL);
gtk_widget_set_valign (axis_scale, GTK_ALIGN_BASELINE);
gtk_widget_set_valign (axis_scale, GTK_ALIGN_BASELINE_FILL);
gtk_widget_set_hexpand (axis_scale, TRUE);
gtk_widget_set_size_request (axis_scale, 100, -1);
gtk_grid_attach (GTK_GRID (demo->variations_grid), axis_scale, 1, i, 1, 1);
axis_entry = gtk_entry_new ();
gtk_widget_set_valign (axis_entry, GTK_ALIGN_BASELINE);
gtk_widget_set_valign (axis_entry, GTK_ALIGN_BASELINE_FILL);
gtk_editable_set_width_chars (GTK_EDITABLE (axis_entry), 4);
gtk_editable_set_max_width_chars (GTK_EDITABLE (axis_entry), 4);
gtk_widget_set_hexpand (axis_entry, FALSE);
@@ -1423,10 +1413,7 @@ instance_changed (GtkDropDown *combo)
ikey.name = (char *) text;
instance = g_hash_table_lookup (demo->instances, &ikey);
if (!instance)
{
g_print ("did not find instance %s\n", text);
goto out;
}
goto out;
pango_font = get_pango_font ();
hb_font = pango_font_get_hb_font (pango_font);
@@ -1575,14 +1562,14 @@ update_font_variations (void)
label = gtk_label_new ("Instance");
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE_FILL);
gtk_grid_attach (GTK_GRID (demo->variations_grid), label, 0, -1, 1, 1);
strings = gtk_string_list_new (NULL);
combo = gtk_drop_down_new (G_LIST_MODEL (strings), NULL);
gtk_widget_set_halign (combo, GTK_ALIGN_START);
gtk_widget_set_valign (combo, GTK_ALIGN_BASELINE);
gtk_widget_set_valign (combo, GTK_ALIGN_BASELINE_FILL);
gtk_string_list_append (strings, "");
@@ -1780,6 +1767,7 @@ do_font_features (GtkWidget *do_widget)
demo->description = GTK_WIDGET (gtk_builder_get_object (builder, "description"));
demo->font = GTK_WIDGET (gtk_builder_get_object (builder, "font"));
demo->script_lang = GTK_WIDGET (gtk_builder_get_object (builder, "script_lang"));
g_assert (GTK_IS_DROP_DOWN (demo->script_lang));
expression = gtk_cclosure_expression_new (G_TYPE_STRING, NULL, 0, NULL, G_CALLBACK (script_lang_get_langname), NULL, NULL);
gtk_drop_down_set_expression (GTK_DROP_DOWN (demo->script_lang), expression);
gtk_expression_unref (expression);

View File

@@ -58,11 +58,17 @@
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkFontButton" id="font">
<object class="GtkFontDialogButton" id="font">
<accessibility>
<property name="label">Font</property>
</accessibility>
<property name="dialog">
<object class="GtkFontDialog">
</object>
</property>
<property name="receives-default">1</property>
<property name="font">Sans 12</property>
<property name="level">family|style</property>
<signal name="font-set" handler="font_features_font_changed" swapped="no"/>
<property name="level">face</property>
<signal name="notify::font-desc" handler="font_features_font_changed" swapped="no"/>
</object>
</child>
<child>
@@ -70,7 +76,7 @@
<property name="column-spacing">10</property>
<property name="row-spacing">10</property>
<child>
<object class="GtkLabel">
<object class="GtkLabel" id="size_label">
<property name="label">Size</property>
<property name="xalign">0</property>
<property name="valign">baseline</property>
@@ -86,6 +92,9 @@
<property name="width-request">100</property>
<property name="valign">baseline</property>
<property name="adjustment">size_adjustment</property>
<accessibility>
<relation name="labelled-by">size_label</relation>
</accessibility>
<layout>
<property name="column">1</property>
<property name="row">0</property>
@@ -98,6 +107,9 @@
<property name="max-width-chars">4</property>
<property name="hexpand">0</property>
<property name="valign">baseline</property>
<accessibility>
<relation name="labelled-by">size_label</relation>
</accessibility>
<signal name="activate" handler="basic_entry_activated"
object="size_adjustment" swapped="false"/>
<layout>
@@ -107,7 +119,7 @@
</object>
</child>
<child>
<object class="GtkLabel">
<object class="GtkLabel" id="letterspacing_label">
<property name="label">Letterspacing</property>
<property name="xalign">0</property>
<property name="valign">baseline</property>
@@ -123,6 +135,9 @@
<property name="width-request">100</property>
<property name="valign">baseline</property>
<property name="adjustment">letterspacing_adjustment</property>
<accessibility>
<relation name="labelled-by">letterspacing_label</relation>
</accessibility>
<layout>
<property name="column">1</property>
<property name="row">1</property>
@@ -135,6 +150,9 @@
<property name="max-width-chars">4</property>
<property name="hexpand">0</property>
<property name="valign">baseline</property>
<accessibility>
<relation name="labelled-by">letterspacing_label</relation>
</accessibility>
<signal name="activate" handler="basic_entry_activated"
object="letterspacing_adjustment" swapped="false"/>
<layout>
@@ -144,7 +162,7 @@
</object>
</child>
<child>
<object class="GtkLabel">
<object class="GtkLabel" id="line_height_label">
<property name="label">Line Height</property>
<property name="xalign">0</property>
<property name="valign">baseline</property>
@@ -160,6 +178,9 @@
<property name="width-request">100</property>
<property name="valign">baseline</property>
<property name="adjustment">line_height_adjustment</property>
<accessibility>
<relation name="labelled-by">line_height_label</relation>
</accessibility>
<layout>
<property name="column">1</property>
<property name="row">2</property>
@@ -172,6 +193,9 @@
<property name="max-width-chars">4</property>
<property name="hexpand">0</property>
<property name="valign">baseline</property>
<accessibility>
<relation name="labelled-by">line_height_label</relation>
</accessibility>
<signal name="activate" handler="basic_entry_activated"
object="line_height_adjustment" swapped="false"/>
<layout>
@@ -181,7 +205,7 @@
</object>
</child>
<child>
<object class="GtkLabel">
<object class="GtkLabel" id="foreground_label">
<property name="label">Foreground</property>
<property name="xalign">0</property>
<property name="valign">baseline</property>
@@ -192,9 +216,16 @@
</object>
</child>
<child>
<object class="GtkColorButton" id="foreground">
<object class="GtkColorDialogButton" id="foreground">
<property name="dialog">
<object class="GtkColorDialog">
</object>
</property>
<property name="valign">baseline</property>
<property name="rgba">black</property>
<accessibility>
<relation name="labelled-by">foreground_label</relation>
</accessibility>
<signal name="notify::rgba" handler="color_set_cb"/>
<layout>
<property name="column">1</property>
@@ -203,7 +234,7 @@
</object>
</child>
<child>
<object class="GtkLabel">
<object class="GtkLabel" id="background_label">
<property name="label">Background</property>
<property name="xalign">0</property>
<property name="valign">baseline</property>
@@ -214,9 +245,16 @@
</object>
</child>
<child>
<object class="GtkColorButton" id="background">
<object class="GtkColorDialogButton" id="background">
<property name="dialog">
<object class="GtkColorDialog">
</object>
</property>
<property name="valign">baseline</property>
<property name="rgba">white</property>
<accessibility>
<relation name="labelled-by">background_label</relation>
</accessibility>
<signal name="notify::rgba" handler="color_set_cb"/>
<layout>
<property name="column">1</property>
@@ -229,6 +267,9 @@
<property name="icon-name">object-flip-vertical-symbolic</property>
<property name="halign">start</property>
<property name="valign">center</property>
<accessibility>
<property name="label">Swap colors</property>
</accessibility>
<style>
<class name="circular"/>
</style>
@@ -330,6 +371,9 @@
<property name="yalign">0</property>
<property name="valign">start</property>
<property name="selectable">1</property>
<accessibility>
<property name="label">Font example</property>
</accessibility>
</object>
</property>
</object>
@@ -339,6 +383,9 @@
<property name="name">entry</property>
<property name="child">
<object class="GtkTextView" id="entry">
<accessibility>
<property name="label">Example text</property>
</accessibility>
<property name="buffer">
<object class="GtkTextBuffer">
<property name="text">Grumpy wizards make toxic brew for the evil Queen and Jack. A quick movement of the enemy will jeopardize six gunboats. The job of waxing linoleum frequently peeves chintzy kids. My girl wove six dozen plaid jackets before she quit. Twelve ziggurats quickly jumped a finch box.
@@ -435,6 +482,9 @@
<property name="icon-name">document-edit-symbolic</property>
<property name="halign">end</property>
<property name="valign">end</property>
<accessibility>
<property name="label">Edit text</property>
</accessibility>
<signal name="clicked" handler="font_features_toggle_edit"/>
</object>
</child>

View File

@@ -42,8 +42,8 @@ val_to_xy (GtkFontPlane *plane,
double u, v;
int width, height;
width = gtk_widget_get_allocated_width (GTK_WIDGET (plane));
height = gtk_widget_get_allocated_height (GTK_WIDGET (plane));
width = gtk_widget_get_width (GTK_WIDGET (plane));
height = gtk_widget_get_height (GTK_WIDGET (plane));
u = adjustment_get_normalized_value (plane->width_adj);
v = adjustment_get_normalized_value (plane->weight_adj);
@@ -62,8 +62,8 @@ plane_snapshot (GtkWidget *widget,
cairo_t *cr;
val_to_xy (plane, &x, &y);
width = gtk_widget_get_allocated_width (widget);
height = gtk_widget_get_allocated_height (widget);
width = gtk_widget_get_width (widget);
height = gtk_widget_get_height (widget);
cr = gtk_snapshot_append_cairo (snapshot,
&GRAPHENE_RECT_INIT (0, 0, width, height));
@@ -131,8 +131,8 @@ update_value (GtkFontPlane *plane,
GtkWidget *widget = GTK_WIDGET (plane);
double u, v;
u = CLAMP (x * (1.0 / gtk_widget_get_allocated_width (widget)), 0, 1);
v = CLAMP (1 - y * (1.0 / gtk_widget_get_allocated_height (widget)), 0, 1);
u = CLAMP (x * (1.0 / gtk_widget_get_width (widget)), 0, 1);
v = CLAMP (1 - y * (1.0 / gtk_widget_get_height (widget)), 0, 1);
adjustment_set_normalized_value (plane->width_adj, u);
adjustment_set_normalized_value (plane->weight_adj, v);

View File

@@ -43,6 +43,7 @@ update_image (void)
cairo_t *cr;
GdkPixbuf *pixbuf;
GdkPixbuf *pixbuf2;
GdkTexture *texture;
cairo_font_options_t *fopt;
cairo_hint_style_t hintstyle;
cairo_hint_metrics_t hintmetrics;
@@ -53,7 +54,7 @@ update_image (void)
context = gtk_widget_create_pango_context (image);
text = gtk_editable_get_text (GTK_EDITABLE (entry));
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (font_button));
desc = gtk_font_dialog_button_get_font_desc (GTK_FONT_DIALOG_BUTTON (font_button));
fopt = cairo_font_options_copy (pango_cairo_context_get_font_options (context));
@@ -120,8 +121,17 @@ update_image (void)
cairo_destroy (cr);
g_object_unref (layout);
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, cairo_image_surface_get_width (surface), cairo_image_surface_get_height (surface));
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf, gdk_pixbuf_get_width (pixbuf) * scale, gdk_pixbuf_get_height (pixbuf) * scale, GDK_INTERP_NEAREST);
pixbuf = gdk_pixbuf_new_from_data (cairo_image_surface_get_data (surface),
GDK_COLORSPACE_RGB, TRUE, 8,
cairo_image_surface_get_width (surface),
cairo_image_surface_get_height (surface),
cairo_image_surface_get_stride (surface),
NULL, NULL);
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf,
gdk_pixbuf_get_width (pixbuf) * scale,
gdk_pixbuf_get_height (pixbuf) * scale,
GDK_INTERP_NEAREST);
g_object_unref (pixbuf);
cairo_surface_destroy (surface);
@@ -278,17 +288,25 @@ retry:
pango_layout_iter_free (iter);
g_object_unref (layout);
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, cairo_image_surface_get_width (surface), cairo_image_surface_get_height (surface));
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf, gdk_pixbuf_get_width (pixbuf) * scale, gdk_pixbuf_get_height (pixbuf) * scale, GDK_INTERP_NEAREST);
pixbuf = gdk_pixbuf_new_from_data (cairo_image_surface_get_data (surface),
GDK_COLORSPACE_RGB, TRUE, 8,
cairo_image_surface_get_width (surface),
cairo_image_surface_get_height (surface),
cairo_image_surface_get_stride (surface),
NULL, NULL);
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf,
gdk_pixbuf_get_width (pixbuf) * scale,
gdk_pixbuf_get_height (pixbuf) * scale,
GDK_INTERP_NEAREST);
g_object_unref (pixbuf);
cairo_surface_destroy (surface);
}
gtk_picture_set_pixbuf (GTK_PICTURE (image), pixbuf2);
texture = gdk_texture_new_for_pixbuf (pixbuf2);
gtk_picture_set_paintable (GTK_PICTURE (image), GDK_PAINTABLE (texture));
g_object_unref (pixbuf2);
pango_font_description_free (desc);
g_object_unref (texture);
}
static gboolean fading = FALSE;
@@ -437,7 +455,7 @@ do_fontrendering (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -39,7 +39,7 @@
<property name="row-spacing">10</property>
<property name="column-spacing">10</property>
<child>
<object class="GtkLabel">
<object class="GtkLabel" id="text_label">
<property name="margin-start">10</property>
<property name="label">Text</property>
<property name="xalign">1</property>
@@ -57,10 +57,13 @@
<layout>
<property name="column">2</property>
</layout>
<accessibility>
<relation name="labelled-by">text_label</relation>
</accessibility>
</object>
</child>
<child>
<object class="GtkLabel">
<object class="GtkLabel" id="font_label">
<property name="margin-start">10</property>
<property name="label">Font</property>
<property name="xalign">1</property>
@@ -74,7 +77,14 @@
</object>
</child>
<child>
<object class="GtkFontButton" id="font_button">
<object class="GtkFontDialogButton" id="font_button">
<accessibility>
<relation name="labelled-by">font_label</relation>
</accessibility>
<property name="dialog">
<object class="GtkFontDialog">
</object>
</property>
<layout>
<property name="column">2</property>
<property name="row">1</property>
@@ -182,6 +192,9 @@
<property name="icon-name">list-add-symbolic</property>
<property name="halign">center</property>
<property name="valign">center</property>
<accessibility>
<property name="label">Zoom in</property>
</accessibility>
<style>
<class name="circular"/>
</style>
@@ -207,6 +220,9 @@
<property name="icon-name">list-remove-symbolic</property>
<property name="halign">center</property>
<property name="valign">center</property>
<accessibility>
<property name="label">Zoom out</property>
</accessibility>
<style>
<class name="circular"/>
</style>
@@ -247,6 +263,9 @@
<property name="vexpand">1</property>
<child>
<object class="GtkPicture" id="image">
<accessibility>
<property name="label">Font rendering example</property>
</accessibility>
<property name="halign">center</property>
<property name="valign">center</property>
<property name="can-shrink">0</property>

View File

@@ -157,7 +157,7 @@ do_frames (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -54,7 +54,6 @@ create_axis_slider (GtkGears *gears,
label = gtk_label_new (text);
gtk_box_append (GTK_BOX (box), label);
gtk_widget_show (label);
adj = gtk_adjustment_new (gtk_gears_get_axis (gears, axis), 0.0, 360.0, 1.0, 12.0, 0.0);
g_object_set_data (G_OBJECT (adj), "axis", GINT_TO_POINTER (axis));
@@ -65,9 +64,6 @@ create_axis_slider (GtkGears *gears,
gtk_scale_set_draw_value (GTK_SCALE (slider), FALSE);
gtk_box_append (GTK_BOX (box), slider);
gtk_widget_set_vexpand (slider, TRUE);
gtk_widget_show (slider);
gtk_widget_show (box);
return box;
}
@@ -129,7 +125,7 @@ do_gears (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -208,7 +208,7 @@ do_gestures (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -221,16 +221,13 @@ static void
realize (GtkWidget *widget)
{
const char *vertex_path, *fragment_path;
GdkGLContext *context;
gtk_gl_area_make_current (GTK_GL_AREA (widget));
if (gtk_gl_area_get_error (GTK_GL_AREA (widget)) != NULL)
return;
context = gtk_gl_area_get_context (GTK_GL_AREA (widget));
if (gdk_gl_context_get_use_es (context))
if (gtk_gl_area_get_api (GTK_GL_AREA (widget)) == GDK_GL_API_GLES)
{
vertex_path = "/glarea/glarea-gles.vs.glsl";
fragment_path = "/glarea/glarea-gles.fs.glsl";
@@ -355,7 +352,6 @@ create_axis_slider (int axis)
label = gtk_label_new (text);
gtk_box_append (GTK_BOX (box), label);
gtk_widget_show (label);
adj = gtk_adjustment_new (0.0, 0.0, 360.0, 1.0, 12.0, 0.0);
g_signal_connect (adj, "value-changed",
@@ -364,9 +360,6 @@ create_axis_slider (int axis)
slider = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adj);
gtk_box_append (GTK_BOX (box), slider);
gtk_widget_set_hexpand (slider, TRUE);
gtk_widget_show (slider);
gtk_widget_show (box);
return box;
}
@@ -440,7 +433,7 @@ do_glarea (GtkWidget *do_widget)
demo_window = create_glarea_window (do_widget);
if (!gtk_widget_get_visible (demo_window))
gtk_widget_show (demo_window);
gtk_widget_set_visible (demo_window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (demo_window));

View File

@@ -33,7 +33,7 @@ static void
text_changed (GtkTextBuffer *buffer,
GtkWidget *button)
{
gtk_widget_show (button);
gtk_widget_set_visible (button, TRUE);
}
static void
@@ -58,7 +58,7 @@ apply_text (GtkWidget *button,
g_object_unref (shader);
g_bytes_unref (bytes);
gtk_widget_hide (button);
gtk_widget_set_visible (button, FALSE);
}
static void
@@ -237,7 +237,7 @@ make_shader_stack (const char *name,
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
gtk_widget_add_css_class (button, "small");
gtk_widget_hide (button);
gtk_widget_set_visible (button, FALSE);
gtk_center_box_set_end_widget (GTK_CENTER_BOX (widget), button);
gtk_box_append (GTK_BOX (vbox), widget);
@@ -337,7 +337,7 @@ create_gltransition_window (GtkWidget *do_widget)
1, 1, 1, 1);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, "button.small { padding: 0; }", -1);
gtk_css_provider_load_from_string (provider, "button.small { padding: 0; }");
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
@@ -354,7 +354,7 @@ do_gltransition (GtkWidget *do_widget)
demo_window = create_gltransition_window (do_widget);
if (!gtk_widget_get_visible (demo_window))
gtk_widget_show (demo_window);
gtk_widget_set_visible (demo_window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (demo_window));

View File

@@ -27,24 +27,17 @@ G_BEGIN_DECLS
#define GSK_TYPE_SHADER_PAINTABLE (gsk_shader_paintable_get_type ())
GDK_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (GskShaderPaintable, gsk_shader_paintable, GSK, SHADER_PAINTABLE, GObject)
GDK_AVAILABLE_IN_ALL
GdkPaintable * gsk_shader_paintable_new (GskGLShader *shader,
GBytes *data);
GDK_AVAILABLE_IN_ALL
GskGLShader * gsk_shader_paintable_get_shader (GskShaderPaintable *self);
GDK_AVAILABLE_IN_ALL
void gsk_shader_paintable_set_shader (GskShaderPaintable *self,
GskGLShader *shader);
GDK_AVAILABLE_IN_ALL
GBytes * gsk_shader_paintable_get_args (GskShaderPaintable *self);
GDK_AVAILABLE_IN_ALL
void gsk_shader_paintable_set_args (GskShaderPaintable *self,
GBytes *data);
GDK_AVAILABLE_IN_ALL
void gsk_shader_paintable_update_time (GskShaderPaintable *self,
int time_idx,
gint64 frame_time);

View File

@@ -48,14 +48,16 @@
#define VERTICES_PER_TOOTH 34
#define GEAR_VERTEX_STRIDE 6
#ifndef HAVE_SINCOS
static void
sincos (double x, double *_sin, double *_cos)
static inline void
_sincos (double x, double *_sin, double *_cos)
{
#ifdef HAVE_SINCOS
sincos (x, _sin, _cos);
#else
*_sin = sin (x);
*_cos = cos (x);
}
#endif
}
/**
* Struct describing the vertices in triangle strip
@@ -307,11 +309,11 @@ create_gear (GLfloat inner_radius,
struct point p[7];
/* Calculate needed sin/cos for various angles */
sincos(i * 2.0 * G_PI / teeth + da * 0, &s[0], &c[0]);
sincos(i * 2.0 * M_PI / teeth + da * 1, &s[1], &c[1]);
sincos(i * 2.0 * M_PI / teeth + da * 2, &s[2], &c[2]);
sincos(i * 2.0 * M_PI / teeth + da * 3, &s[3], &c[3]);
sincos(i * 2.0 * M_PI / teeth + da * 4, &s[4], &c[4]);
_sincos(i * 2.0 * G_PI / teeth + da * 0, &s[0], &c[0]);
_sincos(i * 2.0 * M_PI / teeth + da * 1, &s[1], &c[1]);
_sincos(i * 2.0 * M_PI / teeth + da * 2, &s[2], &c[2]);
_sincos(i * 2.0 * M_PI / teeth + da * 3, &s[3], &c[3]);
_sincos(i * 2.0 * M_PI / teeth + da * 4, &s[4], &c[4]);
GEAR_POINT(p[0], r2, 1);
GEAR_POINT(p[1], r2, 2);
@@ -520,7 +522,7 @@ void perspective(GLfloat *m, GLfloat fovy, GLfloat aspect, GLfloat zNear, GLfloa
identity(tmp);
deltaZ = zFar - zNear;
sincos(radians, &sine, &cosine);
_sincos(radians, &sine, &cosine);
if ((deltaZ == 0) || (sine == 0) || (aspect == 0))
return;
@@ -735,7 +737,6 @@ gtk_gears_realize (GtkWidget *widget)
GtkGLArea *glarea = GTK_GL_AREA (widget);
GtkGears *gears = GTK_GEARS (widget);
GtkGearsPrivate *priv = gtk_gears_get_instance_private (gears);
GdkGLContext *context;
GLuint vao, v, f, program;
const char *p;
char msg[512];
@@ -746,8 +747,6 @@ gtk_gears_realize (GtkWidget *widget)
if (gtk_gl_area_get_error (glarea) != NULL)
return;
context = gtk_gl_area_get_context (glarea);
glEnable (GL_CULL_FACE);
glEnable (GL_DEPTH_TEST);
@@ -757,7 +756,7 @@ gtk_gears_realize (GtkWidget *widget)
priv->vao = vao;
/* Compile the vertex shader */
if (gdk_gl_context_get_use_es (context))
if (gtk_gl_area_get_api (glarea) == GDK_GL_API_GLES)
p = vertex_shader_gles;
else
p = vertex_shader_gl;
@@ -768,7 +767,7 @@ gtk_gears_realize (GtkWidget *widget)
g_debug ("vertex shader info: %s\n", msg);
/* Compile the fragment shader */
if (gdk_gl_context_get_use_es (context))
if (gtk_gl_area_get_api (glarea) == GDK_GL_API_GLES)
p = fragment_shader_gles;
else
p = fragment_shader_gl;
@@ -841,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;

View File

@@ -18,6 +18,7 @@ do_headerbar (GtkWidget *do_widget)
GtkWidget *header;
GtkWidget *button;
GtkWidget *box;
GtkWidget *content;
if (!window)
{
@@ -37,20 +38,30 @@ do_headerbar (GtkWidget *do_widget)
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_add_css_class (box, "linked");
button = gtk_button_new_from_icon_name ("go-previous-symbolic");
gtk_widget_set_tooltip_text (button, "Back");
gtk_box_append (GTK_BOX (box), button);
button = gtk_button_new_from_icon_name ("go-next-symbolic");
gtk_widget_set_tooltip_text (button, "Forward");
gtk_box_append (GTK_BOX (box), button);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), box);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), gtk_switch_new ());
button = gtk_switch_new ();
gtk_accessible_update_property (GTK_ACCESSIBLE (button),
GTK_ACCESSIBLE_PROPERTY_LABEL, "Change something",
-1);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), button);
gtk_window_set_titlebar (GTK_WINDOW (window), header);
gtk_window_set_child (GTK_WINDOW (window), gtk_text_view_new ());
content = gtk_text_view_new ();
gtk_accessible_update_property (GTK_ACCESSIBLE (content),
GTK_ACCESSIBLE_PROPERTY_LABEL, "Content",
-1);
gtk_window_set_child (GTK_WINDOW (window), content);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

146
demos/gtk-demo/hsla.c Normal file
View File

@@ -0,0 +1,146 @@
#include <gdk/gdk.h>
#include "hsla.h"
void
_gdk_hsla_init_from_rgba (GdkHSLA *hsla,
const GdkRGBA *rgba)
{
float min;
float max;
float red;
float green;
float blue;
float delta;
g_return_if_fail (hsla != NULL);
g_return_if_fail (rgba != NULL);
red = rgba->red;
green = rgba->green;
blue = rgba->blue;
if (red > green)
{
if (red > blue)
max = red;
else
max = blue;
if (green < blue)
min = green;
else
min = blue;
}
else
{
if (green > blue)
max = green;
else
max = blue;
if (red < blue)
min = red;
else
min = blue;
}
hsla->lightness = (max + min) / 2;
hsla->saturation = 0;
hsla->hue = 0;
hsla->alpha = rgba->alpha;
if (max != min)
{
if (hsla->lightness <= 0.5)
hsla->saturation = (max - min) / (max + min);
else
hsla->saturation = (max - min) / (2 - max - min);
delta = max -min;
if (red == max)
hsla->hue = (green - blue) / delta;
else if (green == max)
hsla->hue = 2 + (blue - red) / delta;
else if (blue == max)
hsla->hue = 4 + (red - green) / delta;
hsla->hue *= 60;
if (hsla->hue < 0.0)
hsla->hue += 360;
}
}
void
_gdk_rgba_init_from_hsla (GdkRGBA *rgba,
const GdkHSLA *hsla)
{
float hue;
float lightness;
float saturation;
float m1, m2;
lightness = hsla->lightness;
saturation = hsla->saturation;
if (lightness <= 0.5)
m2 = lightness * (1 + saturation);
else
m2 = lightness + saturation - lightness * saturation;
m1 = 2 * lightness - m2;
rgba->alpha = hsla->alpha;
if (saturation == 0)
{
rgba->red = lightness;
rgba->green = lightness;
rgba->blue = lightness;
}
else
{
hue = hsla->hue + 120;
while (hue > 360)
hue -= 360;
while (hue < 0)
hue += 360;
if (hue < 60)
rgba->red = m1 + (m2 - m1) * hue / 60;
else if (hue < 180)
rgba->red = m2;
else if (hue < 240)
rgba->red = m1 + (m2 - m1) * (240 - hue) / 60;
else
rgba->red = m1;
hue = hsla->hue;
while (hue > 360)
hue -= 360;
while (hue < 0)
hue += 360;
if (hue < 60)
rgba->green = m1 + (m2 - m1) * hue / 60;
else if (hue < 180)
rgba->green = m2;
else if (hue < 240)
rgba->green = m1 + (m2 - m1) * (240 - hue) / 60;
else
rgba->green = m1;
hue = hsla->hue - 120;
while (hue > 360)
hue -= 360;
while (hue < 0)
hue += 360;
if (hue < 60)
rgba->blue = m1 + (m2 - m1) * hue / 60;
else if (hue < 180)
rgba->blue = m2;
else if (hue < 240)
rgba->blue = m1 + (m2 - m1) * (240 - hue) / 60;
else
rgba->blue = m1;
}
}

15
demos/gtk-demo/hsla.h Normal file
View File

@@ -0,0 +1,15 @@
#pragma once
typedef struct _GdkHSLA GdkHSLA;
struct _GdkHSLA {
float hue;
float saturation;
float lightness;
float alpha;
};
void _gdk_hsla_init_from_rgba (GdkHSLA *hsla,
const GdkRGBA *rgba);
void _gdk_rgba_init_from_hsla (GdkRGBA *rgba,
const GdkHSLA *hsla);

View File

@@ -399,7 +399,7 @@ do_hypertext (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -354,10 +354,18 @@ do_iconscroll (GtkWidget *do_widget)
if (!window)
{
GtkBuilder *builder;
GtkBuilderScope *scope;
GtkWidget *label;
guint id;
builder = gtk_builder_new_from_resource ("/iconscroll/iconscroll.ui");
scope = gtk_builder_cscope_new ();
gtk_builder_cscope_add_callback (GTK_BUILDER_CSCOPE (scope), iconscroll_prev_clicked_cb);
gtk_builder_cscope_add_callback (GTK_BUILDER_CSCOPE (scope), iconscroll_next_clicked_cb);
builder = gtk_builder_new ();
gtk_builder_set_scope (builder, scope);
gtk_builder_add_from_resource (builder, "/iconscroll/iconscroll.ui", NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
gtk_window_set_display (GTK_WINDOW (window),
@@ -370,15 +378,16 @@ do_iconscroll (GtkWidget *do_widget)
set_widget_type (0);
label = GTK_WIDGET (gtk_builder_get_object (builder, "fps_label"));
id = g_timeout_add (500, update_fps, label);
id = g_timeout_add_full (G_PRIORITY_HIGH, 500, update_fps, label, NULL);
g_object_set_data_full (G_OBJECT (label), "timeout",
GUINT_TO_POINTER (id), remove_timeout);
g_object_unref (builder);
g_object_unref (scope);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -320,7 +320,7 @@ do_iconview (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -1,4 +1,5 @@
/* Icon View/Editing and Drag-and-Drop
* #Keywords: dnd
*
* The GtkIconView widget supports Editing and Drag-and-Drop.
* This example also demonstrates using the generic GtkCellLayout
@@ -150,7 +151,7 @@ do_iconview_edit (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -0,0 +1,197 @@
/* Image Scaling
* #Keywords: zoom, scale, filter, action, menu
*
* The custom widget we create here is similar to a GtkPicture,
* but allows setting a zoom level and filtering mode for the
* displayed paintable.
*
* It also demonstrates how to add a context menu to a custom
* widget and connect it with widget actions.
*
* The context menu has items to change the zoom level.
*/
#include <gtk/gtk.h>
#include "demo3widget.h"
static void
file_opened (GObject *source,
GAsyncResult *result,
void *data)
{
GFile *file;
GError *error = NULL;
GdkTexture *texture;
file = gtk_file_dialog_open_finish (GTK_FILE_DIALOG (source), result, &error);
if (!file)
{
g_print ("%s\n", error->message);
g_error_free (error);
return;
}
texture = gdk_texture_new_from_file (file, &error);
g_object_unref (file);
if (!texture)
{
g_print ("%s\n", error->message);
g_error_free (error);
return;
}
g_object_set (G_OBJECT (data), "texture", texture, NULL);
g_object_unref (texture);
}
static void
open_file (GtkWidget *picker,
GtkWidget *demo)
{
GtkWindow *parent = GTK_WINDOW (gtk_widget_get_root (picker));
GtkFileDialog *dialog;
GtkFileFilter *filter;
GListStore *filters;
dialog = gtk_file_dialog_new ();
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, "Images");
gtk_file_filter_add_pixbuf_formats (filter);
filters = g_list_store_new (GTK_TYPE_FILE_FILTER);
g_list_store_append (filters, filter);
g_object_unref (filter);
gtk_file_dialog_set_filters (dialog, G_LIST_MODEL (filters));
g_object_unref (filters);
gtk_file_dialog_open (dialog, parent, NULL, file_opened, demo);
g_object_unref (dialog);
}
static void
rotate (GtkWidget *button,
GtkWidget *demo)
{
float angle;
g_object_get (demo, "angle", &angle, NULL);
angle = fmodf (angle + 90.f, 360.f);
g_object_set (demo, "angle", angle, NULL);
}
static gboolean
transform_to (GBinding *binding,
const GValue *src,
GValue *dest,
gpointer user_data)
{
double from;
float to;
from = g_value_get_double (src);
to = (float) pow (2., from);
g_value_set_float (dest, to);
return TRUE;
}
static gboolean
transform_from (GBinding *binding,
const GValue *src,
GValue *dest,
gpointer user_data)
{
float to;
double from;
to = g_value_get_float (src);
from = log2 (to);
g_value_set_double (dest, from);
return TRUE;
}
GtkWidget *
do_image_scaling (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *box;
GtkWidget *box2;
GtkWidget *sw;
GtkWidget *widget;
GtkWidget *scale;
GtkWidget *dropdown;
GtkWidget *button;
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "Image Scaling");
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_window_set_child (GTK_WINDOW (window), box);
sw = gtk_scrolled_window_new ();
gtk_widget_set_vexpand (sw, TRUE);
gtk_box_append (GTK_BOX (box), sw);
widget = demo3_widget_new ("/transparent/portland-rose.jpg");
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), widget);
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_append (GTK_BOX (box), box2);
button = gtk_button_new_from_icon_name ("document-open-symbolic");
gtk_widget_set_tooltip_text (button, "Open File");
g_signal_connect (button, "clicked", G_CALLBACK (open_file), widget);
gtk_box_append (GTK_BOX (box2), button);
button = gtk_button_new_from_icon_name ("object-rotate-right-symbolic");
gtk_widget_set_tooltip_text (button, "Rotate");
g_signal_connect (button, "clicked", G_CALLBACK (rotate), widget);
gtk_box_append (GTK_BOX (box2), button);
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, -10., 10., 0.1);
gtk_scale_add_mark (GTK_SCALE (scale), 0., GTK_POS_TOP, NULL);
gtk_widget_set_tooltip_text (scale, "Zoom");
gtk_accessible_update_property (GTK_ACCESSIBLE (scale),
GTK_ACCESSIBLE_PROPERTY_LABEL, "Zoom",
-1);
gtk_range_set_value (GTK_RANGE (scale), 0.);
gtk_widget_set_hexpand (scale, TRUE);
gtk_box_append (GTK_BOX (box2), scale);
dropdown = gtk_drop_down_new (G_LIST_MODEL (gtk_string_list_new ((const char *[]){ "Linear", "Nearest", "Trilinear", NULL })), NULL);
gtk_widget_set_tooltip_text (dropdown, "Filter");
gtk_accessible_update_property (GTK_ACCESSIBLE (dropdown),
GTK_ACCESSIBLE_PROPERTY_LABEL, "Filter",
-1);
gtk_box_append (GTK_BOX (box2), dropdown);
g_object_bind_property (dropdown, "selected", widget, "filter", G_BINDING_DEFAULT);
g_object_bind_property_full (gtk_range_get_adjustment (GTK_RANGE (scale)), "value",
widget, "scale",
G_BINDING_BIDIRECTIONAL,
transform_to,
transform_from,
NULL, NULL);
}
if (!gtk_widget_get_visible (window))
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@@ -30,6 +30,7 @@ progressive_prepared_callback (GdkPixbufLoader *loader,
{
GdkPixbuf *pixbuf;
GtkWidget *picture;
GdkTexture *texture;
picture = GTK_WIDGET (data);
@@ -40,7 +41,9 @@ progressive_prepared_callback (GdkPixbufLoader *loader,
*/
gdk_pixbuf_fill (pixbuf, 0xaaaaaaff);
gtk_picture_set_pixbuf (GTK_PICTURE (picture), pixbuf);
texture = gdk_texture_new_for_pixbuf (pixbuf);
gtk_picture_set_paintable (GTK_PICTURE (picture), GDK_PAINTABLE (texture));
g_object_unref (texture);
}
static void
@@ -51,22 +54,18 @@ progressive_updated_callback (GdkPixbufLoader *loader,
int height,
gpointer data)
{
GtkWidget *picture;
GdkPixbuf *pixbuf;
GtkWidget *picture = GTK_WIDGET (data);
GdkTexture *texture;
picture = GTK_WIDGET (data);
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
gtk_picture_set_pixbuf (GTK_PICTURE (picture), NULL);
gtk_picture_set_pixbuf (GTK_PICTURE (picture), pixbuf);
texture = gdk_texture_new_for_pixbuf (gdk_pixbuf_loader_get_pixbuf (loader));
gtk_picture_set_paintable (GTK_PICTURE (picture), GDK_PAINTABLE (texture));
g_object_unref (texture);
}
static int
progressive_timeout (gpointer data)
{
GtkWidget *picture;
picture = GTK_WIDGET (data);
GtkWidget *picture = GTK_WIDGET (data);
/* This shows off fully-paranoid error handling, so looks scary.
* You could factor out the error handling code into a nice separate
@@ -83,24 +82,17 @@ progressive_timeout (gpointer data)
if (bytes_read < 0)
{
GtkWidget *dialog;
GtkAlertDialog *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failure reading image file 'alphatest.png': %s",
error->message);
dialog = gtk_alert_dialog_new ("Failure reading image file 'alphatest.png': %s",
error->message);
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
g_object_unref (image_stream);
image_stream = NULL;
gtk_widget_show (dialog);
load_timeout = 0;
return FALSE; /* uninstall the timeout */
@@ -110,25 +102,17 @@ progressive_timeout (gpointer data)
buf, bytes_read,
&error))
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failed to load image: %s",
error->message);
GtkAlertDialog *dialog;
dialog = gtk_alert_dialog_new ("Failed to load image: %s",
error->message);
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
g_object_unref (image_stream);
image_stream = NULL;
gtk_widget_show (dialog);
load_timeout = 0;
return FALSE; /* uninstall the timeout */
@@ -143,22 +127,14 @@ progressive_timeout (gpointer data)
error = NULL;
if (!g_input_stream_close (image_stream, NULL, &error))
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failed to load image: %s",
error->message);
GtkAlertDialog *dialog;
dialog = gtk_alert_dialog_new ("Failed to load image: %s",
error->message);
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
g_object_unref (image_stream);
image_stream = NULL;
g_object_unref (pixbuf_loader);
@@ -177,25 +153,16 @@ progressive_timeout (gpointer data)
* it was incomplete.
*/
error = NULL;
if (!gdk_pixbuf_loader_close (pixbuf_loader,
&error))
if (!gdk_pixbuf_loader_close (pixbuf_loader, &error))
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failed to load image: %s",
error->message);
GtkAlertDialog *dialog;
dialog = gtk_alert_dialog_new ("Failed to load image: %s",
error->message);
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
g_object_unref (pixbuf_loader);
pixbuf_loader = NULL;
@@ -216,20 +183,14 @@ progressive_timeout (gpointer data)
if (image_stream == NULL)
{
GtkWidget *dialog;
GtkAlertDialog *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"%s", error->message);
dialog = gtk_alert_dialog_new ("%s",
error->message);
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
load_timeout = 0;
return FALSE; /* uninstall the timeout */
@@ -460,7 +421,7 @@ do_images (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -7,13 +7,15 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
on_bar_response (GtkInfoBar *info_bar,
int response_id,
gpointer user_data)
{
GtkWidget *dialog;
GtkWidget *window;
GtkAlertDialog *dialog;
char *detail;
if (response_id == GTK_RESPONSE_CLOSE)
{
@@ -21,19 +23,12 @@ on_bar_response (GtkInfoBar *info_bar,
return;
}
window = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (info_bar)));
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
"You clicked a button on an info bar");
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"Your response has id %d", response_id);
g_signal_connect_swapped (dialog, "response",
G_CALLBACK (gtk_window_destroy), dialog);
gtk_widget_show (dialog);
dialog = gtk_alert_dialog_new ("You clicked a button on an info bar");
detail = g_strdup_printf ("Your response has been %d", response_id);
gtk_alert_dialog_set_detail (dialog, detail);
g_free (detail);
gtk_alert_dialog_show (dialog, GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (info_bar))));
g_object_unref (dialog);
}
GtkWidget *
@@ -145,7 +140,7 @@ do_infobar (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -311,5 +311,12 @@ get_language_name_for_tag (guint32 tag)
lang = hb_ot_tag_to_language (tag);
s = hb_language_to_string (lang);
if (strcmp (s, "und-fonipa") == 0)
return "International Phonetic Alphabet";
else if (strcmp (s, "und-fonnapa") == 0)
return "North-American Phonetic Alphabet";
else if (strcmp (s, "ro-md") == 0)
return "Moldavian";
return get_language_name (pango_language_from_string (s));
}

View File

@@ -54,7 +54,7 @@ do_layoutmanager (GtkWidget *parent)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -190,7 +190,7 @@ do_layoutmanager2 (GtkWidget *parent)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -7,38 +7,22 @@
#include <gtk/gtk.h>
static void
response_cb (GtkWidget *dialog,
int response_id,
gpointer data)
{
gtk_window_destroy (GTK_WINDOW (dialog));
}
static gboolean
activate_link (GtkWidget *label,
activate_link (GtkWidget *label,
const char *uri,
gpointer data)
gpointer data)
{
if (g_strcmp0 (uri, "keynav") == 0)
{
GtkWidget *dialog;
GtkWidget *parent;
GtkAlertDialog *dialog;
parent = GTK_WIDGET (gtk_widget_get_root (label));
dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (parent),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
"Keyboard navigation");
gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog),
"The term <i>keynav</i> is a shorthand for "
"keyboard navigation and refers to the process of using "
"a program (exclusively) via keyboard input.");
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gtk_window_present (GTK_WINDOW (dialog));
g_signal_connect (dialog, "response", G_CALLBACK (response_cb), NULL);
dialog = gtk_alert_dialog_new ("Keyboard navigation");
gtk_alert_dialog_set_detail (dialog,
"The term keynav is a shorthand for "
"keyboard navigation and refers to the process of using "
"a program (exclusively) via keyboard input.");
gtk_alert_dialog_show (dialog, GTK_WINDOW (gtk_widget_get_root (label)));
g_object_unref (dialog);
return TRUE;
}
@@ -79,11 +63,10 @@ do_links (GtkWidget *do_widget)
gtk_widget_set_margin_top (label, 20);
gtk_widget_set_margin_bottom (label, 20);
gtk_window_set_child (GTK_WINDOW (window), label);
gtk_widget_show (label);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -300,7 +300,7 @@ do_list_store (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
{
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
if (timeout == 0) {
/* FIXME this should use the animation-duration instead */
timeout = g_timeout_add (80, spinner_timeout, NULL);

View File

@@ -380,7 +380,6 @@ do_listbox (GtkWidget *do_widget)
{
message = gtk_message_new (lines[i]);
row = gtk_message_row_new (message);
gtk_widget_show (GTK_WIDGET (row));
gtk_list_box_insert (GTK_LIST_BOX (listbox), GTK_WIDGET (row), -1);
}
@@ -389,7 +388,7 @@ do_listbox (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -64,6 +64,8 @@
</child>
<child>
<object class="GtkLabel" id="short_time_label">
<property name="hexpand">1</property>
<property name="xalign">1</property>
<property name="valign">baseline</property>
<property name="label" translatable="yes">38m</property>
<style>

View File

@@ -62,7 +62,7 @@ do_listbox_controls (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -30,90 +30,89 @@
</object>
</child>
<child>
<object class="GtkFrame">
<object class="GtkListBox">
<property name="selection-mode">none</property>
<signal name="row-activated" handler="row_activated"/>
<style>
<class name="rich-list"/>
<class name="boxed-list"/>
</style>
<child>
<object class="GtkListBox">
<property name="selection-mode">none</property>
<property name="show-separators">1</property>
<signal name="row-activated" handler="row_activated"/>
<style>
<class name="rich-list"/>
</style>
<object class="GtkListBoxRow">
<child>
<object class="GtkListBoxRow">
<object class="GtkBox">
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="switch_label">
<property name="label" translatable="yes">Switch</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkSwitch" id="switch">
<property name="halign">end</property>
<property name="valign">center</property>
</object>
</child>
<object class="GtkLabel" id="switch_label">
<property name="label" translatable="yes">Switch</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
<property name="mnemonic-widget">switch</property>
</object>
</child>
<child>
<object class="GtkSwitch" id="switch">
<property name="halign">end</property>
<property name="valign">center</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<child>
<object class="GtkListBoxRow">
<object class="GtkBox">
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="check_label">
<property name="label" translatable="yes">Check</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkCheckButton" id="check">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="active">1</property>
</object>
</child>
<object class="GtkLabel" id="check_label">
<property name="label" translatable="yes">Check</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
<property name="mnemonic-widget">check</property>
</object>
</child>
<child>
<object class="GtkCheckButton" id="check">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="active">1</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<child>
<object class="GtkListBoxRow">
<object class="GtkBox">
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="image_label">
<property name="label" translatable="yes">Click here!</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkImage" id="image">
<property name="icon-name">object-select-symbolic</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="opacity">0</property>
</object>
</child>
<object class="GtkLabel" id="image_label">
<property name="label" translatable="yes">Click here!</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkImage" id="image">
<property name="icon-name">object-select-symbolic</property>
<property name="halign">end</property>
<property name="valign">center</property>
<property name="margin-start">10</property>
<property name="margin-end">10</property>
<property name="opacity">0</property>
<property name="accessible-role">status</property>
</object>
</child>
</object>
@@ -134,146 +133,146 @@
</style>
</object>
</child>
<child>
<object class="GtkFrame">
<child>
<object class="GtkListBox">
<property name="selection-mode">none</property>
<property name="show-separators">1</property>
<style>
<class name="rich-list"/>
</style>
<child>
<object class="GtkListBox">
<property name="selection-mode">none</property>
<style>
<class name="rich-list"/>
<class name="boxed-list"/>
</style>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="scale_label">
<property name="label" translatable="yes">Scale</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkScale">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="draw-value">0</property>
<property name="width-request">150</property>
<property name="adjustment">
<object class="GtkAdjustment">
<property name="upper">100</property>
<property name="value">50</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="scale_label">
<property name="label" translatable="yes">Scale</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
<property name="mnemonic-widget">scale</property>
</object>
</child>
<child>
<object class="GtkScale" id="scale">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="draw-value">0</property>
<property name="width-request">150</property>
<property name="adjustment">
<object class="GtkAdjustment">
<property name="upper">100</property>
<property name="value">50</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="spin_label">
<property name="label" translatable="yes">Spinbutton</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkSpinButton">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="adjustment">
<object class="GtkAdjustment">
<property name="upper">100</property>
<property name="value">50</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="dropdown_label">
<property name="label" translatable="yes">Dropdown</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkDropDown">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="model">
<object class="GtkStringList">
<items>
<item>Choice 1</item>
<item>Choice 2</item>
<item>Choice 3</item>
<item>Choice 4</item>
</items>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="spin_label">
<property name="label" translatable="yes">Spinbutton</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
<property name="mnemonic-widget">spin</property>
</object>
</child>
<child>
<object class="GtkSpinButton" id="spin">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="adjustment">
<object class="GtkAdjustment">
<property name="upper">100</property>
<property name="value">50</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="dropdown_label">
<property name="label" translatable="yes">Dropdown</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
<property name="mnemonic-widget">dropdown</property>
</object>
</child>
<child>
<object class="GtkDropDown" id="dropdown">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="model">
<object class="GtkStringList">
<items>
<item>Choice 1</item>
<item>Choice 2</item>
<item>Choice 3</item>
<item>Choice 4</item>
</items>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="entry_label">
<property name="label" translatable="yes">Entry</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
</object>
</child>
<child>
<object class="GtkEntry">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="placeholder-text">Type here…</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkLabel" id="entry_label">
<property name="label" translatable="yes">Entry</property>
<property name="xalign">0</property>
<property name="halign">start</property>
<property name="valign">center</property>
<property name="hexpand">1</property>
<property name="mnemonic-widget">entry</property>
</object>
</child>
<child>
<object class="GtkEntry" id="entry">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="placeholder-text">Type here…</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>

View File

@@ -52,6 +52,10 @@ setup_listitem_cb (GtkListItemFactory *factory,
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
image = gtk_image_new ();
gtk_accessible_update_property (GTK_ACCESSIBLE (image),
GTK_ACCESSIBLE_PROPERTY_LABEL,
"App icon",
-1);
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
gtk_box_append (GTK_BOX (box), image);
label = gtk_label_new ("");
@@ -79,6 +83,7 @@ bind_listitem_cb (GtkListItemFactory *factory,
gtk_image_set_from_gicon (GTK_IMAGE (image), g_app_info_get_icon (app_info));
gtk_label_set_label (GTK_LABEL (label), g_app_info_get_display_name (app_info));
gtk_list_item_set_accessible_label (list_item, g_app_info_get_display_name (app_info));
}
/* In more complex code, we would also need functions to unbind and teardown
@@ -117,19 +122,16 @@ activate_cb (GtkListView *list,
G_APP_LAUNCH_CONTEXT (context),
&error))
{
GtkWidget *dialog;
GtkAlertDialog *dialog;
/* And because error handling is important, even a simple demo has it:
* We display an error dialog that something went wrong.
*/
dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (list))),
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Could not launch %s", g_app_info_get_display_name (app_info));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", error->message);
dialog = gtk_alert_dialog_new ("Could not launch %s", g_app_info_get_display_name (app_info));
gtk_alert_dialog_set_detail (dialog, error->message);
gtk_alert_dialog_show (dialog, GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (list))));
g_object_unref (dialog);
g_clear_error (&error);
gtk_widget_show (dialog);
}
g_object_unref (context);
@@ -194,7 +196,7 @@ do_listview_applauncher (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

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