Commit 612cbcc4 authored by Ulrich Sibiller's avatar Ulrich Sibiller Committed by Mike Gabriel

Splash.c: code cleanup

parent 3c92d889
...@@ -64,7 +64,7 @@ int nxagentLogoRed; ...@@ -64,7 +64,7 @@ int nxagentLogoRed;
int nxagentLogoBlack; int nxagentLogoBlack;
int nxagentLogoGray; int nxagentLogoGray;
void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height); static void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height);
/* /*
* From Screen.c. * From Screen.c.
...@@ -92,14 +92,14 @@ void nxagentShowSplashWindow(Window parentWindow) ...@@ -92,14 +92,14 @@ void nxagentShowSplashWindow(Window parentWindow)
return; return;
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentShowSplashWindow: Got called.\n"); fprintf(stderr, "%s: Got called.\n", __func__);
#endif #endif
#ifdef NXAGENT_TIMESTAMP #ifdef NXAGENT_TIMESTAMP
{ {
extern unsigned long startTime; extern unsigned long startTime;
fprintf(stderr, "nxagentShowSplashWindow: Initializing splash start at [%d] milliseconds.\n", fprintf(stderr, "%s: Initializing splash start at [%d] milliseconds.\n", __func__,
GetTimeInMillis() - startTime); GetTimeInMillis() - startTime);
} }
#endif #endif
...@@ -139,7 +139,7 @@ void nxagentShowSplashWindow(Window parentWindow) ...@@ -139,7 +139,7 @@ void nxagentShowSplashWindow(Window parentWindow)
getAttributes.height = nxagentOption(RootHeight); getAttributes.height = nxagentOption(RootHeight);
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentShowSplashWindow: Going to create new splash window.\n"); fprintf(stderr, "%s: Going to create new splash window.\n", __func__);
#endif #endif
nxagentSplashWindow = nxagentSplashWindow =
...@@ -152,7 +152,7 @@ void nxagentShowSplashWindow(Window parentWindow) ...@@ -152,7 +152,7 @@ void nxagentShowSplashWindow(Window parentWindow)
BlackPixel (nxagentDisplay, 0)); BlackPixel (nxagentDisplay, 0));
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentShowSplashWindow: Created new splash window with id [%ld].\n", fprintf(stderr, "%s: Created new splash window with id [%ld].\n", __func__,
nxagentSplashWindow); nxagentSplashWindow);
#endif #endif
...@@ -168,7 +168,7 @@ void nxagentShowSplashWindow(Window parentWindow) ...@@ -168,7 +168,7 @@ void nxagentShowSplashWindow(Window parentWindow)
#ifdef NXAGENT_TIMESTAMP #ifdef NXAGENT_TIMESTAMP
{ {
extern unsigned long startTime; extern unsigned long startTime;
fprintf(stderr, "nxagentShowSplashWindow: Splash ends [%d] milliseconds.\n", fprintf(stderr, "%s: Splash ends [%d] milliseconds.\n", __func__,
GetTimeInMillis() - startTime); GetTimeInMillis() - startTime);
} }
#endif #endif
...@@ -176,26 +176,25 @@ void nxagentShowSplashWindow(Window parentWindow) ...@@ -176,26 +176,25 @@ void nxagentShowSplashWindow(Window parentWindow)
void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height) void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height)
{ {
XPoint rect[4];
int w, h, c, w2, h2;
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, "nxagentPaintLogo: Got called.\n"); fprintf(stderr, "%s: Got called.\n", __func__);
#endif #endif
#ifdef NXAGENT_LOGO_DEBUG #ifdef NXAGENT_LOGO_DEBUG
fprintf(stderr, "nxagentPaintLogo: begin\n"); fprintf(stderr, "%s: begin\n", __func__);
fprintf(stderr, "nxagentPaintLogo: gen params are: w=%d h=%d d=%d r=%x w=%x b=%x\n",width, height, fprintf(stderr, "%s: gen params are: w=%d h=%d d=%d r=%x w=%x b=%x\n", __func__,
width, height,
nxagentLogoDepth, nxagentLogoRed, nxagentLogoDepth, nxagentLogoRed,
nxagentLogoWhite, nxagentLogoBlack); nxagentLogoWhite, nxagentLogoBlack);
#endif #endif
w = width/scale; int w = width/scale;
h = height/scale; int h = height/scale;
w2 = w/2; int w2 = w/2;
h2 = h/2; int h2 = h/2;
int c;
if (height > width) if (height > width)
{ {
c = w/30; c = w/30;
...@@ -205,6 +204,7 @@ void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height) ...@@ -205,6 +204,7 @@ void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height)
c = w/48; c = w/48;
} }
XPoint rect[4];
rect[0].x = 0; rect[0].y = 0; rect[0].x = 0; rect[0].y = 0;
rect[1].x = 0; rect[1].y = h; rect[1].x = 0; rect[1].y = h;
rect[2].x = w; rect[2].y = h; rect[2].x = w; rect[2].y = h;
...@@ -225,7 +225,7 @@ void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height) ...@@ -225,7 +225,7 @@ void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height)
XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin);
#ifdef NXAGENT_LOGO_DEBUG #ifdef NXAGENT_LOGO_DEBUG
fprintf(stderr, "filled first poly\n"); fprintf(stderr, "%s: filled first poly\n", __func__);
#endif #endif
XSetForeground(nxagentDisplay, gc, nxagentLogoRed); XSetForeground(nxagentDisplay, gc, nxagentLogoRed);
...@@ -374,16 +374,17 @@ void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height) ...@@ -374,16 +374,17 @@ void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height)
XSetWindowBackgroundPixmap(nxagentDisplay, win, nxagentPixmapLogo); XSetWindowBackgroundPixmap(nxagentDisplay, win, nxagentPixmapLogo);
#ifdef NXAGENT_LOGO_DEBUG #ifdef NXAGENT_LOGO_DEBUG
fprintf(stderr, "nxagentPaintLogo: end\n"); fprintf(stderr, "%s: end\n", __func__);
#endif #endif
} }
void nxagentRemoveSplashWindow(WindowPtr pWin) void nxagentRemoveSplashWindow(WindowPtr pWin)
{ {
if (nxagentReconnectTrap) return; if (nxagentReconnectTrap)
return;
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentRemoveSplashWindow: Destroying the splash window.\n"); fprintf(stderr, "%s: Destroying the splash window.\n", __func__);
#endif #endif
if (!nxagentWMPassed) if (!nxagentWMPassed)
...@@ -402,7 +403,7 @@ void nxagentRemoveSplashWindow(WindowPtr pWin) ...@@ -402,7 +403,7 @@ void nxagentRemoveSplashWindow(WindowPtr pWin)
nxagentRefreshWindows(screenInfo.screens[0]->root); nxagentRefreshWindows(screenInfo.screens[0]->root);
#ifdef TEST #ifdef TEST
fprintf(stderr, "nxagentRemoveSplashWindow: setting the ownership of %s (%d) on window 0x%lx\n", fprintf(stderr, "%s: setting the ownership of %s (%d) on window 0x%lx\n", __func__
"NX_CUT_BUFFER_SERVER", (int)serverCutProperty, nxagentWindow(screenInfo.screens[0]->root)); "NX_CUT_BUFFER_SERVER", (int)serverCutProperty, nxagentWindow(screenInfo.screens[0]->root));
#endif #endif
...@@ -413,7 +414,6 @@ void nxagentRemoveSplashWindow(WindowPtr pWin) ...@@ -413,7 +414,6 @@ void nxagentRemoveSplashWindow(WindowPtr pWin)
if (nxagentPixmapLogo) if (nxagentPixmapLogo)
{ {
XFreePixmap(nxagentDisplay, nxagentPixmapLogo); XFreePixmap(nxagentDisplay, nxagentPixmapLogo);
nxagentPixmapLogo = (Pixmap) 0; nxagentPixmapLogo = (Pixmap) 0;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment