From bc77048488c1f8878e1d1470443f5fc1870bbded Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Wed, 22 Jan 2020 17:02:22 +0800 Subject: [PATCH] make lock_zi_for_xxx/unlock_zi_for_xxx static inline --- src/kernel/desktop.c | 472 +++++++++++++++++++++---------------------- 1 file changed, 236 insertions(+), 236 deletions(-) diff --git a/src/kernel/desktop.c b/src/kernel/desktop.c index aafd3fb7..bc6bf680 100644 --- a/src/kernel/desktop.c +++ b/src/kernel/desktop.c @@ -11,42 +11,42 @@ // ////////////////////////////////////////////////////////////////////////////// /* - * This file is part of MiniGUI, a mature cross-platform windowing + * 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~2018, 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 . - * + * * 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 * . */ -/* +/* ** desktop.c: The Desktop module. ** -** Current maintainer: +** Current maintainer: ** */ @@ -89,7 +89,7 @@ static BLOCKHEAP sg_FreeClipRectList; #define ZT_NORMAL 0x00000004 #define ZT_ALL 0x0000000F -typedef BOOL (* CB_ONE_ZNODE) (void* context, +typedef BOOL (* CB_ONE_ZNODE) (void* context, const ZORDERINFO* zi, ZORDERNODE* node); typedef struct _DEF_CONTEXT @@ -122,15 +122,15 @@ static BOOL subtract_rgn_by_node (PCLIPRGN region, const ZORDERINFO* zi, maskrect = firstmaskrect + idx; x = maskrect->left; y = maskrect->top; - + /* convert to screen coordinate*/ x = x + node->rc.left; y = y + node->rc.top; - SetRect(&tmprc, x, y, + SetRect(&tmprc, x, y, x+maskrect->right - maskrect->left, y+maskrect->bottom - maskrect->top); - + IntersectRect(&tmprc, &tmprc, &(node->rc)); SubtractClipRect(region, &tmprc); @@ -152,15 +152,15 @@ static int pt_in_maskrect (const ZORDERINFO* zi, MASKRECT *maskrect, *firstmaskrect; int idx = nodes->idx_mask_rect; - if (idx != 0 && PtInRect (&(nodes->rc), x, y)) - { + if (idx != 0 && PtInRect (&(nodes->rc), x, y)) + { cx = x - nodes->rc.left; cy = y - nodes->rc.top; firstmaskrect = GET_MASKRECT(zi); while(idx != 0) { maskrect = firstmaskrect + idx; - SetRect (&tmprc, maskrect->left, maskrect->top, + SetRect (&tmprc, maskrect->left, maskrect->top, maskrect->right, maskrect->bottom); if (PtInRect (&tmprc, cx, cy)) @@ -176,14 +176,14 @@ static int pt_in_maskrect (const ZORDERINFO* zi, } } -static int get_znode_at_point (const ZORDERINFO* zi, +static int get_znode_at_point (const ZORDERINFO* zi, const ZORDERNODE* nodes, int x, int y) { int slot = 0; slot = zi->first_global; for (; slot > 0; slot = nodes [slot].next) { - if (nodes [slot].flags & ZOF_VISIBLE && + if (nodes [slot].flags & ZOF_VISIBLE && pt_in_maskrect(zi, &nodes[slot], x, y)) goto ret; } @@ -249,7 +249,7 @@ static void clean_znode_maskrect (ZORDERINFO* zi, ZORDERNODE* nodes, int idx_zno nodes[idx_znode].idx_mask_rect = 0; } -static int do_for_all_znodes (void* context, const ZORDERINFO* zi, +static int do_for_all_znodes (void* context, const ZORDERINFO* zi, CB_ONE_ZNODE cb, DWORD types) { int slot; @@ -282,8 +282,8 @@ static int do_for_all_znodes (void* context, const ZORDERINFO* zi, return count; } - -static void dskScreenToClient (PMAINWIN pWin, + +static void dskScreenToClient (PMAINWIN pWin, const RECT* rcScreen, RECT* rcClient) { PCONTROL pParent; @@ -302,7 +302,7 @@ static void dskScreenToClient (PMAINWIN pWin, } } -static void dskScreenToWindow (PMAINWIN pWin, +static void dskScreenToWindow (PMAINWIN pWin, const RECT* rcScreen, RECT* rcWindow) { PCONTROL pParent; @@ -321,7 +321,7 @@ static void dskScreenToWindow (PMAINWIN pWin, } } -static void dskClientToScreen (PMAINWIN pWin, +static void dskClientToScreen (PMAINWIN pWin, const RECT* rcClient, RECT* rcScreen) { PCONTROL pParent; @@ -359,17 +359,17 @@ static void dskGetWindowRectInScreen (PMAINWIN pWin, RECT* prc) } } -void __mg_update_window (HWND hwnd, +void __mg_update_window (HWND hwnd, int left, int top, int right, int bottom) { PMAINWIN pWin = (PMAINWIN)hwnd; - if (pWin + if (pWin && ((pWin->WinType == TYPE_CONTROL && (pWin->dwExStyle & WS_EX_CTRLASMAINWIN)) || pWin->WinType != TYPE_CONTROL) && pWin->dwStyle & WS_VISIBLE) { RECT invrc; - SetRect(&invrc, left, top, right, bottom); + SetRect(&invrc, left, top, right, bottom); if (IsRectEmpty (&invrc)) { SendAsyncMessage ((HWND)pWin, MSG_NCPAINT, 0, 0); @@ -384,10 +384,10 @@ void __mg_update_window (HWND hwnd, else GetWindowRect(hwnd, &rcWin); - if (IntersectRect (&rcTemp, + if (IntersectRect (&rcTemp, &rcWin, &invrc)) { dskScreenToWindow (pWin, &rcTemp, &rcInv); - SendAsyncMessage ((HWND)pWin, + SendAsyncMessage ((HWND)pWin, MSG_NCPAINT, 0, (LPARAM)(&rcInv)); dskScreenToClient (pWin, &rcTemp, &rcInv); InvalidateRect ((HWND)pWin, &rcInv, TRUE); @@ -406,20 +406,20 @@ static int update_client_window (ZORDERNODE* znode, const RECT* rc) if (rc) { if (IsRectEmpty (&znode->dirty_rc)){ - SetRect(&znode->dirty_rc, - rc->left, rc->top, rc->right, rc->bottom); + SetRect(&znode->dirty_rc, + rc->left, rc->top, rc->right, rc->bottom); } else{ - GetBoundRect (&znode->dirty_rc, &znode->dirty_rc, rc); + GetBoundRect (&znode->dirty_rc, &znode->dirty_rc, rc); } } mgClients [znode->cli].has_dirty = TRUE; } - else + else #endif { if (rc) - __mg_update_window (znode->fortestinghwnd, rc->left, rc->top, + __mg_update_window (znode->fortestinghwnd, rc->left, rc->top, rc->right, rc->bottom); else __mg_update_window (znode->fortestinghwnd, 0, 0, 0, 0); @@ -429,7 +429,7 @@ static int update_client_window (ZORDERNODE* znode, const RECT* rc) } -static BOOL _cb_update_znode (void* context, +static BOOL _cb_update_znode (void* context, const ZORDERINFO* zi, ZORDERNODE* znode) { const RECT* rc = (RECT*)context; @@ -443,7 +443,7 @@ static BOOL _cb_update_znode (void* context, return FALSE; } -static BOOL _cb_intersect_rc (void* context, +static BOOL _cb_intersect_rc (void* context, const ZORDERINFO* zi, ZORDERNODE* node) { RECT* rc = (RECT*)context; @@ -456,12 +456,12 @@ static BOOL _cb_intersect_rc (void* context, return FALSE; } -static BOOL _cb_update_rc (void* context, +static BOOL _cb_update_rc (void* context, const ZORDERINFO* zi, ZORDERNODE* node) { CLIPRGN* cliprgn = (CLIPRGN*)context; - if (node->flags & ZOF_VISIBLE && + if (node->flags & ZOF_VISIBLE && subtract_rgn_by_node(cliprgn, zi, node)) { node->age ++; node->flags |= ZOF_REFERENCE; @@ -471,7 +471,7 @@ static BOOL _cb_update_rc (void* context, return FALSE; } -static BOOL _cb_exclude_rc (void* context, +static BOOL _cb_exclude_rc (void* context, const ZORDERINFO* zi, ZORDERNODE* node) { if (!(node->flags & ZOF_VISIBLE)) @@ -486,7 +486,7 @@ static BOOL _cb_exclude_rc (void* context, while(idx != 0) { x = node->rc.left + (first+idx)->left; y = node->rc.top + (first+idx)->top; - SetRect(&rc, x, y, + SetRect(&rc, x, y, x+(first+idx)->right-(first+idx)->left, y+(first+idx)->bottom-(first+idx)->top); ExcludeClipRect (HDC_SCREEN_SYS, &rc); @@ -512,52 +512,52 @@ static void reset_window (PMAINWIN pWin, RECT* rcWin) #ifdef _MGRM_THREADS #ifndef __NOUNIX__ /*for unix system, using read/write lock*/ -void lock_zi_for_change (const ZORDERINFO* zi) +static inline void lock_zi_for_change (const ZORDERINFO* zi) { pthread_rwlock_wrlock(&((ZORDERINFO*)zi)->rwlock); } -void unlock_zi_for_change (const ZORDERINFO* zi) +static inline void unlock_zi_for_change (const ZORDERINFO* zi) { pthread_rwlock_unlock(&((ZORDERINFO*)zi)->rwlock); } -void lock_zi_for_read (const ZORDERINFO* zi) +static inline void lock_zi_for_read (const ZORDERINFO* zi) { pthread_rwlock_rdlock(&((ZORDERINFO*)zi)->rwlock); } -void unlock_zi_for_read (const ZORDERINFO* zi) +static inline void unlock_zi_for_read (const ZORDERINFO* zi) { pthread_rwlock_unlock(&((ZORDERINFO*)zi)->rwlock); } #else /*for non-unix system, using mutex*/ -void lock_zi_for_change (const ZORDERINFO* zi) +static inline void lock_zi_for_change (const ZORDERINFO* zi) { pthread_mutex_lock(&((ZORDERINFO*)zi)->rwlock); } -void unlock_zi_for_change (const ZORDERINFO* zi) +static inline void unlock_zi_for_change (const ZORDERINFO* zi) { pthread_mutex_unlock(&((ZORDERINFO*)zi)->rwlock); } -void lock_zi_for_read (const ZORDERINFO* zi) +static inline void lock_zi_for_read (const ZORDERINFO* zi) { pthread_mutex_lock(&((ZORDERINFO*)zi)->rwlock); } -void unlock_zi_for_read (const ZORDERINFO* zi) +static inline void unlock_zi_for_read (const ZORDERINFO* zi) { pthread_mutex_unlock(&((ZORDERINFO*)zi)->rwlock); } #endif #elif defined(_MGRM_STANDALONE) /*for _MGRM_STANDALONE*/ -void lock_zi_for_change (const ZORDERINFO* zi) { } -void unlock_zi_for_change (const ZORDERINFO* zi) { } -void lock_zi_for_read (const ZORDERINFO* zi) { } -void unlock_zi_for_read (const ZORDERINFO* zi) { } +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) { } #else /* for procs */ /* NULL. see desktop-procs.c */ #endif /* _MGRM_THREADS */ @@ -565,7 +565,7 @@ void unlock_zi_for_read (const ZORDERINFO* zi) { } static int RestrictControlRect(PMAINWIN pWin, RECT *minimal) { RECT rcMove; - int off_x = 0, off_y = 0; + int off_x = 0, off_y = 0; PCONTROL pCtrl = gui_Control((HWND)pWin); PCONTROL pRoot = (PCONTROL)(pWin->pMainWin); @@ -574,7 +574,7 @@ static int RestrictControlRect(PMAINWIN pWin, RECT *minimal) return FALSE; do { - PCONTROL pParent = pCtrl; + PCONTROL pParent = pCtrl; rcMove.left = pRoot->cl + off_x; rcMove.top = pRoot->ct + off_y; @@ -640,7 +640,7 @@ static int dskScrollMainWindow (PMAINWIN pWin, PSCROLLWINDOWINFO pswi) if (pWin->dwExStyle & WS_EX_TRANSPARENT) { /* set invalidate rect. */ - InvalidateRect ((HWND)pWin, &rcMove, TRUE); + InvalidateRect ((HWND)pWin, &rcMove, TRUE); inved = TRUE; } else { @@ -648,7 +648,7 @@ static int dskScrollMainWindow (PMAINWIN pWin, PSCROLLWINDOWINFO pswi) SelectClipRect (hdc, &rcMove); - BitBlt (hdc, rcMove.left, rcMove.top, + BitBlt (hdc, rcMove.left, rcMove.top, rcMove.right - rcMove.left, rcMove.bottom - rcMove.top, hdc, pswi->iOffx + rcMove.left, pswi->iOffy + rcMove.top, 0); @@ -657,7 +657,7 @@ static int dskScrollMainWindow (PMAINWIN pWin, PSCROLLWINDOWINFO pswi) pcrc = pcrc->next; } //ReleaseDC (hdc); - //BUGFIXED: we must update the secondaryDC to clientDC, to ensure + //BUGFIXED: we must update the secondaryDC to clientDC, to ensure //the secondaryDC and clientDC are same (dongjunjie 2010/07/08) if(pWin->pMainWin->secondaryDC){ HDC real_dc = GetClientDC((HWND)pWin->pMainWin); @@ -674,7 +674,7 @@ static int dskScrollMainWindow (PMAINWIN pWin, PSCROLLWINDOWINFO pswi) pthread_mutex_lock (&pInvRgn->lock); #endif /*scroll whole screen, offset invalid region*/ - if (EqualRect (pswi->rc1, &rcClient)) + if (EqualRect (pswi->rc1, &rcClient)) OffsetRegion (&(pInvRgn->rgn), pswi->iOffx, pswi->iOffy); else OffsetRegionEx (&(pInvRgn->rgn), &rcClient, @@ -712,11 +712,11 @@ static int dskScrollMainWindow (PMAINWIN pWin, PSCROLLWINDOWINFO pswi) rcInvalid.right = rcInvalid.left + pswi->iOffx; bNeedInvalidate = TRUE; } - + /* * BUGFIXED: offx and offy would make the two diffrent areas invalidate * we should invalid both them (dongjunjie) 2010/07/30 - * + * * content * --------------------------- * |//: offX | @@ -731,12 +731,12 @@ static int dskScrollMainWindow (PMAINWIN pWin, PSCROLLWINDOWINFO pswi) */ if(bNeedInvalidate) { - InvalidateRect ((HWND)pWin, &rcInvalid, TRUE); + InvalidateRect ((HWND)pWin, &rcInvalid, TRUE); rcInvalid = rcMove; //restore the invalidate area bNeedInvalidate = FALSE; //resotre the inved value inved = TRUE; } - + if (pswi->iOffy < 0) { rcInvalid.top = rcInvalid.bottom + pswi->iOffy; bNeedInvalidate = TRUE; @@ -748,7 +748,7 @@ static int dskScrollMainWindow (PMAINWIN pWin, PSCROLLWINDOWINFO pswi) if (bNeedInvalidate) { - InvalidateRect ((HWND)pWin, &rcInvalid, TRUE); + InvalidateRect ((HWND)pWin, &rcInvalid, TRUE); inved = TRUE; } @@ -772,7 +772,7 @@ void __mg_unlock_gcrinfo (PDC pdc) return; } -static BOOL _cb_recalc_gcrinfo (void* context, +static BOOL _cb_recalc_gcrinfo (void* context, const ZORDERINFO* zi, ZORDERNODE* node) { PGCRINFO gcrinfo; @@ -796,7 +796,7 @@ void __mg_lock_recalc_gcrinfo (PDC pdc) gcrinfo = kernel_GetGCRgnInfo (pdc->hwnd); mainwin = (PMAINWIN)(pdc->hwnd); - + #ifdef _MGRM_THREADS pthread_mutex_lock (&pdc->pGCRInfo->lock); #endif @@ -829,14 +829,14 @@ void __mg_lock_recalc_gcrinfo (PDC pdc) switch (nodes[idx_znode].flags & ZOF_TYPE_MASK) { case ZOF_TYPE_NORMAL: - do_for_all_znodes (gcrinfo, zi, + do_for_all_znodes (gcrinfo, zi, _cb_recalc_gcrinfo, ZT_GLOBAL); - do_for_all_znodes (gcrinfo, zi, + do_for_all_znodes (gcrinfo, zi, _cb_recalc_gcrinfo, ZT_TOPMOST); slot = zi->first_normal; break; case ZOF_TYPE_TOPMOST: - do_for_all_znodes (gcrinfo, zi, + do_for_all_znodes (gcrinfo, zi, _cb_recalc_gcrinfo, ZT_GLOBAL); slot = zi->first_topmost; break; @@ -844,7 +844,7 @@ void __mg_lock_recalc_gcrinfo (PDC pdc) slot = zi->first_global; break; case ZOF_TYPE_DESKTOP: - do_for_all_znodes (gcrinfo, zi, + do_for_all_znodes (gcrinfo, zi, _cb_recalc_gcrinfo, ZT_ALL); break; default: @@ -857,7 +857,7 @@ void __mg_lock_recalc_gcrinfo (PDC pdc) } if (nodes [slot].flags & ZOF_VISIBLE) - subtract_rgn_by_node(&gcrinfo->crgn, zi, &nodes[slot]); + subtract_rgn_by_node(&gcrinfo->crgn, zi, &nodes[slot]); slot = nodes [slot].next; } @@ -908,7 +908,7 @@ static int get_next_visible_mainwin (const ZORDERINFO* zi, int from) while (next) { if (nodes [next].flags & ZOF_TF_MAINWIN - && (nodes [next].flags & ZOF_VISIBLE) + && (nodes [next].flags & ZOF_VISIBLE) && !(nodes [next].flags & ZOF_DISABLED)) return next; @@ -919,7 +919,7 @@ static int get_next_visible_mainwin (const ZORDERINFO* zi, int from) next = zi->first_global; while (next) { if (nodes [next].flags & ZOF_TF_MAINWIN - && (nodes [next].flags & ZOF_VISIBLE) + && (nodes [next].flags & ZOF_VISIBLE) && !(nodes [next].flags & ZOF_DISABLED)) return next; @@ -929,7 +929,7 @@ static int get_next_visible_mainwin (const ZORDERINFO* zi, int from) next = zi->first_topmost; while (next) { if (nodes [next].flags & ZOF_TF_MAINWIN - && (nodes [next].flags & ZOF_VISIBLE) + && (nodes [next].flags & ZOF_VISIBLE) && !(nodes [next].flags & ZOF_DISABLED)) return next; @@ -939,7 +939,7 @@ static int get_next_visible_mainwin (const ZORDERINFO* zi, int from) next = zi->first_normal; while (next) { if (nodes [next].flags & ZOF_TF_MAINWIN - && (nodes [next].flags & ZOF_VISIBLE) + && (nodes [next].flags & ZOF_VISIBLE) && !(nodes [next].flags & ZOF_DISABLED)) return next; @@ -955,7 +955,7 @@ static int get_next_visible_mainwin (const ZORDERINFO* zi, int from) static void dskAddNewHostedMainWindow (PMAINWIN pHosting, PMAINWIN pHosted) { PMAINWIN head, prev; - + pHosted->pNextHosted = NULL; head = pHosting->pFirstHosted; @@ -974,13 +974,13 @@ static void dskAddNewHostedMainWindow (PMAINWIN pHosting, PMAINWIN pHosted) return; } -/* +/* * Remove a hosted main window. */ void dskRemoveHostedMainWindow (PMAINWIN pHosting, PMAINWIN pHosted) { PMAINWIN head, prev; - + head = pHosting->pFirstHosted; if (head == pHosted) { @@ -991,7 +991,7 @@ void dskRemoveHostedMainWindow (PMAINWIN pHosting, PMAINWIN pHosted) while (head) { prev = head; head = head->pNextHosted; - + if (head == pHosted) { prev->pNextHosted = head->pNextHosted; return; @@ -1052,7 +1052,7 @@ static HMENU sg_DesktopMenu = 0; /* system global desktop menu handle */ // call back proc of tracking menu. // defined in Menu module. -int PopupMenuTrackProc (PTRACKMENUINFO ptmi, +int PopupMenuTrackProc (PTRACKMENUINFO ptmi, int message, WPARAM wParam, LPARAM lParam); static int srvForceCloseMenu (int cli) @@ -1104,7 +1104,7 @@ static int srvForceCloseMenu (int cli) do_for_all_znodes (&rc_bound, zi, _cb_update_znode, ZT_ALL); if (win_nodes [0].flags & ZOF_REFERENCE) { - SendMessage (HWND_DESKTOP, + SendMessage (HWND_DESKTOP, MSG_ERASEDESKTOP, 0, (LPARAM)&rc_bound); win_nodes [0].flags &= ~ZOF_REFERENCE; } @@ -1139,7 +1139,7 @@ static int srvStartTrackPopupMenu (int cli, const RECT* rc, HWND ptmi) menu_nodes = GET_MENUNODE(zi); win_nodes = menu_nodes + DEF_NR_POPUPMENUS; - + /* lock zi for change */ lock_zi_for_change (zi); @@ -1176,7 +1176,7 @@ static int srvEndTrackPopupMenu (int cli, int idx_znode) menu_nodes = GET_MENUNODE(zi); win_nodes = menu_nodes + DEF_NR_POPUPMENUS; - + /* lock zi for change */ lock_zi_for_change (zi); @@ -1202,7 +1202,7 @@ static int srvEndTrackPopupMenu (int cli, int idx_znode) do_for_all_znodes (&rc, zi, _cb_update_znode, ZT_ALL); if (win_nodes [0].flags & ZOF_REFERENCE) { - SendMessage (HWND_DESKTOP, + SendMessage (HWND_DESKTOP, MSG_ERASEDESKTOP, 0, (LPARAM)&rc); win_nodes [0].flags &= ~ZOF_REFERENCE; } @@ -1215,8 +1215,8 @@ static BOOL dskCloseMenu (void) if (sg_ptmi == NULL) return FALSE; - SendNotifyMessage (sg_ptmi->hwnd, - MSG_DEACTIVEMENU, + SendNotifyMessage (sg_ptmi->hwnd, + MSG_DEACTIVEMENU, (WPARAM)sg_ptmi->pmb, (LPARAM)sg_ptmi->pmi); @@ -1229,7 +1229,7 @@ static BOOL dskCloseMenu (void) #endif -int __mg_post_msg_by_znode (const ZORDERINFO* zi, int znode, +int __mg_post_msg_by_znode (const ZORDERINFO* zi, int znode, int message, WPARAM wParam, LPARAM lParam) { int ret = 0; @@ -1241,12 +1241,12 @@ int __mg_post_msg_by_znode (const ZORDERINFO* zi, int znode, nodes = GET_ZORDERNODE(zi); if (nodes [znode].cli == 0) { - ret = PostMessage (nodes [znode].main_win, + ret = PostMessage (nodes [znode].main_win, message, wParam, lParam); } #if defined (_MGRM_PROCESSES) && !defined (_MGRM_STANDALONE) else { - MSG msg = {nodes [znode].main_win, + MSG msg = {nodes [znode].main_win, message, wParam, lParam, __mg_timer_counter}; ret = __mg_send2client (&msg, mgClients + nodes [znode].cli); @@ -1256,8 +1256,8 @@ int __mg_post_msg_by_znode (const ZORDERINFO* zi, int znode, return ret; } -static int -post_msg_by_znode_p (const ZORDERINFO* zi, const ZORDERNODE* znode, +static int +post_msg_by_znode_p (const ZORDERINFO* zi, const ZORDERNODE* znode, int message, WPARAM wParam, LPARAM lParam) { int ret = 0; @@ -1270,7 +1270,7 @@ post_msg_by_znode_p (const ZORDERINFO* zi, const ZORDERNODE* znode, } #if defined (_MGRM_PROCESSES) && !defined (_MGRM_STANDALONE) else { - MSG msg = {znode->main_win, + MSG msg = {znode->main_win, message, wParam, lParam, __mg_timer_counter}; ret = __mg_send2client (&msg, mgClients + znode->cli); @@ -1287,7 +1287,7 @@ static HWND dskSetActiveZOrderNode (int cli, int idx_znode) ZORDERNODE* nodes; HWND old_hwnd = HWND_NULL, new_hwnd = HWND_NULL; - if (idx_znode > zi->max_nr_globals + if (idx_znode > zi->max_nr_globals + zi->max_nr_topmosts + zi->max_nr_normals) { return HWND_INVALID; } @@ -1332,27 +1332,27 @@ static HWND dskSetActiveZOrderNode (int cli, int idx_znode) } if (old_active && (nodes [zi->active_win].flags & ZOF_VISIBLE)) { - post_msg_by_znode_p (zi, nodes + old_active, + post_msg_by_znode_p (zi, nodes + old_active, MSG_NCACTIVATE, FALSE, 0); - post_msg_by_znode_p (zi, nodes + old_active, + post_msg_by_znode_p (zi, nodes + old_active, MSG_ACTIVE, FALSE, 0); - post_msg_by_znode_p (zi, nodes + old_active, + post_msg_by_znode_p (zi, nodes + old_active, MSG_KILLFOCUS, (WPARAM)new_hwnd, 0); } if (idx_znode) { - post_msg_by_znode_p (zi, nodes + idx_znode, + post_msg_by_znode_p (zi, nodes + idx_znode, MSG_NCACTIVATE, TRUE, 0); - post_msg_by_znode_p (zi, nodes + idx_znode, + post_msg_by_znode_p (zi, nodes + idx_znode, MSG_ACTIVE, TRUE, 0); - post_msg_by_znode_p (zi, nodes + idx_znode, + post_msg_by_znode_p (zi, nodes + idx_znode, MSG_SETFOCUS, (WPARAM)old_hwnd, 0); } return old_hwnd; } -static void get_text_char_pos (PLOGFONT log_font, const char *text, +static void get_text_char_pos (PLOGFONT log_font, const char *text, int len, int fit_bytes, int *fit_chars, int *pos_chars) { DEVFONT* sbc_devfont = log_font->devfonts[0]; @@ -1365,8 +1365,8 @@ static void get_text_char_pos (PLOGFONT log_font, const char *text, if (pos_chars) { pos_chars[char_count] = len - left_bytes; } - if ((mbc_devfont) && - (len_cur_char = mbc_devfont->charset_ops->len_first_char + if ((mbc_devfont) && + (len_cur_char = mbc_devfont->charset_ops->len_first_char ((const unsigned char*)text, left_bytes)) > 0) { char_count ++; left_bytes -= len_cur_char; @@ -1384,7 +1384,7 @@ static void get_text_char_pos (PLOGFONT log_font, const char *text, } } } - + if (fit_chars) { *fit_chars = char_count; } @@ -1398,7 +1398,7 @@ int __mg_get_idle_slot (unsigned char* bitmap, int len_bmp) for (i = 0; i < len_bmp; i++) { for (j = 0; j < 8; j++) { - if (*bitmap & (0x80 >> j)) + if (*bitmap & (0x80 >> j)) idle++; } bitmap++; @@ -1425,9 +1425,9 @@ int __mg_get_idle_slot (unsigned char* bitmap, int len_bmp) else { \ CopyRect(&(drc[idx]), &src); \ idx++; \ - } + } -int CreateNodeRoundMaskRect (ZORDERINFO* zi, ZORDERNODE* node, +int CreateNodeRoundMaskRect (ZORDERINFO* zi, ZORDERNODE* node, const DWORD type, const RECT *rc) { RECT* roundrc = NULL; @@ -1474,7 +1474,7 @@ int CreateNodeRoundMaskRect (ZORDERINFO* zi, ZORDERNODE* node, for(i = 1; i < r; i++) { z = sqrt (r*r-i*i); - SetRect (&rect, rc->left+r-z, + SetRect (&rect, rc->left+r-z, rc->top+RECTHP(rc)-r+i-1, rc->left+RECTWP(rc)-r+z, rc->top+RECTHP(rc)-r+i+1); @@ -1487,8 +1487,8 @@ int CreateNodeRoundMaskRect (ZORDERINFO* zi, ZORDERNODE* node, rc->left+RECTWP(rc), rc->top+RECTHP(rc)); do_with_round_rect (rect, roundrc, rc_idx); } - - /* if have enough mask rect */ + + /* if have enough mask rect */ if ( rc_idx > __mg_get_idle_slot((unsigned char*)GET_MASKRECT_USAGEBMP(zi), zi->size_maskrect_usage_bmp)) { @@ -1502,7 +1502,7 @@ int CreateNodeRoundMaskRect (ZORDERINFO* zi, ZORDERNODE* node, idx = 0; for(i = 0; i < rc_idx; i++) { free_slot = __mg_lookfor_unused_slot ( - (unsigned char*)GET_MASKRECT_USAGEBMP(zi), + (unsigned char*)GET_MASKRECT_USAGEBMP(zi), zi->size_maskrect_usage_bmp, 1); if (free_slot == -1) { _WRN_PRINTF ("KERNEL: __mg_lookfor_unused_slot failed\n"); @@ -1514,7 +1514,7 @@ int CreateNodeRoundMaskRect (ZORDERINFO* zi, ZORDERNODE* node, (firstmaskrect+idx)->next = free_slot; } else { - node->idx_mask_rect = free_slot; + node->idx_mask_rect = free_slot; } idx = free_slot; } @@ -1522,7 +1522,7 @@ int CreateNodeRoundMaskRect (ZORDERINFO* zi, ZORDERNODE* node, if (idx != 0) { (firstmaskrect+idx)->prev = 0; } - + /*get value*/ idx = node->idx_mask_rect; i=0; @@ -1534,13 +1534,13 @@ int CreateNodeRoundMaskRect (ZORDERINFO* zi, ZORDERNODE* node, idx = (firstmaskrect+idx)->next; i++; } - + free (roundrc); return 0; } -static int AllocZOrderNode (int cli, HWND hwnd, HWND main_win, +static int AllocZOrderNode (int cli, HWND hwnd, HWND main_win, DWORD flags, const RECT *rc, const char *caption) { DWORD type = flags & ZOF_TYPE_MASK; @@ -1589,11 +1589,11 @@ static int AllocZOrderNode (int cli, HWND hwnd, HWND main_win, /* the slot must be larger than zero */ if (type == ZOF_TYPE_GLOBAL) - free_slot = __mg_lookfor_unused_slot ((BYTE*)(zi + 1), + free_slot = __mg_lookfor_unused_slot ((BYTE*)(zi + 1), zi->max_nr_globals, 1); else { - free_slot = __mg_lookfor_unused_slot ((BYTE*)(zi + 1) - + (zi->max_nr_globals >> 3), + free_slot = __mg_lookfor_unused_slot ((BYTE*)(zi + 1) + + (zi->max_nr_globals >> 3), zi->size_usage_bmp - (zi->max_nr_globals >> 3), 1); if (free_slot >= 0) { @@ -1619,9 +1619,9 @@ static int AllocZOrderNode (int cli, HWND hwnd, HWND main_win, if (flags & ZOF_TW_TROUNDCNS || flags & ZOF_TW_BROUNDCNS) { RECT cli_rect; - SetRect(&cli_rect, 0, 0, RECTW(nodes[free_slot].rc), + SetRect(&cli_rect, 0, 0, RECTW(nodes[free_slot].rc), RECTH(nodes[free_slot].rc)); - CreateNodeRoundMaskRect (__mg_zorder_info, + CreateNodeRoundMaskRect (__mg_zorder_info, &nodes[free_slot], flags, &cli_rect); } @@ -1670,7 +1670,7 @@ static int AllocZOrderNode (int cli, HWND hwnd, HWND main_win, if (type >= ZOF_TYPE_TOPMOST) { slot = zi->first_topmost; for (; slot > 0; slot = nodes [slot].next) { - if (nodes [slot].flags & ZOF_VISIBLE && + if (nodes [slot].flags & ZOF_VISIBLE && DoesIntersect (&nodes [free_slot].rc, &nodes [slot].rc)) { nodes [slot].age ++; } @@ -1679,7 +1679,7 @@ static int AllocZOrderNode (int cli, HWND hwnd, HWND main_win, if (type >= ZOF_TYPE_GLOBAL) { slot = zi->first_global; for (; slot > 0; slot = nodes [slot].next) { - if (nodes [slot].flags & ZOF_VISIBLE && + if (nodes [slot].flags & ZOF_VISIBLE && DoesIntersect (&nodes [free_slot].rc, &nodes [slot].rc)) { nodes [slot].age ++; } @@ -1691,7 +1691,7 @@ static int AllocZOrderNode (int cli, HWND hwnd, HWND main_win, } #if defined(_MG_ENABLE_SCREENSAVER) || defined(_MG_ENABLE_WATERMARK) - if (*first == 0 + if (*first == 0 || (nodes [*first].flags & ZOF_TF_TOPFOREVER) != ZOF_TF_TOPFOREVER ) { old_first = *first; @@ -1747,7 +1747,7 @@ static int FreeZOrderNode (int cli, int idx_znode) int slot, old_active, next_active; RECT rc; - if (idx_znode > (zi->max_nr_globals + if (idx_znode > (zi->max_nr_globals + zi->max_nr_topmosts + zi->max_nr_normals) || idx_znode <= 0) { return -1; @@ -1791,7 +1791,7 @@ static int FreeZOrderNode (int cli, int idx_znode) lock_zi_for_change (zi); /* Free round corners mask rect. */ - if (type & ZOF_TW_TROUNDCNS || + if (type & ZOF_TW_TROUNDCNS || type & ZOF_TW_BROUNDCNS) { #if 0 @@ -1837,7 +1837,7 @@ static int FreeZOrderNode (int cli, int idx_znode) if (type > ZOF_TYPE_NORMAL) { slot = zi->first_normal; for (; slot > 0; slot = nodes [slot].next) { - if (nodes [slot].flags & ZOF_VISIBLE && + if (nodes [slot].flags & ZOF_VISIBLE && subtract_rgn_by_node(&sg_UpdateRgn, zi, &nodes[slot])) { nodes [slot].age ++; nodes [slot].flags |= ZOF_REFERENCE; @@ -1871,7 +1871,7 @@ static int FreeZOrderNode (int cli, int idx_znode) do_for_all_znodes (&rc, zi, _cb_update_znode, ZT_ALL); if (nodes [0].flags & ZOF_REFERENCE) { - SendMessage (HWND_DESKTOP, + SendMessage (HWND_DESKTOP, MSG_ERASEDESKTOP, 0, (WPARAM)&rc); nodes [0].flags &= ~ZOF_REFERENCE; } @@ -1889,15 +1889,15 @@ static DWORD get_znode_flags_from_style (PMAINWIN pWin) { DWORD zt_type = 0; -#if defined(_MGRM_PROCESSES) && !defined(_MGRM_STANDALONE) +#if defined(_MGRM_PROCESSES) && !defined(_MGRM_STANDALONE) if (mgIsServer) { zt_type |= ZOF_TYPE_GLOBAL; - } else + } else #endif { if (pWin->dwExStyle & WS_EX_TOPMOST) zt_type |= ZOF_TYPE_TOPMOST; - else if (pWin->WinType == TYPE_CONTROL && + else if (pWin->WinType == TYPE_CONTROL && (pWin->pMainWin->dwExStyle & WS_EX_TOPMOST)) zt_type |= ZOF_TYPE_TOPMOST; else @@ -1924,7 +1924,7 @@ static DWORD get_znode_flags_from_style (PMAINWIN pWin) return zt_type; } -static int AllocZOrderMaskRect (int cli, int idx_znode, +static int AllocZOrderMaskRect (int cli, int idx_znode, int flags, const RECT4MASK *rc, const int nr_rc) { MASKRECT *firstmaskrect; @@ -1932,7 +1932,7 @@ static int AllocZOrderMaskRect (int cli, int idx_znode, ZORDERINFO* zi = _get_zorder_info(cli); int free_slot, i, cur_idx, idx, old_num = 0; - if (idx_znode > (zi->max_nr_globals + if (idx_znode > (zi->max_nr_globals + zi->max_nr_topmosts + zi->max_nr_normals) || idx_znode <= 0) { return -1; @@ -1954,7 +1954,7 @@ static int AllocZOrderMaskRect (int cli, int idx_znode, if (nr_rc > old_num) { /* check the number of mask rect if enough */ - int idle = __mg_get_idle_slot((unsigned char*)GET_MASKRECT_USAGEBMP(zi), + int idle = __mg_get_idle_slot((unsigned char*)GET_MASKRECT_USAGEBMP(zi), zi->size_maskrect_usage_bmp); if (idle < nr_rc-old_num) { unlock_zi_for_change (zi); @@ -1965,13 +1965,13 @@ static int AllocZOrderMaskRect (int cli, int idx_znode, idx = nodes[idx_znode].idx_mask_rect; for(i = 0; i < nr_rc-old_num; i++) { free_slot = __mg_lookfor_unused_slot ( - (unsigned char*)GET_MASKRECT_USAGEBMP(zi), + (unsigned char*)GET_MASKRECT_USAGEBMP(zi), zi->size_maskrect_usage_bmp, 1); if (free_slot == -1) { unlock_zi_for_change (zi); return -1; } - + (firstmaskrect+free_slot)->next = idx; if (idx != 0) { (firstmaskrect+idx)->prev = free_slot; @@ -2010,7 +2010,7 @@ static int AllocZOrderMaskRect (int cli, int idx_znode, /* unlock zi for change ... */ unlock_zi_for_change (zi); - return 0; + return 0; } static int FreeZOrderMaskRect (int cli, int idx_znode) @@ -2018,7 +2018,7 @@ static int FreeZOrderMaskRect (int cli, int idx_znode) ZORDERINFO* zi = _get_zorder_info(cli); ZORDERNODE* nodes; - if (idx_znode > (zi->max_nr_globals + if (idx_znode > (zi->max_nr_globals + zi->max_nr_topmosts + zi->max_nr_normals) || idx_znode <= 0) { return -1; @@ -2066,7 +2066,7 @@ void dskRefreshAllClient (const RECT* invrc) #if defined(_MGRM_PROCESSES) && !defined(_MGRM_STANDALONE) if (mgIsServer) { ZORDERINFO* zi = _get_zorder_info (0); - SendMessage (HWND_DESKTOP, MSG_ERASEDESKTOP, 0, + SendMessage (HWND_DESKTOP, MSG_ERASEDESKTOP, 0, (LPARAM)(invrc)); lock_zi_for_read (zi); @@ -2110,7 +2110,7 @@ int dskSetTopForEver(int cli, int idx_znode, BOOL show) ZORDERINFO* zi = _get_zorder_info (cli); ZORDERNODE* nodes; - if (idx_znode > (zi->max_nr_globals + if (idx_znode > (zi->max_nr_globals + zi->max_nr_topmosts + zi->max_nr_normals) || idx_znode <= 0) { return -1; @@ -2127,7 +2127,7 @@ int dskSetTopForEver(int cli, int idx_znode, BOOL show) /* lock zi for change */ lock_zi_for_change (zi); - nodes[idx_znode].flags |= ZOF_TF_TOPFOREVER; + nodes[idx_znode].flags |= ZOF_TF_TOPFOREVER; /* unlock zi for change */ unlock_zi_for_change (zi); @@ -2149,7 +2149,7 @@ static int dskMove2Top (int cli, int idx_znode) int *first = NULL; ZORDERNODE* nodes; - if (idx_znode > (zi->max_nr_globals + if (idx_znode > (zi->max_nr_globals + zi->max_nr_topmosts + zi->max_nr_normals) || idx_znode <= 0) { return -1; @@ -2202,7 +2202,7 @@ static int dskMove2Top (int cli, int idx_znode) if (type == ZOF_TYPE_TOPMOST) { slot = zi->first_topmost; for (; slot != idx_znode; slot = nodes [slot].next) { - if (nodes [slot].flags & ZOF_VISIBLE && + if (nodes [slot].flags & ZOF_VISIBLE && DoesIntersect (&rc, &nodes [slot].rc)) { nodes [slot].age ++; AddClipRect (&sg_UpdateRgn, &nodes [slot].rc); @@ -2212,7 +2212,7 @@ static int dskMove2Top (int cli, int idx_znode) if (type == ZOF_TYPE_GLOBAL) { slot = zi->first_global; for (; slot != idx_znode; slot = nodes [slot].next) { - if (nodes [slot].flags & ZOF_VISIBLE && + if (nodes [slot].flags & ZOF_VISIBLE && DoesIntersect (&rc, &nodes [slot].rc)) { nodes [slot].age ++; AddClipRect (&sg_UpdateRgn, &nodes [slot].rc); @@ -2268,7 +2268,7 @@ static int dskMove2Top (int cli, int idx_znode) unlock_zi_for_change (zi); if ((nodes [idx_znode].flags & ZOF_VISIBLE) && nodes [idx_znode].fortestinghwnd) { - update_client_window_rgn (nodes [idx_znode].cli, + update_client_window_rgn (nodes [idx_znode].cli, nodes [idx_znode].fortestinghwnd); } @@ -2279,11 +2279,11 @@ static int dskMove2Top (int cli, int idx_znode) static int dskShowWindow (int cli, int idx_znode) { DWORD type; - ZORDERINFO* zi = _get_zorder_info(cli); + ZORDERINFO* zi = _get_zorder_info(cli); ZORDERNODE* nodes; int *first = NULL; - if (idx_znode > (zi->max_nr_globals + if (idx_znode > (zi->max_nr_globals + zi->max_nr_topmosts + zi->max_nr_normals) || idx_znode <= 0) { return -1; @@ -2295,7 +2295,7 @@ static int dskShowWindow (int cli, int idx_znode) #endif nodes = GET_ZORDERNODE(__mg_zorder_info); - + type = nodes [idx_znode].flags & ZOF_TYPE_MASK; switch (type) { case ZOF_TYPE_GLOBAL: @@ -2334,7 +2334,7 @@ static int dskShowWindow (int cli, int idx_znode) slot = nodes [idx_znode].next; for (; slot != 0; slot = nodes [slot].next) { - if (nodes [slot].flags & ZOF_VISIBLE && + if (nodes [slot].flags & ZOF_VISIBLE && DoesIntersect (&rc, &nodes [slot].rc)) { nodes [slot].age ++; } @@ -2360,7 +2360,7 @@ static int dskHideWindow (int cli, int idx_znode) int *first = NULL; ZORDERNODE* nodes; - if (idx_znode > zi->max_nr_globals + if (idx_znode > zi->max_nr_globals + zi->max_nr_topmosts + zi->max_nr_normals) { return -1; } @@ -2371,7 +2371,7 @@ static int dskHideWindow (int cli, int idx_znode) #endif nodes = GET_ZORDERNODE(zi); - + type = nodes [idx_znode].flags & ZOF_TYPE_MASK; switch (type) { case ZOF_TYPE_GLOBAL: @@ -2400,7 +2400,7 @@ static int dskHideWindow (int cli, int idx_znode) slot = nodes [idx_znode].next; for (; slot > 0; slot = nodes [slot].next) { - if (nodes [slot].flags & ZOF_VISIBLE && + if (nodes [slot].flags & ZOF_VISIBLE && subtract_rgn_by_node(&sg_UpdateRgn, zi, &nodes[slot])) { nodes [slot].age ++; nodes [slot].flags |= ZOF_REFERENCE; @@ -2420,11 +2420,11 @@ static int dskHideWindow (int cli, int idx_znode) if (idx_znode && (nodes [idx_znode].flags & ZOF_TF_MAINWIN && (nodes [idx_znode].flags & ZOF_VISIBLE))) { - post_msg_by_znode_p (zi, nodes + idx_znode, + post_msg_by_znode_p (zi, nodes + idx_znode, MSG_NCACTIVATE, FALSE, 0); - post_msg_by_znode_p (zi, nodes + idx_znode, + post_msg_by_znode_p (zi, nodes + idx_znode, MSG_ACTIVE, FALSE, 0); - post_msg_by_znode_p (zi, nodes + idx_znode, + post_msg_by_znode_p (zi, nodes + idx_znode, MSG_KILLFOCUS, 0, 0); } @@ -2441,7 +2441,7 @@ static int dskHideWindow (int cli, int idx_znode) do_for_all_znodes (&nodes [idx_znode].rc, zi, _cb_update_znode, ZT_ALL); if (nodes [0].flags & ZOF_REFERENCE) { - SendMessage (HWND_DESKTOP, + SendMessage (HWND_DESKTOP, MSG_ERASEDESKTOP, 0, (WPARAM)&nodes [idx_znode].rc); nodes [0].flags &= ~ZOF_REFERENCE; } @@ -2456,12 +2456,12 @@ static int dskMoveWindow (int cli, int idx_znode, const RECT* rcWin) ZORDERNODE* nodes; RECT rcInv[4], rcOld, rcInter, tmprc; int i, slot, nInvCount; - unsigned short idx; + unsigned short idx; CLIPRGN bblt_rgn; MASKRECT *firstmaskrect, *maskrect; ZORDERINFO* zi = _get_zorder_info(cli); - - if (idx_znode > (zi->max_nr_globals + + if (idx_znode > (zi->max_nr_globals + zi->max_nr_topmosts + zi->max_nr_normals) || idx_znode < 0) { return -1; @@ -2490,10 +2490,10 @@ static int dskMoveWindow (int cli, int idx_znode, const RECT* rcWin) if (memcmp (&nodes [idx_znode].rc, rcWin, sizeof (RECT)) == 0) return 0; - if ( (RECTW(nodes[idx_znode].rc) != RECTWP(rcWin) || - RECTH(nodes[idx_znode].rc) != RECTHP(rcWin)) && - (nodes[idx_znode].flags & ZOF_TW_TROUNDCNS || - nodes[idx_znode].flags & ZOF_TW_BROUNDCNS) ) + if ( (RECTW(nodes[idx_znode].rc) != RECTWP(rcWin) || + RECTH(nodes[idx_znode].rc) != RECTHP(rcWin)) && + (nodes[idx_znode].flags & ZOF_TW_TROUNDCNS || + nodes[idx_znode].flags & ZOF_TW_BROUNDCNS) ) { RECT cli_rect; SetRect(&cli_rect, 0, 0, RECTWP(rcWin), RECTHP(rcWin)); @@ -2502,7 +2502,7 @@ static int dskMoveWindow (int cli, int idx_znode, const RECT* rcWin) if (nodes[idx_znode].idx_mask_rect != 0) { - idx = nodes[idx_znode].idx_mask_rect; + idx = nodes[idx_znode].idx_mask_rect; firstmaskrect = GET_MASKRECT(zi); while (idx) { @@ -2511,7 +2511,7 @@ static int dskMoveWindow (int cli, int idx_znode, const RECT* rcWin) } } - CreateNodeRoundMaskRect (zi, &nodes[idx_znode], + CreateNodeRoundMaskRect (zi, &nodes[idx_znode], nodes[idx_znode].flags, &cli_rect); unlock_zi_for_change(zi); @@ -2538,7 +2538,7 @@ static int dskMoveWindow (int cli, int idx_znode, const RECT* rcWin) slot = nodes [idx_znode].next; for (; slot != 0; slot = nodes [slot].next) { - if (nodes [slot].flags & ZOF_VISIBLE && + if (nodes [slot].flags & ZOF_VISIBLE && DoesIntersect (rcWin, &nodes [slot].rc)) { nodes [slot].age ++; } @@ -2555,7 +2555,7 @@ static int dskMoveWindow (int cli, int idx_znode, const RECT* rcWin) slot = nodes [idx_znode].next; for (; slot > 0; slot = nodes [slot].next) { - if (nodes [slot].flags & ZOF_VISIBLE && + if (nodes [slot].flags & ZOF_VISIBLE && !(nodes [slot].flags & ZOF_REFERENCE) && subtract_rgn_by_node(&sg_UpdateRgn, zi, &nodes[slot])) { nodes [slot].age ++; @@ -2566,7 +2566,7 @@ static int dskMoveWindow (int cli, int idx_znode, const RECT* rcWin) if (type > ZOF_TYPE_TOPMOST) { slot = zi->first_topmost; for (; slot > 0; slot = nodes [slot].next) { - if (nodes [slot].flags & ZOF_VISIBLE && + if (nodes [slot].flags & ZOF_VISIBLE && !(nodes [slot].flags & ZOF_REFERENCE) && subtract_rgn_by_node(&sg_UpdateRgn, zi, &nodes[slot])) { nodes [slot].age ++; @@ -2578,7 +2578,7 @@ static int dskMoveWindow (int cli, int idx_znode, const RECT* rcWin) if (type > ZOF_TYPE_NORMAL) { slot = zi->first_normal; for (; slot > 0; slot = nodes [slot].next) { - if (nodes [slot].flags & ZOF_VISIBLE && + if (nodes [slot].flags & ZOF_VISIBLE && !(nodes [slot].flags & ZOF_REFERENCE) && subtract_rgn_by_node(&sg_UpdateRgn, zi, &nodes[slot])) { nodes [slot].age ++; @@ -2611,9 +2611,9 @@ static int dskMoveWindow (int cli, int idx_znode, const RECT* rcWin) while (idx) { maskrect = firstmaskrect + idx; - SetRect (&tmprc, rcWin->left + maskrect->left, - rcWin->top + maskrect->top, - rcWin->left + maskrect->right, + SetRect (&tmprc, rcWin->left + maskrect->left, + rcWin->top + maskrect->top, + rcWin->left + maskrect->right, rcWin->top + maskrect->bottom); if ( DoesIntersect (&tmprc, &g_rcScr)) { IntersectRect (&tmprc, &tmprc, &g_rcScr); @@ -2623,18 +2623,18 @@ static int dskMoveWindow (int cli, int idx_znode, const RECT* rcWin) } SelectClipRegion(HDC_SCREEN_SYS, &bblt_rgn); } - + slot = 0; switch (type) { case ZOF_TYPE_NORMAL: - do_for_all_znodes (NULL, zi, + do_for_all_znodes (NULL, zi, _cb_exclude_rc, ZT_GLOBAL); - do_for_all_znodes (NULL, zi, + do_for_all_znodes (NULL, zi, _cb_exclude_rc, ZT_TOPMOST); slot = zi->first_normal; break; case ZOF_TYPE_TOPMOST: - do_for_all_znodes (NULL, zi, + do_for_all_znodes (NULL, zi, _cb_exclude_rc, ZT_GLOBAL); slot = zi->first_topmost; break; @@ -2642,7 +2642,7 @@ static int dskMoveWindow (int cli, int idx_znode, const RECT* rcWin) slot = zi->first_global; break; case ZOF_TYPE_DESKTOP: - do_for_all_znodes (NULL, zi, + do_for_all_znodes (NULL, zi, _cb_exclude_rc, ZT_ALL); break; default: @@ -2669,9 +2669,9 @@ static int dskMoveWindow (int cli, int idx_znode, const RECT* rcWin) idx = nodes [slot].idx_mask_rect; while (idx) { maskrect = firstmaskrect + idx; - SetRect (&tmprc, rc.left + maskrect->left, - rc.top + maskrect->top, - rc.left + maskrect->right, + SetRect (&tmprc, rc.left + maskrect->left, + rc.top + maskrect->top, + rc.left + maskrect->right, rc.top + maskrect->bottom); if ( DoesIntersect (&tmprc, &g_rcScr)) { IntersectRect (&tmprc, &tmprc, &g_rcScr); @@ -2683,11 +2683,11 @@ static int dskMoveWindow (int cli, int idx_znode, const RECT* rcWin) } slot = nodes [slot].next; } - BitBlt (HDC_SCREEN_SYS, rcOld.left, rcOld.top, - MIN (RECTWP (rcWin), RECTW (rcOld)), + BitBlt (HDC_SCREEN_SYS, rcOld.left, rcOld.top, + MIN (RECTWP (rcWin), RECTW (rcOld)), MIN (RECTHP (rcWin), RECTH (rcOld)), HDC_SCREEN_SYS, rcWin->left, rcWin->top, 0); - + /* Restore the clip region of HDC_SCREEN_SYS */ SelectClipRect (HDC_SCREEN_SYS, &g_rcScr); EmptyClipRgn(&bblt_rgn); @@ -2708,7 +2708,7 @@ static int dskMoveWindow (int cli, int idx_znode, const RECT* rcWin) if (type < ZOF_TYPE_GLOBAL) { slot = zi->first_global; for (; slot > 0; slot = nodes [slot].next) { - if (nodes [slot].flags & ZOF_VISIBLE && + if (nodes [slot].flags & ZOF_VISIBLE && IntersectRect (&rcInter, &rcOld, &nodes [slot].rc)) AddClipRect(&sg_UpdateRgn, &rcInter); } @@ -2717,7 +2717,7 @@ static int dskMoveWindow (int cli, int idx_znode, const RECT* rcWin) if (type < ZOF_TYPE_TOPMOST) { slot = zi->first_topmost; for (; slot > 0; slot = nodes [slot].next) { - if (nodes [slot].flags & ZOF_VISIBLE && + if (nodes [slot].flags & ZOF_VISIBLE && IntersectRect (&rcInter, &rcOld, &nodes [slot].rc)) AddClipRect(&sg_UpdateRgn, &rcInter); } @@ -2725,23 +2725,23 @@ static int dskMoveWindow (int cli, int idx_znode, const RECT* rcWin) slot = *first; for (; slot != idx_znode; slot = nodes [slot].next) { - if (nodes [slot].flags & ZOF_VISIBLE && + if (nodes [slot].flags & ZOF_VISIBLE && IntersectRect (&rcInter, &rcOld, &nodes [slot].rc)) AddClipRect(&sg_UpdateRgn, &rcInter); } do_for_all_znodes (&rcOld, zi, _cb_update_znode, ZT_ALL); if (nodes [0].flags & ZOF_REFERENCE) { - SendMessage (HWND_DESKTOP, - MSG_ERASEDESKTOP, 0, (LPARAM)&rcOld); + SendMessage (HWND_DESKTOP, + MSG_ERASEDESKTOP, 0, (LPARAM)&rcOld); nodes [0].flags &= ~ZOF_REFERENCE; } - OffsetRegion (&sg_UpdateRgn, - rcWin->left - rcOld.left, + OffsetRegion (&sg_UpdateRgn, + rcWin->left - rcOld.left, rcWin->top - rcOld.top); - update_client_window_rgn (nodes [idx_znode].cli, + update_client_window_rgn (nodes [idx_znode].cli, nodes [idx_znode].fortestinghwnd); } else { @@ -2761,14 +2761,14 @@ static int dskEnableZOrderNode (int cli, int idx_znode, int flags) ZORDERINFO* zi = _get_zorder_info(cli); ZORDERNODE* nodes; - if (idx_znode > (zi->max_nr_globals + if (idx_znode > (zi->max_nr_globals + zi->max_nr_topmosts + zi->max_nr_normals) || idx_znode < 0) { return -1; } nodes = GET_ZORDERNODE(zi); - + /* lock zi for change */ lock_zi_for_change (zi); @@ -2784,12 +2784,12 @@ static int dskEnableZOrderNode (int cli, int idx_znode, int flags) } /*======================== customize desktop =========================*/ -static void +static void def_paint_desktop (void* context, HDC dc_desktop, const RECT* inv_rc) { PBITMAP bg_bmp = NULL; int pic_x = 0, pic_y = 0; - + if(context) { bg_bmp = ((DEF_CONTEXT *)context)->bg; @@ -2797,12 +2797,12 @@ def_paint_desktop (void* context, HDC dc_desktop, const RECT* inv_rc) pic_y = ((DEF_CONTEXT *)context)->y; } - SetBrushColor (dc_desktop, + SetBrushColor (dc_desktop, GetWindowElementPixel (HWND_DESKTOP, WE_BGC_DESKTOP)); if (inv_rc) { SelectClipRect (dc_desktop, inv_rc); - FillBox (dc_desktop, inv_rc->left, inv_rc->top, + FillBox (dc_desktop, inv_rc->left, inv_rc->top, RECTWP (inv_rc), RECTHP (inv_rc)); } else { @@ -2819,8 +2819,8 @@ def_paint_desktop (void* context, HDC dc_desktop, const RECT* inv_rc) } -static void def_keyboard_handler(void* context, int message, - WPARAM wParam, LPARAM lParam) +static void def_keyboard_handler(void* context, int message, + WPARAM wParam, LPARAM lParam) { switch(message) { @@ -2852,8 +2852,8 @@ static void def_customize_desktop_menu (void* context, HMENU hmnu, int start_pos #endif } -static void def_mouse_handler(void* context, int message, - WPARAM wParam, LPARAM lParam) +static void def_mouse_handler(void* context, int message, + WPARAM wParam, LPARAM lParam) { #ifdef _MGHAVE_MENU int x, y; @@ -2865,17 +2865,17 @@ static void def_mouse_handler(void* context, int message, case MSG_DT_MOUSEMOVE: case MSG_DT_RBUTTONDOWN: case MSG_DT_RBUTTONDBLCLK: - break; + break; case MSG_DT_RBUTTONUP: - { - x = LOSWORD (lParam); - y = HISWORD (lParam); + { + x = LOSWORD (lParam); + y = HISWORD (lParam); - TrackPopupMenu (sg_DesktopMenu, TPM_DEFAULT, x, y, HWND_DESKTOP); + TrackPopupMenu (sg_DesktopMenu, TPM_DEFAULT, x, y, HWND_DESKTOP); - break; - } + break; + } } #endif } @@ -2895,14 +2895,14 @@ static void def_desktop_menucmd_handler (void* context, int id) static void def_deinit(void* context) { - if(context) { - if (((DEF_CONTEXT *)context)->bg) - UnloadBitmap (((DEF_CONTEXT *)context)->bg); + if(context) { + if (((DEF_CONTEXT *)context)->bg) + UnloadBitmap (((DEF_CONTEXT *)context)->bg); #if defined(_MGRM_THREADS) || defined(_MGRM_STANDALONE) - free(context); + free(context); #endif - } + } return; } @@ -2911,7 +2911,7 @@ static int dskGetBgPicturePos (void) { char szValue [21]; - if(GetMgEtcValue (__mg_def_renderer->name, + if(GetMgEtcValue (__mg_def_renderer->name, SYSBMP_BGPICPOS, szValue, 20) < 0) { strcpy (szValue, "center"); } @@ -2942,7 +2942,7 @@ static int dskGetBgPicturePos (void) static PBITMAP dskLoadBgPicture (void) { - return (PBITMAP)GetSystemBitmapEx (__mg_def_renderer->name, + return (PBITMAP)GetSystemBitmapEx (__mg_def_renderer->name, SYSBMP_BGPICTURE); } @@ -3012,7 +3012,7 @@ static void* def_init(void) bg_bmp = dskLoadBgPicture (); if (bg_bmp) - dskGetBgPictureXY (pos, + dskGetBgPictureXY (pos, bg_bmp->bmWidth, bg_bmp->bmHeight, &pic_x, &pic_y); con->bg = bg_bmp; @@ -3038,29 +3038,29 @@ static void *dt_context; DESKTOPOPS* GUIAPI SetCustomDesktopOperationSet (DESKTOPOPS* usr_dsk_ops) { - DESKTOPOPS *tmp_ops = NULL; - + DESKTOPOPS *tmp_ops = NULL; + if (usr_dsk_ops == NULL) { - return dsk_ops; - } + return dsk_ops; + } - if (dsk_ops->deinit) { - dsk_ops->deinit(dt_context); - } + if (dsk_ops->deinit) { + dsk_ops->deinit(dt_context); + } - if (usr_dsk_ops->init) { - dt_context = usr_dsk_ops->init(); - } + if (usr_dsk_ops->init) { + dt_context = usr_dsk_ops->init(); + } - tmp_ops = dsk_ops; - dsk_ops = usr_dsk_ops; + tmp_ops = dsk_ops; + dsk_ops = usr_dsk_ops; SendMessage(HWND_DESKTOP, MSG_ERASEDESKTOP, 0, 0); return tmp_ops; } -static BOOL _cb_bcast_msg (void* context, +static BOOL _cb_bcast_msg (void* context, const ZORDERINFO* zi, ZORDERNODE* node) { PMAINWIN pWin; @@ -3206,12 +3206,12 @@ void GUIAPI DumpWindow (FILE* fp, HWND hWnd) } if (pWin->WinType == TYPE_MAINWIN) { - fprintf (fp, "=============== Main Window %#x==================\n", + fprintf (fp, "=============== Main Window %#x==================\n", hWnd); - fprintf (fp, "Rect -- (%d, %d, %d, %d)\n", + fprintf (fp, "Rect -- (%d, %d, %d, %d)\n", pWin->left, pWin->top, pWin->right, pWin->bottom); - fprintf (fp, "Client -- (%d, %d, %d, %d)\n", + fprintf (fp, "Client -- (%d, %d, %d, %d)\n", pWin->cl, pWin->ct, pWin->cr, pWin->cb); fprintf (fp, "Style -- %lx\n", pWin->dwStyle); @@ -3230,7 +3230,7 @@ void GUIAPI DumpWindow (FILE* fp, HWND hWnd) fprintf (fp, "FirstChild -- %#x\n", pWin->hFirstChild); pCtrl = (PCONTROL)pWin->hFirstChild; while (pCtrl) { - fprintf (fp, " Child -- %p(%d), %s(%d)\n", pCtrl, pCtrl->id, + fprintf (fp, " Child -- %p(%d), %s(%d)\n", pCtrl, pCtrl->id, pCtrl->pcci->name, pCtrl->pcci->nUseCount); pCtrl = pCtrl->next; } @@ -3251,9 +3251,9 @@ void GUIAPI DumpWindow (FILE* fp, HWND hWnd) fprintf (fp, "=============== Control %#x==================\n", hWnd); pCtrl = (PCONTROL)hWnd; - fprintf (fp, "Rect -- (%d, %d, %d, %d)\n", + fprintf (fp, "Rect -- (%d, %d, %d, %d)\n", pCtrl->left, pCtrl->top, pCtrl->right, pCtrl->bottom); - fprintf (fp, "Client -- (%d, %d, %d, %d)\n", + fprintf (fp, "Client -- (%d, %d, %d, %d)\n", pCtrl->cl, pCtrl->ct, pCtrl->cr, pCtrl->cb); fprintf (fp, "Style -- %lx\n", pCtrl->dwStyle); @@ -3276,14 +3276,14 @@ void GUIAPI DumpWindow (FILE* fp, HWND hWnd) pCtrl = (PCONTROL)pCtrl->children; while (pCtrl) { - fprintf (fp, " Child -- %p(%d), %s(%d)\n", pCtrl, pCtrl->id, + fprintf (fp, " Child -- %p(%d), %s(%d)\n", pCtrl, pCtrl->id, pCtrl->pcci->name, pCtrl->pcci->nUseCount); pCtrl = pCtrl->next; } } fprintf (fp, "=================== End ==================\n"); - return; + return; } #endif /* _DEBUG */ @@ -3302,7 +3302,7 @@ int kernel_get_window_region (HWND pWin, CLIPRGN* region) #endif idx_znode = ((PMAINWIN)pWin)->idx_znode; - if (idx_znode > (zi->max_nr_globals + if (idx_znode > (zi->max_nr_globals + zi->max_nr_topmosts + zi->max_nr_normals) || idx_znode <= 0) { return -1;