Commit Graph

1197 Commits

Author SHA1 Message Date
Timm Bäder
43cdeee3c4 widget: Save pointer to focus child
Do the same thing GtkContainer does.
2017-03-31 09:50:39 +02:00
Timm Bäder
75a3d0fab6 treeview: Use gtk_widget_measure to measure widget sizes 2017-03-04 08:44:49 +01:00
Benjamin Otte
87497ca2e1 snapshot: Rename gtk_snapshot_translate_2d()
It's now called gtk_snapshot_offset().
2017-01-13 14:37:48 +01:00
Benjamin Otte
6055028c96 snapshot: Rename append APIs
Instead of having gtk_snapshot_append_foo_node(), just have
gtk_snapshot_append_foo(). Nobody needs to know that this internally
uses nodes.
2017-01-13 04:46:09 +01:00
Benjamin Otte
b58de2d16c snapshot: Redo pop() API
gtk_snapshot_pop() => removed
gtk_snapshot_pop_and_append() => gtk_snapshot_pop()

So now there is no way to get a rendernode out of the snapshotting API
until you gtk_snapshot_finish().
2017-01-13 03:38:36 +01:00
Alexander Larsson
7bee22bcb6 Avoid some more type checks for internal calls 2017-01-11 15:27:51 +01:00
Alexander Larsson
65ad2541d7 Snapshot: Only record names if inspector is recording
Otherwise we do a lot of allocations and vprintf calls which are
not used.
2017-01-11 10:22:40 +01:00
Benjamin Otte
d50b73f66d treeview: Remove gtk_tree_view_get_bin_window()
We don't want to expose GdkWindows in the public API.
2017-01-08 00:48:12 +01:00
Timm Bäder
47d4ad71fb Remove gtk_container_snapshot_child
Replace it with the already existing gtk_widget_snapshot_child.
2017-01-07 17:19:30 +01:00
Benjamin Otte
0efeaf9508 treeview: Port rest of stuff to snapshot()
The only thing still drawn with Cairo are grid lines.
2016-12-22 03:37:32 +01:00
Benjamin Otte
f1825f5eff treeview: Partially convert to snapshot()
The big fat scary bin drawing function that actually draws the cell
renderers - that one is still missing.
2016-12-22 03:37:32 +01:00
Benjamin Otte
4850271ae8 API: Remove gtk_cairo_should_draw_window()
The answer is: Yes.
2016-11-23 18:48:38 +01:00
Timm Bäder
5e06701f53 treeview: Remove style properties
Replace them with the Adwaita default values
2016-11-12 08:09:58 +01:00
Benjamin Otte
24d0baec38 API: gdk: Add gdk_window_new_popup()
... and use it.
2016-11-06 23:47:56 +01:00
Timm Bäder
846cf681e8 Remove gtk_widget_set_mapped
Let all the remaining callers chain up.
2016-11-05 11:56:36 +01:00
Benjamin Otte
5e07a31d2b gtk: Call gtk_widget_set_has_window() on every widget
Even if we just set it to the value it already had.
2016-11-02 06:54:57 +01:00
Benjamin Otte
8ea1157d38 treeview: Don't use gtk_widget_get_allocaton()
Use gtk_widget_get_allocated_width()/height() instead.
2016-11-02 06:54:57 +01:00
Benjamin Otte
8854279e2a treeview: Clip before translating
We want to clip invalidations to the bin window, not the treeview
itself.
2016-11-01 03:51:48 +01:00
Benjamin Otte
b40aeb7ab4 treeview: Clip to bin window size when drawing bin window
This ensures that the drawing does not extend the actually drawn area.

It also ensures that our math is sane, because the math assumes the clip
area cannot extend the window. After all, before GTK4 it always was like
that.

Fixes a bunch of drawing bugs when the clip area does indeed extend too
far.
2016-11-01 03:51:48 +01:00
Benjamin Otte
e1e64ac6fc treeview: Use gtk_widget_queue_draw() 2016-10-27 05:07:23 +02:00
Benjamin Otte
134165e773 treeview: Remove the pixel cache usage 2016-10-27 05:03:06 +02:00
Rico Tzschichholz
94058583dc treeview: Remove stray property enum-entry 2016-10-23 19:08:27 +02:00
Rico Tzschichholz
b5f9343ab4 treeview: Remove deprecated API 2016-10-23 18:23:59 +02:00
Timm Bäder
9992a616ef widget: Use ::measure vfunc to measure size
Add a new ::measure vfunc similar to GtkCssGadget's that widget
implementations have to override instead of the old get_preferred_width,
get_preferred_height, get_preferred_width_for_height,
get_preferred_height_for_width and
get_preferred_height_and_baseline_for_width.
2016-10-22 19:05:47 +02:00
Timm Bäder
700300eb81 treeview: Remove deprecated adjustment API 2016-10-18 00:29:19 +02:00
Timm Bäder
7b22037613 treeview: Remove unused style properties 2016-10-18 00:29:16 +02:00
Benjamin Otte
b17bdbdf97 treeview: Use gdk_window_new_child() 2016-10-18 00:22:35 +02:00
Emmanuele Bassi
5880d1b990 gtk: Cast static strings assigned to non-const variables
GtkTargetEntry.target is particularly egregious, and it should really be
constified.
2016-10-17 11:44:10 +01:00
Benjamin Otte
4df6ddad54 API: container: Remove gtk_container_set_border_width() 2016-10-16 18:18:58 +02:00
Benjamin Otte
1518fe0a8f API: stylecontext: Remove state argument from getters
The argument must always be the current state.
2016-10-16 18:18:58 +02:00
Benjamin Otte
662001b60a API: Remove ability to set visuals on windows
And with it, gtk_widget_get_visual() and gtk_widget_set_visual() are
gone.

