diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-13 23:40:23 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-13 23:40:23 +0000 |
commit | c39c92fb6b3803270215d5552acf6ac6d23a31f8 (patch) | |
tree | c170fb1e435a18d12ca9a86adf233074863b4546 | |
parent | 21115c210a35c6f320a43d67fdd662639534eb2e (diff) | |
download | px4-nuttx-c39c92fb6b3803270215d5552acf6ac6d23a31f8.tar.gz px4-nuttx-c39c92fb6b3803270215d5552acf6ac6d23a31f8.tar.bz2 px4-nuttx-c39c92fb6b3803270215d5552acf6ac6d23a31f8.zip |
Disabled NXTK autoraise; it does not work properly in multi-user mode due to queue mouse/touchscreen input
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4732 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r-- | NxWidgets/libnxwidgets/include/cnxwidget.hxx | 92 | ||||
-rw-r--r-- | NxWidgets/libnxwidgets/include/cwidgeteventhandlerlist.hxx | 6 | ||||
-rw-r--r-- | NxWidgets/libnxwidgets/src/cnxwidget.cxx | 18 | ||||
-rw-r--r-- | NxWidgets/libnxwidgets/src/cwidgeteventhandlerlist.cxx | 2 | ||||
-rw-r--r-- | NxWidgets/nxwm/src/ctaskbar.cxx | 2 | ||||
-rw-r--r-- | nuttx/ChangeLog | 8 | ||||
-rw-r--r-- | nuttx/graphics/nxbe/nxbe_lower.c | 2 | ||||
-rw-r--r-- | nuttx/graphics/nxbe/nxbe_raise.c | 2 | ||||
-rw-r--r-- | nuttx/graphics/nxmu/nx_openwindow.c | 9 | ||||
-rw-r--r-- | nuttx/graphics/nxtk/nxtk_events.c | 33 | ||||
-rw-r--r-- | nuttx/graphics/nxtk/nxtk_openwindow.c | 7 |
11 files changed, 101 insertions, 80 deletions
diff --git a/NxWidgets/libnxwidgets/include/cnxwidget.hxx b/NxWidgets/libnxwidgets/include/cnxwidget.hxx index 4c470cfb2..38a66d155 100644 --- a/NxWidgets/libnxwidgets/include/cnxwidget.hxx +++ b/NxWidgets/libnxwidgets/include/cnxwidget.hxx @@ -425,7 +425,7 @@ namespace NXWidgets * @return Widget space x coordinate. */ - const nxgl_coord_t getX(void) const; + nxgl_coord_t getX(void) const; /** * Get the y coordinate of the widget in "Widget space". @@ -433,7 +433,7 @@ namespace NXWidgets * @return Widget space y coordinate. */ - const nxgl_coord_t getY(void) const; + nxgl_coord_t getY(void) const; /** * Get the x coordinate of the widget relative to its parent. @@ -441,7 +441,7 @@ namespace NXWidgets * @return Parent-space x coordinate. */ - const nxgl_coord_t getRelativeX(void) const; + nxgl_coord_t getRelativeX(void) const; /** * Get the y coordinate of the widget relative to its parent. @@ -449,7 +449,7 @@ namespace NXWidgets * @return Parent-space y coordinate. */ - const nxgl_coord_t getRelativeY(void) const; + nxgl_coord_t getRelativeY(void) const; /** * Is the widget active? @@ -459,7 +459,7 @@ namespace NXWidgets * @return True if active. */ - inline const bool hasFocus(void) const + inline bool hasFocus(void) const { return m_flags.hasFocus; } @@ -475,7 +475,7 @@ namespace NXWidgets * @return True if marked for deletion. */ - const bool isDeleted(void) const; + bool isDeleted(void) const; /** * Is the widget allowed to draw? This function recurses up the widget @@ -485,7 +485,7 @@ namespace NXWidgets * @return True if drawing is enabled. */ - const bool isDrawingEnabled(void) const; + bool isDrawingEnabled(void) const; /** * Is the widget hidden? This function recurses up the widget @@ -495,7 +495,7 @@ namespace NXWidgets * @return True if hidden. */ - const bool isHidden(void) const; + bool isHidden(void) const; /** * Is the widget enabled? This function recurses up the widget @@ -505,7 +505,7 @@ namespace NXWidgets * @return True if enabled. */ - const bool isEnabled(void) const; + bool isEnabled(void) const; /** * Are the widget's edges permeable or solid? @@ -515,7 +515,7 @@ namespace NXWidgets * @return True if permeable. */ - inline const bool isPermeable(void) const + inline bool isPermeable(void) const { return m_flags.permeable; } @@ -525,7 +525,7 @@ namespace NXWidgets * @return True if the widget watches for double-clicks. */ - inline const bool isDoubleClickable(void) const + inline bool isDoubleClickable(void) const { return m_flags.doubleClickable; } @@ -536,7 +536,7 @@ namespace NXWidgets * @return True if the widget does not have a border. */ - inline const bool isBorderless(void) const + inline bool isBorderless(void) const { return m_flags.borderless; } @@ -547,7 +547,7 @@ namespace NXWidgets * @return True if the widget is currently clicked. */ - inline const bool isClicked(void) const + inline bool isClicked(void) const { return m_flags.clicked; } @@ -558,7 +558,7 @@ namespace NXWidgets * @return True if the widget is currently being dragged. */ - inline const bool isBeingDragged(void) const + inline bool isBeingDragged(void) const { return m_flags.dragging; } @@ -656,17 +656,6 @@ namespace NXWidgets } /** - * Check if this widget raises events or not. - * - * @return True if events are enabled. - */ - - inline const bool raisesEvents(void) const - { - return m_widgetEventHandlers->isEnabled(); - } - - /** * Insert the dimensions that this widget wants to have into the rect * passed in as a parameter. All coordinates are relative to the widget's * parent. @@ -714,7 +703,7 @@ namespace NXWidgets * @return Background fill color. */ - inline const nxgl_mxpixel_t getBackgroundColor(void) const + inline nxgl_mxpixel_t getBackgroundColor(void) const { return m_style.colors.background; } @@ -725,7 +714,7 @@ namespace NXWidgets * @return Dark color. */ - inline const nxgl_mxpixel_t getSelectedBackgroundColor(void) const + inline nxgl_mxpixel_t getSelectedBackgroundColor(void) const { return m_style.colors.selectedBackground; } @@ -736,7 +725,7 @@ namespace NXWidgets * @return Shine color. */ - inline const nxgl_mxpixel_t getShineEdgeColor(void) const + inline nxgl_mxpixel_t getShineEdgeColor(void) const { return m_style.colors.shineEdge; } @@ -747,7 +736,7 @@ namespace NXWidgets * @return Shadow color. */ - inline const nxgl_mxpixel_t getShadowEdgeColor(void) const + inline nxgl_mxpixel_t getShadowEdgeColor(void) const { return m_style.colors.shadowEdge; } @@ -758,7 +747,7 @@ namespace NXWidgets * @return Highlight color. */ - inline const nxgl_mxpixel_t getHighlightColor(void) const + inline nxgl_mxpixel_t getHighlightColor(void) const { return m_style.colors.highlight; } @@ -769,7 +758,7 @@ namespace NXWidgets * @return Disabled text color. */ - inline const nxgl_mxpixel_t getDisabledTextColor(void) const + inline nxgl_mxpixel_t getDisabledTextColor(void) const { return m_style.colors.disabledText; } @@ -780,7 +769,7 @@ namespace NXWidgets * @return Enabled text color. */ - inline const nxgl_mxpixel_t getEnabledTextColor(void) const + inline nxgl_mxpixel_t getEnabledTextColor(void) const { return m_style.colors.enabledText; } @@ -791,7 +780,7 @@ namespace NXWidgets * @return Selected text color. */ - inline const nxgl_mxpixel_t getSelectedTextColor(void) const + inline nxgl_mxpixel_t getSelectedTextColor(void) const { return m_style.colors.selectedText; } @@ -810,7 +799,7 @@ namespace NXWidgets * @param isDraggable The draggable state. */ - inline void setDraggable(const bool isDraggable) + inline void setDraggable(bool isDraggable) { m_flags.draggable = isDraggable; } @@ -821,7 +810,7 @@ namespace NXWidgets * @param permeable The permeable state. */ - inline void setPermeable(const bool permeable) + inline void setPermeable(bool permeable) { m_flags.permeable = permeable; } @@ -832,7 +821,7 @@ namespace NXWidgets * @param doubleClickable The double-clickable state. */ - inline void setDoubleClickable(const bool doubleClickable) + inline void setDoubleClickable(bool doubleClickable) { m_flags.doubleClickable = doubleClickable; } @@ -866,12 +855,23 @@ namespace NXWidgets * @param raises True to enable events, false to disable. */ - inline void setRaisesEvents(const bool raises) + inline void setRaisesEvents(bool raises) { raises ? m_widgetEventHandlers->enable() : m_widgetEventHandlers->disable(); } /** + * Check if event handling is enabled for this widget. + * + * @return True is event handling is enabled. + */ + + inline bool raisesEvents(void) const + { + return m_widgetEventHandlers->isEnabled(); + } + + /** * Disabled drawing of this widget. Widgets hidden using this method will still * be processed. */ @@ -896,7 +896,7 @@ namespace NXWidgets * @param color The new background color. */ - inline void setBackgroundColor(const nxgl_mxpixel_t color) + inline void setBackgroundColor(nxgl_mxpixel_t color) { m_style.colors.background = color; } @@ -907,7 +907,7 @@ namespace NXWidgets * @param color The new selected background color. */ - inline void setSelectedBackgroundColor(const nxgl_mxpixel_t color) + inline void setSelectedBackgroundColor(nxgl_mxpixel_t color) { m_style.colors.selectedBackground = color; } @@ -918,7 +918,7 @@ namespace NXWidgets * @param color The new shine edge color. */ - inline void setShineEdgeColor(const nxgl_mxpixel_t color) + inline void setShineEdgeColor(nxgl_mxpixel_t color) { m_style.colors.shineEdge = color; } @@ -929,7 +929,7 @@ namespace NXWidgets * @param color The new shadow edge color. */ - inline void setShadowEdgeColor(const nxgl_mxpixel_t color) + inline void setShadowEdgeColor(nxgl_mxpixel_t color) { m_style.colors.shadowEdge = color; } @@ -940,7 +940,7 @@ namespace NXWidgets * @param color The new highlight color. */ - inline void setHighlightColor(const nxgl_mxpixel_t color) + inline void setHighlightColor(nxgl_mxpixel_t color) { m_style.colors.highlight = color; } @@ -951,7 +951,7 @@ namespace NXWidgets * @param color The new text color. */ - inline void setDisabledTextColor(const nxgl_mxpixel_t color) + inline void setDisabledTextColor(nxgl_mxpixel_t color) { m_style.colors.disabledText = color; } @@ -962,7 +962,7 @@ namespace NXWidgets * @param color The new text color. */ - inline void setEnabledTextColor(const nxgl_mxpixel_t color) + inline void setEnabledTextColor(nxgl_mxpixel_t color) { m_style.colors.enabledText = color; } @@ -973,7 +973,7 @@ namespace NXWidgets * @param color The new selected text color. */ - inline void setSelectedTextColor(const nxgl_mxpixel_t color) + inline void setSelectedTextColor(nxgl_mxpixel_t color) { m_style.colors.selectedText = color; } @@ -1303,7 +1303,7 @@ namespace NXWidgets * @return The number of child widgets belonging to this widget. */ - const int getChildCount(void) const + int getChildCount(void) const { return m_children.size(); } diff --git a/NxWidgets/libnxwidgets/include/cwidgeteventhandlerlist.hxx b/NxWidgets/libnxwidgets/include/cwidgeteventhandlerlist.hxx index 8c9ef6738..f0a2f1d72 100644 --- a/NxWidgets/libnxwidgets/include/cwidgeteventhandlerlist.hxx +++ b/NxWidgets/libnxwidgets/include/cwidgeteventhandlerlist.hxx @@ -131,7 +131,7 @@ namespace NXWidgets * @return True if events are enabled. */ - const bool isEnabled(void) const; + bool isEnabled(void) const; /** * Get the event handler at the specified index. @@ -140,7 +140,7 @@ namespace NXWidgets * @return The event handler at the specified index. */ - inline CWidgetEventHandler *at(const int index) const + inline CWidgetEventHandler *at(int index) const { return m_widgetEventHandlers.at(index); } @@ -151,7 +151,7 @@ namespace NXWidgets * @return The size of the array. */ - inline const nxgl_coord_t size(void) const + inline nxgl_coord_t size(void) const { return m_widgetEventHandlers.size(); } diff --git a/NxWidgets/libnxwidgets/src/cnxwidget.cxx b/NxWidgets/libnxwidgets/src/cnxwidget.cxx index 97d24b73c..66766dca6 100644 --- a/NxWidgets/libnxwidgets/src/cnxwidget.cxx +++ b/NxWidgets/libnxwidgets/src/cnxwidget.cxx @@ -243,7 +243,7 @@ CNxWidget::~CNxWidget(void) * @return Widget space x coordinate. */ -const nxgl_coord_t CNxWidget::getX(void) const +nxgl_coord_t CNxWidget::getX(void) const { if (m_parent != (CNxWidget *)NULL) { @@ -259,7 +259,7 @@ const nxgl_coord_t CNxWidget::getX(void) const * @return Widget space y coordinate. */ -const nxgl_coord_t CNxWidget::getY(void) const +nxgl_coord_t CNxWidget::getY(void) const { if (m_parent != (CNxWidget *)NULL) { @@ -275,7 +275,7 @@ const nxgl_coord_t CNxWidget::getY(void) const * @return Parent-space x coordinate. */ -const nxgl_coord_t CNxWidget::getRelativeX(void) const +nxgl_coord_t CNxWidget::getRelativeX(void) const { return m_rect.getX(); } @@ -286,7 +286,7 @@ const nxgl_coord_t CNxWidget::getRelativeX(void) const * @return Parent-space y coordinate. */ -const nxgl_coord_t CNxWidget::getRelativeY(void) const +nxgl_coord_t CNxWidget::getRelativeY(void) const { return m_rect.getY(); } @@ -302,7 +302,7 @@ const nxgl_coord_t CNxWidget::getRelativeY(void) const * @return True if marked for deletion. */ -const bool CNxWidget::isDeleted(void) const +bool CNxWidget::isDeleted(void) const { if (m_parent != (CNxWidget *)NULL) { @@ -323,7 +323,7 @@ const bool CNxWidget::isDeleted(void) const * @return True if drawing is enabled. */ -const bool CNxWidget::isDrawingEnabled(void) const +bool CNxWidget::isDrawingEnabled(void) const { if (m_parent != (CNxWidget *)NULL) { @@ -350,7 +350,7 @@ const bool CNxWidget::isDrawingEnabled(void) const * @return True if hidden. */ -const bool CNxWidget::isHidden(void) const +bool CNxWidget::isHidden(void) const { if (m_parent != (CNxWidget *)NULL) { @@ -377,7 +377,7 @@ const bool CNxWidget::isHidden(void) const * @return True if enabled. */ -const bool CNxWidget::isEnabled() const +bool CNxWidget::isEnabled() const { if (m_parent != (CNxWidget *)NULL) { @@ -1385,7 +1385,7 @@ bool CNxWidget::removeChild(CNxWidget *widget) * @return Pointer to the child at the specified index. */ -const CNxWidget *CNxWidget::getChild(const int index) const +const CNxWidget *CNxWidget::getChild(int index) const { if (index < (int)m_children.size()) { diff --git a/NxWidgets/libnxwidgets/src/cwidgeteventhandlerlist.cxx b/NxWidgets/libnxwidgets/src/cwidgeteventhandlerlist.cxx index 21d21add9..68230e17a 100644 --- a/NxWidgets/libnxwidgets/src/cwidgeteventhandlerlist.cxx +++ b/NxWidgets/libnxwidgets/src/cwidgeteventhandlerlist.cxx @@ -110,7 +110,7 @@ CWidgetEventHandlerList::CWidgetEventHandlerList(CNxWidget *widget) * @return True if events are enabled. */ -const bool CWidgetEventHandlerList::isEnabled(void) const +bool CWidgetEventHandlerList::isEnabled(void) const { return m_isEnabled && !m_widget->isDeleted(); } diff --git a/NxWidgets/nxwm/src/ctaskbar.cxx b/NxWidgets/nxwm/src/ctaskbar.cxx index c6e1b574b..f5a5c08f5 100644 --- a/NxWidgets/nxwm/src/ctaskbar.cxx +++ b/NxWidgets/nxwm/src/ctaskbar.cxx @@ -499,7 +499,7 @@ bool CTaskbar::minimizeApplication(IApplication *app) if (!app->isMinimized()) { // No, then we are going to minimize it but disabling its components, - // marking it as minized, then raising a new window to the top window. + // marking it as minimized, then raising a new window to the top window. hideApplicationWindow(app); diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 54b257785..f3bed6a84 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 0cfcb8f7a..545342d5b 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 7dc2113fd..ef4c392c0 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 504d421a3..2975e365a 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 636fd96ef..33c50b7f9 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 4080b0e7a..0c77a6877 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; |