Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h evhandlers.c pager.c 


Log Message:
Fix event handling when unshading pager.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.191
retrieving revision 1.192
diff -u -3 -r1.191 -r1.192
--- E.h 1 Feb 2004 16:48:05 -0000       1.191
+++ E.h 2 Feb 2004 19:32:25 -0000       1.192
@@ -1314,6 +1314,9 @@
    char                firsttime;
    Window              button_proxy_win;
    const XEvent       *current_event;
+   Window              last_bpress;
+   int                 last_button;
+   Time                last_time;
 }
 EMode;
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/evhandlers.c,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -3 -r1.145 -r1.146
--- evhandlers.c        1 Feb 2004 11:28:05 -0000       1.145
+++ evhandlers.c        2 Feb 2004 19:32:25 -0000       1.146
@@ -27,9 +27,6 @@
 static void         ToolTipTimeout(int val, void *data);
 
 static char         sentpress = 0;
-static Window       last_bpress = 0;
-static Time         last_time = 0;
-static int          last_button = 0;
 
 static void
 ToolTipTimeout(int val, void *data)
@@ -768,14 +765,14 @@
 
    TooltipsHandleEvent();
 
-   if ((((float)(ev->xbutton.time - last_time) / 1000) <
-       mode_double_click_time)
-       && ((int)(ev->xbutton.button) == (int)(last_button)))
+   if ((((float)(ev->xbutton.time - mode.last_time) / 1000) <
+       mode_double_click_time) &&
+       ((int)(ev->xbutton.button) == (int)(mode.last_button)))
       double_click = 1;
 
-   last_time = ev->xbutton.time;
-   last_button = ev->xbutton.button;
-   last_bpress = win;
+   mode.last_time = ev->xbutton.time;
+   mode.last_button = ev->xbutton.button;
+   mode.last_bpress = win;
 
    mode.x = ev->xbutton.x_root;
    mode.y = ev->xbutton.y_root;
@@ -859,7 +856,7 @@
        (!((mode.place) &&
          (mode.mode == MODE_MOVE_PENDING || mode.mode == MODE_MOVE))))
      {
-       if ((int)last_button != (int)ev->xbutton.button)
+       if ((int)mode.last_button != (int)ev->xbutton.button)
           EDBUG_RETURN_;
      }
 
@@ -873,9 +870,9 @@
 
    ActionsEnd(NULL);
 
-   if ((last_bpress) && (last_bpress != win))
+   if ((mode.last_bpress) && (mode.last_bpress != win))
      {
-       ev->xbutton.window = last_bpress;
+       ev->xbutton.window = mode.last_bpress;
        BordersEventMouseOut2(ev);
        ev->xbutton.window = win;
      }
@@ -893,9 +890,9 @@
        ButtonProxySendEvent(ev);
      }
 
-   mode.context_win = last_bpress;
+   mode.context_win = mode.last_bpress;
 
-   if ((((float)(ev->xbutton.time - last_time) / 1000) < 0.5)
+   if ((((float)(ev->xbutton.time - mode.last_time) / 1000) < 0.5)
        && (mode.cur_menu_depth > 0) && (!clickmenu))
      {
        clickmenu = 1;
@@ -942,7 +939,7 @@
 
    mode.action_inhibit = 0;
    mode.justclicked = 0;
-   last_bpress = 0;
+   mode.last_bpress = 0;
 
    EDBUG_RETURN_;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/pager.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -3 -r1.61 -r1.62
--- pager.c     1 Feb 2004 11:28:05 -0000       1.61
+++ pager.c     2 Feb 2004 19:32:25 -0000       1.62
@@ -1632,11 +1632,12 @@
 int
 PagersEventMouseDown(XEvent * ev)
 {
+   Window              win = ev->xbutton.window;
    int                 i, num;
    Pager              *p;
    EWin               *ewin, **gwins;
 
-   p = FindPager(ev->xbutton.window);
+   p = FindPager(win);
    if (!p)
       return 0;
 
@@ -1654,7 +1655,7 @@
    if (gwins)
       Efree(gwins);
 
-   if (ev->xbutton.window == p->hi_win)
+   if (win == p->hi_win)
      {
        int                 hx, hy;
        Window              dw;
@@ -1709,29 +1710,30 @@
 int
 PagersEventMouseUp(XEvent * ev)
 {
+   Window              win = ev->xbutton.window;
    int                 used = 0;
    int                 i, num;
    Pager              *p;
    EWin               *ewin, **gwins;
    int                 pax, pay;
 
-   p = FindPager(ev->xbutton.window);
+   p = FindPager(win);
    if (p == NULL)
       goto exit;
 
    if (((int)ev->xbutton.button == conf.pagers.sel_button))
      {
+       if (win != mode.last_bpress)
+          goto exit;
        PagerAreaAt(p, ev->xbutton.x, ev->xbutton.y, &pax, &pay);
        GotoDesktop(p->desktop);
        if (p->desktop != desks.current)
-         {
-            SoundPlay("SOUND_DESKTOP_SHUT");
-         }
+          SoundPlay("SOUND_DESKTOP_SHUT");
        SetCurrentArea(pax, pay);
      }
    else if (((int)ev->xbutton.button == conf.pagers.win_button))
      {
-       if (ev->xbutton.window == p->hi_win)
+       if (win == p->hi_win)
          {
             int                 hx, hy;
             Window              dw;
@@ -1741,11 +1743,17 @@
             ev->xbutton.x += hx;
             ev->xbutton.y += hy;
          }
-       if (!FindItem
-           ((char *)p->hi_ewin, 0, LIST_FINDBY_POINTER, LIST_TYPE_EWIN))
+
+       if (!FindItem((char *)p->hi_ewin, 0,
+                     LIST_FINDBY_POINTER, LIST_TYPE_EWIN))
           p->hi_ewin = NULL;
-       if ((mode.mode == MODE_PAGER_DRAG) && (p->hi_ewin))
+
+       switch (mode.mode)
          {
+         case MODE_PAGER_DRAG:
+            if (!p->hi_ewin)
+               break;
+
             ewin = NULL;
             for (i = 0; i < desks.desk[desks.current].num; i++)
               {
@@ -1769,6 +1777,7 @@
                         }
                    }
               }
+
             ewin = GetEwinPointerInClient();
             if ((ewin) && (ewin->pager))
               {
@@ -1893,10 +1902,13 @@
                  if (gwins)
                     Efree(gwins);
               }
-         }
-       else if ((ev->xbutton.x >= 0) && (ev->xbutton.y >= 0)
-                && (ev->xbutton.x < p->w) && (ev->xbutton.y < p->h))
-         {
+            break;
+
+         default:
+            if ((ev->xbutton.x < 0) || (ev->xbutton.y < 0) ||
+                (ev->xbutton.x >= p->w) || (ev->xbutton.y >= p->h))
+               break;
+
             PagerAreaAt(p, ev->xbutton.x, ev->xbutton.y, &pax, &pay);
             GotoDesktop(p->desktop);
             SetCurrentArea(pax, pay);
@@ -1906,13 +1918,16 @@
                  RaiseEwin(ewin);
                  FocusToEWin(ewin, FOCUS_SET);
               }
+            break;
          }
+
        if (p->hi_ewin)
          {
             RedrawPagersForDesktop(p->hi_ewin->desktop, 3);
             ForceUpdatePagersForDesktop(p->hi_ewin->desktop);
             PagerHideHi(p);
          }
+
        mode.mode = MODE_NONE;
        mode.context_pager = NULL;
      }




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to