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

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

PF: Added support for WS_EX_TOPMOST

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