ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/Darwin/gtk-osx.patch
Revision: 1.2
Committed: 2006-05-05T06:00:17Z (18 years, 6 months ago) by gbeauche
Branch: MAIN
CVS Tags: nigel-build-19, HEAD
Changes since 1.1: +14 -0 lines
Log Message:
Add another NULL pointer check

File Contents

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