Compare commits

...
38 Commits
Author SHA1 Message Date
Vincent Wei e0cc3b5580 update version to 5.0.11 2022-12-13 17:10:13 +08:00
Vincent Wei e33d98a702 set pdc->bkmode correctly before calling _gdi_draw_one_glyph() 2022-11-27 16:31:27 +08:00
Vincent Wei 84f3cf048a fix a bug: dx and dy of StretchBlt are reset to zero if it is less than 0 in error 2022-11-27 16:30:34 +08:00
Vincent Wei ea579771a7 tune the implementation of auto-repeat message 2022-11-27 16:28:45 +08:00
Vincent Wei 4db97ead1f rename timeoutusec to __mg_timeout_usec; rename repeatusec to __mg_repeat_usec 2022-11-27 16:21:54 +08:00
Vincent Wei 2338501d21 use CreateMemDCFromMyBitmap instead of common_rgba8888_dc for DrawIcon() 2022-11-27 16:02:22 +08:00
Vincent Wei 81c061c3c8 cleanup 2022-11-27 15:59:52 +08:00
Vincent Wei 356bf08c4b remove code using the obsolete style: TVS_ICONFORSELECT 2022-11-27 15:58:14 +08:00
Vincent Wei 09a27e508f suppress useless print 2022-11-25 16:04:11 +08:00
Vincent Wei 0b636032ee use bkmode_set instead of saving oldbkmode in context, because it may cause the bkmode cannot be restored correctly 2022-11-25 15:25:56 +08:00
Vincent Wei 5f78f6bb37 fix a bug in Issure #106 2022-11-25 11:03:19 +08:00
Vincent Wei 272bc39c84 call __mg_legacy_bidi_map_reorder when getting the visual Achars 2022-11-25 11:01:36 +08:00
Vincent Wei 1e006c0589 cleanup 2022-11-25 11:00:58 +08:00
Vincent Wei 7158eaee0f restore __mg_legacy_bidi_map_reorder function 2022-11-25 11:00:42 +08:00
Vincent Wei abfc47159e tune and add some output for debug 2022-11-25 10:58:03 +08:00
Vincent Wei deade3d887 tuen code for resolve bugs reported in Issue #105 2022-11-13 12:22:12 +08:00
Vincent Wei cf3e0b3d4d tune 2022-11-13 11:54:20 +08:00
Vincent Wei 614deba4b7 cleanup 2022-11-13 11:53:43 +08:00
Vincent Wei 53d40508a4 set bkmode to BM_TRANSPARENT when having WS_EX_TRANSPARENT exStyle 2022-11-13 11:53:16 +08:00
Vincent Wei 39f96f407f use client DC instead of screen DC; restore the alpha component if amask != 0. 2022-11-08 17:28:23 +08:00
Vincent Wei c8c6f470ce tune 2022-11-08 17:23:02 +08:00
Vincent Wei d78b493aad fix a bug mentioned in Issue 96: bad handling for Backspace key 2022-11-08 17:22:40 +08:00
Vincent Wei 26f415f3db update release notes 2022-11-07 20:34:35 +08:00
Vincent Wei b66ef7a2f5 optimize the refresh of scrolled 2022-11-07 20:23:57 +08:00
Vincent Wei 9b89614569 fix bug reported in Issue #96 2022-11-07 19:59:54 +08:00
Vincent Wei 0d170a6f74 use CreateLogFontEx instead of CreateLogFont to follow the new style convention of font name
when creating system logfonts, but the orientation is ignored for the system logfont.
2022-11-03 20:49:50 +08:00
Vincent Wei f0dd4a74d2 Tune implementation of GetTabbedTextExtentPoint: remore odd code 2022-11-03 16:58:24 +08:00
Vincent Wei 692a6b81e0 tune update logical of some controls calling ScrollWindow 2022-11-03 16:11:49 +08:00
Vincent Wei cf49cf2b64 do not call UpdateInvalidClient in ScrollWindow: this may break update logical of control 2022-11-03 16:11:06 +08:00
Vincent Wei b26accf037 cleanup 2022-11-03 15:54:41 +08:00
Vincent Wei 5913d95ff2 debug info 2022-11-03 15:53:44 +08:00
Vincent Wei e1b94799a2 cleanup 2022-11-03 15:53:21 +08:00
Vincent Wei 385db01097 fix some implicit full-through 2022-10-22 11:49:24 +08:00
Vincent Wei d787dea652 call mg_FreeMsgQueueForThisThread immediately in TerminateGUI() 2022-10-19 19:37:06 +08:00
Vincent Wei 0adddb422b fix a bug in dskOnRemoveCtrlInstance for procs runmode 2022-10-19 19:36:16 +08:00
Vincent Wei c444030334 cleanup 2022-10-19 17:54:43 +08:00
Vincent Wei a9da4ddfba Fix a bug reported in Issue #94. 2022-10-19 17:53:39 +08:00
Vincent Wei 57cc74410f fix a minor bug 2022-10-12 15:17:27 +08:00
41 changed files with 539 additions and 632 deletions
+25
View File
@@ -1,5 +1,7 @@
# Release Notes
- [Version 5.0.11](#version-5011)
+ [What's new in version 5.0.11](#whats-new-in-version-5011)
- [Version 5.0.10](#version-5010)
+ [What's new in version 5.0.10](#whats-new-in-version-5010)
- [Version 5.0.9](#version-508)
@@ -26,6 +28,29 @@
+ [Changes leading to incompatibility](#changes-leading-to-incompatibility)
+ [Deprecated APIs](#deprecated-apis)
## Version 5.0.11
On Dec. 31, 2022, FMSoft announces the availability of MiniGUI 5.0.11,
which is a bug fixing release with bug fixes and some minor enhancements
of MiniGUI 5.0.x.
### What's new in version 5.0.11
In this version, we made some enhancements
* ENHANCEMENTS:
* BUGFIXING:
- Fix a bug reported in https://github.com/VincentWei/minigui/issues/94
- Fix a bug reported in https://github.com/VincentWei/minigui/issues/96
- Fix a bug reported in https://github.com/VincentWei/minigui/issues/105
- Fix a bug reported in https://github.com/VincentWei/minigui/issues/106
* OPTIMIZATIONS:
- Optimize the refresh of scrolled.
* TUNING:
- Call `mg_FreeMsgQueueForThisThread` immediately in `TerminateGUI()`.
- Use `CreateLogFontEx` instead of `CreateLogFont` to follow the new style convention of font name when creating the system logfonts,
but the orientation is ignored for the system logfont.
## Version 5.0.10
On Sep. 30, 2022, FMSoft announces the availability of MiniGUI 5.0.10,
+1 -1
View File
@@ -1,4 +1,4 @@
Version 5.0.9 (2022/01/14)
Version 5.0.11 (2022/12/31)
This is a minor enhancement and bugfix release of MiniGUI 5.0.x, the stable version.
+4 -4
View File
@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.60)
AC_INIT(libminigui, 5.0.10)
AC_INIT(libminigui, 5.0.11)
AC_CONFIG_SRCDIR(src/main/main.c)
dnl Set various version strings - taken gratefully from the SDL sources
@@ -16,9 +16,9 @@ dnl Set various version strings - taken gratefully from the SDL sources
#
MINIGUI_MAJOR_VERSION=5
MINIGUI_MINOR_VERSION=0
MINIGUI_MICRO_VERSION=10
MINIGUI_INTERFACE_AGE=0
MINIGUI_BINARY_AGE=0
MINIGUI_MICRO_VERSION=11
MINIGUI_INTERFACE_AGE=1
MINIGUI_BINARY_AGE=1
MINIGUI_VERSION=$MINIGUI_MAJOR_VERSION.$MINIGUI_MINOR_VERSION.$MINIGUI_MICRO_VERSION
AC_SUBST(MINIGUI_MAJOR_VERSION)
+56 -46
View File
@@ -210,6 +210,7 @@ static void setup_dc (HWND hWnd, BIDISLEDITDATA *sled, HDC hdc, BOOL bSel)
DWORD dwStyle = GetWindowStyle (hWnd);
if (!bSel) {
SetBkMode (hdc, BM_TRANSPARENT);
if (dwStyle & WS_DISABLED)
SetTextColor (hdc,
@@ -583,7 +584,7 @@ static void slePaint (HWND hWnd, HDC hdc, PBIDISLEDITDATA sled)
/* draw selected chars */
setup_dc (hWnd, sled, hdc, TRUE);
outw += DrawACharString (hdc, startx + outw, starty,
outw += DrawACharString (hdc, startx + outw, starty,
achar_string, sled->selEnd - sled->selStart, NULL, NULL);
achar_string += sled->selEnd - sled->selStart;
@@ -1069,6 +1070,7 @@ static int ascii_bidi_type[] = {
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON,
BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON,
/*0x60~0x6f*/
BIDI_TYPE_ON, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
@@ -1085,21 +1087,23 @@ static int ascii_bidi_type[] = {
static int inline get_char_bidi_type (LOGFONT* logfont, Achar32 chv)
{
DEVFONT* devfont;
int bidi_type = BIDI_TYPE_LTR;
if (IS_MBCHV(chv)) {
devfont = logfont->devfonts[1];
if (devfont->charset_ops->bidi_char_type) {
return devfont->charset_ops->bidi_char_type (chv);
}
else {
return BIDI_TYPE_LTR;
bidi_type = devfont->charset_ops->bidi_char_type (chv);
}
}
else {
return ascii_bidi_type[chv];
assert(chv < 0x80);
bidi_type = ascii_bidi_type[chv];
}
_DBG_PRINTF("chv: %X: bidi_type: %x\n", chv, bidi_type);
return bidi_type;
}
static int get_text_rl_type (PLOGFONT logfont, char* newtext, int l_char_type,
int r_char_type, int line_type)
@@ -1108,53 +1112,60 @@ static int get_text_rl_type (PLOGFONT logfont, char* newtext, int l_char_type,
Achar32 chv;
chv = GetACharValue (logfont, newtext, strlen(newtext), NULL, 0);
if (chv == INV_ACHAR_VALUE)
return -1;
int type = CHAR_TYPE_UNKKOWN;
if (chv == INV_ACHAR_VALUE) {
goto done;
}
bidi_type = get_char_bidi_type (logfont, chv);
if (BIDI_IS_STRONG(bidi_type))
{
if (BIDI_IS_RTL(bidi_type))
{
return CHAR_TYPE_RTL;
if (BIDI_IS_STRONG(bidi_type)) {
if (BIDI_IS_RTL(bidi_type)) {
type = CHAR_TYPE_RTL;
goto done;
}
else
{
return CHAR_TYPE_LTR;
else {
type = CHAR_TYPE_LTR;
goto done;
}
}
if (BIDI_IS_NUMBER(bidi_type))
{
return CHAR_TYPE_LTR;
if (BIDI_IS_NUMBER(bidi_type)) {
type = CHAR_TYPE_LTR;
goto done;
}
if (l_char_type == r_char_type)
{
return l_char_type;
if (l_char_type == r_char_type) {
type = l_char_type;
goto done;
}
/* no left char */
else if (l_char_type == -1)
{
else if (l_char_type == CHAR_TYPE_UNKKOWN) {
if (BIDI_IS_WEAK (bidi_type))
return r_char_type;
type = r_char_type;
else
return line_type;
type = line_type;
goto done;
}
/* no right char */
else if (r_char_type == -1)
{
else if (r_char_type == CHAR_TYPE_UNKKOWN) {
if (BIDI_IS_WEAK (bidi_type))
return l_char_type;
type = l_char_type;
else
return line_type;
type = line_type;
goto done;
}
else
{
return line_type;
else {
type = line_type;
}
_DBG_PRINTF("l_char_type: %d, r_char_type: %d, line_type: %d, "
"type for %X: %d\n",
l_char_type, r_char_type, line_type, chv, type);
done:
return type;
}
static int get_line_rl_type (ACHARMAPINFO* map, int len)
@@ -2133,7 +2144,7 @@ esright_input_char_refresh (HWND hWnd,
scroll_rc.right = cur_caret_x;
ScrollWindow(hWnd, -scroll_len, 0, &scroll_rc, NULL);
UpdateWindow(hWnd, FALSE);
UpdateInvalidClient(hWnd, TRUE);
edtSetCaretPos (hWnd, sled);
sled->changed = TRUE;
@@ -2504,8 +2515,6 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
unsigned char charBuffer [4];
int chars;
_DBG_PRINTF("get char-----------------char----%p\n", (PVOID)wParam);
if (dwStyle & ES_READONLY)
return 0;
@@ -2526,9 +2535,6 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
else {
chars = 1;
if (charBuffer [0] == 127) // BS
charBuffer [0] = '\b';
if (dwStyle & ES_UPPERCASE) {
charBuffer [0] = toupper (charBuffer[0]);
}
@@ -2537,12 +2543,12 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
}
if (chars == 1) {
if (charBuffer [0] < 0x20 && charBuffer[0] != '\b') //FIXME
return 0;
if (chars > 1) {
_WRN_PRINTF("BIDISLEDIT only support ISO8859-6 charset\n");
return 0;
}
if (wParam == '\b') { // backspace
else if (charBuffer [0] == '\b' || charBuffer [0] == 0x7F) {
// BS or DEL
int del = 1;
if (sled->editPos == 0 && sled->selStart == sled->selEnd)
@@ -2564,9 +2570,12 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
sleBackspaceText (hWnd, sled, del, FALSE, FALSE);
}
}
else{
else if (charBuffer [0] < 0x20) {
// ignore all other control characters.
return 0;
}
else {
if (dwStyle & ES_LEFT) {
//if ((dwStyle&0xffff) == ES_LEFT) {
esleft_input_char_refresh(hWnd, sled, (char*)charBuffer, chars);
set_edit_caret_pos(hWnd, sled);
@@ -2586,6 +2595,7 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
sleInsertText (hWnd, sled, (char* )charBuffer, chars, FALSE);
}
}
return 0;
}
+8 -11
View File
@@ -1678,7 +1678,7 @@ esright_input_char_refresh (HWND hWnd,
scroll_rc.right = cur_caret_x;
ScrollWindow(hWnd, -scroll_len, 0, &scroll_rc, NULL);
UpdateWindow(hWnd, FALSE);
UpdateInvalidClient(hWnd, TRUE);
edtSetCaretPos (hWnd, sled);
sled->changed = TRUE;
@@ -2143,9 +2143,6 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
else {
chars = 1;
if (charBuffer [0] == 127) // BS
charBuffer [0] = '\b';
if (dwStyle & ES_UPPERCASE) {
charBuffer [0] = toupper (charBuffer[0]);
}
@@ -2154,12 +2151,8 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
}
}
if (chars == 1) {
if (charBuffer [0] < 0x20 && charBuffer[0] != '\b') //FIXME
return 0;
}
if (charBuffer[0] == '\b') { //backspace
if (chars == 1 && (charBuffer[0] == '\b' || charBuffer[0] == 0x7F)) {
// ASCII BS or DEL
int del;
if (sled->editPos == 0 && sled->selStart == sled->selEnd)
@@ -2184,7 +2177,11 @@ SLEditCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
sleInsertText (hWnd, sled, NULL, del);
}
}
else{
else if (chars == 1 && charBuffer [0] < 0x20) {
// ignore all other ASCII control characters.
return 0;
}
else {
if (dwStyle & ES_LEFT) {
esleft_input_char_refresh(hWnd, sled, (char*)charBuffer, chars);
set_edit_caret_pos(hWnd, sled);
+4
View File
@@ -172,6 +172,10 @@ BOOL scrolled_set_cont_pos (HWND hWnd, PSCRDATA pscrdata, int cont_x, int cont_y
SetScrollPos (hWnd, SB_VERT, cont_y);
bChange = TRUE;
}
if (bChange)
UpdateInvalidClient(hWnd, FALSE);
return bChange;
}
+1 -4
View File
@@ -2096,7 +2096,6 @@ static void teOnChar (HWND hWnd, PTEDATA ptedata, WPARAM wParam)
rcInv.right = ptedata->svdata.scrdata.nContWidth;
rcInv.bottom = rcInv.top + ptedata->nLineHeight - ptedata->nLineBaseH;
REFRESH_NODE_EX(node, &rcInv);
// UpdateWindow(hWnd, FALSE);
newlinenr = NODE_LINENR(node);
rcInv.left = 0;
@@ -2104,12 +2103,10 @@ static void teOnChar (HWND hWnd, PTEDATA ptedata, WPARAM wParam)
rcInv.top += ptedata->nLineHeight;
rcInv.bottom = rcInv.top + ptedata->nLineHeight - ptedata->nLineBaseH;
REFRESH_NODE_EX(node, &rcInv);
// UpdateWindow(hWnd, FALSE);
}
/* houhh 20090814, UpdataWindow will invalidate all edit area, but
* erase area is not same with msg_paint area.*/
UpdateWindow(hWnd, FALSE);
//SendMessage(hWnd, MSG_PAINT, 0, 0);
UpdateInvalidClient(hWnd, TRUE);
}
}
else {
+4 -4
View File
@@ -80,17 +80,17 @@ static void update_viewport (gvGridViewData *view, int from, int to, int is_row)
{
RECT r;
GetClientRect (view->hCtrl, &r);
GetClientRect(view->hCtrl, &r);
if (is_row) {
r.top = from;
ScrollWindow (view->hCtrl, 0, to, &r, NULL);
ScrollWindow(view->hCtrl, 0, to, &r, NULL);
}
else {
r.left = from;
ScrollWindow (view->hCtrl, to, 0, &r, NULL);
ScrollWindow(view->hCtrl, to, 0, &r, NULL);
}
UpdateWindow(view->hCtrl, FALSE);
UpdateInvalidClient(view->hCtrl, FALSE);
}
// scroll function {{{
+10 -17
View File
@@ -93,14 +93,15 @@ BOOL RegisterTreeViewControl (void)
const WINDOW_ELEMENT_RENDERER * rdr =
GetDefaultWindowElementRenderer();
if (!(icon_fold = (HICON)RetrieveRes(gui_GetIconFile(rdr->name, SYSICON_FOLD, szValue)))) {
if (!(icon_fold = (HICON)RetrieveRes(gui_GetIconFile(rdr->name,
SYSICON_FOLD, szValue)))) {
if (!(icon_fold = LoadSystemIcon (SYSICON_FOLD, 0))) {
return FALSE;
}
}
if (!(icon_unfold = (HICON)RetrieveRes(gui_GetIconFile(rdr->name, SYSICON_UNFOLD, szValue)))) {
if (!(icon_unfold = (HICON)RetrieveRes(gui_GetIconFile(rdr->name,
SYSICON_UNFOLD, szValue)))) {
if (!(icon_unfold = LoadSystemIcon (SYSICON_UNFOLD, 0))) {
DestroyIcon (icon_fold);
icon_fold = 0;
@@ -180,6 +181,7 @@ static BOOL tvInitTVData (HWND hwnd, PTVDATA pData, DWORD dwStyle, PTVITEMINFO r
tvRoot->hIconFold = root_ii->hIconFold;
else
tvRoot->hIconFold = ICON_FOLD;
if (root_ii && root_ii->hIconUnfold)
tvRoot->hIconUnfold = root_ii->hIconUnfold;
else
@@ -632,22 +634,13 @@ static void tvDrawItem (HWND hWnd, HDC hdc, PTVDATA pData, int centerX, int cent
centerX += (h>>1) + TV_BOXGAP;
if (pData->dwStyle & TVS_WITHICON) {
if (!(pData->dwStyle & TVS_ICONFORSELECT)
&& (!p->child || (p->dwFlags & TVIF_FOLD))) {
if (p->child != NULL && (p->dwFlags & TVIF_FOLD)) {
if ((p->hIconFold)) {
DrawIcon (hdc, centerX, centerY - (h>>1),
h, h, p->hIconFold);
}
} else if ((pData->dwStyle & TVS_ICONFORSELECT) && p->dwFlags & TVIF_SELECTED) {
if ((p->hIconFold)) {
DrawIcon (hdc, centerX, centerY - (h>>1),
h, h, p->hIconFold);
}
} else
if ((p->hIconUnfold)) {
DrawIcon (hdc, centerX, centerY - (h>>1),
h, h, p->hIconUnfold);
DrawIcon (hdc, centerX, centerY - (h>>1), h, h, p->hIconFold);
}
} else if ((p->hIconUnfold)) {
DrawIcon (hdc, centerX, centerY - (h>>1), h, h, p->hIconUnfold);
}
centerX += h + TV_ICONGAP;
}
+11 -14
View File
@@ -461,9 +461,8 @@ static int iso8859_6_len_first_char (const unsigned char* mstr, int len)
return 2;
else if (ignore == 2)
return 3;
else
return 1;
return 1;
}
#define ISARABIC_LIG_HALF(s) ((s == 0xa5) || (s == 0xa6))
@@ -472,6 +471,7 @@ static unsigned int iso8859_6_char_type (Achar32 chv)
{
unsigned int ch_type = ACHAR_BASIC_UNKNOWN;
chv = REAL_ACHAR(chv);
if (is_arabic_char_vowel (chv)) { /* is vowel */
ch_type = ACHAR_BASIC_VOWEL;
}
@@ -483,7 +483,6 @@ static unsigned int iso8859_6_char_type (Achar32 chv)
}
static BidiType __mg_iso8859_6_bidi_char_type_map[] = {
#if 0
/*0x00~0x0f*/
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
@@ -531,7 +530,6 @@ static BidiType __mg_iso8859_6_bidi_char_type_map[] = {
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON,
BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_BN,
#endif
/*0x80~0x8f*/
BIDI_TYPE_ON, BIDI_TYPE_AL, BIDI_TYPE_AL, BIDI_TYPE_AL,
@@ -606,10 +604,9 @@ static BidiType __mg_iso8859_6_bidi_char_type_map[] = {
static BidiType iso8859_6_bidi_char_type (Achar32 chv)
{
chv = REAL_ACHAR(chv);
if (chv > 0x7F)
return (BidiType)__mg_iso8859_6_bidi_char_type_map[chv - 0x80];
else
return (BidiType)__mg_iso8859_1_bidi_char_type_map[chv];
assert(chv < TABLESIZE(__mg_iso8859_6_bidi_char_type_map));
return (BidiType)__mg_iso8859_6_bidi_char_type_map[chv];
}
static int get_table_index(Uint8 c)
@@ -796,7 +793,7 @@ static const unsigned char* iso8859_6_get_next_word (const unsigned char* mstr,
static Achar32 iso8859_6_get_shaped_char_value (const unsigned char* cur_mchar,
int cur_len, int shape_type)
{
Achar32 chv = -1;
Achar32 chv = INV_ACHAR_VALUE;
int ignore;
int index;
@@ -811,15 +808,14 @@ static Achar32 iso8859_6_get_shaped_char_value (const unsigned char* cur_mchar,
}
}
if (chv == -1 || chv == 0) {
if (chv == INV_ACHAR_VALUE || chv == 0) {
if (ISARABIC_VOWEL(*cur_mchar)){
chv = fontset_68x_get_vowel_char(*cur_mchar);
}
if (chv == 0 || chv == -1) {
if (chv == 0 || chv == INV_ACHAR_VALUE) {
index = get_table_index(*cur_mchar);
if (index >=0)
{
if (index >=0 ) {
switch (shape_type) {
case ACHAR_ISOLATED:
chv = shape_info[index].isolated;
@@ -841,7 +837,7 @@ static Achar32 iso8859_6_get_shaped_char_value (const unsigned char* cur_mchar,
}
if (chv == 0)
chv =-1;
chv = INV_ACHAR_VALUE;
return chv;
}
@@ -862,6 +858,7 @@ static const BIDICHAR_MIRROR_MAP __mg_iso8859_68x_mirror_table [] =
static BOOL iso8859_6_bidi_mirror_char (Achar32 chv, Achar32* mirrored)
{
chv = REAL_ACHAR(chv);
return get_mirror_char (__mg_iso8859_68x_mirror_table,
TABLESIZE (__mg_iso8859_68x_mirror_table), chv, mirrored);
}
+5 -6
View File
@@ -49,6 +49,8 @@
** Create date: 2000/06/13
*/
#undef NDEBUG
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -969,7 +971,6 @@ static const unsigned char* iso8859_8_get_next_word (const unsigned char* mstr,
}
static BidiType __mg_iso8859_8_bidi_char_type_map[] = {
#if 0
/*0x00~0x0f*/
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
@@ -1017,7 +1018,6 @@ static BidiType __mg_iso8859_8_bidi_char_type_map[] = {
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR,
BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_LTR, BIDI_TYPE_ON,
BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_ON, BIDI_TYPE_BN,
#endif
/*0x80~0x8f*/
BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN, BIDI_TYPE_BN,
@@ -1072,10 +1072,9 @@ static BidiType __mg_iso8859_8_bidi_char_type_map[] = {
static BidiType iso8859_8_bidi_char_type (Achar32 chv)
{
chv = REAL_ACHAR(chv);
if (chv > 0x7F)
return (BidiType)__mg_iso8859_8_bidi_char_type_map[chv - 0x80];
else
return (BidiType)__mg_iso8859_1_bidi_char_type_map[chv];
assert(chv < TABLESIZE(__mg_iso8859_8_bidi_char_type_map));
return (BidiType)__mg_iso8859_8_bidi_char_type_map[chv];
}
static const BIDICHAR_MIRROR_MAP __mg_iso8859_8_mirror_table [] =
+14 -7
View File
@@ -703,21 +703,20 @@ void __mg_legacy_bidi_get_embeddlevels (const CHARSETOPS* charset_ops,
print_hexstr(achars, len, TRUE);
}
#if 0
static void bidi_map_reverse (void* context, int len, int pos)
{
GLYPHMAPINFO* str = (GLYPHMAPINFO*)context + pos;
ACHARMAPINFO* str = (ACHARMAPINFO*)context + pos;
int i;
for (i = 0; i < len / 2; i++)
{
GLYPHMAPINFO tmp = str[i];
ACHARMAPINFO tmp = str[i];
str[i] = str[len - 1 - i];
str[len - 1 - i] = tmp;
}
}
Achar32* __mg_legacy_bidi_map_reorder (const CHARSETOPS* charset_ops,
Achar32* achars, int len, GLYPHMAPINFO* map, int pel)
Achar32* achars, int len, int pel, ACHARMAPINFO* map)
{
BYTE max_level = 1;
TYPERUN *type_rl_list = NULL;
@@ -725,6 +724,7 @@ Achar32* __mg_legacy_bidi_map_reorder (const CHARSETOPS* charset_ops,
int i;
int run_pos;
int run_len;
REORDER_CONTEXT rc;
print_hexstr(achars, len, FALSE);
@@ -741,8 +741,10 @@ Achar32* __mg_legacy_bidi_map_reorder (const CHARSETOPS* charset_ops,
}
}
bidi_reorder_cb(map, len, &type_rl_list, max_level,
bidi_map_reverse);
rc.achars = NULL;
rc.extra = map;
rc.cb = bidi_map_reverse;
bidi_reorder(&rc, len, &type_rl_list, max_level);
/* free typerun list.*/
free_typerun_list(type_rl_list);
@@ -752,18 +754,23 @@ Achar32* __mg_legacy_bidi_map_reorder (const CHARSETOPS* charset_ops,
return achars;
}
#if 0
Achar32* __mg_legacy_bidi_index_reorder (const CHARSETOPS* charset_ops,
Achar32* achars, int len, int* index_map, int pel)
{
BYTE max_level = 1;
TYPERUN *type_rl_list = NULL;
REORDER_CONTEXT rc;
print_hexstr(achars, len, FALSE);
/* W1~W7, N1~N2, I1~I2, Get the Embedding Level. */
bidi_resolve_string (charset_ops, achars, len, pel, &type_rl_list, &max_level);
bidi_reorder_cb(index_map, len, &type_rl_list, max_level,
rc.achars = achars;
rc.extra = extra;
rc.cb = cb_reverse_extra;
bidi_reorder(index_map, len, &type_rl_list, max_level,
bidi_string_reverse);
/* free typerun list.*/
+4 -1
View File
@@ -155,7 +155,10 @@ BOOL mg_InitSysFont (void)
goto error_load;
}
if ((sys_fonts[i] = CreateLogFont (type, family, charset,
/* VW 20221003: use CreateLogFontEx instead of CreateLogFont to
follow the new style convention of font name,
but the orientation is ignored for the system logfont. */
if ((sys_fonts[i] = CreateLogFontEx (type, family, charset,
style [0], style [1], style [2],
style [3], style [4], style [5],
height, 0)) == NULL) {
+2 -3
View File
@@ -377,8 +377,8 @@ static _GBType resolve_gbt(struct break_ctxt* ctxt,
uc == 0x8E2 || uc == 0xD4E || uc == 0x110BD ||
(uc >= 0x111C2 && uc <= 0x111C3)) {
gbt = GB_Prepend;
break;
}
break;
case UCHAR_CATEGORY_CONTROL:
case UCHAR_CATEGORY_LINE_SEPARATOR:
@@ -393,8 +393,8 @@ static _GBType resolve_gbt(struct break_ctxt* ctxt,
if ((uc >= 0xFFF0 && uc <= 0xFFF8) ||
(uc >= 0xE0000 && uc <= 0xE0FFF)) {
gbt = GB_ControlCRLF;
break;
}
break;
case UCHAR_CATEGORY_OTHER_LETTER:
if (ctxt->makes_hangul_syllable)
@@ -434,7 +434,6 @@ static _GBType resolve_gbt(struct break_ctxt* ctxt,
gbt = GB_RI_Odd;
else
gbt = GB_RI_Odd;
break;
}
break;
+59 -18
View File
@@ -59,17 +59,22 @@
#include "cliprect.h"
#include "gal.h"
#include "internals.h"
#include "dc.h"
BOOL GUIAPI CreateCaret (HWND hWnd, PBITMAP pBitmap, int nWidth, int nHeight)
{
PMAINWIN pWin;
pWin = (PMAINWIN)hWnd;
if (!pWin->pCaretInfo) {
HDC hdc;
if (!(pWin->pCaretInfo = malloc (sizeof (CARETINFO))))
return FALSE;
/* Since 5.0.11: use client DC of the window instead of screen DC */
hdc = GetClientDC(hWnd);
pWin->pCaretInfo->pBitmap = pBitmap;
if (pBitmap) {
nWidth = pBitmap->bmWidth;
@@ -78,18 +83,22 @@ BOOL GUIAPI CreateCaret (HWND hWnd, PBITMAP pBitmap, int nWidth, int nHeight)
pWin->pCaretInfo->nWidth = nWidth;
pWin->pCaretInfo->nHeight = nHeight;
pWin->pCaretInfo->caret_bmp.bmType = BMP_TYPE_NORMAL;
pWin->pCaretInfo->caret_bmp.bmBitsPerPixel = BITSPERPHYPIXEL;
pWin->pCaretInfo->caret_bmp.bmBytesPerPixel = BYTESPERPHYPIXEL;
pWin->pCaretInfo->caret_bmp.bmBitsPerPixel =
GetGDCapability(hdc, GDCAP_BITSPP);
pWin->pCaretInfo->caret_bmp.bmBytesPerPixel =
GetGDCapability(hdc, GDCAP_BPP);
pWin->pCaretInfo->caret_bmp.bmWidth = nWidth;
pWin->pCaretInfo->caret_bmp.bmHeight = nHeight;
pWin->pCaretInfo->caret_bmp.bmAlphaMask = NULL;
pWin->pCaretInfo->caret_bmp.bmAlphaPitch = 0;
pWin->pCaretInfo->nBytesNr = GAL_GetBoxSize (__gal_screen,
pWin->pCaretInfo->nBytesNr = GAL_GetBoxSize (dc_HDC2PDC(hdc)->surface,
nWidth, nHeight, &pWin->pCaretInfo->caret_bmp.bmPitch);
pWin->pCaretInfo->pNormal = malloc (pWin->pCaretInfo->nBytesNr);
pWin->pCaretInfo->pXored = malloc (pWin->pCaretInfo->nBytesNr);
ReleaseDC(hdc);
if (pWin->pCaretInfo->pNormal == NULL ||
pWin->pCaretInfo->pXored == NULL) {
free (pWin->pCaretInfo);
@@ -219,8 +228,8 @@ void GetCaretBitmaps (PCARETINFO pCaretInfo)
int i;
int sx, sy;
HDC hdc;
Uint32 amask;
// convert to screen coordinates
sx = pCaretInfo->x;
sy = pCaretInfo->y;
@@ -231,36 +240,68 @@ void GetCaretBitmaps (PCARETINFO pCaretInfo)
pCaretInfo->caret_bmp.bmWidth,
pCaretInfo->caret_bmp.bmHeight,
&pCaretInfo->caret_bmp);
amask = GetGDCapability(hdc, GDCAP_AMASK);
ReleaseDC (hdc);
// generate XOR bitmap.
if (pCaretInfo->pBitmap) {
if (amask == 0) {
BYTE* normal;
BYTE* bitmap;
BYTE* xored;
normal = pCaretInfo->pNormal;
bitmap = pCaretInfo->pBitmap->bmBits;
xored = pCaretInfo->pXored;
for (i = 0; i < pCaretInfo->nBytesNr; i++)
xored[i] = normal[i] ^ bitmap[i];
if (pCaretInfo->pBitmap) {
bitmap = pCaretInfo->pBitmap->bmBits;
for (i = 0; i < pCaretInfo->nBytesNr; i++)
xored[i] = normal[i] ^ bitmap[i];
}
else {
for (i = 0; i < pCaretInfo->nBytesNr; i++)
xored[i] = normal[i] ^ 0xFF;
}
}
else {
// Since 5.0.11: restore the alpha component if having alpha component.
int x, y;
BYTE* normal;
BYTE* xored;
BYTE xor_byte;
BYTE* bitmap = NULL;
gal_pixel pix_normal, pix_bitmap, pix_xored, bits_alpha;
if (BITSPERPHYPIXEL < 8)
xor_byte = 0x0F;
else
xor_byte = 0xFF;
for (y = 0; y < pCaretInfo->caret_bmp.bmHeight; y++) {
normal = pCaretInfo->pNormal + pCaretInfo->caret_bmp.bmPitch * y;
xored = pCaretInfo->pXored + pCaretInfo->caret_bmp.bmPitch * y;
if (pCaretInfo->pBitmap)
bitmap = pCaretInfo->pBitmap->bmBits +
pCaretInfo->caret_bmp.bmPitch * y;
normal = pCaretInfo->pNormal;
xored = pCaretInfo->pXored;
for (x = 0; x < pCaretInfo->caret_bmp.bmWidth; x++) {
for (i = 0; i < pCaretInfo->nBytesNr; i++)
xored[i] = normal[i] ^ xor_byte;
pix_normal = _mem_get_pixel(normal,
pCaretInfo->caret_bmp.bmBytesPerPixel);
if (pCaretInfo->pBitmap) {
pix_bitmap = _mem_get_pixel(bitmap,
pCaretInfo->caret_bmp.bmBytesPerPixel);
}
else {
pix_bitmap = 0xFFFFFFFF;
}
bits_alpha = pix_normal & amask;
pix_xored = pix_normal ^ pix_bitmap;
pix_xored &= ~amask;
pix_xored |= bits_alpha;
_mem_set_pixel(xored,
pCaretInfo->caret_bmp.bmBytesPerPixel, pix_xored);
normal += pCaretInfo->caret_bmp.bmBytesPerPixel;
xored += pCaretInfo->caret_bmp.bmBytesPerPixel;
if (pCaretInfo->pBitmap)
bitmap += pCaretInfo->caret_bmp.bmBytesPerPixel;
}
}
}
}
+9 -11
View File
@@ -93,9 +93,8 @@ void GUIAPI SetAutoRepeatMessage (HWND hWnd, UINT uMsg,
{
MSG msg;
if (hWnd) {
if (!MG_IS_NORMAL_WINDOW(hWnd))
return;
if (hWnd && !MG_IS_NORMAL_WINDOW(hWnd)) {
return;
}
msg.hwnd = hWnd;
@@ -138,7 +137,7 @@ static void RecalcClientArea (HWND hWnd)
if (pWin->secondaryDC == HDC_INVALID) {
/* remove the flag of WS_EX_AUTOSECONDARYDC */
pWin->dwExStyle = pWin->dwExStyle | WS_EX_AUTOSECONDARYDC;
pWin->dwExStyle &= ~WS_EX_AUTOSECONDARYDC;
pWin->secondaryDC = 0;
}
@@ -365,11 +364,6 @@ HWND GUIAPI ChildWindowFromPointEx (HWND hParent, POINT pt, UINT uFlags)
return pRet;
}
/* NOTE:
** this function is CONTROL mouse messages handler,
** can automaticly capture mouse depend on HITTEST code.
*/
static PCONTROL __mgs_captured_ctrl = NULL;
void __mg_reset_mainwin_capture_info (PCONTROL ctrl)
@@ -388,6 +382,11 @@ void __mg_reset_mainwin_capture_info (PCONTROL ctrl)
}
}
/* NOTE:
** this function is CONTROL mouse messages handler,
** can automaticly capture mouse depend on HITTEST code.
*/
static LRESULT DefaultDTMouseMsgHandler (PMAINWIN pWin, UINT message,
WPARAM flags, int x, int y)
{
@@ -3245,7 +3244,7 @@ int GUIAPI ScrollWindowEx (HWND hWnd, int dx, int dy,
rcScroll = rcClient;
/*
* BUGFIX: if we scrolled all area, the all area must
* BUGFIX: if we scrolled all area, the whole area must
* be set as invalidate (dongjunjie 2010/7/28)
*/
if ((dx != 0 && abs(dx) >= RECTW(rcScroll)) ||
@@ -3281,7 +3280,6 @@ 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);
+3 -3
View File
@@ -112,11 +112,11 @@ void __mg_legacy_bidi_get_embeddlevels (const CHARSETOPS* charset_ops,
Uint32 __mg_legacy_bidi_str_base_dir (const CHARSETOPS* charset_ops,
Achar32* achars, int len);
Achar32* __mg_legacy_bidi_map_reorder (const CHARSETOPS* charset_ops,
Achar32* achars, int len, int pel, ACHARMAPINFO* map);
#if 0
// Deprecated
Achar32* __mg_legacy_bidi_map_reorder (const CHARSETOPS* charset_ops,
Achar32* achars, int len, GLYPHMAPINFO* map, int pel);
Achar32* __mg_legacy_bidi_index_reorder (const CHARSETOPS* charset_ops,
Achar32* achars, int len, int* index_map, int pel);
#endif
-1
View File
@@ -70,7 +70,6 @@ struct _SCALER_INFO_FILLBMP
typedef struct {
struct _SCALER_INFO_FILLBMP scaler_info;
GAL_Rect dst_rect;
int old_bkmode;
BYTE* decoded_buff;
BYTE* decoded_alpha_buff;
+6 -1
View File
@@ -167,6 +167,8 @@ struct tagDC
/* surface of this DC */
GAL_Surface* surface;
char __first_attr[0]; // just a zero-length field for the first attribute
/* background color */
gal_pixel bkcolor;
@@ -179,7 +181,7 @@ struct tagDC
/* text color */
gal_pixel textcolor;
int bkmode;
int bkmode_set; /* the background mode set by user (5.0.12, Issue #107) */
int tabstop;
int cExtra; /* Character extra */
@@ -213,6 +215,8 @@ struct tagDC
size_t dash_list_len;
#endif
char __last_attr[0]; // just a zero-length field for the last attribute
PLOGFONT pLogFont;
POINT CurPenPos;
@@ -247,6 +251,7 @@ struct tagDC
gal_pixel skip_pixel;
gal_pixel cur_pixel;
int step;
int bkmode; /* the effective background mode */
/* ====================================================================== */
CLIPRECT* cur_ban;
+3
View File
@@ -127,6 +127,9 @@ typedef LWEVENT* PLWEVENT;
extern "C" {
#endif /* __cplusplus */
extern DWORD __mg_timeout_usec;
extern DWORD __mg_repeat_usec;
// The entrance of low level event handling thread
BOOL mg_InitLWEvent (void);
void mg_TerminateLWEvent (void);
+4 -4
View File
@@ -735,10 +735,10 @@ GAL_bool GAL_IntersectRect (const GAL_Rect *A, const GAL_Rect *B,
Bmin = B->x;
Bmax = Bmin + B->w;
if (Bmin > Amin)
Amin = Bmin;
Amin = Bmin;
intersection->x = Amin;
if (Bmax < Amax)
Amax = Bmax;
Amax = Bmax;
intersection->w = Amax - Amin > 0 ? Amax - Amin : 0;
/* Vertical intersection */
@@ -747,10 +747,10 @@ GAL_bool GAL_IntersectRect (const GAL_Rect *A, const GAL_Rect *B,
Bmin = B->y;
Bmax = Bmin + B->h;
if (Bmin > Amin)
Amin = Bmin;
Amin = Bmin;
intersection->y = Amin;
if (Bmax < Amax)
Amax = Bmax;
Amax = Bmax;
intersection->h = Amax - Amin > 0 ? Amax - Amin : 0;
return (intersection->w && intersection->h);
+12 -7
View File
@@ -232,7 +232,7 @@ static int dskAddNewMainWindow (PMAINWIN pWin)
if (pWin->secondaryDC == HDC_INVALID) {
/* remove the flag of WS_EX_AUTOSECONDARYDC */
pWin->dwExStyle = pWin->dwExStyle | WS_EX_AUTOSECONDARYDC;
pWin->dwExStyle &= ~WS_EX_AUTOSECONDARYDC;
pWin->secondaryDC = 0;
}
@@ -1429,6 +1429,8 @@ static LRESULT WindowMessageHandler(UINT message, PMAINWIN pWin, LPARAM lParam)
/* Since 5.0.0 */
case MSG_SETAUTOREPEAT:
sg_msgAutoRepeat = *(const MSG*)lParam;
/* start auto-repeat after 300ms */
sg_msgAutoRepeat.time = __mg_tick_counter + (__mg_timeout_usec/10000);
break;
/* Since 5.0.0 */
@@ -1743,11 +1745,6 @@ static int dskOnRemoveCtrlInstance (PCONTROL pParent, PCONTROL pCtrl)
FreeZOrderNode (0, pCtrl->idx_znode, NULL);
}
if (fFound) {
pCtrl->pcci->nUseCount --;
return 0;
}
if ((HWND)pCtrl == __mg_captured_wnd) {
/* force release the capture */
__mg_captured_wnd = 0;
@@ -1762,6 +1759,11 @@ static int dskOnRemoveCtrlInstance (PCONTROL pParent, PCONTROL pCtrl)
sg_msgAutoRepeat.hwnd = 0;
}
if (fFound) {
pCtrl->pcci->nUseCount--;
return 0;
}
return -1;
}
@@ -1873,9 +1875,12 @@ static void dskOnTimeout (void)
static DWORD uCounter = 0;
static DWORD blink_counter = 0;
if (sg_msgAutoRepeat.hwnd != 0) {
if (sg_msgAutoRepeat.hwnd != 0 &&
__mg_tick_counter >= sg_msgAutoRepeat.time) {
PostMessage (sg_msgAutoRepeat.hwnd, sg_msgAutoRepeat.message,
sg_msgAutoRepeat.wParam, sg_msgAutoRepeat.lParam);
/* next auto-repeat msg after 50ms */
sg_msgAutoRepeat.time = __mg_tick_counter + (__mg_repeat_usec/10000);
}
if (__mg_tick_counter < (blink_counter + 10))
+12 -6
View File
@@ -78,6 +78,7 @@
#include "server.h"
#include "drawsemop.h"
#include "devfont.h"
#include "event.h"
/******************************* global data *********************************/
PMSGQUEUE __mg_dsk_msg_queue;
@@ -2748,6 +2749,8 @@ static LRESULT dskWindowMessageHandler (UINT message,
/* Since 5.0.0 */
case MSG_SETAUTOREPEAT:
sg_msgAutoRepeat = *(const MSG*)lParam;
/* start auto-repeat after 300ms */
sg_msgAutoRepeat.time = __mg_tick_counter + (__mg_timeout_usec/10000);
break;
}
@@ -3545,11 +3548,6 @@ static int dskOnRemoveCtrlInstance (PCONTROL pParent, PCONTROL pCtrl)
cliFreeZOrderNode ((PMAINWIN)pCtrl);
}
if (fFound) {
pCtrl->pcci->nUseCount --;
return 0;
}
if ((HWND)pCtrl == __mg_captured_wnd) {
/* force release the capture */
__mg_captured_wnd = 0;
@@ -3564,6 +3562,11 @@ static int dskOnRemoveCtrlInstance (PCONTROL pParent, PCONTROL pCtrl)
sg_msgAutoRepeat.hwnd = 0;
}
if (fFound) {
pCtrl->pcci->nUseCount--;
return 0;
}
return -1;
}
@@ -4204,9 +4207,12 @@ static void dskOnTimeout (void)
static UINT uCounter = 0;
static UINT blink_counter = 0;
if (sg_msgAutoRepeat.hwnd != 0) {
if (sg_msgAutoRepeat.hwnd != 0 &&
__mg_tick_counter >= sg_msgAutoRepeat.time) {
PostMessage (sg_msgAutoRepeat.hwnd, sg_msgAutoRepeat.message,
sg_msgAutoRepeat.wParam, sg_msgAutoRepeat.lParam);
/* next auto-repeat msg after 50ms */
sg_msgAutoRepeat.time = __mg_tick_counter + (__mg_repeat_usec/10000);
}
if (__mg_tick_counter < (blink_counter + 10))
+1
View File
@@ -74,6 +74,7 @@
#include "dc.h"
#include "misc.h"
#include "devfont.h"
#include "event.h"
#ifndef WIN32
#include <sys/termios.h>
+1
View File
@@ -72,6 +72,7 @@
#include "dc.h"
#include "misc.h"
#include "devfont.h"
#include "event.h"
/******************************* global data *********************************/
/* pointer to desktop message queue */
+14 -13
View File
@@ -89,8 +89,9 @@
struct timeval __mg_event_timeout;
static DWORD timeoutusec;
static DWORD repeatusec;
DWORD __mg_timeout_usec;
DWORD __mg_repeat_usec;
static DWORD dblclicktime;
#ifndef _MGRM_THREADS
@@ -121,8 +122,8 @@ static void GetTimeout (void)
char szValue [11];
int mytimeoutusec, myrepeatusec;
timeoutusec = DEF_USEC_TIMEOUT;
repeatusec = DEF_REPEAT_TIME;
__mg_timeout_usec = DEF_USEC_TIMEOUT;
__mg_repeat_usec = DEF_REPEAT_TIME;
if (GetMgEtcValue (EVENTPARA, EVENTPARA_REPEATUSEC, szValue, 10) < 0)
return;
@@ -133,8 +134,8 @@ static void GetTimeout (void)
mytimeoutusec = atoi(szValue);
if (myrepeatusec >= 0 && mytimeoutusec > 0) {
timeoutusec = mytimeoutusec;
repeatusec = myrepeatusec;
__mg_timeout_usec = mytimeoutusec;
__mg_repeat_usec = myrepeatusec;
}
}
@@ -208,7 +209,7 @@ static void ResetKeyEvent(void)
IAL_SetLeds (slock | (numlock << 1) | (capslock << 2));
__mg_event_timeout.tv_sec = 0;
__mg_event_timeout.tv_usec = timeoutusec;
__mg_event_timeout.tv_usec = __mg_timeout_usec;
#ifndef _MGRM_THREADS
#ifdef _MGRM_PROCESSES
@@ -216,8 +217,8 @@ static void ResetKeyEvent(void)
SHAREDRES_SHIFTSTATUS = status;
#endif
timeout_threshold = timeoutusec / 10000;
repeat_threshold = repeatusec / 10000;
timeout_threshold = __mg_timeout_usec / 10000;
repeat_threshold = __mg_repeat_usec / 10000;
timeout_count = timeout_threshold;
#endif
}
@@ -631,7 +632,7 @@ BOOL kernel_GetLWEvent (int event, PLWEVENT lwe)
// set repeat time
__mg_event_timeout.tv_sec = 0;
__mg_event_timeout.tv_usec = repeatusec;
__mg_event_timeout.tv_usec = __mg_repeat_usec;
// repeat last event
if (old_lwe.type == LWETYPE_KEY
@@ -652,7 +653,7 @@ BOOL kernel_GetLWEvent (int event, PLWEVENT lwe)
old_lwe.data.me.event == ME_MIDDLEDOWN))) {
// reset delay time
__mg_event_timeout.tv_sec = 0;
__mg_event_timeout.tv_usec = timeoutusec;
__mg_event_timeout.tv_usec = __mg_timeout_usec;
}
lwe->type = LWETYPE_TIMEOUT;
@@ -880,7 +881,7 @@ BOOL kernel_GetLWEvent (int event, PLWEVENT lwe)
memcpy (oldkeystate, keystate, nr_keys);
memcpy (&old_lwe, lwe, sizeof (LWEVENT));
__mg_event_timeout.tv_sec = 0;
__mg_event_timeout.tv_usec = timeoutusec;
__mg_event_timeout.tv_usec = __mg_timeout_usec;
return 1;
}
@@ -899,7 +900,7 @@ mouseret:
me->status = status;
memcpy (&old_lwe, lwe, sizeof (LWEVENT));
__mg_event_timeout.tv_sec = 0;
__mg_event_timeout.tv_usec = timeoutusec;
__mg_event_timeout.tv_usec = __mg_timeout_usec;
return 1;
}
#endif
+2 -2
View File
@@ -617,6 +617,8 @@ void GUIAPI TerminateGUI (int not_used)
{
mg_TerminateTimer (FALSE);
mg_FreeMsgQueueForThisThread (TRUE);
/* Since 5.0.0 */
SendNotifyMessage (HWND_DESKTOP, MSG_ENDSESSION, 0, 0);
pthread_join (__mg_dsk_msg_queue->th, NULL);
@@ -655,8 +657,6 @@ void GUIAPI TerminateGUI (int not_used)
miFreeArcCache ();
#endif
mg_FreeMsgQueueForThisThread (TRUE);
deleteThreadInfoKey ();
mg_TerminateSliceAllocator();
+2 -7
View File
@@ -141,6 +141,7 @@ static void GAL_BlitCopyOverlap(GAL_BlitInfo *info)
w = info->d_width*info->dst->BytesPerPixel;
h = info->d_height;
src = info->s_pixels;
dst = info->d_pixels;
srcskip = w+info->s_skip;
@@ -390,24 +391,18 @@ static int GAL_PixmanBlit (struct GAL_Surface *src, GAL_Rect *srcrect,
msk_img = src->msk_img;
op = (pixman_op_t)src->pix_op;
_DBG_PRINTF ("srcrect: %d, %d, %dx%d; dstrect: %d, %d, %dx%d\n",
srcrect->x, srcrect->y, srcrect->w, srcrect->h,
dstrect->x, dstrect->y, dstrect->w, dstrect->h);
#if 0
pixman_region32_t clip_region;
pixman_region32_init_rect (&clip_region,
dst->clip_rect.x, dst->clip_rect.y, dst->clip_rect.w, dst->clip_rect.h);
pixman_image_set_clip_region32 (dst_img, &clip_region);
#endif
// pixman_blt does not work
#if 0
if (pixman_image_get_format (src_img) == pixman_image_get_format (dst_img) &&
op == PIXMAN_OP_SRC && msk_img == NULL) {
pixman_blt ((uint32_t *)((char*)src->pixels + src->pixels_off),
(uint32_t *)((char*)dst->pixels + dst->pixels_off),
src->pitch, dst->pitch,
src->pitch, dst->pitch,
GAL_BytesPerPixel (src),
GAL_BytesPerPixel (dst),
srcrect->x, srcrect->y,
+70 -70
View File
@@ -541,31 +541,12 @@ int GAL_LowerBlit (GAL_Surface *src, GAL_Rect *srcrect,
#ifdef MG_CONFIG_USE_OWN_OVERLAPPED_BITBLIT
ret = own_overlapped_bitblit(do_blit, src, srcrect, dst, dstrect);
#else
_DBG_PRINTF("calling do_blit: from (%d, %d, %d, %d) to (%d, %d)\n",
srcrect->x, srcrect->y, srcrect->w, srcrect->h,
dstrect->x, dstrect->y);
ret = do_blit(src, srcrect, dst, dstrect);
#endif
#if 0
{
static int n_sw=0, n_hw=0;
if ((src->flags & GAL_HWACCEL) == GAL_HWACCEL)
{
n_hw ++;
}
else
{
n_sw ++;
}
printf("[%06u] hw/blit=%d/%d %c size=%dX%d src=(%d %d),%p dst=(%d %d),%p\n",
times(NULL) % 1000000,
n_hw, n_hw+n_sw,
do_blit == src->map->sw_blit ? 'S':'H',
srcrect->w, srcrect->h,
srcrect->x, srcrect->y, src,
dstrect->x, dstrect->y, dst
);
}
#endif
return ret;
}
@@ -573,8 +554,8 @@ int GAL_LowerBlit (GAL_Surface *src, GAL_Rect *srcrect,
int GAL_UpperBlit (GAL_Surface *src, GAL_Rect *srcrect,
GAL_Surface *dst, GAL_Rect *dstrect, DWORD op)
{
GAL_Rect fulldst;
int srcx, srcy, w, h;
GAL_Rect my_dst, my_src;
int w, h;
if (! src || ! dst) {
GAL_SetError("NEWGAL: GAL_UpperBlit: passed a NULL surface.\n");
@@ -583,76 +564,95 @@ int GAL_UpperBlit (GAL_Surface *src, GAL_Rect *srcrect,
/* If the destination rectangle is NULL, use the entire dest surface */
if (dstrect == NULL) {
fulldst.x = fulldst.y = 0;
dstrect = &fulldst;
my_dst.x = my_dst.y = 0;
dstrect = &my_dst;
}
/* clip the source rectangle to the source surface */
if(srcrect) {
int maxw, maxh;
if (srcrect == NULL) {
my_src.x = my_src.y = 0;
srcrect = &my_src;
srcx = srcrect->x;
w = srcrect->w;
if(srcx < 0) {
w += srcx;
dstrect->x -= srcx;
srcx = 0;
}
maxw = src->w - srcx;
if(maxw < w)
w = maxw;
srcy = srcrect->y;
h = srcrect->h;
if(srcy < 0) {
h += srcy;
dstrect->y -= srcy;
srcy = 0;
}
maxh = src->h - srcy;
if(maxh < h)
h = maxh;
} else {
srcx = srcy = 0;
w = src->w;
h = src->h;
srcrect->w = src->w;
srcrect->h = src->h;
}
/* clip the destination rectangle against the clip rectangle */
{
/* make sure that two rectangles have the same size */
w = dstrect->w = srcrect->w;
h = dstrect->h = srcrect->h;
_DBG_PRINTF("before clipping: from (%d, %d, %d, %d) to (%d, %d)\n",
srcrect->x, srcrect->y, srcrect->w, srcrect->h,
dstrect->x, dstrect->y);
/* XXX: We must offset and clipping the source rectangle properly. */
int offx = dstrect->x - srcrect->x;
int offy = dstrect->y - srcrect->y;
/* clip the destination rectangle against the clip rectangle. */
if (TRUE) {
GAL_Rect *clip = &dst->clip_rect;
int dx, dy;
dx = clip->x - dstrect->x;
if(dx > 0) {
if (dx > 0) {
w -= dx;
dstrect->x += dx;
srcx += dx;
}
dx = dstrect->x + w - clip->x - clip->w;
if(dx > 0)
if (dx > 0)
w -= dx;
dy = clip->y - dstrect->y;
if(dy > 0) {
if (dy > 0) {
h -= dy;
dstrect->y += dy;
srcy += dy;
}
dy = dstrect->y + h - clip->y - clip->h;
if(dy > 0)
if (dy > 0)
h -= dy;
}
if(w > 0 && h > 0) {
GAL_Rect sr;
sr.x = srcx;
sr.y = srcy;
sr.w = dstrect->w = w;
sr.h = dstrect->h = h;
return GAL_LowerBlit(src, &sr, dst, dstrect, op);
if (w <= 0 || h <= 0) {
_DBG_PRINTF("destrect clipped\n");
goto done;
}
/* reset the size */
srcrect->w = dstrect->w = w;
srcrect->h = dstrect->h = h;
/* offset the source rectangle */
srcrect->x = dstrect->x - offx;
srcrect->y = dstrect->y - offy;
int old_src_x = srcrect->x;
int old_src_y = srcrect->y;
/* clip the source rectangle against the surface. */
if (TRUE) {
GAL_Rect surrect = { 0, 0, src->w, src->h };
if (!GAL_IntersectRect(srcrect, &surrect, srcrect)) {
_WRN_PRINTF("srcrect clipped\n");
goto done;
}
/* offset the destination rectangle propertly */
offx = srcrect->x - old_src_x;
offy = srcrect->y - old_src_y;
dstrect->x += offx;
dstrect->y += offy;
dstrect->w = srcrect->w;
dstrect->h = srcrect->h;
}
_DBG_PRINTF("After clipping: from (%d, %d, %d, %d) to (%d, %d)\n",
srcrect->x, srcrect->y, srcrect->w, srcrect->h,
dstrect->x, dstrect->y);
return GAL_LowerBlit(src, srcrect, dst, dstrect, op);
done:
dstrect->w = dstrect->h = 0;
return 0;
}
+8
View File
@@ -905,9 +905,17 @@ BOOL GAL_SyncUpdate (GAL_Surface *surface)
numrects = __mg_convert_region_to_rects (&surface->update_region,
rects, NR_DIRTY_RECTS);
if (numrects <= 0) {
_DBG_PRINTF("empty update region\n");
return FALSE;
}
#ifdef _DEBUG
for (int i = 0; i < numrects; i++) {
_DBG_PRINTF("update rect %d: %d, %d, %d, %d\n",
i, rects[i].x, rects[i].y, rects[i].w, rects[i].h);
}
#endif
#ifdef _MGSCHEMA_COMPOSITING
if (surface->shared_header) {
LOCK_SURFACE_SEM (surface->shared_header->sem_num);
+1 -1
View File
@@ -120,7 +120,7 @@ static int make_alpha_pixel_format (PDC pdc)
static void make_gray_pixels (PDC pdc)
{
if (pdc->bkmode == BM_TRANSPARENT
if (pdc->bkmode_set == BM_TRANSPARENT
&& !make_alpha_pixel_format (pdc)) {
int i;
Uint8 r, g, b, a;
+7 -16
View File
@@ -467,19 +467,18 @@ PDC __mg_begin_fill_bitmap (HDC hdc, int x, int y, int w, int h,
info->line_alpha_buff = NULL;
}
if(__mg_enter_drawing (pdc) < 0) {
goto fail;
}
pdc->step = 1;
pdc->cur_ban = NULL;
pdc->cur_pixel = pdc->brushcolor;
pdc->skip_pixel = bmp->bmColorKey;
fill_info->old_bkmode = pdc->bkmode;
if (bmp->bmType & BMP_TYPE_COLORKEY) {
pdc->bkmode = BM_TRANSPARENT;
}
if(__mg_enter_drawing (pdc) < 0) {
goto fail;
}
fill_info->dst_rect = rect;
return pdc;
@@ -499,8 +498,6 @@ fail:
void __mg_end_fill_bitmap (PDC pdc, const BITMAP* bmp, FILLINFO *fill_info)
{
pdc->bkmode = fill_info->old_bkmode;
__mg_leave_drawing (pdc);
if (fill_info->decoded_buff)
@@ -966,7 +963,6 @@ BOOL GUIAPI FillBoxWithBitmapPart (HDC hdc, int x, int y, int w, int h,
{
PDC pdc;
GAL_Rect rect;
int old_bkmode;
struct _SCALER_INFO_FILLBMPPART info;
if (bmp->bmWidth == 0 || bmp->bmHeight == 0 || bmp->bmBits == NULL)
@@ -1019,17 +1015,16 @@ BOOL GUIAPI FillBoxWithBitmapPart (HDC hdc, int x, int y, int w, int h,
info.line_alpha_buff = NULL;
}
ENTER_DRAWING (pdc);
pdc->step = 1;
pdc->cur_ban = NULL;
pdc->cur_pixel = pdc->brushcolor;
pdc->skip_pixel = bmp->bmColorKey;
old_bkmode = pdc->bkmode;
if (bmp->bmType & BMP_TYPE_COLORKEY) {
pdc->bkmode = BM_TRANSPARENT;
pdc->skip_pixel = bmp->bmColorKey;
}
ENTER_DRAWING (pdc);
if (bw != bmp->bmWidth || bh != bmp->bmHeight) {
pdc->bitmap_scaler(&info, bmp, bw, bh,
@@ -1049,8 +1044,6 @@ BOOL GUIAPI FillBoxWithBitmapPart (HDC hdc, int x, int y, int w, int h,
_dc_fillbox_bmp_clip (pdc, &rect, &part);
}
pdc->bkmode = old_bkmode;
LEAVE_DRAWING (pdc);
if (info.line_buff)
@@ -1561,8 +1554,6 @@ BOOL GUIAPI StretchBltEx (HDC hsdc, int sx, int sy, int sw, int sh,
#else
if (sx < 0) sx = 0;
if (sy < 0) sy = 0;
if (dx < 0) dx = 0;
if (dy < 0) dy = 0;
if (sx >= RECTW(psdc->DevRC))
goto error_ret;
+5 -3
View File
@@ -117,7 +117,6 @@ static BOOL cb_drawtextex2 (void* context, Glyph32 glyph_value,
DRAWTEXTEX2_CTXT* ctxt = (DRAWTEXTEX2_CTXT*)context;
int adv_x = 0, adv_y = 0;
BBOX bbox;
int bkmode;
switch (char_type & ACHARTYPE_BASIC_MASK) {
case ACHAR_BASIC_ZEROWIDTH:
@@ -145,8 +144,8 @@ static BOOL cb_drawtextex2 (void* context, Glyph32 glyph_value,
case ACHAR_BASIC_VOWEL:
if (!ctxt->only_extent) {
bkmode = ctxt->pdc->bkmode;
//ctxt->pdc->bkmode = BM_TRANSPARENT;
int bkmode = ctxt->pdc->bkmode;
ctxt->pdc->bkmode = BM_TRANSPARENT;
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
ctxt->x, ctxt->y, &adv_x, &adv_y);
@@ -163,9 +162,12 @@ static BOOL cb_drawtextex2 (void* context, Glyph32 glyph_value,
ctxt->x, ctxt->y, &adv_x, &adv_y, &bbox);
}
else {
int bkmode = ctxt->pdc->bkmode;
ctxt->pdc->bkmode = ctxt->pdc->bkmode_set;
ctxt->advance += _gdi_draw_one_glyph (ctxt->pdc, glyph_value,
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
ctxt->x, ctxt->y, &adv_x, &adv_y);
ctxt->pdc->bkmode = bkmode;
}
break;
}
+20 -6
View File
@@ -691,6 +691,11 @@ int __mg_enter_drawing (PDC pdc)
if (!dc_IsMemDC (pdc))
kernel_ShowCursorForGDI (FALSE, pdc);
/* Since 5.0.12, to fix issue #107.
Always use the background mode set by user as the initial value of
the effective background mode, then override pdc->bkmode
after entering drawing if need. */
pdc->bkmode = pdc->bkmode_set;
return 0;
fail:
@@ -1913,7 +1918,7 @@ static void dc_InitDC (PDC pdc, HWND hWnd, BOOL bIsClient)
memset (pdc->filter_pixels, 0, sizeof (pdc->filter_pixels));
pdc->bkcolor = GAL_MapRGB (pdc->surface->format, 0xFF, 0xFF, 0xFF);
pdc->bkmode = 0;
pdc->bkmode_set = 0; /* Since 5.0.12 */
pdc->pencolor = GAL_MapRGB (pdc->surface->format, 0x00, 0x00, 0x00);
pdc->brushcolor = GAL_MapRGB (pdc->surface->format, 0xFF, 0xFF, 0xFF);
@@ -2067,12 +2072,18 @@ static void dc_InitDC (PDC pdc, HWND hWnd, BOOL bIsClient)
* and copies the DC attributes from the refrence DC. */
static void dc_InitMemDCFrom (PDC pdc, const PDC pdc_ref)
{
unsigned nr_bytes = pdc->__last_attr - pdc->__first_attr;
memset (pdc->gray_pixels, 0, sizeof (pdc->gray_pixels));
memset (pdc->filter_pixels, 0, sizeof (pdc->filter_pixels));
#if 1
memcpy (pdc->__first_attr, pdc_ref->__first_attr, nr_bytes);
#else
/* copy attributes from reference DC
* gal_pixel bkcolor, pencolor, brushcolor, textcolor;
* int bkmode, tabstop, cExtra, wExtra, alExtra, blExtra, mapmode, ta_flags, bidi_flags;
* int bkmode, bkmode_set, tabstop, cExtra, wExtra, alExtra, blExtra,
* mapmode, ta_flags, bidi_flags;
*/
memcpy (&pdc->bkcolor, &pdc_ref->bkcolor,
sizeof (gal_pixel)*4 + sizeof (int)*9);
@@ -2080,6 +2091,8 @@ static void dc_InitMemDCFrom (PDC pdc, const PDC pdc_ref)
memcpy (&pdc->pen_type, &pdc_ref->pen_type,
(sizeof(int)*7) + sizeof(POINT) + (sizeof (void*)*3));
#endif
#endif
pdc->pLogFont = pdc_ref->pLogFont;
/* reset view point info. */
@@ -2127,7 +2140,7 @@ static void dc_InitScreenDC (PDC pdc, GAL_Surface *surface)
pdc->surface = surface;
pdc->bkcolor = PIXEL_lightwhite;
pdc->bkmode = 0;
pdc->bkmode_set = 0;
pdc->brushcolor = PIXEL_lightwhite;
@@ -3784,7 +3797,8 @@ HWND GUIAPI WindowFromDC (HDC hdc)
typedef struct _DCSTATE
{
GAL_Color bkcolor, pencolor, brushcolor, textcolor;
/* bkmode, tabstop, cExtra, wExtra, alExtra, blExtra, mapmode, ta_flags, bidi_flags */
/* bkmode_set, tabstop, cExtra, wExtra, alExtra, blExtra,
mapmode, ta_flags, bidi_flags */
char attrs_g1 [sizeof(int)*9];
#ifdef _MGHAVE_ADV_2DAPI
@@ -3872,7 +3886,7 @@ int GUIAPI SaveDC (HDC hdc)
&dc_state->textcolor.r, &dc_state->textcolor.g,
&dc_state->textcolor.b, &dc_state->textcolor.a);
memcpy (dc_state->attrs_g1, &pdc->bkmode, sizeof (dc_state->attrs_g1));
memcpy (dc_state->attrs_g1, &pdc->bkmode_set, sizeof (dc_state->attrs_g1));
#ifdef _MGHAVE_ADV_2DAPI
memcpy (dc_state->attrs_adv, &pdc->pen_type, sizeof (dc_state->attrs_adv));
#endif
@@ -3976,7 +3990,7 @@ BOOL GUIAPI RestoreDC (HDC hdc, int saved_dc)
dc_state->textcolor.r, dc_state->textcolor.g,
dc_state->textcolor.b, dc_state->textcolor.a);
memcpy (&pdc->bkmode, dc_state->attrs_g1, sizeof (dc_state->attrs_g1));
memcpy (&pdc->bkmode_set, dc_state->attrs_g1, sizeof (dc_state->attrs_g1));
#ifdef _MGHAVE_ADV_2DAPI
memcpy (&pdc->pen_type, dc_state->attrs_adv, sizeof (dc_state->attrs_adv));
#endif
+13 -10
View File
@@ -559,7 +559,6 @@ static void _glyph_draw_pixels (PDC pdc, int x, int y, gal_pixel pixel, int w)
pdc->cur_pixel = old_color;
}
pdc->cur_pixel = old_color;
}
#include "../newgal/blit.h"
@@ -1151,8 +1150,7 @@ static void _dc_ft2subpixel_scan_line(PDC pdc, int xpos, int ypos,
rgba_cur.g, rgba_cur.b);
if (pdc->cur_pixel != pixel) {
_glyph_draw_pixel (pdc,
x+xpos, ypos, pdc->cur_pixel);
_glyph_draw_pixel (pdc, x+xpos, ypos, pdc->cur_pixel);
}
}
@@ -2691,15 +2689,14 @@ int _gdi_draw_null_glyph (PDC pdc, int advance, BOOL direction,
if (WITHOUT_DRAWING (pdc)) goto end;
pdc->cur_pixel = pdc->bkcolor;
pdc->cur_ban = NULL;
pdc->step = 1;
if(!IntersectRect(&pdc->rc_output, &rc_back, &pdc->rc_output))
if (!IntersectRect(&pdc->rc_output, &rc_back, &pdc->rc_output))
goto end;
ENTER_DRAWING(pdc);
pdc->cur_pixel = pdc->bkcolor;
pdc->cur_ban = NULL;
pdc->step = 1;
draw_back_area (pdc, area, &gal_rc, 0, 0, flag);
LEAVE_DRAWING (pdc);
@@ -2968,7 +2965,7 @@ int GUIAPI DrawGlyph (HDC hdc, int x, int y, Glyph32 glyph_value,
int* adv_x, int* adv_y)
{
int my_adv_x, my_adv_y;
int advance;
int advance, bkmode;
PDC pdc;
if (glyph_value == INV_GLYPH_VALUE)
@@ -2982,9 +2979,12 @@ int GUIAPI DrawGlyph (HDC hdc, int x, int y, Glyph32 glyph_value,
/* convert to the start point on baseline. */
_gdi_get_baseline_point (pdc, &x, &y);
bkmode = pdc->bkmode;
pdc->bkmode = pdc->bkmode_set;
advance = _gdi_draw_one_glyph (pdc, glyph_value,
(pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
x, y, &my_adv_x, &my_adv_y);
pdc->bkmode = bkmode;
if (adv_x) *adv_x = my_adv_x;
if (adv_y) *adv_y = my_adv_y;
@@ -2996,9 +2996,10 @@ int GUIAPI DrawGlyphStrings(HDC hdc, Glyph32* glyphs, int nr_glyphs,
const POINT* pts)
{
int count = 0;
int i;
int i, bkmode;
PDC pdc = dc_HDC2PDC(hdc);
bkmode = pdc->bkmode;
for (i = 0; i < nr_glyphs; i++) {
int x, y;
int my_adv_x, my_adv_y;
@@ -3019,10 +3020,12 @@ int GUIAPI DrawGlyphStrings(HDC hdc, Glyph32* glyphs, int nr_glyphs,
/* convert to the start point on baseline. */
_gdi_get_baseline_point (pdc, &x, &y);
pdc->bkmode = pdc->bkmode_set;
_gdi_draw_one_glyph (pdc, gv,
(pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
x, y, &my_adv_x, &my_adv_y);
}
pdc->bkmode = bkmode;
return count;
}
+13 -5
View File
@@ -625,12 +625,18 @@ void GUIAPI DrawIcon (HDC hdc, int x, int y, int w, int h, HICON hicon)
HDC icon_dc;
PICON picon = (PICON)hicon;
icon_dc = __mg_get_common_rgba8888_dc();
if (icon_dc == HDC_INVALID)
return;
MYBITMAP icon_bmp = { };
icon_bmp.flags = MYBMP_TYPE_RGBA | MYBMP_ALPHA;
icon_bmp.frames = 1;
icon_bmp.depth = 32;
icon_bmp.w = picon->width;
icon_bmp.h = picon->height;
icon_bmp.pitch = picon->pitch;
icon_bmp.size =picon->pitch * picon->height;
icon_bmp.bits = picon->pixels;
if (!__mg_reset_common_rgba8888_dc (picon->width, picon->height,
picon->pitch, picon->pixels))
icon_dc = CreateMemDCFromMyBitmap(&icon_bmp, NULL);
if (icon_dc == HDC_INVALID)
return;
if (w <= 0) w = picon->width;
@@ -645,5 +651,7 @@ void GUIAPI DrawIcon (HDC hdc, int x, int y, int w, int h, HICON hicon)
BitBlt (icon_dc, 0, 0, picon->width, picon->height,
hdc, x, y, 0);
}
DeleteMemDC(icon_dc);
}
+6 -6
View File
@@ -1429,6 +1429,7 @@ void GUIAPI BIDIGetTextRangesLog2Vis(LOGFONT* log_font,
free(l_achars);
}
#if 0
static void bidi_reverse_map (void* context, int len, int pos)
{
ACHARMAPINFO* str = (ACHARMAPINFO*)context + pos;
@@ -1440,6 +1441,7 @@ static void bidi_reverse_map (void* context, int len, int pos)
str[len - 1 - i] = tmp;
}
}
#endif
int GUIAPI BIDIGetTextVisualAChars(LOGFONT* log_font,
const char* text, int text_len,
@@ -1457,9 +1459,8 @@ int GUIAPI BIDIGetTextVisualAChars(LOGFONT* log_font,
if (nr_achars > 0 && mbc_devfont
&& mbc_devfont->charset_ops->bidi_char_type) {
__mg_legacy_bidi_achars_reorder (mbc_devfont->charset_ops,
*achs, nr_achars, -1,
*achs_map, bidi_reverse_map);
__mg_legacy_bidi_map_reorder (mbc_devfont->charset_ops,
*achs, nr_achars, -1, *achs_map);
}
return nr_achars;
@@ -1472,9 +1473,8 @@ Achar32* GUIAPI BIDILogAChars2VisAChars(LOGFONT* log_font,
if (nr_achars > 0 && mbc_devfont
&& mbc_devfont->charset_ops->bidi_char_type) {
__mg_legacy_bidi_achars_reorder (mbc_devfont->charset_ops,
achs, nr_achars, -1,
achs_map, bidi_reverse_map);
__mg_legacy_bidi_map_reorder (mbc_devfont->charset_ops,
achs, nr_achars, -1, achs_map);
return achs;
}
+9 -13
View File
@@ -1185,7 +1185,7 @@ static void cb_direct_paint_mybmp_sl (void* context, int stepx,
int GUIAPI FillBoxWithMyBitmap (HDC hdc, int x, int y, MYBITMAP* mybmp, RGB* pal)
{
int i = 0,right,bottom,w,h,oldbkmode,stepy,stepx;
int i = 0,right,bottom,w,h,stepy,stepx;
RECT rc_tmp;
GAL_Rect dst_rect;
PCLIPRECT cliprect;
@@ -1314,20 +1314,17 @@ int GUIAPI FillBoxWithMyBitmap (HDC hdc, int x, int y, MYBITMAP* mybmp, RGB* pal
w = RECTW (pdc->rc_output); h = RECTH (pdc->rc_output);
dst_rect.x = x; dst_rect.y = y; dst_rect.w = w; dst_rect.h = h;
pdc->step = 1;
pdc->cur_ban = NULL;
pdc->cur_pixel = pdc->brushcolor;
pdc->skip_pixel = colorKey;
//fill_info->old_bkmode = pdc->bkmode;
oldbkmode =pdc->bkmode;
if (mybmp->flags & MYBMP_TRANSPARENT) {
pdc->bkmode = BM_TRANSPARENT;
}
if(__mg_enter_drawing (pdc) < 0) {
goto fail;
}
//bits = mybmp->bits;
pdc->step = 1;
pdc->cur_ban = NULL;
pdc->cur_pixel = pdc->brushcolor;
if (mybmp->flags & MYBMP_TRANSPARENT) {
pdc->bkmode = BM_TRANSPARENT;
pdc->skip_pixel = colorKey;
}
info.hdc = hdc;
info.pdc = pdc;
@@ -1350,7 +1347,6 @@ int GUIAPI FillBoxWithMyBitmap (HDC hdc, int x, int y, MYBITMAP* mybmp, RGB* pal
cliprect = cliprect->next;
}
pdc->bkmode =oldbkmode;
__mg_leave_drawing (pdc);
pdc->rc_output = rc_tmp;
UNLOCK_GCRINFO (pdc);
+24 -31
View File
@@ -133,7 +133,6 @@ static BOOL cb_tabbedtextout (void* context, Glyph32 glyph_value,
TABBEDTEXTOUT_CTXT* ctxt = (TABBEDTEXTOUT_CTXT*)context;
int adv_x, adv_y;
BBOX bbox;
int bkmode = ctxt->pdc->bkmode;
switch (char_type & ACHARTYPE_BASIC_MASK) {
case ACHAR_BASIC_ZEROWIDTH:
@@ -158,7 +157,8 @@ static BOOL cb_tabbedtextout (void* context, Glyph32 glyph_value,
case ACHAR_BASIC_VOWEL:
if (!ctxt->only_extent) {
//ctxt->pdc->bkmode = BM_TRANSPARENT;
int bkmode = ctxt->pdc->bkmode;
ctxt->pdc->bkmode = BM_TRANSPARENT;
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
ctxt->x, ctxt->y, &adv_x, &adv_y);
@@ -175,9 +175,12 @@ static BOOL cb_tabbedtextout (void* context, Glyph32 glyph_value,
ctxt->x, ctxt->y, &adv_x, &adv_y, &bbox);
}
else {
int bkmode = ctxt->pdc->bkmode;
ctxt->pdc->bkmode = ctxt->pdc->bkmode_set;
ctxt->advance += _gdi_draw_one_glyph (ctxt->pdc, glyph_value,
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
ctxt->x, ctxt->y, &adv_x, &adv_y);
ctxt->pdc->bkmode = bkmode;
}
break;
}
@@ -224,11 +227,14 @@ static BOOL cb_tabbedtextoutex (void* context, Glyph32 glyph_value,
/* use some tabs to move current x. */
if (ctxt->advance >= tab_pos) {
while (ctxt->advance >= tab_pos)
tab_pos += (ctxt->nr_tab >= ctxt->nTabs) ? ctxt->tab_width : ctxt->pTabPos[ctxt->nr_tab++];
tab_pos += (ctxt->nr_tab >= ctxt->nTabs) ?
ctxt->tab_width : ctxt->pTabPos[ctxt->nr_tab++];
}
else {
tab_pos += (ctxt->nr_tab >= ctxt->nTabs) ? ctxt->tab_width : ctxt->pTabPos[ctxt->nr_tab++];
tab_pos += (ctxt->nr_tab >= ctxt->nTabs) ?
ctxt->tab_width : ctxt->pTabPos[ctxt->nr_tab++];
}
_gdi_draw_null_glyph (ctxt->pdc, tab_pos - ctxt->advance,
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
ctxt->x, ctxt->y, &adv_x, &adv_y);
@@ -237,18 +243,26 @@ static BOOL cb_tabbedtextoutex (void* context, Glyph32 glyph_value,
ctxt->nTabOrig = tab_pos;
break;
case ACHAR_BASIC_VOWEL:
case ACHAR_BASIC_VOWEL: {
int bkmode = ctxt->pdc->bkmode;
ctxt->pdc->bkmode = BM_TRANSPARENT;
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
ctxt->x, ctxt->y, &adv_x, &adv_y);
ctxt->pdc->bkmode = bkmode;
adv_x = adv_y = 0;
break;
}
default:
default: {
int bkmode = ctxt->pdc->bkmode;
ctxt->pdc->bkmode = ctxt->pdc->bkmode_set;
ctxt->advance += _gdi_draw_one_glyph (ctxt->pdc, glyph_value,
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
ctxt->x, ctxt->y, &adv_x, &adv_y);
ctxt->pdc->bkmode = bkmode;
break;
}
}
ctxt->x += adv_x;
@@ -403,20 +417,13 @@ int GUIAPI GetTabbedTextExtent (HDC hdc, const char* spText, int len,
return advance;
}
int _gdi_tabbedex_text_out (PDC pdc, int x, int y,
static int _gdi_tabbedex_text_out (PDC pdc, int x, int y,
const unsigned char* text, int len, int tab_width,
int nTabs, int *pTabPos, int nTabOrig, POINT* cur_pos)
{
TABBEDTEXTOUTEX_CTXT ctxt;
int nr_delim_newline = 0, line_len = 0;
#if 0
DEVFONT* sbc_devfont;
DEVFONT* mbc_devfont;
sbc_devfont = pdc->pLogFont->devfonts[0];
mbc_devfont = pdc->pLogFont->devfonts[1];
#endif
ctxt.pdc = pdc;
ctxt.start_x = x;
ctxt.start_y = y;
@@ -585,25 +592,11 @@ int GUIAPI GetTabbedTextExtentPoint (HDC hdc, const char* text,
ach = devfont->charset_ops->get_char_value
(NULL, 0, (const unsigned char*)text, len_cur_char);
char_type = devfont->charset_ops->char_type (ach);
if (devfont == mbc_devfont)
ach = SET_MBCHV(ach);
gv = GetGlyphValueAlt(log_font, ach);
if (devfont == mbc_devfont) {
int i, dfi;
DEVFONT* df;
dfi = 1;
for (i = 1; i < MAXNR_DEVFONTS; i++) {
if ((df = log_font->devfonts[i])) {
if (df->font_ops->is_glyph_existed(log_font, df,
gv)) {
dfi = i;
break;
}
}
}
gv = SET_GLYPH_DFI(gv, dfi);
}
switch (char_type & ACHARTYPE_BASIC_MASK) {
case ACHAR_BASIC_ZEROWIDTH:
case ACHAR_BASIC_VOWEL:
+15 -12
View File
@@ -122,14 +122,13 @@ static BOOL cb_draw_glyph (void* context, Glyph32 glyph_value, unsigned int char
{
DRAW_GLYPHS_CTXT* ctxt = (DRAW_GLYPHS_CTXT*)context;
int adv_x, adv_y;
int bkmode;
if (check_zero_width(char_type)) {
adv_x = adv_y = 0;
}
else if (check_vowel(char_type)) {
bkmode = GetBkMode (ctxt->hdc);
//SetBkMode (ctxt->hdc, BM_TRANSPARENT);
int bkmode = GetBkMode (ctxt->hdc);
SetBkMode (ctxt->hdc, BM_TRANSPARENT);
DrawGlyph (ctxt->hdc, ctxt->x, ctxt->y, glyph_value, &adv_x, &adv_y);
SetBkMode (ctxt->hdc, bkmode);
adv_x = 0;
@@ -160,22 +159,19 @@ static BOOL cb_textout (void* context, Glyph32 glyph_value,
{
TEXTOUT_CTXT* ctxt = (TEXTOUT_CTXT*)context;
int adv_x, adv_y;
int bkmode;
if (check_zero_width (char_type)) {
adv_x = adv_y = 0;
}
else if (check_vowel(char_type)) {
if (!ctxt->only_extent) {
bkmode = ctxt->pdc->bkmode;
//ctxt->pdc->bkmode = BM_TRANSPARENT;
int bkmode = ctxt->pdc->bkmode;
ctxt->pdc->bkmode = BM_TRANSPARENT;
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
ctxt->x, ctxt->y, &adv_x, &adv_y);
ctxt->pdc->bkmode = bkmode;
}
//adv_x = adv_y = 0;
adv_x = 0;
}
else {
@@ -183,10 +179,14 @@ static BOOL cb_textout (void* context, Glyph32 glyph_value,
ctxt->advance += _gdi_get_glyph_advance (ctxt->pdc, glyph_value,
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
0, 0, &adv_x, &adv_y, NULL);
else
else {
int bkmode = ctxt->pdc->bkmode;
ctxt->pdc->bkmode = ctxt->pdc->bkmode_set;
ctxt->advance += _gdi_draw_one_glyph (ctxt->pdc, glyph_value,
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
ctxt->x, ctxt->y, &adv_x, &adv_y);
ctxt->pdc->bkmode = bkmode;
}
}
ctxt->x += adv_x;
@@ -324,14 +324,13 @@ static BOOL cb_textout_omitted (void* context, Glyph32 glyph_value, unsigned int
TEXTOUTOMITTED_CTXT* ctxt = (TEXTOUTOMITTED_CTXT*)context;
int adv_x, adv_y;
int glyph_advance = 0;
//BBOX bbox;
int bkmode = ctxt->pdc->bkmode;
if (check_zero_width(char_type)) {
adv_x = adv_y = 0;
}
else if (check_vowel(char_type)) {
//ctxt->pdc->bkmode = BM_TRANSPARENT;
int bkmode = ctxt->pdc->bkmode;
ctxt->pdc->bkmode = BM_TRANSPARENT;
_gdi_draw_one_glyph (ctxt->pdc, glyph_value,
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
ctxt->x, ctxt->y, &adv_x, &adv_y);
@@ -347,9 +346,12 @@ static BOOL cb_textout_omitted (void* context, Glyph32 glyph_value, unsigned int
if((ctxt->advance + glyph_advance) > ctxt->max_extent)
return FALSE;
int bkmode = ctxt->pdc->bkmode;
ctxt->pdc->bkmode = ctxt->pdc->bkmode_set;
ctxt->advance += _gdi_draw_one_glyph (ctxt->pdc, glyph_value,
(ctxt->pdc->ta_flags & TA_X_MASK) != TA_RIGHT,
ctxt->x, ctxt->y, &adv_x, &adv_y);
ctxt->pdc->bkmode = bkmode;
}
ctxt->x += adv_x;
@@ -476,6 +478,7 @@ int GUIAPI GetTextExtentPoint (HDC hdc, const char* text, int len,
chv = (*mbc_devfont->charset_ops->get_char_value)(NULL,
0, (const unsigned char*)text, 0);
chv = SET_MBCHV(chv);
gv = GetGlyphValueAlt(pdc->pLogFont, chv);
advance_cur_char = _gdi_get_glyph_advance (pdc, gv,
+71 -268
View File
File diff suppressed because it is too large Load Diff