2 * Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
3 * Copyright (C) 2004-2009 Kim Woelders
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
6 * of this software and associated documentation files (the "Software"), to
7 * deal in the Software without restriction, including without limitation the
8 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
9 * sell copies of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies of the Software, its documentation and marketing & publicity
14 * materials, and acknowledgment shall be given in the documentation, materials
15 * and software packages that this Software was used.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 #include "backgrounds.h"
31 static EObj *init_win1 = NULL;
32 static EObj *init_win2 = NULL;
33 static char bg_sideways = 0;
36 StartupWindowsCreate(void)
38 Win w1, w2, win1, win2, b1, b2;
41 int x, y, bx, by, bw, bh;
44 /* Acting only as boolean? */
45 if (BackgroundFind("STARTUP_BACKGROUND_SIDEWAYS"))
48 ic = ImageclassFind("STARTUP_BAR", 0);
50 ic = ImageclassFind("DESKTOP_DRAGBUTTON_HORIZ", 0);
51 bg = BackgroundFind("STARTUP_BACKGROUND");
57 x = WinGetW(VROOT) / 2;
59 bx = WinGetW(VROOT) - Conf.desks.dragbar_width;
61 bw = Conf.desks.dragbar_width;
67 y = WinGetH(VROOT) / 2;
69 by = WinGetH(VROOT) - Conf.desks.dragbar_width;
71 bh = Conf.desks.dragbar_width;
74 eo = EobjWindowCreate(EOBJ_TYPE_MISC,
75 -x, -y, WinGetW(VROOT), WinGetH(VROOT), 1, "Init-1");
80 win1 = ECreateWindow(w1, x, y, WinGetW(VROOT), WinGetH(VROOT), 0);
82 eo = EobjWindowCreate(EOBJ_TYPE_MISC,
83 x, y, WinGetW(VROOT), WinGetH(VROOT), 1, "Init-2");
88 win2 = ECreateWindow(w2, -x, -y, WinGetW(VROOT), WinGetH(VROOT), 0);
95 b1 = ECreateWindow(w1, bx, by, bw, bh, 0);
96 b2 = ECreateWindow(w2, 0, 0, bw, bh, 0);
100 ImageclassApply(ic, b1, 0, 0, 0, ST_SOLID);
101 ImageclassApply(ic, b2, 0, 0, 0, ST_SOLID);
104 BackgroundSet(bg, win1, WinGetW(VROOT), WinGetH(VROOT));
105 BackgroundSet(bg, win2, WinGetW(VROOT), WinGetH(VROOT));
106 StartupBackgroundsDestroy();
108 EobjMap(init_win1, 0);
109 EobjMap(init_win2, 0);
115 StartupBackgroundsDestroy(void)
117 BackgroundDestroyByName("STARTUP_BACKGROUND");
118 BackgroundDestroyByName("STARTUP_BACKGROUND_SIDEWAYS");
122 doStartupWindowsOpen(void *data __UNUSED__)
125 int k, x, y, xOffset, yOffset, ty;
130 { /* so we can have two different slide methods */
131 ty = (WinGetW(VROOT) / 2);
132 xOffset = (ty * k) >> 10;
139 ty = (WinGetH(VROOT) / 2);
142 yOffset = (ty * k) >> 10;
146 EobjMove(init_win1, -x - xOffset, -y - yOffset);
147 EobjMove(init_win2, x + xOffset, y + yOffset);
149 k = (int)(1e-3 * Conf.animation.step * Conf.desks.slidespeed / 2);
156 Mode.place.enable_features++;
157 EobjWindowDestroy(init_win1);
158 EobjWindowDestroy(init_win2);
166 StartupWindowsOpen(void)
168 if (init_win1 == NULL || init_win2 == NULL)
171 Mode.place.enable_features--;
172 ESync(ESYNC_STARTUP);
173 AnimatorAdd(doStartupWindowsOpen, NULL);