Commit 7ff1c415 authored by Alexandre Julliard's avatar Alexandre Julliard

Release 970525

Tue May 20 19:20:23 1997 Pablo Saratxaga <srtxg@linux.chanae.stben.be> * [resources/sysres_Es.rc] Updated CHOOSE_FONT, CHOOSE_COLOR, EDITMENU for Spanish. Mon May 19 22:06:04 1997 Michiel van Loon <mfvl@xs4all.nl> * [multimedia/mcistring.c] Corrected bug for device!element command. * [multimedia/mmaux.c] Replaced printf and fprintf calls by dprintf_mmaux. * [multimedia/audio.c] Corrected debugmessage in wodGetVolume. Include code for MCI_CUE command. * [multimedia/mmsystem.c] Added the MCIERR_SEQ error messages. * [if1632/mmsystem.spec] [multimedia/audio.c] [multimedia/mmsystem.c] Changed call structure of waveInOpen and waveOutOpen. * [multimedia/mmsystem.c] [multimedia/audio.c] [multimedia/midi.c] [multimedia/mmaux.c] [multimedia/mcicda.c] [multimedia/mcianim.c] [multimedia/mcistring.c] [include/mmsystem.h] Changed the deviceID scheme. * [include/queue.h] [include/win16drv.h] [msdos/dpmi.c] [windows/user.c] [windows/driver.c] [graphic/wing.c] [graphics/x11drv/bitmap.c] [misc/wsprintf.c] [misc/crtdll.c] Removed compiler warnings. Mon May 19 01:32:24 1997 Alex Korobka <alex@trantor.pharm.sunysb.edu> * [controls/menu.c] [windows/win.c] [windows/graphics.c] Popup menu shade, new system menu implementation, ModifyMenu() fixes, better check mark painting. * [windows/mdi.c] MDI client fix for Win32. Sat May 17 12:02:11 1997 Albrecht Kleine <kleine@ak.sax.de> * [objects/metafile.c] Added handling of META_DIBBITBLT, META_SETTEXTJUSTIFICATION plus bugfix in META_EXTTEXTOUT (start_of_text etc.) Thu May 15 22:52:00 1997 Jimen Ching <jching@flex.com> * [loader/ne_image.c] Make sure dgroup is valid by checking pModule->flags consistently.
parent 84c70f55
This is release 970509 of Wine, the MS Windows emulator. This is still a
This is release 970525 of Wine, the MS Windows emulator. This is still a
developer's only release. There are many bugs and many unimplemented API
features. Most applications still do not work correctly.
Patches should be submitted to "julliard@lrc.epfl.ch". Please don't
forget to include a ChangeLog entry.
WHAT'S NEW with Wine-970509: (see ChangeLog for details)
- Better local heap implementation.
- Improvements to -managed mode.
WHAT'S NEW with Wine-970525: (see ChangeLog for details)
- Many fixes to multimedia code.
- Better menus.
- Lots of bug fixes.
See the README file in the distribution for installation instructions.
......@@ -16,11 +16,10 @@ Because of lags created by using mirror, this message may reach you before
the release is available at the ftp sites. The sources will be available
from the following locations:
ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-970509.tar.gz
ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-970509.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-970509.tar.gz
ftp://aris.com/pub/linux/ALPHA/Wine/development/Wine-970509.tar.gz
ftp://ftp.progsoc.uts.edu.au/pub/Wine/development/Wine-970509.tar.gz
ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-970525.tar.gz
ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-970525.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-970525.tar.gz
ftp://ftp.progsoc.uts.edu.au/pub/Wine/development/Wine-970525.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite.
......
......@@ -40,8 +40,6 @@ Miscellaneous:
* 32-bit Freecell segfaults when started from the Progman (looks like
a problem with cards.dll).
* Word 6.0 often segfaults when system menu is double-clicked.
* Edit controls are prone to show blank space when, in fact, there is a
text there.
......
----------------------------------------------------------------------
Tue May 20 19:20:23 1997 Pablo Saratxaga <srtxg@linux.chanae.stben.be>
* [resources/sysres_Es.rc]
Updated CHOOSE_FONT, CHOOSE_COLOR, EDITMENU for Spanish.
Mon May 19 22:06:04 1997 Michiel van Loon <mfvl@xs4all.nl>
* [multimedia/mcistring.c]
Corrected bug for device!element command.
* [multimedia/mmaux.c]
Replaced printf and fprintf calls by dprintf_mmaux.
* [multimedia/audio.c]
Corrected debugmessage in wodGetVolume.
Include code for MCI_CUE command.
* [multimedia/mmsystem.c]
Added the MCIERR_SEQ error messages.
* [if1632/mmsystem.spec] [multimedia/audio.c] [multimedia/mmsystem.c]
Changed call structure of waveInOpen and waveOutOpen.
* [multimedia/mmsystem.c] [multimedia/audio.c] [multimedia/midi.c]
[multimedia/mmaux.c] [multimedia/mcicda.c] [multimedia/mcianim.c]
[multimedia/mcistring.c] [include/mmsystem.h]
Changed the deviceID scheme.
* [include/queue.h] [include/win16drv.h] [msdos/dpmi.c]
[windows/user.c] [windows/driver.c] [graphic/wing.c]
[graphics/x11drv/bitmap.c] [misc/wsprintf.c] [misc/crtdll.c]
Removed compiler warnings.
Mon May 19 01:32:24 1997 Alex Korobka <alex@trantor.pharm.sunysb.edu>
* [controls/menu.c] [windows/win.c] [windows/graphics.c]
Popup menu shade, new system menu implementation,
ModifyMenu() fixes, better check mark painting.
* [windows/mdi.c]
MDI client fix for Win32.
Sat May 17 12:02:11 1997 Albrecht Kleine <kleine@ak.sax.de>
* [objects/metafile.c]
Added handling of META_DIBBITBLT, META_SETTEXTJUSTIFICATION
plus bugfix in META_EXTTEXTOUT (start_of_text etc.)
Thu May 15 22:52:00 1997 Jimen Ching <jching@flex.com>
* [loader/ne_image.c]
Make sure dgroup is valid by checking pModule->flags consistently.
----------------------------------------------------------------------
Tue May 6 19:12:20 1997 Alexandre Julliard <julliard@lrc.epfl.ch>
* [loader/task.c] [loader/module.c]
......
......@@ -122,7 +122,7 @@ install_libwine.a: dummy
$(INSTALL_DATA) libwine.a $(libdir)
libwine.so.1.0: $(COMMONSUBDIRS) $(LIBSUBDIRS) dummy
$(CC) -shared -Wl,-soname,libwine.so.1 -o$@ $(COMMONOBJS) $(LIBOBJS) $(LDOPTIONS) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LDLIBS)
$(CC) -shared -Wl,-soname,libwine.so -o$@ $(COMMONOBJS) $(LIBOBJS) $(LDOPTIONS) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LDLIBS)
install_libwine.so.1.0: dummy
$(INSTALL_DATA) libwine.so.1.0 $(libdir)
......
......@@ -413,7 +413,7 @@ static void CB_Paint( WND *wndPtr, HDC32 hDC, WORD action )
else if (infoPtr->state & BUTTON_3STATE) y += 2 * checkBoxHeight;
GRAPH_DrawBitmap( hDC, hbitmapCheckBoxes, rbox.left, rbox.top + delta,
x, y, checkBoxWidth, checkBoxHeight );
x, y, checkBoxWidth, checkBoxHeight, FALSE );
if( textlen && action != ODA_SELECT )
{
if (wndPtr->dwStyle & WS_DISABLED)
......
......@@ -108,7 +108,7 @@ static LRESULT DESKTOP_DoEraseBkgnd( HWND32 hwnd, HDC32 hdc,
GRAPH_DrawBitmap( hdc, infoPtr->hbitmapWallPaper,
x, y, 0, 0,
infoPtr->bitmapSize.cx,
infoPtr->bitmapSize.cy );
infoPtr->bitmapSize.cy, FALSE );
}
else
{
......@@ -116,8 +116,9 @@ static LRESULT DESKTOP_DoEraseBkgnd( HWND32 hwnd, HDC32 hdc,
y = (rect.top + rect.bottom - infoPtr->bitmapSize.cy) / 2;
if (x < 0) x = 0;
if (y < 0) y = 0;
GRAPH_DrawBitmap( hdc, infoPtr->hbitmapWallPaper, x, y, 0, 0,
infoPtr->bitmapSize.cx, infoPtr->bitmapSize.cy );
GRAPH_DrawBitmap( hdc, infoPtr->hbitmapWallPaper,
x, y, 0, 0, infoPtr->bitmapSize.cx,
infoPtr->bitmapSize.cy, FALSE );
}
}
......
......@@ -724,6 +724,7 @@ static INT32 LISTBOX_FindString( WND *wnd, LB_DESCR *descr, INT32 start,
item = descr->items + start + 1;
if (HAS_STRINGS(descr))
{
if (!str) return LB_ERR;
if (exact)
{
for (i = start + 1; i < descr->nb_items; i++, item++)
......@@ -1915,6 +1916,11 @@ static LRESULT LISTBOX_HandleKeyDown( WND *wnd, LB_DESCR *descr, WPARAM32 wParam
!descr->items[descr->focus_item].selected,
(descr->style & LBS_NOTIFY) != 0 );
}
else if (descr->selected_item == -1)
{
LISTBOX_SetSelection( wnd, descr, descr->focus_item, TRUE,
(descr->style & LBS_NOTIFY) != 0 );
}
break;
}
if (caret >= 0)
......
......@@ -76,7 +76,7 @@ static WNDCLASS32A WIDGETS_BuiltinClasses32[BIC32_NB_CLASSES] =
ComboLBWndProc, 0, sizeof(void *), 0, 0, IDC_ARROW, 0, 0, "ComboLBox" },
/* BIC32_POPUPMENU */
{ CS_GLOBALCLASS | CS_SAVEBITS, PopupMenuWndProc,
0, sizeof(HMENU32), 0, 0, IDC_ARROW, 0, 0, POPUPMENU_CLASS_NAME },
0, sizeof(HMENU32), 0, 0, IDC_ARROW, NULL_BRUSH, 0, POPUPMENU_CLASS_NAME },
/* BIC32_SCROLL */
{ CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
ScrollBarWndProc, 0, sizeof(SCROLLBAR_INFO), 0, 0, IDC_ARROW, 0, 0, "ScrollBar"},
......
......@@ -1531,7 +1531,7 @@ void DEBUG_Disasm( DBG_ADDR *addr, int display )
}
if (seg)
fprintf(stderr,"%s:%d",seg, displ);
fprintf(stderr,"%s:0x%x",seg, displ);
else
db_task_printsym(displ, short_addr ? WORD : LONG);
break;
......
----- Information in this file is obsolete. -----
Winsock
Platform 1.
......
......@@ -981,10 +981,17 @@ LONG _hwrite32( HFILE32 hFile, LPCSTR buffer, LONG count )
if (count == 0) /* Expand or truncate at current position */
result = ftruncate( file->unix_handle,
lseek( file->unix_handle, 0, SEEK_CUR ) );
else
else for (;;)
{
result = write( file->unix_handle, buffer, count );
if (result != -1) break;
if (errno != EINTR)
{
FILE_SetDosError();
break;
}
}
if (result == -1) FILE_SetDosError();
FILE_ReleaseFile( file );
return result;
}
......
......@@ -20,6 +20,8 @@
#include "stddebug.h"
#include "debug.h"
extern void CLIPPING_UpdateGCRegion(DC* );
typedef enum WING_DITHER_TYPE
{
WING_DISPERSED_4x4, WING_DISPERSED_8x8, WING_CLUSTERED_4x4
......
......@@ -16,6 +16,8 @@
#include "stddebug.h"
#include "debug.h"
extern void CLIPPING_UpdateGCRegion(DC* );
/***********************************************************************
* X11DRV_BITMAP_Init
*/
......
......@@ -332,6 +332,9 @@ BOOL32 X11DRV_GetTextMetrics(DC *dc, TEXTMETRIC32A *metrics)
/***********************************************************************
* X11DRV_FONT_SelectObject
*
* FIXME: the fonts should not be cached by hfont only, because
* metrics may be different in an other DC.
*/
HFONT32 X11DRV_FONT_SelectObject( DC * dc, HFONT32 hfont, FONTOBJ * font )
{
......
......@@ -55,7 +55,7 @@ type win16
401 pascal WAVEOUTGETNUMDEVS() waveOutGetNumDevs
402 pascal WAVEOUTGETDEVCAPS(word segptr word) waveOutGetDevCaps
403 pascal WAVEOUTGETERRORTEXT(word ptr word) waveOutGetErrorText
404 pascal WAVEOUTOPEN(ptr word ptr long long long) waveOutOpen
404 pascal WAVEOUTOPEN(ptr word segptr long long long) waveOutOpen
405 pascal WAVEOUTCLOSE(word) waveOutClose
406 pascal WAVEOUTPREPAREHEADER(word segptr word) waveOutPrepareHeader
407 pascal WAVEOUTUNPREPAREHEADER(word segptr word) waveOutUnprepareHeader
......@@ -76,7 +76,7 @@ type win16
501 pascal WAVEINGETNUMDEVS() waveInGetNumDevs
502 pascal WAVEINGETDEVCAPS(word segptr word) waveInGetDevCaps
503 pascal WAVEINGETERRORTEXT(word ptr word) waveInGetErrorText
504 pascal WAVEINOPEN(ptr word ptr long long long) waveInOpen
504 pascal WAVEINOPEN(ptr word segptr long long long) waveInOpen
505 pascal WAVEINCLOSE(word) waveInClose
506 pascal WAVEINPREPAREHEADER(word segptr word) waveInPrepareHeader
507 pascal WAVEINUNPREPAREHEADER(word segptr word) waveInUnprepareHeader
......
......@@ -50,7 +50,7 @@ type win16
107 pascal16 WSAAsyncGetServByName(word word ptr ptr segptr word)
WSAAsyncGetServByName
108 pascal16 WSACancelAsyncRequest(word) WSACancelAsyncRequest
109 pascal16 WSASetBlockingHook() WSASetBlockingHook
109 pascal16 WSASetBlockingHook(segptr) WSASetBlockingHook16
110 pascal16 WSAUnhookBlockingHook() WSAUnhookBlockingHook
111 pascal16 WSAGetLastError() WSAGetLastError
112 pascal WSASetLastError(word) WSASetLastError
......
......@@ -40,7 +40,7 @@ base 0
106 stub WSAAsyncGetServByPort
107 stub WSAAsyncGetServByName
108 stub WSACancelAsyncRequest
109 stub WSASetBlockingHook
109 stdcall WSASetBlockingHook(ptr) WSASetBlockingHook32
110 stub WSAUnhookBlockingHook
111 stub WSAGetLastError
112 stub WSASetLastError
......
......@@ -42,7 +42,7 @@ extern GC BITMAP_monoGC, BITMAP_colorGC;
#define XCREATEIMAGE(image,width,height,bpp) \
{ \
int width_bytes = DIB_GetImageWidthBytesX11( (width), (bpp) ); \
int width_bytes = DIB_GetXImageWidthBytes( (width), (bpp) ); \
(image) = XCreateImage(display, DefaultVisualOfScreen(screen), \
(bpp), ZPixmap, 0, xmalloc( (height)*width_bytes ),\
(width), (height), 32, width_bytes ); \
......@@ -55,8 +55,8 @@ extern INT32 BITMAP_GetObject32( BITMAPOBJ * bmp, INT32 count, LPVOID buffer );
extern BOOL32 BITMAP_DeleteObject( HBITMAP16 hbitmap, BITMAPOBJ * bitmap );
/* objects/dib.c */
extern int DIB_GetImageWidthBytes( int width, int depth );
extern int DIB_GetImageWidthBytesX11( int width, int depth );
extern int DIB_GetDIBWidthBytes( int width, int depth );
extern int DIB_GetXImageWidthBytes( int width, int depth );
extern int DIB_BitmapInfoSize( BITMAPINFO * info, WORD coloruse );
/* objects/oembitmap.c */
......
......@@ -8,6 +8,7 @@
#define COLOR_VIRTUAL 0x0002 /* no mapping needed - pixel == pixel color */
#define COLOR_PRIVATE 0x1000 /* private colormap, identity mapping */
#define COLOR_WHITESET 0x2000
#define PC_SYS_USED 0x80 /* palentry is used (both system and logical) */
#define PC_SYS_RESERVED 0x40 /* system palentry is not to be mapped to */
......@@ -22,6 +23,7 @@ extern BOOL32 COLOR_IsSolid( COLORREF color );
extern Colormap COLOR_GetColormap();
extern UINT16 COLOR_GetSystemPaletteSize();
extern UINT16 COLOR_GetSystemPaletteFlags();
extern BOOL32 COLOR_GetMonoPlane( int* );
extern COLORREF COLOR_LookupNearestColor( PALETTEENTRY*, int, COLORREF );
extern int COLOR_PaletteLookupPixel( PALETTEENTRY*, int, int* , COLORREF, BOOL32 );
......
......@@ -18,7 +18,7 @@ extern void GRAPH_DrawRectangle( HDC32 hdc, INT32 x, INT32 y,
INT32 width, INT32 height, HPEN32 hPen);
extern BOOL32 GRAPH_DrawBitmap( HDC32 hdc, HBITMAP32 hbitmap,
INT32 xdest, INT32 ydest, INT32 xsrc,
INT32 ysrc, INT32 width, INT32 height );
INT32 ysrc, INT32 width, INT32 height, BOOL32 bMono );
extern BOOL32 GRAPH_SelectClipMask( HDC32 hdc, HBITMAP32 hMono,
INT32 x, INT32 y );
......
......@@ -31,15 +31,15 @@ typedef struct tagMDIWCL
typedef struct
{
WORD nActiveChildren;
UINT16 nActiveChildren;
HWND16 hwndChildMaximized;
HWND16 hwndActiveChild;
HMENU16 hWindowMenu;
WORD idFirstChild;
WORD nTotalCreated;
UINT32 idFirstChild;
LPSTR frameTitle;
WORD sbNeedUpdate;
WORD sbRecalc;
UINT16 nTotalCreated;
UINT16 mdiFlags;
UINT16 sbRecalc; /* SB_xxx flags for scrollbar fixup */
HWND16 self;
} MDICLIENTINFO;
......
......@@ -6,7 +6,7 @@
#define __WINE_MENU_H
extern BOOL32 MENU_Init(void);
extern HMENU32 MENU_GetDefSysMenu(void);
extern HMENU32 MENU_GetSysMenu(HWND32 hWndOwner, HMENU32 hSysPopup);
extern void MENU_InitSysMenuPopup(HMENU32 hmenu, DWORD style, DWORD clsStyle);
extern UINT32 MENU_GetMenuBarHeight( HWND32 hwnd, UINT32 menubarWidth,
INT32 orgX, INT32 orgY );
......
......@@ -1485,6 +1485,7 @@ typedef struct {
LPWAVEFORMAT lpFormat;
DWORD dwCallBack;
DWORD dwInstance;
UINT16 uDeviceID;
} WAVEOPENDESC, *LPWAVEOPENDESC;
typedef struct {
......
......@@ -75,8 +75,8 @@ typedef struct tagMESSAGEQUEUE
extern void QUEUE_DumpQueue( HQUEUE16 hQueue );
extern void QUEUE_WalkQueues(void);
extern BOOL32 QUEUE_IsDoomedQueue( HQUEUE16 hQueue );
extern void QUEUE_SetDoomedQueue( HQUEUE16 hQueue );
extern BOOL32 QUEUE_IsExitingQueue( HQUEUE16 hQueue );
extern void QUEUE_SetExitingQueue( HQUEUE16 hQueue );
extern MESSAGEQUEUE *QUEUE_GetSysQueue(void);
extern void QUEUE_SetWakeBit( MESSAGEQUEUE *queue, WORD bit );
extern void QUEUE_ClearWakeBit( MESSAGEQUEUE *queue, WORD bit );
......@@ -95,5 +95,6 @@ extern int QUEUE_FindMsg( MESSAGEQUEUE * msgQueue, HWND32 hwnd,
extern void QUEUE_RemoveMsg( MESSAGEQUEUE * msgQueue, int pos );
extern void hardware_event( WORD message, WORD wParam, LONG lParam,
int xPos, int yPos, DWORD time, DWORD extraInfo );
extern void QUEUE_FlushMessages( HQUEUE16 hQueue );
#endif /* __WINE_QUEUE_H */
......@@ -123,6 +123,7 @@
#undef DEBUG_MESSAGE
#undef DEBUG_METAFILE
#undef DEBUG_MIDI
#undef DEBUG_MMAUX
#undef DEBUG_MMIO
#undef DEBUG_MMSYS
#undef DEBUG_MMTIME
......@@ -205,6 +206,7 @@
#define DEBUG_MESSAGE
#define DEBUG_METAFILE
#define DEBUG_MIDI
#define DEBUG_MMAUX
#define DEBUG_MMIO
#define DEBUG_MMSYS
#define DEBUG_MMTIME
......
......@@ -281,7 +281,13 @@ BOOL32 NE_LoadSegment( HMODULE16 hModule, WORD segnum )
offset = rep->offset;
switch (rep->address_type)
/* Apparently, high bit of address_type is sometimes set; */
/* we ignore it for now */
if (rep->address_type & 0x80)
fprintf( stderr, "Warning: reloc addr type = 0x%02x\n",
rep->address_type );
switch (rep->address_type & 0x7f)
{
case NE_RADDR_LOWBYTE:
do {
......@@ -415,12 +421,16 @@ void NE_FixupPrologs( NE_MODULE *pModule )
{
if (*p & 0x0002)
{
if (pModule->flags & NE_FFLAGS_MULTIPLEDATA) {
if (pModule->flags & NE_FFLAGS_MULTIPLEDATA)
{
/* can this happen? */
fprintf( stderr, "FixupPrologs got confused\n" );
}
*fixup_ptr = 0xb8; /* MOV AX, */
*(WORD *)(fixup_ptr+1) = dgroup;
else if (pModule->flags & NE_FFLAGS_SINGLEDATA)
{
*fixup_ptr = 0xb8; /* MOV AX, */
*(WORD *)(fixup_ptr+1) = dgroup;
}
}
else
{
......
......@@ -872,7 +872,7 @@ HGLOBAL32 GlobalAlloc32(UINT32 flags, DWORD size)
pintern=HeapAlloc(GetProcessHeap(), 0, sizeof(GLOBAL32_INTERN));
if(size)
{
palloc=HeapAlloc(GetProcessHeap(), 0, size+sizeof(HGLOBAL32));
palloc=HeapAlloc(GetProcessHeap(), hpflags, size+sizeof(HGLOBAL32));
*(HGLOBAL32 *)palloc=INTERN_TO_HANDLE(pintern);
pintern->Pointer=palloc+sizeof(HGLOBAL32);
}
......
......@@ -202,7 +202,8 @@ static BOOL32 FILEDLG_ScanDir(HWND16 hWnd, LPSTR newPath)
len = strlen(str);
GetDlgItemText32A( hWnd, edt1, str + len, sizeof(str) - len );
if (!DlgDirList32A( hWnd, str, lst1, 0, 0x0000 )) return FALSE;
return DlgDirList32A( hWnd, "*.*", lst2, stc1, 0x8010 );
strcpy( str, "*.*" );
return DlgDirList32A( hWnd, str, lst2, stc1, 0x8010 );
}
/***********************************************************************
......@@ -409,7 +410,8 @@ static LONG FILEDLG_WMInitDialog(HWND16 hWnd, WPARAM16 wParam, LPARAM lParam)
lpofn->nFilterIndex, tmpstr);
SetDlgItemText32A( hWnd, edt1, tmpstr );
/* get drive list */
DlgDirListComboBox32A(hWnd, "", cmb2, 0, 0xC000);
*tmpstr = 0;
DlgDirListComboBox32A(hWnd, tmpstr, cmb2, 0, 0xC000);
/* read initial directory */
if (PTR_SEG_TO_LIN(lpofn->lpstrInitialDir) != NULL)
{
......
......@@ -25,6 +25,8 @@
#include "crtdll.h"
#include "drive.h"
extern INT32 WIN32_wsprintf32W( DWORD *args );
UINT32 CRTDLL_argc_dll; /* CRTDLL.23 */
LPSTR *CRTDLL_argv_dll; /* CRTDLL.24 */
LPSTR CRTDLL_acmdln_dll; /* CRTDLL.38 */
......
......@@ -628,19 +628,31 @@ INT16 WINSOCK_ioctlsocket(SOCKET16 s, UINT32 cmd, UINT32 *argp)
switch( cmd )
{
case WS_FIONREAD: newcmd=FIONREAD; break;
case WS_FIONBIO: newcmd=FIONBIO;
if( pws->p_aop && *argp == 0 )
{
pwsi->err = WSAEINVAL;
return SOCKET_ERROR;
}
break;
case WS_SIOCATMARK: newcmd=SIOCATMARK; break;
case WS_FIONREAD:
newcmd=FIONREAD;
break;
case WS_FIONBIO:
newcmd=FIONBIO;
if( pws->p_aop && *argp == 0 )
{
pwsi->err = WSAEINVAL;
return SOCKET_ERROR;
}
break;
case WS_SIOCATMARK:
newcmd=SIOCATMARK;
break;
case WS_IOW('f',125,u_long):
fprintf(stderr,"Warning: WS1.1 shouldn't be using async I/O\n");
pwsi->err = WSAEINVAL; return SOCKET_ERROR;
default: fprintf(stderr,"Warning: Unknown WS_IOCTL cmd (%08x)\n", cmd);
fprintf(stderr,"Warning: WS1.1 shouldn't be using async I/O\n");
pwsi->err = WSAEINVAL;
return SOCKET_ERROR;
default:
/* Netscape tries hard to use bogus ioctl 0x667e */
dprintf_winsock(stddeb,"\tunknown WS_IOCTL cmd (%08x)\n", cmd);
}
if( ioctl(pws->fd, newcmd, (char*)argp ) == 0 ) return 0;
pwsi->err = (errno == EBADF) ? WSAENOTSOCK : wsaErrno();
......@@ -1429,7 +1441,7 @@ INT16 WSACancelBlockingCall(void)
return SOCKET_ERROR;
}
FARPROC16 WSASetBlockingHook(FARPROC16 lpBlockFunc)
FARPROC16 WSASetBlockingHook16(FARPROC16 lpBlockFunc)
{
FARPROC16 prev;
LPWSINFO pwsi = wsi_find(GetCurrentTask());
......@@ -1445,6 +1457,12 @@ FARPROC16 WSASetBlockingHook(FARPROC16 lpBlockFunc)
return 0;
}
FARPROC32 WSASetBlockingHook32(FARPROC32 lpBlockFunc)
{
fprintf( stderr, "Empty stub WSASetBlockingHook32(%p)\n", lpBlockFunc );
return NULL;
}
INT16 WSAUnhookBlockingHook(void)
{
LPWSINFO pwsi = wsi_find(GetCurrentTask());
......
......@@ -524,7 +524,7 @@ INT32 wsprintf32A( LPSTR buffer, LPCSTR spec, ... )
}
/* Emulator version */
INT32 WIN32_wsprintf32A( int *args )
INT32 WIN32_wsprintf32A( DWORD *args )
{
return wvsprintf32A( (LPSTR)args[0], (LPCSTR)args[1], (LPCVOID)&args[2] );
}
......@@ -546,7 +546,7 @@ INT32 wsprintf32W( LPWSTR buffer, LPCWSTR spec, ... )
}
/* Emulator version */
INT32 WIN32_wsprintf32W( int *args )
INT32 WIN32_wsprintf32W( DWORD *args )
{
return wvsprintf32W( (LPWSTR)args[0], (LPCWSTR)args[1], (LPCVOID)&args[2]);
}
......@@ -20,6 +20,8 @@
#define DOS_GET_DRIVE(reg) ((reg) ? (reg) - 1 : DRIVE_GetCurrentDrive())
void CreateBPB(int drive, BYTE *data); /* defined in int21.c */
/* Structure for real-mode callbacks */
typedef struct
......
......@@ -311,6 +311,7 @@ MCISTR_Open(_MCISTR_PROTO_) {
if (s!=NULL) {
*s++='\0';
pU->openParams.lpstrElementName=SEGPTR_GET(SEGPTR_STRDUP(s));
dwFlags |= MCI_OPEN_ELEMENT;
}
if (!STRCMP(dev,"cdaudio")) {
uDevTyp=MCI_DEVTYPE_CD_AUDIO;
......@@ -338,7 +339,7 @@ MCISTR_Open(_MCISTR_PROTO_) {
}
}
GetDrv(wDevID)->wType = uDevTyp;
GetDrv(wDevID)->wDeviceID = wDevID;
GetDrv(wDevID)->wDeviceID = 0; /* FIXME? for multiple devices */
pU->openParams.dwCallback = 0;
pU->openParams.wDeviceID = wDevID;
pU->ovlyopenParams.dwStyle = 0;
......
......@@ -18,9 +18,12 @@
#ifdef linux
#include <linux/soundcard.h>
#elif __FreeBSD__
#include <machine/soundcard.h>
#endif
int MMSYSTEM_DevIDToIndex(UINT16);
#include "stddebug.h"
#include "debug.h"
#define SOUND_DEV "/dev/dsp"
#define MIXER_DEV "/dev/mixer"
......@@ -45,15 +48,15 @@ static DWORD AUX_GetDevCaps(WORD wDevID, LPAUXCAPS lpCaps, DWORD dwSize)
#ifdef linux
int mixer;
int volume;
printf("AUX_GetDevCaps(%04X, %p, %lu);\n", wDevID, lpCaps, dwSize);
dprintf_mmaux(stddeb,"AUX_GetDevCaps(%04X, %p, %lu);\n", wDevID, lpCaps, dwSize);
if (lpCaps == NULL) return MMSYSERR_NOTENABLED;
if ((mixer = open(MIXER_DEV, O_RDWR)) < 0) {
printf("AUX_GetDevCaps // mixer device not available !\n");
dprintf_mmaux(stddeb,"AUX_GetDevCaps // mixer device not available !\n");
return MMSYSERR_NOTENABLED;
}
if (ioctl(mixer, SOUND_MIXER_READ_LINE, &volume) == -1) {
close(mixer);
printf("AUX_GetDevCaps // unable read mixer !\n");
dprintf_mmaux(stddeb,"AUX_GetDevCaps // unable read mixer !\n");
return MMSYSERR_NOTENABLED;
}
close(mixer);
......@@ -61,7 +64,7 @@ static DWORD AUX_GetDevCaps(WORD wDevID, LPAUXCAPS lpCaps, DWORD dwSize)
lpCaps->wMid = 0x0002;
lpCaps->vDriverVersion = 0x0200;
lpCaps->dwSupport = AUXCAPS_VOLUME | AUXCAPS_LRVOLUME;
switch (MMSYSTEM_DevIDToIndex(wDevID)) {
switch (wDevID) {
case 0:
lpCaps->wPid = 0x0196;
strcpy(lpCaps->szPname, "SB16 Aux: Wave");
......@@ -117,49 +120,50 @@ static DWORD AUX_GetVolume(WORD wDevID, LPDWORD lpdwVol)
int mixer;
int volume, left, right;
int cmd;
printf("AUX_GetVolume(%04X, %p);\n", wDevID, lpdwVol);
dprintf_mmaux(stddeb,"AUX_GetVolume(%04X, %p);\n", wDevID, lpdwVol);
if (lpdwVol == NULL) return MMSYSERR_NOTENABLED;
if ((mixer = open(MIXER_DEV, O_RDWR)) < 0) {
printf("Linux 'AUX_GetVolume' // mixer device not available !\n");
dprintf_mmaux(stddeb,"Linux 'AUX_GetVolume' // mixer device not available !\n");
return MMSYSERR_NOTENABLED;
}
switch(MMSYSTEM_DevIDToIndex(wDevID)) {
switch(wDevID) {
case 0:
printf("Linux 'AUX_GetVolume' // SOUND_MIXER_READ_PCM !\n");
dprintf_mmaux(stddeb,"Linux 'AUX_GetVolume' // SOUND_MIXER_READ_PCM !\n");
cmd = SOUND_MIXER_READ_PCM;
break;
case 1:
printf("Linux 'AUX_GetVolume' // SOUND_MIXER_READ_SYNTH !\n");
dprintf_mmaux(stddeb,"Linux 'AUX_GetVolume' // SOUND_MIXER_READ_SYNTH !\n");
cmd = SOUND_MIXER_READ_SYNTH;
break;
case 2:
printf("Linux 'AUX_GetVolume' // SOUND_MIXER_READ_CD !\n");
dprintf_mmaux(stddeb,"Linux 'AUX_GetVolume' // SOUND_MIXER_READ_CD !\n");
cmd = SOUND_MIXER_READ_CD;
break;
case 3:
printf("Linux 'AUX_GetVolume' // SOUND_MIXER_READ_LINE !\n");
dprintf_mmaux(stddeb,"Linux 'AUX_GetVolume' // SOUND_MIXER_READ_LINE !\n");
cmd = SOUND_MIXER_READ_LINE;
break;
case 4:
printf("Linux 'AUX_GetVolume' // SOUND_MIXER_READ_MIC !\n");
dprintf_mmaux(stddeb,"Linux 'AUX_GetVolume' // SOUND_MIXER_READ_MIC !\n");
cmd = SOUND_MIXER_READ_MIC;
break;
case 5:
printf("Linux 'AUX_GetVolume' // SOUND_MIXER_READ_VOLUME !\n");
dprintf_mmaux(stddeb,"Linux 'AUX_GetVolume' // SOUND_MIXER_READ_VOLUME !\n");
cmd = SOUND_MIXER_READ_VOLUME;
break;
default:
fprintf(stderr, "Linux 'AUX_GetVolume' // invalid device id=%04X !\n", wDevID);
dprintf_mmaux(stddeb, "Linux 'AUX_GetVolume' // invalid device id=%04X !\n", wDevID);
return MMSYSERR_NOTENABLED;
}
if (ioctl(mixer, cmd, &volume) == -1) {
printf("Linux 'AUX_GetVolume' // unable read mixer !\n");
dprintf_mmaux(stddeb,"Linux 'AUX_GetVolume' // unable read mixer !\n");
return MMSYSERR_NOTENABLED;
}
close(mixer);
left = volume & 0x7F;
right = (volume >> 8) & 0x7F;
printf("Linux 'AUX_GetVolume' // left=%d right=%d !\n", left, right);
dprintf_mmaux(stddeb,"Linux 'AUX_GetVolume' // left=%d right=%d !\n", left, right);
*lpdwVol = MAKELONG(left << 9, right << 9);
return MMSYSERR_NOERROR;
#else
......@@ -176,44 +180,44 @@ static DWORD AUX_SetVolume(WORD wDevID, DWORD dwParam)
int mixer;
int volume;
int cmd;
printf("AUX_SetVolume(%04X, %08lX);\n", wDevID, dwParam);
dprintf_mmaux(stddeb,"AUX_SetVolume(%04X, %08lX);\n", wDevID, dwParam);
volume = (LOWORD(dwParam) >> 9 & 0x7F) +
((HIWORD(dwParam) >> 9 & 0x7F) << 8);
if ((mixer = open(MIXER_DEV, O_RDWR)) < 0) {
printf("Linux 'AUX_SetVolume' // mixer device not available !\n");
dprintf_mmaux(stddeb,"Linux 'AUX_SetVolume' // mixer device not available !\n");
return MMSYSERR_NOTENABLED;
}
switch(MMSYSTEM_DevIDToIndex(wDevID)) {
switch(wDevID) {
case 0:
printf("Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_PCM !\n");
dprintf_mmaux(stddeb,"Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_PCM !\n");
cmd = SOUND_MIXER_WRITE_PCM;
break;
case 1:
printf("Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_SYNTH !\n");
dprintf_mmaux(stddeb,"Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_SYNTH !\n");
cmd = SOUND_MIXER_WRITE_SYNTH;
break;
case 2:
printf("Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_CD !\n");
dprintf_mmaux(stddeb,"Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_CD !\n");
cmd = SOUND_MIXER_WRITE_CD;
break;
case 3:
printf("Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_LINE !\n");
dprintf_mmaux(stddeb,"Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_LINE !\n");
cmd = SOUND_MIXER_WRITE_LINE;
break;
case 4:
printf("Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_MIC !\n");
dprintf_mmaux(stddeb,"Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_MIC !\n");
cmd = SOUND_MIXER_WRITE_MIC;
break;
case 5:
printf("Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_VOLUME !\n");
dprintf_mmaux(stddeb,"Linux 'AUX_SetVolume' // SOUND_MIXER_WRITE_VOLUME !\n");
cmd = SOUND_MIXER_WRITE_VOLUME;
break;
default:
fprintf(stderr, "Linux 'AUX_SetVolume' // invalid device id=%04X !\n", wDevID);
dprintf_mmaux(stddeb, "Linux 'AUX_SetVolume' // invalid device id=%04X !\n", wDevID);
return MMSYSERR_NOTENABLED;
}
if (ioctl(mixer, cmd, &volume) == -1) {
printf("Linux 'AUX_SetVolume' // unable set mixer !\n");
dprintf_mmaux(stddeb,"Linux 'AUX_SetVolume' // unable set mixer !\n");
return MMSYSERR_NOTENABLED;
}
close(mixer);
......@@ -230,21 +234,21 @@ static DWORD AUX_SetVolume(WORD wDevID, DWORD dwParam)
DWORD auxMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
DWORD dwParam1, DWORD dwParam2)
{
printf("auxMessage(%04X, %04X, %08lX, %08lX, %08lX);\n",
dprintf_mmaux(stddeb,"auxMessage(%04X, %04X, %08lX, %08lX, %08lX);\n",
wDevID, wMsg, dwUser, dwParam1, dwParam2);
switch(wMsg) {
case AUXDM_GETDEVCAPS:
return AUX_GetDevCaps(wDevID,
(LPAUXCAPS)PTR_SEG_TO_LIN(dwParam1), dwParam2);
case AUXDM_GETNUMDEVS:
printf("AUX_GetNumDevs() return %d;\n", NumDev);
dprintf_mmaux(stddeb,"AUX_GetNumDevs() return %d;\n", NumDev);
return NumDev;
case AUXDM_GETVOLUME:
return AUX_GetVolume(wDevID, (LPDWORD)PTR_SEG_TO_LIN(dwParam1));
case AUXDM_SETVOLUME:
return AUX_SetVolume(wDevID, dwParam1);
default:
fprintf(stderr,"auxMessage // unknown message !\n");
dprintf_mmaux(stddeb,"auxMessage // unknown message !\n");
}
return MMSYSERR_NOTSUPPORTED;
}
......@@ -86,7 +86,7 @@ static VOID TIME_MMSysTimeCallback( HWND32 hwnd, UINT32 msg,
/**************************************************************************
* StartMMTime [internal]
*/
void StartMMTime()
static void StartMMTime()
{
if (!mmTimeStarted) {
mmTimeStarted = TRUE;
......
......@@ -201,7 +201,7 @@ LONG GetBitmapBits32( HBITMAP32 hbitmap, LONG count, LPVOID buffer )
return 0;
}
widthbytes = DIB_GetImageWidthBytesX11(bmp->bitmap.bmWidth,bmp->bitmap.bmBitsPixel);
widthbytes = DIB_GetXImageWidthBytes(bmp->bitmap.bmWidth,bmp->bitmap.bmBitsPixel);
tmpbuffer = (LPBYTE)xmalloc(widthbytes*height);
image = XCreateImage( display, DefaultVisualOfScreen(screen),
bmp->bitmap.bmBitsPixel, ZPixmap, 0, tmpbuffer,
......@@ -223,8 +223,10 @@ LONG GetBitmapBits32( HBITMAP32 hbitmap, LONG count, LPVOID buffer )
*tbuf = 0;
for (w=0;w<bmp->bitmap.bmWidth;w++)
{
if ((w%8) == 0)
*tbuf = 0;
*tbuf |= XGetPixel(image,w,h)<<(7-(w&7));
if ((w&7) == 7) *(++tbuf) = 0;
if ((w&7) == 7) ++tbuf;
}
tbuf += pad;
}
......@@ -348,7 +350,7 @@ LONG SetBitmapBits32( HBITMAP32 hbitmap, LONG count, LPCVOID buffer )
}
sbuf = (LPBYTE)buffer;
widthbytes = DIB_GetImageWidthBytesX11(bmp->bitmap.bmWidth,bmp->bitmap.bmBitsPixel);
widthbytes = DIB_GetXImageWidthBytes(bmp->bitmap.bmWidth,bmp->bitmap.bmBitsPixel);
tmpbuffer = (LPBYTE)xmalloc(widthbytes*height);
image = XCreateImage( display, DefaultVisualOfScreen(screen),
bmp->bitmap.bmBitsPixel, ZPixmap, 0, tmpbuffer,
......
......@@ -40,6 +40,8 @@ typedef struct
Colormap colorMap;
UINT16 size;
UINT16 flags;
INT32 monoPlane; /* bit plane different for white and black pixels */
BOOL32 bWhiteOn; /* monoPlane bit is 1 for the white pixel */
} CSPACE;
static CSPACE cSpace = {0, 0, 0};
......@@ -125,6 +127,12 @@ Colormap COLOR_GetColormap(void)
return cSpace.colorMap;
}
BOOL32 COLOR_GetMonoPlane(INT32* plane)
{
*plane = cSpace.monoPlane;
return (cSpace.flags & COLOR_WHITESET) ? TRUE : FALSE;
}
UINT16 COLOR_GetSystemPaletteSize(void)
{
return (cSpace.flags & COLOR_PRIVATE) ? cSpace.size : 256;
......@@ -537,10 +545,6 @@ static HPALETTE16 COLOR_InitPalette(void)
memset(COLOR_freeList, 0, 256*sizeof(unsigned char));
/* calculate max palette size */
cSpace.size = visual->map_entries;
if (cSpace.flags & COLOR_PRIVATE)
COLOR_BuildPrivateMap( &cSpace );
else
......@@ -610,10 +614,20 @@ static void COLOR_Computeshifts(unsigned long maskbits, int *shift, int *max)
*/
HPALETTE16 COLOR_Init(void)
{
int mask, white, black;
visual = DefaultVisual( display, DefaultScreen(display) );
dprintf_palette(stddeb,"COLOR_Init: initializing palette manager...");
white = WhitePixelOfScreen( screen );
black = BlackPixelOfScreen( screen );
cSpace.monoPlane = 1;
for( mask = 1; !((white & mask)^(black & mask)); mask <<= 1 )
cSpace.monoPlane++;
cSpace.flags = (white & mask) ? COLOR_WHITESET : 0;
cSpace.size = visual->map_entries;
switch(visual->class)
{
case DirectColor:
......@@ -624,18 +638,23 @@ HPALETTE16 COLOR_Init(void)
{
XSetWindowAttributes win_attr;
cSpace.flags |= COLOR_PRIVATE;
cSpace.colorMap = XCreateColormap( display, rootWindow,
visual, AllocAll );
if (cSpace.colorMap)
{
if( rootWindow != DefaultRootWindow(display) )
{
cSpace.flags |= (COLOR_PRIVATE | COLOR_WHITESET);
cSpace.monoPlane = 1;
for( white = cSpace.size - 1; !(white & 1); white >>= 1 )
cSpace.monoPlane++;
if( rootWindow != DefaultRootWindow(display) )
{
win_attr.colormap = cSpace.colorMap;
XChangeWindowAttributes( display, rootWindow,
CWColormap, &win_attr );
}
break;
}
break;
}
}
cSpace.colorMap = DefaultColormapOfScreen( screen );
......@@ -658,7 +677,8 @@ HPALETTE16 COLOR_Init(void)
break;
}
dprintf_palette(stddeb," visual class %i\n", visual->class);
dprintf_palette(stddeb," visual class %i (%i)\n",
visual->class, cSpace.monoPlane);
return COLOR_InitPalette();
}
......
......@@ -7,6 +7,8 @@
/*
* Theory:
*
* http://www.microsoft.com/win32dev/ui/icons.htm
*
* Cursors and icons are stored in a global heap block, with the
* following layout:
*
......@@ -33,7 +35,6 @@
#include "win.h"
#include "stddebug.h"
#include "debug.h"
#include "xmalloc.h"
#include "task.h"
extern UINT16 COLOR_GetSystemPaletteSize();
......@@ -237,14 +238,15 @@ static BOOL32 CURSORICON_LoadDirEntry( HINSTANCE32 hInstance, SEGPTR name,
HGLOBAL16 CURSORICON_LoadHandler( HGLOBAL16 handle, HINSTANCE16 hInstance,
BOOL32 fCursor )
{
HBITMAP32 hAndBits, hXorBits;
HDC32 hdc;
int size, sizeAnd, sizeXor;
POINT16 hotspot = { 0 ,0 };
static char* __loadhandlerStr = "CURSORICON_LoadHandler";
int sizeAnd, sizeXor;
HBITMAP32 hAndBits = 0, hXorBits = 0; /* error condition for later */
BITMAPOBJ *bmpXor, *bmpAnd;
BITMAPINFO *bmi, *pInfo;
POINT16 hotspot = { 0 ,0 };
CURSORICONINFO *info;
char *bits;
BITMAPINFO *bmi;
HDC32 hdc;
if (fCursor) /* If cursor, get the hotspot */
{
......@@ -254,87 +256,81 @@ HGLOBAL16 CURSORICON_LoadHandler( HGLOBAL16 handle, HINSTANCE16 hInstance,
}
else bmi = (BITMAPINFO *)LockResource16( handle );
/* Create a copy of the bitmap header */
/* Check bitmap header */
size = DIB_BitmapInfoSize( bmi, DIB_RGB_COLORS );
/* Make sure we have room for the monochrome bitmap later on */
size = MAX( size, sizeof(BITMAPINFOHEADER) + 2*sizeof(RGBQUAD) );
pInfo = (BITMAPINFO *)xmalloc( size );
memcpy( pInfo, bmi, size );
if (pInfo->bmiHeader.biSize == sizeof(BITMAPINFOHEADER))
if ( (bmi->bmiHeader.biSize != sizeof(BITMAPCOREHEADER)) &&
(bmi->bmiHeader.biSize != sizeof(BITMAPINFOHEADER) ||
bmi->bmiHeader.biCompression != BI_RGB) )
{
if (pInfo->bmiHeader.biCompression != BI_RGB)
{
fprintf(stderr,"Unknown size for compressed icon bitmap.\n");
free( pInfo );
return 0;
}
pInfo->bmiHeader.biHeight /= 2;
}
else if (pInfo->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
{
BITMAPCOREHEADER *core = (BITMAPCOREHEADER *)pInfo;
core->bcHeight /= 2;
}
else
{
fprintf( stderr, "CURSORICON_Load: Unknown bitmap length %ld!\n",
pInfo->bmiHeader.biSize );
free( pInfo );
return 0;
fprintf(stderr,"%s: invalid bitmap header.\n", __loadhandlerStr);
return 0;
}
/* Create the XOR bitmap */
if (!(hdc = GetDC32( 0 )))
if( (hdc = GetDC32( 0 )) )
{
free( pInfo );
return 0;
}
BITMAPINFO* pInfo;
INT32 size = DIB_BitmapInfoSize( bmi, DIB_RGB_COLORS );
/* Make sure we have room for the monochrome bitmap later on.
* Note that BITMAPINFOINFO and BITMAPCOREHEADER are the same
* up to and including the biBitCount. In-memory icon resource
* format is as follows:
*
* BITMAPINFOHEADER icHeader // DIB header
* RGBQUAD icColors[] // Color table
* BYTE icXOR[] // DIB bits for XOR mask
* BYTE icAND[] // DIB bits for AND mask
*/
hXorBits = CreateDIBitmap32( hdc, &pInfo->bmiHeader, CBM_INIT,
(char*)bmi + size, pInfo, DIB_RGB_COLORS );
if (!hXorBits) {
free( pInfo );
ReleaseDC32( 0, hdc );
return 0;
if( (pInfo = (BITMAPINFO *)HeapAlloc( GetProcessHeap(), 0,
MAX(size, sizeof(BITMAPINFOHEADER) + 2*sizeof(RGBQUAD)))) )
{
memcpy( pInfo, bmi, size );
pInfo->bmiHeader.biHeight /= 2;
/* Create the XOR bitmap */
hXorBits = CreateDIBitmap32( hdc, &pInfo->bmiHeader, CBM_INIT,
(char*)bmi + size, pInfo, DIB_RGB_COLORS );
if( hXorBits )
{
char* bits = (char *)bmi + size + bmi->bmiHeader.biHeight *
DIB_GetDIBWidthBytes(bmi->bmiHeader.biWidth,
bmi->bmiHeader.biBitCount) / 2;
pInfo->bmiHeader.biBitCount = 1;
if (pInfo->bmiHeader.biSize == sizeof(BITMAPINFOHEADER))
{
RGBQUAD *rgb = pInfo->bmiColors;
pInfo->bmiHeader.biClrUsed = pInfo->bmiHeader.biClrImportant = 2;
rgb[0].rgbBlue = rgb[0].rgbGreen = rgb[0].rgbRed = 0x00;
rgb[1].rgbBlue = rgb[1].rgbGreen = rgb[1].rgbRed = 0xff;
rgb[0].rgbReserved = rgb[1].rgbReserved = 0;
}
else
{
RGBTRIPLE *rgb = (RGBTRIPLE *)(((BITMAPCOREHEADER *)pInfo) + 1);
rgb[0].rgbtBlue = rgb[0].rgbtGreen = rgb[0].rgbtRed = 0x00;
rgb[1].rgbtBlue = rgb[1].rgbtGreen = rgb[1].rgbtRed = 0xff;
}
/* Create the AND bitmap */
hAndBits = CreateDIBitmap32( hdc, &pInfo->bmiHeader, CBM_INIT,
bits, pInfo, DIB_RGB_COLORS );
if( !hAndBits ) DeleteObject32( hXorBits );
}
HeapFree( GetProcessHeap(), 0, pInfo );
}
ReleaseDC32( 0, hdc );
}
/* Fix the bitmap header to load the monochrome mask */
if (pInfo->bmiHeader.biSize == sizeof(BITMAPINFOHEADER))
if( !hXorBits || !hAndBits )
{
BITMAPINFOHEADER *bih = &pInfo->bmiHeader;
RGBQUAD *rgb = pInfo->bmiColors;
bits = (char *)bmi + size +
DIB_GetImageWidthBytes(bih->biWidth,bih->biBitCount)*bih->biHeight;
bih->biBitCount = 1;
bih->biClrUsed = bih->biClrImportant = 2;
rgb[0].rgbBlue = rgb[0].rgbGreen = rgb[0].rgbRed = 0x00;
rgb[1].rgbBlue = rgb[1].rgbGreen = rgb[1].rgbRed = 0xff;
rgb[0].rgbReserved = rgb[1].rgbReserved = 0;
}
else
{
BITMAPCOREHEADER *bch = (BITMAPCOREHEADER *)pInfo;
RGBTRIPLE *rgb = (RGBTRIPLE *)(bch + 1);
bits = (char *)bmi + size +
DIB_GetImageWidthBytes(bch->bcWidth,bch->bcBitCount)*bch->bcHeight;
bch->bcBitCount = 1;
rgb[0].rgbtBlue = rgb[0].rgbtGreen = rgb[0].rgbtRed = 0x00;
rgb[1].rgbtBlue = rgb[1].rgbtGreen = rgb[1].rgbtRed = 0xff;
}
/* Create the AND bitmap */
hAndBits = CreateDIBitmap32( hdc, &pInfo->bmiHeader, CBM_INIT,
bits, pInfo, DIB_RGB_COLORS );
ReleaseDC32( 0, hdc );
if (!hAndBits) {
DeleteObject32( hXorBits );
free( pInfo );
return 0;
fprintf(stderr,"%s: unable to create a bitmap.\n", __loadhandlerStr );
return 0;
}
/* Now create the CURSORICONINFO structure */
......@@ -451,12 +447,12 @@ HCURSOR16 CURSORICON_IconToCursor(HICON16 hIcon, BOOL32 bSemiTransparent)
HTASK16 hTask = GetCurrentTask();
TDB* pTask = (TDB *)GlobalLock16(hTask);
if(hIcon)
if(hIcon && pTask)
if (!(ptr = (CURSORICONINFO*)GlobalLock16( hIcon ))) return FALSE;
if (ptr->bPlanes * ptr->bBitsPerPixel == 1)
hRet = CURSORICON_Copy( pTask->hInstance, hIcon );
else
{
{
BYTE pAndBits[128];
BYTE pXorBits[128];
int x, y, ix, iy, shift;
......@@ -471,8 +467,6 @@ HCURSOR16 CURSORICON_IconToCursor(HICON16 hIcon, BOOL32 bSemiTransparent)
COLORREF col;
CURSORICONINFO cI;
if(!pTask) return 0;
memset(pXorBits, 0, 128);
cI.bBitsPerPixel = 1; cI.bPlanes = 1;
cI.ptHotSpot.x = cI.ptHotSpot.y = 15;
......@@ -519,7 +513,7 @@ HCURSOR16 CURSORICON_IconToCursor(HICON16 hIcon, BOOL32 bSemiTransparent)
hRet = CURSORICON_Copy( pTask->hInstance ,
CURSORICON_Load(0,MAKEINTRESOURCE(OCR_DRAGOBJECT),
SYSMETRICS_CXCURSOR, SYSMETRICS_CYCURSOR, 1, TRUE) );
}
}
return hRet;
}
......@@ -1149,3 +1143,8 @@ HICON16 LoadIconHandler( HGLOBAL16 hResource, BOOL16 bNew )
}
return CURSORICON_LoadHandler( hResource, 0, FALSE);
}
/**********************************************************************
* GetIconInfo (USER32.241)
*/
......@@ -18,53 +18,51 @@
extern void CLIPPING_UpdateGCRegion(DC* );
static int bitmapDepthTable[] = { 8, 1, 32, 16, 24, 15, 4, 0 };
static int ximageDepthTable[] = { 0, 0, 0, 0, 0, 0, 0 };
/***********************************************************************
* DIB_GetImageWidthBytesX11
*
* Return the width of an X image in bytes
* DIB_Init
*/
int DIB_GetImageWidthBytesX11( int width, int depth )
BOOL32 DIB_Init()
{
int wbits;
XImage *testimage;
#define DEPTHCASE(depth) \
case depth: { \
static int w##depth = 0; \
if (! w##depth ) { \
testimage=XCreateImage(display,DefaultVisualOfScreen(screen),\
depth,ZPixmap,0,NULL,1,1,32,20); \
w##depth = testimage->bits_per_pixel; \
XDestroyImage(testimage); \
} \
wbits = width*w##depth; \
break; \
}
int i;
XImage* testimage;
switch(depth)
for( i = 0; bitmapDepthTable[i]; i++ )
{
DEPTHCASE(1);
DEPTHCASE(4);
DEPTHCASE(8);
DEPTHCASE(15);
DEPTHCASE(16);
DEPTHCASE(24);
DEPTHCASE(32);
default:
fprintf(stderr, "DIB: unsupported depth %d.\n", depth );
/* assume 32 bits/pixel */
wbits = width*32;
break;
testimage = XCreateImage(display, DefaultVisualOfScreen(screen),
bitmapDepthTable[i], ZPixmap, 0, NULL, 1, 1, 32, 20 );
if( testimage ) ximageDepthTable[i] = testimage->bits_per_pixel;
else return FALSE;
XDestroyImage(testimage);
}
return 4 * ((wbits+31)/32);
return TRUE;
}
/***********************************************************************
* DIB_GetImageWidthBytes
* DIB_GetXImageWidthBytes
*
* Return the width of an X image in bytes
*/
int DIB_GetImageWidthBytes( int width, int depth )
int DIB_GetXImageWidthBytes( int width, int depth )
{
int i;
for( i = 0; bitmapDepthTable[i] ; i++ )
if( bitmapDepthTable[i] == depth )
return (4 * ((width * ximageDepthTable[i] + 31)/32));
fprintf(stderr, "DIB: unsupported depth %d.\n", depth );
return (4 * width);
}
/***********************************************************************
* DIB_GetDIBWidthBytes
*
* Return the width of a DIB bitmap in bytes. DIB bitmap data is 32-bit aligned.
* http://www.microsoft.com/msdn/sdk/platforms/doc/sdk/win32/struc/src/str01.htm
*/
int DIB_GetDIBWidthBytes( int width, int depth )
{
int words;
......@@ -90,7 +88,7 @@ int DIB_GetImageWidthBytes( int width, int depth )
/***********************************************************************
* DIB_BitmapInfoSize
*
* Return the size of the bitmap info structure.
* Return the size of the bitmap info structure including color table.
*/
int DIB_BitmapInfoSize( BITMAPINFO * info, WORD coloruse )
{
......@@ -791,6 +789,8 @@ INT16 GetDIBits16( HDC16 hdc, HBITMAP16 hbitmap, UINT16 startscan,
/***********************************************************************
* GetDIBits32 (GDI32.170)
*
* http://www.microsoft.com/msdn/sdk/platforms/doc/sdk/win32/func/src/f30_14.htm
*/
INT32 GetDIBits32( HDC32 hdc, HBITMAP32 hbitmap, UINT32 startscan,
UINT32 lines, LPSTR bits, BITMAPINFO * info,
......@@ -864,7 +864,7 @@ INT32 GetDIBits32( HDC32 hdc, HBITMAP32 hbitmap, UINT32 startscan,
switch( info->bmiHeader.biBitCount )
{
case 8:
/* pad up to 32 bit (FIXME: not 16? ) */
/* pad up to 32 bit */
pad += (4 - (info->bmiHeader.biWidth & 3)) & 3;
for( y = yend - 1; (int)y >= (int)startscan; y-- )
{
......@@ -953,8 +953,8 @@ INT32 GetDIBits32( HDC32 hdc, HBITMAP32 hbitmap, UINT32 startscan,
info->bmiHeader.biPlanes = 1;
info->bmiHeader.biBitCount = bmp->bitmap.bmBitsPixel;
info->bmiHeader.biSizeImage = bmp->bitmap.bmHeight *
DIB_GetImageWidthBytes( bmp->bitmap.bmWidth,
bmp->bitmap.bmBitsPixel );
DIB_GetDIBWidthBytes( bmp->bitmap.bmWidth,
bmp->bitmap.bmBitsPixel );
info->bmiHeader.biCompression = 0;
}
......
......@@ -156,10 +156,12 @@ BOOL32 GDI_Init(void)
{
HPALETTE16 hpalette;
extern BOOL32 X11DRV_Init(void);
extern BOOL32 DIB_Init(void);
/* Initialize drivers */
if (!X11DRV_Init()) return FALSE;
if (!DIB_Init()) return FALSE;
/* Create default palette */
......
......@@ -607,30 +607,38 @@ void PlayMetaFileRecord16( HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr,
case META_EXTTEXTOUT:
{
LPINT16 dxx;
LPSTR sot;
DWORD len;
s1 = mr->rdParam[2]; /* String length */
len = sizeof(METARECORD) + (((s1 + 1) >> 1) * 2) + 2 * sizeof(short)
+ sizeof(UINT16) + sizeof(RECT16);
if (mr->rdSize == len / 2)
dxx = NULL; /* No array present */
else if (mr->rdSize == (len + s1 * sizeof(INT16)) / 2)
dxx = &mr->rdParam[8+(s1+1)/2]; /* start of array */
else {
fprintf(stderr,
"PlayMetaFileRecord ExtTextOut mr->rdSize = %08lx, count = %x\n",
mr->rdSize, s1);
dxx = NULL;
}
+ sizeof(UINT16) + (mr->rdParam[3] ? sizeof(RECT16) : 0); /* rec len without dx array */
sot= (LPSTR)&mr->rdParam[4]; /* start_of_text */
if (mr->rdParam[3])
sot+=sizeof(RECT16); /* there is a rectangle, so add offset */
if (mr->rdSize == len / 2)
dxx = NULL; /* determine if array present */
else
if (mr->rdSize == (len + s1 * sizeof(INT16)) / 2)
dxx = (LPINT16)(sot+(((s1+1)>>1)*2));
else
{
fprintf(stderr,
"Please report: PlayMetaFile/ExtTextOut len=%ld slen=%d rdSize=%ld opt=%04x\n",
len,s1,mr->rdSize,mr->rdParam[3]);
dxx = NULL; /* should't happen -- but if, we continue with NULL [for workaround] */
}
ExtTextOut16( hdc, mr->rdParam[1], /* X position */
mr->rdParam[0], /* Y position */
mr->rdParam[3], /* options */
(LPRECT16) &mr->rdParam[4], /* rectangle */
(char *)(mr->rdParam + 8), /* string */
mr->rdParam[3] ? (LPRECT16) &mr->rdParam[4]:NULL, /* rectangle */
sot, /* string */
s1, dxx); /* length, dx array */
if (dxx)
dprintf_metafile(stddeb,"EXTTEXTOUT len: %ld (%hd %hd) [%s].\n",
mr->rdSize,dxx[0],dxx[1],(char*) &(mr->rdParam[8]) );
dprintf_metafile(stddeb,"EXTTEXTOUT: %s len: %ld dx0: %d\n",
sot,mr->rdSize,dxx[0]);
}
break;
......@@ -740,16 +748,29 @@ void PlayMetaFileRecord16( HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr,
GlobalFree16(hndl);
break;
case META_DIBBITBLT:
{
LPBITMAPINFO info = (LPBITMAPINFO) &(mr->rdParam[8]);
LPSTR bits = (LPSTR)info + DIB_BitmapInfoSize( info, mr->rdParam[0] );
StretchDIBits16(hdc,mr->rdParam[7],mr->rdParam[6],mr->rdParam[5],
mr->rdParam[4],mr->rdParam[3],mr->rdParam[2],
mr->rdParam[5],mr->rdParam[4],bits,info,
DIB_RGB_COLORS,MAKELONG(mr->rdParam[0],mr->rdParam[1]));
}
break;
case META_SETTEXTJUSTIFICATION:
SetTextJustification32(hdc, *(mr->rdParam + 1), *(mr->rdParam));
break;
#define META_UNIMP(x) case x: fprintf(stderr,"PlayMetaFileRecord:record type "#x" not implemented.\n");break;
META_UNIMP(META_SETTEXTCHAREXTRA)
META_UNIMP(META_SETTEXTJUSTIFICATION)
META_UNIMP(META_FRAMEREGION)
META_UNIMP(META_DRAWTEXT)
META_UNIMP(META_SETDIBTODEV)
META_UNIMP(META_ANIMATEPALETTE)
META_UNIMP(META_SETPALENTRIES)
META_UNIMP(META_RESIZEPALETTE)
META_UNIMP(META_DIBBITBLT)
META_UNIMP(META_EXTFLOODFILL)
META_UNIMP(META_RESETDC)
META_UNIMP(META_STARTDOC)
......
SYSMENU MENU LOADONCALL MOVEABLE DISCARDABLE
{
MENUITEM "&Restaurer", 61728
MENUITEM "&Restaurar", 61728
MENUITEM "&Mover", 61456
MENUITEM "&Tamao", 61440
MENUITEM "Mi&nimizar", 61472
......@@ -20,12 +20,12 @@ EDITMENU MENU LOADONCALL MOVEABLE DISCARDABLE
BEGIN
MENUITEM "&Undo", EM_UNDO32
MENUITEM SEPARATOR
MENUITEM "Cu&t", WM_CUT
MENUITEM "&Copy", WM_COPY
MENUITEM "&Paste", WM_PASTE
MENUITEM "&Delete", WM_CLEAR
MENUITEM "Co&rtar", WM_CUT
MENUITEM "&Copiar", WM_COPY
MENUITEM "&Pegar", WM_PASTE
MENUITEM "&Borrar", WM_CLEAR
MENUITEM SEPARATOR
MENUITEM "Select &All", EM_SETSEL32
MENUITEM "Seleccionar &todo", EM_SETSEL32
END
}
......@@ -148,36 +148,66 @@ FONT 8, "Helv"
}
CHOOSE_FONT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
CHOOSE_FONT DIALOG DISCARDABLE 13, 54, 264, 147
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Fuente"
FONT 8, "Helv"
{
LTEXT "Fuente:", 1088, 6, 6, 40, 9
LTEXT "", 1089, 60, 6, 150, 9
DEFPUSHBUTTON "Aceptar", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Cancelar", 2, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
LTEXT "&Fuente:",1088 ,6,3,40,9
COMBOBOX 1136 ,6,13,94,54, CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL |
CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE
LTEXT "Est&ilo de fuente:",1089 ,108,3,44,9
COMBOBOX 1137,108,13,64,54, CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL |
WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE
LTEXT "&Tamao:",1090,179,3,30,9
COMBOBOX 1138,179,13,32,54, CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL |
WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE | CBS_SORT
DEFPUSHBUTTON "Aceptar",IDOK,218,6,40,14,WS_GROUP
PUSHBUTTON "Cancelar",IDCANCEL,218,23,40,14,WS_GROUP
PUSHBUTTON "A&plicar", 1026,218,40,40,14,WS_GROUP
PUSHBUTTON "A&yuda" , 1038,218,57,40,14,WS_GROUP
GROUPBOX "&Efectos",1072,6,72,84,34,WS_GROUP
CHECKBOX "&Rayado", 1040, 10,82,50,10, BS_AUTOCHECKBOX | WS_TABSTOP
CHECKBOX "&Subrayado", 1041, 10,94,50,10, BS_AUTOCHECKBOX
LTEXT "&Color:", 1091 ,6,110,30,9
COMBOBOX 1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS |
CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Ejemplo",1073,98,72,160,49,WS_GROUP
CTEXT "AaBbYyZz",1093,104,81,149,37,SS_NOPREFIX | WS_VISIBLE
}
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 200
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Color"
FONT 8, "Helv"
{
LTEXT "Colores &basicos:", 1088, 6, 6, 40, 9
LTEXT "Colores person&alizados:", 1089, 6, 126, 40, 9
LTEXT "Color|Sl&ido", 1090, 100, 146, 40, 9
LTEXT "&Hue:", 1091, 150, 126, 40, 9
LTEXT "&Sat:", 1092, 150, 146, 40, 9
LTEXT "&Lum:", 1093, 150, 166, 40, 9
LTEXT "&Rojo:", 1094, 150, 126, 40, 9
LTEXT "&Verde:", 1095, 150, 146, 40, 9
LTEXT "A&zul:", 1096, 150, 166, 40, 9
DEFPUSHBUTTON "Aceptar", 1, 6, 182, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Agregar a los &colores personalizados", 1024, 120, 182, 100, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "Borrar colores personalizados", 1025, 6, 164, 56, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "Cancelar", 2, 76, 182, 56, 14, WS_GROUP | WS_TABSTOP
LTEXT "Colores &bsicos:", 1088, 4, 4, 140, 10
LTEXT "Colores person&alizados:", 1089, 4, 106, 140, 10
LTEXT "Color|S3l&ido", 1090, 150, 151, 48, 10
LTEXT "&Rojo:", 726 /*1094*/,249,126,24,10
EDITTEXT 706, 275,124,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
LTEXT "&Verde:",727/*1095*/,249,140,24,10
EDITTEXT 707, 275,138,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
LTEXT "A&zul:",728 /*1096*/,249,154,24,10
EDITTEXT 708, 275,152,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
LTEXT "&Tinte:" ,723 /*1091*/,202,126,22,10
EDITTEXT 703, 226,124,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
LTEXT "&Sat.:" ,724 /*1092*/,202,140,22,10
EDITTEXT 704, 226,138,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
LTEXT "&Lum.:" ,725 /*1093*/,202,154,22,10
EDITTEXT 705, 226,152,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
CONTROL "" ,720,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP,4,14,140,86
CONTROL "" ,721,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP,4,116,140,28
CONTROL "" ,710,"STATIC",WS_BORDER|SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,4,118,116 CONTROL "" ,702,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 278,4,8,116
CONTROL "" ,702,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 278,4,8,116
CONTROL "" ,709,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,124,40,26
DEFPUSHBUTTON "Aceptar", 1, 4, 166, 44, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Cancelar", 2, 52, 166, 44, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "A&yuda", 1038,100,166, 44, 14
PUSHBUTTON "Agregar a los &colores personalizados", 712/*1024*/, 152, 166, 142, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Definir colores personalizados >>", 719/*1025*/, 4, 150, 142, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "&i",713,300,200,4,14 /* just a dummy: 'i' is like &i in "sol&id" */
}
......
......@@ -339,7 +339,7 @@ static HGLOBAL32 CURSORICON32_LoadHandler( HANDLE32 handle,
BITMAPINFOHEADER *bih = &pInfo->bmiHeader;
RGBQUAD *rgb = pInfo->bmiColors;
bits = (char *)bmi + size +
DIB_GetImageWidthBytes(bih->biWidth,bih->biBitCount)*bih->biHeight;
DIB_GetDIBWidthBytes(bih->biWidth,bih->biBitCount)*bih->biHeight;
bih->biBitCount = 1;
bih->biClrUsed = bih->biClrImportant = 2;
rgb[0].rgbBlue = rgb[0].rgbGreen = rgb[0].rgbRed = 0x00;
......@@ -351,7 +351,7 @@ static HGLOBAL32 CURSORICON32_LoadHandler( HANDLE32 handle,
BITMAPCOREHEADER *bch = (BITMAPCOREHEADER *)pInfo;
RGBTRIPLE *rgb = (RGBTRIPLE *)(bch + 1);
bits = (char *)bmi + size +
DIB_GetImageWidthBytes(bch->bcWidth,bch->bcBitCount)*bch->bcHeight;
DIB_GetDIBWidthBytes(bch->bcWidth,bch->bcBitCount)*bch->bcHeight;
bch->bcBitCount = 1;
rgb[0].rgbtBlue = rgb[0].rgbtGreen = rgb[0].rgbtRed = 0x00;
rgb[1].rgbtBlue = rgb[1].rgbtGreen = rgb[1].rgbtRed = 0xff;
......
......@@ -25,6 +25,7 @@
#define DEBUG_WIN32
#include "debug.h"
DWORD ErrnoToLastError(int errno_num);
static int TranslateCreationFlags(DWORD create_flags);
static int TranslateAccessFlags(DWORD access_flags);
......
......@@ -325,7 +325,7 @@ DWORD WaitForSingleObject(HANDLE32 h, DWORD timeout)
}
/***********************************************************************
* WaitForSingleObject (USER32.399)
* WaitForMultipleObjects (USER32.399)
*/
DWORD MsgWaitForMultipleObjects(
DWORD nCount,HANDLE32 *pHandles,BOOL32 fWaitAll,DWORD dwMilliseconds,
......
......@@ -28,6 +28,8 @@
static short iF10Key = 0;
static short iMenuSysKey = 0;
extern void EndMenu(void);
/***********************************************************************
* DEFWND_HandleWindowPosChanged
*
......@@ -328,8 +330,7 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT32 msg, WPARAM32 wParam,
break;
case WM_CANCELMODE:
/* EndMenu() should be called if in menu state but currently it's
impossible to detect - menu code should be updated*/
if (wndPtr->parent == WIN_GetDesktop()) EndMenu();
if (GetCapture32() == wndPtr->hwndSelf) ReleaseCapture();
break;
......
......@@ -61,8 +61,8 @@ LRESULT SendDriverMessage(HDRVR16 hDriver, UINT16 msg, LPARAM lParam1,
return 0;
}
retval = CallDriverProc( lpdrv->lpDrvProc, 0L /* FIXME */, hDriver, msg,
lParam1, lParam2 );
retval = CallDriverProc( (FARPROC16)lpdrv->lpDrvProc, 0L /* FIXME */,
hDriver, msg, lParam1, lParam2 );
dprintf_driver( stddeb, "SendDriverMessage // retval = %ld\n", retval );
......
......@@ -11,6 +11,7 @@
#include <X11/Xutil.h>
#include <X11/Intrinsic.h>
#include "graphics.h"
#include "color.h"
#include "bitmap.h"
#include "gdi.h"
#include "dc.h"
......@@ -65,7 +66,7 @@ BOOL32 GRAPH_DrawLines( HDC32 hdc, LPPOINT32 pXY, INT32 N, HPEN32 hPen )
*/
BOOL32 GRAPH_DrawBitmap( HDC32 hdc, HBITMAP32 hbitmap,
INT32 xdest, INT32 ydest, INT32 xsrc, INT32 ysrc,
INT32 width, INT32 height )
INT32 width, INT32 height, BOOL32 bMono )
{
BITMAPOBJ *bmp;
DC *dc;
......@@ -73,24 +74,43 @@ BOOL32 GRAPH_DrawBitmap( HDC32 hdc, HBITMAP32 hbitmap,
if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return FALSE;
if (!(bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC )))
return FALSE;
xdest += dc->w.DCOrgX; ydest += dc->w.DCOrgY;
XSetFunction( display, dc->u.x.gc, GXcopy );
if (bmp->bitmap.bmBitsPixel == 1)
{
XSetForeground( display, dc->u.x.gc, dc->w.backgroundPixel );
XSetBackground( display, dc->u.x.gc, dc->w.textPixel );
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;
xsrc, ysrc, width, height, xdest, ydest, 1 );
}
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;
if( bMono )
{
INT32 plane;
if( COLOR_GetMonoPlane(&plane) )
{
XSetForeground( display, dc->u.x.gc, dc->w.backgroundPixel );
XSetBackground( display, dc->u.x.gc, dc->w.textPixel );
}
else
{
XSetForeground( display, dc->u.x.gc, dc->w.textPixel );
XSetBackground( display, dc->u.x.gc, dc->w.backgroundPixel );
}
XCopyPlane( display, bmp->pixmap, dc->u.x.drawable, dc->u.x.gc,
xsrc, ysrc, width, height, xdest, ydest, plane );
}
else
XCopyArea( display, bmp->pixmap, dc->u.x.drawable,
dc->u.x.gc, xsrc, ysrc, width, height, xdest, ydest );
}
else return FALSE;
return TRUE;
}
......
......@@ -639,7 +639,7 @@ msg->hwnd=%04x, msg->message=%04x\n", hAccel,hWnd,msg->hwnd,msg->message);
if (sendmsg) /* found an accelerator, but send a message... ? */
{
INT16 iSysStat,iStat,mesg=0;
HMENU16 hSysMenu,hMenu;
HMENU16 hMenu;
if (msg->message == WM_KEYUP || msg->message == WM_SYSKEYUP)
mesg=1;
......@@ -651,16 +651,14 @@ msg->hwnd=%04x, msg->message=%04x\n", hAccel,hWnd,msg->hwnd,msg->message);
mesg=3;
else
{
hMenu=GetMenu32(hWnd);
hSysMenu=GetSystemMenu32(hWnd,FALSE);
if (hSysMenu)
iSysStat=GetMenuState32(hSysMenu,lpAccelTbl->tbl[i].wIDval,MF_BYCOMMAND);
else
iSysStat=-1;
if (hMenu)
iStat=GetMenuState32(hMenu,lpAccelTbl->tbl[i].wIDval,MF_BYCOMMAND);
else
iStat=-1;
WND* wndPtr = WIN_FindWndPtr(hWnd);
hMenu = (wndPtr->dwStyle & WS_CHILD) ? 0 : (HMENU32)wndPtr->wIDmenu;
iSysStat = (wndPtr->hSysMenu) ? GetMenuState32(GetSubMenu16(wndPtr->hSysMenu, 0),
lpAccelTbl->tbl[i].wIDval, MF_BYCOMMAND) : -1 ;
iStat = (hMenu) ? GetMenuState32(hMenu,
lpAccelTbl->tbl[i].wIDval, MF_BYCOMMAND) : -1 ;
if (iSysStat!=-1)
{
if (iSysStat & (MF_DISABLED|MF_GRAYED))
......
......@@ -30,6 +30,8 @@
#include "stddebug.h"
#include "debug.h"
#define MDIF_NEEDUPDATE 0x0001
static HBITMAP16 hBmpClose = 0;
static HBITMAP16 hBmpRestore = 0;
......@@ -57,9 +59,9 @@ static HWND16 MDI_GetChildByID(WND* wndPtr,int id)
static void MDI_PostUpdate(HWND16 hwnd, MDICLIENTINFO* ci, WORD recalc)
{
if( !ci->sbNeedUpdate )
if( !(ci->mdiFlags & MDIF_NEEDUPDATE) )
{
ci->sbNeedUpdate = TRUE;
ci->mdiFlags |= MDIF_NEEDUPDATE;
PostMessage16( hwnd, WM_MDICALCCHILDSCROLL, 0, 0);
}
ci->sbRecalc = recalc;
......@@ -980,7 +982,6 @@ static void MDI_UpdateFrameText( WND *frameWnd, HWND16 hClient,
LRESULT MDIClientWndProc(HWND16 hwnd, UINT16 message, WPARAM16 wParam, LPARAM lParam)
{
LPCREATESTRUCT16 cs;
LPCLIENTCREATESTRUCT16 ccs;
MDICLIENTINFO *ci;
RECT16 rect;
WND *w = WIN_FindWndPtr(hwnd);
......@@ -999,17 +1000,25 @@ LRESULT MDIClientWndProc(HWND16 hwnd, UINT16 message, WPARAM16 wParam, LPARAM lP
* so we have to keep track of what environment we're in. */
if( w->flags & WIN_ISWIN32 )
ccs = (LPCLIENTCREATESTRUCT16) cs->lpCreateParams;
{
#define ccs ((LPCLIENTCREATESTRUCT32)cs->lpCreateParams)
ci->hWindowMenu = ccs->hWindowMenu;
ci->idFirstChild = ccs->idFirstChild;
#undef ccs
}
else
ccs = (LPCLIENTCREATESTRUCT16) PTR_SEG_TO_LIN(cs->lpCreateParams);
{
LPCLIENTCREATESTRUCT16 ccs = (LPCLIENTCREATESTRUCT16)
PTR_SEG_TO_LIN(cs->lpCreateParams);
ci->hWindowMenu = ccs->hWindowMenu;
ci->idFirstChild = ccs->idFirstChild;
}
ci->hWindowMenu = ccs->hWindowMenu;
ci->idFirstChild = ccs->idFirstChild;
ci->hwndChildMaximized = 0;
ci->nActiveChildren = 0;
ci->nTotalCreated = 0;
ci->frameTitle = NULL;
ci->sbNeedUpdate = 0;
ci->mdiFlags = 0;
ci->self = hwnd;
w->dwStyle |= WS_CLIPCHILDREN;
......@@ -1020,7 +1029,7 @@ LRESULT MDIClientWndProc(HWND16 hwnd, UINT16 message, WPARAM16 wParam, LPARAM lP
}
MDI_UpdateFrameText(frameWnd, hwnd, MDI_NOFRAMEREPAINT,frameWnd->text);
AppendMenu32A( ccs->hWindowMenu, MF_SEPARATOR, 0, NULL );
AppendMenu32A( ci->hWindowMenu, MF_SEPARATOR, 0, NULL );
GetClientRect16(frameWnd->hwndSelf, &rect);
NC_HandleNCCalcSize( w, &rect );
......@@ -1064,7 +1073,7 @@ LRESULT MDIClientWndProc(HWND16 hwnd, UINT16 message, WPARAM16 wParam, LPARAM lP
((LONG) (ci->hwndChildMaximized>0) << 16));
case WM_MDIICONARRANGE:
ci->sbNeedUpdate = TRUE;
ci->mdiFlags |= MDIF_NEEDUPDATE;
MDIIconArrange(hwnd);
ci->sbRecalc = SB_BOTH+1;
SendMessage16(hwnd,WM_MDICALCCHILDSCROLL,0,0L);
......@@ -1090,17 +1099,17 @@ LRESULT MDIClientWndProc(HWND16 hwnd, UINT16 message, WPARAM16 wParam, LPARAM lP
#endif
case WM_MDITILE:
ci->sbNeedUpdate = TRUE;
ci->mdiFlags |= MDIF_NEEDUPDATE;
ShowScrollBar32(hwnd,SB_BOTH,FALSE);
MDITile(w, ci,wParam);
ci->sbNeedUpdate = FALSE;
ci->mdiFlags &= ~MDIF_NEEDUPDATE;
return 0;
case WM_VSCROLL:
case WM_HSCROLL:
ci->sbNeedUpdate = TRUE;
ci->mdiFlags |= MDIF_NEEDUPDATE;
ScrollChildren32(hwnd,message,wParam,lParam);
ci->sbNeedUpdate = FALSE;
ci->mdiFlags &= ~MDIF_NEEDUPDATE;
return 0;
case WM_SETFOCUS:
......@@ -1132,27 +1141,27 @@ LRESULT MDIClientWndProc(HWND16 hwnd, UINT16 message, WPARAM16 wParam, LPARAM lP
return 0;
case WM_SIZE:
if( ci->hwndChildMaximized )
{
WND* child = WIN_FindWndPtr(ci->hwndChildMaximized);
RECT16 rect = { 0, 0, LOWORD(lParam), HIWORD(lParam) };
if( ci->hwndChildMaximized )
{
WND* child = WIN_FindWndPtr(ci->hwndChildMaximized);
RECT16 rect = { 0, 0, LOWORD(lParam), HIWORD(lParam) };
AdjustWindowRectEx16(&rect, child->dwStyle, 0, child->dwExStyle);
MoveWindow16(ci->hwndChildMaximized, rect.left, rect.top,
rect.right - rect.left, rect.bottom - rect.top, 1);
}
AdjustWindowRectEx16(&rect, child->dwStyle, 0, child->dwExStyle);
MoveWindow16(ci->hwndChildMaximized, rect.left, rect.top,
rect.right - rect.left, rect.bottom - rect.top, 1);
}
else
MDI_PostUpdate(hwnd, ci, SB_BOTH+1);
break;
case WM_MDICALCCHILDSCROLL:
if( ci->sbNeedUpdate )
if( ci->sbRecalc )
{
CalcChildScroll(hwnd, ci->sbRecalc-1);
ci->sbRecalc = ci->sbNeedUpdate = 0;
}
if( (ci->mdiFlags & MDIF_NEEDUPDATE) && ci->sbRecalc )
{
CalcChildScroll(hwnd, ci->sbRecalc-1);
ci->sbRecalc = 0;
ci->mdiFlags &= ~MDIF_NEEDUPDATE;
}
return 0;
}
......@@ -1236,20 +1245,20 @@ LRESULT DefFrameProc16( HWND16 hwnd, HWND16 hwndMDIClient, UINT16 message,
if( !(wndPtr->parent->dwStyle & WS_MINIMIZE)
&& ci->hwndActiveChild && !ci->hwndChildMaximized )
{
{
/* control menu is between the frame system menu and
* the first entry of menu bar */
if( wParam == VK_LEFT )
{ if( wndPtr->parent->wIDmenu != LOWORD(lParam) ) break; }
else if( wParam == VK_RIGHT )
{ if( GetSystemMenu16( wndPtr->parent->hwndSelf, 0)
!= LOWORD(lParam) ) break; }
else break;
return MAKELONG( GetSystemMenu16(ci->hwndActiveChild, 0),
ci->hwndActiveChild );
}
if( (wParam == VK_LEFT &&
wndPtr->parent->wIDmenu == LOWORD(lParam)) ||
(wParam == VK_RIGHT &&
GetSubMenu16(wndPtr->parent->hSysMenu, 0) == LOWORD(lParam)) )
{
wndPtr = WIN_FindWndPtr(ci->hwndActiveChild);
return MAKELONG( GetSubMenu16(wndPtr->hSysMenu, 0),
ci->hwndActiveChild);
}
}
break;
}
}
......@@ -1405,8 +1414,7 @@ LRESULT DefMDIChildProc16( HWND16 hwnd, UINT16 message,
return 0;
case WM_SETVISIBLE:
if( ci->hwndChildMaximized)
ci->sbNeedUpdate = 0;
if( ci->hwndChildMaximized) ci->mdiFlags &= ~MDIF_NEEDUPDATE;
else
MDI_PostUpdate(clientWnd->hwndSelf, ci, SB_BOTH+1);
break;
......@@ -1469,7 +1477,7 @@ LRESULT DefMDIChildProc16( HWND16 hwnd, UINT16 message,
case WM_NEXTMENU:
if( wParam == VK_LEFT ) /* switch to frame system menu */
return MAKELONG( GetSystemMenu16(clientWnd->parent->hwndSelf, 0),
return MAKELONG( GetSubMenu16(clientWnd->parent->hSysMenu, 0),
clientWnd->parent->hwndSelf );
if( wParam == VK_RIGHT ) /* to frame menu bar */
return MAKELONG( clientWnd->parent->wIDmenu,
......@@ -1598,42 +1606,49 @@ BOOL32 TranslateMDISysAccel32( HWND32 hwndClient, LPMSG32 msg )
*/
BOOL16 TranslateMDISysAccel16( HWND16 hwndClient, LPMSG16 msg )
{
WND* clientWnd = WIN_FindWndPtr( hwndClient);
WND* wnd;
MDICLIENTINFO *ci = NULL;
WPARAM16 wParam = 0;
if( (msg->message != WM_KEYDOWN && msg->message != WM_SYSKEYDOWN) || !clientWnd )
return 0;
WND* clientWnd = WIN_FindWndPtr( hwndClient);
WND* wnd;
MDICLIENTINFO *ci = NULL;
WPARAM16 wParam = 0;
ci = (MDICLIENTINFO*) clientWnd->wExtra;
wnd = WIN_FindWndPtr(ci->hwndActiveChild);
if( !wnd ) return 0;
if( wnd->dwStyle & WS_DISABLED ) return 0;
if ((GetKeyState32(VK_CONTROL) & 0x8000) && !(GetKeyState32(VK_MENU) & 0x8000))
switch( msg->wParam )
{
case VK_F6:
case VK_SEPARATOR:
wParam = ( GetKeyState32(VK_SHIFT) & 0x8000 )? SC_NEXTWINDOW: SC_PREVWINDOW;
break;
case VK_F4:
case VK_RBUTTON:
wParam = SC_CLOSE;
break;
default:
return 0;
}
else
return 0;
if( clientWnd && (msg->message == WM_KEYDOWN || msg->message == WM_SYSKEYDOWN))
{
MDICLIENTINFO *ci = NULL;
WND* wnd;
dprintf_mdi(stddeb,"TranslateMDISysAccel: wParam = %04x\n", wParam);
ci = (MDICLIENTINFO*) clientWnd->wExtra;
wnd = WIN_FindWndPtr(ci->hwndActiveChild);
if( wnd && !(wnd->dwStyle & WS_DISABLED) )
{
WPARAM16 wParam = 0;
SendMessage16(ci->hwndActiveChild,WM_SYSCOMMAND, wParam, (LPARAM)msg->wParam);
return 1;
/* translate if the Ctrl key is down and Alt not. */
if( (GetKeyState32(VK_CONTROL) & 0x8000) &&
!(GetKeyState32(VK_MENU) & 0x8000))
{
switch( msg->wParam )
{
case VK_F6:
case VK_SEPARATOR:
wParam = ( GetKeyState32(VK_SHIFT) & 0x8000 )
? SC_NEXTWINDOW : SC_PREVWINDOW;
break;
case VK_F4:
case VK_RBUTTON:
wParam = SC_CLOSE;
break;
default:
return 0;
}
dprintf_mdi(stddeb,"TranslateMDISysAccel: wParam = %04x\n", wParam);
SendMessage16( ci->hwndActiveChild, WM_SYSCOMMAND,
wParam, (LPARAM)msg->wParam);
return 1;
}
}
}
return 0; /* failure */
}
......
......@@ -1055,7 +1055,7 @@ LRESULT SendMessage16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, LPARAM lParam)
fprintf( stderr, "SendMessage16: invalid hwnd %04x\n", hwnd );
return 0;
}
if (QUEUE_IsDoomedQueue(wndPtr->hmemTaskQ))
if (QUEUE_IsExitingQueue(wndPtr->hmemTaskQ))
return 0; /* Don't send anything if the task is dying */
if (wndPtr->hmemTaskQ != GetTaskQueue(0))
return MSG_SendMessage( wndPtr->hmemTaskQ, hwnd, msg, wParam, lParam );
......@@ -1120,7 +1120,7 @@ LRESULT SendMessage32A(HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
return 0;
}
if (QUEUE_IsDoomedQueue(wndPtr->hmemTaskQ))
if (QUEUE_IsExitingQueue(wndPtr->hmemTaskQ))
return 0; /* Don't send anything if the task is dying */
if (wndPtr->hmemTaskQ != GetTaskQueue(0))
......@@ -1168,7 +1168,7 @@ LRESULT SendMessage32W(HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
fprintf( stderr, "SendMessage32W: invalid hwnd %08x\n", hwnd );
return 0;
}
if (QUEUE_IsDoomedQueue(wndPtr->hmemTaskQ))
if (QUEUE_IsExitingQueue(wndPtr->hmemTaskQ))
return 0; /* Don't send anything if the task is dying */
if (wndPtr->hmemTaskQ != GetTaskQueue(0))
{
......
......@@ -465,11 +465,11 @@ static void NC_DrawMaxButton( HWND32 hwnd, HDC16 hdc, BOOL32 down )
if( !(wndPtr->flags & WIN_MANAGED) )
{
NC_GetInsideRect( hwnd, &rect );
GRAPH_DrawBitmap( hdc, (IsZoomed32(hwnd) ?
(down ? hbitmapRestoreD : hbitmapRestore) :
(down ? hbitmapMaximizeD : hbitmapMaximize)),
GRAPH_DrawBitmap( hdc, (IsZoomed32(hwnd)
? (down ? hbitmapRestoreD : hbitmapRestore)
: (down ? hbitmapMaximizeD : hbitmapMaximize)),
rect.right - SYSMETRICS_CXSIZE - 1, rect.top,
0, 0, SYSMETRICS_CXSIZE+1, SYSMETRICS_CYSIZE );
0, 0, SYSMETRICS_CXSIZE+1, SYSMETRICS_CYSIZE, FALSE );
}
}
......@@ -488,7 +488,7 @@ static void NC_DrawMinButton( HWND32 hwnd, HDC16 hdc, BOOL32 down )
if (wndPtr->dwStyle & WS_MAXIMIZEBOX) rect.right -= SYSMETRICS_CXSIZE+1;
GRAPH_DrawBitmap( hdc, (down ? hbitmapMinimizeD : hbitmapMinimize),
rect.right - SYSMETRICS_CXSIZE - 1, rect.top,
0, 0, SYSMETRICS_CXSIZE+1, SYSMETRICS_CYSIZE );
0, 0, SYSMETRICS_CXSIZE+1, SYSMETRICS_CYSIZE, FALSE );
}
}
......@@ -927,19 +927,18 @@ static void NC_TrackSysMenu( HWND32 hwnd, POINT16 pt )
* Initialisation of a move or resize, when initiatied from a menu choice.
* Return hit test code for caption or sizing border.
*/
static LONG NC_StartSizeMove( HWND32 hwnd, WPARAM16 wParam,
static LONG NC_StartSizeMove( WND* wndPtr, WPARAM16 wParam,
POINT16 *capturePoint )
{
LONG hittest = 0;
POINT16 pt;
MSG16 msg;
WND * wndPtr = WIN_FindWndPtr( hwnd );
if ((wParam & 0xfff0) == SC_MOVE)
{
/* Move pointer at the center of the caption */
RECT32 rect;
NC_GetInsideRect( hwnd, &rect );
NC_GetInsideRect( wndPtr->hwndSelf, &rect );
if (wndPtr->dwStyle & WS_SYSMENU)
rect.left += SYSMETRICS_CXSIZE + 1;
if (wndPtr->dwStyle & WS_MINIMIZEBOX)
......@@ -948,20 +947,21 @@ static LONG NC_StartSizeMove( HWND32 hwnd, WPARAM16 wParam,
rect.right -= SYSMETRICS_CXSIZE + 1;
pt.x = wndPtr->rectWindow.left + (rect.right - rect.left) / 2;
pt.y = wndPtr->rectWindow.top + rect.top + SYSMETRICS_CYSIZE/2;
hittest = HTCAPTION;
*capturePoint = pt;
if (wndPtr->dwStyle & WS_CHILD)
ClientToScreen16( wndPtr->parent->hwndSelf, &pt );
hittest = HTCAPTION;
}
else /* SC_SIZE */
{
SetCapture32(hwnd);
while(!hittest)
{
MSG_InternalGetMessage( &msg, 0, 0, MSGF_SIZE, PM_REMOVE, FALSE );
switch(msg.message)
{
case WM_MOUSEMOVE:
hittest = NC_HandleNCHitTest( hwnd, msg.pt );
hittest = NC_HandleNCHitTest( wndPtr->hwndSelf, msg.pt );
pt = msg.pt;
if ((hittest < HTLEFT) || (hittest > HTBOTTOMRIGHT))
hittest = 0;
......@@ -998,10 +998,11 @@ static LONG NC_StartSizeMove( HWND32 hwnd, WPARAM16 wParam,
}
}
}
*capturePoint = pt;
}
*capturePoint = pt;
SetCursorPos32( capturePoint->x, capturePoint->y );
NC_HandleSetCursor( hwnd, (WPARAM16)hwnd, MAKELONG( hittest, WM_MOUSEMOVE ));
SetCursorPos32( pt.x, pt.y );
NC_HandleSetCursor( wndPtr->hwndSelf,
wndPtr->hwndSelf, MAKELONG( hittest, WM_MOUSEMOVE ));
return hittest;
}
......@@ -1030,17 +1031,18 @@ static void NC_DoSizeMove( HWND32 hwnd, WORD wParam, POINT16 pt )
if ((wParam & 0xfff0) == SC_MOVE)
{
if (!(wndPtr->dwStyle & WS_CAPTION)) return;
if (!hittest) hittest = NC_StartSizeMove( hwnd, wParam, &capturePoint );
if (!hittest)
hittest = NC_StartSizeMove( wndPtr, wParam, &capturePoint );
if (!hittest) return;
}
else /* SC_SIZE */
{
if (!thickframe) return;
if (hittest) hittest += HTLEFT-1;
if ( hittest && hittest != HTSYSMENU ) hittest += 2;
else
{
SetCapture32(hwnd);
hittest = NC_StartSizeMove( hwnd, wParam, &capturePoint );
hittest = NC_StartSizeMove( wndPtr, wParam, &capturePoint );
if (!hittest)
{
ReleaseCapture();
......@@ -1055,7 +1057,8 @@ static void NC_DoSizeMove( HWND32 hwnd, WORD wParam, POINT16 pt )
sizingRect = wndPtr->rectWindow;
if (wndPtr->dwStyle & WS_CHILD)
GetClientRect16( wndPtr->parent->hwndSelf, &mouseRect );
else SetRect16(&mouseRect, 0, 0, SYSMETRICS_CXSCREEN, SYSMETRICS_CYSCREEN);
else
SetRect16(&mouseRect, 0, 0, SYSMETRICS_CXSCREEN, SYSMETRICS_CYSCREEN);
if (ON_LEFT_BORDER(hittest))
{
mouseRect.left = MAX( mouseRect.left, sizingRect.right-maxTrack.x );
......@@ -1361,7 +1364,8 @@ LONG NC_HandleNCLButtonDown( HWND32 hwnd, WPARAM16 wParam, LPARAM lParam )
case HTBOTTOM:
case HTBOTTOMLEFT:
case HTBOTTOMRIGHT:
SendMessage16( hwnd, WM_SYSCOMMAND, SC_SIZE + wParam - HTLEFT+1, lParam);
/* make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU */
SendMessage16( hwnd, WM_SYSCOMMAND, SC_SIZE + wParam - 2, lParam);
break;
case HTBORDER:
......@@ -1416,14 +1420,15 @@ LONG NC_HandleSysCommand( HWND32 hwnd, WPARAM16 wParam, POINT16 pt )
{
WND *wndPtr = WIN_FindWndPtr( hwnd );
POINT32 pt32;
UINT16 uCommand = wParam & 0xFFF0;
dprintf_nonclient(stddeb, "Handling WM_SYSCOMMAND %x %d,%d\n",
wParam, pt.x, pt.y );
if (wndPtr->dwStyle & WS_CHILD && wParam != SC_KEYMENU )
if (wndPtr->dwStyle & WS_CHILD && uCommand != SC_KEYMENU )
ScreenToClient16( wndPtr->parent->hwndSelf, &pt );
switch (wParam & 0xfff0)
switch (uCommand)
{
case SC_SIZE:
case SC_MOVE:
......
......@@ -19,7 +19,7 @@
#define MAX_QUEUE_SIZE 120 /* Max. size of a message queue */
static HQUEUE16 hFirstQueue = 0;
static HQUEUE16 hDoomedQueue = 0;
static HQUEUE16 hExitingQueue = 0;
static HQUEUE16 hmemSysMsgQueue = 0;
static MESSAGEQUEUE *sysMsgQueue = NULL;
......@@ -94,20 +94,20 @@ void QUEUE_WalkQueues(void)
/***********************************************************************
* QUEUE_IsDoomedQueue
* QUEUE_IsExitingQueue
*/
BOOL32 QUEUE_IsDoomedQueue( HQUEUE16 hQueue )
BOOL32 QUEUE_IsExitingQueue( HQUEUE16 hQueue )
{
return (hDoomedQueue && (hQueue == hDoomedQueue));
return (hExitingQueue && (hQueue == hExitingQueue));
}
/***********************************************************************
* QUEUE_SetDoomedQueue
* QUEUE_SetExitingQueue
*/
void QUEUE_SetDoomedQueue( HQUEUE16 hQueue )
void QUEUE_SetExitingQueue( HQUEUE16 hQueue )
{
hDoomedQueue = hQueue;
hExitingQueue = hQueue;
}
......
......@@ -21,7 +21,7 @@
WORD USER_HeapSel = 0;
extern BOOL32 MENU_SwitchTPWndTo(HTASK16);
extern BOOL32 MENU_PatchResidentPopup( HQUEUE16, WND* );
extern void QUEUE_FlushMessages(HQUEUE16);
/***********************************************************************
......@@ -108,7 +108,7 @@ INT16 InitApp( HINSTANCE16 hInstance )
}
/**********************************************************************
* USER_AppExit
* USER_AppExit
*/
void USER_AppExit( HTASK16 hTask, HINSTANCE16 hInstance, HQUEUE16 hQueue )
{
......@@ -123,16 +123,16 @@ void USER_AppExit( HTASK16 hTask, HINSTANCE16 hInstance, HQUEUE16 hQueue )
desktop->hmemTaskQ = GetTaskQueue(TASK_GetNextTask(hTask));
/* Patch resident popup menu window */
MENU_SwitchTPWndTo(0);
MENU_PatchResidentPopup( hQueue, NULL );
TIMER_RemoveQueueTimers( hQueue );
QUEUE_FlushMessages( hQueue );
HOOK_FreeQueueHooks( hQueue );
QUEUE_SetDoomedQueue( hQueue );
QUEUE_SetExitingQueue( hQueue );
WIN_ResetQueueWindows( desktop->child, hQueue, (HQUEUE16)0);
QUEUE_SetDoomedQueue( 0 );
QUEUE_SetExitingQueue( 0 );
/* Free the message queue */
......
......@@ -43,6 +43,7 @@ static HWND32 hwndSysModal = 0;
static WORD wDragWidth = 4;
static WORD wDragHeight= 3;
extern BOOL32 MENU_PatchResidentPopup( HQUEUE16, WND* );
extern HCURSOR16 CURSORICON_IconToCursor(HICON16, BOOL32);
extern HWND32 CARET_GetHwnd(void);
extern BOOL32 WINPOS_ActivateOtherWindow(WND* pWnd);
......@@ -569,8 +570,9 @@ static HWND32 WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom,
wndPtr->pVScroll = NULL;
wndPtr->pHScroll = NULL;
wndPtr->pProp = NULL;
wndPtr->hSysMenu = MENU_GetDefSysMenu();
wndPtr->userdata = 0;
wndPtr->hSysMenu = (wndPtr->dwStyle & WS_SYSMENU)
? MENU_GetSysMenu( hwnd, 0 ) : 0;
if (classPtr->cbWndExtra) memset( wndPtr->wExtra, 0, classPtr->cbWndExtra);
......@@ -1000,7 +1002,7 @@ BOOL32 DestroyWindow32( HWND32 hwnd )
/* FIXME: clean up palette - see "Internals" p.352 */
}
if( !QUEUE_IsDoomedQueue(wndPtr->hmemTaskQ) )
if( !QUEUE_IsExitingQueue(wndPtr->hmemTaskQ) )
WIN_SendParentNotify( hwnd, WM_DESTROY, wndPtr->wIDmenu, (LPARAM)hwnd );
if (!IsWindow32(hwnd)) return TRUE;
......@@ -1012,7 +1014,7 @@ BOOL32 DestroyWindow32( HWND32 hwnd )
{
SetWindowPos32( hwnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW |
SWP_NOACTIVATE|SWP_NOZORDER|SWP_NOMOVE|SWP_NOSIZE|
((QUEUE_IsDoomedQueue(wndPtr->hmemTaskQ))?SWP_DEFERERASE:0) );
((QUEUE_IsExitingQueue(wndPtr->hmemTaskQ))?SWP_DEFERERASE:0) );
if (!IsWindow32(hwnd)) return TRUE;
}
......@@ -1020,6 +1022,9 @@ BOOL32 DestroyWindow32( HWND32 hwnd )
if( !(wndPtr->dwStyle & WS_CHILD) )
{
/* make sure top menu popup doesn't get destroyed */
MENU_PatchResidentPopup( TRUE, wndPtr );
for (;;)
{
WND *siblingPtr = wndPtr->parent->child; /* First sibling */
......
......@@ -1181,7 +1181,7 @@ BOOL32 WINPOS_ActivateOtherWindow(WND* pWnd)
hwndPrevActive = 0;
if( hwndActive != pWnd->hwndSelf &&
( hwndActive || QUEUE_IsDoomedQueue(pWnd->hmemTaskQ)) )
( hwndActive || QUEUE_IsExitingQueue(pWnd->hmemTaskQ)) )
return 0;
if( pWnd->dwStyle & WS_POPUP &&
......
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