]> git.lizzy.rs Git - bspwm.git/blobdiff - events.c
Fix code block formatting
[bspwm.git] / events.c
index 803b42fab7fbd5ef2f21f77de9770a153216fb77..1e8c8292a5da29d9285b55e36ce6e55af79c8848 100644 (file)
--- a/events.c
+++ b/events.c
@@ -1,16 +1,15 @@
-/*
- * Copyright (c) 2012-2014, Bastien Dejean
+/* Copyright (c) 2012, Bastien Dejean
  * All rights reserved.
- * 
+ *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
- * 
+ *
  * 1. Redistributions of source code must retain the above copyright notice, this
  *    list of conditions and the following disclaimer.
  * 2. Redistributions in binary form must reproduce the above copyright notice,
  *    this list of conditions and the following disclaimer in the documentation
  *    and/or other materials provided with the distribution.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * 
- * The views and conclusions contained in the software and documentation are those
- * of the authors and should not be interpreted as representing official policies,
- * either expressed or implied, of the FreeBSD Project.
  */
 
 #include <stdlib.h>
@@ -70,7 +65,7 @@ void handle_event(xcb_generic_event_t *evt)
                        break;
                default:
                        if (randr && resp_type == randr_base + XCB_RANDR_SCREEN_CHANGE_NOTIFY)
-                               import_monitors();
+                               update_monitors();
                        break;
        }
 }
@@ -277,7 +272,8 @@ void client_message(xcb_generic_event_t *evt)
                handle_state(loc.monitor, loc.desktop, loc.node, e->data.data32[1], e->data.data32[0]);
                handle_state(loc.monitor, loc.desktop, loc.node, e->data.data32[2], e->data.data32[0]);
        } else if (e->type == ewmh->_NET_ACTIVE_WINDOW) {
-               if (ignore_ewmh_focus || loc.node == mon->desk->focus)
+               if ((ignore_ewmh_focus && e->data.data32[0] == XCB_EWMH_CLIENT_SOURCE_TYPE_NORMAL) ||
+                   loc.node == mon->desk->focus)
                        return;
                if (loc.desktop->focus->client->fullscreen && loc.desktop->focus != loc.node) {
                        set_fullscreen(loc.desktop->focus, false);
@@ -351,15 +347,18 @@ void motion_notify(xcb_generic_event_t *evt)
        xcb_point_t pt = {e->root_x, e->root_y};
        query_pointer(&win, NULL);
 
-       bool backup = pointer_follows_monitor;
+       bool pfm_backup = pointer_follows_monitor;
+       bool pff_backup = pointer_follows_focus;
        auto_raise = false;
        pointer_follows_monitor = false;
+       pointer_follows_focus = false;
        if (!window_focus(win)) {
                monitor_t *m = monitor_from_point(pt);
                if (m != NULL && m != mon)
                        focus_node(m, m->desk, m->desk->focus);
        }
-       pointer_follows_monitor = backup;
+       pointer_follows_monitor = pfm_backup;
+       pointer_follows_focus = pff_backup;
        auto_raise = true;
 }