Release 940804
Thu Aug 4 07:18:02 1994 Michael Patra <micky@marie.physik.tu-berlin.de>
* [windows/message.c]
Implemented WaitMessage() (USER.112).
* [if1632/user.spec]
Added WaitMessage.
* [windows/defwnd.c]
WM_ERASEBKGND: Added support for hbrBackground=COLOR_xxx.
* [miscemu/int{13,21,2a}.c]
* [miscemu/Imakefile]
* [signal/loader.c]
Added a few basic disk information and diagnostic functions to
prevent programs using this function from crashing. All drives
are claimed to be remote ones, so direct I/O isn't allowed.
* [controls/edit.c]
EDIT_WriteText(): Added code to correctly erase the remaining space
of the edit-control if the size of the control has changed sinced it's
creation.
Tue Jul 26 22:05:54 MET DST 1994 Erik Bos <erik@hacktic.nl>
* [if1632/mouse.spec]
Added mouse.dll entry, no functions.
* [loader/resource.c]
Bug fix in AccessResource().
* [misc/keyboard.c], added [include/keyboard.h]
Changed functions to return more useful values.
* [windows/dialog.c]
Hacked DIALOG_GetControl() to support resources which
have 0xff00 - 0xffff as id. ** Needs to be done properly by
someone who knows the NE fileformat **
Jul 29, 94 martin2@trgcorp.solucorp.qc.ca (Martin Ayotte)
* [windows/event.c]
Add new stub for EnableHGardwareInput() function.
* [windows/message.c]
Add coding for HWND_BROADCAST in PostMessage().
* [misc/file.c]
Add coding for OpenFile() also search in WindowPaths.
* [misc/mmsystem.c]
* [misc/audio.c]
* [misc/mmaux.c]
* [misc/mcicda.c]
Change #include "linux/soundcard.h" by #include "sys/soundcard.h"
Add coding in MMIO functions. Now, mmioDescend() can find WAV chunks.
SndPlaySound & MCI_ELEMENT now use MMIO and adjust to proper formats.
diff --git a/windows/message.c b/windows/message.c
index dfafcde..dcb8e5c 100644
--- a/windows/message.c
+++ b/windows/message.c
@@ -21,6 +21,8 @@
#include "sysmetrics.h"
#include "hook.h"
+#define HWND_BROADCAST ((HWND)0xffff)
+
#define MAX_QUEUE_SIZE 120 /* Max. size of a message queue */
@@ -115,8 +117,10 @@
pos = msgQueue->nextFreeMessage;
/* Check if queue is full */
- if ((pos == msgQueue->nextMessage) && (msgQueue->msgCount > 0))
- return FALSE;
+ if ((pos == msgQueue->nextMessage) && (msgQueue->msgCount > 0)) {
+ printf("MSG_AddMsg // queue is full !\n");
+ return FALSE;
+ }
/* Store message */
msgQueue->messages[pos].msg = *msg;
@@ -724,16 +728,44 @@
}
+
/***********************************************************************
* PostMessage (USER.110)
*/
BOOL PostMessage( HWND hwnd, WORD message, WORD wParam, LONG lParam )
{
- MSG msg;
- WND *wndPtr = WIN_FindWndPtr( hwnd );
+ MSG msg;
+ WND *wndPtr;
+ if (hwnd == HWND_BROADCAST) {
+#ifdef DEBUG_MSG
+ printf("PostMessage // HWND_BROADCAST !\n");
+#endif
+ hwnd = GetTopWindow(GetDesktopWindow());
+ while (hwnd) {
+ if (!(wndPtr = WIN_FindWndPtr(hwnd))) break;
+ if (wndPtr->dwStyle & WS_POPUP || wndPtr->dwStyle & WS_CAPTION) {
+#ifdef DEBUG_MSG
+ printf("BROADCAST Message to hWnd=%04X m=%04X w=%04X l=%08X !\n",
+ hwnd, message, wParam, lParam);
+#endif
+ PostMessage(hwnd, message, wParam, lParam);
+ }
+/* {
+ char str[128];
+ GetWindowText(hwnd, str, sizeof(str));
+ printf("BROADCAST GetWindowText()='%s' !\n", str);
+ }*/
+ hwnd = wndPtr->hwndNext;
+ }
+#ifdef DEBUG_MSG
+ printf("PostMessage // End of HWND_BROADCAST !\n");
+#endif
+ return TRUE;
+ }
+
+ wndPtr = WIN_FindWndPtr( hwnd );
if (!wndPtr || !wndPtr->hmemTaskQ) return FALSE;
-
msg.hwnd = hwnd;
msg.message = message;
msg.wParam = wParam;
@@ -760,6 +792,51 @@
/***********************************************************************
+ * WaitMessage (USER.112)
+ */
+void WaitMessage( void )
+{
+ MSG msg;
+ LONG nextExp; /* Next timer expiration time */
+ XEvent event;
+
+ while (XPending( display ))
+ {
+ XNextEvent( display, &event );
+ EVENT_ProcessEvent( &event );
+ }
+
+ while(1)
+ {
+ if ((appMsgQueue->wPostQMsg) ||
+ (appMsgQueue->status & (QS_SENDMESSAGE | QS_PAINT)) ||
+ (appMsgQueue->msgCount) || (sysMsgQueue->msgCount) )
+ break;
+ if ((appMsgQueue->status & QS_TIMER) &&
+ TIMER_CheckTimer( &nextExp, &msg, 0, FALSE))
+ break;
+ else
+ nextExp=-1;
+
+ if (!XPending( display ) && (nextExp != -1))
+ {
+ fd_set read_set;
+ struct timeval timeout;
+ int fd = ConnectionNumber(display);
+ FD_ZERO( &read_set );
+ FD_SET( fd, &read_set );
+ timeout.tv_sec = nextExp / 1000;
+ timeout.tv_usec = (nextExp % 1000) * 1000;
+ if (select( fd+1, &read_set, NULL, NULL, &timeout ) != 1)
+ continue; /* On timeout or error, restart from the start */
+ }
+ XNextEvent( display, &event );
+ EVENT_ProcessEvent( &event );
+ }
+}
+
+
+/***********************************************************************
* TranslateMessage (USER.113)
*/
BOOL TranslateMessage( LPMSG msg )
@@ -851,10 +928,12 @@
*/
WORD RegisterWindowMessage( LPCSTR str )
{
+ WORD wRet;
#ifdef DEBUG_MSG
printf( "RegisterWindowMessage: '%s'\n", str );
#endif
- return GlobalAddAtom( str );
+ wRet = GlobalAddAtom( str );
+ return wRet;
}