]> Dogcows Code - chaz/openbox/blobdiff - openbox/client_menu.c
very cool struts. partial struts actually are partial struts now. possibly way broken...
[chaz/openbox] / openbox / client_menu.c
index 80feb2a15096215e166f817d74ab9491bdab5fc3..ce29db10b5945d0ad0220a507391b8103b74a4bd 100644 (file)
 #include "debug.h"
 #include "menu.h"
 #include "menuframe.h"
+#include "config.h"
 #include "screen.h"
 #include "client.h"
 #include "openbox.h"
 #include "frame.h"
 #include "moveresize.h"
+#include "event.h"
 #include "prop.h"
 #include "gettext.h"
 
@@ -90,7 +92,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;
@@ -104,16 +106,21 @@ static void client_menu_execute(ObMenuEntry *e, ObMenuFrame *f,
                                 ObClient *c, guint state, gpointer data,
                                 Time time)
 {
-    GList *it;
+    gint x, y;
+    gulong ignore_start;
 
     g_assert(c);
 
+    if (!config_focus_under_mouse)
+        ignore_start = event_start_ignore_all_enters();
+
     switch (e->id) {
     case CLIENT_ICONIFY:
-        client_iconify(c, TRUE, FALSE);
         /* the client won't be on screen anymore so hide the menu */
         menu_frame_hide_all();
         f = NULL; /* and don't update */
+
+        client_iconify(c, TRUE, FALSE, FALSE);
         break;
     case CLIENT_RESTORE:
         client_maximize(c, FALSE, 0);
@@ -128,10 +135,22 @@ static void client_menu_execute(ObMenuEntry *e, ObMenuFrame *f,
         client_set_undecorated(c, !c->undecorated);
         break;
     case CLIENT_MOVE:
-        moveresize_start(c,0,0,0, prop_atoms.net_wm_moveresize_move_keyboard);
+        /* this needs to grab the keyboard so hide the menu */
+        menu_frame_hide_all();
+        f = NULL; /* and don't update */
+
+        screen_pointer_pos(&x, &y);
+        moveresize_start(c, x, y, 0,
+                         prop_atoms.net_wm_moveresize_move_keyboard);
         break;
     case CLIENT_RESIZE:
-        moveresize_start(c,0,0,0,prop_atoms.net_wm_moveresize_size_keyboard);
+        /* this needs to grab the keyboard so hide the menu */
+        menu_frame_hide_all();
+        f = NULL; /* and don't update */
+
+        screen_pointer_pos(&x, &y);
+        moveresize_start(c, x, y, 0,
+                         prop_atoms.net_wm_moveresize_size_keyboard);
         break;
     case CLIENT_CLOSE:
         client_close(c);
@@ -140,6 +159,9 @@ static void client_menu_execute(ObMenuEntry *e, ObMenuFrame *f,
         g_assert_not_reached();
     }
 
+    if (!config_focus_under_mouse)
+        event_end_ignore_all_enters(ignore_start);
+
     /* update the menu cuz stuff can have changed */
     if (f) {
         client_menu_update(f, NULL);
@@ -163,13 +185,13 @@ static gboolean layer_menu_update(ObMenuFrame *frame, gpointer data)
         if (e->type == OB_MENU_ENTRY_TYPE_NORMAL) {
             switch (e->id) {
             case LAYER_TOP:
-                *en = !c->above;
+                *en = !c->above && (c->functions & OB_CLIENT_FUNC_ABOVE);
                 break;
             case LAYER_NORMAL:
                 *en = c->above || c->below;
                 break;
             case LAYER_BOTTOM:
-                *en = !c->below;
+                *en = !c->below && (c->functions & OB_CLIENT_FUNC_BELOW);
                 break;
             default:
                 *en = TRUE;
@@ -183,22 +205,30 @@ static void layer_menu_execute(ObMenuEntry *e, ObMenuFrame *f,
                                ObClient *c, guint state, gpointer data,
                                Time time)
 {
+    gulong ignore_start;
+
     g_assert(c);
 
+    if (!config_focus_under_mouse)
+        ignore_start = event_start_ignore_all_enters();
+
     switch (e->id) {
     case LAYER_TOP:
-        client_set_layer(f->client, 1);
+        client_set_layer(c, 1);
         break;
     case LAYER_NORMAL:
-        client_set_layer(f->client, 0);
+        client_set_layer(c, 0);
         break;
     case LAYER_BOTTOM:
-        client_set_layer(f->client, -1);
+        client_set_layer(c, -1);
         break;
     default:
         g_assert_not_reached();
     }
 
+    if (!config_focus_under_mouse)
+        event_end_ignore_all_enters(ignore_start);
+
     /* update the menu cuz stuff can have changed */
     if (f) {
         layer_menu_update(f, NULL);
@@ -378,13 +408,7 @@ void client_menu_startup()
     e->data.normal.mask_disabled_selected_color =
         ob_rr_theme->menu_disabled_selected_color;
 
-    e = menu_add_normal(menu, CLIENT_SHADE, _("&Roll up/down"), NULL, TRUE);
-    e->data.normal.mask = ob_rr_theme->shade_mask;
-    e->data.normal.mask_normal_color = ob_rr_theme->menu_color;
-    e->data.normal.mask_selected_color = ob_rr_theme->menu_selected_color;
-    e->data.normal.mask_disabled_color = ob_rr_theme->menu_disabled_color;
-    e->data.normal.mask_disabled_selected_color =
-        ob_rr_theme->menu_disabled_selected_color;
+    menu_add_normal(menu, CLIENT_SHADE, _("&Roll up/down"), NULL, TRUE);
 
     menu_add_normal(menu, CLIENT_DECORATE, _("Un/&Decorate"), NULL, TRUE);
 
This page took 0.023744 seconds and 4 git commands to generate.