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

Last change on this file since 1839 was 1839, checked in by sandervl, 26 years ago

desktop + misc fixes

File size: 41.8 KB
Line 
1/* $Id: oslibwin.cpp,v 1.48 1999-11-25 19:22:02 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 HAS_3DFRAME(exStyle) \
30 ((exStyle & WS_EX_CLIENTEDGE_W) || (exStyle & WS_EX_STATICEDGE_W) || (exStyle & WS_EX_WINDOWEDGE_W))
31
32//******************************************************************************
33//******************************************************************************
34BOOL 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//******************************************************************************
48BOOL OSLibWinSetOwner(HWND hwnd, HWND hwndOwner)
49{
50 return WinSetOwner(hwnd, hwndOwner);
51}
52//******************************************************************************
53//******************************************************************************
54HWND OSLibWinCreateWindow(HWND hwndParent, ULONG dwWinStyle, ULONG dwFrameStyle,
55 char *pszName, HWND Owner, ULONG fHWND_BOTTOM, HWND *hwndFrame,
56 ULONG id)
57{
58 HWND hwndClient;
59
60 dprintf(("WinCreateWindow %x %x %x %s", hwndParent, dwWinStyle, dwFrameStyle, pszName));
61
62 if(pszName && *pszName == 0) {
63 pszName = NULL;
64 }
65 if(hwndParent == OSLIB_HWND_DESKTOP) {
66 hwndParent = HWND_DESKTOP;
67 }
68 if(Owner == OSLIB_HWND_DESKTOP) {
69 Owner = HWND_DESKTOP;
70 }
71 ULONG dwClientStyle;
72#if 1
73
74 BOOL TopLevel = hwndParent == HWND_DESKTOP;
75// if(dwFrameStyle & FCF_TITLEBAR)
76// TopLevel = TRUE;
77
78 FRAMECDATA FCData = {sizeof (FRAMECDATA), 0, 0, 0};
79
80 dwClientStyle = dwWinStyle & ~(WS_TABSTOP | WS_GROUP | WS_CLIPSIBLINGS);
81
82 dwFrameStyle |= FCF_NOBYTEALIGN;
83 if (hwndParent == HWND_DESKTOP && dwFrameStyle & FCF_TITLEBAR) {
84 dwFrameStyle |= FCF_TASKLIST | FCF_NOMOVEWITHOWNER;
85 }
86
87 dwWinStyle &= ~WS_CLIPCHILDREN;
88 FCData.flCreateFlags = dwFrameStyle;
89
90 *hwndFrame = WinCreateWindow (hwndParent,
91 TopLevel ? WC_FRAME : WIN32_INNERFRAME,
92 pszName, dwWinStyle, 0, 0, 50, 30,
93 hwndParent, HWND_TOP,
94 id, &FCData, NULL);
95 if (*hwndFrame) {
96 hwndClient = WinCreateWindow (*hwndFrame, WIN32_STDCLASS,
97 NULL, dwClientStyle, 0, 0, 0, 0,
98 *hwndFrame, HWND_TOP, FID_CLIENT, NULL, NULL);
99 if (hwndClient != NULLHANDLE)
100 WinSendMsg (*hwndFrame, WM_UPDATEFRAME, 0, 0);
101
102 return hwndClient;
103 }
104 dprintf(("OSLibWinCreateWindow: (FRAME) WinCreateStdWindow failed (%x)", WinGetLastError(GetThreadHAB())));
105 return 0;
106#else
107 dwClientStyle = dwWinStyle & ~(WS_TABSTOP | WS_GROUP);
108
109 dwFrameStyle |= FCF_NOBYTEALIGN;
110 if (hwndParent == HWND_DESKTOP && dwFrameStyle & FCF_TITLEBAR)
111 dwFrameStyle |= FCF_TASKLIST | FCF_NOMOVEWITHOWNER;
112
113 dwWinStyle &= ~WS_CLIPCHILDREN;
114
115 *hwndFrame = WinCreateStdWindow(hwndParent, dwWinStyle,
116 &dwFrameStyle, WIN32_STDCLASS,
117 "", dwClientStyle, 0, id, &hwndClient);
118 if(*hwndFrame) {
119 if(pszName) {
120 WinSetWindowText(*hwndFrame, pszName);
121 }
122 return hwndClient;
123 }
124 dprintf(("OSLibWinCreateWindow: (FRAME) WinCreateStdWindow failed (%x)", WinGetLastError(GetThreadHAB())));
125 return 0;
126#endif
127}
128//******************************************************************************
129//******************************************************************************
130BOOL OSLibWinConvertStyle(ULONG dwStyle, ULONG *dwExStyle, ULONG *OSWinStyle, ULONG *OSFrameStyle, ULONG *borderWidth, ULONG *borderHeight)
131{
132 *OSWinStyle = 0;
133 *OSFrameStyle = 0;
134 *borderWidth = 0;
135 *borderHeight = 0;
136
137 /* Window styles */
138 if(dwStyle & WS_MINIMIZE_W)
139 *OSWinStyle |= WS_MINIMIZED;
140//Done explicitely in CreateWindowExA
141#if 1
142 if(dwStyle & WS_VISIBLE_W)
143 *OSWinStyle |= WS_VISIBLE;
144#endif
145 if(dwStyle & WS_DISABLED_W)
146 *OSWinStyle |= WS_DISABLED;
147 if(dwStyle & WS_CLIPSIBLINGS_W)
148 *OSWinStyle |= WS_CLIPSIBLINGS;
149 if(dwStyle & WS_CLIPCHILDREN_W)
150 *OSWinStyle |= WS_CLIPCHILDREN;
151 if(dwStyle & WS_MAXIMIZE_W)
152 *OSWinStyle |= WS_MAXIMIZED;
153 if(dwStyle & WS_GROUP_W)
154 *OSWinStyle |= WS_GROUP;
155 if(dwStyle & WS_TABSTOP_W)
156 *OSWinStyle |= WS_TABSTOP;
157
158 if(dwStyle & WS_CHILD_W && !((dwStyle & WS_CAPTION_W) == WS_CAPTION_W))
159 {
160//SvL: Causes crash in VPBuddy if enabled -> find bug
161#if 0
162 if (!HAS_3DFRAME(*dwExStyle) && (dwStyle & (WS_DLGFRAME_W | WS_THICKFRAME_W))) *dwExStyle |= WS_EX_DLGMODALFRAME_W;
163#endif
164
165 if (*dwExStyle & WS_EX_CLIENTEDGE_W)
166 {
167 *OSFrameStyle |= FCF_SIZEBORDER;
168 *borderHeight = *borderWidth = 2;
169 }
170 else
171 if (*dwExStyle & WS_EX_DLGMODALFRAME_W)
172 {
173 *OSFrameStyle |= FCF_SIZEBORDER;
174 *borderHeight = *borderWidth = 3;
175 }
176 else
177 if (*dwExStyle & WS_EX_STATICEDGE_W)
178 {
179 *OSFrameStyle |= FCF_SIZEBORDER;
180 *borderHeight = *borderWidth = 2;
181 }
182 else
183 if(dwStyle & WS_BORDER_W)
184 {
185 *OSFrameStyle |= FCF_BORDER;
186 *borderHeight = *borderWidth = 1;
187 }
188 else if (*dwExStyle & WS_EX_WINDOWEDGE_W); //no border
189
190 if(dwStyle & WS_VSCROLL_W)
191 *OSFrameStyle |= FCF_VERTSCROLL;
192 if(dwStyle & WS_HSCROLL_W)
193 *OSFrameStyle |= FCF_HORZSCROLL;
194 }
195 else
196 {
197 if((dwStyle & WS_CAPTION_W) == WS_DLGFRAME_W)
198 *OSFrameStyle |= FCF_DLGBORDER;
199 else
200 {
201 if((dwStyle & WS_CAPTION_W) == WS_CAPTION_W)
202 *OSFrameStyle |= (FCF_TITLEBAR | FCF_BORDER);
203 else
204 if(dwStyle & WS_BORDER_W)
205 *OSFrameStyle |= FCF_BORDER;
206 }
207
208 if(dwStyle & WS_VSCROLL_W)
209 *OSFrameStyle |= FCF_VERTSCROLL;
210 if(dwStyle & WS_HSCROLL_W)
211 *OSFrameStyle |= FCF_HORZSCROLL;
212
213 if(dwStyle & WS_SYSMENU_W)
214 *OSFrameStyle |= FCF_SYSMENU;
215 if(dwStyle & WS_THICKFRAME_W)
216 *OSFrameStyle |= FCF_SIZEBORDER; //??
217 if(dwStyle & WS_MINIMIZEBOX_W)
218 *OSFrameStyle |= FCF_MINBUTTON;
219 if(dwStyle & WS_MAXIMIZEBOX_W)
220 *OSFrameStyle |= FCF_MAXBUTTON;
221
222 if(*dwExStyle & WS_EX_DLGMODALFRAME_W)
223 *OSFrameStyle |= FCF_DLGBORDER;
224 }
225
226 //Clear certain frame bits when the window doesn't have a titlebar
227 if(!(*OSFrameStyle & FCF_TITLEBAR)) {
228 *OSFrameStyle &= ~(FCF_MINBUTTON|FCF_MAXBUTTON|FCF_SYSMENU);
229 }
230 return TRUE;
231}
232//******************************************************************************
233//******************************************************************************
234BOOL OSLibWinSetWindowULong(HWND hwnd, ULONG offset, ULONG value)
235{
236 if(offset == OSLIB_QWL_USER)
237 offset = QWL_USER;
238
239 return WinSetWindowULong(hwnd, offset, value);
240}
241//******************************************************************************
242//******************************************************************************
243ULONG OSLibWinGetWindowULong(HWND hwnd, ULONG offset)
244{
245 if(offset == OSLIB_QWL_USER)
246 offset = QWL_USER;
247
248 return WinQueryWindowULong(hwnd, offset);
249}
250//******************************************************************************
251//******************************************************************************
252BOOL OSLibPostMessage(HWND hwnd, ULONG msg, ULONG wParam, ULONG lParam)
253{
254 return WinPostMsg(hwnd, msg, (MPARAM)wParam, (MPARAM)lParam);
255}
256//******************************************************************************
257//******************************************************************************
258ULONG OSLibSendMessage(HWND hwnd, ULONG msg, ULONG wParam, ULONG lParam)
259{
260 return (ULONG)WinSendMsg(hwnd, msg, (MPARAM)wParam, (MPARAM)lParam);
261}
262//******************************************************************************
263//******************************************************************************
264ULONG OSLibWinBroadcastMsg(ULONG msg, ULONG wParam, ULONG lParam, BOOL fSend)
265{
266 return WinBroadcastMsg(HWND_DESKTOP, msg, (MPARAM)wParam, (MPARAM)lParam,
267 (fSend) ? BMSG_SEND : BMSG_POST);
268}
269//******************************************************************************
270//******************************************************************************
271BOOL OSLibWinAlarm(HWND hwndDeskTop,ULONG flStyle)
272{
273 return WinAlarm(hwndDeskTop,flStyle);
274}
275//******************************************************************************
276//******************************************************************************
277APIRET OSLibDosBeep(ULONG freg,ULONG dur)
278{
279 return DosBeep(freg,dur);
280}
281//******************************************************************************
282//******************************************************************************
283HWND OSLibWinQueryFocus(HWND hwndDeskTop)
284{
285 return WinQueryFocus(hwndDeskTop);
286}
287//******************************************************************************
288//******************************************************************************
289HWND OSLibWinWindowFromID(HWND hwndParent,ULONG id)
290{
291 return WinWindowFromID(hwndParent,id);
292}
293//******************************************************************************
294//******************************************************************************
295BOOL OSLibWinSetFocus(HWND hwndDeskTop,HWND hwndNewFocus, BOOL activate)
296{
297 return WinFocusChange (hwndDeskTop, hwndNewFocus, activate ? FC_NOLOSEACTIVE : 0);
298}
299//******************************************************************************
300//******************************************************************************
301BOOL OSLibWinIsChild (HWND hwnd, HWND hwndOf)
302{
303 return WinIsChild (hwnd, hwndOf);
304}
305//******************************************************************************
306//******************************************************************************
307ULONG OSLibGetWindowHeight(HWND hwnd)
308{
309 RECTL rect;
310
311 return (WinQueryWindowRect(hwnd,&rect)) ? rect.yTop-rect.yBottom:0;
312}
313//******************************************************************************
314//******************************************************************************
315LONG OSLibWinQuerySysValue(HWND hwndDeskTop,LONG iSysValue)
316{
317 return WinQuerySysValue(hwndDeskTop,iSysValue);
318}
319//******************************************************************************
320//******************************************************************************
321ULONG OSLibWinQueryDlgItemText(HWND hwndDlg,ULONG idItem,LONG cchBufferMax,char* pchBuffer)
322{
323 return WinQueryDlgItemText(hwndDlg,idItem,cchBufferMax,pchBuffer);
324}
325//******************************************************************************
326//******************************************************************************
327BOOL OSLibWinSetDlgItemText(HWND hwndDlg,ULONG idItem,char* pszText)
328{
329 return WinSetDlgItemText(hwndDlg,idItem,pszText);
330}
331//******************************************************************************
332//******************************************************************************
333BOOL OSLibWinQueryPointerPos(HWND hwndDeskTop,PPOINT pptlPoint)
334{
335 return WinQueryPointerPos(hwndDeskTop,(PPOINTL)pptlPoint);
336}
337//******************************************************************************
338//******************************************************************************
339HWND OSLibWinQueryWindow(HWND hwnd, ULONG lCode)
340{
341 return WinQueryWindow(hwnd, lCode);
342}
343//******************************************************************************
344//******************************************************************************
345BOOL OSLibWinSetWindowPos(HWND hwnd, HWND hwndInsertBehind, LONG x, LONG y, LONG cx,
346 LONG cy, ULONG fl)
347{
348 HWND hwndParent = hwndInsertBehind;
349 BOOL rc;
350
351 if(fl & SWP_MOVE) {
352 switch(hwndParent)
353 {
354 case HWNDOS_TOP:
355 case HWNDOS_BOTTOM:
356 hwndParent = HWND_DESKTOP;
357 break;
358 }
359 y = MapOS2ToWin32Y(hwndParent, cy, y);
360 }
361 rc = WinSetWindowPos(hwnd, hwndInsertBehind, x, y, cx, cy, fl);
362 dprintf(("WinSetWindowPos %x %x %d %d %d %d %x returned %d (%x)", hwnd, hwndInsertBehind, x, y, cx, cy, fl, rc, WinGetLastError(GetThreadHAB())));
363 return rc;
364}
365//******************************************************************************
366//******************************************************************************
367BOOL OSLibWinSetMultWindowPos(PSWP pswp, ULONG num)
368{
369 return WinSetMultWindowPos(GetThreadHAB(), pswp, num);
370}
371//******************************************************************************
372//******************************************************************************
373BOOL OSLibWinShowWindow(HWND hwnd, ULONG fl)
374{
375 BOOL rc = 1;
376
377 if(fl & SWP_SHOW) {
378 rc = WinShowWindow(hwnd, TRUE);
379 }
380 if(rc == 0)
381 dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
382 rc = WinSetWindowPos(hwnd, 0, 0, 0, 0, 0, fl);
383 if(rc == 0)
384 dprintf(("WinShowWindow %x failed %x", hwnd, WinGetLastError(GetThreadHAB())));
385 return rc;
386}
387//******************************************************************************
388//******************************************************************************
389BOOL OSLibWinDestroyWindow(HWND hwnd)
390{
391 return WinDestroyWindow(hwnd);
392}
393//******************************************************************************
394//******************************************************************************
395BOOL OSLibWinQueryWindowRect(HWND hwnd, PRECT pRect, int RelativeTo)
396{
397 BOOL rc;
398 RECTLOS2 rectl;
399
400 rc = WinQueryWindowRect(hwnd, (PRECTL)&rectl);
401 if(rc) {
402 if(RelativeTo == RELATIVE_TO_SCREEN) {
403 MapOS2ToWin32Rectl(OSLIB_HWND_DESKTOP, hwnd, &rectl, pRect);
404 }
405 else MapOS2ToWin32Rectl(&rectl, pRect);
406 }
407 else memset(pRect, 0, sizeof(RECT));
408 return rc;
409}
410//******************************************************************************
411//******************************************************************************
412BOOL OSLibWinIsIconic(HWND hwnd)
413{
414 SWP swp;
415 BOOL rc;
416
417 rc = WinQueryWindowPos(hwnd, &swp);
418 if(rc == FALSE) {
419 dprintf(("OSLibWinIsIconic: WinQueryWindowPos %x failed", hwnd));
420 return FALSE;
421 }
422
423 if(swp.fl & SWP_MINIMIZE)
424 return TRUE;
425 else return FALSE;
426}
427//******************************************************************************
428//******************************************************************************
429BOOL OSLibWinSetActiveWindow(HWND hwnd)
430{
431 return WinSetActiveWindow(HWND_DESKTOP, hwnd);
432}
433//******************************************************************************
434//******************************************************************************
435BOOL OSLibWinSetFocus(HWND hwnd)
436{
437 return WinSetFocus(HWND_DESKTOP, hwnd);
438}
439//******************************************************************************
440//******************************************************************************
441BOOL OSLibWinEnableWindow(HWND hwnd, BOOL fEnable)
442{
443 BOOL rc;
444 HWND hwndClient;
445
446 rc = WinEnableWindow(hwnd, fEnable);
447 hwndClient = WinWindowFromID(hwnd, FID_CLIENT);
448 if(hwndClient) {
449 WinEnableWindow(hwndClient, fEnable);
450 }
451 return rc;
452}
453//******************************************************************************
454//******************************************************************************
455BOOL OSLibWinIsWindowEnabled(HWND hwnd)
456{
457 return WinIsWindowEnabled(hwnd);
458}
459//******************************************************************************
460//******************************************************************************
461BOOL OSLibWinIsWindowVisible(HWND hwnd)
462{
463 return WinIsWindowVisible(hwnd);
464}
465//******************************************************************************
466//******************************************************************************
467BOOL OSLibWinQueryActiveWindow()
468{
469 return WinQueryActiveWindow(HWND_DESKTOP);
470}
471//******************************************************************************
472//******************************************************************************
473LONG OSLibWinQueryWindowTextLength(HWND hwnd)
474{
475 return WinQueryWindowTextLength(hwnd);
476}
477//******************************************************************************
478//******************************************************************************
479LONG OSLibWinQueryWindowText(HWND hwnd, LONG length, LPSTR lpsz)
480{
481 return WinQueryWindowText(hwnd, length, lpsz);
482}
483//******************************************************************************
484//******************************************************************************
485BOOL OSLibWinSetWindowText(HWND hwnd, LPSTR lpsz)
486{
487 return WinSetWindowText(hwnd, lpsz);
488}
489//******************************************************************************
490//******************************************************************************
491BOOL OSLibWinFlashWindow(HWND hwnd, BOOL fFlash)
492{
493 return WinFlashWindow(hwnd, fFlash);
494}
495//******************************************************************************
496//******************************************************************************
497HWND OSLibWinWindowFromPoint(HWND hwnd, PVOID ppoint)
498{
499 return WinWindowFromPoint((hwnd == OSLIB_HWND_DESKTOP) ? HWND_DESKTOP : hwnd, (PPOINTL)ppoint, TRUE);
500}
501//******************************************************************************
502//******************************************************************************
503BOOL OSLibWinMinimizeWindow(HWND hwnd)
504{
505 return WinSetWindowPos(hwnd, 0, 0, 0, 0, 0, SWP_MINIMIZE);
506}
507//******************************************************************************
508//******************************************************************************
509BOOL OSLibWinGetBorderSize(HWND hwnd, OSLIBPOINT *pointl)
510{
511 pointl->x = 0;
512 pointl->y = 0;
513 return (BOOL) WinSendMsg(hwnd, WM_QUERYBORDERSIZE, MPFROMP( &pointl), 0);
514}
515//******************************************************************************
516//******************************************************************************
517BOOL OSLibWinSetIcon(HWND hwnd, HANDLE hIcon)
518{
519 return (BOOL) WinSendMsg(hwnd, WM_SETICON, (MPARAM)hIcon, 0);
520}
521//******************************************************************************
522//******************************************************************************
523BOOL OSLibWinQueryWindowPos (HWND hwnd, PSWP pswp)
524{
525 return WinQueryWindowPos(hwnd, pswp);
526}
527//******************************************************************************
528//******************************************************************************
529void OSLibMapSWPtoWINDOWPOS(PSWP pswp, PWINDOWPOS pwpos, PSWP pswpOld, HWND hParent, HWND hFrame)
530{
531 HWND hWindow = pswp->hwnd;
532 HWND hWndInsertAfter = pswp->hwndInsertBehind;
533 long x = pswp->x;
534 long y = pswp->y;
535 long cx = pswp->cx;
536 long cy = pswp->cy;
537 UINT fuFlags = (UINT)pswp->fl;
538 ULONG parentHeight;
539
540 HWND hWinAfter;
541 ULONG flags = 0;
542 SWP swpFrame, swpClient;
543 POINTL point;
544
545 HWND hWnd = (hWindow == HWND_DESKTOP) ? HWND_DESKTOP_W: hWindow;
546
547 if (hWndInsertAfter == HWND_TOP)
548 hWinAfter = HWND_TOP_W;
549 else if (hWndInsertAfter == HWND_BOTTOM)
550 hWinAfter = HWND_BOTTOM_W;
551 else
552 hWinAfter = (HWND) hWndInsertAfter;
553
554 //***********************************
555 // convert PM flags to Windows flags
556 //***********************************
557 if (!(fuFlags & SWP_SIZE)) flags |= SWP_NOSIZE_W;
558 if (!(fuFlags & SWP_MOVE)) flags |= SWP_NOMOVE_W;
559 if (!(fuFlags & SWP_ZORDER)) flags |= SWP_NOZORDER_W;
560 if ( fuFlags & SWP_NOREDRAW) flags |= SWP_NOREDRAW_W;
561 if (!(fuFlags & SWP_ACTIVATE)) flags |= SWP_NOACTIVATE_W;
562 if ( fuFlags & SWP_SHOW) flags |= SWP_SHOWWINDOW_W;
563 if ( fuFlags & SWP_HIDE) flags |= SWP_HIDEWINDOW_W;
564 if ( fuFlags & SWP_NOADJUST) flags |= SWP_NOSENDCHANGING_W;
565
566 WinQueryWindowPos(hFrame, &swpFrame);
567
568 if(fuFlags & (SWP_MOVE | SWP_SIZE))
569 {
570 point.x = swpFrame.x;
571 point.y = swpFrame.y;
572 if(hParent)
573 {
574 WinMapWindowPoints(hParent, HWND_DESKTOP, &point, 1);
575 }
576 point.y = OSLibQueryScreenHeight() - point.y - swpFrame.cy;
577
578 cy = swpFrame.cy;
579 cx = swpFrame.cx;
580 x = point.x;
581 y = point.y;
582
583 if ((pswp->x == pswpOld->x) && (pswp->y == pswpOld->y))
584 flags |= SWP_NOMOVE_W;
585
586 if ((pswp->cx == pswpOld->cx) && (pswp->cy == pswpOld->cy))
587 flags |= SWP_NOSIZE_W;
588
589 if (fuFlags & SWP_SIZE)
590 {
591 if (pswp->cy != pswpOld->cy)
592 {
593 flags &= ~SWP_NOMOVE_W;
594 }
595 }
596 }
597
598 pswpOld->x = pswp->x;
599 pswpOld->y = swpFrame.cy - pswp->y - pswp->cy;
600 pswpOld->cx = pswp->cx;
601 pswpOld->cy = pswp->cy;
602
603 dprintf(("window (%d,%d)(%d,%d) client (%d,%d)(%d,%d)",
604 x,y,cx,cy, pswpOld->x,pswpOld->y,pswpOld->cx,pswpOld->cy));
605
606 pwpos->flags = (UINT)flags;
607 pwpos->cy = cy;
608 pwpos->cx = cx;
609 pwpos->x = x;
610 pwpos->y = y;
611 pwpos->hwndInsertAfter = hWinAfter;
612 pwpos->hwnd = hWindow;
613}
614//******************************************************************************
615//******************************************************************************
616void OSLibMapSWPtoWINDOWPOSFrame(PSWP pswp, struct tagWINDOWPOS *pwpos, PSWP pswpOld, HWND hParent, HWND hFrame)
617{
618 HWND hWindow = pswp->hwnd;
619 HWND hWndInsertAfter = pswp->hwndInsertBehind;
620 long x = pswp->x;
621 long y = pswp->y;
622 long cx = pswp->cx;
623 long cy = pswp->cy;
624 UINT fuFlags = (UINT)pswp->fl;
625 ULONG parentHeight;
626
627 HWND hWinAfter;
628 ULONG flags = 0;
629 SWP swpClient;
630 POINTL point;
631
632 HWND hWnd = (hWindow == HWND_DESKTOP) ? HWND_DESKTOP_W: hWindow;
633
634 if (hWndInsertAfter == HWND_TOP)
635 hWinAfter = HWND_TOP_W;
636 else if (hWndInsertAfter == HWND_BOTTOM)
637 hWinAfter = HWND_BOTTOM_W;
638 else
639 hWinAfter = (HWND) hWndInsertAfter;
640
641 //***********************************
642 // convert PM flags to Windows flags
643 //***********************************
644 if (!(fuFlags & SWP_SIZE)) flags |= SWP_NOSIZE_W;
645 if (!(fuFlags & SWP_MOVE)) flags |= SWP_NOMOVE_W;
646 if (!(fuFlags & SWP_ZORDER)) flags |= SWP_NOZORDER_W;
647 if ( fuFlags & SWP_NOREDRAW) flags |= SWP_NOREDRAW_W;
648 if (!(fuFlags & SWP_ACTIVATE)) flags |= SWP_NOACTIVATE_W;
649 if ( fuFlags & SWP_SHOW) flags |= SWP_SHOWWINDOW_W;
650 if ( fuFlags & SWP_HIDE) flags |= SWP_HIDEWINDOW_W;
651 if ( fuFlags & SWP_NOADJUST) flags |= SWP_NOSENDCHANGING_W;
652
653 WinQueryWindowPos(WinWindowFromID(hFrame, FID_CLIENT), &swpClient);
654
655 if(fuFlags & (SWP_MOVE | SWP_SIZE))
656 {
657 point.x = x;
658 point.y = y;
659 if(hParent)
660 {
661 WinMapWindowPoints(hParent, HWND_DESKTOP, &point, 1);
662 }
663 point.y = OSLibQueryScreenHeight() - point.y - cy;
664
665 x = point.x;
666 y = point.y;
667
668 if ((pswp->x == pswpOld->x) && (pswp->y == pswpOld->y))
669 flags |= SWP_NOMOVE_W;
670
671 if ((pswp->cx == pswpOld->cx) && (pswp->cy == pswpOld->cy))
672 flags |= SWP_NOSIZE_W;
673
674 if (fuFlags & SWP_SIZE)
675 {
676 if (pswp->cy != pswpOld->cy)
677 {
678 flags &= ~SWP_NOMOVE_W;
679 }
680 }
681 }
682
683 pswpOld->x = swpClient.x;
684 pswpOld->y = pswp->cy - swpClient.y - swpClient.cy;
685 pswpOld->cx = swpClient.cx;
686 pswpOld->cy = swpClient.cy;
687
688 dprintf(("window (%d,%d)(%d,%d) client (%d,%d)(%d,%d)",
689 x,y,cx,cy, pswpOld->x,pswpOld->y,pswpOld->cx,pswpOld->cy));
690
691 pwpos->flags = (UINT)flags;
692 pwpos->cy = cy;
693 pwpos->cx = cx;
694 pwpos->x = x;
695 pwpos->y = y;
696 pwpos->hwndInsertAfter = hWinAfter;
697 pwpos->hwnd = hWindow;
698}
699//******************************************************************************
700//******************************************************************************
701void OSLibMapWINDOWPOStoSWP(PWINDOWPOS pwpos, PSWP pswp, PSWP pswpOld, HWND hParent, HWND hFrame)
702{
703 BOOL fCvt = FALSE;
704
705 HWND hWnd = pwpos->hwnd;
706 HWND hWndInsertAfter = pwpos->hwndInsertAfter;
707 long x = pwpos->x;
708 long y = pwpos->y;
709 long cx = pwpos->cx;
710 long cy = pwpos->cy;
711 UINT fuFlags = pwpos->flags;
712 ULONG parentHeight;
713
714 HWND hWinAfter;
715 ULONG flags = 0;
716 HWND hWindow = hWnd ? (HWND)hWnd : HWND_DESKTOP;
717
718 if (hWndInsertAfter == HWND_TOPMOST_W)
719// hWinAfter = HWND_TOPMOST;
720 hWinAfter = HWND_TOP;
721 else if (hWndInsertAfter == HWND_NOTOPMOST_W)
722// hWinAfter = HWND_NOTOPMOST;
723 hWinAfter = HWND_TOP;
724 else if (hWndInsertAfter == HWND_TOP_W)
725 hWinAfter = HWND_TOP;
726 else if (hWndInsertAfter == HWND_BOTTOM_W)
727 hWinAfter = HWND_BOTTOM;
728 else
729 hWinAfter = (HWND) hWndInsertAfter;
730
731 if (!(fuFlags & SWP_NOSIZE_W )) flags |= SWP_SIZE;
732 if (!(fuFlags & SWP_NOMOVE_W )) flags |= SWP_MOVE;
733 if (!(fuFlags & SWP_NOZORDER_W )) flags |= SWP_ZORDER;
734 if ( fuFlags & SWP_NOREDRAW_W ) flags |= SWP_NOREDRAW;
735 if (!(fuFlags & SWP_NOACTIVATE_W)) flags |= SWP_ACTIVATE;
736 if ( fuFlags & SWP_SHOWWINDOW_W) flags |= SWP_SHOW;
737 if ( fuFlags & SWP_HIDEWINDOW_W) flags |= SWP_HIDE;
738 if ( fuFlags & SWP_NOSENDCHANGING_W) flags |= SWP_NOADJUST;
739
740 if (flags & (SWP_MOVE | SWP_SIZE))
741 {
742 if (hParent == NULLHANDLE)
743 parentHeight = ScreenHeight;
744 else
745 parentHeight = OSLibGetWindowHeight(hParent);
746
747 if ((flags & SWP_MOVE) == 0)
748 {
749 x = pswpOld->x;
750 y = pswpOld->y;
751
752 if (!((y == 0) && (pswpOld->cy == 0)))
753 {
754 y = parentHeight - y - pswpOld->cy;
755 }
756 }
757
758 if (flags & SWP_SIZE)
759 {
760 if (cy != pswpOld->cy)
761 flags |= SWP_MOVE;
762 }
763 else
764 {
765 cx = pswpOld->cx;
766 cy = pswpOld->cy;
767 }
768 y = parentHeight - y - cy;
769
770
771 if ((pswpOld->x == x) && (pswpOld->y == y))
772 flags &= ~SWP_MOVE;
773
774 if ((pswpOld->cx == cx) && (pswpOld->cy == cy))
775 flags &= ~SWP_SIZE;
776 }
777
778 pswp->fl = flags;
779 pswp->cy = cy;
780 pswp->cx = cx;
781 pswp->x = x;
782 pswp->y = y;
783 pswp->hwndInsertBehind = hWinAfter;
784 pswp->hwnd = hWindow;
785 pswp->ulReserved1 = 0;
786 pswp->ulReserved2 = 0;
787}
788//******************************************************************************
789//Position in screen coordinates
790//******************************************************************************
791void OSLibMapWINDOWPOStoSWPFrame(PWINDOWPOS pwpos, PSWP pswp, PSWP pswpOld, HWND hParent, HWND hFrame)
792{
793 BOOL fCvt = FALSE;
794
795 HWND hWnd = pwpos->hwnd;
796 HWND hWndInsertAfter = pwpos->hwndInsertAfter;
797 long x = pwpos->x;
798 long y = pwpos->y;
799 long cx = pwpos->cx;
800 long cy = pwpos->cy;
801 UINT fuFlags = pwpos->flags;
802 ULONG parentHeight;
803 POINTL point;
804
805 HWND hWinAfter;
806 ULONG flags = 0;
807 HWND hWindow = hWnd ? (HWND)hWnd : HWND_DESKTOP;
808
809 if (hWndInsertAfter == HWND_TOPMOST_W)
810// hWinAfter = HWND_TOPMOST;
811 hWinAfter = HWND_TOP;
812 else if (hWndInsertAfter == HWND_NOTOPMOST_W)
813// hWinAfter = HWND_NOTOPMOST;
814 hWinAfter = HWND_TOP;
815 else if (hWndInsertAfter == HWND_TOP_W)
816 hWinAfter = HWND_TOP;
817 else if (hWndInsertAfter == HWND_BOTTOM_W)
818 hWinAfter = HWND_BOTTOM;
819 else
820 hWinAfter = (HWND) hWndInsertAfter;
821
822 if (!(fuFlags & SWP_NOSIZE_W )) flags |= SWP_SIZE;
823 if (!(fuFlags & SWP_NOMOVE_W )) flags |= SWP_MOVE;
824 if (!(fuFlags & SWP_NOZORDER_W )) flags |= SWP_ZORDER;
825 if ( fuFlags & SWP_NOREDRAW_W ) flags |= SWP_NOREDRAW;
826 if (!(fuFlags & SWP_NOACTIVATE_W)) flags |= SWP_ACTIVATE;
827 if ( fuFlags & SWP_SHOWWINDOW_W) flags |= SWP_SHOW;
828 if ( fuFlags & SWP_HIDEWINDOW_W) flags |= SWP_HIDE;
829 if ( fuFlags & SWP_NOSENDCHANGING_W) flags |= SWP_NOADJUST;
830
831 if (flags & (SWP_MOVE | SWP_SIZE))
832 {
833 point.x = x;
834 point.y = y;
835
836 if(hParent) {
837 parentHeight = OSLibGetWindowHeight(hParent);
838
839 point.y = ScreenHeight - point.y - cy;
840 WinMapWindowPoints(HWND_DESKTOP, hParent, &point, 1);
841 point.y = parentHeight - point.y - cy;
842 }
843 else parentHeight = ScreenHeight;
844
845 x = point.x;
846 y = point.y;
847
848 if (flags & SWP_SIZE)
849 {
850 if (cy != pswpOld->cy)
851 flags |= SWP_MOVE;
852 }
853 else
854 {
855 cx = pswpOld->cx;
856 cy = pswpOld->cy;
857 }
858 y = parentHeight - y - cy;
859
860
861 if ((pswpOld->x == x) && (pswpOld->y == y))
862 flags &= ~SWP_MOVE;
863
864 if ((pswpOld->cx == cx) && (pswpOld->cy == cy))
865 flags &= ~SWP_SIZE;
866 }
867
868 pswp->fl = flags;
869 pswp->cy = cy;
870 pswp->cx = cx;
871 pswp->x = x;
872 pswp->y = y;
873 pswp->hwndInsertBehind = hWinAfter;
874 pswp->hwnd = hWindow;
875 pswp->ulReserved1 = 0;
876 pswp->ulReserved2 = 0;
877}
878//******************************************************************************
879//******************************************************************************
880BOOL OSLibWinCalcFrameRect(HWND hwndFrame, RECT *pRect, BOOL fClient)
881{
882 BOOL rc;
883
884 WinMapWindowPoints(hwndFrame, HWND_DESKTOP, (PPOINTL)pRect, 2);
885
886 rc = WinCalcFrameRect(hwndFrame, (PRECTL)pRect, fClient);
887 WinMapWindowPoints(HWND_DESKTOP, hwndFrame, (PPOINTL)pRect, 2);
888
889 return rc;
890}
891//******************************************************************************
892//******************************************************************************
893BOOL OSLibGetMinMaxInfo(HWND hwndFrame, MINMAXINFO *pMinMax)
894{
895 TRACKINFO tinfo;
896
897 memset(&tinfo, 0, sizeof(TRACKINFO));
898 WinSendMsg(hwndFrame, WM_QUERYTRACKINFO, (MPARAM)0,(MPARAM)&tinfo);
899
900 pMinMax->ptMinTrackSize.x = tinfo.ptlMinTrackSize.x;
901 pMinMax->ptMinTrackSize.y = tinfo.ptlMinTrackSize.y;
902 pMinMax->ptMaxTrackSize.x = tinfo.ptlMaxTrackSize.x;
903 pMinMax->ptMaxTrackSize.y = tinfo.ptlMaxTrackSize.y;
904 return TRUE;
905}
906//******************************************************************************
907//******************************************************************************
908HWND OSLibWinBeginEnumWindows(HWND hwnd)
909{
910 if(hwnd == OSLIB_HWND_DESKTOP) hwnd = HWND_DESKTOP;
911 else
912 if(hwnd == OSLIB_HWND_OBJECT) hwnd = HWND_OBJECT;
913
914 return WinBeginEnumWindows(hwnd);
915}
916//******************************************************************************
917//******************************************************************************
918HWND OSLibWinGetNextWindow(HWND hwndEnum)
919{
920 return WinGetNextWindow(hwndEnum);
921}
922//******************************************************************************
923//******************************************************************************
924HWND OSLibWinQueryClientWindow(HWND hwndFrame)
925{
926 HWND hwndClient = 0;
927
928 if(((ULONG)WinSendMsg(hwndFrame, WM_QUERYFRAMEINFO, NULL, NULL)) & FI_FRAME)
929 hwndClient = WinWindowFromID(hwndFrame, FID_CLIENT);
930
931 return hwndClient;
932}
933//******************************************************************************
934//******************************************************************************
935BOOL OSLibWinEndEnumWindows(HWND hwndEnum)
936{
937 return WinEndEnumWindows(hwndEnum);
938}
939//******************************************************************************
940//******************************************************************************
941BOOL OSLibWinQueryWindowProcess(HWND hwnd, ULONG *pid, ULONG *tid)
942{
943 return WinQueryWindowProcess(hwnd, pid, tid);
944}
945//******************************************************************************
946//******************************************************************************
947BOOL OSLibWinMapWindowPoints (HWND hwndFrom, HWND hwndTo, OSLIBPOINT *pptl, ULONG num)
948{
949 return WinMapWindowPoints (hwndFrom, hwndTo, (PPOINTL)pptl, num);
950}
951//******************************************************************************
952//******************************************************************************
953BOOL OSLibWinEnableScrollBar(HWND hwndParent, int scrollBar, BOOL fEnable)
954{
955 HWND hwndScroll;
956
957 if(scrollBar == OSLIB_VSCROLL) {
958 hwndScroll = WinWindowFromID(hwndParent, FID_VERTSCROLL);
959 }
960 else hwndScroll = WinWindowFromID(hwndParent, FID_HORZSCROLL);
961
962 if(hwndScroll == NULL)
963 return FALSE;
964
965 return WinEnableWindow(hwndScroll, fEnable);
966}
967//******************************************************************************
968//******************************************************************************
969HWND OSLibWinQueryObjectWindow(VOID)
970{
971 return WinQueryObjectWindow(HWND_DESKTOP);
972}
973//******************************************************************************
974//******************************************************************************
975ULONG OSLibWinGetScrollPos(HWND hwndParent, HWND hwndScroll)
976{
977 if(hwndScroll == NULL)
978 return 0;
979
980 return (ULONG)WinSendMsg(hwndScroll, SBM_QUERYPOS, 0, 0);
981}
982//******************************************************************************
983//******************************************************************************
984ULONG OSLibWinSetScrollPos(HWND hwndParent, HWND hwndScroll, int pos, int fRedraw)
985{
986 ULONG oldPos;
987
988 if(hwndScroll == NULL)
989 return 0;
990
991 oldPos = (ULONG)WinSendMsg(hwndScroll, SBM_QUERYPOS, 0, 0);
992
993 if(WinSendMsg(hwndScroll, SBM_SETPOS, MPFROMSHORT(pos), MPFROMLONG(fRedraw)) == FALSE)
994 return 0;
995
996 return oldPos;
997}
998//******************************************************************************
999//******************************************************************************
1000BOOL OSLibWinSetScrollRange(HWND hwndParent, HWND hwndScroll, int minpos,
1001 int maxpos, int fRedraw)
1002{
1003 if(hwndScroll == NULL)
1004 return 0;
1005
1006 return (BOOL)WinSendMsg( hwndScroll, SBM_SETSCROLLBAR,
1007 MPFROMLONG(WinSendMsg(hwndScroll, SBM_QUERYPOS, 0, 0)),
1008 MPFROM2SHORT( minpos ,maxpos ) );
1009}
1010//******************************************************************************
1011//******************************************************************************
1012BOOL OSLibWinSetScrollPageSize(HWND hwndParent, HWND hwndScroll, int pagesize,
1013 int totalsize, int fRedraw)
1014{
1015 if(hwndScroll == NULL)
1016 return 0;
1017
1018 return (BOOL)WinSendMsg( hwndScroll, SBM_SETTHUMBSIZE,
1019 MPFROM2SHORT(pagesize, totalsize),
1020 0);
1021}
1022//******************************************************************************
1023//******************************************************************************
1024void OSLibTranslateScrollCmdAndMsg(ULONG *msg, ULONG *scrollcmd)
1025{
1026 switch(*scrollcmd)
1027 {
1028 case SB_LINEUP:
1029 *scrollcmd = SB_LINEUP_W;
1030 break;
1031 case SB_LINEDOWN:
1032 *scrollcmd = SB_LINEDOWN_W;
1033 break;
1034 case SB_PAGEUP:
1035 *scrollcmd = SB_PAGEUP_W;
1036 break;
1037 case SB_PAGEDOWN:
1038 *scrollcmd = SB_PAGEDOWN_W;
1039 break;
1040 case SB_SLIDERTRACK:
1041 *scrollcmd = SB_THUMBTRACK_W;
1042 break;
1043 case SB_SLIDERPOSITION:
1044 *scrollcmd = SB_THUMBPOSITION_W;
1045 break;
1046 case SB_ENDSCROLL:
1047 *scrollcmd = SB_ENDSCROLL_W;
1048 break;
1049 }
1050 *msg = (*msg == WM_HSCROLL) ? WM_HSCROLL_W : WM_VSCROLL_W;
1051 return;
1052}
1053//******************************************************************************
1054//******************************************************************************
1055void OSLibSetWindowStyle(HWND hwnd, ULONG dwStyle)
1056{
1057 ULONG OSWinStyle, OSFrameStyle, borderWidth, borderHeight,dwExStyle;
1058
1059 OSLibWinConvertStyle(dwStyle, &dwExStyle, &OSWinStyle, &OSFrameStyle, &borderWidth, &borderHeight);
1060
1061// OSWinStyle = OSWinStyle & ~(WS_TABSTOP | WS_GROUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
1062 OSWinStyle = OSWinStyle & ~(WS_TABSTOP | WS_GROUP | WS_CLIPCHILDREN);
1063
1064 WinSetWindowULong(hwnd, QWL_STYLE,
1065 (WinQueryWindowULong(hwnd, QWL_STYLE) & ~0xffff0000) |
1066 OSWinStyle);
1067
1068 if(OSFrameStyle & FCF_TITLEBAR)
1069 {
1070 WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_TITLEBAR), hwnd, FALSE);
1071 WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_MENU), hwnd, FALSE);
1072 }
1073 else
1074 {
1075 WinSetParent(WinWindowFromID(hwnd, FID_TITLEBAR), HWND_OBJECT, FALSE);
1076 WinSetParent(WinWindowFromID(hwnd, FID_MENU), HWND_OBJECT, FALSE);
1077 }
1078 if(OSFrameStyle & FCF_SYSMENU)
1079 WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_SYSMENU), hwnd, FALSE);
1080 else
1081 WinSetParent(WinWindowFromID(hwnd, FID_SYSMENU), HWND_OBJECT, FALSE);
1082
1083 if(OSFrameStyle & FCF_MINBUTTON | OSFrameStyle & FCF_MAXBUTTON)
1084 WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_MINMAX), hwnd, FALSE);
1085 else
1086 WinSetParent(WinWindowFromID(hwnd, FID_MINMAX), HWND_OBJECT, FALSE);
1087
1088 if(OSFrameStyle & FCF_VERTSCROLL)
1089 WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_VERTSCROLL), hwnd, FALSE);
1090 else
1091 WinSetParent(WinWindowFromID(hwnd, FID_VERTSCROLL), HWND_OBJECT, FALSE);
1092
1093 if(OSFrameStyle & FCF_HORZSCROLL)
1094 WinSetParent(OSLibWinObjectWindowFromID(hwnd, FID_HORZSCROLL), hwnd, FALSE);
1095 else
1096 WinSetParent(WinWindowFromID(hwnd, FID_HORZSCROLL), HWND_OBJECT, FALSE);
1097
1098#if 0
1099 WNDPARAMS wndparam = {0};
1100 FRAMECDATA framecdata = {0};
1101
1102 framecdata.cb = sizeof(FRAMECDATA);
1103
1104 wndparam.fsStatus = WPM_CTLDATA;
1105 wndparam.cbCtlData = framecdata.cb;
1106 wndparam.pCtlData = (PVOID)&framecdata;
1107 WinSendMsg(hwnd, WM_QUERYWINDOWPARAMS, &wndparam, 0);
1108
1109 wndparam.fsStatus = WPM_CTLDATA;
1110 wndparam.pCtlData = (PVOID)&framecdata;
1111 framecdata.flCreateFlags = OSFrameStyle;
1112 WinSendMsg(hwnd, WM_SETWINDOWPARAMS, &wndparam, 0);
1113#endif
1114
1115 WinSendMsg(hwnd, WM_UPDATEFRAME,
1116 MPFROMLONG(FCF_TITLEBAR | FCF_SYSMENU | FCF_MINMAX |
1117 FCF_MENU | FCF_VERTSCROLL | FCF_HORZSCROLL),
1118 MPVOID);
1119}
1120//******************************************************************************
1121//******************************************************************************
1122HWND OSLibWinObjectWindowFromID(HWND hwndOwner, ULONG ID)
1123{
1124 HWND hwndNext, hwndFound=0;
1125 HENUM henum;
1126
1127 henum = WinBeginEnumWindows(HWND_OBJECT);
1128 while ((hwndNext = WinGetNextWindow(henum)) != 0)
1129 {
1130 if(WinQueryWindow(hwndNext, QW_OWNER) == hwndOwner &&
1131 WinQueryWindowUShort(hwndNext, QWS_ID) == ID)
1132 {
1133 hwndFound = hwndNext;
1134 break;
1135 }
1136 }
1137 WinEndEnumWindows(henum);
1138 return hwndFound;
1139}
1140//******************************************************************************
1141//******************************************************************************
1142BOOL OSLibSetWindowID(HWND hwnd, ULONG value)
1143{
1144 dprintf(("OSLibSetWindowID hwnd:%x ID:%x", hwnd, value));
1145 return WinSetWindowULong(hwnd, QWS_ID, value);
1146}
1147//******************************************************************************
1148//******************************************************************************
1149PVOID OSLibWinSubclassWindow(HWND hwnd,PVOID newWndProc)
1150{
1151 return WinSubclassWindow(hwnd,(PFNWP)newWndProc);
1152}
1153//******************************************************************************
1154//******************************************************************************
1155BOOL OSLibSetWindowRestoreRect(HWND hwnd, PRECT pRect)
1156{
1157 ULONG yHeight = OSLibGetWindowHeight(WinQueryWindow(hwnd, QW_PARENT));
1158
1159 WinSetWindowUShort(hwnd, QWS_XRESTORE, (USHORT)pRect->left );
1160 WinSetWindowUShort(hwnd, QWS_YRESTORE, (USHORT)(yHeight - pRect->top -
1161 (pRect->bottom - pRect->top)));
1162 WinSetWindowUShort(hwnd, QWS_CXRESTORE, (USHORT)(pRect->right - pRect->left));
1163 WinSetWindowUShort(hwnd, QWS_CYRESTORE, (USHORT)(pRect->bottom - pRect->top));
1164 return TRUE;
1165}
1166//******************************************************************************
1167//******************************************************************************
1168BOOL OSLibSetWindowMinPos(HWND hwnd, ULONG x, ULONG y)
1169{
1170 ULONG yHeight = OSLibGetWindowHeight(WinQueryWindow(hwnd, QW_PARENT));
1171
1172 WinSetWindowUShort(hwnd, QWS_XMINIMIZE, (USHORT)x );
1173 WinSetWindowUShort(hwnd, QWS_YMINIMIZE, (USHORT)(yHeight - y -
1174 ( 2 * WinQuerySysValue( HWND_DESKTOP, SV_CYSIZEBORDER)) -
1175 WinQuerySysValue( HWND_DESKTOP, SV_CYICON)));
1176 return TRUE;
1177}
1178//******************************************************************************
1179//******************************************************************************
1180BOOL OSLibWinGetKeyboardStateTable(unsigned char *PMKeyState)
1181{
1182 return WinSetKeyboardStateTable(HWND_DESKTOP, (PBYTE)&PMKeyState, FALSE );
1183}
1184//******************************************************************************
1185//******************************************************************************
1186BOOL OSLibWinSetKeyboardStateTable(unsigned char *PMKeyState)
1187{
1188 return WinSetKeyboardStateTable(HWND_DESKTOP, (PBYTE)&PMKeyState, TRUE );
1189}
1190//******************************************************************************
1191//******************************************************************************
Note: See TracBrowser for help on using the repository browser.