diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-12-01 22:13:03 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-12-01 22:13:03 +0000 |
commit | 0f895f0ed4b2370af37d91c0ecb7649d914ed147 (patch) | |
tree | 0aed3e4de0338044be420062103f72c88a430fa3 /nuttx/graphics | |
parent | 2e5d80f7a34c92e7182b549bd35e0b218fd100a4 (diff) | |
download | px4-nuttx-0f895f0ed4b2370af37d91c0ecb7649d914ed147.tar.gz px4-nuttx-0f895f0ed4b2370af37d91c0ecb7649d914ed147.tar.bz2 px4-nuttx-0f895f0ed4b2370af37d91c0ecb7649d914ed147.zip |
Fixed for multi-user NX mode
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1386 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/graphics')
-rw-r--r-- | nuttx/graphics/nxmu/nx_connect.c | 2 | ||||
-rw-r--r-- | nuttx/graphics/nxmu/nx_mousein.c | 12 | ||||
-rw-r--r-- | nuttx/graphics/nxmu/nx_openwindow.c | 2 | ||||
-rw-r--r-- | nuttx/graphics/nxmu/nx_releasebkgd.c | 2 | ||||
-rw-r--r-- | nuttx/graphics/nxmu/nx_requestbkgd.c | 5 | ||||
-rw-r--r-- | nuttx/graphics/nxmu/nxfe.h | 17 | ||||
-rw-r--r-- | nuttx/graphics/nxmu/nxmu_mouse.c | 23 | ||||
-rw-r--r-- | nuttx/graphics/nxmu/nxmu_releasebkgd.c | 3 | ||||
-rw-r--r-- | nuttx/graphics/nxmu/nxmu_requestbkgd.c | 7 | ||||
-rw-r--r-- | nuttx/graphics/nxsu/nx_mousein.c | 2 | ||||
-rw-r--r-- | nuttx/graphics/nxsu/nx_releasebkgd.c | 3 | ||||
-rw-r--r-- | nuttx/graphics/nxsu/nx_requestbkgd.c | 7 | ||||
-rw-r--r-- | nuttx/graphics/nxsu/nxsu_redrawreq.c | 2 | ||||
-rw-r--r-- | nuttx/graphics/nxtk/nxtk_rawwindow.c | 2 |
14 files changed, 56 insertions, 33 deletions
diff --git a/nuttx/graphics/nxmu/nx_connect.c b/nuttx/graphics/nxmu/nx_connect.c index 69cf7e95a..ac09fd9d4 100644 --- a/nuttx/graphics/nxmu/nx_connect.c +++ b/nuttx/graphics/nxmu/nx_connect.c @@ -110,7 +110,7 @@ static uint32 g_nxcid = 1; * ****************************************************************************/ -NXHANDLE nx_connectionstance(FAR const char *svrmqname) +NXHANDLE nx_connectinstance(FAR const char *svrmqname) { FAR struct nxfe_conn_s *conn; struct nxsvrmsg_s msg; diff --git a/nuttx/graphics/nxmu/nx_mousein.c b/nuttx/graphics/nxmu/nx_mousein.c index 7bd33c4a4..3d22392c3 100644 --- a/nuttx/graphics/nxmu/nx_mousein.c +++ b/nuttx/graphics/nxmu/nx_mousein.c @@ -85,17 +85,17 @@ int nx_mousein(NXHANDLE handle, nxgl_coord_t x, nxgl_coord_t y, ubyte buttons) { FAR struct nxfe_conn_s *conn = (FAR struct nxfe_conn_s *)handle; - struct nxsvrmsg_mousein_s outmsg; + struct nxsvrmsg_mousein_s outmsg; int ret; /* Inform the server that this client no longer exists */ - msg.msgid = NX_SVRMSG_MOUSEIN; - msg.pt.x = x; - msg.pt.y = y; - msg.buttons = buttons; + outmsg.msgid = NX_SVRMSG_MOUSEIN; + outmsg.pt.x = x; + outmsg.pt.y = y; + outmsg.buttons = buttons; - ret = mq_send(conn->c_cwrmq, &outmsg, sizeof(struct nxsvrmsg_mousein_s), NX_SVRMSG_PRIO); + ret = mq_send(conn->cwrmq, &outmsg, sizeof(struct nxsvrmsg_mousein_s), NX_SVRMSG_PRIO); if (ret < 0) { gdbg("mq_send failed: %d\n", errno); diff --git a/nuttx/graphics/nxmu/nx_openwindow.c b/nuttx/graphics/nxmu/nx_openwindow.c index 8878ffceb..a05251546 100644 --- a/nuttx/graphics/nxmu/nx_openwindow.c +++ b/nuttx/graphics/nxmu/nx_openwindow.c @@ -95,7 +95,7 @@ NXWINDOW nx_openwindow(NXHANDLE handle, FAR const struct nx_callback_s *cb, int ret; #ifdef CONFIG_DEBUG - if (!conn || !cb) + if (!handle || !cb) { errno = EINVAL; return NULL; diff --git a/nuttx/graphics/nxmu/nx_releasebkgd.c b/nuttx/graphics/nxmu/nx_releasebkgd.c index 3e73ed6b8..1e6001000 100644 --- a/nuttx/graphics/nxmu/nx_releasebkgd.c +++ b/nuttx/graphics/nxmu/nx_releasebkgd.c @@ -1,5 +1,5 @@ /**************************************************************************** - * graphics/nxsu/nx_releasebkgd.c + * graphics/nxmu/nx_releasebkgd.c * * Copyright (C) 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> diff --git a/nuttx/graphics/nxmu/nx_requestbkgd.c b/nuttx/graphics/nxmu/nx_requestbkgd.c index 06f21f5dd..f9aaf86ff 100644 --- a/nuttx/graphics/nxmu/nx_requestbkgd.c +++ b/nuttx/graphics/nxmu/nx_requestbkgd.c @@ -104,13 +104,15 @@ * Input Parameters: * handle - The handle returned by nx_connect * cb - Callbacks to use for processing background window events + * arg - User provided argument (see nx_openwindow, nx_constructwindow) * * Return: * OK: Success; ERROR of failure with errno set appropriately. * ****************************************************************************/ -int nx_requestbkgd(NXHANDLE handle, FAR const struct nx_callback_s *cb) +int nx_requestbkgd(NXHANDLE handle, FAR const struct nx_callback_s *cb, + FAR void *arg) { FAR struct nxfe_conn_s *conn = (FAR struct nxfe_conn_s *)handle; struct nxsvrmsg_requestbkgd_s outmsg; @@ -129,6 +131,7 @@ int nx_requestbkgd(NXHANDLE handle, FAR const struct nx_callback_s *cb) outmsg.msgid = NX_SVRMSG_REQUESTBKGD; outmsg.conn = conn; outmsg.cb = cb; + outmsg.arg = arg; ret = mq_send(conn->cwrmq, &outmsg, sizeof(struct nxsvrmsg_requestbkgd_s), NX_SVRMSG_PRIO); if (ret < 0) diff --git a/nuttx/graphics/nxmu/nxfe.h b/nuttx/graphics/nxmu/nxfe.h index 04fdf9a40..9b8ff22ee 100644 --- a/nuttx/graphics/nxmu/nxfe.h +++ b/nuttx/graphics/nxmu/nxfe.h @@ -231,7 +231,7 @@ struct nxclimsg_mousein_s FAR struct nxbe_window_s *wnd; /* The handle of window receiving mouse input */ struct nxgl_point_s pos; /* Mouse X/Y position */ ubyte buttons; /* Mouse button set */ -} +}; #endif /* This message reports a new keypad event to a particular window */ @@ -282,6 +282,7 @@ struct nxsvrmsg_requestbkgd_s uint32 msgid; /* NX_SVRMSG_REQUESTBKGD */ FAR struct nxfe_conn_s *conn; /* The specific connection sending the message */ FAR const struct nx_callback_s *cb; /* Event handling callbacks */ + FAR void *arg; /* Client argument used with callbacks */ }; /* This message informs the server that client wishes to close a window */ @@ -392,9 +393,9 @@ struct nxsvrmsg_setbgcolor_s struct nxsvrmsg_mousein_s { uint32 msgid; /* NX_SVRMSG_MOUSEIN */ - struct nx_point_x pt; /* Mouse X/Y position */ + struct nxgl_point_s pt; /* Mouse X/Y position */ ubyte buttons; /* Mouse button set */ -} +}; #endif /* This message reports a new keyboard event from a hardware controller attached to @@ -408,7 +409,7 @@ struct nxsvrmsg_kbdin_s uint32 msgid; /* NX_SVRMSG_KBDIN */ ubyte nch /* Number of characters received */ ubyte ch[1]; /* Array of received characters */ -} +}; #endif /**************************************************************************** @@ -505,6 +506,7 @@ EXTERN void nxmu_openwindow(FAR struct nxbe_state_s *be, * conn - The client containing connection information [IN] * be - The server state structure [IN] * cb - Callbacks used to process window events + * arg - User provided argument (see nx_openwindow, nx_constructwindow) * * Return: * None @@ -513,7 +515,8 @@ EXTERN void nxmu_openwindow(FAR struct nxbe_state_s *be, EXTERN void nxmu_requestbkgd(FAR struct nxfe_conn_s *conn, FAR struct nxbe_state_s *be, - FAR const struct nx_callback_s *cb); + FAR const struct nx_callback_s *cb, + FAR void *arg); /**************************************************************************** * Name: nxmu_releasebkgd @@ -594,8 +597,8 @@ EXTERN int nxmu_mousereport(struct nxbe_window_s *wnd); ****************************************************************************/ #ifdef CONFIG_NX_MOUSE -EXTERN nxmu_mousein(FAR struct nxfe_state_s *fe, - FAR const struct nxgl_point_s *pos, int button); +EXTERN int nxmu_mousein(FAR struct nxfe_state_s *fe, + FAR const struct nxgl_point_s *pos, int button); #endif /**************************************************************************** diff --git a/nuttx/graphics/nxmu/nxmu_mouse.c b/nuttx/graphics/nxmu/nxmu_mouse.c index c18fb98eb..80ab60cb7 100644 --- a/nuttx/graphics/nxmu/nxmu_mouse.c +++ b/nuttx/graphics/nxmu/nxmu_mouse.c @@ -130,7 +130,7 @@ int nxmu_mousereport(struct nxbe_window_s *wnd) outmsg.buttons = g_mbutton; nxgl_vectsubtract(&outmsg.pos, &g_mpos, &wnd->origin); - ret = mq_send(wnd->conn->swrmq, outmsg, + ret = mq_send(wnd->conn->swrmq, &outmsg, sizeof(struct nxclimsg_mousein_s), NX_SVRMSG_PRIO); if (ret < 0) { @@ -155,8 +155,8 @@ int nxmu_mousereport(struct nxbe_window_s *wnd) * ****************************************************************************/ -void nxmu_mousein(FAR struct nxfe_state_s *fe, - FAR const struct nxgl_point_s *pos, int buttons) +int nxmu_mousein(FAR struct nxfe_state_s *fe, + FAR const struct nxgl_point_s *pos, int buttons) { struct nxbe_window_s *wnd; nxgl_coord_t x = pos->x; @@ -193,7 +193,6 @@ void nxmu_mousein(FAR struct nxfe_state_s *fe, g_mpos.y = y; g_mbutton = buttons; - /* Pick the window to receive the mouse event. Start with * the top window and go down. Step with the first window * that gets the mouse report @@ -201,13 +200,23 @@ void nxmu_mousein(FAR struct nxfe_state_s *fe, for (wnd = fe->be.topwnd; wnd; wnd = wnd->below) { - ret = nxsu_mousereport(wnd); - if (ret == 0) + /* The background window normally has no callback structure + * (unless a client has taken control of the background via + * nx_requestbkgd()). + */ + + if (wnd->cb) { - break; + ret = nxmu_mousereport(wnd); + if (ret == 0) + { + break; + } } } } + + return OK; } #endif /* CONFIG_NX_MOUSE */ diff --git a/nuttx/graphics/nxmu/nxmu_releasebkgd.c b/nuttx/graphics/nxmu/nxmu_releasebkgd.c index 131a4d5bc..521892b7c 100644 --- a/nuttx/graphics/nxmu/nxmu_releasebkgd.c +++ b/nuttx/graphics/nxmu/nxmu_releasebkgd.c @@ -1,5 +1,5 @@ /**************************************************************************** - * graphics/nxsu/nxmu_releasebkgd.c + * graphics/nxmu/nxmu_releasebkgd.c * * Copyright (C) 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> @@ -101,6 +101,7 @@ void nxmu_releasebkgd(FAR struct nxfe_state_s *fe) */ be->bkgd.cb = NULL; + be->bkgd.arg = NULL; be->bkgd.conn = &fe->conn; /* Redraw the background window */ diff --git a/nuttx/graphics/nxmu/nxmu_requestbkgd.c b/nuttx/graphics/nxmu/nxmu_requestbkgd.c index 6dba04a98..7214c235f 100644 --- a/nuttx/graphics/nxmu/nxmu_requestbkgd.c +++ b/nuttx/graphics/nxmu/nxmu_requestbkgd.c @@ -81,6 +81,7 @@ * conn - The client containing connection information [IN] * be - The server state structure [IN] * cb - Callbacks used to process window events + * arg - User provided argument (see nx_openwindow, nx_constructwindow) * * Return: * None @@ -89,7 +90,8 @@ void nxmu_requestbkgd(FAR struct nxfe_conn_s *conn, FAR struct nxbe_state_s *be, - FAR const struct nx_callback_s *cb) + FAR const struct nx_callback_s *cb, + FAR void *arg) { #ifdef CONFIG_DEBUG if (!conn || !be || !cb) @@ -103,6 +105,7 @@ void nxmu_requestbkgd(FAR struct nxfe_conn_s *conn, */ be->bkgd.cb = cb; + be->bkgd.arg = arg; be->bkgd.conn = conn; /* Report the size/position of the background window to the client */ @@ -116,7 +119,7 @@ void nxmu_requestbkgd(FAR struct nxfe_conn_s *conn, /* Provide the mouse settings */ #ifdef CONFIG_NX_MOUSE - nxsu_mousereport(&be->bkgd); + nxmu_mousereport(&be->bkgd); #endif } diff --git a/nuttx/graphics/nxsu/nx_mousein.c b/nuttx/graphics/nxsu/nx_mousein.c index 1c5427138..2ed59e894 100644 --- a/nuttx/graphics/nxsu/nx_mousein.c +++ b/nuttx/graphics/nxsu/nx_mousein.c @@ -96,7 +96,7 @@ void nxsu_mouseinit(int x, int y) } /**************************************************************************** - * Name: nxmu_mousereport + * Name: nxsu_mousereport * * Description: * Report mouse position info to the specified window diff --git a/nuttx/graphics/nxsu/nx_releasebkgd.c b/nuttx/graphics/nxsu/nx_releasebkgd.c index d73cd1e50..7c4b4e1cf 100644 --- a/nuttx/graphics/nxsu/nx_releasebkgd.c +++ b/nuttx/graphics/nxsu/nx_releasebkgd.c @@ -100,7 +100,8 @@ int nx_releasebkgd(NXWINDOW hwnd) /* Restore the NX background window callbacks */ - be->bkgd.cb = &g_bkgdcb; + be->bkgd.cb = &g_bkgdcb; + be->bkgd.arg = NULL; /* Redraw the background window */ diff --git a/nuttx/graphics/nxsu/nx_requestbkgd.c b/nuttx/graphics/nxsu/nx_requestbkgd.c index 32eed1ab1..5ac83a428 100644 --- a/nuttx/graphics/nxsu/nx_requestbkgd.c +++ b/nuttx/graphics/nxsu/nx_requestbkgd.c @@ -103,13 +103,15 @@ * Input Parameters: * handle - The handle returned by nx_connect * cb - Callbacks to use for processing background window events + * arg - User provided argument (see nx_openwindow, nx_constructwindow) * * Return: * OK on success; ERROR on failure with errno set appropriately * ****************************************************************************/ -int nx_requestbkgd(NXHANDLE handle, FAR const struct nx_callback_s *cb) +int nx_requestbkgd(NXHANDLE handle, FAR const struct nx_callback_s *cb, + FAR void *arg) { FAR struct nxfe_state_s *fe = (FAR struct nxfe_state_s *)handle; FAR struct nxbe_state_s *be = &fe->be; @@ -124,7 +126,8 @@ int nx_requestbkgd(NXHANDLE handle, FAR const struct nx_callback_s *cb) /* Replace the NX background windo callbacks with the client's callbacks */ - be->bkgd.cb = cb; + be->bkgd.cb = cb; + be->bkgd.arg = arg; /* Report the size/position of the background window to the client */ diff --git a/nuttx/graphics/nxsu/nxsu_redrawreq.c b/nuttx/graphics/nxsu/nxsu_redrawreq.c index 9952709c8..3226c0c2d 100644 --- a/nuttx/graphics/nxsu/nxsu_redrawreq.c +++ b/nuttx/graphics/nxsu/nxsu_redrawreq.c @@ -1,5 +1,5 @@ /**************************************************************************** - * graphics/nxmu/nxsu_redrawreq.c + * graphics/nxsu/nxsu_redrawreq.c * * Copyright (C) 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <spudmonkey@racsa.co.cr> diff --git a/nuttx/graphics/nxtk/nxtk_rawwindow.c b/nuttx/graphics/nxtk/nxtk_rawwindow.c index ad241dc22..e5e03fdf5 100644 --- a/nuttx/graphics/nxtk/nxtk_rawwindow.c +++ b/nuttx/graphics/nxtk/nxtk_rawwindow.c @@ -81,7 +81,7 @@ struct nxtk_rawwindow_s static void nxtk_close(NXTWINDOW hwnd) { FAR struct nxtk_rawwindow_s *this = (FAR struct nxtk_rawwindow_s *)hwnd; - nx_close(this->hwnd); + nx_closewindow(this->hwnd); free(this); } |