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
| VisualClassMask),
&vinfo_template, &n_visuals);
- if (n_visuals > 0)
+ if (n_visuals > 0 && vinfo)
{
dpyinfo->n_planes = vinfo->depth;
dpyinfo->visual = vinfo->visual;
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)
{
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++)
{
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