eventstr.h revision 61cb83a8ccd1dd7f671f31fa93c9d8b7be09b4cc
/*
* Copyright © 2009 Red Hat, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*/
#ifndef EVENTSTR_H
#define EVENTSTR_H
#include <events.h>
/**
* @file events.h
* This file describes the event structures used internally by the X
* server during event generation and event processing.
*
* When are internal events used?
* Events from input devices are stored as internal events in the EQ and
* processed as internal events until late in the processing cycle. Only then
* do they switch to their respective wire events.
*/
/**
* Event types. Used exclusively internal to the server, not visible on the
* protocol.
*
* Note: Keep KeyPress to Motion aligned with the core events.
* Keep ET_Raw* in the same order as KeyPress - Motion
*/
enum EventType {
ET_KeyPress = 2,
};
/**
* Used for ALL input device events internal in the server until
* copied into the matching protocol event.
*
* Note: We only use the device id because the DeviceIntPtr may become invalid while
* the event is in the EQ.
*/
struct _DeviceEvent {
unsigned char header; /**< Always ET_Internal */
int length; /**< Length in bytes */
int deviceid; /**< Device to post this event for */
int sourceid; /**< The physical source device */
union {
touch events) */
} detail;
float root_x_frac; /**< Pos relative to root window in frac part */
float root_y_frac; /**< Pos relative to root window in frac part */
struct {
} valuators;
struct {
} mods;
struct {
} group;
int key_repeat; /**< Internally-generated key repeat event */
};
/**
* Generated internally whenever a touch ownership chain changes - an owner
* chain has been removed.
*/
struct _TouchOwnershipEvent {
unsigned char header; /**< Always ET_Internal */
int length; /**< Length in bytes */
int deviceid; /**< Device to post this event for */
int sourceid; /**< The physical source device */
};
/* Flags used in DeviceChangedEvent to signal if the slave has changed */
#define DEVCHANGE_SLAVE_SWITCH 0x2
/* Flags used in DeviceChangedEvent to signal whether the event was a
* pointer event or a keyboard event */
#define DEVCHANGE_POINTER_EVENT 0x4
#define DEVCHANGE_KEYBOARD_EVENT 0x8
/* device capabilities changed */
#define DEVCHANGE_DEVICE_CHANGE 0x10
/**
* Sent whenever a device's capabilities have changed.
*/
struct _DeviceChangedEvent {
unsigned char header; /**< Always ET_Internal */
int length; /**< Length in bytes */
int deviceid; /**< Device whose capabilities have changed */
int flags; /**< Mask of ::HAS_NEW_SLAVE,
::POINTER_EVENT, ::KEYBOARD_EVENT */
int masterid; /**< MD when event was generated */
int sourceid; /**< The device that caused the change */
struct {
int num_buttons; /**< Number of buttons */
} buttons;
int num_valuators; /**< Number of axes */
struct {
double value; /**< Current value */
struct {
int min_keycode;
int max_keycode;
} keys;
};
#if XFreeXDGA
/**
* DGAEvent, used by DGA to intercept and emulate input events.
*/
struct _DGAEvent {
unsigned char header; /**< Always ET_Internal */
int length; /**< Length in bytes */
int subtype; /**< KeyPress, KeyRelease, ButtonPress,
ButtonRelease, MotionNotify */
int detail; /**< Button number or key code */
int dx; /**< Relative x coordinate */
int dy; /**< Relative y coordinate */
int screen; /**< Screen number this event applies to */
};
#endif
/**
* Raw event, contains the data as posted by the device.
*/
struct _RawDeviceEvent {
unsigned char header; /**< Always ET_Internal */
int length; /**< Length in bytes */
int deviceid; /**< Device to post this event for */
int sourceid; /**< The physical source device */
union {
} detail;
struct {
} valuators;
};
struct _BarrierEvent {
unsigned char header; /**< Always ET_Internal */
int length; /**< Length in bytes */
int deviceid; /**< Device to post this event for */
int sourceid; /**< The physical source device */
int barrierid;
double dx;
double dy;
double root_x;
double root_y;
};
#ifdef XQUARTZ
#define XQUARTZ_EVENT_MAXARGS 5
struct _XQuartzEvent {
unsigned char header; /**< Always ET_Internal */
int length; /**< Length in bytes */
int subtype; /**< Subtype defined by XQuartz DDX */
};
#endif
/**
* Event type used inside the X server for input event
* processing.
*/
union _InternalEvent {
struct {
unsigned char header; /**< Always ET_Internal */
int length; /**< Length in bytes */
} any;
#if XFreeXDGA
#endif
#ifdef XQUARTZ
#endif
};
#endif