summaryrefslogtreecommitdiff
path: root/src/logo.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@gnugeneration.com>2016-08-28 00:36:53 -0700
committerVito Caputo <vcaputo@gnugeneration.com>2016-09-09 14:14:31 -0700
commit4642216f70dd98134a79f9299b7ca4bc876649c7 (patch)
treebdf9fd892bc54a2f2a678a9828c6af9d9fc8bed2 /src/logo.c
parente99f5ac1293a0ae1f498bc4c73c4c04e4edb8665 (diff)
*: 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.
Diffstat (limited to 'src/logo.c')
-rw-r--r--src/logo.c66
1 files changed, 66 insertions, 0 deletions
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 - <vcaputo@gnugeneration.com>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include <unistd.h>
+#include <X11/Xlib.h>
+
+#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);
+}
© All Rights Reserved