Skip to content

Commit

Permalink
DesktopConfiguration: shared mode
Browse files Browse the repository at this point in the history
This teaches the DesktopConfiguration command about a new option:
shared.  When in this mode, a shared state means that's there one set of
desktops (defined via the `DesktopName` command), but these desks are
global to all monitors, yet monitors may independently selected which
desktop to show at that time.

This command will only work if the number of monitors active at the time
`DesktopConfiguration shared` was set is >1, and the number of desktops
set (via `DesktopName` command) is >1.

If a request to move to a particular desktop matches one already shown
on a different monitors, these two desks are exchanged between those
monitors.

Fixes #260
  • Loading branch information
ThomasAdam committed May 29, 2021
1 parent 6f96e75 commit c191b86
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
15 changes: 14 additions & 1 deletion fvwm/placement.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,8 @@ adjust_for_shared_placement(FvwmWindow *fw, const exec_context_t *exc)
if (DO_NOT_SHOW_ON_MAP(fw))
goto done;

if (SUSE_START_ON_SCREEN(&style.flags)) {
if (SUSE_START_ON_SCREEN(&style.flags) ||
SUSE_START_ON_DESK(&style.flags)) {
struct monitor *m_style = NULL;
char *sc = SGET_START_SCREEN(style), *e = NULL;

Expand All @@ -349,6 +350,18 @@ adjust_for_shared_placement(FvwmWindow *fw, const exec_context_t *exc)
if (e != NULL)
m_style = monitor_resolve_name(e);

/* We might not have ascertained the screen yet -- especially
* if only StartsOnDesk was used. So either we can use the
* screen the window is on, or use the currently active one if
* not.
*/
if (m_style == NULL) {
if (fw->m != NULL)
m_style = fw->m;
else
m_style = monitor_get_current();
}

xasprintf(&cmd, "GotoDesk %s 0 %d", m_style->si->name,
fw->Desk);
execute_function_override_window(NULL, NULL, cmd, 0, fw);
Expand Down
1 change: 1 addition & 0 deletions fvwm/virtual.c
Original file line number Diff line number Diff line change
Expand Up @@ -2600,6 +2600,7 @@ void CMD_GotoDeskAndPage(F_CMD_ARGS)
CMD_GOTO_DESK(m, val[0]);
} else if (is_new_desk) {
UnmapDesk(m, m->virtual_scr.CurrentDesk, True);
CMD_GOTO_DESK(m, val[0]);
}
m->virtual_scr.prev_desk_and_page_page_x = m->virtual_scr.Vx;
m->virtual_scr.prev_desk_and_page_page_y = m->virtual_scr.Vy;
Expand Down

0 comments on commit c191b86

Please sign in to comment.