gtk4.git
2 years agoMerge branch 'wip/otte/filefilter-name' into 'main'
Benjamin Otte [Fri, 10 Mar 2023 17:11:25 +0000 (17:11 +0000)]
Merge branch 'wip/otte/filefilter-name' into 'main'

filefilter: If not given a name, deduce one

See merge request GNOME/gtk!5630

2 years agoUpdate Finnish translation
Jiri Grönroos [Fri, 10 Mar 2023 17:03:35 +0000 (17:03 +0000)]
Update Finnish translation

2 years agoMerge branch 'reverse-file-chooser-recent-files-sort-order' into 'main'
Matthias Clasen [Fri, 10 Mar 2023 16:40:50 +0000 (16:40 +0000)]
Merge branch 'reverse-file-chooser-recent-files-sort-order' into 'main'

filerchooser: Show Recent files in inverse order

See merge request GNOME/gtk!5625

2 years agoMerge branch 'wip/otte/listview-border-spacing' into 'main'
Matthias Clasen [Fri, 10 Mar 2023 16:39:05 +0000 (16:39 +0000)]
Merge branch 'wip/otte/listview-border-spacing' into 'main'

Implement CSS border-spacing support for listview and gridview

See merge request GNOME/gtk!5626

2 years agoMerge branch 'file-chooser-selectability2' into 'main'
Matthias Clasen [Fri, 10 Mar 2023 16:37:41 +0000 (16:37 +0000)]
Merge branch 'file-chooser-selectability2' into 'main'

file system model: Store selectability

See merge request GNOME/gtk!5582

2 years agoMerge branch 'notify_after_value_change' into 'main'
Matthias Clasen [Fri, 10 Mar 2023 16:36:41 +0000 (16:36 +0000)]
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

2 years agoa11y: Notify assistive technologies when a GTK_ACCESSIBLE_PROPERTY_VALUE_NOW changes...
Lukáš Tyrychtr [Fri, 10 Mar 2023 16:36:39 +0000 (16:36 +0000)]
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.

2 years agofilefilter: If not given a name, deduce one
Benjamin Otte [Fri, 10 Mar 2023 15:12:00 +0000 (16:12 +0100)]
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

2 years agogridview: Add border-spacing support
Benjamin Otte [Fri, 10 Mar 2023 04:16:25 +0000 (05:16 +0100)]
gridview: Add border-spacing support

omg, this is complicated code.

2 years agogridview: Introduce column size functions
Benjamin Otte [Thu, 9 Mar 2023 16:22:06 +0000 (17:22 +0100)]
gridview: Introduce column size functions

This is in preparation for border-spacing integration.

2 years agogridview: Use gtk_list_item_manager_get_nearest_tile()
Benjamin Otte [Thu, 9 Mar 2023 04:30:25 +0000 (05:30 +0100)]
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.

2 years agolistview: Support CSS border-spacing
Benjamin Otte [Thu, 9 Mar 2023 03:43:51 +0000 (04:43 +0100)]
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.

2 years agofilechooser: Set selectability for list items
Matthias Clasen [Fri, 10 Mar 2023 14:18:26 +0000 (15:18 +0100)]
filechooser: Set selectability for list items

We propagate this from the list items to the
GtkListItems. Twisty!

2 years agofilechooser: Dim non-selectable items
Matthias Clasen [Wed, 1 Mar 2023 17:01:15 +0000 (12:01 -0500)]
filechooser: Dim non-selectable items

2 years agocolumview: Propagate activatable and selectable
Matthias Clasen [Wed, 1 Mar 2023 17:00:26 +0000 (12:00 -0500)]
columview: Propagate activatable and selectable

When any of the cells is not activatable or selectable,
make the row not have those properties either.

2 years agofilechooser: Inform the model about selectability
Matthias Clasen [Wed, 1 Mar 2023 12:53:45 +0000 (07:53 -0500)]
filechooser: Inform the model about selectability

In folder modes, we don't want to select files.

2 years agofilesystemmodel: Store selectability
Matthias Clasen [Wed, 1 Mar 2023 12:53:07 +0000 (07:53 -0500)]
filesystemmodel: Store selectability

