]> Dogcows Code - chaz/openbox/blobdiff - src/blackbox.cc
change to match blackbox
[chaz/openbox] / src / blackbox.cc
index c93b28a6331683a727333f07ac746234483e31a1..56782248dddd5b9a3ef6802df26ef17e8f20cd0c 100644 (file)
@@ -90,6 +90,8 @@ extern "C" {
 #endif // HAVE_LIBGEN_H
 }
 
+#include <assert.h>
+
 #include <algorithm>
 #include <string>
 using std::string;
@@ -559,11 +561,14 @@ void Blackbox::process_event(XEvent *e) {
   }
 
   case FocusIn: {
-    if (e->xfocus.detail != NotifyNonlinear) {
+    if (e->xfocus.detail != NotifyNonlinear &&
+        e->xfocus.detail != NotifyAncestor) {
       /*
         don't process FocusIns when:
         1. the new focus window isn't an ancestor or inferior of the old
         focus window (NotifyNonlinear)
+        make sure to allow the FocusIn when the old focus window was an
+        ancestor but didn't have a parent, such as root (NotifyAncestor)
       */
       break;
     }
@@ -650,7 +655,7 @@ void Blackbox::process_event(XEvent *e) {
 
   case ClientMessage: {
     if (e->xclient.format == 32) {
-      if (e->xclient.message_type == getWMChangeStateAtom()) {
+      if (e->xclient.message_type == xatom->getAtom(XAtom::wm_change_state)) {
         BlackboxWindow *win = searchWindow(e->xclient.window);
         if (! win || ! win->validateClient()) return;
 
@@ -661,10 +666,9 @@ void Blackbox::process_event(XEvent *e) {
       } else if(e->xclient.message_type == getBlackboxChangeWorkspaceAtom()) {
         BScreen *screen = searchScreen(e->xclient.window);
 
-        if (screen && e->xclient.data.l[0] >= 0 &&
-            e->xclient.data.l[0] <
-            static_cast<signed>(screen->getWorkspaceCount()))
-          screen->changeWorkspaceID(e->xclient.data.l[0]);
+        unsigned int workspace = e->xclient.data.l[0];
+        if (screen && workspace < screen->getWorkspaceCount())
+          screen->changeWorkspaceID(workspace);
       } else if (e->xclient.message_type == getBlackboxChangeWindowFocusAtom()) {
         BlackboxWindow *win = searchWindow(e->xclient.window);
 
This page took 0.024864 seconds and 4 git commands to generate.