summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSadrul Habib Chowdhury <sadrul@users.sourceforge.net>2012-03-13 20:56:08 -0400
committerSadrul Habib Chowdhury <sadrul@users.sourceforge.net>2012-03-13 21:14:47 -0400
commit7560d73ba0b611810bc1cf82feaad0204a994a86 (patch)
treecc493c024aa4e2da1d2325afc8b851b295465bdf
parentdf0777e915608ba2d403bb0b3a967b4619e0378b (diff)
downloadscreen-7560d73ba0b611810bc1cf82feaad0204a994a86.tar.gz
Make sure a remote command is executed from the foreground window of a display.
If a remote command is executed from a window inside the session, and it does not pre-select a window, and the window that issued the command is not visible in any display, and there is an existing display for the user, then execute the command in that display's foreground window's context.
-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)