mirror of
https://github.com/fltk/fltk.git
synced 2026-05-31 13:55:38 +08:00
Some fixes for the Cocoa port
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6952 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
+1
-1
@@ -152,7 +152,7 @@ UNINSTALL_DESKTOP = @UNINSTALL_DESKTOP@
|
|||||||
|
|
||||||
.cxx.o:
|
.cxx.o:
|
||||||
echo Compiling $<...
|
echo Compiling $<...
|
||||||
@if [ $< = Fl.cxx ]; then \
|
@if [ `uname` = Darwin -a $< = Fl.cxx ]; then \
|
||||||
$(CXX) -I.. $(ARCHFLAGS) @PNGINC@ @JPEGINC@ @ZLIBINC@ $(CXXFLAGS) -x objective-c++ -c $< -o $@; \
|
$(CXX) -I.. $(ARCHFLAGS) @PNGINC@ @JPEGINC@ @ZLIBINC@ $(CXXFLAGS) -x objective-c++ -c $< -o $@; \
|
||||||
else \
|
else \
|
||||||
$(CXX) -I.. $(ARCHFLAGS) @PNGINC@ @JPEGINC@ @ZLIBINC@ $(CXXFLAGS) -c $< -o $@; \
|
$(CXX) -I.. $(ARCHFLAGS) @PNGINC@ @JPEGINC@ @ZLIBINC@ $(CXXFLAGS) -c $< -o $@; \
|
||||||
|
|||||||
@@ -870,6 +870,16 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, Root root, const char
|
|||||||
"/%s/%s.prefs", vendor, application);
|
"/%s/%s.prefs", vendor, application);
|
||||||
for (char *s = filename; *s; s++) if (*s == '\\') *s = '/';
|
for (char *s = filename; *s; s++) if (*s == '\\') *s = '/';
|
||||||
#elif defined ( __APPLE__ )
|
#elif defined ( __APPLE__ )
|
||||||
|
#ifdef __APPLE_COCOA__
|
||||||
|
switch (root) {
|
||||||
|
case SYSTEM:
|
||||||
|
strcpy(filename, "/Library/Preferences");
|
||||||
|
break;
|
||||||
|
case USER:
|
||||||
|
sprintf(filename, "%s/Library/Preferences", fl_getenv("HOME"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#else
|
||||||
FSSpec spec = { 0 };
|
FSSpec spec = { 0 };
|
||||||
FSRef ref;
|
FSRef ref;
|
||||||
OSErr err = fnfErr;
|
OSErr err = fnfErr;
|
||||||
@@ -885,6 +895,7 @@ Fl_Preferences::RootNode::RootNode( Fl_Preferences *prefs, Root root, const char
|
|||||||
}
|
}
|
||||||
FSpMakeFSRef( &spec, &ref );
|
FSpMakeFSRef( &spec, &ref );
|
||||||
FSRefMakePath( &ref, (UInt8*)filename, FL_PATH_MAX );
|
FSRefMakePath( &ref, (UInt8*)filename, FL_PATH_MAX );
|
||||||
|
#endif
|
||||||
snprintf(filename + strlen(filename), sizeof(filename) - strlen(filename),
|
snprintf(filename + strlen(filename), sizeof(filename) - strlen(filename),
|
||||||
"/%s/%s.prefs", vendor, application );
|
"/%s/%s.prefs", vendor, application );
|
||||||
#else
|
#else
|
||||||
|
|||||||
+16
-4
@@ -61,6 +61,13 @@ extern "C" {
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
#include <AvailabilityMacros.h>
|
||||||
|
#if defined(__LP64__) && __LP64__
|
||||||
|
typedef double CGFloat;
|
||||||
|
#else
|
||||||
|
typedef float CGFloat;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
|
#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
|
||||||
typedef long NSInteger;
|
typedef long NSInteger;
|
||||||
typedef unsigned long NSUInteger;
|
typedef unsigned long NSUInteger;
|
||||||
@@ -803,7 +810,7 @@ static void cocoaMouseHandler(NSEvent *theEvent)
|
|||||||
// fall through
|
// fall through
|
||||||
case NSLeftMouseDragged:
|
case NSLeftMouseDragged:
|
||||||
case NSRightMouseDragged:
|
case NSRightMouseDragged:
|
||||||
case NSOtherMouseDragged:
|
case NSOtherMouseDragged: {
|
||||||
if (suppressed) break;
|
if (suppressed) break;
|
||||||
if ( !sendEvent ) {
|
if ( !sendEvent ) {
|
||||||
sendEvent = FL_MOVE; // Fl::handle will convert into FL_DRAG
|
sendEvent = FL_MOVE; // Fl::handle will convert into FL_DRAG
|
||||||
@@ -817,6 +824,8 @@ static void cocoaMouseHandler(NSEvent *theEvent)
|
|||||||
Fl::e_x = pos.x;
|
Fl::e_x = pos.x;
|
||||||
Fl::e_y = pos.y;
|
Fl::e_y = pos.y;
|
||||||
Fl::handle( sendEvent, window );
|
Fl::handle( sendEvent, window );
|
||||||
|
} break;
|
||||||
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1090,7 +1099,7 @@ OSStatus cocoaKeyboardHandler(NSEvent *theEvent)
|
|||||||
if([s length] == 0) {//this is a dead key that must be combined with the next key to be pressed
|
if([s length] == 0) {//this is a dead key that must be combined with the next key to be pressed
|
||||||
while (window->parent()) window = window->window();
|
while (window->parent()) window = window->window();
|
||||||
Fl::e_keysym = FL_Control_R;//first simulate pressing of the compose key (FL_Control_R)
|
Fl::e_keysym = FL_Control_R;//first simulate pressing of the compose key (FL_Control_R)
|
||||||
Fl::e_text = "";
|
Fl::e_text = (char*)"";
|
||||||
Fl::e_length = 0;
|
Fl::e_length = 0;
|
||||||
Fl::handle(FL_KEYBOARD, window);
|
Fl::handle(FL_KEYBOARD, window);
|
||||||
compose=YES;
|
compose=YES;
|
||||||
@@ -1129,7 +1138,7 @@ OSStatus cocoaKeyboardHandler(NSEvent *theEvent)
|
|||||||
case NSKeyDown:
|
case NSKeyDown:
|
||||||
sendEvent = FL_KEYBOARD;
|
sendEvent = FL_KEYBOARD;
|
||||||
// fall through
|
// fall through
|
||||||
case NSKeyUp:
|
case NSKeyUp: {
|
||||||
if ( !sendEvent ) {
|
if ( !sendEvent ) {
|
||||||
sendEvent = FL_KEYUP;
|
sendEvent = FL_KEYUP;
|
||||||
Fl::e_state &= 0xbfffffff; // clear the deadkey flag
|
Fl::e_state &= 0xbfffffff; // clear the deadkey flag
|
||||||
@@ -1155,7 +1164,10 @@ OSStatus cocoaKeyboardHandler(NSEvent *theEvent)
|
|||||||
Fl::e_length = strlen(buffer);
|
Fl::e_length = strlen(buffer);
|
||||||
Fl::e_text = buffer;
|
Fl::e_text = buffer;
|
||||||
buffer[Fl::e_length] = 0; // just in case...
|
buffer[Fl::e_length] = 0; // just in case...
|
||||||
break;
|
} break;
|
||||||
|
default:
|
||||||
|
fl_unlock_function();
|
||||||
|
return eventNotHandledErr;
|
||||||
}
|
}
|
||||||
while (window->parent()) window = window->window();
|
while (window->parent()) window = window->window();
|
||||||
if (sendEvent && Fl::handle(sendEvent,window)) {
|
if (sendEvent && Fl::handle(sendEvent,window)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user