1
0
forked from vitrine/wmaker

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.
This commit is contained in:
Iain Patterson
2013-03-25 22:14:30 +00:00
committed by Carlos R. Mafra
parent c3a2438fac
commit dee30d06ac
8 changed files with 59 additions and 14 deletions

View File

@@ -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);

View File

@@ -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)

View File

@@ -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)

View File

@@ -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);

View File

@@ -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, -, -) */

View File

@@ -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

View File

@@ -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);

View File

@@ -86,6 +86,8 @@ static char *options[] = {
"IconBack",
"IconTitleColor",
"IconTitleBack",
"FrameBorderColor",
"FrameSelectedBorderColor",
"MenuStyle",
"WindowTitleExtendSpace",
"MenuTitleExtendSpace",