Commit Graph

75686 Commits

Author SHA1 Message Date
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