diff --git a/src/actions.c b/src/actions.c index c308ed04..891c4f29 100644 --- a/src/actions.c +++ b/src/actions.c @@ -49,6 +49,8 @@ #include "xinerama.h" /****** Global Variables ******/ + +int ignore_wks_change = 0; extern Time LastTimestamp; extern Time LastFocusChange; @@ -1109,6 +1111,9 @@ void wIconifyWindow(WWindow * wwin) void wDeiconifyWindow(WWindow * wwin) { + /* Let's avoid changing workspace while deiconifying */ + ignore_wks_change = 1; + /* we're hiding for show_desktop */ int netwm_hidden = wwin->flags.net_show_desktop && wwin->frame->workspace != wwin->screen_ptr->current_workspace; @@ -1230,6 +1235,8 @@ void wDeiconifyWindow(WWindow * wwin) /* In case we were shaded and iconified, also unshade */ if (!netwm_hidden) wUnshadeWindow(wwin); + + ignore_wks_change = 0; } static void hideWindow(WIcon * icon, int icon_x, int icon_y, WWindow * wwin, int animate) diff --git a/src/workspace.c b/src/workspace.c index 11780705..7374633a 100644 --- a/src/workspace.c +++ b/src/workspace.c @@ -54,6 +54,7 @@ #define MAX_SHORTCUT_LENGTH 32 #define WORKSPACE_NAME_DISPLAY_PADDING 32 +extern int ignore_wks_change; extern WPreferences wPreferences; extern XContext wWinContext; extern XContext wVEdgeContext; @@ -441,6 +442,13 @@ void wWorkspaceRelativeChange(WScreen * scr, int amount) { int w; + /* While the deiconify animation is going on the window is + * 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) + return; + w = scr->current_workspace + amount; if (amount < 0) {