Commit Graph

40419 Commits

Author SHA1 Message Date
Matthias Clasen
b831d01f0d filesystemmodel: Drop unused arguments
Drop the unused get_func arguments in constructors.

Update all callers.
2022-10-20 22:34:40 -04:00
Matthias Clasen
278bcf2680 filechooserentry: Simplify model construction
Don't pass a get_value callback when creating the
filesystem model. It isn't called anymore, and things
continue to work.
2022-10-20 22:34:40 -04:00
Matthias Clasen
c19d0dc9ea filesystemmodel: Drop more unused api
Drop all apis that operate on tree iters.
We are no longer a tree model.
2022-10-20 22:34:40 -04:00
Matthias Clasen
edd5ed169e filesystemmodel: Drop _gtk_file_system_model_get_value
This function is unused, so drop it, and its callback.
2022-10-20 22:34:40 -04:00
Matthias Clasen
8ec9c3fdc6 filechooser: Some work on popup menus
This is a start towards placing menus properly.

We once again center keyboard-triggered menus
on the file list.
2022-10-20 22:34:40 -04:00
Matthias Clasen
e95022040f filechooser: Drop deprecated includes
We no longer use cell renderers and tree models
here. Yay.
2022-10-20 22:34:40 -04:00
Matthias Clasen
3a2ce620e2 filesystemmodel: Fix a possible problem
If the async query fails to reproduce a file info,
we still need to thaw the model, otherwise it ends
up frozen forever.

This was deduced by reading the code, I haven't
actually seen it happen.
2022-10-20 22:34:40 -04:00
Matthias Clasen
df49bf9eec filechooserwidget: Use a string sorter for names
We can use the new collation property of GtkStringSorter,
and get the benefit of sort key caching. This commit
also fixes an accidental leak of all sorters, and
removes the sorter from the location column - we never
show that column when individual colummns are sortable.
2022-10-20 22:34:40 -04:00
Matthias Clasen
53327f3aea filechooser: Drop unnecessary theme tracking
The widgets we are using handle theme changes
themselves, so there is no need for the filechooser
to do anything.
2022-10-20 22:34:40 -04:00
Matthias Clasen
c0c3d75062 filechooser: Bring back sorting
Add a sort model between the filter model and the
file system model, and set it up to sort according
to the circumstances.
2022-10-20 22:34:40 -04:00
Corey Berla
d0d0409f9d filechooserwidget: Reimplement DnD Drop Target
This reverts commit 34752a15a71597d00a8d08befc545ac1c178b81b.

Leaving out the drag source portion as that needs a total
reimplementation.  The GtkDropTarget only required minor
modifications.
2022-10-20 22:34:40 -04:00
Matthias Clasen
3a7d094542 filechooserwidget: Reinstate show_and_select_files
Now that we have information about visible and
filtered-out status of items, we can make this
function work again.
2022-10-20 22:34:40 -04:00
Matthias Clasen
280adcbb8c filechooserwidget: Add a filter model
Put a filter model between the selection model and
the filesystem model, and make it filter on the
filechooser::visible attribute. This makes the filer
combo in the filterchooser and the 'show hidden files'
item work. But we need to prod the filter to trigger
a refiltering every now and then.
2022-10-20 22:34:40 -04:00
Matthias Clasen
83431a999c filesystemmodel: Make filtering info available
Provide the filtered-out and visible bits as a file attributes
under the names filechooser::filtered-out and filechooser::visible,
so that we can filter on it.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
eeeee99aa8 filechooserwidget: Connect to the right model
When recreating the browse_files_model model, connect to that
model's item-changed signal, instead of connecting to the selection
model.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
0f503e0ba2 filechooserwidget: Connect to items-changed when changing model
Just like previous commit, we need to call list_items_changed()
even if we change from single selection to multi selection or
vice-versa.
2022-10-20 22:34:40 -04:00
Matthias Clasen
3e4ae62b44 filesystemmodel: Drop an unused include 2022-10-20 22:34:40 -04:00
Matthias Clasen
ec4f814bd4 filechooserwidget: Listen to items-changed too
To track changes of the selected items in a selection
model, we need to listen to both ::selection-changed
and ::items-changed.

This fixes the open button not turning sensitive
when initially loading a new folder.
2022-10-20 22:34:40 -04:00
Matthias Clasen
0141ba4e00 filechooser: Prevent recursion when activating items
When a list item is activated, we activate the default widget.
Unfortunately, due to some other bug, sometimes the open button
is not made sensitive, and then default.activate falls back
to activating the focus widget (which is the item we are just
coming from). Boom
2022-10-20 22:34:40 -04:00
Matthias Clasen
52ef16c21b actionmuxer: Add debug spew for action activation
This helps tracking down whe activation goes wrong.
2022-10-20 22:34:40 -04:00
Matthias Clasen
6ca7104015 filesystemmodel: Drop the tree model implementation
This is no longer used.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
07d6166ab8 filechooserwidget: Use GListModel API for post-renaming selection 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
dc651c3dc3 filechooserentry: Use separate GtkTreeStore for completion
Soon GtkFileSystemModel will not be a GtkTreeModel implementation,
so preemptively remove any usage of this interface. Populate the
list store using the GListModel's 'items-changed' signal.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
f520801626 filesystemmodel: Retire GtkFileSystemItem
This has to be the shortest-living object in GTK history!

It helped us greatly during the transition to GtkColumnView, but
now we can remove it in favour of GFileInfo directly. Perhaps I
could have never introduced GtkFileSystemItem in the first place,
but we're 30 commits deep and it's too late to just redo the whole
thing that will get us exactly here anyway.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
4e3fbd0b0f filesystemmodel: Always set standard::file attribute
This will help us greatly when porting GtkFileSystemModel to
GtkDirectoryList.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
8a24fdea38 filesystemmodel: Trivial cleanup
Use g_set_object() which does exactly what the code there does.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
b26222b6ba filechooserutils: Add helper to get GFile from info
This will be used extensively starting from next commit!
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
c8d291ab86 filechooserentry: Trivial cleanups
Use g_clear_object() in a couple of places. No functional changes.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
0a87438432 searchenginemodel: Use GListModel API to filter
We now start a mini-series of commits that will ultimately remove
the GtkTreeModel implementation of GtkFileSystemModel.

