Skip to content

Commit

Permalink
Fl::clipboard_contains(): handle now properly the case when there's n…
Browse files Browse the repository at this point in the history
…othing in the clipboard.

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10176 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Manolo Gouy authored and Manolo Gouy committed May 29, 2014
1 parent 67f3c4c commit 44c2ca6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Fl_x.cxx
Expand Up @@ -814,11 +814,14 @@ int Fl::clipboard_contains(const char *type)
unsigned char* portion = NULL;
Fl_Window *win = Fl::first_window();
if (!win || !fl_xid(win)) return 0;
XConvertSelection(fl_display, CLIPBOARD, TARGETS, CLIPBOARD,
fl_xid(win), fl_event_time);
XConvertSelection(fl_display, CLIPBOARD, TARGETS, CLIPBOARD, fl_xid(win), CurrentTime);
XFlush(fl_display);
do { XNextEvent(fl_display, &event); i++; }
while (i < 10 && (event.type != SelectionNotify || event.xselection.property == None));
do {
XNextEvent(fl_display, &event);
if (event.type == SelectionNotify && event.xselection.property == None) return 0;
i++;
}
while (i < 10 && event.type != SelectionNotify);
if (i >= 10) return 0;
XGetWindowProperty(fl_display,
event.xselection.requestor,
Expand Down

0 comments on commit 44c2ca6

Please sign in to comment.