dix: Add new internal event enums for gesture events
This commit is contained in:
parent
8e504d8b36
commit
22fa31ed56
|
@ -95,6 +95,7 @@ SOFTWARE.
|
||||||
#include "exevents.h"
|
#include "exevents.h"
|
||||||
#include "extnsionst.h"
|
#include "extnsionst.h"
|
||||||
#include "exglobals.h"
|
#include "exglobals.h"
|
||||||
|
#include "eventstr.h"
|
||||||
#include "dixevents.h" /* DeliverFocusedEvent */
|
#include "dixevents.h" /* DeliverFocusedEvent */
|
||||||
#include "dixgrabs.h" /* CreateGrab() */
|
#include "dixgrabs.h" /* CreateGrab() */
|
||||||
#include "scrnintstr.h"
|
#include "scrnintstr.h"
|
||||||
|
@ -168,6 +169,49 @@ IsTouchEvent(InternalEvent *event)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bool
|
||||||
|
IsGestureEvent(InternalEvent *event)
|
||||||
|
{
|
||||||
|
switch (event->any.type) {
|
||||||
|
case ET_GesturePinchBegin:
|
||||||
|
case ET_GesturePinchUpdate:
|
||||||
|
case ET_GesturePinchEnd:
|
||||||
|
case ET_GestureSwipeBegin:
|
||||||
|
case ET_GestureSwipeUpdate:
|
||||||
|
case ET_GestureSwipeEnd:
|
||||||
|
return TRUE;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool
|
||||||
|
IsGestureBeginEvent(InternalEvent *event)
|
||||||
|
{
|
||||||
|
switch (event->any.type) {
|
||||||
|
case ET_GesturePinchBegin:
|
||||||
|
case ET_GestureSwipeBegin:
|
||||||
|
return TRUE;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool
|
||||||
|
IsGestureEndEvent(InternalEvent *event)
|
||||||
|
{
|
||||||
|
switch (event->any.type) {
|
||||||
|
case ET_GesturePinchEnd:
|
||||||
|
case ET_GestureSwipeEnd:
|
||||||
|
return TRUE;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the device matching the deviceid of the device set in the event, or
|
* @return the device matching the deviceid of the device set in the event, or
|
||||||
* NULL if the event is not an XInput event.
|
* NULL if the event is not an XInput event.
|
||||||
|
|
|
@ -969,8 +969,68 @@ GetXI2Type(enum EventType type)
|
||||||
case ET_BarrierLeave:
|
case ET_BarrierLeave:
|
||||||
xi2type = XI_BarrierLeave;
|
xi2type = XI_BarrierLeave;
|
||||||
break;
|
break;
|
||||||
|
case ET_GesturePinchBegin:
|
||||||
|
xi2type = XI_GesturePinchBegin;
|
||||||
|
break;
|
||||||
|
case ET_GesturePinchUpdate:
|
||||||
|
xi2type = XI_GesturePinchUpdate;
|
||||||
|
break;
|
||||||
|
case ET_GesturePinchEnd:
|
||||||
|
xi2type = XI_GesturePinchEnd;
|
||||||
|
break;
|
||||||
|
case ET_GestureSwipeBegin:
|
||||||
|
xi2type = XI_GestureSwipeBegin;
|
||||||
|
break;
|
||||||
|
case ET_GestureSwipeUpdate:
|
||||||
|
xi2type = XI_GestureSwipeUpdate;
|
||||||
|
break;
|
||||||
|
case ET_GestureSwipeEnd:
|
||||||
|
xi2type = XI_GestureSwipeEnd;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return xi2type;
|
return xi2type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a gesture type to corresponding Gesture{Pinch,Swipe}Begin.
|
||||||
|
* Returns 0 if the input type is not a gesture.
|
||||||
|
*/
|
||||||
|
enum EventType
|
||||||
|
GestureTypeToBegin(enum EventType type)
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case ET_GesturePinchBegin:
|
||||||
|
case ET_GesturePinchUpdate:
|
||||||
|
case ET_GesturePinchEnd:
|
||||||
|
return ET_GesturePinchBegin;
|
||||||
|
case ET_GestureSwipeBegin:
|
||||||
|
case ET_GestureSwipeUpdate:
|
||||||
|
case ET_GestureSwipeEnd:
|
||||||
|
return ET_GestureSwipeBegin;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a gesture type to corresponding Gesture{Pinch,Swipe}End.
|
||||||
|
* Returns 0 if the input type is not a gesture.
|
||||||
|
*/
|
||||||
|
enum EventType
|
||||||
|
GestureTypeToEnd(enum EventType type)
|
||||||
|
{
|
||||||
|
switch (type) {
|
||||||
|
case ET_GesturePinchBegin:
|
||||||
|
case ET_GesturePinchUpdate:
|
||||||
|
case ET_GesturePinchEnd:
|
||||||
|
return ET_GesturePinchEnd;
|
||||||
|
case ET_GestureSwipeBegin:
|
||||||
|
case ET_GestureSwipeUpdate:
|
||||||
|
case ET_GestureSwipeEnd:
|
||||||
|
return ET_GestureSwipeEnd;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -610,6 +610,13 @@ extern Bool
|
||||||
IsPointerEvent(InternalEvent *event);
|
IsPointerEvent(InternalEvent *event);
|
||||||
extern Bool
|
extern Bool
|
||||||
IsTouchEvent(InternalEvent *event);
|
IsTouchEvent(InternalEvent *event);
|
||||||
|
Bool
|
||||||
|
IsGestureEvent(InternalEvent *event);
|
||||||
|
Bool
|
||||||
|
IsGestureBeginEvent(InternalEvent *event);
|
||||||
|
Bool
|
||||||
|
IsGestureEndEvent(InternalEvent *event);
|
||||||
|
|
||||||
extern _X_EXPORT Bool
|
extern _X_EXPORT Bool
|
||||||
IsMaster(DeviceIntPtr dev);
|
IsMaster(DeviceIntPtr dev);
|
||||||
extern _X_EXPORT Bool
|
extern _X_EXPORT Bool
|
||||||
|
|
|
@ -36,4 +36,7 @@ _X_INTERNAL int GetCoreType(enum EventType type);
|
||||||
_X_INTERNAL int GetXIType(enum EventType type);
|
_X_INTERNAL int GetXIType(enum EventType type);
|
||||||
_X_INTERNAL int GetXI2Type(enum EventType type);
|
_X_INTERNAL int GetXI2Type(enum EventType type);
|
||||||
|
|
||||||
|
_X_INTERNAL enum EventType GestureTypeToBegin(enum EventType type);
|
||||||
|
_X_INTERNAL enum EventType GestureTypeToEnd(enum EventType type);
|
||||||
|
|
||||||
#endif /* _EVENTCONVERT_H_ */
|
#endif /* _EVENTCONVERT_H_ */
|
||||||
|
|
|
@ -75,6 +75,12 @@ enum EventType {
|
||||||
ET_XQuartz,
|
ET_XQuartz,
|
||||||
ET_BarrierHit,
|
ET_BarrierHit,
|
||||||
ET_BarrierLeave,
|
ET_BarrierLeave,
|
||||||
|
ET_GesturePinchBegin,
|
||||||
|
ET_GesturePinchUpdate,
|
||||||
|
ET_GesturePinchEnd,
|
||||||
|
ET_GestureSwipeBegin,
|
||||||
|
ET_GestureSwipeUpdate,
|
||||||
|
ET_GestureSwipeEnd,
|
||||||
ET_Internal = 0xFF /* First byte */
|
ET_Internal = 0xFF /* First byte */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue