forked from AuroraMiddleware/gtk
[broadway] Don't roundtrip for getting current pointer location
Roundtrips are bad, and this gets called a lot, so we use all currently availible future info to "emulate" a full roundtrip, but with much lower cost.
This commit is contained in:
parent
a0048d5e70
commit
5b645357d6
@ -155,10 +155,7 @@ gdk_broadway_device_query_state (GdkDevice *device,
|
|||||||
{
|
{
|
||||||
GdkDisplay *display;
|
GdkDisplay *display;
|
||||||
GdkBroadwayDisplay *broadway_display;
|
GdkBroadwayDisplay *broadway_display;
|
||||||
GdkWindowImplBroadway *impl;
|
|
||||||
guint32 serial;
|
|
||||||
GdkScreen *screen;
|
GdkScreen *screen;
|
||||||
BroadwayInputMsg *reply;
|
|
||||||
gint device_root_x, device_root_y;
|
gint device_root_x, device_root_y;
|
||||||
|
|
||||||
if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
|
if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
|
||||||
@ -178,32 +175,27 @@ gdk_broadway_device_query_state (GdkDevice *device,
|
|||||||
|
|
||||||
if (broadway_display->output)
|
if (broadway_display->output)
|
||||||
{
|
{
|
||||||
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
|
_gdk_broadway_display_consume_all_input (display);
|
||||||
|
|
||||||
serial = broadway_output_query_pointer (broadway_display->output, impl->id);
|
if (root_x)
|
||||||
|
*root_x = broadway_display->future_root_x;
|
||||||
reply = _gdk_broadway_display_block_for_input (display, 'q', serial, TRUE);
|
if (root_y)
|
||||||
|
*root_y = broadway_display->future_root_y;
|
||||||
if (reply != NULL)
|
/* TODO: Should really use future_x/y when we get configure events */
|
||||||
|
if (win_x)
|
||||||
|
*win_x = broadway_display->future_root_x - window->x;
|
||||||
|
if (win_y)
|
||||||
|
*win_y = broadway_display->future_root_y - window->y;
|
||||||
|
if (child_window)
|
||||||
{
|
{
|
||||||
if (root_x)
|
if (gdk_window_get_window_type (window) == GDK_WINDOW_ROOT)
|
||||||
*root_x = reply->query_reply.root_x;
|
*child_window =
|
||||||
if (root_y)
|
g_hash_table_lookup (broadway_display->id_ht,
|
||||||
*root_y = reply->query_reply.root_y;
|
GINT_TO_POINTER (broadway_display->future_mouse_in_toplevel));
|
||||||
if (win_x)
|
else
|
||||||
*win_x = reply->query_reply.win_x;
|
*child_window = window; /* No native children */
|
||||||
if (win_y)
|
|
||||||
*win_y = reply->query_reply.win_y;
|
|
||||||
if (child_window)
|
|
||||||
{
|
|
||||||
if (gdk_window_get_window_type (window) == GDK_WINDOW_ROOT)
|
|
||||||
*child_window = g_hash_table_lookup (broadway_display->id_ht, GINT_TO_POINTER (reply->query_reply.window_with_mouse));
|
|
||||||
else
|
|
||||||
*child_window = window; /* No native children */
|
|
||||||
}
|
|
||||||
g_free (reply);
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fallback when unconnected */
|
/* Fallback when unconnected */
|
||||||
|
Loading…
Reference in New Issue
Block a user