As a first step, port GtkSearchEngineModel iter through the files
using GListModel API.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
ddf1cd6678 filechooserwidget: Remove treeview
Now that most of the treeview usage is gone, remove the remaining
code that uses it - mostly event handling code, which for now won't
work, but will be fixed by next commits - and drop the tree view
entirely.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
9c6d5e2ca5 filechooserwidget: Use GtkSelectionModel for selection
So far, GtkFileChooserWidget has relied on GtkTreeView's selection
management. This commit moves it away from GtkTreeView, and that's
a massive surgery - sorry :(

The most important aspect of this commit is that 'selection_model'
is now the main model we deal with. Changing between directories,
recent files, and search, all sets the selection_model's model.

Selections are entirely handled by GtkSelectionModel now.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
1f2561b08e filesystemmodel: Add more GtkFileSystemItem getters
They'll help us further remove GtkTreeModel code.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
d5b31a30fd filechooserwidget: Stop centering on selected files 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
39c678988d filechooserwidget: Don't queue redraw / resize on tree view 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
9052c191cb filechooserwidget: Compare focus against column view
This effectively doesn't work, but focus will be reworked at some
point, and this gets us a tiny bit closer to that.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
766f442636 gtkfilechooserwidget: Don't set size request 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
27a3d2d09e filesystemmodel: Don't implement GtkTreeDragSource 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
3a3482e41e filechooserwidget: Remove DnD code
Another case where we'll reimplement it later.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
44c37fa34a filesystemmodel: Drop GtkTreeSortable interface
Stop implementing this interface. We'll be able to reimplement
sorting once we fully transition to GListModel.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
5c41dbfaa5 filechooserwidget: Remove sorting
This will be reimplemented later using list models. For now, let's
remove it so we can untangle all this code properly.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
c9d2ff7a0f filechooserwidget: Stop autosizing treeview 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
174af596c5 filechooserwidget: Use column view scrolled window
One less hook to treeview widgetry.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
de2624faa7 filechooserwidget: Move tooltip text to column view
Use a closure binding to query the tooltip.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
cda784a5f4 filechooserwidget: Move folder navigation to column view
React to column view's 'activate' signal, instead of treeview's
'row-activated'. It doesn't handle file sensitivity yet, but that
will probably be dropped later.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
cc33dbef03 filechooserwidget: Move keynav handling to column view 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
ce36611c4e filechooserwidget: Set rubberbanding on column view
And stop setting it on the tree view.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
038cb31d27 filesystemmodel: Don't expose cache
With this commit we start slowly cleaning up the sattelite code
surrounding GtkFileChooserWidget, so that we eventually drop it
all.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
3b53a6b0a9 filechooserwidget: Remove extra action bar 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
619ff2338e filechooserwidget: Move date and time to column view
Because this is the last treeview column, some pending tasks
are marked as TODO. We're getting close to dropping the tree
view!
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
2bcd6949df filechooserwidget: Move file type to column view 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
abd78ce5f5 filechooserwidget: Move size to column view
This was one of the easier ones. We merely delegate the hard work
to g_format_size(), like we already do for treeview.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
7899fc03c4 filechooserwidget: Move location to column view
Move the entire location column, which only contains the location
renderer, to the column view. The code to generate locations from
the current folder is essentially intact.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
9984f00781 filechooserwidget: Drop name column from treeview
It is now entirely handled by the column view.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
a0d3bdc911 filechooserwidget: Move file icon to column view
This commit moves the icon loading code into a new private
widget called GtkFileThumbnail, which is bound to the GFileInfo
of the model, and asynchronously loads the file icon from that.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
b96317b872 filechooserwidget: Move file name to column view
And remove it from the tree view. Next commits will look a lot like
this, until all columns are moved.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
6c84958b9f filechooserwidget: Replace 'list' page with column view
Replace the 'list' page of the main stack with another page, this
one containing a GtkColumnView. This, again, is the very minimal
code to achieve a column view - and validate the GListModel code
introduced in the previous commit - but there's a long way until
this column view covers the full range of features of the file
chooser.

The tree view still lives in an unused 'list2' page. From now on,
commits will "cannibalize" the treeview, each commit porting any
particular feature - be it a column, an event controller, etc -
to the column view, and dropping the corresponding feature from
the treeview.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
f2559b1dbb filesystemmodel: Implement GListModel
This is a trivial implementation of the GListModel interface. It
does not do anything fancy, like filtering out hidden files, nor
sorting.

The purpose of this minimal implementation is to bootstrap the
initial work to port GtkFileChooserWidget to GtkColumnView.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
ed2ade4801 filesystemmodel: Use g_clear_* on finalize
Trivial cleanup, no functional changes.
2022-10-20 22:34:40 -04:00
Matthias Clasen
4549172825 Merge branch 'matthiasc/for-main' into 'main'
inspector: Fix accessibility calls

See merge request GNOME/gtk!5154
2022-10-21 02:28:02 +00:00
Matthias Clasen
b877804eb6 Merge branch 'completion' into 'main'
entrycompletion: Fix inserted-text handler

See merge request GNOME/gtk!4892
2022-10-21 02:13:42 +00:00
Matthias Clasen
5310abbcf7 filechooserentry: Fix completions
Before we can drop them, lets make them work.

This was broken since 4.0, I assume :(
2022-10-20 21:41:18 -04:00
Matthias Clasen
490d4b0b9e inspector: Fix accessibility calls
The argument list of gtk_accessible_update_property
is -1-terminated, not NULL-terminated.
2022-10-20 21:19:13 -04:00
Matthias Clasen
375432f0b6 Merge branch 'columnview-sorter-api' into 'main'
gtk-demo: Add more sort columns

Closes #5149

See merge request GNOME/gtk!5152
2022-10-20 19:18:26 +00:00
Matthias Clasen
4cd2e2a11f Merge branch 'ebassi/tree-deprecation-docs' into 'main'
docs: Add deprecation messages to GtkTreeStore

See merge request GNOME/gtk!5115
2022-10-20 18:39:29 +00:00
Matthias Clasen
9ed1505073 columnviewtitle: Clean up interactions
Separate the apis we use for updating title,
menu and sort indicator.
2022-10-20 13:57:33 -04:00
Matthias Clasen
e040d3663e columnviewsorter: Add public API
This API should be sufficient to serialize
a columnviews sort configuration.

Fixes: #5149
2022-10-20 13:06:45 -04:00
Matthias Clasen
6af69a7b7d Make GtkColumnViewSorter public
API is yet to come.
2022-10-20 13:01:18 -04:00
Matthias Clasen
a116e0dd26 columnviewsorter: Cosmetics 2022-10-20 13:01:18 -04:00
Matthias Clasen
3e2b962a36 columnviewcolumn: Add an ID
This string can be used when storing columnview
configuration.
2022-10-20 13:01:18 -04:00
Matthias Clasen
abb60ec579 columnviewcolumn: Remove some unused code 2022-10-20 11:44:05 -04:00
Matthias Clasen
b738d4a6ac columnviewcolumn: Cosmetics 2022-10-20 11:44:05 -04:00
Emmanuele Bassi
e05157437f Add more messages to the deprecation warnings
Point to replacement types for the old GtkTree* API.
2022-10-20 15:39:07 +01:00
Emmanuele Bassi
e045e798a2 Mark GtkStyleContext type as deprecated
Add the Deprecated tag to the type docblock
2022-10-20 15:39:07 +01:00
Emmanuele Bassi
7908a72fa9 Mark GtkEntryCompletion type as deprecated
Add the Deprecated tag to the type docblock.
2022-10-20 15:39:07 +01:00
Emmanuele Bassi
593bf2bc6d Mark GtkTreeView-related types as deprecated
Add the Deprecated annotation to the type docblock.
2022-10-20 15:39:07 +01:00
Jan Tojnar
cf701d5db4 imcontextsimple: Document that Compose file support is incomplete
And that `include "%L"` does something different as introduced in
3b4b1c6878

Note that user can still use `include "/.%L"` as a workaround.
2022-10-20 16:19:13 +02:00
Emmanuele Bassi
bf8d4c5418 Mark GtkAppChooser-related types as deprecated
The type docblock needs a Deprecated annotation.
2022-10-20 14:38:31 +01:00
Emmanuele Bassi
912145c81b Mark GtkCellRenderer-related types as deprecated
The docblock for the type needs a Deprecated annotation, and we can use
it to point to the appropriate replacement.
2022-10-20 14:38:31 +01:00
Emmanuele Bassi
913127b553 Point at the replacement for GtkIconView
In the symbol annotations and in the docblocks.
2022-10-20 14:38:31 +01:00
Emmanuele Bassi
62f85e2f49 Point at the replacements for GtkTreeView
In the symbol annotations and in the docblocks.
2022-10-20 14:38:31 +01:00
Emmanuele Bassi
4b1212eb4a Point to replacement for GtkComboBoxText
GtkDropDown and GtkStringList replace GtkComboBoxText with a simpler
API.
2022-10-20 14:38:31 +01:00
Jan Tojnar
94a096ec4c composetable: Support non-FHS paths for Compose tables
On platforms like NixOS, the libX11 installation prefix may differ from /usr/share,
breaking the hardcoded placeholders. Let’s re-use the X11 path definition from imcontextsimple.
2022-10-20 12:59:17 +02:00
Emmanuele Bassi
404ee55ec4 Point to GtkDropDown as the GtkComboBox replacement 2022-10-20 11:10:57 +01:00
Emmanuele Bassi
5fbd52da49 docs: Add deprecation message for GtkListStore
Point to GListStore and list models instead.
2022-10-20 11:02:29 +01:00
Emmanuele Bassi
7bf094c117 docs: Add deprecation messages to GtkTreeStore
Point to GtkTreeListModel, and while we're at it, let's fix some of the
gtk-doc-isms that are still there.
2022-10-20 11:02:29 +01:00
Matthias Clasen
4bb79decf3 Merge branch 'label-selection-fix' into 'main'
label: Tweak selection behavior

Closes #2024

See merge request GNOME/gtk!5148
2022-10-19 21:37:08 +00:00
Matthias Clasen
60fb93e063 label: Tweak selection behavior
Arrange for double-click-followed-by-drag to do
select by words, not select-and-dnd. This matches
the behavior in GtkTextView better and feels
intuitive.

Fixes: #2024
2022-10-19 16:22:55 -04:00
Matthias Clasen
17819ad4f6 filechooser: Improve "Open in File Manager"
Just relying on GAppInfo leads to suboptimal
results. Instead, call either the OpenURI portal
or the org.freedesktop.FileManager1 interface
directly, and only fall back to GAppInfo.

The wrapper code for the OpenURI portal is taken
from gio, with small adjustments.

Fixes: #5260
2022-10-19 15:01:21 -04:00
Matthias Clasen
e037155a94 Merge branch 'text-overwrite-undo' into 'main'
testsuite: Fix tiff pixbuf tests

Closes #4411

See merge request GNOME/gtk!5138
2022-10-19 05:59:13 +00:00
Matthias Clasen
55cbb8a8d6 Merge branch 'clarify-gapplication-docs' into 'main'
docs: Clarify a point in GtkApplication docs

See merge request GNOME/gtk!5139
2022-10-19 03:54:36 +00:00
Matthias Clasen
1e5e0480fd text: Make overwrite undo-friendly
In overwrite mode, every typed character gets
handled as a delete+insert, but we should not
record these as two individually undoable
steps.

This matches how we handle overwrite mode in
GtkTextView.

Fixes: #4411
2022-10-18 23:49:16 -04:00
Matthias Clasen
917aa7928d docs: Clarify a point in GtkApplication docs
Clarify that loading of automatic resources uses
the resource base path that was set at construction
time.

Fixes: #4300
2022-10-18 23:47:48 -04:00
Matthias Clasen
55ccaf9df9 modelbutton: Set up tooltips
Use the text of iconic model buttons as tooltip.

Fixes: #5220
2022-10-18 22:35:28 -04:00
Matthias Clasen
d4d7d5eafd fontchooser: Drop a few errant translations
No point in translating these properties, they
are not strings.

Fixes: #5146
2022-10-18 16:40:37 -04:00
Matthias Clasen
7be993b728 editablelabel: Defer changes on focus-out
We can get spurious focus-out/-in pairs when
the editable label is in a popover that gets
a Wayland keyboard enter event as a result of
clicking the editable label.

A timeout isn't a great solution, but nothing
better is available right now.

Fixes: #4864
2022-10-18 14:23:22 -04:00
Matthias Clasen
e1d78821f6 window: Keep a reference to move_focus_widget
If we don't take a reference, it can happen that
the pointer is no longer valid by the time we
dereference it in after_paint.
2022-10-18 14:23:11 -04:00
Matthias Clasen
94ac1af293 Merge branch 'fix-focus-changes' into 'main'
window: Fix focus updates

Closes #4903

See merge request GNOME/gtk!5127
2022-10-18 11:02:08 +00:00
Matthias Clasen
f5063c1435 window: Don't focus invisible widgets
Only clear a queued move_focus if the widget
we are focusing is actually visible.

This was happening in some cases when popovers
are dismissed by clicking outside, and it was
causing us to miss proper focus updates that
were already queued.
2022-10-18 06:42:17 -04:00
Bilal Elmoussaoui
0fbaeaabd0 g-i: Fix deprecated version of GtkTreeView 2022-10-18 11:27:39 +02:00
Luca Bacci
995f00d23f Merge branch 'forward-port-mr-991-to-gtk4-2' into 'main'
Use native Windows API for converting keystrokes to characters

Closes #2944

See merge request GNOME/gtk!4986
2022-10-17 19:20:08 +00:00
Matthias Clasen
100605ef0c window: Fix focus updates
This partially undoes changes from 3dbf5038fa.

That commit did two things:
1) Move the focus update to after-paint time
2) Change from grabbing focus to the visible parent
   to  calling move_focus (TAB)

