Compare commits

...
Author SHA1 Message Date
Vincent Wei e0cc3b5580 update version to 5.0.11 2022-12-13 17:10:13 +08:00
Vincent Wei e33d98a702 set pdc->bkmode correctly before calling _gdi_draw_one_glyph() 2022-11-27 16:31:27 +08:00
Vincent Wei 84f3cf048a fix a bug: dx and dy of StretchBlt are reset to zero if it is less than 0 in error 2022-11-27 16:30:34 +08:00
Vincent Wei ea579771a7 tune the implementation of auto-repeat message 2022-11-27 16:28:45 +08:00
Vincent Wei 4db97ead1f rename timeoutusec to __mg_timeout_usec; rename repeatusec to __mg_repeat_usec 2022-11-27 16:21:54 +08:00
Vincent Wei 2338501d21 use CreateMemDCFromMyBitmap instead of common_rgba8888_dc for DrawIcon() 2022-11-27 16:02:22 +08:00
Vincent Wei 81c061c3c8 cleanup 2022-11-27 15:59:52 +08:00
Vincent Wei 356bf08c4b remove code using the obsolete style: TVS_ICONFORSELECT 2022-11-27 15:58:14 +08:00
Vincent Wei 09a27e508f suppress useless print 2022-11-25 16:04:11 +08:00
Vincent Wei 0b636032ee use bkmode_set instead of saving oldbkmode in context, because it may cause the bkmode cannot be restored correctly 2022-11-25 15:25:56 +08:00
Vincent Wei 5f78f6bb37 fix a bug in Issure #106 2022-11-25 11:03:19 +08:00
Vincent Wei 272bc39c84 call __mg_legacy_bidi_map_reorder when getting the visual Achars 2022-11-25 11:01:36 +08:00
Vincent Wei 1e006c0589 cleanup 2022-11-25 11:00:58 +08:00
Vincent Wei 7158eaee0f restore __mg_legacy_bidi_map_reorder function 2022-11-25 11:00:42 +08:00
Vincent Wei abfc47159e tune and add some output for debug 2022-11-25 10:58:03 +08:00
Vincent Wei deade3d887 tuen code for resolve bugs reported in Issue #105 2022-11-13 12:22:12 +08:00
Vincent Wei cf3e0b3d4d tune 2022-11-13 11:54:20 +08:00
Vincent Wei 614deba4b7 cleanup 2022-11-13 11:53:43 +08:00
Vincent Wei 53d40508a4 set bkmode to BM_TRANSPARENT when having WS_EX_TRANSPARENT exStyle 2022-11-13 11:53:16 +08:00
Vincent Wei 39f96f407f use client DC instead of screen DC; restore the alpha component if amask != 0. 2022-11-08 17:28:23 +08:00
Vincent Wei c8c6f470ce tune 2022-11-08 17:23:02 +08:00
Vincent Wei d78b493aad fix a bug mentioned in Issue 96: bad handling for Backspace key 2022-11-08 17:22:40 +08:00
Vincent Wei 26f415f3db update release notes 2022-11-07 20:34:35 +08:00
Vincent Wei b66ef7a2f5 optimize the refresh of scrolled 2022-11-07 20:23:57 +08:00
Vincent Wei 9b89614569 fix bug reported in Issue #96 2022-11-07 19:59:54 +08:00
Vincent Wei 0d170a6f74 use CreateLogFontEx instead of CreateLogFont to follow the new style convention of font name
when creating system logfonts, but the orientation is ignored for the system logfont.
2022-11-03 20:49:50 +08:00
Vincent Wei f0dd4a74d2 Tune implementation of GetTabbedTextExtentPoint: remore odd code 2022-11-03 16:58:24 +08:00
Vincent Wei 692a6b81e0 tune update logical of some controls calling ScrollWindow 2022-11-03 16:11:49 +08:00
Vincent Wei cf49cf2b64 do not call UpdateInvalidClient in ScrollWindow: this may break update logical of control 2022-11-03 16:11:06 +08:00
Vincent Wei b26accf037 cleanup 2022-11-03 15:54:41 +08:00
Vincent Wei 5913d95ff2 debug info 2022-11-03 15:53:44 +08:00
Vincent Wei e1b94799a2 cleanup 2022-11-03 15:53:21 +08:00
Vincent Wei 385db01097 fix some implicit full-through 2022-10-22 11:49:24 +08:00
Vincent Wei d787dea652 call mg_FreeMsgQueueForThisThread immediately in TerminateGUI() 2022-10-19 19:37:06 +08:00
Vincent Wei 0adddb422b fix a bug in dskOnRemoveCtrlInstance for procs runmode 2022-10-19 19:36:16 +08:00
Vincent Wei c444030334 cleanup 2022-10-19 17:54:43 +08:00
Vincent Wei a9da4ddfba Fix a bug reported in Issue #94. 2022-10-19 17:53:39 +08:00
Vincent Wei 57cc74410f fix a minor bug 2022-10-12 15:17:27 +08:00
Vincent Wei 3cc16ababb update release notes 2022-09-28 15:11:52 +08:00
Vincent Wei d4097b577b tune 2022-09-27 21:54:36 +08:00
Vincent Wei 7ef6c14f3f relay MSG_IDLE to active child in PreDefControlProc 2022-09-27 21:54:30 +08:00
Vincent Wei cbb4e32992 Call UpdateInvalidClient in ScrollWindow; Only delaying MSG_IDLE to the child control if the main window is active 2022-09-27 13:20:18 +08:00
Vincent Wei 6bc85062b9 add an internal extended style: WS_EX_ACTIVATED 2022-09-27 13:17:15 +08:00
Vincent Wei b2dee57f4f tune relaying of MSG_IDLE 2022-09-27 11:44:26 +08:00
Vincent Wei a926754a6b Tuning: the MSG_IDLE message will be relayed to the descendant control if the control captured the mouse currently 2022-09-26 20:03:20 +08:00
Vincent Wei 7e470b0e78 tune code according to Issue #90 2022-09-26 20:01:47 +08:00
Vincent Wei 9f81cac662 reset binary age and interface age; update release notes 2022-09-26 14:30:49 +08:00
Vincent Wei a14bdd894a remove #include "window.h" 2022-09-26 14:18:14 +08:00
Vincent Wei 7004e156b8 use inline functions for SetCursor and SetDefaultCursor instead of macros 2022-09-26 14:17:55 +08:00
Vincent Wei e293cf03ba fix bugs when virtual window enabled for sa and procs runmodes 2022-09-26 14:06:09 +08:00
Vincent Wei 07f226f024 tune 2022-09-26 09:45:36 +08:00
Vincent Wei 4b2503e614 fix a bug when quiting dummy engine under compoisiting schema 2022-09-25 22:13:27 +08:00
Vincent Wei 2df5352356 fix a bug which may cause invalid values in log_clusters 2022-09-25 21:13:20 +08:00
Vincent Wei 67ccb2aafd give default RGBA masks for depth 32 when masks not specified 2022-09-24 14:33:49 +08:00
Vincent Wei 9a124dec50 fix a bug in search_win_tree_bfs; send MSG_MANAGE_MSGTHREAD messages only in message.c 2022-09-24 13:42:02 +08:00
Vincent Wei d013822979 add condition for loongarch 2022-09-23 21:45:00 +08:00
Vincent Wei 7f44e948d0 fix a bug mentioned in Issue #89 2022-09-23 16:04:11 +08:00
Vincent Wei 9a94fb9a7c enhance code for some uninitialized fields 2022-09-23 11:20:50 +08:00
Vincent Wei dfc7e95fcd fix the bug reported in Issue #89 2022-09-21 10:40:22 +08:00
Vincent Wei 362b852ec2 update anchor 2022-09-15 15:33:21 +08:00
Vincent Wei 9141e13640 suppress some warnings reported by GCC 12 2022-09-15 15:01:30 +08:00
Vincent Wei 4a22a38e63 update 2022-09-15 15:01:15 +08:00
Vincent Wei c7ce12449b use RUNMODE_LDADD and RUNMODE_SUBDIRS instead of conditions 2022-09-15 15:01:05 +08:00
Vincent Wei 824557b4f1 ignore configure~ 2022-09-15 11:20:18 +08:00
Vincent Wei 022542ef1b tune 2022-09-15 11:08:43 +08:00
Vincent Wei 3b12e71877 update README 2022-09-15 11:01:01 +08:00
Vincent Wei 9593168196 use recursive mutex for locking zorder info if not using *nix 2022-09-15 10:07:50 +08:00
Vincent Wei b5c5c3f8ae fix a deadlock bug (#87): use wrlock_owner to save the current thread holding the wrlock, skip rdlock if the wrlock owner is the current thread 2022-09-14 12:52:29 +08:00
Vincent Wei 492bd649ed update Release Notes for v5.0.10 2022-09-14 08:57:34 +08:00
Vincent Wei bc1a880479 cleanup and enhance shadow engine to use SyncUpdate method 2022-08-21 13:09:00 +08:00
Vincent Wei 0748f26f42 change version to 5.0.10; release notes for 5.0.10 2022-08-20 17:45:45 +08:00
81 changed files with 1111 additions and 1199 deletions
+1
View File
@@ -29,3 +29,4 @@ Makefile.in
/src/font/utils/ucd/ /src/font/utils/ucd/
/src/sysres/font_list /src/sysres/font_list
/src/sysres/license/dat_files/ /src/sysres/license/dat_files/
/configure~
+59 -49
View File
@@ -8,7 +8,7 @@ _TABLE OF CONTENTS_
- [TABLE OF CONTENTS](#table-of-contents) - [TABLE OF CONTENTS](#table-of-contents)
- [INTRODUCTION](#introduction) - [INTRODUCTION](#introduction)
+ [What's MiniGUI](#whats-minigui) + [What's MiniGUI](#whats-minigui)
+ [App Frameworks on MiniGUI](#app-frameworks-on-minigui) + [HVML App Framework on MiniGUI](#hvml-app-framework-on-minigui)
+ [MiniGUI and HybridOS](#minigui-and-hybridos) + [MiniGUI and HybridOS](#minigui-and-hybridos)
+ [Source Code Repositories](#source-code-repositories) + [Source Code Repositories](#source-code-repositories)
- [NEW FEATURES IN VERSION 5.0.x](#new-features-in-version-50x) - [NEW FEATURES IN VERSION 5.0.x](#new-features-in-version-50x)
@@ -37,51 +37,45 @@ _TABLE OF CONTENTS_
### What's MiniGUI ### What's MiniGUI
MiniGUI aims to provide a fast, stable, full-featured, and cross-platform MiniGUI aims to provide a fast, stable, full-featured, and cross-platform windowing and GUI support system,
windowing and GUI support system, which is especially fit for which is especially fit for embedded systems or smart IoT devices based-on Linux/uClinux, eCos,
embedded systems or smart IoT devices based-on Linux/uClinux, eCos, and other and other traditional RTOSes, such as RT-Thread, FreeRTOS, RTEMS, VxWorks, ThreadX, Nucleus, pSOS, uC/OS-II, OSE, and others.
traditional RTOSes, such as RT-Thread, FreeRTOS, RTEMS, VxWorks, ThreadX,
Nucleus, pSOS, uC/OS-II, OSE, and others.
This is the source tree of MiniGUI Core, which provides the windowing This is the source tree of MiniGUI Core, which provides the windowing and graphics interfaces as well as a lot of standard controls (toolkit).
and graphics interfaces as well as a lot of standard controls (toolkit).
MiniGUI is released under GPLv3 and the dual-licensing applies to commercial MiniGUI is released under GPLv3 and the dual-licensing applies to commercial use.
use. In December 1998, the initiator of FMSoft, Wei Yongming, began to develop In December 1998, the initiator of FMSoft, [Vincent Wei], began to develop MiniGUI under the GNU General Public License (GPL).
MiniGUI under the GNU General Public License (GPL). In September 2002, the core In September 2002, the core developers of MiniGUI founded [FMSoft] and started the commercial marketing with the free software.
developers of MiniGUI founded [FMSoft](https://www.fmsoft.cn) and started the By now, FMSoft still continues to release MiniGUI as a free software project.
commercial marketing with the free software. By now, FMSoft still continues to
release MiniGUI as a free software project.
For the live demos, source tarballs, and cases of MiniGUI, you can refer For the live demos, source tarballs, and cases of MiniGUI, you can refer to the following website:
to the following website:
<http://www.minigui.com> <http://www.minigui.com>
### App Frameworks on MiniGUI ### HVML App Framework on MiniGUI
MiniGUI and its components provides a lot of controls/widgets to MiniGUI and its components provide a lot of controls/widgets to help your develop GUI apps in C/C++ programming language.
help your develop GUI apps in C/C++ programming language. However, However, alternatively, you can use the following software to develop your apps in an easy-to-use programming language [HVML].
alternatively, you can choose one of the following frameworks to
develop your apps in a easy-to-use programming language other than C/C++.
* [HybridOS](https://gitlab.fmsoft.cn/HybridOS/hybridos) provides * [HVML] is a descriptive programming language proposed and designed by [Vincent Wei].
a complete software stack to develop an app which have rich functions * [PurC] is the prime interpreter of HVML written in C lauguage.
and excellent expressive in HTML5, CSS3, and JavaScript. * [xGUI Pro] is a full-featured HVML renderer based on the tailored WebKit engine.
* [hiACEJS](https://gitlab.fmsoft.cn/HybridOS/hiACEJS) provides
a light-weight app framework in JavaScript.
You can also choose [HybridOS Lite](https://gitlab.fmsoft.cn/HybridOS/hybridos-lite) In short, the above software suite provides an Electron-like solution that can help people develop cross-platform applications using web front-end technology.
to develop apps with excellent expressive for cost-sensitive devices in C/C++ language. The difference is that the solution replaces JavaScript with HVML and Node.JS with PurC.
It provides an entirely new application framework that isolates the interpreter and renderer from running in separate processes, which brings several benefits.
It greatly reduces the size and resource consumption of the entire solution, improves the overall performance, promotes the interactive responsiveness,
and provides a simpler mechanism to integrate existing C/C++ code modules.
### MiniGUI and HybridOS ### MiniGUI and HybridOS
[HybridOS](https://gitlab.fmsoft.cn/HybridOS/hybridos) is another large open source project [HybridOS] is another large open source project initiated by FMSoft.
initiated by FMSoft. It is a totally new open source operating system designed for It is an open source operating system designed for embedded/AIoT devices and cloud computing environment.
embedded and smart IoT devices and cloud computing environment.
In practice, MiniGUI and the software which are used to integrated with GPU HybridOS provides the complete software stack and the app framework based on HVML for embedded systems.
constitute the graphics stack of HybridOS. You can easily develop your products which has rich functions and excellent expressiveness by using HybridOS.
In practice, MiniGUI and the software which are used to integrated with GPU constitute the graphics stack of HybridOS.
HybridOS uses MiniGUI as the underlying windowing system, and the members of HybridOS uses MiniGUI as the underlying windowing system, and the members of
HybridOS project are now maintaining the whole graphics stack. HybridOS project are now maintaining the whole graphics stack.
@@ -89,7 +83,7 @@ The following chart shows the graphics stack of HybridOS:
``` ```
----------------------------------------------- -----------------------------------------------
| MiniGUI/HybridOS Apps | | MiniGUI/HVML Apps |
|-----------------------------------------------| |-----------------------------------------------|
| | (Graphics Stack) | | | (Graphics Stack) |
| | ---------------------| | | ---------------------|
@@ -105,8 +99,7 @@ The following chart shows the graphics stack of HybridOS:
----------------------------------------------- -----------------------------------------------
``` ```
As shown in the chart above, the HybridOS graphics stack consists of As shown in the chart above, the HybridOS graphics stack consists of the following software:
the following software:
- `libDRM` provides some user land APIs for Linux Direct Rendering Infrastructure. - `libDRM` provides some user land APIs for Linux Direct Rendering Infrastructure.
- `hiDRMDrivers` contains the drivers (user land drivers, not kernel drivers) for - `hiDRMDrivers` contains the drivers (user land drivers, not kernel drivers) for
@@ -133,11 +126,11 @@ FMSoft had created the public repositories for MiniGUI Core, MiniGUI
components, HybridOS, and other open source apps on GitHub. You can visit components, HybridOS, and other open source apps on GitHub. You can visit
them on: them on:
<https://gitlab.fmsoft.cn/VincentWei> <https://github.com/VincentWei>
We now maintain all documents about MiniGUI on the following public repo: We now maintain all documents about MiniGUI on the following public repo:
<https://gitlab.fmsoft.cn/VincentWei/minigui-docs> <https://github.com/VincentWei/minigui-docs>
You can download the source code tarballs of MiniGUI Core, MiniGUI You can download the source code tarballs of MiniGUI Core, MiniGUI
components, and the dependent libraries from the download zone of the site: components, and the dependent libraries from the download zone of the site:
@@ -261,7 +254,7 @@ so that the old applications can smoothly migrate to the new
version. However, there are still some slight changes you need to take care. version. However, there are still some slight changes you need to take care.
For more information, please refer to `RELEASE-NOTES.md` file: For more information, please refer to `RELEASE-NOTES.md` file:
<https://gitlab.fmsoft.cn/VincentWei/minigui/blob/rel-5-0/RELEASE-NOTES.md> <https://github.com/VincentWei/minigui/blob/rel-5-0/RELEASE-NOTES.md>
## NEW FEATURES IN VERSION 4.0.x ## NEW FEATURES IN VERSION 4.0.x
@@ -292,7 +285,7 @@ in order to support [HybridOS Foundation Class Library].
For more information, please refer to `RELEASE-NOTES.md` file: For more information, please refer to `RELEASE-NOTES.md` file:
<https://gitlab.fmsoft.cn/VincentWei/minigui/blob/rel-4-0/RELEASE-NOTES.md> <https://github.com/VincentWei/minigui/blob/rel-4-0/RELEASE-NOTES.md>
Because of the changes of some APIs, we recommended strongly that you Because of the changes of some APIs, we recommended strongly that you
use this version for new projects. use this version for new projects.
@@ -307,7 +300,7 @@ We introduce some new features in MiniGUI Version 3.2.x:
For more information, please refer to `RELEASE-NOTES.md` file: For more information, please refer to `RELEASE-NOTES.md` file:
<https://gitlab.fmsoft.cn/VincentWei/minigui/blob/rel-3-2/RELEASE-NOTES.md> <https://github.com/VincentWei/minigui/blob/rel-3-2/RELEASE-NOTES.md>
## THE RUNTIME MODES OF MINIGUI ## THE RUNTIME MODES OF MINIGUI
@@ -361,15 +354,15 @@ and MiniGUI components, please fetch one of the following repositories
from GitHub and follow the instructions to build MiniGUI Core, from GitHub and follow the instructions to build MiniGUI Core,
MiniGUI components, the samples, and the demonstration programs: MiniGUI components, the samples, and the demonstration programs:
[Build MiniGUI 5.0](https://gitlab.fmsoft.cn/VincentWei/build-minigui-5.0) [Build MiniGUI 5.0](https://github.com/VincentWei/build-minigui-5.0)
or or
[Build MiniGUI 4.0](https://gitlab.fmsoft.cn/VincentWei/build-minigui-4.0) [Build MiniGUI 4.0](https://github.com/VincentWei/build-minigui-4.0)
or or
[Build MiniGUI 3.2](https://gitlab.fmsoft.cn/VincentWei/build-minigui-3.2) [Build MiniGUI 3.2](https://github.com/VincentWei/build-minigui-3.2)
### Building MiniGUI Core ### Building MiniGUI Core
@@ -410,7 +403,7 @@ For more information, please run
Since MiniGUI 4.0.0, we organize the unit test code of MiniGUI APIs in the Since MiniGUI 4.0.0, we organize the unit test code of MiniGUI APIs in the
following repository: following repository:
<https://gitlab.fmsoft.cn/VincentWei/mg-tests> <https://github.com/VincentWei/mg-tests>
If you are interested in hacking the MiniGUI code, please visit this repository. If you are interested in hacking the MiniGUI code, please visit this repository.
@@ -567,15 +560,15 @@ A brief history description of the development progress is listed as follow:
1. Mar., 2020: FMSoft released MiniGUI version 5.0.0. 1. Mar., 2020: FMSoft released MiniGUI version 5.0.0.
1. May., 2021: FMSoft released MiniGUI version 5.0.6. 1. May., 2021: FMSoft released MiniGUI version 5.0.6.
1. Jan., 2022: FMSoft released MiniGUI version 5.0.9. 1. Jan., 2022: FMSoft released MiniGUI version 5.0.9.
1. Sep., 2022: FMSoft released MiniGUI version 5.0.10.
## AUTHORS AND COPYING ## AUTHORS AND COPYING
The original author of MiniGUI is WEI Yongming, and now MiniGUI is The original author of MiniGUI is Vincent Wei, and now MiniGUI is maintained by FMSoft.
maintained by FMSoft. For more information, please refer to For more information, please refer to <http://www.fmsoft.cn>.
<http://www.fmsoft.cn>.
Copyright (C) 2002 ~ 2022, Beijing FMSoft Technologies Co., Ltd. Copyright (C) 2002 ~ 2022, Beijing FMSoft Technologies Co., Ltd.
Copyright (C) 1998 ~ 2002, WEI Yongming Copyright (C) 1998 ~ 2002, Vincent Wei
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -647,3 +640,20 @@ Q: Can I get the tech support from MiniGUI team?
A: Yes, FMSoft can provide you with guaranteed commercial technical A: Yes, FMSoft can provide you with guaranteed commercial technical
support services. Please send messages to <sales@minigui.com>. support services. Please send messages to <sales@minigui.com>.
[Beijing FMSoft Technologies Co., Ltd.]: https://www.fmsoft.cn
[FMSoft Technologies]: https://www.fmsoft.cn
[FMSoft]: https://www.fmsoft.cn
[HybridOS Official Site]: https://hybridos.fmsoft.cn
[MiniGUI Official Site]: https://hvml.fmsoft.cn
[HVML Official Site]: https://hvml.fmsoft.cn
[Vincent Wei]: https://github.com/VincentWei
[MiniGUI]: https://github.com/VincentWei/MiniGUI
[HybridOS]: https://github.com/FMSoftCN/HybridOS
[HVML]: https://github.com/HVML
[PurC]: https://github.com/HVML/PurC
[xGUI Pro]: https://github.com/HVML/xGUI-Pro
[WebKit]: https://webkit.org
+52 -1
View File
@@ -1,5 +1,9 @@
# Release Notes # Release Notes
- [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) - [Version 5.0.9](#version-508)
+ [What's new in version 5.0.9](#whats-new-in-version-508) + [What's new in version 5.0.9](#whats-new-in-version-508)
- [Version 5.0.8](#version-508) - [Version 5.0.8](#version-508)
@@ -24,9 +28,56 @@
+ [Changes leading to incompatibility](#changes-leading-to-incompatibility) + [Changes leading to incompatibility](#changes-leading-to-incompatibility)
+ [Deprecated APIs](#deprecated-apis) + [Deprecated APIs](#deprecated-apis)
## Version 5.0.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 ## Version 5.0.9
On Jan. 14 2022, FMSoft announces the availability of MiniGUI 5.0.9, On Jan. 14, 2022, FMSoft announces the availability of MiniGUI 5.0.9,
which is a bug fixing release with minor enhancements of MiniGUI 5.0.x. which is a bug fixing release with minor enhancements of MiniGUI 5.0.x.
### What's new in version 5.0.9 ### What's new in version 5.0.9
+1 -1
View File
@@ -1,4 +1,4 @@
Version 5.0.9 (2022/01/14) Version 5.0.11 (2022/12/31)
This is a minor enhancement and bugfix release of MiniGUI 5.0.x, the stable version. This is a minor enhancement and bugfix release of MiniGUI 5.0.x, the stable version.
+10 -6
View File
@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.60) AC_PREREQ(2.60)
AC_INIT(libminigui, 5.0.9) AC_INIT(libminigui, 5.0.11)
AC_CONFIG_SRCDIR(src/main/main.c) AC_CONFIG_SRCDIR(src/main/main.c)
dnl Set various version strings - taken gratefully from the SDL sources dnl Set various version strings - taken gratefully from the SDL sources
@@ -16,9 +16,9 @@ dnl Set various version strings - taken gratefully from the SDL sources
# #
MINIGUI_MAJOR_VERSION=5 MINIGUI_MAJOR_VERSION=5
MINIGUI_MINOR_VERSION=0 MINIGUI_MINOR_VERSION=0
MINIGUI_MICRO_VERSION=9 MINIGUI_MICRO_VERSION=11
MINIGUI_INTERFACE_AGE=3 MINIGUI_INTERFACE_AGE=1
MINIGUI_BINARY_AGE=3 MINIGUI_BINARY_AGE=1
MINIGUI_VERSION=$MINIGUI_MAJOR_VERSION.$MINIGUI_MINOR_VERSION.$MINIGUI_MICRO_VERSION MINIGUI_VERSION=$MINIGUI_MAJOR_VERSION.$MINIGUI_MINOR_VERSION.$MINIGUI_MICRO_VERSION
AC_SUBST(MINIGUI_MAJOR_VERSION) AC_SUBST(MINIGUI_MAJOR_VERSION)
@@ -1710,6 +1710,8 @@ case "$runtime_mode" in
AC_DEFINE(_MGRM_STANDALONE, 1, AC_DEFINE(_MGRM_STANDALONE, 1,
[Define if build MiniGUI-Standalone]) [Define if build MiniGUI-Standalone])
MINIGUI_RUNMODE="sa" MINIGUI_RUNMODE="sa"
RUNMODE_LADD="standalone/libstandalone.la"
RUNMODE_SUBDIRS="standalone"
;; ;;
ths) ths)
AC_DEFINE(_MGRM_THREADS, 1, AC_DEFINE(_MGRM_THREADS, 1,
@@ -1722,6 +1724,8 @@ case "$runtime_mode" in
AC_DEFINE(_MGRM_PROCESSES, 1, AC_DEFINE(_MGRM_PROCESSES, 1,
[Define if build MiniGUI-Processes]) [Define if build MiniGUI-Processes])
MINIGUI_RUNMODE="procs" MINIGUI_RUNMODE="procs"
RUNMODE_LADD="server/libserver.la client/libclient.la"
RUNMODE_SUBDIRS="server client"
if test "x$compositing_schema" = "xyes"; then if test "x$compositing_schema" = "xyes"; then
surface_schema="compositing" surface_schema="compositing"
fi fi
@@ -2665,9 +2669,9 @@ AC_SUBST(VIDEO_SUBDIRS)
AC_SUBST(VIDEO_DRIVERS) AC_SUBST(VIDEO_DRIVERS)
AC_SUBST(DEP_LIBS) AC_SUBST(DEP_LIBS)
AC_SUBST(MINIGUI_RUNMODE) AC_SUBST(MINIGUI_RUNMODE)
AC_SUBST(RUNMODE_LADD)
AC_SUBST(RUNMODE_SUBDIRS)
AM_CONDITIONAL(MGRM_PROCESSES, test "x$runtime_mode" = "xprocs")
AM_CONDITIONAL(MGRM_STANDALONE, test "x$runtime_mode" = "xsa")
AM_CONDITIONAL(MGIAL_LIBINPUT, test "x$build_libinput_ial_engine" = "xyes") AM_CONDITIONAL(MGIAL_LIBINPUT, test "x$build_libinput_ial_engine" = "xyes")
AM_CONDITIONAL(MGIAL_SINGLETOUCHKEY, test "x$buid_singletouchkey_ial_engine" = "xyes") AM_CONDITIONAL(MGIAL_SINGLETOUCHKEY, test "x$buid_singletouchkey_ial_engine" = "xyes")
AM_CONDITIONAL(MGIAL_CONSOLE, test "x$build_console_ial_engine" = "xyes") AM_CONDITIONAL(MGIAL_CONSOLE, test "x$build_console_ial_engine" = "xyes")
+1 -1
View File
@@ -127,7 +127,7 @@ defaultmode=800x600-16bpp
[shadow] [shadow]
real_engine=pc_xvfb real_engine=pc_xvfb
defaultmode=800x600-16bpp defaultmode=800x600-16bpp
rotate_screen=normal rotate_screen=ccw
#}} #}}
#{{ifdef _MGGAL_MLSHADOW #{{ifdef _MGGAL_MLSHADOW
+1
View File
@@ -311,6 +311,7 @@ MGUI_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
defined(__amd64) || \ defined(__amd64) || \
(defined(__alpha__) || defined(__alpha)) || \ (defined(__alpha__) || defined(__alpha)) || \
defined(__arm__) || defined(__aarch64__) || \ defined(__arm__) || defined(__aarch64__) || \
defined(__loongarch__) || \
defined(__riscv) || \ defined(__riscv) || \
(defined(__CC_ARM) && !defined(__BIG_ENDIAN)) || \ (defined(__CC_ARM) && !defined(__BIG_ENDIAN)) || \
(defined(__mips__) && defined(__MIPSEL__)) || \ (defined(__mips__) && defined(__MIPSEL__)) || \
+24 -25
View File
@@ -131,7 +131,31 @@
#define IAL_EVENT_GESTURE_PINCH_UPDATE 0x0084 #define IAL_EVENT_GESTURE_PINCH_UPDATE 0x0084
#define IAL_EVENT_GESTURE_PINCH_END 0x0085 #define IAL_EVENT_GESTURE_PINCH_END 0x0085
#define TABLET_TOOL_CHANGED_X (1 << 0)
#define TABLET_TOOL_CHANGED_Y (1 << 1)
#define TABLET_TOOL_CHANGED_PRESSURE (1 << 2)
#define TABLET_TOOL_CHANGED_DISTANCE (1 << 3)
#define TABLET_TOOL_CHANGED_TILT_X (1 << 4)
#define TABLET_TOOL_CHANGED_TILT_Y (1 << 5)
#define TABLET_TOOL_CHANGED_ROTATION (1 << 6)
#define TABLET_TOOL_CHANGED_SLIDER (1 << 7)
#define TABLET_TOOL_CHANGED_SIZE_MAJOR (1 << 8)
#define TABLET_TOOL_CHANGED_SIZE_MINOR (1 << 9)
#define TABLET_TOOL_CHANGED_WHEEL (1 << 10)
#ifndef TABLET_TOOL_X #ifndef TABLET_TOOL_X
#define TABLET_TOOL_X 0
#define TABLET_TOOL_Y 1
#define TABLET_TOOL_PRESSURE 2
#define TABLET_TOOL_DISTANCE 3
#define TABLET_TOOL_TILT_X 4
#define TABLET_TOOL_TILT_Y 5
#define TABLET_TOOL_ROTATION 6
#define TABLET_TOOL_SLIDER 7
#define TABLET_TOOL_SIZE_MAJOR 8
#define TABLET_TOOL_SIZE_MINOR 9
#define TABLET_TOOL_WHEEL 10
#define TABLET_TOOL_PROXIMITY_STATE_INVALID 0 #define TABLET_TOOL_PROXIMITY_STATE_INVALID 0
#define TABLET_TOOL_PROXIMITY_STATE_OUT 1 #define TABLET_TOOL_PROXIMITY_STATE_OUT 1
#define TABLET_TOOL_PROXIMITY_STATE_IN 2 #define TABLET_TOOL_PROXIMITY_STATE_IN 2
@@ -149,31 +173,6 @@
#define TABLET_PAD_STRIP_SOURCE_UNKNOWN 0 #define TABLET_PAD_STRIP_SOURCE_UNKNOWN 0
#define TABLET_PAD_STRIP_SOURCE_FINGER 1 #define TABLET_PAD_STRIP_SOURCE_FINGER 1
#define TABLET_TOOL_CHANGED_X (1 << 0)
#define TABLET_TOOL_CHANGED_Y (1 << 1)
#define TABLET_TOOL_CHANGED_PRESSURE (1 << 2)
#define TABLET_TOOL_CHANGED_DISTANCE (1 << 3)
#define TABLET_TOOL_CHANGED_TILT_X (1 << 4)
#define TABLET_TOOL_CHANGED_TILT_Y (1 << 5)
#define TABLET_TOOL_CHANGED_ROTATION (1 << 6)
#define TABLET_TOOL_CHANGED_SLIDER (1 << 7)
#define TABLET_TOOL_CHANGED_SIZE_MAJOR (1 << 8)
#define TABLET_TOOL_CHANGED_SIZE_MINOR (1 << 9)
#define TABLET_TOOL_CHANGED_WHEEL (1 << 10)
#define TABLET_TOOL_X 0
#define TABLET_TOOL_Y 1
#define TABLET_TOOL_PRESSURE 2
#define TABLET_TOOL_DISTANCE 3
#define TABLET_TOOL_TILT_X 4
#define TABLET_TOOL_TILT_Y 5
#define TABLET_TOOL_ROTATION 6
#define TABLET_TOOL_SLIDER 7
#define TABLET_TOOL_SIZE_MAJOR 8
#define TABLET_TOOL_SIZE_MINOR 9
#define TABLET_TOOL_WHEEL 10
#endif #endif
#define IAL_EVENT_TABLET_TOOL_AXIS 0x0090 #define IAL_EVENT_TABLET_TOOL_AXIS 0x0090
+1 -1
View File
@@ -587,7 +587,7 @@ enum {
* \sa InitBlockDataHeap, DestroyBlockDataHeap * \sa InitBlockDataHeap, DestroyBlockDataHeap
*/ */
typedef struct _BLOCKHEAP { typedef struct _BLOCKHEAP {
#ifdef _MGRM_THREADS #ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_t lock; pthread_mutex_t lock;
#endif #endif
/** Size of one block element in bytes. */ /** Size of one block element in bytes. */
+8 -4
View File
@@ -4097,7 +4097,7 @@ static inline int GUIAPI ShowCursor (BOOL fShow) {
#endif /* !_MGHAVE_CURSOR */ #endif /* !_MGHAVE_CURSOR */
/** /**
* \def SetCursor(hcsr) * \fn HCURSOR SetCursor(HCURSOR hcsr)
* \brief Changes the current cursor. * \brief Changes the current cursor.
* *
* This function changes the current cursor to be \a hcsr. * This function changes the current cursor to be \a hcsr.
@@ -4110,10 +4110,12 @@ static inline int GUIAPI ShowCursor (BOOL fShow) {
* *
* \sa SetCursorEx, SetDefaultCursor * \sa SetCursorEx, SetDefaultCursor
*/ */
#define SetCursor(hcsr) SetCursorEx (hcsr, FALSE) static inline HCURSOR SetCursor(HCURSOR hcsr) {
return SetCursorEx (hcsr, FALSE);
}
/** /**
* \def SetDefaultCursor(hcsr) * \fn HCURSOR SetDefaultCursor(HCURSOR hcsr)
* \brief Changes the current cursor, and set it as the default cursor. * \brief Changes the current cursor, and set it as the default cursor.
* *
* This function changes the current cursor to be \a hcsr, and set it as * This function changes the current cursor to be \a hcsr, and set it as
@@ -4127,7 +4129,9 @@ static inline int GUIAPI ShowCursor (BOOL fShow) {
* *
* \sa SetCursorEx, SetCursor * \sa SetCursorEx, SetCursor
*/ */
#define SetDefaultCursor(hcsr) SetCursorEx (hcsr, TRUE) static inline HCURSOR SetDefaultCursor(HCURSOR hcsr) {
return SetCursorEx (hcsr, TRUE);
}
/** @} end of cursor_fns */ /** @} end of cursor_fns */
+3
View File
@@ -2905,6 +2905,9 @@ typedef struct _WINMASKINFO {
* *
* This message is sent to the all main windows when the system * This message is sent to the all main windows when the system
* enters idle loop. * enters idle loop.
*
* Since 5.0.10, this messasge will be relayed to the active child control
* if the main window is currently active.
*/ */
#define MSG_IDLE 0x0142 #define MSG_IDLE 0x0142
+6 -22
View File
@@ -1,4 +1,4 @@
COMMON_SUBDIRS = libc misc main kernel sysres ial control ex_ctrl font gui mybmp include textedit COMMON_SUBDIRS = libc misc main kernel sysres ial control ex_ctrl font gui mybmp include textedit newgal newgdi
COMMON_LADD = \ COMMON_LADD = \
libc/liblibc.la \ libc/liblibc.la \
@@ -13,31 +13,15 @@ COMMON_LADD = \
mybmp/libmybmp.la \ mybmp/libmybmp.la \
kernel/libkernel.la \ kernel/libkernel.la \
sysres/libsysres.la \ sysres/libsysres.la \
textedit/libtextedit.la textedit/libtextedit.la \
newgal/libnewgal.la \
if MGRM_STANDALONE newgdi/libnewgdi.la
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 DIST_SUBDIRS = $(COMMON_SUBDIRS) newgal newgdi server client standalone
SUBDIRS = $(COMMON_SUBDIRS) $(NEWGAL_SUBDIRS) $(LITE_SUBDIRS) SUBDIRS = $(COMMON_SUBDIRS) @RUNMODE_SUBDIRS@
MGSOURCES = template.c template.h MGSOURCES = template.c template.h
MGLIBADD = $(COMMON_LADD) \ MGLIBADD = $(COMMON_LADD) @RUNMODE_LADD@
$(LITE_LADD) \
$(NEWGAL_LADD)
MGLDFLAGS = -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) MGLDFLAGS = -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
lib_LTLIBRARIES=libminigui_@MGLIB_SUFFIX@.la lib_LTLIBRARIES=libminigui_@MGLIB_SUFFIX@.la
+54 -44
View File
@@ -210,6 +210,7 @@ static void setup_dc (HWND hWnd, BIDISLEDITDATA *sled, HDC hdc, BOOL bSel)
DWORD dwStyle = GetWindowStyle (hWnd); DWORD dwStyle = GetWindowStyle (hWnd);
if (!bSel) { if (!bSel) {
SetBkMode (hdc, BM_TRANSPARENT);
if (dwStyle & WS_DISABLED) if (dwStyle & WS_DISABLED)
SetTextColor (hdc, SetTextColor (hdc,
@@ -1069,6 +1070,7 @@ static int ascii_bidi_type[] = {
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON,
BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON,
/*0x60~0x6f*/ /*0x60~0x6f*/
BIDI_TYPE_ON, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
@@ -1085,21 +1087,23 @@ static int ascii_bidi_type[] = {
static int inline get_char_bidi_type (LOGFONT* logfont, Achar32 chv) static int inline get_char_bidi_type (LOGFONT* logfont, Achar32 chv)
{ {
DEVFONT* devfont; DEVFONT* devfont;
int bidi_type = BIDI_TYPE_LTR;
if (IS_MBCHV(chv)) { if (IS_MBCHV(chv)) {
devfont = logfont->devfonts[1]; devfont = logfont->devfonts[1];
if (devfont->charset_ops->bidi_char_type) { if (devfont->charset_ops->bidi_char_type) {
return devfont->charset_ops->bidi_char_type (chv); bidi_type = devfont->charset_ops->bidi_char_type (chv);
}
else {
return BIDI_TYPE_LTR;
} }
} }
else { else {
return ascii_bidi_type[chv]; assert(chv < 0x80);
bidi_type = ascii_bidi_type[chv];
} }
_DBG_PRINTF("chv: %X: bidi_type: %x\n", chv, bidi_type);
return bidi_type;
} }
static int get_text_rl_type (PLOGFONT logfont, char* newtext, int l_char_type, static int get_text_rl_type (PLOGFONT logfont, char* newtext, int l_char_type,
int r_char_type, int line_type) int r_char_type, int line_type)
@@ -1108,53 +1112,60 @@ static int get_text_rl_type (PLOGFONT logfont, char* newtext, int l_char_type,
Achar32 chv; Achar32 chv;
chv = GetACharValue (logfont, newtext, strlen(newtext), NULL, 0); chv = GetACharValue (logfont, newtext, strlen(newtext), NULL, 0);
if (chv == INV_ACHAR_VALUE) int type = CHAR_TYPE_UNKKOWN;
return -1;
if (chv == INV_ACHAR_VALUE) {
goto done;
}
bidi_type = get_char_bidi_type (logfont, chv); bidi_type = get_char_bidi_type (logfont, chv);
if (BIDI_IS_STRONG(bidi_type)) if (BIDI_IS_STRONG(bidi_type)) {
{ if (BIDI_IS_RTL(bidi_type)) {
if (BIDI_IS_RTL(bidi_type)) type = CHAR_TYPE_RTL;
{ goto done;
return CHAR_TYPE_RTL;
} }
else else {
{ type = CHAR_TYPE_LTR;
return CHAR_TYPE_LTR; goto done;
} }
} }
if (BIDI_IS_NUMBER(bidi_type)) if (BIDI_IS_NUMBER(bidi_type)) {
{ type = CHAR_TYPE_LTR;
return CHAR_TYPE_LTR; goto done;
} }
if (l_char_type == r_char_type) if (l_char_type == r_char_type) {
{ type = l_char_type;
return l_char_type; goto done;
} }
/* no left char */ /* no left char */
else if (l_char_type == -1) else if (l_char_type == CHAR_TYPE_UNKKOWN) {
{
if (BIDI_IS_WEAK (bidi_type)) if (BIDI_IS_WEAK (bidi_type))
return r_char_type; type = r_char_type;
else else
return line_type; type = line_type;
goto done;
} }
/* no right char */ /* no right char */
else if (r_char_type == -1) else if (r_char_type == CHAR_TYPE_UNKKOWN) {
{
if (BIDI_IS_WEAK (bidi_type)) if (BIDI_IS_WEAK (bidi_type))
return l_char_type; type = l_char_type;
else else
return line_type; type = line_type;
goto done;
} }
else else {
{ type = line_type;
return line_type;
} }
_DBG_PRINTF("l_char_type: %d, r_char_type: %d, line_type: %d, "
"type for %X: %d\n",
l_char_type, r_char_type, line_type, chv, type);
done:
return type;
} }
static int get_line_rl_type (ACHARMAPINFO* map, int len) static int get_line_rl_type (ACHARMAPINFO* map, int len)
@@ -2133,7 +2144,7 @@ esright_input_char_refresh (HWND hWnd,
scroll_rc.right = cur_caret_x; scroll_rc.right = cur_caret_x;
ScrollWindow(hWnd, -scroll_len, 0, &scroll_rc, NULL); ScrollWindow(hWnd, -scroll_len, 0, &scroll_rc, NULL);
UpdateWindow(hWnd, FALSE); UpdateInvalidClient(hWnd, TRUE);
edtSetCaretPos (hWnd, sled); edtSetCaretPos (hWnd, sled);
sled->changed = TRUE; sled->changed = TRUE;
@@ -2504,8 +2515,6 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
unsigned char charBuffer [4]; unsigned char charBuffer [4];
int chars; int chars;
_DBG_PRINTF("get char-----------------char----%p\n", (PVOID)wParam);
if (dwStyle & ES_READONLY) if (dwStyle & ES_READONLY)
return 0; return 0;
@@ -2526,9 +2535,6 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
else { else {
chars = 1; chars = 1;
if (charBuffer [0] == 127) // BS
charBuffer [0] = '\b';
if (dwStyle & ES_UPPERCASE) { if (dwStyle & ES_UPPERCASE) {
charBuffer [0] = toupper (charBuffer[0]); charBuffer [0] = toupper (charBuffer[0]);
} }
@@ -2537,12 +2543,12 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
} }
} }
if (chars == 1) { if (chars > 1) {
if (charBuffer [0] < 0x20 && charBuffer[0] != '\b') //FIXME _WRN_PRINTF("BIDISLEDIT only support ISO8859-6 charset\n");
return 0; return 0;
} }
else if (charBuffer [0] == '\b' || charBuffer [0] == 0x7F) {
if (wParam == '\b') { // backspace // BS or DEL
int del = 1; int del = 1;
if (sled->editPos == 0 && sled->selStart == sled->selEnd) if (sled->editPos == 0 && sled->selStart == sled->selEnd)
@@ -2564,9 +2570,12 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
sleBackspaceText (hWnd, sled, del, FALSE, FALSE); sleBackspaceText (hWnd, sled, del, FALSE, FALSE);
} }
} }
else{ else if (charBuffer [0] < 0x20) {
// ignore all other control characters.
return 0;
}
else {
if (dwStyle & ES_LEFT) { if (dwStyle & ES_LEFT) {
//if ((dwStyle&0xffff) == ES_LEFT) {
esleft_input_char_refresh(hWnd, sled, (char*)charBuffer, chars); esleft_input_char_refresh(hWnd, sled, (char*)charBuffer, chars);
set_edit_caret_pos(hWnd, sled); set_edit_caret_pos(hWnd, sled);
@@ -2586,6 +2595,7 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
sleInsertText (hWnd, sled, (char* )charBuffer, chars, FALSE); sleInsertText (hWnd, sled, (char* )charBuffer, chars, FALSE);
} }
} }
return 0; return 0;
} }
+11 -13
View File
@@ -299,7 +299,15 @@ static void change_status_from_pose (PCONTROL pctrl, int new_pose,
} }
} }
/*complete a click if the click if valid /* DK: When the radio or check button state changes do not erase the background,
* and the prospects for direct rendering */
btnGetRects (pctrl, &rcClient, &rcContent, &rcBitmap);
if (BUTTON_IS_PUSHBTN(pctrl) || (pctrl->dwStyle & BS_PUSHLIKE))
InvalidateRect((HWND)pctrl, NULL, TRUE);
else
InvalidateRect((HWND)pctrl, &rcBitmap, FALSE);
/* complete a click if the click if valid
* (mouse lbutton up in button )*/ * (mouse lbutton up in button )*/
if (old_pose == BST_PUSHED && new_pose != BST_DISABLE if (old_pose == BST_PUSHED && new_pose != BST_DISABLE
&& change_valid) && change_valid)
@@ -312,14 +320,6 @@ static void change_status_from_pose (PCONTROL pctrl, int new_pose,
NotifyParent ((HWND)pctrl, pctrl->id, BN_CLICKED); NotifyParent ((HWND)pctrl, pctrl->id, BN_CLICKED);
} }
/* DK: When the radio or check button state changes do not erase the background,
* and the prospects for direct rendering */
btnGetRects (pctrl, &rcClient, &rcContent, &rcBitmap);
if (BUTTON_IS_PUSHBTN(pctrl) || (pctrl->dwStyle & BS_PUSHLIKE))
InvalidateRect((HWND)pctrl, NULL, TRUE);
else
InvalidateRect((HWND)pctrl, &rcBitmap, FALSE);
} }
/*btnGetRects: /*btnGetRects:
@@ -423,8 +423,8 @@ static void draw_bitmap_button (PCONTROL pctrl, HDC hdc, DWORD dwStyle,
GetClientRect ((HWND)pctrl, &prcClient); GetClientRect ((HWND)pctrl, &prcClient);
if (dwStyle & BS_REALSIZEIMAGE) { if (dwStyle & BS_REALSIZEIMAGE) {
x += (w - bmp->bmWidth) >> 1; x += (int)(w - bmp->bmWidth) >> 1;
y += (h - bmp->bmHeight) >> 1; y += (int)(h - bmp->bmHeight) >> 1;
w = h = 0; w = h = 0;
if (bmp->bmWidth > RECTW(prcClient)){ if (bmp->bmWidth > RECTW(prcClient)){
@@ -847,8 +847,6 @@ static LRESULT ButtonCtrlProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
break; break;
} }
case BM_SETSTYLE: case BM_SETSTYLE:
pctrl->dwStyle &= 0xFFFF0000; pctrl->dwStyle &= 0xFFFF0000;
pctrl->dwStyle |= (DWORD)(wParam & 0x0000FFFF); pctrl->dwStyle |= (DWORD)(wParam & 0x0000FFFF);
+8 -11
View File
@@ -1678,7 +1678,7 @@ esright_input_char_refresh (HWND hWnd,
scroll_rc.right = cur_caret_x; scroll_rc.right = cur_caret_x;
ScrollWindow(hWnd, -scroll_len, 0, &scroll_rc, NULL); ScrollWindow(hWnd, -scroll_len, 0, &scroll_rc, NULL);
UpdateWindow(hWnd, FALSE); UpdateInvalidClient(hWnd, TRUE);
edtSetCaretPos (hWnd, sled); edtSetCaretPos (hWnd, sled);
sled->changed = TRUE; sled->changed = TRUE;
@@ -2143,9 +2143,6 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
else { else {
chars = 1; chars = 1;
if (charBuffer [0] == 127) // BS
charBuffer [0] = '\b';
if (dwStyle & ES_UPPERCASE) { if (dwStyle & ES_UPPERCASE) {
charBuffer [0] = toupper (charBuffer[0]); charBuffer [0] = toupper (charBuffer[0]);
} }
@@ -2154,12 +2151,8 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
} }
} }
if (chars == 1) { if (chars == 1 && (charBuffer[0] == '\b' || charBuffer[0] == 0x7F)) {
if (charBuffer [0] < 0x20 && charBuffer[0] != '\b') //FIXME // ASCII BS or DEL
return 0;
}
if (charBuffer[0] == '\b') { //backspace
int del; int del;
if (sled->editPos == 0 && sled->selStart == sled->selEnd) if (sled->editPos == 0 && sled->selStart == sled->selEnd)
@@ -2184,7 +2177,11 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
sleInsertText (hWnd, sled, NULL, del); sleInsertText (hWnd, sled, NULL, del);
} }
} }
else{ else if (chars == 1 && charBuffer [0] < 0x20) {
// ignore all other ASCII control characters.
return 0;
}
else {
if (dwStyle & ES_LEFT) { if (dwStyle & ES_LEFT) {
esleft_input_char_refresh(hWnd, sled, (char*)charBuffer, chars); esleft_input_char_refresh(hWnd, sled, (char*)charBuffer, chars);
set_edit_caret_pos(hWnd, sled); set_edit_caret_pos(hWnd, sled);
+4
View File
@@ -172,6 +172,10 @@ BOOL scrolled_set_cont_pos (HWND hWnd, PSCRDATA pscrdata, int cont_x, int cont_y
SetScrollPos (hWnd, SB_VERT, cont_y); SetScrollPos (hWnd, SB_VERT, cont_y);
bChange = TRUE; bChange = TRUE;
} }
if (bChange)
UpdateInvalidClient(hWnd, FALSE);
return bChange; return bChange;
} }
+9 -4
View File
@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems * and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices. * and smart IoT devices.
* *
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming * Copyright (C) 1998~2002, WEI Yongming
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@@ -493,10 +493,15 @@ LRESULT ScrollViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
break; break;
} }
case MSG_DESTROY: case MSG_DESTROY: {
scrollview_destroy (psvdata); /* suppress a warning about calling free() before using the pointer */
free (psvdata); PSVDATA svdata = (PSVDATA) GetWindowAdditionalData2 (hWnd);
if (svdata) {
scrollview_destroy(svdata);
free (svdata);
}
break; break;
}
case MSG_GETDLGCODE: case MSG_GETDLGCODE:
return DLGC_WANTARROWS; return DLGC_WANTARROWS;
+1 -4
View File
@@ -2096,7 +2096,6 @@ static void teOnChar (HWND hWnd, PTEDATA ptedata, WPARAM wParam)
rcInv.right = ptedata->svdata.scrdata.nContWidth; rcInv.right = ptedata->svdata.scrdata.nContWidth;
rcInv.bottom = rcInv.top + ptedata->nLineHeight - ptedata->nLineBaseH; rcInv.bottom = rcInv.top + ptedata->nLineHeight - ptedata->nLineBaseH;
REFRESH_NODE_EX(node, &rcInv); REFRESH_NODE_EX(node, &rcInv);
// UpdateWindow(hWnd, FALSE);
newlinenr = NODE_LINENR(node); newlinenr = NODE_LINENR(node);
rcInv.left = 0; rcInv.left = 0;
@@ -2104,12 +2103,10 @@ static void teOnChar (HWND hWnd, PTEDATA ptedata, WPARAM wParam)
rcInv.top += ptedata->nLineHeight; rcInv.top += ptedata->nLineHeight;
rcInv.bottom = rcInv.top + ptedata->nLineHeight - ptedata->nLineBaseH; rcInv.bottom = rcInv.top + ptedata->nLineHeight - ptedata->nLineBaseH;
REFRESH_NODE_EX(node, &rcInv); REFRESH_NODE_EX(node, &rcInv);
// UpdateWindow(hWnd, FALSE);
} }
/* houhh 20090814, UpdataWindow will invalidate all edit area, but /* houhh 20090814, UpdataWindow will invalidate all edit area, but
* erase area is not same with msg_paint area.*/ * erase area is not same with msg_paint area.*/
UpdateWindow(hWnd, FALSE); UpdateInvalidClient(hWnd, TRUE);
//SendMessage(hWnd, MSG_PAINT, 0, 0);
} }
} }
else { else {
+2 -2
View File
@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems * and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices. * and smart IoT devices.
* *
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming * Copyright (C) 1998~2002, WEI Yongming
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@@ -283,7 +283,7 @@ static void DrawCoolBox (HWND hWnd, HDC hdc, PCOOLBARCTRL pdata)
WINDOWINFO *info; WINDOWINFO *info;
RECT rc; RECT rc;
if (tmpdata->Caption == NULL || tmpdata->Caption [0] == '\0') if (tmpdata->Caption [0] == '\0')
break; break;
GetTextExtent (hdc, tmpdata->Caption, -1, &size); GetTextExtent (hdc, tmpdata->Caption, -1, &size);
+4 -4
View File
@@ -80,17 +80,17 @@ static void update_viewport (gvGridViewData *view, int from, int to, int is_row)
{ {
RECT r; RECT r;
GetClientRect (view->hCtrl, &r); GetClientRect(view->hCtrl, &r);
if (is_row) { if (is_row) {
r.top = from; r.top = from;
ScrollWindow (view->hCtrl, 0, to, &r, NULL); ScrollWindow(view->hCtrl, 0, to, &r, NULL);
} }
else { else {
r.left = from; r.left = from;
ScrollWindow (view->hCtrl, to, 0, &r, NULL); ScrollWindow(view->hCtrl, to, 0, &r, NULL);
} }
UpdateWindow(view->hCtrl, FALSE); UpdateInvalidClient(view->hCtrl, FALSE);
} }
// scroll function {{{ // scroll function {{{
+2
View File
@@ -157,6 +157,8 @@ static int isInItem (MgList *mglst, int mouseX, int mouseY,
index = row * pivlist->nCol + col; index = row * pivlist->nCol + col;
pci = (IconviewItem *)mglist_getitem_byindex (mglst, index); pci = (IconviewItem *)mglist_getitem_byindex (mglst, index);
if (pci == NULL)
return -1;
if (pRet) if (pRet)
*pRet = (MgItem*)pci; *pRet = (MgItem*)pci;
+9 -16
View File
@@ -93,14 +93,15 @@ BOOL RegisterTreeViewControl (void)
const WINDOW_ELEMENT_RENDERER * rdr = const WINDOW_ELEMENT_RENDERER * rdr =
GetDefaultWindowElementRenderer(); GetDefaultWindowElementRenderer();
if (!(icon_fold = (HICON)RetrieveRes(gui_GetIconFile(rdr->name,
if (!(icon_fold = (HICON)RetrieveRes(gui_GetIconFile(rdr->name, SYSICON_FOLD, szValue)))) { SYSICON_FOLD, szValue)))) {
if (!(icon_fold = LoadSystemIcon (SYSICON_FOLD, 0))) { if (!(icon_fold = LoadSystemIcon (SYSICON_FOLD, 0))) {
return FALSE; return FALSE;
} }
} }
if (!(icon_unfold = (HICON)RetrieveRes(gui_GetIconFile(rdr->name, SYSICON_UNFOLD, szValue)))) { if (!(icon_unfold = (HICON)RetrieveRes(gui_GetIconFile(rdr->name,
SYSICON_UNFOLD, szValue)))) {
if (!(icon_unfold = LoadSystemIcon (SYSICON_UNFOLD, 0))) { if (!(icon_unfold = LoadSystemIcon (SYSICON_UNFOLD, 0))) {
DestroyIcon (icon_fold); DestroyIcon (icon_fold);
icon_fold = 0; icon_fold = 0;
@@ -180,6 +181,7 @@ static BOOL tvInitTVData (HWND hwnd, PTVDATA pData, DWORD dwStyle, PTVITEMINFO r
tvRoot->hIconFold = root_ii->hIconFold; tvRoot->hIconFold = root_ii->hIconFold;
else else
tvRoot->hIconFold = ICON_FOLD; tvRoot->hIconFold = ICON_FOLD;
if (root_ii && root_ii->hIconUnfold) if (root_ii && root_ii->hIconUnfold)
tvRoot->hIconUnfold = root_ii->hIconUnfold; tvRoot->hIconUnfold = root_ii->hIconUnfold;
else else
@@ -632,21 +634,12 @@ static void tvDrawItem (HWND hWnd, HDC hdc, PTVDATA pData, int centerX, int cent
centerX += (h>>1) + TV_BOXGAP; centerX += (h>>1) + TV_BOXGAP;
if (pData->dwStyle & TVS_WITHICON) { if (pData->dwStyle & TVS_WITHICON) {
if (!(pData->dwStyle & TVS_ICONFORSELECT) if (p->child != NULL && (p->dwFlags & TVIF_FOLD)) {
&& (!p->child || (p->dwFlags & TVIF_FOLD))) {
if ((p->hIconFold)) { if ((p->hIconFold)) {
DrawIcon (hdc, centerX, centerY - (h>>1), DrawIcon (hdc, centerX, centerY - (h>>1), h, h, p->hIconFold);
h, h, p->hIconFold);
} }
} else if ((pData->dwStyle & TVS_ICONFORSELECT) && p->dwFlags & TVIF_SELECTED) { } else if ((p->hIconUnfold)) {
if ((p->hIconFold)) { DrawIcon (hdc, centerX, centerY - (h>>1), h, h, p->hIconUnfold);
DrawIcon (hdc, centerX, centerY - (h>>1),
h, h, p->hIconFold);
}
} else
if ((p->hIconUnfold)) {
DrawIcon (hdc, centerX, centerY - (h>>1),
h, h, p->hIconUnfold);
} }
centerX += h + TV_ICONGAP; centerX += h + TV_ICONGAP;
} }
+11 -14
View File
@@ -461,9 +461,8 @@ static int iso8859_6_len_first_char (const unsigned char* mstr, int len)
return 2; return 2;
else if (ignore == 2) else if (ignore == 2)
return 3; return 3;
else
return 1;
return 1;
} }
#define ISARABIC_LIG_HALF(s) ((s == 0xa5) || (s == 0xa6)) #define ISARABIC_LIG_HALF(s) ((s == 0xa5) || (s == 0xa6))
@@ -472,6 +471,7 @@ static unsigned int iso8859_6_char_type (Achar32 chv)
{ {
unsigned int ch_type = ACHAR_BASIC_UNKNOWN; unsigned int ch_type = ACHAR_BASIC_UNKNOWN;
chv = REAL_ACHAR(chv);
if (is_arabic_char_vowel (chv)) { /* is vowel */ if (is_arabic_char_vowel (chv)) { /* is vowel */
ch_type = ACHAR_BASIC_VOWEL; ch_type = ACHAR_BASIC_VOWEL;
} }
@@ -483,7 +483,6 @@ static unsigned int iso8859_6_char_type (Achar32 chv)
} }
static BidiType __mg_iso8859_6_bidi_char_type_map[] = { static BidiType __mg_iso8859_6_bidi_char_type_map[] = {
#if 0
/*0x00~0x0f*/ /*0x00~0x0f*/
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
@@ -531,7 +530,6 @@ static BidiType __mg_iso8859_6_bidi_char_type_map[] = {
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON,
BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_BN, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_BN,
#endif
/*0x80~0x8f*/ /*0x80~0x8f*/
BIDI_TYPE_ON, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_ON, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL,
@@ -606,10 +604,9 @@ static BidiType __mg_iso8859_6_bidi_char_type_map[] = {
static BidiType iso8859_6_bidi_char_type (Achar32 chv) static BidiType iso8859_6_bidi_char_type (Achar32 chv)
{ {
chv = REAL_ACHAR(chv); chv = REAL_ACHAR(chv);
if (chv > 0x7F) assert(chv < TABLESIZE(__mg_iso8859_6_bidi_char_type_map));
return (BidiType)__mg_iso8859_6_bidi_char_type_map[chv - 0x80];
else return (BidiType)__mg_iso8859_6_bidi_char_type_map[chv];
return (BidiType)__mg_iso8859_1_bidi_char_type_map[chv];
} }
static int get_table_index(Uint8 c) static int get_table_index(Uint8 c)
@@ -796,7 +793,7 @@ static const unsigned char* iso8859_6_get_next_word (const unsigned char* mstr,
static Achar32 iso8859_6_get_shaped_char_value (const unsigned char* cur_mchar, static Achar32 iso8859_6_get_shaped_char_value (const unsigned char* cur_mchar,
int cur_len, int shape_type) int cur_len, int shape_type)
{ {
Achar32 chv = -1; Achar32 chv = INV_ACHAR_VALUE;
int ignore; int ignore;
int index; int index;
@@ -811,15 +808,14 @@ static Achar32 iso8859_6_get_shaped_char_value (const unsigned char* cur_mchar,
} }
} }
if (chv == -1 || chv == 0) { if (chv == INV_ACHAR_VALUE || chv == 0) {
if (ISARABIC_VOWEL(*cur_mchar)){ if (ISARABIC_VOWEL(*cur_mchar)){
chv = fontset_68x_get_vowel_char(*cur_mchar); chv = fontset_68x_get_vowel_char(*cur_mchar);
} }
if (chv == 0 || chv == -1) { if (chv == 0 || chv == INV_ACHAR_VALUE) {
index = get_table_index(*cur_mchar); index = get_table_index(*cur_mchar);
if (index >=0) if (index >=0 ) {
{
switch (shape_type) { switch (shape_type) {
case ACHAR_ISOLATED: case ACHAR_ISOLATED:
chv = shape_info[index].isolated; chv = shape_info[index].isolated;
@@ -841,7 +837,7 @@ static Achar32 iso8859_6_get_shaped_char_value (const unsigned char* cur_mchar,
} }
if (chv == 0) if (chv == 0)
chv =-1; chv = INV_ACHAR_VALUE;
return chv; return chv;
} }
@@ -862,6 +858,7 @@ static const BIDICHAR_MIRROR_MAP __mg_iso8859_68x_mirror_table [] =
static BOOL iso8859_6_bidi_mirror_char (Achar32 chv, Achar32* mirrored) static BOOL iso8859_6_bidi_mirror_char (Achar32 chv, Achar32* mirrored)
{ {
chv = REAL_ACHAR(chv);
return get_mirror_char (__mg_iso8859_68x_mirror_table, return get_mirror_char (__mg_iso8859_68x_mirror_table,
TABLESIZE (__mg_iso8859_68x_mirror_table), chv, mirrored); TABLESIZE (__mg_iso8859_68x_mirror_table), chv, mirrored);
} }
+5 -6
View File
@@ -49,6 +49,8 @@
** Create date: 2000/06/13 ** Create date: 2000/06/13
*/ */
#undef NDEBUG
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -969,7 +971,6 @@ static const unsigned char* iso8859_8_get_next_word (const unsigned char* mstr,
} }
static BidiType __mg_iso8859_8_bidi_char_type_map[] = { static BidiType __mg_iso8859_8_bidi_char_type_map[] = {
#if 0
/*0x00~0x0f*/ /*0x00~0x0f*/
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
@@ -1017,7 +1018,6 @@ static BidiType __mg_iso8859_8_bidi_char_type_map[] = {
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON,
BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_BN, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_BN,
#endif
/*0x80~0x8f*/ /*0x80~0x8f*/
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
@@ -1072,10 +1072,9 @@ static BidiType __mg_iso8859_8_bidi_char_type_map[] = {
static BidiType iso8859_8_bidi_char_type (Achar32 chv) static BidiType iso8859_8_bidi_char_type (Achar32 chv)
{ {
chv = REAL_ACHAR(chv); chv = REAL_ACHAR(chv);
if (chv > 0x7F) assert(chv < TABLESIZE(__mg_iso8859_8_bidi_char_type_map));
return (BidiType)__mg_iso8859_8_bidi_char_type_map[chv - 0x80];
else return (BidiType)__mg_iso8859_8_bidi_char_type_map[chv];
return (BidiType)__mg_iso8859_1_bidi_char_type_map[chv];
} }
static const BIDICHAR_MIRROR_MAP __mg_iso8859_8_mirror_table [] = static const BIDICHAR_MIRROR_MAP __mg_iso8859_8_mirror_table [] =
+14 -7
View File
@@ -703,21 +703,20 @@ void __mg_legacy_bidi_get_embeddlevels (const CHARSETOPS* charset_ops,
print_hexstr(achars, len, TRUE); print_hexstr(achars, len, TRUE);
} }
#if 0
static void bidi_map_reverse (void* context, int len, int pos) static void bidi_map_reverse (void* context, int len, int pos)
{ {
GLYPHMAPINFO* str = (GLYPHMAPINFO*)context + pos; ACHARMAPINFO* str = (ACHARMAPINFO*)context + pos;
int i; int i;
for (i = 0; i < len / 2; i++) for (i = 0; i < len / 2; i++)
{ {
GLYPHMAPINFO tmp = str[i]; ACHARMAPINFO tmp = str[i];
str[i] = str[len - 1 - i]; str[i] = str[len - 1 - i];
str[len - 1 - i] = tmp; str[len - 1 - i] = tmp;
} }
} }
Achar32* __mg_legacy_bidi_map_reorder (const CHARSETOPS* charset_ops, Achar32* __mg_legacy_bidi_map_reorder (const CHARSETOPS* charset_ops,
Achar32* achars, int len, GLYPHMAPINFO* map, int pel) Achar32* achars, int len, int pel, ACHARMAPINFO* map)
{ {
BYTE max_level = 1; BYTE max_level = 1;
TYPERUN *type_rl_list = NULL; TYPERUN *type_rl_list = NULL;
@@ -725,6 +724,7 @@ Achar32* __mg_legacy_bidi_map_reorder (const CHARSETOPS* charset_ops,
int i; int i;
int run_pos; int run_pos;
int run_len; int run_len;
REORDER_CONTEXT rc;
print_hexstr(achars, len, FALSE); print_hexstr(achars, len, FALSE);
@@ -741,8 +741,10 @@ Achar32* __mg_legacy_bidi_map_reorder (const CHARSETOPS* charset_ops,
} }
} }
bidi_reorder_cb(map, len, &type_rl_list, max_level, rc.achars = NULL;
bidi_map_reverse); rc.extra = map;
rc.cb = bidi_map_reverse;
bidi_reorder(&rc, len, &type_rl_list, max_level);
/* free typerun list.*/ /* free typerun list.*/
free_typerun_list(type_rl_list); free_typerun_list(type_rl_list);
@@ -752,18 +754,23 @@ Achar32* __mg_legacy_bidi_map_reorder (const CHARSETOPS* charset_ops,
return achars; return achars;
} }
#if 0
Achar32* __mg_legacy_bidi_index_reorder (const CHARSETOPS* charset_ops, Achar32* __mg_legacy_bidi_index_reorder (const CHARSETOPS* charset_ops,
Achar32* achars, int len, int* index_map, int pel) Achar32* achars, int len, int* index_map, int pel)
{ {
BYTE max_level = 1; BYTE max_level = 1;
TYPERUN *type_rl_list = NULL; TYPERUN *type_rl_list = NULL;
REORDER_CONTEXT rc;
print_hexstr(achars, len, FALSE); print_hexstr(achars, len, FALSE);
/* W1~W7, N1~N2, I1~I2, Get the Embedding Level. */ /* W1~W7, N1~N2, I1~I2, Get the Embedding Level. */
bidi_resolve_string (charset_ops, achars, len, pel, &type_rl_list, &max_level); bidi_resolve_string (charset_ops, achars, len, pel, &type_rl_list, &max_level);
bidi_reorder_cb(index_map, len, &type_rl_list, max_level, rc.achars = achars;
rc.extra = extra;
rc.cb = cb_reverse_extra;
bidi_reorder(index_map, len, &type_rl_list, max_level,
bidi_string_reverse); bidi_string_reverse);
/* free typerun list.*/ /* free typerun list.*/
+4 -1
View File
@@ -155,7 +155,10 @@ BOOL mg_InitSysFont (void)
goto error_load; goto error_load;
} }
if ((sys_fonts[i] = CreateLogFont (type, family, charset, /* VW 20221003: use CreateLogFontEx instead of CreateLogFont to
follow the new style convention of font name,
but the orientation is ignored for the system logfont. */
if ((sys_fonts[i] = CreateLogFontEx (type, family, charset,
style [0], style [1], style [2], style [0], style [1], style [2],
style [3], style [4], style [5], style [3], style [4], style [5],
height, 0)) == NULL) { height, 0)) == NULL) {
+2 -3
View File
@@ -377,8 +377,8 @@ static _GBType resolve_gbt(struct break_ctxt* ctxt,
uc == 0x8E2 || uc == 0xD4E || uc == 0x110BD || uc == 0x8E2 || uc == 0xD4E || uc == 0x110BD ||
(uc >= 0x111C2 && uc <= 0x111C3)) { (uc >= 0x111C2 && uc <= 0x111C3)) {
gbt = GB_Prepend; gbt = GB_Prepend;
break;
} }
break;
case UCHAR_CATEGORY_CONTROL: case UCHAR_CATEGORY_CONTROL:
case UCHAR_CATEGORY_LINE_SEPARATOR: case UCHAR_CATEGORY_LINE_SEPARATOR:
@@ -393,8 +393,8 @@ static _GBType resolve_gbt(struct break_ctxt* ctxt,
if ((uc >= 0xFFF0 && uc <= 0xFFF8) || if ((uc >= 0xFFF0 && uc <= 0xFFF8) ||
(uc >= 0xE0000 && uc <= 0xE0FFF)) { (uc >= 0xE0000 && uc <= 0xE0FFF)) {
gbt = GB_ControlCRLF; gbt = GB_ControlCRLF;
break;
} }
break;
case UCHAR_CATEGORY_OTHER_LETTER: case UCHAR_CATEGORY_OTHER_LETTER:
if (ctxt->makes_hangul_syllable) if (ctxt->makes_hangul_syllable)
@@ -434,7 +434,6 @@ static _GBType resolve_gbt(struct break_ctxt* ctxt,
gbt = GB_RI_Odd; gbt = GB_RI_Odd;
else else
gbt = GB_RI_Odd; gbt = GB_RI_Odd;
break;
} }
break; break;
-1
View File
@@ -59,7 +59,6 @@
#include "cliprect.h" #include "cliprect.h"
#include "gal.h" #include "gal.h"
#include "internals.h" #include "internals.h"
#include "blockheap.h"
#include "accelkey.h" #include "accelkey.h"
static BLOCKHEAP ACHeap; static BLOCKHEAP ACHeap;
+57 -16
View File
@@ -59,17 +59,22 @@
#include "cliprect.h" #include "cliprect.h"
#include "gal.h" #include "gal.h"
#include "internals.h" #include "internals.h"
#include "dc.h"
BOOL GUIAPI CreateCaret (HWND hWnd, PBITMAP pBitmap, int nWidth, int nHeight) BOOL GUIAPI CreateCaret (HWND hWnd, PBITMAP pBitmap, int nWidth, int nHeight)
{ {
PMAINWIN pWin; PMAINWIN pWin;
pWin = (PMAINWIN)hWnd; pWin = (PMAINWIN)hWnd;
if (!pWin->pCaretInfo) { if (!pWin->pCaretInfo) {
HDC hdc;
if (!(pWin->pCaretInfo = malloc (sizeof (CARETINFO)))) if (!(pWin->pCaretInfo = malloc (sizeof (CARETINFO))))
return FALSE; return FALSE;
/* Since 5.0.11: use client DC of the window instead of screen DC */
hdc = GetClientDC(hWnd);
pWin->pCaretInfo->pBitmap = pBitmap; pWin->pCaretInfo->pBitmap = pBitmap;
if (pBitmap) { if (pBitmap) {
nWidth = pBitmap->bmWidth; nWidth = pBitmap->bmWidth;
@@ -78,18 +83,22 @@ BOOL GUIAPI CreateCaret (HWND hWnd, PBITMAP pBitmap, int nWidth, int nHeight)
pWin->pCaretInfo->nWidth = nWidth; pWin->pCaretInfo->nWidth = nWidth;
pWin->pCaretInfo->nHeight = nHeight; pWin->pCaretInfo->nHeight = nHeight;
pWin->pCaretInfo->caret_bmp.bmType = BMP_TYPE_NORMAL; pWin->pCaretInfo->caret_bmp.bmType = BMP_TYPE_NORMAL;
pWin->pCaretInfo->caret_bmp.bmBitsPerPixel = BITSPERPHYPIXEL; pWin->pCaretInfo->caret_bmp.bmBitsPerPixel =
pWin->pCaretInfo->caret_bmp.bmBytesPerPixel = BYTESPERPHYPIXEL; GetGDCapability(hdc, GDCAP_BITSPP);
pWin->pCaretInfo->caret_bmp.bmBytesPerPixel =
GetGDCapability(hdc, GDCAP_BPP);
pWin->pCaretInfo->caret_bmp.bmWidth = nWidth; pWin->pCaretInfo->caret_bmp.bmWidth = nWidth;
pWin->pCaretInfo->caret_bmp.bmHeight = nHeight; pWin->pCaretInfo->caret_bmp.bmHeight = nHeight;
pWin->pCaretInfo->caret_bmp.bmAlphaMask = NULL; pWin->pCaretInfo->caret_bmp.bmAlphaMask = NULL;
pWin->pCaretInfo->caret_bmp.bmAlphaPitch = 0; pWin->pCaretInfo->caret_bmp.bmAlphaPitch = 0;
pWin->pCaretInfo->nBytesNr = GAL_GetBoxSize (__gal_screen, pWin->pCaretInfo->nBytesNr = GAL_GetBoxSize (dc_HDC2PDC(hdc)->surface,
nWidth, nHeight, &pWin->pCaretInfo->caret_bmp.bmPitch); nWidth, nHeight, &pWin->pCaretInfo->caret_bmp.bmPitch);
pWin->pCaretInfo->pNormal = malloc (pWin->pCaretInfo->nBytesNr); pWin->pCaretInfo->pNormal = malloc (pWin->pCaretInfo->nBytesNr);
pWin->pCaretInfo->pXored = malloc (pWin->pCaretInfo->nBytesNr); pWin->pCaretInfo->pXored = malloc (pWin->pCaretInfo->nBytesNr);
ReleaseDC(hdc);
if (pWin->pCaretInfo->pNormal == NULL || if (pWin->pCaretInfo->pNormal == NULL ||
pWin->pCaretInfo->pXored == NULL) { pWin->pCaretInfo->pXored == NULL) {
free (pWin->pCaretInfo); free (pWin->pCaretInfo);
@@ -219,8 +228,8 @@ void GetCaretBitmaps (PCARETINFO pCaretInfo)
int i; int i;
int sx, sy; int sx, sy;
HDC hdc; HDC hdc;
Uint32 amask;
// convert to screen coordinates
sx = pCaretInfo->x; sx = pCaretInfo->x;
sy = pCaretInfo->y; sy = pCaretInfo->y;
@@ -231,36 +240,68 @@ void GetCaretBitmaps (PCARETINFO pCaretInfo)
pCaretInfo->caret_bmp.bmWidth, pCaretInfo->caret_bmp.bmWidth,
pCaretInfo->caret_bmp.bmHeight, pCaretInfo->caret_bmp.bmHeight,
&pCaretInfo->caret_bmp); &pCaretInfo->caret_bmp);
amask = GetGDCapability(hdc, GDCAP_AMASK);
ReleaseDC (hdc); ReleaseDC (hdc);
// generate XOR bitmap. // generate XOR bitmap.
if (pCaretInfo->pBitmap) { if (amask == 0) {
BYTE* normal; BYTE* normal;
BYTE* bitmap; BYTE* bitmap;
BYTE* xored; BYTE* xored;
normal = pCaretInfo->pNormal; normal = pCaretInfo->pNormal;
bitmap = pCaretInfo->pBitmap->bmBits;
xored = pCaretInfo->pXored; xored = pCaretInfo->pXored;
if (pCaretInfo->pBitmap) {
bitmap = pCaretInfo->pBitmap->bmBits;
for (i = 0; i < pCaretInfo->nBytesNr; i++) for (i = 0; i < pCaretInfo->nBytesNr; i++)
xored[i] = normal[i] ^ bitmap[i]; xored[i] = normal[i] ^ bitmap[i];
} }
else { else {
for (i = 0; i < pCaretInfo->nBytesNr; i++)
xored[i] = normal[i] ^ 0xFF;
}
}
else {
// Since 5.0.11: restore the alpha component if having alpha component.
int x, y;
BYTE* normal; BYTE* normal;
BYTE* xored; BYTE* xored;
BYTE xor_byte; BYTE* bitmap = NULL;
gal_pixel pix_normal, pix_bitmap, pix_xored, bits_alpha;
if (BITSPERPHYPIXEL < 8) for (y = 0; y < pCaretInfo->caret_bmp.bmHeight; y++) {
xor_byte = 0x0F; normal = pCaretInfo->pNormal + pCaretInfo->caret_bmp.bmPitch * y;
else xored = pCaretInfo->pXored + pCaretInfo->caret_bmp.bmPitch * y;
xor_byte = 0xFF; if (pCaretInfo->pBitmap)
bitmap = pCaretInfo->pBitmap->bmBits +
pCaretInfo->caret_bmp.bmPitch * y;
normal = pCaretInfo->pNormal; for (x = 0; x < pCaretInfo->caret_bmp.bmWidth; x++) {
xored = pCaretInfo->pXored;
for (i = 0; i < pCaretInfo->nBytesNr; i++) pix_normal = _mem_get_pixel(normal,
xored[i] = normal[i] ^ xor_byte; 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;
}
}
} }
} }
+2 -2
View File
@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems * and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices. * and smart IoT devices.
* *
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming * Copyright (C) 1998~2002, WEI Yongming
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@@ -803,7 +803,7 @@ BOOL GUIAPI InitWindowElementAttrs (PWERENDERER rdr)
char buff [20]; char buff [20];
DWORD rgba; DWORD rgba;
if (!rdr || !rdr->name || rdr->name[0] == '\0') if (!rdr || rdr->name[0] == '\0')
return FALSE; return FALSE;
_DBG_PRINTF ("GUI>InitWEA: Initialize %s renderer window element attributes.\n", _DBG_PRINTF ("GUI>InitWEA: Initialize %s renderer window element attributes.\n",
-1
View File
@@ -71,7 +71,6 @@
#include "cliprect.h" #include "cliprect.h"
#include "gal.h" #include "gal.h"
#include "internals.h" #include "internals.h"
#include "blockheap.h"
#include "menu.h" #include "menu.h"
#define SHORTEN 0 #define SHORTEN 0
+80 -41
View File
@@ -93,8 +93,7 @@ void GUIAPI SetAutoRepeatMessage (HWND hWnd, UINT uMsg,
{ {
MSG msg; MSG msg;
if (hWnd) { if (hWnd && !MG_IS_NORMAL_WINDOW(hWnd)) {
if (!MG_IS_NORMAL_WINDOW(hWnd))
return; return;
} }
@@ -138,7 +137,7 @@ static void RecalcClientArea (HWND hWnd)
if (pWin->secondaryDC == HDC_INVALID) { if (pWin->secondaryDC == HDC_INVALID) {
/* remove the flag of WS_EX_AUTOSECONDARYDC */ /* remove the flag of WS_EX_AUTOSECONDARYDC */
pWin->dwExStyle = pWin->dwExStyle | WS_EX_AUTOSECONDARYDC; pWin->dwExStyle &= ~WS_EX_AUTOSECONDARYDC;
pWin->secondaryDC = 0; pWin->secondaryDC = 0;
} }
@@ -365,11 +364,6 @@ HWND GUIAPI ChildWindowFromPointEx (HWND hParent, POINT pt, UINT uFlags)
return pRet; return pRet;
} }
/* NOTE:
** this function is CONTROL mouse messages handler,
** can automaticly capture mouse depend on HITTEST code.
*/
static PCONTROL __mgs_captured_ctrl = NULL; static PCONTROL __mgs_captured_ctrl = NULL;
void __mg_reset_mainwin_capture_info (PCONTROL ctrl) void __mg_reset_mainwin_capture_info (PCONTROL ctrl)
@@ -388,6 +382,11 @@ void __mg_reset_mainwin_capture_info (PCONTROL ctrl)
} }
} }
/* NOTE:
** this function is CONTROL mouse messages handler,
** can automaticly capture mouse depend on HITTEST code.
*/
static LRESULT DefaultDTMouseMsgHandler (PMAINWIN pWin, UINT message, static LRESULT DefaultDTMouseMsgHandler (PMAINWIN pWin, UINT message,
WPARAM flags, int x, int y) WPARAM flags, int x, int y)
{ {
@@ -2225,6 +2224,13 @@ static LRESULT DefaultPostMsgHandler(PMAINWIN pWin, UINT message,
OnQueryClientArea(pWin, (PRECT)lParam); OnQueryClientArea(pWin, (PRECT)lParam);
break; break;
case MSG_ACTIVE:
if (wParam)
pWin->dwExStyle |= WS_EX_ACTIVATED;
else
pWin->dwExStyle &= ~WS_EX_ACTIVATED;
break;
case MSG_SETFOCUS: case MSG_SETFOCUS:
case MSG_KILLFOCUS: case MSG_KILLFOCUS:
if (pWin->hActiveChild && !lParam) if (pWin->hActiveChild && !lParam)
@@ -2597,23 +2603,44 @@ static LRESULT DefaultSessionMsgHandler(PMAINWIN pWin, UINT message,
return 0; return 0;
} }
#if 0
static HWND get_active_descendant(PMAINWIN pWin)
{
HWND hwnd = (HWND)pWin;
HWND active;
while ((active = )) {
hwnd = active;
}
if (hwnd == (HWND)pWin)
return HWND_NULL;
return hwnd;
}
#endif
static LRESULT DefaultSystemMsgHandler(PMAINWIN pWin, UINT message, static LRESULT DefaultSystemMsgHandler(PMAINWIN pWin, UINT message,
WPARAM wParam, LPARAM lParam) WPARAM wParam, LPARAM lParam)
{ {
/* /*
** Should handle following messages: ** Should handle following messages:
** **
** MSG_IDLE, MSG_CARETBLINK: ** MSG_IDLE, MSG_CARETBLINK:
*/ */
if (message == MSG_IDLE) { if (message == MSG_IDLE) {
#if 0 /* deprecated code */ /* Since 5.0.10, MSG_IDLE will also be relayed to
if (pWin == checkAndGetMainWinIfWindow (sg_repeat_msg.hwnd)) { the active child control if the main window is active currently */
SendNotifyMessage (sg_repeat_msg.hwnd, if (pWin->dwExStyle & WS_EX_ACTIVATED) {
sg_repeat_msg.message, HWND active = GetFocusChild((HWND)pWin);
sg_repeat_msg.wParam, sg_repeat_msg.lParam); if (active) {
static DWORD last_tick_count;
if (wParam >= last_tick_count + 50) { /* 0.5s */
PostMessage(active, MSG_IDLE, wParam, lParam);
last_tick_count = wParam;
}
}
} }
#endif /* deprecated code */
} }
else if (message == MSG_CARETBLINK && pWin->dwStyle & WS_VISIBLE) { else if (message == MSG_CARETBLINK && pWin->dwStyle & WS_VISIBLE) {
BlinkCaret ((HWND)pWin); BlinkCaret ((HWND)pWin);
@@ -2673,18 +2700,32 @@ LRESULT PreDefMainWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam
LRESULT PreDefControlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) LRESULT PreDefControlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
if (message == MSG_SETTEXT) switch (message) {
case MSG_SETTEXT:
return 0; return 0;
else if (message == MSG_SETCURSOR) {
case MSG_IDLE:
{
HWND active = GetFocusChild(hWnd);
if (active) {
PostMessage(active, MSG_IDLE, wParam, lParam);
}
}
return 0;
case MSG_SETCURSOR:
if (GetWindowExStyle (hWnd) & WS_EX_USEPARENTCURSOR) if (GetWindowExStyle (hWnd) & WS_EX_USEPARENTCURSOR)
return 0; return 0;
SetCursor (GetWindowCursor (hWnd)); SetCursor (GetWindowCursor (hWnd));
return 0; return 0;
}
else if (message == MSG_NCSETCURSOR) { case MSG_NCSETCURSOR:
SetCursor (GetSystemCursor (IDC_ARROW)); SetCursor (GetSystemCursor (IDC_ARROW));
return 0; return 0;
default:
break;
} }
return DefaultMainWinProc (hWnd, message, wParam, lParam); return DefaultMainWinProc (hWnd, message, wParam, lParam);
@@ -2992,6 +3033,7 @@ HWND GUIAPI GetFirstHosted (HWND hWnd)
PMAINWIN pMainWin; PMAINWIN pMainWin;
if ((pMainWin = getMainWinIfWindowInThisThread (hWnd)) == NULL) { if ((pMainWin = getMainWinIfWindowInThisThread (hWnd)) == NULL) {
_WRN_PRINTF("hWnd (%p) is not in the current thread\n", hWnd);
return HWND_INVALID; return HWND_INVALID;
} }
@@ -3005,6 +3047,7 @@ HWND GUIAPI GetNextHosted (HWND hHosting, HWND hHosted)
PMAINWIN pHosted; PMAINWIN pHosted;
if ((pHosting = getMainWinIfWindowInThisThread (hHosting)) == NULL) { if ((pHosting = getMainWinIfWindowInThisThread (hHosting)) == NULL) {
_WRN_PRINTF("hHosing (%p) is not in the current thread\n", hHosting);
return HWND_INVALID; return HWND_INVALID;
} }
@@ -3013,10 +3056,13 @@ HWND GUIAPI GetNextHosted (HWND hHosting, HWND hHosted)
} }
if ((pHosted = getMainWinIfWindowInThisThread (hHosted)) == NULL) { if ((pHosted = getMainWinIfWindowInThisThread (hHosted)) == NULL) {
_WRN_PRINTF("hHosted (%p) is not in the current thread\n", hHosted);
return HWND_INVALID; return HWND_INVALID;
} }
if (MG_UNLIKELY (pHosted->pHosting != pHosting)) { if (MG_UNLIKELY (pHosted->pHosting != pHosting)) {
_ERR_PRINTF("Bad hosting relationship between hosting(%p) and hosted(%p)\n",
pHosting, pHosted);
return HWND_INVALID; return HWND_INVALID;
} }
@@ -3078,6 +3124,7 @@ static PMAINWIN search_win_tree_bfs (struct _search_context *ctxt)
} }
} }
hosting = hosted;
hosted = GetFirstHosted (hosted); hosted = GetFirstHosted (hosted);
} }
@@ -3164,8 +3211,8 @@ HWND GUIAPI GetNextChild (HWND hWnd, HWND hChild)
HWND GUIAPI GetNextMainWindow (HWND hMainWnd) HWND GUIAPI GetNextMainWindow (HWND hMainWnd)
{ {
MG_CHECK_RET (hMainWnd != HWND_NULL && MG_CHECK_RET (hMainWnd == HWND_NULL ||
!MG_IS_NORMAL_MAIN_WINDOW (hMainWnd), HWND_INVALID); MG_IS_NORMAL_MAIN_WINDOW (hMainWnd), HWND_INVALID);
return (HWND)SendMessage (HWND_DESKTOP, return (HWND)SendMessage (HWND_DESKTOP,
MSG_GETNEXTMAINWIN, (WPARAM)hMainWnd, 0L); MSG_GETNEXTMAINWIN, (WPARAM)hMainWnd, 0L);
@@ -3197,7 +3244,7 @@ int GUIAPI ScrollWindowEx (HWND hWnd, int dx, int dy,
rcScroll = rcClient; rcScroll = rcClient;
/* /*
* BUGFIX: if we scrolled all area, the all area must * BUGFIX: if we scrolled all area, the whole area must
* be set as invalidate (dongjunjie 2010/7/28) * be set as invalidate (dongjunjie 2010/7/28)
*/ */
if ((dx != 0 && abs(dx) >= RECTW(rcScroll)) || if ((dx != 0 && abs(dx) >= RECTW(rcScroll)) ||
@@ -3704,6 +3751,8 @@ BOOL GUIAPI ShowScrollBar (HWND hWnd, int iSBar, BOOL bShow)
return TRUE; return TRUE;
} }
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Warray-bounds"
/* moved here from desktop.c; can be used on virtual window */ /* moved here from desktop.c; can be used on virtual window */
static void guiAddNewHostedMainWindow (PMAINWIN pHosting, PMAINWIN pHosted) static void guiAddNewHostedMainWindow (PMAINWIN pHosting, PMAINWIN pHosted)
{ {
@@ -3755,6 +3804,7 @@ static void guiRemoveHostedMainWindow (PMAINWIN pHosting, PMAINWIN pHosted)
} }
#endif /* debug code */ #endif /* debug code */
} }
#pragma GCC diagnostic pop
/************************* Support for virtual window ************************/ /************************* Support for virtual window ************************/
#ifdef _MGHAVE_VIRTUAL_WINDOW #ifdef _MGHAVE_VIRTUAL_WINDOW
@@ -3775,29 +3825,32 @@ static void* _message_thread_entry (void* arg)
goto failed; goto failed;
/* create message queue for this thread */ /* create message queue for this thread */
if (!(entry_args.msg_queue = mg_AllocMsgQueueForThisThread ())) if (!(entry_args.msg_queue = mg_AllocMsgQueueForThisThread (FALSE)))
goto failed; goto failed;
orig_args->msg_queue = entry_args.msg_queue; orig_args->msg_queue = entry_args.msg_queue;
sem_post (entry_args.wait); sem_post (entry_args.wait);
/* register the message queue */
SendMessage (HWND_DESKTOP, MSG_MANAGE_MSGTHREAD, SendMessage (HWND_DESKTOP, MSG_MANAGE_MSGTHREAD,
MSGTHREAD_SIGNIN, (LPARAM)&entry_args.msg_queue); MSGTHREAD_SIGNIN, (LPARAM)&entry_args.msg_queue);
if (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL)) if (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL))
goto failed; goto cancelled;
/* call start routine of app */ /* call start routine of app */
entry_args.start_routine (entry_args.arg); entry_args.start_routine (entry_args.arg);
/* unregister the message queue */
SendMessage (HWND_DESKTOP, MSG_MANAGE_MSGTHREAD, SendMessage (HWND_DESKTOP, MSG_MANAGE_MSGTHREAD,
MSGTHREAD_SIGNOUT, (LPARAM)&entry_args.msg_queue); MSGTHREAD_SIGNOUT, (LPARAM)&entry_args.msg_queue);
mg_FreeMsgQueueForThisThread (); mg_FreeMsgQueueForThisThread (FALSE);
return NULL; return NULL;
failed: failed:
sem_post (entry_args.wait); sem_post (entry_args.wait);
cancelled:
return NULL; return NULL;
} }
@@ -3902,10 +3955,8 @@ HWND GUIAPI CreateVirtualWindow (HWND hHosting, WNDPROC WndProc,
if (pMsgQueue != getMsgQueueIfWindowInThisThread (hHosting)) { if (pMsgQueue != getMsgQueueIfWindowInThisThread (hHosting)) {
goto err; goto err;
} }
else {
pVirtWin->pHosting = (PVIRTWIN)hHosting; pVirtWin->pHosting = (PVIRTWIN)hHosting;
} }
}
if (SendMessage ((HWND)pVirtWin, MSG_CREATE, if (SendMessage ((HWND)pVirtWin, MSG_CREATE,
(WPARAM)pVirtWin->pHosting, (LPARAM)dwAddData)) { (WPARAM)pVirtWin->pHosting, (LPARAM)dwAddData)) {
@@ -4207,10 +4258,8 @@ HWND GUIAPI CreateMainWindowEx2 (PMAINWINCREATE pCreateInfo, LINT id,
if (pWin->pMsgQueue != getMsgQueue (pCreateInfo->hHosting)) { if (pWin->pMsgQueue != getMsgQueue (pCreateInfo->hHosting)) {
goto err; goto err;
} }
}
if (pWin->pHosting == NULL)
pWin->pHosting = getMainWindowPtr (pCreateInfo->hHosting); pWin->pHosting = getMainWindowPtr (pCreateInfo->hHosting);
}
#else /* defined _MGRM_THREADS */ #else /* defined _MGRM_THREADS */
@@ -4494,7 +4543,7 @@ BOOL GUIAPI DestroyMainWindow (HWND hWnd)
} }
else else
#endif /* defined _MGHAVE_VIRTUAL_WINDOW */ #endif /* defined _MGHAVE_VIRTUAL_WINDOW */
if (pWin->dwExStyle & WS_EX_DIALOGBOX) { if (hosted->dwExStyle & WS_EX_DIALOGBOX) {
if (!EndDialog ((HWND)hosted, IDCANCEL)) if (!EndDialog ((HWND)hosted, IDCANCEL))
return FALSE; return FALSE;
} }
@@ -4529,11 +4578,6 @@ BOOL GUIAPI DestroyMainWindow (HWND hWnd)
SendMessage (HWND_DESKTOP, MSG_REMOVEMAINWIN, (WPARAM)hWnd, 0); SendMessage (HWND_DESKTOP, MSG_REMOVEMAINWIN, (WPARAM)hWnd, 0);
#if 0 /* deprecated code */
if (sg_repeat_msg.hwnd == hWnd)
sg_repeat_msg.hwnd = 0;
#endif /* deprecated code */
/* make the window to be invalid for PeekMessageEx, PostMessage etc */ /* make the window to be invalid for PeekMessageEx, PostMessage etc */
pWin->DataType = TYPE_WINTODEL; pWin->DataType = TYPE_WINTODEL;
@@ -6085,11 +6129,6 @@ BOOL GUIAPI DestroyWindow (HWND hWnd)
pCtrl->privCDC = 0; pCtrl->privCDC = 0;
} }
#if 0 /* deprecated code */
if (sg_repeat_msg.hwnd == hWnd)
sg_repeat_msg.hwnd = 0;
#endif /* deprecated code */
ThrowAwayMessages (hWnd); ThrowAwayMessages (hWnd);
if (pCtrl->dwExStyle & WS_EX_CTRLASMAINWIN) { if (pCtrl->dwExStyle & WS_EX_CTRLASMAINWIN) {
+14
View File
@@ -319,6 +319,19 @@ static void flush_rec (void)
#endif #endif
} }
static void close_rec (void)
{
#ifdef WIN32
/* TODO: */
#else
if (record_fd >= 0) {
close(record_fd);
record_fd = -1;
}
#endif
}
static void do_record(AUTO_IAL_INPUT_EVENT *event) static void do_record(AUTO_IAL_INPUT_EVENT *event)
{ {
@@ -744,6 +757,7 @@ void TermPCXVFBInput (void)
remove("/tmp/.pcxvfb_tmp"); remove("/tmp/.pcxvfb_tmp");
} }
#endif #endif
close_rec();
#endif /* WIN32 */ #endif /* WIN32 */
} }
+1 -1
View File
@@ -3,7 +3,7 @@ noinst_HEADERS = \
cursor.h dc.h event.h list.h element.h \ cursor.h dc.h event.h list.h element.h \
ial.h inline.h internals.h zorder.h menu.h misc.h \ ial.h inline.h internals.h zorder.h menu.h misc.h \
msgstr.h sysfont.h timer.h devfont.h fontname.h \ msgstr.h sysfont.h timer.h devfont.h fontname.h \
readbmp.h icon.h blockheap.h rbtree.h \ readbmp.h icon.h rbtree.h \
ourhdr.h client.h server.h sharedres.h sockio.h drawsemop.h \ ourhdr.h client.h server.h sharedres.h sockio.h drawsemop.h \
gal.h newgal.h memops.h incoreres.h sysres.h clipboard.h \ gal.h newgal.h memops.h incoreres.h sysres.h clipboard.h \
glyph.h license.h mgsock.h unicode-ops.h \ glyph.h license.h mgsock.h unicode-ops.h \
+3 -3
View File
@@ -112,11 +112,11 @@ void __mg_legacy_bidi_get_embeddlevels (const CHARSETOPS* charset_ops,
Uint32 __mg_legacy_bidi_str_base_dir (const CHARSETOPS* charset_ops, Uint32 __mg_legacy_bidi_str_base_dir (const CHARSETOPS* charset_ops,
Achar32* achars, int len); Achar32* achars, int len);
Achar32* __mg_legacy_bidi_map_reorder (const CHARSETOPS* charset_ops,
Achar32* achars, int len, int pel, ACHARMAPINFO* map);
#if 0 #if 0
// Deprecated // Deprecated
Achar32* __mg_legacy_bidi_map_reorder (const CHARSETOPS* charset_ops,
Achar32* achars, int len, GLYPHMAPINFO* map, int pel);
Achar32* __mg_legacy_bidi_index_reorder (const CHARSETOPS* charset_ops, Achar32* __mg_legacy_bidi_index_reorder (const CHARSETOPS* charset_ops,
Achar32* achars, int len, int* index_map, int pel); Achar32* achars, int len, int* index_map, int pel);
#endif #endif
-1
View File
@@ -70,7 +70,6 @@ struct _SCALER_INFO_FILLBMP
typedef struct { typedef struct {
struct _SCALER_INFO_FILLBMP scaler_info; struct _SCALER_INFO_FILLBMP scaler_info;
GAL_Rect dst_rect; GAL_Rect dst_rect;
int old_bkmode;
BYTE* decoded_buff; BYTE* decoded_buff;
BYTE* decoded_alpha_buff; BYTE* decoded_alpha_buff;
@@ -47,6 +47,8 @@
** blockheap.h: the head file of heap for block data. ** blockheap.h: the head file of heap for block data.
** **
** Create date: 2001/01/10 ** Create date: 2001/01/10
**
** DEPRECATED, USE window.h INSTEAD.
*/ */
#ifndef GUI_BLOCKHEAP_H #ifndef GUI_BLOCKHEAP_H
@@ -55,7 +57,7 @@
#ifndef _MGUI_GDI_H /* included in include/gdi.h */ #ifndef _MGUI_GDI_H /* included in include/gdi.h */
struct _BLOCKHEAP { struct _BLOCKHEAP {
#ifdef _MGRM_THREADS #ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_t lock; pthread_mutex_t lock;
#endif #endif
/* Size of one block element. */ /* Size of one block element. */
+6 -1
View File
@@ -167,6 +167,8 @@ struct tagDC
/* surface of this DC */ /* surface of this DC */
GAL_Surface* surface; GAL_Surface* surface;
char __first_attr[0]; // just a zero-length field for the first attribute
/* background color */ /* background color */
gal_pixel bkcolor; gal_pixel bkcolor;
@@ -179,7 +181,7 @@ struct tagDC
/* text color */ /* text color */
gal_pixel textcolor; gal_pixel textcolor;
int bkmode; int bkmode_set; /* the background mode set by user (5.0.12, Issue #107) */
int tabstop; int tabstop;
int cExtra; /* Character extra */ int cExtra; /* Character extra */
@@ -213,6 +215,8 @@ struct tagDC
size_t dash_list_len; size_t dash_list_len;
#endif #endif
char __last_attr[0]; // just a zero-length field for the last attribute
PLOGFONT pLogFont; PLOGFONT pLogFont;
POINT CurPenPos; POINT CurPenPos;
@@ -247,6 +251,7 @@ struct tagDC
gal_pixel skip_pixel; gal_pixel skip_pixel;
gal_pixel cur_pixel; gal_pixel cur_pixel;
int step; int step;
int bkmode; /* the effective background mode */
/* ====================================================================== */ /* ====================================================================== */
CLIPRECT* cur_ban; CLIPRECT* cur_ban;
+3
View File
@@ -127,6 +127,9 @@ typedef LWEVENT* PLWEVENT;
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
extern DWORD __mg_timeout_usec;
extern DWORD __mg_repeat_usec;
// The entrance of low level event handling thread // The entrance of low level event handling thread
BOOL mg_InitLWEvent (void); BOOL mg_InitLWEvent (void);
void mg_TerminateLWEvent (void); void mg_TerminateLWEvent (void);
+12 -5
View File
@@ -84,15 +84,18 @@
#define WS_EX_MODALDISABLED 0x10000000L #define WS_EX_MODALDISABLED 0x10000000L
/* /*
* \def WS_EX_CTRLASMAINWIN * Internal extended style:
* \brief The control can be displayed out of the main window * The control can be displayed out of the main window
* which contains the control. * which contains the control.
*/ */
#define WS_EX_CTRLASMAINWIN 0x20000000L #define WS_EX_CTRLASMAINWIN 0x20000000L
/* Internal extended style. */ /* Internal extended style: dialog box. */
#define WS_EX_DIALOGBOX 0x40000000L #define WS_EX_DIALOGBOX 0x40000000L
/* Internal extended style: activated. */
#define WS_EX_ACTIVATED 0x80000000L
/* Make sure the internal window extended styles above are ok */ /* Make sure the internal window extended styles above are ok */
#define MGUI_COMPILE_TIME_ASSERT(name, x) \ #define MGUI_COMPILE_TIME_ASSERT(name, x) \
typedef int MGUI_dummy_ ## name[((x)?1:0) * 2 - 1] typedef int MGUI_dummy_ ## name[((x)?1:0) * 2 - 1]
@@ -101,6 +104,10 @@ MGUI_COMPILE_TIME_ASSERT(ws_ex_int_1,
WS_EX_INTERNAL_MASK & WS_EX_MODALDISABLED); WS_EX_INTERNAL_MASK & WS_EX_MODALDISABLED);
MGUI_COMPILE_TIME_ASSERT(ws_ex_int_2, MGUI_COMPILE_TIME_ASSERT(ws_ex_int_2,
WS_EX_INTERNAL_MASK & WS_EX_CTRLASMAINWIN); WS_EX_INTERNAL_MASK & WS_EX_CTRLASMAINWIN);
MGUI_COMPILE_TIME_ASSERT(ws_ex_int_3,
WS_EX_INTERNAL_MASK & WS_EX_DIALOGBOX);
MGUI_COMPILE_TIME_ASSERT(ws_ex_int_4,
WS_EX_INTERNAL_MASK & WS_EX_ACTIVATED);
#undef MGUI_COMPILE_TIME_ASSERT #undef MGUI_COMPILE_TIME_ASSERT
@@ -772,8 +779,8 @@ static inline PMSGQUEUE getMsgQueue (HWND hWnd)
} }
MSGQUEUE* mg_AllocMsgQueueForThisThread (void); MSGQUEUE* mg_AllocMsgQueueForThisThread (BOOL sign_in);
void mg_FreeMsgQueueForThisThread (void); void mg_FreeMsgQueueForThisThread (BOOL sign_off);
/* Since 5.0.0 */ /* Since 5.0.0 */
int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd); int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd);
+1 -1
View File
@@ -55,9 +55,9 @@
#ifndef GUI_NEWGAL_H #ifndef GUI_NEWGAL_H
#define GUI_NEWGAL_H #define GUI_NEWGAL_H
#include "minigui.h"
#include "gdi.h" #include "gdi.h"
#include "constants.h" #include "constants.h"
#include "blockheap.h"
#if IS_COMPOSITING_SCHEMA #if IS_COMPOSITING_SCHEMA
#include <sys/types.h> #include <sys/types.h>
+8 -2
View File
@@ -141,11 +141,17 @@ typedef struct _ZORDERINFO {
/* The size of usage bitmap for mask rect. */ /* The size of usage bitmap for mask rect. */
int size_maskrect_usage_bmp; int size_maskrect_usage_bmp;
/* use read/write lock for Unix-like OS */
#ifndef __NOUNIX__
#define __ZI_USE_RWLOCK 1
#endif
#ifdef _MGRM_THREADS #ifdef _MGRM_THREADS
# ifndef __NOUNIX__ # ifdef __ZI_USE_RWLOCK
pthread_rwlock_t rwlock; pthread_rwlock_t rwlock;
pthread_t rwlock_owner;
# else # else
pthread_mutex_t rwlock; pthread_mutex_t mutex;
# endif # endif
#elif defined(_MGRM_PROCESSES) #elif defined(_MGRM_PROCESSES)
int zi_semid; int zi_semid;
+1
View File
@@ -1,5 +1,6 @@
# also for makefile.ng and makefile.msvc # also for makefile.ng and makefile.msvc
AM_CPPFLAGS = -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include AM_CPPFLAGS = -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include
AM_CFLAGS = -Wno-zero-length-bounds
noinst_LTLIBRARIES = libkernel.la noinst_LTLIBRARIES = libkernel.la
+7 -7
View File
@@ -59,13 +59,13 @@
#include "common.h" #include "common.h"
#include "minigui.h" #include "minigui.h"
#include "gdi.h" #include "gdi.h"
#include "window.h"
#include "constants.h" #include "constants.h"
#include "blockheap.h"
#include "misc.h" #include "misc.h"
BOOL InitBlockDataHeap (PBLOCKHEAP heap, size_t sz_block, size_t sz_heap) BOOL InitBlockDataHeap (PBLOCKHEAP heap, size_t sz_block, size_t sz_heap)
{ {
#ifdef _MGRM_THREADS #ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_init (&heap->lock, NULL); pthread_mutex_init (&heap->lock, NULL);
#endif #endif
@@ -99,7 +99,7 @@ void* BlockDataAlloc (PBLOCKHEAP heap)
int free_slot; int free_slot;
unsigned char* block_data = NULL; unsigned char* block_data = NULL;
#ifdef _MGRM_THREADS #ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_lock (&heap->lock); pthread_mutex_lock (&heap->lock);
#endif #endif
@@ -118,7 +118,7 @@ void* BlockDataAlloc (PBLOCKHEAP heap)
ret: ret:
#ifdef _MGRM_THREADS #ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_unlock (&heap->lock); pthread_mutex_unlock (&heap->lock);
#endif #endif
return block_data; return block_data;
@@ -128,7 +128,7 @@ void BlockDataFree (PBLOCKHEAP heap, void* data)
{ {
unsigned char* block_data = data; unsigned char* block_data = data;
#ifdef _MGRM_THREADS #ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_lock (&heap->lock); pthread_mutex_lock (&heap->lock);
#endif #endif
@@ -146,7 +146,7 @@ void BlockDataFree (PBLOCKHEAP heap, void* data)
heap, slot); heap, slot);
} }
#ifdef _MGRM_THREADS #ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_unlock (&heap->lock); pthread_mutex_unlock (&heap->lock);
#endif #endif
} }
@@ -193,7 +193,7 @@ void DestroyBlockDataHeap (PBLOCKHEAP heap)
free (heap->usage_bmp); free (heap->usage_bmp);
heap->usage_bmp = NULL; heap->usage_bmp = NULL;
#ifdef _MGRM_THREADS #ifdef _MGHAVE_VIRTUAL_WINDOW
pthread_mutex_destroy (&heap->lock); pthread_mutex_destroy (&heap->lock);
#endif #endif
} }
+2 -2
View File
@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems * and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices. * and smart IoT devices.
* *
* Copyright (C) 2002~2021, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming * Copyright (C) 1998~2002, WEI Yongming
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@@ -489,7 +489,7 @@ const CompositorOps* GUIAPI ServerGetCompositorOps (const char* name)
return NULL; return NULL;
for (i = 0; i < MAX_NR_COMPOSITORS; i++) { for (i = 0; i < MAX_NR_COMPOSITORS; i++) {
if (compositors [i].name && strcmp (compositors [i].name, name) == 0) { if (strcmp (compositors [i].name, name) == 0) {
return compositors [i].ops; return compositors [i].ops;
} }
} }
+12 -7
View File
@@ -232,7 +232,7 @@ static int dskAddNewMainWindow (PMAINWIN pWin)
if (pWin->secondaryDC == HDC_INVALID) { if (pWin->secondaryDC == HDC_INVALID) {
/* remove the flag of WS_EX_AUTOSECONDARYDC */ /* remove the flag of WS_EX_AUTOSECONDARYDC */
pWin->dwExStyle = pWin->dwExStyle | WS_EX_AUTOSECONDARYDC; pWin->dwExStyle &= ~WS_EX_AUTOSECONDARYDC;
pWin->secondaryDC = 0; pWin->secondaryDC = 0;
} }
@@ -1429,6 +1429,8 @@ static LRESULT WindowMessageHandler(UINT message, PMAINWIN pWin, LPARAM lParam)
/* Since 5.0.0 */ /* Since 5.0.0 */
case MSG_SETAUTOREPEAT: case MSG_SETAUTOREPEAT:
sg_msgAutoRepeat = *(const MSG*)lParam; sg_msgAutoRepeat = *(const MSG*)lParam;
/* start auto-repeat after 300ms */
sg_msgAutoRepeat.time = __mg_tick_counter + (__mg_timeout_usec/10000);
break; break;
/* Since 5.0.0 */ /* Since 5.0.0 */
@@ -1743,11 +1745,6 @@ static int dskOnRemoveCtrlInstance (PCONTROL pParent, PCONTROL pCtrl)
FreeZOrderNode (0, pCtrl->idx_znode, NULL); FreeZOrderNode (0, pCtrl->idx_znode, NULL);
} }
if (fFound) {
pCtrl->pcci->nUseCount --;
return 0;
}
if ((HWND)pCtrl == __mg_captured_wnd) { if ((HWND)pCtrl == __mg_captured_wnd) {
/* force release the capture */ /* force release the capture */
__mg_captured_wnd = 0; __mg_captured_wnd = 0;
@@ -1762,6 +1759,11 @@ static int dskOnRemoveCtrlInstance (PCONTROL pParent, PCONTROL pCtrl)
sg_msgAutoRepeat.hwnd = 0; sg_msgAutoRepeat.hwnd = 0;
} }
if (fFound) {
pCtrl->pcci->nUseCount--;
return 0;
}
return -1; return -1;
} }
@@ -1873,9 +1875,12 @@ static void dskOnTimeout (void)
static DWORD uCounter = 0; static DWORD uCounter = 0;
static DWORD blink_counter = 0; static DWORD blink_counter = 0;
if (sg_msgAutoRepeat.hwnd != 0) { if (sg_msgAutoRepeat.hwnd != 0 &&
__mg_tick_counter >= sg_msgAutoRepeat.time) {
PostMessage (sg_msgAutoRepeat.hwnd, sg_msgAutoRepeat.message, PostMessage (sg_msgAutoRepeat.hwnd, sg_msgAutoRepeat.message,
sg_msgAutoRepeat.wParam, sg_msgAutoRepeat.lParam); sg_msgAutoRepeat.wParam, sg_msgAutoRepeat.lParam);
/* next auto-repeat msg after 50ms */
sg_msgAutoRepeat.time = __mg_tick_counter + (__mg_repeat_usec/10000);
} }
if (__mg_tick_counter < (blink_counter + 10)) if (__mg_tick_counter < (blink_counter + 10))
+13 -15
View File
@@ -78,6 +78,7 @@
#include "server.h" #include "server.h"
#include "drawsemop.h" #include "drawsemop.h"
#include "devfont.h" #include "devfont.h"
#include "event.h"
/******************************* global data *********************************/ /******************************* global data *********************************/
PMSGQUEUE __mg_dsk_msg_queue; PMSGQUEUE __mg_dsk_msg_queue;
@@ -231,14 +232,6 @@ static void init_desktop_win (void)
BOOL mg_InitDesktop (void) BOOL mg_InitDesktop (void)
{ {
#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 */
#ifndef _MGSCHEMA_COMPOSITING #ifndef _MGSCHEMA_COMPOSITING
/* Init heap of clipping rects. */ /* Init heap of clipping rects. */
InitFreeClipRectList (&sg_FreeClipRectList, SIZE_CLIPRECTHEAP); InitFreeClipRectList (&sg_FreeClipRectList, SIZE_CLIPRECTHEAP);
@@ -259,7 +252,7 @@ BOOL mg_InitDesktop (void)
void mg_TerminateDesktop (void) void mg_TerminateDesktop (void)
{ {
/* Since 5.0.0: message queue for desktop thread was dynamically allocated */ /* Since 5.0.0: message queue for desktop thread was dynamically allocated */
mg_FreeMsgQueueForThisThread (); mg_FreeMsgQueueForThisThread (TRUE);
__mg_dsk_msg_queue = NULL; __mg_dsk_msg_queue = NULL;
#ifndef _MGSCHEMA_COMPOSITING #ifndef _MGSCHEMA_COMPOSITING
@@ -2756,6 +2749,8 @@ static LRESULT dskWindowMessageHandler (UINT message,
/* Since 5.0.0 */ /* Since 5.0.0 */
case MSG_SETAUTOREPEAT: case MSG_SETAUTOREPEAT:
sg_msgAutoRepeat = *(const MSG*)lParam; sg_msgAutoRepeat = *(const MSG*)lParam;
/* start auto-repeat after 300ms */
sg_msgAutoRepeat.time = __mg_tick_counter + (__mg_timeout_usec/10000);
break; break;
} }
@@ -3553,11 +3548,6 @@ static int dskOnRemoveCtrlInstance (PCONTROL pParent, PCONTROL pCtrl)
cliFreeZOrderNode ((PMAINWIN)pCtrl); cliFreeZOrderNode ((PMAINWIN)pCtrl);
} }
if (fFound) {
pCtrl->pcci->nUseCount --;
return 0;
}
if ((HWND)pCtrl == __mg_captured_wnd) { if ((HWND)pCtrl == __mg_captured_wnd) {
/* force release the capture */ /* force release the capture */
__mg_captured_wnd = 0; __mg_captured_wnd = 0;
@@ -3572,6 +3562,11 @@ static int dskOnRemoveCtrlInstance (PCONTROL pParent, PCONTROL pCtrl)
sg_msgAutoRepeat.hwnd = 0; sg_msgAutoRepeat.hwnd = 0;
} }
if (fFound) {
pCtrl->pcci->nUseCount--;
return 0;
}
return -1; return -1;
} }
@@ -4212,9 +4207,12 @@ static void dskOnTimeout (void)
static UINT uCounter = 0; static UINT uCounter = 0;
static UINT blink_counter = 0; static UINT blink_counter = 0;
if (sg_msgAutoRepeat.hwnd != 0) { if (sg_msgAutoRepeat.hwnd != 0 &&
__mg_tick_counter >= sg_msgAutoRepeat.time) {
PostMessage (sg_msgAutoRepeat.hwnd, sg_msgAutoRepeat.message, PostMessage (sg_msgAutoRepeat.hwnd, sg_msgAutoRepeat.message,
sg_msgAutoRepeat.wParam, sg_msgAutoRepeat.lParam); sg_msgAutoRepeat.wParam, sg_msgAutoRepeat.lParam);
/* next auto-repeat msg after 50ms */
sg_msgAutoRepeat.time = __mg_tick_counter + (__mg_repeat_usec/10000);
} }
if (__mg_tick_counter < (blink_counter + 10)) if (__mg_tick_counter < (blink_counter + 10))
+2 -9
View File
@@ -74,6 +74,7 @@
#include "dc.h" #include "dc.h"
#include "misc.h" #include "misc.h"
#include "devfont.h" #include "devfont.h"
#include "event.h"
#ifndef WIN32 #ifndef WIN32
#include <sys/termios.h> #include <sys/termios.h>
@@ -102,14 +103,6 @@ BOOL mg_InitDesktop (void)
int ret; int ret;
RECT rcScr = GetScreenRect(); RECT rcScr = GetScreenRect();
#if 0 /* move to init-lite.c */
/* Since 5.0.0: allocate message queue for desktop thread */
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread ()) ) {
_WRN_PRINTF ("failed to allocate message queue\n");
return FALSE;
}
#endif /* moved code */
/* /*
* Init ZOrderInfo here. * Init ZOrderInfo here.
*/ */
@@ -153,7 +146,7 @@ BOOL mg_InitDesktop (void)
void mg_TerminateDesktop (void) void mg_TerminateDesktop (void)
{ {
if (__mg_dsk_msg_queue) { if (__mg_dsk_msg_queue) {
mg_FreeMsgQueueForThisThread (); mg_FreeMsgQueueForThisThread (TRUE);
__mg_dsk_msg_queue = NULL; __mg_dsk_msg_queue = NULL;
} }
+3 -2
View File
@@ -72,6 +72,7 @@
#include "dc.h" #include "dc.h"
#include "misc.h" #include "misc.h"
#include "devfont.h" #include "devfont.h"
#include "event.h"
/******************************* global data *********************************/ /******************************* global data *********************************/
/* pointer to desktop message queue */ /* pointer to desktop message queue */
@@ -145,7 +146,7 @@ void* __kernel_desktop_main (void* data)
MSG Msg; MSG Msg;
/* init message queue of desktop thread */ /* init message queue of desktop thread */
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread ()) ) { if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread (TRUE)) ) {
_ERR_PRINTF ("failed to allocate message queue\n"); _ERR_PRINTF ("failed to allocate message queue\n");
sem_post ((sem_t*)data); sem_post ((sem_t*)data);
return NULL; return NULL;
@@ -191,7 +192,7 @@ void* __kernel_desktop_main (void* data)
#endif #endif
} }
mg_FreeMsgQueueForThisThread (); mg_FreeMsgQueueForThisThread (TRUE);
__mg_dsk_msg_queue = NULL; __mg_dsk_msg_queue = NULL;
return NULL; return NULL;
} }
+36 -26
View File
@@ -15,7 +15,7 @@
* and Graphics User Interface (GUI) support system for embedded systems * and Graphics User Interface (GUI) support system for embedded systems
* and smart IoT devices. * and smart IoT devices.
* *
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd. * Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
* Copyright (C) 1998~2002, WEI Yongming * Copyright (C) 1998~2002, WEI Yongming
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@@ -597,55 +597,63 @@ static void reset_window (PMAINWIN pWin, RECT* rcWin)
#endif #endif
#ifdef _MGRM_THREADS #ifdef _MGRM_THREADS
#ifndef __NOUNIX__ # ifdef __ZI_USE_RWLOCK
/*for unix system, using read/write lock*/ static inline void lock_zi_for_change (ZORDERINFO* zi)
static inline void lock_zi_for_change (const ZORDERINFO* zi)
{ {
pthread_rwlock_wrlock(&((ZORDERINFO*)zi)->rwlock); pthread_rwlock_wrlock(&zi->rwlock);
zi->rwlock_owner = pthread_self();
} }
static inline void unlock_zi_for_change (const ZORDERINFO* zi) static inline void unlock_zi_for_change (ZORDERINFO* zi)
{ {
pthread_rwlock_unlock(&((ZORDERINFO*)zi)->rwlock); pthread_rwlock_unlock(&zi->rwlock);
zi->rwlock_owner = 0;
} }
static inline void lock_zi_for_read (const ZORDERINFO* zi) static inline void lock_zi_for_read (ZORDERINFO* zi)
{ {
pthread_rwlock_rdlock(&((ZORDERINFO*)zi)->rwlock); if (zi->rwlock_owner == pthread_self()) {
return;
}
pthread_rwlock_rdlock(&zi->rwlock);
} }
static inline void unlock_zi_for_read (const ZORDERINFO* zi) static inline void unlock_zi_for_read (ZORDERINFO* zi)
{ {
pthread_rwlock_unlock(&((ZORDERINFO*)zi)->rwlock); if (zi->rwlock_owner == pthread_self()) {
return;
}
pthread_rwlock_unlock(&zi->rwlock);
} }
#else /* __NOUNIX__ */ # else /* __ZI_USE_RWLOCK */
/*for non-unix system, using mutex*/ static inline void lock_zi_for_change (ZORDERINFO* zi)
static inline void lock_zi_for_change (const ZORDERINFO* zi)
{ {
pthread_mutex_lock(&((ZORDERINFO*)zi)->rwlock); pthread_mutex_lock(&zi->mutex);
} }
static inline void unlock_zi_for_change (const ZORDERINFO* zi) static inline void unlock_zi_for_change (ZORDERINFO* zi)
{ {
pthread_mutex_unlock(&((ZORDERINFO*)zi)->rwlock); pthread_mutex_unlock(&zi->mutex);
} }
static inline void lock_zi_for_read (const ZORDERINFO* zi) static inline void lock_zi_for_read (ZORDERINFO* zi)
{ {
pthread_mutex_lock(&((ZORDERINFO*)zi)->rwlock); pthread_mutex_lock(&zi->mutex);
} }
static inline void unlock_zi_for_read (const ZORDERINFO* zi) static inline void unlock_zi_for_read (ZORDERINFO* zi)
{ {
pthread_mutex_unlock(&((ZORDERINFO*)zi)->rwlock); pthread_mutex_unlock(&zi->mutex);
} }
#endif /* __NOUNIX__ */ # endif /* notdef __ZI_USE_RWLOCK */
#elif defined(_MGRM_STANDALONE) #elif defined(_MGRM_STANDALONE)
static inline void lock_zi_for_change (const ZORDERINFO* zi) { } static inline void lock_zi_for_change (ZORDERINFO* zi) { }
static inline void unlock_zi_for_change (const ZORDERINFO* zi) { } static inline void unlock_zi_for_change (ZORDERINFO* zi) { }
static inline void lock_zi_for_read (const ZORDERINFO* zi) { } static inline void lock_zi_for_read (ZORDERINFO* zi) { }
static inline void unlock_zi_for_read (const ZORDERINFO* zi) { } static inline void unlock_zi_for_read (ZORDERINFO* zi) { }
#else /* for procs */ #else /* for procs */
/* NULL. see desktop-procs.c */ /* NULL. see desktop-procs.c */
#endif /* _MGRM_THREADS */ #endif /* _MGRM_THREADS */
@@ -4499,7 +4507,9 @@ int __mg_join_all_message_threads (void)
list_for_each (l, &msg_queue_list) { list_for_each (l, &msg_queue_list) {
MSGQUEUE *msg_queue = (MSGQUEUE*)l; MSGQUEUE *msg_queue = (MSGQUEUE*)l;
#ifndef NDEBUG
dump_message_queue (msg_queue, __func__); dump_message_queue (msg_queue, __func__);
#endif
pthread_cancel (msg_queue->th); pthread_cancel (msg_queue->th);
} }

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