Commit Graph

1004 Commits

Author SHA1 Message Date
John Lindgren
5e2c232145 treeview: Don't emit cursor-changed in destruction
This is a workaround until we have a good idea on how we want to handle
signal disconnection before/during/after dispose and destroy vfunc
calls.

https://bugzilla.gnome.org/show_bug.cgi?id=671939
2013-03-13 02:06:29 +01:00
Cosimo Cecchi
fd51c8f5e9 treeview: fix a critical warning
gtk_tree_view_column_unset_tree_view() resets column->priv->tree_view to
NULL.
The function is called when a column is removed, but later from the same
function we would call _gtk_tree_view_column_unrealize_button(), which
expects column->priv->tree_view to be != NULL, causing these critical
warnings

Gtk-CRITICAL **: gtk_widget_unregister_window: assertion
`GTK_IS_WIDGET (widget)' failed

This commit moves the call to unset the tree view after the button is
unrealized.

https://bugzilla.gnome.org/show_bug.cgi?id=695473
2013-03-08 20:20:28 -05:00
Cosimo Cecchi
50065b7ba0 treeview: center expander allocated space
This patch centers the expander in the extra space allocated by the
horizontal-separator style property.

https://bugzilla.gnome.org/show_bug.cgi?id=650424
2013-03-01 13:55:05 -05:00
Cosimo Cecchi
d0895d6c0f treeview: properly calculate the treeview expander size
It should be expander-size + horizontal-separator / 2. Rework code
calculating the render position of the arrow to account for the larger
size.

https://bugzilla.gnome.org/show_bug.cgi?id=650424
2013-03-01 13:55:05 -05:00
Cosimo Cecchi
32bd10bf74 treeview: remove extra padding handling
We'll replace this with a proper calculation.

https://bugzilla.gnome.org/show_bug.cgi?id=650424
2013-03-01 13:55:05 -05:00
Alexander Larsson
c6bbfc8e3d Add a few missing gtk_widget_unregister_window calls
This was causing warnings on widget unparent like:

Gdk-CRITICAL **: gdk_window_has_native: assertion `GDK_IS_WINDOW (window)' failed

Becasue the window was not properly removed from the lists on unrealize.
2013-02-18 09:35:58 +01:00
Alexander Larsson
3d4cd4db3e Add gtk_widget_(un)register_window
This replaces the previously hardcoded calls to gdk_window_set_user_data,
and also lets us track which windows are a part of a widget. Old code
should continue working as is, but new features that require the
windows may not work perfectly.

We need this for the transparent widget support to work, as we need
to specially mark the windows of child widgets.

https://bugzilla.gnome.org/show_bug.cgi?id=687842
2013-02-07 11:11:37 +01:00
Matthias Clasen
5f41eb74a5 Fix a few parameter mismatches in the symbols 2013-02-01 22:54:21 -05:00
Cosimo Cecchi
eacdaf28a6 tree-view: add back gtk_style_context_set_background()
Commit ddceddaa84 removed the call to
gtk_style_context_set_background() in favour of always rendering it with
gtk_render_background() during the draw vfunc.
This has the side effect of making the backing window always
transparent, which blocks GTK from applying some optimizations during
the paint cycle. The result is that, especially in clutter-gtk
applications, scrolling performance gets really bad.

This commit partially reverts ddceddaa84
and changes the code so that both gtk_style_context_set_background() and
gtk_render_background() are called
2013-02-01 11:27:32 +01:00
Chun-wei Fan
9bdc970f8d gtk/gtktreeview: Avoid a C99ism
Declare a variable at the top of the block
2013-01-23 14:49:50 +08:00
William Jon McCann
dcc412c88e Add an optional single click activation mode to treeview
https://bugzilla.gnome.org/show_bug.cgi?id=345023
2013-01-20 16:49:30 -05:00
John Lindgren
bb10561450 More or less revert 91949934 which broke the regression test for bug #111500.
https://bugzilla.gnome.org/show_bug.cgi?id=691842
2013-01-18 01:30:16 +01:00
John Lindgren
0050d469b5 Better resize of expandable columns
Since 16195ad the “expand” property is always set to FALSE when a
column is resized.  This commit takes a different approach and enables
“expand” whenever the column is wide enough.  An appropriate
“fixed-width” (so that the desired width is achieved after expanding) is
calculated using equations that are explained in the code.

