68 |
#include "dispextern.h" |
#include "dispextern.h" |
69 |
|
|
70 |
#ifdef HAVE_X_WINDOWS |
#ifdef HAVE_X_WINDOWS |
71 |
|
/* Defining HAVE_MULTILINGUAL_MENU would mean that the toolkit menu |
72 |
|
code accepts the Emacs internal encoding. */ |
73 |
#undef HAVE_MULTILINGUAL_MENU |
#undef HAVE_MULTILINGUAL_MENU |
74 |
#ifdef USE_X_TOOLKIT |
#ifdef USE_X_TOOLKIT |
75 |
#include "widget.h" |
#include "widget.h" |
129 |
static Lisp_Object xdialog_show (); |
static Lisp_Object xdialog_show (); |
130 |
#endif |
#endif |
131 |
|
|
132 |
|
/* This is how to deal with multibyte text if HAVE_MULTILINGUAL_MENU |
133 |
|
isn't defined. The use of HAVE_MULTILINGUAL_MENU could probably be |
134 |
|
confined to an extended version of this with sections of code below |
135 |
|
using it unconditionally. */ |
136 |
|
#ifdef USE_GTK |
137 |
|
/* gtk just uses utf-8. */ |
138 |
|
# define ENCODE_MENU_STRING(str) ENCODE_UTF_8 (str) |
139 |
|
#else |
140 |
|
/* I'm not convinced ENCODE_SYSTEM is defined correctly, or maybe |
141 |
|
something else should be used here. Except under MS-Windows it |
142 |
|
just converts to unibyte, but encoding with `locale-coding-system' |
143 |
|
seems better -- X may actually display the result correctly, and |
144 |
|
it's not necessarily equivalent to the unibyte text. -- fx */ |
145 |
|
# define ENCODE_MENU_STRING(str) ENCODE_SYSTEM (str) |
146 |
|
#endif |
147 |
|
|
148 |
static void push_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object, |
static void push_menu_item P_ ((Lisp_Object, Lisp_Object, Lisp_Object, |
149 |
Lisp_Object, Lisp_Object, Lisp_Object, |
Lisp_Object, Lisp_Object, Lisp_Object, |
150 |
Lisp_Object, Lisp_Object)); |
Lisp_Object, Lisp_Object)); |
651 |
elt = Fcar (tail); |
elt = Fcar (tail); |
652 |
pane_name = Fcar (elt); |
pane_name = Fcar (elt); |
653 |
CHECK_STRING (pane_name); |
CHECK_STRING (pane_name); |
654 |
push_menu_pane (pane_name, Qnil); |
push_menu_pane (ENCODE_MENU_STRING (pane_name), Qnil); |
655 |
pane_data = Fcdr (elt); |
pane_data = Fcdr (elt); |
656 |
CHECK_CONS (pane_data); |
CHECK_CONS (pane_data); |
657 |
list_of_items (pane_data); |
list_of_items (pane_data); |
672 |
{ |
{ |
673 |
item = Fcar (tail); |
item = Fcar (tail); |
674 |
if (STRINGP (item)) |
if (STRINGP (item)) |
675 |
push_menu_item (item, Qnil, Qnil, Qt, Qnil, Qnil, Qnil, Qnil); |
push_menu_item (ENCODE_MENU_STRING (item), Qnil, Qnil, Qt, |
676 |
|
Qnil, Qnil, Qnil, Qnil); |
677 |
else if (NILP (item)) |
else if (NILP (item)) |
678 |
push_left_right_boundary (); |
push_left_right_boundary (); |
679 |
else |
else |
681 |
CHECK_CONS (item); |
CHECK_CONS (item); |
682 |
item1 = Fcar (item); |
item1 = Fcar (item); |
683 |
CHECK_STRING (item1); |
CHECK_STRING (item1); |
684 |
push_menu_item (item1, Qt, Fcdr (item), Qt, Qnil, Qnil, Qnil, Qnil); |
push_menu_item (ENCODE_MENU_STRING (item1), Qt, Fcdr (item), |
685 |
|
Qt, Qnil, Qnil, Qnil, Qnil); |
686 |
} |
} |
687 |
} |
} |
688 |
} |
} |
1717 |
#ifndef HAVE_MULTILINGUAL_MENU |
#ifndef HAVE_MULTILINGUAL_MENU |
1718 |
if (STRING_MULTIBYTE (item_name)) |
if (STRING_MULTIBYTE (item_name)) |
1719 |
{ |
{ |
1720 |
item_name = ENCODE_SYSTEM (item_name); |
item_name = ENCODE_MENU_STRING (item_name); |
1721 |
AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name; |
AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name; |
1722 |
} |
} |
1723 |
|
|
1724 |
if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) |
if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) |
1725 |
{ |
{ |
1726 |
descrip = ENCODE_SYSTEM (descrip); |
descrip = ENCODE_MENU_STRING (descrip); |
1727 |
AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip; |
AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip; |
1728 |
} |
} |
1729 |
#endif /* not HAVE_MULTILINGUAL_MENU */ |
#endif /* not HAVE_MULTILINGUAL_MENU */ |
2397 |
XButtonPressedEvent dummy; |
XButtonPressedEvent dummy; |
2398 |
LWLIB_ID menu_id; |
LWLIB_ID menu_id; |
2399 |
Widget menu; |
Widget menu; |
|
Window child; |
|
2400 |
|
|
2401 |
menu_id = widget_id_tick++; |
menu_id = widget_id_tick++; |
2402 |
menu = lw_create_widget ("popup", first_wv->name, menu_id, first_wv, |
menu = lw_create_widget ("popup", first_wv->name, menu_id, first_wv, |
2580 |
#ifndef HAVE_MULTILINGUAL_MENU |
#ifndef HAVE_MULTILINGUAL_MENU |
2581 |
if (STRINGP (item_name) && STRING_MULTIBYTE (item_name)) |
if (STRINGP (item_name) && STRING_MULTIBYTE (item_name)) |
2582 |
{ |
{ |
2583 |
item_name = ENCODE_SYSTEM (item_name); |
item_name = ENCODE_MENU_STRING (item_name); |
2584 |
AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name; |
AREF (menu_items, i + MENU_ITEMS_ITEM_NAME) = item_name; |
2585 |
} |
} |
2586 |
|
|
2587 |
if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) |
if (STRINGP (descrip) && STRING_MULTIBYTE (descrip)) |
2588 |
{ |
{ |
2589 |
descrip = ENCODE_SYSTEM (descrip); |
descrip = ENCODE_MENU_STRING (descrip); |
2590 |
AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip; |
AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip; |
2591 |
} |
} |
2592 |
#endif /* not HAVE_MULTILINGUAL_MENU */ |
#endif /* not HAVE_MULTILINGUAL_MENU */ |
2646 |
|
|
2647 |
#ifndef HAVE_MULTILINGUAL_MENU |
#ifndef HAVE_MULTILINGUAL_MENU |
2648 |
if (STRING_MULTIBYTE (title)) |
if (STRING_MULTIBYTE (title)) |
2649 |
title = ENCODE_SYSTEM (title); |
title = ENCODE_MENU_STRING (title); |
2650 |
#endif |
#endif |
2651 |
|
|
2652 |
wv_title->name = (char *) SDATA (title); |
wv_title->name = (char *) SDATA (title); |