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.
This commit is contained in:
parent
4bb81cc2ba
commit
3928f2b67e
11 changed files with 140 additions and 96 deletions
|
|
@ -1,3 +1,8 @@
|
||||||
|
2011-02-14 Jan Djärv <jan.h.d@swipnet.se>
|
||||||
|
|
||||||
|
* xresources.texi (X Resources): Remove *faceName and replace it with
|
||||||
|
*font for Lucid.
|
||||||
|
|
||||||
2011-02-05 Chong Yidong <cyd@stupidchicken.com>
|
2011-02-05 Chong Yidong <cyd@stupidchicken.com>
|
||||||
|
|
||||||
* rmail.texi (Rmail Display): Document Rmail MIME support more
|
* rmail.texi (Rmail Display): Document Rmail MIME support more
|
||||||
|
|
|
||||||
|
|
@ -428,30 +428,21 @@ and has its own resources. The resource specifications start with
|
||||||
@end iftex
|
@end iftex
|
||||||
|
|
||||||
@example
|
@example
|
||||||
Emacs.pane.menubar.faceName: Courier-12
|
Emacs.pane.menubar.font: Courier-12
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@noindent
|
@noindent
|
||||||
To specify a font, use fontconfig font names as values to the @code{faceName}
|
To specify a font, use fontconfig font names as values to the @code{font}
|
||||||
resource.
|
resource, or old style names:
|
||||||
|
|
||||||
If Emacs is not built with the Xft library, Lucid menus and dialogs
|
|
||||||
can only display old style fonts. If Emacs is built with Xft and you
|
|
||||||
prefer the old fonts, you have to specify @samp{none} to
|
|
||||||
@code{faceName}:
|
|
||||||
|
|
||||||
@example
|
|
||||||
Emacs.pane.menubar.faceName: none
|
|
||||||
Emacs.pane.dialog.faceName: none
|
|
||||||
@end example
|
|
||||||
|
|
||||||
@noindent
|
|
||||||
To specify a non-Xft font, use @code{font}. For example:
|
|
||||||
|
|
||||||
@example
|
@example
|
||||||
Emacs.pane.menubar.font: lucidasanstypewriter-10
|
Emacs.pane.menubar.font: lucidasanstypewriter-10
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
@noindent
|
||||||
|
Emacs first tries to open the font as an old style font, and if that fails
|
||||||
|
as an fontconfig font. In rare cases, Emacs might do the wrong thing.
|
||||||
|
|
||||||
@noindent
|
@noindent
|
||||||
The Lucid menus can display multilingual text in your locale with old style
|
The Lucid menus can display multilingual text in your locale with old style
|
||||||
fonts. For more information about fontsets see the man page for
|
fonts. For more information about fontsets see the man page for
|
||||||
|
|
@ -480,7 +471,7 @@ Emacs.menu*.font: 8x16
|
||||||
For dialog boxes, use @samp{dialog*}:
|
For dialog boxes, use @samp{dialog*}:
|
||||||
|
|
||||||
@example
|
@example
|
||||||
Emacs.dialog*.faceName: Sans-12
|
Emacs.dialog*.font: Sans-12
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
@noindent
|
@noindent
|
||||||
|
|
@ -495,8 +486,6 @@ approach should work on both kinds of systems.
|
||||||
Here is a list of the specific resources for menu bars and pop-up menus:
|
Here is a list of the specific resources for menu bars and pop-up menus:
|
||||||
|
|
||||||
@table @code
|
@table @code
|
||||||
@item faceName
|
|
||||||
Xft font for menu item text.
|
|
||||||
@item font
|
@item font
|
||||||
Font for menu item text.
|
Font for menu item text.
|
||||||
@item fontSet
|
@item fontSet
|
||||||
|
|
|
||||||
5
etc/NEWS
5
etc/NEWS
|
|
@ -137,9 +137,8 @@ theme when Emacs is built with GTK.
|
||||||
off by customizing x-gtk-use-system-tooltips.
|
off by customizing x-gtk-use-system-tooltips.
|
||||||
|
|
||||||
** Lucid menus and dialogs can display antialiased fonts if Emacs is built
|
** Lucid menus and dialogs can display antialiased fonts if Emacs is built
|
||||||
with Xft. To change font, use X resource faceName, for example:
|
with Xft. To change font, use the X resource font, for example:
|
||||||
Emacs.pane.menubar.faceName: Courier-12
|
Emacs.pane.menubar.font: Courier-12
|
||||||
Set faceName to none and use font to use the old X fonts.
|
|
||||||
|
|
||||||
+++
|
+++
|
||||||
** Enhanced support for characters that have no glyphs in available fonts
|
** Enhanced support for characters that have no glyphs in available fonts
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,31 @@
|
||||||
|
2011-02-14 Jan Djärv <jan.h.d@swipnet.se>
|
||||||
|
|
||||||
|
* xlwmenu.h: Remove Xt[CN]faceName and Xt[NC]defaultFace.
|
||||||
|
|
||||||
|
* xlwmenuP.h (_XlwMenu_part): Remove faceName. Add fontName.
|
||||||
|
|
||||||
|
* 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-Xaw.c (make_dialog): Use *font even for Xft fonts. Try
|
||||||
|
XLoadQueryFont first and then Xft fonts.
|
||||||
|
|
||||||
2011-02-13 Glenn Morris <rgm@gnu.org>
|
2011-02-13 Glenn Morris <rgm@gnu.org>
|
||||||
|
|
||||||
* lwlib-utils.c (index, rindex): Don't undef (neither used in lwlib/,
|
* lwlib-utils.c (index, rindex): Don't undef (neither used in lwlib/,
|
||||||
|
|
|
||||||
|
|
@ -577,13 +577,20 @@ make_dialog (char* name,
|
||||||
if (w)
|
if (w)
|
||||||
{
|
{
|
||||||
XtResource rec[] =
|
XtResource rec[] =
|
||||||
{ { "faceName", "FaceName", XtRString, sizeof(String), 0, XtRString,
|
{ { "font", "Font", XtRString, sizeof(String), 0, XtRString,
|
||||||
(XtPointer)"Sans-14" }};
|
(XtPointer)"Sans-10" }};
|
||||||
char *faceName;
|
char *fontName = NULL;
|
||||||
XtVaGetSubresources (dialog, &faceName, "Dialog", "dialog",
|
XtVaGetSubresources (dialog, &fontName, "Dialog", "dialog",
|
||||||
rec, 1, (String)NULL);
|
rec, 1, (String)NULL);
|
||||||
if (strcmp ("none", faceName) != 0)
|
if (fontName)
|
||||||
xft_font = openFont (dialog, faceName);
|
{
|
||||||
|
XFontStruct *xfn = XLoadQueryFont (XtDisplay (dialog), fontName);
|
||||||
|
if (!xfn)
|
||||||
|
xft_font = openFont (dialog, fontName);
|
||||||
|
else
|
||||||
|
XFreeFont (XtDisplay (dialog), xfn);
|
||||||
|
}
|
||||||
|
|
||||||
if (xft_font)
|
if (xft_font)
|
||||||
{
|
{
|
||||||
instance->nr_xft_data = left_buttons + right_buttons + 1;
|
instance->nr_xft_data = left_buttons + right_buttons + 1;
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,6 @@ extern char *gray_bitmap_bits;
|
||||||
static int pointer_grabbed;
|
static int pointer_grabbed;
|
||||||
static XEvent menu_post_event;
|
static XEvent menu_post_event;
|
||||||
|
|
||||||
static XFontStruct *xlwmenu_default_font;
|
|
||||||
|
|
||||||
static char
|
static char
|
||||||
xlwMenuTranslations [] =
|
xlwMenuTranslations [] =
|
||||||
"<BtnDown>: start()\n\
|
"<BtnDown>: start()\n\
|
||||||
|
|
@ -131,14 +129,12 @@ xlwMenuResources[] =
|
||||||
offset(menu.fontSet), XtRFontSet, NULL},
|
offset(menu.fontSet), XtRFontSet, NULL},
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_XFT
|
#ifdef HAVE_XFT
|
||||||
#define DEFAULT_FACENAME "Sans-10"
|
#define DEFAULT_FONTNAME "Sans-10"
|
||||||
{XtNfaceName, XtCFaceName, XtRString, sizeof(String),
|
#else
|
||||||
offset(menu.faceName), XtRString, DEFAULT_FACENAME},
|
#define DEFAULT_FONTNAME "XtDefaultFont"
|
||||||
{XtNdefaultFace, XtCDefaultFace, XtRInt, sizeof(int),
|
|
||||||
offset(menu.default_face), XtRImmediate, (XtPointer)1},
|
|
||||||
#endif
|
#endif
|
||||||
{XtNfont, XtCFont, XtRFontStruct, sizeof(XFontStruct *),
|
{XtNfont, XtCFont, XtRString, sizeof(String),
|
||||||
offset(menu.font), XtRString, "XtDefaultFont"},
|
offset(menu.fontName), XtRString, DEFAULT_FONTNAME },
|
||||||
{XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
|
{XtNforeground, XtCForeground, XtRPixel, sizeof(Pixel),
|
||||||
offset(menu.foreground), XtRString, "XtDefaultForeground"},
|
offset(menu.foreground), XtRString, "XtDefaultForeground"},
|
||||||
{XtNdisabledForeground, XtCDisabledForeground, XtRPixel, sizeof(Pixel),
|
{XtNdisabledForeground, XtCDisabledForeground, XtRPixel, sizeof(Pixel),
|
||||||
|
|
@ -1352,6 +1348,7 @@ make_windows_if_needed (XlwMenuWidget mw, int n)
|
||||||
#endif
|
#endif
|
||||||
set_window_type (windows [i].w, mw);
|
set_window_type (windows [i].w, mw);
|
||||||
}
|
}
|
||||||
|
XFlush (XtDisplay (mw));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Value is non-zero if WINDOW is part of menu bar widget W. */
|
/* Value is non-zero if WINDOW is part of menu bar widget W. */
|
||||||
|
|
@ -1534,10 +1531,12 @@ remap_menubar (XlwMenuWidget mw)
|
||||||
|
|
||||||
fit_to_screen (mw, ws, previous_ws, mw->menu.horizontal && i == 1);
|
fit_to_screen (mw, ws, previous_ws, mw->menu.horizontal && i == 1);
|
||||||
|
|
||||||
XtVaSetValues (ws->w, XtNwidth, ws->width, XtNheight, ws->height,
|
|
||||||
XtNx, ws->x, XtNy, ws->y, NULL);
|
|
||||||
create_pixmap_for_menu (ws, mw);
|
create_pixmap_for_menu (ws, mw);
|
||||||
|
XtMoveWidget (ws->w, ws->x, ws->y);
|
||||||
XtPopup (ws->w, XtGrabNone);
|
XtPopup (ws->w, XtGrabNone);
|
||||||
|
XtResizeWidget (ws->w, ws->width, ws->height,
|
||||||
|
mw->core.border_width);
|
||||||
|
XtResizeWindow (ws->w);
|
||||||
display_menu (mw, i, False, &selection_position, NULL, NULL);
|
display_menu (mw, i, False, &selection_position, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1613,14 +1612,17 @@ make_drawing_gcs (XlwMenuWidget mw)
|
||||||
XtGCMask mask = GCForeground | GCBackground;
|
XtGCMask mask = GCForeground | GCBackground;
|
||||||
|
|
||||||
#ifdef HAVE_X_I18N
|
#ifdef HAVE_X_I18N
|
||||||
if (!mw->menu.fontSet)
|
if (!mw->menu.fontSet && mw->menu.font)
|
||||||
{
|
{
|
||||||
xgcv.font = mw->menu.font->fid;
|
xgcv.font = mw->menu.font->fid;
|
||||||
mask |= GCFont;
|
mask |= GCFont;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
if (mw->menu.font)
|
||||||
|
{
|
||||||
xgcv.font = mw->menu.font->fid;
|
xgcv.font = mw->menu.font->fid;
|
||||||
mask |= GCFont;
|
mask |= GCFont;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
xgcv.foreground = mw->menu.foreground;
|
xgcv.foreground = mw->menu.foreground;
|
||||||
xgcv.background = mw->core.background_pixel;
|
xgcv.background = mw->core.background_pixel;
|
||||||
|
|
@ -1847,13 +1849,20 @@ release_shadow_gcs (XlwMenuWidget mw)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_XFT
|
#ifdef HAVE_XFT
|
||||||
|
static XftFont *
|
||||||
|
getDefaultXftFont (XlwMenuWidget mw)
|
||||||
|
{
|
||||||
|
int screen = XScreenNumberOfScreen (mw->core.screen);
|
||||||
|
return XftFontOpenName (XtDisplay (mw), screen, DEFAULT_FONTNAME);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
openXftFont (XlwMenuWidget mw)
|
openXftFont (XlwMenuWidget mw)
|
||||||
{
|
{
|
||||||
char *fname = mw->menu.faceName;
|
char *fname = mw->menu.fontName;
|
||||||
|
|
||||||
mw->menu.xft_font = 0;
|
mw->menu.xft_font = 0;
|
||||||
mw->menu.default_face = fname && strcmp (fname, DEFAULT_FACENAME) == 0;
|
mw->menu.default_face = fname && strcmp (fname, DEFAULT_FONTNAME) == 0;
|
||||||
|
|
||||||
if (fname && strcmp (fname, "none") != 0)
|
if (fname && strcmp (fname, "none") != 0)
|
||||||
{
|
{
|
||||||
|
|
@ -1864,20 +1873,23 @@ openXftFont (XlwMenuWidget mw)
|
||||||
--i;
|
--i;
|
||||||
if (fname[i] == ' ')
|
if (fname[i] == ' ')
|
||||||
{
|
{
|
||||||
fname = xstrdup (mw->menu.faceName);
|
fname = xstrdup (mw->menu.fontName);
|
||||||
fname[i] = '-';
|
fname[i] = '-';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mw->menu.font = XLoadQueryFont (XtDisplay (mw), fname);
|
||||||
|
if (!mw->menu.font)
|
||||||
|
{
|
||||||
mw->menu.xft_font = XftFontOpenName (XtDisplay (mw), screen, fname);
|
mw->menu.xft_font = XftFontOpenName (XtDisplay (mw), screen, fname);
|
||||||
if (!mw->menu.xft_font)
|
if (!mw->menu.xft_font)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Can't find font '%s'\n", fname);
|
fprintf (stderr, "Can't find font '%s'\n", fname);
|
||||||
mw->menu.xft_font = XftFontOpenName (XtDisplay (mw), screen,
|
mw->menu.xft_font = getDefaultXftFont (mw);
|
||||||
DEFAULT_FACENAME);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fname != mw->menu.faceName) free (fname);
|
if (fname != mw->menu.fontName) free (fname);
|
||||||
|
|
||||||
return mw->menu.xft_font != 0;
|
return mw->menu.xft_font != 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1913,18 +1925,18 @@ XlwMenuInitialize (Widget request, Widget w, ArgList args, Cardinal *num_args)
|
||||||
;
|
;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
mw->menu.font = XLoadQueryFont (display, mw->menu.fontName);
|
||||||
if (!mw->menu.font)
|
if (!mw->menu.font)
|
||||||
{
|
{
|
||||||
if (!xlwmenu_default_font)
|
mw->menu.font = XLoadQueryFont (display, "fixed");
|
||||||
xlwmenu_default_font = XLoadQueryFont (display, "fixed");
|
|
||||||
mw->menu.font = xlwmenu_default_font;
|
|
||||||
if (!mw->menu.font)
|
if (!mw->menu.font)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Menu font fixed not found, can't continue.\n");
|
fprintf (stderr, "Menu font fixed not found, can't continue.\n");
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_X_I18N
|
#ifdef HAVE_X_I18N
|
||||||
if (mw->menu.fontSet)
|
if (mw->menu.fontSet)
|
||||||
|
|
@ -1966,7 +1978,6 @@ XlwMenuInitialize (Widget request, Widget w, ArgList args, Cardinal *num_args)
|
||||||
static void
|
static void
|
||||||
XlwMenuClassInitialize (void)
|
XlwMenuClassInitialize (void)
|
||||||
{
|
{
|
||||||
xlwmenu_default_font = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -2126,13 +2137,13 @@ XlwMenuDestroy (Widget w)
|
||||||
|
|
||||||
#ifdef HAVE_XFT
|
#ifdef HAVE_XFT
|
||||||
static int
|
static int
|
||||||
facename_changed (XlwMenuWidget newmw,
|
fontname_changed (XlwMenuWidget newmw,
|
||||||
XlwMenuWidget oldmw)
|
XlwMenuWidget oldmw)
|
||||||
{
|
{
|
||||||
/* This will fore a new XftFont even if the same string is set.
|
/* This will force a new XftFont even if the same string is set.
|
||||||
This is good, as rendering parameters may have changed and
|
This is good, as rendering parameters may have changed and
|
||||||
we just want to do a redisplay. */
|
we just want to do a redisplay. */
|
||||||
return newmw->menu.faceName != oldmw->menu.faceName;
|
return newmw->menu.fontName != oldmw->menu.fontName;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -2158,7 +2169,7 @@ XlwMenuSetValues (Widget current, Widget request, Widget new,
|
||||||
if (newmw->core.background_pixel != oldmw->core.background_pixel
|
if (newmw->core.background_pixel != oldmw->core.background_pixel
|
||||||
|| newmw->menu.foreground != oldmw->menu.foreground
|
|| newmw->menu.foreground != oldmw->menu.foreground
|
||||||
#ifdef HAVE_XFT
|
#ifdef HAVE_XFT
|
||||||
|| facename_changed (newmw, oldmw)
|
|| fontname_changed (newmw, oldmw)
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_X_I18N
|
#ifdef HAVE_X_I18N
|
||||||
|| newmw->menu.fontSet != oldmw->menu.fontSet
|
|| newmw->menu.fontSet != oldmw->menu.fontSet
|
||||||
|
|
@ -2193,7 +2204,7 @@ XlwMenuSetValues (Widget current, Widget request, Widget new,
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_XFT
|
#ifdef HAVE_XFT
|
||||||
if (facename_changed (newmw, oldmw))
|
if (fontname_changed (newmw, oldmw))
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int screen = XScreenNumberOfScreen (newmw->core.screen);
|
int screen = XScreenNumberOfScreen (newmw->core.screen);
|
||||||
|
|
|
||||||
|
|
@ -58,10 +58,6 @@ Boston, MA 02110-1301, USA. */
|
||||||
#define XtCResizeToPreferred "ResizeToPreferred"
|
#define XtCResizeToPreferred "ResizeToPreferred"
|
||||||
#define XtNallowResize "allowResize"
|
#define XtNallowResize "allowResize"
|
||||||
#define XtCAllowResize "AllowResize"
|
#define XtCAllowResize "AllowResize"
|
||||||
#define XtNfaceName "faceName"
|
|
||||||
#define XtCFaceName "FaceName"
|
|
||||||
#define XtNdefaultFace "defaultFace"
|
|
||||||
#define XtCDefaultFace "DefaultFace"
|
|
||||||
|
|
||||||
/* Motif-compatible resource names */
|
/* Motif-compatible resource names */
|
||||||
#define XmNshadowThickness "shadowThickness"
|
#define XmNshadowThickness "shadowThickness"
|
||||||
|
|
|
||||||
|
|
@ -59,11 +59,11 @@ typedef struct _XlwMenu_part
|
||||||
XFontSetExtents *font_extents;
|
XFontSetExtents *font_extents;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_XFT
|
#ifdef HAVE_XFT
|
||||||
String faceName;
|
|
||||||
int default_face;
|
int default_face;
|
||||||
XftFont* xft_font;
|
XftFont* xft_font;
|
||||||
XftColor xft_fg, xft_bg, xft_disabled_fg;
|
XftColor xft_fg, xft_bg, xft_disabled_fg;
|
||||||
#endif
|
#endif
|
||||||
|
String fontName;
|
||||||
XFontStruct* font;
|
XFontStruct* font;
|
||||||
Pixel foreground;
|
Pixel foreground;
|
||||||
Pixel disabled_foreground;
|
Pixel disabled_foreground;
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,14 @@
|
||||||
|
2011-02-14 Jan Djärv <jan.h.d@swipnet.se>
|
||||||
|
|
||||||
|
* xrdb.c (x_load_resources): For LUCID and XFT, don't put a
|
||||||
|
resource that specifies helvetica for menus and dialogs.
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2011-02-14 Tom Tromey <tromey@redhat.com>
|
2011-02-14 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
* keyboard.h: Remove obsolete comment.
|
* keyboard.h: Remove obsolete comment.
|
||||||
|
|
|
||||||
42
src/xmenu.c
42
src/xmenu.c
|
|
@ -887,31 +887,26 @@ apply_systemfont_to_dialog (Widget w)
|
||||||
{
|
{
|
||||||
XrmDatabase db = XtDatabase (XtDisplay (w));
|
XrmDatabase db = XtDatabase (XtDisplay (w));
|
||||||
if (db)
|
if (db)
|
||||||
XrmPutStringResource (&db, "*dialog.faceName", fn);
|
XrmPutStringResource (&db, "*dialog.font", fn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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 ();
|
const char *fn = xsettings_get_system_normal_font ();
|
||||||
int defflt;
|
|
||||||
|
|
||||||
if (!fn) return;
|
if (fn)
|
||||||
|
|
||||||
if (XtIsShell (w)) /* popup menu */
|
|
||||||
{
|
{
|
||||||
Widget *childs = NULL;
|
XrmDatabase db = XtDatabase (XtDisplay (w));
|
||||||
|
if (db)
|
||||||
XtVaGetValues (w, XtNchildren, &childs, NULL);
|
{
|
||||||
if (*childs) w = *childs;
|
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
|
#endif
|
||||||
|
|
||||||
/* Set the contents of the menubar widgets of frame F.
|
/* 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()";
|
char menuOverride[] = "Ctrl<KeyPress>g: MenuGadgetEscape()";
|
||||||
XtTranslations override = XtParseTranslationTable (menuOverride);
|
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,
|
f->output_data.x->column_widget,
|
||||||
0,
|
0,
|
||||||
popup_activate_callback,
|
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. */
|
/* Make menu pop down on C-g. */
|
||||||
XtOverrideTranslations (menubar_widget, override);
|
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))
|
if (! FRAME_X_P (f))
|
||||||
abort ();
|
abort ();
|
||||||
|
|
||||||
|
#ifdef USE_LUCID
|
||||||
|
apply_systemfont_to_menu (f, f->output_data.x->widget);
|
||||||
|
#endif
|
||||||
|
|
||||||
menu_id = widget_id_tick++;
|
menu_id = widget_id_tick++;
|
||||||
menu = lw_create_widget ("popup", first_wv->name, menu_id, first_wv,
|
menu = lw_create_widget ("popup", first_wv->name, menu_id, first_wv,
|
||||||
f->output_data.x->widget, 1, 0,
|
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,
|
popup_deactivate_callback,
|
||||||
menu_highlight_callback);
|
menu_highlight_callback);
|
||||||
|
|
||||||
#ifdef USE_LUCID
|
|
||||||
apply_systemfont_to_menu (menu);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
dummy.type = ButtonPress;
|
dummy.type = ButtonPress;
|
||||||
dummy.serial = 0;
|
dummy.serial = 0;
|
||||||
dummy.send_event = 0;
|
dummy.send_event = 0;
|
||||||
|
|
|
||||||
|
|
@ -546,12 +546,14 @@ x_load_resources (Display *display, const char *xrm_string,
|
||||||
|
|
||||||
#else /* not USE_MOTIF */
|
#else /* not USE_MOTIF */
|
||||||
|
|
||||||
sprintf (line, "Emacs.dialog*.font: %s", helv);
|
|
||||||
XrmPutLineResource (&rdb, line);
|
|
||||||
sprintf (line, "Emacs.dialog*.background: grey75");
|
sprintf (line, "Emacs.dialog*.background: grey75");
|
||||||
XrmPutLineResource (&rdb, line);
|
XrmPutLineResource (&rdb, line);
|
||||||
|
#if !defined (HAVE_XFT) || !defined (USE_LUCID)
|
||||||
|
sprintf (line, "Emacs.dialog*.font: %s", helv);
|
||||||
|
XrmPutLineResource (&rdb, line);
|
||||||
sprintf (line, "*XlwMenu*font: %s", helv);
|
sprintf (line, "*XlwMenu*font: %s", helv);
|
||||||
XrmPutLineResource (&rdb, line);
|
XrmPutLineResource (&rdb, line);
|
||||||
|
#endif
|
||||||
sprintf (line, "*XlwMenu*background: grey75");
|
sprintf (line, "*XlwMenu*background: grey75");
|
||||||
XrmPutLineResource (&rdb, line);
|
XrmPutLineResource (&rdb, line);
|
||||||
sprintf (line, "Emacs*verticalScrollBar.background: grey75");
|
sprintf (line, "Emacs*verticalScrollBar.background: grey75");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue