Compare commits

...

2507 Commits

Author SHA1 Message Date
Matthias Clasen
d02893a5b4 Add the randomized segment test
This produces bad split examples quickly.
2023-08-21 22:34:57 -04:00
Matthias Clasen
8f0bb34cb9 Add a test for bad lengths with splits 2023-08-21 22:34:57 -04:00
Benjamin Otte
6fb73e8982 demos: Add a text-on-path demo 2023-08-21 22:34:57 -04:00
Matthias Clasen
ec7191b19b Make the map demo more interesting
Add path walking to it.
2023-08-21 22:34:57 -04:00
Matthias Clasen
6be13682c2 Add GskPathMeasure 2023-08-21 22:34:57 -04:00
Matthias Clasen
b5825d613a contour: Add length<>point api 2023-08-21 22:34:57 -04:00
Matthias Clasen
53578e334c curve: Add length computation
Add api to go t<>length.
2023-08-21 22:34:57 -04:00
Matthias Clasen
b84f60877d docs: Drop a nonexisting enum value 2023-08-21 21:52:53 -04:00
Matthias Clasen
8a84024a54 Merge branch 'bilelmoussaoui/gi' into 'main'
gi: Fix missing namespace

See merge request GNOME/gtk!6316
2023-08-22 00:47:05 +00:00
Bilal Elmoussaoui
56cb614f79 gi: Fix missing namespace 2023-08-21 21:11:12 +00:00
Matthias Clasen
957d8845fd Merge branch 'kabus/x11-clipboard-leak' into 'main'
gdk/x11/clipboard: Fix Slist leak

See merge request GNOME/gtk!6314
2023-08-21 20:39:29 +00:00
Georges Basile Stavracas Neto
231c0ad77f Merge branch 'gbsneto/windows-ci-linker' into 'main'
ci: Limit parallel linking on Windows CI

See merge request GNOME/gtk!6315
2023-08-21 18:53:53 +00:00
Matthias Clasen
da635d6392 Merge branch '5777_texthistory_restore_modified_flag_on_redo' into 'main'
gtktexthistory: restore 'modified' flag on redo

Closes #5777

See merge request GNOME/gtk!6302
2023-08-21 18:41:28 +00:00
Matthias Clasen
b8a103b993 Merge branch 'matthiasc/for-main' into 'main'
curve: Add a get_crossing vfunc

See merge request GNOME/gtk!6312
2023-08-21 18:35:01 +00:00
Georges Basile Stavracas Neto
162759f34b 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-21 15:29:51 -03:00
Khalid Abu Shawarib
79fa785dbc gdk/x11/clipboard: Fix Slist leak 2023-08-21 20:32:42 +03:00
Anders Jonsson
2a03e50030 Update Swedish translation 2023-08-21 15:55:55 +00:00
Matthias Clasen
fb0f5b5c14 curve: Add a get_crossing vfunc 2023-08-21 11:29:14 -04:00
Matthias Clasen
cd7726bb31 Merge branch 'matthiasc/for-main' into 'main'
docs: Add more illustrations

See merge request GNOME/gtk!6311
2023-08-21 05:49:23 +00:00
Matthias Clasen
2b4e577b53 docs: Add more illustrations
Add illustrations to the various curve_to methods
of GskPathBuilder.
2023-08-20 22:28:06 -07:00
Matthias Clasen
1ed695931f Merge branch 'matthiasc/for-main' into 'main'
path: Don't accept 'O' as path command

See merge request GNOME/gtk!6305
2023-08-21 04:15:27 +00:00
Matthias Clasen
51a44ddd1d Merge branch 'bilelmoussaoui/gi-docgen-links' into 'main'
docs: Stop using C symbols as links

See merge request GNOME/gtk!6310
2023-08-21 04:14:57 +00:00
Jürgen Benvenuti
ac76cadf32 Update German translation
(cherry picked from commit f237c85c8f)
2023-08-20 17:47:37 +00:00
Bilal Elmoussaoui
5516ff6a02 docs: Stop using C symbols as links
They are much harder for the bindings to figure out the type back from it and usually just break
2023-08-20 10:59:49 +02:00
Baurzhan Muftakhidinov
f2578fcfb9 Update Kazakh translation 2023-08-19 18:04:04 +00:00
Piotr Drąg
4da80520b8 Update Polish translation 2023-08-19 17:18:25 +02:00
Matthias Clasen
b12a27083d path: Drop special contour parsing
This is not used currently, since we don't
have custom contours.
2023-08-18 18:06:44 -04:00
Matthias Clasen
07ec266a00 curve: Add a get_derivative vfunc 2023-08-18 13:46:42 -04:00
Sabri Ünal
965b3025d9 Update Turkish translation 2023-08-18 17:35:14 +00:00
Matthias Clasen
88e74ca21e path: Don't accept 'O' as path command
We don't have conics atm.
2023-08-18 13:19:48 -04:00
Matthias Clasen
148da12cfc Cosmetics 2023-08-18 13:19:33 -04:00
Matthias Clasen
3ded6ada0c Merge branch 'matthiasc/for-main' into 'main'
contour: Optimize bounds

See merge request GNOME/gtk!6304
2023-08-18 14:35:09 +00:00
Matthias Clasen
0c39890e0f contour: Optimize bounds
Cache the bounds in the contour, and compute
the stroke bounds based on it as well.
2023-08-18 10:02:14 -04:00
G.Willems
b4977decc1 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-17 22:26:00 +02:00
Jiri Grönroos
2da9d5862f Update Finnish translation 2023-08-17 17:51:26 +00:00
Matthias Clasen
b948e03e8a Merge branch 'dboles/popover-menu-flags-property' into 'main'
PopoverMenu: Make :flags a property for use in UI…

Closes #6030

See merge request GNOME/gtk!6298
2023-08-17 10:26:16 +00:00
Daniel Boles
2c90cadef4 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-17 10:52:35 +01:00
Matthias Clasen
08c064d79a Merge branch 'matthiasc/for-main' into 'main'
Rename an internal function

See merge request GNOME/gtk!6301
2023-08-16 20:40:12 +00:00
Matthias Clasen
73853f1a6b contour: Add an assertion 2023-08-16 16:18:38 -04:00
Matthias Clasen
8634d67cff Some fixes for gsk_path_builder_add_segment
We must be careful with single-point contours
that contain just a move. These never occur in
practice, but our randomized tests produce them
regularly.
2023-08-16 16:15:26 -04:00
Matthias Clasen
125ea90894 Rename an internal function
We want the number of ops, not the number of points.
2023-08-16 15:54:46 -04:00
Matthias Clasen
ffba5a3f42 Merge branch 'matthiasc/for-main' into 'main'
build: Drop some unused variables

See merge request GNOME/gtk!6297
2023-08-16 19:28:12 +00:00
Matthias Clasen
60df21213b Merge branch 'dboles/popover-css-nodes' into 'main'
Popover: Fix & add to CSS nodes documentation

See merge request GNOME/gtk!6300
2023-08-16 19:16:12 +00:00
Sabri Ünal
14ba577acb Update Turkish translation 2023-08-16 18:31:30 +00:00
Benjamin Otte
7d5ef1117e Merge branch 'color-matrix' into 'main'
Color matrix node fixes & clarifications

See merge request GNOME/gtk!6290
2023-08-16 17:07:35 +00:00
Daniel Boles
af0e2bff94 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-16 17:11:45 +01:00
Matthias Clasen
7d65f81d7f Merge branch 'path-world-resource' into 'main'
Fix MSVC build (turn world map path into a resource)

See merge request GNOME/gtk!6296
2023-08-16 13:51:32 +00:00
Matthias Clasen
b08ecfcf9e build: Drop some unused variables
We are not using gtk_private_packages at all,
so drop it.
2023-08-16 09:43:34 -04:00
Matthias Clasen
e2cd362f24 Merge branch 'fg_color_docs' into 'main'
gsk: Update docs for gtk_snapshot_append_layout

See merge request GNOME/gtk!6295
2023-08-16 12:52:43 +00:00
Yuri Chornoivan
1a1b6fe66b Update Ukrainian translation 2023-08-16 11:37:47 +00:00
Sergey Bugaev
122176a3a1 gtk-demo: Turn world map path into a resource
The C string literal way way too long for MSVC.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
2023-08-16 14:35:35 +03:00
Matthias Clasen
5beccc8208 Merge branch 'fix-pc-files' into 'main'
meson: Add wayland-client to gtk4-wayland requires

See merge request GNOME/gtk!6293
2023-08-16 11:29:39 +00:00
Matthias Clasen
6715a3267a Merge branch 'remove-out-caller-allocates-from-pod-types' into 'main'
introspection: Remove 'caller-allocates' from POD types

See merge request GNOME/gtk!6294
2023-08-16 11:29:25 +00:00
Alexandros Theodotou
313078b77c gsk: Update docs for gtk_snapshot_append_layout
Mention how to get the current theme's foreground color.
2023-08-16 20:09:15 +09:00
Sergey Bugaev
246a7cfeab 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-16 13:55:04 +03:00
Sergey Bugaev
082fdfdb24 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-16 13:54:54 +03:00
Philip Chimento
823cb714ec 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-15 22:30:27 -07:00
Ekaterine Papava
cc93347fe6 Update Georgian translation 2023-08-16 03:36:32 +00:00
Xavier Claessens
d6a07cd617 meson: Add x11_dep to gtk4-x11 requires 2023-08-15 21:17:39 -04:00
Fran Dieguez
858bd9f84c Update Galician translation 2023-08-15 23:40:15 +00:00
Matthias Clasen
be7e5c866f Merge branch 'matthiasc/for-main' into 'main'
gsk: Add more details to the docs

See merge request GNOME/gtk!6292
2023-08-15 19:27:59 +00:00
Matthias Clasen
93a90bafc3 Add some statistics to the map demo 2023-08-15 13:55:46 -04:00
Xavier Claessens
090e01b383 meson: Add wayland-client to gtk4-wayland requires 2023-08-15 13:35:46 -04:00
Matthias Clasen
03a511aab4 path-tool: Make info show statistics
It is somewhat interesting to know how many
contours, lines, etc. a path consists of.
2023-08-15 13:33:23 -04:00
Matthias Clasen
5cf9a09c07 gsk: Add more details to the docs 2023-08-15 12:38:24 -04:00
Matthias Clasen
9558c70683 Merge branch 'dboles/signal-factory-typos' into 'main'
SignalListItemFactory: small doc grammar+sense fix

See merge request GNOME/gtk!6291
2023-08-15 14:36:35 +00:00
Daniel Boles
57d98a12fa 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-15 10:47:30 +01:00
Danial Behzadi
3dd40049a9 Update Persian translation 2023-08-14 22:35:12 +00:00
Matthias Clasen
225e626ada Merge branch 'matthiasc/for-main' into 'main'
Fix GskStandardContour to have a 'good' size

See merge request GNOME/gtk!6289
2023-08-14 20:28:46 +00:00
Matthias Clasen
081f504ae4 Tweak the directions illustration
Still not 100% happy with it, but it is better.
2023-08-14 16:09:27 -04:00
Matthias Clasen
45aa8e4e00 Fix GskStandardContour to have a 'good' size
We need the size of GskStandardContour to be
at least as aligned as graphene_point_t, or
things break in hard to debug ways.
2023-08-14 15:59:45 -04:00
Matthias Clasen
87430be658 Fix up a testcase
I had gotten the path direction enum mixed up here.
2023-08-14 15:59:45 -04:00
Matthias Clasen
012c16ccd6 Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Clean up path walk demo

See merge request GNOME/gtk!6288
2023-08-14 19:20:57 +00:00
Matthias Clasen
de0cef5d4d Merge branch 'path-convenience' into 'main'
pathpoint: Add gsk_path_get_rotation

See merge request GNOME/gtk!6284
2023-08-14 19:20:40 +00:00
Matthias Clasen
e807a84967 gtk-demo: Clean up path walk demo 2023-08-14 15:19:42 -04:00
Matthias Clasen
b5e105d4f4 snapshot: Add more path api
Add convenience methods to fill or stroke
a path with a color.
2023-08-14 14:58:22 -04:00
Matthias Clasen
a85ab3585e Revise gsk_path_point_get_tangent
Update the directions enum to allow all four
tangents to be obtained. Add an illustration
to the docs for clarity.

Update all callers.
2023-08-14 14:58:22 -04:00
Matthias Clasen
a1d40c5236 Add gsk_path_point_get_rotation
This returns the tangent in the form of an angle.
2023-08-14 14:58:22 -04:00
Matthias Clasen
95ea6b2615 Merge branch 'path-point-api-revision2' into 'main'
pathpoint: Revise argument order

See merge request GNOME/gtk!6287
2023-08-14 18:53:23 +00:00
Ekaterine Papava
82d8bc9403 Update Georgian translation 2023-08-14 18:34:10 +00:00
Matthias Clasen
536d432444 Merge branch 'path-map-demo' into 'main'
demos: Add a map demo

See merge request GNOME/gtk!6285
2023-08-14 17:49:26 +00:00
Yuri Chornoivan
3b8c26a116 Update Ukrainian translation 2023-08-14 17:30:53 +00:00
Matthias Clasen
6ace4b60d8 pathpoint: Revise argument order
In order for introspection and documentation to
not be confused, we need to have the GskPathPoint
be the first argument.

Update all callers.
2023-08-14 13:20:34 -04:00
Matthias Clasen
7601b89561 Merge branch 'fix-4986' into 'main'
Fix native filechooser on macOS

Closes #4986

See merge request GNOME/gtk!6272
2023-08-14 16:26:15 +00:00
Matthias Clasen
0cdd2e7008 Merge branch 'color-dialog-button-activate' into 'main'
Make new-style dialog buttons activatable

See merge request GNOME/gtk!6255
2023-08-14 16:26:13 +00:00
Piotr Drąg
595152bdba Update POTFILES.in 2023-08-14 15:16:29 +02:00
Benjamin Otte
90f0733673 demos: Add a map demo
For now, this just shows a world map.

Once we have measures, we can make this
a little more interesting.
2023-08-14 08:41:16 -04:00
Matthias Clasen
625e83e1de Merge branch 'wip/alice/menu-button' into 'main'
menubutton: Fix focus on the internal gizmo

Closes #6025

See merge request GNOME/gtk!6283
2023-08-14 11:19:21 +00:00
Matthias Clasen
daac04be82 Merge branch 'bilelmoussaoui/gi' into 'main'
gi: Add missing since annotation

See merge request GNOME/gtk!6282
2023-08-14 11:15:28 +00:00
Matthias Clasen
8ec9bba892 Merge branch 'dboles/inspector-object-tree-flash' into 'main'
inspector/object-tree: Fix ! flash @ select widget

Closes #6022

See merge request GNOME/gtk!6279
2023-08-14 11:14:49 +00:00
Alice Mikhaylenko
b63e365fd2 menubutton: Fix focus on the internal gizmo
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/6025
2023-08-14 14:24:06 +04:00
Daniel Boles
859a25b0e7 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-14 10:48:26 +01:00
Bilal Elmoussaoui
f5d47a4658 gi: Add missing since annotation 2023-08-14 08:41:12 +00:00
Matthias Clasen
fa6645f157 Merge branch 'fix-add-segment' into 'main'
Fix gsk_path_builder_add_segment

See merge request GNOME/gtk!6280
2023-08-14 01:01:37 +00:00
Joshua Lee
69b6067c5e fontdialogbutton: Make activatable 2023-08-14 01:26:23 +01:00
Joshua Lee
e645f59748 colordialogbutton: Make activatable 2023-08-14 01:26:20 +01:00
Efstathios Iosifidis
2929686c1d Update Greek translation 2023-08-13 21:18:23 +00:00
Andika Triwidada
c83256e080 Update Indonesian translation 2023-08-13 13:42:39 +00:00
Matthias Clasen
4b7e1b1233 Fix gsk_path_builder_add_segment
We were splitting the last segment, but did not
actually use the result of the split. Oops.
2023-08-13 09:40:19 -04:00
Matthias Clasen
95a8821614 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-13 09:31:42 -04:00
Benjamin Otte
73500f9ebb Merge branch 'wip/otte/for-main' into 'main'
treeviewcolumn: Set ascending class for ascending order

Closes #6002

See merge request GNOME/gtk!6277
2023-08-13 03:54:19 +00:00
Matthias Clasen
eae38756c2 Merge branch 'matthiasc/for-main' into 'main'
path-tool: Make the docs match

See merge request GNOME/gtk!6278
2023-08-12 23:51:21 +00:00
Matthias Clasen
8bf7187b89 path-tool: Make the docs match
We've removed various things from the tool,
and forgot to keep the docs up-to-date.
2023-08-12 19:29:27 -04:00
Matthias Clasen
e7fb8842b5 Merge branch 'path-for-merge-8' into 'main'
Add gtk-path-tool

See merge request GNOME/gtk!6263
2023-08-12 21:39:15 +00:00
Matthias Clasen
aaac0cb4a1 Merge branch 'bilelmoussaoui/linkify' into 'main'
docs: Drop uneeded ` in gi-docgen links

See merge request GNOME/gtk!6276
2023-08-12 21:23:13 +00:00
Benjamin Otte
67a4279d3f rendernode: Put typedef into gsktypes.h
Makes includes simpler for headers that want to use GskRenderNode.
2023-08-12 23:13:47 +02:00
Benjamin Otte
dd4b8a4c89 gl: Pass swizzle array directly
There's no need to pass pointers to arrays, as arrays are already
pointers.
2023-08-12 23:13:23 +02:00
Benjamin Otte
4cc5a54da3 viewport: Fix leak
Fixes #6002
2023-08-12 23:13:23 +02:00
Benjamin Otte
07add0144e columnview: Fix refcounting woes
The new code did not deal with the GtkScrollInfo properly.

Related: #6002
2023-08-12 23:13:23 +02:00
Benjamin Otte
d1c7376b05 gdkcontext: Make has_unpack_subimage() do the version check
Makes the code look simpler when we actually use that function.
2023-08-12 23:13:23 +02:00
Benjamin Otte
a71388d2d6 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-12 23:13:23 +02:00
Matthias Clasen
62176a3bd0 tools: Add gtk4-path-tool
This comes in handy for testing, among other things.

For now, this supports decomposing, reversing, rendering,
info and preview.
2023-08-12 16:34:19 -04:00
Bilal Elmoussaoui
8475a29836 docs: Drop uneeded ` in gi-docgen links
Causes the rust docs to fail parsing those as links
2023-08-12 22:26:25 +02:00
Matthias Clasen
44bc5a139c Add rounded rects to the tests 2023-08-12 16:09:31 -04:00
Matthias Clasen
11f48f3c5b Add gsk_path_builder_add_rounded_rect
For now, this is using gsk_path_builder_svg_arc_to
to approximate elliptical arcs.
2023-08-12 15:34:54 -04:00
Matthias Clasen
fa4ad1590d Merge branch 'matthiasc/for-main' into 'main'
path: Some documentation improvements