https://bugzilla.gnome.org/show_bug.cgi?id=691751
2013-01-15 14:41:30 +01:00
John Lindgren
6d53c2339f Use minimum/natural size semantics
Rewrites gtk_tree_view_column_request_width() and
gtk_tree_view_size_allocate_columns() to respect the minimum and natural
sizes that are already being returned by
gtk_cell_area_context_get_preferred_width().

The convoluted logic explained (not!) by this comment has been removed:
“Only update the expand value if the width of the widget has changed, or
the number of expand columns has changed, or if there are no expand
columns, or if we didn't have an size-allocation yet after the last
validated node.”  This logic seems to have been a workaround for the
“jumping” behavior fixed in 16195ad and is no longer necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=691751
2013-01-15 14:41:20 +01:00
John Lindgren
9b6661a0bf Minor refactoring
No functional change, only moves a self-contained block of code out of
size_allocate_columns() to its own function.

https://bugzilla.gnome.org/show_bug.cgi?id=691751
2013-01-15 14:40:40 +01:00
John Lindgren
16195adc92 Use fixed width for resizing
Removes the hidden “resized-width” and “use-resized-width” properties
from GtkTreeViewColumn and instead uses the “fixed-width” property to
serve the same purpose.  “fixed-width”, if set, will now override the
auto-sized width (-1 is now a legal value meaning “not set”).

Additional “cleanups” in this commit:

1. When the user resizes the column the “expand” property is now also
set to FALSE, in order to prevent the column from suddenly jumping to a
different width when the window is resized.

2. The code that translated mouse movement to column sizes has been
simplified:
the change in column width is now calculated directly from the distance
the mouse cursor has traveled.  Weird behavior that might have happened
previously if the position of the column changed during resizing, is now
prevented.

3. There was some lengthy logic handling the keyboard shortcuts used to
resize treeview columns, which would call gtk_widget_error_bell() once
the minimum or maximum width was reached.  Instead of rewriting these
checks I simply set the “fixed-width” property to what was requested,
relying on the fact that it is already clamped between the minimum and
maximum width during size allocation.
I will greatly surprised if anyone notices the missing error bell.

https://bugzilla.gnome.org/show_bug.cgi?id=691751
2013-01-15 14:40:40 +01:00
John Lindgren
d0e0e48942 Kill gtk_tree_view_size_request
Splits up size_request() so that the height calculations are only done
when get_preferred_height() is called and the width calculations are
only done when get_preferred_width() is called.  Since
get_preferred_width() does not change the treeview->priv->width value,
treeview->priv->prev_width will always be equal to it and can therefore
be removed.  The only place where prev_width was used is a block in
gtk_tree_view_size_allocate().  This block seems to be adjusting the
horizontal scrollbar to account for treeview->priv->width having been
changed in size_request() and should no longer be necessary.  A similar
block immediately above it seems to already account for the width change
in size_allocate().

https://bugzilla.gnome.org/show_bug.cgi?id=691751
2013-01-15 14:40:40 +01:00
John Lindgren
9194993453 Remove extraneous size request
After “validation” (i.e., background size calculations) of some cells,
size_request() was called here to update the internally cached size of
the treeview.  Apparently not updating the sizes leads to some kind of
“inconsistency” that messes with top_row_to_dy().  In the GTK3 model for
size allocation, things are more complicated.  The treeview can’t just
go ahead and calculate its own size any more; instead it reports both a
“minimum” and a “natural” size, and it doesn’t know what size it will
actually get until size_allocate().  It may be necessary to update
top_row_to_dy() to deal with not knowing the exact size.

