Mercurial > emacs
comparison src/xterm.c @ 43302:2f479ac769e1
(Vx_alt_keysym, Vx_hyper_keysym, Vx_meta_keysym)
(Vx_super_keysym): New variables.
(syms_of_xterm): DEFVAR_LISP them.
(x_x_to_emacs_modifiers, x_emacs_to_x_modifiers): Use the
variables to determine which keys to use for the various
modifiers.
author | Kai Großjohann <kgrossjo@eu.uu.net> |
---|---|
date | Fri, 15 Feb 2002 09:36:05 +0000 |
parents | 0bf882baa95b |
children | ac7b0c0802cc |
comparison
equal
deleted
inserted
replaced
43301:898b4b31410f | 43302:2f479ac769e1 |
---|---|
378 extern int errno; | 378 extern int errno; |
379 | 379 |
380 /* A mask of extra modifier bits to put into every keyboard char. */ | 380 /* A mask of extra modifier bits to put into every keyboard char. */ |
381 | 381 |
382 extern int extra_keyboard_modifiers; | 382 extern int extra_keyboard_modifiers; |
383 | |
384 /* The keysyms to use for the various modifiers. */ | |
385 | |
386 Lisp_Object Vx_alt_keysym, Vx_hyper_keysym, Vx_meta_keysym, Vx_super_keysym; | |
387 static Lisp_Object Qalt, Qhyper, Qmeta, Qsuper, Qmodifier_value; | |
383 | 388 |
384 static Lisp_Object Qvendor_specific_keysyms; | 389 static Lisp_Object Qvendor_specific_keysyms; |
385 | 390 |
386 extern XrmDatabase x_load_resources P_ ((Display *, char *, char *, char *)); | 391 extern XrmDatabase x_load_resources P_ ((Display *, char *, char *, char *)); |
387 extern Lisp_Object x_icon_type P_ ((struct frame *)); | 392 extern Lisp_Object x_icon_type P_ ((struct frame *)); |
6420 static unsigned int | 6425 static unsigned int |
6421 x_x_to_emacs_modifiers (dpyinfo, state) | 6426 x_x_to_emacs_modifiers (dpyinfo, state) |
6422 struct x_display_info *dpyinfo; | 6427 struct x_display_info *dpyinfo; |
6423 unsigned int state; | 6428 unsigned int state; |
6424 { | 6429 { |
6430 EMACS_UINT mod_meta = meta_modifier; | |
6431 EMACS_UINT mod_alt = alt_modifier; | |
6432 EMACS_UINT mod_hyper = hyper_modifier; | |
6433 EMACS_UINT mod_super = super_modifier; | |
6434 Lisp_Object tem; | |
6435 | |
6436 tem = Fget (Vx_alt_keysym, Qmodifier_value); | |
6437 if (! EQ (tem, Qnil)) mod_alt = XUINT (tem); | |
6438 tem = Fget (Vx_meta_keysym, Qmodifier_value); | |
6439 if (! EQ (tem, Qnil)) mod_meta = XUINT (tem); | |
6440 tem = Fget (Vx_hyper_keysym, Qmodifier_value); | |
6441 if (! EQ (tem, Qnil)) mod_hyper = XUINT (tem); | |
6442 tem = Fget (Vx_super_keysym, Qmodifier_value); | |
6443 if (! EQ (tem, Qnil)) mod_super = XUINT (tem); | |
6444 | |
6445 | |
6425 return ( ((state & (ShiftMask | dpyinfo->shift_lock_mask)) ? shift_modifier : 0) | 6446 return ( ((state & (ShiftMask | dpyinfo->shift_lock_mask)) ? shift_modifier : 0) |
6426 | ((state & ControlMask) ? ctrl_modifier : 0) | 6447 | ((state & ControlMask) ? ctrl_modifier : 0) |
6427 | ((state & dpyinfo->meta_mod_mask) ? meta_modifier : 0) | 6448 | ((state & dpyinfo->meta_mod_mask) ? mod_meta : 0) |
6428 | ((state & dpyinfo->alt_mod_mask) ? alt_modifier : 0) | 6449 | ((state & dpyinfo->alt_mod_mask) ? mod_alt : 0) |
6429 | ((state & dpyinfo->super_mod_mask) ? super_modifier : 0) | 6450 | ((state & dpyinfo->super_mod_mask) ? mod_super : 0) |
6430 | ((state & dpyinfo->hyper_mod_mask) ? hyper_modifier : 0)); | 6451 | ((state & dpyinfo->hyper_mod_mask) ? mod_hyper : 0)); |
6431 } | 6452 } |
6432 | 6453 |
6433 static unsigned int | 6454 static unsigned int |
6434 x_emacs_to_x_modifiers (dpyinfo, state) | 6455 x_emacs_to_x_modifiers (dpyinfo, state) |
6435 struct x_display_info *dpyinfo; | 6456 struct x_display_info *dpyinfo; |
6436 unsigned int state; | 6457 unsigned int state; |
6437 { | 6458 { |
6438 return ( ((state & alt_modifier) ? dpyinfo->alt_mod_mask : 0) | 6459 EMACS_UINT mod_meta = meta_modifier; |
6439 | ((state & super_modifier) ? dpyinfo->super_mod_mask : 0) | 6460 EMACS_UINT mod_alt = alt_modifier; |
6440 | ((state & hyper_modifier) ? dpyinfo->hyper_mod_mask : 0) | 6461 EMACS_UINT mod_hyper = hyper_modifier; |
6441 | ((state & shift_modifier) ? ShiftMask : 0) | 6462 EMACS_UINT mod_super = super_modifier; |
6442 | ((state & ctrl_modifier) ? ControlMask : 0) | 6463 |
6443 | ((state & meta_modifier) ? dpyinfo->meta_mod_mask : 0)); | 6464 Lisp_Object tem; |
6465 | |
6466 tem = Fget (Vx_alt_keysym, Qmodifier_value); | |
6467 if (! EQ (tem, Qnil)) mod_alt = XUINT (tem); | |
6468 tem = Fget (Vx_meta_keysym, Qmodifier_value); | |
6469 if (! EQ (tem, Qnil)) mod_meta = XUINT (tem); | |
6470 tem = Fget (Vx_hyper_keysym, Qmodifier_value); | |
6471 if (! EQ (tem, Qnil)) mod_hyper = XUINT (tem); | |
6472 tem = Fget (Vx_super_keysym, Qmodifier_value); | |
6473 if (! EQ (tem, Qnil)) mod_super = XUINT (tem); | |
6474 | |
6475 | |
6476 return ( ((state & mod_alt) ? dpyinfo->alt_mod_mask : 0) | |
6477 | ((state & mod_super) ? dpyinfo->super_mod_mask : 0) | |
6478 | ((state & mod_hyper) ? dpyinfo->hyper_mod_mask : 0) | |
6479 | ((state & shift_modifier) ? ShiftMask : 0) | |
6480 | ((state & ctrl_modifier) ? ControlMask : 0) | |
6481 | ((state & mod_meta) ? dpyinfo->meta_mod_mask : 0)); | |
6444 } | 6482 } |
6445 | 6483 |
6446 /* Convert a keysym to its name. */ | 6484 /* Convert a keysym to its name. */ |
6447 | 6485 |
6448 char * | 6486 char * |
15033 Vx_toolkit_scroll_bars = Qnil; | 15071 Vx_toolkit_scroll_bars = Qnil; |
15034 #endif | 15072 #endif |
15035 | 15073 |
15036 staticpro (&last_mouse_motion_frame); | 15074 staticpro (&last_mouse_motion_frame); |
15037 last_mouse_motion_frame = Qnil; | 15075 last_mouse_motion_frame = Qnil; |
15076 | |
15077 Qmodifier_value = intern ("modifier-value"); | |
15078 Qalt = intern ("alt"); | |
15079 Fput (Qalt, Qmodifier_value, make_number (alt_modifier)); | |
15080 Qhyper = intern ("hyper"); | |
15081 Fput (Qhyper, Qmodifier_value, make_number (hyper_modifier)); | |
15082 Qmeta = intern ("meta"); | |
15083 Fput (Qmeta, Qmodifier_value, make_number (meta_modifier)); | |
15084 Qsuper = intern ("super"); | |
15085 Fput (Qsuper, Qmodifier_value, make_number (super_modifier)); | |
15086 | |
15087 DEFVAR_LISP ("x-alt-keysym", &Vx_alt_keysym, | |
15088 doc: /* Which keys Emacs uses for the alt modifier. | |
15089 This should be one of the symbols `alt', `hyper', `meta', `super'. | |
15090 For example, `alt' means use the Alt_L and Alt_R keysyms. The default | |
15091 is nil, which is the same as `alt'. */); | |
15092 Vx_alt_keysym = Qnil; | |
15093 | |
15094 DEFVAR_LISP ("x-hyper-keysym", &Vx_hyper_keysym, | |
15095 doc: /* Which keys Emacs uses for the hyper modifier. | |
15096 This should be one of the symbols `alt', `hyper', `meta', `super'. | |
15097 For example, `hyper' means use the Hyper_L and Hyper_R keysyms. The | |
15098 default is nil, which is the same as `hyper'. */); | |
15099 Vx_hyper_keysym = Qnil; | |
15100 | |
15101 DEFVAR_LISP ("x-meta-keysym", &Vx_meta_keysym, | |
15102 doc: /* Which keys Emacs uses for the meta modifier. | |
15103 This should be one of the symbols `alt', `hyper', `meta', `super'. | |
15104 For example, `meta' means use the Meta_L and Meta_R keysyms. The | |
15105 default is nil, which is the same as `meta'. */); | |
15106 Vx_meta_keysym = Qnil; | |
15107 | |
15108 DEFVAR_LISP ("x-super-keysym", &Vx_super_keysym, | |
15109 doc: /* Which keys Emacs uses for the super modifier. | |
15110 This should be one of the symbols `alt', `hyper', `meta', `super'. | |
15111 For example, `super' means use the Super_L and Super_R keysyms. The | |
15112 default is nil, which is the same as `super'. */); | |
15113 Vx_super_keysym = Qnil; | |
15114 | |
15038 } | 15115 } |
15039 | 15116 |
15040 #endif /* HAVE_X_WINDOWS */ | 15117 #endif /* HAVE_X_WINDOWS */ |