From b2cffc688ea7abbddabc9ed23deea1921f59ac9d Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Sun, 6 Dec 2009 22:21:55 +0000 Subject: Moved OS X code base to the more moder Cocoa toolkit thanks to the awesome work of Manolo Gouy (STR #2221). This is a big one! I tested all test applications under 32-bit autoconf and Xcode, and a few apps under 64bit intel. No PPC testing was done. Please verify this patch if you have the machine! git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6951 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_grab.cxx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/Fl_grab.cxx') diff --git a/src/Fl_grab.cxx b/src/Fl_grab.cxx index b16ee536f..b6d49f8a5 100644 --- a/src/Fl_grab.cxx +++ b/src/Fl_grab.cxx @@ -48,7 +48,12 @@ extern HWND fl_capture; #ifdef __APPLE__ // MacOS Carbon does not seem to have a mechanism to grab the mouse pointer -extern WindowRef fl_capture; +#ifdef __APPLE_COCOA__ +extern void MACsetkeywindow(void *nsw); +extern void *fl_capture; +#else +extern Window fl_capture; +#endif #endif void Fl::grab(Fl_Window* win) { @@ -58,8 +63,13 @@ void Fl::grab(Fl_Window* win) { SetActiveWindow(fl_capture = fl_xid(first_window())); SetCapture(fl_capture); #elif defined(__APPLE__) - fl_capture = fl_xid( first_window() ); - SetUserFocusWindow( fl_capture ); +#ifdef __APPLE_COCOA__ + fl_capture = Fl_X::i(first_window())->xid; + MACsetkeywindow(fl_capture); +#else + fl_capture = fl_xid( first_window() ); + SetUserFocusWindow( fl_capture ); +#endif #else XGrabPointer(fl_display, fl_xid(first_window()), @@ -87,7 +97,9 @@ void Fl::grab(Fl_Window* win) { ReleaseCapture(); #elif defined(__APPLE__) fl_capture = 0; +#ifndef __APPLE_COCOA__ SetUserFocusWindow( (WindowRef)kUserFocusAuto ); +#endif #else XUngrabKeyboard(fl_display, fl_event_time); XUngrabPointer(fl_display, fl_event_time); -- cgit v1.2.3