Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h buttons.c slideout.c 


Log Message:
Fix slideouts (again).
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.484
retrieving revision 1.485
diff -u -3 -r1.484 -r1.485
--- E.h 20 Aug 2005 13:55:50 -0000      1.484
+++ E.h 20 Aug 2005 17:43:33 -0000      1.485
@@ -1055,7 +1055,7 @@
 void                ButtonMoveRelative(Button * b, int dx, int dy);
 void                ButtonIncRefcount(Button * b);
 void                ButtonDecRefcount(Button * b);
-void                ButtonSetSwallowed(Button * b);
+void                ButtonSwallowInto(Button * bi, EObj * eo);
 int                 ButtonGetRefcount(const Button * b);
 int                 ButtonGetDesk(const Button * b);
 int                 ButtonGetInfo(const Button * b, RectBox * r, int desk);
@@ -1065,7 +1065,6 @@
 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);
 
@@ -1757,6 +1756,7 @@
 
 /* slideouts.c */
 int                 SlideoutsConfigLoad(FILE * fs);
+void                SlideoutDoAction(EObj * seo, ActionClass * ac, XEvent * 
ev);
 
 /* snaps.c */
 void                Real_SaveSnapInfo(int dumval, void *dumdat);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/buttons.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -3 -r1.72 -r1.73
--- buttons.c   20 Aug 2005 13:55:50 -0000      1.72
+++ buttons.c   20 Aug 2005 17:43:33 -0000      1.73
@@ -54,7 +54,7 @@
    int                 flags;
    char                internal;
    char                default_show;
-   char                used;
+   EObj               *container;
 
    int                 state;
    Window              inside_win;
@@ -124,14 +124,7 @@
    b->geom.ysizeabs = ysa;
    b->geom.ysizerel = ysr;
    b->geom.size_from_image = simg;
-   b->inside_win = 0;
-   b->event_win = 0;
-   b->internal = 0;
    b->default_show = 1;
-   b->used = 0;
-   b->left = 0;
-   b->state = 0;
-   b->ref_count = 0;
 
    EoSetSticky(b, sticky);
    EoSetDesk(b, desk);
@@ -245,13 +238,14 @@
 }
 
 void
