only set focus on clients which are visible during client eval
authorMike Blumenkrantz <zmike@osg.samsung.com>
Mon, 21 Sep 2015 22:19:03 +0000 (18:19 -0400)
committerMike Blumenkrantz <zmike@osg.samsung.com>
Mon, 21 Sep 2015 23:19:01 +0000 (19:19 -0400)
focusing a client will automatically uniconify and desk flip, so
setting focus on a hidden client should be avoided during eval since
these focus-sets are not "user triggered"

this fixes issues where clients could randomly grab focus from other
desks and also restores expected behavior when restarting e on an
empty vdesk

src/bin/e_client.c

index b0dfc7d..669712d 100644 (file)
@@ -2203,14 +2203,12 @@ _e_client_eval(E_Client *ec)
                  ec->changes.need_maximize || ec->changes.need_unmaximize;
    ec->changes.stack = 0;
 
-   if ((!ec->input_only) && ((ec->take_focus) || (ec->want_focus)))
+   if ((!ec->input_only) && (!ec->iconic) &&
+       ((!ec->zone) || e_client_util_desk_visible(ec, e_desk_current_get(ec->zone))) &&
+       ((ec->take_focus) || (ec->want_focus)))
      {
-        ec->take_focus = 0;
         if ((e_config->focus_setting == E_FOCUS_NEW_WINDOW) || (ec->want_focus))
-          {
-             ec->want_focus = 0;
-             e_client_focus_set_with_pointer(ec);
-          }
+          e_client_focus_set_with_pointer(ec);
         else if (ec->dialog)
           {
              if ((e_config->focus_setting == E_FOCUS_NEW_DIALOG) ||
@@ -2239,6 +2237,8 @@ _e_client_eval(E_Client *ec)
                }
           }
      }
+   else
+     ec->take_focus = ec->want_focus = 0;
 
    if (ec->changes.need_maximize)
      {