summaryrefslogtreecommitdiff
path: root/nuttx/graphics/nxtk
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-12-02 20:02:59 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-12-02 20:02:59 +0000
commitaebaefc303f12beb92c4da219411bdb00aa4e03c (patch)
tree770fd1403c0aaf22a23220a4f95f689de9f8cf70 /nuttx/graphics/nxtk
parent124c331605b174afc08f7ef498209952b4a1dbc5 (diff)
downloadpx4-nuttx-aebaefc303f12beb92c4da219411bdb00aa4e03c.tar.gz
px4-nuttx-aebaefc303f12beb92c4da219411bdb00aa4e03c.tar.bz2
px4-nuttx-aebaefc303f12beb92c4da219411bdb00aa4e03c.zip
Don't keep sizes in rectangles
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1392 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/graphics/nxtk')
-rw-r--r--nuttx/graphics/nxtk/nxtk_events.c25
-rw-r--r--nuttx/graphics/nxtk/nxtk_setsize.c10
-rw-r--r--nuttx/graphics/nxtk/nxtk_setsubwindows.c6
3 files changed, 20 insertions, 21 deletions
diff --git a/nuttx/graphics/nxtk/nxtk_events.c b/nuttx/graphics/nxtk/nxtk_events.c
index 1ecb87524..f8ec80ea0 100644
--- a/nuttx/graphics/nxtk/nxtk_events.c
+++ b/nuttx/graphics/nxtk/nxtk_events.c
@@ -63,7 +63,7 @@
static void nxtk_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
boolean morem, FAR void *arg);
-static void nxtk_position(NXWINDOW hwnd, FAR const struct nxgl_rect_s *size,
+static void nxtk_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size,
FAR const struct nxgl_point_s *pos,
FAR const struct nxgl_rect_s *bounds,
FAR void *arg);
@@ -155,37 +155,38 @@ static void nxtk_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
* Name: nxtk_position
****************************************************************************/
-static void nxtk_position(NXWINDOW hwnd, FAR const struct nxgl_rect_s *size,
+static void nxtk_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size,
FAR const struct nxgl_point_s *pos,
FAR const struct nxgl_rect_s *bounds,
FAR void *arg)
{
FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hwnd;
- struct nxgl_rect_s relrect;
+ struct nxgl_size_s subwindowsize;
- gvdbg("nxtk_position: hwnd=%p size={(%d,%d),(%d,%d)} pos=(%d,%d) bounds={(%d,%d),(%d,%d)}\n",
- hwnd, size->pt1.x, size->pt1.y, size->pt2.x, size->pt2.y,
- pos->x, pos->y,
+ gvdbg("nxtk_position: hwnd=%p size=(%d,%d) pos=(%d,%d) bounds={(%d,%d),(%d,%d)}\n",
+ hwnd, size->w, size->w, pos->x, pos->y,
bounds->pt1.x, bounds->pt1.y, bounds->pt2.x, bounds->pt2.y);
/* Recalculate the dimensions of the toolbar and client windows */
nxtk_setsubwindows(fwnd);
- /* Report the size position of the client sub-window */
+ /* Report the size / position of the client sub-window */
if (fwnd->fwcb->position)
{
- nxgl_rectoffset(&relrect, &fwnd->fwrect, fwnd->fwrect.pt1.x, fwnd->fwrect.pt1.y);
- fwnd->fwcb->position((NXTKWINDOW)fwnd, &relrect, &fwnd->fwrect.pt1, bounds, fwnd->fwarg);
+ nxgl_rectsize(&subwindowsize, &fwnd->fwrect);
+ fwnd->fwcb->position((NXTKWINDOW)fwnd, &subwindowsize,
+ &fwnd->fwrect.pt1, bounds, fwnd->fwarg);
}
- /* Report the size position of the toolbar sub-window */
+ /* Report the size / position of the toolbar sub-window */
if (fwnd->tbcb && fwnd->tbcb->position)
{
- nxgl_rectoffset(&relrect, &fwnd->tbrect, fwnd->tbrect.pt1.x, fwnd->tbrect.pt1.y);
- fwnd->tbcb->position((NXTKWINDOW)fwnd, &relrect, &fwnd->fwrect.pt1, bounds, fwnd->tbarg);
+ nxgl_rectsize(&subwindowsize, &fwnd->tbrect);
+ fwnd->tbcb->position((NXTKWINDOW)fwnd, &subwindowsize,
+ &fwnd->tbrect.pt1, bounds, fwnd->tbarg);
}
}
diff --git a/nuttx/graphics/nxtk/nxtk_setsize.c b/nuttx/graphics/nxtk/nxtk_setsize.c
index a72e8f883..e2917fc34 100644
--- a/nuttx/graphics/nxtk/nxtk_setsize.c
+++ b/nuttx/graphics/nxtk/nxtk_setsize.c
@@ -91,10 +91,10 @@
*
****************************************************************************/
-int nxtk_setsize(NXTKWINDOW hfwnd, FAR struct nxgl_rect_s *size)
+int nxtk_setsize(NXTKWINDOW hfwnd, FAR struct nxgl_size_s *size)
{
FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hfwnd;
- struct nxgl_rect_s newsize;
+ struct nxgl_size_s newsize;
#ifdef CONFIG_DEBUG
if (!hfwnd || !size)
@@ -106,10 +106,8 @@ int nxtk_setsize(NXTKWINDOW hfwnd, FAR struct nxgl_rect_s *size)
/* Add the sizes need for the toolbar and the borders */
- newsize.pt1.x = 0;
- newsize.pt1.y = 0;
- newsize.pt2.x = size->pt2.x + 2 * CONFIG_NXTK_BORDERWIDTH;
- newsize.pt2.y = size->pt2.y + fwnd->tbheight + 2 * CONFIG_NXTK_BORDERWIDTH;
+ newsize.w = size->w + 2 * CONFIG_NXTK_BORDERWIDTH;
+ newsize.h = size->w + fwnd->tbheight + 2 * CONFIG_NXTK_BORDERWIDTH;
/* Then set the window size */
diff --git a/nuttx/graphics/nxtk/nxtk_setsubwindows.c b/nuttx/graphics/nxtk/nxtk_setsubwindows.c
index 443fa92c3..57c280c73 100644
--- a/nuttx/graphics/nxtk/nxtk_setsubwindows.c
+++ b/nuttx/graphics/nxtk/nxtk_setsubwindows.c
@@ -142,7 +142,7 @@ void nxtk_setsubwindows(FAR struct nxtk_framedwindow_s *fwnd)
/* Divide up the horizontal dimensions of the window */
- fullwidth = fwnd->wnd.bounds.pt2.x - fwnd->wnd.bounds.pt1.x;
+ fullwidth = fwnd->wnd.bounds.pt2.x - fwnd->wnd.bounds.pt1.x + 1;
bdrwidth = ngl_min(2 * CONFIG_NXTK_BORDERWIDTH, fullwidth);
fwwidth = fullwidth - bdrwidth;
fwleft = fwnd->wnd.origin.x + bdrwidth/2;
@@ -151,11 +151,11 @@ void nxtk_setsubwindows(FAR struct nxtk_framedwindow_s *fwnd)
fwnd->tbrect.pt1.x = fwleft;
fwnd->tbrect.pt1.y = tbtop;
- fwnd->tbrect.pt2.x = fwleft + fwwidth;
+ fwnd->tbrect.pt2.x = fwleft + fwwidth - 1;
fwnd->tbrect.pt2.y = tbtop + tbheight - 1;
fwnd->fwrect.pt1.x = fwleft;
fwnd->fwrect.pt1.y = fwtop;
- fwnd->fwrect.pt2.x = fwleft + fwwidth;
+ fwnd->fwrect.pt2.x = fwleft + fwwidth - 1;
fwnd->fwrect.pt2.y = fwtop + fwheight - 1;
}