diff options
| author | Jan Djärv | 2012-12-30 20:08:15 +0100 |
|---|---|---|
| committer | Jan Djärv | 2012-12-30 20:08:15 +0100 |
| commit | 8b745d925b620fba21bd575e375ed101c17d8e29 (patch) | |
| tree | 61762bcac520c425f4469c8003fd17b8b37a6ee4 /src | |
| parent | 5a1d858bbc5410916d764e7f9c62b4e405fab592 (diff) | |
| download | emacs-8b745d925b620fba21bd575e375ed101c17d8e29.tar.gz emacs-8b745d925b620fba21bd575e375ed101c17d8e29.zip | |
Check for deprecated gtk tearoff menu item in configure.
* configure.ac: Check for GtkHandlebox.
Check for GtkTearoffMenuItem.
* src/gtkutil.c (TOOLBAR_TOP_WIDGET): New macro.
(xg_pack_tool_bar): Use TOOLBAR_TOP_WIDGET, condition out use of
handlebox_widget. Set toolbar_in_hbox to false/true, set
toolbar_is_packed to true.
(xg_update_tool_bar_sizes): Use widget returned by TOOLBAR_TOP_WIDGET.
(update_frame_tool_bar): Check toolbar_is_packed for packing.
Show all on TOOLBAR_TOP_WIDGET.
(free_frame_tool_bar): Check toolbar_is_packed. Use widget returned
by TOOLBAR_TOP_WIDGET.
(xg_change_toolbar_position): Use widget returned by TOOLBAR_TOP_WIDGET.
Check toolbar_is_packed.
(xg_have_tear_offs, tearoff_remove, tearoff_activate): Condition on
HAVE_GTK_TEAROFF_MENU_ITEM_NEW.
(xg_have_tear_offs): When ! HAVE_GTK_TEAROFF_MENU_ITEM_NEW, return
false.
(create_menus): Create tearoff only if HAVE_GTK_TEAROFF_MENU_ITEM_NEW.
(xg_update_menubar): Update title only if
HAVE_GTK_TEAROFF_MENU_ITEM_NEW.
(xg_update_submenu): Skip tearoff only if
HAVE_GTK_TEAROFF_MENU_ITEM_NEW.
(xg_initialize): Initialize xg_detached_menus only if
HAVE_GTK_TEAROFF_MENU_ITEM_NEW.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 11 | ||||
| -rw-r--r-- | src/gtkutil.c | 23 |
2 files changed, 31 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 0234af5f1ef..bb69917bfb2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -11,6 +11,17 @@ | |||
| 11 | by TOOLBAR_TOP_WIDGET. | 11 | by TOOLBAR_TOP_WIDGET. |
| 12 | (xg_change_toolbar_position): Use widget returned by TOOLBAR_TOP_WIDGET. | 12 | (xg_change_toolbar_position): Use widget returned by TOOLBAR_TOP_WIDGET. |
| 13 | Check toolbar_is_packed. | 13 | Check toolbar_is_packed. |
| 14 | (xg_have_tear_offs, tearoff_remove, tearoff_activate): Condition on | ||
| 15 | HAVE_GTK_TEAROFF_MENU_ITEM_NEW. | ||
| 16 | (xg_have_tear_offs): When ! HAVE_GTK_TEAROFF_MENU_ITEM_NEW, return | ||
| 17 | false. | ||
| 18 | (create_menus): Create tearoff only if HAVE_GTK_TEAROFF_MENU_ITEM_NEW. | ||
| 19 | (xg_update_menubar): Update title only if | ||
| 20 | HAVE_GTK_TEAROFF_MENU_ITEM_NEW. | ||
| 21 | (xg_update_submenu): Skip tearoff only if | ||
| 22 | HAVE_GTK_TEAROFF_MENU_ITEM_NEW. | ||
| 23 | (xg_initialize): Initialize xg_detached_menus only if | ||
| 24 | HAVE_GTK_TEAROFF_MENU_ITEM_NEW. | ||
| 14 | 25 | ||
| 15 | * xterm.h (struct x_output): Surround handlebox_widget with | 26 | * xterm.h (struct x_output): Surround handlebox_widget with |
| 16 | #ifdef HAVE_GTK_HANDLE_BOX_NEW. toolbar_is_packed is new, | 27 | #ifdef HAVE_GTK_HANDLE_BOX_NEW. toolbar_is_packed is new, |
diff --git a/src/gtkutil.c b/src/gtkutil.c index b957f1241b8..7b05cff71c0 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -2416,6 +2416,8 @@ make_menu_item (const char *utf8_label, | |||
| 2416 | return w; | 2416 | return w; |
| 2417 | } | 2417 | } |
| 2418 | 2418 | ||
| 2419 | #ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW | ||
| 2420 | |||
| 2419 | static int xg_detached_menus; | 2421 | static int xg_detached_menus; |
| 2420 | 2422 | ||
| 2421 | /* Return true if there are detached menus. */ | 2423 | /* Return true if there are detached menus. */ |
| @@ -2454,7 +2456,13 @@ tearoff_activate (GtkWidget *widget, gpointer client_data) | |||
| 2454 | G_CALLBACK (tearoff_remove), 0); | 2456 | G_CALLBACK (tearoff_remove), 0); |
| 2455 | } | 2457 | } |
| 2456 | } | 2458 | } |
| 2457 | 2459 | #else /* ! HAVE_GTK_TEAROFF_MENU_ITEM_NEW */ | |
| 2460 | bool | ||
| 2461 | xg_have_tear_offs (void) | ||
| 2462 | { | ||
| 2463 | return false; | ||
| 2464 | } | ||
| 2465 | #endif /* ! HAVE_GTK_TEAROFF_MENU_ITEM_NEW */ | ||
| 2458 | 2466 | ||
| 2459 | /* Create a menu item widget, and connect the callbacks. | 2467 | /* Create a menu item widget, and connect the callbacks. |
| 2460 | ITEM describes the menu item. | 2468 | ITEM describes the menu item. |
| @@ -2526,7 +2534,8 @@ xg_create_one_menuitem (widget_value *item, | |||
| 2526 | HIGHLIGHT_CB is the callback to call when entering/leaving menu items. | 2534 | HIGHLIGHT_CB is the callback to call when entering/leaving menu items. |
| 2527 | If POP_UP_P, create a popup menu. | 2535 | If POP_UP_P, create a popup menu. |
| 2528 | If MENU_BAR_P, create a menu bar. | 2536 | If MENU_BAR_P, create a menu bar. |
| 2529 | If ADD_TEAROFF_P, add a tearoff menu item. Ignored if MENU_BAR_P. | 2537 | If ADD_TEAROFF_P, add a tearoff menu item. Ignored if MENU_BAR_P or |
| 2538 | the Gtk+ version used does not have tearoffs. | ||
| 2530 | TOPMENU is the topmost GtkWidget that others shall be placed under. | 2539 | TOPMENU is the topmost GtkWidget that others shall be placed under. |
| 2531 | It may be NULL, in that case we create the appropriate widget | 2540 | It may be NULL, in that case we create the appropriate widget |
| 2532 | (menu bar or menu item depending on POP_UP_P and MENU_BAR_P) | 2541 | (menu bar or menu item depending on POP_UP_P and MENU_BAR_P) |
| @@ -2599,6 +2608,7 @@ create_menus (widget_value *data, | |||
| 2599 | "selection-done", deactivate_cb, 0); | 2608 | "selection-done", deactivate_cb, 0); |
| 2600 | } | 2609 | } |
| 2601 | 2610 | ||
| 2611 | #ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW | ||
| 2602 | if (! menu_bar_p && add_tearoff_p) | 2612 | if (! menu_bar_p && add_tearoff_p) |
| 2603 | { | 2613 | { |
| 2604 | GtkWidget *tearoff = gtk_tearoff_menu_item_new (); | 2614 | GtkWidget *tearoff = gtk_tearoff_menu_item_new (); |
| @@ -2607,6 +2617,7 @@ create_menus (widget_value *data, | |||
| 2607 | g_signal_connect (G_OBJECT (tearoff), "activate", | 2617 | g_signal_connect (G_OBJECT (tearoff), "activate", |
| 2608 | G_CALLBACK (tearoff_activate), 0); | 2618 | G_CALLBACK (tearoff_activate), 0); |
| 2609 | } | 2619 | } |
| 2620 | #endif | ||
| 2610 | 2621 | ||
| 2611 | for (item = data; item; item = item->next) | 2622 | for (item = data; item; item = item->next) |
| 2612 | { | 2623 | { |
| @@ -2897,11 +2908,13 @@ xg_update_menubar (GtkWidget *menubar, | |||
| 2897 | 2908 | ||
| 2898 | gtk_label_set_text (wlabel, utf8_label); | 2909 | gtk_label_set_text (wlabel, utf8_label); |
| 2899 | 2910 | ||
| 2911 | #ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW | ||
| 2900 | /* If this item has a submenu that has been detached, change | 2912 | /* If this item has a submenu that has been detached, change |
| 2901 | the title in the WM decorations also. */ | 2913 | the title in the WM decorations also. */ |
| 2902 | if (submenu && gtk_menu_get_tearoff_state (GTK_MENU (submenu))) | 2914 | if (submenu && gtk_menu_get_tearoff_state (GTK_MENU (submenu))) |
| 2903 | /* Set the title of the detached window. */ | 2915 | /* Set the title of the detached window. */ |
| 2904 | gtk_menu_set_title (GTK_MENU (submenu), utf8_label); | 2916 | gtk_menu_set_title (GTK_MENU (submenu), utf8_label); |
| 2917 | #endif | ||
| 2905 | 2918 | ||
| 2906 | if (utf8_label) g_free (utf8_label); | 2919 | if (utf8_label) g_free (utf8_label); |
| 2907 | iter = g_list_next (iter); | 2920 | iter = g_list_next (iter); |
| @@ -3129,7 +3142,8 @@ xg_update_submenu (GtkWidget *submenu, | |||
| 3129 | { | 3142 | { |
| 3130 | GtkWidget *w = GTK_WIDGET (iter->data); | 3143 | GtkWidget *w = GTK_WIDGET (iter->data); |
| 3131 | 3144 | ||
| 3132 | /* Skip tearoff items, they have no counterpart in val. */ | 3145 | #ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW |
| 3146 | /* Skip tearoff items, they have no counterpart in val. */ | ||
| 3133 | if (GTK_IS_TEAROFF_MENU_ITEM (w)) | 3147 | if (GTK_IS_TEAROFF_MENU_ITEM (w)) |
| 3134 | { | 3148 | { |
| 3135 | has_tearoff_p = 1; | 3149 | has_tearoff_p = 1; |
| @@ -3137,6 +3151,7 @@ xg_update_submenu (GtkWidget *submenu, | |||
| 3137 | if (iter) w = GTK_WIDGET (iter->data); | 3151 | if (iter) w = GTK_WIDGET (iter->data); |
| 3138 | else break; | 3152 | else break; |
| 3139 | } | 3153 | } |
| 3154 | #endif | ||
| 3140 | 3155 | ||
| 3141 | /* Remember first radio button in a group. If we get a mismatch in | 3156 | /* Remember first radio button in a group. If we get a mismatch in |
| 3142 | a radio group we must rebuild the whole group so that the connections | 3157 | a radio group we must rebuild the whole group so that the connections |
| @@ -4987,7 +5002,9 @@ xg_initialize (void) | |||
| 4987 | 5002 | ||
| 4988 | gdpy_def = NULL; | 5003 | gdpy_def = NULL; |
| 4989 | xg_ignore_gtk_scrollbar = 0; | 5004 | xg_ignore_gtk_scrollbar = 0; |
| 5005 | #ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW | ||
| 4990 | xg_detached_menus = 0; | 5006 | xg_detached_menus = 0; |
| 5007 | #endif | ||
| 4991 | xg_menu_cb_list.prev = xg_menu_cb_list.next = | 5008 | xg_menu_cb_list.prev = xg_menu_cb_list.next = |
| 4992 | xg_menu_item_cb_list.prev = xg_menu_item_cb_list.next = 0; | 5009 | xg_menu_item_cb_list.prev = xg_menu_item_cb_list.next = 0; |
| 4993 | 5010 | ||