The second part did have the unintended consequence
of moving focus laterally.

Fixes: #4903
2022-10-17 15:10:41 -04:00
Benjamin Otte
f30e59fed9 dropdown: Handle ::selected and ::selected-item separately
GtkSingleSelection will only emit either of those signals if they
change. But it is possible that only one of those properties changes,
and in those cases we want to only notify for that property changing in
the dropdown, too.
2022-10-17 20:11:27 +02:00
Benjamin Otte
5e8b294faf singleselection: Be more careful about notifies
We don't want to notify::selected or notify::selected-item if they
didn't change.
This will bring performance benefits on frequently changing lists.

In particular, if lists get filtered or reordered, but the selected item
stays in the list, not doing a notify::selected-item will avoid updates
in connected handlers like GtkDropdown (and its handlers), thereby
avoiding lots of unnecessary updates.
2022-10-17 20:11:27 +02:00
Philip Zander
c84c469b78 Use native Windows API for converting keystrokes to characters 2022-10-17 19:36:48 +02:00
Matthias Clasen
d775caff7f Rename gtk_widget_get_style_color
This name wasn't everybody's favorite, so go with
the generic name gtk_widget_get_color() instead.
2022-10-16 21:41:43 -04:00
Benjamin Otte
ca2e14788d Merge branch 'antoniof-main-patch-03677' into 'main'
columnview: Don't be focusable

See merge request GNOME/gtk!5022
2022-10-14 22:39:49 +00:00
Sebastian Dröge
294e5bb79f Fix documentation for gtk_widget_get_style_color()
It was pointing at `gtk_widget_get_css_style()` instead.
2022-10-14 12:36:11 +03:00
Matthias Clasen
bde19f9b2a Fix blank popovers
This was a typo in 2b00b64e8c, making
us render the background on the wrong snapshot.
2022-10-13 16:38:41 -04:00
Matthias Clasen
3d605615ce filechooser: Update the settings docs
Document the window-position setting as unused.
2022-10-12 22:47:51 -04:00
Matthias Clasen
fa3c8ed5f9 filechooser: Stop using entrycompletion api
The file chooser entry now has an api for this.
2022-10-12 21:59:35 -04:00
Matthias Clasen
8ac5f1983e filechooserentry: Add a set_text api
This function prevents the completion popup
from coming up when setting the entry text.
2022-10-12 21:59:19 -04:00
Matthias Clasen
812a879ec2 inspector: Use gtk_widget_get_style_color
The graph renderer in the statistics page needs
the CSS foreground color to draw the graph. Use
the just introduced api for it.
2022-10-12 15:35:00 -04:00
Matthias Clasen
5627542d7c Add gtk_widget_get_style_color
There is a widespread need to access the CSS foreground
color for custom drawing in snapshot functions, so make
it available after gtk_style_context_get_color was
deprecated with a new widget api.
2022-10-12 15:35:00 -04:00
Matthias Clasen
f42fe500c9 cssnode: Avoid style context api
Duplicate the print flags in gtkcssnodeprivate.h,
so we don't rely on gtkstylecontext.h here.
2022-10-12 15:35:00 -04:00
Matthias Clasen
ee8c2a235f stylecontext: Deprecate most apis
The notable exception here are the global provider apis,
which are needed in some form and don't have a replacement
yet. Move them to gtkstyleprovider.[hc], so we can wholly
deprecated gtkstylecontext.[hc].
2022-10-12 15:35:00 -04:00
Matthias Clasen
5f54ecdf2c aboutdialog: Stop using gtk_style_context_save 2022-10-12 15:35:00 -04:00
Matthias Clasen
e09138ce45 textview: Stop using gtk_style_context_save_to_node 2022-10-12 15:35:00 -04:00
Matthias Clasen
a71893f88b text: Stop using gtk_style_context_save_to_node 2022-10-12 15:35:00 -04:00
Matthias Clasen
01324ffaff label: Stop using gtk_style_context_save_to_node 2022-10-12 15:35:00 -04:00
Matthias Clasen
c354465ed8 scrolledwindow: Stop using gtk_style_context_save_to_node 2022-10-12 15:35:00 -04:00
Matthias Clasen
50ab2386ec printunixdialog: Stop using gtk_style_context_save_to_node 2022-10-12 15:35:00 -04:00
Matthias Clasen
bf9f362597 popover: Stop using gtk_style_context_save_to_node 2022-10-12 15:35:00 -04:00
Matthias Clasen
d03ee57cc5 flowbox: Stop using gtk_style_context_save_to_node 2022-10-12 15:35:00 -04:00
Matthias Clasen
616e0a0d32 textview: Stop using gtk_snapshot_render api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen
ee76105119 text: Stop using gtk_snapshot_render api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen
381f863a18 label: Stop using gtk_snapshot_render api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen
57c63d9ce7 Use the new caret rendering api
Implement the deprecated gtk_snapshot_render api
for carets with the new one.
2022-10-12 15:35:00 -04:00
Matthias Clasen
0522dade9f Add gtk_css_style_snapshot_caret 2022-10-12 15:35:00 -04:00
Matthias Clasen
484cff2182 glarea: Stop using gtk_snapshot_render api
The gtk_snapshot_render api is deprecated, stop using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen
dd3c371c08 inscription: Stop using gtk_snapshot_render api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen
3145bce6a1 render: Use the new layout render api 2022-10-12 15:35:00 -04:00
Matthias Clasen
73f991a7fd Add gtk_css_style_snapshot_layout
This function renders a PangoLayout at a given
position, using text shadows and color from css.
2022-10-12 15:35:00 -04:00
Matthias Clasen
0205caa371 scrolledwindow: Port to the gtk_css_style_snapshot api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen
c2c46a7036 printunixdialog: Port to the gtk_css_style_snapshot api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen
2b00b64e8c popover: Port to the gtk_css_style_snapshot api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen
4e2522a080 iconview: Port to the gtk_css_style_snapshot api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen
473065dfeb flowbox: Port to the gtk_css_style_snapshot api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen
60dafebd91 Deprecate gtk_snapshot_render apis
Move the implementations from gtksnapshot.c to
gtk/deprecated/gtkrender.c and deprecated these
functions. We want to get rid of them.

These functions are still used in some of our widgetry,
so use G_GNUC_BEGIN/END_IGNORE_DEPRECATIONS around
them.
2022-10-12 15:35:00 -04:00
Matthias Clasen
35370752d5 Deprecate gtk_render apis
These take a GtkStyleContext as argument, and we
want to get rid of GtkStyleContext eventually.
The proper drawing api these days is gtk_snapshot.
2022-10-12 15:35:00 -04:00
Matthias Clasen
808d00906c printunixdialog: Stop using gtk_render_ apis
These are getting deprecated.
2022-10-12 15:35:00 -04:00
Matthias Clasen
da5d5bd71f popover: Stop using gtk_render_background
The gtk_render_ apis are getting deprecated.
2022-10-12 15:34:59 -04:00
Matthias Clasen
0c99e69423 flowbox: Stop using gtk_render_background
The gtk_render_ apis are getting deprecated.
2022-10-12 15:34:59 -04:00
Matthias Clasen
410813eb6b Merge branch 'deprecate-all-the-cells' into 'main'
Deprecate treeviews and cell renderers

See merge request GNOME/gtk!5098
2022-10-12 19:28:04 +00:00
Luca Bacci
6cc44eb0fe Merge branch 'for-master' into 'main'
For master

See merge request GNOME/gtk!5095
2022-10-12 13:56:51 +00:00
Matthias Clasen
11ee930b9d Merge branch 'inspector_a11y' into 'main'
GtkInspector: make the inspector at least a little bit more accessible

See merge request GNOME/gtk!5109
2022-10-12 11:06:35 +00:00
Matthias Clasen
5e256590db Deprecate treeviews and cell renderers
This includes

GtkCellArea
GtkCellAreaBox
GtkCellAreaContext
GtkCellEditable
GtkCellRenderer
GtkCellRendererAccel
GtkCellRendererCombo
GtkCellRendererPixbuf
GtkCellRendererProgress
GtkCellRendererSpin
GtkCellRendererSpinner
GtkCellRendererText
GtkCellRendererToggle
GtkCellView
GtkComboBox
GtkComboBoxText
GtkIconView
GtkListStore
GtkTreeModel
GtkTreeModelFilter
GtkTreeModelSort
GtkTreeStore
GtkTreeView
GtkTreeViewColumn
GtkTreeSelection
2022-10-11 17:18:21 -04:00
Matthias Clasen
79303d7cd3 inspector: Drop an unused file 2022-10-11 17:18:21 -04:00
Matthias Clasen
681a818af2 flowbox: Stop using gtk_render_background
The gtk_render_ apis are getting deprecated.
2022-10-11 17:18:21 -04:00
Matthias Clasen
c419b57754 stringsorter: Fix up a doc typo
gi-docgen links can be tricky to get right.
2022-10-11 15:32:05 -04:00
Matthias Clasen
05323869d7 stringsorter: Add more detail to the docs
Mention when a collation value of NONE might
be useful.
2022-10-11 14:09:21 -04:00
Matthias Clasen
2520148ebb Apply 2 suggestion(s) to 2 file(s) 2022-10-11 17:53:26 +00:00
Matthias Clasen
141aac1a60 stringsorter: Add a collation property
The new property lets us choose between
Unicode collation, filename collation, and
plain strcmp.

This will be used in the filechooser.
2022-10-11 13:42:00 -04:00
Lukáš Tyrychtr
8a1578ede8 GtkInspector: make the inspector at least a little bit more accessible
Namely, it adds accessible name to the property value editors and to a few labels in the a11y panel.
2022-10-11 13:34:53 +02:00
Matthias Clasen
7c8a098852 emojicompletion: Drop an unused include 2022-10-09 23:08:55 -04:00
Matthias Clasen
ecbdb3104a emojichooser: Drop an unused include 2022-10-09 23:03:43 -04:00
Matthias Clasen
c8a332b3af searchentry: Drop an unused include 2022-10-09 23:03:36 -04:00
Benjamin Otte
32ef462f1d fontbutton: Use attributes for custom font
Don't try to use CSS.
2022-10-09 09:10:39 -04:00
Matthias Clasen
b895360f49 inspector: Fix some criticals
This is fallout from the recent porting to GtkColumnView.
2022-10-09 09:10:39 -04:00
Matthias Clasen
c2c094e8a1 Merge branch 'matthiasc/for-main' into 'main'
widget: Changing the scale does no longer require a redraw

