Commit Graph

1135 Commits

Author SHA1 Message Date
Matthias Clasen
5b360a479d tree view: Rename and document element names
The names are now treeview and header.
2015-10-30 17:25:43 -04:00
Jonas Ådahl
aedd193c69 GtkTreeView: Rework the search window hack so it also works on Wayland
The search window of a tree view was implemented by showing without
making it visible by by positioning it outside the screen edge. This is
not possible on Wayland, so implement another method for being able to
enter text into a non-visible entry.

The new method is implemented by, before showing the window, pass the
key event directly to the IM context backing the entry. If the key
event triggered the context to commit new text or change the preedit
content, the search window is shown, and from that point the key events
are forwarded directly to the entry widget.

https://bugzilla.gnome.org/show_bug.cgi?id=756780
2015-10-27 08:41:02 +08:00
Jonas Ådahl
97dbef451e GtkTreeView: Make a search window destroy helper
https://bugzilla.gnome.org/show_bug.cgi?id=756780
2015-10-27 08:41:02 +08:00
Jonas Ådahl
2eb7d7476b GtkTreeView: Use more consistent search window naming
Instead of alternating between search dialog and search window, use
search window everywhere.

https://bugzilla.gnome.org/show_bug.cgi?id=756780
2015-10-27 08:41:02 +08:00
Benjamin Otte
983de6f4a0 treeview: Use a cssnode instead of regions
This makes Treeview headers work again like before region support was
removed.
2015-10-22 16:42:47 +02:00
Benjamin Otte
b65f400d56 treeview: Remove "row" and "col" regions
They aren't used by the theme and we want to get rid of regions.
2015-10-22 16:35:13 +02:00
Matthias Clasen
2dc63dad34 Don't use g_slist_next in gtktreeview.c
We generally use ->next directly.
2015-10-20 06:14:57 -04:00
Alexander Larsson
d5f1754981 gtk: Stop setting GDK_EXPOSURE_MASK on random widgets
These days exposure happens only on the native windows (generally the
toplevel window) and is propagated down recursively. The expose event
is only useful for backwards compat, and in fact, for double buffered
widgets we totally ignore the event (and non-double buffering breaks
on wayland).

So, by not setting the mask we avoid emitting these events and then
later ignoring them.

We still keep it on eventbox, fixed and layout as these are used
in weird ways that want backwards compat.
2015-09-14 11:01:13 +02:00
Benjamin Otte
e1ecdd3ef5 treeview: Donate a priv variable to gtk_tree_view_init() 2015-09-07 14:34:02 +02:00
Matthias Clasen
2da31e53b0 treeview: Convert to g_object_notify_by_pspec
This avoids pspec lookup overhead in g_object_notify.
2015-09-06 17:11:36 -04:00
Christian Hergert
b37400752b treeview: check for pixel cache before setting property
Code exists in the wild that calls this function after the widget has
been destroyed (and the pixel cache released). Simply check that the
pixel cache exists to preserve the existing state.
2015-08-20 11:13:30 -07:00
Benjamin Otte
ceab99ff2f treeview: Don't underallocate editing widgets that are too big 2015-07-21 02:28:53 +02:00
Matthias Clasen
ee43462d74 treeview: Add an explicit return for clarity
I believe that first_column can only ever be NULL here if
last_column is NULL too, in which case we'd exited already.
But coverity doesn't see that, so add an explicit exit.
2015-07-17 18:41:14 -04:00
Cosimo Cecchi
15908cfdf9 treeview: don't call gtk_style_context_set_background() 2015-07-01 16:09:23 -07:00
Christian Hergert
fb06b6e4b8 treeview: always pixelcache widget contents
GtkTreeView has a particularly expensive drawing path. This can cause
issues when part of animated widget sequences. Caching the content while
a model is attached helps reduce the number of full redraws during
exposure greatly.

https://bugzilla.gnome.org/show_bug.cgi?id=751082
2015-06-16 18:08:22 -07:00
Emmanuele Bassi
56faf49b8e docs: Improve deprecation notice for rules-hint property
Specify that the theme is wholly in control.

https://bugzilla.gnome.org/show_bug.cgi?id=750718
2015-06-11 11:45:03 +01:00
Matthias Clasen
121c195521 tree view: Fix compiler warnings
Fix warnings due to -Wdeclaration-after-statement and -Wshadow.
2015-06-02 09:08:16 -04:00
Carlos Garnacho
b666f14ef8 treeview: Avoid usage of gdk_window_get_device_position() during DnD
Just use the last coordinates given on XdndPosition/drag_motion() in
order to trigger scrolling.

When running on Xwayland, the pointer position is unknown at this
stage on the X11 side, so the coordinates given here are bogus.
This change avoids both roundtrips and this situation.

https://bugzilla.gnome.org/show_bug.cgi?id=749679
2015-05-21 18:11:21 +02:00
Matthias Clasen
a89e99b0be tree view: Avoid a crash with rubberbanding
When a treeview is destroyed while rubberbanding is going
on, we crash because the rb tree is nuked before we want
to access it to stop the rubberbanding. To avoid this crash
end the rubberbanding early in destroy().

