fix middle click only left click; rename enum for mouse click
This commit is contained in:
parent
6126d62097
commit
e97e5f5009
4 changed files with 16 additions and 14 deletions
|
@ -26,13 +26,14 @@ void init_event(event *event, char is_pressed)
|
||||||
void mouse_event(event *event, mouse_button button)
|
void mouse_event(event *event, mouse_button button)
|
||||||
{
|
{
|
||||||
init_event(event, 0);
|
init_event(event, 0);
|
||||||
|
/* FIXME vérifier tous les flags pour des clics de souris en simultané */
|
||||||
switch (button)
|
switch (button)
|
||||||
{
|
{
|
||||||
case LEFT: event->infos |= 0x01;
|
case M_LEFT: event->infos |= 0x01;
|
||||||
break;
|
break;
|
||||||
case RIGHT: event->infos |= 0x02;
|
case M_RIGHT: event->infos |= 0x02;
|
||||||
break;
|
break;
|
||||||
case MIDDLE: event->infos |= 0x3;
|
case M_MIDDLE: event->infos |= 0x3;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,10 @@ typedef struct {
|
||||||
} event;
|
} event;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
LEFT = 0x01,
|
M_NONE = 0,
|
||||||
RIGHT = 0x10,
|
M_LEFT = 0x01,
|
||||||
MIDDLE = 0x11
|
M_RIGHT = 0x02,
|
||||||
|
M_MIDDLE = 0x03
|
||||||
} mouse_button;
|
} mouse_button;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -90,11 +90,11 @@ int listen(FILE *file)
|
||||||
|
|
||||||
/* printf("%d - %d\n", event.xmotion.x, event.xmotion.y); */
|
/* printf("%d - %d\n", event.xmotion.x, event.xmotion.y); */
|
||||||
|
|
||||||
if ((left || right) && !(left && right)) {
|
if (left || right) {
|
||||||
mouse_button type_button;
|
mouse_button type_button = M_NONE;
|
||||||
if (left) type_button = LEFT;
|
if (left) type_button |= M_LEFT;
|
||||||
if (right) type_button = RIGHT;
|
if (right) type_button |= M_RIGHT;
|
||||||
if (middle) type_button = MIDDLE;
|
if (middle) type_button |= M_MIDDLE;
|
||||||
|
|
||||||
mouse_event_coord(user_event, type_button, event.xmotion.x, event.xmotion.y);
|
mouse_event_coord(user_event, type_button, event.xmotion.x, event.xmotion.y);
|
||||||
write_event(user_event, file);
|
write_event(user_event, file);
|
||||||
|
|
|
@ -32,9 +32,9 @@ void readfile(args_readfile *args)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
left = current_event->infos & LEFT;
|
left = (current_event->infos & M_LEFT) == M_LEFT;
|
||||||
right = current_event->infos & RIGHT;
|
right =(current_event->infos & M_RIGHT) == M_RIGHT;
|
||||||
middle = current_event->infos & MIDDLE;
|
middle=(current_event->infos & M_MIDDLE) == M_MIDDLE ;
|
||||||
|
|
||||||
x = current_event->x;
|
x = current_event->x;
|
||||||
y = current_event->y;
|
y = current_event->y;
|
||||||
|
|
Loading…
Reference in a new issue