This commit is contained in:
gbeauche 2006-05-05 05:56:20 +00:00
parent 4578abcbd4
commit 2bff888cee

View File

@ -0,0 +1,165 @@
2006-05-05 Gwenole Beauchesne <gb.public@free.fr>
* gtk/gtkaqua.c (gtk_aqua_draw_focus): Don't crash if "detail" is
NULL.
2006-04-17 Gwenole Beauchesne <gb.public@free.fr>
* glib-1.2.10/gmain.c (g_main_run): Don't block in
RunApplicationEventLoop(), code inspired from Inside Mac
technote.
This patch only suits Basilisk II needs. i.e. this may not work
for other programs.
2006-04-17 Gwenole Beauchesne <gb.public@free.fr>
* glib-1.2.10/glibconfig.h (G_VA_COPY): Don't redefine.
--- gtk-osx-0.7/glib-1.2.10/glibconfig.h Thu Jan 2 05:29:18 2003
+++ gtk-osx-0.7/glib-1.2.10/glibconfig.h Mon Apr 17 21:12:34 2006
@@ -62,8 +62,9 @@ G_GNUC_EXTENSION typedef unsigned long l
#define GLIB_MINOR_VERSION 2
#define GLIB_MICRO_VERSION 10
-
+#ifndef G_VA_COPY
#define G_VA_COPY __va_copy
+#endif
#ifdef __cplusplus
#define G_HAVE_INLINE 1
--- gtk-osx-0.7/glib-1.2.10/gmain.c Sat Dec 27 22:23:06 2003
+++ gtk-osx-0.7/glib-1.2.10/gmain.c Mon Apr 17 22:12:15 2006
@@ -145,6 +145,7 @@ static gboolean g_idle_dispatch (
gpointer user_data);
#ifdef MAC_CARBON_EVENTS
+static void mac_run_application_event_loop (GMainLoop *loop);
static void mac_handle_idle_action (EventLoopTimerRef timer_ref,
EventLoopIdleTimerMessage state,
void* user_data);
@@ -1116,7 +1117,7 @@ g_main_run (GMainLoop *loop)
loop->is_running = TRUE;
#ifdef MAC_CARBON_EVENTS
- RunApplicationEventLoop ();
+ mac_run_application_event_loop (loop);
#else
while (loop->is_running)
g_main_iterate (TRUE, TRUE);
@@ -1870,4 +1871,94 @@ mac_handle_g_main_iteration_action (Even
#endif
}
-#endif /* MAC_CARBON_EVENTS */
\ No newline at end of file
+static EventHandlerUPP g_quit_event_handler_upp;
+
+static pascal OSStatus QuitEventHandler(EventHandlerCallRef inHandlerCallRef,
+ EventRef inEvent, void *inUserData)
+{
+ OSStatus err;
+
+ if ((err = CallNextEventHandler(inHandlerCallRef, inEvent)) == noErr)
+ *((Boolean *)inUserData) = TRUE;
+
+ return err;
+}
+
+static EventHandlerUPP g_event_loop_event_handler_upp;
+
+static pascal OSStatus EventLoopEventHandler(EventHandlerCallRef inHandlerCallRef,
+ EventRef inEvent, void *inUserData)
+{
+ OSStatus err;
+ OSStatus junk;
+ EventHandlerRef installedHandler;
+ EventTargetRef theTarget;
+ EventRef theEvent;
+ EventTimeout timeToWaitForEvent;
+ Boolean quitNow;
+ GMainLoop * loop = (GMainLoop *)inUserData;
+ static const EventTypeSpec eventSpec = {kEventClassApplication, kEventAppQuit};
+
+ quitNow = false;
+
+ err = InstallEventHandler(GetApplicationEventTarget(),
+ g_quit_event_handler_upp,
+ 1, &eventSpec, &quitNow, &installedHandler);
+ if (err == noErr) {
+ theTarget = GetEventDispatcherTarget();
+ do {
+ timeToWaitForEvent = kEventDurationNoWait;
+ err = ReceiveNextEvent(0, NULL, timeToWaitForEvent,
+ true, &theEvent);
+ if (err == noErr) {
+ SendEventToEventTarget(theEvent, theTarget);
+ ReleaseEvent(theEvent);
+ }
+ YieldToAnyThread();
+ } while ( loop->is_running && ! quitNow );
+ junk = RemoveEventHandler(installedHandler);
+ }
+
+ return err;
+}
+
+static void
+mac_run_application_event_loop (GMainLoop *loop)
+{
+ static const EventTypeSpec eventSpec = {'KWIN', 'KWIN' };
+ OSStatus err;
+ OSStatus junk;
+ EventHandlerRef installedHandler;
+ EventRef dummyEvent;
+
+ dummyEvent = nil;
+
+ err = noErr;
+ if (g_event_loop_event_handler_upp == nil)
+ g_event_loop_event_handler_upp = NewEventHandlerUPP(EventLoopEventHandler);
+ if (g_quit_event_handler_upp == nil)
+ g_quit_event_handler_upp = NewEventHandlerUPP(QuitEventHandler);
+ if (g_event_loop_event_handler_upp == nil || g_quit_event_handler_upp == nil)
+ err = memFullErr;
+
+ if (err == noErr) {
+ err = InstallEventHandler(GetApplicationEventTarget(),
+ g_event_loop_event_handler_upp,
+ 1, &eventSpec, loop, &installedHandler);
+ if (err == noErr) {
+ err = MacCreateEvent(nil, 'KWIN', 'KWIN', GetCurrentEventTime(),
+ kEventAttributeNone, &dummyEvent);
+ if (err == noErr)
+ err = PostEventToQueue(GetMainEventQueue(), dummyEvent,
+ kEventPriorityHigh);
+ if (err == noErr)
+ RunApplicationEventLoop();
+
+ junk = RemoveEventHandler(installedHandler);
+ }
+ }
+
+ if (dummyEvent != nil)
+ ReleaseEvent(dummyEvent);
+}
+#endif /* MAC_CARBON_EVENTS */
--- gtk-osx-0.7/gtk/gtkaqua.c Sat Dec 27 23:33:36 2003
+++ gtk-osx-0.7/gtk/gtkaqua.c Fri May 5 07:13:30 2006
@@ -2183,11 +2183,12 @@ gtk_aqua_draw_focus (GtkStyle *styl
g_return_if_fail (window != NULL);
// aqua button focus is not just a simple rectangle, so we don't draw anything here
- if ( strcmp( detail, "button" ) == 0 ) {
+ if (detail) {
+ if ( strcmp( detail, "button" ) == 0 )
return;
- } else if ( strcmp( detail, "checkbutton" ) == 0 ) {
+ else if ( strcmp( detail, "checkbutton" ) == 0 )
return;
- } else if ( strcmp( detail, "togglebutton" ) == 0 ) {
+ else if ( strcmp( detail, "togglebutton" ) == 0 )
return;
}