aboutsummaryrefslogtreecommitdiffstats
path: root/src/xmenu.c
diff options
context:
space:
mode:
authorJan Djärv2011-02-14 18:21:10 +0100
committerJan Djärv2011-02-14 18:21:10 +0100
commit3928f2b67e69cd22995558cc205a2fc6aa33d477 (patch)
tree1a384801162ad5afaa0e5fa7f4e8f0cb023d8d60 /src/xmenu.c
parent4bb81cc2ba5b44f97b14f7c7ae0dd6b972e71677 (diff)
downloademacs-3928f2b67e69cd22995558cc205a2fc6aa33d477.tar.gz
emacs-3928f2b67e69cd22995558cc205a2fc6aa33d477.zip
Use *font for Xft font names for Lucid menus and dialogs.
* doc/emacs/xresources.texi (X Resources): Remove *faceName and replace it with *font for Lucid. * lwlib/lwlib-Xaw.c (make_dialog): Use *font even for Xft fonts. Try XLoadQueryFont first and then Xft fonts. * lwlib/xlwmenu.c (xlwmenu_default_font): Remove, does not work for multi-display. (xlwMenuResources): Remove XtNfaceName and XtNdefaultFace. Make XtNFont a String resource. (make_windows_if_needed): Call XFlush so later changes are seen by the X server. (remap_menubar): Use XtMoveWidget and then XtResizeWidget/XtResizeWindow after XtPopup. Works better with Compiz. (make_drawing_gcs): Check if mw->menu.font is set. (getDefaultXftFont): New function. (openXftFont): faceName is now fontName. Try XLoadQueryFont first and then XftFontOpenName. (XlwMenuInitialize): Initialize mw->menu.font with XLoadQueryFont. (XlwMenuClassInitialize): Remove initialization of xlwmenu_default_font. (fontname_changed): Renamed from facename_changed. (XlwMenuSetValues): Use facename_changed. * lwlib/xlwmenu.h: Remove Xt[CN]faceName and Xt[NC]defaultFace. * lwlib/xlwmenuP.h (_XlwMenu_part): Remove faceName. Add fontName. * src/xmenu.c (apply_systemfont_to_dialog): Apply to *dialog.font. (apply_systemfont_to_menu): Set resources *menubar*font and *popup*font. Remove defflt. (set_frame_menubar, create_and_show_popup_menu): Call apply_systemfont_to_menu before lw_create_widget. * src/xrdb.c (x_load_resources): For LUCID and XFT, don't put a resource that specifies helvetica for menus and dialogs.
Diffstat (limited to 'src/xmenu.c')
-rw-r--r--src/xmenu.c42
1 files changed, 19 insertions, 23 deletions
diff --git a/src/xmenu.c b/src/xmenu.c
index ad1a764eab8..934db0f0406 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -887,31 +887,26 @@ apply_systemfont_to_dialog (Widget w)
887 { 887 {
888 XrmDatabase db = XtDatabase (XtDisplay (w)); 888 XrmDatabase db = XtDatabase (XtDisplay (w));
889 if (db) 889 if (db)
890 XrmPutStringResource (&db, "*dialog.faceName", fn); 890 XrmPutStringResource (&db, "*dialog.font", fn);
891 } 891 }
892} 892}
893 893
894static void 894static void
895apply_systemfont_to_menu (Widget w) 895apply_systemfont_to_menu (struct frame *f, Widget w)
896{ 896{
897 const char *fn = xsettings_get_system_normal_font (); 897 const char *fn = xsettings_get_system_normal_font ();
898 int defflt;
899 898
900 if (!fn) return; 899 if (fn)
901
902 if (XtIsShell (w)) /* popup menu */
903 { 900 {
904 Widget *childs = NULL; 901 XrmDatabase db = XtDatabase (XtDisplay (w));
905 902 if (db)
906 XtVaGetValues (w, XtNchildren, &childs, NULL); 903 {
907 if (*childs) w = *childs; 904 XrmPutStringResource (&db, "*menubar*font", fn);
905 XrmPutStringResource (&db, "*popup*font", fn);
906 }
908 } 907 }
909
910 /* Only use system font if the default is used for the menu. */
911 XtVaGetValues (w, XtNdefaultFace, &defflt, NULL);
912 if (defflt)
913 XtVaSetValues (w, XtNfaceName, fn, NULL);
914} 908}
909
915#endif 910#endif
916 911
917/* Set the contents of the menubar widgets of frame F. 912/* Set the contents of the menubar widgets of frame F.
@@ -1210,7 +1205,11 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1210 char menuOverride[] = "Ctrl<KeyPress>g: MenuGadgetEscape()"; 1205 char menuOverride[] = "Ctrl<KeyPress>g: MenuGadgetEscape()";
1211 XtTranslations override = XtParseTranslationTable (menuOverride); 1206 XtTranslations override = XtParseTranslationTable (menuOverride);
1212 1207
1213 menubar_widget = lw_create_widget ("menubar", "menubar", id, first_wv, 1208#ifdef USE_LUCID
1209 apply_systemfont_to_menu (f, f->output_data.x->column_widget);
1210#endif
1211 menubar_widget = lw_create_widget ("menubar", "menubar", id,
1212 first_wv,
1214 f->output_data.x->column_widget, 1213 f->output_data.x->column_widget,
1215 0, 1214 0,
1216 popup_activate_callback, 1215 popup_activate_callback,
@@ -1221,9 +1220,6 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1221 1220
1222 /* Make menu pop down on C-g. */ 1221 /* Make menu pop down on C-g. */
1223 XtOverrideTranslations (menubar_widget, override); 1222 XtOverrideTranslations (menubar_widget, override);
1224#ifdef USE_LUCID
1225 apply_systemfont_to_menu (menubar_widget);
1226#endif
1227 } 1223 }
1228 1224
1229 { 1225 {
@@ -1542,6 +1538,10 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
1542 if (! FRAME_X_P (f)) 1538 if (! FRAME_X_P (f))
1543 abort (); 1539 abort ();
1544 1540
1541#ifdef USE_LUCID
1542 apply_systemfont_to_menu (f, f->output_data.x->widget);
1543#endif
1544
1545 menu_id = widget_id_tick++; 1545 menu_id = widget_id_tick++;
1546 menu = lw_create_widget ("popup", first_wv->name, menu_id, first_wv, 1546 menu = lw_create_widget ("popup", first_wv->name, menu_id, first_wv,
1547 f->output_data.x->widget, 1, 0, 1547 f->output_data.x->widget, 1, 0,
@@ -1549,10 +1549,6 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
1549 popup_deactivate_callback, 1549 popup_deactivate_callback,
1550 menu_highlight_callback); 1550 menu_highlight_callback);
1551 1551
1552#ifdef USE_LUCID
1553 apply_systemfont_to_menu (menu);
1554#endif
1555
1556 dummy.type = ButtonPress; 1552 dummy.type = ButtonPress;
1557 dummy.serial = 0; 1553 dummy.serial = 0;
1558 dummy.send_event = 0; 1554 dummy.send_event = 0;