only call board_handlePenMove when mouse button is down.

This commit is contained in:
ehouse 2004-06-15 01:41:39 +00:00
parent 893c5acd04
commit 00c0b86d1e
2 changed files with 27 additions and 14 deletions

View file

@ -101,9 +101,12 @@ static gint
button_press_event( GtkWidget *widget, GdkEventButton *event,
GtkAppGlobals* globals )
{
XP_Bool redraw = board_handlePenDown( globals->cGlobals.game.board,
event->x, event->y, event->time );
XP_Bool redraw;
globals->mouseDown = XP_TRUE;
redraw = board_handlePenDown( globals->cGlobals.game.board,
event->x, event->y, event->time );
if ( redraw ) {
board_draw( globals->cGlobals.game.board );
}
@ -112,14 +115,18 @@ button_press_event( GtkWidget *widget, GdkEventButton *event,
static gint
motion_notify_event( GtkWidget *widget, GdkEventMotion *event,
GtkAppGlobals* globals )
GtkAppGlobals* globals )
{
XP_Bool handled;
handled = board_handlePenMove( globals->cGlobals.game.board, event->x,
event->y );
if ( handled ) {
board_draw( globals->cGlobals.game.board );
if ( globals->mouseDown ) {
handled = board_handlePenMove( globals->cGlobals.game.board, event->x,
event->y );
if ( handled ) {
board_draw( globals->cGlobals.game.board );
}
} else {
handled = XP_FALSE;
}
return handled;
@ -127,13 +134,18 @@ motion_notify_event( GtkWidget *widget, GdkEventMotion *event,
static gint
button_release_event( GtkWidget *widget, GdkEventMotion *event,
GtkAppGlobals* globals )
GtkAppGlobals* globals )
{
XP_Bool redraw = board_handlePenUp( globals->cGlobals.game.board,
event->x,
event->y, event->time );
if ( redraw ) {
board_draw( globals->cGlobals.game.board );
XP_Bool redraw;
if ( globals->mouseDown ) {
redraw = board_handlePenUp( globals->cGlobals.game.board,
event->x,
event->y, event->time );
if ( redraw ) {
board_draw( globals->cGlobals.game.board );
}
globals->mouseDown = XP_FALSE;
}
return 1;
} /* button_release_event */

View file

@ -76,6 +76,7 @@ typedef struct GtkAppGlobals {
XP_Bool gridOn;
XP_Bool dropIncommingMsgs;
XP_Bool mouseDown;
} GtkAppGlobals;
/* DictionaryCtxt* gtk_dictionary_make(); */