Skip to content

Commit

Permalink
DesktopConfiguration: shared: don't clobber restart
Browse files Browse the repository at this point in the history
When restarting fvwm2 in situ, don't mangle the windows' positions.

Fixes #694
  • Loading branch information
ThomasAdam committed Sep 19, 2022
1 parent 12ad8d9 commit 32432b8
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions fvwm/add_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -2131,6 +2131,7 @@ FvwmWindow *AddWindow(
const exec_context_t *exc2;
exec_context_changes_t ecc;
struct monitor *mon;
extern Bool Restarting;

/****** init window structure ******/
setup_window_structure(&tmp, w, ReuseWin);
Expand Down
3 changes: 3 additions & 0 deletions fvwm/placement.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ adjust_for_shared_placement(FvwmWindow *fw, const exec_context_t *exc)
struct monitor *m;
char *cmd;
window_style style;
extern Bool Restarting;

if (!is_tracking_shared)
return;
Expand Down Expand Up @@ -371,6 +372,8 @@ adjust_for_shared_placement(FvwmWindow *fw, const exec_context_t *exc)
free(cmd);
}
done:
if (Restarting)
return;
TAILQ_FOREACH(m, &monitor_q, entry) {
if (m->virtual_scr.CurrentDesk == fw->Desk) {
xasprintf(&cmd, "MoveToScreen %s", m->si->name);
Expand Down
16 changes: 15 additions & 1 deletion fvwm/virtual.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@
#define CMD_MOVE_SCREEN_DESK(m, d) \
do { \
char *cmd; \
xasprintf(&cmd, "All (!Screen %s, Desk %d, !CirculateHit) " \
xasprintf(&cmd, \
"All (!Screen %s, Desk %d, CurrentPage, !CirculateHit) "\
"MoveToPage %s $[w.pagex] $[w.pagey]", \
(m)->si->name, (d), (m)->si->name); \
execute_function_override_window( \
Expand Down Expand Up @@ -2249,11 +2250,24 @@ void CMD_DesktopConfiguration(F_CMD_ARGS)
{
FvwmWindow *t;
struct monitor *m = monitor_get_current();
extern Bool Restarting;

if (action == NULL) {
fvwm_debug(__func__, "action is required");
return;
}
if ((Restarting && !Scr.flags.are_windows_captured) &&
strcasecmp(action, "shared") == 0) {
fvwm_debug(__func__, "Restarting and in shared mode...");
if (!is_tracking_shared) {
fvwm_debug(__func__, "Restarting and setting "
"is_tracking_shared to true...");
is_tracking_shared = true;
monitor_mode = MONITOR_TRACKING_G;
}
fvwm_debug(__func__, "All done.");
goto update;
}

if (strcasecmp(action, "global") == 0) {
struct monitor *m_loop;
Expand Down
1 change: 0 additions & 1 deletion libs/FScreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ enum monitor_tracking
{
MONITOR_TRACKING_G = 1,
MONITOR_TRACKING_M,
MONITOR_TRACKING_S,
};

extern enum monitor_tracking monitor_mode;
Expand Down

0 comments on commit 32432b8

Please sign in to comment.