diff -ur twm/man/twm.man twm.new/man/twm.man --- twm/man/twm.man 2004-04-23 21:54:37.000000000 +0200 +++ twm.new/man/twm.man 2006-05-20 16:14:56.000000000 +0200 @@ -409,6 +409,9 @@ .IP "\fBIconBorderWidth\fP \fIpixels\fP" 8 This variable specifies the width in pixels of the border surrounding icon windows. The default is 2. +.IP "\fBIconMaxWidth\fP \fIpixels\fP" 8 +This variable specifies the maximum width in pixels of the icon window. +The default is 1024. .IP "\fBIconDirectory\fP \fIstring\fP" 8 This variable specifies the directory that should be searched if if a bitmap file cannot be found in any of the directories @@ -790,6 +793,9 @@ The optional \fIwin-list\fP is a list of window names and colors so that per-window colors may be specified. The default is "black". +.IP "\fBTitleIndent\fP \fIpixels\fP" 8 +This variable specifies the amount by which window name should be +indented on the left. The default is 0. .IP "\fBTitlePadding\fP \fIpixels\fP" 8 This variable specifies the distance between the various buttons, text, and highlight areas in the titlebar. The default is 8 pixels. Only in twm.new/man: twm.man~ diff -ur twm/src/add_window.c twm.new/src/add_window.c --- twm/src/add_window.c 2005-03-11 17:23:00.000000000 +0100 +++ twm.new/src/add_window.c 2006-05-20 15:26:06.000000000 +0200 @@ -1173,7 +1173,7 @@ Scr->TBInfo.leftx += Scr->ButtonIndent; Scr->TBInfo.titlex = (Scr->TBInfo.leftx + (Scr->TBInfo.nleft * buttonwidth) - Scr->TBInfo.pad + - Scr->TitlePadding); + Scr->TitlePadding + Scr->TitleIndent); if (Scr->TBInfo.nright > 0) Scr->TBInfo.rightoff += (Scr->ButtonIndent + ((Scr->TBInfo.nright * buttonwidth) - diff -ur twm/src/events.c twm.new/src/events.c --- twm/src/events.c 2005-03-11 17:23:00.000000000 +0100 +++ twm.new/src/events.c 2006-05-20 15:58:23.000000000 +0200 @@ -748,9 +748,6 @@ if (!Tmp_win) return; /* unknown window */ -#define MAX_NAME_LEN 200L /* truncate to this many */ -#define MAX_ICON_NAME_LEN 200L /* ditto */ - switch (Event.xproperty.atom) { case XA_WM_NAME: if (!I18N_FetchName(dpy, Tmp_win->w, &name)) return; @@ -922,6 +919,35 @@ } } +/*| +* RedoIconSize - procedure to re-calculate the icon size +*/ +void +RedoIconSize(Tmp_win) + TwmWindow *Tmp_win; +{ + Tmp_win->icon_w_width = MyFont_TextWidth(&Scr->IconFont, + Tmp_win->icon_name, strlen(Tmp_win->icon_name)); + + Tmp_win->icon_w_width += 8; + if (Tmp_win->icon_w_width < Tmp_win->icon_width) + { + Tmp_win->icon_x = (Tmp_win->icon_width - Tmp_win->icon_w_width)/2; + Tmp_win->icon_x += 3; + Tmp_win->icon_w_width = Tmp_win->icon_width; + } + else + { + Tmp_win->icon_x = 3; + } + + if (Tmp_win->icon_w_width > Scr->IconMaxWidth) + Tmp_win->icon_w_width = Scr->IconMaxWidth; + + Tmp_win->icon_w_height = Tmp_win->icon_height + Scr->IconFont.height + 4; + Tmp_win->icon_y = Tmp_win->icon_height + Scr->IconFont.height; +} + /** @@ -935,7 +961,7 @@ if (Tmp_win->list) { /* let the expose event cause the repaint */ - XClearArea(dpy, Tmp_win->list->w, 0,0,0,0, True); + XClearArea(dpy, Tmp_win->list->w, 0 ,0 ,0 ,0 , True); if (Scr->SortIconMgr) SortIconManager(Tmp_win->list->iconmgr); @@ -947,31 +973,15 @@ if (Tmp_win->icon_not_ours) return; - Tmp_win->icon_w_width = MyFont_TextWidth(&Scr->IconFont, - Tmp_win->icon_name, strlen(Tmp_win->icon_name)); - - Tmp_win->icon_w_width += 6; - if (Tmp_win->icon_w_width < Tmp_win->icon_width) - { - Tmp_win->icon_x = (Tmp_win->icon_width - Tmp_win->icon_w_width)/2; - Tmp_win->icon_x += 3; - Tmp_win->icon_w_width = Tmp_win->icon_width; - } - else - { - Tmp_win->icon_x = 3; - } + RedoIconSize(Tmp_win); if (Tmp_win->icon_w_width == Tmp_win->icon_width) x = 0; else - x = (Tmp_win->icon_w_width - Tmp_win->icon_width)/2; + x = (Tmp_win->icon_w_width - Tmp_win->icon_width) / 2; y = 0; - Tmp_win->icon_w_height = Tmp_win->icon_height + Scr->IconFont.height + 4; - Tmp_win->icon_y = Tmp_win->icon_height + Scr->IconFont.height; - XResizeWindow(dpy, Tmp_win->icon_w, Tmp_win->icon_w_width, Tmp_win->icon_w_height); if (Tmp_win->icon_bm_w) @@ -1051,27 +1061,59 @@ } else if (Tmp_win != NULL) { + Region new_region; + XGCValues values; + unsigned long valuemask; + int buttonwidth = (Scr->TBInfo.width + 2 * Scr->TBInfo.pad); + if (Event.xany.window == Tmp_win->title_w) { + XRectangle rect = { 0, 0, (Tmp_win->title_width - buttonwidth - Scr->BorderWidth), Tmp_win->title_height }; + MyFont_ChangeGC(Tmp_win->title.fore, Tmp_win->title.back, &Scr->TitleBarFont); + new_region = XCreateRegion(); + XUnionRectWithRegion(&rect, new_region, new_region); + XSetRegion(dpy, Scr->NormalGC, new_region); + XDestroyRegion(new_region); + MyFont_DrawString (dpy, Tmp_win->title_w, &Scr->TitleBarFont, Scr->NormalGC, Scr->TBInfo.titlex, Scr->TitleBarFont.y, Tmp_win->name, strlen(Tmp_win->name)); + + valuemask = GCClipMask; + values.clip_mask = None; + XChangeGC(dpy, Scr->NormalGC, valuemask, &values); + flush_expose (Event.xany.window); + return; } else if (Event.xany.window == Tmp_win->icon_w) { + XRectangle rect = { 4, 0, Tmp_win->icon_w_width - 8, Tmp_win->icon_w_height }; + MyFont_ChangeGC(Tmp_win->iconc.fore, Tmp_win->iconc.back, &Scr->IconFont); + new_region = XCreateRegion(); + XUnionRectWithRegion(&rect, new_region, new_region); + XSetRegion(dpy, Scr->NormalGC, new_region); + XDestroyRegion(new_region); + MyFont_DrawString (dpy, Tmp_win->icon_w, &Scr->IconFont, Scr->NormalGC, Tmp_win->icon_x, Tmp_win->icon_y, Tmp_win->icon_name, strlen(Tmp_win->icon_name)); + + valuemask = GCClipMask; + values.clip_mask = None; + XChangeGC(dpy, Scr->NormalGC, valuemask, &values); + flush_expose (Event.xany.window); return; - } else if (Tmp_win->titlebuttons) { + } + else if (Tmp_win->titlebuttons) + { int i; Window w = Event.xany.window; register TBWindow *tbw; @@ -1090,7 +1132,9 @@ } } } - if (Tmp_win->list) { + + if (Tmp_win->list) + { if (Event.xany.window == Tmp_win->list->w) { MyFont_ChangeGC(Tmp_win->list->fore, Tmp_win->list->back, @@ -1103,7 +1147,7 @@ flush_expose (Event.xany.window); return; } - if (Event.xany.window == Tmp_win->list->icon) + else if (Event.xany.window == Tmp_win->list->icon) { FB(Tmp_win->list->fore, Tmp_win->list->back); XCopyPlane(dpy, Scr->siconifyPm, Tmp_win->list->icon, @@ -1678,6 +1723,7 @@ /** * ButtonPress event handler */ + void HandleButtonPress() { diff -ur twm/src/icons.c twm.new/src/icons.c --- twm/src/icons.c 2005-03-11 17:23:00.000000000 +0100 +++ twm.new/src/icons.c 2006-05-20 16:03:23.000000000 +0200 @@ -50,6 +50,8 @@ static IconEntry * prevIconEntry ( IconEntry *ie, IconRegion *ir ); static void mergeEntries ( IconEntry *old, IconEntry *ie ); +extern void RedoIconSize(); + static void splitEntry (IconEntry *ie, int grav1, int grav2, int w, int h) { @@ -477,22 +479,7 @@ attributes.background_pixmap = pm; } - tmp_win->icon_w_width = MyFont_TextWidth(&Scr->IconFont, - tmp_win->icon_name, strlen(tmp_win->icon_name)); - - tmp_win->icon_w_width += 6; - if (tmp_win->icon_w_width < tmp_win->icon_width) - { - tmp_win->icon_x = (tmp_win->icon_width - tmp_win->icon_w_width)/2; - tmp_win->icon_x += 3; - tmp_win->icon_w_width = tmp_win->icon_width; - } - else - { - tmp_win->icon_x = 3; - } - tmp_win->icon_y = tmp_win->icon_height + Scr->IconFont.height; - tmp_win->icon_w_height = tmp_win->icon_height + Scr->IconFont.height + 4; + RedoIconSize(tmp_win); event_mask = 0; if (tmp_win->wmhints && tmp_win->wmhints->flags & IconWindowHint) @@ -500,7 +487,8 @@ tmp_win->icon_w = tmp_win->wmhints->icon_window; if (tmp_win->forced || XGetGeometry(dpy, tmp_win->icon_w, &JunkRoot, &JunkX, &JunkY, - (unsigned int *)&tmp_win->icon_w_width, (unsigned int *)&tmp_win->icon_w_height, + (unsigned int *)&tmp_win->icon_w_width, + (unsigned int *)&tmp_win->icon_w_height, &JunkBW, &JunkDepth) == 0) { tmp_win->icon_w = None; diff -ur twm/src/parse.c twm.new/src/parse.c --- twm/src/parse.c 2005-10-09 20:59:28.000000000 +0200 +++ twm.new/src/parse.c 2006-05-20 16:09:50.000000000 +0200 @@ -358,6 +358,8 @@ #define kwn_TitleButtonBorderWidth 9 #define kwn_Priority 10 #define kwn_MenuBorderWidth 11 +#define kwn_TitleIndent 12 +#define kwn_IconMaxWidth 13 #define kwcl_BorderColor 1 #define kwcl_IconManagerHighlight 2 @@ -504,6 +506,7 @@ { "iconmanagerhighlight", CLKEYWORD, kwcl_IconManagerHighlight }, { "iconmanagers", ICONMGRS, 0 }, { "iconmanagershow", ICONMGR_SHOW, 0 }, + { "iconmaxwidth", NKEYWORD, kwn_IconMaxWidth }, { "iconmgr", ICONMGR, 0 }, { "iconregion", ICON_REGION, 0 }, { "icons", ICONS, 0 }, @@ -576,6 +579,7 @@ { "titlefont", SKEYWORD, kws_TitleFont }, { "titleforeground", CLKEYWORD, kwcl_TitleForeground }, { "titlehighlight", TITLE_HILITE, 0 }, + { "titleindent", NKEYWORD, kwn_TitleIndent }, { "titlepadding", NKEYWORD, kwn_TitlePadding }, { "unknownicon", SKEYWORD, kws_UnknownIcon }, { "usepposition", SKEYWORD, kws_UsePPosition }, @@ -689,7 +693,7 @@ return 1; case kw0_RestartPreviousState: - RestartPreviousState = True; + RestartPreviousState = TRUE; return 1; case kw0_ClientBorderWidth: @@ -818,6 +822,10 @@ if (Scr->FirstTime) Scr->TitlePadding = num; return 1; + case kwn_TitleIndent: + if (Scr->FirstTime) Scr->TitleIndent = num; + return 1; + case kwn_ButtonIndent: if (Scr->FirstTime) Scr->ButtonIndent = num; return 1; @@ -834,6 +842,10 @@ if (Scr->FirstTime) Scr->MenuBorderWidth = num; return 1; + case kwn_IconMaxWidth: + if (Scr->FirstTime) Scr->IconMaxWidth = num; + return 1; + case kwn_TitleButtonBorderWidth: if (Scr->FirstTime) Scr->TBInfo.border = num; return 1; @@ -954,9 +966,9 @@ int retFormat; unsigned long nPixels, retAfter; Pixel *retProp; - pixelAtom = XInternAtom(dpy, "_MIT_PRIORITY_COLORS", True); + pixelAtom = XInternAtom(dpy, "_MIT_PRIORITY_COLORS", TRUE); XGetWindowProperty(dpy, Scr->Root, pixelAtom, 0, 8192, - False, XA_CARDINAL, &retAtom, + FALSE, XA_CARDINAL, &retAtom, &retFormat, &nPixels, &retAfter, (unsigned char **)&retProp); diff -ur twm/src/resize.c twm.new/src/resize.c --- twm/src/resize.c 2005-07-12 00:51:03.000000000 +0200 +++ twm.new/src/resize.c 2006-05-20 16:11:03.000000000 +0200 @@ -1127,7 +1127,7 @@ * * Dimensions and Positions: * - * frame orgin (0, 0) + * frame origin (0, 0) * frame upper left border (-tmp->frame_bw, -tmp->frame_bw) * frame size w/o border tmp->frame_width , tmp->frame_height * frame/title border width tmp->frame_bw diff -ur twm/src/screen.h twm.new/src/screen.h --- twm/src/screen.h 2004-04-23 21:54:37.000000000 +0200 +++ twm.new/src/screen.h 2006-05-20 16:12:12.000000000 +0200 @@ -204,12 +204,14 @@ int BorderWidth; /* border width of twm windows */ int IconBorderWidth; /* border width of icon windows */ int MenuBorderWidth; /* border width of twm menus */ + int IconMaxWidth; /* maximum width of the icon */ int UnknownWidth; /* width of the unknown icon */ int UnknownHeight; /* height of the unknown icon */ int TitleHeight; /* height of the title bar window */ TwmWindow *Focus; /* the twm window that has focus */ int EntryHeight; /* menu entry height */ int FramePadding; /* distance between decorations and border */ + int TitleIndent; /* amount to indent a text in titlebar */ int TitlePadding; /* distance between items in titlebar */ int ButtonIndent; /* amount to shrink buttons on each side */ int NumAutoRaises; /* number of autoraise windows on screen */ diff -ur twm/src/twm.c twm.new/src/twm.c --- twm/src/twm.c 2005-03-11 22:18:12.000000000 +0100 +++ twm.new/src/twm.c 2006-05-20 16:13:13.000000000 +0200 @@ -759,12 +759,14 @@ Scr->IconManagerHighlight = black; Scr->FramePadding = 2; /* values that look "nice" on */ + Scr->TitleIndent = 0; Scr->TitlePadding = 8; /* 75 and 100dpi displays */ Scr->ButtonIndent = 1; Scr->SizeStringOffset = 0; Scr->BorderWidth = BW; Scr->IconBorderWidth = BW; Scr->MenuBorderWidth = BW; + Scr->IconMaxWidth = 1024; Scr->UnknownWidth = 0; Scr->UnknownHeight = 0; Scr->NumAutoRaises = 0;