]> Dogcows Code - chaz/openbox/commitdiff
remove focusLast and focusLastOnDesktop
authorDana Jansens <danakj@orodu.net>
Mon, 15 Sep 2003 07:47:05 +0000 (07:47 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 15 Sep 2003 07:47:05 +0000 (07:47 +0000)
data/rc.xml
openbox/config.c
openbox/config.h
openbox/event.c
openbox/focus.c
openbox/focus.h
openbox/screen.c

index 04412efbb54f2c0fdc0add32267513bb3c0eb9ce..fab32908a080a5bd6e6c877a1af0148cde1f23ba 100644 (file)
@@ -13,8 +13,6 @@
 <focus>
   <focusNew>yes</focusNew>
   <followMouse>no</followMouse>
-  <focusLast>yes</focusLast>
-  <focusLastOnDesktop>yes</focusLastOnDesktop>
   <focusDelay>0</focusDelay>
 </focus>
 
index c840f83eb5a3efce28cf5fa66896d5df6accb931..4251390c9fcd031fc9d60595e80fcb0e1133d180 100644 (file)
@@ -8,8 +8,6 @@
 
 gboolean config_focus_new;
 gboolean config_focus_follow;
-gboolean config_focus_last;
-gboolean config_focus_last_on_desktop;
 guint    config_focus_delay;
 
 char *config_theme;
@@ -175,10 +173,6 @@ static void parse_focus(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node,
         config_focus_new = parse_bool(doc, n);
     if ((n = parse_find_node("followMouse", node)))
         config_focus_follow = parse_bool(doc, n);
-    if ((n = parse_find_node("focusLast", node)))
-        config_focus_last = parse_bool(doc, n);
-    if ((n = parse_find_node("focusLastOnDesktop", node)))
-        config_focus_last_on_desktop = parse_bool(doc, n);
     if ((n = parse_find_node("focusDelay", node)))
         config_focus_delay = parse_int(doc, n) * 1000;
 }
@@ -332,8 +326,6 @@ void config_startup(ObParseInst *i)
 {
     config_focus_new = TRUE;
     config_focus_follow = FALSE;
-    config_focus_last = TRUE;
-    config_focus_last_on_desktop = TRUE;
     config_focus_delay = 0;
 
     parse_register(i, "focus", parse_focus, NULL);
index f33a90f664cd1e0711f5d044447847ca467d336e..6ba88afaaf120b921a6a3e27b2e9575b70cf3db8 100644 (file)
@@ -12,10 +12,6 @@ struct _ObParseInst;
 extern gboolean config_focus_new;
 /*! Focus windows when the mouse enters them */
 extern gboolean config_focus_follow;
-/*! Focus the last focused window as a fallback */
-extern gboolean config_focus_last;
-/*! Focus the last focused window as a fallback when switching desktops */
-extern gboolean config_focus_last_on_desktop;
 /*! Timeout for focusing windows on focus follows mouse, in microseconds */
 extern guint    config_focus_delay;
 
index dbb4ec68eb0b91874309d2ec4712618bf296743c..f6d6f3b6f7a83eb3bd6cb595404e558604e98004 100644 (file)
 #include <X11/ICE/ICElib.h>
 #endif
 
+typedef struct
+{
+    gboolean ignored;
+} ObEventData;
+
 static void event_process(const XEvent *e, gpointer data);
 static void event_handle_root(XEvent *e);
 static void event_handle_menu(XEvent *e);
@@ -289,8 +294,8 @@ static gboolean event_ignore(XEvent *e, ObClient *client)
        if (INVALID_FOCUSIN(e) ||
             client == NULL) {
 #ifdef DEBUG_FOCUS
-        ob_debug("FocusIn on %lx mode %d detail %d IGNORED\n",
-                 e->xfocus.window, e->xfocus.mode, e->xfocus.detail);
+            ob_debug("FocusIn on %lx mode %d detail %d IGNORED\n",
+                     e->xfocus.window, e->xfocus.mode, e->xfocus.detail);
 #endif
             /* says a client was not found for the event (or a valid FocusIn
                event was not found.
@@ -372,14 +377,18 @@ static gboolean event_ignore(XEvent *e, ObClient *client)
                         }
                     }
 
-                    /* once all the FocusOut's have been dealt with, if there
-                       is a FocusIn still left and it is valid, then use it */
-                    event_process(&fe, NULL);
-                    /* secret magic way of event_process telling us that no
-                       client was found for the FocusIn event. ^_^ */
-                    if (fe.xfocus.window != None) {
-                        fallback = FALSE;
-                        break;
+                    {
+                        ObEventData d;
+
+                        /* once all the FocusOut's have been dealt with, if
+                           there is a FocusIn still left and it is valid, then
+                           use it */
+                        event_process(&fe, &d);
+                        if (!d.ignored) {
+                            ob_debug("FocusIn was OK, so don't fallback\n");
+                            fallback = FALSE;
+                            break;
+                        }
                     }
                 }
             }
@@ -432,6 +441,7 @@ static void event_process(const XEvent *ec, gpointer data)
     ObDockApp *dockapp = NULL;
     ObWindow *obwin = NULL;
     XEvent ee, *e;
+    ObEventData *ed = data;
 
     /* make a copy we can mangle */
     ee = *ec;
@@ -461,8 +471,12 @@ static void event_process(const XEvent *ec, gpointer data)
 
     event_set_lasttime(e);
     event_hack_mods(e);
-    if (event_ignore(e, client))
+    if (event_ignore(e, client)) {
+        if (ed)
+            ed->ignored = TRUE;
         return;
+    } else if (ed)
+            ed->ignored = FALSE;
 
     /* deal with it in the kernel */
     if (group)
index 0d9ecf54947849eb7c5efa964c270f1402013c20..a79049106a85ceb0efc1d6282cab7bdc2f1d4811 100644 (file)
@@ -162,11 +162,8 @@ void focus_fallback(ObFocusFallbackType type)
     */
     focus_set_client(NULL);
 
-    if (!(type == OB_FOCUS_FALLBACK_DESKTOP ?
-          config_focus_last_on_desktop : config_focus_last)) {
-        if (config_focus_follow) focus_under_pointer();
+    if (config_focus_follow && focus_under_pointer())
         return;
-    }
 
     if (type == OB_FOCUS_FALLBACK_UNFOCUSING && old) {
         /* try for transient relations */
index 0caec776b760ad7da77c1e2214fd029f53e4a540..6a99cf6a2d5af162fe3aa91fdfc229bc890b5ad7 100644 (file)
@@ -24,7 +24,6 @@ void focus_shutdown(gboolean reconfig);
 void focus_set_client(struct _ObClient *client);
 
 typedef enum {
-    OB_FOCUS_FALLBACK_DESKTOP,    /*!< switching desktops */
     OB_FOCUS_FALLBACK_UNFOCUSING, /*!< forcefully remove focus from the
                                     current window */
     OB_FOCUS_FALLBACK_NOFOCUS     /*!< nothing has focus for some reason */
index f999a34b1dddf7dd32e828f6457747d38bc5c389..e5640256689949044a8c9f7b02dfda77b5043746 100644 (file)
@@ -398,7 +398,6 @@ void screen_set_desktop(guint num)
 {
     GList *it;
     guint old;
-    XEvent e;
      
     g_assert(num < screen_num_desktops);
 
@@ -435,18 +434,6 @@ void screen_set_desktop(guint num)
                 frame_hide(c->frame);
         }
     }
-
-    XSync(ob_display, FALSE);
-    /* focus the last focused window on the desktop, and ignore enter events
-       from the switch so it doesnt mess with the focus */
-    while (XCheckTypedEvent(ob_display, EnterNotify, &e));
-#ifdef DEBUG_FOCUS
-    ob_debug("switch fallback\n");
-#endif
-    focus_fallback(OB_FOCUS_FALLBACK_DESKTOP);
-#ifdef DEBUG_FOCUS
-    ob_debug("/switch fallback\n");
-#endif
 }
 
 static void get_row_col(guint d, guint *r, guint *c)
This page took 0.03128 seconds and 4 git commands to generate.