Commit cdd09237 authored by Alexandre Julliard's avatar Alexandre Julliard

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.
parent 5f721f81
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>
* [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.
----------------------------------------------------------------------
Mon Dec 27 11:06:03 1993 Erik Bos (erik@trashcan.hacktic.nl)
* [misc/comm.c]
......
######################################################################
# These variables are inherited by the sub-makefiles
DEBUGOPTS=-DUSE_XLIB
DEBUGOPTS=
COPTS=-O2 -m486
INCLUDE_DIR=include
LDFLAGS=
......
......@@ -41,6 +41,14 @@ For example: to run Windows' solitaire:
Have a nice game of solitaire, but be careful. Emulation isn't perfect.
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)
- Working towards elimination of Xt-dependent code.
- StretchBlt()
......
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 \
WinMenuButto.o
......
/*
* 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;
}
......@@ -21,6 +21,15 @@ static char Copyright[] = "Copyright Martin Ayotte, 1993";
#include <dirent.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 ScrollBarGetStorageHeader(HWND hwnd);
void StdDrawScrollBar(HWND hwnd);
......@@ -34,9 +43,13 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
{
WORD wRet;
short x, y;
short width, height;
WND *wndPtr;
LPHEADSCROLL lphs;
RECT rect;
LPDRAWITEMSTRUCT lpdis;
HDC hMemDC;
BITMAP bm;
RECT rect;
static RECT rectsel;
switch(message)
{
......@@ -45,6 +58,22 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
#ifdef DEBUG_SCROLL
printf("ScrollBar Creation up=%X down=%X!\n", lphs->hWndUp, lphs->hWndDown);
#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;
case WM_DESTROY:
lphs = ScrollBarGetWindowAndStorage(hwnd, &wndPtr);
......@@ -129,15 +158,6 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
ReleaseCapture();
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:
if ((wParam & MK_LBUTTON) != 0) {
lphs = ScrollBarGetWindowAndStorage(hwnd, &wndPtr);
......@@ -150,12 +170,88 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
x = (y * (lphs->MaxVal - lphs->MinVal) /
lphs->MaxPix) + lphs->MinVal;
#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
SendMessage(wndPtr->hwndParent, lphs->Direction,
SB_THUMBTRACK, MAKELONG(x, hwnd));
}
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:
return DefWindowProc( hwnd, message, wParam, lParam );
}
......@@ -274,10 +370,10 @@ int CreateScrollBarStruct(HWND hwnd)
lphs->MaxPix = height - 3 * width;
lphs->Direction = WM_VSCROLL;
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);
lphs->hWndDown = CreateWindow("BUTTON", "",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
0, height - width, width, width, hwnd, 2,
wndPtr->hInstance, 0L);
}
......@@ -286,11 +382,11 @@ int CreateScrollBarStruct(HWND hwnd)
lphs->MaxPix = width - 3 * height;
lphs->Direction = WM_HSCROLL;
lphs->hWndUp = CreateWindow("BUTTON", "",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
0, 0, height, height, hwnd, 0, wndPtr->hInstance, 0L);
WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
0, 0, height, height, hwnd, 3, wndPtr->hInstance, 0L);
lphs->hWndDown = CreateWindow("BUTTON", "",
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
width - height, 0, height, height, hwnd, 0,
WS_CHILD | WS_VISIBLE | BS_OWNERDRAW,
width - height, 0, height, height, hwnd, 4,
wndPtr->hInstance, 0L);
}
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 ComboBoxWndProc ( 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[] =
......@@ -33,6 +34,8 @@ static WNDCLASS WIDGETS_BuiltinClasses[] =
0, 0, 0, 0, NULL, "COMBOBOX" },
{ CS_GLOBALCLASS, (LONG(*)())PopupMenuWndProc, 0, 8,
0, 0, 0, 0, NULL, "POPUPMENU" },
{ CS_GLOBALCLASS, (LONG(*)())CaptionBarWndProc, 0, 8,
0, 0, 0, 0, NULL, "CAPTION" },
{ CS_GLOBALCLASS, (LONG(*)())DefDlgProc, 0, DLGWINDOWEXTRA,
0, 0, 0, 0, NULL, DIALOG_CLASS_NAME }
};
......
......@@ -172,7 +172,7 @@ void examine_memory(int addr, int count, char format){
pnt = (char *) addr;
for(i=0; i<count; i++)
{
fprintf(stderr," %w", *pnt++);
fprintf(stderr," %02.2x", (*pnt++) & 0xff);
if ((i % 32) == 7) {
fprintf(stderr,"\n");
print_address((unsigned int) pnt, stderr);
......
......@@ -19,6 +19,8 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "prototypes.h"
#include "dlls.h"
/* #define DEBUG_RELAY */
#define N_BUILTINS 8
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_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
stack_p = (unsigned short *) seg_off;
for (i = 0; i < 24; i++, stack_p++)
......
......@@ -120,6 +120,7 @@ length 540
155 pascal EnableMenuItem(word word word) EnableMenuItem(1 2 3)
157 pascal GetMenu(word) GetMenu(1)
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)
164 pascal DestroyCaret() DestroyCaret()
165 pascal SetCaretPos(word word) SetCaretPos(1 2)
......@@ -206,6 +207,8 @@ length 540
415 pascal CreatePopupMenu() CreatePopupMenu()
416 pascal TrackPopupMenu(word word word word word word ptr)
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)
421 pascal wvsprintf(ptr ptr ptr) wvsprintf(1 2 3)
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
word word word ptr)
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)
458 pascal DestroyCursor(word) DestroyCursor(1)
471 pascal lstrcmpi(ptr ptr) lstrcmpi(1 2)
......
/*
* 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 GDIOBJHDR * GDI_GetObjPtr( HANDLE, WORD );
extern Display * XT_display;
extern Screen * XT_screen;
extern Display * XT_display; /* Will be removed */
extern Screen * XT_screen; /* Will be removed */
extern Display * display;
extern Screen * screen;
#endif /* GDI_H */
......@@ -13,7 +13,6 @@
#include <X11/Xaw/Command.h>
#include <X11/Xaw/Box.h>
#include "windows.h"
typedef struct tagMENUITEM
{
......@@ -23,7 +22,9 @@ typedef struct tagMENUITEM
struct tagMENUITEM *parent;
WORD item_flags;
WORD item_id;
char *item_text;
WORD sel_key;
char *shortcut;
char *item_text;
Widget w;
Widget menu_w;
char menu_name[10];
......@@ -46,11 +47,15 @@ typedef struct tagMENUBAR
typedef struct tagPOPUPMENU
{
HWND hWnd; /* PopupMenu window handle */
HWND hWndParent; /* Parent opupMenu window handle */
HWND ownerWnd; /* Owner window */
WORD nItems; /* Number of items on menu */
MENUITEM *firstItem;
WORD FocusedItem;
WORD MouseFlags;
WORD BarFlags;
WORD Width;
WORD Height;
} POPUPMENU, *LPPOPUPMENU;
typedef struct
......
/*
* 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
#define WIN_H
#include <X11/Intrinsic.h>
#include <X11/Xlib.h>
#include "windows.h"
#include "menu.h"
......@@ -40,11 +40,10 @@ typedef struct tagWND
WORD wIDmenu; /* ID or hmenu (from CreateWindow) */
HANDLE hText; /* Handle of window text */
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 */
LPMENUBAR menuBarPtr; /* Menu bar */
HWND hWndMenuBar; /* Menu bar */
HWND hWndCaption; /* Caption bar */
WORD wExtra[1]; /* Window extra bytes */
} WND;
......@@ -54,6 +53,7 @@ typedef struct tagWND
#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_CLASS_DC 0x10 /* Win class has style CS_CLASSDC */
#define WIN_DOUBLE_CLICKS 0x20 /* Win class has style CS_DBLCLKS */
/* Window functions */
WND *WIN_FindWndPtr( HWND hwnd );
......
......@@ -238,6 +238,49 @@ typedef struct
#define WVR_REDRAW (WVR_HREDRAW | WVR_VREDRAW)
#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 */
......@@ -794,6 +837,8 @@ typedef METARECORD *PMETARECORD;
#define SM_PENWINDOWS 41
#define SM_DBCSENABLED 42
#define SM_CMETRICS 43
/* Device-independent bitmaps */
typedef struct { BYTE rgbBlue, rgbGreen, rgbRed, rgbReserved; } RGBQUAD;
......@@ -1058,6 +1103,63 @@ typedef HANDLETABLE *LPHANDLETABLE;
#define IDC_SIZEWE MAKEINTRESOURCE(32544)
#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() */
#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_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
/* 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 */
#define WM_KEYDOWN 0x0100
#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_COMMAND 0x0111
#define WM_SYSCOMMAND 0x0112
#define WM_TIMER 0x0113
#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_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,
SW_MAXIMIZE, SW_SHOWNOACTIVATE, SW_SHOW, SW_MINIMIZE,
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_INTERNAL 4096
/* Window Styles */
#define WS_OVERLAPPED 0x00000000L
#define WS_POPUP 0x80000000L
#define WS_CHILD 0x40000000L
......@@ -2022,7 +2146,7 @@ Fa(WORD,GetPolyFillMode,HDC,a)
Fa(WORD,GetRelAbs,HDC,a)
Fa(WORD,GetROP2,HDC,a)
Fa(WORD,GetStretchBltMode,HDC,a)
Fa(int,GetSystemMetrics,short,a)
Fa(int,GetSystemMetrics,WORD,a)
Fa(int,GetWindowTextLength,HWND,a)
Fa(int,RestoreVisRgn,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,SetScrollPos,HWND,a,int,b,int,c,BOOL,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,CheckRadioButton,HWND,a,WORD,b,WORD,c,WORD,d)
Fd(void,CreateCaret,HWND,a,HBITMAP,b,short,c,short,d)
......
/* 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)) !=
sizeof(size_shift))
{
printf("FindResourceByNumber (%s) bad block size !\n", resource_id);
return -1;
}
......@@ -160,40 +161,38 @@ FindResourceByNumber(struct resource_nameinfo_s *result_p,
* Find resource.
*/
typeinfo.type_id = 0xffff;
while (typeinfo.type_id != 0)
{
while (typeinfo.type_id != 0) {
if (read(ResourceFd, &typeinfo, sizeof(typeinfo)) !=
sizeof(typeinfo))
{
sizeof(typeinfo)) {
printf("FindResourceByNumber (%X) bad typeinfo size !\n", resource_id);
return -1;
}
if (typeinfo.type_id != 0)
{
for (i = 0; i < typeinfo.count; i++)
{
}
#ifdef DEBUG_RESOURCE
printf("FindResourceByNumber type=%X count=%d\n",
typeinfo.type_id, typeinfo.count);
#endif
if (typeinfo.type_id == 0) break;
if (typeinfo.type_id == type_id || type_id == -1) {
for (i = 0; i < typeinfo.count; i++) {
if (read(ResourceFd, &nameinfo, sizeof(nameinfo)) !=
sizeof(nameinfo))
{
sizeof(nameinfo)) {
printf("FindResourceByNumber (%X) bad nameinfo size !\n", resource_id);
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);
}
}
#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 ((type_id == -1 || typeinfo.type_id == type_id) &&
nameinfo.id == resource_id)
{
if (nameinfo.id == resource_id) {
memcpy(result_p, &nameinfo, sizeof(nameinfo));
return size_shift;
}
}
}
}
}
}
else {
lseek(ResourceFd, (typeinfo.count * sizeof(nameinfo)), SEEK_CUR);
}
}
return -1;
}
......@@ -243,7 +242,7 @@ FindResourceByName(struct resource_nameinfo_s *result_p,
return -1;
}
#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);
#endif
if (typeinfo.type_id == 0) break;
......@@ -269,7 +268,7 @@ FindResourceByName(struct resource_nameinfo_s *result_p,
lseek(ResourceFd, old_pos, SEEK_SET);
name[nbytes] = '\0';
#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);
#endif
if (strcasecmp(name, resource_name) == 0)
......@@ -281,7 +280,7 @@ FindResourceByName(struct resource_nameinfo_s *result_p,
}
else {
lseek(ResourceFd, (typeinfo.count * sizeof(nameinfo)), SEEK_CUR);
}
}
}
return -1;
}
......@@ -681,9 +680,6 @@ LoadBitmap(HANDLE instance, LPSTR bmp_name)
printf("LoadBitmap: instance = %04x, name = %08x\n",
instance, bmp_name);
#endif
printf("LoadBitmap: instance = %04x, name = %08x\n",
instance, bmp_name);
if (instance == (HANDLE)NULL) instance = hSysRes;
if (!(hdc = GetDC(GetDesktopWindow()))) return 0;
......@@ -706,7 +702,6 @@ printf("before GlobalLock\n");
else if (*lp == sizeof(BITMAPINFOHEADER))
hbitmap = ConvertInfoBitmap( hdc, (BITMAPINFO *) lp );
else hbitmap = 0;
printf("LoadBitmap %04X\n", hbitmap);
GlobalFree(rsc_mem);
ReleaseDC( 0, hdc );
return hbitmap;
......
......@@ -21,6 +21,9 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "dlls.h"
#include "wine.h"
#include "windows.h"
#include "wineopts.h"
/* #define DEBUG_FIXUP */
extern int CallToInit16(unsigned long csip, unsigned long sssp,
unsigned short ds);
......@@ -46,6 +49,8 @@ HINSTANCE hSysRes;
static char *Extensions[] = { "dll", "exe", NULL };
static char *WinePath = NULL;
FILE *SpyFp = NULL;
/**********************************************************************
* DebugPrintString
*/
......@@ -110,6 +115,19 @@ HINSTANCE LoadImage(char *modulename)
unsigned int status;
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
* our linked list.
*/
......@@ -125,20 +143,6 @@ HINSTANCE LoadImage(char *modulename)
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.
*/
wpnt->fd = open(buffer, O_RDONLY);
......@@ -251,6 +255,31 @@ HINSTANCE LoadImage(char *modulename)
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
......@@ -260,6 +289,7 @@ _WinMain(int argc, char **argv)
int segment;
char *p;
char *sysresname;
char filename[100];
char syspath[256];
char exe_path[256];
#ifdef WINESTAT
......@@ -269,15 +299,8 @@ _WinMain(int argc, char **argv)
int cs_reg, ds_reg, ss_reg, ip_reg, sp_reg;
int i;
int rv;
Argc = argc - 1;
Argv = argv + 1;
if (argc < 2)
{
fprintf(stderr, "usage: %s FILENAME\n", argv[0]);
exit(1);
}
ParseArgs(argc, argv);
p = getenv("WINEPATH");
WinePath = malloc(256 + strlen(p));
......@@ -285,27 +308,17 @@ _WinMain(int argc, char **argv)
strcat(WinePath, ";");
strcat(WinePath, p);
LoadImage(argv[1]);
hSysRes = LoadImage("sysres.dll");
LoadImage(Argv[0]);
GetPrivateProfileString("wine", "SystemResources", "sysres.dll",
filename, sizeof(filename),
WINE_INI);
hSysRes = LoadImage(filename);
if (hSysRes == (HINSTANCE)NULL)
printf("Error Loading System Resources !!!\n");
else
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.
*/
......@@ -442,8 +455,10 @@ FixupSegment(struct w_files * wpnt, int segment_num)
seg = &seg_table[segment_num];
sel = &selector_table[segment_num];
fprintf(stderr, "Segment fixups for %s, segment %d, selector %x\n",
wpnt->name, segment_num, (int) sel->base_addr >> 16);
#ifdef DEBUG_FIXUP
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) ||
!(seg->seg_flags & NE_SEGFLAGS_RELOC_DATA))
......@@ -589,13 +604,6 @@ FixupSegment(struct w_files * wpnt, int segment_num)
rep->target1, rep->target2);
free(rep1);
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:
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;
*sp = (unsigned short) address;
if (additive == 2)
......@@ -631,6 +643,10 @@ FixupSegment(struct w_files * wpnt, int segment_num)
case NE_RADDR_POINTER32:
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;
*sp = (unsigned short) address;
if (additive == 2)
......@@ -644,11 +660,15 @@ FixupSegment(struct w_files * wpnt, int segment_num)
case NE_RADDR_SELECTOR:
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;
*sp = (unsigned short) selector;
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);
......
......@@ -24,6 +24,7 @@
* integer atoms, use the "#1234" form.
*/
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
......@@ -90,7 +91,7 @@ static WORD ATOM_Hash( WORD entries, LPCSTR str, WORD len )
{
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;
}
......
......@@ -2,7 +2,7 @@ CFLAGS=$(COPTS) $(DEBUGOPTS) -I../include
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 \
dos_fs.o comm.o
dos_fs.o comm.o spy.o
default: misc.o
......
......@@ -661,7 +661,7 @@ char *WineIniFileName(void)
char *WinIniFileName()
{
char name[256];
static char name[256];
strcpy(name,GetDirectUnixFileName(WindowsDirectory));
strcat(name,"win.ini");
......
......@@ -52,7 +52,7 @@ LPSTR lstrcpyn(LPSTR target,LPCSTR source,int n)
/* KERNEL.90 */
int lstrlen(LPCSTR str)
{
strlen(str);
return strlen(str);
}
/* AnsiUpper USER.431 */
......
......@@ -125,7 +125,7 @@ static TSecHeader *load (char *file)
if (c == ' ' || c == '\t')
break;
if (c == '\n' || overflow) /* Abort Definition */
if (c == '\n' || c == ';' || overflow) /* Abort Definition */
next = CharBuffer;
if (c == '=' || overflow){
......
......@@ -152,8 +152,12 @@ BOOL SubtractRect( LPRECT dest, LPRECT src1, LPRECT src2 )
*dest = *src1;
if (IntersectRect( &tmp, src1, src2 ))
{
if (EqualRect( &tmp, dest )) SetRectEmpty( src1 );
else if ((tmp.top == dest->top) && (tmp.bottom == dest->bottom))
if (EqualRect( &tmp, dest ))
{
SetRectEmpty( dest );
return FALSE;
}
if ((tmp.top == dest->top) && (tmp.bottom == dest->bottom))
{
if (tmp.left == dest->left) dest->right = tmp.right;
else if (tmp.right == dest->right) dest->left = tmp.left;
......
/* 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 GDI_Init();
extern void SYSMETRICS_Init();
/***********************************************************************
* USER_HeapInit
......@@ -40,13 +41,16 @@ USER_InitApp(int hInstance)
{
int queueSize;
SpyInit();
/* Global atom table initialisation */
if (!ATOM_Init()) return 0;
/* GDI initialisation */
if (!GDI_Init()) return 0;
/* Initialize system colors */
/* Initialize system colors and metrics*/
SYSMETRICS_Init();
SYSCOLOR_Init();
/* Create USER heap */
......
......@@ -22,6 +22,8 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
Display * XT_display;
Screen * XT_screen;
Display * display;
Screen * screen;
XtAppContext XT_app_context;
static Widget topLevelWidget;
......@@ -40,6 +42,8 @@ void main(int argc, char **argv)
NULL );
XT_display = XtDisplay( topLevelWidget );
XT_screen = XtScreen( topLevelWidget );
display = XtDisplay( topLevelWidget );
screen = XtScreen( topLevelWidget );
DOS_InitFS();
Comm_Init();
......@@ -68,32 +72,3 @@ DWORD GetTickCount()
struct tms dummy;
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"
extern Display * XT_display;
extern Screen * XT_screen;
#define NB_HATCH_STYLES 6
......
......@@ -20,15 +20,22 @@ void CLIPPING_SetDeviceClipping( DC * dc )
if (dc->w.hGCClipRgn)
{
RGNOBJ *obj = (RGNOBJ *) GDI_GetObjPtr(dc->w.hGCClipRgn, REGION_MAGIC);
XSetClipMask( XT_display, dc->u.x.gc, obj->region.pixmap );
XSetClipOrigin( XT_display, dc->u.x.gc,
dc->w.DCOrgX + obj->region.box.left,
dc->w.DCOrgY + obj->region.box.top );
if (obj->region.pixmap)
{
XSetClipMask( display, dc->u.x.gc, obj->region.pixmap );
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
{
XSetClipMask( XT_display, dc->u.x.gc, None );
XSetClipOrigin( XT_display, dc->u.x.gc, dc->w.DCOrgX, dc->w.DCOrgY );
XSetClipMask( display, dc->u.x.gc, None );
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;
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->biWidth, bmp->biHeight, 32, bytesPerLine );
if (!image) return 0;
......
......@@ -11,9 +11,6 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <X11/Xatom.h>
#include "gdi.h"
extern Display * XT_display;
extern Screen * XT_screen;
/***********************************************************************
* FONT_MatchFont
......
......@@ -8,8 +8,6 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "gdi.h"
extern Display * XT_display;
extern Screen * XT_screen;
MDESC *GDI_Heap = NULL;
......
......@@ -7,7 +7,7 @@
static char Copyright[] = "Copyright Bob Amstadt, 1993";
#include <stdlib.h>
#include "win.h"
#include "windows.h"
/**********************************************************************
* LineDDA (GDI.100)
......
......@@ -18,9 +18,6 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "gdi.h"
extern Display * XT_display;
extern Screen * XT_screen;
extern Colormap COLOR_WinColormap;
GDIOBJHDR * PALETTE_systemPalette;
......@@ -36,7 +33,7 @@ BOOL PALETTE_Init()
HPALETTE hpalette;
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) );
if (!palPtr) return FALSE;
palPtr->palVersion = 0x300;
......@@ -46,7 +43,7 @@ BOOL PALETTE_Init()
for (i = 0; i < size; 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].peGreen = color.green >> 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 );
if (!palPtr) return 0;
if ((COLOR_WinColormap != DefaultColormapOfScreen(XT_screen)) &&
if ((COLOR_WinColormap != DefaultColormapOfScreen(screen)) &&
(hpalette == STOCK_DEFAULT_PALETTE))
{
if ((color & 0xffffff) == 0) return 0; /* Entry 0 is black */
......
......@@ -8,9 +8,6 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "gdi.h"
extern Display * XT_display;
extern Screen * XT_screen;
/***********************************************************************
* CreatePen (GDI.61)
......
......@@ -6,15 +6,8 @@
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 "message.h"
#include "callback.h"
#include "win.h"
#include "gdi.h"
#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_VCENTER) y = (rect->top + rect->bottom -
size.cy) / 2;
if (flags & DT_VCENTER) y = rect->top +
(rect->bottom - rect->top) / 2 - size.cy / 2;
else if (flags & DT_BOTTOM) y = rect->bottom - size.cy;
}
......
No preview for this file type
No preview for this file type
......@@ -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 \
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
......
......@@ -6,12 +6,8 @@
static char Copyright[] = "Copyright David Metcalfe, 1993";
#include <X11/Intrinsic.h>
#include "windows.h"
extern XtAppContext XT_app_context;
typedef struct
{
HWND hwnd;
......@@ -23,49 +19,46 @@ typedef struct
short height;
COLORREF color;
WORD timeout;
XtIntervalId xtid;
WORD timerid;
} CARET;
static CARET Caret;
static BOOL LockCaret;
static void CARET_Callback(XtPointer data, XtIntervalId *xtid);
static void CARET_HideCaret(CARET *pCaret);
static WORD CARET_Callback(HWND hwnd, WORD msg, WORD timerid, LONG ctime);
static void CARET_HideCaret();
/*****************************************************************
* 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;
HBRUSH hBrush;
HRGN rgn;
#ifdef DEBUG_CARET
printf("CARET_Callback: LockCaret=%d, hidden=%d, on=%d\n",
LockCaret, pCaret->hidden, pCaret->on);
printf("CARET_Callback: id=%d: LockCaret=%d, hidden=%d, on=%d\n",
timerid, LockCaret, Caret.hidden, Caret.on);
#endif
if (!LockCaret && (!pCaret->hidden || pCaret->on))
if (!LockCaret && (!Caret.hidden || Caret.on))
{
pCaret->on = (pCaret->on ? FALSE : TRUE);
hdc = GetDC(pCaret->hwnd);
hBrush = CreateSolidBrush(pCaret->color);
Caret.on = (Caret.on ? FALSE : TRUE);
hdc = GetDC(Caret.hwnd);
hBrush = CreateSolidBrush(Caret.color);
SelectObject(hdc, (HANDLE)hBrush);
SetROP2(hdc, R2_XORPEN);
rgn = CreateRectRgn(pCaret->x, pCaret->y,
pCaret->x + pCaret->width,
pCaret->y + pCaret->height);
rgn = CreateRectRgn(Caret.x, Caret.y,
Caret.x + Caret.width,
Caret.y + Caret.height);
FillRgn(hdc, rgn, hBrush);
DeleteObject((HANDLE)rgn);
DeleteObject((HANDLE)hBrush);
ReleaseDC(pCaret->hwnd, hdc);
ReleaseDC(Caret.hwnd, hdc);
}
pCaret->xtid = XtAppAddTimeOut(XT_app_context, pCaret->timeout,
CARET_Callback, pCaret);
return 0;
}
......@@ -73,24 +66,24 @@ static void CARET_Callback(XtPointer data, XtIntervalId *xtid)
* CARET_HideCaret
*/
static void CARET_HideCaret(CARET *pCaret)
static void CARET_HideCaret()
{
HDC hdc;
HBRUSH hBrush;
HRGN rgn;
pCaret->on = FALSE;
hdc = GetDC(pCaret->hwnd);
hBrush = CreateSolidBrush(pCaret->color);
Caret.on = FALSE;
hdc = GetDC(Caret.hwnd);
hBrush = CreateSolidBrush(Caret.color);
SelectObject(hdc, (HANDLE)hBrush);
SetROP2(hdc, R2_XORPEN);
rgn = CreateRectRgn(pCaret->x, pCaret->y,
pCaret->x + pCaret->width,
pCaret->y + pCaret->height);
rgn = CreateRectRgn(Caret.x, Caret.y,
Caret.x + Caret.width,
Caret.y + Caret.height);
FillRgn(hdc, rgn, hBrush);
DeleteObject((HANDLE)rgn);
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 cursor already exists, destroy it */
/* if (Caret.hwnd)
DestroyCaret();
......@@ -131,8 +125,11 @@ void CreateCaret(HWND hwnd, HBITMAP bitmap, short width, short height)
Caret.timeout = 750;
LockCaret = FALSE;
Caret.xtid = XtAppAddTimeOut(XT_app_context, Caret.timeout,
CARET_Callback, &Caret);
Caret.timerid = SetSystemTimer(NULL, 0, Caret.timeout, CARET_Callback);
#ifdef DEBUG_CARET
printf("CreateCaret: hwnd=%d, timerid=%d\n", hwnd, Caret.timerid);
#endif
}
......@@ -144,10 +141,14 @@ void DestroyCaret()
{
/* if (!Caret.hwnd) return;
*/
XtRemoveTimeOut(Caret.xtid);
#ifdef DEBUG_CARET
printf("DestroyCaret: timerid\n", Caret.timerid);
#endif
KillSystemTimer(NULL, Caret.timerid);
if (Caret.on)
CARET_HideCaret(&Caret);
CARET_HideCaret();
Caret.hwnd = 0; /* cursor marked as not existing */
}
......@@ -171,7 +172,7 @@ void SetCaretPos(short x, short y)
LockCaret = TRUE;
if (Caret.on)
CARET_HideCaret(&Caret);
CARET_HideCaret();
Caret.x = x;
Caret.y = y;
......@@ -189,7 +190,7 @@ void HideCaret(HWND hwnd)
LockCaret = TRUE;
if (Caret.on)
CARET_HideCaret(&Caret);
CARET_HideCaret();
++Caret.hidden;
LockCaret = FALSE;
......@@ -221,7 +222,9 @@ void SetCaretBlinkTime(WORD msecs)
{
if (!Caret.hwnd) return;
KillSystemTimer(NULL, Caret.timerid);
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 */
extern Display * XT_display;
extern Screen * XT_screen;
extern Display * display;
static HANDLE firstDCE = 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 );
}
}
else dc->u.x.drawable = DefaultRootWindow( XT_display );
else dc->u.x.drawable = DefaultRootWindow( display );
if (flags & DCX_CLIPCHILDREN)
XSetSubwindowMode( XT_display, dc->u.x.gc, ClipByChildren );
else XSetSubwindowMode( XT_display, dc->u.x.gc, IncludeInferiors);
XSetSubwindowMode( display, dc->u.x.gc, ClipByChildren );
else XSetSubwindowMode( display, dc->u.x.gc, IncludeInferiors);
if ((flags & DCX_INTERSECTRGN) || (flags & DCX_EXCLUDERGN))
{
......@@ -216,7 +215,7 @@ HDC GetWindowDC( HWND hwnd )
int ReleaseDC( HWND hwnd, HDC hdc )
{
HANDLE hdce;
DCE * dce;
DCE * dce = NULL;
#ifdef DEBUG_DC
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->inUse && (dce->hdc == hdc)) break;
}
if (!hdce) return 0;
if (dce->type == DCE_CACHE_DC)
{
SetDCState( dce->hdc, defaultDCstate );
dce->inUse = FALSE;
}
return (hdce != 0);
return 1;
}
......@@ -6,17 +6,19 @@
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#ifndef USE_XLIB
#include <X11/Intrinsic.h>
#include <X11/Shell.h>
#endif
#include "windows.h"
#include "win.h"
#include "class.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)
......@@ -26,6 +28,7 @@ LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
CLASS * classPtr;
LPSTR textPtr;
int len;
int tempwidth, tempheight;
WND * wndPtr = WIN_FindWndPtr( hwnd );
#ifdef DEBUG_MESSAGE
......@@ -51,40 +54,19 @@ LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
}
case WM_NCCALCSIZE:
{
#ifdef USE_XLIB
NCCALCSIZE_PARAMS *params = (NCCALCSIZE_PARAMS *)lParam;
if (wndPtr->dwStyle & WS_CHILD)
{
if (wndPtr->dwStyle & WS_BORDER)
{
params->rgrc[0].left += 1; /* SM_CXBORDER */
params->rgrc[0].top += 1; /* SM_CYBORDER */
params->rgrc[0].right -= 1; /* SM_CXBORDER */
params->rgrc[0].bottom -= 1; /* SM_CYBORDER */
}
}
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;
return NC_HandleNCCalcSize( hwnd, (NCCALCSIZE_PARAMS *)lParam );
case WM_NCPAINT:
return NC_HandleNCPaint( hwnd, (HRGN)wParam );
case WM_NCHITTEST:
return NC_HandleNCHitTest( hwnd, MAKEPOINT(lParam) );
case WM_NCLBUTTONDOWN:
case WM_NCLBUTTONUP:
case WM_NCLBUTTONDBLCLK:
case WM_NCMOUSEMOVE:
return NC_HandleNCMouseMsg( hwnd, msg, wParam, lParam );
case WM_NCDESTROY:
{
......@@ -188,18 +170,42 @@ LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
strlen((LPSTR)lParam) + 1);
textPtr = (LPSTR)USER_HEAP_ADDR(wndPtr->hText);
strcpy(textPtr, (LPSTR)lParam);
#ifdef USE_XLIB
XStoreName( XT_display, wndPtr->window, textPtr );
#else
if (wndPtr->shellWidget)
XtVaSetValues( wndPtr->shellWidget, XtNtitle, textPtr, NULL );
#endif
XStoreName( display, wndPtr->window, textPtr );
return (0L);
}
case WM_SETCURSOR:
if (wndPtr->hCursor != (HCURSOR)NULL)
SetCursor(wndPtr->hCursor);
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;
}
......@@ -184,11 +184,13 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, LPCSTR dlgTemplate,
HMENU hMenu;
HFONT hFont = 0;
HWND hwnd;
RECT rect;
WND * wndPtr;
int i;
DLGTEMPLATE template;
DLGCONTROLHEADER * header;
DIALOGINFO * dlgInfo;
DWORD exStyle = 0;
WORD xUnit = xBaseUnit;
WORD yUnit = yBaseUnit;
......@@ -229,7 +231,7 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, LPCSTR dlgTemplate,
HFONT oldFont;
HDC hdc;
hdc = GetDC(GetDesktopWindow());
hdc = GetDC(0);
oldFont = SelectObject( hdc, hFont );
GetTextMetrics( hdc, &tm );
SelectObject( hdc, oldFont );
......@@ -241,14 +243,19 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, LPCSTR dlgTemplate,
/* Create dialog main window */
hwnd = CreateWindow( template.className, template.caption,
template.header->style,
template.header->x * xUnit / 4,
template.header->y * yUnit / 8,
template.header->cx * xUnit / 4,
template.header->cy * yUnit / 8,
owner, hMenu, hInst,
NULL );
rect.left = rect.top = 0;
rect.right = template.header->cx * xUnit / 4;
rect.bottom = template.header->cy * yUnit / 8;
if (template.header->style & DS_MODALFRAME) exStyle |= WS_EX_DLGMODALFRAME;
AdjustWindowRectEx( &rect, template.header->style, hMenu, exStyle );
hwnd = CreateWindowEx( exStyle, template.className, template.caption,
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 (hFont) DeleteObject( hFont );
......
......@@ -27,13 +27,19 @@ HWND SetFocus(HWND hwnd)
if (hwnd == 0)
{
XSetInputFocus(XT_display, None, RevertToPointerRoot, CurrentTime);
XSetInputFocus(display, None, RevertToPointerRoot, CurrentTime);
}
else
{
XWindowAttributes win_attr;
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;
......
......@@ -7,7 +7,9 @@
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <math.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#ifndef PI
#define PI M_PI
#endif
......@@ -413,48 +415,44 @@ void DrawFocusRect( HDC hdc, LPRECT rc )
/**********************************************************************
* Line (Not a MSWin Call)
* DrawReliefRect (Not a MSWin Call)
*/
void Line(HDC hDC, int X1, int Y1, int X2, int Y2)
void DrawReliefRect( HDC hdc, RECT rect, int thickness, BOOL pressed )
{
MoveTo(hDC, X1, Y1);
LineTo(hDC, X2, Y2);
}
HBRUSH hbrushOld, hbrushShadow, hbrushHighlight;
int i;
hbrushShadow = CreateSolidBrush( GetSysColor(COLOR_BTNSHADOW) );
hbrushHighlight = CreateSolidBrush( GetSysColor(COLOR_BTNHIGHLIGHT) );
/**********************************************************************
* DrawReliefRect (Not a MSWin Call)
*/
void DrawReliefRect(HDC hDC, RECT rect, int ThickNess, int Mode)
{
HPEN hWHITEPen;
HPEN hDKGRAYPen;
HPEN hOldPen;
int OldColor;
rect.right--; rect.bottom--;
hDKGRAYPen = CreatePen(PS_SOLID, 1, 0x00808080L);
hWHITEPen = GetStockObject(WHITE_PEN);
hOldPen = SelectObject(hDC, hWHITEPen);
while(ThickNess > 0) {
if (Mode == 0)
SelectObject(hDC, hWHITEPen);
else
SelectObject(hDC, hDKGRAYPen);
Line(hDC, rect.left, rect.top, rect.right, rect.top);
Line(hDC, rect.left, rect.top, rect.left, rect.bottom + 1);
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--;
if (pressed) hbrushOld = SelectObject( hdc, hbrushShadow );
else hbrushOld = SelectObject( hdc, hbrushHighlight );
for (i = 0; i < thickness; i++)
{
PatBlt( hdc, rect.left + i, rect.top,
1, rect.bottom - rect.top - i, PATCOPY );
PatBlt( hdc, rect.left, rect.top + i,
rect.right - rect.left - i, 1, PATCOPY );
}
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)
*/
......
......@@ -17,15 +17,15 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "message.h"
#include "win.h"
#include "wineopts.h"
#include "sysmetrics.h"
#define MAX_QUEUE_SIZE 120 /* Max. size of a message queue */
extern BOOL TIMER_CheckTimer( DWORD *next ); /* timer.c */
extern Display * XT_display;
extern Screen * XT_screen;
extern XtAppContext XT_app_context;
extern BOOL TIMER_CheckTimer( DWORD *next ); /* timer.c */
extern void EVENT_ProcessEvent( XEvent *event ); /* event.c */
extern Display * display;
/* System message queue (for hardware events) */
static HANDLE hmemSysMsgQueue = 0;
......@@ -35,6 +35,10 @@ static MESSAGEQUEUE * sysMsgQueue = NULL;
static HANDLE hmemAppMsgQueue = 0;
static MESSAGEQUEUE * appMsgQueue = NULL;
/* Double-click time */
static int doubleClickSpeed = 452;
/***********************************************************************
* MSG_CreateMsgQueue
*
......@@ -78,7 +82,8 @@ static HANDLE MSG_CreateMsgQueue( int size )
/***********************************************************************
* 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 )
{
......@@ -86,6 +91,7 @@ BOOL MSG_CreateSysMsgQueue( int size )
else if (size <= 0) size = 1;
if (!(hmemSysMsgQueue = MSG_CreateMsgQueue( size ))) return FALSE;
sysMsgQueue = (MESSAGEQUEUE *) GlobalLock( hmemSysMsgQueue );
doubleClickSpeed = GetProfileInt( "windows", "DoubleClickSpeed", 452 );
return TRUE;
}
......@@ -99,6 +105,8 @@ static int MSG_AddMsg( MESSAGEQUEUE * msgQueue, MSG * msg, DWORD extraInfo )
{
int pos;
SpyMessage(msg->hwnd, msg->message, msg->wParam, msg->lParam);
if (!msgQueue) return FALSE;
pos = msgQueue->nextFreeMessage;
......@@ -184,6 +192,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
*/
void MSG_IncPaintCount( HANDLE hQueue )
......@@ -233,6 +328,7 @@ void MSG_DecTimerCount( HANDLE hQueue )
* hardware_event
*
* 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,
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
*/
......@@ -351,9 +429,7 @@ static BOOL MSG_PeekMessage( MESSAGEQUEUE * msgQueue, LPMSG msg, HWND hwnd,
{
int pos, mask;
DWORD nextExp; /* Next timer expiration time */
#ifdef USE_XLIB
XEvent event;
#endif
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;
#ifdef USE_XLIB
while (XPending( XT_display ))
while (XPending( display ))
{
XNextEvent( XT_display, &event );
XNextEvent( display, &event );
EVENT_ProcessEvent( &event );
}
#else
while (XtAppPending( XT_app_context ))
XtAppProcessEvent( XT_app_context, XtIMAll );
#endif
while(1)
{
......@@ -432,6 +503,8 @@ static BOOL MSG_PeekMessage( MESSAGEQUEUE * msgQueue, LPMSG msg, HWND hwnd,
msgQueue->GetMessageExtraInfoVal = qmsg->extraInfo;
if (flags & PM_REMOVE) MSG_RemoveMsg( sysMsgQueue, pos );
if ((msg->message >= WM_MOUSEFIRST) &&
(msg->message <= WM_MOUSELAST)) MSG_TranslateMouseMsg( msg );
break;
}
......@@ -447,26 +520,16 @@ static BOOL MSG_PeekMessage( MESSAGEQUEUE * msgQueue, LPMSG msg, HWND hwnd,
/* Finally handle WM_TIMER messages */
if ((msgQueue->status & QS_TIMER) && (mask & QS_TIMER))
{
BOOL posted = TIMER_CheckTimer( &nextExp );
#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 */
}
if (TIMER_CheckTimer( &nextExp ))
continue; /* Restart the whole search */
/* Wait until something happens */
if (peek) return FALSE;
#ifdef USE_XLIB
if (!XPending( XT_display ) && (nextExp != -1))
if (!XPending( display ) && (nextExp != -1))
{
fd_set read_set;
struct timeval timeout;
int fd = ConnectionNumber(XT_display);
int fd = ConnectionNumber(display);
FD_ZERO( &read_set );
FD_SET( fd, &read_set );
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)
continue; /* On timeout or error, restart from the start */
}
XNextEvent( XT_display, &event );
XNextEvent( display, &event );
EVENT_ProcessEvent( &event );
#else
XtAppProcessEvent( XT_app_context, XtIMAll );
#endif
}
/* 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 )
{
WND * wndPtr = WIN_FindWndPtr( hwnd );
WND * wndPtr;
SpyMessage(hwnd, msg, wParam, lParam);
wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return 0;
return CallWindowProc( wndPtr->lpfnWndProc, hwnd, msg, wParam, lParam );
}
......@@ -564,7 +628,7 @@ LONG DispatchMessage( LPMSG msg )
int painting;
#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->time, msg->pt.x, msg->pt.y );
#endif
......@@ -587,7 +651,7 @@ LONG DispatchMessage( LPMSG msg )
if (painting && (wndPtr->flags & WIN_NEEDS_BEGINPAINT))
{
#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
wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT;
}
......
......@@ -21,9 +21,12 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
*/
HDC BeginPaint( HWND hwnd, LPPAINTSTRUCT lps )
{
HRGN hrgnUpdate;
WND * wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return 0;
hrgnUpdate = wndPtr->hrgnUpdate; /* Save update region */
if (!(lps->hdc = GetDCEx( hwnd, wndPtr->hrgnUpdate,
DCX_INTERSECTRGN | DCX_USESTYLE ))) return 0;
GetRgnBox( InquireVisRgn(lps->hdc), &lps->rcPaint );
......@@ -35,7 +38,8 @@ HDC BeginPaint( HWND hwnd, LPPAINTSTRUCT lps )
MSG_DecPaintCount( wndPtr->hmemTaskQ );
}
wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT;
SendMessage( hwnd, WM_NCPAINT, hrgnUpdate, 0 );
if (!(wndPtr->flags & WIN_ERASE_UPDATERGN)) lps->fErase = TRUE;
else lps->fErase = !SendMessage( hwnd, WM_ERASEBKGND, lps->hdc, 0 );
......
/*
* 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];
}
......@@ -8,8 +8,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "win.h"
extern Display * XT_display;
extern Screen * XT_screen;
extern Display * display;
/***********************************************************************
......@@ -213,10 +212,8 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, short x, short y,
RECT newWindowRect, newClientRect;
WND *wndPtr;
int calcsize_result = 0;
#ifdef USE_XLIB
XWindowChanges winChanges;
int changeMask = 0;
#endif
#ifdef DEBUG_WIN
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 */
#ifdef USE_XLIB
if (!(winPos->flags & SWP_NOMOVE))
{
WND * parentPtr;
......@@ -343,31 +340,28 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, short x, short y,
}
changeMask |= CWStackMode;
}
if (changeMask) XConfigureWindow( XT_display, wndPtr->window,
if (changeMask) XConfigureWindow( display, wndPtr->window,
changeMask, &winChanges );
#endif
if (winPos->flags & SWP_SHOWWINDOW)
{
wndPtr->dwStyle |= WS_VISIBLE;
#ifdef USE_XLIB
XMapWindow( XT_display, wndPtr->window );
#else
if (wndPtr->shellWidget) XtMapWidget( wndPtr->shellWidget );
else XtMapWidget( wndPtr->winWidget );
#endif
XMapWindow( display, wndPtr->window );
}
else if (winPos->flags & SWP_HIDEWINDOW)
{
wndPtr->dwStyle &= ~WS_VISIBLE;
#ifdef USE_XLIB
XUnmapWindow( XT_display, wndPtr->window );
#else
if (wndPtr->shellWidget) XtUnmapWidget( wndPtr->shellWidget );
else XtUnmapWidget( wndPtr->winWidget );
#endif
XUnmapWindow( display, wndPtr->window );
}
/* 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 */
wndPtr->rectWindow = newWindowRect;
wndPtr->rectClient = newClientRect;
......
[drives]
a=/mnt/fd0
c=/dos
d=/usr/windows
e=/home/bob/Wine/work
f=/home/bob/test
A=/mnt/fd0
C=/dos
D=/usr/windows
E=/home/bob/Wine/work
F=/home/bob/test
[wine]
windows=c:\windows
system=c:\windows\system
temp=c:\temp
path=c:\windows;c:\windows\system;e:\;e:\test;f:\
Windows=c:\windows
System=c:\windows\system
Temp=c:\temp
Path=c:\windows;c:\windows\system;e:\;e:\test;f:\
SystemResources=sysres.dll
; SystemResources=
[serialports]
com1=/dev/cua0
com2=/dev/cua1
Com1=/dev/cua0
Com2=/dev/cua1
[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=
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment