diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2020-01-18 00:01:25 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2020-05-07 12:55:04 +0200 |
commit | 7b669d7e0e46cc63afb1448fdb01a3e0334c9728 (patch) | |
tree | 31bad593ae021e9c0bcd0620992b0571b6248e44 | |
parent | b1b02fe1c0e2a5a608446207985b98cecacfe12e (diff) | |
download | nx-libs-7b669d7e0e46cc63afb1448fdb01a3e0334c9728.tar.gz nx-libs-7b669d7e0e46cc63afb1448fdb01a3e0334c9728.tar.bz2 nx-libs-7b669d7e0e46cc63afb1448fdb01a3e0334c9728.zip |
Splash.c: center logo
was offset to the right and downwards before
Fixes ArcticaProject/nx-libs#892
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/Splash.c | 182 |
1 files changed, 104 insertions, 78 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index 2974f98b1..06ac62a59 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -178,9 +178,6 @@ void nxagentPaintLogo(Window win, XlibGC gc, int scale, int width, int height) int w = width/scale; int h = height/scale; - int w2 = w/2; - int h2 = h/2; - int c; if (height > width) { @@ -221,152 +218,181 @@ void nxagentPaintLogo(Window win, XlibGC gc, int scale, int width, int height) XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); #ifdef NXAGENT_LOGO_DEBUG - fprintf(stderr, "%s: filled first poly\n", __func__); + fprintf(stderr, "%s: filled background\n", __func__); #endif - /* - * Draw X2GO Logo - */ - if (blackRoot) XSetForeground(nxagentDisplay, gc, nxagentLogoDarkGray); else XSetForeground(nxagentDisplay, gc, nxagentLogoLightGray); + + #ifdef NXAGENT_LOGO_DEBUG + /* mark center */ + XDrawLine(nxagentDisplay, nxagentPixmapLogo, gc, 0, h/2, w, h/2); + XDrawLine(nxagentDisplay, nxagentPixmapLogo, gc, w/2, 0, w/2, h); + #endif + + /* + * Draw X2GO Logo + */ + +#define WX 5 /* width of "X" */ +#define W2 4 /* width of "2" */ +#define WG 4 /* width of "G" */ +#define WO 4 /* width of "O" */ +#define SPC 1 /* width of space between letters */ +#define H 8 /* height of letters */ + +#define TOTALW (WX + SPC + W2 + SPC + WG + SPC + WO) /* total width of logo */ +#define XSTART ((w - (TOTALW * c)) / 2) /* x position of whole logo */ +#define YSTART ((h - (H * c)) / 2) /* y position whole logo */ + +#define X(offset) (XSTART + (offset) * c) +#define Y(offset) (YSTART + (offset) * c) + /* * Start 'X'. */ - rect[0].x = w2-7*c; rect[0].y = h2-5*c; - rect[1].x = w2-8*c; rect[1].y = h2-5*c; - rect[2].x = w2-4*c; rect[2].y = h2+3*c; - rect[3].x = w2-3*c; rect[3].y = h2+3*c; + rect[0].x = X(1); rect[0].y = Y(0); + rect[1].x = X(0); rect[1].y = Y(0); + rect[2].x = X(4); rect[2].y = Y(8); + rect[3].x = X(5); rect[3].y = Y(8); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - rect[0].x = w2-4*c; rect[0].y = h2-5*c; - rect[1].x = w2-3*c; rect[1].y = h2-5*c; - rect[2].x = w2-7*c; rect[2].y = h2+3*c; - rect[3].x = w2-8*c; rect[3].y = h2+3*c; + rect[0].x = X(4); rect[0].y = Y(0); + rect[1].x = X(5); rect[1].y = Y(0); + rect[2].x = X(1); rect[2].y = Y(8); + rect[3].x = X(0); rect[3].y = Y(8); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); /* * End 'X'. */ +#undef X +#define X(offset) (XSTART + (SPC + WX + offset) * c) + /* * Start '2'. */ - rect[0].x = w2-2*c; rect[0].y = h2-5*c; - rect[1].x = w2-1*c; rect[1].y = h2-5*c; - rect[2].x = w2-1*c; rect[2].y = h2-3*c; - rect[3].x = w2-2*c; rect[3].y = h2-3*c; + rect[0].x = X(0); rect[0].y = Y(0); + rect[1].x = X(1); rect[1].y = Y(0); + rect[2].x = X(1); rect[2].y = Y(2); + rect[3].x = X(0); rect[3].y = Y(2); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - rect[0].x = w2-2*c; rect[0].y = h2-5*c; - rect[1].x = w2+2*c; rect[1].y = h2-5*c; - rect[2].x = w2+2*c; rect[2].y = h2-4*c; - rect[3].x = w2-2*c; rect[3].y = h2-4*c; + rect[0].x = X(0); rect[0].y = Y(0); + rect[1].x = X(4); rect[1].y = Y(0); + rect[2].x = X(4); rect[2].y = Y(1); + rect[3].x = X(0); rect[3].y = Y(1); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - rect[0].x = w2+1*c; rect[0].y = h2-5*c; - rect[1].x = w2+2*c; rect[1].y = h2-5*c; - rect[2].x = w2+2*c; rect[2].y = h2-2*c; - rect[3].x = w2+1*c; rect[3].y = h2-2*c; + rect[0].x = X(3); rect[0].y = Y(0); + rect[1].x = X(4); rect[1].y = Y(0); + rect[2].x = X(4); rect[2].y = Y(3); + rect[3].x = X(3); rect[3].y = Y(3); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - rect[0].x = w2+2*c; rect[0].y = h2-2*c; - rect[1].x = w2+1*c; rect[1].y = h2-2*c; - rect[2].x = w2-2*c; rect[2].y = h2+2*c; - rect[3].x = w2-1*c; rect[3].y = h2+2*c; + rect[0].x = X(4); rect[0].y = Y(3); + rect[1].x = X(3); rect[1].y = Y(3); + rect[2].x = X(0); rect[2].y = Y(7); + rect[3].x = X(1); rect[3].y = Y(7); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - - rect[0].x = w2-2*c; rect[0].y = h2+2*c; - rect[1].x = w2+2*c; rect[1].y = h2+2*c; - rect[2].x = w2+2*c; rect[2].y = h2+3*c; - rect[3].x = w2-2*c; rect[3].y = h2+3*c; + rect[0].x = X(0); rect[0].y = Y(7); + rect[1].x = X(4); rect[1].y = Y(7); + rect[2].x = X(4); rect[2].y = Y(8); + rect[3].x = X(0); rect[3].y = Y(8); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); + /* * End '2'. */ +#undef X +#define X(offset) (XSTART + (SPC + WX + SPC + W2 + offset) * c) + /* * Start 'G'. */ - rect[0].x = w2+3*c; rect[0].y = h2-5*c; - rect[1].x = w2+7*c; rect[1].y = h2-5*c; - rect[2].x = w2+7*c; rect[2].y = h2-4*c; - rect[3].x = w2+3*c; rect[3].y = h2-4*c; + rect[0].x = X(0); rect[0].y = Y(0); + rect[1].x = X(4); rect[1].y = Y(0); + rect[2].x = X(4); rect[2].y = Y(1); + rect[3].x = X(0); rect[3].y = Y(1); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - rect[0].x = w2+3*c; rect[0].y = h2-5*c; - rect[1].x = w2+4*c; rect[1].y = h2-5*c; - rect[2].x = w2+4*c; rect[2].y = h2+3*c; - rect[3].x = w2+3*c; rect[3].y = h2+3*c; + rect[0].x = X(0); rect[0].y = Y(0); + rect[1].x = X(1); rect[1].y = Y(0); + rect[2].x = X(1); rect[2].y = Y(8); + rect[3].x = X(0); rect[3].y = Y(8); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - rect[0].x = w2+3*c; rect[0].y = h2+2*c; - rect[1].x = w2+7*c; rect[1].y = h2+2*c; - rect[2].x = w2+7*c; rect[2].y = h2+3*c; - rect[3].x = w2+3*c; rect[3].y = h2+3*c; + rect[0].x = X(0); rect[0].y = Y(7); + rect[1].x = X(4); rect[1].y = Y(7); + rect[2].x = X(4); rect[2].y = Y(8); + rect[3].x = X(0); rect[3].y = Y(8); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - rect[0].x = w2+6*c; rect[0].y = h2-5*c; - rect[1].x = w2+7*c; rect[1].y = h2-5*c; - rect[2].x = w2+7*c; rect[2].y = h2-3*c; - rect[3].x = w2+6*c; rect[3].y = h2-3*c; + rect[0].x = X(3); rect[0].y = Y(0); + rect[1].x = X(4); rect[1].y = Y(0); + rect[2].x = X(4); rect[2].y = Y(2); + rect[3].x = X(3); rect[3].y = Y(2); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - rect[0].x = w2+6*c; rect[0].y = h2-0*c; - rect[1].x = w2+7*c; rect[1].y = h2-0*c; - rect[2].x = w2+7*c; rect[2].y = h2+3*c; - rect[3].x = w2+6*c; rect[3].y = h2+3*c; + rect[0].x = X(3); rect[0].y = Y(5); + rect[1].x = X(4); rect[1].y = Y(5); + rect[2].x = X(4); rect[2].y = Y(8); + rect[3].x = X(3); rect[3].y = Y(8); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - rect[0].x = w2+5*c; rect[0].y = h2-1*c; - rect[1].x = w2+7*c; rect[1].y = h2-1*c; - rect[2].x = w2+7*c; rect[2].y = h2+0*c; - rect[3].x = w2+5*c; rect[3].y = h2+0*c; + rect[0].x = X(2); rect[0].y = Y(4); + rect[1].x = X(4); rect[1].y = Y(4); + rect[2].x = X(4); rect[2].y = Y(5); + rect[3].x = X(2); rect[3].y = Y(5); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); /* * End 'G'. */ +#undef X +#define X(offset) (XSTART + (SPC + WX + SPC + W2 + SPC + WG + offset) * c) + /* * Start 'O'. */ - rect[0].x = w2+8*c; rect[0].y = h2-5*c; - rect[1].x = w2+12*c; rect[1].y = h2-5*c; - rect[2].x = w2+12*c; rect[2].y = h2-4*c; - rect[3].x = w2+8*c; rect[3].y = h2-4*c; + rect[0].x = X(0); rect[0].y = Y(0); + rect[1].x = X(4); rect[1].y = Y(0); + rect[2].x = X(4); rect[2].y = Y(1); + rect[3].x = X(0); rect[3].y = Y(1); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - rect[0].x = w2+8*c; rect[0].y = h2+3*c; - rect[1].x = w2+12*c; rect[1].y = h2+3*c; - rect[2].x = w2+12*c; rect[2].y = h2+2*c; - rect[3].x = w2+8*c; rect[3].y = h2+2*c; + rect[0].x = X(0); rect[0].y = Y(8); + rect[1].x = X(4); rect[1].y = Y(8); + rect[2].x = X(4); rect[2].y = Y(7); + rect[3].x = X(0); rect[3].y = Y(7); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - rect[0].x = w2+8*c; rect[0].y = h2-5*c; - rect[1].x = w2+9*c; rect[1].y = h2-5*c; - rect[2].x = w2+9*c; rect[2].y = h2+3*c; - rect[3].x = w2+8*c; rect[3].y = h2+3*c; + rect[0].x = X(0); rect[0].y = Y(0); + rect[1].x = X(1); rect[1].y = Y(0); + rect[2].x = X(1); rect[2].y = Y(8); + rect[3].x = X(0); rect[3].y = Y(8); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); - rect[0].x = w2+11*c; rect[0].y = h2-5*c; - rect[1].x = w2+12*c; rect[1].y = h2-5*c; - rect[2].x = w2+12*c; rect[2].y = h2+3*c; - rect[3].x = w2+11*c; rect[3].y = h2+3*c; + rect[0].x = X(3); rect[0].y = Y(0); + rect[1].x = X(4); rect[1].y = Y(0); + rect[2].x = X(4); rect[2].y = Y(8); + rect[3].x = X(3); rect[3].y = Y(8); XFillPolygon(nxagentDisplay, nxagentPixmapLogo, gc, rect, 4, Convex, CoordModeOrigin); /* * End 'O'. */ - XSetWindowBackgroundPixmap(nxagentDisplay, win, nxagentPixmapLogo); #ifdef NXAGENT_LOGO_DEBUG |