https://bugzilla.gnome.org/show_bug.cgi?id=691751
2013-01-15 14:40:40 +01:00
Matthias Clasen
e4b5e94eb9 Make accessible implementations public
This commit exposes the get_type() functions and standard
headers for accessible implementations. This makes it possible
to derive from the GTK accessible implementations without
GType magic tricks. This is necessary, because we require the
a11y type hierarchy to be parallel to the widget type hierarchy.
So, if you derive a widget and need to adjust its a11y implementation,
you have to be able to derive its accessible implementation.

This commit probably exposes more than is absolutely necessary,
it also exposes accessibles of widgets that are unlikely candidates
for deriving from.
2012-12-27 11:23:22 -05:00
Cosimo Cecchi
b855e91f7a build: fix some GCC warnings 2012-12-07 11:35:06 -05:00
Alexander Larsson
4ca293e006 treeview: Don't invalidate whole tree unless needed
We currently invalidate the whole tree every time the style state
changes in the tree view. The primary reason for this is to catch
default font changes as that may affect text cell renderers. But
cell renderers could *potentially* also read other style properties
(although that seems weird and unlikely).

We handle this by invalidating only when some state that affects sizes
is changed. This includes all the font properties.
2012-12-06 22:28:11 +01:00
Benjamin Otte
239c631ad3 treeview: Delay computing fixed height
In the setter, we only set fixed height mode and queue a revalidation of
the row heights.

https://bugzilla.gnome.org/show_bug.cgi?id=687816
2012-11-26 00:09:35 +01:00
David King
73c436f43e docs: Fix typo in gtk_tree_view_set_tooltip_column comment
https://bugzilla.gnome.org/show_bug.cgi?id=688884
2012-11-22 22:25:51 +00:00
Cosimo Cecchi
ddceddaa84 tree-view: don't use gtk_style_context_set_background()
Render a background with gtk_render_background() in draw() instead.
Note that we still use gtk_style_context_set_background() for the header
window.

