Quoth Carlos R. Mafra,
A long time ago I received a patch from Michael Shigorin that
was trying to implement this. He said the patch was broken and
I never had the time to look at this (since I personally don't
care that much).
I took a look at this. In fact I ended up writing a few patches from
scratch before looking at Michael's work and it turned out that what I'd
done was very similar to the original patch.
The part that's broken is getting WPrefs to draw the graphics to
select the colour you want to change. I didn't make much progress with
that.
The underlying functionality is in, however. You can change the
border colour for both normal and Selected windows, as well as the
border width. It was easy to make that configurable so why not? Edit
the Defaults file or use wdwrite as described in the NEWS file.
Settings will be saved with getstyle. Borders will be drawn properly
under a composited desktop.From 1e3135a5c9e3e7351c1ebaec863bdcbb3cb3969c Mon Sep 17 00:00:00 2001
From: Iain Patterson <[email protected]>
Date: Mon, 25 Mar 2013 21:28:21 +0000
Subject: [PATCH 1/6] Added wGetColorForColormap().
Abstract the wGetColor() function to operate on any colormap not just
the screen colormap.
---
src/resources.c | 11 ++++++++---
src/resources.h | 1 +
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/resources.c b/src/resources.c
index aee511b..3d7ba65 100644
--- a/src/resources.c
+++ b/src/resources.c
@@ -35,19 +35,24 @@
#include "resources.h"
#include "screen.h"
-int wGetColor(WScreen * scr, char *color_name, XColor * color)
+int wGetColorForColormap(Colormap colormap, char *color_name, XColor * color)
{
- if (!XParseColor(dpy, scr->w_colormap, color_name, color)) {
+ if (!XParseColor(dpy, colormap, color_name, color)) {
wwarning(_("could not parse color \"%s\""), color_name);
return False;
}
- if (!XAllocColor(dpy, scr->w_colormap, color)) {
+ if (!XAllocColor(dpy, colormap, color)) {
wwarning(_("could not allocate color \"%s\""), color_name);
return False;
}
return True;
}
+int wGetColor(WScreen * scr, char *color_name, XColor * color)
+{
+ return wGetColorForColormap(scr->w_colormap, color_name, color);
+}
+
void wFreeColor(WScreen * scr, unsigned long pixel)
{
if (pixel != scr->white_pixel && pixel != scr->black_pixel) {
diff --git a/src/resources.h b/src/resources.h
index 90aab34..bbc9278 100644
--- a/src/resources.h
+++ b/src/resources.h
@@ -21,6 +21,7 @@
#ifndef WMRESOURCES_H_
#define WMRESOURCES_H_
+int wGetColorForColormap(Colormap colormap, char *color_name, XColor *color);
int wGetColor(WScreen *scr, char *color_name, XColor *color);
void wFreeColor(WScreen *scr, unsigned long pixel);
--
1.8.1.4
From 83a6260126542bc0f6a0e475bca1cc72e70d521e Mon Sep 17 00:00:00 2001
From: Iain Patterson <[email protected]>
Date: Mon, 25 Mar 2013 21:29:48 +0000
Subject: [PATCH 2/6] Use wGetColorForColormap() when allocating border pixel.
Cut down on code duplication by using the new wGetColorForColormap()
function in allocFrameBorderPixel().
---
src/framewin.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/src/framewin.c b/src/framewin.c
index 67cda92..8413c2a 100644
--- a/src/framewin.c
+++ b/src/framewin.c
@@ -34,6 +34,7 @@
#include "WindowMaker.h"
#include "GNUstep.h"
#include "texture.h"
+#include "resources.h"
#include "screen.h"
#include "wcore.h"
#include "framewin.h"
@@ -65,14 +66,8 @@ static void allocFrameBorderPixel(Colormap colormap, char
*color_name, unsigned
*pixel = NULL;
- if (!XParseColor(dpy, colormap, color_name, &xcol)) {
- wwarning(_("could not parse color \"%s\""), color_name);
+ if (! wGetColorForColormap(colormap, color_name, &xcol))
return;
- }
- if (!XAllocColor(dpy, colormap, &xcol)) {
- wwarning(_("could not allocate color \"%s\""), color_name);
- return;
- }
*pixel = wmalloc(sizeof(unsigned long));
if (*pixel)
--
1.8.1.4
From 37451dd805b192a06b80dc573b70cc79211bce89 Mon Sep 17 00:00:00 2001
From: Iain Patterson <[email protected]>
Date: Mon, 25 Mar 2013 22:14:30 +0000
Subject: [PATCH 3/6] Make window border colours configurable.
Use the new preferences FrameBorderColor and FrameSelectedBorderColor to
set the border colour of frame windows and selected frame windows
respectively.
---
src/defaults.c | 30 ++++++++++++++++++++++++++++++
src/framewin.c | 15 +++++++++++----
src/framewin.h | 1 +
src/screen.c | 16 +++++++++-------
src/screen.h | 4 ++++
src/wconfig.h.in | 3 ---
src/window.c | 2 ++
util/getstyle.c | 2 ++
8 files changed, 59 insertions(+), 14 deletions(-)
diff --git a/src/defaults.c b/src/defaults.c
index f04e9be..490242d 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -122,6 +122,8 @@ static int setMenuTextFont();
static int setIconTitleFont();
static int setIconTitleColor();
static int setIconTitleBack();
+static int setFrameBorderColor();
+static int setFrameSelectedBorderColor();
static int setLargeDisplayFont();
static int setWTitleColor();
static int setFTitleBack();
@@ -181,6 +183,8 @@ static int setCursor();
#define REFRESH_ICON_TITLE_COLOR (1<<13)
#define REFRESH_ICON_TITLE_BACK (1<<14)
+#define REFRESH_FRAME_BORDER REFRESH_MENU_FONT|REFRESH_WINDOW_FONT
+
static WOptionEnumeration seFocusModes[] = {
{"Manual", WKF_CLICK, 0}, {"ClickToFocus", WKF_CLICK, 1},
{"Sloppy", WKF_SLOPPY, 0}, {"SemiAuto", WKF_SLOPPY, 1}, {"Auto",
WKF_SLOPPY, 1},
@@ -538,6 +542,10 @@ WDefaultEntry optionList[] = {
NULL, getPropList, setSwPOptions, NULL, NULL},
{"ModifierKeyLabels", "(\"Shift+\", \"Ctrl+\", \"Mod1+\", \"Mod2+\",
\"Mod3+\", \"Mod4+\", \"Mod5+\")", &wPreferences,
NULL, getPropList, setModifierKeyLabels, NULL, NULL},
+ {"FrameBorderColor", "black", NULL,
+ NULL, getColor, setFrameBorderColor, NULL, NULL},
+ {"FrameSelectedBorderColor", "white", NULL,
+ NULL, getColor, setFrameSelectedBorderColor, NULL, NULL},
/* keybindings */
@@ -2576,6 +2584,28 @@ static int setIconTitleBack(WScreen * scr, WDefaultEntry
* entry, XColor * color
return REFRESH_ICON_TITLE_BACK;
}
+static int setFrameBorderColor(WScreen * scr, WDefaultEntry * entry, XColor *
color, void *foo)
+{
+ if (scr->frame_border_color)
+ WMReleaseColor(scr->frame_border_color);
+ scr->frame_border_color = WMCreateRGBColor(scr->wmscreen, color->red,
color->green, color->blue, True);
+
+ wFreeColor(scr, color->pixel);
+
+ return REFRESH_FRAME_BORDER;
+}
+
+static int setFrameSelectedBorderColor(WScreen * scr, WDefaultEntry * entry,
XColor * color, void *foo)
+{
+ if (scr->frame_selected_border_color)
+ WMReleaseColor(scr->frame_selected_border_color);
+ scr->frame_selected_border_color = WMCreateRGBColor(scr->wmscreen,
color->red, color->green, color->blue, True);
+
+ wFreeColor(scr, color->pixel);
+
+ return REFRESH_FRAME_BORDER;
+}
+
static void trackDeadProcess(pid_t pid, unsigned char status, WScreen * scr)
{
close(scr->helper_fd);
diff --git a/src/framewin.c b/src/framewin.c
index 8413c2a..1ce3b58 100644
--- a/src/framewin.c
+++ b/src/framewin.c
@@ -104,8 +104,6 @@ WFrameWindow *wFrameWindowCreate(WScreen * scr, int wlevel,
int x, int y,
fwin->depth = depth;
fwin->visual = visual;
fwin->colormap = colormap;
- allocFrameBorderPixel(fwin->colormap, FRAME_BORDER_COLOR,
&fwin->border_pixel);
- allocFrameBorderPixel(fwin->colormap, FRAME_SELECTED_BORDER_COLOR,
&fwin->selected_border_pixel);
fwin->core = wCoreCreateTopLevel(scr, x, y, width, height, (flags &
WFF_BORDER)
? FRAME_BORDER_WIDTH : 0, fwin->depth,
fwin->visual, fwin->colormap, scr->frame_border_pixel);
@@ -415,8 +413,17 @@ void wFrameWindowUpdateBorders(WFrameWindow * fwin, int
flags)
checkTitleSize(fwin);
- if (fwin->border_pixel)
- XSetWindowBorder(dpy, fwin->core->window, *fwin->border_pixel);
+ allocFrameBorderPixel(fwin->colormap,
WMGetColorRGBDescription(scr->frame_border_color), &fwin->border_pixel);
+ allocFrameBorderPixel(fwin->colormap,
WMGetColorRGBDescription(scr->frame_selected_border_color),
&fwin->selected_border_pixel);
+
+ if (flags & WFF_SELECTED) {
+ if (fwin->selected_border_pixel)
+ XSetWindowBorder(dpy, fwin->core->window,
*fwin->selected_border_pixel);
+ }
+ else {
+ if (fwin->border_pixel)
+ XSetWindowBorder(dpy, fwin->core->window,
*fwin->border_pixel);
+ }
}
void wFrameWindowDestroy(WFrameWindow * fwin)
diff --git a/src/framewin.h b/src/framewin.h
index d893cd1..b87845b 100644
--- a/src/framewin.h
+++ b/src/framewin.h
@@ -40,6 +40,7 @@
#ifdef XKB_BUTTON_HINT
#define WFF_LANGUAGE_BUTTON (1<<6)
#endif
+#define WFF_SELECTED (1<<7)
#define WFF_IS_SHADED (1<<16)
diff --git a/src/screen.c b/src/screen.c
index bc8f3fa..4911b1c 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -653,13 +653,6 @@ WScreen *wScreenInit(int screen_number)
scr->light_pixel = WMColorPixel(scr->gray);
scr->dark_pixel = WMColorPixel(scr->darkGray);
- {
- XColor xcol;
- /* frame boder color */
- wGetColor(scr, FRAME_BORDER_COLOR, &xcol);
- scr->frame_border_pixel = xcol.pixel;
- }
-
/* create GCs with default values */
allocGCs(scr);
@@ -671,6 +664,15 @@ WScreen *wScreenInit(int screen_number)
/* read defaults for this screen */
wReadDefaults(scr, WDWindowMaker->dictionary);
+ {
+ XColor xcol;
+ /* frame boder color */
+ wGetColor(scr,
WMGetColorRGBDescription(scr->frame_border_color), &xcol);
+ scr->frame_border_pixel = xcol.pixel;
+ wGetColor(scr,
WMGetColorRGBDescription(scr->frame_selected_border_color), &xcol);
+ scr->frame_selected_border_pixel = xcol.pixel;
+ }
+
createInternalWindows(scr);
wNETWMInitStuff(scr);
diff --git a/src/screen.h b/src/screen.h
index 52a0c42..b4cbddf 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -167,8 +167,12 @@ typedef struct _WScreen {
WMColor *mtext_color; /* menu item text */
WMColor *dtext_color; /* disabled menu item text */
+ WMColor *frame_border_color;
+ WMColor *frame_selected_border_color;
+
WMPixel line_pixel;
WMPixel frame_border_pixel; /* frame border */
+ WMPixel frame_selected_border_pixel;/* frame border */
union WTexture *menu_title_texture[3];/* menu titlebar texture (tex, -, -)
*/
diff --git a/src/wconfig.h.in b/src/wconfig.h.in
index c21638d..70f583d 100644
--- a/src/wconfig.h.in
+++ b/src/wconfig.h.in
@@ -341,9 +341,6 @@
/* don't put titles in miniwindows */
#undef NO_MINIWINDOW_TITLES
-#define FRAME_BORDER_COLOR "black"
-#define FRAME_SELECTED_BORDER_COLOR "white"
-
/* for boxes with high mouse sampling rates (SGI) */
#define DELAY_BETWEEN_MOUSE_SAMPLING 10
diff --git a/src/window.c b/src/window.c
index 6c2ae26..aad3fe0 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2198,6 +2198,8 @@ void wWindowConfigureBorders(WWindow *wwin)
flags |= WFF_BORDER;
if (wwin->flags.shaded)
flags |= WFF_IS_SHADED;
+ if (wwin->flags.selected)
+ flags |= WFF_SELECTED;
oldh = wwin->frame->top_width;
wFrameWindowUpdateBorders(wwin->frame, flags);
diff --git a/util/getstyle.c b/util/getstyle.c
index bde802d..3caa315 100644
--- a/util/getstyle.c
+++ b/util/getstyle.c
@@ -86,6 +86,8 @@ static char *options[] = {
"IconBack",
"IconTitleColor",
"IconTitleBack",
+ "FrameBorderColor",
+ "FrameSelectedBorderColor",
"MenuStyle",
"WindowTitleExtendSpace",
"MenuTitleExtendSpace",
--
1.8.1.4
From 542cf6d49497a0a3a0b945872f64a27789df7253 Mon Sep 17 00:00:00 2001
From: Iain Patterson <[email protected]>
Date: Tue, 26 Mar 2013 07:01:08 +0000
Subject: [PATCH 4/6] Make window border size configurable.
Use the new preference FrameBorderWidth to configure the width of frame
window borders.
---
src/actions.c | 6 +++---
src/client.c | 8 ++++----
src/defaults.c | 10 ++++++++++
src/framewin.c | 4 ++--
src/menu.c | 4 ++--
src/moveres.c | 20 ++++++++++----------
src/placement.c | 4 ++--
src/screen.h | 1 +
src/startup.c | 2 +-
src/wconfig.h.in | 1 -
src/window.c | 8 ++++----
src/wmspec.c | 8 ++++----
util/getstyle.c | 1 +
13 files changed, 44 insertions(+), 33 deletions(-)
diff --git a/src/actions.c b/src/actions.c
index a79de8a..6521870 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -362,7 +362,7 @@ void wMaximizeWindow(WWindow *wwin, int directions)
has_border = 0;
/* the size to adjust the geometry */
- adj_size = FRAME_BORDER_WIDTH * 2 * has_border;
+ adj_size = wwin->screen_ptr->frame_border_width * 2 * has_border;
/* save old coordinates before we change the current values
* always if the window is not currently maximized at all
@@ -626,7 +626,7 @@ static void find_Maximus_geometry(WWindow *wwin, WArea
usableArea, int *new_x, i
if (HAS_RESIZEBAR(wwin))
rbar_height_0 = RESIZEBAR_HEIGHT;
if (HAS_BORDER(wwin))
- bd_width_0 = FRAME_BORDER_WIDTH;
+ bd_width_0 = wwin->screen_ptr->frame_border_width;
/* the length to be subtracted if the window has titlebar, etc */
adjust_height = tbar_height_0 + 2 * bd_width_0 + rbar_height_0;
@@ -1871,7 +1871,7 @@ void wSelectWindow(WWindow *wwin, Bool flag)
XSetWindowBorder(dpy, wwin->frame->core->window,
scr->white_pixel);
if (!HAS_BORDER(wwin)) {
- XSetWindowBorderWidth(dpy, wwin->frame->core->window,
FRAME_BORDER_WIDTH);
+ XSetWindowBorderWidth(dpy, wwin->frame->core->window,
wwin->screen_ptr->frame_border_width);
}
if (!scr->selected_windows)
diff --git a/src/client.c b/src/client.c
index c11f306..ab87ecb 100644
--- a/src/client.c
+++ b/src/client.c
@@ -75,8 +75,8 @@ void wClientRestore(WWindow * wwin)
wClientGetGravityOffsets(wwin, &gx, &gy);
/* set the position of the frame on screen */
- wwin->frame_x -= gx * FRAME_BORDER_WIDTH;
- wwin->frame_y -= gy * FRAME_BORDER_WIDTH;
+ wwin->frame_x -= gx * wwin->screen_ptr->frame_border_width;
+ wwin->frame_y -= gy * wwin->screen_ptr->frame_border_width;
/* if gravity is to the south, account for the border sizes */
if (gy > 0)
wwin->frame_y += (wwin->frame->top_width +
wwin->frame->bottom_width);
@@ -224,7 +224,7 @@ void wClientConfigure(WWindow * wwin,
XConfigureRequestEvent * xcre)
nx = xcre->x;
/* Subtracting the border makes the window shift by 1
pixel -Dan */
/*if (HAS_BORDER(wwin)) {
- nx -= FRAME_BORDER_WIDTH;
+ nx -= wwin->screen_ptr->frame_border_width;
} */
} else {
nx = wwin->frame_x;
@@ -234,7 +234,7 @@ void wClientConfigure(WWindow * wwin,
XConfigureRequestEvent * xcre)
ny = xcre->y - ((ofs_y < 0) ? 0 :
wwin->frame->top_width);
/* Subtracting the border makes the window shift by 1
pixel -Dan */
/*if (HAS_BORDER(wwin)) {
- ny -= FRAME_BORDER_WIDTH;
+ ny -= wwin->screen_ptr->frame_border_width;
} */
} else {
ny = wwin->frame_y;
diff --git a/src/defaults.c b/src/defaults.c
index 490242d..c72f623 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -122,6 +122,7 @@ static int setMenuTextFont();
static int setIconTitleFont();
static int setIconTitleColor();
static int setIconTitleBack();
+static int setFrameBorderWidth();
static int setFrameBorderColor();
static int setFrameSelectedBorderColor();
static int setLargeDisplayFont();
@@ -542,6 +543,8 @@ WDefaultEntry optionList[] = {
NULL, getPropList, setSwPOptions, NULL, NULL},
{"ModifierKeyLabels", "(\"Shift+\", \"Ctrl+\", \"Mod1+\", \"Mod2+\",
\"Mod3+\", \"Mod4+\", \"Mod5+\")", &wPreferences,
NULL, getPropList, setModifierKeyLabels, NULL, NULL},
+ {"FrameBorderWidth", "1", NULL,
+ NULL, getInt, setFrameBorderWidth, NULL, NULL},
{"FrameBorderColor", "black", NULL,
NULL, getColor, setFrameBorderColor, NULL, NULL},
{"FrameSelectedBorderColor", "white", NULL,
@@ -2584,6 +2587,13 @@ static int setIconTitleBack(WScreen * scr, WDefaultEntry
* entry, XColor * color
return REFRESH_ICON_TITLE_BACK;
}
+static int setFrameBorderWidth(WScreen * scr, WDefaultEntry * entry, int *
value, void *foo)
+{
+ scr->frame_border_width = *value;
+
+ return REFRESH_FRAME_BORDER;
+}
+
static int setFrameBorderColor(WScreen * scr, WDefaultEntry * entry, XColor *
color, void *foo)
{
if (scr->frame_border_color)
diff --git a/src/framewin.c b/src/framewin.c
index 1ce3b58..fe6a1b2 100644
--- a/src/framewin.c
+++ b/src/framewin.c
@@ -106,7 +106,7 @@ WFrameWindow *wFrameWindowCreate(WScreen * scr, int wlevel,
int x, int y,
fwin->colormap = colormap;
fwin->core = wCoreCreateTopLevel(scr, x, y, width, height, (flags &
WFF_BORDER)
- ? FRAME_BORDER_WIDTH : 0, fwin->depth,
fwin->visual, fwin->colormap, scr->frame_border_pixel);
+ ? scr->frame_border_width : 0,
fwin->depth, fwin->visual, fwin->colormap, scr->frame_border_pixel);
/* setup stacking information */
fwin->core->stacking = wmalloc(sizeof(WStacking));
@@ -369,7 +369,7 @@ void wFrameWindowUpdateBorders(WFrameWindow * fwin, int
flags)
wFrameWindowResize(fwin, width, height + fwin->top_width +
fwin->bottom_width);
if (flags & WFF_BORDER)
- XSetWindowBorderWidth(dpy, fwin->core->window,
FRAME_BORDER_WIDTH);
+ XSetWindowBorderWidth(dpy, fwin->core->window,
scr->frame_border_width);
else
XSetWindowBorderWidth(dpy, fwin->core->window, 0);
diff --git a/src/menu.c b/src/menu.c
index 7bb0639..b770d4c 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -57,8 +57,8 @@ extern WPreferences wPreferences;
#define MENU_SCROLL_STEP
menuScrollParameters[(int)wPreferences.menu_scroll_speed].steps
#define MENU_SCROLL_DELAY
menuScrollParameters[(int)wPreferences.menu_scroll_speed].delay
-#define MENUW(m) ((m)->frame->core->width+2*FRAME_BORDER_WIDTH)
-#define MENUH(m) ((m)->frame->core->height+2*FRAME_BORDER_WIDTH)
+#define MENUW(m)
((m)->frame->core->width+2*(m)->frame->screen_ptr->frame_border_width)
+#define MENUH(m)
((m)->frame->core->height+2*(m)->frame->screen_ptr->frame_border_width)
/***** Local Stuff ******/
diff --git a/src/moveres.c b/src/moveres.c
index 44ddefa..e3a63b9 100644
--- a/src/moveres.c
+++ b/src/moveres.c
@@ -228,10 +228,10 @@ static void showGeometry(WWindow * wwin, int x1, int y1,
int x2, int y2, int dir
x2--;
if (HAS_BORDER_WITH_SELECT(wwin)) {
- x1 += FRAME_BORDER_WIDTH;
- x2 += FRAME_BORDER_WIDTH;
- y1 += FRAME_BORDER_WIDTH;
- y2 += FRAME_BORDER_WIDTH;
+ x1 += scr->frame_border_width;
+ x2 += scr->frame_border_width;
+ y1 += scr->frame_border_width;
+ y2 += scr->frame_border_width;
}
ty = y1 + wwin->frame->top_width;
@@ -463,8 +463,8 @@ static void drawTransparentFrame(WWindow * wwin, int x, int
y, int width, int he
int bottom = 0;
if (HAS_BORDER_WITH_SELECT(wwin)) {
- x += FRAME_BORDER_WIDTH;
- y += FRAME_BORDER_WIDTH;
+ x += wwin->screen_ptr->frame_border_width;
+ y += wwin->screen_ptr->frame_border_width;
}
if (HAS_TITLEBAR(wwin) && !wwin->flags.shaded) {
@@ -596,9 +596,9 @@ typedef struct {
#define WTOP(w) (w)->frame_y
#define WLEFT(w) (w)->frame_x
#define WRIGHT(w) ((w)->frame_x + (int)(w)->frame->core->width - 1 + \
- (HAS_BORDER_WITH_SELECT(w) ? 2*FRAME_BORDER_WIDTH : 0))
+ (HAS_BORDER_WITH_SELECT(w) ? 2*(w)->screen_ptr->frame_border_width : 0))
#define WBOTTOM(w) ((w)->frame_y + (int)(w)->frame->core->height - 1 + \
- (HAS_BORDER_WITH_SELECT(w) ? 2*FRAME_BORDER_WIDTH : 0))
+ (HAS_BORDER_WITH_SELECT(w) ? 2*(w)->screen_ptr->frame_border_width : 0))
static int compareWTop(const void *a, const void *b)
{
@@ -830,8 +830,8 @@ static void initMoveData(WWindow * wwin, MoveData * data)
data->calcX = wwin->frame_x;
data->calcY = wwin->frame_y;
- data->winWidth = wwin->frame->core->width +
(HAS_BORDER_WITH_SELECT(wwin) ? 2 * FRAME_BORDER_WIDTH : 0);
- data->winHeight = wwin->frame->core->height +
(HAS_BORDER_WITH_SELECT(wwin) ? 2 * FRAME_BORDER_WIDTH : 0);
+ data->winWidth = wwin->frame->core->width +
(HAS_BORDER_WITH_SELECT(wwin) ? 2 * wwin->screen_ptr->frame_border_width : 0);
+ data->winHeight = wwin->frame->core->height +
(HAS_BORDER_WITH_SELECT(wwin) ? 2 * wwin->screen_ptr->frame_border_width : 0);
}
static Bool checkWorkspaceChange(WWindow * wwin, MoveData * data, Bool
opaqueMove)
diff --git a/src/placement.c b/src/placement.c
index f9667d2..5e4a8e7 100644
--- a/src/placement.c
+++ b/src/placement.c
@@ -294,8 +294,8 @@ static void set_width_height(WWindow *wwin, unsigned int
*width, unsigned int *h
*height += RESIZEBAR_HEIGHT;
}
if (HAS_BORDER(wwin)) {
- *height += 2 * FRAME_BORDER_WIDTH;
- *width += 2 * FRAME_BORDER_WIDTH;
+ *height += 2 * wwin->screen_ptr->frame_border_width;
+ *width += 2 * wwin->screen_ptr->frame_border_width;
}
}
diff --git a/src/screen.h b/src/screen.h
index b4cbddf..5f44555 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -167,6 +167,7 @@ typedef struct _WScreen {
WMColor *mtext_color; /* menu item text */
WMColor *dtext_color; /* disabled menu item text */
+ int frame_border_width;
WMColor *frame_border_color;
WMColor *frame_selected_border_color;
diff --git a/src/startup.c b/src/startup.c
index e140026..00e32ef 100644
--- a/src/startup.c
+++ b/src/startup.c
@@ -876,7 +876,7 @@ static void manageAllWindows(WScreen * scr, int
crashRecovery)
if (crashRecovery) {
int border;
- border = (!HAS_BORDER(wwin) ? 0 :
FRAME_BORDER_WIDTH);
+ border = (!HAS_BORDER(wwin) ? 0 :
scr->frame_border_width);
wWindowMove(wwin, wwin->frame_x - border,
wwin->frame_y - border -
diff --git a/src/wconfig.h.in b/src/wconfig.h.in
index 70f583d..b8063db 100644
--- a/src/wconfig.h.in
+++ b/src/wconfig.h.in
@@ -355,7 +355,6 @@
#define MIN_TITLEFONT_HEIGHT(h) ((h)>14 ? (h) : 14)
#define TITLEBAR_HEIGHT 18 /* window's titlebar height */
#define RESIZEBAR_HEIGHT 8 /* height of the resizebar */
-#define FRAME_BORDER_WIDTH 1 /* width of window border for frames */
#define RESIZEBAR_MIN_WIDTH 20 /* min width of handles-corner_width */
#define RESIZEBAR_CORNER_WIDTH 28 /* width of the corner of resizebars */
#define MENU_INDICATOR_SPACE 12
diff --git a/src/window.c b/src/window.c
index aad3fe0..a070b0b 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2021,8 +2021,8 @@ void wWindowConfigure(WWindow *wwin, int req_x, int
req_y, int req_width, int re
wwin->frame_x = req_x;
wwin->frame_y = req_y;
if (HAS_BORDER(wwin)) {
- wwin->client.x += FRAME_BORDER_WIDTH;
- wwin->client.y += FRAME_BORDER_WIDTH;
+ wwin->client.x += wwin->screen_ptr->frame_border_width;
+ wwin->client.y += wwin->screen_ptr->frame_border_width;
}
#ifdef SHAPE
if (wShapeSupported && wwin->flags.shaped && resize)
@@ -2058,8 +2058,8 @@ void wWindowMove(WWindow *wwin, int req_x, int req_y)
wwin->client.x = req_x;
wwin->client.y = req_y + wwin->frame->top_width;
if (HAS_BORDER(wwin)) {
- wwin->client.x += FRAME_BORDER_WIDTH;
- wwin->client.y += FRAME_BORDER_WIDTH;
+ wwin->client.x += wwin->screen_ptr->frame_border_width;
+ wwin->client.y += wwin->screen_ptr->frame_border_width;
}
XMoveWindow(dpy, wwin->frame->core->window, req_x, req_y);
diff --git a/src/wmspec.c b/src/wmspec.c
index c758f0a..515b66c 100644
--- a/src/wmspec.c
+++ b/src/wmspec.c
@@ -1608,10 +1608,10 @@ void wNETFrameExtents(WWindow *wwin)
if (wwin->frame->resizebar)
extents[3] = wwin->frame->resizebar->height;
if (HAS_BORDER(wwin)) {
- extents[0] += FRAME_BORDER_WIDTH;
- extents[1] += FRAME_BORDER_WIDTH;
- extents[2] += FRAME_BORDER_WIDTH;
- extents[3] += FRAME_BORDER_WIDTH;
+ extents[0] += wwin->screen_ptr->frame_border_width;
+ extents[1] += wwin->screen_ptr->frame_border_width;
+ extents[2] += wwin->screen_ptr->frame_border_width;
+ extents[3] += wwin->screen_ptr->frame_border_width;
}
XChangeProperty(dpy, wwin->client_win, net_frame_extents, XA_CARDINAL,
32, PropModeReplace, (unsigned char *) extents, 4);
diff --git a/util/getstyle.c b/util/getstyle.c
index 3caa315..e9ee696 100644
--- a/util/getstyle.c
+++ b/util/getstyle.c
@@ -86,6 +86,7 @@ static char *options[] = {
"IconBack",
"IconTitleColor",
"IconTitleBack",
+ "FrameBorderWidth",
"FrameBorderColor",
"FrameSelectedBorderColor",
"MenuStyle",
--
1.8.1.4
From 8a060967458205e94a7067c191909410d948fcb2 Mon Sep 17 00:00:00 2001
From: Iain Patterson <[email protected]>
Date: Tue, 26 Mar 2013 08:08:27 +0000
Subject: [PATCH 5/6] Document FrameBorder* preferences.
Describe the new FrameBorderWidth and Frame(Selected)BorderColor
preferences in the NEWS file.
---
NEWS | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/NEWS b/NEWS
index 2f1c7bd..45f37d5 100644
--- a/NEWS
+++ b/NEWS
@@ -35,6 +35,16 @@ $ wdwrite WindowMaker WindowTitleMaxHeight 24
$ wdwrite WindowMaker MenuTitleMinHeight 24
$ wdwrite WindowMaker MenuTitleMaxHeight 24
+Options to configure window/menu borders
+----------------------------------------
+
+You can now configure the width and color of window and menu borders.
+For example, the default settings could be configured as follows:
+
+$ wdwrite WindowMaker FrameBorderWidth 1
+$ wdwrite WindowMaker FrameBorderColor black
+$ wdwrite WindowMaker FrameSelectedBorderColor white
+
--- 0.95.2
--
1.8.1.4
From d03dfef20cca9ee14f90507977415809b1255d7c Mon Sep 17 00:00:00 2001
From: Iain Patterson <[email protected]>
Date: Tue, 26 Mar 2013 16:57:05 +0000
Subject: [PATCH 6/6] Change Select menu entry text for selected windows.
Other toggle menu items such as Maximize and Shade change their text
labels according to the action which will be performed. A shaded window
has its Shade menu item text changed to Unshade, for instance.
As well as maintaining consistency with other menu items, changing the
Select menu entry's text to Deselect for current selected windows
provides another (the only) way of reporting that a window is selected
when its border has been disabled. Currently the only indication that a
window is selected is that its border colour will change.
---
src/winmenu.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/src/winmenu.c b/src/winmenu.c
index 96609aa..7bba1a1 100644
--- a/src/winmenu.c
+++ b/src/winmenu.c
@@ -551,6 +551,20 @@ static void updateMenuForWindow(WMenu * menu, WWindow *
wwin)
wMenuSetEnabled(menu, MC_SHADE, !WFLAGP(wwin, no_shadeable)
&& !wwin->flags.miniaturized);
+ if (wwin->flags.selected) {
+ static char *text = NULL;
+ if (!text)
+ text = _("Deselect");
+
+ menu->entries[MC_SELECT]->text = text;
+ } else {
+ static char *text = NULL;
+ if (!text)
+ text = _("Select");
+
+ menu->entries[MC_SELECT]->text = text;
+ }
+
wMenuSetEnabled(menu, MC_DUMMY_MOVETO, !IS_OMNIPRESENT(wwin));
if (!wwin->flags.inspector_open) {
@@ -591,6 +605,7 @@ static WMenu *open_window_menu_core(WWindow *wwin, int x,
int y)
wfree(scr->window_menu->entries[MC_MINIATURIZE]->text);
wfree(scr->window_menu->entries[MC_MAXIMIZE]->text);
wfree(scr->window_menu->entries[MC_SHADE]->text);
+ wfree(scr->window_menu->entries[MC_SELECT]->text);
} else {
updateWorkspaceMenu(scr->workspace_submenu);
}
@@ -685,6 +700,7 @@ void DestroyWindowMenu(WScreen *scr)
scr->window_menu->entries[MC_MINIATURIZE]->text = NULL;
scr->window_menu->entries[MC_MAXIMIZE]->text = NULL;
scr->window_menu->entries[MC_SHADE]->text = NULL;
+ scr->window_menu->entries[MC_SELECT]->text = NULL;
wMenuDestroy(scr->window_menu, True);
scr->window_menu = NULL;
}
--
1.8.1.4