2005-03-12 23:38:43 +00:00
|
|
|
/* Internals of a lightweight menubar widget.
|
2011-01-26 08:36:39 +00:00
|
|
|
|
2024-01-02 01:47:10 +00:00
|
|
|
Copyright (C) 2002-2024 Free Software Foundation, Inc.
|
2007-02-27 03:10:29 +00:00
|
|
|
Copyright (C) 1992 Lucid, Inc.
|
2005-03-12 23:38:43 +00:00
|
|
|
|
|
|
|
This file is part of the Lucid Widget Library.
|
|
|
|
|
|
|
|
The Lucid Widget Library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License as published by
|
2007-02-28 03:59:36 +00:00
|
|
|
the Free Software Foundation; either version 1, or (at your option)
|
2005-03-12 23:38:43 +00:00
|
|
|
any later version.
|
|
|
|
|
|
|
|
The Lucid Widget Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2017-09-13 22:52:52 +00:00
|
|
|
along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
|
2005-03-12 23:38:43 +00:00
|
|
|
|
1994-05-06 17:28:42 +00:00
|
|
|
#ifndef _XlwMenuP_h
|
|
|
|
#define _XlwMenuP_h
|
|
|
|
|
|
|
|
#include "xlwmenu.h"
|
|
|
|
#include <X11/CoreP.h>
|
Don't link libXft when using cairo
* configure.ac: Check cairo early. Don't try Xft if cairo is used.
* lwlib/lwlib-utils.h [USE_CAIRO]: Include cairo.h and fontconfig.h.
(XftFont, XftDraw, XftColor, XGlyphInfo) [USE_CAIRO]: New typedefs.
(XftFontOpenName, XftFontClose, XftDrawCreate, XftDrawDestroy)
(XftDrawRect, XftDrawStringUtf8, XftTextExtentsUtf8) [USE_CAIRO]: New macros.
(crxft_font_open_name, crxft_font_close, crxft_draw_create)
(crxft_draw_rect, crxft_draw_string, crxft_text_extents) [USE_CAIRO]: New
externs.
* lwlib/lwlib-utils.c [USE_CAIRO]: Include math.h, cairo-ft.h, and
cairo-xlib.h.
(crxft_font_open_name, crxft_font_close, crxft_draw_create)
(crxft_set_source_color, crxft_draw_rect, crxft_draw_string)
(crxft_text_extents) [USE_CAIRO]: New Xft compatibility functions.
* lwlib/xlwmenuP.h [USE_CAIRO]: Include lwlib-utils.h.
* lwlib/xlwmenu.c (display_menu_item) [USE_CAIRO]: Call
cairo_surface_mark_dirty and cairo_surface_flush.
* lwlib/lwlib-Xaw.c [USE_CAIRO]: Include stdlib.h and lwlib-utils.h.
(draw_text) [USE_CAIRO]: Call cairo_surface_flush.
* src/xsettings.c [USE_CAIRO]: Include fontconfig.h
(apply_xft_settings) [!HAVE_XFT]: Don't call XftDefaultSubstitute or
XftDefaultSet.
* lwlib/lwlib-Xaw.c:
* lwlib/lwlib-int.h:
* lwlib/xlwmenu.c:
* lwlib/xlwmenuP.h:
* src/xrdb.c:
* src/xsettings.c:
* src/xterm.c: Replace all #ifdef HAVE_XFT with #if defined USE_CAIRO ||
defined HAVE_XFT.
* src/xfns.c (x_default_font_parameter): Replace #ifdef HAVE_XFT with #if
defined USE_CAIRO || defined HAVE_XFT.
2019-04-24 03:31:37 +00:00
|
|
|
#if defined USE_CAIRO || defined HAVE_XFT
|
|
|
|
#ifdef USE_CAIRO
|
|
|
|
#include "lwlib-utils.h"
|
|
|
|
#else /* HAVE_XFT */
|
Lucid menus can now use Xft for fonts.
* xsettings.c (current_font, SYSTEM_FONT, XSETTINGS_FONT_NAME): New.
(parse_xft_settings): Also check for XSETTINGS_FONT_NAME and save that
in current_font.
(init_gconf): Read value of SYSTEM_FONT and save it in current_font.
(Ffont_get_system_normal_font, xsettings_get_system_normal_font): New
functions.
(syms_of_xsettings): Initialize current_font. defsubr
Sfont_get_system_normal_font.
* xsettings.h (Ffont_get_system_normal_font,
xsettings_get_system_normal_font): Declare.
* xfns.c (extern xlwmenu_default_font): Remove.
(Fx_create_frame): Remove setting of xlwmenu_default_font, moved
to xlwmenu.c.
* menu.c (digest_single_submenu): If USE_LUCID and HAVE_XFT, encode
menu items in UTF-8.
* xmenu.c: include xsettings.h and xlwmenu.h if USE_LUCID.
(apply_systemfont_to_menu): New function.
(set_frame_menubar, create_and_show_popup_menu): Call
apply_systemfont_to_menu.
* xlwmenu.c (xlwmenu_default_font): Make static.
(xlwMenuResources): Add XtNfaceName and XtNdefaultFace.
(string_width): Use XftTextExtentsUtf8 if HAVE_XFT.
(MENU_FONT_HEIGHT, MENU_FONT_ASCENT): Add versions for
HAVE_XFT.
(size_menu): Set max_rest_width in window_state structure.
(display_menu_item): If HAVE_XFT and xft_draw is set, use
XftDrawRect and XftDrawStringUtf8 to draw text.
(make_windows_if_needed): Set max_rest_width and xft_draw
in windows[i].
(openXftFont): New.
(XlwMenuInitialize): Call openXftFont if HAVE_XFT. If mw->menu.font
is not set, load font fixed and save it in xlwmenu_default_font.
(XlwMenuInitialize): Set max_rest_width and xft_draw in windows[0].
(XlwMenuClassInitialize): Initialize xlwmenu_default_font.
(XlwMenuRealize): Set xft_fg, xft_bg, xft_disabled_fg and
windows[0].xft_draw if xft_font is set.
(XlwMenuDestroy): Destroy all xft_draw and close xft_font.
(facename_changed): New.
(XlwMenuSetValues): Call facename_changed. If face name did change,
close old fonts and destroy xft_draw:s. Then create new ones.
* xlwmenu.h (XtNfaceName, XtCFaceName, XtNdefaultFace,
XtCDefaultFace): New.
* xlwmenuP.h (_window_state): Add max_rest_width and xft_draw.
(_XlwMenu_part): Add faceName,xft_fg, xft_bg, xft_disabled_fg and
xft_font.
* xresources.texi (Lucid Resources): Mention faceName to set Xft fonts.
2010-04-08 16:20:32 +00:00
|
|
|
#include <X11/Xft/Xft.h>
|
|
|
|
#endif
|
Don't link libXft when using cairo
* configure.ac: Check cairo early. Don't try Xft if cairo is used.
* lwlib/lwlib-utils.h [USE_CAIRO]: Include cairo.h and fontconfig.h.
(XftFont, XftDraw, XftColor, XGlyphInfo) [USE_CAIRO]: New typedefs.
(XftFontOpenName, XftFontClose, XftDrawCreate, XftDrawDestroy)
(XftDrawRect, XftDrawStringUtf8, XftTextExtentsUtf8) [USE_CAIRO]: New macros.
(crxft_font_open_name, crxft_font_close, crxft_draw_create)
(crxft_draw_rect, crxft_draw_string, crxft_text_extents) [USE_CAIRO]: New
externs.
* lwlib/lwlib-utils.c [USE_CAIRO]: Include math.h, cairo-ft.h, and
cairo-xlib.h.
(crxft_font_open_name, crxft_font_close, crxft_draw_create)
(crxft_set_source_color, crxft_draw_rect, crxft_draw_string)
(crxft_text_extents) [USE_CAIRO]: New Xft compatibility functions.
* lwlib/xlwmenuP.h [USE_CAIRO]: Include lwlib-utils.h.
* lwlib/xlwmenu.c (display_menu_item) [USE_CAIRO]: Call
cairo_surface_mark_dirty and cairo_surface_flush.
* lwlib/lwlib-Xaw.c [USE_CAIRO]: Include stdlib.h and lwlib-utils.h.
(draw_text) [USE_CAIRO]: Call cairo_surface_flush.
* src/xsettings.c [USE_CAIRO]: Include fontconfig.h
(apply_xft_settings) [!HAVE_XFT]: Don't call XftDefaultSubstitute or
XftDefaultSet.
* lwlib/lwlib-Xaw.c:
* lwlib/lwlib-int.h:
* lwlib/xlwmenu.c:
* lwlib/xlwmenuP.h:
* src/xrdb.c:
* src/xsettings.c:
* src/xterm.c: Replace all #ifdef HAVE_XFT with #if defined USE_CAIRO ||
defined HAVE_XFT.
* src/xfns.c (x_default_font_parameter): Replace #ifdef HAVE_XFT with #if
defined USE_CAIRO || defined HAVE_XFT.
2019-04-24 03:31:37 +00:00
|
|
|
#endif
|
1994-05-06 17:28:42 +00:00
|
|
|
|
|
|
|
/* Elements in the stack arrays. */
|
|
|
|
typedef struct _window_state
|
|
|
|
{
|
2010-04-17 17:43:03 +00:00
|
|
|
Widget w;
|
1994-05-06 17:28:42 +00:00
|
|
|
Window window;
|
2010-04-17 17:43:03 +00:00
|
|
|
Pixmap pixmap;
|
1994-05-06 17:28:42 +00:00
|
|
|
Position x;
|
|
|
|
Position y;
|
|
|
|
Dimension width;
|
|
|
|
Dimension height;
|
|
|
|
Dimension label_width;
|
Lucid menus can now use Xft for fonts.
* xsettings.c (current_font, SYSTEM_FONT, XSETTINGS_FONT_NAME): New.
(parse_xft_settings): Also check for XSETTINGS_FONT_NAME and save that
in current_font.
(init_gconf): Read value of SYSTEM_FONT and save it in current_font.
(Ffont_get_system_normal_font, xsettings_get_system_normal_font): New
functions.
(syms_of_xsettings): Initialize current_font. defsubr
Sfont_get_system_normal_font.
* xsettings.h (Ffont_get_system_normal_font,
xsettings_get_system_normal_font): Declare.
* xfns.c (extern xlwmenu_default_font): Remove.
(Fx_create_frame): Remove setting of xlwmenu_default_font, moved
to xlwmenu.c.
* menu.c (digest_single_submenu): If USE_LUCID and HAVE_XFT, encode
menu items in UTF-8.
* xmenu.c: include xsettings.h and xlwmenu.h if USE_LUCID.
(apply_systemfont_to_menu): New function.
(set_frame_menubar, create_and_show_popup_menu): Call
apply_systemfont_to_menu.
* xlwmenu.c (xlwmenu_default_font): Make static.
(xlwMenuResources): Add XtNfaceName and XtNdefaultFace.
(string_width): Use XftTextExtentsUtf8 if HAVE_XFT.
(MENU_FONT_HEIGHT, MENU_FONT_ASCENT): Add versions for
HAVE_XFT.
(size_menu): Set max_rest_width in window_state structure.
(display_menu_item): If HAVE_XFT and xft_draw is set, use
XftDrawRect and XftDrawStringUtf8 to draw text.
(make_windows_if_needed): Set max_rest_width and xft_draw
in windows[i].
(openXftFont): New.
(XlwMenuInitialize): Call openXftFont if HAVE_XFT. If mw->menu.font
is not set, load font fixed and save it in xlwmenu_default_font.
(XlwMenuInitialize): Set max_rest_width and xft_draw in windows[0].
(XlwMenuClassInitialize): Initialize xlwmenu_default_font.
(XlwMenuRealize): Set xft_fg, xft_bg, xft_disabled_fg and
windows[0].xft_draw if xft_font is set.
(XlwMenuDestroy): Destroy all xft_draw and close xft_font.
(facename_changed): New.
(XlwMenuSetValues): Call facename_changed. If face name did change,
close old fonts and destroy xft_draw:s. Then create new ones.
* xlwmenu.h (XtNfaceName, XtCFaceName, XtNdefaultFace,
XtCDefaultFace): New.
* xlwmenuP.h (_window_state): Add max_rest_width and xft_draw.
(_XlwMenu_part): Add faceName,xft_fg, xft_bg, xft_disabled_fg and
xft_font.
* xresources.texi (Lucid Resources): Mention faceName to set Xft fonts.
2010-04-08 16:20:32 +00:00
|
|
|
int max_rest_width;
|
1999-07-21 21:43:52 +00:00
|
|
|
|
|
|
|
/* Width of toggle buttons or radio buttons. */
|
|
|
|
Dimension button_width;
|
Don't link libXft when using cairo
* configure.ac: Check cairo early. Don't try Xft if cairo is used.
* lwlib/lwlib-utils.h [USE_CAIRO]: Include cairo.h and fontconfig.h.
(XftFont, XftDraw, XftColor, XGlyphInfo) [USE_CAIRO]: New typedefs.
(XftFontOpenName, XftFontClose, XftDrawCreate, XftDrawDestroy)
(XftDrawRect, XftDrawStringUtf8, XftTextExtentsUtf8) [USE_CAIRO]: New macros.
(crxft_font_open_name, crxft_font_close, crxft_draw_create)
(crxft_draw_rect, crxft_draw_string, crxft_text_extents) [USE_CAIRO]: New
externs.
* lwlib/lwlib-utils.c [USE_CAIRO]: Include math.h, cairo-ft.h, and
cairo-xlib.h.
(crxft_font_open_name, crxft_font_close, crxft_draw_create)
(crxft_set_source_color, crxft_draw_rect, crxft_draw_string)
(crxft_text_extents) [USE_CAIRO]: New Xft compatibility functions.
* lwlib/xlwmenuP.h [USE_CAIRO]: Include lwlib-utils.h.
* lwlib/xlwmenu.c (display_menu_item) [USE_CAIRO]: Call
cairo_surface_mark_dirty and cairo_surface_flush.
* lwlib/lwlib-Xaw.c [USE_CAIRO]: Include stdlib.h and lwlib-utils.h.
(draw_text) [USE_CAIRO]: Call cairo_surface_flush.
* src/xsettings.c [USE_CAIRO]: Include fontconfig.h
(apply_xft_settings) [!HAVE_XFT]: Don't call XftDefaultSubstitute or
XftDefaultSet.
* lwlib/lwlib-Xaw.c:
* lwlib/lwlib-int.h:
* lwlib/xlwmenu.c:
* lwlib/xlwmenuP.h:
* src/xrdb.c:
* src/xsettings.c:
* src/xterm.c: Replace all #ifdef HAVE_XFT with #if defined USE_CAIRO ||
defined HAVE_XFT.
* src/xfns.c (x_default_font_parameter): Replace #ifdef HAVE_XFT with #if
defined USE_CAIRO || defined HAVE_XFT.
2019-04-24 03:31:37 +00:00
|
|
|
#if defined USE_CAIRO || defined HAVE_XFT
|
Lucid menus can now use Xft for fonts.
* xsettings.c (current_font, SYSTEM_FONT, XSETTINGS_FONT_NAME): New.
(parse_xft_settings): Also check for XSETTINGS_FONT_NAME and save that
in current_font.
(init_gconf): Read value of SYSTEM_FONT and save it in current_font.
(Ffont_get_system_normal_font, xsettings_get_system_normal_font): New
functions.
(syms_of_xsettings): Initialize current_font. defsubr
Sfont_get_system_normal_font.
* xsettings.h (Ffont_get_system_normal_font,
xsettings_get_system_normal_font): Declare.
* xfns.c (extern xlwmenu_default_font): Remove.
(Fx_create_frame): Remove setting of xlwmenu_default_font, moved
to xlwmenu.c.
* menu.c (digest_single_submenu): If USE_LUCID and HAVE_XFT, encode
menu items in UTF-8.
* xmenu.c: include xsettings.h and xlwmenu.h if USE_LUCID.
(apply_systemfont_to_menu): New function.
(set_frame_menubar, create_and_show_popup_menu): Call
apply_systemfont_to_menu.
* xlwmenu.c (xlwmenu_default_font): Make static.
(xlwMenuResources): Add XtNfaceName and XtNdefaultFace.
(string_width): Use XftTextExtentsUtf8 if HAVE_XFT.
(MENU_FONT_HEIGHT, MENU_FONT_ASCENT): Add versions for
HAVE_XFT.
(size_menu): Set max_rest_width in window_state structure.
(display_menu_item): If HAVE_XFT and xft_draw is set, use
XftDrawRect and XftDrawStringUtf8 to draw text.
(make_windows_if_needed): Set max_rest_width and xft_draw
in windows[i].
(openXftFont): New.
(XlwMenuInitialize): Call openXftFont if HAVE_XFT. If mw->menu.font
is not set, load font fixed and save it in xlwmenu_default_font.
(XlwMenuInitialize): Set max_rest_width and xft_draw in windows[0].
(XlwMenuClassInitialize): Initialize xlwmenu_default_font.
(XlwMenuRealize): Set xft_fg, xft_bg, xft_disabled_fg and
windows[0].xft_draw if xft_font is set.
(XlwMenuDestroy): Destroy all xft_draw and close xft_font.
(facename_changed): New.
(XlwMenuSetValues): Call facename_changed. If face name did change,
close old fonts and destroy xft_draw:s. Then create new ones.
* xlwmenu.h (XtNfaceName, XtCFaceName, XtNdefaultFace,
XtCDefaultFace): New.
* xlwmenuP.h (_window_state): Add max_rest_width and xft_draw.
(_XlwMenu_part): Add faceName,xft_fg, xft_bg, xft_disabled_fg and
xft_font.
* xresources.texi (Lucid Resources): Mention faceName to set Xft fonts.
2010-04-08 16:20:32 +00:00
|
|
|
XftDraw* xft_draw;
|
|
|
|
#endif
|
1994-05-06 17:28:42 +00:00
|
|
|
} window_state;
|
|
|
|
|
|
|
|
|
|
|
|
/* New fields for the XlwMenu widget instance record */
|
2002-05-06 18:54:28 +00:00
|
|
|
typedef struct _XlwMenu_part
|
1994-05-06 17:28:42 +00:00
|
|
|
{
|
|
|
|
/* slots set by the resources */
|
2005-03-18 04:19:41 +00:00
|
|
|
#ifdef HAVE_X_I18N
|
2005-04-01 18:42:33 +00:00
|
|
|
XFontSet fontSet;
|
2005-03-18 04:19:41 +00:00
|
|
|
XFontSetExtents *font_extents;
|
Lucid menus can now use Xft for fonts.
* xsettings.c (current_font, SYSTEM_FONT, XSETTINGS_FONT_NAME): New.
(parse_xft_settings): Also check for XSETTINGS_FONT_NAME and save that
in current_font.
(init_gconf): Read value of SYSTEM_FONT and save it in current_font.
(Ffont_get_system_normal_font, xsettings_get_system_normal_font): New
functions.
(syms_of_xsettings): Initialize current_font. defsubr
Sfont_get_system_normal_font.
* xsettings.h (Ffont_get_system_normal_font,
xsettings_get_system_normal_font): Declare.
* xfns.c (extern xlwmenu_default_font): Remove.
(Fx_create_frame): Remove setting of xlwmenu_default_font, moved
to xlwmenu.c.
* menu.c (digest_single_submenu): If USE_LUCID and HAVE_XFT, encode
menu items in UTF-8.
* xmenu.c: include xsettings.h and xlwmenu.h if USE_LUCID.
(apply_systemfont_to_menu): New function.
(set_frame_menubar, create_and_show_popup_menu): Call
apply_systemfont_to_menu.
* xlwmenu.c (xlwmenu_default_font): Make static.
(xlwMenuResources): Add XtNfaceName and XtNdefaultFace.
(string_width): Use XftTextExtentsUtf8 if HAVE_XFT.
(MENU_FONT_HEIGHT, MENU_FONT_ASCENT): Add versions for
HAVE_XFT.
(size_menu): Set max_rest_width in window_state structure.
(display_menu_item): If HAVE_XFT and xft_draw is set, use
XftDrawRect and XftDrawStringUtf8 to draw text.
(make_windows_if_needed): Set max_rest_width and xft_draw
in windows[i].
(openXftFont): New.
(XlwMenuInitialize): Call openXftFont if HAVE_XFT. If mw->menu.font
is not set, load font fixed and save it in xlwmenu_default_font.
(XlwMenuInitialize): Set max_rest_width and xft_draw in windows[0].
(XlwMenuClassInitialize): Initialize xlwmenu_default_font.
(XlwMenuRealize): Set xft_fg, xft_bg, xft_disabled_fg and
windows[0].xft_draw if xft_font is set.
(XlwMenuDestroy): Destroy all xft_draw and close xft_font.
(facename_changed): New.
(XlwMenuSetValues): Call facename_changed. If face name did change,
close old fonts and destroy xft_draw:s. Then create new ones.
* xlwmenu.h (XtNfaceName, XtCFaceName, XtNdefaultFace,
XtCDefaultFace): New.
* xlwmenuP.h (_window_state): Add max_rest_width and xft_draw.
(_XlwMenu_part): Add faceName,xft_fg, xft_bg, xft_disabled_fg and
xft_font.
* xresources.texi (Lucid Resources): Mention faceName to set Xft fonts.
2010-04-08 16:20:32 +00:00
|
|
|
#endif
|
Don't link libXft when using cairo
* configure.ac: Check cairo early. Don't try Xft if cairo is used.
* lwlib/lwlib-utils.h [USE_CAIRO]: Include cairo.h and fontconfig.h.
(XftFont, XftDraw, XftColor, XGlyphInfo) [USE_CAIRO]: New typedefs.
(XftFontOpenName, XftFontClose, XftDrawCreate, XftDrawDestroy)
(XftDrawRect, XftDrawStringUtf8, XftTextExtentsUtf8) [USE_CAIRO]: New macros.
(crxft_font_open_name, crxft_font_close, crxft_draw_create)
(crxft_draw_rect, crxft_draw_string, crxft_text_extents) [USE_CAIRO]: New
externs.
* lwlib/lwlib-utils.c [USE_CAIRO]: Include math.h, cairo-ft.h, and
cairo-xlib.h.
(crxft_font_open_name, crxft_font_close, crxft_draw_create)
(crxft_set_source_color, crxft_draw_rect, crxft_draw_string)
(crxft_text_extents) [USE_CAIRO]: New Xft compatibility functions.
* lwlib/xlwmenuP.h [USE_CAIRO]: Include lwlib-utils.h.
* lwlib/xlwmenu.c (display_menu_item) [USE_CAIRO]: Call
cairo_surface_mark_dirty and cairo_surface_flush.
* lwlib/lwlib-Xaw.c [USE_CAIRO]: Include stdlib.h and lwlib-utils.h.
(draw_text) [USE_CAIRO]: Call cairo_surface_flush.
* src/xsettings.c [USE_CAIRO]: Include fontconfig.h
(apply_xft_settings) [!HAVE_XFT]: Don't call XftDefaultSubstitute or
XftDefaultSet.
* lwlib/lwlib-Xaw.c:
* lwlib/lwlib-int.h:
* lwlib/xlwmenu.c:
* lwlib/xlwmenuP.h:
* src/xrdb.c:
* src/xsettings.c:
* src/xterm.c: Replace all #ifdef HAVE_XFT with #if defined USE_CAIRO ||
defined HAVE_XFT.
* src/xfns.c (x_default_font_parameter): Replace #ifdef HAVE_XFT with #if
defined USE_CAIRO || defined HAVE_XFT.
2019-04-24 03:31:37 +00:00
|
|
|
#if defined USE_CAIRO || defined HAVE_XFT
|
Lucid menus can now use Xft for fonts.
* xsettings.c (current_font, SYSTEM_FONT, XSETTINGS_FONT_NAME): New.
(parse_xft_settings): Also check for XSETTINGS_FONT_NAME and save that
in current_font.
(init_gconf): Read value of SYSTEM_FONT and save it in current_font.
(Ffont_get_system_normal_font, xsettings_get_system_normal_font): New
functions.
(syms_of_xsettings): Initialize current_font. defsubr
Sfont_get_system_normal_font.
* xsettings.h (Ffont_get_system_normal_font,
xsettings_get_system_normal_font): Declare.
* xfns.c (extern xlwmenu_default_font): Remove.
(Fx_create_frame): Remove setting of xlwmenu_default_font, moved
to xlwmenu.c.
* menu.c (digest_single_submenu): If USE_LUCID and HAVE_XFT, encode
menu items in UTF-8.
* xmenu.c: include xsettings.h and xlwmenu.h if USE_LUCID.
(apply_systemfont_to_menu): New function.
(set_frame_menubar, create_and_show_popup_menu): Call
apply_systemfont_to_menu.
* xlwmenu.c (xlwmenu_default_font): Make static.
(xlwMenuResources): Add XtNfaceName and XtNdefaultFace.
(string_width): Use XftTextExtentsUtf8 if HAVE_XFT.
(MENU_FONT_HEIGHT, MENU_FONT_ASCENT): Add versions for
HAVE_XFT.
(size_menu): Set max_rest_width in window_state structure.
(display_menu_item): If HAVE_XFT and xft_draw is set, use
XftDrawRect and XftDrawStringUtf8 to draw text.
(make_windows_if_needed): Set max_rest_width and xft_draw
in windows[i].
(openXftFont): New.
(XlwMenuInitialize): Call openXftFont if HAVE_XFT. If mw->menu.font
is not set, load font fixed and save it in xlwmenu_default_font.
(XlwMenuInitialize): Set max_rest_width and xft_draw in windows[0].
(XlwMenuClassInitialize): Initialize xlwmenu_default_font.
(XlwMenuRealize): Set xft_fg, xft_bg, xft_disabled_fg and
windows[0].xft_draw if xft_font is set.
(XlwMenuDestroy): Destroy all xft_draw and close xft_font.
(facename_changed): New.
(XlwMenuSetValues): Call facename_changed. If face name did change,
close old fonts and destroy xft_draw:s. Then create new ones.
* xlwmenu.h (XtNfaceName, XtCFaceName, XtNdefaultFace,
XtCDefaultFace): New.
* xlwmenuP.h (_window_state): Add max_rest_width and xft_draw.
(_XlwMenu_part): Add faceName,xft_fg, xft_bg, xft_disabled_fg and
xft_font.
* xresources.texi (Lucid Resources): Mention faceName to set Xft fonts.
2010-04-08 16:20:32 +00:00
|
|
|
int default_face;
|
|
|
|
XftFont* xft_font;
|
2022-07-11 09:14:08 +00:00
|
|
|
XftColor xft_fg, xft_bg, xft_disabled_fg, xft_highlight_fg;
|
2005-03-18 04:19:41 +00:00
|
|
|
#endif
|
2011-02-14 17:21:10 +00:00
|
|
|
String fontName;
|
2005-04-01 18:42:33 +00:00
|
|
|
XFontStruct* font;
|
1994-05-06 17:29:23 +00:00
|
|
|
Pixel foreground;
|
2002-05-06 18:54:28 +00:00
|
|
|
Pixel disabled_foreground;
|
1994-05-06 17:28:42 +00:00
|
|
|
Pixel button_foreground;
|
2022-07-11 09:14:08 +00:00
|
|
|
Pixel highlight_foreground;
|
|
|
|
Pixel highlight_background;
|
1994-05-06 17:28:42 +00:00
|
|
|
Dimension margin;
|
|
|
|
Dimension horizontal_spacing;
|
|
|
|
Dimension vertical_spacing;
|
|
|
|
Dimension arrow_spacing;
|
|
|
|
Dimension shadow_thickness;
|
2021-11-16 08:00:24 +00:00
|
|
|
Dimension border_thickness;
|
1994-05-06 17:28:42 +00:00
|
|
|
Pixel top_shadow_color;
|
|
|
|
Pixel bottom_shadow_color;
|
|
|
|
Pixmap top_shadow_pixmap;
|
|
|
|
Pixmap bottom_shadow_pixmap;
|
2022-07-11 09:14:08 +00:00
|
|
|
Pixel top_highlight_shadow_color;
|
|
|
|
Pixel bottom_highlight_shadow_color;
|
|
|
|
Pixmap top_highlight_shadow_pixmap;
|
|
|
|
Pixmap bottom_highlight_shadow_pixmap;
|
1994-05-06 17:29:23 +00:00
|
|
|
Cursor cursor_shape;
|
1994-05-06 17:28:42 +00:00
|
|
|
XtCallbackList open;
|
2000-01-17 09:11:23 +00:00
|
|
|
XtCallbackList select, highlight;
|
2007-01-01 15:19:58 +00:00
|
|
|
XtCallbackList enter, leave;
|
1994-05-06 17:28:42 +00:00
|
|
|
widget_value* contents;
|
|
|
|
int horizontal;
|
2000-06-16 18:33:58 +00:00
|
|
|
|
|
|
|
/* True means top_shadow_color and/or bottom_shadow_color must be freed. */
|
2022-07-11 09:14:08 +00:00
|
|
|
Boolean free_top_shadow_color_p;
|
|
|
|
Boolean free_bottom_shadow_color_p;
|
|
|
|
Boolean free_top_highlight_shadow_color_p;
|
|
|
|
Boolean free_bottom_highlight_shadow_color_p;
|
2002-05-06 18:54:28 +00:00
|
|
|
|
1994-05-06 17:28:42 +00:00
|
|
|
/* State of the XlwMenu */
|
2004-01-12 01:45:22 +00:00
|
|
|
int top_depth;
|
1994-05-06 17:28:42 +00:00
|
|
|
int old_depth;
|
|
|
|
widget_value** old_stack;
|
|
|
|
int old_stack_length;
|
2007-01-01 15:19:58 +00:00
|
|
|
widget_value* inside_entry;
|
1994-05-06 17:28:42 +00:00
|
|
|
|
|
|
|
/* New state after the user moved */
|
|
|
|
int new_depth;
|
|
|
|
widget_value** new_stack;
|
|
|
|
int new_stack_length;
|
|
|
|
|
|
|
|
/* Window resources */
|
|
|
|
window_state* windows;
|
|
|
|
int windows_length;
|
|
|
|
|
|
|
|
/* Internal part, set by the XlwMenu */
|
|
|
|
GC foreground_gc;
|
|
|
|
GC button_gc;
|
|
|
|
GC background_gc;
|
2002-05-06 18:54:28 +00:00
|
|
|
GC disabled_gc;
|
2022-07-11 09:14:08 +00:00
|
|
|
GC highlight_foreground_gc;
|
|
|
|
GC highlight_background_gc;
|
1994-05-06 17:28:42 +00:00
|
|
|
GC inactive_button_gc;
|
|
|
|
GC shadow_top_gc;
|
|
|
|
GC shadow_bottom_gc;
|
2022-07-11 09:14:08 +00:00
|
|
|
GC highlight_shadow_top_gc;
|
|
|
|
GC highlight_shadow_bottom_gc;
|
1994-05-06 17:28:42 +00:00
|
|
|
Cursor cursor;
|
|
|
|
Boolean popped_up;
|
|
|
|
Pixmap gray_pixmap;
|
|
|
|
} XlwMenuPart;
|
|
|
|
|
|
|
|
/* Full instance record declaration */
|
2002-05-06 18:54:28 +00:00
|
|
|
typedef struct _XlwMenuRec
|
1994-05-06 17:28:42 +00:00
|
|
|
{
|
|
|
|
CorePart core;
|
|
|
|
XlwMenuPart menu;
|
|
|
|
} XlwMenuRec;
|
|
|
|
|
|
|
|
/* New fields for the XlwMenu widget class record */
|
2002-05-06 18:54:28 +00:00
|
|
|
typedef struct
|
1994-05-06 17:28:42 +00:00
|
|
|
{
|
|
|
|
int dummy;
|
|
|
|
} XlwMenuClassPart;
|
|
|
|
|
|
|
|
/* Full class record declaration. */
|
2002-05-06 18:54:28 +00:00
|
|
|
typedef struct _XlwMenuClassRec
|
1994-05-06 17:28:42 +00:00
|
|
|
{
|
|
|
|
CoreClassPart core_class;
|
|
|
|
XlwMenuClassPart menu_class;
|
|
|
|
} XlwMenuClassRec;
|
|
|
|
|
|
|
|
/* Class pointer. */
|
|
|
|
extern XlwMenuClassRec xlwMenuClassRec;
|
|
|
|
|
|
|
|
#endif /* _XlwMenuP_h */
|