summaryrefslogtreecommitdiff
path: root/tutorial.mdwn
diff options
context:
space:
mode:
authorbrian.thomas.will <brian.thomas.will@gmail.com>2007-11-11 21:51:41 -0800
committerXCB site <xcb@annarchy.freedesktop.org>2007-11-11 21:51:41 -0800
commitf625c7d6b3eaa6f440985b8f2c9c8f761f758838 (patch)
tree6fcb90668025a27846a9b947cf28945f458b061f /tutorial.mdwn
parent8f17c2373bb322bc374b322e790df04615dfedcd (diff)
cleanup section 10.4.5 ("keyboard press and release events")
Diffstat (limited to 'tutorial.mdwn')
-rw-r--r--tutorial.mdwn40
1 files changed, 19 insertions, 21 deletions
diff --git a/tutorial.mdwn b/tutorial.mdwn
index 9a5b29f..1d709f6 100644
--- a/tutorial.mdwn
+++ b/tutorial.mdwn
@@ -1089,30 +1089,28 @@ There may be many windows on a screen, but only a single keyboard attached to th
If a window controlled by our program currently holds the keyboard focus, it can receive key press and key release events. So, we should add one (or more) of the following masks when we create our window:
-* XCB_EVENT_MASK_KEY_PRESS: notify us when a key was pressed while any of our controlled windows had the keyboard focus.
-* XCB_EVENT_MASK_KEY_RELEASE: notify us when a key was released while any of our controlled windows had the keyboard focus.
+ XCB_EVENT_MASK_KEY_PRESS // key was pressed while any of our controlled windows had the keyboard focus
+ XCB_EVENT_MASK_KEY_RELEASE // key was released while any of our controlled windows had the keyboard focus
-The structure to be checked for in our events loop is the same for these two events, and is the following:
-
- typedef struct {
- uint8_t response_type; /* The type of the event */
- xcb_keycode_t detail;
- uint16_t sequence;
- xcb_timestamp_t time; /* Time, in milliseconds the event took place in */
- xcb_window_t root;
- xcb_window_t event;
- xcb_window_t child;
- int16_t root_x;
- int16_t root_y;
- int16_t event_x;
- int16_t event_y;
- uint16_t state;
- uint8_t same_screen;
- } xcb_key_press_event_t;
+These generate events of the same type, which goes by two names:
- typedef xcb_key_press_event_t xcb_key_release_event_t;
+ typedef struct {
+ uint8_t response_type; /* The type of the event */
+ xcb_keycode_t detail; /* the physical key on the keyboard */
+ uint16_t sequence;
+ xcb_timestamp_t time; /* Time, in milliseconds the event took place in */
+ xcb_window_t root;
+ xcb_window_t event;
+ xcb_window_t child;
+ int16_t root_x;
+ int16_t root_y;
+ int16_t event_x;
+ int16_t event_y;
+ uint16_t state;
+ uint8_t same_screen;
+ } xcb_key_press_event_t;
-The detail field refers to the physical key on the keyboard.
+ typedef xcb_key_press_event_t xcb_key_release_event_t;
TODO: Talk about getting the ASCII code from the key code.