STR #1310: OS X Quartz support fixed. All test codes now work without complaints fro Quickdraw or CoreGraphics. If no more major bugs are reported for Quartz, I will make Quartz the default over Quickdraw in the next release of FLTK 1.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5178 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
587e1d170b
commit
30786c2ed3
1
CHANGES
1
CHANGES
@ -1,5 +1,6 @@
|
|||||||
CHANGES IN FLTK 1.1.8
|
CHANGES IN FLTK 1.1.8
|
||||||
|
|
||||||
|
- Many OS X Quartz fixes (STR #1310, etc.)
|
||||||
- Fixed shortcut and default focus for message
|
- Fixed shortcut and default focus for message
|
||||||
dialogs (STR #1298)
|
dialogs (STR #1298)
|
||||||
- Fixed focus issues (STR #1286, STR #1289, STR #1296)
|
- Fixed focus issues (STR #1286, STR #1289, STR #1296)
|
||||||
|
@ -219,12 +219,19 @@ void fl_delete_offscreen(Fl_Offscreen ctx) {
|
|||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static CGContextRef prev_gc = 0;
|
const int stack_max = 16;
|
||||||
static Window prev_window = 0;
|
static int stack_ix = 0;
|
||||||
|
static CGContextRef stack_gc[stack_max];
|
||||||
|
static Window stack_window[stack_max];
|
||||||
|
|
||||||
void fl_begin_offscreen(Fl_Offscreen ctx) {
|
void fl_begin_offscreen(Fl_Offscreen ctx) {
|
||||||
prev_gc = fl_gc;
|
if (stack_ix<stack_max) {
|
||||||
prev_window = fl_window;
|
stack_gc[stack_ix] = fl_gc;
|
||||||
|
stack_window[stack_ix] = fl_window;
|
||||||
|
} else
|
||||||
|
fprintf(stderr, "FLTK CGContext Stack overflow error\n");
|
||||||
|
stack_ix++;
|
||||||
|
|
||||||
fl_gc = (CGContextRef)ctx;
|
fl_gc = (CGContextRef)ctx;
|
||||||
fl_window = 0;
|
fl_window = 0;
|
||||||
//fl_push_no_clip();
|
//fl_push_no_clip();
|
||||||
@ -235,8 +242,14 @@ void fl_begin_offscreen(Fl_Offscreen ctx) {
|
|||||||
void fl_end_offscreen() {
|
void fl_end_offscreen() {
|
||||||
Fl_X::q_release_context();
|
Fl_X::q_release_context();
|
||||||
//fl_pop_clip();
|
//fl_pop_clip();
|
||||||
fl_gc = prev_gc;
|
if (stack_ix>0)
|
||||||
fl_window = prev_window;
|
stack_ix--;
|
||||||
|
else
|
||||||
|
fprintf(stderr, "FLTK CGContext Stack underflow error\n");
|
||||||
|
if (stack_ix<stack_max) {
|
||||||
|
fl_gc = stack_gc[stack_ix];
|
||||||
|
fl_window = stack_window[stack_ix];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void fl_restore_clip();
|
extern void fl_restore_clip();
|
||||||
|
@ -2032,6 +2032,7 @@ void Fl_Window::resize(int X,int Y,int W,int H) {
|
|||||||
void Fl_Window::make_current()
|
void Fl_Window::make_current()
|
||||||
{
|
{
|
||||||
#ifdef __APPLE_QUARTZ__
|
#ifdef __APPLE_QUARTZ__
|
||||||
|
OSStatus err;
|
||||||
Fl_X::q_release_context();
|
Fl_X::q_release_context();
|
||||||
#endif
|
#endif
|
||||||
if ( !fl_window_region )
|
if ( !fl_window_region )
|
||||||
@ -2068,7 +2069,9 @@ void Fl_Window::make_current()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __APPLE_QUARTZ__
|
#ifdef __APPLE_QUARTZ__
|
||||||
QDBeginCGContext(GetWindowPort(i->xid), &i->gc);
|
err = QDBeginCGContext(GetWindowPort(i->xid), &i->gc);
|
||||||
|
if (err!=noErr)
|
||||||
|
fprintf(stderr, "Error %d in QDBeginCGContext\n", (int)err);
|
||||||
fl_gc = i->gc;
|
fl_gc = i->gc;
|
||||||
CGContextSaveGState(fl_gc);
|
CGContextSaveGState(fl_gc);
|
||||||
Fl_X::q_fill_context();
|
Fl_X::q_fill_context();
|
||||||
@ -2117,7 +2120,11 @@ void Fl_X::q_release_context(Fl_X *x) {
|
|||||||
if (x && x->gc!=fl_gc) return;
|
if (x && x->gc!=fl_gc) return;
|
||||||
if (!fl_gc) return;
|
if (!fl_gc) return;
|
||||||
CGContextRestoreGState(fl_gc);
|
CGContextRestoreGState(fl_gc);
|
||||||
if (fl_window) QDEndCGContext(GetWindowPort(fl_window), &fl_gc);
|
if (fl_window) {
|
||||||
|
OSStatus err = QDEndCGContext(GetWindowPort(fl_window), &fl_gc);
|
||||||
|
if (err!=noErr)
|
||||||
|
fprintf(stderr, "Error %d in QDEndCGContext\n", (int)err);
|
||||||
|
}
|
||||||
fl_gc = 0;
|
fl_gc = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,6 +83,18 @@
|
|||||||
//+StrokePath
|
//+StrokePath
|
||||||
//+TranslateCTM
|
//+TranslateCTM
|
||||||
|
|
||||||
|
inline OSStatus dbgLocation(const char *file, int line)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "%s:%d ", file, line);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline OSStatus dbgEndl()
|
||||||
|
{
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void dbgCGContextClipToRect(CGContextRef a, CGRect b)
|
inline void dbgCGContextClipToRect(CGContextRef a, CGRect b)
|
||||||
{
|
{
|
||||||
@ -109,20 +121,20 @@ inline OSStatus dbgQDEndCGContext(CGrafPtr a, CGContextRef *b)
|
|||||||
return QDEndCGContext(a, b);
|
return QDEndCGContext(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define QDEndCGContext(a, b) { \
|
#define QDEndCGContext(a, b) ( \
|
||||||
fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
|
dbgLocation(__FILE__, __LINE__) + \
|
||||||
dbgQDEndCGContext(a, b); \
|
dbgQDEndCGContext(a, b) + \
|
||||||
fprintf(stderr, "\n"); }
|
dbgEndl() )
|
||||||
|
|
||||||
inline OSStatus dbgQDBeginCGContext(CGrafPtr a, CGContextRef *b)
|
inline OSStatus dbgQDBeginCGContext(CGrafPtr a, CGContextRef *b)
|
||||||
{
|
{
|
||||||
return QDBeginCGContext(a, b);
|
return QDBeginCGContext(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define QDBeginCGContext(a, b) { \
|
#define QDBeginCGContext(a, b) ( \
|
||||||
fprintf(stderr, "%s:%d ", __FILE__, __LINE__); \
|
dbgLocation(__FILE__, __LINE__) + \
|
||||||
dbgQDBeginCGContext(a, b); \
|
dbgQDBeginCGContext(a, b) + \
|
||||||
fprintf(stderr, "\n"); }
|
dbgEndl() )
|
||||||
|
|
||||||
inline void dbgClipCGContextToRegion(CGContextRef a, const Rect *b, RgnHandle c)
|
inline void dbgClipCGContextToRegion(CGContextRef a, const Rect *b, RgnHandle c)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user