See merge request GNOME/gtk!6273
2023-08-11 16:42:25 +00:00
Matthias Clasen
47ddc742fc path: Some documentation improvements
Among other things, add a quick summary of
SVG path syntax, and add a few illustrations.
2023-08-11 12:09:12 -04:00
Matthias Clasen
31d994837b Merge branch 'path-tests-3' into 'main'
path builder: Fix add_cairo_path

Closes #6011

See merge request GNOME/gtk!6270
2023-08-11 12:44:00 +00:00
Matthias Clasen
83d692e2d3 path: Add tests for gsk_path_builder_add methods
Check that they all end the current contour.

Fixes: #6011
2023-08-11 07:24:19 -04:00
Qiu Wenbo
2a96dde115 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-11 16:19:48 +08:00
Qiu Wenbo
f55b3c68ad 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-11 16:19:38 +08:00
Matthias Clasen
f2835bb48b pathbuilder: Treat current point consistently
Arrange that none of the 'add' methods change
the current point.
2023-08-10 22:56:47 -04:00
Fran Dieguez
857c22db32 Update Galician translation 2023-08-11 00:35:58 +00:00
Matthias Clasen
fff1645060 path builder: Fix add_cairo_path
We were forgetting to end the current contour.
2023-08-10 16:08:32 -04:00
Matthias Clasen
4f0c3c81fb Merge branch 'matthiasc/for-main' into 'main'
Matthiasc/for main

See merge request GNOME/gtk!6269
2023-08-10 04:28:26 +00:00
Matthias Clasen
421365cfc3 Add more path point tests 2023-08-09 23:55:08 -04:00
Matthias Clasen
59c5b41f3d Cosmetics 2023-08-09 23:48:50 -04:00
Matthias Clasen
267367355f Merge branch 'path-fill-tests2' into 'main'
Add more path fill tests

See merge request GNOME/gtk!6268
2023-08-10 03:10:14 +00:00
Matthias Clasen
0aa3356499 Add more path fill tests
These also used to live with measure tests.
2023-08-09 22:47:13 -04:00
Matthias Clasen
14a3b35333 Merge branch 'path-fill-tests' into 'main'
Add path fill tests

See merge request GNOME/gtk!6267
2023-08-10 02:21:34 +00:00
Matthias Clasen
77def95659 Add path fill tests
These used to live with the measure tests, but
path_in_fill no longer involves a measure.
2023-08-09 21:50:29 -04:00
Matthias Clasen
4e91cd1155 Merge branch 'matthiasc/for-main' into 'main'
pathpoint: Use the right type

See merge request GNOME/gtk!6266
2023-08-09 20:37:14 +00:00
Matthias Clasen
2d923d362f Merge branch 'bilelmoussaoui/gi-gsk' into 'main'
gsk/gi: new Path api fixes

See merge request GNOME/gtk!6265
2023-08-09 19:40:53 +00:00
Matthias Clasen
b7544636d4 contour: Skip the move
When jumping between segments, we always
need to skip index 0, since thats the move.

This fixes the tangent checks in the
rectangle tests.
2023-08-09 15:12:58 -04:00
Matthias Clasen
6220baf230 get_closest_point: Prefer earlier points
Only switch to a later point if it is strictly
closer than the existing match. This fixes
start- vs endpoint confusion in the rectangle
tests.
2023-08-09 15:12:52 -04:00
Matthias Clasen
917307a6a4 pathpoint: Use the right type 2023-08-09 14:37:14 -04:00
Matthias Clasen
5f49b7b492 Merge branch 'matthiasc/for-main' into 'main'
pathpoint: Clarify docs

See merge request GNOME/gtk!6262
2023-08-09 18:36:05 +00:00
Bilal Elmoussaoui
b03abea402 gsk: Don't change the GskRenderNodeType order
As we use their values to check that a node can be downcasted to a node
type in the Rust bindings
such change would break existing code
2023-08-09 20:26:46 +02:00
Bilal Elmoussaoui
d4fcc883cb gsk/gi: Add missing since annotations & docs 2023-08-09 20:26:46 +02:00
Daniel Boles
ca2a2697d6 Merge branch 'dboles/for-main' into 'main'
docs: Add/fix some links; avoid pluralisation

See merge request GNOME/gtk!6261
2023-08-09 16:57:19 +00:00
Matthias Clasen
68c6f63e90 pathpoint: Clarify docs
Add a paragraph explaining the situation
for comparing the start- and endpoint of
a closed path.
2023-08-09 11:30:26 -04:00
Daniel Boles
0e89fed8ed 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-09 15:35:12 +01:00
Benjamin Otte
4d726543d0 Merge branch 'path-for-merge-6' into 'main'
Simplify GskPathPoint

See merge request GNOME/gtk!6260
2023-08-09 14:24:33 +00:00
Matthias Clasen
2bcc998e90 Add tests for gsk_path_builder_add_segment
Test at least some of the special cases:
- start and end point on the same contour
- start and end point on the same segment
- end before start
2023-08-09 07:01:01 -04:00
Matthias Clasen
f707185248 Add gsk_path_builder_add_segment
With GskPathPoint, we can subset paths without
a measure object.
2023-08-09 07:01:01 -04:00
Matthias Clasen
ded30049db path: Add gsk_path_get_start/end_point
These are useful to have, now that we are
relying more on GskPathPoint in our api.
2023-08-08 22:05:34 -04:00
Matthias Clasen
5c55e9d11e Add gsk_path_point_equal/compare
These just make sense to have.
2023-08-08 22:05:34 -04:00
Matthias Clasen
c35bb11c18 Simplify GskPathPoint
Use simple representation of just
{ contour index, segment index, t value }
2023-08-08 20:31:56 -04:00
Matthias Clasen
cc19781d27 Merge branch 'cpdb-fix' into 'main'
print: Update printerprivate header location for cpdb backend

See merge request GNOME/gtk!6259
2023-08-08 23:01:12 +00:00
Jeremy Bícha
08d08678e8 print: Update printerprivate header location for cpdb backend
This fixes the print-cpdb build option
2023-08-08 17:55:54 -04:00
Matthias Clasen
11b632a691 Merge branch 'timezone' into 'main'
test-calendar: Update timezone name

See merge request GNOME/gtk!6258
2023-08-08 19:31:31 +00:00
Jeremy Bícha
4881ef251e test-calendar: Update timezone name
Debian no longer provides the MET timezone
but instead provides geographical region and city name
2023-08-08 15:01:42 -04:00
Luca Bacci
5b39abd1a4 Merge branch 'fix-server-side-decorations' into 'main'
win32: Fix minimize and maximize buttons missing on ssd

Closes #5142

See merge request GNOME/gtk!6052
2023-08-08 15:17:09 +00:00
Daniel Mustieles
f0089097dd Update Spanish translation 2023-08-08 10:41:17 +00:00
Fran Dieguez
d603925ab2 Update Galician translation 2023-08-08 00:05:18 +00:00
Matthias Clasen
6af9dc8612 Merge branch 'xry111/issue6003' into 'main'
print: Revert "Start sorting apart includes" change for gtkprinteroptionprivate.h

Closes #6003

See merge request GNOME/gtk!6250
2023-08-07 22:52:43 +00:00
Benjamin Otte
35b313f9b0 Merge branch 'path-for-merge-3' into 'main'
gskpath: Add stroking

See merge request GNOME/gtk!6248
2023-08-07 22:17:53 +00:00
Matthias Clasen
fe84ce8686 gsk: Try to fix flipped fallback rendering
This patch is pretty much a blind guess, but
it seems to fix flipped rendering of fill
and stroke nodes.
2023-08-07 17:53:49 -04:00
Matthias Clasen
02a4e5a457 Add compare tests for fill and stroke nodes 2023-08-07 13:02:57 -04:00
Matthias Clasen
a548a91e6d Add nodeparser tests for fill and stroke nodes 2023-08-07 13:02:57 -04:00
Matthias Clasen
fc3c2e0942 gsk: Implement parsing fill and stroke nodes
Make serialization and deserialization work for stroke and
fill nodes.
2023-08-07 13:02:57 -04:00
Matthias Clasen
60e07335a1 demos: Add stroking to the path fill demo 2023-08-07 13:02:57 -04:00
Benjamin Otte
cb6b968fb5 snapshot: Add gtk_snapshot_push_stroke()
This is the obvious GtkSnapshot API to go
along with the new stroke nodes.
2023-08-07 13:02:57 -04:00
Benjamin Otte
3aa3816125 gsk: Add GskStrokeNode
Take a rendernode as source and a GskPath and GskStroke,
and fill the area that is covered when stroking the path
with the given stroke parameters, like cairo_stroke() would.
2023-08-07 13:02:57 -04:00
Matthias Clasen
c37c29422a Add gsk_path_get_stroke_bounds
This is a helper to compute the bounds for
stroke nodes. We keep it private for now.
2023-08-07 13:02:57 -04:00
Matthias Clasen
db71c07f8f Add GskStroke
A GskStroke struct collects the parameters that are
needed for stroking a path.
2023-08-07 13:02:57 -04:00
Emmanuele Bassi
bf1b97efd3 Merge branch 'gdk-macos-depth-fix' into 'main'
gdk: Fix compilation on macos

See merge request GNOME/gtk!6208
2023-08-07 14:46:47 +00:00
Xi Ruoyao
4d7277f72c 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-07 22:29:10 +08:00
Matthias Clasen
3296f01edf Merge branch 'path-fixes' into 'main'
Fix path point preconditions

See merge request GNOME/gtk!6251
2023-08-07 13:00:18 +00:00
Matthias Clasen
dbcbf0523b Add tests for GskPathPoint
As always, untested code doesn't work...
2023-08-07 08:33:05 -04:00
Matthias Clasen
888abb6f24 path: Make get_closest_point work
We weren't setting point->path. Oops.
Good to have tests.
2023-08-07 08:33:05 -04:00
Matthias Clasen
9b916b329a pathpoint: Implement get_tangent fully
We were not taking the direction into account
at all.
2023-08-07 08:33:05 -04:00
Matthias Clasen
eb3ada6386 Fix path point preconditions
These were inverted and did not work. Oops.
2023-08-07 08:32:50 -04:00
Matthias Clasen
2a725b658b Merge branch 'path-for-merge-2' into 'main'
GskPath for merge, part 0

See merge request GNOME/gtk!6247
2023-08-07 01:31:37 +00:00
Benjamin Otte
97f605f811 demos: Add a simple demo filling a path 2023-08-06 21:01:11 -04:00
Benjamin Otte
4e7d578881 rendernode: Implement fast-path for solid fills
They happen so often that it's worth avoiding the clip + paint path
there.
2023-08-06 21:01:11 -04:00
Benjamin Otte
438d936f57 gtk: Add gtk_snapshot_push_fill()
This is the obvious GtkSnapshot API to go
along with the new fill nodes.
2023-08-06 21:01:11 -04:00
Benjamin Otte
fc4a464b47 gsk: Add GskFillNode
Take a rendernode as source and a GskPath and fill
the region inside the path with the source, just like
cairo_fill() would.
2023-08-06 21:01:11 -04:00
Matthias Clasen
785b9541f6 gsk: Add tests for GskPath 2023-08-06 21:01:11 -04:00
Matthias Clasen
a4cbabb80f gsk: Add tests for GskCurve 2023-08-06 20:48:09 -04:00
Matthias Clasen
1b5dfcba7e gsk: Add GskPath
This commit adds the basic infrastructure for paths.
The public APIs consists of GskPath, GskPathPoint and
GskPathBuilder.

GskPath is a data structure for paths that consists
of contours, which in turn might contain Bézier curves.
The Bezier data structure is inspired by Skia, with separate
arrays for points and operations. One advantage of this
arrangement is that start and end points are shared
between adjacent curves.

A GskPathPoint represents a point on a path, which can
be queried for various properties.

GskPathBuilder is an auxiliary builder object for paths.
2023-08-06 20:48:09 -04:00
Matthias Clasen
ba41edf531 gsk: Add tests for GskBoundingBox 2023-08-06 17:16:46 -04:00
Matthias Clasen
bf3892caed gsk: Add a bounding box type
graphene_rect_t is not well-suited for this purpose,
since you end up with floating-point precision problems
at the upper bound (x + width, y + height).
2023-08-06 17:16:30 -04:00
Benjamin Otte
1e6a95aa1b Merge branch 'grid-scroll-crash' into 'main'
gtkgridview: Fix crash on scroll to 0 sized tile

Closes #5945

See merge request GNOME/gtk!6228
2023-08-06 17:56:57 +00:00
tszymanski
70a9d08e21 gtkgridview: return empty area for empty tiles during scroll 2023-08-06 10:26:32 -07:00
Piotr Drąg
7511d4e281 Update Polish translation 2023-08-06 14:22:51 +02:00
Asier Sarasua Garmendia
53ea97decb Update Basque translation 2023-08-06 07:20:22 +00:00
Matthias Clasen
28190ded71 Merge branch 'matthiasc/for-main' into 'main'
Update tests

See merge request GNOME/gtk!6244
2023-08-05 19:32:56 +00:00
Matthias Clasen
8083cb0e47 Merge branch 'smaller-than' into 'main'
section-accessibility: Close tag

See merge request GNOME/gtk!6243
2023-08-05 19:21:44 +00:00
Matthias Clasen
d241ec4f3e Update tests 2023-08-05 15:02:00 -04:00
Hari Rana
544320a961 section-accessibility: Close tag 2023-08-05 12:25:23 -04:00
Florentina Musat
ee5a95ba24 Update Romanian translation 2023-08-05 15:54:45 +00:00
Jordi Mas
232260b86b Update Catalan translation 2023-08-05 17:30:28 +02:00
Matthias Clasen
857f50649c Merge branch 'microoptimize-label-wfh' into 'main'
Microoptimize GtkLabel width-for-height computation

See merge request GNOME/gtk!6219
2023-08-05 15:15:55 +00:00
Matthias Clasen
a39d9d60a7 Merge branch 'bilelmoussaoui/tree-deprecated' into 'main'
gi: Mark more GtkTreeModel types as deprecated

See merge request GNOME/gtk!6241
2023-08-05 12:09:25 +00:00
Bilal Elmoussaoui
5f9bc97291 gi: Mark more GtkTreeModel types as deprecated
They show up in rust docs as not deprecated without this
2023-08-05 13:10:52 +02:00
Matthias Clasen
01b3b096fe Post-release version bump 2023-08-05 05:42:32 -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
tszymanski
a483fb2d96 gtkgridview: Fix crash on scroll to 0 sized tile
No longer crashes with my listview_clocks demo or in real scrolling in
my application. "GtkGridView failed to scroll to given position. Ignoring..."
warnings are printed when it would have crashed.

Sometimes the scroll jumps incorrectly when it doesn't crash, but that's
a separate bug but is probably related to whatever is causing this
crash.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5945, at least in
terms of the immediate crash.
2023-08-01 22:17:54 -07: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
Sergey Bugaev
d27e7e0180 label: Microoptimize width-for-height computation
We told Pango to limit width to mid pixels, and it returned a layout
size of text_width by text_height; text_width can be considerably
smaller than mid. If the layout fits, we know that it fits at
text_width, so set max to that. This lets us skip many iterations in a
typical case.
2023-07-28 18:42:17 +03: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
Jayson Reis
aa888c0b3f gdk: Remove a leftover reference to the renamed variable prefers_high_depth 2023-07-23 23:13:47 +02: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
dgsasha
5240d8cdf5 win32: Fix minimize and maximize buttons missing on ssd
Completely fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5142
2023-06-10 23:08:21 -04: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
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
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
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
2145 changed files with 178063 additions and 78909 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

@@ -24,9 +24,9 @@ stages:
variables:
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 -Ddemos=false -Dbuild-examples=false -Dbuild-tests=false -Dbuild-testsuite=true"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled -Dbuild-testsuite=true -Dintrospection=enabled"
MESON_TEST_TIMEOUT_MULTIPLIER: 3
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v41"
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v48"
workflow:
rules:
@@ -57,11 +57,9 @@ style-check-diff:
reports:
junit:
- "${CI_PROJECT_DIR}/_build/report-x11.xml"
- "${CI_PROJECT_DIR}/_build/report-x11_unstable.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland_unstable.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland_gles.xml"
- "${CI_PROJECT_DIR}/_build/report-broadway.xml"
- "${CI_PROJECT_DIR}/_build/report-broadway_unstable.xml"
name: "gtk-${CI_COMMIT_REF_NAME}"
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
@@ -72,6 +70,7 @@ 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"
@@ -87,7 +86,27 @@ fedora-x86_64:
script:
- .gitlab-ci/show-info-linux.sh
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- meson subprojects download
- meson subprojects update --reset
- meson setup
${COMMON_MESON_FLAGS}
${EXTRA_MESON_FLAGS}
${BACKEND_FLAGS}
${FEATURE_FLAGS}
_build
- meson compile -C _build
- .gitlab-ci/run-tests.sh _build wayland
- .gitlab-ci/run-tests.sh _build wayland_gles
release-build:
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"
- meson subprojects download
- meson subprojects update --reset
- mkdir _install
@@ -103,11 +122,8 @@ fedora-x86_64:
- 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
release-build:
fedora-clang:
extends: .build-fedora-default
stage: build
needs: []
@@ -116,7 +132,7 @@ release-build:
script:
- .gitlab-ci/show-info-linux.sh
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- export CC=clang
- meson subprojects download
- meson subprojects update --reset
- meson setup
@@ -126,7 +142,6 @@ release-build:
${FEATURE_FLAGS}
_build
- meson compile -C _build
- .gitlab-ci/run-tests.sh _build x11
fedora-mingw64:
extends: .build-fedora-default
@@ -147,23 +162,11 @@ fedora-mingw64:
script:
- .gitlab-ci/show-info-linux.sh
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- pip3 install --user meson~=1.0
- meson subprojects download
- meson subprojects update --reset
# Test that mingw64-meson still fails. If it has stopped failing, the CI
# will fail and now you should remove the hack that follows this.
- FAILED=false
- mingw64-meson --version || FAILED=true
- test $FAILED = false && echo "mingw64-meson works now, remove the hack" && exit 1
# HACK: Running mingw64-meson directly fails on the CI with:
# /usr/bin/mingw64-meson: line 92: fg: no job control
# Because rpm is not evaluating %__meson and it gets interpreted as a job
# specifier. So we fix that and run it ourselves.
- rpm --eval "%{mingw64_meson}" > mingw64-meson.sh
- sed -i -e 's/%__meson/meson/' mingw64-meson.sh
- chmod +x mingw64-meson.sh
- ./mingw64-meson.sh -Dintrospection=disabled -Dgraphene:introspection=disabled _build
- ninja -C _build
- meson -Dintrospection=disabled -Dgraphene:introspection=disabled _build
- meson compile -C _build
.mingw-defaults:
stage: build
@@ -205,7 +208,7 @@ macos:
needs: []
before_script:
- bash .gitlab-ci/show-info-osx.sh
- pip3 install --user meson~=0.64
- pip3 install --user meson~=1.0
- pip3 install --user ninja
- export PATH=/Users/gitlabrunner/Library/Python/3.7/bin:$PATH
- export MESON_FORCE_BACKTRACE=1
@@ -219,7 +222,7 @@ macos:
-Dcpp_std=c++11
-Dpixman:tests=disabled
-Dlibjpeg-turbo:simd=disabled
-Ddemos=false
-Dbuild-demos=false
-Dbuild-tests=false
-Dbuild-examples=false
-Dbuild-testsuite=false
@@ -363,10 +366,11 @@ static-scan:
EXTRA_MESON_FLAGS: "--buildtype=debug"
script:
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- meson setup
${COMMON_MESON_FLAGS}
${EXTRA_MESON_FLAGS}
${BACKEND_FLAGS}
${FEATURE_FLAGS}
_scan_build
- ninja -C _scan_build scan-build
artifacts:
@@ -381,18 +385,27 @@ asan-build:
tags: [ asan ]
stage: analysis
needs: []
when: manual
variables:
script:
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- CC=clang meson setup --buildtype=debugoptimized -Db_sanitize=address -Db_lundef=false -Dintrospection=disabled -Df16c=disabled _build
- 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
@@ -400,16 +413,16 @@ reference:
needs: []
script:
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- 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
-Ddemos=false
-Dbuild-demos=false
-Dbuild-examples=false
-Dbuild-tests=false
-Dbuild-testsuite=false

