Ephyr: Find the right host screen when embedded

When Xephyr is embedded into another application (e.g. in xoo), the
input events may come from the parent Window instead of our own. So make
sure we find the host screen in that case as well instead of crashing.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
Sjoerd Simons 2012-10-30 17:02:58 +01:00 committed by Daniel Stone
parent ac1a60e7b6
commit cf05db8dde

View File

@ -881,7 +881,9 @@ host_screen_from_window(Window w)
struct EphyrHostScreen *result = NULL;
for (index = 0; index < HostX.n_screens; index++) {
if (HostX.screens[index].win == w || HostX.screens[index].peer_win == w) {
if (HostX.screens[index].win == w
|| HostX.screens[index].peer_win == w
|| HostX.screens[index].win_pre_existing == w) {
result = &HostX.screens[index];
goto out;
}