mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-24 09:14:09 +08:00
Compare commits
76
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3cc16ababb | ||
|
|
d4097b577b | ||
|
|
7ef6c14f3f | ||
|
|
cbb4e32992 | ||
|
|
6bc85062b9 | ||
|
|
b2dee57f4f | ||
|
|
a926754a6b | ||
|
|
7e470b0e78 | ||
|
|
9f81cac662 | ||
|
|
a14bdd894a | ||
|
|
7004e156b8 | ||
|
|
e293cf03ba | ||
|
|
07f226f024 | ||
|
|
4b2503e614 | ||
|
|
2df5352356 | ||
|
|
67ccb2aafd | ||
|
|
9a124dec50 | ||
|
|
d013822979 | ||
|
|
7f44e948d0 | ||
|
|
9a94fb9a7c | ||
|
|
dfc7e95fcd | ||
|
|
362b852ec2 | ||
|
|
9141e13640 | ||
|
|
4a22a38e63 | ||
|
|
c7ce12449b | ||
|
|
824557b4f1 | ||
|
|
022542ef1b | ||
|
|
3b12e71877 | ||
|
|
9593168196 | ||
|
|
b5c5c3f8ae | ||
|
|
492bd649ed | ||
|
|
bc1a880479 | ||
|
|
0748f26f42 | ||
|
|
2f72f24a49 | ||
|
|
43e174a604 | ||
|
|
13d36a2785 | ||
|
|
9ec3e9f7e6 | ||
|
|
148f1b1745 | ||
|
|
f76c9187a8 | ||
|
|
2e8eba7dd0 | ||
|
|
abeafa313d | ||
|
|
310c0f3e7a | ||
|
|
c426894ac9 | ||
|
|
bf6998672f | ||
|
|
ea83e92a16 | ||
|
|
d95e827e93 | ||
|
|
40f53732ff | ||
|
|
e2d2544ce6 | ||
|
|
7cefc7d5ab | ||
|
|
b59ed4b7d1 | ||
|
|
5e43b76753 | ||
|
|
894d0f64a2 | ||
|
|
c18e0f3479 | ||
|
|
8756b5de9f | ||
|
|
54a51ab02f | ||
|
|
741a93aebd | ||
|
|
aeb6642aad | ||
|
|
2fe23fa95b | ||
|
|
a6eb81e916 | ||
|
|
93ec7e48b6 | ||
|
|
956003092e | ||
|
|
96b75c41c1 | ||
|
|
d6933b83e3 | ||
|
|
e2ba3681a1 | ||
|
|
0b47b83849 | ||
|
|
08419c0c95 | ||
|
|
03bc5befd5 | ||
|
|
ed37fa4fc2 | ||
|
|
7268bcf92e | ||
|
|
2d462ec749 | ||
|
|
11a4941dc7 | ||
|
|
d6281fd804 | ||
|
|
550fb04731 | ||
|
|
e08a87fc93 | ||
|
|
cac16f1324 | ||
|
|
2efb66cae0 |
@@ -29,3 +29,4 @@ Makefile.in
|
||||
/src/font/utils/ucd/
|
||||
/src/sysres/font_list
|
||||
/src/sysres/license/dat_files/
|
||||
/configure~
|
||||
|
||||
@@ -8,7 +8,7 @@ _TABLE OF CONTENTS_
|
||||
- [TABLE OF CONTENTS](#table-of-contents)
|
||||
- [INTRODUCTION](#introduction)
|
||||
+ [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)
|
||||
+ [Source Code Repositories](#source-code-repositories)
|
||||
- [NEW FEATURES IN VERSION 5.0.x](#new-features-in-version-50x)
|
||||
@@ -37,51 +37,45 @@ _TABLE OF CONTENTS_
|
||||
|
||||
### What's MiniGUI
|
||||
|
||||
MiniGUI aims to provide a fast, stable, full-featured, and cross-platform
|
||||
windowing and GUI support system, which is especially fit for
|
||||
embedded systems or smart IoT devices based-on Linux/uClinux, eCos, and other
|
||||
traditional RTOSes, such as RT-Thread, FreeRTOS, RTEMS, VxWorks, ThreadX,
|
||||
Nucleus, pSOS, uC/OS-II, OSE, and others.
|
||||
MiniGUI aims to provide a fast, stable, full-featured, and cross-platform windowing and GUI support system,
|
||||
which is especially fit for embedded systems or smart IoT devices based-on Linux/uClinux, eCos,
|
||||
and other traditional RTOSes, such as 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
|
||||
and graphics interfaces as well as a lot of standard controls (toolkit).
|
||||
This is the source tree of MiniGUI Core, which provides the windowing and graphics interfaces as well as a lot of standard controls (toolkit).
|
||||
|
||||
MiniGUI is released under GPLv3 and the dual-licensing applies to commercial
|
||||
use. In December 1998, the initiator of FMSoft, Wei Yongming, began to develop
|
||||
MiniGUI under the GNU General Public License (GPL). In September 2002, the core
|
||||
developers of MiniGUI founded [FMSoft](https://www.fmsoft.cn) and started the
|
||||
commercial marketing with the free software. By now, FMSoft still continues to
|
||||
release MiniGUI as a free software project.
|
||||
MiniGUI is released under GPLv3 and the dual-licensing applies to commercial use.
|
||||
In December 1998, the initiator of FMSoft, [Vincent Wei], began to develop MiniGUI under the GNU General Public License (GPL).
|
||||
In September 2002, the core developers of MiniGUI founded [FMSoft] and started the 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
|
||||
to the following website:
|
||||
For the live demos, source tarballs, and cases of MiniGUI, you can refer to the following website:
|
||||
|
||||
<http://www.minigui.com>
|
||||
|
||||
### App Frameworks on MiniGUI
|
||||
### HVML App Framework on MiniGUI
|
||||
|
||||
MiniGUI and its components provides a lot of controls/widgets to
|
||||
help your develop GUI apps in C/C++ programming language. However,
|
||||
alternatively, you can choose one of the following frameworks to
|
||||
develop your apps in a easy-to-use programming language other than C/C++.
|
||||
MiniGUI and its components provide a lot of controls/widgets to help your develop GUI apps in C/C++ programming language.
|
||||
However, alternatively, you can use the following software to develop your apps in an easy-to-use programming language [HVML].
|
||||
|
||||
* [HybridOS](https://gitlab.fmsoft.cn/HybridOS/hybridos) provides
|
||||
a complete software stack to develop an app which have rich functions
|
||||
and excellent expressive in HTML5, CSS3, and JavaScript.
|
||||
* [hiACEJS](https://gitlab.fmsoft.cn/HybridOS/hiACEJS) provides
|
||||
a light-weight app framework in JavaScript.
|
||||
* [HVML] is a descriptive programming language proposed and designed by [Vincent Wei].
|
||||
* [PurC] is the prime interpreter of HVML written in C lauguage.
|
||||
* [xGUI Pro] is a full-featured HVML renderer based on the tailored WebKit engine.
|
||||
|
||||
You can also choose [HybridOS Lite](https://gitlab.fmsoft.cn/HybridOS/hybridos-lite)
|
||||
to develop apps with excellent expressive for cost-sensitive devices in C/C++ language.
|
||||
In short, the above software suite provides an Electron-like solution that can help people develop cross-platform applications using web front-end technology.
|
||||
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
|
||||
|
||||
[HybridOS](https://gitlab.fmsoft.cn/HybridOS/hybridos) is another large open source project
|
||||
initiated by FMSoft. It is a totally new open source operating system designed for
|
||||
embedded and smart IoT devices and cloud computing environment.
|
||||
[HybridOS] is another large open source project initiated by FMSoft.
|
||||
It is an open source operating system designed for embedded/AIoT devices and cloud computing environment.
|
||||
|
||||
In practice, MiniGUI and the software which are used to integrated with GPU
|
||||
constitute the graphics stack of HybridOS.
|
||||
HybridOS provides the complete software stack and the app framework based on HVML for embedded systems.
|
||||
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 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) |
|
||||
| | ---------------------|
|
||||
@@ -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
|
||||
the following software:
|
||||
As shown in the chart above, the HybridOS graphics stack consists of the following software:
|
||||
|
||||
- `libDRM` provides some user land APIs for Linux Direct Rendering Infrastructure.
|
||||
- `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
|
||||
them on:
|
||||
|
||||
<https://gitlab.fmsoft.cn/VincentWei>
|
||||
<https://github.com/VincentWei>
|
||||
|
||||
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
|
||||
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.
|
||||
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
|
||||
|
||||
@@ -292,7 +285,7 @@ in order to support [HybridOS Foundation Class Library].
|
||||
|
||||
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
|
||||
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:
|
||||
|
||||
<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
|
||||
|
||||
@@ -361,15 +354,15 @@ and MiniGUI components, please fetch one of the following repositories
|
||||
from GitHub and follow the instructions to build MiniGUI Core,
|
||||
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
|
||||
|
||||
[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
|
||||
|
||||
[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
|
||||
@@ -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
|
||||
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.
|
||||
|
||||
@@ -566,15 +559,16 @@ A brief history description of the development progress is listed as follow:
|
||||
1. Jul., 2019: FMSoft released MiniGUI version 4.0.0.
|
||||
1. Mar., 2020: FMSoft released MiniGUI version 5.0.0.
|
||||
1. May., 2021: FMSoft released MiniGUI version 5.0.6.
|
||||
1. Jan., 2022: FMSoft released MiniGUI version 5.0.9.
|
||||
1. Sep., 2022: FMSoft released MiniGUI version 5.0.10.
|
||||
|
||||
## AUTHORS AND COPYING
|
||||
|
||||
The original author of MiniGUI is WEI Yongming, and now MiniGUI is
|
||||
maintained by FMSoft. For more information, please refer to
|
||||
<http://www.fmsoft.cn>.
|
||||
The original author of MiniGUI is Vincent Wei, and now MiniGUI is maintained by FMSoft.
|
||||
For more information, please refer to <http://www.fmsoft.cn>.
|
||||
|
||||
Copyright (C) 2002 ~ 2021, Beijing FMSoft Technologies Co., Ltd.
|
||||
Copyright (C) 1998 ~ 2002, WEI Yongming
|
||||
Copyright (C) 2002 ~ 2022, Beijing FMSoft Technologies Co., Ltd.
|
||||
Copyright (C) 1998 ~ 2002, Vincent Wei
|
||||
|
||||
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
|
||||
@@ -646,3 +640,20 @@ Q: Can I get the tech support from MiniGUI team?
|
||||
A: Yes, FMSoft can provide you with guaranteed commercial technical
|
||||
support services. Please send messages to <sales@minigui.com>.
|
||||
|
||||
|
||||
[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
|
||||
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# Release Notes
|
||||
|
||||
- [Version 5.0.10](#version-5010)
|
||||
+ [What's new in version 5.0.10](#whats-new-in-version-5010)
|
||||
- [Version 5.0.9](#version-508)
|
||||
+ [What's new in version 5.0.9](#whats-new-in-version-508)
|
||||
- [Version 5.0.8](#version-508)
|
||||
+ [What's new in version 5.0.8](#whats-new-in-version-508)
|
||||
- [Version 5.0.6](#version-506)
|
||||
+ [What's new in version 5.0.6](#whats-new-in-version-506)
|
||||
- [Version 5.0.5](#version-505)
|
||||
@@ -20,6 +26,67 @@
|
||||
+ [Changes leading to incompatibility](#changes-leading-to-incompatibility)
|
||||
+ [Deprecated APIs](#deprecated-apis)
|
||||
|
||||
## Version 5.0.10
|
||||
|
||||
On Sep. 30, 2022, FMSoft announces the availability of MiniGUI 5.0.10,
|
||||
which is a bug fixing release with bug fixes and some minor enhancements
|
||||
of MiniGUI 5.0.x.
|
||||
|
||||
### What's new in version 5.0.10
|
||||
|
||||
In this version, we made some enhancements
|
||||
|
||||
* ENHANCEMENTS:
|
||||
- Enhance `fbcon` engine to support double buffering for Threads and Standalone mode. (Runtime option: `fbcon.double_buffering`).
|
||||
- Cleanup and enhance `shadow` engine to use `SyncUpdate` method.
|
||||
- Relaying `MSG_IDLE` messages to the active descendant controls in every 0.5s.
|
||||
* BUGFIXING:
|
||||
- Fix a bug reported in https://github.com/VincentWei/minigui/issues/83
|
||||
- Fix a bug reported in https://github.com/VincentWei/minigui/issues/87
|
||||
- Fix bugs reported in https://github.com/VincentWei/minigui/issues/89
|
||||
- Fix some bugs when virtual window enabled under Standalone and Processes runtime modes.
|
||||
* OPTIMIZATIONS:
|
||||
* TUNING:
|
||||
- Fix some warnings reported by GCC 12.
|
||||
- Use inline functions for SetCursor and SetDefaultCursor instead of macros.
|
||||
|
||||
## Version 5.0.9
|
||||
|
||||
On Jan. 14, 2022, FMSoft announces the availability of MiniGUI 5.0.9,
|
||||
which is a bug fixing release with minor enhancements of MiniGUI 5.0.x.
|
||||
|
||||
### What's new in version 5.0.9
|
||||
|
||||
In this version, we fixed some bugs:
|
||||
|
||||
* BUGFIXING:
|
||||
- Fix a crash bug in `InitSubDC()` of `src/newgdi/gdi.c`.
|
||||
* ENHANCEMENTS:
|
||||
* OPTIMIZATIONS:
|
||||
* TUNING:
|
||||
- Change copyright year to 2022.
|
||||
|
||||
## Version 5.0.8
|
||||
|
||||
The MiniGUI development team announces the availability of MiniGUI 5.0.8,
|
||||
which is a bug fixing release with minor enhancements of MiniGUI 5.0.x.
|
||||
|
||||
### What's new in version 5.0.8
|
||||
|
||||
In this version, we fixed some bugs and made some optimizations and enhancements:
|
||||
|
||||
* BUGFIXING:
|
||||
* ENHANCEMENTS:
|
||||
- Support for WebP image format based on `libwebp`.
|
||||
- Support for two ARM64-based hardware platforms: PX30 and R818.
|
||||
- New surface pixel format for main window: `ST_PIXEL_XRGB565` under compositing schema.
|
||||
* OPTIMIZATIONS:
|
||||
- Shrink heap size for fixed string.
|
||||
- Optimize the memory use of blitting context.
|
||||
* TUNING:
|
||||
- Tune code of fbcon video engine for compositing schema.
|
||||
- Fix warnings and errors for conditional compilation.
|
||||
|
||||
## Version 5.0.6
|
||||
|
||||
The MiniGUI development team announces the availability of MiniGUI 5.0.6,
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
Version 5.0.6 (2021/05/20)
|
||||
Version 5.0.9 (2022/01/14)
|
||||
|
||||
This is the first official 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.
|
||||
|
||||
Other packages for MiniGUI resource, tools, components, and samples:
|
||||
|
||||
|
||||
+135
-186
File diff suppressed because it is too large
Load Diff
+7
-1
@@ -105,6 +105,12 @@ seat=seat0
|
||||
[fbcon]
|
||||
defaultmode=1024x768-16bpp
|
||||
dpi=96
|
||||
|
||||
# Whether double buffering is enabled (only for threads and standalone runmodes).
|
||||
# Use `true` or `yes` for enabled, anything else for disabled.
|
||||
# Note that under compositing schema, double buffering is always enabled.
|
||||
# Since 5.0.10.
|
||||
double_buffering=true
|
||||
#}}
|
||||
|
||||
#{{ifdef _MGGAL_PCXVFB
|
||||
@@ -121,7 +127,7 @@ defaultmode=800x600-16bpp
|
||||
[shadow]
|
||||
real_engine=pc_xvfb
|
||||
defaultmode=800x600-16bpp
|
||||
rotate_screen=normal
|
||||
rotate_screen=ccw
|
||||
#}}
|
||||
|
||||
#{{ifdef _MGGAL_MLSHADOW
|
||||
|
||||
@@ -311,6 +311,7 @@ MGUI_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8);
|
||||
defined(__amd64) || \
|
||||
(defined(__alpha__) || defined(__alpha)) || \
|
||||
defined(__arm__) || defined(__aarch64__) || \
|
||||
defined(__loongarch__) || \
|
||||
defined(__riscv) || \
|
||||
(defined(__CC_ARM) && !defined(__BIG_ENDIAN)) || \
|
||||
(defined(__mips__) && defined(__MIPSEL__)) || \
|
||||
|
||||
+24
-25
@@ -131,7 +131,31 @@
|
||||
#define IAL_EVENT_GESTURE_PINCH_UPDATE 0x0084
|
||||
#define IAL_EVENT_GESTURE_PINCH_END 0x0085
|
||||
|
||||
#define TABLET_TOOL_CHANGED_X (1 << 0)
|
||||
#define TABLET_TOOL_CHANGED_Y (1 << 1)
|
||||
#define TABLET_TOOL_CHANGED_PRESSURE (1 << 2)
|
||||
#define TABLET_TOOL_CHANGED_DISTANCE (1 << 3)
|
||||
#define TABLET_TOOL_CHANGED_TILT_X (1 << 4)
|
||||
#define TABLET_TOOL_CHANGED_TILT_Y (1 << 5)
|
||||
#define TABLET_TOOL_CHANGED_ROTATION (1 << 6)
|
||||
#define TABLET_TOOL_CHANGED_SLIDER (1 << 7)
|
||||
#define TABLET_TOOL_CHANGED_SIZE_MAJOR (1 << 8)
|
||||
#define TABLET_TOOL_CHANGED_SIZE_MINOR (1 << 9)
|
||||
#define TABLET_TOOL_CHANGED_WHEEL (1 << 10)
|
||||
|
||||
#ifndef TABLET_TOOL_X
|
||||
#define TABLET_TOOL_X 0
|
||||
#define TABLET_TOOL_Y 1
|
||||
#define TABLET_TOOL_PRESSURE 2
|
||||
#define TABLET_TOOL_DISTANCE 3
|
||||
#define TABLET_TOOL_TILT_X 4
|
||||
#define TABLET_TOOL_TILT_Y 5
|
||||
#define TABLET_TOOL_ROTATION 6
|
||||
#define TABLET_TOOL_SLIDER 7
|
||||
#define TABLET_TOOL_SIZE_MAJOR 8
|
||||
#define TABLET_TOOL_SIZE_MINOR 9
|
||||
#define TABLET_TOOL_WHEEL 10
|
||||
|
||||
#define TABLET_TOOL_PROXIMITY_STATE_INVALID 0
|
||||
#define TABLET_TOOL_PROXIMITY_STATE_OUT 1
|
||||
#define TABLET_TOOL_PROXIMITY_STATE_IN 2
|
||||
@@ -149,31 +173,6 @@
|
||||
|
||||
#define TABLET_PAD_STRIP_SOURCE_UNKNOWN 0
|
||||
#define TABLET_PAD_STRIP_SOURCE_FINGER 1
|
||||
|
||||
#define TABLET_TOOL_CHANGED_X (1 << 0)
|
||||
#define TABLET_TOOL_CHANGED_Y (1 << 1)
|
||||
#define TABLET_TOOL_CHANGED_PRESSURE (1 << 2)
|
||||
#define TABLET_TOOL_CHANGED_DISTANCE (1 << 3)
|
||||
#define TABLET_TOOL_CHANGED_TILT_X (1 << 4)
|
||||
#define TABLET_TOOL_CHANGED_TILT_Y (1 << 5)
|
||||
#define TABLET_TOOL_CHANGED_ROTATION (1 << 6)
|
||||
#define TABLET_TOOL_CHANGED_SLIDER (1 << 7)
|
||||
#define TABLET_TOOL_CHANGED_SIZE_MAJOR (1 << 8)
|
||||
#define TABLET_TOOL_CHANGED_SIZE_MINOR (1 << 9)
|
||||
#define TABLET_TOOL_CHANGED_WHEEL (1 << 10)
|
||||
|
||||
#define TABLET_TOOL_X 0
|
||||
#define TABLET_TOOL_Y 1
|
||||
#define TABLET_TOOL_PRESSURE 2
|
||||
#define TABLET_TOOL_DISTANCE 3
|
||||
#define TABLET_TOOL_TILT_X 4
|
||||
#define TABLET_TOOL_TILT_Y 5
|
||||
#define TABLET_TOOL_ROTATION 6
|
||||
#define TABLET_TOOL_SLIDER 7
|
||||
#define TABLET_TOOL_SIZE_MAJOR 8
|
||||
#define TABLET_TOOL_SIZE_MINOR 9
|
||||
#define TABLET_TOOL_WHEEL 10
|
||||
|
||||
#endif
|
||||
|
||||
#define IAL_EVENT_TABLET_TOOL_AXIS 0x0090
|
||||
|
||||
+1
-1
@@ -587,7 +587,7 @@ enum {
|
||||
* \sa InitBlockDataHeap, DestroyBlockDataHeap
|
||||
*/
|
||||
typedef struct _BLOCKHEAP {
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_t lock;
|
||||
#endif
|
||||
/** Size of one block element in bytes. */
|
||||
|
||||
+8
-4
@@ -4097,7 +4097,7 @@ static inline int GUIAPI ShowCursor (BOOL fShow) {
|
||||
#endif /* !_MGHAVE_CURSOR */
|
||||
|
||||
/**
|
||||
* \def SetCursor(hcsr)
|
||||
* \fn HCURSOR SetCursor(HCURSOR hcsr)
|
||||
* \brief Changes the current cursor.
|
||||
*
|
||||
* This function changes the current cursor to be \a hcsr.
|
||||
@@ -4110,10 +4110,12 @@ static inline int GUIAPI ShowCursor (BOOL fShow) {
|
||||
*
|
||||
* \sa SetCursorEx, SetDefaultCursor
|
||||
*/
|
||||
#define SetCursor(hcsr) SetCursorEx (hcsr, FALSE)
|
||||
static inline HCURSOR SetCursor(HCURSOR hcsr) {
|
||||
return SetCursorEx (hcsr, FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* \def SetDefaultCursor(hcsr)
|
||||
* \fn HCURSOR SetDefaultCursor(HCURSOR hcsr)
|
||||
* \brief Changes the current cursor, and set it as the default cursor.
|
||||
*
|
||||
* This function changes the current cursor to be \a hcsr, and set it as
|
||||
@@ -4127,7 +4129,9 @@ static inline int GUIAPI ShowCursor (BOOL fShow) {
|
||||
*
|
||||
* \sa SetCursorEx, SetCursor
|
||||
*/
|
||||
#define SetDefaultCursor(hcsr) SetCursorEx (hcsr, TRUE)
|
||||
static inline HCURSOR SetDefaultCursor(HCURSOR hcsr) {
|
||||
return SetCursorEx (hcsr, TRUE);
|
||||
}
|
||||
|
||||
/** @} end of cursor_fns */
|
||||
|
||||
|
||||
+4
-1
@@ -2905,6 +2905,9 @@ typedef struct _WINMASKINFO {
|
||||
*
|
||||
* This message is sent to the all main windows when the system
|
||||
* enters idle loop.
|
||||
*
|
||||
* Since 5.0.10, this messasge will be relayed to the active child control
|
||||
* if the main window is currently active.
|
||||
*/
|
||||
#define MSG_IDLE 0x0142
|
||||
|
||||
@@ -6455,7 +6458,7 @@ MG_EXPORT RES_KEY Str2Key (const char* str);
|
||||
* \fn int GUIAPI GetWindowZOrder(HWND hWnd);
|
||||
* \brief Get The Control ZOrder in the parent window
|
||||
*
|
||||
* \param hWnd Handle of a control
|
||||
* \param hWnd Handler of a control
|
||||
*
|
||||
* \return return index of ZOrder or 0 if hWnd is a MainWindow or -1 if error
|
||||
*
|
||||
|
||||
+18
-43
@@ -1,52 +1,27 @@
|
||||
if MG_MINIMALGDI
|
||||
COMMON_SUBDIRS = misc kernel sysres include
|
||||
COMMON_SUBDIRS = libc misc main kernel sysres ial control ex_ctrl font gui mybmp include textedit newgal newgdi
|
||||
|
||||
COMMON_LADD = \
|
||||
kernel/libkernel.la \
|
||||
sysres/libsysres.la \
|
||||
misc/libmisc.la
|
||||
else
|
||||
COMMON_SUBDIRS = libc misc main kernel sysres ial control ex_ctrl font gui mybmp include textedit
|
||||
|
||||
COMMON_LADD = \
|
||||
libc/liblibc.la \
|
||||
misc/libmisc.la \
|
||||
control/libcontrol.la \
|
||||
ex_ctrl/libexctrl.la \
|
||||
font/libfont.la \
|
||||
COMMON_LADD = \
|
||||
libc/liblibc.la \
|
||||
misc/libmisc.la \
|
||||
control/libcontrol.la \
|
||||
ex_ctrl/libexctrl.la \
|
||||
font/libfont.la \
|
||||
font/in-core/libincore.la \
|
||||
ial/libial.la \
|
||||
gui/libgui.la \
|
||||
main/libmain.la \
|
||||
mybmp/libmybmp.la \
|
||||
kernel/libkernel.la \
|
||||
ial/libial.la \
|
||||
gui/libgui.la \
|
||||
main/libmain.la \
|
||||
mybmp/libmybmp.la \
|
||||
kernel/libkernel.la \
|
||||
sysres/libsysres.la \
|
||||
textedit/libtextedit.la
|
||||
endif
|
||||
textedit/libtextedit.la \
|
||||
newgal/libnewgal.la \
|
||||
newgdi/libnewgdi.la
|
||||
|
||||
if MGRM_STANDALONE
|
||||
LITE_LADD = standalone/libstandalone.la
|
||||
LITE_SUBDIRS = standalone
|
||||
else
|
||||
if MGRM_PROCESSES
|
||||
LITE_LADD = server/libserver.la client/libclient.la
|
||||
LITE_SUBDIRS = server client
|
||||
else
|
||||
LITE_LADD =
|
||||
LITE_SUBDIRS =
|
||||
endif
|
||||
endif
|
||||
|
||||
NEWGAL_LADD = newgal/libnewgal.la newgdi/libnewgdi.la
|
||||
NEWGAL_SUBDIRS = newgal newgdi
|
||||
|
||||
DIST_SUBDIRS = $(COMMON_SUBDIRS) newgal newgdi server client standalone
|
||||
SUBDIRS = $(COMMON_SUBDIRS) $(NEWGAL_SUBDIRS) $(LITE_SUBDIRS)
|
||||
DIST_SUBDIRS = $(COMMON_SUBDIRS) newgal newgdi server client standalone
|
||||
SUBDIRS = $(COMMON_SUBDIRS) @RUNMODE_SUBDIRS@
|
||||
|
||||
MGSOURCES = template.c template.h
|
||||
MGLIBADD = $(COMMON_LADD) \
|
||||
$(LITE_LADD) \
|
||||
$(NEWGAL_LADD)
|
||||
MGLIBADD = $(COMMON_LADD) @RUNMODE_LADD@
|
||||
MGLDFLAGS = -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
|
||||
|
||||
lib_LTLIBRARIES=libminigui_@MGLIB_SUFFIX@.la
|
||||
|
||||
+12
-14
@@ -299,7 +299,15 @@ static void change_status_from_pose (PCONTROL pctrl, int new_pose,
|
||||
}
|
||||
}
|
||||
|
||||
/*complete a click if the click if valid
|
||||
/* DK: When the radio or check button state changes do not erase the background,
|
||||
* and the prospects for direct rendering */
|
||||
btnGetRects (pctrl, &rcClient, &rcContent, &rcBitmap);
|
||||
if (BUTTON_IS_PUSHBTN(pctrl) || (pctrl->dwStyle & BS_PUSHLIKE))
|
||||
InvalidateRect((HWND)pctrl, NULL, TRUE);
|
||||
else
|
||||
InvalidateRect((HWND)pctrl, &rcBitmap, FALSE);
|
||||
|
||||
/* complete a click if the click if valid
|
||||
* (mouse lbutton up in button )*/
|
||||
if (old_pose == BST_PUSHED && new_pose != BST_DISABLE
|
||||
&& change_valid)
|
||||
@@ -312,14 +320,6 @@ static void change_status_from_pose (PCONTROL pctrl, int new_pose,
|
||||
|
||||
NotifyParent ((HWND)pctrl, pctrl->id, BN_CLICKED);
|
||||
}
|
||||
|
||||
/* DK: When the radio or check button state changes do not erase the background,
|
||||
* and the prospects for direct rendering */
|
||||
btnGetRects (pctrl, &rcClient, &rcContent, &rcBitmap);
|
||||
if (BUTTON_IS_PUSHBTN(pctrl) || (pctrl->dwStyle & BS_PUSHLIKE))
|
||||
InvalidateRect((HWND)pctrl, NULL, TRUE);
|
||||
else
|
||||
InvalidateRect((HWND)pctrl, &rcBitmap, FALSE);
|
||||
}
|
||||
|
||||
/*btnGetRects:
|
||||
@@ -423,8 +423,8 @@ static void draw_bitmap_button (PCONTROL pctrl, HDC hdc, DWORD dwStyle,
|
||||
|
||||
GetClientRect ((HWND)pctrl, &prcClient);
|
||||
if (dwStyle & BS_REALSIZEIMAGE) {
|
||||
x += (w - bmp->bmWidth) >> 1;
|
||||
y += (h - bmp->bmHeight) >> 1;
|
||||
x += (int)(w - bmp->bmWidth) >> 1;
|
||||
y += (int)(h - bmp->bmHeight) >> 1;
|
||||
w = h = 0;
|
||||
|
||||
if (bmp->bmWidth > RECTW(prcClient)){
|
||||
@@ -847,8 +847,6 @@ static LRESULT ButtonCtrlProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
case BM_SETSTYLE:
|
||||
pctrl->dwStyle &= 0xFFFF0000;
|
||||
pctrl->dwStyle |= (DWORD)(wParam & 0x0000FFFF);
|
||||
@@ -1054,7 +1052,7 @@ static LRESULT ButtonCtrlProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
return DefaultControlProc (hWnd, uMsg, wParam, lParam);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@@ -493,10 +493,15 @@ LRESULT ScrollViewCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lPara
|
||||
break;
|
||||
}
|
||||
|
||||
case MSG_DESTROY:
|
||||
scrollview_destroy (psvdata);
|
||||
free (psvdata);
|
||||
case MSG_DESTROY: {
|
||||
/* suppress a warning about calling free() before using the pointer */
|
||||
PSVDATA svdata = (PSVDATA) GetWindowAdditionalData2 (hWnd);
|
||||
if (svdata) {
|
||||
scrollview_destroy(svdata);
|
||||
free (svdata);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case MSG_GETDLGCODE:
|
||||
return DLGC_WANTARROWS;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@@ -283,7 +283,7 @@ static void DrawCoolBox (HWND hWnd, HDC hdc, PCOOLBARCTRL pdata)
|
||||
WINDOWINFO *info;
|
||||
RECT rc;
|
||||
|
||||
if (tmpdata->Caption == NULL || tmpdata->Caption [0] == '\0')
|
||||
if (tmpdata->Caption [0] == '\0')
|
||||
break;
|
||||
|
||||
GetTextExtent (hdc, tmpdata->Caption, -1, &size);
|
||||
|
||||
@@ -157,6 +157,8 @@ static int isInItem (MgList *mglst, int mouseX, int mouseY,
|
||||
|
||||
index = row * pivlist->nCol + col;
|
||||
pci = (IconviewItem *)mglist_getitem_byindex (mglst, index);
|
||||
if (pci == NULL)
|
||||
return -1;
|
||||
|
||||
if (pRet)
|
||||
*pRet = (MgItem*)pci;
|
||||
|
||||
@@ -59,7 +59,6 @@
|
||||
#include "cliprect.h"
|
||||
#include "gal.h"
|
||||
#include "internals.h"
|
||||
#include "blockheap.h"
|
||||
#include "accelkey.h"
|
||||
|
||||
static BLOCKHEAP ACHeap;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@@ -803,7 +803,7 @@ BOOL GUIAPI InitWindowElementAttrs (PWERENDERER rdr)
|
||||
char buff [20];
|
||||
DWORD rgba;
|
||||
|
||||
if (!rdr || !rdr->name || rdr->name[0] == '\0')
|
||||
if (!rdr || rdr->name[0] == '\0')
|
||||
return FALSE;
|
||||
|
||||
_DBG_PRINTF ("GUI>InitWEA: Initialize %s renderer window element attributes.\n",
|
||||
|
||||
@@ -71,7 +71,6 @@
|
||||
#include "cliprect.h"
|
||||
#include "gal.h"
|
||||
#include "internals.h"
|
||||
#include "blockheap.h"
|
||||
#include "menu.h"
|
||||
|
||||
#define SHORTEN 0
|
||||
|
||||
+74
-36
@@ -75,9 +75,6 @@
|
||||
#ifdef _MG_ENABLE_LICENSE
|
||||
# include "../sysres/license/c_files/04_progressbar-bk.dat.c"
|
||||
#endif
|
||||
#ifndef __TARGET_UNKNOWN__
|
||||
unsigned int g_license_processor_id;
|
||||
#endif
|
||||
|
||||
#ifdef _MGHAVE_MENU
|
||||
/* function defined in menu module. */
|
||||
@@ -2228,6 +2225,13 @@ static LRESULT DefaultPostMsgHandler(PMAINWIN pWin, UINT message,
|
||||
OnQueryClientArea(pWin, (PRECT)lParam);
|
||||
break;
|
||||
|
||||
case MSG_ACTIVE:
|
||||
if (wParam)
|
||||
pWin->dwExStyle |= WS_EX_ACTIVATED;
|
||||
else
|
||||
pWin->dwExStyle &= ~WS_EX_ACTIVATED;
|
||||
break;
|
||||
|
||||
case MSG_SETFOCUS:
|
||||
case MSG_KILLFOCUS:
|
||||
if (pWin->hActiveChild && !lParam)
|
||||
@@ -2600,23 +2604,44 @@ static LRESULT DefaultSessionMsgHandler(PMAINWIN pWin, UINT message,
|
||||
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,
|
||||
WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
|
||||
/*
|
||||
** Should handle following messages:
|
||||
**
|
||||
** MSG_IDLE, MSG_CARETBLINK:
|
||||
*/
|
||||
if (message == MSG_IDLE) {
|
||||
#if 0 /* deprecated code */
|
||||
if (pWin == checkAndGetMainWinIfWindow (sg_repeat_msg.hwnd)) {
|
||||
SendNotifyMessage (sg_repeat_msg.hwnd,
|
||||
sg_repeat_msg.message,
|
||||
sg_repeat_msg.wParam, sg_repeat_msg.lParam);
|
||||
/* Since 5.0.10, MSG_IDLE will also be relayed to
|
||||
the active child control if the main window is active currently */
|
||||
if (pWin->dwExStyle & WS_EX_ACTIVATED) {
|
||||
HWND active = GetFocusChild((HWND)pWin);
|
||||
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) {
|
||||
BlinkCaret ((HWND)pWin);
|
||||
@@ -2676,18 +2701,32 @@ LRESULT PreDefMainWinProc (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;
|
||||
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)
|
||||
return 0;
|
||||
|
||||
SetCursor (GetWindowCursor (hWnd));
|
||||
return 0;
|
||||
}
|
||||
else if (message == MSG_NCSETCURSOR) {
|
||||
|
||||
case MSG_NCSETCURSOR:
|
||||
SetCursor (GetSystemCursor (IDC_ARROW));
|
||||
return 0;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return DefaultMainWinProc (hWnd, message, wParam, lParam);
|
||||
@@ -2995,6 +3034,7 @@ HWND GUIAPI GetFirstHosted (HWND hWnd)
|
||||
PMAINWIN pMainWin;
|
||||
|
||||
if ((pMainWin = getMainWinIfWindowInThisThread (hWnd)) == NULL) {
|
||||
_WRN_PRINTF("hWnd (%p) is not in the current thread\n", hWnd);
|
||||
return HWND_INVALID;
|
||||
}
|
||||
|
||||
@@ -3008,6 +3048,7 @@ HWND GUIAPI GetNextHosted (HWND hHosting, HWND hHosted)
|
||||
PMAINWIN pHosted;
|
||||
|
||||
if ((pHosting = getMainWinIfWindowInThisThread (hHosting)) == NULL) {
|
||||
_WRN_PRINTF("hHosing (%p) is not in the current thread\n", hHosting);
|
||||
return HWND_INVALID;
|
||||
}
|
||||
|
||||
@@ -3016,10 +3057,13 @@ HWND GUIAPI GetNextHosted (HWND hHosting, HWND hHosted)
|
||||
}
|
||||
|
||||
if ((pHosted = getMainWinIfWindowInThisThread (hHosted)) == NULL) {
|
||||
_WRN_PRINTF("hHosted (%p) is not in the current thread\n", hHosted);
|
||||
return HWND_INVALID;
|
||||
}
|
||||
|
||||
if (MG_UNLIKELY (pHosted->pHosting != pHosting)) {
|
||||
_ERR_PRINTF("Bad hosting relationship between hosting(%p) and hosted(%p)\n",
|
||||
pHosting, pHosted);
|
||||
return HWND_INVALID;
|
||||
}
|
||||
|
||||
@@ -3081,6 +3125,7 @@ static PMAINWIN search_win_tree_bfs (struct _search_context *ctxt)
|
||||
}
|
||||
}
|
||||
|
||||
hosting = hosted;
|
||||
hosted = GetFirstHosted (hosted);
|
||||
}
|
||||
|
||||
@@ -3167,8 +3212,8 @@ HWND GUIAPI GetNextChild (HWND hWnd, HWND hChild)
|
||||
|
||||
HWND GUIAPI GetNextMainWindow (HWND hMainWnd)
|
||||
{
|
||||
MG_CHECK_RET (hMainWnd != HWND_NULL &&
|
||||
!MG_IS_NORMAL_MAIN_WINDOW (hMainWnd), HWND_INVALID);
|
||||
MG_CHECK_RET (hMainWnd == HWND_NULL ||
|
||||
MG_IS_NORMAL_MAIN_WINDOW (hMainWnd), HWND_INVALID);
|
||||
|
||||
return (HWND)SendMessage (HWND_DESKTOP,
|
||||
MSG_GETNEXTMAINWIN, (WPARAM)hMainWnd, 0L);
|
||||
@@ -3236,6 +3281,7 @@ int GUIAPI ScrollWindowEx (HWND hWnd, int dx, int dy,
|
||||
}
|
||||
|
||||
SendMessage (HWND_DESKTOP, MSG_SCROLLMAINWIN, (WPARAM)hWnd, (LPARAM)(&swi));
|
||||
UpdateInvalidClient(hWnd, FALSE);
|
||||
|
||||
/* show caret */
|
||||
if (fCaret) ShowCaretEx (hWnd, FALSE);
|
||||
@@ -3707,6 +3753,8 @@ BOOL GUIAPI ShowScrollBar (HWND hWnd, int iSBar, BOOL bShow)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
/* moved here from desktop.c; can be used on virtual window */
|
||||
static void guiAddNewHostedMainWindow (PMAINWIN pHosting, PMAINWIN pHosted)
|
||||
{
|
||||
@@ -3758,6 +3806,7 @@ static void guiRemoveHostedMainWindow (PMAINWIN pHosting, PMAINWIN pHosted)
|
||||
}
|
||||
#endif /* debug code */
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/************************* Support for virtual window ************************/
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
@@ -3778,29 +3827,32 @@ static void* _message_thread_entry (void* arg)
|
||||
goto failed;
|
||||
|
||||
/* create message queue for this thread */
|
||||
if (!(entry_args.msg_queue = mg_AllocMsgQueueForThisThread ()))
|
||||
if (!(entry_args.msg_queue = mg_AllocMsgQueueForThisThread (FALSE)))
|
||||
goto failed;
|
||||
|
||||
orig_args->msg_queue = entry_args.msg_queue;
|
||||
sem_post (entry_args.wait);
|
||||
|
||||
/* register the message queue */
|
||||
SendMessage (HWND_DESKTOP, MSG_MANAGE_MSGTHREAD,
|
||||
MSGTHREAD_SIGNIN, (LPARAM)&entry_args.msg_queue);
|
||||
|
||||
if (pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL))
|
||||
goto failed;
|
||||
goto cancelled;
|
||||
|
||||
/* call start routine of app */
|
||||
entry_args.start_routine (entry_args.arg);
|
||||
|
||||
/* unregister the message queue */
|
||||
SendMessage (HWND_DESKTOP, MSG_MANAGE_MSGTHREAD,
|
||||
MSGTHREAD_SIGNOUT, (LPARAM)&entry_args.msg_queue);
|
||||
mg_FreeMsgQueueForThisThread ();
|
||||
mg_FreeMsgQueueForThisThread (FALSE);
|
||||
|
||||
return NULL;
|
||||
|
||||
failed:
|
||||
sem_post (entry_args.wait);
|
||||
cancelled:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -3905,9 +3957,7 @@ HWND GUIAPI CreateVirtualWindow (HWND hHosting, WNDPROC WndProc,
|
||||
if (pMsgQueue != getMsgQueueIfWindowInThisThread (hHosting)) {
|
||||
goto err;
|
||||
}
|
||||
else {
|
||||
pVirtWin->pHosting = (PVIRTWIN)hHosting;
|
||||
}
|
||||
pVirtWin->pHosting = (PVIRTWIN)hHosting;
|
||||
}
|
||||
|
||||
if (SendMessage ((HWND)pVirtWin, MSG_CREATE,
|
||||
@@ -4210,10 +4260,8 @@ HWND GUIAPI CreateMainWindowEx2 (PMAINWINCREATE pCreateInfo, LINT id,
|
||||
if (pWin->pMsgQueue != getMsgQueue (pCreateInfo->hHosting)) {
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
if (pWin->pHosting == NULL)
|
||||
pWin->pHosting = getMainWindowPtr (pCreateInfo->hHosting);
|
||||
}
|
||||
|
||||
#else /* defined _MGRM_THREADS */
|
||||
|
||||
@@ -4497,7 +4545,7 @@ BOOL GUIAPI DestroyMainWindow (HWND hWnd)
|
||||
}
|
||||
else
|
||||
#endif /* defined _MGHAVE_VIRTUAL_WINDOW */
|
||||
if (pWin->dwExStyle & WS_EX_DIALOGBOX) {
|
||||
if (hosted->dwExStyle & WS_EX_DIALOGBOX) {
|
||||
if (!EndDialog ((HWND)hosted, IDCANCEL))
|
||||
return FALSE;
|
||||
}
|
||||
@@ -4532,11 +4580,6 @@ BOOL GUIAPI DestroyMainWindow (HWND hWnd)
|
||||
|
||||
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 */
|
||||
pWin->DataType = TYPE_WINTODEL;
|
||||
|
||||
@@ -6088,11 +6131,6 @@ BOOL GUIAPI DestroyWindow (HWND hWnd)
|
||||
pCtrl->privCDC = 0;
|
||||
}
|
||||
|
||||
#if 0 /* deprecated code */
|
||||
if (sg_repeat_msg.hwnd == hWnd)
|
||||
sg_repeat_msg.hwnd = 0;
|
||||
#endif /* deprecated code */
|
||||
|
||||
ThrowAwayMessages (hWnd);
|
||||
|
||||
if (pCtrl->dwExStyle & WS_EX_CTRLASMAINWIN) {
|
||||
|
||||
@@ -319,6 +319,19 @@ static void flush_rec (void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void close_rec (void)
|
||||
{
|
||||
#ifdef WIN32
|
||||
/* TODO: */
|
||||
#else
|
||||
if (record_fd >= 0) {
|
||||
close(record_fd);
|
||||
record_fd = -1;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void do_record(AUTO_IAL_INPUT_EVENT *event)
|
||||
{
|
||||
@@ -744,6 +757,7 @@ void TermPCXVFBInput (void)
|
||||
remove("/tmp/.pcxvfb_tmp");
|
||||
}
|
||||
#endif
|
||||
close_rec();
|
||||
#endif /* WIN32 */
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ noinst_HEADERS = \
|
||||
cursor.h dc.h event.h list.h element.h \
|
||||
ial.h inline.h internals.h zorder.h menu.h misc.h \
|
||||
msgstr.h sysfont.h timer.h devfont.h fontname.h \
|
||||
readbmp.h icon.h blockheap.h rbtree.h \
|
||||
readbmp.h icon.h rbtree.h \
|
||||
ourhdr.h client.h server.h sharedres.h sockio.h drawsemop.h \
|
||||
gal.h newgal.h memops.h incoreres.h sysres.h clipboard.h \
|
||||
glyph.h license.h mgsock.h unicode-ops.h \
|
||||
|
||||
@@ -47,6 +47,8 @@
|
||||
** blockheap.h: the head file of heap for block data.
|
||||
**
|
||||
** Create date: 2001/01/10
|
||||
**
|
||||
** DEPRECATED, USE window.h INSTEAD.
|
||||
*/
|
||||
|
||||
#ifndef GUI_BLOCKHEAP_H
|
||||
@@ -55,7 +57,7 @@
|
||||
#ifndef _MGUI_GDI_H /* included in include/gdi.h */
|
||||
|
||||
struct _BLOCKHEAP {
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_t lock;
|
||||
#endif
|
||||
/* Size of one block element. */
|
||||
+1
-1
@@ -93,7 +93,7 @@ typedef struct tagDC* PDC;
|
||||
# else /* not defined _MGSCHEMA_COMPOSITING */
|
||||
void __mg_lock_recalc_gcrinfo (PDC pdc);
|
||||
void __mg_unlock_gcrinfo (PDC pdc);
|
||||
#define LOCK_GCRINFO(pdc) __mg_lock_recalc_gcrinfo (pdc)
|
||||
#define LOCK_GCRINFO(pdc) if (dc_IsGeneralDC(pdc)) __mg_lock_recalc_gcrinfo (pdc)
|
||||
#define UNLOCK_GCRINFO(pdc) if (dc_IsGeneralDC(pdc)) __mg_unlock_gcrinfo (pdc)
|
||||
# endif /* not defined _MGSCHEMA_COMPOSITING */
|
||||
|
||||
|
||||
+13
-6
@@ -84,15 +84,18 @@
|
||||
#define WS_EX_MODALDISABLED 0x10000000L
|
||||
|
||||
/*
|
||||
* \def WS_EX_CTRLASMAINWIN
|
||||
* \brief The control can be displayed out of the main window
|
||||
* which contains the control.
|
||||
* Internal extended style:
|
||||
* The control can be displayed out of the main window
|
||||
* which contains the control.
|
||||
*/
|
||||
#define WS_EX_CTRLASMAINWIN 0x20000000L
|
||||
|
||||
/* Internal extended style. */
|
||||
/* Internal extended style: dialog box. */
|
||||
#define WS_EX_DIALOGBOX 0x40000000L
|
||||
|
||||
/* Internal extended style: activated. */
|
||||
#define WS_EX_ACTIVATED 0x80000000L
|
||||
|
||||
/* Make sure the internal window extended styles above are ok */
|
||||
#define MGUI_COMPILE_TIME_ASSERT(name, x) \
|
||||
typedef int MGUI_dummy_ ## name[((x)?1:0) * 2 - 1]
|
||||
@@ -101,6 +104,10 @@ MGUI_COMPILE_TIME_ASSERT(ws_ex_int_1,
|
||||
WS_EX_INTERNAL_MASK & WS_EX_MODALDISABLED);
|
||||
MGUI_COMPILE_TIME_ASSERT(ws_ex_int_2,
|
||||
WS_EX_INTERNAL_MASK & WS_EX_CTRLASMAINWIN);
|
||||
MGUI_COMPILE_TIME_ASSERT(ws_ex_int_3,
|
||||
WS_EX_INTERNAL_MASK & WS_EX_DIALOGBOX);
|
||||
MGUI_COMPILE_TIME_ASSERT(ws_ex_int_4,
|
||||
WS_EX_INTERNAL_MASK & WS_EX_ACTIVATED);
|
||||
|
||||
#undef MGUI_COMPILE_TIME_ASSERT
|
||||
|
||||
@@ -772,8 +779,8 @@ static inline PMSGQUEUE getMsgQueue (HWND hWnd)
|
||||
}
|
||||
|
||||
|
||||
MSGQUEUE* mg_AllocMsgQueueForThisThread (void);
|
||||
void mg_FreeMsgQueueForThisThread (void);
|
||||
MSGQUEUE* mg_AllocMsgQueueForThisThread (BOOL sign_in);
|
||||
void mg_FreeMsgQueueForThisThread (BOOL sign_off);
|
||||
|
||||
/* Since 5.0.0 */
|
||||
int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd);
|
||||
|
||||
+9
-111
@@ -54,26 +54,12 @@
|
||||
# define MG_LOCAL /* NULL */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Common
|
||||
*/
|
||||
#if defined(_MG_ENABLE_SPLASH) || \
|
||||
defined(_MG_ENABLE_SCREENSAVER) || \
|
||||
defined(_MG_ENABLE_WATERMARK)
|
||||
|
||||
#define _MG_ENABLE_LICENSE 1
|
||||
|
||||
enum {
|
||||
SPLASH_MINIGUI,
|
||||
SPLASH_FMSOFT,
|
||||
SPLASH_FEIMAN,
|
||||
SPLASH_PROGRESSBAR,
|
||||
SPLASH_PROGRESSBAR_BK,
|
||||
#if 0
|
||||
WATERMARK_1,
|
||||
WATERMARK_2,
|
||||
WATERMARK_3,
|
||||
#endif /* _MG_ENABLE_WATERMARK */
|
||||
LICENSE_BITMAP_NR
|
||||
};
|
||||
|
||||
@@ -85,14 +71,14 @@ extern MG_LOCAL BITMAP g_license_bitmaps[];
|
||||
#define g_bitmap_progressbar g_license_bitmaps[SPLASH_PROGRESSBAR]
|
||||
#define g_bitmap_progressbar_bk g_license_bitmaps[SPLASH_PROGRESSBAR_BK]
|
||||
|
||||
#if defined(_MG_ENABLE_SPLASH) || defined(_MG_ENABLE_SCREENSAVER)
|
||||
# define _MG_ENABLE_LICENSE 1
|
||||
MG_LOCAL void __mg_license_create(void);
|
||||
MG_LOCAL void __mg_license_destroy(void);
|
||||
|
||||
#else
|
||||
# define __mg_license_create() /* NULL */
|
||||
# define __mg_license_destroy() /* NULL */
|
||||
#endif /* endif _MG_ENABLE_SPLASH or _MG_ENABLE_SCREENSAVER or _MG_ENABLE_WATERMARK*/
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _MG_ENABLE_SCREENSAVER
|
||||
MG_LOCAL void __mg_screensaver_create(void);
|
||||
@@ -102,9 +88,6 @@ MG_LOCAL void __mg_screensaver_destroy(void);
|
||||
# define __mg_screensaver_destroy() /* NULL */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Splash
|
||||
*/
|
||||
#ifdef _MG_ENABLE_SPLASH
|
||||
MG_LOCAL void __mg_splash_draw_framework(void);
|
||||
MG_LOCAL void __mg_splash_progress(void);
|
||||
@@ -115,96 +98,11 @@ MG_LOCAL void __mg_splash_delay(void);
|
||||
# define __mg_splash_delay() /* NULL */
|
||||
#endif /* endif _MG_ENABLE_SPLASH */
|
||||
|
||||
/*
|
||||
* ScreenSaver & Watermark
|
||||
*/
|
||||
#if defined(_MG_ENABLE_SCREENSAVER) || defined(_MG_ENABLE_WATERMARK)
|
||||
MG_LOCAL void __mg_license_on_input(void);
|
||||
MG_LOCAL void __mg_license_on_timeout(void);
|
||||
#else
|
||||
# define __mg_license_on_input() /* NULL */
|
||||
# define __mg_license_on_timeout() /* NULL */
|
||||
#endif /* _MG_ENABLE_SCREENSAVER || _MG_ENABLE_WATERMARK */
|
||||
|
||||
/*
|
||||
* Product ID
|
||||
*/
|
||||
#ifdef _MG_PRODUCTID
|
||||
typedef struct _product_id {
|
||||
/* Fixed 8-byte code, help us to locate the struct in .so file */
|
||||
unsigned char prefix[8];
|
||||
/* the ID of the customer */
|
||||
int customer_id;
|
||||
/* svn version */
|
||||
int version;
|
||||
/* When does we compile the .so, in seconds */
|
||||
int compile_date;
|
||||
/* The size of the .so file */
|
||||
int file_size;
|
||||
/* The check sum of the .so file */
|
||||
unsigned char checksum[16];
|
||||
} product_id_t;
|
||||
|
||||
#define PRODUCT_ID_PREFIX 0xca, 0x3f, 0x2b, 0x43, 0x00, 0x33, 0xb0, 0xc3
|
||||
|
||||
MG_LOCAL int license_get_customer_id(void);
|
||||
|
||||
#endif /* _MG_PRODUCTID */
|
||||
|
||||
/*
|
||||
* Tools to encrypt const variables
|
||||
*/
|
||||
MG_LOCAL unsigned int LICENSE_ENCRYPTED_CONST_INT(unsigned int);
|
||||
MG_LOCAL char *LICENSE_ENCRYPTED_CONST_STRING(unsigned char *, int);
|
||||
|
||||
/*
|
||||
* Processor ID
|
||||
*/
|
||||
#ifdef _MG_PRODUCTID
|
||||
# define LICENSE_CHECK_CUSTIMER_ID() \
|
||||
do { \
|
||||
if (! license_get_customer_id()) { \
|
||||
return ERR_INVALID_ARGS; \
|
||||
} \
|
||||
} while(0)
|
||||
#else
|
||||
# define LICENSE_CHECK_CUSTIMER_ID() /* NULL */
|
||||
#endif
|
||||
|
||||
#ifdef __TARGET_UNKNOWN__
|
||||
|
||||
# define license_get_processor_id() /* NULL */
|
||||
# define LICENSE_SET_MESSAGE_OFFSET() /* NULL */
|
||||
# define LICENSE_MODIFY_MESSAGE(x) /* NULL */
|
||||
|
||||
#else /* not __TARGET_UNKNOWN__ */
|
||||
|
||||
extern MG_LOCAL unsigned int g_license_processor_id; /* window.c */
|
||||
MG_LOCAL void license_get_processor_id (void);
|
||||
#define LICENSE_PROCESSOR_ID_NONE (0xFC1D8B2A)
|
||||
|
||||
extern MG_LOCAL unsigned int g_license_message_offset; /* zorder.c */
|
||||
|
||||
#if defined (_WITH_TARGET_S3C6410)
|
||||
# define REAL_PROCESSOR_ID LICENSE_ENCRYPTED_CONST_INT(0x1AE2FDFD /* 0x36410101 */)
|
||||
#elif defined (_WITH_TARGET_S3C2440)
|
||||
# define REAL_PROCESSOR_ID LICENSE_ENCRYPTED_CONST_INT(0x3AA4FDFD /* 0x32440101 */)
|
||||
#elif defined (_WITH_TARGET_S3C2410)
|
||||
# define REAL_PROCESSOR_ID LICENSE_ENCRYPTED_CONST_INT(0x3AE2FDFD /* 0x32410101 */)
|
||||
#elif defined (_WITH_TARGET_HI3560A)
|
||||
# define REAL_PROCESSOR_ID LICENSE_ENCRYPTED_CONST_INT(0xFC38C9AD /* 0x35600200 */)
|
||||
#else
|
||||
# define REAL_PROCESSOR_ID LICENSE_PROCESSOR_ID_NONE
|
||||
#endif
|
||||
|
||||
#define LICENSE_SET_MESSAGE_OFFSET() do {g_license_message_offset=g_license_processor_id-(REAL_PROCESSOR_ID);}while (0)
|
||||
|
||||
#define LICENSE_MODIFY_MESSAGE(pMsg) \
|
||||
do { \
|
||||
pMsg->message += g_license_message_offset; \
|
||||
pMsg->hwnd -= g_license_message_offset / 2; \
|
||||
} while (0)
|
||||
|
||||
#endif /* __TARGET_UNKNOWN__ */
|
||||
#define __mg_license_on_input() /* NULL */
|
||||
#define __mg_license_on_timeout() /* NULL */
|
||||
#define LICENSE_CHECK_CUSTIMER_ID() /* NULL */
|
||||
#define license_get_processor_id() /* NULL */
|
||||
#define LICENSE_SET_MESSAGE_OFFSET() /* NULL */
|
||||
#define LICENSE_MODIFY_MESSAGE(x) /* NULL */
|
||||
|
||||
#endif /* LICENSE_H */
|
||||
|
||||
+7
-11
@@ -55,9 +55,9 @@
|
||||
#ifndef GUI_NEWGAL_H
|
||||
#define GUI_NEWGAL_H
|
||||
|
||||
#include "minigui.h"
|
||||
#include "gdi.h"
|
||||
#include "constants.h"
|
||||
#include "blockheap.h"
|
||||
|
||||
#if IS_COMPOSITING_SCHEMA
|
||||
#include <sys/types.h>
|
||||
@@ -216,7 +216,10 @@ typedef struct GAL_Surface {
|
||||
|
||||
#ifdef _MGUSE_PIXMAN
|
||||
pixman_image_t *pix_img; /* The pixman image object for this surface */
|
||||
void *blit_ctxt; /* blitting context */
|
||||
pixman_image_t *msk_img;
|
||||
uint16_t pix_op;
|
||||
uint16_t pix_filter;
|
||||
uint32_t pix_alpha_bits;
|
||||
#endif
|
||||
|
||||
#if IS_COMPOSITING_SCHEMA
|
||||
@@ -818,13 +821,6 @@ static inline BOOL GAL_CheckPixmanFormats (GAL_Surface *src, GAL_Surface *dst)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
typedef struct GAL_BlittingContext {
|
||||
uint16_t op;
|
||||
uint16_t filter;
|
||||
uint32_t alpha_bits;
|
||||
pixman_image_t *msk_img;
|
||||
} GAL_BlittingContext;
|
||||
|
||||
int GAL_SetupBlitting (GAL_Surface *src, GAL_Surface *dst, DWORD ops);
|
||||
|
||||
int GAL_CleanupBlitting (GAL_Surface *src, GAL_Surface *dst);
|
||||
@@ -1071,8 +1067,8 @@ GAL_Surface* __drm_create_surface_from_name (GHANDLE video,
|
||||
uint32_t name, uint32_t drm_format, uint32_t pixels_off,
|
||||
uint32_t width, uint32_t height, uint32_t pitch);
|
||||
|
||||
GAL_Surface* __drm_create_surface_from_handle (GHANDLE video,
|
||||
uint32_t handle, size_t size, uint32_t drm_format, uint32_t pixels_off,
|
||||
GAL_Surface* __drm_create_surface_from_handle (GHANDLE video, uint32_t handle,
|
||||
size_t size, uint32_t drm_format, uint32_t pixels_off,
|
||||
uint32_t width, uint32_t height, uint32_t pitch);
|
||||
|
||||
GAL_Surface* __drm_create_surface_from_prime_fd (GHANDLE video,
|
||||
|
||||
@@ -138,6 +138,14 @@ int __mg_save_png (MG_RWops* fp, MYBITMAP* bmp, RGB* pal);
|
||||
BOOL __mg_check_png (MG_RWops* fp);
|
||||
#endif
|
||||
|
||||
#ifdef _MGIMAGE_WEBP
|
||||
void* __mg_init_webp (MG_RWops* fp, MYBITMAP *png, RGB *pal);
|
||||
int __mg_load_webp (MG_RWops* fp, void* init_info, MYBITMAP *png, CB_ONE_SCANLINE cb, void* context);
|
||||
void __mg_cleanup_webp (void* init_info);
|
||||
int __mg_save_webp (MG_RWops* fp, MYBITMAP* bmp, RGB* pal);
|
||||
BOOL __mg_check_webp (MG_RWops* fp);
|
||||
#endif
|
||||
|
||||
int __mg_bmp_compute_pitch (int bpp, Uint32 width, Uint32 *pitch, BOOL does_round);
|
||||
|
||||
#define fp_getc(fp) MGUI_RWgetc(fp)
|
||||
|
||||
@@ -141,11 +141,17 @@ typedef struct _ZORDERINFO {
|
||||
/* The size of usage bitmap for mask rect. */
|
||||
int size_maskrect_usage_bmp;
|
||||
|
||||
/* use read/write lock for Unix-like OS */
|
||||
#ifndef __NOUNIX__
|
||||
#define __ZI_USE_RWLOCK 1
|
||||
#endif
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
# ifndef __NOUNIX__
|
||||
# ifdef __ZI_USE_RWLOCK
|
||||
pthread_rwlock_t rwlock;
|
||||
pthread_t rwlock_owner;
|
||||
# else
|
||||
pthread_mutex_t rwlock;
|
||||
pthread_mutex_t mutex;
|
||||
# endif
|
||||
#elif defined(_MGRM_PROCESSES)
|
||||
int zi_semid;
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
# also for makefile.ng and makefile.msvc
|
||||
AM_CPPFLAGS = -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include
|
||||
AM_CFLAGS = -Wno-zero-length-bounds
|
||||
|
||||
noinst_LTLIBRARIES = libkernel.la
|
||||
|
||||
if MG_MINIMALGDI
|
||||
libkernel_la_SOURCES = init-lite.c fixstr.c \
|
||||
blockheap.c
|
||||
else
|
||||
libkernel_la_SOURCES = timer.c init.c init-lite.c \
|
||||
desktop-ths.c desktop-sa.c desktop-procs.c \
|
||||
cursor.c cursor-procs.c cursor-sa.c \
|
||||
sharedres.c message.c event.c listenfd.c \
|
||||
blockheap.c fixstr.c slotset.c zorder.c sem-manager.c \
|
||||
compsor-manager.c compsor-fallback.c
|
||||
endif
|
||||
|
||||
EXTRA_DIST= desktop.c desktop-comm.c cursor-comm.c makefile.ng makefile.msvc
|
||||
|
||||
|
||||
@@ -59,13 +59,13 @@
|
||||
#include "common.h"
|
||||
#include "minigui.h"
|
||||
#include "gdi.h"
|
||||
#include "window.h"
|
||||
#include "constants.h"
|
||||
#include "blockheap.h"
|
||||
#include "misc.h"
|
||||
|
||||
BOOL InitBlockDataHeap (PBLOCKHEAP heap, size_t sz_block, size_t sz_heap)
|
||||
{
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_init (&heap->lock, NULL);
|
||||
#endif
|
||||
|
||||
@@ -99,7 +99,7 @@ void* BlockDataAlloc (PBLOCKHEAP heap)
|
||||
int free_slot;
|
||||
unsigned char* block_data = NULL;
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_lock (&heap->lock);
|
||||
#endif
|
||||
|
||||
@@ -118,7 +118,7 @@ void* BlockDataAlloc (PBLOCKHEAP heap)
|
||||
|
||||
ret:
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_unlock (&heap->lock);
|
||||
#endif
|
||||
return block_data;
|
||||
@@ -128,7 +128,7 @@ void BlockDataFree (PBLOCKHEAP heap, void* data)
|
||||
{
|
||||
unsigned char* block_data = data;
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_lock (&heap->lock);
|
||||
#endif
|
||||
|
||||
@@ -146,7 +146,7 @@ void BlockDataFree (PBLOCKHEAP heap, void* data)
|
||||
heap, slot);
|
||||
}
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_unlock (&heap->lock);
|
||||
#endif
|
||||
}
|
||||
@@ -193,7 +193,7 @@ void DestroyBlockDataHeap (PBLOCKHEAP heap)
|
||||
free (heap->usage_bmp);
|
||||
heap->usage_bmp = NULL;
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_destroy (&heap->lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1303,7 +1303,7 @@ static void transit_to_layer (CompositorCtxt* ctxt, MG_Layer* to_layer)
|
||||
}
|
||||
}
|
||||
|
||||
_WRN_PRINTF ("Average time to composite the layers: %u (times: %u)\n", total_time_ms / total_times, total_times);
|
||||
_DBG_PRINTF ("Average time to composite the layers: %ums (times: %u)\n", total_time_ms / total_times, total_times);
|
||||
}
|
||||
|
||||
CompositorOps __mg_fallback_compositor = {
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2021, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@@ -489,7 +489,7 @@ const CompositorOps* GUIAPI ServerGetCompositorOps (const char* name)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < MAX_NR_COMPOSITORS; i++) {
|
||||
if (compositors [i].name && strcmp (compositors [i].name, name) == 0) {
|
||||
if (strcmp (compositors [i].name, name) == 0) {
|
||||
return compositors [i].ops;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1403,7 +1403,7 @@ static LRESULT WindowMessageHandler(UINT message, PMAINWIN pWin, LPARAM lParam)
|
||||
else {
|
||||
from = 0;
|
||||
}
|
||||
|
||||
|
||||
lock_zi_for_read (zi);
|
||||
|
||||
from = __kernel_get_next_znode (zi, from);
|
||||
@@ -1821,7 +1821,7 @@ static void dskRefreshAllWindow (const RECT* invrc)
|
||||
info.is_empty_invrc = TRUE;
|
||||
|
||||
#ifdef _MGHAVE_MENU
|
||||
dskForceCloseMenu ();
|
||||
dskForceCloseMenu ();
|
||||
#endif
|
||||
|
||||
SendMessage (HWND_DESKTOP, MSG_ERASEDESKTOP, 0,
|
||||
|
||||
@@ -231,14 +231,6 @@ static void init_desktop_win (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
|
||||
/* Init heap of clipping rects. */
|
||||
InitFreeClipRectList (&sg_FreeClipRectList, SIZE_CLIPRECTHEAP);
|
||||
@@ -259,7 +251,7 @@ BOOL mg_InitDesktop (void)
|
||||
void mg_TerminateDesktop (void)
|
||||
{
|
||||
/* Since 5.0.0: message queue for desktop thread was dynamically allocated */
|
||||
mg_FreeMsgQueueForThisThread ();
|
||||
mg_FreeMsgQueueForThisThread (TRUE);
|
||||
__mg_dsk_msg_queue = NULL;
|
||||
|
||||
#ifndef _MGSCHEMA_COMPOSITING
|
||||
|
||||
@@ -102,14 +102,6 @@ BOOL mg_InitDesktop (void)
|
||||
int ret;
|
||||
RECT rcScr = GetScreenRect();
|
||||
|
||||
#if 0 /* move to init-lite.c */
|
||||
/* Since 5.0.0: allocate message queue for desktop thread */
|
||||
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread ()) ) {
|
||||
_WRN_PRINTF ("failed to allocate message queue\n");
|
||||
return FALSE;
|
||||
}
|
||||
#endif /* moved code */
|
||||
|
||||
/*
|
||||
* Init ZOrderInfo here.
|
||||
*/
|
||||
@@ -153,7 +145,7 @@ BOOL mg_InitDesktop (void)
|
||||
void mg_TerminateDesktop (void)
|
||||
{
|
||||
if (__mg_dsk_msg_queue) {
|
||||
mg_FreeMsgQueueForThisThread ();
|
||||
mg_FreeMsgQueueForThisThread (TRUE);
|
||||
__mg_dsk_msg_queue = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ void* __kernel_desktop_main (void* data)
|
||||
MSG Msg;
|
||||
|
||||
/* init message queue of desktop thread */
|
||||
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread ()) ) {
|
||||
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread (TRUE)) ) {
|
||||
_ERR_PRINTF ("failed to allocate message queue\n");
|
||||
sem_post ((sem_t*)data);
|
||||
return NULL;
|
||||
@@ -191,7 +191,7 @@ void* __kernel_desktop_main (void* data)
|
||||
#endif
|
||||
}
|
||||
|
||||
mg_FreeMsgQueueForThisThread ();
|
||||
mg_FreeMsgQueueForThisThread (TRUE);
|
||||
__mg_dsk_msg_queue = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+39
-29
@@ -15,7 +15,7 @@
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
@@ -597,55 +597,63 @@ static void reset_window (PMAINWIN pWin, RECT* rcWin)
|
||||
#endif
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifndef __NOUNIX__
|
||||
/*for unix system, using read/write lock*/
|
||||
static inline void lock_zi_for_change (const ZORDERINFO* zi)
|
||||
# ifdef __ZI_USE_RWLOCK
|
||||
static inline void lock_zi_for_change (ZORDERINFO* zi)
|
||||
{
|
||||
pthread_rwlock_wrlock(&((ZORDERINFO*)zi)->rwlock);
|
||||
pthread_rwlock_wrlock(&zi->rwlock);
|
||||
zi->rwlock_owner = pthread_self();
|
||||
}
|
||||
|
||||
static inline void unlock_zi_for_change (const ZORDERINFO* zi)
|
||||
static inline void unlock_zi_for_change (ZORDERINFO* zi)
|
||||
{
|
||||
pthread_rwlock_unlock(&((ZORDERINFO*)zi)->rwlock);
|
||||
pthread_rwlock_unlock(&zi->rwlock);
|
||||
zi->rwlock_owner = 0;
|
||||
}
|
||||
|
||||
static inline void lock_zi_for_read (const ZORDERINFO* zi)
|
||||
static inline void lock_zi_for_read (ZORDERINFO* zi)
|
||||
{
|
||||
pthread_rwlock_rdlock(&((ZORDERINFO*)zi)->rwlock);
|
||||
if (zi->rwlock_owner == pthread_self()) {
|
||||
return;
|
||||
}
|
||||
|
||||
pthread_rwlock_rdlock(&zi->rwlock);
|
||||
}
|
||||
|
||||
static inline void unlock_zi_for_read (const ZORDERINFO* zi)
|
||||
static inline void unlock_zi_for_read (ZORDERINFO* zi)
|
||||
{
|
||||
pthread_rwlock_unlock(&((ZORDERINFO*)zi)->rwlock);
|
||||
if (zi->rwlock_owner == pthread_self()) {
|
||||
return;
|
||||
}
|
||||
|
||||
pthread_rwlock_unlock(&zi->rwlock);
|
||||
}
|
||||
#else /* __NOUNIX__ */
|
||||
/*for non-unix system, using mutex*/
|
||||
static inline void lock_zi_for_change (const ZORDERINFO* zi)
|
||||
# else /* __ZI_USE_RWLOCK */
|
||||
static inline void lock_zi_for_change (ZORDERINFO* zi)
|
||||
{
|
||||
pthread_mutex_lock(&((ZORDERINFO*)zi)->rwlock);
|
||||
pthread_mutex_lock(&zi->mutex);
|
||||
}
|
||||
|
||||
static inline void unlock_zi_for_change (const ZORDERINFO* zi)
|
||||
static inline void unlock_zi_for_change (ZORDERINFO* zi)
|
||||
{
|
||||
pthread_mutex_unlock(&((ZORDERINFO*)zi)->rwlock);
|
||||
pthread_mutex_unlock(&zi->mutex);
|
||||
}
|
||||
|
||||
static inline void lock_zi_for_read (const ZORDERINFO* zi)
|
||||
static inline void lock_zi_for_read (ZORDERINFO* zi)
|
||||
{
|
||||
pthread_mutex_lock(&((ZORDERINFO*)zi)->rwlock);
|
||||
pthread_mutex_lock(&zi->mutex);
|
||||
}
|
||||
|
||||
static inline void unlock_zi_for_read (const ZORDERINFO* zi)
|
||||
static inline void unlock_zi_for_read (ZORDERINFO* zi)
|
||||
{
|
||||
pthread_mutex_unlock(&((ZORDERINFO*)zi)->rwlock);
|
||||
pthread_mutex_unlock(&zi->mutex);
|
||||
}
|
||||
#endif /* __NOUNIX__ */
|
||||
# endif /* notdef __ZI_USE_RWLOCK */
|
||||
|
||||
#elif defined(_MGRM_STANDALONE)
|
||||
static inline void lock_zi_for_change (const ZORDERINFO* zi) { }
|
||||
static inline void unlock_zi_for_change (const ZORDERINFO* zi) { }
|
||||
static inline void lock_zi_for_read (const ZORDERINFO* zi) { }
|
||||
static inline void unlock_zi_for_read (const ZORDERINFO* zi) { }
|
||||
static inline void lock_zi_for_change (ZORDERINFO* zi) { }
|
||||
static inline void unlock_zi_for_change (ZORDERINFO* zi) { }
|
||||
static inline void lock_zi_for_read (ZORDERINFO* zi) { }
|
||||
static inline void unlock_zi_for_read (ZORDERINFO* zi) { }
|
||||
#else /* for procs */
|
||||
/* NULL. see desktop-procs.c */
|
||||
#endif /* _MGRM_THREADS */
|
||||
@@ -3641,6 +3649,9 @@ static int dskMoveWindow (int cli, int idx_znode, HDC memdc, const RECT* rcWin)
|
||||
|
||||
do_for_all_znodes (&rcOld, zi, _cb_update_znode, ZT_ALL);
|
||||
|
||||
/* unlock zi for change ... */
|
||||
unlock_zi_for_change (zi);
|
||||
|
||||
if (nodes [0].flags & ZOF_IF_REFERENCE) {
|
||||
SendMessage (HWND_DESKTOP,
|
||||
MSG_ERASEDESKTOP, 0, (LPARAM)&rcOld);
|
||||
@@ -3680,9 +3691,6 @@ static int dskMoveWindow (int cli, int idx_znode, HDC memdc, const RECT* rcWin)
|
||||
|
||||
update_client_window_rgn (nodes [idx_znode].cli,
|
||||
nodes [idx_znode].hwnd);
|
||||
|
||||
/* unlock zi for change ... */
|
||||
unlock_zi_for_change (zi);
|
||||
}
|
||||
else {
|
||||
lock_zi_for_change (zi);
|
||||
@@ -4499,7 +4507,9 @@ int __mg_join_all_message_threads (void)
|
||||
|
||||
list_for_each (l, &msg_queue_list) {
|
||||
MSGQUEUE *msg_queue = (MSGQUEUE*)l;
|
||||
#ifndef NDEBUG
|
||||
dump_message_queue (msg_queue, __func__);
|
||||
#endif
|
||||
pthread_cancel (msg_queue->th);
|
||||
}
|
||||
|
||||
|
||||
+8
-8
@@ -66,7 +66,7 @@ static struct FIXSTR {
|
||||
BYTE bitmap[LEN_BITMAP];
|
||||
int offset[NR_HEAP];
|
||||
char* heap[NR_HEAP + 1];
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_t lock;
|
||||
#endif
|
||||
} FixStrHeap;
|
||||
@@ -98,7 +98,7 @@ BOOL mg_InitFixStr (void)
|
||||
offset += 1<<i;
|
||||
}
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_init (&FixStrHeap.lock, NULL);
|
||||
#endif
|
||||
return TRUE;
|
||||
@@ -106,7 +106,7 @@ BOOL mg_InitFixStr (void)
|
||||
|
||||
void mg_TerminateFixStr (void)
|
||||
{
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_destroy (&FixStrHeap.lock);
|
||||
#endif
|
||||
free (FixStrHeap.heap[0]);
|
||||
@@ -154,7 +154,7 @@ char* GUIAPI FixStrAlloc (int len)
|
||||
// ..
|
||||
// if i == 0; then bufflen = 512
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_lock (&FixStrHeap.lock);
|
||||
#endif
|
||||
|
||||
@@ -166,7 +166,7 @@ char* GUIAPI FixStrAlloc (int len)
|
||||
for(j = 0; j < 8; j++) {
|
||||
if (*bitmap & (0x80 >> j)) {
|
||||
*bitmap &= (~(0x80 >> j));
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_unlock (&FixStrHeap.lock);
|
||||
#endif
|
||||
#if 0
|
||||
@@ -181,7 +181,7 @@ char* GUIAPI FixStrAlloc (int len)
|
||||
bitmap++;
|
||||
}
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_unlock (&FixStrHeap.lock);
|
||||
#endif
|
||||
return (char*)malloc (len + 1);
|
||||
@@ -216,7 +216,7 @@ void GUIAPI FreeFixStr (char* str)
|
||||
// if i == 0; then bufflen = 512
|
||||
bufflen = 1 << (NR_HEAP + 1 - i);
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_lock (&FixStrHeap.lock);
|
||||
#endif
|
||||
heap = FixStrHeap.heap[i];
|
||||
@@ -236,7 +236,7 @@ void GUIAPI FreeFixStr (char* str)
|
||||
bitmap = bitmap + (stroff>>3);
|
||||
*bitmap |= (0x80 >> (stroff%8));
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
pthread_mutex_unlock (&FixStrHeap.lock);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -386,7 +386,7 @@ int InitGUI (int argc, const char* agr[])
|
||||
|
||||
/* Since 5.0.0
|
||||
allocate message queue for desktop thread before starting client. */
|
||||
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread ()) ) {
|
||||
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread (TRUE)) ) {
|
||||
err_message (step, "Failed to allocate message queue!");
|
||||
return step;
|
||||
}
|
||||
|
||||
+2
-2
@@ -578,7 +578,7 @@ int GUIAPI InitGUI (int args, const char *agr[])
|
||||
|
||||
/* init message queue of main GUI thread */
|
||||
step++;
|
||||
if (!(msg_queue = mg_AllocMsgQueueForThisThread ())) {
|
||||
if (!(msg_queue = mg_AllocMsgQueueForThisThread (TRUE))) {
|
||||
_ERR_PRINTF ("KERNEL>InitGUI: failed to allocate message queue!\n");
|
||||
goto failure;
|
||||
}
|
||||
@@ -655,7 +655,7 @@ void GUIAPI TerminateGUI (int not_used)
|
||||
miFreeArcCache ();
|
||||
#endif
|
||||
|
||||
mg_FreeMsgQueueForThisThread ();
|
||||
mg_FreeMsgQueueForThisThread (TRUE);
|
||||
|
||||
deleteThreadInfoKey ();
|
||||
|
||||
|
||||
+16
-17
@@ -60,7 +60,6 @@
|
||||
#include "gdi.h"
|
||||
#include "window.h"
|
||||
|
||||
#include "blockheap.h"
|
||||
#include "cliprect.h"
|
||||
#include "gal.h"
|
||||
#include "internals.h"
|
||||
@@ -159,7 +158,7 @@ void mg_DestroyFreeQMSGList (void)
|
||||
pthread_key_t __mg_threadinfo_key;
|
||||
#endif
|
||||
|
||||
MSGQUEUE* mg_AllocMsgQueueForThisThread (void)
|
||||
MSGQUEUE* mg_AllocMsgQueueForThisThread (BOOL sign_in)
|
||||
{
|
||||
MSGQUEUE* pMsgQueue;
|
||||
|
||||
@@ -177,13 +176,14 @@ MSGQUEUE* mg_AllocMsgQueueForThisThread (void)
|
||||
pthread_setspecific (__mg_threadinfo_key, pMsgQueue);
|
||||
#endif
|
||||
|
||||
// register this new message queue
|
||||
SendMessage (HWND_DESKTOP, MSG_MANAGE_MSGTHREAD,
|
||||
MSGTHREAD_SIGNIN, (LPARAM)pMsgQueue);
|
||||
if (sign_in) {
|
||||
SendMessage (HWND_DESKTOP, MSG_MANAGE_MSGTHREAD,
|
||||
MSGTHREAD_SIGNIN, (LPARAM)pMsgQueue);
|
||||
}
|
||||
return pMsgQueue;
|
||||
}
|
||||
|
||||
void mg_FreeMsgQueueForThisThread (void)
|
||||
void mg_FreeMsgQueueForThisThread (BOOL sign_off)
|
||||
{
|
||||
MSGQUEUE* pMsgQueue;
|
||||
|
||||
@@ -194,6 +194,11 @@ void mg_FreeMsgQueueForThisThread (void)
|
||||
_WRN_PRINTF ("there are still some windows not destroyed\n");
|
||||
}
|
||||
|
||||
if (sign_off) {
|
||||
SendMessage (HWND_DESKTOP, MSG_MANAGE_MSGTHREAD,
|
||||
MSGTHREAD_SIGNOUT, (LPARAM)pMsgQueue);
|
||||
}
|
||||
|
||||
mg_DestroyMsgQueue (pMsgQueue);
|
||||
free (pMsgQueue);
|
||||
|
||||
@@ -823,8 +828,9 @@ checkagain:
|
||||
goto got_ret;
|
||||
}
|
||||
}
|
||||
else
|
||||
else {
|
||||
pMsgQueue->dwState &= ~QS_POSTMSG;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1410,6 +1416,9 @@ LRESULT GUIAPI DispatchMessage (PMSG pMsg)
|
||||
to the controls of the main window will be thrown away as well. */
|
||||
int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd)
|
||||
{
|
||||
/* For a main window, we use pMainWin to check whether we
|
||||
should throw away a message for controls of the main window.
|
||||
Note that checkAndGetMainWindowIfControl returns NULL for non control. */
|
||||
PMAINWIN pMainWin = (PMAINWIN)hWnd;
|
||||
PMSG pMsg;
|
||||
PQMSG pQMsg;
|
||||
@@ -1421,16 +1430,6 @@ int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd)
|
||||
|
||||
LOCK_MSGQ (pMsgQueue);
|
||||
|
||||
/* for virtual window and main window, use pMainWin to check whether we
|
||||
should throw away a message for controls of a main window.
|
||||
checkAndGetMainWindowIfControl returns NULL for non control. */
|
||||
if (pMainWin != HWND_NULL && pMainWin != HWND_INVALID &&
|
||||
(pMainWin->WinType == TYPE_MAINWIN ||
|
||||
pMainWin->WinType == TYPE_VIRTWIN))
|
||||
pMainWin = (PMAINWIN)hWnd;
|
||||
else
|
||||
pMainWin = NULL;
|
||||
|
||||
if (pMsgQueue->pFirstNotifyMsg) {
|
||||
PQMSG pPrev = NULL, pNext;
|
||||
pQMsg = pMsgQueue->pFirstNotifyMsg;
|
||||
|
||||
+20
-11
@@ -67,9 +67,6 @@
|
||||
#ifdef _MG_ENABLE_LICENSE
|
||||
# include "../sysres/license/c_files/03_progressbar.dat.c"
|
||||
#endif
|
||||
#ifndef __TARGET_UNKNOWN__
|
||||
unsigned int g_license_message_offset;
|
||||
#endif
|
||||
|
||||
#ifdef _MGRM_PROCESSES
|
||||
# include "ourhdr.h"
|
||||
@@ -246,11 +243,23 @@ int __kernel_alloc_z_order_info (int nr_topmosts, int nr_normals, BOOL with_mask
|
||||
#endif /* deprecated code */
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifndef __NOUNIX__
|
||||
# ifdef __ZI_USE_RWLOCK
|
||||
pthread_rwlock_init(&__mg_zorder_info->rwlock, NULL);
|
||||
#else
|
||||
pthread_mutex_init(&__mg_zorder_info->rwlock, NULL);
|
||||
#endif
|
||||
__mg_zorder_info->rwlock_owner = 0;
|
||||
# else
|
||||
do {
|
||||
int ret;
|
||||
pthread_mutexattr_t my_attr;
|
||||
ret = pthread_mutexattr_init(&my_attr);
|
||||
assert(ret == 0);
|
||||
ret = pthread_mutexattr_settype(&my_attr, PTHREAD_MUTEX_RECURSIVE);
|
||||
assert(ret == 0);
|
||||
pthread_mutex_init(&__mg_zorder_info->mutex, &my_attr);
|
||||
ret = pthread_mutexattr_destroy(&my_attr);
|
||||
assert(ret == 0);
|
||||
(void)ret;
|
||||
} while (0);
|
||||
# endif
|
||||
#endif
|
||||
return 0;
|
||||
#endif
|
||||
@@ -264,11 +273,11 @@ void __kernel_free_z_order_info (ZORDERINFO* zi)
|
||||
#else
|
||||
|
||||
#ifdef _MGRM_THREADS
|
||||
#ifndef __NOUNIX__
|
||||
# ifdef __ZI_USE_RWLOCK
|
||||
pthread_rwlock_destroy(&zi->rwlock);
|
||||
#else
|
||||
pthread_mutex_destroy(&zi->rwlock);
|
||||
#endif
|
||||
# else
|
||||
pthread_mutex_destroy(&zi->mutex);
|
||||
# endif
|
||||
#endif
|
||||
free (zi);
|
||||
__mg_zorder_info = NULL;
|
||||
|
||||
+1
-1
@@ -1472,7 +1472,7 @@ void mg_slice_debug_tree_statistics (void)
|
||||
su / bf, en, ex);
|
||||
}
|
||||
else
|
||||
_MG_PRINTF("MGSlice: MemChecker: root=NULL\n");
|
||||
_DBG_PRINTF("MGSlice: MemChecker: root=NULL\n");
|
||||
|
||||
pthread_mutex_unlock (&smc_tree_mutex);
|
||||
|
||||
|
||||
@@ -5,13 +5,9 @@ EXTRA_DIST= misc.c systext.c rwops.c endianrw.c nposix.c clipboard.c \
|
||||
math.c about.c error.c sockio.c rc4.c rc4.h \
|
||||
makefile.ng makefile.msvc
|
||||
|
||||
if MG_MINIMALGDI
|
||||
libmisc_la_SOURCES = misc.c math.c rwops.c nposix.c
|
||||
else
|
||||
libmisc_la_SOURCES = misc.c systext.c rwops.c endianrw.c nposix.c clipboard.c \
|
||||
math.c about.c license.c anon_file.c rbtree.c map.c \
|
||||
error.c sockio.c
|
||||
endif
|
||||
|
||||
SRC_FILES = $(libmisc_la_SOURCES)
|
||||
LIB_NAME=libmisc
|
||||
|
||||
+7
-339
@@ -69,11 +69,7 @@
|
||||
|
||||
#include "license.h"
|
||||
|
||||
#undef _MG_ENABLE_WATERMARK /* XXX: Always disable watermark */
|
||||
|
||||
#if defined(_MG_ENABLE_SPLASH) || \
|
||||
defined(_MG_ENABLE_SCREENSAVER) || \
|
||||
defined(_MG_ENABLE_WATERMARK)
|
||||
#if defined(_MG_ENABLE_SPLASH) || defined(_MG_ENABLE_SCREENSAVER)
|
||||
BITMAP g_license_bitmaps[LICENSE_BITMAP_NR];
|
||||
|
||||
#ifndef _MG_LICENSE_SCREENSAVER_TIMEOUT
|
||||
@@ -94,90 +90,16 @@ BITMAP g_license_bitmaps[LICENSE_BITMAP_NR];
|
||||
#define _MG_LICENSE_SPLASH_MSEC (40)
|
||||
#endif
|
||||
|
||||
#if defined(_MG_ENABLE_SCREENSAVER) || \
|
||||
defined(_MG_ENABLE_WATERMARK)
|
||||
#if defined(_MG_ENABLE_SCREENSAVER)
|
||||
static int s_tick_last_input;
|
||||
static BOOL screensaver_running;
|
||||
extern int dskCreateTopZOrderNode (int cli, const RECT *rc);
|
||||
extern int dskDestroyTopZOrderNode (int cli, int idx_znode);
|
||||
extern void dskRefreshAllClient (const RECT* invrc);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/***********************************************************
|
||||
* Product ID
|
||||
***********************************************************/
|
||||
#ifdef _MG_PRODUCTID
|
||||
|
||||
static unsigned char product_id_buffer[40] = {
|
||||
PRODUCT_ID_PREFIX,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
|
||||
/* use this for splash display customer id by humingming 2010.8.12 */
|
||||
int license_get_customer_id(void) {
|
||||
return ((product_id_t*)product_id_buffer)->customer_id;
|
||||
}
|
||||
|
||||
#else
|
||||
//# warning PRODUCT_ID_is_DISABLED
|
||||
#endif
|
||||
|
||||
/***********************************************************
|
||||
* Watermark
|
||||
***********************************************************/
|
||||
#ifdef _MG_ENABLE_WATERMARK
|
||||
|
||||
#define MARGINSPACE 5
|
||||
|
||||
typedef struct _CornerInfo{
|
||||
POINT pos;
|
||||
HWND hwnd;
|
||||
BITMAP* bmp;
|
||||
}CornerInfo;
|
||||
|
||||
static CornerInfo fourcorner_info[4] = {
|
||||
{{MARGINSPACE, MARGINSPACE} },
|
||||
{{-MARGINSPACE, MARGINSPACE} },
|
||||
{{MARGINSPACE, -MARGINSPACE} },
|
||||
{{-MARGINSPACE, -MARGINSPACE} }
|
||||
};
|
||||
|
||||
static void watermark_update(void)
|
||||
{
|
||||
int i = 0;
|
||||
for (i = 0; i < TABLESIZE(fourcorner_info); i++)
|
||||
FillBoxWithBitmap (HDC_SCREEN_SYS,
|
||||
fourcorner_info[i].pos.x, fourcorner_info[i].pos.y,
|
||||
0, 0, fourcorner_info[i].bmp);
|
||||
}
|
||||
|
||||
static void watermark_init(void)
|
||||
{
|
||||
RECT rcScr = GetScreenRect();
|
||||
|
||||
fourcorner_info[0].bmp = &g_license_bitmaps[WATERMARK_1];
|
||||
fourcorner_info[1].bmp = &g_license_bitmaps[WATERMARK_2];
|
||||
fourcorner_info[2].bmp = &g_license_bitmaps[WATERMARK_3];
|
||||
fourcorner_info[3].bmp = &g_license_bitmaps[WATERMARK_3];
|
||||
|
||||
/* right-top.*/
|
||||
fourcorner_info[1].pos.x += RECTW(rcScr) - fourcorner_info[1].bmp->bmWidth;
|
||||
/* left-bottom.*/
|
||||
fourcorner_info[2].pos.y += RECTH(rcScr) - fourcorner_info[2].bmp->bmHeight;
|
||||
/* right-bottom.*/
|
||||
fourcorner_info[3].pos.x += RECTW(rcScr) - fourcorner_info[3].bmp->bmWidth;
|
||||
fourcorner_info[3].pos.y += RECTH(rcScr) - fourcorner_info[3].bmp->bmHeight;
|
||||
}
|
||||
|
||||
#else
|
||||
# define watermark_update() /* NULL */
|
||||
# define watermark_init() /* NULL */
|
||||
#endif /* _MG_ENABLE_WATERMARK */
|
||||
|
||||
/***********************************************************
|
||||
* Screensaver
|
||||
***********************************************************/
|
||||
@@ -291,16 +213,7 @@ void __mg_splash_draw_framework (void)
|
||||
memset(text, 0, sizeof(text));
|
||||
SetRect(&rc_text, SPLASH_ID_X, SPLASH_ID_Y, SPLASH_ID_X+SPLASH_ID_W, RECTH(rcScr));
|
||||
|
||||
#ifdef _MG_PRODUCTID
|
||||
int customer_id = license_get_customer_id();
|
||||
if (customer_id <= 0) {
|
||||
sprintf(text, "SN: N/A");
|
||||
} else {
|
||||
sprintf(text, "SN: %d", customer_id);
|
||||
}
|
||||
#else
|
||||
sprintf(text, "SN: N/A");
|
||||
#endif
|
||||
|
||||
SetBkMode(HDC_SCREEN_SYS, BM_TRANSPARENT);
|
||||
DrawText(HDC_SCREEN_SYS, text, -1, &rc_text, DT_TOP | DT_RIGHT | DT_SINGLELINE);
|
||||
@@ -351,133 +264,9 @@ void __mg_splash_delay (void)
|
||||
# define splash_init() /* NULL */
|
||||
#endif /* _MG_ENABLE_SPLASH.*/
|
||||
|
||||
/***********************************************************
|
||||
* License common
|
||||
***********************************************************/
|
||||
static unsigned char const_trans_table[] = {
|
||||
0x16, 0xfe, 0xaf, 0x06, 0xd6, 0x9d, 0x54, 0x98,
|
||||
0x77, 0x36, 0xc1, 0xc7, 0x29, 0xf8, 0x64, 0x93,
|
||||
0x2e, 0x6b, 0x2a, 0x3c, 0x12, 0x13, 0x23, 0xc9,
|
||||
0xe2, 0xa3, 0xbd, 0xbe, 0xac, 0xdf, 0x91, 0xe5,
|
||||
0xdc, 0x4a, 0xc0, 0xb8, 0xd3, 0x2c, 0x61, 0x60,
|
||||
0x5b, 0x32, 0x37, 0x7e, 0xb7, 0x8e, 0x2b, 0x0b,
|
||||
0x19, 0x50, 0x40, 0xf3, 0x5f, 0x5d, 0x0d, 0x59,
|
||||
0x21, 0xb1, 0xf6, 0xb5, 0xe3, 0xb3, 0x94, 0xa6,
|
||||
0x31, 0x78, 0x84, 0xcc, 0x9c, 0x1b, 0x7b, 0x2f,
|
||||
0x46, 0xa9, 0x9b, 0xda, 0xee, 0xd0, 0xc5, 0x7f,
|
||||
0x4f, 0xc2, 0xa0, 0x9f, 0xe8, 0xb6, 0x3e, 0xbc,
|
||||
0xf5, 0xae, 0x1c, 0x7d, 0xca, 0xf2, 0x65, 0xe0,
|
||||
0x5a, 0x33, 0xfc, 0x3f, 0x49, 0x6d, 0xa1, 0x83,
|
||||
0xcb, 0x4d, 0x0f, 0xf4, 0x55, 0xec, 0x8a, 0x04,
|
||||
0x03, 0x7c, 0x86, 0x0e, 0xe4, 0xb4, 0x30, 0x99,
|
||||
0xa2, 0xdb, 0x43, 0x8d, 0x92, 0x11, 0xef, 0x8f,
|
||||
0x3a, 0xfb, 0xc6, 0x74, 0x0c, 0xb2, 0x97, 0x57,
|
||||
0x48, 0x69, 0x70, 0x15, 0x22, 0x67, 0x18, 0x24,
|
||||
0xf0, 0x82, 0xe7, 0x44, 0x9e, 0x53, 0x26, 0x81,
|
||||
0x1f, 0xc8, 0x63, 0x96, 0x00, 0x20, 0x4e, 0xe1,
|
||||
0x45, 0xd2, 0x75, 0x4c, 0x1d, 0x95, 0xbf, 0x52,
|
||||
0x05, 0xd8, 0x09, 0x1e, 0x73, 0x1a, 0xd5, 0xab,
|
||||
0x76, 0x08, 0xaa, 0xc4, 0x85, 0xb9, 0xd7, 0x8c,
|
||||
0x02, 0x58, 0x4b, 0x47, 0x89, 0xdd, 0x62, 0xa5,
|
||||
0xbb, 0x51, 0x10, 0xeb, 0x80, 0x79, 0xce, 0xfa,
|
||||
0x87, 0xf1, 0xcf, 0xfd, 0x6a, 0x07, 0x2d, 0x38,
|
||||
0xde, 0x41, 0x90, 0xb0, 0x25, 0x5e, 0xf7, 0xe6,
|
||||
0x42, 0x9a, 0xe9, 0xed, 0x6c, 0xc3, 0x88, 0xd1,
|
||||
0x6f, 0xd9, 0x7a, 0x0a, 0x68, 0x3d, 0x34, 0xcd,
|
||||
0xff, 0x28, 0x3b, 0x35, 0x01, 0xea, 0x39, 0x8b,
|
||||
0x14, 0x27, 0x56, 0xd4, 0x17, 0x72, 0xad, 0xa4,
|
||||
0xf9, 0x5c, 0x66, 0xa8, 0x6e, 0xba, 0xa7, 0x71,
|
||||
};
|
||||
|
||||
static unsigned char decrypt_byte(unsigned int ch) {
|
||||
return const_trans_table[(ch-17)%256];
|
||||
}
|
||||
|
||||
static void decrypt_mem(void *_data, int len) {
|
||||
unsigned char *data = (unsigned char *)_data;
|
||||
int i;
|
||||
for (i=0; i<len; ++i) {
|
||||
data[i] = decrypt_byte(data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int LICENSE_ENCRYPTED_CONST_INT(unsigned int src){
|
||||
decrypt_mem(&src, sizeof(src));
|
||||
return src;
|
||||
}
|
||||
|
||||
char *LICENSE_ENCRYPTED_CONST_STRING(unsigned char *src, int len){
|
||||
decrypt_mem(src, len);
|
||||
src[len] = 0;
|
||||
return (char *)src;
|
||||
}
|
||||
|
||||
#if defined(_MG_ENABLE_SPLASH) || \
|
||||
defined(_MG_ENABLE_SCREENSAVER) || \
|
||||
defined(_MG_ENABLE_WATERMARK)
|
||||
|
||||
/* disable cryptool */
|
||||
#undef ENCRYPTED
|
||||
|
||||
#ifdef ENCRYPTED
|
||||
# include "../sysres/license/c_files/key.c"
|
||||
#endif
|
||||
#if defined(_MG_ENABLE_SPLASH) || defined(_MG_ENABLE_SCREENSAVER)
|
||||
|
||||
#include "../sysres/license/c_files/_splash_inner_res.c"
|
||||
/* XXX: Other resource files are included in desktop.c event.c message.c zorder.c and window.c */
|
||||
#if 0 /* XXX: WaterMark is REMOVED */
|
||||
#ifdef _MG_ENABLE_LICENSE
|
||||
# include "../sysres/license/c_files/05_watermark-fmsoft.dat.c"
|
||||
# include "../sysres/license/c_files/06_watermark-minigui.dat.c"
|
||||
# include "../sysres/license/c_files/07_watermark-evaluation.dat.c"
|
||||
#endif /* _MG_ENABLE_SPLASH */
|
||||
#endif
|
||||
|
||||
#ifdef ENCRYPTED
|
||||
# include "rc4.c"
|
||||
# define FRAGMENT_SIZE 512
|
||||
static unsigned char calc_sum(int len, const unsigned char *data) {
|
||||
unsigned char sum;
|
||||
int i;
|
||||
|
||||
for (i=0, sum=0; i<len; ++i) {
|
||||
sum -= data[i];
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
static int decrypted_len(int len) {
|
||||
return len - ((len-1) / FRAGMENT_SIZE + 1) * sizeof(unsigned char);
|
||||
}
|
||||
|
||||
static int my_decrypt(RC4_KEY *key, int in_len, unsigned char *in) {
|
||||
int out_len = 0;
|
||||
int i;
|
||||
unsigned char sum;
|
||||
|
||||
for (i=0; i<in_len; /* NULL */) {
|
||||
int n;
|
||||
|
||||
RC4(key, sizeof(unsigned char), &in[i], (unsigned char *)&sum);
|
||||
i += sizeof(unsigned char);
|
||||
|
||||
n = (in_len - i > FRAGMENT_SIZE - sizeof(unsigned char)) ? (FRAGMENT_SIZE - sizeof(unsigned char)) : (in_len - i);
|
||||
RC4(key, n, &in[i], &in[out_len]);
|
||||
|
||||
if (calc_sum(n, &in[out_len]) != sum) {
|
||||
assert(0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
i += n;
|
||||
out_len += n;
|
||||
}
|
||||
|
||||
assert(out_len == decrypted_len(in_len));
|
||||
return out_len;
|
||||
}
|
||||
#endif /* ENCRYPTED */
|
||||
|
||||
void __mg_license_create(void) {
|
||||
int i;
|
||||
@@ -485,26 +274,20 @@ void __mg_license_create(void) {
|
||||
for (i=0; i<LICENSE_BITMAP_NR; ++i) {
|
||||
unsigned char *data;
|
||||
int len;
|
||||
#ifdef ENCRYPTED
|
||||
RC4_KEY rc4key;
|
||||
#endif
|
||||
|
||||
data = (unsigned char *)malloc(__mg_splash_splash_inner_res[i].data_len);
|
||||
memcpy(data, __mg_splash_splash_inner_res[i].data, __mg_splash_splash_inner_res[i].data_len);
|
||||
len = __mg_splash_splash_inner_res[i].data_len;
|
||||
|
||||
#ifdef ENCRYPTED
|
||||
RC4_set_key(&rc4key, sizeof(splash_crypto_key), splash_crypto_key);
|
||||
len = my_decrypt(&rc4key, len, data);
|
||||
#endif
|
||||
|
||||
LoadBitmapFromMem(HDC_SCREEN_SYS, &g_license_bitmaps[i], data, len, "png");
|
||||
free(data);
|
||||
}
|
||||
|
||||
splash_init();
|
||||
|
||||
#ifdef _MG_ENABLE_SCREENSAVER
|
||||
watermark_init();
|
||||
#endif
|
||||
}
|
||||
|
||||
void __mg_license_destroy (void) {
|
||||
@@ -514,120 +297,5 @@ void __mg_license_destroy (void) {
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* _MG_ENABLE_SPLASH || _MG_ENABLE_SCREENSAVER || _MG_ENABLE_WATERMARK */
|
||||
#endif /* defined(_MG_ENABLE_SPLASH) || defined(_MG_ENABLE_SCREENSAVER) */
|
||||
|
||||
#if defined(_MG_ENABLE_SCREENSAVER) || defined(_MG_ENABLE_WATERMARK)
|
||||
void __mg_license_on_input(void)
|
||||
{
|
||||
#ifdef _MGRM_PROCESSES
|
||||
RECT rcScr = GetScreenRect();
|
||||
#endif
|
||||
|
||||
s_tick_last_input = GetTickCount();
|
||||
|
||||
if (screensaver_running == TRUE) {
|
||||
screensaver_running = FALSE;
|
||||
|
||||
#if defined(_MGRM_THREADS)
|
||||
{
|
||||
HWND activeWnd = GetActiveWindow();
|
||||
if (activeWnd) {
|
||||
SendNotifyMessage(activeWnd, MSG_CANCELSCREENSAVER, 0, 0);
|
||||
} else {
|
||||
__mg_screensaver_hide();
|
||||
SendNotifyMessage (HWND_DESKTOP, MSG_PAINT, 0, 0);
|
||||
}
|
||||
}
|
||||
#else
|
||||
__mg_screensaver_hide();
|
||||
#if defined(_MGRM_PROCESSES)
|
||||
dskRefreshAllClient (&rcScr);
|
||||
#elif defined(_MGRM_STANDALONE)
|
||||
SendNotifyMessage (HWND_DESKTOP, MSG_PAINT, 0, 0);
|
||||
#else
|
||||
# error
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void __mg_license_on_timeout(void)
|
||||
{
|
||||
static unsigned int old_tick_count;
|
||||
unsigned int current_tick_count;
|
||||
|
||||
#ifdef _MGRM_PROCESSES
|
||||
if (!mgIsServer) {
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
current_tick_count = GetTickCount();
|
||||
|
||||
if (screensaver_running == TRUE) {
|
||||
/* screensaver is running, update the picture */
|
||||
if ((current_tick_count - old_tick_count) > _MG_LICENSE_SCREENSAVER_UPDATE_TIME) {
|
||||
old_tick_count = current_tick_count;
|
||||
screensaver_update();
|
||||
}
|
||||
} else {
|
||||
/* screensaver is not running, show it */
|
||||
if ((current_tick_count - s_tick_last_input) > _MG_LICENSE_SCREENSAVER_TIMEOUT) {
|
||||
screensaver_running = TRUE;
|
||||
__mg_screensaver_show();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* _MG_ENABLE_SCREENSAVER || _MG_ENABLE_WATERMARK */
|
||||
|
||||
/***********************************************************
|
||||
* Processor ID
|
||||
***********************************************************/
|
||||
#ifndef __TARGET_UNKNOWN__
|
||||
void license_get_processor_id (void) {
|
||||
g_license_processor_id = LICENSE_PROCESSOR_ID_NONE;
|
||||
#if defined(_WITH_TARGET_S3C6410) || defined(_WITH_TARGET_S3C2440) || defined(_WITH_TARGET_S3C2410) \
|
||||
|| defined (_WITH_TARGET_HI3560A)
|
||||
{
|
||||
int fd;
|
||||
unsigned char *addr;
|
||||
off_t SFR_offest;
|
||||
size_t cpuid_offest;
|
||||
unsigned char path[8] = "\x58\x1f\x6f\xc1\x58\x76\x6f\x76" /* "/dev/mem" */;
|
||||
|
||||
fd = open(LICENSE_ENCRYPTED_CONST_STRING(path, sizeof(path)), O_RDWR);
|
||||
if (fd <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef _WITH_TARGET_S3C6410
|
||||
SFR_offest = LICENSE_ENCRYPTED_CONST_INT(0x3CADA1AD /* 0x7E00F000 */);
|
||||
cpuid_offest = LICENSE_ENCRYPTED_CONST_INT(0xADADFD9F /* 0x00000118 */);
|
||||
#elif _WITH_TARGET_HI3560A
|
||||
SFR_offest = LICENSE_ENCRYPTED_CONST_INT(0xD3BCADAD /* 0x101E0000 */);
|
||||
cpuid_offest = LICENSE_ENCRYPTED_CONST_INT(0xADAD8470 /* 0x00000EE0 */);
|
||||
#else /* 2440, 2410 */
|
||||
SFR_offest = LICENSE_ENCRYPTED_CONST_INT(0x03ADADAD /* 0x56000000 */);
|
||||
cpuid_offest = LICENSE_ENCRYPTED_CONST_INT(0xADADADE4 /* 0x000000B0 */);
|
||||
#endif
|
||||
|
||||
addr = mmap(NULL, (4<<10), PROT_READ, MAP_SHARED, fd, SFR_offest);
|
||||
|
||||
#if _WITH_TARGET_HI3560A
|
||||
g_license_processor_id = *(unsigned int*)(addr+cpuid_offest+12) << 24 |
|
||||
*(unsigned int*)(addr+cpuid_offest+8) << 16 |
|
||||
*(unsigned int*)(addr+cpuid_offest+4) << 8 |
|
||||
*(unsigned int*)(addr+cpuid_offest);
|
||||
#else
|
||||
g_license_processor_id = *(unsigned int*)(addr+cpuid_offest);
|
||||
#endif
|
||||
munmap(addr, (4<<10));
|
||||
close(fd);
|
||||
}
|
||||
#else
|
||||
//# warning PROCESSOR_ID_verfication_is_DISABLED_on_this_target
|
||||
#endif
|
||||
}
|
||||
#endif /* __TARGET_UNKNOWN__ */
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
AM_CPPFLAGS = -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include
|
||||
AM_CPPFLAGS = $(WEBP_CFLAGS)
|
||||
AM_CPPFLAGS += -I$(abs_top_srcdir)/src/include -I$(abs_top_srcdir)/include
|
||||
|
||||
noinst_LTLIBRARIES = libmybmp.la
|
||||
|
||||
SRC_FILES = mybmp.c winbmp.c gif.c jpeg.c png12.c png16.c lbm.c pcx.c tga.c
|
||||
SRC_FILES = mybmp.c winbmp.c gif.c jpeg.c png12.c png16.c webp.c lbm.c pcx.c tga.c
|
||||
|
||||
libmybmp_la_SOURCES = $(SRC_FILES)
|
||||
|
||||
|
||||
+3
-2
@@ -309,7 +309,7 @@ void* __mg_init_jpg (MG_RWops *fp, MYBITMAP* mybmp, RGB* pal)
|
||||
struct my_error_mgr *jerr;
|
||||
jpeg_init_info_t* init_info;
|
||||
|
||||
if (!read_be16(fp,&soi_marker) || JMK_SOI != soi_marker)
|
||||
if (!read_be16(fp, &soi_marker) || JMK_SOI != soi_marker)
|
||||
goto err; /* not JPEG image*/
|
||||
|
||||
MGUI_RWseek (fp, 0, SEEK_SET);
|
||||
@@ -353,7 +353,8 @@ void* __mg_init_jpg (MG_RWops *fp, MYBITMAP* mybmp, RGB* pal)
|
||||
}
|
||||
|
||||
/* Step 4: set parameters for decompression */
|
||||
cinfo->out_color_space = (mybmp->flags & MYBMP_LOAD_GRAYSCALE) ? JCS_GRAYSCALE: JCS_RGB;
|
||||
cinfo->out_color_space =
|
||||
(mybmp->flags & MYBMP_LOAD_GRAYSCALE) ? JCS_GRAYSCALE: JCS_RGB;
|
||||
cinfo->quantize_colors = FALSE;
|
||||
|
||||
if (!(mybmp->flags & MYBMP_LOAD_GRAYSCALE)) {
|
||||
|
||||
+8
-1
@@ -98,6 +98,9 @@ static BITMAP_TYPE_INFO bitmap_types [MAX_BITMAP_TYPES] =
|
||||
#ifdef _MGIMAGE_PNG
|
||||
{ "png", __mg_init_png, __mg_load_png, __mg_cleanup_png, NULL, __mg_check_png },
|
||||
#endif
|
||||
#ifdef _MGIMAGE_WEBP
|
||||
{ "webp", __mg_init_webp, __mg_load_webp, __mg_cleanup_webp, NULL, __mg_check_webp },
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -184,7 +187,8 @@ int __mg_bmp_compute_pitch(int bpp, Uint32 width, Uint32 *pitch, BOOL does_round
|
||||
return bytespp;
|
||||
}
|
||||
|
||||
void* GUIAPI InitMyBitmapSL (MG_RWops* area, const char* ext, MYBITMAP* my_bmp, RGB* pal)
|
||||
void* GUIAPI
|
||||
InitMyBitmapSL (MG_RWops* area, const char* ext, MYBITMAP* my_bmp, RGB* pal)
|
||||
{
|
||||
int type;
|
||||
LOAD_MYBITMAP_INFO* load_info;
|
||||
@@ -206,8 +210,11 @@ void* GUIAPI InitMyBitmapSL (MG_RWops* area, const char* ext, MYBITMAP* my_bmp,
|
||||
my_bmp->frames = 1;
|
||||
my_bmp->depth = GetGDCapability (HDC_SCREEN, GDCAP_BPP) << 3;
|
||||
|
||||
// initialize the palette with the screen palette.
|
||||
if (my_bmp->depth <= 8)
|
||||
GetPalette (HDC_SCREEN, 0, 256, (GAL_Color*)pal);
|
||||
else
|
||||
memset (pal, 0, sizeof(RGB) * 256); // reset the palette.
|
||||
|
||||
/* This is just for gray screen. If your screen is gray,
|
||||
* please define this macro _GRAY_SCREEN.
|
||||
|
||||
@@ -0,0 +1,275 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IMPORTANT NOTICE
|
||||
//
|
||||
// The following open source license statement does not apply to any
|
||||
// entity in the Exception List published by FMSoft.
|
||||
//
|
||||
// For more information, please visit:
|
||||
//
|
||||
// https://www.fmsoft.cn/exception-list
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
* Copyright (C) 2002~2022, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** webp.c: Low-level WebP file read routines (based on LibWebP 0.6)
|
||||
**
|
||||
** Current maintainer: Wei Yongming
|
||||
**
|
||||
** Create date: 2021/10/19
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef _MGIMAGE_WEBP
|
||||
#include "gdi.h"
|
||||
#include "constants.h"
|
||||
|
||||
#include <webp/decode.h>
|
||||
|
||||
#define RIFF_HEADER_SIZE 12
|
||||
|
||||
#define HEADER_CHUNK_SIZE 32
|
||||
#define READ_BUFF_SIZE 1024
|
||||
|
||||
struct webp_decode_info {
|
||||
WebPDecoderConfig config;
|
||||
size_t sz_data;
|
||||
char data[READ_BUFF_SIZE];
|
||||
};
|
||||
|
||||
void* __mg_init_webp(MG_RWops *fp, MYBITMAP *mybmp, RGB *pal)
|
||||
{
|
||||
int n;
|
||||
size_t pitch;
|
||||
struct webp_decode_info *info = NULL;
|
||||
|
||||
if ((info = malloc(sizeof(struct webp_decode_info))) == NULL) {
|
||||
_ERR_PRINTF ("__mg_init_webp: failed to allocate memory\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!WebPInitDecoderConfig(&info->config)) {
|
||||
_ERR_PRINTF ("__mg_init_webp: WebPInitDecoderConfig failed\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
info->sz_data = 0;
|
||||
do {
|
||||
VP8StatusCode sc;
|
||||
|
||||
if (info->sz_data + HEADER_CHUNK_SIZE > READ_BUFF_SIZE) {
|
||||
_ERR_PRINTF ("__mg_init_webp: two small buffer\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
n = MGUI_RWread(fp, info->data + info->sz_data, 1, HEADER_CHUNK_SIZE);
|
||||
if (n > 0) {
|
||||
info->sz_data += n;
|
||||
}
|
||||
else
|
||||
goto error;
|
||||
|
||||
sc = WebPGetFeatures((const uint8_t *)info->data, info->sz_data,
|
||||
&info->config.input);
|
||||
if (sc == VP8_STATUS_OK) {
|
||||
break;
|
||||
}
|
||||
else if (sc == VP8_STATUS_NOT_ENOUGH_DATA) {
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
_ERR_PRINTF ("__mg_init_webp: WebPGetFeatures failed: %d\n", sc);
|
||||
goto error;
|
||||
}
|
||||
} while (1);
|
||||
|
||||
if (info->config.input.has_animation) {
|
||||
_ERR_PRINTF ("__mg_init_webp: animation not supported\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
#if SIZEOF_PTR == 8
|
||||
info->config.options.no_fancy_upsampling = 0;
|
||||
/* use default
|
||||
info->config.options.dithering_strength = 100; */
|
||||
/* use default
|
||||
info->config.options.alpha_dithering_strength = 100; */
|
||||
#else
|
||||
info->config.options.no_fancy_upsampling = 1;
|
||||
info->config.options.dithering_strength = 67;
|
||||
info->config.options.alpha_dithering_strength = 33;
|
||||
#endif
|
||||
|
||||
mybmp->w = info->config.input.width;
|
||||
mybmp->h = info->config.input.height;
|
||||
mybmp->frames = 1;
|
||||
if (info->config.input.has_alpha) {
|
||||
info->config.output.colorspace = MODE_RGBA;
|
||||
|
||||
mybmp->depth = 32;
|
||||
mybmp->flags |= MYBMP_FLOW_DOWN | MYBMP_ALPHA | MYBMP_TYPE_RGBA;
|
||||
mybmp->flags |= MYBMP_RGBSIZE_4;
|
||||
|
||||
pitch = (size_t)info->config.input.width * 4;
|
||||
}
|
||||
else {
|
||||
info->config.output.colorspace = MODE_RGB;
|
||||
|
||||
mybmp->depth = 24;
|
||||
mybmp->flags |= MYBMP_FLOW_DOWN | MYBMP_TYPE_RGB;
|
||||
mybmp->flags |= MYBMP_RGBSIZE_3;
|
||||
|
||||
pitch = (size_t)info->config.input.width * 3;
|
||||
}
|
||||
|
||||
pitch = ROUND_TO_MULTIPLE(pitch, 8);
|
||||
mybmp->pitch = pitch;
|
||||
|
||||
info->config.output.width = info->config.input.width;
|
||||
info->config.output.height = info->config.input.height;
|
||||
return info;
|
||||
|
||||
error:
|
||||
if (info)
|
||||
free(info);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void __mg_cleanup_webp(void *init_info)
|
||||
{
|
||||
struct webp_decode_info *info = init_info;
|
||||
|
||||
if (info) {
|
||||
free(info);
|
||||
}
|
||||
}
|
||||
|
||||
int __mg_load_webp(MG_RWops *fp, void *init_info, MYBITMAP *mybmp,
|
||||
CB_ONE_SCANLINE cb, void *context)
|
||||
{
|
||||
int rc = ERR_BMP_OK;
|
||||
struct webp_decode_info *info = init_info;
|
||||
WebPIDecoder* idec = NULL;
|
||||
int last_last_y = -1, last_y;
|
||||
|
||||
// Have config.output point to an external buffer:
|
||||
info->config.output.is_external_memory = 1;
|
||||
if (mybmp->flags & MYBMP_LOAD_ALLOCATE_ONE) {
|
||||
info->config.output.u.RGBA.stride = mybmp->pitch;
|
||||
info->config.output.u.RGBA.size = mybmp->pitch * mybmp->h;
|
||||
mybmp->bits = realloc(mybmp->bits, info->config.output.u.RGBA.size);
|
||||
}
|
||||
else {
|
||||
info->config.output.u.RGBA.stride = mybmp->pitch;
|
||||
info->config.output.u.RGBA.size = mybmp->pitch * mybmp->h;
|
||||
}
|
||||
info->config.output.u.RGBA.rgba = (uint8_t*)mybmp->bits;
|
||||
|
||||
idec = WebPINewDecoder(&info->config.output);
|
||||
if (idec == NULL) {
|
||||
rc = ERR_BMP_MEM;
|
||||
goto ret;
|
||||
}
|
||||
|
||||
while (1) {
|
||||
int n;
|
||||
|
||||
VP8StatusCode status = WebPIAppend(idec,
|
||||
(const uint8_t *)info->data, info->sz_data);
|
||||
if (status != VP8_STATUS_OK && status != VP8_STATUS_SUSPENDED) {
|
||||
_ERR_PRINTF ("__mg_load_webp: WebPIAppend failed: %d\n", status);
|
||||
rc = ERR_BMP_LOAD;
|
||||
break;
|
||||
}
|
||||
|
||||
if (WebPIDecGetRGB(idec, &last_y, NULL, NULL, NULL) &&
|
||||
(--last_y > last_last_y)) {
|
||||
|
||||
int y;
|
||||
for (y = last_last_y + 1; y <= last_y; y++) {
|
||||
if (mybmp->flags & MYBMP_LOAD_ALLOCATE_ONE) {
|
||||
mybmp->bits = info->config.output.u.RGBA.rgba;
|
||||
mybmp->bits += mybmp->pitch * y;
|
||||
}
|
||||
|
||||
if (cb)
|
||||
cb(context, mybmp, y);
|
||||
}
|
||||
|
||||
last_last_y = last_y;
|
||||
}
|
||||
|
||||
/* read more data */
|
||||
n = MGUI_RWread(fp, info->data, 1, sizeof(info->data));
|
||||
if (n > 0) {
|
||||
info->sz_data = n;
|
||||
}
|
||||
else if (n == 0) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
_ERR_PRINTF ("__mg_load_webp: MGUI_RWread failed: %d\n", n);
|
||||
rc = ERR_BMP_LOAD;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
mybmp->bits = info->config.output.u.RGBA.rgba;
|
||||
|
||||
ret:
|
||||
if (idec)
|
||||
WebPIDelete(idec);
|
||||
WebPFreeDecBuffer(&info->config.output);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
BOOL __mg_check_webp(MG_RWops* fp)
|
||||
{
|
||||
unsigned char header[RIFF_HEADER_SIZE];
|
||||
|
||||
if (MGUI_RWread(fp, header, 1, RIFF_HEADER_SIZE) != RIFF_HEADER_SIZE)
|
||||
return FALSE;
|
||||
|
||||
return WebPGetInfo(header, RIFF_HEADER_SIZE, NULL, NULL);
|
||||
}
|
||||
|
||||
#endif /* _MGIMAGE_WEBP */
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user