Xephyr: Fix crash with control-shift and GLX (#18185)

When we are looking up the screen for an event, we need to take
into account the fact that the event may have been delivered to the
"peer window" that we create when implementing GLX. Since we only
ever create one such window per screen, just add a single peer_win
field to EphyrHostScreen.
This commit is contained in:
Owen W. Taylor 2008-10-22 16:12:53 -04:00 committed by Adam Jackson
parent 6e85a8304b
commit a058192d97

View File

@ -78,6 +78,7 @@ struct EphyrHostScreen
{
Window win;
Window win_pre_existing; /* Set via -parent option like xnest */
Window peer_win; /* Used for GL; should be at most one */
XImage *ximg;
int win_width, win_height;
int server_depth;
@ -904,35 +905,17 @@ host_screen_from_window (Window w)
{
int index = 0;
struct EphyrHostScreen *result = NULL;
#if 0
unsigned int num_children = 0;
Window root = None, parent = None, *children = NULL;
#endif
for (index = 0 ; index < HostX.n_screens ; index++)
{
if (HostX.screens[index].win == w)
if (HostX.screens[index].win == w || HostX.screens[index].peer_win == w)
{
result = &HostX.screens[index];
goto out;
}
}
#if 0
XQueryTree (hostx_get_display (), w, &root, &parent,
&children, &num_children);
if (parent == root || parent == None)
goto out;
result = host_screen_from_window (parent);
#endif
out:
#if 0
if (children)
{
XFree (children);
children = NULL;
}
#endif
return result;
}
@ -1226,6 +1209,11 @@ hostx_create_window (int a_screen_number,
EPHYR_LOG_ERROR ("failed to create peer window\n") ;
goto out ;
}
if (HostX.screens[a_screen_number].peer_win == None) {
HostX.screens[a_screen_number].peer_win = win;
} else {
EPHYR_LOG_ERROR ("multiple peer windows created for same screen\n") ;
}
XFlush (dpy) ;
XMapWindow (dpy, win) ;
*a_host_peer = win ;