From df2d74fb0a72c50228a73b064f050bbc0458640c Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Wed, 12 Feb 2020 13:26:01 +0800 Subject: [PATCH] use GetWindowElementPixelEx instead of GetWindowElementPixel or GetWindowElementColor --- include/window.h | 19 +++++++----- obsolete/ime/hzinput.c | 5 ++-- src/control/bidiedit.c | 18 ++++++----- src/control/button.c | 6 ++-- src/control/combobox.c | 2 +- src/control/ctrlmisc.c | 10 ++++--- src/control/edit.c | 24 ++++++++++----- src/control/listbox.c | 3 +- src/control/menubutton.c | 4 +-- src/control/newtoolbar.c | 7 +++-- src/control/progressbar.c | 4 +-- src/control/propsheet.c | 8 ++--- src/control/scrollbar.c | 5 ++-- src/control/scrollview.c | 5 ++-- src/control/scrollwnd.c | 6 ++-- src/control/static.c | 11 +++---- src/control/textedit.c | 19 +++++++----- src/control/trackbar.c | 7 +++-- src/ex_ctrl/animation.c | 8 +++-- src/ex_ctrl/coolbar.c | 4 +-- src/ex_ctrl/gridview.c | 3 +- src/ex_ctrl/gridviewcelltype.c | 24 --------------- src/ex_ctrl/iconview.c | 7 +++-- src/ex_ctrl/listview.c | 9 +++--- src/ex_ctrl/monthcalendar.c | 46 +++++++++++++++-------------- src/ex_ctrl/spinbox.c | 3 +- src/ex_ctrl/treeview.c | 9 +++--- src/ex_ctrl/treeview_rdr.c | 9 +++--- src/gui/dialog.c | 2 +- src/gui/lf_classic.c | 28 +++++++++--------- src/gui/lf_common.h | 2 +- src/gui/lf_fashion.c | 4 +-- src/gui/lf_flat.c | 29 ++++++++++-------- src/gui/lf_manager.c | 13 ++++---- src/gui/lf_test/src/button_my.c | 3 +- src/gui/lf_test/src/combobox.c | 3 +- src/gui/lf_test/src/coolbar.c | 3 +- src/gui/lf_test/src/edit.c | 3 +- src/gui/lf_test/src/grid.c | 3 +- src/gui/lf_test/src/listbox.c | 3 +- src/gui/lf_test/src/listview.c | 3 +- src/gui/lf_test/src/menubutton.c | 3 +- src/gui/lf_test/src/monthcalendar.c | 3 +- src/gui/lf_test/src/progbar.c | 3 +- src/gui/lf_test/src/static.c | 3 +- src/gui/lf_test/src/subclass.c | 3 +- src/gui/lf_test/src/timeedit.c | 3 +- src/gui/lf_test/src/trackbar.c | 3 +- src/gui/lf_test/src/treeview.c | 3 +- src/gui/lf_tiny.c | 27 +++++++++-------- src/kernel/compsor-fallback.c | 5 +++- src/kernel/desktop.c | 2 +- src/textedit/mtextedit.c | 21 ++++++------- 53 files changed, 252 insertions(+), 211 deletions(-) diff --git a/include/window.h b/include/window.h index 41b9378e..bfc6f48d 100644 --- a/include/window.h +++ b/include/window.h @@ -5175,7 +5175,7 @@ MG_EXPORT DWORD GUIAPI SetWindowElementAttr (HWND hwnd, int we_attr_id, /** * \fn gal_pixel GUIAPI GetWindowElementPixelEx (HWND hwnd, \ - HDC hdc, int we_attr_id) + HDC hdc, int we_attr_id) * \brief Get the pixel value of a window element. * * This function gets the pixel value of a window element which is identified @@ -7885,18 +7885,23 @@ static inline void GUIAPI ScrollWindow (HWND hWnd, int dx, int dy, NULL, NULL, SW_ERASE | SW_INVALIDATE | SW_SCROLLCHILDREN); } -/** - * \def GetWindowElementColor - * \brief Get window element color. - */ +#if 0 +/* deprecated. */ #define GetWindowElementColor(iItem) \ GetWindowElementPixelEx(HWND_NULL, (HDC)-1, iItem) +/* deprecated. */ #define GetWindowElementColorEx(hWnd, iItem) \ GetWindowElementPixelEx(hWnd, (HDC)-1, iItem) +#endif -#define GetWindowElementPixel(hWnd, iItem) \ - GetWindowElementPixelEx(hWnd, (HDC)-1, iItem) +/** + * \def GetWindowElementPixel + * \brief Get window element pixel value. + * \sa GetWindowElementPixelEx + */ +#define GetWindowElementPixel(hWnd, iItem) \ + GetWindowElementPixelEx(hWnd, HDC_INVALID, iItem) /** @} end of window_general_fns */ diff --git a/obsolete/ime/hzinput.c b/obsolete/ime/hzinput.c index 658d5da5..849d49fd 100644 --- a/obsolete/ime/hzinput.c +++ b/obsolete/ime/hzinput.c @@ -1616,7 +1616,8 @@ int GBIMEWinProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam) case MSG_PAINT: hdc = BeginPaint (hWnd); - SetBkColor (hdc, GetWindowElementPixel (hWnd, WE_MAINC_THREED_BODY)); + SetBkColor (hdc, + GetWindowElementPixelEx (hWnd, hdc, WE_MAINC_THREED_BODY)); refresh_input_method_area (hWnd, hdc); EndPaint (hWnd, hdc); return 0; @@ -1736,7 +1737,7 @@ static void InitIMEWinCreateInfo (PMAINWINCREATE pCreateInfo) pCreateInfo->rx = GetGDCapability (HDC_SCREEN, GDCAP_MAXX); pCreateInfo->by = GetGDCapability (HDC_SCREEN, GDCAP_MAXY) - 40; pCreateInfo->iBkColor = - GetWindowElementPixel (HWND_NULL, WE_MAINC_THREED_BODY); + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_MAINC_THREED_BODY); pCreateInfo->dwAddData = 0; pCreateInfo->hHosting = 0; } diff --git a/src/control/bidiedit.c b/src/control/bidiedit.c index 7fb07306..13b88a73 100644 --- a/src/control/bidiedit.c +++ b/src/control/bidiedit.c @@ -109,7 +109,8 @@ BOOL RegisterBIDISLEditControl (void) #ifdef _MGSCHEMA_COMPOSITING WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_BGC_WINDOW); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_NULL, WE_BGC_WINDOW); + WndClass.iBkColor = GetWindowElementPixelEx (HWND_NULL, + HDC_SCREEN, WE_BGC_WINDOW); #endif WndClass.WinProc = SLEditCtrlProc; @@ -214,9 +215,10 @@ static void setup_dc (HWND hWnd, BIDISLEDITDATA *sled, HDC hdc, BOOL bSel) if (dwStyle & WS_DISABLED) SetTextColor (hdc, - GetWindowElementPixel (hWnd, WE_FGC_DISABLED_ITEM)); + GetWindowElementPixelEx (hWnd, hdc, WE_FGC_DISABLED_ITEM)); else - SetTextColor (hdc, GetWindowElementPixel (hWnd, WE_FGC_WINDOW)); + SetTextColor (hdc, + GetWindowElementPixelEx (hWnd, hdc, WE_FGC_WINDOW)); SetBkColor (hdc, GetWindowBkColor (hWnd)); } @@ -226,17 +228,17 @@ static void setup_dc (HWND hWnd, BIDISLEDITDATA *sled, HDC hdc, BOOL bSel) if (dwStyle & WS_DISABLED) SetTextColor (hdc, - GetWindowElementPixel (hWnd, WE_FGC_DISABLED_ITEM)); + GetWindowElementPixelEx (hWnd, hdc, WE_FGC_DISABLED_ITEM)); else SetTextColor (hdc, - GetWindowElementPixel (hWnd, WE_FGC_SELECTED_ITEM)); + GetWindowElementPixelEx (hWnd, hdc, WE_FGC_SELECTED_ITEM)); if (sled->status & EST_FOCUSED) SetBkColor (hdc, - GetWindowElementPixel (hWnd, WE_BGC_SELECTED_ITEM)); + GetWindowElementPixelEx (hWnd, hdc, WE_BGC_SELECTED_ITEM)); else SetBkColor (hdc, - GetWindowElementPixel (hWnd, WE_BGC_SELECTED_LOSTFOCUS)); + GetWindowElementPixelEx (hWnd, hdc, WE_BGC_SELECTED_LOSTFOCUS)); } } @@ -509,7 +511,7 @@ static void slePaint (HWND hWnd, HDC hdc, PBIDISLEDITDATA sled) } if (dwStyle & ES_BASELINE) { - SetPenColor (hdc, GetWindowElementPixel (hWnd, WE_FGC_WINDOW)); + SetPenColor (hdc, GetWindowElementPixelEx (hWnd, hdc, WE_FGC_WINDOW)); #ifdef _PHONE_WINDOW_STYLE MoveTo (hdc, sled->leftMargin, sled->rcVis.bottom); LineTo (hdc, sled->rcVis.right, sled->rcVis.bottom); diff --git a/src/control/button.c b/src/control/button.c index 8065f1d0..4aca9c7c 100644 --- a/src/control/button.c +++ b/src/control/button.c @@ -671,7 +671,7 @@ BOOL RegisterButtonControl (void) GetWindowElementAttr (HWND_NULL, WE_MAINC_THREED_BODY); #else WndClass.iBkColor = - GetWindowElementPixel (HWND_NULL, WE_MAINC_THREED_BODY); + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_MAINC_THREED_BODY); #endif WndClass.WinProc = ButtonCtrlProc; @@ -707,8 +707,8 @@ static LRESULT ButtonCtrlProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara { case MSG_CREATE: pData = (BUTTONDATA*) calloc (1, sizeof(BUTTONDATA)); - SetWindowBkColor (hWnd, GetWindowElementPixel (hWnd, - WE_MAINC_THREED_BODY)); + SetWindowBkColor (hWnd, GetWindowElementPixelEx (hWnd, + HDC_INVALID, WE_MAINC_THREED_BODY)); if (pData == NULL) return -1; diff --git a/src/control/combobox.c b/src/control/combobox.c index 9dfe101a..3af614d6 100644 --- a/src/control/combobox.c +++ b/src/control/combobox.c @@ -98,7 +98,7 @@ BOOL RegisterComboBoxControl (void) GetWindowElementAttr (HWND_NULL, WE_BGC_WINDOW); #else WndClass.iBkColor = - GetWindowElementPixel (HWND_NULL, WE_BGC_WINDOW); + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_BGC_WINDOW); #endif WndClass.WinProc = ComboBoxCtrlProc; diff --git a/src/control/ctrlmisc.c b/src/control/ctrlmisc.c index 791c407c..35a99233 100644 --- a/src/control/ctrlmisc.c +++ b/src/control/ctrlmisc.c @@ -100,7 +100,8 @@ static LRESULT ToolTipWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lP text = GetWindowCaption (hWnd); SetBkMode (hdc, BM_TRANSPARENT); - SetTextColor (hdc, GetWindowElementPixel(hWnd, WE_FGC_TOOLTIP)); + SetTextColor (hdc, + GetWindowElementPixelEx(hWnd, hdc, WE_FGC_TOOLTIP)); TabbedTextOut (hdc, iBorder, iBorder, text); EndPaint (hWnd, hdc); @@ -172,7 +173,8 @@ HWND CreateToolTipWin (HWND hParentWnd, int x, int y, int timeout_ms, CreateInfo.ty = y; CreateInfo.rx = CreateInfo.lx + text_size.cx; CreateInfo.by = CreateInfo.ty + text_size.cy; - CreateInfo.iBkColor = GetWindowElementPixel (hParentWnd, WE_BGC_TOOLTIP); + CreateInfo.iBkColor = + GetWindowElementPixelEx (hParentWnd, HDC_SCREEN, WE_BGC_TOOLTIP); CreateInfo.dwAddData = (DWORD) timeout_ms; CreateInfo.hHosting = hParentWnd; @@ -229,9 +231,9 @@ void DestroyToolTipWin (HWND hwnd) void GUIAPI DisabledTextOutEx (HDC hdc, HWND hwnd, int x, int y, const char* szText) { SetBkMode (hdc, BM_TRANSPARENT); - SetTextColor (hdc, GetWindowElementColorEx (hwnd, WE_DISABLED_ITEM)); + SetTextColor (hdc, GetWindowElementPixelEx (hwnd, hdc, WE_DISABLED_ITEM)); TextOut (hdc, x + 1, y + 1, szText); - SetTextColor (hdc, GetWindowElementColorEx (hwnd, WE_SIGNIFICANT_ITEM)); + SetTextColor (hdc, GetWindowElementPixelEx (hwnd, hdc, WE_SIGNIFICANT_ITEM)); TextOut (hdc, x, y, szText); } diff --git a/src/control/edit.c b/src/control/edit.c index c5f6c8c8..7050337a 100644 --- a/src/control/edit.c +++ b/src/control/edit.c @@ -118,7 +118,8 @@ BOOL RegisterSLEditControl (void) #ifdef _MGSCHEMA_COMPOSITING WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_BGC_WINDOW); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_NULL, WE_BGC_WINDOW); + WndClass.iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_BGC_WINDOW); #endif WndClass.WinProc = SLEditCtrlProc; @@ -138,23 +139,29 @@ static void setup_dc (HWND hWnd, SLEDITDATA *sled, HDC hdc, BOOL bSel) if (!bSel) { SetBkMode (hdc, BM_TRANSPARENT); if (dwStyle & WS_DISABLED) - SetTextColor (hdc, GetWindowElementPixel (hWnd, WE_FGC_DISABLED_ITEM)); + SetTextColor (hdc, + GetWindowElementPixelEx (hWnd, hdc, WE_FGC_DISABLED_ITEM)); else - SetTextColor (hdc, GetWindowElementPixel (hWnd, WE_FGC_WINDOW)); + SetTextColor (hdc, + GetWindowElementPixelEx (hWnd, hdc, WE_FGC_WINDOW)); SetBkColor (hdc, GetWindowBkColor (hWnd)); } else { SetBkMode (hdc, BM_OPAQUE); if (dwStyle & WS_DISABLED) - SetTextColor (hdc, GetWindowElementPixel (hWnd, WE_FGC_DISABLED_ITEM)); + SetTextColor (hdc, + GetWindowElementPixelEx (hWnd, hdc, WE_FGC_DISABLED_ITEM)); else - SetTextColor (hdc, GetWindowElementPixel (hWnd, WE_FGC_SELECTED_ITEM)); + SetTextColor (hdc, + GetWindowElementPixelEx (hWnd, hdc, WE_FGC_SELECTED_ITEM)); if (sled->status & EST_FOCUSED) - SetBkColor (hdc, GetWindowElementPixel (hWnd, WE_BGC_SELECTED_ITEM)); + SetBkColor (hdc, + GetWindowElementPixelEx (hWnd, hdc, WE_BGC_SELECTED_ITEM)); else - SetBkColor (hdc, GetWindowElementPixel (hWnd, WE_BGC_SELECTED_LOSTFOCUS)); + SetBkColor (hdc, + GetWindowElementPixelEx (hWnd, hdc, WE_BGC_SELECTED_LOSTFOCUS)); } } @@ -358,7 +365,8 @@ static void slePaint (HWND hWnd, HDC hdc, PSLEDITDATA sled) } if (dwStyle & ES_BASELINE) { - SetPenColor (hdc, GetWindowElementPixel (hWnd, WE_FGC_WINDOW)); + SetPenColor (hdc, + GetWindowElementPixelEx (hWnd, hdc, WE_FGC_WINDOW)); #ifdef _PHONE_WINDOW_STYLE MoveTo (hdc, sled->leftMargin, sled->rcVis.bottom); LineTo (hdc, sled->rcVis.right, sled->rcVis.bottom); diff --git a/src/control/listbox.c b/src/control/listbox.c index 54d9062c..10a74a00 100644 --- a/src/control/listbox.c +++ b/src/control/listbox.c @@ -93,7 +93,8 @@ BOOL RegisterListboxControl (void) #ifdef _MGSCHEMA_COMPOSITING WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_BGC_WINDOW); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_NULL, WE_BGC_WINDOW); + WndClass.iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_BGC_WINDOW); #endif WndClass.WinProc = ListboxCtrlProc; return AddNewControlClass (&WndClass) == ERR_OK; diff --git a/src/control/menubutton.c b/src/control/menubutton.c index ec7f62e4..bbe26590 100644 --- a/src/control/menubutton.c +++ b/src/control/menubutton.c @@ -91,8 +91,8 @@ BOOL RegisterMenuButtonControl (void) WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_MAINC_THREED_BODY); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_NULL, - WE_MAINC_THREED_BODY); + WndClass.iBkColor = GetWindowElementPixelEx (HWND_NULL, + HDC_SCREEN, WE_MAINC_THREED_BODY); #endif WndClass.WinProc = MenuButtonCtrlProc; diff --git a/src/control/newtoolbar.c b/src/control/newtoolbar.c index 3cd48f10..8417105e 100644 --- a/src/control/newtoolbar.c +++ b/src/control/newtoolbar.c @@ -90,7 +90,8 @@ BOOL RegisterNewToolbarControl (void) #ifdef _MGSCHEMA_COMPOSITING WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_BGC_WINDOW); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_NULL, WE_BGC_WINDOW); + WndClass.iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_BGC_WINDOW); #endif WndClass.WinProc = NewToolbarCtrlProc; @@ -376,7 +377,7 @@ static void draw_item_text_vert (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data, NTBI SetBkMode (hdc, BM_TRANSPARENT); bk_pixel = SetBkColor (hdc, GetWindowBkColor (hwnd)); - SetTextColor (hdc, GetWindowElementPixel (hwnd, WE_FGC_WINDOW)); + SetTextColor (hdc, GetWindowElementPixelEx (hwnd, hdc, WE_FGC_WINDOW)); DrawText (hdc, item->text, -1, &item->rc_text, format); SetBkColor (hdc, bk_pixel); } @@ -702,7 +703,7 @@ static void draw_item_text_horz (HWND hwnd, HDC hdc, PNTBCTRLDATA ntb_data, NTBI SetBkMode (hdc, BM_TRANSPARENT); bk_pixel = SetBkColor (hdc, GetWindowBkColor (hwnd)); - SetTextColor (hdc, GetWindowElementPixel (hwnd, WE_FGC_WINDOW)); + SetTextColor (hdc, GetWindowElementPixelEx (hwnd, hdc, WE_FGC_WINDOW)); DrawText (hdc, item->text, -1, &item->rc_text, format); SetBkColor (hdc, bk_pixel); } diff --git a/src/control/progressbar.c b/src/control/progressbar.c index 9606dfac..3a67bcdd 100644 --- a/src/control/progressbar.c +++ b/src/control/progressbar.c @@ -227,8 +227,8 @@ BOOL RegisterProgressBarControl (void) WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_MAINC_THREED_BODY); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_NULL, - WE_MAINC_THREED_BODY); + WndClass.iBkColor = GetWindowElementPixelEx (HWND_NULL, + HDC_SCREEN, WE_MAINC_THREED_BODY); #endif WndClass.WinProc = ProgressBarCtrlProc; diff --git a/src/control/propsheet.c b/src/control/propsheet.c index 6b701f25..c86f4ee6 100644 --- a/src/control/propsheet.c +++ b/src/control/propsheet.c @@ -96,8 +96,8 @@ BOOL RegisterPropSheetControl (void) WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_MAINC_THREED_BODY); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_NULL, - WE_MAINC_THREED_BODY); + WndClass.iBkColor = GetWindowElementPixelEx (HWND_NULL, + HDC_SCREEN, WE_MAINC_THREED_BODY); #endif WndClass.WinProc = PropSheetCtrlProc; @@ -974,8 +974,8 @@ PropSheetCtrlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case MSG_CREATE: { #ifdef __TARGET_MSTUDIO__ - SetWindowBkColor(hwnd, - GetWindowElementPixel (hwnd, WE_MAINC_THREED_BODY)); + SetWindowBkColor(hwnd, GetWindowElementPixelEx (hwnd, + HDC_INVALID, WE_MAINC_THREED_BODY)); #endif if (!(propsheet = calloc (1, sizeof (PROPSHEETDATA)))) { diff --git a/src/control/scrollbar.c b/src/control/scrollbar.c index ddc7b1fa..9eb93201 100644 --- a/src/control/scrollbar.c +++ b/src/control/scrollbar.c @@ -1258,9 +1258,10 @@ BOOL RegisterScrollBarControl (void) WndClass.dwExStyle = WS_EX_NONE; WndClass.hCursor = GetSystemCursor (0); #ifdef _MGSCHEMA_COMPOSITING - WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_BGC_WINDOW); + WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_BGC_WINDOW); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_NULL, WE_BGC_WINDOW); + WndClass.iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_BGC_WINDOW); #endif WndClass.WinProc = ScrollBarCtrlProc; diff --git a/src/control/scrollview.c b/src/control/scrollview.c index 3a289895..46e20342 100644 --- a/src/control/scrollview.c +++ b/src/control/scrollview.c @@ -598,9 +598,10 @@ BOOL RegisterScrollViewControl (void) WndClass.dwExStyle = WS_EX_NONE; WndClass.hCursor = GetSystemCursor (IDC_ARROW); #ifdef _MGSCHEMA_COMPOSITING - WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_BGC_WINDOW); + WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_BGC_WINDOW); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_NULL, WE_BGC_WINDOW); + WndClass.iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_BGC_WINDOW); #endif WndClass.WinProc = ScrollViewCtrlProc; diff --git a/src/control/scrollwnd.c b/src/control/scrollwnd.c index 95430257..f4e2a30b 100644 --- a/src/control/scrollwnd.c +++ b/src/control/scrollwnd.c @@ -289,7 +289,8 @@ BOOL RegisterScrollWndControl (void) #ifdef _MGSCHEMA_COMPOSITING WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_BGC_WINDOW); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_NULL, WE_BGC_WINDOW); + WndClass.iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_BGC_WINDOW); #endif WndClass.WinProc = ScrollWndCtrlProc; @@ -365,7 +366,8 @@ static BOOL RegisterContainer (void) #ifdef _MGSCHEMA_COMPOSITING WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_BGC_WINDOW); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_NULL, WE_BGC_WINDOW); + WndClass.iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_BGC_WINDOW); #endif WndClass.WinProc = DefaultContainerProc; diff --git a/src/control/static.c b/src/control/static.c index d79794bb..6f6c28ac 100644 --- a/src/control/static.c +++ b/src/control/static.c @@ -83,12 +83,13 @@ StaticControlProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case MSG_CREATE: #ifdef __TARGET_MSTUDIO__ SetWindowBkColor (hwnd, - GetWindowElementPixel (hwnd, WE_MAINC_THREED_BODY)); + GetWindowElementPixelEx (hwnd, + HDC_INVALID, WE_MAINC_THREED_BODY)); #endif pCtrl->dwAddData2 = pCtrl->dwAddData; - SetWindowBkColor (hwnd, GetWindowElementPixel (hwnd, - WE_MAINC_THREED_BODY)); + SetWindowBkColor (hwnd, GetWindowElementPixelEx (hwnd, + HDC_INVALID, WE_MAINC_THREED_BODY)); /* DK[01/11/10]: For bug 4336 */ switch (pCtrl->dwStyle & SS_TYPEMASK) { case SS_GRAYRECT: @@ -354,8 +355,8 @@ BOOL RegisterStaticControl (void) WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_MAINC_THREED_BODY); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_NULL, - WE_MAINC_THREED_BODY); + WndClass.iBkColor = GetWindowElementPixelEx (HWND_NULL, + HDC_SCREEN, WE_MAINC_THREED_BODY); #endif WndClass.WinProc = StaticControlProc; diff --git a/src/control/textedit.c b/src/control/textedit.c index 3dd4dd41..5c770c42 100644 --- a/src/control/textedit.c +++ b/src/control/textedit.c @@ -964,7 +964,7 @@ static void tePaint(HWND hWnd, HDC hdc, RECT *rcDraw) h = ptedata->nLineHeight - 1; if (GetWindowStyle(hWnd) & ES_BASELINE) { - SetPenColor (hdc, GetWindowElementPixel (hWnd, WE_FGC_WINDOW)); + SetPenColor (hdc, GetWindowElementPixelEx (hWnd, hdc, WE_FGC_WINDOW)); while (h < RECTHP(rc)) { #ifdef _TITLE_SUPPORT indent = (h == ptedata->nLineHeight - 1) ? ptedata->titleIndent : 0; @@ -982,21 +982,25 @@ static void setup_dc (HWND hWnd, HDC hdc, BOOL bSel) SetBkColor (hdc, GetWindowBkColor (hWnd)); SetTextColor (hdc, - GetWindowElementPixel (hWnd, GetWindowStyle(hWnd)&WS_DISABLED? - WE_FGC_DISABLED_ITEM : WE_FGC_WINDOW)); + GetWindowElementPixelEx (hWnd, hdc, + (GetWindowStyle(hWnd) & WS_DISABLED) ? + WE_FGC_DISABLED_ITEM : WE_FGC_WINDOW)); } else { SetBkMode (hdc, BM_OPAQUE); SetTextColor (hdc, - GetWindowElementPixel (hWnd, GetWindowStyle(hWnd)&WS_DISABLED? + GetWindowElementPixelEx (hWnd, hdc, + (GetWindowStyle(hWnd) & WS_DISABLED) ? WE_FGC_DISABLED_ITEM : WE_FGC_SELECTED_ITEM)); if (hWnd == GetFocus(GetParent(hWnd))) { - SetBkColor (hdc, GetWindowElementPixel (hWnd, WE_BGC_SELECTED_ITEM)); + SetBkColor (hdc, GetWindowElementPixelEx (hWnd, + hdc, WE_BGC_SELECTED_ITEM)); } else { - SetBkColor (hdc, GetWindowElementPixel (hWnd, WE_BGC_SELECTED_LOSTFOCUS)); + SetBkColor (hdc, GetWindowElementPixelEx (hWnd, + hdc, WE_BGC_SELECTED_LOSTFOCUS)); } } } @@ -3601,7 +3605,8 @@ BOOL RegisterTextEditControl (void) #ifdef _MGSCHEMA_COMPOSITING WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_BGC_WINDOW); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_NULL, WE_BGC_WINDOW); + WndClass.iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_BGC_WINDOW); #endif WndClass.WinProc = TextEditCtrlProc; diff --git a/src/control/trackbar.c b/src/control/trackbar.c index cba95afb..e441f2a5 100644 --- a/src/control/trackbar.c +++ b/src/control/trackbar.c @@ -105,7 +105,8 @@ static void TrackBarOnDraw (HWND hwnd, HDC hdc, TRACKBARDATA* pData, DWORD dwSty SetBkMode (hdc, BM_TRANSPARENT); SetBkColor (hdc, GetWindowBkColor (hwnd)); - SetTextColor (hdc, GetWindowElementPixel (hwnd, WE_FGC_THREED_BODY)); + SetTextColor (hdc, + GetWindowElementPixelEx (hwnd, hdc, WE_FGC_THREED_BODY)); TextOut (hdc, x + 1, y + (h>>1) - (sliderh>>1) - GAP_TIP_SLIDER, pData->sStartTip); @@ -546,8 +547,8 @@ BOOL RegisterTrackBarControl (void) WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_MAINC_THREED_BODY); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_NULL, - WE_MAINC_THREED_BODY); + WndClass.iBkColor = GetWindowElementPixelEx (HWND_NULL, + HDC_SCREEN, WE_MAINC_THREED_BODY); #endif WndClass.WinProc = TrackBarCtrlProc; return AddNewControlClass (&WndClass) == ERR_OK; diff --git a/src/ex_ctrl/animation.c b/src/ex_ctrl/animation.c index 396243fc..889986bd 100644 --- a/src/ex_ctrl/animation.c +++ b/src/ex_ctrl/animation.c @@ -79,7 +79,8 @@ BOOL RegisterAnimationControl (void) #ifdef _MGSCHEMA_COMPOSITING WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_BGC_WINDOW); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_NULL, WE_BGC_WINDOW); + WndClass.iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_BGC_WINDOW); #endif WndClass.WinProc = AnimationCtrlProc; @@ -295,10 +296,11 @@ static void setup_anim_mem_dc (HWND hwnd, ANIMATIONINFO* anim_info) if (GetWindowStyle (hwnd) & ANS_WINBGC) { if (hwnd != HWND_NULL) { - bk_pixel = GetWindowElementPixel (hwnd, WE_BGC_WINDOW); + bk_pixel = GetWindowElementPixelEx (hwnd, hdc, WE_BGC_WINDOW); } else { - bk_pixel = GetWindowElementPixel (HWND_DESKTOP, WE_BGC_DESKTOP); + bk_pixel = GetWindowElementPixelEx (HWND_DESKTOP, + hdc, WE_BGC_DESKTOP); } } else { diff --git a/src/ex_ctrl/coolbar.c b/src/ex_ctrl/coolbar.c index 161a949f..1aa0872f 100644 --- a/src/ex_ctrl/coolbar.c +++ b/src/ex_ctrl/coolbar.c @@ -85,8 +85,8 @@ BOOL RegisterCoolBarControl (void) WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_MAINC_THREED_BODY); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_DESKTOP, - WE_MAINC_THREED_BODY); + WndClass.iBkColor = GetWindowElementPixelEx (HWND_DESKTOP, + HDC_SCREEN, WE_MAINC_THREED_BODY); #endif WndClass.WinProc = CoolBarCtrlProc; diff --git a/src/ex_ctrl/gridview.c b/src/ex_ctrl/gridview.c index c8329b30..dc8982d8 100644 --- a/src/ex_ctrl/gridview.c +++ b/src/ex_ctrl/gridview.c @@ -2532,7 +2532,8 @@ BOOL RegisterGridViewControl (void) #ifdef _MGSCHEMA_COMPOSITING WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_BGC_WINDOW); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_NULL, WE_BGC_WINDOW); + WndClass.iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_BGC_WINDOW); #endif WndClass.WinProc = GridViewCtrlProc; diff --git a/src/ex_ctrl/gridviewcelltype.c b/src/ex_ctrl/gridviewcelltype.c index 88ee4bfd..4b84e9e5 100644 --- a/src/ex_ctrl/gridviewcelltype.c +++ b/src/ex_ctrl/gridviewcelltype.c @@ -503,15 +503,11 @@ void GridCellTypeTableHeader_get_format(gvGridCellData* cell, HWND hWnd, HDC hdc memset(format, 0, sizeof(GridCellFormat)); format->mask = 0; - //format->color_bg = GetWindowElementColor (BKC_BUTTON_DEF); - //format->hl_color_bg = GetWindowElementColor (BKC_HILIGHT_NORMAL); format->color_bg = GetWindowElementPixelEx(hWnd, hdc, WE_MAINC_THREED_BODY); format->hl_color_bg = GetWindowElementPixelEx(hWnd, hdc, WE_BGC_HIGHLIGHT_ITEM); if(cell->mask & GVITEM_BGCOLOR) format->color_bg = format->hl_color_bg = cell->data.header.color_bg; - //format->color_fg = GetWindowElementColor (FGC_BUTTON_NORMAL); - //format->hl_color_fg = GetWindowElementColor (FGC_HILIGHT_NORMAL); format->color_fg = GetWindowElementPixelEx(hWnd, hdc, WE_FGC_THREED_BODY); format->hl_color_fg = GetWindowElementPixelEx(hWnd, hdc, WE_FGC_HIGHLIGHT_ITEM); if(cell->mask & GVITEM_FGCOLOR) @@ -709,15 +705,11 @@ void GridCellTypeHeader_get_format(gvGridCellData* cell, HWND hWnd, HDC hdc, Gri memset(format, 0, sizeof(GridCellFormat)); format->mask = 0; - // format->color_bg = GetWindowElementColor (BKC_BUTTON_DEF); - // format->hl_color_bg = GetWindowElementColor (BKC_HILIGHT_NORMAL); format->color_bg = GetWindowElementPixelEx(hWnd, hdc, WE_MAINC_THREED_BODY); format->hl_color_bg = GetWindowElementPixelEx(hWnd, hdc, WE_BGC_HIGHLIGHT_ITEM); if(cell->mask & GVITEM_BGCOLOR) format->color_bg = format->hl_color_bg = cell->data.header.color_bg; - //format->color_fg = GetWindowElementColor (FGC_BUTTON_NORMAL); - //format->hl_color_fg = GetWindowElementColor (FGC_HILIGHT_NORMAL); format->color_fg = GetWindowElementPixelEx(hWnd, hdc, WE_FGC_THREED_BODY); format->hl_color_fg = GetWindowElementPixelEx(hWnd, hdc, WE_FGC_THREED_BODY); if(cell->mask & GVITEM_FGCOLOR) @@ -870,8 +862,6 @@ void GridCellTypeText_get_format(gvGridCellData* cell, HWND hWnd, HDC hdc, GridC memset(format, 0, sizeof(GridCellFormat)); format->mask = 0; - // format->color_bg = GetWindowElementColor (BKC_EDIT_DEF); - // format->hl_color_bg = GetWindowElementColor (BKC_HILIGHT_NORMAL); format->color_bg = GetWindowElementPixelEx(hWnd, hdc, WE_BGC_WINDOW); format->hl_color_bg = GetWindowElementPixelEx(hWnd, hdc, WE_BGC_HIGHLIGHT_ITEM); if(cell->mask & GVITEM_BGCOLOR) { @@ -879,8 +869,6 @@ void GridCellTypeText_get_format(gvGridCellData* cell, HWND hWnd, HDC hdc, GridC format->hl_color_bg = ~cell->data.text.color_bg; } - // format->color_fg = GetWindowElementColor (FGC_CONTROL_NORMAL); - // format->hl_color_fg = GetWindowElementColor (FGC_HILIGHT_NORMAL); format->color_fg = GetWindowElementPixelEx(hWnd, hdc, WE_FGC_WINDOW); format->hl_color_fg = GetWindowElementPixelEx(hWnd, hdc, WE_FGC_HIGHLIGHT_ITEM); if(cell->mask & GVITEM_FGCOLOR) { @@ -1133,8 +1121,6 @@ void GridCellTypeNumber_get_format(gvGridCellData* cell, HWND hWnd, HDC hdc, Gri memset(format, 0, sizeof(GridCellFormat)); format->mask = 0; - // format->color_bg = GetWindowElementColor (BKC_EDIT_DEF); - // format->hl_color_bg = GetWindowElementColor (BKC_HILIGHT_NORMAL); format->color_bg = GetWindowElementPixelEx(hWnd, hdc, WE_BGC_WINDOW); format->hl_color_bg = GetWindowElementPixelEx(hWnd, hdc, WE_BGC_HIGHLIGHT_ITEM); if(cell->mask & GVITEM_BGCOLOR) { @@ -1142,8 +1128,6 @@ void GridCellTypeNumber_get_format(gvGridCellData* cell, HWND hWnd, HDC hdc, Gri format->hl_color_bg = ~cell->data.number.color_bg; } - // format->color_fg = GetWindowElementColor (FGC_CONTROL_NORMAL); - // format->hl_color_fg = GetWindowElementColor (FGC_HILIGHT_NORMAL); format->color_fg = GetWindowElementPixelEx(hWnd, hdc, WE_FGC_WINDOW); format->hl_color_fg = GetWindowElementPixelEx(hWnd, hdc, WE_FGC_HIGHLIGHT_ITEM); if(cell->mask & GVITEM_FGCOLOR) { @@ -1315,8 +1299,6 @@ void GridCellTypeCheckBox_get_format(gvGridCellData* cell, HWND hWnd, HDC hdc, G memset(format, 0, sizeof(GridCellFormat)); format->mask = 0; - //format->color_bg = GetWindowElementColor (BKC_CONTROL_DEF); - //format->hl_color_bg = GetWindowElementColor (BKC_HILIGHT_NORMAL); format->color_bg = GetWindowElementPixelEx(hWnd, hdc, WE_MAINC_THREED_BODY); format->hl_color_bg = GetWindowElementPixelEx(hWnd, hdc, WE_BGC_HIGHLIGHT_ITEM); if(cell->mask & GVITEM_BGCOLOR) { @@ -1324,8 +1306,6 @@ void GridCellTypeCheckBox_get_format(gvGridCellData* cell, HWND hWnd, HDC hdc, G format->hl_color_bg = ~cell->data.checkbox.color_bg; } - //format->color_fg = GetWindowElementColor (FGC_CONTROL_NORMAL); - //format->hl_color_fg = GetWindowElementColor (FGC_HILIGHT_NORMAL); format->color_fg = GetWindowElementPixelEx(hWnd, hdc, WE_FGC_THREED_BODY); format->hl_color_fg = GetWindowElementPixelEx(hWnd, hdc, WE_FGC_HIGHLIGHT_ITEM); if(cell->mask & GVITEM_FGCOLOR) { @@ -1582,8 +1562,6 @@ void GridCellTypeSelection_get_format(gvGridCellData* cell, HWND hWnd, HDC hdc, memset(format, 0, sizeof(GridCellFormat)); format->mask = 0; - //format->color_bg = GetWindowElementColor (BKC_CONTROL_DEF); - //format->hl_color_bg = GetWindowElementColor (BKC_HILIGHT_NORMAL); format->color_bg = GetWindowElementPixelEx(hWnd, hdc, WE_MAINC_THREED_BODY); format->hl_color_bg = GetWindowElementPixelEx(hWnd, hdc, WE_BGC_HIGHLIGHT_ITEM); if(cell->mask & GVITEM_BGCOLOR) { @@ -1591,8 +1569,6 @@ void GridCellTypeSelection_get_format(gvGridCellData* cell, HWND hWnd, HDC hdc, format->hl_color_bg = ~cell->data.selection.color_bg; } - //format->color_fg = GetWindowElementColor (FGC_CONTROL_NORMAL); - //format->hl_color_fg = GetWindowElementColor (FGC_HILIGHT_NORMAL); format->color_fg = GetWindowElementPixelEx(hWnd, hdc, WE_FGC_THREED_BODY); format->hl_color_fg = GetWindowElementPixelEx(hWnd, hdc, WE_FGC_HIGHLIGHT_ITEM); if(cell->mask & GVITEM_FGCOLOR) { diff --git a/src/ex_ctrl/iconview.c b/src/ex_ctrl/iconview.c index 103548a5..91574145 100644 --- a/src/ex_ctrl/iconview.c +++ b/src/ex_ctrl/iconview.c @@ -380,12 +380,12 @@ static void ivDrawItem (HWND hWnd, GHANDLE hivi, HDC hdc, RECT *rcDraw) SetBkMode (hdc, BM_TRANSPARENT); if (iconview_is_item_hilight(hWnd, hivi)) { - SetTextColor (hdc, GetWindowElementPixel (hWnd, WE_FGC_HIGHLIGHT_ITEM)); + SetTextColor (hdc, GetWindowElementPixelEx (hWnd, hdc, WE_FGC_HIGHLIGHT_ITEM)); win_info->we_rdr->draw_hilite_item (hWnd, hdc, rcDraw, GetWindowElementAttr (hWnd, WE_BGC_HIGHLIGHT_ITEM)); } else { - SetTextColor (hdc, GetWindowElementPixel (hWnd, WE_FGC_WINDOW)); + SetTextColor (hdc, GetWindowElementPixelEx (hWnd, hdc, WE_FGC_WINDOW)); // win_info->we_rdr->draw_normal_item (hWnd, hdc, rcDraw, // GetWindowElementAttr (hWnd, WE_BGC_WINDOW)); } @@ -726,7 +726,8 @@ BOOL RegisterIconViewControl (void) #ifdef _MGSCHEMA_COMPOSITING WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_BGC_WINDOW); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_NULL, WE_BGC_WINDOW); + WndClass.iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_BGC_WINDOW); #endif WndClass.WinProc = IconViewCtrlProc; diff --git a/src/ex_ctrl/listview.c b/src/ex_ctrl/listview.c index e0e18e4d..7f013e34 100644 --- a/src/ex_ctrl/listview.c +++ b/src/ex_ctrl/listview.c @@ -1290,9 +1290,9 @@ static void setup_color (HWND hWnd, PLVDATA plvdata) { int color; - color = (GetFocusChild(GetParent(hWnd)) == hWnd) ? - WE_BGC_SELECTED_ITEM: WE_BGC_SELECTED_LOSTFOCUS; - plvdata->bkc_selected = GetWindowElementPixel (hWnd, color); + color = (GetFocusChild (GetParent(hWnd)) == hWnd) ? + WE_BGC_SELECTED_ITEM : WE_BGC_SELECTED_LOSTFOCUS; + plvdata->bkc_selected = GetWindowElementPixelEx (hWnd, HDC_INVALID, color); } static SVITEMOPS listview_iops = @@ -2202,7 +2202,8 @@ BOOL RegisterListViewControl (void) #ifdef _MGSCHEMA_COMPOSITING WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_BGC_WINDOW); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_NULL, WE_BGC_WINDOW); + WndClass.iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_BGC_WINDOW); #endif WndClass.WinProc = ListViewCtrlProc; diff --git a/src/ex_ctrl/monthcalendar.c b/src/ex_ctrl/monthcalendar.c index ffccbcaa..8ba71beb 100644 --- a/src/ex_ctrl/monthcalendar.c +++ b/src/ex_ctrl/monthcalendar.c @@ -95,22 +95,22 @@ #define ARROW_BORDER 10 // color info -#define MCCLR_DF_TITLEBK GetWindowElementPixel(hWnd, WE_MAINC_THREED_BODY) -#define MCCLR_DF_TITLETEXT GetWindowElementPixel(hWnd, WE_FGC_THREED_BODY) +#define MCCLR_DF_TITLEBK GetWindowElementPixelEx(hWnd, HDC_INVALID, WE_MAINC_THREED_BODY) +#define MCCLR_DF_TITLETEXT GetWindowElementPixelEx(hWnd, HDC_INVALID, WE_FGC_THREED_BODY) -#define MCCLR_DF_ARROW GetWindowElementPixel(hWnd, WE_FGC_WINDOW) -#define MCCLR_DF_ARROWHIBK GetWindowElementPixel(hWnd, WE_BGC_WINDOW) +#define MCCLR_DF_ARROW GetWindowElementPixelEx(hWnd, HDC_INVALID, WE_FGC_WINDOW) +#define MCCLR_DF_ARROWHIBK GetWindowElementPixelEx(hWnd, HDC_INVALID, WE_BGC_WINDOW) -#define MCCLR_DF_DAYBK GetWindowElementPixel(hWnd, WE_BGC_WINDOW) -#define MCCLR_DF_DAYTEXT GetWindowElementPixel(hWnd, WE_FGC_WINDOW) +#define MCCLR_DF_DAYBK GetWindowElementPixelEx(hWnd, HDC_INVALID, WE_BGC_WINDOW) +#define MCCLR_DF_DAYTEXT GetWindowElementPixelEx(hWnd, HDC_INVALID, WE_FGC_WINDOW) -#define MCCLR_DF_DAYHIBK GetWindowElementPixel(hWnd, WE_BGC_HIGHLIGHT_ITEM) -#define MCCLR_DF_DAYHITEXT GetWindowElementPixel(hWnd, WE_FGC_HIGHLIGHT_ITEM) +#define MCCLR_DF_DAYHIBK GetWindowElementPixelEx(hWnd, HDC_INVALID, WE_BGC_HIGHLIGHT_ITEM) +#define MCCLR_DF_DAYHITEXT GetWindowElementPixelEx(hWnd, HDC_INVALID, WE_FGC_HIGHLIGHT_ITEM) -#define MCCLR_DF_TRAILINGTEXT GetWindowElementPixel(hWnd, WE_FGC_DISABLED_ITEM) +#define MCCLR_DF_TRAILINGTEXT GetWindowElementPixelEx(hWnd, HDC_INVALID, WE_FGC_DISABLED_ITEM) -#define MCCLR_DF_WEEKCAPTBK GetWindowElementPixel(hWnd, WE_BGC_HIGHLIGHT_ITEM) -#define MCCLR_DF_WEEKCAPTTEXT GetWindowElementPixel(hWnd, WE_FGC_HIGHLIGHT_ITEM) +#define MCCLR_DF_WEEKCAPTBK GetWindowElementPixelEx(hWnd, HDC_INVALID, WE_BGC_HIGHLIGHT_ITEM) +#define MCCLR_DF_WEEKCAPTTEXT GetWindowElementPixelEx(hWnd, HDC_INVALID, WE_FGC_HIGHLIGHT_ITEM) static LRESULT MonthCalendarCtrlProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); @@ -125,7 +125,8 @@ BOOL RegisterMonthCalendarControl (void) #ifdef _MGSCHEMA_COMPOSITING WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_BGC_WINDOW); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_DESKTOP, WE_BGC_WINDOW); + WndClass.iBkColor = + GetWindowElementPixelEx (HWND_DESKTOP, HDC_SCREEN, WE_BGC_WINDOW); #endif WndClass.WinProc = MonthCalendarCtrlProc; @@ -439,7 +440,7 @@ static void mcHilightRect (HWND hWnd, PMONCALDDATA mc_data, HDC hdc, RECT* prcIt item_w = prcItem->right - prcItem->left; item_h = prcItem->bottom - prcItem->top; FillBox (hdc, prcItem->left, prcItem->top, item_w, item_h); - SetPenColor(hdc, GetWindowElementPixel (hWnd, WE_MAINC_THREED_BODY)); + SetPenColor(hdc, GetWindowElementPixelEx (hWnd, hdc, WE_MAINC_THREED_BODY)); Rectangle (hdc, prcItem->left, prcItem->top, prcItem->left+item_w-1, prcItem->top+item_h-1); if (day < 10) sprintf (daytext, " %d", day); @@ -515,7 +516,8 @@ static void mcDrawMonthDay (HWND hWnd, HDC hdc, RECT* prcMDay, PMONCALDDATA mc_d FillBox (hdc, rcMonthDay.left, rcMonthDay.top, mc_data->item_w, mc_data->item_h); - SetPenColor(hdc, GetWindowElementPixel (hWnd, WE_MAINC_THREED_BODY)); + SetPenColor(hdc, + GetWindowElementPixelEx (hWnd, hdc, WE_MAINC_THREED_BODY)); Rectangle (hdc, rcMonthDay.left, rcMonthDay.top, rcMonthDay.left+mc_data->item_w-1 , rcMonthDay.top+mc_data->item_h-1); @@ -780,16 +782,16 @@ static BOOL mcInitMonthCalendarData (HWND hWnd, MONCALDDATA* mc_data) // color info pmcci = (PMCCOLORINFO) mc_data->dwClrData; - pmcci->clr_titlebk = MCCLR_DF_TITLEBK; - pmcci->clr_titletext = MCCLR_DF_TITLETEXT; - pmcci->clr_arrow = MCCLR_DF_ARROW; - pmcci->clr_arrowHibk = MCCLR_DF_ARROWHIBK; + pmcci->clr_titlebk = MCCLR_DF_TITLEBK; + pmcci->clr_titletext = MCCLR_DF_TITLETEXT; + pmcci->clr_arrow = MCCLR_DF_ARROW; + pmcci->clr_arrowHibk = MCCLR_DF_ARROWHIBK; pmcci->clr_daybk = MCCLR_DF_DAYBK; - pmcci->clr_dayHibk = MCCLR_DF_DAYHIBK; - pmcci->clr_daytext = MCCLR_DF_DAYTEXT; - pmcci->clr_trailingtext = MCCLR_DF_TRAILINGTEXT; + pmcci->clr_dayHibk = MCCLR_DF_DAYHIBK; + pmcci->clr_daytext = MCCLR_DF_DAYTEXT; + pmcci->clr_trailingtext = MCCLR_DF_TRAILINGTEXT; pmcci->clr_dayHitext = MCCLR_DF_DAYHITEXT; - pmcci->clr_weekcaptbk = MCCLR_DF_WEEKCAPTBK; + pmcci->clr_weekcaptbk = MCCLR_DF_WEEKCAPTBK; pmcci->clr_weekcapttext = MCCLR_DF_WEEKCAPTTEXT; mc_data->customed_day = 0; diff --git a/src/ex_ctrl/spinbox.c b/src/ex_ctrl/spinbox.c index 2016316a..24529963 100644 --- a/src/ex_ctrl/spinbox.c +++ b/src/ex_ctrl/spinbox.c @@ -414,7 +414,8 @@ BOOL RegisterSpinControl (void) #ifdef _MGSCHEMA_COMPOSITING WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_BGC_WINDOW); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_NULL, WE_BGC_WINDOW); + WndClass.iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_BGC_WINDOW); #endif WndClass.WinProc = SpinCtrlProc; diff --git a/src/ex_ctrl/treeview.c b/src/ex_ctrl/treeview.c index aebde0db..03c2eddb 100644 --- a/src/ex_ctrl/treeview.c +++ b/src/ex_ctrl/treeview.c @@ -115,7 +115,8 @@ BOOL RegisterTreeViewControl (void) #ifdef _MGSCHEMA_COMPOSITING WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_BGC_WINDOW); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_NULL, WE_BGC_WINDOW); + WndClass.iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_BGC_WINDOW); #endif WndClass.WinProc = TreeViewCtrlProc; @@ -652,8 +653,8 @@ static void tvDrawItem (HWND hWnd, HDC hdc, PTVDATA pData, int centerX, int cent if (p->dwFlags & TVIF_SELECTED) { SetBkMode (hdc, BM_OPAQUE); - SetBkColor (hdc, GetWindowElementColorEx (hWnd, BKC_HILIGHT_NORMAL)); - SetTextColor (hdc, GetWindowElementColorEx (hWnd, FGC_HILIGHT_NORMAL)); + SetBkColor (hdc, GetWindowElementPixelEx (hWnd, hdc, BKC_HILIGHT_NORMAL)); + SetTextColor (hdc, GetWindowElementPixelEx (hWnd, hdc, FGC_HILIGHT_NORMAL)); TextOut (hdc, centerX, centerY - (h>>1), p->text); #ifndef _GRAY_SCREEN if (pData->dwStyle & TVS_FOCUS) { @@ -665,7 +666,7 @@ static void tvDrawItem (HWND hWnd, HDC hdc, PTVDATA pData, int centerX, int cent } else { SetBkMode (hdc, BM_TRANSPARENT); SetBkColor (hdc, GetWindowBkColor (hWnd)); - SetTextColor (hdc, GetWindowElementColorEx (hWnd, FGC_CONTROL_NORMAL)); + SetTextColor (hdc, GetWindowElementPixelEx (hWnd, hdc, FGC_CONTROL_NORMAL)); TextOut (hdc, centerX, centerY - (h>>1), p->text); } } diff --git a/src/ex_ctrl/treeview_rdr.c b/src/ex_ctrl/treeview_rdr.c index 003bbead..557f6291 100644 --- a/src/ex_ctrl/treeview_rdr.c +++ b/src/ex_ctrl/treeview_rdr.c @@ -87,7 +87,8 @@ BOOL RegisterTreeViewRdrControl (void) #ifdef _MGSCHEMA_COMPOSITING WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_BGC_WINDOW); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_NULL, WE_BGC_WINDOW); + WndClass.iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_BGC_WINDOW); #endif WndClass.WinProc = TreeViewCtrlProc; @@ -626,8 +627,8 @@ static void tvDrawItem (HWND hWnd, HDC hdc, PTVDATA pData, int centerX, if (p->dwFlags & TVIF_SELECTED) { SetBkMode (hdc, BM_OPAQUE); - SetBkColor (hdc, GetWindowElementPixel (hWnd, WE_BGC_HIGHLIGHT_ITEM)); - SetTextColor (hdc, GetWindowElementPixel (hWnd, WE_FGC_HIGHLIGHT_ITEM)); + SetBkColor (hdc, GetWindowElementPixelEx (hWnd, hdc, WE_BGC_HIGHLIGHT_ITEM)); + SetTextColor (hdc, GetWindowElementPixelEx (hWnd, hdc, WE_FGC_HIGHLIGHT_ITEM)); rc.left = centerX; rc.top = centerY - (h>>1); @@ -644,7 +645,7 @@ static void tvDrawItem (HWND hWnd, HDC hdc, PTVDATA pData, int centerX, } else { SetBkMode (hdc, BM_TRANSPARENT); SetBkColor (hdc, GetWindowBkColor (hWnd)); - SetTextColor (hdc, GetWindowElementPixel (hWnd, WE_FGC_WINDOW)); + SetTextColor (hdc, GetWindowElementPixelEx (hWnd, hdc, WE_FGC_WINDOW)); TextOut (hdc, centerX, centerY - (h>>1), p->text); } diff --git a/src/gui/dialog.c b/src/gui/dialog.c index 5814c20f..6d0b6d3e 100644 --- a/src/gui/dialog.c +++ b/src/gui/dialog.c @@ -111,7 +111,7 @@ HWND GUIAPI CreateMainWindowIndirectParamEx (PDLGTEMPLATE pDlgTemplate, CreateInfo.rx = pDlgTemplate->x + pDlgTemplate->w; CreateInfo.by = pDlgTemplate->y + pDlgTemplate->h; CreateInfo.iBkColor = - GetWindowElementPixel (HWND_NULL, WE_MAINC_THREED_BODY); + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_MAINC_THREED_BODY); CreateInfo.dwAddData = pDlgTemplate->dwAddData; CreateInfo.hHosting = hOwner; diff --git a/src/gui/lf_classic.c b/src/gui/lf_classic.c index e200d17c..fdb28978 100644 --- a/src/gui/lf_classic.c +++ b/src/gui/lf_classic.c @@ -2272,9 +2272,9 @@ static void draw_border (HWND hWnd, HDC hdc, BOOL is_active) return ; if(is_active) - border_color = GetWindowElementPixelEx(hWnd, hdc, WE_FGC_ACTIVE_WND_BORDER); + border_color = GetWindowElementPixelEx (hWnd, hdc, WE_FGC_ACTIVE_WND_BORDER); else - border_color = GetWindowElementPixelEx(hWnd, hdc, WE_FGC_INACTIVE_WND_BORDER); + border_color = GetWindowElementPixelEx (hWnd, hdc, WE_FGC_INACTIVE_WND_BORDER); win_info = GetWindowInfo(hWnd); @@ -2420,11 +2420,11 @@ static void draw_caption (HWND hWnd, HDC hdc, BOOL is_active) if (!(win_info->dwStyle & WS_CAPTION)) return; - active_color = GetWindowElementPixelEx(hWnd, hdc, WE_BGCA_ACTIVE_CAPTION); - inactive_color = GetWindowElementPixelEx(hWnd, hdc, WE_BGCA_INACTIVE_CAPTION); - text_active_color = GetWindowElementPixelEx(hWnd, hdc, WE_FGC_ACTIVE_CAPTION); - text_inact_color = GetWindowElementPixelEx(hWnd, hdc, WE_FGC_INACTIVE_CAPTION); - cap_font = (PLOGFONT)GetWindowElementAttr(hWnd, WE_FONT_CAPTION); + active_color = GetWindowElementPixelEx (hWnd, hdc, WE_BGCA_ACTIVE_CAPTION); + inactive_color = GetWindowElementPixelEx (hWnd, hdc, WE_BGCA_INACTIVE_CAPTION); + text_active_color = GetWindowElementPixelEx (hWnd, hdc, WE_FGC_ACTIVE_CAPTION); + text_inact_color = GetWindowElementPixelEx (hWnd, hdc, WE_FGC_INACTIVE_CAPTION); + cap_font = (PLOGFONT)GetWindowElementAttr (hWnd, WE_FONT_CAPTION); if (calc_we_area(hWnd, HT_CAPTION, &rect) == -1) return; @@ -2969,7 +2969,7 @@ static void draw_trackbar_thumb (HWND hWnd, HDC hdc, GetWindowInfo(hWnd)->we_rdr->draw_3dbox (hdc, &rc_draw, color_thumb, tbstatus); - SetPenColor (hdc, GetWindowElementPixel (hWnd, WE_FGC_THREED_BODY)); + SetPenColor (hdc, GetWindowElementPixelEx (hWnd, hdc, WE_FGC_THREED_BODY)); if (dwStyle & TBS_VERTICAL) { MoveTo (hdc, sliderx + (sliderw >> 1) - 3 - 1, slidery + (sliderh >> 1)); @@ -3125,7 +3125,7 @@ draw_trackbar (HWND hWnd, HDC hdc, LFRDR_TRACKBARINFO *info) /* draw the tick of trackbar. */ if (!(dwStyle & TBS_NOTICK)) { - SetPenColor (hdc, GetWindowElementPixel (hWnd, WE_FGC_THREED_BODY)); + SetPenColor (hdc, GetWindowElementPixelEx (hWnd, hdc, WE_FGC_THREED_BODY)); if (dwStyle & TBS_VERTICAL) { TickStart = y + (HEIGHT_VERT_SLIDER >> 1); fTickGap = itofix (h - HEIGHT_VERT_SLIDER); @@ -3364,7 +3364,7 @@ draw_progress (HWND hWnd, HDC hdc, old_color = SetBrushColor (hdc, GetWindowBkColor (hWnd)); else old_color = SetBrushColor (hdc, - GetWindowElementPixel (HWND_DESKTOP, WE_BGC_DESKTOP)); + GetWindowElementPixelEx (HWND_DESKTOP, hdc, WE_BGC_DESKTOP)); //draw the erase background FillBox (hdc, rcClient.left + 1, rcClient.top + 1, RECTW (rcClient) - 2, RECTH (rcClient) - 2); @@ -3384,7 +3384,7 @@ draw_progress (HWND hWnd, HDC hdc, nRem = ndiv_progress.rem; SetBrushColor (hdc, - GetWindowElementPixel (hWnd, WE_BGC_HIGHLIGHT_ITEM)); + GetWindowElementPixelEx (hWnd, hdc, WE_BGC_HIGHLIGHT_ITEM)); if (whOne >= 4) { if (fVertical) { @@ -3440,15 +3440,15 @@ draw_progress (HWND hWnd, HDC hdc, rc_clip.right = prog; SelectClipRect (hdc, &rc_clip); SetTextColor (hdc, - GetWindowElementPixel (hWnd, WE_FGC_HIGHLIGHT_ITEM)); + GetWindowElementPixelEx (hWnd, hdc, WE_FGC_HIGHLIGHT_ITEM)); SetBkColor (hdc, - GetWindowElementPixel (hWnd, WE_BGC_HIGHLIGHT_ITEM)); + GetWindowElementPixelEx (hWnd, hdc, WE_BGC_HIGHLIGHT_ITEM)); TextOut (hdc, x, y, szText); rc_clip.right = rcClient.right; rc_clip.left = prog; SelectClipRect (hdc, &rc_clip); - SetTextColor (hdc, GetWindowElementPixel (hWnd, WE_FGC_WINDOW)); + SetTextColor (hdc, GetWindowElementPixelEx (hWnd, hdc, WE_FGC_WINDOW)); SetBkColor (hdc, GetWindowBkColor (hWnd)); TextOut (hdc, x, y, szText); } diff --git a/src/gui/lf_common.h b/src/gui/lf_common.h index 45243065..10a42c75 100644 --- a/src/gui/lf_common.h +++ b/src/gui/lf_common.h @@ -162,7 +162,7 @@ static inline void erase_bkgnd (HWND hWnd, HDC hdc, const RECT *rect) old_color = SetBrushColor (hdc, GetWindowBkColor (hWnd)); else old_color = SetBrushColor (hdc, - GetWindowElementPixel (HWND_DESKTOP, WE_BGC_DESKTOP)); + GetWindowElementPixelEx (HWND_DESKTOP, hdc, WE_BGC_DESKTOP)); FillBox(hdc, rect->left, rect->top, RECTWP(rect), RECTHP(rect)); SetBrushColor (hdc, old_color); diff --git a/src/gui/lf_fashion.c b/src/gui/lf_fashion.c index 71fc916c..d3dd9db4 100644 --- a/src/gui/lf_fashion.c +++ b/src/gui/lf_fashion.c @@ -4104,7 +4104,7 @@ draw_trackbar (HWND hWnd, HDC hdc, LFRDR_TRACKBARINFO *info) /* draw the tick of trackbar. */ if (!(dwStyle & TBS_NOTICK)) { - SetPenColor (hdc, GetWindowElementPixel (hWnd, WE_FGC_THREED_BODY)); + SetPenColor (hdc, GetWindowElementPixelEx (hWnd, hdc, WE_FGC_THREED_BODY)); if (dwStyle & TBS_VERTICAL) { TickStart = y + (HEIGHT_VERT_SLIDER >> 1); //TickGap = (h - HEIGHT_VERT_SLIDER) / (float)(max - min) * TickFreq; @@ -4489,7 +4489,7 @@ draw_progress (HWND hWnd, HDC hdc, x += ((w - text_ext.cx) >> 1) + 1; y += ((h - text_ext.cy) >> 1); - SetTextColor (hdc, GetWindowElementPixel (hWnd, WE_BGCB_ACTIVE_CAPTION)); + SetTextColor (hdc, GetWindowElementPixelEx (hWnd, hdc, WE_BGCB_ACTIVE_CAPTION)); TextOut (hdc, x, y, szText); } diff --git a/src/gui/lf_flat.c b/src/gui/lf_flat.c index 36cdb3b5..5a92ef6d 100644 --- a/src/gui/lf_flat.c +++ b/src/gui/lf_flat.c @@ -573,7 +573,8 @@ static void draw_3dbox (HDC hdc, const RECT* pRect, DWORD color, DWORD flag) /*draw outer frame*/ //dark_color = calc_3dbox_color (color, LFRDR_3DBOX_COLOR_DARKEST); - old_pen_color = SetPenColor (hdc, GetWindowElementColor (WE_FGC_THREED_BODY)); + old_pen_color = SetPenColor (hdc, + GetWindowElementPixelEx (HWND_NULL, hdc, WE_FGC_THREED_BODY)); Rectangle (hdc, pRect->left, pRect->top, pRect->right - 1, pRect->bottom - 1); @@ -1210,7 +1211,7 @@ static void check_frame (HDC hdc, int x0, int y0, int x1, int y1) x1-=1; y1-=1; - pen_clr = GetWindowElementColor (WE_FGC_THREED_BODY); + pen_clr = GetWindowElementPixelEx (HWND_NULL, hdc, WE_FGC_THREED_BODY); old_pen_clr = SetPenColor (hdc, pen_clr); MoveTo (hdc, x1-4, y0+2); @@ -1246,7 +1247,8 @@ static void normal_frame (HDC hdc, int x0, int y0, int x1, int y1) x1-=1; y1-=1; - old_pen_clr = SetPenColor (hdc, GetWindowElementColor (WE_FGC_THREED_BODY)); + old_pen_clr = SetPenColor (hdc, + GetWindowElementPixelEx (HWND_NULL, hdc, WE_FGC_THREED_BODY)); MoveTo (hdc, x1, y0+4); LineTo (hdc, x1, y1-4); @@ -1268,7 +1270,8 @@ static void DrawFlatControlFrameEx (HDC hdc, int x0, int y0, int x1, int y1) { gal_pixel old_color; - old_color = SetPenColor (hdc, GetWindowElementColor (WE_FGC_THREED_BODY)); + old_color = SetPenColor (hdc, + GetWindowElementPixelEx (HWND_NULL, hdc, WE_FGC_THREED_BODY)); x1-=1; y1-=1; @@ -2740,8 +2743,8 @@ static void draw_scrollbar (HWND hWnd, HDC hdc, int sb_pos) fgc_3d = GetWindowElementAttr(hWnd, WE_FGC_THREED_BODY); fgc_dis = GetWindowElementAttr(hWnd, WE_FGC_DISABLED_ITEM); - SetPenColor (hdc, GetWindowElementPixel(hWnd, WE_FGC_THREED_BODY)); - SetBrushColor (hdc, GetWindowElementPixel (hWnd, WE_MAINC_THREED_BODY)); + SetPenColor (hdc, GetWindowElementPixelEx (hWnd, hdc, WE_FGC_THREED_BODY)); + SetBrushColor (hdc, GetWindowElementPixelEx (hWnd, hdc, WE_MAINC_THREED_BODY)); if (0 == strncasecmp(CTRL_SCROLLBAR, GetClassName(hWnd), strlen(CTRL_SCROLLBAR))) { @@ -2927,7 +2930,7 @@ static void draw_trackbar_thumb (HWND hWnd, HDC hdc, win_info->we_rdr->draw_3dbox (hdc, &rc_draw, color_thumb, tbstatus); - SetPenColor (hdc, GetWindowElementPixel (hWnd, WE_FGC_THREED_BODY)); + SetPenColor (hdc, GetWindowElementPixelEx (hWnd, hdc, WE_FGC_THREED_BODY)); if (dwStyle & TBS_VERTICAL) { MoveTo (hdc, sliderx + (sliderw >> 1) - 3 - 1, slidery + (sliderh >> 1)); @@ -3083,7 +3086,7 @@ draw_trackbar (HWND hWnd, HDC hdc, LFRDR_TRACKBARINFO *info) /* draw the tick of trackbar. */ if (!(dwStyle & TBS_NOTICK)) { - SetPenColor (hdc, GetWindowElementPixel (hWnd, WE_FGC_THREED_BODY)); + SetPenColor (hdc, GetWindowElementPixelEx (hWnd, hdc, WE_FGC_THREED_BODY)); if (dwStyle & TBS_VERTICAL) { TickStart = y + (HEIGHT_VERT_SLIDER >> 1); TickEnd = y + h - (HEIGHT_VERT_SLIDER >> 1); @@ -3327,7 +3330,7 @@ draw_progress (HWND hWnd, HDC hdc, old_color = SetBrushColor (hdc, GetWindowBkColor (hWnd)); else old_color = SetBrushColor (hdc, - GetWindowElementPixel (HWND_DESKTOP, WE_BGC_DESKTOP)); + GetWindowElementPixelEx (HWND_DESKTOP, hdc, WE_BGC_DESKTOP)); FillBox (hdc, rcClient.left + 1, rcClient.top + 1, RECTW (rcClient), RECTH (rcClient)); SetBrushColor (hdc, old_color); @@ -3346,7 +3349,7 @@ draw_progress (HWND hWnd, HDC hdc, nRem = ndiv_progress.rem; SetBrushColor (hdc, - GetWindowElementPixel (hWnd, WE_BGC_HIGHLIGHT_ITEM)); + GetWindowElementPixelEx (hWnd, hdc, WE_BGC_HIGHLIGHT_ITEM)); if (whOne >= 4) { if (fVertical) { @@ -3401,15 +3404,15 @@ draw_progress (HWND hWnd, HDC hdc, rc_clip.right = prog; SelectClipRect (hdc, &rc_clip); SetTextColor (hdc, - GetWindowElementPixel (hWnd, WE_FGC_HIGHLIGHT_ITEM)); + GetWindowElementPixelEx (hWnd, hdc, WE_FGC_HIGHLIGHT_ITEM)); SetBkColor (hdc, - GetWindowElementPixel (hWnd, WE_BGC_HIGHLIGHT_ITEM)); + GetWindowElementPixelEx (hWnd, hdc, WE_BGC_HIGHLIGHT_ITEM)); TextOut (hdc, x, y, szText); rc_clip.right = rcClient.right; rc_clip.left = prog; SelectClipRect (hdc, &rc_clip); - SetTextColor (hdc, GetWindowElementPixel (hWnd, WE_FGC_WINDOW)); + SetTextColor (hdc, GetWindowElementPixelEx (hWnd, hdc, WE_FGC_WINDOW)); SetBkColor (hdc, GetWindowBkColor (hWnd)); TextOut (hdc, x, y, szText); } diff --git a/src/gui/lf_manager.c b/src/gui/lf_manager.c index e248224e..45a745a8 100644 --- a/src/gui/lf_manager.c +++ b/src/gui/lf_manager.c @@ -731,7 +731,6 @@ GetWindowElementPixelEx (HWND hwnd, HDC hdc, int we_attr_id) { DWORD data; Uint8 r, g, b, a; - HDC dc; gal_pixel pixel; if ((we_attr_id & WE_ATTR_TYPE_MASK) != WE_ATTR_TYPE_COLOR) { @@ -740,9 +739,6 @@ GetWindowElementPixelEx (HWND hwnd, HDC hdc, int we_attr_id) } data = GetWindowElementAttr (hwnd, we_attr_id); - if (data < 0) - return -1; - r = GetRValue (data); g = GetGValue (data); b = GetBValue (data); @@ -752,9 +748,12 @@ GetWindowElementPixelEx (HWND hwnd, HDC hdc, int we_attr_id) if (hwnd == HWND_NULL || hwnd == HWND_DESKTOP) pixel = RGBA2Pixel (HDC_SCREEN, r, g, b, a); else { - dc = GetDC (hwnd); - pixel = RGBA2Pixel (dc, r, g, b, a); - ReleaseDC (dc); +#ifdef _MGSCHEMA_COMPOSITING + PMAINWIN pWin = (PMAINWIN)hwnd; + pixel = GAL_MapRGBA (pWin->surf->format, r, g, b, a); +#else + pixel = RGBA2Pixel (HDC_SCREEN, r, g, b, a); +#endif } } else diff --git a/src/gui/lf_test/src/button_my.c b/src/gui/lf_test/src/button_my.c index 52dfa961..16cf3feb 100644 --- a/src/gui/lf_test/src/button_my.c +++ b/src/gui/lf_test/src/button_my.c @@ -280,7 +280,8 @@ static void InitCreateInfo(PMAINWINCREATE pCreateInfo) pCreateInfo->ty = 0; pCreateInfo->rx = 520; pCreateInfo->by = 350; - pCreateInfo->iBkColor = GetWindowElementColor (WE_MAINC_THREED_BODY); + pCreateInfo->iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_MAINC_THREED_BODY); pCreateInfo->dwAddData = 0; pCreateInfo->hHosting = HWND_DESKTOP; } diff --git a/src/gui/lf_test/src/combobox.c b/src/gui/lf_test/src/combobox.c index de2b3724..872a8c68 100644 --- a/src/gui/lf_test/src/combobox.c +++ b/src/gui/lf_test/src/combobox.c @@ -240,7 +240,8 @@ static void InitCreateInfo(PMAINWINCREATE pCreateInfo) pCreateInfo->ty = 0; pCreateInfo->rx = 400; pCreateInfo->by = 260; - pCreateInfo->iBkColor = GetWindowElementColor (WE_MAINC_THREED_BODY); + pCreateInfo->iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_MAINC_THREED_BODY); pCreateInfo->dwAddData = 0; pCreateInfo->hHosting = HWND_DESKTOP; } diff --git a/src/gui/lf_test/src/coolbar.c b/src/gui/lf_test/src/coolbar.c index 1ced150a..168c180b 100644 --- a/src/gui/lf_test/src/coolbar.c +++ b/src/gui/lf_test/src/coolbar.c @@ -236,7 +236,8 @@ static void InitCreateInfo(PMAINWINCREATE pCreateInfo) pCreateInfo->ty = 0; pCreateInfo->rx = 400; pCreateInfo->by = 300; - pCreateInfo->iBkColor = GetWindowElementColor (WE_MAINC_THREED_BODY); + pCreateInfo->iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_MAINC_THREED_BODY); pCreateInfo->dwAddData = 0; pCreateInfo->hHosting = HWND_DESKTOP; } diff --git a/src/gui/lf_test/src/edit.c b/src/gui/lf_test/src/edit.c index e25a5ba5..1e8f428b 100644 --- a/src/gui/lf_test/src/edit.c +++ b/src/gui/lf_test/src/edit.c @@ -285,7 +285,8 @@ static void InitCreateInfo(PMAINWINCREATE pCreateInfo) pCreateInfo->ty = 0; pCreateInfo->rx = 600; pCreateInfo->by = 450; - pCreateInfo->iBkColor = GetWindowElementColor (WE_MAINC_THREED_BODY); + pCreateInfo->iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_MAINC_THREED_BODY); pCreateInfo->dwAddData = 0; pCreateInfo->hHosting = HWND_DESKTOP; } diff --git a/src/gui/lf_test/src/grid.c b/src/gui/lf_test/src/grid.c index 37a56154..f367bbd6 100644 --- a/src/gui/lf_test/src/grid.c +++ b/src/gui/lf_test/src/grid.c @@ -315,7 +315,8 @@ InitCreateInfo (PMAINWINCREATE pCreateInfo) pCreateInfo->ty = 0; pCreateInfo->rx = 500; pCreateInfo->by = 350; - pCreateInfo->iBkColor = GetWindowElementColor (BKC_CONTROL_DEF); + pCreateInfo->iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, BKC_CONTROL_DEF); pCreateInfo->dwAddData = 0; pCreateInfo->hHosting = HWND_DESKTOP; } diff --git a/src/gui/lf_test/src/listbox.c b/src/gui/lf_test/src/listbox.c index 5053426b..44a8c075 100644 --- a/src/gui/lf_test/src/listbox.c +++ b/src/gui/lf_test/src/listbox.c @@ -408,7 +408,8 @@ static void InitCreateInfo(PMAINWINCREATE pCreateInfo) pCreateInfo->ty = 0; pCreateInfo->rx = 500; pCreateInfo->by = 400; - pCreateInfo->iBkColor = GetWindowElementColor (WE_MAINC_THREED_BODY); + pCreateInfo->iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_MAINC_THREED_BODY); pCreateInfo->dwAddData = 0; pCreateInfo->hHosting = HWND_DESKTOP; } diff --git a/src/gui/lf_test/src/listview.c b/src/gui/lf_test/src/listview.c index 7fa3dcee..1caeb2f2 100644 --- a/src/gui/lf_test/src/listview.c +++ b/src/gui/lf_test/src/listview.c @@ -539,7 +539,8 @@ InitCreateInfo (PMAINWINCREATE pCreateInfo) pCreateInfo->ty = 0; pCreateInfo->rx = 500; pCreateInfo->by = 350; - pCreateInfo->iBkColor = GetWindowElementColor (WE_MAINC_THREED_BODY); + pCreateInfo->iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_MAINC_THREED_BODY); pCreateInfo->dwAddData = 0; pCreateInfo->hHosting = HWND_DESKTOP; } diff --git a/src/gui/lf_test/src/menubutton.c b/src/gui/lf_test/src/menubutton.c index 16ff5da9..ac56211b 100644 --- a/src/gui/lf_test/src/menubutton.c +++ b/src/gui/lf_test/src/menubutton.c @@ -292,7 +292,8 @@ static void InitCreateInfo(PMAINWINCREATE pCreateInfo) pCreateInfo->ty = 0; pCreateInfo->rx = 300; pCreateInfo->by = 200; - pCreateInfo->iBkColor = GetWindowElementColor (WE_MAINC_THREED_BODY); + pCreateInfo->iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_MAINC_THREED_BODY); pCreateInfo->dwAddData = 0; pCreateInfo->hHosting = HWND_DESKTOP; } diff --git a/src/gui/lf_test/src/monthcalendar.c b/src/gui/lf_test/src/monthcalendar.c index 7e49bead..8046f674 100644 --- a/src/gui/lf_test/src/monthcalendar.c +++ b/src/gui/lf_test/src/monthcalendar.c @@ -433,7 +433,8 @@ static void InitCreateInfo (PMAINWINCREATE pCreateInfo) pCreateInfo->ty = 0; pCreateInfo->rx = 640; pCreateInfo->by = 480; - pCreateInfo->iBkColor = GetWindowElementColor (WE_MAINC_THREED_BODY); + pCreateInfo->iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_MAINC_THREED_BODY); pCreateInfo->dwAddData = 0; pCreateInfo->hHosting = HWND_DESKTOP; } diff --git a/src/gui/lf_test/src/progbar.c b/src/gui/lf_test/src/progbar.c index d916a2c3..44aa510a 100644 --- a/src/gui/lf_test/src/progbar.c +++ b/src/gui/lf_test/src/progbar.c @@ -195,7 +195,8 @@ static void InitCreateInfo(PMAINWINCREATE pCreateInfo) pCreateInfo->ty = 0; pCreateInfo->rx = 300; pCreateInfo->by = 230; - pCreateInfo->iBkColor = GetWindowElementColor (WE_MAINC_THREED_BODY); + pCreateInfo->iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_MAINC_THREED_BODY); pCreateInfo->dwAddData = 0; pCreateInfo->hHosting = HWND_DESKTOP; } diff --git a/src/gui/lf_test/src/static.c b/src/gui/lf_test/src/static.c index a2c2ced4..c6598670 100644 --- a/src/gui/lf_test/src/static.c +++ b/src/gui/lf_test/src/static.c @@ -267,7 +267,8 @@ static void InitCreateInfo(PMAINWINCREATE pCreateInfo) pCreateInfo->ty = 0; pCreateInfo->rx = 520; pCreateInfo->by = 390; - pCreateInfo->iBkColor = GetWindowElementPixel (HWND_NULL, WE_MAINC_THREED_BODY); + pCreateInfo->iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_MAINC_THREED_BODY); pCreateInfo->dwAddData = 0; pCreateInfo->hHosting = HWND_DESKTOP; } diff --git a/src/gui/lf_test/src/subclass.c b/src/gui/lf_test/src/subclass.c index bf80d525..4621e60a 100644 --- a/src/gui/lf_test/src/subclass.c +++ b/src/gui/lf_test/src/subclass.c @@ -174,7 +174,8 @@ static void InitCreateInfo(PMAINWINCREATE pCreateInfo) pCreateInfo->ty = 0; pCreateInfo->rx = 400; pCreateInfo->by = 300; - pCreateInfo->iBkColor = GetWindowElementColor (WE_MAINC_THREED_BODY); + pCreateInfo->iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_MAINC_THREED_BODY); pCreateInfo->dwAddData = 0; pCreateInfo->hHosting = HWND_DESKTOP; } diff --git a/src/gui/lf_test/src/timeedit.c b/src/gui/lf_test/src/timeedit.c index 8a7f1dd6..4385524d 100644 --- a/src/gui/lf_test/src/timeedit.c +++ b/src/gui/lf_test/src/timeedit.c @@ -237,7 +237,8 @@ static void InitCreateInfo(PMAINWINCREATE pCreateInfo) pCreateInfo->ty = 0; pCreateInfo->rx = 400; pCreateInfo->by = 300; - pCreateInfo->iBkColor = GetWindowElementColor (WE_MAINC_THREED_BODY); + pCreateInfo->iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_MAINC_THREED_BODY); pCreateInfo->dwAddData = 0; pCreateInfo->hHosting = HWND_DESKTOP; } diff --git a/src/gui/lf_test/src/trackbar.c b/src/gui/lf_test/src/trackbar.c index 891ac1da..742345b2 100644 --- a/src/gui/lf_test/src/trackbar.c +++ b/src/gui/lf_test/src/trackbar.c @@ -214,7 +214,8 @@ static void InitCreateInfo(PMAINWINCREATE pCreateInfo) pCreateInfo->ty = 0; pCreateInfo->rx = 460; pCreateInfo->by = 380; - pCreateInfo->iBkColor = GetWindowElementColor (WE_MAINC_THREED_BODY); + pCreateInfo->iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_MAINC_THREED_BODY); pCreateInfo->dwAddData = 0; pCreateInfo->dwReserved = 0; pCreateInfo->hHosting = HWND_DESKTOP; diff --git a/src/gui/lf_test/src/treeview.c b/src/gui/lf_test/src/treeview.c index df27a00b..48f2d034 100644 --- a/src/gui/lf_test/src/treeview.c +++ b/src/gui/lf_test/src/treeview.c @@ -215,7 +215,8 @@ static void InitCreateInfo(PMAINWINCREATE pCreateInfo) pCreateInfo->ty = 0; pCreateInfo->rx = 400; pCreateInfo->by = 300; - pCreateInfo->iBkColor = GetWindowElementColor (WE_MAINC_THREED_BODY); + pCreateInfo->iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_MAINC_THREED_BODY); pCreateInfo->dwAddData = 0; pCreateInfo->hHosting = HWND_DESKTOP; } diff --git a/src/gui/lf_tiny.c b/src/gui/lf_tiny.c index 7ff4d0aa..d5bbfbdb 100644 --- a/src/gui/lf_tiny.c +++ b/src/gui/lf_tiny.c @@ -493,7 +493,8 @@ static void draw_3dbox (HDC hdc, const RECT* pRect, DWORD color, DWORD flag) /*draw outer frame*/ //dark_color = calc_3dbox_color (color, LFRDR_3DBOX_COLOR_DARKEST); - old_pen_color = SetPenColor (hdc, GetWindowElementColor (WE_FGC_THREED_BODY)); + old_pen_color = SetPenColor (hdc, + GetWindowElementPixelEx (HWND_DESKTOP, hdc, WE_FGC_THREED_BODY)); Rectangle (hdc, pRect->left, pRect->top, pRect->right - 1, pRect->bottom - 1); @@ -1133,7 +1134,7 @@ static void check_frame (HDC hdc, int x0, int y0, int x1, int y1) x1-=1; y1-=1; - pen_clr = GetWindowElementColor (WE_FGC_THREED_BODY); + pen_clr = GetWindowElementPixelEx (HWND_NULL, hdc, WE_FGC_THREED_BODY); old_pen_clr = SetPenColor (hdc, pen_clr); MoveTo (hdc, x1-4, y0+2); @@ -1169,7 +1170,8 @@ static void normal_frame (HDC hdc, int x0, int y0, int x1, int y1) x1-=1; y1-=1; - old_pen_clr = SetPenColor (hdc, GetWindowElementColor (WE_FGC_THREED_BODY)); + old_pen_clr = SetPenColor (hdc, + GetWindowElementPixelEx (HWND_NULL, hdc, WE_FGC_THREED_BODY)); MoveTo (hdc, x1, y0+4); LineTo (hdc, x1, y1-4); @@ -1191,7 +1193,8 @@ static void DrawFlatControlFrameEx (HDC hdc, int x0, int y0, int x1, int y1) { gal_pixel old_color; - old_color = SetPenColor (hdc, GetWindowElementColor (WE_FGC_THREED_BODY)); + old_color = SetPenColor (hdc, + GetWindowElementPixelEx (HDC_NULL, hdc, WE_FGC_THREED_BODY)); x1-=1; y1-=1; @@ -3331,8 +3334,8 @@ static void draw_scrollbar (HWND hWnd, HDC hdc, int sb_pos) return; } - old_pen_clr = SetPenColor (hdc, GetWindowElementPixel(hWnd, WE_FGC_THREED_BODY)); - old_bru_clr = SetBrushColor (hdc, GetWindowElementPixel (hWnd, WE_MAINC_THREED_BODY)); + old_pen_clr = SetPenColor (hdc, GetWindowElementPixelEx (hWnd, hdc, WE_FGC_THREED_BODY)); + old_bru_clr = SetBrushColor (hdc, GetWindowElementPixelEx (hWnd, hdc, WE_MAINC_THREED_BODY)); if (0 == strncasecmp(CTRL_SCROLLBAR, GetClassName(hWnd), strlen(CTRL_SCROLLBAR))) { @@ -3529,7 +3532,7 @@ static void draw_trackbar_thumb (HWND hWnd, HDC hdc, win_info->we_rdr->draw_3dbox (hdc, &rc_draw, color_thumb, tbstatus); - SetPenColor (hdc, GetWindowElementPixel (hWnd, WE_FGC_THREED_BODY)); + SetPenColor (hdc, GetWindowElementPixelEx (hWnd, hdc, WE_FGC_THREED_BODY)); if (dwStyle & TBS_VERTICAL) { MoveTo (hdc, sliderx + (sliderw >> 1) - 3 - 1, slidery + (sliderh >> 1)); @@ -3685,7 +3688,7 @@ draw_trackbar (HWND hWnd, HDC hdc, LFRDR_TRACKBARINFO *info) /* draw the tick of trackbar. */ if (!(dwStyle & TBS_NOTICK)) { - SetPenColor (hdc, GetWindowElementPixel (hWnd, WE_FGC_THREED_BODY)); + SetPenColor (hdc, GetWindowElementPixelEx (hWnd, hdc, WE_FGC_THREED_BODY)); if (dwStyle & TBS_VERTICAL) { TickStart = y + (HEIGHT_VERT_SLIDER >> 1); TickEnd = y + h - (HEIGHT_VERT_SLIDER >> 1); @@ -3955,7 +3958,7 @@ draw_progress (HWND hWnd, HDC hdc, nRem = ndiv_progress.rem; SetBrushColor (hdc, - GetWindowElementPixel (hWnd, WE_BGC_HIGHLIGHT_ITEM)); + GetWindowElementPixelEx (hWnd, hdc, WE_BGC_HIGHLIGHT_ITEM)); if (whOne >= 4) { if (fVertical) { @@ -4011,15 +4014,15 @@ draw_progress (HWND hWnd, HDC hdc, rc_clip.right = prog; SelectClipRect (hdc, &rc_clip); SetTextColor (hdc, - GetWindowElementPixel (hWnd, WE_FGC_HIGHLIGHT_ITEM)); + GetWindowElementPixelEx (hWnd, hdc, WE_FGC_HIGHLIGHT_ITEM)); SetBkColor (hdc, - GetWindowElementPixel (hWnd, WE_BGC_HIGHLIGHT_ITEM)); + GetWindowElementPixelEx (hWnd, hdc, WE_BGC_HIGHLIGHT_ITEM)); TextOut (hdc, x, y, szText); rc_clip.right = rcClient.right; rc_clip.left = prog; SelectClipRect (hdc, &rc_clip); - SetTextColor (hdc, GetWindowElementPixel (hWnd, WE_FGC_WINDOW)); + SetTextColor (hdc, GetWindowElementPixelEx (hWnd, hdc, WE_FGC_WINDOW)); SetBkColor (hdc, GetWindowBkColor (hWnd)); TextOut (hdc, x, y, szText); } diff --git a/src/kernel/compsor-fallback.c b/src/kernel/compsor-fallback.c index 17faa22f..63dbcb48 100644 --- a/src/kernel/compsor-fallback.c +++ b/src/kernel/compsor-fallback.c @@ -280,7 +280,8 @@ static void composite_wallpaper_rect (CompositorCtxt* ctxt, } else { SetBrushColor (HDC_SCREEN_SYS, - GetWindowElementPixel (HWND_DESKTOP, WE_BGC_DESKTOP)); + GetWindowElementPixelEx (HWND_DESKTOP, HDC_SCREEN_SYS, + WE_BGC_DESKTOP)); SelectClipRect (HDC_SCREEN_SYS, &ctxt->rc_screen); FillBox (HDC_SCREEN_SYS, dirty_rc->left, dirty_rc->top, RECTWP(dirty_rc), RECTHP(dirty_rc)); @@ -704,6 +705,7 @@ static void on_showing_win (CompositorCtxt* ctxt, MG_Layer* layer, int zidx) if (layer != mgTopmostLayer) return; + _DBG_PRINTF ("called: %d\n", zidx); rgn = mg_slice_new (CLIPRGN); InitClipRgn (rgn, &ctxt->cliprc_heap); ServerGetWinZNodeRegion (layer, zidx, RGN_OP_SET | RGN_OP_FLAG_ABS, rgn); @@ -719,6 +721,7 @@ static void on_hiding_win (CompositorCtxt* ctxt, MG_Layer* layer, int zidx) if (layer != mgTopmostLayer) return; + _DBG_PRINTF ("called: %d\n", zidx); znode_hdr = ServerGetWinZNodeHeader (layer, zidx, (void**)&rgn, FALSE); assert (znode_hdr); diff --git a/src/kernel/desktop.c b/src/kernel/desktop.c index 3e01ba82..dd1a9ee2 100644 --- a/src/kernel/desktop.c +++ b/src/kernel/desktop.c @@ -3751,7 +3751,7 @@ def_paint_desktop (void* context, HDC dc_desktop, const RECT* inv_rc) } SetBrushColor (dc_desktop, - GetWindowElementPixel (HWND_DESKTOP, WE_BGC_DESKTOP)); + GetWindowElementPixelEx (HWND_DESKTOP, HDC_SCREEN, WE_BGC_DESKTOP)); if (inv_rc) { SelectClipRect (dc_desktop, inv_rc); diff --git a/src/textedit/mtextedit.c b/src/textedit/mtextedit.c index b2ecfb08..6b925888 100644 --- a/src/textedit/mtextedit.c +++ b/src/textedit/mtextedit.c @@ -4059,20 +4059,20 @@ static void mTextEditor_beginSelection(mTextEditor *self, HDC hdc) if (!self) return; - SetBkMode(hdc, BM_OPAQUE); + SetBkMode (hdc, BM_OPAQUE); SetTextColor (hdc, - GetWindowElementPixel (self->hwnd, + GetWindowElementPixelEx (self->hwnd, hdc, GetWindowStyle(self->hwnd)&WS_DISABLED? WE_FGC_DISABLED_ITEM : WE_FGC_SELECTED_ITEM)); if (TE_IS_FOCUS(self)) { SetBkColor (hdc, - GetWindowElementPixel(self->hwnd, WE_BGC_SELECTED_ITEM)); + GetWindowElementPixelEx (self->hwnd, hdc, WE_BGC_SELECTED_ITEM)); } else { SetBkColor (hdc, - GetWindowElementPixel (self->hwnd, WE_BGC_SELECTED_LOSTFOCUS)); + GetWindowElementPixelEx (self->hwnd, hdc, WE_BGC_SELECTED_LOSTFOCUS)); } } @@ -4083,7 +4083,7 @@ static void mTextEditor_setupDC(mTextEditor *self, HDC hdc) SetBkColor (hdc, GetWindowBkColor (self->hwnd)); SetTextColor (hdc, - GetWindowElementPixel (self->hwnd, + GetWindowElementPixelEx (self->hwnd, hdc, GetWindowStyle(self->hwnd)&WS_DISABLED? WE_FGC_DISABLED_ITEM : WE_FGC_WINDOW)); } @@ -4175,12 +4175,12 @@ static int mTextEditor_getInvalidBkgnd(mTextEditor *self, RECT *prc) #define INIT_SELECT_BRUSH(self, hdc, oldColor) \ if (TE_IS_FOCUS(self)) {\ - oldColor = SetBrushColor (hdc, GetWindowElementPixel(self->hwnd, \ - WE_BGC_SELECTED_ITEM)); \ + oldColor = SetBrushColor (hdc, GetWindowElementPixelEx(self->hwnd, \ + hdc, WE_BGC_SELECTED_ITEM)); \ }\ else {\ - oldColor = SetBrushColor (hdc, GetWindowElementPixel(self->hwnd, \ - WE_BGC_SELECTED_LOSTFOCUS));\ + oldColor = SetBrushColor (hdc, GetWindowElementPixelEx(self->hwnd, \ + hdc, WE_BGC_SELECTED_LOSTFOCUS));\ } #define INIT_NORMAL_BRUSH(self, hdc, oldColor) \ @@ -6795,7 +6795,8 @@ BOOL RegisterTextEditControl (void) #ifdef _MGSCHEMA_COMPOSITING WndClass.dwBkColor = GetWindowElementAttr (HWND_NULL, WE_BGC_WINDOW); #else - WndClass.iBkColor = GetWindowElementPixel (HWND_NULL, WE_BGC_WINDOW); + WndClass.iBkColor = + GetWindowElementPixelEx (HWND_NULL, HDC_SCREEN, WE_BGC_WINDOW); #endif WndClass.WinProc = mTextEditCtrlProc;