Commit Graph

36063 Commits

Author SHA1 Message Date
Benjamin Otte
795d3122cc selectionmodels: Add set_model() support
Now that we don't care about item types anymore, we can make the child
models settable.

We try to retain the selection, even when the model changes.
2020-07-05 02:59:21 +02:00
Benjamin Otte
5080730728 listmodels: Stop respecting item-type
Simplify all view model APIs and always return G_TYPE_OBJECT as the
item-type for every model.

It turns out nobody uses item-type anyway.

So instead of adding lots of APIs, forcing people to think about it and
trying to figure out how to handle filter or map models that modify item
types, just having an easy life is a better approach.

All the models need to be able to deal with any type of object going
through anyway.
2020-07-05 02:59:21 +02:00
Benjamin Otte
f75a3a0e95 stringlist: Take a const char const * argument
Sucks that we need to cast a char**, but otherwise we need to cast
{"foo", "bar", "baz" } arrays.
2020-07-05 02:34:42 +02:00
Benjamin Otte
b75db7d1c6 stringfilter: Don't crash if the expression returns "" 2020-07-05 00:34:21 +02:00
Benjamin Otte
b03069bdf6 a11y: Remove double initialization of variables 2020-07-05 00:34:21 +02:00
Matthias Clasen
9332d0dcc8 Merge branch 'typo' into 'master'
Fixes typos

See merge request GNOME/gtk!2188
2020-07-04 15:48:29 +00:00
Matthias Clasen
69975627e9 filechooser: Make filtering work again
One too many lines were dropped when this filter combo
was converted to a dropdown. Bring it back, to make
filtering work again.
2020-07-04 10:28:10 -04:00
Jordi Mas
599b807726 Fixes typos 2020-07-04 10:00:25 +02:00
Matthias Clasen
c2da2f7ecd selectionfilter: Fix bugs in signal translation
When the position is 0, we can't check for unchanged
elements below with gtk_bitset_size_in_range. And
we don't need to, either.

And be careful when translating [start,length]
intervals to [first,last] ones. Off-by-one errors
lurk everywhere.
2020-07-03 11:12:55 -04:00
Matthias Clasen
f01d695e6c Merge branch 'matthiasc/for-master' into 'master'
inspector: Fix the monitor list width

Closes #2909

See merge request GNOME/gtk!2185
2020-07-03 05:51:29 +00:00
Matthias Clasen
619b2465c1 inspector: Fix the monitor list width
Fixes #2909
2020-07-03 01:07:13 -04:00
Matthias Clasen
cc18191a8e Merge branch 'wip/exalm/show-title-buttons' into 'master'
headerbar: Show title buttons by default

See merge request GNOME/gtk!2175
2020-07-03 05:05:24 +00:00
Matthias Clasen
76533513c2 Add a selection filter model
This model presents the selection of a GtkSelectionModel
as its own list model.
2020-07-02 22:59:03 -04:00
Matthias Clasen
0d3988365b filterlistmodel: Make model not construct-only
This property wasn't meant to be construct-only.
2020-07-02 22:59:03 -04:00
Benjamin Otte
0966636803 bitset: Add APIs needed for a filterlistmodel 2020-07-02 17:19:16 -04:00
Alexander Mikhaylenko
7c3b30036e headerbar: Show title buttons by default
Most of the time show-title-buttons is set to TRUE. Go ahead and make that
the default.
2020-07-02 23:51:16 +05:00
Matthias Clasen
988901294d Merge branch 'matthiasc/for-master' into 'master'
Add gtk_multi_selection_get_model

See merge request GNOME/gtk!2179
2020-07-01 01:36:47 +00:00
Matthias Clasen
43b9fc6981 Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

See merge request GNOME/gtk!2162
2020-07-01 01:35:56 +00:00
Benjamin Otte
25f670faae Merge branch 'wip/chergert/gtk4-remove-textlayout-vtable' into 'master'
textlayout: remove virtual table indirection

See merge request GNOME/gtk!2178
2020-07-01 01:19:12 +00:00
Matthias Clasen
d0068a036f Add gtk_multi_selection_get_model
This getter was missing.
2020-06-30 20:47:03 -04:00
Christian Hergert
fae014eb45 textlayout: remove virtual table indirection
GtkTextLayout is private now and therefore we can drop all of
the indirection through the class vtable. Instead, just call the
implementations directly and remove the unused vtable entries
for default signal handlers.
2020-06-30 17:38:31 -07:00
Matthias Clasen
f0ea0be15d Merge branch 'matthiasc/for-master' into 'master'
Drop unnecessary uses of gtk_style_context_add_class

See merge request GNOME/gtk!2177
2020-06-30 22:52:18 +00:00
Matthias Clasen
c0e2d7c62f Drop unnecessary uses of gtk_style_context_add_class
We can use gtk_widget_add_css_class instead, most places.
2020-06-30 17:42:30 -04:00
Matthias Clasen
cc072eb7cd inspector: Avoid a use of gtk_style_context_add_class
We have gtk_widget_add_css_class for this now.
2020-06-30 17:10:05 -04:00
Matthias Clasen
613213f597 inspector: proper list model support
Add a data tab for list models that allows exploring
the objects in the model.
2020-06-30 17:09:55 -04:00
Matthias Clasen
52666d6fe5 inspector: Rename DataList -> TreeData
Rename the DataList object to TreeData, in preparation
for adding a ListData object for list models. While
we are touching it, modernize it a bit (drop the Private
struct, use a layout manager, etc).
2020-06-30 15:18:37 -04:00
Matthias Clasen
bbb28196e5 inspector: Remove list model support from the property editor
This makes the inspector lock up when used with any production
size list model, and blocks access to properties of the model
itself. Instead, we'll make the model available as an object
and add a data tab for list model contents, like we already
do for tree models.
2020-06-30 14:22:01 -04:00
Emmanuele Bassi
f2853ffa8e Add nullable annotations for gtk_cclosure_expression_new()
Fixes: #2904
2020-06-30 12:11:21 +01:00
Matthias Clasen
fca2ba963d gtklistitemfactory: Cosmetic documentation fixes 2020-06-29 22:11:44 -04:00
Matthias Clasen
806779769e builderlistitemfactory: Documentation fixes 2020-06-29 22:11:36 -04:00
Matthias Clasen
82aa0d1f7c expression: Add to the docs
Add some more long-form explanation of what expressions
are about and where they are used.
2020-06-29 22:10:34 -04:00
Matthias Clasen
72f1d34eca Drop GtkFunctionsListItemFactory
It has been superseded by GtkSignalsListItemFactory.
2020-06-29 22:10:34 -04:00
Matthias Clasen
c267a75eef Stop using GtkFunctionsListItemFactory
This was an early attempt at a factory, and has been
superseded by GtkSignalsListItemFactory. Port all users
the the newer one.
2020-06-29 22:10:34 -04:00
Jehan
7ccf32db57 gtk: focus out the GtkIMContextWayland upon finalization.
In particular, it will NULL-ified the current global context if this is
the finalized one, avoiding dangling invalid pointers.

Would have been a cherry-pick from branch gtk-3-24 of commit
b592ded80a, but files moved.
2020-06-29 22:17:08 +02:00
Matthias Clasen
b77110c35a bitset: Fix documentation syntax 2020-06-28 22:38:23 -04:00
Matthias Clasen
c8b57154cb bitset: Correct preconditions in gtk_bitset_add_rectangle
We want to make sure that the rectangle fits in the grid.
2020-06-28 22:38:22 -04:00
Matthias Clasen
c4b2112f16 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #2743

See merge request GNOME/gtk!2161
2020-06-28 23:47:09 +00:00
Matthias Clasen
6a6146a9e0 bitset: Fix the right-shift implementation
This was not doing the right thing at all.

This commit also adds tests for left- and
right-shift.
2020-06-28 16:37:30 -04:00
Matthias Clasen
5229069101 widget: Avoid uninitialized access
Initialize all field in the GtkCrossingData struct
when synthesizing crossing events.

