aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2000-12-14 12:01:50 +0000
committerGerd Moellmann2000-12-14 12:01:50 +0000
commit82bab41c67602d699de3b4dcc325f19ca1c1c874 (patch)
tree028d40219e156549000f5b56f79a7469fcc93522 /src
parentef0234c7558b7cf40270314bd7f2ce04eb8d72e2 (diff)
downloademacs-82bab41c67602d699de3b4dcc325f19ca1c1c874.tar.gz
emacs-82bab41c67602d699de3b4dcc325f19ca1c1c874.zip
(Fx_backspace_delete_keys_p): New function.
(syms_of_xfns): Defsubr it.
Diffstat (limited to 'src')
-rw-r--r--src/xfns.c65
1 files changed, 64 insertions, 1 deletions
diff --git a/src/xfns.c b/src/xfns.c
index b560c70c0d6..04ef282a175 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -11059,6 +11059,68 @@ selection dialog's entry field, if MUSTMATCH is non-nil.")
11059 11059
11060 11060
11061/*********************************************************************** 11061/***********************************************************************
11062 Keyboard
11063 ***********************************************************************/
11064
11065#ifdef HAVE_XKBGETKEYBOARD
11066#include <X11/XKBlib.h>
11067#include <X11/keysym.h>
11068#endif
11069
11070DEFUN ("x-backspace-delete-keys-p", Fx_backspace_delete_keys_p,
11071 Sx_backspace_delete_keys_p, 0, 1, 0,
11072 "Check if both Backspace and Delete keys are on the keyboard of FRAME.\n\
11073FRAME nil means use the selected frame.\n\
11074Value is t if we know that both keys are present, and are mapped to the\n\
11075usual X keysyms.")
11076 (frame)
11077 Lisp_Object frame;
11078{
11079#ifdef HAVE_XKBGETKEYBOARD
11080 XkbDescPtr kb;
11081 struct frame *f = check_x_frame (frame);
11082 Display *dpy = FRAME_X_DISPLAY (f);
11083 Lisp_Object have_keys;
11084
11085 have_keys = Qnil;
11086
11087 BLOCK_INPUT;
11088 kb = XkbGetKeyboard (dpy, XkbAllComponentsMask, XkbUseCoreKbd);
11089 if (kb)
11090 {
11091 int delete_keycode = 0, backspace_keycode = 0, i;
11092
11093 for (i = kb->min_key_code;
11094 (i < kb->max_key_code
11095 && (delete_keycode == 0 || backspace_keycode == 0));
11096 ++i)
11097 {
11098 /* The XKB symbolic key names can be seen most easily
11099 in the PS file generated by `xkbprint -label name $DISPLAY'. */
11100 if (bcmp ("DELE", kb->names->keys[i].name, 4) == 0)
11101 delete_keycode = i;
11102 else if (bcmp ("BKSP", kb->names->keys[i].name, 4) == 0)
11103 backspace_keycode = i;
11104 }
11105
11106 XkbFreeKeyboard (kb, XkbAllComponentsMask, True);
11107
11108 if (delete_keycode
11109 && backspace_keycode
11110 && XKeysymToKeycode (dpy, XK_Delete) == delete_keycode
11111 && XKeysymToKeycode (dpy, XK_BackSpace) == backspace_keycode)
11112 have_keys = Qt;
11113 }
11114 UNBLOCK_INPUT;
11115 return have_keys;
11116#else /* not HAVE_XKBGETKEYBOARD */
11117 return Qnil;
11118#endif /* not HAVE_XKBGETKEYBOARD */
11119}
11120
11121
11122
11123/***********************************************************************
11062 Initialization 11124 Initialization
11063 ***********************************************************************/ 11125 ***********************************************************************/
11064 11126
@@ -11326,7 +11388,8 @@ meaning don't clear the cache.");
11326 defsubr (&Sx_display_list); 11388 defsubr (&Sx_display_list);
11327 defsubr (&Sx_synchronize); 11389 defsubr (&Sx_synchronize);
11328 defsubr (&Sx_focus_frame); 11390 defsubr (&Sx_focus_frame);
11329 11391 defsubr (&Sx_backspace_delete_keys_p);
11392
11330 /* Setting callback functions for fontset handler. */ 11393 /* Setting callback functions for fontset handler. */
11331 get_font_info_func = x_get_font_info; 11394 get_font_info_func = x_get_font_info;
11332 11395