-ButtonSetSwallowed(Button * b)
+ButtonSwallowInto(Button * b, EObj * eo)
 {
    b->internal = 1;
    b->default_show = 0;
    b->flags |= FLAG_FIXED;
-   b->used = 1;
+   b->container = eo;
    b->ref_count++;
+   EobjReparent(EoObj(b), eo, 0, 0);
    ButtonCalc(b);
    ButtonDraw(b);
    EMapWindow(EoGetWin(b));
@@ -282,7 +276,7 @@
 void
 ButtonToggle(Button * b)
 {
-   if (b->used)
+   if (b->internal)
       return;
 
    if (EoIsShown(b))
@@ -435,13 +429,6 @@
    return !b->internal && b->default_show;
 }
 
-void
-ButtonDoAction(Button * b, EWin * ewin, XEvent * ev)
-{
-   if (b->aclass && !Mode_buttons.action_inhibit)
-      ActionclassEvent(b->aclass, ev, ewin);
-}
-
 #if 1                          /* Unused */
 int
 ButtonEmbedWindow(Button * b, Window WindowToEmbed)
@@ -505,17 +492,25 @@
  */
 
 static void
-ButtonEventMouseDown(Button * b, XEvent * ev)
+ButtonDoAction(Button * b, XEvent * ev)
 {
-   Window              win = ev->xbutton.window;
-   ActionClass        *ac;
+   if (b->container)
+      SlideoutDoAction(b->container, b->aclass, ev);
+   else
+      ActionclassEvent(b->aclass, ev, NULL);
+}
 
+static void
+ButtonEventMouseDown(Button * b, XEvent * ev)
+{
    Mode_buttons.button = b;
 
-   GrabPointerSet(win, ECSR_GRAB, 0);
+   GrabPointerSet(EoGetWin(b), ECSR_GRAB, 0);
 
    if (b->inside_win)
      {
+       Window              win = ev->xbutton.window;
+
        ev->xbutton.window = b->inside_win;
        XSendEvent(disp, b->inside_win, False, ButtonPressMask, ev);
        ev->xbutton.window = win;
@@ -526,6 +521,8 @@
 
    if (!b->internal)
      {
+       ActionClass        *ac;
+
        ac = FindItem("ACTION_BUTTON_DRAG", 0, LIST_FINDBY_NAME,
                      LIST_TYPE_ACLASS);
        if (ac && !Mode_buttons.action_inhibit)
@@ -533,16 +530,16 @@
      }
 
    if (b->aclass && !Mode_buttons.action_inhibit)
-      ActionclassEvent(b->aclass, ev, NULL);
+      ButtonDoAction(b, ev);
 }
 
 static void
 ButtonEventMouseUp(Button * b, XEvent * ev)
 {
-   Window              win = ev->xbutton.window;
-
    if (b->inside_win && !Mode_buttons.action_inhibit)
      {
+       Window              win = ev->xbutton.window;
+
        ev->xbutton.window = b->inside_win;
        XSendEvent(disp, b->inside_win, False, ButtonReleaseMask, ev);
        ev->xbutton.window = win;
@@ -554,12 +551,10 @@
       b->state = STATE_NORMAL;
    ButtonDraw(b);
 
-#if 1                          /* FIXME - Here? */
    GrabPointerRelease();
-#endif
 
    if (b->aclass && !b->left && !Mode_buttons.action_inhibit)
-      ActionclassEvent(b->aclass, ev, NULL);
+      ButtonDoAction(b, ev);
 
    b->left = 0;
 
@@ -567,9 +562,6 @@
       ButtonDragEnd(Mode_buttons.button);
    Mode_buttons.button = NULL;
 
-#if 0                          /* FIXME - Move? */
-   GrabPointerRelease();
-#endif
    Mode_buttons.action_inhibit = 0;
 }
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/slideout.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -3 -r1.38 -r1.39
--- slideout.c  10 Aug 2005 15:40:58 -0000      1.38
+++ slideout.c  20 Aug 2005 17:43:33 -0000      1.39
@@ -26,6 +26,11 @@
 #include "ewins.h"
 #include "xwin.h"
 
+#define SLIDEOUT_EVENT_MASK \
+  (KeyPressMask | KeyReleaseMask | \
+   ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | \
+   PointerMotionMask)
+
 typedef struct
 {
    EObj                o;
@@ -58,6 +63,7 @@
 
    EobjInit(EoObj(s), EOBJ_TYPE_MISC, None, -10, -10, 1, 1, 1, name);
    s->direction = dir;
+   ESelectInput(EoGetWin(s), SLIDEOUT_EVENT_MASK);
    EventCallbackRegister(EoGetWin(s), 0, SlideoutHandleEvent, s);
 
    return s;
@@ -315,8 +321,7 @@
    s->num_buttons++;
    s->button = Erealloc(s->button, sizeof(Button *) * s->num_buttons);
    s->button[s->num_buttons - 1] = b;
-   EobjReparent((EObj *) b, EoObj(s), 0, 0);
-   ButtonSetSwallowed(b);
+   ButtonSwallowInto(b, EoObj(s));
    SlideoutCalcSize(s);
 }
 
@@ -329,26 +334,16 @@
 }
 #endif
 
-static void
-SlideoutCheckButtonEvent(Slideout * s, XEvent * ev)
+void
+SlideoutDoAction(EObj * seo, ActionClass * ac, XEvent * ev)
 {
-   int                 i, x, y, bx, by, bw, bh;
-   Button             *b;
+   Slideout           *s = (Slideout *) seo;
+   EWin               *ewin = s->context_ewin;
 
-   x = ev->xbutton.x;
-   y = ev->xbutton.y;
+   if (ev->type == ButtonRelease)
+      SlideoutHide(s);
 
-   if (x < 0 || y < 0 || x > EoGetW(s) || y >= EoGetH(s))
-      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);
-     }
+   ActionclassEvent(ac, ev, ewin);
 }
 
 static void
@@ -363,10 +358,17 @@
        SlideoutHide(s);
        break;
      case ButtonPress:
+       break;
      case ButtonRelease:
-       SlideoutCheckButtonEvent(s, ev);
-       if (ev->type == ButtonRelease)
-          SlideoutHide(s);
+       SlideoutHide(s);
+       break;
+     case EnterNotify:
+       if (ev->xcrossing.mode != NotifyGrab)
+          GrabPointerRelease();
+       break;
+     case LeaveNotify:
+       if (ev->xcrossing.mode != NotifyUngrab)
+          GrabPointerSet(EoGetWin(s), ECSR_ROOT, 0);
        break;
      }
 }




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to