From 4642216f70dd98134a79f9299b7ca4bc876649c7 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sun, 28 Aug 2016 00:36:53 -0700 Subject: *: refactor all the things Long overdue house cleaning. The addition of compositing/monitoring overlays in vwm3 pushed vwm well past what is a reasonable size for a simple thousand line file. This is a first step towards restoring sanity in the code, but no behavioral differences are intended, this is mostly just shuffling around and organizing code. I expect some performance regressions initially, follow-on commits will make more improvements to that end as the dust settles. --- src/logo.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 src/logo.c (limited to 'src/logo.c') diff --git a/src/logo.c b/src/logo.c new file mode 100644 index 0000000..8fe7291 --- /dev/null +++ b/src/logo.c @@ -0,0 +1,66 @@ +/* + * \/\/\ + * + * Copyright (C) 2012-2016 Vito Caputo - + * + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 3 as published + * by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include + +#include "screen.h" +#include "vwm.h" + + /* startup logo */ + +/* animated \/\/\ logo done with simple XOR'd lines, a display of the WM being started and ready */ +#define VWM_LOGO_POINTS 6 +void vwm_draw_logo(vwm_t *vwm) +{ + int i; + unsigned int width, height, yoff, xoff; + XPoint points[VWM_LOGO_POINTS]; + const vwm_screen_t *scr = vwm_screen_find(vwm, VWM_SCREEN_REL_POINTER); + + XGrabServer(vwm->display); + + /* use the dimensions of the pointer-containing screen */ + width = scr->width; + height = scr->height; + xoff = scr->x_org; + yoff = scr->y_org + ((float)height * .333); + height /= 3; + + /* the logo gets shrunken vertically until it's essentially a flat line */ + while (height -= 2) { + /* scale and center the points to the screen size */ + for (i = 0; i < VWM_LOGO_POINTS; i++) { + points[i].x = xoff + (i * .2 * (float)width); + points[i].y = (i % 2 * (float)height) + yoff; + } + + XDrawLines(vwm->display, VWM_XROOT(vwm), vwm->gc, points, sizeof(points) / sizeof(XPoint), CoordModeOrigin); + XFlush(vwm->display); + usleep(3333); + XDrawLines(vwm->display, VWM_XROOT(vwm), vwm->gc, points, sizeof(points) / sizeof(XPoint), CoordModeOrigin); + XFlush(vwm->display); + + /* the width is shrunken as well, but only by as much as it is tall */ + yoff++; + width -= 4; + xoff += 2; + } + + XUngrabServer(vwm->display); +} -- cgit v1.2.3