diff options
| author | Po Lu | 2022-02-04 03:28:05 +0000 |
|---|---|---|
| committer | Po Lu | 2022-02-04 03:28:05 +0000 |
| commit | a654985bca4c48472bd17a2723fc93bcd5e27d6c (patch) | |
| tree | a8b78981b1db2277d5b8c36eb97c30994c6b80eb /src | |
| parent | 52c4275283b342d3792d3eb4d4be44cb567b2bc7 (diff) | |
| download | emacs-a654985bca4c48472bd17a2723fc93bcd5e27d6c.tar.gz emacs-a654985bca4c48472bd17a2723fc93bcd5e27d6c.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xfns.c | 50 | ||||
| -rw-r--r-- | src/xterm.c | 11 |
2 files changed, 59 insertions, 2 deletions
diff --git a/src/xfns.c b/src/xfns.c index 1a0e9f50cdd..deaf4204a9f 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -6413,7 +6413,7 @@ select_visual (struct x_display_info *dpyinfo) | |||
| 6413 | | VisualClassMask), | 6413 | | VisualClassMask), |
| 6414 | &vinfo_template, &n_visuals); | 6414 | &vinfo_template, &n_visuals); |
| 6415 | 6415 | ||
| 6416 | if (n_visuals > 0) | 6416 | if (n_visuals > 0 && vinfo) |
| 6417 | { | 6417 | { |
| 6418 | dpyinfo->n_planes = vinfo->depth; | 6418 | dpyinfo->n_planes = vinfo->depth; |
| 6419 | dpyinfo->visual = vinfo->visual; | 6419 | dpyinfo->visual = vinfo->visual; |
| @@ -8644,6 +8644,54 @@ frame_parm_handler x_frame_parm_handlers[] = | |||
| 8644 | x_set_alpha_background, | 8644 | x_set_alpha_background, |
| 8645 | }; | 8645 | }; |
| 8646 | 8646 | ||
| 8647 | /* Some versions of libX11 don't have symbols for a few functions we | ||
| 8648 | need, so define replacements here. */ | ||
| 8649 | |||
| 8650 | #ifdef HAVE_XKB | ||
| 8651 | #ifndef HAVE_XKBREFRESHKEYBOARDMAPPING | ||
| 8652 | Status | ||
| 8653 | XkbRefreshKeyboardMapping (XkbMapNotifyEvent *event) | ||
| 8654 | { | ||
| 8655 | return Success; | ||
| 8656 | } | ||
| 8657 | #endif | ||
| 8658 | |||
| 8659 | #ifndef HAVE_XKBFREENAMES | ||
| 8660 | void | ||
| 8661 | XkbFreeNames (XkbDescPtr xkb, unsigned int which, Bool free_map) | ||
| 8662 | { | ||
| 8663 | return; | ||
| 8664 | } | ||
| 8665 | #endif | ||
| 8666 | #endif | ||
| 8667 | |||
| 8668 | #ifndef HAVE_XDISPLAYCELLS | ||
| 8669 | int | ||
| 8670 | XDisplayCells (Display *dpy, int screen_number) | ||
| 8671 | { | ||
| 8672 | return 1677216; | ||
| 8673 | } | ||
| 8674 | #endif | ||
| 8675 | |||
| 8676 | #ifndef HAVE_XDESTROYSUBWINDOWS | ||
| 8677 | int | ||
| 8678 | XDestroySubwindows (Display *dpy, Window w) | ||
| 8679 | { | ||
| 8680 | Window root, parent, *children; | ||
| 8681 | unsigned int nchildren, i; | ||
| 8682 | |||
| 8683 | if (XQueryTree (dpy, w, &root, &parent, &children, | ||
| 8684 | &nchildren)) | ||
| 8685 | { | ||
| 8686 | for (i = 0; i < nchildren; ++i) | ||
| 8687 | XDestroyWindow (dpy, children[i]); | ||
| 8688 | XFree (children); | ||
| 8689 | } | ||
| 8690 | |||
| 8691 | return 0; | ||
| 8692 | } | ||
| 8693 | #endif | ||
| 8694 | |||
| 8647 | void | 8695 | void |
| 8648 | syms_of_xfns (void) | 8696 | syms_of_xfns (void) |
| 8649 | { | 8697 | { |
diff --git a/src/xterm.c b/src/xterm.c index c24a2ab6863..2e09c454b24 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -5768,7 +5768,8 @@ x_find_modifier_meanings (struct x_display_info *dpyinfo) | |||
| 5768 | dpyinfo->hyper_mod_mask = 0; | 5768 | dpyinfo->hyper_mod_mask = 0; |
| 5769 | 5769 | ||
| 5770 | #ifdef HAVE_XKB | 5770 | #ifdef HAVE_XKB |
| 5771 | if (dpyinfo->xkb_desc) | 5771 | if (dpyinfo->xkb_desc |
| 5772 | && dpyinfo->xkb_desc->server) | ||
| 5772 | { | 5773 | { |
| 5773 | for (i = 0; i < XkbNumVirtualMods; i++) | 5774 | for (i = 0; i < XkbNumVirtualMods; i++) |
| 5774 | { | 5775 | { |
| @@ -5810,6 +5811,14 @@ x_find_modifier_meanings (struct x_display_info *dpyinfo) | |||
| 5810 | syms = XGetKeyboardMapping (dpyinfo->display, | 5811 | syms = XGetKeyboardMapping (dpyinfo->display, |
| 5811 | min_code, max_code - min_code + 1, | 5812 | min_code, max_code - min_code + 1, |
| 5812 | &syms_per_code); | 5813 | &syms_per_code); |
| 5814 | |||
| 5815 | if (!syms) | ||
| 5816 | { | ||
| 5817 | dpyinfo->meta_mod_mask = Mod1Mask; | ||
| 5818 | dpyinfo->super_mod_mask = Mod2Mask; | ||
| 5819 | return; | ||
| 5820 | } | ||
| 5821 | |||
| 5813 | mods = XGetModifierMapping (dpyinfo->display); | 5822 | mods = XGetModifierMapping (dpyinfo->display); |
| 5814 | 5823 | ||
| 5815 | /* Scan the modifier table to see which modifier bits the Meta and | 5824 | /* Scan the modifier table to see which modifier bits the Meta and |