mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-23 14:38:32 +00:00
graphics/microwindows: add NONETWORK mode for linking Nano-X apps with the server
* Add CONFIG_MICROWINDOWS_NANOX_NONETWORK which builds the Nano-X client library and server in the linked-in (NONETWORK) mode, so client applications are linked directly with the server and run in the same task, requiring no network stack or socket at all * Reorganize the source lists: the drawing sources (nxdraw, nxutil, nxtransform, nxpaintnc) are shared by both modes, while the server is built from srvnet.c in the network mode and srvnonet.c in the NONETWORK mode * Use MULTITHREAD_SERVER in the network mode so that several client tasks can run at the same time in the flat build * Let the examples/nanoxterm start the server task only in the network mode (NONETWORK applications run the server inside main) Assisted-by: OpenCode:DeepSeek-V4-Flash Signed-off-by: Acfboy <AcfboyU@outlook.com>
This commit is contained in:
parent
634d2dbdea
commit
1080111f99
4 changed files with 61 additions and 11 deletions
|
|
@ -33,5 +33,9 @@ MODULE = $(CONFIG_EXAMPLES_NANOXTERM)
|
|||
MAINSRC = nxterm.c
|
||||
CFLAGS += -Wno-undef
|
||||
|
||||
ifneq ($(CONFIG_MICROWINDOWS_NANOX_NONETWORK),)
|
||||
CFLAGS += -DNONETWORK=1
|
||||
endif
|
||||
|
||||
|
||||
include $(APPDIR)/Application.mk
|
||||
|
|
|
|||
|
|
@ -2400,7 +2400,9 @@ static void sigquit(int sig)
|
|||
kill(-pid, SIGHUP);
|
||||
}
|
||||
|
||||
#ifndef NONETWORK
|
||||
extern int nanox_server_main(int argc, char *argv[]);
|
||||
#endif
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
|
@ -2408,11 +2410,13 @@ int main(int argc, char **argv)
|
|||
GR_BITMAP bitmap1fg[7];
|
||||
GR_BITMAP bitmap1bg[7];
|
||||
|
||||
#ifndef NONETWORK
|
||||
/* Start the Nano-X server as a separate task; GrOpen() below retries
|
||||
* the connection while the server comes up.
|
||||
*/
|
||||
|
||||
task_create("nanoxserver", 100, 65536, nanox_server_main, NULL);
|
||||
#endif
|
||||
|
||||
argv++;
|
||||
while (*argv && **argv == '-')
|
||||
|
|
|
|||
|
|
@ -131,12 +131,24 @@ config MICROWINDOWS_MWIN
|
|||
config MICROWINDOWS_NANOX
|
||||
bool "Nano-X (X11 API) client/server support"
|
||||
default n
|
||||
depends on NET_LOCAL && NET_LOCAL_STREAM
|
||||
depends on MICROWINDOWS_NANOX_NONETWORK || (NET_LOCAL && NET_LOCAL_STREAM)
|
||||
---help---
|
||||
Build the Nano-X server core and the Nano-X client library.
|
||||
The Nano-X server runs as a separate task and provides the
|
||||
X11-like API (GrXXX calls) to client applications which
|
||||
connect to it through a local stream socket.
|
||||
connect to it through a local stream socket. Alternatively,
|
||||
with MICROWINDOWS_NANOX_NONETWORK, the client applications
|
||||
are linked directly with the server and run in the same task.
|
||||
|
||||
config MICROWINDOWS_NANOX_NONETWORK
|
||||
bool "Link Nano-X applications directly with the server"
|
||||
default n
|
||||
---help---
|
||||
Build the Nano-X client library and server in the linked-in
|
||||
(NONETWORK) mode: client applications are linked directly
|
||||
with the server, so no network stack or socket is required
|
||||
and the memory footprint is minimal. Only a single client
|
||||
application can be active at a time.
|
||||
|
||||
config MICROWINDOWS_NANOX_NANOWM
|
||||
bool "Built-in Nano-X window manager"
|
||||
|
|
|
|||
|
|
@ -155,14 +155,10 @@ endif
|
|||
|
||||
ifneq ($(CONFIG_MICROWINDOWS_NANOX),)
|
||||
|
||||
MW_NANOX_CLIENT_SRCS = microwindows/src/nanox/nxdraw.c
|
||||
MW_NANOX_CLIENT_SRCS += microwindows/src/nanox/nxutil.c
|
||||
MW_NANOX_CLIENT_SRCS += microwindows/src/nanox/nxtransform.c
|
||||
MW_NANOX_CLIENT_SRCS += microwindows/src/nanox/nxpaintnc.c
|
||||
MW_NANOX_CLIENT_SRCS += microwindows/src/nanox/client.c
|
||||
MW_NANOX_CLIENT_SRCS += microwindows/src/nanox/clientfb.c
|
||||
MW_NANOX_CLIENT_SRCS += microwindows/src/nanox/nxproto.c
|
||||
MW_NANOX_CLIENT_SRCS += microwindows/src/drivers/osdep.c
|
||||
MW_NANOX_DRAW_SRCS = microwindows/src/nanox/nxdraw.c
|
||||
MW_NANOX_DRAW_SRCS += microwindows/src/nanox/nxutil.c
|
||||
MW_NANOX_DRAW_SRCS += microwindows/src/nanox/nxtransform.c
|
||||
MW_NANOX_DRAW_SRCS += microwindows/src/nanox/nxpaintnc.c
|
||||
|
||||
MW_NANOX_WM_SRCS = microwindows/src/nanox/wmaction.c
|
||||
MW_NANOX_WM_SRCS += microwindows/src/nanox/wmclients.c
|
||||
|
|
@ -174,15 +170,47 @@ MW_NANOX_SERVER_SRCS += microwindows/src/nanox/srvfunc.c
|
|||
MW_NANOX_SERVER_SRCS += microwindows/src/nanox/srvutil.c
|
||||
MW_NANOX_SERVER_SRCS += microwindows/src/nanox/srvevent.c
|
||||
MW_NANOX_SERVER_SRCS += microwindows/src/nanox/srvclip.c
|
||||
|
||||
ifeq ($(CONFIG_MICROWINDOWS_NANOX_NONETWORK),y)
|
||||
|
||||
# NONETWORK mode: the client application is linked directly with the
|
||||
# server and runs in the same task, without a network socket. Only a
|
||||
# single client can be active at a time.
|
||||
CFLAGS += -DNONETWORK=1
|
||||
|
||||
ifneq ($(CONFIG_MICROWINDOWS_NANOX_NANOWM),)
|
||||
CFLAGS += -DNANOWM=1
|
||||
CSRCS += $(MW_NANOX_WM_SRCS)
|
||||
endif
|
||||
|
||||
CSRCS += $(MW_NANOX_DRAW_SRCS) $(MW_NANOX_SERVER_SRCS)
|
||||
CSRCS += microwindows/src/nanox/srvnonet.c
|
||||
|
||||
else
|
||||
|
||||
# Network client/server mode: each client connects to the server
|
||||
# through a local stream socket. NX_PER_CLIENT_DATA enables the
|
||||
# per-task client data (POSIX per-thread key) so that several client
|
||||
# tasks can run at the same time in the flat build.
|
||||
|
||||
MW_NANOX_CLIENT_SRCS = $(MW_NANOX_DRAW_SRCS)
|
||||
MW_NANOX_CLIENT_SRCS += microwindows/src/nanox/client.c
|
||||
MW_NANOX_CLIENT_SRCS += microwindows/src/nanox/clientfb.c
|
||||
MW_NANOX_CLIENT_SRCS += microwindows/src/nanox/nxproto.c
|
||||
MW_NANOX_CLIENT_SRCS += microwindows/src/drivers/osdep.c
|
||||
|
||||
MW_NANOX_SERVER_SRCS += microwindows/src/nanox/srvnet.c
|
||||
|
||||
# The server main() is renamed to nanox_server_main() and invoked from
|
||||
# the nanoxterm example, which starts the server as a separate task.
|
||||
microwindows/src/nanox/srvmain.c_CFLAGS += -Dmain=nanox_server_main
|
||||
|
||||
CFLAGS += -DMULTITHREAD_SERVER=1
|
||||
CFLAGS += -DNX_PER_CLIENT_DATA=1
|
||||
ifneq ($(CONFIG_MICROWINDOWS_NANOX_NANOWM),)
|
||||
CFLAGS += -DNANOWM=1
|
||||
|
||||
# Rename the server-side GrXXX symbols to SVR_GrXXX, since the server
|
||||
# and the client code are linked into a single image.
|
||||
$(foreach src,$(MW_NANOX_WM_SRCS),$(eval $(src)_CFLAGS += -include microwindows/src/nanox/serv.h))
|
||||
CSRCS += $(MW_NANOX_WM_SRCS)
|
||||
endif
|
||||
|
|
@ -191,4 +219,6 @@ CSRCS += $(MW_NANOX_CLIENT_SRCS) $(MW_NANOX_SERVER_SRCS)
|
|||
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
include $(APPDIR)/Application.mk
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue