change ws field in Client struct from ws index to Workspace struct pointer

This commit is contained in:
Akos Horvath 2023-05-26 18:49:15 +02:00
parent c580905144
commit 683354bbd6
3 changed files with 8 additions and 9 deletions

View File

@ -67,7 +67,7 @@ Client* wm_client_create(Wm *wm, Window w)
c->prev = NULL;
c->window = w;
c->m = wm->smon;
c->ws = wm->smon->selws;
c->ws = &wm->smon->workspaces[wm->smon->selws];
c->hidden = true;
c->is_floating = false;

13
wm.c
View File

@ -145,8 +145,8 @@ void wm_switch_ws(Wm *wm, int ws)
Client *c;
for (c = wm->smon->clients; c; c = c->next) {
if (c->ws == wm->smon->selws) {
DEBUG_PRINT("wm_switch_ws hide client selws: %d\n", c->ws)
if (c->ws->index == wm->smon->selws) {
DEBUG_PRINT("wm_switch_ws hide client selws: %ld\n", c->ws->index)
wm_client_hide(wm, c);
}
}
@ -157,7 +157,7 @@ void wm_switch_ws(Wm *wm, int ws)
(unsigned char*) &(ws), XA_CARDINAL, 1);
for (c = wm->smon->clients; c; c = c->next) {
if (c->ws == wm->smon->selws) {
if (c->ws->index == wm->smon->selws) {
wscc++;
wm_client_show(wm, c);
}
@ -198,7 +198,7 @@ void wm_mstack(Wm *wm, Monitor *m)
}
for (c = m->clients; c; c = c->next) {
if (c->ws == m->selws && c != &wm->root && !c->is_floating) {
if (c->ws->index == m->selws && c != &wm->root && !c->is_floating) {
cc_sws++;
}
}
@ -213,7 +213,7 @@ void wm_mstack(Wm *wm, Monitor *m)
// dynamic
if (cc_sws == 1) {
for (c = m->clients; c; c = c->next) {
if (c->ws == m->selws && c != &wm->root)
if (c->ws->index == m->selws && c != &wm->root)
break;
}
c->x = 0;
@ -235,7 +235,7 @@ void wm_mstack(Wm *wm, Monitor *m)
else {
// FIXME not working with dock
for (c = m->clients; c; c = c->next) {
if (c->ws == m->selws && c->window != wm->root.window && !c->is_floating) {
if (c->ws->index == m->selws && c->window != wm->root.window && !c->is_floating) {
if (n == 0) {
c->x = 0;
c->y = sy;
@ -423,7 +423,6 @@ void wm_init(Wm *wm)
// wm_socket_init();
wm->root.window = XRootWindow(wm->display, DefaultScreen(wm->display));
wm->root.ws = 999;
DEBUG_PRINT("root window: %ld\n", wm->root.window);

2
wm.h
View File

@ -93,7 +93,7 @@ struct Client {
int y;
int w;
int h;
int ws;
Workspace *ws;
bool hidden;
Monitor *m;
Window window;