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