Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
Tag: branch-exp
E.h edge.c events.c evhandlers.c iconify.c menus.c pager.c x.c
Log Message:
Begin using the new event dispatcher.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.314
retrieving revision 1.314.2.1
diff -u -3 -r1.314 -r1.314.2.1
--- E.h 26 Jul 2004 18:54:48 -0000 1.314
+++ E.h 26 Jul 2004 21:24:30 -0000 1.314.2.1
@@ -1324,6 +1324,7 @@
struct _menuitem
{
+ Menu *menu;
ImageClass *icon_iclass;
char *text;
short act_id;
@@ -2101,7 +2102,6 @@
Dialog *FindDialogButton(Window win, int *bnum);
Dialog *FindDialog(Window win);
int FindADialog(void);
-Pager *FindPager(Window win);
DItem *FindDialogItem(Window win, Dialog ** dret);
/* focus.c */
@@ -2648,7 +2648,6 @@
void RemoveWindowMatch(WindowMatch * wm);
/* x.c */
-#if INCLUDE_NEW_EVENT_DISPATCHER
typedef void (EventCallbackFunc) (XEvent * ev, void *prm);
void EventCallbackRegister(Window win, int type,
EventCallbackFunc * func, void *prm);
@@ -2656,7 +2655,7 @@
EventCallbackFunc * func,
void *prm);
void EventCallbacksProcess(XEvent * ev);
-#endif /* INCLUDE_NEW_EVENT_DISPATCHER */
+
Pixmap ECreatePixmap(Display * display, Drawable d,
unsigned int width, unsigned int height,
unsigned depth);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/edge.c,v
retrieving revision 1.7
retrieving revision 1.7.2.1
diff -u -3 -r1.7 -r1.7.2.1
--- edge.c 29 Jun 2004 13:19:23 -0000 1.7
+++ edge.c 26 Jul 2004 21:24:30 -0000 1.7.2.1
@@ -94,6 +94,45 @@
data = NULL;
}
+static void
+EdgeHandleEvents(XEvent * ev, void *prm)
+{
+ static int lastdir = -1;
+ int dir;
+
+ dir = (int)prm;
+ if (dir < 0 || dir > 3) /* Should not be possible */
+ return;
+
+ switch (ev->type)
+ {
+ case EnterNotify:
+ DoIn("EDGE_TIMEOUT", ((double)Conf.edge_flip_resistance) / 100.0,
+ EdgeTimeout, dir, NULL);
+ break;
+
+ case LeaveNotify:
+ RemoveTimerEvent("EDGE_TIMEOUT");
+ break;
+
+ case MotionNotify:
+ if (Mode.mode != MODE_MOVE_PENDING && Mode.mode != MODE_MOVE)
+ break;
+
+ if ((lastdir != dir) && (Conf.edge_flip_resistance))
+ {
+ if (dir < 0)
+ RemoveTimerEvent("EDGE_TIMEOUT");
+ else
+ DoIn("EDGE_TIMEOUT",
+ ((double)Conf.edge_flip_resistance) / 100.0, EdgeTimeout,
+ dir, NULL);
+ lastdir = dir;
+ }
+ break;
+ }
+}
+
void
EdgeWindowsShow(void)
{
@@ -123,6 +162,10 @@
XSelectInput(disp, w4,
EnterWindowMask | LeaveWindowMask | PointerMotionMask |
ButtonPressMask | ButtonReleaseMask);
+ EventCallbackRegister(w1, 0, EdgeHandleEvents, (void *)0);
+ EventCallbackRegister(w2, 0, EdgeHandleEvents, (void *)1);
+ EventCallbackRegister(w3, 0, EdgeHandleEvents, (void *)2);
+ EventCallbackRegister(w4, 0, EdgeHandleEvents, (void *)3);
}
GetCurrentArea(&cx, &cy);
GetAreaSize(&ax, &ay);
@@ -156,72 +199,3 @@
EUnmapWindow(disp, w4);
}
}
-
-static int
-IsEdgeWin(Window win)
-{
- if (!w1)
- return -1;
- if (win == w1)
- return 0;
- else if (win == w2)
- return 1;
- else if (win == w3)
- return 2;
- else if (win == w4)
- return 3;
- return -1;
-}
-
-void
-EdgeHandleEnter(XEvent * ev)
-{
- int dir;
-
- dir = IsEdgeWin(ev->xcrossing.window);
- if (dir < 0)
- return;
- DoIn("EDGE_TIMEOUT", ((double)Conf.edge_flip_resistance) / 100.0,
- EdgeTimeout, dir, NULL);
-}
-
-void
-EdgeHandleLeave(XEvent * ev)
-{
- int dir;
-
- dir = IsEdgeWin(ev->xcrossing.window);
- if (dir < 0)
- return;
- RemoveTimerEvent("EDGE_TIMEOUT");
-}
-
-void
-EdgeHandleMotion(XEvent * ev)
-{
- static int lastdir = -1;
- int dir;
-
- if (Mode.mode != MODE_MOVE_PENDING && Mode.mode != MODE_MOVE)
- return;
-
- dir = -1;
- if (ev->xmotion.x_root == 0)
- dir = 0;
- else if (ev->xmotion.x_root == (VRoot.w - 1))
- dir = 1;
- else if (ev->xmotion.y_root == 0)
- dir = 2;
- else if (ev->xmotion.y_root == (VRoot.h - 1))
- dir = 3;
-
- if ((lastdir != dir) && (Conf.edge_flip_resistance))
- {
- if (dir < 0)
- RemoveTimerEvent("EDGE_TIMEOUT");
- else
- DoIn("EDGE_TIMEOUT", ((double)Conf.edge_flip_resistance) / 100.0,
- EdgeTimeout, dir, NULL);
- lastdir = dir;
- }
-}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/events.c,v
retrieving revision 1.69
retrieving revision 1.69.2.1
diff -u -3 -r1.69 -r1.69.2.1
--- events.c 15 Jul 2004 23:31:01 -0000 1.69
+++ events.c 26 Jul 2004 21:24:30 -0000 1.69.2.1
@@ -230,8 +230,20 @@
break;
}
- /* Should not be "global" */
- IconboxesHandleEvent(ev);
+ /* The new event dispatcher */
+ EventCallbacksProcess(ev);
+
+ /* Post-event stuff TBD */
+ switch (ev->type)
+ {
+ case ButtonRelease: /* 5 */
+ /* This shouldn't be here */
+ if ((Mode.cur_menu_mode) && (!Mode.justclicked))
+ MenusHide();
+ Mode.justclicked = 0;
+ Mode.last_bpress = 0;
+ break;
+ }
EDBUG_RETURN_;
}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/evhandlers.c,v
retrieving revision 1.173
retrieving revision 1.173.2.1
diff -u -3 -r1.173 -r1.173.2.1
--- evhandlers.c 15 Jul 2004 23:31:01 -0000 1.173
+++ evhandlers.c 26 Jul 2004 21:24:30 -0000 1.173.2.1
@@ -120,9 +120,6 @@
if (DialogEventKeyPress(ev))
goto done;
- if (MenusEventKeyPress(ev))
- goto done;
-
done:
EDBUG_RETURN_;
}
@@ -213,9 +210,6 @@
EDBUG_RETURN_;
}
- if (MenusEventMouseDown(ev))
- goto done;
-
FocusHandleClick(win);
if (double_click)
@@ -247,9 +241,6 @@
}
}
- if (PagersEventMouseDown(ev))
- goto done;
-
done:
EDBUG_RETURN_;
}
@@ -316,9 +307,6 @@
if (Mode.action_inhibit)
goto done;
- if (MenusEventMouseUp(ev))
- goto done;
-
if (ButtonsEventMouseUp(ev))
goto done;
@@ -341,16 +329,11 @@
}
}
- if (PagersEventMouseUp(ev))
- goto done;
-
done:
if ((Mode.slideout) && (pslideout))
SlideoutHide(Mode.slideout);
Mode.action_inhibit = 0;
- Mode.justclicked = 0;
- Mode.last_bpress = 0;
EDBUG_RETURN_;
}
@@ -361,7 +344,6 @@
EDBUG(5, "HandleMotion");
TooltipsHandleEvent();
- EdgeHandleMotion(ev);
Mode.px = Mode.x;
Mode.py = Mode.y;
@@ -537,8 +519,6 @@
}
}
- PagersEventMotion(ev);
-
DialogEventMotion(ev);
EDBUG_RETURN_;
@@ -560,13 +540,6 @@
Mode.context_win = win;
TooltipsHandleEvent();
- EdgeHandleEnter(ev);
-
- if (PagersEventMouseIn(ev))
- goto done;
-
- if (MenusEventMouseIn(ev))
- goto done;
if ( /*!clickmenu && */ BordersEventMouseIn(ev))
goto done;
@@ -594,16 +567,9 @@
EDBUG_RETURN_;
TooltipsHandleEvent();
- EdgeHandleLeave(ev);
Mode.context_win = win;
- if (PagersEventMouseOut(ev))
- goto done;
-
- if (MenusEventMouseOut(ev))
- goto done;
-
if ( /*!clickmenu && */ BordersEventMouseOut(ev))
goto done;
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/iconify.c,v
retrieving revision 1.116
retrieving revision 1.116.2.1
diff -u -3 -r1.116 -r1.116.2.1
--- iconify.c 17 Jul 2004 08:55:34 -0000 1.116
+++ iconify.c 26 Jul 2004 21:24:30 -0000 1.116.2.1
@@ -28,6 +28,12 @@
#define y1 y1_
static void IconboxRedraw(Iconbox * ib);
+static void IboxEventScrollWin(XEvent * ev, void *prm);
+static void IboxEventScrollbarWin(XEvent * ev, void *prm);
+static void IboxEventCoverWin(XEvent * ev, void *prm);
+static void IboxEventArrow1Win(XEvent * ev, void *prm);
+static void IboxEventArrow2Win(XEvent * ev, void *prm);
+static void IboxEventIconWin(XEvent * ev, void *prm);
#define IB_ANIM_TIME 0.25
@@ -423,11 +429,17 @@
ib->scrollbox_clicked = 0;
ib->win = ECreateWindow(VRoot.win, 0, 0, 128, 32, 0);
ib->icon_win = ECreateWindow(ib->win, 0, 0, 128, 26, 0);
+ EventCallbackRegister(ib->icon_win, 0, IboxEventIconWin, ib);
ib->cover_win = ECreateWindow(ib->win, 0, 0, 128, 26, 0);
+ EventCallbackRegister(ib->cover_win, 0, IboxEventCoverWin, ib);
ib->scroll_win = ECreateWindow(ib->win, 6, 26, 116, 6, 0);
+ EventCallbackRegister(ib->scroll_win, 0, IboxEventScrollWin, ib);
ib->arrow1_win = ECreateWindow(ib->win, 0, 26, 6, 6, 0);
+ EventCallbackRegister(ib->arrow1_win, 0, IboxEventArrow1Win, ib);
ib->arrow2_win = ECreateWindow(ib->win, 122, 26, 6, 6, 0);
+ EventCallbackRegister(ib->arrow2_win, 0, IboxEventArrow2Win, ib);
ib->scrollbar_win = ECreateWindow(ib->scroll_win, 122, 26, 6, 6, 0);
+ EventCallbackRegister(ib->scrollbar_win, 0, IboxEventScrollbarWin, ib);
ib->scrollbarknob_win = ECreateWindow(ib->scrollbar_win, -20, -20, 4, 4, 0);
ib->pmap = ECreatePixmap(disp, ib->icon_win, 128, 32, VRoot.depth);
XSelectInput(disp, ib->icon_win,
@@ -2295,253 +2307,305 @@
}
}
-void
-IconboxesHandleEvent(XEvent * ev)
+static void
+IboxEventScrollWin(XEvent * ev, void *prm)
{
- Iconbox **ib;
- int i, num;
+ Iconbox *ib = (Iconbox *) prm;
+ int x, y, w, h;
- if (Mode.mode != MODE_NONE)
- return;
+ switch (ev->type)
+ {
+ case ButtonPress:
+ if (ev->xbutton.button == 1)
+ ib->scrollbox_clicked = 1;
+ else if (ev->xbutton.button == 3)
+ IB_ShowMenu(ib, ev->xbutton.x, ev->xbutton.y);
+ break;
+ case ButtonRelease:
+ if (!ib->scrollbox_clicked)
+ break;
+
+ ib->scrollbox_clicked = 0;
+ GetWinXY(ib->scrollbar_win, &x, &y);
+ GetWinWH(ib->scrollbar_win, (unsigned int *)&w, (unsigned int *)&h);
+ if (ev->xbutton.x < x)
+ IB_Scroll(ib, -8);
+ if (ev->xbutton.x > (x + w))
+ IB_Scroll(ib, 8);
+ break;
+ }
+}
- ib = ListAllIconboxes(&num);
- if (!ib)
- return;
+static void
+IboxEventScrollbarWin(XEvent * ev, void *prm)
+{
+ Iconbox *ib = (Iconbox *) prm;
+ static int px, py;
+ int dx, dy, bs, x, y;
+ ImageClass *ic;
- for (i = 0; i < num; i++)
+ switch (ev->type)
{
- if (ev->xany.window == ib[i]->scroll_win)
+ case ButtonPress:
+ if (ev->xbutton.button == 1)
{
- if (ev->type == ButtonPress)
- {
- if (ev->xbutton.button == 1)
- ib[i]->scrollbox_clicked = 1;
- else if (ev->xbutton.button == 3)
- IB_ShowMenu(ib[i], ev->xbutton.x, ev->xbutton.y);
- }
- else if ((ev->type == ButtonRelease) && (ib[i]->scrollbox_clicked))
- {
- int x, y, w, h;
-
- ib[i]->scrollbox_clicked = 0;
- GetWinXY(ib[i]->scrollbar_win, &x, &y);
- GetWinWH(ib[i]->scrollbar_win, (unsigned int *)&w,
- (unsigned int *)&h);
- if (ev->xbutton.x < x)
- IB_Scroll(ib[i], -8);
- if (ev->xbutton.x > (x + w))
- IB_Scroll(ib[i], 8);
- }
+ px = ev->xbutton.x_root;
+ py = ev->xbutton.y_root;
+ ib->scrollbar_clicked = 1;
}
- if (ev->xany.window == ib[i]->scrollbar_win)
- {
- static int px, py;
+ else if (ev->xbutton.button == 3)
+ IB_ShowMenu(ib, ev->xbutton.x, ev->xbutton.y);
+ break;
- if (ev->type == ButtonPress)
- {
- if (ev->xbutton.button == 1)
- {
- px = ev->xbutton.x_root;
- py = ev->xbutton.y_root;
- ib[i]->scrollbar_clicked = 1;
- }
- else if (ev->xbutton.button == 3)
- IB_ShowMenu(ib[i], ev->xbutton.x, ev->xbutton.y);
- }
- else if ((ev->type == ButtonRelease) && (ib[i]->scrollbar_clicked))
- ib[i]->scrollbar_clicked = 0;
- else if (ev->type == EnterNotify)
- ib[i]->scrollbar_hilited = 1;
- else if (ev->type == LeaveNotify)
- ib[i]->scrollbar_hilited = 0;
- else if ((ev->type == MotionNotify) && (ib[i]->scrollbar_clicked))
- {
- int dx, dy, bs, x, y;
- ImageClass *ic;
-
- dx = ev->xmotion.x_root - px;
- dy = ev->xmotion.y_root - py;
- px = ev->xmotion.x_root;
- py = ev->xmotion.y_root;
+ case ButtonRelease:
+ if (ib->scrollbar_clicked)
+ ib->scrollbar_clicked = 0;
+ break;
- if (ib[i]->orientation)
- {
- ic = FindItem("ICONBOX_SCROLLBAR_BASE_VERTICAL", 0,
- LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
- GetWinXY(ib[i]->scrollbar_win, &x, &y);
- bs = ib[i]->h - (ib[i]->arrow_thickness * 2);
- if (ic)
- {
- bs -= (ic->padding.top + ic->padding.bottom);
- y -= ic->padding.top;
- }
- if (bs < 1)
- bs = 1;
- ib[i]->pos = ((y + dy + 1) * ib[i]->max) / bs;
- IB_FixPos(ib[i]);
- IconboxRedraw(ib[i]);
- }
- else
- {
- ic = FindItem("ICONBOX_SCROLLBAR_BASE_HORIZONTAL", 0,
- LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
- GetWinXY(ib[i]->scrollbar_win, &x, &y);
- bs = ib[i]->w - (ib[i]->arrow_thickness * 2);
- if (ic)
- {
- bs -= (ic->padding.left + ic->padding.right);
- x -= ic->padding.left;
- }
- if (bs < 1)
- bs = 1;
- ib[i]->pos = ((x + dx + 1) * ib[i]->max) / bs;
- IB_FixPos(ib[i]);
- IconboxRedraw(ib[i]);
- }
- }
- IB_DrawScroll(ib[i]);
- }
- else if (ev->xany.window == ib[i]->cover_win)
- {
- if (ev->type == ButtonPress)
- IB_ShowMenu(ib[i], ev->xbutton.x, ev->xbutton.y);
- }
- else if (ev->xany.window == ib[i]->arrow1_win)
+ case EnterNotify:
+ ib->scrollbar_hilited = 1;
+ break;
+
+ case LeaveNotify:
+ ib->scrollbar_hilited = 0;
+ break;
+
+ case MotionNotify:
+ if (!ib->scrollbar_clicked)
+ break;
+
+ dx = ev->xmotion.x_root - px;
+ dy = ev->xmotion.y_root - py;
+ px = ev->xmotion.x_root;
+ py = ev->xmotion.y_root;
+
+ if (ib->orientation)
{
- if (ev->type == ButtonPress)
- {
- if (ev->xbutton.button == 1)
- ib[i]->arrow1_clicked = 1;
- else if (ev->xbutton.button == 3)
- IB_ShowMenu(ib[i], ev->xbutton.x, ev->xbutton.y);
- }
- else if ((ev->type == ButtonRelease) && (ib[i]->arrow1_clicked))
+ ic = FindItem("ICONBOX_SCROLLBAR_BASE_VERTICAL", 0,
+ LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
+ GetWinXY(ib->scrollbar_win, &x, &y);
+ bs = ib->h - (ib->arrow_thickness * 2);
+ if (ic)
{
- ib[i]->arrow1_clicked = 0;
- IB_Scroll(ib[i], -8);
+ bs -= (ic->padding.top + ic->padding.bottom);
+ y -= ic->padding.top;
}
- else if (ev->type == EnterNotify)
- ib[i]->arrow1_hilited = 1;
- else if (ev->type == LeaveNotify)
- ib[i]->arrow1_hilited = 0;
- IB_DrawScroll(ib[i]);
+ if (bs < 1)
+ bs = 1;
+ ib->pos = ((y + dy + 1) * ib->max) / bs;
+ IB_FixPos(ib);
+ IconboxRedraw(ib);
}
- else if (ev->xany.window == ib[i]->arrow2_win)
+ else
{
- if (ev->type == ButtonPress)
- {
- if (ev->xbutton.button == 1)
- ib[i]->arrow2_clicked = 1;
- else if (ev->xbutton.button == 3)
- IB_ShowMenu(ib[i], ev->xbutton.x, ev->xbutton.y);
- }
- else if ((ev->type == ButtonRelease) && (ib[i]->arrow2_clicked))
+ ic = FindItem("ICONBOX_SCROLLBAR_BASE_HORIZONTAL", 0,
+ LIST_FINDBY_NAME, LIST_TYPE_ICLASS);
+ GetWinXY(ib->scrollbar_win, &x, &y);
+ bs = ib->w - (ib->arrow_thickness * 2);
+ if (ic)
{
- ib[i]->arrow2_clicked = 0;
- IB_Scroll(ib[i], 8);
+ bs -= (ic->padding.left + ic->padding.right);
+ x -= ic->padding.left;
}
- else if (ev->type == EnterNotify)
- ib[i]->arrow2_hilited = 1;
- else if (ev->type == LeaveNotify)
- ib[i]->arrow2_hilited = 0;
- IB_DrawScroll(ib[i]);
+ if (bs < 1)
+ bs = 1;
+ ib->pos = ((x + dx + 1) * ib->max) / bs;
+ IB_FixPos(ib);
+ IconboxRedraw(ib);
}
- else if (ev->xany.window == ib[i]->icon_win)
- {
- static EWin *name_ewin = NULL;
+ }
+ IB_DrawScroll(ib);
+}
- if ((ev->type == MotionNotify) || (ev->type == EnterNotify))
- {
- EWin *ewin = NULL;
- ToolTip *tt = NULL;
+static void
+IboxEventCoverWin(XEvent * ev, void *prm)
+{
+ Iconbox *ib = (Iconbox *) prm;
- if (ev->type == MotionNotify)
- {
- ewin = IB_FindIcon(ib[i], ev->xmotion.x, ev->xmotion.y);
- Mode.x = ev->xmotion.x_root;
- Mode.y = ev->xmotion.y_root;
- }
- else
- {
- ewin =
- IB_FindIcon(ib[i], ev->xcrossing.x, ev->xcrossing.y);
- Mode.x = ev->xcrossing.x_root;
- Mode.y = ev->xcrossing.y_root;
- }
+ switch (ev->type)
+ {
+ case ButtonPress:
+ IB_ShowMenu(ib, ev->xbutton.x, ev->xbutton.y);
+ break;
+ case ButtonRelease:
+ break;
+ }
+}
- if (ib[i]->shownames && ewin != name_ewin)
- {
- tt = FindItem("ICONBOX", 0, LIST_FINDBY_NAME,
- LIST_TYPE_TOOLTIP);
- if (tt)
- {
- const char *name;
+static void
+IboxEventArrow1Win(XEvent * ev, void *prm)
+{
+ Iconbox *ib = (Iconbox *) prm;
- HideToolTip(tt);
- if (ewin)
- {
-
- name = EwinGetIconName(ewin);
- if (name)
- ShowToolTip(tt, name, NULL, Mode.x, Mode.y);
- }
- }
- name_ewin = ewin;
- }
- }
- else if (ev->type == LeaveNotify)
- {
- ToolTip *tt = NULL;
+ switch (ev->type)
+ {
+ case ButtonPress:
+ if (ev->xbutton.button == 1)
+ ib->arrow1_clicked = 1;
+ else if (ev->xbutton.button == 3)
+ IB_ShowMenu(ib, ev->xbutton.x, ev->xbutton.y);
+ break;
+
+ case ButtonRelease:
+ if (!ib->arrow1_clicked)
+ break;
+ ib->arrow1_clicked = 0;
+ IB_Scroll(ib, -8);
+ break;
+
+ case EnterNotify:
+ ib->arrow1_hilited = 1;
+ break;
+
+ case LeaveNotify:
+ ib->arrow1_hilited = 0;
+ break;
+ }
+ IB_DrawScroll(ib);
+}
+
+static void
+IboxEventArrow2Win(XEvent * ev, void *prm)
+{
+ Iconbox *ib = (Iconbox *) prm;
+
+ switch (ev->type)
+ {
+ case ButtonPress:
+ if (ev->xbutton.button == 1)
+ ib->arrow2_clicked = 1;
+ else if (ev->xbutton.button == 3)
+ IB_ShowMenu(ib, ev->xbutton.x, ev->xbutton.y);
+ break;
+
+ case ButtonRelease:
+ if (!ib->arrow2_clicked)
+ break;
+ ib->arrow2_clicked = 0;
+ IB_Scroll(ib, -8);
+ break;
+
+ case EnterNotify:
+ ib->arrow2_hilited = 1;
+ break;
+
+ case LeaveNotify:
+ ib->arrow2_hilited = 0;
+ break;
+ }
+ IB_DrawScroll(ib);
+}
+
+static void
+IboxEventIconWin(XEvent * ev, void *prm)
+{
+ Iconbox *ib = (Iconbox *) prm;
+ static EWin *name_ewin = NULL;
+ ToolTip *tt;
+ EWin *ewin;
+ EWin **gwins;
+ int j, numg;
+ char iconified;
+
+ switch (ev->type)
+ {
+ case ButtonPress:
+ if (ev->xbutton.button == 1)
+ ib->icon_clicked = 1;
+ else if (ev->xbutton.button == 3)
+ IB_ShowMenu(ib, ev->xbutton.x, ev->xbutton.y);
+ break;
+
+ case ButtonRelease:
+ if (!ib->icon_clicked)
+ break;
+
+ ib->icon_clicked = 0;
+ ewin = IB_FindIcon(ib, ev->xbutton.x, ev->xbutton.y);
+ if (ewin)
+ {
+ tt = FindItem("ICONBOX", 0, LIST_FINDBY_NAME, LIST_TYPE_TOOLTIP);
+ if (tt)
+ HideToolTip(tt);
+ gwins =
+ ListWinGroupMembersForEwin(ewin, ACTION_ICONIFY,
+ Mode.nogroup, &numg);
+ iconified = ewin->iconified;
- tt = FindItem("ICONBOX", 0, LIST_FINDBY_NAME,
- LIST_TYPE_TOOLTIP);
- if (tt)
+ if (gwins)
+ {
+ for (j = 0; j < numg; j++)
{
- HideToolTip(tt);
- name_ewin = NULL;
+ if ((gwins[j]->iconified) && (iconified))
+ DeIconifyEwin(gwins[j]);
}
+ Efree(gwins);
}
- else if (ev->type == ButtonPress)
+ }
+ break;
+
+ case MotionNotify:
+ case EnterNotify:
+ if (ev->type == MotionNotify)
+ {
+ ewin = IB_FindIcon(ib, ev->xmotion.x, ev->xmotion.y);
+ Mode.x = ev->xmotion.x_root;
+ Mode.y = ev->xmotion.y_root;
+ }
+ else
+ {
+ ewin = IB_FindIcon(ib, ev->xcrossing.x, ev->xcrossing.y);
+ Mode.x = ev->xcrossing.x_root;
+ Mode.y = ev->xcrossing.y_root;
+ }
+
+ if (ib->shownames && ewin != name_ewin)
+ {
+ tt = FindItem("ICONBOX", 0, LIST_FINDBY_NAME, LIST_TYPE_TOOLTIP);
+ if (tt)
{
- if (ev->xbutton.button == 1)
- ib[i]->icon_clicked = 1;
- else if (ev->xbutton.button == 3)
- IB_ShowMenu(ib[i], ev->xbutton.x, ev->xbutton.y);
- }
- else if ((ev->type == ButtonRelease) && (ib[i]->icon_clicked))
- {
- EWin *ewin;
- EWin **gwins;
- int j, numg;
- char iconified;
+ const char *name;
- ib[i]->icon_clicked = 0;
- ewin = IB_FindIcon(ib[i], ev->xbutton.x, ev->xbutton.y);
+ HideToolTip(tt);
if (ewin)
{
- ToolTip *tt = NULL;
-
- tt = FindItem("ICONBOX", 0, LIST_FINDBY_NAME,
- LIST_TYPE_TOOLTIP);
- if (tt)
- HideToolTip(tt);
- gwins =
- ListWinGroupMembersForEwin(ewin, ACTION_ICONIFY,
- Mode.nogroup, &numg);
- iconified = ewin->iconified;
- if (gwins)
- {
- for (j = 0; j < numg; j++)
- {
- if ((gwins[j]->iconified) && (iconified))
- DeIconifyEwin(gwins[j]);
- }
- Efree(gwins);
- }
+ name = EwinGetIconName(ewin);
+ if (name)
+ ShowToolTip(tt, name, NULL, Mode.x, Mode.y);
}
}
+ name_ewin = ewin;
}
+ break;
+
+ case LeaveNotify:
+ tt = FindItem("ICONBOX", 0, LIST_FINDBY_NAME, LIST_TYPE_TOOLTIP);
+ if (tt)
+ {
+ HideToolTip(tt);
+ name_ewin = NULL;
+ }
+ break;
+ }
+}
+
+#if 0
+static void
+IboxEventScrolWin(XEvent * ev, void *prm)
+{
+ MenuItem *mi = (MenuItem *) prm;
+
+ switch (ev->type)
+ {
+ case ButtonPress:
+ break;
+ case ButtonRelease:
+ break;
+ case EnterNotify:
+ break;
+ case LeaveNotify:
+ break;
}
- Efree(ib);
}
+#endif
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/menus.c,v
retrieving revision 1.147
retrieving revision 1.147.2.1
diff -u -3 -r1.147 -r1.147.2.1
--- menus.c 15 Jul 2004 23:31:02 -0000 1.147
+++ menus.c 26 Jul 2004 21:24:30 -0000 1.147.2.1
@@ -38,6 +38,9 @@
static void FillFlatFileMenu(Menu * m, MenuStyle * ms, char *name,
char *file, Menu * parent);
+static void MenuHandleEvents(XEvent * ev, void *m);
+static void MenuItemHandleEvents(XEvent * ev, void *mi);
+
static Menu *active_menu = NULL;
static MenuItem *active_item = NULL;
@@ -58,35 +61,6 @@
rc = XUngrabKeyboard(disp, CurrentTime);
}
-static Menu *
-FindMenuItem(Window win, MenuItem ** mi)
-{
- Menu *menu = NULL;
- Menu **menus;
- int i, j, num;
-
- EDBUG(6, "FindMenuItem");
-
- menus = (Menu **) ListItemType(&num, LIST_TYPE_MENU);
- for (i = 0; i < num; i++)
- {
- for (j = 0; j < menus[i]->num; j++)
- {
- if ((win == menus[i]->items[j]->win) ||
- (win == menus[i]->items[j]->icon_win))
- {
- *mi = menus[i]->items[j];
- menu = menus[i];
- break;
- }
- }
- }
- if (menus)
- Efree(menus);
-
- EDBUG_RETURN(menu);
-}
-
Menu *
FindMenu(Window win)
{
@@ -621,7 +595,10 @@
EDBUG_RETURN_;
if (!m->win)
- m->win = ECreateWindow(VRoot.win, 0, 0, 1, 1, 0);
+ {
+ m->win = ECreateWindow(VRoot.win, 0, 0, 1, 1, 0);
+ EventCallbackRegister(m->win, 0, MenuHandleEvents, m);
+ }
if (m->title)
{
@@ -637,11 +614,15 @@
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, 0, MenuItemHandleEvents,
+ m->items[i]);
+
XChangeWindowAttributes(disp, m->items[i]->win, CWEventMask, &att);
EMapWindow(disp, m->items[i]->win);
if ((m->style) && (m->style->tclass) && (m->items[i]->text))
@@ -2330,19 +2311,13 @@
return FindEwinSpawningMenu(m);
}
-int
-MenusEventKeyPress(XEvent * ev)
+static void
+MenuEventKeyPress(Menu * m, XEvent * ev)
{
- Window win = ev->xkey.window;
KeySym key;
- Menu *m;
MenuItem *mi;
EWin *ewin;
- m = FindMenu(win);
- if (m == NULL)
- return 0;
-
mi = NULL;
if (active_menu)
{
@@ -2400,25 +2375,17 @@
ActionsCall(mi->act_id, NULL, mi->params);
break;
}
-
- return 1;
}
-int
-MenusEventMouseDown(XEvent * ev)
+static void
+MenuItemEventMouseDown(MenuItem * mi, XEvent * ev __UNUSED__)
{
Menu *m;
- MenuItem *mi;
EWin *ewin;
- m = FindMenuItem(ev->xbutton.window, &mi);
- if (m == NULL)
- return 0;
- if (mi == NULL)
- goto done;
-
Mode.cur_menu_mode = 1;
+ m = mi->menu;
mi->state = STATE_CLICKED;
MenuDrawItem(m, mi, 1);
@@ -2460,18 +2427,17 @@
}
}
- done:
- return 1;
+ return;
}
-int
-MenusEventMouseUp(XEvent * ev)
+static void
+MenuItemEventMouseUp(MenuItem * mi, XEvent * ev __UNUSED__)
{
Menu *m;
- MenuItem *mi;
EWin *ewin;
- m = FindMenuItem(ev->xbutton.window, &mi);
+ m = mi->menu;
+
if ((m) && (mi->state))
{
mi->state = STATE_HILITED;
@@ -2481,7 +2447,7 @@
ewin = MenuFindContextEwin(m);
MenusHide();
ActionsCall(mi->act_id, ewin, mi->params);
- return 1;
+ return;
}
}
@@ -2511,16 +2477,14 @@
}
}
MenusHide();
- return 1;
+ return;
}
if ((Mode.cur_menu_mode) && (!Mode.justclicked))
{
MenusHide();
- return 1;
+ return;
}
-
- return 0;
}
struct _mdata
@@ -2689,18 +2653,13 @@
}
}
-int
-MenusEventMouseIn(XEvent * ev)
+static void
+MenuItemEventMouseIn(MenuItem * mi, XEvent * ev)
{
Window win = ev->xcrossing.window;
Menu *m;
- MenuItem *mi;
- m = FindMenuItem(win, &mi);
- if (m == NULL)
- return 0;
- if (mi == NULL)
- goto done;
+ m = mi->menu;
PagerHideAllHi();
@@ -2712,21 +2671,16 @@
MenuActivateItem(m, mi);
done:
- return 1;
+ return;
}
-int
-MenusEventMouseOut(XEvent * ev)
+static void
+MenuItemEventMouseOut(MenuItem * mi, XEvent * ev)
{
Window win = ev->xcrossing.window;
Menu *m;
- MenuItem *mi;
- m = FindMenuItem(win, &mi);
- if (m == NULL)
- return 0;
- if (mi == NULL)
- goto done;
+ m = mi->menu;
if ((win == mi->icon_win) && (ev->xcrossing.detail == NotifyAncestor))
goto done;
@@ -2736,5 +2690,42 @@
MenuActivateItem(m, NULL);
done:
- return 1;
+ return;
+}
+
+static void
+MenuHandleEvents(XEvent * ev, void *prm)
+{
+ Menu *m = (Menu *) prm;
+
+ switch (ev->type)
+ {
+ case KeyPress:
+ MenuEventKeyPress(m, ev);
+ break;
+ case ButtonRelease:
+ break;
+ }
+}
+
+static void
+MenuItemHandleEvents(XEvent * ev, void *prm)
+{
+ MenuItem *mi = (MenuItem *) prm;
+
+ switch (ev->type)
+ {
+ case ButtonPress:
+ MenuItemEventMouseDown(mi, ev);
+ break;
+ case ButtonRelease:
+ MenuItemEventMouseUp(mi, ev);
+ break;
+ case EnterNotify:
+ MenuItemEventMouseIn(mi, ev);
+ break;
+ case LeaveNotify:
+ MenuItemEventMouseOut(mi, ev);
+ break;
+ }
}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/pager.c,v
retrieving revision 1.103
retrieving revision 1.103.2.1
diff -u -3 -r1.103 -r1.103.2.1
--- pager.c 25 Jul 2004 09:34:43 -0000 1.103
+++ pager.c 26 Jul 2004 21:24:30 -0000 1.103.2.1
@@ -50,6 +50,9 @@
static void PagerEwinUpdateMini(Pager * p, EWin * ewin);
static void PagerEwinUpdateFromPager(Pager * p, EWin * ewin);
+static void PagerEventMainWin(XEvent * ev, void *prm);
+static void PagerEventHiWin(XEvent * ev, void *prm);
+
static Pager *mode_context_pager = NULL;
#define HIQ Conf.pagers.hiq
@@ -147,9 +150,11 @@
p->dw = ((48 * VRoot.w) / VRoot.h);
p->dh = 48;
p->win = ECreateWindow(VRoot.win, 0, 0, p->w, p->h, 0);
+ EventCallbackRegister(p->win, 0, PagerEventMainWin, p);
p->pmap = ECreatePixmap(disp, p->win, p->w, p->h, VRoot.depth);
ESetWindowBackgroundPixmap(disp, p->win, p->pmap);
p->hi_win = ECreateWindow(VRoot.win, 0, 0, 3, 3, 0);
+ EventCallbackRegister(p->hi_win, 0, PagerEventHiWin, p);
p->hi_visible = 0;
p->hi_ewin = NULL;
XSelectInput(disp, p->hi_win,
@@ -1529,31 +1534,6 @@
return (p) ? p->hi_win : 0;
}
-Pager *
-FindPager(Window win)
-{
- Pager *p, *pr = NULL;
- Pager **ps;
- int i, num;
-
- EDBUG(6, "FindDialog");
-
- ps = (Pager **) ListItemType(&num, LIST_TYPE_PAGER);
- for (i = 0; i < num; i++)
- {
- p = ps[i];
- if ((p->win == win) || (p->hi_win == win))
- {
- pr = p;
- break;
- }
- }
- if (ps)
- Efree(ps);
-
- EDBUG_RETURN(pr);
-}
-
/*
* Pager event handlers
*/
@@ -1634,16 +1614,14 @@
EwinGroupMove(p->hi_ewin, pd->desktop, x, y);
}
-int
-PagersEventMotion(XEvent * ev)
+static int
+PagerEventMotion(Pager * p, XEvent * ev)
{
int used = 0;
- Pager *p;
switch (Mode.mode)
{
case MODE_NONE:
- p = FindPager(ev->xmotion.window);
if (p == NULL)
break;
used = 1;
@@ -1654,7 +1632,6 @@
case MODE_PAGER_DRAG_PENDING:
case MODE_PAGER_DRAG:
Mode.mode = MODE_PAGER_DRAG;
- p = mode_context_pager;
if (p == NULL)
break;
used = 1;
@@ -1672,18 +1649,13 @@
return used;
}
-int
-PagersEventMouseDown(XEvent * ev)
+static void
+PagerEventMouseDown(Pager * p, XEvent * ev)
{
Window win = ev->xbutton.window, child;
int i, num, px, py, in_pager;
- Pager *p;
EWin *ewin, **gwins;
- p = FindPager(win);
- if (!p)
- return 0;
-
gwins =
ListWinGroupMembersForEwin(p->hi_ewin, ACTION_MOVE, Mode.nogroup, &num);
gwin_px = calloc(num, sizeof(int));
@@ -1743,26 +1715,18 @@
mode_context_pager = p;
}
}
-
- return 1;
}
-int
-PagersEventMouseUp(XEvent * ev)
+static int
+PagerEventMouseUp(Pager * p, XEvent * ev)
{
Window win = ev->xbutton.window, child;
int used = 0;
int i, num, px, py, in_pager, in_vroot;
- Pager *p;
EWin *ewin, **gwins;
int x, y, pax, pay;
int mode_was;
- p = FindPager(win);
- if (!p)
- goto done;
-
- used = 1;
mode_was = Mode.mode;
Mode.mode = MODE_NONE;
@@ -1896,38 +1860,60 @@
return used;
}
-int
-PagersEventMouseIn(XEvent * ev)
+static void
+PagerEventMainWin(XEvent * ev, void *prm)
{
- Pager *p;
- Window win = ev->xcrossing.window;
+ Pager *p = (Pager *) prm;
- p = FindPager(win);
- if (p)
+ switch (ev->type)
{
+ case ButtonPress:
+ PagerEventMouseDown(p, ev);
+ break;
+ case ButtonRelease:
+ PagerEventMouseUp(p, ev);
+ break;
+ case MotionNotify:
+ PagerEventMotion(p, ev);
+ break;
+ case EnterNotify:
#if 0 /* Nothing done here */
- PagerHandleMotion(p, win, ev->xcrossing.x, ev->xcrossing.y,
+ PagerHandleMotion(p, ev->xany.window, ev->xcrossing.x, ev->xcrossing.y,
PAGER_EVENT_MOUSE_IN);
#endif
- return 1;
+ break;
+ case LeaveNotify:
+ PagerHandleMotion(p, ev->xany.window, ev->xcrossing.x, ev->xcrossing.y,
+ PAGER_EVENT_MOUSE_OUT);
+ break;
}
-
- return 0;
}
-int
-PagersEventMouseOut(XEvent * ev)
+static void
+PagerEventHiWin(XEvent * ev, void *prm)
{
- Pager *p;
- Window win = ev->xcrossing.window;
+ Pager *p = (Pager *) prm;
- p = FindPager(win);
- if (p)
+ switch (ev->type)
{
- PagerHandleMotion(p, win, ev->xcrossing.x, ev->xcrossing.y,
+ case ButtonPress:
+ PagerEventMouseDown(p, ev);
+ break;
+ case ButtonRelease:
+ PagerEventMouseUp(p, ev);
+ break;
+ case MotionNotify:
+ PagerEventMotion(p, ev);
+ break;
+ case EnterNotify:
+#if 0 /* Nothing done here */
+ PagerHandleMotion(p, ev->xany.window, ev->xcrossing.x, ev->xcrossing.y,
+ PAGER_EVENT_MOUSE_IN);
+#endif
+ break;
+ case LeaveNotify:
+ PagerHandleMotion(p, ev->xany.window, ev->xcrossing.x, ev->xcrossing.y,
PAGER_EVENT_MOUSE_OUT);
- return 1;
+ break;
}
-
- return 0;
}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/x.c,v
retrieving revision 1.71
retrieving revision 1.71.2.1
diff -u -3 -r1.71 -r1.71.2.1
--- x.c 31 May 2004 20:03:06 -0000 1.71
+++ x.c 26 Jul 2004 21:24:30 -0000 1.71.2.1
@@ -20,12 +20,10 @@
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#define INCLUDE_NEW_EVENT_DISPATCHER 0
#include "E.h"
#include <X11/Xutil.h>
#include <X11/Xresource.h>
-#if INCLUDE_NEW_EVENT_DISPATCHER
typedef struct
{
EventCallbackFunc *func;
@@ -37,13 +35,10 @@
int num;
EventCallbackItem *lst;
} EventCallbackList;
-#endif /* INCLUDE_NEW_EVENT_DISPATCHER */
typedef struct _exid
{
-#if INCLUDE_NEW_EVENT_DISPATCHER
EventCallbackList cbl;
-#endif /* INCLUDE_NEW_EVENT_DISPATCHER */
Window parent;
Window win;
int x, y, w, h;
@@ -105,12 +100,19 @@
XDeleteContext(disp, win, xid_context);
if (xid->rects)
XFree(xid->rects);
+#if 0
+ if (xid->cbl.lst)
+ Eprintf("EventCallbacksUnregister: %p %#lx\n", xid, win);
+#endif
+ if (xid->cbl.lst)
+ Efree(xid->cbl.lst);
Efree(xid);
}
}
static void
-SetXID(Window win, Window parent, int x, int y, int w, int h, int depth)
+SetXID(Window win, Window parent, int x, int y, int w, int h,
+ int depth __UNUSED__)
{
EXID *xid;
@@ -123,11 +125,8 @@
xid->h = h;
xid->depth = VRoot.depth;
AddXID(xid);
- return;
- depth = 0;
}
-#if INCLUDE_NEW_EVENT_DISPATCHER
void
EventCallbackRegister(Window win, int type __UNUSED__, EventCallbackFunc * func,
void *prm)
@@ -136,6 +135,9 @@
EventCallbackItem *eci;
xid = FindXID(win);
+#if 0
+ Eprintf("EventCallbackRegister: %p %#lx\n", xid, win);
+#endif
if (xid == NULL)
return;
@@ -147,6 +149,7 @@
eci->prm = prm;
}
+/* Not used/tested */
void
EventCallbackUnregister(Window win, int type __UNUSED__,
EventCallbackFunc * func, void *prm)
@@ -157,6 +160,9 @@
int i;
xid = FindXID(win);
+#if 0
+ Eprintf("EventCallbackUnregister: %p %#lx\n", xid, win);
+#endif
if (xid == NULL)
return;
@@ -165,7 +171,19 @@
for (i = 0; i < ecl->num; i++, eci++)
if (eci->func == func && eci->prm == prm)
{
- /* Well - remove it */
+ ecl->num--;
+ if (ecl->num)
+ {
+ for (; i < ecl->num; i++, eci++)
+ *eci = *(eci + 1);
+ xid->cbl.lst =
+ Erealloc(xid->cbl.lst, ecl->num * sizeof(EventCallbackItem));
+ }
+ else
+ {
+ Efree(xid->cbl.lst);
+ xid->cbl.lst = NULL;
+ }
return;
}
}
@@ -192,7 +210,6 @@
eci->func(ev, eci->prm);
}
}
-#endif /* INCLUDE_NEW_EVENT_DISPATCHER */
Pixmap
ECreatePixmap(Display * display, Drawable d, unsigned int width,
@@ -229,11 +246,10 @@
attr.save_under = True;
else
attr.save_under = False;
- win =
- XCreateWindow(disp, parent, x, y, w, h, 0, VRoot.depth, InputOutput,
- VRoot.vis,
- CWOverrideRedirect | CWSaveUnder | CWBackingStore |
- CWColormap | CWBackPixmap | CWBorderPixel, &attr);
+ win = XCreateWindow(disp, parent, x, y, w, h, 0, VRoot.depth, InputOutput,
+ VRoot.vis,
+ CWOverrideRedirect | CWSaveUnder | CWBackingStore |
+ CWColormap | CWBackPixmap | CWBorderPixel, &attr);
SetXID(win, parent, x, y, w, h, VRoot.depth);
EDBUG_RETURN(win);
@@ -734,12 +750,9 @@
EDBUG(6, "ECreateEventWindow");
attr.override_redirect = False;
- win =
- XCreateWindow(disp, parent, x, y, w, h, 0, 0, InputOnly, VRoot.vis,
- CWOverrideRedirect, &attr);
-#if 0 /* Not yet */
+ win = XCreateWindow(disp, parent, x, y, w, h, 0, 0, InputOnly, VRoot.vis,
+ CWOverrideRedirect, &attr);
SetXID(win, parent, x, y, w, h, VRoot.depth);
-#endif
EDBUG_RETURN(win);
}
@@ -764,11 +777,11 @@
attr.save_under = False;
attr.event_mask = KeyPressMask | FocusChangeMask;
- win =
- XCreateWindow(disp, parent, x, y, w, h, 0, 0, InputOnly, CopyFromParent,
- CWOverrideRedirect | CWSaveUnder | CWBackingStore |
- CWColormap | CWBackPixel | CWBorderPixel | CWEventMask,
- &attr);
+ win = XCreateWindow(disp, parent, x, y, w, h, 0, 0, InputOnly,
+ CopyFromParent,
+ CWOverrideRedirect | CWSaveUnder | CWBackingStore |
+ CWColormap | CWBackPixel | CWBorderPixel | CWEventMask,
+ &attr);
XSetWindowBackground(disp, win, 0);
XMapWindow(disp, win);
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs