Commit Graph

64791 Commits

Author SHA1 Message Date
Benjamin Otte
081afc0477 sortlistmodel: Track item positions
The model now tracks the original positions on top of just the items so that
it can remove items in an items-changed emission.

It now takes twice as much memory but removes items much faster.

Benchmarks:

Removing 50% of a model:
                   before    after
   250,000 items    135ms     10ms
   500,000 items    300ms     25ms

Removing 1 item:
     4,000 items    2.2ms      0ms
     8,000 items    4.6ms      0ms
   500,000 items      ---   0.01ms
2020-07-22 14:04:40 +02:00
Benjamin Otte
e807fc3be0 sortlistmodel: Replace with an array-based model
This is the dumbest possible sortmodel using an array:
Just grab all the items, put them in the array, qsort() the array.

Some benchmarks (setting a new model):

  125,000 items - old: 549ms
                  new: 115ms
  250,000 items - new: 250ms

This performance can not be kept for simple additions and removals
though.
2020-07-22 14:04:40 +02:00
Benjamin Otte
b67ffe9650 sortlistmodel: Test that the model is stable
Stability is measured relative to the child model, not relative to the
previous sorter.
2020-07-20 22:28:01 +02:00
Benjamin Otte
2c519b006d testsuite: Fix a leak 2020-07-20 22:28:01 +02:00
Matthias Clasen
852429d163 Merge branch 'barthalion/asan-runner' into 'master'
ci: Switch ASAN tests to runners tagged so

See merge request GNOME/gtk!2267
2020-07-20 16:17:49 +00:00
Matthias Clasen
ee9c6bbf75 Merge branch 'action-muxer-speedup' into 'master'
Action muxer speedup

See merge request GNOME/gtk!1754
2020-07-20 16:17:17 +00:00
Bartłomiej Piotrowski
d9ece94377 ci: Switch ASAN tests to runners tagged so 2020-07-20 16:41:46 +02:00
Matthias Clasen
486fbce42b actionmuxer: Update docs and clean up headers
Update the doc comment at the top to describe the
current  functionality of GtkActionMuxer.
2020-07-20 08:24:54 -04:00
Matthias Clasen
ed92026632 actionmuxer: Use an array for accels
We have a lot of accels across all the muxers, but the vast
majority has just one or two, so an array is going to be
smaller and faster for this.
2020-07-20 08:24:54 -04:00
Matthias Clasen
05e614feb7 actionmuxer: Create observed_actions and groups on demand
The vast majority of action muxers don't have observers or
groups, so we can avoid the overhead of carrying all these
empty hash tables.
2020-07-20 08:24:54 -04:00
Matthias Clasen
14059afdf1 inspector: Make the actions tab work again
Bring back the actions tab; we don't receive
changes anymore, since GtkActionMuxer lost
the GActionGroup signals for this, and the
action observer machinery has no way to listen
for all changes.
2020-07-20 08:24:54 -04:00
Matthias Clasen
9b294eb94e Add gtk_action_muxer_list_actions
This is needed to reinstate the actions support
in the inspector.
2020-07-20 08:24:53 -04:00
Matthias Clasen
96d42cf1cc actionmuxer: Stop implementing GActionGroup
Instead of implementing the GActionGroup interface
and using its signals for propagating changes up
and down the muxer hierarchy, use the GtkActionObserver
mechanism. This cuts down on the signal emission
overhead.
2020-07-20 08:24:53 -04:00
Matthias Clasen
4786a16696 actionmuxer: Port internal users
Port all internal users of the action muxer
from the GActionGroup interface to the new
action muxer apis.
2020-07-20 08:24:52 -04:00
Matthias Clasen
14bb12125f actionmuxer: Add some more api
We want to drop the GActionGroup interface from
GtkActionMuxer, so add the necessary api directly
to GtkActionMuxer itself.
2020-07-20 08:24:14 -04:00
Matthias Clasen
07e8dafcea inspector: Remove action support temporarily
This is using the action muxer as a GActionGroup,
and we want to remove that interface from GtkActionMuxer.

The support will come back later.
2020-07-20 08:24:14 -04:00
Matthias Clasen
ab67a81f11 Speed up action muxer setup more
Don't emit signals for group insertion/removal
if nobody is listening.
2020-07-20 08:24:14 -04:00
Matthias Clasen
aa76f7e210 Speed up action muxer setup
We don't need to duplicate all these action names and
emit all these signals if nobody is listening.
2020-07-20 08:24:14 -04:00
Matthias Clasen
0c15463e41 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2266
2020-07-20 12:23:12 +00:00
Matthias Clasen
5df1356295 gsk: Remove an unused debug flag
GSK_DEBUG_DIFF was not used anywhere, so remove it.
2020-07-20 07:03:08 -04:00
Matthias Clasen
95fc81c565 inspector: Add a few more debug flags
Add check buttons for GTK_DEBUG=constraints and
GTK_DEBUG=layout in the logs page.
2020-07-20 07:03:08 -04:00
Matthias Clasen
378e594f75 Tweak the GTK_DEBUG=help output
I got the layout flag wrong when I added the
improved help output. It is about layout managers,
not about showing layout borders.
2020-07-20 07:03:08 -04:00
Matthias Clasen
86c7fceb09 Merge branch 'list-model-docs' into 'master'
List model docs

