ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/Darwin/gtk-osx.patch
Revision: 1.1
Committed: 2006-05-05T05:56:20Z (18 years, 6 months ago) by gbeauche
Branch: MAIN
Log Message:
updates

File Contents

# User Rev Content
1 gbeauche 1.1 2006-05-05 Gwenole Beauchesne <gb.public@free.fr>
2    
3     * gtk/gtkaqua.c (gtk_aqua_draw_focus): Don't crash if "detail" is
4     NULL.
5    
6     2006-04-17 Gwenole Beauchesne <gb.public@free.fr>
7    
8     * glib-1.2.10/gmain.c (g_main_run): Don't block in
9     RunApplicationEventLoop(), code inspired from Inside Mac
10     technote.
11    
12     This patch only suits Basilisk II needs. i.e. this may not work
13     for other programs.
14    
15     2006-04-17 Gwenole Beauchesne <gb.public@free.fr>
16    
17     * glib-1.2.10/glibconfig.h (G_VA_COPY): Don't redefine.
18    
19     --- gtk-osx-0.7/glib-1.2.10/glibconfig.h Thu Jan 2 05:29:18 2003
20     +++ gtk-osx-0.7/glib-1.2.10/glibconfig.h Mon Apr 17 21:12:34 2006
21     @@ -62,8 +62,9 @@ G_GNUC_EXTENSION typedef unsigned long l
22     #define GLIB_MINOR_VERSION 2
23     #define GLIB_MICRO_VERSION 10
24    
25     -
26     +#ifndef G_VA_COPY
27     #define G_VA_COPY __va_copy
28     +#endif
29    
30     #ifdef __cplusplus
31     #define G_HAVE_INLINE 1
32     --- gtk-osx-0.7/glib-1.2.10/gmain.c Sat Dec 27 22:23:06 2003
33     +++ gtk-osx-0.7/glib-1.2.10/gmain.c Mon Apr 17 22:12:15 2006
34     @@ -145,6 +145,7 @@ static gboolean g_idle_dispatch (
35     gpointer user_data);
36    
37     #ifdef MAC_CARBON_EVENTS
38     +static void mac_run_application_event_loop (GMainLoop *loop);
39     static void mac_handle_idle_action (EventLoopTimerRef timer_ref,
40     EventLoopIdleTimerMessage state,
41     void* user_data);
42     @@ -1116,7 +1117,7 @@ g_main_run (GMainLoop *loop)
43     loop->is_running = TRUE;
44    
45     #ifdef MAC_CARBON_EVENTS
46     - RunApplicationEventLoop ();
47     + mac_run_application_event_loop (loop);
48     #else
49     while (loop->is_running)
50     g_main_iterate (TRUE, TRUE);
51     @@ -1870,4 +1871,94 @@ mac_handle_g_main_iteration_action (Even
52     #endif
53     }
54    
55     -#endif /* MAC_CARBON_EVENTS */
56     \ No newline at end of file
57     +static EventHandlerUPP g_quit_event_handler_upp;
58     +
59     +static pascal OSStatus QuitEventHandler(EventHandlerCallRef inHandlerCallRef,
60     + EventRef inEvent, void *inUserData)
61     +{
62     + OSStatus err;
63     +
64     + if ((err = CallNextEventHandler(inHandlerCallRef, inEvent)) == noErr)
65     + *((Boolean *)inUserData) = TRUE;
66     +
67     + return err;
68     +}
69     +
70     +static EventHandlerUPP g_event_loop_event_handler_upp;
71     +
72     +static pascal OSStatus EventLoopEventHandler(EventHandlerCallRef inHandlerCallRef,
73     + EventRef inEvent, void *inUserData)
74     +{
75     + OSStatus err;
76     + OSStatus junk;
77     + EventHandlerRef installedHandler;
78     + EventTargetRef theTarget;
79     + EventRef theEvent;
80     + EventTimeout timeToWaitForEvent;
81     + Boolean quitNow;
82     + GMainLoop * loop = (GMainLoop *)inUserData;
83     + static const EventTypeSpec eventSpec = {kEventClassApplication, kEventAppQuit};
84     +
85     + quitNow = false;
86     +
87     + err = InstallEventHandler(GetApplicationEventTarget(),
88     + g_quit_event_handler_upp,
89     + 1, &eventSpec, &quitNow, &installedHandler);
90     + if (err == noErr) {
91     + theTarget = GetEventDispatcherTarget();
92     + do {
93     + timeToWaitForEvent = kEventDurationNoWait;
94     + err = ReceiveNextEvent(0, NULL, timeToWaitForEvent,
95     + true, &theEvent);
96     + if (err == noErr) {
97     + SendEventToEventTarget(theEvent, theTarget);
98     + ReleaseEvent(theEvent);
99     + }
100     + YieldToAnyThread();
101     + } while ( loop->is_running && ! quitNow );
102     + junk = RemoveEventHandler(installedHandler);
103     + }
104     +
105     + return err;
106     +}
107     +
108     +static void
109     +mac_run_application_event_loop (GMainLoop *loop)
110     +{
111     + static const EventTypeSpec eventSpec = {'KWIN', 'KWIN' };
112     + OSStatus err;
113     + OSStatus junk;
114     + EventHandlerRef installedHandler;
115     + EventRef dummyEvent;
116     +
117     + dummyEvent = nil;
118     +
119     + err = noErr;
120     + if (g_event_loop_event_handler_upp == nil)
121     + g_event_loop_event_handler_upp = NewEventHandlerUPP(EventLoopEventHandler);
122     + if (g_quit_event_handler_upp == nil)
123     + g_quit_event_handler_upp = NewEventHandlerUPP(QuitEventHandler);
124     + if (g_event_loop_event_handler_upp == nil || g_quit_event_handler_upp == nil)
125     + err = memFullErr;
126     +
127     + if (err == noErr) {
128     + err = InstallEventHandler(GetApplicationEventTarget(),
129     + g_event_loop_event_handler_upp,
130     + 1, &eventSpec, loop, &installedHandler);
131     + if (err == noErr) {
132     + err = MacCreateEvent(nil, 'KWIN', 'KWIN', GetCurrentEventTime(),
133     + kEventAttributeNone, &dummyEvent);
134     + if (err == noErr)
135     + err = PostEventToQueue(GetMainEventQueue(), dummyEvent,
136     + kEventPriorityHigh);
137     + if (err == noErr)
138     + RunApplicationEventLoop();
139     +
140     + junk = RemoveEventHandler(installedHandler);
141     + }
142     + }
143     +
144     + if (dummyEvent != nil)
145     + ReleaseEvent(dummyEvent);
146     +}
147     +#endif /* MAC_CARBON_EVENTS */
148     --- gtk-osx-0.7/gtk/gtkaqua.c Sat Dec 27 23:33:36 2003
149     +++ gtk-osx-0.7/gtk/gtkaqua.c Fri May 5 07:13:30 2006
150     @@ -2183,11 +2183,12 @@ gtk_aqua_draw_focus (GtkStyle *styl
151     g_return_if_fail (window != NULL);
152    
153     // aqua button focus is not just a simple rectangle, so we don't draw anything here
154     - if ( strcmp( detail, "button" ) == 0 ) {
155     + if (detail) {
156     + if ( strcmp( detail, "button" ) == 0 )
157     return;
158     - } else if ( strcmp( detail, "checkbutton" ) == 0 ) {
159     + else if ( strcmp( detail, "checkbutton" ) == 0 )
160     return;
161     - } else if ( strcmp( detail, "togglebutton" ) == 0 ) {
162     + else if ( strcmp( detail, "togglebutton" ) == 0 )
163     return;
164     }
165