summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/emuMB.c3
-rw-r--r--src/emuThird.c19
-rw-r--r--src/evdev.c5
-rw-r--r--src/evdev.h7
4 files changed, 21 insertions, 13 deletions
diff --git a/src/emuMB.c b/src/emuMB.c
index b7a57b8..eb01495 100644
--- a/src/emuMB.c
+++ b/src/emuMB.c
@@ -191,7 +191,8 @@ EvdevMBEmuTimer(InputInfoPtr pInfo)
pEvdev->emulateMB.pending = FALSE;
if ((id = stateTab[pEvdev->emulateMB.state][4][0]) != 0) {
- EvdevPostButtonEvent(pInfo, abs(id), (id >= 0));
+ EvdevPostButtonEvent(pInfo, abs(id),
+ (id >= 0) ? BUTTON_PRESS : BUTTON_RELEASE);
pEvdev->emulateMB.state =
stateTab[pEvdev->emulateMB.state][4][2];
} else {
diff --git a/src/emuThird.c b/src/emuThird.c
index d89fd9e..7461767 100644
--- a/src/emuThird.c
+++ b/src/emuThird.c
@@ -58,7 +58,7 @@ enum EmulationState {
};
static void
-Evdev3BEmuPostButtonEvent(InputInfoPtr pInfo, int button, int press)
+Evdev3BEmuPostButtonEvent(InputInfoPtr pInfo, int button, enum ButtonAction act)
{
EvdevPtr pEvdev = pInfo->private;
struct emulate3B *emu3B = &pEvdev->emulate3B;
@@ -72,7 +72,8 @@ Evdev3BEmuPostButtonEvent(InputInfoPtr pInfo, int button, int press)
if (emu3B->flags & EVDEV_ABSOLUTE_EVENTS)
absolute = Absolute;
- xf86PostButtonEventP(pInfo->dev, absolute, button, press, 0,
+ xf86PostButtonEventP(pInfo->dev, absolute, button,
+ (act == BUTTON_PRESS) ? 1 : 0, 0,
(absolute ? 2 : 0), emu3B->startpos);
}
@@ -92,7 +93,7 @@ Evdev3BEmuTimer(OsTimerPtr timer, CARD32 time, pointer arg)
sigstate = xf86BlockSIGIO ();
emu3B->state = EM3B_EMULATING;
- Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, 1);
+ Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, BUTTON_PRESS);
xf86UnblockSIGIO (sigstate);
return 0;
}
@@ -145,14 +146,14 @@ Evdev3BEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
switch (emu3B->state)
{
case EM3B_PENDING:
- Evdev3BEmuPostButtonEvent(pInfo, 1, 1);
+ Evdev3BEmuPostButtonEvent(pInfo, 1, BUTTON_PRESS);
Evdev3BCancel(pInfo);
break;
case EM3B_EMULATING:
/* We're emulating and now the user pressed a different
* button. Just release the emulating one, tell the user to
* not do that and get on with life */
- Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, 0);
+ Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, BUTTON_RELEASE);
Evdev3BCancel(pInfo);
break;
default:
@@ -171,11 +172,11 @@ Evdev3BEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
switch(emu3B->state)
{
case EM3B_PENDING:
- Evdev3BEmuPostButtonEvent(pInfo, 1, 1);
+ Evdev3BEmuPostButtonEvent(pInfo, 1, BUTTON_PRESS);
Evdev3BCancel(pInfo);
break;
case EM3B_EMULATING:
- Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, 0);
+ Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, BUTTON_RELEASE);
Evdev3BCancel(pInfo);
ret = TRUE;
break;
@@ -237,7 +238,7 @@ Evdev3BEmuProcessAbsMotion(InputInfoPtr pInfo, ValuatorMask *vals)
if (cancel)
{
- Evdev3BEmuPostButtonEvent(pInfo, 1, 1);
+ Evdev3BEmuPostButtonEvent(pInfo, 1, BUTTON_PRESS);
Evdev3BCancel(pInfo);
}
}
@@ -262,7 +263,7 @@ Evdev3BEmuProcessRelMotion(InputInfoPtr pInfo, int dx, int dy)
if (abs(emu3B->delta[0]) > emu3B->threshold ||
abs(emu3B->delta[1]) > emu3B->threshold)
{
- Evdev3BEmuPostButtonEvent(pInfo, 1, 1);
+ Evdev3BEmuPostButtonEvent(pInfo, 1, BUTTON_PRESS);
Evdev3BCancel(pInfo);
}
}
diff --git a/src/evdev.c b/src/evdev.c
index 13b1e10..4bb55f5 100644
--- a/src/evdev.c
+++ b/src/evdev.c
@@ -411,9 +411,10 @@ EvdevQueueTouchEvent(InputInfoPtr pInfo, unsigned int touch, ValuatorMask *mask,
* Interface for MB emulation since these need to post immediately.
*/
void
-EvdevPostButtonEvent(InputInfoPtr pInfo, int button, int value)
+EvdevPostButtonEvent(InputInfoPtr pInfo, int button, enum ButtonAction act)
{
- xf86PostButtonEvent(pInfo->dev, Relative, button, value, 0, 0);
+ xf86PostButtonEvent(pInfo->dev, Relative, button,
+ (act == BUTTON_PRESS) ? 1 : 0, 0, 0);
}
void
diff --git a/src/evdev.h b/src/evdev.h
index 27e404c..5fd99ff 100644
--- a/src/evdev.h
+++ b/src/evdev.h
@@ -107,6 +107,11 @@ enum SlotState {
SLOTSTATE_EMPTY,
};
+enum ButtonAction {
+ BUTTON_RELEASE = 0,
+ BUTTON_PRESS = 1
+};
+
/* axis specific data for wheel emulation */
typedef struct {
int up_button;
@@ -248,7 +253,7 @@ void EvdevQueueProximityEvent(InputInfoPtr pInfo, int value);
void EvdevQueueTouchEvent(InputInfoPtr pInfo, unsigned int touch,
ValuatorMask *mask, uint16_t type);
#endif
-void EvdevPostButtonEvent(InputInfoPtr pInfo, int button, int value);
+void EvdevPostButtonEvent(InputInfoPtr pInfo, int button, enum ButtonAction act);
void EvdevQueueButtonClicks(InputInfoPtr pInfo, int button, int count);
void EvdevPostRelativeMotionEvents(InputInfoPtr pInfo, int num_v, int first_v,
int v[MAX_VALUATORS]);