1069
1093
XSaveContext(dpy, tmp_win->hilite_wr, TwmContext, (caddr_t)tmp_win);
1070
1094
XSaveContext(dpy, tmp_win->hilite_wr, ScreenContext, (caddr_t)Scr);
1096
if (tmp_win->lolite_wl)
1098
XSaveContext(dpy, tmp_win->lolite_wl, TwmContext, (caddr_t)tmp_win);
1099
XSaveContext(dpy, tmp_win->lolite_wl, ScreenContext, (caddr_t)Scr);
1101
if (tmp_win->lolite_wr)
1103
XSaveContext(dpy, tmp_win->lolite_wr, TwmContext, (caddr_t)tmp_win);
1104
XSaveContext(dpy, tmp_win->lolite_wr, ScreenContext, (caddr_t)Scr);
1074
1108
XUngrabServer(dpy);
1354
1404
Scr->d_visual, valuemask, &attributes);
1358
void ComputeCommonTitleOffsets ()
1407
static void CreateLowlightWindows (tmp_win)
1360
int buttonwidth = (Scr->TBInfo.width + Scr->TBInfo.pad);
1362
Scr->TBInfo.leftx = Scr->TBInfo.rightoff = Scr->FramePadding;
1363
if (Scr->TBInfo.nleft > 0) Scr->TBInfo.leftx += Scr->ButtonIndent;
1364
if (Scr->TBInfo.nright > 0) Scr->TBInfo.rightoff += (Scr->ButtonIndent +
1365
(Scr->TBInfo.nright * buttonwidth) -
1368
Scr->TBInfo.titlex = (Scr->TBInfo.leftx +
1369
(Scr->TBInfo.nleft * buttonwidth) -
1410
XSetWindowAttributes attributes; /* attributes for create windows */
1411
unsigned long valuemask;
1412
int h = (Scr->TitleHeight - 2 * Scr->FramePadding);
1413
int y = Scr->FramePadding;
1416
if (!Scr->UseSunkTitlePixmap || ! tmp_win->titlehighlight) {
1417
tmp_win->lolite_wl = (Window) 0;
1418
tmp_win->lolite_wr = (Window) 0;
1422
* If a special highlight pixmap was given, use that. Otherwise,
1423
* use a nice, even gray pattern. The old horizontal lines look really
1424
* awful on interlaced monitors (as well as resembling other looks a
1425
* little bit too closely), but can be used by putting
1427
* Pixmaps { TitleHighlight "hline2" }
1429
* (or whatever the horizontal line bitmap is named) in the startup
1430
* file. If all else fails, use the foreground color to look like a
1434
if (! tmp_win->LoliteImage) {
1435
if (Scr->HighlightPixmapName) {
1436
cp = tmp_win->title;
1437
cp.shadc = tmp_win->title.shadd;
1438
cp.shadd = tmp_win->title.shadc;
1439
tmp_win->LoliteImage = GetImage (Scr->HighlightPixmapName, cp);
1442
if (tmp_win->LoliteImage) {
1443
valuemask = CWBackPixmap;
1444
attributes.background_pixmap = tmp_win->LoliteImage->pixmap;
1446
valuemask = CWBackPixel;
1447
attributes.background_pixel = tmp_win->title.fore;
1450
if (Scr->use3Dtitles) {
1454
if (Scr->TitleJustification == J_LEFT)
1455
tmp_win->lolite_wl = (Window) 0;
1457
tmp_win->lolite_wl = XCreateWindow (dpy, tmp_win->title_w, 0, y,
1458
(unsigned int) Scr->TBInfo.width, (unsigned int) h,
1459
(unsigned int) 0, Scr->d_depth, (unsigned int) CopyFromParent,
1460
Scr->d_visual, valuemask, &attributes);
1462
if (Scr->TitleJustification == J_RIGHT)
1463
tmp_win->lolite_wr = (Window) 0;
1465
tmp_win->lolite_wr = XCreateWindow (dpy, tmp_win->title_w, 0, y,
1466
(unsigned int) Scr->TBInfo.width, (unsigned int) h,
1467
(unsigned int) 0, Scr->d_depth, (unsigned int) CopyFromParent,
1468
Scr->d_visual, valuemask, &attributes);
1374
1472
void ComputeWindowTitleOffsets (tmp_win, width, squeeze)
1375
1473
TwmWindow *tmp_win;
1859
1962
t->HiliteImage = image->next;
1965
name_list **AddWindowRegion (geom, grav1, grav2)
1972
wr = (WindowRegion*) malloc (sizeof (WindowRegion));
1975
if (!Scr->FirstWindowRegion) Scr->FirstWindowRegion = wr;
1978
wr->clientlist = NULL;
1981
wr->x = wr->y = wr->w = wr->h = 0;
1983
mask = XParseGeometry (geom, &wr->x, &wr->y, (unsigned int*) &wr->w,
1984
(unsigned int*) &wr->h);
1986
if (mask & XNegative) wr->x += Scr->MyDisplayWidth - wr->w;
1987
if (mask & YNegative) wr->y += Scr->MyDisplayHeight - wr->h;
1989
return (&(wr->clientlist));
1992
void CreateWindowRegions () {
1993
WindowRegion *wr, *wr1 = NULL, *wr2 = NULL;
1996
for (wl = Scr->workSpaceMgr.workSpaceList; wl != NULL; wl = wl->next) {
1997
wl->FirstWindowRegion = NULL;
1999
for (wr = Scr->FirstWindowRegion; wr != NULL; wr = wr->next) {
2000
wr1 = (WindowRegion*) malloc (sizeof (WindowRegion));
2002
wr1->entries = (WindowEntry*) malloc (sizeof (WindowEntry));
2003
wr1->entries->next = 0;
2004
wr1->entries->x = wr1->x;
2005
wr1->entries->y = wr1->y;
2006
wr1->entries->w = wr1->w;
2007
wr1->entries->h = wr1->h;
2008
wr1->entries->twm_win = (TwmWindow*) 0;
2009
wr1->entries->used = 0;
2010
if (wr2) wr2->next = wr1; else wl->FirstWindowRegion = wr1;
2013
if (wr1) wr1->next = NULL;
2018
Bool PlaceWindowInRegion (tmp_win, final_x, final_y)
2020
int *final_x, *final_y;
2027
if (!Scr->FirstWindowRegion) return (False);
2028
for (wl = Scr->workSpaceMgr.workSpaceList; wl != NULL; wl = wl->next) {
2029
if (OCCUPY (tmp_win, wl)) break;
2031
if (!wl) return (False);
2032
w = tmp_win->frame_width;
2033
h = tmp_win->frame_height;
2034
we = (WindowEntry*) 0;
2035
for (wr = wl->FirstWindowRegion; wr; wr = wr->next) {
2036
if (LookInList (wr->clientlist, tmp_win->full_name, &tmp_win->class)) {
2037
for (we = wr->entries; we; we=we->next) {
2038
if (we->used) continue;
2039
if (we->w >= w && we->h >= h) break;
2044
tmp_win->wr = (WindowRegion*) 0;
2045
if (!we) return (False);
2047
splitWindowRegionEntry (we, wr->grav1, wr->grav2, w, h);
2049
we->twm_win = tmp_win;
2056
static void splitWindowRegionEntry (we, grav1, grav2, w, h)
2068
if (w != we->w) splitWindowRegionEntry (we, grav2, grav1, w, we->h);
2070
new = (WindowEntry *) malloc (sizeof (WindowEntry));
2073
new->next = we->next;
2076
new->h = (we->h - h);
2079
if (grav1 == D_SOUTH) {
2081
we->y = new->y + new->h;
2083
new->y = we->y + we->h;
2089
if (h != we->h) splitWindowRegionEntry (we, grav2, grav1, we->w, h);
2091
new = (WindowEntry *) malloc (sizeof (WindowEntry));
2094
new->next = we->next;
2097
new->w = (we->w - w);
2100
if (grav1 == D_EAST) {
2102
we->x = new->x + new->w;
2104
new->x = we->x + we->w;
2110
static WindowEntry *findWindowEntry (wl, tmp_win, wrp)
2118
for (wr = wl->FirstWindowRegion; wr; wr = wr->next) {
2119
for (we = wr->entries; we; we=we->next) {
2120
if (we->twm_win == tmp_win) {
2126
return (WindowEntry*) 0;
2129
static WindowEntry *prevWindowEntry (we, wr)
2135
if (we == wr->entries) return 0;
2136
for (wp = wr->entries; wp->next != we; wp=wp->next);
2140
static void mergeWindowEntries (old, we)
2141
WindowEntry *old, *we;
2143
if (old->y == we->y) {
2144
we->w = old->w + we->w;
2145
if (old->x < we->x) we->x = old->x;
2147
we->h = old->h + we->h;
2148
if (old->y < we->y) we->y = old->y;
2152
void RemoveWindowFromRegion (tmp_win)
2155
WindowEntry *we, *wp, *wn;
2159
if (!Scr->FirstWindowRegion) return;
2160
we = (WindowEntry*) 0;
2161
for (wl = Scr->workSpaceMgr.workSpaceList; wl != NULL; wl = wl->next) {
2162
we = findWindowEntry (wl, tmp_win, &wr);
2169
wp = prevWindowEntry (we, wr);
2172
if (wp && wp->used == 0 &&
2173
((wp->x == we->x && wp->w == we->w) ||
2174
(wp->y == we->y && wp->h == we->h))) {
2175
wp->next = we->next;
2176
mergeWindowEntries (we, wp);
2179
wp = prevWindowEntry (wp, wr);
2181
if (wn && wn->used == 0 &&
2182
((wn->x == we->x && wn->w == we->w) ||
2183
(wn->y == we->y && wn->h == we->h))) {
2184
we->next = wn->next;
2185
mergeWindowEntries (wn, we);