/* window procedure for the desktop window */ static LRESULT WINAPI desktop_wnd_proc( HWND hwnd, UINT message, WPARAM wp, LPARAM lp ) { WINE_TRACE( "got msg %04x wp %lx lp %lx\n", message, wp, lp ); switch(message) { case WM_SYSCOMMAND: switch(wp & 0xfff0) { case SC_CLOSE: ExitWindows( 0, 0 ); break; case SC_SCREENSAVE: return start_screensaver(); } return 0; case WM_CLOSE: PostQuitMessage(0); return 0; case WM_SETCURSOR: return (LRESULT)SetCursor( LoadCursorA( 0, (LPSTR)IDC_ARROW ) ); case WM_NCHITTEST: return HTCLIENT; case WM_ERASEBKGND: if (!using_root) PaintDesktop( (HDC)wp ); return TRUE; case WM_PAINT: { PAINTSTRUCT ps; BeginPaint( hwnd, &ps ); if (!using_root && ps.fErase) PaintDesktop( ps.hdc ); EndPaint( hwnd, &ps ); } return 0; default: return DefWindowProcW( hwnd, message, wp, lp ); } }
void BackgroundWindow::DrawDesktopBkgnd(HDC hdc) { PaintDesktop(hdc); /* special solid background HBRUSH bkgndBrush = CreateSolidBrush(RGB(0,32,160)); // dark blue FillRect(hdc, &rect, bkgndBrush); DeleteBrush(bkgndBrush); */ }
LRESULT WINAPI DesktopWndProcW(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam) { TRACE("Desktop W Class Atom! hWnd 0x%x, Msg %d\n", Wnd, Msg); switch(Msg) { case WM_ERASEBKGND: case WM_NCCREATE: case WM_CREATE: case WM_CLOSE: case WM_DISPLAYCHANGE: case WM_PAINT: case WM_SYSCOLORCHANGE: { LRESULT lResult; NtUserMessageCall( Wnd, Msg, wParam, lParam, (ULONG_PTR)&lResult, FNID_DESKTOP, FALSE); TRACE("Desktop lResult %d\n", lResult); return lResult; } case WM_PALETTECHANGED: if (Wnd == (HWND)wParam) break; case WM_QUERYNEWPALETTE: { HDC hdc = GetWindowDC( Wnd ); PaintDesktop(hdc); ReleaseDC( Wnd, hdc ); break; } case WM_SETCURSOR: return (LRESULT)SetCursor(LoadCursorW(0, (LPCWSTR)IDC_ARROW)); default: return DefWindowProcW(Wnd, Msg, wParam, lParam); } return 0; }
ST LRESULT CALLBACK Desk_WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { static UINT msgs [] = { BB_DRAGTODESKTOP, 0 }; static bool button_down; int n = 0; int nDelta; switch (uMsg) { //==================== case WM_CREATE: hDesktopWnd = hwnd; MakeSticky(hwnd); MessageManager_AddMessages(hwnd, msgs); Desk_SetPosition(); init_DeskDropTarget(hwnd); break; //==================== case WM_DESTROY: exit_DeskDropTarget(hwnd); MessageManager_RemoveMessages(hwnd, msgs); RemoveSticky(hwnd); break; case WM_USER: Desk_Clear(); Root.bmp = (HBITMAP)lParam; case WM_NCPAINT: Desk_SetPosition(); break; //==================== case WM_CLOSE: break; //==================== case WM_MOUSEACTIVATE: return MA_NOACTIVATE; case WM_LBUTTONDOWN: case WM_RBUTTONDOWN: case WM_MBUTTONDOWN: case WM_XBUTTONDOWN: button_down = true; break; //==================== case WM_LBUTTONUP: n = 0; goto post_click; case WM_RBUTTONUP: n = 1; goto post_click; case WM_MBUTTONUP: n = 2; goto post_click; case WM_XBUTTONUP: switch (HIWORD(wParam)) { case XBUTTON1: n = 3; goto post_click; case XBUTTON2: n = 4; goto post_click; case XBUTTON3: n = 5; goto post_click; } break; case WM_LBUTTONDBLCLK: case WM_RBUTTONDBLCLK: case WM_MBUTTONDBLCLK: n = 6; button_down = true; goto post_click; case WM_MOUSEWHEEL: nDelta = (short)HIWORD(wParam); if (nDelta > 0) n = 7; // Wheel UP if (nDelta < 0) n = 8; // Wheel Down button_down = true; goto post_click; post_click: if (button_down) PostMessage(BBhwnd, BB_DESKCLICK, 0, n); button_down = false; // PostMessage(BBhwnd, BB_DESKCLICK, 0, n); break; //==================== case WM_PAINT: { PAINTSTRUCT ps; HDC hdc_scrn = BeginPaint(hwnd, &ps); if (Root.bmp) { HDC hdc_bmp = CreateCompatibleDC(hdc_scrn); HGDIOBJ other = SelectObject(hdc_bmp, Root.bmp); BitBltRect(hdc_scrn, hdc_bmp, &ps.rcPaint); SelectObject(hdc_bmp, other); DeleteDC(hdc_bmp); } else { PaintDesktop(hdc_scrn); } EndPaint(hwnd, &ps); break; } //==================== case WM_ERASEBKGND: return TRUE; //==================== case BB_DRAGTODESKTOP: return get_drop_command((const char *)lParam, wParam); //==================== default: return DefWindowProc(hwnd, uMsg, wParam, lParam); } return 0; }
/* window procedure for the desktop window */ static LRESULT WINAPI desktop_wnd_proc( HWND hwnd, UINT message, WPARAM wp, LPARAM lp ) { WINE_TRACE( "got msg %04x wp %lx lp %lx\n", message, wp, lp ); switch(message) { case WM_SYSCOMMAND: switch(wp & 0xfff0) { case SC_CLOSE: ExitWindows( 0, 0 ); break; case SC_SCREENSAVE: return start_screensaver(); } return 0; case WM_CLOSE: PostQuitMessage(0); return 0; case WM_SETCURSOR: return (LRESULT)SetCursor( LoadCursorA( 0, (LPSTR)IDC_ARROW ) ); case WM_NCHITTEST: return HTCLIENT; case WM_ERASEBKGND: if (!using_root) PaintDesktop( (HDC)wp ); return TRUE; case WM_SETTINGCHANGE: if (wp == SPI_SETDESKWALLPAPER) SystemParametersInfoW( SPI_SETDESKWALLPAPER, 0, NULL, FALSE ); return 0; case WM_LBUTTONDBLCLK: if (!using_root) { const struct launcher *launcher = launcher_from_point( (short)LOWORD(lp), (short)HIWORD(lp) ); if (launcher) do_launch( launcher ); } return 0; case WM_PAINT: { PAINTSTRUCT ps; BeginPaint( hwnd, &ps ); if (!using_root) { if (ps.fErase) PaintDesktop( ps.hdc ); draw_launchers( ps.hdc, ps.rcPaint ); } EndPaint( hwnd, &ps ); } return 0; default: return DefWindowProcW( hwnd, message, wp, lp ); } }
ST LRESULT CALLBACK Desk_WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { static const UINT msgs [] = { BB_DRAGTODESKTOP, BB_REDRAWGUI, 0 }; static bool button_down, dblclk; int n; switch (uMsg) { //==================== case WM_CREATE: hDesktopWnd = hwnd; MakeSticky(hwnd); MessageManager_Register(hwnd, msgs, true); init_DeskDropTarget(hwnd); Desk_SetPosition(); break; //==================== case WM_DESTROY: exit_DeskDropTarget(hwnd); MessageManager_Register(hwnd, msgs, false); RemoveSticky(hwnd); break; case WM_NCPAINT: // dbg_printf("ncpaint: %x %x %x %x", hwnd, uMsg, wParam, lParam); // keep the window on bottom Desk_SetPosition(); break; case WM_SETTINGCHANGE: if (SPI_SETDESKWALLPAPER == wParam) { CHAR oldWallPaper[(MAX_PATH + 1)]; if (TRUE == SystemParametersInfo(SPI_GETDESKWALLPAPER, sizeof(oldWallPaper), &oldWallPaper, 0)) Desk_read_background(oldWallPaper); //Desk_new_background(oldWallPaper); //Desk_read_background(oldWallPaper); Desk_SetPosition(); //InvalidateRect(hwnd, NULL, FALSE); } break; //==================== case WM_CLOSE: break; //==================== case WM_MOUSEACTIVATE: return MA_NOACTIVATE; case WM_LBUTTONDOWN: case WM_RBUTTONDOWN: case WM_MBUTTONDOWN: case WM_XBUTTONDOWN: dblclk = false; button_down = true; if (uMsg == WM_LBUTTONDOWN) { n = 0; goto post_click_2; } break; case WM_MOUSEMOVE: break; case WM_LBUTTONDBLCLK: case WM_RBUTTONDBLCLK: case WM_MBUTTONDBLCLK: dblclk = true; button_down = true; break; case WM_LBUTTONUP: n = dblclk ? 7 : 1; goto post_click; case WM_RBUTTONUP: n = 2; goto post_click; case WM_MBUTTONUP: n = 3; goto post_click; case WM_XBUTTONUP: switch (HIWORD(wParam)) { case XBUTTON1: n = 4; goto post_click; case XBUTTON2: n = 5; goto post_click; case XBUTTON3: n = 6; goto post_click; } break; post_click: if (false == button_down) break; button_down = dblclk = false; post_click_2: wParam &= (MK_CONTROL|MK_SHIFT); if (0x8000 & GetAsyncKeyState(VK_MENU)) wParam |= MK_ALT; PostMessage(BBhwnd, BB_DESKCLICK, wParam, n); break; //==================== case WM_PAINT: { PAINTSTRUCT ps; HDC hdc_scrn; HDC hdc_bmp; HGDIOBJ other; hdc_scrn = BeginPaint(hwnd, &ps); if (Root.bmp) { hdc_bmp = CreateCompatibleDC(hdc_scrn); other = SelectObject(hdc_bmp, Root.bmp); BitBltRect(hdc_scrn, hdc_bmp, &ps.rcPaint); SelectObject(hdc_bmp, other); DeleteDC(hdc_bmp); } else { PaintDesktop(hdc_scrn); } EndPaint(hwnd, &ps); break; } //==================== case WM_ERASEBKGND: return TRUE; //==================== case BB_DRAGTODESKTOP: return get_drop_command((const char *)lParam, wParam); case BB_REDRAWGUI: if (wParam & BBRG_DESK) Desk_new_background("style"); break; //==================== default: return DefWindowProc(hwnd, uMsg, wParam, lParam); } return 0; }