Commit 86a8d0f9 authored by Alexandre Julliard's avatar Alexandre Julliard

Release 0.7

Thu Jan 13 11:45:13 1994 John Richardson <jrichard@cs.uml.edu> * [window/win.c] Added functions EnableWindow, IsWindowEnabled, and helper WIN_SetSensitive. * [window/event.c] Added checks for WS_DISABLED windows in EVENT_key, EVENT_MotionNotify, EVENT_ButtonPress, EVENT_ButtonRelease, EVENT_ConfigureNotify, EVENT_FocusIn, EVENT_FocusOut, and EVENT_EnterNotify. Key and button presses beep for a disabled window. If anyone finds better places for these checks, please tell me. Jan 17, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte) * [misc/message.c] Cleanup on buttons answer value returned. * [control/combo.c] Now use OBM_COMBO bitmap dropdown button. Mon Jan 17 21:56:45 1994 Erik Bos (erik@trashcan.hacktic.nl) * [misc/comm/c] A few bugfixes. Tue Jan 18 06:36:48 1994 julliard@di.epfl.ch (Alexandre Julliard) * [loader/cursor.c] Added X cursor for IDC_SIZENS and IDC_SIZEWE. * [include/options.h] [misc/main.c] (New files) Rewrote main() function to get rid of Xt application context, and added command-line option parsing. * [objects/color.c] Use of a private map now configurable with command-line option. * [windows/defwnd.c] Added WM_SYSCOMMAND handling, and better WM_SETCURSOR handling. * [windows/event.c] Removed ConfigureNotify event handler (no longer needed). * [windows/message.c] Send WM_SETCURSOR message on mouse events. * [windows/nonclient.c] Use OEM bitmaps for the drawing of the non-client area. Added caption bar buttons handling, and moving and resizing of the window via the window frame (bypassing the window manager). * [windows/painting.c] Bug fix in BeginPaint(). * [windows/win.c] Set the override_redirect flag for windows (to bypass window manager). * [windows/winpos.c] Implemented WindowFromPoint(), ChildWindowFromPoint(), BringWindowToTop(), Get/SetInternalWindowPos(), Get/SetWindowPlacement(). Mon Jan 17 20:48:24 1994 Bob Amstadt (bob@pooh) * [memory/heap.c] Added support for multiple local heaps.
parent cdd09237
Thu Jan 13 11:45:13 1994 John Richardson <jrichard@cs.uml.edu>
* [window/win.c]
Added functions EnableWindow, IsWindowEnabled, and helper
WIN_SetSensitive.
* [window/event.c]
Added checks for WS_DISABLED windows in EVENT_key, EVENT_MotionNotify,
EVENT_ButtonPress, EVENT_ButtonRelease, EVENT_ConfigureNotify,
EVENT_FocusIn, EVENT_FocusOut, and EVENT_EnterNotify. Key and
button presses beep for a disabled window.
If anyone finds better places for these checks, please tell me.
Jan 17, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
* [misc/message.c]
Cleanup on buttons answer value returned.
* [control/combo.c]
Now use OBM_COMBO bitmap dropdown button.
Mon Jan 17 21:56:45 1994 Erik Bos (erik@trashcan.hacktic.nl)
* [misc/comm/c]
A few bugfixes.
Tue Jan 18 06:36:48 1994 julliard@di.epfl.ch (Alexandre Julliard)
* [loader/cursor.c]
Added X cursor for IDC_SIZENS and IDC_SIZEWE.
* [include/options.h] [misc/main.c] (New files)
Rewrote main() function to get rid of Xt application context,
and added command-line option parsing.
* [objects/color.c]
Use of a private map now configurable with command-line option.
* [windows/defwnd.c]
Added WM_SYSCOMMAND handling, and better WM_SETCURSOR handling.
* [windows/event.c]
Removed ConfigureNotify event handler (no longer needed).
* [windows/message.c]
Send WM_SETCURSOR message on mouse events.
* [windows/nonclient.c]
Use OEM bitmaps for the drawing of the non-client area.
Added caption bar buttons handling, and moving and resizing of
the window via the window frame (bypassing the window manager).
* [windows/painting.c]
Bug fix in BeginPaint().
* [windows/win.c]
Set the override_redirect flag for windows (to bypass window
manager).
* [windows/winpos.c]
Implemented WindowFromPoint(), ChildWindowFromPoint(),
BringWindowToTop(), Get/SetInternalWindowPos(),
Get/SetWindowPlacement().
Mon Jan 17 20:48:24 1994 Bob Amstadt (bob@pooh)
* [memory/heap.c]
Added support for multiple local heaps.
----------------------------------------------------------------------
Tue Jan 4 13:01:33 1994 David Metcalfe <david@prism.demon.co.uk>
* [window/caret.c]
......@@ -84,7 +154,6 @@ Tue Jan 11 05:27:45 1994 julliard@di.epfl.ch (Alexandre Julliard
Added sending of the WM_NCPAINT message in SetWindowPos().
Removed the Xt code.
----------------------------------------------------------------------
Sun Jan 2 12:38:53 1994 David Metcalfe <david@prism.demon.co.uk>
* [windows/class.c]
......
......@@ -8,7 +8,7 @@ LDFLAGS=
######################################################################
# These definitions are for the top level
TARGET=wine
LIBS=-L. -L/usr/X386/lib -lXext -lXaw -lXt -lXmu -lX11 -lm
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
......
......@@ -41,6 +41,12 @@ For example: to run Windows' solitaire:
Have a nice game of solitaire, but be careful. Emulation isn't perfect.
So, occassionally it will crash.
WHAT'S NEW with version 0.7: (see ChangeLog for details)
- Eliminated Xt-dependent code. Thanks to Alexandre and Martin.
- Other bug fixes.
- IsWIndowEnabled() and EnableWindow() now implemented.
- New command line options.
WHAT'S NEW with version 0.6: (see ChangeLog for details)
- Working towards elimination of Xt-dependent code. Thanks to
Alexandre and Martin.
......
CFLAGS=$(COPTS) $(DEBUGOPTS) -I$(INCLUDE_DIR)
OBJS = menu.o caption.o widgets.o button.o \
scroll.o listbox.o combo.o static.o \
SmeMenuButto.o WinLabel.o WinCommand.o \
WinMenuButto.o
scroll.o listbox.o combo.o static.o
default: controls.o
......
/*
* $XConsortium: SmeMenuButtP.h,v 1.6 89/12/11 15:20:15 kit Exp $
*
* Copyright 1989 Massachusetts Institute of Technology
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. M.I.T. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Chris D. Peterson, MIT X Consortium
*
* Modifications for Wine
*
* 8/23/93 David Metcalfe (david@prism.demon.co.uk)
* Added code to translate ampersand to underlined char
*/
/*
* SmeP.h - Private definitions for Sme object
*
*/
#ifndef _XawSmeMenuButtP_h
#define _XawSmeMenuButtP_h
/***********************************************************************
*
* Sme Object Private Data
*
***********************************************************************/
#include <X11/Xaw/SmeP.h>
#include "SmeMenuButto.h"
/************************************************************
*
* New fields for the Sme Object class record.
*
************************************************************/
typedef struct _SmeMenuButtonClassPart {
XtPointer extension;
} SmeMenuButtonClassPart;
/* Full class record declaration */
typedef struct _SmeMenuButtonClassRec {
RectObjClassPart rect_class;
SmeClassPart sme_class;
SmeMenuButtonClassPart sme_bsb_class;
} SmeMenuButtonClassRec;
extern SmeMenuButtonClassRec smeMenuButtonClassRec;
/* New fields for the Sme Object record */
typedef struct {
/* resources */
String label; /* The entry label. */
int vert_space; /* extra vert space to leave, as a percentage
of the font height of the label. */
Pixmap left_bitmap, right_bitmap; /* bitmaps to show. */
Dimension left_margin, right_margin; /* left and right margins. */
Pixel foreground; /* foreground color. */
XFontStruct * font; /* The font to show label in. */
XtJustify justify; /* Justification for the label. */
String menu_name; /* Menu to activate */
Boolean inactive; /* True if can't be selected */
/* private resources. */
Boolean set_values_area_cleared; /* Remember if we need to unhighlight. */
GC norm_gc; /* noral color gc. */
GC rev_gc; /* reverse color gc. */
GC norm_gray_gc; /* Normal color (grayed out) gc. */
GC invert_gc; /* gc for flipping colors. */
Dimension left_bitmap_width; /* size of each bitmap. */
Dimension left_bitmap_height;
Dimension right_bitmap_width;
Dimension right_bitmap_height;
int ul_pos; /* Offset in chars of underlined character */
/* in label */
} SmeMenuButtonPart;
/****************************************************************
*
* Full instance record declaration
*
****************************************************************/
typedef struct _SmeMenuButtonRec {
ObjectPart object;
RectObjPart rectangle;
SmePart sme;
SmeMenuButtonPart sme_bsb;
} SmeMenuButtonRec;
/************************************************************
*
* Private declarations.
*
************************************************************/
#endif /* _XawSmeMenuButtP_h */
/*
* $XConsortium: SmeMenuButton.h,v 1.5 89/12/11 15:20:14 kit Exp $
*
* Copyright 1989 Massachusetts Institute of Technology
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. M.I.T. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* SmeMenuButton.h - Public Header file for SmeMenuButton object.
*
* This is the public header file for the Athena BSB Sme object.
* It is intended to be used with the simple menu widget. This object
* provides bitmap - string - bitmap style entries.
*
* Date: April 3, 1989
*
* By: Chris D. Peterson
* MIT X Consortium
* kit@expo.lcs.mit.edu
*
* Modifications for Wine
*
* 8/23/93 David Metcalfe (david@prism.demon.co.uk)
* Added code to translate ampersand to underlined char
*/
#ifndef _SmeMenuButto_h
#define _SmeMenuButto_h
#include <X11/Xmu/Converters.h>
#include <X11/Xaw/Sme.h>
/****************************************************************
*
* SmeMenuButton object
*
****************************************************************/
/* BSB Menu Entry Resources:
Name Class RepType Default Value
---- ----- ------- -------------
callback Callback Callback NULL
destroyCallback Callback Pointer NULL
font Font XFontStruct * XtDefaultFont
foreground Foreground Pixel XtDefaultForeground
height Height Dimension 0
label Label String Name of entry
leftBitmap LeftBitmap Pixmap None
leftMargin HorizontalMargins Dimension 4
rightBitmap RightBitmap Pixmap None
rightMargin HorizontalMargins Dimension 4
sensitive Sensitive Boolean True
vertSpace VertSpace int 25
width Width Dimension 0
x Position Position 0n
y Position Position 0
menuName MenuName String "menu"
inactive Inactive Boolean False
*/
typedef struct _SmeMenuButtonClassRec *SmeMenuButtonObjectClass;
typedef struct _SmeMenuButtonRec *SmeMenuButtonObject;
extern WidgetClass smeMenuButtonObjectClass;
#define XtNleftBitmap "leftBitmap"
#define XtNleftMargin "leftMargin"
#define XtNrightBitmap "rightBitmap"
#define XtNrightMargin "rightMargin"
#define XtNvertSpace "vertSpace"
#define XtNmenuName "menuName"
#define XtNinactive "inactive"
#define XtCLeftBitmap "LeftBitmap"
#define XtCHorizontalMargins "HorizontalMargins"
#define XtCRightBitmap "RightBitmap"
#define XtCVertSpace "VertSpace"
#define XtCMenuName "MenuName"
#define XtCInactive "Inactive"
#endif /* _SmeMenuButto_h */
/***********************************************************
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/*
* Modifications for Wine
*
* 8/27/93 David Metcalfe (david@prism.demon.co.uk)
* Converted to WinCommand
*/
#ifndef _WinCommand_h
#define _WinCommand_h
#include "WinLabel.h"
/* Command widget resources:
Name Class RepType Default Value
---- ----- ------- -------------
accelerators Accelerators AcceleratorTable NULL
ancestorSensitive AncestorSensitive Boolean True
background Background Pixel XtDefaultBackground
backgroundPixmap Pixmap Pixmap XtUnspecifiedPixmap
bitmap Pixmap Pixmap None
borderColor BorderColor Pixel XtDefaultForeground
borderPixmap Pixmap Pixmap XtUnspecifiedPixmap
borderWidth BorderWidth Dimension 1
callback Callback XtCallbackList NULL
colormap Colormap Colormap parent's colormap
cornerRoundPercent CornerRoundPercent Dimension 25
cursor Cursor Cursor None
cursorName Cursor String NULL
depth Depth int parent's depth
destroyCallback Callback XtCallbackList NULL
encoding Encoding UnsignedChar XawTextEncoding8bit
font Font XFontStruct* XtDefaultFont
foreground Foreground Pixel XtDefaultForeground
height Height Dimension text height
highlightThickness Thickness Dimension 0 if shaped, else 2
insensitiveBorder Insensitive Pixmap Gray
internalHeight Height Dimension 2
internalWidth Width Dimension 4
justify Justify XtJustify XtJustifyCenter
label Label String NULL
leftBitmap LeftBitmap Pixmap None
mappedWhenManaged MappedWhenManaged Boolean True
pointerColor Foreground Pixel XtDefaultForeground
pointerColorBackground Background Pixel XtDefaultBackground
resize Resize Boolean True
screen Screen Screen parent's Screen
sensitive Sensitive Boolean True
shapeStyle ShapeStyle ShapeStyle Rectangle
translations Translations TranslationTable see doc or source
width Width Dimension text width
x Position Position 0
y Position Position 0
*/
#define XtNhighlightThickness "highlightThickness"
#define XtNshapeStyle "shapeStyle"
#define XtCShapeStyle "ShapeStyle"
#define XtRShapeStyle "ShapeStyle"
#define XtNcornerRoundPercent "cornerRoundPercent"
#define XtCCornerRoundPercent "CornerRoundPercent"
#define XawShapeRectangle XmuShapeRectangle
#define XawShapeOval XmuShapeOval
#define XawShapeEllipse XmuShapeEllipse
#define XawShapeRoundedRectangle XmuShapeRoundedRectangle
extern WidgetClass winCommandWidgetClass;
typedef struct _WinCommandClassRec *WinCommandWidgetClass;
typedef struct _WinCommandRec *WinCommandWidget;
#endif /* _WinCommand_h */
/* DON'T ADD STUFF AFTER THIS */
/***********************************************************
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/*
* Modifications for Wine
*
* 8/27/93 David Metcalfe (david@prism.demon.co.uk)
* Convrted to WinCommand
*/
/*
* WinCommandP.h - Private definitions for WinCommand widget
*
*/
#ifndef _WinCommandP_h
#define _WinCommandP_h
#include "WinCommand.h"
#include "WinLabelP.h"
/***********************************************************************
*
* WinCommand Widget Private Data
*
***********************************************************************/
typedef enum {
HighlightNone, /* Do not highlight. */
HighlightWhenUnset, /* Highlight only when unset, this is
to preserve current command widget
functionality. */
HighlightAlways /* Always highlight, lets the toggle widget
and other subclasses do the right thing. */
} XtCommandHighlight;
/************************************
*
* Class structure
*
***********************************/
/* New fields for the WinCommand widget class record */
typedef struct _WinCommandClass
{
int makes_compiler_happy; /* not used */
} WinCommandClassPart;
/* Full class record declaration */
typedef struct _WinCommandClassRec {
CoreClassPart core_class;
SimpleClassPart simple_class;
WinLabelClassPart winlabel_class;
WinCommandClassPart wincommand_class;
} WinCommandClassRec;
extern WinCommandClassRec winCommandClassRec;
/***************************************
*
* Instance (widget) structure
*
**************************************/
/* New fields for the WinCommand widget record */
typedef struct {
/* resources */
Dimension highlight_thickness;
XtCallbackList callbacks;
/* private state */
Pixmap gray_pixmap;
GC normal_GC;
GC inverse_GC;
Boolean set;
XtCommandHighlight highlighted;
/* more resources */
int shape_style;
Dimension corner_round;
} WinCommandPart;
/* XtEventsPtr eventTable;*/
/* Full widget declaration */
typedef struct _WinCommandRec {
CorePart core;
SimplePart simple;
WinLabelPart winlabel;
WinCommandPart wincommand;
} WinCommandRec;
#endif /* _WinCommandP_h */
/***********************************************************
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/*
* Modifications for Wine
*
* 8/23/93 David Metcalfe (david@prism.demon.co.uk)
* Added code to translate ampersand to underlined char
*
* 8/27/93 David Metcalfe (david@prism.demon.co.uk)
* Converted to WinLabel
*/
#ifndef _WinLabel_h
#define _WinLabel_h
/***********************************************************************
*
* WinLabel Widget
*
***********************************************************************/
#include <X11/Xaw/Simple.h>
/* Resources:
Name Class RepType Default Value
---- ----- ------- -------------
background Background Pixel XtDefaultBackground
bitmap Pixmap Pixmap None
border BorderColor Pixel XtDefaultForeground
borderWidth BorderWidth Dimension 1
cursor Cursor Cursor None
cursorName Cursor String NULL
destroyCallback Callback XtCallbackList NULL
encoding Encoding unsigned char XawTextEncoding8bit
font Font XFontStruct* XtDefaultFont
foreground Foreground Pixel XtDefaultForeground
height Height Dimension text height
insensitiveBorder Insensitive Pixmap Gray
internalHeight Height Dimension 2
internalWidth Width Dimension 4
justify Justify XtJustify XtJustifyCenter
label Label String NULL
leftBitmap LeftBitmap Pixmap None
mappedWhenManaged MappedWhenManaged Boolean True
pointerColor Foreground Pixel XtDefaultForeground
pointerColorBackground Background Pixel XtDefaultBackground
resize Resize Boolean True
sensitive Sensitive Boolean True
width Width Dimension text width
x Position Position 0
y Position Position 0
*/
#define XawTextEncoding8bit 0
#define XawTextEncodingChar2b 1
#define XtNleftBitmap "leftBitmap"
#define XtCLeftBitmap "LeftBitmap"
#define XtNencoding "encoding"
#define XtCEncoding "Encoding"
#ifndef _XtStringDefs_h_
#define XtNbitmap "bitmap"
#define XtNforeground "foreground"
#define XtNlabel "label"
#define XtNfont "font"
#define XtNinternalWidth "internalWidth"
#define XtNinternalHeight "internalHeight"
#define XtNresize "resize"
#define XtCResize "Resize"
#define XtCBitmap "Bitmap"
#endif
/* Class record constants */
extern WidgetClass winLabelWidgetClass;
typedef struct _WinLabelClassRec *WinLabelWidgetClass;
typedef struct _WinLabelRec *WinLabelWidget;
#endif /* _WinLabel_h */
/* DON'T ADD STUFF AFTER THIS #endif */
/***********************************************************
Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the names of Digital or MIT not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
******************************************************************/
/*
* Modifications for Wine
*
* 8/23/93 David Metcalfe (david@prism.demon.co.uk)
* Added code to translate ampersand to underlined char
*
* 8/27/93 David Metcalfe (david@prism.demon.co.uk)
* Converted to WinLabel
*/
/*
* WinLabelP.h - Private definitions for WinLabel widget
*
*/
#ifndef _WinLabelP_h
#define _WinLabelP_h
/***********************************************************************
*
* WinLabel Widget Private Data
*
***********************************************************************/
#include "WinLabel.h"
#include <X11/Xaw/SimpleP.h>
/* New fields for the WinLabel widget class record */
typedef struct {int foo;} WinLabelClassPart;
/* Full class record declaration */
typedef struct _WinLabelClassRec {
CoreClassPart core_class;
SimpleClassPart simple_class;
WinLabelClassPart winlabel_class;
} WinLabelClassRec;
extern WinLabelClassRec winLabelClassRec;
/* New fields for the WinLabel widget record */
typedef struct {
/* resources */
Pixel foreground;
XFontStruct *font;
char *label;
XtJustify justify;
Dimension internal_width;
Dimension internal_height;
Pixmap pixmap;
Boolean resize;
unsigned char encoding;
Pixmap left_bitmap;
/* private state */
GC normal_GC;
GC gray_GC;
Pixmap stipple;
Position label_x;
Position label_y;
Dimension label_width;
Dimension label_height;
Dimension label_len;
int lbm_y; /* where in label */
unsigned int lbm_width, lbm_height; /* size of pixmap */
int ul_pos; /* Offset in chars of underlined character */
/* in label */
} WinLabelPart;
/****************************************************************
*
* Full instance record declaration
*
****************************************************************/
typedef struct _WinLabelRec {
CorePart core;
SimplePart simple;
WinLabelPart winlabel;
} WinLabelRec;
#define LEFT_OFFSET(lw) ((lw)->winlabel.left_bitmap \
? (lw)->winlabel.lbm_width + \
(lw)->winlabel.internal_width \
: 0)
#endif /* _WinLabelP_h */
/*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. M.I.T. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* Modifications for Wine
*
* 8/27/93 David Metcalfe (david@prism.demon.co.uk)
* Converted to WinMenuButton
*/
/***********************************************************************
*
* WinMenuButton Widget
*
***********************************************************************/
/*
* WinMenuButtP.h - Private Header file for WinMenuButton widget.
*
* This is the private header file for the WinMenuButton widget.
* It is intended to provide an easy method of activating pulldown menus.
*
* Date: May 2, 1989
*
* By: Chris D. Peterson
* MIT X Consortium
* kit@expo.lcs.mit.edu
*/
#ifndef _WinMenuButtonP_h
#define _WinMenuButtonP_h
#include "WinMenuButto.h"
#include "WinCommandP.h"
/************************************
*
* Class structure
*
***********************************/
/* New fields for the WinMenuButton widget class record */
typedef struct _WinMenuButtonClass
{
int makes_compiler_happy; /* not used */
} WinMenuButtonClassPart;
/* Full class record declaration */
typedef struct _WinMenuButtonClassRec {
CoreClassPart core_class;
SimpleClassPart simple_class;
WinLabelClassPart winLabel_class;
WinCommandClassPart winCommand_class;
WinMenuButtonClassPart winMenuButton_class;
} WinMenuButtonClassRec;
extern WinMenuButtonClassRec winMenuButtonClassRec;
/***************************************
*
* Instance (widget) structure
*
**************************************/
/* New fields for the WinMenuButton widget record */
typedef struct {
/* resources */
String menu_name;
} WinMenuButtonPart;
/* Full widget declaration */
typedef struct _WinMenuButtonRec {
CorePart core;
SimplePart simple;
WinLabelPart winlabel;
WinCommandPart wincommand;
WinMenuButtonPart winmenu_button;
} WinMenuButtonRec;
#endif /* _WinMenuButtonP_h */
/*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. M.I.T. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
*/
/*
* Modifications for Wine
*
* 8/27/93 David Metcalfe (david@prism.demon.co.uk)
* Converted to WinMenuButton
*/
/***********************************************************************
*
* WinMenuButton Widget
*
***********************************************************************/
/*
* WinMenuButto.c - Source code for WinMenuButton widget.
*
* This is the source code for the WinMenuButton widget.
* It is intended to provide an easy method of activating pulldown menus.
*
* Date: May 2, 1989
*
* By: Chris D. Peterson
* MIT X Consortium
* kit@expo.lcs.mit.edu
*/
#include <stdio.h>
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#include <X11/Xaw/XawInit.h>
#include "WinMenuButtP.h"
static void ClassInitialize();
static void PopupMenu();
#define superclass ((WinCommandWidgetClass)&winCommandClassRec)
static char defaultTranslations[] =
"<EnterWindow>: highlight() \n\
<LeaveWindow>: reset() \n\
<BtnDown>: reset() PopupMenu() ";
/****************************************************************
*
* Full class record constant
*
****************************************************************/
/* Private Data */
#define offset(field) XtOffsetOf(WinMenuButtonRec, field)
static XtResource resources[] = {
{
XtNmenuName, XtCMenuName, XtRString, sizeof(String),
offset(winmenu_button.menu_name), XtRString, (XtPointer)"menu"},
};
#undef offset
static XtActionsRec actionsList[] =
{
{"PopupMenu", PopupMenu}
};
WinMenuButtonClassRec winMenuButtonClassRec = {
{
(WidgetClass) superclass, /* superclass */
"WinMenuButton", /* class_name */
sizeof(WinMenuButtonRec), /* size */
ClassInitialize, /* class_initialize */
NULL, /* class_part_initialize */
FALSE, /* class_inited */
NULL, /* initialize */
NULL, /* initialize_hook */
XtInheritRealize, /* realize */
actionsList, /* actions */
XtNumber(actionsList), /* num_actions */
resources, /* resources */
XtNumber(resources), /* resource_count */
NULLQUARK, /* xrm_class */
FALSE, /* compress_motion */
TRUE, /* compress_exposure */
TRUE, /* compress_enterleave */
FALSE, /* visible_interest */
NULL, /* destroy */
XtInheritResize, /* resize */
XtInheritExpose, /* expose */
NULL, /* set_values */
NULL, /* set_values_hook */
XtInheritSetValuesAlmost, /* set_values_almost */
NULL, /* get_values_hook */
NULL, /* accept_focus */
XtVersion, /* version */
NULL, /* callback_private */
defaultTranslations, /* tm_table */
XtInheritQueryGeometry, /* query_geometry */
XtInheritDisplayAccelerator, /* display_accelerator */
NULL /* extension */
}, /* CoreClass fields initialization */
{
XtInheritChangeSensitive /* change_sensitive */
}, /* SimpleClass fields initialization */
{
0, /* field not used */
}, /* WinLabelClass fields initialization */
{
0, /* field not used */
}, /* WinCommandClass fields initialization */
{
0, /* field not used */
}, /* WinMenuButtonClass fields initialization */
};
/* for public consumption */
WidgetClass winMenuButtonWidgetClass = (WidgetClass) &winMenuButtonClassRec;
/****************************************************************
*
* Private Procedures
*
****************************************************************/
static void ClassInitialize()
{
XawInitializeWidgetSet();
XtRegisterGrabAction(PopupMenu, True, ButtonPressMask | ButtonReleaseMask,
GrabModeAsync, GrabModeAsync);
}
/* ARGSUSED */
static void
PopupMenu(w, event, params, num_params)
Widget w;
XEvent * event;
String * params;
Cardinal * num_params;
{
WinMenuButtonWidget mbw = (WinMenuButtonWidget) w;
Widget menu, temp;
Arg arglist[2];
Cardinal num_args;
int menu_x, menu_y, menu_width, menu_height, button_height;
Position button_x, button_y;
temp = w;
while(temp != NULL) {
menu = XtNameToWidget(temp, mbw->winmenu_button.menu_name);
if (menu == NULL)
temp = XtParent(temp);
else
break;
}
if (menu == NULL) {
char error_buf[BUFSIZ];
sprintf(error_buf, "MenuButton: %s %s.",
"Could not find menu widget named", mbw->winmenu_button.menu_name);
XtAppWarning(XtWidgetToApplicationContext(w), error_buf);
return;
}
if (!XtIsRealized(menu))
XtRealizeWidget(menu);
menu_width = menu->core.width + 2 * menu->core.border_width;
button_height = w->core.height + 2 * w->core.border_width;
menu_height = menu->core.height + 2 * menu->core.border_width;
XtTranslateCoords(w, 0, 0, &button_x, &button_y);
menu_x = button_x;
menu_y = button_y + button_height;
if (menu_x >= 0) {
int scr_width = WidthOfScreen(XtScreen(menu));
if (menu_x + menu_width > scr_width)
menu_x = scr_width - menu_width;
}
if (menu_x < 0)
menu_x = 0;
if (menu_y >= 0) {
int scr_height = HeightOfScreen(XtScreen(menu));
if (menu_y + menu_height > scr_height)
menu_y = scr_height - menu_height;
}
if (menu_y < 0)
menu_y = 0;
num_args = 0;
XtSetArg(arglist[num_args], XtNx, menu_x); num_args++;
XtSetArg(arglist[num_args], XtNy, menu_y); num_args++;
XtSetValues(menu, arglist, num_args);
XtPopupSpringLoaded(menu);
}
/*
* Copyright 1989 Massachusetts Institute of Technology
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of M.I.T. not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. M.I.T. makes no representations about the
* suitability of this software for any purpose. It is provided "as is"
* without express or implied warranty.
*
* M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/*
* Modifications for Wine
*
* 8/23/93 David Metcalfe (david@prism.demon.co.uk)
* Converted to WinMenuButton
*/
/***********************************************************************
*
* WinMenuButton Widget
*
***********************************************************************/
/*
* WinMenuButton.h - Public Header file for WinMenuButton widget.
*
* This is the public header file for the WinMenuButton widget.
* It is intended to provide an easy method of activating pulldown menus.
*
* Date: May 2, 1989
*
* By: Chris D. Peterson
* MIT X Consortium
* kit@expo.lcs.mit.edu
*/
#ifndef _WinMenuButton_h
#define _WinMenuButton_h
#include "WinCommand.h"
/* Resources:
Name Class RepType Default Value
---- ----- ------- -------------
background Background Pixel XtDefaultBackground
bitmap Pixmap Pixmap None
border BorderColor Pixel XtDefaultForeground
borderWidth BorderWidth Dimension 1
callback Callback Pointer NULL
cursor Cursor Cursor None
destroyCallback Callback Pointer NULL
font Font XFontStruct* XtDefaultFont
foreground Foreground Pixel XtDefaultForeground
height Height Dimension text height
highlightThickness Thickness Dimension 2
insensitiveBorder Insensitive Pixmap Gray
internalHeight Height Dimension 2
internalWidth Width Dimension 4
justify Justify XtJustify XtJustifyCenter
label Label String NULL
mappedWhenManaged MappedWhenManaged Boolean True
menuName MenuName String "menu"
resize Resize Boolean True
sensitive Sensitive Boolean True
width Width Dimension text width
x Position Position 0
y Position Position 0
*/
#define XtNmenuName "menuName"
#define XtCMenuName "MenuName"
extern WidgetClass winMenuButtonWidgetClass;
typedef struct _WinMenuButtonClassRec *WinMenuButtonWidgetClass;
typedef struct _WinMenuButtonRec *WinMenuButtonWidget;
#endif /* _WinMenuButton_h -- DON'T ADD STUFF AFTER THIS */
......@@ -21,6 +21,8 @@ static char Copyright[] = "Copyright Martin Ayotte, 1993";
#include <dirent.h>
#include <sys/stat.h>
HBITMAP hComboBit = 0;
LPHEADCOMBO ComboGetStorageHeader(HWND hwnd);
int CreateComboStruct(HWND hwnd);
......@@ -37,12 +39,21 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
int AltState;
WND *wndPtr;
LPHEADCOMBO lphc;
LPDRAWITEMSTRUCT lpdis;
HDC hMemDC;
BITMAP bm;
char str[128];
PAINTSTRUCT paintstruct;
static RECT rectsel;
switch(message)
{
case WM_CREATE:
ShowScrollBar(hwnd, SB_BOTH, FALSE);
GetClientRect(hwnd, &rect);
width = rect.right - rect.left;
height = rect.bottom - rect.top;
/* SetWindowPos(hwnd, 0, 0, 0, width, 16,
SWP_NOMOVE | SWP_NOZORDER); */
CreateComboStruct(hwnd);
wndPtr = WIN_FindWndPtr(hwnd);
lphc = ComboGetStorageHeader(hwnd);
......@@ -50,10 +61,10 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
#ifdef DEBUG_COMBO
printf("Combo WM_CREATE %lX !\n", lphc);
#endif
width = wndPtr->rectClient.right - wndPtr->rectClient.left;
height = wndPtr->rectClient.bottom - wndPtr->rectClient.top;
if (hComboBit == (HBITMAP)NULL)
hComboBit = LoadBitmap((HINSTANCE)NULL, MAKEINTRESOURCE(OBM_COMBO));
lphc->hWndDrop = CreateWindow("BUTTON", "",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON,
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,
......@@ -189,6 +200,24 @@ LONG ComboBoxWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
break;
case WM_CTLCOLOR:
return(SendMessage(GetParent(hwnd), WM_CTLCOLOR, wParam, lParam));
case WM_DRAWITEM:
#ifdef DEBUG_SCROLL
printf("ComboBox WM_DRAWITEM w=%04X l=%08X\n", wParam, lParam);
#endif
lpdis = (LPDRAWITEMSTRUCT)lParam;
if (lpdis->CtlType == ODT_BUTTON && lpdis->itemAction == ODA_DRAWENTIRE) {
hMemDC = CreateCompatibleDC(lpdis->hDC);
GetObject(hComboBit, sizeof(BITMAP), (LPSTR)&bm);
SelectObject(hMemDC, hComboBit);
BitBlt(lpdis->hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
DeleteDC(hMemDC);
}
if (lpdis->CtlType == ODT_BUTTON && lpdis->itemAction == ODA_SELECT) {
CopyRect(&rect, &lpdis->rcItem);
InflateRect(&rect, -1, -1);
DrawReliefRect(lpdis->hDC, rect, 1, 1);
}
break;
case WM_PAINT:
BeginPaint( hwnd, &paintstruct );
EndPaint( hwnd, &paintstruct );
......
......@@ -9,11 +9,6 @@ static char Copyright2[] = "Copyright Martin Ayotte, 1993";
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Xaw/SmeBSB.h>
#include <X11/Xaw/SmeLine.h>
#include <X11/Xaw/SimpleMenu.h>
#include "WinMenuButto.h"
#include "SmeMenuButto.h"
#include "windows.h"
#include "menu.h"
#include "heap.h"
......
......@@ -205,7 +205,9 @@ LONG ScrollBarWndProc( HWND hwnd, WORD message, WORD wParam, LONG lParam )
if (lpdis->CtlID == 1) {
GetObject(hUpArrow, sizeof(BITMAP), (LPSTR)&bm);
SelectObject(hMemDC, hUpArrow);
BitBlt(lpdis->hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
/* BitBlt(lpdis->hDC, 0, 0, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY); */
StretchBlt(lpdis->hDC, 0, 0, lpdis->rcItem.right, lpdis->rcItem.right,
hMemDC, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
}
if (lpdis->CtlID == 2) {
GetObject(hDnArrow, sizeof(BITMAP), (LPSTR)&bm);
......
......@@ -43,9 +43,8 @@ length 490
33 pascal TextOut(word s_word s_word ptr word) TextOut(1 2 3 4 5)
34 pascal BitBlt( word s_word s_word s_word s_word word s_word s_word long)
BitBlt(1 2 3 4 5 6 7 8 9)
35 pascal StrechBlt( word s_word s_word s_word s_word word s_word s_word s_word s_word long)
StrechBlt(1 2 3 4 5 6 7 8 9 10 11)
35 pascal StretchBlt( word s_word s_word s_word s_word word s_word s_word s_word s_word long)
StretchBlt(1 2 3 4 5 6 7 8 9 10 11)
36 pascal Polygon (word ptr word) Polygon (1 2 3)
37 pascal Polyline (word ptr word) Polyline (1 2 3)
39 pascal RestoreDC(word s_word) RestoreDC(1 2)
......
......@@ -23,9 +23,12 @@ length 540
23 pascal GetFocus() GetFocus()
28 pascal ClientToScreen(word ptr) ClientToScreen(1 2)
29 pascal ScreenToClient(word ptr) ScreenToClient(1 2)
30 pascal WindowFromPoint(long) WindowFromPoint(1)
31 pascal IsIconic(word) IsIconic(1)
32 pascal GetWindowRect(word ptr) GetWindowRect(1 2)
33 pascal GetClientRect(word ptr) GetClientRect(1 2)
34 pascal EnableWindow(word word) EnableWindow(1 2)
35 pascal IsWindowEnabled(word) IsWindowEnabled(1)
36 pascal GetWindowText(word ptr word) GetWindowText(1 2 3)
37 pascal SetWindowText(word ptr) SetWindowText(1 2)
38 pascal GetWindowTextLength(word) GetWindowTextLength(1)
......@@ -36,6 +39,7 @@ length 540
42 pascal ShowWindow(word word) ShowWindow(1 2)
43 pascal CloseWindow(word) CloseWindow(1)
44 pascal OpenIcon(word) OpenIcon(1)
45 pascal BringWindowToTop(word) BringWindowToTop(1)
46 pascal GetParent(word) GetParent(1)
47 pascal IsWindow(word) IsWindow(1)
48 pascal IsChild(word word) IsChild(1 2)
......@@ -140,6 +144,7 @@ length 540
182 pascal KillSystemTimer(word word) KillSystemTimer(1 2)
183 pascal GetCaretPos(ptr) GetCaretPos(1)
190 pascal GetUpdateRect(word ptr word) GetUpdateRect(1 2 3)
191 pascal ChildWindowFromPoint(word long) ChildWindowFromPoint(1 2)
200 pascal OpenComm(ptr word word) OpenComm(1 2 3)
201 pascal SetCommState(ptr) SetCommState(1)
202 pascal GetCommState(word ptr) GetCommState(1 2)
......@@ -194,6 +199,8 @@ length 540
334 pascal GetQueueStatus(word) GetQueueStatus(1)
335 pascal GetInputState() GetInputState()
359 pascal GetDCEx(word word long) GetDCEx(1 2 3)
370 pascal GetWindowPlacement(word ptr) GetWindowPlacement(1 2)
371 pascal SetWindowPlacement(word ptr) SetWindowPlacement(1 2)
373 pascal SubtractRect(ptr ptr ptr) SubtractRect(1 2 3)
403 pascal UnregisterClass(ptr word) UnregisterClass(1 2)
404 pascal GetClassInfo(word ptr ptr) GetClassInfo(1 2 3)
......@@ -226,6 +233,9 @@ length 540
454 pascal AdjustWindowRectEx(ptr long word long) AdjustWindowRectEx(1 2 3 4)
457 pascal DestroyIcon(word) DestroyIcon(1)
458 pascal DestroyCursor(word) DestroyCursor(1)
460 pascal GetInternalWindowPos(word ptr ptr) GetInternalWindowPos(1 2 3)
461 pascal SetInternalWindowPos(word word ptr ptr) SetInternalWindowPos(1 2 3 4)
466 pascal DrawFocusRect(word ptr) DrawFocusRect(1 2)
471 pascal lstrcmpi(ptr ptr) lstrcmpi(1 2)
472 pascal AnsiNext(ptr) AnsiNext(1 )
473 pascal AnsiPrev(ptr ptr) AnsiPrev(1 2)
/*
* Command-line options.
*
* Copyright 1994 Alexandre Julliard
*/
#ifndef OPTIONS_H
#define OPTIONS_H
struct options
{
char * spyFilename;
int usePrivateMap;
int synchronous;
short cmdShow;
};
extern struct options Options;
#endif
......@@ -69,4 +69,10 @@ static __inline__ int Is16bitAddress(void *address)
return ((int) address >= (((FIRST_SELECTOR << 3) | 0x0007) << 16));
}
extern SEGDESC Segments[];
#endif /* SEGMEM_H */
......@@ -26,6 +26,9 @@ typedef struct tagWND
HANDLE hInstance; /* Window hInstance (from CreateWindow) */
RECT rectClient; /* Client area rel. to parent client area */
RECT rectWindow; /* Whole window rel. to parent client area */
RECT rectNormal; /* Window rect. when in normal state */
POINT ptIconPos; /* Icon position */
POINT ptMaxPos; /* Maximized window position */
HANDLE hmemTaskQ; /* Task queue global memory handle */
HRGN hrgnUpdate; /* Update region */
HWND hwndLastActive; /* Last active popup hwnd */
......@@ -54,6 +57,10 @@ typedef struct tagWND
#define WIN_OWN_DC 0x08 /* Win class has style CS_OWNDC */
#define WIN_CLASS_DC 0x10 /* Win class has style CS_CLASSDC */
#define WIN_DOUBLE_CLICKS 0x20 /* Win class has style CS_DBLCLKS */
#define WIN_RESTORE_MAX 0x40 /* Maximize when restoring */
/* First top-level window */
extern HWND firstWindow;
/* Window functions */
WND *WIN_FindWndPtr( HWND hwnd );
......
......@@ -111,6 +111,19 @@ typedef int *LPCATCHBUF;
#endif
*/
typedef struct { short x, y; } POINT;
typedef POINT *PPOINT;
typedef POINT *NPPOINT;
typedef POINT *LPPOINT;
typedef struct
{
short cx;
short cy;
} SIZE, *LPSIZE;
#define MAKEPOINT(l) (*((POINT *)&(l)))
#define MAKELPARAM(low, high) ((LONG)(((WORD)(low)) | \
(((DWORD)((WORD)(high))) << 16)))
......@@ -221,6 +234,21 @@ typedef struct
UINT flags;
} WINDOWPOS;
/* SetWindowPlacement() struct */
typedef struct
{
UINT length;
UINT flags;
UINT showCmd;
POINT ptMinPosition __attribute__ ((packed));
POINT ptMaxPosition __attribute__ ((packed));
RECT rcNormalPosition __attribute__ ((packed));
} WINDOWPLACEMENT, *LPWINDOWPLACEMENT;
/* WINDOWPLACEMENT flags */
#define WPF_SETMINPOSITION 0x0001
#define WPF_RESTORETOMAXIMIZED 0x0002
/* WM_NCCALCSIZE parameter structure */
typedef struct
{
......@@ -324,19 +352,6 @@ typedef struct
#define IDNO 7
typedef struct { short x, y; } POINT;
typedef POINT *PPOINT;
typedef POINT *NPPOINT;
typedef POINT *LPPOINT;
typedef struct
{
short cx;
short cy;
} SIZE, *LPSIZE;
#define MAKEPOINT(l) (*((POINT *)&(l)))
typedef struct tagMSG
{
HWND hwnd;
......@@ -2002,6 +2017,7 @@ Fa(ATOM,FindAtom,LPCSTR,a)
Fa(ATOM,GlobalAddAtom,LPCSTR,a)
Fa(ATOM,GlobalDeleteAtom,ATOM,a)
Fa(ATOM,GlobalFindAtom,LPCSTR,a)
Fa(BOOL,BringWindowToTop,HWND,a)
Fa(BOOL,DeleteDC,HDC,a)
Fa(BOOL,DeleteMetaFile,HANDLE,a)
Fa(BOOL,DeleteObject,HANDLE,a)
......@@ -2156,7 +2172,6 @@ Fa(int,ShowCursor,BOOL,a)
Fa(int,UpdateColors,HDC,a)
Fa(int,WaitSoundState,int,a)
Fa(short,GetTextCharacterExtra,HDC,a)
Fa(void,BringWindowToTop,HWND,a)
Fa(void,ClipCursor,LPRECT,a)
Fa(void,CloseWindow,HWND,a)
Fa(void,DrawMenuBar,HWND,a)
......@@ -2179,6 +2194,8 @@ Fa(void,ShowCaret,HWND,a)
Fa(void,SwapRecording,WORD,a)
Fb(BOOL,ExitWindows,DWORD,dwReserved,WORD,wReturnCode)
Fb(BOOL,GetBitmapDimensionEx,HBITMAP,a,LPSIZE,b)
Fb(BOOL,GetWindowPlacement,HWND,a,LPWINDOWPLACEMENT,b)
Fb(BOOL,SetWindowPlacement,HWND,a,LPWINDOWPLACEMENT,b)
Fb(BOOL,ShowWindow,HWND,a,int,b)
Fb(HDC,BeginPaint,HWND,a,LPPAINTSTRUCT,b)
Fb(LPSTR,lstrcat,LPSTR,a,LPCSTR,b )
......@@ -2270,6 +2287,12 @@ Fb(WORD,IsDlgButtonChecked,HWND,a,WORD,b)
Fb(WORD,LocalShrink,HANDLE,a,WORD,b)
Fb(WORD,MapVirtualKey,WORD,a,WORD,b)
Fb(WORD,SetSystemPaletteUse,HDC,a,WORD,b)
Fb(WORD,SetBkMode,HDC,a,WORD,b)
Fb(WORD,SetMapMode,HDC,a,WORD,b)
Fb(WORD,SetPolyFillMode,HDC,a,WORD,b)
Fb(WORD,SetRelAbs,HDC,a,WORD,b)
Fb(WORD,SetROP2,HDC,a,WORD,b)
Fb(WORD,SetStretchBltMode,HDC,a,WORD,b)
Fb(WORD,SetTaskQueue,HANDLE,a,HANDLE,b)
Fb(WORD,SetTextAlign,HDC,a,WORD,b)
Fb(WORD,SizeofResource,HANDLE,a,HANDLE,b)
......@@ -2317,6 +2340,7 @@ Fb(void,Throw,LPCATCHBUF,a,int,b)
Fb(void,ValidateRect,HWND,a,LPRECT,b)
Fb(void,ValidateRgn,HWND,a,HRGN,b)
Fc(BOOL,LineTo,HDC,a,short,b,short,c)
Fc(WORD,GetInternalWindowPos,HWND,a,LPRECT,b,LPPOINT,c)
Fc(LONG,_llseek,int,a,long,b,int,c)
Fc(WORD,_lread,int,a,LPSTR,b,int,c)
Fc(WORD,_lwrite,int,a,LPSTR,b,int,c)
......@@ -2378,12 +2402,6 @@ Fc(WORD,GetProfileInt,LPSTR,a,LPSTR,b,int,c)
Fc(WORD,GlobalGetAtomName,ATOM,a,LPSTR,b,short,c)
Fc(WORD,SetClassWord,HWND,a,short,b,WORD,c)
Fc(WORD,SetWindowWord,HWND,a,short,b,WORD,c)
Fb(WORD,SetBkMode,HDC,a,WORD,b)
Fb(WORD,SetMapMode,HDC,a,WORD,b)
Fb(WORD,SetPolyFillMode,HDC,a,WORD,b)
Fb(WORD,SetRelAbs,HDC,a,WORD,b)
Fb(WORD,SetROP2,HDC,a,WORD,b)
Fb(WORD,SetStretchBltMode,HDC,a,WORD,b)
Fc(int,FrameRect,HDC,a,LPRECT,b,HBRUSH,c)
Fc(int,GetClassName,HWND,a,LPSTR,b,short,c)
Fc(int,GetClipboardFormatName,WORD,a,LPSTR,b,int,c)
......@@ -2479,6 +2497,7 @@ Fd(void,FillWindow,HWND,a,HWND,b,HDC,c,HBRUSH,d)
Fd(void,GetScrollRange,HWND,a,int,b,LPINT,c,LPINT,d)
Fd(void,MapWindowPoints,HWND,a,HWND,b,LPPOINT,c,WORD,d)
Fd(void,PlayMetaFileRecord,HDC,a,LPHANDLETABLE,b,LPMETARECORD,c,WORD,d)
Fd(void,SetInternalWindowPos,HWND,a,WORD,b,LPRECT,c,LPPOINT,d)
Fd(void,SetDlgItemInt,HWND,a,WORD,b,WORD,c,BOOL,d)
Fe(BOOL,Rectangle,HDC,a,int,xLeft,int,yTop,int,xRight,int,yBottom)
Fe(int,DrawText,HDC,a,LPSTR,str,int,c,LPRECT,d,WORD,flag)
......
......@@ -77,6 +77,14 @@ HCURSOR LoadCursor(HANDLE instance, LPSTR cursor_name)
lpcur->xcursor = XCreateFontCursor(XT_display, XC_watch);
GlobalUnlock(hCursor);
return hCursor;
case IDC_SIZENS:
lpcur->xcursor = XCreateFontCursor(XT_display, XC_sb_v_double_arrow);
GlobalUnlock(hCursor);
return hCursor;
case IDC_SIZEWE:
lpcur->xcursor = XCreateFontCursor(XT_display, XC_sb_h_double_arrow);
GlobalUnlock(hCursor);
return hCursor;
default:
break;
}
......
......@@ -62,6 +62,35 @@ extern int Argc;
* FindUnusedSelector
*/
int
FindUnusedSelectors(int n_selectors)
{
int i;
int n_found;
n_found = 0;
for (i = LastUsedSelector + 1; i != LastUsedSelector; i++)
{
if (i >= MAX_SELECTORS)
{
n_found = 0;
i = FIRST_SELECTOR;
}
if (!SelectorMap[i] && ++n_found == n_selectors)
break;
}
if (i == LastUsedSelector)
return 0;
LastUsedSelector = i;
return i - n_selectors + 1;
}
/**********************************************************************
* FindUnusedSelector
*/
int
FindUnusedSelector(void)
{
int i;
......@@ -728,6 +757,7 @@ CreateSelectors(struct w_files * wpnt)
int i;
int status;
int old_length, file_image_length;
int saved_old_length;
/*
* Allocate memory for the table to keep track of all selectors.
......@@ -828,14 +858,18 @@ CreateSelectors(struct w_files * wpnt)
if (i + 1 == ne_header->auto_data_seg)
{
auto_data_sel = s->selector;
HEAP_LocalInit(s->base_addr + old_length,
ne_header->local_heap_length);
saved_old_length = old_length;
}
}
s = selectors;
for (i = 0; i < ne_header->n_segment_tab; i++, s++)
{
Segments[s->selector >> 3].owner = auto_data_sel;
if (s->selector == auto_data_sel)
HEAP_LocalInit(auto_data_sel, s->base_addr + saved_old_length,
ne_header->local_heap_length);
}
if(!EnvironmentSelector) {
EnvironmentSelector = CreateEnvironment();
......
......@@ -6,8 +6,16 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include "prototypes.h"
#include "segmem.h"
#include "heap.h"
#include "regfunc.h"
MDESC *LOCAL_FreeList;
typedef struct heap_local_heap_s
{
struct heap_local_heap_s *next;
MDESC *free_list;
unsigned short selector;
} LHEAP;
LHEAP *LocalHeaps = NULL;
/**********************************************************************
* HEAP_Init
......@@ -274,12 +282,49 @@ HEAP_Free(MDESC **free_list, void *block)
}
/**********************************************************************
* HEAP_LocalFindHeap
*/
MDESC **
HEAP_LocalFindHeap(unsigned short owner)
{
LHEAP *lh;
#ifdef DEBUG_HEAP
printf("HEAP_LocalFindHeap: owner %04x\n", owner);
#endif
for (lh = LocalHeaps; lh != NULL; lh = lh->next)
{
if (lh->selector == owner)
return &lh->free_list;
}
return NULL;
}
#define LOCALHEAP() HEAP_LocalFindHeap(Segments[Stack16Frame[11] >> 3].owner)
/**********************************************************************
* HEAP_LocalInit
*/
void
HEAP_LocalInit(void *start, int length)
HEAP_LocalInit(unsigned short owner, void *start, int length)
{
HEAP_Init(&LOCAL_FreeList, start, length);
LHEAP *lh;
#ifdef DEBUG_HEAP
printf("HEAP_LocalInit: owner %04x, start %08x, length %04x\n",
owner, start, length);
#endif
lh = (LHEAP *) malloc(sizeof(*lh));
if (lh == NULL)
return;
lh->selector = owner;
lh->next = LocalHeaps;
HEAP_Init(&lh->free_list, start, length);
LocalHeaps = lh;
}
/**********************************************************************
......@@ -292,9 +337,10 @@ LocalAlloc(int flags, int bytes)
#ifdef DEBUG_HEAP
printf("LocalAlloc: flags %x, bytes %d\n", flags, bytes);
printf(" called from segment %04x\n", Stack16Frame[11]);
#endif
m = HEAP_Alloc(&LOCAL_FreeList, flags, bytes);
m = HEAP_Alloc(LOCALHEAP(), flags, bytes);
#ifdef DEBUG_HEAP
printf("LocalAlloc: returning %x\n", (int) m);
......@@ -312,7 +358,7 @@ LocalCompact(int min_free)
int max_block;
max_block = 0;
for (m = LOCAL_FreeList; m != NULL; m = m->next)
for (m = *LOCALHEAP(); m != NULL; m = m->next)
if (m->length > max_block)
max_block = m->length;
......@@ -327,7 +373,7 @@ LocalFlags(unsigned int handle)
{
MDESC *m;
m = (MDESC *) (((int) LOCAL_FreeList & 0xffff0000) |
m = (MDESC *) (((int) *LOCALHEAP() & 0xffff0000) |
(handle & 0xffff)) - 1;
if (m->next != m || m->prev != m)
return 0;
......@@ -343,8 +389,8 @@ LocalFree(unsigned int handle)
{
unsigned int addr;
addr = ((int) LOCAL_FreeList & 0xffff0000) | (handle & 0xffff);
if (HEAP_Free(&LOCAL_FreeList, (void *) addr) < 0)
addr = ((int) *LOCALHEAP() & 0xffff0000) | (handle & 0xffff);
if (HEAP_Free(LOCALHEAP(), (void *) addr) < 0)
return handle;
else
return 0;
......@@ -356,7 +402,7 @@ LocalFree(unsigned int handle)
unsigned int
LocalInit(unsigned int segment, unsigned int start, unsigned int end)
{
HEAP_Init(&LOCAL_FreeList,
HEAP_Init(LOCALHEAP(),
(void *) ((segment << 16) | start), end - start + 1);
return segment;
......@@ -370,7 +416,7 @@ LocalLock(unsigned int handle)
{
MDESC *m;
m = (MDESC *) (((int) LOCAL_FreeList & 0xffff0000) |
m = (MDESC *) (((int) *LOCALHEAP() & 0xffff0000) |
(handle & 0xffff)) - 1;
if (m->next != m || m->prev != m)
return 0;
......@@ -387,8 +433,8 @@ LocalReAlloc(unsigned int handle, int flags, int bytes)
{
void *m;
m = HEAP_ReAlloc(&LOCAL_FreeList, (void *)
(((int) LOCAL_FreeList & 0xffff0000) | (handle & 0xffff)),
m = HEAP_ReAlloc(LOCALHEAP(), (void *)
(((int) *LOCALHEAP() & 0xffff0000) | (handle & 0xffff)),
bytes, flags);
return m;
......@@ -402,7 +448,7 @@ LocalSize(unsigned int handle)
{
MDESC *m;
m = (MDESC *) (((int) LOCAL_FreeList & 0xffff0000) |
m = (MDESC *) (((int) *LOCALHEAP() & 0xffff0000) |
(handle & 0xffff)) - 1;
if (m->next != m || m->prev != m)
return 0;
......@@ -418,7 +464,7 @@ LocalUnlock(unsigned int handle)
{
MDESC *m;
m = (MDESC *) (((int) LOCAL_FreeList & 0xffff0000) |
m = (MDESC *) (((int) *LOCALHEAP() & 0xffff0000) |
(handle & 0xffff)) - 1;
if (m->next != m || m->prev != m)
return 1;
......
CFLAGS=$(COPTS) $(DEBUGOPTS) -I../include
OBJS=kernel.o user.o xt.o rect.o file.o sound.o emulate.o \
OBJS=main.o kernel.o user.o rect.o file.o sound.o emulate.o \
keyboard.o profile.o lstr.o exec.o message.o int1a.o int21.o \
dos_fs.o comm.o spy.o
......
......@@ -25,6 +25,8 @@ struct DosDeviceStruct {
char *devicename; /* /dev/cua1 */
int fd;
int suspended;
int unget;
int unget_byte;
};
struct DosDeviceStruct COM[MAX_PORTS];
......@@ -83,15 +85,6 @@ void Comm_Init(void)
}
atexit(Comm_DeInit);
#ifdef DEBUG_COMM
for (x=0; x!=MAX_PORTS; x++) {
if (COM[x].devicename)
fprintf(stderr, "comm: COM%d = %s\n", x, COM[x].devicename);
if (LPT[x].devicename)
fprintf(stderr, "comm: LPT%d = %s\n", x, LPT[x].devicename);
}
#endif
}
void Comm_DeInit(void)
......@@ -103,13 +96,11 @@ void Comm_DeInit(void)
if (COM[x].devicename) {
if (COM[x].fd)
close(COM[x].fd);
fprintf(stderr, "comm: COM%d = %s\n",x,COM[x].devicename);
free(COM[x].devicename);
}
if (LPT[x].devicename) {
if (LPT[x].fd)
close(LPT[x].fd);
fprintf(stderr, "comm: LPT%d = %s\n",x,LPT[x].devicename);
free(LPT[x].devicename);
}
}
......@@ -799,7 +790,6 @@ int UngetCommChar(int fd, char chUnget)
#ifdef DEBUG_COMM
fprintf(stderr,"UngetCommChar: fd %d (char %d)\n", fd, chUnget);
#endif
fprintf(stderr,"NOT implemented!\n");
if ((ptr = GetDeviceStruct(fd)) == NULL) {
commerror = IE_BADID;
......@@ -811,16 +801,22 @@ fprintf(stderr,"UngetCommChar: fd %d (char %d)\n", fd, chUnget);
return -1;
}
ptr->unget = 1;
ptr->unget_byte = chUnget;
commerror = 0;
return 0;
}
int ReadComm(int fd, LPSTR lpvBuf, int cbRead)
{
int status, length;
struct DosDeviceStruct *ptr;
#ifdef DEBUG_COMM
fprintf(stderr,"ReadComm: fd %d, ptr %d, length %d\n", fd, lpvBuf, cbRead);
#endif
if ((ptr = GetDeviceStruct(fd)) == NULL) {
commerror = IE_BADID;
return -1;
......@@ -831,18 +827,29 @@ fprintf(stderr,"ReadComm: fd %d, ptr %d, length %d\n", fd, lpvBuf, cbRead);
return -1;
}
if (read(fd, (void *) lpvBuf, cbRead) == -1) {
if (ptr->unget) {
*lpvBuf = ptr->unget_byte;
lpvBuf++;
ptr->unget = 0;
length = 1;
} else
length = 0;
status = read(fd, (void *) lpvBuf, cbRead);
if (status == -1) {
commerror = WinError();
return -1;
return -1 - length;
} else {
commerror = 0;
return 0;
return length + status;
}
}
int WriteComm(int fd, LPSTR lpvBuf, int cbWrite)
{
int x;
int x, length;
struct DosDeviceStruct *ptr;
#ifdef DEBUG_COMM
......@@ -859,14 +866,18 @@ fprintf(stderr,"WriteComm: fd %d, ptr %d, length %d\n", fd, lpvBuf, cbWrite);
return -1;
}
#ifdef DEBUG_COMM
for (x=0; x != cbWrite ; x++)
fprintf(stderr,"%c", *(lpvBuf + x) );
#endif
if (write(fd, (void *) lpvBuf, cbWrite) == -1) {
length = write(fd, (void *) lpvBuf, cbWrite);
if (length == -1) {
commerror = WinError();
return -1;
} else {
commerror = 0;
return 0;
return length;
}
}
......@@ -338,8 +338,9 @@ char *GetDirectUnixFileName(char *dosfilename)
{
/* a:\windows\system.ini => /dos/windows/system.ini */
static char temp[256];
int drive;
char x, temp[256];
char x;
if (dosfilename[1] == ':')
{
......
......@@ -73,7 +73,7 @@ BOOL WinHelp(HWND hWnd, LPSTR lpHelpFile, WORD wCommand, DWORD dwData)
case 0:
printf("New process started !\n");
ArgV[0] = "wine";
ArgV[1] = "/C:/windows/winhelp.exe";
ArgV[1] = "winhelp.exe";
ArgV[2] = lpHelpFile;
switch (wCommand) {
case HELP_CONTEXT:
......@@ -99,5 +99,3 @@ BOOL WinHelp(HWND hWnd, LPSTR lpHelpFile, WORD wCommand, DWORD dwData)
}
return(TRUE);
}
......@@ -5,6 +5,7 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#include <stdlib.h>
#include "prototypes.h"
#include "regfunc.h"
#include "options.h"
extern unsigned short WIN_StackSize;
......@@ -48,7 +49,7 @@ KERNEL_InitTask()
_BX = 0x81;
_AX = 1;
_CX = WIN_StackSize;
_DX = 1;
_DX = Options.cmdShow;
_SI = 0;
ReturnFromRegisterFunc();
/* Function does not return */
......
/*
* Main function.
*
* Copyright 1994 Alexandre Julliard
*/
static char Copyright[] = "Copyright Alexandre Julliard, 1994";
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xresource.h>
#include "windows.h"
#include "options.h"
Display * XT_display; /* To be removed */
Screen * XT_screen; /* To be removed */
Display * display;
Screen * screen;
struct options Options =
{ /* default options */
NULL, /* spyFilename */
FALSE, /* usePrivateMap */
FALSE, /* synchronous */
SW_SHOWNORMAL /* cmdShow */
};
static XrmOptionDescRec optionsTable[] =
{
{ "-display", ".display", XrmoptionSepArg, (caddr_t)NULL },
{ "-iconic", ".iconic", XrmoptionNoArg, (caddr_t)"on" },
{ "-privatemap", ".privatemap", XrmoptionNoArg, (caddr_t)"on" },
{ "-synchronous", ".synchronous", XrmoptionNoArg, (caddr_t)"on" },
{ "-spy", ".spy", XrmoptionSepArg, (caddr_t)NULL }
};
#define NB_OPTIONS (sizeof(optionsTable) / sizeof(optionsTable[0]))
/***********************************************************************
* MAIN_Usage
*/
static void MAIN_Usage( char *name )
{
fprintf( stderr,"Usage: %s [-display name] [-iconic] [-privatemap]\n"
" [-synchronous] [-spy file] program [arguments]\n",
name );
exit(1);
}
/***********************************************************************
* MAIN_ParseOptions
*
* Parse command line options and open display.
*/
static void MAIN_ParseOptions( int *argc, char *argv[] )
{
char *dummy, *display_name;
XrmValue value;
XrmDatabase db = NULL;
XrmParseCommand( &db, optionsTable, NB_OPTIONS, "wine", argc, argv );
if (*argc < 2) MAIN_Usage( argv[0] );
if (XrmGetResource( db, "wine.display", "Wine.display", &dummy, &value ))
display_name = value.addr;
else display_name = NULL;
if (!(display = XOpenDisplay( display_name )))
{
fprintf( stderr, "%s: Can't open display: %s\n",
argv[0], display_name ? display_name : "" );
exit(1);
}
if (XrmGetResource(db,"wine.iconic","Wine.iconic",&dummy,&value))
Options.cmdShow = SW_SHOWMINIMIZED;
if (XrmGetResource(db,"wine.privatemap","Wine.privatemap",&dummy,&value))
Options.usePrivateMap = TRUE;
if (XrmGetResource(db,"wine.synchronous","Wine.synchronous",&dummy,&value))
Options.synchronous = TRUE;
if (XrmGetResource(db,"wine.spy","Wine.spy",&dummy,&value))
Options.spyFilename = value.addr;
}
/***********************************************************************
* main
*/
int main( int argc, char *argv[] )
{
XrmInitialize();
MAIN_ParseOptions( &argc, argv );
screen = DefaultScreenOfDisplay( display );
XT_display = display;
XT_screen = screen;
if (Options.synchronous) XSynchronize( display, True );
DOS_InitFS();
Comm_Init();
return _WinMain( argc, argv );
}
/***********************************************************************
* MessageBeep (USER.104)
*/
void MessageBeep( WORD i )
{
XBell( display, 100 );
}
......@@ -108,6 +108,9 @@ LONG SystemMessageBoxProc(HWND hWnd, WORD message, WORD wParam, LONG lParam)
int x;
switch(message) {
case WM_CREATE:
#ifdef DEBUG_MSGBOX
printf("MessageBox WM_CREATE !\n");
#endif
wndPtr = WIN_FindWndPtr(hWnd);
createStruct = (CREATESTRUCT *)lParam;
lpmbInit = (LPMSGBOX)createStruct->lpCreateParams;
......@@ -122,55 +125,55 @@ LONG SystemMessageBoxProc(HWND hWnd, WORD message, WORD wParam, LONG lParam)
lpmb->hWndYes = CreateWindow("BUTTON", "&Ok",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON,
rect.right / 2 - 30, rect.bottom - 25,
60, 18, hWnd, 1, wndPtr->hInstance, 0L);
60, 18, hWnd, IDOK, wndPtr->hInstance, 0L);
break;
case MB_OKCANCEL :
lpmb->hWndYes = CreateWindow("BUTTON", "&Ok",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON,
rect.right / 2 - 65, rect.bottom - 25,
60, 18, hWnd, 1, wndPtr->hInstance, 0L);
60, 18, hWnd, IDOK, wndPtr->hInstance, 0L);
lpmb->hWndCancel = CreateWindow("BUTTON", "&Cancel",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON,
rect.right / 2 + 5, rect.bottom - 25,
60, 18, hWnd, 2, wndPtr->hInstance, 0L);
60, 18, hWnd, IDCANCEL, wndPtr->hInstance, 0L);
break;
case MB_ABORTRETRYIGNORE :
lpmb->hWndYes = CreateWindow("BUTTON", "&Retry",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON,
rect.right / 2 - 100, rect.bottom - 25,
60, 18, hWnd, 1, wndPtr->hInstance, 0L);
60, 18, hWnd, IDRETRY, wndPtr->hInstance, 0L);
lpmb->hWndNo = CreateWindow("BUTTON", "&Ignore",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON,
rect.right / 2 - 30, rect.bottom - 25,
60, 18, hWnd, 2, wndPtr->hInstance, 0L);
60, 18, hWnd, IDIGNORE, wndPtr->hInstance, 0L);
lpmb->hWndCancel = CreateWindow("BUTTON", "&Abort",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON,
rect.right / 2 + 40, rect.bottom - 25,
60, 18, hWnd, 3, wndPtr->hInstance, 0L);
60, 18, hWnd, IDABORT, wndPtr->hInstance, 0L);
break;
case MB_YESNO :
lpmb->hWndYes = CreateWindow("BUTTON", "&Yes",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON,
rect.right / 2 - 65, rect.bottom - 25,
60, 18, hWnd, 1, wndPtr->hInstance, 0L);
60, 18, hWnd, IDYES, wndPtr->hInstance, 0L);
lpmb->hWndNo = CreateWindow("BUTTON", "&No",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON,
rect.right / 2 + 5, rect.bottom - 25,
60, 18, hWnd, 2, wndPtr->hInstance, 0L);
60, 18, hWnd, IDNO, wndPtr->hInstance, 0L);
break;
case MB_YESNOCANCEL :
lpmb->hWndYes = CreateWindow("BUTTON", "&Yes",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON,
rect.right / 2 - 100, rect.bottom - 25,
60, 18, hWnd, 1, wndPtr->hInstance, 0L);
60, 18, hWnd, IDYES, wndPtr->hInstance, 0L);
lpmb->hWndNo = CreateWindow("BUTTON", "&No",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON,
rect.right / 2 - 30, rect.bottom - 25,
60, 18, hWnd, 2, wndPtr->hInstance, 0L);
60, 18, hWnd, IDNO, wndPtr->hInstance, 0L);
lpmb->hWndCancel = CreateWindow("BUTTON", "&Cancel",
WS_CHILD | WS_CLIPCHILDREN | WS_VISIBLE | BS_PUSHBUTTON,
rect.right / 2 + 40, rect.bottom - 25,
60, 18, hWnd, 3, wndPtr->hInstance, 0L);
60, 18, hWnd, IDCANCEL, wndPtr->hInstance, 0L);
break;
}
switch(lpmb->wType & MB_ICONMASK) {
......@@ -199,6 +202,9 @@ LONG SystemMessageBoxProc(HWND hWnd, WORD message, WORD wParam, LONG lParam)
}
break;
case WM_PAINT:
#ifdef DEBUG_MSGBOX
printf("MessageBox WM_PAINT !\n");
#endif
lpmb = MsgBoxGetStorageHeader(hWnd);
CopyRect(&rect, &lpmb->rectStr);
hDC = BeginPaint(hWnd, &ps);
......@@ -224,71 +230,67 @@ LONG SystemMessageBoxProc(HWND hWnd, WORD message, WORD wParam, LONG lParam)
break;
case WM_COMMAND:
lpmb = MsgBoxGetStorageHeader(hWnd);
switch(wParam) {
case 1:
lpmb->wRetVal = IDOK;
if (wParam < IDOK || wParam > IDNO) return(0);
lpmb->wRetVal = wParam;
#ifdef DEBUG_MSGBOX
printf("MessageBox sending WM_CLOSE !\n");
#endif
PostMessage(hWnd, WM_CLOSE, 0, 0L);
break;
case 2:
wndPtr = WIN_FindWndPtr(hWnd);
hDC = GetDC(hWnd);
/*
for (x = 1; x < 50; x++) {
hBitMap = LoadBitmap(wndPtr->hInstance, MAKEINTRESOURCE(x));
GetObject(hBitMap, sizeof(BITMAP), (LPSTR)&bm);
hMemDC = CreateCompatibleDC(hDC);
SelectObject(hMemDC, hBitMap);
printf(" bm.bmWidth=%d bm.bmHeight=%d\n",
bm.bmWidth, bm.bmHeight);
BitBlt(hDC, x * 20, 30, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
DeleteDC(hMemDC);
default:
return DefWindowProc(hWnd, message, wParam, lParam );
}
*/
hBitMap = LoadBitmap((HINSTANCE)NULL, "WINELOGO");
GetObject(hBitMap, sizeof(BITMAP), (LPSTR)&bm);
printf("bm.bmWidth=%d bm.bmHeight=%d\n",
bm.bmWidth, bm.bmHeight);
return(0);
}
/*************************************************************************
* "About Wine..." Dialog Box
*/
BOOL FAR PASCAL AboutWine_Proc(HWND hDlg, WORD msg, WORD wParam, LONG lParam)
{
HDC hDC;
HDC hMemDC;
PAINTSTRUCT ps;
int OldBackMode;
HFONT hOldFont;
RECT rect;
BITMAP bm;
char C[80];
int X;
static HBITMAP hBitMap;
switch (msg) {
case WM_INITDIALOG:
strcpy(C, "WINELOGO");
hBitMap = LoadBitmap((HINSTANCE)NULL, (LPSTR)C);
return TRUE;
case WM_PAINT:
hDC = BeginPaint(hDlg, &ps);
GetClientRect(hDlg, &rect);
FillRect(hDC, &rect, GetStockObject(GRAY_BRUSH));
InflateRect(&rect, -3, -3);
FrameRect(hDC, &rect, GetStockObject(BLACK_BRUSH));
InflateRect(&rect, -10, -10);
hMemDC = CreateCompatibleDC(hDC);
SelectObject(hMemDC, hBitMap);
BitBlt(hDC, 100, 30, bm.bmWidth, bm.bmHeight, hMemDC, 0, 0, SRCCOPY);
GetObject(hBitMap, sizeof(BITMAP), (LPSTR)&bm);
BitBlt(hDC, rect.left, rect.top, bm.bmWidth, bm.bmHeight,
hMemDC, 0, 0, SRCCOPY);
DeleteDC(hMemDC);
ReleaseDC(hWnd, hDC);
lpmb->wRetVal = IDCANCEL;
/*
SetWindowPos(lpmb->hWndNo, (HWND)NULL, 20, 20, 0, 0,
SWP_NOSIZE | SWP_NOZORDER);
*/
return 0;
break;
case 3:
hDC = GetDC(hWnd);
hInst2 = LoadImage("ev3lite.exe");
printf("hInst2=%04X\n", hInst2);
hIcon = LoadIcon(hInst2, "EV3LITE");
DrawIcon(hDC, 20, 20, hIcon);
DestroyIcon(hIcon);
hInst2 = LoadImage("moricons.dll");
printf("hInst2=%04X\n", hInst2);
hIcon = LoadIcon(hInst2, MAKEINTRESOURCE(1));
/* hIcon = LoadIcon(hInst2, "WINEICON"); */
DrawIcon(hDC, 60, 20, hIcon);
DestroyIcon(hIcon);
hIcon = LoadIcon((HINSTANCE)NULL, IDI_EXCLAMATION);
DrawIcon(hDC, 1000, 20, hIcon);
DestroyIcon(hIcon);
ReleaseDC(hWnd, hDC);
lpmb->wRetVal = IDIGNORE;
return(0);
break;
EndPaint(hDlg, &ps);
return TRUE;
case WM_COMMAND:
switch (wParam)
{
case IDOK:
CloseDLG: EndDialog(hDlg, TRUE);
return TRUE;
default:
return(0);
return TRUE;
}
CloseWindow(hWnd);
break;
default:
return DefWindowProc(hWnd, message, wParam, lParam );
}
return(0);
return FALSE;
}
......@@ -5,9 +5,12 @@
#include <stdlib.h>
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Xresource.h>
#include "wineopts.h"
#include "windows.h"
#include "wine.h"
#include "options.h"
#ifndef NOSPY
......@@ -245,8 +248,13 @@ void SpyInit(void)
if (SpyFp == NULL)
return;
if (Options.spyFilename == NULL)
{
GetPrivateProfileString("spy", "file", "", filename, sizeof(filename),
WINE_INI);
}
else
strncpy(filename, Options.spyFilename, 100);
if (strcasecmp(filename, "CON") == 0)
SpyFp = stdout;
......
/*
* X toolkit functions
*
* Copyright 1993 Alexandre Julliard
*/
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <sys/param.h>
#include <sys/times.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Core.h>
#include <X11/Shell.h>
#include "windows.h"
#ifdef __NetBSD__
#define HZ 100
#endif
Display * XT_display;
Screen * XT_screen;
Display * display;
Screen * screen;
XtAppContext XT_app_context;
static Widget topLevelWidget;
/***********************************************************************
* main
*/
void main(int argc, char **argv)
{
topLevelWidget = XtVaAppInitialize(&XT_app_context,
"XWine", /* Application class */
NULL, 0, /* Option list */
&argc, argv, /* Command line args */
NULL, /* Fallback resources */
NULL );
XT_display = XtDisplay( topLevelWidget );
XT_screen = XtScreen( topLevelWidget );
display = XtDisplay( topLevelWidget );
screen = XtScreen( topLevelWidget );
DOS_InitFS();
Comm_Init();
_WinMain( argc, argv );
}
/********************************************************************
*
* Miscellaneous partially implemented functions.
*
*/
void MessageBeep( WORD i )
{
XBell(XT_display, 100);
}
/***********************************************************************
* GetTickCount (USER.13)
*/
DWORD GetTickCount()
{
struct tms dummy;
return (times(&dummy) * 1000) / HZ;
}
......@@ -113,9 +113,9 @@ BOOL BitBlt( HDC hdcDest, short xDest, short yDest, short width, short height,
/***********************************************************************
* StrechBlt (GDI.35)
* StretchBlt (GDI.35)
*/
BOOL StrechBlt( HDC hdcDest, short xDest, short yDest, short widthDest, short heightDest,
BOOL StretchBlt( HDC hdcDest, short xDest, short yDest, short widthDest, short heightDest,
HDC hdcSrc, short xSrc, short ySrc, short widthSrc, short heightSrc, DWORD rop )
{
int xs1, xs2, ys1, ys2;
......@@ -124,7 +124,7 @@ BOOL StrechBlt( HDC hdcDest, short xDest, short yDest, short widthDest, short he
/*#ifdef DEBUG_GDI */
printf( "StrechBlt: %d %d,%d %dx%d %d %d,%d %dx%d %08x\n",
printf( "StretchBlt: %d %d,%d %dx%d %d %d,%d %dx%d %08x\n",
hdcDest, xDest, yDest, widthDest, heightDest, hdcSrc, xSrc,
ySrc, widthSrc, heightSrc, rop );
/*#endif */
......
......@@ -10,17 +10,12 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include <X11/Xlib.h>
#include "windows.h"
#include "options.h"
extern Display * XT_display;
extern Screen * XT_screen;
extern Display * display;
extern Screen * screen;
/*
* We try to use a private color map if possible, because Windows programs
* assume that palette(0) == Black and palette(max-1) == White.
*/
#undef USE_PRIVATE_MAP
Colormap COLOR_WinColormap = 0;
......@@ -55,10 +50,10 @@ static int COLOR_FillDefaultMap()
for (i = 0; i < NB_SYS_COLORS; i++)
{
if (XParseColor( XT_display, DefaultColormapOfScreen( XT_screen ),
if (XParseColor( display, DefaultColormapOfScreen( screen ),
SysColors[i], &color ))
{
if (XAllocColor( XT_display, DefaultColormapOfScreen( XT_screen ),
if (XAllocColor( display, DefaultColormapOfScreen( screen ),
&color ))
total++;
}
......@@ -72,8 +67,6 @@ static int COLOR_FillDefaultMap()
*
* Fill the private colormap.
*/
#ifdef USE_PRIVATE_MAP
static BOOL COLOR_BuildMap( Colormap map, int depth, int size )
{
XColor color;
......@@ -99,7 +92,7 @@ static BOOL COLOR_BuildMap( Colormap map, int depth, int size )
color.red = r;
color.green = g;
color.blue = b;
XStoreColor( XT_display, map, &color );
XStoreColor( display, map, &color );
}
}
......@@ -107,46 +100,47 @@ static BOOL COLOR_BuildMap( Colormap map, int depth, int size )
for (i = 0; i < NB_SYS_COLORS; i++)
{
if (!XParseColor( XT_display, map, SysColors[i], &color ))
if (!XParseColor( display, map, SysColors[i], &color ))
color.red = color.green = color.blue = color.flags = 0;
if (i < NB_SYS_COLORS/2) color.pixel = i;
else color.pixel = (1 << depth) - NB_SYS_COLORS + i;
if (color.pixel < size) XStoreColor( XT_display, map, &color );
if (color.pixel < size) XStoreColor( display, map, &color );
}
return TRUE;
}
#endif /* USE_PRIVATE_MAP */
/***********************************************************************
* COLOR_Init
*/
BOOL COLOR_Init()
{
Visual * visual = DefaultVisual( XT_display, DefaultScreen(XT_display) );
Visual * visual = DefaultVisual( display, DefaultScreen(display) );
switch(visual->class)
{
case GrayScale:
case PseudoColor:
case DirectColor:
#ifdef USE_PRIVATE_MAP
COLOR_WinColormap = XCreateColormap( XT_display,
DefaultRootWindow(XT_display),
if (Options.usePrivateMap)
{
COLOR_WinColormap = XCreateColormap( display,
DefaultRootWindow(display),
visual, AllocAll );
if (COLOR_WinColormap)
{
COLOR_BuildMap(COLOR_WinColormap,
DefaultDepth(XT_display, DefaultScreen(XT_display)),
DefaultDepth(display, DefaultScreen(display)),
visual->map_entries );
else COLOR_FillDefaultMap();
break;
#endif /* USE_PRIVATE_MAP */
}
}
/* Fall through */
case StaticGray:
case StaticColor:
case TrueColor:
COLOR_FillDefaultMap();
COLOR_WinColormap = DefaultColormapOfScreen( XT_screen );
COLOR_WinColormap = DefaultColormapOfScreen( screen );
break;
}
return TRUE;
......
......@@ -12,12 +12,15 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "class.h"
#include "user.h"
extern Display * display;
extern LONG NC_HandleNCPaint( HWND hwnd, HRGN hrgn );
extern LONG NC_HandleNCCalcSize( HWND hwnd, NCCALCSIZE_PARAMS *params );
extern LONG NC_HandleNCHitTest( HWND hwnd, POINT pt );
extern LONG NC_HandleNCMouseMsg(HWND hwnd, WORD msg, WORD wParam, LONG lParam);
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 );
/***********************************************************************
......@@ -28,7 +31,6 @@ LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
CLASS * classPtr;
LPSTR textPtr;
int len;
int tempwidth, tempheight;
WND * wndPtr = WIN_FindWndPtr( hwnd );
#ifdef DEBUG_MESSAGE
......@@ -63,10 +65,16 @@ LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
return NC_HandleNCHitTest( hwnd, MAKEPOINT(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_HandleNCMouseMsg( hwnd, msg, wParam, lParam );
return NC_HandleNCMouseMove( hwnd, wParam, MAKEPOINT(lParam) );
case WM_NCDESTROY:
{
......@@ -170,32 +178,18 @@ LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
strlen((LPSTR)lParam) + 1);
textPtr = (LPSTR)USER_HEAP_ADDR(wndPtr->hText);
strcpy(textPtr, (LPSTR)lParam);
XStoreName( display, wndPtr->window, textPtr );
return (0L);
}
case WM_SETCURSOR:
if (wndPtr->hCursor != (HCURSOR)NULL)
SetCursor(wndPtr->hCursor);
return 0L;
if (wndPtr->dwStyle & WS_CHILD)
if (SendMessage(wndPtr->hwndParent, WM_SETCURSOR, wParam, lParam))
return TRUE;
return NC_HandleSetCursor( hwnd, wParam, lParam );
case WM_SYSCOMMAND:
switch (wParam)
{
case SC_CLOSE:
ShowWindow(hwnd, SW_MINIMIZE);
printf("defdwndproc WM_SYSCOMMAND SC_CLOSE !\n");
return SendMessage( hwnd, WM_CLOSE, 0, 0 );
case SC_RESTORE:
ShowWindow(hwnd, SW_RESTORE);
break;
case SC_MINIMIZE:
ShowWindow(hwnd, SW_MINIMIZE);
printf("defdwndproc WM_SYSCOMMAND SC_MINIMIZE !\n");
break;
case SC_MAXIMIZE:
ShowWindow(hwnd, SW_MAXIMIZE);
break;
}
break;
return NC_HandleSysCommand( hwnd, wParam, MAKEPOINT(lParam) );
case WM_SYSKEYDOWN:
if (wParam == VK_MENU) {
printf("VK_MENU Pressed // hMenu=%04X !\n", GetMenu(hwnd));
......
......@@ -117,7 +117,6 @@ static void EVENT_EnterNotify( HWND hwnd, XCrossingEvent *event );
static void EVENT_FocusIn( HWND hwnd, XFocusChangeEvent *event );
static void EVENT_FocusOut( HWND hwnd, XFocusChangeEvent *event );
static void EVENT_Expose( HWND hwnd, XExposeEvent *event );
static void EVENT_ConfigureNotify( HWND hwnd, XConfigureEvent *event );
/***********************************************************************
......@@ -172,10 +171,6 @@ void EVENT_ProcessEvent( XEvent *event )
EVENT_Expose( hwnd, (XExposeEvent*)event );
break;
case ConfigureNotify:
EVENT_ConfigureNotify( hwnd, (XConfigureEvent*)event );
break;
#ifdef DEBUG_EVENT
default:
printf( "Unprocessed event %s for hwnd %d\n",
......@@ -257,6 +252,12 @@ static void EVENT_key( HWND hwnd, XKeyEvent *event )
keysym, count, Str[0], Str);
#endif
if (wndPtr->dwStyle & WS_DISABLED) {
if (event->type == KeyPress) XBell(display, 0);
return;
}
xkey = LOWORD(keysym);
key_type = HIBYTE(xkey);
key = LOBYTE(xkey);
......@@ -358,6 +359,14 @@ static void EVENT_key( HWND hwnd, XKeyEvent *event )
*/
static void EVENT_MotionNotify( HWND hwnd, XMotionEvent *event )
{
WND * wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return;
if (wndPtr->dwStyle & WS_DISABLED) {
return;
}
hardware_event( hwnd, WM_MOUSEMOVE,
EVENT_XStateToKeyState( event->state ), 0L,
event->x_root & 0xffff, event->y_root & 0xffff,
......@@ -373,6 +382,18 @@ static void EVENT_ButtonPress( HWND hwnd, XButtonEvent *event )
static WORD messages[NB_BUTTONS] =
{ WM_LBUTTONDOWN, WM_MBUTTONDOWN, WM_RBUTTONDOWN };
int buttonNum = event->button - 1;
WND * wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) {
printf("couldn't find window\n");
return;
}
if (wndPtr->dwStyle & WS_DISABLED) {
XBell(display, 0);
return;
}
if (buttonNum >= NB_BUTTONS) return;
winHasCursor = event->window;
......@@ -391,6 +412,13 @@ static void EVENT_ButtonRelease( HWND hwnd, XButtonEvent *event )
static const WORD messages[NB_BUTTONS] =
{ WM_LBUTTONUP, WM_MBUTTONUP, WM_RBUTTONUP };
int buttonNum = event->button - 1;
WND * wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return;
if (wndPtr->dwStyle & WS_DISABLED) {
return;
}
if (buttonNum >= NB_BUTTONS) return;
winHasCursor = event->window;
......@@ -401,42 +429,20 @@ static void EVENT_ButtonRelease( HWND hwnd, XButtonEvent *event )
}
/***********************************************************************
* EVENT_ConfigureNotify
/**********************************************************************
* EVENT_FocusIn
*/
static void EVENT_ConfigureNotify( HWND hwnd, XConfigureEvent *event )
static void EVENT_FocusIn( HWND hwnd, XFocusChangeEvent *event )
{
HANDLE handle;
NCCALCSIZE_PARAMS *params;
WND * wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return;
wndPtr->rectWindow.left = event->x;
wndPtr->rectWindow.top = event->y;
wndPtr->rectWindow.right = event->x + event->width;
wndPtr->rectWindow.bottom = event->y + event->height;
/* Send WM_NCCALCSIZE message */
handle = GlobalAlloc( GMEM_MOVEABLE, sizeof(*params) );
params = (NCCALCSIZE_PARAMS *)GlobalLock( handle );
params->rgrc[0] = wndPtr->rectWindow;
params->lppos = NULL; /* Should be WINDOWPOS struct */
SendMessage( hwnd, WM_NCCALCSIZE, FALSE, (LPARAM)params );
wndPtr->rectClient = params->rgrc[0];
PostMessage( hwnd, WM_MOVE, 0,
MAKELONG( wndPtr->rectClient.left, wndPtr->rectClient.top ));
PostMessage( hwnd, WM_SIZE, SIZE_RESTORED,
MAKELONG( wndPtr->rectClient.right-wndPtr->rectClient.left,
wndPtr->rectClient.bottom-wndPtr->rectClient.top) );
GlobalUnlock( handle );
GlobalFree( handle );
}
if (wndPtr->dwStyle & WS_DISABLED) {
return;
}
/**********************************************************************
* EVENT_FocusIn
*/
static void EVENT_FocusIn( HWND hwnd, XFocusChangeEvent *event )
{
PostMessage( hwnd, WM_SETFOCUS, hwnd, 0 );
hWndFocus = hwnd;
}
......@@ -447,6 +453,14 @@ 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 (wndPtr->dwStyle & WS_DISABLED) {
return;
}
if (hWndFocus)
{
PostMessage( hwnd, WM_KILLFOCUS, hwnd, 0 );
......@@ -460,9 +474,20 @@ static void EVENT_FocusOut( HWND hwnd, XFocusChangeEvent *event )
*/
static void EVENT_EnterNotify( HWND hwnd, XCrossingEvent *event )
{
WND * wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return;
if (wndPtr->dwStyle & WS_DISABLED) {
return;
}
if (captureWnd != 0) return;
winHasCursor = event->window;
PostMessage( hwnd, WM_SETCURSOR, hwnd, 0 );
/* Simulate a mouse motion to set the correct cursor */
hardware_event( hwnd, WM_MOUSEMOVE,
EVENT_XStateToKeyState( event->state ), 0L,
event->x_root & 0xffff, event->y_root & 0xffff,
event->time, 0 );
}
......
......@@ -382,7 +382,7 @@ BOOL FillRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush )
/***********************************************************************
* DrawFocusRect (GDI.466)
* DrawFocusRect (USER.466)
*/
void DrawFocusRect( HDC hdc, LPRECT rc )
{
......
......@@ -196,10 +196,11 @@ static void MSG_RemoveMsg( MESSAGEQUEUE * msgQueue, int pos )
*
* Translate an mouse hardware event into a real mouse message.
* Actions performed:
* - Translate button down messages in double-clicks.
* - Translate button-down messages in double-clicks.
* - Send the WM_NCHITTEST message to find where the cursor is.
* - Translate the message into a non-client message, or translate
* the coordinates to client coordinates.
* - Send the WM_SETCURSOR message.
*/
static void MSG_TranslateMouseMsg( MSG *msg )
{
......@@ -209,6 +210,8 @@ static void MSG_TranslateMouseMsg( MSG *msg )
LONG hittest_result = SendMessage( msg->hwnd, WM_NCHITTEST, 0,
MAKELONG( msg->pt.x, msg->pt.y ) );
SendMessage( msg->hwnd, WM_SETCURSOR, msg->hwnd,
MAKELONG( hittest_result, msg->message ));
if ((msg->message == WM_LBUTTONDOWN) ||
(msg->message == WM_RBUTTONDOWN) ||
......@@ -697,3 +700,13 @@ WORD RegisterWindowMessage( LPCSTR str )
return GlobalAddAtom( str );
}
/***********************************************************************
* GetTickCount (USER.13)
*/
DWORD GetTickCount()
{
struct timeval t;
gettimeofday( &t, NULL );
return (t.tv_sec * 1000) + (t.tv_usec / 1000);
}
......@@ -33,13 +33,14 @@ HDC BeginPaint( HWND hwnd, LPPAINTSTRUCT lps )
if (wndPtr->hrgnUpdate)
{
DeleteObject( wndPtr->hrgnUpdate );
wndPtr->hrgnUpdate = 0;
MSG_DecPaintCount( wndPtr->hmemTaskQ );
}
wndPtr->flags &= ~WIN_NEEDS_BEGINPAINT;
SendMessage( hwnd, WM_NCPAINT, hrgnUpdate, 0 );
if (hrgnUpdate) DeleteObject( hrgnUpdate );
if (!(wndPtr->flags & WIN_ERASE_UPDATERGN)) lps->fErase = TRUE;
else lps->fErase = !SendMessage( hwnd, WM_ERASEBKGND, lps->hdc, 0 );
......
......@@ -22,7 +22,7 @@ extern Colormap COLOR_WinColormap;
extern void EVENT_RegisterWindow( Window w, HWND hwnd ); /* event.c */
static HWND firstWindow = 0;
HWND firstWindow = 0;
/***********************************************************************
* WIN_FindWndPtr
......@@ -240,6 +240,11 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
wndPtr->rectWindow.right = x + width;
wndPtr->rectWindow.bottom = y + height;
wndPtr->rectClient = wndPtr->rectWindow;
wndPtr->rectNormal = wndPtr->rectWindow;
wndPtr->ptIconPos.x = -1;
wndPtr->ptIconPos.y = -1;
wndPtr->ptMaxPos.x = -1;
wndPtr->ptMaxPos.y = -1;
wndPtr->hmemTaskQ = GetTaskQueue(0);
wndPtr->hrgnUpdate = 0;
wndPtr->hwndLastActive = 0;
......@@ -282,9 +287,8 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
win_attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask |
PointerMotionMask | ButtonPressMask |
ButtonReleaseMask | StructureNotifyMask |
FocusChangeMask | EnterWindowMask;
win_attr.override_redirect = /*True*/ False;
ButtonReleaseMask | FocusChangeMask | EnterWindowMask;
win_attr.override_redirect = True;
win_attr.colormap = COLOR_WinColormap;
if (style & WS_CHILD)
{
......@@ -360,12 +364,14 @@ 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);
}
#endif
if (((style & WS_CHILD) != WS_CHILD) && (wndPtr->wIDmenu != 0)) {
lpbar = (LPPOPUPMENU) GlobalLock(wndPtr->wIDmenu);
if (lpbar != NULL) {
......@@ -434,6 +440,7 @@ BOOL DestroyWindow( HWND hwnd )
/* Destroy the window */
wndPtr->dwMagic = 0; /* Mark it as invalid */
XDestroyWindow( display, wndPtr->window );
if (wndPtr->flags & WIN_OWN_DC) DCE_FreeDCE( wndPtr->hdce );
classPtr->cWindows--;
......@@ -555,6 +562,86 @@ WORD SetWindowWord( HWND hwnd, short offset, WORD newval )
}
/*******************************************************************
* WIN_SetSensitive
*
* sets hWnd and all children to the same sensitivity
*
* sets hWnd sensitive and then calls SetSensitive on hWnd's child
* and all of hWnd's child's Next windows
*/
static BOOL WIN_SetSensitive(HWND hWnd, BOOL fEnable)
{
WND *wndPtr;
HWND hwnd;
printf("in SetSenitive\n");
if (!hWnd) return 0;
if (!(wndPtr = WIN_FindWndPtr(hWnd))) return 0;
if (fEnable) {
wndPtr->dwStyle &= ~WS_DISABLED;
} else {
wndPtr->dwStyle |= WS_DISABLED;
}
hwnd=wndPtr->hwndChild;
while (hwnd) { /* mk next child sens */
WIN_SetSensitive(hwnd, fEnable);
if ( !(wndPtr=WIN_FindWndPtr(hwnd)) ) return 0;
hwnd=wndPtr->hwndNext;
}
return 1;
}
/*******************************************************************
* EnableWindow (USER.34)
*
*
*/
BOOL EnableWindow(HWND hWnd, BOOL fEnable)
{
WND *wndPtr;
int eprev;
if (hWnd == 0) return 0;
wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr == 0) return 0;
eprev = ! (wndPtr->dwStyle & WS_DISABLED);
if (fEnable != eprev) { /* change req */
printf("changing window\n");
WIN_SetSensitive(hWnd, fEnable);
SendMessage(hWnd, WM_ENABLE, (WORD)fEnable, 0);
}
return !eprev;
}
/***********************************************************************
* IsWindowEnabled (USER.35)
*/
BOOL IsWindowEnabled(HWND hWnd)
{
WND * wndPtr;
if (hWnd == 0) return 0;
wndPtr = WIN_FindWndPtr(hWnd);
if (wndPtr == 0) return 0;
return !(wndPtr->dwStyle & WS_DISABLED);
}
/**********************************************************************
* GetWindowLong (USER.135)
*/
......
......@@ -60,6 +60,44 @@ void ScreenToClient( HWND hwnd, LPPOINT lppnt )
/*******************************************************************
* WindowFromPoint (USER.30)
*/
HWND WindowFromPoint( POINT pt )
{
RECT rect;
HWND hwnd = firstWindow;
while (hwnd)
{
GetWindowRect( hwnd, &rect );
if (PtInRect( &rect, pt )) return hwnd;
hwnd = GetWindow( hwnd, GW_HWNDNEXT );
}
return 0;
}
/*******************************************************************
* ChildWindowFromPoint (USER.191)
*/
HWND ChildWindowFromPoint( HWND hwndParent, POINT pt )
{
RECT rect;
HWND hwnd;
GetWindowRect( hwndParent, &rect );
if (!PtInRect( &rect, pt )) return 0;
hwnd = GetTopWindow( hwndParent );
while (hwnd)
{
GetWindowRect( hwnd, &rect );
if (PtInRect( &rect, pt )) return hwnd;
hwnd = GetWindow( hwnd, GW_HWNDNEXT );
}
return 0;
}
/*******************************************************************
* MapWindowPoints (USER.258)
*/
void MapWindowPoints( HWND hwndFrom, HWND hwndTo, LPPOINT lppt, WORD count )
......@@ -119,6 +157,15 @@ BOOL IsZoomed(HWND hWnd)
/***********************************************************************
* BringWindowToTop (USER.45)
*/
BOOL BringWindowToTop( HWND hwnd )
{
return SetWindowPos( hwnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE );
}
/***********************************************************************
* MoveWindow (USER.56)
*/
BOOL MoveWindow( HWND hwnd, short x, short y, short cx, short cy, BOOL repaint)
......@@ -196,6 +243,75 @@ BOOL ShowWindow( HWND hwnd, int cmd )
/***********************************************************************
* GetInternalWindowPos (USER.460)
*/
WORD GetInternalWindowPos( HWND hwnd, LPRECT rectWnd, LPPOINT ptIcon )
{
WINDOWPLACEMENT wndpl;
if (!GetWindowPlacement( hwnd, &wndpl )) return 0;
if (rectWnd) *rectWnd = wndpl.rcNormalPosition;
if (ptIcon) *ptIcon = wndpl.ptMinPosition;
return wndpl.showCmd;
}
/***********************************************************************
* SetInternalWindowPos (USER.461)
*/
void SetInternalWindowPos( HWND hwnd, WORD showCmd, LPRECT rect, LPPOINT pt )
{
WINDOWPLACEMENT wndpl;
WND *wndPtr = WIN_FindWndPtr( hwnd );
wndpl.length = sizeof(wndpl);
wndpl.flags = (pt != NULL) ? WPF_SETMINPOSITION : 0;
wndpl.showCmd = showCmd;
if (pt) wndpl.ptMinPosition = *pt;
wndpl.rcNormalPosition = (rect != NULL) ? *rect : wndPtr->rectNormal;
wndpl.ptMaxPosition = wndPtr->ptMaxPos;
SetWindowPlacement( hwnd, &wndpl );
}
/***********************************************************************
* GetWindowPlacement (USER.370)
*/
BOOL GetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *wndpl )
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return FALSE;
wndpl->length = sizeof(*wndpl);
wndpl->flags = 0;
wndpl->showCmd = IsZoomed(hwnd) ? SW_SHOWMAXIMIZED :
(IsIconic(hwnd) ? SW_SHOWMINIMIZED : SW_SHOWNORMAL);
wndpl->ptMinPosition = wndPtr->ptIconPos;
wndpl->ptMaxPosition = wndPtr->ptMaxPos;
wndpl->rcNormalPosition = wndPtr->rectNormal;
return TRUE;
}
/***********************************************************************
* SetWindowPlacement (USER.371)
*/
BOOL SetWindowPlacement( HWND hwnd, WINDOWPLACEMENT *wndpl )
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return FALSE;
if (wndpl->flags & WPF_SETMINPOSITION)
wndPtr->ptIconPos = wndpl->ptMinPosition;
if ((wndpl->flags & WPF_RESTORETOMAXIMIZED) &&
(wndpl->showCmd == SW_SHOWMINIMIZED)) wndPtr->flags |= WIN_RESTORE_MAX;
wndPtr->ptMaxPos = wndpl->ptMaxPosition;
wndPtr->rectNormal = wndpl->rcNormalPosition;
ShowWindow( hwnd, wndpl->showCmd );
return TRUE;
}
/***********************************************************************
* SetWindowPos (USER.232)
*/
/* Unimplemented flags: SWP_NOREDRAW, SWP_NOACTIVATE
......
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