Remove TitlePadding option, hardcoding default.

I cannot ever see myself wanting to customize this distance between the
buttons. If I decide to pack them tighter or vice versa, I'll change
the TITLE_PADDING macro.

This is an early step in eliminating the TBInfo structure (screen.h).
This commit is contained in:
Mike Small 2018-11-25 23:50:24 -05:00
parent d232df77c4
commit 2a336b4f12
7 changed files with 8 additions and 18 deletions

View File

@ -576,9 +576,6 @@ may only be specified inside of a
The optional \fIwin-list\fP is a list of window names and colors so that The optional \fIwin-list\fP is a list of window names and colors so that
per-window colors may be specified. per-window colors may be specified.
The default is "black". The default is "black".
.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.
.IP "\fBUnknownIcon\fP \fIstring\fP" 8 .IP "\fBUnknownIcon\fP \fIstring\fP" 8
This variable specifies the filename of a bitmap file to be This variable specifies the filename of a bitmap file to be
used as the default icon. This bitmap will be used as the icon of all used as the default icon. This bitmap will be used as the icon of all

View File

@ -769,7 +769,7 @@ void ComputeCommonTitleOffsets (void)
Scr->TBInfo.leftx += Scr->ButtonIndent; Scr->TBInfo.leftx += Scr->ButtonIndent;
Scr->TBInfo.titlex = (Scr->TBInfo.leftx + Scr->TBInfo.titlex = (Scr->TBInfo.leftx +
(Scr->TBInfo.nleft * buttonwidth) - Scr->TBInfo.pad + (Scr->TBInfo.nleft * buttonwidth) - Scr->TBInfo.pad +
Scr->TitlePadding); TITLE_PADDING);
if (Scr->TBInfo.nright > 0) if (Scr->TBInfo.nright > 0)
Scr->TBInfo.rightoff += (Scr->ButtonIndent + Scr->TBInfo.rightoff += (Scr->ButtonIndent +
((Scr->TBInfo.nright * buttonwidth) - ((Scr->TBInfo.nright * buttonwidth) -
@ -780,13 +780,13 @@ void ComputeWindowTitleOffsets (TwmWindow *tmp_win, int width, Bool squeeze)
{ {
tmp_win->highlightx = (Scr->TBInfo.titlex + tmp_win->name_width); tmp_win->highlightx = (Scr->TBInfo.titlex + tmp_win->name_width);
if (tmp_win->hilite_w || Scr->TBInfo.nright > 0) if (tmp_win->hilite_w || Scr->TBInfo.nright > 0)
tmp_win->highlightx += Scr->TitlePadding; tmp_win->highlightx += TITLE_PADDING;
tmp_win->rightx = width - Scr->TBInfo.rightoff; tmp_win->rightx = width - Scr->TBInfo.rightoff;
if (squeeze && tmp_win->squeeze) { if (squeeze && tmp_win->squeeze) {
int rx = (tmp_win->highlightx + int rx = (tmp_win->highlightx +
(tmp_win->hilite_w (tmp_win->hilite_w
? Scr->TBInfo.width * 2 : 0) + ? Scr->TBInfo.width * 2 : 0) +
(Scr->TBInfo.nright > 0 ? Scr->TitlePadding : 0) + (Scr->TBInfo.nright > 0 ? TITLE_PADDING : 0) +
Scr->FramePadding); Scr->FramePadding);
if (rx < tmp_win->rightx) if (rx < tmp_win->rightx)
tmp_win->rightx = rx; tmp_win->rightx = rx;

View File

@ -301,8 +301,7 @@ void InitTitlebarButtons (void)
*/ */
Scr->TBInfo.width = (Scr->TitleHeight - Scr->TBInfo.width = (Scr->TitleHeight -
2 * (Scr->FramePadding + Scr->ButtonIndent)); 2 * (Scr->FramePadding + Scr->ButtonIndent));
Scr->TBInfo.pad = ((Scr->TitlePadding > 1) Scr->TBInfo.pad = (TITLE_PADDING + 1) / 2;
? ((Scr->TitlePadding + 1) / 2) : 1);
h = Scr->TBInfo.width - 2 * Scr->TBInfo.border; h = Scr->TBInfo.width - 2 * Scr->TBInfo.border;
/* /*

View File

@ -339,7 +339,6 @@ typedef struct _TwmKeyword {
#define kwn_MoveDelta 2 #define kwn_MoveDelta 2
#define kwn_XorValue 3 #define kwn_XorValue 3
#define kwn_FramePadding 4 #define kwn_FramePadding 4
#define kwn_TitlePadding 5
#define kwn_ButtonIndent 6 #define kwn_ButtonIndent 6
#define kwn_Priority 10 #define kwn_Priority 10
@ -517,7 +516,6 @@ static TwmKeyword keytable[] = {
{ "titlebackground", CLKEYWORD, kwcl_TitleBackground }, { "titlebackground", CLKEYWORD, kwcl_TitleBackground },
{ "titlefont", SKEYWORD, kws_TitleFont }, { "titlefont", SKEYWORD, kws_TitleFont },
{ "titleforeground", CLKEYWORD, kwcl_TitleForeground }, { "titleforeground", CLKEYWORD, kwcl_TitleForeground },
{ "titlepadding", NKEYWORD, kwn_TitlePadding },
{ "unknownicon", SKEYWORD, kws_UnknownIcon }, { "unknownicon", SKEYWORD, kws_UnknownIcon },
{ "w", WINDOW, 0 }, { "w", WINDOW, 0 },
{ "wait", WAIT, 0 }, { "wait", WAIT, 0 },
@ -709,10 +707,6 @@ int do_number_keyword (int keyword, int num)
if (Scr->FirstTime) Scr->FramePadding = num; if (Scr->FirstTime) Scr->FramePadding = num;
return 1; return 1;
case kwn_TitlePadding:
if (Scr->FirstTime) Scr->TitlePadding = num;
return 1;
case kwn_ButtonIndent: case kwn_ButtonIndent:
if (Scr->FirstTime) Scr->ButtonIndent = num; if (Scr->FirstTime) Scr->ButtonIndent = num;
return 1; return 1;

View File

@ -848,7 +848,7 @@ void SetupFrame (TwmWindow *tmp_win, int x, int y, int w, int h, int bw, Bool se
if (tmp_win->title_height && tmp_win->hilite_w) if (tmp_win->title_height && tmp_win->hilite_w)
{ {
xwc.width = (tmp_win->rightx - tmp_win->highlightx); xwc.width = (tmp_win->rightx - tmp_win->highlightx);
if (Scr->TBInfo.nright > 0) xwc.width -= Scr->TitlePadding; if (Scr->TBInfo.nright > 0) xwc.width -= TITLE_PADDING;
if (xwc.width <= 0) { if (xwc.width <= 0) {
xwc.x = Scr->MyDisplayWidth; /* move offscreen */ xwc.x = Scr->MyDisplayWidth; /* move offscreen */
xwc.width = 1; xwc.width = 1;

View File

@ -49,6 +49,8 @@ typedef struct _StdCmap {
#define SIZE_HINDENT 10 #define SIZE_HINDENT 10
#define SIZE_VINDENT 2 #define SIZE_VINDENT 2
/* distance between items in titlebar */
#define TITLE_PADDING 8
typedef struct _TitlebarPixmaps { typedef struct _TitlebarPixmaps {
Pixmap xlogo; Pixmap xlogo;
@ -186,7 +188,6 @@ typedef struct ScreenInfo
TwmWindow *Focus; /* the twm window that has focus */ TwmWindow *Focus; /* the twm window that has focus */
int EntryHeight; /* menu entry height */ int EntryHeight; /* menu entry height */
int FramePadding; /* distance between decorations and border */ int FramePadding; /* distance between decorations and border */
int TitlePadding; /* distance between items in titlebar */
int ButtonIndent; /* amount to shrink buttons on each side */ int ButtonIndent; /* amount to shrink buttons on each side */
int NumAutoRaises; /* number of autoraise windows on screen */ int NumAutoRaises; /* number of autoraise windows on screen */
short NoDefaults; /* do not add in default UI stuff */ short NoDefaults; /* do not add in default UI stuff */

View File

@ -693,8 +693,7 @@ InitVariables(void)
&Scr->PointerBackground); &Scr->PointerBackground);
Scr->FramePadding = 2; /* values that look "nice" on */ Scr->FramePadding = 2; /* values that look "nice" on */
Scr->TitlePadding = 8; /* 75 and 100dpi displays */ Scr->ButtonIndent = 0; /* 75 and 100dpi displays */
Scr->ButtonIndent = 0;
Scr->SizeStringOffset = 0; Scr->SizeStringOffset = 0;
Scr->UnknownWidth = 0; Scr->UnknownWidth = 0;
Scr->UnknownHeight = 0; Scr->UnknownHeight = 0;