Fixes: #2743
2020-06-28 13:42:02 -04:00
Matthias Clasen
a6752bd3e0 gtk: Better help for GTK_DEBUG
Reuse the newly introduced gdk_parse_debug_var for
GTK_DEBUG.
2020-06-28 13:42:02 -04:00
Matthias Clasen
30eca5a523 Drop GTK_DEBUG_SHORTCUTS
It is unused.
2020-06-28 13:42:02 -04:00
Matthias Clasen
4fa71fd82a shortcuts: Use GTK_DEBUG_KEYBINDINGS
There was just a single message under GTK_DEBUG_SHORTCUTS.
Consolidate with GTK_DEBUG_KEYBINDINGS.
2020-06-28 13:42:02 -04:00
Matthias Clasen
5d9bcfb64a stringlist: Cosmetic documentation fix 2020-06-28 12:43:16 -04:00
Matthias Clasen
334f95479b sorter: Some doc corrections
The docs were referring to some non-existing enum value.
Fix things up to match the current code.
2020-06-28 12:43:11 -04:00
Matthias Clasen
9dff4d6ff3 stack: Remove nonexisting api from headers
The homogeneous property was dropped a while ago.
2020-06-28 12:43:11 -04:00
Matthias Clasen
7c98af6358 stack: Cosmetic documentation fixes
Fix parameter mismatches.
2020-06-28 12:23:52 -04:00
Matthias Clasen
ddcba4d33f bitset: Cosmetic documentation changes 2020-06-28 12:23:52 -04:00
Emmanuele Bassi
24d6a190af Add pre-condition check on nullable argument
Even if `gtk_expression_watch()` will do the same, we're calling public
API, so we should perform a check at the point of use, to ensure that
warnings are easily debuggable.
2020-06-28 13:42:03 +01:00
Emmanuele Bassi
6a4b5ead86 Annotate nullable argument
The `this_` argument is passed to `gtk_expression_watch()`, which
accepts it as nullable.

Fixes: #2900
2020-06-28 13:41:54 +01:00
Matthias Clasen
8a269de89a multiselection: Update docs
Remove information that is no longer true. GtkMultiSelection
is persistent across sorting changes since 3d8b6f6b79.
2020-06-27 21:40:26 -04:00
Matthias Clasen
65902367c6 builder: Documentation tweaks
Don't use no-longer-existing enums as examples,
and drop the +.
2020-06-27 17:28:15 -04:00
Matthias Clasen
4fb495d0fe builder: Warn about dropped objects
Use GTK_DEBUG=builder-objects to make GtkBuilder warn
if a named object from a ui files doesn't get claimed
by gtk_builder_get_object(). This is useful for finding
dead wood in .ui files.
2020-06-27 09:47:00 -04:00
Timm Bäder
83543423e2 widget: Don't get the frame clock if we don't use it 2020-06-27 11:47:42 +02:00
Timm Bäder
d0bb72a2aa label: Only care about clipboard in unrealize of we need to 2020-06-27 11:47:39 +02:00
Timm Bäder
8cc2a44268 recorder: Don't select new row when adding recording
This is what makes the recorder slow. We might want to scroll down in
the list though.
2020-06-27 11:30:02 +02:00
Timm Bäder
2534310ce9 recorder: Remove frame time from recording rows
We should bring this back in a different way, e.g. in a way that doesn't
just use the time of the previous recording.
2020-06-27 11:15:51 +02:00
Timm Bäder
3a4fbc5e50 recorder: Remove Full/Partial render distinction
It doesn't exist anymore these days
2020-06-27 11:08:09 +02:00
Timm Bäder
89a67ac719 recorder: s/gint/int/g 2020-06-27 11:04:03 +02:00
Timm Bäder
21b84b1890 recorder: Remove some debug spew
Stop printing the number of nodes we have
2020-06-27 11:01:28 +02:00
Timm Bäder
20935f678b scale: Rearrange child widgets
Always keep the order:

 - [value]
 - [marks.top]
 - [marks.bottom]
 - trough

Which makes sense given the rendering order. Slider should be drawn
after the marks.

Makes it possible to simply remove the custom snapshot implementations
in scale and range. And Adwaita does not depend on the node order
anyway.
2020-06-27 10:51:06 +02:00
Timm Bäder
c41b4130c6 textview: Remove unused define 2020-06-27 10:51:06 +02:00
Timm Bäder
f1b010af66 Add .view to view widgets 2020-06-27 10:51:06 +02:00
Timm Bäder
ec1133d6e1 renderbackground: Only query number of layers once
We did it once in snapshot_background and then again in snapshot_color.
2020-06-27 10:51:06 +02:00
Timm Bäder
8fcf1b78a4 renderbackground: Only query h/vrepeat if we need to 2020-06-27 10:51:06 +02:00
Matthias Clasen
3a70ca9d03 listitem: Correct the docs 2020-06-26 23:10:21 -04:00
Matthias Clasen
0d10982379 text: Support reverse selection
Take ordering of cursor_position and selection_bound
into account when copying text to the clipboard, and
ensure that both orders work the same.

