00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #include <os2win.h>
00013 #include <misc.h>
00014 #include <win32wbase.h>
00015 #include <win32wdesktop.h>
00016 #include "oslibwin.h"
00017 #include "win32wndhandle.h"
00018
00019 #define DBG_LOCALLOG DBG_win32wdesktop
00020 #include "dbglocal.h"
00021
00022 Win32Desktop *windowDesktop = 0;
00023
00024
00025
00026 BOOL CreateWin32Desktop()
00027 {
00028 windowDesktop = new Win32Desktop();
00029 if(windowDesktop == NULL) {
00030 dprintf(("Unable to create desktop window!!!"));
00031 return FALSE;
00032 }
00033 return TRUE;
00034 }
00035
00036
00037 void DestroyDesktopWindow()
00038 {
00039 if(windowDesktop) {
00040 delete windowDesktop;
00041 windowDesktop = 0;
00042 }
00043 }
00044
00045
00046 Win32Desktop::Win32Desktop() : Win32BaseWindow()
00047 {
00048 rectWindow.left = 0;
00049 rectWindow.top = 0;
00050 rectWindow.right = OSLibQueryScreenWidth();
00051 rectWindow.bottom = OSLibQueryScreenHeight();
00052
00053 OS2Hwnd = OSLIB_HWND_DESKTOP;
00054 OS2HwndFrame = OSLIB_HWND_DESKTOP;
00055 rectClient = rectWindow;
00056
00057 if(HwAllocateWindowHandle(&Win32Hwnd, (ULONG)this) == FALSE)
00058 {
00059 dprintf(("Win32BaseWindow::Init HwAllocateWindowHandle failed!!"));
00060 DebugInt3();
00061 }
00062 dprintf(("Desktop window %x", Win32Hwnd));
00063
00064
00065 windowClass = Win32WndClass::FindClass(0, (LPSTR)DESKTOP_CLASS_ATOM);
00066
00067 setWindowProc(windowClass->getWindowProc());
00068
00069 dwStyle |= WS_VISIBLE;
00070 }
00071
00072
00073 Win32Desktop::~Win32Desktop()
00074 {
00075 }
00076
00077
00078 BOOL Win32Desktop::isDesktopWindow()
00079 {
00080 return TRUE;
00081 }
00082
00083
00084
00085 BOOL Win32Desktop::EnableWindow(BOOL fEnable)
00086 {
00087 return TRUE;
00088 }
00089
00090
00091 BOOL Win32Desktop::DestroyWindow()
00092 {
00093 dprintf(("WARNING: can't destroy desktop window!!"));
00094 return FALSE;
00095 }
00096
00097
00098
00099 LRESULT WIN32API DesktopWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
00100 {
00101 switch (message)
00102 {
00103 case WM_GETTEXT:
00104 if (!lParam || !wParam) return 0;
00105 ((LPSTR)lParam)[0] = 0;
00106 return 0;
00107 }
00108
00109 return 0;
00110 }
00111
00112
00113 BOOL WIN32API SetDeskWallPaper(LPCSTR filename)
00114 {
00115 dprintf(("USER32: SetDeskWallPaper - empty stub!"));
00116
00117 return TRUE;
00118 }
00119
00120
00121 BOOL DESKTOP_Register()
00122 {
00123 WNDCLASSA wndClass;
00124
00125 ZeroMemory(&wndClass,sizeof(WNDCLASSA));
00126 wndClass.style = CS_GLOBALCLASS;
00127 wndClass.lpfnWndProc = (WNDPROC)DesktopWndProc;
00128 wndClass.cbClsExtra = 0;
00129 wndClass.cbWndExtra = 0;
00130 wndClass.hCursor = LoadCursorA(0, IDC_ARROWA);
00131 wndClass.hbrBackground = 0;
00132 wndClass.lpszClassName = DESKTOP_CLASS_NAMEA;
00133
00134 return RegisterClassA(&wndClass);
00135 }
00136
00137
00138 BOOL DESKTOP_Unregister()
00139 {
00140 if (GlobalFindAtomA(DESKTOP_CLASS_NAMEA))
00141 return UnregisterClassA(DESKTOP_CLASS_NAMEA,(HINSTANCE)NULL);
00142 else return FALSE;
00143 }
00144
00145