diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-12 16:59:57 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-12 16:59:57 +0000 |
commit | a9990e4f81cbd4e9201e60e9123b3caeb5ecb35b (patch) | |
tree | e1b475a8402986605c60b204f160ffeda35e9c26 /NxWidgets/nxwm | |
parent | fb8f25a3f43d6c5a10dfa5a99b9cec55feec97f6 (diff) | |
download | px4-nuttx-a9990e4f81cbd4e9201e60e9123b3caeb5ecb35b.tar.gz px4-nuttx-a9990e4f81cbd4e9201e60e9123b3caeb5ecb35b.tar.bz2 px4-nuttx-a9990e4f81cbd4e9201e60e9123b3caeb5ecb35b.zip |
NxWM: Correct the calculation of the physical dispaly size
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4726 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'NxWidgets/nxwm')
-rw-r--r-- | NxWidgets/nxwm/include/ctaskbar.hxx | 5 | ||||
-rw-r--r-- | NxWidgets/nxwm/src/ctaskbar.cxx | 74 |
2 files changed, 46 insertions, 33 deletions
diff --git a/NxWidgets/nxwm/include/ctaskbar.hxx b/NxWidgets/nxwm/include/ctaskbar.hxx index 1f2f69580..431c2be48 100644 --- a/NxWidgets/nxwm/include/ctaskbar.hxx +++ b/NxWidgets/nxwm/include/ctaskbar.hxx @@ -393,10 +393,7 @@ namespace NxWM * @return The size of the display */ - inline bool getWindowSize(FAR struct nxgl_size_s *size) - { - return m_taskbar->getSize(size); - } + void getDisplaySize(FAR struct nxgl_size_s &size); /** * Simulate a mouse click on the icon at index. This inline method is only diff --git a/NxWidgets/nxwm/src/ctaskbar.cxx b/NxWidgets/nxwm/src/ctaskbar.cxx index a840fdcb2..87fa34c3d 100644 --- a/NxWidgets/nxwm/src/ctaskbar.cxx +++ b/NxWidgets/nxwm/src/ctaskbar.cxx @@ -549,6 +549,29 @@ bool CTaskbar::stopApplication(IApplication *app) } /** + * Get the size of the physical display device as it is known to the task + * bar. + * + * @return The size of the display + */ + +void CTaskbar::getDisplaySize(FAR struct nxgl_size_s &size) +{ + // Get the widget control from the task bar window. The physical window geometry + // should be the same for all windows. + + NXWidgets::CWidgetControl *control = m_taskbar->getWidgetControl(); + + // Get the window bounding box from the widget control + + NXWidgets::CRect rect = control->getWindowBoundingBox(); + + // And return the size of the window + + rect.getSize(size); +} + +/** * Create a raw window. * * 1) Create a dumb CWigetControl instance @@ -638,14 +661,10 @@ NXWidgets::CNxTkWindow *CTaskbar::openFramedWindow(void) void CTaskbar::setApplicationGeometry(NXWidgets::INxWindow *window, bool fullscreen) { - // Get the widget control from the task bar window. The physical window geometry - // should be the same for all windows. - - NXWidgets::CWidgetControl *control = m_taskbar->getWidgetControl(); + // Get the physical size of the display - // Get the size of the window from the widget control - - NXWidgets::CRect rect = control->getWindowBoundingBox(); + struct nxgl_size_s displaySize; + getDisplaySize(displaySize); // Now position and size the application. This will depend on the position and // orientation of the task bar. @@ -660,8 +679,8 @@ void CTaskbar::setApplicationGeometry(NXWidgets::INxWindow *window, bool fullscr pos.x = 0; pos.y = 0; - size.w = rect.getWidth(); - size.h = rect.getHeight(); + size.w = displaySize.w; + size.h = displaySize.h; } else { @@ -669,26 +688,26 @@ void CTaskbar::setApplicationGeometry(NXWidgets::INxWindow *window, bool fullscr pos.x = 0; pos.y = CONFIG_NXWM_TASKBAR_WIDTH; - size.w = rect.getWidth(); - size.h = rect.getHeight() - CONFIG_NXWM_TASKBAR_WIDTH; + size.w = displaySize.w; + size.h = displaySize.h - CONFIG_NXWM_TASKBAR_WIDTH; #elif defined(CONFIG_NXWM_TASKBAR_BOTTOM) pos.x = 0; pos.y = 0; - size.w = rect.getWidth(); - size.h = rect.getHeight() - CONFIG_NXWM_TASKBAR_WIDTH; + size.w = displaySize.w; + size.h = displaySize.h - CONFIG_NXWM_TASKBAR_WIDTH; #elif defined(CONFIG_NXWM_TASKBAR_LEFT) pos.x = CONFIG_NXWM_TASKBAR_WIDTH; pos.y = 0; - size.w = rect.getWidth() - CONFIG_NXWM_TASKBAR_WIDTH; - size.h = rect.getHeight(); + size.w = displaySize.w - CONFIG_NXWM_TASKBAR_WIDTH; + size.h = displaySize.h; #else pos.x = 0; pos.y = 0; - size.w = rect.getWidth() - CONFIG_NXWM_TASKBAR_WIDTH; - size.h = rect.getHeight(); + size.w = displaySize.w - CONFIG_NXWM_TASKBAR_WIDTH; + size.h = displaySize.h; #endif } @@ -718,13 +737,10 @@ bool CTaskbar::createTaskbarWindow(void) return false; } - // Get the contained widget control - - NXWidgets::CWidgetControl *control = m_taskbar->getWidgetControl(); - - // Get the size of the window from the widget control + // Get the size of the physical display - NXWidgets::CRect rect = control->getWindowBoundingBox(); + struct nxgl_size_s displaySize; + getDisplaySize(displaySize); // Now position and size the task bar. This will depend on the position and // orientation of the task bar. @@ -736,26 +752,26 @@ bool CTaskbar::createTaskbarWindow(void) pos.x = 0; pos.y = 0; - size.w = rect.getWidth(); + size.w = displaySize.w; size.h = CONFIG_NXWM_TASKBAR_WIDTH; #elif defined(CONFIG_NXWM_TASKBAR_BOTTOM) pos.x = 0; - pos.y = rect.getHeight() - CONFIG_NXWM_TASKBAR_WIDTH; + pos.y = displaySize.h - CONFIG_NXWM_TASKBAR_WIDTH; - size.w = rect.getWidth(); + size.w = displaySize.w; size.h = CONFIG_NXWM_TASKBAR_WIDTH; #elif defined(CONFIG_NXWM_TASKBAR_LEFT) pos.x = 0; pos.y = 0; size.w = CONFIG_NXWM_TASKBAR_WIDTH; - size.h = rect.getHeight(); + size.h = displaySize.h; #else pos.x = rect.getWidgth() - CONFIG_NXWM_TASKBAR_WIDTH; pos.y = 0; size.w = CONFIG_NXWM_TASKBAR_WIDTH; - size.h = rect.getHeight(); + size.h = displaySize.h; #endif /* Set the size and position the window. @@ -940,7 +956,7 @@ bool CTaskbar::redrawTaskbarWindow(void) struct nxgl_point_s iconPos; #if defined(CONFIG_NXWM_TASKBAR_TOP) || defined(CONFIG_NXWM_TASKBAR_BOTTOM) - // For horizontal task bars, the icons will be aligned at the top of + // For horizontal task bars, the icons will be aligned along the top of // the task bar iconPos.x = taskbarPos.x; |