View File

@@ -1,4 +1,4 @@
FROM fedora:37
FROM fedora:38
RUN dnf -y install \
adwaita-icon-theme \
@@ -32,7 +32,7 @@ RUN dnf -y install \
glib2-static \
glibc-devel \
glibc-headers \
gnome-desktop-testing \
glslc \
gnupg2 \
gobject-introspection-devel \
graphene-devel \
@@ -73,10 +73,14 @@ RUN dnf -y install \
mesa-dri-drivers \
mesa-libEGL-devel \
mesa-libGLES-devel \
meson \
mutter \
ninja-build \
pango-devel \
pcre-devel \
pcre-static \
pipewire \
pipewire-gstreamer \
python3 \
python3-docutils \
python3-gobject \
@@ -84,6 +88,7 @@ RUN dnf -y install \
python3-markdown \
python3-packaging \
python3-pip \
python3-pydbus \
python3-pygments \
python3-typogrify \
python3-wheel \
@@ -95,6 +100,7 @@ RUN dnf -y install \
weston \
weston-libs \
which \
wireplumber \
xorg-x11-server-Xvfb \
&& dnf clean all

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

@@ -138,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,16 +6,18 @@ 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:verbosity=1:log_threads=1
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 \
@@ -26,17 +28,9 @@ case "${backend}" in
# Store the exit code for the CI run, but always
# generate the reports
exit_code=$?
xvfb-run -a -s "-screen 0 1024x768x24 -noreset" \
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \
--setup=${backend}_unstable \
--suite=flaky \
--suite=failing || true
;;
wayland)
wayland*)
export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
weston --backend=headless-backend.so --socket=wayland-5 --idle-time=0 &
@@ -44,49 +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=$?
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \
--setup=${backend}_unstable \
--suite=flaky \
--suite=failing || true
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=failing \
--no-suite=flaky \
--no-suite=gsk-compare-broadway
exit_code=$?
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \
--setup=${backend}_unstable \
--suite=flaky \
--suite=failing || true
kill ${compositor}
;;
@@ -98,7 +60,8 @@ 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 \
@@ -106,16 +69,6 @@ case "${backend}" in
--no-suite=flaky \
--no-suite=gsk-compare-opengl
# don't let Broadway failures fail the run, for now
exit_code=0
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \
--setup=${backend}_unstable \
--suite=flaky \
--suite=failing || true
kill ${server}
;;
@@ -128,20 +81,19 @@ esac
cd ${builddir}
for suffix in "" "_unstable"; do
$srcdir/.gitlab-ci/meson-junit-report.py \
$srcdir/.gitlab-ci/meson-junit-report.py \
--project-name=gtk \
--backend="${backend}${suffix}" \
--backend="${backend}" \
--job-id="${CI_JOB_NAME}" \
--output="report-${backend}${suffix}.xml" \
"meson-logs/testlog-${backend}${suffix}.json"
$srcdir/.gitlab-ci/meson-html-report.py \
--output="report-${backend}.xml" \
"meson-logs/testlog-${backend}.json"
$srcdir/.gitlab-ci/meson-html-report.py \
--project-name=gtk \
--backend="${backend}${suffix}" \
--backend="${backend}" \
--job-id="${CI_JOB_NAME}" \
--reftest-output-dir="testsuite/reftests/output/${backend}${suffix}" \
--output="report-${backend}${suffix}.html" \
"meson-logs/testlog-${backend}${suffix}.json"
done
--reftest-output-dir="testsuite/reftests/output/${backend}" \
--output="report-${backend}.html" \
"meson-logs/testlog-${backend}.json"
exit $exit_code

View File

@@ -6,7 +6,7 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliar
:: FIXME: make warnings fatal
pip3 install --upgrade --user meson~=0.64 || goto :error
meson -Ddebug=false -Dmedia-gstreamer=disabled _build || goto :error
meson setup -Dbackend_max_links=1 -Ddebug=false -Dmedia-gstreamer=disabled _build || goto :error
ninja -C _build || goto :error
goto :EOF

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

590
NEWS
View File

