[gtk+/wip/carlosg/event-delivery: 22/104] gtkbutton: Handle crossing events without the event window
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/carlosg/event-delivery: 22/104] gtkbutton: Handle crossing events without the event window
- Date: Thu, 25 May 2017 14:41:57 +0000 (UTC)
commit 5836beee78fc3acf7a48ec01ab1dda72eac2bfc0
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Mar 31 17:59:43 2017 +0200
gtkbutton: Handle crossing events without the event window
The event shall no longer be "directed" to the event window, but the
widget. Getting a enter/leave event is enough now to know whether the
pointer is inside or outside the widget.
gtk/gtkbutton.c | 18 +++++-------------
gtk/gtkbuttonprivate.h | 1 -
gtk/gtkmodelbutton.c | 12 ------------
3 files changed, 5 insertions(+), 26 deletions(-)
---
diff --git a/gtk/gtkbutton.c b/gtk/gtkbutton.c
index 6066090..951eb18 100644
--- a/gtk/gtkbutton.c
+++ b/gtk/gtkbutton.c
@@ -473,7 +473,7 @@ gtk_button_init (GtkButton *button)
g_signal_connect (priv->gesture, "released", G_CALLBACK (multipress_released_cb), button);
g_signal_connect (priv->gesture, "update", G_CALLBACK (multipress_gesture_update_cb), button);
g_signal_connect (priv->gesture, "cancel", G_CALLBACK (multipress_gesture_cancel_cb), button);
- gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->gesture), GTK_PHASE_BUBBLE);
+ gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (priv->gesture), GTK_PHASE_CAPTURE);
priv->gadget = gtk_css_custom_gadget_new_for_node (gtk_widget_get_css_node (GTK_WIDGET (button)),
GTK_WIDGET (button),
@@ -977,12 +977,8 @@ gtk_button_enter_notify (GtkWidget *widget,
GtkButton *button = GTK_BUTTON (widget);
GtkButtonPrivate *priv = button->priv;
- if ((event->window == button->priv->event_window) &&
- (event->detail != GDK_NOTIFY_INFERIOR))
- {
- priv->in_button = TRUE;
- gtk_button_update_state (button);
- }
+ priv->in_button = TRUE;
+ gtk_button_update_state (button);
return FALSE;
}
@@ -994,12 +990,8 @@ gtk_button_leave_notify (GtkWidget *widget,
GtkButton *button = GTK_BUTTON (widget);
GtkButtonPrivate *priv = button->priv;
- if ((event->window == button->priv->event_window) &&
- (event->detail != GDK_NOTIFY_INFERIOR))
- {
- priv->in_button = FALSE;
- gtk_button_update_state (button);
- }
+ priv->in_button = FALSE;
+ gtk_button_update_state (button);
return FALSE;
}
diff --git a/gtk/gtkbuttonprivate.h b/gtk/gtkbuttonprivate.h
index 075f855..8a85676 100644
--- a/gtk/gtkbuttonprivate.h
+++ b/gtk/gtkbuttonprivate.h
@@ -32,7 +32,6 @@ struct _GtkButtonPrivate
GtkCssGadget *gadget;
GdkDevice *grab_keyboard;
- GdkWindow *event_window;
GtkGesture *gesture;
diff --git a/gtk/gtkmodelbutton.c b/gtk/gtkmodelbutton.c
index 7c84725..28489b0 100644
--- a/gtk/gtkmodelbutton.c
+++ b/gtk/gtkmodelbutton.c
@@ -872,18 +872,6 @@ gtk_model_button_allocate (GtkCssGadget *gadget,
gtk_widget_size_allocate_with_baseline (child, &child_allocation, baseline);
}
- if (gtk_widget_get_realized (widget))
- {
- GtkAllocation border_allocation;
- gtk_css_gadget_get_border_allocation (gadget, &border_allocation, NULL);
-
- gdk_window_move_resize (GTK_BUTTON (widget)->priv->event_window,
- border_allocation.x,
- border_allocation.y,
- border_allocation.width,
- border_allocation.height);
- }
-
gtk_container_get_children_clip (GTK_CONTAINER (widget), out_clip);
gdk_rectangle_union (out_clip, &check_clip, out_clip);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]