Commit Graph

75087 Commits

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