emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111381: Check for deprecated gtk tea


From: Jan D.
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111381: Check for deprecated gtk tearoff menu item in configure.
Date: Sun, 30 Dec 2012 20:08:15 +0100
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111381
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Sun 2012-12-30 20:08:15 +0100
message:
  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.
modified:
  ChangeLog
  configure.ac
  src/ChangeLog
  src/gtkutil.c
=== modified file 'ChangeLog'
--- a/ChangeLog 2012-12-30 18:44:00 +0000
+++ b/ChangeLog 2012-12-30 19:08:15 +0000
@@ -1,6 +1,7 @@
 2012-12-30  Jan Djärv  <address@hidden>
 
        * configure.ac: Check for GtkHandlebox.
+       Check for GtkTearoffMenuItem.
 
 2012-12-30  Andreas Schwab  <address@hidden>
 

=== modified file 'configure.ac'
--- a/configure.ac      2012-12-30 18:44:00 +0000
+++ b/configure.ac      2012-12-30 19:08:15 +0000
@@ -2080,6 +2080,15 @@
     AC_CHECK_FUNCS(gtk_handle_box_new)
   fi
 
+  dnl Same as above for gtk_tearoff_menu_item.
+  HAVE_GTK_TEAROFF_MENU_ITEM=no
+  AC_CHECK_DECL(GTK_TYPE_TEAROFF_MENU_ITEM, HAVE_GTK_TEAROFF_MENU_ITEM=yes,
+                   HAVE_GTK_TEAROFF_MENU_ITEM=no, [AC_INCLUDES_DEFAULT
+#include <gtk/gtk.h>])
+  if test "$HAVE_GTK_TEAROFF_MENU_ITEM" = yes; then
+    AC_CHECK_FUNCS(gtk_tearoff_menu_item_new)
+  fi
+
   dnl Check for functions introduced in 2.14 and later.
   AC_CHECK_FUNCS(gtk_widget_get_window gtk_widget_set_has_window \
                  gtk_dialog_get_action_area gtk_widget_get_sensitive \

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-12-30 18:44:00 +0000
+++ b/src/ChangeLog     2012-12-30 19:08:15 +0000
@@ -11,6 +11,17 @@
        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.
 
        * xterm.h (struct x_output): Surround handlebox_widget with
        #ifdef HAVE_GTK_HANDLE_BOX_NEW.  toolbar_is_packed is new,

=== modified file 'src/gtkutil.c'
--- a/src/gtkutil.c     2012-12-30 18:44:00 +0000
+++ b/src/gtkutil.c     2012-12-30 19:08:15 +0000
@@ -2416,6 +2416,8 @@
   return w;
 }
 
+#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW
+
 static int xg_detached_menus;
 
 /* Return true if there are detached menus.  */
@@ -2454,7 +2456,13 @@
                         G_CALLBACK (tearoff_remove), 0);
     }
 }
-
+#else /* ! HAVE_GTK_TEAROFF_MENU_ITEM_NEW */
+bool
+xg_have_tear_offs (void)
+{
+  return false;
+}
+#endif /* ! HAVE_GTK_TEAROFF_MENU_ITEM_NEW */
 
 /* Create a menu item widget, and connect the callbacks.
    ITEM describes the menu item.
@@ -2526,7 +2534,8 @@
    HIGHLIGHT_CB is the callback to call when entering/leaving menu items.
    If POP_UP_P, create a popup menu.
    If MENU_BAR_P, create a menu bar.
-   If ADD_TEAROFF_P, add a tearoff menu item.  Ignored if MENU_BAR_P.
+   If ADD_TEAROFF_P, add a tearoff menu item.  Ignored if MENU_BAR_P or
+   the Gtk+ version used does not have tearoffs.
    TOPMENU is the topmost GtkWidget that others shall be placed under.
    It may be NULL, in that case we create the appropriate widget
    (menu bar or menu item depending on POP_UP_P and MENU_BAR_P)
@@ -2599,6 +2608,7 @@
                           "selection-done", deactivate_cb, 0);
     }
 
+#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW
   if (! menu_bar_p && add_tearoff_p)
     {
       GtkWidget *tearoff = gtk_tearoff_menu_item_new ();
@@ -2607,6 +2617,7 @@
       g_signal_connect (G_OBJECT (tearoff), "activate",
                         G_CALLBACK (tearoff_activate), 0);
     }
+#endif
 
   for (item = data; item; item = item->next)
     {
@@ -2897,11 +2908,13 @@
 
           gtk_label_set_text (wlabel, utf8_label);
 
+#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW
           /* If this item has a submenu that has been detached, change
              the title in the WM decorations also.  */
           if (submenu && gtk_menu_get_tearoff_state (GTK_MENU (submenu)))
             /* Set the title of the detached window.  */
             gtk_menu_set_title (GTK_MENU (submenu), utf8_label);
+#endif
 
           if (utf8_label) g_free (utf8_label);
           iter = g_list_next (iter);
@@ -3129,7 +3142,8 @@
   {
     GtkWidget *w = GTK_WIDGET (iter->data);
 
-    /* Skip tearoff items, they have no counterpart in val.  */
+#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW
+  /* Skip tearoff items, they have no counterpart in val.  */
     if (GTK_IS_TEAROFF_MENU_ITEM (w))
       {
         has_tearoff_p = 1;
@@ -3137,6 +3151,7 @@
         if (iter) w = GTK_WIDGET (iter->data);
         else break;
       }
+#endif
 
     /* Remember first radio button in a group.  If we get a mismatch in
        a radio group we must rebuild the whole group so that the connections
@@ -4987,7 +5002,9 @@
 
   gdpy_def = NULL;
   xg_ignore_gtk_scrollbar = 0;
+#ifdef HAVE_GTK_TEAROFF_MENU_ITEM_NEW
   xg_detached_menus = 0;
+#endif
   xg_menu_cb_list.prev = xg_menu_cb_list.next =
     xg_menu_item_cb_list.prev = xg_menu_item_cb_list.next = 0;
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]