diff options
author | Jan Djärv <jan.h.d@swipnet.se> | 2011-02-14 18:21:10 +0100 |
---|---|---|
committer | Jan Djärv <jan.h.d@swipnet.se> | 2011-02-14 18:21:10 +0100 |
commit | 3928f2b67e69cd22995558cc205a2fc6aa33d477 (patch) | |
tree | 1a384801162ad5afaa0e5fa7f4e8f0cb023d8d60 /src/xmenu.c | |
parent | 4bb81cc2ba5b44f97b14f7c7ae0dd6b972e71677 (diff) | |
download | emacs-3928f2b67e69cd22995558cc205a2fc6aa33d477.tar.gz |
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.c | 42 |
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) { XrmDatabase db = XtDatabase (XtDisplay (w)); if (db) - XrmPutStringResource (&db, "*dialog.faceName", fn); + XrmPutStringResource (&db, "*dialog.font", fn); } } static void -apply_systemfont_to_menu (Widget w) +apply_systemfont_to_menu (struct frame *f, Widget w) { const char *fn = xsettings_get_system_normal_font (); - int defflt; - if (!fn) return; - - if (XtIsShell (w)) /* popup menu */ + if (fn) { - Widget *childs = NULL; - - XtVaGetValues (w, XtNchildren, &childs, NULL); - if (*childs) w = *childs; + XrmDatabase db = XtDatabase (XtDisplay (w)); + if (db) + { + XrmPutStringResource (&db, "*menubar*font", fn); + XrmPutStringResource (&db, "*popup*font", fn); + } } - - /* Only use system font if the default is used for the menu. */ - XtVaGetValues (w, XtNdefaultFace, &defflt, NULL); - if (defflt) - XtVaSetValues (w, XtNfaceName, fn, NULL); } + #endif /* 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) char menuOverride[] = "Ctrl<KeyPress>g: MenuGadgetEscape()"; XtTranslations override = XtParseTranslationTable (menuOverride); - menubar_widget = lw_create_widget ("menubar", "menubar", id, first_wv, +#ifdef USE_LUCID + apply_systemfont_to_menu (f, f->output_data.x->column_widget); +#endif + menubar_widget = lw_create_widget ("menubar", "menubar", id, + first_wv, f->output_data.x->column_widget, 0, popup_activate_callback, @@ -1221,9 +1220,6 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) /* Make menu pop down on C-g. */ XtOverrideTranslations (menubar_widget, override); -#ifdef USE_LUCID - apply_systemfont_to_menu (menubar_widget); -#endif } { @@ -1542,6 +1538,10 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, if (! FRAME_X_P (f)) abort (); +#ifdef USE_LUCID + apply_systemfont_to_menu (f, f->output_data.x->widget); +#endif + menu_id = widget_id_tick++; menu = lw_create_widget ("popup", first_wv->name, menu_id, first_wv, f->output_data.x->widget, 1, 0, @@ -1549,10 +1549,6 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, popup_deactivate_callback, menu_highlight_callback); -#ifdef USE_LUCID - apply_systemfont_to_menu (menu); -#endif - dummy.type = ButtonPress; dummy.serial = 0; dummy.send_event = 0; |