struct Client* next;
char* name;
Window frame, win;
- int state, flags, wspace, x, y, w, h;
+ int state, flags, wspace, x, y, w, h, rel_x, rel_y;
long hint_flags, wm_flags;
XWMHints hints;
XSizeHints size_hints;
// int width;
// Client* clients;
//} Column;
-//
+
typedef struct Workspace {
int monitor;
// Client* floating;
XFree(hints);
}
}
+ Client_Place(c);
+
}
return c;
}
void Client_Show(Client* c)
{
- /*
- If window not overlapping workspace
- center on configured workspace
- end
- */
+ /* position it with relative coords */
Monitor* mon = &Monitors[Workspaces[c->wspace].monitor];
- if (MonitorOverlap(mon, c) == 0)
- {
- c->x = mon->midx - c->w/2;
- c->y = mon->midy - c->h/2;
- Client_MoveResize(c);
- }
+ c->x = mon->x + c->rel_x;
+ c->y = mon->y + c->rel_y;
+ Client_MoveResize(c);
ReadProps(c);
SetWMState(c, NormalState);
/* update the workspace this client is mapped to */
c->wspace = Monitors[monitor].wspace;
+ c->rel_x = c->x - Monitors[monitor].x;
+ c->rel_y = c->y - Monitors[monitor].y;
}
static void ReadProps(Client* c)