Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        E.h borders.c events.c evhandlers.c focus.c setup.c 


Log Message:
Shuffle around some focus and event handling code.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.188
retrieving revision 1.189
diff -u -3 -r1.188 -r1.189
--- E.h 21 Jan 2004 23:32:44 -0000      1.188
+++ E.h 28 Jan 2004 20:09:06 -0000      1.189
@@ -692,7 +692,6 @@
    Colormap            cmap;
    int                 scr;
    int                 w, h;
-   Window              focuswin;
 }
 Root;
 
@@ -1872,6 +1871,7 @@
 void                FocusHandleFocusIn(Window win);
 void                FocusHandleFocusOut(Window win);
 void                FocusHandleEnter(XEvent * ev);
+void                FocusHandleLeave(XEvent * ev);
 void                FocusHandleClick(Window win);
 void                FocusNewDeskBegin(void);
 void                FocusNewDesk(void);
@@ -2004,6 +2004,8 @@
 void                HandleClientMessage(XEvent * ev);
 void                HandleFocusWindowIn(Window win);
 void                HandleFocusWindow(Window win);
+void                HandleFocusIn(XEvent * ev);
+void                HandleFocusOut(XEvent * ev);
 void                HandleChildShapeChange(XEvent * ev);
 void                HandleMotion(XEvent * ev);
 void                HandleDestroy(XEvent * ev);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/borders.c,v
retrieving revision 1.127
retrieving revision 1.128
diff -u -3 -r1.127 -r1.128
--- borders.c   21 Jan 2004 23:32:44 -0000      1.127
+++ borders.c   28 Jan 2004 20:09:06 -0000      1.128
@@ -2079,23 +2079,26 @@
 
    if (ewin->visible)
       EDBUG_RETURN_;
+   ewin->visible = 1;
+
    if (ewin->client.win)
      {
        if (ewin->shaded)
           EMoveResizeWindow(disp, ewin->win_container, -30, -30, 1, 1);
        EMapWindow(disp, ewin->client.win);
      }
+
    if (ewin->win)
-     {
-       EMapWindow(disp, ewin->win);
-     }
-   ewin->visible = 1;
+      EMapWindow(disp, ewin->win);
+
    SetEwinToCurrentArea(ewin);
+
    if (mode.mode == MODE_NONE)
      {
        PagerEwinOutsideAreaUpdate(ewin);
        ForceUpdatePagersForDesktop(ewin->desktop);
      }
+
    EDBUG_RETURN_;
 }
 
@@ -2103,18 +2106,23 @@
 HideEwin(EWin * ewin)
 {
    EDBUG(3, "HideEwin");
+
    if (!ewin->visible)
       EDBUG_RETURN_;
+   ewin->visible = 0;
+
    if (GetZoomEWin() == ewin)
       Zoom(NULL);
+
    if (ewin->win)
       EUnmapWindow(disp, ewin->win);
-   ewin->visible = 0;
+
    if (mode.mode == MODE_NONE)
      {
        PagerEwinOutsideAreaUpdate(ewin);
        ForceUpdatePagersForDesktop(ewin->desktop);
      }
+
    EDBUG_RETURN_;
 }
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/events.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -3 -r1.47 -r1.48
--- events.c    21 Jan 2004 23:32:44 -0000      1.47
+++ events.c    28 Jan 2004 20:09:07 -0000      1.48
@@ -220,23 +220,7 @@
 HEnterNotify(XEvent * ev)
 {
    EDBUG(7, "HEnterNotify");
-   if (mode.mode == MODE_NONE)
-     {
-       /*
-        * multi screen handling -- root windows receive
-        * enter / leave notify
-        */
-       if (ev->xany.window == root.win)
-         {
-            if (!mode.focuswin || conf.focus.mode == MODE_FOCUS_POINTER)
-               HandleFocusWindow(root.focuswin);
-         }
-       else
-         {
-            HandleMouseIn(ev);
-            HandleFocusWindow(ev->xcrossing.window);
-         }
-     }
+   HandleMouseIn(ev);
    EDBUG_RETURN_;
 }
 
