mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 12:28:22 +01:00
Allow setting separate border color for focused windows
This patch adds "FrameFocusedBorderColor" option for theming, It should allow having borders better matching titlebar colors. By default it's set to black. Signed-off-by: Amadeusz Sławiński <amade@asmblr.net>
This commit is contained in:
committed by
Carlos R. Mafra
parent
9d503d2abc
commit
bc8ccee72f
@@ -1874,10 +1874,17 @@ void wSelectWindow(WWindow *wwin, Bool flag)
|
|||||||
WMAddToArray(scr->selected_windows, wwin);
|
WMAddToArray(scr->selected_windows, wwin);
|
||||||
} else {
|
} else {
|
||||||
wwin->flags.selected = 0;
|
wwin->flags.selected = 0;
|
||||||
|
if (wwin->flags.focused) {
|
||||||
|
if (wwin->frame->focused_border_pixel)
|
||||||
|
XSetWindowBorder(dpy, wwin->frame->core->window, *wwin->frame->focused_border_pixel);
|
||||||
|
else
|
||||||
|
XSetWindowBorder(dpy, wwin->frame->core->window, scr->frame_focused_border_pixel);
|
||||||
|
} else {
|
||||||
if (wwin->frame->border_pixel)
|
if (wwin->frame->border_pixel)
|
||||||
XSetWindowBorder(dpy, wwin->frame->core->window, *wwin->frame->border_pixel);
|
XSetWindowBorder(dpy, wwin->frame->core->window, *wwin->frame->border_pixel);
|
||||||
else
|
else
|
||||||
XSetWindowBorder(dpy, wwin->frame->core->window, scr->frame_border_pixel);
|
XSetWindowBorder(dpy, wwin->frame->core->window, scr->frame_border_pixel);
|
||||||
|
}
|
||||||
|
|
||||||
if (!HAS_BORDER(wwin)) {
|
if (!HAS_BORDER(wwin)) {
|
||||||
XSetWindowBorderWidth(dpy, wwin->frame->core->window, 0);
|
XSetWindowBorderWidth(dpy, wwin->frame->core->window, 0);
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ static WDECallbackUpdate setIconTitleColor;
|
|||||||
static WDECallbackUpdate setIconTitleBack;
|
static WDECallbackUpdate setIconTitleBack;
|
||||||
static WDECallbackUpdate setFrameBorderWidth;
|
static WDECallbackUpdate setFrameBorderWidth;
|
||||||
static WDECallbackUpdate setFrameBorderColor;
|
static WDECallbackUpdate setFrameBorderColor;
|
||||||
|
static WDECallbackUpdate setFrameFocusedBorderColor;
|
||||||
static WDECallbackUpdate setFrameSelectedBorderColor;
|
static WDECallbackUpdate setFrameSelectedBorderColor;
|
||||||
static WDECallbackUpdate setLargeDisplayFont;
|
static WDECallbackUpdate setLargeDisplayFont;
|
||||||
static WDECallbackUpdate setWTitleColor;
|
static WDECallbackUpdate setWTitleColor;
|
||||||
@@ -568,6 +569,8 @@ WDefaultEntry optionList[] = {
|
|||||||
NULL, getInt, setFrameBorderWidth, NULL, NULL},
|
NULL, getInt, setFrameBorderWidth, NULL, NULL},
|
||||||
{"FrameBorderColor", "black", NULL,
|
{"FrameBorderColor", "black", NULL,
|
||||||
NULL, getColor, setFrameBorderColor, NULL, NULL},
|
NULL, getColor, setFrameBorderColor, NULL, NULL},
|
||||||
|
{"FrameFocusedBorderColor", "black", NULL,
|
||||||
|
NULL, getColor, setFrameFocusedBorderColor, NULL, NULL},
|
||||||
{"FrameSelectedBorderColor", "white", NULL,
|
{"FrameSelectedBorderColor", "white", NULL,
|
||||||
NULL, getColor, setFrameSelectedBorderColor, NULL, NULL},
|
NULL, getColor, setFrameSelectedBorderColor, NULL, NULL},
|
||||||
|
|
||||||
@@ -2891,6 +2894,23 @@ static int setFrameBorderColor(WScreen * scr, WDefaultEntry * entry, void *tdata
|
|||||||
return REFRESH_FRAME_BORDER;
|
return REFRESH_FRAME_BORDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int setFrameFocusedBorderColor(WScreen *scr, WDefaultEntry *entry, void *tdata, void *foo)
|
||||||
|
{
|
||||||
|
XColor *color = tdata;
|
||||||
|
|
||||||
|
/* Parameter not used, but tell the compiler that it is ok */
|
||||||
|
(void) entry;
|
||||||
|
(void) foo;
|
||||||
|
|
||||||
|
if (scr->frame_focused_border_color)
|
||||||
|
WMReleaseColor(scr->frame_focused_border_color);
|
||||||
|
scr->frame_focused_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, void *tdata, void *foo)
|
static int setFrameSelectedBorderColor(WScreen * scr, WDefaultEntry * entry, void *tdata, void *foo)
|
||||||
{
|
{
|
||||||
XColor *color = tdata;
|
XColor *color = tdata;
|
||||||
|
|||||||
@@ -415,6 +415,7 @@ void wFrameWindowUpdateBorders(WFrameWindow * fwin, int flags)
|
|||||||
checkTitleSize(fwin);
|
checkTitleSize(fwin);
|
||||||
|
|
||||||
allocFrameBorderPixel(fwin->colormap, WMGetColorRGBDescription(scr->frame_border_color), &fwin->border_pixel);
|
allocFrameBorderPixel(fwin->colormap, WMGetColorRGBDescription(scr->frame_border_color), &fwin->border_pixel);
|
||||||
|
allocFrameBorderPixel(fwin->colormap, WMGetColorRGBDescription(scr->frame_focused_border_color), &fwin->focused_border_pixel);
|
||||||
allocFrameBorderPixel(fwin->colormap, WMGetColorRGBDescription(scr->frame_selected_border_color), &fwin->selected_border_pixel);
|
allocFrameBorderPixel(fwin->colormap, WMGetColorRGBDescription(scr->frame_selected_border_color), &fwin->selected_border_pixel);
|
||||||
|
|
||||||
if (flags & WFF_SELECTED) {
|
if (flags & WFF_SELECTED) {
|
||||||
@@ -422,9 +423,14 @@ void wFrameWindowUpdateBorders(WFrameWindow * fwin, int flags)
|
|||||||
XSetWindowBorder(dpy, fwin->core->window, *fwin->selected_border_pixel);
|
XSetWindowBorder(dpy, fwin->core->window, *fwin->selected_border_pixel);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (fwin->flags.state == WS_FOCUSED) {
|
||||||
|
if (fwin->focused_border_pixel)
|
||||||
|
XSetWindowBorder(dpy, fwin->core->window, *fwin->focused_border_pixel);
|
||||||
|
} else {
|
||||||
if (fwin->border_pixel)
|
if (fwin->border_pixel)
|
||||||
XSetWindowBorder(dpy, fwin->core->window, *fwin->border_pixel);
|
XSetWindowBorder(dpy, fwin->core->window, *fwin->border_pixel);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wFrameWindowDestroy(WFrameWindow * fwin)
|
void wFrameWindowDestroy(WFrameWindow * fwin)
|
||||||
@@ -477,6 +483,13 @@ void wFrameWindowChangeState(WFrameWindow * fwin, int state)
|
|||||||
fwin->flags.state = state;
|
fwin->flags.state = state;
|
||||||
fwin->flags.need_texture_change = 1;
|
fwin->flags.need_texture_change = 1;
|
||||||
|
|
||||||
|
if (fwin->flags.state == WS_FOCUSED) {
|
||||||
|
if (fwin->focused_border_pixel)
|
||||||
|
XSetWindowBorder(dpy, fwin->core->window, *fwin->focused_border_pixel);
|
||||||
|
} else {
|
||||||
|
if (fwin->border_pixel)
|
||||||
|
XSetWindowBorder(dpy, fwin->core->window, *fwin->border_pixel);
|
||||||
|
}
|
||||||
wFrameWindowPaint(fwin);
|
wFrameWindowPaint(fwin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -152,6 +152,7 @@ typedef struct WFrameWindow {
|
|||||||
Visual *visual;
|
Visual *visual;
|
||||||
Colormap colormap;
|
Colormap colormap;
|
||||||
unsigned long *border_pixel;
|
unsigned long *border_pixel;
|
||||||
|
unsigned long *focused_border_pixel;
|
||||||
unsigned long *selected_border_pixel;
|
unsigned long *selected_border_pixel;
|
||||||
} WFrameWindow;
|
} WFrameWindow;
|
||||||
|
|
||||||
|
|||||||
@@ -622,6 +622,8 @@ WScreen *wScreenInit(int screen_number)
|
|||||||
/* frame boder color */
|
/* frame boder color */
|
||||||
wGetColor(scr, WMGetColorRGBDescription(scr->frame_border_color), &xcol);
|
wGetColor(scr, WMGetColorRGBDescription(scr->frame_border_color), &xcol);
|
||||||
scr->frame_border_pixel = xcol.pixel;
|
scr->frame_border_pixel = xcol.pixel;
|
||||||
|
wGetColor(scr, WMGetColorRGBDescription(scr->frame_focused_border_color), &xcol);
|
||||||
|
scr->frame_focused_border_pixel = xcol.pixel;
|
||||||
wGetColor(scr, WMGetColorRGBDescription(scr->frame_selected_border_color), &xcol);
|
wGetColor(scr, WMGetColorRGBDescription(scr->frame_selected_border_color), &xcol);
|
||||||
scr->frame_selected_border_pixel = xcol.pixel;
|
scr->frame_selected_border_pixel = xcol.pixel;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -160,10 +160,12 @@ typedef struct _WScreen {
|
|||||||
|
|
||||||
int frame_border_width;
|
int frame_border_width;
|
||||||
WMColor *frame_border_color;
|
WMColor *frame_border_color;
|
||||||
|
WMColor *frame_focused_border_color;
|
||||||
WMColor *frame_selected_border_color;
|
WMColor *frame_selected_border_color;
|
||||||
|
|
||||||
WMPixel line_pixel;
|
WMPixel line_pixel;
|
||||||
WMPixel frame_border_pixel; /* frame border */
|
WMPixel frame_border_pixel; /* frame border */
|
||||||
|
WMPixel frame_focused_border_pixel; /* frame border */
|
||||||
WMPixel frame_selected_border_pixel;/* frame border */
|
WMPixel frame_selected_border_pixel;/* frame border */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ static char *options[] = {
|
|||||||
"IconTitleBack",
|
"IconTitleBack",
|
||||||
"FrameBorderWidth",
|
"FrameBorderWidth",
|
||||||
"FrameBorderColor",
|
"FrameBorderColor",
|
||||||
|
"FrameFocusedBorderColor",
|
||||||
"FrameSelectedBorderColor",
|
"FrameSelectedBorderColor",
|
||||||
"MenuStyle",
|
"MenuStyle",
|
||||||
"WindowTitleExtendSpace",
|
"WindowTitleExtendSpace",
|
||||||
|
|||||||
Reference in New Issue
Block a user