15#include "ctwm_atoms.h"
29# include "ewmh_atoms.h"
50 XSetWindowAttributes attr;
58 if(!
Scr->workSpaceManagerActive) {
61 for(tmpvs =
Scr->vScreenList; tmpvs != NULL; tmpvs = tmpvs->
next) {
75 if(newws->
image == NULL) {
85 if(
Scr->SaveWorkspaceFocus) {
102 if(
OCCUPY(twmWin, newws)) {
107 if(
OCCUPY(twmWin, oldws)) {
120 if(twmWin->
vs == vs) {
121 if(!
OCCUPY(twmWin, newws)) {
131 if(
Scr->numVscreens > 1) {
133 for(tvs =
Scr->vScreenList; tvs != NULL; tvs = tvs->
next) {
146 focuswindow = twmWin;
156 for(twmWin =
Scr->FirstWindow; twmWin != NULL; twmWin = twmWin->
next) {
180 for(iconmgr = newws->
iconmgr; iconmgr; iconmgr = iconmgr->
next) {
193 for(winl = msw->
wl; winl != NULL; winl = winl->
next) {
197 for(winl = msw->
wl; winl != NULL; winl = winl->
next) {
214 if(oldws->
image == NULL ||
Scr->NoImagesInWorkSpaceManager) {
222 if(
Scr->workSpaceMgr.defImage == NULL ||
Scr->NoImagesInWorkSpaceManager) {
223 XSetWindowBackground(
dpy, oldw,
Scr->workSpaceMgr.defColors.back);
226 XSetWindowBackgroundPixmap(
dpy, oldw,
Scr->workSpaceMgr.defImage->pixmap);
229 attr.border_pixel =
Scr->workSpaceMgr.defBorderColor;
230 XChangeWindowAttributes(
dpy, oldw, CWBorderPixel, &attr);
232 if(
Scr->workSpaceMgr.curImage == NULL) {
233 if(
Scr->workSpaceMgr.curPaint) {
234 XSetWindowBackground(
dpy, neww,
Scr->workSpaceMgr.curColors.back);
238 XSetWindowBackgroundPixmap(
dpy, neww,
Scr->workSpaceMgr.curImage->pixmap);
240 attr.border_pixel =
Scr->workSpaceMgr.curBorderColor;
241 XChangeWindowAttributes(
dpy, neww, CWBorderPixel, &attr);
243 XClearWindow(
dpy, oldw);
244 XClearWindow(
dpy, neww);
248 XChangeProperty(
dpy,
Scr->Root, XA_WM_CURRENTWORKSPACE, XA_STRING, 8,
249 PropModeReplace, (
unsigned char *) newws->
name, strlen(newws->
name));
252 long number = newws->
number;
259 XChangeProperty(
dpy,
Scr->Root, XA__NET_CURRENT_DESKTOP,
261 PropModeReplace, (
unsigned char *) &number, 1);
268 if(
Scr->ChangeWorkspaceFunction.func != 0) {
272 action =
Scr->ChangeWorkspaceFunction.item ?
273 Scr->ChangeWorkspaceFunction.item->action : NULL;
275 (Window) 0, NULL, &event,
C_ROOT,
false);
282 if(
OCCUPY(twmWin, newws)) {
294 if(
Scr->ClickToFocus ||
Scr->SloppyFocus) {
310#define GWS_CHECK do { \
311 if(! Scr->workSpaceManagerActive) { \
341 for(ws =
Scr->workSpaceMgr.workSpaceList; ws != NULL; ws = ws->
next) {
342 if(ws->
number == workspacenum) {
360 ws1 =
Scr->workSpaceMgr.workSpaceList;
382 ws = (ws->
next != NULL) ? ws->
next :
Scr->workSpaceMgr.workSpaceList;
391 int number, columns, count;
397 columns =
Scr->workSpaceMgr.columns;
398 count =
Scr->workSpaceMgr.count;
400 if((number % columns) == 0) {
403 else if(number >= count) {
404 number = (number / columns) * columns;
415 int number, columns, count;
421 columns =
Scr->workSpaceMgr.columns;
422 count =
Scr->workSpaceMgr.count;
423 number += (number % columns) ? -1 : (columns - 1);
424 if(number >= count) {
435 int number, lines, columns, count;
441 lines =
Scr->workSpaceMgr.lines;
442 columns =
Scr->workSpaceMgr.columns;
443 count =
Scr->workSpaceMgr.count;
446 number += lines * columns;
448 if(number >= count) {
460 int number, columns, count;
466 columns =
Scr->workSpaceMgr.columns;
467 count =
Scr->workSpaceMgr.count;
469 if(number >= count) {
493 static int state = 0;
496 if(newstate == state) {
501 for(twmWin =
Scr->FirstWindow; twmWin != NULL; twmWin = twmWin->
next) {
502 if(twmWin->
savevs == vs) {
510 for(twmWin =
Scr->FirstWindow; twmWin != NULL; twmWin = twmWin->
next) {
536 if(!
Scr->workSpaceManagerActive) {
540 vs =
Scr->vScreenList;
560 for(ws =
Scr->workSpaceMgr.workSpaceList; ws != NULL; ws = ws->
next) {
561 if(strcmp(ws->
label, wname) == 0) {
567 for(ws =
Scr->workSpaceMgr.workSpaceList; ws != NULL; ws = ws->
next) {
568 if(strcmp(ws->
name, wname) == 0) {
void set_last_window(WorkSpace *current)
void PaintWsButton(PWBType which, VirtualScreen *vs, Window w, char *label, ColorPair cp, ButtonState state)
void EwmhSet_NET_WM_DESKTOP_ws(TwmWindow *twm_win, WorkSpace *ws)
void EwmhSet_NET_SHOWING_DESKTOP(int state)
void ExecuteFunction(int func, void *action, Window w, TwmWindow *tmp_win, XEvent *eventp, int context, bool pulldown)
void CurrentIconManagerEntry(WList *current)
TwmWindow * OtpNextWinDown(TwmWindow *twm_win)
TwmWindow * OtpNextWinUp(TwmWindow *twm_win)
bool OtpCheckConsistency(void)
TwmWindow * OtpBottomWin(void)
TwmWindow * OtpTopWin(void)
struct IconMgr * next
Next iconmgr in this workspace.
Info and control for every X Window we take over.
struct TwmWindow * next
Next TwmWindow on the Screen.
bool hasfocusvisible
The window visibly has focus.
struct VirtualScreen * vs
Where the window is currently mapped (may be NULL).
struct VirtualScreen * savevs
Where the window would be.
struct WList * iconmanagerlist
List of the icon managers the window is in.
struct VirtualScreen * next
struct WorkSpaceWindow * wsw
void Vanish(VirtualScreen *vs, TwmWindow *tmp_win)
bool CtwmSetVScreenMap(Display *display, Window rootw, struct VirtualScreen *firstvs)
void DisplayWin(VirtualScreen *vs, TwmWindow *tmp_win)
void SetFocusVisualAttributes(TwmWindow *tmp_win, bool focus)
int restore_mask(Window w, long restore)
long mask_out_event(Window w, long ignore_event)
void WarpToWindow(TwmWindow *t, bool must_raise)
void WMapRedrawName(VirtualScreen *vs, WinList *wl)
void GotoPrevWorkSpace(VirtualScreen *vs)
void GotoRightWorkSpace(VirtualScreen *vs)
void GotoWorkSpace(VirtualScreen *vs, WorkSpace *ws)
void GotoWorkSpaceByNumber(VirtualScreen *vs, int workspacenum)
void GotoWorkSpaceByName(VirtualScreen *vs, const char *wname)
void ShowBackground(VirtualScreen *vs, int newstate)
void GotoLeftWorkSpace(VirtualScreen *vs)
WorkSpace * GetWorkspace(const char *wname)
void GotoDownWorkSpace(VirtualScreen *vs)
void GotoNextWorkSpace(VirtualScreen *vs)
char * GetCurrentWorkSpaceName(VirtualScreen *vs)
void GotoUpWorkSpace(VirtualScreen *vs)