This will be used later on.

2 years agoMerge branch 'file-chooser-selection' into 'main'
Matthias Clasen [Fri, 10 Mar 2023 14:25:36 +0000 (14:25 +0000)]
Merge branch 'file-chooser-selection' into 'main'

filechooser: Don't automatically select a file

See merge request GNOME/gtk!5572

2 years agoUpdate Friulian translation
Fabio Tomat [Fri, 10 Mar 2023 07:49:25 +0000 (07:49 +0000)]
Update Friulian translation

2 years agolistitemmanager: Add gtk_list_item_manager_get_nearest_tile()
Benjamin Otte [Thu, 9 Mar 2023 03:42:45 +0000 (04:42 +0100)]
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.

2 years agolistview: Move bounds check into base class
Benjamin Otte [Thu, 9 Mar 2023 03:02:22 +0000 (04:02 +0100)]
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.

2 years agolistview: Return an allocation for unallcoated items
Benjamin Otte [Thu, 9 Mar 2023 02:34:01 +0000 (03:34 +0100)]
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.

2 years agofilerchooser: Show Recent files in inverse order
Ray Strode [Thu, 9 Mar 2023 20:42:16 +0000 (15:42 -0500)]
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.

2 years agoMerge branch 'more-size-allocation-fixes' into 'main'
Matthias Clasen [Wed, 8 Mar 2023 22:26:51 +0000 (22:26 +0000)]
Merge branch 'more-size-allocation-fixes' into 'main'

widget: Skip popovers in allocation

See merge request GNOME/gtk!5615

2 years agoMerge branch 'wip/chergert/fix-const-preserving-text-iter-order' into 'main'
Matthias Clasen [Wed, 8 Mar 2023 22:06:04 +0000 (22:06 +0000)]
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

2 years agoMerge branch 'file_chooser_stuff' into 'main'
Matthias Clasen [Wed, 8 Mar 2023 21:57:13 +0000 (21:57 +0000)]
Merge branch 'file_chooser_stuff' into 'main'

filechooser: two small changes

See merge request GNOME/gtk!5619

2 years agotextlinedisplaycache: fix const-preserving gtk_text_iter_order()
Christian Hergert [Wed, 8 Mar 2023 21:00:08 +0000 (13:00 -0800)]
textlinedisplaycache: fix const-preserving gtk_text_iter_order()

2 years agofilechooser: Do not look up parents of directories
Barnabás Pőcze [Wed, 8 Mar 2023 19:20:35 +0000 (20:20 +0100)]
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.

2 years agofilechooser: Use gtk_recent_info_is_local() for filtering
Barnabás Pőcze [Wed, 8 Mar 2023 19:04:41 +0000 (20:04 +0100)]
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.

2 years agoMerge branch 'ebassi/issue-5650' into 'main'
Matthias Clasen [Wed, 8 Mar 2023 18:45:10 +0000 (18:45 +0000)]
Merge branch 'ebassi/issue-5650' into 'main'

Filter recently used files in the file chooser

Closes #5650

See merge request GNOME/gtk!5618

2 years agoMerge branch 'fix-msvc-older-glib' into 'main'
Matthias Clasen [Wed, 8 Mar 2023 18:44:46 +0000 (18:44 +0000)]
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

2 years agowidget: Skip popovers in allocation
Matthias Clasen [Wed, 8 Mar 2023 18:36:42 +0000 (13:36 -0500)]
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.

2 years agowidget: Stop propagating alloc_needed beyond popovers
Matthias Clasen [Wed, 8 Mar 2023 18:13:15 +0000 (13:13 -0500)]
widget:  Stop propagating alloc_needed beyond popovers

This should not be necessary, since popovers get
their new size from present_popup via the compositor.

2 years agowidget: Remove goto usage in widget_allocate()
Benjamin Otte [Wed, 8 Mar 2023 18:27:46 +0000 (18:27 +0000)]
widget: Remove goto usage in widget_allocate()

