Commit Graph

156 Commits

Author SHA1 Message Date
Timm Bäder
4c6cb2d461 listbox: Remove gadgets 2017-07-19 21:27:11 -04:00
Timm Bäder
d21e931b64 listbox: Remove css box drawing 2017-07-19 21:27:11 -04:00
Timm Bäder
3e44a3920a listbox: Fix row hovering
Drop the in_widget flag since motion events the listbox receives are
always inside the listbox. Also drop the manual coordinate translation
code using GdkWindows.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
a72404dd5a gtk: Mass delete all GtkWidget event mask API
We now rely on toplevels receiving and forwarding all the events
the windowing should be able to handle. Event masks are no longer a
way to determine whether an event is deliverable ot a widget.

Events will always be delivered in the three captured/target/bubbled
phases, widgets can now just attach GtkEventControllers and let those
handle the events.
2017-05-25 16:25:58 +02:00
Timm Bäder
179b8b0cbc Fix gdk_rectangle_union calls
Turns out that the destination is the last parameter, not the first one.
This fixes the flickering in the first page of the widget-factory when
using the expander on page 2.
2017-04-28 11:27:09 +02:00
Timm Bäder
167fc2b659 listbox: Compute clips directly 2017-04-25 20:30:37 +02:00
Timm Bäder
f053a63d74 container: Remove include_internals parameter from forall
with include_internals=TRUE, this is the same as the (still private)
gtk_widget_forall, or just using the children/sibling accessors in a
loop.
2017-04-25 20:30:37 +02:00
Timm Bäder
5d94ee8584 listbox: Properly remove placeholders 2017-04-25 20:29:02 +02:00
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
373d261d15 listbox: Avoid a gtk_widget_destroy call 2017-03-13 12:08:58 +01:00
Timm Bäder
56a58655fe Remove unnecessary gtk_widget_show calls 2017-01-22 14:38:21 +01:00
Benjamin Otte
0dbdf0c428 gadget: Remove gtk_css_gadget_draw()
And with it, remove the draw func from custom gadgets, that has been
NULL everywhere.

All gadgets are snapshot now.
2016-12-20 18:01:12 +01:00
Debarshi Ray
f5818c594c listbox: Don't emit selected-rows-changed, etc. during destruction
https://bugzilla.gnome.org/show_bug.cgi?id=776012
2016-12-19 18:05:51 +01:00
Timm Bäder
31ed68dbfa listbox: Fix row hovering
GtkListBox is not a windowed widget anymore so we can't use
gtk_widget_get_window. Just directly access priv->view_window instead to
get the right window.
2016-12-03 13:19:26 +01:00
Benjamin Otte
e28d94bc8b listbox: Move the priv->gadget allocation
It used to be relative to the window, now it is relative to the widget.

That is necessary so the snapshot fuction doesn't confuse coordinate
systems.
2016-11-30 15:15:08 +01:00
Benjamin Otte
30e0bbeaaa snapshot: convert GtkListBox 2016-11-15 17:49:19 +01:00
Benjamin Otte
da207c9fdd snapshot: Add a snapshot function to GtkCssCustomGadget 2016-11-15 17:48:45 +01:00
Timm Bäder
95eed97586 listbox: Use gtk_widget_measure 2016-11-12 20:37:18 +01:00
Benjamin Otte
b7a72224e1 listbox: Turn into no-window widget 2016-11-06 14:52:56 +01:00
Timm Bäder
5c99f7a670 Fix clip of more windowed widgets 2016-10-28 19:33:47 +02:00
Alexander Larsson
70935f0952 Drop support for offscreen GdkWindows
These complicate a lot of GdkWindow internals to implement features
that not a lot of apps use, and will be better achieved using gsk.
So, we just drop it all.
2016-10-25 09:54:37 +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
Matthias Clasen
ea549a3ce4 GtkListBox: Convert to indirect rendering
Note that there is a problem with the pixel cache that causes
listboxes to come out black when in a scrolled window.
2016-10-18 11:49:13 +01:00
Benjamin Otte
f8a48507a6 listbox: Use gdk_window_new_child() 2016-10-18 00:22:35 +02:00
Emmanuele Bassi
b74cd23e29 docs: Add a diagram for GtkListBox nodes
GtkListBox's API reference for CSS nodes should follow the template of
other widget classes.
2016-09-20 23:32:00 +01:00
Joaquim Rocha
f9658a2faf listbox: Select the last row on page down when there are few rows
When pressing page down doesn't retrieve a valid row (because the list
box has few rows), the last visible one should be selected instead.

