Public Attributes | Protected Member Functions | List of all members
minxlib::key_event_details Struct Reference

Various attributes common to both key presses and releases. More...

#include <event.hh>

Public Attributes

const window root
 Target window's root window.
 
const window child
 Target's child that received event.
 
const Time time
 Millisecond timestamp of event.
 
const int y
 Mouse coords relative to target window.
 
const int y_root
 Mouse coords relative to root.
 
const unsigned int mask
 State of mouse buttons & modifier keys.
 
const unsigned int keycode
 Number representing physical key.
 
const std::string key
 String representation of key pressed.
 
const bool same_screen
 True if target and root on same screen.
 

Protected Member Functions

 key_event_details (const XKeyEvent &e, Display *d)
 Initialize keyboard event attributes. More...
 

Detailed Description

Various attributes common to both key presses and releases.

Xlib reports the same stuff for KeyPress and KeyRelease events and uses a typedef to alias the two event structures. Since minxlib uses two different types for the two event types, we put the relevant fields into this base class and have the relevant event subclasses derive from this class as well as minxlib::event.

Note
Xlib's XKeyEvent structure contains a modifier mask and a keycode, which we copy into this structure. Additionally, if the keyboard event's modifier mask and keycode correspond to a named key binding (configured by end-users), we "translate" that into the user-defined name and return it via this structure's key field. If, however, the event does not correspond to a user-defined key binding, the key field will simply be a string representing the keycode.

Constructor & Destructor Documentation

minxlib::key_event_details::key_event_details ( const XKeyEvent &  e,
Display *  d 
)
protected

Initialize keyboard event attributes.

Parameters
eThe XEvent structure detailing the keyboard event.
dThe X server connection associated with the event.
Returns
A properly constructed key_event_details object.

A protected constructor because only key_press and key_release objects should construct instances of this class.