[Xephyr/DRI] correctly route motion events targeted at GL drawable

This commit is contained in:
Dodji Seketeli 2008-03-18 14:00:15 +01:00
parent afd7428690
commit cdadd2ff9b
3 changed files with 31 additions and 7 deletions

View File

@ -891,9 +891,12 @@ ephyrPoll(void)
continue;
}
{
if (ephyrCurScreen != ev.data.mouse_motion.screen)
if (ev.data.mouse_motion.screen >=0
&& (ephyrCurScreen != ev.data.mouse_motion.screen))
{
EPHYR_LOG ("warping mouse cursor:%d\n", ephyrCurScreen) ;
EPHYR_LOG ("warping mouse cursor. "
"cur_screen%d, motion_screen:%d\n",
ephyrCurScreen, ev.data.mouse_motion.screen) ;
if (ev.data.mouse_motion.screen >= 0)
{
ephyrWarpCursor
@ -904,11 +907,30 @@ ephyrPoll(void)
}
else
{
int x=0, y=0;
#ifdef XEPHYR_DRI
EphyrWindowPair *pair = NULL;
#endif
EPHYR_LOG ("enqueuing mouse motion:%d\n", ephyrCurScreen) ;
KdEnqueuePointerEvent(ephyrMouse, mouseState,
ev.data.mouse_motion.x,
ev.data.mouse_motion.y,
0);
x = ev.data.mouse_motion.x;
y = ev.data.mouse_motion.y;
EPHYR_LOG ("initial (x,y):(%d,%d)\n", x, y) ;
#ifdef XEPHYR_DRI
EPHYR_LOG ("is this window peered by a gl drawable ?\n") ;
if (findWindowPairFromRemote (ev.data.mouse_motion.window,
&pair))
{
EPHYR_LOG ("yes, it is peered\n") ;
x += pair->local->drawable.x;
y += pair->local->drawable.y;
}
else
{
EPHYR_LOG ("no, it is not peered\n") ;
}
EPHYR_LOG ("final (x,y):(%d,%d)\n", x, y) ;
#endif
KdEnqueuePointerEvent(ephyrMouse, mouseState, x, y, 0);
}
}
break;

View File

@ -914,8 +914,9 @@ hostx_get_event(EphyrHostXEvent *ev)
host_screen_from_window (xev.xmotion.window);
ev->type = EPHYR_EV_MOUSE_MOTION;
ev->data.mouse_motion.x = xev.xmotion.x;
ev->data.mouse_motion.x = xev.xmotion.x;
ev->data.mouse_motion.y = xev.xmotion.y;
ev->data.mouse_motion.window = xev.xmotion.window;
ev->data.mouse_motion.screen = (host_screen ? host_screen->mynum : -1);
}
return 1;

View File

@ -70,6 +70,7 @@ struct EphyrHostXEvent
int x;
int y;
int screen;
int window;
} mouse_motion;
struct mouse_down {