See merge request GNOME/gtk!5103
2022-10-09 13:10:24 +00:00
Benjamin Otte
d4d0192405 widget: Changing the scale does no longer require a redraw
It doesn't require one generally anyway, because only the root can
change scale and when that happens the root will queue a redraw.

But even if the root doesn't queue a redraw, render nodes (the only
thing discarded by queue_draw()) are scale-independant.
2022-10-09 08:50:32 -04:00
Matthias Clasen
15ea36e7fd Merge branch 'matthiasc/for-main' into 'main'
glarea: Drop an unused include

See merge request GNOME/gtk!5102
2022-10-09 12:49:42 +00:00
Matthias Clasen
9eec475dcc glarea: Drop an unused include
We are not using gtk_render apis here.
2022-10-09 08:10:12 -04:00
Tilo Villwock
661130d429 GtkPaned: Fix symbol names in code example 2022-10-08 13:49:10 +02:00
Matthias Clasen
08c0020ac3 placesview: Stop using GtkEntryCompletion
We want to get rid of tree models and cell renderers,
and that includes GtkEntryCompletion. The functionality
here is really not that essential.
2022-10-07 22:22:36 -04:00
Matthias Clasen
ac87c72797 paperdialog: Drop an unused function
This gets rid of a GtkListStore use.
2022-10-07 22:03:15 -04:00
Matthias Clasen
5fa027ab8a cssnode: Drop the node-added/-removed signals
These are no longer used, and the children-observer
listmodel is a better approach for monitoring the
children.
2022-10-07 17:21:04 -04:00
Matthias Clasen
dbe04adb1a inspector: Drop the css node tree model
This is not used anymore.
2022-10-07 17:17:41 -04:00
Matthias Clasen
6815f3af6d inspector: Stop using GtkTreeView for css nodes
Replace the css node tree with a GtkColumnView, using
the new gtk_css_node_observe_children api.
2022-10-07 15:54:02 -04:00
Matthias Clasen
f8357512d0 Add gtk_css_node_observe_children 2022-10-07 15:54:01 -04:00
Luca Bacci
8bfc19e7f7 GtkFileChooserNativeWin32: Add some option flags
Avoid changing the current directory.
Also avoid creating a sample file to test if the target file
can be created.

References:

* "Why does the common file dialog change the current directory?"
 -> https://devblogs.microsoft.com/oldnewthing/20101112-00/?p=12293

* "Why does the common file save dialog create a temporary file and then delete it?"
 -> https://devblogs.microsoft.com/oldnewthing/20140429-00/?p=1123
2022-10-07 19:06:09 +02:00
Matthias Clasen
61393fdcce inspector: Stop using GtkTreeView for statistics
GtkTreeView is heading towards deprecation; use
a GtkColumnView instead.
2022-10-07 01:40:51 -04:00
Matthias Clasen
6ed6cebcf4 inspector: Fixup
We were overlooking a transfer full here.
2022-10-07 00:12:47 -04:00
Matthias Clasen
7c5e1c6195 gtk: Rename some private headers
Improve the consistency of our private header
naming, by add 'private' to a bunch of them.
2022-10-05 23:01:28 -04:00
Matthias Clasen
abac891bd2 Merge branch 'inspector-trees' into 'main'
inspector: Stop using a treeview for css properties

See merge request GNOME/gtk!5086
2022-10-06 02:52:12 +00:00
Matthias Clasen
7a2c4e8a38 inspector: Stop using a treeview for css properties
Treeviews are heading towards deprecation.
2022-10-05 22:12:57 -04:00
Matthias Clasen
90e0ace325 inspector: Cosmetics 2022-10-05 21:20:04 -04:00
Matthias Clasen
9a2a5d9c8b mountoperation: Add a mnemonic to a button
This is a good practice, even if this is a rarely
used dialog.
2022-10-05 20:14:09 -04:00
Matthias Clasen
d4dd0dcd79 Merge branch 'accessible_range_interface' into 'main'
Introduce GtkAccessibleRange

See merge request GNOME/gtk!5066
2022-10-05 11:33:56 +00:00
Matthias Clasen
d454586927 Review fixes 2022-10-05 11:13:21 +00:00
Matthias Clasen
a924b820c2 inspector: Use more compact list styles
Use the same style classes throughout for
data lists that benefit from smaller fonts.
2022-10-04 23:25:12 -04:00
Matthias Clasen
ab7a04d89f inspector: Stop using a treeview for menus
Replace this with a GtkColumnView.
2022-10-04 22:49:05 -04:00
Matthias Clasen
a377f95aac Drop unused includes
This gets rid of treeview includes in a number of places.
2022-10-04 22:49:05 -04:00
Matthias Clasen
5d5de9f759 mountoperation: Don't use a treeview
Port the process list from GtkTreeView
to GtkListView, and fix a number of broken
things along the way.
2022-10-04 21:26:07 -04:00
Matthias Clasen
6a76fe41c6 mountoperation: Survive on Wayland
The code was assuming it is dealing with an
X11 display, and trigger assertions. Fix that
to make it work at least as well as it does
on Windows.
2022-10-04 21:26:07 -04:00
Matthias Clasen
ca576e877f inspector: Don't use treeviews in the recorder
Replace the event and render node details views with
columnviews.
2022-10-04 16:26:28 -04:00
Matthias Clasen
e68b365fa1 inspector: Fix some lifecycle issues
The template use in the inspector was not properly
disposing all widgets. gtk_widget_dispose_template
will only unparent widgets that have been named
as template children, so we need to make the toplevel
elements in the ui file named children, or manually
dispose them. This commit does the former.
2022-10-04 07:10:35 -04:00
Matthias Clasen
7e9ca5b41d Deprecate GtkEntryCompletion
We want to drop cell renderers and tree models
in GTK 5. The functionality of GtkEntryCompletion
may be replaced by a new widget in GTK 5.
2022-10-03 23:23:56 -04:00
Matthias Clasen
a527a4d82e Deprecate the app chooser widgets
These are a family of pretty specialized widgets, and
are very rarely used. Instead of porting them away
from GtkTreeView and GtkComboBox, deprecate them.
2022-10-03 23:02:09 -04:00
Matthias Clasen
adfc29968a Revert "gtk: Use gnome.mkenums_simple"
This reverts commit 11829fe7d0.

The mkenums_simple function can't properly handle headers
in subdirectories currently, so go back to the template
version.
2022-10-03 22:20:07 -04:00
Benjamin Otte
9af3bb8dc1 Remove outdated docs
There are a lot of automatic conversions in the blame log.
2022-10-03 21:12:42 +00:00
António Fernandes
9cb8d21cb5 columnview: Forward all focus to child
For the same reasoning as the preceding commit.

Also don't make GtkColumnView focusable. Its internal list view
is already focusable, which is enough to take care of the empty
view case.
2022-10-03 20:48:10 +01:00
António Fernandes
4fc4298920 listbase: Grab focus on items instead of container
The container view itself being focusable makes keyboard navigation
slower by adding a useless focus step.

It also means if an item gets removed, the focus jumps back to the view,
instead of jumping to the next item, as seen in nautilus bug report:
https://gitlab.gnome.org/GNOME/nautilus/-/issues/2489

Instead of making the GtkListBase container itself focusable, override
the .grab_focus() vfunc. This way, calling gtk_widget_grab_focus() on
the view container keeps working sucessfully, but focuses the focus
item directly instead.

This is particularly useful to have because applicaiton authors do
not have direct acess to this class's children, so they can't call
gtk_widget_grab_focus() on them directly.
2022-10-03 20:26:24 +01:00
Corey Berla
230188fb30 entrycompletion: Use GSignalGroup on the entry's buffer
We connect to the inserted-text signal for the entry's buffer.
During the lifetime of the entry, the buffer changes.  This is
literally the example used for GSignalGroup in the docs.
2022-10-03 10:40:27 -07:00
Jakub Steiner
a96c75ff02 stylesheet: sync combox with other popovers
- use the same lists style as everything else (menus, sidebars ...)

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5221
2022-10-03 15:43:07 +02:00
Carlos Garnacho
1b4ed00509 Merge branch 'evince_crash_popover_motion2' into 'main'
fix crash in gtk_synthesize_crossing_events()

Closes #5190

See merge request GNOME/gtk!5052
2022-10-03 12:19:35 +00:00
Emmanuele Bassi
31fea11255 a11y: Drop GtkAccessibleRange.get_minimum_increment()
MinimumIncrement is an AT-SPI-ism that has no counterpart in the ARIA
specification, so it should not live inside public API. Additionally,
it's not really a useful method because it collapses two values on the
adjustment API.

The only method in the GtkAccessibleRange interface should be the
set_current_value(), which allows ATs to control the current position in
a ranged widget.

