Remove border widths, title button indent and random placement options.

I use the default border width, 2 pixels.  I use "random" placement
instead of the manually sized grid at window creation.

Also get rid of the Clientborderwidth and respect existing window
border widths unless they are zero.

I got rid of the title button borders and made the buttons use as
much space as available. The resize button looked odd so I added
one more pair of line segments that more or less match up with where
the old right and bottom border would have been.
This commit is contained in:
Mike Small 2018-09-06 21:22:43 -04:00
parent 4de2773058
commit d232df77c4
11 changed files with 48 additions and 137 deletions

View File

@ -56,7 +56,7 @@ a session manager, \fItwmruined\fP is frequently executed in the foreground
as the last client. When run this way, exiting \fItwmruined\fP causes the
session to be terminated (i.e., logged out).
.PP
By default, application windows are surrounded by a ``frame'' with a
Application windows are surrounded by a ``frame'' with a
titlebar at the top and a special border around the window. The titlebar
contains the window's name, a rectangle that is lit when the window is
receiving keyboard input, and function boxes known as ``titlebuttons'' at
@ -79,19 +79,8 @@ when the outline is in the desired position. Just
clicking in the title or highlight region raises the window without moving it.
.PP
When new windows are created, \fItwmruined\fP will honor any size and location
information requested by the user (usually through \fI-geometry\fP
information requested by the user (usually through a \fI-geometry\fP
command line argument or resources for the individual applications).
Otherwise, an outline of the window's default size, its titlebar, and lines
dividing the
window into a 3x3 grid that track the pointer are displayed.
Clicking pointer Button1
will position the window at the current position and give it the default
size. Pressing pointer Button2 (usually the middle pointer button)
and dragging the outline
will give the window its current position but allow the sides to be resized as
described above. Clicking pointer Button3 (usually the right pointer button)
will give the window its current position but attempt to make it long enough
to touch the bottom the screen.
.SH OPTIONS
\fITwmruined\fP accepts the following command line options:
.PP
@ -145,7 +134,7 @@ Widgets\fP manual and \fIxrdb(__appmansuffix__)\fP).
\fITwmruined\fP startup files are logically broken up into three types of
specifications: \fIVariables\fP, \fIBindings\fP, \fIMenus\fP. The
\fIVariables\fP section must come first and is used to describe the
fonts, colors, cursors, border widths, icon and window placement, highlighting,
fonts, colors, cursors, icon and window placement, highlighting,
autoraising, layout of titles, and warping.
The \fIBindings\fP section usually comes second and is used to specify
the functions that should be
@ -252,21 +241,6 @@ This variable specifies the default foreground color in the gray pattern
used in unhighlighted borders, and may only be given within a
\fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The optional \fIwincolorlist\fP allows
per-window colors to be specified. The default is "black".
.IP "\fBBorderWidth\fP \fIpixels\fP" 8
This variable specifies the width in pixels of the border surrounding
all client window frames if \fBClientBorderWidth\fP has not been specified.
This value is also used to set the border size of windows created by \fItwmruined\fP. The
default is 2.
.IP "\fBButtonIndent\fP \fIpixels\fP" 8
This variable specifies the amount by which titlebuttons should be
indented on all sides. Positive values cause the buttons to be smaller than
the window text and highlight area so that they stand out. Setting this
and the \fBTitleButtonBorderWidth\fP variables to 0 makes titlebuttons be as
tall and wide as possible. The default is 1.
.IP "\fBClientBorderWidth\fP" 8
This variable indicates that border width of a window's frame should be set to
the initial border width of the window, rather than to the value of
\fBBorderWidth\fP.
.IP "\fBColor\fP { \fIcolors-list\fP }" 8
This variable specifies a list of color assignments to be made if the default
display is capable of displaying more than simple black and white. The
@ -386,9 +360,6 @@ The optional \fIwin-list\fP is a list of window names and colors so that
per-window colors may be specified. See the \fBBorderColor\fP
variable for a complete description of the \fIwin-list\fP.
The default is "black".
.IP "\fBIconBorderWidth\fP \fIpixels\fP" 8
This variable specifies the width in pixels of the border surrounding
icon windows. The default is 2.
.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
@ -467,9 +438,6 @@ and can only be specified inside of a
This variable specifies the color of the menu border and can only be specified
inside of a
\fBColor\fP, \fBGrayscale\fP or \fBMonochrome\fP list. The default is "black".
.IP "\fBMenuBorderWidth\fP \fIpixels\fP" 8
This variable specifies the width in pixels of the border surrounding
menu windows. The default is 2.
.IP "\fBMenuFont\fP \fIstring\fP" 8
This variable specifies the font to use when displaying menus. The default
is "variable".
@ -598,11 +566,6 @@ and may only be specified inside of a
The optional \fIwin-list\fP is a list of window names and colors so that
per-window colors may be specified.
The default is "white".
.IP "\fBTitleButtonBorderWidth\fP \fIpixels\fP" 8
This variable specifies the width in pixels of the border surrounding
titlebuttons. This is typically set to 0 to allow titlebuttons to take up as
much space as possible and to not have a border.
The default is 1.
.IP "\fBTitleFont\fP \fIstring\fP" 8
This variable specifies the font to be used for displaying window names in
titlebars. The default is "variable".

