1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/*
* \/\/\
*
* Copyright (C) 2012-2017 Vito Caputo - <vcaputo@pengaru.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_XDISPLAY(vwm));
/* 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_XDISPLAY(vwm), VWM_XROOT(vwm), VWM_XGC(vwm), points, sizeof(points) / sizeof(XPoint), CoordModeOrigin);
XFlush(VWM_XDISPLAY(vwm));
usleep(3333);
XDrawLines(VWM_XDISPLAY(vwm), VWM_XROOT(vwm), VWM_XGC(vwm), points, sizeof(points) / sizeof(XPoint), CoordModeOrigin);
XFlush(VWM_XDISPLAY(vwm));
/* the width is shrunken as well, but only by as much as it is tall */
yoff++;
width -= 4;
xoff += 2;
}
XUngrabServer(VWM_XDISPLAY(vwm));
}
|