| 1 | /* $Id: oslibwin.cpp,v 1.1 2001-05-11 08:37:25 sandervl Exp $ */ | 
|---|
| 2 | /* | 
|---|
| 3 | * Window API wrappers for OS/2 | 
|---|
| 4 | * | 
|---|
| 5 | * | 
|---|
| 6 | * Copyright 1999 Sander van Leeuwen (sandervl@xs4all.nl) | 
|---|
| 7 | * Copyright 1999 Daniela Engert (dani@ngrt.de) | 
|---|
| 8 | * | 
|---|
| 9 | * | 
|---|
| 10 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 11 | * | 
|---|
| 12 | */ | 
|---|
| 13 | #define  INCL_WIN | 
|---|
| 14 | #define  INCL_PM | 
|---|
| 15 | #define  INCL_WINSWITCHLIST | 
|---|
| 16 | #include <os2wrap.h> | 
|---|
| 17 | #include <stdlib.h> | 
|---|
| 18 | #include <string.h> | 
|---|
| 19 |  | 
|---|
| 20 | #include <misc.h> | 
|---|
| 21 | #include "win32type.h" | 
|---|
| 22 | #include <winconst.h> | 
|---|
| 23 | #include "oslibwin.h" | 
|---|
| 24 | #include "oslibutil.h" | 
|---|
| 25 | #include "oslibmsg.h" | 
|---|
| 26 | #include "oslibgdi.h" | 
|---|
| 27 | #include "pmwindow.h" | 
|---|
| 28 |  | 
|---|
| 29 | #define DBG_LOCALLOG    DBG_oslibwin | 
|---|
| 30 | #include "dbglocal.h" | 
|---|
| 31 |  | 
|---|
| 32 | //****************************************************************************** | 
|---|
| 33 | //****************************************************************************** | 
|---|
| 34 | BOOL OSLibWinSetParent(HWND hwnd, HWND hwndParent, ULONG fRedraw) | 
|---|
| 35 | { | 
|---|
| 36 | if(hwndParent == OSLIB_HWND_DESKTOP) | 
|---|
| 37 | { | 
|---|
| 38 | hwndParent = HWND_DESKTOP; | 
|---|
| 39 | } | 
|---|
| 40 | else | 
|---|
| 41 | if(hwndParent == OSLIB_HWND_OBJECT) { | 
|---|
| 42 | hwndParent = HWND_OBJECT; | 
|---|
| 43 | } | 
|---|
| 44 | return (WinSetParent(hwnd, hwndParent, fRedraw) == 0); | 
|---|
| 45 | } | 
|---|
| 46 | //****************************************************************************** | 
|---|
| 47 | //****************************************************************************** | 
|---|
| 48 | BOOL OSLibWinSetOwner(HWND hwnd, HWND hwndOwner) | 
|---|
| 49 | { | 
|---|
| 50 | return WinSetOwner(hwnd, hwndOwner); | 
|---|
| 51 | } | 
|---|
| 52 | //****************************************************************************** | 
|---|
| 53 | //****************************************************************************** | 
|---|
| 54 | HWND OSLibWinCreateWindow(HWND hwndParent,ULONG dwWinStyle, | 
|---|
| 55 | char *pszName, HWND Owner, ULONG fHWND_BOTTOM, | 
|---|
| 56 | ULONG id, BOOL fTaskList,BOOL fShellPosition, | 
|---|
| 57 | int classStyle) | 
|---|
| 58 | { | 
|---|
| 59 | HWND  hwndClient; | 
|---|
| 60 | ULONG dwFrameStyle = 0; | 
|---|
| 61 |  | 
|---|
| 62 | if(pszName && *pszName == 0) { | 
|---|
| 63 | pszName = NULL; | 
|---|
| 64 | } | 
|---|
| 65 | if(hwndParent == OSLIB_HWND_DESKTOP) { | 
|---|
| 66 | hwndParent = HWND_DESKTOP; | 
|---|
| 67 | } | 
|---|
| 68 | if(Owner == OSLIB_HWND_DESKTOP) { | 
|---|
| 69 | Owner = HWND_DESKTOP; | 
|---|
| 70 | } | 
|---|
| 71 |  | 
|---|
| 72 | if(classStyle & CS_SAVEBITS_W) dwWinStyle |= WS_SAVEBITS; | 
|---|
| 73 | if(classStyle & CS_PARENTDC_W) dwWinStyle |= WS_PARENTCLIP; | 
|---|
| 74 |  | 
|---|
| 75 | dwWinStyle = dwWinStyle & ~(WS_TABSTOP | WS_GROUP); | 
|---|
| 76 |  | 
|---|
| 77 | if(fTaskList) | 
|---|
| 78 | { | 
|---|
| 79 | dwFrameStyle |= FCF_NOMOVEWITHOWNER; | 
|---|
| 80 | } | 
|---|
| 81 | if (fShellPosition) dwFrameStyle |= FCF_SHELLPOSITION; | 
|---|
| 82 |  | 
|---|
| 83 | FRAMECDATA FCData = {sizeof (FRAMECDATA), 0, 0, 0}; | 
|---|
| 84 | FCData.flCreateFlags = dwFrameStyle; | 
|---|
| 85 |  | 
|---|
| 86 | dprintf(("WinCreateWindow %x %s %x task %d shell %d classstyle %x winstyle %x bottom %d", hwndParent, pszName, id, fTaskList, fShellPosition, classStyle, dwWinStyle, fHWND_BOTTOM)); | 
|---|
| 87 |  | 
|---|
| 88 | return WinCreateWindow (hwndParent, | 
|---|
| 89 | (hwndParent == HWND_DESKTOP) ? WIN32_STDFRAMECLASS : WIN32_STDCLASS, | 
|---|
| 90 | pszName, dwWinStyle, 0, 0, 0, 0, | 
|---|
| 91 | Owner, (fHWND_BOTTOM) ? HWND_BOTTOM : HWND_TOP, | 
|---|
| 92 | id, NULL, NULL); | 
|---|
| 93 | } | 
|---|
| 94 | //****************************************************************************** | 
|---|
| 95 | //Note: Also check OSLibSetWindowStyle when changing this!! | 
|---|
| 96 | //****************************************************************************** | 
|---|
| 97 | BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG dwExStyle, ULONG *OSWinStyle) | 
|---|
| 98 | { | 
|---|
| 99 | *OSWinStyle   = 0; | 
|---|
| 100 |  | 
|---|
| 101 | /* Window styles */ | 
|---|
| 102 | #if 0 | 
|---|
| 103 | //Done explicitely in CreateWindowExA | 
|---|
| 104 | if(dwStyle & WS_MINIMIZE_W) | 
|---|
| 105 | *OSWinStyle |= WS_MINIMIZED; | 
|---|
| 106 | if(dwStyle & WS_VISIBLE_W) | 
|---|
| 107 | *OSWinStyle |= WS_VISIBLE; | 
|---|
| 108 | #endif | 
|---|
| 109 | if(dwStyle & WS_DISABLED_W) | 
|---|
| 110 | *OSWinStyle |= WS_DISABLED; | 
|---|
| 111 | if(dwStyle & WS_CLIPSIBLINGS_W) | 
|---|
| 112 | *OSWinStyle |= WS_CLIPSIBLINGS; | 
|---|
| 113 | if(dwStyle & WS_CLIPCHILDREN_W) | 
|---|
| 114 | *OSWinStyle |= WS_CLIPCHILDREN; | 
|---|
| 115 | #if 0 | 
|---|
| 116 | if(dwStyle & WS_MAXIMIZE_W) | 
|---|
| 117 | *OSWinStyle |= WS_MAXIMIZED; | 
|---|
| 118 | if(dwStyle & WS_GROUP_W) | 
|---|
| 119 | *OSWinStyle |= WS_GROUP; | 
|---|
| 120 | if(dwStyle & WS_TABSTOP_W) | 
|---|
| 121 | *OSWinStyle |= WS_TABSTOP; | 
|---|
| 122 | #endif | 
|---|
| 123 |  | 
|---|
| 124 | return TRUE; | 
|---|
| 125 | } | 
|---|
| 126 | //****************************************************************************** | 
|---|
| 127 | //****************************************************************************** | 
|---|
| 128 | BOOL OSLibWinSetWindowULong(HWND hwnd, ULONG offset, ULONG value) | 
|---|
| 129 | { | 
|---|
| 130 | if(offset == OSLIB_QWL_USER) | 
|---|
| 131 | offset = QWL_USER; | 
|---|
| 132 |  | 
|---|
| 133 | return WinSetWindowULong(hwnd, offset, value); | 
|---|
| 134 | } | 
|---|
| 135 | //****************************************************************************** | 
|---|
| 136 | //****************************************************************************** | 
|---|
| 137 | ULONG OSLibWinGetWindowULong(HWND hwnd, ULONG offset) | 
|---|
| 138 | { | 
|---|
| 139 | if(offset == OSLIB_QWL_USER) | 
|---|
| 140 | offset = QWL_USER; | 
|---|
| 141 |  | 
|---|
| 142 | return WinQueryWindowULong(hwnd, offset); | 
|---|
| 143 | } | 
|---|
| 144 | //****************************************************************************** | 
|---|
| 145 | //****************************************************************************** | 
|---|
| 146 | BOOL OSLibWinAlarm(HWND hwndDeskTop,ULONG flStyle) | 
|---|
| 147 | { | 
|---|
| 148 | return WinAlarm(hwndDeskTop,flStyle); | 
|---|
| 149 | } | 
|---|
| 150 | //****************************************************************************** | 
|---|
| 151 | //****************************************************************************** | 
|---|
| 152 | APIRET OSLibDosBeep(ULONG freg,ULONG dur) | 
|---|
| 153 | { | 
|---|
| 154 | return DosBeep(freg,dur); | 
|---|
| 155 | } | 
|---|
| 156 | //****************************************************************************** | 
|---|
| 157 | //****************************************************************************** | 
|---|
| 158 | HWND OSLibWinQueryFocus(HWND hwndDeskTop) | 
|---|
| 159 | { | 
|---|
| 160 | return WinQueryFocus(hwndDeskTop); | 
|---|
| 161 | } | 
|---|
| 162 | //****************************************************************************** | 
|---|
| 163 | //****************************************************************************** | 
|---|
| 164 | HWND OSLibWinWindowFromID(HWND hwndParent,ULONG id) | 
|---|
| 165 | { | 
|---|
| 166 | return WinWindowFromID(hwndParent,id); | 
|---|
| 167 | } | 
|---|
| 168 | //****************************************************************************** | 
|---|
| 169 | //****************************************************************************** | 
|---|
| 170 | BOOL OSLibWinSetFocus(HWND hwndDeskTop,HWND hwndNewFocus, BOOL activate) | 
|---|
| 171 | { | 
|---|
| 172 | return WinFocusChange (hwndDeskTop, hwndNewFocus, activate ? FC_NOLOSEACTIVE : 0); | 
|---|
| 173 | } | 
|---|
| 174 | //****************************************************************************** | 
|---|
| 175 | //****************************************************************************** | 
|---|
| 176 | BOOL OSLibWinIsChild (HWND hwnd, HWND hwndOf) | 
|---|
| 177 | { | 
|---|
| 178 | return WinIsChild (hwnd, hwndOf); | 
|---|
| 179 | } | 
|---|
| 180 | //****************************************************************************** | 
|---|
| 181 | //****************************************************************************** | 
|---|
| 182 | ULONG OSLibGetWindowHeight(HWND hwnd) | 
|---|
| 183 | { | 
|---|
| 184 | RECTL rect; | 
|---|
| 185 |  | 
|---|
| 186 | return (WinQueryWindowRect(hwnd,&rect)) ? rect.yTop-rect.yBottom:0; | 
|---|
| 187 | } | 
|---|
| 188 | //****************************************************************************** | 
|---|
| 189 | //****************************************************************************** | 
|---|
| 190 | LONG OSLibWinQuerySysValue(LONG iSysValue) | 
|---|
| 191 | { | 
|---|
| 192 | return WinQuerySysValue(HWND_DESKTOP,iSysValue); | 
|---|
| 193 | } | 
|---|
| 194 | //****************************************************************************** | 
|---|
| 195 | //****************************************************************************** | 
|---|
| 196 | ULONG OSLibWinQueryDlgItemText(HWND hwndDlg,ULONG idItem,LONG cchBufferMax,char* pchBuffer) | 
|---|
| 197 | { | 
|---|
| 198 | return WinQueryDlgItemText(hwndDlg,idItem,cchBufferMax,pchBuffer); | 
|---|
| 199 | } | 
|---|
| 200 | //****************************************************************************** | 
|---|
| 201 | //****************************************************************************** | 
|---|
| 202 | BOOL OSLibWinSetDlgItemText(HWND hwndDlg,ULONG idItem,char* pszText) | 
|---|
| 203 | { | 
|---|
| 204 | return WinSetDlgItemText(hwndDlg,idItem,pszText); | 
|---|
| 205 | } | 
|---|
| 206 | //****************************************************************************** | 
|---|
| 207 | //****************************************************************************** | 
|---|
| 208 | BOOL OSLibWinQueryPointerPos(PPOINT pptlPoint) | 
|---|
| 209 | { | 
|---|
| 210 | return WinQueryPointerPos(HWND_DESKTOP,(PPOINTL)pptlPoint); | 
|---|
| 211 | } | 
|---|
| 212 | //****************************************************************************** | 
|---|
| 213 | //****************************************************************************** | 
|---|
| 214 | BOOL OSLibWinSetPointerPos(int x, int y) | 
|---|
| 215 | { | 
|---|
| 216 | return WinSetPointerPos(HWND_DESKTOP, x, y); | 
|---|
| 217 | } | 
|---|
| 218 | //****************************************************************************** | 
|---|
| 219 | //****************************************************************************** | 
|---|
| 220 | HWND OSLibWinQueryWindow(HWND hwnd, ULONG lCode) | 
|---|
| 221 | { | 
|---|
| 222 | return WinQueryWindow(hwnd, lCode); | 
|---|
| 223 | } | 
|---|
| 224 | //****************************************************************************** | 
|---|
| 225 | //****************************************************************************** | 
|---|
| 226 | BOOL OSLibWinSetMultWindowPos(PSWP pswp, ULONG num) | 
|---|
| 227 | { | 
|---|
| 228 | return WinSetMultWindowPos(GetThreadHAB(), pswp, num); | 
|---|
| 229 | } | 
|---|
| 230 | //****************************************************************************** | 
|---|
| 231 | //****************************************************************************** | 
|---|
| 232 | BOOL OSLibWinShowWindow(HWND hwnd, ULONG fl) | 
|---|
| 233 | { | 
|---|
| 234 | BOOL rc = 1; | 
|---|
| 235 |  | 
|---|
| 236 | if(fl & SWP_SHOW) { | 
|---|
| 237 | rc = WinShowWindow(hwnd, TRUE); | 
|---|
| 238 | } | 
|---|
| 239 | if(rc == 0) | 
|---|
| 240 | dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB()))); | 
|---|
| 241 | rc = WinSetWindowPos(hwnd, 0, 0, 0, 0, 0, fl); | 
|---|
| 242 | if(rc == 0) | 
|---|
| 243 | dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB()))); | 
|---|
| 244 | return rc; | 
|---|
| 245 | } | 
|---|
| 246 | //****************************************************************************** | 
|---|
| 247 | //****************************************************************************** | 
|---|
| 248 | BOOL OSLibWinDestroyWindow(HWND hwnd) | 
|---|
| 249 | { | 
|---|
| 250 | return WinDestroyWindow(hwnd); | 
|---|
| 251 | } | 
|---|
| 252 | //****************************************************************************** | 
|---|
| 253 | //****************************************************************************** | 
|---|
| 254 | #if 0 | 
|---|
| 255 | BOOL OSLibWinQueryWindowRect(Win32BaseWindow *window, PRECT pRect, int RelativeTo) | 
|---|
| 256 | { | 
|---|
| 257 | BOOL     rc; | 
|---|
| 258 | RECTLOS2 rectl; | 
|---|
| 259 |  | 
|---|
| 260 | rc = WinQueryWindowRect(window->getOS2WindowHandle(), (PRECTL)&rectl); | 
|---|
| 261 | if(rc) { | 
|---|
| 262 | if(RelativeTo == RELATIVE_TO_SCREEN) { | 
|---|
| 263 | mapOS2ToWin32RectFrame(window,windowDesktop,&rectl,pRect); | 
|---|
| 264 | } | 
|---|
| 265 | else    mapOS2ToWin32RectFrame(window,&rectl,pRect); | 
|---|
| 266 | } | 
|---|
| 267 | else  memset(pRect, 0, sizeof(RECT)); | 
|---|
| 268 | return rc; | 
|---|
| 269 | } | 
|---|
| 270 | #endif | 
|---|
| 271 | //****************************************************************************** | 
|---|
| 272 | //****************************************************************************** | 
|---|
| 273 | BOOL OSLibWinIsIconic(HWND hwnd) | 
|---|
| 274 | { | 
|---|
| 275 | SWP  swp; | 
|---|
| 276 | BOOL rc; | 
|---|
| 277 |  | 
|---|
| 278 | rc = WinQueryWindowPos(hwnd, &swp); | 
|---|
| 279 | if(rc == FALSE) { | 
|---|
| 280 | dprintf(("OSLibWinIsIconic: WinQueryWindowPos %x failed", hwnd)); | 
|---|
| 281 | return FALSE; | 
|---|
| 282 | } | 
|---|
| 283 |  | 
|---|
| 284 | if(swp.fl & SWP_MINIMIZE) | 
|---|
| 285 | return TRUE; | 
|---|
| 286 | else  return FALSE; | 
|---|
| 287 | } | 
|---|
| 288 | //****************************************************************************** | 
|---|
| 289 | //****************************************************************************** | 
|---|
| 290 | BOOL OSLibWinSetActiveWindow(HWND hwnd) | 
|---|
| 291 | { | 
|---|
| 292 | BOOL rc; | 
|---|
| 293 |  | 
|---|
| 294 | rc = WinSetActiveWindow(HWND_DESKTOP, hwnd); | 
|---|
| 295 | if(rc == FALSE) { | 
|---|
| 296 | dprintf(("WinSetActiveWindow %x failure: %x", hwnd, OSLibWinGetLastError())); | 
|---|
| 297 | } | 
|---|
| 298 | return rc; | 
|---|
| 299 | } | 
|---|
| 300 | //****************************************************************************** | 
|---|
| 301 | //****************************************************************************** | 
|---|
| 302 | BOOL OSLibWinSetFocus(HWND hwnd) | 
|---|
| 303 | { | 
|---|
| 304 | return WinSetFocus(HWND_DESKTOP, hwnd); | 
|---|
| 305 | } | 
|---|
| 306 | //****************************************************************************** | 
|---|
| 307 | //****************************************************************************** | 
|---|
| 308 | BOOL OSLibWinEnableWindow(HWND hwnd, BOOL fEnable) | 
|---|
| 309 | { | 
|---|
| 310 | BOOL rc; | 
|---|
| 311 | HWND hwndClient; | 
|---|
| 312 |  | 
|---|
| 313 | rc = WinEnableWindow(hwnd, fEnable); | 
|---|
| 314 | hwndClient = WinWindowFromID(hwnd, FID_CLIENT); | 
|---|
| 315 | if(hwndClient) { | 
|---|
| 316 | WinEnableWindow(hwndClient, fEnable); | 
|---|
| 317 | } | 
|---|
| 318 | return rc; | 
|---|
| 319 | } | 
|---|
| 320 | //****************************************************************************** | 
|---|
| 321 | //****************************************************************************** | 
|---|
| 322 | BOOL OSLibWinIsWindowEnabled(HWND hwnd) | 
|---|
| 323 | { | 
|---|
| 324 | return WinIsWindowEnabled(hwnd); | 
|---|
| 325 | } | 
|---|
| 326 | //****************************************************************************** | 
|---|
| 327 | //****************************************************************************** | 
|---|
| 328 | BOOL OSLibWinIsWindowVisible(HWND hwnd) | 
|---|
| 329 | { | 
|---|
| 330 | return WinIsWindowVisible(hwnd); | 
|---|
| 331 | } | 
|---|
| 332 | //****************************************************************************** | 
|---|
| 333 | //****************************************************************************** | 
|---|
| 334 | HWND OSLibWinQueryActiveWindow() | 
|---|
| 335 | { | 
|---|
| 336 | return WinQueryActiveWindow(HWND_DESKTOP); | 
|---|
| 337 | } | 
|---|
| 338 | //****************************************************************************** | 
|---|
| 339 | //****************************************************************************** | 
|---|
| 340 | LONG OSLibWinQueryWindowTextLength(HWND hwnd) | 
|---|
| 341 | { | 
|---|
| 342 | return WinQueryWindowTextLength(hwnd); | 
|---|
| 343 | } | 
|---|
| 344 | //****************************************************************************** | 
|---|
| 345 | //****************************************************************************** | 
|---|
| 346 | LONG OSLibWinQueryWindowText(HWND hwnd, LONG length, LPSTR lpsz) | 
|---|
| 347 | { | 
|---|
| 348 | return WinQueryWindowText(hwnd, length, lpsz); | 
|---|
| 349 | } | 
|---|
| 350 | //****************************************************************************** | 
|---|
| 351 | //****************************************************************************** | 
|---|
| 352 | BOOL OSLibWinSetWindowText(HWND hwnd, LPSTR lpsz) | 
|---|
| 353 | { | 
|---|
| 354 | return WinSetWindowText(hwnd, lpsz); | 
|---|
| 355 | } | 
|---|
| 356 | //****************************************************************************** | 
|---|
| 357 | //****************************************************************************** | 
|---|
| 358 | BOOL OSLibWinFlashWindow(HWND hwnd, BOOL fFlash) | 
|---|
| 359 | { | 
|---|
| 360 | return WinFlashWindow(hwnd, fFlash); | 
|---|
| 361 | } | 
|---|
| 362 | //****************************************************************************** | 
|---|
| 363 | //****************************************************************************** | 
|---|
| 364 | HWND OSLibWinWindowFromPoint(HWND hwnd, PVOID ppoint) | 
|---|
| 365 | { | 
|---|
| 366 | return WinWindowFromPoint((hwnd == OSLIB_HWND_DESKTOP) ? HWND_DESKTOP : hwnd, (PPOINTL)ppoint, TRUE); | 
|---|
| 367 | } | 
|---|
| 368 | //****************************************************************************** | 
|---|
| 369 | //****************************************************************************** | 
|---|
| 370 | BOOL OSLibWinMinimizeWindow(HWND hwnd) | 
|---|
| 371 | { | 
|---|
| 372 | return WinSetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_MINIMIZE); | 
|---|
| 373 | } | 
|---|
| 374 | //****************************************************************************** | 
|---|
| 375 | //****************************************************************************** | 
|---|
| 376 | BOOL OSLibWinGetBorderSize(HWND hwnd, OSLIBPOINT *pointl) | 
|---|
| 377 | { | 
|---|
| 378 | pointl->x = 0; | 
|---|
| 379 | pointl->y = 0; | 
|---|
| 380 | return (BOOL) WinSendMsg(hwnd, WM_QUERYBORDERSIZE, MPFROMP( &pointl), 0); | 
|---|
| 381 | } | 
|---|
| 382 | //****************************************************************************** | 
|---|
| 383 | //****************************************************************************** | 
|---|
| 384 | BOOL OSLibWinSetIcon(HWND hwnd, HANDLE hIcon) | 
|---|
| 385 | { | 
|---|
| 386 | return (BOOL) WinSendMsg(hwnd, WM_SETICON, (MPARAM)hIcon, 0); | 
|---|
| 387 | } | 
|---|
| 388 | //****************************************************************************** | 
|---|
| 389 | //****************************************************************************** | 
|---|
| 390 | BOOL OSLibWinQueryWindowPos (HWND hwnd, PSWP pswp) | 
|---|
| 391 | { | 
|---|
| 392 | return WinQueryWindowPos(hwnd, pswp); | 
|---|
| 393 | } | 
|---|
| 394 | //****************************************************************************** | 
|---|
| 395 | //****************************************************************************** | 
|---|
| 396 | void OSLibMapSWPtoWINDOWPOS(PSWP pswp, PWINDOWPOS pwpos, PSWP pswpOld, | 
|---|
| 397 | int parentHeight, int clientOrgX, int clientOrgY, | 
|---|
| 398 | HWND hwnd) | 
|---|
| 399 | { | 
|---|
| 400 | HWND hWindow            = pswp->hwnd; | 
|---|
| 401 | HWND hWndInsertAfter    = pswp->hwndInsertBehind; | 
|---|
| 402 | long x                  = pswp->x - clientOrgX; | 
|---|
| 403 | long y                  = pswp->y + clientOrgY; | 
|---|
| 404 | long cx                 = pswp->cx; | 
|---|
| 405 | long cy                 = pswp->cy; | 
|---|
| 406 | UINT fuFlags            = (UINT)pswp->fl; | 
|---|
| 407 |  | 
|---|
| 408 | HWND   hWinAfter; | 
|---|
| 409 | ULONG  flags = 0; | 
|---|
| 410 |  | 
|---|
| 411 | HWND  hWnd = (hWindow == HWND_DESKTOP) ? HWND_DESKTOP_W: hWindow; | 
|---|
| 412 |  | 
|---|
| 413 | if (hWndInsertAfter == HWND_TOP) | 
|---|
| 414 | hWinAfter = HWND_TOP_W; | 
|---|
| 415 | else if (hWndInsertAfter == HWND_BOTTOM) | 
|---|
| 416 | hWinAfter = HWND_BOTTOM_W; | 
|---|
| 417 | else | 
|---|
| 418 | hWinAfter = (HWND) hWndInsertAfter; | 
|---|
| 419 |  | 
|---|
| 420 | //*********************************** | 
|---|
| 421 | // convert PM flags to Windows flags | 
|---|
| 422 | //*********************************** | 
|---|
| 423 | if (!(fuFlags & SWP_SIZE))       flags |= SWP_NOSIZE_W; | 
|---|
| 424 | if (!(fuFlags & SWP_MOVE))       flags |= SWP_NOMOVE_W; | 
|---|
| 425 | if (!(fuFlags & SWP_ZORDER))     flags |= SWP_NOZORDER_W; | 
|---|
| 426 | if (  fuFlags & SWP_NOREDRAW)    flags |= SWP_NOREDRAW_W; | 
|---|
| 427 | if (!(fuFlags & SWP_ACTIVATE))   flags |= SWP_NOACTIVATE_W; | 
|---|
| 428 | if (  fuFlags & SWP_SHOW)        flags |= SWP_SHOWWINDOW_W; | 
|---|
| 429 | if (  fuFlags & SWP_HIDE)        flags |= SWP_HIDEWINDOW_W; | 
|---|
| 430 | if (  fuFlags & SWP_NOADJUST)    flags |= SWP_NOSENDCHANGING_W; | 
|---|
| 431 |  | 
|---|
| 432 | if(fuFlags & (SWP_MOVE | SWP_SIZE)) | 
|---|
| 433 | { | 
|---|
| 434 | y  = parentHeight - y - pswp->cy; | 
|---|
| 435 |  | 
|---|
| 436 | if ((pswp->x == pswpOld->x) && (pswp->y == pswpOld->y)) | 
|---|
| 437 | flags |= SWP_NOMOVE_W; | 
|---|
| 438 |  | 
|---|
| 439 | if ((pswp->cx == pswpOld->cx) && (pswp->cy == pswpOld->cy)) | 
|---|
| 440 | flags |= SWP_NOSIZE_W; | 
|---|
| 441 |  | 
|---|
| 442 | if (fuFlags & SWP_SIZE) | 
|---|
| 443 | { | 
|---|
| 444 | if (pswp->cy != pswpOld->cy) | 
|---|
| 445 | { | 
|---|
| 446 | flags &= ~SWP_NOMOVE_W; | 
|---|
| 447 | } | 
|---|
| 448 | } | 
|---|
| 449 | } | 
|---|
| 450 |  | 
|---|
| 451 | pswpOld->x  = pswp->x; | 
|---|
| 452 | pswpOld->y  = parentHeight-pswp->y-pswp->cy; | 
|---|
| 453 | pswpOld->cx = pswp->cx; | 
|---|
| 454 | pswpOld->cy = pswp->cy; | 
|---|
| 455 |  | 
|---|
| 456 | dprintf(("window (%d,%d)(%d,%d)  client (%d,%d)(%d,%d)", | 
|---|
| 457 | x,y,cx,cy, pswpOld->x,pswpOld->y,pswpOld->cx,pswpOld->cy)); | 
|---|
| 458 |  | 
|---|
| 459 | pwpos->flags            = (UINT)flags; | 
|---|
| 460 | pwpos->cy               = cy; | 
|---|
| 461 | pwpos->cx               = cx; | 
|---|
| 462 | pwpos->x                = x; | 
|---|
| 463 | pwpos->y                = y; | 
|---|
| 464 | pwpos->hwndInsertAfter  = hWinAfter; | 
|---|
| 465 | pwpos->hwnd             = hWindow; | 
|---|
| 466 | } | 
|---|
| 467 | //****************************************************************************** | 
|---|
| 468 | //****************************************************************************** | 
|---|
| 469 | void OSLibMapWINDOWPOStoSWP(struct tagWINDOWPOS *pwpos, PSWP pswp, PSWP pswpOld, | 
|---|
| 470 | int parentHeight, int clientOrgX, int clientOrgY, HWND hFrame) | 
|---|
| 471 | { | 
|---|
| 472 | BOOL fCvt = FALSE; | 
|---|
| 473 |  | 
|---|
| 474 | HWND hWnd            = pwpos->hwnd; | 
|---|
| 475 | HWND hWndInsertAfter = pwpos->hwndInsertAfter; | 
|---|
| 476 | long x               = pwpos->x + clientOrgX; | 
|---|
| 477 | long y               = pwpos->y + clientOrgY; | 
|---|
| 478 | long cx              = pwpos->cx; | 
|---|
| 479 | long cy              = pwpos->cy; | 
|---|
| 480 | UINT fuFlags         = pwpos->flags; | 
|---|
| 481 |  | 
|---|
| 482 | HWND  hWinAfter; | 
|---|
| 483 | ULONG flags = 0; | 
|---|
| 484 | HWND  hWindow = hWnd ? (HWND)hWnd : HWND_DESKTOP; | 
|---|
| 485 |  | 
|---|
| 486 | if (hWndInsertAfter == HWND_TOPMOST_W) | 
|---|
| 487 | //      hWinAfter = HWND_TOPMOST; | 
|---|
| 488 | hWinAfter = HWND_TOP; | 
|---|
| 489 | else if (hWndInsertAfter == HWND_NOTOPMOST_W) | 
|---|
| 490 | //      hWinAfter = HWND_NOTOPMOST; | 
|---|
| 491 | hWinAfter = HWND_TOP; | 
|---|
| 492 | else if (hWndInsertAfter == HWND_TOP_W) | 
|---|
| 493 | hWinAfter = HWND_TOP; | 
|---|
| 494 | else if (hWndInsertAfter == HWND_BOTTOM_W) | 
|---|
| 495 | hWinAfter = HWND_BOTTOM; | 
|---|
| 496 | else | 
|---|
| 497 | hWinAfter = (HWND) hWndInsertAfter; | 
|---|
| 498 |  | 
|---|
| 499 | if (!(fuFlags & SWP_NOSIZE_W    )) flags |= SWP_SIZE; | 
|---|
| 500 | if (!(fuFlags & SWP_NOMOVE_W    )) flags |= SWP_MOVE; | 
|---|
| 501 | if (!(fuFlags & SWP_NOZORDER_W  )) flags |= SWP_ZORDER; | 
|---|
| 502 | if (  fuFlags & SWP_NOREDRAW_W  )  flags |= SWP_NOREDRAW; | 
|---|
| 503 | if (!(fuFlags & SWP_NOACTIVATE_W)) flags |= SWP_ACTIVATE; | 
|---|
| 504 | if (  fuFlags & SWP_SHOWWINDOW_W)  flags |= SWP_SHOW; | 
|---|
| 505 | if (  fuFlags & SWP_HIDEWINDOW_W)  flags |= SWP_HIDE; | 
|---|
| 506 | if (  fuFlags & SWP_NOSENDCHANGING_W) flags |= SWP_NOADJUST; | 
|---|
| 507 |  | 
|---|
| 508 | if(flags & (SWP_MOVE | SWP_SIZE)) | 
|---|
| 509 | { | 
|---|
| 510 | if((flags & SWP_MOVE) == 0) | 
|---|
| 511 | { | 
|---|
| 512 | x = pswpOld->x; | 
|---|
| 513 | y = pswpOld->y; | 
|---|
| 514 |  | 
|---|
| 515 | y = parentHeight - y - pswpOld->cy; | 
|---|
| 516 | } | 
|---|
| 517 |  | 
|---|
| 518 | if(flags & SWP_SIZE) | 
|---|
| 519 | { | 
|---|
| 520 | if (cy != pswpOld->cy) | 
|---|
| 521 | flags |= SWP_MOVE; | 
|---|
| 522 | } | 
|---|
| 523 | else | 
|---|
| 524 | { | 
|---|
| 525 | cx = pswpOld->cx; | 
|---|
| 526 | cy = pswpOld->cy; | 
|---|
| 527 | } | 
|---|
| 528 | y = parentHeight - y - cy; | 
|---|
| 529 |  | 
|---|
| 530 | if ((pswpOld->x == x) && (pswpOld->y == y)) | 
|---|
| 531 | flags &= ~SWP_MOVE; | 
|---|
| 532 |  | 
|---|
| 533 | if ((pswpOld->cx == cx) && (pswpOld->cy == cy)) | 
|---|
| 534 | flags &= ~SWP_SIZE; | 
|---|
| 535 | } | 
|---|
| 536 |  | 
|---|
| 537 | pswp->fl               = flags; | 
|---|
| 538 | pswp->cy               = cy; | 
|---|
| 539 | pswp->cx               = cx; | 
|---|
| 540 | pswp->x                = x; | 
|---|
| 541 | pswp->y                = y; | 
|---|
| 542 | pswp->hwndInsertBehind = hWinAfter; | 
|---|
| 543 | pswp->hwnd             = hWindow; | 
|---|
| 544 | pswp->ulReserved1      = 0; | 
|---|
| 545 | pswp->ulReserved2      = 0; | 
|---|
| 546 | } | 
|---|
| 547 | //****************************************************************************** | 
|---|
| 548 | //Position in screen coordinates | 
|---|
| 549 | //****************************************************************************** | 
|---|
| 550 | BOOL OSLibWinCalcFrameRect(HWND hwndFrame, RECT *pRect, BOOL fClient) | 
|---|
| 551 | { | 
|---|
| 552 | BOOL rc; | 
|---|
| 553 |  | 
|---|
| 554 | WinMapWindowPoints(hwndFrame, HWND_DESKTOP, (PPOINTL)pRect, 2); | 
|---|
| 555 |  | 
|---|
| 556 | rc = WinCalcFrameRect(hwndFrame, (PRECTL)pRect, fClient); | 
|---|
| 557 | WinMapWindowPoints(HWND_DESKTOP, hwndFrame, (PPOINTL)pRect, 2); | 
|---|
| 558 |  | 
|---|
| 559 | return rc; | 
|---|
| 560 | } | 
|---|
| 561 | //****************************************************************************** | 
|---|
| 562 | //****************************************************************************** | 
|---|
| 563 | BOOL OSLibGetMinMaxInfo(HWND hwndFrame, MINMAXINFO *pMinMax) | 
|---|
| 564 | { | 
|---|
| 565 | TRACKINFO tinfo; | 
|---|
| 566 |  | 
|---|
| 567 | memset(&tinfo, 0, sizeof(TRACKINFO)); | 
|---|
| 568 | WinSendMsg(hwndFrame, WM_QUERYTRACKINFO, (MPARAM)0,(MPARAM)&tinfo); | 
|---|
| 569 |  | 
|---|
| 570 | pMinMax->ptMinTrackSize.x = tinfo.ptlMinTrackSize.x; | 
|---|
| 571 | pMinMax->ptMinTrackSize.y = tinfo.ptlMinTrackSize.y; | 
|---|
| 572 | pMinMax->ptMaxTrackSize.x = tinfo.ptlMaxTrackSize.x; | 
|---|
| 573 | pMinMax->ptMaxTrackSize.y = tinfo.ptlMaxTrackSize.y; | 
|---|
| 574 | return TRUE; | 
|---|
| 575 | } | 
|---|
| 576 | //****************************************************************************** | 
|---|
| 577 | //****************************************************************************** | 
|---|
| 578 | HWND OSLibWinBeginEnumWindows(HWND hwnd) | 
|---|
| 579 | { | 
|---|
| 580 | if(hwnd == OSLIB_HWND_DESKTOP)       hwnd = HWND_DESKTOP; | 
|---|
| 581 | else | 
|---|
| 582 | if(hwnd == OSLIB_HWND_OBJECT)        hwnd = HWND_OBJECT; | 
|---|
| 583 |  | 
|---|
| 584 | return WinBeginEnumWindows(hwnd); | 
|---|
| 585 | } | 
|---|
| 586 | //****************************************************************************** | 
|---|
| 587 | //****************************************************************************** | 
|---|
| 588 | HWND OSLibWinGetNextWindow(HWND hwndEnum) | 
|---|
| 589 | { | 
|---|
| 590 | return WinGetNextWindow(hwndEnum); | 
|---|
| 591 | } | 
|---|
| 592 | //****************************************************************************** | 
|---|
| 593 | //****************************************************************************** | 
|---|
| 594 | HWND OSLibWinQueryClientWindow(HWND hwndFrame) | 
|---|
| 595 | { | 
|---|
| 596 | HWND hwndClient = 0; | 
|---|
| 597 |  | 
|---|
| 598 | if(((ULONG)WinSendMsg(hwndFrame, WM_QUERYFRAMEINFO, NULL, NULL)) & FI_FRAME) | 
|---|
| 599 | hwndClient = WinWindowFromID(hwndFrame, FID_CLIENT); | 
|---|
| 600 |  | 
|---|
| 601 | return hwndClient; | 
|---|
| 602 | } | 
|---|
| 603 | //****************************************************************************** | 
|---|
| 604 | //****************************************************************************** | 
|---|
| 605 | BOOL OSLibWinEndEnumWindows(HWND hwndEnum) | 
|---|
| 606 | { | 
|---|
| 607 | return WinEndEnumWindows(hwndEnum); | 
|---|
| 608 | } | 
|---|
| 609 | //****************************************************************************** | 
|---|
| 610 | //****************************************************************************** | 
|---|
| 611 | BOOL OSLibWinQueryWindowProcess(HWND hwnd, ULONG *pid, ULONG *tid) | 
|---|
| 612 | { | 
|---|
| 613 | return WinQueryWindowProcess(hwnd, pid, tid); | 
|---|
| 614 | } | 
|---|
| 615 | //****************************************************************************** | 
|---|
| 616 | //****************************************************************************** | 
|---|
| 617 | BOOL OSLibWinMapWindowPoints (HWND hwndFrom, HWND hwndTo, OSLIBPOINT *pptl, ULONG num) | 
|---|
| 618 | { | 
|---|
| 619 | return WinMapWindowPoints (hwndFrom, hwndTo, (PPOINTL)pptl, num); | 
|---|
| 620 | } | 
|---|
| 621 | //****************************************************************************** | 
|---|
| 622 | //****************************************************************************** | 
|---|
| 623 | HWND OSLibWinQueryObjectWindow(VOID) | 
|---|
| 624 | { | 
|---|
| 625 | return WinQueryObjectWindow(HWND_DESKTOP); | 
|---|
| 626 | } | 
|---|
| 627 | //****************************************************************************** | 
|---|
| 628 | //****************************************************************************** | 
|---|
| 629 | HWND OSLibWinObjectWindowFromID(HWND hwndOwner, ULONG ID) | 
|---|
| 630 | { | 
|---|
| 631 | HWND   hwndNext, hwndFound=0; | 
|---|
| 632 | HENUM  henum; | 
|---|
| 633 |  | 
|---|
| 634 | henum = WinBeginEnumWindows(HWND_OBJECT); | 
|---|
| 635 | while ((hwndNext = WinGetNextWindow(henum)) != 0) | 
|---|
| 636 | { | 
|---|
| 637 | if(WinQueryWindow(hwndNext, QW_OWNER) == hwndOwner && | 
|---|
| 638 | WinQueryWindowUShort(hwndNext, QWS_ID) == ID) | 
|---|
| 639 | { | 
|---|
| 640 | hwndFound = hwndNext; | 
|---|
| 641 | break; | 
|---|
| 642 | } | 
|---|
| 643 | } | 
|---|
| 644 | WinEndEnumWindows(henum); | 
|---|
| 645 | return hwndFound; | 
|---|
| 646 | } | 
|---|
| 647 | //****************************************************************************** | 
|---|
| 648 | //****************************************************************************** | 
|---|
| 649 | BOOL OSLibSetWindowID(HWND hwnd, ULONG value) | 
|---|
| 650 | { | 
|---|
| 651 | dprintf(("OSLibSetWindowID hwnd:%x ID:%x", hwnd, value)); | 
|---|
| 652 | return WinSetWindowULong(hwnd, QWS_ID, value); | 
|---|
| 653 | } | 
|---|
| 654 | //****************************************************************************** | 
|---|
| 655 | //****************************************************************************** | 
|---|
| 656 | PVOID OSLibWinSubclassWindow(HWND hwnd,PVOID newWndProc) | 
|---|
| 657 | { | 
|---|
| 658 | return WinSubclassWindow(hwnd,(PFNWP)newWndProc); | 
|---|
| 659 | } | 
|---|
| 660 | //****************************************************************************** | 
|---|
| 661 | //****************************************************************************** | 
|---|
| 662 | BOOL OSLibSetWindowRestoreRect(HWND hwnd, PRECT pRect) | 
|---|
| 663 | { | 
|---|
| 664 | ULONG yHeight = OSLibGetWindowHeight(WinQueryWindow(hwnd, QW_PARENT)); | 
|---|
| 665 |  | 
|---|
| 666 | WinSetWindowUShort(hwnd, QWS_XRESTORE,  (USHORT)pRect->left ); | 
|---|
| 667 | WinSetWindowUShort(hwnd, QWS_YRESTORE,  (USHORT)(yHeight - pRect->top - | 
|---|
| 668 | (pRect->bottom - pRect->top))); | 
|---|
| 669 | WinSetWindowUShort(hwnd, QWS_CXRESTORE, (USHORT)(pRect->right - pRect->left)); | 
|---|
| 670 | WinSetWindowUShort(hwnd, QWS_CYRESTORE, (USHORT)(pRect->bottom - pRect->top)); | 
|---|
| 671 | return TRUE; | 
|---|
| 672 | } | 
|---|
| 673 | //****************************************************************************** | 
|---|
| 674 | //****************************************************************************** | 
|---|
| 675 | BOOL OSLibSetWindowMinPos(HWND hwnd, ULONG x, ULONG y) | 
|---|
| 676 | { | 
|---|
| 677 | ULONG yHeight = OSLibGetWindowHeight(WinQueryWindow(hwnd, QW_PARENT)); | 
|---|
| 678 |  | 
|---|
| 679 | WinSetWindowUShort(hwnd, QWS_XMINIMIZE, (USHORT)x ); | 
|---|
| 680 | WinSetWindowUShort(hwnd, QWS_YMINIMIZE, (USHORT)(yHeight - y - | 
|---|
| 681 | ( 2 * WinQuerySysValue( HWND_DESKTOP, SV_CYSIZEBORDER)) - | 
|---|
| 682 | WinQuerySysValue( HWND_DESKTOP, SV_CYICON))); | 
|---|
| 683 | return TRUE; | 
|---|
| 684 | } | 
|---|
| 685 | //****************************************************************************** | 
|---|
| 686 | //****************************************************************************** | 
|---|
| 687 | BOOL OSLibWinGetKeyboardStateTable(unsigned char *PMKeyState) | 
|---|
| 688 | { | 
|---|
| 689 | return WinSetKeyboardStateTable(HWND_DESKTOP, (PBYTE)&PMKeyState, FALSE ); | 
|---|
| 690 | } | 
|---|
| 691 | //****************************************************************************** | 
|---|
| 692 | //****************************************************************************** | 
|---|
| 693 | BOOL OSLibWinSetKeyboardStateTable(unsigned char *PMKeyState) | 
|---|
| 694 | { | 
|---|
| 695 | return WinSetKeyboardStateTable(HWND_DESKTOP, (PBYTE)&PMKeyState, TRUE ); | 
|---|
| 696 | } | 
|---|
| 697 | //****************************************************************************** | 
|---|
| 698 | //****************************************************************************** | 
|---|
| 699 | BOOL OSLibWinEnableWindowUpdate(HWND hwnd,BOOL fEnable) | 
|---|
| 700 | { | 
|---|
| 701 | return WinEnableWindowUpdate(hwnd,fEnable); | 
|---|
| 702 | } | 
|---|
| 703 | //****************************************************************************** | 
|---|
| 704 | //****************************************************************************** | 
|---|
| 705 | ULONG OSLibWinGetLastError() | 
|---|
| 706 | { | 
|---|
| 707 | return WinGetLastError(GetThreadHAB()) & 0xFFFF; | 
|---|
| 708 | } | 
|---|
| 709 | //****************************************************************************** | 
|---|
| 710 | //****************************************************************************** | 
|---|
| 711 | void OSLibWinShowTaskList(HWND hwndFrame) | 
|---|
| 712 | { | 
|---|
| 713 | //CB: don't know if this works on all machines | 
|---|
| 714 | WinSetActiveWindow(HWND_DESKTOP,0x8000000E); | 
|---|
| 715 | } | 
|---|
| 716 | //****************************************************************************** | 
|---|
| 717 | //****************************************************************************** | 
|---|
| 718 | void OSLibSetWindowStyle(HWND hwnd, ULONG dwStyle, ULONG dwExStyle) | 
|---|
| 719 | { | 
|---|
| 720 | ULONG dwWinStyle = WinQueryWindowULong(hwnd, QWL_STYLE); | 
|---|
| 721 | ULONG dwOldWinStyle = dwWinStyle; | 
|---|
| 722 |  | 
|---|
| 723 | if(dwStyle & WS_DISABLED_W) { | 
|---|
| 724 | dwWinStyle |= WS_DISABLED; | 
|---|
| 725 | } | 
|---|
| 726 | else  dwWinStyle &= ~WS_DISABLED; | 
|---|
| 727 |  | 
|---|
| 728 | if(dwStyle & WS_CLIPSIBLINGS_W) { | 
|---|
| 729 | dwWinStyle |= WS_CLIPSIBLINGS; | 
|---|
| 730 | } | 
|---|
| 731 | else  dwWinStyle &= ~WS_CLIPSIBLINGS; | 
|---|
| 732 |  | 
|---|
| 733 | if(dwStyle & WS_CLIPCHILDREN_W) { | 
|---|
| 734 | dwWinStyle |= WS_CLIPCHILDREN; | 
|---|
| 735 | } | 
|---|
| 736 | else  dwWinStyle &= ~WS_CLIPCHILDREN; | 
|---|
| 737 |  | 
|---|
| 738 | if(dwWinStyle != dwOldWinStyle) { | 
|---|
| 739 | WinSetWindowULong(hwnd, QWL_STYLE, dwWinStyle); | 
|---|
| 740 | } | 
|---|
| 741 | } | 
|---|
| 742 | //****************************************************************************** | 
|---|
| 743 | //****************************************************************************** | 
|---|
| 744 | DWORD OSLibQueryWindowStyle(HWND hwnd) | 
|---|
| 745 | { | 
|---|
| 746 | return WinQueryWindowULong(hwnd, QWL_STYLE); | 
|---|
| 747 | } | 
|---|
| 748 | //****************************************************************************** | 
|---|
| 749 | //****************************************************************************** | 
|---|
| 750 | void OSLibWinSetVisibleRegionNotify(HWND hwnd, BOOL fNotify) | 
|---|
| 751 | { | 
|---|
| 752 | WinSetVisibleRegionNotify(hwnd, fNotify); | 
|---|
| 753 | } | 
|---|
| 754 | //****************************************************************************** | 
|---|
| 755 | //****************************************************************************** | 
|---|
| 756 | HWND OSLibWinQueryCapture() | 
|---|
| 757 | { | 
|---|
| 758 | return WinQueryCapture(HWND_DESKTOP); | 
|---|
| 759 | } | 
|---|
| 760 | //****************************************************************************** | 
|---|
| 761 | //****************************************************************************** | 
|---|
| 762 | BOOL OSLibWinSetCapture(HWND hwnd) | 
|---|
| 763 | { | 
|---|
| 764 | return WinSetCapture(HWND_DESKTOP, hwnd); | 
|---|
| 765 | } | 
|---|
| 766 | //****************************************************************************** | 
|---|
| 767 | //****************************************************************************** | 
|---|
| 768 | BOOL OSLibWinRemoveFromTasklist(HANDLE hTaskList) | 
|---|
| 769 | { | 
|---|
| 770 | return (WinRemoveSwitchEntry(hTaskList)) ? FALSE : TRUE; | 
|---|
| 771 | } | 
|---|
| 772 | //****************************************************************************** | 
|---|
| 773 | //****************************************************************************** | 
|---|
| 774 | HANDLE OSLibWinAddToTaskList(HWND hwndFrame, char *title, BOOL fVisible) | 
|---|
| 775 | { | 
|---|
| 776 | SWCNTRL swctrl; | 
|---|
| 777 | ULONG   tid; | 
|---|
| 778 |  | 
|---|
| 779 | swctrl.hwnd          = hwndFrame; | 
|---|
| 780 | swctrl.hwndIcon      = 0; | 
|---|
| 781 | swctrl.hprog         = 0; | 
|---|
| 782 | WinQueryWindowProcess(hwndFrame, (PPID)&swctrl.idProcess, (PTID)&tid); | 
|---|
| 783 | swctrl.idSession     = 0; | 
|---|
| 784 | swctrl.uchVisibility = (fVisible) ? SWL_VISIBLE : SWL_INVISIBLE; | 
|---|
| 785 | swctrl.fbJump        = SWL_JUMPABLE; | 
|---|
| 786 | swctrl.bProgType     = PROG_PM; | 
|---|
| 787 | if(title) { | 
|---|
| 788 | strncpy(swctrl.szSwtitle, title, MAXNAMEL+4); | 
|---|
| 789 | swctrl.szSwtitle[MAXNAMEL+4-1] = 0; | 
|---|
| 790 | } | 
|---|
| 791 | else { | 
|---|
| 792 | swctrl.szSwtitle[0] = 0; | 
|---|
| 793 | swctrl.uchVisibility    = SWL_INVISIBLE; | 
|---|
| 794 | } | 
|---|
| 795 | return WinAddSwitchEntry(&swctrl); | 
|---|
| 796 | } | 
|---|
| 797 | //****************************************************************************** | 
|---|
| 798 | //****************************************************************************** | 
|---|
| 799 | BOOL OSLibWinChangeTaskList(HANDLE hTaskList, HWND hwndFrame, char *title, BOOL fVisible) | 
|---|
| 800 | { | 
|---|
| 801 | SWCNTRL swctrl; | 
|---|
| 802 | ULONG   tid; | 
|---|
| 803 |  | 
|---|
| 804 | swctrl.hwnd          = hwndFrame; | 
|---|
| 805 | swctrl.hwndIcon      = 0; | 
|---|
| 806 | swctrl.hprog         = 0; | 
|---|
| 807 | WinQueryWindowProcess(hwndFrame, (PPID)&swctrl.idProcess, (PTID)&tid); | 
|---|
| 808 | swctrl.idSession     = 0; | 
|---|
| 809 | swctrl.uchVisibility = (fVisible) ? SWL_VISIBLE : SWL_INVISIBLE; | 
|---|
| 810 | swctrl.fbJump        = SWL_JUMPABLE; | 
|---|
| 811 | swctrl.bProgType     = PROG_PM; | 
|---|
| 812 | if(title) { | 
|---|
| 813 | strncpy(swctrl.szSwtitle, title, MAXNAMEL+4); | 
|---|
| 814 | swctrl.szSwtitle[MAXNAMEL+4-1] = 0; | 
|---|
| 815 | } | 
|---|
| 816 | else { | 
|---|
| 817 | swctrl.szSwtitle[0] = 0; | 
|---|
| 818 | swctrl.uchVisibility    = SWL_INVISIBLE; | 
|---|
| 819 | } | 
|---|
| 820 | return (WinChangeSwitchEntry(hTaskList, &swctrl)) ? FALSE : TRUE; | 
|---|
| 821 | } | 
|---|
| 822 | //****************************************************************************** | 
|---|
| 823 | //****************************************************************************** | 
|---|
| 824 | BOOL OSLibWinLockWindowUpdate(HWND hwnd) | 
|---|
| 825 | { | 
|---|
| 826 | return WinLockWindowUpdate(HWND_DESKTOP, (HWND)hwnd); | 
|---|
| 827 | } | 
|---|
| 828 | //****************************************************************************** | 
|---|
| 829 | //****************************************************************************** | 
|---|
| 830 | ULONG OSLibGetScreenHeight() | 
|---|
| 831 | { | 
|---|
| 832 | return ScreenHeight; | 
|---|
| 833 | } | 
|---|
| 834 | //****************************************************************************** | 
|---|
| 835 | //****************************************************************************** | 
|---|
| 836 | ULONG OSLibGetScreenWidth() | 
|---|
| 837 | { | 
|---|
| 838 | return ScreenWidth; | 
|---|
| 839 | } | 
|---|
| 840 | //****************************************************************************** | 
|---|
| 841 | //Returns the maximum position for a window | 
|---|
| 842 | //Should only be used from toplevel windows | 
|---|
| 843 | //****************************************************************************** | 
|---|
| 844 | BOOL OSLibWinGetMaxPosition(HWND hwndOS2, RECT *rect) | 
|---|
| 845 | { | 
|---|
| 846 | SWP  swp; | 
|---|
| 847 |  | 
|---|
| 848 | if(!WinGetMaxPosition(hwndOS2, &swp)) { | 
|---|
| 849 | dprintf(("WARNING: WinGetMaxPosition %x returned FALSE", hwndOS2)); | 
|---|
| 850 | return FALSE; | 
|---|
| 851 | } | 
|---|
| 852 | rect->left   = swp.x; | 
|---|
| 853 | rect->right  = swp.x + swp.cx; | 
|---|
| 854 | rect->top    = ScreenHeight - (swp.y + swp.cy); | 
|---|
| 855 | rect->bottom = ScreenHeight - swp.y; | 
|---|
| 856 | return TRUE; | 
|---|
| 857 | } | 
|---|
| 858 | //****************************************************************************** | 
|---|
| 859 | //****************************************************************************** | 
|---|
| 860 | BOOL OSLibWinShowPointer(BOOL fShow) | 
|---|
| 861 | { | 
|---|
| 862 | return WinShowPointer(HWND_DESKTOP, fShow); | 
|---|
| 863 | } | 
|---|
| 864 | //****************************************************************************** | 
|---|
| 865 | //****************************************************************************** | 
|---|