diff --git a/src/defaults.c b/src/defaults.c index f04e9be5..490242dc 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 8413c2ab..1ce3b584 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 d893cd14..b87845bf 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 bc8f3faa..4911b1ce 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 52a0c42e..b4cbddf0 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 c21638d3..70f583d7 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 6c2ae26e..aad3fe01 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 bde802dc..3caa3155 100644 --- a/util/getstyle.c +++ b/util/getstyle.c @@ -86,6 +86,8 @@ static char *options[] = { "IconBack", "IconTitleColor", "IconTitleBack", + "FrameBorderColor", + "FrameSelectedBorderColor", "MenuStyle", "WindowTitleExtendSpace", "MenuTitleExtendSpace",