merge r6595-6597 from trunk
authorDana Jansens <danakj@orodu.net>
Thu, 17 May 2007 02:30:13 +0000 (02:30 +0000)
committerDana Jansens <danakj@orodu.net>
Thu, 17 May 2007 02:30:13 +0000 (02:30 +0000)
openbox/action.c
openbox/client.c
openbox/client.h
openbox/client_menu.c
openbox/event.c
openbox/event.h

index 60af74b5e4723a879b3c97e5038cd149f1ca4925..431b88c1de05606512fa29dcf529aee8549d9e92 100644 (file)
@@ -40,9 +40,6 @@
 
 inline void client_action_start(union ActionData *data)
 {
-    if (config_focus_follow)
-        if (data->any.context != OB_FRAME_CONTEXT_CLIENT && !data->any.button)
-            grab_pointer(FALSE, FALSE, OB_CURSOR_NONE);
 }
 
 inline void client_action_end(union ActionData *data)
@@ -50,7 +47,7 @@ inline void client_action_end(union ActionData *data)
     if (config_focus_follow)
         if (data->any.context != OB_FRAME_CONTEXT_CLIENT) {
             if (!data->any.button) {
-                ungrab_pointer();
+                event_ignore_queued_enters();
             } else {
                 ObClient *c;
 
index f1cbdc8d13ff024fe72529a1c2ff18992d84a34a..addaed44f8c1f14fd531bb1570c6766446c3d1ae 100644 (file)
@@ -1585,7 +1585,8 @@ void client_setup_decor_and_functions(ObClient *self)
          OB_CLIENT_FUNC_SHADE |
          OB_CLIENT_FUNC_CLOSE |
          OB_CLIENT_FUNC_BELOW |
-         OB_CLIENT_FUNC_ABOVE);
+         OB_CLIENT_FUNC_ABOVE |
+         OB_CLIENT_FUNC_UNDECORATE);
 
     if (!(self->min_size.width < self->max_size.width ||
           self->min_size.height < self->max_size.height))
@@ -1684,6 +1685,11 @@ void client_setup_decor_and_functions(ObClient *self)
     if (self->max_vert && self->max_horz)
         self->decorations &= ~(OB_FRAME_DECOR_HANDLE | OB_FRAME_DECOR_GRIPS);
 
+    /* If there are no decorations to remove, don't allow the user to try
+       toggle the state */
+    if (self->decorations == 0)
+        self->functions &= ~OB_CLIENT_FUNC_UNDECORATE;
+
     /* finally, the user can have requested no decorations, which overrides
        everything (but doesnt give it a border if it doesnt have one) */
     if (self->undecorated) {
@@ -3272,10 +3278,6 @@ void client_set_state(ObClient *self, Atom action, glong data1, glong data2)
         }
     }
 
-    /* Grab pointer across these, so it is the same as actions. Enter events
-       won't be generated by the windows moving around */
-    grab_pointer(FALSE, FALSE, OB_CURSOR_NONE);
-
     if (max_horz != self->max_horz || max_vert != self->max_vert) {
         if (max_horz != self->max_horz && max_vert != self->max_vert) {
             /* toggling both */
@@ -3313,19 +3315,11 @@ void client_set_state(ObClient *self, Atom action, glong data1, glong data2)
            transients needs to change */
         stacking_raise(CLIENT_AS_WINDOW(self));
 
-        /* These things below can change focus so we can't grab pointer for
-           them. Note how we have two ungrab_pointers.. */
-        ungrab_pointer();
-
         /* it also may get focused. if something is focused that shouldn't
            be focused anymore, then move the focus */
         if (focus_client && client_focus_target(focus_client) != focus_client)
             client_focus(focus_client);
     }
-    else
-        /* These things below can change focus so we can't grab pointer for
-           them. Note how we have two ungrab_pointers.. */
-        ungrab_pointer();
 
     if (iconic != self->iconic)
         client_iconify(self, iconic, FALSE, FALSE);
@@ -3583,7 +3577,11 @@ void client_set_layer(ObClient *self, gint layer)
 
 void client_set_undecorated(ObClient *self, gboolean undecorated)
 {
-    if (self->undecorated != undecorated) {
+    if (self->undecorated != undecorated &&
+        /* don't let it undecorate if the function is missing, but let 
+           it redecorate */
+        (self->functions & OB_CLIENT_FUNC_UNDECORATE || !undecorated))
+    {
         self->undecorated = undecorated;
         client_setup_decor_and_functions(self);
         client_change_state(self); /* reflect this in the state hints */
index 2cc64a5c26fb8b3d90a58b16d386b452f91a0072..05153eb0008fa14dc0523a1d431c97382bf537c4 100644 (file)
@@ -73,7 +73,8 @@ typedef enum
     OB_CLIENT_FUNC_FULLSCREEN = 1 << 5, /*!< Allow to be made fullscreen */
     OB_CLIENT_FUNC_CLOSE      = 1 << 6, /*!< Allow to be closed */
     OB_CLIENT_FUNC_ABOVE      = 1 << 7, /*!< Allow to be put in lower layer */
-    OB_CLIENT_FUNC_BELOW      = 1 << 8  /*!< Allow to be put in higher layer */
+    OB_CLIENT_FUNC_BELOW      = 1 << 8, /*!< Allow to be put in higher layer */
+    OB_CLIENT_FUNC_UNDECORATE = 1 << 9  /*!< Allow to be undecorated */
 } ObFunctions;
 
 struct _ObClient
index 499bb9128ad8375d8ce414731c3d43fca1cfee3f..6fa744c41b8545790886c873251a921e4b4f7b6a 100644 (file)
@@ -24,6 +24,7 @@
 #include "openbox.h"
 #include "frame.h"
 #include "moveresize.h"
+#include "event.h"
 #include "prop.h"
 #include "gettext.h"
 
@@ -90,7 +91,7 @@ static gboolean client_menu_update(ObMenuFrame *frame, gpointer data)
                 *en = c->functions & OB_CLIENT_FUNC_CLOSE;
                 break;
             case CLIENT_DECORATE:
-                *en = client_normal(c);
+                *en = c->functions & OB_CLIENT_FUNC_UNDECORATE;
                 break;
             default:
                 *en = TRUE;
@@ -118,15 +119,19 @@ static void client_menu_execute(ObMenuEntry *e, ObMenuFrame *f,
         break;
     case CLIENT_RESTORE:
         client_maximize(c, FALSE, 0);
+        event_ignore_queued_enters();
         break;
     case CLIENT_MAXIMIZE:
         client_maximize(c, TRUE, 0);
+        event_ignore_queued_enters();
         break;
     case CLIENT_SHADE:
         client_shade(c, !c->shaded);
+        event_ignore_queued_enters();
         break;
     case CLIENT_DECORATE:
         client_set_undecorated(c, !c->undecorated);
+        event_ignore_queued_enters();
         break;
     case CLIENT_MOVE:
         /* this needs to grab the keyboard so hide the menu */
@@ -212,6 +217,8 @@ static void layer_menu_execute(ObMenuEntry *e, ObMenuFrame *f,
         g_assert_not_reached();
     }
 
+    event_ignore_queued_enters();
+
     /* update the menu cuz stuff can have changed */
     if (f) {
         layer_menu_update(f, NULL);
index 6a5e3540e175d515c34a260bcb1bfee5ce9a1740..7b8793fa8bc0e28aaa0a59e3d3c7bf943a7dc643 100644 (file)
@@ -1082,11 +1082,10 @@ static void event_handle_client(ObClient *client, XEvent *e)
 
         if (config) {
             client_find_onscreen(client, &x, &y, w, h, FALSE);
-
-            /* don't create enter events from clients moving themselves */
-            grab_pointer(FALSE, FALSE, OB_CURSOR_NONE);
             client_configure(client, x, y, w, h, FALSE, TRUE);
-            ungrab_pointer();
+
+            /* ignore enter events caused by these like ob actions do */
+            event_ignore_queued_enters();
         }
         break;
     }
@@ -1180,6 +1179,9 @@ static void event_handle_client(ObClient *client, XEvent *e)
                      client->window);
             client_set_state(client, e->xclient.data.l[0],
                              e->xclient.data.l[1], e->xclient.data.l[2]);
+
+            /* ignore enter events caused by these like ob actions do */
+            event_ignore_queued_enters();
         } else if (msgtype == prop_atoms.net_close_window) {
             ob_debug("net_close_window for 0x%lx\n", client->window);
             client_close(client);
@@ -1264,10 +1266,10 @@ static void event_handle_client(ObClient *client, XEvent *e)
             client_convert_gravity(client, grav, &x, &y, w, h);
             client_find_onscreen(client, &x, &y, w, h, FALSE);
 
-            /* don't create enter events from clients moving themselves */
-            grab_pointer(FALSE, FALSE, OB_CURSOR_NONE);
             client_configure(client, x, y, w, h, FALSE, TRUE);
-            ungrab_pointer();
+
+            /* ignore enter events caused by these like ob actions do */
+            event_ignore_queued_enters();
         } else if (msgtype == prop_atoms.net_restack_window) {
             if (e->xclient.data.l[0] != 2) {
                 ob_debug_type(OB_DEBUG_APP_BUGS,
index 08ee0c1ce094cbac678586b8ffa23e16904be341..4fdf292e511e3f41c025d11a0c919bcdc0390c21 100644 (file)
@@ -51,7 +51,4 @@ void event_halt_focus_delay();
   comes at the same time or later than t2. */
 gboolean event_time_after(Time t1, Time t2);
 
-/*! Used with XCheckIfEvent to find a focusin event on a client window */
-Bool event_look_for_focusin_client(Display *d, XEvent *e, XPointer arg);
-
 #endif