Commit bce72079 authored by Gerd Moellmann's avatar Gerd Moellmann
Browse files

(x_update_menu_appearance): Renamed from

x_set_menu_face_resources.  Use different resources for popups.
parent 97305dec
...@@ -601,6 +601,10 @@ static void clear_font_table P_ ((struct frame *)); ...@@ -601,6 +601,10 @@ static void clear_font_table P_ ((struct frame *));
extern Lisp_Object w32_list_fonts P_ ((struct frame *, Lisp_Object, int, int)); extern Lisp_Object w32_list_fonts P_ ((struct frame *, Lisp_Object, int, int));
#endif /* WINDOWSNT */ #endif /* WINDOWSNT */
#ifdef USE_X_TOOLKIT
static void x_update_menu_appearance P_ ((struct frame *));
#endif /* USE_X_TOOLKIT */
#endif /* HAVE_WINDOW_SYSTEM */ #endif /* HAVE_WINDOW_SYSTEM */
...@@ -4341,91 +4345,84 @@ DEFUN ("internal-set-lisp-face-attribute-from-resource", ...@@ -4341,91 +4345,84 @@ DEFUN ("internal-set-lisp-face-attribute-from-resource",
#endif /* HAVE_WINDOW_SYSTEM */ #endif /* HAVE_WINDOW_SYSTEM */
#ifdef HAVE_X_WINDOWS
/*********************************************************************** /***********************************************************************
Menu face Menu face
***********************************************************************/ ***********************************************************************/
#ifdef USE_X_TOOLKIT #if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT
void /* Make menus on frame F appear as specified by the `menu' face. */
x_set_menu_face_resources (f)
static void
x_update_menu_appearance (f)
struct frame *f; struct frame *f;
{ {
struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
XrmDatabase rdb;
if (dpyinfo) if (dpyinfo
&& (rdb = XrmGetDatabase (FRAME_X_DISPLAY (f)),
rdb != NULL))
{ {
Display *dpy = FRAME_X_DISPLAY (f); char line[512];
XrmDatabase rdb = XrmGetDatabase (dpy); Lisp_Object lface = lface_from_face_name (f, Qmenu, 1);
extern Lisp_Object Vx_resource_name; struct face *face = FACE_FROM_ID (f, MENU_FACE_ID);
char *myname = XSTRING (Vx_resource_name)->data;
if (rdb) int changed_p = 0;
{
char line[512];
Lisp_Object lface = lface_from_face_name (f, Qmenu, 1);
struct face *face = FACE_FROM_ID (f, MENU_FACE_ID);
char *myname = XSTRING (Vx_resource_name)->data;
int changes = 0;
if (STRINGP (LFACE_FOREGROUND (lface))) if (STRINGP (LFACE_FOREGROUND (lface)))
{ {
sprintf (line, "%s.menu*foreground: %s", sprintf (line, "%s.popup_menu*foreground: %s",
myname, XSTRING (LFACE_FOREGROUND (lface))->data); myname, XSTRING (LFACE_FOREGROUND (lface))->data);
XrmPutLineResource (&rdb, line); XrmPutLineResource (&rdb, line);
sprintf (line, "%s.pane.menubar*foreground: %s", sprintf (line, "%s.pane.menubar*foreground: %s",
myname, XSTRING (LFACE_FOREGROUND (lface))->data); myname, XSTRING (LFACE_FOREGROUND (lface))->data);
XrmPutLineResource (&rdb, line); XrmPutLineResource (&rdb, line);
++changes; changed_p = 1;
} }
if (STRINGP (LFACE_BACKGROUND (lface))) if (STRINGP (LFACE_BACKGROUND (lface)))
{ {
sprintf (line, "%s*menu*background: %s", sprintf (line, "%s.popup_menu*background: %s",
myname, XSTRING (LFACE_BACKGROUND (lface))->data); myname, XSTRING (LFACE_BACKGROUND (lface))->data);
XrmPutLineResource (&rdb, line); XrmPutLineResource (&rdb, line);
sprintf (line, "%s.pane.menubar*background: %s", sprintf (line, "%s.pane.menubar*background: %s",
myname, XSTRING (LFACE_BACKGROUND (lface))->data); myname, XSTRING (LFACE_BACKGROUND (lface))->data);
XrmPutLineResource (&rdb, line); XrmPutLineResource (&rdb, line);
++changes; changed_p = 1;
} }
if (face->font_name if (face->font_name
&& (!UNSPECIFIEDP (LFACE_FAMILY (lface)) && (!UNSPECIFIEDP (LFACE_FAMILY (lface))
|| !UNSPECIFIEDP (LFACE_SWIDTH (lface)) || !UNSPECIFIEDP (LFACE_SWIDTH (lface))
|| !UNSPECIFIEDP (LFACE_AVGWIDTH (lface)) || !UNSPECIFIEDP (LFACE_AVGWIDTH (lface))
|| !UNSPECIFIEDP (LFACE_WEIGHT (lface)) || !UNSPECIFIEDP (LFACE_WEIGHT (lface))
|| !UNSPECIFIEDP (LFACE_SLANT (lface)) || !UNSPECIFIEDP (LFACE_SLANT (lface))
|| !UNSPECIFIEDP (LFACE_HEIGHT (lface)))) || !UNSPECIFIEDP (LFACE_HEIGHT (lface))))
{ {
#ifdef USE_MOTIF #ifdef USE_MOTIF
char *format1 = "%s.pane.menubar*fontList: %s"; const char *suffix = "List";
char *format2 = "%s*menu*fontList: %s";
#else #else
char *format1 = "%s.pane.menubar*font: %s"; const char *suffix = "";
char *format2 = "%s*menu*font: %s"; #endif
#endif sprintf (line, "%s.pane.menubar*font%s: %s",
sprintf (line, format1, myname, face->font_name); myname, suffix, face->font_name);
XrmPutLineResource (&rdb, line); XrmPutLineResource (&rdb, line);
sprintf (line, format2, myname, face->font_name); sprintf (line, "%s.popup_menu*font%s: %s",
XrmPutLineResource (&rdb, line); myname, suffix, face->font_name);
++changes; XrmPutLineResource (&rdb, line);
} changed_p = 1;
}
if (changes && f->output_data.x->menubar_widget) if (changed_p && f->output_data.x->menubar_widget)
{ {
free_frame_menubar (f); free_frame_menubar (f);
set_frame_menubar (f, 1, 1); set_frame_menubar (f, 1, 1);
XWINDOW (FRAME_SELECTED_WINDOW (f))->update_mode_line = Qt;
}
} }
} }
} }
#endif /* HAVE_X_WINDOWS && USE_X_TOOLKIT */
#endif /* USE_X_TOOLKIT */
#endif /* HAVE_X_WINDOWS */
...@@ -5972,7 +5969,7 @@ realize_basic_faces (f) ...@@ -5972,7 +5969,7 @@ realize_basic_faces (f)
{ {
menu_face_change_count = 0; menu_face_change_count = 0;
#ifdef USE_X_TOOLKIT #ifdef USE_X_TOOLKIT
x_set_menu_face_resources (f); x_update_menu_appearance (f);
#endif #endif
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment