gtk frontend: Ignore initial mouse clicks from outside the
touchscreen, but allow dragging outside of it once touch is started. Patch from #2998869 by noodlebox.
This commit is contained in:
parent
77024d3b82
commit
be3000353b
|
@ -1192,7 +1192,7 @@ static gboolean ExposeDrawingArea (GtkWidget *widget, GdkEventExpose *event, gpo
|
||||||
|
|
||||||
/////////////////////////////// KEYS AND STYLUS UPDATE ///////////////////////////////////////
|
/////////////////////////////// KEYS AND STYLUS UPDATE ///////////////////////////////////////
|
||||||
|
|
||||||
static inline void rotoscaled_touchpos(gint x, gint y)
|
static gboolean rotoscaled_touchpos(gint x, gint y, gboolean start)
|
||||||
{
|
{
|
||||||
u16 EmuX, EmuY;
|
u16 EmuX, EmuY;
|
||||||
gint X, Y;
|
gint X, Y;
|
||||||
|
@ -1214,14 +1214,15 @@ static inline void rotoscaled_touchpos(gint x, gint y)
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG("X=%d, Y=%d\n",x,y);
|
LOG("X=%d, Y=%d\n",x,y);
|
||||||
// FIXME: should ignore events only when STARTING touched-position
|
|
||||||
// was outside touchscreen - desmume window does not have physical band
|
if (!start || (X >= 0 && Y >= 0 && X < 256 && Y < 192)) {
|
||||||
// to limit movement of stylus
|
|
||||||
if ( Y >= 0 ) {
|
|
||||||
EmuX = CLAMP(X, 0, 255);
|
EmuX = CLAMP(X, 0, 255);
|
||||||
EmuY = CLAMP(Y, 0, 191);
|
EmuY = CLAMP(Y, 0, 191);
|
||||||
NDS_setTouchPos(EmuX, EmuY);
|
NDS_setTouchPos(EmuX, EmuY);
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean Stylus_Move(GtkWidget *w, GdkEventMotion *e, gpointer data)
|
static gboolean Stylus_Move(GtkWidget *w, GdkEventMotion *e, gpointer data)
|
||||||
|
@ -1239,7 +1240,7 @@ static gboolean Stylus_Move(GtkWidget *w, GdkEventMotion *e, gpointer data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(state & GDK_BUTTON1_MASK)
|
if(state & GDK_BUTTON1_MASK)
|
||||||
rotoscaled_touchpos(x,y);
|
rotoscaled_touchpos(x, y, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -1261,12 +1262,11 @@ static gboolean Stylus_Press(GtkWidget * w, GdkEventButton * e,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (e->button == 1) {
|
if (e->button == 1) {
|
||||||
click = TRUE;
|
|
||||||
|
|
||||||
gdk_window_get_pointer(w->window, &x, &y, &state);
|
gdk_window_get_pointer(w->window, &x, &y, &state);
|
||||||
|
|
||||||
if(state & GDK_BUTTON1_MASK)
|
if(state & GDK_BUTTON1_MASK)
|
||||||
rotoscaled_touchpos(x, y);
|
if (rotoscaled_touchpos(x, y, TRUE))
|
||||||
|
click = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in New Issue