Fixes: #2898
2020-06-26 22:22:47 -04:00
Matthias Clasen
c20a966f06 text: Update action enabled state correctly
Take the editable property into account when updating
the emoji.insert action state, and update the action
when it changes.

Fixes: #2897
2020-06-26 22:13:12 -04:00
Matthias Clasen
64db05d3dd shortcutcontroller: Add some debug spew
This helps in debugging event routing and keyboard
shortcut issues.
2020-06-26 22:12:42 -04:00
Matthias Clasen
913cd91df0 widget: Fix an oversight
g_message comes with a builtin newline, don't add one
to the message.
2020-06-26 22:12:14 -04:00
Matthias Clasen
cfdc81af02 Adwaita: Fix block cursors in spinbuttons
Fix block cursors in vertical spinbuttons with Adwaita.

Fixes: #2871
2020-06-26 19:56:10 -04:00
Matthias Clasen
fd2861d683 docs: Add css docs to entries
The various entries were missing the semi-standard
"CSS Nodes" section in their long descriptions. Add
them.
2020-06-26 16:13:02 -04:00
Matthias Clasen
cd9f5733b3 text: Be more selective when selecting on focus-in
We don't want to select on focus-in when the focus
comes from a child. The case where this does harm
is when you activate copy or paste actions from the
context menu. We close the menu before triggering the
action, and if that causes the text in the entry to
be selected, unexpected things happen, since the action
applies to the current selection.

Fixes: #2869
2020-06-26 15:49:39 -04:00
Matthias Clasen
8b4560cbfb Revert "text: Avoid creating a PangoAttrList we don't need"
This reverts commit 67c2665028.

The splicing we do here has the important side-effect
of shifting the preedit attributes to the right position.
Without it, we end up always underlining the first chars
in the entry, regardless where the preedit happens.
2020-06-26 15:27:17 -04:00
Matthias Clasen
2d914d52be text: Handle key events in the target phase
This makes sure that we do actual key input right
in the middle between all the capture and bubble
event controllers, and are not dependent on the
ordering of those controllers.

The bug that triggered this change was that the
shortcut for activation (Enter) was getting triggered
before the key input, causing Ctrl-Shift-u hex
to stop working, since it never received the enter
to commit the sequence.
2020-06-26 14:08:35 -04:00
Matthias Clasen
a26865e741 widget: Add a debug message for consumed key events
Run the application with GTK_DEBUG=keybindings to
get some hints where key events get lost.
2020-06-26 14:08:14 -04:00
Matthias Clasen
3558beaa61 text: Give names to event controllers
It helps with debugging.
2020-06-26 14:08:11 -04:00
Carlos Garnacho
0ce4f66976 gtktext: Don't accept (twice!) all press actions
The gesture should claim the sequence after triggering uncancellable
actions, like pasting, showing a menu or selecting words/lines. A
single first button press initiating a drag does not trigger
anything yet, so it should avoid claiming the sequence.
2020-06-26 17:48:10 +02:00
Carlos Garnacho
b81bbde7c8 gtkswitch: Don't be eager in accepting the gesture
The gesture should be accepted whenever it triggers uncancellable
actions in the widget. This means it should be accepted if the
click does result in toggling the switch.

This leaves the pan gesture room to handle dragging the handle.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2895
2020-06-26 17:48:10 +02:00
Matthias Clasen
3f55bfe2cb Merge branch 'matthiasc/for-master' into 'master'
main: Avoid a warning

Closes #2894

See merge request GNOME/gtk!2153
2020-06-26 14:31:20 +00:00
Matthias Clasen
e04191a5ea Merge branch 'wip/otte/bitset' into 'master'
Improve selection handling API for rubberbanding

See merge request GNOME/gtk!2086
2020-06-26 12:43:49 +00:00
Matthias Clasen
f07d304f19 main: Avoid a warning
transient-for relationships only exist between
windows, so check that both candidates are such.

