diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl_Window.cxx | 8 | ||||
| -rw-r--r-- | src/Fl_Window_Driver.cxx | 1 | ||||
| -rw-r--r-- | src/Fl_cocoa.mm | 14 | ||||
| -rw-r--r-- | src/Fl_win32.cxx | 19 | ||||
| -rw-r--r-- | src/Fl_x.cxx | 18 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx | 20 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Window_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Window_Driver.cxx | 21 |
10 files changed, 56 insertions, 48 deletions
diff --git a/src/Fl_Window.cxx b/src/Fl_Window.cxx index 85075b4b3..1fa27f928 100644 --- a/src/Fl_Window.cxx +++ b/src/Fl_Window.cxx @@ -32,6 +32,8 @@ char *Fl_Window::default_xclass_ = 0L; +Fl_Window *Fl_Window::current_; + void Fl_Window::_Fl_Window() { cursor_default = FL_CURSOR_DEFAULT; type(FL_WINDOW); @@ -479,7 +481,11 @@ void Fl_Window::draw() # endif } - +void Fl_Window::make_current() +{ + pWindowDriver->make_current(); + current_ = this; +} // // End of "$Id$". diff --git a/src/Fl_Window_Driver.cxx b/src/Fl_Window_Driver.cxx index 190822214..8d74ec832 100644 --- a/src/Fl_Window_Driver.cxx +++ b/src/Fl_Window_Driver.cxx @@ -42,6 +42,7 @@ unsigned char Fl_Window_Driver::size_range_set() {return pWindow->size_range_set void Fl_Window_Driver::flush_single() { pWindow->Fl_Window::flush(); } void Fl_Window_Driver::draw() { pWindow->draw(); } +void Fl_Window_Driver::make_current() { } void Fl_Window_Driver::take_focus() diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 40d984f0a..7ee2877b6 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -94,7 +94,6 @@ void *fl_capture = 0; // (NSWindow*) we need this to compensate for a missing( bool fl_show_iconic; // true if called from iconize() - shows the next created window in collapsed state //int fl_disable_transient_for; // secret method of removing TRANSIENT_FOR Window fl_window; -Fl_Window *Fl_Window::current_; // forward declarations of variables in this file static int got_events = 0; @@ -3266,14 +3265,14 @@ void Fl_Window::resize(int X,int Y,int W,int H) { Subsequent drawing requests go to this window. CAUTION: it's not possible to call Fl::wait(), Fl::check() nor Fl::ready() while in the draw() function of a widget. Use an idle callback instead. */ -void Fl_Window::make_current() +void Fl_Cocoa_Window_Driver::make_current() { if (make_current_counts > 1) return; if (make_current_counts) make_current_counts++; Fl_X::q_release_context(); + Fl_X *i = Fl_X::i(pWindow); fl_window = i->xid; Fl_X::set_high_resolution( i->mapped_to_retina() ); - current_ = this; NSGraphicsContext *nsgc; #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 @@ -3299,13 +3298,13 @@ void Fl_Window::make_current() // this is the context with origin at top left of (sub)window CGContextSaveGState(i->gc); #if defined(FLTK_USE_CAIRO) - if (Fl::cairo_autolink_context()) Fl::cairo_make_current(this); // capture gc changes automatically to update the cairo context adequately + if (Fl::cairo_autolink_context()) Fl::cairo_make_current(pWindow); // capture gc changes automatically to update the cairo context adequately #endif fl_clip_region( 0 ); #if defined(FLTK_USE_CAIRO) // update the cairo_t context - if (Fl::cairo_autolink_context()) Fl::cairo_make_current(this); + if (Fl::cairo_autolink_context()) Fl::cairo_make_current(pWindow); #endif } @@ -4274,11 +4273,6 @@ CGImageRef Fl_X::CGImage_from_window_rect(Fl_Window *win, int x, int y, int w, i return img; } -WindowRef Fl_X::window_ref() // useless with cocoa GL windows -{ - return (WindowRef)[xid windowRef]; -} - // so a CGRect matches exactly what is denoted x,y,w,h for clipping purposes CGRect fl_cgrectmake_cocoa(int x, int y, int w, int h) { return CGRectMake(x - 0.5, y - 0.5, w, h); diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index 0caf501f1..ab5465e03 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -2361,7 +2361,6 @@ void Fl_Window::show() { #endif } -Fl_Window *Fl_Window::current_; // the current context // the current window handle, initially set to -1 so we can correctly // allocate fl_GetDC(0) @@ -2385,24 +2384,6 @@ HDC fl_GetDC(HWND w) { return gc; } -// make X drawing go into this window (called by subclass flush() impl.) -void Fl_Window::make_current() { - fl_GetDC(fl_xid(this)); - -#if USE_COLORMAP - // Windows maintains a hardware and software color palette; the - // SelectPalette() call updates the current soft->hard mapping - // for all drawing calls, so we must select it here before any - // code does any drawing... - - fl_select_palette(); -#endif // USE_COLORMAP - - current_ = this; - fl_clip_region(0); - - -} /* Make sure that all allocated fonts are released. This works only if Fl::run() is allowed to exit by closing all windows. Calling 'exit(int)' diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index 6397fd136..ce72367cf 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -2927,24 +2927,6 @@ preparePrintFront(); #endif } -Window fl_window; -Fl_Window *Fl_Window::current_; - -// make X drawing go into this window (called by subclass flush() impl.) -void Fl_Window::make_current() { - if (!shown()) { - fl_alert("Fl_Window::make_current(), but window is not shown()."); - Fl::fatal("Fl_Window::make_current(), but window is not shown()."); - } - fl_window = i->xid; - current_ = this; - fl_clip_region(0); - -#ifdef FLTK_USE_CAIRO - // update the cairo_t context - if (Fl::cairo_autolink_context()) Fl::cairo_make_current(this); -#endif -} FL_EXPORT Window fl_xid_(const Fl_Window *w) { Fl_X *temp = Fl_X::i(w); diff --git a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H index 025d1701a..5414401d0 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H +++ b/src/drivers/Cocoa/Fl_Cocoa_Window_Driver.H @@ -73,6 +73,7 @@ public: virtual void flush_overlay(); virtual void draw_begin(); virtual void draw_end(); + virtual void make_current(); virtual void shape(const Fl_Image* img); // that one is implemented in Fl_Cocoa.mm because it uses Objective-c diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H index 31f3b1db2..c7726d170 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H +++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.H @@ -76,6 +76,7 @@ public: virtual void flush_double(); virtual void flush_overlay(); virtual void draw_begin(); + virtual void make_current(); virtual void shape(const Fl_Image* img); virtual void icons(const Fl_RGB_Image *icons[], int count); diff --git a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx index 1de3046f3..f259b62ac 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx +++ b/src/drivers/WinAPI/Fl_WinAPI_Window_Driver.cxx @@ -29,6 +29,11 @@ #include "Fl_WinAPI_Window_Driver.H" #include <windows.h> +#if USE_COLORMAP +extern HPALETTE fl_select_palette(void); // in fl_color_win32.cxx +#endif + + Fl_Window_Driver *Fl_Window_Driver::newWindowDriver(Fl_Window *w) { return new Fl_WinAPI_Window_Driver(w); @@ -374,6 +379,21 @@ void Fl_WinAPI_Window_Driver::wait_for_expose() { } } + +void Fl_WinAPI_Window_Driver::make_current() { + fl_GetDC(fl_xid(pWindow)); + +#if USE_COLORMAP + // Windows maintains a hardware and software color palette; the + // SelectPalette() call updates the current soft->hard mapping + // for all drawing calls, so we must select it here before any + // code does any drawing... + fl_select_palette(); +#endif // USE_COLORMAP + + fl_graphics_driver->clip_region(0); +} + // // End of "$Id$". // diff --git a/src/drivers/X11/Fl_X11_Window_Driver.H b/src/drivers/X11/Fl_X11_Window_Driver.H index 642d6b72a..61d3d4073 100644 --- a/src/drivers/X11/Fl_X11_Window_Driver.H +++ b/src/drivers/X11/Fl_X11_Window_Driver.H @@ -81,6 +81,7 @@ public: virtual void flush_double(); virtual void flush_overlay(); virtual void draw_begin(); + virtual void make_current(); virtual void shape(const Fl_Image* img); virtual void icons(const Fl_RGB_Image *icons[], int count); diff --git a/src/drivers/X11/Fl_X11_Window_Driver.cxx b/src/drivers/X11/Fl_X11_Window_Driver.cxx index 0b35c8969..2fa295560 100644 --- a/src/drivers/X11/Fl_X11_Window_Driver.cxx +++ b/src/drivers/X11/Fl_X11_Window_Driver.cxx @@ -23,6 +23,7 @@ #include <FL/Fl_Shared_Image.H> #include <FL/Fl_Overlay_Window.H> #include <FL/fl_draw.H> +#include <FL/fl_ask.H> #include <FL/Fl.H> #include <string.h> #if HAVE_DLFCN_H @@ -31,6 +32,9 @@ #define ShapeBounding 0 #define ShapeSet 0 +Window fl_window; + + #if USE_XDBE #include <X11/extensions/Xdbe.h> @@ -422,6 +426,23 @@ void Fl_X11_Window_Driver::wait_for_expose() { } } + +// make X drawing go into this window (called by subclass flush() impl.) +void Fl_X11_Window_Driver::make_current() { + if (!pWindow->shown()) { + fl_alert("Fl_Window::make_current(), but window is not shown()."); + Fl::fatal("Fl_Window::make_current(), but window is not shown()."); + } + fl_window = fl_xid(pWindow); + fl_graphics_driver->clip_region(0); + +#ifdef FLTK_USE_CAIRO + // update the cairo_t context + if (Fl::cairo_autolink_context()) Fl::cairo_make_current(pWindow); +#endif +} + + // // End of "$Id$". // |