See
https://bugzilla.redhat.com/show_bug.cgi?id=1173904
2015-04-08 18:54:45 -04:00
Benjamin Otte
93c3b90f6a treeview: Fix copy/paste bug
Introduced in 7eecb16404
2015-02-06 03:13:59 +01:00
Benjamin Otte
7eecb16404 treeview: Don't create an overly large pixel cache
GPUs generally have problems when you create a 35000px wide surface.
Luckily X catches this and sends a BadAlloc. Which GTK immediately
abort()s on.

Testcase included.

https://bugzilla.redhat.com/show_bug.cgi?id=1163579
2015-02-05 18:57:29 +01:00
Matthias Clasen
1aee4f0384 Fix a typo
commit aa1b7fab9c introduced a misuse of G_UNLIKELY in
several places. Fix all those.
2015-01-28 10:08:13 -05:00
Alexander Larsson
a1e4ba0dd4 gtktreeview: Fix horizontal grid lines
The clipping was wrong so it was not drawing grid lines
outside the visible area, which broke due to the pixel cache.
2015-01-27 17:16:03 +00:00
Benjamin Otte
aa1b7fab9c css: Remove _gtk_css_style_property_changes_affect_size()
... and _gtk_css_style_property_changes_affect_font().

Replace it with _gtk_css_style_property_get_mask_affecting().
2015-01-27 05:04:34 +01:00
Matthias Clasen
9431050618 GtkTreeView: Implement get_border
Add an implementation for the new scrollable vfunc that returns
the header height as top border.
2014-12-10 10:01:30 -05:00
Carlos Garnacho
4df13b7262 treeview: remove single-click activation from GtkGestureMultiPress::pressed
This is already handled in GtkGestureMultiPress::release, and more in
concordance with how it was done pre-gestures.

https://bugzilla.gnome.org/show_bug.cgi?id=737891
2014-11-07 13:49:43 +01:00
Benjamin Otte
1741de47db treeview: Apply column-header region always
... so that invisible columns get it, too.

Works around weird effects seen when buttons are animated and columns
get hidden/shown.
2014-09-15 16:35:40 +02:00
Matthias Clasen
e2c54098da tree view: Fix column drag highlight
This is a bandaid fix that makes the origin case work again
by switching RGBA window. The arrow case is still unreliable.

https://bugzilla.gnome.org/show_bug.cgi?id=732916
2014-09-07 22:25:23 -04:00
Carlos Garnacho
bf8f824760 treeview: Run the row dragging gesture on the bubble phase
This is so signal handlers have an opportunity to undo its effect by
returning GDK_EVENT_STOP on ::button-press-event, just like they used
to do pre-gestures.

https://bugzilla.gnome.org/show_bug.cgi?id=735965
2014-09-04 14:59:08 +02:00
Matthias Clasen
a822abd308 GtkTreeView: Don't hardcode black for tree lines
Use the left border color for tree lines. This is similar to
our use of top border color for grid lines. As a side-effect,
tree lines now get recolored when they are in a selected row.

https://bugzilla.gnome.org/show_bug.cgi?id=415415
2014-08-30 02:12:41 -04:00
Benjamin Otte
75ac49c475 Use CHECKED instead of ACTIVE for expanded expanders
https://bugzilla.gnome.org/show_bug.cgi?id=733967
2014-08-27 21:27:20 +02:00
Carlos Garnacho
e6199af60d treeview: Reset multipress controller after 2nd click
The pre-gestures code used to compare the current button press with the
previous one on !activate_on_single_click, and unset the previous event
data so ::row-activated would be emitted every 2 clicks.

So do the same with the multipress gesture and reset it after every 2nd
click to have ::row-activated emitted multiple times while manic clicking.

https://bugzilla.gnome.org/show_bug.cgi?id=735353
2014-08-27 17:12:52 +02:00
Matthias Clasen
d5876e99f5 GtkTreeView: Avoid a crash with empty trees
The gesture code was assuming that the rb tree exists, which
will not be the case if the treeview is empty.

https://bugzilla.gnome.org/show_bug.cgi?id=735300
2014-08-26 00:06:23 -04:00
Carlos Garnacho
91afc0ea4f treeview: Make multipress gesture accept all buttons
That gesture is meant to handle clicks on multiple buttons, so unset
the GDK_BUTTON_PRIMARY default. Also, remove unnecessary boilerplate
with the new GtkGestureSingle/GtkEventController defaults.

https://bugzilla.gnome.org/show_bug.cgi?id=734285
2014-08-15 13:53:40 +02:00
Carlos Garnacho
b56f5cec3e treeview: Check the selected node active flag before maybe starting rubberband
This check used to be present in the pre-gestures code, but was unintentionally
removed when splitting code into drag/multiclick gestures. The policy used to
be that if clicking happened on an already selected node, DnD would happen
instead of rubberband selection, so this behavior is resuscitated.