2 years agowidget: Split out gtk_widget_ensure_allocate_on_children()
Benjamin Otte [Wed, 8 Mar 2023 18:23:50 +0000 (18:23 +0000)]
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.

2 years agowidget: Simplify size allocation
Matthias Clasen [Wed, 8 Mar 2023 18:06:53 +0000 (13:06 -0500)]
widget: Simplify size allocation

Don't call ensure_allocate if we've just
done size_allocate. This makes criticals
from reshowing popovers go away.

2 years agoFilter recently used files in the file chooser
Emmanuele Bassi [Wed, 8 Mar 2023 18:08:24 +0000 (18:08 +0000)]
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
2 years agoMerge branch 'wip/carlosg/reuse-search-engine' into 'main'
Matthias Clasen [Wed, 8 Mar 2023 12:58:43 +0000 (12:58 +0000)]
Merge branch 'wip/carlosg/reuse-search-engine' into 'main'

gtkfilechooser: Keep GtkSearchEngine around for longer

See merge request GNOME/gtk!5617

2 years agogtkfilechooser: Keep GtkSearchEngine around for longer
Carlos Garnacho [Wed, 8 Mar 2023 12:13:19 +0000 (13:13 +0100)]
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.

2 years agoMerge branch 'wip/carlosg/recursive-file-search' into 'main'
Matthias Clasen [Wed, 8 Mar 2023 11:56:41 +0000 (11:56 +0000)]
Merge branch 'wip/carlosg/recursive-file-search' into 'main'

searchengine: Improve performance for recursive search

Closes #4133

See merge request GNOME/gtk!5611

2 years agosearchengine: Do not fight filechooser search mode sorting
Carlos Garnacho [Wed, 8 Mar 2023 10:23:39 +0000 (11:23 +0100)]
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.

2 years agosearchengine: Bail out on the first character
Carlos Garnacho [Tue, 7 Mar 2023 23:03:28 +0000 (00:03 +0100)]
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.

2 years agosearchengine: Ensure some GFileInfo fields
Carlos Garnacho [Tue, 7 Mar 2023 23:01:53 +0000 (00:01 +0100)]
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.

2 years agosearchengine: Drop non-recursive search
Carlos Garnacho [Tue, 7 Mar 2023 22:04:25 +0000 (23:04 +0100)]
searchengine: Drop non-recursive search

Recursive search seems to be the hardcoded default, go with it.

2 years agosearchengine: Populate filesystem model in an idle
Carlos Garnacho [Tue, 7 Mar 2023 21:35:47 +0000 (22:35 +0100)]
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.

2 years agoMerge branch 'check_null_gfile_location' into 'main'
Matthias Clasen [Wed, 8 Mar 2023 03:19:00 +0000 (03:19 +0000)]
Merge branch 'check_null_gfile_location' into 'main'

filechooser: Fix memory leaks

See merge request GNOME/gtk!5610

2 years agoMerge branch 'matthiasc/for-main' into 'main'
Matthias Clasen [Wed, 8 Mar 2023 03:02:16 +0000 (03:02 +0000)]
Merge branch 'matthiasc/for-main' into 'main'

build: Handle introspection a bit better

See merge request GNOME/gtk!5614

2 years agofilechooser: Fix memory leaks
Barnabás Pőcze [Tue, 7 Mar 2023 23:28:25 +0000 (00:28 +0100)]
filechooser: Fix memory leaks

The returned strings from `file_chooser_get_location()` were never freed.

2 years agobuild: Handle introspection a bit better
Matthias Clasen [Wed, 8 Mar 2023 02:20:43 +0000 (21:20 -0500)]
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.

2 years agoMerge branch 'matthiasc/for-main' into 'main'
Matthias Clasen [Wed, 8 Mar 2023 02:31:19 +0000 (02:31 +0000)]
Merge branch 'matthiasc/for-main' into 'main'

filechooser: Handle pathless files

See merge request GNOME/gtk!5613

2 years agoMerge branch 'expose_checkable_state' into 'main'
Matthias Clasen [Wed, 8 Mar 2023 02:07:39 +0000 (02:07 +0000)]
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

