Commit Graph

190 Commits

Author SHA1 Message Date
Georges Basile Stavracas Neto
5596feae9b listbox: Store child iter in a variable when removing
Unparenting a GtkListBoxRow can drop its last reference, which
will free its memory. Right after unparenting, though, we were
accessing the row's iter - which assumes that the row is still
alive. This causes a crash when, for example, binding two or
more models to the listbox.

Fix that by storing the iter in a variable, and not trying to
access it after unparenting. After unparenting, the variables
that are potentially garbage were explicitly assigned NULL for
clarity.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/1258
2018-08-02 10:24:12 -03:00
Timm Bäder
f26359db13 listbox: Use widget insert API instead of fiddling with CSS nodes 2018-06-20 20:47:17 +02:00
Benjamin Otte
314eaf7d10 widget: Make GtkWidgetClass::drag_leave() take a GdkDrop
Drag Contexts are on their way out!
2018-06-18 23:49:20 +02:00
Benjamin Otte
4ddc94b293 multipressgesture: Port to new API model 2018-04-26 17:59:42 +02:00
Benjamin Otte
9c0acf62b4 widget: Allow adding event controllers in ui files 2018-04-26 17:59:41 +02:00
Timm Bäder
3ce6355bf4 widget: Remove _get_own_allocation
Replace all usages of it with _compute_bounds
2018-04-10 09:43:47 +02:00
Benjamin Otte
169203951b widget: Remove clip from size-allocate vfunc
As the clip is no longer needed, get rid of it.
2018-04-05 14:56:38 +02:00
Alexander Larsson
63e060a21d GtkWidget: Start renaming widget->window
This is an automated change doing these command:

git sed -f g gtk_widget_set_has_window gtk_widget_set_has_surface
git sed -f g gtk_widget_get_has_window gtk_widget_get_has_surface
git sed -f g gtk_widget_set_parent_window gtk_widget_set_parent_surface
git sed -f g gtk_widget_get_parent_window gtk_widget_get_parent_surface
git sed -f g gtk_widget_set_window gtk_widget_set_surface
git sed -f g gtk_widget_get_window gtk_widget_get_surface
git sed -f g gtk_widget_register_window gtk_widget_register_surface
git sed -f g gtk_widget_unregister_window gtk_widget_unregister_surface

git checkout NEWS*
2018-03-20 15:21:12 +01:00
Timm Bäder
6cfb720ab7 Fix a few get_allocated_width/height usages 2018-03-17 12:09:30 +01:00
Daniel Boles
2072953375 ListBox: Avoid ::row-activated/Row::activate ambig
…uity, by adding a doc comment to Row::activate explaining what it does
and why it is probably not what the user reading that is looking for.

https://bugzilla.gnome.org/show_bug.cgi?id=794008
2018-03-12 16:12:09 +00:00
Benjamin Otte
6a47dc26e4 a11y: Remove gtk.h include from listbox headers 2018-02-09 00:52:44 +01:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Emmanuele Bassi
1ed17df7a0 Rename GtkActionHelper private header
Follow the naming scheme for private headers.
2018-02-02 10:28:17 +01:00
Timm Bäder
cb0d2616ff listbox: Don't assume that row child == focus widget
With widgets supporting child widgets and custom GtkListBoxRow
subclasses, this might not be true.
2018-01-17 21:57:19 +01:00
Arnaud Bonatti
f1e3b503de Make GtkListBoxRow GtkActionable.
https://bugzilla.gnome.org/show_bug.cgi?id=741633
2018-01-02 17:56:10 -08:00
Matthias Clasen
72c9853999 list, flow box: Make unpaired releases opt-in
We don't want a pointer that is moved off a scrollbar
to trigger a row when it gets released. To avoid this,
require an explicit opt-in to handling unpaired-releases.
2017-12-30 23:23:16 -05:00
Matthias Clasen
4573d2d19b listbox: Fix a crash during keynav
The code was asserting something that was not always holding
true. We can hit row == NULL here on page-up too. Handle that
case by moving to the first row.

https://bugzilla.gnome.org/show_bug.cgi?id=791549
2017-12-15 18:48:50 -05:00
Matthias Clasen
e92c0e85ec Replace gdk_keymap_get_for_display by gdk_display_get_keymap
Replace all uses of the old function by the new one.
No functional change.
2017-12-15 07:44:58 -05:00
Matthias Clasen
8747c7a42a Fix a typo
The signal is called ::unpaired-release.
2017-11-27 10:56:09 -05:00
Matthias Clasen
268ebb3a46 listbox: Handle unpaired releases as well
Same as for flowbox in the previous commit.
2017-11-26 19:52:01 -05:00
Matthias Clasen
5a6c6070d6 remove debug spew 2017-11-19 22:43:36 -05:00
Matthias Clasen
4d0a57fe0b listbox: Listen to ::stopped on the press gesture
Otherwise, we end up interpreting grab notify's as
button releases, which is not right. This matches
what GtkFlowBox does.
2017-11-19 14:49:58 -05:00
Matthias Clasen
ffd6baec42 gtk: Intern css names
This avoids a bunch of strdups at startup.
2017-11-17 22:49:57 -05:00
Timm Bäder
ff6cd8f75e widget: Remove parent-set signal
When a widget unparents its child widget manually in finalize, this can
lead to the parent-set signal being emitted for those child widgets. The
parent already has a ref_count of 0 though, so it can't be used in a
meaningful way. Specifically, emitting the signal will already try to
ref the parent which prints a critical.

Since GtkWidget already has a "parent" property, one can use its notify
signal instead to get notified when the parent widget changes.
2017-10-29 17:24:12 +01:00
Timm Bäder
00ce3abd6c listboxrow: Remove measure() and size_allocate() impls
GtkListBoxRow is a GtkBin which already does this.
2017-10-14 17:27:55 +02:00
Benjamin Otte
43c212ac28 build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:

1. Add all missing enums to the switch statement
  or
2. Cast the switch argument to a uint to avoid having to do that (mostly
   for GdkEventType).

I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.

The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
2017-10-06 21:23:39 +02:00
Carlos Garnacho
1f91ca0cec gtklistbox: Remove enter/leave/motion event handlers
Those worked similarly to those in GtkFlowBox, but would additionally
handle "active" state for child rows. Simplify this to just enabling/
disabling active state on gesture press/release, we don't get the
nice state updates when hovering around with a mouse button pressed,
but the rationale from flowbox applies here, and makes a nice cleanup.
2017-09-19 18:40:50 +02:00
Carlos Garnacho
1b6ff9df76 listbox: Update to using GdkEvent API 2017-09-19 18:39:02 +02:00
Timm Bäder
a8a755e5cd widget: Remove gtk_widget_set_redraw_on_alloc
Since gtk+ draws more than the widget and allocates more size to it than
it knows about, this flag doesn't work anymore. Removing it (or setting
it to TRUE for widgets that used to set it to FALSE) fixes drawing
invalidation when these widgets get allocated a new size.
2017-08-09 16:26:26 +02:00
Timm Bäder
36ab70ddf5 widget: Add baseline and out_clip parameters to size-allocate
Since setting a clip is mandatory for almost all widgets, we can as well
change the size-allocate signature to include a out_clip parameter, just
like GtkCssGadget did. And since we now always propagate baselines, we
might as well pass that one on to size-allocate.

This way we can also make sure to transform the clip returned from
size-allocate to parent-coordinates, i.e. the same coordinate space
priv->allocation is in.
2017-07-19 21:27:16 -04:00
Timm Bäder
3dc6d240b3 Fix a few allocation coordinates & sizes 2017-07-19 21:27:15 -04:00
Timm Bäder
357e0db4c9 listbox: Remove manual prelight row management
This works automatically now.
2017-07-19 21:27:13 -04:00
Timm Bäder
c2717a887d listbox: Remove view_window 2017-07-19 21:27:13 -04:00
Timm Bäder
665c9aba31 listbox: Remove rows directly when binding model
Instead of hopping through 7 different functions to do that, just
remove all rows directly. This also mean we'll only remove rows and not
other children that've been added like placeholders.
2017-07-19 21:27:13 -04:00
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