From c3c2d8d7f1bda6e86f75ec312a307da966019b54 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Thu, 10 Oct 2013 20:38:22 +0200 Subject: [PATCH] wmaker: Moved variable Ignore Wks Change into the workspace object in the global namespace Took the opportunity to change its type: it was an integer, but it is actually holding a yes/no status, so it is now defined as a boolean. --- src/WindowMaker.h | 7 +++++++ src/actions.c | 13 +++++-------- src/main.c | 1 + src/workspace.c | 3 +-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/WindowMaker.h b/src/WindowMaker.h index c861a7d9..eb72dccc 100644 --- a/src/WindowMaker.h +++ b/src/WindowMaker.h @@ -494,6 +494,13 @@ extern struct wmaker_global_variables { WMFont *font_for_name; /* used during workspace switch */ + /* + * Ignore Workspace Change: + * this variable is used to prevent workspace switch while certain + * operations are ongoing. + */ + Bool ignore_change; + /* Menus */ struct WMenu *menu; /* workspace operation */ struct WMenu *submenu; /* workspace list for window_menu */ diff --git a/src/actions.c b/src/actions.c index 1b351f41..65eaa844 100644 --- a/src/actions.c +++ b/src/actions.c @@ -50,9 +50,6 @@ #include "misc.h" #include "event.h" -/****** Global Variables ******/ - -int ignore_wks_change = 0; static void find_Maximus_geometry(WWindow *wwin, WArea usableArea, int *new_x, int *new_y, unsigned int *new_width, unsigned int *new_height); @@ -1199,7 +1196,7 @@ void wIconifyWindow(WWindow * wwin) void wDeiconifyWindow(WWindow *wwin) { /* Let's avoid changing workspace while deiconifying */ - ignore_wks_change = 1; + w_global.workspace.ignore_change = True; /* we're hiding for show_desktop */ int netwm_hidden = wwin->flags.net_show_desktop && @@ -1209,7 +1206,7 @@ void wDeiconifyWindow(WWindow *wwin) wWindowChangeWorkspace(wwin, w_global.workspace.current); if (!wwin->flags.miniaturized) { - ignore_wks_change = 0; + w_global.workspace.ignore_change = False; return; } @@ -1220,7 +1217,7 @@ void wDeiconifyWindow(WWindow *wwin) wDeiconifyWindow(owner); wSetFocusTo(wwin->screen_ptr, wwin); wRaiseFrame(wwin->frame->core); - ignore_wks_change = 0; + w_global.workspace.ignore_change = False; return; } } @@ -1309,7 +1306,7 @@ void wDeiconifyWindow(WWindow *wwin) /* the window can disappear while ProcessPendingEvents() runs */ if (!wWindowFor(clientwin)) { - ignore_wks_change = 0; + w_global.workspace.ignore_change = False; return; } } @@ -1325,7 +1322,7 @@ void wDeiconifyWindow(WWindow *wwin) if (!netwm_hidden) wUnshadeWindow(wwin); - ignore_wks_change = 0; + w_global.workspace.ignore_change = False; } static void hideWindow(WIcon *icon, int icon_x, int icon_y, WWindow *wwin, int animate) diff --git a/src/main.c b/src/main.c index 8924a5d3..79899a09 100644 --- a/src/main.c +++ b/src/main.c @@ -553,6 +553,7 @@ int main(int argc, char **argv) w_global.program.signal_state = WSTATE_NORMAL; w_global.timestamp.last_event = CurrentTime; w_global.timestamp.focus_change = CurrentTime; + w_global.workspace.ignore_change = False; /* setup common stuff for the monitor and wmaker itself */ WMInitializeApplication("WindowMaker", &argc, argv); diff --git a/src/workspace.c b/src/workspace.c index d959663b..9455691c 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -59,7 +59,6 @@ #define MAX_SHORTCUT_LENGTH 32 #define WORKSPACE_NAME_DISPLAY_PADDING 32 -extern int ignore_wks_change; extern WShortKey wKeyBindings[WKBD_LAST]; static WMPropList *dWorkspaces = NULL; @@ -441,7 +440,7 @@ void wWorkspaceRelativeChange(WScreen * scr, int amount) * still "flying" to its final position and we don't want to * change workspace before the animation finishes, otherwise * the window will land in the new workspace */ - if (ignore_wks_change) + if (w_global.workspace.ignore_change) return; w = w_global.workspace.current + amount;