Created
February 20, 2013 16:05
-
-
Save danhper/4996645 to your computer and use it in GitHub Desktop.
C++ implementation of X protocol events
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
//namespace protocol { | |
//namespace type { | |
struct event { | |
enum event_enum { | |
key_press = 0x00000001, | |
key_release = 0x00000002, | |
button_press = 0x00000004, | |
// many others | |
zero = 0xfe000000, | |
}; | |
}; | |
typedef event::event_enum event_enum; | |
struct pointer_event : event { | |
static event_enum const zero = static_cast<event_enum>(0xffff8003); | |
}; | |
typedef event::event_enum pointer_event_enum; | |
struct device_event : event { | |
static event_enum const zero = static_cast<event_enum>(0xffffc0b0); | |
}; | |
typedef event::event_enum device_event_enum; | |
//}} | |
// namespaces end | |
int main() | |
{ | |
event_enum normal_event_zero = event::zero; | |
pointer_event_enum pointer_event_zero = pointer_event::zero; | |
device_event_enum device_event_zero = device_event::zero; | |
std::cout << normal_event_zero << std::endl; | |
std::cout << pointer_event_zero << std::endl; | |
std::cout << device_event_zero << std::endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment