| 1 | /* $Id: win32wdesktop.cpp,v 1.12 2000-02-16 14:28:24 sandervl Exp $ */ | 
|---|
| 2 | /* | 
|---|
| 3 | * Win32 Desktop Window for OS/2 | 
|---|
| 4 | * | 
|---|
| 5 | * | 
|---|
| 6 | * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl) | 
|---|
| 7 | * | 
|---|
| 8 | * | 
|---|
| 9 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 10 | * | 
|---|
| 11 | */ | 
|---|
| 12 | #include <os2win.h> | 
|---|
| 13 | #include <misc.h> | 
|---|
| 14 | #include <win32wbase.h> | 
|---|
| 15 | #include <win32wdesktop.h> | 
|---|
| 16 | #include "oslibwin.h" | 
|---|
| 17 | #include "win32wndhandle.h" | 
|---|
| 18 |  | 
|---|
| 19 | #define DBG_LOCALLOG    DBG_win32wdesktop | 
|---|
| 20 | #include "dbglocal.h" | 
|---|
| 21 |  | 
|---|
| 22 | Win32Desktop *windowDesktop = 0; | 
|---|
| 23 |  | 
|---|
| 24 | //****************************************************************************** | 
|---|
| 25 | //****************************************************************************** | 
|---|
| 26 | BOOL CreateWin32Desktop() | 
|---|
| 27 | { | 
|---|
| 28 | windowDesktop = new Win32Desktop(); | 
|---|
| 29 | if(windowDesktop == NULL) { | 
|---|
| 30 | dprintf(("Unable to create desktop window!!!")); | 
|---|
| 31 | return FALSE; | 
|---|
| 32 | } | 
|---|
| 33 | return TRUE; | 
|---|
| 34 | } | 
|---|
| 35 | //****************************************************************************** | 
|---|
| 36 | //****************************************************************************** | 
|---|
| 37 | void DestroyDesktopWindow() | 
|---|
| 38 | { | 
|---|
| 39 | if(windowDesktop) { | 
|---|
| 40 | delete windowDesktop; | 
|---|
| 41 | windowDesktop = 0; | 
|---|
| 42 | } | 
|---|
| 43 | } | 
|---|
| 44 | //****************************************************************************** | 
|---|
| 45 | //****************************************************************************** | 
|---|
| 46 | Win32Desktop::Win32Desktop() : Win32BaseWindow(OBJTYPE_WINDOW) | 
|---|
| 47 | { | 
|---|
| 48 | OSLibWinQueryWindowRect(OSLIB_HWND_DESKTOP, &rectWindow, RELATIVE_TO_SCREEN); | 
|---|
| 49 | OS2Hwnd      = OSLIB_HWND_DESKTOP; | 
|---|
| 50 | OS2HwndFrame = OSLIB_HWND_DESKTOP; | 
|---|
| 51 | rectClient   = rectWindow; | 
|---|
| 52 |  | 
|---|
| 53 | if(HwAllocateWindowHandle(&Win32Hwnd, (ULONG)this) == FALSE) | 
|---|
| 54 | { | 
|---|
| 55 | dprintf(("Win32BaseWindow::Init HwAllocateWindowHandle failed!!")); | 
|---|
| 56 | DebugInt3(); | 
|---|
| 57 | } | 
|---|
| 58 | dprintf(("Desktop window %x", Win32Hwnd)); | 
|---|
| 59 |  | 
|---|
| 60 | /* Find the window class */ | 
|---|
| 61 | windowClass = Win32WndClass::FindClass(0, (LPSTR)DESKTOP_CLASS_ATOM); | 
|---|
| 62 |  | 
|---|
| 63 | setWindowProc(windowClass->getWindowProc()); | 
|---|
| 64 | } | 
|---|
| 65 | //****************************************************************************** | 
|---|
| 66 | //****************************************************************************** | 
|---|
| 67 | Win32Desktop::~Win32Desktop() | 
|---|
| 68 | { | 
|---|
| 69 | } | 
|---|
| 70 | //****************************************************************************** | 
|---|
| 71 | //Disabling the desktop is not a good idea (mouse no longer responds) | 
|---|
| 72 | //****************************************************************************** | 
|---|
| 73 | BOOL Win32Desktop::EnableWindow(BOOL fEnable) | 
|---|
| 74 | { | 
|---|
| 75 | return TRUE; //of course we succeeded | 
|---|
| 76 | } | 
|---|
| 77 | //****************************************************************************** | 
|---|
| 78 | //Dummy window procedure. Does nothing. | 
|---|
| 79 | //****************************************************************************** | 
|---|
| 80 | LRESULT WIN32API DesktopWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) | 
|---|
| 81 | { | 
|---|
| 82 | switch (message) | 
|---|
| 83 | { | 
|---|
| 84 | case WM_GETTEXT: | 
|---|
| 85 | if (!lParam || !wParam) return 0; | 
|---|
| 86 | ((LPSTR)lParam)[0] = 0; | 
|---|
| 87 | return 0; | 
|---|
| 88 | } | 
|---|
| 89 |  | 
|---|
| 90 | return 0; | 
|---|
| 91 | } | 
|---|
| 92 | //****************************************************************************** | 
|---|
| 93 | //****************************************************************************** | 
|---|
| 94 | BOOL WIN32API SetDeskWallPaper(LPCSTR filename) | 
|---|
| 95 | { | 
|---|
| 96 | dprintf(("USER32: SetDeskWallPaper - empty stub!")); | 
|---|
| 97 |  | 
|---|
| 98 | return TRUE; | 
|---|
| 99 | } | 
|---|
| 100 | //****************************************************************************** | 
|---|
| 101 | //****************************************************************************** | 
|---|
| 102 | BOOL DESKTOP_Register() | 
|---|
| 103 | { | 
|---|
| 104 | WNDCLASSA wndClass; | 
|---|
| 105 |  | 
|---|
| 106 | ZeroMemory(&wndClass,sizeof(WNDCLASSA)); | 
|---|
| 107 | wndClass.style         = CS_GLOBALCLASS; | 
|---|
| 108 | wndClass.lpfnWndProc   = (WNDPROC)DesktopWndProc; | 
|---|
| 109 | wndClass.cbClsExtra    = 0; | 
|---|
| 110 | wndClass.cbWndExtra    = 0; | 
|---|
| 111 | wndClass.hCursor       = (HCURSOR)IDC_ARROWA; | 
|---|
| 112 | wndClass.hbrBackground = 0; | 
|---|
| 113 | wndClass.lpszClassName = DESKTOP_CLASS_NAMEA; | 
|---|
| 114 |  | 
|---|
| 115 | return RegisterClassA(&wndClass); | 
|---|
| 116 | } | 
|---|
| 117 | //****************************************************************************** | 
|---|
| 118 | //****************************************************************************** | 
|---|
| 119 | BOOL DESKTOP_Unregister() | 
|---|
| 120 | { | 
|---|
| 121 | if (GlobalFindAtomA(DESKTOP_CLASS_NAMEA)) | 
|---|
| 122 | return UnregisterClassA(DESKTOP_CLASS_NAMEA,(HINSTANCE)NULL); | 
|---|
| 123 | else    return FALSE; | 
|---|
| 124 | } | 
|---|
| 125 | //****************************************************************************** | 
|---|
| 126 | //****************************************************************************** | 
|---|