The AT-SPI implementation can now use all the accessible properties,
including the VALUE_TEXT one, mapped to the Text property on the
AtSpi.Value interface.
2022-09-30 18:36:02 +01:00
Emmanuele Bassi
5dd7e24806 Clean up GtkAccessibleRange
Coding style and documentation fixes.
2022-09-30 16:58:00 +01:00
Lukáš Tyrychtr
7e683ed89b Use proper version specifier 2022-09-29 09:55:10 +02:00
Lukáš Tyrychtr
7fb892460a Document that this will be available only in GTK 4.10 2022-09-29 09:36:09 +02:00
Lukáš Tyrychtr
d517804acd Actually use the AccessibleRange interface 2022-09-29 09:36:09 +02:00
Lukáš Tyrychtr
ce761122b2 Implement also for GtkPaned 2022-09-29 09:36:09 +02:00
Lukáš Tyrychtr
76a5354ad7 Implement GtkAccessibleRange for GtkScaleButton 2022-09-29 09:36:08 +02:00
Lukáš Tyrychtr
006b473c0c Improve documentation 2022-09-29 09:36:08 +02:00
Lukáš Tyrychtr
5e1af6d7d5 Implement GtkAccessibleRange for GtkProgressBar 2022-09-29 09:36:08 +02:00
Lukáš Tyrychtr
ec0cd4a994 Implement GtkAccessibleRange for GtkLevelBar 2022-09-29 09:36:08 +02:00
Lukáš Tyrychtr
86864d7bc0 Account for GtkAccessibleRange implementations which do not have a
minimum step and it makes no sense for them to set the current value
2022-09-29 09:36:08 +02:00
Lukáš Tyrychtr
485ffcde38 Implement GtkAccessibleRange for GtkSpinButton 2022-09-29 09:36:08 +02:00
Lukáš Tyrychtr
0304eaec94 Implement GtkAccessibleRange for GtkRange 2022-09-29 09:36:08 +02:00
Lukáš Tyrychtr
a7814a0963 Introduce GtkAccessibleRange
This introduces GtkAccessibleRange, an interface which allows the accessibility backend to work with a control which can adjust a value.
2022-09-29 09:36:08 +02:00
Matthias Clasen
dd7cd6ffdd Add more names to sources
This helps with identifying things in sysprof logs,
and while debugging.
2022-09-28 12:37:21 -04:00
Matthias Clasen
aa9a7a931d Merge branch 'wip/carlosg/shuffle-reset-take2' into 'main'
gtkimcontextwayland: Shuffle full resets after IM changes

Closes #5200

See merge request GNOME/gtk!5050
2022-09-28 01:39:49 +00:00
Matthias Clasen
2ce2e90205 Merge branch 'fix-scale-crashes' into 'main'
scale: Fix a typo

See merge request GNOME/gtk!5061
2022-09-28 01:22:49 +00:00
Matthias Clasen
8b76cc841d scale: Fix a typo
We want to update the label size request when
the adjustment changes, not when anything else
changes.

This may be the reason for crash reports like
https://retrace.fedoraproject.org/faf/problems/bthash/?bth=1e5cc1318358d5db298e5d6c2ec47361922cce74
2022-09-27 21:03:56 -04:00
Benjamin Otte
c98cea3dbb drop target: Warn about broken signal handler returns
Signal handlers ust return their preferred action and that one must be
unique.

Shout at them if they don't do that, before gdk_drop_status() does
tesame thing.

Related: gnome-build-meta#554
Related: gnome-builder#1799
2022-09-27 03:50:29 +02:00
Emmanuele Bassi
0a67ac6d47 Merge branch 'left-right-typo' into 'main'
Fix GtkSettings docs typo

See merge request GNOME/gtk!5059
2022-09-26 22:23:29 +00:00
Mitchell Hentges
f8c0d86d6c Fix GtkSettings docs typo
"left of right" should be "left or right".
There's a small (subjective?) English nit in there as well: I believe
that buttons are placed (for example) "on the right" rather than "at the
right".
2022-09-27 00:00:30 +02:00
Matthias Clasen
1318fdc52c Merge branch 'fix_4577' into 'main'
Make the presentation of the stack sidebar listbox nicer for A11Y

Closes #4577

See merge request GNOME/gtk!4661
2022-09-26 14:41:29 +00:00
Nelson Benítez León
94a4c2cb40 fix crash in gtk_synthesize_crossing_events()
Update ancestor between GTK_CROSSING_OUT and
GTK_CROSSING_IN as it may have changed.

Fixes #5190
2022-09-24 21:25:05 -04:00
Matthias Clasen
11829fe7d0 gtk: Use gnome.mkenums_simple
This lets us avoid template files, and works just as well.
2022-09-24 21:23:00 -04:00
Matthias Clasen
e499a09759 Drop gtkintl.h
Include gtkprivate.h for I_() and glib-i18n.h for
gettext macros.
2022-09-24 10:03:37 -04:00
Carlos Garnacho
fb280e47d6 gtkimcontextwayland: Shuffle full resets after IM changes
Doing reset() on the text widgets after commit and delete_surrounding
is still too eager for some IMs (e.g. those that expect being able
to commit text while keeping a preedit buffer shown).

However, reset() is more of a "synchronize state" action on Wayland,
and it is still desirable to do that after changes that do come from
the IM (e.g. requesting the new surrounding text and cursor/anchor
positions). Notably here, the text_input protocol may still come up
with a preedit string after this state synchronization happens.

Shuffle the code so that the text widgets do not reset() the IM
context after text is deleted or committed, but the Wayland IM does
apply its practical effects after these actions happen. This keeps
the Wayland IM fully up-to-date wrt text widget state, while not
altering the ::commit and ::delete-surrounding-text behavior for
other IM context implementations.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5200
Fixes: 5b78fe2721 (gtktextview: Also reset IM context after IM...)
Fixes: 7c0a395ff9 (gtktext: Also reset IM context after IM...)
Fixes: 52ac71b972 (gtktextview: Shuffle the places doing IM reset)
Fixes: 9e29739e66 (gtktext: Shuffle the places doing IM reset)
2022-09-24 11:52:16 +02:00
Matthias Clasen
a8af7caae1 Rename gdk-private.h to gdkprivate.h
The extra - does not add any value.
2022-09-23 23:23:27 -04:00
Matthias Clasen
7d2c296357 Rename gdkconstructor.h to gdkconstructorprivate.h
This is the naming convention for private headers.
2022-09-23 23:14:08 -04:00
Matthias Clasen
c24a69549d Rename gdkdebug.h to gdkdebugprivate.h
This is the naming convention for private headers.
2022-09-23 23:12:01 -04:00
Matthias Clasen
f141da6b55 gtk: Dissolve gtk-autocleanup.h
Move the autocleanup declarations into their
respective headers.
2022-09-23 23:07:43 -04:00
Matthias Clasen
bccb4f87be Merge branch 'debug-envvars-cleanup' into 'main'
Clean up debug env vars

See merge request GNOME/gtk!5044
2022-09-23 23:06:47 +00:00
Matthias Clasen
52b6dbf2b4 gtk: Remove old debug macros
These are no longer used.
2022-09-23 18:51:46 -04:00
Matthias Clasen
f33f55bcbb gtk: Use the new debug macros 2022-09-23 18:12:39 -04:00
Matthias Clasen
f4d3f45c16 gtk: Introduce new debug macros
Introduce GTK_DISPLAY_DEBUG() and GTK_DEBUG(), which
mirror the new macros in gdk. They use the same helper
function gdk_debug_message().
2022-09-23 18:12:39 -04:00
Matthias Clasen
1f166ae071 macos: Use the new debug macros 2022-09-23 18:11:48 -04:00
Jakub Steiner
be6413b0e7 theme: tone down unfocused title labels
- mimic libadwaita in toning down unfocused titles. Cargo culting the
  filter instead of using normal opacity property.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4468
2022-09-23 17:01:24 +02:00
Carlos Garnacho
872534e763 gtkgesture: Do not update gestures with mismatching n-points on touchpad
Check that the touchpad gesture event has a matching number of fingers before
updating the GtkGesture point tracking, instead of afterwards. Avoids pointless
tracking of these touchpad events when we know beforehand that the gesture
will never be activated by the touchpad events.

Related: https://gitlab.gnome.org/GNOME/gtk/-/issues/5199
2022-09-23 16:04:32 +02:00
Matthias Clasen
ee1a634c25 Mark the invert-text-dir flag as always there
This flag works in non-debug builds too.
2022-09-21 21:47:06 -04:00
Matthias Clasen
1987398ec5 Drop the software-gl debug flag
This was not doing anything.
2022-09-21 21:03:40 -04:00
Matthias Clasen
3016edbe72 Merge branch 'font-chooser-docs' into 'main'
fontchooser: Add some details to the docs

See merge request GNOME/gtk!5041
2022-09-21 18:57:58 +00:00
Matthias Clasen
5b03f5c531 fontchooser: Add some details to the docs 2022-09-21 09:39:06 -04:00
Simon McVittie
60a83a51c3 build: Use more conservative GResource embedding on non-x86_64
Doing clever things with objcopy is faster and seems to be reliable on
x86_64 Linux, but also doesn't work on all toolchains and architectures:
in particular, Debian has had trouble with this on arm and mips.
In a distro build environment where we are compiling all of GTK every
time, the cost of potentially unreliable builds is higher than the cost
of using slower but more conservative GResource embedding.

Resolves: https://gitlab.gnome.org/GNOME/gtk/-/issues/5107
Signed-off-by: Simon McVittie <smcv@debian.org>
2022-09-17 21:50:38 +01:00
Alessandro Bono
5320acf589 gtk/main: Remove condition that always evaluates TRUE 2022-09-15 16:44:44 +02:00
Corey Berla
ad041fc5d4 gridview: Fix rubberbanding from negative x coordinates
This is a follow-up to 1e9a36ffa8. For GridView
we also need to make sure that we aren't rubberbanding below x=0 which
causes unexpected rubberbanding behavior.

Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2492
2022-09-14 11:27:52 -07:00
Matthias Clasen
6be27682a8 Regenerate builtin sequences
The table format has changed.
2022-09-12 22:30:47 -04:00
Matthias Clasen
8931169e00 input: Accept short compose sequences
Some of the X keyboard layouts use compose
sequences of length one to make individual
keys generate multiple Unicode characters.

To support this use case, change the index
part of the table format to also include
an offset for length 1. Bump the table
version to indicate this change.

Fixes: #5172
2022-09-12 22:30:47 -04:00
Matthias Clasen
72785c68d6 Cosmetics: Fix a typo 2022-09-12 12:01:30 -04:00
Emmanuele Bassi
dca57bebb7 Merge branch 'a11y-state-changes' into 'main'
a11y: Be safe against state type changes

See merge request GNOME/gtk!5018
2022-09-10 00:04:03 +00:00
Matthias Clasen
4c1bc93f6f a11y: Be safe against state type changes
For some of the a11y states, calling gtk_accessible_reset_state
can change the type of the state value from boolean or tristate
to undefined.

