mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-24 07:20:37 +00:00
Make Emacs build with some other XLib implementations
* configure.ac (HAVE_XKB): Check for functions that aren't always implemented by various XLib implementations. * src/xfns.c (select_visual): Handle NULL values of vinfo. (XkbRefreshKeyboardMapping): (XkbFreeNames): (XDisplayCells): (XDestroySubwindows): Define replacement functions where they aren't available. * src/xterm.c (x_find_modifier_meanings): Handle NULL values of various fields.
This commit is contained in:
parent
52c4275283
commit
a654985bca
@ -2620,10 +2620,11 @@ if test "${HAVE_X11}" = "yes"; then
|
||||
emacs_cv_xkb=yes, emacs_cv_xkb=no)])
|
||||
if test $emacs_cv_xkb = yes; then
|
||||
AC_DEFINE(HAVE_XKB, 1, [Define to 1 if you have the Xkb extension.])
|
||||
AC_CHECK_FUNCS(XkbRefreshKeyboardMapping XkbFreeNames)
|
||||
fi
|
||||
|
||||
AC_CHECK_FUNCS(XrmSetDatabase XScreenResourceString \
|
||||
XScreenNumberOfScreen)
|
||||
AC_CHECK_FUNCS(XrmSetDatabase XScreenResourceString XScreenNumberOfScreen)
|
||||
AC_CHECK_FUNCS(XDisplayCells XDestroySubwindows)
|
||||
fi
|
||||
|
||||
if test "${window_system}" = "x11"; then
|
||||
|
50
src/xfns.c
50
src/xfns.c
@ -6413,7 +6413,7 @@ select_visual (struct x_display_info *dpyinfo)
|
||||
| VisualClassMask),
|
||||
&vinfo_template, &n_visuals);
|
||||
|
||||
if (n_visuals > 0)
|
||||
if (n_visuals > 0 && vinfo)
|
||||
{
|
||||
dpyinfo->n_planes = vinfo->depth;
|
||||
dpyinfo->visual = vinfo->visual;
|
||||
@ -8644,6 +8644,54 @@ frame_parm_handler x_frame_parm_handlers[] =
|
||||
x_set_alpha_background,
|
||||
};
|
||||
|
||||
/* Some versions of libX11 don't have symbols for a few functions we
|
||||
need, so define replacements here. */
|
||||
|
||||
#ifdef HAVE_XKB
|
||||
#ifndef HAVE_XKBREFRESHKEYBOARDMAPPING
|
||||
Status
|
||||
XkbRefreshKeyboardMapping (XkbMapNotifyEvent *event)
|
||||
{
|
||||
return Success;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_XKBFREENAMES
|
||||
void
|
||||
XkbFreeNames (XkbDescPtr xkb, unsigned int which, Bool free_map)
|
||||
{
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_XDISPLAYCELLS
|
||||
int
|
||||
XDisplayCells (Display *dpy, int screen_number)
|
||||
{
|
||||
return 1677216;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_XDESTROYSUBWINDOWS
|
||||
int
|
||||
XDestroySubwindows (Display *dpy, Window w)
|
||||
{
|
||||
Window root, parent, *children;
|
||||
unsigned int nchildren, i;
|
||||
|
||||
if (XQueryTree (dpy, w, &root, &parent, &children,
|
||||
&nchildren))
|
||||
{
|
||||
for (i = 0; i < nchildren; ++i)
|
||||
XDestroyWindow (dpy, children[i]);
|
||||
XFree (children);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
syms_of_xfns (void)
|
||||
{
|
||||
|
11
src/xterm.c
11
src/xterm.c
@ -5768,7 +5768,8 @@ x_find_modifier_meanings (struct x_display_info *dpyinfo)
|
||||
dpyinfo->hyper_mod_mask = 0;
|
||||
|
||||
#ifdef HAVE_XKB
|
||||
if (dpyinfo->xkb_desc)
|
||||
if (dpyinfo->xkb_desc
|
||||
&& dpyinfo->xkb_desc->server)
|
||||
{
|
||||
for (i = 0; i < XkbNumVirtualMods; i++)
|
||||
{
|
||||
@ -5810,6 +5811,14 @@ x_find_modifier_meanings (struct x_display_info *dpyinfo)
|
||||
syms = XGetKeyboardMapping (dpyinfo->display,
|
||||
min_code, max_code - min_code + 1,
|
||||
&syms_per_code);
|
||||
|
||||
if (!syms)
|
||||
{
|
||||
dpyinfo->meta_mod_mask = Mod1Mask;
|
||||
dpyinfo->super_mod_mask = Mod2Mask;
|
||||
return;
|
||||
}
|
||||
|
||||
mods = XGetModifierMapping (dpyinfo->display);
|
||||
|
||||
/* Scan the modifier table to see which modifier bits the Meta and
|
||||
|
Loading…
Reference in New Issue
Block a user