[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master a654985bca: Make Emacs build with some other XLib implementations
From: |
Po Lu |
Subject: |
master a654985bca: Make Emacs build with some other XLib implementations |
Date: |
Thu, 3 Feb 2022 22:30:12 -0500 (EST) |
branch: master
commit a654985bca4c48472bd17a2723fc93bcd5e27d6c
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
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.
---
configure.ac | 5 +++--
src/xfns.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++-
src/xterm.c | 11 ++++++++++-
3 files changed, 62 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac
index 9f4d5db43f..2ad5f2312c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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
diff --git a/src/xfns.c b/src/xfns.c
index 1a0e9f50cd..deaf4204a9 100644
--- a/src/xfns.c
+++ b/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)
{
diff --git a/src/xterm.c b/src/xterm.c
index c24a2ab686..2e09c454b2 100644
--- a/src/xterm.c
+++ b/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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master a654985bca: Make Emacs build with some other XLib implementations,
Po Lu <=