diff options
author | px4dev <px4@purgatory.org> | 2013-01-11 02:14:43 -0800 |
---|---|---|
committer | px4dev <px4@purgatory.org> | 2013-01-11 02:14:43 -0800 |
commit | f127495caa2d45a1b1fff3be7a9d3756259d23e2 (patch) | |
tree | 91daf599eae326f2207d0fbd9ede34b51eca1812 /nuttx/graphics/nxsu | |
parent | 48c5d63319be3b8da7c4cd598d2a31dceae842a7 (diff) | |
download | px4-firmware-f127495caa2d45a1b1fff3be7a9d3756259d23e2.tar.gz px4-firmware-f127495caa2d45a1b1fff3be7a9d3756259d23e2.tar.bz2 px4-firmware-f127495caa2d45a1b1fff3be7a9d3756259d23e2.zip |
Manually fixup merge botches via direct comparison with NuttX r5447.
Diffstat (limited to 'nuttx/graphics/nxsu')
-rw-r--r-- | nuttx/graphics/nxsu/nx_mousein.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/nuttx/graphics/nxsu/nx_mousein.c b/nuttx/graphics/nxsu/nx_mousein.c index bee4a2265..5b268358b 100644 --- a/nuttx/graphics/nxsu/nx_mousein.c +++ b/nuttx/graphics/nxsu/nx_mousein.c @@ -62,9 +62,10 @@ * Private Data ****************************************************************************/ -static struct nxgl_point_s g_mpos; -static struct nxgl_point_s g_mrange; -static uint8_t g_mbutton; +static struct nxgl_point_s g_mpos; +static struct nxgl_point_s g_mrange; +static uint8_t g_mbutton; +static struct nxbe_window_s *g_mwnd; /**************************************************************************** * Public Data @@ -148,6 +149,7 @@ int nx_mousein(NXHANDLE handle, nxgl_coord_t x, nxgl_coord_t y, uint8_t buttons) { FAR struct nxfe_state_s *fe = (FAR struct nxfe_state_s *)handle; struct nxbe_window_s *wnd; + uint8_t oldbuttons; int ret; /* Clip x and y to within the bounding rectangle */ @@ -176,13 +178,27 @@ int nx_mousein(NXHANDLE handle, nxgl_coord_t x, nxgl_coord_t y, uint8_t buttons) { /* Update the mouse value */ + oldbuttons = g_mbutton; g_mpos.x = x; g_mpos.y = y; g_mbutton = buttons; - /* Pick the window to receive the mouse event. Start with - * the top window and go down. Step with the first window - * that gets the mouse report + /* 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. + */ + + if (oldbuttons && g_mwnd && g_mwnd->cb->mousein) + { + struct nxgl_point_s relpos; + nxgl_vectsubtract(&relpos, &g_mpos, &g_mwnd->bounds.pt1); + g_mwnd->cb->mousein((NXWINDOW)g_mwnd, &relpos, g_mbutton, g_mwnd->arg); + return OK; + } + + /* Pick the window to receive the mouse event. Start with the top + * window and go down. Step with the first window that gets the mouse + * report */ for (wnd = fe->be.topwnd; wnd; wnd = wnd->below) @@ -193,6 +209,8 @@ int nx_mousein(NXHANDLE handle, nxgl_coord_t x, nxgl_coord_t y, uint8_t buttons) break; } } + + g_mwnd = wnd; } return OK; } |