summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Fl_cocoa.mm35
-rw-r--r--src/fl_diamond_box.cxx28
2 files changed, 44 insertions, 19 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index ffdb27ac4..5c96fb255 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -51,6 +51,7 @@ extern "C" {
#include <stdarg.h>
#include <math.h>
#include <limits.h>
+#include <dlfcn.h>
#import <Cocoa/Cocoa.h>
@@ -639,9 +640,28 @@ void Fl::remove_timeout(Fl_Timeout_Handler cb, void* data)
*/
- (BOOL)containsGLsubwindow;
- (void)containsGLsubwindow:(BOOL)contains;
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+- (NSPoint)convertBaseToScreen:(NSPoint)aPoint;
+#endif
@end
@implementation FLWindow
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
+- (NSPoint)convertBaseToScreen:(NSPoint)aPoint
+{
+ if (fl_mac_os_version >= 100700) {
+ NSRect r = [self convertRectToScreen:NSMakeRect(aPoint.x, aPoint.y, 0, 0)];
+ return r.origin;
+ }
+ else {
+ // replaces return [super convertBaseToScreen:aPoint] that may trigger a compiler warning
+ typedef NSPoint (*convertIMP)(id, SEL, NSPoint);
+ convertIMP addr = (convertIMP)[NSWindow instanceMethodForSelector:@selector(convertBaseToScreen:)];
+ return addr(self, @selector(convertBaseToScreen:), aPoint);
+ }
+}
+#endif
+
- (FLWindow*)initWithFl_W:(Fl_Window *)flw
contentRect:(NSRect)rect
styleMask:(NSUInteger)windowStyle
@@ -1349,7 +1369,7 @@ static void cocoaMouseHandler(NSEvent *theEvent)
*/
void fl_open_callback(void (*cb)(const char *)) {
fl_open_display();
- [[NSApp delegate] open_cb:cb];
+ [(FLAppDelegate*)[NSApp delegate] open_cb:cb];
}
@implementation FLApplication
@@ -1424,8 +1444,14 @@ void fl_open_display() {
{
Boolean same_psn;
ProcessSerialNumber front_psn;
- i_am_in_front = (!GetFrontProcess( &front_psn ) &&
- !SameProcess( &front_psn, &cur_psn, &same_psn ) && same_psn );
+ //avoid compilation warnings triggered by GetFrontProcess() and SameProcess()
+ void* h = dlopen(NULL, RTLD_LAZY);
+ typedef OSErr (*GetFrontProcess_type)(ProcessSerialNumber*);
+ GetFrontProcess_type GetFrontProcess_ = (GetFrontProcess_type)dlsym(h, "GetFrontProcess");
+ typedef OSErr (*SameProcess_type)(ProcessSerialNumber*, ProcessSerialNumber*, Boolean*);
+ SameProcess_type SameProcess_ = (SameProcess_type)dlsym(h, "SameProcess");
+ i_am_in_front = (!GetFrontProcess_( &front_psn ) &&
+ !SameProcess_( &front_psn, &cur_psn, &same_psn ) && same_psn );
}
if (!i_am_in_front) {
// only transform the application type for unbundled apps
@@ -2311,7 +2337,7 @@ static void cocoaKeyboardHandler(NSEvent *theEvent)
}
// Convert the rect to screen coordinates
glyphRect.origin.y = wfocus->h() - glyphRect.origin.y;
- glyphRect.origin = [[self window] convertBaseToScreen:glyphRect.origin];
+ glyphRect.origin = [(FLWindow*)[self window] convertBaseToScreen:glyphRect.origin];
if (actualRange) *actualRange = aRange;
fl_unlock_function();
return glyphRect;
@@ -3845,7 +3871,6 @@ void Fl_Paged_Device::print_window(Fl_Window *win, int x_offset, int y_offset)
this->print_widget(win, x_offset, y_offset + bt); // print the window inner part
}
-#include <dlfcn.h>
/* Returns the address of a Carbon function after dynamically loading the Carbon library if needed.
Supports old Mac OS X versions that may use a couple of Carbon calls:
diff --git a/src/fl_diamond_box.cxx b/src/fl_diamond_box.cxx
index bc85b64f8..9aa3aad88 100644
--- a/src/fl_diamond_box.cxx
+++ b/src/fl_diamond_box.cxx
@@ -34,13 +34,13 @@ static void fl_diamond_up_box(int x,int y,int w,int h,Fl_Color bgcolor) {
int y1 = y+h/2;
fl_color(bgcolor); fl_polygon(x+3, y1, x1,y+3, x+w-3,y1, x1,y+h-3);
const uchar *g = fl_gray_ramp();
- fl_color(g['W']); fl_line(x+1, y1, x1, y+1, x+w-1, y1);
- fl_color(g['U']); fl_line(x+2, y1, x1, y+2, x+w-2, y1);
- fl_color(g['S']); fl_line(x+3, y1, x1, y+3, x+w-3, y1);
- fl_color(g['P']); fl_line(x+3, y1, x1, y+h-3, x+w-3, y1);
- fl_color(g['N']); fl_line(x+2, y1, x1, y+h-2, x+w-2, y1);
- fl_color(g['H']); fl_line(x+1, y1, x1, y+h-1, x+w-1, y1);
- fl_color(g['A']); fl_loop(x, y1, x1, y, x+w, y1, x1, y+h);
+ fl_color(g[(int)'W']); fl_line(x+1, y1, x1, y+1, x+w-1, y1);
+ fl_color(g[(int)'U']); fl_line(x+2, y1, x1, y+2, x+w-2, y1);
+ fl_color(g[(int)'S']); fl_line(x+3, y1, x1, y+3, x+w-3, y1);
+ fl_color(g[(int)'P']); fl_line(x+3, y1, x1, y+h-3, x+w-3, y1);
+ fl_color(g[(int)'N']); fl_line(x+2, y1, x1, y+h-2, x+w-2, y1);
+ fl_color(g[(int)'H']); fl_line(x+1, y1, x1, y+h-1, x+w-1, y1);
+ fl_color(g[(int)'A']); fl_loop(x, y1, x1, y, x+w, y1, x1, y+h);
}
static void fl_diamond_down_box(int x,int y,int w,int h,Fl_Color bgcolor) {
@@ -49,14 +49,14 @@ static void fl_diamond_down_box(int x,int y,int w,int h,Fl_Color bgcolor) {
int x1 = x+w/2;
int y1 = y+h/2;
const uchar *g = fl_gray_ramp();
- fl_color(g['P']); fl_line(x+0, y1, x1, y+0, x+w-0, y1);
- fl_color(g['N']); fl_line(x+1, y1, x1, y+1, x+w-1, y1);
- fl_color(g['H']); fl_line(x+2, y1, x1, y+2, x+w-2, y1);
- fl_color(g['W']); fl_line(x+2, y1, x1, y+h-2, x+w-2, y1);
- fl_color(g['U']); fl_line(x+1, y1, x1, y+h-1, x+w-1, y1);
- fl_color(g['S']); fl_line(x+0, y1, x1, y+h-0, x+w-0, y1);
+ fl_color(g[(int)'P']); fl_line(x+0, y1, x1, y+0, x+w-0, y1);
+ fl_color(g[(int)'N']); fl_line(x+1, y1, x1, y+1, x+w-1, y1);
+ fl_color(g[(int)'H']); fl_line(x+2, y1, x1, y+2, x+w-2, y1);
+ fl_color(g[(int)'W']); fl_line(x+2, y1, x1, y+h-2, x+w-2, y1);
+ fl_color(g[(int)'U']); fl_line(x+1, y1, x1, y+h-1, x+w-1, y1);
+ fl_color(g[(int)'S']); fl_line(x+0, y1, x1, y+h-0, x+w-0, y1);
fl_color(bgcolor); fl_polygon(x+3, y1, x1,y+3, x+w-3,y1, x1,y+h-3);
- fl_color(g['A']); fl_loop(x+3, y1, x1, y+3, x+w-3, y1, x1, y+h-3);
+ fl_color(g[(int)'A']); fl_loop(x+3, y1, x1, y+3, x+w-3, y1, x1, y+h-3);
}
extern void fl_internal_boxtype(Fl_Boxtype, Fl_Box_Draw_F*);