diff options
author | Laszlo Boros <[email protected]> | 2013-10-26 14:27:58 +0200 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2013-10-26 14:27:58 +0200 |
commit | 35d540dd3c9269ec39bf3bc10a98b9714963291b (patch) | |
tree | ae76b286839a6d3a6ebe309bdb7884bd35a3698d /src/ui/menu.c | |
parent | 46ba8ca5fc9665c1a4758e56fda6761ac993c62e (diff) | |
download | marco-35d540dd3c9269ec39bf3bc10a98b9714963291b.tar.bz2 marco-35d540dd3c9269ec39bf3bc10a98b9714963291b.tar.xz |
Starting to add GTK3 support
Diffstat (limited to 'src/ui/menu.c')
-rw-r--r-- | src/ui/menu.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/ui/menu.c b/src/ui/menu.c index d98a33d3..2b6dfe83 100644 --- a/src/ui/menu.c +++ b/src/ui/menu.c @@ -390,10 +390,19 @@ meta_window_menu_new (MetaFrames *frames, meta_verbose ("Creating %d-workspace menu current space %lu\n", n_workspaces, active_workspace); + #if GTK_CHECK_VERSION(3, 0, 0) + GdkWindow* window = gtk_widget_get_window(GTK_WIDGET(frames)); + + display = GDK_WINDOW_XDISPLAY (window); + + screen = gdk_window_get_screen (window); + xroot = GDK_WINDOW_XID (gdk_screen_get_root_window (screen)); + #else display = gdk_x11_drawable_get_xdisplay (GTK_WIDGET (frames)->window); screen = gdk_drawable_get_screen (GTK_WIDGET (frames)->window); xroot = GDK_DRAWABLE_XID (gdk_screen_get_root_window (screen)); + #endif submenu = gtk_menu_new (); @@ -435,12 +444,20 @@ meta_window_menu_new (MetaFrames *frames, "workspace", GINT_TO_POINTER (j)); + #if GTK_CHECK_VERSION(3, 0, 0) + g_signal_connect_data (G_OBJECT (submi), + "activate", + G_CALLBACK (activate_cb), + md, + (GClosureNotify) g_free, 0); + #else gtk_signal_connect_full (GTK_OBJECT (submi), "activate", G_CALLBACK (activate_cb), NULL, md, g_free, FALSE, FALSE); + #endif gtk_menu_shell_append (GTK_MENU_SHELL (submenu), submi); @@ -463,12 +480,20 @@ meta_window_menu_new (MetaFrames *frames, md->menu = menu; md->op = menuitem.op; + #if GTK_CHECK_VERSION(3, 0, 0) + g_signal_connect_data (G_OBJECT (mi), + "activate", + G_CALLBACK (activate_cb), + md, + (GClosureNotify) g_free, 0); + #else gtk_signal_connect_full (GTK_OBJECT (mi), "activate", G_CALLBACK (activate_cb), NULL, md, g_free, FALSE, FALSE); + #endif } if (mi) @@ -496,7 +521,11 @@ void meta_window_menu_popup(MetaWindowMenu* menu, int root_x, int root_y, int bu gtk_menu_popup(GTK_MENU (menu->menu), NULL, NULL, popup_position_func, pt, button, timestamp); + #if GTK_CHECK_VERSION(3, 0, 0) + if (!gtk_widget_get_visible (menu->menu)) + #else if (!GTK_MENU_SHELL(menu->menu)->have_xgrab) + #endif { meta_warning("GtkMenu failed to grab the pointer\n"); } |