Commit f7207259 authored by Alexandre Julliard's avatar Alexandre Julliard

Release 940722

Mon Jul 18 23:55:13 MET DST 1994 * [if1632/call.S] CallTo16(): added `mov %eax,%edx' just before lcall, to make sure that DX contain the DLL's hinstance when initialised. CallTo32_16() added, equal to CallTo32() except for one thing: it saves DX and * [tools/build.c] Added some code to support 16 and 32 bit return values. * [1632/{kernel,user}.spec] Changed most of the `pascal' style to pascal_16 when function returned a 16bit value. Tue Jul 19 18:40:25 1994 Alexandre Julliard (julliard@lamisun.epfl.ch) * [controls/menu.c] Reorganized sizing and drawing code to implement multi-line menus. Implemented MENUBREAK style. Use system colors to draw menus. * [objects/color.c] Bug fix in COLOR_IsSolid(). * [objects/font.c] Bug fix in FONT_GetMetrics(): calculate average character width only on existing chars (dialogs look much better). * [objects/text.c] Bug fix in DrawText(): use text color to underline mnemonic. * [windows/nonclient.c] Changed WM_NCHITTEST handling to cope with multi-line menu bars. * [windows/syscolor.c] Added system objects for menu colors. Mon Jul 18 19:32:08 PDT 1994 Andrew Lagodzinski (andrew@netcom.com) * [controls/menu.c] Fixed bug in SelectPrevItem that caused seperators to not be skipped when using the up arrow key.
parent 2d159fb7
---------------------------------------------------------------------- ----------------------------------------------------------------------
Mon Jul 18 23:55:13 MET DST 1994
* [if1632/call.S]
CallTo16(): added `mov %eax,%edx' just before lcall,
to make sure that DX contain the DLL's hinstance when
initialised.
CallTo32_16() added, equal to CallTo32() except for
one thing: it saves DX and
* [tools/build.c]
Added some code to support 16 and 32 bit return values.
* [1632/{kernel,user}.spec]
Changed most of the `pascal' style to pascal_16 when
function returned a 16bit value.
Tue Jul 19 18:40:25 1994 Alexandre Julliard (julliard@lamisun.epfl.ch)
* [controls/menu.c]
Reorganized sizing and drawing code to implement multi-line menus.
Implemented MENUBREAK style.
Use system colors to draw menus.
* [objects/color.c]
Bug fix in COLOR_IsSolid().
* [objects/font.c]
Bug fix in FONT_GetMetrics(): calculate average character width
only on existing chars (dialogs look much better).
* [objects/text.c]
Bug fix in DrawText(): use text color to underline mnemonic.
* [windows/nonclient.c]
Changed WM_NCHITTEST handling to cope with multi-line menu bars.
* [windows/syscolor.c]
Added system objects for menu colors.
Mon Jul 18 19:32:08 PDT 1994 Andrew Lagodzinski (andrew@netcom.com)
* [controls/menu.c]
Fixed bug in SelectPrevItem that caused seperators to not be
skipped when using the up arrow key.
----------------------------------------------------------------------
Thu Jul 14 17:50:45 1994 Bob Amstadt (bob@pooh) Thu Jul 14 17:50:45 1994 Bob Amstadt (bob@pooh)
* [Configure] * [Configure]
......
...@@ -37,7 +37,7 @@ static WNDCLASS WIDGETS_BuiltinClasses[] = ...@@ -37,7 +37,7 @@ static WNDCLASS WIDGETS_BuiltinClasses[] =
{ CS_GLOBALCLASS, (LONG(*)())EditWndProc, 0, 4, { CS_GLOBALCLASS, (LONG(*)())EditWndProc, 0, 4,
0, 0, 0, 0, NULL, "EDIT" }, 0, 0, 0, 0, NULL, "EDIT" },
{ CS_GLOBALCLASS | CS_SAVEBITS, (LONG(*)())PopupMenuWndProc, 0, 8, { CS_GLOBALCLASS | CS_SAVEBITS, (LONG(*)())PopupMenuWndProc, 0, 8,
0, 0, 0, 0, NULL, "POPUPMENU" }, 0, 0, 0, 0, NULL, POPUPMENU_CLASS_NAME },
{ CS_GLOBALCLASS, (LONG(*)())DesktopWndProc, 0, sizeof(DESKTOPINFO), { CS_GLOBALCLASS, (LONG(*)())DesktopWndProc, 0, sizeof(DESKTOPINFO),
0, 0, 0, 0, NULL, DESKTOP_CLASS_NAME }, 0, 0, 0, 0, NULL, DESKTOP_CLASS_NAME },
{ CS_GLOBALCLASS, (LONG(*)())DefDlgProc, 0, DLGWINDOWEXTRA, { CS_GLOBALCLASS, (LONG(*)())DefDlgProc, 0, DLGWINDOWEXTRA,
......
...@@ -190,6 +190,7 @@ _CallTo16: ...@@ -190,6 +190,7 @@ _CallTo16:
* Call entry point * Call entry point
*/ */
movw %ax,%ds movw %ax,%ds
movw %ax,%di
.byte 0x66 .byte 0x66
lcall %fs:(%edx) lcall %fs:(%edx)
...@@ -284,11 +285,16 @@ _CallTo32: ...@@ -284,11 +285,16 @@ _CallTo32:
/* /*
* Call entry point * Call entry point
*/ */
pushl %edx
pushw _IF1632_Saved16_ss pushw _IF1632_Saved16_ss
pushw _IF1632_Saved16_esp pushw _IF1632_Saved16_esp
pushl %eax pushl %eax
call _DLLRelay call _DLLRelay
popl %edx
popl %edx
popl %edx
/* /*
* Restore registers, but do not destroy return value. * Restore registers, but do not destroy return value.
*/ */
...@@ -327,6 +333,7 @@ noargs: ...@@ -327,6 +333,7 @@ noargs:
/* /*
* Last, but not least we need to move the high word from eax to dx * Last, but not least we need to move the high word from eax to dx
*/ */
pushl %eax pushl %eax
popw %dx popw %dx
popw %dx popw %dx
...@@ -335,6 +342,99 @@ noargs: ...@@ -335,6 +342,99 @@ noargs:
lret lret
/********************************************************************** /**********************************************************************
* CallTo32_16()
*
* This function is same one as CallTo32() except that the high
* word of EAX won't be moved to DX.
*/
.align 4
.globl _CallTo32_16
_CallTo32_16:
pushl %ebp
movl %esp,%ebp
/*
* Save registers. 286 mode does not have fs or gs.
*/
pushw %ds
pushw %es
/*
* Restore segment registers.
*/
pushl %eax
movw $UDATASEL,%ax
movw %ax,%ds
movw %ax,%es
popl %eax
/*
* Save old stack save variables, save stack registers, reload
* stack registers.
*/
pushl _IF1632_Saved16_esp
pushl _IF1632_Saved16_ebp
pushw _IF1632_Saved16_ss
movw %ss,_IF1632_Saved16_ss
movl %esp,_IF1632_Saved16_esp
movl %ebp,_IF1632_Saved16_ebp
movw _IF1632_Saved32_ss,%ss
movl _IF1632_Saved32_esp,%esp
movl _IF1632_Saved32_ebp,%ebp
/*
* Call entry point
*/
pushl %edx
pushw _IF1632_Saved16_ss
pushw _IF1632_Saved16_esp
pushl %eax
call _DLLRelay
popl %edx
popl %edx
popl %edx
/*
* Restore registers, but do not destroy return value.
*/
movw _IF1632_Saved16_ss,%ss
movl _IF1632_Saved16_esp,%esp
movl _IF1632_Saved16_ebp,%ebp
popw _IF1632_Saved16_ss
popl _IF1632_Saved16_ebp
popl _IF1632_Saved16_esp
popw %es
popw %ds
.align 2,0x90
leave
/*
* Now we need to ditch the parameter bytes that were left on the
* stack. We do this by effectively popping the number of bytes,
* and the return address, removing the parameters and then putting
* the return address back on the stack.
* Normally this field is filled in by the relevant function in
* the emulation library, since it should know how many bytes to
* expect.
*/
popw %gs:nbytes
cmpw $0,%gs:nbytes
je noargs2
popw %gs:offset
popw %gs:selector
addw %gs:nbytes,%esp
pushw %gs:selector
pushw %gs:offset
noargs2:
.byte 0x66
lret
/**********************************************************************
* ReturnFromRegisterFunc() * ReturnFromRegisterFunc()
*/ */
.globl _ReturnFromRegisterFunc .globl _ReturnFromRegisterFunc
......
...@@ -178,7 +178,7 @@ length 540 ...@@ -178,7 +178,7 @@ length 540
173 pascal LoadCursor(word ptr) LoadCursor(1 2) 173 pascal LoadCursor(word ptr) LoadCursor(1 2)
174 pascal LoadIcon(word ptr) LoadIcon(1 2) 174 pascal LoadIcon(word ptr) LoadIcon(1 2)
175 pascal LoadBitmap(word ptr) LoadBitmap(1 2) 175 pascal LoadBitmap(word ptr) LoadBitmap(1 2)
176 pascal LoadString(word word ptr s_word) LoadString(1 2 3 4) 176 pascal16 LoadString(word word ptr s_word) LoadString(1 2 3 4)
177 pascal LoadAccelerators(word ptr) LoadAccelerators(1 2) 177 pascal LoadAccelerators(word ptr) LoadAccelerators(1 2)
178 pascal TranslateAccelerator(word word ptr) TranslateAccelerator(1 2 3) 178 pascal TranslateAccelerator(word word ptr) TranslateAccelerator(1 2 3)
179 pascal GetSystemMetrics(word) GetSystemMetrics(1) 179 pascal GetSystemMetrics(word) GetSystemMetrics(1)
...@@ -228,9 +228,9 @@ length 540 ...@@ -228,9 +228,9 @@ length 540
220 pascal LoadMenuIndirect(ptr) LoadMenuIndirect(1) 220 pascal LoadMenuIndirect(ptr) LoadMenuIndirect(1)
221 pascal ScrollDC(word s_word s_word ptr ptr word ptr) 221 pascal ScrollDC(word s_word s_word ptr ptr word ptr)
ScrollDC(1 2 3 4 5 6 7) ScrollDC(1 2 3 4 5 6 7)
222 pascal GetKeyboardState(ptr) GetKeyboardState(1) 222 pascal16 GetKeyboardState(ptr) GetKeyboardState(1)
#223 SETKEYBOARDSTATE #223 SETKEYBOARDSTATE
224 pascal GetWindowTask(word) GetWindowTask(1) 224 pascal16 GetWindowTask(word) GetWindowTask(1)
225 pascal EnumTaskWindows(word ptr long) EnumTaskWindows(1 2 3) 225 pascal EnumTaskWindows(word ptr long) EnumTaskWindows(1 2 3)
#226 LOCKINPUT #226 LOCKINPUT
227 pascal GetNextDlgGroupItem(word word word) GetNextDlgGroupItem(1 2 3) 227 pascal GetNextDlgGroupItem(word word word) GetNextDlgGroupItem(1 2 3)
...@@ -294,7 +294,7 @@ length 540 ...@@ -294,7 +294,7 @@ length 540
281 pascal GetSysColorBrush(word) GetSysColorBrush(1) 281 pascal GetSysColorBrush(word) GetSysColorBrush(1)
282 pascal SelectPalette(word word word) SelectPalette(1 2 3) 282 pascal SelectPalette(word word word) SelectPalette(1 2 3)
283 pascal RealizePalette(word) RealizePalette(1) 283 pascal RealizePalette(word) RealizePalette(1)
284 pascal GetFreeSystemResources(word) GetFreeSystemResources(1) 284 pascal16 GetFreeSystemResources(word) GetFreeSystemResources(1)
#285 BEAR285 #285 BEAR285
286 pascal GetDesktopWindow() GetDesktopWindow() 286 pascal GetDesktopWindow() GetDesktopWindow()
#287 GETLASTACTIVEPOPUP #287 GETLASTACTIVEPOPUP
...@@ -366,15 +366,15 @@ length 540 ...@@ -366,15 +366,15 @@ length 540
421 pascal wvsprintf(ptr ptr ptr) wvsprintf(1 2 3) 421 pascal wvsprintf(ptr ptr ptr) wvsprintf(1 2 3)
#422 DLGDIRSELECTEX #422 DLGDIRSELECTEX
#423 DLGDIRSELECTCOMBOBOXEX #423 DLGDIRSELECTCOMBOBOXEX
430 pascal lstrcmp(ptr ptr) lstrcmp(1 2) 430 pascal16 lstrcmp(ptr ptr) lstrcmp(1 2)
431 pascal AnsiUpper(ptr) AnsiUpper(1) 431 pascal AnsiUpper(ptr) AnsiUpper(1)
432 pascal AnsiLower(ptr) AnsiLower(1) 432 pascal AnsiLower(ptr) AnsiLower(1)
433 pascal IsCharAlpha(byte) IsCharAlpha(1) 433 pascal16 IsCharAlpha(byte) IsCharAlpha(1)
434 pascal IsCharAlphanumeric(byte) IsCharAlphanumeric(1) 434 pascal16 IsCharAlphanumeric(byte) IsCharAlphanumeric(1)
435 pascal IsCharUpper(byte) IsCharUpper(1) 435 pascal16 IsCharUpper(byte) IsCharUpper(1)
436 pascal IsCharLower(byte) IsCharLower(1) 436 pascal16 IsCharLower(byte) IsCharLower(1)
437 pascal AnsiUpperBuff(ptr word) AnsiUpperBuff(1 2) 437 pascal16 AnsiUpperBuff(ptr word) AnsiUpperBuff(1 2)
438 pascal AnsiLowerBuff(ptr word) AnsiLowerBuff(1 2) 438 pascal16 AnsiLowerBuff(ptr word) AnsiLowerBuff(1 2)
445 pascal DefFrameProc(word word word word long) DefFrameProc(1 2 3 4 5) 445 pascal DefFrameProc(word word word word long) DefFrameProc(1 2 3 4 5)
447 pascal DefMDIChildProc(word word word long) DefMDIChildProc(1 2 3 4) 447 pascal DefMDIChildProc(word word word long) DefMDIChildProc(1 2 3 4)
451 pascal TranslateMDISysAccel(word ptr) TranslateMDISysAccel(1 2) 451 pascal TranslateMDISysAccel(word ptr) TranslateMDISysAccel(1 2)
...@@ -395,7 +395,7 @@ length 540 ...@@ -395,7 +395,7 @@ length 540
#465 DRAGDETECT #465 DRAGDETECT
466 pascal DrawFocusRect(word ptr) DrawFocusRect(1 2) 466 pascal DrawFocusRect(word ptr) DrawFocusRect(1 2)
#470 STRINGFUNC #470 STRINGFUNC
471 pascal lstrcmpi(ptr ptr) lstrcmpi(1 2) 471 pascal16 lstrcmpi(ptr ptr) lstrcmpi(1 2)
472 pascal AnsiNext(ptr) AnsiNext(1 ) 472 pascal AnsiNext(ptr) AnsiNext(1 )
473 pascal AnsiPrev(ptr ptr) AnsiPrev(1 2) 473 pascal AnsiPrev(ptr ptr) AnsiPrev(1 2)
#480 GETUSERLOCALOBJTYPE #480 GETUSERLOCALOBJTYPE
...@@ -415,13 +415,13 @@ length 540 ...@@ -415,13 +415,13 @@ length 540
#509 WNETUNWATCHQUEUE #509 WNETUNWATCHQUEUE
#510 WNETLOCKQUEUEDATA #510 WNETLOCKQUEUEDATA
#511 WNETUNLOCKQUEUEDATA #511 WNETUNLOCKQUEUEDATA
512 pascal WNetGetConnection(ptr ptr ptr) WNetGetConnection(1 2 3) 512 pascal16 WNetGetConnection(ptr ptr ptr) WNetGetConnection(1 2 3)
513 pascal WNetGetCaps(word) WNetGetCaps(1) 513 pascal WNetGetCaps(word) WNetGetCaps(1)
#514 WNETDEVICEMODE #514 WNETDEVICEMODE
#515 WNETBROWSEDIALOG #515 WNETBROWSEDIALOG
516 pascal WNetGetUser(ptr ptr ptr) WNetGetUser(1 2 3) 516 pascal WNetGetUser(ptr ptr ptr) WNetGetUser(1 2 3)
517 pascal WNetAddConnection(ptr ptr ptr) WNetAddConnection(1 2 3) 517 pascal16 WNetAddConnection(ptr ptr ptr) WNetAddConnection(1 2 3)
518 pascal WNetCancelConnection(ptr word) WNetCancelConnection(1 2) 518 pascal16 WNetCancelConnection(ptr word) WNetCancelConnection(1 2)
#519 WNETGETERROR #519 WNETGETERROR
#520 WNETGETERRORTEXT #520 WNETGETERRORTEXT
#521 WNETENABLE #521 WNETENABLE
......
...@@ -15,7 +15,7 @@ struct SysColorObjects ...@@ -15,7 +15,7 @@ struct SysColorObjects
/* COLOR_BACKGROUND */ /* COLOR_BACKGROUND */
HBRUSH hbrushActiveCaption; /* COLOR_ACTIVECAPTION */ HBRUSH hbrushActiveCaption; /* COLOR_ACTIVECAPTION */
HBRUSH hbrushInactiveCaption; /* COLOR_INACTIVECAPTION */ HBRUSH hbrushInactiveCaption; /* COLOR_INACTIVECAPTION */
/* COLOR_MENU */ HBRUSH hbrushMenu; /* COLOR_MENU */
HBRUSH hbrushWindow; /* COLOR_WINDOW */ HBRUSH hbrushWindow; /* COLOR_WINDOW */
HPEN hpenWindowFrame; /* COLOR_WINDOWFRAME */ HPEN hpenWindowFrame; /* COLOR_WINDOWFRAME */
/* COLOR_MENUTEXT */ /* COLOR_MENUTEXT */
...@@ -24,7 +24,7 @@ struct SysColorObjects ...@@ -24,7 +24,7 @@ struct SysColorObjects
HBRUSH hbrushActiveBorder; /* COLOR_ACTIVEBORDER */ HBRUSH hbrushActiveBorder; /* COLOR_ACTIVEBORDER */
HBRUSH hbrushInactiveBorder; /* COLOR_INACTIVEBORDER */ HBRUSH hbrushInactiveBorder; /* COLOR_INACTIVEBORDER */
/* COLOR_APPWORKSPACE */ /* COLOR_APPWORKSPACE */
/* COLOR_HIGHLIGHT */ HBRUSH hbrushHighlight; /* COLOR_HIGHLIGHT */
/* COLOR_HIGHLIGHTTEXT */ /* COLOR_HIGHLIGHTTEXT */
HBRUSH hbrushBtnFace; /* COLOR_BTNFACE */ HBRUSH hbrushBtnFace; /* COLOR_BTNFACE */
HBRUSH hbrushBtnShadow; /* COLOR_BTNSHADOW */ HBRUSH hbrushBtnShadow; /* COLOR_BTNSHADOW */
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#if defined(__NetBSD__) || defined(__FreeBSD__) #if defined(__NetBSD__) || defined(__FreeBSD__)
#include <sys/syscall.h> #include <sys/syscall.h>
#include <sys/param.h>
#else #else
#include <syscall.h> #include <syscall.h>
#endif #endif
...@@ -20,13 +21,14 @@ ...@@ -20,13 +21,14 @@
#include "prototypes.h" #include "prototypes.h"
#include "win.h" #include "win.h"
#if !defined(BSD4_4) || defined(linux)
char * cstack[4096]; char * cstack[4096];
#endif
struct sigaction segv_act; struct sigaction segv_act;
#ifdef linux #ifdef linux
extern void ___sig_restore(); extern void ___sig_restore();
extern void ___masksig_restore(); extern void ___masksig_restore();
#endif
/* Similar to the sigaction function in libc, except it leaves alone the /* Similar to the sigaction function in libc, except it leaves alone the
restorer field */ restorer field */
...@@ -41,6 +43,7 @@ wine_sigaction(int sig,struct sigaction * new, struct sigaction * old) ...@@ -41,6 +43,7 @@ wine_sigaction(int sig,struct sigaction * new, struct sigaction * old)
errno = -sig; errno = -sig;
return -1; return -1;
} }
#endif
int do_int(int intnum, struct sigcontext_struct *scp) int do_int(int intnum, struct sigcontext_struct *scp)
{ {
...@@ -111,7 +114,7 @@ static void win_fault(int signal, int code, struct sigcontext *scp) ...@@ -111,7 +114,7 @@ static void win_fault(int signal, int code, struct sigcontext *scp)
#endif #endif
#if defined(__NetBSD__) || defined(__FreeBSD__) #if defined(__NetBSD__) || defined(__FreeBSD__)
/* set_es(0x27); set_ds(0x27); */ /* set_es(0x27); set_ds(0x27); */
if(signal != SIGBUS) if(signal != SIGBUS && signal != SIGSEGV && signal != SIGTRAP)
exit(1); exit(1);
if(scp->sc_cs == 0x1f) if(scp->sc_cs == 0x1f)
{ {
...@@ -181,7 +184,7 @@ static void win_fault(int signal, int code, struct sigcontext *scp) ...@@ -181,7 +184,7 @@ static void win_fault(int signal, int code, struct sigcontext *scp)
XUngrabServer(display); XUngrabServer(display);
XFlush(display); XFlush(display);
fprintf(stderr,"In win_fault %x:%x\n", scp->sc_cs, scp->sc_eip); fprintf(stderr,"In win_fault %x:%x\n", scp->sc_cs, scp->sc_eip);
#ifdef linux #if defined(linux) || defined(__NetBSD__)
wine_debug(signal, scp); /* Enter our debugger */ wine_debug(signal, scp); /* Enter our debugger */
#else #else
fprintf(stderr,"Stack: %x:%x\n", scp->sc_ss, scp->sc_esp); fprintf(stderr,"Stack: %x:%x\n", scp->sc_ss, scp->sc_esp);
...@@ -213,8 +216,23 @@ int init_wine_signals(void) ...@@ -213,8 +216,23 @@ int init_wine_signals(void)
wine_sigaction(SIGTRAP, &segv_act, NULL); /* For breakpoints */ wine_sigaction(SIGTRAP, &segv_act, NULL); /* For breakpoints */
#endif #endif
#if defined(__NetBSD__) || defined(__FreeBSD__) #if defined(__NetBSD__) || defined(__FreeBSD__)
struct sigstack ss;
sigset_t sig_mask; sigset_t sig_mask;
#ifdef BSD4_4
struct sigaltstack ss;
if ((ss.ss_base = malloc(MINSIGSTKSZ)) == NULL) {
fprintf(stderr, "Unable to allocate signal stack (%d bytes)\n",
MINSIGSTKSZ);
exit(1);
}
ss.ss_size = MINSIGSTKSZ;
ss.ss_flags = 0;
if (sigaltstack(&ss, NULL) < 0) {
perror("sigstack");
exit(1);
}
#else
struct sigstack ss;
ss.ss_sp = (char *) (((unsigned int)(cstack) + sizeof(cstack) - 4) & ~3); ss.ss_sp = (char *) (((unsigned int)(cstack) + sizeof(cstack) - 4) & ~3);
ss.ss_onstack = 0; ss.ss_onstack = 0;
...@@ -222,12 +240,27 @@ int init_wine_signals(void) ...@@ -222,12 +240,27 @@ int init_wine_signals(void)
perror("sigstack"); perror("sigstack");
exit(1); exit(1);
} }
#endif
sigemptyset(&sig_mask); sigemptyset(&sig_mask);
segv_act.sa_handler = (__sighandler_t) win_fault; segv_act.sa_handler = (void (*)) win_fault;
segv_act.sa_flags = SA_ONSTACK; segv_act.sa_flags = SA_ONSTACK;
segv_act.sa_mask = sig_mask; segv_act.sa_mask = sig_mask;
if (sigaction(SIGBUS, &segv_act, NULL) < 0) { if (sigaction(SIGBUS, &segv_act, NULL) < 0) {
perror("sigaction"); perror("sigaction: SIGBUS");
exit(1);
}
segv_act.sa_handler = (void (*)) win_fault;
segv_act.sa_flags = SA_ONSTACK;
segv_act.sa_mask = sig_mask;
if (sigaction(SIGSEGV, &segv_act, NULL) < 0) {
perror("sigaction: SIGSEGV");
exit(1);
}
segv_act.sa_handler = (void (*)) win_fault; /* For breakpoints */
segv_act.sa_flags = SA_ONSTACK;
segv_act.sa_mask = sig_mask;
if (sigaction(SIGTRAP, &segv_act, NULL) < 0) {
perror("sigaction: SIGTRAP");
exit(1); exit(1);
} }
#endif #endif
......
...@@ -18,8 +18,10 @@ static char Copyright[] = "Copyright Martin Ayotte, 1994"; ...@@ -18,8 +18,10 @@ static char Copyright[] = "Copyright Martin Ayotte, 1994";
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#ifdef linux
#include <linux/soundcard.h> #include <linux/soundcard.h>
#include <linux/cdrom.h> #include <linux/cdrom.h>
#endif
#define SOUND_DEV "/dev/dsp" #define SOUND_DEV "/dev/dsp"
#define CDAUDIO_DEV "/dev/sbpcd" #define CDAUDIO_DEV "/dev/sbpcd"
...@@ -37,6 +39,7 @@ static char Copyright[] = "Copyright Martin Ayotte, 1994"; ...@@ -37,6 +39,7 @@ static char Copyright[] = "Copyright Martin Ayotte, 1994";
#define CDFRAMES_PERMIN 4500 #define CDFRAMES_PERMIN 4500
#define SECONDS_PERMIN 60 #define SECONDS_PERMIN 60
#ifdef linux
typedef struct { typedef struct {
int nUseCount; /* Incremented for each shared open */ int nUseCount; /* Incremented for each shared open */
BOOL fShareable; /* TRUE if first open was shareable */ BOOL fShareable; /* TRUE if first open was shareable */
...@@ -57,6 +60,7 @@ typedef struct { ...@@ -57,6 +60,7 @@ typedef struct {
} LINUX_CDAUDIO; } LINUX_CDAUDIO;
static LINUX_CDAUDIO CDADev[MAX_CDAUDIODRV]; static LINUX_CDAUDIO CDADev[MAX_CDAUDIODRV];
#endif
UINT CDAUDIO_GetNumberOfTracks(UINT wDevID); UINT CDAUDIO_GetNumberOfTracks(UINT wDevID);
BOOL CDAUDIO_GetTracksInfo(UINT wDevID); BOOL CDAUDIO_GetTracksInfo(UINT wDevID);
...@@ -72,6 +76,7 @@ DWORD CDAUDIO_CalcTime(UINT wDevID, DWORD dwFormatType, DWORD dwFrame); ...@@ -72,6 +76,7 @@ DWORD CDAUDIO_CalcTime(UINT wDevID, DWORD dwFormatType, DWORD dwFrame);
*/ */
DWORD CDAUDIO_mciOpen(DWORD dwFlags, LPMCI_OPEN_PARMS lpParms) DWORD CDAUDIO_mciOpen(DWORD dwFlags, LPMCI_OPEN_PARMS lpParms)
{ {
#ifdef linux
UINT wDevID; UINT wDevID;
int cdrom; int cdrom;
#ifdef DEBUG_CDAUDIO #ifdef DEBUG_CDAUDIO
...@@ -121,6 +126,9 @@ DWORD CDAUDIO_mciOpen(DWORD dwFlags, LPMCI_OPEN_PARMS lpParms) ...@@ -121,6 +126,9 @@ DWORD CDAUDIO_mciOpen(DWORD dwFlags, LPMCI_OPEN_PARMS lpParms)
CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
return 0; return 0;
#else
return MCIERR_HARDWARE;
#endif
} }
/************************************************************************** /**************************************************************************
...@@ -128,12 +136,14 @@ DWORD CDAUDIO_mciOpen(DWORD dwFlags, LPMCI_OPEN_PARMS lpParms) ...@@ -128,12 +136,14 @@ DWORD CDAUDIO_mciOpen(DWORD dwFlags, LPMCI_OPEN_PARMS lpParms)
*/ */
DWORD CDAUDIO_mciClose(UINT wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpParms) DWORD CDAUDIO_mciClose(UINT wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpParms)
{ {
#ifdef linux
#ifdef DEBUG_CDAUDIO #ifdef DEBUG_CDAUDIO
printf("CDAUDIO_mciClose(%u, %08X, %08X);\n", wDevID, dwParam, lpParms); printf("CDAUDIO_mciClose(%u, %08X, %08X);\n", wDevID, dwParam, lpParms);
#endif #endif
if (CDADev[wDevID].lpdwTrackLen != NULL) free(CDADev[wDevID].lpdwTrackLen); if (CDADev[wDevID].lpdwTrackLen != NULL) free(CDADev[wDevID].lpdwTrackLen);
if (CDADev[wDevID].lpdwTrackPos != NULL) free(CDADev[wDevID].lpdwTrackPos); if (CDADev[wDevID].lpdwTrackPos != NULL) free(CDADev[wDevID].lpdwTrackPos);
close(CDADev[wDevID].unixdev); close(CDADev[wDevID].unixdev);
#endif
} }
/************************************************************************** /**************************************************************************
...@@ -142,6 +152,7 @@ DWORD CDAUDIO_mciClose(UINT wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpParms) ...@@ -142,6 +152,7 @@ DWORD CDAUDIO_mciClose(UINT wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpParms)
DWORD CDAUDIO_mciGetDevCaps(UINT wDevID, DWORD dwFlags, DWORD CDAUDIO_mciGetDevCaps(UINT wDevID, DWORD dwFlags,
LPMCI_GETDEVCAPS_PARMS lpParms) LPMCI_GETDEVCAPS_PARMS lpParms)
{ {
#ifdef linux
#ifdef DEBUG_CDAUDIO #ifdef DEBUG_CDAUDIO
printf("CDAUDIO_mciGetDevCaps(%u, %08X, %08X);\n", wDevID, dwFlags, lpParms); printf("CDAUDIO_mciGetDevCaps(%u, %08X, %08X);\n", wDevID, dwFlags, lpParms);
#endif #endif
...@@ -183,6 +194,9 @@ DWORD CDAUDIO_mciGetDevCaps(UINT wDevID, DWORD dwFlags, ...@@ -183,6 +194,9 @@ DWORD CDAUDIO_mciGetDevCaps(UINT wDevID, DWORD dwFlags,
} }
printf("CDAUDIO_mciGetDevCaps // lpParms->dwReturn=%08X);\n", lpParms->dwReturn); printf("CDAUDIO_mciGetDevCaps // lpParms->dwReturn=%08X);\n", lpParms->dwReturn);
return 0; return 0;
#else
return MCIERR_INTERNAL;
#endif
} }
/************************************************************************** /**************************************************************************
...@@ -190,6 +204,7 @@ DWORD CDAUDIO_mciGetDevCaps(UINT wDevID, DWORD dwFlags, ...@@ -190,6 +204,7 @@ DWORD CDAUDIO_mciGetDevCaps(UINT wDevID, DWORD dwFlags,
*/ */
DWORD CDAUDIO_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMS lpParms) DWORD CDAUDIO_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMS lpParms)
{ {
#ifdef linux
#ifdef DEBUG_CDAUDIO #ifdef DEBUG_CDAUDIO
printf("CDAUDIO_mciInfo(%u, %08X, %08X);\n", wDevID, dwFlags, lpParms); printf("CDAUDIO_mciInfo(%u, %08X, %08X);\n", wDevID, dwFlags, lpParms);
#endif #endif
...@@ -207,6 +222,9 @@ DWORD CDAUDIO_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMS lpParms) ...@@ -207,6 +222,9 @@ DWORD CDAUDIO_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMS lpParms)
else else
lpParms->dwRetSize = 0; lpParms->dwRetSize = 0;
return 0; return 0;
#else
return MCIERR_INTERNAL;
#endif
} }
/************************************************************************** /**************************************************************************
...@@ -214,6 +232,7 @@ DWORD CDAUDIO_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMS lpParms) ...@@ -214,6 +232,7 @@ DWORD CDAUDIO_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_INFO_PARMS lpParms)
*/ */
DWORD CDAUDIO_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms) DWORD CDAUDIO_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms)
{ {
#ifdef linux
#ifdef DEBUG_CDAUDIO #ifdef DEBUG_CDAUDIO
printf("CDAUDIO_mciStatus(%u, %08X, %08X);\n", wDevID, dwFlags, lpParms); printf("CDAUDIO_mciStatus(%u, %08X, %08X);\n", wDevID, dwFlags, lpParms);
#endif #endif
...@@ -315,6 +334,9 @@ DWORD CDAUDIO_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms) ...@@ -315,6 +334,9 @@ DWORD CDAUDIO_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms)
} }
printf("CDAUDIO_mciStatus // not MCI_STATUS_ITEM !\n"); printf("CDAUDIO_mciStatus // not MCI_STATUS_ITEM !\n");
return 0; return 0;
#else
return MMSYSERR_NOTENABLED;
#endif
} }
...@@ -324,6 +346,7 @@ DWORD CDAUDIO_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms) ...@@ -324,6 +346,7 @@ DWORD CDAUDIO_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms)
DWORD CDAUDIO_CalcTime(UINT wDevID, DWORD dwFormatType, DWORD dwFrame) DWORD CDAUDIO_CalcTime(UINT wDevID, DWORD dwFormatType, DWORD dwFrame)
{ {
DWORD dwTime = 0; DWORD dwTime = 0;
#ifdef linux
UINT wTrack; UINT wTrack;
UINT wMinutes; UINT wMinutes;
UINT wSeconds; UINT wSeconds;
...@@ -372,6 +395,7 @@ TryAGAIN: ...@@ -372,6 +395,7 @@ TryAGAIN:
dwFormatType = MCI_FORMAT_TMSF; dwFormatType = MCI_FORMAT_TMSF;
goto TryAGAIN; goto TryAGAIN;
} }
#endif
return dwTime; return dwTime;
} }
...@@ -382,6 +406,7 @@ TryAGAIN: ...@@ -382,6 +406,7 @@ TryAGAIN:
DWORD CDAUDIO_CalcFrame(UINT wDevID, DWORD dwFormatType, DWORD dwTime) DWORD CDAUDIO_CalcFrame(UINT wDevID, DWORD dwFormatType, DWORD dwTime)
{ {
DWORD dwFrame = 0; DWORD dwFrame = 0;
#ifdef linux
UINT wTrack; UINT wTrack;
#ifdef DEBUG_CDAUDIO #ifdef DEBUG_CDAUDIO
printf("CDAUDIO_CalcFrame(%u, %08X, %lu);\n", wDevID, dwFormatType, dwTime); printf("CDAUDIO_CalcFrame(%u, %08X, %lu);\n", wDevID, dwFormatType, dwTime);
...@@ -423,6 +448,7 @@ TryAGAIN: ...@@ -423,6 +448,7 @@ TryAGAIN:
dwFormatType = MCI_FORMAT_TMSF; dwFormatType = MCI_FORMAT_TMSF;
goto TryAGAIN; goto TryAGAIN;
} }
#endif
return dwFrame; return dwFrame;
} }
...@@ -432,6 +458,7 @@ TryAGAIN: ...@@ -432,6 +458,7 @@ TryAGAIN:
*/ */
UINT CDAUDIO_GetNumberOfTracks(UINT wDevID) UINT CDAUDIO_GetNumberOfTracks(UINT wDevID)
{ {
#ifdef linux
struct cdrom_tochdr hdr; struct cdrom_tochdr hdr;
if (CDADev[wDevID].nTracks == 0) { if (CDADev[wDevID].nTracks == 0) {
if (ioctl(CDADev[wDevID].unixdev, CDROMREADTOCHDR, &hdr)) { if (ioctl(CDADev[wDevID].unixdev, CDROMREADTOCHDR, &hdr)) {
...@@ -441,6 +468,9 @@ UINT CDAUDIO_GetNumberOfTracks(UINT wDevID) ...@@ -441,6 +468,9 @@ UINT CDAUDIO_GetNumberOfTracks(UINT wDevID)
CDADev[wDevID].nTracks = hdr.cdth_trk1; CDADev[wDevID].nTracks = hdr.cdth_trk1;
} }
return CDADev[wDevID].nTracks; return CDADev[wDevID].nTracks;
#else
return (WORD)-1;
#endif
} }
/************************************************************************** /**************************************************************************
...@@ -448,6 +478,7 @@ UINT CDAUDIO_GetNumberOfTracks(UINT wDevID) ...@@ -448,6 +478,7 @@ UINT CDAUDIO_GetNumberOfTracks(UINT wDevID)
*/ */
BOOL CDAUDIO_GetTracksInfo(UINT wDevID) BOOL CDAUDIO_GetTracksInfo(UINT wDevID)
{ {
#ifdef linux
int i, length; int i, length;
int start, last_start; int start, last_start;
int total_length = 0; int total_length = 0;
...@@ -503,6 +534,9 @@ BOOL CDAUDIO_GetTracksInfo(UINT wDevID) ...@@ -503,6 +534,9 @@ BOOL CDAUDIO_GetTracksInfo(UINT wDevID)
CDADev[wDevID].dwTotalLen = total_length; CDADev[wDevID].dwTotalLen = total_length;
printf("CDAUDIO_GetTracksInfo // total_len=%u\n", total_length); printf("CDAUDIO_GetTracksInfo // total_len=%u\n", total_length);
return TRUE; return TRUE;
#else
return FALSE;
#endif
} }
...@@ -511,6 +545,7 @@ BOOL CDAUDIO_GetTracksInfo(UINT wDevID) ...@@ -511,6 +545,7 @@ BOOL CDAUDIO_GetTracksInfo(UINT wDevID)
*/ */
BOOL CDAUDIO_GetCDStatus(UINT wDevID) BOOL CDAUDIO_GetCDStatus(UINT wDevID)
{ {
#ifdef linux
int oldmode = CDADev[wDevID].mode; int oldmode = CDADev[wDevID].mode;
CDADev[wDevID].sc.cdsc_format = CDROM_MSF; CDADev[wDevID].sc.cdsc_format = CDROM_MSF;
if (ioctl(CDADev[wDevID].unixdev, CDROMSUBCHNL, &CDADev[wDevID].sc)) { if (ioctl(CDADev[wDevID].unixdev, CDROMSUBCHNL, &CDADev[wDevID].sc)) {
...@@ -565,6 +600,9 @@ BOOL CDAUDIO_GetCDStatus(UINT wDevID) ...@@ -565,6 +600,9 @@ BOOL CDAUDIO_GetCDStatus(UINT wDevID)
} }
} }
return TRUE; return TRUE;
#else
return FALSE;
#endif
} }
/************************************************************************** /**************************************************************************
...@@ -572,6 +610,7 @@ BOOL CDAUDIO_GetCDStatus(UINT wDevID) ...@@ -572,6 +610,7 @@ BOOL CDAUDIO_GetCDStatus(UINT wDevID)
*/ */
DWORD CDAUDIO_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms) DWORD CDAUDIO_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
{ {
#ifdef linux
int start, end; int start, end;
struct cdrom_msf msf; struct cdrom_msf msf;
#ifdef DEBUG_CDAUDIO #ifdef DEBUG_CDAUDIO
...@@ -625,6 +664,9 @@ DWORD CDAUDIO_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms) ...@@ -625,6 +664,9 @@ DWORD CDAUDIO_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
return 0; return 0;
#else
return MCIERR_HARDWARE;
#endif
} }
/************************************************************************** /**************************************************************************
...@@ -632,6 +674,7 @@ DWORD CDAUDIO_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms) ...@@ -632,6 +674,7 @@ DWORD CDAUDIO_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
*/ */
DWORD CDAUDIO_mciStop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms) DWORD CDAUDIO_mciStop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
{ {
#ifdef linux
#ifdef DEBUG_CDAUDIO #ifdef DEBUG_CDAUDIO
printf("CDAUDIO_mciStop(%u, %08X, %08X);\n", wDevID, dwFlags, lpParms); printf("CDAUDIO_mciStop(%u, %08X, %08X);\n", wDevID, dwFlags, lpParms);
#endif #endif
...@@ -644,6 +687,9 @@ DWORD CDAUDIO_mciStop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms) ...@@ -644,6 +687,9 @@ DWORD CDAUDIO_mciStop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
return 0; return 0;
#else
return MCIERR_HARDWARE;
#endif
} }
/************************************************************************** /**************************************************************************
...@@ -651,6 +697,7 @@ DWORD CDAUDIO_mciStop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms) ...@@ -651,6 +697,7 @@ DWORD CDAUDIO_mciStop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
*/ */
DWORD CDAUDIO_mciPause(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms) DWORD CDAUDIO_mciPause(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
{ {
#ifdef linux
#ifdef DEBUG_CDAUDIO #ifdef DEBUG_CDAUDIO
printf("CDAUDIO_mciPause(%u, %08X, %08X);\n", wDevID, dwFlags, lpParms); printf("CDAUDIO_mciPause(%u, %08X, %08X);\n", wDevID, dwFlags, lpParms);
#endif #endif
...@@ -663,6 +710,9 @@ DWORD CDAUDIO_mciPause(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms) ...@@ -663,6 +710,9 @@ DWORD CDAUDIO_mciPause(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
return 0; return 0;
#else
return MCIERR_HARDWARE;
#endif
} }
/************************************************************************** /**************************************************************************
...@@ -670,6 +720,7 @@ DWORD CDAUDIO_mciPause(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms) ...@@ -670,6 +720,7 @@ DWORD CDAUDIO_mciPause(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
*/ */
DWORD CDAUDIO_mciResume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms) DWORD CDAUDIO_mciResume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
{ {
#ifdef linux
#ifdef DEBUG_CDAUDIO #ifdef DEBUG_CDAUDIO
printf("CDAUDIO_mciResume(%u, %08X, %08X);\n", wDevID, dwFlags, lpParms); printf("CDAUDIO_mciResume(%u, %08X, %08X);\n", wDevID, dwFlags, lpParms);
#endif #endif
...@@ -682,6 +733,9 @@ DWORD CDAUDIO_mciResume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms) ...@@ -682,6 +733,9 @@ DWORD CDAUDIO_mciResume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
return 0; return 0;
#else
return MCIERR_HARDWARE;
#endif
} }
/************************************************************************** /**************************************************************************
...@@ -689,6 +743,7 @@ DWORD CDAUDIO_mciResume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms) ...@@ -689,6 +743,7 @@ DWORD CDAUDIO_mciResume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
*/ */
DWORD CDAUDIO_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms) DWORD CDAUDIO_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
{ {
#ifdef linux
DWORD dwRet; DWORD dwRet;
MCI_PLAY_PARMS PlayParms; MCI_PLAY_PARMS PlayParms;
#ifdef DEBUG_CDAUDIO #ifdef DEBUG_CDAUDIO
...@@ -717,6 +772,9 @@ DWORD CDAUDIO_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms) ...@@ -717,6 +772,9 @@ DWORD CDAUDIO_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
return dwRet; return dwRet;
#else
return MCIERR_HARDWARE;
#endif
} }
...@@ -725,6 +783,7 @@ DWORD CDAUDIO_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms) ...@@ -725,6 +783,7 @@ DWORD CDAUDIO_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
*/ */
DWORD CDAUDIO_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms) DWORD CDAUDIO_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
{ {
#ifdef linux
#ifdef DEBUG_CDAUDIO #ifdef DEBUG_CDAUDIO
printf("CDAUDIO_mciSet(%u, %08X, %08X);\n", wDevID, dwFlags, lpParms); printf("CDAUDIO_mciSet(%u, %08X, %08X);\n", wDevID, dwFlags, lpParms);
#endif #endif
...@@ -775,6 +834,9 @@ DWORD CDAUDIO_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms) ...@@ -775,6 +834,9 @@ DWORD CDAUDIO_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL); CDADev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
} }
return 0; return 0;
#else
return MCIERR_HARDWARE;
#endif
} }
...@@ -784,6 +846,7 @@ DWORD CDAUDIO_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms) ...@@ -784,6 +846,7 @@ DWORD CDAUDIO_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
LRESULT CDAUDIO_DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg, LRESULT CDAUDIO_DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
DWORD dwParam1, DWORD dwParam2) DWORD dwParam1, DWORD dwParam2)
{ {
#ifdef linux
switch(wMsg) { switch(wMsg) {
case DRV_LOAD: case DRV_LOAD:
return (LRESULT)1L; return (LRESULT)1L;
...@@ -852,6 +915,9 @@ LRESULT CDAUDIO_DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg, ...@@ -852,6 +915,9 @@ LRESULT CDAUDIO_DriverProc(DWORD dwDevID, HDRVR hDriv, WORD wMsg,
default: default:
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2); return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
} }
#else
return MCIERR_HARDWARE;
#endif
} }
......
...@@ -14,7 +14,9 @@ static char Copyright[] = "Copyright Martin Ayotte, 1994"; ...@@ -14,7 +14,9 @@ static char Copyright[] = "Copyright Martin Ayotte, 1994";
#include <fcntl.h> #include <fcntl.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#ifdef linux
#include <linux/soundcard.h> #include <linux/soundcard.h>
#endif
#define SOUND_DEV "/dev/dsp" #define SOUND_DEV "/dev/dsp"
#define MIXER_DEV "/dev/mixer" #define MIXER_DEV "/dev/mixer"
...@@ -34,6 +36,7 @@ static char Copyright[] = "Copyright Martin Ayotte, 1994"; ...@@ -34,6 +36,7 @@ static char Copyright[] = "Copyright Martin Ayotte, 1994";
*/ */
DWORD AUX_GetDevCaps(WORD wDevID, LPAUXCAPS lpCaps, DWORD dwSize) DWORD AUX_GetDevCaps(WORD wDevID, LPAUXCAPS lpCaps, DWORD dwSize)
{ {
#ifdef linux
int mixer; int mixer;
int volume; int volume;
printf("AUX_GetDevCaps(%u, %08X, %u);\n", wDevID, lpCaps, dwSize); printf("AUX_GetDevCaps(%u, %08X, %u);\n", wDevID, lpCaps, dwSize);
...@@ -48,6 +51,9 @@ DWORD AUX_GetDevCaps(WORD wDevID, LPAUXCAPS lpCaps, DWORD dwSize) ...@@ -48,6 +51,9 @@ DWORD AUX_GetDevCaps(WORD wDevID, LPAUXCAPS lpCaps, DWORD dwSize)
} }
close(mixer); close(mixer);
return MMSYSERR_NOERROR; return MMSYSERR_NOERROR;
#else
return MMSYSERR_NOTENABLED;
#endif
} }
...@@ -56,6 +62,7 @@ DWORD AUX_GetDevCaps(WORD wDevID, LPAUXCAPS lpCaps, DWORD dwSize) ...@@ -56,6 +62,7 @@ DWORD AUX_GetDevCaps(WORD wDevID, LPAUXCAPS lpCaps, DWORD dwSize)
*/ */
DWORD AUX_GetVolume(WORD wDevID, DWORD dwParam) DWORD AUX_GetVolume(WORD wDevID, DWORD dwParam)
{ {
#ifdef linux
int mixer; int mixer;
int volume; int volume;
printf("AUX_GetVolume(%u, %08X);\n", wDevID, dwParam); printf("AUX_GetVolume(%u, %08X);\n", wDevID, dwParam);
...@@ -69,6 +76,9 @@ DWORD AUX_GetVolume(WORD wDevID, DWORD dwParam) ...@@ -69,6 +76,9 @@ DWORD AUX_GetVolume(WORD wDevID, DWORD dwParam)
} }
close(mixer); close(mixer);
return MMSYSERR_NOERROR; return MMSYSERR_NOERROR;
#else
return MMSYSERR_NOTENABLED;
#endif
} }
/************************************************************************** /**************************************************************************
...@@ -76,6 +86,7 @@ DWORD AUX_GetVolume(WORD wDevID, DWORD dwParam) ...@@ -76,6 +86,7 @@ DWORD AUX_GetVolume(WORD wDevID, DWORD dwParam)
*/ */
DWORD AUX_SetVolume(WORD wDevID, DWORD dwParam) DWORD AUX_SetVolume(WORD wDevID, DWORD dwParam)
{ {
#ifdef linux
int mixer; int mixer;
int volume = 50; int volume = 50;
printf("AUX_SetVolume(%u, %08X);\n", wDevID, dwParam); printf("AUX_SetVolume(%u, %08X);\n", wDevID, dwParam);
...@@ -89,6 +100,9 @@ DWORD AUX_SetVolume(WORD wDevID, DWORD dwParam) ...@@ -89,6 +100,9 @@ DWORD AUX_SetVolume(WORD wDevID, DWORD dwParam)
} }
close(mixer); close(mixer);
return MMSYSERR_NOERROR; return MMSYSERR_NOERROR;
#else
return MMSYSERR_NOTENABLED;
#endif
} }
......
...@@ -233,7 +233,7 @@ WORD COLOR_ToPhysical( DC *dc, COLORREF color ) ...@@ -233,7 +233,7 @@ WORD COLOR_ToPhysical( DC *dc, COLORREF color )
WORD *mapping; WORD *mapping;
if (!dc->u.x.pal.hMapping) return 0; if (!dc->u.x.pal.hMapping) return 0;
switch(color & 0xff000000) switch(color >> 24)
{ {
case 0: /* RGB */ case 0: /* RGB */
index = GetNearestPaletteIndex( STOCK_DEFAULT_PALETTE, color ); index = GetNearestPaletteIndex( STOCK_DEFAULT_PALETTE, color );
......
...@@ -16,6 +16,34 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993"; ...@@ -16,6 +16,34 @@ static char Copyright[] = "Copyright Alexandre Julliard, 1993";
#define MAX_FONTS 256 #define MAX_FONTS 256
static LPLOGFONT lpLogFontList[MAX_FONTS] = { NULL }; static LPLOGFONT lpLogFontList[MAX_FONTS] = { NULL };
#define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \
(((cs)->rbearing|(cs)->lbearing| \
(cs)->ascent|(cs)->descent) == 0))
/*
* CI_GET_CHAR_INFO - return the charinfo struct for the indicated 8bit
* character. If the character is in the column and exists, then return the
* appropriate metrics (note that fonts with common per-character metrics will
* return min_bounds). If none of these hold true, try again with the default
* char.
*/
#define CI_GET_CHAR_INFO(fs,col,def,cs) \
{ \
cs = def; \
if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
if (fs->per_char == NULL) { \
cs = &fs->min_bounds; \
} else { \
cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \
if (CI_NONEXISTCHAR(cs)) cs = def; \
} \
} \
}
#define CI_GET_DEFAULT_INFO(fs,cs) \
CI_GET_CHAR_INFO(fs, fs->default_char, NULL, cs)
/*********************************************************************** /***********************************************************************
* FONT_MatchFont * FONT_MatchFont
* *
...@@ -86,7 +114,7 @@ static XFontStruct * FONT_MatchFont( LOGFONT * font ) ...@@ -86,7 +114,7 @@ static XFontStruct * FONT_MatchFont( LOGFONT * font )
void FONT_GetMetrics( LOGFONT * logfont, XFontStruct * xfont, void FONT_GetMetrics( LOGFONT * logfont, XFontStruct * xfont,
TEXTMETRIC * metrics ) TEXTMETRIC * metrics )
{ {
int average, i; int average, i, count;
unsigned long prop; unsigned long prop;
metrics->tmAscent = xfont->ascent; metrics->tmAscent = xfont->ascent;
...@@ -116,13 +144,17 @@ void FONT_GetMetrics( LOGFONT * logfont, XFontStruct * xfont, ...@@ -116,13 +144,17 @@ void FONT_GetMetrics( LOGFONT * logfont, XFontStruct * xfont,
else else
{ {
XCharStruct * charPtr = xfont->per_char; XCharStruct * charPtr = xfont->per_char;
average = 0; average = count = 0;
for (i = metrics->tmFirstChar; i <= metrics->tmLastChar; i++) for (i = metrics->tmFirstChar; i <= metrics->tmLastChar; i++)
{ {
average += charPtr->width; if (!CI_NONEXISTCHAR( charPtr ))
{
average += charPtr->width;
count++;
}
charPtr++; charPtr++;
} }
average /= metrics->tmLastChar - metrics->tmFirstChar + 1; if (count) average = (average + count/2) / count;
} }
metrics->tmAveCharWidth = average; metrics->tmAveCharWidth = average;
} }
...@@ -373,33 +405,6 @@ DWORD SetMapperFlags(HDC hDC, DWORD dwFlag) ...@@ -373,33 +405,6 @@ DWORD SetMapperFlags(HDC hDC, DWORD dwFlag)
/***********************************************************************/ /***********************************************************************/
#define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \
(((cs)->rbearing|(cs)->lbearing| \
(cs)->ascent|(cs)->descent) == 0))
/*
* CI_GET_CHAR_INFO - return the charinfo struct for the indicated 8bit
* character. If the character is in the column and exists, then return the
* appropriate metrics (note that fonts with common per-character metrics will
* return min_bounds). If none of these hold true, try again with the default
* char.
*/
#define CI_GET_CHAR_INFO(fs,col,def,cs) \
{ \
cs = def; \
if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
if (fs->per_char == NULL) { \
cs = &fs->min_bounds; \
} else { \
cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \
if (CI_NONEXISTCHAR(cs)) cs = def; \
} \
} \
}
#define CI_GET_DEFAULT_INFO(fs,cs) \
CI_GET_CHAR_INFO(fs, fs->default_char, NULL, cs)
/*********************************************************************** /***********************************************************************
* GetCharWidth (GDI.350) * GetCharWidth (GDI.350)
......
...@@ -235,8 +235,12 @@ int DrawText( HDC hdc, LPSTR str, int count, LPRECT rect, WORD flags ) ...@@ -235,8 +235,12 @@ int DrawText( HDC hdc, LPSTR str, int count, LPRECT rect, WORD flags )
if (!TextOut(hdc, x, y, line, len)) return 0; if (!TextOut(hdc, x, y, line, len)) return 0;
if (prefix_offset != -1) if (prefix_offset != -1)
{ {
HPEN hpen = CreatePen( PS_SOLID, 1, GetTextColor(hdc) );
HPEN oldPen = SelectObject( hdc, hpen );
MoveTo(hdc, x + prefix_x, y + tm.tmAscent + 1 ); MoveTo(hdc, x + prefix_x, y + tm.tmAscent + 1 );
LineTo(hdc, x + prefix_end, y + tm.tmAscent + 1 ); LineTo(hdc, x + prefix_end, y + tm.tmAscent + 1 );
SelectObject( hdc, oldPen );
DeleteObject( hpen );
} }
if (strPtr) if (strPtr)
......
...@@ -20,9 +20,10 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993"; ...@@ -20,9 +20,10 @@ static char Copyright[] = "Copyright Robert J. Amstadt, 1993";
#define VARTYPE_LONG 2 #define VARTYPE_LONG 2
#define VARTYPE_FARPTR 3 #define VARTYPE_FARPTR 3
#define FUNCTYPE_PASCAL 16 #define FUNCTYPE_PASCAL_16 15
#define FUNCTYPE_C 17 #define FUNCTYPE_PASCAL 16
#define FUNCTYPE_REG 19 #define FUNCTYPE_C 17
#define FUNCTYPE_REG 19
#define EQUATETYPE_ABS 18 #define EQUATETYPE_ABS 18
#define TYPE_RETURN 20 #define TYPE_RETURN 20
...@@ -372,7 +373,8 @@ ParseExportFunction(int ordinal, int type) ...@@ -372,7 +373,8 @@ ParseExportFunction(int ordinal, int type)
} }
fdp->n_args_16 = i; fdp->n_args_16 = i;
if (type == FUNCTYPE_PASCAL || type == FUNCTYPE_REG) if (type == FUNCTYPE_PASCAL_16 || type == FUNCTYPE_PASCAL ||
type == FUNCTYPE_REG )
{ {
current_offset = 0; current_offset = 0;
for (i--; i >= 0; i--) for (i--; i >= 0; i--)
...@@ -521,6 +523,8 @@ ParseOrdinal(int ordinal) ...@@ -521,6 +523,8 @@ ParseOrdinal(int ordinal)
return ParseExportFunction(ordinal, FUNCTYPE_PASCAL); return ParseExportFunction(ordinal, FUNCTYPE_PASCAL);
else if (stricmp(token, "pascal") == 0) else if (stricmp(token, "pascal") == 0)
return ParseExportFunction(ordinal, FUNCTYPE_PASCAL); return ParseExportFunction(ordinal, FUNCTYPE_PASCAL);
else if (stricmp(token, "pascal16") == 0)
return ParseExportFunction(ordinal, FUNCTYPE_PASCAL_16);
else if (stricmp(token, "register") == 0) else if (stricmp(token, "register") == 0)
return ParseExportFunction(ordinal, FUNCTYPE_REG); return ParseExportFunction(ordinal, FUNCTYPE_REG);
else if (stricmp(token, "equate") == 0) else if (stricmp(token, "equate") == 0)
...@@ -755,6 +759,13 @@ main(int argc, char **argv) ...@@ -755,6 +759,13 @@ main(int argc, char **argv)
fprintf(fp, "\torl\t$0x%08x,%%eax\n", DLLId << 16); fprintf(fp, "\torl\t$0x%08x,%%eax\n", DLLId << 16);
fprintf(fp, "\tjmp\t_CallTo32\n\n"); fprintf(fp, "\tjmp\t_CallTo32\n\n");
fprintf(fp, "\t.globl _%s_Dispatch_16\n", UpperDLLName);
fprintf(fp, "_%s_Dispatch_16:\n", UpperDLLName);
fprintf(fp, "\tandl\t$0x0000ffff,%%esp\n");
fprintf(fp, "\tandl\t$0x0000ffff,%%ebp\n");
fprintf(fp, "\torl\t$0x%08x,%%eax\n", DLLId << 16);
fprintf(fp, "\tjmp\t_CallTo32_16\n\n");
odp = OrdinalDefinitions; odp = OrdinalDefinitions;
for (i = 0; i <= Limit; i++, odp++) for (i = 0; i <= Limit; i++, odp++)
{ {
...@@ -829,6 +840,13 @@ main(int argc, char **argv) ...@@ -829,6 +840,13 @@ main(int argc, char **argv)
fprintf(fp, "\tjmp\t_%s_Dispatch\n\n", UpperDLLName); fprintf(fp, "\tjmp\t_%s_Dispatch\n\n", UpperDLLName);
break; break;
case FUNCTYPE_PASCAL_16:
fprintf(fp, "_%s_Ordinal_%d:\n", UpperDLLName, i);
fprintf(fp, "\tmovl\t$%d,%%eax\n", i);
fprintf(fp, "\tpushw\t$%d\n", fdp->arg_16_size);
fprintf(fp, "\tjmp\t_%s_Dispatch_16\n\n", UpperDLLName);
break;
case FUNCTYPE_C: case FUNCTYPE_C:
default: default:
fprintf(fp, "_%s_Ordinal_%d:\n", UpperDLLName, i); fprintf(fp, "_%s_Ordinal_%d:\n", UpperDLLName, i);
...@@ -862,8 +880,8 @@ main(int argc, char **argv) ...@@ -862,8 +880,8 @@ main(int argc, char **argv)
for (i = 0; i <= Limit; i++, odp++) for (i = 0; i <= Limit; i++, odp++)
{ {
if (odp->valid && if (odp->valid &&
(odp->type == FUNCTYPE_PASCAL || odp->type == FUNCTYPE_C || (odp->type == FUNCTYPE_PASCAL || odp->type == FUNCTYPE_PASCAL_16 ||
odp->type == FUNCTYPE_REG)) odp->type == FUNCTYPE_REG || odp->type == FUNCTYPE_C ))
{ {
fdp = odp->additional_data; fdp = odp->additional_data;
fprintf(fp, "extern int %s();\n", fdp->internal_name); fprintf(fp, "extern int %s();\n", fdp->internal_name);
...@@ -884,6 +902,7 @@ main(int argc, char **argv) ...@@ -884,6 +902,7 @@ main(int argc, char **argv)
switch (odp->type) switch (odp->type)
{ {
case FUNCTYPE_PASCAL: case FUNCTYPE_PASCAL:
case FUNCTYPE_PASCAL_16:
case FUNCTYPE_REG: case FUNCTYPE_REG:
fprintf(fp, " { 0x%x, %s_Ordinal_%d, ", UTEXTSEL, UpperDLLName, i); fprintf(fp, " { 0x%x, %s_Ordinal_%d, ", UTEXTSEL, UpperDLLName, i);
fprintf(fp, "\042%s\042, ", odp->export_name); fprintf(fp, "\042%s\042, ", odp->export_name);
......
...@@ -27,7 +27,8 @@ static HBITMAP hbitmapRestoreD = 0; ...@@ -27,7 +27,8 @@ static HBITMAP hbitmapRestoreD = 0;
extern void WINPOS_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos, extern void WINPOS_GetMinMaxInfo( HWND hwnd, POINT *maxSize, POINT *maxPos,
POINT *minTrack, POINT *maxTrack ); /* winpos.c */ POINT *minTrack, POINT *maxTrack ); /* winpos.c */
extern void CURSOR_SetWinCursor( HWND hwnd, HCURSOR hcursor ); /* cursor.c */ extern void CURSOR_SetWinCursor( HWND hwnd, HCURSOR hcursor ); /* cursor.c */
extern WORD MENU_GetMenuBarHeight( HWND hwnd, WORD menubarWidth ); /* menu.c */ extern WORD MENU_GetMenuBarHeight( HWND hwnd, WORD menubarWidth,
int orgX, int orgY ); /* menu.c */
/* Some useful macros */ /* Some useful macros */
...@@ -127,7 +128,8 @@ LONG NC_HandleNCCalcSize( HWND hwnd, NCCALCSIZE_PARAMS *params ) ...@@ -127,7 +128,8 @@ LONG NC_HandleNCCalcSize( HWND hwnd, NCCALCSIZE_PARAMS *params )
if (HAS_MENU(wndPtr)) if (HAS_MENU(wndPtr))
{ {
params->rgrc[0].top += MENU_GetMenuBarHeight( hwnd, params->rgrc[0].top += MENU_GetMenuBarHeight( hwnd,
params->rgrc[0].right - params->rgrc[0].left ); params->rgrc[0].right - params->rgrc[0].left,
-tmpRect.left, -tmpRect.top ) + 1;
} }
return 0; return 0;
} }
...@@ -178,43 +180,61 @@ static LONG NC_InternalNCHitTest( HWND hwnd, POINT pt ) ...@@ -178,43 +180,61 @@ static LONG NC_InternalNCHitTest( HWND hwnd, POINT pt )
GetWindowRect( hwnd, &rect ); GetWindowRect( hwnd, &rect );
if (!PtInRect( &rect, pt )) return HTNOWHERE; if (!PtInRect( &rect, pt )) return HTNOWHERE;
ScreenToClient( hwnd, &pt );
GetClientRect( hwnd, &rect );
if (PtInRect( &rect, pt )) return HTCLIENT;
/* Check vertical scroll bar */ /* Check borders */
if (wndPtr->dwStyle & WS_VSCROLL)
{
rect.right += SYSMETRICS_CXVSCROLL;
if (PtInRect( &rect, pt )) return HTVSCROLL;
}
/* Check horizontal scroll bar */ if (HAS_THICKFRAME( wndPtr->dwStyle ))
if (wndPtr->dwStyle & WS_HSCROLL)
{ {
rect.bottom += SYSMETRICS_CYHSCROLL; InflateRect( &rect, -SYSMETRICS_CXFRAME, -SYSMETRICS_CYFRAME );
if (PtInRect( &rect, pt )) if (wndPtr->dwStyle & WS_BORDER)
InflateRect( &rect, -SYSMETRICS_CXBORDER, -SYSMETRICS_CYBORDER );
if (!PtInRect( &rect, pt ))
{ {
/* Check size box */ /* Check top sizing border */
if ((wndPtr->dwStyle & WS_VSCROLL) && if (pt.y < rect.top)
(pt.x >= rect.right - SYSMETRICS_CXVSCROLL)) return HTSIZE; {
return HTHSCROLL; if (pt.x < rect.left+SYSMETRICS_CXSIZE) return HTTOPLEFT;
if (pt.x >= rect.right-SYSMETRICS_CXSIZE) return HTTOPRIGHT;
return HTTOP;
}
/* Check bottom sizing border */
if (pt.y >= rect.bottom)
{
if (pt.x < rect.left+SYSMETRICS_CXSIZE) return HTBOTTOMLEFT;
if (pt.x >= rect.right-SYSMETRICS_CXSIZE) return HTBOTTOMRIGHT;
return HTBOTTOM;
}
/* Check left sizing border */
if (pt.x < rect.left)
{
if (pt.y < rect.top+SYSMETRICS_CYSIZE) return HTTOPLEFT;
if (pt.y >= rect.bottom-SYSMETRICS_CYSIZE) return HTBOTTOMLEFT;
return HTLEFT;
}
/* Check right sizing border */
if (pt.x >= rect.right)
{
if (pt.y < rect.top+SYSMETRICS_CYSIZE) return HTTOPRIGHT;
if (pt.y >= rect.bottom-SYSMETRICS_CYSIZE) return HTBOTTOMRIGHT;
return HTRIGHT;
}
} }
} }
else /* No thick frame */
/* Check menu */
if (HAS_MENU(wndPtr))
{ {
rect.top -= SYSMETRICS_CYMENU + 1; if (HAS_DLGFRAME( wndPtr->dwStyle, wndPtr->dwExStyle ))
if (PtInRect( &rect, pt )) return HTMENU; InflateRect(&rect, -SYSMETRICS_CXDLGFRAME, -SYSMETRICS_CYDLGFRAME);
else if (wndPtr->dwStyle & WS_BORDER)
InflateRect(&rect, -SYSMETRICS_CXBORDER, -SYSMETRICS_CYBORDER);
if (!PtInRect( &rect, pt )) return HTBORDER;
} }
/* Check caption */ /* Check caption */
if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION) if ((wndPtr->dwStyle & WS_CAPTION) == WS_CAPTION)
{ {
rect.top -= SYSMETRICS_CYCAPTION - 1; rect.top += SYSMETRICS_CYCAPTION - 1;
if (PtInRect( &rect, pt )) if (!PtInRect( &rect, pt ))
{ {
/* Check system menu */ /* Check system menu */
if ((wndPtr->dwStyle & WS_SYSMENU) && (pt.x <= SYSMETRICS_CXSIZE)) if ((wndPtr->dwStyle & WS_SYSMENU) && (pt.x <= SYSMETRICS_CXSIZE))
...@@ -230,40 +250,42 @@ static LONG NC_InternalNCHitTest( HWND hwnd, POINT pt ) ...@@ -230,40 +250,42 @@ static LONG NC_InternalNCHitTest( HWND hwnd, POINT pt )
return HTCAPTION; return HTCAPTION;
} }
} }
/* Check non-sizing border */
if (!HAS_THICKFRAME( wndPtr->dwStyle )) return HTBORDER;
/* Check top sizing border */ /* Check client area */
if (pt.y < rect.top)
{ ScreenToClient( hwnd, &pt );
if (pt.x < rect.left+SYSMETRICS_CXSIZE) return HTTOPLEFT; GetClientRect( hwnd, &rect );
if (pt.x >= rect.right-SYSMETRICS_CXSIZE) return HTTOPRIGHT; if (PtInRect( &rect, pt )) return HTCLIENT;
return HTTOP;
} /* Check vertical scroll bar */
/* Check bottom sizing border */ if (wndPtr->dwStyle & WS_VSCROLL)
if (pt.y >= rect.bottom)
{ {
if (pt.x < rect.left+SYSMETRICS_CXSIZE) return HTBOTTOMLEFT; rect.right += SYSMETRICS_CXVSCROLL;
if (pt.x >= rect.right-SYSMETRICS_CXSIZE) return HTBOTTOMRIGHT; if (PtInRect( &rect, pt )) return HTVSCROLL;
return HTBOTTOM;
} }
/* Check left sizing border */ /* Check horizontal scroll bar */
if (pt.x < rect.left)
if (wndPtr->dwStyle & WS_HSCROLL)
{ {
if (pt.y < rect.top+SYSMETRICS_CYSIZE) return HTTOPLEFT; rect.bottom += SYSMETRICS_CYHSCROLL;
if (pt.y >= rect.bottom-SYSMETRICS_CYSIZE) return HTBOTTOMLEFT; if (PtInRect( &rect, pt ))
return HTLEFT; {
/* Check size box */
if ((wndPtr->dwStyle & WS_VSCROLL) &&
(pt.x >= rect.right - SYSMETRICS_CXVSCROLL))
return HTSIZE;
return HTHSCROLL;
}
} }
/* Check right sizing border */ /* Check menu bar */
if (pt.x >= rect.right)
if (HAS_MENU(wndPtr))
{ {
if (pt.y < rect.top+SYSMETRICS_CYSIZE) return HTTOPRIGHT; if ((pt.y < 0) && (pt.x >= 0) && (pt.x < rect.right))
if (pt.y >= rect.bottom-SYSMETRICS_CYSIZE) return HTBOTTOMRIGHT; return HTMENU;
return HTRIGHT;
} }
/* Should never get here */ /* Should never get here */
...@@ -537,9 +559,9 @@ void NC_DoNCPaint( HWND hwnd, HRGN hrgn, BOOL active, BOOL suppress_menupaint ) ...@@ -537,9 +559,9 @@ void NC_DoNCPaint( HWND hwnd, HRGN hrgn, BOOL active, BOOL suppress_menupaint )
#ifdef DEBUG_NONCLIENT #ifdef DEBUG_NONCLIENT
printf( "NC_DoNCPaint: %d %d\n", hwnd, hrgn ); printf( "NC_DoNCPaint: %d %d\n", hwnd, hrgn );
#endif #endif
if (!IsWindowVisible(hwnd)) return;
if (!wndPtr || !hrgn) return; if (!wndPtr || !hrgn) return;
if (!(wndPtr->dwStyle & (WS_BORDER | WS_DLGFRAME | WS_THICKFRAME))) if ((!(wndPtr->dwStyle & (WS_BORDER | WS_DLGFRAME | WS_THICKFRAME))) ||
(!(wndPtr->dwStyle & WS_VISIBLE)))
return; /* Nothing to do! */ return; /* Nothing to do! */
if (hrgn == 1) hdc = GetDCEx( hwnd, 0, DCX_CACHE | DCX_WINDOW ); if (hrgn == 1) hdc = GetDCEx( hwnd, 0, DCX_CACHE | DCX_WINDOW );
...@@ -594,27 +616,15 @@ void NC_DoNCPaint( HWND hwnd, HRGN hrgn, BOOL active, BOOL suppress_menupaint ) ...@@ -594,27 +616,15 @@ void NC_DoNCPaint( HWND hwnd, HRGN hrgn, BOOL active, BOOL suppress_menupaint )
NC_DrawCaption( hdc, &r, hwnd, wndPtr->dwStyle, active ); NC_DrawCaption( hdc, &r, hwnd, wndPtr->dwStyle, active );
} }
if (wndPtr->wIDmenu != 0 && if (HAS_MENU(wndPtr))
(wndPtr->dwStyle & WS_CHILD) != WS_CHILD) { {
LPPOPUPMENU lpMenu = (LPPOPUPMENU) GlobalLock(wndPtr->wIDmenu); LPPOPUPMENU lpMenu = (LPPOPUPMENU) GlobalLock( wndPtr->wIDmenu );
if (lpMenu != NULL) { RECT r = rect;
int oldHeight; r.bottom = rect.top + lpMenu->Height;
CopyRect(&rect2, &rect); rect.top += lpMenu->Height;
/* Default MenuBar height */ StdDrawMenuBar( hdc, &r, lpMenu, suppress_menupaint );
if (lpMenu->Height == 0) lpMenu->Height = SYSMETRICS_CYMENU + 1; GlobalUnlock( wndPtr->wIDmenu );
oldHeight = lpMenu->Height; }
rect2.bottom = rect2.top + oldHeight;
StdDrawMenuBar(hdc, &rect2, lpMenu, suppress_menupaint);
if (oldHeight != lpMenu->Height) {
printf("NC_DoNCPaint // menubar changed oldHeight=%d != lpMenu->Height=%d\n",
oldHeight, lpMenu->Height);
/* Reduce ClientRect according to MenuBar height */
wndPtr->rectClient.top -= oldHeight;
wndPtr->rectClient.top += lpMenu->Height;
}
GlobalUnlock(wndPtr->wIDmenu);
}
}
if (wndPtr->dwStyle & (WS_VSCROLL | WS_HSCROLL)) { if (wndPtr->dwStyle & (WS_VSCROLL | WS_HSCROLL)) {
if ((wndPtr->dwStyle & WS_VSCROLL) && (wndPtr->VScroll != NULL) && if ((wndPtr->dwStyle & WS_VSCROLL) && (wndPtr->VScroll != NULL) &&
...@@ -624,9 +634,6 @@ void NC_DoNCPaint( HWND hwnd, HRGN hrgn, BOOL active, BOOL suppress_menupaint ) ...@@ -624,9 +634,6 @@ void NC_DoNCPaint( HWND hwnd, HRGN hrgn, BOOL active, BOOL suppress_menupaint )
bottom -= SYSMETRICS_CYHSCROLL; bottom -= SYSMETRICS_CYHSCROLL;
SetRect(&rect2, rect.right - SYSMETRICS_CXVSCROLL, SetRect(&rect2, rect.right - SYSMETRICS_CXVSCROLL,
rect.top, rect.right, bottom); rect.top, rect.right, bottom);
if (wndPtr->dwStyle & WS_CAPTION) rect.top += SYSMETRICS_CYSIZE;
if (wndPtr->wIDmenu != 0 && (wndPtr->dwStyle & WS_CHILD) != WS_CHILD)
rect2.top += SYSMETRICS_CYMENU + 1;
StdDrawScrollBar(hwnd, hdc, SB_VERT, &rect2, (LPHEADSCROLL)wndPtr->VScroll); StdDrawScrollBar(hwnd, hdc, SB_VERT, &rect2, (LPHEADSCROLL)wndPtr->VScroll);
} }
if ((wndPtr->dwStyle & WS_HSCROLL) && wndPtr->HScroll != NULL && if ((wndPtr->dwStyle & WS_HSCROLL) && wndPtr->HScroll != NULL &&
......
...@@ -45,6 +45,8 @@ static char * DefSysColors[] = ...@@ -45,6 +45,8 @@ static char * DefSysColors[] =
static COLORREF SysColors[NUM_SYS_COLORS]; static COLORREF SysColors[NUM_SYS_COLORS];
#define MAKE_SOLID(color) \
(PALETTEINDEX(GetNearestPaletteIndex(STOCK_DEFAULT_PALETTE,(color))))
/************************************************************************* /*************************************************************************
* SYSCOLOR_SetColor * SYSCOLOR_SetColor
...@@ -69,6 +71,8 @@ static void SYSCOLOR_SetColor( int index, COLORREF color ) ...@@ -69,6 +71,8 @@ static void SYSCOLOR_SetColor( int index, COLORREF color )
sysColorObjects.hbrushInactiveCaption = CreateSolidBrush( color ); sysColorObjects.hbrushInactiveCaption = CreateSolidBrush( color );
break; break;
case COLOR_MENU: case COLOR_MENU:
DeleteObject( sysColorObjects.hbrushMenu );
sysColorObjects.hbrushMenu = CreateSolidBrush( MAKE_SOLID(color) );
break; break;
case COLOR_WINDOW: case COLOR_WINDOW:
DeleteObject( sysColorObjects.hbrushWindow ); DeleteObject( sysColorObjects.hbrushWindow );
...@@ -95,7 +99,11 @@ static void SYSCOLOR_SetColor( int index, COLORREF color ) ...@@ -95,7 +99,11 @@ static void SYSCOLOR_SetColor( int index, COLORREF color )
sysColorObjects.hbrushInactiveBorder = CreateSolidBrush( color ); sysColorObjects.hbrushInactiveBorder = CreateSolidBrush( color );
break; break;
case COLOR_APPWORKSPACE: case COLOR_APPWORKSPACE:
break;
case COLOR_HIGHLIGHT: case COLOR_HIGHLIGHT:
DeleteObject( sysColorObjects.hbrushHighlight );
sysColorObjects.hbrushHighlight = CreateSolidBrush( MAKE_SOLID(color));
break;
case COLOR_HIGHLIGHTTEXT: case COLOR_HIGHLIGHTTEXT:
break; break;
case COLOR_BTNFACE: case COLOR_BTNFACE:
......
...@@ -260,8 +260,11 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName, ...@@ -260,8 +260,11 @@ HWND CreateWindowEx( DWORD exStyle, LPSTR className, LPSTR windowName,
#endif #endif
/* 'soundrec.exe' has negative position ! /* 'soundrec.exe' has negative position !
Why ? For now, here a patch : */ Why ? For now, here a patch : */
if (x < 0) x = 0; if (!strcmp(className, "SoundRec"))
if (y < 0) y = 0; {
if (x < 0) x = 0;
if (y < 0) y = 0;
}
if (x == CW_USEDEFAULT) x = y = 0; if (x == CW_USEDEFAULT) x = y = 0;
if (width == CW_USEDEFAULT) if (width == CW_USEDEFAULT)
{ {
......
...@@ -647,16 +647,21 @@ static BOOL WINPOS_InternalSetWindowPos( WINDOWPOS *winpos ) ...@@ -647,16 +647,21 @@ static BOOL WINPOS_InternalSetWindowPos( WINDOWPOS *winpos )
/* Send WM_NCPAINT message if needed */ /* Send WM_NCPAINT message if needed */
if ((flags & (SWP_FRAMECHANGED | SWP_SHOWWINDOW)) || if (flags & SWP_SHOWWINDOW)
(!(flags & SWP_NOSIZE)) || (!(flags & SWP_NOMOVE)) || {
(!(flags & SWP_NOACTIVATE)) || (!(flags & SWP_NOZORDER))) /* Repaint the window frame and background */
SendMessage( winpos->hwnd, WM_NCPAINT, 1, 0L ); RedrawWindow( winpos->hwnd, NULL, 0,
#if 0 RDW_INVALIDATE | RDW_FRAME | RDW_ERASENOW );
if ((flags & (SWP_FRAMECHANGED | SWP_SHOWWINDOW)) && }
(!(flags & SWP_NOREDRAW)) && else
(wndPtr->dwStyle & WS_VISIBLE)) {
InvalidateRect(winpos->hwnd, NULL, TRUE); if ((flags & SWP_FRAMECHANGED) ||
#endif (!(flags & SWP_NOSIZE)) ||
(!(flags & SWP_NOMOVE)) ||
(!(flags & SWP_NOACTIVATE)) ||
(!(flags & SWP_NOZORDER)))
SendMessage( winpos->hwnd, WM_NCPAINT, 1, 0L );
}
/* And last, send the WM_WINDOWPOSCHANGED message */ /* And last, send the WM_WINDOWPOSCHANGED message */
......
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