Acfboy opened a new pull request, #3624:
URL: https://github.com/apache/nuttx-apps/pull/3624

   Hello the community! Here is the work I have done in the early stage of GSoC.
   
   ## Work Completed So Far
   
   The GDI‑level Microwindows core, drivers, and `mwdemo` are functional on 
QEMU x86‑64 and the simulator.
   
   ### Build System Integration
   - Based on the initial proof-of-concept branch by @ppisa , the Microwindows 
core (engine, drivers, precompiled bitmap fonts)  has been successfully 
compiled into the NuttX apps library.
   - Resolved a build conflict: the `ERROR` macro in `wingdi.h` clashes with 
NuttX’s `enum { ERROR = -1 }`. The fix was to compile with `-DNOGDI`, a 
solution accepted by ghaerr and implemented upstream.
   - Image resources used by `mwdemo.c` are compiled into binary  using the 
`convbmp` tool during the build.
   
   ### NuttX Hardware Drivers
   
   Framebuffer driver (`scr_nuttx.c`), Keyboard driver `(kbd_nuttx.c`), Mouse 
driver (`mou_nuttx.c`), have been implemented to connect Microwindows to 
NuttX’s input/output subsystems.
   
   ### Demo Application
   
   Ported `mwdemo.c` (a complex Windows‑like demo) into a standalone NuttX 
example application. The demo runs successfully on both `qemu‑intel64:mw` and 
the NuttX simulator (`sim:mw`).
   
   I have also tested the demo with #define CONTROL 1 enabled in mwdemo.c, 
which represents a more complex use case.
   
   ### Upstream Bug Fixes
   Several issues were discovered, analysed, and fixed – most of them already 
merged upstream:
   
   | Issue | Root Cause | Fix |
   |-------|------------|-----|
   | Animation freezing in mwdemo | `MwSelect()` blocked forever when a timer 
had already expired, because the code assumed no timer existed when 
`GdGetNextTimeout` returned false. | Patch by ppisa (committed by ghaerr in [PR 
#191](https://github.com/ghaerr/microwindows/pull/191)): correctly handle the 
case where `timeout == 0` and return immediately. |
   | Cursor leaving a blue ghost image | `#if defined(ELKS)` in `mwtypes.h` 
forced `MWPIXELVALHW` to `unsigned char` even when `ELKS=0` (intended to 
disable it). This truncated 32‑bit pixel values read from the framebuffer. | 
Changed to `#if ELKS` in 
[ghaerr/microwindows@7a2ff57](https://github.com/ghaerr/microwindows/commit/7a2ff57).
 |
   | System freeze when dragging a window caption | During drag, `MwSelect` 
switches to polling (`select(…, timeout=0)`). The USB input thread had a lower 
priority (50) than the application (100), so it never got CPU time to generate 
events. | Short‑term: adjust thread priorities or add a minimal poll timeout. A 
permanent solution (refactoring the drag event loop) is under discussion. A 
`NUTTX`-specific patch will be prepared. |
   
   ### Remaining Issues
   
   However, despite resolving several issues, two discovered problems are still 
under investigation. Due to a brief interruption while preparing for final 
exams, I have not yet fully diagnosed them. I will resume work soon and address 
the following:
   
   1. When `#define CONTROL 1` is enabled in `mwdemo` and input is tested in an 
edit box, backspace handling does not work correctly under QEMU.
   2. In the simulator (`sim`), after dragging a window, the mouse cursor jumps 
outside the screen and drags the window off-screen as well.
   
   Both issues appear to be related to the input drivers of the respective 
platforms. For instance, adding `sample.point[0].x = x; sample.point[0].y = y;` 
before the code at 
[sim_touchscreen.c#L198-L220](https://github.com/apache/nuttx/blob/e60c831c40d4c5c20520fb10891ea82698215468/arch/sim/src/sim/sim_touchscreen.c#L198-L220)
 resolves the mouse drift problem. It seems that `sample.point[0]` was 
previously uninitialized; however, the code branch in question never sets 
`TOUCH_POS_VALID`, so that value should not have been read in the first place. 
The root cause may lie elsewhere.
   
   
   ## How to Reproduce (QEMU / Simulator)
   
   ### qemu-intel64:mw
   1. Download 
[`defconfig`](https://github.com/Acfboy/nuttx/blob/add-microwindows/boards/x86_64/qemu/qemu-intel64/configs/mw/defconfig)
   2. Build nuttx 
   ```
   make distclean 
   ./tools/configure.sh qemu-intel64:mw
   make -j$(nproc)
   ```
   3. Creating a bootable disk following the instructions in the  
[documentation](https://nuttx.apache.org/docs/12.5.0/platforms/x86_64/qemu/boards/qemu-intel64/index.html)
   4. Run QEMU
   ```
   qemu-system-x86_64 -cpu host -enable-kvm -m 2G \
           -cdrom boot_mw.iso \
            -serial stdio -monitor none -no-reboot -device qemu-xhci -device 
usb-kbd -device usb-mouse
   ```
   ### sim:mw
   
   1. Download 
[`defconfig`](https://github.com/Acfboy/nuttx/blob/add-microwindows/boards/sim/sim/sim/configs/mw/defconfig)
   2. Build nuttx and run
   ```
   make distclean 
   ./tools/configure.sh sim:mw
   make -j$(nproc)
   ./nuttx
   ```
   
   ### Notice
   You can set `#define CONTROL 1` manually in `mwdemo.c` to test more complex 
case.
   
   ## Plan for the Second Half of GSoC
   - Extend testing – verify on real hardware if possible; currently the work 
has been limited to QEMU and sim.
   - Nano‑X (X11 API) port – enable Unix domain socket communication between 
the Nano‑X server and clients. The goal is to run multi‑client demos (e.g., 
src/demos/nanox/ applications).
   - Driver submission to Microwindows mainline – after review by ghaerr, the 
NuttX screen/mouse/keyboard drivers should be integrated into the official 
Microwindows repository.
   - Pull request to NuttX apps – submit a polished draft PR with all the work 
done so far, incorporating mentor feedback.
   - Try to port FLTK gui framework and real-world applications.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to