]> Dogcows Code - chaz/openbox/blobdiff - openbox/client_menu.c
make maximize work when its not-fullmax
[chaz/openbox] / openbox / client_menu.c
index da6ac2d9994ae9a81ae117c4161a3e66688be816..f6eb941684f959c6920dc532e29b5e57e8a3a1b2 100644 (file)
@@ -74,7 +74,7 @@ static gboolean client_update(ObMenuFrame *frame, gpointer data)
     e = menu_find_entry_id(menu, CLIENT_MAXIMIZE);
     e->data.normal.enabled =
         (frame->client->functions & OB_CLIENT_FUNC_MAXIMIZE) &&
-        !frame->client->max_horz && !frame->client->max_vert;
+        (!frame->client->max_horz || !frame->client->max_vert);
 
     e = menu_find_entry_id(menu, CLIENT_SHADE);
     e->data.normal.enabled = frame->client->functions & OB_CLIENT_FUNC_SHADE;
@@ -125,7 +125,7 @@ static gboolean send_to_update(ObMenuFrame *frame, gpointer data)
     guint i;
     GSList *acts;
     ObAction *act;
-    ObMenuEntry *e;;
+    ObMenuEntry *e;
 
     menu_clear_entries(menu);
 
@@ -169,6 +169,25 @@ static gboolean send_to_update(ObMenuFrame *frame, gpointer data)
     return TRUE; /* show the menu */
 }
 
+static void desktop_change_callback(ObClient *c, gpointer data)
+{
+    ObMenuFrame *frame = data;
+    if (c == frame->client) {
+        /* the client won't even be on the screen anymore, so hide the menu */
+        menu_frame_hide_all();
+    }
+}
+
+static void show_callback(ObMenuFrame *frame, gpointer data)
+{
+    client_add_desktop_notify(desktop_change_callback, frame);
+}
+
+static void hide_callback(ObMenuFrame *frame, gpointer data)
+{
+    client_remove_desktop_notify(desktop_change_callback);
+}
+
 static void client_menu_place(ObMenuFrame *frame, gint *x, gint *y,
                               gint button, gpointer data)
 {
@@ -259,6 +278,8 @@ void client_menu_startup()
 
     menu = menu_new(SEND_TO_MENU_NAME, _("&Send to desktop"), TRUE, NULL);
     menu_set_update_func(menu, send_to_update);
+    menu_set_show_func(menu, show_callback);
+    menu_set_hide_func(menu, hide_callback);
 
 
     menu = menu_new(CLIENT_MENU_NAME, _("Client menu"), TRUE, NULL);
@@ -267,7 +288,7 @@ void client_menu_startup()
     menu_set_place_func(menu, client_menu_place);
 
     acts = g_slist_prepend(NULL, action_from_string
-                           ("ToggleMaximizeFull",
+                           ("UnmaximizeFull",
                             OB_USER_ACTION_MENU_SELECTION));
     e = menu_add_normal(menu, CLIENT_RESTORE, _("R&estore"), acts, TRUE);
     e->data.normal.mask = ob_rr_theme->max_toggled_mask; 
@@ -296,7 +317,7 @@ void client_menu_startup()
         ob_rr_theme->menu_disabled_selected_color;
 
     acts = g_slist_prepend(NULL, action_from_string
-                           ("ToggleMaximizeFull",
+                           ("MaximizeFull",
                             OB_USER_ACTION_MENU_SELECTION));
     e = menu_add_normal(menu, CLIENT_MAXIMIZE, _("Ma&ximize"), acts, TRUE);
     e->data.normal.mask = ob_rr_theme->max_mask; 
This page took 0.025144 seconds and 4 git commands to generate.