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