diff options
| author | Dmitry Antipov | 2014-09-24 11:17:51 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2014-09-24 11:17:51 +0400 |
| commit | 4b930ccbb4fc4b848f318e09eddd172c2acf9b9b (patch) | |
| tree | 349f033caa6278c11cae123b8d2f949ec7e3df10 /src/termhooks.h | |
| parent | 4620e6bccd98625208d8be4d960d24119a20594f (diff) | |
| download | emacs-4b930ccbb4fc4b848f318e09eddd172c2acf9b9b.tar.gz emacs-4b930ccbb4fc4b848f318e09eddd172c2acf9b9b.zip | |
* termhooks.h (enum scroll_bar_part): Begin from 0 to allow...
(struct input_event): ...unsigned bitfields. Likewise for
`event_kind' member. Prefer unsigned for `code' and 'modifiers'.
Use `timestamp' for HELP_EVENT position. Add compile-time assert.
* keyboard.c (gen_help_event, kbd_buffer_store_help_event)
(kbd_buffer_get_event): Adjust users.
(scroll_bar_parts): Add Qnil to match scroll_bar_nowhere.
(make_scroll_bar_position): New function, refactored out of...
(make_lispy_event): ...adjusted user.
* nsterm.h (EmacsScroller): Use enum for `last_hit_part' member.
* nsterm.m (ns_mouse_position, mouseUp):
* term.c (term_mouse_position):
* w32inevt.c (w32_console_mouse_position):
* w32term.c (w32_mouse_position):
* xterm.c (XTmouse_position): Use scroll_bar_above_handle.
(x_send_scroll_bar_event, xm_scroll_callback, xg_scroll_callback):
Prefer enum and explicit enum members to integers and numeric values.
Diffstat (limited to 'src/termhooks.h')
| -rw-r--r-- | src/termhooks.h | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/termhooks.h b/src/termhooks.h index 04104eb41e9..6412f0da6ca 100644 --- a/src/termhooks.h +++ b/src/termhooks.h | |||
| @@ -28,7 +28,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 28 | INLINE_HEADER_BEGIN | 28 | INLINE_HEADER_BEGIN |
| 29 | 29 | ||
| 30 | enum scroll_bar_part { | 30 | enum scroll_bar_part { |
| 31 | scroll_bar_nowhere = -1, | 31 | scroll_bar_nowhere, |
| 32 | scroll_bar_above_handle, | 32 | scroll_bar_above_handle, |
| 33 | scroll_bar_handle, | 33 | scroll_bar_handle, |
| 34 | scroll_bar_below_handle, | 34 | scroll_bar_below_handle, |
| @@ -255,31 +255,42 @@ enum event_kind | |||
| 255 | struct input_event | 255 | struct input_event |
| 256 | { | 256 | { |
| 257 | /* What kind of event was this? */ | 257 | /* What kind of event was this? */ |
| 258 | enum event_kind kind; | 258 | ENUM_BF (event_kind) kind : 16; |
| 259 | |||
| 260 | /* Used in scroll back click events. */ | ||
| 261 | ENUM_BF (scroll_bar_part) part : 16; | ||
| 259 | 262 | ||
| 260 | /* For an ASCII_KEYSTROKE_EVENT and MULTIBYTE_CHAR_KEYSTROKE_EVENT, | 263 | /* For an ASCII_KEYSTROKE_EVENT and MULTIBYTE_CHAR_KEYSTROKE_EVENT, |
| 261 | this is the character. | 264 | this is the character. |
| 262 | For a NON_ASCII_KEYSTROKE_EVENT, this is the keysym code. | 265 | For a NON_ASCII_KEYSTROKE_EVENT, this is the keysym code. |
| 263 | For a mouse event, this is the button number. | 266 | For a mouse event, this is the button number. */ |
| 264 | For a HELP_EVENT, this is the position within the object | 267 | unsigned code; |
| 265 | (stored in ARG below) where the help was found. */ | ||
| 266 | ptrdiff_t code; | ||
| 267 | enum scroll_bar_part part; | ||
| 268 | 268 | ||
| 269 | int modifiers; /* See enum below for interpretation. */ | 269 | /* See enum below for interpretation. */ |
| 270 | unsigned modifiers; | ||
| 270 | 271 | ||
| 272 | /* One would prefer C integers, but HELP_EVENT uses these to | ||
| 273 | record frame or window object and a help form, respectively. */ | ||
| 271 | Lisp_Object x, y; | 274 | Lisp_Object x, y; |
| 275 | |||
| 276 | /* Usually a time as reported by window system-specific event loop. | ||
| 277 | For a HELP_EVENT, this is the position within the object (stored | ||
| 278 | in ARG below) where the help was found. */ | ||
| 272 | Time timestamp; | 279 | Time timestamp; |
| 273 | 280 | ||
| 274 | /* This field is copied into a vector while the event is in | 281 | /* This field is copied into a vector while the event is in |
| 275 | the queue, so that garbage collections won't kill it. */ | 282 | the queue, so that garbage collections won't kill it. */ |
| 276 | Lisp_Object frame_or_window; | 283 | Lisp_Object frame_or_window; |
| 277 | 284 | ||
| 278 | /* Additional event argument. This is used for TOOL_BAR_EVENTs and | 285 | /* This additional argument is used in attempt to avoid extra consing |
| 279 | HELP_EVENTs and avoids calling Fcons during signal handling. */ | 286 | when building events. Unfortunately some events have to pass much |
| 287 | more data than it's reasonable to pack directly into this structure. */ | ||
| 280 | Lisp_Object arg; | 288 | Lisp_Object arg; |
| 281 | }; | 289 | }; |
| 282 | 290 | ||
| 291 | /* To make sure we don't break HELP_EVENT. */ | ||
| 292 | verify (sizeof (Time) == sizeof (ptrdiff_t)); | ||
| 293 | |||
| 283 | #define EVENT_INIT(event) memset (&(event), 0, sizeof (struct input_event)) | 294 | #define EVENT_INIT(event) memset (&(event), 0, sizeof (struct input_event)) |
| 284 | 295 | ||
| 285 | /* Bits in the modifiers member of the input_event structure. | 296 | /* Bits in the modifiers member of the input_event structure. |