summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2015-02-13 07:41:59 +0000
committerManolo Gouy <Manolo>2015-02-13 07:41:59 +0000
commit2633a887b75a55cb714fbb31f4f171321601130a (patch)
tree0d0e81fa1d015d8f55bcb98f044a92b96eb4eaab /src
parent5b801eae16415b041c1e1a8f98ee2b83bd0a092c (diff)
Mac OS: more accurate way to determine the screen where the paste operation occurs.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10574 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_cocoa.mm7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Fl_cocoa.mm b/src/Fl_cocoa.mm
index 0e4ab5b80..29f871800 100644
--- a/src/Fl_cocoa.mm
+++ b/src/Fl_cocoa.mm
@@ -3484,7 +3484,7 @@ static int get_plain_text_from_clipboard(char **buffer, int previous_length)
return length;
}
-static Fl_Image* get_image_from_clipboard()
+static Fl_Image* get_image_from_clipboard(Fl_Widget *receiver)
{
Fl_RGB_Image *image = NULL;
uchar *imagedata;
@@ -3523,7 +3523,8 @@ after_loop:
if ([found isEqualToString:@"com.adobe.pdf"] ) {
vectorial = [NSPDFImageRep imageRepWithData:data];
rect = [(NSPDFImageRep*)vectorial bounds]; // in points = 1/72 inch
- Fl_Window *win = Fl::first_window();
+ Fl_Window *win = receiver->top_window();
+ if (!win) win = Fl::first_window();
int screen_num = win ? Fl::screen_num(win->x(), win->y(), win->w(), win->h()) : 0;
float hr, vr;
Fl::screen_dpi(hr, vr, screen_num); // 1 inch = hr pixels = 72 points -> hr/72 pixel/point
@@ -3575,7 +3576,7 @@ void Fl::paste(Fl_Widget &receiver, int clipboard, const char *type) {
fl_selection_length[1] = get_plain_text_from_clipboard( &fl_selection_buffer[1], fl_selection_length[1]);
}
else if (strcmp(type, Fl::clipboard_image) == 0) {
- Fl::e_clipboard_data = get_image_from_clipboard( );
+ Fl::e_clipboard_data = get_image_from_clipboard(&receiver);
if (Fl::e_clipboard_data) {
int done = receiver.handle(FL_PASTE);
Fl::e_clipboard_type = "";