diff options
Diffstat (limited to 'nuttx/graphics/nxmu')
-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 |
9 files changed, 46 insertions, 27 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 } |