mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
graphics/microwindows: introduce Microwindows graphics support to NuttX
This commit integrates the Microwindows core into the NuttX apps build system: - Downloads a pinned upstream commit during build and compiles the engine, drivers and precompiled bitmap fonts via Microwindows' Objects.rules files. - Adds Kconfig options for framebuffer path, keyboard driver selection (event-mode, raw byte-stream, none, custom), and mouse/touchscreen driver selection (relative, touchscreen, none, custom). - Uses the MWCONFIG_FILE mechanism to inject NuttX-specific configuration (mwconfig.nuttx) without modifying upstream headers. - The NuttX screen, keyboard, mouse and touchscreen drivers are pulled from upstream Microwindows. Driver selection is controlled via ARCH=NUTTX and Kconfig-driven KEYBOARD/MOUSE variables in the Makefile. - Depends on VIDEO_FB for the framebuffer device. - Builds the mwin library (Win32 API layer) when MICROWINDOWS_MWIN is enabled. Co-authored-by: Pavel Pisa <ppisa@pikron.com> Signed-off-by: Pavel Pisa <ppisa@pikron.com> Signed-off-by: Acfboy <AcfboyU@outlook.com>
This commit is contained in:
parent
636047a4e0
commit
ae601e2892
4 changed files with 320 additions and 0 deletions
2
graphics/microwindows/.gitignore
vendored
Normal file
2
graphics/microwindows/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
/microwindows
|
||||
/*.zip
|
||||
131
graphics/microwindows/Kconfig
Normal file
131
graphics/microwindows/Kconfig
Normal file
|
|
@ -0,0 +1,131 @@
|
|||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
menuconfig GRAPHICS_MICROWINDOWS
|
||||
bool "Microwindows or the Nano-X Window System"
|
||||
default n
|
||||
depends on VIDEO_FB
|
||||
---help---
|
||||
Enable Microwindows or the Nano-X Window System
|
||||
|
||||
if GRAPHICS_MICROWINDOWS
|
||||
|
||||
config MICROWINDOWS_FB_PATH
|
||||
string "Framebuffer device path"
|
||||
default "/dev/fb0"
|
||||
---help---
|
||||
Path to the NuttX framebuffer device.
|
||||
|
||||
choice
|
||||
prompt "Keyboard driver"
|
||||
default MICROWINDOWS_KBD_EVENT
|
||||
---help---
|
||||
Select the keyboard input driver for Microwindows.
|
||||
|
||||
config MICROWINDOWS_KBD_EVENT
|
||||
bool "Event-mode keyboard driver"
|
||||
---help---
|
||||
Reads keyboard_event_s events from a NuttX keyboard device
|
||||
(e.g., /dev/kbd). Supports key press/release tracking and
|
||||
modifier keys (Shift, Ctrl, Alt).
|
||||
|
||||
config MICROWINDOWS_KBD_RAW
|
||||
bool "Raw-mode keyboard driver"
|
||||
depends on LIBC_KBDCODEC
|
||||
---help---
|
||||
Reads raw byte stream from a character device (e.g., /dev/kbda)
|
||||
and decodes escape sequences via the kbd_codec library. Suitable
|
||||
for USB HID keyboards on QEMU.
|
||||
|
||||
config MICROWINDOWS_KBD_NONE
|
||||
bool "No keyboard driver"
|
||||
---help---
|
||||
No keyboard driver is compiled. Microwindows will use a null
|
||||
keyboard driver that never produces input. Suitable for
|
||||
display-only applications.
|
||||
|
||||
config MICROWINDOWS_KBD_CUSTOM
|
||||
bool "Custom keyboard driver"
|
||||
---help---
|
||||
No built-in keyboard driver is compiled. The application or BSP
|
||||
must provide its own kbddev symbol and KBDDEVICE implementation,
|
||||
and add the source file to the build (e.g., via CSRCS in its
|
||||
Makefile). See the Microwindows documentation for details.
|
||||
|
||||
endchoice
|
||||
|
||||
config MICROWINDOWS_KBD_EVENT_PATH
|
||||
string "Event keyboard device path"
|
||||
default "/dev/kbd"
|
||||
depends on MICROWINDOWS_KBD_EVENT
|
||||
---help---
|
||||
Device path for the event-mode keyboard driver.
|
||||
|
||||
config MICROWINDOWS_KBD_RAW_PATH
|
||||
string "Raw keyboard device path"
|
||||
default "/dev/kbda"
|
||||
depends on MICROWINDOWS_KBD_RAW
|
||||
---help---
|
||||
Device path for the raw-mode keyboard driver.
|
||||
|
||||
choice
|
||||
prompt "Mouse/touchscreen driver"
|
||||
default MICROWINDOWS_MOUSE_RELATIVE
|
||||
---help---
|
||||
Select the pointing device driver for Microwindows.
|
||||
|
||||
config MICROWINDOWS_MOUSE_RELATIVE
|
||||
bool "Relative mouse driver"
|
||||
---help---
|
||||
Reads mouse_report_s events from a NuttX mouse device
|
||||
(e.g., /dev/mouse0). Supports three buttons and scroll wheel.
|
||||
|
||||
config MICROWINDOWS_MOUSE_TS
|
||||
bool "Touchscreen driver"
|
||||
---help---
|
||||
Reads touch_sample_s events from a NuttX touchscreen device
|
||||
(e.g., /dev/input0). Supports absolute positioning.
|
||||
|
||||
config MICROWINDOWS_MOUSE_NONE
|
||||
bool "No mouse/touchscreen driver"
|
||||
---help---
|
||||
No pointing device driver is compiled. Microwindows will use a
|
||||
null mouse driver that never produces input and hides the cursor.
|
||||
Suitable for display-only applications.
|
||||
|
||||
config MICROWINDOWS_MOUSE_CUSTOM
|
||||
bool "Custom mouse/touchscreen driver"
|
||||
---help---
|
||||
No built-in pointing device driver is compiled. The application
|
||||
or BSP must provide its own mousedev symbol and MOUSEDEVICE
|
||||
implementation, and add the source file to the build (e.g., via
|
||||
CSRCS in its Makefile). See the Microwindows documentation for
|
||||
details.
|
||||
|
||||
endchoice
|
||||
|
||||
config MICROWINDOWS_MOUSE_PATH
|
||||
string "Mouse device path"
|
||||
default "/dev/mouse0"
|
||||
depends on MICROWINDOWS_MOUSE_RELATIVE
|
||||
---help---
|
||||
Device path for the relative mouse driver.
|
||||
|
||||
config MICROWINDOWS_TS_PATH
|
||||
string "Touchscreen device path"
|
||||
default "/dev/input0"
|
||||
depends on MICROWINDOWS_MOUSE_TS
|
||||
---help---
|
||||
Device path for the touchscreen driver.
|
||||
|
||||
config MICROWINDOWS_MWIN
|
||||
bool "Win32 API (mwin) support"
|
||||
default n
|
||||
---help---
|
||||
Build the Microwindows Win32 (mwin) API library. This provides
|
||||
a high-level windowing API similar to the Microsoft Windows API
|
||||
with window management, controls, and standard dialogs.
|
||||
|
||||
endif # GRAPHICS_MICROWINDOWS
|
||||
33
graphics/microwindows/Make.defs
Normal file
33
graphics/microwindows/Make.defs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
############################################################################
|
||||
# apps/graphics/microwindows/Make.defs
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
ifneq ($(CONFIG_GRAPHICS_MICROWINDOWS),)
|
||||
CONFIGURED_APPS += $(APPDIR)/graphics/microwindows
|
||||
|
||||
# It allows `microwindows/src/include` import.
|
||||
|
||||
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/graphics/microwindows/microwindows/src/include
|
||||
CXXFLAGS += ${INCDIR_PREFIX}$(APPDIR)/graphics/microwindows/microwindows/src/include
|
||||
|
||||
CFLAGS += -DMWCONFIG_FILE='"mwconfig.nuttx"'
|
||||
|
||||
endif
|
||||
154
graphics/microwindows/Makefile
Normal file
154
graphics/microwindows/Makefile
Normal file
|
|
@ -0,0 +1,154 @@
|
|||
############################################################################
|
||||
# apps/graphics/microwindows/Makefile
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
# contributor license agreements. See the NOTICE file distributed with
|
||||
# this work for additional information regarding copyright ownership. The
|
||||
# ASF licenses this file to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance with the
|
||||
# License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include $(APPDIR)/Make.defs
|
||||
|
||||
# Microwindows graphic library
|
||||
|
||||
MICROWINDOWS_DIR = .
|
||||
MICROWINDOWS_DIR_NAME = microwindows
|
||||
|
||||
# Set up build configuration and environment
|
||||
|
||||
WD := ${shell echo $(CURDIR) | sed -e 's/ /\\ /g'}
|
||||
|
||||
MICROWINDOWS_COMMIT_HASH := 1f269127b991d01dea5784eacee321a23e34d3d5
|
||||
|
||||
CONFIG_GRAPH_MICROWINDOWS_URL ?= https://codeload.github.com/ghaerr/microwindows/zip/$(MICROWINDOWS_COMMIT_HASH)
|
||||
|
||||
MICROWINDOWS_TARBALL := microwindows-$(MICROWINDOWS_COMMIT_HASH).zip
|
||||
|
||||
MICROWINDOWS_UNPACKNAME = microwindows
|
||||
UNPACK ?= unzip -o $(if $(V),,-q)
|
||||
CURL ?= curl -L $(if $(V),,-Ss)
|
||||
|
||||
MICROWINDOWS_UNPACKDIR = $(WD)/$(MICROWINDOWS_UNPACKNAME)
|
||||
|
||||
$(MICROWINDOWS_TARBALL):
|
||||
$(ECHO_BEGIN)"Downloading: $(MICROWINDOWS_TARBALL)"
|
||||
$(Q) $(CURL) -o $(MICROWINDOWS_TARBALL) $(CONFIG_GRAPH_MICROWINDOWS_URL)
|
||||
$(ECHO_END)
|
||||
|
||||
$(MICROWINDOWS_UNPACKNAME): $(MICROWINDOWS_TARBALL)
|
||||
$(ECHO_BEGIN)"Unpacking: $(MICROWINDOWS_TARBALL) -> $(MICROWINDOWS_UNPACKNAME)"
|
||||
$(Q) $(UNPACK) $(MICROWINDOWS_TARBALL)
|
||||
$(Q) mv microwindows-$(MICROWINDOWS_COMMIT_HASH) $(MICROWINDOWS_UNPACKNAME)
|
||||
$(Q) touch $(MICROWINDOWS_UNPACKNAME)
|
||||
$(ECHO_END)
|
||||
|
||||
# Download and unpack tarball if no git repo found
|
||||
ifeq ($(wildcard $(MICROWINDOWS_UNPACKNAME)/.git),)
|
||||
context:: $(MICROWINDOWS_UNPACKNAME)
|
||||
|
||||
distclean::
|
||||
$(call DELDIR, $(MICROWINDOWS_UNPACKNAME))
|
||||
$(call DELFILE, $(MICROWINDOWS_TARBALL))
|
||||
endif
|
||||
|
||||
CFLAGS += -Wno-undef
|
||||
CFLAGS += -Wno-shadow
|
||||
|
||||
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/graphics/microwindows/microwindows/src/drivers
|
||||
|
||||
CFLAGS += -DNUTTX_FB_PATH=\"$(CONFIG_MICROWINDOWS_FB_PATH)\"
|
||||
ifdef CONFIG_MICROWINDOWS_KBD_EVENT_PATH
|
||||
CFLAGS += -DNUTTX_KBD_EVENT_PATH=\"$(CONFIG_MICROWINDOWS_KBD_EVENT_PATH)\"
|
||||
endif
|
||||
ifdef CONFIG_MICROWINDOWS_KBD_RAW_PATH
|
||||
CFLAGS += -DNUTTX_KBD_RAW_PATH=\"$(CONFIG_MICROWINDOWS_KBD_RAW_PATH)\"
|
||||
endif
|
||||
ifdef CONFIG_MICROWINDOWS_MOUSE_PATH
|
||||
CFLAGS += -DNUTTX_MOUSE_PATH=\"$(CONFIG_MICROWINDOWS_MOUSE_PATH)\"
|
||||
endif
|
||||
ifdef CONFIG_MICROWINDOWS_TS_PATH
|
||||
CFLAGS += -DNUTTX_TOUCHSCREEN_PATH=\"$(CONFIG_MICROWINDOWS_TS_PATH)\"
|
||||
endif
|
||||
|
||||
MW_DIR_OBJ = $(WD)/$(MICROWINDOWS_DIR_NAME)/src
|
||||
|
||||
# Select NuttX drivers via Microwindows Objects.rules
|
||||
ARCH = NUTTX
|
||||
|
||||
ifeq ($(CONFIG_MICROWINDOWS_KBD_EVENT),y)
|
||||
KEYBOARD = NUTTXKBD
|
||||
else ifeq ($(CONFIG_MICROWINDOWS_KBD_RAW),y)
|
||||
KEYBOARD = NUTTXRAWKBD
|
||||
else ifeq ($(CONFIG_MICROWINDOWS_KBD_NONE),y)
|
||||
KEYBOARD = NOKBD
|
||||
else ifeq ($(CONFIG_MICROWINDOWS_KBD_CUSTOM),y)
|
||||
KEYBOARD = CUSTOM
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_MICROWINDOWS_MOUSE_RELATIVE),y)
|
||||
MOUSE = NUTTXMOUSE
|
||||
else ifeq ($(CONFIG_MICROWINDOWS_MOUSE_TS),y)
|
||||
MOUSE = NUTTXTOUCH
|
||||
else ifeq ($(CONFIG_MICROWINDOWS_MOUSE_NONE),y)
|
||||
MOUSE = NOMOUSE
|
||||
else ifeq ($(CONFIG_MICROWINDOWS_MOUSE_CUSTOM),y)
|
||||
MOUSE = CUSTOM
|
||||
endif
|
||||
|
||||
-include microwindows/src/engine/Objects.rules
|
||||
-include microwindows/src/drivers/Objects.rules
|
||||
-include microwindows/src/fonts/Objects.rules
|
||||
|
||||
CSRCS += $(MW_CORE_OBJS:%.o=%.c)
|
||||
|
||||
ifneq ($(CONFIG_MICROWINDOWS_MWIN),)
|
||||
|
||||
# Win32 API
|
||||
MWIN_CORE_SRCS = microwindows/src/mwin/winmain.c
|
||||
MWIN_CORE_SRCS += microwindows/src/mwin/winuser.c
|
||||
MWIN_CORE_SRCS += microwindows/src/mwin/wingdi.c
|
||||
MWIN_CORE_SRCS += microwindows/src/mwin/winexpos.c
|
||||
MWIN_CORE_SRCS += microwindows/src/mwin/winclip.c
|
||||
MWIN_CORE_SRCS += microwindows/src/mwin/winevent.c
|
||||
MWIN_CORE_SRCS += microwindows/src/mwin/windefw.c
|
||||
MWIN_CORE_SRCS += microwindows/src/mwin/winrgn.c
|
||||
MWIN_CORE_SRCS += microwindows/src/mwin/winfont.c
|
||||
MWIN_CORE_SRCS += microwindows/src/mwin/winsbar.c
|
||||
MWIN_CORE_SRCS += microwindows/src/mwin/winres.c
|
||||
|
||||
# mwin winlib
|
||||
WINLIB_SRCS = microwindows/src/mwin/winlib/draw3d.c
|
||||
WINLIB_SRCS += microwindows/src/mwin/winlib/fastfill.c
|
||||
WINLIB_SRCS += microwindows/src/mwin/winlib/windlg.c
|
||||
WINLIB_SRCS += microwindows/src/mwin/winlib/graph3d.c
|
||||
WINLIB_SRCS += microwindows/src/mwin/winlib/caret.c
|
||||
WINLIB_SRCS += microwindows/src/mwin/winlib/static.c
|
||||
WINLIB_SRCS += microwindows/src/mwin/winlib/button.c
|
||||
WINLIB_SRCS += microwindows/src/mwin/winlib/newedit.c
|
||||
WINLIB_SRCS += microwindows/src/mwin/winlib/newlistbox.c
|
||||
WINLIB_SRCS += microwindows/src/mwin/winlib/combobox.c
|
||||
WINLIB_SRCS += microwindows/src/mwin/winlib/progbar.c
|
||||
WINLIB_SRCS += microwindows/src/mwin/winlib/scrlbar.c
|
||||
WINLIB_SRCS += microwindows/src/mwin/winlib/medit.c
|
||||
WINLIB_SRCS += microwindows/src/mwin/winlib/ptinsid.c
|
||||
WINLIB_SRCS += microwindows/src/mwin/winlib/insetr.c
|
||||
|
||||
CSRCS += $(MWIN_CORE_SRCS) $(WINLIB_SRCS)
|
||||
CFLAGS += -DNOGDI
|
||||
|
||||
endif
|
||||
|
||||
include $(APPDIR)/Application.mk
|
||||
Loading…
Add table
Add a link
Reference in a new issue