From 316c8d6455b5d67ae86dc36b8f90478272061d19 Mon Sep 17 00:00:00 2001 From: Michael Shigorin Date: Mon, 24 Oct 2011 22:25:32 +0300 Subject: [PATCH] TMP: a sketch of frame border color knob Black frame border isn't very useful with black window background (e.g. a couple of colliding xterms might strain eyes faster when the text inside them visually mixes up). The problem with implementation so far seems that previewPositions[] is aimed at texture-related objects (which also fave colors attached) but the border isn't a texture-related object at all... NB: the "cyan" default is a temporary value to make it more easily spottable. Global default should stay black probably, but themes might have it varying. --- WPrefs.app/Appearance.c | 14 ++++++++++++-- src/defaults.c | 22 ++++++++++++++++++++++ src/screen.c | 7 ++++--- src/screen.h | 2 ++ util/getstyle.c | 1 + 5 files changed, 41 insertions(+), 5 deletions(-) diff --git a/WPrefs.app/Appearance.c b/WPrefs.app/Appearance.c index f266382..cc159a6 100644 --- a/WPrefs.app/Appearance.c +++ b/WPrefs.app/Appearance.c @@ -338,6 +338,7 @@ static char *colorOptions[] = { "IconTitleBack", "black", "ClipTitleColor", "black", "CClipTitleColor", "#454045" + "FrameBorderColor", "cyan", }; static WMRect previewPositions[] = { @@ -347,6 +348,11 @@ static WMRect previewPositions[] = { {{30, 40}, {190, 20}}, #define POWNER 2 {{30, 70}, {190, 20}}, +/* +#define PBORDER 3 + {{30, 100}, {190, 9}}, +(and shift the below items) +*/ #define PRESIZEBAR 3 {{30, 100}, {190, 9}}, #define PMTITLE 4 @@ -371,7 +377,8 @@ static WMRect previewColorPositions[] = { {{155, 130}, {64, 64}}, {{155, 130}, {64, 64}}, {{155, 130}, {64, 64}}, - {{155, 130}, {64, 64}} + {{155, 130}, {64, 64}}, + {{30, 90}, {190, 9}} }; static void str2rcolor(RContext * rc, char *name, RColor * color) @@ -1343,7 +1350,8 @@ static void changeColorPage(WMWidget * w, void *data) {130, 140}, {130, 140}, {130, 140}, - {130, 140} + {130, 140}, + {5, 95} }; if (panel->preview) { @@ -1715,11 +1723,13 @@ static void createPanel(Panel * p) WMAddPopUpButtonItem(panel->colP, _("Focused Window Title")); WMAddPopUpButtonItem(panel->colP, _("Unfocused Window Title")); WMAddPopUpButtonItem(panel->colP, _("Owner of Focused Window Title")); + /* WMAddPopUpButtonItem(panel->colP, _("Frame Border Color")); --> breaks menu order */ WMAddPopUpButtonItem(panel->colP, _("Menu Title")); WMAddPopUpButtonItem(panel->colP, _("Menu Item Text")); WMAddPopUpButtonItem(panel->colP, _("Disabled Menu Item Text")); WMAddPopUpButtonItem(panel->colP, _("Menu Highlight Color")); WMAddPopUpButtonItem(panel->colP, _("Highlighted Menu Text Color")); + WMAddPopUpButtonItem(panel->colP, _("Frame Border Color")); /* WMAddPopUpButtonItem(panel->colP, _("Miniwindow Title")); WMAddPopUpButtonItem(panel->colP, _("Miniwindow Title Back")); diff --git a/src/defaults.c b/src/defaults.c index c1edf7b..62d85ac 100644 --- a/src/defaults.c +++ b/src/defaults.c @@ -127,6 +127,7 @@ static int setWTitleColor(); static int setFTitleBack(); static int setPTitleBack(); static int setUTitleBack(); +static int setFrameBorder(); static int setResizebarBack(); static int setWorkspaceBack(); static int setWorkspaceSpecificBack(); @@ -180,6 +181,7 @@ static int setCursor(); #define REFRESH_ICON_TITLE_COLOR (1<<13) #define REFRESH_ICON_TITLE_BACK (1<<14) +#define REFRESH_BORDER_COLOR (1<<15) static WOptionEnumeration seFocusModes[] = { {"Manual", WKF_CLICK, 0}, {"ClickToFocus", WKF_CLICK, 1}, @@ -505,6 +507,8 @@ WDefaultEntry optionList[] = { NULL, getColor, setWTitleColor, NULL, NULL}, {"UTitleColor", "black", (void *)WS_UNFOCUSED, NULL, getColor, setWTitleColor, NULL, NULL}, + {"FrameBorderColor", "cyan", NULL, + NULL, getColor, setFrameBorder, NULL, NULL}, {"FTitleBack", "(solid, black)", NULL, NULL, getTexture, setFTitleBack, NULL, NULL}, {"PTitleBack", "(solid, \"#616161\")", NULL, @@ -1093,6 +1097,12 @@ void wReadDefaults(WScreen * scr, WMPropList * new_dict) int foo; foo = 0; + if (needs_refresh & REFRESH_BORDER_COLOR) + foo |= WColorSettings; + if (foo) + WMPostNotificationName(WNMenuAppearanceSettingsChanged, NULL, (void *)(uintptr_t) foo); + + foo = 0; if (needs_refresh & REFRESH_MENU_TITLE_TEXTURE) foo |= WTextureSettings; if (needs_refresh & REFRESH_MENU_TITLE_FONT) @@ -2554,6 +2564,18 @@ static int setClipTitleColor(WScreen * scr, WDefaultEntry * entry, XColor * colo return REFRESH_ICON_TITLE_COLOR; } +static int setFrameBorder(WScreen * scr, WDefaultEntry * entry, XColor * color, void *foo) +{ + if (scr->select_border_color) + WMReleaseColor(scr->select_border_color); + + scr->select_border_color = WMCreateRGBColor(scr->wmscreen, color->red, color->green, color->blue, True); + + wFreeColor(scr, color->pixel); + + return REFRESH_BORDER_COLOR; +} + static int setWTitleColor(WScreen * scr, WDefaultEntry * entry, XColor * color, long widx) { if (scr->window_title_color[widx]) diff --git a/src/screen.c b/src/screen.c index e2cda33..04fcf76 100644 --- a/src/screen.c +++ b/src/screen.c @@ -723,10 +723,11 @@ WScreen *wScreenInit(int screen_number) scr->dark_pixel = WMColorPixel(scr->darkGray); { - XColor xcol; + /* XColor xcol; */ /* frame boder color */ - wGetColor(scr, FRAME_BORDER_COLOR, &xcol); - scr->frame_border_pixel = xcol.pixel; + /* wGetColor(scr, FRAME_BORDER_COLOR, &xcol); */ + /* scr->frame_border_pixel = xcol.pixel; */ + scr->frame_border_pixel = WMColorPixel(scr->select_border_color); } /* create GCs with default values */ diff --git a/src/screen.h b/src/screen.h index b95ba29..ad0b669 100644 --- a/src/screen.h +++ b/src/screen.h @@ -163,6 +163,8 @@ typedef struct _WScreen { WMColor *mtext_color; /* menu item text */ WMColor *dtext_color; /* disabled menu item text */ + WMColor *select_border_color; /* window frame border */ + WMPixel line_pixel; WMPixel frame_border_pixel; /* frame border */ diff --git a/util/getstyle.c b/util/getstyle.c index 1a9ac31..21805e3 100644 --- a/util/getstyle.c +++ b/util/getstyle.c @@ -74,6 +74,7 @@ static char *options[] = { "FTitleColor", "PTitleColor", "UTitleColor", + "FrameBorderColor", "FTitleBack", "PTitleBack", "UTitleBack", -- 1.7.6.4