summaryrefslogtreecommitdiff
path: root/app/xdm
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2015-03-15 17:20:42 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2015-03-15 17:20:42 +0000
commit2c4ef373affeb14ce75101011f3236b8ee52927e (patch)
treec7006898b221b9ce59d91ba5755de371a4bbd195 /app/xdm
parent68ffb6515643a3d1992cf4b17ae45d26d29c7825 (diff)
Allow the greeter to set the input fields bg color
A new 'inpColor' resource is added for that. Already commited upstream.
Diffstat (limited to 'app/xdm')
-rw-r--r--app/xdm/config/Xresources.cpp2
-rw-r--r--app/xdm/greeter/Login.c26
-rw-r--r--app/xdm/greeter/Login.h1
-rw-r--r--app/xdm/greeter/LoginP.h2
4 files changed, 24 insertions, 7 deletions
diff --git a/app/xdm/config/Xresources.cpp b/app/xdm/config/Xresources.cpp
index aa3dac2b3..b52331e61 100644
--- a/app/xdm/config/Xresources.cpp
+++ b/app/xdm/config/Xresources.cpp
@@ -83,8 +83,8 @@ xlogin*shdColor: #384c70
xlogin*greetColor: #000000
XHASHif defined(bpp4) || defined(bpp8) || defined(bpp15)
! flood fill
-!xlogin*background: #2559a5
xlogin*background: #5272b6
+xlogin*inpColor: #5272b6
XHASHendif
xlogin*failColor: red
diff --git a/app/xdm/greeter/Login.c b/app/xdm/greeter/Login.c
index 26fa573d9..6a9905043 100644
--- a/app/xdm/greeter/Login.c
+++ b/app/xdm/greeter/Login.c
@@ -156,6 +156,8 @@ static XtResource resources[] = {
offset(hipixel), XtRString, XtDefaultForeground},
{XtNshdColor, XtCForeground, XtRPixel, sizeof (Pixel),
offset(shdpixel), XtRString, XtDefaultForeground},
+ {XtNinpColor, XtCForeground, XtRPixel, sizeof (Pixel),
+ offset(inppixel), XtRString, XtDefaultBackground},
{XtNframeWidth, XtCFrameWidth, XtRInt, sizeof(int),
offset(outframewidth), XtRImmediate, (XtPointer) 1},
{XtNinnerFramesWidth, XtCFrameWidth, XtRInt, sizeof(int),
@@ -325,7 +327,7 @@ XmuXftTextWidth(Display *dpy, XftFont *font, FcChar8 *string, int len);
F_ASCENT(greet) + Y_INC(w)) + \
(n * PROMPT_SPACE_Y(w)))
#define PROMPT_W(w) (w->core.width - (2 * TEXT_X_INC(w)))
-#define PROMPT_H(w) (3 * Y_INC(w) / 2)
+#define PROMPT_H(w) (5 * Y_INC(w) / 4)
#define VALUE_X(w,n) (PROMPT_X(w) + CUR_PROMPT_W(w,n))
#define CURSOR_W 5
#define MAX_VALUE_W(w,n) (PROMPT_W(w) - VALUE_X (w,n) - CURSOR_W - 1 - \
@@ -336,7 +338,7 @@ XmuXftTextWidth(Display *dpy, XftFont *font, FcChar8 *string, int len);
#define FAIL_X(w) ERROR_X(w, w->login.fail)
#define FAIL_Y(w) (PROMPT_Y(w,1) + 2 * FAIL_Y_INC (w) + F_ASCENT(fail))
-#define ERROR_W(w,m) (STRING_WIDTH (fail, m))
+#define ERROR_W(w,m) (STRING_WIDTH (fail, m) + LOGO_W(w))
#define FAIL_W(w) max(ERROR_W(w, w->login.failMsg), \
ERROR_W(w, w->login.passwdChangeMsg))
@@ -744,14 +746,15 @@ draw_it (LoginWidget w)
int in_width = PROMPT_W(w) - VALUE_X(w,p) - LOGO_W(w);
int in_height = PROMPT_H(w) + w->login.inframeswidth + 2;
- GC topLeftGC, botRightGC;
+ GC topLeftGC, botRightGC, inpGC;
if ((PROMPT_STATE(w, p) == LOGIN_PROMPT_ECHO_ON) ||
(PROMPT_STATE(w, p) == LOGIN_PROMPT_ECHO_OFF)) {
topLeftGC = w->login.shdGC;
botRightGC = w->login.hiGC;
+ inpGC = w->login.inpGC;
} else {
- topLeftGC = botRightGC = w->login.bgGC;
+ topLeftGC = botRightGC = inpGC = w->login.bgGC;
}
/* draw borders of editboxes */
@@ -775,6 +778,11 @@ draw_it (LoginWidget w)
in_frame_x + i-1, in_frame_y + in_height-i,
in_frame_x + in_width-i, in_frame_y + in_height-i);
}
+ XFillRectangle(XtDisplay (w), XtWindow (w), inpGC,
+ in_frame_x + w->login.inframeswidth,
+ in_frame_y + w->login.inframeswidth,
+ in_width - 2*w->login.inframeswidth,
+ in_height - 2*w->login.inframeswidth);
}
if (GREETING(w)[0]) {
@@ -1682,6 +1690,11 @@ static void Initialize (
valuemask = GCForeground | GCBackground;
w->login.shdGC = XtGetGC(gnew, valuemask, &myXGCV);
+ myXGCV.foreground = w->login.inppixel;
+ myXGCV.background = w->core.background_pixel;
+ valuemask = GCForeground | GCBackground;
+ w->login.inpGC = XtGetGC(gnew, valuemask, &myXGCV);
+
myXGCV.foreground = TEXT_COLOR(text);
myXGCV.background = w->core.background_pixel;
valuemask = GCForeground | GCBackground;
@@ -1692,10 +1705,10 @@ static void Initialize (
}
#endif
w->login.textGC = XtGetGC(gnew, valuemask, &myXGCV);
- myXGCV.foreground = w->core.background_pixel;
+ myXGCV.foreground = w->login.inppixel;
w->login.bgGC = XtGetGC(gnew, valuemask, &myXGCV);
- myXGCV.foreground = TEXT_COLOR(text) ^ w->core.background_pixel;
+ myXGCV.foreground = TEXT_COLOR(text) ^ w->login.inppixel;
myXGCV.function = GXxor;
xvaluemask = valuemask | GCFunction;
w->login.xorGC = XtGetGC (gnew, xvaluemask, &myXGCV);
@@ -1961,6 +1974,7 @@ static void Destroy (Widget gw)
#endif
XtReleaseGC(gw, w->login.hiGC);
XtReleaseGC(gw, w->login.shdGC);
+ XtReleaseGC(gw, w->login.inpGC);
#ifdef XPM
if (True == w->login.logoValid)
diff --git a/app/xdm/greeter/Login.h b/app/xdm/greeter/Login.h
index 9b5212c1e..6af33694d 100644
--- a/app/xdm/greeter/Login.h
+++ b/app/xdm/greeter/Login.h
@@ -111,6 +111,7 @@ from The Open Group.
/* added by Amit Margalit Oct 1996 */
# define XtNhiColor "hiColor"
# define XtNshdColor "shdColor"
+# define XtNinpColor "inpColor"
# define XtNframeWidth "frameWidth"
# define XtCFrameWidth "FrameWidth"
# define XtNinnerFramesWidth "innerFramesWidth"
diff --git a/app/xdm/greeter/LoginP.h b/app/xdm/greeter/LoginP.h
index bd82ce30e..57ed18241 100644
--- a/app/xdm/greeter/LoginP.h
+++ b/app/xdm/greeter/LoginP.h
@@ -95,6 +95,7 @@ typedef struct {
# endif
Pixel hipixel; /* frame hilite pixel */
Pixel shdpixel; /* shadow frame pixel */
+ Pixel inppixel; /* input field bg pixel */
GC textGC; /* pointer to GraphicsContext */
GC bgGC; /* pointer to GraphicsContext */
GC xorGC; /* pointer to GraphicsContext */
@@ -105,6 +106,7 @@ typedef struct {
# endif
GC hiGC; /* for hilight part of frame */
GC shdGC; /* for shaded part of frame */
+ GC inpGC; /* for input field of frame */
char *greeting; /* greeting */
char *unsecure_greet;/* message displayed when insecure */
char *namePrompt; /* name prompt */