From: <enl...@li...> - 2005-06-09 18:28:32
|
Enlightenment CVS committal Author : kwo Project : e16 Module : e Dir : e16/e/src Modified Files: E.h aclass.c buttons.c eobj.c events.c ewins.c iconify.c ipc.c menus.c pager.c slideout.c x.c Log Message: Fix slideouts. =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v retrieving revision 1.449 retrieving revision 1.450 diff -u -3 -r1.449 -r1.450 --- E.h 5 Jun 2005 11:27:27 -0000 1.449 +++ E.h 9 Jun 2005 18:27:55 -0000 1.450 @@ -335,7 +335,6 @@ typedef struct _snapshot Snapshot; typedef struct _group Group; typedef struct _button Button; -typedef struct _slideout Slideout; typedef struct _background Background; typedef struct _ecursor ECursor; typedef struct _efont Efont; @@ -1073,9 +1072,7 @@ int px, py, x, y; int server_grabbed; int deskdrag; - char button_move_pending; Colormap current_cmap; - Slideout *slideout; Window context_win; char constrained; char nogroup; @@ -1284,12 +1281,13 @@ int ButtonGetDesk(const Button * b); int ButtonGetInfo(const Button * b, RectBox * r, int desk); ActionClass *ButtonGetAClass(const Button * b); -Window ButtonGetWindow(const Button * b); +Window ButtonGetWin(const Button * b); int ButtonGetWidth(const Button * b); int ButtonGetHeight(const Button * b); int ButtonIsFixed(const Button * b); int ButtonIsInternal(const Button * b); int ButtonDoShowDefault(const Button * b); +void ButtonDoAction(Button * b, EWin * ewin, XEvent * ev); int ButtonEmbedWindow(Button * ButtonToUse, Window WindowToEmbed); @@ -1527,6 +1525,8 @@ int speed); void EobjsSlideBy(EObj ** peo, int num, int dx, int dy, int speed); +void EobjSlideSizeTo(EObj * eo, int fx, int fy, int tx, int ty, + int fw, int fh, int tw, int th, int speed); /* events.c */ /* Re-mapped X-events */ @@ -1898,7 +1898,7 @@ void __PRINTF__ IpcPrintf(const char *fmt, ...); int HandleIPC(const char *params, Client * c); void ButtonIPC(int val, void *data); -int EFunc(const char *params); +int EFunc(EWin * ewin, const char *params); /* lang.c */ void LangInit(void); @@ -2094,10 +2094,6 @@ /* slideouts.c */ int SlideoutsConfigLoad(FILE * fs); -void SlideoutShow(Slideout * s, EWin * ewin, Window win); -void SlideoutHide(Slideout * s); - -void SlideoutsHide(void); /* snaps.c */ void Real_SaveSnapInfo(int dumval, void *dumdat); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/aclass.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -3 -r1.13 -r1.14 --- aclass.c 25 Mar 2005 18:11:52 -0000 1.13 +++ aclass.c 9 Jun 2005 18:28:10 -0000 1.14 @@ -821,9 +821,7 @@ static void handleAction(EWin * ewin, ActionType * action) { - SetContextEwin(ewin); - EFunc(action->params); - SetContextEwin(NULL); + EFunc(ewin, action->params); /* Did we just hose ourselves? if so, we'd best not stick around here */ if (mode_action_destroy) =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/buttons.c,v retrieving revision 1.63 retrieving revision 1.64 diff -u -3 -r1.63 -r1.64 --- buttons.c 12 May 2005 16:53:47 -0000 1.63 +++ buttons.c 9 Jun 2005 18:28:10 -0000 1.64 @@ -63,6 +63,7 @@ { Button *button; char loading_user; + char move_pending; } Mode_buttons; static void ButtonHandleEvents(XEvent * ev, void *btn); @@ -398,7 +399,7 @@ } Window -ButtonGetWindow(const Button * b) +ButtonGetWin(const Button * b) { return EoGetWin(b); } @@ -433,6 +434,13 @@ return !b->internal && b->default_show; } +void +ButtonDoAction(Button * b, EWin * ewin, XEvent * ev) +{ + if (b->aclass) + EventAclass(ev, ewin, b->aclass); +} + int ButtonEmbedWindow(Button * b, Window WindowToEmbed) { @@ -464,7 +472,7 @@ GrabPointerSet(EoGetWin(b), ECSR_GRAB, 0); Mode.mode = MODE_BUTTONDRAG; - Mode.button_move_pending = 1; + Mode_buttons.move_pending = 1; Mode.start_x = Mode.x; Mode.start_y = Mode.y; Mode.win_x = EoGetX(b); @@ -478,7 +486,7 @@ Mode.mode = MODE_NONE; - if (!Mode.button_move_pending) + if (!Mode_buttons.move_pending) { d = DesktopAt(Mode.x, Mode.y); ButtonMoveToDesktop(b, d); @@ -486,7 +494,7 @@ ButtonMoveRelative(b, -DeskGetX(d), -DeskGetY(d)); } else - Mode.button_move_pending = 0; + Mode_buttons.move_pending = 0; autosave(); } @@ -543,9 +551,14 @@ b->state = STATE_CLICKED; ButtonDraw(b); - ac = FindItem("ACTION_BUTTON_DRAG", 0, LIST_FINDBY_NAME, LIST_TYPE_ACLASS); - if (ac) - EventAclass(ev, NULL, ac); + if (!b->internal) + { + ac = FindItem("ACTION_BUTTON_DRAG", 0, LIST_FINDBY_NAME, + LIST_TYPE_ACLASS); + if (ac) + EventAclass(ev, NULL, ac); + } + if (b->aclass) EventAclass(ev, NULL, b->aclass); } @@ -568,6 +581,10 @@ b->state = STATE_NORMAL; ButtonDraw(b); +#if 1 /* FIXME - Here? */ + GrabPointerRelease(); +#endif + if (b->aclass && !b->left) EventAclass(ev, NULL, b->aclass); @@ -577,7 +594,9 @@ ButtonDragEnd(Mode_buttons.button); Mode_buttons.button = NULL; +#if 0 /* FIXME - Move? */ GrabPointerRelease(); +#endif } static void @@ -591,7 +610,7 @@ dx = Mode.x - Mode.px; dy = Mode.y - Mode.py; - if (Mode.button_move_pending) + if (Mode_buttons.move_pending) { int x, y; @@ -603,10 +622,10 @@ y = -y; if ((x > Conf.button_move_resistance) || (y > Conf.button_move_resistance)) - Mode.button_move_pending = 0; + Mode_buttons.move_pending = 0; Mode.action_inhibit = 1; } - if (!Mode.button_move_pending) + if (!Mode_buttons.move_pending) { if (b) { =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/eobj.c,v retrieving revision 1.33 retrieving revision 1.34 diff -u -3 -r1.33 -r1.34 --- eobj.c 5 Jun 2005 15:15:59 -0000 1.33 +++ eobj.c 9 Jun 2005 18:28:11 -0000 1.34 @@ -492,6 +492,34 @@ } void +EobjSlideSizeTo(EObj * eo, int fx, int fy, int tx, int ty, int fw, int fh, + int tw, int th, int speed) +{ + int k, x, y, w, h; + +#if 0 /* FIXME - Need this? */ + EGrabServer(); +#endif + + ETimedLoopInit(0, 1024, speed); + for (k = 0; k <= 1024;) + { + x = ((fx * (1024 - k)) + (tx * k)) >> 10; + y = ((fy * (1024 - k)) + (ty * k)) >> 10; + w = ((fw * (1024 - k)) + (tw * k)) >> 10; + h = ((fh * (1024 - k)) + (th * k)) >> 10; + EobjMoveResize(eo, x, y, w, h); + + k = ETimedLoopNext(); + } + EobjMoveResize(eo, tx, ty, tw, th); + +#if 0 /* FIXME - Need this? */ + EUngrabServer(); +#endif +} + +void EobjsRepaint(void) { #if USE_COMPOSITE =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/events.c,v retrieving revision 1.91 retrieving revision 1.92 diff -u -3 -r1.91 -r1.92 --- events.c 28 May 2005 20:36:24 -0000 1.91 +++ events.c 9 Jun 2005 18:28:11 -0000 1.92 @@ -165,7 +165,6 @@ { void **lst; int i, num; - Slideout *pslideout = NULL; #if ENABLE_DEBUG_EVENTS if (EventDebug(ev->type)) @@ -265,8 +264,6 @@ } #endif - pslideout = Mode.slideout; - ActionsEnd(NULL); break; case MotionNotify: /* 6 */ @@ -329,10 +326,6 @@ switch (ev->type) { case ButtonRelease: /* 5 */ - /* This shouldn't be here */ - if ((Mode.slideout) && (pslideout)) - SlideoutHide(Mode.slideout); - Mode.last_bpress = 0; Mode.action_inhibit = 0; break; =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/ewins.c,v retrieving revision 1.73 retrieving revision 1.74 diff -u -3 -r1.73 -r1.74 --- ewins.c 5 Jun 2005 11:27:40 -0000 1.73 +++ ewins.c 9 Jun 2005 18:28:11 -0000 1.74 @@ -889,9 +889,6 @@ FocusEnable(1); #endif } - - if (ewin == GetContextEwin()) - SlideoutsHide(); } static void =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/iconify.c,v retrieving revision 1.156 retrieving revision 1.157 diff -u -3 -r1.156 -r1.157 --- iconify.c 4 Jun 2005 23:58:08 -0000 1.156 +++ iconify.c 9 Jun 2005 18:28:11 -0000 1.157 @@ -1753,7 +1753,7 @@ mi = MenuItemCreate(_("Create New Iconbox"), NULL, "ibox new", NULL); MenuAddItem(p_menu, mi); - EFunc("menus show __IBOX_MENU"); + EFunc(NULL, "menus show __IBOX_MENU"); } else { @@ -1767,7 +1767,7 @@ mi = MenuItemCreate(_("Close Systray"), NULL, s, NULL); MenuAddItem(p_menu, mi); - EFunc("menus show __TRAY_MENU"); + EFunc(NULL, "menus show __TRAY_MENU"); } } =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/ipc.c,v retrieving revision 1.217 retrieving revision 1.218 diff -u -3 -r1.217 -r1.218 --- ipc.c 29 May 2005 17:52:03 -0000 1.217 +++ ipc.c 9 Jun 2005 18:28:11 -0000 1.218 @@ -1231,22 +1231,6 @@ } static void -IPC_Slideout(const char *params, Client * c __UNUSED__) -{ - Slideout *s; - - if (!params) - return; - - s = FindItem(params, 0, LIST_FINDBY_NAME, LIST_TYPE_SLIDEOUT); - if (s) - { - SoundPlay("SOUND_SLIDEOUT_SHOW"); - SlideoutShow(s, GetContextEwin(), Mode.context_win); - } -} - -static void IPC_Warp(const char *params, Client * c __UNUSED__) { int x, y; @@ -1503,8 +1487,6 @@ "Reparent window", " reparent <windowid> <new parent>\n"}, { - IPC_Slideout, "slideout", NULL, "Show slideout", NULL}, - { IPC_Remember, "remember", NULL, "Remembers parameters for client windows (obsolete)", @@ -1599,9 +1581,15 @@ } int -EFunc(const char *params) +EFunc(EWin * ewin, const char *params) { - return HandleIPC(params, NULL); + int err; + + SetContextEwin(ewin); + err = HandleIPC(params, NULL); + SetContextEwin(NULL); + + return err; } static int =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/menus.c,v retrieving revision 1.199 retrieving revision 1.200 diff -u -3 -r1.199 -r1.200 --- menus.c 4 Jun 2005 23:58:08 -0000 1.199 +++ menus.c 9 Jun 2005 18:28:13 -0000 1.200 @@ -1190,23 +1190,6 @@ return NULL; } -#if 0 -static EWin * -MenuFindContextEwin(Menu * m __UNUSED__) -{ -#if 0 - while (m && m->parent) - m = m->parent; - - if (!m) - return NULL; - - return FindEwinSpawningMenu(m); -#endif - return Mode_menus.context_ewin; -} -#endif - static KeySym MenuKeyPressConversion(KeySym key) { @@ -1290,9 +1273,7 @@ break; MenusHide(); EobjsRepaint(); - SetContextEwin(Mode_menus.context_ewin); - EFunc(mi->params); - SetContextEwin(NULL); + EFunc(Mode_menus.context_ewin, mi->params); break; } } @@ -1365,9 +1346,7 @@ { MenusHide(); EobjsRepaint(); - SetContextEwin(Mode_menus.context_ewin); - EFunc(mi->params); - SetContextEwin(NULL); + EFunc(Mode_menus.context_ewin, mi->params); return; } } =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/pager.c,v retrieving revision 1.149 retrieving revision 1.150 diff -u -3 -r1.149 -r1.150 --- pager.c 8 Jun 2005 16:33:37 -0000 1.149 +++ pager.c 9 Jun 2005 18:28:13 -0000 1.150 @@ -856,7 +856,7 @@ mi = MenuItemCreate(_("Stick / Unstick"), NULL, s, NULL); MenuAddItem(pw_menu, mi); - EFunc("menus show __DESK_WIN_MENU"); + EFunc(NULL, "menus show __DESK_WIN_MENU"); return; } @@ -882,7 +882,7 @@ MenuAddItem(p_menu, mi); } - EFunc("menus show __DESK_MENU"); + EFunc(NULL, "menus show __DESK_MENU"); } static void =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/slideout.c,v retrieving revision 1.31 retrieving revision 1.32 diff -u -3 -r1.31 -r1.32 --- slideout.c 21 May 2005 20:58:18 -0000 1.31 +++ slideout.c 9 Jun 2005 18:28:13 -0000 1.32 @@ -23,91 +23,71 @@ */ #include "E.h" -struct _slideout +typedef struct { - char *name; + EObj *win; char direction; int num_buttons; Button **button; - int w, h; - Window win; - Window from_win; unsigned int ref_count; -}; + EWin *context_ewin; +} Slideout; static void SlideoutCalcSize(Slideout * s); -static void -SlideWindowSizeTo(Window win, int fx, int fy, int tx, int ty, int fw, int fh, - int tw, int th, int speed) +struct { - int k, x, y, w, h; - - EGrabServer(); - - ETimedLoopInit(0, 1024, speed); - for (k = 0; k <= 1024;) - { - x = ((fx * (1024 - k)) + (tx * k)) >> 10; - y = ((fy * (1024 - k)) + (ty * k)) >> 10; - w = ((fw * (1024 - k)) + (tw * k)) >> 10; - h = ((fh * (1024 - k)) + (th * k)) >> 10; - EMoveResizeWindow(win, x, y, w, h); - - k = ETimedLoopNext(); - } - EMoveResizeWindow(win, tx, ty, tw, th); + Slideout *active; +} Mode_slideouts = +{ +NULL}; - EUngrabServer(); -} +static void SlideoutHandleEvent(XEvent * ev, void *prm); static Slideout * SlideoutCreate(char *name, char dir) { Slideout *s; - s = Emalloc(sizeof(Slideout)); + s = Ecalloc(1, sizeof(Slideout)); if (!s) return NULL; - s->name = Estrdup(name); + s->win = EobjWindowCreate(EOBJ_TYPE_MISC, -10, -10, 1, 1, 1, name); s->direction = dir; - s->num_buttons = 0; - s->button = NULL; - s->w = 0; - s->h = 0; - s->win = ECreateWindow(VRoot.win, -10, -10, 1, 1, 1); - s->from_win = 0; - s->ref_count = 0; + EventCallbackRegister(s->win->win, 0, SlideoutHandleEvent, s); return s; } -void +static void SlideoutShow(Slideout * s, EWin * ewin, Window win) { - int x, y, i, xx, yy, di; + int x, y, i, xx, yy, sw, sh; Window dw; char pdir; XSetWindowAttributes att; - int w, h, d; + int w, h; + Desk *d; /* Don't ever show more than one slideout */ - if (Mode.slideout) + if (Mode_slideouts.active) return; SlideoutCalcSize(s); - EGetGeometry(win, &dw, &di, &di, &w, &h, &d, &d); + EGetGeometry(win, NULL, NULL, NULL, &w, &h, NULL, NULL); XTranslateCoordinates(disp, win, VRoot.win, 0, 0, &x, &y, &dw); + sw = s->win->w; + sh = s->win->h; xx = 0; yy = 0; switch (s->direction) { case 2: - xx = x + ((w - s->w) >> 1); - yy = y - s->h; - if ((yy < 0) && (s->h < VRoot.h)) + xx = x + ((w - sw) >> 1); + yy = y - sh; + if ((yy < 0) && (sh < VRoot.h)) { pdir = s->direction; s->direction = 1; @@ -117,9 +97,9 @@ } break; case 3: - xx = x + ((w - s->w) >> 1); + xx = x + ((w - sw) >> 1); yy = y + h; - if (((yy + s->h) > VRoot.h) && (s->h < VRoot.h)) + if (((yy + sh) > VRoot.h) && (sh < VRoot.h)) { pdir = s->direction; s->direction = 0; @@ -129,9 +109,9 @@ } break; case 0: - xx = x - s->w; - yy = y + ((h - s->h) >> 1); - if ((xx < 0) && (s->w < VRoot.w)) + xx = x - sw; + yy = y + ((h - sh) >> 1); + if ((xx < 0) && (sw < VRoot.w)) { pdir = s->direction; s->direction = 1; @@ -142,8 +122,8 @@ break; case 1: xx = x + w; - yy = y + ((h - s->h) >> 1); - if (((xx + s->w) > VRoot.w) && (s->w < VRoot.w)) + yy = y + ((h - sh) >> 1); + if (((xx + sw) > VRoot.w) && (sw < VRoot.w)) { pdir = s->direction; s->direction = 0; @@ -156,107 +136,113 @@ break; } - /* If the slideout is associated with an ewin, - * put it on the same virtual desktop. */ - dw = VRoot.win; - if (ewin && BorderWinpartIndex(ewin, win) >= 0 && - !EoIsFloating(ewin) /* && !ewin->sticky */ ) + if (ewin) { - int desk = EoGetDesk(ewin); - - xx -= DeskGetX(desk); - yy -= DeskGetY(desk); - dw = DeskGetWin(desk); + /* If the slideout is associated with an ewin, + * put it on the same virtual desktop. */ + d = DeskGet(EoGetDesk(ewin)); + if (BorderWinpartIndex(ewin, win) >= 0 && + !EoIsFloating(ewin) /* && !ewin->sticky */ ) + { + xx -= EoGetX(d); + yy -= EoGetY(d); + } + } + else + { + d = DeskGet(0); } - EReparentWindow(s->win, dw, xx, yy); + EobjReparent(s->win, d->num, xx, yy); switch (s->direction) { case 0: att.win_gravity = SouthEastGravity; - EChangeWindowAttributes(s->win, CWWinGravity, &att); + EChangeWindowAttributes(s->win->win, CWWinGravity, &att); att.win_gravity = NorthWestGravity; for (i = 0; i < s->num_buttons; i++) - EChangeWindowAttributes(ButtonGetWindow(s->button[i]), + EChangeWindowAttributes(ButtonGetWin(s->button[i]), CWWinGravity, &att); - EMoveResizeWindow(s->win, xx, yy, 1, 1); + EobjMoveResize(s->win, xx, yy, 1, 1); ESync(); - EMapRaised(s->win); - SlideWindowSizeTo(s->win, xx + s->w, yy, xx, yy, 0, s->h, s->w, s->h, - Conf.slidespeedmap); + EobjMap(s->win, 1); + EobjSlideSizeTo(s->win, xx + sw, yy, xx, yy, 0, sh, sw, sh, + Conf.slidespeedmap); break; case 1: att.win_gravity = NorthWestGravity; - EChangeWindowAttributes(s->win, CWWinGravity, &att); + EChangeWindowAttributes(s->win->win, CWWinGravity, &att); att.win_gravity = SouthEastGravity; for (i = 0; i < s->num_buttons; i++) - EChangeWindowAttributes(ButtonGetWindow(s->button[i]), + EChangeWindowAttributes(ButtonGetWin(s->button[i]), CWWinGravity, &att); - EMoveResizeWindow(s->win, xx, yy, 1, 1); + EobjMoveResize(s->win, xx, yy, 1, 1); ESync(); - EMapRaised(s->win); - SlideWindowSizeTo(s->win, xx, yy, xx, yy, 0, s->h, s->w, s->h, - Conf.slidespeedmap); + EobjMap(s->win, 1); + EobjSlideSizeTo(s->win, xx, yy, xx, yy, 0, sh, sw, sh, + Conf.slidespeedmap); break; case 2: att.win_gravity = SouthEastGravity; - EChangeWindowAttributes(s->win, CWWinGravity, &att); + EChangeWindowAttributes(s->win->win, CWWinGravity, &att); att.win_gravity = NorthWestGravity; for (i = 0; i < s->num_buttons; i++) - EChangeWindowAttributes(ButtonGetWindow(s->button[i]), + EChangeWindowAttributes(ButtonGetWin(s->button[i]), CWWinGravity, &att); - EMoveResizeWindow(s->win, xx, yy, 1, 1); + EobjMoveResize(s->win, xx, yy, 1, 1); ESync(); - EMapRaised(s->win); - SlideWindowSizeTo(s->win, xx, yy + s->h, xx, yy, s->w, 0, s->w, s->h, - Conf.slidespeedmap); + EobjMap(s->win, 1); + EobjSlideSizeTo(s->win, xx, yy + sh, xx, yy, sw, 0, sw, sh, + Conf.slidespeedmap); break; case 3: att.win_gravity = NorthWestGravity; - EChangeWindowAttributes(s->win, CWWinGravity, &att); + EChangeWindowAttributes(s->win->win, CWWinGravity, &att); att.win_gravity = SouthEastGravity; for (i = 0; i < s->num_buttons; i++) - EChangeWindowAttributes(ButtonGetWindow(s->button[i]), + EChangeWindowAttributes(ButtonGetWin(s->button[i]), CWWinGravity, &att); - EMoveResizeWindow(s->win, xx, yy, 1, 1); + EobjMoveResize(s->win, xx, yy, 1, 1); ESync(); - EMapRaised(s->win); - SlideWindowSizeTo(s->win, xx, yy, xx, yy, s->w, 0, s->w, s->h, - Conf.slidespeedmap); + EobjMap(s->win, 1); + EobjSlideSizeTo(s->win, xx, yy, xx, yy, sw, 0, sw, sh, + Conf.slidespeedmap); break; default: break; } - s->from_win = win; s->ref_count++; + s->context_ewin = ewin; + + GrabPointerSet(s->win->win, ECSR_ROOT, 0); - Mode.slideout = s; + Mode_slideouts.active = s; } -void +static void SlideoutHide(Slideout * s) { if (!s) return; - EUnmapWindow(s->win); - s->from_win = 0; + GrabPointerRelease(); + EobjUnmap(s->win); + s->context_ewin = NULL; s->ref_count--; - Mode.slideout = NULL; + Mode_slideouts.active = NULL; } static void SlideoutCalcSize(Slideout * s) { - int i; - int mx, my, x, y; - int bw, bh; + int i, x, y; + int sw, sh, bw, bh; if (!s) return; - mx = 0; - my = 0; + sw = 0; + sh = 0; x = 0; y = 0; for (i = 0; i < s->num_buttons; i++) @@ -268,24 +254,22 @@ { case 2: case 3: - if (bw > mx) - mx = bw; - my += bh; + if (bw > sw) + sw = bw; + sh += bh; break; case 0: case 1: - if (bh > my) - my = bh; - mx += bw; + if (bh > sh) + sh = bh; + sw += bw; break; default: break; } } - EResizeWindow(s->win, mx, my); - s->w = mx; - s->h = my; + EobjResize(s->win, sw, sh); for (i = 0; i < s->num_buttons; i++) { @@ -296,26 +280,24 @@ { case 2: y += bh; - EMoveWindow(ButtonGetWindow(s->button[i]), - (s->w - bw) >> 1, s->h - y); + EMoveWindow(ButtonGetWin(s->button[i]), (sw - bw) >> 1, sh - y); break; case 3: - EMoveWindow(ButtonGetWindow(s->button[i]), (s->w - bw) >> 1, y); + EMoveWindow(ButtonGetWin(s->button[i]), (sw - bw) >> 1, y); y += bh; break; case 0: x += bw; - EMoveWindow(ButtonGetWindow(s->button[i]), s->w - x, - (s->h - bh) >> 1); + EMoveWindow(ButtonGetWin(s->button[i]), sw - x, (sh - bh) >> 1); break; case 1: - EMoveWindow(ButtonGetWindow(s->button[i]), x, (s->h - bh) >> 1); + EMoveWindow(ButtonGetWin(s->button[i]), x, (sh - bh) >> 1); x += bw; default: break; } } - EShapePropagate(s->win); + EShapePropagate(s->win->win); } static void @@ -329,7 +311,7 @@ s->num_buttons++; s->button = Erealloc(s->button, sizeof(Button *) * s->num_buttons); s->button[s->num_buttons - 1] = b; - EReparentWindow(ButtonGetWindow(b), s->win, 0, 0); + EReparentWindow(ButtonGetWin(b), s->win->win, 0, 0); ButtonSetSwallowed(b); ButtonShow(b); SlideoutCalcSize(s); @@ -347,35 +329,57 @@ static const char * SlideoutGetName(Slideout * s) { - return s->name; + return s->win->name; } -#if 0 -static EWin * -SlideoutsGetContextEwin(void) +static void +SlideoutCheckButtonEvent(Slideout * s, XEvent * ev) { - if (Mode.slideout) - return FindEwinByChildren(Mode.slideout->from_win); + int i, x, y, bx, by, bw, bh; + Button *b; - return NULL; + x = ev->xbutton.x; + y = ev->xbutton.y; + + if (x < 0 || y < 0 || x > s->win->w || y >= s->win->h) + return; + + for (i = 0; i < s->num_buttons; i++) + { + b = s->button[i]; + EGetGeometry(ButtonGetWin(b), NULL, &bx, &by, &bw, &bh, NULL, NULL); + if (x < bx || y < by || x >= bx + bw || y >= by + bh) + continue; + ButtonDoAction(b, s->context_ewin, ev); + } } -#endif -void -SlideoutsHide(void) +static void +SlideoutHandleEvent(XEvent * ev, void *prm) { - if (Mode.slideout) - SlideoutHide(Mode.slideout); + Slideout *s = prm; + + switch (ev->type) + { + case KeyPress: + case KeyRelease: + SlideoutHide(s); + break; + case ButtonPress: + case ButtonRelease: + SlideoutCheckButtonEvent(s, ev); + if (ev->type == ButtonRelease) + SlideoutHide(s); + break; + } } -#if 0 static void -SlideoutsHideIfContextWin(Window win) +SlideoutsHide(void) { - if ((Mode.slideout) && (Mode.slideout->from_win == win)) - SlideoutHide(Mode.slideout); + if (Mode_slideouts.active) + SlideoutHide(Mode_slideouts.active); } -#endif /* * Configuration load/save @@ -460,7 +464,7 @@ */ static void -SlideoutsSighan(int sig, void *prm __UNUSED__) +SlideoutsSighan(int sig, void *prm) { switch (sig) { @@ -468,16 +472,43 @@ case ESIGNAL_DESK_SWITCH_START: SlideoutsHide(); break; + + case ESIGNAL_EWIN_UNMAP: + if (Mode_slideouts.active + && Mode_slideouts.active->context_ewin == (EWin *) prm) + SlideoutsHide(); + break; } } +static void +IPC_Slideout(const char *params, Client * c __UNUSED__) +{ + Slideout *s; + + if (!params) + return; + + s = FindItem(params, 0, LIST_FINDBY_NAME, LIST_TYPE_SLIDEOUT); + if (!s) + return; + + SoundPlay("SOUND_SLIDEOUT_SHOW"); + SlideoutShow(s, GetContextEwin(), Mode.context_win); +} + +static IpcItem SlideoutsIpcArray[] = { + { + IPC_Slideout, "slideout", NULL, "Show slideout", NULL}, +}; +#define N_IPC_FUNCS (sizeof(SlideoutsIpcArray)/sizeof(IpcItem)) + /* * Module descriptor */ EModule ModSlideouts = { "slideouts", "slideout", SlideoutsSighan, - {0, NULL} - , + {N_IPC_FUNCS, SlideoutsIpcArray}, {0, NULL} }; =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/x.c,v retrieving revision 1.96 retrieving revision 1.97 diff -u -3 -r1.96 -r1.97 --- x.c 4 Jun 2005 08:29:55 -0000 1.96 +++ x.c 9 Jun 2005 18:28:13 -0000 1.97 @@ -421,10 +421,6 @@ { EXID *xid; -#if 0 /* FIXME */ - SlideoutsHideIfContextWin(win); -#endif - xid = EXidFind(win); if (xid) { |