[PATCH 5/5][resent] Implement MsgWaitForMultipleObjectsEx and initial Carbon event handling.

Pierre d'Herbemont pdherbemont at free.fr
Sun Oct 22 17:54:31 CDT 2006


Fix TABs and #import from last patch.

Pierre.
---
  dlls/winequartz.drv/Makefile.in         |    4 +-
  dlls/winequartz.drv/event.c             |   74 
+++++++++++++++++++++++++++++++
  dlls/winequartz.drv/quartzdrv.h         |    5 ++
  dlls/winequartz.drv/quartzdrv_carbon.c  |   46 +++++++++++++++++++
  dlls/winequartz.drv/winequartz.drv.spec |    2 -
  5 files changed, 129 insertions(+), 2 deletions(-)
-------------- next part --------------
diff --git a/dlls/winequartz.drv/Makefile.in b/dlls/winequartz.drv/Makefile.in
index 809bf0a..cb826cd 100644
--- a/dlls/winequartz.drv/Makefile.in
+++ b/dlls/winequartz.drv/Makefile.in
@@ -5,9 +5,11 @@ VPATH     = @srcdir@
 MODULE    = winequartz.drv
 IMPORTS   = user32 gdi32 advapi32 kernel32 ntdll
 EXTRAINCL = 
-EXTRALIBS = 
+EXTRALIBS = -framework Carbon
 
 C_SRCS = \
+	event.c \
+	quartzdrv_carbon.c \
 	quartzdrv_main.c
 
 @MAKE_DLL_RULES@
diff --git a/dlls/winequartz.drv/event.c b/dlls/winequartz.drv/event.c
new file mode 100644
index 0000000..0c2cbc0
--- /dev/null
+++ b/dlls/winequartz.drv/event.c
@@ -0,0 +1,74 @@
+/*
+ * Quartz (Mac OS X) event driver
+ *
+ * Copyright 1993 Alexandre Julliard
+ *         1999 Noel Borthwick
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ */
+
+#define COM_NO_WINDOWS_H
+#include "config.h"
+
+#include <assert.h>
+#include <stdarg.h>
+#include <string.h>
+
+#define NONAMELESSUNION
+#define NONAMELESSSTRUCT
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "wingdi.h"
+#include "shlobj.h"  /* DROPFILES */
+
+#include "win.h"
+#include "winreg.h"
+#include "quartzdrv.h"
+#include "shellapi.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(event);
+
+/***********************************************************************
+ *           MsgWaitForMultipleObjectsEx   (QDRV.@)
+ */
+DWORD QDRV_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles,
+                                          DWORD timeout, DWORD mask, DWORD flags )
+{
+    DWORD ret;
+    struct quartzdrv_thread_data *data = quartzdrv_thread_data();
+    
+    if (!data || data->process_event_count)
+    {
+        if (!count && !timeout) return WAIT_TIMEOUT;
+        return WaitForMultipleObjectsEx( count, handles, flags & MWMO_WAITALL,
+                                         timeout, flags & MWMO_ALERTABLE );
+    }
+
+    data->process_event_count++;
+    if (QDRV_CarbonGetEvent()) ret = count;
+    else if (count || timeout)
+    {   
+        ret = WaitForMultipleObjectsEx( count, handles, flags & MWMO_WAITALL,
+                                        timeout, flags & MWMO_ALERTABLE );
+        
+        if (ret == count) QDRV_CarbonGetEvent();
+    }
+    else ret = WAIT_TIMEOUT;
+    data->process_event_count--;
+
+    return ret;
+}
\ No newline at end of file
diff --git a/dlls/winequartz.drv/quartzdrv.h b/dlls/winequartz.drv/quartzdrv.h
index 4f97bb1..d9f326d 100644
--- a/dlls/winequartz.drv/quartzdrv.h
+++ b/dlls/winequartz.drv/quartzdrv.h
@@ -45,4 +45,9 @@ inline static struct quartzdrv_thread_da
     return data;
 }
 
+/* ---------------------------------------------------------------------
+   quartzdrv_carbon.c
+*/
+extern int QDRV_CarbonGetEvent(void);
+
 #endif  /* __WINE_QUARTZDRV_H */
diff --git a/dlls/winequartz.drv/quartzdrv_carbon.c b/dlls/winequartz.drv/quartzdrv_carbon.c
new file mode 100644
index 0000000..f668430
--- /dev/null
+++ b/dlls/winequartz.drv/quartzdrv_carbon.c
@@ -0,0 +1,46 @@
+/*
+ * QUARTZDRV Carbon bridge code
+ *
+ * Copyright 2006 Emmanuel Maillard
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ */
+
+#include <Carbon/Carbon.h>
+
+/***********************************************************************
+ *          QDRV_CarbonGetEvent
+ *            (returns 1 if an event was received, else 0)
+ */
+int QDRV_CarbonGetEvent(void)
+{
+    EventRef event;
+    if (ReceiveNextEvent(0, NULL, kEventDurationNoWait, true, &event) == noErr) {
+        UInt32 eventClass = GetEventClass(event);
+        
+        switch (eventClass)
+        {
+            case kEventClassMouse:
+            case kEventClassAppleEvent:
+            case kEventClassApplication:
+            default:
+                SendEventToEventTarget(event, GetEventDispatcherTarget());
+            break;
+        }
+        ReleaseEvent(event);
+        return 1;
+    }
+    return 0;
+}
\ No newline at end of file
diff --git a/dlls/winequartz.drv/winequartz.drv.spec b/dlls/winequartz.drv/winequartz.drv.spec
index d98d860..b0a372c 100644
--- a/dlls/winequartz.drv/winequartz.drv.spec
+++ b/dlls/winequartz.drv/winequartz.drv.spec
@@ -1 +1 @@
-# Nothing Yet
+@ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) QDRV_MsgWaitForMultipleObjectsEx
\ No newline at end of file


More information about the wine-patches mailing list