2 years agofilechooser: Handle pathless files
Matthias Clasen [Wed, 8 Mar 2023 01:54:31 +0000 (20:54 -0500)]
filechooser: Handle pathless files

g_file_get_path() can return NULL. Make our
getter for file locations handle that case.

Related: !5610

2 years agoMerge branch 'matthiasc/for-main' into 'main'
Matthias Clasen [Wed, 8 Mar 2023 01:46:43 +0000 (01:46 +0000)]
Merge branch 'matthiasc/for-main' into 'main'

wayland: Don't crash during DND with Cairo renderer

See merge request GNOME/gtk!5612

2 years agowayland: Don't crash during DND with Cairo renderer
Benjamin Otte [Tue, 7 Mar 2023 04:50:08 +0000 (05:50 +0100)]
wayland: Don't crash during DND with Cairo renderer

Attaching buffers with offsets is forbidden now and nobody
checked the Cairo renderer.

2 years agotext: Don't crash when somebody drops NULL
Benjamin Otte [Tue, 7 Mar 2023 03:45:35 +0000 (04:45 +0100)]
text: Don't crash when somebody drops NULL

2 years agoMerge branch 'wroy-main-patch-03255' into 'main'
Emmanuele Bassi [Tue, 7 Mar 2023 23:48:25 +0000 (23:48 +0000)]
Merge branch 'wroy-main-patch-03255' into 'main'

MSBuild: Fix gnome.compile_resources current source directory

See merge request GNOME/gtk!5609

2 years agoApply suggestion to use '/' over join_paths
Emmanuele Bassi [Tue, 7 Mar 2023 22:40:17 +0000 (22:40 +0000)]
Apply suggestion to use '/' over join_paths

2 years agosearchengine: Improve performance for recursive search
Carlos Garnacho [Tue, 7 Mar 2023 19:38:46 +0000 (20:38 +0100)]
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
2 years agoFix compile_resources present source directory
William Roy [Tue, 7 Mar 2023 21:59:50 +0000 (21:59 +0000)]
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.

2 years agoMerge branch 'unbreak-combobox' into 'main'
Matthias Clasen [Tue, 7 Mar 2023 19:10:51 +0000 (19:10 +0000)]
Merge branch 'unbreak-combobox' into 'main'

combobox: Avoid extra queue_resize()

Closes #5644

See merge request GNOME/gtk!5608

2 years agoUpdated Danish translation
Ask Hjorth Larsen [Tue, 7 Mar 2023 19:02:40 +0000 (20:02 +0100)]
Updated Danish translation

2 years agocombobox: Avoid extra queue_resize()
Ivan Molodetskikh [Tue, 7 Mar 2023 17:51:32 +0000 (09:51 -0800)]
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
75a417e33708dab2bdb2f784a8952e085a12bf03.

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.

2 years agoMerge branch 'window-signals' into 'main'
Matthias Clasen [Tue, 7 Mar 2023 13:15:21 +0000 (13:15 +0000)]
Merge branch 'window-signals' into 'main'

window: Disconnect the ::compute-size handler

See merge request GNOME/gtk!5606

2 years agowindow: Disconnect the ::compute-size handler
Matthias Clasen [Tue, 7 Mar 2023 11:40:25 +0000 (06:40 -0500)]
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.

2 years agomodules/media: Fix Visual Studio builds with older GLib
Chun-wei Fan [Tue, 7 Mar 2023 06:27:06 +0000 (14:27 +0800)]
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.

2 years agoMerge branch 'expose_landmark_role' into 'main'
Matthias Clasen [Mon, 6 Mar 2023 17:49:05 +0000 (17:49 +0000)]
Merge branch 'expose_landmark_role' into 'main'

a11y: Expose GTK_ACCESSIBLE_ROLE_LANDMARK to AtSPI2

See merge request GNOME/gtk!5601

2 years agoa11y: When an accessible has GTK_STATE_CHECKED, set its ATSPI_STATE_CHECKABLE as...
Lukáš Tyrychtr [Mon, 6 Mar 2023 16:15:54 +0000 (17:15 +0100)]
a11y: When an accessible has GTK_STATE_CHECKED, set its ATSPI_STATE_CHECKABLE as well

