Signed-off-by: Amadeusz Sławiński <am...@asmblr.net>
---
 WPrefs.app/Appearance.c |  2 ++
 src/actions.c           | 15 +++++++++++----
 src/defaults.c          | 20 ++++++++++++++++++++
 src/framewin.c          | 17 +++++++++++++++--
 src/framewin.h          |  1 +
 src/screen.c            |  2 ++
 src/screen.h            |  2 ++
 util/getstyle.c         |  1 +
 8 files changed, 54 insertions(+), 6 deletions(-)

diff --git a/WPrefs.app/Appearance.c b/WPrefs.app/Appearance.c
index 9b42034..df23917 100644
--- a/WPrefs.app/Appearance.c
+++ b/WPrefs.app/Appearance.c
@@ -351,6 +351,7 @@ static const struct {
        { "MenuDisabledColor", "#616161" },
        { "HighlightColor", "white" },
        { "HighlightTextColor", "black" },
+       { "FrameFocusedBorderColor", "black" },
        { "FrameBorderColor", "black" },
        { "FrameSelectedBorderColor", "white" }/* , */
        /* { "IconTitleColor", "white" }, */
@@ -1834,6 +1835,7 @@ static void createPanel(Panel * p)
        WMAddPopUpButtonItem(panel->colP, _("Disabled Menu Item Text"));
        WMAddPopUpButtonItem(panel->colP, _("Menu Highlight Color"));
        WMAddPopUpButtonItem(panel->colP, _("Highlighted Menu Text Color"));
+       WMAddPopUpButtonItem(panel->colP, _("Focused Window Border Color"));
        WMAddPopUpButtonItem(panel->colP, _("Window Border Color"));
        WMAddPopUpButtonItem(panel->colP, _("Selected Window Border Color"));
        /*
diff --git a/src/actions.c b/src/actions.c
index 13dffec..a767072 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -1874,10 +1874,17 @@ void wSelectWindow(WWindow *wwin, Bool flag)
                WMAddToArray(scr->selected_windows, wwin);
        } else {
                wwin->flags.selected = 0;
-               if (wwin->frame->border_pixel)
-                       XSetWindowBorder(dpy, wwin->frame->core->window, 
*wwin->frame->border_pixel);
-               else
-                       XSetWindowBorder(dpy, wwin->frame->core->window, 
scr->frame_border_pixel);
+               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)
+                               XSetWindowBorder(dpy, 
wwin->frame->core->window, *wwin->frame->border_pixel);
+                       else
+                               XSetWindowBorder(dpy, 
wwin->frame->core->window, scr->frame_border_pixel);
+               }
 
                if (!HAS_BORDER(wwin)) {
                        XSetWindowBorderWidth(dpy, wwin->frame->core->window, 
0);
diff --git a/src/defaults.c b/src/defaults.c
index 7d66372..cd19ca1 100644
--- a/src/defaults.c
+++ b/src/defaults.c
@@ -126,6 +126,7 @@ static WDECallbackUpdate setIconTitleColor;
 static WDECallbackUpdate setIconTitleBack;
 static WDECallbackUpdate setFrameBorderWidth;
 static WDECallbackUpdate setFrameBorderColor;
+static WDECallbackUpdate setFrameFocusedBorderColor;
 static WDECallbackUpdate setFrameSelectedBorderColor;
 static WDECallbackUpdate setLargeDisplayFont;
 static WDECallbackUpdate setWTitleColor;
@@ -568,6 +569,8 @@ WDefaultEntry optionList[] = {
            NULL, getInt, setFrameBorderWidth, NULL, NULL},
        {"FrameBorderColor", "black", NULL,
            NULL, getColor, setFrameBorderColor, NULL, NULL},
+       {"FrameFocusedBorderColor", "black", NULL,
+           NULL, getColor, setFrameFocusedBorderColor, NULL, NULL},
        {"FrameSelectedBorderColor", "white", NULL,
            NULL, getColor, setFrameSelectedBorderColor, NULL, NULL},
 
@@ -2891,6 +2894,23 @@ static int setFrameBorderColor(WScreen * scr, 
WDefaultEntry * entry, void *tdata
        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)
 {
        XColor *color = tdata;
diff --git a/src/framewin.c b/src/framewin.c
index 68a1b74..13fe1e0 100644
--- a/src/framewin.c
+++ b/src/framewin.c
@@ -415,6 +415,7 @@ void wFrameWindowUpdateBorders(WFrameWindow * fwin, int 
flags)
        checkTitleSize(fwin);
 
        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);
 
        if (flags & WFF_SELECTED) {
@@ -422,8 +423,13 @@ void wFrameWindowUpdateBorders(WFrameWindow * fwin, int 
flags)
                        XSetWindowBorder(dpy, fwin->core->window, 
*fwin->selected_border_pixel);
        }
        else {
-               if (fwin->border_pixel)
-                       XSetWindowBorder(dpy, fwin->core->window, 
*fwin->border_pixel);
+               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);
+               }
        }
 }
 
@@ -477,6 +483,13 @@ void wFrameWindowChangeState(WFrameWindow * fwin, int 
state)
        fwin->flags.state = state;
        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);
 }
 
diff --git a/src/framewin.h b/src/framewin.h
index 22e0edf..8b0a53c 100644
--- a/src/framewin.h
+++ b/src/framewin.h
@@ -152,6 +152,7 @@ typedef struct WFrameWindow {
     Visual *visual;
     Colormap colormap;
     unsigned long *border_pixel;
+    unsigned long *focused_border_pixel;
     unsigned long *selected_border_pixel;
 } WFrameWindow;
 
diff --git a/src/screen.c b/src/screen.c
index 91ef63b..afc9d17 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -622,6 +622,8 @@ WScreen *wScreenInit(int screen_number)
                /* frame boder color */
                wGetColor(scr, 
WMGetColorRGBDescription(scr->frame_border_color), &xcol);
                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);
                scr->frame_selected_border_pixel = xcol.pixel;
        }
diff --git a/src/screen.h b/src/screen.h
index 97e2e48..b9b5d78 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -160,10 +160,12 @@ typedef struct _WScreen {
 
     int frame_border_width;
     WMColor *frame_border_color;
+    WMColor *frame_focused_border_color;
     WMColor *frame_selected_border_color;
 
     WMPixel line_pixel;
     WMPixel frame_border_pixel;               /* frame border */
+    WMPixel frame_focused_border_pixel;               /* frame border */
     WMPixel frame_selected_border_pixel;/* frame border */
 
 
diff --git a/util/getstyle.c b/util/getstyle.c
index f365bd7..80c1c4c 100644
--- a/util/getstyle.c
+++ b/util/getstyle.c
@@ -93,6 +93,7 @@ static char *options[] = {
        "IconTitleBack",
        "FrameBorderWidth",
        "FrameBorderColor",
+       "FrameFocusedBorderColor",
        "FrameSelectedBorderColor",
        "MenuStyle",
        "WindowTitleExtendSpace",
-- 
1.9.3


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to