See merge request GNOME/gtk!2182
2020-07-19 23:50:09 +00:00
Matthias Clasen
b5e20a3e37 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2265
2020-07-19 19:14:04 +00:00
Matthias Clasen
75a30b1f98 windowhandle: Don't use an action muxer needlessly
The api that is meant to be used here is
gtk_widget_activate_action.
2020-07-19 13:50:23 -04:00
Matthias Clasen
c64a021af4 NEWS: Updates 2020-07-18 18:28:51 -04:00
Matthias Clasen
9b64635925 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2264
2020-07-18 17:31:31 +00:00
Matthias Clasen
7b76be5360 button: Add explicit key bindings for activation
We should not rely on GtkWindow to have global
"activate-default" key bindings that happen to
fall back to activating the focus widget. This is
unreliable, since the bubbling up from the button
to the toplevel may run across other widgets that
may want to use Enter for their own purpose, and
then the button loses out. By adding our own
key bindings, the button gets to handle it before
its ancestors.

This fixes check buttons in the inspector property
list not reacting to Enter despite having focus.
2020-07-18 12:53:10 -04:00
Matthias Clasen
2e2336ffce text: Claim clicks when grabbing focus
If we don't, an ancestor (such a GtkListItemWidget)
may interpret the click as "I should grab focus!",
and still our focus away. This was causing hard-to-focus
entries in the property list in the inspector.
2020-07-18 12:47:47 -04:00
Matthias Clasen
76d80ef516 inspector: Add focus handling to the property editor
We want to focus the actual control here.
2020-07-18 11:55:19 -04:00
Matthias Clasen
287d80bd36 editablelabel: Stop editing on focus-out
This is the expected behavior for the main use case,
treeview-like 'edit one cell at a time'.
2020-07-18 10:45:27 -04:00
Matthias Clasen
77072b3eaa fixup editing style class 2020-07-18 10:10:28 -04:00
Matthias Clasen
c7833bb090 editablelabel: Document css nodes
Just the usual.
2020-07-18 09:55:46 -04:00
Matthias Clasen
899024cef7 editablelabel: Add a style class while editing
Add the .editing style class to the editable label
while it is editing. The idea is that themes can
show a frame around the entry.
2020-07-18 09:54:55 -04:00
Rico Tzschichholz
4da3edd42e Merge branch 'wip/ricotz/annotations' into 'master'
gtk: Improve g-i annotations for methods of GtkExpression subclasses

See merge request GNOME/gtk!2263
2020-07-18 11:06:47 +00:00
Rico Tzschichholz
6b59626817 gtk: Improve g-i annotations for methods of GtkExpression subclasses 2020-07-18 12:30:05 +02:00
Matthias Clasen
7c02ae00c2 inspector: Clean up GtkInspectorGeneral
Drop the Private struct.
2020-07-18 00:31:04 -04:00
Matthias Clasen
80e29a3627 inspector: Clean up GtkInspectorMiscInfo
Drop the Private struct.
2020-07-18 00:25:46 -04:00
Matthias Clasen
26163a4f30 inspector: Clean up GtkInspectorVisual
Drop the Private struct, and do all cleanup in dispose.
2020-07-18 00:17:42 -04:00
Matthias Clasen
dbd88fc210 inspector: Clean up GtkInspectorActions
Drop the Private struct, dispose properly,
and don't derive from GtkBox.
2020-07-17 23:59:49 -04:00
Matthias Clasen
2de31e4cac inspector: Clean up GtkInspectorActionEditor
Drop the Private struct, dispose properly,
and don't derive from GtkBox.
2020-07-17 23:36:05 -04:00
Matthias Clasen
1bff328895 inspector: Clean up GtkInspectorLogs
Drop the Private struct, dispose properly,
and don't derive from GtkBox.
2020-07-17 23:24:14 -04:00
Matthias Clasen
facf78a5b6 inspector: Allow disposing the inspector
We were hiding the inspector when the window
is closed, but that has the side-effect of
keeping references to application windows,
so we would keep them artificially alive,
which can have side-effects.

So, make the inspector go away when closed.
2020-07-17 23:15:42 -04:00
Matthias Clasen
6b19fcd859 inspector: Properly dispose GtkInspectorWindow 2020-07-17 23:15:25 -04:00
Matthias Clasen
ca784e3e1a inspector: Properly dispose GtkInspectorShortcuts 2020-07-17 23:13:29 -04:00
Matthias Clasen
314c8558d7 inspector: Properly dispose GtkInspectorListData 2020-07-17 23:13:07 -04:00
Matthias Clasen
af30a7fe06 inspector: Dispose tree data properly
Another place where we were leaking children.
2020-07-17 22:54:19 -04:00
Matthias Clasen
9ffd7d1970 inspector: Dispose the recorder properly
We were leaking children here.
2020-07-17 22:54:10 -04:00
Matthias Clasen
cb906c80eb inspector: Drop the recorder Private struct 2020-07-17 22:37:24 -04:00
Matthias Clasen
96ce0eb600 Merge branch 'matthiasc/for-master' into 'master'
gtk-demo: Don't use GtkColorSwatch

See merge request GNOME/gtk!2262
2020-07-18 01:17:43 +00:00