We now always use the RGBA visual (if available) and otherwise fall back
to the system visual.
2016-10-16 18:17:21 +02:00
Matthias Clasen
29faa2db44 Redo focus handling in treeview once more
The fix for bug 767468 had some unintended side-effects. This is
an attempt at doing the same fix (don't grab focus when we are
grab-shadowed), while avoiding the breakage, by using GTK+'s
internal tracking for grab-shadowed-ness.

https://bugzilla.gnome.org/show_bug.cgi?id=770508
2016-09-11 11:47:55 -04:00
Arnaud Bonatti
533de822ba Use 'focused' everywhere.
https://bugzilla.gnome.org/show_bug.cgi?id=770624
2016-09-01 07:14:30 +02:00
Benjamin Otte
e1a03ead7a Use NULL for generic marshallers in g_signal_new()
glib will use the correct marshaller automatically. And as a side
effect, we also get all glib optimizations, like a va marshaller.
2016-08-29 16:20:54 +02:00
Carlos Garnacho
e33e23a6d9 treeview: Ensure the treeview has the implicit grab before grabbing focus
The cellrenderer signals might be taking the grab somewhere else, at which
point it's dubious we should attempt to take the keyboard focus into the
treeview.

This concretely breaks popovers triggered from cellrenderer signals on
button press, because the treeview will attempt to grab focus
inconditionally then.

https://bugzilla.gnome.org/show_bug.cgi?id=767468
2016-06-19 20:54:18 -04:00
Matthias Clasen
c4224bf9d0 treeview: fix an off-by-one error
gtk_tree_view_get_path_at_pos() mistakenly identifies the first
pixel of all but the first column in a tree view as belonging to
the previous column.

https://bugzilla.gnome.org/show_bug.cgi?id=708148
2016-06-05 22:20:38 -04:00
Matthias Clasen
d3adf47d9f treeview: Fix a rubberbanding-related crash
When starting a rubberband selection from an empty area, we could run
into crashes if the selection moves over the rows and then back out
to unpopulated area. Handle this case without crashing.

https://bugzilla.gnome.org/show_bug.cgi?id=766336
2016-05-19 16:59:10 -04:00
Matthias Clasen
449732446b treeview: Use getter for gtk-enable-animations 2016-05-01 00:40:23 -04:00
Matthias Clasen
6ae2c24bde treeview: Stop using screen width/height
Popups should always be placed relative to a monitor.
2016-04-27 23:18:16 -04:00
Matthias Clasen
b5fb9ae3b7 gtk: Port to new monitor api
Use the GdkDisplay monitor api instead of the GdkScreen one.
2016-04-27 23:18:16 -04:00
Руслан Ижбулатов
96c18db0da GtkTreeView: change child repositioning to preserve locality
If there was a piece of text in the cell, then when the edit
entry is shown for that cell, it should have a piece of text
in it roughly at the same location.

Therefore, when child widget is enlarged (child preferred
size exceeds cell size), extra width should be added by
extending either left or right edge depending on text direction.

If after that the child sticks outside of the treeivew visible region,
try to push it back inside (breaking its alignment with the
cell), again, giving preference (i.e. adjusting it last)
to either left or right edge depending on text direction.

https://bugzilla.gnome.org/show_bug.cgi?id=765471
2016-04-28 01:35:46 +00:00
Matthias Clasen
12c5ca5c01 treeview: Update drop target highlighting
Stop using the .dnd style class, and instead use the
:drop(active) pseudo state, together with .before and .after
classes.

https://bugzilla.gnome.org/show_bug.cgi?id=763808
2016-03-21 11:56:17 -04:00
Matthias Clasen
0ac71e81cf Drop some unused debug printfs
Remove some debug spew that has been ifdef'ed out for years
and does not look useful enough to keep.
2016-02-28 21:40:23 -05:00
Benjamin Otte
760b540c8c treeview: Don't make things way too high
If the size-request is larger than the dedicated size, don't increase
the dedicated size by the size request, only increase it to the
size request.
2016-02-25 04:03:41 +01:00
Benjamin Otte
9016a00edd treeview: Fix positioning of editing widgets
This looks like a thinko.
2016-02-25 04:03:41 +01:00
Colomban Wendling
a47d9a7b65 treeview: Make sure the editing widget's top left is always visible
https://bugzilla.gnome.org/show_bug.cgi?id=761838
2016-02-11 22:41:58 -05:00
Matthias Clasen
7d16b8df29 treeview: Draw background when empty
We have a function we call for drawing the empty case, but
it only renders a focus rectangle. Make it draw the background
as well.

https://bugzilla.gnome.org/show_bug.cgi?id=761309
2016-01-30 18:31:30 -05:00
Carlos Garnacho
f32a54fb70 GtkTreeView: Update prelight row after revalidating rows
It might have changed (eg. after a row being expanded, and the child
rows revalidated), so just update it here based on the last pointer
position.

Based on a patch by Maxim Reznik <reznikmm@gmail.com>

https://bugzilla.gnome.org/show_bug.cgi?id=760891
2016-01-22 21:18:24 +01:00
Carlos Garnacho
a5f9dc1284 GtkTreeView: Avoid device query on collapsing rows
The pointer position is queried to properly trigger the prelight
updates on the new row below it. We store the last coordinates
though, and track crossing events to unset these, so it's safe
to just update_prelight() here on these.
2016-01-22 21:18:24 +01:00
Matthias Clasen
a0d91a3a71 treeview: Use foreground color to draw dnd marker
This is still not perfect, but makes the dnd marker better visible
in HighContrastInverse.
2016-01-15 19:39:12 -05:00