From 91e38a73cd93af894ecaf44476ae8e6313670cb5 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 15 May 2012 16:40:43 +0000 Subject: NxWidgets: New pre-release event. Action now raised on pre-release. NxWM: Use action event to process icon touches; Fix initialization of image highlighted state. git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4740 42af7a65-404d-4744-a932-0658087f49c3 --- NxWidgets/libnxwidgets/include/cbutton.hxx | 11 +++++++- NxWidgets/libnxwidgets/include/cbuttonarray.hxx | 11 +++++++- NxWidgets/libnxwidgets/include/cimage.hxx | 15 ++++++++--- NxWidgets/libnxwidgets/include/cnxwidget.hxx | 17 ++++++++++--- .../libnxwidgets/include/crlepalettebitmap.hxx | 2 +- .../libnxwidgets/include/cwidgeteventhandler.hxx | 2 +- NxWidgets/libnxwidgets/src/cbitmap.cxx | 2 +- NxWidgets/libnxwidgets/src/cbutton.cxx | 15 +++++++++-- NxWidgets/libnxwidgets/src/cbuttonarray.cxx | 14 +++++++++-- NxWidgets/libnxwidgets/src/cimage.cxx | 29 ++++++++++++++++------ NxWidgets/libnxwidgets/src/cnxwidget.cxx | 21 ++++++++++++++-- NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx | 2 +- NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx | 2 +- .../libnxwidgets/src/cwidgeteventhandlerlist.cxx | 2 +- NxWidgets/nxwm/include/capplicationwindow.hxx | 4 +-- NxWidgets/nxwm/include/cstartwindow.hxx | 4 +-- NxWidgets/nxwm/include/ctaskbar.hxx | 4 +-- NxWidgets/nxwm/src/capplicationwindow.cxx | 4 +-- NxWidgets/nxwm/src/cstartwindow.cxx | 8 +++--- NxWidgets/nxwm/src/ctaskbar.cxx | 6 ++--- nuttx/TODO | 25 +++++++++++++++++-- 21 files changed, 156 insertions(+), 44 deletions(-) diff --git a/NxWidgets/libnxwidgets/include/cbutton.hxx b/NxWidgets/libnxwidgets/include/cbutton.hxx index 4af39f0ef..45481387f 100644 --- a/NxWidgets/libnxwidgets/include/cbutton.hxx +++ b/NxWidgets/libnxwidgets/include/cbutton.hxx @@ -179,7 +179,16 @@ namespace NXWidgets virtual void onClick(nxgl_coord_t x, nxgl_coord_t y); /** - * Raises an action event and redraws the button. + * Raises an action. + * + * @param x The x coordinate of the mouse. + * @param y The y coordinate of the mouse. + */ + + virtual void onPreRelease(nxgl_coord_t x, nxgl_coord_t y); + + /** + * Redraws the button. * * @param x The x coordinate of the mouse. * @param y The y coordinate of the mouse. diff --git a/NxWidgets/libnxwidgets/include/cbuttonarray.hxx b/NxWidgets/libnxwidgets/include/cbuttonarray.hxx index 487a6cb9f..435fa1080 100644 --- a/NxWidgets/libnxwidgets/include/cbuttonarray.hxx +++ b/NxWidgets/libnxwidgets/include/cbuttonarray.hxx @@ -133,7 +133,16 @@ namespace NXWidgets virtual void onClick(nxgl_coord_t x, nxgl_coord_t y); /** - * Raises an action event and redraws the button. + * Raises an action. + * + * @param x The x coordinate of the mouse. + * @param y The y coordinate of the mouse. + */ + + virtual void onPreRelease(nxgl_coord_t x, nxgl_coord_t y); + + /** + * Redraws the button. * * @param x The x coordinate of the mouse. * @param y The y coordinate of the mouse. diff --git a/NxWidgets/libnxwidgets/include/cimage.hxx b/NxWidgets/libnxwidgets/include/cimage.hxx index 0b7be14f2..0fe275624 100644 --- a/NxWidgets/libnxwidgets/include/cimage.hxx +++ b/NxWidgets/libnxwidgets/include/cimage.hxx @@ -143,16 +143,25 @@ namespace NXWidgets virtual void onClick(nxgl_coord_t x, nxgl_coord_t y); /** - * Raises an action event and redraws the button. + * Raises an action. * * @param x The x coordinate of the mouse. * @param y The y coordinate of the mouse. */ - virtual void onRelease(nxgl_coord_t x, nxgl_coord_t y); + virtual void onPreRelease(nxgl_coord_t x, nxgl_coord_t y); /** - * Redraws the button. + * Redraws the image. + * + * @param x The x coordinate of the mouse. + * @param y The y coordinate of the mouse. + */ + + virtual void onRelease(nxgl_coord_t x, nxgl_coord_t y); + + /** + * Redraws the image. * * @param x The x coordinate of the mouse. * @param y The y coordinate of the mouse. diff --git a/NxWidgets/libnxwidgets/include/cnxwidget.hxx b/NxWidgets/libnxwidgets/include/cnxwidget.hxx index 38a66d155..2ca055c1c 100644 --- a/NxWidgets/libnxwidgets/include/cnxwidget.hxx +++ b/NxWidgets/libnxwidgets/include/cnxwidget.hxx @@ -296,9 +296,20 @@ namespace NXWidgets virtual inline void onDoubleClick(nxgl_coord_t x, nxgl_coord_t y) { } /** - * Called when the widget is released. Override this when - * creating new widgets if the widget should exhibit additional - * behaviour when it is released. + * Called just before the widget is released; the widget will be in the + * clicked stated. Override this when creating new widgets if the + * widget should exhibit additional behaviour when it is released. + * + * @param x The x coordinate of the mouse when released. + * @param y The y coordinate of the mouse when released. + */ + + virtual inline void onPreRelease(nxgl_coord_t x, nxgl_coord_t y) { } + + /** + * Called just after the widget is released; the widget will be in the + * released stated. Override this when creating new widgets if the + * widget should exhibit additional behaviour when it is released. * * @param x The x coordinate of the mouse when released. * @param y The y coordinate of the mouse when released. diff --git a/NxWidgets/libnxwidgets/include/crlepalettebitmap.hxx b/NxWidgets/libnxwidgets/include/crlepalettebitmap.hxx index 451b472f4..dd869c476 100644 --- a/NxWidgets/libnxwidgets/include/crlepalettebitmap.hxx +++ b/NxWidgets/libnxwidgets/include/crlepalettebitmap.hxx @@ -40,7 +40,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include #include diff --git a/NxWidgets/libnxwidgets/include/cwidgeteventhandler.hxx b/NxWidgets/libnxwidgets/include/cwidgeteventhandler.hxx index d176d8822..8883fa12d 100644 --- a/NxWidgets/libnxwidgets/include/cwidgeteventhandler.hxx +++ b/NxWidgets/libnxwidgets/include/cwidgeteventhandler.hxx @@ -270,7 +270,7 @@ namespace NXWidgets virtual void handleDoubleClickEvent(const CWidgetEventArgs &e) { } /** - * Handle a widget action event. + * Handle a widget action event. For CImage, this is a mouse button pre-release event. * * @param e The event data. */ diff --git a/NxWidgets/libnxwidgets/src/cbitmap.cxx b/NxWidgets/libnxwidgets/src/cbitmap.cxx index 875e6daaa..c9c974814 100644 --- a/NxWidgets/libnxwidgets/src/cbitmap.cxx +++ b/NxWidgets/libnxwidgets/src/cbitmap.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include #include diff --git a/NxWidgets/libnxwidgets/src/cbutton.cxx b/NxWidgets/libnxwidgets/src/cbutton.cxx index 66ad3f2c7..429905759 100644 --- a/NxWidgets/libnxwidgets/src/cbutton.cxx +++ b/NxWidgets/libnxwidgets/src/cbutton.cxx @@ -275,15 +275,26 @@ void CButton::onClick(nxgl_coord_t x, nxgl_coord_t y) } /** - * Raises an action event and redraws the button. + * Raises an action. * * @param x The x coordinate of the mouse. * @param y The y coordinate of the mouse. */ -void CButton::onRelease(nxgl_coord_t x, nxgl_coord_t y) +void CButton::onPreRelease(nxgl_coord_t x, nxgl_coord_t y) { m_widgetEventHandlers->raiseActionEvent(); +} + +/** + * Redraws the button. + * + * @param x The x coordinate of the mouse. + * @param y The y coordinate of the mouse. + */ + +void CButton::onRelease(nxgl_coord_t x, nxgl_coord_t y) +{ redraw(); } diff --git a/NxWidgets/libnxwidgets/src/cbuttonarray.cxx b/NxWidgets/libnxwidgets/src/cbuttonarray.cxx index 263a16ce4..642a0a562 100644 --- a/NxWidgets/libnxwidgets/src/cbuttonarray.cxx +++ b/NxWidgets/libnxwidgets/src/cbuttonarray.cxx @@ -546,16 +546,26 @@ void CButtonArray::onClick(nxgl_coord_t x, nxgl_coord_t y) } /** - * Raises an action event and redraws the button. + * Raises an action. * * @param x The x coordinate of the mouse. * @param y The y coordinate of the mouse. */ -void CButtonArray::onRelease(nxgl_coord_t x, nxgl_coord_t y) +void CButtonArray::onPreRelease(nxgl_coord_t x, nxgl_coord_t y) { m_widgetEventHandlers->raiseActionEvent(); +} +/** + * Redraws the button. + * + * @param x The x coordinate of the mouse. + * @param y The y coordinate of the mouse. + */ + +void CButtonArray::onRelease(nxgl_coord_t x, nxgl_coord_t y) +{ // Redraw only the button that was released m_redrawButton = true; diff --git a/NxWidgets/libnxwidgets/src/cimage.cxx b/NxWidgets/libnxwidgets/src/cimage.cxx index 7d9e0ee4e..30bf7e78b 100644 --- a/NxWidgets/libnxwidgets/src/cimage.cxx +++ b/NxWidgets/libnxwidgets/src/cimage.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include #include @@ -116,12 +116,16 @@ CImage::CImage(CWidgetControl *pWidgetControl, nxgl_coord_t x, nxgl_coord_t y, { // Save the IBitmap instance - m_bitmap = bitmap; + m_bitmap = bitmap; + + // Not highlighted + + m_highlighted = false; // Position the top/lef corner of the bitmap in the top/left corner of the display - m_origin.x = 0; - m_origin.y = 0; + m_origin.x = 0; + m_origin.y = 0; } /** @@ -385,20 +389,31 @@ void CImage::onClick(nxgl_coord_t x, nxgl_coord_t y) } /** - * Raises an action event and redraws the button. + * Raises an action. * * @param x The x coordinate of the mouse. * @param y The y coordinate of the mouse. */ -void CImage::onRelease(nxgl_coord_t x, nxgl_coord_t y) +void CImage::onPreRelease(nxgl_coord_t x, nxgl_coord_t y) { m_widgetEventHandlers->raiseActionEvent(); +} + +/** + * Redraws the image. + * + * @param x The x coordinate of the mouse. + * @param y The y coordinate of the mouse. + */ + +void CImage::onRelease(nxgl_coord_t x, nxgl_coord_t y) +{ redraw(); } /** - * Redraws the button. + * Redraws the image. * * @param x The x coordinate of the mouse. * @param y The y coordinate of the mouse. diff --git a/NxWidgets/libnxwidgets/src/cnxwidget.cxx b/NxWidgets/libnxwidgets/src/cnxwidget.cxx index 66766dca6..ab4a09b4e 100644 --- a/NxWidgets/libnxwidgets/src/cnxwidget.cxx +++ b/NxWidgets/libnxwidgets/src/cnxwidget.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include #include @@ -772,6 +772,17 @@ bool CNxWidget::release(nxgl_coord_t x, nxgl_coord_t y) return false; } + // Notify of the pre-release event. In this event, the widget is still in the + // clicked state. This event is used, for example, by button handlers so + // that the click event is really processed when the button is released + // instead of pressed. The former behavior is needed because the result + // of processing the press may obscure the button and make it impossible + // to receive the release event. + + onPreRelease(x, y); + + // Now mark the widget as NOT clicked and stop draggin actions. + m_flags.clicked = false; stopDragging(x, y); @@ -784,6 +795,9 @@ bool CNxWidget::release(nxgl_coord_t x, nxgl_coord_t y) if (checkCollision(x, y)) { + // Notify of the release event... the widget was NOT dragged outside of + // its original bounding box + onRelease(x, y); // Release occurred within widget; raise release @@ -792,9 +806,12 @@ bool CNxWidget::release(nxgl_coord_t x, nxgl_coord_t y) } else { + // Notify of the release event... the widget WAS dragged outside of + // its original bounding box + onReleaseOutside(x, y); - // Release occurred outside widget; raise release + // Release occurred outside widget; raise release outside event m_widgetEventHandlers->raiseReleaseOutsideEvent(x, y); } diff --git a/NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx b/NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx index 4c781e2c9..99f7fdbba 100644 --- a/NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx +++ b/NxWidgets/libnxwidgets/src/crlepalettebitmap.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include #include diff --git a/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx b/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx index 5ecd8ab22..286c9c46a 100644 --- a/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx +++ b/NxWidgets/libnxwidgets/src/cwidgetcontrol.cxx @@ -36,7 +36,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include #include diff --git a/NxWidgets/libnxwidgets/src/cwidgeteventhandlerlist.cxx b/NxWidgets/libnxwidgets/src/cwidgeteventhandlerlist.cxx index 68230e17a..91722725a 100644 --- a/NxWidgets/libnxwidgets/src/cwidgeteventhandlerlist.cxx +++ b/NxWidgets/libnxwidgets/src/cwidgeteventhandlerlist.cxx @@ -70,7 +70,7 @@ /**************************************************************************** * Included Files ****************************************************************************/ - + #include #include diff --git a/NxWidgets/nxwm/include/capplicationwindow.hxx b/NxWidgets/nxwm/include/capplicationwindow.hxx index 1a3d7eb48..8eda8d28a 100644 --- a/NxWidgets/nxwm/include/capplicationwindow.hxx +++ b/NxWidgets/nxwm/include/capplicationwindow.hxx @@ -96,12 +96,12 @@ namespace NxWM uint8_t m_flags; /**< Window flags */ /** - * Handle a mouse button click event. + * Handle a widget action event. For CImage, this is a mouse button pre-release event. * * @param e The event data. */ - void handleClickEvent(const NXWidgets::CWidgetEventArgs &e); + void handleActionEvent(const NXWidgets::CWidgetEventArgs &e); public: diff --git a/NxWidgets/nxwm/include/cstartwindow.hxx b/NxWidgets/nxwm/include/cstartwindow.hxx index 5a5ea12f4..d0ae5ec84 100644 --- a/NxWidgets/nxwm/include/cstartwindow.hxx +++ b/NxWidgets/nxwm/include/cstartwindow.hxx @@ -110,12 +110,12 @@ namespace NxWM void stopAllApplications(void); /** - * Handle a mouse button click event. + * Handle a widget action event. For CImage, this is a mouse button pre-release event. * * @param e The event data. */ - void handleClickEvent(const NXWidgets::CWidgetEventArgs &e); + void handleActionEvent(const NXWidgets::CWidgetEventArgs &e); public: diff --git a/NxWidgets/nxwm/include/ctaskbar.hxx b/NxWidgets/nxwm/include/ctaskbar.hxx index 35a291aef..cf98d10d9 100644 --- a/NxWidgets/nxwm/include/ctaskbar.hxx +++ b/NxWidgets/nxwm/include/ctaskbar.hxx @@ -209,12 +209,12 @@ namespace NxWM void hideApplicationWindow(IApplication *app); /** - * Handle a mouse button click event. + * Handle a widget action event. For CImage, this is a mouse button pre-release event. * * @param e The event data. */ - void handleClickEvent(const NXWidgets::CWidgetEventArgs &e); + void handleActionEvent(const NXWidgets::CWidgetEventArgs &e); public: /** diff --git a/NxWidgets/nxwm/src/capplicationwindow.cxx b/NxWidgets/nxwm/src/capplicationwindow.cxx index 320559ef7..df8c69f11 100644 --- a/NxWidgets/nxwm/src/capplicationwindow.cxx +++ b/NxWidgets/nxwm/src/capplicationwindow.cxx @@ -498,12 +498,12 @@ void CApplicationWindow::clickStopIcon(int index) #endif /** - * Handle a mouse button click event. + * Handle a widget action event. For CImage, this is a mouse button pre-release event. * * @param e The event data. */ -void CApplicationWindow::handleClickEvent(const NXWidgets::CWidgetEventArgs &e) +void CApplicationWindow::handleActionEvent(const NXWidgets::CWidgetEventArgs &e) { // Ignore the event if no callback is registered diff --git a/NxWidgets/nxwm/src/cstartwindow.cxx b/NxWidgets/nxwm/src/cstartwindow.cxx index ceeff0d7b..de35662d5 100644 --- a/NxWidgets/nxwm/src/cstartwindow.cxx +++ b/NxWidgets/nxwm/src/cstartwindow.cxx @@ -36,7 +36,7 @@ /******************************************************************************************** * Included Files ********************************************************************************************/ - + #include #include "cwidgetcontrol.hxx" @@ -443,14 +443,14 @@ void CStartWindow::stopAllApplications(void) } /** - * Handle a mouse button click event. + * Handle a widget action event. For CImage, this is a mouse button pre-release event. * * @param e The event data. */ -void CStartWindow::handleClickEvent(const NXWidgets::CWidgetEventArgs &e) +void CStartWindow::handleActionEvent(const NXWidgets::CWidgetEventArgs &e) { - // icon was clicked? + // Was an ICON clicked? for (int i = 0; i < m_slots.size(); i++) { diff --git a/NxWidgets/nxwm/src/ctaskbar.cxx b/NxWidgets/nxwm/src/ctaskbar.cxx index b15916b0a..ec3d8460b 100644 --- a/NxWidgets/nxwm/src/ctaskbar.cxx +++ b/NxWidgets/nxwm/src/ctaskbar.cxx @@ -1277,14 +1277,14 @@ void CTaskbar::hideApplicationWindow(IApplication *app) } /** - * Handle a mouse button click event. + * Handle a widget action event. For CImage, this is a mouse button pre-release event. * * @param e The event data. */ -void CTaskbar::handleClickEvent(const NXWidgets::CWidgetEventArgs &e) +void CTaskbar::handleActionEvent(const NXWidgets::CWidgetEventArgs &e) { - // icon was clicked? + // Was a n ICON clicked? for (int i = 0; i < m_slots.size(); i++) { diff --git a/nuttx/TODO b/nuttx/TODO index 10908ac43..d1d9df3fa 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -1,4 +1,4 @@ -NuttX TODO List (Last updated April 12, 2012) +NuttX TODO List (Last updated May 15, 2012) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This file summarizes known NuttX bugs, limitations, inconsistencies with @@ -17,7 +17,7 @@ nuttx/ (3) USB (drivers/usbdev, drivers/usbhost) (8) Libraries (lib/) (10) File system/Generic drivers (fs/, drivers/) - (1) Graphics subystem (graphics/) + (4) Graphics subystem (graphics/) (1) Pascal add-on (pcode/) (1) Documentation (Documentation/) (7) Build system / Toolchains @@ -774,6 +774,27 @@ o Graphics subystem (graphics/) in the current structure. Priority: Low. + Title: RAW WINDOW AUTORAISE + Description: Auto-raise only applies to NXTK windows. Shouldn't it also apply + to raw windows as well? + Status: Open + Priority: Low + + Title: AUTO-RAISE DISABLED + Descption: Auto-raise is currently disabled in NX multi-server mode. The + reason is complex: + - Most touchscreen controls send touch data a high rates + - In multi-server mode, touch events get queued in a message + queue. + - The logic that receives the messages performs the auto-raise. + But it can do stupid things after the first auto-raise as + it opperates on the stale data in the message queue. + I am thinking that auto-raise ought to be removed from NuttX + and moved out into a graphics layer (like NxWM) that knows + more about the appropriate context to do the autoraise. + Status: Open + Proiority: Medium low + o Pascal Add-On (pcode/) ^^^^^^^^^^^^^^^^^^^^^^ -- cgit v1.2.3