Release 980628
Sun Jun 28 18:37:02 1998 Alexandre Julliard <julliard@lrc.epfl.ch>
* [if1632/signal.c] [miscemu/instr.c] [memory/virtual.c]
Moved page-fault handling to INSTR_EmulateInstruction.
* [scheduler/thread.c]
Added locking and check for own thread in Suspend/ResumeThread.
Sat Jun 27 21:25:21 1998 Ulrich Weigand <weigand@informatik.uni-erlangen.de>
* [objects/dib.c] [objects/bitmap.c] [objects/oembitmap.c]
[graphics/x11drv/bitblt.c] [include/bitmap.h]
Improved DIB section handling using page fault handlers.
(Note: This patch includes code contributed by Matthew J. Francis.)
* [memory/virtual.c] [if1632/signal.c] [include/global.h]
Page Fault handler support added.
* [if1632/signal.c] [loader/signal.c] [tools/build.c] [misc/system.c]
[misc/winsock_dns.c] [include/sig_context.h] [include/thread.h]
16-bit %fs handling improved: Always preserve 16-bit %fs value,
always restore 32-bit %fs value for signal handlers.
* [if1632/thunk.c] [loader/module.c] [misc/callback.c] [windows/user.c]
[loader/ne/resource.c] [include/callback.h] [include/module.h]
[if1632/kernel.spec] [if1632/wprocs.spec]
Resource Handler function pointer stored as 16-bit SEGPTR.
* [loader/task.c] [windows/win.c] [windows/winpos.c] [if1632/user.spec]
[if1632/kernel.spec] [loader/ne/module.c]
Some minor incompatibilities fixed (Win32s relies on those):
GetExePtr, IsWindow16 should set ES on return; WINPOS_SendNCCalcSize
should cope with having the WINDOWPOS structure trashed;
the OFSTRUCT in the NE module image should be placed *last*.
* [include/windows.h]
Missing prototype for FlushViewOfFile.
* [loader/task.c]
Bugfix: Command line should *not* start with a blank.
* [loader/ne/segment.c]
Bugfix: Fixups to offset 0 were never applied.
* [misc/lstr.c]
Use debugstr_a in OutputDebugString16.
* [msdos/dpmi.c]
Stub for int 31 BL=2f AX=7a20 (NetWare: Get VLM Call Address) added.
* [msdos/int21.c]
Stub for int 21 AX=440d CL=6f (get drive map information) added.
Fri Jun 26 18:08:30 1998 Rein Klazes <rklazes@casema.net>
* [windows/winpos.c]
Fix small buglet that mixed up maximized and minimized windows.
* [include/x11drv.h] [objects/dc.c] [graphics/x11drv/pen.c]
[graphics/x11drv/graphics.c]
Fix some bugs with lines joining styles. Draws rectangles
with thick pens now correctly.
Fri Jun 26 16:22:23 1998 James Juran <jrj120@psu.edu>
* [misc/shell.c]
Fixed bug I introduced last release in InternalExtractIcon.
* [win32/file.c]
Added documentation for CreateFile32A.
* [documentation/wine.man]
Updated manpage.
* [ChangeLog]
Added my entry from last release.
Fri Jun 26 13:33:30 1998 Huw D M Davies <daviesh@abacus.physics.ox.ac.uk>
* [graphics/psdrv/*] [if1632/wineps.spec] [include/psdrv.h]
[include/print.h] [objects/gdiobj.c]
First stages of an internal Postscript driver. See
graphics/psdrv/README . Should print text (badly) from win3.1 notepad,
write and winword6.
* [documentation/printing]
Some notes on printing.
* [controls/edit.c]
Strip off WS_BORDER in WM_NCREATE, edit draws its own rectangle.
EC_USEFONTINFO seems to be used as a left/right value for EM_SETMARGINS
and not as an action as the docs say. This actually makes more sense.
Scroll the caret back to zero after a WM_SETTEXT.
Fri Jun 26 10:56:25 1998 Marcus Meissner <marcus@jet.franken.de>
* [if1632/snoop.c]
Added win16 inter-dll snooping.
* [win32/ordinals.c]
KERNEL_485 is GetProcessDword.
* [include/xmalloc.h][include/bitmap.h][misc/xmalloc.c]
Added xcalloc so we 0 initialize XImages.
Fixes/Hides the 'junk around MOPYFish'.
* [misc/ntdll.c]
Some stubs added.
Thu Jun 25 15:22:43 1998 Adrian Harvey <adrian@select.com.au>
* [scheduler/thread.c]
Implemented SuspendThread and ResumeThread.
Thu Jun 25 00:55:03 1998 Peter Hunnisett <hunnise@nortel.ca>
* [include/debug.h,dplay.h,dsound.h][multimedia/dsound.c,dplay.c]
[relay32/dplayx.spec,dplay.spec][multimedia/Makefile.in]
[documentation/status/directplay]
Added preliminary support for DirectPlay & DirectPlayLobby. Moved the
preliminary stubs put in the dsound files into two new files
dplay.h and dplay.c.
Added new debug channel (dplay) for this.
Created new document to keep track of implementation.
* [include/winioctl.h][win32/device.c]
Added some framework in DeviceIoControl to, in the future, support
the "builtin" windows dwIoControlCodes. Added new header file
winioctl.h .
* [multimedia/mmsystem.c]
Added slightly improved debugging information for PlaySound.
Wed Jun 24 12:00:00 1998 Juergen Schmied <juergen.schmied@metronet.de>
* [files/profile.c][graphics/x11drv/xfont.c][loader/module.c]
Changed lstrcmpi32A to strcasecmp, lstrncmpi32A to strncasecmp,
lstrcpy32A to strcpy, lstrlen32A to strlen, lstrcmp32A to strcmp
because it's not necessary to support locale on such places.
It causes a huge overhead and even fails sometimes
* [include/oleauto.h][include/winerror.h]
Added some ole-related constants.
* [misc/shell.c]
SHELL32_DllGetClassObject, SHGetSpecialFolderLocation,
SHGetPathFromIDList improved the stubs
* [ole/folders.c]
IShellFolder* functions rewrote the stubs so don't crash and give
something sensible back, started implementation of.
* [ole/typelib.c][relay32/oleaut32.spec]
LoadTypeLib32, RegisterTypeLib stub.
* [ole/ole2nls.c]
Fixed a buffer overrun in CompareString32A.
Test for a bad pointer in LCMapString32A (happens
in winhlp32 while building a index for searching).
* [relay32/oleaut32.spec] [ole/typelib.c]
Added stub for LoadTypeLib (ole32) to make excel95 happy.
Tue Jun 23 22:47:09 1998 Alex Priem <alexp@sci.kun.nl>
* [files/profile.c] [relay32/kernel32.spec]
Added WritePrivateProfileStructA, GetPrivateProfileStructA,
GetPrivateProfileSectionNames16.
Tue Jun 23 01:34:43 1998 Pascal Cuoq <pcuoq@ens-lyon.fr>
* [ole/ole2nls.c]
GetStringTypeEx32A: Implemented CT_CTYPE2 and CT_CTYPE3 cases.
LCMapString32A: Map final '\0' for '\0'-terminated strings.
* [misc/shellord.c] [files/profile.c] [graphics/driver.c]
[loader/module.c] [msdos/int21.c] [windows/driver.c] [files/drive.c]
Changed lstrcmpi32A -> strcasecmp. Should be OK in these places.
Sat Jun 20 23:40:00 1998 Bertho Stultiens <bertho@akhphd.au.dk>
* [tools/wrc/]
Wrc version 1.0.2 (20-Jun-1998). Please revert to
the file tools/wrc/CHANGES for details.
Sat Jun 20 14:58:00 1998 Marcel Baur <mbaur@g26.ethz.ch>
* [ole/ole2nls.c] [ole/nls/*]
Added the first 57 nls files, most are not yet complete.
Wed Jun 17 11:16:54 1998 David Luyer <luyer@ucs.uwa.edu.au>
* [relay32/relay386.c] [if1632/relay.c]
Move debug_relay_(include|exclude)_list handling into
seperate function RELAY_ShowDebugmsgsRelay(). Include
checking of this for 16 bit calls (originally only
32-bit calls).
* [relay32/snoop.c] [misc/main.c]
Add debug_snoop_(include|exclude)_list as per the relay stuff.
Fix typo and add information on -debugmsg +/-relay=... in
help on -debugmsg. Refer to availability of snoop too.
Tue Jun 10 22:00:18 1998 Eric Kohl <ekohl@abo.rhein-zeitung.de>
* [controls/header.c][include/header.h][include/commctrl.h]
Added owner draw support.
* [windows/nonclient.c][windows/sysmetics.c]
Fixed menu bar height for Win95 look.
Split NC_AdjustRect95() into NC_AdjustRectOuter95() and
NC_AdjustRectInner95 to fix a menu bar bug.
Improved Win95 look.
* [controls/progress.c]
Improved drawing code. Borders will be drawn by non-client code.
* [controls/updown.c]
Changed memory allocation and fixed some bugs.
* [controls/toolbar.c]
Fixed TB_BUTTONSTRUCTSIZE bug in MFC programs.
Several improvements.
* [misc/shell.c]
Added stub for BrowseForFoldersA().
* [misc/shellord.c]
Added stub for SHELL32_147().
* [controls/comctl32undoc.c]
Minor changes.
* [documentation/common_controls]
New File: Documentation about development status, undocumented
features and functions of the common controls.
diff --git a/windows/nonclient.c b/windows/nonclient.c
index 521c0b1..f9917ee 100644
--- a/windows/nonclient.c
+++ b/windows/nonclient.c
@@ -36,6 +36,7 @@
HBRUSH32 NC_WinShadow95;
static HBITMAP16 hbitmapClose = 0;
+static HBITMAP16 hbitmapCloseD = 0;
static HBITMAP16 hbitmapMinimize = 0;
static HBITMAP16 hbitmapMinimizeD = 0;
static HBITMAP16 hbitmapMaximize = 0;
@@ -54,6 +55,15 @@
(((style) & WS_THICKFRAME) && \
!(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME))
+#define HAS_FIXEDFRAME(style,exStyle) \
+ (((((exStyle) & WS_EX_DLGMODALFRAME) || \
+ ((style) & WS_DLGFRAME)) && ((style) & WS_BORDER)) && \
+ !((style) & WS_THICKFRAME))
+
+#define HAS_SIZEFRAME(style) \
+ (((style) & WS_THICKFRAME) && \
+ !(((style) & (WS_DLGFRAME|WS_BORDER)) == WS_DLGFRAME))
+
#define HAS_MENU(w) (!((w)->dwStyle & WS_CHILD) && ((w)->wIDmenu != 0))
#define ON_LEFT_BORDER(hit) \
@@ -113,29 +123,34 @@
/******************************************************************************
+ * NC_AdjustRectOuter95
*
- * NC_AdjustRect95(
- * LPRECT16 rect,
- * DWORD style,
- * BOOL32 menu,
- * DWORD exStyle )
+ * Computes the size of the "outside" parts of the window based on the
+ * parameters of the client area.
*
- * Computes the size of the window based on the parameters of the client
- * area.
+ + PARAMS
+ * LPRECT16 rect
+ * DWORD style
+ * BOOL32 menu
+ * DWORD exStyle
*
- * Bugs
- * Most of this code is copied from NC_AdjustRect. It shouldn't be.
- * There are some unique things about Win 95 that are being horribly
- * neglected here. I don't know what they are, either. :-\
+ * NOTES
+ * "Outer" parts of a window means the whole window frame, caption and
+ * menu bar. It does not include "inner" parts of the frame like client
+ * edge, static edge or scroll bars.
*
- * Revision history
- * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
- * Original cut & paste from NC_AdjustRect
+ * Revision history
+ * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
+ * Original (NC_AdjustRect95) cut & paste from NC_AdjustRect
+ *
+ * 20-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de)
+ * Split NC_AdjustRect95 into NC_AdjustRectOuter95 and
+ * NC_AdjustRectInner95 and added handling of Win95 styles.
*
*****************************************************************************/
-static void NC_AdjustRect95( LPRECT16 rect, DWORD style, BOOL32 menu,
- DWORD exStyle )
+static void
+NC_AdjustRectOuter95 (LPRECT16 rect, DWORD style, BOOL32 menu, DWORD exStyle)
{
if(style & WS_ICONIC) return;
@@ -144,21 +159,67 @@
((style & (WS_DLGFRAME | WS_THICKFRAME)) ||
(exStyle & WS_EX_DLGMODALFRAME))))
{
- if (HAS_DLGFRAME( style, exStyle ))
+ if (HAS_FIXEDFRAME( style, exStyle ))
InflateRect16(rect, SYSMETRICS_CXDLGFRAME, SYSMETRICS_CYDLGFRAME );
else
{
- if (HAS_THICKFRAME(style))
+ if (HAS_SIZEFRAME(style))
InflateRect16( rect, SYSMETRICS_CXFRAME, SYSMETRICS_CYFRAME );
+#if 0
if (style & WS_BORDER)
InflateRect16( rect, SYSMETRICS_CXBORDER, SYSMETRICS_CYBORDER);
+#endif
}
if ((style & WS_CAPTION) == WS_CAPTION)
- rect->top -= SYSMETRICS_CYCAPTION - SYSMETRICS_CYBORDER;
+ if (exStyle & WS_EX_TOOLWINDOW)
+ rect->top -= SYSMETRICS_CYSMCAPTION;
+ else
+ rect->top -= SYSMETRICS_CYCAPTION;
+// rect->top -= sysMetrics[SM_CYCAPTION];
}
- if (menu) rect->top -= SYSMETRICS_CYMENU + SYSMETRICS_CYBORDER + 2;
- else if (!(style & WS_CHILD)) rect->top += SYSMETRICS_CYBORDER;
+
+ if (menu)
+ rect->top -= sysMetrics[SM_CYMENU];
+}
+
+
+/******************************************************************************
+ * NC_AdjustRectInner95
+ *
+ * Computes the size of the "inside" part of the window based on the
+ * parameters of the client area.
+ *
+ + PARAMS
+ * LPRECT16 rect
+ * DWORD style
+ * DWORD exStyle
+ *
+ * NOTES
+ * "Inner" part of a window means the window frame inside of the flat
+ * window frame. It includes the client edge, the static edge and the
+ * scroll bars.
+ *
+ * Revision history
+ * 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
+ * Original (NC_AdjustRect95) cut & paste from NC_AdjustRect
+ *
+ * 20-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de)
+ * Split NC_AdjustRect95 into NC_AdjustRectOuter95 and
+ * NC_AdjustRectInner95 and added handling of Win95 styles.
+ *
+ *****************************************************************************/
+
+static void
+NC_AdjustRectInner95 (LPRECT16 rect, DWORD style, DWORD exStyle)
+{
+ if(style & WS_ICONIC) return;
+
+ if (exStyle & WS_EX_CLIENTEDGE)
+ InflateRect16 (rect, sysMetrics[SM_CXEDGE], sysMetrics[SM_CYEDGE]);
+
+ if (exStyle & WS_EX_STATICEDGE)
+ InflateRect16 (rect, sysMetrics[SM_CXBORDER], sysMetrics[SM_CYBORDER]);
if (style & WS_VSCROLL) rect->right += SYSMETRICS_CXVSCROLL;
if (style & WS_HSCROLL) rect->bottom += SYSMETRICS_CYHSCROLL;
@@ -206,15 +267,18 @@
if (!(style & (WS_POPUP | WS_CHILD))) /* Overlapped window */
style |= WS_CAPTION;
style &= (WS_DLGFRAME | WS_BORDER | WS_THICKFRAME | WS_CHILD);
- exStyle &= (WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE);
+ exStyle &= (WS_EX_DLGMODALFRAME | WS_EX_CLIENTEDGE |
+ WS_EX_STATICEDGE | WS_EX_TOOLWINDOW);
if (exStyle & WS_EX_DLGMODALFRAME) style &= ~WS_THICKFRAME;
TRACE(nonclient, "(%d,%d)-(%d,%d) %08lx %d %08lx\n",
rect->left, rect->top, rect->right, rect->bottom,
style, menu, exStyle );
- if(TWEAK_Win95Look)
- NC_AdjustRect95( rect, style, menu, exStyle );
+ if(TWEAK_Win95Look) {
+ NC_AdjustRectOuter95( rect, style, menu, exStyle );
+ NC_AdjustRectInner95( rect, style, exStyle );
+ }
else
NC_AdjustRect( rect, style, menu, exStyle );
@@ -253,7 +317,7 @@
if( !( pWnd->dwStyle & WS_MINIMIZE ) ) {
if(TWEAK_Win95Look)
- NC_AdjustRect95( &tmpRect, pWnd->dwStyle, FALSE, pWnd->dwExStyle );
+ NC_AdjustRectOuter95( &tmpRect, pWnd->dwStyle, FALSE, pWnd->dwExStyle );
else
NC_AdjustRect( &tmpRect, pWnd->dwStyle, FALSE, pWnd->dwExStyle );
@@ -274,6 +338,15 @@
winRect->right - winRect->left,
-tmpRect.left, -tmpRect.top ) + 1;
}
+
+ if (TWEAK_Win95Look) {
+ SetRect16 (&tmpRect, 0, 0, 0, 0);
+ NC_AdjustRectInner95 (&tmpRect, pWnd->dwStyle, pWnd->dwExStyle);
+ winRect->left -= tmpRect.left;
+ winRect->top -= tmpRect.top;
+ winRect->right -= tmpRect.right;
+ winRect->bottom -= tmpRect.bottom;
+ }
}
return result;
}
@@ -335,16 +408,24 @@
if ((wndPtr->dwStyle & WS_ICONIC) || (wndPtr->flags & WIN_MANAGED)) return;
/* Remove frame from rectangle */
- if (HAS_DLGFRAME (wndPtr->dwStyle, wndPtr->dwExStyle ))
+ if (HAS_FIXEDFRAME (wndPtr->dwStyle, wndPtr->dwExStyle ))
{
InflateRect32( rect, -SYSMETRICS_CXFIXEDFRAME, -SYSMETRICS_CYFIXEDFRAME);
}
- else if (HAS_THICKFRAME (wndPtr->dwStyle))
+ else if (HAS_SIZEFRAME (wndPtr->dwStyle))
{
InflateRect32( rect, -SYSMETRICS_CXSIZEFRAME, -SYSMETRICS_CYSIZEFRAME );
- if (wndPtr->dwStyle & WS_BORDER)
- InflateRect32( rect, -SYSMETRICS_CXBORDER, -SYSMETRICS_CYBORDER );
+/* if (wndPtr->dwStyle & WS_BORDER)
+ InflateRect32( rect, -SYSMETRICS_CXBORDER, -SYSMETRICS_CYBORDER );*/
+ }
+
+ if (wndPtr->dwStyle & WS_CHILD) {
+ if (wndPtr->dwExStyle & WS_EX_CLIENTEDGE)
+ InflateRect32 (rect, -SYSMETRICS_CXEDGE, -SYSMETRICS_CYEDGE);
+
+ if (wndPtr->dwExStyle & WS_EX_STATICEDGE)
+ InflateRect32 (rect, -SYSMETRICS_CXBORDER, -SYSMETRICS_CYBORDER);
}
return;
@@ -352,22 +433,19 @@
/***********************************************************************
- * NC_HandleNCHitTest
+ * NC_DoNCHitTest
*
- * Handle a WM_NCHITTEST message. Called from DefWindowProc().
- *
- * FIXME: A Win95 version of this function is needed.
+ * Handle a WM_NCHITTEST message. Called from NC_HandleNcHitTest().
*/
-LONG NC_HandleNCHitTest( HWND32 hwnd, POINT16 pt )
+
+LONG NC_DoNCHitTest (WND *wndPtr, POINT16 pt )
{
RECT16 rect;
- WND *wndPtr = WIN_FindWndPtr( hwnd );
- if (!wndPtr) return HTERROR;
TRACE(nonclient, "hwnd=%04x pt=%d,%d\n",
- hwnd, pt.x, pt.y );
+ wndPtr->hwndSelf, pt.x, pt.y );
- GetWindowRect16( hwnd, &rect );
+ GetWindowRect16 (wndPtr->hwndSelf, &rect );
if (!PtInRect16( &rect, pt )) return HTNOWHERE;
if (wndPtr->dwStyle & WS_MINIMIZE) return HTCAPTION;
@@ -425,7 +503,7 @@
if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION)
{
- rect.top += SYSMETRICS_CYCAPTION - 1;
+ rect.top += sysMetrics[SM_CYCAPTION] - 1;
if (!PtInRect16( &rect, pt ))
{
/* Check system menu */
@@ -447,8 +525,8 @@
/* Check client area */
- ScreenToClient16( hwnd, &pt );
- GetClientRect16( hwnd, &rect );
+ ScreenToClient16( wndPtr->hwndSelf, &pt );
+ GetClientRect16( wndPtr->hwndSelf, &rect );
if (PtInRect16( &rect, pt )) return HTCLIENT;
/* Check vertical scroll bar */
@@ -488,6 +566,173 @@
/***********************************************************************
+ * NC_DoNCHitTest95
+ *
+ * Handle a WM_NCHITTEST message. Called from NC_HandleNCHitTest().
+ *
+ * FIXME: Just a copy of the Win 3.1 version.
+ */
+
+LONG
+NC_DoNCHitTest95 (WND *wndPtr, POINT16 pt )
+{
+ RECT16 rect;
+
+ TRACE(nonclient, "hwnd=%04x pt=%d,%d\n",
+ wndPtr->hwndSelf, pt.x, pt.y );
+
+ GetWindowRect16 (wndPtr->hwndSelf, &rect );
+ if (!PtInRect16( &rect, pt )) return HTNOWHERE;
+
+ if (wndPtr->dwStyle & WS_MINIMIZE) return HTCAPTION;
+
+ if (!(wndPtr->flags & WIN_MANAGED))
+ {
+ /* Check borders */
+ if (HAS_SIZEFRAME( wndPtr->dwStyle ))
+ {
+ InflateRect16( &rect, -SYSMETRICS_CXFRAME, -SYSMETRICS_CYFRAME );
+// if (wndPtr->dwStyle & WS_BORDER)
+// InflateRect16(&rect,-SYSMETRICS_CXBORDER,-SYSMETRICS_CYBORDER);
+ if (!PtInRect16( &rect, pt ))
+ {
+ /* Check top sizing border */
+ if (pt.y < rect.top)
+ {
+ if (pt.x < rect.left+SYSMETRICS_CXSIZE) return HTTOPLEFT;
+ if (pt.x >= rect.right-SYSMETRICS_CXSIZE) return HTTOPRIGHT;
+ return HTTOP;
+ }
+ /* Check bottom sizing border */
+ if (pt.y >= rect.bottom)
+ {
+ if (pt.x < rect.left+SYSMETRICS_CXSIZE) return HTBOTTOMLEFT;
+ if (pt.x >= rect.right-SYSMETRICS_CXSIZE) return HTBOTTOMRIGHT;
+ return HTBOTTOM;
+ }
+ /* Check left sizing border */
+ if (pt.x < rect.left)
+ {
+ if (pt.y < rect.top+SYSMETRICS_CYSIZE) return HTTOPLEFT;
+ if (pt.y >= rect.bottom-SYSMETRICS_CYSIZE) return HTBOTTOMLEFT;
+ return HTLEFT;
+ }
+ /* Check right sizing border */
+ if (pt.x >= rect.right)
+ {
+ if (pt.y < rect.top+SYSMETRICS_CYSIZE) return HTTOPRIGHT;
+ if (pt.y >= rect.bottom-SYSMETRICS_CYSIZE) return HTBOTTOMRIGHT;
+ return HTRIGHT;
+ }
+ }
+ }
+ else /* No thick frame */
+ {
+ if (HAS_FIXEDFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
+ InflateRect16(&rect, -SYSMETRICS_CXDLGFRAME, -SYSMETRICS_CYDLGFRAME);
+// else if (wndPtr->dwStyle & WS_BORDER)
+// InflateRect16(&rect, -SYSMETRICS_CXBORDER, -SYSMETRICS_CYBORDER);
+ if (!PtInRect16( &rect, pt )) return HTBORDER;
+ }
+
+ /* Check caption */
+
+ if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION)
+ {
+ if (wndPtr->dwExStyle & WS_EX_TOOLWINDOW)
+ rect.top += sysMetrics[SM_CYSMCAPTION] - 1;
+ else
+ rect.top += sysMetrics[SM_CYCAPTION] - 1;
+ if (!PtInRect16( &rect, pt ))
+ {
+ /* Check system menu */
+ if ((wndPtr->dwStyle & WS_SYSMENU) &&
+ ((wndPtr->class->hIconSm) || (wndPtr->class->hIcon)))
+ rect.left += sysMetrics[SM_CYCAPTION] - 1;
+ if (pt.x < rect.left) return HTSYSMENU;
+
+ /* Check close button */
+ if (wndPtr->dwStyle & WS_SYSMENU)
+ rect.right -= sysMetrics[SM_CYCAPTION] - 1;
+ if (pt.x > rect.right) return HTCLOSE;
+
+ /* Check maximize box */
+ if (wndPtr->dwStyle & WS_MAXIMIZEBOX)
+ rect.right -= SYSMETRICS_CXSIZE + 1;
+ if (pt.x > rect.right) return HTMAXBUTTON;
+
+ /* Check minimize box */
+ if (wndPtr->dwStyle & WS_MINIMIZEBOX)
+ rect.right -= SYSMETRICS_CXSIZE + 1;
+ if (pt.x > rect.right) return HTMINBUTTON;
+ return HTCAPTION;
+ }
+ }
+ }
+
+ /* Check client area */
+
+ ScreenToClient16( wndPtr->hwndSelf, &pt );
+ GetClientRect16( wndPtr->hwndSelf, &rect );
+ if (PtInRect16( &rect, pt )) return HTCLIENT;
+
+ /* Check vertical scroll bar */
+
+ if (wndPtr->dwStyle & WS_VSCROLL)
+ {
+ rect.right += SYSMETRICS_CXVSCROLL;
+ if (PtInRect16( &rect, pt )) return HTVSCROLL;
+ }
+
+ /* Check horizontal scroll bar */
+
+ if (wndPtr->dwStyle & WS_HSCROLL)
+ {
+ rect.bottom += SYSMETRICS_CYHSCROLL;
+ if (PtInRect16( &rect, pt ))
+ {
+ /* Check size box */
+ if ((wndPtr->dwStyle & WS_VSCROLL) &&
+ (pt.x >= rect.right - SYSMETRICS_CXVSCROLL))
+ return HTSIZE;
+ return HTHSCROLL;
+ }
+ }
+
+ /* Check menu bar */
+
+ if (HAS_MENU(wndPtr))
+ {
+ if ((pt.y < 0) && (pt.x >= 0) && (pt.x < rect.right))
+ return HTMENU;
+ }
+
+ /* Should never get here */
+ return HTERROR;
+}
+
+
+/***********************************************************************
+ * NC_HandleNCHitTest
+ *
+ * Handle a WM_NCHITTEST message. Called from DefWindowProc().
+ */
+LONG
+NC_HandleNCHitTest( HWND32 hwnd , POINT16 pt)
+{
+ WND* wndPtr = WIN_FindWndPtr( hwnd );
+
+ if (!wndPtr)
+ return HTERROR;
+
+ if(TWEAK_Win95Look)
+ return NC_DoNCHitTest95 (wndPtr, pt);
+ else
+ return NC_DoNCHitTest (wndPtr, pt);
+}
+
+
+/***********************************************************************
* NC_DrawSysButton
*/
void NC_DrawSysButton( HWND32 hwnd, HDC32 hdc, BOOL32 down )
@@ -557,45 +802,83 @@
* HDC32 hdc,
* BOOL32 down )
*
- * Draws a fake Win95 system button. Horribly broken. We should be drawing
- * an icon, not the X. (This will require some thought)
- *
- * Bugs
- * Plain and simply doesn't work. Fails miserably for child windows.
+ * Draws the Win95 system icon.
*
* Revision history
* 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
* Original implementation from NC_DrawSysButton source.
+ * 11-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de)
+ * Fixed most bugs.
+ *
+ *****************************************************************************/
+
+BOOL32
+NC_DrawSysButton95 (HWND32 hwnd, HDC32 hdc, BOOL32 down)
+{
+ WND *wndPtr = WIN_FindWndPtr( hwnd );
+
+ if( !(wndPtr->flags & WIN_MANAGED) )
+ {
+ HICON32 hIcon = 0;
+ RECT32 rect;
+
+ NC_GetInsideRect95( hwnd, &rect );
+
+ if (wndPtr->class->hIconSm)
+ hIcon = wndPtr->class->hIconSm;
+ else if (wndPtr->class->hIcon)
+ hIcon = wndPtr->class->hIcon;
+
+ if (hIcon)
+ DrawIconEx32 (hdc, rect.left + 2, rect.top + 1, hIcon,
+ sysMetrics[SM_CYCAPTION] - 3,
+ sysMetrics[SM_CYCAPTION] - 3, 0, 0, DI_NORMAL);
+ return (hIcon != 0);
+ }
+ return FALSE;
+}
+
+
+/******************************************************************************
+ *
+ * void NC_DrawCloseButton95(
+ * HWND32 hwnd,
+ * HDC32 hdc,
+ * BOOL32 down )
+ *
+ * Draws the Win95 close button.
+ *
+ * Revision history
+ * 11-Jun-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de)
+ * Original implementation from NC_DrawSysButton95 source.
*
*****************************************************************************/
void
-NC_DrawSysButton95 (HWND32 hwnd, HDC32 hdc, BOOL32 down)
+NC_DrawCloseButton95 (HWND32 hwnd, HDC32 hdc, BOOL32 down)
{
RECT32 rect;
HDC32 hdcMem;
- HBITMAP32 hbitmap;
WND *wndPtr = WIN_FindWndPtr( hwnd );
if( !(wndPtr->flags & WIN_MANAGED) )
{
BITMAP32 bmp;
+ HBITMAP32 hBmp, hOldBmp;
NC_GetInsideRect95( hwnd, &rect );
- hdcMem = CreateCompatibleDC32( hdc );
- hbitmap = SelectObject32( hdcMem, hbitmapClose );
- GetObject32A (hbitmapClose, sizeof(BITMAP32), &bmp);
- BitBlt32 (hdc, rect.left + (sysMetrics[SM_CXSIZE] - bmp.bmWidth) / 2 +
- NC_SysControlNudge,
- rect.top + (sysMetrics[SM_CYSIZE] - bmp.bmHeight - 1) / 2,
- bmp.bmWidth, bmp.bmHeight,
- hdcMem, 0, 0, down ? NOTSRCCOPY : SRCCOPY );
- SelectObject32( hdcMem, hbitmap );
- DeleteDC32( hdcMem );
-
+ hdcMem = CreateCompatibleDC32( hdc );
+ hBmp = /*down ? hbitmapCloseD :*/ hbitmapClose;
+ hOldBmp = SelectObject32 (hdcMem, hBmp);
+ GetObject32A (hBmp, sizeof(BITMAP32), &bmp);
+ BitBlt32 (hdc, rect.right - (sysMetrics[SM_CYCAPTION] + 1 + bmp.bmWidth) / 2,
+ rect.top + (sysMetrics[SM_CYCAPTION] - 1 - bmp.bmHeight) / 2,
+ bmp.bmWidth, bmp.bmHeight, hdcMem, 0, 0, down ? NOTSRCCOPY : SRCCOPY);
+
+ SelectObject32 (hdcMem, hOldBmp);
+ DeleteDC32 (hdcMem);
}
- return;
}
@@ -610,9 +893,8 @@
*
* Bugs
* Many. Spacing might still be incorrect. Need to fit a close
- * button between the max button and the edge. Draws the wrong thing
- * (a Win31 up-down) when maximized. Should scale the image with the
- * title bar. And more...
+ * button between the max button and the edge.
+ * Should scale the image with the title bar. And more...
*
* Revision history
* 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
@@ -637,11 +919,13 @@
&bmsz)) {
NC_GetInsideRect95( hwnd, &rect );
+
+ if (wndPtr->dwStyle & WS_SYSMENU)
+ rect.right -= sysMetrics[SM_CYCAPTION] + 1;
- GRAPH_DrawBitmap( hdc, bm,
- rect.right + NC_MaxControlNudge -
+ GRAPH_DrawBitmap( hdc, bm, rect.right + NC_MinControlNudge -
(sysMetrics[SM_CXSIZE] + bmsz.cx) / 2,
- rect.top + (sysMetrics[SM_CYSIZE] - bmsz.cy - 1) / 2,
+ rect.top + (sysMetrics[SM_CYCAPTION] - 1 - bmsz.cy) / 2,
0, 0, bmsz.cx, bmsz.cy, FALSE );
}
@@ -684,13 +968,16 @@
NC_GetInsideRect95( hwnd, &rect );
+ if (wndPtr->dwStyle & WS_SYSMENU)
+ rect.right -= sysMetrics[SM_CYCAPTION] + 1;
+
if (wndPtr->dwStyle & WS_MAXIMIZEBOX)
rect.right += -1 + NC_MaxControlNudge -
(sysMetrics[SM_CXSIZE] + bmsz.cx) / 2;
GRAPH_DrawBitmap( hdc, bm, rect.right + NC_MinControlNudge -
(sysMetrics[SM_CXSIZE] + bmsz.cx) / 2,
- rect.top + (sysMetrics[SM_CYSIZE] - bmsz.cy - 1) / 2,
+ rect.top + (sysMetrics[SM_CYCAPTION] - 1 - bmsz.cy) / 2,
0, 0, bmsz.cx, bmsz.cy, FALSE );
}
@@ -826,8 +1113,8 @@
}
else
{
- width = sysMetrics[SM_CXFRAME] - sysMetrics[SM_CXEDGE] - 1;
- height = sysMetrics[SM_CYFRAME] - sysMetrics[SM_CYEDGE] - 1;
+ width = sysMetrics[SM_CXFRAME] - sysMetrics[SM_CXEDGE];
+ height = sysMetrics[SM_CYFRAME] - sysMetrics[SM_CYEDGE];
}
SelectObject32( hdc, GetSysColorBrush32(active ? COLOR_ACTIVEBORDER :
@@ -844,16 +1131,6 @@
-width, rect->bottom - rect->top, PATCOPY );
InflateRect32( rect, -width, -height );
-
- if(!dlgFrame) {
- /* Draw inner rectangle */
- GRAPH_DrawRectangle( hdc, rect->left, rect->top,
- rect->right - rect->left,
- rect->bottom - rect->top,
- TWEAK_PenC095 );
-
- InflateRect32( rect, -1, -1 );
- }
}
@@ -897,6 +1174,7 @@
{
if (!(hbitmapClose = LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_CLOSE) )))
return;
+ hbitmapCloseD = LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_CLOSE) );
hbitmapMinimize = LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_REDUCE) );
hbitmapMinimizeD = LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_REDUCED) );
hbitmapMaximize = LoadBitmap16( 0, MAKEINTRESOURCE16(OBM_ZOOM) );
@@ -983,11 +1261,16 @@
BOOL32 active )
{
RECT32 r = *rect;
- WND *wndPtr = WIN_FindWndPtr( hwnd );
- char buffer[256];
+ WND *wndPtr = WIN_FindWndPtr( hwnd );
+ char buffer[256];
+ POINT32 sep[2] = { { r.left, r.bottom - 1 },
+ { r.right, r.bottom - 1 } };
if (wndPtr->flags & WIN_MANAGED) return;
+ GRAPH_DrawLines( hdc, sep, 1, TWEAK_PenC095 );
+ r.bottom--;
+
FillRect32( hdc, &r, GetSysColorBrush32(active ? COLOR_ACTIVECAPTION :
COLOR_INACTIVECAPTION) );
@@ -1003,8 +1286,10 @@
}
if (style & WS_SYSMENU) {
- NC_DrawSysButton95( hwnd, hdc, FALSE );
- r.left += SYSMETRICS_CXSIZE + 1;
+ if (NC_DrawSysButton95 (hwnd, hdc, FALSE))
+ r.left += sysMetrics[SM_CYCAPTION] - 1;
+ NC_DrawCloseButton95 (hwnd, hdc, FALSE);
+ r.right -= sysMetrics[SM_CYCAPTION] - 1;
}
if (style & WS_MAXIMIZEBOX) {
NC_DrawMaxButton95( hwnd, hdc, FALSE );
@@ -1184,12 +1469,12 @@
SelectObject32( hdc, GetSysColorPen32(COLOR_WINDOWFRAME) );
if(!(wndPtr->flags & WIN_MANAGED)) {
- if((wndPtr->dwStyle & WS_BORDER) || (wndPtr->dwStyle & WS_DLGFRAME) ||
- (wndPtr->dwExStyle & WS_EX_DLGMODALFRAME)) {
+ if ((wndPtr->dwStyle & WS_BORDER) && ((wndPtr->dwStyle & WS_DLGFRAME) ||
+ (wndPtr->dwExStyle & WS_EX_DLGMODALFRAME) || (wndPtr->dwStyle & WS_THICKFRAME))) {
DrawEdge32 (hdc, &rect, EDGE_RAISED, BF_RECT | BF_ADJUST);
}
- if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
+ if (HAS_FIXEDFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
NC_DrawFrame95( hdc, &rect, TRUE, active );
else if (wndPtr->dwStyle & WS_THICKFRAME)
NC_DrawFrame95(hdc, &rect, FALSE, active );
@@ -1197,43 +1482,38 @@
if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION)
{
RECT32 r = rect;
- POINT32 sep[2] = { { rect.left,
- rect.top + sysMetrics[SM_CYCAPTION] - 2 },
- { rect.right,
- rect.top + sysMetrics[SM_CYCAPTION] - 2 } };
-
- r.bottom = rect.top + sysMetrics[SM_CYCAPTION] - 2;
- rect.top += sysMetrics[SM_CYCAPTION] - 2 + sysMetrics[SM_CYBORDER];
+ if (wndPtr->dwExStyle & WS_EX_TOOLWINDOW) {
+ r.bottom = rect.top + sysMetrics[SM_CYSMCAPTION];
+ rect.top += sysMetrics[SM_CYSMCAPTION];
+ }
+ else {
+ r.bottom = rect.top + sysMetrics[SM_CYCAPTION];
+ rect.top += sysMetrics[SM_CYCAPTION];
+ }
NC_DrawCaption95( hdc, &r, hwnd, wndPtr->dwStyle, active );
- GRAPH_DrawLines( hdc, sep, 1, TWEAK_PenC095 );
}
}
if (HAS_MENU(wndPtr))
{
RECT32 r = rect;
- r.bottom = rect.top + sysMetrics[SM_CYMENU] - sysMetrics[SM_CYBORDER];
- r.top -= sysMetrics[SM_CYBORDER];
+ r.bottom = rect.top + sysMetrics[SM_CYMENU];
TRACE(nonclient, "Calling DrawMenuBar with "
"rect (%d, %d)-(%d, %d)\n", r.left, r.top,
r.right, r.bottom);
- rect.top += MENU_DrawMenuBar( hdc, &r, hwnd, suppress_menupaint );
+ rect.top += MENU_DrawMenuBar( hdc, &r, hwnd, suppress_menupaint ) + 1;
}
TRACE(nonclient, "After MenuBar, rect is (%d, %d)-(%d, %d).\n",
rect.left, rect.top, rect.right, rect.bottom );
- /* Draw the inner frames */
- GRAPH_DrawRectangle( hdc, rect.left, rect.top, rect.right - rect.left,
- rect.bottom - rect.top, TWEAK_PenC095 );
- InflateRect32(&rect, -1, -1);
- GRAPH_DrawGenericReliefRect( hdc, &rect, 1, 1, NC_WinShadow95,
- NC_WinHighlight95 );
+ if (wndPtr->dwExStyle & WS_EX_CLIENTEDGE)
+ DrawEdge32 (hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
- InflateRect32(&rect, -1, -1);
-
+ if (wndPtr->dwExStyle & WS_EX_STATICEDGE)
+ DrawEdge32 (hdc, &rect, BDR_SUNKENOUTER, BF_RECT | BF_ADJUST);
/* Draw the scroll-bars */
@@ -1378,8 +1658,14 @@
OffsetRect32( rect, wndPtr->rectWindow.left, wndPtr->rectWindow.top);
if (wndPtr->dwStyle & WS_CHILD)
ClientToScreen32( wndPtr->parent->hwndSelf, (POINT32 *)rect );
- rect->right = rect->left + SYSMETRICS_CXSIZE;
- rect->bottom = rect->top + SYSMETRICS_CYSIZE;
+ if(TWEAK_Win95Look) {
+ rect->right = rect->left + sysMetrics[SM_CYCAPTION] - 1;
+ rect->bottom = rect->top + sysMetrics[SM_CYCAPTION] - 1;
+ }
+ else {
+ rect->right = rect->left + SYSMETRICS_CXSIZE;
+ rect->bottom = rect->top + SYSMETRICS_CYSIZE;
+ }
}
return TRUE;
}
@@ -1749,6 +2035,42 @@
/***********************************************************************
+ * NC_TrackCloseButton95
+ *
+ * Track a mouse button press on the Win95 close button.
+ */
+static void
+NC_TrackCloseButton95 (HWND32 hwnd, WORD wParam)
+{
+ MSG16 msg;
+ HDC32 hdc = GetWindowDC32( hwnd );
+ BOOL32 pressed = TRUE;
+
+ SetCapture32( hwnd );
+
+ NC_DrawCloseButton95 (hwnd, hdc, TRUE);
+
+ do
+ {
+ BOOL32 oldstate = pressed;
+ MSG_InternalGetMessage( &msg, 0, 0, 0, PM_REMOVE, FALSE );
+
+ pressed = (NC_HandleNCHitTest( hwnd, msg.pt ) == wParam);
+ if (pressed != oldstate)
+ NC_DrawCloseButton95 (hwnd, hdc, pressed);
+ } while (msg.message != WM_LBUTTONUP);
+
+ NC_DrawCloseButton95 (hwnd, hdc, FALSE);
+
+ ReleaseCapture();
+ ReleaseDC32( hwnd, hdc );
+ if (!pressed) return;
+
+ SendMessage16( hwnd, WM_SYSCOMMAND, SC_CLOSE, *(LONG*)&msg.pt );
+}
+
+
+/***********************************************************************
* NC_TrackScrollBar
*
* Track a mouse button press on the horizontal or vertical scroll-bar.
@@ -1855,6 +2177,11 @@
NC_TrackMinMaxBox( hwnd, wParam );
break;
+ case HTCLOSE:
+ if (TWEAK_Win95Look)
+ NC_TrackCloseButton95 (hwnd, wParam);
+ break;
+
case HTLEFT:
case HTRIGHT:
case HTTOP: