summaryrefslogtreecommitdiff
path: root/src/menu.c
diff options
context:
space:
mode:
authorrhp <rhp>2001-06-07 05:18:10 +0000
committerrhp <rhp>2001-06-07 05:18:10 +0000
commit0feac37c5b23870dbd1bdd3ac30e9f5435820217 (patch)
tree0ee727eb83388ec2e99ead6a545da3b6fe492d11 /src/menu.c
parent834452ca2c2cde16bd11351e90df44cbe20c96bf (diff)
downloadmetacity-0feac37c5b23870dbd1bdd3ac30e9f5435820217.tar.gz
...
Diffstat (limited to 'src/menu.c')
-rw-r--r--src/menu.c47
1 files changed, 44 insertions, 3 deletions
diff --git a/src/menu.c b/src/menu.c
index 292e9948..81015dd6 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -176,15 +176,56 @@ meta_window_menu_hide (void)
}
static void
+close_window (GdkWindow *window)
+{
+ XClientMessageEvent ev;
+
+ ev.type = ClientMessage;
+ ev.window = GDK_WINDOW_XID (window);
+ ev.message_type = gdk_atom_intern ("_NET_CLOSE_WINDOW", FALSE);
+ ev.format = 32;
+ ev.data.l[0] = 0;
+ ev.data.l[1] = 0;
+
+ gdk_error_trap_push ();
+ XSendEvent (gdk_display,
+ gdk_root_window, False,
+ SubstructureNotifyMask | SubstructureRedirectMask,
+ (XEvent*) &ev);
+ gdk_flush ();
+ gdk_error_trap_pop ();
+}
+
+static void
activate_cb (GtkWidget *menuitem, gpointer data)
{
MenuData *md;
md = data;
- meta_ui_warning ("Activated menuitem\n");
-
- gtk_widget_destroy (menu);
+ switch (md->op)
+ {
+ case META_MESSAGE_MENU_DELETE:
+ close_window (md->window);
+ break;
+
+ case META_MESSAGE_MENU_MINIMIZE:
+ break;
+
+ case META_MESSAGE_MENU_MAXIMIZE:
+ gdk_error_trap_push ();
+ gdk_window_maximize (md->window);
+ gdk_flush ();
+ gdk_error_trap_pop ();
+ break;
+
+ default:
+ meta_ui_warning (G_STRLOC": Unknown window op\n");
+ break;
+ }
+
+ if (menu)
+ gtk_widget_destroy (menu);
g_object_unref (G_OBJECT (md->window));
g_free (md);
}