[Xcb-commit] tutorial.mdwn
XCB site
xcb at freedesktop.org
Sun Nov 11 21:51:41 PST 2007
tutorial.mdwn | 40 +++++++++++++++++++---------------------
1 file changed, 19 insertions(+), 21 deletions(-)
New commits:
commit f625c7d6b3eaa6f440985b8f2c9c8f761f758838
Author: brian.thomas.will <brian.thomas.will at gmail.com>
Date: Sun Nov 11 21:51:41 2007 -0800
cleanup section 10.4.5 ("keyboard press and release events")
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.
More information about the xcb-commit
mailing list