source: trunk/src/user32/oslibwin.cpp@ 9072

Last change on this file since 9072 was 9072, checked in by sandervl, 23 years ago

PF: Added OSLibWinControlWindow; fixed OSLibWinSetSysValue

File size: 43.9 KB
Line 
1/* $Id: oslibwin.cpp,v 1.123 2002-08-21 12:32:40 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 <winuser32.h>
24#include <wprocess.h>
25#include "oslibwin.h"
26#include "oslibutil.h"
27#include "oslibmsg.h"
28#include "oslibgdi.h"
29#include "pmwindow.h"
30#include "initterm.h"
31
32#define DBG_LOCALLOG DBG_oslibwin
33#include "dbglocal.h"
34
35//******************************************************************************
36//******************************************************************************
37BOOL OSLibWinSetParent(HWND hwnd, HWND hwndParent, ULONG fRedraw)
38{
39 if(hwndParent == OSLIB_HWND_DESKTOP)
40 {
41 hwndParent = HWND_DESKTOP;
42 }
43 else
44 if(hwndParent == OSLIB_HWND_OBJECT) {
45 hwndParent = HWND_OBJECT;
46 }
47 return (WinSetParent(hwnd, hwndParent, fRedraw) == 0);
48}
49//******************************************************************************
50//******************************************************************************
51BOOL OSLibWinSetOwner(HWND hwnd, HWND hwndOwner)
52{
53 return WinSetOwner(hwnd, hwndOwner);
54}
55//******************************************************************************
56//******************************************************************************
57HWND OSLibWinCreateWindow(HWND hwndParent,ULONG dwWinStyle, ULONG dwOSFrameStyle,
58 char *pszName, HWND Owner, ULONG fHWND_BOTTOM,
59 ULONG id, BOOL fTaskList,BOOL fShellPosition,
60 int classStyle, HWND *hwndFrame)
61{
62 HWND hwndClient;
63 ULONG dwFrameStyle = 0;
64
65 if(pszName && *pszName == 0) {
66 pszName = NULL;
67 }
68 if(hwndParent == OSLIB_HWND_DESKTOP) {
69 hwndParent = HWND_DESKTOP;
70 }
71 if(Owner == OSLIB_HWND_DESKTOP) {
72 Owner = HWND_DESKTOP;
73 }
74
75 if(classStyle & CS_SAVEBITS_W) dwWinStyle |= WS_SAVEBITS;
76 if(classStyle & CS_PARENTDC_W) dwWinStyle |= WS_PARENTCLIP;
77
78 dwWinStyle = dwWinStyle & ~(WS_TABSTOP | WS_GROUP);
79
80 if(fTaskList)
81 {
82 dwFrameStyle |= FCF_NOMOVEWITHOWNER;
83 }
84 if (fShellPosition) dwFrameStyle |= FCF_SHELLPOSITION;
85
86 FRAMECDATA FCData = {sizeof (FRAMECDATA), 0, 0, 0};
87 FCData.flCreateFlags = dwFrameStyle;
88
89 dprintf(("WinCreateWindow %x %s %x task %d shell %d classstyle %x winstyle %x bottom %d", hwndParent, pszName, id, fTaskList, fShellPosition, classStyle, dwWinStyle, fHWND_BOTTOM));
90
91 //Must not use WS_CLIPCHILDREN style with frame window. Transparency won't work otherwise.
92 //Eg: dialog parent, groupbox; invalidate part of groupbox -> painting algorithm stops when it finds
93 // a window with WS_CLIPCHILDREN -> result: dialog window won't update groupbox background as groupbox only draws the border
94 *hwndFrame = WinCreateWindow(hwndParent,
95 WIN32_STDFRAMECLASS,
96 pszName, (dwWinStyle & ~WS_CLIPCHILDREN), 0, 0, 0, 0,
97 Owner, (fHWND_BOTTOM) ? HWND_BOTTOM : HWND_TOP,
98 id, (PVOID)&FCData, NULL);
99 if(fOS2Look && *hwndFrame) {
100 FCData.flCreateFlags = dwOSFrameStyle;
101// FCData.flCreateFlags = FCF_TITLEBAR|FCF_SYSMENU|FCF_MINMAX;
102 WinCreateFrameControls(*hwndFrame, &FCData, NULL);
103 }
104 hwndClient = WinCreateWindow (*hwndFrame, WIN32_STDCLASS,
105 NULL, dwWinStyle | WS_VISIBLE, 0, 0, 0, 0,
106 *hwndFrame, HWND_TOP, FID_CLIENT, NULL, NULL);
107
108 return hwndClient;
109}
110//******************************************************************************
111//Note: Also check OSLibSetWindowStyle when changing this!!
112//******************************************************************************
113BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle)
114{
115 *OSWinStyle = 0;
116 *OSFrameStyle = 0;
117
118 /* Window styles */
119 if(dwStyle & WS_DISABLED_W)
120 *OSWinStyle |= WS_DISABLED;
121 if(dwStyle & WS_CLIPSIBLINGS_W)
122 *OSWinStyle |= WS_CLIPSIBLINGS;
123 if(dwStyle & WS_CLIPCHILDREN_W)
124 *OSWinStyle |= WS_CLIPCHILDREN;
125
126 if(fOS2Look) {
127 if((dwStyle & WS_CAPTION_W) == WS_CAPTION_W) {
128 *OSFrameStyle = FCF_TITLEBAR;
129 if((dwStyle & WS_SYSMENU_W) && !(dwExStyle & WS_EX_TOOLWINDOW_W))
130 {
131 *OSFrameStyle |= FCF_SYSMENU;
132 }
133 if(dwStyle & WS_MINIMIZEBOX_W) {
134 *OSFrameStyle |= FCF_MINBUTTON;
135 }
136 if(dwStyle & WS_MAXIMIZEBOX_W) {
137 *OSFrameStyle |= FCF_MAXBUTTON;
138 }
139 if(dwStyle & WS_SYSMENU_W) {
140 *OSFrameStyle |= FCF_CLOSEBUTTON;
141 }
142 }
143 }
144 return TRUE;
145}
146//******************************************************************************
147//******************************************************************************
148BOOL OSLibWinPositionFrameControls(HWND hwndFrame, RECTLOS2 *pRect, DWORD dwStyle,
149 DWORD dwExStyle, HICON hSysMenuIcon)
150{
151 SWP swp[3];
152 HWND hwndControl;
153 int i = 0;
154 static int minmaxwidth = 0;
155 static int minmaxheight = 0;
156
157 if(minmaxwidth == 0) {
158 minmaxwidth = WinQuerySysValue(HWND_DESKTOP, SV_CXMINMAXBUTTON);
159 minmaxheight = WinQuerySysValue(HWND_DESKTOP, SV_CYMINMAXBUTTON);
160 }
161
162 if(fOS2Look == OS2_APPEARANCE_SYSMENU) {
163 hwndControl = WinWindowFromID(hwndFrame, FID_SYSMENU);
164 if(hwndControl) {
165 swp[i].hwnd = hwndControl;
166 swp[i].hwndInsertBehind = HWND_TOP;
167 swp[i].x = pRect->xLeft;
168 swp[i].y = pRect->yBottom;
169 if(pRect->yTop - pRect->yBottom > minmaxheight) {
170 swp[i].y += pRect->yTop - pRect->yBottom - minmaxheight;
171 }
172 swp[i].cx = minmaxwidth/2;
173 swp[i].cy = minmaxheight;;
174 swp[i].fl = SWP_SIZE | SWP_MOVE | SWP_SHOW;
175 dprintf(("FID_SYSMENU (%d,%d)(%d,%d)", swp[i].x, swp[i].y, swp[i].cx, swp[i].cy));
176 pRect->xLeft += minmaxwidth/2;
177 i++;
178 }
179 }
180 else
181 if((dwStyle & WS_SYSMENU_W) && !(dwExStyle & WS_EX_TOOLWINDOW_W) && hSysMenuIcon) {
182 pRect->xLeft += minmaxwidth/2;
183 }
184
185 if((dwStyle & WS_CAPTION_W) == WS_CAPTION_W) {
186 hwndControl = WinWindowFromID(hwndFrame, FID_TITLEBAR);
187 if(hwndControl) {
188 swp[i].hwnd = hwndControl;
189 swp[i].hwndInsertBehind = HWND_TOP;
190 swp[i].x = pRect->xLeft;
191 swp[i].y = pRect->yBottom;
192 if(pRect->yTop - pRect->yBottom > minmaxheight) {
193 swp[i].y += pRect->yTop - pRect->yBottom - minmaxheight;
194 }
195 swp[i].cx = pRect->xRight - pRect->xLeft;
196 if((dwStyle & WS_MINIMIZEBOX_W)) {
197 swp[i].cx -= minmaxwidth/2;
198 }
199 if((dwStyle & WS_MAXIMIZEBOX_W)) {
200 swp[i].cx -= minmaxwidth/2;
201 }
202 //there is no close button in warp 3
203 if((dwStyle & WS_SYSMENU_W) && !fVersionWarp3) {
204 swp[i].cx -= minmaxwidth/2;
205 }
206 swp[i].cy = minmaxheight;
207 swp[i].fl = SWP_SIZE | SWP_MOVE | SWP_SHOW;
208 dprintf(("FID_TITLEBAR (%d,%d)(%d,%d)", swp[i].x, swp[i].y, swp[i].cx, swp[i].cy));
209 pRect->xLeft += swp[i].cx;
210 i++;
211 }
212 else return FALSE; //no titlebar -> no frame controls
213 }
214 if((dwStyle & WS_MINIMIZEBOX_W) || (dwStyle & WS_MAXIMIZEBOX_W) || (dwStyle & WS_SYSMENU_W)) {
215 hwndControl = WinWindowFromID(hwndFrame, FID_MINMAX);
216 if(hwndControl) {
217 swp[i].hwnd = hwndControl;
218 swp[i].hwndInsertBehind = HWND_TOP;
219 swp[i].x = pRect->xLeft;
220 swp[i].y = pRect->yBottom;
221 if(pRect->yTop - pRect->yBottom > minmaxheight) {
222 swp[i].y += pRect->yTop - pRect->yBottom - minmaxheight;
223 }
224 swp[i].cx = 0;
225 if((dwStyle & WS_MINIMIZEBOX_W)) {
226 swp[i].cx += minmaxwidth/2;
227 }
228 if((dwStyle & WS_MAXIMIZEBOX_W)) {
229 swp[i].cx += minmaxwidth/2;
230 }
231 //there is no close button in warp 3
232 if((dwStyle & WS_SYSMENU_W) && !fVersionWarp3) {
233 swp[i].cx += minmaxwidth/2;
234 }
235 swp[i].cy = minmaxheight;
236 swp[i].fl = SWP_SIZE | SWP_MOVE | SWP_SHOW;
237 dprintf(("FID_MINMAX (%d,%d)(%d,%d)", swp[i].x, swp[i].y, swp[i].cx, swp[i].cy));
238 pRect->xLeft += swp[i].cx;
239 i++;
240 }
241 }
242 return WinSetMultWindowPos(GetThreadHAB(), swp, i);
243}
244//******************************************************************************
245//******************************************************************************
246BOOL OSLibWinSetWindowULong(HWND hwnd, ULONG offset, ULONG value)
247{
248 if(offset == OSLIB_QWL_USER)
249 offset = QWL_USER;
250
251 return WinSetWindowULong(hwnd, offset, value);
252}
253//******************************************************************************
254//******************************************************************************
255BOOL OSLibWinGetMinPosition(HWND hwnd, PSWP pswp, PPOINTL pointl)
256{
257 return WinGetMinPosition(hwnd, pswp, pointl);
258}
259
260//******************************************************************************
261//******************************************************************************
262ULONG OSLibWinGetWindowULong(HWND hwnd, ULONG offset)
263{
264 if(offset == OSLIB_QWL_USER)
265 offset = QWL_USER;
266
267 return WinQueryWindowULong(hwnd, offset);
268}
269//******************************************************************************
270//******************************************************************************
271BOOL OSLibWinAlarm(HWND hwndDeskTop,ULONG flStyle)
272{
273 return WinAlarm(hwndDeskTop,flStyle);
274}
275//******************************************************************************
276HWND OSLibWinQueryFocus(HWND hwndDeskTop)
277{
278 return WinQueryFocus(hwndDeskTop);
279}
280//******************************************************************************
281//******************************************************************************
282HWND OSLibWinControlWindow(HWND hwndWindow, INT controlID, HWND controlHWND)
283{
284 HWND hwnd = NULL, hwndParent = NULL;
285
286 if (controlHWND)
287 {
288 WinSetParent(controlHWND, hwndWindow, TRUE);
289 return NULL; // this is done to minimize assignments
290 }
291 else
292 {
293 hwnd = WinWindowFromID(hwndWindow, controlID);
294 if (hwnd)
295 {
296 WinSetParent(hwnd, HWND_OBJECT, TRUE);
297 return hwnd;
298 }
299 }
300 return NULL;
301}
302//******************************************************************************
303//******************************************************************************
304HWND OSLibWinWindowFromID(HWND hwndParent,ULONG id)
305{
306 return WinWindowFromID(hwndParent,id);
307}
308//******************************************************************************
309//******************************************************************************
310LONG OSLibWinGetPhysKeyState(LONG scan)
311{
312 return WinGetPhysKeyState(HWND_DESKTOP,scan);
313}
314//******************************************************************************
315//******************************************************************************
316BOOL OSLibWinSetFocus(HWND hwndDeskTop,HWND hwndNewFocus, BOOL activate)
317{
318 return WinFocusChange (hwndDeskTop, hwndNewFocus, activate ? 0 : FC_NOSETACTIVE);
319}
320//******************************************************************************
321//******************************************************************************
322BOOL OSLibWinIsChild (HWND hwnd, HWND hwndOf)
323{
324 return WinIsChild (hwnd, hwndOf);
325}
326//******************************************************************************
327//******************************************************************************
328ULONG OSLibGetWindowHeight(HWND hwnd)
329{
330 RECTL rect;
331
332 return (WinQueryWindowRect(hwnd,&rect)) ? rect.yTop-rect.yBottom:0;
333}
334//******************************************************************************
335//******************************************************************************
336LONG OSLibWinQuerySysValue(LONG iSysValue)
337{
338 return WinQuerySysValue(HWND_DESKTOP,iSysValue);
339}
340//******************************************************************************
341//******************************************************************************
342BOOL OSLibWinSetSysValue(LONG iSysValue, ULONG val)
343{
344 return WinSetSysValue(HWND_DESKTOP, iSysValue, val);
345}
346//******************************************************************************
347//******************************************************************************
348ULONG OSLibWinQueryDlgItemText(HWND hwndDlg,ULONG idItem,LONG cchBufferMax,char* pchBuffer)
349{
350 return WinQueryDlgItemText(hwndDlg,idItem,cchBufferMax,pchBuffer);
351}
352//******************************************************************************
353//******************************************************************************
354BOOL OSLibWinSetDlgItemText(HWND hwndDlg,ULONG idItem,char* pszText)
355{
356 return WinSetDlgItemText(hwndDlg,idItem,pszText);
357}
358//******************************************************************************
359//******************************************************************************
360BOOL OSLibWinQueryPointerPos(PPOINT pptlPoint)
361{
362 return WinQueryPointerPos(HWND_DESKTOP,(PPOINTL)pptlPoint);
363}
364//******************************************************************************
365//******************************************************************************
366BOOL OSLibWinSetPointerPos(int x, int y)
367{
368 return WinSetPointerPos(HWND_DESKTOP, x, y);
369}
370//******************************************************************************
371//******************************************************************************
372HWND OSLibWinQueryWindow(HWND hwnd, ULONG lCode)
373{
374 return WinQueryWindow(hwnd, lCode);
375}
376//******************************************************************************
377//******************************************************************************
378BOOL OSLibWinSetMultWindowPos(PSWP pswp, ULONG num)
379{
380 return WinSetMultWindowPos(GetThreadHAB(), pswp, num);
381}
382//******************************************************************************
383//******************************************************************************
384BOOL OSLibWinShowWindow(HWND hwnd, ULONG fl)
385{
386 BOOL rc = 1;
387
388 if(fl & SWP_SHOW) {
389 rc = WinShowWindow(hwnd, TRUE);
390 }
391 if(rc == 0)
392 dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
393 rc = WinSetWindowPos(hwnd, 0, 0, 0, 0, 0, fl);
394 if(rc == 0)
395 dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
396 return rc;
397}
398//******************************************************************************
399//******************************************************************************
400BOOL OSLibWinDestroyWindow(HWND hwnd)
401{
402 return WinDestroyWindow(hwnd);
403}
404//******************************************************************************
405//******************************************************************************
406BOOL OSLibWinQueryWindowClientRect(HWND hwndOS2, PRECT pRect)
407{
408 BOOL rc;
409 RECTLOS2 rectl;
410
411 rc = WinQueryWindowRect(hwndOS2, (PRECTL)&rectl);
412 if(rc) {
413 pRect->left = 0;
414 pRect->right = rectl.xRight - rectl.xLeft;
415 pRect->top = 0;
416 pRect->bottom = rectl.yTop - rectl.yBottom;
417 }
418 else memset(pRect, 0, sizeof(RECT));
419 return rc;
420}
421//******************************************************************************
422//******************************************************************************
423BOOL OSLibQueryWindowRectAbsolute (HWND hwndOS2, PRECT pRect)
424{
425 BOOL rc;
426 RECTLOS2 rectl;
427
428 rc = WinQueryWindowRect (hwndOS2, (RECTL *)&rectl);
429 if (rc)
430 {
431 rc = WinMapWindowPoints (hwndOS2, HWND_DESKTOP, (POINTL *)&rectl, 2);
432 if (rc)
433 {
434 pRect->left = rectl.xLeft;
435 pRect->right = rectl.xRight;
436 pRect->top = mapScreenY (rectl.yTop);
437 pRect->bottom = mapScreenY (rectl.yBottom);
438 }
439 }
440 if (!rc)
441 {
442 memset(pRect, 0, sizeof(*pRect));
443 }
444 return rc;
445}
446//******************************************************************************
447//******************************************************************************
448#if 0
449BOOL OSLibWinQueryWindowRect(Win32BaseWindow *window, PRECT pRect, int RelativeTo)
450{
451 BOOL rc;
452 RECTLOS2 rectl;
453
454 rc = WinQueryWindowRect(window->getOS2WindowHandle(), (PRECTL)&rectl);
455 if(rc) {
456 if(RelativeTo == RELATIVE_TO_SCREEN) {
457 mapOS2ToWin32RectFrame(window,windowDesktop,&rectl,pRect);
458 }
459 else mapOS2ToWin32RectFrame(window,&rectl,pRect);
460 }
461 else memset(pRect, 0, sizeof(RECT));
462 return rc;
463}
464#endif
465//******************************************************************************
466//******************************************************************************
467BOOL OSLibWinIsIconic(HWND hwnd)
468{
469 SWP swp;
470 BOOL rc;
471
472 rc = WinQueryWindowPos(hwnd, &swp);
473 if(rc == FALSE) {
474 dprintf(("OSLibWinIsIconic: WinQueryWindowPos %x failed", hwnd));
475 return FALSE;
476 }
477
478 if(swp.fl & SWP_MINIMIZE)
479 return TRUE;
480 else return FALSE;
481}
482//******************************************************************************
483//******************************************************************************
484BOOL OSLibWinSetActiveWindow(HWND hwnd)
485{
486 BOOL rc;
487
488 rc = WinSetActiveWindow(HWND_DESKTOP, hwnd);
489 if(rc == FALSE) {
490 dprintf(("WinSetActiveWindow %x failure: %x", hwnd, OSLibWinGetLastError()));
491 }
492 return rc;
493}
494//******************************************************************************
495//******************************************************************************
496BOOL OSLibWinSetFocus(HWND hwnd)
497{
498 return WinSetFocus(HWND_DESKTOP, hwnd);
499}
500//******************************************************************************
501//******************************************************************************
502BOOL OSLibWinEnableWindow(HWND hwnd, BOOL fEnable)
503{
504 BOOL rc;
505 HWND hwndClient;
506
507 rc = WinEnableWindow(hwnd, fEnable);
508 hwndClient = WinWindowFromID(hwnd, FID_CLIENT);
509 if(hwndClient) {
510 WinEnableWindow(hwndClient, fEnable);
511 }
512 return rc;
513}
514//******************************************************************************
515//******************************************************************************
516BOOL OSLibWinIsWindowEnabled(HWND hwnd)
517{
518 return WinIsWindowEnabled(hwnd);
519}
520//******************************************************************************
521//******************************************************************************
522BOOL OSLibWinIsWindowVisible(HWND hwnd)
523{
524 return WinIsWindowVisible(hwnd);
525}
526//******************************************************************************
527//******************************************************************************
528HWND OSLibWinQueryActiveWindow()
529{
530 return WinQueryActiveWindow(HWND_DESKTOP);
531}
532//******************************************************************************
533//******************************************************************************
534LONG OSLibWinQueryWindowTextLength(HWND hwnd)
535{
536 return WinQueryWindowTextLength(hwnd);
537}
538//******************************************************************************
539//******************************************************************************
540LONG OSLibWinQueryWindowText(HWND hwnd, LONG length, LPSTR lpsz)
541{
542 return WinQueryWindowText(hwnd, length, lpsz);
543}
544//******************************************************************************
545//******************************************************************************
546BOOL OSLibWinSetWindowText(HWND hwnd, LPSTR lpsz)
547{
548 return WinSetWindowText(hwnd, lpsz);
549}
550//******************************************************************************
551//******************************************************************************
552BOOL OSLibWinSetTitleBarText(HWND hwnd, LPSTR lpsz)
553{
554 return WinSetWindowText(WinWindowFromID(hwnd, FID_TITLEBAR), lpsz);
555}
556//******************************************************************************
557//******************************************************************************
558BOOL OSLibWinFlashWindow(HWND hwnd, BOOL fFlash)
559{
560 return WinFlashWindow(hwnd, fFlash);
561}
562//******************************************************************************
563//******************************************************************************
564HWND OSLibWinWindowFromPoint(HWND hwnd, PVOID ppoint)
565{
566 return WinWindowFromPoint((hwnd == OSLIB_HWND_DESKTOP) ? HWND_DESKTOP : hwnd, (PPOINTL)ppoint, TRUE);
567}
568//******************************************************************************
569//******************************************************************************
570BOOL OSLibWinMinimizeWindow(HWND hwnd)
571{
572 /* @@PF The reason for this weird minimize algorithm is that we are not fully
573 using PM for minimization. I.e. we respect all PM messages yet we do mess
574 so much with some messages that minimization is based partly on vodoo.
575 That is if you try minimize and deactivate in one call it will fail.
576 Here we deactivate yourselves and give focus to next window that is
577 on desktop, this func also works with MDI */
578
579 BOOL rc;
580 HWND hwndNext;
581
582 rc = WinSetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_MINIMIZE);
583
584 if (rc) {
585 rc = WinSetWindowPos(hwnd, HWND_BOTTOM, 0, 0, 0, 0, SWP_DEACTIVATE | SWP_ZORDER);
586 if (rc)
587 {
588 HENUM henum;
589 henum = WinBeginEnumWindows(HWND_DESKTOP);
590 while ((hwndNext = WinGetNextWindow(henum)) != NULLHANDLE)
591 {
592 if (WinIsWindowVisible(hwndNext) && WinIsWindowShowing(hwndNext)) break;
593 }
594 WinEndEnumWindows (henum);
595 rc = WinSetWindowPos(hwndNext, HWND_TOP, 0, 0, 0, 0, SWP_ACTIVATE | SWP_ZORDER);
596 }
597 }
598
599 return (rc);
600}
601//******************************************************************************
602//******************************************************************************
603BOOL OSLibWinGetBorderSize(HWND hwnd, OSLIBPOINT *pointl)
604{
605 pointl->x = 0;
606 pointl->y = 0;
607 return (BOOL) WinSendMsg(hwnd, WM_QUERYBORDERSIZE, MPFROMP( &pointl), 0);
608}
609//******************************************************************************
610//******************************************************************************
611BOOL OSLibWinSetIcon(HWND hwnd, HANDLE hIcon)
612{
613 ULONG hIconOS2 = GetOS2Icon(hIcon);
614 if(hIconOS2)
615 return (BOOL) WinSendMsg(hwnd, WM_SETICON, (MPARAM)hIconOS2, 0);
616 return FALSE;
617}
618//******************************************************************************
619//******************************************************************************
620BOOL OSLibWinQueryWindowPos (HWND hwnd, PSWP pswp)
621{
622 return WinQueryWindowPos(hwnd, pswp);
623}
624//******************************************************************************
625//******************************************************************************
626void OSLibMapSWPtoWINDOWPOS(PSWP pswp, PWINDOWPOS pwpos, PSWP pswpOld,
627 int parentHeight, HWND hwnd)
628{
629 HWND hWindow = pswp->hwnd;
630 HWND hWndInsertAfter = pswp->hwndInsertBehind;
631 long x = pswp->x;
632 long y = pswp->y;
633 long cx = pswp->cx;
634 long cy = pswp->cy;
635 UINT fuFlags = (UINT)pswp->fl;
636
637 HWND hWinAfter;
638 ULONG flags = 0;
639
640 HWND hWnd = (hWindow == HWND_DESKTOP) ? HWND_DESKTOP_W: hWindow;
641
642 if (hWndInsertAfter == HWND_TOP)
643 hWinAfter = HWND_TOP_W;
644 else if (hWndInsertAfter == HWND_BOTTOM)
645 hWinAfter = HWND_BOTTOM_W;
646 else
647 hWinAfter = (HWND) hWndInsertAfter;
648
649 //***********************************
650 // convert PM flags to Windows flags
651 //***********************************
652 if (!(fuFlags & SWP_SIZE)) flags |= SWP_NOSIZE_W;
653 if (!(fuFlags & SWP_MOVE)) flags |= SWP_NOMOVE_W;
654 if (!(fuFlags & SWP_ZORDER)) flags |= SWP_NOZORDER_W;
655 if ( fuFlags & SWP_NOREDRAW) flags |= SWP_NOREDRAW_W;
656 if (!(fuFlags & SWP_ACTIVATE)) flags |= SWP_NOACTIVATE_W;
657 if ( fuFlags & SWP_SHOW) flags |= SWP_SHOWWINDOW_W;
658 if ( fuFlags & SWP_HIDE) flags |= SWP_HIDEWINDOW_W;
659 if ( fuFlags & SWP_NOADJUST) flags |= SWP_NOSENDCHANGING_W;
660
661 if(fuFlags & (SWP_MOVE | SWP_SIZE))
662 {
663 y = parentHeight - y - pswp->cy;
664
665 if ((pswp->x == pswpOld->x) && (pswp->y == pswpOld->y))
666 flags |= SWP_NOMOVE_W;
667
668 if ((pswp->cx == pswpOld->cx) && (pswp->cy == pswpOld->cy))
669 flags |= SWP_NOSIZE_W;
670
671 if (fuFlags & SWP_SIZE)
672 {
673 if (pswp->cy != pswpOld->cy)
674 {
675 flags &= ~SWP_NOMOVE_W;
676 }
677 }
678 }
679
680 pswpOld->x = pswp->x;
681 pswpOld->y = parentHeight-pswp->y-pswp->cy;
682 pswpOld->cx = pswp->cx;
683 pswpOld->cy = pswp->cy;
684
685 dprintf(("window (%d,%d)(%d,%d) client (%d,%d)(%d,%d)",
686 x,y,cx,cy, pswpOld->x,pswpOld->y,pswpOld->cx,pswpOld->cy));
687
688 pwpos->flags = (UINT)flags;
689 pwpos->cy = cy;
690 pwpos->cx = cx;
691 pwpos->x = x;
692 pwpos->y = y;
693 pwpos->hwndInsertAfter = hWinAfter;
694 pwpos->hwnd = hWindow;
695}
696//******************************************************************************
697//******************************************************************************
698void OSLibMapWINDOWPOStoSWP(struct tagWINDOWPOS *pwpos, PSWP pswp, PSWP pswpOld,
699 int parentHeight, HWND hFrame)
700{
701 BOOL fCvt = FALSE;
702
703 HWND hWnd = pwpos->hwnd;
704 HWND hWndInsertAfter = pwpos->hwndInsertAfter;
705 long x = pwpos->x;
706 long y = pwpos->y;
707 long cx = pwpos->cx;
708 long cy = pwpos->cy;
709 UINT fuFlags = pwpos->flags;
710
711 HWND hWinAfter;
712 ULONG flags = 0;
713 HWND hWindow = hWnd ? (HWND)hWnd : HWND_DESKTOP;
714
715 if (hWndInsertAfter == HWND_TOPMOST_W)
716// hWinAfter = HWND_TOPMOST;
717 hWinAfter = HWND_TOP;
718 else if (hWndInsertAfter == HWND_NOTOPMOST_W)
719// hWinAfter = HWND_NOTOPMOST;
720 hWinAfter = HWND_TOP;
721 else if (hWndInsertAfter == HWND_TOP_W)
722 hWinAfter = HWND_TOP;
723 else if (hWndInsertAfter == HWND_BOTTOM_W)
724 hWinAfter = HWND_BOTTOM;
725 else
726 hWinAfter = (HWND) hWndInsertAfter;
727
728 if (!(fuFlags & SWP_NOSIZE_W )) flags |= SWP_SIZE;
729 if (!(fuFlags & SWP_NOMOVE_W )) flags |= SWP_MOVE;
730 if (!(fuFlags & SWP_NOZORDER_W )) flags |= SWP_ZORDER;
731 if ( fuFlags & SWP_NOREDRAW_W ) flags |= SWP_NOREDRAW;
732 if (!(fuFlags & SWP_NOACTIVATE_W)) flags |= SWP_ACTIVATE;
733 if ( fuFlags & SWP_SHOWWINDOW_W) flags |= SWP_SHOW;
734 if ( fuFlags & SWP_HIDEWINDOW_W) flags |= SWP_HIDE;
735 if ( fuFlags & SWP_NOSENDCHANGING_W) flags |= SWP_NOADJUST;
736
737 if(flags & (SWP_MOVE | SWP_SIZE))
738 {
739 if((flags & SWP_MOVE) == 0)
740 {
741 x = pswpOld->x;
742 y = pswpOld->y;
743
744 y = parentHeight - y - pswpOld->cy;
745 }
746
747 if(flags & SWP_SIZE)
748 {
749 if (cy != pswpOld->cy)
750 flags |= SWP_MOVE;
751 }
752 else
753 {
754 cx = pswpOld->cx;
755 cy = pswpOld->cy;
756 }
757 y = parentHeight - y - cy;
758
759 if ((pswpOld->x == x) && (pswpOld->y == y))
760 flags &= ~SWP_MOVE;
761
762 if ((pswpOld->cx == cx) && (pswpOld->cy == cy))
763 flags &= ~SWP_SIZE;
764 }
765
766 pswp->fl = flags;
767 pswp->cy = cy;
768 pswp->cx = cx;
769 pswp->x = x;
770 pswp->y = y;
771 pswp->hwndInsertBehind = hWinAfter;
772 pswp->hwnd = hWindow;
773 pswp->ulReserved1 = 0;
774 pswp->ulReserved2 = 0;
775}
776//******************************************************************************
777//******************************************************************************
778void OSLibWinSetClientPos(HWND hwnd, int x, int y, int cx, int cy, int parentHeight)
779{
780 SWP swp;
781 BOOL rc;
782
783 swp.hwnd = hwnd;
784 swp.hwndInsertBehind = 0;
785 swp.x = x;
786 swp.y = parentHeight - y - cy;
787 swp.cx = cx;
788 swp.cy = cy;
789 swp.fl = SWP_MOVE | SWP_SIZE;
790
791 dprintf(("OSLibWinSetClientPos (%d,%d) (%d,%d) -> (%d,%d) (%d,%d)", x, y, x+cx, y+cy, swp.x, swp.y, swp.x+swp.cx, swp.y+swp.cy));
792
793 rc = WinSetMultWindowPos(GetThreadHAB(), &swp, 1);
794 if(rc == FALSE) {
795 dprintf(("OSLibWinSetClientPos: WinSetMultWindowPos %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
796 }
797}
798//******************************************************************************
799//******************************************************************************
800BOOL OSLibWinCalcFrameRect(HWND hwndFrame, RECT *pRect, BOOL fClient)
801{
802 BOOL rc;
803
804 WinMapWindowPoints(hwndFrame, HWND_DESKTOP, (PPOINTL)pRect, 2);
805
806 rc = WinCalcFrameRect(hwndFrame, (PRECTL)pRect, fClient);
807 WinMapWindowPoints(HWND_DESKTOP, hwndFrame, (PPOINTL)pRect, 2);
808
809 return rc;
810}
811//******************************************************************************
812//******************************************************************************
813BOOL OSLibGetMinMaxInfo(HWND hwndFrame, MINMAXINFO *pMinMax)
814{
815 TRACKINFO tinfo;
816
817 memset(&tinfo, 0, sizeof(TRACKINFO));
818 WinSendMsg(hwndFrame, WM_QUERYTRACKINFO, (MPARAM)0,(MPARAM)&tinfo);
819
820 pMinMax->ptMinTrackSize.x = tinfo.ptlMinTrackSize.x;
821 pMinMax->ptMinTrackSize.y = tinfo.ptlMinTrackSize.y;
822 pMinMax->ptMaxTrackSize.x = tinfo.ptlMaxTrackSize.x;
823 pMinMax->ptMaxTrackSize.y = tinfo.ptlMaxTrackSize.y;
824 return TRUE;
825}
826//******************************************************************************
827//******************************************************************************
828HWND OSLibWinBeginEnumWindows(HWND hwnd)
829{
830 if(hwnd == OSLIB_HWND_DESKTOP) hwnd = HWND_DESKTOP;
831 else
832 if(hwnd == OSLIB_HWND_OBJECT) hwnd = HWND_OBJECT;
833
834 return WinBeginEnumWindows(hwnd);
835}
836//******************************************************************************
837//******************************************************************************
838HWND OSLibWinGetNextWindow(HWND hwndEnum)
839{
840 return WinGetNextWindow(hwndEnum);
841}
842//******************************************************************************
843//******************************************************************************
844HWND OSLibWinQueryClientWindow(HWND hwndFrame)
845{
846 HWND hwndClient = 0;
847
848 if(((ULONG)WinSendMsg(hwndFrame, WM_QUERYFRAMEINFO, NULL, NULL)) & FI_FRAME)
849 hwndClient = WinWindowFromID(hwndFrame, FID_CLIENT);
850
851 return hwndClient;
852}
853//******************************************************************************
854//******************************************************************************
855BOOL OSLibWinEndEnumWindows(HWND hwndEnum)
856{
857 return WinEndEnumWindows(hwndEnum);
858}
859//******************************************************************************
860//******************************************************************************
861BOOL OSLibWinQueryWindowProcess(HWND hwnd, ULONG *pid, ULONG *tid)
862{
863 BOOL ret;
864
865 ret = WinQueryWindowProcess(hwnd, pid, tid);
866 *tid = MAKE_THREADID(*pid, *tid);
867 return ret;
868}
869//******************************************************************************
870//******************************************************************************
871BOOL OSLibWinMapWindowPoints (HWND hwndFrom, HWND hwndTo, OSLIBPOINT *pptl, ULONG num)
872{
873 return WinMapWindowPoints (hwndFrom, hwndTo, (PPOINTL)pptl, num);
874}
875//******************************************************************************
876//******************************************************************************
877HWND OSLibWinQueryObjectWindow(VOID)
878{
879 return WinQueryObjectWindow(HWND_DESKTOP);
880}
881//******************************************************************************
882//******************************************************************************
883HWND OSLibWinObjectWindowFromID(HWND hwndOwner, ULONG ID)
884{
885 HWND hwndNext, hwndFound=0;
886 HENUM henum;
887
888 henum = WinBeginEnumWindows(HWND_OBJECT);
889 while ((hwndNext = WinGetNextWindow(henum)) != 0)
890 {
891 if(WinQueryWindow(hwndNext, QW_OWNER) == hwndOwner &&
892 WinQueryWindowUShort(hwndNext, QWS_ID) == ID)
893 {
894 hwndFound = hwndNext;
895 break;
896 }
897 }
898 WinEndEnumWindows(henum);
899 return hwndFound;
900}
901//******************************************************************************
902//******************************************************************************
903BOOL OSLibSetWindowID(HWND hwnd, ULONG value)
904{
905 dprintf(("OSLibSetWindowID hwnd:%x ID:%x", hwnd, value));
906 return WinSetWindowULong(hwnd, QWS_ID, value);
907}
908//******************************************************************************
909//******************************************************************************
910PVOID OSLibWinSubclassWindow(HWND hwnd,PVOID newWndProc)
911{
912 return WinSubclassWindow(hwnd,(PFNWP)newWndProc);
913}
914//******************************************************************************
915//******************************************************************************
916BOOL OSLibSetWindowRestoreRect(HWND hwnd, PRECT pRect)
917{
918 ULONG yHeight = OSLibGetWindowHeight(WinQueryWindow(hwnd, QW_PARENT));
919
920 WinSetWindowUShort(hwnd, QWS_XRESTORE, (USHORT)pRect->left );
921 WinSetWindowUShort(hwnd, QWS_YRESTORE, (USHORT)(yHeight - pRect->top -
922 (pRect->bottom - pRect->top)));
923 WinSetWindowUShort(hwnd, QWS_CXRESTORE, (USHORT)(pRect->right - pRect->left));
924 WinSetWindowUShort(hwnd, QWS_CYRESTORE, (USHORT)(pRect->bottom - pRect->top));
925 return TRUE;
926}
927//******************************************************************************
928//******************************************************************************
929BOOL OSLibSetWindowMinPos(HWND hwnd, ULONG x, ULONG y)
930{
931 ULONG yHeight = OSLibGetWindowHeight(WinQueryWindow(hwnd, QW_PARENT));
932
933 WinSetWindowUShort(hwnd, QWS_XMINIMIZE, (USHORT)x );
934 WinSetWindowUShort(hwnd, QWS_YMINIMIZE, (USHORT)(yHeight - y -
935 ( 2 * WinQuerySysValue( HWND_DESKTOP, SV_CYSIZEBORDER)) -
936 WinQuerySysValue( HWND_DESKTOP, SV_CYICON)));
937 return TRUE;
938}
939//******************************************************************************
940//******************************************************************************
941BOOL OSLibWinGetKeyboardStateTable(unsigned char *PMKeyState)
942{
943 return WinSetKeyboardStateTable(HWND_DESKTOP, (PBYTE)PMKeyState, FALSE );
944}
945//******************************************************************************
946//******************************************************************************
947BOOL OSLibWinSetKeyboardStateTable(unsigned char *PMKeyState)
948{
949 return WinSetKeyboardStateTable(HWND_DESKTOP, (PBYTE)PMKeyState, TRUE );
950}
951//******************************************************************************
952//******************************************************************************
953USHORT APIENTRY WinTranslateChar2( USHORT /* Codepage (currently ignored) */
954 , PUSHORT /* Ptr to char to translate */
955 , PULONG /* Ptr to deadkey save info */
956 , USHORT /* Translation option (TC_xxx) */
957 , PUSHORT /* Ptr to shift state (TCF_xxx) */
958 );
959//******************************************************************************
960//******************************************************************************
961USHORT OSLibWinTranslateChar(USHORT usScanCode, ULONG type, USHORT shiftstate)
962{
963 USHORT usResult;
964 USHORT sel = GetFS();
965
966 usResult = WinTranslateChar2(0, &usScanCode, NULL, type, &shiftstate);
967 SetFS(sel);
968 return usScanCode;
969}
970//******************************************************************************
971//******************************************************************************
972BOOL OSLibWinEnableWindowUpdate(HWND hwndFrame, HWND hwndClient ,BOOL fEnable)
973{
974 WinEnableWindowUpdate(hwndFrame, fEnable);
975 return WinEnableWindowUpdate(hwndClient, fEnable);
976}
977//******************************************************************************
978//******************************************************************************
979ULONG OSLibWinGetLastError()
980{
981 return WinGetLastError(GetThreadHAB()) & 0xFFFF;
982}
983//******************************************************************************
984//******************************************************************************
985void OSLibWinShowTaskList(HWND hwndFrame)
986{
987 SWBLOCK swblk;
988 // the first entry returned is always the window list itself
989 if (WinQuerySwitchList(0, &swblk, sizeof(SWBLOCK)) > 0)
990 WinSetActiveWindow(HWND_DESKTOP, swblk.aswentry[0].swctl.hwnd);
991}
992//******************************************************************************
993//******************************************************************************
994void OSLibSetWindowStyle(HWND hwndFrame, HWND hwndClient, ULONG dwStyle, ULONG dwExStyle)
995{
996 ULONG dwWinStyle;
997 ULONG dwOldWinStyle;
998
999 //client window:
1000 dwWinStyle = WinQueryWindowULong(hwndClient, QWL_STYLE);
1001 dwOldWinStyle = dwWinStyle;
1002
1003 if(dwStyle & WS_CLIPCHILDREN_W) {
1004 dwWinStyle |= WS_CLIPCHILDREN;
1005 }
1006 else dwWinStyle &= ~WS_CLIPCHILDREN;
1007
1008 if(dwWinStyle != dwOldWinStyle) {
1009 WinSetWindowULong(hwndClient, QWL_STYLE, dwWinStyle);
1010 }
1011
1012 //Frame window
1013 dwWinStyle = WinQueryWindowULong(hwndFrame, QWL_STYLE);
1014 dwOldWinStyle = dwWinStyle;
1015 if(dwStyle & WS_DISABLED_W) {
1016 dwWinStyle |= WS_DISABLED;
1017 }
1018 else dwWinStyle &= ~WS_DISABLED;
1019
1020 if(dwStyle & WS_CLIPSIBLINGS_W) {
1021 dwWinStyle |= WS_CLIPSIBLINGS;
1022 }
1023 else dwWinStyle &= ~WS_CLIPSIBLINGS;
1024
1025 if(dwStyle & WS_MINIMIZE_W) {
1026 dwWinStyle |= WS_MINIMIZED;
1027 }
1028 else dwWinStyle &= ~WS_MINIMIZED;
1029
1030 if(dwStyle & WS_MAXIMIZE_W) {
1031 dwWinStyle |= WS_MAXIMIZED;
1032 }
1033 else dwWinStyle &= ~WS_MAXIMIZED;
1034
1035 if(dwWinStyle != dwOldWinStyle) {
1036 WinSetWindowULong(hwndFrame, QWL_STYLE, dwWinStyle);
1037 }
1038 if(fOS2Look) {
1039 ULONG OSFrameStyle = 0;
1040 if((dwStyle & WS_CAPTION_W) == WS_CAPTION_W) {
1041 if(WinWindowFromID(hwndFrame, FID_TITLEBAR) == 0) {
1042 OSFrameStyle = FCF_TITLEBAR;
1043 }
1044 if((dwStyle & WS_SYSMENU_W) && !(dwExStyle & WS_EX_TOOLWINDOW_W))
1045 {
1046 if(WinWindowFromID(hwndFrame, FID_SYSMENU) == 0) {
1047 OSFrameStyle |= FCF_SYSMENU;
1048 }
1049 }
1050 if((dwStyle & WS_MINIMIZEBOX_W) || (dwStyle & WS_MAXIMIZEBOX_W)) {
1051 if(WinWindowFromID(hwndFrame, FID_MINMAX) == 0) {
1052 OSFrameStyle |= FCF_MINMAX;
1053 }
1054 }
1055 else
1056 if(dwStyle & WS_SYSMENU_W) {
1057 if(WinWindowFromID(hwndFrame, FID_MINMAX) == 0) {
1058 OSFrameStyle |= FCF_CLOSEBUTTON;
1059 }
1060 }
1061 }
1062 if(OSFrameStyle) {
1063 FRAMECDATA FCData = {sizeof (FRAMECDATA), 0, 0, 0};
1064
1065 FCData.flCreateFlags = OSFrameStyle;
1066 WinCreateFrameControls(hwndFrame, &FCData, NULL);
1067 }
1068 }
1069}
1070//******************************************************************************
1071//******************************************************************************
1072DWORD OSLibQueryWindowStyle(HWND hwnd)
1073{
1074 return WinQueryWindowULong(hwnd, QWL_STYLE);
1075}
1076//******************************************************************************
1077//******************************************************************************
1078void OSLibWinSetVisibleRegionNotify(HWND hwnd, BOOL fNotify)
1079{
1080 WinSetVisibleRegionNotify(hwnd, fNotify);
1081}
1082//******************************************************************************
1083//******************************************************************************
1084HWND OSLibWinQueryCapture()
1085{
1086 return WinQueryCapture(HWND_DESKTOP);
1087}
1088//******************************************************************************
1089//******************************************************************************
1090BOOL OSLibWinSetCapture(HWND hwnd)
1091{
1092 return WinSetCapture(HWND_DESKTOP, hwnd);
1093}
1094//******************************************************************************
1095//******************************************************************************
1096BOOL OSLibWinRemoveFromTasklist(HANDLE hTaskList)
1097{
1098 return (WinRemoveSwitchEntry(hTaskList)) ? FALSE : TRUE;
1099}
1100//******************************************************************************
1101//******************************************************************************
1102HANDLE OSLibWinAddToTaskList(HWND hwndFrame, char *title, BOOL fVisible)
1103{
1104 SWCNTRL swctrl;
1105 ULONG tid;
1106
1107 swctrl.hwnd = hwndFrame;
1108 swctrl.hwndIcon = 0;
1109 swctrl.hprog = 0;
1110 WinQueryWindowProcess(hwndFrame, (PPID)&swctrl.idProcess, (PTID)&tid);
1111 swctrl.idSession = 0;
1112 swctrl.uchVisibility = (fVisible) ? SWL_VISIBLE : SWL_INVISIBLE;
1113 swctrl.fbJump = SWL_JUMPABLE;
1114 swctrl.bProgType = PROG_PM;
1115 if(title) {
1116// strncpy(swctrl.szSwtitle, title, MAXNAMEL+4);
1117 CharToOemBuffA( title, swctrl.szSwtitle, MAXNAMEL+4 );
1118 swctrl.szSwtitle[MAXNAMEL+4-1] = 0;
1119 }
1120 else {
1121 swctrl.szSwtitle[0] = 0;
1122 swctrl.uchVisibility = SWL_INVISIBLE;
1123 }
1124 return WinAddSwitchEntry(&swctrl);
1125}
1126//******************************************************************************
1127//******************************************************************************
1128BOOL OSLibWinChangeTaskList(HANDLE hTaskList, HWND hwndFrame, char *title, BOOL fVisible)
1129{
1130 SWCNTRL swctrl;
1131 ULONG tid;
1132
1133 swctrl.hwnd = hwndFrame;
1134 swctrl.hwndIcon = 0;
1135 swctrl.hprog = 0;
1136 WinQueryWindowProcess(hwndFrame, (PPID)&swctrl.idProcess, (PTID)&tid);
1137 swctrl.idSession = 0;
1138 swctrl.uchVisibility = (fVisible) ? SWL_VISIBLE : SWL_INVISIBLE;
1139 swctrl.fbJump = SWL_JUMPABLE;
1140 swctrl.bProgType = PROG_PM;
1141 if(title) {
1142// strncpy(swctrl.szSwtitle, title, MAXNAMEL+4);
1143 CharToOemBuffA( title, swctrl.szSwtitle, MAXNAMEL+4 );
1144 swctrl.szSwtitle[MAXNAMEL+4-1] = 0;
1145 }
1146 else {
1147 swctrl.szSwtitle[0] = 0;
1148 swctrl.uchVisibility = SWL_INVISIBLE;
1149 }
1150 return (WinChangeSwitchEntry(hTaskList, &swctrl)) ? FALSE : TRUE;
1151}
1152//******************************************************************************
1153//******************************************************************************
1154BOOL OSLibWinLockWindowUpdate(HWND hwnd)
1155{
1156 return WinLockWindowUpdate(HWND_DESKTOP, (HWND)hwnd);
1157}
1158//******************************************************************************
1159//******************************************************************************
1160ULONG OSLibGetScreenHeight()
1161{
1162 return ScreenHeight;
1163}
1164//******************************************************************************
1165//******************************************************************************
1166ULONG OSLibGetScreenWidth()
1167{
1168 return ScreenWidth;
1169}
1170//******************************************************************************
1171//Returns the maximum position for a window
1172//Should only be used from toplevel windows
1173//******************************************************************************
1174BOOL OSLibWinGetMaxPosition(HWND hwndOS2, RECT *rect)
1175{
1176 SWP swp;
1177
1178 if(!WinGetMaxPosition(hwndOS2, &swp)) {
1179 dprintf(("WARNING: WinGetMaxPosition %x returned FALSE", hwndOS2));
1180 return FALSE;
1181 }
1182 rect->left = swp.x;
1183 rect->right = swp.x + swp.cx;
1184 rect->top = ScreenHeight - (swp.y + swp.cy);
1185 rect->bottom = ScreenHeight - swp.y;
1186 return TRUE;
1187}
1188//******************************************************************************
1189//******************************************************************************
1190BOOL OSLibWinShowPointer(BOOL fShow)
1191{
1192 return WinShowPointer(HWND_DESKTOP, fShow);
1193}
1194//******************************************************************************
1195//******************************************************************************
1196ULONG OSLibWinQuerySysColor(int index)
1197{
1198 return CONVERT_RGB(WinQuerySysColor(HWND_DESKTOP, index, 0));
1199}
1200//******************************************************************************
1201//******************************************************************************
Note: See TracBrowser for help on using the repository browser.