Bugfix: Don’t hide assigned clients to inactive but visible workspaces (Thanks xeen)

This commit is contained in:
Michael Stapelberg 2009-08-02 22:31:52 +02:00
parent a753684ac5
commit 7cfe520755
4 changed files with 26 additions and 10 deletions

View File

@ -24,4 +24,12 @@
*/
void workspace_set_name(Workspace *ws, const char *name);
/**
* Returns true if the workspace is currently visible. Especially important for
* multi-monitor environments, as they can have multiple currenlty active
* workspaces.
*
*/
bool workspace_is_visible(Workspace *ws);
#endif

View File

@ -27,6 +27,7 @@
#include "floating.h"
#include "xcb.h"
#include "config.h"
#include "workspace.h"
bool focus_window_in_container(xcb_connection_t *conn, Container *container, direction_t direction) {
/* If this container is empty, were done */
@ -490,10 +491,8 @@ static void move_floating_window_to_workspace(xcb_connection_t *conn, Client *cl
floating_assign_to_workspace(client, t_ws);
bool target_invisible = t_ws->screen->current_workspace != t_ws->num;
/* If were moving it to an invisible screen, we need to unmap it */
if (target_invisible) {
if (!workspace_is_visible(t_ws)) {
LOG("This workspace is not visible, unmapping\n");
xcb_unmap_window(conn, client->frame);
} else {
@ -515,7 +514,7 @@ static void move_floating_window_to_workspace(xcb_connection_t *conn, Client *cl
render_layout(conn);
if (!target_invisible)
if (workspace_is_visible(t_ws))
set_focus(conn, client, true);
}
@ -575,10 +574,8 @@ static void move_current_window_to_workspace(xcb_connection_t *conn, int workspa
container->currently_focused = to_focus;
to_container->currently_focused = current_client;
bool target_invisible = (to_container->workspace->screen->current_workspace != to_container->workspace->num);
/* If were moving it to an invisible screen, we need to unmap it */
if (target_invisible) {
if (!workspace_is_visible(to_container->workspace)) {
LOG("This workspace is not visible, unmapping\n");
xcb_unmap_window(conn, current_client->frame);
} else {
@ -593,7 +590,7 @@ static void move_current_window_to_workspace(xcb_connection_t *conn, int workspa
render_layout(conn);
if (!target_invisible)
if (workspace_is_visible(to_container->workspace))
set_focus(conn, current_client, true);
}

View File

@ -29,6 +29,7 @@
#include "manage.h"
#include "floating.h"
#include "client.h"
#include "workspace.h"
/*
* Go through all existing windows (if the window manager is restarted) and manage them
@ -325,7 +326,7 @@ void reparent_window(xcb_connection_t *conn, xcb_window_t child,
break;
}
LOG("Changin container/workspace and unmapping the client\n");
LOG("Changing container/workspace and unmapping the client\n");
Workspace *t_ws = &(workspaces[assign->workspace-1]);
if (t_ws->screen == NULL) {
LOG("initializing new workspace, setting num to %d\n", assign->workspace);
@ -338,7 +339,7 @@ void reparent_window(xcb_connection_t *conn, xcb_window_t child,
new->workspace = t_ws;
old_focused = new->container->currently_focused;
map_frame = false;
map_frame = workspace_is_visible(t_ws);
break;
}
}

View File

@ -45,3 +45,13 @@ void workspace_set_name(Workspace *ws, const char *name) {
free(label);
}
/*
* Returns true if the workspace is currently visible. Especially important for
* multi-monitor environments, as they can have multiple currenlty active
* workspaces.
*
*/
bool workspace_is_visible(Workspace *ws) {
return (ws->screen->current_workspace == ws->num);
}