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

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

desktop + misc updates

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