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