MiniGUI API Reference (MiniGUI-Threads)
v5.0.6
A mature and proven cross-platform GUI system for embedded and smart IoT devices
|
A modern and proven cross-platform window system for embedded systems or smart IoT devices.
TABLE OF CONTENTS
MiniGUI aims to provide a fast, stable, full-featured, and cross-platform windowing and GUI support system, which is especially fit for embedded systems or smart IoT devices based-on Linux/uClinux, eCos, and other traditional RTOSes, such as RT-Thread, FreeRTOS, RTEMS, VxWorks, ThreadX, Nucleus, pSOS, uC/OS-II, OSE, and others.
This is the source tree of MiniGUI Core, which provides the windowing and graphics interfaces as well as a lot of standard controls (toolkit).
MiniGUI is released under GPLv3 and the dual-licensing applies to commercial use. In December 1998, the initiator of FMSoft, Wei Yongming, began to develop MiniGUI under the GNU General Public License (GPL). In September 2002, the core developers of MiniGUI founded FMSoft and started the commercial marketing with the free software. By now, FMSoft still continues to release MiniGUI as a free software project.
For the live demos, source tarballs, and cases of MiniGUI, you can refer to the following website:
MiniGUI and its components provides a lot of controls/widgets to help your develop GUI apps in C/C++ programming language. However, alternatively, you can choose one of the following frameworks to develop your apps in a easy-to-use programming language other than C/C++.
You can also choose HybridOS Lite to develop apps with excellent expressive for cost-sensitive devices in C/C++ language.
HybridOS is another large open source project initiated by FMSoft. It is a totally new open source operating system designed for embedded and smart IoT devices and cloud computing environment.
In practice, MiniGUI and the software which are used to integrated with GPU constitute the graphics stack of HybridOS.
HybridOS uses MiniGUI as the underlying windowing system, and the members of HybridOS project are now maintaining the whole graphics stack. The following chart shows the graphics stack of HybridOS:
As shown in the chart above, the HybridOS graphics stack consists of the following software:
libDRM
provides some user land APIs for Linux Direct Rendering Infrastructure.hiDRMDrivers
contains the drivers (user land drivers, not kernel drivers) for MiniGUI DRM engine. The drivers implement the basic hardware accelerated 2D graphics operations of various GPUs for MiniGUI.hiMesa
is the Mesa derivative for HybridOS, while Mesa is the open source implementation of OpenGL and other graphics APIs, including OpenGL ES (versions 1, 2, 3), OpenCL, OpenMAX, and Vulkan. It contains the following components:swrast
.hiCairo
is the Cairo derivative for HybridOS. Cairo is a 2D vector graphics library for Gtk. We provide support for MiniGUI backend in hiCairo
.For more information about HybridOS, please refer to:
FMSoft had created the public repositories for MiniGUI Core, MiniGUI components, HybridOS, and other open source apps on GitHub. You can visit them on:
https://gitlab.fmsoft.cn/VincentWei
We now maintain all documents about MiniGUI on the following public repo:
https://gitlab.fmsoft.cn/VincentWei/minigui-docs
You can download the source code tarballs of MiniGUI Core, MiniGUI components, and the dependent libraries from the download zone of the site:
http://www.minigui.com/download
In version 5.0.0, we introduced some exciting new features, and refactored a lot basic modules of MiniGUI Core.
In this version, we enhanced the MiniGUI-Processes runtime mode to support the compositing schema. Under compositing schema, regardless a main window is created by the server (mginit
) or a client, it renders the content in a separate rendering buffer, and the server composites the contents from all visible main windows to the ultimate scan-out frame buffer according to the z-order information.
On the contrary, the legacy schema of MiniGUI-Processes uses the same frame buffer for all processes (and all main windows) in the system. So the legacy schema is also called the shared frame buffer schema.
By enabling the compositing schema, MiniGUI now can provide a better implementation for multi-process environment:
In this version, we also enhanced the window manager of MiniGUI Core to support some special main window types.
Before 5.0.0, you can create a topmost main window with the style WS_EX_TOPMOST
in order to show the main window above all normal main windows, and if you use MiniGUI-Processes runtime mode, the server (mginit
) will always create global main windows, which are shown on other main windows created by clients.
Since 5.0.0, we introduce a concept of z-order levels for main windows. There are eight levels in MiniGUI from top to bottom:
WS_EX_WINTYPE_TOOLTIP
).WS_EX_WINTYPE_GLOBAL
).WS_EX_WINTYPE_SCREENLOCK
).WS_EX_WINTYPE_DOCKER
).WS_EX_WINTYPE_HIGHER
).WS_EX_WINTYPE_NORMAL
).WS_EX_WINTYPE_LAUNCHER
).This enhancement allows us to create a special app which acts as screen lock, docker, or launcher.
You know that we can post or send a message to other windows which may run in another thread under MiniGUI-Threads. The MiniGUI messaging functions such as PostMessage()
, SendMessage()
, SendNotifyMessage()
, and the window callback procedure provide a flexible, efficient, safe, and flexible data transfer and synchronization mechanism for your multithreaded applications.
For example, you can send or post a message to a window from a general purpose thread which may download a file from a remote server under MiniGUI-Threads.
But can we use the MiniGUI messaging mechanism under MiniGUI-Processes and MiniGUI-Standalone runtime modes for multithreading purpose? For example, we may download a file in a general thread and inform a window when the file is ready.
Furthermore, if we want to use the MiniGUI messaging mechanism in a general thread to handle messages from other threads, how to do this?
The virtual window provides a solution for the requirements above. A virtual window is a special window object which does not have a visible window area. But after you create a virtual window in a different thread, you can use the MiniGUI messaging mechanism to post or send messages between the current main window thread and the new thread.
This enhancement provides a very useful facility to you in order to develop a well-designed multithreaded application.
We also tune or enhance the following modules of MiniGUI Core:
select()
system call for all runtime modes. Now you can call RegisterListenFD()
to register a file descriptor to be listened, and handle MSG_FDEVENT
in your window callback procedure to read/write from/to the file descriptor. Before this version, this feature only available for MiniGUI-Processes runtime mode.Obviously, this version brings the largest improvement since MiniGUI 3.0.0. We did our best to ensure backward compatibility of the existed APIs so that the old applications can smoothly migrate to the new version. However, there are still some slight changes you need to take care. For more information, please refer to RELEASE-NOTES.md
file:
https://gitlab.fmsoft.cn/VincentWei/minigui/blob/rel-5-0/RELEASE-NOTES.md
In this version, we enhanced and tuned the APIs related to text rendering, in order to support [HybridOS Foundation Class Library].
MSG_EXIN_XXX
messages to support the input events from devices other than standard mouse and keyboard. We call these messages as 'extra input messages'.dri
to support modern DRI/DRM-driven graphics cards or GPUs on Linux.libinput
to support all modern input devices including mouse, keyboard, joystick, switch, multiple touch panel, gesture, tablet tool, and table pad on Linux.For more information, please refer to RELEASE-NOTES.md
file:
https://gitlab.fmsoft.cn/VincentWei/minigui/blob/rel-4-0/RELEASE-NOTES.md
Because of the changes of some APIs, we recommended strongly that you use this version for new projects.
We introduce some new features in MiniGUI Version 3.2.x:
For more information, please refer to RELEASE-NOTES.md
file:
https://gitlab.fmsoft.cn/VincentWei/minigui/blob/rel-3-2/RELEASE-NOTES.md
You can configure and compile MiniGUI as one of three runtime modes:
MiniGUI-Threads
: A program running on MiniGUI-Threads can create multiple cascaded windows in different threads, and all the windows belong to a single process. MiniGUI-Threads is fit for some real-time systems on Linux/uClinux, eCos, uC/OS-II, VxWorks, pSOS, ThreadX, and OSE.MiniGUI-Processes
: A program running on MiniGUI-Processes is an independent process, which can also create multiple windows. MiniGUI-Processes is fit for some complex embedded systems, such as PDAs, Thin-Clients or STBs. This mode is only useful for full-featured UNIX-like operating systems, like Linux.MiniGUI-Standalone
: A single process version of MiniGUI. This mode is useful for some small systems, like uClinux or RTOSes.The original MiniGUI (version 1.0) run in MiniGUI-Threads mode. It is based on POSIX-compliant thread library. And this thread-based architecture of MiniGUI is very fit for most traditional embedded operating systems, such as eCos, uC/OS-II, and VxWorks. However, if you use embedded Linux, the architecture like X Window will have better stability and scalability, because of the independent memory address space of every process.
Since version 2.0, we provides a new runtime mode called MiniGUI-Processes. You can use MiniGUI-Processes to run more than one MiniGUI-based program in the form of UNIX process at the same time. MiniGUI-Processes is a full-featured multi-process version of original MiniGUI – You can run a program based on MiniGUI-Processes from a program called mginit
. Just like X Window, the former process is called a client, and the latter the server.
Clients connect to the server via UNIX domain socket, and the server receives and responses requests from clients. The server provides shared resources for clients, manage window objects, and sends mouse (or touch screen) and keyboard events to the active top-most client. If a client exits or dies for some reasons, it will not damage other clients and the server.
If you are anxious to see the comprehensive demo of MiniGUI Core and MiniGUI components, please fetch one of the following repositories from GitHub and follow the instructions to build MiniGUI Core, MiniGUI components, the samples, and the demonstration programs:
or
or
We recommend that you use a latest Linux distribution with long term support, for example, Ubuntu Linux LTS 16.04 or 18.04.
On Ubuntu Linux LTS 16.04 or 18.04, you should run apt install <package_name>
to install the following packages:
MiniGUI Core uses GNU autoconf/automake scripts to configure and build the project.
Run
$ ./configure; make; sudo make install
to configure, make, and install the headers and the libraries. If there is not configure
file, please run
$ ./autogen.sh
to generate the script.
MiniGUI Core also provides some configuration options to customize the features. For more information, please run
$ ./configure --help
Since MiniGUI 4.0.0, we organize the unit test code of MiniGUI APIs in the following repository:
https://gitlab.fmsoft.cn/VincentWei/mg-tests
If you are interested in hacking the MiniGUI code, please visit this repository.
Besides MiniGUI Core, FMSoft also provides some components for the developers to develop app much easier:
ColorSelectionDialogBox
, FileOpenDialogBox
, and so on.There are also some legacy MiniGUI components. But we will not maintain these components since MiniGUI v3.2.0:
FMSoft also releases some open source apps for MiniGUI on the site above, for examples:
mDolphin
, licensed under Apache 2.0, is a full-featured WEB/WAP browser, which is developed based on the open source browser core WebKit and uses MiniGUI as its underlying graphics support system.mGallery
, licensed under Apache 2.0, intends to provide a total solution for PMP (Portable Multimedia Player), which uses MiniGUI as the graphics platform.mSpider
, licensed under GPL 3.0, intends to provide a light-weight MiniGUI-based web browser (HTML 3.2 and part JavaScript)mEagle
, licensed under GPL 3.0, is an embedded GIS development platform which addresses the needs of map browse, query, analysis, etc21 years have pasted since MiniGUI was initially created at the end of 1998, and now it becomes much reliable and stable. During the past years, many remarkable changes have taken place in the MiniGUI project.
At the original, the version 0.2.xx was based on SVGALib and PThread (LinuxThreads). Then the version 0.3.xx had many enhanced features including Graphics Abstract Layer (GAL), Input Abstract Layer (IAL), and the support for multiple charsets and multiple fonts.
In version 1.0.00, we designed MiniGUI-Lite, which was more fit for some complex embedded systems, such as PDAs, Thin-Clients, or STBs. MiniGUI-Lite made the embedded systems more stable and efficient. The version 1.0.00 provided the native fbcon engine based on Linux frame buffer device directly as well.
In the development of version 1.1.00, we re-wrote the GAL and GDI interfaces, and provided some advanced video features, such as raster operation, transparent blitting, alpha blending, and video hardware acceleration. We also provided some important GDI functions, such as Ellipse, Arc, Polygon, and FloodFill.
In the development of version 1.6.0, we added advanced 2D graphics functions to MiniGUI. It provides the abstract logical pen and brush objects, and can be used to render advanced graphics objects.
In the development of version 2.0.x, we developed MiniGUI-Processes.
In the development of version 3.0.x, we introduced Look & Feel Renderer, BIDI text support, Non-rectangular window, double-buffer window, and other main features.
In the development of version 4.0.x, we introduced the support for complex writing systems (scripts), such as Arabic, Thai, and Indic.
In the development of version 5.0.x, we introduced some new and exciting features such as compositing schema and virtual window.
A brief history description of the development progress is listed as follow:
The original author of MiniGUI is WEI Yongming, and now MiniGUI is maintained by FMSoft. For more information, please refer to http://www.fmsoft.cn.
Copyright (C) 2002 ~ 2021, Beijing FMSoft Technologies Co., Ltd.
Copyright (C) 1998 ~ 2002, WEI Yongming
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Or,
As this program is a library, any link to this program must follow GNU General Public License version 3 (GPLv3). If you cannot accept GPLv3, you need to be licensed from FMSoft.
If you have got a commercial license of this program, please use it under the terms and conditions of the commercial license.
For more information about the commercial license, please refer to http://www.minigui.com/blog/minigui-licensing-policy/.
The above open source or free software license does not apply to any entity in the Exception List published by Beijing FMSoft Technologies Co., Ltd.
If you are or the entity you represent is listed in the Exception List, the above open source or free software license does not apply to you or the entity you represent. Regardless of the purpose, you should not use the software in any way whatsoever, including but not limited to downloading, viewing, copying, distributing, compiling, and running. If you have already downloaded it, you MUST destroy all of its copies.
The Exception List is published by FMSoft and may be updated from time to time. For more information, please see https://www.fmsoft.cn/exception-list.
As stated above, MiniGUI and its components are licensed under GPL. So any links about MiniGUI must follow GPL. If you cannot accept GPL, you need to be licensed from FMSoft.
We provide you the commercial license of MiniGUI according to the number of the run-time binary copies of MiniGUI. If you are interested in the commercial license of MiniGUI, please write to sales. @min igui. com
Q: Which operating systems does MiniGUI support?
A: MiniGUI can run on Linux/uClinux, uC/OS-II, eCos, ThreadX, pSOS, VxWorks, ThreadX, OSE, and even Win32. Any other real-time OSes can be supported theoretically.
Q: Which architecture does MiniGUI support?
A: x86 32/64-bit, ARM 32/64-bit (e.g., ARMv7 and ARM Cortex-A7), PowerPC, MIPS, DragonBall, ColdFire, Blackfin, and so on.
Q: Does MiniGUI offer the support for grey LCD with 4bpp (bits per pixel)?
A: Yes, it offers. It even offers the support for 1bpp and 2bpp LCD.
Q: Can I get the tech support from MiniGUI team?
A: Yes, FMSoft can provide you with guaranteed commercial technical support services. Please send messages to sales. @min igui. com