mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-28 16:17:09 +08:00
Compare commits
208
Commits
dblbuff4fbcon
..
drm
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef713488e3 | ||
|
|
60200cbbcd | ||
|
|
6dec838cd8 | ||
|
|
2ccb876134 | ||
|
|
d9da7747d0 | ||
|
|
e48af7072a | ||
|
|
210e996b56 | ||
|
|
0d0246adbe | ||
|
|
08d4ab78e5 | ||
|
|
0cda03a2eb | ||
|
|
4cf4d204e7 | ||
|
|
6aa294e75b | ||
|
|
7718be5200 | ||
|
|
78e6d6581e | ||
|
|
62b3dc11d0 | ||
|
|
67cddafa19 | ||
|
|
4ae46a4b94 | ||
|
|
2791dc99ef | ||
|
|
b7525f3001 | ||
|
|
4c55f2eac3 | ||
|
|
3ad600d1bf | ||
|
|
3c233a4164 | ||
|
|
3643606a7f | ||
|
|
3ef2340749 | ||
|
|
a583dc1cbb | ||
|
|
0abaeef4c7 | ||
|
|
c2779cbf09 | ||
|
|
e118805eef | ||
|
|
7513d461bf | ||
|
|
b131f00a79 | ||
|
|
649fbf571e | ||
|
|
e38fd05cb4 | ||
|
|
ce53f2c703 | ||
|
|
fbebc94718 | ||
|
|
b4ce6f9f10 | ||
|
|
c04dde31e5 | ||
|
|
5a2b425012 | ||
|
|
fa18025350 | ||
|
|
890ab1db44 | ||
|
|
3d963b3d25 | ||
|
|
29ac6a4277 | ||
|
|
96ecf5e9b7 | ||
|
|
50aafa3faa | ||
|
|
d06ce0683b | ||
|
|
5a9b08fe94 | ||
|
|
c7569e9d32 | ||
|
|
06fcf2eaa0 | ||
|
|
33e5d62da8 | ||
|
|
f0bae4444c | ||
|
|
0a5ace7f82 | ||
|
|
5b27cc70fc | ||
|
|
cf3340c01d | ||
|
|
950f73716a | ||
|
|
295c993d50 | ||
|
|
95ab7dad2a | ||
|
|
3d42f72e21 | ||
|
|
59d9d08158 | ||
|
|
3a9cbfdd9b | ||
|
|
bc7d5f6ce0 | ||
|
|
1131973f7a | ||
|
|
a46804080e | ||
|
|
81b25968ca | ||
|
|
f1463f41de | ||
|
|
0a10b81499 | ||
|
|
fd07118939 | ||
|
|
a0a757a621 | ||
|
|
7cd7f954c6 | ||
|
|
e673452b7d | ||
|
|
e24490e92f | ||
|
|
0c2345aed1 | ||
|
|
95b9def0d5 | ||
|
|
563fe9232c | ||
|
|
5ad525c1d8 | ||
|
|
fcde9eb405 | ||
|
|
39d03be6d7 | ||
|
|
43101379ed | ||
|
|
bce5b73e1c | ||
|
|
0b4a5a1c17 | ||
|
|
c609e2e5b1 | ||
|
|
f6bf02aa5c | ||
|
|
d52aa4c1a4 | ||
|
|
d6a961aa6c | ||
|
|
2665200eee | ||
|
|
469eb1c05a | ||
|
|
6a83f2efbf | ||
|
|
6422cb8568 | ||
|
|
6be4b719c8 | ||
|
|
0f566d0342 | ||
|
|
1de19f9bee | ||
|
|
5f8a88c0a2 | ||
|
|
1611a56754 | ||
|
|
73fcb8d2c3 | ||
|
|
bc0efac21f | ||
|
|
26341b162e | ||
|
|
c6957bec23 | ||
|
|
56ddd87189 | ||
|
|
5cdd258046 | ||
|
|
8b4ab267b6 | ||
|
|
613a19c236 | ||
|
|
e242cbe32f | ||
|
|
5f921a2908 | ||
|
|
39493ef4dc | ||
|
|
fef311f0b2 | ||
|
|
e98aeab8dc | ||
|
|
2ff96ba383 | ||
|
|
03d90aec9f | ||
|
|
57293a2896 | ||
|
|
cfd3311f86 | ||
|
|
51b09bc2ed | ||
|
|
ff54c6ffe5 | ||
|
|
4c836603c1 | ||
|
|
311d2262d6 | ||
|
|
209a0c6ab0 | ||
|
|
4c2b20c49f | ||
|
|
b7625c5726 | ||
|
|
872e299ad9 | ||
|
|
c60c19aad5 | ||
|
|
5d216dcc32 | ||
|
|
37c122a1de | ||
|
|
50ae4b9b44 | ||
|
|
695c55e464 | ||
|
|
a16903d570 | ||
|
|
3189931910 | ||
|
|
c3a8dc0798 | ||
|
|
848ed3fecc | ||
|
|
0d1f1f028a | ||
|
|
d4add19e6a | ||
|
|
bfaeae0023 | ||
|
|
70705c7db0 | ||
|
|
517d74a2d2 | ||
|
|
d68eee3c90 | ||
|
|
e575e7c69d | ||
|
|
d059fc8de2 | ||
|
|
5d9d787dac | ||
|
|
9696fbb3ba | ||
|
|
800329086e | ||
|
|
11be6af9d3 | ||
|
|
e0cc3b5580 | ||
|
|
e33d98a702 | ||
|
|
84f3cf048a | ||
|
|
ea579771a7 | ||
|
|
4db97ead1f | ||
|
|
2338501d21 | ||
|
|
81c061c3c8 | ||
|
|
356bf08c4b | ||
|
|
09a27e508f | ||
|
|
0b636032ee | ||
|
|
5f78f6bb37 | ||
|
|
272bc39c84 | ||
|
|
1e006c0589 | ||
|
|
7158eaee0f | ||
|
|
abfc47159e | ||
|
|
deade3d887 | ||
|
|
cf3e0b3d4d | ||
|
|
614deba4b7 | ||
|
|
53d40508a4 | ||
|
|
39f96f407f | ||
|
|
c8c6f470ce | ||
|
|
d78b493aad | ||
|
|
26f415f3db | ||
|
|
b66ef7a2f5 | ||
|
|
9b89614569 | ||
|
|
0d170a6f74 | ||
|
|
f0dd4a74d2 | ||
|
|
692a6b81e0 | ||
|
|
cf49cf2b64 | ||
|
|
b26accf037 | ||
|
|
5913d95ff2 | ||
|
|
e1b94799a2 | ||
|
|
385db01097 | ||
|
|
d787dea652 | ||
|
|
0adddb422b | ||
|
|
c444030334 | ||
|
|
a9da4ddfba | ||
|
|
57cc74410f | ||
|
|
3cc16ababb | ||
|
|
d4097b577b | ||
|
|
7ef6c14f3f | ||
|
|
cbb4e32992 | ||
|
|
6bc85062b9 | ||
|
|
b2dee57f4f | ||
|
|
a926754a6b | ||
|
|
7e470b0e78 | ||
|
|
9f81cac662 | ||
|
|
a14bdd894a | ||
|
|
7004e156b8 | ||
|
|
e293cf03ba | ||
|
|
07f226f024 | ||
|
|
4b2503e614 | ||
|
|
2df5352356 | ||
|
|
67ccb2aafd | ||
|
|
9a124dec50 | ||
|
|
d013822979 | ||
|
|
7f44e948d0 | ||
|
|
9a94fb9a7c | ||
|
|
dfc7e95fcd | ||
|
|
362b852ec2 | ||
|
|
9141e13640 | ||
|
|
4a22a38e63 | ||
|
|
c7ce12449b | ||
|
|
824557b4f1 | ||
|
|
022542ef1b | ||
|
|
3b12e71877 | ||
|
|
9593168196 | ||
|
|
b5c5c3f8ae | ||
|
|
492bd649ed | ||
|
|
bc1a880479 | ||
|
|
0748f26f42 |
@@ -10,6 +10,7 @@ Makefile
|
||||
Makefile.in
|
||||
.deps/
|
||||
.libs/
|
||||
m4/*.m4
|
||||
/acinclude.m4
|
||||
/aclocal.m4
|
||||
/autom4te.cache
|
||||
@@ -21,6 +22,7 @@ Makefile.in
|
||||
/depcomp
|
||||
/install-sh
|
||||
/libtool
|
||||
/ltmain.sh
|
||||
/*.pc
|
||||
/*config.h
|
||||
/*config.h.in
|
||||
@@ -29,3 +31,6 @@ Makefile.in
|
||||
/src/font/utils/ucd/
|
||||
/src/sysres/font_list
|
||||
/src/sysres/license/dat_files/
|
||||
/configure~
|
||||
.cache
|
||||
compile_commands.json
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
SUBDIRS = src 3rd-party include rtos etc m4 cmake build
|
||||
|
||||
EXTRA_DIST = minigui.pc.in \
|
||||
|
||||
+123
-1
@@ -1,5 +1,17 @@
|
||||
# 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)
|
||||
@@ -24,9 +36,119 @@
|
||||
+ [Changes leading to incompatibility](#changes-leading-to-incompatibility)
|
||||
+ [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,
|
||||
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
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
Version 5.0.9 (2022/01/14)
|
||||
Version 5.0.16 (2025/05/27)
|
||||
|
||||
This is a minor enhancement and bugfix release of MiniGUI 5.0.x, the stable version.
|
||||
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
cat m4/*.m4 > acinclude.m4
|
||||
libtoolize
|
||||
cat m4/*.m4 > aclocal.m4
|
||||
aclocal
|
||||
autoheader
|
||||
automake --add-missing --foreign --copy
|
||||
|
||||
+43
-36
File diff suppressed because it is too large
Load Diff
+53
-8
@@ -55,6 +55,36 @@ wallpaper_pattern_size=full
|
||||
# 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
|
||||
[drm]
|
||||
defaultmode=1024x768-32bpp
|
||||
@@ -78,9 +108,21 @@ dpi=96
|
||||
# Since 5.0.0.
|
||||
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 equivalent environment variable: MG_GAL_DRM_DRIVER
|
||||
exdriver=libhidrmdrivers-0.2.so.0
|
||||
exdriver=libdrmdrivers.so
|
||||
#}}
|
||||
|
||||
#{{ifdef _MGIAL_SINGLETOUCHKEY
|
||||
@@ -111,6 +153,16 @@ dpi=96
|
||||
# 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
|
||||
@@ -123,13 +175,6 @@ exec_file=/usr/local/bin/gvfb
|
||||
[rtos_xvfb]
|
||||
defaultmode=800x600-16bpp
|
||||
|
||||
#{{ifdef _MGGAL_SHADOW
|
||||
[shadow]
|
||||
real_engine=pc_xvfb
|
||||
defaultmode=800x600-16bpp
|
||||
rotate_screen=normal
|
||||
#}}
|
||||
|
||||
#{{ifdef _MGGAL_MLSHADOW
|
||||
[mlshadow]
|
||||
real_engine=qvfb
|
||||
|
||||
@@ -268,6 +268,8 @@ MGUI_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
|
||||
#define MG_UNLIKELY(expr) (expr)
|
||||
#endif
|
||||
|
||||
#define HAVE(FEATURE) (defined HAVE_##FEATURE && HAVE_##FEATURE)
|
||||
|
||||
/**
|
||||
* \defgroup endian_info Endianness information
|
||||
* @{
|
||||
@@ -311,6 +313,7 @@ MGUI_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
|
||||
defined(__amd64) || \
|
||||
(defined(__alpha__) || defined(__alpha)) || \
|
||||
defined(__arm__) || defined(__aarch64__) || \
|
||||
defined(__loongarch__) || \
|
||||
defined(__riscv) || \
|
||||
(defined(__CC_ARM) && !defined(__BIG_ENDIAN)) || \
|
||||
(defined(__mips__) && defined(__MIPSEL__)) || \
|
||||
@@ -2346,6 +2349,7 @@ int init_minigui_printf (int (*output_char) (int ch),
|
||||
#define _ERR_PRINTF(fmt, ...) \
|
||||
do { \
|
||||
TCS_RED (stderr); \
|
||||
fprintf (stderr, "%s: ", __FUNCTION__); \
|
||||
fprintf (stderr, fmt, ##__VA_ARGS__); \
|
||||
TCS_NONE (stderr); \
|
||||
} while (0)
|
||||
|
||||
+24
-25
@@ -131,7 +131,31 @@
|
||||
#define IAL_EVENT_GESTURE_PINCH_UPDATE 0x0084
|
||||
#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
|
||||
#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_OUT 1
|
||||
#define TABLET_TOOL_PROXIMITY_STATE_IN 2
|
||||
@@ -149,31 +173,6 @@
|
||||
|
||||
#define TABLET_PAD_STRIP_SOURCE_UNKNOWN 0
|
||||
#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
|
||||
|
||||
#define IAL_EVENT_TABLET_TOOL_AXIS 0x0090
|
||||
|
||||
+57
-77
File diff suppressed because it is too large
Load Diff
+487
-34
File diff suppressed because it is too large
Load Diff
+93
-8
@@ -456,6 +456,45 @@ 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,
|
||||
const char* client_name,
|
||||
@@ -490,9 +529,30 @@ MG_EXPORT void GUIAPI MiniGUIPanic (int exitcode);
|
||||
*
|
||||
* \sa GetLayerInfo, ServerStartup, ServerCreateLayer
|
||||
*/
|
||||
MG_EXPORT GHANDLE GUIAPI JoinLayer (const char* layer_name,
|
||||
static inline GHANDLE GUIAPI JoinLayer (const char* layer_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,
|
||||
@@ -2125,7 +2185,7 @@ MG_EXPORT int GUIAPI ServerSendReplyEx (int clifd,
|
||||
* \fn int GUIAPI ServerSendReply (int clifd, const void* reply, int len)
|
||||
* \brief Sends the reply to the client.
|
||||
*
|
||||
* This function sends a replay pointed to by \a reply which is
|
||||
* This function sends a reply pointed to by \a reply which is
|
||||
* \a len bytes long to the client.
|
||||
*
|
||||
* \note Only used by the server to send the reply to the client.
|
||||
@@ -2673,6 +2733,26 @@ MG_EXPORT void GUIAPI DesktopUpdateAllWindow (void);
|
||||
|
||||
#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,
|
||||
const char* client_name,
|
||||
@@ -2687,7 +2767,8 @@ MG_EXPORT void GUIAPI DesktopUpdateAllWindow (void);
|
||||
* \return Always returns DUMMY_LAYER_HANDLE to indicate success.
|
||||
*/
|
||||
static inline GHANDLE GUIAPI JoinLayer (const char* layer_name,
|
||||
const char* client_name, int max_nr_highers, int max_nr_normals)
|
||||
const char* client_name,
|
||||
int max_nr_highers, int max_nr_normals)
|
||||
{
|
||||
return DUMMY_LAYER_HANDLE;
|
||||
}
|
||||
@@ -4097,7 +4178,7 @@ static inline int GUIAPI ShowCursor (BOOL fShow) {
|
||||
#endif /* !_MGHAVE_CURSOR */
|
||||
|
||||
/**
|
||||
* \def SetCursor(hcsr)
|
||||
* \fn HCURSOR SetCursor(HCURSOR hcsr)
|
||||
* \brief Changes the current cursor.
|
||||
*
|
||||
* This function changes the current cursor to be \a hcsr.
|
||||
@@ -4110,10 +4191,12 @@ static inline int GUIAPI ShowCursor (BOOL fShow) {
|
||||
*
|
||||
* \sa SetCursorEx, SetDefaultCursor
|
||||
*/
|
||||
#define SetCursor(hcsr) SetCursorEx (hcsr, FALSE)
|
||||
static inline HCURSOR SetCursor(HCURSOR hcsr) {
|
||||
return SetCursorEx (hcsr, FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* \def SetDefaultCursor(hcsr)
|
||||
* \fn HCURSOR SetDefaultCursor(HCURSOR hcsr)
|
||||
* \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
|
||||
@@ -4127,7 +4210,9 @@ static inline int GUIAPI ShowCursor (BOOL fShow) {
|
||||
*
|
||||
* \sa SetCursorEx, SetCursor
|
||||
*/
|
||||
#define SetDefaultCursor(hcsr) SetCursorEx (hcsr, TRUE)
|
||||
static inline HCURSOR SetDefaultCursor(HCURSOR hcsr) {
|
||||
return SetCursorEx (hcsr, TRUE);
|
||||
}
|
||||
|
||||
/** @} end of cursor_fns */
|
||||
|
||||
|
||||
+35
-3
@@ -2905,6 +2905,9 @@ typedef struct _WINMASKINFO {
|
||||
*
|
||||
* This message is sent to the all main windows when the system
|
||||
* 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
|
||||
|
||||
@@ -2987,18 +2990,22 @@ typedef struct _WINMASKINFO {
|
||||
if the client moved to a new layer */
|
||||
#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 */
|
||||
|
||||
/* Since 5.0.0: for managing message thread */
|
||||
#define MSG_MANAGE_MSGTHREAD 0x014A
|
||||
#define MSG_MANAGE_MSGTHREAD 0x014B
|
||||
#define MSGTHREAD_SIGNIN 0x00
|
||||
#define MSGTHREAD_SIGNOUT 0x01
|
||||
|
||||
/* Since 5.0.0: for calculating the default position */
|
||||
#define MSG_CALC_POSITION 0x014B
|
||||
#define MSG_CALC_POSITION 0x014C
|
||||
|
||||
/* Since 5.0.6: for waking up the client */
|
||||
#define MSG_WAKEUP_CLIENT 0x014C
|
||||
#define MSG_WAKEUP_CLIENT 0x014D
|
||||
|
||||
/**
|
||||
* \def MSG_DOESNEEDIME
|
||||
@@ -7234,6 +7241,31 @@ MG_EXPORT BOOL GUIAPI SetMainWindowGestureFlags (HWND hWnd, DWORD dwFlags);
|
||||
|
||||
#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,
|
||||
int type, DWORD arg)
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# This file does not do anything, except making sure these files are included
|
||||
# when you run 'make dist'.
|
||||
|
||||
EXTRA_DIST = libtool.m4
|
||||
EXTRA_DIST =
|
||||
|
||||
Vendored
-3724
File diff suppressed because it is too large
Load Diff
+2
-1
@@ -2,11 +2,12 @@ prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
runmode=@MINIGUI_RUNMODE@
|
||||
libsuffix=@MGLIB_SUFFIX@
|
||||
|
||||
Name: MiniGUI
|
||||
Description: A mature cross-platform windowing and GUI system for embedded systems and IoT smart devices.
|
||||
Version: @MINIGUI_VERSION@
|
||||
Runmode: @MINIGUI_RUNMODE@
|
||||
Requires:
|
||||
Libs: -L${libdir} -lminigui_@MGLIB_SUFFIX@ @DEP_LIBS@
|
||||
Libs.private:
|
||||
|
||||
+8
-24
@@ -1,10 +1,10 @@
|
||||
COMMON_SUBDIRS = libc misc main kernel sysres ial control ex_ctrl font gui mybmp include textedit
|
||||
COMMON_SUBDIRS = libc misc main kernel sysres ial control ex_ctrl font gui mybmp include textedit newgal newgdi
|
||||
|
||||
COMMON_LADD = \
|
||||
libc/liblibc.la \
|
||||
misc/libmisc.la \
|
||||
control/libcontrol.la \
|
||||
ex_ctrl/libexctrl.la \
|
||||
ex_ctrl/libexctrl.la \
|
||||
font/libfont.la \
|
||||
font/in-core/libincore.la \
|
||||
ial/libial.la \
|
||||
@@ -13,31 +13,15 @@ COMMON_LADD = \
|
||||
mybmp/libmybmp.la \
|
||||
kernel/libkernel.la \
|
||||
sysres/libsysres.la \
|
||||
textedit/libtextedit.la
|
||||
textedit/libtextedit.la \
|
||||
newgal/libnewgal.la \
|
||||
newgdi/libnewgdi.la
|
||||
|
||||
if MGRM_STANDALONE
|
||||
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)
|
||||
DIST_SUBDIRS = $(COMMON_SUBDIRS) newgal newgdi server client standalone
|
||||
SUBDIRS = $(COMMON_SUBDIRS) @RUNMODE_SUBDIRS@
|
||||
|
||||
MGSOURCES = template.c template.h
|
||||
MGLIBADD = $(COMMON_LADD) \
|
||||
$(LITE_LADD) \
|
||||
$(NEWGAL_LADD)
|
||||
MGLIBADD = $(COMMON_LADD) @RUNMODE_LADD@
|
||||
MGLDFLAGS = -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
|
||||
|
||||
lib_LTLIBRARIES=libminigui_@MGLIB_SUFFIX@.la
|
||||
|
||||
+32
-3
@@ -184,6 +184,23 @@ static void process_socket_message (MSG *msg)
|
||||
LOSWORD(msg->wParam), HISWORD(msg->wParam),
|
||||
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 {
|
||||
if (msg->hwnd == HWND_NULL) {
|
||||
msg->hwnd = HWND_DESKTOP;
|
||||
@@ -518,8 +535,8 @@ BOOL client_IdleHandler4Client (PMSGQUEUE msg_queue, BOOL wait)
|
||||
return (n > 0);
|
||||
}
|
||||
|
||||
GHANDLE GUIAPI JoinLayer (const char* layer_name, const char* client_name,
|
||||
int max_nr_topmosts, int max_nr_normals)
|
||||
GHANDLE GUIAPI JoinLayerEx (const char* layer_name, const char* client_name,
|
||||
int max_nr_topmosts, int max_nr_normals, int *cli_id)
|
||||
{
|
||||
GHANDLE layer_handle = INV_LAYER_HANDLE;
|
||||
REQUEST req;
|
||||
@@ -529,8 +546,12 @@ GHANDLE GUIAPI JoinLayer (const char* layer_name, const char* client_name,
|
||||
if (mgIsServer)
|
||||
return layer_handle;
|
||||
|
||||
if (__mg_client_id != 0) /* Already joined, return the handle */
|
||||
if (__mg_client_id != 0) {
|
||||
/* Already joined, return the handle */
|
||||
if (cli_id)
|
||||
*cli_id = __mg_client_id;
|
||||
return GetLayerInfo (NAME_SELF_LAYER, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
if (layer_name) {
|
||||
strncpy (info.layer_name, layer_name, LEN_LAYER_NAME);
|
||||
@@ -593,10 +614,18 @@ GHANDLE GUIAPI JoinLayer (const char* layer_name, const char* client_name,
|
||||
|
||||
__mg_start_client_desktop ();
|
||||
|
||||
if (cli_id)
|
||||
*cli_id = __mg_client_id;
|
||||
|
||||
ret:
|
||||
return layer_handle;
|
||||
}
|
||||
|
||||
int GUIAPI GetClientId (void)
|
||||
{
|
||||
return __mg_client_id;
|
||||
}
|
||||
|
||||
GHANDLE GUIAPI GetLayerInfo (const char* layer_name,
|
||||
int* nr_clients, BOOL* is_topmost, int* cli_active)
|
||||
{
|
||||
|
||||
+56
-46
File diff suppressed because it is too large
Load Diff
+12
-14
@@ -299,7 +299,15 @@ static void change_status_from_pose (PCONTROL pctrl, int new_pose,
|
||||
}
|
||||
}
|
||||
|
||||
/*complete a click if the click if valid
|
||||
/* 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);
|
||||
|
||||
/* complete a click if the click if valid
|
||||
* (mouse lbutton up in button )*/
|
||||
if (old_pose == BST_PUSHED && new_pose != BST_DISABLE
|
||||
&& change_valid)
|
||||
@@ -312,14 +320,6 @@ static void change_status_from_pose (PCONTROL pctrl, int new_pose,
|
||||
|
||||
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:
|
||||
@@ -423,8 +423,8 @@ static void draw_bitmap_button (PCONTROL pctrl, HDC hdc, DWORD dwStyle,
|
||||
|
||||
GetClientRect ((HWND)pctrl, &prcClient);
|
||||
if (dwStyle & BS_REALSIZEIMAGE) {
|
||||
x += (w - bmp->bmWidth) >> 1;
|
||||
y += (h - bmp->bmHeight) >> 1;
|
||||
x += (int)(w - bmp->bmWidth) >> 1;
|
||||
y += (int)(h - bmp->bmHeight) >> 1;
|
||||
w = h = 0;
|
||||
|
||||
if (bmp->bmWidth > RECTW(prcClient)){
|
||||
@@ -847,8 +847,6 @@ static LRESULT ButtonCtrlProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
case BM_SETSTYLE:
|
||||
pctrl->dwStyle &= 0xFFFF0000;
|
||||
pctrl->dwStyle |= (DWORD)(wParam & 0x0000FFFF);
|
||||
@@ -1054,7 +1052,7 @@ static LRESULT ButtonCtrlProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
return DefaultControlProc (hWnd, uMsg, wParam, lParam);
|
||||
|
||||
+8
-11
@@ -1678,7 +1678,7 @@ esright_input_char_refresh (HWND hWnd,
|
||||
scroll_rc.right = cur_caret_x;
|
||||
|
||||
ScrollWindow(hWnd, -scroll_len, 0, &scroll_rc, NULL);
|
||||
UpdateWindow(hWnd, FALSE);
|
||||
UpdateInvalidClient(hWnd, TRUE);
|
||||
edtSetCaretPos (hWnd, sled);
|
||||
|
||||
sled->changed = TRUE;
|
||||
@@ -2143,9 +2143,6 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
else {
|
||||
chars = 1;
|
||||
|
||||
if (charBuffer [0] == 127) // BS
|
||||
charBuffer [0] = '\b';
|
||||
|
||||
if (dwStyle & ES_UPPERCASE) {
|
||||
charBuffer [0] = toupper (charBuffer[0]);
|
||||
}
|
||||
@@ -2154,12 +2151,8 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
}
|
||||
}
|
||||
|
||||
if (chars == 1) {
|
||||
if (charBuffer [0] < 0x20 && charBuffer[0] != '\b') //FIXME
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (charBuffer[0] == '\b') { //backspace
|
||||
if (chars == 1 && (charBuffer[0] == '\b' || charBuffer[0] == 0x7F)) {
|
||||
// ASCII BS or DEL
|
||||
int del;
|
||||
|
||||
if (sled->editPos == 0 && sled->selStart == sled->selEnd)
|
||||
@@ -2184,7 +2177,11 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
sleInsertText (hWnd, sled, NULL, del);
|
||||
}
|
||||
}
|
||||
else{
|
||||
else if (chars == 1 && charBuffer [0] < 0x20) {
|
||||
// ignore all other ASCII control characters.
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
if (dwStyle & ES_LEFT) {
|
||||
esleft_input_char_refresh(hWnd, sled, (char*)charBuffer, chars);
|
||||
set_edit_caret_pos(hWnd, sled);
|
||||
|
||||
@@ -404,7 +404,7 @@ void mglist_set_itemops (MgList *mglst, PMGITEMOPS iop)
|
||||
mglst->iop = *iop;
|
||||
}
|
||||
|
||||
int DefaultItemViewProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam,
|
||||
LRESULT DefaultItemViewProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam,
|
||||
PSCRDATA pscrdata, MgList *mglst)
|
||||
{
|
||||
switch (message) {
|
||||
|
||||
@@ -140,7 +140,7 @@ struct _MgList
|
||||
|
||||
/* ------------------------- external api -------------------------- */
|
||||
|
||||
MG_EXPORT int DefaultItemViewProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam,
|
||||
MG_EXPORT LRESULT DefaultItemViewProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam,
|
||||
PSCRDATA pscrdata, MgList *mglst);
|
||||
|
||||
MG_EXPORT SVITEM_DRAWFUNC mglist_set_itemdraw (MgList *mglst, SVITEM_DRAWFUNC draw_func);
|
||||
|
||||
@@ -172,6 +172,10 @@ BOOL scrolled_set_cont_pos (HWND hWnd, PSCRDATA pscrdata, int cont_x, int cont_y
|
||||
SetScrollPos (hWnd, SB_VERT, cont_y);
|
||||
bChange = TRUE;
|
||||
}
|
||||
|
||||
if (bChange)
|
||||
UpdateInvalidClient(hWnd, FALSE);
|
||||
|
||||
return bChange;
|
||||
}
|
||||
|
||||
@@ -585,7 +589,7 @@ int scrolled_init (HWND hWnd, PSCRDATA pscrdata, int w, int h)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int DefaultScrolledProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
|
||||
LRESULT DefaultScrolledProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
PSCRDATA pscrdata = NULL;
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ typedef struct _scrdata
|
||||
typedef SCRDATA *PSCRDATA;
|
||||
|
||||
|
||||
MG_EXPORT int DefaultScrolledProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam);
|
||||
MG_EXPORT LRESULT DefaultScrolledProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam);
|
||||
MG_EXPORT int scrolled_init (HWND hWnd, PSCRDATA pscrdata, int w, int h);
|
||||
MG_EXPORT void scrolled_destroy (PSCRDATA pscrdata);
|
||||
MG_EXPORT void scrolled_hscroll (HWND hWnd, PSCRDATA pscrdata, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@@ -493,10 +493,15 @@ LRESULT ScrollViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
|
||||
break;
|
||||
}
|
||||
|
||||
case MSG_DESTROY:
|
||||
scrollview_destroy (psvdata);
|
||||
free (psvdata);
|
||||
case MSG_DESTROY: {
|
||||
/* suppress a warning about calling free() before using the pointer */
|
||||
PSVDATA svdata = (PSVDATA) GetWindowAdditionalData2 (hWnd);
|
||||
if (svdata) {
|
||||
scrollview_destroy(svdata);
|
||||
free (svdata);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case MSG_GETDLGCODE:
|
||||
return DLGC_WANTARROWS;
|
||||
|
||||
@@ -2096,7 +2096,6 @@ static void teOnChar (HWND hWnd, PTEDATA ptedata, WPARAM wParam)
|
||||
rcInv.right = ptedata->svdata.scrdata.nContWidth;
|
||||
rcInv.bottom = rcInv.top + ptedata->nLineHeight - ptedata->nLineBaseH;
|
||||
REFRESH_NODE_EX(node, &rcInv);
|
||||
// UpdateWindow(hWnd, FALSE);
|
||||
|
||||
newlinenr = NODE_LINENR(node);
|
||||
rcInv.left = 0;
|
||||
@@ -2104,12 +2103,10 @@ static void teOnChar (HWND hWnd, PTEDATA ptedata, WPARAM wParam)
|
||||
rcInv.top += ptedata->nLineHeight;
|
||||
rcInv.bottom = rcInv.top + ptedata->nLineHeight - ptedata->nLineBaseH;
|
||||
REFRESH_NODE_EX(node, &rcInv);
|
||||
// UpdateWindow(hWnd, FALSE);
|
||||
}
|
||||
/* houhh 20090814, UpdataWindow will invalidate all edit area, but
|
||||
* erase area is not same with msg_paint area.*/
|
||||
UpdateWindow(hWnd, FALSE);
|
||||
//SendMessage(hWnd, MSG_PAINT, 0, 0);
|
||||
UpdateInvalidClient(hWnd, TRUE);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* 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;
|
||||
RECT rc;
|
||||
|
||||
if (tmpdata->Caption == NULL || tmpdata->Caption [0] == '\0')
|
||||
if (tmpdata->Caption [0] == '\0')
|
||||
break;
|
||||
|
||||
GetTextExtent (hdc, tmpdata->Caption, -1, &size);
|
||||
|
||||
@@ -80,17 +80,17 @@ static void update_viewport (gvGridViewData *view, int from, int to, int is_row)
|
||||
{
|
||||
RECT r;
|
||||
|
||||
GetClientRect (view->hCtrl, &r);
|
||||
GetClientRect(view->hCtrl, &r);
|
||||
|
||||
if (is_row) {
|
||||
r.top = from;
|
||||
ScrollWindow (view->hCtrl, 0, to, &r, NULL);
|
||||
ScrollWindow(view->hCtrl, 0, to, &r, NULL);
|
||||
}
|
||||
else {
|
||||
r.left = from;
|
||||
ScrollWindow (view->hCtrl, to, 0, &r, NULL);
|
||||
ScrollWindow(view->hCtrl, to, 0, &r, NULL);
|
||||
}
|
||||
UpdateWindow(view->hCtrl, FALSE);
|
||||
UpdateInvalidClient(view->hCtrl, FALSE);
|
||||
}
|
||||
|
||||
// scroll function {{{
|
||||
|
||||
@@ -157,6 +157,8 @@ static int isInItem (MgList *mglst, int mouseX, int mouseY,
|
||||
|
||||
index = row * pivlist->nCol + col;
|
||||
pci = (IconviewItem *)mglist_getitem_byindex (mglst, index);
|
||||
if (pci == NULL)
|
||||
return -1;
|
||||
|
||||
if (pRet)
|
||||
*pRet = (MgItem*)pci;
|
||||
|
||||
+10
-17
@@ -93,14 +93,15 @@ BOOL RegisterTreeViewControl (void)
|
||||
const WINDOW_ELEMENT_RENDERER * rdr =
|
||||
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))) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(icon_unfold = (HICON)RetrieveRes(gui_GetIconFile(rdr->name, SYSICON_UNFOLD, szValue)))) {
|
||||
if (!(icon_unfold = (HICON)RetrieveRes(gui_GetIconFile(rdr->name,
|
||||
SYSICON_UNFOLD, szValue)))) {
|
||||
if (!(icon_unfold = LoadSystemIcon (SYSICON_UNFOLD, 0))) {
|
||||
DestroyIcon (icon_fold);
|
||||
icon_fold = 0;
|
||||
@@ -180,6 +181,7 @@ static BOOL tvInitTVData (HWND hwnd, PTVDATA pData, DWORD dwStyle, PTVITEMINFO r
|
||||
tvRoot->hIconFold = root_ii->hIconFold;
|
||||
else
|
||||
tvRoot->hIconFold = ICON_FOLD;
|
||||
|
||||
if (root_ii && root_ii->hIconUnfold)
|
||||
tvRoot->hIconUnfold = root_ii->hIconUnfold;
|
||||
else
|
||||
@@ -632,22 +634,13 @@ static void tvDrawItem (HWND hWnd, HDC hdc, PTVDATA pData, int centerX, int cent
|
||||
centerX += (h>>1) + TV_BOXGAP;
|
||||
|
||||
if (pData->dwStyle & TVS_WITHICON) {
|
||||
if (!(pData->dwStyle & TVS_ICONFORSELECT)
|
||||
&& (!p->child || (p->dwFlags & TVIF_FOLD))) {
|
||||
if (p->child != NULL && (p->dwFlags & TVIF_FOLD)) {
|
||||
if ((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);
|
||||
DrawIcon (hdc, centerX, centerY - (h>>1), h, h, p->hIconFold);
|
||||
}
|
||||
} else if ((p->hIconUnfold)) {
|
||||
DrawIcon (hdc, centerX, centerY - (h>>1), h, h, p->hIconUnfold);
|
||||
}
|
||||
centerX += h + TV_ICONGAP;
|
||||
}
|
||||
|
||||
|
||||
@@ -202,6 +202,17 @@ static void destroy (GLYPHTREENODE *root)
|
||||
|
||||
/*** 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)
|
||||
{
|
||||
return DEVFONTGLYPHTYPE_PRERDRBMP;
|
||||
@@ -380,6 +391,7 @@ static int get_glyph_bbox (LOGFONT* logfont, DEVFONT* devfont,
|
||||
|
||||
/**************************** Global data ************************************/
|
||||
FONTOPS __mg_bitmap_font_ops = {
|
||||
get_feature,
|
||||
get_glyph_bmptype,
|
||||
get_ave_width,
|
||||
get_max_width,
|
||||
|
||||
+19
-16
@@ -15,7 +15,7 @@
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 2002~2023, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@@ -226,7 +226,7 @@ static int iso8859_6_conv_from_uc32 (Uchar32 wc, unsigned char* mchar)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* must attetion the para s is arabic chv value.*/
|
||||
#if 0
|
||||
static int is_arabic_char_vowel(Uint8 c)
|
||||
{
|
||||
|
||||
@@ -240,6 +240,7 @@ static int is_arabic_char_vowel(Uint8 c)
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ISO8859-6 charset vowel relative define and judge */
|
||||
#define ISARABIC_VOWEL(s) ((s >= FATHATAN) && (s <= SUKUN))
|
||||
@@ -461,15 +462,18 @@ static int iso8859_6_len_first_char (const unsigned char* mstr, int len)
|
||||
return 2;
|
||||
else if (ignore == 2)
|
||||
return 3;
|
||||
else
|
||||
return 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define ISARABIC_LIG_HALF(s) ((s == 0xa5) || (s == 0xa6))
|
||||
|
||||
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;
|
||||
|
||||
if (is_arabic_char_vowel (chv)) { /* is vowel */
|
||||
@@ -480,10 +484,10 @@ static unsigned int iso8859_6_char_type (Achar32 chv)
|
||||
}
|
||||
|
||||
return ch_type;
|
||||
#endif
|
||||
}
|
||||
|
||||
static BidiType __mg_iso8859_6_bidi_char_type_map[] = {
|
||||
#if 0
|
||||
/*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,
|
||||
@@ -531,7 +535,6 @@ 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_ON,
|
||||
BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_BN,
|
||||
#endif
|
||||
|
||||
/*0x80~0x8f*/
|
||||
BIDI_TYPE_ON, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL,
|
||||
@@ -606,10 +609,9 @@ static BidiType __mg_iso8859_6_bidi_char_type_map[] = {
|
||||
static BidiType iso8859_6_bidi_char_type (Achar32 chv)
|
||||
{
|
||||
chv = REAL_ACHAR(chv);
|
||||
if (chv > 0x7F)
|
||||
return (BidiType)__mg_iso8859_6_bidi_char_type_map[chv - 0x80];
|
||||
else
|
||||
return (BidiType)__mg_iso8859_1_bidi_char_type_map[chv];
|
||||
assert(chv < TABLESIZE(__mg_iso8859_6_bidi_char_type_map));
|
||||
|
||||
return (BidiType)__mg_iso8859_6_bidi_char_type_map[chv];
|
||||
}
|
||||
|
||||
static int get_table_index(Uint8 c)
|
||||
@@ -796,7 +798,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,
|
||||
int cur_len, int shape_type)
|
||||
{
|
||||
Achar32 chv = -1;
|
||||
Achar32 chv = INV_ACHAR_VALUE;
|
||||
int ignore;
|
||||
int index;
|
||||
|
||||
@@ -811,15 +813,14 @@ static Achar32 iso8859_6_get_shaped_char_value (const unsigned char* cur_mchar,
|
||||
}
|
||||
}
|
||||
|
||||
if (chv == -1 || chv == 0) {
|
||||
if (chv == INV_ACHAR_VALUE || chv == 0) {
|
||||
if (ISARABIC_VOWEL(*cur_mchar)){
|
||||
chv = fontset_68x_get_vowel_char(*cur_mchar);
|
||||
}
|
||||
|
||||
if (chv == 0 || chv == -1) {
|
||||
if (chv == 0 || chv == INV_ACHAR_VALUE) {
|
||||
index = get_table_index(*cur_mchar);
|
||||
if (index >=0)
|
||||
{
|
||||
if (index >=0 ) {
|
||||
switch (shape_type) {
|
||||
case ACHAR_ISOLATED:
|
||||
chv = shape_info[index].isolated;
|
||||
@@ -841,7 +842,7 @@ static Achar32 iso8859_6_get_shaped_char_value (const unsigned char* cur_mchar,
|
||||
}
|
||||
|
||||
if (chv == 0)
|
||||
chv =-1;
|
||||
chv = INV_ACHAR_VALUE;
|
||||
|
||||
return chv;
|
||||
}
|
||||
@@ -862,6 +863,7 @@ static const BIDICHAR_MIRROR_MAP __mg_iso8859_68x_mirror_table [] =
|
||||
|
||||
static BOOL iso8859_6_bidi_mirror_char (Achar32 chv, Achar32* mirrored)
|
||||
{
|
||||
chv = REAL_ACHAR(chv);
|
||||
return get_mirror_char (__mg_iso8859_68x_mirror_table,
|
||||
TABLESIZE (__mg_iso8859_68x_mirror_table), chv, mirrored);
|
||||
}
|
||||
@@ -871,6 +873,7 @@ static CHARSETOPS CharsetOps_iso8859_6 = {
|
||||
3,
|
||||
FONT_CHARSET_ISO8859_6,
|
||||
0,
|
||||
1,
|
||||
iso8859_6_len_first_char,
|
||||
iso8859_6_get_char_value,
|
||||
iso8859_6_get_shaped_char_value,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 2002~2023, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@@ -210,6 +210,8 @@ static unsigned int unicode_char_type (Achar32 chv)
|
||||
mchar_type = ACHAR_BASIC_LF;
|
||||
else if (break_type == UCHAR_BREAK_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))
|
||||
mchar_type = ACHAR_BASIC_ZEROWIDTH;
|
||||
else if ((chv >= 0x1160 && chv < 0x1200)
|
||||
@@ -239,10 +241,36 @@ static const BidiType linear_enum_to_bidi_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)
|
||||
{
|
||||
ch = REAL_ACHAR(ch);
|
||||
return linear_enum_to_bidi_type[UNIBIDI_GET_BIDI_TYPE(ch)];
|
||||
BidiType bt = 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)
|
||||
@@ -628,6 +656,7 @@ CHARSETOPS __mg_CharsetOps_utf8 = {
|
||||
6,
|
||||
FONT_CHARSET_UTF8,
|
||||
0,
|
||||
0,
|
||||
utf8_len_first_char,
|
||||
utf8_get_char_value,
|
||||
NULL,
|
||||
@@ -854,6 +883,7 @@ CHARSETOPS __mg_CharsetOps_utf16le = {
|
||||
4,
|
||||
FONT_CHARSET_UTF16LE,
|
||||
0,
|
||||
0,
|
||||
utf16le_len_first_char,
|
||||
utf16le_get_char_value,
|
||||
NULL,
|
||||
@@ -1080,6 +1110,7 @@ CHARSETOPS __mg_CharsetOps_utf16be = {
|
||||
4,
|
||||
FONT_CHARSET_UTF16BE,
|
||||
0,
|
||||
0,
|
||||
utf16be_len_first_char,
|
||||
utf16be_get_char_value,
|
||||
NULL,
|
||||
|
||||
+30
-7
File diff suppressed because it is too large
Load Diff
@@ -255,6 +255,17 @@ compute_kernval (TTFINSTANCEINFO* ttf_inst_info)
|
||||
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)
|
||||
{
|
||||
if (logfont->style & FS_WEIGHT_BOOK)
|
||||
@@ -792,6 +803,7 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
|
||||
}
|
||||
/**************************** Global data ************************************/
|
||||
FONTOPS __mg_ttf_ops = {
|
||||
get_feature,
|
||||
get_glyph_bmptype,
|
||||
get_ave_width,
|
||||
get_max_width,
|
||||
|
||||
@@ -197,6 +197,17 @@ print_bitmap_grey (const BYTE* buffer, int width, int rows, int pitch)
|
||||
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)
|
||||
{
|
||||
switch (logfont->style & FS_RENDER_MASK) {
|
||||
@@ -1265,6 +1276,7 @@ void font_TermFreetypeLibrary (void)
|
||||
|
||||
/**************************** Global data ************************************/
|
||||
FONTOPS __mg_ttf_ops = {
|
||||
get_feature,
|
||||
get_glyph_bmptype,
|
||||
get_ave_width,
|
||||
get_max_width,
|
||||
|
||||
+15
-9
@@ -703,21 +703,20 @@ void __mg_legacy_bidi_get_embeddlevels (const CHARSETOPS* charset_ops,
|
||||
print_hexstr(achars, len, TRUE);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void bidi_map_reverse (void* context, int len, int pos)
|
||||
{
|
||||
GLYPHMAPINFO* str = (GLYPHMAPINFO*)context + pos;
|
||||
ACHARMAPINFO* str = (ACHARMAPINFO*)context + pos;
|
||||
int i;
|
||||
for (i = 0; i < len / 2; i++)
|
||||
{
|
||||
GLYPHMAPINFO tmp = str[i];
|
||||
ACHARMAPINFO tmp = str[i];
|
||||
str[i] = str[len - 1 - i];
|
||||
str[len - 1 - i] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
Achar32* __mg_legacy_bidi_map_reorder (const CHARSETOPS* charset_ops,
|
||||
Achar32* achars, int len, GLYPHMAPINFO* map, int pel)
|
||||
Achar32* achars, int len, int pel, ACHARMAPINFO* map)
|
||||
{
|
||||
BYTE max_level = 1;
|
||||
TYPERUN *type_rl_list = NULL;
|
||||
@@ -725,6 +724,7 @@ Achar32* __mg_legacy_bidi_map_reorder (const CHARSETOPS* charset_ops,
|
||||
int i;
|
||||
int run_pos;
|
||||
int run_len;
|
||||
REORDER_CONTEXT rc;
|
||||
|
||||
print_hexstr(achars, len, FALSE);
|
||||
|
||||
@@ -735,14 +735,15 @@ Achar32* __mg_legacy_bidi_map_reorder (const CHARSETOPS* charset_ops,
|
||||
run_pos = node_p->pos;
|
||||
run_len = node_p->len;
|
||||
|
||||
for (i=0; i<run_len; i++)
|
||||
{
|
||||
for (i=0; i<run_len; i++) {
|
||||
(map+run_pos+i)->is_rtol = (node_p)->level & 1;
|
||||
}
|
||||
}
|
||||
|
||||
bidi_reorder_cb(map, len, &type_rl_list, max_level,
|
||||
bidi_map_reverse);
|
||||
rc.achars = NULL;
|
||||
rc.extra = map;
|
||||
rc.cb = bidi_map_reverse;
|
||||
bidi_reorder(&rc, len, &type_rl_list, max_level);
|
||||
|
||||
/* free typerun list.*/
|
||||
free_typerun_list(type_rl_list);
|
||||
@@ -752,18 +753,23 @@ Achar32* __mg_legacy_bidi_map_reorder (const CHARSETOPS* charset_ops,
|
||||
return achars;
|
||||
}
|
||||
|
||||
#if 0
|
||||
Achar32* __mg_legacy_bidi_index_reorder (const CHARSETOPS* charset_ops,
|
||||
Achar32* achars, int len, int* index_map, int pel)
|
||||
{
|
||||
BYTE max_level = 1;
|
||||
TYPERUN *type_rl_list = NULL;
|
||||
REORDER_CONTEXT rc;
|
||||
|
||||
print_hexstr(achars, len, FALSE);
|
||||
|
||||
/* W1~W7, N1~N2, I1~I2, Get the Embedding Level. */
|
||||
bidi_resolve_string (charset_ops, achars, len, pel, &type_rl_list, &max_level);
|
||||
|
||||
bidi_reorder_cb(index_map, len, &type_rl_list, max_level,
|
||||
rc.achars = achars;
|
||||
rc.extra = extra;
|
||||
rc.cb = cb_reverse_extra;
|
||||
bidi_reorder(index_map, len, &type_rl_list, max_level,
|
||||
bidi_string_reverse);
|
||||
|
||||
/* free typerun list.*/
|
||||
|
||||
@@ -66,6 +66,17 @@
|
||||
#define NUF_WIDTH 8
|
||||
#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)
|
||||
{
|
||||
return DEVFONTGLYPHTYPE_MONOBMP;
|
||||
@@ -171,6 +182,7 @@ static void unload_font_data (DEVFONT* devfont, void* data)
|
||||
}
|
||||
|
||||
FONTOPS __mg_null_font_ops = {
|
||||
get_feature,
|
||||
get_glyph_bmptype,
|
||||
get_ave_width,
|
||||
get_max_width,
|
||||
|
||||
@@ -287,6 +287,17 @@ static unsigned char def_smooth_bitmap [] =
|
||||
static QPF_GLYPH def_glyph = {&def_metrics, def_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)
|
||||
{
|
||||
if (QPFONT_INFO_P (devfont)->fm->flags & FLAG_MODE_SMOOTH)
|
||||
@@ -541,6 +552,7 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
|
||||
|
||||
/**************************** Global data ************************************/
|
||||
FONTOPS __mg_qpf_ops = {
|
||||
get_feature,
|
||||
get_glyph_bmptype,
|
||||
get_ave_width,
|
||||
get_max_width,
|
||||
|
||||
@@ -151,6 +151,17 @@ static void unload_font_data (DEVFONT* devfont, void* data)
|
||||
|
||||
/*************** 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)
|
||||
{
|
||||
return DEVFONTGLYPHTYPE_MONOBMP;
|
||||
@@ -280,6 +291,7 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
|
||||
|
||||
/**************************** Global data ************************************/
|
||||
FONTOPS __mg_rbf_ops = {
|
||||
get_feature,
|
||||
get_glyph_bmptype,
|
||||
get_ave_width,
|
||||
get_ave_width, // max_width same as ave_width
|
||||
|
||||
@@ -377,6 +377,17 @@ static int get_max_width (LOGFONT* logfont, DEVFONT* devfont)
|
||||
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)
|
||||
{
|
||||
if (logfont->style & FS_WEIGHT_BOOK)
|
||||
@@ -598,6 +609,7 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
|
||||
|
||||
/**************************** Global data ************************************/
|
||||
static FONTOPS scripteasy_font_ops = {
|
||||
get_feature,
|
||||
get_glyph_bmptype,
|
||||
get_ave_width,
|
||||
get_max_width,
|
||||
|
||||
+4
-1
@@ -155,7 +155,10 @@ BOOL mg_InitSysFont (void)
|
||||
goto error_load;
|
||||
}
|
||||
|
||||
if ((sys_fonts[i] = CreateLogFont (type, family, charset,
|
||||
/* VW 20221003: use CreateLogFontEx instead of CreateLogFont to
|
||||
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 [3], style [4], style [5],
|
||||
height, 0)) == NULL) {
|
||||
|
||||
@@ -377,8 +377,8 @@ static _GBType resolve_gbt(struct break_ctxt* ctxt,
|
||||
uc == 0x8E2 || uc == 0xD4E || uc == 0x110BD ||
|
||||
(uc >= 0x111C2 && uc <= 0x111C3)) {
|
||||
gbt = GB_Prepend;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case UCHAR_CATEGORY_CONTROL:
|
||||
case UCHAR_CATEGORY_LINE_SEPARATOR:
|
||||
@@ -393,8 +393,8 @@ static _GBType resolve_gbt(struct break_ctxt* ctxt,
|
||||
if ((uc >= 0xFFF0 && uc <= 0xFFF8) ||
|
||||
(uc >= 0xE0000 && uc <= 0xE0FFF)) {
|
||||
gbt = GB_ControlCRLF;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case UCHAR_CATEGORY_OTHER_LETTER:
|
||||
if (ctxt->makes_hangul_syllable)
|
||||
@@ -434,7 +434,6 @@ static _GBType resolve_gbt(struct break_ctxt* ctxt,
|
||||
gbt = GB_RI_Odd;
|
||||
else
|
||||
gbt = GB_RI_Odd;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -148,6 +148,17 @@ static void unload_font_data (DEVFONT* devfont, void* 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)
|
||||
{
|
||||
Uint8* p_upf = (Uint8 *)UPFONT_INFO_P (devfont)->root_dir;
|
||||
@@ -525,6 +536,7 @@ static int is_rotatable (LOGFONT* logfont, DEVFONT* devfont, int rot_desired)
|
||||
}
|
||||
|
||||
FONTOPS __mg_upf_ops = {
|
||||
get_feature,
|
||||
get_glyph_bmptype,
|
||||
get_ave_width,
|
||||
get_max_width,
|
||||
|
||||
@@ -109,6 +109,17 @@ typedef struct _FONT_PROPT {
|
||||
int def_glyph;
|
||||
} 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)
|
||||
{
|
||||
return DEVFONTGLYPHTYPE_MONOBMP;
|
||||
@@ -477,6 +488,7 @@ static void unload_font_data (DEVFONT* devfont, void* data)
|
||||
}
|
||||
|
||||
FONTOPS __mg_vbf_ops = {
|
||||
get_feature,
|
||||
get_glyph_bmptype,
|
||||
get_ave_width,
|
||||
get_max_width,
|
||||
|
||||
@@ -59,7 +59,6 @@
|
||||
#include "cliprect.h"
|
||||
#include "gal.h"
|
||||
#include "internals.h"
|
||||
#include "blockheap.h"
|
||||
#include "accelkey.h"
|
||||
|
||||
static BLOCKHEAP ACHeap;
|
||||
|
||||
+59
-18
@@ -59,17 +59,22 @@
|
||||
#include "cliprect.h"
|
||||
#include "gal.h"
|
||||
#include "internals.h"
|
||||
#include "dc.h"
|
||||
|
||||
BOOL GUIAPI CreateCaret (HWND hWnd, PBITMAP pBitmap, int nWidth, int nHeight)
|
||||
{
|
||||
PMAINWIN pWin;
|
||||
|
||||
pWin = (PMAINWIN)hWnd;
|
||||
|
||||
if (!pWin->pCaretInfo) {
|
||||
HDC hdc;
|
||||
|
||||
if (!(pWin->pCaretInfo = malloc (sizeof (CARETINFO))))
|
||||
return FALSE;
|
||||
|
||||
/* Since 5.0.11: use client DC of the window instead of screen DC */
|
||||
hdc = GetClientDC(hWnd);
|
||||
|
||||
pWin->pCaretInfo->pBitmap = pBitmap;
|
||||
if (pBitmap) {
|
||||
nWidth = pBitmap->bmWidth;
|
||||
@@ -78,18 +83,22 @@ BOOL GUIAPI CreateCaret (HWND hWnd, PBITMAP pBitmap, int nWidth, int nHeight)
|
||||
pWin->pCaretInfo->nWidth = nWidth;
|
||||
pWin->pCaretInfo->nHeight = nHeight;
|
||||
pWin->pCaretInfo->caret_bmp.bmType = BMP_TYPE_NORMAL;
|
||||
pWin->pCaretInfo->caret_bmp.bmBitsPerPixel = BITSPERPHYPIXEL;
|
||||
pWin->pCaretInfo->caret_bmp.bmBytesPerPixel = BYTESPERPHYPIXEL;
|
||||
pWin->pCaretInfo->caret_bmp.bmBitsPerPixel =
|
||||
GetGDCapability(hdc, GDCAP_BITSPP);
|
||||
pWin->pCaretInfo->caret_bmp.bmBytesPerPixel =
|
||||
GetGDCapability(hdc, GDCAP_BPP);
|
||||
pWin->pCaretInfo->caret_bmp.bmWidth = nWidth;
|
||||
pWin->pCaretInfo->caret_bmp.bmHeight = nHeight;
|
||||
pWin->pCaretInfo->caret_bmp.bmAlphaMask = NULL;
|
||||
pWin->pCaretInfo->caret_bmp.bmAlphaPitch = 0;
|
||||
|
||||
pWin->pCaretInfo->nBytesNr = GAL_GetBoxSize (__gal_screen,
|
||||
pWin->pCaretInfo->nBytesNr = GAL_GetBoxSize (dc_HDC2PDC(hdc)->surface,
|
||||
nWidth, nHeight, &pWin->pCaretInfo->caret_bmp.bmPitch);
|
||||
pWin->pCaretInfo->pNormal = malloc (pWin->pCaretInfo->nBytesNr);
|
||||
pWin->pCaretInfo->pXored = malloc (pWin->pCaretInfo->nBytesNr);
|
||||
|
||||
ReleaseDC(hdc);
|
||||
|
||||
if (pWin->pCaretInfo->pNormal == NULL ||
|
||||
pWin->pCaretInfo->pXored == NULL) {
|
||||
free (pWin->pCaretInfo);
|
||||
@@ -219,8 +228,8 @@ void GetCaretBitmaps (PCARETINFO pCaretInfo)
|
||||
int i;
|
||||
int sx, sy;
|
||||
HDC hdc;
|
||||
Uint32 amask;
|
||||
|
||||
// convert to screen coordinates
|
||||
sx = pCaretInfo->x;
|
||||
sy = pCaretInfo->y;
|
||||
|
||||
@@ -231,36 +240,68 @@ void GetCaretBitmaps (PCARETINFO pCaretInfo)
|
||||
pCaretInfo->caret_bmp.bmWidth,
|
||||
pCaretInfo->caret_bmp.bmHeight,
|
||||
&pCaretInfo->caret_bmp);
|
||||
amask = GetGDCapability(hdc, GDCAP_AMASK);
|
||||
ReleaseDC (hdc);
|
||||
|
||||
// generate XOR bitmap.
|
||||
if (pCaretInfo->pBitmap) {
|
||||
if (amask == 0) {
|
||||
BYTE* normal;
|
||||
BYTE* bitmap;
|
||||
BYTE* xored;
|
||||
|
||||
normal = pCaretInfo->pNormal;
|
||||
bitmap = pCaretInfo->pBitmap->bmBits;
|
||||
xored = pCaretInfo->pXored;
|
||||
|
||||
for (i = 0; i < pCaretInfo->nBytesNr; i++)
|
||||
xored[i] = normal[i] ^ bitmap[i];
|
||||
if (pCaretInfo->pBitmap) {
|
||||
bitmap = pCaretInfo->pBitmap->bmBits;
|
||||
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 {
|
||||
// Since 5.0.11: restore the alpha component if having alpha component.
|
||||
int x, y;
|
||||
BYTE* normal;
|
||||
BYTE* xored;
|
||||
BYTE xor_byte;
|
||||
BYTE* bitmap = NULL;
|
||||
gal_pixel pix_normal, pix_bitmap, pix_xored, bits_alpha;
|
||||
|
||||
if (BITSPERPHYPIXEL < 8)
|
||||
xor_byte = 0x0F;
|
||||
else
|
||||
xor_byte = 0xFF;
|
||||
for (y = 0; y < pCaretInfo->caret_bmp.bmHeight; y++) {
|
||||
normal = pCaretInfo->pNormal + pCaretInfo->caret_bmp.bmPitch * y;
|
||||
xored = pCaretInfo->pXored + pCaretInfo->caret_bmp.bmPitch * y;
|
||||
if (pCaretInfo->pBitmap)
|
||||
bitmap = pCaretInfo->pBitmap->bmBits +
|
||||
pCaretInfo->caret_bmp.bmPitch * y;
|
||||
|
||||
normal = pCaretInfo->pNormal;
|
||||
xored = pCaretInfo->pXored;
|
||||
for (x = 0; x < pCaretInfo->caret_bmp.bmWidth; x++) {
|
||||
|
||||
for (i = 0; i < pCaretInfo->nBytesNr; i++)
|
||||
xored[i] = normal[i] ^ xor_byte;
|
||||
pix_normal = _mem_get_pixel(normal,
|
||||
pCaretInfo->caret_bmp.bmBytesPerPixel);
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@@ -803,7 +803,7 @@ BOOL GUIAPI InitWindowElementAttrs (PWERENDERER rdr)
|
||||
char buff [20];
|
||||
DWORD rgba;
|
||||
|
||||
if (!rdr || !rdr->name || rdr->name[0] == '\0')
|
||||
if (!rdr || rdr->name[0] == '\0')
|
||||
return FALSE;
|
||||
|
||||
_DBG_PRINTF ("GUI>InitWEA: Initialize %s renderer window element attributes.\n",
|
||||
|
||||
+1
-2
@@ -71,7 +71,6 @@
|
||||
#include "cliprect.h"
|
||||
#include "gal.h"
|
||||
#include "internals.h"
|
||||
#include "blockheap.h"
|
||||
#include "menu.h"
|
||||
|
||||
#define SHORTEN 0
|
||||
@@ -2186,7 +2185,7 @@ static int create_memdc_for_menu (TRACKMENUINFO* ptmi)
|
||||
return -1;
|
||||
}
|
||||
|
||||
ptmi->dc = CreateMemDCFromSurface (surf);
|
||||
ptmi->dc = __mg_create_memdc_for_surface (surf);
|
||||
if (ptmi->dc == HDC_INVALID) {
|
||||
GAL_FreeSurface (surf);
|
||||
return -1;
|
||||
|
||||
+115
-52
File diff suppressed because it is too large
Load Diff
@@ -319,6 +319,19 @@ static void flush_rec (void)
|
||||
#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)
|
||||
{
|
||||
@@ -744,6 +757,7 @@ void TermPCXVFBInput (void)
|
||||
remove("/tmp/.pcxvfb_tmp");
|
||||
}
|
||||
#endif
|
||||
close_rec();
|
||||
#endif /* WIN32 */
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ noinst_HEADERS = \
|
||||
cursor.h dc.h event.h list.h element.h \
|
||||
ial.h inline.h internals.h zorder.h menu.h misc.h \
|
||||
msgstr.h sysfont.h timer.h devfont.h fontname.h \
|
||||
readbmp.h icon.h blockheap.h rbtree.h \
|
||||
readbmp.h icon.h rbtree.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 \
|
||||
glyph.h license.h mgsock.h unicode-ops.h \
|
||||
|
||||
+3
-3
@@ -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,
|
||||
Achar32* achars, int len);
|
||||
|
||||
Achar32* __mg_legacy_bidi_map_reorder (const CHARSETOPS* charset_ops,
|
||||
Achar32* achars, int len, int pel, ACHARMAPINFO* map);
|
||||
|
||||
#if 0
|
||||
// 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* achars, int len, int* index_map, int pel);
|
||||
#endif
|
||||
|
||||
@@ -70,7 +70,6 @@ struct _SCALER_INFO_FILLBMP
|
||||
typedef struct {
|
||||
struct _SCALER_INFO_FILLBMP scaler_info;
|
||||
GAL_Rect dst_rect;
|
||||
int old_bkmode;
|
||||
|
||||
BYTE* decoded_buff;
|
||||
BYTE* decoded_alpha_buff;
|
||||
|
||||
@@ -47,6 +47,8 @@
|
||||
** blockheap.h: the head file of heap for block data.
|
||||
**
|
||||
** Create date: 2001/01/10
|
||||
**
|
||||
** DEPRECATED, USE window.h INSTEAD.
|
||||
*/
|
||||
|
||||
#ifndef GUI_BLOCKHEAP_H
|
||||
@@ -55,7 +57,7 @@
|
||||
#ifndef _MGUI_GDI_H /* included in include/gdi.h */
|
||||
|
||||
struct _BLOCKHEAP {
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_t lock;
|
||||
#endif
|
||||
/* Size of one block element. */
|
||||
+27
-2
@@ -105,6 +105,10 @@
|
||||
#define REQID_GETSHAREDSURFACE 0x001C
|
||||
// for compositing schema
|
||||
#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
|
||||
#define SYSSF_REAL_SCREEN "syssf-real-screen"
|
||||
#define SYSSF_SHADOW_SCREEN "syssf-shadow-screen"
|
||||
@@ -113,10 +117,22 @@
|
||||
#define REQID_LOADCURSOR_PNG 0x001D
|
||||
// Load cursor from in-memory PNG
|
||||
#define REQID_LOADCURSOR_PNG_MEM 0x001E
|
||||
|
||||
#if 0 // Deprecated since 5.2.0
|
||||
// allocate semaphore for shared surface
|
||||
#define REQID_ALLOC_SURF_SEM 0x001F
|
||||
// free semaphore of shared surface
|
||||
#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
|
||||
#define REQID_MOVETOLAYER 0x0021
|
||||
@@ -142,15 +158,23 @@ MGUI_COMPILE_TIME_ASSERT(sys_request_id, MAX_SYS_REQID >= REQID_SYS_LAST);
|
||||
|
||||
#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 */
|
||||
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 width, height;
|
||||
uint32_t pitch;
|
||||
uint32_t name; // when use flink name
|
||||
uint32_t drm_format; // DRM pixel format
|
||||
size_t size; // whole size of the surface
|
||||
off_t offset; // offset of pixel data
|
||||
} SHAREDSURFINFO;
|
||||
|
||||
typedef struct JoinLayerInfo {
|
||||
@@ -359,6 +383,7 @@ void __mg_start_client_desktop (void);
|
||||
|
||||
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_on_layer_changed (GHANDLE layer_handle, int zi_shmid);
|
||||
|
||||
|
||||
+12
-5
@@ -167,6 +167,8 @@ struct tagDC
|
||||
/* surface of this DC */
|
||||
GAL_Surface* surface;
|
||||
|
||||
char __first_attr[0]; // just a zero-length field for the first attribute
|
||||
|
||||
/* background color */
|
||||
gal_pixel bkcolor;
|
||||
|
||||
@@ -179,7 +181,7 @@ struct tagDC
|
||||
/* text color */
|
||||
gal_pixel textcolor;
|
||||
|
||||
int bkmode;
|
||||
int bkmode_set; /* the background mode set by user (5.0.12, Issue #107) */
|
||||
|
||||
int tabstop;
|
||||
int cExtra; /* Character extra */
|
||||
@@ -213,6 +215,8 @@ struct tagDC
|
||||
size_t dash_list_len;
|
||||
#endif
|
||||
|
||||
char __last_attr[0]; // just a zero-length field for the last attribute
|
||||
|
||||
PLOGFONT pLogFont;
|
||||
|
||||
POINT CurPenPos;
|
||||
@@ -247,6 +251,7 @@ struct tagDC
|
||||
gal_pixel skip_pixel;
|
||||
gal_pixel cur_pixel;
|
||||
int step;
|
||||
int bkmode; /* the effective background mode */
|
||||
/* ====================================================================== */
|
||||
|
||||
CLIPRECT* cur_ban;
|
||||
@@ -516,14 +521,16 @@ static inline void _dc_step_y (PDC pdc, int step)
|
||||
|
||||
# define BLOCK_DRAW_SEM(pdc) \
|
||||
do { \
|
||||
if (pdc->surface->shared_header) \
|
||||
LOCK_SURFACE_SEM (pdc->surface->shared_header->sem_num); \
|
||||
if (pdc->surface->shared_header) { \
|
||||
__mg_lock_file_for_write(pdc->surface->fd); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define UNBLOCK_DRAW_SEM(pdc) \
|
||||
do { \
|
||||
if (pdc->surface->shared_header) \
|
||||
UNLOCK_SURFACE_SEM (pdc->surface->shared_header->sem_num); \
|
||||
if (pdc->surface->shared_header) { \
|
||||
__mg_unlock_file_for_write(pdc->surface->fd); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
# define IS_SCREEN_SURFACE(pdc) \
|
||||
|
||||
+12
-1
@@ -15,7 +15,7 @@
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 2002~2023, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@@ -209,6 +209,9 @@ struct _CHARSETOPS
|
||||
/** Default character. */
|
||||
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. */
|
||||
int (*len_first_char) (const unsigned char* mstr, int mstrlen);
|
||||
|
||||
@@ -263,9 +266,17 @@ struct _CHARSETOPS
|
||||
|
||||
#define DEVFONTGLYPHTYPE_MASK_BMPTYPE 0x0F
|
||||
|
||||
enum devfont_feature {
|
||||
DEVFONT_FEATURE_MARK_BBOX = 0,
|
||||
};
|
||||
|
||||
/** The font operation structure. */
|
||||
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 . */
|
||||
DWORD (*get_glyph_bmptype) (LOGFONT* logfont, DEVFONT* devfont);
|
||||
|
||||
|
||||
+10
-8
@@ -51,12 +51,10 @@
|
||||
#ifndef GUI_DRAWSEMOP_H
|
||||
#define GUI_DRAWSEMOP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#include "misc.h"
|
||||
|
||||
static inline void my_sem_op (int semid, int num, int op)
|
||||
{
|
||||
struct sembuf sb;
|
||||
@@ -70,6 +68,9 @@ again:
|
||||
if (errno == EINTR) {
|
||||
goto again;
|
||||
}
|
||||
else {
|
||||
_ERR_PRINTF("Failed semop: %m\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,10 +80,7 @@ again:
|
||||
#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)
|
||||
|
||||
#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
|
||||
extern int __mg_client_id;
|
||||
|
||||
#ifdef _MGHAVE_CURSOR
|
||||
|
||||
@@ -157,6 +155,10 @@ again:
|
||||
# define UNLOCK_MOUSEMOVE_SEM() my_sem_op(SHAREDRES_SEMID, _IDX_SEM_MOUSEMOVE, 1)
|
||||
#endif /* _MGRM_PROCESSES */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -127,6 +127,9 @@ typedef LWEVENT* PLWEVENT;
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
extern DWORD __mg_timeout_usec;
|
||||
extern DWORD __mg_repeat_usec;
|
||||
|
||||
// The entrance of low level event handling thread
|
||||
BOOL mg_InitLWEvent (void);
|
||||
void mg_TerminateLWEvent (void);
|
||||
|
||||
+18
-44
@@ -84,15 +84,18 @@
|
||||
#define WS_EX_MODALDISABLED 0x10000000L
|
||||
|
||||
/*
|
||||
* \def WS_EX_CTRLASMAINWIN
|
||||
* \brief The control can be displayed out of the main window
|
||||
* which contains the control.
|
||||
* Internal extended style:
|
||||
* The control can be displayed out of the main window
|
||||
* which contains the control.
|
||||
*/
|
||||
#define WS_EX_CTRLASMAINWIN 0x20000000L
|
||||
|
||||
/* Internal extended style. */
|
||||
/* Internal extended style: dialog box. */
|
||||
#define WS_EX_DIALOGBOX 0x40000000L
|
||||
|
||||
/* Internal extended style: activated. */
|
||||
#define WS_EX_ACTIVATED 0x80000000L
|
||||
|
||||
/* Make sure the internal window extended styles above are ok */
|
||||
#define MGUI_COMPILE_TIME_ASSERT(name, x) \
|
||||
typedef int MGUI_dummy_ ## name[((x)?1:0) * 2 - 1]
|
||||
@@ -101,6 +104,10 @@ MGUI_COMPILE_TIME_ASSERT(ws_ex_int_1,
|
||||
WS_EX_INTERNAL_MASK & WS_EX_MODALDISABLED);
|
||||
MGUI_COMPILE_TIME_ASSERT(ws_ex_int_2,
|
||||
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
|
||||
|
||||
@@ -251,7 +258,7 @@ struct _MSGQUEUE
|
||||
int loop_depth; // message loop depth, for dialog boxes
|
||||
|
||||
int idle_counter; // the idle connter for MSG_IDLE
|
||||
DWORD last_ticks_desktop; // the last tick count for desktop timer
|
||||
DWORD last_ticks; // the last tick count saved; since 5.0.14
|
||||
|
||||
/* Since 5.0.0, MiniGUI provides support for timers per message thread */
|
||||
int nr_timers; // the number of active timers
|
||||
@@ -772,8 +779,8 @@ static inline PMSGQUEUE getMsgQueue (HWND hWnd)
|
||||
}
|
||||
|
||||
|
||||
MSGQUEUE* mg_AllocMsgQueueForThisThread (void);
|
||||
void mg_FreeMsgQueueForThisThread (void);
|
||||
MSGQUEUE* mg_AllocMsgQueueForThisThread (BOOL sign_in);
|
||||
void mg_FreeMsgQueueForThisThread (BOOL sign_off);
|
||||
|
||||
/* Since 5.0.0 */
|
||||
int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd);
|
||||
@@ -904,40 +911,9 @@ static inline MSGQUEUE* getMsgQueueIfMainWindowInThisThread (PMAINWIN pMainWin)
|
||||
|
||||
#endif /* defined _MGHAVE_VIRTUAL_WINDOW */
|
||||
|
||||
#if 0 /* deprecated code */
|
||||
/* since 5.0.0, we always use QS_DESKTIMER for desktop timer */
|
||||
/* 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);
|
||||
/* Since 5.0.14, remove arg use_sys_timer */
|
||||
BOOL mg_InitTimer (void);
|
||||
void mg_TerminateTimer (void);
|
||||
|
||||
/*window element renderer manager interface*/
|
||||
extern WINDOW_ELEMENT_RENDERER * __mg_def_renderer;
|
||||
@@ -951,9 +927,7 @@ BOOL gui_LoadIconRes(HDC hdc, const char* rdr_name, char* file);
|
||||
void gui_WndRect(HWND hWnd, PRECT prc);
|
||||
void gui_WndClientRect(HWND hWnd, PRECT prc);
|
||||
|
||||
/* Undisclosed APIs */
|
||||
HDC CreateMemDCFromSurface (struct GAL_Surface* surface);
|
||||
struct GAL_Surface* GetSurfaceFromDC (HDC hdc);
|
||||
HDC __mg_create_memdc_for_surface (struct GAL_Surface* surface);
|
||||
|
||||
/* Since 5.0.0 */
|
||||
#ifdef _MGRM_PROCESSES
|
||||
|
||||
+14
-2
@@ -83,6 +83,11 @@ static inline int comp_key_string (const void *key1, const void *key2)
|
||||
return strcmp (key1, key2);
|
||||
}
|
||||
|
||||
static inline void free_val_alloc (void *val)
|
||||
{
|
||||
free (val);
|
||||
}
|
||||
|
||||
typedef struct _map_t map_t;
|
||||
typedef struct _map_entry_t {
|
||||
struct rb_node node;
|
||||
@@ -100,8 +105,15 @@ int __mg_map_get_size (map_t* map);
|
||||
|
||||
map_entry_t* __mg_map_find (map_t* map, const void* key);
|
||||
|
||||
int __mg_map_insert_ex (map_t* map, const void* key,
|
||||
map_entry_t* __mg_map_insert_ex2 (map_t* map, const void* key,
|
||||
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,
|
||||
const void* val)
|
||||
{
|
||||
@@ -114,7 +126,7 @@ int __mg_map_find_replace_or_insert (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);
|
||||
|
||||
int __mg_map_erase (map_t* map, void* key);
|
||||
int __mg_map_erase (map_t* map, const void* key);
|
||||
int __mg_map_get_size (map_t* map);
|
||||
|
||||
#if 0 /* deprecated code */
|
||||
|
||||
+7
-1
@@ -79,6 +79,11 @@ struct timezone {
|
||||
extern "C" {
|
||||
#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);
|
||||
void __mg_os_time_delay (int ms);
|
||||
void __mg_os_start_time (void);
|
||||
@@ -115,10 +120,11 @@ void mg_TerminateMisc (void);
|
||||
BOOL mg_InitSystemRes (void);
|
||||
void mg_TerminateSystemRes (void);
|
||||
|
||||
/* Deprecated since 5.2.0
|
||||
#ifdef _MGSCHEMA_COMPOSITING
|
||||
int __mg_alloc_sem_for_shared_surf (void);
|
||||
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);
|
||||
|
||||
|
||||
@@ -396,10 +396,10 @@ char * __mg_msgstr3 [] =
|
||||
"MSG_SRVNOTIFY", // 0x0147
|
||||
"MSG_UPDATECLIWIN", // 0x0148
|
||||
"MSG_LAYERCHANGED", // 0x0149
|
||||
"MSG_MANAGE_MSGTHREAD", // 0x014A
|
||||
"MSG_CALC_POSITION", // 0x014B
|
||||
"", // 0x014C
|
||||
"", // 0x014D
|
||||
"MSG_WINCOMPOSITED", // 0x014A
|
||||
"MSG_MANAGE_MSGTHREAD", // 0x014B
|
||||
"MSG_CALC_POSITION", // 0x014C
|
||||
"MSG_WAKEUP_CLIENT", // 0x014D
|
||||
"", // 0x014E
|
||||
"", // 0x014F
|
||||
|
||||
|
||||
+41
-26
@@ -55,9 +55,9 @@
|
||||
#ifndef GUI_NEWGAL_H
|
||||
#define GUI_NEWGAL_H
|
||||
|
||||
#include "minigui.h"
|
||||
#include "gdi.h"
|
||||
#include "constants.h"
|
||||
#include "blockheap.h"
|
||||
|
||||
#if IS_COMPOSITING_SCHEMA
|
||||
#include <sys/types.h>
|
||||
@@ -117,8 +117,10 @@ void GAL_FreeFormat(GAL_PixelFormat *format);
|
||||
|
||||
/* typedef for private surface blitting functions */
|
||||
struct GAL_Surface;
|
||||
typedef int (*GAL_blit)(struct GAL_Surface *src, GAL_Rect *srcrect,
|
||||
struct GAL_Surface *dst, GAL_Rect *dstrect);
|
||||
|
||||
typedef int (*GAL_blit)(GAL_VideoDevice *video,
|
||||
struct GAL_Surface *src, GAL_Rect *srcrect,
|
||||
struct GAL_Surface *dst, GAL_Rect *dstrect);
|
||||
|
||||
#if IS_COMPOSITING_SCHEMA
|
||||
typedef struct _DirtyInfo {
|
||||
@@ -137,20 +139,25 @@ typedef struct _DirtyInfo {
|
||||
* than the creator.
|
||||
*/
|
||||
typedef struct _SharedSurfaceHeader {
|
||||
/* The number of semphore for this surface.
|
||||
The SysV semaphore set id for synchronizing this shared surface:
|
||||
SHAREDRES_SEMID_SHARED_SURF. */
|
||||
int sem_num;
|
||||
/* the name of the shared surface; since 5.2.0. */
|
||||
char name[NAME_MAX + 1];
|
||||
|
||||
/* The pid of the creator */
|
||||
pid_t creator;
|
||||
/* The client identifier of the creator. */
|
||||
int create_cli;
|
||||
|
||||
/* The file descriptor in context of the creator. */
|
||||
int fd;
|
||||
/* Not zero for hardware surface. */
|
||||
int byhw;
|
||||
/* The dirty information */
|
||||
GAL_DirtyInfo dirty_info;
|
||||
|
||||
/* Deprecated since 5.2.0.
|
||||
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 */
|
||||
int width, height;
|
||||
/* the pitch of the surface */
|
||||
@@ -164,6 +171,9 @@ typedef struct _SharedSurfaceHeader {
|
||||
size_t map_size;
|
||||
/* the offset of pixels data */
|
||||
off_t pixels_off;
|
||||
|
||||
/* The dirty information */
|
||||
GAL_DirtyInfo dirty_info;
|
||||
} GAL_SharedSurfaceHeader;
|
||||
#endif /* IS_COMPOSITING_SCHEMA */
|
||||
|
||||
@@ -228,6 +238,8 @@ typedef struct GAL_Surface {
|
||||
GAL_SharedSurfaceHeader *shared_header; /* Private */
|
||||
/* The dirty info for non-shared surface. */
|
||||
GAL_DirtyInfo *dirty_info; /* Private */
|
||||
/* The file descriptor if the surface is a shared surface. */
|
||||
int fd; /* Private; since 5.2.0. */
|
||||
#endif
|
||||
} GAL_Surface;
|
||||
|
||||
@@ -250,6 +262,8 @@ typedef struct GAL_Surface {
|
||||
|
||||
#define GAL_PREALLOC 0x01000000 /* Surface uses preallocated memory */
|
||||
#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() */
|
||||
#define GAL_ANYFORMAT 0x10000000 /* Allow any video depth/pixel-format */
|
||||
@@ -569,6 +583,11 @@ GAL_Surface *GAL_CreateRGBSurface
|
||||
GAL_Surface *GAL_CreateRGBSurfaceFrom (void *pixels,
|
||||
int width, int height, int depth, int pitch,
|
||||
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);
|
||||
|
||||
typedef struct REQ_HWSURFACE {
|
||||
@@ -649,11 +668,11 @@ GAL_Surface *GAL_CreateSurfaceForZNodeAs (const GAL_Surface* ref_surf,
|
||||
void GAL_FreeSharedSurfaceData (GAL_Surface *surface);
|
||||
|
||||
/* Attach to a shared RGB surface. */
|
||||
GAL_Surface *GAL_AttachSharedRGBSurface (int fd, size_t map_size,
|
||||
Uint32 flags, BOOL with_wr);
|
||||
GAL_Surface *GAL_AttachSharedRGBSurface (GAL_VideoDevice* video,
|
||||
int fd, size_t map_size, Uint32 flags, BOOL with_wr);
|
||||
|
||||
/* Dettach from a shared RGB surface from the specific video device. */
|
||||
void GAL_DettachSharedSurfaceData (GAL_Surface *surface);
|
||||
/* Detach from a shared RGB surface from the specific video device. */
|
||||
void GAL_DetachSharedSurfaceData (GAL_Surface *surface);
|
||||
|
||||
/* Create a cursor surface from the specific video device. */
|
||||
GAL_Surface* GAL_CreateCursorSurface (GAL_VideoDevice* video,
|
||||
@@ -670,7 +689,6 @@ void GAL_MoveCursor (GAL_Surface* surface, int x, int y);
|
||||
|
||||
#endif /* defined _MGSCHEMA_COMPOSITING */
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* GAL_LockSurface() sets up a surface for directly accessing the pixels.
|
||||
* Between calls to GAL_LockSurface()/GAL_UnlockSurface(), you can write
|
||||
@@ -680,9 +698,7 @@ void GAL_MoveCursor (GAL_Surface* surface, int x, int y);
|
||||
*
|
||||
* 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
|
||||
* 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.
|
||||
* pixel format of the surface will not change.
|
||||
*
|
||||
* No operating system or library calls should be made between lock/unlock
|
||||
* pairs, as critical system locks may be held during this time.
|
||||
@@ -691,7 +707,6 @@ void GAL_MoveCursor (GAL_Surface* surface, int x, int y);
|
||||
*/
|
||||
int GAL_LockSurface (GAL_Surface *surface);
|
||||
void GAL_UnlockSurface (GAL_Surface *surface);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Set the color key (transparent pixel) in a blittable surface.
|
||||
@@ -735,10 +750,10 @@ GAL_bool GAL_IntersectRect (const GAL_Rect *A, const GAL_Rect *B,
|
||||
Bmin = B->x;
|
||||
Bmax = Bmin + B->w;
|
||||
if (Bmin > Amin)
|
||||
Amin = Bmin;
|
||||
Amin = Bmin;
|
||||
intersection->x = Amin;
|
||||
if (Bmax < Amax)
|
||||
Amax = Bmax;
|
||||
Amax = Bmax;
|
||||
intersection->w = Amax - Amin > 0 ? Amax - Amin : 0;
|
||||
|
||||
/* Vertical intersection */
|
||||
@@ -747,10 +762,10 @@ GAL_bool GAL_IntersectRect (const GAL_Rect *A, const GAL_Rect *B,
|
||||
Bmin = B->y;
|
||||
Bmax = Bmin + B->h;
|
||||
if (Bmin > Amin)
|
||||
Amin = Bmin;
|
||||
Amin = Bmin;
|
||||
intersection->y = Amin;
|
||||
if (Bmax < Amax)
|
||||
Amax = Bmax;
|
||||
Amax = Bmax;
|
||||
intersection->h = Amax - Amin > 0 ? Amax - Amin : 0;
|
||||
|
||||
return (intersection->w && intersection->h);
|
||||
|
||||
@@ -73,6 +73,8 @@
|
||||
|
||||
#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
|
||||
/* union semun is defined by including <sys/sem.h> */
|
||||
#elif defined(__DARWIN__)
|
||||
/* union semun is defined by including <sys/sem.h> */
|
||||
#else
|
||||
/* according to X/OPEN we have to define it ourselves */
|
||||
union semun {
|
||||
|
||||
@@ -132,6 +132,13 @@ void __mg_client_del (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);
|
||||
|
||||
int __mg_handle_request (int clifd, int req_id, int cli);
|
||||
@@ -150,6 +157,7 @@ int __mg_remove_all_znodes_of_client (int cli);
|
||||
|
||||
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);
|
||||
ZORDERNODE *__mg_find_znode_by_client_hwnd (int cli, HWND hwnd);
|
||||
|
||||
int __mg_do_reghook_operation (int cli, const REGHOOKINFO* info);
|
||||
int __mg_handle_mouse_hook (int message, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
@@ -112,7 +112,7 @@ typedef struct tagG_RES {
|
||||
|
||||
int nr_layers;
|
||||
int semid_layer;
|
||||
#ifdef _MGSCHEMA_COMPOSITING
|
||||
#if 0 && defined(_MGSCHEMA_COMPOSITING) // deprecated since 5.2.0
|
||||
int semid_shared_surf; /* the id of semaphore set for shared surfaces */
|
||||
#endif
|
||||
|
||||
@@ -208,7 +208,7 @@ typedef G_RES* PG_RES;
|
||||
#define SHAREDRES_NR_LAYSERS (((PG_RES)mgSharedRes)->nr_layers)
|
||||
#define SHAREDRES_SEMID_LAYER (((PG_RES)mgSharedRes)->semid_layer)
|
||||
|
||||
#ifdef _MGSCHEMA_COMPOSITING
|
||||
#if 0 && defined(_MGSCHEMA_COMPOSITING) // Deprecated since 5.2.0
|
||||
# define SHAREDRES_SEMID_SHARED_SURF (((PG_RES)mgSharedRes)->semid_shared_surf)
|
||||
#endif
|
||||
|
||||
|
||||
+1
-1
@@ -74,7 +74,7 @@ typedef struct _MSGQUEUE MSGQUEUE;
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void __mg_update_tick_count (void* data);
|
||||
DWORD __mg_update_tick_count (MSGQUEUE* msg_queue);
|
||||
int __mg_check_expired_timers (MSGQUEUE* msg_queue, DWORD inter);
|
||||
void __mg_remove_timers_by_msg_queue (MSGQUEUE* msg_queue);
|
||||
void __mg_remove_timer (MSGQUEUE* msg_queue, int slot);
|
||||
|
||||
@@ -141,11 +141,17 @@ typedef struct _ZORDERINFO {
|
||||
/* The size of usage bitmap for mask rect. */
|
||||
int size_maskrect_usage_bmp;
|
||||
|
||||
/* use read/write lock for Unix-like OS */
|
||||
#ifndef __NOUNIX__
|
||||
#define __ZI_USE_RWLOCK 1
|
||||
#endif
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
# ifndef __NOUNIX__
|
||||
# ifdef __ZI_USE_RWLOCK
|
||||
pthread_rwlock_t rwlock;
|
||||
pthread_t rwlock_owner;
|
||||
# else
|
||||
pthread_mutex_t rwlock;
|
||||
pthread_mutex_t mutex;
|
||||
# endif
|
||||
#elif defined(_MGRM_PROCESSES)
|
||||
int zi_semid;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# also for makefile.ng and makefile.msvc
|
||||
AM_CPPFLAGS = -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include
|
||||
AM_CFLAGS = -Wno-zero-length-bounds
|
||||
|
||||
noinst_LTLIBRARIES = libkernel.la
|
||||
|
||||
|
||||
@@ -59,13 +59,13 @@
|
||||
#include "common.h"
|
||||
#include "minigui.h"
|
||||
#include "gdi.h"
|
||||
#include "window.h"
|
||||
#include "constants.h"
|
||||
#include "blockheap.h"
|
||||
#include "misc.h"
|
||||
|
||||
BOOL InitBlockDataHeap (PBLOCKHEAP heap, size_t sz_block, size_t sz_heap)
|
||||
{
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_init (&heap->lock, NULL);
|
||||
#endif
|
||||
|
||||
@@ -99,7 +99,7 @@ void* BlockDataAlloc (PBLOCKHEAP heap)
|
||||
int free_slot;
|
||||
unsigned char* block_data = NULL;
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_lock (&heap->lock);
|
||||
#endif
|
||||
|
||||
@@ -118,7 +118,7 @@ void* BlockDataAlloc (PBLOCKHEAP heap)
|
||||
|
||||
ret:
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_unlock (&heap->lock);
|
||||
#endif
|
||||
return block_data;
|
||||
@@ -128,7 +128,7 @@ void BlockDataFree (PBLOCKHEAP heap, void* data)
|
||||
{
|
||||
unsigned char* block_data = data;
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_lock (&heap->lock);
|
||||
#endif
|
||||
|
||||
@@ -146,7 +146,7 @@ void BlockDataFree (PBLOCKHEAP heap, void* data)
|
||||
heap, slot);
|
||||
}
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_unlock (&heap->lock);
|
||||
#endif
|
||||
}
|
||||
@@ -193,7 +193,7 @@ void DestroyBlockDataHeap (PBLOCKHEAP heap)
|
||||
free (heap->usage_bmp);
|
||||
heap->usage_bmp = NULL;
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_destroy (&heap->lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -228,6 +228,7 @@ static void composite_wallpaper_rect (CompositorCtxt* ctxt,
|
||||
}
|
||||
}
|
||||
else {
|
||||
SelectClipRect (HDC_SCREEN_SYS, dirty_rc);
|
||||
SetBrushColor (HDC_SCREEN_SYS,
|
||||
GetWindowElementPixelEx (HWND_DESKTOP, HDC_SCREEN_SYS,
|
||||
WE_BGC_DESKTOP));
|
||||
@@ -678,6 +679,19 @@ static BOOL merge_dirty_ppp (CompositorCtxt* ctxt, MG_Layer* layer, int zidx)
|
||||
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)
|
||||
{
|
||||
BOOL rc = FALSE;
|
||||
@@ -721,9 +735,13 @@ static BOOL merge_dirty_wpp (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. */
|
||||
if (layer != mgTopmostLayer || IsEmptyClipRgn (&ctxt->dirty_rgn))
|
||||
if (layer != mgTopmostLayer)
|
||||
return FALSE;
|
||||
|
||||
if (IsEmptyClipRgn (&ctxt->dirty_rgn)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (ctxt->highest_dirty_ppp >= 0) {
|
||||
composite_ppp_znodes (ctxt);
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2021, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@@ -56,7 +56,6 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define _DEBUG
|
||||
#include "common.h"
|
||||
|
||||
#if defined(_MGRM_PROCESSES) && defined(_MGSCHEMA_COMPOSITING)
|
||||
@@ -69,6 +68,7 @@
|
||||
#include "constants.h"
|
||||
#include "zorder.h"
|
||||
#include "dc.h"
|
||||
#include "server.h"
|
||||
|
||||
#define MAX_NR_COMPOSITORS 8
|
||||
#define LEN_COMPOSITOR_NAME 15
|
||||
@@ -133,31 +133,51 @@ static void lock_znode_surface (PDC pdc, ZORDERNODE* node)
|
||||
{
|
||||
if (node->lock_count == 0) {
|
||||
if (pdc->surface->shared_header) {
|
||||
LOCK_SURFACE_SEM (pdc->surface->shared_header->sem_num);
|
||||
__mg_lock_file_for_read(pdc->surface->fd);
|
||||
}
|
||||
|
||||
node->dirty_age = pdc->surface->dirty_info->dirty_age;
|
||||
node->nr_dirty_rcs = pdc->surface->dirty_info->nr_dirty_rcs;
|
||||
node->dirty_rcs = pdc->surface->dirty_info->dirty_rcs;
|
||||
|
||||
}
|
||||
|
||||
node->lock_count++;
|
||||
}
|
||||
|
||||
static void unlock_znode_surface (PDC pdc, ZORDERNODE* node)
|
||||
static BOOL unlock_znode_surface (PDC pdc, ZORDERNODE* node)
|
||||
{
|
||||
BOOL need_reset = FALSE;
|
||||
if (node->lock_count > 0) {
|
||||
node->lock_count--;
|
||||
if (node->lock_count == 0) {
|
||||
if (pdc->surface->shared_header)
|
||||
UNLOCK_SURFACE_SEM (pdc->surface->shared_header->sem_num);
|
||||
if (node->changes != pdc->surface->dirty_info->dirty_age) {
|
||||
node->changes = pdc->surface->dirty_info->dirty_age;
|
||||
need_reset = TRUE;
|
||||
}
|
||||
|
||||
if (pdc->surface->shared_header) {
|
||||
__mg_unlock_file_for_read(pdc->surface->fd);
|
||||
}
|
||||
|
||||
node->dirty_age = 0;
|
||||
node->nr_dirty_rcs = 0;
|
||||
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 */
|
||||
@@ -322,10 +342,8 @@ static void composite_layer (MG_Layer* layer, CompositorCtxt* ctxt,
|
||||
nodes = GET_MENUNODE(zi);
|
||||
for (i = 0; i < zi->nr_popupmenus; i++) {
|
||||
pdc = dc_HDC2PDC (nodes[i].mem_dc);
|
||||
|
||||
nodes[i].changes = pdc->surface->dirty_info->dirty_age;
|
||||
pdc->surface->dirty_info->nr_dirty_rcs = 0;
|
||||
unlock_znode_surface (pdc, nodes + i);
|
||||
if (unlock_znode_surface (pdc, nodes + i))
|
||||
reset_znode_surface_dirty (pdc, nodes + i, i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,9 +353,8 @@ static void composite_layer (MG_Layer* layer, CompositorCtxt* ctxt,
|
||||
while ((next = __kernel_get_next_znode (zi, next)) > 0) {
|
||||
if (nodes [next].flags & ZOF_VISIBLE) {
|
||||
pdc = dc_HDC2PDC (nodes[next].mem_dc);
|
||||
nodes[next].changes = pdc->surface->dirty_info->dirty_age;
|
||||
pdc->surface->dirty_info->nr_dirty_rcs = 0;
|
||||
unlock_znode_surface (pdc, nodes + next);
|
||||
if (unlock_znode_surface (pdc, nodes + next))
|
||||
reset_znode_surface_dirty (pdc, nodes + next, next);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,9 +363,8 @@ static void composite_layer (MG_Layer* layer, CompositorCtxt* ctxt,
|
||||
if (layer == mgTopmostLayer) {
|
||||
pdc = dc_HDC2PDC (HDC_SCREEN);
|
||||
if (pdc->surface->w > 0 && pdc->surface->h > 0) {
|
||||
nodes[0].changes = pdc->surface->dirty_info->dirty_age;
|
||||
pdc->surface->dirty_info->nr_dirty_rcs = 0;
|
||||
unlock_znode_surface (pdc, nodes);
|
||||
if (unlock_znode_surface (pdc, nodes))
|
||||
reset_znode_surface_dirty (pdc, nodes, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -489,7 +505,7 @@ const CompositorOps* GUIAPI ServerGetCompositorOps (const char* name)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < MAX_NR_COMPOSITORS; i++) {
|
||||
if (compositors [i].name && strcmp (compositors [i].name, name) == 0) {
|
||||
if (strcmp (compositors [i].name, name) == 0) {
|
||||
return compositors [i].ops;
|
||||
}
|
||||
}
|
||||
|
||||
+36
-14
@@ -1081,6 +1081,12 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
|
||||
const RECT* prc;
|
||||
|
||||
prc = &cur_pdc->rc_output;
|
||||
|
||||
/* Since 5.0.13 */
|
||||
if (!fShow) {
|
||||
GAL_LockSurface(cur_pdc->surface);
|
||||
}
|
||||
|
||||
if (cur_pdc->surface != __gal_screen) {
|
||||
if (fShow) {
|
||||
GAL_UpdateRect (cur_pdc->surface,
|
||||
@@ -1090,7 +1096,7 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
|
||||
}
|
||||
else {
|
||||
if (!mgIsServer && (SHAREDRES_TOPMOST_LAYER != __mg_layer)) {
|
||||
return;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!fShow) {
|
||||
@@ -1109,6 +1115,12 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
|
||||
UNLOCK_CURSOR_SEM ();
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
/* Since 5.0.13 */
|
||||
if (fShow) {
|
||||
GAL_UnlockSurface(cur_pdc->surface);
|
||||
}
|
||||
}
|
||||
|
||||
#else /* defined _MGSCHEMA_SHAREDFB */
|
||||
@@ -1124,6 +1136,12 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
|
||||
}
|
||||
|
||||
prc = &cur_pdc->rc_output;
|
||||
|
||||
/* Since 5.0.13 */
|
||||
if (!fShow) {
|
||||
GAL_LockSurface(cur_pdc->surface);
|
||||
}
|
||||
|
||||
if (cur_pdc->surface == __gal_screen) {
|
||||
// Under compositing schema, we never call SyncUpdate in
|
||||
// kernel_ShowCursorForGDI for __gal_screen.
|
||||
@@ -1150,6 +1168,11 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
|
||||
// For surface other than screen, we call SyncUpdate.
|
||||
GAL_SyncUpdate (cur_pdc->surface);
|
||||
}
|
||||
|
||||
/* Since 5.0.13 */
|
||||
if (fShow) {
|
||||
GAL_UnlockSurface(cur_pdc->surface);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* not defined _MGSCHEMA_SHAREDFB */
|
||||
@@ -1228,26 +1251,25 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
|
||||
PDC cur_pdc = (PDC)pdc;
|
||||
const RECT* prc = NULL;
|
||||
|
||||
prc = &cur_pdc->rc_output;
|
||||
|
||||
/* houhh20080827, if --disable-cursor, mginit can not update auto(qvfb). */
|
||||
#if 0
|
||||
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;
|
||||
}
|
||||
|
||||
prc = &cur_pdc->rc_output;
|
||||
|
||||
/* Since 5.0.13 */
|
||||
if (!fShow) {
|
||||
GAL_LockSurface(cur_pdc->surface);
|
||||
}
|
||||
|
||||
if (fShow)
|
||||
GAL_UpdateRect (cur_pdc->surface,
|
||||
prc->left, prc->top, RECTWP(prc), RECTHP(prc));
|
||||
#endif
|
||||
|
||||
/* Since 5.0.13 */
|
||||
if (fShow) {
|
||||
GAL_UnlockSurface(cur_pdc->surface);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _MGHAVE_CURSOR */
|
||||
|
||||
+20
-2
@@ -448,6 +448,11 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
|
||||
|
||||
prc = &cur_pdc->rc_output;
|
||||
|
||||
/* Since 5.0.13 */
|
||||
if (!fShow) {
|
||||
GAL_LockSurface(cur_pdc->surface);
|
||||
}
|
||||
|
||||
if (cur_pdc->surface != __gal_screen) {
|
||||
if (fShow) {
|
||||
GAL_UpdateRect (cur_pdc->surface,
|
||||
@@ -472,7 +477,7 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
|
||||
prc->left, prc->top, RECTWP(prc), RECTHP(prc));
|
||||
//GAL_SyncUpdate (cur_pdc->surface);
|
||||
}
|
||||
return;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (fShow && nShowCount >= 0 && pCurCsr) {
|
||||
@@ -488,6 +493,12 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
|
||||
//GAL_SyncUpdate (cur_pdc->surface);
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
/* Since 5.0.13 */
|
||||
if (fShow) {
|
||||
GAL_UnlockSurface(cur_pdc->surface);
|
||||
}
|
||||
}
|
||||
|
||||
int GUIAPI ShowCursor (BOOL fShow)
|
||||
@@ -516,9 +527,16 @@ void kernel_ShowCursorForGDI(BOOL fShow, void* pdc)
|
||||
|
||||
prc = &cur_pdc->rc_output;
|
||||
|
||||
if (fShow)
|
||||
/* Since 5.0.13 */
|
||||
if (!fShow) {
|
||||
GAL_LockSurface(cur_pdc->surface);
|
||||
}
|
||||
else {
|
||||
GAL_UpdateRect (cur_pdc->surface,
|
||||
prc->left, prc->top, RECTWP(prc), RECTHP(prc));
|
||||
/* Since 5.0.13 */
|
||||
GAL_UnlockSurface(cur_pdc->surface);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _MGHAVE_CURSOR */
|
||||
|
||||
+22
-4
@@ -472,11 +472,15 @@ void kernel_ShowCursorForGDI (BOOL fShow, void *pdc)
|
||||
|
||||
prc = &cur_pdc->rc_output;
|
||||
|
||||
/* Since 5.0.13 */
|
||||
if (!fShow) {
|
||||
GAL_LockSurface(cur_pdc->surface);
|
||||
}
|
||||
|
||||
if (cur_pdc->surface != __gal_screen) {
|
||||
if (fShow) {
|
||||
GAL_UpdateRect (cur_pdc->surface,
|
||||
GAL_UpdateRect(cur_pdc->surface,
|
||||
prc->left, prc->top, RECTWP(prc), RECTHP(prc));
|
||||
// GAL_SyncUpdate (cur_pdc->surface);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -500,7 +504,7 @@ void kernel_ShowCursorForGDI (BOOL fShow, void *pdc)
|
||||
pthread_mutex_unlock(&__mg_mouselock);
|
||||
// GAL_SyncUpdate (cur_pdc->surface);
|
||||
}
|
||||
return;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (fShow && nShowCount >= 0 && pCurCsr) {
|
||||
@@ -518,6 +522,12 @@ void kernel_ShowCursorForGDI (BOOL fShow, void *pdc)
|
||||
// GAL_SyncUpdate (cur_pdc->surface);
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
/* Since 5.0.13 */
|
||||
if (fShow) {
|
||||
GAL_UnlockSurface(cur_pdc->surface);
|
||||
}
|
||||
}
|
||||
|
||||
int GUIAPI ShowCursor(BOOL fShow)
|
||||
@@ -558,9 +568,17 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
|
||||
|
||||
prc = &cur_pdc->rc_output;
|
||||
|
||||
if (fShow)
|
||||
/* Since 5.0.13 */
|
||||
if (!fShow) {
|
||||
GAL_LockSurface(cur_pdc->surface);
|
||||
}
|
||||
else {
|
||||
GAL_UpdateRect (cur_pdc->surface,
|
||||
prc->left, prc->top, RECTWP(prc), RECTHP(prc));
|
||||
|
||||
/* Since 5.0.13 */
|
||||
GAL_UnlockSurface(cur_pdc->surface);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _MGHAVE_CURSOR */
|
||||
|
||||
@@ -232,7 +232,7 @@ static int dskAddNewMainWindow (PMAINWIN pWin)
|
||||
|
||||
if (pWin->secondaryDC == HDC_INVALID) {
|
||||
/* remove the flag of WS_EX_AUTOSECONDARYDC */
|
||||
pWin->dwExStyle = pWin->dwExStyle | WS_EX_AUTOSECONDARYDC;
|
||||
pWin->dwExStyle &= ~WS_EX_AUTOSECONDARYDC;
|
||||
pWin->secondaryDC = 0;
|
||||
|
||||
}
|
||||
@@ -1429,6 +1429,8 @@ static LRESULT WindowMessageHandler(UINT message, PMAINWIN pWin, LPARAM lParam)
|
||||
/* Since 5.0.0 */
|
||||
case MSG_SETAUTOREPEAT:
|
||||
sg_msgAutoRepeat = *(const MSG*)lParam;
|
||||
/* start auto-repeat after 300ms */
|
||||
sg_msgAutoRepeat.time = __mg_tick_counter + (__mg_timeout_usec/10000);
|
||||
break;
|
||||
|
||||
/* Since 5.0.0 */
|
||||
@@ -1743,11 +1745,6 @@ static int dskOnRemoveCtrlInstance (PCONTROL pParent, PCONTROL pCtrl)
|
||||
FreeZOrderNode (0, pCtrl->idx_znode, NULL);
|
||||
}
|
||||
|
||||
if (fFound) {
|
||||
pCtrl->pcci->nUseCount --;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((HWND)pCtrl == __mg_captured_wnd) {
|
||||
/* force release the capture */
|
||||
__mg_captured_wnd = 0;
|
||||
@@ -1762,6 +1759,11 @@ static int dskOnRemoveCtrlInstance (PCONTROL pParent, PCONTROL pCtrl)
|
||||
sg_msgAutoRepeat.hwnd = 0;
|
||||
}
|
||||
|
||||
if (fFound) {
|
||||
pCtrl->pcci->nUseCount--;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1873,9 +1875,12 @@ static void dskOnTimeout (void)
|
||||
static DWORD uCounter = 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,
|
||||
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))
|
||||
|
||||
+77
-31
File diff suppressed because it is too large
Load Diff
@@ -74,6 +74,7 @@
|
||||
#include "dc.h"
|
||||
#include "misc.h"
|
||||
#include "devfont.h"
|
||||
#include "event.h"
|
||||
|
||||
#ifndef WIN32
|
||||
#include <sys/termios.h>
|
||||
@@ -102,14 +103,6 @@ BOOL mg_InitDesktop (void)
|
||||
int ret;
|
||||
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.
|
||||
*/
|
||||
@@ -153,7 +146,7 @@ BOOL mg_InitDesktop (void)
|
||||
void mg_TerminateDesktop (void)
|
||||
{
|
||||
if (__mg_dsk_msg_queue) {
|
||||
mg_FreeMsgQueueForThisThread ();
|
||||
mg_FreeMsgQueueForThisThread (TRUE);
|
||||
__mg_dsk_msg_queue = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
@@ -72,6 +73,7 @@
|
||||
#include "dc.h"
|
||||
#include "misc.h"
|
||||
#include "devfont.h"
|
||||
#include "event.h"
|
||||
|
||||
/******************************* global data *********************************/
|
||||
/* pointer to desktop message queue */
|
||||
@@ -140,19 +142,47 @@ BOOL mg_InitDesktop (void)
|
||||
|
||||
#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)
|
||||
{
|
||||
MSG Msg;
|
||||
|
||||
/* init message queue of desktop thread */
|
||||
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread ()) ) {
|
||||
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread (TRUE)) ) {
|
||||
_ERR_PRINTF ("failed to allocate message queue\n");
|
||||
sem_post ((sem_t*)data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* for threads mode, the idle handler for desktop thread is NULL */
|
||||
__mg_dsk_msg_queue->OnIdle = NULL;
|
||||
/* For bug reported in Issue #116, under threads mode, the idle handler
|
||||
for the desktop thread should call __mg_update_tick_count () */
|
||||
__mg_dsk_msg_queue->OnIdle = idle_handler_for_desktop_thread;
|
||||
|
||||
/* init desktop window */
|
||||
init_desktop_win ();
|
||||
@@ -191,7 +221,7 @@ void* __kernel_desktop_main (void* data)
|
||||
#endif
|
||||
}
|
||||
|
||||
mg_FreeMsgQueueForThisThread ();
|
||||
mg_FreeMsgQueueForThisThread (TRUE);
|
||||
__mg_dsk_msg_queue = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+46
-29
@@ -15,7 +15,7 @@
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@@ -597,55 +597,63 @@ static void reset_window (PMAINWIN pWin, RECT* rcWin)
|
||||
#endif
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifndef __NOUNIX__
|
||||
/*for unix system, using read/write lock*/
|
||||
static inline void lock_zi_for_change (const ZORDERINFO* zi)
|
||||
# ifdef __ZI_USE_RWLOCK
|
||||
static inline void lock_zi_for_change (ZORDERINFO* zi)
|
||||
{
|
||||
pthread_rwlock_wrlock(&((ZORDERINFO*)zi)->rwlock);
|
||||
pthread_rwlock_wrlock(&zi->rwlock);
|
||||
zi->rwlock_owner = pthread_self();
|
||||
}
|
||||
|
||||
static inline void unlock_zi_for_change (const ZORDERINFO* zi)
|
||||
static inline void unlock_zi_for_change (ZORDERINFO* zi)
|
||||
{
|
||||
pthread_rwlock_unlock(&((ZORDERINFO*)zi)->rwlock);
|
||||
pthread_rwlock_unlock(&zi->rwlock);
|
||||
zi->rwlock_owner = 0;
|
||||
}
|
||||
|
||||
static inline void lock_zi_for_read (const ZORDERINFO* zi)
|
||||
static inline void lock_zi_for_read (ZORDERINFO* zi)
|
||||
{
|
||||
pthread_rwlock_rdlock(&((ZORDERINFO*)zi)->rwlock);
|
||||
if (zi->rwlock_owner == pthread_self()) {
|
||||
return;
|
||||
}
|
||||
|
||||
pthread_rwlock_rdlock(&zi->rwlock);
|
||||
}
|
||||
|
||||
static inline void unlock_zi_for_read (const ZORDERINFO* zi)
|
||||
static inline void unlock_zi_for_read (ZORDERINFO* zi)
|
||||
{
|
||||
pthread_rwlock_unlock(&((ZORDERINFO*)zi)->rwlock);
|
||||
if (zi->rwlock_owner == pthread_self()) {
|
||||
return;
|
||||
}
|
||||
|
||||
pthread_rwlock_unlock(&zi->rwlock);
|
||||
}
|
||||
#else /* __NOUNIX__ */
|
||||
/*for non-unix system, using mutex*/
|
||||
static inline void lock_zi_for_change (const ZORDERINFO* zi)
|
||||
# else /* __ZI_USE_RWLOCK */
|
||||
static inline void lock_zi_for_change (ZORDERINFO* zi)
|
||||
{
|
||||
pthread_mutex_lock(&((ZORDERINFO*)zi)->rwlock);
|
||||
pthread_mutex_lock(&zi->mutex);
|
||||
}
|
||||
|
||||
static inline void unlock_zi_for_change (const ZORDERINFO* zi)
|
||||
static inline void unlock_zi_for_change (ZORDERINFO* zi)
|
||||
{
|
||||
pthread_mutex_unlock(&((ZORDERINFO*)zi)->rwlock);
|
||||
pthread_mutex_unlock(&zi->mutex);
|
||||
}
|
||||
|
||||
static inline void lock_zi_for_read (const ZORDERINFO* zi)
|
||||
static inline void lock_zi_for_read (ZORDERINFO* zi)
|
||||
{
|
||||
pthread_mutex_lock(&((ZORDERINFO*)zi)->rwlock);
|
||||
pthread_mutex_lock(&zi->mutex);
|
||||
}
|
||||
|
||||
static inline void unlock_zi_for_read (const ZORDERINFO* zi)
|
||||
static inline void unlock_zi_for_read (ZORDERINFO* zi)
|
||||
{
|
||||
pthread_mutex_unlock(&((ZORDERINFO*)zi)->rwlock);
|
||||
pthread_mutex_unlock(&zi->mutex);
|
||||
}
|
||||
#endif /* __NOUNIX__ */
|
||||
# endif /* notdef __ZI_USE_RWLOCK */
|
||||
|
||||
#elif defined(_MGRM_STANDALONE)
|
||||
static inline void lock_zi_for_change (const ZORDERINFO* zi) { }
|
||||
static inline void unlock_zi_for_change (const ZORDERINFO* zi) { }
|
||||
static inline void lock_zi_for_read (const ZORDERINFO* zi) { }
|
||||
static inline void unlock_zi_for_read (const ZORDERINFO* zi) { }
|
||||
static inline void lock_zi_for_change (ZORDERINFO* zi) { }
|
||||
static inline void unlock_zi_for_change (ZORDERINFO* zi) { }
|
||||
static inline void lock_zi_for_read (ZORDERINFO* zi) { }
|
||||
static inline void unlock_zi_for_read (ZORDERINFO* zi) { }
|
||||
#else /* for procs */
|
||||
/* NULL. see desktop-procs.c */
|
||||
#endif /* _MGRM_THREADS */
|
||||
@@ -1595,8 +1603,10 @@ static int srvStartTrackPopupMenu (int cli, const RECT* rc, HWND ptmi,
|
||||
surf->refcount++;
|
||||
}
|
||||
else if (fd >= 0) {
|
||||
surf = GAL_AttachSharedRGBSurface (fd, surf_size, surf_flags, TRUE);
|
||||
close (fd);
|
||||
surf = GAL_AttachSharedRGBSurface (NULL, fd,
|
||||
surf_size, surf_flags, TRUE);
|
||||
/* Since 5.2.0: keep fd available.
|
||||
close (fd); */
|
||||
}
|
||||
else {
|
||||
_WRN_PRINTF("not server but fd for shared surface is invalid\n");
|
||||
@@ -1604,7 +1614,7 @@ static int srvStartTrackPopupMenu (int cli, const RECT* rc, HWND ptmi,
|
||||
}
|
||||
|
||||
if (surf) {
|
||||
memdc = CreateMemDCFromSurface (surf);
|
||||
memdc = __mg_create_memdc_for_surface (surf);
|
||||
if (memdc == HDC_INVALID) {
|
||||
GAL_FreeSurface (surf);
|
||||
_WRN_PRINTF("failed to create memory dc for znode\n");
|
||||
@@ -1638,11 +1648,14 @@ static int srvStartTrackPopupMenu (int cli, const RECT* rc, HWND ptmi,
|
||||
menu_nodes [zi->nr_popupmenus].flags = ZOF_TYPE_POPUPMENU;
|
||||
menu_nodes [zi->nr_popupmenus].rc = *rc;
|
||||
menu_nodes [zi->nr_popupmenus].hwnd = ptmi;
|
||||
menu_nodes [zi->nr_popupmenus].cli = 0;
|
||||
#ifdef _MGSCHEMA_COMPOSITING
|
||||
menu_nodes [zi->nr_popupmenus].changes = 0;
|
||||
menu_nodes [zi->nr_popupmenus].ct = CT_OPAQUE;
|
||||
menu_nodes [zi->nr_popupmenus].ct_arg = 0;
|
||||
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;
|
||||
#endif
|
||||
menu_nodes [zi->nr_popupmenus].priv_data = NULL;
|
||||
@@ -2348,6 +2361,8 @@ 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_arg = ct_arg;
|
||||
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;
|
||||
#else
|
||||
nodes [free_slot].age = 1;
|
||||
@@ -4499,7 +4514,9 @@ int __mg_join_all_message_threads (void)
|
||||
|
||||
list_for_each (l, &msg_queue_list) {
|
||||
MSGQUEUE *msg_queue = (MSGQUEUE*)l;
|
||||
#ifndef NDEBUG
|
||||
dump_message_queue (msg_queue, __func__);
|
||||
#endif
|
||||
pthread_cancel (msg_queue->th);
|
||||
}
|
||||
|
||||
|
||||
+14
-13
@@ -89,8 +89,9 @@
|
||||
|
||||
struct timeval __mg_event_timeout;
|
||||
|
||||
static DWORD timeoutusec;
|
||||
static DWORD repeatusec;
|
||||
DWORD __mg_timeout_usec;
|
||||
DWORD __mg_repeat_usec;
|
||||
|
||||
static DWORD dblclicktime;
|
||||
|
||||
#ifndef _MGRM_THREADS
|
||||
@@ -121,8 +122,8 @@ static void GetTimeout (void)
|
||||
char szValue [11];
|
||||
int mytimeoutusec, myrepeatusec;
|
||||
|
||||
timeoutusec = DEF_USEC_TIMEOUT;
|
||||
repeatusec = DEF_REPEAT_TIME;
|
||||
__mg_timeout_usec = DEF_USEC_TIMEOUT;
|
||||
__mg_repeat_usec = DEF_REPEAT_TIME;
|
||||
|
||||
if (GetMgEtcValue (EVENTPARA, EVENTPARA_REPEATUSEC, szValue, 10) < 0)
|
||||
return;
|
||||
@@ -133,8 +134,8 @@ static void GetTimeout (void)
|
||||
mytimeoutusec = atoi(szValue);
|
||||
|
||||
if (myrepeatusec >= 0 && mytimeoutusec > 0) {
|
||||
timeoutusec = mytimeoutusec;
|
||||
repeatusec = myrepeatusec;
|
||||
__mg_timeout_usec = mytimeoutusec;
|
||||
__mg_repeat_usec = myrepeatusec;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,7 +209,7 @@ static void ResetKeyEvent(void)
|
||||
IAL_SetLeds (slock | (numlock << 1) | (capslock << 2));
|
||||
|
||||
__mg_event_timeout.tv_sec = 0;
|
||||
__mg_event_timeout.tv_usec = timeoutusec;
|
||||
__mg_event_timeout.tv_usec = __mg_timeout_usec;
|
||||
|
||||
#ifndef _MGRM_THREADS
|
||||
#ifdef _MGRM_PROCESSES
|
||||
@@ -216,8 +217,8 @@ static void ResetKeyEvent(void)
|
||||
SHAREDRES_SHIFTSTATUS = status;
|
||||
#endif
|
||||
|
||||
timeout_threshold = timeoutusec / 10000;
|
||||
repeat_threshold = repeatusec / 10000;
|
||||
timeout_threshold = __mg_timeout_usec / 10000;
|
||||
repeat_threshold = __mg_repeat_usec / 10000;
|
||||
timeout_count = timeout_threshold;
|
||||
#endif
|
||||
}
|
||||
@@ -631,7 +632,7 @@ BOOL kernel_GetLWEvent (int event, PLWEVENT lwe)
|
||||
|
||||
// set repeat time
|
||||
__mg_event_timeout.tv_sec = 0;
|
||||
__mg_event_timeout.tv_usec = repeatusec;
|
||||
__mg_event_timeout.tv_usec = __mg_repeat_usec;
|
||||
|
||||
// repeat last event
|
||||
if (old_lwe.type == LWETYPE_KEY
|
||||
@@ -652,7 +653,7 @@ BOOL kernel_GetLWEvent (int event, PLWEVENT lwe)
|
||||
old_lwe.data.me.event == ME_MIDDLEDOWN))) {
|
||||
// reset delay time
|
||||
__mg_event_timeout.tv_sec = 0;
|
||||
__mg_event_timeout.tv_usec = timeoutusec;
|
||||
__mg_event_timeout.tv_usec = __mg_timeout_usec;
|
||||
}
|
||||
|
||||
lwe->type = LWETYPE_TIMEOUT;
|
||||
@@ -880,7 +881,7 @@ BOOL kernel_GetLWEvent (int event, PLWEVENT lwe)
|
||||
memcpy (oldkeystate, keystate, nr_keys);
|
||||
memcpy (&old_lwe, lwe, sizeof (LWEVENT));
|
||||
__mg_event_timeout.tv_sec = 0;
|
||||
__mg_event_timeout.tv_usec = timeoutusec;
|
||||
__mg_event_timeout.tv_usec = __mg_timeout_usec;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -899,7 +900,7 @@ mouseret:
|
||||
me->status = status;
|
||||
memcpy (&old_lwe, lwe, sizeof (LWEVENT));
|
||||
__mg_event_timeout.tv_sec = 0;
|
||||
__mg_event_timeout.tv_usec = timeoutusec;
|
||||
__mg_event_timeout.tv_usec = __mg_timeout_usec;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
+8
-8
@@ -66,7 +66,7 @@ static struct FIXSTR {
|
||||
BYTE bitmap[LEN_BITMAP];
|
||||
int offset[NR_HEAP];
|
||||
char* heap[NR_HEAP + 1];
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_t lock;
|
||||
#endif
|
||||
} FixStrHeap;
|
||||
@@ -98,7 +98,7 @@ BOOL mg_InitFixStr (void)
|
||||
offset += 1<<i;
|
||||
}
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_init (&FixStrHeap.lock, NULL);
|
||||
#endif
|
||||
return TRUE;
|
||||
@@ -106,7 +106,7 @@ BOOL mg_InitFixStr (void)
|
||||
|
||||
void mg_TerminateFixStr (void)
|
||||
{
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_destroy (&FixStrHeap.lock);
|
||||
#endif
|
||||
free (FixStrHeap.heap[0]);
|
||||
@@ -154,7 +154,7 @@ char* GUIAPI FixStrAlloc (int len)
|
||||
// ..
|
||||
// if i == 0; then bufflen = 512
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_lock (&FixStrHeap.lock);
|
||||
#endif
|
||||
|
||||
@@ -166,7 +166,7 @@ char* GUIAPI FixStrAlloc (int len)
|
||||
for(j = 0; j < 8; j++) {
|
||||
if (*bitmap & (0x80 >> j)) {
|
||||
*bitmap &= (~(0x80 >> j));
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_unlock (&FixStrHeap.lock);
|
||||
#endif
|
||||
#if 0
|
||||
@@ -181,7 +181,7 @@ char* GUIAPI FixStrAlloc (int len)
|
||||
bitmap++;
|
||||
}
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_unlock (&FixStrHeap.lock);
|
||||
#endif
|
||||
return (char*)malloc (len + 1);
|
||||
@@ -216,7 +216,7 @@ void GUIAPI FreeFixStr (char* str)
|
||||
// if i == 0; then bufflen = 512
|
||||
bufflen = 1 << (NR_HEAP + 1 - i);
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_lock (&FixStrHeap.lock);
|
||||
#endif
|
||||
heap = FixStrHeap.heap[i];
|
||||
@@ -236,7 +236,7 @@ void GUIAPI FreeFixStr (char* str)
|
||||
bitmap = bitmap + (stroff>>3);
|
||||
*bitmap |= (0x80 >> (stroff%8));
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_unlock (&FixStrHeap.lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -386,7 +386,7 @@ int InitGUI (int argc, const char* agr[])
|
||||
|
||||
/* Since 5.0.0
|
||||
allocate message queue for desktop thread before starting client. */
|
||||
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread ()) ) {
|
||||
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread (TRUE)) ) {
|
||||
err_message (step, "Failed to allocate message queue!");
|
||||
return step;
|
||||
}
|
||||
|
||||
+11
-24
@@ -391,14 +391,6 @@ static BOOL InstallSEGVHandler (void)
|
||||
#include <locale.h>
|
||||
#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[])
|
||||
{
|
||||
char engine [LEN_ENGINE_NAME + 1];
|
||||
@@ -570,6 +562,13 @@ int GUIAPI InitGUI (int args, const char *agr[])
|
||||
|
||||
_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++;
|
||||
if (!SystemThreads()) {
|
||||
_ERR_PRINTF ("KERNEL>InitGUI: failed to init system threads!\n");
|
||||
@@ -578,23 +577,11 @@ int GUIAPI InitGUI (int args, const char *agr[])
|
||||
|
||||
/* init message queue of main GUI thread */
|
||||
step++;
|
||||
if (!(msg_queue = mg_AllocMsgQueueForThisThread ())) {
|
||||
if (!(msg_queue = mg_AllocMsgQueueForThisThread (TRUE))) {
|
||||
_ERR_PRINTF ("KERNEL>InitGUI: failed to allocate message queue!\n");
|
||||
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");
|
||||
|
||||
SetCursor (GetSystemCursor (IDC_ARROW));
|
||||
@@ -615,7 +602,9 @@ failure1:
|
||||
|
||||
void GUIAPI TerminateGUI (int not_used)
|
||||
{
|
||||
mg_TerminateTimer (FALSE);
|
||||
mg_TerminateTimer ();
|
||||
|
||||
mg_FreeMsgQueueForThisThread (TRUE);
|
||||
|
||||
/* Since 5.0.0 */
|
||||
SendNotifyMessage (HWND_DESKTOP, MSG_ENDSESSION, 0, 0);
|
||||
@@ -655,8 +644,6 @@ void GUIAPI TerminateGUI (int not_used)
|
||||
miFreeArcCache ();
|
||||
#endif
|
||||
|
||||
mg_FreeMsgQueueForThisThread ();
|
||||
|
||||
deleteThreadInfoKey ();
|
||||
|
||||
mg_TerminateSliceAllocator();
|
||||
|
||||
+27
-17
@@ -60,7 +60,6 @@
|
||||
#include "gdi.h"
|
||||
#include "window.h"
|
||||
|
||||
#include "blockheap.h"
|
||||
#include "cliprect.h"
|
||||
#include "gal.h"
|
||||
#include "internals.h"
|
||||
@@ -159,7 +158,7 @@ void mg_DestroyFreeQMSGList (void)
|
||||
pthread_key_t __mg_threadinfo_key;
|
||||
#endif
|
||||
|
||||
MSGQUEUE* mg_AllocMsgQueueForThisThread (void)
|
||||
MSGQUEUE* mg_AllocMsgQueueForThisThread (BOOL sign_in)
|
||||
{
|
||||
MSGQUEUE* pMsgQueue;
|
||||
|
||||
@@ -177,13 +176,14 @@ MSGQUEUE* mg_AllocMsgQueueForThisThread (void)
|
||||
pthread_setspecific (__mg_threadinfo_key, pMsgQueue);
|
||||
#endif
|
||||
|
||||
// register this new message queue
|
||||
SendMessage (HWND_DESKTOP, MSG_MANAGE_MSGTHREAD,
|
||||
MSGTHREAD_SIGNIN, (LPARAM)pMsgQueue);
|
||||
if (sign_in) {
|
||||
SendMessage (HWND_DESKTOP, MSG_MANAGE_MSGTHREAD,
|
||||
MSGTHREAD_SIGNIN, (LPARAM)pMsgQueue);
|
||||
}
|
||||
return pMsgQueue;
|
||||
}
|
||||
|
||||
void mg_FreeMsgQueueForThisThread (void)
|
||||
void mg_FreeMsgQueueForThisThread (BOOL sign_off)
|
||||
{
|
||||
MSGQUEUE* pMsgQueue;
|
||||
|
||||
@@ -194,6 +194,11 @@ void mg_FreeMsgQueueForThisThread (void)
|
||||
_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);
|
||||
free (pMsgQueue);
|
||||
|
||||
@@ -823,8 +828,9 @@ checkagain:
|
||||
goto got_ret;
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
pMsgQueue->dwState &= ~QS_POSTMSG;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -949,6 +955,12 @@ checkagain:
|
||||
|
||||
goto checkagain;
|
||||
}
|
||||
else {
|
||||
/* no message, wait again. */
|
||||
if (pMsgQueue->OnIdle && !pMsgQueue->OnIdle (pMsgQueue, FALSE)) {
|
||||
handle_idle_message (pMsgQueue);
|
||||
}
|
||||
}
|
||||
#else /* defined _MGHAVE_VIRTUAL_WINDOW */
|
||||
/* no message, idle */
|
||||
if (bWait) {
|
||||
@@ -958,6 +970,11 @@ checkagain:
|
||||
}
|
||||
goto checkagain;
|
||||
}
|
||||
else {
|
||||
if (!pMsgQueue->OnIdle (pMsgQueue, FALE)) {
|
||||
handle_idle_message (pMsgQueue);
|
||||
}
|
||||
}
|
||||
#endif /* not defined _MGHAVE_VIRTUAL_WINDOW */
|
||||
|
||||
/* no message */
|
||||
@@ -1410,6 +1427,9 @@ LRESULT GUIAPI DispatchMessage (PMSG pMsg)
|
||||
to the controls of the main window will be thrown away as well. */
|
||||
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;
|
||||
PMSG pMsg;
|
||||
PQMSG pQMsg;
|
||||
@@ -1421,16 +1441,6 @@ int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd)
|
||||
|
||||
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) {
|
||||
PQMSG pPrev = NULL, pNext;
|
||||
pQMsg = pMsgQueue->pFirstNotifyMsg;
|
||||
|
||||
+80
-306
File diff suppressed because it is too large
Load Diff
+20
-8
@@ -243,11 +243,23 @@ int __kernel_alloc_z_order_info (int nr_topmosts, int nr_normals, BOOL with_mask
|
||||
#endif /* deprecated code */
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifndef __NOUNIX__
|
||||
# ifdef __ZI_USE_RWLOCK
|
||||
pthread_rwlock_init(&__mg_zorder_info->rwlock, NULL);
|
||||
#else
|
||||
pthread_mutex_init(&__mg_zorder_info->rwlock, NULL);
|
||||
#endif
|
||||
__mg_zorder_info->rwlock_owner = 0;
|
||||
# else
|
||||
do {
|
||||
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
|
||||
return 0;
|
||||
#endif
|
||||
@@ -261,11 +273,11 @@ void __kernel_free_z_order_info (ZORDERINFO* zi)
|
||||
#else
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifndef __NOUNIX__
|
||||
# ifdef __ZI_USE_RWLOCK
|
||||
pthread_rwlock_destroy(&zi->rwlock);
|
||||
#else
|
||||
pthread_mutex_destroy(&zi->rwlock);
|
||||
#endif
|
||||
# else
|
||||
pthread_mutex_destroy(&zi->mutex);
|
||||
# endif
|
||||
#endif
|
||||
free (zi);
|
||||
__mg_zorder_info = NULL;
|
||||
|
||||
@@ -7,7 +7,7 @@ EXTRA_DIST= 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 \
|
||||
error.c sockio.c
|
||||
error.c sockio.c lock_file.c
|
||||
|
||||
SRC_FILES = $(libmisc_la_SOURCES)
|
||||
LIB_NAME=libmisc
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ static LRESULT AboutWinProc (HWND hWnd, UINT message,
|
||||
DrawText (hdc,
|
||||
"MiniGUI -- a mature cross-platform windowing system "
|
||||
"and GUI support system for embedded or IoT devices.\n\n"
|
||||
"Copyright (C) 2002 ~ 2020 FMSoft Co., Ltd.",
|
||||
"Copyright (C) 2002 ~ 2023 FMSoft Co., Ltd.",
|
||||
-1, &rcClient, DT_WORDBREAK | DT_CENTER);
|
||||
|
||||
EndPaint (hWnd, hdc);
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT NOTICE
|
||||
//
|
||||
// The following open source license statement does not apply to any
|
||||
// entity in the Exception List published by FMSoft.
|
||||
//
|
||||
// For more information, please visit:
|
||||
//
|
||||
// https://www.fmsoft.cn/exception-list
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2023, Beijing FMSoft Technologies Co., Ltd.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** lock_file.c: This file include functions for locking/unlocking a file.
|
||||
**
|
||||
** Create date: 2023/09/10
|
||||
**
|
||||
** Current maintainer: Wei Yongming.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifndef __NOUNIX__
|
||||
|
||||
#include "misc.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/file.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
void __mg_lock_file_for_read(int fd)
|
||||
{
|
||||
struct flock lock;
|
||||
|
||||
lock.l_type = F_RDLCK;
|
||||
lock.l_whence = SEEK_SET;
|
||||
lock.l_start = 0;
|
||||
lock.l_len = 0;
|
||||
|
||||
while (fcntl(fd, F_SETLKW, &lock) == -1 && errno == EINTR);
|
||||
}
|
||||
|
||||
void __mg_unlock_file_for_read(int fd)
|
||||
{
|
||||
struct flock lock;
|
||||
|
||||
lock.l_type = F_UNLCK;
|
||||
lock.l_whence = SEEK_SET;
|
||||
lock.l_start = 0;
|
||||
lock.l_len = 0;
|
||||
|
||||
fcntl(fd, F_SETLK, &lock);
|
||||
}
|
||||
|
||||
void __mg_lock_file_for_write(int fd)
|
||||
{
|
||||
struct flock lock;
|
||||
|
||||
lock.l_type = F_WRLCK;
|
||||
lock.l_whence = SEEK_SET;
|
||||
lock.l_start = 0;
|
||||
lock.l_len = 0;
|
||||
|
||||
while (fcntl(fd, F_SETLKW, &lock) == -1 && errno == EINTR);
|
||||
}
|
||||
|
||||
void __mg_unlock_file_for_write(int fd)
|
||||
{
|
||||
struct flock lock;
|
||||
|
||||
lock.l_type = F_UNLCK;
|
||||
lock.l_whence = SEEK_SET;
|
||||
lock.l_start = 0;
|
||||
lock.l_len = 0;
|
||||
|
||||
fcntl(fd, F_SETLK, &lock);
|
||||
}
|
||||
|
||||
#endif /* __NOUNIX__ */
|
||||
+5
-5
@@ -243,7 +243,7 @@ map_entry_t* __mg_map_find (map_t* map, const void* key)
|
||||
return entry;
|
||||
}
|
||||
|
||||
int __mg_map_erase (map_t* map, void* key)
|
||||
int __mg_map_erase (map_t* map, const void* key)
|
||||
{
|
||||
int retval = -1;
|
||||
map_entry_t* entry = NULL;
|
||||
@@ -299,7 +299,7 @@ ret:
|
||||
return retval;
|
||||
}
|
||||
|
||||
int __mg_map_insert_ex (map_t* map, const void* key,
|
||||
map_entry_t* __mg_map_insert_ex2 (map_t* map, const void* key,
|
||||
const void* val, free_val_fn free_val_alt)
|
||||
{
|
||||
map_entry_t **pentry;
|
||||
@@ -307,7 +307,7 @@ int __mg_map_insert_ex (map_t* map, const void* key,
|
||||
map_entry_t *parent;
|
||||
|
||||
if (map == NULL)
|
||||
return -1;
|
||||
return NULL;
|
||||
|
||||
WRLOCK_MAP (map);
|
||||
|
||||
@@ -317,7 +317,7 @@ int __mg_map_insert_ex (map_t* map, const void* key,
|
||||
|
||||
while (*pentry) {
|
||||
int ret;
|
||||
|
||||
|
||||
if (map->comp_key)
|
||||
ret = map->comp_key (key, (*pentry)->key);
|
||||
else
|
||||
@@ -354,7 +354,7 @@ int __mg_map_insert_ex (map_t* map, const void* key,
|
||||
}
|
||||
|
||||
UNLOCK_MAP (map);
|
||||
return 0;
|
||||
return entry;
|
||||
}
|
||||
|
||||
int __mg_map_find_replace_or_insert (map_t* map, const void* key,
|
||||
|
||||
@@ -495,28 +495,6 @@ DWORD __mg_os_get_time_ticks (void)
|
||||
return (current - startup_time_win32) / 10;
|
||||
}
|
||||
|
||||
#if 0 /* deprecated code */
|
||||
DWORD __mg_os_get_elapsed_ms (void)
|
||||
{
|
||||
static DWORD last;
|
||||
DWORD current = timeGetTime();
|
||||
DWORD elapsed;
|
||||
|
||||
if (current >= last) {
|
||||
elapsed = current - last;
|
||||
return elapsed;
|
||||
}
|
||||
else {
|
||||
/* overflowed */
|
||||
elapsed = BITMASK_DWORD - last;
|
||||
elapsed += current;
|
||||
}
|
||||
|
||||
last = current;
|
||||
return elapsed;
|
||||
}
|
||||
#endif /* deprecated code */
|
||||
|
||||
#elif defined (HAVE_CLOCK_GETTIME)
|
||||
|
||||
static struct timespec timeval_startup;
|
||||
@@ -573,68 +551,6 @@ DWORD __mg_os_get_time_ticks (void)
|
||||
return ds * 100 + dms;
|
||||
}
|
||||
|
||||
#if 0 /* deprecated code */
|
||||
DWORD __mg_os_get_elapsed_ms (void)
|
||||
{
|
||||
static struct timespec last;
|
||||
DWORD ds, dms;
|
||||
struct timespec current;
|
||||
|
||||
clock_gettime (CLOCK_MONOTONIC, ¤t);
|
||||
ds = (current.tv_sec - last.tv_sec);
|
||||
|
||||
if (current.tv_sec == last.tv_sec) {
|
||||
dms = (current.tv_nsec - last.tv_nsec) / 1000000L;
|
||||
}
|
||||
else if (current.tv_nsec >= last.tv_nsec) {
|
||||
dms = (current.tv_nsec - last.tv_nsec) / 1000000L;
|
||||
}
|
||||
else {
|
||||
assert (ds > 0);
|
||||
|
||||
ds--;
|
||||
dms = 1000L - (last.tv_nsec - current.tv_nsec) / 1000000L;
|
||||
}
|
||||
|
||||
last = current;
|
||||
return ds * 1000 + dms;
|
||||
}
|
||||
|
||||
#include <unistd.h>
|
||||
#include <poll.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
static struct timeval timeval_startup;
|
||||
void __mg_os_start_time(void)
|
||||
{
|
||||
gettimeofday(&timeval_startup, NULL);
|
||||
}
|
||||
|
||||
DWORD __mg_os_get_time_ms(void)
|
||||
{
|
||||
DWORD ds, dms;
|
||||
struct timeval current;
|
||||
|
||||
gettimeofday(¤t, NULL);
|
||||
ds = (current.tv_sec - timeval_startup.tv_sec);
|
||||
|
||||
if (current.tv_sec == timeval_startup.tv_sec) {
|
||||
dms = (current.tv_usec - timeval_startup.tv_usec) / 1000L;
|
||||
}
|
||||
else if (current.tv_usec >= timeval_startup.tv_usec) {
|
||||
dms = (current.tv_usec - timeval_startup.tv_usec) / 1000L;
|
||||
}
|
||||
else {
|
||||
assert(ds > 0);
|
||||
|
||||
ds--;
|
||||
dms = 1000L - (timeval_startup.tv_usec - current.tv_usec) / 1000L;
|
||||
}
|
||||
|
||||
return ds * 1000 + dms;
|
||||
}
|
||||
#endif /* deprecated code */
|
||||
|
||||
#else /* defined HAVE_CLOCK_GETTIME */
|
||||
|
||||
#error "Please implement __mg_os_start_time and __mg_os_get_time_ticks for your OS"
|
||||
|
||||
+9
-1
@@ -96,8 +96,12 @@ static BITMAP_TYPE_INFO bitmap_types [MAX_BITMAP_TYPES] =
|
||||
{ "jpeg", __mg_init_jpg, __mg_load_jpg, __mg_cleanup_jpg, __mg_save_jpg, __mg_check_jpg },
|
||||
#endif
|
||||
#ifdef _MGIMAGE_PNG
|
||||
#if _MGLIBPNG_VER == 16
|
||||
{ "png", __mg_init_png, __mg_load_png, __mg_cleanup_png, __mg_save_png, __mg_check_png },
|
||||
#else
|
||||
{ "png", __mg_init_png, __mg_load_png, __mg_cleanup_png, NULL, __mg_check_png },
|
||||
#endif
|
||||
#endif
|
||||
#ifdef _MGIMAGE_WEBP
|
||||
{ "webp", __mg_init_webp, __mg_load_webp, __mg_cleanup_webp, NULL, __mg_check_webp },
|
||||
#endif
|
||||
@@ -187,7 +191,8 @@ int __mg_bmp_compute_pitch(int bpp, Uint32 width, Uint32 *pitch, BOOL does_round
|
||||
return bytespp;
|
||||
}
|
||||
|
||||
void* GUIAPI InitMyBitmapSL (MG_RWops* area, const char* ext, MYBITMAP* my_bmp, RGB* pal)
|
||||
void* GUIAPI
|
||||
InitMyBitmapSL (MG_RWops* area, const char* ext, MYBITMAP* my_bmp, RGB* pal)
|
||||
{
|
||||
int type;
|
||||
LOAD_MYBITMAP_INFO* load_info;
|
||||
@@ -209,8 +214,11 @@ void* GUIAPI InitMyBitmapSL (MG_RWops* area, const char* ext, MYBITMAP* my_bmp,
|
||||
my_bmp->frames = 1;
|
||||
my_bmp->depth = GetGDCapability (HDC_SCREEN, GDCAP_BPP) << 3;
|
||||
|
||||
// initialize the palette with the screen palette.
|
||||
if (my_bmp->depth <= 8)
|
||||
GetPalette (HDC_SCREEN, 0, 256, (GAL_Color*)pal);
|
||||
else
|
||||
memset (pal, 0, sizeof(RGB) * 256); // reset the palette.
|
||||
|
||||
/* This is just for gray screen. If your screen is gray,
|
||||
* please define this macro _GRAY_SCREEN.
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+5
-3
@@ -15,7 +15,7 @@
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2021, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@@ -106,7 +106,8 @@ void* __mg_init_webp(MG_RWops *fp, MYBITMAP *mybmp, RGB *pal)
|
||||
else
|
||||
goto error;
|
||||
|
||||
sc = WebPGetFeatures(info->data, info->sz_data, &info->config.input);
|
||||
sc = WebPGetFeatures((const uint8_t *)info->data, info->sz_data,
|
||||
&info->config.input);
|
||||
if (sc == VP8_STATUS_OK) {
|
||||
break;
|
||||
}
|
||||
@@ -210,7 +211,8 @@ int __mg_load_webp(MG_RWops *fp, void *init_info, MYBITMAP *mybmp,
|
||||
while (1) {
|
||||
int n;
|
||||
|
||||
VP8StatusCode status = WebPIAppend(idec, info->data, info->sz_data);
|
||||
VP8StatusCode status = WebPIAppend(idec,
|
||||
(const uint8_t *)info->data, info->sz_data);
|
||||
if (status != VP8_STATUS_OK && status != VP8_STATUS_SUSPENDED) {
|
||||
_ERR_PRINTF ("__mg_load_webp: WebPIAppend failed: %d\n", status);
|
||||
rc = ERR_BMP_LOAD;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user