You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

01-str2636-fltk-1.3.x-clipboard.patch 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. diff -up fltk-1.3.x-r8659/FL/Fl.H.orig fltk-1.3.x-r8659/FL/Fl.H
  2. --- fltk-1.3.x-r8659/FL/Fl.H.orig 2011-05-17 16:25:56.671744548 +0200
  3. +++ fltk-1.3.x-r8659/FL/Fl.H 2011-05-17 16:26:05.709101536 +0200
  4. @@ -108,6 +108,9 @@ typedef int (*Fl_Args_Handler)(int argc,
  5. \see Fl::event_dispatch(Fl_Event_Dispatch) */
  6. typedef int (*Fl_Event_Dispatch)(int event, Fl_Window *w);
  7. +/** Signature of add_clipboard_notify functions passed as parameters */
  8. +typedef void (*Fl_Clipboard_Notify_Handler)(int source, void *data);
  9. +
  10. /** @} */ /* group callback_functions */
  11. @@ -744,6 +747,19 @@ public:
  12. */
  13. static void paste(Fl_Widget &receiver, int source /*=0*/); // platform dependent
  14. /**
  15. + FLTK will call the registered callback whenever there is a change to the
  16. + selection buffer or the clipboard. The source argument indicates which
  17. + of the two has changed. Only changes by other applications are reported.
  18. + \note Some systems require polling to monitor the clipboard and may
  19. + therefore have some delay in detecting changes.
  20. + */
  21. + static void add_clipboard_notify(Fl_Clipboard_Notify_Handler h, void *data);
  22. + /**
  23. + Stop calling the specified callback when there are changes to the selection
  24. + buffer or the clipboard.
  25. + */
  26. + static void remove_clipboard_notify(Fl_Clipboard_Notify_Handler h);
  27. + /**
  28. Initiate a Drag And Drop operation. The selection buffer should be
  29. filled with relevant data before calling this method. FLTK will
  30. then initiate the system wide drag and drop handling. Dropped data
  31. diff -up fltk-1.3.x-r8659/src/Fl.cxx.orig fltk-1.3.x-r8659/src/Fl.cxx
  32. --- fltk-1.3.x-r8659/src/Fl.cxx.orig 2011-05-18 15:20:26.667291459 +0200
  33. +++ fltk-1.3.x-r8659/src/Fl.cxx 2011-05-18 16:31:15.522026086 +0200
  34. @@ -430,6 +430,69 @@ static char in_idle;
  35. #endif
  36. ////////////////////////////////////////////////////////////////
  37. +// Clipboard notifications
  38. +
  39. +struct Clipboard_Notify {
  40. + Fl_Clipboard_Notify_Handler handler;
  41. + void *data;
  42. + struct Clipboard_Notify *next;
  43. +};
  44. +
  45. +static struct Clipboard_Notify *clip_notify_list = NULL;
  46. +
  47. +extern void fl_clipboard_notify_change(); // in Fl_<platform>.cxx
  48. +
  49. +void Fl::add_clipboard_notify(Fl_Clipboard_Notify_Handler h, void *data) {
  50. + struct Clipboard_Notify *node;
  51. +
  52. + remove_clipboard_notify(h);
  53. +
  54. + node = new Clipboard_Notify;
  55. +
  56. + node->handler = h;
  57. + node->data = data;
  58. + node->next = clip_notify_list;
  59. +
  60. + clip_notify_list = node;
  61. +
  62. + fl_clipboard_notify_change();
  63. +}
  64. +
  65. +void Fl::remove_clipboard_notify(Fl_Clipboard_Notify_Handler h) {
  66. + struct Clipboard_Notify *node, **prev;
  67. +
  68. + node = clip_notify_list;
  69. + prev = &clip_notify_list;
  70. + while (node != NULL) {
  71. + if (node->handler == h) {
  72. + *prev = node->next;
  73. + delete node;
  74. +
  75. + fl_clipboard_notify_change();
  76. +
  77. + return;
  78. + }
  79. +
  80. + prev = &node->next;
  81. + node = node->next;
  82. + }
  83. +}
  84. +
  85. +bool fl_clipboard_notify_empty(void) {
  86. + return clip_notify_list == NULL;
  87. +}
  88. +
  89. +void fl_trigger_clipboard_notify(int source) {
  90. + struct Clipboard_Notify *node;
  91. +
  92. + node = clip_notify_list;
  93. + while (node != NULL) {
  94. + node->handler(source, node->data);
  95. + node = node->next;
  96. + }
  97. +}
  98. +
  99. +////////////////////////////////////////////////////////////////
  100. // wait/run/check/ready:
  101. void (*Fl::idle)(); // see Fl::add_idle.cxx for the add/remove functions