Enlightenment CVS committal Author : kwo Project : e16 Module : e
Dir : e16/e/src Modified Files: E.h areas.c backgrounds.c buttons.c desktops.c ecompmgr.c iclass.c menus.c pager.c timers.c x.c Log Message: Fix menu segv. Eliminate GetWinXY/WH. =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v retrieving revision 1.386 retrieving revision 1.387 diff -u -3 -r1.386 -r1.387 --- E.h 6 Mar 2005 11:40:54 -0000 1.386 +++ E.h 6 Mar 2005 21:29:43 -0000 1.387 @@ -2134,7 +2134,7 @@ void *runtime_data); Qentry *GetHeadTimerQueue(void); void HandleTimerEvent(void); -void RemoveTimerEvent(const char *name); +int RemoveTimerEvent(const char *name); /* tooltips.c */ typedef struct _tooltip ToolTip; @@ -2241,8 +2241,7 @@ void ESetColor(XColor * pxc, int r, int g, int b); void EGetColor(const XColor * pxc, int *pr, int *pg, int *pb); -void GetWinXY(Window win, int *x, int *y); -void GetWinWH(Window win, unsigned int *w, unsigned int *h); + int GetWinDepth(Window win); Window GetWinParent(Window win); int WinExists(Window win); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/areas.c,v retrieving revision 1.78 retrieving revision 1.79 diff -u -3 -r1.78 -r1.79 --- areas.c 2 Feb 2005 17:11:30 -0000 1.78 +++ areas.c 6 Mar 2005 21:29:44 -0000 1.79 @@ -177,7 +177,8 @@ xy = Emalloc(sizeof(struct _xy) * num); for (i = 0; i < num; i++) - GetWinXY(win[i], &(xy[i].x), &(xy[i].y)); + EGetGeometry(win[i], NULL, &(xy[i].x), &(xy[i].y), NULL, NULL, NULL, + NULL); ETimedLoopInit(0, 1024, speed); for (k = 0; k <= 1024;) =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/backgrounds.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -3 -r1.18 -r1.19 --- backgrounds.c 5 Mar 2005 12:19:47 -0000 1.18 +++ backgrounds.c 6 Mar 2005 21:29:44 -0000 1.19 @@ -467,16 +467,16 @@ void BackgroundApply(Background * bg, Window win, int setbg) { - unsigned int rw, rh; + unsigned int rw, rh, depth; Pixmap dpmap; GC gc; - int rt, depth; + int rt; if (!WinExists(win)) return; - GetWinWH(win, &rw, &rh); - depth = GetWinDepth(win); + EGetGeometry(win, NULL, NULL, NULL, &rw, &rh, NULL, &depth); + imlib_context_set_drawable(win); EAllocColor(&bg->bg_solid); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/buttons.c,v retrieving revision 1.51 retrieving revision 1.52 diff -u -3 -r1.51 -r1.52 --- buttons.c 5 Mar 2005 12:19:47 -0000 1.51 +++ buttons.c 6 Mar 2005 21:29:44 -0000 1.52 @@ -551,7 +551,7 @@ EReparentWindow(WindowToEmbed, EoGetWin(b), 0, 0); b->inside_win = WindowToEmbed; - GetWinWH(WindowToEmbed, &w, &h); + EGetGeometry(WindowToEmbed, NULL, NULL, NULL, &w, &h, NULL, NULL); EMoveWindow(b->inside_win, (EoGetW(b) - w) >> 1, (EoGetH(b) - h) >> 1); b->event_win = ECreateEventWindow(EoGetWin(b), 0, 0, w, h); EventCallbackRegister(b->event_win, 0, ButtonHandleEvents, b); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/desktops.c,v retrieving revision 1.129 retrieving revision 1.130 diff -u -3 -r1.129 -r1.130 --- desktops.c 5 Mar 2005 17:52:01 -0000 1.129 +++ desktops.c 6 Mar 2005 21:29:44 -0000 1.130 @@ -983,7 +983,6 @@ DeskGoto(int desk) { Desk *d; - int x, y; if (Conf.desks.desks_wraparound) { @@ -1047,7 +1046,6 @@ } else { - GetWinXY(EoGetWin(d), &x, &y); SlideWindowTo(EoGetWin(d), EoGetX(d), EoGetY(d), 0, 0, Conf.desks.slidespeed); DeskRaise(desk); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/ecompmgr.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -3 -r1.11 -r1.12 --- ecompmgr.c 27 Feb 2005 17:32:18 -0000 1.11 +++ ecompmgr.c 6 Mar 2005 21:29:44 -0000 1.12 @@ -289,7 +289,7 @@ } wo = ho = 0; - GetWinWH(eo->win, &wo, &ho); + EGetGeometry(eo->win, NULL, NULL, NULL, &wo, &ho, NULL, NULL); if (wo <= 0 || ho <= 0 || (wo == w && ho == h)) { EMoveResizeWindow(eo->win, x, y, w, h); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/iclass.c,v retrieving revision 1.55 retrieving revision 1.56 diff -u -3 -r1.55 -r1.56 --- iclass.c 2 Mar 2005 20:09:45 -0000 1.55 +++ iclass.c 6 Mar 2005 21:29:44 -0000 1.56 @@ -981,7 +981,7 @@ /* FIXME - Why? */ if (w <= 0 || h <= 0) - GetWinWH(win, (unsigned int *)&w, (unsigned int *)&h); + EGetGeometry(win, NULL, NULL, NULL, &w, &h, NULL, NULL); if (w <= 0 || h <= 0) return; =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/menus.c,v retrieving revision 1.173 retrieving revision 1.174 diff -u -3 -r1.173 -r1.174 --- menus.c 27 Feb 2005 17:32:19 -0000 1.173 +++ menus.c 6 Mar 2005 21:29:44 -0000 1.174 @@ -1,5 +1,6 @@ /* * Copyright (C) 2000-2004 Carsten Haitzler, Geoff Harrison and various contributors + * Copyright (C) 2004-2005 Kim Woelders * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to @@ -184,10 +185,11 @@ ewin = FindEwinByMenu(m); if (ewin) - HideEwin(ewin); + { + HideEwin(ewin); + EReparentWindow(m->win, VRoot.win, ewin->client.x, ewin->client.y); + } m->ewin = NULL; - if (m->win) - EReparentWindow(m->win, VRoot.win, 0, 0); m->stuck = 0; m->shown = 0; @@ -299,9 +301,9 @@ #endif } - GetWinXY(m->items[0]->win, &x, &y); - GetWinWH(m->items[0]->win, &w, &h); - GetWinWH(m->win, &mw, &mh); + EGetGeometry(m->items[0]->win, NULL, &x, &y, &w, &h, NULL, NULL); + mw = m->w; + mh = m->h; wx = 0; wy = 0; @@ -629,7 +631,8 @@ ewin = FindEwinByMenu(m); if (ewin) { - GetWinWH(m->win, &w, &h); + w = m->w; + h = m->h; ewin->client.height.min = h; ewin->client.height.max = h; ewin->client.width.min = w; @@ -806,7 +809,8 @@ { iw = 0; ih = 0; - GetWinWH(m->items[i]->icon_win, &iw, &ih); + EGetGeometry(m->items[i]->icon_win, NULL, NULL, NULL, &iw, &ih, + NULL, NULL); ImageclassApply(m->items[i]->icon_iclass, m->items[i]->icon_win, iw, ih, 0, 0, STATE_NORMAL, 0, ST_MENU_ITEM); } @@ -875,7 +879,8 @@ if (!m->style->use_item_bg) { - GetWinWH(m->win, &w, &h); + w = m->w; + h = m->h; FreePmapMask(&m->pmm); ImageclassApplyCopy(m->style->bg_iclass, m->win, w, h, 0, 0, STATE_NORMAL, &m->pmm, 1, ST_MENU); @@ -911,8 +916,7 @@ int item_type; ImageClass *ic; - GetWinWH(mi->win, &w, &h); - GetWinXY(mi->win, &x, &y); + EGetGeometry(mi->win, NULL, &x, &y, &w, &h, NULL, NULL); mi_pmm->type = 0; mi_pmm->pmap = ECreatePixmap(mi->win, w, h, VRoot.depth); @@ -1151,6 +1155,9 @@ { int i; + while (RemoveTimerEvent("SUBMENU_SHOW")) + ; + for (i = 0; i < Mode_menus.current_depth; i++) { if (!Mode_menus.list[i]->stuck) @@ -1340,8 +1347,7 @@ ewin = FindEwinByMenu(m); if (ewin) { - GetWinXY(mi->win, &mx, &my); - GetWinWH(mi->win, &mw, &mh); + EGetGeometry(mi->win, NULL, &mx, &my, &mw, &mh, NULL, NULL); #if 1 /* Whatgoesonhere ??? */ MenuShow(mi->child, 1); ewin2 = FindEwinByMenu(mi->child); @@ -1565,7 +1571,6 @@ { Menu *m; MenuItem *mi; - EWin *ewin; }; static void @@ -1589,10 +1594,11 @@ } static void -SubmenuShowTimeout(int val, void *dat) +SubmenuShowTimeout(int val __UNUSED__, void *dat) { int mx, my; unsigned int mw, mh; + Menu *m; MenuItem *mi; EWin *ewin2, *ewin; struct _mdata *data; @@ -1602,76 +1608,78 @@ return; if (!data->m) return; - if (!FindEwinByMenu(data->m)) + + m = data->m; + ewin = FindItem(NULL, m->win, LIST_FINDBY_ID, LIST_TYPE_EWIN); + if (!ewin) return; + if (!ewin->shown) + return; mi = data->mi; - GetWinXY(mi->win, &mx, &my); - GetWinWH(mi->win, &mw, &mh); MenuShow(mi->child, 1); - ewin2 = FindEwinByMenu(mi->child); - if (ewin2) - { - ewin = data->ewin; - MoveEwin(ewin2, - EoGetX(ewin) + ewin->border->border.left + mx + mw, - EoGetY(ewin) + ewin->border->border.top + my - - ewin2->border->border.top); - RaiseEwin(ewin2); - ShowEwin(ewin2); + ewin2 = FindItem(NULL, mi->child->win, LIST_FINDBY_ID, LIST_TYPE_EWIN); + if (!ewin2) + return; - if (Conf.menus.slide) - EwinUnShade(ewin2); + EGetGeometry(mi->win, NULL, &mx, &my, &mw, &mh, NULL, NULL); + MoveEwin(ewin2, + EoGetX(ewin) + ewin->border->border.left + mx + mw, + EoGetY(ewin) + ewin->border->border.top + my - + ewin2->border->border.top); + RaiseEwin(ewin2); + ShowEwin(ewin2); + + if (Conf.menus.slide) + EwinUnShade(ewin2); - if (Mode_menus.list[Mode_menus.current_depth - 1] != mi->child) - Mode_menus.list[Mode_menus.current_depth++] = mi->child; + if (Mode_menus.list[Mode_menus.current_depth - 1] != mi->child) + Mode_menus.list[Mode_menus.current_depth++] = mi->child; - if (Conf.menus.onscreen) + if (Conf.menus.onscreen) + { + EWin *menus[256]; + int fx[256]; + int fy[256]; + int tx[256]; + int ty[256]; + int i; + int xdist = 0, ydist = 0; + + if (EoGetX(ewin2) + EoGetW(ewin2) > VRoot.w) + xdist = VRoot.w - (EoGetX(ewin2) + EoGetW(ewin2)); + if (EoGetY(ewin2) + EoGetH(ewin2) > VRoot.h) + ydist = VRoot.h - (EoGetY(ewin2) + EoGetH(ewin2)); + if ((xdist != 0) || (ydist != 0)) { - EWin *menus[256]; - int fx[256]; - int fy[256]; - int tx[256]; - int ty[256]; - int i; - int xdist = 0, ydist = 0; - - if (EoGetX(ewin2) + EoGetW(ewin2) > VRoot.w) - xdist = VRoot.w - (EoGetX(ewin2) + EoGetW(ewin2)); - if (EoGetY(ewin2) + EoGetH(ewin2) > VRoot.h) - ydist = VRoot.h - (EoGetY(ewin2) + EoGetH(ewin2)); - if ((xdist != 0) || (ydist != 0)) + for (i = 0; i < Mode_menus.current_depth; i++) { - for (i = 0; i < Mode_menus.current_depth; i++) + menus[i] = NULL; + if (Mode_menus.list[i]) { - menus[i] = NULL; - if (Mode_menus.list[i]) + ewin = FindEwinByMenu(Mode_menus.list[i]); + if (ewin) { - ewin = FindEwinByMenu(Mode_menus.list[i]); - if (ewin) - { - menus[i] = ewin; - fx[i] = EoGetX(ewin); - fy[i] = EoGetY(ewin); - tx[i] = EoGetX(ewin) + xdist; - ty[i] = EoGetY(ewin) + ydist; - } + menus[i] = ewin; + fx[i] = EoGetX(ewin); + fy[i] = EoGetY(ewin); + tx[i] = EoGetX(ewin) + xdist; + ty[i] = EoGetY(ewin) + ydist; } } - - /* Disable menu item events while sliding */ - MenusSetEvents(0); - SlideEwinsTo(menus, fx, fy, tx, ty, Mode_menus.current_depth, - Conf.shadespeed); - MenusSetEvents(1); - - if (Conf.menus.warp) - XWarpPointer(disp, None, mi->win, 0, 0, 0, 0, - mi->text_w / 2, mi->text_h / 2); } + + /* Disable menu item events while sliding */ + MenusSetEvents(0); + SlideEwinsTo(menus, fx, fy, tx, ty, Mode_menus.current_depth, + Conf.shadespeed); + MenusSetEvents(1); + + if (Conf.menus.warp) + XWarpPointer(disp, None, mi->win, 0, 0, 0, 0, + mi->text_w / 2, mi->text_h / 2); } } - val = 0; } static void @@ -1722,7 +1730,6 @@ { mdata.m = m; mdata.mi = mi; - mdata.ewin = ewin; DoIn("SUBMENU_SHOW", 0.2, SubmenuShowTimeout, 0, &mdata); } } =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/pager.c,v retrieving revision 1.120 retrieving revision 1.121 diff -u -3 -r1.120 -r1.121 --- pager.c 3 Mar 2005 19:16:24 -0000 1.120 +++ pager.c 6 Mar 2005 21:29:45 -0000 1.121 @@ -1506,7 +1506,7 @@ if (dx || dy) { /* Move mini window */ - GetWinXY(p->hi_win, &x, &y); + EGetGeometry(p->hi_win, NULL, &x, &y, NULL, NULL, NULL, NULL); x += dx; y += dy; ERaiseWindow(p->hi_win); =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/timers.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -3 -r1.17 -r1.18 --- timers.c 25 Jan 2005 21:58:12 -0000 1.17 +++ timers.c 6 Mar 2005 21:29:46 -0000 1.18 @@ -136,7 +136,7 @@ Efree(qe); } -void +int RemoveTimerEvent(const char *name) { Qentry *qe, *ptr, *pptr; @@ -164,10 +164,12 @@ if (qe) Efree(qe); /* done */ - return; + return 1; } pptr = ptr; ptr = ptr->next; /* keep going through the queue */ } + + return 0; } =================================================================== RCS file: /cvsroot/enlightenment/e16/e/src/x.c,v retrieving revision 1.80 retrieving revision 1.81 diff -u -3 -r1.80 -r1.81 --- x.c 2 Mar 2005 19:20:27 -0000 1.80 +++ x.c 6 Mar 2005 21:29:46 -0000 1.81 @@ -774,7 +774,28 @@ } else { - ok = XGetGeometry(disp, win, root_return, x, y, w, h, bw, depth); + Window rr; + int xx, yy; + unsigned int ww, hh, bb, dd; + + ok = XGetGeometry(disp, win, &rr, &xx, &yy, &ww, &hh, &bb, &dd); + if (ok) + { + if (root_return) + *root_return = rr; + if (x) + *x = xx; + if (y) + *y = yy; + if (w) + *w = ww; + if (h) + *h = hh; + if (bw) + *bw = bb; + if (depth) + *depth = dd; + } } #if 0 /* Debug */ if (!ok) @@ -923,7 +944,7 @@ int i, w, h; int rect_num, rect_ord; - GetWinWH(win, &w, &h); + EGetGeometry(win, NULL, NULL, NULL, &w, &h, NULL, NULL); mask = ECreatePixmap(win, w, h, 1); gc = XCreateGC(disp, mask, 0, NULL); @@ -968,15 +989,6 @@ } #endif -void -GetWinXY(Window win, int *x, int *y) -{ - Window w1; - unsigned int w, h, b, d; - - EGetGeometry(win, &w1, x, y, &w, &h, &b, &d); -} - Window GetWinParent(Window win) { @@ -989,16 +1001,6 @@ return 0; } -void -GetWinWH(Window win, unsigned int *w, unsigned int *h) -{ - Window w1; - int x, y; - unsigned int b, d; - - EGetGeometry(win, &w1, &x, &y, w, h, &b, &d); -} - int GetWinDepth(Window win) { @@ -1196,7 +1198,7 @@ int w, h; w = h = 0; - GetWinWH(draw, &w, &h); + EGetGeometry(draw, NULL, NULL, NULL, &w, &h, NULL, NULL); if (w <= 0 || h <= 0) return; imlib_context_set_drawable(draw); ------------------------------------------------------- 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