[gtk+] popover: Update to using GdkEvent API
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] popover: Update to using GdkEvent API
- Date: Tue, 19 Sep 2017 17:13:54 +0000 (UTC)
commit 5785db64ceecb2790d30476d95db594cf6cb39e3
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Aug 25 16:52:16 2017 +0200
popover: Update to using GdkEvent API
gtk/gtkpopover.c | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 8bde783..d31e30c 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -1383,7 +1383,7 @@ gtk_popover_button_press (GtkWidget *widget,
{
GtkPopover *popover = GTK_POPOVER (widget);
- if (event->type != GDK_BUTTON_PRESS)
+ if (gdk_event_get_event_type ((GdkEvent *) event) != GDK_BUTTON_PRESS)
return GDK_EVENT_PROPAGATE;
popover->priv->button_pressed = TRUE;
@@ -1398,18 +1398,20 @@ gtk_popover_button_release (GtkWidget *widget,
GtkPopover *popover = GTK_POPOVER (widget);
GtkAllocation child_alloc;
GtkWidget *child;
+ gdouble x, y;
child = gtk_bin_get_child (GTK_BIN (widget));
- if (!popover->priv->button_pressed)
+ if (!popover->priv->button_pressed ||
+ !gdk_event_get_coords ((GdkEvent *) event, &x, &y))
return GDK_EVENT_PROPAGATE;
gtk_widget_get_allocation (child, &child_alloc);
- if (event->x < child_alloc.x ||
- event->x > child_alloc.x + child_alloc.width ||
- event->y < child_alloc.y ||
- event->y > child_alloc.y + child_alloc.height)
+ if (x < child_alloc.x ||
+ x > child_alloc.x + child_alloc.width ||
+ y < child_alloc.y ||
+ y > child_alloc.y + child_alloc.height)
gtk_popover_popdown (popover);
return GDK_EVENT_PROPAGATE;
@@ -1420,8 +1422,12 @@ gtk_popover_key_press (GtkWidget *widget,
GdkEventKey *event)
{
GtkWidget *toplevel, *focus;
+ guint keyval;
- if (event->keyval == GDK_KEY_Escape)
+ if (!gdk_event_get_keyval ((GdkEvent *) event, &keyval))
+ return GDK_EVENT_PROPAGATE;
+
+ if (keyval == GDK_KEY_Escape)
{
gtk_popover_popdown (GTK_POPOVER (widget));
return GDK_EVENT_STOP;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]