This allows, for example, checkable list itemss.

2 years agoa11y: Expose GTK_ACCESSIBLE_ROLE_LANDMARK to AtSPI2
Lukáš Tyrychtr [Mon, 6 Mar 2023 15:45:19 +0000 (16:45 +0100)]
a11y: Expose GTK_ACCESSIBLE_ROLE_LANDMARK to AtSPI2

2 years agoUpdate Czech translation
Marek Černocký [Mon, 6 Mar 2023 11:57:22 +0000 (11:57 +0000)]
Update Czech translation

2 years agoMerge branch 'wip/exalm/template' into 'main'
Emmanuele Bassi [Mon, 6 Mar 2023 11:00:04 +0000 (11:00 +0000)]
Merge branch 'wip/exalm/template' into 'main'

widget: Use the correct template in dispose_template()

See merge request GNOME/gtk!5600

2 years agoMerge branch 'main' into 'main'
Matthias Clasen [Mon, 6 Mar 2023 05:52:00 +0000 (05:52 +0000)]
Merge branch 'main' into 'main'

removed duplicate function call

See merge request GNOME/gtk!5545

2 years agoMerge branch 'matthiasc/for-main' into 'main'
Matthias Clasen [Mon, 6 Mar 2023 05:50:36 +0000 (05:50 +0000)]
Merge branch 'matthiasc/for-main' into 'main'

macos: Fix type func generation

See merge request GNOME/gtk!5596

2 years agoMerge branch 'wip/fix-wl-destruct-order' into 'main'
Matthias Clasen [Mon, 6 Mar 2023 05:08:44 +0000 (05:08 +0000)]
Merge branch 'wip/fix-wl-destruct-order' into 'main'

wayland: Destroy xdg_surface after role

See merge request GNOME/gtk!5598

2 years agowidget: Use the correct template in dispose_template()
Alexander Mikhaylenko [Mon, 6 Mar 2023 01:36:16 +0000 (05:36 +0400)]
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.

2 years agoMerge branch 'wip/otte/for-main' into 'main'
Benjamin Otte [Sun, 5 Mar 2023 23:49:15 +0000 (23:49 +0000)]
Merge branch 'wip/otte/for-main' into 'main'

inspector: Make really sure we don't inspect ourselves

See merge request GNOME/gtk!5599

2 years agoinspector: Make really sure we don't inspect ourselves
Benjamin Otte [Sun, 5 Mar 2023 23:13:53 +0000 (00:13 +0100)]
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.

2 years agowayland: Destroy xdg_surface after role
Jonas Ådahl [Sun, 5 Mar 2023 19:54:40 +0000 (20:54 +0100)]
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")
2 years agomacos: Fix type func generation
Matthias Clasen [Sun, 5 Mar 2023 17:20:50 +0000 (09:20 -0800)]
macos: Fix type func generation

We were checking for gdk_quartz even though
the sysbols are now all called gdk_macos. Oops.

2 years agoMerge branch 'wip/otte/for-main' into 'main'
Benjamin Otte [Sun, 5 Mar 2023 17:53:18 +0000 (17:53 +0000)]
Merge branch 'wip/otte/for-main' into 'main'

cssnode: Don't crash the inspector

See merge request GNOME/gtk!5595

2 years agotestsuite: Add tests for the unknown enums
Benjamin Otte [Mon, 13 Feb 2023 07:39:54 +0000 (08:39 +0100)]
testsuite: Add tests for the unknown enums

See commit 40e7a265a7ccb1385a3af0931c591201b0ce063a

2 years agotestsuite: Add empty test for new node
Benjamin Otte [Mon, 13 Feb 2023 06:59:15 +0000 (07:59 +0100)]
testsuite: Add empty test for new node

2 years agocssnode: Don't crash the inspector
Benjamin Otte [Sun, 5 Mar 2023 17:30:45 +0000 (18:30 +0100)]
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.

2 years agoMerge branch 'matthiasc/for-main' into 'main'
Matthias Clasen [Sun, 5 Mar 2023 16:51:23 +0000 (16:51 +0000)]
Merge branch 'matthiasc/for-main' into 'main'

