emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/src/xmenu.c


From: Dave Love
Subject: [Emacs-diffs] Changes to emacs/src/xmenu.c
Date: Mon, 02 Jun 2003 14:48:44 -0400

Index: emacs/src/xmenu.c
diff -c emacs/src/xmenu.c:1.247 emacs/src/xmenu.c:1.248
*** emacs/src/xmenu.c:1.247     Sat May 24 18:09:50 2003
--- emacs/src/xmenu.c   Mon Jun  2 14:48:43 2003
***************
*** 68,73 ****
--- 68,75 ----
  #include "dispextern.h"
  
  #ifdef HAVE_X_WINDOWS
+ /*  Defining HAVE_MULTILINGUAL_MENU would mean that the toolkit menu
+     code accepts the Emacs internal encoding.  */
  #undef HAVE_MULTILINGUAL_MENU
  #ifdef USE_X_TOOLKIT
  #include "widget.h"
***************
*** 127,132 ****
--- 129,150 ----
  static Lisp_Object xdialog_show ();
  #endif
  
+ /* This is how to deal with multibyte text if HAVE_MULTILINGUAL_MENU
+    isn't defined.  The use of HAVE_MULTILINGUAL_MENU could probably be
+    confined to an extended version of this with sections of code below
+    using it unconditionally.  */
+ #ifdef USE_GTK
+ /* gtk just uses utf-8.  */
+ # define ENCODE_MENU_STRING(str) ENCODE_UTF_8 (str)
+ #else
+ /* I'm not convinced ENCODE_SYSTEM is defined correctly, or maybe
+    something else should be used here.  Except under MS-Windows it
+    just converts to unibyte, but encoding with `locale-coding-system'
+    seems better -- X may actually display the result correctly, and
+    it's not necessarily equivalent to the unibyte text.  -- fx  */
+ # define ENCODE_MENU_STRING(str) ENCODE_SYSTEM (str)
+ #endif
+ 
  static void push_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object,
                                Lisp_Object, Lisp_Object, Lisp_Object,
                                Lisp_Object, Lisp_Object));
***************
*** 633,639 ****
        elt = Fcar (tail);
        pane_name = Fcar (elt);
        CHECK_STRING (pane_name);
!       push_menu_pane (pane_name, Qnil);
        pane_data = Fcdr (elt);
        CHECK_CONS (pane_data);
        list_of_items (pane_data);
--- 651,657 ----
        elt = Fcar (tail);
        pane_name = Fcar (elt);
        CHECK_STRING (pane_name);
!       push_menu_pane (ENCODE_MENU_STRING (pane_name), Qnil);
        pane_data = Fcdr (elt);
        CHECK_CONS (pane_data);
        list_of_items (pane_data);
***************
*** 654,660 ****
      {
        item = Fcar (tail);
        if (STRINGP (item))
!       push_menu_item (item, Qnil, Qnil, Qt, Qnil, Qnil, Qnil, Qnil);
        else if (NILP (item))
        push_left_right_boundary ();
        else
--- 672,679 ----
      {
        item = Fcar (tail);
        if (STRINGP (item))
!       push_menu_item (ENCODE_MENU_STRING (item), Qnil, Qnil, Qt,
!                       Qnil, Qnil, Qnil, Qnil);
        else if (NILP (item))
        push_left_right_boundary ();
        else
***************
*** 662,668 ****
          CHECK_CONS (item);
          item1 = Fcar (item);
          CHECK_STRING (item1);
!         push_menu_item (item1, Qt, Fcdr (item), Qt, Qnil, Qnil, Qnil, Qnil);
        }
      }
  }
--- 681,688 ----
          CHECK_CONS (item);
          item1 = Fcar (item);
          CHECK_STRING (item1);
!         push_menu_item (ENCODE_MENU_STRING (item1), Qt, Fcdr (item),
!                         Qt, Qnil, Qnil, Qnil, Qnil);
        }
      }
  }
***************
*** 1697,1709 ****
  #ifndef HAVE_MULTILINGUAL_MENU
            if (STRING_MULTIBYTE (item_name))
            {
!             item_name = ENCODE_SYSTEM (item_name);
              AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
            }
  
            if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
            {
!             descrip = ENCODE_SYSTEM (descrip);
              AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip;
            }
  #endif /* not HAVE_MULTILINGUAL_MENU */
--- 1717,1729 ----
  #ifndef HAVE_MULTILINGUAL_MENU
            if (STRING_MULTIBYTE (item_name))
            {
!             item_name = ENCODE_MENU_STRING (item_name);
              AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
            }
  
            if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
            {
!             descrip = ENCODE_MENU_STRING (descrip);
              AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip;
            }
  #endif /* not HAVE_MULTILINGUAL_MENU */
***************
*** 2377,2383 ****
    XButtonPressedEvent dummy;
    LWLIB_ID menu_id;
    Widget menu;
-   Window child;
  
    menu_id = widget_id_tick++;
    menu = lw_create_widget ("popup", first_wv->name, menu_id, first_wv,
--- 2397,2402 ----
***************
*** 2561,2573 ****
  #ifndef HAVE_MULTILINGUAL_MENU
            if (STRINGP (item_name) && STRING_MULTIBYTE (item_name))
            {
!             item_name = ENCODE_SYSTEM (item_name);
              AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
            }
  
            if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
            {
!             descrip = ENCODE_SYSTEM (descrip);
              AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip;
            }
  #endif /* not HAVE_MULTILINGUAL_MENU */
--- 2580,2592 ----
  #ifndef HAVE_MULTILINGUAL_MENU
            if (STRINGP (item_name) && STRING_MULTIBYTE (item_name))
            {
!             item_name = ENCODE_MENU_STRING (item_name);
              AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name;
            }
  
            if (STRINGP (descrip) && STRING_MULTIBYTE (descrip))
            {
!             descrip = ENCODE_MENU_STRING (descrip);
              AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip;
            }
  #endif /* not HAVE_MULTILINGUAL_MENU */
***************
*** 2627,2633 ****
  
  #ifndef HAVE_MULTILINGUAL_MENU
        if (STRING_MULTIBYTE (title))
!       title = ENCODE_SYSTEM (title);
  #endif
  
        wv_title->name = (char *) SDATA (title);
--- 2646,2652 ----
  
  #ifndef HAVE_MULTILINGUAL_MENU
        if (STRING_MULTIBYTE (title))
!       title = ENCODE_MENU_STRING (title);
  #endif
  
        wv_title->name = (char *) SDATA (title);




reply via email to

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