diff options
| -rw-r--r-- | FL/Fl.H | 2 | ||||
| -rw-r--r-- | FL/Fl_Screen_Driver.H | 2 | ||||
| -rw-r--r-- | FL/Fl_System_Driver.H | 4 | ||||
| -rw-r--r-- | FL/mac.H | 1 | ||||
| -rw-r--r-- | src/Fl.cxx | 12 | ||||
| -rw-r--r-- | src/Fl_Screen_Driver.cxx | 4 | ||||
| -rw-r--r-- | src/Fl_cocoa.mm | 12 | ||||
| -rw-r--r-- | src/Fl_win32.cxx | 10 | ||||
| -rw-r--r-- | src/Fl_x.cxx | 7 | ||||
| -rw-r--r-- | src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/Darwin/Fl_Darwin_System_Driver.H | 2 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/WinAPI/Fl_WinAPI_System_Driver.H | 4 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_Screen_Driver.H | 1 | ||||
| -rw-r--r-- | src/drivers/X11/Fl_X11_System_Driver.H | 4 |
15 files changed, 49 insertions, 18 deletions
@@ -663,7 +663,7 @@ int main() { position your first window). If the display is not open, this will open it. */ - static void get_mouse(int &,int &); // platform dependent + static void get_mouse(int &,int &); /** Returns non zero if we had a double click event. \retval Non-zero if the most recent FL_PUSH or FL_KEYBOARD was a "double click". diff --git a/FL/Fl_Screen_Driver.H b/FL/Fl_Screen_Driver.H index 22eda6095..f1bee4bc9 100644 --- a/FL/Fl_Screen_Driver.H +++ b/FL/Fl_Screen_Driver.H @@ -133,6 +133,8 @@ public: // optional platform-specific key handling for Fl_Input widget // the default implementation may be enough virtual int input_widget_handle_key(int key, unsigned mods, unsigned shift, Fl_Input *input); + // implement to support Fl::get_mouse() + virtual void get_mouse(int &x, int &y) {} }; diff --git a/FL/Fl_System_Driver.H b/FL/Fl_System_Driver.H index 028802c58..0c1ff5b90 100644 --- a/FL/Fl_System_Driver.H +++ b/FL/Fl_System_Driver.H @@ -122,6 +122,8 @@ public: virtual int filename_isdir_quick(const char* n); // the default implementation of filename_ext() is in src/filename_ext.cxx and may be enough virtual const char *filename_ext(const char *buf); + // implement to support fl_filename_name() + virtual const char *filename_name(const char *buf) {return buf;} // whether a platform uses additional code in Fl_Menu::handle(int e) virtual int need_menu_handle_part2() {return 0;} // whether a platform uses additional code in Fl_Menu::handle_part1(int e) @@ -191,6 +193,8 @@ public: static const char * const tree_close_xpm[]; // used by tree_closepixmap() // the default implementation of tree_connector_style() is in Fl_Tree_Prefs.cxx and can be enough virtual int tree_connector_style(); + //implement to support copy-to-clipboard + virtual void copy(const char *stuff, int len, int clipboard, const char *type) {} }; #endif // FL_SYSTEM_DRIVER_H @@ -165,7 +165,6 @@ public: int set_cursor(const Fl_RGB_Image*, int, int); static CGImageRef CGImage_from_window_rect(Fl_Window *win, int x, int y, int w, int h); static unsigned char *bitmap_from_window_rect(Fl_Window *win, int x, int y, int w, int h, int *bytesPerPixel); - static void clip_to_rounded_corners(CGContextRef gc, int w, int h); private: CGRect* subRect_; // makes sure subwindow remains inside its parent window // stores 3 binary flags: whether window is mapped to retina display; whether resolution just changed; diff --git a/src/Fl.cxx b/src/Fl.cxx index bdd68d9f9..9a4dda794 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -1920,6 +1920,18 @@ int Fl::get_key(int k) { return system_driver()->get_key(k); } +void Fl::get_mouse(int &x, int &y) { + Fl::screen_driver()->get_mouse(x, y); +} + +const char * fl_filename_name(const char *name) { + return Fl::system_driver()->filename_name(name); +} + +void Fl::copy(const char *stuff, int len, int clipboard, const char *type) { + Fl::system_driver()->copy(stuff, len, clipboard, type); +} + // // End of "$Id$". // diff --git a/src/Fl_Screen_Driver.cxx b/src/Fl_Screen_Driver.cxx index bba7d8cf7..1b4a3be1f 100644 --- a/src/Fl_Screen_Driver.cxx +++ b/src/Fl_Screen_Driver.cxx @@ -53,7 +53,7 @@ int Fl_Screen_Driver::visual(int) { void Fl_Screen_Driver::screen_xywh(int &X, int &Y, int &W, int &H) { int x, y; - Fl::get_mouse(x, y); + get_mouse(x, y); screen_xywh(X, Y, W, H, x, y); } @@ -67,7 +67,7 @@ void Fl_Screen_Driver::screen_xywh(int &X, int &Y, int &W, int &H, int mx, int m void Fl_Screen_Driver::screen_work_area(int &X, int &Y, int &W, int &H) { int x, y; - Fl::get_mouse(x, y); + get_mouse(x, y); screen_work_area(X, Y, W, H, x, y); } diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm index 9720977e3..dfc28741f 100644 --- a/src/Fl_cocoa.mm +++ b/src/Fl_cocoa.mm @@ -1920,7 +1920,7 @@ void Fl_Cocoa_Screen_Driver::screen_work_area(int &X, int &Y, int &W, int &H, in /* * get the current mouse pointer world coordinates */ -void Fl::get_mouse(int &x, int &y) +void Fl_Cocoa_Screen_Driver::get_mouse(int &x, int &y) { fl_open_display(); NSPoint pt = [NSEvent mouseLocation]; @@ -3114,7 +3114,7 @@ void Fl_Cocoa_Window_Driver::wait_for_expose() /* * returns pointer to the filename, or null if name ends with ':' */ -const char *fl_filename_name( const char *name ) +const char *Fl_Darwin_System_Driver::filename_name( const char *name ) { const char *p, *q; if (!name) return (0); @@ -3379,7 +3379,7 @@ static void resize_selection_buffer(int len, int clipboard) { * len: size of selected data * type: always "plain/text" for now */ -void Fl::copy(const char *stuff, int len, int clipboard, const char *type) { +void Fl_Darwin_System_Driver::copy(const char *stuff, int len, int clipboard, const char *type) { if (!stuff || len<0) return; if (clipboard >= 2) clipboard = 1; // Only on X11 do multiple clipboards make sense. @@ -4268,7 +4268,7 @@ int Fl_Cocoa_Window_Driver::decorated_h() } // clip the graphics context to rounded corners -void Fl_X::clip_to_rounded_corners(CGContextRef gc, int w, int h) { +static void clip_to_rounded_corners(CGContextRef gc, int w, int h) { const CGFloat radius = 5; CGContextMoveToPoint(gc, 0, 0); CGContextAddLineToPoint(gc, 0, h - radius); @@ -4294,7 +4294,7 @@ void Fl_Cocoa_Window_Driver::draw_layer_to_context(CALayer *layer, CGContextRef { #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 CGContextSaveGState(gc); - Fl_X::clip_to_rounded_corners(gc, w, h); + clip_to_rounded_corners(gc, w, h); CGContextSetRGBFillColor(gc, .79, .79, .79, 1.); // equiv. to FL_DARK1 CGContextFillRect(gc, CGRectMake(0, 0, w, h)); CGContextSetShouldAntialias(gc, true); @@ -4322,7 +4322,7 @@ void Fl_Cocoa_Window_Driver::capture_titlebar_and_borders(Fl_Shared_Image*& top, } else { CGImageRef img = Fl_X::CGImage_from_window_rect(pWindow, 0, -htop, w(), htop); CGContextSaveGState(auxgc); - Fl_X::clip_to_rounded_corners(auxgc, w(), htop); + clip_to_rounded_corners(auxgc, w(), htop); CGContextDrawImage(auxgc, CGRectMake(0, 0, w(), htop), img); CGContextRestoreGState(auxgc); CFRelease(img); diff --git a/src/Fl_win32.cxx b/src/Fl_win32.cxx index 9a2e8ffb0..974d2e22d 100644 --- a/src/Fl_win32.cxx +++ b/src/Fl_win32.cxx @@ -55,6 +55,7 @@ void fl_cleanup_dc_list(void); #include <FL/Fl_Graphics_Driver.H> // for fl_graphics_driver #include "drivers/WinAPI/Fl_WinAPI_Window_Driver.H" #include "drivers/WinAPI/Fl_WinAPI_System_Driver.H" +#include "drivers/WinAPI/Fl_WinAPI_Screen_Driver.H" #include <FL/fl_utf8.h> #include <FL/Fl_Window.H> #include <FL/fl_draw.H> @@ -573,7 +574,7 @@ void Fl::disable_im() { //////////////////////////////////////////////////////////////// -void Fl::get_mouse(int &x, int &y) { +void Fl_WinAPI_Screen_Driver::get_mouse(int &x, int &y) { POINT p; GetCursorPos(&p); x = p.x; @@ -666,7 +667,7 @@ void fl_update_clipboard(void) { } // call this when you create a selection: -void Fl::copy(const char *stuff, int len, int clipboard, const char *type) { +void Fl_WinAPI_System_Driver::copy(const char *stuff, int len, int clipboard, const char *type) { if (!stuff || len<0) return; if (clipboard >= 2) clipboard = 1; // Only on X11 do multiple clipboards make sense. @@ -1928,12 +1929,11 @@ void Fl_X::set_minmax(LPMINMAXINFO minmax) } } -//////////////////////////////////////////////////////////////// -#include <FL/filename.H> // need so FL_EXPORT fl_filename_name works +//////////////////////////////////////////////////////////////// // returns pointer to the filename, or null if name ends with '/' -const char *fl_filename_name(const char *name) { +const char *Fl_WinAPI_System_Driver::filename_name(const char *name) { const char *p,*q; if (!name) return (0); q = name; diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index 387459f6b..3c7245efc 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -39,6 +39,7 @@ # include "flstring.h" # include "drivers/X11/Fl_X11_Screen_Driver.H" # include "drivers/X11/Fl_X11_Window_Driver.H" +# include "drivers/X11/Fl_X11_System_Driver.H" # include <unistd.h> # include <time.h> # include <sys/time.h> @@ -787,7 +788,7 @@ void fl_close_display() { } -void Fl::get_mouse(int &xx, int &yy) { +void Fl_X11_Screen_Driver::get_mouse(int &xx, int &yy) { fl_open_display(); Window root = RootWindow(fl_display, fl_screen); Window c; int mx,my,cx,cy; unsigned int mask; @@ -940,7 +941,7 @@ static int get_xwinprop(Window wnd, Atom prop, long max_length, //////////////////////////////////////////////////////////////// // Code for copying to clipboard and DnD out of the program: -void Fl::copy(const char *stuff, int len, int clipboard, const char *type) { +void Fl_X11_System_Driver::copy(const char *stuff, int len, int clipboard, const char *type) { if (!stuff || len<0) return; if (clipboard >= 2) { @@ -2844,7 +2845,7 @@ int Fl_X::set_cursor(const Fl_RGB_Image *image, int hotx, int hoty) { //////////////////////////////////////////////////////////////// // returns pointer to the filename, or null if name ends with '/' -const char *fl_filename_name(const char *name) { +const char *Fl_X11_System_Driver::filename_name(const char *name) { const char *p,*q; if (!name) return (0); for (p=q=name; *p;) if (*p++ == '/') q = p; diff --git a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H index 23e123e9c..b64cf91b2 100644 --- a/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H +++ b/src/drivers/Cocoa/Fl_Cocoa_Screen_Driver.H @@ -90,6 +90,7 @@ public: virtual int compose(int &del); virtual uchar *read_image(uchar *p, int x, int y, int w, int h, int alpha); virtual int input_widget_handle_key(int key, unsigned mods, unsigned shift, Fl_Input *input); + virtual void get_mouse(int &x, int &y); }; diff --git a/src/drivers/Darwin/Fl_Darwin_System_Driver.H b/src/drivers/Darwin/Fl_Darwin_System_Driver.H index 7a7651898..9f9f7f5b0 100644 --- a/src/drivers/Darwin/Fl_Darwin_System_Driver.H +++ b/src/drivers/Darwin/Fl_Darwin_System_Driver.H @@ -68,6 +68,8 @@ public: virtual Fl_Pixmap *tree_closepixmap(); static const char * const tree_close_xpm_darwin[]; // used by tree_closepixmap() virtual int tree_connector_style(); + virtual const char *filename_name(const char *buf); + virtual void copy(const char *stuff, int len, int clipboard, const char *type); }; #endif // FL_DARWIN_SYSTEM_DRIVER_H diff --git a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H index a8c530fbe..b24045433 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H +++ b/src/drivers/WinAPI/Fl_WinAPI_Screen_Driver.H @@ -72,6 +72,7 @@ public: virtual int dnd(int unused); virtual int compose(int &del); virtual uchar *read_win_rectangle(uchar *p, int X, int Y, int w, int h, int alpha); + virtual void get_mouse(int &x, int &y); }; diff --git a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H index 67c2e8b73..d544b239c 100644 --- a/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H +++ b/src/drivers/WinAPI/Fl_WinAPI_System_Driver.H @@ -102,6 +102,10 @@ public: virtual int backslash_as_slash() {return 1;} virtual int colon_is_drive() {return 1;} virtual int case_insensitive_filenames() {return 1;} + // this one is implemented in Fl_win32.cxx + virtual const char *filename_name(const char *buf); + // this one is in Fl_win32.cxx + virtual void copy(const char *stuff, int len, int clipboard, const char *type); }; #endif // FL_WINAPI_SYSTEM_DRIVER_H diff --git a/src/drivers/X11/Fl_X11_Screen_Driver.H b/src/drivers/X11/Fl_X11_Screen_Driver.H index f639fd6cb..72f4358b2 100644 --- a/src/drivers/X11/Fl_X11_Screen_Driver.H +++ b/src/drivers/X11/Fl_X11_Screen_Driver.H @@ -78,6 +78,7 @@ public: virtual void compose_reset(); virtual int text_display_can_leak(); virtual uchar *read_win_rectangle(uchar *p, int X, int Y, int w, int h, int alpha); + virtual void get_mouse(int &x, int &y); }; diff --git a/src/drivers/X11/Fl_X11_System_Driver.H b/src/drivers/X11/Fl_X11_System_Driver.H index dc97c5f99..b6e87922d 100644 --- a/src/drivers/X11/Fl_X11_System_Driver.H +++ b/src/drivers/X11/Fl_X11_System_Driver.H @@ -45,6 +45,10 @@ public: virtual int utf8locale(); // this one is in Fl_own_colormap.cxx virtual void own_colormap(); + // this one is in Fl_x.cxx + virtual const char *filename_name(const char *buf); + // this one is in Fl_x.cxx + virtual void copy(const char *stuff, int len, int clipboard, const char *type); }; #endif /* FL_X11_SYSTEM_DRIVER_H */ |
