libs/libnx/nxtk/nxtk_events: Fix an error in handling mouse events for framed windows. When drawing, NX may report mouse positions outside of the Window. The is only for NX windows, but the outside-the-side positions were being discarded by nxtk_events().

This commit is contained in:
Gregory Nutt
2019-05-07 18:17:59 -06:00
parent 0ac8b5b8f6
commit a312503ed2
3 changed files with 48 additions and 9 deletions
+8 -4
View File
@@ -54,6 +54,10 @@
* Private Data
****************************************************************************/
/* REVISIT: These globals will prevent this code from being used in an
* environment with more than one display. FIX ME!
*/
static struct nxgl_point_s g_mpos;
static struct nxgl_point_s g_mrange;
static uint8_t g_mbutton;
@@ -198,7 +202,7 @@ int nxmu_mousein(FAR struct nxmu_state_s *nxmu,
y = g_mrange.y - 1;
}
/* Look any change in values */
/* Look for any change in values */
if (x != g_mpos.x || y != g_mpos.y || buttons != g_mbutton)
{
@@ -211,13 +215,13 @@ int nxmu_mousein(FAR struct nxmu_state_s *nxmu,
/* If a button is already down, regard this as part of a mouse drag
* event. Pass all the following events to the window where the drag
* started in.
* started in, including the final button release event.
*/
if (oldbuttons)
if (oldbuttons != 0)
{
g_mwnd = nxmu_revalidate_g_mwnd(nxmu->be.topwnd);
if (g_mwnd && g_mwnd->cb->mousein)
if (g_mwnd != NULL && g_mwnd->cb->mousein)
{
struct nxclimsg_mousein_s outmsg;
outmsg.msgid = NX_CLIMSG_MOUSEIN;