aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-05-11 16:16:52 -0700
committerPaul Eggert2011-05-11 16:16:52 -0700
commit5235bd3eb16b94dc5dcef3b1447f821fc09ea930 (patch)
tree216c6b983a9fc59910efe3341ffcc58af1637236 /src
parentbc827e23be4630f4b5d7a1895e37cfab89eb6b6a (diff)
downloademacs-5235bd3eb16b94dc5dcef3b1447f821fc09ea930.tar.gz
emacs-5235bd3eb16b94dc5dcef3b1447f821fc09ea930.zip
* xterm.c: Use EMACS_INT for Emacs modifiers, and int for X modifiers.
Before, the code was not consistent. These values cannot exceed 2**31 - 1 so there's no need to make them unsigned. (x_x_to_emacs_modifiers): Accept int and return EMACS_INT. (x_emacs_to_x_modifiers): Accept EMACS_INT and return int. (x_x_to_emacs_modifiers, x_emacs_to_x_modifiers): Reject non-integers as modifiers. * xterm.h (x_x_to_emacs_modifiers): Adjust to signature change.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/xterm.c40
-rw-r--r--src/xterm.h3
3 files changed, 30 insertions, 22 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 550dd28eb24..da468d47db3 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,14 @@
12011-05-11 Paul Eggert <eggert@cs.ucla.edu> 12011-05-11 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 * xterm.c: Use EMACS_INT for Emacs modifiers, and int for X modifiers.
4 Before, the code was not consistent. These values cannot exceed
5 2**31 - 1 so there's no need to make them unsigned.
6 (x_x_to_emacs_modifiers): Accept int and return EMACS_INT.
7 (x_emacs_to_x_modifiers): Accept EMACS_INT and return int.
8 (x_x_to_emacs_modifiers, x_emacs_to_x_modifiers): Reject non-integers
9 as modifiers.
10 * xterm.h (x_x_to_emacs_modifiers): Adjust to signature change.
11
3 * lisp.h (XINT) [USE_LISP_UNION_TYPE]: Cast to EMACS_INT. 12 * lisp.h (XINT) [USE_LISP_UNION_TYPE]: Cast to EMACS_INT.
4 (XUINT) [USE_LISP_UNION_TYPE]: Cast to EMACS_UINT. 13 (XUINT) [USE_LISP_UNION_TYPE]: Cast to EMACS_UINT.
5 Otherwise, GCC 4.6.0 warns about printf (pI, XINT (...)), 14 Otherwise, GCC 4.6.0 warns about printf (pI, XINT (...)),
diff --git a/src/xterm.c b/src/xterm.c
index 20259b7ab2e..f5886ab9628 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -3609,23 +3609,23 @@ x_find_modifier_meanings (struct x_display_info *dpyinfo)
3609/* Convert between the modifier bits X uses and the modifier bits 3609/* Convert between the modifier bits X uses and the modifier bits
3610 Emacs uses. */ 3610 Emacs uses. */
3611 3611
3612unsigned int 3612EMACS_INT
3613x_x_to_emacs_modifiers (struct x_display_info *dpyinfo, unsigned int state) 3613x_x_to_emacs_modifiers (struct x_display_info *dpyinfo, int state)
3614{ 3614{
3615 EMACS_UINT mod_meta = meta_modifier; 3615 EMACS_INT mod_meta = meta_modifier;
3616 EMACS_UINT mod_alt = alt_modifier; 3616 EMACS_INT mod_alt = alt_modifier;
3617 EMACS_UINT mod_hyper = hyper_modifier; 3617 EMACS_INT mod_hyper = hyper_modifier;
3618 EMACS_UINT mod_super = super_modifier; 3618 EMACS_INT mod_super = super_modifier;
3619 Lisp_Object tem; 3619 Lisp_Object tem;
3620 3620
3621 tem = Fget (Vx_alt_keysym, Qmodifier_value); 3621 tem = Fget (Vx_alt_keysym, Qmodifier_value);
3622 if (! EQ (tem, Qnil)) mod_alt = XUINT (tem); 3622 if (INTEGERP (tem)) mod_alt = XINT (tem);
3623 tem = Fget (Vx_meta_keysym, Qmodifier_value); 3623 tem = Fget (Vx_meta_keysym, Qmodifier_value);
3624 if (! EQ (tem, Qnil)) mod_meta = XUINT (tem); 3624 if (INTEGERP (tem)) mod_meta = XINT (tem);
3625 tem = Fget (Vx_hyper_keysym, Qmodifier_value); 3625 tem = Fget (Vx_hyper_keysym, Qmodifier_value);
3626 if (! EQ (tem, Qnil)) mod_hyper = XUINT (tem); 3626 if (INTEGERP (tem)) mod_hyper = XINT (tem);
3627 tem = Fget (Vx_super_keysym, Qmodifier_value); 3627 tem = Fget (Vx_super_keysym, Qmodifier_value);
3628 if (! EQ (tem, Qnil)) mod_super = XUINT (tem); 3628 if (INTEGERP (tem)) mod_super = XINT (tem);
3629 3629
3630 3630
3631 return ( ((state & (ShiftMask | dpyinfo->shift_lock_mask)) ? shift_modifier : 0) 3631 return ( ((state & (ShiftMask | dpyinfo->shift_lock_mask)) ? shift_modifier : 0)
@@ -3636,24 +3636,24 @@ x_x_to_emacs_modifiers (struct x_display_info *dpyinfo, unsigned int state)
3636 | ((state & dpyinfo->hyper_mod_mask) ? mod_hyper : 0)); 3636 | ((state & dpyinfo->hyper_mod_mask) ? mod_hyper : 0));
3637} 3637}
3638 3638
3639static unsigned int 3639static int
3640x_emacs_to_x_modifiers (struct x_display_info *dpyinfo, unsigned int state) 3640x_emacs_to_x_modifiers (struct x_display_info *dpyinfo, EMACS_INT state)
3641{ 3641{
3642 EMACS_UINT mod_meta = meta_modifier; 3642 int mod_meta = meta_modifier;
3643 EMACS_UINT mod_alt = alt_modifier; 3643 int mod_alt = alt_modifier;
3644 EMACS_UINT mod_hyper = hyper_modifier; 3644 int mod_hyper = hyper_modifier;
3645 EMACS_UINT mod_super = super_modifier; 3645 int mod_super = super_modifier;
3646 3646
3647 Lisp_Object tem; 3647 Lisp_Object tem;
3648 3648
3649 tem = Fget (Vx_alt_keysym, Qmodifier_value); 3649 tem = Fget (Vx_alt_keysym, Qmodifier_value);
3650 if (! EQ (tem, Qnil)) mod_alt = XUINT (tem); 3650 if (INTEGERP (tem)) mod_alt = XINT (tem);
3651 tem = Fget (Vx_meta_keysym, Qmodifier_value); 3651 tem = Fget (Vx_meta_keysym, Qmodifier_value);
3652 if (! EQ (tem, Qnil)) mod_meta = XUINT (tem); 3652 if (INTEGERP (tem)) mod_meta = XINT (tem);
3653 tem = Fget (Vx_hyper_keysym, Qmodifier_value); 3653 tem = Fget (Vx_hyper_keysym, Qmodifier_value);
3654 if (! EQ (tem, Qnil)) mod_hyper = XUINT (tem); 3654 if (INTEGERP (tem)) mod_hyper = XINT (tem);
3655 tem = Fget (Vx_super_keysym, Qmodifier_value); 3655 tem = Fget (Vx_super_keysym, Qmodifier_value);
3656 if (! EQ (tem, Qnil)) mod_super = XUINT (tem); 3656 if (INTEGERP (tem)) mod_super = XINT (tem);
3657 3657
3658 3658
3659 return ( ((state & mod_alt) ? dpyinfo->alt_mod_mask : 0) 3659 return ( ((state & mod_alt) ? dpyinfo->alt_mod_mask : 0)
diff --git a/src/xterm.h b/src/xterm.h
index fbd638fe73b..1b90b6d8ff4 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -989,8 +989,7 @@ extern void x_mouse_leave (struct x_display_info *);
989#ifdef USE_X_TOOLKIT 989#ifdef USE_X_TOOLKIT
990extern int x_dispatch_event (XEvent *, Display *); 990extern int x_dispatch_event (XEvent *, Display *);
991#endif 991#endif
992extern unsigned int x_x_to_emacs_modifiers (struct x_display_info *, 992extern EMACS_INT x_x_to_emacs_modifiers (struct x_display_info *, int);
993 unsigned);
994extern int x_display_pixel_height (struct x_display_info *); 993extern int x_display_pixel_height (struct x_display_info *);
995extern int x_display_pixel_width (struct x_display_info *); 994extern int x_display_pixel_width (struct x_display_info *);
996 995