View File

@ -119,7 +119,7 @@ GetGravityOffsets (TwmWindow *tmp, int *xp, int *yp)
{ 1, 1 }, /* SouthEastGravity */
{ 0, 0 }, /* StaticGravity */
};
register int g = ((tmp->hints.flags & PWinGravity)
int g = ((tmp->hints.flags & PWinGravity)
? tmp->hints.win_gravity : NorthWestGravity);
if (g < ForgetGravity || g > StaticGravity) {
@ -149,7 +149,6 @@ AddWindow(Window w)
int random_placement; /* don't know where to put the window */
int gravx, gravy; /* gravity signs for positioning */
int namelen;
int bw2;
short saved_x, saved_y, restore_icon_x, restore_icon_y;
unsigned short saved_width, saved_height;
Bool restore_iconified = 0;
@ -276,7 +275,8 @@ AddWindow(Window w)
tmp_win->auto_raise = (short)(long) LookInList(Scr->AutoRaise,
tmp_win->full_name,
&tmp_win->class);
if (tmp_win->auto_raise) Scr->NumAutoRaises++;
if (tmp_win->auto_raise)
Scr->NumAutoRaises++;
if (LookInList(Scr->WindowRingL, tmp_win->full_name, &tmp_win->class)) {
if (Scr->Ring) {
@ -293,14 +293,8 @@ AddWindow(Window w)
tmp_win->ring.cursor_valid = False;
tmp_win->squeeze = HasShape;
tmp_win->old_bw = tmp_win->attr.border_width;
if (Scr->ClientBorderWidth) {
tmp_win->old_bw = tmp_win->attr.border_width ? tmp_win->attr.border_width : BW;
tmp_win->frame_bw = tmp_win->old_bw;
} else {
tmp_win->frame_bw = Scr->BorderWidth;
}
bw2 = tmp_win->frame_bw * 2;
tmp_win->title_height = Scr->TitleHeight + tmp_win->frame_bw;
if (Scr->NoTitlebar)
@ -375,7 +369,6 @@ AddWindow(Window w)
if (gravy < 0) tmp_win->attr.y -= gravy * tmp_win->title_height;
}
#ifdef DEBUG
fprintf(stderr, " position window %d, %d %dx%d\n",
tmp_win->attr.x,
@ -383,17 +376,15 @@ AddWindow(Window w)
tmp_win->attr.width,
tmp_win->attr.height);
#endif
if (!Scr->ClientBorderWidth) { /* need to adjust for twm borders */
/* need to adjust for twm borders */
int delta = tmp_win->attr.border_width - tmp_win->frame_bw;
if (delta > 0) {
tmp_win->attr.x += gravx * delta;
tmp_win->attr.y += gravy * delta;
}
tmp_win->title_width = tmp_win->attr.width;
if (tmp_win->old_bw) XSetWindowBorderWidth(dpy, tmp_win->w, 0);
tmp_win->name_width = MyFont_TextWidth(&Scr->TitleBarFont, tmp_win->name,
namelen);

View File

@ -1475,10 +1475,10 @@ HandleButtonRelease(void)
}
else
{
xl = Event.xbutton.x_root - DragX - Scr->IconBorderWidth;
yt = Event.xbutton.y_root - DragY - Scr->IconBorderWidth;
w = DragWidth + 2 * Scr->IconBorderWidth;
h = DragHeight + 2 * Scr->IconBorderWidth;
xl = Event.xbutton.x_root - DragX - BW;
yt = Event.xbutton.y_root - DragY - BW;
w = DragWidth + BW2;
h = DragHeight + BW2;
}
if (ConstMove)
@ -2235,7 +2235,7 @@ HandleConfigureRequest(void)
if (cre->value_mask & CWBorderWidth) {
int bwdelta = cre->border_width - Tmp_win->old_bw; /* posit growth */
if (bwdelta && Scr->ClientBorderWidth) { /* if change allowed */
if (bwdelta) {
x += gravx * bwdelta; /* change default values only */
y += gravy * bwdelta; /* ditto */
bw = cre->border_width;

View File

@ -39,8 +39,8 @@ in this Software without prior written authorization from The Open Group.
#include "parse.h"
#include "util.h"
#define iconWidth(w) (Scr->IconBorderWidth * 2 + w->icon_w_width)
#define iconHeight(w) (Scr->IconBorderWidth * 2 + w->icon_w_height)
#define iconWidth(w) (BW2 + w->icon_w_width)
#define iconHeight(w) (BW2 + w->icon_w_height)
static void splitEntry ( IconEntry *ie, int grav1, int grav2, int w, int h );
static IconEntry * FindIconEntry ( TwmWindow *tmp_win, IconRegion **irp );
@ -519,7 +519,7 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y)
tmp_win->icon_w = XCreateSimpleWindow(dpy, Scr->Root,
0,0,
tmp_win->icon_w_width, tmp_win->icon_w_height,
Scr->IconBorderWidth, tmp_win->icon_border, tmp_win->iconc.back);
BW, tmp_win->icon_border, tmp_win->iconc.back);
event_mask = ExposureMask;
}
@ -563,12 +563,11 @@ CreateIconWindow(TwmWindow *tmp_win, int def_x, int def_y)
}
if (final_x > Scr->MyDisplayWidth)
final_x = Scr->MyDisplayWidth - tmp_win->icon_w_width -
(2 * Scr->IconBorderWidth);
final_x = Scr->MyDisplayWidth - tmp_win->icon_w_width - BW2;
if (final_y > Scr->MyDisplayHeight)
final_y = Scr->MyDisplayHeight - tmp_win->icon_height -
Scr->IconFont.height - 4 - (2 * Scr->IconBorderWidth);
Scr->IconFont.height - 4 - BW2;
XMoveWindow(dpy, tmp_win->icon_w, final_x, final_y);
tmp_win->iconified = TRUE;

View File

@ -841,7 +841,7 @@ MakeMenu(MenuRoot *mr)
}
mr->w = XCreateWindow (dpy, Scr->Root, 0, 0, (unsigned int) mr->width,
(unsigned int) mr->height,
(unsigned int) Scr->MenuBorderWidth,
(unsigned int) BW,
CopyFromParent, (unsigned int) CopyFromParent,
(Visual *) CopyFromParent,
valuemask, &attributes);

View File

@ -322,7 +322,6 @@ typedef struct _TwmKeyword {
#define kw0_NoBackingStore 15
#define kw0_NoSaveUnders 16
#define kw0_RestartPreviousState 17
#define kw0_ClientBorderWidth 18
#define kw0_NoTitleFocus 19
#define kw0_DecorateTransients 21
#define kw0_NoRaiseOnWarp 24
@ -342,11 +341,7 @@ typedef struct _TwmKeyword {
#define kwn_FramePadding 4
#define kwn_TitlePadding 5
#define kwn_ButtonIndent 6
#define kwn_BorderWidth 7
#define kwn_IconBorderWidth 8
#define kwn_TitleButtonBorderWidth 9
#define kwn_Priority 10
#define kwn_MenuBorderWidth 11
#define kwcl_BorderColor 1
#define kwcl_BorderTileForeground 3
@ -381,12 +376,10 @@ static TwmKeyword keytable[] = {
{ "bordercolor", CLKEYWORD, kwcl_BorderColor },
{ "bordertilebackground", CLKEYWORD, kwcl_BorderTileBackground },
{ "bordertileforeground", CLKEYWORD, kwcl_BorderTileForeground },
{ "borderwidth", NKEYWORD, kwn_BorderWidth },
{ "button", BUTTON, 0 },
{ "buttonindent", NKEYWORD, kwn_ButtonIndent },
{ "c", CONTROL, 0 },
{ "center", JKEYWORD, J_CENTER },
{ "clientborderwidth", KEYWORD, kw0_ClientBorderWidth },
{ "color", COLOR, 0 },
{ "constrainedmovetime", NKEYWORD, kwn_ConstrainedMoveTime },
{ "control", CONTROL, 0 },
@ -463,7 +456,6 @@ static TwmKeyword keytable[] = {
{ "icon", ICON, 0 },
{ "iconbackground", CLKEYWORD, kwcl_IconBackground },
{ "iconbordercolor", CLKEYWORD, kwcl_IconBorderColor },
{ "iconborderwidth", NKEYWORD, kwn_IconBorderWidth },
{ "icondirectory", SKEYWORD, kws_IconDirectory },
{ "iconfont", SKEYWORD, kws_IconFont },
{ "iconforeground", CLKEYWORD, kwcl_IconForeground },
@ -480,7 +472,6 @@ static TwmKeyword keytable[] = {
{ "menu", MENU, 0 },
{ "menubackground", CKEYWORD, kwc_MenuBackground },
{ "menubordercolor", CKEYWORD, kwc_MenuBorderColor },
{ "menuborderwidth", NKEYWORD, kwn_MenuBorderWidth },
{ "menufont", SKEYWORD, kws_MenuFont },
{ "menuforeground", CKEYWORD, kwc_MenuForeground },
{ "menushadowcolor", CKEYWORD, kwc_MenuShadowColor },
@ -524,7 +515,6 @@ static TwmKeyword keytable[] = {
{ "t", TITLE, 0 },
{ "title", TITLE, 0 },
{ "titlebackground", CLKEYWORD, kwcl_TitleBackground },
{ "titlebuttonborderwidth", NKEYWORD, kwn_TitleButtonBorderWidth },
{ "titlefont", SKEYWORD, kws_TitleFont },
{ "titleforeground", CLKEYWORD, kwcl_TitleForeground },
{ "titlepadding", NKEYWORD, kwn_TitlePadding },
@ -630,10 +620,6 @@ int do_single_keyword (int keyword)
RestartPreviousState = True;
return 1;
case kw0_ClientBorderWidth:
if (Scr->FirstTime) Scr->ClientBorderWidth = TRUE;
return 1;
case kw0_NoTitleFocus:
Scr->TitleFocus = FALSE;
return 1;
@ -731,22 +717,6 @@ int do_number_keyword (int keyword, int num)
if (Scr->FirstTime) Scr->ButtonIndent = num;
return 1;
case kwn_BorderWidth:
if (Scr->FirstTime) Scr->BorderWidth = num;
return 1;
case kwn_IconBorderWidth:
if (Scr->FirstTime) Scr->IconBorderWidth = num;
return 1;
case kwn_MenuBorderWidth:
if (Scr->FirstTime) Scr->MenuBorderWidth = num;
return 1;
case kwn_TitleButtonBorderWidth:
if (Scr->FirstTime) Scr->TBInfo.border = num;
return 1;
case kwn_Priority:
if (HasSync) XSyncSetPriority(dpy, /*self*/ None, num);
return 1;

View File

@ -180,9 +180,6 @@ typedef struct ScreenInfo
const char *IconDirectory; /* icon directory to search */
int SizeStringOffset; /* x offset in size window for drawing */
int SizeStringWidth; /* minimum width of size window */
int BorderWidth; /* border width of twm windows */
int IconBorderWidth; /* border width of icon windows */
int MenuBorderWidth; /* border width of twm menus */
int UnknownWidth; /* width of the unknown icon */
int UnknownHeight; /* height of the unknown icon */
int TitleHeight; /* height of the title bar window */
@ -214,7 +211,6 @@ typedef struct ScreenInfo
short ZoomCount; /* zoom outline count */
short Shadow; /* show the menu shadow */
short InterpolateMenuColors;/* make pretty menus */
short ClientBorderWidth; /* respect client window border width */
short HaveFonts; /* set if fonts have been loaded */
short FirstTime; /* first time we've read .twmrc */
short CaseSensitive; /* be case-sensitive when sorting names */

View File

@ -15,7 +15,6 @@ TitleFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*"
ResizeFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*"
MenuFont "-adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-*"
IconFont "-adobe-helvetica-bold-r-normal--*-100-*-*-*-*-*-*"
#ClientBorderWidth
Color
{

View File

@ -476,7 +476,7 @@ main(int argc, char *argv[])
Scr->TBInfo.nleft = Scr->TBInfo.nright = 0;
Scr->TBInfo.head = NULL;
Scr->TBInfo.border = 1;
Scr->TBInfo.border = 0;
Scr->TBInfo.width = 0;
Scr->TBInfo.leftx = 0;
Scr->TBInfo.titlex = 0;
@ -694,11 +694,8 @@ InitVariables(void)
Scr->FramePadding = 2; /* values that look "nice" on */
Scr->TitlePadding = 8; /* 75 and 100dpi displays */
Scr->ButtonIndent = 1;
Scr->ButtonIndent = 0;
Scr->SizeStringOffset = 0;
Scr->BorderWidth = BW;
Scr->IconBorderWidth = BW;
Scr->MenuBorderWidth = BW;
Scr->UnknownWidth = 0;
Scr->UnknownHeight = 0;
Scr->NumAutoRaises = 0;
@ -724,7 +721,6 @@ InitVariables(void)
Scr->ZoomCount = 8;
Scr->Shadow = TRUE;
Scr->InterpolateMenuColors = FALSE;
Scr->ClientBorderWidth = FALSE;
Scr->FirstRegion = NULL;
Scr->LastRegion = NULL;
Scr->FirstTime = TRUE;
@ -780,23 +776,11 @@ RestoreWithdrawnLocation (TwmWindow *tmp)
if (bw != tmp->old_bw) {
int xoff, yoff;
if (!Scr->ClientBorderWidth) {
xoff = gravx;
yoff = gravy;
} else {
xoff = 0;
yoff = 0;
}
xwc.x -= (xoff + 1) * tmp->old_bw;
xwc.y -= (yoff + 1) * tmp->old_bw;
}
if (!Scr->ClientBorderWidth) {
xwc.x += gravx * tmp->frame_bw;
xwc.y += gravy * tmp->frame_bw;
}
mask = (CWX | CWY);
if (bw != tmp->old_bw) {
xwc.border_width = tmp->old_bw;

View File

@ -851,6 +851,15 @@ CreateResizePixmap (unsigned *widthp, unsigned *heightp)
points[2].y = w;
XDrawLines(dpy, Scr->tbpm.resize, gc, points, 3, CoordModeOrigin);
w = h - 1;
points[0].x = w;
points[0].y = 0;
points[1].x = w;
points[1].y = w;
points[2].x = 0;
points[2].y = w;
XDrawLines(dpy, Scr->tbpm.resize, gc, points, 3, CoordModeOrigin);
/*
* done drawing
*/