https://bugzilla.gnome.org/show_bug.cgi?id=770703
2016-09-03 13:52:39 +02:00
Joaquim Rocha
adabec7d25 listbox: Avoid crashing on page down if the list has few rows
The code always assumed that getting a row at a certain 'y' was
possible but if the list box has more empty space than rows then a
valid row may not be retrieved.

https://bugzilla.gnome.org/show_bug.cgi?id=770703
2016-09-03 13:52:39 +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
Christian Hergert
3724592efb listbox: short-circuit if no sort function is set
do_sort will crash if sort_func is not defined. Instead of adding a check
there in the hot path, just check for sort_func before invalidating the
sort of the underlying GSequence.
2016-06-20 18:51:42 -07:00
Timm Bäder
a99213100d listbox: Don't compare int to uint 2016-05-12 20:39:39 +02:00
Timm Bäder
0815b21ad4 listbox: Make sure page down/up move at least one row
When the current cursor_row is taller than the page_size we get from the
GtkAdjustment, the previous code would not actually cause any scrolling,
so make sure we just take the row after or before the cursor_row in that
case.

https://bugzilla.gnome.org/show_bug.cgi?id=765261
2016-04-21 23:11:38 -04:00
Matthias Clasen
28042ef336 listbox: Fix css node ordering
When inserting a child at the top, we were not inserting its
css node properly.

https://bugzilla.gnome.org/show_bug.cgi?id=764710
2016-04-11 07:52:39 -04:00
Matthias Clasen
bbd94b5a9f gtk: Strip newlines from g_warning and g_error
g_logv adds one for us already.
2016-02-28 12:23:12 -05:00
Timm Bäder
c5369356e8 Various documentation fixes
Always have Since: annotations at the very bottom, use the correct
ClassName::signal-name/ClassName:property-name syntax, fix a few typos
in type names, wrong function names, non-existing type names, etc.
2016-02-08 22:56:52 +01:00
Timm Bäder
c360b5fb49 Remove more unnecessary redraws
The call to gtk_widget_set_state_flags immediately before these already
queues a redraw/allocate/resize in case they have to be queued.
2016-02-07 19:16:26 +01:00
Timm Bäder
47afccb41b GtkListBox: Optimize _get_row_at_y a bit
Use g_sequence_lookup for a binary search over the rows.
2016-01-06 16:02:59 +01:00
Timm Bäder
a9d5fa4cfe GtkListBox: get_row_at_y can return NULL 2016-01-06 16:02:58 +01:00
Matthias Clasen
4eeeb5811d listbox: Fix an oversight in the row gadget conversion 2015-12-15 14:12:50 -05:00
Matthias Clasen
29accad89a listbox: Convert to gadgets 2015-12-15 08:41:16 -05:00
Matthias Clasen
9fb3716259 listbox: Convert rows to gadgets 2015-12-15 08:41:16 -05:00
Timm Bäder
a28103cf51 Add some more missing nullable annotations 2015-12-01 13:41:35 +01:00
Florian Müllner
0a35886b0a listbox: Use :focus-on-click policy from row instead of list
Using the property from the container is inconsistent with the
:selectable and :activatable properties, which are per row.
2015-11-30 17:59:06 +01:00
Matthias Clasen
acdb7dae4e Cosmetic: Avoid an explicit state variable
Using the state of the context makes it more obviously correct.
2015-11-14 12:32:57 -05:00
Matthias Clasen
cf1adadfed listbox: Cosmetic cleanup
We don't cast these arguments anywhere else, so lets not do here
either.
2015-11-14 12:32:57 -05:00
Matthias Clasen
4f29b4a348 listbox: Add element names
The names used here are list and row.
2015-11-05 13:48:02 -05:00
Matthias Clasen
6791c1413d list box: Remove an unused static 2015-11-03 10:43:48 -05:00
Florian Müllner
de50012371 listbox: Implement :focus-on-click
Similar to buttons-in-toolbars, it can make sense for listbox rows
to not take away the focus from the main application view, for
instance when used for navigation. Support this by taking the newly
added GtkWidget:focus-on-click property into account.

https://bugzilla.gnome.org/show_bug.cgi?id=757269
2015-11-03 07:44:17 -05: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
Matthias Clasen
66f0bdee0a Intern all signal names beforehand
This avoids pointless allocations
2015-09-12 12:50:39 -04:00
Matthias Clasen
5f458e4002 list box: Use g_object_notify_by_pspec everywhere
We already have the pspec at hand, so use it.
2015-09-06 17:11:35 -04:00