Commit dba420a7 authored by Alexandre Julliard's avatar Alexandre Julliard

Release 940201

Tue Feb 1 21:14:47 1994 Bob Amstadt (bob@pooh) * [loader/selector.c] Added function CreateNewSegments(). Modified IPCCopySelector to allow aliasing to any arbitrary memory space. * [memory/global.c] Fixed potential bug in GlobalGetFreeSegments(). * [memory/linear.c] Created functions GlobalLinearLock() and GlobalLinearUnlock(). Tue Feb 1 05:51:43 1994 julliard@di.epfl.ch (Alexandre Julliard) * [controls/widgets.c] Removed CAPTION window class. * [loader/cursor.c] Bug fix in LoadCursor(): don't allocate memory every time for built-in cursors. * [windows/clipping.c] Invalidate child windows in InvalidateRgn(). * [windows/defwnd.c] Added repaint of the caption when changing window text. * [windows/event.c] Modified SetCapture() to allow keyboard events while capturing. * [windows/message.c] New function MSG_GetHardwareMessage(), to do mouse tracking without returning control to the Windows program. * [windows/nonclient.c] A couple of changes in frame drawing for DLGMODALFRAME windows. Rewritten window moving code, to use MSG_GetHardwareMessage() instead of non-client mouse events (this is the way Windows does it), and to send WM_ENTERSIZEMOVE messages. Removed WM_NCBUTTONUP and WM_NCMOUSEMOVE handlers. * [windows/win.c] Allocate temporary structures on the USER heap instead of using GlobalAlloc(). * [windows/winpos.c] Added function WINPOS_GetMinMaxInfo() to get sizing informations. Jan 31, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [windows/nonclient.c] Call to StdDrawScrollBar() during NC's drawing. Call to NC_ScrollBarButtonDown() on NC mouse events WM_LBUTTONDOWN. Call to NC_ScrollBarButtonUp() on NC mouse events WM_LBUTTONUP. Call to NC_ScrollBarMouseMove() on NC mouse events WM_MOUSEMOVE. * [controls/menu.c] New GetSubMenu() function. Move GetMenu() & SetMenu() functions from 'windows/win.c'. * [controls/listbox.c] Start changes to satisfy recent changes in scrollbars/windows. * [loader/resource.c] Put some code in LoadAccelerators() stub. New TranslateAccelerator() function. * [windows/win.c] Remove GetMenu() & SetMenu() functions. Call to NC_CreateScrollBars() if required by CreateWindow(). Mon Jan 24 10:40:10 EST 1994 John Richardson (jrichard@cs.uml.edu) * [window/win.c] Added functions EnumWindows, EnumChildWindows, and helper WIN_EnumChildWin. EnumWindows won't list all wine windows because GetDesktopWindow isn't complete. However, the code is in place for it to work correctly and only needs GetDesktopWindow to do so. Tue Jan 25 05:51:47 1994 julliard@di.epfl.ch (Alexandre Julliard) * [windows/defwnd.c] Added handling of activation messages (WM_ACTIVATE, WM_NCACTIVATE, WM_MOUSEACTIVATE) * [windows/event.c] De-activate the window when losing input focus. * [windows/focus.c] Bug fix in SetFocus(). * [windows/message.c] Added activation of the window on mouse-clicks. * [windows/nonclient.c] Changed non-client area painting to use the correct colors depending upon the activation state. Added WM_NCACTIVATE message handling. Fixed a couple of bugs in window moving and resizing. * [windows/winpos.c] Implemented Get/SetActiveWindow(). Implemented SWP_NOACTIVATE flag in SetWindowPos(). Jan 17, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [misc/message.c] MessageBox has a CaptionBar for his title except for MB_SYSTEMMODAL with MB_ICONHAND. * [windows/nonclient.c] Call to NC_TrackSysMenu on SysMenu button mouse click. * [windows/defwnd.c] Call to NC_TrackSysMenu on Alt key (VK_MENU). * [controls/menu.c] New GetSystemMenu() function. New CopySystemMenu() internal function. New NC_TrackSysMenu() internal function. * [include/windows.h] New WM_INITMENU, WM_INITMENUPOPUP, WM_MENUSELECT & WM_MENUCHAR defines.
parent 86a8d0f9
Tue Feb 1 21:14:47 1994 Bob Amstadt (bob@pooh)
* [loader/selector.c]
Added function CreateNewSegments(). Modified IPCCopySelector
to allow aliasing to any arbitrary memory space.
* [memory/global.c]
Fixed potential bug in GlobalGetFreeSegments().
* [memory/linear.c]
Created functions GlobalLinearLock() and GlobalLinearUnlock().
Tue Feb 1 05:51:43 1994 julliard@di.epfl.ch (Alexandre Julliard)
* [controls/widgets.c]
Removed CAPTION window class.
* [loader/cursor.c]
Bug fix in LoadCursor(): don't allocate memory every time for
built-in cursors.
* [windows/clipping.c]
Invalidate child windows in InvalidateRgn().
* [windows/defwnd.c]
Added repaint of the caption when changing window text.
* [windows/event.c]
Modified SetCapture() to allow keyboard events while capturing.
* [windows/message.c]
New function MSG_GetHardwareMessage(), to do mouse tracking
without returning control to the Windows program.
* [windows/nonclient.c]
A couple of changes in frame drawing for DLGMODALFRAME windows.
Rewritten window moving code, to use MSG_GetHardwareMessage()
instead of non-client mouse events (this is the way Windows
does it), and to send WM_ENTERSIZEMOVE messages.
Removed WM_NCBUTTONUP and WM_NCMOUSEMOVE handlers.
* [windows/win.c]
Allocate temporary structures on the USER heap instead of
using GlobalAlloc().
* [windows/winpos.c]
Added function WINPOS_GetMinMaxInfo() to get sizing informations.
Jan 31, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
* [windows/nonclient.c]
Call to StdDrawScrollBar() during NC's drawing.
Call to NC_ScrollBarButtonDown() on NC mouse events WM_LBUTTONDOWN.
Call to NC_ScrollBarButtonUp() on NC mouse events WM_LBUTTONUP.
Call to NC_ScrollBarMouseMove() on NC mouse events WM_MOUSEMOVE.
* [controls/menu.c]
New GetSubMenu() function.
Move GetMenu() & SetMenu() functions from 'windows/win.c'.
* [controls/combo.c]
Start changes to satisfy recent changes in scrollbars/windows.
* [loader/resource.c]
Put some code in LoadAccelerators() stub.
New TranslateAccelerator() function.
* [windows/win.c]
Remove GetMenu() & SetMenu() functions.
Call to NC_CreateScrollBars() if required by CreateWindow().
----------------------------------------------------------------------
Mon Jan 24 10:40:10 EST 1994 John Richardson (jrichard@cs.uml.edu)
* [window/win.c]
Added functions EnumWindows, EnumChildWindows, and helper
WIN_EnumChildWin. EnumWindows won't list all wine windows
because GetDesktopWindow isn't complete. However, the code
is in place for it to work correctly and only needs
GetDesktopWindow to do so.
Tue Jan 25 05:51:47 1994 julliard@di.epfl.ch (Alexandre Julliard)
* [windows/defwnd.c]
Added handling of activation messages (WM_ACTIVATE,
WM_NCACTIVATE, WM_MOUSEACTIVATE)
* [windows/event.c]
De-activate the window when losing input focus.
* [windows/focus.c]
Bug fix in SetFocus().
* [windows/message.c]
Added activation of the window on mouse-clicks.
* [windows/nonclient.c]
Changed non-client area painting to use the correct colors
depending upon the activation state.
Added WM_NCACTIVATE message handling.
Fixed a couple of bugs in window moving and resizing.
* [windows/winpos.c]
Implemented Get/SetActiveWindow().
Implemented SWP_NOACTIVATE flag in SetWindowPos().
Jan 17, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
* [misc/message.c]
MessageBox has a CaptionBar for his title except for
MB_SYSTEMMODAL with MB_ICONHAND.
* [windows/nonclient.c]
Call to NC_TrackSysMenu on SysMenu button mouse click.
* [windows/defwnd.c]
Call to NC_TrackSysMenu on Alt key (VK_MENU).
* [controls/menu.c]
New GetSystemMenu() function.
New CopySystemMenu() internal function.
New NC_TrackSysMenu() internal function.
* [include/windows.h]
New WM_INITMENU, WM_INITMENUPOPUP, WM_MENUSELECT & WM_MENUCHAR defines.
----------------------------------------------------------------------
Thu Jan 13 11:45:13 1994 John Richardson <jrichard@cs.uml.edu>
* [window/win.c]
......
This is intend to be a document to help new developers get started.
Existing developers should feel free to add there comments.
RESERVING WINE PROJECT ARES:
If you wish to work on a specific set of API functions. Send
mail to wine-project@amscons.com. The automatic mail handler
will provide you with instructions.
SUBMITTING YOUR WORK:
Submissions of code for inclussion into Wine should be sent to
bob@amscons.com (Bob Amstadt). You MUST provide a suitable
ChangeLog entry for any work that you submit. I prefer new code
to be submitted as diffs off of the latest release. Releases are
every Tuesday evening (approximately 19:00 PST or Wednesday 03:00 GMT).
MEMORY AND SEGMENTS:
NE (Win16) executables consist of multiple segments. The Wine loader
loads each segment into a unique location the Wine processes memory
and assigns a selector to that segment. To make address conversion
simpler, Wine loads the segments in such a way that the segmented
address (16:16) is stored in memory the same way as the 32-bit linear
address. For example, the segmented address 1237:89AB can be at the
address 0x123789AB in the Wine process space.
This also implies that a Win16 program cannot access any arbitrary
memory location. If a pointer needs to be returned to a Win16 program,
then the memory block must be allocated using either GlobalAlloc()
or HEAP_Alloc(). The HEAP_* functions are faster than the Global*
functions but are only capable of managing a 64k memory block. The
HEAP_* functions are used to implement local heaps. Wine should
never call Local* functions. These functions are reserved for use
by Win16 programs only!
The following code fragment should be used to establish a new Wine
local heap:
#include "heap.h"
#define MY_HEAP_SIZE 0x10000 /* Must be <= 64k */
int MyHeapHandle;
void *MyHeapBase;
MDESC *MyHeap;
...
int InitMyHeap()
{
MyHeapHandle = GlobalAlloc(GMEM_FIXED, MY_HEAP_SIZE);
if (MyHeapHandle == 0)
return -1;
MyHeapBase = GlobalLock(MyHeapHandle);
HEAP_Init(&MyHeap, MyHeapBase, MY_HEAP_SIZE);
return 0;
}
Memory blocks greater than 64 kilobytes in length must be allocated
using GlobalAlloc(). Because of our special memory mapping, GlobalLock()
cannot be used to obtain the address of a linearly accessible memory
block that is greater than 64kB in length. Instead GlobalLinearLock()
should be used. The inverse function GlobalLinearUnlock() must be
called before the block can be freed with GlobalFree().
API ENTRY POINTS:
Because Win16 programs use a 16-bit stack and because they can only
call 16:16 addressed functions, all API entry points must be at low
address offsets and must have the arguments translated and moved to
Wines 32-bit stack. This task is handled by the code in the "if1632"
directory. To define a new API entry point handler you must place a
new entry in the appropriate API specification file. These files are
named *.spec. For example, the API specification file for the USER DLL
is contained in the file user.spec. These entries are processed by
the "build" program to create dll_*.s and dll_tab_*.c. The dll_*.s
files contain the entry point code for each API call, and the dll_tab_*.s
files contain tables used by relay.c to translate arguments and transfer
control to the proper handler. The format of the *.spec files is
documented in the file "tools/build-spec.txt".
\ No newline at end of file
#include "Wine.tmpl"
/*
* This is the first try at using Imakefiles. There are probably many
* problems and things I haven't even considered. I do not have a Linux
* system to test them on, just NetBSD, so you may need to change things
* like the the SYSLIBS definition below...
* This is the second try at using Imakefiles. There are probably many
* problems and things I haven't even considered. I do not have a fixed
* Linux system to test them on, but thanks to Thomas Michlmayr
* <tmichl@cosy.sbg.ac.at> for use of one of his boxes.
*
* Peter Galbavy, 5th Dec 1993 peter@wonderland.org
* SEE BELOW ABOUT DEBUGGING AND LINUX
*
* Peter Galbavy, 31st Jan 1994: peter@wonderland.org
*/
#define IHaveSubDirs
#define IHaveSubdirs
#define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' 'CC=$(CC)'
SUBDIRS = \
tools \
controls \
debugger \
etc \
if1632 \
include \
......@@ -26,6 +27,21 @@ SUBDIRS = \
test \
windows
/*
* due to me not having the time and resources to test this, debugging
* has been left out by for now of the Imakefiles. To put it back you have
* to add:
* debugger
* to the SUBDIRS list and:
* debugger
* readline.o
* to the OBJS list.
*
* Not doing this will make the build fail in loader/signal.c, with an
* unresolved reference to wine_debug. Comment out the line for now...
* sigh. Fixed soon.
*/
WINEDIR = $(LIBDIR)/wine
OBJS = \
......@@ -35,32 +51,29 @@ OBJS = \
memory.o \
misc.o \
objects.o \
windows.o \
debugger.o \
readline.o
windows.o
#ifdef i386BsdArchitecture
SYSLIBS = -ll -lm -li386 -lgnumalloc
#else
#ifdef LinuxArchitechture
#ifdef LinuxArchitecture
SYSLIBS = -lm
#endif
#endif
AllTarget(wine)
NamedTargetSubdirs($(OBJS),$(SUBDIRS),"making",PassCDebugFlags,all)
MakefileSubdirs($(SUBDIRS))
MakeSubdirs($(SUBDIRS))
DependSubdirs($(SUBDIRS))
IncludesSubdirs($(SUBDIRS))
CleanSubdirs($(SUBDIRS))
#ifdef i386BsdArchitecture
AllTarget(wine)
#endif
NormalProgramTarget(wine,$(OBJS),XawClientDepLibs,XawClientLibs,$(SYSLIBS))
#ifdef LinuxArchitecture
AllTarget(wine)
#endif
depend::
install::
includes::
clean::
......@@ -27,6 +27,9 @@ clean:
rm -f *~ *.o *#
@for i in tools $(SUBDIRS); do (cd $$i && $(MAKE) clean) || exit; done
patchclean:
rm -f `find . -name '*.orig' -o -name '*.rej'`
$(TARGET): dummy
@for i in tools $(SUBDIRS); \
do (cd $$i && echo $$i && $(MAKE) INCLUDE_DIR=../$(INCLUDE_DIR) \
......@@ -36,5 +39,5 @@ $(TARGET): dummy
depend:
@for i in tools $(SUBDIRS); \
do (cd $$i && echo $$i && \
$(MAKE) INCLUDE_DIR=../$(INCLUDE_DIR) depend) \
$(MAKE) INCLUDE_DIR=../$(INCLUDE_DIR) COPTS="$(COPTS)" depend) \
|| exit; done
......@@ -41,6 +41,17 @@ 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 Wine-940201: (see ChangeLog for details)
- Support for huge data structures.
- FreeBSD support.
- Many many bug fixes
WHAT'S NEW with version 0.8: (see ChangeLog for details)
- Eliminated Xt-dependent code. Thanks to Alexandre and Martin.
- EnumWindows() and EnumChildWindows()
- Activating and deactivating of windows.
- More work on system menus.
WHAT'S NEW with version 0.7: (see ChangeLog for details)
- Eliminated Xt-dependent code. Thanks to Alexandre and Martin.
- Other bug fixes.
......
diff -ruN ../Backup//Makefile ./Makefile
--- ../Backup//Makefile Tue Sep 14 09:47:00 1993
+++ ./Makefile Thu Sep 16 09:59:52 1993
@@ -7,7 +7,7 @@
######################################################################
# These definitions are for the top level
TARGET=wine
-LIBS=-L. -L/usr/X386/lib -lXext -lXaw -lXt -lXmu -lX11 -lm
+LIBS=-L. -L/usr/X386/lib -lXext -lXaw -lXt -lXmu -lX11 -lm -li386 -lgnumalloc -ll
OBJS=if1632/if1632.o controls/controls.o loader/loader.o \
memory/memory.o misc/misc.o objects/objects.o windows/windows.o
SUBDIRS=if1632 controls loader memory misc objects windows
*** Makefile.orig Tue Jan 18 12:36:47 1994
--- Makefile Mon Jan 24 22:34:06 1994
***************
*** 8,14 ****
######################################################################
# These definitions are for the top level
TARGET=wine
! LIBS=-L/usr/X386/lib -lX11 -lm
OBJS=if1632/if1632.o controls/controls.o loader/loader.o \
memory/memory.o misc/misc.o objects/objects.o windows/windows.o debugger/debugger.o
SUBDIRS=if1632 controls loader memory misc objects windows debugger
--- 8,14 ----
######################################################################
# These definitions are for the top level
TARGET=wine
! LIBS=-L/usr/X386/lib -lX11 -lm -li386 -lgnumalloc -ll
OBJS=if1632/if1632.o controls/controls.o loader/loader.o \
memory/memory.o misc/misc.o objects/objects.o windows/windows.o debugger/debugger.o
SUBDIRS=if1632 controls loader memory misc objects windows debugger
diff -ruN ../Backup//controls/Makefile ./controls/Makefile
--- ../Backup//controls/Makefile Sat Sep 11 22:13:44 1993
+++ ./controls/Makefile Thu Sep 16 10:00:24 1993
......
......@@ -3,30 +3,24 @@
MODULE = controls
SRCS = \
menu.c \
widgets.c \
button.c \
scroll.c \
listbox.c \
caption.c \
combo.c \
listbox.c \
menu.c \
scroll.c \
static.c \
SmeMenuButto.c \
WinLabel.c \
WinCommand.c \
WinMenuButto.c
widgets.c
OBJS = \
menu.o \
widgets.o \
button.o \
scroll.o \
listbox.o \
caption.o \
combo.o \
listbox.o \
menu.o \
scroll.o \
static.o \
SmeMenuButto.o \
WinLabel.o \
WinCommand.o \
WinMenuButto.o
widgets.o
WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS))
DependTarget()
......
......@@ -512,8 +512,8 @@ static LONG CB_Paint(HWND hWnd)
FillRect(hDC, &rc, hBrush);
textlen = GetWindowTextLength(hWnd);
hText = LocalAlloc(LMEM_MOVEABLE, textlen+1);
text = LocalLock(hText);
hText = USER_HEAP_ALLOC(0, textlen+1);
text = USER_HEAP_ADDR(hText);
GetWindowText(hWnd, text, textlen+1);
GetTextMetrics(hDC, &tm);
......@@ -555,8 +555,7 @@ static LONG CB_Paint(HWND hWnd)
DrawFocusRect(hDC, &rc);
}
LocalUnlock(hText);
LocalFree(hText);
USER_HEAP_FREE(hText);
GlobalUnlock(hWnd);
EndPaint(hWnd, &ps);
}
......@@ -725,8 +724,8 @@ static LONG RB_Paint(HWND hWnd)
FillRect(hDC, &rc, hBrush);
textlen = GetWindowTextLength(hWnd);
hText = LocalAlloc(LMEM_MOVEABLE, textlen+1);
text = LocalLock(hText);
hText = USER_HEAP_ALLOC(0, textlen+1);
text = USER_HEAP_ADDR(hText);
GetWindowText(hWnd, text, textlen+1);
GetTextMetrics(hDC, &tm);
......@@ -760,8 +759,7 @@ static LONG RB_Paint(HWND hWnd)
DrawFocusRect(hDC, &rc);
}
LocalUnlock(hText);
LocalFree(hText);
USER_HEAP_FREE(hText);
GlobalUnlock(hWnd);
EndPaint(hWnd, &ps);
}
......@@ -900,8 +898,8 @@ static LONG GB_Paint(HWND hWnd)
FillRect(hDC, &rc, hBrush);
textlen = GetWindowTextLength(hWnd);
hText = LocalAlloc(LMEM_MOVEABLE, textlen+1);
text = LocalLock(hText);
hText = USER_HEAP_ALLOC(0, textlen+1);
text = USER_HEAP_ADDR(hText);
GetWindowText(hWnd, text, textlen+1);
GetTextExtentPoint(hDC, text, textlen, &size);
......@@ -913,8 +911,7 @@ static LONG GB_Paint(HWND hWnd)
rc.bottom = size.cy;
DrawText(hDC, text, textlen, &rc, DT_SINGLELINE);
LocalUnlock(hText);
LocalFree(hText);
USER_HEAP_FREE(hText);
EndPaint(hWnd, &ps);
}
......
......@@ -66,9 +66,15 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
lphc->hWndDrop = CreateWindow("BUTTON", "",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_OWNERDRAW,
width - 16, 0, 16, 16, hwnd, 1, wndPtr->hInstance, 0L);
lphc->hWndEdit = CreateWindow("STATIC", "",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | SS_LEFT,
0, 0, width - 16, 16, hwnd, 1, wndPtr->hInstance, 0L);
if (wndPtr->dwStyle & CBS_SIMPLE)
/* lphc->hWndEdit = CreateWindow("EDIT", "", */
lphc->hWndEdit = CreateWindow("STATIC", "",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | SS_LEFT,
0, 0, width - 16, 16, hwnd, 1, wndPtr->hInstance, 0L);
else
lphc->hWndEdit = CreateWindow("STATIC", "",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | SS_LEFT,
0, 0, width - 16, 16, hwnd, 1, wndPtr->hInstance, 0L);
lphc->hWndLBox = CreateWindow("LISTBOX", "",
WS_CHILD | WS_CLIPCHILDREN | WS_BORDER | WS_VSCROLL | LBS_NOTIFY,
wndPtr->rectClient.left, wndPtr->rectClient.top + 16, width, height,
......@@ -128,7 +134,7 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
switch(HIWORD(lParam))
{
case LBN_SELCHANGE:
lphc->dwState = lphc->dwState & (CB_SHOWDROPDOWN ^ 0xFFFF);
lphc->dwState = lphc->dwState & (CB_SHOWDROPDOWN ^ 0xFFFFFFFFL);
ShowWindow(lphc->hWndLBox, SW_HIDE);
y = SendMessage(lphc->hWndLBox, LB_GETCURSEL, 0, 0L);
if (y != LB_ERR) {
......
......@@ -79,11 +79,11 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
else
lphl->hWndLogicParent = GetParent(hwnd);
lphl->ColumnsWidth = wndPtr->rectClient.right - wndPtr->rectClient.left;
if (wndPtr->hWndVScroll != (HWND)NULL) {
if (wndPtr->dwStyle & WS_VSCROLL) {
SetScrollRange(hwnd, SB_VERT, 1, lphl->ItemsCount, TRUE);
ShowScrollBar(hwnd, SB_VERT, FALSE);
}
if (wndPtr->hWndHScroll != (HWND)NULL) {
if (wndPtr->dwStyle & WS_HSCROLL) {
SetScrollRange(hwnd, SB_HORZ, 1, 1, TRUE);
ShowScrollBar(hwnd, SB_HORZ, FALSE);
}
......@@ -225,7 +225,7 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
lphl = ListBoxGetStorageHeader(hwnd);
if (lphl->FirstVisible > 1) {
lphl->FirstVisible--;
if (wndPtr->hWndVScroll != (HWND)NULL)
if (wndPtr->dwStyle & WS_VSCROLL)
SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
......@@ -237,7 +237,7 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
lphl = ListBoxGetStorageHeader(hwnd);
if (lphl->FirstVisible < lphl->ItemsCount) {
lphl->FirstVisible++;
if (wndPtr->hWndVScroll != (HWND)NULL)
if (wndPtr->dwStyle & WS_VSCROLL)
SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
......@@ -310,7 +310,7 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
if ((wndPtr->dwStyle & LBS_MULTIPLESEL) != LBS_MULTIPLESEL) {
ListBoxSetCurSel(hwnd, lphl->ItemFocused);
}
if (wndPtr->hWndVScroll != (HWND)NULL)
if (wndPtr->dwStyle & WS_VSCROLL)
SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
......@@ -419,7 +419,7 @@ LONG ListBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
printf("ListBox LB_SETTOPINDEX wParam=%x !\n", wParam);
lphl = ListBoxGetStorageHeader(hwnd);
lphl->FirstVisible = wParam;
if (wndPtr->hWndVScroll != (HWND)NULL)
if (wndPtr->dwStyle & WS_VSCROLL)
SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
......@@ -482,10 +482,10 @@ void StdDrawListBox(HWND hwnd)
MAKELONG(hwnd, CTLCOLOR_LISTBOX));
if (hBrush == (HBRUSH)NULL) hBrush = GetStockObject(WHITE_BRUSH);
GetClientRect(hwnd, &rect);
if ((wndPtr->hWndVScroll != (HWND)NULL) &&
IsWindowVisible(wndPtr->hWndVScroll)) rect.right -= 16;
if ((wndPtr->hWndHScroll != (HWND)NULL) &&
IsWindowVisible(wndPtr->hWndHScroll)) rect.bottom -= 16;
/*
if (wndPtr->dwStyle & WS_VSCROLL) rect.right -= 16;
if (wndPtr->dwStyle & WS_HSCROLL) rect.bottom -= 16;
*/
FillRect(hdc, &rect, hBrush);
maxwidth = rect.right;
rect.right = lphl->ColumnsWidth;
......@@ -531,9 +531,11 @@ void StdDrawListBox(HWND hwnd)
EndOfPaint:
EndPaint( hwnd, &ps );
if ((lphl->ItemsCount > lphl->ItemsVisible) &
(wndPtr->hWndVScroll != (HWND)NULL)) {
(wndPtr->dwStyle & WS_VSCROLL)) {
/*
InvalidateRect(wndPtr->hWndVScroll, NULL, TRUE);
UpdateWindow(wndPtr->hWndVScroll);
*/
}
}
......@@ -563,10 +565,8 @@ void OwnerDrawListBox(HWND hwnd)
MAKELONG(hwnd, CTLCOLOR_LISTBOX));
if (hBrush == (HBRUSH)NULL) hBrush = GetStockObject(WHITE_BRUSH);
GetClientRect(hwnd, &rect);
if ((wndPtr->hWndVScroll != (HWND)NULL) &&
IsWindowVisible(wndPtr->hWndVScroll)) rect.right -= 16;
if ((wndPtr->hWndHScroll != (HWND)NULL) &&
IsWindowVisible(wndPtr->hWndHScroll)) rect.bottom -= 16;
if (wndPtr->dwStyle & WS_VSCROLL) rect.right -= 16;
if (wndPtr->dwStyle & WS_HSCROLL) rect.bottom -= 16;
FillRect(hdc, &rect, hBrush);
maxwidth = rect.right;
rect.right = lphl->ColumnsWidth;
......@@ -612,9 +612,11 @@ void OwnerDrawListBox(HWND hwnd)
EndOfPaint:
EndPaint( hwnd, &ps );
if ((lphl->ItemsCount > lphl->ItemsVisible) &
(wndPtr->hWndVScroll != (HWND)NULL)) {
(wndPtr->dwStyle & WS_VSCROLL)) {
/*
InvalidateRect(wndPtr->hWndVScroll, NULL, TRUE);
UpdateWindow(wndPtr->hWndVScroll);
*/
}
}
......@@ -634,10 +636,8 @@ int ListBoxFindMouse(HWND hwnd, int X, int Y)
lpls = lphl->lpFirst;
if (lpls == NULL) return LB_ERR;
GetClientRect(hwnd, &rect);
if ((wndPtr->hWndVScroll != (HWND)NULL) &&
IsWindowVisible(wndPtr->hWndVScroll)) rect.right -= 16;
if ((wndPtr->hWndHScroll != (HWND)NULL) &&
IsWindowVisible(wndPtr->hWndHScroll)) rect.bottom -= 16;
if (wndPtr->dwStyle & WS_VSCROLL) rect.right -= 16;
if (wndPtr->dwStyle & WS_HSCROLL) rect.bottom -= 16;
h = w2 = 0;
w = lphl->ColumnsWidth;
for(i = 1; i <= lphl->ItemsCount; i++) {
......@@ -720,10 +720,10 @@ int ListBoxAddString(HWND hwnd, LPSTR newstr)
lplsnew->dis.itemID = lphl->ItemsCount;
lplsnew->dis.itemData = (DWORD)newstr;
lplsnew->hData = hTemp;
if (wndPtr->hWndVScroll != (HWND)NULL)
if (wndPtr->dwStyle & WS_VSCROLL)
SetScrollRange(hwnd, SB_VERT, 1, lphl->ItemsCount,
(lphl->FirstVisible != 1));
if (wndPtr->hWndHScroll != (HWND)NULL && lphl->ItemsPerColumn != 0)
if ((wndPtr->dwStyle & WS_HSCROLL) && lphl->ItemsPerColumn != 0)
SetScrollRange(hwnd, SB_HORZ, 1, lphl->ItemsVisible /
lphl->ItemsPerColumn + 1, (lphl->FirstVisible != 1));
if (lphl->FirstVisible >= (lphl->ItemsCount - lphl->ItemsVisible)) {
......@@ -731,9 +731,9 @@ int ListBoxAddString(HWND hwnd, LPSTR newstr)
UpdateWindow(hwnd);
}
if ((lphl->ItemsCount - lphl->FirstVisible) == lphl->ItemsVisible) {
if (wndPtr->hWndVScroll != (HWND)NULL)
if (wndPtr->dwStyle & WS_VSCROLL)
ShowScrollBar(hwnd, SB_VERT, TRUE);
if (wndPtr->hWndHScroll != (HWND)NULL)
if (wndPtr->dwStyle & WS_HSCROLL)
ShowScrollBar(hwnd, SB_HORZ, TRUE);
}
return lphl->ItemsCount;
......@@ -779,17 +779,17 @@ int ListBoxInsertString(HWND hwnd, UINT uIndex, LPSTR newstr)
lplsnew->dis.itemID = lphl->ItemsCount;
lplsnew->dis.itemData = (DWORD)newstr;
lplsnew->hData = hTemp;
if (wndPtr->hWndVScroll != (HWND)NULL)
if (wndPtr->dwStyle & WS_VSCROLL)
SetScrollRange(hwnd, SB_VERT, 1, lphl->ItemsCount,
(lphl->FirstVisible != 1));
if (wndPtr->hWndHScroll != (HWND)NULL && lphl->ItemsPerColumn != 0)
if ((wndPtr->dwStyle & WS_HSCROLL) && lphl->ItemsPerColumn != 0)
SetScrollRange(hwnd, SB_HORZ, 1, lphl->ItemsVisible /
lphl->ItemsPerColumn + 1, (lphl->FirstVisible != 1));
if (((lphl->ItemsCount - lphl->FirstVisible) == lphl->ItemsVisible) &&
(lphl->ItemsVisible != 0)) {
if (wndPtr->hWndVScroll != (HWND)NULL)
if (wndPtr->dwStyle & WS_VSCROLL)
ShowScrollBar(hwnd, SB_VERT, TRUE);
if (wndPtr->hWndHScroll != (HWND)NULL)
if (wndPtr->dwStyle & WS_HSCROLL)
ShowScrollBar(hwnd, SB_HORZ, TRUE);
}
if ((lphl->FirstVisible <= uIndex) &&
......@@ -851,15 +851,15 @@ int ListBoxDeleteString(HWND hwnd, UINT uIndex)
lphl->ItemsCount--;
if (lpls->hData != 0) USER_HEAP_FREE(lpls->hData);
if (lpls->hMem != 0) USER_HEAP_FREE(lpls->hMem);
if (wndPtr->hWndVScroll != (HWND)NULL)
if (wndPtr->dwStyle & WS_VSCROLL)
SetScrollRange(hwnd, SB_VERT, 1, lphl->ItemsCount, TRUE);
if (wndPtr->hWndHScroll != (HWND)NULL && lphl->ItemsPerColumn != 0)
if ((wndPtr->dwStyle & WS_HSCROLL) && lphl->ItemsPerColumn != 0)
SetScrollRange(hwnd, SB_HORZ, 1, lphl->ItemsVisible /
lphl->ItemsPerColumn + 1, TRUE);
if (lphl->ItemsCount < lphl->ItemsVisible) {
if (wndPtr->hWndVScroll != (HWND)NULL)
if (wndPtr->dwStyle & WS_VSCROLL)
ShowScrollBar(hwnd, SB_VERT, FALSE);
if (wndPtr->hWndHScroll != (HWND)NULL)
if (wndPtr->dwStyle & WS_HSCROLL)
ShowScrollBar(hwnd, SB_HORZ, FALSE);
}
if ((lphl->FirstVisible <= uIndex) &&
......@@ -922,14 +922,14 @@ int ListBoxResetContent(HWND hwnd)
SendMessage(wndPtr->hwndParent, WM_COMMAND,
wndPtr->wIDmenu, MAKELONG(hwnd, LBN_SELCHANGE));
if (wndPtr->hWndVScroll != (HWND)NULL)
if (wndPtr->dwStyle & WS_VSCROLL)
SetScrollRange(hwnd, SB_VERT, 1, lphl->ItemsCount, TRUE);
if (wndPtr->hWndHScroll != (HWND)NULL && lphl->ItemsPerColumn != 0)
if ((wndPtr->dwStyle & WS_HSCROLL) && lphl->ItemsPerColumn != 0)
SetScrollRange(hwnd, SB_HORZ, 1, lphl->ItemsVisible /
lphl->ItemsPerColumn + 1, TRUE);
if (wndPtr->hWndVScroll != (HWND)NULL)
if (wndPtr->dwStyle & WS_VSCROLL)
ShowScrollBar(hwnd, SB_VERT, FALSE);
if (wndPtr->hWndHScroll != (HWND)NULL)
if (wndPtr->dwStyle & WS_HSCROLL)
ShowScrollBar(hwnd, SB_HORZ, FALSE);
InvalidateRect(hwnd, NULL, TRUE);
UpdateWindow(hwnd);
......
......@@ -149,8 +149,8 @@ static LONG PaintTextfn(HWND hwnd)
GetClientRect(hwnd, &rc);
textlen = GetWindowTextLength(hwnd);
hText = LocalAlloc(LMEM_MOVEABLE, textlen+1);
text = LocalLock(hText);
hText = USER_HEAP_ALLOC(0, textlen+1);
text = USER_HEAP_ADDR(hText);
GetWindowText(hwnd, text, textlen+1);
switch (style & 0x0000000F)
......@@ -185,8 +185,7 @@ static LONG PaintTextfn(HWND hwnd)
FillRect(hdc, &rc, hBrush);
DrawText(hdc, text, textlen, &rc, wFormat);
LocalUnlock(hText);
LocalFree(hText);
USER_HEAP_FREE(hText);
GlobalUnlock(hwnd);
EndPaint(hwnd, &ps);
}
......
......@@ -7,7 +7,6 @@
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "windows.h"
#include "win.h"
#include "dialog.h"
......@@ -17,7 +16,6 @@ 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[] =
......@@ -34,8 +32,6 @@ 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 }
};
......
CFLAGS=-g -I../include -DUSE_READLINE
CFLAGS=-g -I../include -DUSE_READLINE ${COPTS}
LIBS= readline/libedit.a
OBJS=dbg.tab.o hash.o lex.yy.o info.o i386-pinsn.o
#YACC=bison -v -d
......
......@@ -58,7 +58,7 @@ main(){
segv_act.sa_handler = (__sighandler_t) win_fault;
sigaction(SIGSEGV, &segv_act, NULL);
#endif
#ifdef __NetBSD__
#if defined(__NetBSD__) || defined(__FreeBSD__)
sigset_t sig_mask;
sigemptyset(&sig_mask);
......
......@@ -25,7 +25,8 @@
#define RN_CR2 21
#endif
#ifdef __NetBSD__
#if defined(__NetBSD__) || defined(__FreeBSD__)
#define RN_OLDMASK 1
/* Register numbers */
#define RN_ESP 2
#define RN_EBP 3
......@@ -50,6 +51,8 @@
#ifdef linux
#define SC_GS regval[RN_GS]
#define SC_FS regval[RN_FS]
#define I387 regval[RN_I387]
#define CR2 regval[RN_CR2]
#endif
#define SC_ES regval[RN_ES]
#define SC_DS regval[RN_DS]
......@@ -68,7 +71,4 @@
#define SC_EFLAGS regval[RN_EFLAGS]
#define ESP_AT_SIGNAL regval[RN_ESP_AT_SIGNAL]
#define SC_SS regval[RN_SS]
#define I387 regval[RN_I387]
#define OLDMASK regval[RN_OLDMASK]
#define CR2 regval[RN_CR2]
......@@ -7,6 +7,11 @@ SRCS = \
callback.c \
relay.c
/*
* Hack alert. There appear to be no object files, 'cause a very
* nasty rule below links *.o together, which is a generally bad idea,
* but I can't see how else to do it.
*/
OBJS = \
call.o \
callback.o \
......@@ -25,9 +30,11 @@ MakeDllFromSpec(user,$(TOP)/$(MODULE))
MakeDllFromSpec(win87em,$(TOP)/$(MODULE))
/*
* Yes I know *.o is not veru clever, but can you do it cleaner ?
* Yes I know *.o is not very clever, but can you do it cleaner ?
*/
WineRelocatableTarget($(TOP)/$(MODULE),*.o,$(OBJS))
WineRelocatableTarget($(TOP)/$(MODULE),*.o,)
$(TOP)/$(MODULE).o: $(OBJS)
clean::
$(RM) dll*
......
......@@ -10,6 +10,10 @@ MUST_BE_LINKED_FIRST=call.o $(BUILDOBJS)
OBJS=$(MUST_BE_LINKED_FIRST) callback.o relay.o
# Uncomment the following 2 lines for use with FreeBSD
# %.o: %.S
# $(CC) $(ASFLAGS) $(CPPFLAGS) $(TARGET_MACH) $(COPTS) -c -o $@ $<
default: if1632.o
if1632.o: $(OBJS)
......
......@@ -4,7 +4,7 @@
#ifdef linux
#define UDATASEL 0x2b
#endif
#ifdef __NetBSD__
#if defined(__NetBSD__) || defined(__FreeBSD__)
#define UDATASEL 0x27
#endif
.data
......
......@@ -78,6 +78,7 @@ length 415
134 pascal GetWindowsDirectory(ptr word) GetWindowsDirectory(1 2)
135 pascal GetSystemDirectory(ptr word) GetSystemDirectory(1 2)
136 pascal GetDriveType(byte) GetWindowsDirectory(1)
152 return GetNumTasks 0 1
154 return GlobalNotify 4 0
163 pascal GlobalLRUOldest(word) ReturnArg(1)
164 pascal GlobalLRUNewest(word) ReturnArg(1)
......
......@@ -19,7 +19,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "prototypes.h"
#include "dlls.h"
/* #define DEBUG_RELAY */
/* #define DEBUG_RELAY /* */
#define N_BUILTINS 8
......
......@@ -46,10 +46,14 @@ length 540
49 pascal IsWindowVisible(word) IsWindowVisible(1)
50 pascal FindWindow(ptr ptr) FindWindow(1 2)
53 pascal DestroyWindow(word) DestroyWindow(1)
54 pascal EnumWindows(ptr long) EnumWindows(1 2)
55 pascal EnumChildWindows(word ptr long) EnumChildWindows(1 2 3)
56 pascal MoveWindow(word word word word word word)
MoveWindow(1 2 3 4 5 6)
57 pascal RegisterClass(ptr) RegisterClass(1)
58 pascal GetClassName(word ptr word) GetClassName(1 2 3)
59 pascal SetActiveWindow(word) SetActiveWindow(1)
60 pascal GetActiveWindow() GetActiveWindow()
61 pascal ScrollWindow(word s_word s_word ptr ptr) ScrollWindow(1 2 3 4 5)
62 pascal SetScrollPos(word word word word) SetScrollPos(1 2 3 4)
63 pascal GetScrollPos(word word) GetScrollPos(1 2)
......@@ -122,8 +126,10 @@ length 540
152 pascal DestroyMenu(word) DestroyMenu(1)
154 pascal CheckMenuItem(word word word) CheckMenuItem(1 2 3)
155 pascal EnableMenuItem(word word word) EnableMenuItem(1 2 3)
156 pascal GetSystemMenu(word word) GetSystemMenu(1 2)
157 pascal GetMenu(word) GetMenu(1)
158 pascal SetMenu(word word) SetMenu(1 2)
159 pascal GetSubMenu(word word) GetSubMenu(1 2)
160 pascal DrawMenuBar(word) DrawMenuBar(1)
163 pascal CreateCaret(word word word word) CreateCaret(1 2 3 4)
164 pascal DestroyCaret() DestroyCaret()
......@@ -138,6 +144,7 @@ length 540
175 pascal LoadBitmap(word ptr) LoadBitmap(1 2)
176 pascal LoadString(word word ptr s_word) LoadString(1 2 3 4)
177 pascal LoadAccelerators(word ptr) LoadAccelerators(1 2)
178 pascal TranslateAccelerator(word word ptr) TranslateAccelerator(1 2 3)
179 pascal GetSystemMetrics(word) GetSystemMetrics(1)
180 pascal GetSysColor(word) GetSysColor(1)
181 pascal SetSysColors(word ptr ptr) SetSysColors(1 2 3)
......
/*
* structure definitions for ACCELERATORS
*
* Copyright Martin Ayotte, 1994
*
*/
typedef struct {
WORD wEvent;
WORD wIDval;
BYTE type;
} ACCELENTRY, *LPACCELENTRY;
typedef struct {
WORD wCount;
ACCELENTRY tbl[1];
} ACCELHEADER, *LPACCELHEADER;
#define VIRTKEY_ACCEL 0x01
#define SHIFT_ACCEL 0x04
#define CONTROL_ACCEL 0x08
#define SYSTEM_ACCEL 0x80
......@@ -6,6 +6,9 @@
#ifndef HEAP_H
#define HEAP_H
/**********************************************************************
* LOCAL HEAP STRUCTURES AND FUNCTIONS
*/
typedef struct heap_mem_desc_s
{
struct heap_mem_desc_s *prev, *next;
......@@ -20,7 +23,44 @@ extern int HEAP_Free(MDESC **free_list, void *block);
extern void *HEAP_ReAlloc(MDESC **free_list, void *old_block,
int new_size, unsigned int flags);
/**********************************************************************
* GLOBAL HEAP STRUCTURES AND FUNCTIONS:
*
* Global memory pool descriptor. Segments MUST be maintained in segment
* ascending order. If not the reallocation routine will die a horrible
* death.
*
* handle = 0, this descriptor contains the address of a free pool.
* != 0, this describes an allocated block.
*
* sequence = 0, this is not a huge block
* > 0, this is a portion of a huge block
* =-1, this is a free segment
*
* addr - address of this memory block.
*
* length - used to maintain huge blocks.
*/
typedef struct global_mem_desc_s
{
struct global_mem_desc_s *next;
struct global_mem_desc_s *prev;
unsigned short handle;
short sequence;
void *addr;
int length;
int lock_count;
void *linear_addr;
int linear_key;
int linear_count;
} GDESC;
extern GDESC *GlobalList;
extern void *GlobalQuickAlloc(int size);
extern unsigned int GlobalHandleFromPointer(void *block);
extern GDESC *GlobalGetGDesc(unsigned int block);
extern void *GlobalLinearLock(unsigned int block);
extern unsigned int GlobalLinearUnlock(unsigned int block);
#endif /* HEAP_H */
......@@ -54,6 +54,7 @@ typedef struct tagPOPUPMENU
WORD FocusedItem;
WORD MouseFlags;
WORD BarFlags;
BOOL SysFlag;
WORD Width;
WORD Height;
} POPUPMENU, *LPPOPUPMENU;
......
......@@ -51,5 +51,6 @@ extern void MSG_DecTimerCount( HANDLE hQueue );
extern BOOL MSG_CreateSysMsgQueue( int size );
extern void hardware_event(HWND hwnd, WORD message, WORD wParam, LONG lParam,
WORD xPos, WORD yPos, DWORD time, DWORD extraInfo);
extern BOOL MSG_GetHardwareMessage( LPMSG msg );
#endif /* MESSAGE_H */
......@@ -28,6 +28,10 @@ extern unsigned int GetEntryPointFromOrdinal(struct w_files * wpnt,
extern struct segment_descriptor_s *GetNextSegment(unsigned int flags,
unsigned int limit);
extern struct segment_descriptor_s *CreateNewSegments(int code_flag,
int read_only,
int length,
int n_segments);
extern struct mz_header_s *CurrentMZHeader;
extern struct ne_header_s *CurrentNEHeader;
extern int CurrentNEFile;
......
......@@ -9,12 +9,23 @@ typedef struct tagHEADSSCROLL {
short MaxVal;
short MaxPix;
short CurPix;
RECT rect;
BOOL ThumbActive;
BOOL TimerPending;
WORD ButtonDown;
WORD Direction;
DWORD dwStyle;
HWND hWndUp;
HWND hWndDown;
HWND hWndOwner;
} HEADSCROLL;
typedef HEADSCROLL FAR* LPHEADSCROLL;
void ScrollBarButtonDown(HWND hWnd, int nBar, int x, int y);
void ScrollBarButtonUp(HWND hWnd, int nBar, int x, int y);
void ScrollBarMouseMove(HWND hWnd, int nBar, WORD wParam, int x, int y);
void StdDrawScrollBar(HWND hWnd, HDC hDC, int nBar, LPRECT lprect, LPHEADSCROLL lphs);
int CreateScrollBarStruct(HWND hWnd);
void NC_CreateScrollBars(HWND hWnd);
......@@ -48,6 +48,8 @@ typedef struct segment_descriptor_s
#endif
} SEGDESC;
extern int IPCCopySelector(int i_old, unsigned long new, int swap_type);
/*
* Additional flags
*/
......
......@@ -38,15 +38,15 @@ typedef struct tagWND
HANDLE hdce; /* Window DCE (if CS_OWNDC or CS_CLASSDC) */
HMENU hmenuSystem; /* System menu */
HCURSOR hCursor; /* Window Current Cursor */
HWND hWndVScroll; /* Verti. ScrollBar handle of the window */
HWND hWndHScroll; /* Horiz. ScrollBar handle of the window */
void *VScroll; /* Vertical ScrollBar Struct Pointer */
void *HScroll; /* Horizontal ScrollBar Struct Pointer */
WORD wIDmenu; /* ID or hmenu (from CreateWindow) */
HANDLE hText; /* Handle of window text */
WORD flags; /* Misc. flags */
Window window; /* X window */
LPMENUBAR menuBarPtr; /* Menu bar */
HMENU hSysMenu; /* window's copy of System Menu */
HWND hWndMenuBar; /* Menu bar */
HWND hWndCaption; /* Caption bar */
WORD wExtra[1]; /* Window extra bytes */
} WND;
......
......@@ -222,6 +222,17 @@ typedef struct {
#define GW_OWNER 4
#define GW_CHILD 5
/* WM_GETMINMAXINFO struct */
typedef struct
{
POINT ptReserved;
POINT ptMaxSize;
POINT ptMaxPosition;
POINT ptMinTrackSize;
POINT ptMaxTrackSize;
} MINMAXINFO;
/* WM_WINDOWPOSCHANGING/CHANGED struct */
typedef struct
{
......@@ -249,6 +260,17 @@ typedef struct
#define WPF_SETMINPOSITION 0x0001
#define WPF_RESTORETOMAXIMIZED 0x0002
/* WM_MOUSEACTIVATE return values */
#define MA_ACTIVATE 1
#define MA_ACTIVATEANDEAT 2
#define MA_NOACTIVATE 3
#define MA_NOACTIVATEANDEAT 4
/* WM_ACTIVATE wParam values */
#define WA_INACTIVE 0
#define WA_ACTIVE 1
#define WA_CLICKACTIVE 2
/* WM_NCCALCSIZE parameter structure */
typedef struct
{
......@@ -1271,6 +1293,9 @@ enum { WM_NULL, WM_CREATE, WM_DESTROY, WM_MOVE, WM_UNUSED0, WM_SIZE, WM_ACTIVATE
#define WM_PARENTNOTIFY 0x0210
#define WM_ENTERSIZEMOVE 0x0231
#define WM_EXITSIZEMOVE 0x0232
/* misc messages */
#define WM_NULL 0x0000
#define WM_USER 0x0400
......@@ -1349,6 +1374,13 @@ enum { SW_HIDE, SW_SHOWNORMAL, SW_NORMAL, SW_SHOWMINIMIZED, SW_SHOWMAXIMIZED,
#define TPM_CENTERALIGN 0x0004
#define TPM_RIGHTALIGN 0x0008
/* Menu messages */
#define WM_INITMENU 0x0116
#define WM_INITMENUPOPUP 0x0117
#define WM_MENUSELECT 0x011F
#define WM_MENUCHAR 0x0120
#define MF_INSERT 0
#define MF_CHANGE 0x0080
#define MF_APPEND 0x0100
......@@ -2254,7 +2286,7 @@ Fb(HBRUSH,CreateDIBPatternBrush,HANDLE,a,WORD,b)
Fb(HBRUSH,CreateHatchBrush,short,a,COLORREF,b)
Fb(HCURSOR,LoadCursor,HANDLE,a,LPSTR,b)
Fb(HICON,LoadIcon,HANDLE,a,LPSTR,b)
Fb(HMENU,GetSubMenu,HMENU,a,int,b)
Fb(HMENU,GetSubMenu,HMENU,a,short,b)
Fb(HMENU,GetSystemMenu,HWND,a,BOOL,b)
Fb(HMENU,LoadMenu,HANDLE,a,LPSTR,b)
Fb(HWND,ChildWindowFromPoint,HWND,a,POINT,b)
......
......@@ -57,7 +57,7 @@ struct sigcontext_struct {
};
#endif
#ifdef __NetBSD__
#if defined(__NetBSD__) || defined(__FreeBSD__)
#include <signal.h>
#define sigcontext_struct sigcontext
#define HZ 100
......
......@@ -3,6 +3,8 @@
MODULE = loader
SRCS = \
int1a.c \
int21.c \
dump.c \
files.c \
ldt.c \
......@@ -15,6 +17,8 @@ SRCS = \
cursor.c
OBJS = \
int1a.o \
int21.o \
dump.o \
files.o \
ldt.o \
......
......@@ -30,6 +30,24 @@ RECT ClipCursorRect;
extern HINSTANCE hSysRes;
extern Window winHasCursor;
static struct { LPSTR name; HCURSOR cursor; } system_cursor[] =
{
{ IDC_ARROW, 0 },
{ IDC_IBEAM, 0 },
{ IDC_WAIT, 0 },
{ IDC_CROSS, 0 },
{ IDC_UPARROW, 0 },
{ IDC_SIZE, 0 },
{ IDC_ICON, 0 },
{ IDC_SIZENWSE, 0 },
{ IDC_SIZENESW, 0 },
{ IDC_SIZEWE, 0 },
{ IDC_SIZENS, 0 }
};
#define NB_SYS_CURSORS (sizeof(system_cursor)/sizeof(system_cursor[0]))
/**********************************************************************
* LoadCursor [USER.173]
*/
......@@ -51,8 +69,22 @@ HCURSOR LoadCursor(HANDLE instance, LPSTR cursor_name)
printf("LoadCursor: instance = %04x, name = %08x\n",
instance, cursor_name);
#endif
if (!instance)
{
for (i = 0; i < NB_SYS_CURSORS; i++)
if (system_cursor[i].name == cursor_name)
{
hCursor = system_cursor[i].cursor;
break;
}
if (i == NB_SYS_CURSORS) return 0;
if (hCursor) return hCursor;
}
hCursor = GlobalAlloc(GMEM_MOVEABLE, sizeof(CURSORALLOC) + 1024L);
if (hCursor == (HCURSOR)NULL) return 0;
if (!instance) system_cursor[i].cursor = hCursor;
#ifdef DEBUG_CURSOR
printf("LoadCursor Alloc hCursor=%X\n", hCursor);
#endif
......@@ -203,9 +235,9 @@ HCURSOR CreateCursor(HANDLE instance, short nXhotspot, short nYhotspot,
int i, j;
#ifdef DEBUG_RESOURCE
printf("CreateCursor: inst=%04x nXhotspot=%d nYhotspot=%d nWidth=%d nHeight=%d\n",
nXhotspot, nYhotspot, nWidth, nHeight);
instance, nXhotspot, nYhotspot, nWidth, nHeight);
printf("CreateCursor: inst=%04x lpANDbitPlane=%08X lpXORbitPlane=%08X\n",
LPSTR lpANDbitPlane, LPSTR lpXORbitPlane);
instance, lpANDbitPlane, lpXORbitPlane);
#endif
if (!(hdc = GetDC(GetDesktopWindow()))) return 0;
hCursor = GlobalAlloc(GMEM_MOVEABLE, sizeof(CURSORALLOC) + 1024L);
......
......@@ -6,7 +6,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <errno.h>
#include "prototypes.h"
#ifdef __NetBSD__
#if defined(__NetBSD__) || defined(__FreeBSD__)
#include <machine/segments.h>
#endif
......@@ -21,7 +21,7 @@ print_ldt()
unsigned long *lp;
unsigned long base_addr, limit;
int type, dpl, i;
#ifdef __NetBSD__
#if defined(__NetBSD__) || defined(__FreeBSD__)
struct segment_descriptor *sd;
#endif
......@@ -29,7 +29,7 @@ print_ldt()
exit(1);
lp = (unsigned long *) buffer;
#ifdef __NetBSD__
#if defined(__NetBSD__) || defined(__FreeBSD__)
sd = (struct segment_descriptor *) buffer;
#endif
......@@ -47,7 +47,7 @@ print_ldt()
type = (*lp >> 10) & 5;
dpl = (*lp >> 13) & 3;
#endif
#ifdef __NetBSD__
#if defined(__NetBSD__) || defined(__FreeBSD__)
type = sd->sd_type;
dpl = sd->sd_dpl;
sd++;
......
......@@ -11,7 +11,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
_syscall3(int, modify_ldt, int, func, void *, ptr, unsigned long, bytecount)
#endif
#ifdef __NetBSD__
#if defined(__NetBSD__) || defined(__FreeBSD__)
#include <machine/segments.h>
extern int i386_get_ldt(int, union descriptor *, int);
......@@ -43,7 +43,7 @@ get_ldt(void *buffer)
#ifdef linux
return modify_ldt(0, buffer, 32 * sizeof(struct modify_ldt_ldt_s));
#endif
#ifdef __NetBSD__
#if defined(__NetBSD__) || defined(__FreeBSD__)
return i386_get_ldt(0, (union descriptor *)buffer, 32);
#endif
}
......@@ -66,7 +66,7 @@ set_ldt_entry(int entry, unsigned long base, unsigned int limit,
return modify_ldt(1, &ldt_info, sizeof(ldt_info));
#endif
#ifdef __NetBSD__
#if defined(__NetBSD__) || defined(__FreeBSD__)
struct segment_descriptor *sd;
int ret;
......
......@@ -14,6 +14,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "gdi.h"
#include "wine.h"
#include "icon.h"
#include "accel.h"
#define MIN(a,b) ((a) < (b) ? (a) : (b))
......@@ -388,6 +389,7 @@ HICON LoadIcon(HANDLE instance, LPSTR icon_name)
DeleteDC(hMemDC);
DeleteDC(hMemDC2);
ReleaseDC(GetDesktopWindow(), hdc);
GlobalUnlock(hIcon);
return hIcon;
}
......@@ -407,12 +409,97 @@ BOOL DestroyIcon(HICON hIcon)
/**********************************************************************
* LoadAccelerators
* LoadAccelerators [USER.177]
*/
HANDLE
LoadAccelerators(HANDLE instance, LPSTR lpTableName)
HANDLE LoadAccelerators(HANDLE instance, LPSTR lpTableName)
{
HANDLE hAccel;
HANDLE rsc_mem;
BYTE *lp;
ACCELHEADER *lpAccelTbl;
int i, image_size;
#ifdef DEBUG_ACCEL
if (((LONG)lpTableName & 0xFFFF0000L) == 0L)
printf("LoadAccelerators: instance = %04X, name = %08X\n",
instance, lpTableName);
else
printf("LoadAccelerators: instance = %04X, name = '%s'\n",
instance, lpTableName);
#endif
if (instance == (HANDLE)NULL) instance = hSysRes;
rsc_mem = RSC_LoadResource(instance, lpTableName, NE_RSCTYPE_ACCELERATOR,
&image_size);
if (rsc_mem == (HANDLE)NULL) {
printf("LoadAccelerators / AccelTable %04X not Found !\n", lpTableName);
return 0;
}
lp = (BYTE *)GlobalLock(rsc_mem);
if (lp == NULL) {
GlobalFree(rsc_mem);
return 0;
}
#ifdef DEBUG_ACCEL
printf("LoadAccelerators / image_size=%d\n", image_size);
#endif
hAccel = GlobalAlloc(GMEM_MOVEABLE,
sizeof(ACCELHEADER) + sizeof(ACCELENTRY) + image_size);
lpAccelTbl = (LPACCELHEADER)GlobalLock(hAccel);
lpAccelTbl->wCount = 0;
for (i = 0; ; i++) {
lpAccelTbl->tbl[i].type = *(lp++);
lpAccelTbl->tbl[i].wEvent = *((WORD *)lp);
lp += 2;
lpAccelTbl->tbl[i].wIDval = *((WORD *)lp);
lp += 2;
if (lpAccelTbl->tbl[i].wEvent == 0) break;
#ifdef DEBUG_ACCEL
printf("Accelerator #%u / event=%04X id=%04X type=%02X \n",
i, lpAccelTbl->tbl[i].wEvent, lpAccelTbl->tbl[i].wIDval,
lpAccelTbl->tbl[i].type);
#endif
lpAccelTbl->wCount++;
}
GlobalUnlock(hAccel);
GlobalUnlock(rsc_mem);
GlobalFree(rsc_mem);
return hAccel;
}
/**********************************************************************
* TranslateAccelerator [USER.178]
*/
int TranslateAccelerator(HWND hWnd, HANDLE hAccel, LPMSG msg)
{
fprintf(stderr,"LoadAccelerators: (%d),%d\n",instance,lpTableName);
ACCELHEADER *lpAccelTbl;
int i, image_size;
if (hAccel == 0 || msg == NULL) return 0;
if (msg->message != WM_KEYDOWN &&
msg->message != WM_KEYUP &&
msg->message != WM_CHAR) return 0;
#ifdef DEBUG_ACCEL
printf("TranslateAccelerators hAccel=%04X !\n", hAccel);
#endif
lpAccelTbl = (LPACCELHEADER)GlobalLock(hAccel);
for (i = 0; i < lpAccelTbl->wCount; i++) {
/* if (lpAccelTbl->tbl[i].type & SHIFT_ACCEL) { */
/* if (lpAccelTbl->tbl[i].type & CONTROL_ACCEL) { */
if (lpAccelTbl->tbl[i].type & VIRTKEY_ACCEL) {
if (msg->wParam == lpAccelTbl->tbl[i].wEvent &&
msg->message == WM_KEYDOWN) {
SendMessage(hWnd, WM_COMMAND, lpAccelTbl->tbl[i].wIDval, 0x00010000L);
return 1;
}
if (msg->message == WM_KEYUP) return 1;
}
else {
if (msg->wParam == lpAccelTbl->tbl[i].wEvent &&
msg->message == WM_CHAR) {
SendMessage(hWnd, WM_COMMAND, lpAccelTbl->tbl[i].wIDval, 0x00010000L);
return 1;
}
}
}
GlobalUnlock(hAccel);
return 0;
}
......@@ -446,12 +533,12 @@ HANDLE FindResource(HANDLE instance, LPSTR resource_name, LPSTR type_name)
if (((int) resource_name & 0xffff0000) == 0)
{
r->size_shift = FindResourceByNumber(&r->nameinfo, type_name,
r->size_shift = FindResourceByNumber(&r->nameinfo, (int)type_name,
(int) resource_name | 0x8000);
}
else
{
r->size_shift = FindResourceByName(&r->nameinfo, type_name,
r->size_shift = FindResourceByName(&r->nameinfo, (int)type_name,
resource_name);
}
......@@ -683,14 +770,12 @@ LoadBitmap(HANDLE instance, LPSTR bmp_name)
if (instance == (HANDLE)NULL) instance = hSysRes;
if (!(hdc = GetDC(GetDesktopWindow()))) return 0;
printf("before RSC_Load\n");
rsc_mem = RSC_LoadResource(instance, bmp_name, NE_RSCTYPE_BITMAP,
&image_size);
if (rsc_mem == (HANDLE)NULL) {
printf("LoadBitmap / BitMap %04X not Found !\n", bmp_name);
return 0;
}
printf("before GlobalLock\n");
lp = (long *) GlobalLock(rsc_mem);
if (lp == NULL)
{
......
......@@ -3,7 +3,7 @@
#include <stdlib.h>
#include <time.h>
#ifdef __NetBSD__
#if defined(__NetBSD__) || defined(__FreeBSD__)
#include <sys/syscall.h>
#else
#include <syscall.h>
......@@ -55,7 +55,7 @@ static void win_fault(int signal, int code, struct sigcontext *scp){
if(signal != SIGSEGV) exit(1);
if((scp->sc_cs & 7) != 7){
#endif
#ifdef __NetBSD__
#if defined(__NetBSD__) || defined(__FreeBSD__)
/* set_es(0x27); set_ds(0x27); */
if(signal != SIGBUS) exit(1);
if(scp->sc_cs == 0x1f){
......@@ -134,7 +134,7 @@ init_wine_signals(){
(void (*)()) (((unsigned int)(cstack) + sizeof(cstack) - 4) & ~3);
wine_sigaction(SIGSEGV, &segv_act, NULL);
#endif
#ifdef __NetBSD__
#if defined(__NetBSD__) || defined(__FreeBSD__)
struct sigstack ss;
sigset_t sig_mask;
......
......@@ -363,11 +363,11 @@ _WinMain(int argc, char **argv)
if (ss_reg == 0)
{
fprintf(stderr, "SS is 0. Send email to bob@amscons.com.\n");
fprintf(stderr, " No. Really. I want to know what programs\n");
fprintf(stderr, " do this.\n");
fprintf(stderr, "SS is 0\n");
}
LinearTest();
rv = CallToInit16(cs_reg << 16 | ip_reg, ss_reg << 16 | sp_reg, ds_reg);
printf ("rv = %x\n", rv);
}
......
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
OBJS=global.o heap.o atom.o
OBJS=global.o heap.o atom.o linear.o
default: memory.o
......
......@@ -7,37 +7,37 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "heap.h"
#include "segmem.h"
/*
* Global memory pool descriptor. Segments MUST be maintained in segment
* ascending order. If not the reallocation routine will die a horrible
* death.
*
* handle = 0, this descriptor contains the address of a free pool.
* != 0, this describes an allocated block.
*
* sequence = 0, this is not a huge block
* > 0, this is a portion of a huge block
* =-1, this is a free segment
*
* addr - address of this memory block.
*
* length - used to maintain huge blocks.
*
GDESC *GlobalList = NULL;
static unsigned short next_unused_handle = 1;
/**********************************************************************
* GlobalGetGDesc
*/
typedef struct global_mem_desc_s
GDESC *GlobalGetGDesc(unsigned int block)
{
struct global_mem_desc_s *next;
struct global_mem_desc_s *prev;
unsigned short handle;
short sequence;
void *addr;
int length;
int lock_count;
} GDESC;
GDESC *g;
GDESC *GlobalList = NULL;
static unsigned short next_unused_handle = 1;
if (block == 0)
return NULL;
/*
* Find GDESC for this block.
*/
if (block & 0xffff0000)
{
for (g = GlobalList; g != NULL; g = g->next)
if (g->handle > 0 && (unsigned int) g->addr == block)
break;
}
else
{
for (g = GlobalList; g != NULL; g = g->next)
if (g->handle == block)
break;
}
return g;
}
/**********************************************************************
* GlobalGetFreeSegments
......@@ -91,13 +91,14 @@ GlobalGetFreeSegments(unsigned int flags, int n_segments)
/*
* Allocate segments.
*/
for (count = 0; count < n_segments; count++)
s = CreateNewSegments(0, 0, 0x10000, n_segments);
if (s == NULL)
{
printf("GlobalGetFreeSegments // bad CreateNewSegments !\n");
return NULL;
}
for (count = 0; count < n_segments; count++, s++)
{
s = GetNextSegment(flags, 0x10000);
if (s == NULL) {
printf("GlobalGetFreeSegments // bad GetNextSegment !\n");
return NULL;
}
g = (GDESC *) malloc(sizeof(*g));
if (g == NULL) {
printf("GlobalGetFreeSegments // bad GDESC malloc !\n");
......@@ -109,6 +110,9 @@ GlobalGetFreeSegments(unsigned int flags, int n_segments)
g->sequence = -1;
g->addr = s->base_addr;
g->length = s->length;
g->linear_addr = NULL;
g->linear_key = 0;
g->linear_count = 0;
if (!(flags & GLOBAL_FLAGS_MOVEABLE))
g->lock_count = 1;
else
......@@ -138,6 +142,9 @@ GlobalGetFreeSegments(unsigned int flags, int n_segments)
}
g->sequence = i + 1;
g->length = n_segments;
g->linear_addr = NULL;
g->linear_key = 0;
g->linear_count = 0;
}
return g_start;
......@@ -223,6 +230,9 @@ GlobalAlloc(unsigned int flags, unsigned long size)
g->handle = next_unused_handle;
g->sequence = 0;
g->addr = m;
g->linear_addr = NULL;
g->linear_key = 0;
g->linear_count = 0;
g->length = size;
g->next = g_prev->next;
if (g->next) g->next->prev = g;
......
static char RCSId[] = "$Id$";
static char Copyright[] = "Copyright Robert J. Amstadt, 1994";
#include <stdio.h>
#include <stdlib.h>
#include "prototypes.h"
#include "heap.h"
#include "segmem.h"
#ifdef HAVE_IPC
static key_t MemoryKeys[SHMSEG]; /* Keep track of keys were using */
static int LinearInitialized = 0;
#endif
#ifdef HAVE_IPC
/**********************************************************************
* LinearFindSpace
*/
int
LinearFindSpace(int n_segments)
{
int i, n;
if (!LinearInitialized)
{
memset(MemoryKeys, -1, sizeof(MemoryKeys));
return 0;
}
for (i = 0, n = 0; i < SHMSEG, n != n_segments; i++)
{
if (MemoryKeys[i] < 0)
n++;
else
n = 0;
}
if (n != n_segments)
return -1;
else
return i - n;
}
#endif /* HAVE_IPC */
/**********************************************************************
* GlobalLinearLock
*
* OK, this is an evil beast. We will do one of two things:
*
* 1. If the data item <= 64k, then just call GlobalLock().
* 2. If the data item > 64k, then map memory.
*/
void *
GlobalLinearLock(unsigned int block)
{
GDESC *g, *g_first;
int loc_idx;
unsigned long addr;
int i;
/******************************************************************
* Get GDESC for this block.
*/
g_first = GlobalGetGDesc(block);
if (g_first == NULL)
return 0;
/******************************************************************
* Is block less then 64k in length?
*/
if (g_first->sequence != 1 || g_first->length == 1)
{
return (void *) GlobalLock(block);
}
/******************************************************************
* If there is already a linear lock on this memory, then
* just return a pointer to it.
*/
if (g_first->linear_count)
{
g_first->linear_count++;
return g_first->linear_addr;
}
/******************************************************************
* No luck. We need to do the linear mapping right now.
*/
#ifdef HAVE_IPC
loc_idx = LinearFindSpace(g_first->length);
if (loc_idx < 0)
return NULL;
addr = (unsigned long) SHM_RANGE_START + (0x10000 * loc_idx);
g = g_first;
for (i = loc_idx;
i < loc_idx + g_first->length;
i++, addr += 0x10000, g = g->next)
{
if ((MemoryKeys[i] = IPCCopySelector(g->handle >> 3, addr, 0)) < 0)
return NULL;
g->linear_addr = (void *) addr;
g->linear_count = 1;
}
#endif /* HAVE_IPC */
return g_first->linear_addr;
}
/**********************************************************************
* GlobalLinearUnlock
*
*/
unsigned int
GlobalLinearUnlock(unsigned int block)
{
GDESC *g, *g_first;
int loc_idx;
int i;
/******************************************************************
* Get GDESC for this block.
*/
g_first = GlobalGetGDesc(block);
if (g_first == NULL)
return block;
/******************************************************************
* Is block less then 64k in length?
*/
if (g_first->sequence != 1 || g_first->length == 1)
{
return GlobalUnlock(block);
}
/******************************************************************
* Make sure we have a lock on this block.
*/
#ifdef HAVE_IPC
if (g_first->linear_count > 1)
{
g_first->linear_count--;
}
else if (g_first->linear_count == 1)
{
g = g_first;
loc_idx = (((unsigned int) g_first - (unsigned int) SHM_RANGE_START)
/ 0x10000);
for (i = 0; i < g_first->length; i++, g = g->next)
{
shmdt(g->linear_addr);
g->linear_addr = NULL;
MemoryKeys[i] = -1;
}
g_first->linear_count = 0;
return 0;
}
#endif /* HAVE_IPC */
return 0;
}
/**********************************************************************/
LinearTest()
{
#if 0
unsigned int handle;
int *seg_ptr;
int *lin_ptr;
int seg, i;
int *p;
handle = GlobalAlloc(0, 0x40000);
seg_ptr = GlobalLock(handle);
lin_ptr = GlobalLinearLock(handle);
for (seg = 0; seg < 4; seg++)
{
p = (int *) ((char *) seg_ptr + (0x80000 * seg));
for (i = 0; i < (0x10000 / sizeof(int)); i++, p++)
*p = (seg * (0x10000 / sizeof(int))) + i;
}
p = lin_ptr;
for (i = 0; i < (0x40000 / sizeof(int)); i++, p++)
{
if (*p != i)
printf("lin_ptr[%x] = %x\n", i, *p);
}
#endif
}
......@@ -3,37 +3,45 @@
MODULE = misc
SRCS = \
kernel.c \
user.c \
rect.c \
file.c \
sound.c \
comm.c \
dos.c \
dos_fs.c \
emulate.c \
keyboard.c \
profile.c \
lstr.c \
exec.c \
message.c \
file.c \
int1a.c \
int21.c \
dos_fs.c \
kernel.c \
keyboard.c \
lstr.c \
main.c \
message.c \
profile.c \
rect.c \
sound.c \
spy.c \
user.c \
xt.c
OBJS = \
kernel.o \
user.o \
rect.o \
file.o \
sound.o \
comm.o \
dos.o \
dos_fs.o \
emulate.o \
keyboard.o \
profile.o \
lstr.o \
exec.o \
message.o \
file.o \
int1a.o \
int21.o \
dos_fs.o \
kernel.o \
keyboard.o \
lstr.o \
main.o \
message.o \
profile.o \
rect.o \
sound.o \
spy.o \
user.o \
xt.o
WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS))
......
......@@ -8,7 +8,7 @@
#include <fcntl.h>
#include <string.h>
#include <sys/stat.h>
#ifdef __NetBSD__
#if defined(__NetBSD__) || defined(__FreeBSD__)
#include <errno.h>
#include <sys/ioctl.h>
#endif
......
......@@ -13,7 +13,7 @@
#ifdef __linux__
#include <sys/vfs.h>
#endif
#ifdef __NetBSD__
#if defined(__NetBSD__) || defined(__FreeBSD__)
#include <sys/types.h>
#include <sys/mount.h>
#endif
......
#include <time.h>
#include <fcntl.h>
#include <errno.h>
#ifndef __STDC__
#include <malloc.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
......
......@@ -6,7 +6,14 @@
static char Copyright[] = "Copyright Martin Ayotte, 1993";
#include "windows.h"
#define DEBUG_MSGBOX
#include <windows.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "prototypes.h"
#include "heap.h"
#include "win.h"
......@@ -26,7 +33,6 @@ typedef struct tagMSGBOX {
} MSGBOX;
typedef MSGBOX FAR* LPMSGBOX;
LONG SystemMessageBoxProc(HWND hwnd, WORD message, WORD wParam, LONG lParam);
/**************************************************************************
......@@ -40,8 +46,11 @@ int MessageBox( HWND hWnd, LPSTR str, LPSTR title, WORD type )
WNDCLASS wndClass;
MSG msg;
MSGBOX mb;
DWORD dwStyle;
wndPtr = WIN_FindWndPtr(hWnd);
#ifdef DEBUG_MSGBOX
printf( "MessageBox: '%s'\n", str );
#endif
wndClass.style = CS_HREDRAW | CS_VREDRAW ;
wndClass.lpfnWndProc = (WNDPROC)SystemMessageBoxProc;
wndClass.cbClsExtra = 0;
......@@ -58,8 +67,9 @@ int MessageBox( HWND hWnd, LPSTR str, LPSTR title, WORD type )
mb.Str = str;
mb.wType = type;
mb.ActiveFlg = TRUE;
hDlg = CreateWindow("MESSAGEBOX", title,
WS_POPUP | WS_DLGFRAME | WS_VISIBLE, 100, 150, 400, 120,
dwStyle = WS_POPUP | WS_DLGFRAME | WS_VISIBLE;
if ((type & (MB_SYSTEMMODAL | MB_TASKMODAL)) == 0) dwStyle |= WS_CAPTION;
hDlg = CreateWindow("MESSAGEBOX", title, dwStyle, 100, 150, 400, 120,
(HWND)NULL, (HMENU)NULL, wndPtr->hInstance, (LPSTR)&mb);
if (hDlg == 0) return 0;
while(TRUE) {
......@@ -68,8 +78,10 @@ int MessageBox( HWND hWnd, LPSTR str, LPSTR title, WORD type )
TranslateMessage(&msg);
DispatchMessage(&msg);
}
printf( "after MessageBox !\n");
if (!UnregisterClass("MESSAGEBOX", wndPtr->hInstance)) return 0;
#ifdef DEBUG_MSGBOX
printf( "MessageBox return %04X !\n", mb.wRetVal);
#endif
return(mb.wRetVal);
}
......@@ -219,7 +231,9 @@ LONG SystemMessageBoxProc(HWND hWnd, WORD message, WORD wParam, LONG lParam)
EndPaint(hWnd, &ps);
break;
case WM_DESTROY:
#ifdef DEBUG_MSGBOX
printf("MessageBox WM_DESTROY !\n");
#endif
ReleaseCapture();
lpmb = MsgBoxGetStorageHeader(hWnd);
lpmb->ActiveFlg = FALSE;
......@@ -227,6 +241,9 @@ LONG SystemMessageBoxProc(HWND hWnd, WORD message, WORD wParam, LONG lParam)
if (lpmb->hWndYes) DestroyWindow(lpmb->hWndYes);
if (lpmb->hWndNo) DestroyWindow(lpmb->hWndNo);
if (lpmb->hWndCancel) DestroyWindow(lpmb->hWndCancel);
#ifdef DEBUG_MSGBOX
printf("MessageBox WM_DESTROY end !\n");
#endif
break;
case WM_COMMAND:
lpmb = MsgBoxGetStorageHeader(hWnd);
......@@ -257,17 +274,41 @@ BOOL FAR PASCAL AboutWine_Proc(HWND hDlg, WORD msg, WORD wParam, LONG lParam)
HFONT hOldFont;
RECT rect;
BITMAP bm;
char C[80];
int X;
static HBITMAP hBitMap;
OFSTRUCT ofstruct;
static LPSTR ptr;
static char str[256];
static HBITMAP hBitMap = 0;
static BOOL CreditMode;
static HANDLE hFile = 0;
switch (msg) {
case WM_INITDIALOG:
strcpy(C, "WINELOGO");
hBitMap = LoadBitmap((HINSTANCE)NULL, (LPSTR)C);
CreditMode = FALSE;
strcpy(str, "WINELOGO");
hBitMap = LoadBitmap((HINSTANCE)NULL, (LPSTR)str);
/* getcwd(str, 256);
strcat(str, ";");
strcat(str, getenv("HOME"));
strcat(str, ";");
strcat(str, getenv("WINEPATH")); */
strcpy(str, "PROPOSED_LICENSE");
printf("str = '%s'\n", str);
hFile = KERNEL_OpenFile((LPSTR)str, &ofstruct, OF_READ);
ptr = (LPSTR)malloc(2048);
lseek(hFile, 0L, SEEK_SET);
KERNEL__lread(hFile, ptr, 2000L);
close(hFile);
return TRUE;
case WM_PAINT:
hDC = BeginPaint(hDlg, &ps);
GetClientRect(hDlg, &rect);
if (CreditMode) {
FillRect(hDC, &rect, GetStockObject(WHITE_BRUSH));
InflateRect(&rect, -8, -8);
DrawText(hDC, ptr, -1, &rect, DT_LEFT | DT_WORDBREAK);
EndPaint(hDlg, &ps);
return TRUE;
}
FillRect(hDC, &rect, GetStockObject(GRAY_BRUSH));
InflateRect(&rect, -3, -3);
FrameRect(hDC, &rect, GetStockObject(BLACK_BRUSH));
......@@ -283,8 +324,26 @@ BOOL FAR PASCAL AboutWine_Proc(HWND hDlg, WORD msg, WORD wParam, LONG lParam)
case WM_COMMAND:
switch (wParam)
{
case IDYES:
if (!CreditMode) {
SetWindowPos(hDlg, (HWND)NULL, 0, 0, 640, 480,
SWP_NOMOVE | SWP_NOZORDER);
}
else {
SetWindowPos(hDlg, (HWND)NULL, 0, 0, 320, 250,
SWP_NOMOVE | SWP_NOZORDER);
}
CreditMode = !CreditMode;
ShowWindow(GetDlgItem(hDlg, IDYES), CreditMode ? SW_HIDE : SW_SHOW);
ShowWindow(GetDlgItem(hDlg, IDOK), CreditMode ? SW_HIDE : SW_SHOW);
InvalidateRect(hDlg, (LPRECT)NULL, TRUE);
UpdateWindow(hDlg);
return TRUE;
case IDCANCEL:
case IDOK:
CloseDLG: EndDialog(hDlg, TRUE);
CloseDLG: if (hBitMap != 0 ) DeleteObject(hBitMap);
if (ptr != NULL) free(ptr);
EndDialog(hDlg, TRUE);
return TRUE;
default:
return TRUE;
......
......@@ -10,7 +10,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#ifdef linux
#include <values.h>
#endif
#ifdef __NetBSD__
#if defined(__NetBSD__) || defined(__FreeBSD__)
#include <limits.h>
#define MAXINT INT_MAX
#endif
......
No preview for this file type
No preview for this file type
......@@ -9,7 +9,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#ifdef linux
#define UTEXTSEL 0x23
#endif
#ifdef __NetBSD__
#if defined(__NetBSD__) || defined(__FreeBSD__)
#define UTEXTSEL 0x1f
#endif
......
......@@ -3,46 +3,54 @@
MODULE = windows
SRCS = \
caret.c \
class.c \
clipping.c \
dc.c \
dce.c \
defdlg.c \
defwnd.c \
dialog.c \
event.c \
message.c \
win.c \
timer.c \
focus.c \
graphics.c \
clipping.c \
keyboard.c \
mapping.c \
message.c \
nonclient.c \
painting.c \
keyboard.c \
utility.c \
scroll.c \
syscolor.c \
defwnd.c \
defdlg.c \
dialog.c \
focus.c \
scroll.c
sysmetrics.c \
timer.c \
utility.c \
win.c \
winpos.c
OBJS = \
caret.o \
class.o \
clipping.o \
dc.o \
dce.o \
defdlg.o \
defwnd.o \
dialog.o \
event.o \
message.o \
win.o \
timer.o \
focus.o \
graphics.o \
clipping.o \
keyboard.o \
mapping.o \
message.o \
nonclient.o \
painting.o \
keyboard.o \
utility.o \
scroll.o \
syscolor.o \
defwnd.o \
defdlg.o \
dialog.o \
focus.o \
scroll.o
sysmetrics.o \
timer.o \
utility.o \
win.o \
winpos.o
WineRelocatableTarget($(TOP)/$(MODULE),,$(OBJS))
DependTarget()
......
......@@ -38,6 +38,16 @@ void InvalidateRgn( HWND hwnd, HRGN hrgn, BOOL erase )
else MSG_IncPaintCount( wndPtr->hmemTaskQ );
wndPtr->hrgnUpdate = newRgn;
if (erase) wndPtr->flags |= WIN_ERASE_UPDATERGN;
/* Invalidate the children overlapping the region */
if (wndPtr->dwStyle & WS_CLIPCHILDREN) return;
for (hwnd = wndPtr->hwndChild; (hwnd); hwnd = wndPtr->hwndNext)
{
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) break;
if (hrgn && !RectInRegion( hrgn, &wndPtr->rectWindow )) continue;
InvalidateRgn( hwnd, hrgn, erase );
}
}
......
......@@ -13,14 +13,34 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "user.h"
extern LONG NC_HandleNCPaint( HWND hwnd, HRGN hrgn );
extern LONG NC_HandleNCActivate( HWND hwnd, WORD wParam );
extern LONG NC_HandleNCCalcSize( HWND hwnd, NCCALCSIZE_PARAMS *params );
extern LONG NC_HandleNCHitTest( HWND hwnd, POINT pt );
extern LONG NC_HandleNCLButtonDown( HWND hwnd, WORD wParam, LONG lParam );
extern LONG NC_HandleNCLButtonUp( HWND hwnd, WORD wParam, LONG lParam );
extern LONG NC_HandleNCLButtonDblClk( HWND hwnd, WORD wParam, LONG lParam );
extern LONG NC_HandleNCMouseMove( HWND hwnd, WORD wParam, POINT pt );
extern LONG NC_HandleSysCommand( HWND hwnd, WORD wParam, POINT pt );
extern LONG NC_HandleSetCursor( HWND hwnd, WORD wParam, LONG lParam );
extern void NC_TrackSysMenu( HWND hwnd ); /* menu.c */
/***********************************************************************
* DEFWND_SetText
*
* Set the window text.
*/
void DEFWND_SetText( HWND hwnd, LPSTR text )
{
LPSTR textPtr;
WND *wndPtr = WIN_FindWndPtr( hwnd );
if (wndPtr->hText) USER_HEAP_FREE( wndPtr->hText );
wndPtr->hText = USER_HEAP_ALLOC( LMEM_MOVEABLE, strlen(text) + 2 );
textPtr = (LPSTR) USER_HEAP_ADDR( wndPtr->hText );
strcpy( textPtr, text );
/* for use by edit control */
*(textPtr + strlen(text) + 1) = '\0';
}
/***********************************************************************
......@@ -43,15 +63,7 @@ LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
{
CREATESTRUCT * createStruct = (CREATESTRUCT *)lParam;
if (createStruct->lpszName)
{
/* Allocate space for window text */
wndPtr->hText = USER_HEAP_ALLOC(GMEM_MOVEABLE,
strlen(createStruct->lpszName) + 2);
textPtr = (LPSTR)USER_HEAP_ADDR(wndPtr->hText);
strcpy(textPtr, createStruct->lpszName);
*(textPtr + strlen(createStruct->lpszName) + 1) = '\0';
/* for use by edit control */
}
DEFWND_SetText( hwnd, createStruct->lpszName );
return 1;
}
......@@ -67,14 +79,11 @@ LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
case WM_NCLBUTTONDOWN:
return NC_HandleNCLButtonDown( hwnd, wParam, lParam );
case WM_NCLBUTTONUP:
return NC_HandleNCLButtonUp( hwnd, wParam, lParam );
case WM_NCLBUTTONDBLCLK:
return NC_HandleNCLButtonDblClk( hwnd, wParam, lParam );
case WM_NCMOUSEMOVE:
return NC_HandleNCMouseMove( hwnd, wParam, MAKEPOINT(lParam) );
case WM_NCACTIVATE:
return NC_HandleNCActivate( hwnd, wParam );
case WM_NCDESTROY:
{
......@@ -95,6 +104,19 @@ LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
DestroyWindow( hwnd );
return 0;
case WM_MOUSEACTIVATE:
if (wndPtr->dwStyle & WS_CHILD)
{
LONG ret = SendMessage( wndPtr->hwndParent, WM_MOUSEACTIVATE,
wParam, lParam );
if (ret) return ret;
}
return MA_ACTIVATE;
case WM_ACTIVATE:
if (wParam) SetFocus( hwnd );
break;
case WM_WINDOWPOSCHANGED:
{
WINDOWPOS * winPos = (WINDOWPOS *)lParam;
......@@ -170,16 +192,9 @@ LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
}
case WM_SETTEXT:
{
if (wndPtr->hText)
USER_HEAP_FREE(wndPtr->hText);
wndPtr->hText = USER_HEAP_ALLOC(GMEM_MOVEABLE,
strlen((LPSTR)lParam) + 1);
textPtr = (LPSTR)USER_HEAP_ADDR(wndPtr->hText);
strcpy(textPtr, (LPSTR)lParam);
return (0L);
}
DEFWND_SetText( hwnd, (LPSTR)lParam );
NC_HandleNCPaint( hwnd, (HRGN)1 ); /* Repaint caption */
return 0;
case WM_SETCURSOR:
if (wndPtr->dwStyle & WS_CHILD)
......@@ -193,6 +208,7 @@ LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
case WM_SYSKEYDOWN:
if (wParam == VK_MENU) {
printf("VK_MENU Pressed // hMenu=%04X !\n", GetMenu(hwnd));
NC_TrackSysMenu(hwnd);
}
break;
case WM_SYSKEYUP:
......
......@@ -9,6 +9,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "windows.h"
#include "dialog.h"
#include "win.h"
#include "user.h"
/* Dialog base units */
......@@ -510,14 +511,13 @@ int GetDlgItemText( HWND hwnd, WORD id, LPSTR str, WORD max )
*/
void SetDlgItemInt( HWND hwnd, WORD id, WORD value, BOOL fSigned )
{
HANDLE hText = LocalAlloc( LMEM_MOVEABLE, 10 );
char * str = (char *) LocalLock( hText );
HANDLE hText = USER_HEAP_ALLOC(0, 10 );
char * str = (char *) USER_HEAP_ADDR( hText );
if (fSigned) sprintf( str, "%d", value );
else sprintf( str, "%u", value );
SendDlgItemMessage( hwnd, id, WM_SETTEXT, 0, (DWORD)str );
LocalUnlock( hText );
LocalFree( hText );
USER_HEAP_FREE( hText );
}
......@@ -534,9 +534,9 @@ WORD GetDlgItemInt( HWND hwnd, WORD id, BOOL * translated, BOOL fSigned )
if (translated) *translated = FALSE;
if (!(len = SendDlgItemMessage( hwnd, id, WM_GETTEXTLENGTH, 0, 0 )))
return 0;
if (!(hText = LocalAlloc(LMEM_MOVEABLE, len+1 )))
if (!(hText = USER_HEAP_ALLOC(0, len+1 )))
return 0;
str = (char *) LocalLock( hText );
str = (char *) USER_HEAP_ADDR( hText );
if (SendDlgItemMessage( hwnd, id, WM_GETTEXT, len+1, (DWORD)str ))
{
char * endptr;
......@@ -555,8 +555,7 @@ WORD GetDlgItemInt( HWND hwnd, WORD id, BOOL * translated, BOOL fSigned )
}
}
}
LocalUnlock( hText );
LocalFree( hText );
USER_HEAP_FREE( hText );
return (WORD)result;
}
......
......@@ -18,6 +18,8 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
extern Display * display;
extern void WINPOS_ChangeActiveWindow( HWND hwnd, BOOL mouseMsg ); /*winpos.c*/
/* X context to associate a hwnd to an X window */
static XContext winContext = 0;
......@@ -453,10 +455,11 @@ static void EVENT_FocusIn( HWND hwnd, XFocusChangeEvent *event )
*/
static void EVENT_FocusOut( HWND hwnd, XFocusChangeEvent *event )
{
WND * wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return;
if (hwnd == GetActiveWindow()) WINPOS_ChangeActiveWindow( 0, FALSE );
if (wndPtr->dwStyle & WS_DISABLED) {
return;
}
......@@ -503,8 +506,8 @@ HWND SetCapture(HWND wnd)
return 0;
rv = XGrabPointer(display, wnd_p->window, False,
ButtonPressMask | ButtonReleaseMask | ButtonMotionMask,
GrabModeAsync, GrabModeSync, None, None, CurrentTime);
ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
if (rv == GrabSuccess)
{
......
......@@ -24,6 +24,7 @@ HWND SetFocus(HWND hwnd)
WND *wndPtr;
hWndPrevFocus = hWndFocus;
hWndFocus = hwnd;
if (hwnd == 0)
{
......
......@@ -24,6 +24,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
extern BOOL TIMER_CheckTimer( DWORD *next ); /* timer.c */
extern void EVENT_ProcessEvent( XEvent *event ); /* event.c */
extern void WINPOS_ChangeActiveWindow( HWND hwnd, BOOL mouseMsg ); /*winpos.c*/
extern Display * display;
......@@ -195,32 +196,65 @@ static void MSG_RemoveMsg( MESSAGEQUEUE * msgQueue, int pos )
* MSG_TranslateMouseMsg
*
* Translate an mouse hardware event into a real mouse message.
* Return value indicates whether the translated message must be passed
* to the user.
* Actions performed:
* - Translate button-down messages in double-clicks.
* - Send the WM_NCHITTEST message to find where the cursor is.
* - Activate the window if needed.
* - Translate the message into a non-client message, or translate
* the coordinates to client coordinates.
* - Send the WM_SETCURSOR message.
*/
static void MSG_TranslateMouseMsg( MSG *msg )
static BOOL MSG_TranslateMouseMsg( MSG *msg )
{
BOOL eatMsg = FALSE;
static DWORD lastClickTime = 0;
static WORD lastClickMsg = 0;
static POINT lastClickPos = { 0, 0 };
BOOL mouseClick = ((msg->message == WM_LBUTTONDOWN) ||
(msg->message == WM_RBUTTONDOWN) ||
(msg->message == WM_MBUTTONDOWN));
/* Send the WM_NCHITTEST message */
LONG hittest_result = SendMessage( msg->hwnd, WM_NCHITTEST, 0,
MAKELONG( msg->pt.x, msg->pt.y ) );
/* Activate the window if needed */
if (mouseClick)
{
HWND parent, hwndTop = msg->hwnd;
while ((parent = GetParent(hwndTop)) != 0) hwndTop = parent;
if (hwndTop != GetActiveWindow())
{
LONG ret = SendMessage( msg->hwnd, WM_MOUSEACTIVATE, hwndTop,
MAKELONG( hittest_result, msg->message ) );
if ((ret == MA_ACTIVATEANDEAT) || (ret == MA_NOACTIVATEANDEAT))
eatMsg = TRUE;
if ((ret == MA_ACTIVATE) || (ret == MA_ACTIVATEANDEAT))
{
SetWindowPos( hwndTop, HWND_TOP, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE );
WINPOS_ChangeActiveWindow( hwndTop, TRUE );
}
}
}
/* Send the WM_SETCURSOR message */
SendMessage( msg->hwnd, WM_SETCURSOR, msg->hwnd,
MAKELONG( hittest_result, msg->message ));
if (eatMsg) return FALSE;
/* Check for double-click */
if ((msg->message == WM_LBUTTONDOWN) ||
(msg->message == WM_RBUTTONDOWN) ||
(msg->message == WM_MBUTTONDOWN))
if (mouseClick)
{
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) &&
......@@ -247,6 +281,8 @@ static void MSG_TranslateMouseMsg( MSG *msg )
lastClickPos = msg->pt;
}
/* Build the translated message */
msg->lParam = MAKELONG( msg->pt.x, msg->pt.y );
if (hittest_result == HTCLIENT)
{
......@@ -257,6 +293,7 @@ static void MSG_TranslateMouseMsg( MSG *msg )
msg->wParam = hittest_result;
msg->message += WM_NCLBUTTONDOWN - WM_LBUTTONDOWN;
}
return TRUE;
}
......@@ -351,6 +388,33 @@ void hardware_event( HWND hwnd, WORD message, WORD wParam, LONG lParam,
/***********************************************************************
* MSG_GetHardwareMessage
*
* Like GetMessage(), but only return mouse and keyboard events.
* Used internally for window moving and resizing. Mouse messages
* are not translated.
*/
BOOL MSG_GetHardwareMessage( LPMSG msg )
{
int pos;
XEvent event;
while(1)
{
if ((pos = MSG_FindMsg( sysMsgQueue, 0, 0, 0 )) != -1)
{
*msg = sysMsgQueue->messages[pos].msg;
MSG_RemoveMsg( sysMsgQueue, pos );
break;
}
XNextEvent( display, &event );
EVENT_ProcessEvent( &event );
}
return TRUE;
}
/***********************************************************************
* SetTaskQueue (KERNEL.34)
*/
WORD SetTaskQueue( HANDLE hTask, HANDLE hQueue )
......@@ -505,9 +569,14 @@ static BOOL MSG_PeekMessage( MESSAGEQUEUE * msgQueue, LPMSG msg, HWND hwnd,
msgQueue->GetMessagePosVal = *(DWORD *)&msg->pt;
msgQueue->GetMessageExtraInfoVal = qmsg->extraInfo;
if (flags & PM_REMOVE) MSG_RemoveMsg( sysMsgQueue, pos );
if ((msg->message >= WM_MOUSEFIRST) &&
(msg->message <= WM_MOUSELAST)) MSG_TranslateMouseMsg( msg );
(msg->message <= WM_MOUSELAST))
if (!MSG_TranslateMouseMsg( msg ))
{
MSG_RemoveMsg( sysMsgQueue, pos );
continue;
}
if (flags & PM_REMOVE) MSG_RemoveMsg( sysMsgQueue, pos );
break;
}
......
......@@ -142,7 +142,10 @@ static WORD TIMER_SetTimer( HWND hwnd, WORD id, WORD timeout,
pTimer->proc = proc;
TIMER_InsertTimer( pTimer );
MSG_IncTimerCount( GetTaskQueue(0) );
return id;
if (!id)
return TRUE;
else
return id;
}
......
......@@ -16,11 +16,13 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "user.h"
#include "dce.h"
#include "sysmetrics.h"
#include "scroll.h"
extern Display * display;
extern Colormap COLOR_WinColormap;
extern void EVENT_RegisterWindow( Window w, HWND hwnd ); /* event.c */
extern HMENU CopySysMenu(); /* menu.c */
HWND firstWindow = 0;
......@@ -256,10 +258,10 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
wndPtr->hText = 0;
wndPtr->flags = 0;
wndPtr->hCursor = 0;
wndPtr->hWndVScroll = 0;
wndPtr->hWndHScroll = 0;
wndPtr->VScroll = NULL;
wndPtr->HScroll = NULL;
wndPtr->hSysMenu = 0;
wndPtr->hWndMenuBar = 0;
wndPtr->hWndCaption = 0;
if (classPtr->wc.cbWndExtra)
memset( wndPtr->wExtra, 0, classPtr->wc.cbWndExtra );
......@@ -311,8 +313,8 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
/* Send the WM_CREATE message */
hcreateStruct = GlobalAlloc( GMEM_MOVEABLE, sizeof(CREATESTRUCT) );
createStruct = (CREATESTRUCT *) GlobalLock( hcreateStruct );
hcreateStruct = USER_HEAP_ALLOC( GMEM_MOVEABLE, sizeof(CREATESTRUCT) );
createStruct = (CREATESTRUCT *) USER_HEAP_ADDR( hcreateStruct );
createStruct->lpCreateParams = data;
createStruct->hInstance = instance;
createStruct->hMenu = menu;
......@@ -333,22 +335,20 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
/* Send WM_NCCALCSIZE message */
NCCALCSIZE_PARAMS *params;
HANDLE hparams;
hparams = GlobalAlloc( GMEM_MOVEABLE, sizeof(*params) );
hparams = USER_HEAP_ALLOC( GMEM_MOVEABLE, sizeof(*params) );
if (hparams)
{
params = (NCCALCSIZE_PARAMS *) GlobalLock( hparams );
params = (NCCALCSIZE_PARAMS *) USER_HEAP_ADDR( hparams );
params->rgrc[0] = wndPtr->rectWindow;
params->lppos = NULL;
SendMessage( hwnd, WM_NCCALCSIZE, FALSE, (LONG)params );
wndPtr->rectClient = params->rgrc[0];
GlobalUnlock( hparams );
GlobalFree( hparams );
USER_HEAP_FREE( hparams );
}
wmcreate = SendMessage( hwnd, WM_CREATE, 0, (LONG)createStruct );
}
GlobalUnlock( hcreateStruct );
GlobalFree( hcreateStruct );
USER_HEAP_FREE( hcreateStruct );
if (wmcreate == -1)
{
......@@ -364,14 +364,9 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
/* Create scrollbars */
#if 0
if (windowName != NULL) SetWindowText(hwnd, windowName);
if ((style & WS_CAPTION) == WS_CAPTION) {
wndPtr->hWndCaption = CreateWindow("CAPTION", "",
WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE,
0, -20, width, 20, hwnd, 1, instance, 0L);
if ((style & WS_SYSMENU) == WS_SYSMENU) {
wndPtr->hSysMenu = CopySysMenu();
}
#endif
if (((style & WS_CHILD) != WS_CHILD) && (wndPtr->wIDmenu != 0)) {
lpbar = (LPPOPUPMENU) GlobalLock(wndPtr->wIDmenu);
if (lpbar != NULL) {
......@@ -381,25 +376,11 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
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);
}
/* Create scrollbars */
if ((style & WS_VSCROLL) == WS_VSCROLL ||
(style & WS_HSCROLL) == WS_HSCROLL) {
NC_CreateScrollBars(hwnd);
}
EVENT_RegisterWindow( wndPtr->window, hwnd );
WIN_SendParentNotify( hwnd, wndPtr, WM_CREATE );
......@@ -429,8 +410,8 @@ BOOL DestroyWindow( HWND hwnd )
/* Destroy all children */
if (wndPtr->hWndVScroll) DestroyWindow(wndPtr->hWndVScroll);
if (wndPtr->hWndHScroll) DestroyWindow(wndPtr->hWndHScroll);
if (wndPtr->VScroll) free(wndPtr->VScroll);
if (wndPtr->HScroll) free(wndPtr->HScroll);
while (wndPtr->hwndChild) /* The child removes itself from the list */
DestroyWindow( wndPtr->hwndChild );
......@@ -445,6 +426,9 @@ BOOL DestroyWindow( HWND hwnd )
if (wndPtr->flags & WIN_OWN_DC) DCE_FreeDCE( wndPtr->hdce );
classPtr->cWindows--;
USER_HEAP_FREE( hwnd );
/*
printf("End of DestroyWindow // hwnd=%04X !\n", hwnd);
*/
return TRUE;
}
......@@ -493,25 +477,6 @@ void UpdateWindow( HWND hwnd )
}
}
/**********************************************************************
* GetMenu (USER.157)
*/
HMENU GetMenu( HWND hwnd )
{
WND * wndPtr = WIN_FindWndPtr(hwnd);
if (wndPtr == NULL)
return 0;
return wndPtr->wIDmenu;
}
/**********************************************************************
* SetMenu (USER.158)
*/
BOOL SetMenu(HWND hwnd, HMENU hmenu)
{
return FALSE;
}
/**********************************************************************
* GetDesktopWindow (USER.286)
......@@ -842,3 +807,127 @@ HWND GetNextWindow( HWND hwnd, WORD flag )
if ((flag != GW_HWNDNEXT) && (flag != GW_HWNDPREV)) return 0;
return GetWindow( hwnd, flag );
}
/*******************************************************************
* EnumWindows (USER.54)
*
* o gets the desktop window and iterates over all the windows
* which are direct decendents of the desktop * by iterating over
* the desktop's child window and all the child windows next
* pointers
*
* o call wndenumprc for every child window the desktop has
* (parameters to Callback16 passed backwards so they are
* put in in pascal calling order)
*
* o if wndenumprc returns 0 exit
*
* * remove the HAS_DESKTOP_WINDOW ifdef when the GetDesktopWindow() call
* is fixed to actually return the desktop window
*
*/
BOOL EnumWindows(FARPROC wndenumprc, LPARAM lParam)
{
HWND hwnd = GetDesktopWindow();
WND *wndPtr;
int result;
#ifdef DEBUG_ENUM
printf("EnumWindows\n");
#endif
#ifdef HAS_DESKTOP_WINDOW
if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0;
hwnd = wndPtr->hwndChild;
#else
hwnd = firstWindow;
#endif
while (hwnd) {
char *ptr;
if ( !(wndPtr=WIN_FindWndPtr(hwnd)) ) {
return 0;
}
#ifdef DEBUG_ENUM
if (XFetchName(display, wndPtr->window, &ptr) && ptr)
printf("found a window (%s)\n", ptr);
else
printf("found nameless parent window\n");
#endif
result = CallBack16(wndenumprc, 2, lParam, (int) hwnd);
if ( ! result ) {
return 0;
}
hwnd=wndPtr->hwndNext;
}
return 1; /* for now */
}
/*******************************************************************
* WIN_EnumChildWin
*
* o hwnd is the first child to use, loop until all next windows
* are processed
*
* o call wdnenumprc with parameters in inverse order (pascal)
*
* o call ourselves with the next child window
*
*/
static BOOL WIN_EnumChildWin(HWND hwnd, FARPROC wndenumprc, LPARAM lParam)
{
WND *wndPtr;
int result;
while (hwnd) {
char *ptr;
if ( !(wndPtr=WIN_FindWndPtr(hwnd)) ) {
return 0;
}
#ifdef DEBUG_ENUM
if (XFetchName(display, wndPtr->window, &ptr) && ptr)
printf("EnumChild: found a child window (%s)\n", ptr);
else
printf("EnumChild: nameless child\n");
if (!(wndPtr->dwStyle & WS_CHILD)) {
printf("this is not a child window! What is it doing here?\n");
return 0;
}
#endif
if (!CallBack16(wndenumprc, 2, lParam, (int) hwnd)) {
return 0;
}
if (!WIN_EnumChildWin(wndPtr->hwndChild, wndenumprc, lParam)) {
return 0;
}
hwnd=wndPtr->hwndNext;
}
return 1;
}
/*******************************************************************
* EnumChildWindows (USER.55)
*
* o gets the first child of hwnd
*
* o calls WIN_EnumChildWin to do a recursive decent of child windows
*/
BOOL EnumChildWindows(HWND hwnd, FARPROC wndenumprc, LPARAM lParam)
{
WND *wndPtr;
#ifdef DEBUG_ENUM
printf("EnumChildWindows\n");
#endif
if (hwnd == 0) return 0;
if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0;
hwnd = wndPtr->hwndChild;
return WIN_EnumChildWin(hwnd, wndenumprc, lParam);
}
......@@ -6,10 +6,14 @@
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "sysmetrics.h"
#include "user.h"
#include "win.h"
extern Display * display;
static HWND hwndActive = 0; /* Currently active window */
/***********************************************************************
* GetWindowRect (USER.32)
......@@ -156,6 +160,28 @@ BOOL IsZoomed(HWND hWnd)
}
/*******************************************************************
* GetActiveWindow (USER.60)
*/
HWND GetActiveWindow()
{
return hwndActive;
}
/*******************************************************************
* SetActiveWindow (USER.59)
*/
HWND SetActiveWindow( HWND hwnd )
{
HWND prev = hwndActive;
WND *wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr || (wndPtr->dwStyle & WS_CHILD)) return 0;
SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
return prev;
}
/***********************************************************************
* BringWindowToTop (USER.45)
*/
......@@ -204,6 +230,7 @@ BOOL ShowWindow( HWND hwnd, int cmd )
case SW_SHOWMINNOACTIVE:
case SW_SHOWMINIMIZED:
case SW_SHOWMAXIMIZED:
case SW_MINIMIZE:
wndPtr->dwStyle |= WS_MINIMIZE;
swpflags |= SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE |
......@@ -211,15 +238,23 @@ BOOL ShowWindow( HWND hwnd, int cmd )
break;
case SW_SHOWNA:
case SW_SHOWNOACTIVATE:
case SW_MAXIMIZE:
case SW_SHOWMAXIMIZED:
case SW_SHOW:
swpflags |= SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE;
break;
case SW_NORMAL:
case SW_SHOWNORMAL:
case SW_SHOWNOACTIVATE:
case SW_RESTORE:
wndPtr->dwStyle &= ~WS_MINIMIZE;
swpflags |= SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE |
SWP_NOACTIVATE | SWP_NOZORDER;
wndPtr->dwStyle &= ~WS_MAXIMIZE;
swpflags |= SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE;
if (cmd == SW_SHOWNOACTIVATE)
{
swpflags |= SWP_NOZORDER;
if (GetActiveWindow()) swpflags |= SWP_NOACTIVATE;
}
break;
}
SendMessage( hwnd, WM_SHOWWINDOW, (cmd != SW_HIDE), 0 );
......@@ -311,10 +346,76 @@ BOOL SetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *wndpl )
}
/*******************************************************************
* WINPOS_GetMinMaxInfo
*
* Send a WM_GETMINMAXINFO to the window.
*/
void WINPOS_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos,
POINT *minTrack, POINT *maxTrack )
{
HANDLE minmaxHandle;
MINMAXINFO MinMax, *pMinMax;
WND *wndPtr = WIN_FindWndPtr( hwnd );
MinMax.ptMaxSize.x = SYSMETRICS_CXSCREEN;
MinMax.ptMaxSize.y = SYSMETRICS_CYSCREEN;
MinMax.ptMaxPosition = wndPtr->ptMaxPos;
MinMax.ptMinTrackSize.x = SYSMETRICS_CXMINTRACK;
MinMax.ptMinTrackSize.y = SYSMETRICS_CYMINTRACK;
MinMax.ptMaxTrackSize.x = SYSMETRICS_CXSCREEN;
MinMax.ptMaxTrackSize.y = SYSMETRICS_CYSCREEN;
minmaxHandle = USER_HEAP_ALLOC( LMEM_MOVEABLE, sizeof(MINMAXINFO) );
if (minmaxHandle)
{
pMinMax = (MINMAXINFO *) USER_HEAP_ADDR( minmaxHandle );
memcpy( pMinMax, &MinMax, sizeof(MinMax) );
SendMessage( hwnd, WM_GETMINMAXINFO, 0, (LONG)pMinMax );
}
else pMinMax = &MinMax;
if (maxSize) *maxSize = pMinMax->ptMaxSize;
if (maxPos) *maxPos = pMinMax->ptMaxPosition;
if (minTrack) *minTrack = pMinMax->ptMinTrackSize;
if (maxTrack) *maxTrack = pMinMax->ptMaxTrackSize;
if (minmaxHandle) USER_HEAP_FREE( minmaxHandle );
}
/*******************************************************************
* WINPOS_ChangeActiveWindow
*
* Change the active window and send the corresponding messages.
*/
HWND WINPOS_ChangeActiveWindow( HWND hwnd, BOOL mouseMsg )
{
HWND prevActive = hwndActive;
if (hwnd == hwndActive) return 0;
if (hwndActive)
{
if (!SendMessage( hwndActive, WM_NCACTIVATE, FALSE, 0 )) return 0;
SendMessage( hwndActive, WM_ACTIVATE, WA_INACTIVE,
MAKELONG( IsIconic(hwndActive), hwnd ) );
/* Send WM_ACTIVATEAPP here */
}
hwndActive = hwnd;
if (hwndActive)
{
/* Send WM_ACTIVATEAPP here */
SendMessage( hwnd, WM_NCACTIVATE, TRUE, 0 );
SendMessage( hwnd, WM_ACTIVATE, mouseMsg ? WA_CLICKACTIVE : WA_ACTIVE,
MAKELONG( IsIconic(hwnd), prevActive ) );
}
return prevActive;
}
/***********************************************************************
* SetWindowPos (USER.232)
*/
/* Unimplemented flags: SWP_NOREDRAW, SWP_NOACTIVATE
/* Unimplemented flags: SWP_NOREDRAW
*/
/* Note: all this code should be in the DeferWindowPos() routines,
* and SetWindowPos() should simply call them. This will be implemented
......@@ -342,8 +443,9 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, short x, short y,
/* Send WM_WINDOWPOSCHANGING message */
if (!(hmem = GlobalAlloc( GMEM_MOVEABLE,sizeof(WINDOWPOS) ))) return FALSE;
winPos = (WINDOWPOS *)GlobalLock( hmem );
if (!(hmem = USER_HEAP_ALLOC( GMEM_MOVEABLE, sizeof(WINDOWPOS) )))
return FALSE;
winPos = (WINDOWPOS *)USER_HEAP_ADDR( hmem );
winPos->hwnd = hwnd;
winPos->hwndInsertAfter = hwndInsertAfter;
winPos->x = x;
......@@ -398,16 +500,15 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, short x, short y,
NCCALCSIZE_PARAMS *params;
HANDLE hparams;
if (!(hparams = GlobalAlloc( GMEM_MOVEABLE, sizeof(*params) )))
if (!(hparams = USER_HEAP_ALLOC( GMEM_MOVEABLE, sizeof(*params) )))
goto Abort;
params = (NCCALCSIZE_PARAMS *) GlobalLock( hparams );
params = (NCCALCSIZE_PARAMS *) USER_HEAP_ADDR( hparams );
params->rgrc[0] = newWindowRect;
params->rgrc[1] = wndPtr->rectWindow;
params->rgrc[2] = wndPtr->rectClient;
params->lppos = winPos;
calcsize_result = SendMessage(hwnd, WM_NCCALCSIZE, TRUE, (LONG)params);
GlobalUnlock( hparams );
GlobalFree( hparams );
USER_HEAP_FREE( hparams );
newClientRect = params->rgrc[0];
/* Handle result here */
}
......@@ -470,6 +571,12 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, short x, short y,
XUnmapWindow( display, wndPtr->window );
}
if (!(winPos->flags & SWP_NOACTIVATE))
{
if (!(wndPtr->dwStyle & WS_CHILD))
WINPOS_ChangeActiveWindow( hwnd, FALSE );
}
/* Send WM_NCPAINT message if needed */
if ((winPos->flags & (SWP_FRAMECHANGED | SWP_SHOWWINDOW)) ||
(!(winPos->flags & SWP_NOSIZE)) ||
......@@ -482,18 +589,11 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, short x, short y,
wndPtr->rectWindow = newWindowRect;
wndPtr->rectClient = newClientRect;
SendMessage( hwnd, WM_WINDOWPOSCHANGED, 0, (LONG)winPos );
GlobalUnlock( hmem );
GlobalFree( hmem );
USER_HEAP_FREE( hmem );
return TRUE;
Abort: /* Fatal error encountered */
if (hmem)
{
GlobalUnlock( hmem );
GlobalFree( hmem );
}
if (hmem) USER_HEAP_FREE( hmem );
return FALSE;
}
......@@ -22,7 +22,7 @@ Lpt1=/dev/lp0
[spy]
;;;;; Uncomment the following line to activate spying to the console ;;;;;
;File=CON
File=CON
;;;;; Uncomment the following line to activate spying to the spy.log ;;;;;
;File=spy.log
......
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