int main(int argc, char **argv) { int ch, i, loop; struct utsname ubuf; const char *str, *dstr; /* This function runs all the setup for startup, and then * proceeds into the primary event loop at the end. */ /* Init state variable struct */ memset(&Mode, 0, sizeof(EMode)); Mode.wm.master = 1; Mode.wm.pid = getpid(); Mode.wm.exec_name = argv[0]; Mode.wm.startup = 1; Mode.mode = MODE_NONE; EXInit(); Dpy.screen = -1; str = getenv("EDEBUG"); if (str) EDebugInit(str); str = getenv("EDEBUG_COREDUMP"); if (str) Mode.wm.coredump = 1; str = getenv("EDEBUG_EXIT"); if (str) Mode.debug_exit = atoi(str); str = getenv("ECONFNAME"); if (str) EConfNameSet(str); str = getenv("ECONFDIR"); if (str) EDirUserSet(str); str = getenv("ECACHEDIR"); if (str) EDirUserCacheSet(str); srand((unsigned int)time(NULL)); if (!uname(&ubuf)) Mode.wm.machine_name = Estrdup(ubuf.nodename); if (!Mode.wm.machine_name) Mode.wm.machine_name = Estrdup("localhost"); /* Now we're going to interpret any of the commandline parameters * that are passed to it -- Well, at least the ones that we * understand. */ Mode.theme.path = NULL; dstr = NULL; for (loop = 1; loop;) { ch = EoptGet(argc, argv); if (ch <= 0) break; #if 0 Eprintf("Opt: %c: %d - %s\n", ch, eoptind, eoptarg); #endif switch (ch) { default: case '?': printf("e16: Ignoring: "); for (i = eoptind; i < argc; i++) printf("%s ", argv[i]); printf("\n"); loop = 0; break; case 'h': EoptHelp(); exit(0); break; case 'd': dstr = eoptarg; break; case 'f': Mode.wm.restart = 1; break; case 'p': EConfNameSet(eoptarg); break; case 'P': EDirUserSet(eoptarg); break; case 'Q': EDirUserCacheSet(eoptarg); break; case 's': Mode.wm.single = 1; Dpy.screen = strtoul(eoptarg, NULL, 10); break; case 'S': SetSMID(eoptarg); break; case 't': Mode.theme.path = Estrdup(eoptarg); break; case 'V': printf("%s %s\n", e_wm_name, e_wm_version); exit(0); break; case 'v': EDebugSet(EDBUG_TYPE_VERBOSE, 1); break; case 'w': sscanf(eoptarg, "%dx%d", &Mode.wm.win_w, &Mode.wm.win_h); Mode.wm.window = 1; Mode.wm.single = 1; Mode.wm.master = 0; break; #ifdef USE_EXT_INIT_WIN case 'X': ExtInitWinSet(strtoul(eoptarg, NULL, 0)); Mode.wm.restart = 1; break; #endif case 'm': Mode.wm.master = 0; Mode.wm.master_screen = strtoul(eoptarg, NULL, 10); break; } } SignalsSetup(); /* Install signal handlers */ EDirsSetup(); ECheckEprog("epp"); ECheckEprog("eesh"); SetupX(dstr); /* This is where the we fork per screen */ /* X is now running, and we have forked per screen */ ESavePrefixSetup(); /* So far nothing should rely on a selected settings or theme. */ ConfigurationLoad(); /* Load settings */ /* Initialise internationalisation */ LangInit(); /* The theme path must now be available for config file loading. */ ThemePathFind(); /* Set the Environment variables */ Esetenv("EVERSION", e_wm_version); Esetenv("EROOT", EDirRoot()); Esetenv("EBIN", EDirBin()); Esetenv("ECONFDIR", EDirUser()); Esetenv("ECACHEDIR", EDirUserCache()); Esetenv("ETHEME", Mode.theme.path); /* Move elsewhere? */ EImageInit(); HintsInit(); CommsInit(); SessionInit(); SnapshotsLoad(); #if USE_DBUS DbusInit(); #endif if (Mode.wm.window) EMapWindow(VROOT); ModulesSignal(ESIGNAL_INIT, NULL); /* Load the theme */ ThemeConfigLoad(); if (Mode.debug_exit) return 0; /* Do initial configuration */ ModulesSignal(ESIGNAL_CONFIGURE, NULL); /* Set root window cursor */ ECsrApply(ECSR_ROOT, WinGetXwin(VROOT)); #ifdef USE_EXT_INIT_WIN /* Kill the E process owning the "init window" */ ExtInitWinKill(); #endif /* let's make sure we set this up and go to our desk anyways */ DeskGoto(DesksGetCurrent()); ESync(ESYNC_MAIN); #ifdef SIGCONT for (i = 0; i < Mode.wm.child_count; i++) kill(Mode.wm.children[i], SIGCONT); #endif ModulesSignal(ESIGNAL_START, NULL); #if ENABLE_DIALOGS DialogsInit(); #endif EwinsManage(); RunInitPrograms(); SnapshotsSpawn(); if (!Mode.wm.restart) StartupWindowsOpen(); Conf.startup.firsttime = 0; Mode.wm.save_ok = Conf.autosave; Mode.wm.startup = 0; autosave(); /* The primary event loop */ EventsMain(); SessionExit(EEXIT_QUIT, NULL); return 0; }
void TooltipShow(ToolTip * tt, const char *text, ActionClass * ac, int x, int y) { int i, w, h, ix, iy, iw, ih, dx, dy, xx, yy; int ww, hh, adx, ady, dist; int headline_h = 0, headline_w = 0, icons_width = 0, labels_width = 0, double_w = 0; EImage *im; int *heights = NULL; ImageClass *ic; EImageBorder *pad; int cols[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; int num, modifiers; Action *aa; const char *tts; EObj *eo; if (!tt || Mode.mode != MODE_NONE) return; if (!tt->TTWIN) { TooltipRealize(tt); if (!tt->TTWIN) return; } /* if we get an actionclass, look for tooltip action texts */ h = 0; if (ac) { num = ActionclassGetActionCount(ac); heights = EMALLOC(int, num); for (i = 0; i < num; i++) { int temp_w, temp_h; temp_w = 0; temp_h = 0; aa = ActionclassGetAction(ac, i); if (!aa) continue; tts = ActionGetTooltipString(aa); if (!tts) continue; tts = _(tts); TextSize(tt->tclass, 0, 0, STATE_NORMAL, tts, &temp_w, &temp_h, 17); if (temp_w > labels_width) labels_width = temp_w; temp_w = 0; if (ActionGetEvent(aa) == EVENT_DOUBLE_DOWN) { TextSize(tt->tclass, 0, 0, STATE_NORMAL, "2x", &double_w, &temp_h, 17); if (cols[0] < double_w) cols[0] = double_w; } if (ActionGetAnybutton(aa)) { TooltipCreateIclass("TOOLTIP_MOUSEBUTTON_ANY", "pix/mouse_any.png", &cols[1], &temp_h); } else switch (ActionGetButton(aa)) { case 1: TooltipCreateIclass("TOOLTIP_MOUSEBUTTON_1", "pix/mouse_1.png", &cols[1], &temp_h); break; case 2: TooltipCreateIclass("TOOLTIP_MOUSEBUTTON_2", "pix/mouse_2.png", &cols[1], &temp_h); break; case 3: TooltipCreateIclass("TOOLTIP_MOUSEBUTTON_3", "pix/mouse_3.png", &cols[1], &temp_h); break; case 4: TooltipCreateIclass("TOOLTIP_MOUSEBUTTON_4", "pix/mouse_4.png", &cols[1], &temp_h); break; case 5: TooltipCreateIclass("TOOLTIP_MOUSEBUTTON_5", "pix/mouse_5.png", &cols[1], &temp_h); break; case 0: default: break; } modifiers = ActionGetModifiers(aa); if (modifiers) { if (modifiers & ShiftMask) TooltipCreateIclass("TOOLTIP_KEY_SHIFT", "pix/key_shift.png", &cols[2], &temp_h); if (modifiers & LockMask) TooltipCreateIclass("TOOLTIP_KEY_LOCK", "pix/key_lock.png", &cols[3], &temp_h); if (modifiers & ControlMask) TooltipCreateIclass("TOOLTIP_KEY_CTRL", "pix/key_ctrl.png", &cols[4], &temp_h); if (modifiers & Mod1Mask) TooltipCreateIclass("TOOLTIP_KEY_MOD1", "pix/key_mod1.png", &cols[5], &temp_h); if (modifiers & Mod2Mask) TooltipCreateIclass("TOOLTIP_KEY_MOD2", "pix/key_mod2.png", &cols[6], &temp_h); if (modifiers & Mod3Mask) TooltipCreateIclass("TOOLTIP_KEY_MOD3", "pix/key_mod3.png", &cols[7], &temp_h); if (modifiers & Mod4Mask) TooltipCreateIclass("TOOLTIP_KEY_MOD4", "pix/key_mod4.png", &cols[8], &temp_h); if (modifiers & Mod5Mask) TooltipCreateIclass("TOOLTIP_KEY_MOD5", "pix/key_mod5.png", &cols[9], &temp_h); } temp_w = cols[0] + cols[1] + cols[2] + cols[3] + cols[4] + cols[5] + cols[6] + cols[7] + cols[8] + cols[9]; if (temp_w > icons_width) icons_width = temp_w; heights[i] = temp_h; h += temp_h; } } TextSize(tt->tclass, 0, 0, STATE_NORMAL, text, &headline_w, &headline_h, 17); if (headline_w < icons_width + labels_width) w = icons_width + labels_width; else w = headline_w; h += headline_h; ic = tt->TTICL; pad = ImageclassGetPadding(ic); iw = 0; ih = 0; if (tt->tooltippic) { im = ImageclassGetImage(tt->tooltippic, 0, 0, 0); if (im) { EImageGetSize(im, &iw, &ih); EImageFree(im); } w += iw; if (h < ih) h = ih; } w += pad->left + pad->right; h += pad->top + pad->bottom; if ((tt->tooltippic) && (iw > 0) && (ih > 0)) { ix = pad->left; iy = (h - ih) / 2; EMoveResizeWindow(tt->iwin, ix, iy, iw, ih); EMapWindow(tt->iwin); ImageclassApply(tt->tooltippic, tt->iwin, 0, 0, STATE_NORMAL, ST_SOLID); } else EUnmapWindow(tt->iwin); dx = x - WinGetW(VROOT) / 2; dy = y - WinGetH(VROOT) / 2; if ((dy == 0) && (dx == 0)) dy = -1; adx = dx; if (adx < 0) adx = -adx; ady = dy; if (ady < 0) ady = -ady; if (adx < ady) /* +-------+ */ /* |\#####/| */ /* | \###/ | */ /* | \#/ | */ /* | /#\ | */ /* | /###\ | */ /* |/#####\| */ /* +-------+ */ { if (dy == 0) { dy = 1; ady = 1; } dist = tt->dist; ady = ady / dy; if (tt->win[0]) { yy = y - ((ady * 10 * dist) / 100); xx = x - (dist * 10 * dx) / (100 * WinGetW(VROOT) / 2); EobjMove(tt->win[0], xx - 4, yy - 4); } if (tt->win[1]) { yy = y - ((ady * 30 * dist) / 100); xx = x - (dist * 30 * dx) / (100 * WinGetW(VROOT) / 2); EobjMove(tt->win[1], xx - 8, yy - 8); } if (tt->win[2]) { yy = y - ((ady * 50 * dist) / 100); xx = x - (dist * 50 * dx) / (100 * WinGetW(VROOT) / 2); EobjMove(tt->win[2], xx - 12, yy - 12); } if (tt->win[3]) { yy = y - ((ady * 80 * dist) / 100); xx = x - (dist * 80 * dx) / (100 * WinGetW(VROOT) / 2); EobjMove(tt->win[3], xx - 16, yy - 16); } yy = y - ((ady * 100 * dist) / 100); xx = x - (dist * 100 * dx) / (100 * WinGetW(VROOT) / 2); if (ady < 0) hh = 0; else hh = h; ww = (w / 2) + ((dx * w) / (WinGetW(VROOT) / 2)); } else /* +-------+ */ /* |\ /| */ /* |#\ /#| */ /* |##\ /##| */ /* |##/ \##| */ /* |#/ \#| */ /* |/ \| */ /* +-------+ */ { if (dx == 0) { dx = 1; adx = 1; } dist = tt->dist; adx = adx / dx; if (tt->win[0]) { xx = x - ((adx * 10 * dist) / 100); yy = y - (dist * 10 * dy) / (100 * WinGetH(VROOT) / 2); EobjMove(tt->win[0], xx - 4, yy - 4); } if (tt->win[1]) { xx = x - ((adx * 30 * dist) / 100); yy = y - (dist * 30 * dy) / (100 * WinGetH(VROOT) / 2); EobjMove(tt->win[1], xx - 8, yy - 8); } if (tt->win[2]) { xx = x - ((adx * 50 * dist) / 100); yy = y - (dist * 50 * dy) / (100 * WinGetH(VROOT) / 2); EobjMove(tt->win[2], xx - 12, yy - 12); } if (tt->win[3]) { xx = x - ((adx * 80 * dist) / 100); yy = y - (dist * 80 * dy) / (100 * WinGetH(VROOT) / 2); EobjMove(tt->win[3], xx - 16, yy - 16); } xx = x - ((adx * 100 * dist) / 100); yy = y - (dist * 100 * dy) / (100 * WinGetH(VROOT) / 2); if (adx < 0) ww = 0; else ww = w; hh = (h / 2) + ((dy * h) / (WinGetH(VROOT) / 2)); } EobjMoveResize(tt->TTWIN, xx - ww, yy - hh, w, h); for (i = 0; i < 5; i++) { eo = tt->win[i]; if (!eo) continue; ImageclassApply(tt->iclass[i], EobjGetWin(eo), 0, 0, STATE_NORMAL, ST_TOOLTIP); EobjShapeUpdate(eo, 0); EobjMap(eo, 0); } xx = pad->left + iw; /* draw the ordinary tooltip text */ TextDraw(tt->tclass, EobjGetWin(tt->TTWIN), None, 0, 0, STATE_NORMAL, text, xx, pad->top, headline_w, headline_h, 17, 512); /* draw the icons and labels, if any */ if (ac) { num = ActionclassGetActionCount(ac); y = pad->top + headline_h; xx = pad->left + double_w; for (i = 0; i < num; i++) { x = xx + iw; aa = ActionclassGetAction(ac, i); if (!aa) continue; tts = ActionGetTooltipString(aa); if (!tts) continue; tts = _(tts); if (ActionGetEvent(aa) == EVENT_DOUBLE_DOWN) { TextDraw(tt->tclass, EobjGetWin(tt->TTWIN), None, 0, 0, STATE_NORMAL, "2x", xx + iw - double_w, y, double_w, heights[i], 17, 0); } if (ActionGetAnybutton(aa)) { TooltipIclassPaste(tt, "TOOLTIP_MOUSEBUTTON_ANY", x, y, &x); } else switch (ActionGetButton(aa)) { case 1: TooltipIclassPaste(tt, "TOOLTIP_MOUSEBUTTON_1", x, y, &x); break; case 2: TooltipIclassPaste(tt, "TOOLTIP_MOUSEBUTTON_2", x, y, &x); break; case 3: TooltipIclassPaste(tt, "TOOLTIP_MOUSEBUTTON_3", x, y, &x); break; case 4: TooltipIclassPaste(tt, "TOOLTIP_MOUSEBUTTON_4", x, y, &x); break; case 5: TooltipIclassPaste(tt, "TOOLTIP_MOUSEBUTTON_5", x, y, &x); break; default: break; } modifiers = ActionGetModifiers(aa); if (modifiers) { if (modifiers & ShiftMask) TooltipIclassPaste(tt, "TOOLTIP_KEY_SHIFT", x, y, &x); if (modifiers & LockMask) TooltipIclassPaste(tt, "TOOLTIP_KEY_LOCK", x, y, &x); if (modifiers & ControlMask) TooltipIclassPaste(tt, "TOOLTIP_KEY_CTRL", x, y, &x); if (modifiers & Mod1Mask) TooltipIclassPaste(tt, "TOOLTIP_KEY_MOD1", x, y, &x); if (modifiers & Mod2Mask) TooltipIclassPaste(tt, "TOOLTIP_KEY_MOD2", x, y, &x); if (modifiers & Mod3Mask) TooltipIclassPaste(tt, "TOOLTIP_KEY_MOD3", x, y, &x); if (modifiers & Mod4Mask) TooltipIclassPaste(tt, "TOOLTIP_KEY_MOD4", x, y, &x); if (modifiers & Mod5Mask) TooltipIclassPaste(tt, "TOOLTIP_KEY_MOD5", x, y, &x); } TextDraw(tt->tclass, EobjGetWin(tt->TTWIN), None, 0, 0, STATE_NORMAL, tts, pad->left + icons_width + iw, y, labels_width, heights[i], 17, 0); y += heights[i]; } } Efree(heights); }
static void MenuRealize(Menu * m) { int i, maxh, maxw, nmaxy; int maxx1, maxx2, w, h, x, y, r, mmw, mmh; EImage *im; EImageBorder *pad, *pad_item, *pad_sub; char has_i, has_s; if (m->num <= 0) return; if (!m->style) { MenuSetStyle(m, NULL); if (!m->style) return; } if (!m->win) { m->win = ECreateClientWindow(VROOT, 0, 0, 1, 1); EventCallbackRegister(m->win, MenuHandleEvents, m); } maxh = maxw = 0; maxx1 = 0; maxx2 = 0; has_i = 0; has_s = 0; for (i = 0; i < m->num; i++) { m->items[i]->menu = m; if (m->items[i]->child) has_s = 1; else has_i = 1; m->items[i]->win = ECreateWindow(m->win, 0, 0, 1, 1, 0); EventCallbackRegister(m->items[i]->win, MenuItemHandleEvents, m->items[i]); ESelectInput(m->items[i]->win, MENU_ITEM_EVENT_MASK); EMapWindow(m->items[i]->win); if ((m->style->tclass) && (m->items[i]->text)) { TextSize(m->style->tclass, 0, 0, 0, _(m->items[i]->text), &w, &h, 17); if (h > maxh) maxh = h; if (w > maxx1) maxx1 = w; m->items[i]->text_w = w; m->items[i]->text_h = h; } if (m->items[i]->icon_iclass && Conf.menus.show_icons) { im = ImageclassGetImage(m->items[i]->icon_iclass, 0, 0, 0); if (im) { w = h = 0; if (m->icon_size > 0) w = h = m->icon_size; else if (m->icon_size == 0) w = h = Conf.menus.icon_size; if (w <= 0 || h <= 0) EImageGetSize(im, &w, &h); m->items[i]->icon_w = w; m->items[i]->icon_h = h; m->items[i]->icon_win = ECreateWindow(m->items[i]->win, 0, 0, w, h, 0); EMapWindow(m->items[i]->icon_win); if (h > maxh) maxh = h; if (w > maxx2) maxx2 = w; EImageFree(im); } else m->items[i]->icon_iclass = NULL; } } pad = ImageclassGetPadding(m->style->bg_iclass); pad_item = ImageclassGetPadding(m->style->item_iclass); pad_sub = ImageclassGetPadding(m->style->sub_iclass); if (((has_i) && (has_s)) || ((!has_i) && (!has_s))) { if (pad_item->top > pad_sub->top) maxh += pad_item->top; else maxh += pad_sub->top; if (pad_item->bottom > pad_sub->bottom) maxh += pad_item->bottom; else maxh += pad_sub->bottom; maxw = maxx1 + maxx2; if (pad_item->left > pad_sub->left) maxw += pad_item->left; else maxw += pad_sub->left; if (pad_item->right > pad_sub->right) maxw += pad_item->right; else maxw += pad_sub->right; } else if (has_i) { maxh += pad_item->top; maxh += pad_item->bottom; maxw = maxx1 + maxx2; maxw += pad_item->left; maxw += pad_item->right; } else if (has_s) { maxh += pad_sub->top; maxh += pad_sub->bottom; maxw = maxx1 + maxx2; maxw += pad_sub->left; maxw += pad_sub->right; } mmw = 0; mmh = 0; nmaxy = 3 * WinGetH(VROOT) / (4 * maxh + 1); if (m->style->maxy && nmaxy > m->style->maxy) nmaxy = m->style->maxy; r = 0; x = 0; y = 0; for (i = 0; i < m->num; i++) { if (r == 0 && (m->style->bg_iclass) && (!m->style->use_item_bg)) { x += pad->left; y += pad->top; } EMoveResizeWindow(m->items[i]->win, x, y, maxw, maxh); if (m->style->iconpos == ICON_LEFT) { m->items[i]->text_x = pad_item->left + maxx2; m->items[i]->text_w = maxx1; m->items[i]->text_y = (maxh - m->items[i]->text_h) / 2; if (m->items[i]->icon_win) EMoveWindow(m->items[i]->icon_win, pad_item->left + ((maxx2 - m->items[i]->icon_w) / 2), ((maxh - m->items[i]->icon_h) / 2)); } else { m->items[i]->text_x = pad_item->left; m->items[i]->text_w = maxx1; m->items[i]->text_y = (maxh - m->items[i]->text_h) / 2; if (m->items[i]->icon_win) EMoveWindow(m->items[i]->icon_win, maxw - pad_item->right - maxx2 + ((maxx2 - m->items[i]->icon_w) / 2), ((maxh - m->items[i]->icon_h) / 2)); } if (m->items[i]->icon_iclass && Conf.menus.show_icons) { ImageclassApply(m->items[i]->icon_iclass, m->items[i]->icon_win, 0, 0, STATE_NORMAL, ST_MENU_ITEM); } if (x + maxw > mmw) mmw = x + maxw; if (y + maxh > mmh) mmh = y + maxh; if ((m->style->maxx) || (nmaxy)) { if (nmaxy) { y += maxh; r++; if (r >= nmaxy) { r = 0; x += maxw; y = 0; } } else { x += maxw; r++; if (r >= m->style->maxx) { r = 0; y += maxh; x = 0; } } } else y += maxh; } if ((m->style->bg_iclass) && (!m->style->use_item_bg)) { mmw += pad->right; mmh += pad->bottom; } m->redraw = 1; m->w = mmw; m->h = mmh; EResizeWindow(m->win, mmw, mmh); }
static void WarpFocusWinShow(WarpFocusWin * fw) { WarplistItem *wi; EImageBorder *pad; EWin *ewin; int i, x, y, w, h, ww, hh; char s[1024], ss[32]; const char *fmt; w = 0; h = 0; pad = ImageclassGetPadding(fw->ic); for (i = 0; i < warplist_num; i++) { wi = warplist + i; wi->win = ECreateWindow(EoGetWin(fw), 0, 0, 1, 1, 0); EMapWindow(wi->win); ewin = wi->ewin; if (ewin->state.iconified) fmt = "%s[%s]"; else if (ewin->state.shaded) fmt = "%s=%s="; else fmt = "%s%s"; ss[0] = '\0'; if (Conf.warplist.showalldesks) { if (EoIsSticky(ewin) || ewin->state.iconified) strcpy(ss, "[-] "); else Esnprintf(ss, sizeof(ss), "[%d] ", EoGetDeskNum(ewin)); } Esnprintf(s, sizeof(s), fmt, ss, EwinGetTitle(ewin)); wi->txt = strdup(s); TextSize(fw->tc, 0, 0, 0, wi->txt, &ww, &hh, 17); if (ww > w) w = ww; if (hh > h) h = hh; } fw->tw = w; /* Text size */ fw->th = h; w += pad->left + pad->right; h += pad->top + pad->bottom; if (Conf.warplist.icon_mode != 0) { if (Conf.warplist.icon_mode != EWIN_ICON_MODE_APP_IMG && Conf.warplist.icon_mode != EWIN_ICON_MODE_IMG_APP) Conf.warplist.icon_mode = EWIN_ICON_MODE_APP_IMG; w += h; } fw->mw = w; /* Focus list item size */ fw->mh = h; /* Reset shape */ EShapeSetMask(EoGetWin(fw), 0, 0, None); ScreenGetAvailableAreaByPointer(&x, &y, &ww, &hh, Conf.place.ignore_struts); x += (ww - w) / 2; y += (hh - h * warplist_num) / 2; EoMoveResize(fw, x, y, w, h * warplist_num); for (i = 0; i < warplist_num; i++) EMoveResizeWindow(warplist[i].win, 0, (h * i), fw->mw, fw->mh); EoMap(fw, 0); /* * Grab the keyboard. The grab is automatically released when * WarpFocusHide unmaps warpFocusWindow. */ GrabKeyboardSet(EoGetWin(fw)); GrabPointerSet(EoGetWin(fw), None, 0); TooltipsEnable(0); }
void StartupWindowsCreate(void) { Win w1, w2, win1, win2, b1, b2; Background *bg; ImageClass *ic; int x, y, bx, by, bw, bh, dbw; EObj *eo; /* Acting only as boolean? */ if (BackgroundFind("STARTUP_BACKGROUND_SIDEWAYS")) bg_sideways = 1; ic = ImageclassFind("STARTUP_BAR", 0); if (!ic) ic = ImageclassFind("DESKTOP_DRAGBUTTON_HORIZ", 0); bg = BackgroundFind("STARTUP_BACKGROUND"); if (!ic || !bg) return; dbw = Conf.desks.dragbar_width; if (dbw <= 0) dbw = 16; if (bg_sideways) { x = WinGetW(VROOT) / 2; y = 0; bx = WinGetW(VROOT) - dbw; by = 0; bw = dbw; bh = WinGetH(VROOT); } else { x = 0; y = WinGetH(VROOT) / 2; bx = 0; by = WinGetH(VROOT) - dbw; bw = WinGetW(VROOT); bh = dbw; } eo = EobjWindowCreate(EOBJ_TYPE_MISC, -x, -y, WinGetW(VROOT), WinGetH(VROOT), 1, "Init-1"); if (!eo) return; init_win1 = eo; w1 = EobjGetWin(eo); win1 = ECreateWindow(w1, x, y, WinGetW(VROOT), WinGetH(VROOT), 0); eo = EobjWindowCreate(EOBJ_TYPE_MISC, x, y, WinGetW(VROOT), WinGetH(VROOT), 1, "Init-2"); if (!eo) return; init_win2 = eo; w2 = EobjGetWin(eo); win2 = ECreateWindow(w2, -x, -y, WinGetW(VROOT), WinGetH(VROOT), 0); EMapWindow(win1); EMapWindow(win2); if (bw > 0 && bh > 0) { b1 = ECreateWindow(w1, bx, by, bw, bh, 0); b2 = ECreateWindow(w2, 0, 0, bw, bh, 0); EMapRaised(b1); EMapRaised(b2); ImageclassApply(ic, b1, 0, 0, 0, ST_SOLID); ImageclassApply(ic, b2, 0, 0, 0, ST_SOLID); } BackgroundSet(bg, win1, WinGetW(VROOT), WinGetH(VROOT)); BackgroundSet(bg, win2, WinGetW(VROOT), WinGetH(VROOT)); StartupBackgroundsDestroy(); EobjMap(init_win1, 0); EobjMap(init_win2, 0); EobjsRepaint(); }