mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-30 08:34:16 +01:00
only call board_handlePenMove when mouse button is down.
This commit is contained in:
parent
893c5acd04
commit
00c0b86d1e
2 changed files with 27 additions and 14 deletions
|
@ -101,8 +101,11 @@ static gint
|
||||||
button_press_event( GtkWidget *widget, GdkEventButton *event,
|
button_press_event( GtkWidget *widget, GdkEventButton *event,
|
||||||
GtkAppGlobals* globals )
|
GtkAppGlobals* globals )
|
||||||
{
|
{
|
||||||
|
XP_Bool redraw;
|
||||||
|
|
||||||
XP_Bool redraw = board_handlePenDown( globals->cGlobals.game.board,
|
globals->mouseDown = XP_TRUE;
|
||||||
|
|
||||||
|
redraw = board_handlePenDown( globals->cGlobals.game.board,
|
||||||
event->x, event->y, event->time );
|
event->x, event->y, event->time );
|
||||||
if ( redraw ) {
|
if ( redraw ) {
|
||||||
board_draw( globals->cGlobals.game.board );
|
board_draw( globals->cGlobals.game.board );
|
||||||
|
@ -116,11 +119,15 @@ motion_notify_event( GtkWidget *widget, GdkEventMotion *event,
|
||||||
{
|
{
|
||||||
XP_Bool handled;
|
XP_Bool handled;
|
||||||
|
|
||||||
|
if ( globals->mouseDown ) {
|
||||||
handled = board_handlePenMove( globals->cGlobals.game.board, event->x,
|
handled = board_handlePenMove( globals->cGlobals.game.board, event->x,
|
||||||
event->y );
|
event->y );
|
||||||
if ( handled ) {
|
if ( handled ) {
|
||||||
board_draw( globals->cGlobals.game.board );
|
board_draw( globals->cGlobals.game.board );
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
handled = XP_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
return handled;
|
return handled;
|
||||||
} /* motion_notify_event */
|
} /* motion_notify_event */
|
||||||
|
@ -129,12 +136,17 @@ static gint
|
||||||
button_release_event( GtkWidget *widget, GdkEventMotion *event,
|
button_release_event( GtkWidget *widget, GdkEventMotion *event,
|
||||||
GtkAppGlobals* globals )
|
GtkAppGlobals* globals )
|
||||||
{
|
{
|
||||||
XP_Bool redraw = board_handlePenUp( globals->cGlobals.game.board,
|
XP_Bool redraw;
|
||||||
|
|
||||||
|
if ( globals->mouseDown ) {
|
||||||
|
redraw = board_handlePenUp( globals->cGlobals.game.board,
|
||||||
event->x,
|
event->x,
|
||||||
event->y, event->time );
|
event->y, event->time );
|
||||||
if ( redraw ) {
|
if ( redraw ) {
|
||||||
board_draw( globals->cGlobals.game.board );
|
board_draw( globals->cGlobals.game.board );
|
||||||
}
|
}
|
||||||
|
globals->mouseDown = XP_FALSE;
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
} /* button_release_event */
|
} /* button_release_event */
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,7 @@ typedef struct GtkAppGlobals {
|
||||||
|
|
||||||
XP_Bool gridOn;
|
XP_Bool gridOn;
|
||||||
XP_Bool dropIncommingMsgs;
|
XP_Bool dropIncommingMsgs;
|
||||||
|
XP_Bool mouseDown;
|
||||||
} GtkAppGlobals;
|
} GtkAppGlobals;
|
||||||
|
|
||||||
/* DictionaryCtxt* gtk_dictionary_make(); */
|
/* DictionaryCtxt* gtk_dictionary_make(); */
|
||||||
|
|
Loading…
Add table
Reference in a new issue