forked from AuroraMiddleware/gtk
Switch motion hint emulation to be serial based.
For backends not supporting serials, just have _gdk_windowing_window_get_next_serial return zero.
This commit is contained in:
parent
19cd4d6af8
commit
e24c9e291d
@ -444,6 +444,19 @@ _gdk_get_sm_client_id (void)
|
||||
return gdk_sm_client_id;
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_display_enable_motion_hints (GdkDisplay *display)
|
||||
{
|
||||
gulong next_serial;
|
||||
|
||||
if (display->pointer_info.motion_hint_serial != 0)
|
||||
{
|
||||
next_serial = _gdk_windowing_window_get_next_serial (display);
|
||||
if (next_serial < display->pointer_info.motion_hint_serial)
|
||||
display->pointer_info.motion_hint_serial = next_serial;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_get_pointer:
|
||||
* @display: a #GdkDisplay
|
||||
|
@ -83,7 +83,7 @@ typedef struct
|
||||
gdouble toplevel_x, toplevel_y;
|
||||
guint32 state;
|
||||
guint32 button;
|
||||
gboolean motion_hint_paused; /* TRUE if we've sent a motion to a window with motion hints enabled */
|
||||
gulong motion_hint_serial; /* 0 == didn't deliver hinted motion event */
|
||||
} GdkPointerWindowInfo;
|
||||
|
||||
struct _GdkDisplay
|
||||
|
@ -950,7 +950,7 @@ gdk_event_request_motions (const GdkEventMotion *event)
|
||||
gdk_device_get_state (event->device, event->window, NULL, NULL);
|
||||
|
||||
display = gdk_drawable_get_display (event->window);
|
||||
display->pointer_info.motion_hint_paused = FALSE;
|
||||
_gdk_display_enable_motion_hints (display);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -333,6 +333,7 @@ void _gdk_windowing_set_default_display (GdkDisplay *display);
|
||||
gchar *_gdk_windowing_substitute_screen_number (const gchar *display_name,
|
||||
gint screen_number);
|
||||
|
||||
gulong _gdk_windowing_window_get_next_serial (GdkDisplay *display);
|
||||
void _gdk_windowing_window_get_offsets (GdkWindow *window,
|
||||
gint *x_offset,
|
||||
gint *y_offset);
|
||||
@ -357,7 +358,8 @@ GdkWindow* _gdk_windowing_window_at_pointer (GdkDisplay *display,
|
||||
GdkModifierType *mask);
|
||||
void _gdk_windowing_got_event (GdkDisplay *display,
|
||||
GList *event_link,
|
||||
GdkEvent *event);
|
||||
GdkEvent *event,
|
||||
gulong serial);
|
||||
|
||||
|
||||
/* Return the number of bits-per-pixel for images of the specified depth. */
|
||||
@ -486,6 +488,8 @@ void _gdk_display_set_has_keyboard_grab (GdkDisplay *display,
|
||||
guint32 time);
|
||||
void _gdk_display_unset_has_keyboard_grab (GdkDisplay *display,
|
||||
gboolean implicit);
|
||||
void _gdk_display_enable_motion_hints (GdkDisplay *display);
|
||||
|
||||
|
||||
void _gdk_window_invalidate_for_expose (GdkWindow *window,
|
||||
const GdkRegion *region);
|
||||
|
@ -5272,7 +5272,7 @@ gdk_window_get_pointer (GdkWindow *window,
|
||||
if (mask)
|
||||
*mask = tmp_mask;
|
||||
|
||||
display->pointer_info.motion_hint_paused = FALSE;
|
||||
_gdk_display_enable_motion_hints (display);
|
||||
|
||||
return child;
|
||||
}
|
||||
@ -5847,7 +5847,7 @@ gdk_window_set_events (GdkWindow *window,
|
||||
display = gdk_drawable_get_display (window);
|
||||
if ((private->event_mask & GDK_POINTER_MOTION_HINT_MASK) &&
|
||||
!(event_mask & GDK_POINTER_MOTION_HINT_MASK))
|
||||
display->pointer_info.motion_hint_paused = FALSE;
|
||||
_gdk_display_enable_motion_hints (display);
|
||||
|
||||
private->event_mask = event_mask;
|
||||
}
|
||||
@ -8104,7 +8104,7 @@ _gdk_display_set_window_under_pointer (GdkDisplay *display,
|
||||
if (window)
|
||||
update_cursor (display);
|
||||
|
||||
display->pointer_info.motion_hint_paused = FALSE;
|
||||
_gdk_display_enable_motion_hints (display);
|
||||
}
|
||||
|
||||
void
|
||||
@ -8215,7 +8215,8 @@ get_event_window (GdkDisplay *display,
|
||||
|
||||
static gboolean
|
||||
proxy_pointer_event (GdkDisplay *display,
|
||||
GdkEvent *source_event)
|
||||
GdkEvent *source_event,
|
||||
gulong serial)
|
||||
{
|
||||
GdkWindow *toplevel_window;
|
||||
GdkWindow *pointer_window;
|
||||
@ -8264,12 +8265,13 @@ proxy_pointer_event (GdkDisplay *display,
|
||||
if (event_win &&
|
||||
(evmask & GDK_POINTER_MOTION_HINT_MASK))
|
||||
{
|
||||
if (display->pointer_info.motion_hint_paused)
|
||||
if (display->pointer_info.motion_hint_serial != 0 &&
|
||||
serial < display->pointer_info.motion_hint_serial)
|
||||
event_win = NULL; /* Ignore event */
|
||||
else
|
||||
{
|
||||
is_hint = TRUE;
|
||||
display->pointer_info.motion_hint_paused = TRUE;
|
||||
display->pointer_info.motion_hint_serial = G_MAXULONG;
|
||||
}
|
||||
}
|
||||
|
||||
@ -8468,7 +8470,8 @@ gdk_window_print_tree (GdkWindow *window,
|
||||
void
|
||||
_gdk_windowing_got_event (GdkDisplay *display,
|
||||
GList *event_link,
|
||||
GdkEvent *event)
|
||||
GdkEvent *event,
|
||||
gulong serial)
|
||||
{
|
||||
GdkWindow *event_window;
|
||||
GdkWindowObject *event_private;
|
||||
@ -8569,15 +8572,13 @@ _gdk_windowing_got_event (GdkDisplay *display,
|
||||
|
||||
if (display->pointer_info.state != old_state ||
|
||||
display->pointer_info.button != old_button)
|
||||
{
|
||||
/* Enable motions for the window */
|
||||
display->pointer_info.motion_hint_paused = FALSE;
|
||||
}
|
||||
_gdk_display_enable_motion_hints (display);
|
||||
|
||||
unlink_event = FALSE;
|
||||
if (is_motion_type (event->type))
|
||||
unlink_event = proxy_pointer_event (display,
|
||||
event);
|
||||
event,
|
||||
serial);
|
||||
else if (is_button_type (event->type))
|
||||
unlink_event = proxy_button_event (event);
|
||||
|
||||
|
@ -444,6 +444,13 @@ process_internal_connection (GIOChannel *gioc,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gulong
|
||||
_gdk_windowing_window_get_next_serial (GdkDisplay *display)
|
||||
{
|
||||
return NextRequest (GDK_DISPLAY_XDISPLAY (display));
|
||||
}
|
||||
|
||||
|
||||
static GdkInternalConnection *
|
||||
gdk_add_connection_handler (Display *display,
|
||||
guint fd)
|
||||
|
@ -2352,7 +2352,7 @@ _gdk_events_queue (GdkDisplay *display)
|
||||
if (gdk_event_translate (display, event, &xevent, FALSE))
|
||||
{
|
||||
((GdkEventPrivate *)event)->flags &= ~GDK_EVENT_PENDING;
|
||||
_gdk_windowing_got_event (display, node, event);
|
||||
_gdk_windowing_got_event (display, node, event, xevent.xany.serial);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user