Release 0.6
Tue Jan 4 13:01:33 1994 David Metcalfe <david@prism.demon.co.uk> * [window/caret.c] Modified code to use system timer. Jan 9, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [windows/win.c] Windows create if required new XLIB MenuBar & CaptionBar. * [windows/defwnd.c] WM_CALCSIZE Move & Resize caption, menubar & scrollbars. (I'm not sure it's the good place for it, but it work...) * [loader/resource.c] optimize in FindResourceByNumber, make lseek() if next type ... * [controls/scroll.c] scrollbar buttons are now using system resources bitmaps. * [controls/caption.c] - new file ... captionbar showing title, close button with SysMenu, and other buttons using system resources bitmaps. * [controls/menu.c] New functions: SetMenuItemBitmaps() with 'glues', Make new version of LoadMenu() & ParseMenu(), ( put #define USE_POPUPMENU ). Implementation of MenuBar functions. * [sysres.dll] New bitmaps for system such OBM_CLOSE, OBM_MINIMIZE, OBM_UPARROWI. New SYSMENU menu, it don't work yet ! :-(( Tue Jan 11 05:27:45 1994 julliard@di.epfl.ch (Alexandre Julliard * [memory/atom.c] Fixed a bug that could cause atoms to be case-sensitive. * [misc/rect.c] Bug fix in SubtractRect(). * [objects/clipping.c] Bug fix when setting the clip mask to an empty region. * [windows/dce.c] Bug fix in ReleaseDC(). * [windows/dialog.c] Call AdjustWindowRectEx() before creating the dialog window. Added support for DS_MODALFRAME style. * [windows/event.c] Cleaned up event handling and removed old Xt stuff. Moved double-click handling to windows/message.c * [windows/focus.c] Bug fix: only set the X focus when the window is viewable. * [windows/graphics.c] Rewritten DrawReliefRect() to use brush instead of pen, and to use the system colors. * [windows/message.c] Implemented WM_NCHITTEST message sending, and non-client mouse messages. Cleaned up double-click handling, and removed the Xt code. * [windows/nonclient.c] (New file) Implemented AdjustWindowRect(). Implemented WM_NCCALCSIZE, WM_NCHITTEST and WM_NCPAINT handling. * [windows/painting.c] Added sending of the WM_NCPAINT message in BeginPaint(). * [windows/sysmetrics.c] [include/sysmetrics.h] (New files) Implemented system metrics. * [windows/win.c] Bug fix in setting the parent and owner in CreateWindow(). Removed the Xt code. * [windows/winpos.c] Added sending of the WM_NCPAINT message in SetWindowPos(). Removed the Xt code.
This commit is contained in:
parent
5f721f81fd
commit
cdd0923710
88
ChangeLog
88
ChangeLog
|
@ -1,3 +1,90 @@
|
||||||
|
Tue Jan 4 13:01:33 1994 David Metcalfe <david@prism.demon.co.uk>
|
||||||
|
|
||||||
|
* [window/caret.c]
|
||||||
|
Modified code to use system timer.
|
||||||
|
|
||||||
|
Jan 9, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
|
||||||
|
|
||||||
|
* [windows/win.c]
|
||||||
|
Windows create if required new XLIB MenuBar & CaptionBar.
|
||||||
|
|
||||||
|
* [windows/defwnd.c]
|
||||||
|
WM_CALCSIZE Move & Resize caption, menubar & scrollbars.
|
||||||
|
(I'm not sure it's the good place for it, but it work...)
|
||||||
|
|
||||||
|
* [loader/resource.c]
|
||||||
|
optimize in FindResourceByNumber, make lseek() if next type ...
|
||||||
|
|
||||||
|
* [controls/scroll.c]
|
||||||
|
scrollbar buttons are now using system resources bitmaps.
|
||||||
|
|
||||||
|
* [controls/caption.c] - new file ...
|
||||||
|
captionbar showing title, close button with SysMenu,
|
||||||
|
and other buttons using system resources bitmaps.
|
||||||
|
|
||||||
|
* [controls/menu.c]
|
||||||
|
New functions: SetMenuItemBitmaps() with 'glues',
|
||||||
|
Make new version of LoadMenu() & ParseMenu(),
|
||||||
|
( put #define USE_POPUPMENU ).
|
||||||
|
Implementation of MenuBar functions.
|
||||||
|
|
||||||
|
* [sysres.dll]
|
||||||
|
New bitmaps for system such OBM_CLOSE, OBM_MINIMIZE, OBM_UPARROWI.
|
||||||
|
New SYSMENU menu, it don't work yet ! :-((
|
||||||
|
|
||||||
|
Tue Jan 11 05:27:45 1994 julliard@di.epfl.ch (Alexandre Julliard
|
||||||
|
|
||||||
|
* [memory/atom.c]
|
||||||
|
Fixed a bug that could cause atoms to be case-sensitive.
|
||||||
|
|
||||||
|
* [misc/rect.c]
|
||||||
|
Bug fix in SubtractRect().
|
||||||
|
|
||||||
|
* [objects/clipping.c]
|
||||||
|
Bug fix when setting the clip mask to an empty region.
|
||||||
|
|
||||||
|
* [windows/dce.c]
|
||||||
|
Bug fix in ReleaseDC().
|
||||||
|
|
||||||
|
* [windows/dialog.c]
|
||||||
|
Call AdjustWindowRectEx() before creating the dialog window.
|
||||||
|
Added support for DS_MODALFRAME style.
|
||||||
|
|
||||||
|
* [windows/event.c]
|
||||||
|
Cleaned up event handling and removed old Xt stuff.
|
||||||
|
Moved double-click handling to windows/message.c
|
||||||
|
|
||||||
|
* [windows/focus.c]
|
||||||
|
Bug fix: only set the X focus when the window is viewable.
|
||||||
|
|
||||||
|
* [windows/graphics.c]
|
||||||
|
Rewritten DrawReliefRect() to use brush instead of pen, and
|
||||||
|
to use the system colors.
|
||||||
|
|
||||||
|
* [windows/message.c]
|
||||||
|
Implemented WM_NCHITTEST message sending, and non-client
|
||||||
|
mouse messages.
|
||||||
|
Cleaned up double-click handling, and removed the Xt code.
|
||||||
|
|
||||||
|
* [windows/nonclient.c] (New file)
|
||||||
|
Implemented AdjustWindowRect().
|
||||||
|
Implemented WM_NCCALCSIZE, WM_NCHITTEST and WM_NCPAINT handling.
|
||||||
|
|
||||||
|
* [windows/painting.c]
|
||||||
|
Added sending of the WM_NCPAINT message in BeginPaint().
|
||||||
|
|
||||||
|
* [windows/sysmetrics.c] [include/sysmetrics.h] (New files)
|
||||||
|
Implemented system metrics.
|
||||||
|
|
||||||
|
* [windows/win.c]
|
||||||
|
Bug fix in setting the parent and owner in CreateWindow().
|
||||||
|
Removed the Xt code.
|
||||||
|
|
||||||
|
* [windows/winpos.c]
|
||||||
|
Added sending of the WM_NCPAINT message in SetWindowPos().
|
||||||
|
Removed the Xt code.
|
||||||
|
|
||||||
|
----------------------------------------------------------------------
|
||||||
Sun Jan 2 12:38:53 1994 David Metcalfe <david@prism.demon.co.uk>
|
Sun Jan 2 12:38:53 1994 David Metcalfe <david@prism.demon.co.uk>
|
||||||
|
|
||||||
* [windows/class.c]
|
* [windows/class.c]
|
||||||
|
@ -101,7 +188,6 @@ Sat Jan 1 10:22:43 1994 Bob Amstadt (bob@pooh)
|
||||||
|
|
||||||
* loader/wine.c: Added support for relocation types 5 and 6.
|
* loader/wine.c: Added support for relocation types 5 and 6.
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
|
||||||
Mon Dec 27 11:06:03 1993 Erik Bos (erik@trashcan.hacktic.nl)
|
Mon Dec 27 11:06:03 1993 Erik Bos (erik@trashcan.hacktic.nl)
|
||||||
|
|
||||||
* [misc/comm.c]
|
* [misc/comm.c]
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -1,6 +1,6 @@
|
||||||
######################################################################
|
######################################################################
|
||||||
# These variables are inherited by the sub-makefiles
|
# These variables are inherited by the sub-makefiles
|
||||||
DEBUGOPTS=-DUSE_XLIB
|
DEBUGOPTS=
|
||||||
COPTS=-O2 -m486
|
COPTS=-O2 -m486
|
||||||
INCLUDE_DIR=include
|
INCLUDE_DIR=include
|
||||||
LDFLAGS=
|
LDFLAGS=
|
||||||
|
|
8
README
8
README
|
@ -41,6 +41,14 @@ For example: to run Windows' solitaire:
|
||||||
Have a nice game of solitaire, but be careful. Emulation isn't perfect.
|
Have a nice game of solitaire, but be careful. Emulation isn't perfect.
|
||||||
So, occassionally it will crash.
|
So, occassionally it will crash.
|
||||||
|
|
||||||
|
WHAT'S NEW with version 0.6: (see ChangeLog for details)
|
||||||
|
- Working towards elimination of Xt-dependent code. Thanks to
|
||||||
|
Alexandre and Martin.
|
||||||
|
- Other bug fixes.
|
||||||
|
- I added a rudimentary spy facility which can be turned
|
||||||
|
on from the wine.ini file. See the sample wine.ini
|
||||||
|
for details
|
||||||
|
|
||||||
WHAT'S NEW with version 0.5: (see ChangeLog for details)
|
WHAT'S NEW with version 0.5: (see ChangeLog for details)
|
||||||
- Working towards elimination of Xt-dependent code.
|
- Working towards elimination of Xt-dependent code.
|
||||||
- StretchBlt()
|
- StretchBlt()
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
|
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
|
||||||
|
|
||||||
OBJS=menu.o widgets.o button.o scroll.o listbox.o combo.o static.o \
|
OBJS = menu.o caption.o widgets.o button.o \
|
||||||
|
scroll.o listbox.o combo.o static.o \
|
||||||
SmeMenuButto.o WinLabel.o WinCommand.o \
|
SmeMenuButto.o WinLabel.o WinCommand.o \
|
||||||
WinMenuButto.o
|
WinMenuButto.o
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,296 @@
|
||||||
|
/*
|
||||||
|
* Interface code to CAPTION widget
|
||||||
|
*
|
||||||
|
* Copyright Martin Ayotte, 1994
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
#define DEBUG_CAPTION
|
||||||
|
*/
|
||||||
|
|
||||||
|
static char Copyright[] = "Copyright Martin Ayotte, 1994";
|
||||||
|
|
||||||
|
#include <X11/Intrinsic.h>
|
||||||
|
#include <X11/StringDefs.h>
|
||||||
|
#include "windows.h"
|
||||||
|
#include "caption.h"
|
||||||
|
#include "heap.h"
|
||||||
|
#include "win.h"
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
HBITMAP hStdClose = (HBITMAP)NULL;
|
||||||
|
HBITMAP hStdCloseD = (HBITMAP)NULL;
|
||||||
|
HBITMAP hStdMinim = (HBITMAP)NULL;
|
||||||
|
HBITMAP hStdMinimD = (HBITMAP)NULL;
|
||||||
|
HBITMAP hStdMaxim = (HBITMAP)NULL;
|
||||||
|
HBITMAP hStdMaximD = (HBITMAP)NULL;
|
||||||
|
HMENU hStdSysMenu = (HMENU)NULL;
|
||||||
|
|
||||||
|
LPHEADCAPTION CaptionBarGetWindowAndStorage(HWND hWnd, WND **wndPtr);
|
||||||
|
LPHEADCAPTION CaptionBarGetStorageHeader(HWND hWnd);
|
||||||
|
void SetMenuLogicalParent(HMENU hMenu, HWND hWnd);
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* CaptionBarWndProc
|
||||||
|
*/
|
||||||
|
LONG CaptionBarWndProc( HWND hWnd, WORD message, WORD wParam, LONG lParam )
|
||||||
|
{
|
||||||
|
WORD wRet;
|
||||||
|
short x, y;
|
||||||
|
short width, height;
|
||||||
|
WND *wndPtr;
|
||||||
|
LPHEADCAPTION lphs;
|
||||||
|
PAINTSTRUCT ps;
|
||||||
|
HDC hDC;
|
||||||
|
HDC hMemDC;
|
||||||
|
BITMAP bm;
|
||||||
|
RECT rect;
|
||||||
|
char str[128];
|
||||||
|
switch(message)
|
||||||
|
{
|
||||||
|
case WM_CREATE:
|
||||||
|
wndPtr = WIN_FindWndPtr(hWnd);
|
||||||
|
lphs = (LPHEADCAPTION)malloc(sizeof(HEADCAPTION));
|
||||||
|
if (lphs == 0) {
|
||||||
|
printf("Bad Memory Alloc on CAPTIONBAR !\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
memset(lphs, 0, sizeof(HEADCAPTION));
|
||||||
|
#ifdef DEBUG_CAPTION
|
||||||
|
printf("CreateCaptionBarStruct %lX !\n", lphs);
|
||||||
|
#endif
|
||||||
|
*((LPHEADCAPTION *)&wndPtr->wExtra[1]) = lphs;
|
||||||
|
if (hStdClose == (HBITMAP)NULL)
|
||||||
|
hStdClose = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_CLOSE));
|
||||||
|
lphs->hClose = hStdClose;
|
||||||
|
if (hStdMinim == (HBITMAP)NULL)
|
||||||
|
hStdMinim = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_REDUCE));
|
||||||
|
lphs->hMinim = hStdMinim;
|
||||||
|
if (hStdMaxim == (HBITMAP)NULL)
|
||||||
|
hStdMaxim = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RESTORE));
|
||||||
|
lphs->hMaxim = hStdMaxim;
|
||||||
|
if (hStdCloseD == (HBITMAP)NULL)
|
||||||
|
hStdCloseD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_CLOSE));
|
||||||
|
if (hStdMinimD == (HBITMAP)NULL)
|
||||||
|
hStdMinimD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_REDUCED));
|
||||||
|
if (hStdMaximD == (HBITMAP)NULL)
|
||||||
|
hStdMaximD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RESTORED));
|
||||||
|
if (hStdSysMenu == (HBITMAP)NULL)
|
||||||
|
hStdSysMenu = LoadMenu((HINSTANCE)NULL, "SYSMENU");
|
||||||
|
lphs->hSysMenu = hStdSysMenu;
|
||||||
|
printf("CaptionBar SYSMENU %04X !\n", lphs->hSysMenu);
|
||||||
|
if (lphs->hSysMenu == 0) lphs->hSysMenu = CreatePopupMenu();
|
||||||
|
AppendMenu(lphs->hSysMenu, MF_STRING, 9999, "About &Wine ...");
|
||||||
|
GetClientRect(hWnd, &rect);
|
||||||
|
CopyRect(&lphs->rectClose, &rect);
|
||||||
|
CopyRect(&lphs->rectMaxim, &rect);
|
||||||
|
lphs->rectClose.right = lphs->rectClose.left +
|
||||||
|
lphs->rectClose.bottom + lphs->rectClose.top;
|
||||||
|
lphs->rectMaxim.left = lphs->rectMaxim.right -
|
||||||
|
lphs->rectMaxim.bottom + lphs->rectMaxim.top;
|
||||||
|
CopyRect(&lphs->rectMinim, &lphs->rectMaxim);
|
||||||
|
if (lphs->hMaxim != 0) {
|
||||||
|
lphs->rectMinim.left = lphs->rectMaxim.bottom + lphs->rectMaxim.top;
|
||||||
|
lphs->rectMinim.right = lphs->rectMaxim.bottom + lphs->rectMaxim.top;
|
||||||
|
}
|
||||||
|
if (lphs->hClose == 0) lphs->rectClose.right = lphs->rectClose.left;
|
||||||
|
printf("CAPTION Close.right=%d Maxim.left=%d Minim.left=%d !\n",
|
||||||
|
lphs->rectClose.right, lphs->rectMaxim.left, lphs->rectMinim.left);
|
||||||
|
return 0;
|
||||||
|
case WM_DESTROY:
|
||||||
|
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
|
||||||
|
if (lphs == 0) return 0;
|
||||||
|
#ifdef DEBUG_CAPTION
|
||||||
|
printf("CaptionBar WM_DESTROY %lX !\n", lphs);
|
||||||
|
#endif
|
||||||
|
DestroyMenu(lphs->hSysMenu);
|
||||||
|
free(lphs);
|
||||||
|
*((LPHEADCAPTION *)&wndPtr->wExtra[1]) = 0;
|
||||||
|
return 0;
|
||||||
|
case WM_COMMAND:
|
||||||
|
#ifdef DEBUG_CAPTION
|
||||||
|
printf("CaptionBar WM_COMMAND %04X %08X !\n", wParam, lParam);
|
||||||
|
#endif
|
||||||
|
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
|
||||||
|
if (wParam == 9999) {
|
||||||
|
printf("CaptionBar Show 'About Wine ...' !\n");
|
||||||
|
}
|
||||||
|
SendMessage(wndPtr->hwndParent, message, wParam, lParam);
|
||||||
|
break;
|
||||||
|
case WM_SIZE:
|
||||||
|
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
|
||||||
|
width = LOWORD(lParam);
|
||||||
|
height = HIWORD(lParam);
|
||||||
|
if (lphs->hClose != 0)
|
||||||
|
SetRect(&lphs->rectClose, 0, 0, height, height);
|
||||||
|
if (lphs->hMinim != 0) {
|
||||||
|
if (lphs->hMaxim != 0)
|
||||||
|
SetRect(&lphs->rectMinim, width - 2 * height, 0,
|
||||||
|
width - height, height);
|
||||||
|
else
|
||||||
|
SetRect(&lphs->rectMinim, width - height, 0, width, height);
|
||||||
|
}
|
||||||
|
if (lphs->hMaxim != 0)
|
||||||
|
SetRect(&lphs->rectMaxim, width - height, 0, width, height);
|
||||||
|
break;
|
||||||
|
case WM_LBUTTONDOWN:
|
||||||
|
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
|
||||||
|
SetCapture(hWnd);
|
||||||
|
x = LOWORD(lParam);
|
||||||
|
y = HIWORD(lParam);
|
||||||
|
hDC = GetDC(hWnd);
|
||||||
|
if (x > lphs->rectClose.left && x < lphs->rectClose.right) {
|
||||||
|
lphs->hClose = hStdCloseD;
|
||||||
|
InvalidateRect(hWnd, &lphs->rectClose, TRUE);
|
||||||
|
UpdateWindow(hWnd);
|
||||||
|
}
|
||||||
|
if (x > lphs->rectMinim.left && x < lphs->rectMinim.right) {
|
||||||
|
lphs->hMinim = hStdMinimD;
|
||||||
|
InvalidateRect(hWnd, &lphs->rectMinim, TRUE);
|
||||||
|
UpdateWindow(hWnd);
|
||||||
|
}
|
||||||
|
if (x > lphs->rectMaxim.left && x < lphs->rectMaxim.right &&
|
||||||
|
lphs->hMaxim != 0) {
|
||||||
|
lphs->hMaxim = hStdMaximD;
|
||||||
|
InvalidateRect(hWnd, &lphs->rectMaxim, TRUE);
|
||||||
|
UpdateWindow(hWnd);
|
||||||
|
}
|
||||||
|
ReleaseDC(hWnd, hDC);
|
||||||
|
break;
|
||||||
|
case WM_LBUTTONUP:
|
||||||
|
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
|
||||||
|
ReleaseCapture();
|
||||||
|
#ifdef DEBUG_CAPTION
|
||||||
|
printf("CaptionBar WM_LBUTTONUP %lX !\n", lParam);
|
||||||
|
#endif
|
||||||
|
x = LOWORD(lParam);
|
||||||
|
y = HIWORD(lParam);
|
||||||
|
if (x > lphs->rectClose.left && x < lphs->rectClose.right) {
|
||||||
|
lphs->hClose = hStdClose;
|
||||||
|
InvalidateRect(hWnd, &lphs->rectClose, TRUE);
|
||||||
|
UpdateWindow(hWnd);
|
||||||
|
TrackPopupMenu(lphs->hSysMenu, TPM_LEFTBUTTON, 0, -20,
|
||||||
|
0, wndPtr->hwndParent, (LPRECT)NULL);
|
||||||
|
SetMenuLogicalParent(lphs->hSysMenu, hWnd);
|
||||||
|
printf("CAPTION Pop the SYSMENU !\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (x > lphs->rectMinim.left && x < lphs->rectMinim.right) {
|
||||||
|
SendMessage(wndPtr->hwndParent, WM_SYSCOMMAND, SC_MINIMIZE, 0L);
|
||||||
|
lphs->hMinim = hStdMinim;
|
||||||
|
InvalidateRect(hWnd, &lphs->rectMinim, TRUE);
|
||||||
|
UpdateWindow(hWnd);
|
||||||
|
printf("CAPTION Minimize Window !\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (x > lphs->rectMaxim.left && x < lphs->rectMaxim.right) {
|
||||||
|
lphs->hMaxim = hStdMaxim;
|
||||||
|
InvalidateRect(hWnd, &lphs->rectMaxim, TRUE);
|
||||||
|
UpdateWindow(hWnd);
|
||||||
|
SendMessage(wndPtr->hwndParent, WM_SYSCOMMAND, SC_MAXIMIZE, 0L);
|
||||||
|
printf("CAPTION Maximize Window !\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_LBUTTONDBLCLK:
|
||||||
|
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
|
||||||
|
#ifdef DEBUG_CAPTION
|
||||||
|
printf("CaptionBar WM_LBUTTONDBLCLK %lX !\n", lParam);
|
||||||
|
#endif
|
||||||
|
x = LOWORD(lParam);
|
||||||
|
y = HIWORD(lParam);
|
||||||
|
if (x > lphs->rectClose.left && x < lphs->rectClose.right) {
|
||||||
|
SendMessage(wndPtr->hwndParent, WM_SYSCOMMAND, SC_CLOSE, 0L);
|
||||||
|
printf("CAPTION DoubleClick Close Window !\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_KEYDOWN:
|
||||||
|
case WM_KEYUP:
|
||||||
|
case WM_CHAR:
|
||||||
|
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
|
||||||
|
return(SendMessage(wndPtr->hwndParent, message, wParam, lParam));
|
||||||
|
|
||||||
|
case WM_PAINT:
|
||||||
|
GetWindowRect(hWnd, &rect);
|
||||||
|
#ifdef DEBUG_CAPTION
|
||||||
|
printf("CaptionBar WM_PAINT left=%d top=%d right=%d bottom=%d !\n",
|
||||||
|
rect.left, rect.top, rect.right, rect.bottom);
|
||||||
|
#endif
|
||||||
|
lphs = CaptionBarGetWindowAndStorage(hWnd, &wndPtr);
|
||||||
|
hDC = BeginPaint(hWnd, &ps);
|
||||||
|
hMemDC = CreateCompatibleDC(hDC);
|
||||||
|
if (lphs->hClose != 0) {
|
||||||
|
GetObject(lphs->hClose, sizeof(BITMAP), (LPSTR)&bm);
|
||||||
|
SelectObject(hMemDC, lphs->hClose);
|
||||||
|
BitBlt(hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
|
||||||
|
}
|
||||||
|
if (lphs->hMinim != 0) {
|
||||||
|
GetObject(lphs->hMinim, sizeof(BITMAP), (LPSTR)&bm);
|
||||||
|
SelectObject(hMemDC, lphs->hMinim);
|
||||||
|
BitBlt(hDC, lphs->rectMinim.left, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
|
||||||
|
}
|
||||||
|
if (lphs->hMaxim != 0) {
|
||||||
|
GetObject(lphs->hMaxim, sizeof(BITMAP), (LPSTR)&bm);
|
||||||
|
SelectObject(hMemDC, lphs->hMaxim);
|
||||||
|
BitBlt(hDC, lphs->rectMaxim.left, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
|
||||||
|
}
|
||||||
|
DeleteDC(hMemDC);
|
||||||
|
GetClientRect(hWnd, &rect);
|
||||||
|
FrameRect(hDC, &rect, GetStockObject(BLACK_BRUSH));
|
||||||
|
rect.left = lphs->rectClose.right;
|
||||||
|
rect.right = lphs->rectMinim.left;
|
||||||
|
#ifdef DEBUG_CAPTION
|
||||||
|
printf("CaptionBar WM_PAINT left=%d top=%d right=%d bottom=%d !\n",
|
||||||
|
rect.left, rect.top, rect.right, rect.bottom);
|
||||||
|
#endif
|
||||||
|
FillRect(hDC, &rect, GetStockObject(GRAY_BRUSH));
|
||||||
|
if (GetWindowTextLength(wndPtr->hwndParent) > 0) {
|
||||||
|
GetWindowText(wndPtr->hwndParent, str, sizeof(str));
|
||||||
|
width = GetTextExtent(hDC, str, strlen(str));
|
||||||
|
DrawText(hDC, str, -1, &rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
|
||||||
|
}
|
||||||
|
EndPaint(hWnd, &ps);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return DefWindowProc( hWnd, message, wParam, lParam );
|
||||||
|
}
|
||||||
|
return(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
LPHEADCAPTION CaptionBarGetWindowAndStorage(HWND hWnd, WND **wndPtr)
|
||||||
|
{
|
||||||
|
WND *Ptr;
|
||||||
|
LPHEADCAPTION lphs;
|
||||||
|
*(wndPtr) = Ptr = WIN_FindWndPtr(hWnd);
|
||||||
|
if (Ptr == 0) {
|
||||||
|
printf("Bad Window handle on CaptionBar !\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
lphs = *((LPHEADCAPTION *)&Ptr->wExtra[1]);
|
||||||
|
return lphs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LPHEADCAPTION CaptionBarGetStorageHeader(HWND hWnd)
|
||||||
|
{
|
||||||
|
WND *wndPtr;
|
||||||
|
LPHEADCAPTION lphs;
|
||||||
|
wndPtr = WIN_FindWndPtr(hWnd);
|
||||||
|
if (wndPtr == 0) {
|
||||||
|
printf("Bad Window handle on CaptionBar !\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
lphs = *((LPHEADCAPTION *)&wndPtr->wExtra[1]);
|
||||||
|
return lphs;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
1117
controls/menu.c
1117
controls/menu.c
File diff suppressed because it is too large
Load Diff
|
@ -21,6 +21,15 @@ static char Copyright[] = "Copyright Martin Ayotte, 1993";
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
HBITMAP hUpArrow = 0;
|
||||||
|
HBITMAP hDnArrow = 0;
|
||||||
|
HBITMAP hLfArrow = 0;
|
||||||
|
HBITMAP hRgArrow = 0;
|
||||||
|
HBITMAP hUpArrowD = 0;
|
||||||
|
HBITMAP hDnArrowD = 0;
|
||||||
|
HBITMAP hLfArrowD = 0;
|
||||||
|
HBITMAP hRgArrowD = 0;
|
||||||
|
|
||||||
LPHEADSCROLL ScrollBarGetWindowAndStorage(HWND hwnd, WND **wndPtr);
|
LPHEADSCROLL ScrollBarGetWindowAndStorage(HWND hwnd, WND **wndPtr);
|
||||||
LPHEADSCROLL ScrollBarGetStorageHeader(HWND hwnd);
|
LPHEADSCROLL ScrollBarGetStorageHeader(HWND hwnd);
|
||||||
void StdDrawScrollBar(HWND hwnd);
|
void StdDrawScrollBar(HWND hwnd);
|
||||||
|
@ -34,9 +43,13 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
|
||||||
{
|
{
|
||||||
WORD wRet;
|
WORD wRet;
|
||||||
short x, y;
|
short x, y;
|
||||||
|
short width, height;
|
||||||
WND *wndPtr;
|
WND *wndPtr;
|
||||||
LPHEADSCROLL lphs;
|
LPHEADSCROLL lphs;
|
||||||
RECT rect;
|
LPDRAWITEMSTRUCT lpdis;
|
||||||
|
HDC hMemDC;
|
||||||
|
BITMAP bm;
|
||||||
|
RECT rect;
|
||||||
static RECT rectsel;
|
static RECT rectsel;
|
||||||
switch(message)
|
switch(message)
|
||||||
{
|
{
|
||||||
|
@ -45,6 +58,22 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
|
||||||
#ifdef DEBUG_SCROLL
|
#ifdef DEBUG_SCROLL
|
||||||
printf("ScrollBar Creation up=%X down=%X!\n", lphs->hWndUp, lphs->hWndDown);
|
printf("ScrollBar Creation up=%X down=%X!\n", lphs->hWndUp, lphs->hWndDown);
|
||||||
#endif
|
#endif
|
||||||
|
if (hUpArrow == (HBITMAP)NULL)
|
||||||
|
hUpArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_UPARROWI));
|
||||||
|
if (hDnArrow == (HBITMAP)NULL)
|
||||||
|
hDnArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_DNARROWI));
|
||||||
|
if (hLfArrow == (HBITMAP)NULL)
|
||||||
|
hLfArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_LFARROWI));
|
||||||
|
if (hRgArrow == (HBITMAP)NULL)
|
||||||
|
hRgArrow = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROWI));
|
||||||
|
if (hUpArrowD == (HBITMAP)NULL)
|
||||||
|
hUpArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_UPARROWD));
|
||||||
|
if (hDnArrowD == (HBITMAP)NULL)
|
||||||
|
hDnArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_DNARROWD));
|
||||||
|
if (hLfArrowD == (HBITMAP)NULL)
|
||||||
|
hLfArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_LFARROWD));
|
||||||
|
if (hRgArrowD == (HBITMAP)NULL)
|
||||||
|
hRgArrowD = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_RGARROWD));
|
||||||
return 0;
|
return 0;
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
lphs = ScrollBarGetWindowAndStorage(hwnd, &wndPtr);
|
lphs = ScrollBarGetWindowAndStorage(hwnd, &wndPtr);
|
||||||
|
@ -129,15 +158,6 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
|
||||||
ReleaseCapture();
|
ReleaseCapture();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_KEYDOWN:
|
|
||||||
case WM_KEYUP:
|
|
||||||
case WM_CHAR:
|
|
||||||
lphs = ScrollBarGetWindowAndStorage(hwnd, &wndPtr);
|
|
||||||
return(SendMessage(wndPtr->hwndParent, message, wParam, lParam));
|
|
||||||
|
|
||||||
case WM_PAINT:
|
|
||||||
StdDrawScrollBar(hwnd);
|
|
||||||
break;
|
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
if ((wParam & MK_LBUTTON) != 0) {
|
if ((wParam & MK_LBUTTON) != 0) {
|
||||||
lphs = ScrollBarGetWindowAndStorage(hwnd, &wndPtr);
|
lphs = ScrollBarGetWindowAndStorage(hwnd, &wndPtr);
|
||||||
|
@ -150,12 +170,88 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
|
||||||
x = (y * (lphs->MaxVal - lphs->MinVal) /
|
x = (y * (lphs->MaxVal - lphs->MinVal) /
|
||||||
lphs->MaxPix) + lphs->MinVal;
|
lphs->MaxPix) + lphs->MinVal;
|
||||||
#ifdef DEBUG_SCROLL
|
#ifdef DEBUG_SCROLL
|
||||||
printf("WM_MOUSEMOVE val=%d pix=%d\n", x, y);
|
printf("Scroll WM_MOUSEMOVE val=%d pix=%d\n", x, y);
|
||||||
#endif
|
#endif
|
||||||
SendMessage(wndPtr->hwndParent, lphs->Direction,
|
SendMessage(wndPtr->hwndParent, lphs->Direction,
|
||||||
SB_THUMBTRACK, MAKELONG(x, hwnd));
|
SB_THUMBTRACK, MAKELONG(x, hwnd));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case WM_KEYDOWN:
|
||||||
|
case WM_KEYUP:
|
||||||
|
case WM_CHAR:
|
||||||
|
lphs = ScrollBarGetWindowAndStorage(hwnd, &wndPtr);
|
||||||
|
return(SendMessage(wndPtr->hwndParent, message, wParam, lParam));
|
||||||
|
|
||||||
|
case WM_SIZE:
|
||||||
|
lphs = ScrollBarGetWindowAndStorage(hwnd, &wndPtr);
|
||||||
|
width = LOWORD(lParam);
|
||||||
|
height = HIWORD(lParam);
|
||||||
|
if (lphs->Direction == WM_VSCROLL) {
|
||||||
|
MoveWindow(lphs->hWndUp, 0, 0, width, width, TRUE);
|
||||||
|
MoveWindow(lphs->hWndDown, 0, height - width, width, width, TRUE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
MoveWindow(lphs->hWndUp, 0, 0, height, height, TRUE);
|
||||||
|
MoveWindow(lphs->hWndDown, width - height, 0, height, height, TRUE);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_DRAWITEM:
|
||||||
|
#ifdef DEBUG_SCROLL
|
||||||
|
printf("Scroll WM_DRAWITEM w=%04X l=%08X\n", wParam, lParam);
|
||||||
|
#endif
|
||||||
|
lpdis = (LPDRAWITEMSTRUCT)lParam;
|
||||||
|
if (lpdis->CtlType == ODT_BUTTON && lpdis->itemAction == ODA_DRAWENTIRE) {
|
||||||
|
hMemDC = CreateCompatibleDC(lpdis->hDC);
|
||||||
|
if (lpdis->CtlID == 1) {
|
||||||
|
GetObject(hUpArrow, sizeof(BITMAP), (LPSTR)&bm);
|
||||||
|
SelectObject(hMemDC, hUpArrow);
|
||||||
|
BitBlt(lpdis->hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
|
||||||
|
}
|
||||||
|
if (lpdis->CtlID == 2) {
|
||||||
|
GetObject(hDnArrow, sizeof(BITMAP), (LPSTR)&bm);
|
||||||
|
SelectObject(hMemDC, hDnArrow);
|
||||||
|
BitBlt(lpdis->hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
|
||||||
|
}
|
||||||
|
if (lpdis->CtlID == 3) {
|
||||||
|
GetObject(hLfArrow, sizeof(BITMAP), (LPSTR)&bm);
|
||||||
|
SelectObject(hMemDC, hLfArrow);
|
||||||
|
BitBlt(lpdis->hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
|
||||||
|
}
|
||||||
|
if (lpdis->CtlID == 4) {
|
||||||
|
GetObject(hRgArrow, sizeof(BITMAP), (LPSTR)&bm);
|
||||||
|
SelectObject(hMemDC, hRgArrow);
|
||||||
|
BitBlt(lpdis->hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
|
||||||
|
}
|
||||||
|
DeleteDC(hMemDC);
|
||||||
|
}
|
||||||
|
if (lpdis->CtlType == ODT_BUTTON && lpdis->itemAction == ODA_SELECT) {
|
||||||
|
hMemDC = CreateCompatibleDC(lpdis->hDC);
|
||||||
|
if (lpdis->CtlID == 1) {
|
||||||
|
GetObject(hUpArrowD, sizeof(BITMAP), (LPSTR)&bm);
|
||||||
|
SelectObject(hMemDC, hUpArrowD);
|
||||||
|
BitBlt(lpdis->hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
|
||||||
|
}
|
||||||
|
if (lpdis->CtlID == 2) {
|
||||||
|
GetObject(hDnArrowD, sizeof(BITMAP), (LPSTR)&bm);
|
||||||
|
SelectObject(hMemDC, hDnArrowD);
|
||||||
|
BitBlt(lpdis->hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
|
||||||
|
}
|
||||||
|
if (lpdis->CtlID == 3) {
|
||||||
|
GetObject(hLfArrowD, sizeof(BITMAP), (LPSTR)&bm);
|
||||||
|
SelectObject(hMemDC, hLfArrowD);
|
||||||
|
BitBlt(lpdis->hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
|
||||||
|
}
|
||||||
|
if (lpdis->CtlID == 4) {
|
||||||
|
GetObject(hRgArrowD, sizeof(BITMAP), (LPSTR)&bm);
|
||||||
|
SelectObject(hMemDC, hRgArrowD);
|
||||||
|
BitBlt(lpdis->hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
|
||||||
|
}
|
||||||
|
DeleteDC(hMemDC);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_PAINT:
|
||||||
|
StdDrawScrollBar(hwnd);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return DefWindowProc( hwnd, message, wParam, lParam );
|
return DefWindowProc( hwnd, message, wParam, lParam );
|
||||||
}
|
}
|
||||||
|
@ -274,10 +370,10 @@ int CreateScrollBarStruct(HWND hwnd)
|
||||||
lphs->MaxPix = height - 3 * width;
|
lphs->MaxPix = height - 3 * width;
|
||||||
lphs->Direction = WM_VSCROLL;
|
lphs->Direction = WM_VSCROLL;
|
||||||
lphs->hWndUp = CreateWindow("BUTTON", "",
|
lphs->hWndUp = CreateWindow("BUTTON", "",
|
||||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
|
WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
|
||||||
0, 0, width, width, hwnd, 1, wndPtr->hInstance, 0L);
|
0, 0, width, width, hwnd, 1, wndPtr->hInstance, 0L);
|
||||||
lphs->hWndDown = CreateWindow("BUTTON", "",
|
lphs->hWndDown = CreateWindow("BUTTON", "",
|
||||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
|
WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
|
||||||
0, height - width, width, width, hwnd, 2,
|
0, height - width, width, width, hwnd, 2,
|
||||||
wndPtr->hInstance, 0L);
|
wndPtr->hInstance, 0L);
|
||||||
}
|
}
|
||||||
|
@ -286,11 +382,11 @@ int CreateScrollBarStruct(HWND hwnd)
|
||||||
lphs->MaxPix = width - 3 * height;
|
lphs->MaxPix = width - 3 * height;
|
||||||
lphs->Direction = WM_HSCROLL;
|
lphs->Direction = WM_HSCROLL;
|
||||||
lphs->hWndUp = CreateWindow("BUTTON", "",
|
lphs->hWndUp = CreateWindow("BUTTON", "",
|
||||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
|
WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
|
||||||
0, 0, height, height, hwnd, 0, wndPtr->hInstance, 0L);
|
0, 0, height, height, hwnd, 3, wndPtr->hInstance, 0L);
|
||||||
lphs->hWndDown = CreateWindow("BUTTON", "",
|
lphs->hWndDown = CreateWindow("BUTTON", "",
|
||||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
|
WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
|
||||||
width - height, 0, height, height, hwnd, 0,
|
width - height, 0, height, height, hwnd, 4,
|
||||||
wndPtr->hInstance, 0L);
|
wndPtr->hInstance, 0L);
|
||||||
}
|
}
|
||||||
if (lphs->MaxPix < 1) lphs->MaxPix = 1;
|
if (lphs->MaxPix < 1) lphs->MaxPix = 1;
|
||||||
|
|
|
@ -17,6 +17,7 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam );
|
||||||
LONG ListBoxWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
|
LONG ListBoxWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
|
||||||
LONG ComboBoxWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
|
LONG ComboBoxWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
|
||||||
LONG PopupMenuWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
|
LONG PopupMenuWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
|
||||||
|
LONG CaptionBarWndProc ( HWND hwnd, WORD message, WORD wParam, LONG lParam );
|
||||||
|
|
||||||
|
|
||||||
static WNDCLASS WIDGETS_BuiltinClasses[] =
|
static WNDCLASS WIDGETS_BuiltinClasses[] =
|
||||||
|
@ -33,6 +34,8 @@ static WNDCLASS WIDGETS_BuiltinClasses[] =
|
||||||
0, 0, 0, 0, NULL, "COMBOBOX" },
|
0, 0, 0, 0, NULL, "COMBOBOX" },
|
||||||
{ CS_GLOBALCLASS, (LONG(*)())PopupMenuWndProc, 0, 8,
|
{ CS_GLOBALCLASS, (LONG(*)())PopupMenuWndProc, 0, 8,
|
||||||
0, 0, 0, 0, NULL, "POPUPMENU" },
|
0, 0, 0, 0, NULL, "POPUPMENU" },
|
||||||
|
{ CS_GLOBALCLASS, (LONG(*)())CaptionBarWndProc, 0, 8,
|
||||||
|
0, 0, 0, 0, NULL, "CAPTION" },
|
||||||
{ CS_GLOBALCLASS, (LONG(*)())DefDlgProc, 0, DLGWINDOWEXTRA,
|
{ CS_GLOBALCLASS, (LONG(*)())DefDlgProc, 0, DLGWINDOWEXTRA,
|
||||||
0, 0, 0, 0, NULL, DIALOG_CLASS_NAME }
|
0, 0, 0, 0, NULL, DIALOG_CLASS_NAME }
|
||||||
};
|
};
|
||||||
|
|
|
@ -172,7 +172,7 @@ void examine_memory(int addr, int count, char format){
|
||||||
pnt = (char *) addr;
|
pnt = (char *) addr;
|
||||||
for(i=0; i<count; i++)
|
for(i=0; i<count; i++)
|
||||||
{
|
{
|
||||||
fprintf(stderr," %w", *pnt++);
|
fprintf(stderr," %02.2x", (*pnt++) & 0xff);
|
||||||
if ((i % 32) == 7) {
|
if ((i % 32) == 7) {
|
||||||
fprintf(stderr,"\n");
|
fprintf(stderr,"\n");
|
||||||
print_address((unsigned int) pnt, stderr);
|
print_address((unsigned int) pnt, stderr);
|
||||||
|
|
|
@ -19,6 +19,8 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
|
||||||
#include "prototypes.h"
|
#include "prototypes.h"
|
||||||
#include "dlls.h"
|
#include "dlls.h"
|
||||||
|
|
||||||
|
/* #define DEBUG_RELAY */
|
||||||
|
|
||||||
#define N_BUILTINS 8
|
#define N_BUILTINS 8
|
||||||
|
|
||||||
struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS] =
|
struct dll_name_table_entry_s dll_builtin_table[N_BUILTINS] =
|
||||||
|
@ -99,14 +101,6 @@ DLLRelay(unsigned int func_num, unsigned int seg_off)
|
||||||
IF1632_Saved16_esp, IF1632_Saved16_ebp,
|
IF1632_Saved16_esp, IF1632_Saved16_ebp,
|
||||||
IF1632_Saved16_ss);
|
IF1632_Saved16_ss);
|
||||||
|
|
||||||
if (strcmp("GetMessage", dll_p->export_name) == 0 &&
|
|
||||||
seg_off == 0x00972526 &&
|
|
||||||
*ret_addr == 0x004700cd &&
|
|
||||||
IF1632_Saved16_esp == 0x2526 &&
|
|
||||||
IF1632_Saved16_ebp == 0x2534 &&
|
|
||||||
IF1632_Saved16_ss == 0x0097)
|
|
||||||
printf("ACK!!\n");
|
|
||||||
|
|
||||||
#ifdef DEBUG_STACK
|
#ifdef DEBUG_STACK
|
||||||
stack_p = (unsigned short *) seg_off;
|
stack_p = (unsigned short *) seg_off;
|
||||||
for (i = 0; i < 24; i++, stack_p++)
|
for (i = 0; i < 24; i++, stack_p++)
|
||||||
|
|
|
@ -120,6 +120,7 @@ length 540
|
||||||
155 pascal EnableMenuItem(word word word) EnableMenuItem(1 2 3)
|
155 pascal EnableMenuItem(word word word) EnableMenuItem(1 2 3)
|
||||||
157 pascal GetMenu(word) GetMenu(1)
|
157 pascal GetMenu(word) GetMenu(1)
|
||||||
158 pascal SetMenu(word word) SetMenu(1 2)
|
158 pascal SetMenu(word word) SetMenu(1 2)
|
||||||
|
160 pascal DrawMenuBar(word) DrawMenuBar(1)
|
||||||
163 pascal CreateCaret(word word word word) CreateCaret(1 2 3 4)
|
163 pascal CreateCaret(word word word word) CreateCaret(1 2 3 4)
|
||||||
164 pascal DestroyCaret() DestroyCaret()
|
164 pascal DestroyCaret() DestroyCaret()
|
||||||
165 pascal SetCaretPos(word word) SetCaretPos(1 2)
|
165 pascal SetCaretPos(word word) SetCaretPos(1 2)
|
||||||
|
@ -206,6 +207,8 @@ length 540
|
||||||
415 pascal CreatePopupMenu() CreatePopupMenu()
|
415 pascal CreatePopupMenu() CreatePopupMenu()
|
||||||
416 pascal TrackPopupMenu(word word word word word word ptr)
|
416 pascal TrackPopupMenu(word word word word word word ptr)
|
||||||
TrackPopupMenu(1 2 3 4 5 6 7)
|
TrackPopupMenu(1 2 3 4 5 6 7)
|
||||||
|
418 pascal SetMenuItemBitmaps(word word word word word)
|
||||||
|
SetMenuItemBitmaps(1 2 3 4 5)
|
||||||
420 pascal wsprintf(ptr ptr) wsprintf(1 2)
|
420 pascal wsprintf(ptr ptr) wsprintf(1 2)
|
||||||
421 pascal wvsprintf(ptr ptr ptr) wvsprintf(1 2 3)
|
421 pascal wvsprintf(ptr ptr ptr) wvsprintf(1 2 3)
|
||||||
430 pascal lstrcmp(ptr ptr) lstrcmp(1 2)
|
430 pascal lstrcmp(ptr ptr) lstrcmp(1 2)
|
||||||
|
@ -220,6 +223,7 @@ length 540
|
||||||
452 pascal CreateWindowEx(long ptr ptr long s_word s_word s_word s_word
|
452 pascal CreateWindowEx(long ptr ptr long s_word s_word s_word s_word
|
||||||
word word word ptr)
|
word word word ptr)
|
||||||
CreateWindowEx(1 2 3 4 5 6 7 8 9 10 11 12)
|
CreateWindowEx(1 2 3 4 5 6 7 8 9 10 11 12)
|
||||||
|
454 pascal AdjustWindowRectEx(ptr long word long) AdjustWindowRectEx(1 2 3 4)
|
||||||
457 pascal DestroyIcon(word) DestroyIcon(1)
|
457 pascal DestroyIcon(word) DestroyIcon(1)
|
||||||
458 pascal DestroyCursor(word) DestroyCursor(1)
|
458 pascal DestroyCursor(word) DestroyCursor(1)
|
||||||
471 pascal lstrcmpi(ptr ptr) lstrcmpi(1 2)
|
471 pascal lstrcmpi(ptr ptr) lstrcmpi(1 2)
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
/*
|
||||||
|
* Caption Bar definitions
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct tagHEADCAPTION {
|
||||||
|
HBITMAP hClose;
|
||||||
|
HBITMAP hMinim;
|
||||||
|
HBITMAP hMaxim;
|
||||||
|
HMENU hSysMenu;
|
||||||
|
RECT rectClose;
|
||||||
|
RECT rectMinim;
|
||||||
|
RECT rectMaxim;
|
||||||
|
} HEADCAPTION;
|
||||||
|
typedef HEADCAPTION FAR* LPHEADCAPTION;
|
||||||
|
|
||||||
|
|
|
@ -282,7 +282,10 @@ extern HANDLE GDI_AllocObject( WORD, WORD );
|
||||||
extern BOOL GDI_FreeObject( HANDLE );
|
extern BOOL GDI_FreeObject( HANDLE );
|
||||||
extern GDIOBJHDR * GDI_GetObjPtr( HANDLE, WORD );
|
extern GDIOBJHDR * GDI_GetObjPtr( HANDLE, WORD );
|
||||||
|
|
||||||
extern Display * XT_display;
|
extern Display * XT_display; /* Will be removed */
|
||||||
extern Screen * XT_screen;
|
extern Screen * XT_screen; /* Will be removed */
|
||||||
|
|
||||||
|
extern Display * display;
|
||||||
|
extern Screen * screen;
|
||||||
|
|
||||||
#endif /* GDI_H */
|
#endif /* GDI_H */
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
#include <X11/Xaw/Command.h>
|
#include <X11/Xaw/Command.h>
|
||||||
#include <X11/Xaw/Box.h>
|
#include <X11/Xaw/Box.h>
|
||||||
|
|
||||||
#include "windows.h"
|
|
||||||
|
|
||||||
typedef struct tagMENUITEM
|
typedef struct tagMENUITEM
|
||||||
{
|
{
|
||||||
|
@ -23,7 +22,9 @@ typedef struct tagMENUITEM
|
||||||
struct tagMENUITEM *parent;
|
struct tagMENUITEM *parent;
|
||||||
WORD item_flags;
|
WORD item_flags;
|
||||||
WORD item_id;
|
WORD item_id;
|
||||||
char *item_text;
|
WORD sel_key;
|
||||||
|
char *shortcut;
|
||||||
|
char *item_text;
|
||||||
Widget w;
|
Widget w;
|
||||||
Widget menu_w;
|
Widget menu_w;
|
||||||
char menu_name[10];
|
char menu_name[10];
|
||||||
|
@ -46,11 +47,15 @@ typedef struct tagMENUBAR
|
||||||
typedef struct tagPOPUPMENU
|
typedef struct tagPOPUPMENU
|
||||||
{
|
{
|
||||||
HWND hWnd; /* PopupMenu window handle */
|
HWND hWnd; /* PopupMenu window handle */
|
||||||
|
HWND hWndParent; /* Parent opupMenu window handle */
|
||||||
HWND ownerWnd; /* Owner window */
|
HWND ownerWnd; /* Owner window */
|
||||||
WORD nItems; /* Number of items on menu */
|
WORD nItems; /* Number of items on menu */
|
||||||
MENUITEM *firstItem;
|
MENUITEM *firstItem;
|
||||||
WORD FocusedItem;
|
WORD FocusedItem;
|
||||||
WORD MouseFlags;
|
WORD MouseFlags;
|
||||||
|
WORD BarFlags;
|
||||||
|
WORD Width;
|
||||||
|
WORD Height;
|
||||||
} POPUPMENU, *LPPOPUPMENU;
|
} POPUPMENU, *LPPOPUPMENU;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
/*
|
||||||
|
* System metrics definitions
|
||||||
|
*
|
||||||
|
* Copyright 1994 Alexandre Julliard
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SYSMETRICS_H
|
||||||
|
#define SYSMETRICS_H
|
||||||
|
|
||||||
|
#include "windows.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* Constant system metrics */
|
||||||
|
#define SYSMETRICS_CXVSCROLL 16
|
||||||
|
#define SYSMETRICS_CYHSCROLL 16
|
||||||
|
#define SYSMETRICS_CYCAPTION 20
|
||||||
|
#define SYSMETRICS_CXBORDER 1
|
||||||
|
#define SYSMETRICS_CYBORDER 1
|
||||||
|
#define SYSMETRICS_CXDLGFRAME 4
|
||||||
|
#define SYSMETRICS_CYDLGFRAME 4
|
||||||
|
#define SYSMETRICS_CYVTHUMB 16
|
||||||
|
#define SYSMETRICS_CXHTHUMB 16
|
||||||
|
#define SYSMETRICS_CXICON 32
|
||||||
|
#define SYSMETRICS_CYICON 32
|
||||||
|
#define SYSMETRICS_CXCURSOR 32
|
||||||
|
#define SYSMETRICS_CYCURSOR 32
|
||||||
|
#define SYSMETRICS_CYMENU 18
|
||||||
|
#define SYSMETRICS_CYVSCROLL 16
|
||||||
|
#define SYSMETRICS_CXHSCROLL 16
|
||||||
|
#define SYSMETRICS_CXMIN 100
|
||||||
|
#define SYSMETRICS_CYMIN 28
|
||||||
|
#define SYSMETRICS_CXSIZE 18
|
||||||
|
#define SYSMETRICS_CYSIZE 18
|
||||||
|
#define SYSMETRICS_CXMINTRACK 100
|
||||||
|
#define SYSMETRICS_CYMINTRACK 28
|
||||||
|
#define SYSMETRICS_CXICONSPACING 20
|
||||||
|
#define SYSMETRICS_CYICONSPACING 20
|
||||||
|
|
||||||
|
/* Some non-constant system metrics */
|
||||||
|
#define SYSMETRICS_CXSCREEN sysMetrics[SM_CXSCREEN]
|
||||||
|
#define SYSMETRICS_CYSCREEN sysMetrics[SM_CYSCREEN]
|
||||||
|
#define SYSMETRICS_CXFULLSCREEN sysMetrics[SM_CXFULLSCREEN]
|
||||||
|
#define SYSMETRICS_CYFULLSCREEN sysMetrics[SM_CYFULLSCREEN]
|
||||||
|
#define SYSMETRICS_SWAPBUTTON sysMetrics[SM_SWAPBUTTON]
|
||||||
|
#define SYSMETRICS_CXFRAME sysMetrics[SM_CXFRAME]
|
||||||
|
#define SYSMETRICS_CYFRAME sysMetrics[SM_CYFRAME]
|
||||||
|
#define SYSMETRICS_CXDOUBLECLK sysMetrics[SM_CXDOUBLECLK]
|
||||||
|
#define SYSMETRICS_CYDOUBLECLK sysMetrics[SM_CYDOUBLECLK]
|
||||||
|
#define SYSMETRICS_MENUDROPALIGNMENT sysMetrics[SM_MENUDROPALIGNMENT]
|
||||||
|
|
||||||
|
|
||||||
|
extern short sysMetrics[SM_CMETRICS];
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -7,7 +7,7 @@
|
||||||
#ifndef WIN_H
|
#ifndef WIN_H
|
||||||
#define WIN_H
|
#define WIN_H
|
||||||
|
|
||||||
#include <X11/Intrinsic.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
|
@ -40,11 +40,10 @@ typedef struct tagWND
|
||||||
WORD wIDmenu; /* ID or hmenu (from CreateWindow) */
|
WORD wIDmenu; /* ID or hmenu (from CreateWindow) */
|
||||||
HANDLE hText; /* Handle of window text */
|
HANDLE hText; /* Handle of window text */
|
||||||
WORD flags; /* Misc. flags */
|
WORD flags; /* Misc. flags */
|
||||||
Widget shellWidget; /* For top-level windows */
|
|
||||||
Widget winWidget; /* For all windows */
|
|
||||||
Widget compositeWidget;/* For top-level windows */
|
|
||||||
Window window; /* X window */
|
Window window; /* X window */
|
||||||
LPMENUBAR menuBarPtr; /* Menu bar */
|
LPMENUBAR menuBarPtr; /* Menu bar */
|
||||||
|
HWND hWndMenuBar; /* Menu bar */
|
||||||
|
HWND hWndCaption; /* Caption bar */
|
||||||
WORD wExtra[1]; /* Window extra bytes */
|
WORD wExtra[1]; /* Window extra bytes */
|
||||||
} WND;
|
} WND;
|
||||||
|
|
||||||
|
@ -54,6 +53,7 @@ typedef struct tagWND
|
||||||
#define WIN_GOT_SIZEMSG 0x04 /* WM_SIZE has been sent to the window */
|
#define WIN_GOT_SIZEMSG 0x04 /* WM_SIZE has been sent to the window */
|
||||||
#define WIN_OWN_DC 0x08 /* Win class has style CS_OWNDC */
|
#define WIN_OWN_DC 0x08 /* Win class has style CS_OWNDC */
|
||||||
#define WIN_CLASS_DC 0x10 /* Win class has style CS_CLASSDC */
|
#define WIN_CLASS_DC 0x10 /* Win class has style CS_CLASSDC */
|
||||||
|
#define WIN_DOUBLE_CLICKS 0x20 /* Win class has style CS_DBLCLKS */
|
||||||
|
|
||||||
/* Window functions */
|
/* Window functions */
|
||||||
WND *WIN_FindWndPtr( HWND hwnd );
|
WND *WIN_FindWndPtr( HWND hwnd );
|
||||||
|
|
|
@ -238,6 +238,49 @@ typedef struct
|
||||||
#define WVR_REDRAW (WVR_HREDRAW | WVR_VREDRAW)
|
#define WVR_REDRAW (WVR_HREDRAW | WVR_VREDRAW)
|
||||||
#define WVR_VALIDRECTS 0x0400
|
#define WVR_VALIDRECTS 0x0400
|
||||||
|
|
||||||
|
/* WM_NCHITTEST return codes */
|
||||||
|
#define HTERROR (-2)
|
||||||
|
#define HTTRANSPARENT (-1)
|
||||||
|
#define HTNOWHERE 0
|
||||||
|
#define HTCLIENT 1
|
||||||
|
#define HTCAPTION 2
|
||||||
|
#define HTSYSMENU 3
|
||||||
|
#define HTSIZE 4
|
||||||
|
#define HTMENU 5
|
||||||
|
#define HTHSCROLL 6
|
||||||
|
#define HTVSCROLL 7
|
||||||
|
#define HTMINBUTTON 8
|
||||||
|
#define HTMAXBUTTON 9
|
||||||
|
#define HTLEFT 10
|
||||||
|
#define HTRIGHT 11
|
||||||
|
#define HTTOP 12
|
||||||
|
#define HTTOPLEFT 13
|
||||||
|
#define HTTOPRIGHT 14
|
||||||
|
#define HTBOTTOM 15
|
||||||
|
#define HTBOTTOMLEFT 16
|
||||||
|
#define HTBOTTOMRIGHT 17
|
||||||
|
#define HTBORDER 18
|
||||||
|
#define HTGROWBOX HTSIZE
|
||||||
|
#define HTREDUCE HTMINBUTTON
|
||||||
|
#define HTZOOM HTMAXBUTTON
|
||||||
|
|
||||||
|
/* WM_SYSCOMMAND parameters */
|
||||||
|
#define SC_SIZE 0xf000
|
||||||
|
#define SC_MOVE 0xf010
|
||||||
|
#define SC_MINIMIZE 0xf020
|
||||||
|
#define SC_MAXIMIZE 0xf030
|
||||||
|
#define SC_NEXTWINDOW 0xf040
|
||||||
|
#define SC_PREVWINDOW 0xf050
|
||||||
|
#define SC_CLOSE 0xf060
|
||||||
|
#define SC_VSCROLL 0xf070
|
||||||
|
#define SC_HSCROLL 0xf080
|
||||||
|
#define SC_MOUSEMENU 0xf090
|
||||||
|
#define SC_KEYMENU 0xf100
|
||||||
|
#define SC_ARRANGE 0xf110
|
||||||
|
#define SC_RESTORE 0xf120
|
||||||
|
#define SC_TASKLIST 0xf130
|
||||||
|
#define SC_SCREENSAVE 0xf140
|
||||||
|
#define SC_HOTKEY 0xf150
|
||||||
|
|
||||||
/* Dialogs */
|
/* Dialogs */
|
||||||
|
|
||||||
|
@ -794,6 +837,8 @@ typedef METARECORD *PMETARECORD;
|
||||||
#define SM_PENWINDOWS 41
|
#define SM_PENWINDOWS 41
|
||||||
#define SM_DBCSENABLED 42
|
#define SM_DBCSENABLED 42
|
||||||
|
|
||||||
|
#define SM_CMETRICS 43
|
||||||
|
|
||||||
/* Device-independent bitmaps */
|
/* Device-independent bitmaps */
|
||||||
|
|
||||||
typedef struct { BYTE rgbBlue, rgbGreen, rgbRed, rgbReserved; } RGBQUAD;
|
typedef struct { BYTE rgbBlue, rgbGreen, rgbRed, rgbReserved; } RGBQUAD;
|
||||||
|
@ -1058,6 +1103,63 @@ typedef HANDLETABLE *LPHANDLETABLE;
|
||||||
#define IDC_SIZEWE MAKEINTRESOURCE(32544)
|
#define IDC_SIZEWE MAKEINTRESOURCE(32544)
|
||||||
#define IDC_SIZENS MAKEINTRESOURCE(32545)
|
#define IDC_SIZENS MAKEINTRESOURCE(32545)
|
||||||
|
|
||||||
|
/* OEM Resource Ordinal Numbers */
|
||||||
|
#define OBM_CLOSE 32754
|
||||||
|
#define OBM_UPARROW 32753
|
||||||
|
#define OBM_DNARROW 32752
|
||||||
|
#define OBM_RGARROW 32751
|
||||||
|
#define OBM_LFARROW 32750
|
||||||
|
#define OBM_REDUCE 32749
|
||||||
|
#define OBM_ZOOM 32748
|
||||||
|
#define OBM_RESTORE 32747
|
||||||
|
#define OBM_REDUCED 32746
|
||||||
|
#define OBM_ZOOMD 32745
|
||||||
|
#define OBM_RESTORED 32744
|
||||||
|
#define OBM_UPARROWD 32743
|
||||||
|
#define OBM_DNARROWD 32742
|
||||||
|
#define OBM_RGARROWD 32741
|
||||||
|
#define OBM_LFARROWD 32740
|
||||||
|
#define OBM_MNARROW 32739
|
||||||
|
#define OBM_COMBO 32738
|
||||||
|
#define OBM_UPARROWI 32737
|
||||||
|
#define OBM_DNARROWI 32736
|
||||||
|
#define OBM_RGARROWI 32735
|
||||||
|
#define OBM_LFARROWI 32734
|
||||||
|
|
||||||
|
#define OBM_OLD_CLOSE 32767
|
||||||
|
#define OBM_SIZE 32766
|
||||||
|
#define OBM_OLD_UPARROW 32765
|
||||||
|
#define OBM_OLD_DNARROW 32764
|
||||||
|
#define OBM_OLD_RGARROW 32763
|
||||||
|
#define OBM_OLD_LFARROW 32762
|
||||||
|
#define OBM_BTSIZE 32761
|
||||||
|
#define OBM_CHECK 32760
|
||||||
|
#define OBM_CHECKBOXES 32759
|
||||||
|
#define OBM_BTNCORNERS 32758
|
||||||
|
#define OBM_OLD_REDUCE 32757
|
||||||
|
#define OBM_OLD_ZOOM 32756
|
||||||
|
#define OBM_OLD_RESTORE 32755
|
||||||
|
|
||||||
|
#define OCR_NORMAL 32512
|
||||||
|
#define OCR_IBEAM 32513
|
||||||
|
#define OCR_WAIT 32514
|
||||||
|
#define OCR_CROSS 32515
|
||||||
|
#define OCR_UP 32516
|
||||||
|
#define OCR_SIZE 32640
|
||||||
|
#define OCR_ICON 32641
|
||||||
|
#define OCR_SIZENWSE 32642
|
||||||
|
#define OCR_SIZENESW 32643
|
||||||
|
#define OCR_SIZEWE 32644
|
||||||
|
#define OCR_SIZENS 32645
|
||||||
|
#define OCR_SIZEALL 32646
|
||||||
|
#define OCR_ICOCUR 32647
|
||||||
|
|
||||||
|
#define OIC_SAMPLE 32512
|
||||||
|
#define OIC_HAND 32513
|
||||||
|
#define OIC_QUES 32514
|
||||||
|
#define OIC_BANG 32515
|
||||||
|
#define OIC_NOTE 32516
|
||||||
|
|
||||||
/* Stock GDI objects for GetStockObject() */
|
/* Stock GDI objects for GetStockObject() */
|
||||||
|
|
||||||
#define WHITE_BRUSH 0
|
#define WHITE_BRUSH 0
|
||||||
|
@ -1097,10 +1199,25 @@ enum { WM_NULL, WM_CREATE, WM_DESTROY, WM_MOVE, WM_UNUSED0, WM_SIZE, WM_ACTIVATE
|
||||||
|
|
||||||
#define WM_NCCREATE 0x0081
|
#define WM_NCCREATE 0x0081
|
||||||
#define WM_NCDESTROY 0x0082
|
#define WM_NCDESTROY 0x0082
|
||||||
#define WM_NCCALCSIZE 0x0083
|
#define WM_NCCALCSIZE 0x0083
|
||||||
|
#define WM_NCHITTEST 0x0084
|
||||||
|
#define WM_NCPAINT 0x0085
|
||||||
|
#define WM_NCACTIVATE 0x0086
|
||||||
|
|
||||||
#define WM_GETDLGCODE 0x0087
|
#define WM_GETDLGCODE 0x0087
|
||||||
|
|
||||||
|
/* Non-client mouse messages */
|
||||||
|
#define WM_NCMOUSEMOVE 0x00a0
|
||||||
|
#define WM_NCLBUTTONDOWN 0x00a1
|
||||||
|
#define WM_NCLBUTTONUP 0x00a2
|
||||||
|
#define WM_NCLBUTTONDBLCLK 0x00a3
|
||||||
|
#define WM_NCRBUTTONDOWN 0x00a4
|
||||||
|
#define WM_NCRBUTTONUP 0x00a5
|
||||||
|
#define WM_NCRBUTTONDBLCLK 0x00a6
|
||||||
|
#define WM_NCMBUTTONDOWN 0x00a7
|
||||||
|
#define WM_NCMBUTTONUP 0x00a8
|
||||||
|
#define WM_NCMBUTTONDBLCLK 0x00a9
|
||||||
|
|
||||||
/* Keyboard messages */
|
/* Keyboard messages */
|
||||||
#define WM_KEYDOWN 0x0100
|
#define WM_KEYDOWN 0x0100
|
||||||
#define WM_KEYUP 0x0101
|
#define WM_KEYUP 0x0101
|
||||||
|
@ -1115,6 +1232,7 @@ enum { WM_NULL, WM_CREATE, WM_DESTROY, WM_MOVE, WM_UNUSED0, WM_SIZE, WM_ACTIVATE
|
||||||
|
|
||||||
#define WM_INITDIALOG 0x0110
|
#define WM_INITDIALOG 0x0110
|
||||||
#define WM_COMMAND 0x0111
|
#define WM_COMMAND 0x0111
|
||||||
|
#define WM_SYSCOMMAND 0x0112
|
||||||
#define WM_TIMER 0x0113
|
#define WM_TIMER 0x0113
|
||||||
#define WM_SYSTIMER 0x0118
|
#define WM_SYSTIMER 0x0118
|
||||||
|
|
||||||
|
@ -1166,6 +1284,14 @@ enum { WM_NULL, WM_CREATE, WM_DESTROY, WM_MOVE, WM_UNUSED0, WM_SIZE, WM_ACTIVATE
|
||||||
#define PM_REMOVE 0x0001
|
#define PM_REMOVE 0x0001
|
||||||
#define PM_NOYIELD 0x0002
|
#define PM_NOYIELD 0x0002
|
||||||
|
|
||||||
|
#define WM_SHOWWINDOW 0x0018
|
||||||
|
|
||||||
|
/* WM_SHOWWINDOW wParam codes */
|
||||||
|
#define SW_PARENTCLOSING 1
|
||||||
|
#define SW_OTHERMAXIMIZED 2
|
||||||
|
#define SW_PARENTOPENING 3
|
||||||
|
#define SW_OTHERRESTORED 4
|
||||||
|
|
||||||
enum { SW_HIDE, SW_SHOWNORMAL, SW_NORMAL, SW_SHOWMINIMIZED, SW_SHOWMAXIMIZED,
|
enum { SW_HIDE, SW_SHOWNORMAL, SW_NORMAL, SW_SHOWMINIMIZED, SW_SHOWMAXIMIZED,
|
||||||
SW_MAXIMIZE, SW_SHOWNOACTIVATE, SW_SHOW, SW_MINIMIZE,
|
SW_MAXIMIZE, SW_SHOWNOACTIVATE, SW_SHOW, SW_MINIMIZE,
|
||||||
SW_SHOWMINNOACTIVE, SW_SHOWNA, SW_RESTORE };
|
SW_SHOWMINNOACTIVE, SW_SHOWNA, SW_RESTORE };
|
||||||
|
@ -1284,9 +1410,7 @@ enum { SW_HIDE, SW_SHOWNORMAL, SW_NORMAL, SW_SHOWMINIMIZED, SW_SHOWMAXIMIZED,
|
||||||
#define DT_NOPREFIX 2048
|
#define DT_NOPREFIX 2048
|
||||||
#define DT_INTERNAL 4096
|
#define DT_INTERNAL 4096
|
||||||
|
|
||||||
|
/* Window Styles */
|
||||||
|
|
||||||
|
|
||||||
#define WS_OVERLAPPED 0x00000000L
|
#define WS_OVERLAPPED 0x00000000L
|
||||||
#define WS_POPUP 0x80000000L
|
#define WS_POPUP 0x80000000L
|
||||||
#define WS_CHILD 0x40000000L
|
#define WS_CHILD 0x40000000L
|
||||||
|
@ -2022,7 +2146,7 @@ Fa(WORD,GetPolyFillMode,HDC,a)
|
||||||
Fa(WORD,GetRelAbs,HDC,a)
|
Fa(WORD,GetRelAbs,HDC,a)
|
||||||
Fa(WORD,GetROP2,HDC,a)
|
Fa(WORD,GetROP2,HDC,a)
|
||||||
Fa(WORD,GetStretchBltMode,HDC,a)
|
Fa(WORD,GetStretchBltMode,HDC,a)
|
||||||
Fa(int,GetSystemMetrics,short,a)
|
Fa(int,GetSystemMetrics,WORD,a)
|
||||||
Fa(int,GetWindowTextLength,HWND,a)
|
Fa(int,GetWindowTextLength,HWND,a)
|
||||||
Fa(int,RestoreVisRgn,HDC,a)
|
Fa(int,RestoreVisRgn,HDC,a)
|
||||||
Fa(int,SaveDC,HDC,a)
|
Fa(int,SaveDC,HDC,a)
|
||||||
|
@ -2347,7 +2471,7 @@ Fd(int,LoadString,HANDLE,a,WORD,b,LPSTR,c,int,d)
|
||||||
Fd(int,MessageBox,HWND,a,LPSTR,b,LPSTR,c,WORD,d)
|
Fd(int,MessageBox,HWND,a,LPSTR,b,LPSTR,c,WORD,d)
|
||||||
Fd(int,SetScrollPos,HWND,a,int,b,int,c,BOOL,d)
|
Fd(int,SetScrollPos,HWND,a,int,b,int,c,BOOL,d)
|
||||||
Fd(int,SetVoiceNote,int,a,int,b,int,c,int,d)
|
Fd(int,SetVoiceNote,int,a,int,b,int,c,int,d)
|
||||||
Fd(void,AdjustWindowRectEx,LPRECT,a,LONG,b,BOOL,c,DWORD,d)
|
Fd(void,AdjustWindowRectEx,LPRECT,a,DWORD,b,BOOL,c,DWORD,d)
|
||||||
Fd(void,AnimatePalette,HPALETTE,a,WORD,b,WORD,c,LPPALETTEENTRY,d)
|
Fd(void,AnimatePalette,HPALETTE,a,WORD,b,WORD,c,LPPALETTEENTRY,d)
|
||||||
Fd(void,CheckRadioButton,HWND,a,WORD,b,WORD,c,WORD,d)
|
Fd(void,CheckRadioButton,HWND,a,WORD,b,WORD,c,WORD,d)
|
||||||
Fd(void,CreateCaret,HWND,a,HBITMAP,b,short,c,short,d)
|
Fd(void,CreateCaret,HWND,a,HBITMAP,b,short,c,short,d)
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
/* WINEOPTS.H
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef WINEOPTS_H
|
||||||
|
#define WINEOPTS_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
FILE *SpyFp;
|
||||||
|
|
||||||
|
#endif /* WINEOPTS_H */
|
|
@ -153,6 +153,7 @@ FindResourceByNumber(struct resource_nameinfo_s *result_p,
|
||||||
if (read(ResourceFd, &size_shift, sizeof(size_shift)) !=
|
if (read(ResourceFd, &size_shift, sizeof(size_shift)) !=
|
||||||
sizeof(size_shift))
|
sizeof(size_shift))
|
||||||
{
|
{
|
||||||
|
printf("FindResourceByNumber (%s) bad block size !\n", resource_id);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -160,40 +161,38 @@ FindResourceByNumber(struct resource_nameinfo_s *result_p,
|
||||||
* Find resource.
|
* Find resource.
|
||||||
*/
|
*/
|
||||||
typeinfo.type_id = 0xffff;
|
typeinfo.type_id = 0xffff;
|
||||||
while (typeinfo.type_id != 0)
|
while (typeinfo.type_id != 0) {
|
||||||
{
|
|
||||||
if (read(ResourceFd, &typeinfo, sizeof(typeinfo)) !=
|
if (read(ResourceFd, &typeinfo, sizeof(typeinfo)) !=
|
||||||
sizeof(typeinfo))
|
sizeof(typeinfo)) {
|
||||||
{
|
printf("FindResourceByNumber (%X) bad typeinfo size !\n", resource_id);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (typeinfo.type_id != 0)
|
#ifdef DEBUG_RESOURCE
|
||||||
{
|
printf("FindResourceByNumber type=%X count=%d\n",
|
||||||
for (i = 0; i < typeinfo.count; i++)
|
typeinfo.type_id, typeinfo.count);
|
||||||
{
|
|
||||||
if (read(ResourceFd, &nameinfo, sizeof(nameinfo)) !=
|
|
||||||
sizeof(nameinfo))
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(DEBUG_RESOURCE) && defined(VERBOSE_DEBUG)
|
|
||||||
if (type_id == typeinfo.type_id)
|
|
||||||
{
|
|
||||||
printf("FindResource: type id = %d, resource id = %x\n",
|
|
||||||
type_id, nameinfo.id);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
if ((type_id == -1 || typeinfo.type_id == type_id) &&
|
if (typeinfo.type_id == 0) break;
|
||||||
nameinfo.id == resource_id)
|
if (typeinfo.type_id == type_id || type_id == -1) {
|
||||||
{
|
for (i = 0; i < typeinfo.count; i++) {
|
||||||
|
if (read(ResourceFd, &nameinfo, sizeof(nameinfo)) !=
|
||||||
|
sizeof(nameinfo)) {
|
||||||
|
printf("FindResourceByNumber (%X) bad nameinfo size !\n", resource_id);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#ifdef DEBUG_RESOURCE
|
||||||
|
printf("FindResource: search type=%X id=%X // type=%X id=%X\n",
|
||||||
|
type_id, resource_id, typeinfo.type_id, nameinfo.id);
|
||||||
|
#endif
|
||||||
|
if (nameinfo.id == resource_id) {
|
||||||
memcpy(result_p, &nameinfo, sizeof(nameinfo));
|
memcpy(result_p, &nameinfo, sizeof(nameinfo));
|
||||||
return size_shift;
|
return size_shift;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
}
|
lseek(ResourceFd, (typeinfo.count * sizeof(nameinfo)), SEEK_CUR);
|
||||||
|
}
|
||||||
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +242,7 @@ FindResourceByName(struct resource_nameinfo_s *result_p,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#ifdef DEBUG_RESOURCE
|
#ifdef DEBUG_RESOURCE
|
||||||
printf("FindResourceByName typeinfo.type_id=%d type_id=%d\n",
|
printf("FindResourceByName typeinfo.type_id=%X type_id=%X\n",
|
||||||
typeinfo.type_id, type_id);
|
typeinfo.type_id, type_id);
|
||||||
#endif
|
#endif
|
||||||
if (typeinfo.type_id == 0) break;
|
if (typeinfo.type_id == 0) break;
|
||||||
|
@ -269,7 +268,7 @@ FindResourceByName(struct resource_nameinfo_s *result_p,
|
||||||
lseek(ResourceFd, old_pos, SEEK_SET);
|
lseek(ResourceFd, old_pos, SEEK_SET);
|
||||||
name[nbytes] = '\0';
|
name[nbytes] = '\0';
|
||||||
#ifdef DEBUG_RESOURCE
|
#ifdef DEBUG_RESOURCE
|
||||||
printf("FindResourceByName type_id=%d name='%s' resource_name='%s'\n",
|
printf("FindResourceByName type_id=%X name='%s' resource_name='%s'\n",
|
||||||
typeinfo.type_id, name, resource_name);
|
typeinfo.type_id, name, resource_name);
|
||||||
#endif
|
#endif
|
||||||
if (strcasecmp(name, resource_name) == 0)
|
if (strcasecmp(name, resource_name) == 0)
|
||||||
|
@ -281,7 +280,7 @@ FindResourceByName(struct resource_nameinfo_s *result_p,
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
lseek(ResourceFd, (typeinfo.count * sizeof(nameinfo)), SEEK_CUR);
|
lseek(ResourceFd, (typeinfo.count * sizeof(nameinfo)), SEEK_CUR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -681,9 +680,6 @@ LoadBitmap(HANDLE instance, LPSTR bmp_name)
|
||||||
printf("LoadBitmap: instance = %04x, name = %08x\n",
|
printf("LoadBitmap: instance = %04x, name = %08x\n",
|
||||||
instance, bmp_name);
|
instance, bmp_name);
|
||||||
#endif
|
#endif
|
||||||
printf("LoadBitmap: instance = %04x, name = %08x\n",
|
|
||||||
instance, bmp_name);
|
|
||||||
|
|
||||||
if (instance == (HANDLE)NULL) instance = hSysRes;
|
if (instance == (HANDLE)NULL) instance = hSysRes;
|
||||||
if (!(hdc = GetDC(GetDesktopWindow()))) return 0;
|
if (!(hdc = GetDC(GetDesktopWindow()))) return 0;
|
||||||
|
|
||||||
|
@ -706,7 +702,6 @@ printf("before GlobalLock\n");
|
||||||
else if (*lp == sizeof(BITMAPINFOHEADER))
|
else if (*lp == sizeof(BITMAPINFOHEADER))
|
||||||
hbitmap = ConvertInfoBitmap( hdc, (BITMAPINFO *) lp );
|
hbitmap = ConvertInfoBitmap( hdc, (BITMAPINFO *) lp );
|
||||||
else hbitmap = 0;
|
else hbitmap = 0;
|
||||||
printf("LoadBitmap %04X\n", hbitmap);
|
|
||||||
GlobalFree(rsc_mem);
|
GlobalFree(rsc_mem);
|
||||||
ReleaseDC( 0, hdc );
|
ReleaseDC( 0, hdc );
|
||||||
return hbitmap;
|
return hbitmap;
|
||||||
|
|
120
loader/wine.c
120
loader/wine.c
|
@ -21,6 +21,9 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
|
||||||
#include "dlls.h"
|
#include "dlls.h"
|
||||||
#include "wine.h"
|
#include "wine.h"
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
|
#include "wineopts.h"
|
||||||
|
|
||||||
|
/* #define DEBUG_FIXUP */
|
||||||
|
|
||||||
extern int CallToInit16(unsigned long csip, unsigned long sssp,
|
extern int CallToInit16(unsigned long csip, unsigned long sssp,
|
||||||
unsigned short ds);
|
unsigned short ds);
|
||||||
|
@ -46,6 +49,8 @@ HINSTANCE hSysRes;
|
||||||
static char *Extensions[] = { "dll", "exe", NULL };
|
static char *Extensions[] = { "dll", "exe", NULL };
|
||||||
static char *WinePath = NULL;
|
static char *WinePath = NULL;
|
||||||
|
|
||||||
|
FILE *SpyFp = NULL;
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* DebugPrintString
|
* DebugPrintString
|
||||||
*/
|
*/
|
||||||
|
@ -110,6 +115,19 @@ HINSTANCE LoadImage(char *modulename)
|
||||||
unsigned int status;
|
unsigned int status;
|
||||||
char buffer[256];
|
char buffer[256];
|
||||||
|
|
||||||
|
/*
|
||||||
|
* search file
|
||||||
|
*/
|
||||||
|
if (FindFile(buffer, sizeof(buffer), modulename, Extensions, WindowsPath)
|
||||||
|
==NULL)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
fprintf(stderr,"LoadImage: I can't find %s !\n",modulename);
|
||||||
|
return (HINSTANCE) NULL;
|
||||||
|
}
|
||||||
|
fprintf(stderr,"LoadImage: loading %s (%s)\n", modulename, buffer);
|
||||||
|
|
||||||
/* First allocate a spot to store the info we collect, and add it to
|
/* First allocate a spot to store the info we collect, and add it to
|
||||||
* our linked list.
|
* our linked list.
|
||||||
*/
|
*/
|
||||||
|
@ -124,20 +142,6 @@ HINSTANCE LoadImage(char *modulename)
|
||||||
};
|
};
|
||||||
wpnt->next = NULL;
|
wpnt->next = NULL;
|
||||||
|
|
||||||
/*
|
|
||||||
* search file
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (FindFile(buffer, sizeof(buffer), modulename, Extensions, WindowsPath)
|
|
||||||
==NULL)
|
|
||||||
{
|
|
||||||
char temp[256];
|
|
||||||
|
|
||||||
sprintf(temp,"LoadImage: I can't find %s !\n",modulename);
|
|
||||||
myerror(temp);
|
|
||||||
}
|
|
||||||
fprintf(stderr,"LoadImage: loading %s (%s)\n", modulename, buffer);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open file for reading.
|
* Open file for reading.
|
||||||
*/
|
*/
|
||||||
|
@ -251,6 +255,31 @@ HINSTANCE LoadImage(char *modulename)
|
||||||
return(wpnt->hinstance);
|
return(wpnt->hinstance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* ParseArgs
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
ParseArgs(int argc, char **argv)
|
||||||
|
{
|
||||||
|
if (argc < 2)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "usage: %s [-spy FILENAME] FILENAME\n", argv[0]);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
Argc = argc - 1;
|
||||||
|
|
||||||
|
for (Argv = argv + 1; **Argv == '-' && Argc > 0; Argv++)
|
||||||
|
{
|
||||||
|
if (strcmp(*Argv, "-spy") == 0)
|
||||||
|
{
|
||||||
|
if (strcmp(*(++Argv), "-") == 0)
|
||||||
|
SpyFp = stdout;
|
||||||
|
else
|
||||||
|
SpyFp = fopen(*Argv, "a");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* main
|
* main
|
||||||
|
@ -260,6 +289,7 @@ _WinMain(int argc, char **argv)
|
||||||
int segment;
|
int segment;
|
||||||
char *p;
|
char *p;
|
||||||
char *sysresname;
|
char *sysresname;
|
||||||
|
char filename[100];
|
||||||
char syspath[256];
|
char syspath[256];
|
||||||
char exe_path[256];
|
char exe_path[256];
|
||||||
#ifdef WINESTAT
|
#ifdef WINESTAT
|
||||||
|
@ -269,15 +299,8 @@ _WinMain(int argc, char **argv)
|
||||||
int cs_reg, ds_reg, ss_reg, ip_reg, sp_reg;
|
int cs_reg, ds_reg, ss_reg, ip_reg, sp_reg;
|
||||||
int i;
|
int i;
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
Argc = argc - 1;
|
ParseArgs(argc, argv);
|
||||||
Argv = argv + 1;
|
|
||||||
|
|
||||||
if (argc < 2)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "usage: %s FILENAME\n", argv[0]);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
p = getenv("WINEPATH");
|
p = getenv("WINEPATH");
|
||||||
WinePath = malloc(256 + strlen(p));
|
WinePath = malloc(256 + strlen(p));
|
||||||
|
@ -285,27 +308,17 @@ _WinMain(int argc, char **argv)
|
||||||
strcat(WinePath, ";");
|
strcat(WinePath, ";");
|
||||||
strcat(WinePath, p);
|
strcat(WinePath, p);
|
||||||
|
|
||||||
LoadImage(argv[1]);
|
LoadImage(Argv[0]);
|
||||||
hSysRes = LoadImage("sysres.dll");
|
|
||||||
|
GetPrivateProfileString("wine", "SystemResources", "sysres.dll",
|
||||||
|
filename, sizeof(filename),
|
||||||
|
WINE_INI);
|
||||||
|
hSysRes = LoadImage(filename);
|
||||||
if (hSysRes == (HINSTANCE)NULL)
|
if (hSysRes == (HINSTANCE)NULL)
|
||||||
printf("Error Loading System Resources !!!\n");
|
printf("Error Loading System Resources !!!\n");
|
||||||
else
|
else
|
||||||
printf("System Resources Loaded // hSysRes='%04X'\n", hSysRes);
|
printf("System Resources Loaded // hSysRes='%04X'\n", hSysRes);
|
||||||
|
|
||||||
if(ran_out) exit(1);
|
|
||||||
#ifdef DEBUG
|
|
||||||
{
|
|
||||||
int dummy1, dummy2;
|
|
||||||
|
|
||||||
GetEntryDLLName("USER", "INITAPP", &dummy1, &dummy2);
|
|
||||||
}
|
|
||||||
for(i=0; i<1024; i++) {
|
|
||||||
int j;
|
|
||||||
j = GetEntryPointFromOrdinal(wine_files, i);
|
|
||||||
if(j == 0) break;
|
|
||||||
fprintf(stderr," %d %x\n", i, j);
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
* Fixup references.
|
* Fixup references.
|
||||||
*/
|
*/
|
||||||
|
@ -442,8 +455,10 @@ FixupSegment(struct w_files * wpnt, int segment_num)
|
||||||
seg = &seg_table[segment_num];
|
seg = &seg_table[segment_num];
|
||||||
sel = &selector_table[segment_num];
|
sel = &selector_table[segment_num];
|
||||||
|
|
||||||
fprintf(stderr, "Segment fixups for %s, segment %d, selector %x\n",
|
#ifdef DEBUG_FIXUP
|
||||||
wpnt->name, segment_num, (int) sel->base_addr >> 16);
|
printf("Segment fixups for %s, segment %d, selector %x\n",
|
||||||
|
wpnt->name, segment_num, (int) sel->base_addr >> 16);
|
||||||
|
#endif
|
||||||
|
|
||||||
if ((seg->seg_data_offset == 0) ||
|
if ((seg->seg_data_offset == 0) ||
|
||||||
!(seg->seg_flags & NE_SEGFLAGS_RELOC_DATA))
|
!(seg->seg_flags & NE_SEGFLAGS_RELOC_DATA))
|
||||||
|
@ -589,13 +604,6 @@ FixupSegment(struct w_files * wpnt, int segment_num)
|
||||||
rep->target1, rep->target2);
|
rep->target1, rep->target2);
|
||||||
free(rep1);
|
free(rep1);
|
||||||
return -1;
|
return -1;
|
||||||
#if 0
|
|
||||||
sp = (unsigned short *) ((char *) sel->base_addr + rep->offset);
|
|
||||||
fprintf(stderr, " FIXUP ADDRESS %04.4x:%04.4x\n",
|
|
||||||
(int) sel->base_addr >> 16, rep->offset);
|
|
||||||
WineForceFail = 1;
|
|
||||||
continue;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -619,6 +627,10 @@ FixupSegment(struct w_files * wpnt, int segment_num)
|
||||||
{
|
{
|
||||||
case NE_RADDR_OFFSET16:
|
case NE_RADDR_OFFSET16:
|
||||||
do {
|
do {
|
||||||
|
#ifdef DEBUG_FIXUP
|
||||||
|
printf(" %04.4x:%04.4x:%04.4x OFFSET16\n",
|
||||||
|
(unsigned long) sp >> 16, (int) sp & 0xFFFF, *sp);
|
||||||
|
#endif
|
||||||
next_addr = *sp;
|
next_addr = *sp;
|
||||||
*sp = (unsigned short) address;
|
*sp = (unsigned short) address;
|
||||||
if (additive == 2)
|
if (additive == 2)
|
||||||
|
@ -631,6 +643,10 @@ FixupSegment(struct w_files * wpnt, int segment_num)
|
||||||
|
|
||||||
case NE_RADDR_POINTER32:
|
case NE_RADDR_POINTER32:
|
||||||
do {
|
do {
|
||||||
|
#ifdef DEBUG_FIXUP
|
||||||
|
printf(" %04.4x:%04.4x:%04.4x POINTER32\n",
|
||||||
|
(unsigned long) sp >> 16, (int) sp & 0xFFFF, *sp);
|
||||||
|
#endif
|
||||||
next_addr = *sp;
|
next_addr = *sp;
|
||||||
*sp = (unsigned short) address;
|
*sp = (unsigned short) address;
|
||||||
if (additive == 2)
|
if (additive == 2)
|
||||||
|
@ -644,11 +660,15 @@ FixupSegment(struct w_files * wpnt, int segment_num)
|
||||||
|
|
||||||
case NE_RADDR_SELECTOR:
|
case NE_RADDR_SELECTOR:
|
||||||
do {
|
do {
|
||||||
|
#ifdef DEBUG_FIXUP
|
||||||
|
printf(" %04.4x:%04.4x:%04.4x SELECTOR\n",
|
||||||
|
(unsigned long) sp >> 16, (int) sp & 0xFFFF, *sp);
|
||||||
|
#endif
|
||||||
next_addr = *sp;
|
next_addr = *sp;
|
||||||
*sp = (unsigned short) selector;
|
*sp = (unsigned short) selector;
|
||||||
sp = (unsigned short *) ((char *) sel->base_addr + next_addr);
|
sp = (unsigned short *) ((char *) sel->base_addr + next_addr);
|
||||||
if (rep->relocation_type == NE_RELTYPE_INT1) break;
|
if (rep->relocation_type == NE_RELTYPE_INT1)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
while (next_addr != 0xffff && !additive);
|
while (next_addr != 0xffff && !additive);
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
* integer atoms, use the "#1234" form.
|
* integer atoms, use the "#1234" form.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -90,7 +91,7 @@ static WORD ATOM_Hash( WORD entries, LPCSTR str, WORD len )
|
||||||
{
|
{
|
||||||
WORD i, hash = 0;
|
WORD i, hash = 0;
|
||||||
|
|
||||||
for (i = 0; i < len; i++) hash ^= str[i] + i;
|
for (i = 0; i < len; i++) hash ^= toupper(str[i]) + i;
|
||||||
return hash % entries;
|
return hash % entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ CFLAGS=$(COPTS) $(DEBUGOPTS) -I../include
|
||||||
|
|
||||||
OBJS=kernel.o user.o xt.o rect.o file.o sound.o emulate.o \
|
OBJS=kernel.o user.o xt.o rect.o file.o sound.o emulate.o \
|
||||||
keyboard.o profile.o lstr.o exec.o message.o int1a.o int21.o \
|
keyboard.o profile.o lstr.o exec.o message.o int1a.o int21.o \
|
||||||
dos_fs.o comm.o
|
dos_fs.o comm.o spy.o
|
||||||
|
|
||||||
default: misc.o
|
default: misc.o
|
||||||
|
|
||||||
|
|
|
@ -661,7 +661,7 @@ char *WineIniFileName(void)
|
||||||
|
|
||||||
char *WinIniFileName()
|
char *WinIniFileName()
|
||||||
{
|
{
|
||||||
char name[256];
|
static char name[256];
|
||||||
|
|
||||||
strcpy(name,GetDirectUnixFileName(WindowsDirectory));
|
strcpy(name,GetDirectUnixFileName(WindowsDirectory));
|
||||||
strcat(name,"win.ini");
|
strcat(name,"win.ini");
|
||||||
|
|
|
@ -52,7 +52,7 @@ LPSTR lstrcpyn(LPSTR target,LPCSTR source,int n)
|
||||||
/* KERNEL.90 */
|
/* KERNEL.90 */
|
||||||
int lstrlen(LPCSTR str)
|
int lstrlen(LPCSTR str)
|
||||||
{
|
{
|
||||||
strlen(str);
|
return strlen(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* AnsiUpper USER.431 */
|
/* AnsiUpper USER.431 */
|
||||||
|
|
|
@ -125,7 +125,7 @@ static TSecHeader *load (char *file)
|
||||||
if (c == ' ' || c == '\t')
|
if (c == ' ' || c == '\t')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (c == '\n' || overflow) /* Abort Definition */
|
if (c == '\n' || c == ';' || overflow) /* Abort Definition */
|
||||||
next = CharBuffer;
|
next = CharBuffer;
|
||||||
|
|
||||||
if (c == '=' || overflow){
|
if (c == '=' || overflow){
|
||||||
|
|
|
@ -152,8 +152,12 @@ BOOL SubtractRect( LPRECT dest, LPRECT src1, LPRECT src2 )
|
||||||
*dest = *src1;
|
*dest = *src1;
|
||||||
if (IntersectRect( &tmp, src1, src2 ))
|
if (IntersectRect( &tmp, src1, src2 ))
|
||||||
{
|
{
|
||||||
if (EqualRect( &tmp, dest )) SetRectEmpty( src1 );
|
if (EqualRect( &tmp, dest ))
|
||||||
else if ((tmp.top == dest->top) && (tmp.bottom == dest->bottom))
|
{
|
||||||
|
SetRectEmpty( dest );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if ((tmp.top == dest->top) && (tmp.bottom == dest->bottom))
|
||||||
{
|
{
|
||||||
if (tmp.left == dest->left) dest->right = tmp.right;
|
if (tmp.left == dest->left) dest->right = tmp.right;
|
||||||
else if (tmp.right == dest->right) dest->left = tmp.left;
|
else if (tmp.right == dest->right) dest->left = tmp.left;
|
||||||
|
|
|
@ -0,0 +1,257 @@
|
||||||
|
/* SPY.C
|
||||||
|
*
|
||||||
|
* Copyright 1994, Bob Amstadt
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "wineopts.h"
|
||||||
|
#include "windows.h"
|
||||||
|
#include "wine.h"
|
||||||
|
|
||||||
|
#ifndef NOSPY
|
||||||
|
|
||||||
|
#define SPY_MAX_MSGNUM 0x0210
|
||||||
|
|
||||||
|
const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] =
|
||||||
|
{
|
||||||
|
"WM_NULL", /* 0x00 */
|
||||||
|
"WM_CREATE",
|
||||||
|
"WM_DESTROY",
|
||||||
|
"WM_MOVE",
|
||||||
|
"WM_UNUSED0",
|
||||||
|
"WM_SIZE",
|
||||||
|
"WM_ACTIVATE",
|
||||||
|
"WM_SETFOCUS",
|
||||||
|
"WM_KILLFOCUS",
|
||||||
|
"WM_UNUSED1",
|
||||||
|
"WM_ENABLE",
|
||||||
|
"WM_SETREDRAW",
|
||||||
|
"WM_SETTEXT",
|
||||||
|
"WM_GETTEXT",
|
||||||
|
"WM_GETTEXTLENGTH",
|
||||||
|
"WM_PAINT",
|
||||||
|
"WM_CLOSE", /* 0x10 */
|
||||||
|
"WM_QUERYENDSESSION",
|
||||||
|
"WM_QUIT",
|
||||||
|
"WM_QUERYOPEN",
|
||||||
|
"WM_ERASEBKGND",
|
||||||
|
"WM_SYSCOLORCHANGE",
|
||||||
|
"WM_ENDSESSION",
|
||||||
|
"WM_UNUSED2",
|
||||||
|
"WM_SHOWWINDOW",
|
||||||
|
"WM_CTLCOLOR",
|
||||||
|
"WM_WININICHANGE",
|
||||||
|
"WM_DEVMODECHANGE",
|
||||||
|
"WM_ACTIVATEAPP",
|
||||||
|
"WM_FONTCHANGE",
|
||||||
|
"WM_TIMECHANGE",
|
||||||
|
"WM_CANCELMODE",
|
||||||
|
"WM_SETCURSOR", /* 0x20 */
|
||||||
|
"WM_MOUSEACTIVATE",
|
||||||
|
"WM_CHILDACTIVATE",
|
||||||
|
"WM_QUEUESYNC",
|
||||||
|
"WM_GETMINMAXINFO",
|
||||||
|
"WM_UNUSED3",
|
||||||
|
"WM_PAINTICON",
|
||||||
|
"WM_ICONERASEBKGND",
|
||||||
|
"WM_NEXTDLGCTL",
|
||||||
|
"WM_UNUSED4",
|
||||||
|
"WM_SPOOLERSTATUS",
|
||||||
|
"WM_DRAWITEM",
|
||||||
|
"WM_MEASUREITEM",
|
||||||
|
"WM_DELETEITEM",
|
||||||
|
"WM_VKEYTOITEM",
|
||||||
|
"WM_CHARTOITEM",
|
||||||
|
"WM_SETFONT", /* 0x30 */
|
||||||
|
"WM_GETFONT", NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x40 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
"WM_WINDOWPOSCHANGING", /* 0x0046 */
|
||||||
|
"WM_WINDOWPOSCHANGED", /* 0x0047 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x0050 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x0060 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x0070 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
NULL, /* 0x0080 */
|
||||||
|
"WM_NCCREATE", /* 0x0081 */
|
||||||
|
"WM_NCDESTROY", /* 0x0082 */
|
||||||
|
"WM_NCCALCSIZE", /* 0x0083 */
|
||||||
|
NULL, NULL, NULL,
|
||||||
|
"WM_GETDLGCODE", /* 0x0087 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x0090 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x00A0 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x00B0 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x00C0 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x00D0 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x00E0 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x00F0 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
"WM_KEYDOWN", /* 0x0100 */
|
||||||
|
"WM_KEYUP", /* 0x0101 */
|
||||||
|
"WM_CHAR", /* 0x0102 */
|
||||||
|
"WM_DEADCHAR", /* 0x0103 */
|
||||||
|
"WM_SYSKEYDOWN", /* 0x0104 */
|
||||||
|
"WM_SYSKEYUP", /* 0x0105 */
|
||||||
|
"WM_SYSCHAR", /* 0x0106 */
|
||||||
|
"WM_SYSDEADCHAR", /* 0x0107 */
|
||||||
|
"WM_KEYLAST", /* 0x0108 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
"WM_INITDIALOG", /* 0x0110 */
|
||||||
|
"WM_COMMAND", /* 0x0111 */
|
||||||
|
NULL,
|
||||||
|
"WM_TIMER", /* 0x0113 */
|
||||||
|
"WM_HSCROLL", /* 0x0114 */
|
||||||
|
"WM_VSCROLL", /* 0x0115 */
|
||||||
|
NULL, NULL,
|
||||||
|
"WM_SYSTIMER", /* 0x0118 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x0120 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x0130 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x0140 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x0150 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x0160 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x0170 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x0180 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x0190 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x01A0 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x01B0 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x01C0 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x01D0 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x01E0 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
/* 0x01F0 */
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
|
||||||
|
"WM_MOUSEMOVE", /* 0x0200 */
|
||||||
|
"WM_LBUTTONDOWN", /* 0x0201 */
|
||||||
|
"WM_LBUTTONUP", /* 0x0202 */
|
||||||
|
"WM_LBUTTONDBLCLK", /* 0x0203 */
|
||||||
|
"WM_RBUTTONDOWN", /* 0x0204 */
|
||||||
|
"WM_RBUTTONUP", /* 0x0205 */
|
||||||
|
"WM_RBUTTONDBLCLK", /* 0x0206 */
|
||||||
|
"WM_MBUTTONDOWN", /* 0x0207 */
|
||||||
|
"WM_MBUTTONUP", /* 0x0208 */
|
||||||
|
"WM_MBUTTONDBLCLK", /* 0x0209 */
|
||||||
|
"WM_PARENTNOTIFY", /* 0x0210 */
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* NOSPY */
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* SpyMessage
|
||||||
|
*/
|
||||||
|
void SpyMessage(HWND hwnd, WORD msg, WORD wParam, LONG lParam)
|
||||||
|
{
|
||||||
|
#ifndef NOSPY
|
||||||
|
if (SpyFp == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (msg > SPY_MAX_MSGNUM || MessageTypeNames[msg] == NULL)
|
||||||
|
{
|
||||||
|
fprintf(SpyFp, "%04.4x %04.4x %04.4x %08.8x\n",
|
||||||
|
hwnd, msg, wParam, lParam);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fprintf(SpyFp, "%04.4x %20.20s %04.4x %08.8x\n",
|
||||||
|
hwnd, MessageTypeNames[msg], wParam, lParam);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* SpyInit
|
||||||
|
*/
|
||||||
|
void SpyInit(void)
|
||||||
|
{
|
||||||
|
char filename[100];
|
||||||
|
|
||||||
|
if (SpyFp == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
GetPrivateProfileString("spy", "file", "", filename, sizeof(filename),
|
||||||
|
WINE_INI);
|
||||||
|
|
||||||
|
if (strcasecmp(filename, "CON") == 0)
|
||||||
|
SpyFp = stdout;
|
||||||
|
else if (strlen(filename))
|
||||||
|
SpyFp = fopen(filename, "a");
|
||||||
|
else
|
||||||
|
SpyFp = NULL;
|
||||||
|
}
|
|
@ -16,6 +16,7 @@ MDESC *USER_Heap = NULL;
|
||||||
|
|
||||||
extern BOOL ATOM_Init();
|
extern BOOL ATOM_Init();
|
||||||
extern BOOL GDI_Init();
|
extern BOOL GDI_Init();
|
||||||
|
extern void SYSMETRICS_Init();
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* USER_HeapInit
|
* USER_HeapInit
|
||||||
|
@ -40,13 +41,16 @@ USER_InitApp(int hInstance)
|
||||||
{
|
{
|
||||||
int queueSize;
|
int queueSize;
|
||||||
|
|
||||||
|
SpyInit();
|
||||||
|
|
||||||
/* Global atom table initialisation */
|
/* Global atom table initialisation */
|
||||||
if (!ATOM_Init()) return 0;
|
if (!ATOM_Init()) return 0;
|
||||||
|
|
||||||
/* GDI initialisation */
|
/* GDI initialisation */
|
||||||
if (!GDI_Init()) return 0;
|
if (!GDI_Init()) return 0;
|
||||||
|
|
||||||
/* Initialize system colors */
|
/* Initialize system colors and metrics*/
|
||||||
|
SYSMETRICS_Init();
|
||||||
SYSCOLOR_Init();
|
SYSCOLOR_Init();
|
||||||
|
|
||||||
/* Create USER heap */
|
/* Create USER heap */
|
||||||
|
|
33
misc/xt.c
33
misc/xt.c
|
@ -22,6 +22,8 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
||||||
|
|
||||||
Display * XT_display;
|
Display * XT_display;
|
||||||
Screen * XT_screen;
|
Screen * XT_screen;
|
||||||
|
Display * display;
|
||||||
|
Screen * screen;
|
||||||
XtAppContext XT_app_context;
|
XtAppContext XT_app_context;
|
||||||
|
|
||||||
static Widget topLevelWidget;
|
static Widget topLevelWidget;
|
||||||
|
@ -40,6 +42,8 @@ void main(int argc, char **argv)
|
||||||
NULL );
|
NULL );
|
||||||
XT_display = XtDisplay( topLevelWidget );
|
XT_display = XtDisplay( topLevelWidget );
|
||||||
XT_screen = XtScreen( topLevelWidget );
|
XT_screen = XtScreen( topLevelWidget );
|
||||||
|
display = XtDisplay( topLevelWidget );
|
||||||
|
screen = XtScreen( topLevelWidget );
|
||||||
|
|
||||||
DOS_InitFS();
|
DOS_InitFS();
|
||||||
Comm_Init();
|
Comm_Init();
|
||||||
|
@ -68,32 +72,3 @@ DWORD GetTickCount()
|
||||||
struct tms dummy;
|
struct tms dummy;
|
||||||
return (times(&dummy) * 1000) / HZ;
|
return (times(&dummy) * 1000) / HZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int GetSystemMetrics( short index )
|
|
||||||
{
|
|
||||||
printf( "GetSystemMetrics: %d\n", index );
|
|
||||||
switch(index)
|
|
||||||
{
|
|
||||||
case SM_CXSCREEN:
|
|
||||||
return DisplayWidth( XT_display, DefaultScreen( XT_display ));
|
|
||||||
|
|
||||||
case SM_CYSCREEN:
|
|
||||||
return DisplayHeight( XT_display, DefaultScreen( XT_display ));
|
|
||||||
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AdjustWindowRect( LPRECT rect, DWORD style, BOOL menu )
|
|
||||||
{
|
|
||||||
printf( "AdjustWindowRect: (%d,%d)-(%d,%d) %d %d\n", rect->left, rect->top,
|
|
||||||
rect->right, rect->bottom, style, menu );
|
|
||||||
#ifdef USE_XLIB
|
|
||||||
rect->right += 8;
|
|
||||||
rect->bottom += 34;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,6 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
||||||
|
|
||||||
#include "gdi.h"
|
#include "gdi.h"
|
||||||
|
|
||||||
extern Display * XT_display;
|
|
||||||
extern Screen * XT_screen;
|
|
||||||
|
|
||||||
#define NB_HATCH_STYLES 6
|
#define NB_HATCH_STYLES 6
|
||||||
|
|
||||||
|
|
|
@ -20,15 +20,22 @@ void CLIPPING_SetDeviceClipping( DC * dc )
|
||||||
if (dc->w.hGCClipRgn)
|
if (dc->w.hGCClipRgn)
|
||||||
{
|
{
|
||||||
RGNOBJ *obj = (RGNOBJ *) GDI_GetObjPtr(dc->w.hGCClipRgn, REGION_MAGIC);
|
RGNOBJ *obj = (RGNOBJ *) GDI_GetObjPtr(dc->w.hGCClipRgn, REGION_MAGIC);
|
||||||
XSetClipMask( XT_display, dc->u.x.gc, obj->region.pixmap );
|
if (obj->region.pixmap)
|
||||||
XSetClipOrigin( XT_display, dc->u.x.gc,
|
{
|
||||||
dc->w.DCOrgX + obj->region.box.left,
|
XSetClipMask( display, dc->u.x.gc, obj->region.pixmap );
|
||||||
dc->w.DCOrgY + obj->region.box.top );
|
XSetClipOrigin( display, dc->u.x.gc,
|
||||||
|
dc->w.DCOrgX + obj->region.box.left,
|
||||||
|
dc->w.DCOrgY + obj->region.box.top );
|
||||||
|
}
|
||||||
|
else /* Clip everything */
|
||||||
|
{
|
||||||
|
XSetClipRectangles( display, dc->u.x.gc, 0, 0, NULL, 0, 0 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
XSetClipMask( XT_display, dc->u.x.gc, None );
|
XSetClipMask( display, dc->u.x.gc, None );
|
||||||
XSetClipOrigin( XT_display, dc->u.x.gc, dc->w.DCOrgX, dc->w.DCOrgY );
|
XSetClipOrigin( display, dc->u.x.gc, dc->w.DCOrgX, dc->w.DCOrgY );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ XImage * DIB_DIBmpToImage( BITMAPINFOHEADER * bmp, void * bmpData )
|
||||||
XImage * image;
|
XImage * image;
|
||||||
int bytesPerLine = (bmp->biWidth * bmp->biBitCount + 31) / 32 * 4;
|
int bytesPerLine = (bmp->biWidth * bmp->biBitCount + 31) / 32 * 4;
|
||||||
|
|
||||||
image = XCreateImage( XT_display, DefaultVisualOfScreen( XT_screen ),
|
image = XCreateImage( display, DefaultVisualOfScreen( screen ),
|
||||||
bmp->biBitCount, ZPixmap, 0, bmpData,
|
bmp->biBitCount, ZPixmap, 0, bmpData,
|
||||||
bmp->biWidth, bmp->biHeight, 32, bytesPerLine );
|
bmp->biWidth, bmp->biHeight, 32, bytesPerLine );
|
||||||
if (!image) return 0;
|
if (!image) return 0;
|
||||||
|
|
|
@ -11,9 +11,6 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include "gdi.h"
|
#include "gdi.h"
|
||||||
|
|
||||||
extern Display * XT_display;
|
|
||||||
extern Screen * XT_screen;
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* FONT_MatchFont
|
* FONT_MatchFont
|
||||||
|
|
|
@ -8,8 +8,6 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
||||||
|
|
||||||
#include "gdi.h"
|
#include "gdi.h"
|
||||||
|
|
||||||
extern Display * XT_display;
|
|
||||||
extern Screen * XT_screen;
|
|
||||||
|
|
||||||
MDESC *GDI_Heap = NULL;
|
MDESC *GDI_Heap = NULL;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
static char Copyright[] = "Copyright Bob Amstadt, 1993";
|
static char Copyright[] = "Copyright Bob Amstadt, 1993";
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "win.h"
|
#include "windows.h"
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* LineDDA (GDI.100)
|
* LineDDA (GDI.100)
|
||||||
|
|
|
@ -18,9 +18,6 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
||||||
|
|
||||||
#include "gdi.h"
|
#include "gdi.h"
|
||||||
|
|
||||||
extern Display * XT_display;
|
|
||||||
extern Screen * XT_screen;
|
|
||||||
|
|
||||||
extern Colormap COLOR_WinColormap;
|
extern Colormap COLOR_WinColormap;
|
||||||
|
|
||||||
GDIOBJHDR * PALETTE_systemPalette;
|
GDIOBJHDR * PALETTE_systemPalette;
|
||||||
|
@ -36,7 +33,7 @@ BOOL PALETTE_Init()
|
||||||
HPALETTE hpalette;
|
HPALETTE hpalette;
|
||||||
LOGPALETTE * palPtr;
|
LOGPALETTE * palPtr;
|
||||||
|
|
||||||
size = DefaultVisual( XT_display, DefaultScreen(XT_display) )->map_entries;
|
size = DefaultVisual( display, DefaultScreen(display) )->map_entries;
|
||||||
palPtr = malloc( sizeof(LOGPALETTE) + (size-1)*sizeof(PALETTEENTRY) );
|
palPtr = malloc( sizeof(LOGPALETTE) + (size-1)*sizeof(PALETTEENTRY) );
|
||||||
if (!palPtr) return FALSE;
|
if (!palPtr) return FALSE;
|
||||||
palPtr->palVersion = 0x300;
|
palPtr->palVersion = 0x300;
|
||||||
|
@ -46,7 +43,7 @@ BOOL PALETTE_Init()
|
||||||
for (i = 0; i < size; i++)
|
for (i = 0; i < size; i++)
|
||||||
{
|
{
|
||||||
color.pixel = i;
|
color.pixel = i;
|
||||||
XQueryColor( XT_display, COLOR_WinColormap, &color );
|
XQueryColor( display, COLOR_WinColormap, &color );
|
||||||
palPtr->palPalEntry[i].peRed = color.red >> 8;
|
palPtr->palPalEntry[i].peRed = color.red >> 8;
|
||||||
palPtr->palPalEntry[i].peGreen = color.green >> 8;
|
palPtr->palPalEntry[i].peGreen = color.green >> 8;
|
||||||
palPtr->palPalEntry[i].peBlue = color.blue >> 8;
|
palPtr->palPalEntry[i].peBlue = color.blue >> 8;
|
||||||
|
@ -132,7 +129,7 @@ WORD GetNearestPaletteIndex( HPALETTE hpalette, COLORREF color )
|
||||||
palPtr = (PALETTEOBJ *) GDI_GetObjPtr( hpalette, PALETTE_MAGIC );
|
palPtr = (PALETTEOBJ *) GDI_GetObjPtr( hpalette, PALETTE_MAGIC );
|
||||||
if (!palPtr) return 0;
|
if (!palPtr) return 0;
|
||||||
|
|
||||||
if ((COLOR_WinColormap != DefaultColormapOfScreen(XT_screen)) &&
|
if ((COLOR_WinColormap != DefaultColormapOfScreen(screen)) &&
|
||||||
(hpalette == STOCK_DEFAULT_PALETTE))
|
(hpalette == STOCK_DEFAULT_PALETTE))
|
||||||
{
|
{
|
||||||
if ((color & 0xffffff) == 0) return 0; /* Entry 0 is black */
|
if ((color & 0xffffff) == 0) return 0; /* Entry 0 is black */
|
||||||
|
|
|
@ -8,9 +8,6 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
||||||
|
|
||||||
#include "gdi.h"
|
#include "gdi.h"
|
||||||
|
|
||||||
extern Display * XT_display;
|
|
||||||
extern Screen * XT_screen;
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* CreatePen (GDI.61)
|
* CreatePen (GDI.61)
|
||||||
|
|
|
@ -6,15 +6,8 @@
|
||||||
|
|
||||||
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
||||||
|
|
||||||
#include <X11/Intrinsic.h>
|
|
||||||
#include <X11/StringDefs.h>
|
|
||||||
#include <X11/Core.h>
|
|
||||||
#include <X11/Shell.h>
|
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
|
|
||||||
#include "message.h"
|
|
||||||
#include "callback.h"
|
|
||||||
#include "win.h"
|
|
||||||
#include "gdi.h"
|
#include "gdi.h"
|
||||||
|
|
||||||
#define TAB 9
|
#define TAB 9
|
||||||
|
@ -224,8 +217,8 @@ int DrawText( HDC hdc, LPSTR str, int count, LPRECT rect, WORD flags )
|
||||||
|
|
||||||
if (flags & DT_SINGLELINE)
|
if (flags & DT_SINGLELINE)
|
||||||
{
|
{
|
||||||
if (flags & DT_VCENTER) y = (rect->top + rect->bottom -
|
if (flags & DT_VCENTER) y = rect->top +
|
||||||
size.cy) / 2;
|
(rect->bottom - rect->top) / 2 - size.cy / 2;
|
||||||
else if (flags & DT_BOTTOM) y = rect->bottom - size.cy;
|
else if (flags & DT_BOTTOM) y = rect->bottom - size.cy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
BIN
sysres.dll
BIN
sysres.dll
Binary file not shown.
BIN
test/widget.exe
BIN
test/widget.exe
Binary file not shown.
|
@ -2,7 +2,8 @@ CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
|
||||||
|
|
||||||
OBJS=class.o dc.o dce.o event.o message.o win.o timer.o graphics.o \
|
OBJS=class.o dc.o dce.o event.o message.o win.o timer.o graphics.o \
|
||||||
clipping.o mapping.o painting.o keyboard.o utility.o syscolor.o \
|
clipping.o mapping.o painting.o keyboard.o utility.o syscolor.o \
|
||||||
defwnd.o defdlg.o dialog.o focus.o scroll.o caret.o winpos.o
|
defwnd.o defdlg.o dialog.o focus.o scroll.o caret.o winpos.o \
|
||||||
|
sysmetrics.o nonclient.o
|
||||||
|
|
||||||
default: windows.o
|
default: windows.o
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,8 @@
|
||||||
|
|
||||||
static char Copyright[] = "Copyright David Metcalfe, 1993";
|
static char Copyright[] = "Copyright David Metcalfe, 1993";
|
||||||
|
|
||||||
#include <X11/Intrinsic.h>
|
|
||||||
|
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
|
|
||||||
extern XtAppContext XT_app_context;
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
|
@ -23,49 +19,46 @@ typedef struct
|
||||||
short height;
|
short height;
|
||||||
COLORREF color;
|
COLORREF color;
|
||||||
WORD timeout;
|
WORD timeout;
|
||||||
XtIntervalId xtid;
|
WORD timerid;
|
||||||
} CARET;
|
} CARET;
|
||||||
|
|
||||||
static CARET Caret;
|
static CARET Caret;
|
||||||
static BOOL LockCaret;
|
static BOOL LockCaret;
|
||||||
|
|
||||||
static void CARET_Callback(XtPointer data, XtIntervalId *xtid);
|
static WORD CARET_Callback(HWND hwnd, WORD msg, WORD timerid, LONG ctime);
|
||||||
static void CARET_HideCaret(CARET *pCaret);
|
static void CARET_HideCaret();
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************
|
/*****************************************************************
|
||||||
* CARET_Callback
|
* CARET_Callback
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void CARET_Callback(XtPointer data, XtIntervalId *xtid)
|
static WORD CARET_Callback(HWND hwnd, WORD msg, WORD timerid, LONG ctime)
|
||||||
{
|
{
|
||||||
CARET *pCaret = (CARET *)data;
|
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
HBRUSH hBrush;
|
HBRUSH hBrush;
|
||||||
HRGN rgn;
|
HRGN rgn;
|
||||||
|
|
||||||
#ifdef DEBUG_CARET
|
#ifdef DEBUG_CARET
|
||||||
printf("CARET_Callback: LockCaret=%d, hidden=%d, on=%d\n",
|
printf("CARET_Callback: id=%d: LockCaret=%d, hidden=%d, on=%d\n",
|
||||||
LockCaret, pCaret->hidden, pCaret->on);
|
timerid, LockCaret, Caret.hidden, Caret.on);
|
||||||
#endif
|
#endif
|
||||||
if (!LockCaret && (!pCaret->hidden || pCaret->on))
|
if (!LockCaret && (!Caret.hidden || Caret.on))
|
||||||
{
|
{
|
||||||
pCaret->on = (pCaret->on ? FALSE : TRUE);
|
Caret.on = (Caret.on ? FALSE : TRUE);
|
||||||
hdc = GetDC(pCaret->hwnd);
|
hdc = GetDC(Caret.hwnd);
|
||||||
hBrush = CreateSolidBrush(pCaret->color);
|
hBrush = CreateSolidBrush(Caret.color);
|
||||||
SelectObject(hdc, (HANDLE)hBrush);
|
SelectObject(hdc, (HANDLE)hBrush);
|
||||||
SetROP2(hdc, R2_XORPEN);
|
SetROP2(hdc, R2_XORPEN);
|
||||||
rgn = CreateRectRgn(pCaret->x, pCaret->y,
|
rgn = CreateRectRgn(Caret.x, Caret.y,
|
||||||
pCaret->x + pCaret->width,
|
Caret.x + Caret.width,
|
||||||
pCaret->y + pCaret->height);
|
Caret.y + Caret.height);
|
||||||
FillRgn(hdc, rgn, hBrush);
|
FillRgn(hdc, rgn, hBrush);
|
||||||
DeleteObject((HANDLE)rgn);
|
DeleteObject((HANDLE)rgn);
|
||||||
DeleteObject((HANDLE)hBrush);
|
DeleteObject((HANDLE)hBrush);
|
||||||
ReleaseDC(pCaret->hwnd, hdc);
|
ReleaseDC(Caret.hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
pCaret->xtid = XtAppAddTimeOut(XT_app_context, pCaret->timeout,
|
|
||||||
CARET_Callback, pCaret);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,24 +66,24 @@ static void CARET_Callback(XtPointer data, XtIntervalId *xtid)
|
||||||
* CARET_HideCaret
|
* CARET_HideCaret
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void CARET_HideCaret(CARET *pCaret)
|
static void CARET_HideCaret()
|
||||||
{
|
{
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
HBRUSH hBrush;
|
HBRUSH hBrush;
|
||||||
HRGN rgn;
|
HRGN rgn;
|
||||||
|
|
||||||
pCaret->on = FALSE;
|
Caret.on = FALSE;
|
||||||
hdc = GetDC(pCaret->hwnd);
|
hdc = GetDC(Caret.hwnd);
|
||||||
hBrush = CreateSolidBrush(pCaret->color);
|
hBrush = CreateSolidBrush(Caret.color);
|
||||||
SelectObject(hdc, (HANDLE)hBrush);
|
SelectObject(hdc, (HANDLE)hBrush);
|
||||||
SetROP2(hdc, R2_XORPEN);
|
SetROP2(hdc, R2_XORPEN);
|
||||||
rgn = CreateRectRgn(pCaret->x, pCaret->y,
|
rgn = CreateRectRgn(Caret.x, Caret.y,
|
||||||
pCaret->x + pCaret->width,
|
Caret.x + Caret.width,
|
||||||
pCaret->y + pCaret->height);
|
Caret.y + Caret.height);
|
||||||
FillRgn(hdc, rgn, hBrush);
|
FillRgn(hdc, rgn, hBrush);
|
||||||
DeleteObject((HANDLE)rgn);
|
DeleteObject((HANDLE)rgn);
|
||||||
DeleteObject((HANDLE)hBrush);
|
DeleteObject((HANDLE)hBrush);
|
||||||
ReleaseDC(pCaret->hwnd, hdc);
|
ReleaseDC(Caret.hwnd, hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,6 +95,7 @@ void CreateCaret(HWND hwnd, HBITMAP bitmap, short width, short height)
|
||||||
{
|
{
|
||||||
if (!hwnd) return;
|
if (!hwnd) return;
|
||||||
|
|
||||||
|
|
||||||
/* if cursor already exists, destroy it */
|
/* if cursor already exists, destroy it */
|
||||||
/* if (Caret.hwnd)
|
/* if (Caret.hwnd)
|
||||||
DestroyCaret();
|
DestroyCaret();
|
||||||
|
@ -131,8 +125,11 @@ void CreateCaret(HWND hwnd, HBITMAP bitmap, short width, short height)
|
||||||
Caret.timeout = 750;
|
Caret.timeout = 750;
|
||||||
LockCaret = FALSE;
|
LockCaret = FALSE;
|
||||||
|
|
||||||
Caret.xtid = XtAppAddTimeOut(XT_app_context, Caret.timeout,
|
Caret.timerid = SetSystemTimer(NULL, 0, Caret.timeout, CARET_Callback);
|
||||||
CARET_Callback, &Caret);
|
|
||||||
|
#ifdef DEBUG_CARET
|
||||||
|
printf("CreateCaret: hwnd=%d, timerid=%d\n", hwnd, Caret.timerid);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -144,10 +141,14 @@ void DestroyCaret()
|
||||||
{
|
{
|
||||||
/* if (!Caret.hwnd) return;
|
/* if (!Caret.hwnd) return;
|
||||||
*/
|
*/
|
||||||
XtRemoveTimeOut(Caret.xtid);
|
#ifdef DEBUG_CARET
|
||||||
|
printf("DestroyCaret: timerid\n", Caret.timerid);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
KillSystemTimer(NULL, Caret.timerid);
|
||||||
|
|
||||||
if (Caret.on)
|
if (Caret.on)
|
||||||
CARET_HideCaret(&Caret);
|
CARET_HideCaret();
|
||||||
|
|
||||||
Caret.hwnd = 0; /* cursor marked as not existing */
|
Caret.hwnd = 0; /* cursor marked as not existing */
|
||||||
}
|
}
|
||||||
|
@ -171,7 +172,7 @@ void SetCaretPos(short x, short y)
|
||||||
|
|
||||||
LockCaret = TRUE;
|
LockCaret = TRUE;
|
||||||
if (Caret.on)
|
if (Caret.on)
|
||||||
CARET_HideCaret(&Caret);
|
CARET_HideCaret();
|
||||||
|
|
||||||
Caret.x = x;
|
Caret.x = x;
|
||||||
Caret.y = y;
|
Caret.y = y;
|
||||||
|
@ -189,7 +190,7 @@ void HideCaret(HWND hwnd)
|
||||||
|
|
||||||
LockCaret = TRUE;
|
LockCaret = TRUE;
|
||||||
if (Caret.on)
|
if (Caret.on)
|
||||||
CARET_HideCaret(&Caret);
|
CARET_HideCaret();
|
||||||
|
|
||||||
++Caret.hidden;
|
++Caret.hidden;
|
||||||
LockCaret = FALSE;
|
LockCaret = FALSE;
|
||||||
|
@ -221,7 +222,9 @@ void SetCaretBlinkTime(WORD msecs)
|
||||||
{
|
{
|
||||||
if (!Caret.hwnd) return;
|
if (!Caret.hwnd) return;
|
||||||
|
|
||||||
|
KillSystemTimer(NULL, Caret.timerid);
|
||||||
Caret.timeout = msecs;
|
Caret.timeout = msecs;
|
||||||
|
Caret.timerid = SetSystemTimer(NULL, 0, Caret.timeout, CARET_Callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
||||||
|
|
||||||
#define NB_DCE 5 /* Number of DCEs created at startup */
|
#define NB_DCE 5 /* Number of DCEs created at startup */
|
||||||
|
|
||||||
extern Display * XT_display;
|
extern Display * display;
|
||||||
extern Screen * XT_screen;
|
|
||||||
|
|
||||||
static HANDLE firstDCE = 0;
|
static HANDLE firstDCE = 0;
|
||||||
static HDC defaultDCstate = 0;
|
static HDC defaultDCstate = 0;
|
||||||
|
@ -159,11 +158,11 @@ HDC GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
|
||||||
IntersectVisRect( hdc, 0, 0, dc->w.DCSizeX, dc->w.DCSizeY );
|
IntersectVisRect( hdc, 0, 0, dc->w.DCSizeX, dc->w.DCSizeY );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else dc->u.x.drawable = DefaultRootWindow( XT_display );
|
else dc->u.x.drawable = DefaultRootWindow( display );
|
||||||
|
|
||||||
if (flags & DCX_CLIPCHILDREN)
|
if (flags & DCX_CLIPCHILDREN)
|
||||||
XSetSubwindowMode( XT_display, dc->u.x.gc, ClipByChildren );
|
XSetSubwindowMode( display, dc->u.x.gc, ClipByChildren );
|
||||||
else XSetSubwindowMode( XT_display, dc->u.x.gc, IncludeInferiors);
|
else XSetSubwindowMode( display, dc->u.x.gc, IncludeInferiors);
|
||||||
|
|
||||||
if ((flags & DCX_INTERSECTRGN) || (flags & DCX_EXCLUDERGN))
|
if ((flags & DCX_INTERSECTRGN) || (flags & DCX_EXCLUDERGN))
|
||||||
{
|
{
|
||||||
|
@ -216,7 +215,7 @@ HDC GetWindowDC( HWND hwnd )
|
||||||
int ReleaseDC( HWND hwnd, HDC hdc )
|
int ReleaseDC( HWND hwnd, HDC hdc )
|
||||||
{
|
{
|
||||||
HANDLE hdce;
|
HANDLE hdce;
|
||||||
DCE * dce;
|
DCE * dce = NULL;
|
||||||
|
|
||||||
#ifdef DEBUG_DC
|
#ifdef DEBUG_DC
|
||||||
printf( "ReleaseDC: %d %d\n", hwnd, hdc );
|
printf( "ReleaseDC: %d %d\n", hwnd, hdc );
|
||||||
|
@ -227,11 +226,12 @@ int ReleaseDC( HWND hwnd, HDC hdc )
|
||||||
if (!(dce = (DCE *) USER_HEAP_ADDR( hdce ))) return 0;
|
if (!(dce = (DCE *) USER_HEAP_ADDR( hdce ))) return 0;
|
||||||
if (dce->inUse && (dce->hdc == hdc)) break;
|
if (dce->inUse && (dce->hdc == hdc)) break;
|
||||||
}
|
}
|
||||||
|
if (!hdce) return 0;
|
||||||
|
|
||||||
if (dce->type == DCE_CACHE_DC)
|
if (dce->type == DCE_CACHE_DC)
|
||||||
{
|
{
|
||||||
SetDCState( dce->hdc, defaultDCstate );
|
SetDCState( dce->hdc, defaultDCstate );
|
||||||
dce->inUse = FALSE;
|
dce->inUse = FALSE;
|
||||||
}
|
}
|
||||||
return (hdce != 0);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,17 +6,19 @@
|
||||||
|
|
||||||
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
||||||
|
|
||||||
#ifndef USE_XLIB
|
|
||||||
#include <X11/Intrinsic.h>
|
|
||||||
#include <X11/Shell.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
#include "class.h"
|
#include "class.h"
|
||||||
#include "user.h"
|
#include "user.h"
|
||||||
|
|
||||||
extern Display * XT_display;
|
extern Display * display;
|
||||||
|
|
||||||
|
extern LONG NC_HandleNCPaint( HWND hwnd, HRGN hrgn );
|
||||||
|
extern LONG NC_HandleNCCalcSize( HWND hwnd, NCCALCSIZE_PARAMS *params );
|
||||||
|
extern LONG NC_HandleNCHitTest( HWND hwnd, POINT pt );
|
||||||
|
extern LONG NC_HandleNCMouseMsg(HWND hwnd, WORD msg, WORD wParam, LONG lParam);
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* DefWindowProc (USER.107)
|
* DefWindowProc (USER.107)
|
||||||
|
@ -26,6 +28,7 @@ LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
|
||||||
CLASS * classPtr;
|
CLASS * classPtr;
|
||||||
LPSTR textPtr;
|
LPSTR textPtr;
|
||||||
int len;
|
int len;
|
||||||
|
int tempwidth, tempheight;
|
||||||
WND * wndPtr = WIN_FindWndPtr( hwnd );
|
WND * wndPtr = WIN_FindWndPtr( hwnd );
|
||||||
|
|
||||||
#ifdef DEBUG_MESSAGE
|
#ifdef DEBUG_MESSAGE
|
||||||
|
@ -51,40 +54,19 @@ LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
|
||||||
}
|
}
|
||||||
|
|
||||||
case WM_NCCALCSIZE:
|
case WM_NCCALCSIZE:
|
||||||
{
|
return NC_HandleNCCalcSize( hwnd, (NCCALCSIZE_PARAMS *)lParam );
|
||||||
#ifdef USE_XLIB
|
|
||||||
NCCALCSIZE_PARAMS *params = (NCCALCSIZE_PARAMS *)lParam;
|
case WM_NCPAINT:
|
||||||
if (wndPtr->dwStyle & WS_CHILD)
|
return NC_HandleNCPaint( hwnd, (HRGN)wParam );
|
||||||
{
|
|
||||||
if (wndPtr->dwStyle & WS_BORDER)
|
case WM_NCHITTEST:
|
||||||
{
|
return NC_HandleNCHitTest( hwnd, MAKEPOINT(lParam) );
|
||||||
params->rgrc[0].left += 1; /* SM_CXBORDER */
|
|
||||||
params->rgrc[0].top += 1; /* SM_CYBORDER */
|
case WM_NCLBUTTONDOWN:
|
||||||
params->rgrc[0].right -= 1; /* SM_CXBORDER */
|
case WM_NCLBUTTONUP:
|
||||||
params->rgrc[0].bottom -= 1; /* SM_CYBORDER */
|
case WM_NCLBUTTONDBLCLK:
|
||||||
}
|
case WM_NCMOUSEMOVE:
|
||||||
}
|
return NC_HandleNCMouseMsg( hwnd, msg, wParam, lParam );
|
||||||
else
|
|
||||||
{
|
|
||||||
params->rgrc[0].left += 4; /* SM_CXFRAME */
|
|
||||||
params->rgrc[0].top += 30; /* SM_CYFRAME+SM_CYCAPTION */
|
|
||||||
params->rgrc[0].right -= 4; /* SM_CXFRAME */
|
|
||||||
params->rgrc[0].bottom -= 4; /* SM_CYFRAME */
|
|
||||||
if (wndPtr->dwStyle & WS_VSCROLL)
|
|
||||||
{
|
|
||||||
params->rgrc[0].right -= 16; /* SM_CXVSCROLL */
|
|
||||||
}
|
|
||||||
if (wndPtr->dwStyle & WS_HSCROLL)
|
|
||||||
{
|
|
||||||
params->rgrc[0].bottom += 16; /* SM_CYHSCROLL */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
case WM_CREATE:
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
case WM_NCDESTROY:
|
case WM_NCDESTROY:
|
||||||
{
|
{
|
||||||
|
@ -188,18 +170,42 @@ LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
|
||||||
strlen((LPSTR)lParam) + 1);
|
strlen((LPSTR)lParam) + 1);
|
||||||
textPtr = (LPSTR)USER_HEAP_ADDR(wndPtr->hText);
|
textPtr = (LPSTR)USER_HEAP_ADDR(wndPtr->hText);
|
||||||
strcpy(textPtr, (LPSTR)lParam);
|
strcpy(textPtr, (LPSTR)lParam);
|
||||||
#ifdef USE_XLIB
|
XStoreName( display, wndPtr->window, textPtr );
|
||||||
XStoreName( XT_display, wndPtr->window, textPtr );
|
|
||||||
#else
|
|
||||||
if (wndPtr->shellWidget)
|
|
||||||
XtVaSetValues( wndPtr->shellWidget, XtNtitle, textPtr, NULL );
|
|
||||||
#endif
|
|
||||||
return (0L);
|
return (0L);
|
||||||
}
|
}
|
||||||
case WM_SETCURSOR:
|
case WM_SETCURSOR:
|
||||||
if (wndPtr->hCursor != (HCURSOR)NULL)
|
if (wndPtr->hCursor != (HCURSOR)NULL)
|
||||||
SetCursor(wndPtr->hCursor);
|
SetCursor(wndPtr->hCursor);
|
||||||
return 0L;
|
return 0L;
|
||||||
|
case WM_SYSCOMMAND:
|
||||||
|
switch (wParam)
|
||||||
|
{
|
||||||
|
case SC_CLOSE:
|
||||||
|
ShowWindow(hwnd, SW_MINIMIZE);
|
||||||
|
printf("defdwndproc WM_SYSCOMMAND SC_CLOSE !\n");
|
||||||
|
return SendMessage( hwnd, WM_CLOSE, 0, 0 );
|
||||||
|
case SC_RESTORE:
|
||||||
|
ShowWindow(hwnd, SW_RESTORE);
|
||||||
|
break;
|
||||||
|
case SC_MINIMIZE:
|
||||||
|
ShowWindow(hwnd, SW_MINIMIZE);
|
||||||
|
printf("defdwndproc WM_SYSCOMMAND SC_MINIMIZE !\n");
|
||||||
|
break;
|
||||||
|
case SC_MAXIMIZE:
|
||||||
|
ShowWindow(hwnd, SW_MAXIMIZE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_SYSKEYDOWN:
|
||||||
|
if (wParam == VK_MENU) {
|
||||||
|
printf("VK_MENU Pressed // hMenu=%04X !\n", GetMenu(hwnd));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WM_SYSKEYUP:
|
||||||
|
if (wParam == VK_MENU) {
|
||||||
|
printf("VK_MENU Released // hMenu=%04X !\n", GetMenu(hwnd));
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,11 +184,13 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, LPCSTR dlgTemplate,
|
||||||
HMENU hMenu;
|
HMENU hMenu;
|
||||||
HFONT hFont = 0;
|
HFONT hFont = 0;
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
|
RECT rect;
|
||||||
WND * wndPtr;
|
WND * wndPtr;
|
||||||
int i;
|
int i;
|
||||||
DLGTEMPLATE template;
|
DLGTEMPLATE template;
|
||||||
DLGCONTROLHEADER * header;
|
DLGCONTROLHEADER * header;
|
||||||
DIALOGINFO * dlgInfo;
|
DIALOGINFO * dlgInfo;
|
||||||
|
DWORD exStyle = 0;
|
||||||
WORD xUnit = xBaseUnit;
|
WORD xUnit = xBaseUnit;
|
||||||
WORD yUnit = yBaseUnit;
|
WORD yUnit = yBaseUnit;
|
||||||
|
|
||||||
|
@ -229,7 +231,7 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, LPCSTR dlgTemplate,
|
||||||
HFONT oldFont;
|
HFONT oldFont;
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
|
|
||||||
hdc = GetDC(GetDesktopWindow());
|
hdc = GetDC(0);
|
||||||
oldFont = SelectObject( hdc, hFont );
|
oldFont = SelectObject( hdc, hFont );
|
||||||
GetTextMetrics( hdc, &tm );
|
GetTextMetrics( hdc, &tm );
|
||||||
SelectObject( hdc, oldFont );
|
SelectObject( hdc, oldFont );
|
||||||
|
@ -241,14 +243,19 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, LPCSTR dlgTemplate,
|
||||||
|
|
||||||
/* Create dialog main window */
|
/* Create dialog main window */
|
||||||
|
|
||||||
hwnd = CreateWindow( template.className, template.caption,
|
rect.left = rect.top = 0;
|
||||||
template.header->style,
|
rect.right = template.header->cx * xUnit / 4;
|
||||||
template.header->x * xUnit / 4,
|
rect.bottom = template.header->cy * yUnit / 8;
|
||||||
template.header->y * yUnit / 8,
|
if (template.header->style & DS_MODALFRAME) exStyle |= WS_EX_DLGMODALFRAME;
|
||||||
template.header->cx * xUnit / 4,
|
AdjustWindowRectEx( &rect, template.header->style, hMenu, exStyle );
|
||||||
template.header->cy * yUnit / 8,
|
|
||||||
owner, hMenu, hInst,
|
hwnd = CreateWindowEx( exStyle, template.className, template.caption,
|
||||||
NULL );
|
template.header->style,
|
||||||
|
rect.left + template.header->x * xUnit / 4,
|
||||||
|
rect.top + template.header->y * yUnit / 8,
|
||||||
|
rect.right - rect.left, rect.bottom - rect.top,
|
||||||
|
owner, hMenu, hInst,
|
||||||
|
NULL );
|
||||||
if (!hwnd)
|
if (!hwnd)
|
||||||
{
|
{
|
||||||
if (hFont) DeleteObject( hFont );
|
if (hFont) DeleteObject( hFont );
|
||||||
|
|
463
windows/event.c
463
windows/event.c
|
@ -6,33 +6,23 @@
|
||||||
|
|
||||||
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
||||||
|
|
||||||
#include <X11/Intrinsic.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/StringDefs.h>
|
|
||||||
#include <X11/Core.h>
|
|
||||||
|
|
||||||
#include "windows.h"
|
#include "windows.h"
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
#include "class.h"
|
#include "class.h"
|
||||||
|
#include "message.h"
|
||||||
|
|
||||||
|
|
||||||
#define NB_BUTTONS 3 /* Windows can handle 3 buttons */
|
#define NB_BUTTONS 3 /* Windows can handle 3 buttons */
|
||||||
static WORD dblclick_time = 300; /* Max. time for a double click (milliseconds) */
|
|
||||||
|
|
||||||
extern Display * XT_display;
|
extern Display * display;
|
||||||
|
|
||||||
/* Event handlers */
|
|
||||||
static void EVENT_expose();
|
|
||||||
static void EVENT_key();
|
|
||||||
static void EVENT_mouse_motion();
|
|
||||||
static void EVENT_mouse_button();
|
|
||||||
static void EVENT_structure();
|
|
||||||
static void EVENT_focus_change();
|
|
||||||
static void EVENT_enter_notify();
|
|
||||||
|
|
||||||
/* X context to associate a hwnd to an X window */
|
/* X context to associate a hwnd to an X window */
|
||||||
static XContext winContext = 0;
|
static XContext winContext = 0;
|
||||||
|
|
||||||
/* State variables */
|
/* State variables */
|
||||||
|
static WORD ALTKeyState;
|
||||||
static HWND captureWnd = 0;
|
static HWND captureWnd = 0;
|
||||||
Window winHasCursor = 0;
|
Window winHasCursor = 0;
|
||||||
extern HWND hWndFocus;
|
extern HWND hWndFocus;
|
||||||
|
@ -118,6 +108,17 @@ static char *event_names[] =
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Event handlers */
|
||||||
|
static void EVENT_key( HWND hwnd, XKeyEvent *event );
|
||||||
|
static void EVENT_ButtonPress( HWND hwnd, XButtonEvent *event );
|
||||||
|
static void EVENT_ButtonRelease( HWND hwnd, XButtonEvent *event );
|
||||||
|
static void EVENT_MotionNotify( HWND hwnd, XMotionEvent *event );
|
||||||
|
static void EVENT_EnterNotify( HWND hwnd, XCrossingEvent *event );
|
||||||
|
static void EVENT_FocusIn( HWND hwnd, XFocusChangeEvent *event );
|
||||||
|
static void EVENT_FocusOut( HWND hwnd, XFocusChangeEvent *event );
|
||||||
|
static void EVENT_Expose( HWND hwnd, XExposeEvent *event );
|
||||||
|
static void EVENT_ConfigureNotify( HWND hwnd, XConfigureEvent *event );
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* EVENT_ProcessEvent
|
* EVENT_ProcessEvent
|
||||||
|
@ -128,117 +129,72 @@ void EVENT_ProcessEvent( XEvent *event )
|
||||||
{
|
{
|
||||||
HWND hwnd;
|
HWND hwnd;
|
||||||
XPointer ptr;
|
XPointer ptr;
|
||||||
Boolean cont_dispatch = TRUE;
|
|
||||||
|
|
||||||
XFindContext( XT_display, ((XAnyEvent *)event)->window, winContext, &ptr );
|
XFindContext( display, ((XAnyEvent *)event)->window, winContext, &ptr );
|
||||||
hwnd = (HWND)ptr & 0xffff;
|
hwnd = (HWND) (int)ptr;
|
||||||
|
|
||||||
#ifdef DEBUG_EVENT
|
#ifdef DEBUG_EVENT
|
||||||
printf( "Got event %s for hwnd %d\n",
|
printf( "Got event %s for hwnd %d\n", event_names[event->type], hwnd );
|
||||||
event_names[event->type], hwnd );
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch(event->type)
|
switch(event->type)
|
||||||
{
|
{
|
||||||
case Expose:
|
case KeyPress:
|
||||||
EVENT_expose( 0, hwnd, event, &cont_dispatch );
|
case KeyRelease:
|
||||||
break;
|
EVENT_key( hwnd, (XKeyEvent*)event );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ButtonPress:
|
||||||
|
EVENT_ButtonPress( hwnd, (XButtonEvent*)event );
|
||||||
|
break;
|
||||||
|
|
||||||
case KeyPress:
|
case ButtonRelease:
|
||||||
case KeyRelease:
|
EVENT_ButtonRelease( hwnd, (XButtonEvent*)event );
|
||||||
EVENT_key( 0, hwnd, event, &cont_dispatch );
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
EVENT_mouse_motion( 0, hwnd, event, &cont_dispatch );
|
EVENT_MotionNotify( hwnd, (XMotionEvent*)event );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ButtonPress:
|
case EnterNotify:
|
||||||
case ButtonRelease:
|
EVENT_EnterNotify( hwnd, (XCrossingEvent*)event );
|
||||||
EVENT_mouse_button( 0, hwnd, event, &cont_dispatch );
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case CirculateNotify:
|
case FocusIn:
|
||||||
case ConfigureNotify:
|
EVENT_FocusIn( hwnd, (XFocusChangeEvent*)event );
|
||||||
case MapNotify:
|
break;
|
||||||
case UnmapNotify:
|
|
||||||
EVENT_structure( 0, hwnd, event, &cont_dispatch );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FocusIn:
|
case FocusOut:
|
||||||
case FocusOut:
|
EVENT_FocusOut( hwnd, (XFocusChangeEvent*)event );
|
||||||
EVENT_focus_change( 0, hwnd, event, &cont_dispatch );
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case EnterNotify:
|
case Expose:
|
||||||
EVENT_enter_notify( 0, hwnd, event, &cont_dispatch );
|
EVENT_Expose( hwnd, (XExposeEvent*)event );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ConfigureNotify:
|
||||||
|
EVENT_ConfigureNotify( hwnd, (XConfigureEvent*)event );
|
||||||
|
break;
|
||||||
|
|
||||||
#ifdef DEBUG_EVENT
|
#ifdef DEBUG_EVENT
|
||||||
default:
|
default:
|
||||||
printf( "Unprocessed event %s for hwnd %d\n",
|
printf( "Unprocessed event %s for hwnd %d\n",
|
||||||
event_names[event->type], hwnd );
|
event_names[event->type], hwnd );
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* EVENT_AddHandlers
|
* EVENT_RegisterWindow
|
||||||
*
|
*
|
||||||
* Add the event handlers to the given window
|
* Associate an X window to a HWND.
|
||||||
*/
|
*/
|
||||||
#ifdef USE_XLIB
|
void EVENT_RegisterWindow( Window w, HWND hwnd )
|
||||||
void EVENT_AddHandlers( Window w, int hwnd )
|
|
||||||
{
|
{
|
||||||
if (!winContext) winContext = XUniqueContext();
|
if (!winContext) winContext = XUniqueContext();
|
||||||
XSaveContext( XT_display, w, winContext, (XPointer)hwnd );
|
XSaveContext( display, w, winContext, (XPointer)(int)hwnd );
|
||||||
}
|
|
||||||
#else
|
|
||||||
void EVENT_AddHandlers( Widget w, int hwnd )
|
|
||||||
{
|
|
||||||
XtAddEventHandler(w, ExposureMask, FALSE,
|
|
||||||
EVENT_expose, (XtPointer)hwnd );
|
|
||||||
XtAddEventHandler(w, KeyPressMask | KeyReleaseMask, FALSE,
|
|
||||||
EVENT_key, (XtPointer)hwnd );
|
|
||||||
XtAddEventHandler(w, PointerMotionMask, FALSE,
|
|
||||||
EVENT_mouse_motion, (XtPointer)hwnd );
|
|
||||||
XtAddEventHandler(w, ButtonPressMask | ButtonReleaseMask, FALSE,
|
|
||||||
EVENT_mouse_button, (XtPointer)hwnd );
|
|
||||||
XtAddEventHandler(w, StructureNotifyMask, FALSE,
|
|
||||||
EVENT_structure, (XtPointer)hwnd );
|
|
||||||
XtAddEventHandler(w, FocusChangeMask, FALSE,
|
|
||||||
EVENT_focus_change, (XtPointer)hwnd );
|
|
||||||
XtAddEventHandler(w, EnterWindowMask, FALSE,
|
|
||||||
EVENT_enter_notify, (XtPointer)hwnd );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* EVENT_RemoveHandlers
|
|
||||||
*
|
|
||||||
* Remove the event handlers of the given window
|
|
||||||
*/
|
|
||||||
void EVENT_RemoveHandlers( Widget w, int hwnd )
|
|
||||||
{
|
|
||||||
#ifndef USE_XLIB
|
|
||||||
XtRemoveEventHandler(w, ExposureMask, FALSE,
|
|
||||||
EVENT_expose, (XtPointer)hwnd );
|
|
||||||
XtRemoveEventHandler(w, KeyPressMask | KeyReleaseMask, FALSE,
|
|
||||||
EVENT_key, (XtPointer)hwnd );
|
|
||||||
XtRemoveEventHandler(w, PointerMotionMask, FALSE,
|
|
||||||
EVENT_mouse_motion, (XtPointer)hwnd );
|
|
||||||
XtRemoveEventHandler(w, ButtonPressMask | ButtonReleaseMask, FALSE,
|
|
||||||
EVENT_mouse_button, (XtPointer)hwnd );
|
|
||||||
XtRemoveEventHandler(w, StructureNotifyMask, FALSE,
|
|
||||||
EVENT_structure, (XtPointer)hwnd );
|
|
||||||
XtRemoveEventHandler(w, FocusChangeMask, FALSE,
|
|
||||||
EVENT_focus_change, (XtPointer)hwnd );
|
|
||||||
XtRemoveEventHandler(w, EnterWindowMask, FALSE,
|
|
||||||
EVENT_enter_notify, (XtPointer)hwnd );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -262,12 +218,9 @@ static WORD EVENT_XStateToKeyState( int state )
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* EVENT_expose
|
* EVENT_Expose
|
||||||
*
|
|
||||||
* Handle a X expose event
|
|
||||||
*/
|
*/
|
||||||
static void EVENT_expose( Widget w, int hwnd, XExposeEvent *event,
|
static void EVENT_Expose( HWND hwnd, XExposeEvent *event )
|
||||||
Boolean *cont_dispatch )
|
|
||||||
{
|
{
|
||||||
RECT rect;
|
RECT rect;
|
||||||
WND * wndPtr = WIN_FindWndPtr( hwnd );
|
WND * wndPtr = WIN_FindWndPtr( hwnd );
|
||||||
|
@ -288,10 +241,8 @@ static void EVENT_expose( Widget w, int hwnd, XExposeEvent *event,
|
||||||
*
|
*
|
||||||
* Handle a X key event
|
* Handle a X key event
|
||||||
*/
|
*/
|
||||||
static void EVENT_key( Widget w, int hwnd, XKeyEvent *event,
|
static void EVENT_key( HWND hwnd, XKeyEvent *event )
|
||||||
Boolean *cont_dispatch )
|
|
||||||
{
|
{
|
||||||
MSG msg;
|
|
||||||
char Str[24];
|
char Str[24];
|
||||||
XComposeStatus cs;
|
XComposeStatus cs;
|
||||||
KeySym keysym;
|
KeySym keysym;
|
||||||
|
@ -350,25 +301,20 @@ static void EVENT_key( Widget w, int hwnd, XKeyEvent *event,
|
||||||
|
|
||||||
if (event->type == KeyPress)
|
if (event->type == KeyPress)
|
||||||
{
|
{
|
||||||
msg.hwnd = hwnd;
|
if (vkey == VK_MENU) ALTKeyState = TRUE;
|
||||||
msg.message = WM_KEYDOWN;
|
|
||||||
msg.wParam = vkey;
|
|
||||||
keylp.lp1.count = 1;
|
keylp.lp1.count = 1;
|
||||||
keylp.lp1.code = LOBYTE(event->keycode);
|
keylp.lp1.code = LOBYTE(event->keycode);
|
||||||
keylp.lp1.extended = (extended ? 1 : 0);
|
keylp.lp1.extended = (extended ? 1 : 0);
|
||||||
keylp.lp1.context = (event->state & Mod1Mask ? 1 : 0);
|
keylp.lp1.context = (event->state & Mod1Mask ? 1 : 0);
|
||||||
keylp.lp1.previous = (KeyDown ? 0 : 1);
|
keylp.lp1.previous = (KeyDown ? 0 : 1);
|
||||||
keylp.lp1.transition = 0;
|
keylp.lp1.transition = 0;
|
||||||
msg.lParam = keylp.lp2;
|
|
||||||
#ifdef DEBUG_KEY
|
#ifdef DEBUG_KEY
|
||||||
printf(" wParam=%X, lParam=%lX\n", msg.wParam, msg.lParam);
|
printf(" wParam=%X, lParam=%lX\n", vkey, keylp.lp2 );
|
||||||
#endif
|
#endif
|
||||||
msg.time = event->time;
|
hardware_event( hwnd, ALTKeyState ? WM_SYSKEYDOWN : WM_KEYDOWN,
|
||||||
msg.pt.x = event->x & 0xffff;
|
vkey, keylp.lp2,
|
||||||
msg.pt.y = event->y & 0xffff;
|
event->x_root & 0xffff, event->y_root & 0xffff,
|
||||||
|
event->time, 0 );
|
||||||
hardware_event( hwnd, WM_KEYDOWN, vkey, keylp.lp2,
|
|
||||||
event->x & 0xffff, event->y & 0xffff, event->time, 0 );
|
|
||||||
KeyDown = TRUE;
|
KeyDown = TRUE;
|
||||||
|
|
||||||
/* The key translation ought to take place in TranslateMessage().
|
/* The key translation ought to take place in TranslateMessage().
|
||||||
|
@ -378,218 +324,145 @@ static void EVENT_key( Widget w, int hwnd, XKeyEvent *event,
|
||||||
*/
|
*/
|
||||||
if (count == 1) /* key has an ASCII representation */
|
if (count == 1) /* key has an ASCII representation */
|
||||||
{
|
{
|
||||||
msg.hwnd = hwnd;
|
|
||||||
msg.message = WM_CHAR;
|
|
||||||
msg.wParam = (WORD)Str[0];
|
|
||||||
msg.lParam = keylp.lp2;
|
|
||||||
#ifdef DEBUG_KEY
|
#ifdef DEBUG_KEY
|
||||||
printf("WM_CHAR : wParam=%X\n", msg.wParam);
|
printf("WM_CHAR : wParam=%X\n", (WORD)Str[0] );
|
||||||
#endif
|
#endif
|
||||||
msg.time = event->time;
|
|
||||||
msg.pt.x = event->x & 0xffff;
|
|
||||||
msg.pt.y = event->y & 0xffff;
|
|
||||||
PostMessage( hwnd, WM_CHAR, (WORD)Str[0], keylp.lp2 );
|
PostMessage( hwnd, WM_CHAR, (WORD)Str[0], keylp.lp2 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg.hwnd = hwnd;
|
if (vkey == VK_MENU) ALTKeyState = FALSE;
|
||||||
msg.message = WM_KEYUP;
|
|
||||||
msg.wParam = vkey;
|
|
||||||
keylp.lp1.count = 1;
|
keylp.lp1.count = 1;
|
||||||
keylp.lp1.code = LOBYTE(event->keycode);
|
keylp.lp1.code = LOBYTE(event->keycode);
|
||||||
keylp.lp1.extended = (extended ? 1 : 0);
|
keylp.lp1.extended = (extended ? 1 : 0);
|
||||||
keylp.lp1.context = (event->state & Mod1Mask ? 1 : 0);
|
keylp.lp1.context = (event->state & Mod1Mask ? 1 : 0);
|
||||||
keylp.lp1.previous = 1;
|
keylp.lp1.previous = 1;
|
||||||
keylp.lp1.transition = 1;
|
keylp.lp1.transition = 1;
|
||||||
msg.lParam = keylp.lp2;
|
|
||||||
#ifdef DEBUG_KEY
|
#ifdef DEBUG_KEY
|
||||||
printf(" wParam=%X, lParam=%lX\n", msg.wParam, msg.lParam);
|
printf(" wParam=%X, lParam=%lX\n", vkey, keylp.lp2 );
|
||||||
#endif
|
#endif
|
||||||
msg.time = event->time;
|
hardware_event( hwnd,
|
||||||
msg.pt.x = event->x & 0xffff;
|
((ALTKeyState || vkey == VK_MENU) ?
|
||||||
msg.pt.y = event->y & 0xffff;
|
WM_SYSKEYUP : WM_KEYUP),
|
||||||
|
vkey, keylp.lp2,
|
||||||
hardware_event( hwnd, WM_KEYUP, vkey, keylp.lp2,
|
event->x_root & 0xffff, event->y_root & 0xffff,
|
||||||
event->x & 0xffff, event->y & 0xffff, event->time, 0 );
|
event->time, 0 );
|
||||||
KeyDown = FALSE;
|
KeyDown = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* EVENT_mouse_motion
|
* EVENT_MotionNotify
|
||||||
*
|
|
||||||
* Handle a X mouse motion event
|
|
||||||
*/
|
*/
|
||||||
static void EVENT_mouse_motion( Widget w, int hwnd, XMotionEvent *event,
|
static void EVENT_MotionNotify( HWND hwnd, XMotionEvent *event )
|
||||||
Boolean *cont_dispatch )
|
|
||||||
{
|
{
|
||||||
WND * wndPtr = WIN_FindWndPtr( hwnd );
|
hardware_event( hwnd, WM_MOUSEMOVE,
|
||||||
if (!wndPtr) return;
|
EVENT_XStateToKeyState( event->state ), 0L,
|
||||||
|
event->x_root & 0xffff, event->y_root & 0xffff,
|
||||||
/* Position must be relative to client area */
|
|
||||||
event->x -= wndPtr->rectClient.left - wndPtr->rectWindow.left;
|
|
||||||
event->y -= wndPtr->rectClient.top - wndPtr->rectWindow.top;
|
|
||||||
|
|
||||||
hardware_event( hwnd, WM_MOUSEMOVE, EVENT_XStateToKeyState( event->state ),
|
|
||||||
(event->x & 0xffff) | (event->y << 16),
|
|
||||||
event->x & 0xffff, event->y & 0xffff,
|
|
||||||
event->time, 0 );
|
event->time, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* EVENT_mouse_button
|
* EVENT_ButtonPress
|
||||||
*
|
|
||||||
* Handle a X mouse button event
|
|
||||||
*/
|
*/
|
||||||
static void EVENT_mouse_button( Widget w, int hwnd, XButtonEvent *event,
|
static void EVENT_ButtonPress( HWND hwnd, XButtonEvent *event )
|
||||||
Boolean *cont_dispatch )
|
|
||||||
{
|
{
|
||||||
static WORD messages[3][NB_BUTTONS] =
|
static WORD messages[NB_BUTTONS] =
|
||||||
{
|
{ WM_LBUTTONDOWN, WM_MBUTTONDOWN, WM_RBUTTONDOWN };
|
||||||
{ WM_LBUTTONDOWN, WM_MBUTTONDOWN, WM_RBUTTONDOWN },
|
int buttonNum = event->button - 1;
|
||||||
{ WM_LBUTTONUP, WM_MBUTTONUP, WM_RBUTTONUP },
|
|
||||||
{ WM_LBUTTONDBLCLK, WM_MBUTTONDBLCLK, WM_RBUTTONDBLCLK }
|
|
||||||
};
|
|
||||||
static unsigned long lastClickTime[NB_BUTTONS] = { 0, 0, 0 };
|
|
||||||
|
|
||||||
int buttonNum, prevTime, type;
|
|
||||||
|
|
||||||
WND * wndPtr = WIN_FindWndPtr( hwnd );
|
if (buttonNum >= NB_BUTTONS) return;
|
||||||
if (!wndPtr) return;
|
|
||||||
|
|
||||||
/* Position must be relative to client area */
|
|
||||||
event->x -= wndPtr->rectClient.left - wndPtr->rectWindow.left;
|
|
||||||
event->y -= wndPtr->rectClient.top - wndPtr->rectWindow.top;
|
|
||||||
|
|
||||||
buttonNum = event->button-1;
|
|
||||||
if (buttonNum >= NB_BUTTONS) return;
|
|
||||||
if (event->type == ButtonRelease) type = 1;
|
|
||||||
else
|
|
||||||
{ /* Check if double-click */
|
|
||||||
prevTime = lastClickTime[buttonNum];
|
|
||||||
lastClickTime[buttonNum] = event->time;
|
|
||||||
if (event->time - prevTime < dblclick_time)
|
|
||||||
{
|
|
||||||
WND * wndPtr;
|
|
||||||
CLASS * classPtr;
|
|
||||||
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return;
|
|
||||||
if (!(classPtr = CLASS_FindClassPtr( wndPtr->hClass ))) return;
|
|
||||||
type = (classPtr->wc.style & CS_DBLCLKS) ? 2 : 0;
|
|
||||||
}
|
|
||||||
else type = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
winHasCursor = event->window;
|
winHasCursor = event->window;
|
||||||
|
hardware_event( hwnd, messages[buttonNum],
|
||||||
hardware_event( hwnd, messages[type][buttonNum],
|
EVENT_XStateToKeyState( event->state ), 0L,
|
||||||
EVENT_XStateToKeyState( event->state ),
|
event->x_root & 0xffff, event->y_root & 0xffff,
|
||||||
(event->x & 0xffff) | (event->y << 16),
|
|
||||||
event->x & 0xffff, event->y & 0xffff,
|
|
||||||
event->time, 0 );
|
event->time, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* EVENT_structure
|
* EVENT_ButtonRelease
|
||||||
*
|
|
||||||
* Handle a X StructureNotify event
|
|
||||||
*/
|
*/
|
||||||
static void EVENT_structure( Widget w, int hwnd, XEvent *event,
|
static void EVENT_ButtonRelease( HWND hwnd, XButtonEvent *event )
|
||||||
Boolean *cont_dispatch )
|
|
||||||
{
|
{
|
||||||
MSG msg;
|
static const WORD messages[NB_BUTTONS] =
|
||||||
|
{ WM_LBUTTONUP, WM_MBUTTONUP, WM_RBUTTONUP };
|
||||||
msg.hwnd = hwnd;
|
int buttonNum = event->button - 1;
|
||||||
msg.time = GetTickCount();
|
|
||||||
msg.pt.x = 0;
|
|
||||||
msg.pt.y = 0;
|
|
||||||
|
|
||||||
switch(event->type)
|
if (buttonNum >= NB_BUTTONS) return;
|
||||||
{
|
winHasCursor = event->window;
|
||||||
case ConfigureNotify:
|
hardware_event( hwnd, messages[buttonNum],
|
||||||
{
|
EVENT_XStateToKeyState( event->state ), 0L,
|
||||||
HANDLE handle;
|
event->x_root & 0xffff, event->y_root & 0xffff,
|
||||||
NCCALCSIZE_PARAMS *params;
|
event->time, 0 );
|
||||||
XConfigureEvent * evt = (XConfigureEvent *)event;
|
}
|
||||||
WND * wndPtr = WIN_FindWndPtr( hwnd );
|
|
||||||
if (!wndPtr) return;
|
|
||||||
wndPtr->rectWindow.left = evt->x;
|
|
||||||
wndPtr->rectWindow.top = evt->y;
|
|
||||||
wndPtr->rectWindow.right = evt->x + evt->width;
|
|
||||||
wndPtr->rectWindow.bottom = evt->y + evt->height;
|
|
||||||
|
|
||||||
/* Send WM_NCCALCSIZE message */
|
|
||||||
handle = GlobalAlloc( GMEM_MOVEABLE, sizeof(*params) );
|
/***********************************************************************
|
||||||
params = (NCCALCSIZE_PARAMS *)GlobalLock( handle );
|
* EVENT_ConfigureNotify
|
||||||
params->rgrc[0] = wndPtr->rectWindow;
|
*/
|
||||||
params->lppos = NULL; /* Should be WINDOWPOS struct */
|
static void EVENT_ConfigureNotify( HWND hwnd, XConfigureEvent *event )
|
||||||
SendMessage( hwnd, WM_NCCALCSIZE, FALSE, params );
|
{
|
||||||
wndPtr->rectClient = params->rgrc[0];
|
HANDLE handle;
|
||||||
PostMessage( hwnd, WM_MOVE, 0,
|
NCCALCSIZE_PARAMS *params;
|
||||||
MAKELONG( wndPtr->rectClient.left,
|
WND * wndPtr = WIN_FindWndPtr( hwnd );
|
||||||
wndPtr->rectClient.top ));
|
if (!wndPtr) return;
|
||||||
PostMessage( hwnd, WM_SIZE, SIZE_RESTORED,
|
wndPtr->rectWindow.left = event->x;
|
||||||
MAKELONG(wndPtr->rectClient.right-wndPtr->rectClient.left,
|
wndPtr->rectWindow.top = event->y;
|
||||||
wndPtr->rectClient.bottom-wndPtr->rectClient.top));
|
wndPtr->rectWindow.right = event->x + event->width;
|
||||||
GlobalUnlock( handle );
|
wndPtr->rectWindow.bottom = event->y + event->height;
|
||||||
GlobalFree( handle );
|
|
||||||
}
|
/* Send WM_NCCALCSIZE message */
|
||||||
break;
|
handle = GlobalAlloc( GMEM_MOVEABLE, sizeof(*params) );
|
||||||
|
params = (NCCALCSIZE_PARAMS *)GlobalLock( handle );
|
||||||
}
|
params->rgrc[0] = wndPtr->rectWindow;
|
||||||
|
params->lppos = NULL; /* Should be WINDOWPOS struct */
|
||||||
|
SendMessage( hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)params );
|
||||||
|
wndPtr->rectClient = params->rgrc[0];
|
||||||
|
PostMessage( hwnd, WM_MOVE, 0,
|
||||||
|
MAKELONG( wndPtr->rectClient.left, wndPtr->rectClient.top ));
|
||||||
|
PostMessage( hwnd, WM_SIZE, SIZE_RESTORED,
|
||||||
|
MAKELONG( wndPtr->rectClient.right-wndPtr->rectClient.left,
|
||||||
|
wndPtr->rectClient.bottom-wndPtr->rectClient.top) );
|
||||||
|
GlobalUnlock( handle );
|
||||||
|
GlobalFree( handle );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* EVENT_focus_change
|
* EVENT_FocusIn
|
||||||
*
|
|
||||||
* Handle an X FocusChange event
|
|
||||||
*/
|
*/
|
||||||
static void EVENT_focus_change( Widget w, int hwnd, XEvent *event,
|
static void EVENT_FocusIn( HWND hwnd, XFocusChangeEvent *event )
|
||||||
Boolean *cont_dispatch )
|
|
||||||
{
|
{
|
||||||
switch(event->type)
|
PostMessage( hwnd, WM_SETFOCUS, hwnd, 0 );
|
||||||
{
|
hWndFocus = hwnd;
|
||||||
case FocusIn:
|
|
||||||
{
|
|
||||||
PostMessage( hwnd, WM_SETFOCUS, hwnd, 0 );
|
|
||||||
hWndFocus = hwnd;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case FocusOut:
|
|
||||||
{
|
|
||||||
if (hWndFocus)
|
|
||||||
{
|
|
||||||
PostMessage( hwnd, WM_KILLFOCUS, hwnd, 0 );
|
|
||||||
hWndFocus = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* EVENT_enter_notify
|
* EVENT_FocusOut
|
||||||
*
|
|
||||||
* Handle an X EnterNotify event
|
|
||||||
*/
|
*/
|
||||||
static void EVENT_enter_notify( Widget w, int hwnd, XCrossingEvent *event,
|
static void EVENT_FocusOut( HWND hwnd, XFocusChangeEvent *event )
|
||||||
Boolean *cont_dispatch )
|
{
|
||||||
|
if (hWndFocus)
|
||||||
|
{
|
||||||
|
PostMessage( hwnd, WM_KILLFOCUS, hwnd, 0 );
|
||||||
|
hWndFocus = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* EVENT_EnterNotify
|
||||||
|
*/
|
||||||
|
static void EVENT_EnterNotify( HWND hwnd, XCrossingEvent *event )
|
||||||
{
|
{
|
||||||
if (captureWnd != 0) return;
|
if (captureWnd != 0) return;
|
||||||
|
|
||||||
winHasCursor = event->window;
|
winHasCursor = event->window;
|
||||||
|
PostMessage( hwnd, WM_SETCURSOR, hwnd, 0 );
|
||||||
switch(event->type)
|
|
||||||
{
|
|
||||||
case EnterNotify:
|
|
||||||
PostMessage( hwnd, WM_SETCURSOR, hwnd, 0 );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -604,15 +477,9 @@ HWND SetCapture(HWND wnd)
|
||||||
if (wnd_p == NULL)
|
if (wnd_p == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#ifdef USE_XLIB
|
rv = XGrabPointer(display, wnd_p->window, False,
|
||||||
rv = XGrabPointer(XT_display, wnd_p->window, False,
|
|
||||||
ButtonPressMask | ButtonReleaseMask | ButtonMotionMask,
|
ButtonPressMask | ButtonReleaseMask | ButtonMotionMask,
|
||||||
GrabModeAsync, GrabModeSync, None, None, CurrentTime);
|
GrabModeAsync, GrabModeSync, None, None, CurrentTime);
|
||||||
#else
|
|
||||||
rv = XtGrabPointer(wnd_p->winWidget, False,
|
|
||||||
ButtonPressMask | ButtonReleaseMask | ButtonMotionMask,
|
|
||||||
GrabModeAsync, GrabModeSync, None, None, CurrentTime);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (rv == GrabSuccess)
|
if (rv == GrabSuccess)
|
||||||
{
|
{
|
||||||
|
@ -637,12 +504,7 @@ void ReleaseCapture()
|
||||||
if (wnd_p == NULL)
|
if (wnd_p == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef USE_XLIB
|
XUngrabPointer( display, CurrentTime );
|
||||||
XUngrabPointer( XT_display, CurrentTime );
|
|
||||||
#else
|
|
||||||
XtUngrabPointer(wnd_p->winWidget, CurrentTime);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
captureWnd = 0;
|
captureWnd = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -653,24 +515,3 @@ HWND GetCapture()
|
||||||
{
|
{
|
||||||
return captureWnd;
|
return captureWnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**********************************************************************
|
|
||||||
* SetDoubleClickTime (USER.20)
|
|
||||||
*/
|
|
||||||
void SetDoubleClickTime (WORD interval)
|
|
||||||
{
|
|
||||||
if (interval == 0)
|
|
||||||
dblclick_time = 500;
|
|
||||||
else
|
|
||||||
dblclick_time = interval;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**********************************************************************
|
|
||||||
* GetDoubleClickTime (USER.21)
|
|
||||||
*/
|
|
||||||
WORD GetDoubleClickTime ()
|
|
||||||
{
|
|
||||||
return ((WORD)dblclick_time);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -27,13 +27,19 @@ HWND SetFocus(HWND hwnd)
|
||||||
|
|
||||||
if (hwnd == 0)
|
if (hwnd == 0)
|
||||||
{
|
{
|
||||||
XSetInputFocus(XT_display, None, RevertToPointerRoot, CurrentTime);
|
XSetInputFocus(display, None, RevertToPointerRoot, CurrentTime);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
XWindowAttributes win_attr;
|
||||||
wndPtr = WIN_FindWndPtr(hwnd);
|
wndPtr = WIN_FindWndPtr(hwnd);
|
||||||
XSetInputFocus(XT_display, wndPtr->window,
|
|
||||||
RevertToParent, CurrentTime);
|
if (XGetWindowAttributes( display, wndPtr->window, &win_attr ))
|
||||||
|
{
|
||||||
|
if (win_attr.map_state == IsViewable)
|
||||||
|
XSetInputFocus(display, wndPtr->window,
|
||||||
|
RevertToParent, CurrentTime);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return hWndPrevFocus;
|
return hWndPrevFocus;
|
||||||
|
|
|
@ -7,7 +7,9 @@
|
||||||
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
#include <X11/Xutil.h>
|
||||||
#ifndef PI
|
#ifndef PI
|
||||||
#define PI M_PI
|
#define PI M_PI
|
||||||
#endif
|
#endif
|
||||||
|
@ -412,49 +414,45 @@ void DrawFocusRect( HDC hdc, LPRECT rc )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
|
||||||
* Line (Not a MSWin Call)
|
|
||||||
*/
|
|
||||||
void Line(HDC hDC, int X1, int Y1, int X2, int Y2)
|
|
||||||
{
|
|
||||||
MoveTo(hDC, X1, Y1);
|
|
||||||
LineTo(hDC, X2, Y2);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* DrawReliefRect (Not a MSWin Call)
|
* DrawReliefRect (Not a MSWin Call)
|
||||||
*/
|
*/
|
||||||
void DrawReliefRect(HDC hDC, RECT rect, int ThickNess, int Mode)
|
void DrawReliefRect( HDC hdc, RECT rect, int thickness, BOOL pressed )
|
||||||
{
|
{
|
||||||
HPEN hWHITEPen;
|
HBRUSH hbrushOld, hbrushShadow, hbrushHighlight;
|
||||||
HPEN hDKGRAYPen;
|
int i;
|
||||||
HPEN hOldPen;
|
|
||||||
int OldColor;
|
hbrushShadow = CreateSolidBrush( GetSysColor(COLOR_BTNSHADOW) );
|
||||||
rect.right--; rect.bottom--;
|
hbrushHighlight = CreateSolidBrush( GetSysColor(COLOR_BTNHIGHLIGHT) );
|
||||||
hDKGRAYPen = CreatePen(PS_SOLID, 1, 0x00808080L);
|
|
||||||
hWHITEPen = GetStockObject(WHITE_PEN);
|
if (pressed) hbrushOld = SelectObject( hdc, hbrushShadow );
|
||||||
hOldPen = SelectObject(hDC, hWHITEPen);
|
else hbrushOld = SelectObject( hdc, hbrushHighlight );
|
||||||
while(ThickNess > 0) {
|
|
||||||
if (Mode == 0)
|
for (i = 0; i < thickness; i++)
|
||||||
SelectObject(hDC, hWHITEPen);
|
{
|
||||||
else
|
PatBlt( hdc, rect.left + i, rect.top,
|
||||||
SelectObject(hDC, hDKGRAYPen);
|
1, rect.bottom - rect.top - i, PATCOPY );
|
||||||
Line(hDC, rect.left, rect.top, rect.right, rect.top);
|
PatBlt( hdc, rect.left, rect.top + i,
|
||||||
Line(hDC, rect.left, rect.top, rect.left, rect.bottom + 1);
|
rect.right - rect.left - i, 1, PATCOPY );
|
||||||
if (Mode == 0)
|
|
||||||
SelectObject(hDC, hDKGRAYPen);
|
|
||||||
else
|
|
||||||
SelectObject(hDC, hWHITEPen);
|
|
||||||
Line(hDC, rect.right, rect.bottom, rect.left, rect.bottom);
|
|
||||||
Line(hDC, rect.right, rect.bottom, rect.right, rect.top - 1);
|
|
||||||
InflateRect(&rect, -1, -1);
|
|
||||||
ThickNess--;
|
|
||||||
}
|
}
|
||||||
SelectObject(hDC, hOldPen);
|
|
||||||
DeleteObject(hDKGRAYPen);
|
if (pressed) hbrushOld = SelectObject( hdc, hbrushHighlight );
|
||||||
|
else hbrushOld = SelectObject( hdc, hbrushShadow );
|
||||||
|
|
||||||
|
for (i = 0; i < thickness; i++)
|
||||||
|
{
|
||||||
|
PatBlt( hdc, rect.right - i - 1, rect.top + i,
|
||||||
|
1, rect.bottom - rect.top - i, PATCOPY );
|
||||||
|
PatBlt( hdc, rect.left + i, rect.bottom - i - 1,
|
||||||
|
rect.right - rect.left - i, 1, PATCOPY );
|
||||||
|
}
|
||||||
|
|
||||||
|
SelectObject( hdc, hbrushOld );
|
||||||
|
DeleteObject( hbrushShadow );
|
||||||
|
DeleteObject( hbrushHighlight );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Polyline (GDI.37)
|
* Polyline (GDI.37)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -17,15 +17,15 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
||||||
|
|
||||||
#include "message.h"
|
#include "message.h"
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
|
#include "wineopts.h"
|
||||||
|
#include "sysmetrics.h"
|
||||||
|
|
||||||
#define MAX_QUEUE_SIZE 120 /* Max. size of a message queue */
|
#define MAX_QUEUE_SIZE 120 /* Max. size of a message queue */
|
||||||
|
|
||||||
extern BOOL TIMER_CheckTimer( DWORD *next ); /* timer.c */
|
extern BOOL TIMER_CheckTimer( DWORD *next ); /* timer.c */
|
||||||
|
extern void EVENT_ProcessEvent( XEvent *event ); /* event.c */
|
||||||
extern Display * XT_display;
|
|
||||||
extern Screen * XT_screen;
|
extern Display * display;
|
||||||
extern XtAppContext XT_app_context;
|
|
||||||
|
|
||||||
/* System message queue (for hardware events) */
|
/* System message queue (for hardware events) */
|
||||||
static HANDLE hmemSysMsgQueue = 0;
|
static HANDLE hmemSysMsgQueue = 0;
|
||||||
|
@ -35,6 +35,10 @@ static MESSAGEQUEUE * sysMsgQueue = NULL;
|
||||||
static HANDLE hmemAppMsgQueue = 0;
|
static HANDLE hmemAppMsgQueue = 0;
|
||||||
static MESSAGEQUEUE * appMsgQueue = NULL;
|
static MESSAGEQUEUE * appMsgQueue = NULL;
|
||||||
|
|
||||||
|
/* Double-click time */
|
||||||
|
static int doubleClickSpeed = 452;
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* MSG_CreateMsgQueue
|
* MSG_CreateMsgQueue
|
||||||
*
|
*
|
||||||
|
@ -78,7 +82,8 @@ static HANDLE MSG_CreateMsgQueue( int size )
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* MSG_CreateSysMsgQueue
|
* MSG_CreateSysMsgQueue
|
||||||
*
|
*
|
||||||
* Create the system message queue. Must be called only once.
|
* Create the system message queue, and set the double-click speed.
|
||||||
|
* Must be called only once.
|
||||||
*/
|
*/
|
||||||
BOOL MSG_CreateSysMsgQueue( int size )
|
BOOL MSG_CreateSysMsgQueue( int size )
|
||||||
{
|
{
|
||||||
|
@ -86,6 +91,7 @@ BOOL MSG_CreateSysMsgQueue( int size )
|
||||||
else if (size <= 0) size = 1;
|
else if (size <= 0) size = 1;
|
||||||
if (!(hmemSysMsgQueue = MSG_CreateMsgQueue( size ))) return FALSE;
|
if (!(hmemSysMsgQueue = MSG_CreateMsgQueue( size ))) return FALSE;
|
||||||
sysMsgQueue = (MESSAGEQUEUE *) GlobalLock( hmemSysMsgQueue );
|
sysMsgQueue = (MESSAGEQUEUE *) GlobalLock( hmemSysMsgQueue );
|
||||||
|
doubleClickSpeed = GetProfileInt( "windows", "DoubleClickSpeed", 452 );
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,6 +105,8 @@ static int MSG_AddMsg( MESSAGEQUEUE * msgQueue, MSG * msg, DWORD extraInfo )
|
||||||
{
|
{
|
||||||
int pos;
|
int pos;
|
||||||
|
|
||||||
|
SpyMessage(msg->hwnd, msg->message, msg->wParam, msg->lParam);
|
||||||
|
|
||||||
if (!msgQueue) return FALSE;
|
if (!msgQueue) return FALSE;
|
||||||
pos = msgQueue->nextFreeMessage;
|
pos = msgQueue->nextFreeMessage;
|
||||||
|
|
||||||
|
@ -183,6 +191,93 @@ static void MSG_RemoveMsg( MESSAGEQUEUE * msgQueue, int pos )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* MSG_TranslateMouseMsg
|
||||||
|
*
|
||||||
|
* Translate an mouse hardware event into a real mouse message.
|
||||||
|
* Actions performed:
|
||||||
|
* - Translate button down messages in double-clicks.
|
||||||
|
* - Send the WM_NCHITTEST message to find where the cursor is.
|
||||||
|
* - Translate the message into a non-client message, or translate
|
||||||
|
* the coordinates to client coordinates.
|
||||||
|
*/
|
||||||
|
static void MSG_TranslateMouseMsg( MSG *msg )
|
||||||
|
{
|
||||||
|
static DWORD lastClickTime = 0;
|
||||||
|
static WORD lastClickMsg = 0;
|
||||||
|
static POINT lastClickPos = { 0, 0 };
|
||||||
|
|
||||||
|
LONG hittest_result = SendMessage( msg->hwnd, WM_NCHITTEST, 0,
|
||||||
|
MAKELONG( msg->pt.x, msg->pt.y ) );
|
||||||
|
|
||||||
|
if ((msg->message == WM_LBUTTONDOWN) ||
|
||||||
|
(msg->message == WM_RBUTTONDOWN) ||
|
||||||
|
(msg->message == WM_MBUTTONDOWN))
|
||||||
|
{
|
||||||
|
BOOL dbl_click = FALSE;
|
||||||
|
|
||||||
|
/* Check for double-click */
|
||||||
|
|
||||||
|
if ((msg->message == lastClickMsg) &&
|
||||||
|
(msg->time - lastClickTime < doubleClickSpeed) &&
|
||||||
|
(abs(msg->pt.x - lastClickPos.x) < SYSMETRICS_CXDOUBLECLK/2) &&
|
||||||
|
(abs(msg->pt.y - lastClickPos.y) < SYSMETRICS_CYDOUBLECLK/2))
|
||||||
|
dbl_click = TRUE;
|
||||||
|
|
||||||
|
if (dbl_click && (hittest_result == HTCLIENT))
|
||||||
|
{
|
||||||
|
/* Check whether window wants the double click message. */
|
||||||
|
WND * wndPtr = WIN_FindWndPtr( msg->hwnd );
|
||||||
|
if (!wndPtr || !(wndPtr->flags & WIN_DOUBLE_CLICKS))
|
||||||
|
dbl_click = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dbl_click) switch(msg->message)
|
||||||
|
{
|
||||||
|
case WM_LBUTTONDOWN: msg->message = WM_LBUTTONDBLCLK; break;
|
||||||
|
case WM_RBUTTONDOWN: msg->message = WM_RBUTTONDBLCLK; break;
|
||||||
|
case WM_MBUTTONDOWN: msg->message = WM_MBUTTONDBLCLK; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
lastClickTime = msg->time;
|
||||||
|
lastClickMsg = msg->message;
|
||||||
|
lastClickPos = msg->pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
msg->lParam = MAKELONG( msg->pt.x, msg->pt.y );
|
||||||
|
if (hittest_result == HTCLIENT)
|
||||||
|
{
|
||||||
|
ScreenToClient( msg->hwnd, (LPPOINT)&msg->lParam );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg->wParam = hittest_result;
|
||||||
|
msg->message += WM_NCLBUTTONDOWN - WM_LBUTTONDOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* SetDoubleClickTime (USER.20)
|
||||||
|
*/
|
||||||
|
void SetDoubleClickTime( WORD interval )
|
||||||
|
{
|
||||||
|
if (interval == 0)
|
||||||
|
doubleClickSpeed = 500;
|
||||||
|
else
|
||||||
|
doubleClickSpeed = interval;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* GetDoubleClickTime (USER.21)
|
||||||
|
*/
|
||||||
|
WORD GetDoubleClickTime()
|
||||||
|
{
|
||||||
|
return (WORD)doubleClickSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* MSG_IncPaintCount
|
* MSG_IncPaintCount
|
||||||
*/
|
*/
|
||||||
|
@ -233,6 +328,7 @@ void MSG_DecTimerCount( HANDLE hQueue )
|
||||||
* hardware_event
|
* hardware_event
|
||||||
*
|
*
|
||||||
* Add an event to the system message queue.
|
* Add an event to the system message queue.
|
||||||
|
* Note: the position is in screen coordinates.
|
||||||
*/
|
*/
|
||||||
void hardware_event( HWND hwnd, WORD message, WORD wParam, LONG lParam,
|
void hardware_event( HWND hwnd, WORD message, WORD wParam, LONG lParam,
|
||||||
WORD xPos, WORD yPos, DWORD time, DWORD extraInfo )
|
WORD xPos, WORD yPos, DWORD time, DWORD extraInfo )
|
||||||
|
@ -325,24 +421,6 @@ BOOL GetInputState()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef USE_XLIB
|
|
||||||
static XtIntervalId xt_timer = 0;
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* MSG_TimerCallback
|
|
||||||
*/
|
|
||||||
static void MSG_TimerCallback( XtPointer data, XtIntervalId * xtid )
|
|
||||||
{
|
|
||||||
DWORD nextExp;
|
|
||||||
TIMER_CheckTimer( &nextExp );
|
|
||||||
if (nextExp != (DWORD)-1)
|
|
||||||
xt_timer = XtAppAddTimeOut( XT_app_context, nextExp,
|
|
||||||
MSG_TimerCallback, NULL );
|
|
||||||
else xt_timer = 0;
|
|
||||||
}
|
|
||||||
#endif /* USE_XLIB */
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* MSG_PeekMessage
|
* MSG_PeekMessage
|
||||||
*/
|
*/
|
||||||
|
@ -351,9 +429,7 @@ static BOOL MSG_PeekMessage( MESSAGEQUEUE * msgQueue, LPMSG msg, HWND hwnd,
|
||||||
{
|
{
|
||||||
int pos, mask;
|
int pos, mask;
|
||||||
DWORD nextExp; /* Next timer expiration time */
|
DWORD nextExp; /* Next timer expiration time */
|
||||||
#ifdef USE_XLIB
|
|
||||||
XEvent event;
|
XEvent event;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (first || last)
|
if (first || last)
|
||||||
{
|
{
|
||||||
|
@ -366,16 +442,11 @@ static BOOL MSG_PeekMessage( MESSAGEQUEUE * msgQueue, LPMSG msg, HWND hwnd,
|
||||||
}
|
}
|
||||||
else mask = QS_MOUSE | QS_KEY | QS_POSTMESSAGE | QS_TIMER | QS_PAINT;
|
else mask = QS_MOUSE | QS_KEY | QS_POSTMESSAGE | QS_TIMER | QS_PAINT;
|
||||||
|
|
||||||
#ifdef USE_XLIB
|
while (XPending( display ))
|
||||||
while (XPending( XT_display ))
|
|
||||||
{
|
{
|
||||||
XNextEvent( XT_display, &event );
|
XNextEvent( display, &event );
|
||||||
EVENT_ProcessEvent( &event );
|
EVENT_ProcessEvent( &event );
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
while (XtAppPending( XT_app_context ))
|
|
||||||
XtAppProcessEvent( XT_app_context, XtIMAll );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
|
@ -432,6 +503,8 @@ static BOOL MSG_PeekMessage( MESSAGEQUEUE * msgQueue, LPMSG msg, HWND hwnd,
|
||||||
msgQueue->GetMessageExtraInfoVal = qmsg->extraInfo;
|
msgQueue->GetMessageExtraInfoVal = qmsg->extraInfo;
|
||||||
|
|
||||||
if (flags & PM_REMOVE) MSG_RemoveMsg( sysMsgQueue, pos );
|
if (flags & PM_REMOVE) MSG_RemoveMsg( sysMsgQueue, pos );
|
||||||
|
if ((msg->message >= WM_MOUSEFIRST) &&
|
||||||
|
(msg->message <= WM_MOUSELAST)) MSG_TranslateMouseMsg( msg );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -447,26 +520,16 @@ static BOOL MSG_PeekMessage( MESSAGEQUEUE * msgQueue, LPMSG msg, HWND hwnd,
|
||||||
|
|
||||||
/* Finally handle WM_TIMER messages */
|
/* Finally handle WM_TIMER messages */
|
||||||
if ((msgQueue->status & QS_TIMER) && (mask & QS_TIMER))
|
if ((msgQueue->status & QS_TIMER) && (mask & QS_TIMER))
|
||||||
{
|
if (TIMER_CheckTimer( &nextExp ))
|
||||||
BOOL posted = TIMER_CheckTimer( &nextExp );
|
continue; /* Restart the whole search */
|
||||||
#ifndef USE_XLIB
|
|
||||||
if (xt_timer) XtRemoveTimeOut( xt_timer );
|
|
||||||
if (nextExp != (DWORD)-1)
|
|
||||||
xt_timer = XtAppAddTimeOut( XT_app_context, nextExp,
|
|
||||||
MSG_TimerCallback, NULL );
|
|
||||||
else xt_timer = 0;
|
|
||||||
#endif
|
|
||||||
if (posted) continue; /* Restart the whole thing */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Wait until something happens */
|
/* Wait until something happens */
|
||||||
if (peek) return FALSE;
|
if (peek) return FALSE;
|
||||||
#ifdef USE_XLIB
|
if (!XPending( display ) && (nextExp != -1))
|
||||||
if (!XPending( XT_display ) && (nextExp != -1))
|
|
||||||
{
|
{
|
||||||
fd_set read_set;
|
fd_set read_set;
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
int fd = ConnectionNumber(XT_display);
|
int fd = ConnectionNumber(display);
|
||||||
FD_ZERO( &read_set );
|
FD_ZERO( &read_set );
|
||||||
FD_SET( fd, &read_set );
|
FD_SET( fd, &read_set );
|
||||||
timeout.tv_sec = nextExp / 1000;
|
timeout.tv_sec = nextExp / 1000;
|
||||||
|
@ -474,11 +537,8 @@ static BOOL MSG_PeekMessage( MESSAGEQUEUE * msgQueue, LPMSG msg, HWND hwnd,
|
||||||
if (select( fd+1, &read_set, NULL, NULL, &timeout ) != 1)
|
if (select( fd+1, &read_set, NULL, NULL, &timeout ) != 1)
|
||||||
continue; /* On timeout or error, restart from the start */
|
continue; /* On timeout or error, restart from the start */
|
||||||
}
|
}
|
||||||
XNextEvent( XT_display, &event );
|
XNextEvent( display, &event );
|
||||||
EVENT_ProcessEvent( &event );
|
EVENT_ProcessEvent( &event );
|
||||||
#else
|
|
||||||
XtAppProcessEvent( XT_app_context, XtIMAll );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We got a message */
|
/* We got a message */
|
||||||
|
@ -529,7 +589,11 @@ BOOL PostMessage( HWND hwnd, WORD message, WORD wParam, LONG lParam )
|
||||||
*/
|
*/
|
||||||
LONG SendMessage( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
|
LONG SendMessage( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
|
||||||
{
|
{
|
||||||
WND * wndPtr = WIN_FindWndPtr( hwnd );
|
WND * wndPtr;
|
||||||
|
|
||||||
|
SpyMessage(hwnd, msg, wParam, lParam);
|
||||||
|
|
||||||
|
wndPtr = WIN_FindWndPtr( hwnd );
|
||||||
if (!wndPtr) return 0;
|
if (!wndPtr) return 0;
|
||||||
return CallWindowProc( wndPtr->lpfnWndProc, hwnd, msg, wParam, lParam );
|
return CallWindowProc( wndPtr->lpfnWndProc, hwnd, msg, wParam, lParam );
|
||||||
}
|
}
|
||||||
|
@ -564,7 +628,7 @@ LONG DispatchMessage( LPMSG msg )
|
||||||
int painting;
|
int painting;
|
||||||
|
|
||||||
#ifdef DEBUG_MSG
|
#ifdef DEBUG_MSG
|
||||||
printf( "Dispatch message hwnd=%08x msg=%d w=%d l=%d time=%u pt=%d,%d\n",
|
printf( "Dispatch message hwnd=%08x msg=0x%x w=%d l=%d time=%u pt=%d,%d\n",
|
||||||
msg->hwnd, msg->message, msg->wParam, msg->lParam,
|
msg->hwnd, msg->message, msg->wParam, msg->lParam,
|
||||||
msg->time, msg->pt.x, msg->pt.y );
|
msg->time, msg->pt.x, msg->pt.y );
|
||||||
#endif
|
#endif
|
||||||
|
@ -587,7 +651,7 @@ LONG DispatchMessage( LPMSG msg )
|
||||||
if (painting && (wndPtr->flags & WIN_NEEDS_BEGINPAINT))
|
if (painting && (wndPtr->flags & WIN_NEEDS_BEGINPAINT))
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_WIN
|
#ifdef DEBUG_WIN
|
||||||
printf( "BeginPaint not called on WM_PAINT!\n" );
|
printf( "BeginPaint not called on WM_PAINT for hwnd %d!\n", msg->hwnd);
|
||||||
#endif
|
#endif
|
||||||
wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT;
|
wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,461 @@
|
||||||
|
/*
|
||||||
|
* Non-client area window functions
|
||||||
|
*
|
||||||
|
* Copyright 1994 Alexandre Julliard
|
||||||
|
*/
|
||||||
|
|
||||||
|
static char Copyright[] = "Copyright Alexandre Julliard, 1994";
|
||||||
|
|
||||||
|
#include "win.h"
|
||||||
|
#include "sysmetrics.h"
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* NC_AdjustRect
|
||||||
|
*
|
||||||
|
* Compute the size of the window rectangle from the size of the
|
||||||
|
* client rectangle.
|
||||||
|
*/
|
||||||
|
static void NC_AdjustRect( LPRECT rect, DWORD style, BOOL menu, DWORD exStyle )
|
||||||
|
{
|
||||||
|
if ((style & WS_DLGFRAME) &&
|
||||||
|
((exStyle & WS_EX_DLGMODALFRAME) || !(style & WS_BORDER)))
|
||||||
|
InflateRect( rect, SYSMETRICS_CXDLGFRAME, SYSMETRICS_CYDLGFRAME );
|
||||||
|
else if (style & WS_THICKFRAME)
|
||||||
|
InflateRect( rect, SYSMETRICS_CXFRAME, SYSMETRICS_CYFRAME );
|
||||||
|
|
||||||
|
if (style & WS_BORDER)
|
||||||
|
InflateRect( rect, SYSMETRICS_CXBORDER, SYSMETRICS_CYBORDER );
|
||||||
|
|
||||||
|
if ((style & WS_CAPTION) == WS_CAPTION)
|
||||||
|
rect->top -= SYSMETRICS_CYCAPTION - 1;
|
||||||
|
|
||||||
|
if (menu) rect->top -= SYSMETRICS_CYMENU + 1;
|
||||||
|
|
||||||
|
if (style & WS_VSCROLL) rect->right += SYSMETRICS_CXVSCROLL;
|
||||||
|
if (style & WS_HSCROLL) rect->bottom += SYSMETRICS_CYHSCROLL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* AdjustWindowRect (USER.102)
|
||||||
|
*/
|
||||||
|
void AdjustWindowRect( LPRECT rect, DWORD style, BOOL menu )
|
||||||
|
{
|
||||||
|
AdjustWindowRectEx( rect, style, menu, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* AdjustWindowRectEx (USER.454)
|
||||||
|
*/
|
||||||
|
void AdjustWindowRectEx( LPRECT rect, DWORD style, BOOL menu, DWORD exStyle )
|
||||||
|
{
|
||||||
|
/* Correct the window style */
|
||||||
|
|
||||||
|
if (!(style & (WS_POPUP | WS_CHILD))) /* Overlapped window */
|
||||||
|
style |= WS_CAPTION;
|
||||||
|
if (exStyle & WS_EX_DLGMODALFRAME) style &= ~WS_THICKFRAME;
|
||||||
|
|
||||||
|
#ifdef DEBUG_NONCLIENT
|
||||||
|
printf( "AdjustWindowRectEx: (%d,%d)-(%d,%d) %08x %d %08x\n",
|
||||||
|
rect->left, rect->top, rect->right, rect->bottom, style, menu, exStyle );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
NC_AdjustRect( rect, style, menu, exStyle );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* NC_HandleNCCalcSize
|
||||||
|
*
|
||||||
|
* Handle a WM_NCCALCSIZE message. Called from DefWindowProc().
|
||||||
|
*/
|
||||||
|
LONG NC_HandleNCCalcSize( HWND hwnd, NCCALCSIZE_PARAMS *params )
|
||||||
|
{
|
||||||
|
RECT tmpRect = { 0, 0, 0, 0 };
|
||||||
|
BOOL hasMenu;
|
||||||
|
WND *wndPtr = WIN_FindWndPtr( hwnd );
|
||||||
|
|
||||||
|
if (!wndPtr) return 0;
|
||||||
|
|
||||||
|
hasMenu = (!(wndPtr->dwStyle & WS_CHILD)) && (wndPtr->wIDmenu != 0);
|
||||||
|
|
||||||
|
NC_AdjustRect( &tmpRect, wndPtr->dwStyle, hasMenu, wndPtr->dwExStyle );
|
||||||
|
|
||||||
|
params->rgrc[0].left -= tmpRect.left;
|
||||||
|
params->rgrc[0].top -= tmpRect.top;
|
||||||
|
params->rgrc[0].right -= tmpRect.right;
|
||||||
|
params->rgrc[0].bottom -= tmpRect.bottom;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* NC_HandleNCHitTest
|
||||||
|
*
|
||||||
|
* Handle a WM_NCHITTEST message. Called from DefWindowProc().
|
||||||
|
*/
|
||||||
|
LONG NC_HandleNCHitTest( HWND hwnd, POINT pt )
|
||||||
|
{
|
||||||
|
RECT rect;
|
||||||
|
WND *wndPtr = WIN_FindWndPtr( hwnd );
|
||||||
|
if (!wndPtr) return HTERROR;
|
||||||
|
|
||||||
|
#ifdef DEBUG_NONCLIENT
|
||||||
|
printf( "NC_HandleNCHitTest: hwnd=%x pt=%d,%d\n", hwnd, pt.x, pt.y );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (hwnd == GetCapture()) return HTCLIENT;
|
||||||
|
GetWindowRect( hwnd, &rect );
|
||||||
|
if (!PtInRect( &rect, pt )) return HTNOWHERE;
|
||||||
|
ScreenToClient( hwnd, &pt );
|
||||||
|
GetClientRect( hwnd, &rect );
|
||||||
|
|
||||||
|
if (PtInRect( &rect, pt )) return HTCLIENT;
|
||||||
|
|
||||||
|
/* Check vertical scroll bar */
|
||||||
|
if (wndPtr->dwStyle & WS_VSCROLL)
|
||||||
|
{
|
||||||
|
rect.right += SYSMETRICS_CXVSCROLL;
|
||||||
|
if (PtInRect( &rect, pt )) return HTVSCROLL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check horizontal scroll bar */
|
||||||
|
if (wndPtr->dwStyle & WS_HSCROLL)
|
||||||
|
{
|
||||||
|
rect.bottom += SYSMETRICS_CYHSCROLL;
|
||||||
|
if (PtInRect( &rect, pt ))
|
||||||
|
{
|
||||||
|
/* Check size box */
|
||||||
|
if ((wndPtr->dwStyle & WS_VSCROLL) &&
|
||||||
|
(pt.x >= rect.right - SYSMETRICS_CXVSCROLL)) return HTSIZE;
|
||||||
|
return HTHSCROLL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check menu */
|
||||||
|
if ((!(wndPtr->dwStyle & WS_CHILD)) && (wndPtr->wIDmenu != 0))
|
||||||
|
{
|
||||||
|
rect.top -= SYSMETRICS_CYMENU + 1;
|
||||||
|
if (PtInRect( &rect, pt )) return HTMENU;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check caption */
|
||||||
|
if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION)
|
||||||
|
{
|
||||||
|
rect.top -= SYSMETRICS_CYCAPTION - 1;
|
||||||
|
if (PtInRect( &rect, pt ))
|
||||||
|
{
|
||||||
|
/* Check system menu */
|
||||||
|
if ((wndPtr->dwStyle & WS_SYSMENU) && (pt.x <= SYSMETRICS_CXSIZE))
|
||||||
|
return HTSYSMENU;
|
||||||
|
/* Check maximize box */
|
||||||
|
if (wndPtr->dwStyle & WS_MAXIMIZEBOX)
|
||||||
|
rect.right -= SYSMETRICS_CXSIZE + 1;
|
||||||
|
if (pt.x >= rect.right) return HTMAXBUTTON;
|
||||||
|
/* Check minimize box */
|
||||||
|
if (wndPtr->dwStyle & WS_MINIMIZEBOX)
|
||||||
|
rect.right -= SYSMETRICS_CXSIZE + 1;
|
||||||
|
if (pt.x >= rect.right) return HTMINBUTTON;
|
||||||
|
return HTCAPTION;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check non-sizing border */
|
||||||
|
if (!(wndPtr->dwStyle & WS_THICKFRAME) ||
|
||||||
|
((wndPtr->dwStyle & (WS_DLGFRAME | WS_BORDER)) == WS_DLGFRAME))
|
||||||
|
return HTBORDER;
|
||||||
|
|
||||||
|
/* Check top sizing border */
|
||||||
|
if (pt.y < rect.top)
|
||||||
|
{
|
||||||
|
if (pt.x < rect.left+SYSMETRICS_CXSIZE) return HTTOPLEFT;
|
||||||
|
if (pt.x >= rect.right-SYSMETRICS_CXSIZE) return HTTOPRIGHT;
|
||||||
|
return HTTOP;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check bottom sizing border */
|
||||||
|
if (pt.y >= rect.bottom)
|
||||||
|
{
|
||||||
|
if (pt.x < rect.left+SYSMETRICS_CXSIZE) return HTBOTTOMLEFT;
|
||||||
|
if (pt.x >= rect.right-SYSMETRICS_CXSIZE) return HTBOTTOMRIGHT;
|
||||||
|
return HTBOTTOM;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check left sizing border */
|
||||||
|
if (pt.x < rect.left)
|
||||||
|
{
|
||||||
|
if (pt.y < rect.top+SYSMETRICS_CYSIZE) return HTTOPLEFT;
|
||||||
|
if (pt.y >= rect.bottom-SYSMETRICS_CYSIZE) return HTBOTTOMLEFT;
|
||||||
|
return HTLEFT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check right sizing border */
|
||||||
|
if (pt.x >= rect.right)
|
||||||
|
{
|
||||||
|
if (pt.y < rect.top+SYSMETRICS_CYSIZE) return HTTOPRIGHT;
|
||||||
|
if (pt.y >= rect.bottom-SYSMETRICS_CYSIZE) return HTBOTTOMRIGHT;
|
||||||
|
return HTRIGHT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Should never get here */
|
||||||
|
return HTERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* NC_DrawFrame
|
||||||
|
*
|
||||||
|
* Draw a window frame inside the given rectangle, and update the rectangle.
|
||||||
|
* The correct pen and brush must be selected in the DC.
|
||||||
|
*/
|
||||||
|
static void NC_DrawFrame( HDC hdc, RECT *rect, BOOL dlgFrame )
|
||||||
|
{
|
||||||
|
short width, height, tmp;
|
||||||
|
|
||||||
|
if (dlgFrame)
|
||||||
|
{
|
||||||
|
width = SYSMETRICS_CXDLGFRAME;
|
||||||
|
height = SYSMETRICS_CYDLGFRAME;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
width = SYSMETRICS_CXFRAME - 1;
|
||||||
|
height = SYSMETRICS_CYFRAME - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Draw frame */
|
||||||
|
PatBlt( hdc, rect->left, rect->top,
|
||||||
|
rect->right - rect->left, height, PATCOPY );
|
||||||
|
PatBlt( hdc, rect->left, rect->top,
|
||||||
|
width, rect->bottom - rect->top, PATCOPY );
|
||||||
|
PatBlt( hdc, rect->left, rect->bottom,
|
||||||
|
rect->right - rect->left, -height, PATCOPY );
|
||||||
|
PatBlt( hdc, rect->right, rect->top,
|
||||||
|
-width, rect->bottom - rect->top, PATCOPY );
|
||||||
|
|
||||||
|
if (dlgFrame)
|
||||||
|
{
|
||||||
|
InflateRect( rect, -width, -height );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Draw inner rectangle */
|
||||||
|
MoveTo( hdc, rect->left+width, rect->top+height );
|
||||||
|
LineTo( hdc, rect->right-width-1, rect->top+height );
|
||||||
|
LineTo( hdc, rect->right-width-1, rect->bottom-height-1 );
|
||||||
|
LineTo( hdc, rect->left+width, rect->bottom-height-1 );
|
||||||
|
LineTo( hdc, rect->left+width, rect->top+height );
|
||||||
|
|
||||||
|
/* Draw the decorations */
|
||||||
|
tmp = rect->top + SYSMETRICS_CYFRAME + SYSMETRICS_CYSIZE;
|
||||||
|
MoveTo( hdc, rect->left, tmp);
|
||||||
|
LineTo( hdc, rect->left+width, tmp );
|
||||||
|
MoveTo( hdc, rect->right-width-1, tmp );
|
||||||
|
LineTo( hdc, rect->right-1, tmp );
|
||||||
|
|
||||||
|
tmp = rect->bottom - 1 - SYSMETRICS_CYFRAME - SYSMETRICS_CYSIZE;
|
||||||
|
MoveTo( hdc, rect->left, tmp );
|
||||||
|
LineTo( hdc, rect->left+width, tmp );
|
||||||
|
MoveTo( hdc, rect->right-width-1, tmp );
|
||||||
|
LineTo( hdc, rect->right-1, tmp );
|
||||||
|
|
||||||
|
tmp = rect->left + SYSMETRICS_CXFRAME + SYSMETRICS_CXSIZE;
|
||||||
|
MoveTo( hdc, tmp, rect->top );
|
||||||
|
LineTo( hdc, tmp, rect->top+height );
|
||||||
|
MoveTo( hdc, tmp, rect->bottom-height-1 );
|
||||||
|
LineTo( hdc, tmp, rect->bottom-1 );
|
||||||
|
|
||||||
|
tmp = rect->right - 1 - SYSMETRICS_CXFRAME - SYSMETRICS_CYSIZE;
|
||||||
|
MoveTo( hdc, tmp, rect->top );
|
||||||
|
LineTo( hdc, tmp, rect->top+height );
|
||||||
|
MoveTo( hdc, tmp, rect->bottom-height-1 );
|
||||||
|
LineTo( hdc, tmp, rect->bottom-1 );
|
||||||
|
|
||||||
|
InflateRect( rect, -width-1, -height-1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* NC_DrawCaption
|
||||||
|
*
|
||||||
|
* Draw the window caption.
|
||||||
|
* The correct pen for the window frame must be selected in the DC.
|
||||||
|
*/
|
||||||
|
static void NC_DrawCaption( HDC hdc, RECT *rect, HWND hwnd, DWORD style )
|
||||||
|
{
|
||||||
|
RECT r;
|
||||||
|
HBRUSH hbrushCaption, hbrushButtons;
|
||||||
|
char buffer[256];
|
||||||
|
|
||||||
|
hbrushButtons = CreateSolidBrush( GetSysColor( COLOR_BTNFACE ) );
|
||||||
|
hbrushCaption = CreateSolidBrush( GetSysColor( COLOR_ACTIVECAPTION ) );
|
||||||
|
|
||||||
|
MoveTo( hdc, rect->left, rect->bottom );
|
||||||
|
LineTo( hdc, rect->right-1, rect->bottom );
|
||||||
|
|
||||||
|
/* We should probably use OEM bitmaps (OBM_*) here */
|
||||||
|
if (style & WS_SYSMENU)
|
||||||
|
{
|
||||||
|
r = *rect;
|
||||||
|
r.right = r.left + SYSMETRICS_CYSIZE;
|
||||||
|
FillRect( hdc, &r, hbrushButtons );
|
||||||
|
MoveTo( hdc, r.right, r.top );
|
||||||
|
LineTo( hdc, r.right, r.bottom );
|
||||||
|
rect->left += SYSMETRICS_CXSIZE + 1;
|
||||||
|
}
|
||||||
|
if (style & WS_MAXIMIZEBOX)
|
||||||
|
{
|
||||||
|
r = *rect;
|
||||||
|
r.left = r.right - SYSMETRICS_CXSIZE;
|
||||||
|
FillRect( hdc, &r, hbrushButtons );
|
||||||
|
MoveTo( hdc, r.left-1, r.top );
|
||||||
|
LineTo( hdc, r.left-1, r.bottom );
|
||||||
|
DrawReliefRect( hdc, r, 2, 0 );
|
||||||
|
rect->right -= SYSMETRICS_CXSIZE + 1;
|
||||||
|
}
|
||||||
|
if (style & WS_MINIMIZEBOX)
|
||||||
|
{
|
||||||
|
r = *rect;
|
||||||
|
r.left = r.right - SYSMETRICS_CXSIZE;
|
||||||
|
FillRect( hdc, &r, hbrushButtons );
|
||||||
|
MoveTo( hdc, r.left-1, r.top );
|
||||||
|
LineTo( hdc, r.left-1, r.bottom );
|
||||||
|
DrawReliefRect( hdc, r, 2, 0 );
|
||||||
|
rect->right -= SYSMETRICS_CXSIZE + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
FillRect( hdc, rect, hbrushCaption );
|
||||||
|
|
||||||
|
if (GetWindowText( hwnd, buffer, 256 ))
|
||||||
|
{
|
||||||
|
SetTextColor( hdc, GetSysColor( COLOR_CAPTIONTEXT ) );
|
||||||
|
SetBkMode( hdc, TRANSPARENT );
|
||||||
|
DrawText( hdc, buffer, -1, rect,
|
||||||
|
DT_SINGLELINE | DT_CENTER | DT_VCENTER );
|
||||||
|
}
|
||||||
|
|
||||||
|
DeleteObject( hbrushButtons );
|
||||||
|
DeleteObject( hbrushCaption );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* NC_HandleNCPaint
|
||||||
|
*
|
||||||
|
* Handle a WM_NCPAINT message. Called from DefWindowProc().
|
||||||
|
*/
|
||||||
|
LONG NC_HandleNCPaint( HWND hwnd, HRGN hrgn )
|
||||||
|
{
|
||||||
|
HDC hdc;
|
||||||
|
RECT rect;
|
||||||
|
HBRUSH hbrushBorder = 0;
|
||||||
|
HPEN hpenFrame = 0;
|
||||||
|
|
||||||
|
WND *wndPtr = WIN_FindWndPtr( hwnd );
|
||||||
|
|
||||||
|
#ifdef DEBUG_NONCLIENT
|
||||||
|
printf( "NC_HandleNCPaint: %d %d\n", hwnd, hrgn );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!wndPtr || !hrgn) return 0;
|
||||||
|
if (!(wndPtr->dwStyle & (WS_BORDER | WS_DLGFRAME | WS_THICKFRAME)))
|
||||||
|
return 0; /* Nothing to do! */
|
||||||
|
|
||||||
|
if (hrgn == 1) hdc = GetDCEx( hwnd, 0, DCX_CACHE | DCX_WINDOW );
|
||||||
|
else hdc = GetDCEx( hwnd, hrgn, DCX_CACHE | DCX_WINDOW | DCX_INTERSECTRGN);
|
||||||
|
if (!hdc) return 0;
|
||||||
|
if (ExcludeVisRect( hdc, wndPtr->rectClient.left-wndPtr->rectWindow.left,
|
||||||
|
wndPtr->rectClient.top-wndPtr->rectWindow.top,
|
||||||
|
wndPtr->rectClient.right-wndPtr->rectWindow.left,
|
||||||
|
wndPtr->rectClient.bottom-wndPtr->rectWindow.top )
|
||||||
|
== NULLREGION)
|
||||||
|
{
|
||||||
|
ReleaseDC( hwnd, hdc );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
rect.top = rect.left = 0;
|
||||||
|
rect.right = wndPtr->rectWindow.right - wndPtr->rectWindow.left;
|
||||||
|
rect.bottom = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top;
|
||||||
|
|
||||||
|
hpenFrame = CreatePen( PS_SOLID, 1, GetSysColor(COLOR_WINDOWFRAME) );
|
||||||
|
SelectObject( hdc, hpenFrame );
|
||||||
|
hbrushBorder = CreateSolidBrush( GetSysColor(COLOR_ACTIVEBORDER) );
|
||||||
|
SelectObject( hdc, hbrushBorder );
|
||||||
|
|
||||||
|
if ((wndPtr->dwStyle & WS_BORDER) || (wndPtr->dwStyle & WS_DLGFRAME))
|
||||||
|
{
|
||||||
|
MoveTo( hdc, 0, 0 );
|
||||||
|
LineTo( hdc, rect.right-1, 0 );
|
||||||
|
LineTo( hdc, rect.right-1, rect.bottom-1 );
|
||||||
|
LineTo( hdc, 0, rect.bottom-1 );
|
||||||
|
LineTo( hdc, 0, 0 );
|
||||||
|
InflateRect( &rect, -1, -1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((wndPtr->dwStyle & WS_DLGFRAME) &&
|
||||||
|
((wndPtr->dwExStyle & WS_EX_DLGMODALFRAME) ||
|
||||||
|
!(wndPtr->dwStyle & WS_BORDER))) NC_DrawFrame( hdc, &rect, TRUE );
|
||||||
|
else if (wndPtr->dwStyle & WS_THICKFRAME) NC_DrawFrame(hdc, &rect, FALSE);
|
||||||
|
|
||||||
|
if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION)
|
||||||
|
{
|
||||||
|
RECT r = rect;
|
||||||
|
rect.top += SYSMETRICS_CYSIZE + 1;
|
||||||
|
r.bottom = rect.top - 1;
|
||||||
|
if (wndPtr->dwExStyle & WS_EX_DLGMODALFRAME)
|
||||||
|
{
|
||||||
|
HBRUSH hbrushWindow = CreateSolidBrush(GetSysColor(COLOR_WINDOW));
|
||||||
|
HBRUSH hbrushOld = SelectObject( hdc, hbrushWindow );
|
||||||
|
PatBlt( hdc, r.left, r.top, 1, r.bottom-r.top+1, PATCOPY );
|
||||||
|
PatBlt( hdc, r.right-1, r.top, 1, r.bottom-r.top+1, PATCOPY );
|
||||||
|
PatBlt( hdc, r.left, r.top, r.right-r.left, 1, PATCOPY );
|
||||||
|
r.left++;
|
||||||
|
r.right--;
|
||||||
|
r.top++;
|
||||||
|
SelectObject( hdc, hbrushOld );
|
||||||
|
DeleteObject( hbrushWindow );
|
||||||
|
}
|
||||||
|
NC_DrawCaption( hdc, &r, hwnd, wndPtr->dwStyle );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (wndPtr->dwStyle & (WS_VSCROLL | WS_HSCROLL))
|
||||||
|
{
|
||||||
|
HBRUSH hbrushScroll = CreateSolidBrush( GetSysColor(COLOR_SCROLLBAR) );
|
||||||
|
HBRUSH hbrushOld = SelectObject( hdc, hbrushScroll );
|
||||||
|
if (wndPtr->dwStyle & WS_VSCROLL)
|
||||||
|
PatBlt( hdc, rect.right - SYSMETRICS_CXVSCROLL, rect.top,
|
||||||
|
SYSMETRICS_CXVSCROLL, rect.bottom-rect.top, PATCOPY );
|
||||||
|
if (wndPtr->dwStyle & WS_HSCROLL)
|
||||||
|
PatBlt( hdc, rect.left, rect.bottom - SYSMETRICS_CYHSCROLL,
|
||||||
|
rect.right-rect.left, SYSMETRICS_CYHSCROLL, PATCOPY );
|
||||||
|
SelectObject( hdc, hbrushOld );
|
||||||
|
DeleteObject( hbrushScroll );
|
||||||
|
}
|
||||||
|
|
||||||
|
ReleaseDC( hwnd, hdc );
|
||||||
|
if (hbrushBorder) DeleteObject( hbrushBorder );
|
||||||
|
if (hpenFrame) DeleteObject( hpenFrame );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* NC_HandleNCMouseMsg
|
||||||
|
*
|
||||||
|
* Handle a non-client mouse message. Called from DefWindowProc().
|
||||||
|
*/
|
||||||
|
LONG NC_HandleNCMouseMsg( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
|
||||||
|
{
|
||||||
|
switch(wParam) /* Hit test code */
|
||||||
|
{
|
||||||
|
case HTSYSMENU:
|
||||||
|
if (msg == WM_NCLBUTTONDBLCLK)
|
||||||
|
return SendMessage( hwnd, WM_SYSCOMMAND, SC_CLOSE, lParam );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -21,9 +21,12 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
||||||
*/
|
*/
|
||||||
HDC BeginPaint( HWND hwnd, LPPAINTSTRUCT lps )
|
HDC BeginPaint( HWND hwnd, LPPAINTSTRUCT lps )
|
||||||
{
|
{
|
||||||
|
HRGN hrgnUpdate;
|
||||||
WND * wndPtr = WIN_FindWndPtr( hwnd );
|
WND * wndPtr = WIN_FindWndPtr( hwnd );
|
||||||
if (!wndPtr) return 0;
|
if (!wndPtr) return 0;
|
||||||
|
|
||||||
|
hrgnUpdate = wndPtr->hrgnUpdate; /* Save update region */
|
||||||
|
|
||||||
if (!(lps->hdc = GetDCEx( hwnd, wndPtr->hrgnUpdate,
|
if (!(lps->hdc = GetDCEx( hwnd, wndPtr->hrgnUpdate,
|
||||||
DCX_INTERSECTRGN | DCX_USESTYLE ))) return 0;
|
DCX_INTERSECTRGN | DCX_USESTYLE ))) return 0;
|
||||||
GetRgnBox( InquireVisRgn(lps->hdc), &lps->rcPaint );
|
GetRgnBox( InquireVisRgn(lps->hdc), &lps->rcPaint );
|
||||||
|
@ -35,7 +38,8 @@ HDC BeginPaint( HWND hwnd, LPPAINTSTRUCT lps )
|
||||||
MSG_DecPaintCount( wndPtr->hmemTaskQ );
|
MSG_DecPaintCount( wndPtr->hmemTaskQ );
|
||||||
}
|
}
|
||||||
wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT;
|
wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT;
|
||||||
|
|
||||||
|
SendMessage( hwnd, WM_NCPAINT, hrgnUpdate, 0 );
|
||||||
if (!(wndPtr->flags & WIN_ERASE_UPDATERGN)) lps->fErase = TRUE;
|
if (!(wndPtr->flags & WIN_ERASE_UPDATERGN)) lps->fErase = TRUE;
|
||||||
else lps->fErase = !SendMessage( hwnd, WM_ERASEBKGND, lps->hdc, 0 );
|
else lps->fErase = !SendMessage( hwnd, WM_ERASEBKGND, lps->hdc, 0 );
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
/*
|
||||||
|
* System metrics functions
|
||||||
|
*
|
||||||
|
* Copyright 1994 Alexandre Julliard
|
||||||
|
*/
|
||||||
|
|
||||||
|
static char Copyright[] = "Copyright Alexandre Julliard, 1994";
|
||||||
|
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
|
#include "sysmetrics.h"
|
||||||
|
|
||||||
|
|
||||||
|
short sysMetrics[SM_CMETRICS];
|
||||||
|
|
||||||
|
extern Display * display;
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* SYSMETRICS_Init
|
||||||
|
*
|
||||||
|
* Initialisation of the system metrics array.
|
||||||
|
*/
|
||||||
|
void SYSMETRICS_Init()
|
||||||
|
{
|
||||||
|
sysMetrics[SM_CXSCREEN] = DisplayWidth( display, DefaultScreen(display) );
|
||||||
|
sysMetrics[SM_CYSCREEN] = DisplayHeight( display, DefaultScreen(display) );
|
||||||
|
sysMetrics[SM_CXVSCROLL] = SYSMETRICS_CXVSCROLL;
|
||||||
|
sysMetrics[SM_CYHSCROLL] = SYSMETRICS_CYHSCROLL;
|
||||||
|
sysMetrics[SM_CYCAPTION] = SYSMETRICS_CYCAPTION;
|
||||||
|
sysMetrics[SM_CXBORDER] = SYSMETRICS_CXBORDER;
|
||||||
|
sysMetrics[SM_CYBORDER] = SYSMETRICS_CYBORDER;
|
||||||
|
sysMetrics[SM_CXDLGFRAME] = SYSMETRICS_CXDLGFRAME;
|
||||||
|
sysMetrics[SM_CYDLGFRAME] = SYSMETRICS_CYDLGFRAME;
|
||||||
|
sysMetrics[SM_CYVTHUMB] = SYSMETRICS_CYVTHUMB;
|
||||||
|
sysMetrics[SM_CXHTHUMB] = SYSMETRICS_CXHTHUMB;
|
||||||
|
sysMetrics[SM_CXICON] = SYSMETRICS_CXICON;
|
||||||
|
sysMetrics[SM_CYICON] = SYSMETRICS_CYICON;
|
||||||
|
sysMetrics[SM_CXCURSOR] = SYSMETRICS_CXCURSOR;
|
||||||
|
sysMetrics[SM_CYCURSOR] = SYSMETRICS_CYCURSOR;
|
||||||
|
sysMetrics[SM_CYMENU] = SYSMETRICS_CYMENU;
|
||||||
|
sysMetrics[SM_CXFULLSCREEN] = sysMetrics[SM_CXSCREEN];
|
||||||
|
sysMetrics[SM_CYFULLSCREEN] = sysMetrics[SM_CYSCREEN] - sysMetrics[SM_CYCAPTION];
|
||||||
|
sysMetrics[SM_CYKANJIWINDOW] = 0;
|
||||||
|
sysMetrics[SM_MOUSEPRESENT] = 1;
|
||||||
|
sysMetrics[SM_CYVSCROLL] = SYSMETRICS_CYVSCROLL;
|
||||||
|
sysMetrics[SM_CXHSCROLL] = SYSMETRICS_CXHSCROLL;
|
||||||
|
sysMetrics[SM_DEBUG] = 0;
|
||||||
|
sysMetrics[SM_SWAPBUTTON] = 0;
|
||||||
|
sysMetrics[SM_RESERVED1] = 0;
|
||||||
|
sysMetrics[SM_RESERVED2] = 0;
|
||||||
|
sysMetrics[SM_RESERVED3] = 0;
|
||||||
|
sysMetrics[SM_RESERVED4] = 0;
|
||||||
|
sysMetrics[SM_CXMIN] = SYSMETRICS_CXMIN;
|
||||||
|
sysMetrics[SM_CYMIN] = SYSMETRICS_CYMIN;
|
||||||
|
sysMetrics[SM_CXSIZE] = SYSMETRICS_CXSIZE;
|
||||||
|
sysMetrics[SM_CYSIZE] = SYSMETRICS_CYSIZE;
|
||||||
|
sysMetrics[SM_CXFRAME] = GetProfileInt( "windows", "BorderWidth", 4 );
|
||||||
|
sysMetrics[SM_CYFRAME] = sysMetrics[SM_CXFRAME];
|
||||||
|
sysMetrics[SM_CXMINTRACK] = SYSMETRICS_CXMINTRACK;
|
||||||
|
sysMetrics[SM_CYMINTRACK] = SYSMETRICS_CYMINTRACK;
|
||||||
|
sysMetrics[SM_CXDOUBLECLK] = (GetProfileInt( "windows","DoubleClickWidth", 4) + 1) & ~1;
|
||||||
|
sysMetrics[SM_CYDOUBLECLK] = (GetProfileInt( "windows","DoubleClickHeight", 4) + 1) & ~1;
|
||||||
|
sysMetrics[SM_CXICONSPACING] = GetProfileInt( "desktop","IconSpacing", 75);
|
||||||
|
sysMetrics[SM_CYICONSPACING] = GetProfileInt( "desktop","IconVerticalSpacing", 72);
|
||||||
|
sysMetrics[SM_MENUDROPALIGNMENT] = GetProfileInt( "windows","MenuDropAlignment", 0 );
|
||||||
|
sysMetrics[SM_PENWINDOWS] = 0;
|
||||||
|
sysMetrics[SM_DBCSENABLED] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* GetSystemMetrics (USER.179)
|
||||||
|
*/
|
||||||
|
int GetSystemMetrics( WORD index )
|
||||||
|
{
|
||||||
|
if (index >= SM_CMETRICS) return 0;
|
||||||
|
else return sysMetrics[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
306
windows/win.c
306
windows/win.c
|
@ -15,11 +15,13 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
#include "user.h"
|
#include "user.h"
|
||||||
#include "dce.h"
|
#include "dce.h"
|
||||||
|
#include "sysmetrics.h"
|
||||||
|
|
||||||
extern Display * XT_display;
|
extern Display * display;
|
||||||
extern Screen * XT_screen;
|
|
||||||
extern Colormap COLOR_WinColormap;
|
extern Colormap COLOR_WinColormap;
|
||||||
|
|
||||||
|
extern void EVENT_RegisterWindow( Window w, HWND hwnd ); /* event.c */
|
||||||
|
|
||||||
static HWND firstWindow = 0;
|
static HWND firstWindow = 0;
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -178,17 +180,22 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
|
||||||
CREATESTRUCT *createStruct;
|
CREATESTRUCT *createStruct;
|
||||||
HANDLE hcreateStruct;
|
HANDLE hcreateStruct;
|
||||||
int wmcreate;
|
int wmcreate;
|
||||||
short newwidth, newheight;
|
XSetWindowAttributes win_attr;
|
||||||
|
Window parentWindow;
|
||||||
|
int x_rel, y_rel;
|
||||||
|
LPPOPUPMENU lpbar;
|
||||||
|
|
||||||
#ifdef DEBUG_WIN
|
#ifdef DEBUG_WIN
|
||||||
printf( "CreateWindowEx: %s %s %d,%d %dx%d %08x\n",
|
printf( "CreateWindowEx: %d '%s' '%s' %d,%d %dx%d %08x %x\n",
|
||||||
className, windowName, x, y, width, height, style );
|
exStyle, className, windowName, x, y, width, height, style, parent);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (x == CW_USEDEFAULT) x = 0;
|
if (x == CW_USEDEFAULT) x = y = 0;
|
||||||
if (y == CW_USEDEFAULT) y = 0;
|
if (width == CW_USEDEFAULT)
|
||||||
if (width == CW_USEDEFAULT) width = 600;
|
{
|
||||||
if (height == CW_USEDEFAULT) height = 400;
|
width = 600;
|
||||||
|
height = 400;
|
||||||
|
}
|
||||||
if (width == 0) width = 1;
|
if (width == 0) width = 1;
|
||||||
if (height == 0) height = 1;
|
if (height == 0) height = 1;
|
||||||
|
|
||||||
|
@ -201,11 +208,18 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
|
||||||
if (!parent) return 0;
|
if (!parent) return 0;
|
||||||
}
|
}
|
||||||
else if (style & WS_CHILD) return 0; /* WS_CHILD needs a parent */
|
else if (style & WS_CHILD) return 0; /* WS_CHILD needs a parent */
|
||||||
|
|
||||||
if (!(class = CLASS_FindClassByName( className, &classPtr ))) {
|
if (!(class = CLASS_FindClassByName( className, &classPtr ))) {
|
||||||
printf("CreateWindow BAD CLASSNAME '%s' !\n", className);
|
printf("CreateWindow BAD CLASSNAME '%s' !\n", className);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Correct the window style */
|
||||||
|
|
||||||
|
if (!(style & (WS_POPUP | WS_CHILD))) /* Overlapped window */
|
||||||
|
style |= WS_CAPTION | WS_CLIPSIBLINGS;
|
||||||
|
if (exStyle & WS_EX_DLGMODALFRAME) style &= ~WS_THICKFRAME;
|
||||||
|
|
||||||
/* Create the window structure */
|
/* Create the window structure */
|
||||||
|
|
||||||
hwnd = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(WND)+classPtr->wc.cbWndExtra);
|
hwnd = USER_HEAP_ALLOC(GMEM_MOVEABLE, sizeof(WND)+classPtr->wc.cbWndExtra);
|
||||||
|
@ -217,8 +231,8 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
|
||||||
wndPtr->hwndNext = 0;
|
wndPtr->hwndNext = 0;
|
||||||
wndPtr->hwndChild = 0;
|
wndPtr->hwndChild = 0;
|
||||||
wndPtr->dwMagic = WND_MAGIC;
|
wndPtr->dwMagic = WND_MAGIC;
|
||||||
wndPtr->hwndParent = parent;
|
wndPtr->hwndParent = (style & WS_CHILD) ? parent : 0;
|
||||||
wndPtr->hwndOwner = parent; /* What else? */
|
wndPtr->hwndOwner = (style & WS_CHILD) ? 0 : parent;
|
||||||
wndPtr->hClass = class;
|
wndPtr->hClass = class;
|
||||||
wndPtr->hInstance = instance;
|
wndPtr->hInstance = instance;
|
||||||
wndPtr->rectWindow.left = x;
|
wndPtr->rectWindow.left = x;
|
||||||
|
@ -239,9 +253,12 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
|
||||||
wndPtr->hCursor = 0;
|
wndPtr->hCursor = 0;
|
||||||
wndPtr->hWndVScroll = 0;
|
wndPtr->hWndVScroll = 0;
|
||||||
wndPtr->hWndHScroll = 0;
|
wndPtr->hWndHScroll = 0;
|
||||||
|
wndPtr->hWndMenuBar = 0;
|
||||||
|
wndPtr->hWndCaption = 0;
|
||||||
|
|
||||||
if (classPtr->wc.cbWndExtra)
|
if (classPtr->wc.cbWndExtra)
|
||||||
memset( wndPtr->wExtra, 0, classPtr->wc.cbWndExtra );
|
memset( wndPtr->wExtra, 0, classPtr->wc.cbWndExtra );
|
||||||
|
if (classPtr->wc.style & CS_DBLCLKS) wndPtr->flags |= WIN_DOUBLE_CLICKS;
|
||||||
classPtr->cWindows++;
|
classPtr->cWindows++;
|
||||||
|
|
||||||
/* Get class or window DC if needed */
|
/* Get class or window DC if needed */
|
||||||
|
@ -261,156 +278,32 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
|
||||||
|
|
||||||
WIN_LinkWindow( hwnd, HWND_TOP );
|
WIN_LinkWindow( hwnd, HWND_TOP );
|
||||||
|
|
||||||
if (!strcasecmp(className, "COMBOBOX"))
|
/* Create the X window */
|
||||||
{
|
|
||||||
height = 16;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef USE_XLIB
|
|
||||||
{
|
|
||||||
XSetWindowAttributes win_attr;
|
|
||||||
Window parentWindow;
|
|
||||||
int x_rel, y_rel;
|
|
||||||
|
|
||||||
win_attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask |
|
|
||||||
PointerMotionMask | ButtonPressMask |
|
|
||||||
ButtonReleaseMask | StructureNotifyMask |
|
|
||||||
FocusChangeMask | EnterWindowMask;
|
|
||||||
win_attr.override_redirect = /*True*/ False;
|
|
||||||
win_attr.colormap = COLOR_WinColormap;
|
|
||||||
if (style & WS_CHILD)
|
|
||||||
{
|
|
||||||
parentWindow = parentPtr->window;
|
|
||||||
x_rel = x + parentPtr->rectClient.left-parentPtr->rectWindow.left;
|
|
||||||
y_rel = y + parentPtr->rectClient.top-parentPtr->rectWindow.top;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
parentWindow = DefaultRootWindow( XT_display );
|
|
||||||
x_rel = x;
|
|
||||||
y_rel = y;
|
|
||||||
}
|
|
||||||
wndPtr->window = XCreateWindow( XT_display, parentWindow,
|
|
||||||
x_rel, y_rel, width, height, 0,
|
|
||||||
CopyFromParent, InputOutput,
|
|
||||||
CopyFromParent,
|
|
||||||
CWEventMask | CWOverrideRedirect |
|
|
||||||
CWColormap, &win_attr );
|
|
||||||
XStoreName( XT_display, wndPtr->window, windowName );
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
/* Create the widgets */
|
|
||||||
|
|
||||||
|
win_attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask |
|
||||||
|
PointerMotionMask | ButtonPressMask |
|
||||||
|
ButtonReleaseMask | StructureNotifyMask |
|
||||||
|
FocusChangeMask | EnterWindowMask;
|
||||||
|
win_attr.override_redirect = /*True*/ False;
|
||||||
|
win_attr.colormap = COLOR_WinColormap;
|
||||||
if (style & WS_CHILD)
|
if (style & WS_CHILD)
|
||||||
{
|
{
|
||||||
wndPtr->shellWidget = 0;
|
parentWindow = parentPtr->window;
|
||||||
if (style & (WS_BORDER | WS_DLGFRAME | WS_THICKFRAME))
|
x_rel = x + parentPtr->rectClient.left - parentPtr->rectWindow.left;
|
||||||
{
|
y_rel = y + parentPtr->rectClient.top - parentPtr->rectWindow.top;
|
||||||
int borderCol = 0;
|
|
||||||
if (COLOR_WinColormap == DefaultColormapOfScreen(XT_screen))
|
|
||||||
borderCol = BlackPixelOfScreen(XT_screen);
|
|
||||||
wndPtr->winWidget = XtVaCreateManagedWidget(className,
|
|
||||||
compositeWidgetClass,
|
|
||||||
parentPtr->winWidget,
|
|
||||||
XtNx, x,
|
|
||||||
XtNy, y,
|
|
||||||
XtNwidth, width,
|
|
||||||
XtNheight, height,
|
|
||||||
XtNborderColor, borderCol,
|
|
||||||
XtNmappedWhenManaged, FALSE,
|
|
||||||
NULL );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wndPtr->winWidget = XtVaCreateManagedWidget(className,
|
|
||||||
compositeWidgetClass,
|
|
||||||
parentPtr->winWidget,
|
|
||||||
XtNx, x,
|
|
||||||
XtNy, y,
|
|
||||||
XtNwidth, width,
|
|
||||||
XtNheight, height,
|
|
||||||
XtNborderWidth, 0,
|
|
||||||
XtNmappedWhenManaged, FALSE,
|
|
||||||
NULL );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wndPtr->shellWidget = XtVaAppCreateShell(windowName,
|
parentWindow = DefaultRootWindow( display );
|
||||||
className,
|
x_rel = x;
|
||||||
topLevelShellWidgetClass,
|
y_rel = y;
|
||||||
XT_display,
|
|
||||||
XtNx, x,
|
|
||||||
XtNy, y,
|
|
||||||
XtNcolormap, COLOR_WinColormap,
|
|
||||||
XtNmappedWhenManaged, FALSE,
|
|
||||||
NULL );
|
|
||||||
wndPtr->compositeWidget = XtVaCreateManagedWidget(className,
|
|
||||||
formWidgetClass,
|
|
||||||
wndPtr->shellWidget,
|
|
||||||
NULL );
|
|
||||||
/* wndPtr->winWidget = wndPtr->compositeWidget; */
|
|
||||||
wndPtr->winWidget = wndPtr->shellWidget;
|
|
||||||
if (wndPtr->wIDmenu == 0)
|
|
||||||
{
|
|
||||||
wndPtr->menuBarPtr =
|
|
||||||
MENU_CreateMenuBar(wndPtr->compositeWidget,
|
|
||||||
instance, hwnd,
|
|
||||||
classPtr->wc.lpszMenuName,
|
|
||||||
width);
|
|
||||||
if (wndPtr->menuBarPtr)
|
|
||||||
wndPtr->wIDmenu =
|
|
||||||
GlobalHandleFromPointer(wndPtr->menuBarPtr->firstItem);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wndPtr->menuBarPtr = MENU_UseMenu(wndPtr->compositeWidget,
|
|
||||||
instance, hwnd,
|
|
||||||
wndPtr->wIDmenu, width);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (wndPtr->menuBarPtr != NULL)
|
|
||||||
{
|
|
||||||
wndPtr->winWidget =
|
|
||||||
XtVaCreateManagedWidget(className,
|
|
||||||
compositeWidgetClass,
|
|
||||||
wndPtr->compositeWidget,
|
|
||||||
XtNwidth, width,
|
|
||||||
XtNheight, height,
|
|
||||||
XtNfromVert,
|
|
||||||
wndPtr->menuBarPtr->menuBarWidget,
|
|
||||||
XtNvertDistance, 4,
|
|
||||||
NULL );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wndPtr->winWidget =
|
|
||||||
XtVaCreateManagedWidget(className,
|
|
||||||
compositeWidgetClass,
|
|
||||||
wndPtr->compositeWidget,
|
|
||||||
XtNwidth, width,
|
|
||||||
XtNheight, height,
|
|
||||||
NULL );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (wndPtr->shellWidget) XtRealizeWidget( wndPtr->shellWidget );
|
wndPtr->window = XCreateWindow(display, parentWindow,
|
||||||
if (wndPtr->compositeWidget) XtRealizeWidget( wndPtr->compositeWidget );
|
x_rel, y_rel, width, height, 0,
|
||||||
XtRealizeWidget( wndPtr->winWidget );
|
CopyFromParent, InputOutput, CopyFromParent,
|
||||||
wndPtr->window = XtWindow( wndPtr->winWidget );
|
CWEventMask | CWOverrideRedirect |
|
||||||
#endif /* USE_XLIB */
|
CWColormap, &win_attr );
|
||||||
|
XStoreName( display, wndPtr->window, windowName );
|
||||||
if ((style & WS_VSCROLL) == WS_VSCROLL) {
|
|
||||||
newheight = height - (((style & WS_HSCROLL) == WS_HSCROLL) ? 16 : 0);
|
|
||||||
wndPtr->hWndVScroll = CreateWindow("SCROLLBAR", "",
|
|
||||||
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SBS_VERT,
|
|
||||||
width - 16, 0, 16, newheight, hwnd, 2, instance, 0L);
|
|
||||||
}
|
|
||||||
if ((style & WS_HSCROLL) == WS_HSCROLL) {
|
|
||||||
newwidth = width - (((style & WS_VSCROLL) == WS_VSCROLL) ? 16 : 0);
|
|
||||||
wndPtr->hWndHScroll = CreateWindow("SCROLLBAR", "",
|
|
||||||
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SBS_HORZ,
|
|
||||||
0, height - 16, newwidth, 16, hwnd, 3, instance, 0L);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Send the WM_CREATE message */
|
/* Send the WM_CREATE message */
|
||||||
|
|
||||||
|
@ -452,30 +345,56 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
|
||||||
|
|
||||||
GlobalUnlock( hcreateStruct );
|
GlobalUnlock( hcreateStruct );
|
||||||
GlobalFree( hcreateStruct );
|
GlobalFree( hcreateStruct );
|
||||||
|
|
||||||
if (wmcreate == -1)
|
if (wmcreate == -1)
|
||||||
{
|
{
|
||||||
/* Abort window creation */
|
/* Abort window creation */
|
||||||
|
|
||||||
if (parent) parentPtr->hwndChild = wndPtr->hwndNext;
|
WIN_UnlinkWindow( hwnd );
|
||||||
else firstWindow = wndPtr->hwndNext;
|
XDestroyWindow( display, wndPtr->window );
|
||||||
#ifdef USE_XLIB
|
|
||||||
XDestroyWindow( XT_display, wndPtr->window );
|
|
||||||
#else
|
|
||||||
if (wndPtr->shellWidget) XtDestroyWidget( wndPtr->shellWidget );
|
|
||||||
else XtDestroyWidget( wndPtr->winWidget );
|
|
||||||
#endif
|
|
||||||
if (wndPtr->flags & WIN_OWN_DC) DCE_FreeDCE( wndPtr->hdce );
|
if (wndPtr->flags & WIN_OWN_DC) DCE_FreeDCE( wndPtr->hdce );
|
||||||
classPtr->cWindows--;
|
classPtr->cWindows--;
|
||||||
USER_HEAP_FREE( hwnd );
|
USER_HEAP_FREE( hwnd );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_XLIB
|
/* Create scrollbars */
|
||||||
EVENT_AddHandlers( wndPtr->window, hwnd );
|
|
||||||
#else
|
if (windowName != NULL) SetWindowText(hwnd, windowName);
|
||||||
EVENT_AddHandlers( wndPtr->winWidget, hwnd );
|
if ((style & WS_CAPTION) == WS_CAPTION) {
|
||||||
#endif
|
wndPtr->hWndCaption = CreateWindow("CAPTION", "",
|
||||||
|
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE,
|
||||||
|
0, -20, width, 20, hwnd, 1, instance, 0L);
|
||||||
|
}
|
||||||
|
if (((style & WS_CHILD) != WS_CHILD) && (wndPtr->wIDmenu != 0)) {
|
||||||
|
lpbar = (LPPOPUPMENU) GlobalLock(wndPtr->wIDmenu);
|
||||||
|
if (lpbar != NULL) {
|
||||||
|
lpbar->ownerWnd = hwnd;
|
||||||
|
wndPtr->hWndMenuBar = CreateWindow("POPUPMENU", "",
|
||||||
|
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE,
|
||||||
|
0, 0, width, 20, hwnd, 2, instance, (LPSTR)lpbar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((style & WS_VSCROLL) == WS_VSCROLL)
|
||||||
|
{
|
||||||
|
wndPtr->hWndVScroll = CreateWindow("SCROLLBAR", "",
|
||||||
|
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SBS_VERT,
|
||||||
|
wndPtr->rectClient.right-wndPtr->rectClient.left, 0,
|
||||||
|
SYSMETRICS_CXVSCROLL,
|
||||||
|
wndPtr->rectClient.bottom-wndPtr->rectClient.top,
|
||||||
|
hwnd, 3, instance, 0L);
|
||||||
|
}
|
||||||
|
if ((style & WS_HSCROLL) == WS_HSCROLL)
|
||||||
|
{
|
||||||
|
wndPtr->hWndHScroll = CreateWindow("SCROLLBAR", "",
|
||||||
|
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE | SBS_HORZ,
|
||||||
|
0, wndPtr->rectClient.bottom-wndPtr->rectClient.top,
|
||||||
|
wndPtr->rectClient.right-wndPtr->rectClient.left,
|
||||||
|
SYSMETRICS_CYHSCROLL,
|
||||||
|
hwnd, 4, instance, 0L);
|
||||||
|
}
|
||||||
|
|
||||||
|
EVENT_RegisterWindow( wndPtr->window, hwnd );
|
||||||
|
|
||||||
WIN_SendParentNotify( hwnd, wndPtr, WM_CREATE );
|
WIN_SendParentNotify( hwnd, wndPtr, WM_CREATE );
|
||||||
|
|
||||||
|
@ -515,12 +434,7 @@ BOOL DestroyWindow( HWND hwnd )
|
||||||
|
|
||||||
/* Destroy the window */
|
/* Destroy the window */
|
||||||
|
|
||||||
#ifdef USE_XLIB
|
XDestroyWindow( display, wndPtr->window );
|
||||||
XDestroyWindow( XT_display, wndPtr->window );
|
|
||||||
#else
|
|
||||||
if (wndPtr->shellWidget) XtDestroyWidget( wndPtr->shellWidget );
|
|
||||||
else XtDestroyWidget( wndPtr->winWidget );
|
|
||||||
#endif
|
|
||||||
if (wndPtr->flags & WIN_OWN_DC) DCE_FreeDCE( wndPtr->hdce );
|
if (wndPtr->flags & WIN_OWN_DC) DCE_FreeDCE( wndPtr->hdce );
|
||||||
classPtr->cWindows--;
|
classPtr->cWindows--;
|
||||||
USER_HEAP_FREE( hwnd );
|
USER_HEAP_FREE( hwnd );
|
||||||
|
@ -588,49 +502,7 @@ HMENU GetMenu( HWND hwnd )
|
||||||
*/
|
*/
|
||||||
BOOL SetMenu(HWND hwnd, HMENU hmenu)
|
BOOL SetMenu(HWND hwnd, HMENU hmenu)
|
||||||
{
|
{
|
||||||
#ifdef USE_XLIB
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
#else
|
|
||||||
WND *wndPtr;
|
|
||||||
wndPtr = WIN_FindWndPtr(hwnd);
|
|
||||||
if (wndPtr == NULL)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (wndPtr->dwStyle & WS_CHILD) return FALSE;
|
|
||||||
|
|
||||||
if (wndPtr->menuBarPtr != NULL)
|
|
||||||
{
|
|
||||||
XtVaSetValues(wndPtr->winWidget, XtNfromVert, NULL, NULL);
|
|
||||||
MENU_CollapseMenu(wndPtr->menuBarPtr);
|
|
||||||
}
|
|
||||||
|
|
||||||
wndPtr->menuBarPtr = MENU_UseMenu(wndPtr->compositeWidget,
|
|
||||||
wndPtr->hInstance, hwnd, hmenu,
|
|
||||||
wndPtr->rectClient.right -
|
|
||||||
wndPtr->rectClient.left);
|
|
||||||
|
|
||||||
if (wndPtr->menuBarPtr != NULL)
|
|
||||||
{
|
|
||||||
XtVaSetValues(wndPtr->winWidget,
|
|
||||||
XtNfromVert, wndPtr->menuBarPtr->menuBarWidget,
|
|
||||||
XtNvertDistance, 4,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (wndPtr->wIDmenu != 0)
|
|
||||||
{
|
|
||||||
wndPtr->menuBarPtr = MENU_UseMenu(wndPtr->compositeWidget,
|
|
||||||
wndPtr->hInstance, hwnd,
|
|
||||||
wndPtr->wIDmenu,
|
|
||||||
wndPtr->rectClient.right -
|
|
||||||
wndPtr->rectClient.left);
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
#endif /* USE_XLIB */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
||||||
|
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
|
|
||||||
extern Display * XT_display;
|
extern Display * display;
|
||||||
extern Screen * XT_screen;
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -213,10 +212,8 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, short x, short y,
|
||||||
RECT newWindowRect, newClientRect;
|
RECT newWindowRect, newClientRect;
|
||||||
WND *wndPtr;
|
WND *wndPtr;
|
||||||
int calcsize_result = 0;
|
int calcsize_result = 0;
|
||||||
#ifdef USE_XLIB
|
|
||||||
XWindowChanges winChanges;
|
XWindowChanges winChanges;
|
||||||
int changeMask = 0;
|
int changeMask = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef DEBUG_WIN
|
#ifdef DEBUG_WIN
|
||||||
printf( "SetWindowPos: %d %d %d,%d %dx%d 0x%x\n",
|
printf( "SetWindowPos: %d %d %d,%d %dx%d 0x%x\n",
|
||||||
|
@ -311,7 +308,7 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, short x, short y,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Perform the moving and resizing */
|
/* Perform the moving and resizing */
|
||||||
#ifdef USE_XLIB
|
|
||||||
if (!(winPos->flags & SWP_NOMOVE))
|
if (!(winPos->flags & SWP_NOMOVE))
|
||||||
{
|
{
|
||||||
WND * parentPtr;
|
WND * parentPtr;
|
||||||
|
@ -343,31 +340,28 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, short x, short y,
|
||||||
}
|
}
|
||||||
changeMask |= CWStackMode;
|
changeMask |= CWStackMode;
|
||||||
}
|
}
|
||||||
if (changeMask) XConfigureWindow( XT_display, wndPtr->window,
|
if (changeMask) XConfigureWindow( display, wndPtr->window,
|
||||||
changeMask, &winChanges );
|
changeMask, &winChanges );
|
||||||
#endif
|
|
||||||
|
|
||||||
if (winPos->flags & SWP_SHOWWINDOW)
|
if (winPos->flags & SWP_SHOWWINDOW)
|
||||||
{
|
{
|
||||||
wndPtr->dwStyle |= WS_VISIBLE;
|
wndPtr->dwStyle |= WS_VISIBLE;
|
||||||
#ifdef USE_XLIB
|
XMapWindow( display, wndPtr->window );
|
||||||
XMapWindow( XT_display, wndPtr->window );
|
|
||||||
#else
|
|
||||||
if (wndPtr->shellWidget) XtMapWidget( wndPtr->shellWidget );
|
|
||||||
else XtMapWidget( wndPtr->winWidget );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else if (winPos->flags & SWP_HIDEWINDOW)
|
else if (winPos->flags & SWP_HIDEWINDOW)
|
||||||
{
|
{
|
||||||
wndPtr->dwStyle &= ~WS_VISIBLE;
|
wndPtr->dwStyle &= ~WS_VISIBLE;
|
||||||
#ifdef USE_XLIB
|
XUnmapWindow( display, wndPtr->window );
|
||||||
XUnmapWindow( XT_display, wndPtr->window );
|
|
||||||
#else
|
|
||||||
if (wndPtr->shellWidget) XtUnmapWidget( wndPtr->shellWidget );
|
|
||||||
else XtUnmapWidget( wndPtr->winWidget );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Send WM_NCPAINT message if needed */
|
||||||
|
if ((winPos->flags & (SWP_FRAMECHANGED | SWP_SHOWWINDOW)) ||
|
||||||
|
(!(winPos->flags & SWP_NOSIZE)) ||
|
||||||
|
(!(winPos->flags & SWP_NOMOVE)) ||
|
||||||
|
(!(winPos->flags & SWP_NOACTIVATE)) ||
|
||||||
|
(!(winPos->flags & SWP_NOZORDER)))
|
||||||
|
SendMessage( hwnd, WM_NCPAINT, 1, 0L );
|
||||||
|
|
||||||
/* Finally send the WM_WINDOWPOSCHANGED message */
|
/* Finally send the WM_WINDOWPOSCHANGED message */
|
||||||
wndPtr->rectWindow = newWindowRect;
|
wndPtr->rectWindow = newWindowRect;
|
||||||
wndPtr->rectClient = newClientRect;
|
wndPtr->rectClient = newClientRect;
|
||||||
|
|
37
wine.ini
37
wine.ini
|
@ -1,19 +1,32 @@
|
||||||
[drives]
|
[drives]
|
||||||
a=/mnt/fd0
|
A=/mnt/fd0
|
||||||
c=/dos
|
C=/dos
|
||||||
d=/usr/windows
|
D=/usr/windows
|
||||||
e=/home/bob/Wine/work
|
E=/home/bob/Wine/work
|
||||||
f=/home/bob/test
|
F=/home/bob/test
|
||||||
|
|
||||||
[wine]
|
[wine]
|
||||||
windows=c:\windows
|
Windows=c:\windows
|
||||||
system=c:\windows\system
|
System=c:\windows\system
|
||||||
temp=c:\temp
|
Temp=c:\temp
|
||||||
path=c:\windows;c:\windows\system;e:\;e:\test;f:\
|
Path=c:\windows;c:\windows\system;e:\;e:\test;f:\
|
||||||
|
SystemResources=sysres.dll
|
||||||
|
; SystemResources=
|
||||||
|
|
||||||
[serialports]
|
[serialports]
|
||||||
com1=/dev/cua0
|
Com1=/dev/cua0
|
||||||
com2=/dev/cua1
|
Com2=/dev/cua1
|
||||||
|
|
||||||
[parallelports]
|
[parallelports]
|
||||||
lpt1=/dev/lp0
|
Lpt1=/dev/lp0
|
||||||
|
|
||||||
|
[spy]
|
||||||
|
;;;;; Uncomment the following line to activate spying to the console ;;;;;
|
||||||
|
;File=CON
|
||||||
|
|
||||||
|
;;;;; Uncomment the following line to activate spying to the spy.log ;;;;;
|
||||||
|
;File=spy.log
|
||||||
|
|
||||||
|
;;;;; The following options are not supported yet ;;;;;
|
||||||
|
;Include=
|
||||||
|
;Exclude=
|
||||||
|
|
Loading…
Reference in New Issue