From 01491a96d3ce3b7bb55959504aa01c5bc5f7de4e Mon Sep 17 00:00:00 2001 From: raincomplex Date: Wed, 24 Dec 2014 15:08:02 -0500 Subject: [PATCH] Mark windows changed on Expose On i3wm, windows aren't unmapped when switching away from a window's workspace, but it does cause OBS to lose the capture. Because switching back will not trigger a MapNotify, the capture fails to restart unless you resize or move the window (ConfigureNotify). An Expose event is fired by the wm, however, so catching this correctly restarts the capture. --- plugins/linux-capture/xcompcap-helper.cpp | 3 +++ plugins/linux-capture/xcompcap-main.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/linux-capture/xcompcap-helper.cpp b/plugins/linux-capture/xcompcap-helper.cpp index f44fdbab6..4ff158ab3 100644 --- a/plugins/linux-capture/xcompcap-helper.cpp +++ b/plugins/linux-capture/xcompcap-helper.cpp @@ -186,6 +186,9 @@ namespace XCompcap if (ev.type == MapNotify) changedWindows.insert(ev.xmap.event); + if (ev.type == Expose) + changedWindows.insert(ev.xexpose.window); + if (ev.type == DestroyNotify) changedWindows.insert(ev.xdestroywindow.event); } diff --git a/plugins/linux-capture/xcompcap-main.cpp b/plugins/linux-capture/xcompcap-main.cpp index 4448a7946..ebbc73e57 100644 --- a/plugins/linux-capture/xcompcap-main.cpp +++ b/plugins/linux-capture/xcompcap-main.cpp @@ -296,7 +296,7 @@ void XCompcapMain::updateSettings(obs_data_t *settings) return; } - XSelectInput(xdisp, p->win, StructureNotifyMask); + XSelectInput(xdisp, p->win, StructureNotifyMask | ExposureMask); XSync(xdisp, 0); XWindowAttributes attr;