summaryrefslogtreecommitdiff
path: root/src/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/socket.c')
-rw-r--r--src/socket.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/socket.c b/src/socket.c
index 940034d..8f9a315 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -1715,6 +1715,13 @@ struct msg *mp;
{
if (!display)
display = fore->w_layer.l_cvlist ? fore->w_layer.l_cvlist->c_display : 0;
+
+ /* If the window is not visibile in any display, then do not use the originating window as
+ * the foreground window for the command. This way, if there is an existing display, then
+ * the command will execute from the foreground window of that display. This is necessary so
+ * that commands that are relative to the window (e.g. 'next' etc.) do the right thing. */
+ if (!fore->w_layer.l_cvlist || !fore->w_layer.l_cvlist->c_display)
+ fore = NULL;
break;
}
if (!display)