release version 4.0.2

This commit is contained in:
Vincent Wei
2019-10-31 11:29:24 +08:00
parent 991472894b
commit 38aa40042c
8 changed files with 301 additions and 282 deletions

114
README.md
View File

@@ -33,43 +33,37 @@ use.
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 VxWorks, ThreadX, Nucleus, pSOS, uC/OS-II,
and OSE.
traditional RTOSes, such as RT-Thread, FreeRTOS, RTEMS, VxWorks, ThreadX,
Nucleus, pSOS, uC/OS-II, and OSE.
This is the MiniGUI core source tree, which provides windowing
and graphics interfaces as well as a lot of standard controls (tookit).
and graphics interfaces as well as a lot of standard controls (toolkit).
Besides MiniGUI core, FMSoft also provides some components
for the developers to develop app much easier:
* mGUtils: A MiniGUI component which contains miscellaneous utilities
like ColorSelectionDialogBox, FileOpenDialogBox, and so on.
* mGPlus: A MiniGUI component which provides support for advanced graphics
functions like path, gradient, anti-aliase stretch, and color combination.
* mGEff: mGEff provides an animation framework for MiniGUI app.
It also provides some popular UI/UE special effects.
* mGNCS: This component provides a new control set for MiniGUI app.
* mGNCS4Touch: This component provides some new controls, which are
compliant to the new control API spec of mGNCS, for devices with
touch screens.
* mGUtils: A MiniGUI component which contains miscellaneous utilities
like `ColorSelectionDialogBox`, `FileOpenDialogBox`, and so on.
* mGPlus: A MiniGUI component which provides support for advanced graphics
functions like path, gradient, anti-aliased stretch, and color combination.
* mGEff: mGEff provides an animation framework for MiniGUI app.
It also provides some popular UI/UE special effects.
* mGNCS: This component provides a new control set for MiniGUI app.
* mGNCS4Touch: This component provides some new controls, which are
compliant to the new control API spec of mGNCS, for devices with
touch screens.
There are also some legacy MiniGUI components. But we will not maintain these
components since MiniGUI v3.2.0:
* mGi: An input method component for MiniGUI. This component provides
some typical input methods (such as softkey, hand-writing, and predict
text input for mobile phone) for MiniGUI apps.
* mGp: A printing component for MiniGUI. By using mGp, you can print
out the graphics created by MiniGUI app to general-purpose printers.
* mG3d: A simple three-dimension component for MiniGUI. This component
provides a simple 3D API for app. You can use mG3d to create simple
3D UI.
* mGi: An input method component for MiniGUI. This component provides
some typical input methods (such as soft keyboard, hand-writing, and predict
text input for mobile phone) for MiniGUI apps.
* mGp: A printing component for MiniGUI. By using mGp, you can print
out the graphics created by MiniGUI app to general-purpose printers.
* mG3d: A simple three-dimension component for MiniGUI. This component
provides a simple 3D API for app. You can use mG3d to create simple
3D UI.
MiniGUI is a free software project. In December 1998, the initiator of
FMSoft, Wei Yongming, began to develop MiniGUI under the GNU General Public
@@ -81,24 +75,21 @@ as a free software project.
You can download the source code tarball of MiniGUI and the dependent libraries
from the download zone of the site:
http://www.minigui.com
<http://www.minigui.com>
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, etc
* 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, etc
FMSoft had created the public repositories for MiniGUI core, MiniGUI
components, and other open source apps on GitHub. You can visit them on:
@@ -113,7 +104,6 @@ We now maintain all documents about MiniGUI on the following public repo:
<https://github.com/VincentWei/minigui-docs>
## A BRIEF BUILDING INSTRUCTION
This instruction assumes that you are using Ubuntu Linux.
@@ -179,37 +169,31 @@ If you are interested in hacking the MiniGUI code, please visit this repository.
In this version, we enhanced and tuned the APIs related to text rendering,
in order to support [HybridOS Foundation Class Library].
* Since 4.0.2, MiniGUI provides support for RTEMS, RT-Thread, and FreeRTOS.
* MiniGUI now provides complete APIs for Unicode characters processing.
These APIs conform to Unicode 12.0.
* MiniGUI also provides new APIs to lay out, shape, and render glyphs
from complex and mixed scripts, such as Arabic, Thai, and Indic.
* We tuned and optimized MiniGUI's logical and device font interfaces to
support the new features above.
* MiniGUI now is enhanced to support input events which may be generated
by input devices other than standard mouse (or single-touch panel) and
keyboard, such as multi-touch panel (gesture), joystick, tablet tool,
table pad, and switch. In MiniGUI 4.0, we introduce `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'.
* The NEWGAL engine of `dri` to support modern DRI/DRM-driven graphics cards
or GPUs on Linux.
* The IAL engine of `libinput` to support all modern input devices including
mouse, keyboard, joystick, switch, multiple touch panel, gesture, tablet tool,
and table pad on Linux.
* We introduced a Slice Memory Allocator for fast concurrent memory chunk
allocation.
* Cleanup and tune code for GCC 7.3.
For more information, please refer to `RELEASE-NOTES.md` file:
https://github.com/VincentWei/minigui/blob/master/RELEASE-NOTES.md
<https://github.com/VincentWei/minigui/blob/master/RELEASE-NOTES.md>
Because of the changes of some APIs, we recommended strongly that you
use this version for new projects.
@@ -224,26 +208,26 @@ We introduce some new features in MiniGUI Version 3.2.x:
For more information, please refer to `RELEASE-NOTES.md` file:
https://github.com/VincentWei/minigui/blob/rel-3-2/RELEASE-NOTES.md
<https://github.com/VincentWei/minigui/blob/rel-3-2/RELEASE-NOTES.md>
## THE RUNTIME MODES OF MINIGUI
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-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-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.
* `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
@@ -258,7 +242,7 @@ 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,
`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
@@ -445,7 +429,7 @@ A: x86 32/64-bit, ARM 32/64-bit (e.g., ARMv7 and ARM Cortex-A7),
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?
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@minigui.com>.

View File

@@ -1,21 +1,42 @@
# Release Notes
## Version 4.0.1
## Version 4.0.2
The MiniGUI development team announces the availability of MiniGUI 4.0.0.
The MiniGUI development team announces the availability of MiniGUI 4.0.2.
We strongly recommend that you use this version for any new MiniGUI
apps, especially if the new features of MiniGUI 4.0.0 are must for your
apps, especially if the new features of MiniGUI 4.0 are must for your
new apps.
Please report any bugs and incompatibilities in
https://github.com/VincentWei/minigui
<https://github.com/VincentWei/minigui>
### What's new in this version
* ENHANCEMENTS:
- Support for RTEMS operating system
- Basic support for RT-Thread and FreeRTOS operating systems.
* BUGFIXES:
- Fixed errors in makefile.ng files.
* CLEANUP:
- `README.md` for correct markdown tags.
## Version 4.0.1
The MiniGUI development team announces the availability of MiniGUI 4.0.1.
We strongly recommend that you use this version for any new MiniGUI
apps, especially if the new features of MiniGUI 4.0 are must for your
new apps.
Please report any bugs and incompatibilities in
<https://github.com/VincentWei/minigui>
### What's new in this version
This version mainly fixed some minor issues:
- Use FVN algorithm to implement Str2Key.
- Use FVN algorithm to implement `Str2Key`.
- Tune some API description.
- Tune format string to use '%z' instead of '%l' or '%ll' for `size_t` values.
@@ -28,7 +49,7 @@ new apps.
Please report any bugs and incompatibilities in
https://github.com/VincentWei/minigui
<https://github.com/VincentWei/minigui>
### What's new in this version
@@ -290,7 +311,7 @@ run MiniGUI apps on a Linux box on which the DRI
The `dri` engine uses `libdrm` developed by Free Desktop project:
https://dri.freedesktop.org/wiki/
<https://dri.freedesktop.org/wiki/>
Libdrm is a user-space library implements the Direct Rendering Manager.
MiniGUI mainly uses this library to support the dumb frame buffer
@@ -841,38 +862,38 @@ The MiniGUI development team announces the availability of MiniGUI 3.0.13.
All users of MiniGUI are encouraged to test this version carefully, and
report any bugs and incompatibilities in
https://github.com/VincentWei/minigui.
<https://github.com/VincentWei/minigui>.
### What's new in this version
* Merge new APIs which are introduced by miniStudio.
* The autoconf/automake config scripts are cleaned up.
* Remove most of compilation warnings (not used variables).
* Remove some inline function definitions, especially GetIMEPos/SetIMEPos.
* Fix some bugs.
* Merge new APIs which are introduced by miniStudio.
* The autoconf/automake config scripts are cleaned up.
* Remove most of compilation warnings (not used variables).
* Remove some inline function definitions, especially GetIMEPos/SetIMEPos.
* Fix some bugs.
### API changes
* [NEW] CopyCursor: Copies a cursor object.
* [NEW] GetKeyboardState: Gets status of all keys on keyboard.
* [NEW] ToUnicode/ToAscii: Converts the key code between Unicode and ASCII.
* [NEW] GetWindowRegion: The function obtains a copy of the window region of a window.
* [NEW] InvalidateRegion: Invalidates the client area within the specified region.
* [NEW] ValidateRect: Validates the client area within a rectangle by removing the
rectangle from the update region of the specified window.
* [NEW] ValidateRegion: Validates the client area within a region by removing the
region from the current update region of the specified window.
* [NEW] GetUpdateRegion: Copy the update region of a window to a region.
* [NEW] AdjustWindowRectEx: Calculates the required size of the window rectangle
based on the desired size of the client rectangle.
* [NEW] WindowFromPointEx: Retrieves a handle to the window that contains the specified point.
* [NEW] ChildWindowFromPointEx: Retrieves a handle to the child window that contains the
speicified point and meets the certain criteria.
* [NEW] ScrollWindowEx: Scrolls the content of a window's client area.
* [ADJUST] GetIMEPos/SetIMEPos: inline functions -> normal functions.
* [ADJUST] WindowFromPoint: normal function -> inline function.
* [ADJUST] ChildWindowFromPoint: normal function -> inline function.
* [ADJUST] ScrollWindow: normal function -> inline function.
* [NEW] CopyCursor: Copies a cursor object.
* [NEW] GetKeyboardState: Gets status of all keys on keyboard.
* [NEW] ToUnicode/ToAscii: Converts the key code between Unicode and ASCII.
* [NEW] GetWindowRegion: The function obtains a copy of the window region of a window.
* [NEW] InvalidateRegion: Invalidates the client area within the specified region.
* [NEW] ValidateRect: Validates the client area within a rectangle by removing the
rectangle from the update region of the specified window.
* [NEW] ValidateRegion: Validates the client area within a region by removing the
region from the current update region of the specified window.
* [NEW] GetUpdateRegion: Copy the update region of a window to a region.
* [NEW] AdjustWindowRectEx: Calculates the required size of the window rectangle
based on the desired size of the client rectangle.
* [NEW] WindowFromPointEx: Retrieves a handle to the window that contains the specified point.
* [NEW] ChildWindowFromPointEx: Retrieves a handle to the child window that contains the
speicified point and meets the certain criteria.
* [NEW] ScrollWindowEx: Scrolls the content of a window's client area.
* [ADJUST] GetIMEPos/SetIMEPos: inline functions -> normal functions.
* [ADJUST] WindowFromPoint: normal function -> inline function.
* [ADJUST] ChildWindowFromPoint: normal function -> inline function.
* [ADJUST] ScrollWindow: normal function -> inline function.
## Version 3.0.2
@@ -885,48 +906,48 @@ https://github.com/VincentWei/minigui.
### What's new in this version
* Append non-rectangle window support.
* Append support of double buffer of maindow.
* Support for Look and Feel (LF) concept.
* Remove SKIN interfaces of MGExt library, move MGExt library and vcongui into mGUtils component.
* Newly added bitmap font.
* Developing interfaces of desktop for MiniGUI.
* Support direct draw to DC for higher efficiency.
* Enhancement of resource management
* Enhancement of controls: Support of independent scrollbar and transparent control.
* Enhancement of font and character set, support bidi text support.
* Enhancement of zoom of picture
* Append non-rectangle window support.
* Append support of double buffer of maindow.
* Support for Look and Feel (LF) concept.
* Remove SKIN interfaces of MGExt library, move MGExt library and vcongui into mGUtils component.
* Newly added bitmap font.
* Developing interfaces of desktop for MiniGUI.
* Support direct draw to DC for higher efficiency.
* Enhancement of resource management
* Enhancement of controls: Support of independent scrollbar and transparent control.
* Enhancement of font and character set, support bidi text support.
* Enhancement of zoom of picture
### API changes
* [NEW] ScaleBitmapEx: a bilinear interpolation algorithm which is better than the original.
* [NEW] GetWindowInfo: get New structure WINDOWINFO.
* [NEW] CreateMainWindowEx: enhance of CreeateMainWindow, compatiable with CreeateMainWindow.
* [NEW] CreateWindowEx2enhance of CreateWindowEx2, compatiable with CreateWindowEx2.
* [NEW] DialogBoxIndirectParamEx: new create dialog.
* [NEW] CreateMainWindowIndirectParamEx:new create dialog.
* [NEW] GetWindowRendererFromName: get LF renderer by name
* [NEW] AddWindowElementRenderer: append a LF renderer to MiniGU
* [NEW] RemoveWindowElementRenderer: delete a LF renderer from MiniG
* [NEW] GetDefaultWindowElementRenderer: get default LF renderer
* [NEW] SetDefaultWindowElementRenderer: set default LF renderer
* [NEW] SetWindowElementRenderer: set a LF renderer for one windows render
* [NEW] SetWindowElementAttr: set windows attributes.
* [NEW] GetWindowElementAttr: get windows attributes value
* [NEW] CreateBMPDevFont: create an bitmap device font.
* [NEW] AddGlyphsToBMPFont: add an bitmap font glyph.
* [NEW] DestroyBMPFont: destroy bitmap device font.
* [NEW] SetCustomDesktopOperationSet: set the custom desktop operation set.
* [NEW] DesktopUpdateAllWindow: refresh all windows on the desktop.
* [NEW] PopupDesktopMenu: pop up a menu on the desktop
* [NEW] GetTextAlign: get the current text-alignment flags of a DC.
* [NEW] SetTextAlign: set text-alignment flags of a DC.
* [NEW] SetWindowMask: set non-rectangle window mask rect.
* [NEW] SetWindowRegion: set non-rectangle window visible region
* [NEW] LockDCEx: support for directly read and write the pixels in a DC.
* [NEW] CreateSecondaryDC: Creates a secondary window DC of a window.
* [NEW] SetSecondaryDC:set a window's secondary DC and the callback for double buffer window.
* [NEW] ScaleBitmapEx: a bilinear interpolation algorithm which is better than the original.
* [NEW] GetWindowInfo: get New structure WINDOWINFO.
* [NEW] CreateMainWindowEx: enhance of CreeateMainWindow, compatiable with CreeateMainWindow.
* [NEW] CreateWindowEx2enhance of CreateWindowEx2, compatiable with CreateWindowEx2.
* [NEW] DialogBoxIndirectParamEx: new create dialog.
* [NEW] CreateMainWindowIndirectParamEx:new create dialog.
* [NEW] GetWindowRendererFromName: get LF renderer by name
* [NEW] AddWindowElementRenderer: append a LF renderer to MiniGU
* [NEW] RemoveWindowElementRenderer: delete a LF renderer from MiniG
* [NEW] GetDefaultWindowElementRenderer: get default LF renderer
* [NEW] SetDefaultWindowElementRenderer: set default LF renderer
* [NEW] SetWindowElementRenderer: set a LF renderer for one windows render
* [NEW] SetWindowElementAttr: set windows attributes.
* [NEW] GetWindowElementAttr: get windows attributes value
* [NEW] CreateBMPDevFont: create an bitmap device font.
* [NEW] AddGlyphsToBMPFont: add an bitmap font glyph.
* [NEW] DestroyBMPFont: destroy bitmap device font.
* [NEW] SetCustomDesktopOperationSet: set the custom desktop operation set.
* [NEW] DesktopUpdateAllWindow: refresh all windows on the desktop.
* [NEW] PopupDesktopMenu: pop up a menu on the desktop
* [NEW] GetTextAlign: get the current text-alignment flags of a DC.
* [NEW] SetTextAlign: set text-alignment flags of a DC.
* [NEW] SetWindowMask: set non-rectangle window mask rect.
* [NEW] SetWindowRegion: set non-rectangle window visible region
* [NEW] LockDCEx: support for directly read and write the pixels in a DC.
* [NEW] CreateSecondaryDC: Creates a secondary window DC of a window.
* [NEW] SetSecondaryDC:set a window's secondary DC and the callback for double buffer window.
[HybridOS]: https://github.com/FMSoftCN/hybridos

View File

@@ -1,4 +1,4 @@
Version 4.0.2 (2019/11/30)
Version 4.0.2 (2019/10/31)
This release needs the following resource packages:

View File

@@ -62,7 +62,7 @@ dnl ========================================================================
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_DIRENT
AC_CHECK_HEADERS(sys/types.h sys/time.h termio.h unistd.h math.h locale.h)
AC_CHECK_HEADERS(limits.h math.h locale.h unistd.h termio.h sys/types.h sys/time.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST

View File

@@ -1963,7 +1963,7 @@ typedef struct _GAL_Rect {
#endif
/* Commonly used definitions */
#if !defined(__NOUNIX__) || defined (__ECOS__)
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif

View File

@@ -11,35 +11,35 @@
//
//////////////////////////////////////////////////////////////////////////////
/*
* This file is part of MiniGUI, a mature cross-platform windowing
* This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
*
* Copyright (C) 2002~2018, 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/en/about/licensing-policy/>.
*/
@@ -47,15 +47,17 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#ifdef _MGIAL_NET
#include <linux/input.h>
#include <unistd.h>
#include <fcntl.h>
#include "mgconfig.h"
#include "common.h"
#include "minigui.h"
#include "netial.h"
#ifdef _MGIAL_NET
#include <sys/ioctl.h>
#include <sys/poll.h>
@@ -86,9 +88,9 @@ typedef struct {
typedef struct
{
int x;
int y;
int pressure;
int x;
int y;
int pressure;
}MOUSE_EVENT;
static int mousex = 0;
@@ -120,15 +122,15 @@ static int mouse_update(void)
static void mouse_getxy(int *x, int* y)
{
if (mousex < 0)
mousex = 0;
if (mousex > g_rcScr.right)
mousex = g_rcScr.right;
if (mousex < 0)
mousex = 0;
if (mousex > g_rcScr.right)
mousex = g_rcScr.right;
if (mousey < 0)
mousey = 0;
if (mousey > g_rcScr.bottom)
mousey = g_rcScr.bottom;
if (mousey < 0)
mousey = 0;
if (mousey > g_rcScr.bottom)
mousey = g_rcScr.bottom;
*x = mousex;
*y = mousey;
}
@@ -161,98 +163,98 @@ static int wait_event (int which, int maxfd, fd_set *in, fd_set *out, fd_set *ex
e = select (FD_SETSIZE, in, out, except, timeout) ;
#endif
if (e > 0)
{
if (temp_sock_descriptor >= 0 && FD_ISSET (temp_sock_descriptor, in))
{
FD_CLR (temp_sock_descriptor, in);
n = recv (temp_sock_descriptor, event_buf, 100, 0);
if (n == 0)
{
printf ("recv == 0\n");
exit (1);
}
if (n == sizeof (MOUSE_EVENT)/sizeof (char))
{
mouse_event = (MOUSE_EVENT*)event_buf;
mousex += mouse_event->x * 2;
mousey += mouse_event->y * 2;
switch (mouse_event->pressure)
{
case 1:
ts_event.pressure = IAL_MOUSE_LEFTBUTTON;
break;
case 2:
ts_event.pressure = IAL_MOUSE_RIGHTBUTTON;
break;
case 0:
ts_event.pressure = 0;
break;
}
return IAL_MOUSEEVENT;
}
}
}
else if (e < 0)
{
return -1;
}
if (e > 0)
{
if (temp_sock_descriptor >= 0 && FD_ISSET (temp_sock_descriptor, in))
{
FD_CLR (temp_sock_descriptor, in);
n = recv (temp_sock_descriptor, event_buf, 100, 0);
if (n == 0)
{
printf ("recv == 0\n");
exit (1);
}
if (n == sizeof (MOUSE_EVENT)/sizeof (char))
{
mouse_event = (MOUSE_EVENT*)event_buf;
mousex += mouse_event->x * 2;
mousey += mouse_event->y * 2;
switch (mouse_event->pressure)
{
case 1:
ts_event.pressure = IAL_MOUSE_LEFTBUTTON;
break;
case 2:
ts_event.pressure = IAL_MOUSE_RIGHTBUTTON;
break;
case 0:
ts_event.pressure = 0;
break;
}
return IAL_MOUSEEVENT;
}
}
}
else if (e < 0)
{
return -1;
}
return 0;
return 0;
}
BOOL InitNetInput (INPUT* input, const char* mdev, const char* mtype)
{
sock_descriptor = socket (AF_INET, SOCK_STREAM, 0);
if (sock_descriptor == -1)
{
perror ("call to socket");
exit (1);
}
sock_descriptor = socket (AF_INET, SOCK_STREAM, 0);
if (sock_descriptor == -1)
{
perror ("call to socket");
exit (1);
}
bzero (&sin, sizeof (sin));
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_port = htons (port);
bzero (&sin, sizeof (sin));
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = INADDR_ANY;
sin.sin_port = htons (port);
if (bind (sock_descriptor, (struct sockaddr*)&sin, sizeof (sin)) == -1)
{
perror("call to bind");
exit (1);
}
if (bind (sock_descriptor, (struct sockaddr*)&sin, sizeof (sin)) == -1)
{
perror("call to bind");
exit (1);
}
if (listen (sock_descriptor, 20) == -1)
{
perror ("call to listen");
exit (1);
}
printf ("Please start the PC side of the client process.\n");
if (listen (sock_descriptor, 20) == -1)
{
perror ("call to listen");
exit (1);
}
printf ("Please start the PC side of the client process.\n");
temp_sock_descriptor = accept (sock_descriptor, (struct sockaddr *)&pin, &address_size);
if (temp_sock_descriptor == -1)
{
perror ("call to accept");
exit (1);
}
temp_sock_descriptor = accept (sock_descriptor, (struct sockaddr *)&pin, &address_size);
if (temp_sock_descriptor == -1)
{
perror ("call to accept");
exit (1);
}
input->update_mouse = mouse_update;
input->get_mouse_xy = mouse_getxy;
input->set_mouse_xy = NULL;
input->get_mouse_button = mouse_getbutton;
input->set_mouse_range = NULL;
input->update_keyboard = NULL;
input->update_keyboard = NULL;
input->get_keyboard_state = NULL;
input->wait_event = wait_event;
return TRUE;
}
void TermNetInput(void)
{
if (temp_sock_descriptor >= 0)
close(temp_sock_descriptor);
close(temp_sock_descriptor);
}
#endif /* _MGIAL_NET */

View File

@@ -11,35 +11,35 @@
//
//////////////////////////////////////////////////////////////////////////////
/*
* This file is part of MiniGUI, a mature cross-platform windowing
* This file is part of MiniGUI, a mature cross-platform windowing
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
*
* Copyright (C) 2002~2018, 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/en/about/licensing-policy/>.
*/
@@ -205,8 +205,8 @@ void mg_DestroyMsgQueue (PMSGQUEUE pMsgQueue)
}
/*
* hWnd may belong to a different thread,
* so this function should be thread-safe
* hWnd may belong to a different thread,
* so this function should be thread-safe
*/
PMSGQUEUE kernel_GetMsgQueue (HWND hWnd)
{
@@ -230,7 +230,7 @@ BOOL kernel_QueueMessage (PMSGQUEUE msg_que, PMSG msg)
msg->time = __mg_timer_counter;
/* check for the duplicated messages */
if (msg->message == MSG_MOUSEMOVE
if (msg->message == MSG_MOUSEMOVE
|| msg->message == MSG_NCMOUSEMOVE
|| msg->message == MSG_DT_MOUSEMOVE) {
int readpos = msg_que->readpos;
@@ -255,7 +255,7 @@ BOOL kernel_QueueMessage (PMSGQUEUE msg_que, PMSG msg)
goto ret;
}
}
else if (msg->message == MSG_TIMEOUT
else if (msg->message == MSG_TIMEOUT
|| msg->message == MSG_IDLE
|| msg->message == MSG_CARETBLINK) {
int readpos = msg_que->readpos;
@@ -264,7 +264,7 @@ BOOL kernel_QueueMessage (PMSGQUEUE msg_que, PMSG msg)
while (readpos != msg_que->writepos) {
a_msg = msg_que->msg + readpos;
if (a_msg->message == msg->message
if (a_msg->message == msg->message
&& a_msg->hwnd == msg->hwnd) {
a_msg->wParam = msg->wParam;
a_msg->lParam = msg->lParam;
@@ -335,7 +335,7 @@ HWND kernel_CheckInvalidRegion (PMAINWIN pWin)
static PMAINWIN msgGetHostingRoot (PMAINWIN pHosted)
{
PMAINWIN pHosting;
pHosting = pHosted->pHosting;
if (pHosting)
return msgGetHostingRoot (pHosting);
@@ -405,9 +405,9 @@ BOOL GUIAPI HavePendingMessageEx (HWND hWnd, BOOL bNoDeskTimer)
if (pMsgQueue->TimerMask)
goto retok;
#ifndef _MGRM_THREADS
/*
/*
* FIXME
* We do not need to check QS_DESKTIMER, because it is for the
* We do not need to check QS_DESKTIMER, because it is for the
* desktop window, and user don't care it.
*/
if (!bNoDeskTimer && (pMsgQueue->dwState & QS_DESKTIMER)) {
@@ -435,7 +435,7 @@ BOOL GUIAPI HavePendingMessage (HWND hWnd)
int GUIAPI BroadcastMessage (UINT nMsg, WPARAM wParam, LPARAM lParam)
{
MSG msg;
msg.message = nMsg;
msg.wParam = wParam;
msg.lParam = lParam;
@@ -462,7 +462,7 @@ const char* GUIAPI Message2Str (UINT message)
return "MSG_USER";
}
void GUIAPI PrintMessage (FILE* fp, HWND hWnd,
void GUIAPI PrintMessage (FILE* fp, HWND hWnd,
UINT nMsg, WPARAM wParam, LPARAM lParam)
{
fprintf (fp, "Message %s: hWnd: %p, wP: %p, lP: %p.\n",
@@ -473,9 +473,9 @@ void GUIAPI PrintMessage (FILE* fp, HWND hWnd,
static inline void CheckCapturedMouseMessage (PMSG pMsg)
{
if (__mg_capture_wnd == pMsg->hwnd
&& pMsg->message >= MSG_FIRSTMOUSEMSG
&& pMsg->message <= MSG_LASTMOUSEMSG
if (__mg_capture_wnd == pMsg->hwnd
&& pMsg->message >= MSG_FIRSTMOUSEMSG
&& pMsg->message <= MSG_LASTMOUSEMSG
&& !(pMsg->wParam & KS_CAPTURED)) {
int x, y;
x = LOSWORD (pMsg->lParam);
@@ -493,7 +493,7 @@ static inline void CheckCapturedMouseMessage (PMSG pMsg)
(nMsgFilterMin > 0 && nMsgFilterMax >= nMsgFilterMin && \
message >= nMsgFilterMin && message <= nMsgFilterMax) )
BOOL PeekMessageEx (PMSG pMsg, HWND hWnd, UINT nMsgFilterMin, UINT nMsgFilterMax,
BOOL PeekMessageEx (PMSG pMsg, HWND hWnd, UINT nMsgFilterMin, UINT nMsgFilterMax,
BOOL bWait, UINT uRemoveMsg)
{
PMSGQUEUE pMsgQueue;
@@ -537,7 +537,7 @@ checkagain:
pMsgQueue->dwState &= ~QS_QUIT;
}
}
UNLOCK_MSGQ (pMsgQueue);
return FALSE;
}
@@ -614,7 +614,7 @@ checkagain:
PMAINWIN pHostingRoot;
HWND hNeedPaint;
PMAINWIN pWin;
#ifdef _MGRM_THREADS
/* REMIND this */
if (hWnd == HWND_DESKTOP) {
@@ -650,7 +650,7 @@ checkagain:
UNLOCK_MSGQ (pMsgQueue);
return TRUE;
}
/* no paint message */
pMsgQueue->dwState &= ~QS_PAINT;
}
@@ -719,7 +719,7 @@ checkagain:
UNLOCK_MSGQ (pMsgQueue);
/* calling the timer callback procedure */
ret_timer_proc = timer->proc (timer->hWnd,
ret_timer_proc = timer->proc (timer->hWnd,
timer->id, timer->tick_count);
/* lock the message queue again */
@@ -730,7 +730,7 @@ checkagain:
__mg_remove_timer (timer, slot);
}
UNLOCK_MSGQ (pMsgQueue);
goto checkagain;
goto checkagain;
}
else {
pMsg->message = MSG_TIMER;
@@ -765,17 +765,17 @@ checkagain:
return FALSE;
}
/*
/*
The following two functions are moved to window.h as inline functions.
int GUIAPI GetMessage (PMSG pMsg, HWND hWnd)
{
return PeekMessageEx (pMsg, hWnd, 0, 0, TRUE, PM_REMOVE);
}
BOOL GUIAPI PeekMessage (PMSG pMsg, HWND hWnd, UINT nMsgFilterMin,
BOOL GUIAPI PeekMessage (PMSG pMsg, HWND hWnd, UINT nMsgFilterMin,
UINT nMsgFilterMax, UINT uRemoveMsg)
{
return PeekMessageEx (pMsg, hWnd, nMsgFilterMin, nMsgFilterMax,
return PeekMessageEx (pMsg, hWnd, nMsgFilterMin, nMsgFilterMax,
FALSE, uRemoveMsg);
}
*/
@@ -826,7 +826,7 @@ checkagain:
if (pMsgQueue->dwState & QS_PAINT) {
goto getit;
}
#ifndef _MGRM_THREADS
if (pMsgQueue->dwState & QS_DESKTIMER) {
goto getit;
@@ -853,7 +853,7 @@ getit:
return TRUE;
}
BOOL GUIAPI PeekPostMessage (PMSG pMsg, HWND hWnd, UINT nMsgFilterMin,
BOOL GUIAPI PeekPostMessage (PMSG pMsg, HWND hWnd, UINT nMsgFilterMin,
UINT nMsgFilterMax, UINT uRemoveMsg)
{
PMSGQUEUE pMsgQueue;
@@ -869,7 +869,7 @@ BOOL GUIAPI PeekPostMessage (PMSG pMsg, HWND hWnd, UINT nMsgFilterMin,
memset (pMsg, 0, sizeof(MSG));
if (pMsgQueue->dwState & QS_POSTMSG) {
if (pMsgQueue->readpos != pMsgQueue->writepos) {
pPostMsg = pMsgQueue->msg + pMsgQueue->readpos;
@@ -882,7 +882,7 @@ BOOL GUIAPI PeekPostMessage (PMSG pMsg, HWND hWnd, UINT nMsgFilterMin,
UNLOCK_MSGQ (pMsgQueue);
return FALSE;
}
SET_PADD (NULL);
if (uRemoveMsg == PM_REMOVE) {
@@ -915,7 +915,7 @@ LRESULT GUIAPI SendMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
if (!BE_THIS_THREAD(hWnd))
return SendSyncMessage (hWnd, nMsg, wParam, lParam);
#endif
if ( !(WndProc = GetWndProc(hWnd)) )
return ERR_INV_HWND;
@@ -933,7 +933,7 @@ LRESULT SendTopNotifyMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam
if (!(pMsgQueue = kernel_GetMsgQueue(hWnd)))
return ERR_INV_HWND;
pqmsg = QMSGAlloc();
LOCK_MSGQ (pMsgQueue);
@@ -973,7 +973,7 @@ int GUIAPI SendNotifyMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam
if (!(pMsgQueue = kernel_GetMsgQueue(hWnd)))
return ERR_INV_HWND;
pqmsg = QMSGAlloc();
LOCK_MSGQ (pMsgQueue);
@@ -1091,7 +1091,7 @@ LRESULT GUIAPI DispatchMessage (PMSG pMsg)
sem_post (pSyncMsg->sem_handle);
}
#endif
#ifdef _MGHAVE_TRACE_MSG
if (pMsg->message != MSG_TIMEOUT && pMsg->message != MSG_CARETBLINK) {
fprintf (stderr, "Message %u (%s) has been thrown away.\n",
@@ -1157,11 +1157,11 @@ int GUIAPI ThrowAwayMessages (HWND hWnd)
if (pMsgQueue->pFirstNotifyMsg) {
pQMsg = pMsgQueue->pFirstNotifyMsg;
while (pQMsg) {
pMsg = &pQMsg->Msg;
if (pMsg->hwnd == hWnd || gui_GetMainWindowPtrOfControl (pMsg->hwnd)
if (pMsg->hwnd == hWnd || gui_GetMainWindowPtrOfControl (pMsg->hwnd)
== (PMAINWIN)hWnd) {
pMsg->hwnd = HWND_INVALID;
nCountN ++;
@@ -1179,7 +1179,7 @@ int GUIAPI ThrowAwayMessages (HWND hWnd)
if (pMsgQueue->pFirstSyncMsg) {
PSYNCMSG pSyncMsg, pSyncPrev = NULL;
pSyncMsg = pMsgQueue->pFirstSyncMsg;
while (pSyncMsg) {
pMsg = &pSyncMsg->Msg;
@@ -1188,8 +1188,8 @@ int GUIAPI ThrowAwayMessages (HWND hWnd)
pMsg->hwnd = HWND_INVALID;
nCountS ++;
/*
* notify the waiting thread and remove the node from
/*
* notify the waiting thread and remove the node from
* msg queue
*/
pSyncMsg->retval = ERR_MSG_CANCELED;
@@ -1211,7 +1211,7 @@ int GUIAPI ThrowAwayMessages (HWND hWnd)
pSyncMsg = pSyncMsg->pNext;
}
}
#ifdef _DEBUG_TAM
printf ("ThrowAwayMessages: %d sync messages thrown\n", nCountS);
#endif
@@ -1227,7 +1227,7 @@ int GUIAPI ThrowAwayMessages (HWND hWnd)
pMsg->hwnd = HWND_INVALID;
nCountP ++;
}
readpos++;
#if 0
if (readpos >= pMsgQueue->len) readpos = 0;
@@ -1303,7 +1303,7 @@ LRESULT SendSyncMessage (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
return ERR_INV_HWND;
#define _SYNC_NEED_REENTERABLE
#ifndef _SYNC_NEED_REENTERABLE
#ifndef _SYNC_NEED_REENTERABLE
if ((thinfo = GetMsgQueueThisThread ())) {
/* avoid to create a new semaphore object, Note: it's not reenterable.*/
SyncMsg.sem_handle = &thinfo->sync_msg;
@@ -1330,7 +1330,7 @@ LRESULT SendSyncMessage (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
SyncMsg.pNext = NULL;
#if 1
/* add by houhh 20081030, deal with itself's SyncMsg first before
/* add by houhh 20081030, deal with itself's SyncMsg first before
* SendSyncMessage to other thread, because other thread maybe wait
* for SyncMsg for you.*/
if (thinfo) {
@@ -1379,11 +1379,11 @@ LRESULT SendSyncMessage (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
/* suspend until the message has been handled. */
if (sem_wait (SyncMsg.sem_handle) < 0) {
fprintf (stderr,
fprintf (stderr,
"KERNEL>SendSyncMessage: thread is interrupted abnormally!\n");
}
#ifndef _SYNC_NEED_REENTERABLE
#ifndef _SYNC_NEED_REENTERABLE
if (thinfo == NULL)
sem_destroy (&sync_msg);
#else
@@ -1406,7 +1406,7 @@ LRESULT GUIAPI PostSyncMessage (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lPara
LRESULT GUIAPI SendAsyncMessage (HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam)
{
WNDPROC WndProc;
MG_CHECK_RET (MG_IS_WINDOW(hWnd), -1);
if (!(WndProc = GetWndProc(hWnd)))

View File

@@ -407,6 +407,11 @@ unsigned int __mg_os_get_random_seed (void)
return 0;
#elif defined (__UCOSII__)
return 0;
#elif defined (__RTTHREAD__)
// rt_tick_t rt_tick_get(void);
unsigned int rt_tick_get(void);
return rt_tick_get();
#elif defined (__FREERTOS__)
#else
/*other os use time, for example: linux, OSE, etc.*/
return time (NULL);
@@ -425,7 +430,7 @@ void __mg_os_time_delay (int ms)
OSTimeDly (OS_TICKS_PER_SEC * ms / 1000);
#elif defined (__VXWORKS__)
taskDelay (sysClkRateGet() * ms / 1000);
#elif defined (__PSOS__) || defined (__ECOS__)
#elif defined (__PSOS__) || defined (__ECOS__) || defined (__RTEMS__)
struct timespec ts;
ts.tv_sec = 0;
ts.tv_nsec = ms * 1000000;
@@ -439,6 +444,13 @@ void __mg_os_time_delay (int ms)
NU_Sleep (ms/10);
#elif defined (__OSE__)
delay(ms);
#elif defined (__RTTHREAD__)
// rt_err_t rt_thread_mdelay(rt_int32_t ms);
extern int rt_thread_mdelay(int ms);
rt_thread_mdelay(ms);
#elif defined (__FREERTOS__)
#else
#error "Please implement __mg_os_time_delay for your OS"
#endif
}