Fixes: #2894
2020-06-26 08:19:32 -04:00
Emmanuele Bassi
1d1f618a13 Merge branch 'tintou/dropdown-annotations' into 'master'
dropdown: Annotate the get_selected_item method

See merge request GNOME/gtk!2152
2020-06-26 08:48:51 +00:00
Corentin Noël
721396b6d6 dropdown: Annotate the get_selected_item method
We need to specify the type as we already know that it is at least a GObject and in case of no selection, NULL is returned.
2020-06-26 10:00:59 +02:00
Benjamin Otte
dc1dbe6158 listbase: Make rubberbanding a threshold drag 2020-06-26 07:13:32 +02:00
Benjamin Otte
30488e60e2 listbase: Only compute the modifiers when releasing the rubberband
... and do the right things:

nothing:    selection = rubberband
ctrl:       selection = selection OR rubberband
shift:      selection = selection AND (NOT rubberband)
ctrl+shift: selection = selection XOR rubberband
            (not sure this one makes sense, but toggling is fun)
2020-06-26 07:13:32 +02:00
Benjamin Otte
a5949960bc listbase: Compute rubberband region on-demand
Instead of storing the active items as we go, compute the affected items
whenever the rubberband changes and in particular when the rubberband
ends.
That way, the rubberband is guaranteed to select a rectangle even
after scrolling very far.

This is achieved by having a get_items_in_rect() vfunc that selects all
the items in the rubberbanded rectangle and returns them as a bitset.
2020-06-26 07:13:32 +02:00
Benjamin Otte
ec4a489093 listview: Allocate rubberband at end of size_allocate()
Otherwise the rubberband uses the wrong scroll offsets.
2020-06-26 07:13:32 +02:00
Benjamin Otte
7c52e03815 listbase: Flip autoscroll deltas if adjustments are flipped
Fixes autoscroll on RTL languages.
2020-06-26 07:13:32 +02:00
Benjamin Otte
724c9361f3 listbase: Allocate gridview items properly on RTL
We need to flip the items.
2020-06-26 07:13:32 +02:00
Benjamin Otte
147388e69a multiselection: Implement get_selection_in_range() 2020-06-26 07:13:32 +02:00
Benjamin Otte
64aa281c97 listbase: Allocate rubberband according to list coords
The rubberband is now handled on the list coordinate system.

When starting the rubberband, we track the item under the pointer and
follow it when it is moving.
This may lead to the rubberband start position changing position and
while this may be confusing, it alerts users to the fact that something
crazy is going on.
2020-06-26 07:13:32 +02:00
Benjamin Otte
c2b0330c56 listbase: Move a common function from the children into GtkListBase
We want to use it for the rubberband later.
2020-06-26 07:13:32 +02:00
Benjamin Otte
de4803bb21 listbase: Don't do extra work
Scrolling causes a queue_resize() which will update the rubberband in
size_allocate() and queue a draw.
2020-06-26 07:13:32 +02:00
Benjamin Otte
e574dcb091 Fix indentation 2020-06-26 07:13:32 +02:00
Benjamin Otte
488b0cbb69 gtk: Remove GtkPropertySelection
GtkMultiSelection is so much faster than this that it isn't needed.
2020-06-26 07:13:32 +02:00
Benjamin Otte
3d8b6f6b79 multiselection: Track items across resorts
In particular, track which items remain in ::items-changed
signal emissions.

But the main use case is sorting, which causes items-changed(0, n, n)
to be emitted.
2020-06-26 07:13:32 +02:00
Benjamin Otte
58d3213eef Remove GtkSet
It's been superceded by GtkBitset.
2020-06-26 07:13:32 +02:00
Benjamin Otte
006dfdc55a selectionmodel: Remove select_callback() functions
gtk_selection_model_set_selection() takes care of those now.
2020-06-26 07:13:32 +02:00
Benjamin Otte
a38c423ddb listbase: Port rubberband to gtk_selection_model_set_selection() 2020-06-26 07:13:32 +02:00
Benjamin Otte
fa0295629b selectionmodel: Add gtk_selection_model_set_selection()
Also port the testsuite.
2020-06-26 07:13:32 +02:00