76
76
void CreateWorkSpaceManager ()
80
79
int lines, vspace, hspace, count, columns;
81
80
int width, height, bwidth, bheight;
82
81
char *name, *icon_name, *geometry;
97
96
columns = Scr->workSpaceMgr.columns;
98
97
vspace = Scr->workSpaceMgr.vspace;
99
98
hspace = Scr->workSpaceMgr.hspace;
100
cp = Scr->IconManagerC;
101
99
font = Scr->MenuFont;
103
GetColor (Scr->Monochrome, &(cp.back), "gray70");
106
102
for (blist = Scr->workSpaceMgr.buttonList; blist != NULL; blist = blist->next) count++;
135
131
bheight = (height - ((lines + 1) * vspace)) / lines;
139
background = Scr->workSpaceMgr.cp.back;
140
GetColorFromList(Scr->IconManagerBL, name, (XClassHint *)NULL, &background);
134
cp = Scr->IconManagerC;
142
135
Scr->workSpaceMgr.w = XCreateSimpleWindow (dpy, Scr->Root, x, y, width, height, 0, Scr->Black, cp.back);
158
151
Scr->workSpaceMgr.twm_win->occupation = fullOccupation;
159
152
XSelectInput (dpy, Scr->workSpaceMgr.w, ButtonPressMask |
160
153
ButtonReleaseMask |
163
158
SetMapStateProp (Scr->workSpaceMgr.twm_win, WithdrawnState);
169
164
Scr->workSpaceMgr.width = width;
170
165
Scr->workSpaceMgr.height = height;
171
166
Scr->workSpaceMgr.count = count;
172
Scr->workSpaceMgr.cp = Scr->IconManagerC;
167
Scr->workSpaceMgr.cp = cp;
173
168
Scr->workSpaceMgr.font = Scr->MenuFont;
175
170
CreateOccupyWindow ();
232
227
XClearWindow (dpy, Scr->Root);
234
229
for (twmWin = &(Scr->TwmRoot); twmWin != NULL; twmWin = twmWin->next) {
235
if (OCCUPY (twmWin, oldscr) && ! OCCUPY (twmWin, newscr)) {
238
if (! OCCUPY (twmWin, oldscr) && OCCUPY (twmWin, newscr)) {
230
if (OCCUPY (twmWin, oldscr)) {
231
if (twmWin->mapped == FALSE) {
232
if ((twmWin->icon_on == TRUE) && (twmWin->icon_w)) {
233
XUnmapWindow(dpy, twmWin->icon_w);
238
if (! OCCUPY (twmWin, newscr)) {
243
for (twmWin = &(Scr->TwmRoot); twmWin != NULL; twmWin = twmWin->next) {
244
if (OCCUPY (twmWin, newscr)) {
245
if (twmWin->mapped == FALSE) {
246
if ((twmWin->icon_on == TRUE) && (twmWin->icon_w)) {
248
XMapRaised(dpy, twmWin->icon_w);
252
if (! OCCUPY (twmWin, oldscr)) {
258
Reorganize window lists
260
for (twmWin = &(Scr->TwmRoot); twmWin != NULL; twmWin = twmWin->next) {
241
261
wl = twmWin->list;
242
262
if (wl == NULL) continue;
243
263
if (OCCUPY (wl->iconmgr->twm_win, newscr)) continue;
321
341
useBackgroundInfo = True;
325
blist->number = scrnum++;
345
blist->number = scrnum++;
326
346
if (Scr->workSpaceMgr.buttonList == NULL) {
327
347
Scr->workSpaceMgr.buttonList = blist;
383
403
XrmDestroyDatabase (db);
406
if (twm_win->iconmgr) /* someone try to modify occupation of icon managers */
407
twm_win->occupation = 1 << Scr->workSpaceMgr.activeWSPC->number;
386
409
if ((twm_win->occupation & fullOccupation) == 0)
387
410
twm_win->occupation = 1 << Scr->workSpaceMgr.activeWSPC->number;
389
412
XChangeProperty (dpy, twm_win->w, _XA_WM_WORKSPACES, _XA_WM_WORKSPACES, 32,
390
413
PropModeReplace, (unsigned char *) &twm_win->occupation, 1);
392
416
if (OCCUPY (twm_win, Scr->workSpaceMgr.activeWSPC)) {
393
/* use WM_STATE if enabled */
394
417
if (GetWMState (twm_win->w, &state, &icon) != 0) {
395
418
if (state == InactiveState) SetMapStateProp (twm_win, NormalState);
398
SetMapStateProp (twm_win, NormalState);
402
/* use WM_STATE if enabled */
403
422
if (GetWMState (twm_win->w, &state, &icon) != 0) {
404
423
if (state == NormalState) SetMapStateProp (twm_win, InactiveState);
426
if (twm_win->wmhints->initial_state == NormalState) {
407
427
SetMapStateProp (twm_win, InactiveState);
490
509
if (buttonW == occupyW->OK) {
491
510
if (occupyW->tmpOccupation == 0) return;
494
Scr->iconmgr = Scr->workSpaceMgr.buttonList->iconmgr;
495
511
occupyWin->occupation = occupyW->tmpOccupation & ~occupyWin->occupation;
496
512
AddIconManager (occupyWin);
497
513
occupyWin->occupation = occupyW->tmpOccupation;
499
514
RemoveIconManager (occupyWin);
500
515
if (! OCCUPY (occupyWin, Scr->workSpaceMgr.activeWSPC)) Vanish (occupyWin);
501
516
Vanish (occupyW->twm_win);
525
540
if (ButtonPressed == -1) XUngrabPointer (dpy, CurrentTime);
552
buttonW = event->xkey.subwindow;
554
if (buttonW == 0) return; /* icon */
555
blist = Scr->workSpaceMgr.buttonList;
556
while (blist != NULL) {
557
if (blist->w == buttonW) break;
560
if (blist == NULL) return;
561
strcpy (name, blist->label);
562
lname = strlen (name);
563
len = XLookupString (event, key, 16, NULL, NULL);
564
for (i = 0; i < len; i++) {
570
if ((k == 127) || (k == 8)) {
571
if (lname != 0) lname--;
577
SetButtonLabel (blist, name);
528
580
OccupyAll (twm_win)
529
581
TwmWindow *twm_win;
581
633
XWindowAttributes winattrs;
582
634
unsigned long eventMask;
584
if (tmp_win->mapped == FALSE) {
585
if (tmp_win->icon_on == TRUE) {
586
XUnmapWindow (dpy, tmp_win->icon_w);
590
636
XGetWindowAttributes(dpy, tmp_win->w, &winattrs);
591
637
eventMask = winattrs.your_event_mask;
609
655
XWindowAttributes winattrs;
610
656
unsigned long eventMask;
612
if (tmp_win->mapped == FALSE) {
613
if (tmp_win->icon_on == TRUE) {
614
XMapWindow (dpy, tmp_win->icon_w);
619
XGetWindowAttributes(dpy, tmp_win->w, &winattrs);
620
eventMask = winattrs.your_event_mask;
622
658
XMapWindow(dpy, tmp_win->w);
623
659
XMapWindow(dpy, tmp_win->frame);
624
660
SetMapStateProp (tmp_win, NormalState);
861
void SetButtonLabel (blist, label)
866
int bwidth, bheight, width, height;
869
int strWid, strHei, hspace, vspace;
871
width = Scr->workSpaceMgr.width;
872
height = Scr->workSpaceMgr.height;
873
bwidth = Scr->workSpaceMgr.bwidth;
874
bheight = Scr->workSpaceMgr.bheight;
875
font = Scr->workSpaceMgr.font;
878
blist->label = realloc (blist->label, (strlen (label) + 1));
879
strcpy (blist->label, label);
882
strHei = font.font->max_bounds.ascent + font.font->max_bounds.descent;
883
vspace = ((bheight + strHei) / 2) - font.font->max_bounds.descent;
884
XClearWindow (dpy, blist->w);
885
if (blist == Scr->workSpaceMgr.activeWSPC) SetButton (blist->w, on);
886
else SetButton (blist->w, off);
887
FBF (cp.fore, cp.back, font.font->fid);
888
strWid = XTextWidth (font.font, label, strlen (label));
889
hspace = (bwidth - strWid) / 2;
890
if (hspace < 3) hspace = 3;
891
XDrawString (dpy, w, Scr->NormalGC, hspace, vspace, label, strlen (label));
825
894
int GetMaskFromResource (res)