diff --git a/CMakeLists.txt b/CMakeLists.txt index cbfb9fe3..f2533500 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ add_definitions (-D_GNU_SOURCE) # the version number. set (MINIGUI_MAJOR_VERSION 3) set (MINIGUI_MINOR_VERSION 2) -set (MINIGUI_MICRO_VERSION 1) +set (MINIGUI_MICRO_VERSION 2) set (MINIGUI_NAME "minigui") set (MGLIB_SUFFIX "") diff --git a/ChangeLog b/ChangeLog index 91517d0b..4931d776 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ ******************************************************************************* -What's new in trunk: +What's new (V3.2.2): +10/24-2017 +CLEANUP: Remove some 'inline' definitions: + * GetIMEPos/SetIMEPos. + * WndRect -> gui_WndRect. + * WndClientRect -> gui_WndClientRect. + +******************************************************************************* +What's new (V3.2.1): 12/06. CLEANUP #11: Merge differences from rel-3-0, and remove unnecessary files. svn merge -r 12913:13673 ../branches/rel-3-0 (wanzheng) @@ -18,7 +26,6 @@ rel-3.0(dongjunjie) * src/textedit/mtextedit.c * src/textedit/mtextedit.h - 06/30. BUGFIXING: #4801 Fix a bug which introduce a absolute path check error in Windows (dongkai). * src/font/devfont.c diff --git a/Version b/Version index 977b618f..0c38ba67 100644 --- a/Version +++ b/Version @@ -1,4 +1,4 @@ -Version 3.2.1 (the developing version of the official version 3.2) +Version 3.2.2 (the official release) This release needs the following resource packages: diff --git a/configure.in b/configure.in index ea1af3a3..7e41b884 100644 --- a/configure.in +++ b/configure.in @@ -3,7 +3,7 @@ AC_PREREQ(2.52) dnl ======================================================================== dnl Put the name and version of the package here -AC_INIT([libminigui], [3.2.1]) +AC_INIT([libminigui], [3.2.2]) AC_CONFIG_SRCDIR([src/main/main.c]) dnl Set various version strings - taken gratefully from the SDL sources diff --git a/include/window.h b/include/window.h index 2f56af8b..940294ea 100644 --- a/include/window.h +++ b/include/window.h @@ -7815,22 +7815,6 @@ MG_EXPORT int GUIAPI SetIMEStatus (int StatusCode, int Value); */ MG_EXPORT int GUIAPI GetIMETargetInfo (IME_TARGET_INFO *info); -/** - * \fn int GUIAPI GetIMEPos (POINT* pt) - * \brief Retrives the position of the current IME window. - * - * This function retrives the position of the current IME window. - * - * \param pt The item to be retrived. The positon is - * return by the current IME Window. - * - * \return The current IME window positon. - * ERR_IME_NOIMEWND if error occurred. - * - * \sa GetIMEPos - */ -MG_EXPORT inline int GUIAPI GetIMEPos (POINT* pt); - /** * \fn int GUIAPI SetIMETargetInfo (const IME_TARGET_INFO *info) * \brief Sets the target info of the current IME window. @@ -7849,9 +7833,29 @@ MG_EXPORT inline int GUIAPI GetIMEPos (POINT* pt); MG_EXPORT int GUIAPI SetIMETargetInfo (const IME_TARGET_INFO *info); /** - * \fn inline int GUIAPI SetIMEPos (POINT* pt) + * \fn int GUIAPI GetIMEPos (POINT* pt) + * \brief Retrives the position of the current IME window. + * + * NOTE that this function is deprecated. + * + * This function retrives the position of the current IME window. + * + * \param pt The item to be retrived. The positon is + * return by the current IME Window. + * + * \return The current IME window positon. + * ERR_IME_NOIMEWND if error occurred. + * + * \sa GetIMEPos + */ +MG_EXPORT int GUIAPI GetIMEPos (POINT* pt); + +/** + * \fn int GUIAPI SetIMEPos (POINT* pt) * \brief Sets the position of the current IME window. * + * NOTE that this function is deprecated. + * * This function sets the position of the current IME window. * * \param pt The set position value. @@ -7863,7 +7867,7 @@ MG_EXPORT int GUIAPI SetIMETargetInfo (const IME_TARGET_INFO *info); * * \sa SetIMEPos */ -MG_EXPORT inline int GUIAPI SetIMEPos(const POINT* pt); +MG_EXPORT int GUIAPI SetIMEPos (const POINT* pt); /** @} end of ime_fns */ diff --git a/src/gui/window.c b/src/gui/window.c index 972f995d..db641845 100644 --- a/src/gui/window.c +++ b/src/gui/window.c @@ -3,10 +3,10 @@ ** ** window.c: The Window module. ** - ** Copyright (C) 2003 ~ 2008 Feynman Software. + ** Copyright (C) 2003 ~ 2017 FMSoft. ** Copyright (C) 1999 ~ 2002 Wei Yongming. ** - ** All rights reserved by Feynman Software. + ** All rights reserved. ** ** Current maintainer: Wei Yongming. ** @@ -230,7 +230,7 @@ HWND GUIAPI GetWindowUnderCursor (void) HWND GUIAPI WindowFromPointEx (POINT pt, BOOL bRecursion) { - HWND hChild; + HWND hChild; HWND hParent = (HWND)gui_GetMainWindowPtrUnderPoint (pt.x, pt.y); if (hParent && bRecursion) { @@ -250,8 +250,8 @@ HWND GUIAPI WindowFromPointEx (POINT pt, BOOL bRecursion) return IsWindow(hChild)?hChild:hParent; } - else - return hParent; + else + return hParent; return HWND_NULL; } @@ -348,7 +348,8 @@ static int DefaultDTMouseMsgHandler (PMAINWIN pWin, int message, int cx, cy; PCONTROL pCtrl = NULL; - if(pWin->dwStyle & WS_DISABLED) return 0; + if (pWin->dwStyle & WS_DISABLED) + return 0; cx = x - pWin->cl; cy = y - pWin->ct; @@ -652,10 +653,10 @@ void update_secondary_dc (PMAINWIN pWin, HDC secondary_dc, /* calculate offset postion. */ if (flags == HT_CLIENT){ - WndClientRect ((HWND)pWin, &wnd_rc); + gui_WndClientRect ((HWND)pWin, &wnd_rc); } else { - WndRect ((HWND)pWin, &wnd_rc); + gui_WndRect ((HWND)pWin, &wnd_rc); } /* 1. clip_rc.left/clip_rc.top is real_rc update in the screen (coordinate relative @@ -692,7 +693,7 @@ void update_secondary_dc (PMAINWIN pWin, HDC secondary_dc, if ((child->dwStyle & WS_VISIBLE) && DoesIntersect ((const RECT*)&child->left, &rc)) { RECT rcTmp; - WndClientRect ((HWND)child, &rcTmp); + gui_WndClientRect ((HWND)child, &rcTmp); ScreenToClient ((HWND)pWin->pMainWin, &rcTmp.left, &rcTmp.top); ScreenToClient ((HWND)pWin->pMainWin, @@ -1992,6 +1993,62 @@ static int HittestOnNClient (PMAINWIN pWin, int x, int y) return info->we_rdr->hit_test ((HWND)pWin, x, y); } + +/************************** internal functions *********************************/ +void gui_WndRect(HWND hWnd, PRECT prc) +{ + PCONTROL pParent; + PCONTROL pCtrl; + + pParent = pCtrl = (PCONTROL) hWnd; + + if (hWnd == HWND_DESKTOP) { + *prc = g_rcScr; + return; + } + + prc->left = pCtrl->left; + prc->top = pCtrl->top; + prc->right = pCtrl->right; + prc->bottom = pCtrl->bottom; + + /* dongjunjie 2009/7/9 main window and control as main window + * don't need offset + * */ + if (pCtrl->WinType == TYPE_MAINWIN ) + return ; + + while ((pParent = pParent->pParent)) { + prc->left += pParent->cl; + prc->top += pParent->ct; + prc->right += pParent->cl; + prc->bottom += pParent->ct; + } +} + +void gui_WndClientRect(HWND hWnd, PRECT prc) +{ + PCONTROL pCtrl; + PCONTROL pParent; + pParent = pCtrl = (PCONTROL) hWnd; + + if (hWnd == HWND_DESKTOP) { + *prc = g_rcScr; + return; + } + + prc->left = pCtrl->cl; + prc->top = pCtrl->ct; + prc->right = pCtrl->cr; + prc->bottom = pCtrl->cb; + while ((pParent = pParent->pParent)) { + prc->left += pParent->cl; + prc->top += pParent->ct; + prc->right += pParent->cl; + prc->bottom += pParent->ct; + } +} + extern HWND __mg_ime_wnd; void gui_open_ime_window (PMAINWIN pWin, BOOL open_close, HWND rev_hwnd) { @@ -2089,27 +2146,26 @@ static int DefaultPostMsgHandler(PMAINWIN pWin, int message, break; case MSG_HITTEST: - if (PtInRect((PRECT)(&(pWin->cl)), (int)wParam, (int)lParam) ) + if (PtInRect((PRECT)(&(pWin->cl)), (int)wParam, (int)lParam)) return HT_CLIENT; - else - { - CONTROL * pCtrl; - if(pWin->WinType == TYPE_MAINWIN && ( pCtrl= (CONTROL*)(pWin->hFirstChildAsMainWin)) != NULL){ - int x = (int)wParam; - int y = (int)lParam; - ScreenToClient((HWND)pCtrl->pParent,&x,&y); + else { + CONTROL * pCtrl; + if(pWin->WinType == TYPE_MAINWIN && ( pCtrl= (CONTROL*)(pWin->hFirstChildAsMainWin)) != NULL){ + int x = (int)wParam; + int y = (int)lParam; + ScreenToClient((HWND)pCtrl->pParent,&x,&y); - while(pCtrl){ - if((pCtrl->dwStyle&WS_VISIBLE) && PtInRect((PRECT)&(pCtrl->cl),x, y)) - { - return HT_CLIENT; - } - pCtrl = pCtrl->next_ctrl_as_main; - } - } + while(pCtrl){ + if((pCtrl->dwStyle&WS_VISIBLE) && PtInRect((PRECT)&(pCtrl->cl),x, y)) + { + return HT_CLIENT; + } + pCtrl = pCtrl->next_ctrl_as_main; + } + } return HittestOnNClient (pWin, (int)wParam, (int)lParam); - } + } break; case MSG_CHANGESIZE: @@ -2265,11 +2321,11 @@ static void wndDrawNCFrame(MAINWIN* pWin, HDC hdc, const RECT* prcInvalid) rdr->draw_caption_button ((HWND)pWin, hdc, 0, LFRDR_BTN_STATUS_NORMAL); else rdr->draw_caption_button ((HWND)pWin, hdc, 0, LFRDR_BTN_STATUS_INACTIVE); - - /*dongjunjie 09/07/09 - * If Border is Zero, but MainWindow style have caption - * we should notify the secondaryDC - * */ + + /*dongjunjie 09/07/09 + * If Border is Zero, but MainWindow style have caption + * we should notify the secondaryDC + * */ if (pWin->pMainWin->secondaryDC) { draw_secondary_nc_area (pWin, rdr, hdc, HT_CAPTION); } @@ -2918,49 +2974,49 @@ UPDATERGIN: /* FIXME: we use the invalid region of the window as the update region directly. */ if (pRgnUpdate) { /* copy from window's invalidate region */ - RECT rcClient; - RECT rc; + RECT rcClient; + RECT rc; CopyRegion (pRgnUpdate, &pWin->InvRgn.rgn); - /* FIXME: I have not the best idea to do this */ - GetClientRect(hWnd, &rcClient); - rc = rcClient; - if(dx > 0) - rc.right = rc.left + dx + 1; - else if(dx < 0) - rc.left = rc.right + dx - 1; - if(dx != 0) - AddClipRect(pRgnUpdate, &rc); - rc = rcClient; - if(dy > 0) - rc.bottom = rc.top + dy + 1; - else if(dy < 0) - rc.top = rc.bottom + dy - 1; - if(dy != 0) - AddClipRect(pRgnUpdate, &rc); + /* FIXME: I have not the best idea to do this */ + GetClientRect(hWnd, &rcClient); + rc = rcClient; + if(dx > 0) + rc.right = rc.left + dx + 1; + else if(dx < 0) + rc.left = rc.right + dx - 1; + if(dx != 0) + AddClipRect(pRgnUpdate, &rc); + rc = rcClient; + if(dy > 0) + rc.bottom = rc.top + dy + 1; + else if(dy < 0) + rc.top = rc.bottom + dy - 1; + if(dy != 0) + AddClipRect(pRgnUpdate, &rc); } if (prcUpdate) { - if(pRgnUpdate) - *prcUpdate = pRgnUpdate->rcBound; - else if(dx != 0 && dy != 0) - GetClientRect(hWnd, prcUpdate); - else if(dx != 0) - { - GetClientRect(hWnd, prcUpdate); - if(dx > 0) - prcUpdate->right = prcUpdate->left + dx + 1; - else - prcUpdate->left = prcUpdate->right + dx - 1; - } - else if(dy != 0) - { - GetClientRect(hWnd, prcUpdate); - if(dy > 0) - prcUpdate->bottom = prcUpdate->top + dx + 1; - else - prcUpdate->top = prcUpdate->bottom + dx - 1; - } - else - *prcUpdate = pWin->InvRgn.rgn.rcBound; + if(pRgnUpdate) + *prcUpdate = pRgnUpdate->rcBound; + else if(dx != 0 && dy != 0) + GetClientRect(hWnd, prcUpdate); + else if(dx != 0) + { + GetClientRect(hWnd, prcUpdate); + if(dx > 0) + prcUpdate->right = prcUpdate->left + dx + 1; + else + prcUpdate->left = prcUpdate->right + dx - 1; + } + else if(dy != 0) + { + GetClientRect(hWnd, prcUpdate); + if(dy > 0) + prcUpdate->bottom = prcUpdate->top + dx + 1; + else + prcUpdate->top = prcUpdate->bottom + dx - 1; + } + else + *prcUpdate = pWin->InvRgn.rgn.rcBound; } return pWin->InvRgn.rgn.type; @@ -3319,13 +3375,13 @@ BOOL GUIAPI ShowScrollBar (HWND hWnd, int iSBar, BOOL bShow) return FALSE; } - //TO AVOID THE DEAD LOOP - if (!bPrevState - && ((pSBar->minPos == pSBar->maxPos) - || (pSBar->pageStep >= (pSBar->maxPos - pSBar->minPos)))) - { - return FALSE; - } + //TO AVOID THE DEAD LOOP + if (!bPrevState + && ((pSBar->minPos == pSBar->maxPos) + || (pSBar->pageStep >= (pSBar->maxPos - pSBar->minPos)))) + { + return FALSE; + } if (iSBar == SB_VERT) wndGetVScrollBarRect (pWin, &rcBar); @@ -3338,15 +3394,15 @@ BOOL GUIAPI ShowScrollBar (HWND hWnd, int iSBar, BOOL bShow) else pSBar->status |= SBS_HIDE; - //Hear , MSG_CHANGESIZE would call OnChangeSize - //OnChangeSize May be modify pSBar->status as 100 - //( pSBar->status|=SBS_HIDE), when - // pSBar's pageStep >= max -min - // And Then, RecalcClientArea would be called, - // RecalcClientArea will send MSG_CHANGESIZE, - // In some controls, it will process MSG_CHANGESIZE - // and call ShowScrollBar too. - // Becareful the MSG_CHANGESIZE !!! + //Hear , MSG_CHANGESIZE would call OnChangeSize + //OnChangeSize May be modify pSBar->status as 100 + //( pSBar->status|=SBS_HIDE), when + // pSBar's pageStep >= max -min + // And Then, RecalcClientArea would be called, + // RecalcClientArea will send MSG_CHANGESIZE, + // In some controls, it will process MSG_CHANGESIZE + // and call ShowScrollBar too. + // Becareful the MSG_CHANGESIZE !!! SendAsyncMessage (hWnd, MSG_CHANGESIZE, 0, 0); /* houhh 20081006, pSbar->status |= SBS_HIDE, Get rcBar is error. @@ -3835,17 +3891,17 @@ void GUIAPI UpdateWindow (HWND hWnd, BOOL fErase) #if 0 #if 0 - MSG Msg; - HWND hMainWnd; + MSG Msg; + HWND hMainWnd; - /* MSG_PAINT Must Use PostMessage. Becuse Only PostMessage can give a correct order - * when processing MSG_PAINT message - * - * the Order of MSG_PAINT: - * * The Parent Window Must Be Painted before Children - * * The Previously created window must be Painted before afterwards created - * - * */ + /* MSG_PAINT Must Use PostMessage. Becuse Only PostMessage can give a correct order + * when processing MSG_PAINT message + * + * the Order of MSG_PAINT: + * * The Parent Window Must Be Painted before Children + * * The Previously created window must be Painted before afterwards created + * + * */ if (hWnd != HWND_DESKTOP) { PMAINWIN pWin; @@ -3856,12 +3912,12 @@ void GUIAPI UpdateWindow (HWND hWnd, BOOL fErase) SendMessage (hWnd, MSG_PAINT, 0, 0); #else - hMainWnd = GetMainWindowHandle(hWnd); - while(PeekMessageEx(&Msg, hMainWnd, MSG_PAINT, MSG_PAINT + 1 , FALSE, PM_REMOVE)) - { - TranslateMessage(&Msg); - DispatchMessage(&Msg); - } + hMainWnd = GetMainWindowHandle(hWnd); + while(PeekMessageEx(&Msg, hMainWnd, MSG_PAINT, MSG_PAINT + 1 , FALSE, PM_REMOVE)) + { + TranslateMessage(&Msg); + DispatchMessage(&Msg); + } #endif #else /* a new implementation only check the window and its children. */ { @@ -4629,75 +4685,75 @@ BOOL GUIAPI MoveWindow (HWND hWnd, int x, int y, int w, int h, BOOL fPaint) #define WIRM_ALL (WIRM_PARENT | WIRM_CHILDREN | WIRM_SIBLING) static BOOL _wndInvalidateRect(HWND hWnd, const RECT* prc, BOOL bEraseBkgnd, int mark) { - PCONTROL pCtrl; - RECT rcClient; - RECT rcInv; - RECT rcTemp; - PINVRGN pInvRgn; + PCONTROL pCtrl; + RECT rcClient; + RECT rcInv; + RECT rcTemp; + PINVRGN pInvRgn; - pCtrl = (PCONTROL)hWnd; + pCtrl = (PCONTROL)hWnd; - //invalidate itself - rcClient.left = rcClient.top = 0; - rcClient.right = pCtrl->cr - pCtrl->cl; - rcClient.bottom = pCtrl->cb - pCtrl->ct; + //invalidate itself + rcClient.left = rcClient.top = 0; + rcClient.right = pCtrl->cr - pCtrl->cl; + rcClient.bottom = pCtrl->cb - pCtrl->ct; - pInvRgn = &pCtrl->InvRgn; - - if(!pInvRgn->frozen) - { - PCONTROL pNext; + pInvRgn = &pCtrl->InvRgn; + + if(!pInvRgn->frozen) + { + PCONTROL pNext; #ifdef _MGRM_THREADS - pthread_mutex_lock(&pInvRgn->lock); + pthread_mutex_lock(&pInvRgn->lock); #endif if (bEraseBkgnd) { pCtrl->Flags |= WF_ERASEBKGND; } - if(prc) - { - rcInv = *prc; - NormalizeRect(&rcInv); - if(IntersectRect(&rcInv, &rcInv, &rcClient)) - AddClipRect(&pInvRgn->rgn, &rcInv); - } - else - { - rcInv = rcClient; - SetClipRgn(&pInvRgn->rgn, &rcInv); - } + if(prc) + { + rcInv = *prc; + NormalizeRect(&rcInv); + if(IntersectRect(&rcInv, &rcInv, &rcClient)) + AddClipRect(&pInvRgn->rgn, &rcInv); + } + else + { + rcInv = rcClient; + SetClipRgn(&pInvRgn->rgn, &rcInv); + } - rcTemp = rcInv; - OffsetRect(&rcTemp, pCtrl->cl, pCtrl->ct); + rcTemp = rcInv; + OffsetRect(&rcTemp, pCtrl->cl, pCtrl->ct); - //subtract from next sibling controls - if(pCtrl->WinType==TYPE_CONTROL /*&& ( mark & WIRM_NEXT_SIBLING)*/) - { - for(pNext = pCtrl->next; pNext; pNext = pNext->next) - { - RECT rc; - if((pNext->dwStyle & WS_VISIBLE) - && !(pNext->dwExStyle & WS_EX_TRANSPARENT) - && IntersectRect(&rc, &rcTemp, (const RECT*)&pNext->left)) - { - OffsetRect(&rc, - pCtrl->cl, - pCtrl->ct ); - SubtractClipRect(&pInvRgn->rgn, &rc); - } - } - } + //subtract from next sibling controls + if(pCtrl->WinType==TYPE_CONTROL /*&& ( mark & WIRM_NEXT_SIBLING)*/) + { + for(pNext = pCtrl->next; pNext; pNext = pNext->next) + { + RECT rc; + if((pNext->dwStyle & WS_VISIBLE) + && !(pNext->dwExStyle & WS_EX_TRANSPARENT) + && IntersectRect(&rc, &rcTemp, (const RECT*)&pNext->left)) + { + OffsetRect(&rc, - pCtrl->cl, - pCtrl->ct ); + SubtractClipRect(&pInvRgn->rgn, &rc); + } + } + } #ifdef _MGRM_THREADS - pthread_mutex_unlock(&pInvRgn->lock); + pthread_mutex_unlock(&pInvRgn->lock); #endif - } - else - { - return FALSE; - } + } + else + { + return FALSE; + } - //invalidate parent + //invalidate parent if( (mark & WIRM_PARENT) && (pCtrl->dwExStyle & WS_EX_TRANSPARENT) && pCtrl->WinType != TYPE_MAINWIN @@ -4709,76 +4765,76 @@ static BOOL _wndInvalidateRect(HWND hWnd, const RECT* prc, BOOL bEraseBkgnd, int } } - //invalidate sibling - if(pCtrl->WinType==TYPE_CONTROL - && (pCtrl->dwExStyle & WS_EX_TRANSPARENT) - && !(pCtrl->dwExStyle & WS_EX_CTRLASMAINWIN) - && (mark & WIRM_PREV_SIBLING)) - { - PCONTROL pPrev; - for(pPrev = pCtrl->prev; pPrev; pPrev = pPrev->prev) - { - RECT rc; + //invalidate sibling + if(pCtrl->WinType==TYPE_CONTROL + && (pCtrl->dwExStyle & WS_EX_TRANSPARENT) + && !(pCtrl->dwExStyle & WS_EX_CTRLASMAINWIN) + && (mark & WIRM_PREV_SIBLING)) + { + PCONTROL pPrev; + for(pPrev = pCtrl->prev; pPrev; pPrev = pPrev->prev) + { + RECT rc; - if(!(pPrev->dwStyle & WS_VISIBLE)) - continue; + if(!(pPrev->dwStyle & WS_VISIBLE)) + continue; - if(IntersectRect(&rc, &rcTemp, (const RECT*)&pPrev->cl)) - { - OffsetRect(&rc, - pPrev->cl, - pPrev->ct); - _wndInvalidateRect((HWND)pPrev, &rc, bEraseBkgnd, WIRM_CHILDREN); - } - } - } + if(IntersectRect(&rc, &rcTemp, (const RECT*)&pPrev->cl)) + { + OffsetRect(&rc, - pPrev->cl, - pPrev->ct); + _wndInvalidateRect((HWND)pPrev, &rc, bEraseBkgnd, WIRM_CHILDREN); + } + } + } - if(pCtrl->WinType==TYPE_CONTROL - && !(pCtrl->dwExStyle & WS_EX_CTRLASMAINWIN) - && (mark & WIRM_NEXT_SIBLING)) - { - PCONTROL pNext; - for(pNext = pCtrl->next; pNext; pNext = pNext->next) - { - RECT rc; - if(!(pNext->dwStyle & WS_VISIBLE) - || !(pNext->dwExStyle & WS_EX_TRANSPARENT)) - continue; + if(pCtrl->WinType==TYPE_CONTROL + && !(pCtrl->dwExStyle & WS_EX_CTRLASMAINWIN) + && (mark & WIRM_NEXT_SIBLING)) + { + PCONTROL pNext; + for(pNext = pCtrl->next; pNext; pNext = pNext->next) + { + RECT rc; + if(!(pNext->dwStyle & WS_VISIBLE) + || !(pNext->dwExStyle & WS_EX_TRANSPARENT)) + continue; - if(IntersectRect(&rc, &rcTemp, (const RECT*)&pNext->cl)) - { - OffsetRect(&rc, - pNext->cl, - pNext->ct); - _wndInvalidateRect((HWND)pNext, &rc, bEraseBkgnd, WIRM_CHILDREN); - } - } - } + if(IntersectRect(&rc, &rcTemp, (const RECT*)&pNext->cl)) + { + OffsetRect(&rc, - pNext->cl, - pNext->ct); + _wndInvalidateRect((HWND)pNext, &rc, bEraseBkgnd, WIRM_CHILDREN); + } + } + } - - //check mark for invalidate children - if(mark & WIRM_CHILDREN) - { - PCONTROL pChild ; - RECT rc; + + //check mark for invalidate children + if(mark & WIRM_CHILDREN) + { + PCONTROL pChild ; + RECT rc; - - for(pChild = pCtrl->children; pChild; pChild = pChild->next) - { - if(!(pChild->dwStyle & WS_VISIBLE) - || (pChild->dwExStyle & WS_EX_CTRLASMAINWIN)) - continue; - - if(IntersectRect(&rc, &rcInv, (const RECT*)&pChild->cl)) - { - OffsetRect(&rc, - pChild->cl, - pChild->ct); - _wndInvalidateRect((HWND)pChild, &rc, bEraseBkgnd, WIRM_CHILDREN); - } - if(IntersectRect(&rc, &rcInv, (const RECT*)&pChild->left)) - { - OffsetRect(&rc, - pChild->left, - pChild->top); - SendAsyncMessage((HWND)pChild, MSG_NCPAINT, 0, (LPARAM)&rc); - } - } - } + + for(pChild = pCtrl->children; pChild; pChild = pChild->next) + { + if(!(pChild->dwStyle & WS_VISIBLE) + || (pChild->dwExStyle & WS_EX_CTRLASMAINWIN)) + continue; + + if(IntersectRect(&rc, &rcInv, (const RECT*)&pChild->cl)) + { + OffsetRect(&rc, - pChild->cl, - pChild->ct); + _wndInvalidateRect((HWND)pChild, &rc, bEraseBkgnd, WIRM_CHILDREN); + } + if(IntersectRect(&rc, &rcInv, (const RECT*)&pChild->left)) + { + OffsetRect(&rc, - pChild->left, - pChild->top); + SendAsyncMessage((HWND)pChild, MSG_NCPAINT, 0, (LPARAM)&rc); + } + } + } - return TRUE; + return TRUE; } @@ -4788,8 +4844,8 @@ BOOL GUIAPI InvalidateRect (HWND hWnd, const RECT* prc, BOOL bEraseBkgnd) MG_CHECK_RET (MG_IS_NORMAL_WINDOW(hWnd), FALSE); - retval = _wndInvalidateRect(hWnd, prc, bEraseBkgnd, WIRM_ALL); - PostMessage (hWnd, MSG_PAINT, 0, (LPARAM)prc); + retval = _wndInvalidateRect(hWnd, prc, bEraseBkgnd, WIRM_ALL); + PostMessage (hWnd, MSG_PAINT, 0, (LPARAM)prc); return retval; } @@ -4872,7 +4928,7 @@ HDC GUIAPI BeginPaint (HWND hWnd) HDC hdc; RECT rcInv; PCONTROL child; - BOOL fEraseBk; + BOOL fEraseBk; MG_CHECK_RET (MG_IS_NORMAL_WINDOW(hWnd), HDC_INVALID); pWin = MG_GET_WINDOW_PTR (hWnd); @@ -4898,8 +4954,8 @@ HDC GUIAPI BeginPaint (HWND hWnd) #endif pInvRgn->frozen ++; - fEraseBk = pWin->Flags & WF_ERASEBKGND; - pWin->Flags = (pWin->Flags & ~WF_ERASEBKGND); + fEraseBk = pWin->Flags & WF_ERASEBKGND; + pWin->Flags = (pWin->Flags & ~WF_ERASEBKGND); SelectClipRegion (hdc, &pInvRgn->rgn); if (pWin->pMainWin->secondaryDC) { @@ -4912,7 +4968,7 @@ HDC GUIAPI BeginPaint (HWND hWnd) else { CopyRect (&pWin->pMainWin->update_rc, &pInvRgn->rgn.rcBound); } - rcInv = pInvRgn->rgn.rcBound; + rcInv = pInvRgn->rgn.rcBound; EmptyClipRgn (&pInvRgn->rgn); @@ -4921,8 +4977,8 @@ HDC GUIAPI BeginPaint (HWND hWnd) pthread_mutex_unlock (&pInvRgn->lock); #endif - if(!(pWin->dwStyle & WS_VISIBLE)) - return hdc; + if(!(pWin->dwStyle & WS_VISIBLE)) + return hdc; /* exclude the children area from the client */ /* if (pWin->dwExStyle & WS_EX_CLIPCHILDREN)*/ { @@ -4935,33 +4991,33 @@ HDC GUIAPI BeginPaint (HWND hWnd) child = child->next; } } - //erase bkgnd - if(fEraseBk - && !(pWin->WinType == TYPE_CONTROL - && !(pWin->dwExStyle & WS_EX_CTRLASMAINWIN) - && (pWin->dwExStyle & WS_EX_TRANSPARENT) - ) - ) - SendAsyncMessage(hWnd, MSG_ERASEBKGND, (WPARAM)hdc,0); //(LPARAM)&rcInv); + //erase bkgnd + if(fEraseBk + && !(pWin->WinType == TYPE_CONTROL + && !(pWin->dwExStyle & WS_EX_CTRLASMAINWIN) + && (pWin->dwExStyle & WS_EX_TRANSPARENT) + ) + ) + SendAsyncMessage(hWnd, MSG_ERASEBKGND, (WPARAM)hdc,0); //(LPARAM)&rcInv); - //repaint NC area of tranparent children - for(child = (PCONTROL)pWin->hFirstChild; child; child = child->next) - { - RECT rcTemp; - if(!(pWin->dwExStyle & WS_EX_TRANSPARENT) - && (!(child->dwStyle & WS_VISIBLE) - || !(child->dwExStyle & WS_EX_TRANSPARENT) - || ( child->dwExStyle & WS_EX_CTRLASMAINWIN))) - continue; + //repaint NC area of tranparent children + for(child = (PCONTROL)pWin->hFirstChild; child; child = child->next) + { + RECT rcTemp; + if(!(pWin->dwExStyle & WS_EX_TRANSPARENT) + && (!(child->dwStyle & WS_VISIBLE) + || !(child->dwExStyle & WS_EX_TRANSPARENT) + || ( child->dwExStyle & WS_EX_CTRLASMAINWIN))) + continue; - if(IntersectRect(&rcTemp, &rcInv, (const RECT*)&child->left)) - { - //draw NC - OffsetRect(&rcTemp, -child->left, -child->top); - SendAsyncMessage((HWND)child, MSG_NCPAINT, (WPARAM)0, (LPARAM)&rcTemp); - } - - } + if(IntersectRect(&rcTemp, &rcInv, (const RECT*)&child->left)) + { + //draw NC + OffsetRect(&rcTemp, -child->left, -child->top); + SendAsyncMessage((HWND)child, MSG_NCPAINT, (WPARAM)0, (LPARAM)&rcTemp); + } + + } return hdc; } @@ -5249,12 +5305,12 @@ HWND GUIAPI CreateWindowEx2 (const char* spClassName, goto error; } - //set ctrl as main - if(pNewCtrl->dwExStyle & WS_EX_CTRLASMAINWIN){ - pNewCtrl->next_ctrl_as_main = (PCONTROL)pNewCtrl->pMainWin->hFirstChildAsMainWin; - pMainWin->hFirstChildAsMainWin = (HWND) pNewCtrl; - } - + //set ctrl as main + if(pNewCtrl->dwExStyle & WS_EX_CTRLASMAINWIN){ + pNewCtrl->next_ctrl_as_main = (PCONTROL)pNewCtrl->pMainWin->hFirstChildAsMainWin; + pMainWin->hFirstChildAsMainWin = (HWND) pNewCtrl; + } + SendMessage ((HWND)pNewCtrl, MSG_SIZECHANGING, (WPARAM)&rcExpect, (LPARAM)&pNewCtrl->left); @@ -5344,7 +5400,7 @@ BOOL GUIAPI DestroyWindow (HWND hWnd) ThrowAwayMessages (hWnd); if (pCtrl->dwExStyle & WS_EX_CTRLASMAINWIN) { - PMAINWIN pMainWin; + PMAINWIN pMainWin; EmptyClipRgn (&pCtrl->pGCRInfo->crgn); #ifdef _MGRM_THREADS pthread_mutex_destroy (&pCtrl->pGCRInfo->lock); @@ -5569,7 +5625,15 @@ int GUIAPI SetIMETargetInfo (const IME_TARGET_INFO *info) #endif } -inline int GUIAPI SetIMEPos (const POINT* pt) +int GUIAPI GetIMEPos (POINT *pt) +{ + IME_TARGET_INFO info; + int ret = GetIMETargetInfo (&info); + *pt = info.ptCaret; + return ret; +} + +int GUIAPI SetIMEPos (const POINT* pt) { IME_TARGET_INFO info; memset (&info, 0, sizeof(IME_TARGET_INFO)); @@ -5599,14 +5663,6 @@ int GUIAPI GetIMETargetInfo (IME_TARGET_INFO *info) #endif } -inline int GUIAPI GetIMEPos (POINT *pt) -{ - IME_TARGET_INFO info; - int ret = GetIMETargetInfo (&info); - *pt = info.ptCaret; - return ret; -} - HICON GetWindowIcon (HWND hWnd) { PMAINWIN pWin; @@ -6108,91 +6164,92 @@ BOOL GUIAPI GetWindowRegion (HWND hWnd, CLIPRGN* region) int GUIAPI GetWindowZOrder(HWND hWnd) { - PCONTROL pCtrl, pCtrlTmp; - int idx; - if(!IsWindow(hWnd)) - return -1; + PCONTROL pCtrl, pCtrlTmp; + int idx; + if(!IsWindow(hWnd)) + return -1; - if(IsMainWindow(hWnd)) - return 0; + if(IsMainWindow(hWnd)) + return 0; - pCtrl = (PCONTROL)hWnd; + pCtrl = (PCONTROL)hWnd; - pCtrlTmp = pCtrl->pParent->children; - - idx = 0; - while(pCtrlTmp && pCtrl != pCtrlTmp) - { - idx ++; - pCtrlTmp = pCtrlTmp->next; - } + pCtrlTmp = pCtrl->pParent->children; + + idx = 0; + while(pCtrlTmp && pCtrl != pCtrlTmp) + { + idx ++; + pCtrlTmp = pCtrlTmp->next; + } - return idx; + return idx; } int GUIAPI SetWindowZOrder(HWND hWnd, int zorder) { - int idx; - PCONTROL pCtrl, pCtrlTmp; - if(!IsWindow(hWnd)) - return -1; + int idx; + PCONTROL pCtrl, pCtrlTmp; + if(!IsWindow(hWnd)) + return -1; - if(IsMainWindow(hWnd)) - return 0; - - pCtrl = (PCONTROL)hWnd; + if(IsMainWindow(hWnd)) + return 0; + + pCtrl = (PCONTROL)hWnd; - pCtrlTmp = pCtrl->pParent->children; + pCtrlTmp = pCtrl->pParent->children; - idx = 0; - while(idx < zorder && pCtrlTmp && pCtrlTmp != pCtrl){ - idx ++; - pCtrlTmp = pCtrlTmp->next; - } + idx = 0; + while(idx < zorder && pCtrlTmp && pCtrlTmp != pCtrl){ + idx ++; + pCtrlTmp = pCtrlTmp->next; + } - if(idx < zorder) //Move Down - { - pCtrlTmp = pCtrlTmp->next; - if(pCtrlTmp && pCtrl == pCtrl->pParent->children) - pCtrl->pParent->children = pCtrl->next; - while(idx < zorder && pCtrlTmp) - { - //switch pCtrl and pCtrlTmp - pCtrl->next = pCtrlTmp->next; - pCtrlTmp->prev = pCtrl->prev; - pCtrl->prev = pCtrlTmp; - pCtrlTmp->next = pCtrl; - if(pCtrl->next) - pCtrl->next->prev = pCtrl; - if(pCtrlTmp->prev) - pCtrlTmp->prev->next = pCtrlTmp; - pCtrlTmp = pCtrl->next; - } - } - else if(pCtrlTmp && pCtrlTmp != pCtrl) // Move Up - { - PCONTROL prev; - do{ - prev = pCtrl->prev; - if(prev == NULL) - break; - prev->next = pCtrl->next; - pCtrl->prev = prev->prev; - pCtrl->next = prev; - prev->prev = pCtrl; - if(pCtrl->prev) - pCtrl->prev->next = pCtrl; - if(prev->next) - prev->next->prev = prev; - }while(prev != pCtrlTmp); - if(pCtrlTmp == pCtrl->pParent->children) - pCtrl->pParent->children = pCtrl; + if(idx < zorder) //Move Down + { + pCtrlTmp = pCtrlTmp->next; + if(pCtrlTmp && pCtrl == pCtrl->pParent->children) + pCtrl->pParent->children = pCtrl->next; + while(idx < zorder && pCtrlTmp) + { + //switch pCtrl and pCtrlTmp + pCtrl->next = pCtrlTmp->next; + pCtrlTmp->prev = pCtrl->prev; + pCtrl->prev = pCtrlTmp; + pCtrlTmp->next = pCtrl; + if(pCtrl->next) + pCtrl->next->prev = pCtrl; + if(pCtrlTmp->prev) + pCtrlTmp->prev->next = pCtrlTmp; + pCtrlTmp = pCtrl->next; + } + } + else if(pCtrlTmp && pCtrlTmp != pCtrl) // Move Up + { + PCONTROL prev; + do{ + prev = pCtrl->prev; + if(prev == NULL) + break; + prev->next = pCtrl->next; + pCtrl->prev = prev->prev; + pCtrl->next = prev; + prev->prev = pCtrl; + if(pCtrl->prev) + pCtrl->prev->next = pCtrl; + if(prev->next) + prev->next->prev = prev; + }while(prev != pCtrlTmp); + if(pCtrlTmp == pCtrl->pParent->children) + pCtrl->pParent->children = pCtrl; - if(prev == NULL) - return 0; - } + if(prev == NULL) + return 0; + } - return idx; + return idx; } #endif + diff --git a/src/include/dc.h b/src/include/dc.h index 237ece00..ee822eee 100644 --- a/src/include/dc.h +++ b/src/include/dc.h @@ -3,7 +3,7 @@ ** ** dc.h: this head file declares all internal types and data of GDI module. ** -** Copyright (C) 2003 ~ 2007 Feynman Software. +** Copyright (C) 2003 ~ 2017 FMSoft. ** Copyright (C) 1999 ~ 2002 Wei Yongming. ** ** Create Date: 1999/xx/xx @@ -217,16 +217,13 @@ struct tagDC extern DC __mg_screen_dc; extern DC __mg_screen_sys_dc; -inline void WndRect(HWND hWnd, PRECT prc); -inline void WndClientRect(HWND hWnd, PRECT prc); - /* This function convert HDC to PDC. */ static inline PDC dc_HDC2PDC (HDC hdc) { if (hdc == HDC_SCREEN_SYS) - return &__mg_screen_sys_dc; + return &__mg_screen_sys_dc; else if (hdc == HDC_SCREEN) - return &__mg_screen_dc; + return &__mg_screen_dc; return (PDC) hdc; } diff --git a/src/include/internals.h b/src/include/internals.h index 47f77113..81936bdc 100644 --- a/src/include/internals.h +++ b/src/include/internals.h @@ -608,6 +608,9 @@ void mg_TerminateLFManager (void); char* gui_GetIconFile(const char* rdr_name, char* file, char* _szValue); BOOL gui_LoadIconRes(HDC hdc, const char* rdr_name, char* file); +void gui_WndRect(HWND hWnd, PRECT prc); +void gui_WndClientRect(HWND hWnd, PRECT prc); + /* -------------------------------------------------------------------------- */ #ifdef __cplusplus diff --git a/src/newgdi/gdi.c b/src/newgdi/gdi.c index d77ca4e4..5ff67b64 100644 --- a/src/newgdi/gdi.c +++ b/src/newgdi/gdi.c @@ -87,63 +87,6 @@ static void dc_InitDC (PDC pdc, HWND hWnd, BOOL bIsClient); static void dc_InitMemDCFrom (PDC pdc, const PDC pdc_ref); static void dc_InitScreenDC (PDC pdc, GAL_Surface* surface); -/************************** inline functions *********************************/ -inline void WndRect(HWND hWnd, PRECT prc) -{ - PCONTROL pParent; - PCONTROL pCtrl; - - pParent = pCtrl = (PCONTROL) hWnd; - - if (hWnd == HWND_DESKTOP) { - *prc = g_rcScr; - return; - } - - prc->left = pCtrl->left; - prc->top = pCtrl->top; - prc->right = pCtrl->right; - prc->bottom = pCtrl->bottom; - - /*dongjunjie 2009/7/9 main window and control as main window - * don't need offset - * */ - if(pCtrl->WinType == TYPE_MAINWIN ) -// || (pCtrl->dwExStyle & WS_EX_CTRLASMAINWIN)) - return ; - - - while ((pParent = pParent->pParent)) { - prc->left += pParent->cl; - prc->top += pParent->ct; - prc->right += pParent->cl; - prc->bottom += pParent->ct; - } -} - -inline void WndClientRect(HWND hWnd, PRECT prc) -{ - PCONTROL pCtrl; - PCONTROL pParent; - pParent = pCtrl = (PCONTROL) hWnd; - - if (hWnd == HWND_DESKTOP) { - *prc = g_rcScr; - return; - } - - prc->left = pCtrl->cl; - prc->top = pCtrl->ct; - prc->right = pCtrl->cr; - prc->bottom = pCtrl->cb; - while ((pParent = pParent->pParent)) { - prc->left += pParent->cl; - prc->top += pParent->ct; - prc->right += pParent->cl; - prc->bottom += pParent->ct; - } -} - static BOOL RestrictControlECRGNEx (RECT* minimal, PCONTROL pCtrl, CLIPRGN * ergn) { @@ -241,7 +184,7 @@ void mg_TerminateScreenDC (void) DESTROY_LOCK (&__mg_gdilock); DESTROY_LOCK (&dcslot); /* [2010/06/02] DongJunJie : fix a dead-lock bug of mgncs. */ - DestroyFreeClipRectList (&__mg_FreeClipRectList); + DestroyFreeClipRectList (&__mg_FreeClipRectList); } #define INIT_SPECIFICAL_FONTS(etc_section) \ @@ -483,9 +426,9 @@ BOOL dc_GenerateECRgn(PDC pdc, BOOL fForce) * update pdc->DevRC, and restrict the effective */ if (pdc->bIsClient) - WndClientRect (pdc->hwnd, &pdc->DevRC); + gui_WndClientRect (pdc->hwnd, &pdc->DevRC); else - WndRect (pdc->hwnd, &pdc->DevRC); + gui_WndRect (pdc->hwnd, &pdc->DevRC); /* copy local clipping region to effective clipping region. */ ClipRgnCopy (&pdc->ecrgn, &pdc->lcrgn); @@ -1783,9 +1726,9 @@ static void dc_InitDC (PDC pdc, HWND hWnd, BOOL bIsClient) pdc->bIsClient = bIsClient; if (bIsClient) - WndClientRect (pdc->hwnd, &pdc->DevRC); + gui_WndClientRect (pdc->hwnd, &pdc->DevRC); else - WndRect (pdc->hwnd, &pdc->DevRC); + gui_WndRect (pdc->hwnd, &pdc->DevRC); minimal = pdc->DevRC; @@ -2109,9 +2052,9 @@ void GUIAPI ReleaseDC (HDC hDC) ClipRgnCopy (&pdc->ecrgn, &pdc->pGCRInfo->crgn); if (pdc->bIsClient) - WndClientRect (pdc->hwnd, &pdc->DevRC); + gui_WndClientRect (pdc->hwnd, &pdc->DevRC); else - WndRect (pdc->hwnd, &pdc->DevRC); + gui_WndRect (pdc->hwnd, &pdc->DevRC); minimal = pdc->DevRC; @@ -2154,8 +2097,8 @@ static BOOL InitSubDC (HDC hdcDest, HDC hdc, int off_x, int off_y, PDC pdc; PDC pdc_parent; - if(hdcDest == 0) return FALSE; - + if(hdcDest == 0) return FALSE; + pdc_parent = dc_HDC2PDC (hdc); if (pdc_parent == NULL || pdc_parent->DataType != TYPE_HDC || pdc_parent->DCType == TYPE_SCRDC) @@ -2182,18 +2125,18 @@ static BOOL InitSubDC (HDC hdcDest, HDC hdc, int off_x, int off_y, pdc->DevRC.top = pdc_parent->DevRC.top + off_y; pdc->DevRC.right = pdc->DevRC.left + width; pdc->DevRC.bottom = pdc->DevRC.top + height; - pdc->surface = pdc_parent->surface; - pdc->pGCRInfo = pdc_parent->pGCRInfo; - - dc_InitMemDCFrom(pdc, pdc_parent); + pdc->surface = pdc_parent->surface; + pdc->pGCRInfo = pdc_parent->pGCRInfo; + + dc_InitMemDCFrom(pdc, pdc_parent); /* should set after InitMemDC.*/ - pdc->hwnd = pdc_parent->hwnd; + pdc->hwnd = pdc_parent->hwnd; CopyRegion (&pdc->lcrgn, &pdc_parent->lcrgn); CopyRegion (&pdc->ecrgn, &pdc_parent->ecrgn); IntersectClipRect (&pdc->ecrgn, &pdc->DevRC); - return TRUE; + return TRUE; } /* @@ -2244,12 +2187,12 @@ HDC GUIAPI GetSubDC (HDC hdc, int off_x, int off_y, int width, int height) if (pdc == NULL) return HDC_INVALID; - if(!InitSubDC((HDC)pdc, hdc, off_x, off_y, width, height)) - { - pdc->inuse = FALSE; - return HDC_INVALID; - } - return (HDC)pdc; + if (!InitSubDC((HDC)pdc, hdc, off_x, off_y, width, height)) + { + pdc->inuse = FALSE; + return HDC_INVALID; + } + return (HDC)pdc; } HDC GUIAPI CreatePrivateDC(HWND hwnd) @@ -2291,8 +2234,8 @@ HDC GUIAPI CreatePrivateClientDC(HWND hwnd) HDC GUIAPI CreatePrivateSubDC(HDC hdc, int off_x, int off_y, int width, int height) { - PDC pdc; - if(!(pdc = malloc(sizeof(DC)))) return HDC_INVALID; + PDC pdc; + if(!(pdc = malloc(sizeof(DC)))) return HDC_INVALID; InitClipRgn (&pdc->lcrgn, &__mg_FreeClipRectList); MAKE_REGION_INFINITE(&pdc->lcrgn); @@ -2302,12 +2245,12 @@ HDC GUIAPI CreatePrivateSubDC(HDC hdc, int off_x, int off_y, int width, int heig pdc->DataType = TYPE_HDC; pdc->DCType = TYPE_GENDC; - if(!InitSubDC((HDC)pdc, hdc, off_x,off_y, width, height)) - { - free(pdc); - return HDC_INVALID; - } - return (HDC)pdc; + if(!InitSubDC((HDC)pdc, hdc, off_x,off_y, width, height)) + { + free(pdc); + return HDC_INVALID; + } + return (HDC)pdc; } void GUIAPI DeletePrivateDC(HDC hdc) @@ -2667,14 +2610,14 @@ HDC GetSecondarySubDC (HDC secondary_dc, HWND hwnd_child, BOOL client) /* SubDC is relative the parent_dc's (0,0). */ if (client) { /* 1.get child client_rc relative to screen. */ - WndClientRect (hwnd_child, &rc1); + gui_WndClientRect (hwnd_child, &rc1); } else { /* 2.get child window rc relative to screen.*/ - WndRect (hwnd_child, &rc1); + gui_WndRect (hwnd_child, &rc1); } /* 3.parent window relative to screen.*/ - WndRect (pdc_parent->hwnd, &rc2); + gui_WndRect (pdc_parent->hwnd, &rc2); /* 4.get the child's offset to the parent window rc.*/ off_x = rc1.left - rc2.left; @@ -3053,22 +2996,22 @@ HDC GUIAPI CreateSubMemDC (HDC parent, int off_x, int off_y, PDC pdc_sub; GAL_Surface* surface; BYTE* sub_pixels; - int parent_width; - int parent_height; + int parent_width; + int parent_height; pdc_parent = dc_HDC2PDC (parent); if (pdc_parent->DCType != TYPE_MEMDC) return HDC_INVALID; - parent_width = RECTW (pdc_parent->DevRC); - parent_height = RECTH (pdc_parent->DevRC); + parent_width = RECTW (pdc_parent->DevRC); + parent_height = RECTH (pdc_parent->DevRC); - if (off_x < 0) off_x = 0; - else if(off_x > parent_width) off_x = parent_width; - if (off_y < 0) off_y = 0; - else if(off_y > parent_height) off_y = parent_height; - if (width < 0) width = 0; - if (height < 0) height = 0; + if (off_x < 0) off_x = 0; + else if(off_x > parent_width) off_x = parent_width; + if (off_y < 0) off_y = 0; + else if(off_y > parent_height) off_y = parent_height; + if (width < 0) width = 0; + if (height < 0) height = 0; if (off_x + width > pdc_parent->DevRC.right)