@@ -244,27 +228,7 @@
 HLeaveNotify(XEvent * ev)
 {
    EDBUG(7, "HLeaveNotify");
-   if (mode.mode == MODE_NONE)
-     {
-       HandleMouseOut(ev);
-
-       /*
-        * If we are leaving the root window, we are switching
-        * screens on a multi screen system - need to unfocus
-        * to allow other desk to grab focus...
-        */
-       if (ev->xcrossing.window == root.win)
-         {
-            if (ev->xcrossing.mode == NotifyNormal
-                && ev->xcrossing.detail != NotifyInferior && mode.focuswin)
-               HandleFocusWindow(root.focuswin);
-            else
-               HandleFocusWindow(ev->xcrossing.window);
-         }
-/* THIS caused the "emacs focus bug" ? */
-/*      else */
-/*      HandleFocusWindow(ev->xcrossing.window); */
-     }
+   HandleMouseOut(ev);
    EDBUG_RETURN_;
 }
 
@@ -272,8 +236,7 @@
 HFocusIn(XEvent * ev)
 {
    EDBUG(7, "HFocusIn");
-   if (ev->xfocus.detail != NotifyPointer)
-      HandleFocusWindowIn(ev->xfocus.window);
+   HandleFocusIn(ev);
    EDBUG_RETURN_;
 }
 
@@ -281,19 +244,7 @@
 HFocusOut(XEvent * ev)
 {
    EDBUG(7, "HFocusOut");
-   if (ev->xfocus.detail == NotifyNonlinear)
-     {
-       Window              rt, ch;
-       int                 d;
-       unsigned int        ud;
-
-       XQueryPointer(disp, root.win, &rt, &ch, &d, &d, &d, &d, &ud);
-       if (rt != root.win)
-         {
-/*           fprintf(stderr, "HandleFocusWindowIn\n"); */
-            HandleFocusWindowIn(0);
-         }
-     }
+   HandleFocusOut(ev);
    EDBUG_RETURN_;
 }
 
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/evhandlers.c,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -3 -r1.143 -r1.144
--- evhandlers.c        21 Jan 2004 23:32:44 -0000      1.143
+++ evhandlers.c        28 Jan 2004 20:09:07 -0000      1.144
@@ -114,80 +114,28 @@
 }
 
 void