@@ -1,5 +1,591 @@
Overview of Changes in 4.9.5, xx-xx-xxxx
========================================
Overview of Changes in 4.13.0, xx-xx-xxxx
=========================================
Overview of Changes in 4.12.0, 05-08-2023
=========================================
* List widgets:
- Add scroll_to APIs
* GtkFileLauncher:
- Add an always-ask property
* GtkTextView:
- Make backspace behavior match GtkEntry
* gsk:
- Fix handling of luminance in mask nodes
* Text rendering:
- Automate the setting of gtk-hint-font-metrics from the
scale factor. This improves font rendering in flatpaks
* Wayland:
- Fix behavior of stylus buttons
- Support suspended window state
* Vulkan:
- Many improvements
* Tools:
- Add gtk4-rendernode-tool
* Debugging:
- Drop the GTK_DEBUG_TOUCHSCREEN flag
* Build:
- Some build options have been renamed:
gtk_doc -> documentation
update_screenshots -> screenshots
The old names still work
* Translation updates:
Georgian
Greek
Hebrew
Persian
Vietnamese
* Contributors:
Aleksandr Melman
Alexander Mikhaylenko
Alexander Shopov
Alexandre Franke
Alice Mikhaylenko
António Fernandes
Arjan Molenaar
Asier Sarasua Garmendia
Balázs Meskó
Balázs Úr
Barnabás Pőcze
Bart Jacobs
Benjamin Otte
Bilal Elmoussaoui
Boyuan Yang
Bruce Cowan
Calvin Walton
Cam Cook
Chris Mayo
Christian Hergert
Christopher Davis
Chun-wei Fan
Corey Berla
Danial Behzadi
Daniel Boles
Daniel Rusek
Efstathios Iosifidis
Ekaterine Papava
Emin Tufan Çetin
Emmanuele Bassi
Erik Schilling
Fabio Tomat
FeRD (Frank Dana)
Fina Wilke
FineFindus
Fran Dieguez
G.Willems
Georges Basile Stavracas Neto
Guillaume Bernard
Hugo Carvalho
Ivan Molodetskikh
Jason Francis
Jonas Ådahl
Jordan Petridis
Jordi Mas
José Expósito
José Roberto de Souza
Khalid Abu Shawarib
Kévin Commaille
Leônidas Araújo
Luca Bacci
Ludovico de Nittis
Lukáš Tyrychtr
Marc-André Lureau
Marco Trevisan (Treviño)
Matt Turner
Matthias Clasen
Maximiliano Sandoval R
Michael Catanzaro
Michel Dänzer
Mohammed Sadiq
Nathan Follens
Nelson Benítez León
Ngọc Quân Trần
Niels De Graef
Olivier Crête
Patrick Griffis
Piotr Drąg
Sabri Ünal
Sebastian Keller
Sophie Herold
Sébastien Le Roux
Takao Fujiwara
Thomas Lange
Yiğit Burak
Yosef Or Boczko
Yuri Chornoivan
Zander Brown
al_SeveR
dgsasha
sumibi-yakitori
tszymanski
velsinki
Алексей Шилин
Арсений Засыпкин
Overview of Changes in 4.11.4, 03-07-2023
=========================================
* GtkFileChooser:
- Default to sorting folders first
- Fix a crash when visiting recent files
* GtkTextView:
- Fix corner cases in word navigation
* GtkMenuButton:
- Normalize label layout
* GtkDropDown:
- Add support for sections
* GtkVideo:
- Make the overlay icon clickable
* GtkWindow:
- Clear the resize cursors to avoid artifacts
* GtkFileDialog:
- Always set initial-folder
* GtkDropDown:
- Update on expression changes
* GtkMapListModel:
- Implement GtkSectionModel
* Accessibility:
- Improvements all over the place: GtkButton, GtkPasswordEntry,
GtkFontChooserDialog, GtkColorChooserDialog, GtkShortcutsWindow,
GtkMenuButton, GtkAboutDialog, GtkFileChooserDialog, GtkStackSidebar,
GtkStackSwitcher, GtkMediaControls, GtkColorDialogButton, GtkDropDown,
GtkInfoBar, GtkNotebook, GtkPrintUnixDialog, GtkModelButton
- Make name computation follow the ARIA spec more closely
- Adapt name computation for the common 'nested button' scenario
- Change many containers to use `generic` instead of `group`
- Use `generic` as the default role
- Use `application` instead of `window` for windows
- Add properties for accessible names of not directly exposed
widgets in GtkListView, GtkGridView and GtkColumnView
* DND:
- Fix criticals when drops are rejected
* X11:
- Fix regressions in GLX setup
* Windows:
- Center newly created transient windows
* Vulkan:
- Add antialising for gradients
- Do less work on clipped away nodes
- Redo image uploading
- Support different image depths and formats
- Add a pipeline cache
* Demos:
- gtk4-demo: Improve window sizing
- gtk4-demo: Improve focus behavior
- gtk4-demo: Add many missing a11y properties
* Tools:
- gtk4-builder-tool: Make render an alias screenshot
* Inspector:
- Show more information in the a11y tab
- Add an accessibility overlay with warnings and recommendations
- Limit the width of the a11y tab
* Build:
- Require GLib 2.76
- Make asan builds work again
- Fix the build if ld is not ld.bdf
* Translation updates:
Brazilian Portuguese
Catalan
Czech
Georgian
Overview of Changes in 4.11.3, 05-06-2023
=========================================
* GtkGridView:
- Respect css border-spacing
- Don't leak the factories
* GtkListView:
- Don't leak the factories
* GtkColumnView:
- Support displaying sections
* GtkNotebook:
- Make the pages model implement GtkSelectionModel
* GtkScrolledWindow:
- Propagate child measure size whenever possible
* GtkPopoverMenu:
- Avoid unnecessary left padding
* GtkSearchEntry:
- Improve size allocation for the clear icon
* GtkBoxLayout:
- Fix a regression from recent baseline work
* CSS:
- Add new binding-friendly css provider apis
* Theme:
- Show focus in the shortcuts window
* GDK:
- Support grayscale and alpha texture formats for loading
and saving to png and tiff, and in GL
- Fix some regressions in GL context initialization
* GSK:
- Support grayscale and alpha texture formats in the GL renderer
- Support straight alpha textures in the GL renderer
- Many improvements to the experimental Vulkan renderer
* Wayland:
- Make exporting surface handles more flexible
* X11:
- Trap XRandr errors
- Stop using passive grabs during DND
* Windows:
- Many cleanups and simplifications
* Tests:
- Improve test coverage
* Build:
- Some build options have been renamed:
demos -> build-demos
profile -> demo-profile
The old names still work
* Deprecations:
- gtk_css_provider_load_from_data
- gdk_wayland_toplevel_unexport_handle
- gdk_pixbuf_get_from_surface
- gdk_pixbuf_get_from_texture
- gtk_image_new_from_pixbuf
- gtk_image_set_from_pixbuf
- gtk_picture_new_for_pixbuf
- gtk_picture_set_pixbuf
* Translation updates:
Basque
Catalan
Georgian
Russian
Turkish
Overview of Changes in 4.11.2, 09-05-2023
=========================================
* GtkGLArea:
- Add an allowed-apis property
* GtkListBox:
- Fix a problem with gtk_list_box_remove_all
* Add the GtkSectionModel interface, and implement it in most
of our list models
* GtkListView:
- Support displaying sections
* GtkCenterBox:
- Add a shrink-center-last property
* GtkButton, GtkMenuButton:
- Add a can-shrink property
* GtkPopover:
- Fix problems with grabs
* GtkFileChooser:
- Fix a problem with removing files
- Make the date, time and location columns work
- Fix filtering in the save entry popup
- A few memory leak fixes
- Handle webdav in the pathbar
* GtkBox:
- Support baselines in vertical orientation with GtkBox:baseline-child
* Dialogs:
- Destroy windows promptly when the async callback finishes
- Detect absence of the OpenURI portal and fall back
* Theme:
- Add explicit style classes to a number of widgets
- Fix some contrast issues in the dark theme
* Accessibility:
- Fix alert dialogs in the a11y tree
- Improve accessibility of GtkShortcutsWindow
* Layout:
- Some fixes to baseline alignment
- Separate GTK_ALIGN_BASELINE_CENTER and _FILL
* CSS:
- Fix a crash with color transitions
* GSK:
- Fix problems with negative scales
- Improve scaling of offscreens for (cross-fades, masks, blends)
* GL:
- Add GdkGLTextureBuilder, a more flexible api for creating textures
- Support setting update regions for GL textures
- Ensure that we work with GLES 2
* Vulkan:
- More fixes to the experimental Vulkan renderer
- Rework glyph caching
* Wayland:
- Don't destroy wl_surfaces on hide
- Plug leaks of compositor-side resources
* X11:
- Fix artifacts in gnome-shell frame decorations
* Windows:
- Fix GL context initialization
* Inspector:
- Improve the action list
- Improve the accessibility pane
- Fix a crash
* Tools:
- gtk4-node-editor: Improve scaling
- gtk4-node-editor: Preserve aspect ratio of textures
- gtk4-node-editor: Add some smarter editing
- gtk4-demo: Make the stylus demo work with mice
* Deprecations:
- gtk_widget_get_allocated_width/height/baseline
- GTK_ALIGN_BASELINE
* Translation updates
Bulgarian
Chinese (China)
Friulian
Galician
Hebrew
Persian
Polish
Portuguese
`Russian
Turkish
Overview of Changes in 4.11.1, 03-04-2023
=========================================
* GtkLabel, GtkLinkButton:
- Make file:// uris work again
* GtkListView/GtkColumnView/GtkGridView:
- Fix clipping issues
- Handle focus movement better
- Introduce ::tab-behavior properties
- Introduce GtkListItem::focusable
- Introduce GtkColumnViewCell
- Introduce row factories in GtkColumnView
- Make list grid and column views inert when not rendering
* Drag-and-Drop:
- Support resizing drag surfaces, using the new
GdkDragSurface::compute-size signal
* Theme:
- Port .boxed-list style from Adwaita
- Make insensitive pictures appear grayed out
* Accessibility:
- Fix memory leaks
- Fix a crash
* GDK:
- Add gdk_surface_get_scale to get the fractional scale
- Use fractional scales on Wayland with cairo
- Use fractional scales on Wayland with GL if GDK_DEBUG=gl-fractional
is set. This support is still experimental
* GSK:
- Allow limiting texture sizes with GSK_MAX_TEXTURE_SIZE
- Use samplers for GL texture filtering
- Fix problems with texture slicing
- Avoid re-uploading textures when possible
- Use mipmaps when it is beneficial
* Wayland:
- Fix handling of Drag hotspots
- Fix a crash with cursor size 0
- Support absolute paths in WAYLAND_DISPLAY
- Use the fractional scale protocol
- Use a viewporter to set buffer scale
* Windows:
- Fix problems with WGL
* Vulkan:
- Some fixes to the experimental Vulkan renderer
- Support fractional scaling
* Debugging:
- Show more Wayland-specific information in the inspector
* Deprecations:
- gtk_widget_translate_coordinates
- gdk_surface_create_similar_surface
* Documentation:
- Add a section on coordinate systems
* Build:
- Require wayland-protocols 1.31
* Translation updates
- British English
- Bulgarian
- Chinese (China)
- Dutch
- French
- Persian
- Russian
Overview of Changes in 4.10.1, 14-03-2023
=========================================
* GtkFileChooser
- Improve search performance
- Be safe against pathless files
- Fix memory leaks
- Only show local files in recent files
- Show most recent files first
- Make files non-selectable in selet_folder mode
* GtkListView / GtkColumnView / GtkGridView
- Fix scrolling problems
- Support CSS border-spacing
* GtkComboBox
- Fix a size allocation problem
* gtk
- Size allocation fixes
* Accessibility
- Miscellaneous property fixes and improvements
* Wayland
- Fix an ordering problem in surface disposal
* Windows
- Fix Visual Studio build with older GLib
* Translation updates
Basque
Bulgarian
Catalan
Czech
Danish
Finnish
Friulian
Galician
Georgian
Hungarian
Lithuanian
Polish
Portuguese
Swedish
Turkish
Ukrainian
Overview of Changes in 4.10.0, 04-03-2023
=========================================
* GtkTextView
- Document hanging indentation
* GtkListView
- Fix a size allocation problem
* GtkFileChooser
- Fix paned behavior
- Fix a crash
* GtkText
- Fix various problems with undo
* Accessibility
- Make some getters transfer-full
- Allow setting accessible parents and siblings
- Add a role for toggle buttons
- Miscellaneous property fixes and improvements
* gtk
- Improve the handling resize-during-size-allocate
* gdk
- Introduce GdkTextureDownloader and use it
- Make gdk_texture_get_format public
* gsk
- Make mask nodes more versatile
- Improve the GL implementation for texture scale nodes
* X11
- Fix key handling during DND
* Tools
- gtk-builder-tool: Try harder to handle templates
- gtk-builder-tool: Prefer properties over <child>
* Translation updates
Basque
Belarusian
Bulgarian
Indonesian
Galician
Georgian
German
Hebrew
Lithuanian
Portuguese
Spanish
Swedish
Turkish
Ukrainian
Overview of Changes in 4.9.4, 12-02-2023
========================================

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

@@ -483,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

@@ -2,8 +2,6 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
typedef GtkApplication DemoApplication;
typedef GtkApplicationClass DemoApplicationClass;
@@ -216,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_get_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_get_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)
@@ -226,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);
@@ -240,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);
}

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

@@ -162,6 +162,10 @@ create_page4 (GtkWidget *assistant)
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.
*/

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,30 +37,34 @@ remove_timeout (gpointer data)
g_source_remove (id);
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
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);
}
G_GNUC_END_IGNORE_DEPRECATIONS
static void
help_activate (GSimpleAction *action,
GVariant *parameter,
@@ -69,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
@@ -82,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);
}

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">
@@ -54,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>
@@ -66,6 +75,9 @@
<property name="name">Color</property>
<property name="child">
<object class="GtkColorDialogButton" id="source_color">
<accessibility>
<property name="label">Color Drag Source</property>
</accessibility>
<property name="dialog">
<object class="GtkColorDialog">
</object>
@@ -87,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>
@@ -105,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">
@@ -113,6 +131,9 @@
</child>
<child>
<object class="GtkImage">
<accessibility>
<property name="label">Floppy Buddy Icon</property>
</accessibility>
<style>
<class name="large-icons"/>
</style>
@@ -123,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">
@@ -131,6 +155,9 @@
</child>
<child>
<object class="GtkImage">
<accessibility>
<property name="label">gtk-demo logo</property>
</accessibility>
<style>
<class name="large-icons"/>
</style>
@@ -148,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>
@@ -172,6 +202,9 @@
<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>
@@ -225,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">
@@ -252,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>
@@ -265,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>
@@ -283,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>
@@ -298,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

@@ -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);

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);

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 ();

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);

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_set_visible (window, TRUE);
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

@@ -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>
@@ -274,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>
@@ -298,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>
@@ -310,7 +313,9 @@
<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>
@@ -318,7 +323,6 @@
<file>main.c</file>
<file>markup.c</file>
<file>mask.c</file>
<file>menu.c</file>
<file>overlay.c</file>
<file>overlay_decorative.c</file>
<file>paint.c</file>
@@ -331,6 +335,9 @@
<file>paintable_symbolic.c</file>
<file>panes.c</file>
<file>password_entry.c</file>
<file>path_fill.c</file>
<file>path_walk.c</file>
<file>path_text.c</file>
<file>peg_solitaire.c</file>
<file>pickers.c</file>
<file>printing.c</file>
@@ -416,6 +423,13 @@
<gresource prefix="/fontrendering">
<file>fontrendering.ui</file>
</gresource>
<gresource prefix="/path_walk">
<file>path_walk.ui</file>
<file compressed="true">path_world.txt</file>
</gresource>
<gresource prefix="/path_text">
<file>path_text.ui</file>
</gresource>
<gresource prefix="/org/gtk/Demo4">
<file>icons/16x16/actions/application-exit.png</file>
<file>icons/16x16/actions/document-new.png</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

@@ -5,7 +5,8 @@ enum
{
PROP_TEXTURE = 1,
PROP_FILTER,
PROP_SCALE
PROP_SCALE,
PROP_ANGLE,
};
struct _Demo3Widget
@@ -14,6 +15,7 @@ struct _Demo3Widget
GdkTexture *texture;
float scale;
float angle;
GskScalingFilter filter;
GtkWidget *menu;
@@ -26,10 +28,85 @@ 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));
}
@@ -52,26 +129,35 @@ demo3_widget_snapshot (GtkWidget *widget,
{
Demo3Widget *self = DEMO3_WIDGET (widget);
int x, y, width, height;
double w, h;
GskRenderNode *node;
double w, h, w2, h2;
width = gtk_widget_get_width (widget);
height = gtk_widget_get_height (widget);
w = self->scale * gdk_texture_get_width (self->texture);
h = self->scale * gdk_texture_get_height (self->texture);
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));
node = gsk_texture_scale_node_new (self->texture,
&GRAPHENE_RECT_INIT (0, 0, w, h),
self->filter);
gtk_snapshot_append_node (snapshot, node);
gsk_render_node_unref (node);
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);
}
@@ -86,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_texture_get_width (self->texture);
else
size = gdk_texture_get_height (self->texture);
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
@@ -111,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,
@@ -124,11 +224,24 @@ demo3_widget_set_property (GObject *object,
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;
@@ -161,6 +274,10 @@ demo3_widget_get_property (GObject *object,
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;
@@ -186,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,
@@ -195,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)
{
@@ -229,7 +365,12 @@ demo3_widget_class_init (Demo3WidgetClass *class)
g_object_class_install_property (object_class, PROP_SCALE,
g_param_spec_float ("scale", NULL, NULL,
0.0, 10.0, 1.0,
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,
@@ -241,10 +382,13 @@ demo3_widget_class_init (Demo3WidgetClass *class)
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 *
@@ -255,7 +399,12 @@ demo3_widget_new (const char *resource)
texture = gdk_texture_new_from_resource (resource);
self = g_object_new (DEMO3_TYPE_WIDGET, "texture", texture, NULL);
self = g_object_new (DEMO3_TYPE_WIDGET,
"texture", texture,
"has-tooltip", TRUE,
NULL);
g_signal_connect (self, "query-tooltip", G_CALLBACK (query_tooltip), NULL);
g_object_unref (texture);

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

@@ -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,8 +368,9 @@ 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);
}
@@ -368,6 +387,7 @@ 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);
@@ -379,7 +399,10 @@ prepare (GtkDragSource *source,
g_object_set_data (G_OBJECT (canvas), "dragged-item", item);
hotspot = g_new (Hotspot, 1);
gtk_widget_translate_coordinates (canvas, item, x, y, &hotspot->x, &hotspot->y);
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);
@@ -737,9 +760,7 @@ do_dnd (GtkWidget *do_widget)
GtkCssProvider *provider;
GString *css;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
button = gtk_color_button_new ();
G_GNUC_END_IGNORE_DEPRECATIONS
button = gtk_color_dialog_button_new (gtk_color_dialog_new ());
g_object_unref (g_object_ref_sink (button));
provider = gtk_css_provider_new ();
@@ -754,7 +775,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
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);

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,11 +358,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), scribble_draw, NULL, NULL);
gtk_frame_set_child (GTK_FRAME (frame), da);
g_signal_connect (da, "resize",
G_CALLBACK (scribble_resize), NULL);
@@ -372,7 +384,7 @@ do_drawingarea (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_set_visible (window, TRUE);
gtk_window_present (GTK_WINDOW (window));
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 ();

View File

@@ -43,6 +43,10 @@ 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))

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);
}
}
@@ -44,10 +48,18 @@ mode_switch_state_set (GtkSwitch *sw,
{
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_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;
@@ -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 *

View File

@@ -10,8 +10,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *window = NULL;
static void
@@ -45,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);
@@ -122,7 +121,7 @@ do_expander (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_set_visible (window, TRUE);
gtk_window_present (GTK_WINDOW (window));
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -68,13 +68,18 @@ create_blurred_button (void)
return w;
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *
create_font_button (void)
{
return gtk_font_button_new ();
GtkFontDialog *dialog;
GtkWidget *button;
dialog = gtk_font_dialog_new ();
button = gtk_font_dialog_button_new (dialog);
g_object_unref (dialog);
return button;
}
G_GNUC_END_IGNORE_DEPRECATIONS
static GtkWidget *
create_level_bar (void)
@@ -301,7 +306,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);
@@ -310,11 +315,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);
@@ -326,6 +340,7 @@ do_fishbowl (GtkWidget *do_widget)
gtk_widget_realize (window);
g_object_unref (builder);
g_object_unref (scope);
}
if (!gtk_widget_get_visible (window))

View File

@@ -1294,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);
@@ -1562,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, "");

View File

@@ -59,6 +59,9 @@
<property name="spacing">6</property>
<child>
<object class="GtkFontDialogButton" id="font">
<accessibility>
<property name="label">Font</property>
</accessibility>
<property name="dialog">
<object class="GtkFontDialog">
</object>
@@ -73,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>
@@ -89,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>
@@ -101,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>
@@ -110,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>
@@ -126,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>
@@ -138,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>
@@ -147,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>
@@ -163,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>
@@ -175,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>
@@ -184,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>
@@ -202,6 +223,9 @@
</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>
@@ -210,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>
@@ -228,6 +252,9 @@
</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>
@@ -240,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>
@@ -341,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>
@@ -350,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.
@@ -446,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;
@@ -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,15 +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);
g_object_unref (texture);
}
static gboolean fading = FALSE;

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>
@@ -75,6 +78,9 @@
</child>
<child>
<object class="GtkFontDialogButton" id="font_button">
<accessibility>
<relation name="labelled-by">font_label</relation>
</accessibility>
<property name="dialog">
<object class="GtkFontDialog">
</object>
@@ -186,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>
@@ -211,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>
@@ -251,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

@@ -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";

View File

@@ -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);

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

@@ -737,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];
@@ -748,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);
@@ -759,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;
@@ -770,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;

View File

@@ -18,6 +18,7 @@ do_headerbar (GtkWidget *do_widget)
GtkWidget *header;
GtkWidget *button;
GtkWidget *box;
GtkWidget *content;
if (!window)
{
@@ -37,16 +38,26 @@ 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))

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,11 +378,12 @@ 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))

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

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

@@ -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

View File

@@ -431,6 +431,9 @@ setup_listitem_cb (GtkListItemFactory *factory,
picture = gtk_picture_new ();
gtk_expression_bind (expression, picture, "paintable", picture);
gtk_box_append (GTK_BOX (box), picture);
gtk_accessible_update_relation (GTK_ACCESSIBLE (picture),
GTK_ACCESSIBLE_RELATION_LABELLED_BY, location_label, NULL,
-1);
/* And finally, everything comes together.
@@ -487,6 +490,9 @@ do_listview_clocks (GtkWidget *do_widget)
model = GTK_SELECTION_MODEL (gtk_no_selection_new (create_clocks_model ()));
gridview = gtk_grid_view_new (model, factory);
gtk_accessible_update_property (GTK_ACCESSIBLE (gridview),
GTK_ACCESSIBLE_PROPERTY_LABEL, "Clocks",
-1);
gtk_scrollable_set_hscroll_policy (GTK_SCROLLABLE (gridview), GTK_SCROLL_NATURAL);
gtk_scrollable_set_vscroll_policy (GTK_SCROLLABLE (gridview), GTK_SCROLL_NATURAL);

View File

@@ -368,8 +368,40 @@ match_func (MatchObject *obj,
g_free (tmp2);
}
static void
setup_header (GtkSignalListItemFactory *factory,
GObject *list_item,
gpointer data)
{
GtkListHeader *self = GTK_LIST_HEADER (list_item);
GtkWidget *child;
child = gtk_label_new ("");
gtk_label_set_xalign (GTK_LABEL (child), 0);
gtk_label_set_use_markup (GTK_LABEL (child), TRUE);
gtk_widget_set_margin_top (child, 10);
gtk_widget_set_margin_bottom (child, 10);
gtk_list_header_set_child (self, child);
}
static void
bind_header (GtkSignalListItemFactory *factory,
GObject *list_item,
gpointer data)
{
GtkListHeader *self = GTK_LIST_HEADER (list_item);
GtkWidget *child = gtk_list_header_get_child (self);
GObject *item = gtk_list_header_get_item (self);
if (strstr (gtk_string_object_get_string (GTK_STRING_OBJECT (item)), "hour"))
gtk_label_set_label (GTK_LABEL (child), "<big><b>Hours</b></big>");
else
gtk_label_set_label (GTK_LABEL (child), "<big><b>Minutes</b></big>");
}
GtkWidget *
do_dropdown (GtkWidget *do_widget)
do_listview_selections (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
GtkWidget *button, *box, *spin, *check, *hbox, *label, *entry;
@@ -377,10 +409,12 @@ do_dropdown (GtkWidget *do_widget)
GtkExpression *expression;
GtkListItemFactory *factory;
const char * const times[] = { "1 minute", "2 minutes", "5 minutes", "20 minutes", NULL };
const char * const many_times[] = {
const char * const minutes[] = {
"1 minute", "2 minutes", "5 minutes", "10 minutes", "15 minutes", "20 minutes",
"25 minutes", "30 minutes", "35 minutes", "40 minutes", "45 minutes", "50 minutes",
"55 minutes", "1 hour", "2 hours", "3 hours", "5 hours", "6 hours", "7 hours",
"55 minutes", NULL
};
const char * const hours[] = { "1 hour", "2 hours", "3 hours", "5 hours", "6 hours", "7 hours",
"8 hours", "9 hours", "10 hours", "11 hours", "12 hours", NULL
};
const char * const device_titles[] = { "Digital Output", "Headphones", "Digital Output", "Analog Output", NULL };
@@ -395,6 +429,10 @@ do_dropdown (GtkWidget *do_widget)
if (!window)
{
GtkStringList *minutes_model, *hours_model;
GListStore *store;
GtkFlattenListModel *flat;
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
@@ -422,14 +460,25 @@ do_dropdown (GtkWidget *do_widget)
gtk_box_append (GTK_BOX (box), button);
/* A dropdown using an expression to obtain strings */
button = drop_down_new_from_strings (many_times, NULL, NULL);
gtk_drop_down_set_enable_search (GTK_DROP_DOWN (button), TRUE);
minutes_model = gtk_string_list_new (minutes);
hours_model = gtk_string_list_new (hours);
store = g_list_store_new (G_TYPE_LIST_MODEL);
g_list_store_append (store, minutes_model);
g_list_store_append (store, hours_model);
g_object_unref (minutes_model);
g_object_unref (hours_model);
flat = gtk_flatten_list_model_new (G_LIST_MODEL (store));
expression = gtk_cclosure_expression_new (G_TYPE_STRING, NULL,
0, NULL,
(GCallback)get_title,
NULL, NULL);
gtk_drop_down_set_expression (GTK_DROP_DOWN (button), expression);
gtk_expression_unref (expression);
button = gtk_drop_down_new (G_LIST_MODEL (flat), expression);
gtk_drop_down_set_enable_search (GTK_DROP_DOWN (button), TRUE);
factory = gtk_signal_list_item_factory_new ();
g_signal_connect (factory, "setup", G_CALLBACK (setup_header), NULL);
g_signal_connect (factory, "bind", G_CALLBACK (bind_header), NULL);
gtk_drop_down_set_header_factory (GTK_DROP_DOWN (button), factory);
g_object_unref (factory);
gtk_box_append (GTK_BOX (box), button);
button = gtk_drop_down_new (NULL, NULL);

View File

@@ -14,145 +14,15 @@
#include <gtk/gtk.h>
#include <stdlib.h>
/* Create an object that wraps GSettingsSchemaKey because that's a boxed type */
typedef struct _SettingsKey SettingsKey;
struct _SettingsKey
{
GObject parent_instance;
GSettings *settings;
GSettingsSchemaKey *key;
};
enum {
PROP_0,
PROP_NAME,
PROP_SUMMARY,
PROP_DESCRIPTION,
PROP_VALUE,
PROP_TYPE,
PROP_DEFAULT_VALUE,
N_PROPS
};
#define SETTINGS_TYPE_KEY (settings_key_get_type ())
G_DECLARE_FINAL_TYPE (SettingsKey, settings_key, SETTINGS, KEY, GObject);
G_DEFINE_TYPE (SettingsKey, settings_key, G_TYPE_OBJECT);
static GParamSpec *properties[N_PROPS] = { NULL, };
#include "settings-key.h"
static void
settings_key_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
SettingsKey *self = SETTINGS_KEY (object);
switch (property_id)
{
case PROP_DESCRIPTION:
g_value_set_string (value, g_settings_schema_key_get_description (self->key));
break;
case PROP_NAME:
g_value_set_string (value, g_settings_schema_key_get_name (self->key));
break;
case PROP_SUMMARY:
g_value_set_string (value, g_settings_schema_key_get_summary (self->key));
break;
case PROP_VALUE:
{
GVariant *variant = g_settings_get_value (self->settings, g_settings_schema_key_get_name (self->key));
g_value_take_string (value, g_variant_print (variant, FALSE));
g_variant_unref (variant);
}
break;
case PROP_TYPE:
{
const GVariantType *type = g_settings_schema_key_get_value_type (self->key);
g_value_set_string (value, g_variant_type_peek_string (type));
}
break;
case PROP_DEFAULT_VALUE:
{
GVariant *variant = g_settings_schema_key_get_default_value (self->key);
g_value_take_string (value, g_variant_print (variant, FALSE));
g_variant_unref (variant);
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
settings_key_finalize (GObject *object)
{
SettingsKey *self = SETTINGS_KEY (object);
g_object_unref (self->settings);
g_settings_schema_key_unref (self->key);
G_OBJECT_CLASS (settings_key_parent_class)->finalize (object);
}
static void
settings_key_class_init (SettingsKeyClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = settings_key_finalize;
gobject_class->get_property = settings_key_get_property;
properties[PROP_DESCRIPTION] =
g_param_spec_string ("description", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_NAME] =
g_param_spec_string ("name", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_SUMMARY] =
g_param_spec_string ("summary", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_VALUE] =
g_param_spec_string ("value", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_TYPE] =
g_param_spec_string ("type", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_DEFAULT_VALUE] =
g_param_spec_string ("default-value", NULL, NULL, NULL, G_PARAM_READABLE);
g_object_class_install_properties (gobject_class, N_PROPS, properties);
}
static void
settings_key_init (SettingsKey *self)
{
}
static SettingsKey *
settings_key_new (GSettings *settings,
GSettingsSchemaKey *key)
{
SettingsKey *result = g_object_new (SETTINGS_TYPE_KEY, NULL);
result->settings = g_object_ref (settings);
result->key = g_settings_schema_key_ref (key);
return result;
}
static void
item_value_changed (GtkEditableLabel *label,
GParamSpec *pspec,
GtkListItem *item)
item_value_changed (GtkEditableLabel *label,
GParamSpec *pspec,
GtkColumnViewCell *cell)
{
SettingsKey *self;
GSettingsSchemaKey *key;
const char *text;
const GVariantType *type;
GVariant *variant;
@@ -162,11 +32,11 @@ item_value_changed (GtkEditableLabel *label,
text = gtk_editable_get_text (GTK_EDITABLE (label));
g_object_get (item, "item", &self, NULL);
g_object_unref (self);
self = gtk_column_view_cell_get_item (cell);
key = settings_key_get_key (self);
type = g_settings_schema_key_get_value_type (self->key);
name = g_settings_schema_key_get_name (self->key);
type = g_settings_schema_key_get_value_type (key);
name = g_settings_schema_key_get_name (key);
variant = g_variant_parse (type, text, NULL, NULL, &error);
if (!variant)
@@ -176,13 +46,13 @@ item_value_changed (GtkEditableLabel *label,
goto revert;
}
if (!g_settings_schema_key_range_check (self->key, variant))
if (!g_settings_schema_key_range_check (key, variant))
{
g_warning ("Not a valid value for %s", name);
goto revert;
}
g_settings_set_value (self->settings, name, variant);
g_settings_set_value (settings_key_get_settings (self), name, variant);
g_variant_unref (variant);
return;

View File

@@ -20,6 +20,7 @@
<object class="GtkScrolledWindow">
<child>
<object class="GtkListView" id="listview">
<property name="tab-behavior">item</property>
<style>
<class name="navigation-sidebar"/>
</style>
@@ -76,6 +77,7 @@
<property name="vexpand">1</property>
<child>
<object class="GtkColumnView" id="columnview">
<property name="tab-behavior">cell</property>
<style>
<class name="data-table"/>
</style>
@@ -88,13 +90,13 @@
<property name="bytes"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<template class="GtkColumnViewCell">
<property name="child">
<object class="GtkLabel">
<property name="xalign">0</property>
<binding name="label">
<lookup name="name" type="SettingsKey">
<lookup name="item">GtkListItem</lookup>
<lookup name="item">GtkColumnViewCell</lookup>
</lookup>
</binding>
</object>
@@ -116,12 +118,12 @@
<property name="bytes"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<template class="GtkColumnViewCell">
<property name="child">
<object class="GtkEditableLabel">
<binding name="text">
<lookup name="value" type="SettingsKey">
<lookup name="item">GtkListItem</lookup>
<lookup name="item">GtkColumnViewCell</lookup>
</lookup>
</binding>
<signal name="notify::label" handler="item_value_changed"/>
@@ -144,13 +146,13 @@
<property name="bytes"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<template class="GtkColumnViewCell">
<property name="child">
<object class="GtkLabel">
<property name="xalign">0</property>
<binding name="label">
<lookup name="type" type="SettingsKey">
<lookup name="item">GtkListItem</lookup>
<lookup name="item">GtkColumnViewCell</lookup>
</lookup>
</binding>
</object>
@@ -173,13 +175,13 @@
<property name="bytes"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<template class="GtkColumnViewCell">
<property name="child">
<object class="GtkLabel">
<property name="xalign">0</property>
<binding name="label">
<lookup name="default-value" type="SettingsKey">
<lookup name="item">GtkListItem</lookup>
<lookup name="item">GtkColumnViewCell</lookup>
</lookup>
</binding>
</object>
@@ -203,14 +205,14 @@
<property name="bytes"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<template class="GtkColumnViewCell">
<property name="child">
<object class="GtkLabel">
<property name="xalign">0</property>
<property name="wrap">1</property>
<binding name="label">
<lookup name="summary" type="SettingsKey">
<lookup name="item">GtkListItem</lookup>
<lookup name="item">GtkColumnViewCell</lookup>
</lookup>
</binding>
</object>
@@ -234,14 +236,14 @@
<property name="bytes"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<template class="GtkColumnViewCell">
<property name="child">
<object class="GtkLabel">
<property name="xalign">0</property>
<property name="wrap">1</property>
<binding name="label">
<lookup name="description" type="SettingsKey">
<lookup name="item">GtkListItem</lookup>
<lookup name="item">GtkColumnViewCell</lookup>
</lookup>
</binding>
</object>

View File

@@ -0,0 +1,230 @@
/* Lists/Alternative Settings
* #Keywords: GtkListHeaderFactory, GtkSectionModel
*
* This demo shows an alternative settings viewer for GSettings.
*
* It demonstrates how to implement support for sections with GtkListView.
*
* It also shows how to quickly flatten a large tree of items into a list
* that can be filtered to find the items one is looking for.
*/
#include <gtk/gtk.h>
#include "settings-key.h"
static void
item_value_changed (GtkEditableLabel *label,
GParamSpec *pspec,
GtkColumnViewCell *cell)
{
SettingsKey *self;
GSettingsSchemaKey *key;
const char *text;
const GVariantType *type;
GVariant *variant;
GError *error = NULL;
const char *name;
char *value;
text = gtk_editable_get_text (GTK_EDITABLE (label));
self = gtk_column_view_cell_get_item (cell);
key = settings_key_get_key (self);
type = g_settings_schema_key_get_value_type (key);
name = g_settings_schema_key_get_name (key);
variant = g_variant_parse (type, text, NULL, NULL, &error);
if (!variant)
{
g_warning ("%s", error->message);
g_clear_error (&error);
goto revert;
}
if (!g_settings_schema_key_range_check (key, variant))
{
g_warning ("Not a valid value for %s", name);
goto revert;
}
g_settings_set_value (settings_key_get_settings (self), name, variant);
g_variant_unref (variant);
return;
revert:
gtk_widget_error_bell (GTK_WIDGET (label));
g_object_get (self, "value", &value, NULL);
gtk_editable_set_text (GTK_EDITABLE (label), value);
g_free (value);
}
static int
strvcmp (gconstpointer p1,
gconstpointer p2)
{
const char * const *s1 = p1;
const char * const *s2 = p2;
return strcmp (*s1, *s2);
}
static gpointer
map_settings_to_keys (gpointer item,
gpointer unused)
{
GSettings *settings = item;
GSettingsSchema *schema;
GListStore *store;
char **keys;
guint i;
g_object_get (settings, "settings-schema", &schema, NULL);
store = g_list_store_new (SETTINGS_TYPE_KEY);
keys = g_settings_schema_list_keys (schema);
for (i = 0; keys[i] != NULL; i++)
{
GSettingsSchemaKey *almost_there = g_settings_schema_get_key (schema, keys[i]);
SettingsKey *finally = settings_key_new (settings, almost_there);
g_list_store_append (store, finally);
g_object_unref (finally);
g_settings_schema_key_unref (almost_there);
}
g_strfreev (keys);
g_settings_schema_unref (schema);
g_object_unref (settings);
return store;
}
static GListModel *
create_settings_model (gpointer item,
gpointer unused)
{
GSettings *settings = item;
char **schemas;
GListStore *result;
guint i;
if (settings == NULL)
{
g_settings_schema_source_list_schemas (g_settings_schema_source_get_default (),
TRUE,
&schemas,
NULL);
}
else
{
schemas = g_settings_list_children (settings);
}
if (schemas == NULL || schemas[0] == NULL)
{
g_free (schemas);
return NULL;
}
qsort (schemas, g_strv_length (schemas), sizeof (char *), strvcmp);
result = g_list_store_new (G_TYPE_SETTINGS);
for (i = 0; schemas[i] != NULL; i++)
{
GSettings *child;
if (settings == NULL)
child = g_settings_new (schemas[i]);
else
child = g_settings_get_child (settings, schemas[i]);
g_list_store_append (result, child);
g_object_unref (child);
}
g_strfreev (schemas);
return G_LIST_MODEL (result);
}
static void
search_enabled (GtkSearchEntry *entry)
{
gtk_editable_set_text (GTK_EDITABLE (entry), "");
}
static void
stop_search (GtkSearchEntry *entry,
gpointer data)
{
gtk_editable_set_text (GTK_EDITABLE (entry), "");
}
static GtkWidget *window = NULL;
GtkWidget *
do_listview_settings2 (GtkWidget *do_widget)
{
if (window == NULL)
{
GtkListView *listview;
GListModel *model;
GtkTreeListModel *treemodel;
GtkNoSelection *selection;
GtkBuilderScope *scope;
GtkBuilder *builder;
GError *error = NULL;
GtkFilter *filter;
g_type_ensure (SETTINGS_TYPE_KEY);
scope = gtk_builder_cscope_new ();
gtk_builder_cscope_add_callback (scope, search_enabled);
gtk_builder_cscope_add_callback (scope, stop_search);
gtk_builder_cscope_add_callback (scope, settings_key_get_search_string);
gtk_builder_cscope_add_callback (scope, item_value_changed);
builder = gtk_builder_new ();
gtk_builder_set_scope (builder, scope);
g_object_unref (scope);
gtk_builder_add_from_resource (builder, "/listview_settings2/listview_settings2.ui", &error);
g_assert_no_error (error);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *) &window);
listview = GTK_LIST_VIEW (gtk_builder_get_object (builder, "listview"));
filter = GTK_FILTER (gtk_builder_get_object (builder, "filter"));
model = create_settings_model (NULL, NULL);
treemodel = gtk_tree_list_model_new (model,
TRUE,
TRUE,
create_settings_model,
NULL,
NULL);
model = G_LIST_MODEL (gtk_map_list_model_new (G_LIST_MODEL (treemodel), map_settings_to_keys, NULL, NULL));
model = G_LIST_MODEL (gtk_flatten_list_model_new (model));
model = G_LIST_MODEL (gtk_filter_list_model_new (model, g_object_ref (filter)));
selection = gtk_no_selection_new (model);
gtk_list_view_set_model (GTK_LIST_VIEW (listview), GTK_SELECTION_MODEL (selection));
g_object_unref (selection);
g_object_unref (builder);
}
if (!gtk_widget_get_visible (window))
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkStringFilter" id="filter">
<property name="expression">
<closure type="gchararray" function="settings_key_get_search_string" />
</property>
<property name="search" bind-source="entry" bind-property="text" />
</object>
<object class="GtkWindow" id="window">
<property name="title" translatable="yes">Settings</property>
<property name="default-width">640</property>
<property name="default-height">480</property>
<child type="titlebar">
<object class="GtkHeaderBar">
<child type="end">
<object class="GtkToggleButton" id="search_button">
<property name="icon-name">system-search-symbolic</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkSearchBar">
<property name="search-mode-enabled" bind-source="search_button" bind-property="active" bind-flags="bidirectional"/>
<signal name="notify::search-mode-enabled" handler="search_enabled" object="entry"/>
<child>
<object class="GtkSearchEntry" id="entry">
<signal name="stop-search" handler="stop_search"/>
</object>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<child>
<object class="GtkListView" id="listview">
<property name="vexpand">1</property>
<style>
<class name="rich-list"/>
</style>
<property name="factory">
<object class="GtkBuilderListItemFactory">
<property name="bytes"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<property name="child">
<object class="GtkBox">
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="xalign">0</property>
<binding name="label">
<lookup name="name" type="SettingsKey">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
</object>
</child>
<child>
<object class="GtkLabel">
<style>
<class name="dim-label"/>
</style>
<property name="xalign">0</property>
<property name="ellipsize">end</property>
<binding name="label">
<lookup name="summary" type="SettingsKey">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
</object>
</child>
</object>
</child>
<child>
<object class="GtkEntry">
<property name="hexpand">1</property>
<property name="halign">end</property>
<binding name="text">
<lookup name="value" type="SettingsKey">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
<signal name="notify::label" handler="item_value_changed"/>
</object>
</child>
</object>
</property>
</template>
</interface>
]]></property>
</object>
</property>
<property name="header-factory">
<object class="GtkBuilderListItemFactory">
<property name="bytes"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListHeader">
<property name="child">
<object class="GtkLabel">
<property name="xalign">0</property>
<binding name="label">
<lookup name="schema" type="GSettings">
<lookup name="settings" type="SettingsKey">
<lookup name="item">GtkListHeader</lookup>
</lookup>
</lookup>
</binding>
</object>
</property>
</template>
</interface>
]]></property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -367,7 +367,7 @@ do_listview_ucd (GtkWidget *do_widget)
gtk_label_set_width_chars (GTK_LABEL (label), 2);
gtk_widget_add_css_class (label, "enormous");
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, "label.enormous { font-size: 80px; }", -1);
gtk_css_provider_load_from_string (provider, "label.enormous { font-size: 80px; }");
gtk_style_context_add_provider_for_display (gdk_display_get_default (), GTK_STYLE_PROVIDER (provider), 800);
gtk_widget_set_hexpand (label, TRUE);
gtk_box_append (GTK_BOX (box), label);

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<property name="focusable">0</property>
<property name="child">
<object class="GtkTreeExpander" id="expander">
<binding name="list-row">
@@ -9,6 +10,8 @@
<property name="child">
<object class="GtkInscription">
<property name="hexpand">1</property>
<property name="nat-chars">25</property>
<property name="text-overflow">ellipsize-end</property>
<binding name="text">
<lookup name="title" type="GtkDemo">
<lookup name="item">expander</lookup>

View File

@@ -18,7 +18,6 @@
#include <string.h>
#include "config.h"
#include <gtk/gtk.h>
#include <glib/gstdio.h>
@@ -268,9 +267,9 @@ activate_run (GSimpleAction *action,
}
static GtkWidget *
display_image (const char *format,
const char *resource,
char **label)
display_image (const char *format,
const char *resource,
GtkWidget *label)
{
GtkWidget *sw, *image;
@@ -280,13 +279,17 @@ display_image (const char *format,
sw = gtk_scrolled_window_new ();
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), image);
gtk_accessible_update_relation (GTK_ACCESSIBLE (image),
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
-1);
return sw;
}
static GtkWidget *
display_images (const char *format,
const char *resource_dir,
char **label)
display_images (const char *format,
const char *resource_dir,
GtkWidget *label)
{
char **resources;
GtkWidget *grid;
@@ -311,13 +314,15 @@ display_images (const char *format,
{
char *resource_name;
GtkWidget *box;
GtkWidget *image_label;
resource_name = g_strconcat (resource_dir, "/", resources[i], NULL);
widget = display_image (NULL, resource_name, NULL);
image_label = gtk_label_new (resources[i]);
widget = display_image (NULL, resource_name, image_label);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_box_append (GTK_BOX (box), widget);
gtk_box_append (GTK_BOX (box), gtk_label_new (resources[i]));
gtk_box_append (GTK_BOX (box), image_label);
gtk_flow_box_insert (GTK_FLOW_BOX (grid), box, -1);
g_free (resource_name);
@@ -325,15 +330,19 @@ display_images (const char *format,
g_strfreev (resources);
*label = g_strdup ("Images");
gtk_label_set_label (GTK_LABEL (label), "Images");
gtk_accessible_update_relation (GTK_ACCESSIBLE (grid),
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
-1);
return sw;
}
static GtkWidget *
display_text (const char *format,
const char *resource,
char **label)
display_text (const char *format,
const char *resource,
GtkWidget *label)
{
GtkTextBuffer *buffer;
GtkWidget *textview, *sw;
@@ -368,6 +377,10 @@ display_text (const char *format,
gtk_text_view_set_buffer (GTK_TEXT_VIEW (textview), buffer);
gtk_accessible_update_relation (GTK_ACCESSIBLE (textview),
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
-1);
sw = gtk_scrolled_window_new ();
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
@@ -378,15 +391,19 @@ display_text (const char *format,
}
static GtkWidget *
display_video (const char *format,
const char *resource,
char **label)
display_video (const char *format,
const char *resource,
GtkWidget *label)
{
GtkWidget *video;
video = gtk_video_new_for_resource (resource);
gtk_video_set_loop (GTK_VIDEO (video), TRUE);
gtk_accessible_update_relation (GTK_ACCESSIBLE (video),
GTK_ACCESSIBLE_RELATION_LABELLED_BY, label, NULL,
-1);
return video;
}
@@ -408,9 +425,9 @@ display_nothing (const char *resource)
static struct {
const char *extension;
const char *format;
GtkWidget * (* display_func) (const char *format,
const char *resource,
char **label);
GtkWidget * (* display_func) (const char *format,
const char *resource,
GtkWidget *label);
} display_funcs[] = {
{ ".gif", NULL, display_image },
{ ".jpg", NULL, display_image },
@@ -433,7 +450,6 @@ add_data_tab (const char *demoname)
char **resources;
GtkWidget *widget, *label;
guint i, j;
char *label_string;
resource_dir = g_strconcat ("/", demoname, NULL);
resources = g_resources_enumerate_children (resource_dir, 0, NULL);
@@ -453,23 +469,21 @@ add_data_tab (const char *demoname)
break;
}
label_string = NULL;
label = gtk_label_new (resources[i]);
if (j < G_N_ELEMENTS (display_funcs))
widget = display_funcs[j].display_func (display_funcs[j].format,
resource_name,
&label_string);
label);
else
widget = display_nothing (resource_name);
label = gtk_label_new (label_string ? label_string : resources[i]);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, label);
g_object_set (gtk_notebook_get_page (GTK_NOTEBOOK (notebook), widget),
"tab-expand", FALSE,
NULL);
g_free (resource_name);
g_free (label_string);
}
g_strfreev (resources);

View File

@@ -57,14 +57,17 @@
<object class="GtkBox">
<child>
<object class="GtkBox">
<property name="width-request">220</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkSearchBar" id="searchbar">
<accessibility>
<relation name="labelled-by">search-entry</relation>
</accessibility>
<property name="key-capture-widget">window</property>
<child>
<object class="GtkSearchEntry" id="search-entry">
<accessibility>
<property name="label" translatable="yes">Search</property>
<relation name="controls">listview</relation>
</accessibility>
</object>
@@ -76,15 +79,15 @@
<style>
<class name="sidebar"/>
</style>
<property name="width-request">120</property>
<property name="hscrollbar-policy">never</property>
<property name="min-content-width">150</property>
<property name="propagate-natural-width">1</property>
<property name="vexpand">1</property>
<child>
<object class="GtkListView" id="listview">
<style>
<class name="navigation-sidebar"/>
</style>
<property name="tab-behavior">item</property>
<property name="factory">
<object class="GtkBuilderListItemFactory">
<property name="resource">/ui/main-listitem.ui</property>

View File

@@ -1,72 +0,0 @@
/* Menu
* #Keywords: action, zoom
*
* Demonstrates how to add a context menu to a custom widget
* and connect it with widget actions.
*
* The custom widget we create here is similar to a GtkPicture,
* but allows setting a zoom level for the displayed paintable.
*
* Our context menu has items to change the zoom level.
*/
#include <gtk/gtk.h>
#include "demo3widget.h"
GtkWidget *
do_menu (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *box;
GtkWidget *box2;
GtkWidget *sw;
GtkWidget *widget;
GtkWidget *scale;
GtkWidget *dropdown;
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "Menu");
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);
scale = gtk_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL, 0.01, 10.0, 0.1);
gtk_range_set_value (GTK_RANGE (scale), 1.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_box_append (GTK_BOX (box2), dropdown);
g_object_bind_property (dropdown, "selected", widget, "filter", G_BINDING_DEFAULT);
g_object_bind_property (gtk_range_get_adjustment (GTK_RANGE (scale)), "value",
widget, "scale",
G_BINDING_BIDIRECTIONAL);
}
if (!gtk_widget_get_visible (window))
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@@ -39,6 +39,7 @@ demos = files([
'iconscroll.c',
'iconview.c',
'iconview_edit.c',
'image_scaling.c',
'images.c',
'infobar.c',
'layoutmanager.c',
@@ -47,7 +48,6 @@ demos = files([
'listbox.c',
'listbox_controls.c',
'mask.c',
'menu.c',
'flowbox.c',
'list_store.c',
'listview_applauncher.c',
@@ -55,8 +55,9 @@ demos = files([
'listview_colors.c',
'listview_filebrowser.c',
'listview_minesweeper.c',
'dropdown.c',
'listview_selections.c',
'listview_settings.c',
'listview_settings2.c',
'listview_ucd.c',
'listview_weather.c',
'listview_words.c',
@@ -71,6 +72,9 @@ demos = files([
'paintable_symbolic.c',
'panes.c',
'password_entry.c',
'path_fill.c',
'path_walk.c',
'path_text.c',
'peg_solitaire.c',
'pickers.c',
'printing.c',
@@ -131,6 +135,7 @@ extra_demo_sources = files([
'demo4widget.c',
'pixbufpaintable.c',
'script-names.c',
'settings-key.c',
'unicode-names.c',
'suggestionentry.c',
'language-names.c',
@@ -148,25 +153,13 @@ if librsvg_dep.found()
gtkdemo_deps += [ librsvg_dep ]
endif
gtkdemo_args = [ '-DGDK_DISABLE_DEPRECATED', '-DGTK_DISABLE_DEPRECATED', ]
demos_h = custom_target('gtk4 demo header',
output: 'demos.h',
input: demos,
command: [ find_program('geninclude.py'), '@OUTPUT@', '@INPUT@' ],
)
objcopy_supports_add_symbol = false
objcopy = find_program('objcopy', required : false)
if objcopy.found()
objcopy_supports_add_symbol = run_command(objcopy, '--help', check: false).stdout().contains('--add-symbol')
endif
ld = find_program('ld', required : false)
if not meson.is_cross_build() and build_machine.cpu_family() != 'arm' and build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_add_symbol and ld.found()
glib_compile_resources = find_program('glib-compile-resources')
if can_use_objcopy_for_resources
# Create the resource blob
gtkdemo_gresource = custom_target('gtkdemo.gresource',
input : 'demo.gresource.xml',
@@ -214,6 +207,7 @@ if not meson.is_cross_build() and build_machine.cpu_family() != 'arm' and build_
output : 'gtkdemo_resources2.o',
command : [objcopy,
'--strip-all',
'--set-section-alignment', '.data=8',
'--add-symbol','_g_binary_gtkdemo_resource_data=.data:0',
'@INPUT@',
'@OUTPUT@'])
@@ -225,7 +219,7 @@ if not meson.is_cross_build() and build_machine.cpu_family() != 'arm' and build_
else
gtkdemo_resources = gnome.compile_resources('gtkdemo_resources',
'demo.gresource.xml',
source_dir: '.',
source_dir: meson.current_source_dir()
)
endif
@@ -233,8 +227,7 @@ endif
demo_cflags = []
foreach flag: common_cflags
if flag not in ['-Werror=missing-prototypes', '-Wmissing-prototypes',
'-Werror=missing-declarations', '-Wmissing-declarations',
'-fvisibility=hidden']
'-Werror=missing-declarations', '-Wmissing-declarations']
demo_cflags += flag
endif
endforeach
@@ -243,7 +236,7 @@ gtkdemo_deps += [ demo_conf_h ]
executable('gtk4-demo',
sources: [demos, demos_h, extra_demo_sources, gtkdemo_resources],
c_args: gtkdemo_args + demo_cflags,
c_args: demo_cflags,
dependencies: gtkdemo_deps,
include_directories: confinc,
win_subsystem: 'windows',
@@ -253,7 +246,7 @@ executable('gtk4-demo',
executable('gtk4-demo-application',
sources: ['application.c', gtkdemo_resources],
c_args: gtkdemo_args + common_cflags,
c_args: common_cflags,
dependencies: gtkdemo_deps,
include_directories: confinc,
win_subsystem: 'windows',

View File

@@ -7,8 +7,6 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
enum {
COLOR_SET,
N_SIGNALS
@@ -24,6 +22,7 @@ typedef struct
GdkRGBA draw_color;
GtkPadController *pad_controller;
double brush_size;
GtkGesture *gesture;
} DrawingArea;
typedef struct
@@ -103,13 +102,11 @@ drawing_area_size_allocate (GtkWidget *widget,
static void
drawing_area_map (GtkWidget *widget)
{
GtkAllocation allocation;
GTK_WIDGET_CLASS (drawing_area_parent_class)->map (widget);
gtk_widget_get_allocation (widget, &allocation);
drawing_area_ensure_surface ((DrawingArea *) widget,
allocation.width, allocation.height);
gtk_widget_get_width (widget),
gtk_widget_get_height (widget));
}
static void
@@ -125,19 +122,16 @@ drawing_area_unmap (GtkWidget *widget)
static void
drawing_area_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
GtkSnapshot *snapshot)
{
DrawingArea *area = (DrawingArea *) widget;
GtkAllocation allocation;
int width, height;
cairo_t *cr;
gtk_widget_get_allocation (widget, &allocation);
cr = gtk_snapshot_append_cairo (snapshot,
&GRAPHENE_RECT_INIT (
0, 0,
allocation.width,
allocation.height
));
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));
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_paint (cr);
@@ -146,7 +140,7 @@ drawing_area_snapshot (GtkWidget *widget,
cairo_paint (cr);
cairo_set_source_rgb (cr, 0.6, 0.6, 0.6);
cairo_rectangle (cr, 0, 0, allocation.width, allocation.height);
cairo_rectangle (cr, 0, 0, width, height);
cairo_stroke (cr);
cairo_destroy (cr);
@@ -262,7 +256,7 @@ drawing_area_apply_stroke (DrawingArea *area,
double y,
double pressure)
{
if (gdk_device_tool_get_tool_type (tool) == GDK_DEVICE_TOOL_TYPE_ERASER)
if (tool && gdk_device_tool_get_tool_type (tool) == GDK_DEVICE_TOOL_TYPE_ERASER)
{
cairo_set_line_width (area->cr, 10 * pressure * area->brush_size);
cairo_set_operator (area->cr, CAIRO_OPERATOR_DEST_OUT);
@@ -313,7 +307,9 @@ stylus_gesture_motion (GtkGestureStylus *gesture,
drawing_area_apply_stroke (area, tool,
backlog[i].axes[GDK_AXIS_X],
backlog[i].axes[GDK_AXIS_Y],
backlog[i].axes[GDK_AXIS_PRESSURE]);
backlog[i].flags & GDK_AXIS_FLAG_PRESSURE
? backlog[i].axes[GDK_AXIS_PRESSURE]
: 1);
}
g_free (backlog);
@@ -343,6 +339,8 @@ drawing_area_init (DrawingArea *area)
area->draw_color = (GdkRGBA) { 0, 0, 0, 1 };
area->brush_size = 1;
area->gesture = gesture;
}
static GtkWidget *
@@ -381,6 +379,12 @@ drawing_area_color_set (DrawingArea *area,
gtk_color_dialog_button_set_rgba (button, color);
}
static GtkGesture *
drawing_area_get_gesture (DrawingArea *area)
{
return area->gesture;
}
GtkWidget *
do_paint (GtkWidget *toplevel)
{
@@ -388,7 +392,7 @@ do_paint (GtkWidget *toplevel)
if (!window)
{
GtkWidget *draw_area, *headerbar, *colorbutton;
GtkWidget *draw_area, *headerbar, *button;
window = gtk_window_new ();
@@ -397,15 +401,22 @@ do_paint (GtkWidget *toplevel)
headerbar = gtk_header_bar_new ();
colorbutton = gtk_color_dialog_button_new (gtk_color_dialog_new ());
g_signal_connect (colorbutton, "notify::rgba",
button = gtk_color_dialog_button_new (gtk_color_dialog_new ());
g_signal_connect (button, "notify::rgba",
G_CALLBACK (color_button_color_set), draw_area);
g_signal_connect (draw_area, "color-set",
G_CALLBACK (drawing_area_color_set), colorbutton);
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (colorbutton),
G_CALLBACK (drawing_area_color_set), button);
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (button),
&(GdkRGBA) { 0, 0, 0, 1 });
gtk_header_bar_pack_end (GTK_HEADER_BAR (headerbar), colorbutton);
gtk_header_bar_pack_end (GTK_HEADER_BAR (headerbar), button);
button = gtk_check_button_new_with_label ("Stylus only");
g_object_bind_property (button, "active",
drawing_area_get_gesture ((DrawingArea *)draw_area), "stylus-only",
G_BINDING_SYNC_CREATE);
gtk_header_bar_pack_start (GTK_HEADER_BAR (headerbar), button);
gtk_window_set_titlebar (GTK_WINDOW (window), headerbar);
gtk_window_set_title (GTK_WINDOW (window), "Paint");
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);

View File

@@ -68,6 +68,9 @@ do_password_entry (GtkWidget *do_widget)
"placeholder-text", "Password",
"activates-default", TRUE,
NULL);
gtk_accessible_update_property (GTK_ACCESSIBLE (entry),
GTK_ACCESSIBLE_PROPERTY_LABEL, "Password",
-1);
g_signal_connect (entry, "notify::text", G_CALLBACK (update_button), NULL);
gtk_box_append (GTK_BOX (box), entry);
@@ -77,6 +80,9 @@ do_password_entry (GtkWidget *do_widget)
"placeholder-text", "Confirm",
"activates-default", TRUE,
NULL);
gtk_accessible_update_property (GTK_ACCESSIBLE (entry2),
GTK_ACCESSIBLE_PROPERTY_LABEL, "Confirm",
-1);
g_signal_connect (entry2, "notify::text", G_CALLBACK (update_button), NULL);
gtk_box_append (GTK_BOX (box), entry2);

198
demos/gtk-demo/path_fill.c Normal file
View File

@@ -0,0 +1,198 @@
/* Path/Fill and Stroke
*
* This demo shows how to use GskPath to draw shapes that are (a bit)
* more complex than a rounded rectangle.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "paintable.h"
#define GTK_TYPE_LOGO_PAINTABLE (gtk_logo_paintable_get_type ())
G_DECLARE_FINAL_TYPE (GtkLogoPaintable, gtk_logo_paintable, GTK, LOGO_PAINTABLE, GObject)
struct _GtkLogoPaintable
{
GObject parent_instance;
int width;
int height;
GskPath *path[3];
GdkRGBA color[3];
GskPath *stroke_path;
GskStroke *stroke1;
GskStroke *stroke2;
GdkRGBA stroke_color;
};
struct _GtkLogoPaintableClass
{
GObjectClass parent_class;
};
static int
gtk_logo_paintable_get_intrinsic_width (GdkPaintable *paintable)
{
GtkLogoPaintable *self = GTK_LOGO_PAINTABLE (paintable);
return self->width;
}
static int
gtk_logo_paintable_get_intrinsic_height (GdkPaintable *paintable)
{
GtkLogoPaintable *self = GTK_LOGO_PAINTABLE (paintable);
return self->height;
}
static void
gtk_logo_paintable_snapshot (GdkPaintable *paintable,
GdkSnapshot *snapshot,
double width,
double height)
{
GtkLogoPaintable *self = GTK_LOGO_PAINTABLE (paintable);
for (unsigned int i = 0; i < 3; i++)
{
gtk_snapshot_push_fill (snapshot, self->path[i], GSK_FILL_RULE_WINDING);
gtk_snapshot_append_color (snapshot,
&self->color[i],
&GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_pop (snapshot);
}
for (unsigned int i = 0; i < 3; i++)
{
gtk_snapshot_push_stroke (snapshot, self->stroke_path, self->stroke1);
gtk_snapshot_append_color (snapshot,
&self->stroke_color,
&GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_pop (snapshot);
}
gtk_snapshot_push_stroke (snapshot, self->stroke_path, self->stroke2);
gtk_snapshot_append_color (snapshot,
&self->stroke_color,
&GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_pop (snapshot);
}
static GdkPaintableFlags
gtk_logo_paintable_get_flags (GdkPaintable *paintable)
{
return GDK_PAINTABLE_STATIC_CONTENTS | GDK_PAINTABLE_STATIC_SIZE;
}
static void
gtk_logo_paintable_paintable_init (GdkPaintableInterface *iface)
{
iface->get_intrinsic_width = gtk_logo_paintable_get_intrinsic_width;
iface->get_intrinsic_height = gtk_logo_paintable_get_intrinsic_height;
iface->snapshot = gtk_logo_paintable_snapshot;
iface->get_flags = gtk_logo_paintable_get_flags;
}
/* When defining the GType, we need to implement the GdkPaintable interface */
G_DEFINE_TYPE_WITH_CODE (GtkLogoPaintable, gtk_logo_paintable, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
gtk_logo_paintable_paintable_init))
static void
gtk_logo_paintable_dispose (GObject *object)
{
GtkLogoPaintable *self = GTK_LOGO_PAINTABLE (object);
for (unsigned int i = 0; i < 3; i++)
gsk_path_unref (self->path[i]);
gsk_path_unref (self->stroke_path);
gsk_stroke_free (self->stroke1);
gsk_stroke_free (self->stroke2);
G_OBJECT_CLASS (gtk_logo_paintable_parent_class)->dispose (object);
}
static void
gtk_logo_paintable_class_init (GtkLogoPaintableClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = gtk_logo_paintable_dispose;
}
static void
gtk_logo_paintable_init (GtkLogoPaintable *self)
{
}
static GdkPaintable *
gtk_logo_paintable_new (void)
{
GtkLogoPaintable *self;
graphene_rect_t bounds, bounds2;
self = g_object_new (GTK_TYPE_LOGO_PAINTABLE, NULL);
/* Paths and colors extracted from gtk-logo.svg */
self->path[0] = gsk_path_parse ("m3.12,66.17 -2.06,-51.46 32.93,24.7 v55.58 l-30.87,-28.82 z");
self->path[1] = gsk_path_parse ("m34,95 49.4,-20.58 4.12,-51.46 -53.52,16.47 v55.58 z");
self->path[2] = gsk_path_parse ("m1.06,14.71 32.93,24.7 53.52,-16.47 -36.75,-21.88 -49.7,13.65 z");
gdk_rgba_parse (&self->color[0], "#e40000");
gdk_rgba_parse (&self->color[1], "#7fe719");
gdk_rgba_parse (&self->color[2], "#729fcf");
self->stroke_path = gsk_path_parse ("m50.6,51.3 -47.3,14 z l33,23 z v-50");
self->stroke1 = gsk_stroke_new (2.12);
self->stroke2 = gsk_stroke_new (1.25);
gdk_rgba_parse (&self->stroke_color, "#ffffff");
gsk_path_get_stroke_bounds (self->path[0], self->stroke1, &bounds);
gsk_path_get_stroke_bounds (self->path[1], self->stroke1, &bounds2);
graphene_rect_union (&bounds, &bounds2, &bounds);
gsk_path_get_stroke_bounds (self->path[2], self->stroke1, &bounds2);
graphene_rect_union (&bounds, &bounds2, &bounds);
gsk_path_get_stroke_bounds (self->stroke_path, self->stroke2, &bounds2);
graphene_rect_union (&bounds, &bounds2, &bounds);
self->width = bounds.origin.x + bounds.size.width;
self->height = bounds.origin.y + bounds.size.height;
return GDK_PAINTABLE (self);
}
GtkWidget *
do_path_fill (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *picture;
GdkPaintable *paintable;
window = gtk_window_new ();
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
gtk_window_set_title (GTK_WINDOW (window), "Path Fill");
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
paintable = gtk_logo_paintable_new ();
picture = gtk_picture_new_for_paintable (paintable);
gtk_picture_set_content_fit (GTK_PICTURE (picture), GTK_CONTENT_FIT_CONTAIN);
gtk_picture_set_can_shrink (GTK_PICTURE (picture), FALSE);
g_object_unref (paintable);
gtk_window_set_child (GTK_WINDOW (window), picture);
}
if (!gtk_widget_get_visible (window))
gtk_window_present (GTK_WINDOW (window));
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

573
demos/gtk-demo/path_text.c Normal file
View File

@@ -0,0 +1,573 @@
/* Path/Text
*
* This demo shows how to use GskPath to transform a path along another path.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#define GTK_TYPE_PATH_WIDGET (gtk_path_widget_get_type ())
G_DECLARE_FINAL_TYPE (GtkPathWidget, gtk_path_widget, GTK, PATH_WIDGET, GtkWidget)
#define POINT_SIZE 8
enum {
PROP_0,
PROP_TEXT,
PROP_EDITABLE,
N_PROPS
};
struct _GtkPathWidget
{
GtkWidget parent_instance;
char *text;
gboolean editable;
graphene_point_t points[4];
guint active_point;
GskPath *line_path;
GskPath *text_path;
GdkPaintable *background;
};
struct _GtkPathWidgetClass
{
GtkWidgetClass parent_class;
};
static GParamSpec *properties[N_PROPS] = { NULL, };
G_DEFINE_TYPE (GtkPathWidget, gtk_path_widget, GTK_TYPE_WIDGET)
static GskPath *
create_path_from_text (GtkWidget *widget,
const char *text,
graphene_point_t *out_offset)
{
PangoLayout *layout;
PangoFontDescription *desc;
GskPathBuilder *builder;
GskPath *result;
layout = gtk_widget_create_pango_layout (widget, text);
desc = pango_font_description_from_string ("sans bold 36");
pango_layout_set_font_description (layout, desc);
pango_font_description_free (desc);
builder = gsk_path_builder_new ();
gsk_path_builder_add_layout (builder, layout);
result = gsk_path_builder_free_to_path (builder);
if (out_offset)
graphene_point_init (out_offset, 0, - pango_layout_get_baseline (layout) / (double) PANGO_SCALE);
g_object_unref (layout);
return result;
}
typedef struct
{
GskPathMeasure *measure;
GskPathBuilder *builder;
graphene_point_t offset;
double scale;
} GtkPathTransform;
static void
gtk_path_transform_point (GskPathMeasure *measure,
const graphene_point_t *pt,
const graphene_point_t *offset,
float scale,
graphene_point_t *res)
{
graphene_vec2_t tangent;
GskPathPoint point;
if (gsk_path_measure_get_point (measure, (pt->x + offset->x) * scale, TRUE, &point))
{
GskPath *path = gsk_path_measure_get_path (measure);
gsk_path_point_get_position (&point, path, res);
gsk_path_point_get_tangent (&point, path, GSK_PATH_TO_END, &tangent);
res->x -= (pt->y + offset->y) * scale * graphene_vec2_get_y (&tangent);
res->y += (pt->y + offset->y) * scale * graphene_vec2_get_x (&tangent);
}
}
static gboolean
gtk_path_transform_op (GskPathOperation op,
const graphene_point_t *pts,
gsize n_pts,
gpointer data)
{
GtkPathTransform *transform = data;
switch (op)
{
case GSK_PATH_MOVE:
{
graphene_point_t res;
gtk_path_transform_point (transform->measure, &pts[0], &transform->offset, transform->scale, &res);
gsk_path_builder_move_to (transform->builder, res.x, res.y);
}
break;
case GSK_PATH_LINE:
{
graphene_point_t res;
gtk_path_transform_point (transform->measure, &pts[1], &transform->offset, transform->scale, &res);
gsk_path_builder_line_to (transform->builder, res.x, res.y);
}
break;
case GSK_PATH_QUAD:
{
graphene_point_t res[2];
gtk_path_transform_point (transform->measure, &pts[1], &transform->offset, transform->scale, &res[0]);
gtk_path_transform_point (transform->measure, &pts[2], &transform->offset, transform->scale, &res[1]);
gsk_path_builder_quad_to (transform->builder, res[0].x, res[0].y, res[1].x, res[1].y);
}
break;
case GSK_PATH_CUBIC:
{
graphene_point_t res[3];
gtk_path_transform_point (transform->measure, &pts[1], &transform->offset, transform->scale, &res[0]);
gtk_path_transform_point (transform->measure, &pts[2], &transform->offset, transform->scale, &res[1]);
gtk_path_transform_point (transform->measure, &pts[3], &transform->offset, transform->scale, &res[2]);
gsk_path_builder_cubic_to (transform->builder, res[0].x, res[0].y, res[1].x, res[1].y, res[2].x, res[2].y);
}
break;
case GSK_PATH_CLOSE:
gsk_path_builder_close (transform->builder);
break;
default:
g_assert_not_reached();
return FALSE;
}
return TRUE;
}
static GskPath *
gtk_path_transform (GskPath *line_path,
GskPath *path,
const graphene_point_t *offset)
{
GskPathMeasure *measure = gsk_path_measure_new (line_path);
GtkPathTransform transform = { measure, gsk_path_builder_new (), *offset };
graphene_rect_t bounds;
gsk_path_get_bounds (path, &bounds);
if (bounds.origin.x + bounds.size.width > 0)
transform.scale = gsk_path_measure_get_length (measure) / (bounds.origin.x + bounds.size.width);
else
transform.scale = 1.0f;
gsk_path_foreach (path, -1, gtk_path_transform_op, &transform);
gsk_path_measure_unref (measure);
return gsk_path_builder_free_to_path (transform.builder);
}
static void
gtk_path_widget_clear_text_path (GtkPathWidget *self)
{
g_clear_pointer (&self->text_path, gsk_path_unref);
}
static void
gtk_path_widget_clear_paths (GtkPathWidget *self)
{
gtk_path_widget_clear_text_path (self);
g_clear_pointer (&self->line_path, gsk_path_unref);
}
static void
gtk_path_widget_create_text_path (GtkPathWidget *self)
{
GskPath *path;
graphene_point_t offset;
gtk_path_widget_clear_text_path (self);
path = create_path_from_text (GTK_WIDGET (self), self->text, &offset);
self->text_path = gtk_path_transform (self->line_path, path, &offset);
gsk_path_unref (path);
}
static void
gtk_path_widget_create_paths (GtkPathWidget *self)
{
double width = gtk_widget_get_width (GTK_WIDGET (self));
double height = gtk_widget_get_height (GTK_WIDGET (self));
GskPathBuilder *builder;
gtk_path_widget_clear_paths (self);
if (width <= 0 || height <= 0)
return;
builder = gsk_path_builder_new ();
gsk_path_builder_move_to (builder,
self->points[0].x * width, self->points[0].y * height);
gsk_path_builder_cubic_to (builder,
self->points[1].x * width, self->points[1].y * height,
self->points[2].x * width, self->points[2].y * height,
self->points[3].x * width, self->points[3].y * height);
self->line_path = gsk_path_builder_free_to_path (builder);
gtk_path_widget_create_text_path (self);
}
static void
gtk_path_widget_allocate (GtkWidget *widget,
int width,
int height,
int baseline)
{
GtkPathWidget *self = GTK_PATH_WIDGET (widget);
GTK_WIDGET_CLASS (gtk_path_widget_parent_class)->size_allocate (widget, width, height, baseline);
gtk_path_widget_create_paths (self);
}
static void
gtk_path_widget_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GtkPathWidget *self = GTK_PATH_WIDGET (widget);
double width = gtk_widget_get_width (widget);
double height = gtk_widget_get_height (widget);
GskPath *path;
GskStroke *stroke;
gsize i;
/* frosted glass the background */
gtk_snapshot_push_blur (snapshot, 100);
gdk_paintable_snapshot (self->background, snapshot, width, height);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 1, 1, 1, 0.6 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_pop (snapshot);
/* draw the text */
if (self->text_path)
{
gtk_snapshot_push_fill (snapshot, self->text_path, GSK_FILL_RULE_WINDING);
gdk_paintable_snapshot (self->background, snapshot, width, height);
/* ... with an emboss effect */
stroke = gsk_stroke_new (2.0);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT(1, 1));
gtk_snapshot_push_stroke (snapshot, self->text_path, stroke);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 0, 0, 0, 0.2 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gsk_stroke_free (stroke);
gtk_snapshot_pop (snapshot);
gtk_snapshot_pop (snapshot);
}
if (self->editable && self->line_path)
{
GskPathBuilder *builder;
/* draw the control line */
stroke = gsk_stroke_new (1.0);
gtk_snapshot_push_stroke (snapshot, self->line_path, stroke);
gsk_stroke_free (stroke);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 0, 0, 0, 1 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_pop (snapshot);
/* draw the points */
builder = gsk_path_builder_new ();
for (i = 0; i < 4; i++)
{
gsk_path_builder_add_circle (builder, &GRAPHENE_POINT_INIT (self->points[i].x * width, self->points[i].y * height), POINT_SIZE);
}
path = gsk_path_builder_free_to_path (builder);
gtk_snapshot_push_fill (snapshot, path, GSK_FILL_RULE_WINDING);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 1, 1, 1, 1 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_pop (snapshot);
stroke = gsk_stroke_new (1.0);
gtk_snapshot_push_stroke (snapshot, path, stroke);
gsk_stroke_free (stroke);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 0, 0, 0, 1 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_pop (snapshot);
gsk_path_unref (path);
}
}
static void
gtk_path_widget_set_text (GtkPathWidget *self,
const char *text)
{
if (g_strcmp0 (self->text, text) == 0)
return;
g_free (self->text);
self->text = g_strdup (text);
gtk_path_widget_create_paths (self);
gtk_widget_queue_draw (GTK_WIDGET (self));
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TEXT]);
}
static void
gtk_path_widget_set_editable (GtkPathWidget *self,
gboolean editable)
{
if (self->editable == editable)
return;
self->editable = editable;
gtk_widget_queue_draw (GTK_WIDGET (self));
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_EDITABLE]);
}
static void
gtk_path_widget_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkPathWidget *self = GTK_PATH_WIDGET (object);
switch (prop_id)
{
case PROP_TEXT:
gtk_path_widget_set_text (self, g_value_get_string (value));
break;
case PROP_EDITABLE:
gtk_path_widget_set_editable (self, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_path_widget_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkPathWidget *self = GTK_PATH_WIDGET (object);
switch (prop_id)
{
case PROP_TEXT:
g_value_set_string (value, self->text);
break;
case PROP_EDITABLE:
g_value_set_boolean (value, self->editable);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_path_widget_dispose (GObject *object)
{
GtkPathWidget *self = GTK_PATH_WIDGET (object);
gtk_path_widget_clear_paths (self);
G_OBJECT_CLASS (gtk_path_widget_parent_class)->dispose (object);
}
static void
gtk_path_widget_class_init (GtkPathWidgetClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = gtk_path_widget_dispose;
object_class->set_property = gtk_path_widget_set_property;
object_class->get_property = gtk_path_widget_get_property;
widget_class->size_allocate = gtk_path_widget_allocate;
widget_class->snapshot = gtk_path_widget_snapshot;
properties[PROP_TEXT] =
g_param_spec_string ("text",
"text",
"Text transformed along a path",
NULL,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
properties[PROP_EDITABLE] =
g_param_spec_boolean ("editable",
"editable",
"If the path can be edited by the user",
FALSE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPS, properties);
}
static void
drag_begin (GtkGestureDrag *gesture,
double x,
double y,
GtkPathWidget *self)
{
graphene_point_t mouse = GRAPHENE_POINT_INIT (x, y);
double width = gtk_widget_get_width (GTK_WIDGET (self));
double height = gtk_widget_get_height (GTK_WIDGET (self));
gsize i;
for (i = 0; i < 4; i++)
{
if (graphene_point_distance (&GRAPHENE_POINT_INIT (self->points[i].x * width, self->points[i].y * height), &mouse, NULL, NULL) <= POINT_SIZE)
{
self->active_point = i;
break;
}
}
if (i == 4)
{
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_DENIED);
return;
}
gtk_widget_queue_draw (GTK_WIDGET (self));
}
static void
drag_update (GtkGestureDrag *drag,
double offset_x,
double offset_y,
GtkPathWidget *self)
{
double width = gtk_widget_get_width (GTK_WIDGET (self));
double height = gtk_widget_get_height (GTK_WIDGET (self));
double start_x, start_y;
gtk_gesture_drag_get_start_point (drag, &start_x, &start_y);
self->points[self->active_point] = GRAPHENE_POINT_INIT ((start_x + offset_x) / width,
(start_y + offset_y) / height);
self->points[self->active_point].x = CLAMP (self->points[self->active_point].x, 0, 1);
self->points[self->active_point].y = CLAMP (self->points[self->active_point].y, 0, 1);
gtk_path_widget_create_paths (self);
gtk_widget_queue_draw (GTK_WIDGET (self));
}
static void
pointer_motion (GtkEventControllerMotion *controller,
double x,
double y,
GtkPathWidget *self)
{
GskPathPoint point;
graphene_point_t pos;
if (gsk_path_get_closest_point (self->line_path,
&GRAPHENE_POINT_INIT (x, y),
INFINITY,
&point))
{
gsk_path_point_get_position (&point, self->line_path, &pos);
gtk_widget_queue_draw (GTK_WIDGET (self));
}
}
static void
pointer_leave (GtkEventControllerMotion *controller,
GtkPathWidget *self)
{
gtk_widget_queue_draw (GTK_WIDGET (self));
}
static void
gtk_path_widget_init (GtkPathWidget *self)
{
GtkEventController *controller;
controller = GTK_EVENT_CONTROLLER (gtk_gesture_drag_new ());
g_signal_connect (controller, "drag-begin", G_CALLBACK (drag_begin), self);
g_signal_connect (controller, "drag-update", G_CALLBACK (drag_update), self);
g_signal_connect (controller, "drag-end", G_CALLBACK (drag_update), self);
gtk_widget_add_controller (GTK_WIDGET (self), controller);
controller = GTK_EVENT_CONTROLLER (gtk_event_controller_motion_new ());
g_signal_connect (controller, "enter", G_CALLBACK (pointer_motion), self);
g_signal_connect (controller, "motion", G_CALLBACK (pointer_motion), self);
g_signal_connect (controller, "leave", G_CALLBACK (pointer_leave), self);
gtk_widget_add_controller (GTK_WIDGET (self), controller);
self->points[0] = GRAPHENE_POINT_INIT (0.1, 0.9);
self->points[1] = GRAPHENE_POINT_INIT (0.3, 0.1);
self->points[2] = GRAPHENE_POINT_INIT (0.7, 0.1);
self->points[3] = GRAPHENE_POINT_INIT (0.9, 0.9);
self->background = GDK_PAINTABLE (gdk_texture_new_from_resource ("/sliding_puzzle/portland-rose.jpg"));
gtk_path_widget_set_text (self, "It's almost working");
}
GtkWidget *
gtk_path_widget_new (void)
{
GtkPathWidget *self;
self = g_object_new (GTK_TYPE_PATH_WIDGET, NULL);
return GTK_WIDGET (self);
}
GtkWidget *
do_path_text (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkBuilder *builder;
g_type_ensure (GTK_TYPE_PATH_WIDGET);
builder = gtk_builder_new_from_resource ("/path_text/path_text.ui");
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *) &window);
g_object_unref (builder);
}
if (!gtk_widget_get_visible (window))
gtk_window_present (GTK_WINDOW (window));
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow" id="window">
<property name="title" translatable="yes">Text along a Path</property>
<child type="titlebar">
<object class="GtkHeaderBar">
<child type="end">
<object class="GtkToggleButton" id="edit-toggle">
<property name="icon-name">document-edit-symbolic</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkRevealer">
<property name="reveal-child" bind-source="edit-toggle" bind-property="active" bind-flags="sync-create"></property>
<child>
<object class="GtkEntry" id="text">
<property name="text">Through the looking glass</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkPathWidget" id="view">
<property name="editable" bind-source="edit-toggle" bind-property="active" bind-flags="sync-create"></property>
<property name="text" bind-source="text" bind-property="text" bind-flags="sync-create"></property>
<property name="hexpand">true</property>
<property name="vexpand">true</property>
</object>
</child>
</object>
</child>
</object>
</interface>

373
demos/gtk-demo/path_walk.c Normal file
View File

@@ -0,0 +1,373 @@
/* Path/Walk
*
* This demo draws a world map and shows how to animate objects along a GskPath.
*
* The world map that is used here is a path with 211 lines and 1569 cubic
* Bėzier segments in 121 contours.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#define GTK_TYPE_PATH_WALK (gtk_path_walk_get_type ())
G_DECLARE_FINAL_TYPE (GtkPathWalk, gtk_path_walk, GTK, PATH_WALK, GtkWidget)
#define POINT_SIZE 8
enum {
PROP_0,
PROP_N_POINTS,
PROP_PATH,
N_PROPS
};
struct _GtkPathWalk
{
GtkWidget parent_instance;
GskPath *path;
GskPathMeasure *measure;
graphene_rect_t bounds;
GskPath *arrow_path;
guint n_points;
};
struct _GtkPathWalkClass
{
GtkWidgetClass parent_class;
};
static GParamSpec *properties[N_PROPS] = { NULL, };
G_DEFINE_TYPE (GtkPathWalk, gtk_path_walk, GTK_TYPE_WIDGET)
static void
rgba_init_from_hsla (GdkRGBA *rgba,
float hue,
float saturation,
float lightness,
float alpha)
{
float m1, m2;
if (lightness <= 0.5)
m2 = lightness * (1 + saturation);
else
m2 = lightness + saturation - lightness * saturation;
m1 = 2 * lightness - m2;
rgba->alpha = alpha;
if (saturation == 0)
{
rgba->red = lightness;
rgba->green = lightness;
rgba->blue = lightness;
}
else
{
hue = 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 -= 120;
if (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 -= 120;
if (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;
}
}
static void
gtk_path_walk_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GtkPathWalk *self = GTK_PATH_WALK (widget);
double width = gtk_widget_get_width (widget);
double height = gtk_widget_get_height (widget);
float length, progress;
GskStroke *stroke;
guint i;
if (self->path == NULL)
return;
gtk_snapshot_save (snapshot);
stroke = gsk_stroke_new (2.0);
gtk_snapshot_push_stroke (snapshot, self->path, stroke);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 0, 0, 0, 1 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_pop (snapshot);
gsk_stroke_free (stroke);
length = gsk_path_measure_get_length (self->measure);
progress = 25.f * gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget)) / G_USEC_PER_SEC;
stroke = gsk_stroke_new (1.0);
for (i = 0; i < self->n_points; i++)
{
GskPathPoint point;
graphene_point_t position;
float angle;
GdkRGBA color;
float distance;
distance = i * length / self->n_points;
distance = fmod (distance + progress, length);
gsk_path_measure_get_point (self->measure, distance, FALSE, &point);
gsk_path_point_get_position (&point, self->path, &position);
angle = gsk_path_point_get_rotation (&point, self->path, GSK_PATH_FROM_START);
rgba_init_from_hsla (&color, 360.f * i / self->n_points, 1, 0.5, 1);
gtk_snapshot_save (snapshot);
gtk_snapshot_translate (snapshot, &position);
gtk_snapshot_rotate (snapshot, angle);
gtk_snapshot_append_fill (snapshot, self->arrow_path, GSK_FILL_RULE_EVEN_ODD, &color);
gtk_snapshot_append_stroke (snapshot, self->arrow_path, stroke, &(GdkRGBA) { 0, 0, 0, 1 });
gtk_snapshot_restore (snapshot);
}
gsk_stroke_free (stroke);
gtk_snapshot_restore (snapshot);
}
static void
gtk_path_walk_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
GtkPathWalk *self = GTK_PATH_WALK (widget);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
*minimum = *natural = (int) ceilf (self->bounds.size.width);
else
*minimum = *natural = (int) ceilf (self->bounds.size.height);
}
static void
gtk_path_walk_set_n_points (GtkPathWalk *self,
gsize n_points)
{
if (self->n_points == n_points)
return;
self->n_points = n_points;
gtk_widget_queue_draw (GTK_WIDGET (self));
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_N_POINTS]);
}
static void
gtk_path_walk_set_path (GtkPathWalk *self,
GskPath *path)
{
if (self->path == path)
return;
g_clear_pointer (&self->path, gsk_path_unref);
graphene_rect_init (&self->bounds, 0, 0, 0, 0);
if (path)
{
GskStroke *stroke;
self->path = gsk_path_ref (path);
stroke = gsk_stroke_new (2.0);
gsk_path_get_stroke_bounds (path, stroke, &self->bounds);
gsk_stroke_free (stroke);
self->measure = gsk_path_measure_new (self->path);
}
gtk_widget_queue_resize (GTK_WIDGET (self));
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PATH]);
}
static void
gtk_path_walk_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkPathWalk *self = GTK_PATH_WALK (object);
switch (prop_id)
{
case PROP_N_POINTS:
gtk_path_walk_set_n_points (self, g_value_get_uint (value));
break;
case PROP_PATH:
gtk_path_walk_set_path (self, g_value_get_boxed (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_path_walk_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkPathWalk *self = GTK_PATH_WALK (object);
switch (prop_id)
{
case PROP_N_POINTS:
g_value_set_uint (value, self->n_points);
break;
case PROP_PATH:
g_value_set_boxed (value, self->path);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_path_walk_dispose (GObject *object)
{
GtkPathWalk *self = GTK_PATH_WALK (object);
g_clear_pointer (&self->path, gsk_path_unref);
g_clear_pointer (&self->measure, gsk_path_measure_unref);
g_clear_pointer (&self->arrow_path, gsk_path_unref);
G_OBJECT_CLASS (gtk_path_walk_parent_class)->dispose (object);
}
static void
gtk_path_walk_class_init (GtkPathWalkClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = gtk_path_walk_dispose;
object_class->set_property = gtk_path_walk_set_property;
object_class->get_property = gtk_path_walk_get_property;
widget_class->snapshot = gtk_path_walk_snapshot;
widget_class->measure = gtk_path_walk_measure;
properties[PROP_N_POINTS] =
g_param_spec_uint ("n-points",
NULL, NULL,
1, G_MAXUINT,
500,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
properties[PROP_PATH] =
g_param_spec_boxed ("path",
NULL, NULL,
GSK_TYPE_PATH,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPS, properties);
}
static gboolean
tick_tick_tick (GtkWidget *self,
GdkFrameClock *frame_clock,
gpointer unused)
{
gtk_widget_queue_draw (GTK_WIDGET (self));
return G_SOURCE_CONTINUE;
}
static void
gtk_path_walk_init (GtkPathWalk *self)
{
/* Data taken from
* https://commons.wikimedia.org/wiki/Maps_of_the_world#/media/File:Simplified_blank_world_map_without_Antartica_(no_borders).svg
*/
GBytes *data = g_resources_lookup_data ("/path_walk/path_world.txt", 0, NULL);
GskPath *path = gsk_path_parse (g_bytes_get_data (data, NULL));
g_bytes_unref (data);
gtk_path_walk_set_path (self, path);
gsk_path_unref (path);
self->arrow_path = gsk_path_parse ("M 5 0 L 0 -5. 0 -2, -5 -2, -5 2, 0 2, 0 5 Z");
self->n_points = 500;
gtk_widget_add_tick_callback (GTK_WIDGET (self), tick_tick_tick, NULL, NULL);
}
GtkWidget *
gtk_path_walk_new (void)
{
GtkPathWalk *self;
self = g_object_new (GTK_TYPE_PATH_WALK, NULL);
return GTK_WIDGET (self);
}
GtkWidget *
do_path_walk (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkBuilder *builder;
g_type_ensure (GTK_TYPE_PATH_WALK);
builder = gtk_builder_new_from_resource ("/path_walk/path_walk.ui");
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *) &window);
g_object_unref (builder);
}
if (!gtk_widget_get_visible (window))
gtk_window_present (GTK_WINDOW (window));
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow" id="window">
<property name="title" translatable="yes">World Map</property>
<property name="titlebar">
<object class="GtkHeaderBar">
<child type="end">
<object class="GtkSpinButton">
<property name="adjustment">
<object class="GtkAdjustment" id="adjustment">
<property name="lower">0</property>
<property name="upper">5000</property>
<property name="value">500</property>
</object>
</property>
</object>
</child>
</object>
</property>
<property name="child">
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkPathWalk" id="view">
<property name="n-points" bind-source="adjustment" bind-property="value"/>
<property name="hexpand">true</property>
<property name="vexpand">true</property>
</object>
</child>
</object>
</property>
</object>
</interface>

File diff suppressed because one or more lines are too long

View File

@@ -384,7 +384,7 @@ create_board (GtkWidget *window)
"}";
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),
800);

View File

@@ -13,20 +13,13 @@
static GtkWidget *app_picker;
static void
file_opened (GObject *source,
GAsyncResult *result,
void *data)
set_file (GFile *file,
gpointer data)
{
GFile *file;
GError *error = NULL;
char *name;
file = gtk_file_dialog_open_finish (GTK_FILE_DIALOG (source), result, &error);
if (!file)
{
g_print ("%s\n", error->message);
g_error_free (error);
gtk_widget_set_sensitive (app_picker, FALSE);
g_object_set_data (G_OBJECT (app_picker), "file", NULL);
return;
@@ -40,6 +33,25 @@ file_opened (GObject *source,
g_object_set_data_full (G_OBJECT (app_picker), "file", g_object_ref (file), g_object_unref);
}
static void
file_opened (GObject *source,
GAsyncResult *result,
void *data)
{
GFile *file;
GError *error = NULL;
file = gtk_file_dialog_open_finish (GTK_FILE_DIALOG (source), result, &error);
if (!file)
{
g_print ("%s\n", error->message);
g_error_free (error);
}
set_file (file, data);
}
static gboolean
abort_mission (gpointer data)
{
@@ -130,11 +142,28 @@ launch_uri (GtkButton *picker)
g_object_unref (launcher);
}
static gboolean
on_drop (GtkDropTarget *target,
const GValue *value,
double x,
double y,
gpointer data)
{
if (G_VALUE_HOLDS (value, G_TYPE_FILE))
{
set_file (g_value_get_object (value), data);
return TRUE;
}
return FALSE;
}
GtkWidget *
do_pickers (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
GtkWidget *table, *label, *picker, *button;
GtkDropTarget *drop_target;
if (!window)
{
@@ -160,6 +189,7 @@ do_pickers (GtkWidget *do_widget)
gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
picker = gtk_color_dialog_button_new (gtk_color_dialog_new ());
gtk_label_set_mnemonic_widget (GTK_LABEL (label), picker);
gtk_grid_attach (GTK_GRID (table), picker, 1, 0, 1, 1);
label = gtk_label_new ("Font:");
@@ -169,6 +199,7 @@ do_pickers (GtkWidget *do_widget)
gtk_grid_attach (GTK_GRID (table), label, 0, 1, 1, 1);
picker = gtk_font_dialog_button_new (gtk_font_dialog_new ());
gtk_label_set_mnemonic_widget (GTK_LABEL (label), picker);
gtk_grid_attach (GTK_GRID (table), picker, 1, 1, 1, 1);
label = gtk_label_new ("File:");
@@ -179,7 +210,16 @@ do_pickers (GtkWidget *do_widget)
picker = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
button = gtk_button_new_from_icon_name ("document-open-symbolic");
gtk_accessible_update_property (GTK_ACCESSIBLE (button),
GTK_ACCESSIBLE_PROPERTY_LABEL, "Select File",
-1);
label = gtk_label_new ("None");
drop_target = gtk_drop_target_new (G_TYPE_FILE, GDK_ACTION_COPY);
g_signal_connect (drop_target, "drop", G_CALLBACK (on_drop), label);
gtk_widget_add_controller (button, GTK_EVENT_CONTROLLER (drop_target));
gtk_label_set_xalign (GTK_LABEL (label), 0.);
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_MIDDLE);
gtk_widget_set_hexpand (label, TRUE);
@@ -188,6 +228,9 @@ do_pickers (GtkWidget *do_widget)
gtk_box_append (GTK_BOX (picker), button);
app_picker = gtk_button_new_from_icon_name ("emblem-system-symbolic");
gtk_widget_set_halign (app_picker, GTK_ALIGN_END);
gtk_accessible_update_property (GTK_ACCESSIBLE (app_picker),
GTK_ACCESSIBLE_PROPERTY_LABEL, "Open File",
-1);
gtk_widget_set_sensitive (app_picker, FALSE);
g_signal_connect (app_picker, "clicked", G_CALLBACK (open_app), NULL);
gtk_box_append (GTK_BOX (picker), app_picker);
@@ -206,7 +249,7 @@ do_pickers (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_set_visible (window, TRUE);
gtk_window_present (GTK_WINDOW (window));
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -6,6 +6,6 @@
* Also, when adding new style properties, please add them here.
*/
* {
window.demo * {
all: unset;
}

View File

@@ -0,0 +1,165 @@
#include "settings-key.h"
/* Create an object that wraps GSettingsSchemaKey because that's a boxed type */
struct _SettingsKey
{
GObject parent_instance;
GSettings *settings;
GSettingsSchemaKey *key;
};
enum {
PROP_0,
PROP_NAME,
PROP_SETTINGS,
PROP_SUMMARY,
PROP_DESCRIPTION,
PROP_VALUE,
PROP_TYPE,
PROP_DEFAULT_VALUE,
N_PROPS
};
G_DEFINE_TYPE (SettingsKey, settings_key, G_TYPE_OBJECT);
static GParamSpec *properties[N_PROPS] = { NULL, };
static void
settings_key_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
SettingsKey *self = SETTINGS_KEY (object);
switch (property_id)
{
case PROP_DESCRIPTION:
g_value_set_string (value, g_settings_schema_key_get_description (self->key));
break;
case PROP_NAME:
g_value_set_string (value, g_settings_schema_key_get_name (self->key));
break;
case PROP_SUMMARY:
g_value_set_string (value, g_settings_schema_key_get_summary (self->key));
break;
case PROP_VALUE:
{
GVariant *variant = g_settings_get_value (self->settings, g_settings_schema_key_get_name (self->key));
g_value_take_string (value, g_variant_print (variant, FALSE));
g_variant_unref (variant);
}
break;
case PROP_TYPE:
{
const GVariantType *type = g_settings_schema_key_get_value_type (self->key);
g_value_set_string (value, g_variant_type_peek_string (type));
}
break;
case PROP_DEFAULT_VALUE:
{
GVariant *variant = g_settings_schema_key_get_default_value (self->key);
g_value_take_string (value, g_variant_print (variant, FALSE));
g_variant_unref (variant);
}
break;
case PROP_SETTINGS:
g_value_set_object (value, self->settings);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
settings_key_finalize (GObject *object)
{
SettingsKey *self = SETTINGS_KEY (object);
g_object_unref (self->settings);
g_settings_schema_key_unref (self->key);
G_OBJECT_CLASS (settings_key_parent_class)->finalize (object);
}
static void
settings_key_class_init (SettingsKeyClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = settings_key_finalize;
gobject_class->get_property = settings_key_get_property;
properties[PROP_DESCRIPTION] =
g_param_spec_string ("description", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_NAME] =
g_param_spec_string ("name", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_SETTINGS] =
g_param_spec_object ("settings", NULL, NULL, G_TYPE_SETTINGS, G_PARAM_READABLE);
properties[PROP_SUMMARY] =
g_param_spec_string ("summary", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_VALUE] =
g_param_spec_string ("value", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_TYPE] =
g_param_spec_string ("type", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_DEFAULT_VALUE] =
g_param_spec_string ("default-value", NULL, NULL, NULL, G_PARAM_READABLE);
g_object_class_install_properties (gobject_class, N_PROPS, properties);
}
static void
settings_key_init (SettingsKey *self)
{
}
SettingsKey *
settings_key_new (GSettings *settings,
GSettingsSchemaKey *key)
{
SettingsKey *result = g_object_new (SETTINGS_TYPE_KEY, NULL);
result->settings = g_object_ref (settings);
result->key = g_settings_schema_key_ref (key);
return result;
}
GSettingsSchemaKey *
settings_key_get_key (SettingsKey *self)
{
return self->key;
}
GSettings *
settings_key_get_settings (SettingsKey *self)
{
return self->settings;
}
char *
settings_key_get_search_string (SettingsKey *self)
{
char *schema, *result;
g_object_get (self->settings, "schema-id", &schema, NULL);
result = g_strconcat (g_settings_schema_key_get_name (self->key), " ",
g_settings_schema_key_get_summary (self->key), " ",
schema,
NULL);
g_free (schema);
return result;
}

View File

@@ -0,0 +1,17 @@
#pragma once
#include <gtk/gtk.h>
#include <stdlib.h>
/* Create an object that wraps GSettingsSchemaKey because that's a boxed type */
typedef struct _SettingsKey SettingsKey;
#define SETTINGS_TYPE_KEY (settings_key_get_type ())
G_DECLARE_FINAL_TYPE (SettingsKey, settings_key, SETTINGS, KEY, GObject);
SettingsKey * settings_key_new (GSettings *settings,
GSettingsSchemaKey *key);
GSettingsSchemaKey * settings_key_get_key (SettingsKey *self);
GSettings * settings_key_get_settings (SettingsKey *self);
char * settings_key_get_search_string (SettingsKey *self);

View File

@@ -22,6 +22,7 @@ show_shortcuts (GtkWidget *window,
gtk_window_set_transient_for (GTK_WINDOW (overlay), GTK_WINDOW (window));
g_object_set (overlay, "view-name", view, NULL);
g_object_unref (builder);
gtk_window_present (GTK_WINDOW (overlay));
}
G_MODULE_EXPORT void

View File

@@ -28,14 +28,14 @@ add_row (GtkGrid *table,
label = gtk_label_new_with_mnemonic (label_text);
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_widget_set_hexpand (label, TRUE);
gtk_grid_attach (table, label, 0, row, 1, 1);
dropdown = gtk_drop_down_new_from_strings (options);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), dropdown);
gtk_widget_set_halign (dropdown, GTK_ALIGN_END);
gtk_widget_set_valign (dropdown, GTK_ALIGN_BASELINE);
gtk_widget_set_valign (dropdown, GTK_ALIGN_BASELINE_FILL);
gtk_size_group_add_widget (size_group, dropdown);
gtk_grid_attach (table, dropdown, 1, row, 1, 1);
}

View File

@@ -188,10 +188,20 @@ do_spinbutton (GtkWidget *do_widget)
if (!window)
{
GtkBuilder *builder;
GtkBuilderScope *scope;
GtkAdjustment *adj;
GtkWidget *label;
builder = gtk_builder_new_from_resource ("/spinbutton/spinbutton.ui");
scope = gtk_builder_cscope_new ();
builder = gtk_builder_new ();
gtk_builder_cscope_add_callback (GTK_BUILDER_CSCOPE (scope), spinbutton_hex_spin_input);
gtk_builder_cscope_add_callback (GTK_BUILDER_CSCOPE (scope), spinbutton_hex_spin_output);
gtk_builder_cscope_add_callback (GTK_BUILDER_CSCOPE (scope), spinbutton_time_spin_input);
gtk_builder_cscope_add_callback (GTK_BUILDER_CSCOPE (scope), spinbutton_time_spin_output);
gtk_builder_cscope_add_callback (GTK_BUILDER_CSCOPE (scope), spinbutton_month_spin_input);
gtk_builder_cscope_add_callback (GTK_BUILDER_CSCOPE (scope), spinbutton_month_spin_output);
gtk_builder_set_scope (builder, scope);
gtk_builder_add_from_resource (builder, "/spinbutton/spinbutton.ui", NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
@@ -233,6 +243,7 @@ do_spinbutton (GtkWidget *do_widget)
NULL, NULL);
g_object_unref (builder);
g_object_unref (scope);
}
if (!gtk_widget_get_visible (window))

View File

@@ -27,7 +27,6 @@ GtkWidget *
do_spinner (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
GtkWidget *content_area;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *button;
@@ -35,28 +34,19 @@ do_spinner (GtkWidget *do_widget)
if (!window)
{
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
window = gtk_dialog_new_with_buttons ("Spinner",
GTK_WINDOW (do_widget),
0,
_("_Close"),
GTK_RESPONSE_NONE,
NULL);
window = gtk_window_new ();
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Spinner");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_signal_connect (window, "response",
G_CALLBACK (gtk_window_destroy), NULL);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
content_area = gtk_dialog_get_content_area (GTK_DIALOG (window));
G_GNUC_END_IGNORE_DEPRECATIONS
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
gtk_widget_set_margin_start (vbox, 5);
gtk_widget_set_margin_end (vbox, 5);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
gtk_widget_set_margin_top (vbox, 5);
gtk_widget_set_margin_bottom (vbox, 5);
gtk_box_append (GTK_BOX (content_area), vbox);
gtk_widget_set_margin_start (vbox, 5);
gtk_widget_set_margin_end (vbox, 5);
gtk_window_set_child (GTK_WINDOW (window), vbox);
/* Sensitive */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 5);

View File

@@ -471,7 +471,7 @@ suggestion_entry_size_allocate (GtkWidget *widget,
&(GtkAllocation) { width - arrow_nat, 0, arrow_nat, height },
baseline);
gtk_widget_set_size_request (self->popup, gtk_widget_get_allocated_width (GTK_WIDGET (self)), -1);
gtk_widget_set_size_request (self->popup, gtk_widget_get_width (GTK_WIDGET (self)), -1);
gtk_widget_queue_resize (self->popup);
gtk_popover_present (GTK_POPOVER (self->popup));
@@ -801,7 +801,7 @@ suggestion_entry_key_pressed (GtkEventControllerKey *controller,
selected = matches - 1;
}
gtk_single_selection_set_selected (self->selection, selected);
gtk_list_view_scroll_to (GTK_LIST_VIEW (self->list), selected, GTK_LIST_SCROLL_SELECT, NULL);
return TRUE;
}
@@ -849,7 +849,7 @@ suggestion_entry_init (SuggestionEntry *self)
GtkCssProvider *provider;
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (provider, "/dropdown/suggestionentry.css");
gtk_css_provider_load_from_resource (provider, "/listview_selections/suggestionentry.css");
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
800);

View File

@@ -1,5 +1,5 @@
/* Overlay/Transparency
* #Keywords: GtkOverlay, GtkSnapshot
* #Keywords: GtkOverlay, GtkSnapshot, blur
*
* Blur the background behind an overlay.
*/

View File

@@ -150,20 +150,36 @@ do_video_player (GtkWidget *do_widget)
button = gtk_button_new ();
image = gtk_image_new_from_resource ("/cursors/images/gtk_logo_cursor.png");
gtk_accessible_update_relation (GTK_ACCESSIBLE (image),
GTK_ACCESSIBLE_RELATION_LABELLED_BY, button, NULL,
-1);
gtk_image_set_pixel_size (GTK_IMAGE (image), 24);
gtk_button_set_child (GTK_BUTTON (button), image);
g_signal_connect (button, "clicked", G_CALLBACK (logo_clicked_cb), video);
gtk_accessible_update_property (GTK_ACCESSIBLE (button),
GTK_ACCESSIBLE_PROPERTY_LABEL, "GTK Logo",
-1);
gtk_header_bar_pack_start (GTK_HEADER_BAR (title), button);
button = gtk_button_new ();
image = gtk_image_new_from_resource ("/video-player/bbb.png");
gtk_accessible_update_relation (GTK_ACCESSIBLE (image),
GTK_ACCESSIBLE_RELATION_LABELLED_BY, button, NULL,
-1);
gtk_image_set_pixel_size (GTK_IMAGE (image), 24);
gtk_button_set_child (GTK_BUTTON (button), image);
g_signal_connect (button, "clicked", G_CALLBACK (bbb_clicked_cb), video);
gtk_accessible_update_property (GTK_ACCESSIBLE (button),
GTK_ACCESSIBLE_PROPERTY_LABEL, "Big Buck Bunny",
-1);
gtk_header_bar_pack_start (GTK_HEADER_BAR (title), button);
fullscreen_button = gtk_button_new_from_icon_name ("view-fullscreen-symbolic");
g_signal_connect (fullscreen_button, "clicked", G_CALLBACK (fullscreen_clicked_cb), NULL);
gtk_accessible_update_property (GTK_ACCESSIBLE (fullscreen_button),
GTK_ACCESSIBLE_PROPERTY_LABEL, "Fullscreen",
-1);
gtk_header_bar_pack_end (GTK_HEADER_BAR (title), fullscreen_button);
controller = gtk_shortcut_controller_new ();

View File

@@ -8,7 +8,7 @@ iconbrowser_sources = [
iconbrowser_resources = gnome.compile_resources('iconbrowser_resources',
'iconbrowser.gresource.xml',
source_dir: '.',
source_dir: meson.current_source_dir(),
)
executable('gtk4-icon-browser',

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