Commit 940d58c2 authored by Alexandre Julliard's avatar Alexandre Julliard

Release 940912

Thu Aug 25 15:24:36 EDT 1994 <jrichard@cs.uml.edu> * [include/win.h] Removed seperate X window for icon, added icon width,height. * [include/windows.h] Commented out the old SW_xxx emum and added defines since they aren't enumerated. * [windows/dce.c] Removed some older IsIconic checks from GetDCEx(), functionality is now in nonclient and generic wine window handling code. Lots of thanks to Alexandre Julliard all the hints and help... * [windows/defwnd.c] Removed call to NC_HandleNCPaintIcon() under case WM_PAINTICON, WM_PAINTICON now calls NC_HandleNCPaint. * [windows/event.c] Removed IsIconic checks. * [windows/icon.c] Removed everything in this file for now... could be used later. Icon functionality is now handled by the generic wine windows handling functions. * [windows/mdi.c] Added a ShowWindow in MDIRestoreChild(). MDI child windows now show up when deiconified. Removed IsIconic checks. * [windows/message.c] Removed old icon routines from hardware_event(). * [windows/nonclient.c] Changed NC_HandleNCCalcSize() so it doesn't change the size of an icon window. Made NC_InternalNCHitTest() on an Iconic window always return HTCAPTION. Made NC_HandleNCLButtonDblClk() on an Iconic window always send a SC_RESTORE message. * [windows/painting.c] Changed RedrawWindow() so it doesn't redraw an iconic window unless it has to (no icon for this class). * [windows/win.c] Removed creation of seperate icon window from CreateWindowEx(). * [windows/winpos.c] Added saving and restoring of window rectangle during iconification/deiconification to ShowWindow(). Added functions to recursively hide and show children... called by ShowWindow during iconification/deiconification. Sat, 27 Aug 1994 18:47:34 +0100 (MET DST) micky@marie.physik.tu-berlin.de (Michael Patra) * [windows/message.c] WaitMessage(): Fixed handling of wm_timer-messages * [miscemu/int21.c] FindNextFCB(): Rewritten to support other functions than just returning the volume label * [misc/file.c] OpenFile(): Fix in handling of OF_CREATE Wed Aug 24 19:40:42 PDT 1994 Andrew Lagodzinski (andrew@netcom.com) * [if1632/user.spec] Added SetParent. * [windows/win.c] Added SetParent. Fri Aug 19 16:37:00 1994 Thomas Sandford <t.d.g.sandford@bradford.ac.uk> * [loader/selector.c] Many changes throughout file to correct handling of shared memory function return codes. FreeBSD and SunOS shm functions return -1 not 0 on error. If Linux is different, these changes will have to be backed out. CleanupSelectors(): this is a new (internal) call to free up all selectors (and shm handles/memory) for use on exit. * [include/segmem.h] Change comment to reflect new use of shm_key * [misc/main.c] called_at_exit(): add call to CleanupSelectors() Mon Aug 22 18:19:25 1994 Alexandre Julliard (julliard@lamisun.epfl.ch) * [controls/button.c] Use OBM_CHECKBOXES to draw check boxes with correct colors. Fixed bug with WM_SETTEXT handling. A few drawing optimisations. * [controls/menu.c] Implemented correct \t and \a handling in menu items. Implemented help items (flush right) on menu bar. Added WM_ENTERMENULOOP and WM_EXITMENULOOP messages. * [controls/static.c] Fixed SS_ICON controls and implemented STM_SETICON message handling. * [controls/widget.c] Set cursor to IDC_ARROW for built-in classes. * [include/options.h] [misc/main.c] Backing store is now off by default. * [objects/region.c] Use X regions for rectangle and polygon regions: *major* speed improvement. * [windows/dialog.c] Fixed the fix for integer ids in controls. SS_ICON controls in dialogs should work now. Implemented DS_ABSALIGN style. * [windows/graphics.c] Implemented InvertRgn(). New internal function GRAPH_DrawBitmap() to draw bitmaps faster than with CreateCompatibleDC() + BitBlt(). * [windows/message.c] Determining the window for a mouse message is now done at GetMessage() time. Modified PeekMessage() handling to avoid needlessly flushing the output queue. * [windows/timer.c] Check for restart of a timer (SetTimer call with the same hwnd and id than an existing timer).
parent 3f2abfaa
----------------------------------------------------------------------
Thu Aug 25 15:24:36 EDT 1994 <jrichard@cs.uml.edu>
* [include/win.h]
Removed seperate X window for icon, added icon width,height.
* [include/windows.h]
Commented out the old SW_xxx emum and added defines since
they aren't enumerated.
* [windows/dce.c]
Removed some older IsIconic checks from GetDCEx(), functionality
is now in nonclient and generic wine window handling code.
Lots of thanks to Alexandre Julliard all the hints and
help...
* [windows/defwnd.c]
Removed call to NC_HandleNCPaintIcon() under case WM_PAINTICON,
WM_PAINTICON now calls NC_HandleNCPaint.
* [windows/event.c]
Removed IsIconic checks.
* [windows/icon.c]
Removed everything in this file for now... could be used later.
Icon functionality is now handled by the generic wine windows
handling functions.
* [windows/mdi.c]
Added a ShowWindow in MDIRestoreChild(). MDI child windows now
show up when deiconified. Removed IsIconic checks.
* [windows/message.c]
Removed old icon routines from hardware_event().
* [windows/nonclient.c]
Changed NC_HandleNCCalcSize() so it doesn't change the size
of an icon window. Made NC_InternalNCHitTest() on an Iconic
window always return HTCAPTION. Made NC_HandleNCLButtonDblClk()
on an Iconic window always send a SC_RESTORE message.
* [windows/painting.c]
Changed RedrawWindow() so it doesn't redraw an iconic window
unless it has to (no icon for this class).
* [windows/win.c]
Removed creation of seperate icon window from CreateWindowEx().
* [windows/winpos.c]
Added saving and restoring of window rectangle during
iconification/deiconification to ShowWindow(). Added
functions to recursively hide and show children... called
by ShowWindow during iconification/deiconification.
Sat, 27 Aug 1994 18:47:34 +0100 (MET DST) micky@marie.physik.tu-berlin.de (Michael Patra)
* [windows/message.c]
WaitMessage(): Fixed handling of wm_timer-messages
* [miscemu/int21.c]
FindNextFCB(): Rewritten to support other functions than just
returning the volume label
* [misc/file.c]
OpenFile(): Fix in handling of OF_CREATE
Wed Aug 24 19:40:42 PDT 1994 Andrew Lagodzinski (andrew@netcom.com)
* [if1632/user.spec]
Added SetParent.
* [windows/win.c]
Added SetParent.
Fri Aug 19 16:37:00 1994 Thomas Sandford <t.d.g.sandford@bradford.ac.uk>
* [loader/selector.c]
Many changes throughout file to correct handling of shared memory
function return codes. FreeBSD and SunOS shm functions return
-1 not 0 on error. If Linux is different, these changes
will have to be backed out.
CleanupSelectors(): this is a new (internal) call to free
up all selectors (and shm handles/memory) for use on exit.
* [include/segmem.h]
Change comment to reflect new use of shm_key
* [misc/main.c]
called_at_exit(): add call to CleanupSelectors()
Mon Aug 22 18:19:25 1994 Alexandre Julliard (julliard@lamisun.epfl.ch)
* [controls/button.c]
Use OBM_CHECKBOXES to draw check boxes with correct colors.
Fixed bug with WM_SETTEXT handling.
A few drawing optimisations.
* [controls/menu.c]
Implemented correct \t and \a handling in menu items.
Implemented help items (flush right) on menu bar.
Added WM_ENTERMENULOOP and WM_EXITMENULOOP messages.
* [controls/static.c]
Fixed SS_ICON controls and implemented STM_SETICON message
handling.
* [controls/widget.c]
Set cursor to IDC_ARROW for built-in classes.
* [include/options.h] [misc/main.c]
Backing store is now off by default.
* [objects/region.c]
Use X regions for rectangle and polygon regions: *major* speed
improvement.
* [windows/dialog.c]
Fixed the fix for integer ids in controls. SS_ICON controls in
dialogs should work now.
Implemented DS_ABSALIGN style.
* [windows/graphics.c]
Implemented InvertRgn().
New internal function GRAPH_DrawBitmap() to draw bitmaps faster
than with CreateCompatibleDC() + BitBlt().
* [windows/message.c]
Determining the window for a mouse message is now done at
GetMessage() time.
Modified PeekMessage() handling to avoid needlessly flushing the
output queue.
* [windows/timer.c]
Check for restart of a timer (SetTimer call with the same hwnd and
id than an existing timer).
----------------------------------------------------------------------
Tue Aug 9 23:58:29 MET DST 1994 <erik@hacktic.nl>
* [misc/file.c]
......
......@@ -8,11 +8,15 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1994";
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "win.h"
#include "desktop.h"
#include "prototypes.h"
extern BOOL GRAPH_DrawBitmap( HDC hdc, HBITMAP hbitmap, int xdest, int ydest,
int xsrc, int ysrc, int width, int height,
int rop ); /* graphics.c */
/***********************************************************************
* DESKTOP_LoadBitmap
......@@ -85,17 +89,15 @@ static LONG DESKTOP_DoEraseBkgnd( HWND hwnd, HDC hdc, DESKTOPINFO *infoPtr )
if (infoPtr->hbitmapWallPaper)
{
int x, y;
HDC hdcmem;
hdcmem = CreateCompatibleDC( hdc );
SelectObject( hdcmem, infoPtr->hbitmapWallPaper );
if (infoPtr->fTileWallPaper)
{
for (y = 0; y < rect.bottom; y += infoPtr->bitmapSize.cy)
for (x = 0; x < rect.right; x += infoPtr->bitmapSize.cx)
BitBlt( hdc, x, y,
infoPtr->bitmapSize.cx, infoPtr->bitmapSize.cy,
hdcmem, 0, 0, SRCCOPY );
GRAPH_DrawBitmap( hdc, infoPtr->hbitmapWallPaper,
x, y, 0, 0,
infoPtr->bitmapSize.cx,
infoPtr->bitmapSize.cy, SRCCOPY );
}
else
{
......@@ -103,10 +105,10 @@ static LONG DESKTOP_DoEraseBkgnd( HWND hwnd, HDC hdc, DESKTOPINFO *infoPtr )
y = (rect.top + rect.bottom - infoPtr->bitmapSize.cy) / 2;
if (x < 0) x = 0;
if (y < 0) y = 0;
BitBlt( hdc, x, y, infoPtr->bitmapSize.cx, infoPtr->bitmapSize.cy,
hdcmem, 0, 0, SRCCOPY );
GRAPH_DrawBitmap( hdc, infoPtr->hbitmapWallPaper, x, y, 0, 0,
infoPtr->bitmapSize.cx, infoPtr->bitmapSize.cy,
SRCCOPY );
}
DeleteDC( hdcmem );
}
return 1;
......
......@@ -12,7 +12,7 @@ static char Copyright[] = "Copyright David W. Metcalfe, 1993";
#include "win.h"
#include "user.h"
LONG StaticWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam);
extern void DEFWND_SetText( HWND hwnd, LPSTR text ); /* windows/defwnd.c */
static LONG PaintTextfn(HWND hwnd);
static LONG PaintRectfn(HWND hwnd);
......@@ -67,6 +67,27 @@ LONG StaticWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam)
InvalidateRect(hWnd, NULL, FALSE);
break;
case WM_NCCREATE:
if (style == SS_ICON)
{
/* Note: we use wndPtr->hText to store the icon handle */
CREATESTRUCT * createStruct = (CREATESTRUCT *)lParam;
if (createStruct->lpszName)
wndPtr->hText = LoadIcon( createStruct->hInstance,
createStruct->lpszName );
return 1;
}
else return DefWindowProc(hWnd, uMsg, wParam, lParam);
case WM_NCDESTROY:
if (style == SS_ICON)
{
if (wndPtr->hText) DestroyIcon( wndPtr->hText );
wndPtr->hText = 0;
return 0;
}
else return DefWindowProc(hWnd, uMsg, wParam, lParam);
case WM_CREATE:
if (style < 0L || style >= (LONG)DIM(staticfn)) {
lResult = -1L;
......@@ -100,27 +121,26 @@ LONG StaticWndProc(HWND hWnd, WORD uMsg, WORD wParam, LONG lParam)
break;
case WM_SETTEXT:
if (wndPtr->hText)
USER_HEAP_FREE(wndPtr->hText);
wndPtr->hText = USER_HEAP_ALLOC(GMEM_MOVEABLE,
strlen((LPSTR)lParam) + 1);
textPtr = (LPSTR)USER_HEAP_ADDR(wndPtr->hText);
strcpy(textPtr, (LPSTR)lParam);
InvalidateRect(hWnd, NULL, TRUE);
if (style == SS_ICON) break;
DEFWND_SetText( hWnd, (LPSTR)lParam );
InvalidateRect( hWnd, NULL, FALSE );
UpdateWindow( hWnd );
break;
case WM_KEYDOWN:
case WM_KEYUP:
case WM_CHAR:
case WM_LBUTTONDOWN:
case WM_LBUTTONUP:
case WM_MBUTTONDOWN:
case WM_MBUTTONUP:
case WM_RBUTTONDOWN:
case WM_RBUTTONUP:
case WM_MOUSEMOVE:
return(SendMessage(wndPtr->hwndParent, uMsg, wParam, lParam));
case WM_NCHITTEST:
return HTTRANSPARENT;
case STM_GETICON:
if (style != SS_ICON) return 0;
return (HICON)wndPtr->hText;
case STM_SETICON:
if (style != SS_ICON) return 0;
if (wndPtr->hText) DestroyIcon( wndPtr->hText );
wndPtr->hText = wParam;
InvalidateRect( hWnd, NULL, TRUE );
UpdateWindow( hWnd );
return 0;
default:
lResult = DefWindowProc(hWnd, uMsg, wParam, lParam);
......@@ -280,30 +300,11 @@ static LONG PaintIconfn(HWND hwnd)
PAINTSTRUCT ps;
RECT rc;
HDC hdc;
LPSTR textPtr;
HICON hIcon;
wndPtr = WIN_FindWndPtr(hwnd);
hdc = BeginPaint(hwnd, &ps);
GetClientRect(hwnd, &rc);
FillRect(hdc, &rc, GetStockObject(WHITE_BRUSH));
textPtr = (LPSTR)USER_HEAP_ADDR(wndPtr->hText);
printf("SS_ICON : textPtr='%8x' / left=%d top=%d right=%d bottom=%d \n",
textPtr, rc.left, rc.top, rc.right, rc.bottom);
/*
SetWindowPos(hwnd, (HWND)NULL, 0, 0, 32, 32,
SWP_NOZORDER | SWP_NOMOVE);
GetClientRect(hwnd, &rc);
printf("SS_ICON : textPtr='%s' / left=%d top=%d right=%d bottom=%d \n",
textPtr, rc.left, rc.top, rc.right, rc.bottom);
*/
hIcon = LoadIcon(wndPtr->hInstance, textPtr);
DrawIcon(hdc, rc.left, rc.top, hIcon);
if (wndPtr->hText) DrawIcon(hdc, rc.left, rc.top, wndPtr->hText );
EndPaint(hwnd, &ps);
}
......@@ -40,7 +40,7 @@ static WNDCLASS WIDGETS_BuiltinClasses[] =
0, 0, 0, 0, NULL, POPUPMENU_CLASS_NAME },
{ CS_GLOBALCLASS, (LONG(*)())DesktopWndProc, 0, sizeof(DESKTOPINFO),
0, 0, 0, 0, NULL, DESKTOP_CLASS_NAME },
{ CS_GLOBALCLASS, (LONG(*)())DefDlgProc, 0, DLGWINDOWEXTRA,
{ CS_GLOBALCLASS | CS_SAVEBITS, (LONG(*)())DefDlgProc, 0, DLGWINDOWEXTRA,
0, 0, 0, 0, NULL, DIALOG_CLASS_NAME },
{ CS_GLOBALCLASS, (LONG(*)())MDIClientWndProc, 0, sizeof(MDICLIENTINFO),
0, 0, 0, STOCK_LTGRAY_BRUSH, NULL, "MDICLIENT" }
......@@ -58,9 +58,12 @@ static WNDCLASS WIDGETS_BuiltinClasses[] =
BOOL WIDGETS_Init(void)
{
int i;
for (i = 0; i < NB_BUILTIN_CLASSES; i++)
WNDCLASS *class = WIDGETS_BuiltinClasses;
for (i = 0; i < NB_BUILTIN_CLASSES; i++, class++)
{
if (!RegisterClass(&WIDGETS_BuiltinClasses[i])) return FALSE;
class->hCursor = LoadCursor( 0, IDC_ARROW );
if (!RegisterClass( class )) return FALSE;
}
return TRUE;
}
......@@ -72,5 +72,5 @@ includes::
install::
clean::
$(RM) dll* dtb* pop.h
$(RM) dll* dtb* pop.h call.s
touch pop.h
......@@ -54,7 +54,7 @@ length 490
39 pascal RestoreDC(word s_word) RestoreDC(1 2)
40 pascal FillRgn(word word word) FillRgn(1 2 3)
#41 pascal FrameRgn
#42 pascal InvertRgn
42 pascal InvertRgn(word word) InvertRgn(1 2)
43 pascal PaintRgn(word word) PaintRgn(1 2)
44 pascal SelectClipRgn(word word) SelectClipRgn(1 2)
45 pascal SelectObject(word word) SelectObject(1 2)
......
......@@ -241,7 +241,7 @@ length 540
#231 GETSYSTEMDEBUGSTATE
232 pascal SetWindowPos(word word word word word word word)
SetWindowPos(1 2 3 4 5 6 7)
#233 SETPARENT
233 pascal SetParent(word word) SetParent(1 2)
234 pascal UnhookWindowsHook(s_word ptr) UnhookWindowsHook(1 2)
235 pascal DefHookProc(s_word word long ptr) DefHookProc(1 2 3 4)
236 pascal GetCapture() GetCapture()
......
#define check_boxes_width 56
#define check_boxes_height 39
static char check_boxes_bits[] = {
0xff, 0xdf, 0xff, 0xf7, 0xff, 0xfd, 0x7f, 0x01, 0xd0, 0x00, 0xf6, 0xff,
0xfd, 0x7f, 0x01, 0x50, 0x01, 0x35, 0x80, 0x1d, 0x70, 0x01, 0x50, 0x82,
0x34, 0x80, 0x2d, 0x68, 0x01, 0x50, 0x44, 0x34, 0x80, 0x4d, 0x64, 0x01,
0x50, 0x28, 0x34, 0x80, 0x8d, 0x62, 0x01, 0x50, 0x10, 0x34, 0x80, 0x0d,
0x61, 0x01, 0x50, 0x28, 0x34, 0x80, 0x8d, 0x62, 0x01, 0x50, 0x44, 0x34,
0x80, 0x4d, 0x64, 0x01, 0x50, 0x82, 0x34, 0x80, 0x2d, 0x68, 0x01, 0x50,
0x01, 0x35, 0x80, 0x1d, 0x70, 0x01, 0xd0, 0x00, 0xf6, 0xff, 0xfd, 0x7f,
0xff, 0xdf, 0xff, 0xf7, 0xff, 0xfd, 0x7f, 0xe0, 0x00, 0x38, 0x00, 0x0e,
0x80, 0x03, 0x18, 0x03, 0xc6, 0x80, 0x3f, 0xe0, 0x0f, 0x04, 0x04, 0x01,
0xc1, 0x71, 0x70, 0x1c, 0x02, 0x88, 0x38, 0xe2, 0xe0, 0xb8, 0x3b, 0x02,
0x88, 0x7c, 0x62, 0xc0, 0xd8, 0x37, 0x01, 0x50, 0xfe, 0x34, 0x80, 0xed,
0x6f, 0x01, 0x50, 0xfe, 0x34, 0x80, 0xed, 0x6f, 0x01, 0x50, 0xfe, 0x34,
0x80, 0xed, 0x6f, 0x02, 0x88, 0x7c, 0x62, 0xc0, 0xd8, 0x37, 0x02, 0x88,
0x38, 0xe2, 0xe0, 0xb8, 0x3b, 0x04, 0x04, 0x01, 0xc1, 0x71, 0x70, 0x1c,
0x18, 0x03, 0xc6, 0x80, 0x3f, 0xe0, 0x0f, 0xe0, 0x00, 0x38, 0x00, 0x0e,
0x80, 0x03, 0x00, 0xc0, 0xff, 0x07, 0x00, 0xfc, 0x7f, 0x00, 0xc0, 0xaa,
0x06, 0x00, 0xfc, 0x7f, 0x00, 0x40, 0x55, 0x05, 0x00, 0x5c, 0x75, 0x00,
0xc0, 0xaa, 0x06, 0x00, 0xac, 0x6a, 0x00, 0x40, 0x55, 0x05, 0x00, 0x5c,
0x75, 0x00, 0xc0, 0xaa, 0x06, 0x00, 0xac, 0x6a, 0x00, 0x40, 0x55, 0x05,
0x00, 0x5c, 0x75, 0x00, 0xc0, 0xaa, 0x06, 0x00, 0xac, 0x6a, 0x00, 0x40,
0x55, 0x05, 0x00, 0x5c, 0x75, 0x00, 0xc0, 0xaa, 0x06, 0x00, 0xac, 0x6a,
0x00, 0x40, 0x55, 0x05, 0x00, 0x5c, 0x75, 0x00, 0xc0, 0xaa, 0x06, 0x00,
0xfc, 0x7f, 0x00, 0xc0, 0xff, 0x07, 0x00, 0xfc, 0x7f};
......@@ -8,6 +8,7 @@
#define GDI_H
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "windows.h"
#include "segmem.h"
......@@ -32,6 +33,7 @@ typedef struct tagREGION
WORD type;
RECT box;
Pixmap pixmap;
Region xrgn;
} REGION;
typedef struct tagGDIOBJHDR
......
......@@ -11,14 +11,14 @@
typedef struct tagMENUITEM
{
WORD item_flags;
WORD item_id;
RECT rect;
WORD sel_key;
HBITMAP hCheckBit;
HBITMAP hUnCheckBit;
WORD item_flags; /* Item flags */
WORD item_id; /* Item or popup id */
RECT rect; /* Item area (relative to menu window) */
WORD xTab; /* X position of text after Tab */
HBITMAP hCheckBit; /* Bitmap for checked item */
HBITMAP hUnCheckBit; /* Bitmap for unchecked item */
HANDLE hText; /* Handle to item string or bitmap */
char *item_text;
HANDLE hText;
} MENUITEM, *LPMENUITEM;
......
......@@ -14,6 +14,18 @@ struct dosdirent {
long filetime;
};
struct fcb {
BYTE drive;
char name[8];
char extension[3];
BYTE dummy1[4];
int filesize;
WORD date_write;
WORD time_write;
struct dosdirent *directory;
BYTE dummy2[9];
};
#define DOSVERSION 0x0330;
#define MAX_DOS_DRIVES 26
......
......@@ -13,8 +13,8 @@ struct options
char * desktopGeometry; /* NULL when no desktop */
char * programName; /* To use when loading resources */
int usePrivateMap;
int synchronous;
int nobackingstore;
int synchronous; /* X synchronous mode */
int backingstore; /* Use backing store */
short cmdShow;
int relay_debug;
int debug;
......
......@@ -55,7 +55,7 @@ typedef struct segment_descriptor_s
unsigned short owner; /* Handle of owner program */
unsigned char type; /* DATA or CODE */
#ifdef HAVE_IPC
key_t shm_key; /* Shared memory key or IPC_PRIVATE */
key_t shm_key; /* Shared memory key or -1 */
#endif
} SEGDESC;
......
......@@ -42,19 +42,20 @@ typedef struct tagWND
DWORD dwStyle; /* Window style (from CreateWindow) */
DWORD dwExStyle; /* Extended style (from CreateWindowEx) */
HANDLE hdce; /* Window DCE (if CS_OWNDC or CS_CLASSDC) */
void *VScroll; /* Vertical ScrollBar Struct Pointer */
void *HScroll; /* Horizontal ScrollBar Struct Pointer */
void *VScroll; /* Vertical ScrollBar Struct Pointer */
void *HScroll; /* Horizontal ScrollBar Struct Pointer */
WORD scroll_flags; /* scrolls flags (vert & horz visible) */
WORD wIDmenu; /* ID or hmenu (from CreateWindow) */
HANDLE hText; /* Handle of window text */
WORD flags; /* Misc. flags (see below) */
Window window; /* X window */
Window icon; /* icon's X window */
HICON hIcon; /* icon's MS-windows handle */
RECT rectClientSave; /* where client rect is saved when icon*/
HMENU hSysMenu; /* window's copy of System Menu */
WORD iconWidth; /* width of icon */
WORD iconHeight; /* height of icon */
RECT rectClientSave; /* where client rect is saved when icon*/
HMENU hSysMenu; /* window's copy of System Menu */
HANDLE hProp; /* Handle of Properties List */
HTASK hTask; /* Task Handle of the owner */
HTASK hTask; /* Task Handle of the owner */
WORD wExtra[1]; /* Window extra bytes */
} WND;
......
......@@ -1513,6 +1513,8 @@ enum { WM_NULL, WM_CREATE, WM_DESTROY, WM_MOVE, WM_UNUSED0, WM_SIZE, WM_ACTIVATE
#define WM_MOUSELAST WM_MBUTTONDBLCLK
#define WM_PARENTNOTIFY 0x0210
#define WM_ENTERMENULOOP 0x0211
#define WM_EXITMENULOOP 0x0212
#define WM_MDICREATE 0x0220
#define WM_MDIDESTROY 0x0221
......@@ -1565,9 +1567,29 @@ enum { WM_NULL, WM_CREATE, WM_DESTROY, WM_MOVE, WM_UNUSED0, WM_SIZE, WM_ACTIVATE
#define SW_PARENTOPENING 3
#define SW_OTHERRESTORED 4
enum { SW_HIDE, SW_SHOWNORMAL, SW_NORMAL, SW_SHOWMINIMIZED, SW_SHOWMAXIMIZED,
SW_MAXIMIZE, SW_SHOWNOACTIVATE, SW_SHOW, SW_MINIMIZE,
SW_SHOWMINNOACTIVE, SW_SHOWNA, SW_RESTORE };
/*
enum { SW_HIDE, SW_SHOWNORMAL, SW_NORMAL, SW_SHOWMINIMIZED,
SW_SHOWMAXIMIZED, SW_MAXIMIZE, SW_SHOWNOACTIVATE, SW_SHOW,
SW_MINIMIZE, SW_SHOWMINNOACTIVE, SW_SHOWNA, SW_RESTORE,
SW_INTERNAL_HIDE, SW_INTERNAL_RESTORE };
*/
#define SW_HIDE 0
#define SW_SHOWNORMAL 1
#define SW_NORMAL 1
#define SW_SHOWMINIMIZED 2
#define SW_SHOWMAXIMIZED 3
#define SW_MAXIMIZE 3
#define SW_SHOWNOACTIVATE 4
#define SW_SHOW 5
#define SW_MINIMIZE 6
#define SW_SHOWMINNOACTIVE 7
#define SW_SHOWNA 8
#define SW_RESTORE 9
#define SW_INTERNAL_HIDE 20
#define SW_INTERNAL_RESTORE 21
/* WM_SIZE message wParam values */
#define SIZE_RESTORED 0
......
......@@ -156,19 +156,23 @@ IPCCopySelector(int i_old, unsigned long new, int swap_type)
* to get one. In this case, we'll also have to copy the data
* to protect it.
*/
if (s_old->shm_key == 0)
if (s_old->shm_key == -1)
{
s_old->shm_key = shmget(IPC_PRIVATE, s_old->length, 0600);
if (s_old->shm_key == 0)
s_old->shm_key = shmget(IPC_PRIVATE, s_old->length, IPC_CREAT);
if (s_old->shm_key == -1)
{
if (s_new)
if (s_new) {
memset(s_new, 0, sizeof(*s_new));
s_new->shm_key = -1;
}
return -1;
}
if (shmat(s_old->shm_key, base_addr, 0) == NULL)
if (shmat(s_old->shm_key, base_addr, 0) == (char *) -1)
{
if (s_new)
if (s_new) {
memset(s_new, 0, sizeof(*s_new));
s_new->shm_key = -1;
}
shmctl(s_old->shm_key, IPC_RMID, NULL);
return -1;
}
......@@ -183,10 +187,12 @@ IPCCopySelector(int i_old, unsigned long new, int swap_type)
*/
else
{
if (shmat(s_old->shm_key, base_addr, 0) == NULL)
if (shmat(s_old->shm_key, base_addr, 0) == (char *) -1)
{
if (s_new)
if (s_new) {
memset(s_new, 0, sizeof(*s_new));
s_new->shm_key = -1;
}
return -1;
}
}
......@@ -257,6 +263,9 @@ WORD AllocSelector(WORD old_selector)
else
{
memset(s_new, 0, sizeof(*s_new));
#ifdef HAVE_IPC
s_new->shm_key = -1;
#endif
SelectorMap[i_new] = i_new;
}
......@@ -401,6 +410,19 @@ WORD AllocDStoCSAlias(WORD ds_selector)
}
/**********************************************************************
* CleanupSelectors
*/
void CleanupSelectors(void)
{
int sel_idx;
for (sel_idx = FIRST_SELECTOR; sel_idx < MAX_SELECTORS; sel_idx++)
if (SelectorMap[sel_idx])
FreeSelector((sel_idx << 3) | 7);
}
/**********************************************************************
* FreeSelector
*/
WORD FreeSelector(WORD sel)
......@@ -417,10 +439,11 @@ WORD FreeSelector(WORD sel)
return 0;
s = &Segments[sel_idx];
if (s->shm_key == 0)
if (s->shm_key == -1)
{
munmap(s->base_addr, ((s->length + PAGE_SIZE) & ~(PAGE_SIZE - 1)));
memset(s, 0, sizeof(*s));
s->shm_key = -1;
SelectorMap[sel_idx] = 0;
}
else
......@@ -436,6 +459,7 @@ WORD FreeSelector(WORD sel)
shmctl(s->shm_key, IPC_RMID, NULL);
memset(s, 0, sizeof(*s));
s->shm_key = -1;
SelectorMap[sel_idx] = 0;
}
......@@ -521,12 +545,17 @@ CreateNewSegments(int code_flag, int read_only, int length, int n_segments)
MAP_FIXED | MAP_PRIVATE | MAP_ANON,
-1, 0);
#endif
#ifdef HAVE_IPC
s->shm_key = -1;
#endif
if (set_ldt_entry(i, (unsigned long) s->base_addr,
(s->length - 1) & 0xffff, 0,
contents, read_only, 0) < 0)
{
memset(s, 0, sizeof(*s));
#ifdef HAVE_IPC
s->shm_key = -1;
#endif
return NULL;
}
......@@ -982,6 +1011,9 @@ CreateSelectors(struct w_files * wpnt)
myerror("CreateSelectors: GlobalAlloc() failed");
s->base_addr = (void *) ((LONG) s->selector << 16);
#ifdef HAVE_IPC
s->shm_key = -1;
#endif
if (!(s->flags & NE_SEGFLAGS_DATA))
PrestoChangoSelector(s->selector, s->selector);
else
......
......@@ -173,7 +173,7 @@ INT OpenFile (LPSTR lpFileName, LPOFSTRUCT ofs, WORD wStyle)
ofs->nErrCode = ExtendedError;
return -1;
}
handle = open (ofs->szPathName, (wStyle & 0x0003) | O_CREAT, 0x666);
handle = open (unixfilename, (wStyle & 0x0003) | O_CREAT, 0x666);
if (handle == -1)
{
errno_to_doserr();
......
......@@ -52,7 +52,7 @@ struct options Options =
NULL, /* programName */
FALSE, /* usePrivateMap */
FALSE, /* synchronous */
FALSE, /* no backing store */
FALSE, /* backing store */
SW_SHOWNORMAL, /* cmdShow */
FALSE
};
......@@ -60,6 +60,7 @@ struct options Options =
static XrmOptionDescRec optionsTable[] =
{
{ "-backingstore", ".backingstore", XrmoptionNoArg, (caddr_t)"on" },
{ "-desktop", ".desktop", XrmoptionSepArg, (caddr_t)NULL },
{ "-depth", ".depth", XrmoptionSepArg, (caddr_t)NULL },
{ "-display", ".display", XrmoptionSepArg, (caddr_t)NULL },
......@@ -67,7 +68,6 @@ static XrmOptionDescRec optionsTable[] =
{ "-name", ".name", XrmoptionSepArg, (caddr_t)NULL },
{ "-privatemap", ".privatemap", XrmoptionNoArg, (caddr_t)"on" },
{ "-synchronous", ".synchronous", XrmoptionNoArg, (caddr_t)"on" },
{ "-nobackingstore",".nobackingstore", XrmoptionNoArg, (caddr_t)"on" },
{ "-spy", ".spy", XrmoptionSepArg, (caddr_t)NULL },
{ "-debug", ".debug", XrmoptionNoArg, (caddr_t)"on" },
{ "-relaydbg", ".relaydbg", XrmoptionNoArg, (caddr_t)"on" }
......@@ -87,7 +87,7 @@ static XrmOptionDescRec optionsTable[] =
" -name name Set the application name\n" \
" -privatemap Use a private color map\n" \
" -synchronous Turn on synchronous display mode\n" \
" -nobackingstore Turn off backing store\n" \
" -backingstore Turn on backing store\n" \
" -spy file Turn on message spying to the specified file\n" \
" -relaydbg Display call relay information\n"
......@@ -242,8 +242,8 @@ static void MAIN_ParseOptions( int *argc, char *argv[] )
Options.usePrivateMap = TRUE;
if (MAIN_GetResource( db, ".synchronous", &value ))
Options.synchronous = TRUE;
if (MAIN_GetResource( db, ".nobackingstore", &value ))
Options.nobackingstore = TRUE;
if (MAIN_GetResource( db, ".backingstore", &value ))
Options.backingstore = TRUE;
if (MAIN_GetResource( db, ".relaydbg", &value ))
Options.relay_debug = TRUE;
if (MAIN_GetResource( db, ".debug", &value ))
......@@ -350,6 +350,7 @@ static void called_at_exit(void)
sync_profiles();
MAIN_RestoreSetup();
WSACleanup();
CleanupSelectors();
}
/***********************************************************************
......
......@@ -841,31 +841,70 @@ static void DumpFCB(BYTE *fcb)
static void FindFirstFCB(struct sigcontext_struct *context)
{
BYTE *fcb = pointer(DS, DX);
struct fcb *standard_fcb;
struct fcb *output_fcb;
int drive;
char path[12];
DumpFCB( fcb );
if ((*fcb) == 0xff)
{
standard_fcb = fcb + 7;
output_fcb = dta + 7;
*dta = 0xff;
}
else
{
standard_fcb = fcb;
output_fcb = dta;
}
if (*fcb)
drive = *fcb - 1;
if (standard_fcb->drive)
{
drive = standard_fcb->drive - 1;
if (!DOS_ValidDrive(drive))
{
Error (InvalidDrive, EC_MediaError, EL_Disk);
AL = 0xff;
return;
}
}
else
drive = DOS_GetDefaultDrive();
drive = DOS_GetDefaultDrive();
if (*(fcb - 7) == 0xff) {
if (*(fcb - 1) == FA_DIREC) {
/* return volume label */
output_fcb->drive = drive;
memset(dta, ' ', 11);
if (DOS_GetVolumeLabel(drive) != NULL)
strncpy(dta, DOS_GetVolumeLabel(drive), 8);
*(dta + 0x0b) = FA_DIREC;
if (*(fcb) == 0xff)
{
if (*(fcb+6) & FA_LABEL) /* return volume label */
{
*(dta+6) = FA_LABEL;
memset(&output_fcb->name, ' ', 11);
if (DOS_GetVolumeLabel(drive) != NULL)
{
strncpy(&output_fcb->name, DOS_GetVolumeLabel(drive), 11);
AL = 0x00;
return;
}
}
}
AL;
return;
}
}
IntBarf(0x21, context);
strncpy(&(output_fcb->name),&(standard_fcb->name),11);
if (*fcb == 0xff)
*(dta+6) = ( *(fcb+6) & (!FA_DIREC));
sprintf(path,"%c:*.*",drive+'A');
if ((output_fcb->directory = DOS_opendir(path))==NULL)
{
Error (PathNotFound, EC_MediaError, EL_Disk);
AL = 0xff;
return;
}
}
static void DeleteFileFCB(struct sigcontext_struct *context)
{
BYTE *fcb = pointer(DS, DX);
......
......@@ -13,6 +13,7 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "bitmap.h"
/* Include OEM bitmaps */
#include "bitmaps/check_boxes"
#include "bitmaps/check_mark"
#include "bitmaps/menu_arrow"
......@@ -64,7 +65,7 @@ static XImage *BITMAP_BmpToImage( BITMAP * bmp, void * bmpData )
extern void _XInitImageFuncPtrs( XImage* );
XImage * image;
image = XCreateImage( XT_display, DefaultVisualOfScreen(screen),
image = XCreateImage( display, DefaultVisualOfScreen(screen),
bmp->bmBitsPixel, ZPixmap, 0, bmpData,
bmp->bmWidth, bmp->bmHeight, 16, bmp->bmWidthBytes );
if (!image) return 0;
......@@ -94,6 +95,12 @@ HBITMAP BITMAP_LoadOEMBitmap( WORD id )
data = menu_arrow_bits;
break;
case OBM_CHECKBOXES:
width = check_boxes_width;
height = check_boxes_height;
data = check_boxes_bits;
break;
case OBM_CHECK:
width = check_mark_width;
height = check_mark_height;
......
......@@ -21,7 +21,12 @@ void CLIPPING_SetDeviceClipping( DC * dc )
if (dc->w.hGCClipRgn)
{
RGNOBJ *obj = (RGNOBJ *) GDI_GetObjPtr(dc->w.hGCClipRgn, REGION_MAGIC);
if (obj->region.pixmap)
if (obj->region.xrgn)
{
XSetRegion( display, dc->u.x.gc, obj->region.xrgn );
XSetClipOrigin( display, dc->u.x.gc, dc->w.DCOrgX, dc->w.DCOrgY );
}
else if (obj->region.pixmap)
{
XSetClipMask( display, dc->u.x.gc, obj->region.pixmap );
XSetClipOrigin( display, dc->u.x.gc,
......
......@@ -183,25 +183,6 @@ HDC GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
dc->w.DCSizeX = wndPtr->rectWindow.right - wndPtr->rectWindow.left;
dc->w.DCSizeY = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top;
}
else if (IsIconic(hwnd)) /* if we have an icon */
{
/* more things are hardcoded here than should be,
* I assume the icon windows is 100 pixels 1/2 of which is 50
* this just sets up the dc so it knows about the size of
* the icon area
*/
dc->u.x.drawable = wndPtr->icon;
if (wndPtr->hIcon != (HICON)NULL) {
lpico = (ICONALLOC *)GlobalLock(wndPtr->hIcon);
dc->w.DCSizeX = /* (int)lpico->descriptor.Width */ 100;
dc->w.DCSizeY = (int)lpico->descriptor.Height + 20;
} else {
dc->w.DCOrgX = /* 64 */ 100; /* assume max size */
dc->w.DCOrgY = 64 + 20;
}
dc->w.DCOrgX = 0;
dc->w.DCOrgY = 0;
}
else
{
dc->w.DCOrgX = wndPtr->rectClient.left - wndPtr->rectWindow.left;
......@@ -223,11 +204,12 @@ HDC GetDCEx( HWND hwnd, HRGN hrgnClip, DWORD flags )
if ((flags & DCX_INTERSECTRGN) || (flags & DCX_EXCLUDERGN))
{
HRGN hrgn = CreateRectRgn( 0, 0, 0, 0 );
if (hrgn && !IsIconic(hwnd))
if (hrgn)
{
if (CombineRgn( hrgn, InquireVisRgn(hdc), hrgnClip,
(flags & DCX_INTERSECTRGN) ? RGN_AND : RGN_DIFF ))
(flags & DCX_INTERSECTRGN) ? RGN_AND : RGN_DIFF )) {
SelectVisRgn( hdc, hrgn );
}
DeleteObject( hrgn );
}
}
......
......@@ -44,6 +44,7 @@ void DEFWND_SetText( HWND hwnd, LPSTR text )
strcpy( textPtr, text );
}
#include <assert.h>
/***********************************************************************
* DefWindowProc (USER.107)
......@@ -75,13 +76,10 @@ LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
case WM_NCCALCSIZE:
return NC_HandleNCCalcSize( hwnd, (NCCALCSIZE_PARAMS *)lParam );
case WM_PAINTICON:
case WM_NCPAINT:
return NC_HandleNCPaint( hwnd, (HRGN)wParam );
case WM_PAINTICON:
printf("going to call NC_HandleNCPaintIcon\n");
return NC_HandleNCPaintIcon( hwnd );
case WM_NCHITTEST:
return NC_HandleNCHitTest( hwnd, MAKEPOINT(lParam) );
......@@ -89,6 +87,7 @@ LONG DefWindowProc( HWND hwnd, WORD msg, WORD wParam, LONG lParam )
case WM_NCLBUTTONDOWN:
return NC_HandleNCLButtonDown( hwnd, wParam, lParam );
case WM_LBUTTONDBLCLK:
case WM_NCLBUTTONDBLCLK:
return NC_HandleNCLButtonDblClk( hwnd, wParam, lParam );
......
......@@ -78,12 +78,14 @@ static DLGCONTROLHEADER * DIALOG_GetControl( DLGCONTROLHEADER * ptr,
*class = p;
p += strlen(p) + 1;
}
/* FIXME: how can I determine if the resource id is an integer or a string ? */
if (*p == 0xff) {
/* *(DWORD*)text = (*p << 8) | *p;*/
*(DWORD*)text = 0xebeb;
if (*p == 0xff)
{
/* Integer id, not documented (?). Only works for SS_ICON controls */
*text = (char *)MAKEINTRESOURCE( p[1] + 256*p[2] );
p += 4;
} else {
}
else
{
*text = p;
p += strlen(p) + 2;
}
......@@ -263,8 +265,10 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, LPCSTR dlgTemplate,
/* Create dialog main window */
rect.left = rect.top = 0;
rect.right = template.header->cx * xUnit / 4;
rect.bottom = template.header->cy * yUnit / 8;
if (!(template.header->style & DS_ABSALIGN))
ClientToScreen( owner, (POINT *)&rect );
rect.right = rect.left + template.header->cx * xUnit / 4;
rect.bottom = rect.top + template.header->cy * yUnit / 8;
if (template.header->style & DS_MODALFRAME) exStyle |= WS_EX_DLGMODALFRAME;
AdjustWindowRectEx( &rect, template.header->style, hMenu, exStyle );
......@@ -300,11 +304,8 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, LPCSTR dlgTemplate,
#ifdef DEBUG_DIALOG
printf( " %s ", class);
if ((DWORD*)text < 0x10000)
printf("'%4X'", (DWORD*)text);
else
printf("'%s'", text);
if ((int)text & 0xffff0000) printf("'%s'", text);
else printf("%4X", (int)text & 0xffff);
printf(" %d, %d, %d, %d, %d, %08x\n", header->id, header->x, header->y,
header->cx, header->cy, header->style );
#endif
......@@ -329,11 +330,6 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, LPCSTR dlgTemplate,
hwnd, header->id, HIWORD((LONG)dlgHeapBase), NULL );
}
else {
if ((strcmp(class, "STATIC") == 0) &
((header->style & SS_ICON) == SS_ICON)) {
header->cx = 32;
header->cy = 32;
}
header->style |= WS_CHILD;
CreateWindowEx( WS_EX_NOPARENTNOTIFY,
class, text, header->style,
......
......@@ -252,13 +252,6 @@ static void EVENT_Expose( HWND hwnd, XExposeEvent *event )
WND * wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr) return;
if (IsIconic(hwnd) && wndPtr->hIcon)
{
SendMessage(hwnd, WM_PAINTICON, 0, 0);
return;
}
/* Make position relative to client area instead of window */
rect.left = event->x - (wndPtr->rectClient.left - wndPtr->rectWindow.left);
rect.top = event->y - (wndPtr->rectClient.top - wndPtr->rectWindow.top);
......
......@@ -18,6 +18,8 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "gdi.h"
#include "syscolor.h"
extern const int DC_XROPfunction[];
extern int COLOR_ToPhysical( DC *dc, COLORREF color );
static inline swap_int(int *a, int *b)
......@@ -473,6 +475,10 @@ COLORREF GetPixel( HDC hdc, short x, short y )
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return 0;
#ifdef SOLITAIRE_SPEED_HACK
return 0;
#endif
x = dc->w.DCOrgX + XLPTODP( dc, x );
y = dc->w.DCOrgY + YLPTODP( dc, y );
if ((x < 0) || (y < 0)) return 0;
......@@ -552,6 +558,20 @@ BOOL FillRgn( HDC hdc, HRGN hrgn, HBRUSH hbrush )
/***********************************************************************
* InvertRgn (GDI.42)
*/
BOOL InvertRgn( HDC hdc, HRGN hrgn )
{
HBRUSH prevBrush = SelectObject( hdc, GetStockObject(BLACK_BRUSH) );
WORD prevROP = SetROP2( hdc, R2_NOT );
BOOL retval = PaintRgn( hdc, hrgn );
SelectObject( hdc, prevBrush );
SetROP2( hdc, prevROP );
return retval;
}
/***********************************************************************
* DrawFocusRect (USER.466)
*/
void DrawFocusRect( HDC hdc, LPRECT rc )
......@@ -583,6 +603,44 @@ void DrawFocusRect( HDC hdc, LPRECT rc )
/**********************************************************************
* GRAPH_DrawBitmap
*
* Short-cut function to blit a bitmap into a device.
* Faster than CreateCompatibleDC() + SelectBitmap() + BitBlt() + DeleteDC().
*/
BOOL GRAPH_DrawBitmap( HDC hdc, HBITMAP hbitmap, int xdest, int ydest,
int xsrc, int ysrc, int width, int height, int rop )
{
XGCValues val;
BITMAPOBJ *bmp;
DC *dc;
if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return FALSE;
if (!(bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC )))
return FALSE;
val.function = DC_XROPfunction[(rop >> 16) & 0x0f];
val.foreground = dc->w.textPixel;
val.background = dc->w.backgroundPixel;
XChangeGC(display, dc->u.x.gc, GCFunction|GCForeground|GCBackground, &val);
if (bmp->bitmap.bmBitsPixel == 1)
{
XCopyPlane( display, bmp->pixmap, dc->u.x.drawable, dc->u.x.gc,
xsrc, ysrc, width, height,
dc->w.DCOrgX + xdest, dc->w.DCOrgY + ydest, 1 );
return TRUE;
}
else if (bmp->bitmap.bmBitsPixel == dc->w.bitsPerPixel)
{
XCopyArea( display, bmp->pixmap, dc->u.x.drawable, dc->u.x.gc,
xsrc, ysrc, width, height,
dc->w.DCOrgX + xdest, dc->w.DCOrgY + ydest );
return TRUE;
}
else return FALSE;
}
/**********************************************************************
* DrawReliefRect (Not a MSWin Call)
*/
void DrawReliefRect( HDC hdc, RECT rect, int thickness, BOOL pressed )
......
/*
* Iconification functions
*
* Copyright 1994 John Richardson
*/
static char Copyright[] = "Copyright John Richardson, 1994";
#include "win.h"
#include "class.h"
#include "message.h"
#include "sysmetrics.h"
#include "user.h"
#include "scroll.h"
#include "menu.h"
#include "icon.h"
RECT myrect;
ICON_Iconify(HWND hwnd)
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
GC testgc;
WND *parwPtr;
#ifdef DEBUG_ICON
printf("ICON_Iconify %d\n", hwnd);
#endif
parwPtr = WIN_FindWndPtr(wndPtr->hwndParent);
if (parwPtr == NULL) {
printf("argh, the parent is NULL, what to do?\n");
exit(1);
}
wndPtr->dwStyle |= WS_MINIMIZE;
XUnmapWindow(display, wndPtr->window);
if (wndPtr->icon == NULL) {
printf("argh, couldn't find icon\n");
exit(1);
}
#ifdef DEBUG_ICON
printf("parent edge values are %d, %d\n", parwPtr->rectWindow.left,
parwPtr->rectWindow.bottom);
#endif
wndPtr->ptIconPos.x = parwPtr->rectWindow.left + 10;
wndPtr->ptIconPos.y = parwPtr->rectWindow.bottom - 80;
#ifdef NOT
wndPtr->rectWindow.right = 100;
wndPtr->rectWindow.bottom = 32;
wndPtr->rectNormal.right = 1000;
wndPtr->rectNormal.bottom = 32;
wndPtr->rectClient.top= wndPtr->ptIconPos.y;
wndPtr->rectClient.left= wndPtr->ptIconPos.x;
wndPtr->rectClient.right = 100;
wndPtr->rectClient.bottom = 64;
#endif
wndPtr->rectClientSave = wndPtr->rectNormal;
myrect = wndPtr->rectClient;
MoveWindow(hwnd, wndPtr->ptIconPos.x, wndPtr->ptIconPos.y,
100, 64+20, FALSE);
XMoveWindow(display, wndPtr->icon,
wndPtr->ptIconPos.x, wndPtr->ptIconPos.y);
XMapWindow(display, wndPtr->icon);
SendMessage(hwnd, WM_PAINTICON, 0, 0);
#ifdef DEBUG_ICON
printf("done with iconify\n");
#endif
}
BOOL ICON_isAtPoint(HWND hwnd, POINT pt)
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
int iconWidth, iconHeight;
/****************
if (wndPtr->hwndParent != GetDesktopWindow()) {
pt.x -= wndPtr->rectClient.left;
pt.y -= wndPtr->rectClient.top;
}
*****************/
if (wndPtr->hIcon != (HICON)NULL) {
ICONALLOC *lpico;
lpico = (ICONALLOC *)GlobalLock(wndPtr->hIcon);
iconWidth = (int)lpico->descriptor.Width;
iconHeight = (int)lpico->descriptor.Height;
} else {
iconWidth = 64;
iconHeight = 64;
}
#ifdef DEBUG_ICON
printf("icon x,y is %d,%d\n",
wndPtr->ptIconPos.x, wndPtr->ptIconPos.y);
printf("icon end x,y is %d,%d\n",
wndPtr->ptIconPos.x + 100,
wndPtr->ptIconPos.y + iconHeight + 20);
printf("mouse pt x,y is %d,%d\n", pt.x, pt.y);
printf("%d\n", IsIconic(hwnd));
printf("%d\n", (pt.x >= wndPtr->ptIconPos.x));
printf("%d\n", (pt.x < wndPtr->ptIconPos.x + 100));
printf("%d\n", (pt.y >= wndPtr->ptIconPos.y));
printf("%d\n", (pt.y < wndPtr->ptIconPos.y + iconHeight + 20));
printf("%d\n", !(wndPtr->dwStyle & WS_DISABLED));
printf("%d\n", (wndPtr->dwStyle & WS_VISIBLE));
printf("%d\n", !(wndPtr->dwExStyle & WS_EX_TRANSPARENT));
#endif
if ( IsIconic(hwnd) &&
(pt.x >= wndPtr->ptIconPos.x) &&
(pt.x < wndPtr->ptIconPos.x + 100) &&
(pt.y >= wndPtr->ptIconPos.y) &&
(pt.y < wndPtr->ptIconPos.y + iconHeight + 20) &&
!(wndPtr->dwStyle & WS_DISABLED) &&
(wndPtr->dwStyle & WS_VISIBLE) &&
!(wndPtr->dwExStyle & WS_EX_TRANSPARENT))
{
#ifdef DEBUG_ICON
printf("got a winner!\n");
#endif
return 1;
}
return 0;
}
HWND ICON_findIconFromPoint(POINT pt)
{
HWND hwnd = GetTopWindow( GetDesktopWindow() );
WND *wndPtr;
HWND hwndRet = 0;
while (hwnd) {
if ( !(wndPtr=WIN_FindWndPtr(hwnd))) return 0;
if (ICON_isAtPoint(hwnd, pt)) {
#ifdef DEBUG_ICON
printf("returning\n");
#endif
return hwndRet = hwnd;
} else {
#ifdef DEBUG_ICON
printf("checking child\n");
#endif
hwnd = wndPtr->hwndChild;
}
}
return hwndRet;
}
ICON_Deiconify(HWND hwnd)
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
#ifdef DEBUG_ICON
printf("deiconifying\n");
#endif
XUnmapWindow(display, wndPtr->icon);
wndPtr->dwStyle &= ~WS_MINIMIZE;
/* wndPtr->rectNormal = myrect;
*/
MoveWindow(hwnd,
wndPtr->rectClientSave.left,
wndPtr->rectClientSave.top,
wndPtr->rectClientSave.right - wndPtr->rectClientSave.left,
wndPtr->rectClientSave.bottom - wndPtr->rectClientSave.top,
FALSE);
XMapWindow(display, wndPtr->window);
}
......@@ -16,7 +16,7 @@
#define DEBUG_MDI /* */
extern WORD MENU_DrawMenuBar( HDC hDC, LPRECT lprect,
HMENU hmenu, BOOL suppress_draw ); /* menu.c */
HWND hwnd, BOOL suppress_draw ); /* menu.c */
/**********************************************************************
* MDIRecreateMenuList
......@@ -310,6 +310,7 @@ LONG MDIRestoreChild(HWND parent, MDICLIENTINFO *ci)
ci->flagChildMaximized = FALSE;
ShowWindow(child, SW_RESTORE); /* display the window */
SendMessage(GetParent(parent), WM_NCPAINT, 1, 0);
MDIBringChildToTop(parent, child, FALSE, FALSE);
......@@ -571,7 +572,7 @@ LONG MDIPaintMaximized(HWND hwndFrame, HWND hwndClient, WORD message,
rect.right -= SYSMETRICS_CXSIZE;
rect.bottom = rect.top + SYSMETRICS_CYMENU;
MENU_DrawMenuBar(hdc, &rect, wndPtr->wIDmenu, FALSE);
MENU_DrawMenuBar(hdc, &rect, hwndFrame, FALSE);
DeleteDC(hdcMem);
ReleaseDC(hwndFrame, hdc);
......@@ -751,8 +752,6 @@ DefMDIChildProc(HWND hwnd, WORD message, WORD wParam, LONG lParam)
return SendMessage(GetParent(hwnd), WM_MDIMAXIMIZE, hwnd, 0);
case SC_RESTORE:
if (IsIconic(hwnd))
ICON_Deiconify(hwnd);
return SendMessage(GetParent(hwnd), WM_MDIRESTORE, hwnd, 0);
}
break;
......
......@@ -198,6 +198,7 @@ static void MSG_RemoveMsg( MESSAGEQUEUE * msgQueue, int pos )
* Return value indicates whether the translated message must be passed
* to the user.
* Actions performed:
* - Find the window for this message.
* - Translate button-down messages in double-clicks.
* - Send the WM_NCHITTEST message to find where the cursor is.
* - Activate the window if needed.
......@@ -208,6 +209,7 @@ static void MSG_RemoveMsg( MESSAGEQUEUE * msgQueue, int pos )
static BOOL MSG_TranslateMouseMsg( MSG *msg, BOOL remove )
{
BOOL eatMsg = FALSE;
LONG hittest_result;
static DWORD lastClickTime = 0;
static WORD lastClickMsg = 0;
static POINT lastClickPos = { 0, 0 };
......@@ -216,10 +218,29 @@ static BOOL MSG_TranslateMouseMsg( MSG *msg, BOOL remove )
(msg->message == WM_RBUTTONDOWN) ||
(msg->message == WM_MBUTTONDOWN));
/* Find the window */
if (GetCapture())
{
msg->hwnd = GetCapture();
msg->lParam = MAKELONG( msg->pt.x, msg->pt.y );
ScreenToClient( msg->hwnd, (LPPOINT)&msg->lParam );
return TRUE; /* No need to further process the message */
}
else msg->hwnd = WindowFromPoint( msg->pt );
/* Send the WM_NCHITTEST message */
LONG hittest_result = SendMessage( msg->hwnd, WM_NCHITTEST, 0,
MAKELONG( msg->pt.x, msg->pt.y ) );
hittest_result = SendMessage( msg->hwnd, WM_NCHITTEST, 0,
MAKELONG( msg->pt.x, msg->pt.y ) );
while ((hittest_result == HTTRANSPARENT) && (msg->hwnd))
{
msg->hwnd = GetParent(msg->hwnd);
if (!msg->hwnd)
hittest_result = SendMessage( msg->hwnd, WM_NCHITTEST, 0,
MAKELONG( msg->pt.x, msg->pt.y ) );
}
if (!msg->hwnd) msg->hwnd = GetDesktopWindow();
/* Send the WM_PARENTNOTIFY message */
......@@ -305,6 +326,29 @@ static BOOL MSG_TranslateMouseMsg( MSG *msg, BOOL remove )
}
/***********************************************************************
* MSG_TranslateKeyboardMsg
*
* Translate an keyboard hardware event into a real message.
* Return value indicates whether the translated message must be passed
* to the user.
*/
static BOOL MSG_TranslateKeyboardMsg( MSG *msg )
{
/* Should check Ctrl-Esc and PrintScreen here */
msg->hwnd = GetFocus();
if (!msg->hwnd)
{
/* Send the message to the active window instead, */
/* translating messages to their WM_SYS equivalent */
msg->hwnd = GetActiveWindow();
msg->message += WM_SYSKEYDOWN - WM_KEYDOWN;
}
return TRUE;
}
/**********************************************************************
* SetDoubleClickTime (USER.20)
*/
......@@ -391,30 +435,6 @@ void hardware_event( WORD message, WORD wParam, LONG lParam,
msg.pt.x = xPos & 0xffff;
msg.pt.y = yPos & 0xffff;
/* Determine the hwnd for this message */
/* Maybe this should be done in GetMessage() */
if (msg.hwnd = ICON_findIconFromPoint(msg.pt)) {
SendMessage( msg.hwnd, WM_SYSCOMMAND, SC_RESTORE, *(LONG*)&msg.pt );
return;
}
if ((message >= WM_MOUSEFIRST) && (message <= WM_MOUSELAST))
{
/* Mouse event */
if (GetCapture()) msg.hwnd = GetCapture();
else msg.hwnd = WindowFromPoint( msg.pt );
}
else if ((message >= WM_KEYFIRST) && (message <= WM_KEYLAST))
{
/* Keyboard event */
msg.hwnd = GetFocus();
if (!msg.hwnd && ((message==WM_KEYDOWN) || (message==WM_SYSKEYDOWN)))
MessageBeep(0); /* Beep on key press if no focus */
}
if (!msg.hwnd) return; /* No window for this message */
/* Merge with previous event if possible */
if (sysMsgQueue->msgCount && (message == WM_MOUSEMOVE))
......@@ -438,6 +458,7 @@ void hardware_event( WORD message, WORD wParam, LONG lParam,
* Like GetMessage(), but only return mouse and keyboard events.
* Used internally for window moving and resizing. Mouse messages
* are not translated.
* Warning: msg->hwnd is always 0.
*/
BOOL MSG_GetHardwareMessage( LPMSG msg )
{
......@@ -560,6 +581,9 @@ static BOOL MSG_PeekMessage( MESSAGEQUEUE * msgQueue, LPMSG msg, HWND hwnd,
int pos, mask;
LONG nextExp; /* Next timer expiration time */
XEvent event;
fd_set read_set;
struct timeval timeout;
int fd = ConnectionNumber(display);
if (first || last)
{
......@@ -572,25 +596,9 @@ static BOOL MSG_PeekMessage( MESSAGEQUEUE * msgQueue, LPMSG msg, HWND hwnd,
}
else mask = QS_MOUSE | QS_KEY | QS_POSTMESSAGE | QS_TIMER | QS_PAINT;
while (XPending( display ))
{
XNextEvent( display, &event );
EVENT_ProcessEvent( &event );
}
while(1)
{
/* First handle a WM_QUIT message */
if (msgQueue->wPostQMsg)
{
msg->hwnd = hwnd;
msg->message = WM_QUIT;
msg->wParam = msgQueue->wExitCode;
msg->lParam = 0;
break;
}
/* Then handle a message put by SendMessage() */
/* First handle a message put by SendMessage() */
if (msgQueue->status & QS_SENDMESSAGE)
{
if (!hwnd || (msgQueue->hWnd == hwnd))
......@@ -623,7 +631,7 @@ static BOOL MSG_PeekMessage( MESSAGEQUEUE * msgQueue, LPMSG msg, HWND hwnd,
}
/* Now find a hardware event */
pos = MSG_FindMsg( sysMsgQueue, hwnd, first, last );
pos = MSG_FindMsg( sysMsgQueue, 0, first, last );
if (pos != -1)
{
QMSG *qmsg = &sysMsgQueue->messages[pos];
......@@ -639,10 +647,27 @@ static BOOL MSG_PeekMessage( MESSAGEQUEUE * msgQueue, LPMSG msg, HWND hwnd,
MSG_RemoveMsg( sysMsgQueue, pos );
continue;
}
else if ((msg->message >= WM_KEYFIRST) &&
(msg->message <= WM_KEYLAST))
if (!MSG_TranslateKeyboardMsg( msg ))
{
MSG_RemoveMsg( sysMsgQueue, pos );
continue;
}
if (flags & PM_REMOVE) MSG_RemoveMsg( sysMsgQueue, pos );
break;
}
/* Now handle a WM_QUIT message */
if (msgQueue->wPostQMsg)
{
msg->hwnd = hwnd;
msg->message = WM_QUIT;
msg->wParam = msgQueue->wExitCode;
msg->lParam = 0;
break;
}
/* Now find a WM_PAINT message */
if ((msgQueue->status & QS_PAINT) && (mask & QS_PAINT))
{
......@@ -662,21 +687,27 @@ static BOOL MSG_PeekMessage( MESSAGEQUEUE * msgQueue, LPMSG msg, HWND hwnd,
else nextExp = -1; /* No timeout needed */
/* Wait until something happens */
if (peek) return FALSE;
if (!XPending( display ) && (nextExp != -1))
FD_ZERO( &read_set );
FD_SET( fd, &read_set );
if (peek)
{
timeout.tv_sec = 0;
timeout.tv_usec = 0;
if (select( fd+1, &read_set, NULL, NULL, &timeout ) != 1)
return FALSE; /* No data waiting to be read */
}
else if (!XPending( display ) && (nextExp != -1))
{
fd_set read_set;
struct timeval timeout;
int fd = ConnectionNumber(display);
FD_ZERO( &read_set );
FD_SET( fd, &read_set );
timeout.tv_sec = nextExp / 1000;
timeout.tv_usec = (nextExp % 1000) * 1000;
if (select( fd+1, &read_set, NULL, NULL, &timeout ) != 1)
continue; /* On timeout or error, restart from the start */
}
XNextEvent( display, &event );
EVENT_ProcessEvent( &event );
while (XPending( display ))
{
XNextEvent( display, &event );
EVENT_ProcessEvent( &event );
}
}
/* We got a message */
......@@ -825,11 +856,10 @@ void WaitMessage( void )
(appMsgQueue->status & (QS_SENDMESSAGE | QS_PAINT)) ||
(appMsgQueue->msgCount) || (sysMsgQueue->msgCount) )
break;
nextExp = -1;
if ((appMsgQueue->status & QS_TIMER) &&
TIMER_CheckTimer( &nextExp, &msg, 0, FALSE))
break;
else
nextExp=-1;
if (!XPending( display ) && (nextExp != -1))
{
......
......@@ -98,6 +98,14 @@ BOOL RedrawWindow( HWND hwnd, LPRECT rectUpdate, HRGN hrgnUpdate, UINT flags )
if (!hwnd) hwnd = GetDesktopWindow();
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return FALSE;
/*
* I can't help but feel that this belongs somewhere upstream...
*
* Don't redraw the window if it is iconified and we have an
* icon to draw for it
*/
if (IsIconic(hwnd) && wndPtr->hIcon) return FALSE;
GetClientRect( hwnd, &rectClient );
rectWindow = wndPtr->rectWindow;
OffsetRect(&rectWindow, -wndPtr->rectClient.left, -wndPtr->rectClient.top);
......
......@@ -134,7 +134,25 @@ static WORD TIMER_SetTimer( HWND hwnd, WORD id, WORD timeout,
if (!timeout) return 0;
if (!hwnd && !proc) return 0;
/* Check if there's already a timer with the same hwnd and id */
if (hwnd)
{
for (i = 0, pTimer = TimersArray; i < NB_TIMERS; i++, pTimer++)
if ((pTimer->hwnd == hwnd) && (pTimer->id == id) &&
(pTimer->timeout != 0))
{
/* Got one: set new values and return */
pTimer->timeout = timeout;
pTimer->expires = GetTickCount() + timeout;
pTimer->proc = proc;
TIMER_RemoveTimer( pTimer );
TIMER_InsertTimer( pTimer );
return id;
}
}
/* Find a free timer */
for (i = 0, pTimer = TimersArray; i < NB_TIMERS; i++, pTimer++)
......
......@@ -251,8 +251,7 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
CREATESTRUCT *createStruct;
HANDLE hcreateStruct;
int wmcreate;
XSetWindowAttributes win_attr, icon_attr;
int iconWidth, iconHeight;
XSetWindowAttributes win_attr;
#ifdef DEBUG_WIN
printf( "CreateWindowEx: %04X '%s' '%s' %04X %d,%d %dx%d %04X %04X %04X %08X\n",
......@@ -373,11 +372,7 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
/* Only select focus events on top-level override-redirect windows */
if (win_attr.override_redirect) win_attr.event_mask |= FocusChangeMask;
}
if (Options.nobackingstore)
win_attr.backing_store = NotUseful;
else
win_attr.backing_store = Always;
win_attr.backing_store = Options.backingstore ? WhenMapped : NotUseful;
win_attr.save_under = ((classPtr->wc.style & CS_SAVEBITS) != 0);
WINPOS_GetMinMaxInfo( hwnd, &maxSize, &maxPos, &minTrack, &maxTrack );
......@@ -392,7 +387,7 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
height = maxSize.y;
wndPtr->rectWindow.bottom = y + height;
}
wndPtr->window = XCreateWindow( display, parentPtr->window,
x + parentPtr->rectClient.left - parentPtr->rectWindow.left,
y + parentPtr->rectClient.top - parentPtr->rectWindow.top,
......@@ -403,42 +398,22 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
XStoreName( display, wndPtr->window, windowName );
/* create icon window */
icon_attr.override_redirect = rootWindow==DefaultRootWindow(display);
icon_attr.background_pixel = WhitePixelOfScreen(screen);
icon_attr.event_mask = ExposureMask | KeyPressMask |
ButtonPressMask | ButtonReleaseMask;
/*
* store icon handle, icon handle is kept in class. If we
* have an icon, make the icon size the size of the icon,
* if we don't have an icon, just give it 64x64
*/
wndPtr->hIcon = classPtr->wc.hIcon;
if (wndPtr->hIcon != (HICON)NULL) {
ICONALLOC *lpico;
lpico = (ICONALLOC *)GlobalLock(wndPtr->hIcon);
printf("icon is %d x %d\n",
(int)lpico->descriptor.Width,
(int)lpico->descriptor.Height);
iconWidth = (int)lpico->descriptor.Width;
iconHeight = (int)lpico->descriptor.Height;
wndPtr->iconWidth = (int)lpico->descriptor.Width;
wndPtr->iconHeight = (int)lpico->descriptor.Height;
} else {
printf("icon was NULL\n");
iconWidth = 64;
iconHeight = 64;
wndPtr->iconWidth = 64;
wndPtr->iconHeight = 64;
}
wndPtr->icon = XCreateWindow(display, parentPtr->window,
10, 10, 100, iconHeight+20,
0, CopyFromParent,
InputOutput, CopyFromParent,
CWBorderPixel | CWEventMask | CWOverrideRedirect,
&icon_attr);
if (style & WS_MINIMIZE)
{
style &= ~WS_MINIMIZE;
}
#ifdef DEBUG_MENU
printf("CreateWindowEx // menu=%04X instance=%04X classmenu=%08X !\n",
menu, instance, classPtr->wc.lpszMenuName);
......@@ -505,11 +480,12 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
else CURSOR_SetWinCursor( hwnd, LoadCursor( 0, IDC_ARROW ));
EVENT_RegisterWindow( wndPtr->window, hwnd );
EVENT_RegisterWindow( wndPtr->icon, hwnd );
WIN_SendParentNotify( hwnd, WM_CREATE, MAKELONG( hwnd, wndPtr->wIDmenu ) );
if (style & WS_VISIBLE) ShowWindow( hwnd, SW_SHOW );
/* if (style & WS_MINIMIZE) ShowWindow( hwnd, SW_MINIMIZE ); */
#ifdef DEBUG_WIN
printf( "CreateWindowEx: return %04X \n", hwnd);
#endif
......@@ -805,6 +781,27 @@ HWND GetParent(HWND hwnd)
return wndPtr->hwndParent;
}
/*****************************************************************
* SetParent (USER.233)
*/
HWND SetParent(HWND hwndChild, HWND hwndNewParent)
{
HWND temp;
WND *wndPtr = WIN_FindWndPtr(hwndChild);
if (!wndPtr || !(wndPtr->dwStyle & WS_CHILD)) return 0;
temp = wndPtr->hwndParent;
if (hwndNewParent)
wndPtr->hwndParent = hwndNewParent;
else
wndPtr->hwndParent = GetDesktopWindow();
return temp;
}
/*******************************************************************
* IsChild (USER.48)
......
......@@ -10,9 +10,12 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#include "user.h"
#include "win.h"
#include "message.h"
#include <assert.h>
static HWND hwndActive = 0; /* Currently active window */
/* #define DEBUG_WIN /**/
/***********************************************************************
* GetWindowRect (USER.32)
......@@ -220,6 +223,45 @@ BOOL MoveWindow( HWND hwnd, short x, short y, short cx, short cy, BOOL repaint)
}
/*
* hwnd is the handle to the first child window to hide
*/
static void WINPOS_hideChildren(HWND hwnd)
{
WND *wndPtr;
while (hwnd) {
ShowWindow(hwnd, SW_HIDE);
wndPtr = WIN_FindWndPtr(hwnd);
assert(wndPtr);
WINPOS_hideChildren(wndPtr->hwndChild);
hwnd = wndPtr->hwndNext;
}
}
static void WINPOS_ChildrenComeOutToPlay(HWND hwnd)
{
WND *wndPtr;
while (hwnd) {
/*
* we shouldn't really be calling SW_SHOWNOACTIVATE
* here because we wake up all windows, even the ones
* the user has decided to iconify or hide
*
* have to use SHOWNOACTIVATE instead of SHOWNORMAL
* since we are traversing the window tree and don't
* want windows linked/unlined under us
*/
ShowWindow(hwnd, SW_SHOWNOACTIVATE);
wndPtr = WIN_FindWndPtr(hwnd);
assert(wndPtr);
WINPOS_ChildrenComeOutToPlay(wndPtr->hwndChild);
hwnd = wndPtr->hwndNext;
}
}
/***********************************************************************
* ShowWindow (USER.42)
*/
......@@ -227,41 +269,72 @@ BOOL ShowWindow( HWND hwnd, int cmd )
{
WND * wndPtr = WIN_FindWndPtr( hwnd );
BOOL wasVisible;
BOOL wasIconic;
int swpflags = 0;
if (!wndPtr) return FALSE;
#ifdef DEBUG_WIN
printf("ShowWindow: hwnd=%04X, cmd=%d\n", hwnd, cmd);
#endif
if (!wndPtr) return FALSE;
/*
* wasVisible is true if user has not made window invisible
* wasIconic is true if the window is not iconified
*/
wasVisible = (wndPtr->dwStyle & WS_VISIBLE) != 0;
switch(cmd)
{
case SW_HIDE:
if (!wasVisible) return FALSE; /* Nothing to do */
/*
* if the window wasn't visible to begin with -- just return
*/
if (!wasVisible)
return FALSE; /* Nothing to do */
swpflags |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE |
SWP_NOACTIVATE | SWP_NOZORDER;
break;
case SW_SHOWMINNOACTIVE:
case SW_SHOWMINIMIZED:
case SW_SHOWMAXIMIZED:
case SW_MINIMIZE:
case SW_MINIMIZE:
wndPtr->dwStyle |= WS_MINIMIZE;
swpflags |= SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE |
SWP_NOACTIVATE | SWP_NOZORDER;
/*
* tell children that they are getting hidden
*/
WINPOS_hideChildren(wndPtr->hwndChild);
/* store the size and position of the window, so we can
* deiconify it to the same size and position
*/
wndPtr->rectNormal = wndPtr->rectWindow;
wndPtr->ptIconPos.x = wndPtr->rectWindow.left;
wndPtr->ptIconPos.y = wndPtr->rectWindow.top;
/* move the window to icon size and position and
* tell it that it is going to have to be painted
*/
MoveWindow(hwnd, wndPtr->ptIconPos.x, wndPtr->ptIconPos.y,
wndPtr->iconWidth, wndPtr->iconHeight, FALSE);
SendMessage(hwnd, WM_PAINTICON, 0, 0);
break;
case SW_SHOWNA:
case SW_MAXIMIZE:
case SW_SHOWMAXIMIZED: /* same as SW_MAXIMIZE: */
case SW_SHOW:
swpflags |= SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE;
break;
case SW_NORMAL:
case SW_SHOWNORMAL:
case SW_SHOWNORMAL: /* same as SW_NORMAL: */
case SW_SHOWNOACTIVATE:
case SW_RESTORE:
wasIconic = IsIconic(hwnd);
wndPtr->dwStyle &= ~WS_MINIMIZE;
wndPtr->dwStyle &= ~WS_MAXIMIZE;
swpflags |= SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE;
......@@ -270,8 +343,17 @@ BOOL ShowWindow( HWND hwnd, int cmd )
swpflags |= SWP_NOZORDER;
if (GetActiveWindow()) swpflags |= SWP_NOACTIVATE;
}
if (wasIconic) {
MoveWindow(hwnd, wndPtr->rectNormal.left,
wndPtr->rectNormal.top,
wndPtr->rectNormal.right - wndPtr->rectNormal.left,
wndPtr->rectNormal.bottom - wndPtr->rectNormal.top,
FALSE);
}
WINPOS_ChildrenComeOutToPlay(wndPtr->hwndChild);
break;
}
SendMessage( hwnd, WM_SHOWWINDOW, (cmd != SW_HIDE), 0 );
SetWindowPos( hwnd, 0, 0, 0, 0, 0, swpflags );
......@@ -288,6 +370,7 @@ BOOL ShowWindow( HWND hwnd, int cmd )
SendMessage( hwnd, WM_MOVE, 0,
MAKELONG(wndPtr->rectClient.left, wndPtr->rectClient.top) );
}
return wasVisible;
}
......
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