-HandleFocusWindowIn(Window win)
+HandleFocusIn(XEvent * ev)
 {
-   EWin               *ewin;
-
-   EDBUG(5, "HandleFocusWindowIn");
-   ewin = FindItem(NULL, win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
-   if (!ewin)
-      ewin = FindEwinByBase(win);
-   if (ewin != mode.focuswin)
-     {
-       if (mode.focuswin)
-         {
-            mode.focuswin->active = 0;
-            DrawEwin(mode.focuswin);
-            if (conf.focus.mode == MODE_FOCUS_CLICK)
-               XGrabButton(disp, AnyButton, AnyModifier,
-                           mode.focuswin->win_container, False,
-                           ButtonPressMask, GrabModeSync, GrabModeAsync, None,
-                           None);
-         }
-       mode.focuswin = ewin;
-       if ((ewin) && (!ewin->menu))
-         {
-            mode.realfocuswin = ewin;
-            if (!mode.cur_menu_mode)
-               mode.context_ewin = ewin;
-         }
-       if (mode.focuswin)
-         {
-            mode.focuswin->active = 1;
-            DrawEwin(mode.focuswin);
-            if (conf.focus.mode == MODE_FOCUS_CLICK)
-              {
-                 XUngrabButton(disp, AnyButton, AnyModifier,
-                               mode.focuswin->win_container);
-                 GrabButtonGrabs(mode.focuswin);
-              }
-         }
-     }
-   EDBUG_RETURN_;
+   if (ev->xfocus.detail != NotifyPointer)
+      HandleFocusWindowIn(ev->xfocus.window);
 }
 
 void
-HandleFocusWindow(Window win)
+HandleFocusOut(XEvent * ev)
 {
-   EWin               *found_ewin;
-
-   EDBUG(5, "HandleFocusWindow");
-   if (root.focuswin == win)
-      FocusToEWin(NULL, FOCUS_SET);
-   else
+   if (ev->xfocus.detail == NotifyNonlinear)
      {
-       found_ewin = FindEwinByChildren(win);
-       if (!found_ewin)
-          found_ewin = FindEwinByBase(win);
-       if (conf.focus.mode == MODE_FOCUS_CLICK)
-          mode.mouse_over_win = found_ewin;
-       else if (conf.focus.mode == MODE_FOCUS_SLOPPY)
-         {
-            if (!found_ewin)
-               ICCCM_Cmap(NULL);
-            else if (!(found_ewin->focusclick))
-               FocusToEWin(found_ewin, FOCUS_SET);
-            mode.mouse_over_win = found_ewin;
-         }
-       else if (conf.focus.mode == MODE_FOCUS_POINTER)
-         {
-            if (!found_ewin)
-               found_ewin = GetEwinPointerInClient();
-            FocusToEWin(found_ewin, FOCUS_SET);
-            mode.mouse_over_win = found_ewin;
+       Window              rt, ch;
+       int                 d;
+       unsigned int        ud;
+
+       XQueryPointer(disp, root.win, &rt, &ch, &d, &d, &d, &d, &ud);
+       if (rt != root.win)
+         {
+/*           fprintf(stderr, "HandleFocusWindowIn\n"); */
+            HandleFocusWindowIn(0);
          }
      }
-   EDBUG_RETURN_;
 }
 
 void
@@ -1037,6 +985,8 @@
       goto exit;
 
  exit:
+   FocusHandleEnter(ev);
+
    EDBUG_RETURN_;
 }
 
@@ -1073,5 +1023,7 @@
       goto exit;
 
  exit:
+   FocusHandleLeave(ev);
+
    EDBUG_RETURN_;
 }
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/focus.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -3 -r1.41 -r1.42
--- focus.c     21 Jan 2004 23:32:44 -0000      1.41
+++ focus.c     28 Jan 2004 20:09:07 -0000      1.42
@@ -28,14 +28,14 @@
 static void
 AutoraiseTimeout(int val, void *data)
 {
-   EWin               *found_ewin;
+   EWin               *ewin;
 
    if (conf.focus.mode == MODE_FOCUS_CLICK)
       return;
-   found_ewin = FindItem("", val, LIST_FINDBY_ID, LIST_TYPE_EWIN);
-   if (found_ewin)
-      RaiseEwin(found_ewin);
-   data = NULL;
+
+   ewin = FindItem("", val, LIST_FINDBY_ID, LIST_TYPE_EWIN);
+   if (ewin)
+      RaiseEwin(ewin);
 }
 
 static void
@@ -46,8 +46,6 @@
    ewin = RemoveItem("EWIN", val, LIST_FINDBY_ID, LIST_TYPE_EWIN);
    if (ewin)
       AddItem(ewin, "EWIN", ewin->client.win, LIST_TYPE_EWIN);
-   val = 0;
-   data = NULL;
 }
 
 static void
@@ -484,3 +482,123 @@
    EDBUG_RETURN_;
 }
 #endif
