Commit Graph

75461 Commits

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