Compare commits

..
194 changed files with 15133 additions and 8080 deletions
-3
View File
@@ -10,7 +10,6 @@ Makefile
Makefile.in Makefile.in
.deps/ .deps/
.libs/ .libs/
m4/*.m4
/acinclude.m4 /acinclude.m4
/aclocal.m4 /aclocal.m4
/autom4te.cache /autom4te.cache
@@ -22,7 +21,6 @@ m4/*.m4
/depcomp /depcomp
/install-sh /install-sh
/libtool /libtool
/ltmain.sh
/*.pc /*.pc
/*config.h /*config.h
/*config.h.in /*config.h.in
@@ -31,4 +29,3 @@ m4/*.m4
/src/font/utils/ucd/ /src/font/utils/ucd/
/src/sysres/font_list /src/sysres/font_list
/src/sysres/license/dat_files/ /src/sysres/license/dat_files/
/configure~
-2
View File
@@ -1,5 +1,3 @@
ACLOCAL_AMFLAGS = -I m4
SUBDIRS = src 3rd-party include rtos etc m4 cmake build SUBDIRS = src 3rd-party include rtos etc m4 cmake build
EXTRA_DIST = minigui.pc.in \ EXTRA_DIST = minigui.pc.in \
+61 -77
View File
File diff suppressed because it is too large Load Diff
-163
View File
@@ -1,21 +1,5 @@
# Release Notes # Release Notes
- [Version 5.0.16](#version-5016)
+ [What's new in version 5.0.16](#whats-new-in-version-5016)
- [Version 5.0.15](#version-5015)
+ [What's new in version 5.0.15](#whats-new-in-version-5015)
- [Version 5.0.13](#version-5013)
+ [What's new in version 5.0.13](#whats-new-in-version-5013)
- [Version 5.0.12](#version-5012)
+ [What's new in version 5.0.12](#whats-new-in-version-5012)
- [Version 5.0.11](#version-5011)
+ [What's new in version 5.0.11](#whats-new-in-version-5011)
- [Version 5.0.10](#version-5010)
+ [What's new in version 5.0.10](#whats-new-in-version-5010)
- [Version 5.0.9](#version-508)
+ [What's new in version 5.0.9](#whats-new-in-version-508)
- [Version 5.0.8](#version-508)
+ [What's new in version 5.0.8](#whats-new-in-version-508)
- [Version 5.0.6](#version-506) - [Version 5.0.6](#version-506)
+ [What's new in version 5.0.6](#whats-new-in-version-506) + [What's new in version 5.0.6](#whats-new-in-version-506)
- [Version 5.0.5](#version-505) - [Version 5.0.5](#version-505)
@@ -36,153 +20,6 @@
+ [Changes leading to incompatibility](#changes-leading-to-incompatibility) + [Changes leading to incompatibility](#changes-leading-to-incompatibility)
+ [Deprecated APIs](#deprecated-apis) + [Deprecated APIs](#deprecated-apis)
## Version 5.0.16
On May 27, 2025, FMSoft announces the availability of MiniGUI 5.0.16,
which is a bugfix release with some minor enhancements of MiniGUI 5.0.x.
* BUGFIXING:
- The desktop thread can not handle the request from other threads as soon as possible.
- The `MSG_TIMEOUT` message can not be fired correctly under MiniGUI-Threads mode.
- Bad subpixel rendering when background color is RGBA0000.
* TUNING:
- Tune `configure.ac` and `Makefile.am` to use the system libtool scripts.
- Do not check `pciaccess` if the target architecture is not `i386`.
## Version 5.0.15
On May 09, 2025, FMSoft announces the availability of MiniGUI 5.0.15,
which is an enhancement release with some minor enhancements
of MiniGUI 5.0.x.
* ENHANCEMENTS:
- Optimize NEWGAL engines: `shadow`, `drm`, and `fbcon` for large resolution.
- New APIs: `GetWindowSharedSurfaceFD()` and `CreateMemDCFromSharedSurfaceFD()` for compositing schema.
* CHANGES:
- The operations for DRM userland driver changed.
## Version 5.0.13
On Aug. 31, 2023, FMSoft announces the availability of MiniGUI 5.0.13,
which is an enhancement release with some minor enhancements
of MiniGUI 5.0.x.
### What's new in version 5.0.13
In this version, we made some enhancements:
* ENHANCEMENTS:
- Disable BIDI for text in UTF-8 charset by default.
* CHANGES:
- Add `BIDI_FLAG_NONE` and `BIDI_FLAG_LEGACY`.
* BUGFIXING:
- Ignore C0CTRL characters when renerding text.
- Support for vowels.
## Version 5.0.12
On May 10, 2023, FMSoft announces the availability of MiniGUI 5.0.12,
which is an enhancement release with some minor enhancements
of MiniGUI 5.0.x.
### What's new in version 5.0.12
In this version, we made some enhancements:
* ENHANCEMENTS:
- Add new API `GetACharsExtentPointEx()`.
- Add new APIs `GetTabbedACharsExtent()`, `GetTabbedACharsExtentPoint()`,
and `GetTabbedACharsExtentPointEx()`.
- Enhance two APIs `GetTextExtentPoint()` and `GetTabbedTextExtentPoint()`
to support BIDI charsets.
- Tune management of tick count.
* BUGFIXING:
- Fix a typo: `Achar2UChar()` to `AChar2UChar()`.
## Version 5.0.11
On Dec. 31, 2022, FMSoft announces the availability of MiniGUI 5.0.11,
which is a bug fixing release with bug fixes and some minor enhancements
of MiniGUI 5.0.x.
### What's new in version 5.0.11
In this version, we made some enhancements
* ENHANCEMENTS:
* BUGFIXING:
- Fix a bug reported in https://github.com/VincentWei/minigui/issues/94
- Fix a bug reported in https://github.com/VincentWei/minigui/issues/96
- Fix a bug reported in https://github.com/VincentWei/minigui/issues/105
- Fix a bug reported in https://github.com/VincentWei/minigui/issues/106
* OPTIMIZATIONS:
- Optimize the refresh of scrolled.
* TUNING:
- Call `mg_FreeMsgQueueForThisThread` immediately in `TerminateGUI()`.
- Use `CreateLogFontEx` instead of `CreateLogFont` to follow the new style convention of font name when creating the system logfonts,
but the orientation is ignored for the system logfont.
## Version 5.0.10
On Sep. 30, 2022, FMSoft announces the availability of MiniGUI 5.0.10,
which is a bug fixing release with bug fixes and some minor enhancements
of MiniGUI 5.0.x.
### What's new in version 5.0.10
In this version, we made some enhancements
* ENHANCEMENTS:
- Enhance `fbcon` engine to support double buffering for Threads and Standalone mode. (Runtime option: `fbcon.double_buffering`).
- Cleanup and enhance `shadow` engine to use `SyncUpdate` method.
- Relaying `MSG_IDLE` messages to the active descendant controls in every 0.5s.
* BUGFIXING:
- Fix a bug reported in https://github.com/VincentWei/minigui/issues/83
- Fix a bug reported in https://github.com/VincentWei/minigui/issues/87
- Fix bugs reported in https://github.com/VincentWei/minigui/issues/89
- Fix some bugs when virtual window enabled under Standalone and Processes runtime modes.
* OPTIMIZATIONS:
* TUNING:
- Fix some warnings reported by GCC 12.
- Use inline functions for SetCursor and SetDefaultCursor instead of macros.
## Version 5.0.9
On Jan. 14, 2022, FMSoft announces the availability of MiniGUI 5.0.9,
which is a bug fixing release with minor enhancements of MiniGUI 5.0.x.
### What's new in version 5.0.9
In this version, we fixed some bugs:
* BUGFIXING:
- Fix a crash bug in `InitSubDC()` of `src/newgdi/gdi.c`.
* ENHANCEMENTS:
* OPTIMIZATIONS:
* TUNING:
- Change copyright year to 2022.
## Version 5.0.8
The MiniGUI development team announces the availability of MiniGUI 5.0.8,
which is a bug fixing release with minor enhancements of MiniGUI 5.0.x.
### What's new in version 5.0.8
In this version, we fixed some bugs and made some optimizations and enhancements:
* BUGFIXING:
* ENHANCEMENTS:
- Support for WebP image format based on `libwebp`.
- Support for two ARM64-based hardware platforms: PX30 and R818.
- New surface pixel format for main window: `ST_PIXEL_XRGB565` under compositing schema.
* OPTIMIZATIONS:
- Shrink heap size for fixed string.
- Optimize the memory use of blitting context.
* TUNING:
- Tune code of fbcon video engine for compositing schema.
- Fix warnings and errors for conditional compilation.
## Version 5.0.6 ## Version 5.0.6
The MiniGUI development team announces the availability of MiniGUI 5.0.6, The MiniGUI development team announces the availability of MiniGUI 5.0.6,
+2 -2
View File
@@ -1,6 +1,6 @@
Version 5.0.16 (2025/05/27) Version 5.0.6 (2021/05/20)
This is a minor enhancement and bugfix release of MiniGUI 5.0.x, the stable version. This is the first official release of MiniGUI 5.0.x, the stable version.
Other packages for MiniGUI resource, tools, components, and samples: Other packages for MiniGUI resource, tools, components, and samples:
+1 -2
View File
@@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
libtoolize cat m4/*.m4 > acinclude.m4
cat m4/*.m4 > aclocal.m4
aclocal aclocal
autoheader autoheader
automake --add-missing --foreign --copy automake --add-missing --foreign --copy
+218 -170
View File
File diff suppressed because it is too large Load Diff
+8 -59
View File
@@ -55,36 +55,6 @@ wallpaper_pattern_size=full
# def_compositor_so= # def_compositor_so=
#}} #}}
#{{ifdef _MGGAL_SHADOW
[shadow]
real_engine=pc_xvfb
defaultmode=800x600-16bpp
# `cw`: rotating screen clock-wise.
# `ccw`: rotating screen counter clock-wise.
# `hflip`: flipping screen horizontally.
# `vflip`: flipping screen vertically.
rotate_screen=ccw
# Whether the async. update is enabled.
# Use `true` or `yes` for enabled, anything else for disabled.
# Since 5.0.13.
async_update=yes
# The synchronization interval for the asyn. updater (milli-seconds).
# This setting is only valid when `async_update` is enabled and
# the real engine does not provide WaitWBlank method.
# Since 5.0.13.
update_interval=15
# The minimal pixels to use the hardware accelerator.
# If the number of pixels to copy is less than this value,
# MiniGUI will use the software copy routine to update the real screen,
# even if the real device provides a hardware accelerator.
# Since 5.0.13.
min_pixels_using_hwaccl=4096
#}}
#{{ifdef _MGGAL_DRM #{{ifdef _MGGAL_DRM
[drm] [drm]
defaultmode=1024x768-32bpp defaultmode=1024x768-32bpp
@@ -108,21 +78,9 @@ dpi=96
# Since 5.0.0. # Since 5.0.0.
double_buffering=true double_buffering=true
# The update interval for the asyn. updater (milli-seconds).
# This setting is only valid when drmWaitVBlank doesn't work correctly.
# Since 5.0.13.
update_interval=15
# The minimal pixels to use the hardware accelerator.
# If the number of pixels to copy is less than this value,
# MiniGUI will use the software copy routine to update the real screen,
# even if the device provides a hardware accelerator.
# Since 5.0.13.
min_pixels_using_hwaccl=4096
# The filename of the shared library for the external driver. # The filename of the shared library for the external driver.
# The equivalent environment variable: MG_GAL_DRM_DRIVER # The equivalent environment variable: MG_GAL_DRM_DRIVER
exdriver=libdrmdrivers.so exdriver=libhidrmdrivers-0.2.so.0
#}} #}}
#{{ifdef _MGIAL_SINGLETOUCHKEY #{{ifdef _MGIAL_SINGLETOUCHKEY
@@ -147,22 +105,6 @@ seat=seat0
[fbcon] [fbcon]
defaultmode=1024x768-16bpp defaultmode=1024x768-16bpp
dpi=96 dpi=96
# Whether double buffering is enabled (only for threads and standalone runmodes).
# Use `true` or `yes` for enabled, anything else for disabled.
# Note that under compositing schema, double buffering is always enabled.
# Since 5.0.10.
double_buffering=true
# Whether the async. update is enabled.
# Use `true` or `yes` for enabled, anything else for disabled.
# Since 5.0.13.
async_update=yes
# The update interval for the asyn. updater (milli-seconds).
# This setting is only valid when drmWaitVBlank doesn't work correctly.
# Since 5.0.13.
update_interval=15
#}} #}}
#{{ifdef _MGGAL_PCXVFB #{{ifdef _MGGAL_PCXVFB
@@ -175,6 +117,13 @@ exec_file=/usr/local/bin/gvfb
[rtos_xvfb] [rtos_xvfb]
defaultmode=800x600-16bpp defaultmode=800x600-16bpp
#{{ifdef _MGGAL_SHADOW
[shadow]
real_engine=pc_xvfb
defaultmode=800x600-16bpp
rotate_screen=normal
#}}
#{{ifdef _MGGAL_MLSHADOW #{{ifdef _MGGAL_MLSHADOW
[mlshadow] [mlshadow]
real_engine=qvfb real_engine=qvfb
-4
View File
@@ -268,8 +268,6 @@ MGUI_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
#define MG_UNLIKELY(expr) (expr) #define MG_UNLIKELY(expr) (expr)
#endif #endif
#define HAVE(FEATURE) (defined HAVE_##FEATURE && HAVE_##FEATURE)
/** /**
* \defgroup endian_info Endianness information * \defgroup endian_info Endianness information
* @{ * @{
@@ -313,7 +311,6 @@ MGUI_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
defined(__amd64) || \ defined(__amd64) || \
(defined(__alpha__) || defined(__alpha)) || \ (defined(__alpha__) || defined(__alpha)) || \
defined(__arm__) || defined(__aarch64__) || \ defined(__arm__) || defined(__aarch64__) || \
defined(__loongarch__) || \
defined(__riscv) || \ defined(__riscv) || \
(defined(__CC_ARM) && !defined(__BIG_ENDIAN)) || \ (defined(__CC_ARM) && !defined(__BIG_ENDIAN)) || \
(defined(__mips__) && defined(__MIPSEL__)) || \ (defined(__mips__) && defined(__MIPSEL__)) || \
@@ -2349,7 +2346,6 @@ int init_minigui_printf (int (*output_char) (int ch),
#define _ERR_PRINTF(fmt, ...) \ #define _ERR_PRINTF(fmt, ...) \
do { \ do { \
TCS_RED (stderr); \ TCS_RED (stderr); \
fprintf (stderr, "%s: ", __FUNCTION__); \
fprintf (stderr, fmt, ##__VA_ARGS__); \ fprintf (stderr, fmt, ##__VA_ARGS__); \
TCS_NONE (stderr); \ TCS_NONE (stderr); \
} while (0) } while (0)
+25 -24
View File
@@ -131,31 +131,7 @@
#define IAL_EVENT_GESTURE_PINCH_UPDATE 0x0084 #define IAL_EVENT_GESTURE_PINCH_UPDATE 0x0084
#define IAL_EVENT_GESTURE_PINCH_END 0x0085 #define IAL_EVENT_GESTURE_PINCH_END 0x0085
#define TABLET_TOOL_CHANGED_X (1 << 0)
#define TABLET_TOOL_CHANGED_Y (1 << 1)
#define TABLET_TOOL_CHANGED_PRESSURE (1 << 2)
#define TABLET_TOOL_CHANGED_DISTANCE (1 << 3)
#define TABLET_TOOL_CHANGED_TILT_X (1 << 4)
#define TABLET_TOOL_CHANGED_TILT_Y (1 << 5)
#define TABLET_TOOL_CHANGED_ROTATION (1 << 6)
#define TABLET_TOOL_CHANGED_SLIDER (1 << 7)
#define TABLET_TOOL_CHANGED_SIZE_MAJOR (1 << 8)
#define TABLET_TOOL_CHANGED_SIZE_MINOR (1 << 9)
#define TABLET_TOOL_CHANGED_WHEEL (1 << 10)
#ifndef TABLET_TOOL_X #ifndef TABLET_TOOL_X
#define TABLET_TOOL_X 0
#define TABLET_TOOL_Y 1
#define TABLET_TOOL_PRESSURE 2
#define TABLET_TOOL_DISTANCE 3
#define TABLET_TOOL_TILT_X 4
#define TABLET_TOOL_TILT_Y 5
#define TABLET_TOOL_ROTATION 6
#define TABLET_TOOL_SLIDER 7
#define TABLET_TOOL_SIZE_MAJOR 8
#define TABLET_TOOL_SIZE_MINOR 9
#define TABLET_TOOL_WHEEL 10
#define TABLET_TOOL_PROXIMITY_STATE_INVALID 0 #define TABLET_TOOL_PROXIMITY_STATE_INVALID 0
#define TABLET_TOOL_PROXIMITY_STATE_OUT 1 #define TABLET_TOOL_PROXIMITY_STATE_OUT 1
#define TABLET_TOOL_PROXIMITY_STATE_IN 2 #define TABLET_TOOL_PROXIMITY_STATE_IN 2
@@ -173,6 +149,31 @@
#define TABLET_PAD_STRIP_SOURCE_UNKNOWN 0 #define TABLET_PAD_STRIP_SOURCE_UNKNOWN 0
#define TABLET_PAD_STRIP_SOURCE_FINGER 1 #define TABLET_PAD_STRIP_SOURCE_FINGER 1
#define TABLET_TOOL_CHANGED_X (1 << 0)
#define TABLET_TOOL_CHANGED_Y (1 << 1)
#define TABLET_TOOL_CHANGED_PRESSURE (1 << 2)
#define TABLET_TOOL_CHANGED_DISTANCE (1 << 3)
#define TABLET_TOOL_CHANGED_TILT_X (1 << 4)
#define TABLET_TOOL_CHANGED_TILT_Y (1 << 5)
#define TABLET_TOOL_CHANGED_ROTATION (1 << 6)
#define TABLET_TOOL_CHANGED_SLIDER (1 << 7)
#define TABLET_TOOL_CHANGED_SIZE_MAJOR (1 << 8)
#define TABLET_TOOL_CHANGED_SIZE_MINOR (1 << 9)
#define TABLET_TOOL_CHANGED_WHEEL (1 << 10)
#define TABLET_TOOL_X 0
#define TABLET_TOOL_Y 1
#define TABLET_TOOL_PRESSURE 2
#define TABLET_TOOL_DISTANCE 3
#define TABLET_TOOL_TILT_X 4
#define TABLET_TOOL_TILT_Y 5
#define TABLET_TOOL_ROTATION 6
#define TABLET_TOOL_SLIDER 7
#define TABLET_TOOL_SIZE_MAJOR 8
#define TABLET_TOOL_SIZE_MINOR 9
#define TABLET_TOOL_WHEEL 10
#endif #endif
#define IAL_EVENT_TABLET_TOOL_AXIS 0x0090 #define IAL_EVENT_TABLET_TOOL_AXIS 0x0090
+82 -62
View File
File diff suppressed because it is too large Load Diff
+34 -487
View File
File diff suppressed because it is too large Load Diff
+8 -93
View File
@@ -456,45 +456,6 @@ MG_EXPORT void GUIAPI MiniGUIPanic (int exitcode);
* @{ * @{
*/ */
/**
* \fn GHANDLE GUIAPI JoinLayerEx (const char* layer_name,
const char* client_name,
int max_nr_highers, int max_nr_normals, int *cli_id)
* \brief Joins to a layer and returns the client identifier if success.
*
* This function should be called by clients before calling any other MiniGUI
* functions. You can call \a GetLayerInfo to get the layer information.
* If the layer to be joined does not exist, the server, i.e. \a mginit, will
* try to create a new one. If you passed a NULL pointer or a null string for
* \a layer_name, the client will join to the default layer.
*
* If the client want to create a new layer, you should specify the maximal
* number of z-nodes in the higher level (max_nr_highers) and the maximal
* number of z-nodes in the normal level (max_nr_normals) of the new layer.
* Passing zero to \a max_nr_highers and max_nr_normals will use the default
* values, and the default values are specified by ServerStartup.
*
* Note that the server will create a default layer named "mginit".
*
* \param layer_name The name of the layer. You can use NAME_TOPMOST_LAYER to
* specify the current topmost layer.
* \param client_name The name of the client.
* \param max_nr_highers The maximal number of z-nodes in the higher level of
* the new layer.
* \param max_nr_normals The maximal number of z-nodes in the normal level of
* the new layer.
* \param cli_id The pointer to a buffer of int to return the client identifier.
*
* \return The handle to the layer on success, INV_LAYER_HANDLE on error.
*
* \note Only call this function in clients of MiniGUI-Processes.
*
* \sa GetLayerInfo, ServerStartup, ServerCreateLayer
*/
MG_EXPORT GHANDLE GUIAPI JoinLayerEx (const char* layer_name,
const char* client_name,
int max_nr_highers, int max_nr_normals, int *cli_id);
/** /**
* \fn GHANDLE GUIAPI JoinLayer (const char* layer_name, * \fn GHANDLE GUIAPI JoinLayer (const char* layer_name,
const char* client_name, const char* client_name,
@@ -529,30 +490,9 @@ MG_EXPORT GHANDLE GUIAPI JoinLayerEx (const char* layer_name,
* *
* \sa GetLayerInfo, ServerStartup, ServerCreateLayer * \sa GetLayerInfo, ServerStartup, ServerCreateLayer
*/ */
static inline GHANDLE GUIAPI JoinLayer (const char* layer_name, MG_EXPORT GHANDLE GUIAPI JoinLayer (const char* layer_name,
const char* client_name, const char* client_name,
int max_nr_highers, int max_nr_normals) int max_nr_highers, int max_nr_normals);
{
return JoinLayerEx (layer_name, client_name,
max_nr_highers, max_nr_normals, NULL);
}
/**
* \fn int GUIAPI GetClientId (void)
* \brief Gets the client identifier.
*
* You can get the information of a layer through this function.
* The information will be returned through the pointer arguments
* if the specific pointer is not NULL.
*
* \return Returns the client identifier of the current process.
* Note that the server always returns 0.
*
* \sa JoinLayerEx
*
* Since 5.2.0
*/
MG_EXPORT int GUIAPI GetClientId (void);
/** /**
* \fn GHANDLE GUIAPI GetLayerInfo (const char* layer_name, * \fn GHANDLE GUIAPI GetLayerInfo (const char* layer_name,
@@ -2185,7 +2125,7 @@ MG_EXPORT int GUIAPI ServerSendReplyEx (int clifd,
* \fn int GUIAPI ServerSendReply (int clifd, const void* reply, int len) * \fn int GUIAPI ServerSendReply (int clifd, const void* reply, int len)
* \brief Sends the reply to the client. * \brief Sends the reply to the client.
* *
* This function sends a reply pointed to by \a reply which is * This function sends a replay pointed to by \a reply which is
* \a len bytes long to the client. * \a len bytes long to the client.
* *
* \note Only used by the server to send the reply to the client. * \note Only used by the server to send the reply to the client.
@@ -2733,26 +2673,6 @@ MG_EXPORT void GUIAPI DesktopUpdateAllWindow (void);
#define DUMMY_LAYER_HANDLE (GHANDLE)(-1) #define DUMMY_LAYER_HANDLE (GHANDLE)(-1)
/**
* \fn GHANDLE GUIAPI JoinLayerEx (const char* layer_name,
const char* client_name,
int max_nr_highers, int max_nr_normals, int *cli_fd)
* \brief The dummy replacement of the same function for MiniGUI-Processes.
*
* This function is a replacment of the same function for MiniGUI-Processes
* runtime mode. We provide this function for MiniGUI-Threads and
* MiniGUI-Standalone runtime modes, in order to avoid using the
* conditional compilation instructions in your source code.
*
* \return Always returns DUMMY_LAYER_HANDLE to indicate success.
*/
static inline GHANDLE GUIAPI JoinLayerEx (const char* layer_name,
const char* client_name,
int max_nr_highers, int max_nr_normals, int *cli_fd)
{
return DUMMY_LAYER_HANDLE;
}
/** /**
* \fn GHANDLE GUIAPI JoinLayer (const char* layer_name, * \fn GHANDLE GUIAPI JoinLayer (const char* layer_name,
const char* client_name, const char* client_name,
@@ -2767,8 +2687,7 @@ static inline GHANDLE GUIAPI JoinLayerEx (const char* layer_name,
* \return Always returns DUMMY_LAYER_HANDLE to indicate success. * \return Always returns DUMMY_LAYER_HANDLE to indicate success.
*/ */
static inline GHANDLE GUIAPI JoinLayer (const char* layer_name, static inline GHANDLE GUIAPI JoinLayer (const char* layer_name,
const char* client_name, const char* client_name, int max_nr_highers, int max_nr_normals)
int max_nr_highers, int max_nr_normals)
{ {
return DUMMY_LAYER_HANDLE; return DUMMY_LAYER_HANDLE;
} }
@@ -4178,7 +4097,7 @@ static inline int GUIAPI ShowCursor (BOOL fShow) {
#endif /* !_MGHAVE_CURSOR */ #endif /* !_MGHAVE_CURSOR */
/** /**
* \fn HCURSOR SetCursor(HCURSOR hcsr) * \def SetCursor(hcsr)
* \brief Changes the current cursor. * \brief Changes the current cursor.
* *
* This function changes the current cursor to be \a hcsr. * This function changes the current cursor to be \a hcsr.
@@ -4191,12 +4110,10 @@ static inline int GUIAPI ShowCursor (BOOL fShow) {
* *
* \sa SetCursorEx, SetDefaultCursor * \sa SetCursorEx, SetDefaultCursor
*/ */
static inline HCURSOR SetCursor(HCURSOR hcsr) { #define SetCursor(hcsr) SetCursorEx (hcsr, FALSE)
return SetCursorEx (hcsr, FALSE);
}
/** /**
* \fn HCURSOR SetDefaultCursor(HCURSOR hcsr) * \def SetDefaultCursor(hcsr)
* \brief Changes the current cursor, and set it as the default cursor. * \brief Changes the current cursor, and set it as the default cursor.
* *
* This function changes the current cursor to be \a hcsr, and set it as * This function changes the current cursor to be \a hcsr, and set it as
@@ -4210,9 +4127,7 @@ static inline HCURSOR SetCursor(HCURSOR hcsr) {
* *
* \sa SetCursorEx, SetCursor * \sa SetCursorEx, SetCursor
*/ */
static inline HCURSOR SetDefaultCursor(HCURSOR hcsr) { #define SetDefaultCursor(hcsr) SetCursorEx (hcsr, TRUE)
return SetCursorEx (hcsr, TRUE);
}
/** @} end of cursor_fns */ /** @} end of cursor_fns */
+4 -36
View File
@@ -2905,9 +2905,6 @@ typedef struct _WINMASKINFO {
* *
* This message is sent to the all main windows when the system * This message is sent to the all main windows when the system
* enters idle loop. * enters idle loop.
*
* Since 5.0.10, this messasge will be relayed to the active child control
* if the main window is currently active.
*/ */
#define MSG_IDLE 0x0142 #define MSG_IDLE 0x0142
@@ -2990,22 +2987,18 @@ typedef struct _WINMASKINFO {
if the client moved to a new layer */ if the client moved to a new layer */
#define MSG_LAYERCHANGED 0x0149 #define MSG_LAYERCHANGED 0x0149
/* Since 5.2.0; the server send this message to the client
if a window has been composited to the screen. */
#define MSG_WINCOMPOSITED 0x014A
#endif /* defined _MGRM_PROCESSES */ #endif /* defined _MGRM_PROCESSES */
/* Since 5.0.0: for managing message thread */ /* Since 5.0.0: for managing message thread */
#define MSG_MANAGE_MSGTHREAD 0x014B #define MSG_MANAGE_MSGTHREAD 0x014A
#define MSGTHREAD_SIGNIN 0x00 #define MSGTHREAD_SIGNIN 0x00
#define MSGTHREAD_SIGNOUT 0x01 #define MSGTHREAD_SIGNOUT 0x01
/* Since 5.0.0: for calculating the default position */ /* Since 5.0.0: for calculating the default position */
#define MSG_CALC_POSITION 0x014C #define MSG_CALC_POSITION 0x014B
/* Since 5.0.6: for waking up the client */ /* Since 5.0.6: for waking up the client */
#define MSG_WAKEUP_CLIENT 0x014D #define MSG_WAKEUP_CLIENT 0x014C
/** /**
* \def MSG_DOESNEEDIME * \def MSG_DOESNEEDIME
@@ -6462,7 +6455,7 @@ MG_EXPORT RES_KEY Str2Key (const char* str);
* \fn int GUIAPI GetWindowZOrder(HWND hWnd); * \fn int GUIAPI GetWindowZOrder(HWND hWnd);
* \brief Get The Control ZOrder in the parent window * \brief Get The Control ZOrder in the parent window
* *
* \param hWnd Handler of a control * \param hWnd Handle of a control
* *
* \return return index of ZOrder or 0 if hWnd is a MainWindow or -1 if error * \return return index of ZOrder or 0 if hWnd is a MainWindow or -1 if error
* *
@@ -7241,31 +7234,6 @@ MG_EXPORT BOOL GUIAPI SetMainWindowGestureFlags (HWND hWnd, DWORD dwFlags);
#ifdef _MGSCHEMA_COMPOSITING #ifdef _MGSCHEMA_COMPOSITING
/**
* \fn int GUIAPI GetWindowSharedSurfaceFD (HWND hwnd, size_t *map_size,
* DWORD *flags)
* \brief Gets the file descriptor of the surface buffer for a window or
* the main window it locates.
*
* This function gets the file descriptor of the surface buffer for
* the specified window if it is a main window or the main window it locates.
* Note that if the window is a control that has the style `WS_EX_CTRLASMAINWIN`,
* the window will have a separate surface buffer.
*
* \param hwnd The handle to the window.
*
* \return An integer larger than or equal to 0 for a valid file descriptor,
* otherwise a negative value.
*
* \note This function only available when _MGSCHEMA_COMPOSITING is defined.
*
* \sa CreateMemDCFromSharedSurfaceFD
*
* Since 5.0.13
*/
MG_EXPORT int GUIAPI GetWindowSharedSurfaceFD (HWND hWnd, size_t *map_size,
DWORD *flags);
/** /**
* \fn BOOL GUIAPI SetMainWindowCompositing (HWND hWnd, * \fn BOOL GUIAPI SetMainWindowCompositing (HWND hWnd,
int type, DWORD arg) int type, DWORD arg)
+5064
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,4 +1,4 @@
# This file does not do anything, except making sure these files are included # This file does not do anything, except making sure these files are included
# when you run 'make dist'. # when you run 'make dist'.
EXTRA_DIST = EXTRA_DIST = libtool.m4
+3724
View File
File diff suppressed because it is too large Load Diff
+1 -2
View File
@@ -2,12 +2,11 @@ prefix=@prefix@
exec_prefix=@exec_prefix@ exec_prefix=@exec_prefix@
libdir=@libdir@ libdir=@libdir@
includedir=@includedir@ includedir=@includedir@
runmode=@MINIGUI_RUNMODE@
libsuffix=@MGLIB_SUFFIX@
Name: MiniGUI Name: MiniGUI
Description: A mature cross-platform windowing and GUI system for embedded systems and IoT smart devices. Description: A mature cross-platform windowing and GUI system for embedded systems and IoT smart devices.
Version: @MINIGUI_VERSION@ Version: @MINIGUI_VERSION@
Runmode: @MINIGUI_RUNMODE@
Requires: Requires:
Libs: -L${libdir} -lminigui_@MGLIB_SUFFIX@ @DEP_LIBS@ Libs: -L${libdir} -lminigui_@MGLIB_SUFFIX@ @DEP_LIBS@
Libs.private: Libs.private:
+43 -18
View File
@@ -1,27 +1,52 @@
COMMON_SUBDIRS = libc misc main kernel sysres ial control ex_ctrl font gui mybmp include textedit newgal newgdi if MG_MINIMALGDI
COMMON_SUBDIRS = misc kernel sysres include
COMMON_LADD = \ COMMON_LADD = \
libc/liblibc.la \ kernel/libkernel.la \
misc/libmisc.la \ sysres/libsysres.la \
control/libcontrol.la \ misc/libmisc.la
ex_ctrl/libexctrl.la \ else
font/libfont.la \ COMMON_SUBDIRS = libc misc main kernel sysres ial control ex_ctrl font gui mybmp include textedit
COMMON_LADD = \
libc/liblibc.la \
misc/libmisc.la \
control/libcontrol.la \
ex_ctrl/libexctrl.la \
font/libfont.la \
font/in-core/libincore.la \ font/in-core/libincore.la \
ial/libial.la \ ial/libial.la \
gui/libgui.la \ gui/libgui.la \
main/libmain.la \ main/libmain.la \
mybmp/libmybmp.la \ mybmp/libmybmp.la \
kernel/libkernel.la \ kernel/libkernel.la \
sysres/libsysres.la \ sysres/libsysres.la \
textedit/libtextedit.la \ textedit/libtextedit.la
newgal/libnewgal.la \ endif
newgdi/libnewgdi.la
DIST_SUBDIRS = $(COMMON_SUBDIRS) newgal newgdi server client standalone if MGRM_STANDALONE
SUBDIRS = $(COMMON_SUBDIRS) @RUNMODE_SUBDIRS@ LITE_LADD = standalone/libstandalone.la
LITE_SUBDIRS = standalone
else
if MGRM_PROCESSES
LITE_LADD = server/libserver.la client/libclient.la
LITE_SUBDIRS = server client
else
LITE_LADD =
LITE_SUBDIRS =
endif
endif
NEWGAL_LADD = newgal/libnewgal.la newgdi/libnewgdi.la
NEWGAL_SUBDIRS = newgal newgdi
DIST_SUBDIRS = $(COMMON_SUBDIRS) newgal newgdi server client standalone
SUBDIRS = $(COMMON_SUBDIRS) $(NEWGAL_SUBDIRS) $(LITE_SUBDIRS)
MGSOURCES = template.c template.h MGSOURCES = template.c template.h
MGLIBADD = $(COMMON_LADD) @RUNMODE_LADD@ MGLIBADD = $(COMMON_LADD) \
$(LITE_LADD) \
$(NEWGAL_LADD)
MGLDFLAGS = -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) MGLDFLAGS = -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
lib_LTLIBRARIES=libminigui_@MGLIB_SUFFIX@.la lib_LTLIBRARIES=libminigui_@MGLIB_SUFFIX@.la
+3 -32
View File
@@ -184,23 +184,6 @@ static void process_socket_message (MSG *msg)
LOSWORD(msg->wParam), HISWORD(msg->wParam), LOSWORD(msg->wParam), HISWORD(msg->wParam),
LOSWORD(msg->lParam), HISWORD(msg->lParam)); LOSWORD(msg->lParam), HISWORD(msg->lParam));
} }
#ifdef _MGSCHEMA_COMPOSITING
else if (msg->message == MSG_WINCOMPOSITED) {
/* Since 5.2.0 */
int slot = (int)msg->wParam;
HWND hwnd = (HWND)msg->lParam;
unsigned dirty_age = (unsigned)msg->time;
if (__mg_client_check_znode_hwnd(slot, hwnd, __mg_client_id)) {
GAL_Surface *ssurf = ((PMAINWIN)hwnd)->surf;
assert(ssurf->shared_header);
__mg_lock_file_for_write(ssurf->fd);
if (ssurf->dirty_info->dirty_age == dirty_age) {
ssurf->dirty_info->nr_dirty_rcs = 0;
}
__mg_unlock_file_for_write(ssurf->fd);
}
}
#endif
else { else {
if (msg->hwnd == HWND_NULL) { if (msg->hwnd == HWND_NULL) {
msg->hwnd = HWND_DESKTOP; msg->hwnd = HWND_DESKTOP;
@@ -535,8 +518,8 @@ BOOL client_IdleHandler4Client (PMSGQUEUE msg_queue, BOOL wait)
return (n > 0); return (n > 0);
} }
GHANDLE GUIAPI JoinLayerEx (const char* layer_name, const char* client_name, GHANDLE GUIAPI JoinLayer (const char* layer_name, const char* client_name,
int max_nr_topmosts, int max_nr_normals, int *cli_id) int max_nr_topmosts, int max_nr_normals)
{ {
GHANDLE layer_handle = INV_LAYER_HANDLE; GHANDLE layer_handle = INV_LAYER_HANDLE;
REQUEST req; REQUEST req;
@@ -546,12 +529,8 @@ GHANDLE GUIAPI JoinLayerEx (const char* layer_name, const char* client_name,
if (mgIsServer) if (mgIsServer)
return layer_handle; return layer_handle;
if (__mg_client_id != 0) { if (__mg_client_id != 0) /* Already joined, return the handle */
/* Already joined, return the handle */
if (cli_id)
*cli_id = __mg_client_id;
return GetLayerInfo (NAME_SELF_LAYER, NULL, NULL, NULL); return GetLayerInfo (NAME_SELF_LAYER, NULL, NULL, NULL);
}
if (layer_name) { if (layer_name) {
strncpy (info.layer_name, layer_name, LEN_LAYER_NAME); strncpy (info.layer_name, layer_name, LEN_LAYER_NAME);
@@ -614,18 +593,10 @@ GHANDLE GUIAPI JoinLayerEx (const char* layer_name, const char* client_name,
__mg_start_client_desktop (); __mg_start_client_desktop ();
if (cli_id)
*cli_id = __mg_client_id;
ret: ret:
return layer_handle; return layer_handle;
} }
int GUIAPI GetClientId (void)
{
return __mg_client_id;
}
GHANDLE GUIAPI GetLayerInfo (const char* layer_name, GHANDLE GUIAPI GetLayerInfo (const char* layer_name,
int* nr_clients, BOOL* is_topmost, int* cli_active) int* nr_clients, BOOL* is_topmost, int* cli_active)
{ {
+46 -56
View File
File diff suppressed because it is too large Load Diff
+14 -12
View File
@@ -299,15 +299,7 @@ static void change_status_from_pose (PCONTROL pctrl, int new_pose,
} }
} }
/* DK: When the radio or check button state changes do not erase the background, /*complete a click if the click if valid
* and the prospects for direct rendering */
btnGetRects (pctrl, &rcClient, &rcContent, &rcBitmap);
if (BUTTON_IS_PUSHBTN(pctrl) || (pctrl->dwStyle & BS_PUSHLIKE))
InvalidateRect((HWND)pctrl, NULL, TRUE);
else
InvalidateRect((HWND)pctrl, &rcBitmap, FALSE);
/* complete a click if the click if valid
* (mouse lbutton up in button )*/ * (mouse lbutton up in button )*/
if (old_pose == BST_PUSHED && new_pose != BST_DISABLE if (old_pose == BST_PUSHED && new_pose != BST_DISABLE
&& change_valid) && change_valid)
@@ -320,6 +312,14 @@ static void change_status_from_pose (PCONTROL pctrl, int new_pose,
NotifyParent ((HWND)pctrl, pctrl->id, BN_CLICKED); NotifyParent ((HWND)pctrl, pctrl->id, BN_CLICKED);
} }
/* DK: When the radio or check button state changes do not erase the background,
* and the prospects for direct rendering */
btnGetRects (pctrl, &rcClient, &rcContent, &rcBitmap);
if (BUTTON_IS_PUSHBTN(pctrl) || (pctrl->dwStyle & BS_PUSHLIKE))
InvalidateRect((HWND)pctrl, NULL, TRUE);
else
InvalidateRect((HWND)pctrl, &rcBitmap, FALSE);
} }
/*btnGetRects: /*btnGetRects:
@@ -423,8 +423,8 @@ static void draw_bitmap_button (PCONTROL pctrl, HDC hdc, DWORD dwStyle,
GetClientRect ((HWND)pctrl, &prcClient); GetClientRect ((HWND)pctrl, &prcClient);
if (dwStyle & BS_REALSIZEIMAGE) { if (dwStyle & BS_REALSIZEIMAGE) {
x += (int)(w - bmp->bmWidth) >> 1; x += (w - bmp->bmWidth) >> 1;
y += (int)(h - bmp->bmHeight) >> 1; y += (h - bmp->bmHeight) >> 1;
w = h = 0; w = h = 0;
if (bmp->bmWidth > RECTW(prcClient)){ if (bmp->bmWidth > RECTW(prcClient)){
@@ -847,6 +847,8 @@ static LRESULT ButtonCtrlProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
break; break;
} }
case BM_SETSTYLE: case BM_SETSTYLE:
pctrl->dwStyle &= 0xFFFF0000; pctrl->dwStyle &= 0xFFFF0000;
pctrl->dwStyle |= (DWORD)(wParam & 0x0000FFFF); pctrl->dwStyle |= (DWORD)(wParam & 0x0000FFFF);
@@ -1052,7 +1054,7 @@ static LRESULT ButtonCtrlProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
} }
default: default:
break; break;
} }
return DefaultControlProc (hWnd, uMsg, wParam, lParam); return DefaultControlProc (hWnd, uMsg, wParam, lParam);
+11 -8
View File
@@ -1678,7 +1678,7 @@ esright_input_char_refresh (HWND hWnd,
scroll_rc.right = cur_caret_x; scroll_rc.right = cur_caret_x;
ScrollWindow(hWnd, -scroll_len, 0, &scroll_rc, NULL); ScrollWindow(hWnd, -scroll_len, 0, &scroll_rc, NULL);
UpdateInvalidClient(hWnd, TRUE); UpdateWindow(hWnd, FALSE);
edtSetCaretPos (hWnd, sled); edtSetCaretPos (hWnd, sled);
sled->changed = TRUE; sled->changed = TRUE;
@@ -2143,6 +2143,9 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
else { else {
chars = 1; chars = 1;
if (charBuffer [0] == 127) // BS
charBuffer [0] = '\b';
if (dwStyle & ES_UPPERCASE) { if (dwStyle & ES_UPPERCASE) {
charBuffer [0] = toupper (charBuffer[0]); charBuffer [0] = toupper (charBuffer[0]);
} }
@@ -2151,8 +2154,12 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
} }
} }
if (chars == 1 && (charBuffer[0] == '\b' || charBuffer[0] == 0x7F)) { if (chars == 1) {
// ASCII BS or DEL if (charBuffer [0] < 0x20 && charBuffer[0] != '\b') //FIXME
return 0;
}
if (charBuffer[0] == '\b') { //backspace
int del; int del;
if (sled->editPos == 0 && sled->selStart == sled->selEnd) if (sled->editPos == 0 && sled->selStart == sled->selEnd)
@@ -2177,11 +2184,7 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
sleInsertText (hWnd, sled, NULL, del); sleInsertText (hWnd, sled, NULL, del);
} }
} }
else if (chars == 1 && charBuffer [0] < 0x20) { else{
// ignore all other ASCII control characters.
return 0;
}
else {
if (dwStyle & ES_LEFT) { if (dwStyle & ES_LEFT) {
esleft_input_char_refresh(hWnd, sled, (char*)charBuffer, chars); esleft_input_char_refresh(hWnd, sled, (char*)charBuffer, chars);
set_edit_caret_pos(hWnd, sled); set_edit_caret_pos(hWnd, sled);
+1 -1
View File
@@ -404,7 +404,7 @@ void mglist_set_itemops (MgList *mglst, PMGITEMOPS iop)
mglst->iop = *iop; mglst->iop = *iop;
} }
LRESULT DefaultItemViewProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam, int DefaultItemViewProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam,
PSCRDATA pscrdata, MgList *mglst) PSCRDATA pscrdata, MgList *mglst)
{ {
switch (message) { switch (message) {
+1 -1
View File
@@ -140,7 +140,7 @@ struct _MgList
/* ------------------------- external api -------------------------- */ /* ------------------------- external api -------------------------- */
MG_EXPORT LRESULT DefaultItemViewProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam, MG_EXPORT int DefaultItemViewProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam,
PSCRDATA pscrdata, MgList *mglst); PSCRDATA pscrdata, MgList *mglst);
MG_EXPORT SVITEM_DRAWFUNC mglist_set_itemdraw (MgList *mglst, SVITEM_DRAWFUNC draw_func); MG_EXPORT SVITEM_DRAWFUNC mglist_set_itemdraw (MgList *mglst, SVITEM_DRAWFUNC draw_func);
+1 -5
View File
@@ -172,10 +172,6 @@ BOOL scrolled_set_cont_pos (HWND hWnd, PSCRDATA pscrdata, int cont_x, int cont_y
SetScrollPos (hWnd, SB_VERT, cont_y); SetScrollPos (hWnd, SB_VERT, cont_y);
bChange = TRUE; bChange = TRUE;
} }
if (bChange)
UpdateInvalidClient(hWnd, FALSE);
return bChange; return bChange;
} }
@@ -589,7 +585,7 @@ int scrolled_init (HWND hWnd, PSCRDATA pscrdata, int w, int h)
return 0; return 0;
} }
LRESULT DefaultScrolledProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) int DefaultScrolledProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{ {
PSCRDATA pscrdata = NULL; PSCRDATA pscrdata = NULL;
+1 -1
View File
@@ -96,7 +96,7 @@ typedef struct _scrdata
typedef SCRDATA *PSCRDATA; typedef SCRDATA *PSCRDATA;
MG_EXPORT LRESULT DefaultScrolledProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam); MG_EXPORT int DefaultScrolledProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam);
MG_EXPORT int scrolled_init (HWND hWnd, PSCRDATA pscrdata, int w, int h); MG_EXPORT int scrolled_init (HWND hWnd, PSCRDATA pscrdata, int w, int h);
MG_EXPORT void scrolled_destroy (PSCRDATA pscrdata); MG_EXPORT void scrolled_destroy (PSCRDATA pscrdata);
MG_EXPORT void scrolled_hscroll (HWND hWnd, PSCRDATA pscrdata, WPARAM wParam, LPARAM lParam); MG_EXPORT void scrolled_hscroll (HWND hWnd, PSCRDATA pscrdata, WPARAM wParam, LPARAM lParam);
+4 -9
View File
@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems * and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices. * and smart IoT devices.
* *
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming * Copyright (C) 1998~2002, WEI Yongming
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@@ -493,15 +493,10 @@ LRESULT ScrollViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
break; break;
} }
case MSG_DESTROY: { case MSG_DESTROY:
/* suppress a warning about calling free() before using the pointer */ scrollview_destroy (psvdata);
PSVDATA svdata = (PSVDATA) GetWindowAdditionalData2 (hWnd); free (psvdata);
if (svdata) {
scrollview_destroy(svdata);
free (svdata);
}
break; break;
}
case MSG_GETDLGCODE: case MSG_GETDLGCODE:
return DLGC_WANTARROWS; return DLGC_WANTARROWS;
+4 -1
View File
@@ -2096,6 +2096,7 @@ static void teOnChar (HWND hWnd, PTEDATA ptedata, WPARAM wParam)
rcInv.right = ptedata->svdata.scrdata.nContWidth; rcInv.right = ptedata->svdata.scrdata.nContWidth;
rcInv.bottom = rcInv.top + ptedata->nLineHeight - ptedata->nLineBaseH; rcInv.bottom = rcInv.top + ptedata->nLineHeight - ptedata->nLineBaseH;
REFRESH_NODE_EX(node, &rcInv); REFRESH_NODE_EX(node, &rcInv);
// UpdateWindow(hWnd, FALSE);
newlinenr = NODE_LINENR(node); newlinenr = NODE_LINENR(node);
rcInv.left = 0; rcInv.left = 0;
@@ -2103,10 +2104,12 @@ static void teOnChar (HWND hWnd, PTEDATA ptedata, WPARAM wParam)
rcInv.top += ptedata->nLineHeight; rcInv.top += ptedata->nLineHeight;
rcInv.bottom = rcInv.top + ptedata->nLineHeight - ptedata->nLineBaseH; rcInv.bottom = rcInv.top + ptedata->nLineHeight - ptedata->nLineBaseH;
REFRESH_NODE_EX(node, &rcInv); REFRESH_NODE_EX(node, &rcInv);
// UpdateWindow(hWnd, FALSE);
} }
/* houhh 20090814, UpdataWindow will invalidate all edit area, but /* houhh 20090814, UpdataWindow will invalidate all edit area, but
* erase area is not same with msg_paint area.*/ * erase area is not same with msg_paint area.*/
UpdateInvalidClient(hWnd, TRUE); UpdateWindow(hWnd, FALSE);
//SendMessage(hWnd, MSG_PAINT, 0, 0);
} }
} }
else { else {
+2 -2
View File
@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems * and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices. * and smart IoT devices.
* *
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming * Copyright (C) 1998~2002, WEI Yongming
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@@ -283,7 +283,7 @@ static void DrawCoolBox (HWND hWnd, HDC hdc, PCOOLBARCTRL pdata)
WINDOWINFO *info; WINDOWINFO *info;
RECT rc; RECT rc;
if (tmpdata->Caption [0] == '\0') if (tmpdata->Caption == NULL || tmpdata->Caption [0] == '\0')
break; break;
GetTextExtent (hdc, tmpdata->Caption, -1, &size); GetTextExtent (hdc, tmpdata->Caption, -1, &size);
+4 -4
View File
@@ -80,17 +80,17 @@ static void update_viewport (gvGridViewData *view, int from, int to, int is_row)
{ {
RECT r; RECT r;
GetClientRect(view->hCtrl, &r); GetClientRect (view->hCtrl, &r);
if (is_row) { if (is_row) {
r.top = from; r.top = from;
ScrollWindow(view->hCtrl, 0, to, &r, NULL); ScrollWindow (view->hCtrl, 0, to, &r, NULL);
} }
else { else {
r.left = from; r.left = from;
ScrollWindow(view->hCtrl, to, 0, &r, NULL); ScrollWindow (view->hCtrl, to, 0, &r, NULL);
} }
UpdateInvalidClient(view->hCtrl, FALSE); UpdateWindow(view->hCtrl, FALSE);
} }
// scroll function {{{ // scroll function {{{
-2
View File
@@ -157,8 +157,6 @@ static int isInItem (MgList *mglst, int mouseX, int mouseY,
index = row * pivlist->nCol + col; index = row * pivlist->nCol + col;
pci = (IconviewItem *)mglist_getitem_byindex (mglst, index); pci = (IconviewItem *)mglist_getitem_byindex (mglst, index);
if (pci == NULL)
return -1;
if (pRet) if (pRet)
*pRet = (MgItem*)pci; *pRet = (MgItem*)pci;
+17 -10
View File
@@ -93,15 +93,14 @@ BOOL RegisterTreeViewControl (void)
const WINDOW_ELEMENT_RENDERER * rdr = const WINDOW_ELEMENT_RENDERER * rdr =
GetDefaultWindowElementRenderer(); GetDefaultWindowElementRenderer();
if (!(icon_fold = (HICON)RetrieveRes(gui_GetIconFile(rdr->name,
SYSICON_FOLD, szValue)))) { if (!(icon_fold = (HICON)RetrieveRes(gui_GetIconFile(rdr->name, SYSICON_FOLD, szValue)))) {
if (!(icon_fold = LoadSystemIcon (SYSICON_FOLD, 0))) { if (!(icon_fold = LoadSystemIcon (SYSICON_FOLD, 0))) {
return FALSE; return FALSE;
} }
} }
if (!(icon_unfold = (HICON)RetrieveRes(gui_GetIconFile(rdr->name, if (!(icon_unfold = (HICON)RetrieveRes(gui_GetIconFile(rdr->name, SYSICON_UNFOLD, szValue)))) {
SYSICON_UNFOLD, szValue)))) {
if (!(icon_unfold = LoadSystemIcon (SYSICON_UNFOLD, 0))) { if (!(icon_unfold = LoadSystemIcon (SYSICON_UNFOLD, 0))) {
DestroyIcon (icon_fold); DestroyIcon (icon_fold);
icon_fold = 0; icon_fold = 0;
@@ -181,7 +180,6 @@ static BOOL tvInitTVData (HWND hwnd, PTVDATA pData, DWORD dwStyle, PTVITEMINFO r
tvRoot->hIconFold = root_ii->hIconFold; tvRoot->hIconFold = root_ii->hIconFold;
else else
tvRoot->hIconFold = ICON_FOLD; tvRoot->hIconFold = ICON_FOLD;
if (root_ii && root_ii->hIconUnfold) if (root_ii && root_ii->hIconUnfold)
tvRoot->hIconUnfold = root_ii->hIconUnfold; tvRoot->hIconUnfold = root_ii->hIconUnfold;
else else
@@ -634,13 +632,22 @@ static void tvDrawItem (HWND hWnd, HDC hdc, PTVDATA pData, int centerX, int cent
centerX += (h>>1) + TV_BOXGAP; centerX += (h>>1) + TV_BOXGAP;
if (pData->dwStyle & TVS_WITHICON) { if (pData->dwStyle & TVS_WITHICON) {
if (p->child != NULL && (p->dwFlags & TVIF_FOLD)) { if (!(pData->dwStyle & TVS_ICONFORSELECT)
&& (!p->child || (p->dwFlags & TVIF_FOLD))) {
if ((p->hIconFold)) { if ((p->hIconFold)) {
DrawIcon (hdc, centerX, centerY - (h>>1), h, h, p->hIconFold); DrawIcon (hdc, centerX, centerY - (h>>1),
h, h, p->hIconFold);
}
} else if ((pData->dwStyle & TVS_ICONFORSELECT) && p->dwFlags & TVIF_SELECTED) {
if ((p->hIconFold)) {
DrawIcon (hdc, centerX, centerY - (h>>1),
h, h, p->hIconFold);
}
} else
if ((p->hIconUnfold)) {
DrawIcon (hdc, centerX, centerY - (h>>1),
h, h, p->hIconUnfold);
} }
} else if ((p->hIconUnfold)) {
DrawIcon (hdc, centerX, centerY - (h>>1), h, h, p->hIconUnfold);
}
centerX += h + TV_ICONGAP; centerX += h + TV_ICONGAP;
} }
-12
View File
@@ -202,17 +202,6 @@ static void destroy (GLYPHTREENODE *root)
/*** device font ops ***/ /*** device font ops ***/
static DWORD get_feature (LOGFONT* logfont, DEVFONT* devfont,
enum devfont_feature feature)
{
switch (feature) {
case DEVFONT_FEATURE_MARK_BBOX:
return 0;
}
return 0;
}
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont) static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
{ {
return DEVFONTGLYPHTYPE_PRERDRBMP; return DEVFONTGLYPHTYPE_PRERDRBMP;
@@ -391,7 +380,6 @@ static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
/**************************** Global data ************************************/ /**************************** Global data ************************************/
FONTOPS __mg_bitmap_font_ops = { FONTOPS __mg_bitmap_font_ops = {
get_feature,
get_glyph_bmptype, get_glyph_bmptype,
get_ave_width, get_ave_width,
get_max_width, get_max_width,
+18 -21
View File
@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems * and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices. * and smart IoT devices.
* *
* Copyright (C) 2002~2023, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming * Copyright (C) 1998~2002, WEI Yongming
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@@ -166,7 +166,7 @@ static unsigned short iso8859_68x_unicode_map [] =
0xFEB3, 0xFEB7, 0xFEBB, 0xFEBF, /*0xF1~0xF4*/ 0xFEB3, 0xFEB7, 0xFEBB, 0xFEBF, /*0xF1~0xF4*/
0xFECB, 0xFECF, 0xFED3, 0xFED7, /*0xF5~0xF8*/ 0xFECB, 0xFECF, 0xFED3, 0xFED7, /*0xF5~0xF8*/
0xFEDB, 0xFEDF, 0xFEE3, 0xFEE7, /*0xF9~0xFC*/ 0xFEDB, 0xFEDF, 0xFEE3, 0xFEE7, /*0xF9~0xFC*/
0xFEEB, 0xFEF3, 0xFFFF, /*0xFD~0xFF*/ 0xFEEB, 0xFEF4, 0xFFFF, /*0xFD~0xFF*/
0xFEC4, 0xFEC6, 0xFE82, 0xFE84, /*0x100~0x103*/ 0xFEC4, 0xFEC6, 0xFE82, 0xFE84, /*0x100~0x103*/
0xFE86, 0xFE88, 0xFE8C, 0xFE8E, /*0x104~0x107*/ 0xFE86, 0xFE88, 0xFE8C, 0xFE8E, /*0x104~0x107*/
@@ -226,7 +226,7 @@ static int iso8859_6_conv_from_uc32 (Uchar32 wc, unsigned char* mchar)
} }
#endif #endif
#if 0 /* must attetion the para s is arabic chv value.*/
static int is_arabic_char_vowel(Uint8 c) static int is_arabic_char_vowel(Uint8 c)
{ {
@@ -240,7 +240,6 @@ static int is_arabic_char_vowel(Uint8 c)
*/ */
return 0; return 0;
} }
#endif
/* ISO8859-6 charset vowel relative define and judge */ /* ISO8859-6 charset vowel relative define and judge */
#define ISARABIC_VOWEL(s) ((s >= FATHATAN) && (s <= SUKUN)) #define ISARABIC_VOWEL(s) ((s >= FATHATAN) && (s <= SUKUN))
@@ -462,18 +461,15 @@ static int iso8859_6_len_first_char (const unsigned char* mstr, int len)
return 2; return 2;
else if (ignore == 2) else if (ignore == 2)
return 3; return 3;
else
return 1;
return 1;
} }
#define ISARABIC_LIG_HALF(s) ((s == 0xa5) || (s == 0xa6)) #define ISARABIC_LIG_HALF(s) ((s == 0xa5) || (s == 0xa6))
static unsigned int iso8859_6_char_type (Achar32 chv) static unsigned int iso8859_6_char_type (Achar32 chv)
{ {
chv = REAL_ACHAR(chv);
#if 1
return sb_char_type(chv);
#else
unsigned int ch_type = ACHAR_BASIC_UNKNOWN; unsigned int ch_type = ACHAR_BASIC_UNKNOWN;
if (is_arabic_char_vowel (chv)) { /* is vowel */ if (is_arabic_char_vowel (chv)) { /* is vowel */
@@ -484,10 +480,10 @@ static unsigned int iso8859_6_char_type (Achar32 chv)
} }
return ch_type; return ch_type;
#endif
} }
static BidiType __mg_iso8859_6_bidi_char_type_map[] = { static BidiType __mg_iso8859_6_bidi_char_type_map[] = {
#if 0
/*0x00~0x0f*/ /*0x00~0x0f*/
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
@@ -535,6 +531,7 @@ static BidiType __mg_iso8859_6_bidi_char_type_map[] = {
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON,
BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_BN, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_BN,
#endif
/*0x80~0x8f*/ /*0x80~0x8f*/
BIDI_TYPE_ON, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_ON, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL,
@@ -576,7 +573,7 @@ static BidiType __mg_iso8859_6_bidi_char_type_map[] = {
BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL,
BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL,
BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL,
BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_ON,
/*0xf0~0xff*/ /*0xf0~0xff*/
BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL,
@@ -609,9 +606,10 @@ static BidiType __mg_iso8859_6_bidi_char_type_map[] = {
static BidiType iso8859_6_bidi_char_type (Achar32 chv) static BidiType iso8859_6_bidi_char_type (Achar32 chv)
{ {
chv = REAL_ACHAR(chv); chv = REAL_ACHAR(chv);
assert(chv < TABLESIZE(__mg_iso8859_6_bidi_char_type_map)); if (chv > 0x7F)
return (BidiType)__mg_iso8859_6_bidi_char_type_map[chv - 0x80];
return (BidiType)__mg_iso8859_6_bidi_char_type_map[chv]; else
return (BidiType)__mg_iso8859_1_bidi_char_type_map[chv];
} }
static int get_table_index(Uint8 c) static int get_table_index(Uint8 c)
@@ -798,7 +796,7 @@ static const unsigned char* iso8859_6_get_next_word (const unsigned char* mstr,
static Achar32 iso8859_6_get_shaped_char_value (const unsigned char* cur_mchar, static Achar32 iso8859_6_get_shaped_char_value (const unsigned char* cur_mchar,
int cur_len, int shape_type) int cur_len, int shape_type)
{ {
Achar32 chv = INV_ACHAR_VALUE; Achar32 chv = -1;
int ignore; int ignore;
int index; int index;
@@ -813,14 +811,15 @@ static Achar32 iso8859_6_get_shaped_char_value (const unsigned char* cur_mchar,
} }
} }
if (chv == INV_ACHAR_VALUE || chv == 0) { if (chv == -1 || chv == 0) {
if (ISARABIC_VOWEL(*cur_mchar)){ if (ISARABIC_VOWEL(*cur_mchar)){
chv = fontset_68x_get_vowel_char(*cur_mchar); chv = fontset_68x_get_vowel_char(*cur_mchar);
} }
if (chv == 0 || chv == INV_ACHAR_VALUE) { if (chv == 0 || chv == -1) {
index = get_table_index(*cur_mchar); index = get_table_index(*cur_mchar);
if (index >=0 ) { if (index >=0)
{
switch (shape_type) { switch (shape_type) {
case ACHAR_ISOLATED: case ACHAR_ISOLATED:
chv = shape_info[index].isolated; chv = shape_info[index].isolated;
@@ -842,7 +841,7 @@ static Achar32 iso8859_6_get_shaped_char_value (const unsigned char* cur_mchar,
} }
if (chv == 0) if (chv == 0)
chv = INV_ACHAR_VALUE; chv =-1;
return chv; return chv;
} }
@@ -863,7 +862,6 @@ static const BIDICHAR_MIRROR_MAP __mg_iso8859_68x_mirror_table [] =
static BOOL iso8859_6_bidi_mirror_char (Achar32 chv, Achar32* mirrored) static BOOL iso8859_6_bidi_mirror_char (Achar32 chv, Achar32* mirrored)
{ {
chv = REAL_ACHAR(chv);
return get_mirror_char (__mg_iso8859_68x_mirror_table, return get_mirror_char (__mg_iso8859_68x_mirror_table,
TABLESIZE (__mg_iso8859_68x_mirror_table), chv, mirrored); TABLESIZE (__mg_iso8859_68x_mirror_table), chv, mirrored);
} }
@@ -873,7 +871,6 @@ static CHARSETOPS CharsetOps_iso8859_6 = {
3, 3,
FONT_CHARSET_ISO8859_6, FONT_CHARSET_ISO8859_6,
0, 0,
1,
iso8859_6_len_first_char, iso8859_6_len_first_char,
iso8859_6_get_char_value, iso8859_6_get_char_value,
iso8859_6_get_shaped_char_value, iso8859_6_get_shaped_char_value,
+2 -33
View File
@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems * and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices. * and smart IoT devices.
* *
* Copyright (C) 2002~2023, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming * Copyright (C) 1998~2002, WEI Yongming
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@@ -210,8 +210,6 @@ static unsigned int unicode_char_type (Achar32 chv)
mchar_type = ACHAR_BASIC_LF; mchar_type = ACHAR_BASIC_LF;
else if (break_type == UCHAR_BREAK_SPACE) else if (break_type == UCHAR_BREAK_SPACE)
mchar_type = ACHAR_BASIC_SPACE; mchar_type = ACHAR_BASIC_SPACE;
else if (basic_type == UCHAR_CATEGORY_NON_SPACING_MARK)
mchar_type = ACHAR_BASIC_VOWEL;
else if (chv != 0x00AD && ISZEROWIDTHTYPE (basic_type)) else if (chv != 0x00AD && ISZEROWIDTHTYPE (basic_type))
mchar_type = ACHAR_BASIC_ZEROWIDTH; mchar_type = ACHAR_BASIC_ZEROWIDTH;
else if ((chv >= 0x1160 && chv < 0x1200) else if ((chv >= 0x1160 && chv < 0x1200)
@@ -241,36 +239,10 @@ static const BidiType linear_enum_to_bidi_type[] = {
#undef _UNIBIDI_ADD_TYPE #undef _UNIBIDI_ADD_TYPE
}; };
/* Since 5.0.13: this function only returns BidiType which
is recognizable by the legacy BIDI algorithm. */
static BidiType unicode_bidi_char_type(Achar32 ch) static BidiType unicode_bidi_char_type(Achar32 ch)
{ {
ch = REAL_ACHAR(ch); ch = REAL_ACHAR(ch);
BidiType bt = linear_enum_to_bidi_type[UNIBIDI_GET_BIDI_TYPE(ch)]; return linear_enum_to_bidi_type[UNIBIDI_GET_BIDI_TYPE(ch)];
switch (bt) {
case BIDI_TYPE_LTR:
case BIDI_TYPE_RTL:
case BIDI_TYPE_AL:
case BIDI_TYPE_EN:
case BIDI_TYPE_AN:
case BIDI_TYPE_ET:
case BIDI_TYPE_CS:
case BIDI_TYPE_NSM:
case BIDI_TYPE_BN:
case BIDI_TYPE_BS:
case BIDI_TYPE_SS:
case BIDI_TYPE_WS:
case BIDI_TYPE_ON:
case BIDI_TYPE_SOT:
case BIDI_TYPE_EOT:
return bt;
default:
_DBG_PRINTF("Not recognizable for char (0x%04x): %u\n", ch, bt);
break;
}
return BIDI_TYPE_WS;
} }
BidiType GUIAPI UCharGetBidiType(Uchar32 uc) BidiType GUIAPI UCharGetBidiType(Uchar32 uc)
@@ -656,7 +628,6 @@ CHARSETOPS __mg_CharsetOps_utf8 = {
6, 6,
FONT_CHARSET_UTF8, FONT_CHARSET_UTF8,
0, 0,
0,
utf8_len_first_char, utf8_len_first_char,
utf8_get_char_value, utf8_get_char_value,
NULL, NULL,
@@ -883,7 +854,6 @@ CHARSETOPS __mg_CharsetOps_utf16le = {
4, 4,
FONT_CHARSET_UTF16LE, FONT_CHARSET_UTF16LE,
0, 0,
0,
utf16le_len_first_char, utf16le_len_first_char,
utf16le_get_char_value, utf16le_get_char_value,
NULL, NULL,
@@ -1110,7 +1080,6 @@ CHARSETOPS __mg_CharsetOps_utf16be = {
4, 4,
FONT_CHARSET_UTF16BE, FONT_CHARSET_UTF16BE,
0, 0,
0,
utf16be_len_first_char, utf16be_len_first_char,
utf16be_get_char_value, utf16be_get_char_value,
NULL, NULL,
+7 -30
View File
File diff suppressed because it is too large Load Diff
-12
View File
@@ -255,17 +255,6 @@ compute_kernval (TTFINSTANCEINFO* ttf_inst_info)
return kernval; return kernval;
} }
static DWORD get_feature (LOGFONT* logfont, DEVFONT* devfont,
enum devfont_feature feature)
{
switch (feature) {
case DEVFONT_FEATURE_MARK_BBOX:
return 0;
}
return 0;
}
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont) static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
{ {
if (logfont->style & FS_WEIGHT_BOOK) if (logfont->style & FS_WEIGHT_BOOK)
@@ -803,7 +792,6 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
} }
/**************************** Global data ************************************/ /**************************** Global data ************************************/
FONTOPS __mg_ttf_ops = { FONTOPS __mg_ttf_ops = {
get_feature,
get_glyph_bmptype, get_glyph_bmptype,
get_ave_width, get_ave_width,
get_max_width, get_max_width,
-12
View File
@@ -197,17 +197,6 @@ print_bitmap_grey (const BYTE* buffer, int width, int rows, int pitch)
printf("*******************************************\n"); printf("*******************************************\n");
} }
static DWORD get_feature (LOGFONT* logfont, DEVFONT* devfont,
enum devfont_feature feature)
{
switch (feature) {
case DEVFONT_FEATURE_MARK_BBOX:
return 1;
}
return 0;
}
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont) static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
{ {
switch (logfont->style & FS_RENDER_MASK) { switch (logfont->style & FS_RENDER_MASK) {
@@ -1276,7 +1265,6 @@ void font_TermFreetypeLibrary (void)
/**************************** Global data ************************************/ /**************************** Global data ************************************/
FONTOPS __mg_ttf_ops = { FONTOPS __mg_ttf_ops = {
get_feature,
get_glyph_bmptype, get_glyph_bmptype,
get_ave_width, get_ave_width,
get_max_width, get_max_width,
+18 -125
View File
File diff suppressed because it is too large Load Diff
-12
View File
@@ -66,17 +66,6 @@
#define NUF_WIDTH 8 #define NUF_WIDTH 8
#define NUF_HEIGHT 1 #define NUF_HEIGHT 1
static DWORD get_feature (LOGFONT* logfont, DEVFONT* devfont,
enum devfont_feature feature)
{
switch (feature) {
case DEVFONT_FEATURE_MARK_BBOX:
return 0;
}
return 0;
}
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont) static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
{ {
return DEVFONTGLYPHTYPE_MONOBMP; return DEVFONTGLYPHTYPE_MONOBMP;
@@ -182,7 +171,6 @@ static void unload_font_data (DEVFONT* devfont, void* data)
} }
FONTOPS __mg_null_font_ops = { FONTOPS __mg_null_font_ops = {
get_feature,
get_glyph_bmptype, get_glyph_bmptype,
get_ave_width, get_ave_width,
get_max_width, get_max_width,
-12
View File
@@ -287,17 +287,6 @@ static unsigned char def_smooth_bitmap [] =
static QPF_GLYPH def_glyph = {&def_metrics, def_bitmap}; static QPF_GLYPH def_glyph = {&def_metrics, def_bitmap};
static QPF_GLYPH def_smooth_glyph = {&def_smooth_metrics, def_smooth_bitmap}; static QPF_GLYPH def_smooth_glyph = {&def_smooth_metrics, def_smooth_bitmap};
static DWORD get_feature (LOGFONT* logfont, DEVFONT* devfont,
enum devfont_feature feature)
{
switch (feature) {
case DEVFONT_FEATURE_MARK_BBOX:
return 0;
}
return 0;
}
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont) static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
{ {
if (QPFONT_INFO_P (devfont)->fm->flags & FLAG_MODE_SMOOTH) if (QPFONT_INFO_P (devfont)->fm->flags & FLAG_MODE_SMOOTH)
@@ -552,7 +541,6 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
/**************************** Global data ************************************/ /**************************** Global data ************************************/
FONTOPS __mg_qpf_ops = { FONTOPS __mg_qpf_ops = {
get_feature,
get_glyph_bmptype, get_glyph_bmptype,
get_ave_width, get_ave_width,
get_max_width, get_max_width,
-12
View File
@@ -151,17 +151,6 @@ static void unload_font_data (DEVFONT* devfont, void* data)
/*************** Raw bitmap font operations *********************************/ /*************** Raw bitmap font operations *********************************/
static DWORD get_feature (LOGFONT* logfont, DEVFONT* devfont,
enum devfont_feature feature)
{
switch (feature) {
case DEVFONT_FEATURE_MARK_BBOX:
return 0;
}
return 0;
}
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont) static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
{ {
return DEVFONTGLYPHTYPE_MONOBMP; return DEVFONTGLYPHTYPE_MONOBMP;
@@ -291,7 +280,6 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
/**************************** Global data ************************************/ /**************************** Global data ************************************/
FONTOPS __mg_rbf_ops = { FONTOPS __mg_rbf_ops = {
get_feature,
get_glyph_bmptype, get_glyph_bmptype,
get_ave_width, get_ave_width,
get_ave_width, // max_width same as ave_width get_ave_width, // max_width same as ave_width
-12
View File
@@ -377,17 +377,6 @@ static int get_max_width (LOGFONT* logfont, DEVFONT* devfont)
return logfont->size; return logfont->size;
} }
static DWORD get_feature (LOGFONT* logfont, DEVFONT* devfont,
enum devfont_feature feature)
{
switch (feature) {
case DEVFONT_FEATURE_MARK_BBOX:
return 0;
}
return 0;
}
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont) static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
{ {
if (logfont->style & FS_WEIGHT_BOOK) if (logfont->style & FS_WEIGHT_BOOK)
@@ -609,7 +598,6 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
/**************************** Global data ************************************/ /**************************** Global data ************************************/
static FONTOPS scripteasy_font_ops = { static FONTOPS scripteasy_font_ops = {
get_feature,
get_glyph_bmptype, get_glyph_bmptype,
get_ave_width, get_ave_width,
get_max_width, get_max_width,
+1 -4
View File
@@ -155,10 +155,7 @@ BOOL mg_InitSysFont (void)
goto error_load; goto error_load;
} }
/* VW 20221003: use CreateLogFontEx instead of CreateLogFont to if ((sys_fonts[i] = CreateLogFont (type, family, charset,
follow the new style convention of font name,
but the orientation is ignored for the system logfont. */
if ((sys_fonts[i] = CreateLogFontEx (type, family, charset,
style [0], style [1], style [2], style [0], style [1], style [2],
style [3], style [4], style [5], style [3], style [4], style [5],
height, 0)) == NULL) { height, 0)) == NULL) {
+3 -2
View File
@@ -377,8 +377,8 @@ static _GBType resolve_gbt(struct break_ctxt* ctxt,
uc == 0x8E2 || uc == 0xD4E || uc == 0x110BD || uc == 0x8E2 || uc == 0xD4E || uc == 0x110BD ||
(uc >= 0x111C2 && uc <= 0x111C3)) { (uc >= 0x111C2 && uc <= 0x111C3)) {
gbt = GB_Prepend; gbt = GB_Prepend;
break;
} }
break;
case UCHAR_CATEGORY_CONTROL: case UCHAR_CATEGORY_CONTROL:
case UCHAR_CATEGORY_LINE_SEPARATOR: case UCHAR_CATEGORY_LINE_SEPARATOR:
@@ -393,8 +393,8 @@ static _GBType resolve_gbt(struct break_ctxt* ctxt,
if ((uc >= 0xFFF0 && uc <= 0xFFF8) || if ((uc >= 0xFFF0 && uc <= 0xFFF8) ||
(uc >= 0xE0000 && uc <= 0xE0FFF)) { (uc >= 0xE0000 && uc <= 0xE0FFF)) {
gbt = GB_ControlCRLF; gbt = GB_ControlCRLF;
break;
} }
break;
case UCHAR_CATEGORY_OTHER_LETTER: case UCHAR_CATEGORY_OTHER_LETTER:
if (ctxt->makes_hangul_syllable) if (ctxt->makes_hangul_syllable)
@@ -434,6 +434,7 @@ static _GBType resolve_gbt(struct break_ctxt* ctxt,
gbt = GB_RI_Odd; gbt = GB_RI_Odd;
else else
gbt = GB_RI_Odd; gbt = GB_RI_Odd;
break;
} }
break; break;
+4 -3
View File
@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems * and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices. * and smart IoT devices.
* *
* Copyright (C) 2002~2026, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming * Copyright (C) 1998~2002, WEI Yongming
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@@ -57,7 +57,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdbool.h>
#include "common.h" #include "common.h"
#include "minigui.h" #include "minigui.h"
@@ -216,6 +215,8 @@ static unsigned char emojiSegmentationCategory (Uchar32 codepoint)
} }
typedef BOOL bool;
enum { false = FALSE, true = TRUE };
typedef unsigned char *emoji_text_iter_t; typedef unsigned char *emoji_text_iter_t;
#include "emoji_presentation_scanner.inc" #include "emoji_presentation_scanner.inc"
@@ -250,7 +251,7 @@ EmojiIterator * __mg_emoji_iterator_init (EmojiIterator *iter,
BOOL __mg_emoji_iterator_next (EmojiIterator *iter) BOOL __mg_emoji_iterator_next (EmojiIterator *iter)
{ {
unsigned int old_cursor, cursor; unsigned int old_cursor, cursor;
bool is_emoji; BOOL is_emoji;
if (iter->end >= iter->text_end) if (iter->end >= iter->text_end)
return FALSE; return FALSE;
-12
View File
@@ -148,17 +148,6 @@ static void unload_font_data (DEVFONT* devfont, void* data)
free (((UPFINFO*) data)); free (((UPFINFO*) data));
} }
static DWORD get_feature (LOGFONT* logfont, DEVFONT* devfont,
enum devfont_feature feature)
{
switch (feature) {
case DEVFONT_FEATURE_MARK_BBOX:
return 0;
}
return 0;
}
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont) static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
{ {
Uint8* p_upf = (Uint8 *)UPFONT_INFO_P (devfont)->root_dir; Uint8* p_upf = (Uint8 *)UPFONT_INFO_P (devfont)->root_dir;
@@ -536,7 +525,6 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
} }
FONTOPS __mg_upf_ops = { FONTOPS __mg_upf_ops = {
get_feature,
get_glyph_bmptype, get_glyph_bmptype,
get_ave_width, get_ave_width,
get_max_width, get_max_width,
-12
View File
@@ -109,17 +109,6 @@ typedef struct _FONT_PROPT {
int def_glyph; int def_glyph;
} FONT_PROPT; } FONT_PROPT;
static DWORD get_feature (LOGFONT* logfont, DEVFONT* devfont,
enum devfont_feature feature)
{
switch (feature) {
case DEVFONT_FEATURE_MARK_BBOX:
return 0;
}
return 0;
}
static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont) static DWORD get_glyph_bmptype (LOGFONT* logfont, DEVFONT* devfont)
{ {
return DEVFONTGLYPHTYPE_MONOBMP; return DEVFONTGLYPHTYPE_MONOBMP;
@@ -488,7 +477,6 @@ static void unload_font_data (DEVFONT* devfont, void* data)
} }
FONTOPS __mg_vbf_ops = { FONTOPS __mg_vbf_ops = {
get_feature,
get_glyph_bmptype, get_glyph_bmptype,
get_ave_width, get_ave_width,
get_max_width, get_max_width,
+1
View File
@@ -59,6 +59,7 @@
#include "cliprect.h" #include "cliprect.h"
#include "gal.h" #include "gal.h"
#include "internals.h" #include "internals.h"
#include "blockheap.h"
#include "accelkey.h" #include "accelkey.h"
static BLOCKHEAP ACHeap; static BLOCKHEAP ACHeap;
+18 -59
View File
@@ -59,22 +59,17 @@
#include "cliprect.h" #include "cliprect.h"
#include "gal.h" #include "gal.h"
#include "internals.h" #include "internals.h"
#include "dc.h"
BOOL GUIAPI CreateCaret (HWND hWnd, PBITMAP pBitmap, int nWidth, int nHeight) BOOL GUIAPI CreateCaret (HWND hWnd, PBITMAP pBitmap, int nWidth, int nHeight)
{ {
PMAINWIN pWin; PMAINWIN pWin;
pWin = (PMAINWIN)hWnd; pWin = (PMAINWIN)hWnd;
if (!pWin->pCaretInfo) { if (!pWin->pCaretInfo) {
HDC hdc;
if (!(pWin->pCaretInfo = malloc (sizeof (CARETINFO)))) if (!(pWin->pCaretInfo = malloc (sizeof (CARETINFO))))
return FALSE; return FALSE;
/* Since 5.0.11: use client DC of the window instead of screen DC */
hdc = GetClientDC(hWnd);
pWin->pCaretInfo->pBitmap = pBitmap; pWin->pCaretInfo->pBitmap = pBitmap;
if (pBitmap) { if (pBitmap) {
nWidth = pBitmap->bmWidth; nWidth = pBitmap->bmWidth;
@@ -83,22 +78,18 @@ BOOL GUIAPI CreateCaret (HWND hWnd, PBITMAP pBitmap, int nWidth, int nHeight)
pWin->pCaretInfo->nWidth = nWidth; pWin->pCaretInfo->nWidth = nWidth;
pWin->pCaretInfo->nHeight = nHeight; pWin->pCaretInfo->nHeight = nHeight;
pWin->pCaretInfo->caret_bmp.bmType = BMP_TYPE_NORMAL; pWin->pCaretInfo->caret_bmp.bmType = BMP_TYPE_NORMAL;
pWin->pCaretInfo->caret_bmp.bmBitsPerPixel = pWin->pCaretInfo->caret_bmp.bmBitsPerPixel = BITSPERPHYPIXEL;
GetGDCapability(hdc, GDCAP_BITSPP); pWin->pCaretInfo->caret_bmp.bmBytesPerPixel = BYTESPERPHYPIXEL;
pWin->pCaretInfo->caret_bmp.bmBytesPerPixel =
GetGDCapability(hdc, GDCAP_BPP);
pWin->pCaretInfo->caret_bmp.bmWidth = nWidth; pWin->pCaretInfo->caret_bmp.bmWidth = nWidth;
pWin->pCaretInfo->caret_bmp.bmHeight = nHeight; pWin->pCaretInfo->caret_bmp.bmHeight = nHeight;
pWin->pCaretInfo->caret_bmp.bmAlphaMask = NULL; pWin->pCaretInfo->caret_bmp.bmAlphaMask = NULL;
pWin->pCaretInfo->caret_bmp.bmAlphaPitch = 0; pWin->pCaretInfo->caret_bmp.bmAlphaPitch = 0;
pWin->pCaretInfo->nBytesNr = GAL_GetBoxSize (dc_HDC2PDC(hdc)->surface, pWin->pCaretInfo->nBytesNr = GAL_GetBoxSize (__gal_screen,
nWidth, nHeight, &pWin->pCaretInfo->caret_bmp.bmPitch); nWidth, nHeight, &pWin->pCaretInfo->caret_bmp.bmPitch);
pWin->pCaretInfo->pNormal = malloc (pWin->pCaretInfo->nBytesNr); pWin->pCaretInfo->pNormal = malloc (pWin->pCaretInfo->nBytesNr);
pWin->pCaretInfo->pXored = malloc (pWin->pCaretInfo->nBytesNr); pWin->pCaretInfo->pXored = malloc (pWin->pCaretInfo->nBytesNr);
ReleaseDC(hdc);
if (pWin->pCaretInfo->pNormal == NULL || if (pWin->pCaretInfo->pNormal == NULL ||
pWin->pCaretInfo->pXored == NULL) { pWin->pCaretInfo->pXored == NULL) {
free (pWin->pCaretInfo); free (pWin->pCaretInfo);
@@ -228,8 +219,8 @@ void GetCaretBitmaps (PCARETINFO pCaretInfo)
int i; int i;
int sx, sy; int sx, sy;
HDC hdc; HDC hdc;
Uint32 amask;
// convert to screen coordinates
sx = pCaretInfo->x; sx = pCaretInfo->x;
sy = pCaretInfo->y; sy = pCaretInfo->y;
@@ -240,68 +231,36 @@ void GetCaretBitmaps (PCARETINFO pCaretInfo)
pCaretInfo->caret_bmp.bmWidth, pCaretInfo->caret_bmp.bmWidth,
pCaretInfo->caret_bmp.bmHeight, pCaretInfo->caret_bmp.bmHeight,
&pCaretInfo->caret_bmp); &pCaretInfo->caret_bmp);
amask = GetGDCapability(hdc, GDCAP_AMASK);
ReleaseDC (hdc); ReleaseDC (hdc);
// generate XOR bitmap. // generate XOR bitmap.
if (amask == 0) { if (pCaretInfo->pBitmap) {
BYTE* normal; BYTE* normal;
BYTE* bitmap; BYTE* bitmap;
BYTE* xored; BYTE* xored;
normal = pCaretInfo->pNormal; normal = pCaretInfo->pNormal;
bitmap = pCaretInfo->pBitmap->bmBits;
xored = pCaretInfo->pXored; xored = pCaretInfo->pXored;
if (pCaretInfo->pBitmap) { for (i = 0; i < pCaretInfo->nBytesNr; i++)
bitmap = pCaretInfo->pBitmap->bmBits; xored[i] = normal[i] ^ bitmap[i];
for (i = 0; i < pCaretInfo->nBytesNr; i++)
xored[i] = normal[i] ^ bitmap[i];
}
else {
for (i = 0; i < pCaretInfo->nBytesNr; i++)
xored[i] = normal[i] ^ 0xFF;
}
} }
else { else {
// Since 5.0.11: restore the alpha component if having alpha component.
int x, y;
BYTE* normal; BYTE* normal;
BYTE* xored; BYTE* xored;
BYTE* bitmap = NULL; BYTE xor_byte;
gal_pixel pix_normal, pix_bitmap, pix_xored, bits_alpha;
for (y = 0; y < pCaretInfo->caret_bmp.bmHeight; y++) { if (BITSPERPHYPIXEL < 8)
normal = pCaretInfo->pNormal + pCaretInfo->caret_bmp.bmPitch * y; xor_byte = 0x0F;
xored = pCaretInfo->pXored + pCaretInfo->caret_bmp.bmPitch * y; else
if (pCaretInfo->pBitmap) xor_byte = 0xFF;
bitmap = pCaretInfo->pBitmap->bmBits +
pCaretInfo->caret_bmp.bmPitch * y;
for (x = 0; x < pCaretInfo->caret_bmp.bmWidth; x++) { normal = pCaretInfo->pNormal;
xored = pCaretInfo->pXored;
pix_normal = _mem_get_pixel(normal, for (i = 0; i < pCaretInfo->nBytesNr; i++)
pCaretInfo->caret_bmp.bmBytesPerPixel); xored[i] = normal[i] ^ xor_byte;
if (pCaretInfo->pBitmap) {
pix_bitmap = _mem_get_pixel(bitmap,
pCaretInfo->caret_bmp.bmBytesPerPixel);
}
else {
pix_bitmap = 0xFFFFFFFF;
}
bits_alpha = pix_normal & amask;
pix_xored = pix_normal ^ pix_bitmap;
pix_xored &= ~amask;
pix_xored |= bits_alpha;
_mem_set_pixel(xored,
pCaretInfo->caret_bmp.bmBytesPerPixel, pix_xored);
normal += pCaretInfo->caret_bmp.bmBytesPerPixel;
xored += pCaretInfo->caret_bmp.bmBytesPerPixel;
if (pCaretInfo->pBitmap)
bitmap += pCaretInfo->caret_bmp.bmBytesPerPixel;
}
}
} }
} }
+2 -2
View File
@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems * and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices. * and smart IoT devices.
* *
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming * Copyright (C) 1998~2002, WEI Yongming
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@@ -803,7 +803,7 @@ BOOL GUIAPI InitWindowElementAttrs (PWERENDERER rdr)
char buff [20]; char buff [20];
DWORD rgba; DWORD rgba;
if (!rdr || rdr->name[0] == '\0') if (!rdr || !rdr->name || rdr->name[0] == '\0')
return FALSE; return FALSE;
_DBG_PRINTF ("GUI>InitWEA: Initialize %s renderer window element attributes.\n", _DBG_PRINTF ("GUI>InitWEA: Initialize %s renderer window element attributes.\n",
+2 -1
View File
@@ -71,6 +71,7 @@
#include "cliprect.h" #include "cliprect.h"
#include "gal.h" #include "gal.h"
#include "internals.h" #include "internals.h"
#include "blockheap.h"
#include "menu.h" #include "menu.h"
#define SHORTEN 0 #define SHORTEN 0
@@ -2185,7 +2186,7 @@ static int create_memdc_for_menu (TRACKMENUINFO* ptmi)
return -1; return -1;
} }
ptmi->dc = __mg_create_memdc_for_surface (surf); ptmi->dc = CreateMemDCFromSurface (surf);
if (ptmi->dc == HDC_INVALID) { if (ptmi->dc == HDC_INVALID) {
GAL_FreeSurface (surf); GAL_FreeSurface (surf);
return -1; return -1;
+55 -115
View File
File diff suppressed because it is too large Load Diff
-14
View File
@@ -319,19 +319,6 @@ static void flush_rec (void)
#endif #endif
} }
static void close_rec (void)
{
#ifdef WIN32
/* TODO: */
#else
if (record_fd >= 0) {
close(record_fd);
record_fd = -1;
}
#endif
}
static void do_record(AUTO_IAL_INPUT_EVENT *event) static void do_record(AUTO_IAL_INPUT_EVENT *event)
{ {
@@ -757,7 +744,6 @@ void TermPCXVFBInput (void)
remove("/tmp/.pcxvfb_tmp"); remove("/tmp/.pcxvfb_tmp");
} }
#endif #endif
close_rec();
#endif /* WIN32 */ #endif /* WIN32 */
} }
+1 -1
View File
@@ -3,7 +3,7 @@ noinst_HEADERS = \
cursor.h dc.h event.h list.h element.h \ cursor.h dc.h event.h list.h element.h \
ial.h inline.h internals.h zorder.h menu.h misc.h \ ial.h inline.h internals.h zorder.h menu.h misc.h \
msgstr.h sysfont.h timer.h devfont.h fontname.h \ msgstr.h sysfont.h timer.h devfont.h fontname.h \
readbmp.h icon.h rbtree.h \ readbmp.h icon.h blockheap.h rbtree.h \
ourhdr.h client.h server.h sharedres.h sockio.h drawsemop.h \ ourhdr.h client.h server.h sharedres.h sockio.h drawsemop.h \
gal.h newgal.h memops.h incoreres.h sysres.h clipboard.h \ gal.h newgal.h memops.h incoreres.h sysres.h clipboard.h \
glyph.h license.h mgsock.h unicode-ops.h \ glyph.h license.h mgsock.h unicode-ops.h \
+3 -3
View File
@@ -112,11 +112,11 @@ void __mg_legacy_bidi_get_embeddlevels (const CHARSETOPS* charset_ops,
Uint32 __mg_legacy_bidi_str_base_dir (const CHARSETOPS* charset_ops, Uint32 __mg_legacy_bidi_str_base_dir (const CHARSETOPS* charset_ops,
Achar32* achars, int len); Achar32* achars, int len);
Achar32* __mg_legacy_bidi_map_reorder (const CHARSETOPS* charset_ops,
Achar32* achars, int len, int pel, ACHARMAPINFO* map);
#if 0 #if 0
// Deprecated // Deprecated
Achar32* __mg_legacy_bidi_map_reorder (const CHARSETOPS* charset_ops,
Achar32* achars, int len, GLYPHMAPINFO* map, int pel);
Achar32* __mg_legacy_bidi_index_reorder (const CHARSETOPS* charset_ops, Achar32* __mg_legacy_bidi_index_reorder (const CHARSETOPS* charset_ops,
Achar32* achars, int len, int* index_map, int pel); Achar32* achars, int len, int* index_map, int pel);
#endif #endif
+1
View File
@@ -70,6 +70,7 @@ struct _SCALER_INFO_FILLBMP
typedef struct { typedef struct {
struct _SCALER_INFO_FILLBMP scaler_info; struct _SCALER_INFO_FILLBMP scaler_info;
GAL_Rect dst_rect; GAL_Rect dst_rect;
int old_bkmode;
BYTE* decoded_buff; BYTE* decoded_buff;
BYTE* decoded_alpha_buff; BYTE* decoded_alpha_buff;
@@ -47,8 +47,6 @@
** blockheap.h: the head file of heap for block data. ** blockheap.h: the head file of heap for block data.
** **
** Create date: 2001/01/10 ** Create date: 2001/01/10
**
** DEPRECATED, USE window.h INSTEAD.
*/ */
#ifndef GUI_BLOCKHEAP_H #ifndef GUI_BLOCKHEAP_H
@@ -57,7 +55,7 @@
#ifndef _MGUI_GDI_H /* included in include/gdi.h */ #ifndef _MGUI_GDI_H /* included in include/gdi.h */
struct _BLOCKHEAP { struct _BLOCKHEAP {
#ifdef _MGHAVE_VIRTUAL_WINDOW #ifdef _MGRM_THREADS
pthread_mutex_t lock; pthread_mutex_t lock;
#endif #endif
/* Size of one block element. */ /* Size of one block element. */
+2 -27
View File
@@ -105,10 +105,6 @@
#define REQID_GETSHAREDSURFACE 0x001C #define REQID_GETSHAREDSURFACE 0x001C
// for compositing schema // for compositing schema
#define SYSSF_WALLPAPER_PATTER "syssf-wallpaper-pattern" #define SYSSF_WALLPAPER_PATTER "syssf-wallpaper-pattern"
#define APPSF_NAME_PREFIX "appsf-name-"
#define APPSF_NAME_PATTER "appsf-name-%s"
#define APPSF_HWND_PREFIX "appsf-hwnd-"
#define APPSF_HWND_PATTER "appsf-hwnd-%d-%p"
// for sharedfb schema // for sharedfb schema
#define SYSSF_REAL_SCREEN "syssf-real-screen" #define SYSSF_REAL_SCREEN "syssf-real-screen"
#define SYSSF_SHADOW_SCREEN "syssf-shadow-screen" #define SYSSF_SHADOW_SCREEN "syssf-shadow-screen"
@@ -117,22 +113,10 @@
#define REQID_LOADCURSOR_PNG 0x001D #define REQID_LOADCURSOR_PNG 0x001D
// Load cursor from in-memory PNG // Load cursor from in-memory PNG
#define REQID_LOADCURSOR_PNG_MEM 0x001E #define REQID_LOADCURSOR_PNG_MEM 0x001E
#if 0 // Deprecated since 5.2.0
// allocate semaphore for shared surface // allocate semaphore for shared surface
#define REQID_ALLOC_SURF_SEM 0x001F #define REQID_ALLOC_SURF_SEM 0x001F
// free semaphore of shared surface // free semaphore of shared surface
#define REQID_FREE_SURF_SEM 0x0020 #define REQID_FREE_SURF_SEM 0x0020
#endif
/* Since 5.2.0 */
// Operate a shared surface to register/revoke the name and set the fd
#define REQID_OPERATENAMEDSSURF 0x001F
#define ID_NAMEDSSURFOP_REGISTER 1
#define ID_NAMEDSSURFOP_SET 2
#define ID_NAMEDSSURFOP_REVOKE 3
#define REQID_RESERVED 0x0020
// Move the current client to another layer // Move the current client to another layer
#define REQID_MOVETOLAYER 0x0021 #define REQID_MOVETOLAYER 0x0021
@@ -158,23 +142,15 @@ MGUI_COMPILE_TIME_ASSERT(sys_request_id, MAX_SYS_REQID >= REQID_SYS_LAST);
#undef MGUI_COMPILE_TIME_ASSERT #undef MGUI_COMPILE_TIME_ASSERT
/* Since 5.2.0 */
typedef struct OperateNSSurfInfo
{
int id_op;
char name[NAME_MAX + 1];
size_t map_size;
} OPERATENSSURFINFO;
/* Since 5.0.0 */ /* Since 5.0.0 */
typedef struct _SharedSurfInfo { typedef struct _SharedSurfInfo {
size_t size; // whole size of the surface
off_t offset; // offset of pixel data
uint32_t flags; // the flags of the surface uint32_t flags; // the flags of the surface
uint32_t width, height; uint32_t width, height;
uint32_t pitch; uint32_t pitch;
uint32_t name; // when use flink name uint32_t name; // when use flink name
uint32_t drm_format; // DRM pixel format uint32_t drm_format; // DRM pixel format
size_t size; // whole size of the surface
off_t offset; // offset of pixel data
} SHAREDSURFINFO; } SHAREDSURFINFO;
typedef struct JoinLayerInfo { typedef struct JoinLayerInfo {
@@ -383,7 +359,6 @@ void __mg_start_client_desktop (void);
void __mg_update_window (HWND hwnd, int left, int top, int right, int bottom); void __mg_update_window (HWND hwnd, int left, int top, int right, int bottom);
BOOL __mg_client_check_znode_hwnd (int slot, HWND hwnd, int cli);
BOOL __mg_client_check_hwnd (HWND hwnd, int cli); BOOL __mg_client_check_hwnd (HWND hwnd, int cli);
BOOL __mg_client_on_layer_changed (GHANDLE layer_handle, int zi_shmid); BOOL __mg_client_on_layer_changed (GHANDLE layer_handle, int zi_shmid);
+6 -13
View File
@@ -93,7 +93,7 @@ typedef struct tagDC* PDC;
# else /* not defined _MGSCHEMA_COMPOSITING */ # else /* not defined _MGSCHEMA_COMPOSITING */
void __mg_lock_recalc_gcrinfo (PDC pdc); void __mg_lock_recalc_gcrinfo (PDC pdc);
void __mg_unlock_gcrinfo (PDC pdc); void __mg_unlock_gcrinfo (PDC pdc);
#define LOCK_GCRINFO(pdc) if (dc_IsGeneralDC(pdc)) __mg_lock_recalc_gcrinfo (pdc) #define LOCK_GCRINFO(pdc) __mg_lock_recalc_gcrinfo (pdc)
#define UNLOCK_GCRINFO(pdc) if (dc_IsGeneralDC(pdc)) __mg_unlock_gcrinfo (pdc) #define UNLOCK_GCRINFO(pdc) if (dc_IsGeneralDC(pdc)) __mg_unlock_gcrinfo (pdc)
# endif /* not defined _MGSCHEMA_COMPOSITING */ # endif /* not defined _MGSCHEMA_COMPOSITING */
@@ -167,8 +167,6 @@ struct tagDC
/* surface of this DC */ /* surface of this DC */
GAL_Surface* surface; GAL_Surface* surface;
char __first_attr[0]; // just a zero-length field for the first attribute
/* background color */ /* background color */
gal_pixel bkcolor; gal_pixel bkcolor;
@@ -181,7 +179,7 @@ struct tagDC
/* text color */ /* text color */
gal_pixel textcolor; gal_pixel textcolor;
int bkmode_set; /* the background mode set by user (5.0.12, Issue #107) */ int bkmode;
int tabstop; int tabstop;
int cExtra; /* Character extra */ int cExtra; /* Character extra */
@@ -215,8 +213,6 @@ struct tagDC
size_t dash_list_len; size_t dash_list_len;
#endif #endif
char __last_attr[0]; // just a zero-length field for the last attribute
PLOGFONT pLogFont; PLOGFONT pLogFont;
POINT CurPenPos; POINT CurPenPos;
@@ -251,7 +247,6 @@ struct tagDC
gal_pixel skip_pixel; gal_pixel skip_pixel;
gal_pixel cur_pixel; gal_pixel cur_pixel;
int step; int step;
int bkmode; /* the effective background mode */
/* ====================================================================== */ /* ====================================================================== */
CLIPRECT* cur_ban; CLIPRECT* cur_ban;
@@ -521,16 +516,14 @@ static inline void _dc_step_y (PDC pdc, int step)
# define BLOCK_DRAW_SEM(pdc) \ # define BLOCK_DRAW_SEM(pdc) \
do { \ do { \
if (pdc->surface->shared_header) { \ if (pdc->surface->shared_header) \
__mg_lock_file_for_write(pdc->surface->fd); \ LOCK_SURFACE_SEM (pdc->surface->shared_header->sem_num); \
} \
} while (0) } while (0)
# define UNBLOCK_DRAW_SEM(pdc) \ # define UNBLOCK_DRAW_SEM(pdc) \
do { \ do { \
if (pdc->surface->shared_header) { \ if (pdc->surface->shared_header) \
__mg_unlock_file_for_write(pdc->surface->fd); \ UNLOCK_SURFACE_SEM (pdc->surface->shared_header->sem_num); \
} \
} while (0) } while (0)
# define IS_SCREEN_SURFACE(pdc) \ # define IS_SCREEN_SURFACE(pdc) \
+1 -12
View File
@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems * and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices. * and smart IoT devices.
* *
* Copyright (C) 2002~2023, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming * Copyright (C) 1998~2002, WEI Yongming
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@@ -209,9 +209,6 @@ struct _CHARSETOPS
/** Default character. */ /** Default character. */
Achar32 def_char_value; Achar32 def_char_value;
/** Whether using legacy BIDI algorithm (Since 5.0.13). */
unsigned legacy_bidi:1;
/** The method to get the length of the first character. */ /** The method to get the length of the first character. */
int (*len_first_char) (const unsigned char* mstr, int mstrlen); int (*len_first_char) (const unsigned char* mstr, int mstrlen);
@@ -266,17 +263,9 @@ struct _CHARSETOPS
#define DEVFONTGLYPHTYPE_MASK_BMPTYPE 0x0F #define DEVFONTGLYPHTYPE_MASK_BMPTYPE 0x0F
enum devfont_feature {
DEVFONT_FEATURE_MARK_BBOX = 0,
};
/** The font operation structure. */ /** The font operation structure. */
struct _FONTOPS struct _FONTOPS
{ {
/** The method to get the feature value of the font (Since 5.0.13). */
DWORD (*get_feature) (LOGFONT* logfont, DEVFONT* devfont,
enum devfont_feature feature);
/** The method to get the glyph bitmap type . */ /** The method to get the glyph bitmap type . */
DWORD (*get_glyph_bmptype) (LOGFONT* logfont, DEVFONT* devfont); DWORD (*get_glyph_bmptype) (LOGFONT* logfont, DEVFONT* devfont);
+8 -10
View File
@@ -51,9 +51,11 @@
#ifndef GUI_DRAWSEMOP_H #ifndef GUI_DRAWSEMOP_H
#define GUI_DRAWSEMOP_H #define GUI_DRAWSEMOP_H
#include <errno.h> #ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "misc.h" #include <errno.h>
static inline void my_sem_op (int semid, int num, int op) static inline void my_sem_op (int semid, int num, int op)
{ {
@@ -68,9 +70,6 @@ again:
if (errno == EINTR) { if (errno == EINTR) {
goto again; goto again;
} }
else {
_ERR_PRINTF("Failed semop: %m\n");
}
} }
} }
@@ -80,7 +79,10 @@ again:
#define LOCK_SCREEN_SEM() my_sem_op(SHAREDRES_SEMID, _IDX_SEM_SCR, -1) #define LOCK_SCREEN_SEM() my_sem_op(SHAREDRES_SEMID, _IDX_SEM_SCR, -1)
#define UNLOCK_SCREEN_SEM() my_sem_op(SHAREDRES_SEMID, _IDX_SEM_SCR, 1) #define UNLOCK_SCREEN_SEM() my_sem_op(SHAREDRES_SEMID, _IDX_SEM_SCR, 1)
extern int __mg_client_id; #ifdef _MGSCHEMA_COMPOSITING
# define LOCK_SURFACE_SEM(num) my_sem_op(SHAREDRES_SEMID_SHARED_SURF, num, -1)
# define UNLOCK_SURFACE_SEM(num) my_sem_op(SHAREDRES_SEMID_SHARED_SURF, num, 1)
#endif
#ifdef _MGHAVE_CURSOR #ifdef _MGHAVE_CURSOR
@@ -155,10 +157,6 @@ again:
# define UNLOCK_MOUSEMOVE_SEM() my_sem_op(SHAREDRES_SEMID, _IDX_SEM_MOUSEMOVE, 1) # define UNLOCK_MOUSEMOVE_SEM() my_sem_op(SHAREDRES_SEMID, _IDX_SEM_MOUSEMOVE, 1)
#endif /* _MGRM_PROCESSES */ #endif /* _MGRM_PROCESSES */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */
-3
View File
@@ -127,9 +127,6 @@ typedef LWEVENT* PLWEVENT;
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
extern DWORD __mg_timeout_usec;
extern DWORD __mg_repeat_usec;
// The entrance of low level event handling thread // The entrance of low level event handling thread
BOOL mg_InitLWEvent (void); BOOL mg_InitLWEvent (void);
void mg_TerminateLWEvent (void); void mg_TerminateLWEvent (void);
+44 -18
View File
@@ -84,18 +84,15 @@
#define WS_EX_MODALDISABLED 0x10000000L #define WS_EX_MODALDISABLED 0x10000000L
/* /*
* Internal extended style: * \def WS_EX_CTRLASMAINWIN
* The control can be displayed out of the main window * \brief The control can be displayed out of the main window
* which contains the control. * which contains the control.
*/ */
#define WS_EX_CTRLASMAINWIN 0x20000000L #define WS_EX_CTRLASMAINWIN 0x20000000L
/* Internal extended style: dialog box. */ /* Internal extended style. */
#define WS_EX_DIALOGBOX 0x40000000L #define WS_EX_DIALOGBOX 0x40000000L
/* Internal extended style: activated. */
#define WS_EX_ACTIVATED 0x80000000L
/* Make sure the internal window extended styles above are ok */ /* Make sure the internal window extended styles above are ok */
#define MGUI_COMPILE_TIME_ASSERT(name, x) \ #define MGUI_COMPILE_TIME_ASSERT(name, x) \
typedef int MGUI_dummy_ ## name[((x)?1:0) * 2 - 1] typedef int MGUI_dummy_ ## name[((x)?1:0) * 2 - 1]
@@ -104,10 +101,6 @@ MGUI_COMPILE_TIME_ASSERT(ws_ex_int_1,
WS_EX_INTERNAL_MASK & WS_EX_MODALDISABLED); WS_EX_INTERNAL_MASK & WS_EX_MODALDISABLED);
MGUI_COMPILE_TIME_ASSERT(ws_ex_int_2, MGUI_COMPILE_TIME_ASSERT(ws_ex_int_2,
WS_EX_INTERNAL_MASK & WS_EX_CTRLASMAINWIN); WS_EX_INTERNAL_MASK & WS_EX_CTRLASMAINWIN);
MGUI_COMPILE_TIME_ASSERT(ws_ex_int_3,
WS_EX_INTERNAL_MASK & WS_EX_DIALOGBOX);
MGUI_COMPILE_TIME_ASSERT(ws_ex_int_4,
WS_EX_INTERNAL_MASK & WS_EX_ACTIVATED);
#undef MGUI_COMPILE_TIME_ASSERT #undef MGUI_COMPILE_TIME_ASSERT
@@ -258,7 +251,7 @@ struct _MSGQUEUE
int loop_depth; // message loop depth, for dialog boxes int loop_depth; // message loop depth, for dialog boxes
int idle_counter; // the idle connter for MSG_IDLE int idle_counter; // the idle connter for MSG_IDLE
DWORD last_ticks; // the last tick count saved; since 5.0.14 DWORD last_ticks_desktop; // the last tick count for desktop timer
/* Since 5.0.0, MiniGUI provides support for timers per message thread */ /* Since 5.0.0, MiniGUI provides support for timers per message thread */
int nr_timers; // the number of active timers int nr_timers; // the number of active timers
@@ -779,8 +772,8 @@ static inline PMSGQUEUE getMsgQueue (HWND hWnd)
} }
MSGQUEUE* mg_AllocMsgQueueForThisThread (BOOL sign_in); MSGQUEUE* mg_AllocMsgQueueForThisThread (void);
void mg_FreeMsgQueueForThisThread (BOOL sign_off); void mg_FreeMsgQueueForThisThread (void);
/* Since 5.0.0 */ /* Since 5.0.0 */
int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd); int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd);
@@ -911,9 +904,40 @@ static inline MSGQUEUE* getMsgQueueIfMainWindowInThisThread (PMAINWIN pMainWin)
#endif /* defined _MGHAVE_VIRTUAL_WINDOW */ #endif /* defined _MGHAVE_VIRTUAL_WINDOW */
/* Since 5.0.14, remove arg use_sys_timer */ #if 0 /* deprecated code */
BOOL mg_InitTimer (void); /* since 5.0.0, we always use QS_DESKTIMER for desktop timer */
void mg_TerminateTimer (void); /* since 5.0.0, we no longer use the timer thread */
static inline void AlertDesktopTimerEvent (void)
{
if (__mg_dsk_msg_queue) {
__mg_dsk_msg_queue->expired_timer_mask = 1;
POST_MSGQ (__mg_dsk_msg_queue);
}
}
static inline void AlertDesktopTimerEvent (void)
{
__mg_dsk_msg_queue->dwState |= QS_DESKTIMER;
#ifdef _MGHAVE_VIRTUAL_WINDOW
if (getMsgQueueForThisThread() != __mg_dsk_msg_queue)
POST_MSGQ (__mg_dsk_msg_queue);
#endif /* defined _MGHAVE_VIRTUAL_WINDOW */
}
static inline void setMsgQueueTimerFlag (PMSGQUEUE pMsgQueue, int slot)
{
pMsgQueue->expired_timer_mask |= (0x01UL << slot);
POST_MSGQ (pMsgQueue);
}
static inline void removeMsgQueueTimerFlag (PMSGQUEUE pMsgQueue, int slot)
{
pMsgQueue->expired_timer_mask &= ~(0x01UL << slot);
}
#endif /* deprecated code */
BOOL mg_InitTimer (BOOL use_sys_timer);
void mg_TerminateTimer (BOOL use_sys_timer);
/*window element renderer manager interface*/ /*window element renderer manager interface*/
extern WINDOW_ELEMENT_RENDERER * __mg_def_renderer; extern WINDOW_ELEMENT_RENDERER * __mg_def_renderer;
@@ -927,7 +951,9 @@ BOOL gui_LoadIconRes(HDC hdc, const char* rdr_name, char* file);
void gui_WndRect(HWND hWnd, PRECT prc); void gui_WndRect(HWND hWnd, PRECT prc);
void gui_WndClientRect(HWND hWnd, PRECT prc); void gui_WndClientRect(HWND hWnd, PRECT prc);
HDC __mg_create_memdc_for_surface (struct GAL_Surface* surface); /* Undisclosed APIs */
HDC CreateMemDCFromSurface (struct GAL_Surface* surface);
struct GAL_Surface* GetSurfaceFromDC (HDC hdc);
/* Since 5.0.0 */ /* Since 5.0.0 */
#ifdef _MGRM_PROCESSES #ifdef _MGRM_PROCESSES
+111 -9
View File
@@ -54,12 +54,26 @@
# define MG_LOCAL /* NULL */ # define MG_LOCAL /* NULL */
#endif #endif
/*
* Common
*/
#if defined(_MG_ENABLE_SPLASH) || \
defined(_MG_ENABLE_SCREENSAVER) || \
defined(_MG_ENABLE_WATERMARK)
#define _MG_ENABLE_LICENSE 1
enum { enum {
SPLASH_MINIGUI, SPLASH_MINIGUI,
SPLASH_FMSOFT, SPLASH_FMSOFT,
SPLASH_FEIMAN, SPLASH_FEIMAN,
SPLASH_PROGRESSBAR, SPLASH_PROGRESSBAR,
SPLASH_PROGRESSBAR_BK, SPLASH_PROGRESSBAR_BK,
#if 0
WATERMARK_1,
WATERMARK_2,
WATERMARK_3,
#endif /* _MG_ENABLE_WATERMARK */
LICENSE_BITMAP_NR LICENSE_BITMAP_NR
}; };
@@ -71,14 +85,14 @@ extern MG_LOCAL BITMAP g_license_bitmaps[];
#define g_bitmap_progressbar g_license_bitmaps[SPLASH_PROGRESSBAR] #define g_bitmap_progressbar g_license_bitmaps[SPLASH_PROGRESSBAR]
#define g_bitmap_progressbar_bk g_license_bitmaps[SPLASH_PROGRESSBAR_BK] #define g_bitmap_progressbar_bk g_license_bitmaps[SPLASH_PROGRESSBAR_BK]
#if defined(_MG_ENABLE_SPLASH) || defined(_MG_ENABLE_SCREENSAVER)
# define _MG_ENABLE_LICENSE 1
MG_LOCAL void __mg_license_create(void); MG_LOCAL void __mg_license_create(void);
MG_LOCAL void __mg_license_destroy(void); MG_LOCAL void __mg_license_destroy(void);
#else #else
# define __mg_license_create() /* NULL */ # define __mg_license_create() /* NULL */
# define __mg_license_destroy() /* NULL */ # define __mg_license_destroy() /* NULL */
#endif #endif /* endif _MG_ENABLE_SPLASH or _MG_ENABLE_SCREENSAVER or _MG_ENABLE_WATERMARK*/
#ifdef _MG_ENABLE_SCREENSAVER #ifdef _MG_ENABLE_SCREENSAVER
MG_LOCAL void __mg_screensaver_create(void); MG_LOCAL void __mg_screensaver_create(void);
@@ -88,6 +102,9 @@ MG_LOCAL void __mg_screensaver_destroy(void);
# define __mg_screensaver_destroy() /* NULL */ # define __mg_screensaver_destroy() /* NULL */
#endif #endif
/*
* Splash
*/
#ifdef _MG_ENABLE_SPLASH #ifdef _MG_ENABLE_SPLASH
MG_LOCAL void __mg_splash_draw_framework(void); MG_LOCAL void __mg_splash_draw_framework(void);
MG_LOCAL void __mg_splash_progress(void); MG_LOCAL void __mg_splash_progress(void);
@@ -98,11 +115,96 @@ MG_LOCAL void __mg_splash_delay(void);
# define __mg_splash_delay() /* NULL */ # define __mg_splash_delay() /* NULL */
#endif /* endif _MG_ENABLE_SPLASH */ #endif /* endif _MG_ENABLE_SPLASH */
#define __mg_license_on_input() /* NULL */ /*
#define __mg_license_on_timeout() /* NULL */ * ScreenSaver & Watermark
#define LICENSE_CHECK_CUSTIMER_ID() /* NULL */ */
#define license_get_processor_id() /* NULL */ #if defined(_MG_ENABLE_SCREENSAVER) || defined(_MG_ENABLE_WATERMARK)
#define LICENSE_SET_MESSAGE_OFFSET() /* NULL */ MG_LOCAL void __mg_license_on_input(void);
#define LICENSE_MODIFY_MESSAGE(x) /* NULL */ MG_LOCAL void __mg_license_on_timeout(void);
#else
# define __mg_license_on_input() /* NULL */
# define __mg_license_on_timeout() /* NULL */
#endif /* _MG_ENABLE_SCREENSAVER || _MG_ENABLE_WATERMARK */
/*
* Product ID
*/
#ifdef _MG_PRODUCTID
typedef struct _product_id {
/* Fixed 8-byte code, help us to locate the struct in .so file */
unsigned char prefix[8];
/* the ID of the customer */
int customer_id;
/* svn version */
int version;
/* When does we compile the .so, in seconds */
int compile_date;
/* The size of the .so file */
int file_size;
/* The check sum of the .so file */
unsigned char checksum[16];
} product_id_t;
#define PRODUCT_ID_PREFIX 0xca, 0x3f, 0x2b, 0x43, 0x00, 0x33, 0xb0, 0xc3
MG_LOCAL int license_get_customer_id(void);
#endif /* _MG_PRODUCTID */
/*
* Tools to encrypt const variables
*/
MG_LOCAL unsigned int LICENSE_ENCRYPTED_CONST_INT(unsigned int);
MG_LOCAL char *LICENSE_ENCRYPTED_CONST_STRING(unsigned char *, int);
/*
* Processor ID
*/
#ifdef _MG_PRODUCTID
# define LICENSE_CHECK_CUSTIMER_ID() \
do { \
if (! license_get_customer_id()) { \
return ERR_INVALID_ARGS; \
} \
} while(0)
#else
# define LICENSE_CHECK_CUSTIMER_ID() /* NULL */
#endif
#ifdef __TARGET_UNKNOWN__
# define license_get_processor_id() /* NULL */
# define LICENSE_SET_MESSAGE_OFFSET() /* NULL */
# define LICENSE_MODIFY_MESSAGE(x) /* NULL */
#else /* not __TARGET_UNKNOWN__ */
extern MG_LOCAL unsigned int g_license_processor_id; /* window.c */
MG_LOCAL void license_get_processor_id (void);
#define LICENSE_PROCESSOR_ID_NONE (0xFC1D8B2A)
extern MG_LOCAL unsigned int g_license_message_offset; /* zorder.c */
#if defined (_WITH_TARGET_S3C6410)
# define REAL_PROCESSOR_ID LICENSE_ENCRYPTED_CONST_INT(0x1AE2FDFD /* 0x36410101 */)
#elif defined (_WITH_TARGET_S3C2440)
# define REAL_PROCESSOR_ID LICENSE_ENCRYPTED_CONST_INT(0x3AA4FDFD /* 0x32440101 */)
#elif defined (_WITH_TARGET_S3C2410)
# define REAL_PROCESSOR_ID LICENSE_ENCRYPTED_CONST_INT(0x3AE2FDFD /* 0x32410101 */)
#elif defined (_WITH_TARGET_HI3560A)
# define REAL_PROCESSOR_ID LICENSE_ENCRYPTED_CONST_INT(0xFC38C9AD /* 0x35600200 */)
#else
# define REAL_PROCESSOR_ID LICENSE_PROCESSOR_ID_NONE
#endif
#define LICENSE_SET_MESSAGE_OFFSET() do {g_license_message_offset=g_license_processor_id-(REAL_PROCESSOR_ID);}while (0)
#define LICENSE_MODIFY_MESSAGE(pMsg) \
do { \
pMsg->message += g_license_message_offset; \
pMsg->hwnd -= g_license_message_offset / 2; \
} while (0)
#endif /* __TARGET_UNKNOWN__ */
#endif /* LICENSE_H */ #endif /* LICENSE_H */
+2 -14
View File
@@ -83,11 +83,6 @@ static inline int comp_key_string (const void *key1, const void *key2)
return strcmp (key1, key2); return strcmp (key1, key2);
} }
static inline void free_val_alloc (void *val)
{
free (val);
}
typedef struct _map_t map_t; typedef struct _map_t map_t;
typedef struct _map_entry_t { typedef struct _map_entry_t {
struct rb_node node; struct rb_node node;
@@ -105,15 +100,8 @@ int __mg_map_get_size (map_t* map);
map_entry_t* __mg_map_find (map_t* map, const void* key); map_entry_t* __mg_map_find (map_t* map, const void* key);
map_entry_t* __mg_map_insert_ex2 (map_t* map, const void* key, int __mg_map_insert_ex (map_t* map, const void* key,
const void* val, free_val_fn free_val_alt); const void* val, free_val_fn free_val_alt);
static int __mg_map_insert_ex (map_t* map, const void* key,
const void* val, free_val_fn free_val_alt)
{
return __mg_map_insert_ex2(map, key, val, NULL) ? 0 : -1;
}
static inline int __mg_map_insert (map_t* map, const void* key, static inline int __mg_map_insert (map_t* map, const void* key,
const void* val) const void* val)
{ {
@@ -126,7 +114,7 @@ int __mg_map_find_replace_or_insert (map_t* map, const void* key,
int __mg_map_replace (map_t* map, const void* key, int __mg_map_replace (map_t* map, const void* key,
const void* val, free_val_fn free_val_alt); const void* val, free_val_fn free_val_alt);
int __mg_map_erase (map_t* map, const void* key); int __mg_map_erase (map_t* map, void* key);
int __mg_map_get_size (map_t* map); int __mg_map_get_size (map_t* map);
#if 0 /* deprecated code */ #if 0 /* deprecated code */
+1 -7
View File
@@ -79,11 +79,6 @@ struct timezone {
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
void __mg_lock_file_for_read(int fd);
void __mg_unlock_file_for_read(int fd);
void __mg_lock_file_for_write(int fd);
void __mg_unlock_file_for_write(int fd);
unsigned int __mg_os_get_random_seed (void); unsigned int __mg_os_get_random_seed (void);
void __mg_os_time_delay (int ms); void __mg_os_time_delay (int ms);
void __mg_os_start_time (void); void __mg_os_start_time (void);
@@ -120,11 +115,10 @@ void mg_TerminateMisc (void);
BOOL mg_InitSystemRes (void); BOOL mg_InitSystemRes (void);
void mg_TerminateSystemRes (void); void mg_TerminateSystemRes (void);
/* Deprecated since 5.2.0
#ifdef _MGSCHEMA_COMPOSITING #ifdef _MGSCHEMA_COMPOSITING
int __mg_alloc_sem_for_shared_surf (void); int __mg_alloc_sem_for_shared_surf (void);
int __mg_free_sem_for_shared_surf (int sem_num); int __mg_free_sem_for_shared_surf (int sem_num);
#endif _MGSCHEMA_COMPOSITING */ #endif /* _MGSCHEMA_COMPOSITING */
size_t __mg_lookfor_unused_slot (unsigned char* bitmap, size_t len_bmp, int set); size_t __mg_lookfor_unused_slot (unsigned char* bitmap, size_t len_bmp, int set);
+4 -4
View File
@@ -396,10 +396,10 @@ char * __mg_msgstr3 [] =
"MSG_SRVNOTIFY", // 0x0147 "MSG_SRVNOTIFY", // 0x0147
"MSG_UPDATECLIWIN", // 0x0148 "MSG_UPDATECLIWIN", // 0x0148
"MSG_LAYERCHANGED", // 0x0149 "MSG_LAYERCHANGED", // 0x0149
"MSG_WINCOMPOSITED", // 0x014A "MSG_MANAGE_MSGTHREAD", // 0x014A
"MSG_MANAGE_MSGTHREAD", // 0x014B "MSG_CALC_POSITION", // 0x014B
"MSG_CALC_POSITION", // 0x014C "", // 0x014C
"MSG_WAKEUP_CLIENT", // 0x014D "", // 0x014D
"", // 0x014E "", // 0x014E
"", // 0x014F "", // 0x014F
+36 -47
View File
@@ -55,9 +55,9 @@
#ifndef GUI_NEWGAL_H #ifndef GUI_NEWGAL_H
#define GUI_NEWGAL_H #define GUI_NEWGAL_H
#include "minigui.h"
#include "gdi.h" #include "gdi.h"
#include "constants.h" #include "constants.h"
#include "blockheap.h"
#if IS_COMPOSITING_SCHEMA #if IS_COMPOSITING_SCHEMA
#include <sys/types.h> #include <sys/types.h>
@@ -117,10 +117,8 @@ void GAL_FreeFormat(GAL_PixelFormat *format);
/* typedef for private surface blitting functions */ /* typedef for private surface blitting functions */
struct GAL_Surface; struct GAL_Surface;
typedef int (*GAL_blit)(struct GAL_Surface *src, GAL_Rect *srcrect,
typedef int (*GAL_blit)(GAL_VideoDevice *video, struct GAL_Surface *dst, GAL_Rect *dstrect);
struct GAL_Surface *src, GAL_Rect *srcrect,
struct GAL_Surface *dst, GAL_Rect *dstrect);
#if IS_COMPOSITING_SCHEMA #if IS_COMPOSITING_SCHEMA
typedef struct _DirtyInfo { typedef struct _DirtyInfo {
@@ -139,25 +137,20 @@ typedef struct _DirtyInfo {
* than the creator. * than the creator.
*/ */
typedef struct _SharedSurfaceHeader { typedef struct _SharedSurfaceHeader {
/* the name of the shared surface; since 5.2.0. */ /* The number of semphore for this surface.
char name[NAME_MAX + 1]; The SysV semaphore set id for synchronizing this shared surface:
SHAREDRES_SEMID_SHARED_SURF. */
int sem_num;
/* The client identifier of the creator. */ /* The pid of the creator */
int create_cli; pid_t creator;
/* The file descriptor in context of the creator. */
int fd;
/* Not zero for hardware surface. */ /* Not zero for hardware surface. */
int byhw; int byhw;
/* The dirty information */
/* Deprecated since 5.2.0. GAL_DirtyInfo dirty_info;
The number of semphore for this surface.
The SysV semaphore set id for synchronizing this shared surface:
SHAREDRES_SEMID_SHARED_SURF.
int sem_num; */
/* Deprecated since 5.2.0.
The file descriptor in context of the creator.
int fd; */
/* the size of the surface */ /* the size of the surface */
int width, height; int width, height;
/* the pitch of the surface */ /* the pitch of the surface */
@@ -171,9 +164,6 @@ typedef struct _SharedSurfaceHeader {
size_t map_size; size_t map_size;
/* the offset of pixels data */ /* the offset of pixels data */
off_t pixels_off; off_t pixels_off;
/* The dirty information */
GAL_DirtyInfo dirty_info;
} GAL_SharedSurfaceHeader; } GAL_SharedSurfaceHeader;
#endif /* IS_COMPOSITING_SCHEMA */ #endif /* IS_COMPOSITING_SCHEMA */
@@ -226,10 +216,7 @@ typedef struct GAL_Surface {
#ifdef _MGUSE_PIXMAN #ifdef _MGUSE_PIXMAN
pixman_image_t *pix_img; /* The pixman image object for this surface */ pixman_image_t *pix_img; /* The pixman image object for this surface */
pixman_image_t *msk_img; void *blit_ctxt; /* blitting context */
uint16_t pix_op;
uint16_t pix_filter;
uint32_t pix_alpha_bits;
#endif #endif
#if IS_COMPOSITING_SCHEMA #if IS_COMPOSITING_SCHEMA
@@ -238,8 +225,6 @@ typedef struct GAL_Surface {
GAL_SharedSurfaceHeader *shared_header; /* Private */ GAL_SharedSurfaceHeader *shared_header; /* Private */
/* The dirty info for non-shared surface. */ /* The dirty info for non-shared surface. */
GAL_DirtyInfo *dirty_info; /* Private */ GAL_DirtyInfo *dirty_info; /* Private */
/* The file descriptor if the surface is a shared surface. */
int fd; /* Private; since 5.2.0. */
#endif #endif
} GAL_Surface; } GAL_Surface;
@@ -262,8 +247,6 @@ typedef struct GAL_Surface {
#define GAL_PREALLOC 0x01000000 /* Surface uses preallocated memory */ #define GAL_PREALLOC 0x01000000 /* Surface uses preallocated memory */
#define GAL_FORMAT_CHECKED 0x02000000 /* Pixman format checked */ #define GAL_FORMAT_CHECKED 0x02000000 /* Pixman format checked */
#define GAL_SSURF_ATTACHED 0x04000000 /* The shared surface is attached to. */
#define GAL_SSURF_LOCKED 0x08000000 /* The shared surface is locked. */
/* Available for GAL_SetVideoMode() */ /* Available for GAL_SetVideoMode() */
#define GAL_ANYFORMAT 0x10000000 /* Allow any video depth/pixel-format */ #define GAL_ANYFORMAT 0x10000000 /* Allow any video depth/pixel-format */
@@ -583,11 +566,6 @@ GAL_Surface *GAL_CreateRGBSurface
GAL_Surface *GAL_CreateRGBSurfaceFrom (void *pixels, GAL_Surface *GAL_CreateRGBSurfaceFrom (void *pixels,
int width, int height, int depth, int pitch, int width, int height, int depth, int pitch,
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
/* Since 5.2.0 */
static GAL_Surface *GAL_RefSurface (GAL_Surface *surface) {
surface->refcount++;
return surface;
}
void GAL_FreeSurface (GAL_Surface *surface); void GAL_FreeSurface (GAL_Surface *surface);
typedef struct REQ_HWSURFACE { typedef struct REQ_HWSURFACE {
@@ -668,11 +646,11 @@ GAL_Surface *GAL_CreateSurfaceForZNodeAs (const GAL_Surface* ref_surf,
void GAL_FreeSharedSurfaceData (GAL_Surface *surface); void GAL_FreeSharedSurfaceData (GAL_Surface *surface);
/* Attach to a shared RGB surface. */ /* Attach to a shared RGB surface. */
GAL_Surface *GAL_AttachSharedRGBSurface (GAL_VideoDevice* video, GAL_Surface *GAL_AttachSharedRGBSurface (int fd, size_t map_size,
int fd, size_t map_size, Uint32 flags, BOOL with_wr); Uint32 flags, BOOL with_wr);
/* Detach from a shared RGB surface from the specific video device. */ /* Dettach from a shared RGB surface from the specific video device. */
void GAL_DetachSharedSurfaceData (GAL_Surface *surface); void GAL_DettachSharedSurfaceData (GAL_Surface *surface);
/* Create a cursor surface from the specific video device. */ /* Create a cursor surface from the specific video device. */
GAL_Surface* GAL_CreateCursorSurface (GAL_VideoDevice* video, GAL_Surface* GAL_CreateCursorSurface (GAL_VideoDevice* video,
@@ -689,6 +667,7 @@ void GAL_MoveCursor (GAL_Surface* surface, int x, int y);
#endif /* defined _MGSCHEMA_COMPOSITING */ #endif /* defined _MGSCHEMA_COMPOSITING */
#if 0
/* /*
* GAL_LockSurface() sets up a surface for directly accessing the pixels. * GAL_LockSurface() sets up a surface for directly accessing the pixels.
* Between calls to GAL_LockSurface()/GAL_UnlockSurface(), you can write * Between calls to GAL_LockSurface()/GAL_UnlockSurface(), you can write
@@ -698,7 +677,9 @@ void GAL_MoveCursor (GAL_Surface* surface, int x, int y);
* *
* Not all surfaces require locking. If GAL_MUSTLOCK(surface) evaluates * Not all surfaces require locking. If GAL_MUSTLOCK(surface) evaluates
* to 0, then you can read and write to the surface at any time, and the * to 0, then you can read and write to the surface at any time, and the
* pixel format of the surface will not change. * pixel format of the surface will not change. In particular, if the
* GAL_HWSURFACE flag is not given when calling GAL_SetVideoMode(), you
* will not need to lock the display surface before accessing it.
* *
* No operating system or library calls should be made between lock/unlock * No operating system or library calls should be made between lock/unlock
* pairs, as critical system locks may be held during this time. * pairs, as critical system locks may be held during this time.
@@ -707,6 +688,7 @@ void GAL_MoveCursor (GAL_Surface* surface, int x, int y);
*/ */
int GAL_LockSurface (GAL_Surface *surface); int GAL_LockSurface (GAL_Surface *surface);
void GAL_UnlockSurface (GAL_Surface *surface); void GAL_UnlockSurface (GAL_Surface *surface);
#endif
/* /*
* Set the color key (transparent pixel) in a blittable surface. * Set the color key (transparent pixel) in a blittable surface.
@@ -750,10 +732,10 @@ GAL_bool GAL_IntersectRect (const GAL_Rect *A, const GAL_Rect *B,
Bmin = B->x; Bmin = B->x;
Bmax = Bmin + B->w; Bmax = Bmin + B->w;
if (Bmin > Amin) if (Bmin > Amin)
Amin = Bmin; Amin = Bmin;
intersection->x = Amin; intersection->x = Amin;
if (Bmax < Amax) if (Bmax < Amax)
Amax = Bmax; Amax = Bmax;
intersection->w = Amax - Amin > 0 ? Amax - Amin : 0; intersection->w = Amax - Amin > 0 ? Amax - Amin : 0;
/* Vertical intersection */ /* Vertical intersection */
@@ -762,10 +744,10 @@ GAL_bool GAL_IntersectRect (const GAL_Rect *A, const GAL_Rect *B,
Bmin = B->y; Bmin = B->y;
Bmax = Bmin + B->h; Bmax = Bmin + B->h;
if (Bmin > Amin) if (Bmin > Amin)
Amin = Bmin; Amin = Bmin;
intersection->y = Amin; intersection->y = Amin;
if (Bmax < Amax) if (Bmax < Amax)
Amax = Bmax; Amax = Bmax;
intersection->h = Amax - Amin > 0 ? Amax - Amin : 0; intersection->h = Amax - Amin > 0 ? Amax - Amin : 0;
return (intersection->w && intersection->h); return (intersection->w && intersection->h);
@@ -836,6 +818,13 @@ static inline BOOL GAL_CheckPixmanFormats (GAL_Surface *src, GAL_Surface *dst)
return FALSE; return FALSE;
} }
typedef struct GAL_BlittingContext {
uint16_t op;
uint16_t filter;
uint32_t alpha_bits;
pixman_image_t *msk_img;
} GAL_BlittingContext;
int GAL_SetupBlitting (GAL_Surface *src, GAL_Surface *dst, DWORD ops); int GAL_SetupBlitting (GAL_Surface *src, GAL_Surface *dst, DWORD ops);
int GAL_CleanupBlitting (GAL_Surface *src, GAL_Surface *dst); int GAL_CleanupBlitting (GAL_Surface *src, GAL_Surface *dst);
@@ -1082,8 +1071,8 @@ GAL_Surface* __drm_create_surface_from_name (GHANDLE video,
uint32_t name, uint32_t drm_format, uint32_t pixels_off, uint32_t name, uint32_t drm_format, uint32_t pixels_off,
uint32_t width, uint32_t height, uint32_t pitch); uint32_t width, uint32_t height, uint32_t pitch);
GAL_Surface* __drm_create_surface_from_handle (GHANDLE video, uint32_t handle, GAL_Surface* __drm_create_surface_from_handle (GHANDLE video,
size_t size, uint32_t drm_format, uint32_t pixels_off, uint32_t handle, size_t size, uint32_t drm_format, uint32_t pixels_off,
uint32_t width, uint32_t height, uint32_t pitch); uint32_t width, uint32_t height, uint32_t pitch);
GAL_Surface* __drm_create_surface_from_prime_fd (GHANDLE video, GAL_Surface* __drm_create_surface_from_prime_fd (GHANDLE video,
-2
View File
@@ -73,8 +73,6 @@
#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED) #if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
/* union semun is defined by including <sys/sem.h> */ /* union semun is defined by including <sys/sem.h> */
#elif defined(__DARWIN__)
/* union semun is defined by including <sys/sem.h> */
#else #else
/* according to X/OPEN we have to define it ourselves */ /* according to X/OPEN we have to define it ourselves */
union semun { union semun {
-8
View File
@@ -138,14 +138,6 @@ int __mg_save_png (MG_RWops* fp, MYBITMAP* bmp, RGB* pal);
BOOL __mg_check_png (MG_RWops* fp); BOOL __mg_check_png (MG_RWops* fp);
#endif #endif
#ifdef _MGIMAGE_WEBP
void* __mg_init_webp (MG_RWops* fp, MYBITMAP *png, RGB *pal);
int __mg_load_webp (MG_RWops* fp, void* init_info, MYBITMAP *png, CB_ONE_SCANLINE cb, void* context);
void __mg_cleanup_webp (void* init_info);
int __mg_save_webp (MG_RWops* fp, MYBITMAP* bmp, RGB* pal);
BOOL __mg_check_webp (MG_RWops* fp);
#endif
int __mg_bmp_compute_pitch (int bpp, Uint32 width, Uint32 *pitch, BOOL does_round); int __mg_bmp_compute_pitch (int bpp, Uint32 width, Uint32 *pitch, BOOL does_round);
#define fp_getc(fp) MGUI_RWgetc(fp) #define fp_getc(fp) MGUI_RWgetc(fp)
-8
View File
@@ -132,13 +132,6 @@ void __mg_client_del (int cli);
void __mg_release_global_res (int cli); void __mg_release_global_res (int cli);
/* Since 5.2.0 */
int __mg_nssurf_map_new(void);
void __mg_nssurf_map_delete(void);
int __mg_nssurf_map_operate_srv(const OPERATENSSURFINFO* req_info,
int cli, int fd);
int __mg_get_shared_surface_srv(const char *itn_name, SHAREDSURFINFO *info);
void __mg_remove_client (int cli, int clifd); void __mg_remove_client (int cli, int clifd);
int __mg_handle_request (int clifd, int req_id, int cli); int __mg_handle_request (int clifd, int req_id, int cli);
@@ -157,7 +150,6 @@ int __mg_remove_all_znodes_of_client (int cli);
int __mg_handle_normal_mouse_move (const ZORDERINFO* zi, int x, int y); int __mg_handle_normal_mouse_move (const ZORDERINFO* zi, int x, int y);
int __mg_get_znode_at_point (const ZORDERINFO* zi, int x, int y, HWND* hwnd); int __mg_get_znode_at_point (const ZORDERINFO* zi, int x, int y, HWND* hwnd);
ZORDERNODE *__mg_find_znode_by_client_hwnd (int cli, HWND hwnd);
int __mg_do_reghook_operation (int cli, const REGHOOKINFO* info); int __mg_do_reghook_operation (int cli, const REGHOOKINFO* info);
int __mg_handle_mouse_hook (int message, WPARAM wParam, LPARAM lParam); int __mg_handle_mouse_hook (int message, WPARAM wParam, LPARAM lParam);
+2 -2
View File
@@ -112,7 +112,7 @@ typedef struct tagG_RES {
int nr_layers; int nr_layers;
int semid_layer; int semid_layer;
#if 0 && defined(_MGSCHEMA_COMPOSITING) // deprecated since 5.2.0 #ifdef _MGSCHEMA_COMPOSITING
int semid_shared_surf; /* the id of semaphore set for shared surfaces */ int semid_shared_surf; /* the id of semaphore set for shared surfaces */
#endif #endif
@@ -208,7 +208,7 @@ typedef G_RES* PG_RES;
#define SHAREDRES_NR_LAYSERS (((PG_RES)mgSharedRes)->nr_layers) #define SHAREDRES_NR_LAYSERS (((PG_RES)mgSharedRes)->nr_layers)
#define SHAREDRES_SEMID_LAYER (((PG_RES)mgSharedRes)->semid_layer) #define SHAREDRES_SEMID_LAYER (((PG_RES)mgSharedRes)->semid_layer)
#if 0 && defined(_MGSCHEMA_COMPOSITING) // Deprecated since 5.2.0 #ifdef _MGSCHEMA_COMPOSITING
# define SHAREDRES_SEMID_SHARED_SURF (((PG_RES)mgSharedRes)->semid_shared_surf) # define SHAREDRES_SEMID_SHARED_SURF (((PG_RES)mgSharedRes)->semid_shared_surf)
#endif #endif
+1 -1
View File
@@ -74,7 +74,7 @@ typedef struct _MSGQUEUE MSGQUEUE;
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
DWORD __mg_update_tick_count (MSGQUEUE* msg_queue); void __mg_update_tick_count (void* data);
int __mg_check_expired_timers (MSGQUEUE* msg_queue, DWORD inter); int __mg_check_expired_timers (MSGQUEUE* msg_queue, DWORD inter);
void __mg_remove_timers_by_msg_queue (MSGQUEUE* msg_queue); void __mg_remove_timers_by_msg_queue (MSGQUEUE* msg_queue);
void __mg_remove_timer (MSGQUEUE* msg_queue, int slot); void __mg_remove_timer (MSGQUEUE* msg_queue, int slot);
+2 -8
View File
@@ -141,17 +141,11 @@ typedef struct _ZORDERINFO {
/* The size of usage bitmap for mask rect. */ /* The size of usage bitmap for mask rect. */
int size_maskrect_usage_bmp; int size_maskrect_usage_bmp;
/* use read/write lock for Unix-like OS */
#ifndef __NOUNIX__
#define __ZI_USE_RWLOCK 1
#endif
#ifdef _MGRM_THREADS #ifdef _MGRM_THREADS
# ifdef __ZI_USE_RWLOCK # ifndef __NOUNIX__
pthread_rwlock_t rwlock; pthread_rwlock_t rwlock;
pthread_t rwlock_owner;
# else # else
pthread_mutex_t mutex; pthread_mutex_t rwlock;
# endif # endif
#elif defined(_MGRM_PROCESSES) #elif defined(_MGRM_PROCESSES)
int zi_semid; int zi_semid;
+5 -1
View File
@@ -1,15 +1,19 @@
# also for makefile.ng and makefile.msvc # also for makefile.ng and makefile.msvc
AM_CPPFLAGS = -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include AM_CPPFLAGS = -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include
AM_CFLAGS = -Wno-zero-length-bounds
noinst_LTLIBRARIES = libkernel.la noinst_LTLIBRARIES = libkernel.la
if MG_MINIMALGDI
libkernel_la_SOURCES = init-lite.c fixstr.c \
blockheap.c
else
libkernel_la_SOURCES = timer.c init.c init-lite.c \ libkernel_la_SOURCES = timer.c init.c init-lite.c \
desktop-ths.c desktop-sa.c desktop-procs.c \ desktop-ths.c desktop-sa.c desktop-procs.c \
cursor.c cursor-procs.c cursor-sa.c \ cursor.c cursor-procs.c cursor-sa.c \
sharedres.c message.c event.c listenfd.c \ sharedres.c message.c event.c listenfd.c \
blockheap.c fixstr.c slotset.c zorder.c sem-manager.c \ blockheap.c fixstr.c slotset.c zorder.c sem-manager.c \
compsor-manager.c compsor-fallback.c compsor-manager.c compsor-fallback.c
endif
EXTRA_DIST= desktop.c desktop-comm.c cursor-comm.c makefile.ng makefile.msvc EXTRA_DIST= desktop.c desktop-comm.c cursor-comm.c makefile.ng makefile.msvc
+7 -7
View File
@@ -59,13 +59,13 @@
#include "common.h" #include "common.h"
#include "minigui.h" #include "minigui.h"
#include "gdi.h" #include "gdi.h"
#include "window.h"
#include "constants.h" #include "constants.h"
#include "blockheap.h"
#include "misc.h" #include "misc.h"
BOOL InitBlockDataHeap (PBLOCKHEAP heap, size_t sz_block, size_t sz_heap) BOOL InitBlockDataHeap (PBLOCKHEAP heap, size_t sz_block, size_t sz_heap)
{ {
#ifdef _MGHAVE_VIRTUAL_WINDOW #ifdef _MGRM_THREADS
pthread_mutex_init (&heap->lock, NULL); pthread_mutex_init (&heap->lock, NULL);
#endif #endif
@@ -99,7 +99,7 @@ void* BlockDataAlloc (PBLOCKHEAP heap)
int free_slot; int free_slot;
unsigned char* block_data = NULL; unsigned char* block_data = NULL;
#ifdef _MGHAVE_VIRTUAL_WINDOW #ifdef _MGRM_THREADS
pthread_mutex_lock (&heap->lock); pthread_mutex_lock (&heap->lock);
#endif #endif
@@ -118,7 +118,7 @@ void* BlockDataAlloc (PBLOCKHEAP heap)
ret: ret:
#ifdef _MGHAVE_VIRTUAL_WINDOW #ifdef _MGRM_THREADS
pthread_mutex_unlock (&heap->lock); pthread_mutex_unlock (&heap->lock);
#endif #endif
return block_data; return block_data;
@@ -128,7 +128,7 @@ void BlockDataFree (PBLOCKHEAP heap, void* data)
{ {
unsigned char* block_data = data; unsigned char* block_data = data;
#ifdef _MGHAVE_VIRTUAL_WINDOW #ifdef _MGRM_THREADS
pthread_mutex_lock (&heap->lock); pthread_mutex_lock (&heap->lock);
#endif #endif
@@ -146,7 +146,7 @@ void BlockDataFree (PBLOCKHEAP heap, void* data)
heap, slot); heap, slot);
} }
#ifdef _MGHAVE_VIRTUAL_WINDOW #ifdef _MGRM_THREADS
pthread_mutex_unlock (&heap->lock); pthread_mutex_unlock (&heap->lock);
#endif #endif
} }
@@ -193,7 +193,7 @@ void DestroyBlockDataHeap (PBLOCKHEAP heap)
free (heap->usage_bmp); free (heap->usage_bmp);
heap->usage_bmp = NULL; heap->usage_bmp = NULL;
#ifdef _MGHAVE_VIRTUAL_WINDOW #ifdef _MGRM_THREADS
pthread_mutex_destroy (&heap->lock); pthread_mutex_destroy (&heap->lock);
#endif #endif
} }
+2 -20
View File
@@ -228,7 +228,6 @@ static void composite_wallpaper_rect (CompositorCtxt* ctxt,
} }
} }
else { else {
SelectClipRect (HDC_SCREEN_SYS, dirty_rc);
SetBrushColor (HDC_SCREEN_SYS, SetBrushColor (HDC_SCREEN_SYS,
GetWindowElementPixelEx (HWND_DESKTOP, HDC_SCREEN_SYS, GetWindowElementPixelEx (HWND_DESKTOP, HDC_SCREEN_SYS,
WE_BGC_DESKTOP)); WE_BGC_DESKTOP));
@@ -679,19 +678,6 @@ static BOOL merge_dirty_ppp (CompositorCtxt* ctxt, MG_Layer* layer, int zidx)
return rc; return rc;
} }
#if 0
static void dump_dirty_region(CompositorCtxt* ctxt, const char *prefix, int zidx)
{
CLIPRGN* rgn = &ctxt->dirty_rgn;
_WRN_PRINTF("%s (%d): dirty region on screen: (%d, %d) %d x %d; "
"highest dirty win: %d; lowest dirty win: %d\n",
prefix, zidx,
rgn->rcBound.left, rgn->rcBound.top,
RECTW (rgn->rcBound), RECTH (rgn->rcBound),
ctxt->highest_dirty_win, ctxt->lowest_dirty_win);
}
#endif
static BOOL merge_dirty_win (CompositorCtxt* ctxt, MG_Layer* layer, int zidx) static BOOL merge_dirty_win (CompositorCtxt* ctxt, MG_Layer* layer, int zidx)
{ {
BOOL rc = FALSE; BOOL rc = FALSE;
@@ -735,13 +721,9 @@ static BOOL merge_dirty_wpp (CompositorCtxt* ctxt, MG_Layer* layer)
static BOOL refresh_dirty_region (CompositorCtxt* ctxt, MG_Layer* layer) static BOOL refresh_dirty_region (CompositorCtxt* ctxt, MG_Layer* layer)
{ {
/* the fallback compositor only manages znodes on the topmost layer. */ /* the fallback compositor only manages znodes on the topmost layer. */
if (layer != mgTopmostLayer) if (layer != mgTopmostLayer || IsEmptyClipRgn (&ctxt->dirty_rgn))
return FALSE; return FALSE;
if (IsEmptyClipRgn (&ctxt->dirty_rgn)) {
return FALSE;
}
if (ctxt->highest_dirty_ppp >= 0) { if (ctxt->highest_dirty_ppp >= 0) {
composite_ppp_znodes (ctxt); composite_ppp_znodes (ctxt);
} }
@@ -1321,7 +1303,7 @@ static void transit_to_layer (CompositorCtxt* ctxt, MG_Layer* to_layer)
} }
} }
_DBG_PRINTF ("Average time to composite the layers: %ums (times: %u)\n", total_time_ms / total_times, total_times); _WRN_PRINTF ("Average time to composite the layers: %u (times: %u)\n", total_time_ms / total_times, total_times);
} }
CompositorOps __mg_fallback_compositor = { CompositorOps __mg_fallback_compositor = {
+18 -34
View File
@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems * and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices. * and smart IoT devices.
* *
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 2002~2021, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming * Copyright (C) 1998~2002, WEI Yongming
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@@ -56,6 +56,7 @@
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#define _DEBUG
#include "common.h" #include "common.h"
#if defined(_MGRM_PROCESSES) && defined(_MGSCHEMA_COMPOSITING) #if defined(_MGRM_PROCESSES) && defined(_MGSCHEMA_COMPOSITING)
@@ -68,7 +69,6 @@
#include "constants.h" #include "constants.h"
#include "zorder.h" #include "zorder.h"
#include "dc.h" #include "dc.h"
#include "server.h"
#define MAX_NR_COMPOSITORS 8 #define MAX_NR_COMPOSITORS 8
#define LEN_COMPOSITOR_NAME 15 #define LEN_COMPOSITOR_NAME 15
@@ -133,51 +133,31 @@ static void lock_znode_surface (PDC pdc, ZORDERNODE* node)
{ {
if (node->lock_count == 0) { if (node->lock_count == 0) {
if (pdc->surface->shared_header) { if (pdc->surface->shared_header) {
__mg_lock_file_for_read(pdc->surface->fd); LOCK_SURFACE_SEM (pdc->surface->shared_header->sem_num);
} }
node->dirty_age = pdc->surface->dirty_info->dirty_age; node->dirty_age = pdc->surface->dirty_info->dirty_age;
node->nr_dirty_rcs = pdc->surface->dirty_info->nr_dirty_rcs; node->nr_dirty_rcs = pdc->surface->dirty_info->nr_dirty_rcs;
node->dirty_rcs = pdc->surface->dirty_info->dirty_rcs; node->dirty_rcs = pdc->surface->dirty_info->dirty_rcs;
} }
node->lock_count++; node->lock_count++;
} }
static BOOL unlock_znode_surface (PDC pdc, ZORDERNODE* node) static void unlock_znode_surface (PDC pdc, ZORDERNODE* node)
{ {
BOOL need_reset = FALSE;
if (node->lock_count > 0) { if (node->lock_count > 0) {
node->lock_count--; node->lock_count--;
if (node->lock_count == 0) { if (node->lock_count == 0) {
if (node->changes != pdc->surface->dirty_info->dirty_age) { if (pdc->surface->shared_header)
node->changes = pdc->surface->dirty_info->dirty_age; UNLOCK_SURFACE_SEM (pdc->surface->shared_header->sem_num);
need_reset = TRUE;
}
if (pdc->surface->shared_header) {
__mg_unlock_file_for_read(pdc->surface->fd);
}
node->dirty_age = 0; node->dirty_age = 0;
node->nr_dirty_rcs = 0; node->nr_dirty_rcs = 0;
node->dirty_rcs = NULL; node->dirty_rcs = NULL;
} }
} }
return need_reset;
}
static void reset_znode_surface_dirty (PDC pdc, ZORDERNODE* node, int slot)
{
if (node->cli == 0 || slot == 0) {
pdc->surface->dirty_info->nr_dirty_rcs = 0;
}
else if (node->hwnd) {
MSG msg = { HWND_NULL, MSG_WINCOMPOSITED,
slot, (LPARAM)node->hwnd, (DWORD)node->changes };
__mg_send2client(&msg, mgClients + node->cli);
}
} }
#if 0 /* not optimized */ #if 0 /* not optimized */
@@ -342,8 +322,10 @@ static void composite_layer (MG_Layer* layer, CompositorCtxt* ctxt,
nodes = GET_MENUNODE(zi); nodes = GET_MENUNODE(zi);
for (i = 0; i < zi->nr_popupmenus; i++) { for (i = 0; i < zi->nr_popupmenus; i++) {
pdc = dc_HDC2PDC (nodes[i].mem_dc); pdc = dc_HDC2PDC (nodes[i].mem_dc);
if (unlock_znode_surface (pdc, nodes + i))
reset_znode_surface_dirty (pdc, nodes + i, i); nodes[i].changes = pdc->surface->dirty_info->dirty_age;
pdc->surface->dirty_info->nr_dirty_rcs = 0;
unlock_znode_surface (pdc, nodes + i);
} }
} }
@@ -353,8 +335,9 @@ static void composite_layer (MG_Layer* layer, CompositorCtxt* ctxt,
while ((next = __kernel_get_next_znode (zi, next)) > 0) { while ((next = __kernel_get_next_znode (zi, next)) > 0) {
if (nodes [next].flags & ZOF_VISIBLE) { if (nodes [next].flags & ZOF_VISIBLE) {
pdc = dc_HDC2PDC (nodes[next].mem_dc); pdc = dc_HDC2PDC (nodes[next].mem_dc);
if (unlock_znode_surface (pdc, nodes + next)) nodes[next].changes = pdc->surface->dirty_info->dirty_age;
reset_znode_surface_dirty (pdc, nodes + next, next); pdc->surface->dirty_info->nr_dirty_rcs = 0;
unlock_znode_surface (pdc, nodes + next);
} }
} }
@@ -363,8 +346,9 @@ static void composite_layer (MG_Layer* layer, CompositorCtxt* ctxt,
if (layer == mgTopmostLayer) { if (layer == mgTopmostLayer) {
pdc = dc_HDC2PDC (HDC_SCREEN); pdc = dc_HDC2PDC (HDC_SCREEN);
if (pdc->surface->w > 0 && pdc->surface->h > 0) { if (pdc->surface->w > 0 && pdc->surface->h > 0) {
if (unlock_znode_surface (pdc, nodes)) nodes[0].changes = pdc->surface->dirty_info->dirty_age;
reset_znode_surface_dirty (pdc, nodes, 0); pdc->surface->dirty_info->nr_dirty_rcs = 0;
unlock_znode_surface (pdc, nodes);
} }
} }
} }
@@ -505,7 +489,7 @@ const CompositorOps* GUIAPI ServerGetCompositorOps (const char* name)
return NULL; return NULL;
for (i = 0; i < MAX_NR_COMPOSITORS; i++) { for (i = 0; i < MAX_NR_COMPOSITORS; i++) {
if (strcmp (compositors [i].name, name) == 0) { if (compositors [i].name && strcmp (compositors [i].name, name) == 0) {
return compositors [i].ops; return compositors [i].ops;
} }
} }
+14 -36
View File
@@ -1081,12 +1081,6 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
const RECT* prc; const RECT* prc;
prc = &cur_pdc->rc_output; prc = &cur_pdc->rc_output;
/* Since 5.0.13 */
if (!fShow) {
GAL_LockSurface(cur_pdc->surface);
}
if (cur_pdc->surface != __gal_screen) { if (cur_pdc->surface != __gal_screen) {
if (fShow) { if (fShow) {
GAL_UpdateRect (cur_pdc->surface, GAL_UpdateRect (cur_pdc->surface,
@@ -1096,7 +1090,7 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
} }
else { else {
if (!mgIsServer && (SHAREDRES_TOPMOST_LAYER != __mg_layer)) { if (!mgIsServer && (SHAREDRES_TOPMOST_LAYER != __mg_layer)) {
goto done; return;
} }
if (!fShow) { if (!fShow) {
@@ -1115,12 +1109,6 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
UNLOCK_CURSOR_SEM (); UNLOCK_CURSOR_SEM ();
} }
} }
done:
/* Since 5.0.13 */
if (fShow) {
GAL_UnlockSurface(cur_pdc->surface);
}
} }
#else /* defined _MGSCHEMA_SHAREDFB */ #else /* defined _MGSCHEMA_SHAREDFB */
@@ -1136,12 +1124,6 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
} }
prc = &cur_pdc->rc_output; prc = &cur_pdc->rc_output;
/* Since 5.0.13 */
if (!fShow) {
GAL_LockSurface(cur_pdc->surface);
}
if (cur_pdc->surface == __gal_screen) { if (cur_pdc->surface == __gal_screen) {
// Under compositing schema, we never call SyncUpdate in // Under compositing schema, we never call SyncUpdate in
// kernel_ShowCursorForGDI for __gal_screen. // kernel_ShowCursorForGDI for __gal_screen.
@@ -1168,11 +1150,6 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
// For surface other than screen, we call SyncUpdate. // For surface other than screen, we call SyncUpdate.
GAL_SyncUpdate (cur_pdc->surface); GAL_SyncUpdate (cur_pdc->surface);
} }
/* Since 5.0.13 */
if (fShow) {
GAL_UnlockSurface(cur_pdc->surface);
}
} }
#endif /* not defined _MGSCHEMA_SHAREDFB */ #endif /* not defined _MGSCHEMA_SHAREDFB */
@@ -1251,25 +1228,26 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
PDC cur_pdc = (PDC)pdc; PDC cur_pdc = (PDC)pdc;
const RECT* prc = NULL; const RECT* prc = NULL;
if (!mgIsServer && (SHAREDRES_TOPMOST_LAYER != __mg_layer)) {
return;
}
prc = &cur_pdc->rc_output; prc = &cur_pdc->rc_output;
/* Since 5.0.13 */ /* houhh20080827, if --disable-cursor, mginit can not update auto(qvfb). */
if (!fShow) { #if 0
GAL_LockSurface(cur_pdc->surface); if (cur_pdc->surface == __gal_screen
&& mgIsServer && (SHAREDRES_TOPMOST_LAYER != __mg_layer))
return;
if (fShow)
GAL_UpdateRect (cur_pdc->surface,
prc->left, prc->top, RECTWP(prc), RECTHP(prc));
#else
if (!mgIsServer && (SHAREDRES_TOPMOST_LAYER != __mg_layer)) {
return;
} }
if (fShow) if (fShow)
GAL_UpdateRect (cur_pdc->surface, GAL_UpdateRect (cur_pdc->surface,
prc->left, prc->top, RECTWP(prc), RECTHP(prc)); prc->left, prc->top, RECTWP(prc), RECTHP(prc));
#endif
/* Since 5.0.13 */
if (fShow) {
GAL_UnlockSurface(cur_pdc->surface);
}
} }
#endif /* _MGHAVE_CURSOR */ #endif /* _MGHAVE_CURSOR */
+2 -20
View File
@@ -448,11 +448,6 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
prc = &cur_pdc->rc_output; prc = &cur_pdc->rc_output;
/* Since 5.0.13 */
if (!fShow) {
GAL_LockSurface(cur_pdc->surface);
}
if (cur_pdc->surface != __gal_screen) { if (cur_pdc->surface != __gal_screen) {
if (fShow) { if (fShow) {
GAL_UpdateRect (cur_pdc->surface, GAL_UpdateRect (cur_pdc->surface,
@@ -477,7 +472,7 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
prc->left, prc->top, RECTWP(prc), RECTHP(prc)); prc->left, prc->top, RECTWP(prc), RECTHP(prc));
//GAL_SyncUpdate (cur_pdc->surface); //GAL_SyncUpdate (cur_pdc->surface);
} }
goto done; return;
} }
if (fShow && nShowCount >= 0 && pCurCsr) { if (fShow && nShowCount >= 0 && pCurCsr) {
@@ -493,12 +488,6 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
//GAL_SyncUpdate (cur_pdc->surface); //GAL_SyncUpdate (cur_pdc->surface);
} }
} }
done:
/* Since 5.0.13 */
if (fShow) {
GAL_UnlockSurface(cur_pdc->surface);
}
} }
int GUIAPI ShowCursor (BOOL fShow) int GUIAPI ShowCursor (BOOL fShow)
@@ -527,16 +516,9 @@ void kernel_ShowCursorForGDI(BOOL fShow, void* pdc)
prc = &cur_pdc->rc_output; prc = &cur_pdc->rc_output;
/* Since 5.0.13 */ if (fShow)
if (!fShow) {
GAL_LockSurface(cur_pdc->surface);
}
else {
GAL_UpdateRect (cur_pdc->surface, GAL_UpdateRect (cur_pdc->surface,
prc->left, prc->top, RECTWP(prc), RECTHP(prc)); prc->left, prc->top, RECTWP(prc), RECTHP(prc));
/* Since 5.0.13 */
GAL_UnlockSurface(cur_pdc->surface);
}
} }
#endif /* _MGHAVE_CURSOR */ #endif /* _MGHAVE_CURSOR */
+4 -22
View File
@@ -472,15 +472,11 @@ void kernel_ShowCursorForGDI (BOOL fShow, void *pdc)
prc = &cur_pdc->rc_output; prc = &cur_pdc->rc_output;
/* Since 5.0.13 */
if (!fShow) {
GAL_LockSurface(cur_pdc->surface);
}
if (cur_pdc->surface != __gal_screen) { if (cur_pdc->surface != __gal_screen) {
if (fShow) { if (fShow) {
GAL_UpdateRect(cur_pdc->surface, GAL_UpdateRect (cur_pdc->surface,
prc->left, prc->top, RECTWP(prc), RECTHP(prc)); prc->left, prc->top, RECTWP(prc), RECTHP(prc));
// GAL_SyncUpdate (cur_pdc->surface);
} }
} }
else { else {
@@ -504,7 +500,7 @@ void kernel_ShowCursorForGDI (BOOL fShow, void *pdc)
pthread_mutex_unlock(&__mg_mouselock); pthread_mutex_unlock(&__mg_mouselock);
// GAL_SyncUpdate (cur_pdc->surface); // GAL_SyncUpdate (cur_pdc->surface);
} }
goto done; return;
} }
if (fShow && nShowCount >= 0 && pCurCsr) { if (fShow && nShowCount >= 0 && pCurCsr) {
@@ -522,12 +518,6 @@ void kernel_ShowCursorForGDI (BOOL fShow, void *pdc)
// GAL_SyncUpdate (cur_pdc->surface); // GAL_SyncUpdate (cur_pdc->surface);
} }
} }
done:
/* Since 5.0.13 */
if (fShow) {
GAL_UnlockSurface(cur_pdc->surface);
}
} }
int GUIAPI ShowCursor(BOOL fShow) int GUIAPI ShowCursor(BOOL fShow)
@@ -568,17 +558,9 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
prc = &cur_pdc->rc_output; prc = &cur_pdc->rc_output;
/* Since 5.0.13 */ if (fShow)
if (!fShow) {
GAL_LockSurface(cur_pdc->surface);
}
else {
GAL_UpdateRect (cur_pdc->surface, GAL_UpdateRect (cur_pdc->surface,
prc->left, prc->top, RECTWP(prc), RECTHP(prc)); prc->left, prc->top, RECTWP(prc), RECTHP(prc));
/* Since 5.0.13 */
GAL_UnlockSurface(cur_pdc->surface);
}
} }
#endif /* _MGHAVE_CURSOR */ #endif /* _MGHAVE_CURSOR */
+9 -14
View File
@@ -232,7 +232,7 @@ static int dskAddNewMainWindow (PMAINWIN pWin)
if (pWin->secondaryDC == HDC_INVALID) { if (pWin->secondaryDC == HDC_INVALID) {
/* remove the flag of WS_EX_AUTOSECONDARYDC */ /* remove the flag of WS_EX_AUTOSECONDARYDC */
pWin->dwExStyle &= ~WS_EX_AUTOSECONDARYDC; pWin->dwExStyle = pWin->dwExStyle | WS_EX_AUTOSECONDARYDC;
pWin->secondaryDC = 0; pWin->secondaryDC = 0;
} }
@@ -1403,7 +1403,7 @@ static LRESULT WindowMessageHandler(UINT message, PMAINWIN pWin, LPARAM lParam)
else { else {
from = 0; from = 0;
} }
lock_zi_for_read (zi); lock_zi_for_read (zi);
from = __kernel_get_next_znode (zi, from); from = __kernel_get_next_znode (zi, from);
@@ -1429,8 +1429,6 @@ static LRESULT WindowMessageHandler(UINT message, PMAINWIN pWin, LPARAM lParam)
/* Since 5.0.0 */ /* Since 5.0.0 */
case MSG_SETAUTOREPEAT: case MSG_SETAUTOREPEAT:
sg_msgAutoRepeat = *(const MSG*)lParam; sg_msgAutoRepeat = *(const MSG*)lParam;
/* start auto-repeat after 300ms */
sg_msgAutoRepeat.time = __mg_tick_counter + (__mg_timeout_usec/10000);
break; break;
/* Since 5.0.0 */ /* Since 5.0.0 */
@@ -1745,6 +1743,11 @@ static int dskOnRemoveCtrlInstance (PCONTROL pParent, PCONTROL pCtrl)
FreeZOrderNode (0, pCtrl->idx_znode, NULL); FreeZOrderNode (0, pCtrl->idx_znode, NULL);
} }
if (fFound) {
pCtrl->pcci->nUseCount --;
return 0;
}
if ((HWND)pCtrl == __mg_captured_wnd) { if ((HWND)pCtrl == __mg_captured_wnd) {
/* force release the capture */ /* force release the capture */
__mg_captured_wnd = 0; __mg_captured_wnd = 0;
@@ -1759,11 +1762,6 @@ static int dskOnRemoveCtrlInstance (PCONTROL pParent, PCONTROL pCtrl)
sg_msgAutoRepeat.hwnd = 0; sg_msgAutoRepeat.hwnd = 0;
} }
if (fFound) {
pCtrl->pcci->nUseCount--;
return 0;
}
return -1; return -1;
} }
@@ -1823,7 +1821,7 @@ static void dskRefreshAllWindow (const RECT* invrc)
info.is_empty_invrc = TRUE; info.is_empty_invrc = TRUE;
#ifdef _MGHAVE_MENU #ifdef _MGHAVE_MENU
dskForceCloseMenu (); dskForceCloseMenu ();
#endif #endif
SendMessage (HWND_DESKTOP, MSG_ERASEDESKTOP, 0, SendMessage (HWND_DESKTOP, MSG_ERASEDESKTOP, 0,
@@ -1875,12 +1873,9 @@ static void dskOnTimeout (void)
static DWORD uCounter = 0; static DWORD uCounter = 0;
static DWORD blink_counter = 0; static DWORD blink_counter = 0;
if (sg_msgAutoRepeat.hwnd != 0 && if (sg_msgAutoRepeat.hwnd != 0) {
__mg_tick_counter >= sg_msgAutoRepeat.time) {
PostMessage (sg_msgAutoRepeat.hwnd, sg_msgAutoRepeat.message, PostMessage (sg_msgAutoRepeat.hwnd, sg_msgAutoRepeat.message,
sg_msgAutoRepeat.wParam, sg_msgAutoRepeat.lParam); sg_msgAutoRepeat.wParam, sg_msgAutoRepeat.lParam);
/* next auto-repeat msg after 50ms */
sg_msgAutoRepeat.time = __mg_tick_counter + (__mg_repeat_usec/10000);
} }
if (__mg_tick_counter < (blink_counter + 10)) if (__mg_tick_counter < (blink_counter + 10))
File diff suppressed because it is too large Load Diff
+9 -2
View File
@@ -74,7 +74,6 @@
#include "dc.h" #include "dc.h"
#include "misc.h" #include "misc.h"
#include "devfont.h" #include "devfont.h"
#include "event.h"
#ifndef WIN32 #ifndef WIN32
#include <sys/termios.h> #include <sys/termios.h>
@@ -103,6 +102,14 @@ BOOL mg_InitDesktop (void)
int ret; int ret;
RECT rcScr = GetScreenRect(); RECT rcScr = GetScreenRect();
#if 0 /* move to init-lite.c */
/* Since 5.0.0: allocate message queue for desktop thread */
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread ()) ) {
_WRN_PRINTF ("failed to allocate message queue\n");
return FALSE;
}
#endif /* moved code */
/* /*
* Init ZOrderInfo here. * Init ZOrderInfo here.
*/ */
@@ -146,7 +153,7 @@ BOOL mg_InitDesktop (void)
void mg_TerminateDesktop (void) void mg_TerminateDesktop (void)
{ {
if (__mg_dsk_msg_queue) { if (__mg_dsk_msg_queue) {
mg_FreeMsgQueueForThisThread (TRUE); mg_FreeMsgQueueForThisThread ();
__mg_dsk_msg_queue = NULL; __mg_dsk_msg_queue = NULL;
} }
+4 -34
View File
@@ -55,7 +55,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include <time.h>
#include "common.h" #include "common.h"
@@ -73,7 +72,6 @@
#include "dc.h" #include "dc.h"
#include "misc.h" #include "misc.h"
#include "devfont.h" #include "devfont.h"
#include "event.h"
/******************************* global data *********************************/ /******************************* global data *********************************/
/* pointer to desktop message queue */ /* pointer to desktop message queue */
@@ -142,47 +140,19 @@ BOOL mg_InitDesktop (void)
#include "debug.h" #include "debug.h"
/* According to a bug report, we use sem_timedwait() instead of
calling std_idle_handler for desktop thread.
Otherwise, the desktop might not handle the request from other GUI threads
as soon as possible. */
static BOOL idle_handler_for_desktop_thread (MSGQUEUE *msg_queue, BOOL wait)
{
int retv, n = 0;
__mg_update_tick_count (msg_queue);
if (wait) {
struct timespec ts;
if (clock_gettime (CLOCK_REALTIME, &ts) != -1) {
ts.tv_nsec += 10 * 1000 * 1000L; // 10ms
if (ts.tv_nsec >= 1000 * 1000 * 1000L) {
ts.tv_sec += 1;
ts.tv_nsec -= 1000 * 1000 * 1000L;
}
if (sem_timedwait (&msg_queue->wait, &ts) == 0)
return TRUE;
}
}
return n > 0;
}
void* __kernel_desktop_main (void* data) void* __kernel_desktop_main (void* data)
{ {
MSG Msg; MSG Msg;
/* init message queue of desktop thread */ /* init message queue of desktop thread */
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread (TRUE)) ) { if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread ()) ) {
_ERR_PRINTF ("failed to allocate message queue\n"); _ERR_PRINTF ("failed to allocate message queue\n");
sem_post ((sem_t*)data); sem_post ((sem_t*)data);
return NULL; return NULL;
} }
/* For bug reported in Issue #116, under threads mode, the idle handler /* for threads mode, the idle handler for desktop thread is NULL */
for the desktop thread should call __mg_update_tick_count () */ __mg_dsk_msg_queue->OnIdle = NULL;
__mg_dsk_msg_queue->OnIdle = idle_handler_for_desktop_thread;
/* init desktop window */ /* init desktop window */
init_desktop_win (); init_desktop_win ();
@@ -221,7 +191,7 @@ void* __kernel_desktop_main (void* data)
#endif #endif
} }
mg_FreeMsgQueueForThisThread (TRUE); mg_FreeMsgQueueForThisThread ();
__mg_dsk_msg_queue = NULL; __mg_dsk_msg_queue = NULL;
return NULL; return NULL;
} }
+32 -49
View File
@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems * and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices. * and smart IoT devices.
* *
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming * Copyright (C) 1998~2002, WEI Yongming
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@@ -597,63 +597,55 @@ static void reset_window (PMAINWIN pWin, RECT* rcWin)
#endif #endif
#ifdef _MGRM_THREADS #ifdef _MGRM_THREADS
# ifdef __ZI_USE_RWLOCK #ifndef __NOUNIX__
static inline void lock_zi_for_change (ZORDERINFO* zi) /*for unix system, using read/write lock*/
static inline void lock_zi_for_change (const ZORDERINFO* zi)
{ {
pthread_rwlock_wrlock(&zi->rwlock); pthread_rwlock_wrlock(&((ZORDERINFO*)zi)->rwlock);
zi->rwlock_owner = pthread_self();
} }
static inline void unlock_zi_for_change (ZORDERINFO* zi) static inline void unlock_zi_for_change (const ZORDERINFO* zi)
{ {
pthread_rwlock_unlock(&zi->rwlock); pthread_rwlock_unlock(&((ZORDERINFO*)zi)->rwlock);
zi->rwlock_owner = 0;
} }
static inline void lock_zi_for_read (ZORDERINFO* zi) static inline void lock_zi_for_read (const ZORDERINFO* zi)
{ {
if (zi->rwlock_owner == pthread_self()) { pthread_rwlock_rdlock(&((ZORDERINFO*)zi)->rwlock);
return;
}
pthread_rwlock_rdlock(&zi->rwlock);
} }
static inline void unlock_zi_for_read (ZORDERINFO* zi) static inline void unlock_zi_for_read (const ZORDERINFO* zi)
{ {
if (zi->rwlock_owner == pthread_self()) { pthread_rwlock_unlock(&((ZORDERINFO*)zi)->rwlock);
return;
}
pthread_rwlock_unlock(&zi->rwlock);
} }
# else /* __ZI_USE_RWLOCK */ #else /* __NOUNIX__ */
static inline void lock_zi_for_change (ZORDERINFO* zi) /*for non-unix system, using mutex*/
static inline void lock_zi_for_change (const ZORDERINFO* zi)
{ {
pthread_mutex_lock(&zi->mutex); pthread_mutex_lock(&((ZORDERINFO*)zi)->rwlock);
} }
static inline void unlock_zi_for_change (ZORDERINFO* zi) static inline void unlock_zi_for_change (const ZORDERINFO* zi)
{ {
pthread_mutex_unlock(&zi->mutex); pthread_mutex_unlock(&((ZORDERINFO*)zi)->rwlock);
} }
static inline void lock_zi_for_read (ZORDERINFO* zi) static inline void lock_zi_for_read (const ZORDERINFO* zi)
{ {
pthread_mutex_lock(&zi->mutex); pthread_mutex_lock(&((ZORDERINFO*)zi)->rwlock);
} }
static inline void unlock_zi_for_read (ZORDERINFO* zi) static inline void unlock_zi_for_read (const ZORDERINFO* zi)
{ {
pthread_mutex_unlock(&zi->mutex); pthread_mutex_unlock(&((ZORDERINFO*)zi)->rwlock);
} }
# endif /* notdef __ZI_USE_RWLOCK */ #endif /* __NOUNIX__ */
#elif defined(_MGRM_STANDALONE) #elif defined(_MGRM_STANDALONE)
static inline void lock_zi_for_change (ZORDERINFO* zi) { } static inline void lock_zi_for_change (const ZORDERINFO* zi) { }
static inline void unlock_zi_for_change (ZORDERINFO* zi) { } static inline void unlock_zi_for_change (const ZORDERINFO* zi) { }
static inline void lock_zi_for_read (ZORDERINFO* zi) { } static inline void lock_zi_for_read (const ZORDERINFO* zi) { }
static inline void unlock_zi_for_read (ZORDERINFO* zi) { } static inline void unlock_zi_for_read (const ZORDERINFO* zi) { }
#else /* for procs */ #else /* for procs */
/* NULL. see desktop-procs.c */ /* NULL. see desktop-procs.c */
#endif /* _MGRM_THREADS */ #endif /* _MGRM_THREADS */
@@ -1603,10 +1595,8 @@ static int srvStartTrackPopupMenu (int cli, const RECT* rc, HWND ptmi,
surf->refcount++; surf->refcount++;
} }
else if (fd >= 0) { else if (fd >= 0) {
surf = GAL_AttachSharedRGBSurface (NULL, fd, surf = GAL_AttachSharedRGBSurface (fd, surf_size, surf_flags, TRUE);
surf_size, surf_flags, TRUE); close (fd);
/* Since 5.2.0: keep fd available.
close (fd); */
} }
else { else {
_WRN_PRINTF("not server but fd for shared surface is invalid\n"); _WRN_PRINTF("not server but fd for shared surface is invalid\n");
@@ -1614,7 +1604,7 @@ static int srvStartTrackPopupMenu (int cli, const RECT* rc, HWND ptmi,
} }
if (surf) { if (surf) {
memdc = __mg_create_memdc_for_surface (surf); memdc = CreateMemDCFromSurface (surf);
if (memdc == HDC_INVALID) { if (memdc == HDC_INVALID) {
GAL_FreeSurface (surf); GAL_FreeSurface (surf);
_WRN_PRINTF("failed to create memory dc for znode\n"); _WRN_PRINTF("failed to create memory dc for znode\n");
@@ -1648,14 +1638,11 @@ static int srvStartTrackPopupMenu (int cli, const RECT* rc, HWND ptmi,
menu_nodes [zi->nr_popupmenus].flags = ZOF_TYPE_POPUPMENU; menu_nodes [zi->nr_popupmenus].flags = ZOF_TYPE_POPUPMENU;
menu_nodes [zi->nr_popupmenus].rc = *rc; menu_nodes [zi->nr_popupmenus].rc = *rc;
menu_nodes [zi->nr_popupmenus].hwnd = ptmi; menu_nodes [zi->nr_popupmenus].hwnd = ptmi;
menu_nodes [zi->nr_popupmenus].cli = 0;
#ifdef _MGSCHEMA_COMPOSITING #ifdef _MGSCHEMA_COMPOSITING
menu_nodes [zi->nr_popupmenus].changes = 0; menu_nodes [zi->nr_popupmenus].changes = 0;
menu_nodes [zi->nr_popupmenus].ct = CT_OPAQUE; menu_nodes [zi->nr_popupmenus].ct = CT_OPAQUE;
menu_nodes [zi->nr_popupmenus].ct_arg = 0; menu_nodes [zi->nr_popupmenus].ct_arg = 0;
menu_nodes [zi->nr_popupmenus].mem_dc = memdc; menu_nodes [zi->nr_popupmenus].mem_dc = memdc;
menu_nodes [zi->nr_popupmenus].dirty_age = 0;
menu_nodes [zi->nr_popupmenus].nr_dirty_rcs = 0;
menu_nodes [zi->nr_popupmenus].dirty_rcs = NULL; menu_nodes [zi->nr_popupmenus].dirty_rcs = NULL;
#endif #endif
menu_nodes [zi->nr_popupmenus].priv_data = NULL; menu_nodes [zi->nr_popupmenus].priv_data = NULL;
@@ -2361,8 +2348,6 @@ static int AllocZOrderNodeEx (ZORDERINFO* zi, int cli, HWND hwnd, HWND main_win,
nodes [free_slot].ct = validate_compositing_type (flags, ct); nodes [free_slot].ct = validate_compositing_type (flags, ct);
nodes [free_slot].ct_arg = ct_arg; nodes [free_slot].ct_arg = ct_arg;
nodes [free_slot].mem_dc = mem_dc; nodes [free_slot].mem_dc = mem_dc;
nodes [free_slot].dirty_age = 0;
nodes [free_slot].nr_dirty_rcs = 0;
nodes [free_slot].dirty_rcs = NULL; nodes [free_slot].dirty_rcs = NULL;
#else #else
nodes [free_slot].age = 1; nodes [free_slot].age = 1;
@@ -3656,9 +3641,6 @@ static int dskMoveWindow (int cli, int idx_znode, HDC memdc, const RECT* rcWin)
do_for_all_znodes (&rcOld, zi, _cb_update_znode, ZT_ALL); do_for_all_znodes (&rcOld, zi, _cb_update_znode, ZT_ALL);
/* unlock zi for change ... */
unlock_zi_for_change (zi);
if (nodes [0].flags & ZOF_IF_REFERENCE) { if (nodes [0].flags & ZOF_IF_REFERENCE) {
SendMessage (HWND_DESKTOP, SendMessage (HWND_DESKTOP,
MSG_ERASEDESKTOP, 0, (LPARAM)&rcOld); MSG_ERASEDESKTOP, 0, (LPARAM)&rcOld);
@@ -3698,6 +3680,9 @@ static int dskMoveWindow (int cli, int idx_znode, HDC memdc, const RECT* rcWin)
update_client_window_rgn (nodes [idx_znode].cli, update_client_window_rgn (nodes [idx_znode].cli,
nodes [idx_znode].hwnd); nodes [idx_znode].hwnd);
/* unlock zi for change ... */
unlock_zi_for_change (zi);
} }
else { else {
lock_zi_for_change (zi); lock_zi_for_change (zi);
@@ -4514,9 +4499,7 @@ int __mg_join_all_message_threads (void)
list_for_each (l, &msg_queue_list) { list_for_each (l, &msg_queue_list) {
MSGQUEUE *msg_queue = (MSGQUEUE*)l; MSGQUEUE *msg_queue = (MSGQUEUE*)l;
#ifndef NDEBUG
dump_message_queue (msg_queue, __func__); dump_message_queue (msg_queue, __func__);
#endif
pthread_cancel (msg_queue->th); pthread_cancel (msg_queue->th);
} }
+13 -14
View File
@@ -89,9 +89,8 @@
struct timeval __mg_event_timeout; struct timeval __mg_event_timeout;
DWORD __mg_timeout_usec; static DWORD timeoutusec;
DWORD __mg_repeat_usec; static DWORD repeatusec;
static DWORD dblclicktime; static DWORD dblclicktime;
#ifndef _MGRM_THREADS #ifndef _MGRM_THREADS
@@ -122,8 +121,8 @@ static void GetTimeout (void)
char szValue [11]; char szValue [11];
int mytimeoutusec, myrepeatusec; int mytimeoutusec, myrepeatusec;
__mg_timeout_usec = DEF_USEC_TIMEOUT; timeoutusec = DEF_USEC_TIMEOUT;
__mg_repeat_usec = DEF_REPEAT_TIME; repeatusec = DEF_REPEAT_TIME;
if (GetMgEtcValue (EVENTPARA, EVENTPARA_REPEATUSEC, szValue, 10) < 0) if (GetMgEtcValue (EVENTPARA, EVENTPARA_REPEATUSEC, szValue, 10) < 0)
return; return;
@@ -134,8 +133,8 @@ static void GetTimeout (void)
mytimeoutusec = atoi(szValue); mytimeoutusec = atoi(szValue);
if (myrepeatusec >= 0 && mytimeoutusec > 0) { if (myrepeatusec >= 0 && mytimeoutusec > 0) {
__mg_timeout_usec = mytimeoutusec; timeoutusec = mytimeoutusec;
__mg_repeat_usec = myrepeatusec; repeatusec = myrepeatusec;
} }
} }
@@ -209,7 +208,7 @@ static void ResetKeyEvent(void)
IAL_SetLeds (slock | (numlock << 1) | (capslock << 2)); IAL_SetLeds (slock | (numlock << 1) | (capslock << 2));
__mg_event_timeout.tv_sec = 0; __mg_event_timeout.tv_sec = 0;
__mg_event_timeout.tv_usec = __mg_timeout_usec; __mg_event_timeout.tv_usec = timeoutusec;
#ifndef _MGRM_THREADS #ifndef _MGRM_THREADS
#ifdef _MGRM_PROCESSES #ifdef _MGRM_PROCESSES
@@ -217,8 +216,8 @@ static void ResetKeyEvent(void)
SHAREDRES_SHIFTSTATUS = status; SHAREDRES_SHIFTSTATUS = status;
#endif #endif
timeout_threshold = __mg_timeout_usec / 10000; timeout_threshold = timeoutusec / 10000;
repeat_threshold = __mg_repeat_usec / 10000; repeat_threshold = repeatusec / 10000;
timeout_count = timeout_threshold; timeout_count = timeout_threshold;
#endif #endif
} }
@@ -632,7 +631,7 @@ BOOL kernel_GetLWEvent (int event, PLWEVENT lwe)
// set repeat time // set repeat time
__mg_event_timeout.tv_sec = 0; __mg_event_timeout.tv_sec = 0;
__mg_event_timeout.tv_usec = __mg_repeat_usec; __mg_event_timeout.tv_usec = repeatusec;
// repeat last event // repeat last event
if (old_lwe.type == LWETYPE_KEY if (old_lwe.type == LWETYPE_KEY
@@ -653,7 +652,7 @@ BOOL kernel_GetLWEvent (int event, PLWEVENT lwe)
old_lwe.data.me.event == ME_MIDDLEDOWN))) { old_lwe.data.me.event == ME_MIDDLEDOWN))) {
// reset delay time // reset delay time
__mg_event_timeout.tv_sec = 0; __mg_event_timeout.tv_sec = 0;
__mg_event_timeout.tv_usec = __mg_timeout_usec; __mg_event_timeout.tv_usec = timeoutusec;
} }
lwe->type = LWETYPE_TIMEOUT; lwe->type = LWETYPE_TIMEOUT;
@@ -881,7 +880,7 @@ BOOL kernel_GetLWEvent (int event, PLWEVENT lwe)
memcpy (oldkeystate, keystate, nr_keys); memcpy (oldkeystate, keystate, nr_keys);
memcpy (&old_lwe, lwe, sizeof (LWEVENT)); memcpy (&old_lwe, lwe, sizeof (LWEVENT));
__mg_event_timeout.tv_sec = 0; __mg_event_timeout.tv_sec = 0;
__mg_event_timeout.tv_usec = __mg_timeout_usec; __mg_event_timeout.tv_usec = timeoutusec;
return 1; return 1;
} }
@@ -900,7 +899,7 @@ mouseret:
me->status = status; me->status = status;
memcpy (&old_lwe, lwe, sizeof (LWEVENT)); memcpy (&old_lwe, lwe, sizeof (LWEVENT));
__mg_event_timeout.tv_sec = 0; __mg_event_timeout.tv_sec = 0;
__mg_event_timeout.tv_usec = __mg_timeout_usec; __mg_event_timeout.tv_usec = timeoutusec;
return 1; return 1;
} }
#endif #endif
+8 -8
View File
@@ -66,7 +66,7 @@ static struct FIXSTR {
BYTE bitmap[LEN_BITMAP]; BYTE bitmap[LEN_BITMAP];
int offset[NR_HEAP]; int offset[NR_HEAP];
char* heap[NR_HEAP + 1]; char* heap[NR_HEAP + 1];
#ifdef _MGHAVE_VIRTUAL_WINDOW #ifdef _MGRM_THREADS
pthread_mutex_t lock; pthread_mutex_t lock;
#endif #endif
} FixStrHeap; } FixStrHeap;
@@ -98,7 +98,7 @@ BOOL mg_InitFixStr (void)
offset += 1<<i; offset += 1<<i;
} }
#ifdef _MGHAVE_VIRTUAL_WINDOW #ifdef _MGRM_THREADS
pthread_mutex_init (&FixStrHeap.lock, NULL); pthread_mutex_init (&FixStrHeap.lock, NULL);
#endif #endif
return TRUE; return TRUE;
@@ -106,7 +106,7 @@ BOOL mg_InitFixStr (void)
void mg_TerminateFixStr (void) void mg_TerminateFixStr (void)
{ {
#ifdef _MGHAVE_VIRTUAL_WINDOW #ifdef _MGRM_THREADS
pthread_mutex_destroy (&FixStrHeap.lock); pthread_mutex_destroy (&FixStrHeap.lock);
#endif #endif
free (FixStrHeap.heap[0]); free (FixStrHeap.heap[0]);
@@ -154,7 +154,7 @@ char* GUIAPI FixStrAlloc (int len)
// .. // ..
// if i == 0; then bufflen = 512 // if i == 0; then bufflen = 512
#ifdef _MGHAVE_VIRTUAL_WINDOW #ifdef _MGRM_THREADS
pthread_mutex_lock (&FixStrHeap.lock); pthread_mutex_lock (&FixStrHeap.lock);
#endif #endif
@@ -166,7 +166,7 @@ char* GUIAPI FixStrAlloc (int len)
for(j = 0; j < 8; j++) { for(j = 0; j < 8; j++) {
if (*bitmap & (0x80 >> j)) { if (*bitmap & (0x80 >> j)) {
*bitmap &= (~(0x80 >> j)); *bitmap &= (~(0x80 >> j));
#ifdef _MGHAVE_VIRTUAL_WINDOW #ifdef _MGRM_THREADS
pthread_mutex_unlock (&FixStrHeap.lock); pthread_mutex_unlock (&FixStrHeap.lock);
#endif #endif
#if 0 #if 0
@@ -181,7 +181,7 @@ char* GUIAPI FixStrAlloc (int len)
bitmap++; bitmap++;
} }
#ifdef _MGHAVE_VIRTUAL_WINDOW #ifdef _MGRM_THREADS
pthread_mutex_unlock (&FixStrHeap.lock); pthread_mutex_unlock (&FixStrHeap.lock);
#endif #endif
return (char*)malloc (len + 1); return (char*)malloc (len + 1);
@@ -216,7 +216,7 @@ void GUIAPI FreeFixStr (char* str)
// if i == 0; then bufflen = 512 // if i == 0; then bufflen = 512
bufflen = 1 << (NR_HEAP + 1 - i); bufflen = 1 << (NR_HEAP + 1 - i);
#ifdef _MGHAVE_VIRTUAL_WINDOW #ifdef _MGRM_THREADS
pthread_mutex_lock (&FixStrHeap.lock); pthread_mutex_lock (&FixStrHeap.lock);
#endif #endif
heap = FixStrHeap.heap[i]; heap = FixStrHeap.heap[i];
@@ -236,7 +236,7 @@ void GUIAPI FreeFixStr (char* str)
bitmap = bitmap + (stroff>>3); bitmap = bitmap + (stroff>>3);
*bitmap |= (0x80 >> (stroff%8)); *bitmap |= (0x80 >> (stroff%8));
#ifdef _MGHAVE_VIRTUAL_WINDOW #ifdef _MGRM_THREADS
pthread_mutex_unlock (&FixStrHeap.lock); pthread_mutex_unlock (&FixStrHeap.lock);
#endif #endif
} }
+1 -1
View File
@@ -386,7 +386,7 @@ int InitGUI (int argc, const char* agr[])
/* Since 5.0.0 /* Since 5.0.0
allocate message queue for desktop thread before starting client. */ allocate message queue for desktop thread before starting client. */
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread (TRUE)) ) { if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread ()) ) {
err_message (step, "Failed to allocate message queue!"); err_message (step, "Failed to allocate message queue!");
return step; return step;
} }
+24 -11
View File
@@ -391,6 +391,14 @@ static BOOL InstallSEGVHandler (void)
#include <locale.h> #include <locale.h>
#endif #endif
static IDLEHANDLER std_idle_handler;
static BOOL idle_handler_for_main_thread (MSGQUEUE *msg_queue, BOOL wait)
{
__mg_update_tick_count (NULL);
return std_idle_handler (msg_queue, wait);
}
int GUIAPI InitGUI (int args, const char *agr[]) int GUIAPI InitGUI (int args, const char *agr[])
{ {
char engine [LEN_ENGINE_NAME + 1]; char engine [LEN_ENGINE_NAME + 1];
@@ -562,13 +570,6 @@ int GUIAPI InitGUI (int args, const char *agr[])
_is_minigui_running = 1; _is_minigui_running = 1;
/* init timer for tick counter */
step++;
if (!mg_InitTimer()) {
_ERR_PRINTF ("KERNEL>InitGUI: failed to start time counter\n");
goto failure;
}
step++; step++;
if (!SystemThreads()) { if (!SystemThreads()) {
_ERR_PRINTF ("KERNEL>InitGUI: failed to init system threads!\n"); _ERR_PRINTF ("KERNEL>InitGUI: failed to init system threads!\n");
@@ -577,11 +578,23 @@ int GUIAPI InitGUI (int args, const char *agr[])
/* init message queue of main GUI thread */ /* init message queue of main GUI thread */
step++; step++;
if (!(msg_queue = mg_AllocMsgQueueForThisThread (TRUE))) { if (!(msg_queue = mg_AllocMsgQueueForThisThread ())) {
_ERR_PRINTF ("KERNEL>InitGUI: failed to allocate message queue!\n"); _ERR_PRINTF ("KERNEL>InitGUI: failed to allocate message queue!\n");
goto failure; goto failure;
} }
/* for threads mode, the idle handler for the main threads should
call __mg_update_tick_count () */
std_idle_handler = msg_queue->OnIdle;
msg_queue->OnIdle = idle_handler_for_main_thread;
/* init timer for tick counter */
step++;
if (!mg_InitTimer (FALSE)) {
_ERR_PRINTF ("KERNEL>InitGUI: failed to start time counter\n");
goto failure;
}
SetKeyboardLayout ("default"); SetKeyboardLayout ("default");
SetCursor (GetSystemCursor (IDC_ARROW)); SetCursor (GetSystemCursor (IDC_ARROW));
@@ -602,9 +615,7 @@ failure1:
void GUIAPI TerminateGUI (int not_used) void GUIAPI TerminateGUI (int not_used)
{ {
mg_TerminateTimer (); mg_TerminateTimer (FALSE);
mg_FreeMsgQueueForThisThread (TRUE);
/* Since 5.0.0 */ /* Since 5.0.0 */
SendNotifyMessage (HWND_DESKTOP, MSG_ENDSESSION, 0, 0); SendNotifyMessage (HWND_DESKTOP, MSG_ENDSESSION, 0, 0);
@@ -644,6 +655,8 @@ void GUIAPI TerminateGUI (int not_used)
miFreeArcCache (); miFreeArcCache ();
#endif #endif
mg_FreeMsgQueueForThisThread ();
deleteThreadInfoKey (); deleteThreadInfoKey ();
mg_TerminateSliceAllocator(); mg_TerminateSliceAllocator();
+17 -27
View File
@@ -60,6 +60,7 @@
#include "gdi.h" #include "gdi.h"
#include "window.h" #include "window.h"
#include "blockheap.h"
#include "cliprect.h" #include "cliprect.h"
#include "gal.h" #include "gal.h"
#include "internals.h" #include "internals.h"
@@ -158,7 +159,7 @@ void mg_DestroyFreeQMSGList (void)
pthread_key_t __mg_threadinfo_key; pthread_key_t __mg_threadinfo_key;
#endif #endif
MSGQUEUE* mg_AllocMsgQueueForThisThread (BOOL sign_in) MSGQUEUE* mg_AllocMsgQueueForThisThread (void)
{ {
MSGQUEUE* pMsgQueue; MSGQUEUE* pMsgQueue;
@@ -176,14 +177,13 @@ MSGQUEUE* mg_AllocMsgQueueForThisThread (BOOL sign_in)
pthread_setspecific (__mg_threadinfo_key, pMsgQueue); pthread_setspecific (__mg_threadinfo_key, pMsgQueue);
#endif #endif
if (sign_in) { // register this new message queue
SendMessage (HWND_DESKTOP, MSG_MANAGE_MSGTHREAD, SendMessage (HWND_DESKTOP, MSG_MANAGE_MSGTHREAD,
MSGTHREAD_SIGNIN, (LPARAM)pMsgQueue); MSGTHREAD_SIGNIN, (LPARAM)pMsgQueue);
}
return pMsgQueue; return pMsgQueue;
} }
void mg_FreeMsgQueueForThisThread (BOOL sign_off) void mg_FreeMsgQueueForThisThread (void)
{ {
MSGQUEUE* pMsgQueue; MSGQUEUE* pMsgQueue;
@@ -194,11 +194,6 @@ void mg_FreeMsgQueueForThisThread (BOOL sign_off)
_WRN_PRINTF ("there are still some windows not destroyed\n"); _WRN_PRINTF ("there are still some windows not destroyed\n");
} }
if (sign_off) {
SendMessage (HWND_DESKTOP, MSG_MANAGE_MSGTHREAD,
MSGTHREAD_SIGNOUT, (LPARAM)pMsgQueue);
}
mg_DestroyMsgQueue (pMsgQueue); mg_DestroyMsgQueue (pMsgQueue);
free (pMsgQueue); free (pMsgQueue);
@@ -828,9 +823,8 @@ checkagain:
goto got_ret; goto got_ret;
} }
} }
else { else
pMsgQueue->dwState &= ~QS_POSTMSG; pMsgQueue->dwState &= ~QS_POSTMSG;
}
} }
/* /*
@@ -955,12 +949,6 @@ checkagain:
goto checkagain; goto checkagain;
} }
else {
/* no message, wait again. */
if (pMsgQueue->OnIdle && !pMsgQueue->OnIdle (pMsgQueue, FALSE)) {
handle_idle_message (pMsgQueue);
}
}
#else /* defined _MGHAVE_VIRTUAL_WINDOW */ #else /* defined _MGHAVE_VIRTUAL_WINDOW */
/* no message, idle */ /* no message, idle */
if (bWait) { if (bWait) {
@@ -970,11 +958,6 @@ checkagain:
} }
goto checkagain; goto checkagain;
} }
else {
if (!pMsgQueue->OnIdle (pMsgQueue, FALE)) {
handle_idle_message (pMsgQueue);
}
}
#endif /* not defined _MGHAVE_VIRTUAL_WINDOW */ #endif /* not defined _MGHAVE_VIRTUAL_WINDOW */
/* no message */ /* no message */
@@ -1427,9 +1410,6 @@ LRESULT GUIAPI DispatchMessage (PMSG pMsg)
to the controls of the main window will be thrown away as well. */ to the controls of the main window will be thrown away as well. */
int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd) int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd)
{ {
/* For a main window, we use pMainWin to check whether we
should throw away a message for controls of the main window.
Note that checkAndGetMainWindowIfControl returns NULL for non control. */
PMAINWIN pMainWin = (PMAINWIN)hWnd; PMAINWIN pMainWin = (PMAINWIN)hWnd;
PMSG pMsg; PMSG pMsg;
PQMSG pQMsg; PQMSG pQMsg;
@@ -1441,6 +1421,16 @@ int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd)
LOCK_MSGQ (pMsgQueue); LOCK_MSGQ (pMsgQueue);
/* for virtual window and main window, use pMainWin to check whether we
should throw away a message for controls of a main window.
checkAndGetMainWindowIfControl returns NULL for non control. */
if (pMainWin != HWND_NULL && pMainWin != HWND_INVALID &&
(pMainWin->WinType == TYPE_MAINWIN ||
pMainWin->WinType == TYPE_VIRTWIN))
pMainWin = (PMAINWIN)hWnd;
else
pMainWin = NULL;
if (pMsgQueue->pFirstNotifyMsg) { if (pMsgQueue->pFirstNotifyMsg) {
PQMSG pPrev = NULL, pNext; PQMSG pPrev = NULL, pNext;
pQMsg = pMsgQueue->pFirstNotifyMsg; pQMsg = pMsgQueue->pFirstNotifyMsg;
+305 -79
View File
File diff suppressed because it is too large Load Diff
+11 -20
View File
@@ -67,6 +67,9 @@
#ifdef _MG_ENABLE_LICENSE #ifdef _MG_ENABLE_LICENSE
# include "../sysres/license/c_files/03_progressbar.dat.c" # include "../sysres/license/c_files/03_progressbar.dat.c"
#endif #endif
#ifndef __TARGET_UNKNOWN__
unsigned int g_license_message_offset;
#endif
#ifdef _MGRM_PROCESSES #ifdef _MGRM_PROCESSES
# include "ourhdr.h" # include "ourhdr.h"
@@ -243,23 +246,11 @@ int __kernel_alloc_z_order_info (int nr_topmosts, int nr_normals, BOOL with_mask
#endif /* deprecated code */ #endif /* deprecated code */
#ifdef _MGRM_THREADS #ifdef _MGRM_THREADS
# ifdef __ZI_USE_RWLOCK #ifndef __NOUNIX__
pthread_rwlock_init(&__mg_zorder_info->rwlock, NULL); pthread_rwlock_init(&__mg_zorder_info->rwlock, NULL);
__mg_zorder_info->rwlock_owner = 0; #else
# else pthread_mutex_init(&__mg_zorder_info->rwlock, NULL);
do { #endif
int ret;
pthread_mutexattr_t my_attr;
ret = pthread_mutexattr_init(&my_attr);
assert(ret == 0);
ret = pthread_mutexattr_settype(&my_attr, PTHREAD_MUTEX_RECURSIVE);
assert(ret == 0);
pthread_mutex_init(&__mg_zorder_info->mutex, &my_attr);
ret = pthread_mutexattr_destroy(&my_attr);
assert(ret == 0);
(void)ret;
} while (0);
# endif
#endif #endif
return 0; return 0;
#endif #endif
@@ -273,11 +264,11 @@ void __kernel_free_z_order_info (ZORDERINFO* zi)
#else #else
#ifdef _MGRM_THREADS #ifdef _MGRM_THREADS
# ifdef __ZI_USE_RWLOCK #ifndef __NOUNIX__
pthread_rwlock_destroy(&zi->rwlock); pthread_rwlock_destroy(&zi->rwlock);
# else #else
pthread_mutex_destroy(&zi->mutex); pthread_mutex_destroy(&zi->rwlock);
# endif #endif
#endif #endif
free (zi); free (zi);
__mg_zorder_info = NULL; __mg_zorder_info = NULL;
+1 -1
View File
@@ -1472,7 +1472,7 @@ void mg_slice_debug_tree_statistics (void)
su / bf, en, ex); su / bf, en, ex);
} }
else else
_DBG_PRINTF("MGSlice: MemChecker: root=NULL\n"); _MG_PRINTF("MGSlice: MemChecker: root=NULL\n");
pthread_mutex_unlock (&smc_tree_mutex); pthread_mutex_unlock (&smc_tree_mutex);
+5 -1
View File
@@ -5,9 +5,13 @@ EXTRA_DIST= misc.c systext.c rwops.c endianrw.c nposix.c clipboard.c \
math.c about.c error.c sockio.c rc4.c rc4.h \ math.c about.c error.c sockio.c rc4.c rc4.h \
makefile.ng makefile.msvc makefile.ng makefile.msvc
if MG_MINIMALGDI
libmisc_la_SOURCES = misc.c math.c rwops.c nposix.c
else
libmisc_la_SOURCES = misc.c systext.c rwops.c endianrw.c nposix.c clipboard.c \ libmisc_la_SOURCES = misc.c systext.c rwops.c endianrw.c nposix.c clipboard.c \
math.c about.c license.c anon_file.c rbtree.c map.c \ math.c about.c license.c anon_file.c rbtree.c map.c \
error.c sockio.c lock_file.c error.c sockio.c
endif
SRC_FILES = $(libmisc_la_SOURCES) SRC_FILES = $(libmisc_la_SOURCES)
LIB_NAME=libmisc LIB_NAME=libmisc
+1 -1
View File
@@ -114,7 +114,7 @@ static LRESULT AboutWinProc (HWND hWnd, UINT message,
DrawText (hdc, DrawText (hdc,
"MiniGUI -- a mature cross-platform windowing system " "MiniGUI -- a mature cross-platform windowing system "
"and GUI support system for embedded or IoT devices.\n\n" "and GUI support system for embedded or IoT devices.\n\n"
"Copyright (C) 2002 ~ 2023 FMSoft Co., Ltd.", "Copyright (C) 2002 ~ 2020 FMSoft Co., Ltd.",
-1, &rcClient, DT_WORDBREAK | DT_CENTER); -1, &rcClient, DT_WORDBREAK | DT_CENTER);
EndPaint (hWnd, hdc); EndPaint (hWnd, hdc);
+339 -7
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -243,7 +243,7 @@ map_entry_t* __mg_map_find (map_t* map, const void* key)
return entry; return entry;
} }
int __mg_map_erase (map_t* map, const void* key) int __mg_map_erase (map_t* map, void* key)
{ {
int retval = -1; int retval = -1;
map_entry_t* entry = NULL; map_entry_t* entry = NULL;
@@ -299,7 +299,7 @@ ret:
return retval; return retval;
} }
map_entry_t* __mg_map_insert_ex2 (map_t* map, const void* key, int __mg_map_insert_ex (map_t* map, const void* key,
const void* val, free_val_fn free_val_alt) const void* val, free_val_fn free_val_alt)
{ {
map_entry_t **pentry; map_entry_t **pentry;
@@ -307,7 +307,7 @@ map_entry_t* __mg_map_insert_ex2 (map_t* map, const void* key,
map_entry_t *parent; map_entry_t *parent;
if (map == NULL) if (map == NULL)
return NULL; return -1;
WRLOCK_MAP (map); WRLOCK_MAP (map);
@@ -317,7 +317,7 @@ map_entry_t* __mg_map_insert_ex2 (map_t* map, const void* key,
while (*pentry) { while (*pentry) {
int ret; int ret;
if (map->comp_key) if (map->comp_key)
ret = map->comp_key (key, (*pentry)->key); ret = map->comp_key (key, (*pentry)->key);
else else
@@ -354,7 +354,7 @@ map_entry_t* __mg_map_insert_ex2 (map_t* map, const void* key,
} }
UNLOCK_MAP (map); UNLOCK_MAP (map);
return entry; return 0;
} }
int __mg_map_find_replace_or_insert (map_t* map, const void* key, int __mg_map_find_replace_or_insert (map_t* map, const void* key,

Some files were not shown because too many files have changed in this diff Show More