https://bugzilla.gnome.org/show_bug.cgi?id=734143
2014-08-11 18:09:16 +02:00
Matthias Clasen
9746419cce GtkTreeView: Avoid deprecation warnings 2014-08-03 20:12:48 +02:00
Emmanuele Bassi
0ed766ec86 treeview: Deprecated rules-hint
The rules-hint property has always been a fairly bad application API, as
it set some wrong expectations for the developers; deferring to the
theme makes it impossible to design application reliably, and if this is
a usability setting we should either impose this setting on every theme,
or simply drop it.

Our own default theme does not honour the zebra striping, which makes
this function even more questionable.

In practice, usability studies on zebra striping have demonstrated that
alternating colors on a list it improves readability just as much as
clear ruling between rows, or by visually differentiating the selected
row. Zebra striping improves readability (or, at least, it does not
hinder it) on static displays, like a table on paper or a document; on a
dynamic display, like an application's UI, there are different
strategies that yield similar, if not better, results.

https://bugzilla.gnome.org/show_bug.cgi?id=733312
2014-08-03 02:51:02 +02:00
Carlos Garnacho
0bb955b30e treeview: Add back a check to ignore buttons > 3
The removal was not intentional, and still needed as the GtkGestureMultiPress
will work for any button unless told to lock on a single specific one.
2014-07-22 13:20:13 +02:00
Matthias Clasen
daf05ad987 GtkTreeView: Avoid interference with animation
The animated scrolling interferes with incremental validation.
As short-term solution, disable scrolling animation during
incremental validation. This is not a proper solution, but
it avoids broken behavior like scrollbars that are not reacting
to clicks. The problem was visible, e.g. in the list view
example in gtk3-demo.
2014-07-13 23:04:40 -04:00
Matthias Clasen
332fa9b848 Revert "GtkTreeView: Avoid interference with animation"
This reverts commit faa676ffa7.

It fixed the problematic list view example in gtk3-demo, but
broke all others :-(
2014-07-13 22:54:19 -04:00
Matthias Clasen
faa676ffa7 GtkTreeView: Avoid interference with animation
The animated scrolling interferes with incremental validation.
As short-term solution, disable scrolling animation during
incremental validation. This is not a proper solution, but
it avoids broken behavior like scrollbars that are not reacting
to clicks. The problem was visible, e.g. in the list view
example in gtk3-demo.
2014-07-13 22:00:59 -04:00
Carlos Garnacho
b3ab5088df treeview: remove needless duplicate gtk_widget_set_parent_window() call
This same call happens a few lines above.
2014-07-10 20:44:55 +02:00
Carlos Garnacho
edc5cb4e47 treeview: Add back the Gdk pointer grab during column dragging
The reparenting happening on the column header so it gets a movable
window breaks the implicit grab, so this is one situation were we
want a pointer grab, if just to replace it.

https://bugzilla.gnome.org/show_bug.cgi?id=732933
2014-07-09 21:28:46 -04:00
Carlos Garnacho
5fb9c4441e treeview: Fix horizontal position during column dragging
Code was expecting view coordinates, not widget ones, as we're
only dealing with horizontal displacements, just adding the
horizontal adjustment value suffices.

https://bugzilla.gnome.org/show_bug.cgi?id=732933
2014-07-09 21:28:45 -04:00
Matthias Clasen
ef40f54e31 GtkTreeView: Animate keybindings 2014-07-02 20:58:16 -04:00
Jasper St. Pierre
6926821ae1 treeview: Remove configure-event handler as well 2014-06-26 15:58:44 -04:00
Benjamin Otte
93b3179042 widgetpath: Deprecate regions
This is a foolowup to d80bf0790d
2014-06-21 15:46:44 +02:00
Benjamin Otte
d80bf0790d stylecontext: Deprecate regions
Regions are done in a very non-css way. They don't fit the DOM in that
they don't integrate into the CSS tree and they have very weird matching
behavior in selectors.

So I'm deprecating them now. GtkNotebook and GtkTreeview will continue
to use them and as long as they do, we can't remove the code for it.
But once those are ported it might be safe to remove the code as it will
clean up lots of places in the code by quite a bit.
2014-06-19 22:26:51 +02:00
Matthias Clasen
0056d3a6ad GtkTreeView: Remove a no-longer-valid optimization
The rubberband rendering code was assuming that we just have
a 1-pixel border and the rest of the rubberband is uniform.
That is not a safe assumption to make with css-styled
rubberbands, so remove it.
2014-06-19 13:52:11 -04:00
Carlos Garnacho
3e65655424 treeview: Check that :row-activated is only emitted on GDK_BUTTON_PRIMARY
It turned out not all code was fully prepared to handle multiple buttons,
this avoids respawning https://bugzilla.gnome.org/show_bug.cgi?id=731020.
2014-06-11 23:18:34 +02:00