summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2007-06-15 19:43:46 -0700
committerAlan Coopersmith <alan.coopersmith@sun.com>2007-06-15 19:43:46 -0700
commitd0d4581be22aba9021c5a672bd9e5ba719961e29 (patch)
tree274b1b5a7c0632f5f3c5c3c7975c0ad170b50725
parent188415ebf07ff8a25ac663c37615269cd1a741a4 (diff)
Make #ifdef XPM only control whether XPM pixmap logo is shown
Make 3D look-and-feel independent of XPM
-rw-r--r--config/Xresources.cpp30
-rw-r--r--greeter/Login.c78
-rw-r--r--greeter/Login.h9
-rw-r--r--greeter/LoginP.h14
-rw-r--r--xdm.man.cpp8
5 files changed, 49 insertions, 90 deletions
diff --git a/config/Xresources.cpp b/config/Xresources.cpp
index e904591..a98287b 100644
--- a/config/Xresources.cpp
+++ b/config/Xresources.cpp
@@ -22,15 +22,11 @@ xlogin*login.translations: #override BS
<Key>KP_Enter: set-session-argument() finish-field()NLBS
Ctrl<Key>Return: set-session-argument(failsafe) finish-field()NLBS
<Key>Return: set-session-argument() finish-field()
-#ifndef XPM
-xlogin*greeting: CLIENTHOST
-xlogin*namePrompt: login:\040
-#else
+
xlogin*greeting: Welcome to CLIENTHOST
xlogin*namePrompt: \040\040\040\040\040\040\040Login:
-#endif /* XPM */
xlogin*fail: Login incorrect
-#ifdef XPM
+
XHASHif WIDTH > 800
xlogin*greetFont: -adobe-helvetica-bold-o-normal--24-240-75-75-p-138-iso8859-1
xlogin*font: -adobe-helvetica-medium-r-normal--18-180-75-75-p-98-iso8859-1
@@ -40,21 +36,8 @@ xlogin*greetFace: Serif-24:bold:italic
xlogin*face: Helvetica-18
xlogin*promptFace: Helvetica-18:bold
xlogin*failFace: Helvetica-18:bold
-XHASHelse
-xlogin*greetFont: -adobe-helvetica-bold-o-normal--17-120-100-100-p-92-iso8859-1
-xlogin*font: -adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1
-xlogin*promptFont: -adobe-helvetica-bold-r-normal--12-120-75-75-p-70-iso8859-1
-xlogin*failFont: -adobe-helvetica-bold-o-normal--14-140-75-75-p-82-iso8859-1
-xlogin*greetFace: Serif-18:bold:italic
-xlogin*face: Helvetica-12
-xlogin*promptFace: Helvetica-12:bold
-xlogin*failFace: Helvetica-14:bold
-XHASHendif
-#endif /* XPM */
+
XHASHifdef COLOR
-#ifndef XPM
-xlogin*greetColor: CadetBlue
-#else
xlogin*borderWidth: 1
xlogin*frameWidth: 5
xlogin*innerFramesWidth: 2
@@ -63,22 +46,15 @@ xlogin*hiColor: grey90
xlogin*background: grey
!xlogin*foreground: darkgreen
xlogin*greetColor: Blue3
-#endif /* XPM */
xlogin*failColor: red
*Foreground: black
*Background: #fffff0
XHASHelse
-#ifdef XPM
xlogin*borderWidth: 3
xlogin*frameWidth: 0
xlogin*innerFramesWidth: 1
xlogin*shdColor: black
xlogin*hiColor: black
-#else
-xlogin*borderWidth: 3
-xlogin*Foreground: black
-xlogin*Background: white
-#endif /* XPM */
XHASHendif
#ifdef XPM
XHASHif PLANES >= 8
diff --git a/greeter/Login.c b/greeter/Login.c
index 120da8b..a0b387e 100644
--- a/greeter/Login.c
+++ b/greeter/Login.c
@@ -85,9 +85,10 @@ from The Open Group.
#include <X11/Xlib.h>
#include <X11/xpm.h>
#include <X11/extensions/shape.h>
-#include <X11/cursorfont.h>
#endif /* XPM */
+#include <X11/cursorfont.h>
+
#ifdef USE_XINERAMA
#include <X11/extensions/Xinerama.h>
#endif
@@ -135,12 +136,14 @@ static XtResource resources[] = {
offset(failpixel), XtRString, XtDefaultForeground},
#endif
-#ifdef XPM
+#ifdef DANCING
/* added by Caolan McNamara */
{XtNlastEventTime, XtCLastEventTime, XtRInt , sizeof (int),
offset(lastEventTime), XtRImmediate, (XtPointer)0},
/* end (caolan) */
+#endif /* DANCING */
+#ifdef XPM
/* added by Ivan Griffin (ivan.griffin@ul.ie) */
{XtNlogoFileName, XtCLogoFileName, XtRString, sizeof(char*),
offset(logoFileName), XtRImmediate, (XtPointer)0},
@@ -149,7 +152,7 @@ static XtResource resources[] = {
{XtNlogoPadding, XtCLogoPadding, XtRInt, sizeof(int),
offset(logoPadding), XtRImmediate, (XtPointer) 5},
/* end (ivan) */
-
+#endif /* XPM */
/* added by Amit Margalit */
{XtNhiColor, XtCForeground, XtRPixel, sizeof (Pixel),
@@ -163,7 +166,6 @@ static XtResource resources[] = {
{XtNsepWidth, XtCFrameWidth, XtRInt, sizeof(int),
offset(sepwidth), XtRImmediate, (XtPointer) 1},
/* end (amit) */
-#endif /* XPM */
#ifndef USE_XFT
{XtNfont, XtCFont, XtRFontStruct, sizeof (XFontStruct *),
@@ -298,11 +300,8 @@ XmuXftTextWidth(Display *dpy, XftFont *font, FcChar8 *string, int len);
# define STRING_WIDTH(f, s) TEXT_WIDTH (f, s, strlen(s))
-#ifndef XPM
-# define TEXT_PROMPT_W(w, m) STRING_WIDTH(prompt, m)
-#else
+
# define TEXT_PROMPT_W(w, m) (STRING_WIDTH(prompt, m) + w->login.inframeswidth)
-#endif /* XPM */
# define DEF_PROMPT_W(w,n) TEXT_PROMPT_W(w, w->login.prompts[n].defaultPrompt)
# define CUR_PROMPT_W(w,n) (max(MAX_DEF_PROMPT_W(w), PROMPT_TEXT(w,n) ? \
@@ -330,11 +329,8 @@ XmuXftTextWidth(Display *dpy, XftFont *font, FcChar8 *string, int len);
# define PROMPT_W(w) (w->core.width - (2 * TEXT_X_INC(w)))
# define PROMPT_H(w) (3 * Y_INC(w) / 2)
# define VALUE_X(w,n) (PROMPT_X(w) + CUR_PROMPT_W(w,n))
-#ifndef XPM
-# define PROMPT_SPACE_Y(w) (8 * Y_INC(w) / 5)
-#else
# define PROMPT_SPACE_Y(w) (10 * Y_INC(w) / 5)
-#endif /* XPM */
+
# define ERROR_X(w,m) ((int)(w->core.width - STRING_WIDTH (fail, m)) / 2)
# 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))
@@ -373,10 +369,10 @@ realizeValue (LoginWidget w, int cursor, int promptNum, GC gc)
height = PROMPT_H(w);
width = PROMPT_W(w) - x - 3;
-#ifdef XPM
height -= (w->login.inframeswidth * 2);
- width -= (w->login.inframeswidth * 2) +
- (w->login.logoWidth + 2*(w->login.logoPadding));
+ width -= (w->login.inframeswidth * 2);
+#ifdef XPM
+ width -= (w->login.logoWidth + 2*(w->login.logoPadding));
#endif
if (cursor > VALUE_SHOW_START(w, promptNum))
curoff = TEXT_WIDTH (text, text, cursor);
@@ -435,11 +431,11 @@ static void
DrawValue (LoginWidget w, int cursor, int promptNum)
{
realizeValue(w, cursor, promptNum, w->login.textGC);
-#ifdef XPM
+#ifdef DANCING
/*as good a place as any Caolan begin*/
w->login.lastEventTime = time(NULL);
/*as good a place as any Caolan end*/
-#endif /* XPM */
+#endif /* DANCING */
}
static void
@@ -482,10 +478,6 @@ realizeCursor (LoginWidget w, GC gc)
break;
}
-#ifndef XPM
- XFillRectangle (XtDisplay (w), XtWindow (w), gc,
- x, y - F_ASCENT(text), width, height);
-#else
XFillRectangle (XtDisplay (w), XtWindow (w), gc,
x, y+1 - F_ASCENT(text), width, height-1);
XDrawPoint (XtDisplay (w), XtWindow (w), gc,
@@ -504,7 +496,6 @@ realizeCursor (LoginWidget w, GC gc)
x-2 , y - F_ASCENT(text)+height);
XDrawPoint (XtDisplay (w), XtWindow (w), gc,
x+2 , y - F_ASCENT(text)+height);
-#endif /* XPM */
#ifdef FORCE_CURSOR_FLASH
/* Force cursor to flash briefly to give user feedback */
@@ -708,14 +699,11 @@ static void
draw_it (LoginWidget w)
{
int p;
-#ifdef XPM
int i;
int gr_line_x, gr_line_y, gr_line_w;
-#endif /* XPM */
EraseCursor (w);
-#ifdef XPM
if( (w->login.outframewidth) < 1 )
w->login.outframewidth = 1;
for(i=1;i<=(w->login.outframewidth);i++)
@@ -731,11 +719,15 @@ draw_it (LoginWidget w)
}
/* make separator line */
- gr_line_x = w->login.outframewidth + w->login.logoPadding;
+ gr_line_x = w->login.outframewidth;
gr_line_y = GREET_Y(w) + GREET_Y_INC(w);
- gr_line_w = w->core.width - 2*(w->login.outframewidth) -
- (w->login.logoWidth + 3*(w->login.logoPadding));
-
+ gr_line_w = w->core.width - 2*(w->login.outframewidth);
+
+#ifdef XPM
+ gr_line_x += w->login.logoPadding;
+ gr_line_w -= w->login.logoWidth + (3 * (w->login.logoPadding));
+#endif /* XPM */
+
for(i=1;i<=(w->login.sepwidth);i++)
{
XDrawLine(XtDisplay (w), XtWindow (w), w->login.shdGC,
@@ -752,11 +744,14 @@ draw_it (LoginWidget w)
int in_frame_y
= PROMPT_Y(w,p) - w->login.inframeswidth - 1 - TEXT_Y_INC(w);
- int in_width = PROMPT_W(w) - VALUE_X(w,p) -
- (w->login.logoWidth + 2*(w->login.logoPadding));
+ int in_width = PROMPT_W(w) - VALUE_X(w,p);
int in_height = PROMPT_H(w) + w->login.inframeswidth + 2;
GC topLeftGC, botRightGC;
+
+#ifdef XPM
+ in_width -= (w->login.logoWidth + 2*(w->login.logoPadding));
+#endif /* XPM */
if ((PROMPT_STATE(w, p) == LOGIN_PROMPT_ECHO_ON) ||
(PROMPT_STATE(w, p) == LOGIN_PROMPT_ECHO_OFF)) {
@@ -787,15 +782,12 @@ draw_it (LoginWidget w)
in_frame_x + in_width-i, in_frame_y + in_height-i);
}
}
-#endif /* XPM */
if (GREETING(w)[0]) {
- int gx;
+ int gx = GREET_X(w);
#ifdef XPM
- gx = GREET_X(w) - ((w->login.logoWidth/2) + w->login.logoPadding);
-#else
- gx = GREET_X(w);
+ gx -= ((w->login.logoWidth/2) + w->login.logoPadding);
#endif
DRAW_STRING (greet, gx, GREET_Y(w), GREETING(w), strlen (GREETING(w)));
}
@@ -1696,8 +1688,6 @@ static void Initialize (
XineramaScreenInfo *screens;
int s_num;
#endif
-
-#ifdef XPM
int rv = 0;
myXGCV.foreground = w->login.hipixel;
@@ -1709,7 +1699,6 @@ static void Initialize (
myXGCV.background = w->core.background_pixel;
valuemask = GCForeground | GCBackground;
w->login.shdGC = XtGetGC(gnew, valuemask, &myXGCV);
-#endif /* XPM */
myXGCV.foreground = TEXT_COLOR(text);
myXGCV.background = w->core.background_pixel;
@@ -1898,10 +1887,9 @@ static void Realize (
XtValueMask *valueMask,
XSetWindowAttributes *attrs)
{
-#ifdef XPM
LoginWidget w = (LoginWidget) gw;
Cursor cursor;
-#endif /* XPM */
+
XtCreateWindow( gw, (unsigned)InputOutput, (Visual *)CopyFromParent,
*valueMask, attrs );
InitI18N(gw);
@@ -1913,10 +1901,10 @@ static void Realize (
#endif
-#ifdef XPM
cursor = XCreateFontCursor(XtDisplay(gw), XC_left_ptr);
XDefineCursor(XtDisplay(gw), XtWindow(gw), cursor);
+#ifdef XPM
/*
* Check if Pixmap was valid
*/
@@ -1990,10 +1978,10 @@ static void Destroy (Widget gw)
XtReleaseGC(gw, w->login.greetGC);
XtReleaseGC(gw, w->login.failGC);
#endif
-#ifdef XPM
XtReleaseGC(gw, w->login.hiGC);
XtReleaseGC(gw, w->login.shdGC);
+#ifdef XPM
if (True == w->login.logoValid)
{
if (w->login.logoPixmap != 0)
@@ -2101,11 +2089,7 @@ LoginClassRec loginClassRec = {
/* expose */ Redisplay,
/* set_values */ SetValues,
/* set_values_hook */ NULL,
-#ifndef XPM
- /* set_values_almost */ NULL,
-#else
/* set_values_almost */ XtInheritSetValuesAlmost,
-#endif /* XPM */
/* get_values_hook */ NULL,
/* accept_focus */ NULL,
/* version */ XtVersion,
diff --git a/greeter/Login.h b/greeter/Login.h
index 13484fe..68664bc 100644
--- a/greeter/Login.h
+++ b/greeter/Login.h
@@ -114,29 +114,30 @@ from The Open Group.
# define XtRXftFont "XftFont"
# define XtRXftColor "XftColor"
-#ifdef XPM
/* added by Amit Margalit Oct 1996 */
# define XtNhiColor "hiColor"
# define XtNshdColor "shdColor"
# define XtNframeWidth "frameWidth"
+# define XtCFrameWidth "FrameWidth"
# define XtNinnerFramesWidth "innerFramesWidth"
# define XtNsepWidth "sepWidth"
+#ifdef DANCING
/* caolan begin */
#define XtNlastEventTime "lastEventTime"
#define XtCLastEventTime "LastEventTime"
/* caolan end */
+#endif /* DANCING */
+#ifdef XPM
#define XtNuseShape "useShape"
#define XtCUseShape "UseShape"
#define XtNlogoFileName "logoFileName"
#define XtCLogoFileName "LogoFileName"
#define XtNlogoPadding "logoPadding"
#define XtCLogoPadding "LogoPadding"
-
-# define XtCFrameWidth "FrameWidth"
-
#endif /* XPM */
+
# define XtCGreeting "Greeting"
# define XtCNamePrompt "NamePrompt"
# define XtCPasswdPrompt "PasswdPrompt"
diff --git a/greeter/LoginP.h b/greeter/LoginP.h
index fda41d3..7fde809 100644
--- a/greeter/LoginP.h
+++ b/greeter/LoginP.h
@@ -67,9 +67,7 @@ from The Open Group.
#include "Login.h"
#include <X11/IntrinsicP.h>
#include <X11/CoreP.h>
-#ifdef XPM
#include <X11/Xlib.h>
-#endif /* XPM */
#ifdef USE_XFT
# include <X11/Xft/Xft.h>
#endif
@@ -103,10 +101,8 @@ typedef struct {
Pixel greetpixel; /* greeting pixel */
Pixel failpixel; /* failure pixel */
#endif
-#ifdef XPM
Pixel hipixel; /* frame hilite pixel */
Pixel shdpixel; /* shadow frame pixel */
-#endif /* XPM */
GC textGC; /* pointer to GraphicsContext */
GC bgGC; /* pointer to GraphicsContext */
GC xorGC; /* pointer to GraphicsContext */
@@ -115,10 +111,8 @@ typedef struct {
GC greetGC;
GC failGC;
#endif
-#ifdef XPM
GC hiGC; /* for hilight part of frame */
GC shdGC; /* for shaded part of frame */
-#endif /* XPM */
char *greeting; /* greeting */
char *unsecure_greet;/* message displayed when insecure */
char *namePrompt; /* name prompt */
@@ -147,14 +141,18 @@ typedef struct {
XIC xic; /* input method of input context */
loginPromptData prompts[NUM_PROMPTS];
time_t msgTimeout;
-#ifdef XPM
+
+#ifdef DANCING
/*caolan begin*/
- int lastEventTime;
+ int lastEventTime;
/*caolan end*/
+#endif /* DANCING */
+
int outframewidth; /* outer frame thickness */
int inframeswidth; /* inner frames thickness */
int sepwidth; /* width of separator line */
+#ifdef XPM
char *logoFileName;
unsigned int logoWidth, logoHeight, logoPadding, logoBorderWidth;
int logoX, logoY;
diff --git a/xdm.man.cpp b/xdm.man.cpp
index ff18a56..c95019a 100644
--- a/xdm.man.cpp
+++ b/xdm.man.cpp
@@ -1032,7 +1032,7 @@ If set to ``true'', when built with XPM support, attempt to use the
X Non-Rectangular Window Shape Extension to set the window shape.
The default is ``true''.
.IP "\fBxlogin.Login.hiColor\fP, \fBxlogin.Login.shdColor\fP"
-When built with XPM support, raised appearance bezels may be drawn around
+Raised appearance bezels may be drawn around
the greeter frame and text input boxes by setting these resources. hiColor
is the highlight color, used on the top and left sides of the frame, and the
bottom and right sides of text input areas. shdColor is the shadow color,
@@ -1040,13 +1040,13 @@ used on the bottom and right sides of the frame, and the top and left sides
of text input areas.
The default for both is the foreground color, providing a flat appearance.
.IP "\fBxlogin.Login.frameWidth\fP"
-When built with XPM support, frameWidth is the width in pixels of the area
+frameWidth is the width in pixels of the area
around the greeter frame drawn in hiColor and shdColor.
.IP "\fBxlogin.Login.innerFramesWidth\fP"
-When built with XPM support, innerFramesWidth is the width in pixels of the
+innerFramesWidth is the width in pixels of the
area around text input areas drawn in hiColor and shdColor.
.IP "\fBxlogin.Login.sepWidth\fP"
-When built with XPM support, sepWidth is the width in pixels of the
+sepWidth is the width in pixels of the
bezeled line between the greeting and input areas
drawn in hiColor and shdColor.
.IP "\fBxlogin.Login.allowRootLogin\fP"