| 1 | /* $Id: win32wdesktop.cpp,v 1.15 2000-12-05 13:05:52 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 | rectWindow.left   = 0; | 
|---|
| 49 | rectWindow.top    = 0; | 
|---|
| 50 | rectWindow.right  = OSLibQueryScreenWidth(); | 
|---|
| 51 | rectWindow.bottom = OSLibQueryScreenHeight(); | 
|---|
| 52 |  | 
|---|
| 53 | OS2Hwnd      = OSLIB_HWND_DESKTOP; | 
|---|
| 54 | rectClient   = rectWindow; | 
|---|
| 55 |  | 
|---|
| 56 | if(HwAllocateWindowHandle(&Win32Hwnd, (ULONG)this) == FALSE) | 
|---|
| 57 | { | 
|---|
| 58 | dprintf(("Win32BaseWindow::Init HwAllocateWindowHandle failed!!")); | 
|---|
| 59 | DebugInt3(); | 
|---|
| 60 | } | 
|---|
| 61 | dprintf(("Desktop window %x", Win32Hwnd)); | 
|---|
| 62 |  | 
|---|
| 63 | /* Find the window class */ | 
|---|
| 64 | windowClass = Win32WndClass::FindClass(0, (LPSTR)DESKTOP_CLASS_ATOM); | 
|---|
| 65 |  | 
|---|
| 66 | setWindowProc(windowClass->getWindowProc()); | 
|---|
| 67 |  | 
|---|
| 68 | dwStyle |= WS_VISIBLE; | 
|---|
| 69 | } | 
|---|
| 70 | //****************************************************************************** | 
|---|
| 71 | //****************************************************************************** | 
|---|
| 72 | Win32Desktop::~Win32Desktop() | 
|---|
| 73 | { | 
|---|
| 74 | } | 
|---|
| 75 | //****************************************************************************** | 
|---|
| 76 | //****************************************************************************** | 
|---|
| 77 | BOOL Win32Desktop::isDesktopWindow() | 
|---|
| 78 | { | 
|---|
| 79 | return TRUE; | 
|---|
| 80 | } | 
|---|
| 81 | //****************************************************************************** | 
|---|
| 82 | //Disabling the desktop is not a good idea (mouse no longer responds) | 
|---|
| 83 | //****************************************************************************** | 
|---|
| 84 | BOOL Win32Desktop::EnableWindow(BOOL fEnable) | 
|---|
| 85 | { | 
|---|
| 86 | return TRUE; //of course we succeeded | 
|---|
| 87 | } | 
|---|
| 88 | //****************************************************************************** | 
|---|
| 89 | //Dummy window procedure. Does nothing. | 
|---|
| 90 | //****************************************************************************** | 
|---|
| 91 | LRESULT WIN32API DesktopWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) | 
|---|
| 92 | { | 
|---|
| 93 | switch (message) | 
|---|
| 94 | { | 
|---|
| 95 | case WM_GETTEXT: | 
|---|
| 96 | if (!lParam || !wParam) return 0; | 
|---|
| 97 | ((LPSTR)lParam)[0] = 0; | 
|---|
| 98 | return 0; | 
|---|
| 99 | } | 
|---|
| 100 |  | 
|---|
| 101 | return 0; | 
|---|
| 102 | } | 
|---|
| 103 | //****************************************************************************** | 
|---|
| 104 | //****************************************************************************** | 
|---|
| 105 | BOOL WIN32API SetDeskWallPaper(LPCSTR filename) | 
|---|
| 106 | { | 
|---|
| 107 | dprintf(("USER32: SetDeskWallPaper - empty stub!")); | 
|---|
| 108 |  | 
|---|
| 109 | return TRUE; | 
|---|
| 110 | } | 
|---|
| 111 | //****************************************************************************** | 
|---|
| 112 | //****************************************************************************** | 
|---|
| 113 | BOOL DESKTOP_Register() | 
|---|
| 114 | { | 
|---|
| 115 | WNDCLASSA wndClass; | 
|---|
| 116 |  | 
|---|
| 117 | ZeroMemory(&wndClass,sizeof(WNDCLASSA)); | 
|---|
| 118 | wndClass.style         = CS_GLOBALCLASS; | 
|---|
| 119 | wndClass.lpfnWndProc   = (WNDPROC)DesktopWndProc; | 
|---|
| 120 | wndClass.cbClsExtra    = 0; | 
|---|
| 121 | wndClass.cbWndExtra    = 0; | 
|---|
| 122 | wndClass.hCursor       = (HCURSOR)IDC_ARROWA; | 
|---|
| 123 | wndClass.hbrBackground = 0; | 
|---|
| 124 | wndClass.lpszClassName = DESKTOP_CLASS_NAMEA; | 
|---|
| 125 |  | 
|---|
| 126 | return RegisterClassA(&wndClass); | 
|---|
| 127 | } | 
|---|
| 128 | //****************************************************************************** | 
|---|
| 129 | //****************************************************************************** | 
|---|
| 130 | BOOL DESKTOP_Unregister() | 
|---|
| 131 | { | 
|---|
| 132 | if (GlobalFindAtomA(DESKTOP_CLASS_NAMEA)) | 
|---|
| 133 | return UnregisterClassA(DESKTOP_CLASS_NAMEA,(HINSTANCE)NULL); | 
|---|
| 134 | else    return FALSE; | 
|---|
| 135 | } | 
|---|
| 136 | //****************************************************************************** | 
|---|
| 137 | //****************************************************************************** | 
|---|