+
+void
+HandleFocusWindowIn(Window win)
+{
+   EWin               *ewin;
+
+   EDBUG(5, "HandleFocusWindowIn");
+   ewin = FindItem(NULL, win, LIST_FINDBY_ID, LIST_TYPE_EWIN);
+   if (!ewin)
+      ewin = FindEwinByBase(win);
+   if (ewin != mode.focuswin)
+     {
+       if (mode.focuswin)
+         {
+            mode.focuswin->active = 0;
+            DrawEwin(mode.focuswin);
+            if (conf.focus.mode == MODE_FOCUS_CLICK)
+               XGrabButton(disp, AnyButton, AnyModifier,
+                           mode.focuswin->win_container, False,
+                           ButtonPressMask, GrabModeSync, GrabModeAsync, None,
+                           None);
+         }
+       mode.focuswin = ewin;
+       if ((ewin) && (!ewin->menu))
+         {
+            mode.realfocuswin = ewin;
+            if (!mode.cur_menu_mode)
+               mode.context_ewin = ewin;
+         }
+       if (mode.focuswin)
+         {
+            mode.focuswin->active = 1;
+            DrawEwin(mode.focuswin);
+            if (conf.focus.mode == MODE_FOCUS_CLICK)
+              {
+                 XUngrabButton(disp, AnyButton, AnyModifier,
+                               mode.focuswin->win_container);
+                 GrabButtonGrabs(mode.focuswin);
+              }
+         }
+     }
+   EDBUG_RETURN_;
+}
+
+void
+HandleFocusWindow(Window win)
+{
+   EWin               *found_ewin;
+
+   EDBUG(5, "HandleFocusWindow");
+   if (win == 0)
+      FocusToEWin(NULL, FOCUS_SET);
+   else
+     {
+       found_ewin = FindEwinByChildren(win);
+       if (!found_ewin)
+          found_ewin = FindEwinByBase(win);
+       if (conf.focus.mode == MODE_FOCUS_CLICK)
+          mode.mouse_over_win = found_ewin;
+       else if (conf.focus.mode == MODE_FOCUS_SLOPPY)
+         {
+            if (!found_ewin)
+               ICCCM_Cmap(NULL);
+            else if (!(found_ewin->focusclick))
+               FocusToEWin(found_ewin, FOCUS_SET);
+            mode.mouse_over_win = found_ewin;
+         }
+       else if (conf.focus.mode == MODE_FOCUS_POINTER)
+         {
+            if (!found_ewin)
+               found_ewin = GetEwinPointerInClient();
+            FocusToEWin(found_ewin, FOCUS_SET);
+            mode.mouse_over_win = found_ewin;
+         }
+     }
+   EDBUG_RETURN_;
+}
+
+/*
+ * Focus event handlers
+ */
+
+void
+FocusHandleEnter(XEvent * ev)
+{
+   /*
+    * multi screen handling -- root windows receive
+    * enter / leave notify
+    */
+   if (ev->xany.window == root.win)
+     {
+       if (!mode.focuswin || conf.focus.mode == MODE_FOCUS_POINTER)
+          HandleFocusWindow(0);
+     }
+   else
+     {
+       HandleFocusWindow(ev->xcrossing.window);
+     }
+}
+
+void
+FocusHandleLeave(XEvent * ev)
+{
+   /*
+    * If we are leaving the root window, we are switching
+    * screens on a multi screen system - need to unfocus
+    * to allow other desk to grab focus...
+    */
+   if (ev->xcrossing.window == root.win)
+     {
+       if (ev->xcrossing.mode == NotifyNormal
+           && ev->xcrossing.detail != NotifyInferior && mode.focuswin)
+          HandleFocusWindow(0);
+       else
+          HandleFocusWindow(ev->xcrossing.window);
+     }
+/* THIS caused the "emacs focus bug" ? */
+/*      else */
+/*      HandleFocusWindow(ev->xcrossing.window); */
+}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/setup.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -3 -r1.105 -r1.106
--- setup.c     21 Jan 2004 23:32:45 -0000      1.105
+++ setup.c     28 Jan 2004 20:09:07 -0000      1.106
@@ -297,7 +297,6 @@
 #endif
    root.w = DisplayWidth(disp, root.scr);
    root.h = DisplayHeight(disp, root.scr);
-   root.focuswin = ECreateFocusWindow(root.win, -100, -100, 5, 5);
 
    /* just in case - set them up again */
    /* set up an error handler for then E would normally have fatal X errors */
@@ -409,6 +408,7 @@
    conf.focus.raise_on_next_focus = 1;
    conf.focus.raise_after_next_focus = 1;
    conf.focus.warp_on_next_focus = 0;
+   conf.focus.warp_after_next_focus = 0;
    conf.group_config.iconify = 1;
    conf.group_config.kill = 0;
    conf.group_config.move = 1;




-------------------------------------------------------
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