From a058192d970f7417b06334aa666c17e9891795c6 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Wed, 22 Oct 2008 16:12:53 -0400 Subject: [PATCH] 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. --- hw/kdrive/ephyr/hostx.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c index d289d7335..f69db2b18 100644 --- a/hw/kdrive/ephyr/hostx.c +++ b/hw/kdrive/ephyr/hostx.c @@ -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 ;