https://bugzilla.gnome.org/show_bug.cgi?id=688744
2012-11-20 13:41:39 -05:00
Matthias Clasen
c51157d437 Forgotten fixup
This was meant to be included in the previous commit :-(
2012-10-22 19:41:14 -04:00
Stefano Facchini
4e42bd055d treeview: Add support for styling the dragged header
https://bugzilla.gnome.org/show_bug.cgi?id=684980
2012-10-22 19:05:00 -04:00
Stefano Facchini
f67273c579 treeview: Move the dragged header in the headers window
https://bugzilla.gnome.org/show_bug.cgi?id=684980
2012-10-22 19:04:12 -04:00
Benjamin Otte
a7d2138544 treeview: Invalidate children properly
GtkTreeView still uses regions (yay!), so we need to invalidate the
regions when hiding/showing children, and not their siblings.
2012-10-01 11:54:18 +02:00
Benjamin Otte
f1ad9051bd treeview: Fix computing child paths
We were adding the GtkButton class twice.
2012-10-01 11:48:50 +02:00
Stefano Facchini
3c7a6581dc treeview: fix size of the dragged column header
Currently the GdkWindow used for dragging is created once when
the first drag starts, and the reused identical each time.
Instead, just recreate it for each drag, with the correct size.
2012-09-27 17:09:55 +02:00
Alexander Larsson
f9d77959a4 Don't create GdkWindows with NULL parents
This is not multi-display safe, you always need to pick the right
parent based on which screen your widget is at.
2012-09-27 13:46:26 +02:00
Matthias Clasen
8d0e88bac7 gtk: Don't use GDK_THREADS_ENTER/LEAVE macros internally
These are just wrappers for the functions, and we want to
deprecate them. Stopping to use them internally is a good
first step.
2012-07-30 18:01:47 +02:00
Cosimo Cecchi
f70fc49ebc docs: fix a number of typos and obsolete references 2012-07-02 10:41:11 -04:00
Benjamin Otte
04c5fdaca6 css: Remove old animation code
Deprecate public API where appropriate and make it no-ops.
Remove all calls to it.
Get rid of the 'transition' css property.

For now, this means spinners don't animate anymore.
2012-04-17 08:59:19 +02:00
Benjamin Otte
ece9d2fd92 gtk: Make widget only invalidate widget positions
Instead of resetting them completely
2012-04-17 08:59:10 +02:00
Matthias Clasen
050cba6a31 Fix malformed doc comments
Most of these are forgotten :'s and similar details
which gtk-doc now warns about.
2012-04-12 21:12:16 -04:00
Benjamin Otte
605a472c99 treeview: Don't cache expander size
Style properties should not be cached, they should be queried live.

Also, this fixes the case where the expander size wasn't set when
constructing the widget which caused expanders to go missing.
2012-04-07 13:01:25 +02:00
Benjamin Otte
917ca6a802 gtk: Don't call gdk_window_process_updates() when scrolling
This can cause lagging when scrolling as it causes us to repaint
on every scroll event. This wasn't historically a great problem,
but with smooth scrolling we get a lot more events, so this
now creates visible lagging on slower machines.
2012-04-05 15:48:51 +02:00
Nelson Benitez Leon
45a5151f94 gtktreeview: don't handle extra mouse buttons
Don't handle mouse button events greater than 5 so
they can bubble up to be used by the application.

This was causing nautilus list view to not go forward
and backwards when pressing the extra mouse buttons
designated for that.

Fixes bug 673441

Signed-off-by: Nelson Benitez Leon <nbenitezl@gmail.com>
2012-04-04 16:26:57 +02:00
Cosimo Cecchi
52bd5f2f1f treeview: filter out invisible columns in get_path_for_child()
Since we check for !list->next (and !list->prev for RTL) to set the
GTK_REGION_LAST flag, we have to filter out invisible columns before
looping; if we don't do that we might end up assigning GTK_REGION_LAST
to an invisible column.

https://bugzilla.gnome.org/show_bug.cgi?id=672937
2012-03-27 12:39:20 -04:00
Benjamin Otte
461803e407 gtk: Get gtkwidgetpath.h includes out of the public headers
and include them in the C files instead.
2012-03-19 02:26:16 +01:00
Benjamin Otte
2353d60b8a types: Move GtkAdustment declaration to gtktypes.h
... and make all the headers to not include gtkadjustment.h anymore. Of
course, also include it in the source files instead.
2012-03-03 19:45:03 +01:00
Benjamin Otte
7844e8089c types: Clean up gtkwidget.h includes
In particular gtksettings.h and gtkstylecontext.h needed to be included
in lots of places now.

Also, I order the includes alphabetically in a bunch of headers.
2012-03-03 19:45:03 +01:00
Carlos Garnacho
faa1d9b8f8 treeview: set GDK_SMOOTH_SCROLL_MASK
This is so smooth scroll events are send/handled by the
parent GtkScrolledWindow if any.
2012-03-01 16:28:59 -05:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Carlos Garnacho
3fb69a0cae treeview: Set background on the widget's window
The widget window is usually covered by the bin_window.
Its background color will become relevant when we introduce
kinetic scrolling with overshooting.
2012-02-23 22:26:52 -05:00
Sebastian Keller
ab2e9d9c93 Bug 650693 - Drawing errors in column headers when adding new columns
Reset style on visible headers, not on invisible ones
2012-02-21 11:46:47 +01:00
Jiří Klimeš
0a9901b1d2 docs: fix typos in functions' descriptions
gtk_tree_view_set_hover_expand()
gtk_tree_view_column_set_clickable()

Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
2012-02-20 09:25:29 +00:00
Cosimo Cecchi
713c532940 treeview: don't use gtk_render_focus() for dnd indicator
There's no reason this should be a focus ring rather than an actual
frame. In the past this was probably used to get a dashed effect, but
now we even support that natively for borders.
2012-02-13 22:43:07 -05:00
Cosimo Cecchi
a3b097639f treeview: set "dnd" style class when drawing drag and drop indicators
This is useful to theme the rings that appear around rows on drag and
drop.
2012-02-13 22:19:53 -05:00