graphics/nxmu/nxmu_server.c: Appease nxstyle

This commit is contained in:
YAMAMOTO Takashi
2020-11-20 20:33:38 +09:00
committed by Xiang Xiao
parent 318b3ce8eb
commit 4b67aa3df9
+70 -35
View File
@@ -70,7 +70,8 @@ static inline void nxmu_disconnect(FAR struct nxmu_conn_s *conn)
outmsg.msgid = NX_CLIMSG_DISCONNECTED; outmsg.msgid = NX_CLIMSG_DISCONNECTED;
ret = nxmu_sendclient(conn, &outmsg, sizeof(struct nxclimsg_disconnected_s)); ret = nxmu_sendclient(conn, &outmsg,
sizeof(struct nxclimsg_disconnected_s));
if (ret < 0) if (ret < 0)
{ {
gerr("ERROR: nxmu_sendclient failed: %d\n", ret); gerr("ERROR: nxmu_sendclient failed: %d\n", ret);
@@ -95,7 +96,9 @@ static inline void nxmu_connect(FAR struct nxmu_conn_s *conn)
sprintf(mqname, NX_CLIENT_MQNAMEFMT, conn->cid); sprintf(mqname, NX_CLIENT_MQNAMEFMT, conn->cid);
/* Open the client MQ -- this should have already been created by the client */ /* Open the client MQ -- this should have already been created by the
* client
*/
conn->swrmq = mq_open(mqname, O_WRONLY); conn->swrmq = mq_open(mqname, O_WRONLY);
if (conn->swrmq == (mqd_t)-1) if (conn->swrmq == (mqd_t)-1)
@@ -331,46 +334,52 @@ int nx_runinstance(FAR const char *mqname, FAR NX_DRIVERTYPE *dev)
ginfo("Received opcode=%d nbytes=%d\n", msg->msgid, nbytes); ginfo("Received opcode=%d nbytes=%d\n", msg->msgid, nbytes);
switch (msg->msgid) switch (msg->msgid)
{ {
/* Messages sent from clients to the NX server *********************/ /* Messages sent from clients to the NX server ********************/
case NX_SVRMSG_CONNECT: /* Establish connection with new NX server client */ case NX_SVRMSG_CONNECT: /* Establish connection with new NX server client */
{ {
FAR struct nxsvrmsg_s *connmsg = (FAR struct nxsvrmsg_s *)buffer; FAR struct nxsvrmsg_s *connmsg =
(FAR struct nxsvrmsg_s *)buffer;
nxmu_connect(connmsg->conn); nxmu_connect(connmsg->conn);
} }
break; break;
case NX_SVRMSG_DISCONNECT: /* Tear down connection with terminating client */ case NX_SVRMSG_DISCONNECT: /* Tear down connection with terminating client */
{ {
FAR struct nxsvrmsg_s *disconnmsg = (FAR struct nxsvrmsg_s *)buffer; FAR struct nxsvrmsg_s *disconnmsg =
(FAR struct nxsvrmsg_s *)buffer;
nxmu_disconnect(disconnmsg->conn); nxmu_disconnect(disconnmsg->conn);
} }
break; break;
case NX_SVRMSG_OPENWINDOW: /* Create a new window */ case NX_SVRMSG_OPENWINDOW: /* Create a new window */
{ {
FAR struct nxsvrmsg_openwindow_s *openmsg = (FAR struct nxsvrmsg_openwindow_s *)buffer; FAR struct nxsvrmsg_openwindow_s *openmsg =
(FAR struct nxsvrmsg_openwindow_s *)buffer;
nxmu_openwindow(&nxmu.be, openmsg->wnd); nxmu_openwindow(&nxmu.be, openmsg->wnd);
} }
break; break;
case NX_SVRMSG_CLOSEWINDOW: /* Close an existing window */ case NX_SVRMSG_CLOSEWINDOW: /* Close an existing window */
{ {
FAR struct nxsvrmsg_closewindow_s *closemsg = (FAR struct nxsvrmsg_closewindow_s *)buffer; FAR struct nxsvrmsg_closewindow_s *closemsg =
(FAR struct nxsvrmsg_closewindow_s *)buffer;
nxbe_closewindow(closemsg->wnd); nxbe_closewindow(closemsg->wnd);
} }
break; break;
case NX_SVRMSG_BLOCKED: /* Block messages to a window */ case NX_SVRMSG_BLOCKED: /* Block messages to a window */
{ {
FAR struct nxsvrmsg_blocked_s *blocked = (FAR struct nxsvrmsg_blocked_s *)buffer; FAR struct nxsvrmsg_blocked_s *blocked =
(FAR struct nxsvrmsg_blocked_s *)buffer;
nxmu_event(blocked->wnd, NXEVENT_BLOCKED, blocked->arg); nxmu_event(blocked->wnd, NXEVENT_BLOCKED, blocked->arg);
} }
break; break;
case NX_SVRMSG_SYNCH: /* Synchronization request */ case NX_SVRMSG_SYNCH: /* Synchronization request */
{ {
FAR struct nxsvrmsg_synch_s *synch = (FAR struct nxsvrmsg_synch_s *)buffer; FAR struct nxsvrmsg_synch_s *synch =
(FAR struct nxsvrmsg_synch_s *)buffer;
nxmu_event(synch->wnd, NXEVENT_SYNCHED, synch->arg); nxmu_event(synch->wnd, NXEVENT_SYNCHED, synch->arg);
} }
break; break;
@@ -378,7 +387,8 @@ int nx_runinstance(FAR const char *mqname, FAR NX_DRIVERTYPE *dev)
#if defined(CONFIG_NX_SWCURSOR) || defined(CONFIG_NX_HWCURSOR) #if defined(CONFIG_NX_SWCURSOR) || defined(CONFIG_NX_HWCURSOR)
case NX_SVRMSG_CURSOR_ENABLE: /* Enable/disable cursor */ case NX_SVRMSG_CURSOR_ENABLE: /* Enable/disable cursor */
{ {
FAR struct nxsvrmsg_curenable_s *enabmsg = (FAR struct nxsvrmsg_curenable_s *)buffer; FAR struct nxsvrmsg_curenable_s *enabmsg =
(FAR struct nxsvrmsg_curenable_s *)buffer;
nxbe_cursor_enable(&nxmu.be, enabmsg->enable); nxbe_cursor_enable(&nxmu.be, enabmsg->enable);
} }
break; break;
@@ -386,14 +396,16 @@ int nx_runinstance(FAR const char *mqname, FAR NX_DRIVERTYPE *dev)
#if defined(CONFIG_NX_HWCURSORIMAGE) || defined(CONFIG_NX_SWCURSOR) #if defined(CONFIG_NX_HWCURSORIMAGE) || defined(CONFIG_NX_SWCURSOR)
case NX_SVRMSG_CURSOR_IMAGE: /* Set cursor image */ case NX_SVRMSG_CURSOR_IMAGE: /* Set cursor image */
{ {
FAR struct nxsvrmsg_curimage_s *imgmsg = (FAR struct nxsvrmsg_curimage_s *)buffer; FAR struct nxsvrmsg_curimage_s *imgmsg =
(FAR struct nxsvrmsg_curimage_s *)buffer;
nxbe_cursor_setimage(&nxmu.be, &imgmsg->image); nxbe_cursor_setimage(&nxmu.be, &imgmsg->image);
} }
break; break;
#endif #endif
case NX_SVRMSG_CURSOR_SETPOS: /* Set cursor position */ case NX_SVRMSG_CURSOR_SETPOS: /* Set cursor position */
{ {
FAR struct nxsvrmsg_curpos_s *posmsg = (FAR struct nxsvrmsg_curpos_s *)buffer; FAR struct nxsvrmsg_curpos_s *posmsg =
(FAR struct nxsvrmsg_curpos_s *)buffer;
nxbe_cursor_setposition(&nxmu.be, &posmsg->pos); nxbe_cursor_setposition(&nxmu.be, &posmsg->pos);
} }
break; break;
@@ -401,8 +413,10 @@ int nx_runinstance(FAR const char *mqname, FAR NX_DRIVERTYPE *dev)
case NX_SVRMSG_REQUESTBKGD: /* Give access to the background window */ case NX_SVRMSG_REQUESTBKGD: /* Give access to the background window */
{ {
FAR struct nxsvrmsg_requestbkgd_s *rqbgmsg = (FAR struct nxsvrmsg_requestbkgd_s *)buffer; FAR struct nxsvrmsg_requestbkgd_s *rqbgmsg =
nxmu_requestbkgd(rqbgmsg->conn, &nxmu.be, rqbgmsg->cb, rqbgmsg->arg); (FAR struct nxsvrmsg_requestbkgd_s *)buffer;
nxmu_requestbkgd(rqbgmsg->conn, &nxmu.be, rqbgmsg->cb,
rqbgmsg->arg);
} }
break; break;
@@ -414,42 +428,48 @@ int nx_runinstance(FAR const char *mqname, FAR NX_DRIVERTYPE *dev)
case NX_SVRMSG_SETPOSITION: /* Change window position */ case NX_SVRMSG_SETPOSITION: /* Change window position */
{ {
FAR struct nxsvrmsg_setposition_s *setposmsg = (FAR struct nxsvrmsg_setposition_s *)buffer; FAR struct nxsvrmsg_setposition_s *setposmsg =
(FAR struct nxsvrmsg_setposition_s *)buffer;
nxbe_setposition(setposmsg->wnd, &setposmsg->pos); nxbe_setposition(setposmsg->wnd, &setposmsg->pos);
} }
break; break;
case NX_SVRMSG_SETSIZE: /* Change window size */ case NX_SVRMSG_SETSIZE: /* Change window size */
{ {
FAR struct nxsvrmsg_setsize_s *setsizemsg = (FAR struct nxsvrmsg_setsize_s *)buffer; FAR struct nxsvrmsg_setsize_s *setsizemsg =
(FAR struct nxsvrmsg_setsize_s *)buffer;
nxbe_setsize(setsizemsg->wnd, &setsizemsg->size); nxbe_setsize(setsizemsg->wnd, &setsizemsg->size);
} }
break; break;
case NX_SVRMSG_GETPOSITION: /* Get the window size/position */ case NX_SVRMSG_GETPOSITION: /* Get the window size/position */
{ {
FAR struct nxsvrmsg_getposition_s *getposmsg = (FAR struct nxsvrmsg_getposition_s *)buffer; FAR struct nxsvrmsg_getposition_s *getposmsg =
(FAR struct nxsvrmsg_getposition_s *)buffer;
nxmu_reportposition(getposmsg->wnd); nxmu_reportposition(getposmsg->wnd);
} }
break; break;
case NX_SVRMSG_RAISE: /* Move the window to the top of the display */ case NX_SVRMSG_RAISE: /* Move the window to the top of the display */
{ {
FAR struct nxsvrmsg_raise_s *raisemsg = (FAR struct nxsvrmsg_raise_s *)buffer; FAR struct nxsvrmsg_raise_s *raisemsg =
(FAR struct nxsvrmsg_raise_s *)buffer;
nxbe_raise(raisemsg->wnd); nxbe_raise(raisemsg->wnd);
} }
break; break;
case NX_SVRMSG_LOWER: /* Lower the window to the bottom of the display */ case NX_SVRMSG_LOWER: /* Lower the window to the bottom of the display */
{ {
FAR struct nxsvrmsg_lower_s *lowermsg = (FAR struct nxsvrmsg_lower_s *)buffer; FAR struct nxsvrmsg_lower_s *lowermsg =
(FAR struct nxsvrmsg_lower_s *)buffer;
nxbe_lower(lowermsg->wnd); nxbe_lower(lowermsg->wnd);
} }
break; break;
case NX_SVRMSG_MODAL: /* Select/De-select window modal state */ case NX_SVRMSG_MODAL: /* Select/De-select window modal state */
{ {
FAR struct nxsvrmsg_modal_s *modalmsg = (FAR struct nxsvrmsg_modal_s *)buffer; FAR struct nxsvrmsg_modal_s *modalmsg =
(FAR struct nxsvrmsg_modal_s *)buffer;
nxbe_modal(modalmsg->wnd, modalmsg->modal); nxbe_modal(modalmsg->wnd, modalmsg->modal);
} }
break; break;
@@ -464,22 +484,26 @@ int nx_runinstance(FAR const char *mqname, FAR NX_DRIVERTYPE *dev)
case NX_SVRMSG_SETPIXEL: /* Set a single pixel in the window with a color */ case NX_SVRMSG_SETPIXEL: /* Set a single pixel in the window with a color */
{ {
FAR struct nxsvrmsg_setpixel_s *setmsg = (FAR struct nxsvrmsg_setpixel_s *)buffer; FAR struct nxsvrmsg_setpixel_s *setmsg =
(FAR struct nxsvrmsg_setpixel_s *)buffer;
nxbe_setpixel(setmsg->wnd, &setmsg->pos, setmsg->color); nxbe_setpixel(setmsg->wnd, &setmsg->pos, setmsg->color);
} }
break; break;
case NX_SVRMSG_FILL: /* Fill a rectangular region in the window with a color */ case NX_SVRMSG_FILL: /* Fill a rectangular region in the window with a color */
{ {
FAR struct nxsvrmsg_fill_s *fillmsg = (FAR struct nxsvrmsg_fill_s *)buffer; FAR struct nxsvrmsg_fill_s *fillmsg =
(FAR struct nxsvrmsg_fill_s *)buffer;
nxbe_fill(fillmsg->wnd, &fillmsg->rect, fillmsg->color); nxbe_fill(fillmsg->wnd, &fillmsg->rect, fillmsg->color);
} }
break; break;
case NX_SVRMSG_GETRECTANGLE: /* Get a rectangular region from the window */ case NX_SVRMSG_GETRECTANGLE: /* Get a rectangular region from the window */
{ {
FAR struct nxsvrmsg_getrectangle_s *getmsg = (FAR struct nxsvrmsg_getrectangle_s *)buffer; FAR struct nxsvrmsg_getrectangle_s *getmsg =
nxbe_getrectangle(getmsg->wnd, &getmsg->rect, getmsg->plane, getmsg->dest, getmsg->deststride); (FAR struct nxsvrmsg_getrectangle_s *)buffer;
nxbe_getrectangle(getmsg->wnd, &getmsg->rect, getmsg->plane,
getmsg->dest, getmsg->deststride);
if (getmsg->sem_done) if (getmsg->sem_done)
{ {
@@ -490,21 +514,27 @@ int nx_runinstance(FAR const char *mqname, FAR NX_DRIVERTYPE *dev)
case NX_SVRMSG_FILLTRAP: /* Fill a trapezoidal region in the window with a color */ case NX_SVRMSG_FILLTRAP: /* Fill a trapezoidal region in the window with a color */
{ {
FAR struct nxsvrmsg_filltrapezoid_s *trapmsg = (FAR struct nxsvrmsg_filltrapezoid_s *)buffer; FAR struct nxsvrmsg_filltrapezoid_s *trapmsg =
nxbe_filltrapezoid(trapmsg->wnd, &trapmsg->clip, &trapmsg->trap, trapmsg->color); (FAR struct nxsvrmsg_filltrapezoid_s *)buffer;
nxbe_filltrapezoid(trapmsg->wnd, &trapmsg->clip,
&trapmsg->trap, trapmsg->color);
} }
break; break;
case NX_SVRMSG_MOVE: /* Move a rectangular region within the window */ case NX_SVRMSG_MOVE: /* Move a rectangular region within the window */
{ {
FAR struct nxsvrmsg_move_s *movemsg = (FAR struct nxsvrmsg_move_s *)buffer; FAR struct nxsvrmsg_move_s *movemsg =
(FAR struct nxsvrmsg_move_s *)buffer;
nxbe_move(movemsg->wnd, &movemsg->rect, &movemsg->offset); nxbe_move(movemsg->wnd, &movemsg->rect, &movemsg->offset);
} }
break; break;
case NX_SVRMSG_BITMAP: /* Copy a rectangular bitmap into the window */ case NX_SVRMSG_BITMAP: /* Copy a rectangular bitmap into the window */
{ {
FAR struct nxsvrmsg_bitmap_s *bmpmsg = (FAR struct nxsvrmsg_bitmap_s *)buffer; FAR struct nxsvrmsg_bitmap_s *bmpmsg =
nxbe_bitmap(bmpmsg->wnd, &bmpmsg->dest, bmpmsg->src, &bmpmsg->origin, bmpmsg->stride); (FAR struct nxsvrmsg_bitmap_s *)buffer;
nxbe_bitmap(bmpmsg->wnd, &bmpmsg->dest, bmpmsg->src,
&bmpmsg->origin, bmpmsg->stride);
if (bmpmsg->sem_done) if (bmpmsg->sem_done)
{ {
@@ -525,7 +555,8 @@ int nx_runinstance(FAR const char *mqname, FAR NX_DRIVERTYPE *dev)
/* Yes.. fill the background */ /* Yes.. fill the background */
nxgl_colorcopy(nxmu.be.bgcolor, bgcolormsg->color); nxgl_colorcopy(nxmu.be.bgcolor, bgcolormsg->color);
nxbe_fill(&nxmu.be.bkgd, &nxmu.be.bkgd.bounds, bgcolormsg->color); nxbe_fill(&nxmu.be.bkgd, &nxmu.be.bkgd.bounds,
bgcolormsg->color);
} }
} }
break; break;
@@ -533,7 +564,8 @@ int nx_runinstance(FAR const char *mqname, FAR NX_DRIVERTYPE *dev)
#ifdef CONFIG_NX_XYINPUT #ifdef CONFIG_NX_XYINPUT
case NX_SVRMSG_MOUSEIN: /* New mouse report from mouse client */ case NX_SVRMSG_MOUSEIN: /* New mouse report from mouse client */
{ {
FAR struct nxsvrmsg_mousein_s *mousemsg = (FAR struct nxsvrmsg_mousein_s *)buffer; FAR struct nxsvrmsg_mousein_s *mousemsg =
(FAR struct nxsvrmsg_mousein_s *)buffer;
nxmu_mousein(&nxmu, &mousemsg->pt, mousemsg->buttons); nxmu_mousein(&nxmu, &mousemsg->pt, mousemsg->buttons);
} }
break; break;
@@ -541,7 +573,8 @@ int nx_runinstance(FAR const char *mqname, FAR NX_DRIVERTYPE *dev)
#ifdef CONFIG_NX_KBD #ifdef CONFIG_NX_KBD
case NX_SVRMSG_KBDIN: /* New keyboard report from keyboard client */ case NX_SVRMSG_KBDIN: /* New keyboard report from keyboard client */
{ {
FAR struct nxsvrmsg_kbdin_s *kbdmsg = (FAR struct nxsvrmsg_kbdin_s *)buffer; FAR struct nxsvrmsg_kbdin_s *kbdmsg =
(FAR struct nxsvrmsg_kbdin_s *)buffer;
nxmu_kbdin(&nxmu, kbdmsg->nch, kbdmsg->ch); nxmu_kbdin(&nxmu, kbdmsg->nch, kbdmsg->ch);
} }
break; break;
@@ -549,16 +582,18 @@ int nx_runinstance(FAR const char *mqname, FAR NX_DRIVERTYPE *dev)
case NX_SVRMSG_REDRAWREQ: /* Request re-drawing of rectangular region */ case NX_SVRMSG_REDRAWREQ: /* Request re-drawing of rectangular region */
{ {
FAR struct nxsvrmsg_redrawreq_s *redrawmsg = (FAR struct nxsvrmsg_redrawreq_s *)buffer; FAR struct nxsvrmsg_redrawreq_s *redrawmsg =
(FAR struct nxsvrmsg_redrawreq_s *)buffer;
nxmu_redraw(redrawmsg->wnd, &redrawmsg->rect); nxmu_redraw(redrawmsg->wnd, &redrawmsg->rect);
} }
break; break;
/* Messages sent to the background window **************************/ /* Messages sent to the background window *************************/
case NX_CLIMSG_REDRAW: /* Re-draw the background window */ case NX_CLIMSG_REDRAW: /* Re-draw the background window */
{ {
FAR struct nxclimsg_redraw_s *redraw = (FAR struct nxclimsg_redraw_s *)buffer; FAR struct nxclimsg_redraw_s *redraw =
(FAR struct nxclimsg_redraw_s *)buffer;
DEBUGASSERT(redraw->wnd == &nxmu.be.bkgd); DEBUGASSERT(redraw->wnd == &nxmu.be.bkgd);
ginfo("Re-draw background rect={(%d,%d),(%d,%d)}\n", ginfo("Re-draw background rect={(%d,%d),(%d,%d)}\n",
redraw->rect.pt1.x, redraw->rect.pt1.y, redraw->rect.pt1.x, redraw->rect.pt1.y,