Avoid blocking paint events from long-running mouse event handlers
If a mouse event handler calls Refresh(), increase the likelyhood that a paint event can be issued before the next mouse event occurs, by requesting more mouse events from the the end of the handler rather than the start. See #18314
This commit is contained in:
@@ -1815,19 +1815,6 @@ gtk_window_motion_notify_callback( GtkWidget * WXUNUSED(widget),
|
|||||||
|
|
||||||
wxCOMMON_CALLBACK_PROLOGUE(gdk_event, win);
|
wxCOMMON_CALLBACK_PROLOGUE(gdk_event, win);
|
||||||
|
|
||||||
if (gdk_event->is_hint)
|
|
||||||
{
|
|
||||||
int x = 0;
|
|
||||||
int y = 0;
|
|
||||||
#ifdef __WXGTK3__
|
|
||||||
gdk_window_get_device_position(gdk_event->window, gdk_event->device, &x, &y, NULL);
|
|
||||||
#else
|
|
||||||
gdk_window_get_pointer(gdk_event->window, &x, &y, NULL);
|
|
||||||
#endif
|
|
||||||
gdk_event->x = x;
|
|
||||||
gdk_event->y = y;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_lastMouseEvent = (GdkEvent*) gdk_event;
|
g_lastMouseEvent = (GdkEvent*) gdk_event;
|
||||||
|
|
||||||
wxMouseEvent event( wxEVT_MOTION );
|
wxMouseEvent event( wxEVT_MOTION );
|
||||||
@@ -1875,6 +1862,20 @@ gtk_window_motion_notify_callback( GtkWidget * WXUNUSED(widget),
|
|||||||
|
|
||||||
g_lastMouseEvent = NULL;
|
g_lastMouseEvent = NULL;
|
||||||
|
|
||||||
|
// Request additional motion events. Done at the end to increase the
|
||||||
|
// chances that lower priority events requested by the handler above, such
|
||||||
|
// as painting, can be processed before the next motion event occurs.
|
||||||
|
// Otherwise a long-running handler can cause paint events to be entirely
|
||||||
|
// blocked while the mouse is moving.
|
||||||
|
if (gdk_event->is_hint)
|
||||||
|
{
|
||||||
|
#ifdef __WXGTK3__
|
||||||
|
gdk_event_request_motions(gdk_event);
|
||||||
|
#else
|
||||||
|
gdk_window_get_pointer(gdk_event->window, NULL, NULL, NULL);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user