#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"
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));
elt = Fcar (tail);
pane_name = Fcar (elt);
CHECK_STRING (pane_name);
- push_menu_pane (pane_name, Qnil);
+ push_menu_pane (ENCODE_MENU_STRING (pane_name), Qnil);
pane_data = Fcdr (elt);
CHECK_CONS (pane_data);
list_of_items (pane_data);
{
item = Fcar (tail);
if (STRINGP (item))
- push_menu_item (item, Qnil, Qnil, Qt, Qnil, Qnil, Qnil, Qnil);
+ push_menu_item (ENCODE_MENU_STRING (item), Qnil, Qnil, Qt,
+ Qnil, Qnil, Qnil, Qnil);
else if (NILP (item))
push_left_right_boundary ();
else
CHECK_CONS (item);
item1 = Fcar (item);
CHECK_STRING (item1);
- push_menu_item (item1, Qt, Fcdr (item), Qt, Qnil, Qnil, Qnil, Qnil);
+ push_menu_item (ENCODE_MENU_STRING (item1), Qt, Fcdr (item),
+ Qt, Qnil, Qnil, Qnil, Qnil);
}
}
}
/* xmenu_show expects window coordinates, not root window
coordinates. Translate. */
- *x -= f->output_data.x->left_pos
- + FRAME_OUTER_TO_INNER_DIFF_X (f);
- *y -= f->output_data.x->top_pos
- + FRAME_OUTER_TO_INNER_DIFF_Y (f);
+ *x -= f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f);
+ *y -= f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f);
}
#endif /* HAVE_X_WINDOWS */
CHECK_LIVE_WINDOW (window);
f = XFRAME (WINDOW_FRAME (XWINDOW (window)));
- xpos = (FONT_WIDTH (FRAME_FONT (f))
- * XFASTINT (XWINDOW (window)->left));
- ypos = (FRAME_LINE_HEIGHT (f)
- * XFASTINT (XWINDOW (window)->top));
+ xpos = WINDOW_LEFT_EDGE_X (XWINDOW (window));
+ ypos = WINDOW_TOP_EDGE_Y (XWINDOW (window));
}
else
/* ??? Not really clean; should be CHECK_WINDOW_OR_FRAME,
int j;
struct input_event buf;
Lisp_Object frame;
+ EVENT_INIT (buf);
XSETFRAME (frame, f);
buf.kind = MENU_BAR_EVENT;
#ifndef HAVE_MULTILINGUAL_MENU
if (STRING_MULTIBYTE (item_name))
{
- item_name = ENCODE_SYSTEM (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_SYSTEM (descrip);
+ descrip = ENCODE_MENU_STRING (descrip);
AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip;
}
#endif /* not HAVE_MULTILINGUAL_MENU */
BLOCK_INPUT;
/* Save the size of the frame because the pane widget doesn't accept
to resize itself. So force it. */
- columns = f->width;
- rows = f->height;
+ columns = FRAME_COLS (f);
+ rows = FRAME_LINES (f);
/* Do the voodoo which means "I'm changing lots of things, don't try
to refigure sizes until I'm done." */
pos_func = menu_position_func;
/* Adjust coordinates to be root-window-relative. */
- x += f->output_data.x->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f);
- y += f->output_data.x->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f);
+ x += f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f);
+ y += f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f);
popup_x_y.x = x;
popup_x_y.y = y;
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,
dummy.y = y;
/* Adjust coordinates to be root-window-relative. */
- x += f->output_data.x->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f);
- y += f->output_data.x->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f);
+ x += f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f);
+ y += f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f);
dummy.x_root = x;
dummy.y_root = y;
#ifndef HAVE_MULTILINGUAL_MENU
if (STRINGP (item_name) && STRING_MULTIBYTE (item_name))
{
- item_name = ENCODE_SYSTEM (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_SYSTEM (descrip);
+ descrip = ENCODE_MENU_STRING (descrip);
AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY) = descrip;
}
#endif /* not HAVE_MULTILINGUAL_MENU */
#ifndef HAVE_MULTILINGUAL_MENU
if (STRING_MULTIBYTE (title))
- title = ENCODE_SYSTEM (title);
+ title = ENCODE_MENU_STRING (title);
#endif
wv_title->name = (char *) SDATA (title);
#endif /* HAVE_X_WINDOWS */
/* Adjust coordinates to be root-window-relative. */
- x += f->output_data.x->left_pos;
- y += f->output_data.x->top_pos;
+ x += f->left_pos;
+ y += f->top_pos;
/* Create all the necessary panes and their items. */
i = 0;
defsubr (&Sx_popup_dialog);
#endif
}
+
+/* arch-tag: 92ea573c-398e-496e-ac73-2436f7d63242
+ (do not change this comment) */