Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        focus.c 


Log Message:
Fix some startup/desk switch focusing issues.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/focus.c,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -3 -r1.91 -r1.92
--- focus.c     26 Feb 2005 16:40:36 -0000      1.91
+++ focus.c     5 Mar 2005 14:25:50 -0000       1.92
@@ -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
@@ -22,7 +23,8 @@
  */
 #include "E.h"
 
-static int          new_desk_focus_nesting = 0;
+static int          focus_enable = 0;
+static int          focus_new_desk_nesting = 0;
 
 /*
  * Return !0 if it is OK to focus ewin.
@@ -52,7 +54,7 @@
 static EWin        *
 FocusEwinSelect(void)
 {
-   EWin               *const *lst, *ewin = NULL;
+   EWin               *const *lst, *ewin;
    int                 num, i;
 
    switch (Conf.focus.mode)
@@ -61,16 +63,23 @@
      case MODE_FOCUS_POINTER:
        ewin = GetEwinPointerInClient();
        break;
+
      case MODE_FOCUS_SLOPPY:
        ewin = GetEwinPointerInClient();
-       if (ewin)
+       if (ewin && FocusEwinValid(ewin, 1) && !ewin->focusclick)
           break;
-       /* If pointer not in window -  fall thru and select other */
+       goto do_select;
+
      case MODE_FOCUS_CLICK:
+       goto do_select;
+
+      do_select:
+       ewin = NULL;
        lst = EwinListFocusGet(&num);
        for (i = 0; i < num; i++)
          {
-            if (!FocusEwinValid(lst[i], 1) || lst[i]->skipfocus)
+            if (!FocusEwinValid(lst[i], 1) || lst[i]->skipfocus ||
+                lst[i]->focusclick)
                continue;
             ewin = lst[i];
             break;
@@ -216,6 +225,9 @@
           Eprintf("FocusToEWin None why=%d\n", why);
      }
 
+   if (!focus_enable)
+      return;
+
    switch (why)
      {
      case FOCUS_NEXT:
@@ -306,6 +318,9 @@
 
    /* NB! ewin != NULL */
 
+   if (why != FOCUS_CLICK && ewin->focusclick)
+      return;
+
    if (do_follow)
       DeskGotoByEwin(ewin);
 
@@ -366,7 +381,7 @@
 void
 FocusNewDeskBegin(void)
 {
-   if (new_desk_focus_nesting++)
+   if (focus_new_desk_nesting++)
       return;
 
    FocusToEWin(NULL, FOCUS_DESK_LEAVE);
@@ -382,6 +397,9 @@
 {
    EWin               *ewin;
 
+   /* Start focusing windows */
+   focus_enable = 1;
+
    /* Set the mouse-over window */
    ewin = GetEwinByCurrentPointer();
    Mode.mouse_over_ewin = ewin;
@@ -399,7 +417,7 @@
 {
    EWin               *ewin;
 
-   if (--new_desk_focus_nesting)
+   if (--focus_new_desk_nesting)
       return;
 
    /* we flipped - re-enable enter and leave events */
@@ -510,13 +528,21 @@
  */
 
 static void
+FocusInitTimeout(int val __UNUSED__, void *data __UNUSED__)
+{
+   FocusInit();
+}
+
+static void
 FocusSighan(int sig, void *prm __UNUSED__)
 {
    switch (sig)
      {
      case ESIGNAL_START:
-       FocusInit();
+       /* Delay focusing a bit to allow things to settle down */
+       DoIn("FOCUS_INIT_TIMEOUT", 1., FocusInitTimeout, 0, NULL);
        break;
+
      case ESIGNAL_EXIT:
        FocusExit();
        break;




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

Reply via email to