notebook: Fetch directly current event state/device

gtk_get_current_event() returns a new reference to the event, it should
be freed across various return branches to avoid the event leak, or we
just fetch the little stuff we're interested in.
This commit is contained in:
Carlos Garnacho 2018-04-25 02:10:01 +02:00
parent 23f4724a23
commit aeda2ad049

View File

@ -2671,15 +2671,12 @@ gtk_notebook_motion (GtkEventController *controller,
GtkNotebookPrivate *priv = notebook->priv;
GtkNotebookPage *page;
guint state;
GdkEventMotion *event;
event = (GdkEventMotion *)gtk_get_current_event (); /* FIXME: controller event */
page = priv->cur_page;
if (!page)
return;
if (!gdk_event_get_state ((GdkEvent *) event, &state))
if (!gtk_get_current_event_state (&state))
return;
if (!(state & GDK_BUTTON1_MASK) &&
@ -2701,7 +2698,7 @@ gtk_notebook_motion (GtkEventController *controller,
priv->detached_tab = priv->cur_page;
gtk_drag_begin_with_coordinates (widget,
gdk_event_get_device ((GdkEvent*) event),
gtk_get_current_event_device (),
priv->source_targets, GDK_ACTION_MOVE,
priv->drag_begin_x, priv->drag_begin_y);
return;