Handle that, instead of throwing criticals.

Related: !4910
2022-09-09 16:07:24 -04:00
Matthias Clasen
7e54a7e5a5 filechooser: Restore ~ and . functionality
We'll have to keep patching up these things
until somebody rewrites the file chooser :(

Inspired by: !4970
2022-09-09 14:44:28 -04:00
Matthias Clasen
d7817e6fc6 Merge branch 'gtkplaces' into 'main'
gtkplacesview: Right click popover fix crash and align menu with mouse

See merge request GNOME/gtk!4662
2022-09-09 14:59:03 +00:00
Matthias Clasen
de94f3d97f Merge branch 'gtktooltip.c-optimise' into 'main'
gtk/gtktooltip.c: check result of event position get operation

Closes #5134

See merge request GNOME/gtk!4996
2022-09-09 14:56:33 +00:00
Matthias Clasen
066884aed1 Merge branch 'wip/carlosg/im-reset' into 'main'
Avoid early IM reset on updates

Closes #5133

See merge request GNOME/gtk!5012
2022-09-09 12:36:43 +00:00
Matthias Clasen
7d564ecdc9 Merge branch 'textbuffer-set-text-docs' into 'main'
Document irreversibility of gtk_text_buffer_set_text

See merge request GNOME/gtk!5005
2022-09-06 22:19:30 +00:00
Matthias Clasen
d850dfd245 Merge branch 'launch-uri-no-export' into 'main'
Make gtk_launch_uri more robust

Closes #5152

See merge request GNOME/gtk!5010
2022-09-06 20:50:06 +00:00
Matthias Clasen
a6d5757627 Merge branch 'gtk-scale-set-digits-update-label' into 'main'
GtkScale: Update the label size request from set_digits ()

Closes #5156

See merge request GNOME/gtk!5011
2022-09-06 20:34:39 +00:00
Matthias Clasen
ad8a3e5b45 Merge branch 'wip/antoniof/columnview-rtl' into 'main'
columnview: Invert columns on RTL

Closes nautilus#2302

See merge request GNOME/gtk!5002
2022-09-06 20:30:15 +00:00
Carlos Garnacho
5b78fe2721 gtktextview: Also reset IM context after IM surrounding text deletion
When the IM commands the GtkText to delete text, the cursor position
would change, and so would the surrounding text. Reset the IM context
so that these updates are properly picked up by the IM.

Fixes backspace	key behavior in	the GNOME Shell OSK, since that	relies
on the surrounding text	being properly updated for the next iteration.
2022-09-06 22:17:40 +02:00
Carlos Garnacho
7c0a395ff9 gtktext: Also reset IM context after IM surrounding text deletion
When the IM commands the GtkText to delete text, the cursor position
would change, and so would the surrounding text. Reset the IM context
so that these updates are properly picked up by the IM.

Fixes backspace key behavior in the GNOME Shell OSK, since that relies
on the surrounding text being properly updated for the next iteration.
2022-09-06 22:17:40 +02:00
Carlos Garnacho
41f26975a9 gtktext: Avoid early IM reset on updates
Resetting the IM on IM updates is too eager and indeed the simple
IM context doesn't like that this happens in the middle of dead
key handling.

We however want to reset the IM after actual text buffer changes
(say, a committed string) moved the cursor position, altered the
surrounding text, etc. So that the IM implementation does know to
update its state.

Since there is going to be an actual IM reset anyways, it does
no longer make sense to try to preserve the old priv->need_im_reset
status during commit handling.

Fixes: 52ac71b972 ("gtktextview: Shuffle the places doing IM reset")
Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5133
2022-09-06 22:17:40 +02:00
Carlos Garnacho
085374198f gtktext: Avoid early IM reset on updates
Resetting the IM on IM updates is too eager and indeed the simple
IM context doesn't like that this happens in the middle of dead
key handling.

We however want to reset the IM after actual text buffer changes
(say, a committed string) moved the cursor position, altered the
surrounding text, etc. So that the IM implementation does know to
update its state.

Fixes: 9e29739e66 ("gtktext: Shuffle the places doing IM reset")
Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5133
2022-09-06 22:17:40 +02:00
Matthias Clasen
586675c902 Merge branch 'treepopover-ellipsize' into 'main'
treepopover: Do not propagate natural width of content

See merge request GNOME/gtk!4895
2022-09-06 20:17:33 +00:00
Luca Bacci
cc57692345 GtkScale: Update the label's size request from set_digits ()
Update the label size request when setting the digits property
by calling the update_label_request () util function.

That util function works by measuring the size request of the
label with the lower and upper values of the adjustment, then
taking the max. That way the size requisition is constant
regardless of the actual displayed value.

Since the util function internally works by setting the text
of the label, let it also set the text at last by taking in
account the current adjustment's value. Most of its callers
do that anyway.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5156
2022-09-06 21:08:31 +02:00
Matthias Clasen
a0db8a24c2 Make gtk_launch_uri more robust
We were failing to launch the uri if we are on
Wayland, but have no xdg_foreign protocol support.

Fixes: #5152
2022-09-06 12:37:56 -04:00
Elliott Sales de Andrade
4cbfb69f74 Document irreversibility of gtk_text_buffer_set_text
If you've begun a user action and call `gtk_text_buffer_set_text`, you
get an unexpected warning:
```
Gtk-WARNING **: Cannot begin irreversible action while in user action
```
which can be fixed by doing the delete/insert yourself. But this is not
documented as occurring, so document it.
2022-09-04 02:47:57 -04:00
António Fernandes
91e6f8e4b9 columnview: Invert columns on RTL
Respect text direction.

Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2302
2022-09-02 15:44:59 +01:00
Mat
58953671fe treeview: Don't claim event sequence too early
We want to claim the event sequence in the click gesture when appropriate,
such as activating a row or clicking an editable cell, but this is currently
done too early, preventing other gestures for drag-and-drop and rubberband
selection entirely.

Fixes #3649
Fixes #3985
Fixes #4669
2022-09-02 15:04:43 +03:00
Luca Bacci
041a186272 Merge branch 'implement-gtk-color-picker-for-windows' into 'main'
Implement GtkColorPicker for Windows

Closes #5136

See merge request GNOME/gtk!4983
2022-09-01 20:39:15 +00:00
Luca Bacci
86a38918d7 Implement GtkColorPicker for Windows
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5136
2022-09-01 19:25:07 +02:00
Matthias Clasen
adcec93b02 Merge branch 'gtkplacessidebar' into 'main'
gtkplacessidebar: Fix crash when remove or rename bookmark

See merge request GNOME/gtk!4625
2022-09-01 15:00:42 +00:00
Lukáš Tyrychtr
27f32b7f9b GtkInscription: Set the a11y label when updating the text property 2022-09-01 16:19:59 +02:00
Georges Basile Stavracas Neto
9261b0079d gtk: Remove last-folder-uri from schema
It's unused since 2013, apparently.
2022-08-30 15:58:47 -03:00
Maxim Zakharov
982b4ff3b2 gtk/gtktooltip.c: check result of event position get operation
Do not perform coordinates transformation when gdk_event_get_position()
returns FALSE as it returns NaNs in that case and these coordinates
are not used anyway in further processing (closes #5134).
2022-08-30 15:54:52 +10:00
Matthias Clasen
e077a6bffe Merge branch 'wip/jimmac/HC-italic-hints' into 'main'
HC: entry - make hints italic

Closes #5143

See merge request GNOME/gtk!4994
2022-08-29 18:55:34 +00:00
Matthias Clasen
39439aa838 fontchooser: Rename default feature value
"Default" is a better fit than "None" here.
2022-08-29 14:14:07 -04:00
Matthias Clasen
018bd0a927 fontchooser: Add a tooltip to the tweak button
Icon-only buttons are always better with a tooltip.
2022-08-29 12:13:32 -04:00
Matthias Clasen
975ab6e7cf fontchooser: Remove placeholder from preview entry
The way we explicitly set the font on the entry
conflicts with the placeholder text styling. But the
entry isn't normally empty, so placeholder text is
not that important here. Remove it and use a tooltip
instead.
2022-08-29 10:21:37 -04:00
Jakub Steiner
09176fc1b3 HC: entry - make hints italic
- to keep contrast but indicated difference between a value and a hint

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5143
2022-08-29 11:58:29 +02:00
Matthias Clasen
0f2582ff02 Merge branch 'font-feature-work' into 'main'
fontchooser: Improve handling of features

See merge request GNOME/gtk!4992
2022-08-29 01:26:12 +00:00
Matthias Clasen
a217be14f9 Merge branch 'gtknotebook-arrow-press' into 'main'
gtknotebook: Claim event sequence after pressing notebook arrow buttons

See merge request GNOME/gtk!4990
2022-08-28 23:30:00 +00:00
Matthias Clasen
c364f1ee12 fontchooser: Improve handling of features
salt and swsh need to be treated like cvXX, with
a dropdown. Also add examples to the default cases
of radio groups.
2022-08-28 17:02:56 -04:00
Mat
dd8c899737 gtknotebook: update arrow button state when reordering tabs
When reordering notebook tabs, updating the sensitivity state of the
arrow buttons is necessary if the tab is moved to the beginning or
end of the tab list.
2022-08-29 00:00:10 +03:00
Mat
d69fdaa04d gtknotebook: Claim event sequence after pressing notebook arrow buttons
When notebook tabs are reorderable, pressing the notebook arrow buttons to
change the active tab results in tabs reordering unexpectedly.
Claim the event sequence after pressing an arrow button to avoid conflicts
with the motion/drag gesture used for reordering.
2022-08-28 23:42:59 +03:00
Matthias Clasen
1276e8868d Merge branch 'notebook-tab-accessibility' into 'main'
gtkatspiselection: Retrieve the correct GtkNotebook tab widget

See merge request GNOME/gtk!4989
2022-08-28 14:53:03 +00:00
Mat
df40efd50d gtkatspiselection: Retrieve the correct GtkNotebook tab widget
A typo resulted in the tab container widget being retrieved instead of
the tab widget. If an adjacent action widget was present, an infinite
loop occurred when switching tabs while a screen reader was enabled.
2022-08-28 17:02:01 +03:00
Matthias Clasen
32796cad10 Use gtk_event_controller_set_static_name
This avoids strdups.
2022-08-27 22:35:13 -04:00
Matthias Clasen
b6a965a67c eventcontroller: Allow static names
These names are a debug-only feature, and we
use string literals everywhere, so avoid the
overhead of copying them.
2022-08-27 22:35:13 -04:00
Matthias Clasen
6136f3ab95 shortcutaction: Intern signal names
Signal names are already interned anyway,
so we can avoid strdups here, and just use
the interned names.
2022-08-27 22:35:13 -04:00
Matthias Clasen
d3e79633e1 notebook: Use canonical signal names
No excuse for not doing that.
2022-08-27 22:34:31 -04:00
Matthias Clasen
137af44f81 Merge branch 'font-chooser-feature-work' into 'main'
fontchooser: Handle font features better

See merge request GNOME/gtk!4984
2022-08-26 22:10:52 +00:00
Matthias Clasen
0441fd3678 fontchooser: Handle font features better
Properly show multiple-choice cvXX features as dropdowns,
include afrc, and fix bugs in feature enumeration that
made some features not show up.
2022-08-26 17:53:55 -04:00
Luca Bacci
3abc3425cb Merge branch 'win32-gir' into 'main'
gdk/win32: do not expose gdk_win32_*_libgtk_only in public headers

See merge request GNOME/gtk!4980
2022-08-26 13:14:30 +00:00
Benjamin Otte
fb7257a1f5 Merge branch 'treelistmodel-collapse-test' into 'main'
treelistmodel: Fix handling of collapsed nodes

Closes #4595

See merge request GNOME/gtk!4981
2022-08-24 13:42:51 +00:00
Matthias Clasen
f1c1c979c2 treelistmodel: Fix handling of collapsed nodes
When we collapse a node, we clear out the children,
but we were not disconnecting the signal handler on
the child listmodel, leading to bad outcomes when
that model is persistent and changing.

Fixes: #4595
2022-08-24 08:23:20 -04:00
Marc-André Lureau
6cfb6e0c9c gdk/win32: do not expose gdk_win32_*_libgtk_only in public headers
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-24 15:44:32 +04:00
Marc-André Lureau
88503bcc3b gtk/win32: fix a switch-default warning
gtk/gtkimcontextime.c:714:3: warning: switch missing default case [-Wswitch-default]

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 16:42:17 +04:00
Marc-André Lureau
04ebec0fa7 gtk/win32: use gdk_win32_surface_get_handle
As I propose to deprecate gdk_win32_surface_get_impl_hwnd() next,
replace it with the alternative.

The main difference between the two functions is that
gdk_win32_surface_get_impl_hwnd() fails gracefully by returning NULL if
the surface is not of the win32 implementation.

All the surfaces should be native surfaces here, and the existing code
doesn't seem to deal with NULL case anyway.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 16:31:09 +04:00
Luca Bacci
0d4d52d322 Merge branch 'win32-gir' into 'main'
Generate gtk/GdkWin32-4.0.gir

Closes #5112

See merge request GNOME/gtk!4965
2022-08-22 22:26:09 +00:00
Matthias Clasen
a52ee9ee22 css: Fix freeing of calc values
We were getting our memory allocations mixed
up here.

Fixes: #5130
2022-08-22 11:51:56 -04:00
Matthias Clasen
092c166f54 Merge branch 'no-emoji-insert' into 'main'
text: Respect no-emoji hint fully

See merge request GNOME/gtk!4972
2022-08-21 20:47:27 +00:00
Matthias Clasen
13f8eeb3ee text: Respect no-emoji hint fully
We were disabling the insert-emoji action when the
no-emoji input hint is set, but the Ctrl-. shortcut
was bypassing the action and kept working. Make
the shortcut activate the action instead.

Fixes: #5123
2022-08-21 16:31:14 -04:00
Matthias Clasen
78eaad614a emojichooser: Fix arrow keynav
When some of the Emoji have been filtered out by
a search term, arrow keynav would behave oddly and
get stuck in invisible sections. Fix this by ignoring
any filtered out children when moving between
sections for arrow keynav.

Fixes: #5076
2022-08-19 15:55:10 -04:00
Marc-André Lureau
8ab57fc8ef build-sys: generate GdkWin32.gir
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-19 17:42:30 +04:00
Matthias Clasen
44931aa8f8 Merge branch 'treeview-search-focus' into 'main'
treeview: Always call grab_focus_without_selecting on search entry

Closes #4551

See merge request GNOME/gtk!4961
2022-08-18 23:51:02 +00:00
Carlos Garnacho
f66ffde68d gtkimcontextwayland: Refactor handling of client updates
Currently, the wayland IM context sends zwp_text_input_v3.commit from
a number of places, and some of them with partial data. In order to
make client state updates "atomic" and complete, make the communication
happen over an unified notify_im_change() function that happens on
a narrower set of circumstances:

  - The GtkIMContext is reset
  - The GtkIMContext is just focused
  - The gesture to invoke the OSK is triggered
  - The IM context is reacting to changes coming from the compositor

Notably, setting the cursor location or the surrounding text do not try
to commit state on their own, and now will be flushed with the corresponding
IM update or reset. But also, these requests won't be prevented from
happening individually on serial mismatch, instead it will be the whole
state commit which is held off.

With these changes in place, all client-side updates are notified
atomically to the compositor under a single .commit request.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5106
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5105
2022-08-18 19:19:53 +02:00
Carlos Garnacho
52ac71b972 gtktextview: Shuffle the places doing IM reset
During text widget manipulation (inserting or deleting text via keyboard)
the IM context is reset somewhat early, before the actual change took place.
This makes IM lag behind in terms of surrounding text and cursor position.

Shuffle these IM reset calls so that they happen after the changes, and
ensure that the IM is actually reset, since that is currently toggled on
a pretty narrow set of circumstances.

Also, fix a bug during GtkEventControllerKey::im-update where the condition
on cursor position editability to reset the IM context was inverted.
2022-08-18 19:07:12 +02:00
Mat
27eaca8b79 treeview: Always call grab_focus_without_selecting on search entry
The search text entry is always a GtkText widget, not GtkEntry. If a
custom search entry is set, this part of the code is never reached.

Fixes #4551
2022-08-18 18:03:04 +03:00
Carlos Garnacho
9e29739e66 gtktext: Shuffle the places doing IM reset
During text widget manipulation (inserting or deleting text via keyboard)
the IM context is reset somewhat early, before the actual change took place.
This makes IM lag behind in terms of surrounding text and cursor position.

Shuffle these IM reset calls so that they happen after the changes, and
ensure that the IM is actually reset, since that is currently toggled on
a pretty narrow set of circumstances.
2022-08-18 00:55:30 +02:00
Matthias Clasen
bebaac64e1 Merge branch 'gtktreeview-adjustment' into 'main'
treeview: Do not set top row adjustment value while animating

Closes #4550

See merge request GNOME/gtk!4940
2022-08-14 22:40:32 +00:00
Matthias Clasen
1d232a725f Merge branch 'treeview-widget-coords' into 'main'
treeview: Use widget coordinates where required

See merge request GNOME/gtk!4939
2022-08-14 22:39:21 +00:00
Benjamin Otte
918dd66dca listitemwidget: Actually unref the listitems
Fixes #5102
2022-08-14 22:55:27 +02:00
Matthias Clasen
33cf8f9404 inscription: Plug a memory leak
PangoFontMetrics also need to be freed.
2022-08-12 20:35:36 -04:00
Matthias Clasen
1640390839 inscription: Plug a memory leak
PangoLayoutIter needs to be freed.
2022-08-12 20:35:36 -04:00
Matthias Clasen
e81db46578 a11y: Fix a memory leak
We need to free the queued context list in dispose
if we didn't get to register the contexts, and we also
need to free the list properly when we do get to
register them.

This showed up in valgrind as leaked GList structs.
2022-08-12 12:01:42 -04:00
Pablo Correa Gómez
97d3363360
gtk/css: data_url_path fix leak in error path
Fixes 7900032f30
2022-08-12 01:34:18 +02:00
Matthias Clasen
7900032f30 css: Propagate charset conversion errors
Lets not throw away informtation that
helps to figure out why things fail.
2022-08-11 07:29:56 -04:00
José Expósito
95860d4989 gtkeventcontrollerscroll: Always accumulate discrete deltas
When GTK_EVENT_CONTROLLER_SCROLL_DISCRETE is set, accumulate deltas also
for mouse scroll so a high-resolution mouse wheel click behaves in the
in the same manner as a low-resolution mouse wheel click.
2022-08-10 14:23:58 +00:00
José Expósito
6ebb38e12e gdk/events: Set discrete scroll deltas in its constructor
Instead of calculating the discrete scroll deltas in
GtkEventControllerScroll, move that code to the event constructor and
access the precalculated values using gdk_scroll_event_get_deltas.

Refactor, no functional changes.
2022-08-10 14:23:58 +00:00
Mat
b4ade026f1 treeview: Do not set top row adjustment value while animating
gtk_tree_view_top_row_to_dy, which is called from GtkTreeView's
size_allocate function, changes the adjustment value. Since this
conflicts with the animation when changing the active row, bail
out until the animation is finished.

Fixes #4550
2022-08-10 08:32:47 +03:00
Mat
102ca838b8 treeview: Use widget coordinates where required
When a GtkTreeView scrolled horizontally, it was not possible to
select rows outside the initial area due to an erroneous comparison
between widget and bin window coordinates.

Original change to widget coordinates occurred in commit
a0de570e47
2022-08-10 04:25:19 +03:00
Carlos Garnacho
378ae4fbc1 Merge branch 'gbsneto/paned-focus-infloop' into 'main'
paned: Protect against NULL variable

Closes #5094

See merge request GNOME/gtk!4938
2022-08-09 18:26:48 +00:00
Carlos Garnacho
54465adff2 gtkwindow: Use pointer-oriented function to deal with crossing events
Commit adba0b97 fixed missed pointer crossings by using a helper function that
was already present and looked like did everything that was needed. However
this function was oriented to keyboard focus and it also did update the related
widget state. Doing these changes on pointer-based crossing was misuse, and
could cause weird interactions with keyboard focus management.

Fix this by using gtkmain.c gtk_synthesize_crossing_event() that is in fact
oriented to pointers.

Fixes: adba0b97 (gtkwindow: Synthesize pointer crossing events on state changes)
Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5094
2022-08-09 19:48:15 +02:00
Georges Basile Stavracas Neto
29580d4252 paned: Warn if child is not actually a child
This will at least allow us to debug this in the future.
2022-08-09 14:20:25 -03:00
Carlos Garnacho
25c3616a79 gtkmain: Pass coordinates when synthesizing pointer events
Instead of passing an event and figuring out coordinates from it, pass
directly the toplevel coordinates so that we can use this outside event
handling.

All callers have been updated to pass the coordinates, in practical effects
they were already based on the GtkNative.
2022-08-09 19:13:28 +02:00
Georges Basile Stavracas Neto
120399cc92 paned: Protect against NULL variable
The inner loop in gtk_paned_set_focus_child() tries to find the
topmost GtkPaned, however, if the `w` variable ends up becoming
NULL after bubbling up the entire GtkWidget hierarchy, this loop
never breaks.

Check for NULL in this loop.

Closes https://gitlab.gnome.org/GNOME/gtk/-/issues/5094
2022-08-09 13:59:09 -03:00
Alexander Mikhaylenko
493660a296 scrolledwindow: Lower the scroll multiplier
c68247f63b introduced a scroll multiplier,
intended to be significantly lower than the GTK 4.6 behavior but higher
than 1. However, it was _higher_ than 4.6, since 4.6 also had a permanent
1/10 multiplier in GDK, so the cited multiplier values were really 6.4 and
9.7.
2022-08-08 00:07:36 +04:00
Carlos Garnacho
0e5a97ae58 gtk/scrolledwindow: Check for overshoot setting up kinetic scroll helpers
We may have situations where velocity is 0/0, but are overshooting. Places where
this happens are mouse wheels, and continuous scroll that ended up still before
finish. In this situation we also want to run the animation for overshoot, so
check for the corresponding axes to also set up the kinetic scroll helper.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4784
2022-08-07 20:26:52 +02:00
Carlos Garnacho
c68247f63b gtkscrolledwindow: Add fixed multiplier to scroll events in surface units
The expected configurability is not going to arrive yet from compositors, and
it is precipitate for GTK to gain any configurability. We do know a factor of 1
feels way too slow, and we do know a factor of page_size * pow (2 / 3) feels way
way too fast.

With the previous multiplier, gtk4-demo at its default size had a vertical textview
factor of 64.332901, and maximized on a 1920x1080 screen a factor of 97.585365.
Pick a magic multiplier that is both significantly below these values and above 1,
and stick to it.

Future work will add the configurability of smooth scroll events where it belongs.
At that point this commit may be reverted so we don't pile up on magic numbers again.

Related: https://gitlab.gnome.org/GNOME/gtk/-/issues/4793
2022-08-07 17:16:14 +02:00
Carlos Garnacho
adba0b972e gtkwindow: Synthesize pointer crossing events on state changes
When widgets go mapped/unmapped, we repick but don't generate crossing
events. Since there could be stateful controllers that use those in
the previously picked widget (e.g. GtkEventControllerMotion), skipping
those breaks their state.

Ensure to send the relevant crossing events on every situation that
changes the pointer focus, so these controllers get a fair opportunity
to undo their state.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2877
2022-08-05 19:25:13 +02:00
Carlos Garnacho
8eda182f24 gtkeventcontroller: Fix internal enum documentation
Copy and paste typo.
2022-08-05 19:25:13 +02:00
Carlos Garnacho
15e0c175a3 gtkgesturerotate: Filter touchpad holds events
Since the pinch touchpad gestures already have begin/update/end phases,
this gesture has no actual use for these events.
2022-08-05 19:25:13 +02:00
Carlos Garnacho
bc953eebdd gtkgesturerotate: Filter touchpad holds events
Since the pinch touchpad gestures already have begin/update/end phases,
this gesture has no actual use for these events.
2022-08-05 19:25:13 +02:00
Carlos Garnacho
6238f97cb6 gdkevent: Give touchpad hold events a sequence
Following what was done for pinch/swipe events, give hold gestures their
own distinct sequence as well. Without this it was NULL, which was already
distinct to other touchpad gestures.
2022-08-05 19:25:13 +02:00
Carlos Garnacho
023924bca9 gtkgesture: Do not coalesce hold events with other touchpad gestures
This delaying of the cancel event was made to avoid intermediate cancellation
for >=2fg hold gestures followed by pinch/swipe gestures, and it worked as
long as everything was considered to have the same sequence.

Since each pinch/swipe pointer gesture now gets its own sequence, this no
longer applies, nor works. This results in zoom/rotate/swipe gestures being
stuck since the sequence for the touchpad events changes mid-gesture.

Sticking to this pattern of giving touchpad gestures their own sequence,
these hold events cannot be assumed to coalesce with other touchpad gestures,
it is better to let it propagate altogether so that both the hold gesture
and the incoming gesture trigger coherent begin and end/cancel phases.

In the worst case, this results in "::begin, ::cancel, ::begin , ..." before
triggering a touchpad gesture, but the extra begin/cancel ought to be a safe
no-op in widgets.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5003
2022-08-05 19:25:13 +02:00
Emmanuele Bassi
d030c92d63 Move private function out of the AT-SPI a11y backend
The textbuffer test is calling into a function defined by the AT-SPI
accessibility backend. As of commit 4ddf1b70 we only build and run the
test on Linux, but the function in question isn't really
accessibility-related: it's just a serialization function.
2022-08-04 23:34:41 +01:00
Matthias Clasen
f7b3a214f3 Merge branch 'mount_operation' into 'main'
mountoperation: Fix authentication dialog

Closes #5059 and #5058

See merge request GNOME/gtk!4899
2022-08-03 11:56:25 +00:00
Matthias Clasen
a48942bf39 Merge branch 'label-tabs' into 'main'
Label tabs

See merge request GNOME/gtk!4914
2022-08-02 00:18:44 +00:00
Benjamin Otte
dbab69c453 snapshot: Don't critical on dispose
When there's remaining state that draws nothing, it returns no
rendernode. So do a NULL-check before unreffing it.
2022-08-01 20:28:46 +00:00
Benjamin Otte
09f0c96b9b Fix g_object_new(GTK_TYPE_SNAPSHOT)
GJS apparent likes g_object_new() over actual constructors, so make that work.
2022-08-01 20:08:58 +00:00
Matthias Clasen
641a589734 Add GtkLabel:tabs
This adds more powerful formatting capabilities to GtkLabel
without costing us much, since Pango already supports tabs.
2022-08-01 08:20:05 -04:00
Christian Hergert
d00d1334ce gtkbuilder: update gtk_builder_expose_object() docs 2022-07-31 21:37:20 -07:00
Christian Hergert
fbe124ca54 gtkbuilder: update gtk_builder_extend_with_templat() docs 2022-07-31 21:25:58 -07:00
Christian Hergert
f680b86130 gtkbuilder: check for existing object before extending template
If gtk_builder_expose_object() is called twice with the same name, it will
result in a g_critical(). This improves that situation by checking for the
object before exposing additional times.

This turns out to be handy in situations where templates are expanded
multiple times, such as application-side implementations of UI merging.
2022-07-31 21:25:58 -07:00
David Demelier
06bec5fb45 gtk: Missing end of code block 2022-07-26 14:52:30 +00:00
Corey Berla
a7bbc25851 listview: Fix selection for last item in get_items_in_rect
Make the last item dependent on y + height
2022-07-25 17:55:26 -07:00
Corey Berla
d6fab1408a listview: Allow starting rubberband in empty space below last row
Rubberband does not work when initiated past the last row
(warning is printed "Could not start rubberbanding: No item).

Clamp y at the max height of the widgets in the listview
2022-07-25 17:55:15 -07:00
Corey Berla
e14b84ff67 listview: Return an empty bitset when selecting only empty space
Return an empty bitset if the user selects exclusively below the last
row.
2022-07-25 17:54:44 -07:00
Corey Berla
aba2d994e6 gridview: Fix typo in docstring for gtk_grid_view_get_cell_at_y() 2022-07-25 17:54:44 -07:00
Corey Berla
57c032e6cc listbase: Clear selection if rubberband selected an empty set
If rubberband returns an empty bitset the selection should be cleared
unless the shift or ctrl key is held
2022-07-25 17:54:44 -07:00
Corey Berla
f3fc8f5b35 gridview: Return an empty bitset when selecting only empty space
Return an empty bitset if the user selects exclusively below the last
row.  No need to calculate selection.
2022-07-25 17:54:44 -07:00
Corey Berla
ba909cf901 gridview: Fix get_items_in_rect() selection
last_row should be dependent on y + height, not y
2022-07-25 17:54:44 -07:00
Corey Berla
1e9a36ffa8 gridview: Allow starting rubberband in empty space below last row
Rubberband does not work when initiated past the last row
(warning is printed "Could not start rubberbanding: No item).

Clamp y at the max height of the widgets in the gridview

Fixes: #3462
2022-07-25 17:54:35 -07:00
Corey Berla
c6f357e447 gridview: Limit rectangle to gridview columns
The function gtk_grid_view_get_items_in_rect() erroneously calculates
columns less than 0 and greater than n_columns when the user attempts
to rubberband all the way to the left or right respectively.  This
causes the rubberband to persistent and creates unexpected behavior.
Limit the rows to a minimum of 0 and maximum of n_columns - 1.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3445
2022-07-25 17:27:24 -07:00
Corey Berla
2bcae546b3 gridview: Move gtk_grid_view_computer_total_height() up for reuse 2022-07-25 17:27:24 -07:00
Philip Withnall
87ba99f66b gtkwidget: Fix a small typo in a docs comment
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-07-25 23:15:58 +02:00