summaryrefslogtreecommitdiffstats
path: root/nuttx
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-05-13 23:40:23 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2012-05-13 23:40:23 +0000
commit88aa3828e0375f9784ac44c1578e11b3f38b6995 (patch)
treec170fb1e435a18d12ca9a86adf233074863b4546 /nuttx
parent15d911b6f5c08f139653fd6cfa5e4b67632f4c1a (diff)
Disabled NXTK autoraise; it does not work properly in multi-user mode due to queue mouse/touchscreen input
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4732 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx')
-rw-r--r--nuttx/ChangeLog8
-rw-r--r--nuttx/graphics/nxbe/nxbe_lower.c2
-rw-r--r--nuttx/graphics/nxbe/nxbe_raise.c2
-rw-r--r--nuttx/graphics/nxmu/nx_openwindow.c9
-rw-r--r--nuttx/graphics/nxtk/nxtk_events.c33
-rw-r--r--nuttx/graphics/nxtk/nxtk_openwindow.c7
6 files changed, 41 insertions, 20 deletions
diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog
index 54b2577855..f3bed6a848 100644
--- a/nuttx/ChangeLog
+++ b/nuttx/ChangeLog
@@ -2750,3 +2750,11 @@
when if positional data is valid. When the touch is released, the X/Y position
of the release must be the same as the X/Y position of the last touch (se that
the release occurs in the same window as the last touch).
+ * graphics/nxtk/nxtk_events.c: Fix an error in mouse/touchscreen input logic:
+ Was autoraising the window AFTER processing the mouse press. This raises havoc
+ if the result of processing the mouse click was to raise some other window!
+ * graphics/nxtk/nxtk_events.c: I had to disable the whole autoraise feature
+ for multi-user case because it does not work correctly. In a scenario where (1) there
+ are multiple queued touchscreen events for the same window and (2) the result of the
+ first input was to switch windows, then the autoraise implementation will cause the
+ window to revert to the previous window. Not good behavior.
diff --git a/nuttx/graphics/nxbe/nxbe_lower.c b/nuttx/graphics/nxbe/nxbe_lower.c
index 0cfcb8f7a1..545342d5bf 100644
--- a/nuttx/graphics/nxbe/nxbe_lower.c
+++ b/nuttx/graphics/nxbe/nxbe_lower.c
@@ -2,7 +2,7 @@
* graphics/nxbe/nxbe_lower.c
*
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/nuttx/graphics/nxbe/nxbe_raise.c b/nuttx/graphics/nxbe/nxbe_raise.c
index 7dc2113fdf..ef4c392c03 100644
--- a/nuttx/graphics/nxbe/nxbe_raise.c
+++ b/nuttx/graphics/nxbe/nxbe_raise.c
@@ -2,7 +2,7 @@
* graphics/nxbe/nxbe_raise.c
*
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/nuttx/graphics/nxmu/nx_openwindow.c b/nuttx/graphics/nxmu/nx_openwindow.c
index 504d421a35..2975e365a1 100644
--- a/nuttx/graphics/nxmu/nx_openwindow.c
+++ b/nuttx/graphics/nxmu/nx_openwindow.c
@@ -1,8 +1,8 @@
/****************************************************************************
* graphics/nxmu/nx_openwindow.c
*
- * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -39,11 +39,12 @@
#include <nuttx/config.h>
-#include <stdlib.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/nx/nx.h>
+#include <nuttx/kmalloc.h>
+
#include "nxfe.h"
/****************************************************************************
@@ -103,7 +104,7 @@ NXWINDOW nx_openwindow(NXHANDLE handle, FAR const struct nx_callback_s *cb,
/* Pre-allocate the window structure */
- wnd = (FAR struct nxbe_window_s *)zalloc(sizeof(struct nxbe_window_s));
+ wnd = (FAR struct nxbe_window_s *)kzalloc(sizeof(struct nxbe_window_s));
if (!wnd)
{
errno = ENOMEM;
diff --git a/nuttx/graphics/nxtk/nxtk_events.c b/nuttx/graphics/nxtk/nxtk_events.c
index 636fd96ef0..33c50b7f90 100644
--- a/nuttx/graphics/nxtk/nxtk_events.c
+++ b/nuttx/graphics/nxtk/nxtk_events.c
@@ -220,6 +220,28 @@ static void nxtk_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos,
struct nxgl_point_s abspos;
struct nxgl_point_s relpos;
+ /* Raise the window to the top if any mouse button was pressed or if auto-raise
+ * is configured. Do this before reporting the mouse event (because processing
+ * of the mouse event could change the ordering again).
+ */
+
+ /* REVISIT: This does not work correctly. In a scenario where (1) there are
+ * multiple queued touchscreen events and (2) the result of the first input
+ * was to switch windows, then this autoraise implementation will cause the
+ * window to revert to the previous window. Not good behavior.
+ */
+
+#ifndef CONFIG_NX_MULTIUSER /* Queuing only happens in multi-user mode */
+#ifdef CONFIG_NXTK_AUTORAISE
+ if (fwnd->wnd.above != NULL)
+#else
+ if (buttons != 0 && fwnd->wnd.above != NULL)
+#endif
+ {
+ nx_raise((NXWINDOW)&fwnd->wnd);
+ }
+#endif
+
/* When we get here, the mouse position that we receive has already been
* offset by the window origin. Here we need to detect mouse events in
* the various regions of the windows: The toolbar, the client window,
@@ -248,17 +270,6 @@ static void nxtk_mousein(NXWINDOW hwnd, FAR const struct nxgl_point_s *pos,
nxgl_vectsubtract(&relpos, &abspos, &fwnd->tbrect.pt1);
fwnd->tbcb->mousein((NXTKWINDOW)fwnd, &relpos, buttons, fwnd->tbarg);
}
-
- /* Raise the window to the top if any mouse button was pressed or if auto-raise
- * is configured.
- */
-
-#ifndef CONFIG_NXTK_AUTORAISE
- if (buttons != 0)
-#endif
- {
- nx_raise((NXWINDOW)&fwnd->wnd);
- }
}
#endif
diff --git a/nuttx/graphics/nxtk/nxtk_openwindow.c b/nuttx/graphics/nxtk/nxtk_openwindow.c
index 4080b0e7ab..0c77a68777 100644
--- a/nuttx/graphics/nxtk/nxtk_openwindow.c
+++ b/nuttx/graphics/nxtk/nxtk_openwindow.c
@@ -1,8 +1,8 @@
/****************************************************************************
* graphics/nxtk/nxtk_openwindow.c
*
- * Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
- * Author: Gregory Nutt <spudmonkey@racsa.co.cr>
+ * Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved.
+ * Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -44,6 +44,7 @@
#include <debug.h>
#include <nuttx/nx/nx.h>
+#include <nuttx/kmalloc.h>
#include "nxfe.h"
#include "nxtk_internal.h"
@@ -130,7 +131,7 @@ NXTKWINDOW nxtk_openwindow(NXHANDLE handle,
/* Pre-allocate the window structure */
- fwnd = (FAR struct nxtk_framedwindow_s *)zalloc(sizeof(struct nxtk_framedwindow_s));
+ fwnd = (FAR struct nxtk_framedwindow_s *)kzalloc(sizeof(struct nxtk_framedwindow_s));
if (!fwnd)
{
errno = ENOMEM;