summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/game.c3
-rw-r--r--src/client/interface.c7
-rw-r--r--src/client/mouse_buffer.c135
-rw-r--r--src/client/mouse_buffer.h20
-rw-r--r--src/screen/world.c58
-rw-r--r--src/widget/widget_button.c11
-rw-r--r--src/widget/widget_buttonimage.c7
-rw-r--r--src/widget/widget_catchkey.c9
-rw-r--r--src/widget/widget_catchkey.h2
-rw-r--r--src/widget/widget_check.c8
-rw-r--r--src/widget/widget_choicegroup.c11
-rw-r--r--src/widget/widget_select.c20
-rw-r--r--src/widget/widget_statusbar.c7
-rw-r--r--src/widget/widget_textfield.c9
14 files changed, 226 insertions, 81 deletions
diff --git a/src/client/game.c b/src/client/game.c
index 4ff8724..12dff3a 100644
--- a/src/client/game.c
+++ b/src/client/game.c
@@ -22,6 +22,7 @@
#include "settingKeys.h"
#include "panel.h"
#include "radar.h"
+#include "mouse_buffer.h"
#ifndef NO_SOUND
#include "audio.h"
@@ -45,6 +46,7 @@ static void initGame()
{
home_director_create();
+ mouse_buffer_init();
interface_init();
font_init();
layer_init();
@@ -76,6 +78,7 @@ static void initGame()
void game_quit()
{
+ mouse_buffer_quit();
interface_quit();
main_menu_quit();
diff --git a/src/client/interface.c b/src/client/interface.c
index e8f1971..9907862 100644
--- a/src/client/interface.c
+++ b/src/client/interface.c
@@ -7,7 +7,7 @@
#include "screen.h"
#include "keyboardBuffer.h"
#include "hotKey.h"
-
+#include "mouse_buffer.h"
static SDL_Surface *screen; /* window surface */
/*static SDL_Surface *my_surface;*/
@@ -278,6 +278,10 @@ int eventAction()
while (SDL_WaitEvent(&event)) {
switch (event.type) {
+ case SDL_MOUSEBUTTONDOWN:
+ mouse_buffer_event(&event.button);
+ break;
+
case SDL_KEYDOWN:
switch (event.key.keysym.sym) {
default:
@@ -300,6 +304,7 @@ int eventAction()
screen_event();
hot_key_event();
screen_switch();
+ mouse_buffer_clean();
break;
default:
diff --git a/src/client/mouse_buffer.c b/src/client/mouse_buffer.c
new file mode 100644
index 0000000..9888c44
--- /dev/null
+++ b/src/client/mouse_buffer.c
@@ -0,0 +1,135 @@
+#include <SDL.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <assert.h>
+
+#include "main.h"
+#include "list.h"
+#include "mouse_buffer.h"
+
+static list_t *list_event;
+
+typedef struct mouse_event_struct
+{
+ Uint8 button;
+ int x;
+ int y;
+} mouse_event_t;
+
+static mouse_event_t* mouse_event_new(int x, int y, Uint8 button)
+{
+ mouse_event_t *mouse_event;
+
+ mouse_event = malloc(sizeof(mouse_event_t));
+ mouse_event->x = x;
+ mouse_event->y = y;
+ mouse_event->button = button;
+
+ return mouse_event;
+}
+
+static void mouse_event_destroy(mouse_event_t *mouse_event)
+{
+ assert(mouse_event != NULL);
+ free(mouse_event);
+}
+
+int mouse_buffer_init()
+{
+ list_event = list_new();
+
+ return 0;
+}
+
+int mouse_buffer_event(SDL_MouseButtonEvent *button)
+{
+ assert(button != NULL);
+ assert(list_event != NULL);
+
+ switch(button->button) {
+ case SDL_BUTTON_LEFT:
+ case SDL_BUTTON_RIGHT:
+ //printf("mouse button - pos(%d,%d)\n", button->x, button->y);
+
+ list_add(list_event, mouse_event_new(button->x, button->y, button->button));
+
+ return 1;
+ break;
+
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+int mouse_buffer_clean()
+{
+ assert(list_event != NULL);
+ list_do_empty(list_event);
+
+ return 0;
+}
+
+bool_t mouse_buffer_is_on_area(int x, int y, int w, int h, unsigned int flag)
+{
+ mouse_event_t *mouse_event;
+ int i;
+
+ assert(list_event != NULL);
+
+ if (flag & MOUSE_BUF_MOTION) {
+ int mouse_x, mouse_y;
+
+ SDL_GetMouseState(&mouse_x, &mouse_y);
+
+ if (mouse_x >= x && mouse_y >= y &&
+ mouse_x < x+w && mouse_y < y+h) {
+ return TRUE;
+ }
+ } else {
+ for (i = 0; i<list_event->count; i++) {
+ mouse_event = (mouse_event_t *)list_event->list[i];
+
+ if ((mouse_event->x >= x && mouse_event->y >= y && mouse_event->x < x+w && mouse_event->y < y+h) ||
+ (flag & MOUSE_BUF_AREA_NONE)) {
+ if (flag & MOUSE_BUF_CLICK_LEFT) {
+ if (mouse_event->button == SDL_BUTTON_LEFT) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ }
+
+ if (flag & MOUSE_BUF_CLICK_RIGHT) {
+ if (mouse_event->button == SDL_BUTTON_RIGHT) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ }
+
+ if (flag & MOUSE_BUF_CLICK) {
+ if (mouse_event->button == SDL_BUTTON_LEFT || mouse_event->button == SDL_BUTTON_RIGHT) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+ }
+ }
+ }
+
+ return FALSE;
+}
+
+int mouse_buffer_quit()
+{
+ assert(list_event != NULL);
+ list_destroy_item(list_event, mouse_event_destroy);
+
+ return 0;
+}
diff --git a/src/client/mouse_buffer.h b/src/client/mouse_buffer.h
new file mode 100644
index 0000000..75fe549
--- /dev/null
+++ b/src/client/mouse_buffer.h
@@ -0,0 +1,20 @@
+#ifndef MOUSE_EVENT_H
+#define MOUSE_EVENT_H
+
+#include <SDL.h>
+
+#define MOUSE_BUF_MOTION 1
+#define MOUSE_BUF_CLICK_LEFT 2
+#define MOUSE_BUF_CLICK_RIGHT 4
+#define MOUSE_BUF_CLICK 8
+#define MOUSE_BUF_AREA_NONE 16
+
+extern int mouse_buffer_init();
+extern int mouse_buffer_event(SDL_MouseButtonEvent *button);
+extern int mouse_buffer_clean();
+extern bool_t mouse_buffer_is_on_area(int x, int y, int w, int h, unsigned int flag);
+extern int mouse_buffer_quit();
+
+#endif
+
+
diff --git a/src/screen/world.c b/src/screen/world.c
index 42f0990..2afd8d4 100644
--- a/src/screen/world.c
+++ b/src/screen/world.c
@@ -149,34 +149,14 @@ void prepareArena()
tux = tux_new();
- control_tux_right = control_new(
- key_table_get_key(KEY_TUX_RIGHT_MOVE_UP),
- key_table_get_key(KEY_TUX_RIGHT_MOVE_RIGHT),
- key_table_get_key(KEY_TUX_RIGHT_MOVE_LEFT),
- key_table_get_key(KEY_TUX_RIGHT_MOVE_DOWN),
- key_table_get_key(KEY_TUX_RIGHT_SWITCH_WEAPON),
- key_table_get_key(KEY_TUX_RIGHT_SHOOT)
- );
-
- tux->control = TUX_CONTROL_KEYBOARD_RIGHT;
- tuxWithControlRightKeyboard = tux;
+ world_set_control_tux(tux, TUX_CONTROL_KEYBOARD_RIGHT);
public_server_get_setting_name_right(name);
tux_set_name(tux, name);
space_add(arena->spaceTux, tux);
tux = tux_new();
- control_tux_left = control_new(
- key_table_get_key(KEY_TUX_LEFT_MOVE_UP),
- key_table_get_key(KEY_TUX_LEFT_MOVE_RIGHT),
- key_table_get_key(KEY_TUX_LEFT_MOVE_LEFT),
- key_table_get_key(KEY_TUX_LEFT_MOVE_DOWN),
- key_table_get_key(KEY_TUX_LEFT_SWITCH_WEAPON),
- key_table_get_key(KEY_TUX_LEFT_SHOOT)
- );
-
- tux->control = TUX_CONTROL_KEYBOARD_LEFT;
- tuxWithControlLeftKeyboard = tux;
+ world_set_control_tux(tux, TUX_CONTROL_KEYBOARD_LEFT);
public_server_get_settingNameLeft(name);
tux_set_name(tux, name);
space_add(arena->spaceTux, tux);
@@ -199,17 +179,7 @@ void prepareArena()
tux = tux_new();
- control_tux_right = control_new(
- key_table_get_key(KEY_TUX_RIGHT_MOVE_UP),
- key_table_get_key(KEY_TUX_RIGHT_MOVE_RIGHT),
- key_table_get_key(KEY_TUX_RIGHT_MOVE_LEFT),
- key_table_get_key(KEY_TUX_RIGHT_MOVE_DOWN),
- key_table_get_key(KEY_TUX_RIGHT_SWITCH_WEAPON),
- key_table_get_key(KEY_TUX_RIGHT_SHOOT)
- );
-
- tux->control = TUX_CONTROL_KEYBOARD_RIGHT;
- tuxWithControlRightKeyboard = tux;
+ world_set_control_tux(tux, TUX_CONTROL_KEYBOARD_RIGHT);
public_server_get_setting_name_right(name);
tux_set_name(tux, name);
space_add(arena->spaceTux, tux);
@@ -308,9 +278,31 @@ void world_set_control_tux(tux_t *tux, int control_type)
switch (control_type) {
case TUX_CONTROL_KEYBOARD_RIGHT:
tuxWithControlRightKeyboard = tux;
+ tux->control = control_type;
+
+ control_tux_right = control_new(
+ key_table_get_key(KEY_TUX_RIGHT_MOVE_UP),
+ key_table_get_key(KEY_TUX_RIGHT_MOVE_RIGHT),
+ key_table_get_key(KEY_TUX_RIGHT_MOVE_LEFT),
+ key_table_get_key(KEY_TUX_RIGHT_MOVE_DOWN),
+ key_table_get_key(KEY_TUX_RIGHT_SHOOT),
+ key_table_get_key(KEY_TUX_RIGHT_SWITCH_WEAPON)
+ );
+
break;
case TUX_CONTROL_KEYBOARD_LEFT:
tuxWithControlLeftKeyboard = tux;
+ tux->control = control_type;
+
+ control_tux_left = control_new(
+ key_table_get_key(KEY_TUX_LEFT_MOVE_UP),
+ key_table_get_key(KEY_TUX_LEFT_MOVE_RIGHT),
+ key_table_get_key(KEY_TUX_LEFT_MOVE_LEFT),
+ key_table_get_key(KEY_TUX_LEFT_MOVE_DOWN),
+ key_table_get_key(KEY_TUX_RIGHT_SHOOT),
+ key_table_get_key(KEY_TUX_RIGHT_SWITCH_WEAPON)
+ );
+
break;
}
}
diff --git a/src/widget/widget_button.c b/src/widget/widget_button.c
index 26c153a..7e2d091 100644
--- a/src/widget/widget_button.c
+++ b/src/widget/widget_button.c
@@ -6,6 +6,7 @@
#include "interface.h"
#include "image.h"
#include "font.h"
+#include "mouse_buffer.h"
#include "widget.h"
#include "widget_button.h"
@@ -44,8 +45,7 @@ void button_draw(widget_t *widget)
g_button1 = image_add("button1.png", IMAGE_ALPHA, "button1", IMAGE_GROUP_BASE);
}
- if (x >= widget->x && x <= widget->x + WIDGET_BUTTON_WIDTH &&
- y >= widget->y && y <= widget->y + WIDGET_BUTTON_HEIGHT) {
+ if (mouse_buffer_is_on_area(widget->x, widget->y, WIDGET_BUTTON_WIDTH, WIDGET_BUTTON_HEIGHT, MOUSE_BUF_MOTION)) {
image_draw(g_button1, widget->x, widget->y, 0, 0, g_button0->w, g_button0->h);
} else {
image_draw(g_button0, widget->x, widget->y, 0, 0, g_button0->w, g_button0->h);
@@ -61,7 +61,6 @@ void button_event(widget_t *widget)
{
widget_button_t *p;
static int my_time = 0;
- int x, y;
assert(widget != NULL);
assert(widget->type == WIDGET_TYPE_BUTTON);
@@ -73,11 +72,7 @@ void button_event(widget_t *widget)
return;
}
- interface_get_mouse_position(&x, &y);
-
- if (x >= widget->x && x <= widget->x + WIDGET_BUTTON_WIDTH &&
- y >= widget->y && y <= widget->y + WIDGET_BUTTON_HEIGHT &&
- interface_is_mouse_clicket()) {
+ if (mouse_buffer_is_on_area(widget->x, widget->y, WIDGET_BUTTON_WIDTH, WIDGET_BUTTON_HEIGHT, MOUSE_BUF_CLICK)) {
my_time = WIDGET_BUTTON_TIME;
DEBUG_MSG(_("[Debug] Caught some button event\n"));
diff --git a/src/widget/widget_buttonimage.c b/src/widget/widget_buttonimage.c
index a22d4fe..134d34e 100644
--- a/src/widget/widget_buttonimage.c
+++ b/src/widget/widget_buttonimage.c
@@ -5,6 +5,7 @@
#include "interface.h"
#include "font.h"
#include "image.h"
+#include "mouse_buffer.h"
#include "widget.h"
#include "widget_buttonimage.h"
@@ -49,7 +50,6 @@ void button_image_event(widget_t *widget)
{
widget_buttonimage_t *p;
static int my_time = 0;
- int x, y;
assert(widget != NULL);
assert(widget->type == WIDGET_TYPE_BUTTONIMAGE);
@@ -61,10 +61,7 @@ void button_image_event(widget_t *widget)
return;
}
- interface_get_mouse_position(&x, &y);
-
- if (x >= widget->x && x <= widget->x + p->w &&
- y >= widget->y && y <= widget->y + p->h && interface_is_mouse_clicket()) {
+ if (mouse_buffer_is_on_area(widget->x, widget->y, p->w, p->h, MOUSE_BUF_CLICK)) {
my_time = WIDGET_BUTTONIMAGE_TIME;
p->active = 1;
p->fce_event(widget);
diff --git a/src/widget/widget_catchkey.c b/src/widget/widget_catchkey.c
index b961012..b6290a6 100644
--- a/src/widget/widget_catchkey.c
+++ b/src/widget/widget_catchkey.c
@@ -4,6 +4,7 @@
#include "main.h"
#include "interface.h"
#include "font.h"
+#include "mouse_buffer.h"
#include "widget.h"
#include "widget_catchkey.h"
@@ -95,18 +96,14 @@ static int getPessAnyKey()
void catch_key_event(widget_t *widget)
{
widget_catchkey_t *p;
- int x, y;
assert(widget != NULL);
assert(widget->type == WIDGET_TYPE_CATCHKEY);
p = (widget_catchkey_t *) widget->private_data;
- interface_get_mouse_position(&x, &y);
-
- if (interface_is_mouse_clicket()) {
- if (x >= widget->x && x <= widget->x + WIDGET_CATCHKEY_WIDTH &&
- y >= widget->y && y <= widget->y + WIDGET_CATCHKEY_HEIGHT) {
+ if (mouse_buffer_is_on_area(0, 0, 0, 0, MOUSE_BUF_AREA_NONE|MOUSE_BUF_CLICK)) {
+ if (mouse_buffer_is_on_area(widget->x, widget->y, WIDGET_CATCHKEY_WIDTH, WIDGET_CATCHKEY_HEIGHT, MOUSE_BUF_CLICK)) {
p->active = TRUE;
} else {
p->active = FALSE;
diff --git a/src/widget/widget_catchkey.h b/src/widget/widget_catchkey.h
index a030f6e..d922241 100644
--- a/src/widget/widget_catchkey.h
+++ b/src/widget/widget_catchkey.h
@@ -7,7 +7,7 @@
#define WIDGET_CATCHKEY_NOKEY -1
#define WIDGET_CATCHKEY_WIDTH 110
-#define WIDGET_CATCHKEY_HEIGHT 12
+#define WIDGET_CATCHKEY_HEIGHT 16
typedef struct widget_catchkey_struct {
int w, h;
diff --git a/src/widget/widget_check.c b/src/widget/widget_check.c
index 3d7814c..4aa6a29 100644
--- a/src/widget/widget_check.c
+++ b/src/widget/widget_check.c
@@ -4,6 +4,7 @@
#include "main.h"
#include "interface.h"
#include "image.h"
+#include "mouse_buffer.h"
#include "widget.h"
#include "widget_check.h"
@@ -50,7 +51,6 @@ void check_draw(widget_t *widget)
void check_event(widget_t *widget)
{
widget_check_t *p;
- int x, y;
assert(widget != NULL);
assert(widget->type == WIDGET_TYPE_CHECK);
@@ -62,11 +62,7 @@ void check_event(widget_t *widget)
return;
}
- interface_get_mouse_position(&x, &y);
-
- if (x >= widget->x && x <= widget->x + WIDGET_CHECK_WIDTH &&
- y >= widget->y && y <= widget->y + WIDGET_CHECK_HEIGHT &&
- interface_is_mouse_clicket()) {
+ if (mouse_buffer_is_on_area(widget->x, widget->y, WIDGET_CHECK_WIDTH, WIDGET_CHECK_HEIGHT, MOUSE_BUF_CLICK)) {
if (p->status == TRUE) {
p->status = FALSE;
p->time = WIDGET_CHECK_TIME_SWITCH_STATUS;
diff --git a/src/widget/widget_choicegroup.c b/src/widget/widget_choicegroup.c
index ee3894e..d325d1b 100644
--- a/src/widget/widget_choicegroup.c
+++ b/src/widget/widget_choicegroup.c
@@ -4,6 +4,7 @@
#include "main.h"
#include "interface.h"
#include "image.h"
+#include "mouse_buffer.h"
#include "widget.h"
#include "widget_choicegroup.h"
@@ -30,7 +31,6 @@ void choice_group_draw(widget_t *widget)
{
widget_choicegroup_t *p;
static image_t *g_choicegroup = NULL;
- int x, y;
int offset;
assert(widget != NULL);
@@ -38,8 +38,6 @@ void choice_group_draw(widget_t *widget)
p = (widget_choicegroup_t *) widget->private_data;
- interface_get_mouse_position(&x, &y);
-
if (g_choicegroup == NULL) {
g_choicegroup = image_add("choice.png", IMAGE_ALPHA, "choicegroup", IMAGE_GROUP_BASE);
}
@@ -107,7 +105,6 @@ void choiceGroup_set_status(widget_t *widget, bool_t status)
void choice_group_event(widget_t *widget)
{
widget_choicegroup_t *p;
- int x, y;
assert(widget != NULL);
assert(widget->type == WIDGET_TYPE_CHOICE);
@@ -119,11 +116,7 @@ void choice_group_event(widget_t *widget)
return;
}
- interface_get_mouse_position(&x, &y);
-
- if (x >= widget->x && x <= widget->x + WIDGET_CHOICEGROUP_WIDTH &&
- y >= widget->y && y <= widget->y + WIDGET_CHOICEGROUP_HEIGHT &&
- interface_is_mouse_clicket()) {
+ if (mouse_buffer_is_on_area(widget->x, widget->y, WIDGET_CHOICEGROUP_WIDTH, WIDGET_CHOICEGROUP_HEIGHT, MOUSE_BUF_CLICK)) {
choice_group_set_active(widget);
}
}
diff --git a/src/widget/widget_select.c b/src/widget/widget_select.c
index d847113..a453ec4 100644
--- a/src/widget/widget_select.c
+++ b/src/widget/widget_select.c
@@ -4,6 +4,7 @@
#include "main.h"
#include "interface.h"
#include "font.h"
+#include "mouse_buffer.h"
#include "widget.h"
#include "widget_select.h"
@@ -92,7 +93,7 @@ void select_draw(widget_t *widget)
line = (char *) p->list->list[i];
font_text_size(line, &w, &h);
-
+/*
if (x > widget->x && y > widget->y + i * 20 &&
x < widget->x + w && y < widget->y + i * 20 + h) {
font_draw(line, widget->x, widget->y + i * 20, COLOR_YELLOW);
@@ -103,6 +104,17 @@ void select_draw(widget_t *widget)
font_draw(line, widget->x, widget->y + i * 20, COLOR_WHITE);
}
}
+*/
+ if (mouse_buffer_is_on_area(widget->x, widget->y+i * 20, w, h, MOUSE_BUF_MOTION)) {
+ font_draw(line, widget->x, widget->y + i * 20, COLOR_YELLOW);
+ } else {
+ if (p->select == i) {
+ font_draw(line, widget->x, widget->y + i * 20, COLOR_RED);
+ } else {
+ font_draw(line, widget->x, widget->y + i * 20, COLOR_WHITE);
+ }
+ }
+
}
}
@@ -125,12 +137,18 @@ void select_event(widget_t *widget)
font_text_size(line, &w, &h);
+ if (mouse_buffer_is_on_area(widget->x, widget->y+i * 20, w, h, MOUSE_BUF_CLICK)) {
+ p->select = i;
+ p->fce_event(p);
+ }
+/*
if (x > widget->x && y > widget->y + i * 20 &&
x < widget->x + w && y < widget->y + i * 20 + h &&
interface_is_mouse_clicket()) {
p->select = i;
p->fce_event(p);
}
+*/
}
}
diff --git a/src/widget/widget_statusbar.c b/src/widget/widget_statusbar.c
index 0ee5cc0..0a9c9b3 100644
--- a/src/widget/widget_statusbar.c
+++ b/src/widget/widget_statusbar.c
@@ -7,6 +7,7 @@
#include "font.h"
#include "widget_statusbar.h"
#include "widget.h"
+#include "mouse_buffer.h"
typedef struct item_struct {
widget_t *widget;
@@ -107,7 +108,6 @@ void statusbar_draw(widget_t *widget)
void statusbar_event(widget_t *widget)
{
widget_statusbar_t *p;
- int x, y;
int i;
assert(widget != NULL);
@@ -115,8 +115,6 @@ void statusbar_event(widget_t *widget)
p = (widget_statusbar_t *) widget->private_data;
- interface_get_mouse_position(&x, &y);
-
p->selectElement = WIDGET_STATUSBAR_NONE_SELECT_ELEMENT;
for (i = 0 ; i < p->listElement->count; i++) {
@@ -124,8 +122,7 @@ void statusbar_event(widget_t *widget)
item = (item_t *) p->listElement->list[i];
- if (x >= item->widget->x && x <= item->widget->x + item->widget->w &&
- y >= item->widget->y && y <= item->widget->y + item->widget->h) {
+ if (mouse_buffer_is_on_area(item->widget->x, item->widget->y, item->widget->w, item->widget->h, MOUSE_BUF_MOTION)) {
p->selectElement = i;
}
}
diff --git a/src/widget/widget_textfield.c b/src/widget/widget_textfield.c
index be0f016..1711ad9 100644
--- a/src/widget/widget_textfield.c
+++ b/src/widget/widget_textfield.c
@@ -5,6 +5,7 @@
#include "interface.h"
#include "font.h"
#include "image.h"
+#include "mouse_buffer.h"
#include "widget.h"
#include "widget_textfield.h"
@@ -300,18 +301,14 @@ static void readKey(widget_textfield_t *p)
void text_field_event(widget_t *widget)
{
widget_textfield_t *p;
- int x, y;
assert(widget != NULL);
assert(widget->type == WIDGET_TYPE_TEXTFILED);
p = (widget_textfield_t *) widget->private_data;
- interface_get_mouse_position(&x, &y);
-
- if (interface_is_mouse_clicket()) {
- if (x >= widget->x && x <= widget->x + WIDGET_TEXTFIELD_WIDTH &&
- y >= widget->y && y <= widget->y + WIDGET_TEXTFIELD_HEIGHT) {
+ if (mouse_buffer_is_on_area(0, 0, 0, 0, MOUSE_BUF_AREA_NONE|MOUSE_BUF_CLICK)) {
+ if (mouse_buffer_is_on_area(widget->x, widget->y, WIDGET_TEXTFIELD_WIDTH, WIDGET_TEXTFIELD_HEIGHT, MOUSE_BUF_MOTION)) {
p->active = TRUE;
interface_enable_keyboard_buffer();
keyboard_buffer_clear();