Enlightenment CVS committal Author : kwo Project : e16 Module : e
Dir : e16/e/src Modified Files: E.h buttons.c coords.c desktops.c eobj.c ewins.c ipc.c progress.c setup.c stacking.c startup.c tooltips.c warp.c Log Message: Simplify handling of top-level windows - part 2. =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v retrieving revision 1.406 retrieving revision 1.407 diff -u -3 -r1.406 -r1.407 --- E.h 15 Apr 2005 23:59:56 -0000 1.406 +++ E.h 17 Apr 2005 13:58:04 -0000 1.407 @@ -522,6 +522,7 @@ #define EOBJ_TYPE_EXT 4 #define EoGetWin(eo) ((eo)->o.win) +#define EoGetName(eo) ((eo)->o.name) #define EoGetType(eo) ((eo)->o.type) #define EoGetX(eo) ((eo)->o.x) #define EoGetY(eo) ((eo)->o.y) @@ -534,7 +535,7 @@ #define EoGetLayer(eo) ((eo)->o.layer) #define EoGetPixmap(eo) EobjGetPixmap(&((eo)->o)) -#define EoSetWin(eo, _x) (eo)->o.win = (_x) +#define EoSetName(eo, _x) (eo)->o.name = (_x) #define EoSetX(eo, _x) (eo)->o.x = (_x) #define EoSetY(eo, _y) (eo)->o.y = (_y) #define EoSetW(eo, _w) (eo)->o.w = (_w) @@ -543,9 +544,6 @@ #define EoSetFloating(eo, _f) EobjSetFloating(&((eo)->o), (_f)) #define EoSetDesk(eo, _d) EobjSetDesk(&((eo)->o), (_d)) #define EoSetLayer(eo, _l) EobjSetLayer(&((eo)->o), (_l)) -#define EoMap(eo) EobjMap(&((eo)->o)) -#define EoUnmap(eo) EobjUnmap(&((eo)->o)) -#define EoMoveResize(eo, x, y, w, h) EobjMoveResize(&((eo)->o), x, y, w, h) #if USE_COMPOSITE #define EoSetOpacity(eo, _o) (eo)->o.opacity = (_o) #define EoGetOpacity(eo) ((eo)->o.opacity) @@ -559,6 +557,12 @@ #define EoGetShadow(eo) 0 #endif +#define EoMap(eo, raise) EobjMap(&((eo)->o), (raise)) +#define EoUnmap(eo) EobjUnmap(&((eo)->o)) +#define EoMove(eo, x, y) EobjMove(&((eo)->o), x, y) +#define EoResize(eo, w, h) EobjResize(&((eo)->o), w, h) +#define EoMoveResize(eo, x, y, w, h) EobjMoveResize(&((eo)->o), x, y, w, h) + typedef struct { EObj o; @@ -1308,7 +1312,6 @@ void ButtonIncRefcount(Button * b); void ButtonDecRefcount(Button * b); void ButtonSetSwallowed(Button * b); -const char *ButtonGetName(const Button * b); int ButtonGetRefcount(const Button * b); int ButtonGetDesk(const Button * b); int ButtonGetInfo(const Button * b, RectBox * r, int desk); @@ -1530,20 +1533,26 @@ void EdgeWindowsHide(void); /* eobj.c */ -void EobjInit(EObj * eo, int type, int x, int y, int w, int h); +void EobjInit(EObj * eo, int type, Window win, int x, int y, + int w, int h, const char *name); +void EobjFini(EObj * eo); +void EobjDestroy(EObj * eo); +EObj *EobjWindowCreate(int type, int x, int y, int w, int h, + int su, const char *name); +void EobjWindowDestroy(EObj * eo); EObj *EobjRegister(Window win, int type); void EobjUnregister(Window win); -void EobjMap(EObj * eo); +void EobjMap(EObj * eo, int raise); void EobjUnmap(EObj * eo); +void EobjMove(EObj * eo, int x, int y); +void EobjResize(EObj * eo, int w, int h); void EobjMoveResize(EObj * eo, int x, int y, int w, int h); #if USE_COMPOSITE Pixmap EobjGetPixmap(const EObj * eo); void EobjChangeOpacity(EObj * eo, unsigned int opacity); #endif -const char *EobjGetName(const EObj * eo); -int EobjGetDesk(const EObj * eo); int EobjSetDesk(EObj * eo, int desk); void EobjSetLayer(EObj * eo, int layer); void EobjSetFloating(EObj * eo, int floating); @@ -2057,8 +2066,6 @@ void ProgressbarSet(Progressbar * p, int progress); void ProgressbarShow(Progressbar * p); void ProgressbarHide(Progressbar * p); -Window *ProgressbarsListWindows(int *num); -void ProgressbarsRaise(void); /* regex.c */ int matchregexp(const char *rx, const char *s); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/buttons.c,v retrieving revision 1.57 retrieving revision 1.58 diff -u -3 -r1.57 -r1.58 --- buttons.c 12 Apr 2005 16:43:34 -0000 1.57 +++ buttons.c 17 Apr 2005 13:58:06 -0000 1.58 @@ -42,7 +42,6 @@ struct _button { EObj o; - char *name; BGeometry geom; ImageClass *iclass; ActionClass *aclass; @@ -77,6 +76,7 @@ int ysr, int ysa, char simg, int desk, char sticky) { Button *b; + Window win; if (desk < 0 || desk >= DesksGetNumber()) return NULL; @@ -85,7 +85,6 @@ b = Ecalloc(1, sizeof(Button)); - b->name = Estrdup(name); b->label = Estrdup(label); b->iclass = iclass; @@ -130,19 +129,18 @@ b->state = 0; b->ref_count = 0; - EoSetWin(b, ECreateWindow(DeskGetWin(desk), -100, -100, 50, 50, 0)); - ESelectInput(EoGetWin(b), BUTTON_EVENT_MASK); - EventCallbackRegister(EoGetWin(b), 0, ButtonHandleEvents, b); + win = ECreateWindow(DeskGetWin(desk), -100, -100, 50, 50, 0); + EobjInit(&b->o, EOBJ_TYPE_BUTTON, win, -100, -100, 50, 50, name); - EobjInit(&b->o, EOBJ_TYPE_BUTTON, -1, -1, -1, -1); EoSetSticky(b, sticky); EoSetDesk(b, desk); EoSetLayer(b, ontop); EoSetShadow(b, 0); - EobjListStackAdd(&b->o, 1); + ESelectInput(EoGetWin(b), BUTTON_EVENT_MASK); + EventCallbackRegister(EoGetWin(b), 0, ButtonHandleEvents, b); - AddItemEnd(b, b->name, id, LIST_TYPE_BUTTON); + AddItemEnd(b, EoGetName(b), id, LIST_TYPE_BUTTON); return b; } @@ -161,10 +159,7 @@ while (RemoveItemByPtr(b, LIST_TYPE_BUTTON)); - EobjListStackDel(&b->o); - - if (b->name) - Efree(b->name); + EobjFini(&b->o); if (EoGetWin(b)) EDestroyWindow(EoGetWin(b)); @@ -237,23 +232,16 @@ yo = (h * b->geom.yorigin) >> 10; x = ((b->geom.xrel * VRoot.w) >> 10) + b->geom.xabs - xo; y = ((b->geom.yrel * VRoot.h) >> 10) + b->geom.yabs - yo; - EoSetX(b, x); - EoSetY(b, y); - EoSetW(b, w); - EoSetH(b, h); + + EoMoveResize(b, x, y, w, h); } void ButtonShow(Button * b) { ButtonCalc(b); - EoMoveResize(b, EoGetX(b), EoGetY(b), EoGetW(b), EoGetH(b)); -#if 0 /* Why? */ - if (EoIsSticky(b)) - ERaiseWindow(EoGetWin(b)); -#endif ButtonDraw(b); - EoMap(b); + EoMap(b, 0); } void @@ -343,11 +331,6 @@ } ButtonCalc(b); - EoMoveResize(b, EoGetX(b), EoGetY(b), EoGetW(b), EoGetH(b)); -#if 0 /* Why? */ - if (EoIsSticky(b)) - ERaiseWindow(EoGetWin(b)); -#endif } void @@ -379,10 +362,10 @@ EobjListStackDel(&b->o); } -const char * +static const char * ButtonGetName(const Button * b) { - return b->name; + return EoGetName(b); } int @@ -972,7 +955,7 @@ continue; fprintf(fs, "4 999\n"); - fprintf(fs, "100 %s\n", blst[i]->name); + fprintf(fs, "100 %s\n", EoGetName(blst[i])); if (blst[i]->iclass) fprintf(fs, "12 %s\n", blst[i]->iclass->name); if (blst[i]->aclass) =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/coords.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -3 -r1.25 -r1.26 --- coords.c 12 Apr 2005 16:43:34 -0000 1.25 +++ coords.c 17 Apr 2005 13:58:06 -0000 1.26 @@ -29,11 +29,10 @@ { TextClass *tc; ImageClass *ic; - char s[256], pq; + char s[256]; int md; int x, y, w, h; int cx, cy, cw, ch; - Window win; EObj *eo = coord_eo; if (!Conf.movres.mode_info) @@ -83,26 +82,19 @@ if (!eo) { - win = ECreateWindow(VRoot.win, 0, 0, 1, 1, 2); - eo = EobjRegister(win, EOBJ_TYPE_MISC); + eo = EobjWindowCreate(EOBJ_TYPE_MISC, 0, 0, 1, 1, 2, "Coord"); if (!eo) return; - EobjSetLayer(eo, 10); - EobjSetFloating(eo, 1); - EobjListStackRaise(eo); coord_eo = eo; } EobjMoveResize(eo, cx, cy, cw, ch); if (!eo->shown) - EobjMap(eo); + EobjMap(eo, 1); - pq = Mode.queue_up; - Mode.queue_up = 0; ImageclassApply(ic, eo->win, cw, ch, 1, 0, STATE_NORMAL, 0, ST_UNKNWN); TextclassApply(ic, eo->win, cw, ch, 0, 0, STATE_NORMAL, 0, tc, s); - Mode.queue_up = pq; XFlush(disp); } =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v retrieving revision 1.136 retrieving revision 1.137 diff -u -3 -r1.136 -r1.137 --- desktops.c 15 Apr 2005 21:07:44 -0000 1.136 +++ desktops.c 17 Apr 2005 13:58:06 -0000 1.137 @@ -397,6 +397,7 @@ { Desk *d; Window win; + char buf[64]; if (desk < 0 || desk >= ENLIGHTENMENT_CONF_NUM_DESKTOPS) return NULL; @@ -412,14 +413,14 @@ else win = ECreateWindow(VRoot.win, -VRoot.w, -VRoot.h, VRoot.w, VRoot.h, 0); - EobjInit(&d->o, EOBJ_TYPE_DESK, 0, 0, VRoot.w, VRoot.h); - EoSetWin(d, win); - EoSetLayer(d, 0); + Esnprintf(buf, sizeof(buf), "Desk-%d", desk); + EobjInit(&d->o, EOBJ_TYPE_DESK, win, 0, 0, VRoot.w, VRoot.h, buf); EoSetShadow(d, 0); + EoSetLayer(d, 0); if (desk > 0) { EoSetFloating(d, 1); - EobjListStackAdd(&d->o, 0); + EobjListStackRaise(&d->o); #if 0 /* TBD */ d->event_mask = EDESK_EVENT_MASK; DeskEventsConfigure(d, 1); @@ -472,10 +473,10 @@ if (d->bg) BackgroundDecRefcount(d->bg); - EobjListStackDel(&d->o); - EDestroyWindow(EoGetWin(d)); + EobjFini(&d->o); + desks.desk[d->num] = NULL; Efree(d); } @@ -484,14 +485,14 @@ DeskResize(int desk, int w, int h) { Desk *d; + int x; d = _DeskGet(desk); if (desk > 0) { - EResizeWindow(EoGetWin(d), w, h); - if (!d->viewable) - EMoveWindow(EoGetWin(d), VRoot.w, 0); + x = (d->viewable) ? EoGetX(d) : VRoot.w; + EoMoveResize(d, x, 0, w, h); } BackgroundPixmapFree(d->bg); DeskRefresh(desk); @@ -1133,7 +1134,7 @@ } } - EMoveWindow(EoGetWin(d), x, y); + EoMove(d, x, y); if (d->tag) ButtonMoveRelative(d->tag, dx, dy); @@ -1160,7 +1161,7 @@ d->viewable = 1; DeskRefresh(desk); if (desk != 0) - EMapWindow(EoGetWin(d)); + EoMap(d, 0); } static void @@ -1191,7 +1192,7 @@ } else { - EMapWindow(EoGetWin(d)); + EoMap(d, 0); } StackDesktops(); @@ -1252,7 +1253,7 @@ if (d->viewable) BackgroundTouch(d->bg); d->viewable = 0; - EMoveWindow(EoGetWin(d), VRoot.w, 0); + EoMove(d, VRoot.w, 0); } void @@ -1278,7 +1279,7 @@ else { StackDesktops(); - EMapWindow(EoGetWin(d)); + EoMap(d, 0); } } @@ -1297,41 +1298,15 @@ StackDesktop(int desk) { Window *wl; - -#if 1 /* FIXME - Somehow */ - Window *wl2; -#endif int i, num, tot; EObj *const *lst, *eo; + /* Build the window stack, top to bottom */ + tot = 0; wl = NULL; - - /* - * Build the window stack, top to bottom - */ - -#if 1 /* FIXME - Somehow */ - if (desk == 0) - { - wl2 = ProgressbarsListWindows(&num); - if (wl2) - { - for (i = 0; i < num; i++) - _APPEND_TO_WIN_LIST(wl2[i]); - Efree(wl2); - } - if (init_win_ext) - { - _APPEND_TO_WIN_LIST(init_win_ext); - } - } -#endif - lst = EobjListStackGetForDesk(&num, desk); - /* Make the X window list */ - /* Floating objects */ for (i = 0; i < num; i++) { @@ -1361,9 +1336,6 @@ XRestackWindows(disp, wl, tot); EdgeWindowsShow(); -#if 0 /* FIXME Is this necessary? */ - ProgressbarsRaise(); -#endif HintsSetClientStacking(); if (wl) =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/eobj.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -3 -r1.16 -r1.17 --- eobj.c 12 Apr 2005 16:43:35 -0000 1.16 +++ eobj.c 17 Apr 2005 13:58:06 -0000 1.17 @@ -23,29 +23,6 @@ #include "E.h" #include "ecompmgr.h" -const char * -EobjGetName(const EObj * eo) -{ - switch (eo->type) - { - default: - return "?"; - case EOBJ_TYPE_EWIN: - return EwinGetName((EWin *) eo); - case EOBJ_TYPE_BUTTON: - return ButtonGetName((Button *) eo); - case EOBJ_TYPE_MISC: - case EOBJ_TYPE_EXT: - return eo->name; - } -} - -int -EobjGetDesk(const EObj * eo) -{ - return (eo->sticky) ? DesksGetCurrent() : eo->desk; -} - int EobjSetDesk(EObj * eo, int desk) { @@ -158,17 +135,39 @@ } void -EobjInit(EObj * eo, int type, int x, int y, int w, int h) +EobjInit(EObj * eo, int type, Window win, int x, int y, int w, int h, + const char *name) { eo->type = type; + eo->win = win; eo->x = x; eo->y = y; eo->w = w; eo->h = h; + if (name) + eo->name = Estrdup(name); #if USE_COMPOSITE - eo->opacity = 0xFFFFFFFF; + if (eo->opacity == 0) + eo->opacity = 0xFFFFFFFF; eo->shadow = 1; #endif + if (eo->win != VRoot.win) + EobjListStackAdd(eo, 1); + + if (EventDebug(EDBUG_TYPE_EWINS)) + Eprintf("EobjInit: %#lx %s\n", eo->win, eo->name); +} + +void +EobjFini(EObj * eo) +{ + if (EventDebug(EDBUG_TYPE_EWINS)) + Eprintf("EobjFini: %#lx %s\n", eo->win, eo->name); + + EobjListStackDel(eo); + + if (eo->name) + Efree(eo->name); } static EObj * @@ -179,28 +178,57 @@ if (!XGetWindowAttributes(disp, win, &attr)) return NULL; -#if 0 - if (!attr.override_redirect) - return NULL; -#endif eo = Ecalloc(1, sizeof(EObj)); + if (!eo) + return eo; - eo->win = win; - - EobjInit(eo, type, attr.x, attr.y, attr.width, attr.height); + EobjInit(eo, type, win, attr.x, attr.y, attr.width, attr.height, NULL); + eo->name = ecore_x_icccm_title_get(win); return eo; } -static void +void EobjDestroy(EObj * eo) { - _EFREE(eo->name); + if (EventDebug(EDBUG_TYPE_EWINS)) + Eprintf("EobjDestroy: %#lx %s\n", eo->win, eo->name); + + EobjFini(eo); + Efree(eo); } EObj * +EobjWindowCreate(int type, int x, int y, int w, int h, int su, const char *name) +{ + EObj *eo; + + eo = Ecalloc(1, sizeof(EObj)); + + eo->win = ECreateWindow(VRoot.win, x, y, w, h, su); + if (eo->win == None) + { + Efree(eo); + return NULL; + } + + eo->floating = 1; + EobjSetLayer(eo, 20); + EobjInit(eo, type, eo->win, x, y, w, h, name); + + return eo; +} + +void +EobjWindowDestroy(EObj * eo) +{ + EDestroyWindow(eo->win); + EobjDestroy(eo); +} + +EObj * EobjRegister(Window win, int type) { EObj *eo; @@ -213,17 +241,14 @@ if (!eo) return eo; -#if 1 /* Just for debug */ - eo->name = ecore_x_icccm_title_get(win); -#endif - - if (EventDebug(EDBUG_TYPE_EWINS)) - Eprintf("EobjRegister: %#lx %s\n", win, eo->name); - +#if 1 /* FIXME - TBD */ if (type == EOBJ_TYPE_EXT) - EobjSetFloating(eo, 1); - EobjSetLayer(eo, 4); - EobjListStackAdd(eo, 1); + { + EobjSetFloating(eo, 1); + EobjSetLayer(eo, 4); + EobjListStackRaise(eo); + } +#endif return eo; } @@ -236,26 +261,20 @@ eo = EobjListStackFind(win); if (!eo) return; -#if 0 - if (eo->type != EOBJ_TYPE_EXT) - return; -#endif - - if (EventDebug(EDBUG_TYPE_EWINS)) - Eprintf("EobjUnregister: %#lx %s\n", win, eo->name); - - EobjListStackDel(eo); EobjDestroy(eo); } void -EobjMap(EObj * eo) +EobjMap(EObj * eo, int raise) { if (eo->shown) return; eo->shown = 1; + if (raise) + EobjListStackRaise(eo); + EMapWindow(eo->win); } @@ -290,6 +309,18 @@ } } +void +EobjMove(EObj * eo, int x, int y) +{ + EobjMoveResize(eo, x, y, eo->w, eo->h); +} + +void +EobjResize(EObj * eo, int w, int h) +{ + EobjMoveResize(eo, eo->x, eo->y, w, h); +} + #if USE_COMPOSITE Pixmap EobjGetPixmap(const EObj * eo) =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/ewins.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -3 -r1.39 -r1.40 --- ewins.c 15 Apr 2005 21:07:44 -0000 1.39 +++ ewins.c 17 Apr 2005 13:58:06 -0000 1.40 @@ -65,6 +65,7 @@ { EWin *ewin; XSetWindowAttributes att; + Window frame; ewin = Ecalloc(1, sizeof(EWin)); @@ -97,11 +98,6 @@ ewin->client.mwm_func_minimize = 1; ewin->client.mwm_func_maximize = 1; ewin->client.mwm_func_close = 1; - - ewin->ewmh.opacity = 0; /* If 0, ignore */ - - EoSetWin(ewin, ECreateWindow(VRoot.win, -10, -10, 1, 1, 1)); - ewin->win_container = ECreateWindow(EoGetWin(ewin), 0, 0, 1, 1, 0); #if 0 /* ENABLE_GNOME - Not actually used */ ewin->expanded_width = -1; ewin->expanded_height = -1; @@ -109,10 +105,16 @@ ewin->area_x = -1; ewin->area_y = -1; - EobjInit(&ewin->o, EOBJ_TYPE_EWIN, -1, -1, -1, -1); + ewin->ewmh.opacity = 0; /* If 0, ignore */ + + frame = ECreateWindow(VRoot.win, -10, -10, 1, 1, 1); + EobjInit(&ewin->o, EOBJ_TYPE_EWIN, frame, -10, -10, -1, -1, NULL); EoSetDesk(ewin, DesksGetCurrent()); EoSetLayer(ewin, 4); + EoSetShadow(ewin, 1); + EobjListFocusAdd(&ewin->o, 0); + ewin->win_container = ECreateWindow(EoGetWin(ewin), 0, 0, 1, 1, 0); att.event_mask = EWIN_CONTAINER_EVENT_MASK; att.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask; EChangeWindowAttributes(ewin->win_container, @@ -122,12 +124,10 @@ att.event_mask = EWIN_TOP_EVENT_MASK; att.do_not_propagate_mask = ButtonPressMask | ButtonReleaseMask; EChangeWindowAttributes(EoGetWin(ewin), CWEventMask | CWDontPropagate, &att); + ewin->client.win = win; FocusEwinSetGrabs(ewin); - EobjListStackAdd(&ewin->o, 0); - EobjListFocusAdd(&ewin->o, 0); - ewin->client.event_mask = EWIN_CLIENT_EVENT_MASK; AddItem(ewin, "EWIN", win, LIST_TYPE_EWIN); @@ -158,6 +158,8 @@ EwinCleanup(EWin * ewin) { EwinBorderDetach(ewin); + EobjListFocusDel(&ewin->o); + EobjFini(&ewin->o); } static void @@ -184,9 +186,6 @@ if (!EwinIsInternal(ewin)) EUnregisterWindow(ewin->client.win); - EobjListStackDel(&ewin->o); - EobjListFocusDel(&ewin->o); - HintsSetClientList(); SnapshotEwinUnmatch(ewin); @@ -530,9 +529,11 @@ if (Mode.wm.startup) EHintsGetInfo(ewin); /* E restart hints */ + EoSetName(ewin, Estrdup(ewin->icccm.wm_name)); /* FIXME */ if (ewin->ewmh.opacity == 0) ewin->ewmh.opacity = 0xffffffff; - EoSetOpacity(ewin, ewin->ewmh.opacity); + EoChangeOpacity(ewin, ewin->ewmh.opacity); + if (!ewin->no_button_grabs) GrabButtonGrabs(ewin); @@ -584,9 +585,11 @@ WindowMatchEwinOps(ewin); /* Window matches */ SnapshotEwinMatch(ewin); /* Saved settings */ + EoSetName(ewin, Estrdup(ewin->icccm.wm_name)); /* FIXME */ if (ewin->ewmh.opacity == 0) ewin->ewmh.opacity = 0xffffffff; - EoSetOpacity(ewin, ewin->ewmh.opacity); + EoChangeOpacity(ewin, ewin->ewmh.opacity); + GrabButtonGrabs(ewin); ICCCM_MatchSize(ewin); @@ -1544,7 +1547,7 @@ EMapWindow(ewin->client.win); } - EoMap(ewin); + EoMap(ewin, 0); } void =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/ipc.c,v retrieving revision 1.213 retrieving revision 1.214 diff -u -3 -r1.213 -r1.214 --- ipc.c 12 Apr 2005 16:43:36 -0000 1.213 +++ ipc.c 17 Apr 2005 13:58:06 -0000 1.214 @@ -1194,19 +1194,19 @@ lst = EobjListStackGet(&num); - IpcPrintf("Num window T L D pos size S F C Name\n"); + IpcPrintf("Num window T V D L pos size S F C Name\n"); for (i = 0; i < num; i++) { eo = lst[i]; - IpcPrintf(" %2d %#lx %d %3d %2d %5d,%5d %4dx%4d %d %d %d %s\n", i, - eo->win, eo->type, eo->ilayer, eo->desk, + IpcPrintf(" %2d %#lx %d %d %2d %3d %5d,%5d %4dx%4d %d %d %d %s\n", i, + eo->win, eo->type, eo->shown, eo->desk, eo->ilayer, eo->x, eo->y, eo->w, eo->h, eo->sticky, eo->floating, #if USE_COMPOSITE (eo->cmhook) ? 1 : 0, #else 0, #endif - EobjGetName(eo)); + eo->name); } } =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/progress.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -3 -r1.20 -r1.21 --- progress.c 19 Mar 2005 16:40:07 -0000 1.20 +++ progress.c 17 Apr 2005 13:58:08 -0000 1.21 @@ -24,15 +24,11 @@ struct _progressbar { - char *name; + EObj *win; + EObj *n_win; + EObj *p_win; + int w, h; int value; - int x; - int y; - int w; - int h; - Window win; - Window n_win; - Window p_win; ImageClass *ic, *inc, *ipc; TextClass *tc, *tnc; }; @@ -41,25 +37,32 @@ static Progressbar **plist = NULL; Progressbar * -ProgressbarCreate(char *name, int width, int height) +ProgressbarCreate(char *name, int w, int h) { Progressbar *p; + int x, y; - p = Emalloc(sizeof(Progressbar)); + p = Ecalloc(1, sizeof(Progressbar)); pnum++; plist = Erealloc(plist, pnum * sizeof(Progressbar *)); plist[pnum - 1] = p; - p->name = Estrdup(name); - p->x = (VRoot.w - width) / 2; - p->y = 32 + (pnum * height * 2); - p->w = width; - p->h = height; - p->win = ECreateWindow(VRoot.win, p->x, p->y, p->w - (p->h * 5), p->h, 1); + + p->w = w; + p->h = h; + p->value = 0; + + x = (VRoot.w - w) / 2; + y = 32 + (pnum * h * 2); + + p->win = EobjWindowCreate(EOBJ_TYPE_MISC, x, y, w - (h * 5), h, 1, name); p->n_win = - ECreateWindow(VRoot.win, p->x + p->w - (p->h * 5), p->y, (p->h * 5), - p->h, 1); - p->p_win = ECreateWindow(VRoot.win, p->x, p->y + p->h, 1, p->h, 1); - /* FIXME: need to use other image and textclasses */ + EobjWindowCreate(EOBJ_TYPE_MISC, x + w - (h * 5), y, (h * 5), h, 1, "pn"); + p->p_win = EobjWindowCreate(EOBJ_TYPE_MISC, x, y + h, 1, h, 1, "pp"); + if (!p->win || !p->n_win || !p->p_win) + { + ProgressbarDestroy(p); + return NULL; + } p->ic = ImageclassFind("PROGRESS_BAR", 1); if (p->ic) @@ -81,41 +84,36 @@ if (p->tnc) p->tnc->ref_count++; - p->value = 0; - return p; } void ProgressbarDestroy(Progressbar * p) { - int i, j; + int i, j, dy; - if (p->name) - Efree(p->name); - if (p->win) - EDestroyWindow(p->win); - if (p->win) - EDestroyWindow(p->n_win); - if (p->win) - EDestroyWindow(p->p_win); + dy = 2 * p->h; + EobjWindowDestroy(p->win); + EobjWindowDestroy(p->n_win); + EobjWindowDestroy(p->p_win); for (i = 0; i < pnum; i++) { - if (plist[i] == p) + if (plist[i] != p) + continue; + + for (j = i; j < pnum - 1; j++) { - for (j = i; j < (pnum - 1); j++) - { - plist[j] = plist[j + 1]; - plist[j]->y -= p->h; - EMoveWindow(p->win, plist[j]->x, plist[j]->y); - EMoveWindow(p->n_win, - plist[j]->x + plist[j]->w - (plist[j]->h * 5), - plist[j]->y); - EMoveWindow(p->p_win, plist[j]->x, plist[j]->y + plist[j]->h); - } - i = pnum; + Progressbar *pp; + + pp = plist[j + 1]; + plist[j] = pp; + EobjMove(pp->win, pp->win->x, pp->win->y - dy); + EobjMove(pp->n_win, pp->n_win->x, pp->n_win->y - dy); + EobjMove(pp->p_win, pp->p_win->x, pp->p_win->y - dy); } + break; + } if (p->ic) @@ -137,9 +135,7 @@ if (pnum <= 0) { pnum = 0; - if (plist) - Efree(plist); - plist = NULL; + _EFREE(plist); } else { @@ -151,7 +147,7 @@ ProgressbarSet(Progressbar * p, int progress) { int w; - char s[64], pq; + char s[64]; if (progress == p->value) return; @@ -163,13 +159,14 @@ if (w > p->w) w = p->w; Esnprintf(s, sizeof(s), "%i%%", p->value); - pq = Mode.queue_up; - Mode.queue_up = 0; - TextclassApply(p->inc, p->n_win, p->h * 5, p->h, 0, 0, STATE_CLICKED, 0, + + TextclassApply(p->inc, p->n_win->win, p->h * 5, p->h, 0, 0, STATE_CLICKED, 0, p->tnc, s); - ImageclassApply(p->inc, p->p_win, w, p->h, 1, 0, STATE_NORMAL, 0, ST_UNKNWN); - EResizeWindow(p->p_win, w, p->h); - Mode.queue_up = pq; + ImageclassApply(p->inc, p->p_win->win, w, p->h, 1, 0, STATE_NORMAL, 0, + ST_UNKNWN); + + EobjResize(p->p_win, w, p->h); + XFlush(disp); } @@ -177,71 +174,32 @@ ProgressbarShow(Progressbar * p) { int w; - char pq; w = (p->value * p->w) / 100; if (w < 1) w = 1; if (w > p->w) w = p->w; - pq = Mode.queue_up; - Mode.queue_up = 0; - ImageclassApply(p->ic, p->win, p->w - (p->h * 5), p->h, 0, 0, STATE_NORMAL, + + ImageclassApply(p->ic, p->win->win, p->w - (p->h * 5), p->h, 0, 0, + STATE_NORMAL, 0, ST_UNKNWN); + ImageclassApply(p->inc, p->n_win->win, (p->h * 5), p->h, 0, 0, STATE_CLICKED, 0, ST_UNKNWN); - ImageclassApply(p->inc, p->n_win, (p->h * 5), p->h, 0, 0, STATE_CLICKED, 0, + ImageclassApply(p->ipc, p->p_win->win, w, p->h, 1, 0, STATE_NORMAL, 0, ST_UNKNWN); - ImageclassApply(p->ipc, p->p_win, w, p->h, 1, 0, STATE_NORMAL, 0, ST_UNKNWN); - EMapRaised(p->win); - EMapRaised(p->n_win); - EMapRaised(p->p_win); + + EobjMap(p->win, 1); + EobjMap(p->n_win, 1); + EobjMap(p->p_win, 1); ecore_x_sync(); - TextclassApply(p->ic, p->win, p->w - (p->h * 5), p->h, 0, 0, STATE_NORMAL, 0, - p->tc, p->name); - Mode.queue_up = pq; + TextclassApply(p->ic, p->win->win, p->w - (p->h * 5), p->h, 0, 0, + STATE_NORMAL, 0, p->tc, p->win->name); } void ProgressbarHide(Progressbar * p) { - EUnmapWindow(p->win); - EUnmapWindow(p->n_win); - EUnmapWindow(p->p_win); -} - -Window * -ProgressbarsListWindows(int *num) -{ - int i, j; - Window *wl; - - *num = pnum * 3; - if (pnum > 0) - { - j = 0; - wl = Emalloc(sizeof(Window) * pnum * 3); - for (i = 0; i < pnum; i++) - { - wl[j++] = plist[i]->win; - wl[j++] = plist[i]->n_win; - wl[j++] = plist[i]->p_win; - } - return wl; - } - - return NULL; -} - -void -ProgressbarsRaise(void) -{ - int i; - - for (i = 0; i < pnum; i++) - { - ERaiseWindow(plist[i]->win); - ERaiseWindow(plist[i]->n_win); - ERaiseWindow(plist[i]->p_win); - } - - return; + EobjUnmap(p->win); + EobjUnmap(p->n_win); + EobjUnmap(p->p_win); } =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/setup.c,v retrieving revision 1.157 retrieving revision 1.158 diff -u -3 -r1.157 -r1.158 --- setup.c 7 Apr 2005 16:38:57 -0000 1.157 +++ setup.c 17 Apr 2005 13:58:08 -0000 1.158 @@ -34,77 +34,69 @@ */ static Window *wlist = NULL; + static unsigned int num = 0; Window par; Window rt; XWindowAttributes attr; - static unsigned int num = 0; - int i; + unsigned int i; switch (start) { case 0: ecore_x_grab(); XQueryTree(disp, VRoot.win, &rt, &par, &wlist, &num); - if (wlist) + for (i = 0; i < num; i++) { - for (i = 0; i < (int)num; i++) - { #ifdef USE_EXT_INIT_WIN - if ((init_win_ext) && (init_win_ext == wlist[i])) - { - wlist[i] = 0; - } - else -#endif - { - XGetWindowAttributes(disp, wlist[i], &attr); - if (attr.map_state == IsUnmapped) - { - wlist[i] = 0; - } - else - { - XUnmapWindow(disp, wlist[i]); - } - } + if ((init_win_ext) && (init_win_ext == wlist[i])) + { + wlist[i] = 0; + continue; } +#endif + XGetWindowAttributes(disp, wlist[i], &attr); + if (attr.map_state == IsUnmapped) + wlist[i] = 0; + else + XUnmapWindow(disp, wlist[i]); } /* Flush (get rid of unmap events) */ XSync(disp, True); ecore_x_ungrab(); break; + case 1: - if (wlist) + if (!wlist) + break; + + for (i = 0; i < num; i++) { - for (i = 0; i < (int)num; i++) + if (!wlist[i]) + continue; + + if (!XGetWindowAttributes(disp, wlist[i], &attr)) + continue; + + if (attr.override_redirect) { - if (wlist[i]) - { - if (XGetWindowAttributes(disp, wlist[i], &attr)) - { - if (attr.override_redirect) - { #ifdef USE_EXT_INIT_WIN - if (init_win_ext) - XRaiseWindow(disp, init_win_ext); + if (init_win_ext) + XRaiseWindow(disp, init_win_ext); #endif - ProgressbarsRaise(); - XMapWindow(disp, wlist[i]); - } - else - { - if (Mode.wm.exiting) - XMapWindow(disp, wlist[i]); - else - AddToFamily(NULL, wlist[i]); - } - } - } + XMapWindow(disp, wlist[i]); + } + else + { + if (Mode.wm.exiting) + XMapWindow(disp, wlist[i]); + else + AddToFamily(NULL, wlist[i]); } - XFree(wlist); - wlist = NULL; } + XFree(wlist); + wlist = NULL; break; + default: break; } =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/stacking.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -3 -r1.19 -r1.20 --- stacking.c 19 Mar 2005 16:40:17 -0000 1.19 +++ stacking.c 17 Apr 2005 13:58:08 -0000 1.20 @@ -56,7 +56,7 @@ { eo = ewl->list[i]; Eprintf(" %2d: %#10lx %#10lx %d %d %s\n", i, eo->win, - EobjGetCwin(eo), eo->desk, eo->ilayer, EobjGetName(eo)); + EobjGetCwin(eo), eo->desk, eo->ilayer, eo->name); } } #else =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/startup.c,v retrieving revision 1.52 retrieving revision 1.53 diff -u -3 -r1.52 -r1.53 --- startup.c 12 Apr 2005 16:43:39 -0000 1.52 +++ startup.c 17 Apr 2005 13:58:08 -0000 1.53 @@ -24,8 +24,8 @@ #include "E.h" #include <time.h> -static Window init_win1 = None; -static Window init_win2 = None; +static EObj *init_win1 = NULL; +static EObj *init_win2 = NULL; static char bg_sideways = 0; void @@ -34,8 +34,8 @@ Window w1, w2, win1, win2, b1, b2; Background *bg; ImageClass *ic; + int x, y, bx, by, bw, bh; EObj *eo; - char pq; if (!Conf.startup.animate) return; @@ -56,51 +56,54 @@ if (bg_sideways) { - w1 = ECreateWindow(VRoot.win, (VRoot.w / 2), 0, VRoot.w, VRoot.h, 1); - w2 = ECreateWindow(VRoot.win, -(VRoot.w / 2), 0, VRoot.w, VRoot.h, 1); - win1 = ECreateWindow(w1, -(VRoot.w / 2), 0, VRoot.w, VRoot.h, 0); - win2 = ECreateWindow(w2, (VRoot.w / 2), 0, VRoot.w, VRoot.h, 0); + x = VRoot.w / 2; + y = 0; + bx = VRoot.w - Conf.desks.dragbar_width; + by = 0; + bw = Conf.desks.dragbar_width; + bh = VRoot.h; } else { - w1 = ECreateWindow(VRoot.win, 0, -(VRoot.h / 2), VRoot.w, VRoot.h, 1); - w2 = ECreateWindow(VRoot.win, 0, (VRoot.h / 2), VRoot.w, VRoot.h, 1); - win1 = ECreateWindow(w1, 0, (VRoot.h / 2), VRoot.w, VRoot.h, 0); - win2 = ECreateWindow(w2, 0, -(VRoot.h / 2), VRoot.w, VRoot.h, 0); + x = 0; + y = VRoot.h / 2; + bx = 0; + by = VRoot.h - Conf.desks.dragbar_width; + bw = VRoot.w; + bh = Conf.desks.dragbar_width; } + eo = EobjWindowCreate(EOBJ_TYPE_MISC, -x, -y, VRoot.w, VRoot.h, 1, "Init-1"); + if (!eo) + return; + init_win1 = eo; + w1 = eo->win; + win1 = ECreateWindow(w1, x, y, VRoot.w, VRoot.h, 0); + + eo = EobjWindowCreate(EOBJ_TYPE_MISC, x, y, VRoot.w, VRoot.h, 1, "Init-2"); + if (!eo) + return; + init_win2 = eo; + w2 = eo->win; + win2 = ECreateWindow(w2, -x, -y, VRoot.w, VRoot.h, 0); + EMapWindow(win1); EMapWindow(win2); - b1 = ECreateWindow(w1, 0, VRoot.h - Conf.desks.dragbar_width, VRoot.w, - Conf.desks.dragbar_width, 0); - b2 = ECreateWindow(w2, 0, 0, VRoot.w, Conf.desks.dragbar_width, 0); + b1 = ECreateWindow(w1, bx, by, bw, bh, 0); + b2 = ECreateWindow(w2, 0, 0, bw, bh, 0); EMapRaised(b1); EMapRaised(b2); - pq = Mode.queue_up; - Mode.queue_up = 0; - ImageclassApply(ic, b1, VRoot.w, Conf.desks.dragbar_width, 0, 0, 0, 0, - ST_UNKNWN); - ImageclassApply(ic, b2, VRoot.w, Conf.desks.dragbar_width, 0, 0, 0, 0, - ST_UNKNWN); - Mode.queue_up = pq; + ImageclassApply(ic, b1, bw, bh, 0, 0, 0, 0, ST_UNKNWN); + ImageclassApply(ic, b2, bw, bh, 0, 0, 0, 0, ST_UNKNWN); BackgroundApply(bg, win1, 1); BackgroundApply(bg, win2, 1); BackgroundImagesFree(bg, 1); - init_win1 = w1; - init_win2 = w2; - EMapRaised(w1); - EMapRaised(w2); - - eo = EobjRegister(w1, EOBJ_TYPE_MISC); - EobjSetFloating(eo, 1); - EobjListStackRaise(eo); - eo = EobjRegister(w2, EOBJ_TYPE_MISC); - EobjSetFloating(eo, 1); - EobjListStackRaise(eo); + EobjMap(init_win1, 0); + EobjMap(init_win2, 0); } void @@ -133,19 +136,17 @@ y = ty; } - EMoveWindow(init_win1, x + xOffset, -y - yOffset); - EMoveWindow(init_win2, -x - xOffset, y + yOffset); + EobjMove(init_win1, -x - xOffset, -y - yOffset); + EobjMove(init_win2, x + xOffset, y + yOffset); ecore_x_sync(); k = ETimedLoopNext(); } - EobjUnregister(init_win1); - EobjUnregister(init_win2); - EDestroyWindow(init_win1); - EDestroyWindow(init_win2); - init_win1 = None; - init_win2 = None; + EobjWindowDestroy(init_win1); + EobjWindowDestroy(init_win2); + init_win1 = NULL; + init_win2 = NULL; BackgroundDestroyByName("STARTUP_BACKGROUND_SIDEWAYS"); BackgroundDestroyByName("STARTUP_BACKGROUND"); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/tooltips.c,v retrieving revision 1.73 retrieving revision 1.74 diff -u -3 -r1.73 -r1.74 --- tooltips.c 12 Apr 2005 16:43:39 -0000 1.73 +++ tooltips.c 17 Apr 2005 13:58:09 -0000 1.74 @@ -39,83 +39,67 @@ struct _tooltip { - char *name; - - ImageClass *iclass; - ImageClass *s_iclass[4]; + ImageClass *iclass[5]; TextClass *tclass; int dist; - Window win; Window iwin; - Window s_win[4]; + EObj *win[5]; char visible; ImageClass *tooltippic; unsigned int ref_count; }; +#define TTWIN win[4] +#define TTICL iclass[4] + static ToolTip * TooltipCreate(const char *name, ImageClass * ic0, ImageClass * ic1, ImageClass * ic2, ImageClass * ic3, ImageClass * ic4, TextClass * tclass, int dist, ImageClass * tooltippic) { - int i; + int i, wh; ToolTip *tt; - -#if USE_COMPOSITE EObj *eo; -#endif - if (ic0 == NULL || ic1 == NULL || ic2 == NULL || ic3 == NULL || ic4 == NULL - || tclass == NULL) + if (ic0 == NULL || tclass == NULL) return NULL; - tt = Emalloc(sizeof(ToolTip)); - tt->name = Estrdup(name); - tt->iclass = ic0; - if (ic0) - ic0->ref_count++; - tt->s_iclass[0] = ic1; - tt->s_iclass[1] = ic2; - tt->s_iclass[2] = ic3; - tt->s_iclass[3] = ic4; + tt = Ecalloc(1, sizeof(ToolTip)); + + tt->iclass[0] = ic1; + tt->iclass[1] = ic2; + tt->iclass[2] = ic3; + tt->iclass[3] = ic4; + tt->iclass[4] = ic0; + ic0->ref_count++; tt->tclass = tclass; - if (tclass) - tclass->ref_count++; + tclass->ref_count++; tt->tooltippic = tooltippic; if (tooltippic) tooltippic->ref_count++; tt->dist = dist; - tt->win = ECreateWindow(VRoot.win, -10, -100, 1, 1, 1); - tt->iwin = ECreateWindow(tt->win, -10, -100, 1, 1, 1); -#if USE_COMPOSITE - eo = EobjRegister(tt->win, EOBJ_TYPE_MISC); - eo->opacity = OpacityExt(Conf_tooltips.opacity); -#endif - for (i = 0; i < 4; i++) + for (i = 0; i < 5; i++) { - Window win; + if (!tt->iclass[i]) + continue; - win = 0; - if (tt->s_iclass[i]) - { - int wh = (i + 1) * 8; + wh = (i + 1) * 8; - win = ECreateWindow(VRoot.win, -10, -100, wh, wh, 1); - tt->s_iclass[i]->ref_count++; + eo = EobjWindowCreate(EOBJ_TYPE_MISC, -50, -100, wh, wh, 1, NULL); + tt->iclass[i]->ref_count++; #if USE_COMPOSITE - eo = EobjRegister(win, EOBJ_TYPE_MISC); - eo->opacity = OpacityExt(Conf_tooltips.opacity); + eo->opacity = OpacityExt(Conf_tooltips.opacity); #endif - } - tt->s_win[i] = win; + tt->win[i] = eo; } + tt->iwin = ECreateWindow(tt->TTWIN->win, 0, 0, 1, 1, 0); + tt->TTWIN->name = Estrdup(name); - tt->visible = 0; tt->ref_count = 0; - AddItem(tt, tt->name, 0, LIST_TYPE_TOOLTIP); + AddItem(tt, name, 0, LIST_TYPE_TOOLTIP); return tt; } @@ -258,7 +242,7 @@ return; imlib_context_set_image(ic->norm.normal->im); - imlib_context_set_drawable(tt->win); + imlib_context_set_drawable(tt->TTWIN->win); imlib_context_set_blend(1); imlib_render_image_on_drawable(x, y); imlib_context_set_blend(0); @@ -269,26 +253,24 @@ void TooltipShow(ToolTip * tt, const char *text, ActionClass * ac, int x, int y) { - int i, w = 0, h = 0, ix, iy, iw, ih, dx, dy, xx, yy; + 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, temp_w, temp_h; + 0, labels_width = 0, double_w = 0; Imlib_Image *im; - char pq; int *heights = NULL; - ImageClass *ic = NULL; + ImageClass *ic; 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; - pq = Mode.queue_up; - Mode.queue_up = 0; - /* if we get an actionclass, look for tooltip action texts */ + h = 0; if (ac) { num = ActionclassGetActionCount(ac); @@ -296,6 +278,8 @@ for (i = 0; i < num; i++) { + int temp_w, temp_h; + temp_w = 0; temp_h = 0; @@ -412,6 +396,8 @@ else w = headline_w; h += headline_h; + + ic = tt->TTICL; iw = 0; ih = 0; if (tt->tooltippic) @@ -430,12 +416,12 @@ if (h < ih) h = ih; } - w += tt->iclass->padding.left + tt->iclass->padding.right; - h += tt->iclass->padding.top + tt->iclass->padding.bottom; + w += ic->padding.left + ic->padding.right; + h += ic->padding.top + ic->padding.bottom; if ((tt->tooltippic) && (iw > 0) && (ih > 0)) { - ix = tt->iclass->padding.left; + ix = ic->padding.left; iy = (h - ih) / 2; EMoveResizeWindow(tt->iwin, ix, iy, iw, ih); EMapWindow(tt->iwin); @@ -470,32 +456,40 @@ dist = tt->dist; ady = ady / dy; - yy = y - ((ady * 10 * dist) / 100); - xx = x - (dist * 10 * dx) / (100 * VRoot.w / 2); - EMoveWindow(tt->s_win[0], xx - 4, yy - 4); - - yy = y - ((ady * 30 * dist) / 100); - xx = x - (dist * 30 * dx) / (100 * VRoot.w / 2); - EMoveWindow(tt->s_win[1], xx - 8, yy - 8); - - yy = y - ((ady * 50 * dist) / 100); - xx = x - (dist * 50 * dx) / (100 * VRoot.w / 2); - EMoveWindow(tt->s_win[2], xx - 12, yy - 12); - - yy = y - ((ady * 80 * dist) / 100); - xx = x - (dist * 80 * dx) / (100 * VRoot.w / 2); - EMoveWindow(tt->s_win[3], xx - 16, yy - 16); + if (tt->win[0]) + { + yy = y - ((ady * 10 * dist) / 100); + xx = x - (dist * 10 * dx) / (100 * VRoot.w / 2); + EobjMove(tt->win[0], xx - 4, yy - 4); + } - yy = y - ((ady * 100 * dist) / 100); - xx = x - (dist * 100 * dx) / (100 * VRoot.w / 2); - if (ady < 0) + if (tt->win[1]) { - hh = 0; + yy = y - ((ady * 30 * dist) / 100); + xx = x - (dist * 30 * dx) / (100 * VRoot.w / 2); + EobjMove(tt->win[1], xx - 8, yy - 8); } - else + + if (tt->win[2]) { - hh = h; + yy = y - ((ady * 50 * dist) / 100); + xx = x - (dist * 50 * dx) / (100 * VRoot.w / 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 * VRoot.w / 2); + EobjMove(tt->win[3], xx - 16, yy - 16); + } + + yy = y - ((ady * 100 * dist) / 100); + xx = x - (dist * 100 * dx) / (100 * VRoot.w / 2); + if (ady < 0) + hh = 0; + else + hh = h; ww = (w / 2) + ((dx * w) / (VRoot.w / 2)); } else @@ -515,62 +509,72 @@ } dist = tt->dist; adx = adx / dx; - xx = x - ((adx * 10 * dist) / 100); - yy = y - (dist * 10 * dy) / (100 * VRoot.h / 2); - EMoveWindow(tt->s_win[0], xx - 4, yy - 4); - xx = x - ((adx * 30 * dist) / 100); - yy = y - (dist * 30 * dy) / (100 * VRoot.h / 2); - EMoveWindow(tt->s_win[1], xx - 8, yy - 8); - xx = x - ((adx * 50 * dist) / 100); - yy = y - (dist * 50 * dy) / (100 * VRoot.h / 2); - EMoveWindow(tt->s_win[2], xx - 12, yy - 12); - xx = x - ((adx * 80 * dist) / 100); - yy = y - (dist * 80 * dy) / (100 * VRoot.h / 2); - EMoveWindow(tt->s_win[3], xx - 16, yy - 16); - xx = x - ((adx * 100 * dist) / 100); - yy = y - (dist * 100 * dy) / (100 * VRoot.h / 2); - if (adx < 0) + + if (tt->win[0]) { - ww = 0; + xx = x - ((adx * 10 * dist) / 100); + yy = y - (dist * 10 * dy) / (100 * VRoot.h / 2); + EobjMove(tt->win[0], xx - 4, yy - 4); } - else + + if (tt->win[1]) { - ww = w; + xx = x - ((adx * 30 * dist) / 100); + yy = y - (dist * 30 * dy) / (100 * VRoot.h / 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 * VRoot.h / 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 * VRoot.h / 2); + EobjMove(tt->win[3], xx - 16, yy - 16); + } + + xx = x - ((adx * 100 * dist) / 100); + yy = y - (dist * 100 * dy) / (100 * VRoot.h / 2); + if (adx < 0) + ww = 0; + else + ww = w; hh = (h / 2) + ((dy * h) / (VRoot.h / 2)); } - EMoveResizeWindow(tt->win, xx - ww, yy - hh, w, h); + EobjMoveResize(tt->TTWIN, xx - ww, yy - hh, w, h); + + for (i = 0; i < 5; i++) + { + eo = tt->win[i]; + if (eo) + ImageclassApply(tt->iclass[i], eo->win, eo->w, eo->h, 0, 0, + STATE_NORMAL, 0, ST_TOOLTIP); + } + + for (i = 0; i < 5; i++) + if (tt->win[i]) + EobjMap(tt->win[i], 1); - ImageclassApply(tt->s_iclass[0], tt->s_win[0], 8, 8, 0, 0, STATE_NORMAL, 0, - ST_TOOLTIP); - ImageclassApply(tt->s_iclass[1], tt->s_win[1], 16, 16, 0, 0, STATE_NORMAL, 0, - ST_TOOLTIP); - ImageclassApply(tt->s_iclass[2], tt->s_win[2], 24, 24, 0, 0, STATE_NORMAL, 0, - ST_TOOLTIP); - ImageclassApply(tt->s_iclass[3], tt->s_win[3], 32, 32, 0, 0, STATE_NORMAL, 0, - ST_TOOLTIP); - ImageclassApply(tt->iclass, tt->win, w, h, 0, 0, STATE_NORMAL, 0, - ST_TOOLTIP); - EMapRaised(tt->s_win[0]); - EMapRaised(tt->s_win[1]); - EMapRaised(tt->s_win[2]); - EMapRaised(tt->s_win[3]); - EMapRaised(tt->win); ecore_x_sync(); - xx = tt->iclass->padding.left + iw; + xx = ic->padding.left + iw; /* draw the ordinary tooltip text */ - TextDraw(tt->tclass, tt->win, 0, 0, STATE_NORMAL, text, xx, - tt->iclass->padding.top, headline_w, headline_h, 17, 512); + TextDraw(tt->tclass, tt->TTWIN->win, 0, 0, STATE_NORMAL, text, xx, + ic->padding.top, headline_w, headline_h, 17, 512); /* draw the icons and labels, if any */ if (ac) { num = ActionclassGetActionCount(ac); - y = tt->iclass->padding.top + headline_h; - xx = tt->iclass->padding.left + double_w; + y = ic->padding.top + headline_h; + xx = ic->padding.left + double_w; for (i = 0; i < num; i++) { @@ -586,7 +590,7 @@ if (ActionGetEvent(aa) == EVENT_DOUBLE_DOWN) { - TextDraw(tt->tclass, tt->win, 0, 0, STATE_NORMAL, "2x", + TextDraw(tt->tclass, tt->TTWIN->win, 0, 0, STATE_NORMAL, "2x", xx + iw - double_w, y, double_w, heights[i], 17, 0); } @@ -637,16 +641,14 @@ TooltipIclassPaste(tt, "TOOLTIP_KEY_MOD5", x, y, &x); } - TextDraw(tt->tclass, tt->win, 0, 0, STATE_NORMAL, tts, - tt->iclass->padding.left + icons_width + iw, y, + TextDraw(tt->tclass, tt->TTWIN->win, 0, 0, STATE_NORMAL, tts, + ic->padding.left + icons_width + iw, y, labels_width, heights[i], 17, 0); y += heights[i]; } } - Mode.queue_up = pq; - tt->visible = 1; if (heights) Efree(heights); } @@ -654,18 +656,18 @@ void TooltipHide(ToolTip * tt) { + int i; + if (!tt) return; - if (!tt->visible) + if (!tt->TTWIN->shown) return; - tt->visible = 0; - EUnmapWindow(tt->win); - EUnmapWindow(tt->s_win[0]); - EUnmapWindow(tt->s_win[1]); - EUnmapWindow(tt->s_win[2]); - EUnmapWindow(tt->s_win[3]); + for (i = 4; i >= 0; i--) + if (tt->win[i]) + EobjUnmap(tt->win[i]); + ecore_x_sync(); } =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/warp.c,v retrieving revision 1.57 retrieving revision 1.58 diff -u -3 -r1.57 -r1.58 --- warp.c 19 Mar 2005 16:40:18 -0000 1.57 +++ warp.c 17 Apr 2005 13:58:09 -0000 1.58 @@ -48,9 +48,9 @@ static void WarpFocusHandleEvent(XEvent * ev, void *prm); +static EObj *warpFocusWindow = NULL; + static int warpFocusIndex = 0; -static char warpFocusTitleShowing = 0; -static Window warpFocusTitleWindow = 0; static unsigned int warpFocusKey = 0; static int warplist_num = 0; static WarplistItem *warplist; @@ -58,7 +58,7 @@ #define ICON_PAD 2 static void -WarpFocusShowTitle(EWin * ewin) +WarpFocusShow(EWin * ewin) { TextClass *tc; ImageClass *ic; @@ -78,19 +78,25 @@ if ((!ic) || (!tc)) return; - if (!warpFocusTitleWindow) + if (!warpFocusWindow) { - warpFocusTitleWindow = ECreateWindow(VRoot.win, 0, 0, 1, 1, 1); - EventCallbackRegister(warpFocusTitleWindow, 0, WarpFocusHandleEvent, - NULL); + EObj *eo; + + eo = EobjWindowCreate(EOBJ_TYPE_MISC, 0, 0, 1, 1, 1, "Warp"); + if (!eo) + return; + + warpFocusWindow = eo; + + EventCallbackRegister(eo->win, 0, WarpFocusHandleEvent, NULL); + TooltipsEnable(0); } pq = Mode.queue_up; Mode.queue_up = 0; - ERaiseWindow(warpFocusTitleWindow); - if (!warpFocusTitleShowing) + if (!warpFocusWindow->shown) { EWin **lst; @@ -105,7 +111,7 @@ warplist = Erealloc(warplist, warplist_num * sizeof(WarplistItem)); warplist[warplist_num - 1].win = - ECreateWindow(warpFocusTitleWindow, 0, 0, 1, 1, 0); + ECreateWindow(warpFocusWindow->win, 0, 0, 1, 1, 0); EMapWindow(warplist[warplist_num - 1].win); warplist[warplist_num - 1].ewin = lst[i]; Esnprintf(s, sizeof(s), (lst[i]->iconified) ? "[%s]" : "%s", @@ -133,7 +139,7 @@ GetPointerScreenAvailableArea(&x, &y, &ww, &hh); x += (ww - w) / 2; y += (hh - h * warplist_num) / 2; - EMoveResizeWindow(warpFocusTitleWindow, x, y, w, (h * warplist_num)); + EobjMoveResize(warpFocusWindow, x, y, w, h * warplist_num); for (i = 0; i < warplist_num; i++) { @@ -146,14 +152,14 @@ 0, ST_WARPLIST); } - PropagateShapes(warpFocusTitleWindow); - EMapWindow(warpFocusTitleWindow); + PropagateShapes(warpFocusWindow->win); + EobjMap(warpFocusWindow, 1); /* * Grab the keyboard. The grab is automatically released when - * WarpFocusHideTitle unmaps warpFocusTitleWindow. + * WarpFocusHide unmaps warpFocusWindow. */ - XGrabKeyboard(disp, warpFocusTitleWindow, False, GrabModeAsync, + XGrabKeyboard(disp, warpFocusWindow->win, False, GrabModeAsync, GrabModeAsync, CurrentTime); } @@ -200,37 +206,39 @@ } } - PropagateShapes(warpFocusTitleWindow); + PropagateShapes(warpFocusWindow->win); Mode.queue_up = pq; XFlush(disp); - warpFocusTitleShowing = 1; } static void -WarpFocusHideTitle(void) +WarpFocusHide(void) { int i; - if (warpFocusTitleWindow) + if (warpFocusWindow && warpFocusWindow->shown) { - EUnmapWindow(warpFocusTitleWindow); + EobjUnmap(warpFocusWindow); for (i = 0; i < warplist_num; i++) { EDestroyWindow(warplist[i].win); Efree(warplist[i].txt); } - EventCallbackUnregister(warpFocusTitleWindow, 0, WarpFocusHandleEvent, +#if 0 /* We might as well keep it around */ + EventCallbackUnregister(warpFocusWindow->win, 0, WarpFocusHandleEvent, NULL); - EDestroyWindow(warpFocusTitleWindow); + EDestroyWindow(warpFocusWindow->win); + EobjDestroy(warpFocusWindow); + warpFocusWindow = None; +#endif + TooltipsEnable(1); - warpFocusTitleWindow = None; } if (warplist) Efree(warplist); warplist = NULL; warplist_num = 0; - warpFocusTitleShowing = 0; } void @@ -241,7 +249,7 @@ int i, num0, num; /* Remember invoking keycode (ugly hack) */ - if (!warpFocusTitleShowing) + if (!warpFocusWindow || !warpFocusWindow->shown) warpFocusKey = Mode.last_keycode; lst = (EWin **) ListItemType(&num, LIST_TYPE_WARP_RING); @@ -286,7 +294,7 @@ EoGetW(ewin) / 2, EoGetH(ewin) / 2); if (Conf.warplist.warpfocused) FocusToEWin(ewin, FOCUS_SET); - WarpFocusShowTitle(ewin); + WarpFocusShow(ewin); } Efree(lst); } @@ -304,7 +312,7 @@ ewin = lst[warpFocusIndex]; - WarpFocusHideTitle(); + WarpFocusHide(); if (!FindItem((char *)ewin, 0, LIST_FINDBY_POINTER, LIST_TYPE_EWIN)) ewin = NULL; if (ewin) @@ -331,12 +339,12 @@ { #if 0 /* Not necessary when sampling keycode in events.c */ case KeyPress: - if (warpFocusTitleShowing && ev->xany.window == VRoot.win) + if (warpFocusWindow->shown && ev->xany.window == VRoot.win) warpFocusKey = ev->xkey.keycode; break; #endif case KeyRelease: - if (warpFocusTitleShowing && ev->xkey.keycode != warpFocusKey) + if (warpFocusWindow->shown && ev->xkey.keycode != warpFocusKey) WarpFocusFinish(); break; } ------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs