Hi,
First, this is going to be a long post, sorry ;-)
You might have noticed, that I have been working on the desk.cpl
appearance tab, wich is working partly.
Here's the first version:
http://www.reactos.org/bugzilla/show_bug.cgi?id=1732
Some things still don't work. For example the desktop doesn't get
repainted in the new color.
------- /Comment #5
<http://www.reactos.org/bugzilla/show_bug.cgi?id=1732#c5> >From
jimtabor 2006-08-05 04:46:36 CET / [reply
<http://www.reactos.org/bugzilla/show_bug.cgi?id=1732#add_comment>]
-------
Hi,
You can use WM_SYSCOLORCHANGE in the desktop proc if it is used, should be!,
user32/misc/desktop.c;
static
LRESULT
WINAPI
DesktopWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
{
DPRINT1("Desktop Class Atom!\n");
switch(message)
{
case WM_NCCREATE:
return TRUE;
case WM_CREATE:
/* when I spy I see notify */
SendNotifyMessageW( hwnd, WM_SYSCOLORCHANGE , 0, 0 );
break;
case WM_SYSCOLORCHANGE:
/* update everything, well in theory anyway */
RedrawWindow( hwnd, NULL, 0, RDW_INVALIDATE | RDW_ERASE |
RDW_ALLCHILDREN );
break;
default:
return DefWindowProcW(hwnd,message,wParam,lParam);
}
return 0; /* all other messages are ignored */
}
Its crude, I'm not sure if it will compile, its off the top of my head ATM.
8^D
Thanks,
James
Thanks for helping, James. I tried it, but it doesn't work.
1.) Sending WM_SYSCOLORCHANGE on WM_CREATE will probably do nothing,
because the desktop has just been created with the initial SysColors, no
need to update them.
2.) RedrawWindow calls NtUserRedrawWindow wich calls co_UserRedrawWindow
wich calls co_IntPaintWindows wich sends a WM_PAINT message to the
desktop window.
WM_PAINT is then passed to DefWindowProc and passed on to
User32DefWindowProc wich does only repaint the icon as it seems.
So WM_PAINT must be evaluated in DesktopWndProc.
I tried the following:
case WM_PAINT:
{
PAINTSTRUCT ps;
HDC hdc = BeginPaint(hwnd, &ps);
PaintDesktop(hdc);
EndPaint(hwnd, &ps);
}
PaintDesktop calls NtUserPaintDesktop, wich then paints the desktop.
I have also replaced
DesktopBrush = (HBRUSH)UserGetClassLongPtr(WndDesktop->Class,
GCL_HBRBACKGROUND, FALSE);
with
DesktopBrush = IntGetSysColorBrush(COLOR_BACKGROUND);
But the desktop is still painted in the original color, whereas the icon
text is in the color I have set in the registry.
I played a little around with the code in NtUserPaintDesktop. I added
the following code before the desktop background is painted:
if (IntGetSysColor(COLOR_BACKGROUND) == 0) // This is
true after
SysColors are loaded from Registry
{
DesktopBrush = IntGetSysColorBrush(COLOR_ACTIVECAPTION);
}
And suddenly the desktop is painted in COLOR_ACTIVECAPTION.
This is strange, because I also added CreateSysColorObjects(); at the
beginning of NtUserPaintDesktop.
Anybody any idea?