From 5f7fc616d26bedd47bfb6f253549d8d6cdbef1ba Mon Sep 17 00:00:00 2001 From: Thomas Adam Date: Wed, 16 Sep 2020 14:44:45 +0100 Subject: [PATCH] FvwmPager: respect DesktopConfiguration setting When FvwmPager is launched without a "Monitor" config, it assumes the remit is global -- that is, it will show windows from all monitors. However, this could be at odds with the DesktopConfiguration setting. When FvwmPager performs tasks such as switching pages and/or desks, it does so by sending Fvwm commands directly. This includes monitor information which is not what's needed if DesktopConfiguration is global. Therefore, only send the monitor string across if FvwmPager is already tracking a specific monitor. Helps with #236 --- modules/FvwmPager/x_pager.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/FvwmPager/x_pager.c b/modules/FvwmPager/x_pager.c index 27f5ead3f..0461b0fc2 100644 --- a/modules/FvwmPager/x_pager.c +++ b/modules/FvwmPager/x_pager.c @@ -1903,7 +1903,9 @@ void SwitchToDesk(int Desk) char command[256]; struct fpmonitor *m = fpmonitor_this(); - sprintf(command, "GotoDesk %s 0 %d", m->name, Desk + desk1); + sprintf(command, "GotoDesk %s 0 %d", monitor_to_track ? m->name : "", + Desk + desk1); + fprintf(stderr, "%s: cmd: %s\n", __func__, command); SendText(fd,command,0); } @@ -1921,7 +1923,9 @@ void SwitchToDeskAndPage(int Desk, XEvent *Event) vy = Event->xbutton.y * mon->virtual_scr.VHeight / (desk_h * mon->virtual_scr.MyDisplayHeight); mon->virtual_scr.Vx = vx * mon->virtual_scr.MyDisplayWidth; mon->virtual_scr.Vy = vy * mon->virtual_scr.MyDisplayHeight; - sprintf(command, "GotoDeskAndPage %s %d %d %d", mon->name, Desk + desk1, vx, vy); + sprintf(command, "GotoDeskAndPage %s %d %d %d", + monitor_to_track ? mon->name : "", Desk + desk1, vx, vy); + fprintf(stderr, "%s: cmd: %s\n", __func__, command); SendText(fd, command, 0); } @@ -1941,8 +1945,8 @@ void SwitchToDeskAndPage(int Desk, XEvent *Event) x = mon->virtual_scr.VxMax / mon->virtual_scr.MyDisplayWidth; if (y * mon->virtual_scr.MyDisplayHeight > mon->virtual_scr.VyMax) y = mon->virtual_scr.VyMax / mon->virtual_scr.MyDisplayHeight; - sprintf(command, "GotoPage %s %d %d", mon->name, x, y); - fprintf(stderr, "%s: going to page: %s %d, %d\n", __func__, mon->name, x, y); + sprintf(command, "GotoPage %s %d %d", monitor_to_track ? mon->name : "", x, y); + fprintf(stderr, "%s: cmd: %s\n", __func__, command); SendText(fd, command, 0); } Wait = 1; @@ -1954,9 +1958,10 @@ void IconSwitchPage(XEvent *Event) struct fpmonitor *mon = fpmonitor_this(); sprintf(command,"GotoPage %s %d %d", - mon->name, + monitor_to_track ? mon->name : "", Event->xbutton.x * mon->virtual_scr.VWidth / (icon_w * mon->virtual_scr.MyDisplayWidth), Event->xbutton.y * mon->virtual_scr.VHeight / (icon_h * mon->virtual_scr.MyDisplayHeight)); + fprintf(stderr, "%s: cmd: %s\n", __func__, command); SendText(fd, command, 0); Wait = 1; }