meson: Mention testsuite in summary

See merge request GNOME/gtk!5594

2 years agomeson: Mention testsuite in summary
Matthias Clasen [Sun, 5 Mar 2023 16:10:12 +0000 (08:10 -0800)]
meson: Mention testsuite in summary

This was broken out from the 'tests' toggle,
so list it separately.

2 years agoMerge branch 'expose_error_message_relation' into 'main'
Matthias Clasen [Sun, 5 Mar 2023 16:08:38 +0000 (16:08 +0000)]
Merge branch 'expose_error_message_relation' into 'main'

a11y: Expose GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE to AtSPI2

See merge request GNOME/gtk!5588

2 years agoMerge branch 'wip/otte/listview2' into 'main'
Benjamin Otte [Sun, 5 Mar 2023 15:53:43 +0000 (15:53 +0000)]
Merge branch 'wip/otte/listview2' into 'main'

listview: GtkListTile

See merge request GNOME/gtk!5584

2 years agoMerge branch 'matthiasc/for-main' into 'main'
Matthias Clasen [Sun, 5 Mar 2023 15:46:13 +0000 (15:46 +0000)]
Merge branch 'matthiasc/for-main' into 'main'

ci: Disable the testsuite in flatpak builds

See merge request GNOME/gtk!5593

2 years agoci: Disable the testsuite in flatpak builds
Matthias Clasen [Sun, 5 Mar 2023 15:23:20 +0000 (07:23 -0800)]
ci: Disable the testsuite in flatpak builds

No need to build the testsuite when we are
just producing flatpaks.

2 years agolistbase: Remove nonexisting function from header
Benjamin Otte [Sat, 4 Mar 2023 14:43:26 +0000 (15:43 +0100)]
listbase: Remove nonexisting function from header

2 years agogridview: Add a filler tile for empty space
Benjamin Otte [Sat, 4 Mar 2023 02:32:12 +0000 (03:32 +0100)]
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.

2 years agocolumnview: Clear the sorter first thing in dispose
Benjamin Otte [Fri, 3 Mar 2023 02:05:22 +0000 (03:05 +0100)]
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.

2 years agolistview: Handle emptying of views
Benjamin Otte [Fri, 3 Mar 2023 01:38:24 +0000 (02:38 +0100)]
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.

2 years agolistview: Remove an unused member variable
Benjamin Otte [Fri, 3 Mar 2023 01:35:56 +0000 (02:35 +0100)]
listview: Remove an unused member variable

It's only used in the allocate function, so make it a local varaible
there.

2 years agolistview: Simplify a vfunc
Benjamin Otte [Fri, 3 Mar 2023 01:20:17 +0000 (02:20 +0100)]
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.

2 years agolistview: Simplify allocation
Benjamin Otte [Thu, 2 Mar 2023 20:27:52 +0000 (21:27 +0100)]
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.

2 years agogridview: Remove an unused member variable
Benjamin Otte [Thu, 2 Mar 2023 04:46:16 +0000 (05:46 +0100)]
gridview: Remove an unused member variable

It's only used during size_allocate(), so make it a local variable
there.

2 years agolistitemmanager: Add a split vfunc and use it
Benjamin Otte [Thu, 2 Mar 2023 02:53:56 +0000 (03:53 +0100)]
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

2 years agolistview: Add gc'ing
Benjamin Otte [Thu, 2 Mar 2023 02:26:58 +0000 (03:26 +0100)]
listview: Add gc'ing

This is in preparation for the following reorg of the listitemmanager,
it should not have any effect now.

2 years agolistitemmanager: Remove unused functionality
Benjamin Otte [Wed, 1 Mar 2023 14:39:11 +0000 (15:39 +0100)]
listitemmanager: Remove unused functionality

Both ListView and GridView use GtkListTile now, so no need anymore for
custom machinery.

2 years agogridview: Redo tile management
Benjamin Otte [Wed, 1 Mar 2023 14:25:17 +0000 (15:25 +0100)]
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.