Compare commits

..
3 Commits
195 changed files with 7912 additions and 12080 deletions
-1
View File
@@ -29,4 +29,3 @@ Makefile.in
/src/font/utils/ucd/
/src/sysres/font_list
/src/sysres/license/dat_files/
/configure~
+78 -174
View File
File diff suppressed because it is too large Load Diff
+78 -174
View File
File diff suppressed because it is too large Load Diff
+78 -174
View File
File diff suppressed because it is too large Load Diff
+98 -130
View File
File diff suppressed because it is too large Load Diff
-184
View File
@@ -1,21 +1,5 @@
# Release Notes
- [Version 5.2.0](#version-520)
+ [What's new in version 5.2.0](#whats-new-in-version-520)
- [Version 5.0.13](#version-5013)
+ [What's new in version 5.0.13](#whats-new-in-version-5013)
- [Version 5.0.12](#version-5012)
+ [What's new in version 5.0.12](#whats-new-in-version-5012)
- [Version 5.0.11](#version-5011)
+ [What's new in version 5.0.11](#whats-new-in-version-5011)
- [Version 5.0.10](#version-5010)
+ [What's new in version 5.0.10](#whats-new-in-version-5010)
- [Version 5.0.9](#version-508)
+ [What's new in version 5.0.9](#whats-new-in-version-508)
- [Version 5.0.8](#version-508)
+ [What's new in version 5.0.8](#whats-new-in-version-508)
- [Version 5.0.6](#version-506)
+ [What's new in version 5.0.6](#whats-new-in-version-506)
- [Version 5.0.5](#version-505)
+ [What's new in version 5.0.5](#whats-new-in-version-505)
- [Version 5.0.4](#version-504)
@@ -34,174 +18,6 @@
+ [Changes leading to incompatibility](#changes-leading-to-incompatibility)
+ [Deprecated APIs](#deprecated-apis)
## Version 5.2.0
On Nov. 30, 2023, FMSoft announces the availability of MiniGUI 5.2.0,
which is an mainline release with some major enhancements:
* ENHANCEMENTS:
- Optimize NEWGAL engines: `shadow`, `drm`, and `fbcon` for large resolution.
- New APIs: `GetWindowSharedSurfaceFD()` and `CreateMemDCFromSharedSurfaceFD()` for compositing schema.
* CHANGES:
- The operations for DRM userland driver changed.
## Version 5.0.13
On Aug. 31, 2023, FMSoft announces the availability of MiniGUI 5.0.13,
which is an enhancement release with some minor enhancements
of MiniGUI 5.0.x.
### What's new in version 5.0.13
In this version, we made some enhancements:
* ENHANCEMENTS:
- Disable BIDI for text in UTF-8 charset by default.
* CHANGES:
- Add `BIDI_FLAG_NONE` and `BIDI_FLAG_LEGACY`.
* BUGFIXING:
- Ignore C0CTRL characters when renerding text.
- Support for vowels.
## Version 5.0.12
On May 10, 2023, FMSoft announces the availability of MiniGUI 5.0.12,
which is an enhancement release with some minor enhancements
of MiniGUI 5.0.x.
### What's new in version 5.0.12
In this version, we made some enhancements:
* ENHANCEMENTS:
- Add new API `GetACharsExtentPointEx()`.
- Add new APIs `GetTabbedACharsExtent()`, `GetTabbedACharsExtentPoint()`,
and `GetTabbedACharsExtentPointEx()`.
- Enhance two APIs `GetTextExtentPoint()` and `GetTabbedTextExtentPoint()`
to support BIDI charsets.
- Tune management of tick count.
* BUGFIXING:
- Fix a typo: `Achar2UChar()` to `AChar2UChar()`.
## Version 5.0.11
On Dec. 31, 2022, FMSoft announces the availability of MiniGUI 5.0.11,
which is a bug fixing release with bug fixes and some minor enhancements
of MiniGUI 5.0.x.
### What's new in version 5.0.11
In this version, we made some enhancements
* ENHANCEMENTS:
* BUGFIXING:
- Fix a bug reported in https://github.com/VincentWei/minigui/issues/94
- Fix a bug reported in https://github.com/VincentWei/minigui/issues/96
- Fix a bug reported in https://github.com/VincentWei/minigui/issues/105
- Fix a bug reported in https://github.com/VincentWei/minigui/issues/106
* OPTIMIZATIONS:
- Optimize the refresh of scrolled.
* TUNING:
- Call `mg_FreeMsgQueueForThisThread` immediately in `TerminateGUI()`.
- Use `CreateLogFontEx` instead of `CreateLogFont` to follow the new style convention of font name when creating the system logfonts,
but the orientation is ignored for the system logfont.
## Version 5.0.10
On Sep. 30, 2022, FMSoft announces the availability of MiniGUI 5.0.10,
which is a bug fixing release with bug fixes and some minor enhancements
of MiniGUI 5.0.x.
### What's new in version 5.0.10
In this version, we made some enhancements
* ENHANCEMENTS:
- Enhance `fbcon` engine to support double buffering for Threads and Standalone mode. (Runtime option: `fbcon.double_buffering`).
- Cleanup and enhance `shadow` engine to use `SyncUpdate` method.
- Relaying `MSG_IDLE` messages to the active descendant controls in every 0.5s.
* BUGFIXING:
- Fix a bug reported in https://github.com/VincentWei/minigui/issues/83
- Fix a bug reported in https://github.com/VincentWei/minigui/issues/87
- Fix bugs reported in https://github.com/VincentWei/minigui/issues/89
- Fix some bugs when virtual window enabled under Standalone and Processes runtime modes.
* OPTIMIZATIONS:
* TUNING:
- Fix some warnings reported by GCC 12.
- Use inline functions for SetCursor and SetDefaultCursor instead of macros.
## Version 5.0.9
On Jan. 14, 2022, FMSoft announces the availability of MiniGUI 5.0.9,
which is a bug fixing release with minor enhancements of MiniGUI 5.0.x.
### What's new in version 5.0.9
In this version, we fixed some bugs:
* BUGFIXING:
- Fix a crash bug in `InitSubDC()` of `src/newgdi/gdi.c`.
* ENHANCEMENTS:
* OPTIMIZATIONS:
* TUNING:
- Change copyright year to 2022.
## Version 5.0.8
The MiniGUI development team announces the availability of MiniGUI 5.0.8,
which is a bug fixing release with minor enhancements of MiniGUI 5.0.x.
### What's new in version 5.0.8
In this version, we fixed some bugs and made some optimizations and enhancements:
* BUGFIXING:
* ENHANCEMENTS:
- Support for WebP image format based on `libwebp`.
- Support for two ARM64-based hardware platforms: PX30 and R818.
- New surface pixel format for main window: `ST_PIXEL_XRGB565` under compositing schema.
* OPTIMIZATIONS:
- Shrink heap size for fixed string.
- Optimize the memory use of blitting context.
* TUNING:
- Tune code of fbcon video engine for compositing schema.
- Fix warnings and errors for conditional compilation.
## Version 5.0.6
The MiniGUI development team announces the availability of MiniGUI 5.0.6,
which is the bug fixing release of MiniGUI 5.0.x.
### What's new in version 5.0.6
In this version, we fixed some bugs and made some optimizations and enhancements:
* BUGFIXING:
- Fix bugs of switching layers under MiniGUI-Processes.
- Fix bugs of `FBCon` and `PC_XVFB` engines: the dirty rectangles are
not set empty after calling `SyncUpdate`.
- Fix memory leaks when using block heap.
- Fix a bug in ServerGetWinZNodeRegion.
* ENHANCEMENTS:
- Enhance `GetGlyphInfo` to return the FreeType face, font file path, and glyph
index.
- NEW API `StretchBltEx` to support different scaling filters and rotation.
- Use Pixman to support color blending methods for `BitBlt` and `StretchBlt`.
- Enhance fallback compositor to support animation when switching among layers.
- New API `SetMainWindowGestureFlags` and `MSG_GESTURETEST` message for
gesture test and setting the gesture flags of a specific main window.
- Tune implementation of Tooltip window.
* OPTIMIZATIONS:
- Optimize the fallback compositor for lucent windows.
- Use Pixman to optimize `FillBox`, `BitBlt`, and `StretchBlt`.
- Optimize the management of BLOCKHEAP.
- Optimize the `__mg_lookfor_unused_slot`.
Note that the binary backward-compatibility was broken, two operations added to
`CompositorOps`. You should rebuild all MiniGUI applications.
Also note that the compositing schema is now enabled by default.
## Version 5.0.5
The MiniGUI development team announces the availability of MiniGUI 5.0.5,
+3 -3
View File
@@ -1,11 +1,11 @@
Version 5.2.0 (2023/09/30)
Version 5.0.5 (2021/01/31)
This is a minor enhancement and bugfix release of MiniGUI 5.2.x, the stable version.
This is the first official release of MiniGUI 5.0.x, the stable version.
Other packages for MiniGUI resource, tools, components, and samples:
- GVFB: `gvfb-1.2.5.tar.gz`
- The resource package: `minigui-res-5.0.6.tar.gz`
- The resource package: `minigui-res-5.0.0.tar.gz`
- mGUtils component: `libmgutils-1.5.0.tar.gz`
- mGPlus component: `libmgplus-1.5.0.tar.gz`
- mGEff component: `libmgeff-1.5.0.tar.gz`
+167 -171
View File
File diff suppressed because it is too large Load Diff
+8 -59
View File
@@ -55,36 +55,6 @@ wallpaper_pattern_size=full
# def_compositor_so=
#}}
#{{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
@@ -108,21 +78,9 @@ 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=libdrmdrivers.so
exdriver=libhidrmdrivers-0.2.so.0
#}}
#{{ifdef _MGIAL_SINGLETOUCHKEY
@@ -147,22 +105,6 @@ seat=seat0
[fbcon]
defaultmode=1024x768-16bpp
dpi=96
# Whether double buffering is enabled (only for threads and standalone runmodes).
# Use `true` or `yes` for enabled, anything else for disabled.
# Note that under compositing schema, double buffering is always enabled.
# Since 5.0.10.
double_buffering=true
# Whether the async. update is enabled.
# Use `true` or `yes` for enabled, anything else for disabled.
# Since 5.0.13.
async_update=yes
# The update interval for the asyn. updater (milli-seconds).
# This setting is only valid when drmWaitVBlank doesn't work correctly.
# Since 5.0.13.
update_interval=15
#}}
#{{ifdef _MGGAL_PCXVFB
@@ -175,6 +117,13 @@ 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
-4
View File
@@ -268,8 +268,6 @@ 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
* @{
@@ -313,7 +311,6 @@ 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__)) || \
@@ -2349,7 +2346,6 @@ 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)
+1
View File
@@ -237,6 +237,7 @@ MG_EXPORT void GUIAPI NotifyParentEx (HWND hwnd, LINT id, int code,
NotifyParentEx(hwnd, id, code, 0)
/**
* \var typedef int (*STRCMP) (const char* s1, const char* s2, size_t n)
* \brief Type of general strncmp function.
*
* The function compares the two strings \a s1 and \a s2. It returns
+1
View File
@@ -698,6 +698,7 @@ extern "C" {
#define EM_SETREADONLY 0xF0CF
/**
* \var typedef int (*ED_DRAWSEL_FUNC) (HWND hWnd, HDC hdc, int startx, int starty, const char* content, int len, int selout)
* \brief Type of the edit control callback function on drawing selected strings.
*
* \param hWnd Handle of the edit control.
+25 -24
View File
@@ -131,31 +131,7 @@
#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
@@ -173,6 +149,31 @@
#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
+82 -62
View File
File diff suppressed because it is too large Load Diff
+105 -669
View File
File diff suppressed because it is too large Load Diff
+14 -172
View File
File diff suppressed because it is too large Load Diff
+33 -131
View File
File diff suppressed because it is too large Load Diff
+1 -2
View File
@@ -2,12 +2,11 @@ prefix=@prefix@
exec_prefix=@exec_prefix@
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:
+44 -19
View File
@@ -1,31 +1,56 @@
COMMON_SUBDIRS = libc misc main kernel sysres ial control ex_ctrl font gui mybmp include textedit newgal newgdi
if MG_MINIMALGDI
COMMON_SUBDIRS = misc kernel sysres include
COMMON_LADD = \
libc/liblibc.la \
misc/libmisc.la \
control/libcontrol.la \
ex_ctrl/libexctrl.la \
font/libfont.la \
COMMON_LADD = \
kernel/libkernel.la \
sysres/libsysres.la \
misc/libmisc.la
else
COMMON_SUBDIRS = libc misc main kernel sysres ial control ex_ctrl font gui mybmp include textedit
COMMON_LADD = \
libc/liblibc.la \
misc/libmisc.la \
control/libcontrol.la \
ex_ctrl/libexctrl.la \
font/libfont.la \
font/in-core/libincore.la \
ial/libial.la \
gui/libgui.la \
main/libmain.la \
mybmp/libmybmp.la \
kernel/libkernel.la \
ial/libial.la \
gui/libgui.la \
main/libmain.la \
mybmp/libmybmp.la \
kernel/libkernel.la \
sysres/libsysres.la \
textedit/libtextedit.la \
newgal/libnewgal.la \
newgdi/libnewgdi.la
textedit/libtextedit.la
endif
DIST_SUBDIRS = $(COMMON_SUBDIRS) newgal newgdi server client standalone
SUBDIRS = $(COMMON_SUBDIRS) @RUNMODE_SUBDIRS@
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)
MGSOURCES = template.c template.h
MGLIBADD = $(COMMON_LADD) @RUNMODE_LADD@
MGLIBADD = $(COMMON_LADD) \
$(LITE_LADD) \
$(NEWGAL_LADD)
MGLDFLAGS = -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
lib_LTLIBRARIES=libminigui_@MGLIB_SUFFIX@.la
libminigui_@MGLIB_SUFFIX@_la_LIBADD=$(MGLIBADD) @DEP_LIBS@
libminigui_@MGLIB_SUFFIX@_la_LIBADD=$(MGLIBADD)
libminigui_@MGLIB_SUFFIX@_la_SOURCES=$(MGSOURCES)
libminigui_@MGLIB_SUFFIX@_la_LDFLAGS=$(MGLDFLAGS)
+30 -104
View File
File diff suppressed because it is too large Load Diff
+46 -56
View File
File diff suppressed because it is too large Load Diff
+14 -12
View File
@@ -299,15 +299,7 @@ static void change_status_from_pose (PCONTROL pctrl, int new_pose,
}
}
/* DK: When the radio or check button state changes do not erase the background,
* 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
/*complete a click if the click if valid
* (mouse lbutton up in button )*/
if (old_pose == BST_PUSHED && new_pose != BST_DISABLE
&& change_valid)
@@ -320,6 +312,14 @@ 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 += (int)(w - bmp->bmWidth) >> 1;
y += (int)(h - bmp->bmHeight) >> 1;
x += (w - bmp->bmWidth) >> 1;
y += (h - bmp->bmHeight) >> 1;
w = h = 0;
if (bmp->bmWidth > RECTW(prcClient)){
@@ -847,6 +847,8 @@ static LRESULT ButtonCtrlProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
break;
}
case BM_SETSTYLE:
pctrl->dwStyle &= 0xFFFF0000;
pctrl->dwStyle |= (DWORD)(wParam & 0x0000FFFF);
@@ -1052,7 +1054,7 @@ static LRESULT ButtonCtrlProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
}
default:
break;
break;
}
return DefaultControlProc (hWnd, uMsg, wParam, lParam);
+9 -7
View File
@@ -63,17 +63,21 @@
#include "ctrlmisc.h"
#define _ID_TIMER 100
#define _MARGIN 10
static LRESULT ToolTipWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static int iBorder;
switch (message) {
case MSG_CREATE:
{
const WINDOWINFO *info;
int timeout = (int)GetWindowAdditionalData (hWnd);
if (timeout >= 10)
SetTimer (hWnd, _ID_TIMER, timeout / 10);
info = GetWindowInfo (hWnd);
iBorder =
info->we_rdr->calc_we_area (hWnd, LFRDR_METRICS_BORDER, NULL);
SetWindowFont (hWnd,
(PLOGFONT)GetWindowElementAttr(hWnd, WE_FONT_TOOLTIP));
break;
@@ -98,7 +102,7 @@ static LRESULT ToolTipWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
SetTextColor (hdc,
GetWindowElementPixelEx(hWnd, hdc, WE_FGC_TOOLTIP));
TabbedTextOut (hdc, _MARGIN, _MARGIN, text);
TabbedTextOut (hdc, iBorder, iBorder, text);
EndPaint (hWnd, hdc);
return 0;
@@ -160,7 +164,6 @@ HWND CreateToolTipWin (HWND hParentWnd, int x, int y, int timeout_ms,
CreateInfo.dwStyle = WS_VISIBLE;
CreateInfo.dwExStyle = WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_USEPARENTRDR;
CreateInfo.dwExStyle |= WS_EX_WINTYPE_TOOLTIP | WS_EX_TROUNDCNS | WS_EX_BROUNDCNS;
CreateInfo.spCaption = buf ? buf : text;
CreateInfo.hMenu = 0;
CreateInfo.hCursor = GetSystemCursor (IDC_ARROW);
@@ -168,8 +171,8 @@ HWND CreateToolTipWin (HWND hParentWnd, int x, int y, int timeout_ms,
CreateInfo.MainWindowProc = ToolTipWinProc;
CreateInfo.lx = x;
CreateInfo.ty = y;
CreateInfo.rx = CreateInfo.lx + text_size.cx + _MARGIN * 2;
CreateInfo.by = CreateInfo.ty + text_size.cy + _MARGIN * 2;
CreateInfo.rx = CreateInfo.lx + text_size.cx;
CreateInfo.by = CreateInfo.ty + text_size.cy;
CreateInfo.iBkColor =
GetWindowElementPixelEx (hParentWnd, HDC_SCREEN, WE_BGC_TOOLTIP);
CreateInfo.dwAddData = (DWORD) timeout_ms;
@@ -215,8 +218,7 @@ void ResetToolTipWin (HWND hwnd, int x, int y, const char* text, ...)
if (y + text_size.cy > g_rcScr.bottom)
y = g_rcScr.bottom - text_size.cy;
MoveWindow (hwnd, x, y,
text_size.cx + _MARGIN * 2, text_size.cy + _MARGIN * 2, TRUE);
MoveWindow (hwnd, x, y, text_size.cx, text_size.cy, TRUE);
ShowWindow (hwnd, SW_SHOWNORMAL);
}
+11 -8
View File
@@ -1678,7 +1678,7 @@ esright_input_char_refresh (HWND hWnd,
scroll_rc.right = cur_caret_x;
ScrollWindow(hWnd, -scroll_len, 0, &scroll_rc, NULL);
UpdateInvalidClient(hWnd, TRUE);
UpdateWindow(hWnd, FALSE);
edtSetCaretPos (hWnd, sled);
sled->changed = TRUE;
@@ -2143,6 +2143,9 @@ 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]);
}
@@ -2151,8 +2154,12 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
}
if (chars == 1 && (charBuffer[0] == '\b' || charBuffer[0] == 0x7F)) {
// ASCII BS or DEL
if (chars == 1) {
if (charBuffer [0] < 0x20 && charBuffer[0] != '\b') //FIXME
return 0;
}
if (charBuffer[0] == '\b') { //backspace
int del;
if (sled->editPos == 0 && sled->selStart == sled->selEnd)
@@ -2177,11 +2184,7 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
sleInsertText (hWnd, sled, NULL, del);
}
}
else if (chars == 1 && charBuffer [0] < 0x20) {
// ignore all other ASCII control characters.
return 0;
}
else {
else{
if (dwStyle & ES_LEFT) {
esleft_input_char_refresh(hWnd, sled, (char*)charBuffer, chars);
set_edit_caret_pos(hWnd, sled);
+1 -1
View File
@@ -404,7 +404,7 @@ void mglist_set_itemops (MgList *mglst, PMGITEMOPS iop)
mglst->iop = *iop;
}
LRESULT DefaultItemViewProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam,
int DefaultItemViewProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam,
PSCRDATA pscrdata, MgList *mglst)
{
switch (message) {
+1 -1
View File
@@ -140,7 +140,7 @@ struct _MgList
/* ------------------------- external api -------------------------- */
MG_EXPORT LRESULT DefaultItemViewProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam,
MG_EXPORT int DefaultItemViewProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam,
PSCRDATA pscrdata, MgList *mglst);
MG_EXPORT SVITEM_DRAWFUNC mglist_set_itemdraw (MgList *mglst, SVITEM_DRAWFUNC draw_func);
+1 -5
View File
@@ -172,10 +172,6 @@ BOOL scrolled_set_cont_pos (HWND hWnd, PSCRDATA pscrdata, int cont_x, int cont_y
SetScrollPos (hWnd, SB_VERT, cont_y);
bChange = TRUE;
}
if (bChange)
UpdateInvalidClient(hWnd, FALSE);
return bChange;
}
@@ -589,7 +585,7 @@ int scrolled_init (HWND hWnd, PSCRDATA pscrdata, int w, int h)
return 0;
}
LRESULT DefaultScrolledProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
int DefaultScrolledProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
PSCRDATA pscrdata = NULL;
+1 -1
View File
@@ -96,7 +96,7 @@ typedef struct _scrdata
typedef SCRDATA *PSCRDATA;
MG_EXPORT LRESULT DefaultScrolledProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam);
MG_EXPORT int DefaultScrolledProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam);
MG_EXPORT int scrolled_init (HWND hWnd, PSCRDATA pscrdata, int w, int h);
MG_EXPORT void scrolled_destroy (PSCRDATA pscrdata);
MG_EXPORT void scrolled_hscroll (HWND hWnd, PSCRDATA pscrdata, WPARAM wParam, LPARAM lParam);
+4 -9
View File
@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* This program is free software: you can redistribute it and/or modify
@@ -493,15 +493,10 @@ LRESULT ScrollViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
break;
}
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);
}
case MSG_DESTROY:
scrollview_destroy (psvdata);
free (psvdata);
break;
}
case MSG_GETDLGCODE:
return DLGC_WANTARROWS;
+4 -1
View File
@@ -2096,6 +2096,7 @@ static void teOnChar (HWND hWnd, PTEDATA ptedata, WPARAM wParam)
rcInv.right = ptedata->svdata.scrdata.nContWidth;
rcInv.bottom = rcInv.top + ptedata->nLineHeight - ptedata->nLineBaseH;
REFRESH_NODE_EX(node, &rcInv);
// UpdateWindow(hWnd, FALSE);
newlinenr = NODE_LINENR(node);
rcInv.left = 0;
@@ -2103,10 +2104,12 @@ 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.*/
UpdateInvalidClient(hWnd, TRUE);
UpdateWindow(hWnd, FALSE);
//SendMessage(hWnd, MSG_PAINT, 0, 0);
}
}
else {
+2 -2
View File
@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* 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 [0] == '\0')
if (tmpdata->Caption == NULL || tmpdata->Caption [0] == '\0')
break;
GetTextExtent (hdc, tmpdata->Caption, -1, &size);
+4 -4
View File
@@ -80,17 +80,17 @@ static void update_viewport (gvGridViewData *view, int from, int to, int is_row)
{
RECT r;
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);
}
UpdateInvalidClient(view->hCtrl, FALSE);
UpdateWindow(view->hCtrl, FALSE);
}
// scroll function {{{
-2
View File
@@ -157,8 +157,6 @@ 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;
+17 -10
View File
@@ -93,15 +93,14 @@ 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;
@@ -181,7 +180,6 @@ 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
@@ -634,13 +632,22 @@ static void tvDrawItem (HWND hWnd, HDC hdc, PTVDATA pData, int centerX, int cent
centerX += (h>>1) + TV_BOXGAP;
if (pData->dwStyle & TVS_WITHICON) {
if (p->child != NULL && (p->dwFlags & TVIF_FOLD)) {
if (!(pData->dwStyle & TVS_ICONFORSELECT)
&& (!p->child || (p->dwFlags & TVIF_FOLD))) {
if ((p->hIconFold)) {
DrawIcon (hdc, centerX, centerY - (h>>1), h, h, p->hIconFold);
DrawIcon (hdc, centerX, centerY - (h>>1),
h, h, p->hIconFold);
}
} else if ((pData->dwStyle & TVS_ICONFORSELECT) && p->dwFlags & TVIF_SELECTED) {
if ((p->hIconFold)) {
DrawIcon (hdc, centerX, centerY - (h>>1),
h, h, p->hIconFold);
}
} else
if ((p->hIconUnfold)) {
DrawIcon (hdc, centerX, centerY - (h>>1),
h, h, p->hIconUnfold);
}
} else if ((p->hIconUnfold)) {
DrawIcon (hdc, centerX, centerY - (h>>1), h, h, p->hIconUnfold);
}
centerX += h + TV_ICONGAP;
}
-12
View File
@@ -202,17 +202,6 @@ 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;
@@ -391,7 +380,6 @@ 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,
+16 -19
View File
@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2023, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* 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
#if 0
/* must attetion the para s is arabic chv value.*/
static int is_arabic_char_vowel(Uint8 c)
{
@@ -240,7 +240,6 @@ 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))
@@ -462,18 +461,15 @@ 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 */
@@ -484,10 +480,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,
@@ -535,6 +531,7 @@ static BidiType __mg_iso8859_6_bidi_char_type_map[] = {
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_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,
@@ -609,9 +606,10 @@ static BidiType __mg_iso8859_6_bidi_char_type_map[] = {
static BidiType iso8859_6_bidi_char_type (Achar32 chv)
{
chv = REAL_ACHAR(chv);
assert(chv < TABLESIZE(__mg_iso8859_6_bidi_char_type_map));
return (BidiType)__mg_iso8859_6_bidi_char_type_map[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];
}
static int get_table_index(Uint8 c)
@@ -798,7 +796,7 @@ static const unsigned char* iso8859_6_get_next_word (const unsigned char* mstr,
static Achar32 iso8859_6_get_shaped_char_value (const unsigned char* cur_mchar,
int cur_len, int shape_type)
{
Achar32 chv = INV_ACHAR_VALUE;
Achar32 chv = -1;
int ignore;
int index;
@@ -813,14 +811,15 @@ static Achar32 iso8859_6_get_shaped_char_value (const unsigned char* cur_mchar,
}
}
if (chv == INV_ACHAR_VALUE || chv == 0) {
if (chv == -1 || chv == 0) {
if (ISARABIC_VOWEL(*cur_mchar)){
chv = fontset_68x_get_vowel_char(*cur_mchar);
}
if (chv == 0 || chv == INV_ACHAR_VALUE) {
if (chv == 0 || chv == -1) {
index = get_table_index(*cur_mchar);
if (index >=0 ) {
if (index >=0)
{
switch (shape_type) {
case ACHAR_ISOLATED:
chv = shape_info[index].isolated;
@@ -842,7 +841,7 @@ static Achar32 iso8859_6_get_shaped_char_value (const unsigned char* cur_mchar,
}
if (chv == 0)
chv = INV_ACHAR_VALUE;
chv =-1;
return chv;
}
@@ -863,7 +862,6 @@ static const BIDICHAR_MIRROR_MAP __mg_iso8859_68x_mirror_table [] =
static BOOL iso8859_6_bidi_mirror_char (Achar32 chv, Achar32* mirrored)
{
chv = REAL_ACHAR(chv);
return get_mirror_char (__mg_iso8859_68x_mirror_table,
TABLESIZE (__mg_iso8859_68x_mirror_table), chv, mirrored);
}
@@ -873,7 +871,6 @@ 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,
+2 -33
View File
@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2023, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* This program is free software: you can redistribute it and/or modify
@@ -210,8 +210,6 @@ static unsigned int unicode_char_type (Achar32 chv)
mchar_type = ACHAR_BASIC_LF;
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)
@@ -241,36 +239,10 @@ 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);
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;
return linear_enum_to_bidi_type[UNIBIDI_GET_BIDI_TYPE(ch)];
}
BidiType GUIAPI UCharGetBidiType(Uchar32 uc)
@@ -656,7 +628,6 @@ CHARSETOPS __mg_CharsetOps_utf8 = {
6,
FONT_CHARSET_UTF8,
0,
0,
utf8_len_first_char,
utf8_get_char_value,
NULL,
@@ -883,7 +854,6 @@ CHARSETOPS __mg_CharsetOps_utf16le = {
4,
FONT_CHARSET_UTF16LE,
0,
0,
utf16le_len_first_char,
utf16le_get_char_value,
NULL,
@@ -1110,7 +1080,6 @@ CHARSETOPS __mg_CharsetOps_utf16be = {
4,
FONT_CHARSET_UTF16BE,
0,
0,
utf16be_len_first_char,
utf16be_get_char_value,
NULL,
+7 -30
View File
File diff suppressed because it is too large Load Diff
-12
View File
@@ -255,17 +255,6 @@ compute_kernval (TTFINSTANCEINFO* ttf_inst_info)
return kernval;
}
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)
@@ -803,7 +792,6 @@ 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,
+1 -13
View File
@@ -197,17 +197,6 @@ 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) {
@@ -746,9 +735,9 @@ get_glyph_advance (LOGFONT* logfont, DEVFONT* devfont,
pcache->valid_advance = 1;
}
}
done:
#endif
done:
FT_UNLOCK(&ft_lock);
if (px) {
@@ -1276,7 +1265,6 @@ void font_TermFreetypeLibrary (void)
/**************************** Global data ************************************/
FONTOPS __mg_ttf_ops = {
get_feature,
get_glyph_bmptype,
get_ave_width,
get_max_width,
+3 -2
View File
@@ -88,6 +88,7 @@ typedef int (* MakeHashKeyFunc)(Glyph32 gv);
typedef struct tagFTFACEINFO {
char* filepathname;
FT_Face face;
BOOL valid;
#ifdef _MGFONT_TTF_CACHE
int face_index;
int cmap_index;
@@ -162,13 +163,13 @@ extern void __mg_ttc_sys_deinit(void);
extern TTFCACHEINFO *__mg_ttc_search(HCACHE hCache, Glyph32 gv, int *size);
extern void __mg_ttc_refer(HCACHE hCache);
#endif /* _MGFONT_TTF_CACHE */
#ifdef _MGCOMPLEX_SCRIPTS
extern void __mg_init_harzbuff_funcs(void);
extern void __mg_term_harzbuff_funcs(void);
#endif
#endif
#ifdef __cplusplus
}
#endif /* __cplusplus */
+9 -15
View File
@@ -703,20 +703,21 @@ 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)
{
ACHARMAPINFO* str = (ACHARMAPINFO*)context + pos;
GLYPHMAPINFO* str = (GLYPHMAPINFO*)context + pos;
int i;
for (i = 0; i < len / 2; i++)
{
ACHARMAPINFO tmp = str[i];
GLYPHMAPINFO 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, int pel, ACHARMAPINFO* map)
Achar32* achars, int len, GLYPHMAPINFO* map, int pel)
{
BYTE max_level = 1;
TYPERUN *type_rl_list = NULL;
@@ -724,7 +725,6 @@ 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,15 +735,14 @@ 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;
}
}
rc.achars = NULL;
rc.extra = map;
rc.cb = bidi_map_reverse;
bidi_reorder(&rc, len, &type_rl_list, max_level);
bidi_reorder_cb(map, len, &type_rl_list, max_level,
bidi_map_reverse);
/* free typerun list.*/
free_typerun_list(type_rl_list);
@@ -753,23 +752,18 @@ 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);
rc.achars = achars;
rc.extra = extra;
rc.cb = cb_reverse_extra;
bidi_reorder(index_map, len, &type_rl_list, max_level,
bidi_reorder_cb(index_map, len, &type_rl_list, max_level,
bidi_string_reverse);
/* free typerun list.*/
-12
View File
@@ -66,17 +66,6 @@
#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;
@@ -182,7 +171,6 @@ 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,
-12
View File
@@ -287,17 +287,6 @@ static unsigned char def_smooth_bitmap [] =
static QPF_GLYPH def_glyph = {&def_metrics, def_bitmap};
static QPF_GLYPH def_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)
@@ -552,7 +541,6 @@ 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,
-12
View File
@@ -151,17 +151,6 @@ 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;
@@ -291,7 +280,6 @@ 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
-12
View File
@@ -377,17 +377,6 @@ 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)
@@ -609,7 +598,6 @@ 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,
+1 -4
View File
@@ -155,10 +155,7 @@ BOOL mg_InitSysFont (void)
goto error_load;
}
/* 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,
if ((sys_fonts[i] = CreateLogFont (type, family, charset,
style [0], style [1], style [2],
style [3], style [4], style [5],
height, 0)) == NULL) {
+3 -2
View File
@@ -377,8 +377,8 @@ static _GBType resolve_gbt(struct break_ctxt* ctxt,
uc == 0x8E2 || uc == 0xD4E || uc == 0x110BD ||
(uc >= 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,6 +434,7 @@ static _GBType resolve_gbt(struct break_ctxt* ctxt,
gbt = GB_RI_Odd;
else
gbt = GB_RI_Odd;
break;
}
break;
-12
View File
@@ -148,17 +148,6 @@ 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;
@@ -536,7 +525,6 @@ 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,
-12
View File
@@ -109,17 +109,6 @@ 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;
@@ -488,7 +477,6 @@ static void unload_font_data (DEVFONT* devfont, void* data)
}
FONTOPS __mg_vbf_ops = {
get_feature,
get_glyph_bmptype,
get_ave_width,
get_max_width,
+1
View File
@@ -59,6 +59,7 @@
#include "cliprect.h"
#include "gal.h"
#include "internals.h"
#include "blockheap.h"
#include "accelkey.h"
static BLOCKHEAP ACHeap;
+18 -59
View File
@@ -59,22 +59,17 @@
#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;
@@ -83,22 +78,18 @@ 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 =
GetGDCapability(hdc, GDCAP_BITSPP);
pWin->pCaretInfo->caret_bmp.bmBytesPerPixel =
GetGDCapability(hdc, GDCAP_BPP);
pWin->pCaretInfo->caret_bmp.bmBitsPerPixel = BITSPERPHYPIXEL;
pWin->pCaretInfo->caret_bmp.bmBytesPerPixel = BYTESPERPHYPIXEL;
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 (dc_HDC2PDC(hdc)->surface,
pWin->pCaretInfo->nBytesNr = GAL_GetBoxSize (__gal_screen,
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);
@@ -228,8 +219,8 @@ void GetCaretBitmaps (PCARETINFO pCaretInfo)
int i;
int sx, sy;
HDC hdc;
Uint32 amask;
// convert to screen coordinates
sx = pCaretInfo->x;
sy = pCaretInfo->y;
@@ -240,68 +231,36 @@ 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 (amask == 0) {
if (pCaretInfo->pBitmap) {
BYTE* normal;
BYTE* bitmap;
BYTE* xored;
normal = pCaretInfo->pNormal;
bitmap = pCaretInfo->pBitmap->bmBits;
xored = pCaretInfo->pXored;
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;
}
for (i = 0; i < pCaretInfo->nBytesNr; i++)
xored[i] = normal[i] ^ bitmap[i];
}
else {
// Since 5.0.11: restore the alpha component if having alpha component.
int x, y;
BYTE* normal;
BYTE* xored;
BYTE* bitmap = NULL;
gal_pixel pix_normal, pix_bitmap, pix_xored, bits_alpha;
BYTE xor_byte;
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;
if (BITSPERPHYPIXEL < 8)
xor_byte = 0x0F;
else
xor_byte = 0xFF;
for (x = 0; x < pCaretInfo->caret_bmp.bmWidth; x++) {
normal = pCaretInfo->pNormal;
xored = pCaretInfo->pXored;
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;
}
}
for (i = 0; i < pCaretInfo->nBytesNr; i++)
xored[i] = normal[i] ^ xor_byte;
}
}
+2 -2
View File
@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* 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[0] == '\0')
if (!rdr || !rdr->name || rdr->name[0] == '\0')
return FALSE;
_DBG_PRINTF ("GUI>InitWEA: Initialize %s renderer window element attributes.\n",
+2 -1
View File
@@ -71,6 +71,7 @@
#include "cliprect.h"
#include "gal.h"
#include "internals.h"
#include "blockheap.h"
#include "menu.h"
#define SHORTEN 0
@@ -2185,7 +2186,7 @@ static int create_memdc_for_menu (TRACKMENUINFO* ptmi)
return -1;
}
ptmi->dc = __mg_create_memdc_for_surface (surf);
ptmi->dc = CreateMemDCFromSurface (surf);
if (ptmi->dc == HDC_INVALID) {
GAL_FreeSurface (surf);
return -1;
+65 -140
View File
File diff suppressed because it is too large Load Diff
-14
View File
@@ -319,19 +319,6 @@ static void flush_rec (void)
#endif
}
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)
{
@@ -757,7 +744,6 @@ void TermPCXVFBInput (void)
remove("/tmp/.pcxvfb_tmp");
}
#endif
close_rec();
#endif /* WIN32 */
}
+1 -1
View File
@@ -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 rbtree.h \
readbmp.h icon.h blockheap.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
View File
@@ -112,11 +112,11 @@ void __mg_legacy_bidi_get_embeddlevels (const CHARSETOPS* charset_ops,
Uint32 __mg_legacy_bidi_str_base_dir (const CHARSETOPS* charset_ops,
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
+1
View File
@@ -70,6 +70,7 @@ 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,35 +47,26 @@
** blockheap.h: the head file of heap for block data.
**
** Create date: 2001/01/10
**
** DEPRECATED, USE window.h INSTEAD.
*/
#ifndef GUI_BLOCKHEAP_H
#define GUI_BLOCKHEAP_H
#define BDS_FREE 0x0000
#define BDS_SPECIAL 0x0001
#define BDS_USED 0x0002
#ifndef _MGUI_GDI_H /* included in include/gdi.h */
struct _BLOCKHEAP {
#ifdef _MGHAVE_VIRTUAL_WINDOW
typedef struct tagBLOCKHEAP {
#ifdef _MGRM_THREADS
pthread_mutex_t lock;
#endif
/* Size of one block element. */
size_t sz_block;
/* Size of the heap in blocks. */
size_t sz_heap;
/* The first free element in the heap. */
size_t sz_usage_bmp;
/* The number of blocks extra allocated. */
size_t nr_alloc;
/* Pointer to the pre-allocated heap. */
unsigned char* heap;
/* Pointer to the usage bitmap. */
unsigned char* usage_bmp;
};
typedef struct _BLOCKHEAP BLOCKHEAP;
size_t bd_size;
size_t heap_size;
int free;
void* heap;
} BLOCKHEAP;
typedef BLOCKHEAP* PBLOCKHEAP;
#ifdef __cplusplus
+3 -31
View File
@@ -105,10 +105,6 @@
#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"
@@ -117,22 +113,10 @@
#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
@@ -158,23 +142,15 @@ 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 {
@@ -188,8 +164,7 @@ typedef struct JoinLayerInfo {
typedef struct JoinedClientInfo {
GHANDLE layer;
int cli_id;
int def_zi_shmid;
int zi_shmid;
int zo_shmid;
} JOINEDCLIENTINFO;
typedef struct LayerInfo {
@@ -247,8 +222,6 @@ typedef struct _MovedClientInfo {
#define ID_ZOOP_MASKRECT_SET 17
#define ID_ZOOP_MASKRECT_FREE 18
#define ID_ZOOP_SETGESTUREFLAGS 19 /* since 5.0.6 */
#ifndef MAX_CAPTION_LEN
#define MAX_CAPTION_LEN 39 //40
#endif
@@ -383,7 +356,6 @@ 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);
+22 -15
View File
@@ -71,24 +71,19 @@
#define NR_DIRTY_RECTS 16
/* constants for layers and z-order nodes */
#define MAX_NR_LAYERS 16
#define MAX_NR_LAYERS 8
/* Since 5.0.0: the number of the fixed znodes - DONOT adjust */
#define NR_FIXED_ZNODES 1
/* the numbers of znodes in different levels - should be mulitples of 8 */
#define DEF_NR_POPUPMENUS 16
#define DEF_NR_TOOLTIPS 16
#define DEF_NR_GLOBALS 15 // reserve one slot for fixed znode
#define DEF_NR_TOOLTIPS 8
#define DEF_NR_GLOBALS 15 // reserve slots for fixed znodes
#define DEF_NR_SCREENLOCKS 8
#define DEF_NR_DOCKERS 8
#ifdef _MGRM_PROCESSES // per layer basis
# define DEF_NR_TOPMOSTS 8
# define DEF_NR_NORMALS 32
#else
# define DEF_NR_TOPMOSTS 16
# define DEF_NR_NORMALS 128
#endif
#define DEF_NR_TOPMOSTS 16
#define DEF_NR_NORMALS 128
#define DEF_NR_LAUNCHERS 8
/* Since 5.0.0: the number of the zorder levels - DONOT adjust */
@@ -107,10 +102,10 @@ enum {
#define ZNIDX_DESKTOP 0
/* The heap size for mask rectangles */
#define DEF_NR_MASKRECTS 1024
#define DEF_NR_MASKRECT 1024
#if IS_COMPOSITING_SCHEMA
/* max number of shared surfaces (512) */
/* max number of shared surfaces */
# define MAX_NR_SHARED_SURF (DEF_NR_NORMALS * (MAX_NR_LAYERS >> 1))
#endif
@@ -155,9 +150,21 @@ enum {
#endif
/* constants for fix string module */
#define MAX_LEN_FIXSTR 64
#define NR_HEAP 5
#define LEN_BITMAP (1+2+4+8+16)
#if defined (__NOUNIX__) || defined (__uClinux__)
#define MAX_LEN_FIXSTR 64
#define NR_HEAP 5
#define LEN_BITMAP (1+2+4+8+16)
#else
#ifdef _MGRM_THREADS
#define MAX_LEN_FIXSTR 2048
#define NR_HEAP 10
#define LEN_BITMAP (1+2+4+8+16+32+64+128+256+512)
#else
#define MAX_LEN_FIXSTR 1024
#define NR_HEAP 9
#define LEN_BITMAP (1+2+4+8+16+32+64+128+256)
#endif
#endif
/* constants for engine name and video mode */
#define LEN_SO_NAME 127 // name length of a shared object (library)
+6 -15
View File
@@ -93,7 +93,7 @@ typedef struct tagDC* PDC;
# else /* not defined _MGSCHEMA_COMPOSITING */
void __mg_lock_recalc_gcrinfo (PDC pdc);
void __mg_unlock_gcrinfo (PDC pdc);
#define LOCK_GCRINFO(pdc) if (dc_IsGeneralDC(pdc)) __mg_lock_recalc_gcrinfo (pdc)
#define LOCK_GCRINFO(pdc) __mg_lock_recalc_gcrinfo (pdc)
#define UNLOCK_GCRINFO(pdc) if (dc_IsGeneralDC(pdc)) __mg_unlock_gcrinfo (pdc)
# endif /* not defined _MGSCHEMA_COMPOSITING */
@@ -167,8 +167,6 @@ 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;
@@ -181,7 +179,7 @@ struct tagDC
/* text color */
gal_pixel textcolor;
int bkmode_set; /* the background mode set by user (5.0.12, Issue #107) */
int bkmode;
int tabstop;
int cExtra; /* Character extra */
@@ -215,8 +213,6 @@ 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;
@@ -251,7 +247,6 @@ struct tagDC
gal_pixel skip_pixel;
gal_pixel cur_pixel;
int step;
int bkmode; /* the effective background mode */
/* ====================================================================== */
CLIPRECT* cur_ban;
@@ -521,16 +516,14 @@ static inline void _dc_step_y (PDC pdc, int step)
# define BLOCK_DRAW_SEM(pdc) \
do { \
if (pdc->surface->shared_header) { \
__mg_lock_file_for_write(pdc->surface->fd); \
} \
if (pdc->surface->shared_header) \
LOCK_SURFACE_SEM (pdc->surface->shared_header->sem_num); \
} while (0)
# define UNBLOCK_DRAW_SEM(pdc) \
do { \
if (pdc->surface->shared_header) { \
__mg_unlock_file_for_write(pdc->surface->fd); \
} \
if (pdc->surface->shared_header) \
UNLOCK_SURFACE_SEM (pdc->surface->shared_header->sem_num); \
} while (0)
# define IS_SCREEN_SURFACE(pdc) \
@@ -720,8 +713,6 @@ void __mg_update_secondary_dc (PMAINWIN pWin, HDC secondary_dc,
HDC __mg_get_common_rgba8888_dc (void);
BOOL __mg_reset_common_rgba8888_dc (int width, int height, int pitch,
void* pixels);
/* Since 5.0.6 */
void __mg_destroy_common_rgba8888_dc (void);
/* Since 5.0.0.
helpers to update the private client DC of window and it's descendants */
+1 -12
View File
@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2023, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* This program is free software: you can redistribute it and/or modify
@@ -209,9 +209,6 @@ 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);
@@ -266,17 +263,9 @@ 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);
+8 -10
View File
@@ -51,9 +51,11 @@
#ifndef GUI_DRAWSEMOP_H
#define GUI_DRAWSEMOP_H
#include <errno.h>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "misc.h"
#include <errno.h>
static inline void my_sem_op (int semid, int num, int op)
{
@@ -68,9 +70,6 @@ again:
if (errno == EINTR) {
goto again;
}
else {
_ERR_PRINTF("Failed semop: %m\n");
}
}
}
@@ -80,7 +79,10 @@ again:
#define LOCK_SCREEN_SEM() my_sem_op(SHAREDRES_SEMID, _IDX_SEM_SCR, -1)
#define UNLOCK_SCREEN_SEM() my_sem_op(SHAREDRES_SEMID, _IDX_SEM_SCR, 1)
extern int __mg_client_id;
#ifdef _MGSCHEMA_COMPOSITING
# define LOCK_SURFACE_SEM(num) my_sem_op(SHAREDRES_SEMID_SHARED_SURF, num, -1)
# define UNLOCK_SURFACE_SEM(num) my_sem_op(SHAREDRES_SEMID_SHARED_SURF, num, 1)
#endif
#ifdef _MGHAVE_CURSOR
@@ -155,10 +157,6 @@ 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 */
-3
View File
@@ -127,9 +127,6 @@ 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);
+10 -18
View File
@@ -84,18 +84,15 @@
#define WS_EX_MODALDISABLED 0x10000000L
/*
* Internal extended style:
* The control can be displayed out of the main window
* which contains the control.
* \def WS_EX_CTRLASMAINWIN
* \brief The control can be displayed out of the main window
* which contains the control.
*/
#define WS_EX_CTRLASMAINWIN 0x20000000L
/* Internal extended style: dialog box. */
/* Internal extended style. */
#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]
@@ -104,10 +101,6 @@ 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
@@ -534,10 +527,7 @@ int __mg_free_hook_wins (int cli);
/************************* Initialization/Termination ************************/
void __mg_init_local_sys_text (void);
/* the zorder information for the default layer */
extern ZORDERINFO* __mg_def_zorder_info;
/* the zorder information for the current layer */
/* the zorder information of the server */
extern ZORDERINFO* __mg_zorder_info;
#ifdef _MGRM_STANDALONE
@@ -779,8 +769,8 @@ static inline PMSGQUEUE getMsgQueue (HWND hWnd)
}
MSGQUEUE* mg_AllocMsgQueueForThisThread (BOOL sign_in);
void mg_FreeMsgQueueForThisThread (BOOL sign_off);
MSGQUEUE* mg_AllocMsgQueueForThisThread (void);
void mg_FreeMsgQueueForThisThread (void);
/* Since 5.0.0 */
int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd);
@@ -958,7 +948,9 @@ 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);
HDC __mg_create_memdc_for_surface (struct GAL_Surface* surface);
/* Undisclosed APIs */
HDC CreateMemDCFromSurface (struct GAL_Surface* surface);
struct GAL_Surface* GetSurfaceFromDC (HDC hdc);
/* Since 5.0.0 */
#ifdef _MGRM_PROCESSES
+111 -9
View File
@@ -54,12 +54,26 @@
# define MG_LOCAL /* NULL */
#endif
/*
* Common
*/
#if defined(_MG_ENABLE_SPLASH) || \
defined(_MG_ENABLE_SCREENSAVER) || \
defined(_MG_ENABLE_WATERMARK)
#define _MG_ENABLE_LICENSE 1
enum {
SPLASH_MINIGUI,
SPLASH_FMSOFT,
SPLASH_FEIMAN,
SPLASH_PROGRESSBAR,
SPLASH_PROGRESSBAR_BK,
#if 0
WATERMARK_1,
WATERMARK_2,
WATERMARK_3,
#endif /* _MG_ENABLE_WATERMARK */
LICENSE_BITMAP_NR
};
@@ -71,14 +85,14 @@ extern MG_LOCAL BITMAP g_license_bitmaps[];
#define g_bitmap_progressbar g_license_bitmaps[SPLASH_PROGRESSBAR]
#define g_bitmap_progressbar_bk g_license_bitmaps[SPLASH_PROGRESSBAR_BK]
#if defined(_MG_ENABLE_SPLASH) || defined(_MG_ENABLE_SCREENSAVER)
# define _MG_ENABLE_LICENSE 1
MG_LOCAL void __mg_license_create(void);
MG_LOCAL void __mg_license_destroy(void);
#else
# define __mg_license_create() /* NULL */
# define __mg_license_destroy() /* NULL */
#endif
#endif /* endif _MG_ENABLE_SPLASH or _MG_ENABLE_SCREENSAVER or _MG_ENABLE_WATERMARK*/
#ifdef _MG_ENABLE_SCREENSAVER
MG_LOCAL void __mg_screensaver_create(void);
@@ -88,6 +102,9 @@ MG_LOCAL void __mg_screensaver_destroy(void);
# define __mg_screensaver_destroy() /* NULL */
#endif
/*
* Splash
*/
#ifdef _MG_ENABLE_SPLASH
MG_LOCAL void __mg_splash_draw_framework(void);
MG_LOCAL void __mg_splash_progress(void);
@@ -98,11 +115,96 @@ MG_LOCAL void __mg_splash_delay(void);
# define __mg_splash_delay() /* NULL */
#endif /* endif _MG_ENABLE_SPLASH */
#define __mg_license_on_input() /* NULL */
#define __mg_license_on_timeout() /* NULL */
#define LICENSE_CHECK_CUSTIMER_ID() /* NULL */
#define license_get_processor_id() /* NULL */
#define LICENSE_SET_MESSAGE_OFFSET() /* NULL */
#define LICENSE_MODIFY_MESSAGE(x) /* NULL */
/*
* ScreenSaver & Watermark
*/
#if defined(_MG_ENABLE_SCREENSAVER) || defined(_MG_ENABLE_WATERMARK)
MG_LOCAL void __mg_license_on_input(void);
MG_LOCAL void __mg_license_on_timeout(void);
#else
# define __mg_license_on_input() /* NULL */
# define __mg_license_on_timeout() /* NULL */
#endif /* _MG_ENABLE_SCREENSAVER || _MG_ENABLE_WATERMARK */
/*
* Product ID
*/
#ifdef _MG_PRODUCTID
typedef struct _product_id {
/* Fixed 8-byte code, help us to locate the struct in .so file */
unsigned char prefix[8];
/* the ID of the customer */
int customer_id;
/* svn version */
int version;
/* When does we compile the .so, in seconds */
int compile_date;
/* The size of the .so file */
int file_size;
/* The check sum of the .so file */
unsigned char checksum[16];
} product_id_t;
#define PRODUCT_ID_PREFIX 0xca, 0x3f, 0x2b, 0x43, 0x00, 0x33, 0xb0, 0xc3
MG_LOCAL int license_get_customer_id(void);
#endif /* _MG_PRODUCTID */
/*
* Tools to encrypt const variables
*/
MG_LOCAL unsigned int LICENSE_ENCRYPTED_CONST_INT(unsigned int);
MG_LOCAL char *LICENSE_ENCRYPTED_CONST_STRING(unsigned char *, int);
/*
* Processor ID
*/
#ifdef _MG_PRODUCTID
# define LICENSE_CHECK_CUSTIMER_ID() \
do { \
if (! license_get_customer_id()) { \
return ERR_INVALID_ARGS; \
} \
} while(0)
#else
# define LICENSE_CHECK_CUSTIMER_ID() /* NULL */
#endif
#ifdef __TARGET_UNKNOWN__
# define license_get_processor_id() /* NULL */
# define LICENSE_SET_MESSAGE_OFFSET() /* NULL */
# define LICENSE_MODIFY_MESSAGE(x) /* NULL */
#else /* not __TARGET_UNKNOWN__ */
extern MG_LOCAL unsigned int g_license_processor_id; /* window.c */
MG_LOCAL void license_get_processor_id (void);
#define LICENSE_PROCESSOR_ID_NONE (0xFC1D8B2A)
extern MG_LOCAL unsigned int g_license_message_offset; /* zorder.c */
#if defined (_WITH_TARGET_S3C6410)
# define REAL_PROCESSOR_ID LICENSE_ENCRYPTED_CONST_INT(0x1AE2FDFD /* 0x36410101 */)
#elif defined (_WITH_TARGET_S3C2440)
# define REAL_PROCESSOR_ID LICENSE_ENCRYPTED_CONST_INT(0x3AA4FDFD /* 0x32440101 */)
#elif defined (_WITH_TARGET_S3C2410)
# define REAL_PROCESSOR_ID LICENSE_ENCRYPTED_CONST_INT(0x3AE2FDFD /* 0x32410101 */)
#elif defined (_WITH_TARGET_HI3560A)
# define REAL_PROCESSOR_ID LICENSE_ENCRYPTED_CONST_INT(0xFC38C9AD /* 0x35600200 */)
#else
# define REAL_PROCESSOR_ID LICENSE_PROCESSOR_ID_NONE
#endif
#define LICENSE_SET_MESSAGE_OFFSET() do {g_license_message_offset=g_license_processor_id-(REAL_PROCESSOR_ID);}while (0)
#define LICENSE_MODIFY_MESSAGE(pMsg) \
do { \
pMsg->message += g_license_message_offset; \
pMsg->hwnd -= g_license_message_offset / 2; \
} while (0)
#endif /* __TARGET_UNKNOWN__ */
#endif /* LICENSE_H */
+2 -14
View File
@@ -83,11 +83,6 @@ 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;
@@ -105,15 +100,8 @@ int __mg_map_get_size (map_t* map);
map_entry_t* __mg_map_find (map_t* map, const void* key);
map_entry_t* __mg_map_insert_ex2 (map_t* map, const void* key,
int __mg_map_insert_ex (map_t* map, const void* key,
const void* val, free_val_fn free_val_alt);
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)
{
@@ -126,7 +114,7 @@ int __mg_map_find_replace_or_insert (map_t* map, const void* key,
int __mg_map_replace (map_t* map, const void* key,
const void* val, free_val_fn free_val_alt);
int __mg_map_erase (map_t* map, const void* key);
int __mg_map_erase (map_t* map, void* key);
int __mg_map_get_size (map_t* map);
#if 0 /* deprecated code */
+12 -41
View File
@@ -79,11 +79,6 @@ 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);
@@ -120,66 +115,42 @@ 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 */
size_t __mg_lookfor_unused_slot (unsigned char* bitmap, size_t len_bmp, int set);
#endif /* _MGSCHEMA_COMPOSITING */
int __mg_lookfor_unused_slot (unsigned char* bitmap, int len_bmp, int set);
static inline
void __mg_slot_set_use (unsigned char* bitmap, size_t index) {
void __mg_slot_set_use (unsigned char* bitmap, int index) {
bitmap += index >> 3;
*bitmap &= (~(0x80 >> (index % 8)));
}
static inline
int __mg_slot_clear_use (unsigned char* bitmap, size_t index) {
bitmap += index >> 3;
*bitmap |= (0x80 >> (index % 8));
return 1;
}
static inline
int __mg_slot_is_used (unsigned char* bitmap, size_t index) {
int __mg_slot_clear_use (unsigned char* bitmap, int index) {
bitmap += index >> 3;
if (*bitmap & (0x80 >> (index % 8)))
return 0;
*bitmap |= (0x80 >> (index % 8));
return 1;
}
/* get the number of idle mask rectangles */
static inline
size_t __mg_get_nr_idle_slots (unsigned char* bitmap, size_t len_bmp)
int __mg_get_nr_idle_slots (unsigned char* bitmap, int len_bmp)
{
size_t idle = 0;
size_t i, j;
int idle = 0;
int i, j;
for (i = 0; i < len_bmp; i++) {
if (*bitmap) {
if (*bitmap == 0xFF) {
idle += 8;
}
else {
if (*bitmap & 0xF0) {
for (j = 0; j < 4; j++) {
if (*bitmap & (0x80 >> j))
idle++;
}
}
if (*bitmap & 0x0F) {
for (j = 0; j < 4; j++) {
if (*bitmap & (0x08 >> j))
idle++;
}
}
}
for (j = 0; j < 8; j++) {
if (*bitmap & (0x80 >> j))
idle++;
}
bitmap++;
}
return idle;
}
+4 -4
View File
@@ -396,10 +396,10 @@ char * __mg_msgstr3 [] =
"MSG_SRVNOTIFY", // 0x0147
"MSG_UPDATECLIWIN", // 0x0148
"MSG_LAYERCHANGED", // 0x0149
"MSG_WINCOMPOSITED", // 0x014A
"MSG_MANAGE_MSGTHREAD", // 0x014B
"MSG_CALC_POSITION", // 0x014C
"MSG_WAKEUP_CLIENT", // 0x014D
"MSG_MANAGE_MSGTHREAD", // 0x014A
"MSG_CALC_POSITION", // 0x014B
"", // 0x014C
"", // 0x014D
"", // 0x014E
"", // 0x014F
+57 -156
View File
File diff suppressed because it is too large Load Diff
-2
View File
@@ -73,8 +73,6 @@
#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 {
-8
View File
@@ -138,14 +138,6 @@ int __mg_save_png (MG_RWops* fp, MYBITMAP* bmp, RGB* pal);
BOOL __mg_check_png (MG_RWops* fp);
#endif
#ifdef _MGIMAGE_WEBP
void* __mg_init_webp (MG_RWops* fp, MYBITMAP *png, RGB *pal);
int __mg_load_webp (MG_RWops* fp, void* init_info, MYBITMAP *png, CB_ONE_SCANLINE cb, void* context);
void __mg_cleanup_webp (void* init_info);
int __mg_save_webp (MG_RWops* fp, MYBITMAP* bmp, RGB* pal);
BOOL __mg_check_webp (MG_RWops* fp);
#endif
int __mg_bmp_compute_pitch (int bpp, Uint32 width, Uint32 *pitch, BOOL does_round);
#define fp_getc(fp) MGUI_RWgetc(fp)
+1 -14
View File
@@ -132,13 +132,6 @@ 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);
@@ -157,17 +150,11 @@ 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);
#ifdef _MGSCHEMA_COMPOSITING
int __mg_prepare_layer_for_compositing (MG_Layer* layer);
int __mg_end_up_layer_for_compositing (MG_Layer* layer);
#endif
int __mg_do_change_topmost_layer (MG_Layer* new_topmost);
int __mg_do_change_topmost_layer (void);
MG_Layer* __mg_find_layer_by_name (const char* name);
+2 -2
View File
@@ -112,7 +112,7 @@ typedef struct tagG_RES {
int nr_layers;
int semid_layer;
#if 0 && defined(_MGSCHEMA_COMPOSITING) // deprecated since 5.2.0
#ifdef _MGSCHEMA_COMPOSITING
int semid_shared_surf; /* the id of semaphore set for shared surfaces */
#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)
#if 0 && defined(_MGSCHEMA_COMPOSITING) // Deprecated since 5.2.0
#ifdef _MGSCHEMA_COMPOSITING
# define SHAREDRES_SEMID_SHARED_SURF (((PG_RES)mgSharedRes)->semid_shared_surf)
#endif
+19 -30
View File
@@ -87,7 +87,7 @@ typedef struct _ZORDERNODE {
int nr_dirty_rcs; /* the number of dirty rects */
const RECT* dirty_rcs; /* the pointer to the dirty rectangles */
#else /* defined _MGSCHEMA_COMPOSITING */
DWORD age; /* znode age */
unsigned int age; /* znode age */
RECT dirty_rc; /* dirty rectangle */
#endif /* not defined _MGSCHEMA_COMPOSITING */
@@ -133,25 +133,17 @@ typedef struct _ZORDERINFO {
int first_launcher;
int active_win;
int old_active;
int next_active;
int cli_trackmenu;
/* 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
# ifdef __ZI_USE_RWLOCK
# ifndef __NOUNIX__
pthread_rwlock_t rwlock;
pthread_t rwlock_owner;
# else
pthread_mutex_t mutex;
pthread_mutex_t rwlock;
# endif
#elif defined(_MGRM_PROCESSES)
int zi_semid;
@@ -164,13 +156,12 @@ typedef struct _ZORDERINFO {
typedef ZORDERINFO* PZORDERINFO;
#define MAX_NR_SPECIAL_ZNODES(zi) \
(zi->max_nr_globals + \
(zi->max_nr_tooltips + zi->max_nr_globals + \
zi->max_nr_screenlocks + zi->max_nr_dockers + \
zi->max_nr_launchers + NR_FIXED_ZNODES)
#define MAX_NR_GENERAL_ZNODES(zi) \
(zi->max_nr_tooltips + zi->max_nr_topmosts + \
zi->max_nr_normals)
(zi->max_nr_topmosts + zi->max_nr_normals)
#define MAX_NR_ZNODES(zi) \
MAX_NR_SPECIAL_ZNODES(zi) + MAX_NR_GENERAL_ZNODES(zi)
@@ -187,7 +178,7 @@ typedef ZORDERINFO* PZORDERINFO;
(ZORDERNODE*)((char*)((zi)+1)+ (zi)->size_usage_bmp)
#define GET_MASKRECT_USAGEBMP(zi) \
((unsigned char *)((zi) + 1) + (zi)->size_usage_bmp + \
((char *)((zi) + 1) + (zi)->size_usage_bmp + \
sizeof (ZORDERNODE) * (MAX_NR_ZNODES_WITH_PPP(zi)))
#define GET_MASKRECT(zi) \
@@ -196,25 +187,25 @@ typedef ZORDERINFO* PZORDERINFO;
/* round to multiple of 8 to aoivd alignment issue */
#define SIZE_MASKRECT_USAGE_BMP \
ROUND_TO_MULTIPLE((DEF_NR_MASKRECTS >> 3), 8)
ROUND_TO_MULTIPLE((DEF_NR_MASKRECT >> 3), 8)
#define NR_SPECIAL_ZNODES(zi) \
(zi->nr_globals + \
(zi->nr_tooltips + zi->nr_globals + \
zi->nr_screenlocks + zi->nr_dockers + \
zi->nr_launchers + NR_FIXED_ZNODES)
#define NR_GENERAL_ZNODES(zi) \
(zi->nr_tooltips + zi->nr_topmosts + zi->nr_normals)
(zi->nr_topmosts + zi->nr_normals)
#define NR_ZNODES(zi) \
NR_SPECIAL_ZNODES(zi) + NR_GENERAL_ZNODES(zi)
/* Since 5.0.0: more levels */
#define SIZE_USAGE_BMP_GENERAL(max_nr_t, max_nr_n) \
((7 + DEF_NR_TOOLTIPS + (max_nr_t) + (max_nr_n)) >> 3)
((7 + (max_nr_t) + (max_nr_n)) >> 3)
#define SIZE_USAGE_BMP_SPECIAL(max_nr_g) \
((7 + max_nr_g + \
((7 + DEF_NR_TOOLTIPS + max_nr_g + \
DEF_NR_SCREENLOCKS + DEF_NR_DOCKERS + \
DEF_NR_LAUNCHERS + NR_FIXED_ZNODES) >> 3)
@@ -243,15 +234,15 @@ typedef ZORDERINFO* PZORDERINFO;
MG_UNLIKELY ((idx) > MAX_NR_ZNODES(zi))
#define IS_TYPE_GENERAL(type) \
((type) == ZOF_TYPE_TOOLTIP || \
(type) == ZOF_TYPE_HIGHER || \
(type) == ZOF_TYPE_NORMAL)
(type == ZOF_TYPE_HIGHER || \
type == ZOF_TYPE_NORMAL)
#define IS_TYPE_SPECIAL(type) \
((type) == ZOF_TYPE_GLOBAL || \
(type) == ZOF_TYPE_SCREENLOCK || \
(type) == ZOF_TYPE_DOCKER || \
(type) == ZOF_TYPE_LAUNCHER)
(type == ZOF_TYPE_TOOLTIP || \
type == ZOF_TYPE_GLOBAL || \
type == ZOF_TYPE_SCREENLOCK || \
type == ZOF_TYPE_DOCKER || \
type == ZOF_TYPE_LAUNCHER)
#define ZOF_TYPE_TO_LEVEL_IDX(type) ((int)(8 - ((type) >> 28)))
@@ -259,14 +250,12 @@ typedef ZORDERINFO* PZORDERINFO;
extern "C" {
#endif /* __cplusplus */
int __kernel_alloc_z_order_info (int nr_topmosts, int nr_normals, BOOL with_maskrc_heap);
int __kernel_alloc_z_order_info (int nr_topmosts, int nr_normals);
void __kernel_free_z_order_info (ZORDERINFO* zi);
int __kernel_get_window_region (HWND pWin, CLIPRGN* region);
int __kernel_get_next_znode (const ZORDERINFO* zi, int from);
int __kernel_get_prev_znode (const ZORDERINFO* zi, int from);
void __mg_sync_special_nodes (ZORDERINFO* from, ZORDERINFO* to);
#ifdef __cplusplus
}
#endif /* __cplusplus */
+5 -1
View File
@@ -1,15 +1,19 @@
# 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
if MG_MINIMALGDI
libkernel_la_SOURCES = init-lite.c fixstr.c \
blockheap.c
else
libkernel_la_SOURCES = timer.c init.c init-lite.c \
desktop-ths.c desktop-sa.c desktop-procs.c \
cursor.c cursor-procs.c cursor-sa.c \
sharedres.c message.c event.c listenfd.c \
blockheap.c fixstr.c slotset.c zorder.c sem-manager.c \
compsor-manager.c compsor-fallback.c
endif
EXTRA_DIST= desktop.c desktop-comm.c cursor-comm.c makefile.ng makefile.msvc
+70 -93
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+17 -52
View File
@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices.
*
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 2002~2020, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming
*
* This program is free software: you can redistribute it and/or modify
@@ -56,6 +56,7 @@
#include <string.h>
#include <errno.h>
#define _DEBUG
#include "common.h"
#if defined(_MGRM_PROCESSES) && defined(_MGSCHEMA_COMPOSITING)
@@ -68,7 +69,6 @@
#include "constants.h"
#include "zorder.h"
#include "dc.h"
#include "server.h"
#define MAX_NR_COMPOSITORS 8
#define LEN_COMPOSITOR_NAME 15
@@ -133,51 +133,31 @@ static void lock_znode_surface (PDC pdc, ZORDERNODE* node)
{
if (node->lock_count == 0) {
if (pdc->surface->shared_header) {
__mg_lock_file_for_read(pdc->surface->fd);
LOCK_SURFACE_SEM (pdc->surface->shared_header->sem_num);
}
node->dirty_age = pdc->surface->dirty_info->dirty_age;
node->nr_dirty_rcs = pdc->surface->dirty_info->nr_dirty_rcs;
node->dirty_rcs = pdc->surface->dirty_info->dirty_rcs;
}
node->lock_count++;
}
static BOOL unlock_znode_surface (PDC pdc, ZORDERNODE* node)
static void unlock_znode_surface (PDC pdc, ZORDERNODE* node)
{
BOOL need_reset = FALSE;
if (node->lock_count > 0) {
node->lock_count--;
if (node->lock_count == 0) {
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);
}
if (pdc->surface->shared_header)
UNLOCK_SURFACE_SEM (pdc->surface->shared_header->sem_num);
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 */
@@ -342,8 +322,10 @@ 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);
if (unlock_znode_surface (pdc, nodes + i))
reset_znode_surface_dirty (pdc, nodes + i, i);
nodes[i].changes = pdc->surface->dirty_info->dirty_age;
pdc->surface->dirty_info->nr_dirty_rcs = 0;
unlock_znode_surface (pdc, nodes + i);
}
}
@@ -353,8 +335,9 @@ static void composite_layer (MG_Layer* layer, CompositorCtxt* ctxt,
while ((next = __kernel_get_next_znode (zi, next)) > 0) {
if (nodes [next].flags & ZOF_VISIBLE) {
pdc = dc_HDC2PDC (nodes[next].mem_dc);
if (unlock_znode_surface (pdc, nodes + next))
reset_znode_surface_dirty (pdc, nodes + next, next);
nodes[next].changes = pdc->surface->dirty_info->dirty_age;
pdc->surface->dirty_info->nr_dirty_rcs = 0;
unlock_znode_surface (pdc, nodes + next);
}
}
@@ -363,8 +346,9 @@ static void composite_layer (MG_Layer* layer, CompositorCtxt* ctxt,
if (layer == mgTopmostLayer) {
pdc = dc_HDC2PDC (HDC_SCREEN);
if (pdc->surface->w > 0 && pdc->surface->h > 0) {
if (unlock_znode_surface (pdc, nodes))
reset_znode_surface_dirty (pdc, nodes, 0);
nodes[0].changes = pdc->surface->dirty_info->dirty_age;
pdc->surface->dirty_info->nr_dirty_rcs = 0;
unlock_znode_surface (pdc, nodes);
}
}
}
@@ -599,24 +583,5 @@ const CompositorOps* GUIAPI ServerSelectCompositor (const char* name,
return NULL;
}
const char* GUIAPI ServerGetCurrentCompositor (
const CompositorOps** ops, CompositorCtxt** ctxt)
{
int i;
const CompositorOps* the_ops;
the_ops = ServerSelectCompositor (NULL, ctxt);
if (ops) {
*ops = the_ops;
}
for (i = 0; i < MAX_NR_COMPOSITORS; i++) {
if (compositors [i].ops == the_ops)
return compositors [i].name;
}
return NULL;
}
#endif /* defined(_MGRM_PROCESSES) && defined(_MGSCHEMA_COMPOSITING) */
+14 -36
View File
@@ -1081,12 +1081,6 @@ 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,
@@ -1096,7 +1090,7 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
}
else {
if (!mgIsServer && (SHAREDRES_TOPMOST_LAYER != __mg_layer)) {
goto done;
return;
}
if (!fShow) {
@@ -1115,12 +1109,6 @@ 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 */
@@ -1136,12 +1124,6 @@ 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.
@@ -1168,11 +1150,6 @@ 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 */
@@ -1251,25 +1228,26 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
PDC cur_pdc = (PDC)pdc;
const RECT* prc = NULL;
if (!mgIsServer && (SHAREDRES_TOPMOST_LAYER != __mg_layer)) {
return;
}
prc = &cur_pdc->rc_output;
/* Since 5.0.13 */
if (!fShow) {
GAL_LockSurface(cur_pdc->surface);
/* 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;
}
if (fShow)
GAL_UpdateRect (cur_pdc->surface,
prc->left, prc->top, RECTWP(prc), RECTHP(prc));
/* Since 5.0.13 */
if (fShow) {
GAL_UnlockSurface(cur_pdc->surface);
}
#endif
}
#endif /* _MGHAVE_CURSOR */
+2 -20
View File
@@ -448,11 +448,6 @@ 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,
@@ -477,7 +472,7 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
prc->left, prc->top, RECTWP(prc), RECTHP(prc));
//GAL_SyncUpdate (cur_pdc->surface);
}
goto done;
return;
}
if (fShow && nShowCount >= 0 && pCurCsr) {
@@ -493,12 +488,6 @@ 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)
@@ -527,16 +516,9 @@ void kernel_ShowCursorForGDI(BOOL fShow, void* pdc)
prc = &cur_pdc->rc_output;
/* Since 5.0.13 */
if (!fShow) {
GAL_LockSurface(cur_pdc->surface);
}
else {
if (fShow)
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 */
+4 -22
View File
@@ -472,15 +472,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,
GAL_UpdateRect (cur_pdc->surface,
prc->left, prc->top, RECTWP(prc), RECTHP(prc));
// GAL_SyncUpdate (cur_pdc->surface);
}
}
else {
@@ -504,7 +500,7 @@ void kernel_ShowCursorForGDI (BOOL fShow, void *pdc)
pthread_mutex_unlock(&__mg_mouselock);
// GAL_SyncUpdate (cur_pdc->surface);
}
goto done;
return;
}
if (fShow && nShowCount >= 0 && pCurCsr) {
@@ -522,12 +518,6 @@ 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)
@@ -568,17 +558,9 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
prc = &cur_pdc->rc_output;
/* Since 5.0.13 */
if (!fShow) {
GAL_LockSurface(cur_pdc->surface);
}
else {
if (fShow)
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 */
+19 -34
View File
@@ -104,7 +104,7 @@ static PMAINWIN dskSetActiveWindow (PMAINWIN pWin)
if (pWin == pOldActive)
return pOldActive;
pOldActive = (PMAINWIN) dskSetActiveZOrderNode (__mg_zorder_info, 0, pWin?pWin->idx_znode:0);
pOldActive = (PMAINWIN) dskSetActiveZOrderNode (0, pWin?pWin->idx_znode:0);
#ifndef _MGRM_PROCESSES /*for MiniGUI-Threads, not for MiniGUI-StandAlone*/
if (pOldActive != (PMAINWIN)HWND_INVALID && __mg_ime_wnd)
@@ -232,7 +232,7 @@ static int dskAddNewMainWindow (PMAINWIN pWin)
if (pWin->secondaryDC == HDC_INVALID) {
/* remove the flag of WS_EX_AUTOSECONDARYDC */
pWin->dwExStyle &= ~WS_EX_AUTOSECONDARYDC;
pWin->dwExStyle = pWin->dwExStyle | WS_EX_AUTOSECONDARYDC;
pWin->secondaryDC = 0;
}
@@ -368,15 +368,6 @@ static BOOL dskSetMainWindowAlwaysTop (PMAINWIN pWin, BOOL fSet)
return TRUE;
}
/* Since 5.0.6 */
static inline int dskSetMainWindowGestureFlags (PMAINWIN pWin, DWORD dwFlags)
{
if (dskSetZNodeGestureFlags (0, pWin->idx_znode, dwFlags))
return FALSE;
return TRUE;
}
/* Since 5.0.0 */
static int dskSetWindowMask (HWND pWin, const WINMASKINFO* mask_info)
{
@@ -676,7 +667,7 @@ static LRESULT KeyMessageHandler (UINT message, int scancode, DWORD status)
if (next_node) {
dskMove2Top (0, next_node);
dskSetActiveZOrderNode (__mg_zorder_info, 0, next_node);
dskSetActiveZOrderNode (0, next_node);
}
return 0;
}
@@ -1403,7 +1394,7 @@ static LRESULT WindowMessageHandler(UINT message, PMAINWIN pWin, LPARAM lParam)
else {
from = 0;
}
lock_zi_for_read (zi);
from = __kernel_get_next_znode (zi, from);
@@ -1429,17 +1420,11 @@ 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 */
case MSG_SETALWAYSTOP:
return dskSetMainWindowAlwaysTop (pWin, (BOOL)lParam);
/* Since 5.0.6 */
case MSG_SETGESTUREFLAGS:
return dskSetMainWindowGestureFlags (pWin, (DWORD)lParam);
return dskSetMainWindowAlwaysTop(pWin, (BOOL)lParam);
/* Since 5.0.0 */
case MSG_SETWINDOWMASK:
@@ -1745,6 +1730,11 @@ 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;
@@ -1759,11 +1749,6 @@ static int dskOnRemoveCtrlInstance (PCONTROL pParent, PCONTROL pCtrl)
sg_msgAutoRepeat.hwnd = 0;
}
if (fFound) {
pCtrl->pcci->nUseCount--;
return 0;
}
return -1;
}
@@ -1823,7 +1808,7 @@ static void dskRefreshAllWindow (const RECT* invrc)
info.is_empty_invrc = TRUE;
#ifdef _MGHAVE_MENU
dskForceCloseMenu ();
dskForceCloseMenu ();
#endif
SendMessage (HWND_DESKTOP, MSG_ERASEDESKTOP, 0,
@@ -1870,17 +1855,14 @@ void GUIAPI DesktopUpdateAllWindow(void)
SendMessage(HWND_DESKTOP, MSG_PAINT, 0, 0);
}
static void dskOnTimeout (void)
static void dskOnTimer (void)
{
static DWORD uCounter = 0;
static DWORD blink_counter = 0;
if (sg_msgAutoRepeat.hwnd != 0 &&
__mg_tick_counter >= sg_msgAutoRepeat.time) {
if (sg_msgAutoRepeat.hwnd != 0) {
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))
@@ -2155,10 +2137,7 @@ static LRESULT DesktopWinProc (HWND hWnd, UINT message,
break;
#endif
/* Since 5.0.6, the desktop handles caret blinking in MSG_TIMEOUT
message, and the interval for this message changes to about 0.05s. */
case MSG_TIMEOUT:
dskOnTimeout ();
// Since 5.0.0: MSG_IDLE messages will be generated by PeekMessage.
// BroadcastMessageInThisThread (MSG_IDLE, wParam, 0);
break;
@@ -2192,6 +2171,12 @@ static LRESULT DesktopWinProc (HWND hWnd, UINT message,
dsk_ops->mouse_handler(dt_context, message, wParam, lParam);
break;
/* Since 5.0.0, the desktop only handles caret blinking in MSG_TIMER
message, and the interval for this MSG_TIMER changes to about 0.05s. */
case MSG_TIMER:
dskOnTimer ();
break;
default:
break;
}
+203 -538
View File
File diff suppressed because it is too large Load Diff
+10 -4
View File
@@ -74,7 +74,6 @@
#include "dc.h"
#include "misc.h"
#include "devfont.h"
#include "event.h"
#ifndef WIN32
#include <sys/termios.h>
@@ -103,11 +102,18 @@ 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.
*/
ret = __kernel_alloc_z_order_info (DEF_NR_TOPMOSTS, DEF_NR_NORMALS,
TRUE);
ret = __kernel_alloc_z_order_info (DEF_NR_TOPMOSTS, DEF_NR_NORMALS);
if (ret < 0) {
_WRN_PRINTF ("KERNEL>Desktop: Can not initialize ZOrderInfo!\n");
return FALSE;
@@ -146,7 +152,7 @@ BOOL mg_InitDesktop (void)
void mg_TerminateDesktop (void)
{
if (__mg_dsk_msg_queue) {
mg_FreeMsgQueueForThisThread (TRUE);
mg_FreeMsgQueueForThisThread ();
__mg_dsk_msg_queue = NULL;
}
+5 -17
View File
@@ -72,7 +72,6 @@
#include "dc.h"
#include "misc.h"
#include "devfont.h"
#include "event.h"
/******************************* global data *********************************/
/* pointer to desktop message queue */
@@ -113,8 +112,7 @@ BOOL mg_InitDesktop (void)
/*
* Init ZOrderInfo here.
*/
ret = __kernel_alloc_z_order_info (DEF_NR_TOPMOSTS, DEF_NR_NORMALS,
TRUE);
ret = __kernel_alloc_z_order_info (DEF_NR_TOPMOSTS, DEF_NR_NORMALS);
if (ret < 0) {
_WRN_PRINTF ("KERNEL>Desktop: Can not initialize ZOrderInfo!\n");
return FALSE;
@@ -141,29 +139,19 @@ BOOL mg_InitDesktop (void)
#include "debug.h"
static IDLEHANDLER std_idle_handler;
static BOOL idle_handler_for_desktop_thread (MSGQUEUE *msg_queue, BOOL wait)
{
__mg_update_tick_count (NULL);
return std_idle_handler (msg_queue, wait);
}
void* __kernel_desktop_main (void* data)
{
MSG Msg;
/* init message queue of desktop thread */
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread (TRUE)) ) {
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread ()) ) {
_ERR_PRINTF ("failed to allocate message queue\n");
sem_post ((sem_t*)data);
return NULL;
}
/* For bug reported in Issue #116, under threads mode, the idle handler
for the desktop thread should call __mg_update_tick_count () */
std_idle_handler = __mg_dsk_msg_queue->OnIdle;
__mg_dsk_msg_queue->OnIdle = idle_handler_for_desktop_thread;
/* for threads mode, the idle handler for desktop thread is NULL */
__mg_dsk_msg_queue->OnIdle = NULL;
/* init desktop window */
init_desktop_win ();
@@ -202,7 +190,7 @@ void* __kernel_desktop_main (void* data)
#endif
}
mg_FreeMsgQueueForThisThread (TRUE);
mg_FreeMsgQueueForThisThread ();
__mg_dsk_msg_queue = NULL;
return NULL;
}
+260 -504
View File
File diff suppressed because it is too large Load Diff
+13 -14
View File
@@ -89,9 +89,8 @@
struct timeval __mg_event_timeout;
DWORD __mg_timeout_usec;
DWORD __mg_repeat_usec;
static DWORD timeoutusec;
static DWORD repeatusec;
static DWORD dblclicktime;
#ifndef _MGRM_THREADS
@@ -122,8 +121,8 @@ static void GetTimeout (void)
char szValue [11];
int mytimeoutusec, myrepeatusec;
__mg_timeout_usec = DEF_USEC_TIMEOUT;
__mg_repeat_usec = DEF_REPEAT_TIME;
timeoutusec = DEF_USEC_TIMEOUT;
repeatusec = DEF_REPEAT_TIME;
if (GetMgEtcValue (EVENTPARA, EVENTPARA_REPEATUSEC, szValue, 10) < 0)
return;
@@ -134,8 +133,8 @@ static void GetTimeout (void)
mytimeoutusec = atoi(szValue);
if (myrepeatusec >= 0 && mytimeoutusec > 0) {
__mg_timeout_usec = mytimeoutusec;
__mg_repeat_usec = myrepeatusec;
timeoutusec = mytimeoutusec;
repeatusec = myrepeatusec;
}
}
@@ -209,7 +208,7 @@ static void ResetKeyEvent(void)
IAL_SetLeds (slock | (numlock << 1) | (capslock << 2));
__mg_event_timeout.tv_sec = 0;
__mg_event_timeout.tv_usec = __mg_timeout_usec;
__mg_event_timeout.tv_usec = timeoutusec;
#ifndef _MGRM_THREADS
#ifdef _MGRM_PROCESSES
@@ -217,8 +216,8 @@ static void ResetKeyEvent(void)
SHAREDRES_SHIFTSTATUS = status;
#endif
timeout_threshold = __mg_timeout_usec / 10000;
repeat_threshold = __mg_repeat_usec / 10000;
timeout_threshold = timeoutusec / 10000;
repeat_threshold = repeatusec / 10000;
timeout_count = timeout_threshold;
#endif
}
@@ -632,7 +631,7 @@ BOOL kernel_GetLWEvent (int event, PLWEVENT lwe)
// set repeat time
__mg_event_timeout.tv_sec = 0;
__mg_event_timeout.tv_usec = __mg_repeat_usec;
__mg_event_timeout.tv_usec = repeatusec;
// repeat last event
if (old_lwe.type == LWETYPE_KEY
@@ -653,7 +652,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 = __mg_timeout_usec;
__mg_event_timeout.tv_usec = timeoutusec;
}
lwe->type = LWETYPE_TIMEOUT;
@@ -881,7 +880,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 = __mg_timeout_usec;
__mg_event_timeout.tv_usec = timeoutusec;
return 1;
}
@@ -900,7 +899,7 @@ mouseret:
me->status = status;
memcpy (&old_lwe, lwe, sizeof (LWEVENT));
__mg_event_timeout.tv_sec = 0;
__mg_event_timeout.tv_usec = __mg_timeout_usec;
__mg_event_timeout.tv_usec = timeoutusec;
return 1;
}
#endif
+8 -8
View File
@@ -66,7 +66,7 @@ static struct FIXSTR {
BYTE bitmap[LEN_BITMAP];
int offset[NR_HEAP];
char* heap[NR_HEAP + 1];
#ifdef _MGHAVE_VIRTUAL_WINDOW
#ifdef _MGRM_THREADS
pthread_mutex_t lock;
#endif
} FixStrHeap;
@@ -98,7 +98,7 @@ BOOL mg_InitFixStr (void)
offset += 1<<i;
}
#ifdef _MGHAVE_VIRTUAL_WINDOW
#ifdef _MGRM_THREADS
pthread_mutex_init (&FixStrHeap.lock, NULL);
#endif
return TRUE;
@@ -106,7 +106,7 @@ BOOL mg_InitFixStr (void)
void mg_TerminateFixStr (void)
{
#ifdef _MGHAVE_VIRTUAL_WINDOW
#ifdef _MGRM_THREADS
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 _MGHAVE_VIRTUAL_WINDOW
#ifdef _MGRM_THREADS
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 _MGHAVE_VIRTUAL_WINDOW
#ifdef _MGRM_THREADS
pthread_mutex_unlock (&FixStrHeap.lock);
#endif
#if 0
@@ -181,7 +181,7 @@ char* GUIAPI FixStrAlloc (int len)
bitmap++;
}
#ifdef _MGHAVE_VIRTUAL_WINDOW
#ifdef _MGRM_THREADS
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 _MGHAVE_VIRTUAL_WINDOW
#ifdef _MGRM_THREADS
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 _MGHAVE_VIRTUAL_WINDOW
#ifdef _MGRM_THREADS
pthread_mutex_unlock (&FixStrHeap.lock);
#endif
}
+1 -5
View File
@@ -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 (TRUE)) ) {
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread ()) ) {
err_message (step, "Failed to allocate message queue!");
return step;
}
@@ -611,10 +611,6 @@ void TerminateGUI (int rcByGUI)
if (_is_server) {
mg_TerminateDesktop ();
#ifdef _MGSCHEMA_COMPOSITING
mg_TerminateCompositor ();
#endif
/* Cleanup UNIX domain socket and other IPC objects. */
server_ServerCleanup ();
}
+17 -4
View File
@@ -112,7 +112,7 @@ static void ParseEvent (PLWEVENT lwe)
Msg.message = MSG_TIMEOUT;
Msg.wParam = (WPARAM)lwe->count;
Msg.lParam = 0;
// Since 5.0.0, we do not genenrate MSG_TIMEOUT message here.
// Since 5.0.0, we do not genenrate MSG_TIMEOUT message any more.
// QueueDeskMessage (&Msg);
}
else if (lwe->type == LWETYPE_KEY) {
@@ -391,6 +391,14 @@ 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,11 +578,16 @@ int GUIAPI InitGUI (int args, const char *agr[])
/* init message queue of main GUI thread */
step++;
if (!(msg_queue = mg_AllocMsgQueueForThisThread (TRUE))) {
if (!(msg_queue = mg_AllocMsgQueueForThisThread ())) {
_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)) {
@@ -604,8 +617,6 @@ void GUIAPI TerminateGUI (int not_used)
{
mg_TerminateTimer (FALSE);
mg_FreeMsgQueueForThisThread (TRUE);
/* Since 5.0.0 */
SendNotifyMessage (HWND_DESKTOP, MSG_ENDSESSION, 0, 0);
pthread_join (__mg_dsk_msg_queue->th, NULL);
@@ -644,6 +655,8 @@ void GUIAPI TerminateGUI (int not_used)
miFreeArcCache ();
#endif
mg_FreeMsgQueueForThisThread ();
deleteThreadInfoKey ();
mg_TerminateSliceAllocator();
+18 -28
View File
@@ -60,6 +60,7 @@
#include "gdi.h"
#include "window.h"
#include "blockheap.h"
#include "cliprect.h"
#include "gal.h"
#include "internals.h"
@@ -158,7 +159,7 @@ void mg_DestroyFreeQMSGList (void)
pthread_key_t __mg_threadinfo_key;
#endif
MSGQUEUE* mg_AllocMsgQueueForThisThread (BOOL sign_in)
MSGQUEUE* mg_AllocMsgQueueForThisThread (void)
{
MSGQUEUE* pMsgQueue;
@@ -176,14 +177,13 @@ MSGQUEUE* mg_AllocMsgQueueForThisThread (BOOL sign_in)
pthread_setspecific (__mg_threadinfo_key, pMsgQueue);
#endif
if (sign_in) {
SendMessage (HWND_DESKTOP, MSG_MANAGE_MSGTHREAD,
MSGTHREAD_SIGNIN, (LPARAM)pMsgQueue);
}
// register this new message queue
SendMessage (HWND_DESKTOP, MSG_MANAGE_MSGTHREAD,
MSGTHREAD_SIGNIN, (LPARAM)pMsgQueue);
return pMsgQueue;
}
void mg_FreeMsgQueueForThisThread (BOOL sign_off)
void mg_FreeMsgQueueForThisThread (void)
{
MSGQUEUE* pMsgQueue;
@@ -194,11 +194,6 @@ void mg_FreeMsgQueueForThisThread (BOOL sign_off)
_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);
@@ -828,9 +823,8 @@ checkagain:
goto got_ret;
}
}
else {
else
pMsgQueue->dwState &= ~QS_POSTMSG;
}
}
/*
@@ -866,7 +860,7 @@ checkagain:
/* handle desktop timer here */
if (pMsgQueue == __mg_dsk_msg_queue && pMsgQueue->dwState & QS_DESKTIMER) {
pMsg->hwnd = HWND_DESKTOP;
pMsg->message = MSG_TIMEOUT;
pMsg->message = MSG_TIMER;
pMsg->wParam = 0;
pMsg->lParam = 0;
@@ -955,12 +949,6 @@ 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) {
@@ -970,11 +958,6 @@ checkagain:
}
goto checkagain;
}
else {
if (!pMsgQueue->OnIdle (pMsgQueue, FALE)) {
handle_idle_message (pMsgQueue);
}
}
#endif /* not defined _MGHAVE_VIRTUAL_WINDOW */
/* no message */
@@ -1427,9 +1410,6 @@ 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;
@@ -1441,6 +1421,16 @@ 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;
+8 -31
View File
@@ -51,40 +51,17 @@
** Create date: 2005/08/16
*/
#include <stdlib.h>
size_t __mg_lookfor_unused_slot (unsigned char* bitmap, size_t len_bmp, int set)
int __mg_lookfor_unused_slot (unsigned char* bitmap, int len_bmp, int set)
{
size_t unused = 0;
size_t i, j;
int unused = 0;
int i, j;
for (i = 0; i < len_bmp; i++) {
if (*bitmap) {
unsigned char half_byte = *bitmap & 0xF0;
unsigned char test_byte = 0x80;
if (half_byte) {
for (j = 0; j < 4; j++) {
if (half_byte & test_byte) {
if (set)
*bitmap ^= test_byte;
return unused + j;
}
test_byte = test_byte >> 1;
}
}
half_byte = *bitmap & 0x0F;
test_byte = 0x08;
for (j = 4; j < 8; j++) {
if (half_byte & test_byte) {
if (set)
*bitmap ^= test_byte;
return unused + j;
}
test_byte = test_byte >> 1;
for (j = 0; j < 8; j++) {
if (*bitmap & (0x80 >> j)) {
if (set)
*bitmap &= (~(0x80 >> j));
return unused + j;
}
}
+175 -33
View File
File diff suppressed because it is too large Load Diff
+143 -27
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1472,7 +1472,7 @@ void mg_slice_debug_tree_statistics (void)
su / bf, en, ex);
}
else
_DBG_PRINTF("MGSlice: MemChecker: root=NULL\n");
_MG_PRINTF("MGSlice: MemChecker: root=NULL\n");
pthread_mutex_unlock (&smc_tree_mutex);
+5 -1
View File
@@ -5,9 +5,13 @@ EXTRA_DIST= misc.c systext.c rwops.c endianrw.c nposix.c clipboard.c \
math.c about.c error.c sockio.c rc4.c rc4.h \
makefile.ng makefile.msvc
if MG_MINIMALGDI
libmisc_la_SOURCES = misc.c math.c rwops.c nposix.c
else
libmisc_la_SOURCES = misc.c systext.c rwops.c endianrw.c nposix.c clipboard.c \
math.c about.c license.c anon_file.c rbtree.c map.c \
error.c sockio.c lock_file.c
error.c sockio.c
endif
SRC_FILES = $(libmisc_la_SOURCES)
LIB_NAME=libmisc
+2 -2
View File
@@ -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 ~ 2023 FMSoft Co., Ltd.",
"Copyright (C) 2002 ~ 2020 FMSoft Co., Ltd.",
-1, &rcClient, DT_WORDBREAK | DT_CENTER);
EndPaint (hWnd, hdc);
@@ -228,7 +228,7 @@ HWND GUIAPI OpenAboutDialog (HWND hHosting)
SysPixelColor[IDX_COLOR_darkgray].g,
SysPixelColor[IDX_COLOR_darkgray].b,
0xA0),
CT_ALPHAPIXEL, COLOR_BLEND_LEGACY);
CT_ALPHAPIXEL, 0x80);
if (hMainWnd == HWND_INVALID)
return HWND_INVALID;

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