summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2014-05-29 15:28:04 +0000
committerManolo Gouy <Manolo>2014-05-29 15:28:04 +0000
commit44c2ca6521cfdbd4a2d674411fcc3167537a9c68 (patch)
tree3f8737bc85e91c2265144996d08905373668f9b3
parent67f3c4cc828806d1668abc8b3ae3d883c23a63ab (diff)
Fl::clipboard_contains(): handle now properly the case when there's nothing in the clipboard.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10176 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--src/Fl_x.cxx11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index 6df61e150..821e1612a 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -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,