summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FL/Fl_Sys_Menu_Bar.H8
-rw-r--r--FL/mac.H1
-rw-r--r--src/Fl_cocoa.mm20
3 files changed, 21 insertions, 8 deletions
diff --git a/FL/Fl_Sys_Menu_Bar.H b/FL/Fl_Sys_Menu_Bar.H
index 8c8cbfd40..794cac5fd 100644
--- a/FL/Fl_Sys_Menu_Bar.H
+++ b/FL/Fl_Sys_Menu_Bar.H
@@ -39,13 +39,15 @@ protected:
public:
Fl_Sys_Menu_Bar(int x,int y,int w,int h,const char *l=0)
: Fl_Menu_Bar(x,y,w,h,l) {
- deactivate(); // don't let the old area take events
- fl_sys_menu_bar = this;
- }
+ deactivate(); // don't let the old area take events
+ fl_sys_menu_bar = this;
+ }
void menu(const Fl_Menu_Item *m);
+#ifdef __APPLE_COCOA__
int add(const char* label, int shortcut, Fl_Callback*, void *user_data=0, int flags=0);
void remove(int n);
void replace(int rank, const char *name);
+#endif
};
#else
diff --git a/FL/mac.H b/FL/mac.H
index 0d24d03c8..0237b70cc 100644
--- a/FL/mac.H
+++ b/FL/mac.H
@@ -163,6 +163,7 @@ extern void MacUnmapWindow(Fl_Window*,void *);
extern WindowRef MACwindowRef(Fl_Window *w);
extern Fl_Region MacRectRegionIntersect(Fl_Region current, int x,int y,int w, int h);
extern void MacCollapseWindow(Window w);
+extern void fl_mac_set_about( Fl_Callback *cb, void *user_data, int shortcut = 0);
#else
extern void MacDestroyWindow(Fl_Window*,WindowPtr);
extern void MacMapWindow(Fl_Window*,WindowPtr);
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index 17485361b..71c751dc0 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -973,11 +973,13 @@ static int (*keycode_function)(char*, int, EventKind, UInt32, UInt32, UInt32*, u
//this gets called by CJK character palette input
OSStatus carbonTextHandler( EventHandlerCallRef nextHandler, EventRef event, void *unused )
{
+ //make sure the key window is an FLTK window
+ NSWindow *keywindow = [NSApp keyWindow];
+ if(keywindow == nil || ![keywindow isMemberOfClass:[FLWindow class]]) return eventNotHandledErr;
//under 10.5 this gets called only after character palette inputs
//but under 10.6 this gets also called by interpretKeyEvents
//during character composition when we don't want to run it
- if([[NSApp currentEvent] type] == NSKeyDown) return noErr;
- if( [NSApp keyWindow] == nil) return noErr;
+ if([[NSApp currentEvent] type] != NSSystemDefined) return eventNotHandledErr;
Fl_Window *window = [(FLWindow*)[NSApp keyWindow] getFl_Window];
fl_lock_function();
//int kind = GetEventKind(event);
@@ -1539,7 +1541,12 @@ static void handleUpdateEvent( Fl_Window *window )
Fl_X *i = Fl_X::i( window );
i->wait_for_expose = 0;
- // FIXME: this is in the Carbon version. Does it need to be here?
+ // FIXME: Matt: This is in the Carbon version. Does it need to be here?
+ /*
+ //I don't think so (MG). This function gets called only when a full
+ //redraw is needed (creation, resize, deminiaturization)
+ //and later in it we set damages to DAMAGE_ALL, so there is no
+ //point in limiting redraw to i->region
if ( i->xid && window->damage() ) {
NSView *view = [(NSWindow*)i->xid contentView];
if ( view && i->region ) {
@@ -1551,6 +1558,7 @@ static void handleUpdateEvent( Fl_Window *window )
}
}
}
+ */
if ( i->region ) {
XDestroyRegion(i->region);
@@ -2868,16 +2876,18 @@ static void createAppleMenu(void)
@end
-void fl_mac_set_about( Fl_Callback *cb, void *user_data, int shortcut = 0)
/**
* Mac OS: attaches a callback to the "About myprog" item of the system application menu.
+ * \note #include <FL/x.H>
*
* \author Manolo Gouy
*
* \param[in] cb a callback that will be called by "About myprog" menu item
- * \param[in] user_data a pointer transmitted as 2nd argument to the callback
+ * with NULL 1st argument.
+ * \param[in] user_data a pointer transmitted as 2nd argument to the callback.
* \param[in] shortcut optional shortcut to attach to the "About myprog" menu item (e.g., FL_META+'a')
*/
+void fl_mac_set_about( Fl_Callback *cb, void *user_data, int shortcut)
{
NSAutoreleasePool *localPool;
localPool = [[NSAutoreleasePool alloc] init];