]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/XWorkArea.C
remove focus/unfocus events - unused
[lyx.git] / src / frontends / xforms / XWorkArea.C
1 /**
2  * \file XWorkArea.C
3  * Copyright 1995-2002 the LyX Team
4  * Read the file COPYING
5  *
6  * \author unknown
7  * \author John Levon <moz@compsoc.man.ac.uk>
8  */
9
10 #include <config.h>
11
12 #ifdef __GNUG__
13 #pragma implementation
14 #endif
15
16 #include "XWorkArea.h"
17 #include "debug.h"
18 #include "LyXView.h"
19 #include "lyxrc.h" // lyxrc.show_banner
20 #include "version.h" // lyx_version
21 #include "XLyXKeySym.h"
22
23 #if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5))
24 #include "lyxlookup.h"
25 #endif
26
27 #include "support/filetools.h" // LibFileSearch
28 #include "support/lstrings.h"
29 #include "support/LAssert.h"
30
31 #include <cmath>
32 #include <cctype>
33
34 // xforms doesn't define this (but it should be in <forms.h>).
35 extern "C"
36 FL_APPEVENT_CB fl_set_preemptive_callback(Window, FL_APPEVENT_CB, void *);
37  
38 using std::endl;
39 using std::abs;
40 using std::hex;
41
42 namespace {
43
44 inline
45 void waitForX()
46 {
47         XSync(fl_get_display(), 0);
48 }
49
50
51 void setXtermCursor(Window win)
52 {
53         static Cursor cursor;
54         static bool cursor_undefined = true;
55         if (cursor_undefined) {
56                 cursor = XCreateFontCursor(fl_get_display(), XC_xterm);
57                 XFlush(fl_get_display());
58                 cursor_undefined = false;
59         }
60         XDefineCursor(fl_get_display(), win, cursor);
61         XFlush(fl_get_display());
62 }
63  
64
65 // FIXME !
66 mouse_button::state x_button_state(unsigned int button)
67 {
68         mouse_button::state b = mouse_button::none;
69         switch (button) {
70                 case Button1:
71                         b = mouse_button::button1;
72                         break;
73                 case Button2:
74                         b = mouse_button::button2;
75                         break;
76                 case Button3:
77                         b = mouse_button::button3;
78                         break;
79                 case Button4:
80                         b = mouse_button::button4;
81                         break;
82                 case Button5:
83                         b = mouse_button::button5;
84                         break;
85                 default: // FIXME
86                         break;
87         }
88         return b;
89 }
90
91
92 // FIXME
93 mouse_button::state x_motion_state(unsigned int state)
94 {
95         mouse_button::state b = mouse_button::none;
96         if (state & Button1MotionMask)
97                 b |= mouse_button::button1;
98         if (state & Button2MotionMask)
99                 b |= mouse_button::button2;
100         if (state & Button3MotionMask)
101                 b |= mouse_button::button3;
102         if (state & Button4MotionMask)
103                 b |= mouse_button::button4;
104         if (state & Button5MotionMask)
105                 b |= mouse_button::button5;
106         return b;
107 }
108
109
110 key_modifier::state x_key_state(unsigned int state)
111 {
112         key_modifier::state k = key_modifier::none;
113         if (state & ControlMask)
114                 k |= key_modifier::ctrl;
115         if (state & ShiftMask)
116                 k |= key_modifier::shift;
117         if (state & Mod1Mask)
118                 k |= key_modifier::alt;
119         return k;
120 }
121
122
123 } // anon namespace
124
125
126 extern "C" {
127         // Just a bunch of C wrappers around static members of XWorkArea
128         static
129         void C_XWorkArea_scroll_cb(FL_OBJECT * ob, long)
130         {
131                 XWorkArea * area = static_cast<XWorkArea*>(ob->u_vdata);
132                 area->scroll_cb();
133         }
134
135
136         static
137         int C_XWorkArea_work_area_handler(FL_OBJECT * ob, int event,
138                                          FL_Coord, FL_Coord,
139                                          int key, void * xev)
140         {
141                 return XWorkArea::work_area_handler(ob, event,
142                                                    0, 0, key, xev);
143         }
144
145         static
146         int C_XWorkAreaEventCB(FL_FORM * form, void * xev) {
147                 XWorkArea * wa = static_cast<XWorkArea*>(form->u_vdata);
148                 return wa->event_cb(static_cast<XEvent*>(xev));
149         }
150 }
151
152
153 XWorkArea::XWorkArea(int x, int y, int w, int h)
154         : splash_(0), splash_text_(0), workareapixmap(0), painter_(*this)
155 {
156         fl_freeze_all_forms();
157
158         //
159         FL_OBJECT * obj;
160
161         // a box
162         if (lyxerr.debugging(Debug::WORKAREA))
163                 lyxerr << "\tbackground box: +"
164                        << x << '+' << y << ' '
165                        << w - 15 << 'x' << h << endl;
166         backgroundbox = obj = fl_add_box(FL_BORDER_BOX,
167                                          x, y,
168                                          w - 15,
169                                          h, "");
170         fl_set_object_resize(obj, FL_RESIZE_ALL);
171         fl_set_object_gravity(obj, NorthWestGravity, SouthEastGravity);
172
173         // Add a splash screen to the centre of the work area
174         string const splash_file = (lyxrc.show_banner) ?
175                 LibFileSearch("images", "banner", "xpm") : string();
176
177         if (!splash_file.empty()) {
178                 int const splash_w = 425;
179                 int const splash_h = 290;
180                 int const splash_x = x + (w - 15 - splash_w) / 2;
181                 int const splash_y = y + (h - splash_h) / 2;
182                 splash_ = obj =
183                         fl_add_pixmapbutton(FL_NORMAL_BUTTON,
184                                             splash_x, splash_y,
185                                             splash_w, splash_h, "");
186                 fl_set_pixmapbutton_file(obj, splash_file.c_str());
187                 fl_set_pixmapbutton_focus_outline(obj, 3);
188                 fl_set_object_boxtype(obj, FL_NO_BOX);
189
190                 int const text_x = splash_x + 260;
191                 int const text_y = splash_y + 255;
192                 splash_text_ = obj =
193                         fl_add_text(FL_NORMAL_TEXT, text_x, text_y, 160, 16,
194                                     lyx_version);
195                 fl_set_object_lsize(obj, FL_NORMAL_SIZE);
196                 fl_mapcolor(FL_FREE_COL2, 0x2b, 0x47, 0x82);
197                 fl_mapcolor(FL_FREE_COL3, 0xe1, 0xd2, 0x9b);
198                 fl_set_object_color(obj, FL_FREE_COL2, FL_FREE_COL2);
199                 fl_set_object_lcol(obj, FL_FREE_COL3);
200                 fl_set_object_lalign(obj, FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
201                 fl_set_object_lstyle(obj, FL_BOLD_STYLE);
202         }
203
204         scrollbar = obj = fl_add_scrollbar(FL_VERT_SCROLLBAR,
205                                            x + w - 15,
206                                            y, 17, h, "");
207         fl_set_object_boxtype(obj, FL_UP_BOX);
208         fl_set_object_resize(obj, FL_RESIZE_ALL);
209         fl_set_object_gravity(obj, NorthEastGravity, SouthEastGravity);
210         obj->u_vdata = this;
211         fl_set_object_callback(obj, C_XWorkArea_scroll_cb, 0);
212         fl_set_scrollbar_bounds(scrollbar, 0.0, 0.0);
213         fl_set_scrollbar_value(scrollbar, 0.0);
214         fl_set_scrollbar_size(scrollbar, scrollbar->h);
215         
216         ///
217         /// The free object
218
219         int const bw = int(abs(fl_get_border_width()));
220  
221         // Create the workarea pixmap
222         createPixmap(w - 15 - 2 * bw, h - 2 * bw);
223
224         // We add this object as late as possible to avoit problems
225         // with drawing.
226         if (lyxerr.debugging(Debug::WORKAREA))
227                 lyxerr << "\tfree object: +"
228                        << x + bw << '+' << y + bw << ' '
229                        << w - 15 - 2 * bw << 'x'
230                        << h - 2 * bw << endl;
231
232         work_area = obj = fl_add_free(FL_ALL_FREE,
233                                       x + bw, y + bw,
234                                       w - 15 - 2 * bw, // scrollbarwidth
235                                       h - 2 * bw, "",
236                                       C_XWorkArea_work_area_handler);
237         obj->wantkey = FL_KEY_ALL;
238         obj->u_vdata = this; /* This is how we pass the XWorkArea
239                                 to the work_area_handler. */
240         fl_set_object_boxtype(obj,FL_DOWN_BOX);
241         fl_set_object_resize(obj, FL_RESIZE_ALL);
242         fl_set_object_gravity(obj, NorthWestGravity, SouthEastGravity);
243
244         /// X selection hook - xforms gets it wrong
245         fl_current_form->u_vdata = this;
246         fl_register_raw_callback(fl_current_form, FL_ALL_EVENT, C_XWorkAreaEventCB);
247
248         fl_unfreeze_all_forms();
249 }
250
251
252 XWorkArea::~XWorkArea()
253 {
254         if (workareapixmap)
255                 XFreePixmap(fl_get_display(), workareapixmap);
256 }
257
258
259 void XWorkArea::resize(int xpos, int ypos, int width, int height)
260 {
261         fl_freeze_all_forms();
262
263         int const bw = int(abs(fl_get_border_width()));
264
265         // a box
266         fl_set_object_geometry(backgroundbox, xpos, ypos, width - 15, height);
267
268         //
269         // THE SCROLLBAR
270         //
271         fl_set_object_geometry(scrollbar, xpos + width - 15,
272                                ypos, 17, height);
273
274         // Create the workarea pixmap
275         createPixmap(width - 15 - 2 * bw, height - 2 * bw);
276
277         // the free object
278         fl_set_object_geometry(work_area, xpos + bw, ypos + bw,
279                                width - 15 - 2 * bw,
280                                height - 2 * bw);
281
282         fl_unfreeze_all_forms();
283 }
284
285
286 namespace {
287 void destroy_object(FL_OBJECT * obj)
288 {
289         if (!obj)
290                 return;
291
292         if (obj->visible) {
293                 fl_hide_object(obj);
294         }
295         fl_delete_object(obj);
296         fl_free_object(obj);
297 }
298 } // namespace anon
299
300
301 void XWorkArea::createPixmap(int width, int height)
302 {
303         // Three calls to createPixmap are needed to draw the initial view
304         // of LyX. Any more and the splash is destroyed.
305         static int counter = 0;
306         if (++counter == 4) {
307                 destroy_object(splash_);
308                 splash_ = 0;
309                 destroy_object(splash_text_);
310                 splash_text_ = 0;
311         }
312
313         static int cur_width = -1;
314         static int cur_height = -1;
315
316         if (cur_width == width && cur_height == height && workareapixmap)
317                 return;
318
319         cur_width = width;
320         cur_height = height;
321
322         if (workareapixmap)
323                 XFreePixmap(fl_get_display(), workareapixmap);
324
325         if (lyxerr.debugging(Debug::WORKAREA))
326                 lyxerr << "Creating pixmap ("
327                        << width << 'x' << height << ")" << endl;
328
329         workareapixmap = XCreatePixmap(fl_get_display(),
330                                        RootWindow(fl_get_display(), 0),
331                                        width,
332                                        height,
333                                        fl_get_visual_depth());
334         if (lyxerr.debugging(Debug::WORKAREA))
335                 lyxerr << "\tpixmap=" << workareapixmap << endl;
336 }
337
338
339 void XWorkArea::greyOut() const
340 {
341         if (!splash_) {
342                 fl_winset(FL_ObjWin(work_area));
343                 fl_rectangle(1, work_area->x, work_area->y,
344                              work_area->w, work_area->h, FL_GRAY63);
345         }
346 }
347
348
349 void XWorkArea::setFocus() const
350 {
351         fl_set_focus_object(work_area->form, work_area);
352 }
353
354
355 void XWorkArea::setScrollbarParams(int height, int pos, int line_height)
356 {
357         // we need to cache this for scroll_cb
358         doc_height_ = height;
359
360         if (height == 0) {
361                 fl_set_scrollbar_value(scrollbar, 0.0);
362                 fl_set_scrollbar_size(scrollbar, scrollbar->h);
363                 return;
364         }
365
366         long const work_height = workHeight();
367
368         lyxerr[Debug::GUI] << "scroll: height now " << height << endl;
369         lyxerr[Debug::GUI] << "scroll: work_height " << work_height << endl;
370  
371         /* If the text is smaller than the working area, the scrollbar
372          * maximum must be the working area height. No scrolling will
373          * be possible */
374         if (height <= work_height) {
375                 lyxerr[Debug::GUI] << "scroll: doc smaller than workarea !" << endl;
376                 fl_set_scrollbar_bounds(scrollbar, 0.0, 0.0);
377                 fl_set_scrollbar_value(scrollbar, pos);
378                 fl_set_scrollbar_size(scrollbar, scrollbar->h);
379                 return;
380         }
381
382         fl_set_scrollbar_bounds(scrollbar, 0.0, height - work_height);
383         fl_set_scrollbar_increment(scrollbar, work_area->h - line_height, line_height);
384
385         fl_set_scrollbar_value(scrollbar, pos);
386
387         double const slider_size =
388                 (height == 0) ? 1.0 : 1.0 / double(height);
389
390         fl_set_scrollbar_size(scrollbar, scrollbar->h * slider_size);
391 }
392
393
394 // callback for scrollbar slider
395 void XWorkArea::scroll_cb()
396 {
397         double const val = fl_get_scrollbar_value(scrollbar);
398         lyxerr[Debug::GUI] << "scroll: val: " << val << endl;
399         lyxerr[Debug::GUI] << "scroll: height: " << scrollbar->h << endl;
400         lyxerr[Debug::GUI] << "scroll: docheight: " << doc_height_ << endl;
401         scrollDocView(int(val));
402         waitForX();
403 }
404
405
406 int XWorkArea::work_area_handler(FL_OBJECT * ob, int event,
407                                 FL_Coord, FL_Coord ,
408                                 int key, void * xev)
409 {
410         static int x_old = -1;
411         static int y_old = -1;
412         static long scrollbar_value_old = -1;
413
414         XEvent * ev = static_cast<XEvent*>(xev);
415         XWorkArea * area = static_cast<XWorkArea*>(ob->u_vdata);
416
417         if (!area) return 1;
418
419         switch (event) {
420         case FL_DRAW:
421                 if (!area->work_area ||
422                     !area->work_area->form->visible)
423                         return 1;
424                 lyxerr[Debug::WORKAREA] << "Workarea event: DRAW" << endl;
425                 area->createPixmap(area->workWidth(), area->workHeight());
426                 area->workAreaExpose();
427                 break;
428         case FL_PUSH:
429                 if (!ev || ev->xbutton.button == 0) break;
430                 // Should really have used xbutton.state
431                 lyxerr[Debug::WORKAREA] << "Workarea event: PUSH" << endl;
432                 area->workAreaButtonPress(ev->xbutton.x - ob->x,
433                                           ev->xbutton.y - ob->y,
434                                           x_button_state(ev->xbutton.button));
435                 break;
436         case FL_RELEASE:
437                 if (!ev || ev->xbutton.button == 0) break;
438                 // Should really have used xbutton.state
439                 lyxerr[Debug::WORKAREA] << "Workarea event: RELEASE" << endl;
440                 area->workAreaButtonRelease(ev->xbutton.x - ob->x,
441                                       ev->xbutton.y - ob->y,
442                                       x_button_state(ev->xbutton.button));
443                 break;
444 #if FL_VERSION < 1 && FL_REVISION < 89
445         case FL_MOUSE:
446 #else
447         case FL_DRAG:
448 #endif
449                 if (!ev || ! area->scrollbar) break;
450                 if (ev->xmotion.x != x_old ||
451                     ev->xmotion.y != y_old ||
452                     fl_get_scrollbar_value(area->scrollbar) != scrollbar_value_old
453                         ) {
454                         lyxerr[Debug::WORKAREA] << "Workarea event: MOUSE" << endl;
455                         area->workAreaMotionNotify(ev->xmotion.x - ob->x,
456                                              ev->xmotion.y - ob->y,
457                                              x_motion_state(ev->xbutton.state));
458                 }
459                 break;
460 #if FL_VERSION < 1 && FL_REVISION < 89
461         case FL_KEYBOARD:
462 #else
463         case FL_KEYPRESS:
464 #endif
465         {
466                 lyxerr[Debug::WORKAREA] << "Workarea event: KEYBOARD" << endl;
467
468                 KeySym keysym = 0;
469                 char dummy[1];
470                 XKeyEvent * xke = reinterpret_cast<XKeyEvent *>(ev);
471 #if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5))
472                 // XForms < 0.89.5 does not have compose support
473                 // so we are using our own compose support
474                 LyXLookupString(ev, dummy, 1, &keysym);
475 #else
476                 XLookupString(xke, dummy, 1, &keysym, 0);
477 //              int num_keys = XLookupString(xke, dummy, 10, &keysym, &xcs);
478 //              lyxerr << "We have " << num_keys << " keys in the returned buffer" << endl;
479 //              lyxerr << "Our dummy string is " << dummy << endl;
480 #endif
481                 
482                 if (lyxerr.debugging(Debug::KEY)) {
483                         char const * tmp = XKeysymToString(key);
484                         char const * tmp2 = XKeysymToString(keysym);
485                         string const stm = (tmp ? tmp : "");
486                         string const stm2 = (tmp2 ? tmp2 : "");
487
488                         lyxerr[Debug::KEY] << "XWorkArea: Key is `" << stm << "' ["
489                                << key << "]" << endl;
490                         lyxerr[Debug::KEY] << "XWorkArea: Keysym is `" << stm2 << "' ["
491                                << keysym << "]" << endl;
492                 }
493
494 #if FL_VERSION < 1 && (FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5))
495                 if (keysym == NoSymbol) {
496                         lyxerr[Debug::KEY]
497                                 << "Empty kdb action (probably composing)"
498                                 << endl;
499                         break;
500                 }
501                 KeySym ret_key = keysym;
502 #else
503                 // Note that we need this handling because of a bug
504                 // in XForms 0.89, if this bug is resolved in the way I hope
505                 // we can just use the keysym directly with out looking
506                 // at key at all. (Lgb)
507                 KeySym ret_key = 0;
508                 if (!key) {
509                         // We migth have to add more keysyms here also,
510                         // we will do that as the issues arise. (Lgb)
511                         if (keysym == XK_space) {
512                                 ret_key = keysym;
513                                 lyxerr[Debug::KEY] << "Using keysym [A]"
514                                                    << endl;
515                         } else
516                                 break;
517                 } else {
518                         // It seems that this was a bit optimistic...
519                         // With this hacking things seems to be better (Lgb)
520                         //if (!iscntrl(key)) {
521                         //      ret_key = key;
522                         //      lyxerr[Debug::KEY]
523                         //              << "Using key [B]\n"
524                         //              << "Uchar["
525                         //              << static_cast<unsigned char>(key)
526                         //              << endl;
527                         //} else {
528                                 ret_key = (keysym ? keysym : key);
529                                 lyxerr[Debug::KEY] << "Using keysym [B]"
530                                                    << endl;
531                                 //}
532                 }
533
534 #endif
535                 unsigned int const ret_state = xke->state;
536
537                 // If you have a better way to handle "wild-output" of
538                 // characters after the key has been released than the one
539                 // below, please contact me. (Lgb)
540                 static Time last_time_pressed;
541                 static unsigned int last_key_pressed;
542                 static unsigned int last_state_pressed;
543                 lyxerr[Debug::KEY] << "Workarea Diff: "
544                                    << xke->time - last_time_pressed
545                                    << endl;
546                 if (xke->time - last_time_pressed < 25 // should perhaps be tunable
547                     && ret_state == last_state_pressed
548                     && xke->keycode == last_key_pressed) {
549                         lyxerr[Debug::KEY]
550                                 << "Workarea: Purging X events." << endl;
551                         //lyxerr << "Workarea Events: "
552                         //       << XEventsQueued(fl_get_display(), QueuedAlready)
553                         //       << endl;
554                         if (XEventsQueued(fl_get_display(), QueuedAlready) > 0)
555                                 XSync(fl_get_display(), 1);
556                         // This purge make f.ex. scrolling stop immidiatly when
557                         // releasing the PageDown button. The question is if
558                         // this purging of XEvents can cause any harm...
559                         // after some testing I can see no problems, but
560                         // I'd like other reports too.
561                         break;
562                 }
563                 last_time_pressed = xke->time;
564                 last_key_pressed = xke->keycode;
565                 last_state_pressed = ret_state;
566
567                 XLyXKeySym * xlk = new XLyXKeySym;
568                 xlk->initFromKeySym(ret_key);
569                 
570                 area->workAreaKeyPress(LyXKeySymPtr(xlk),
571                                        x_key_state(ret_state));
572         }
573         break;
574
575 #if FL_VERSION > 0 || FL_REVISION >= 89
576         case FL_KEYRELEASE:
577                 lyxerr[Debug::WORKAREA] << "Workarea event: KEYRELEASE" << endl;
578                 break;
579 #endif
580
581         case FL_ENTER:
582                 lyxerr[Debug::WORKAREA] << "Workarea event: ENTER" << endl;
583                 break;
584         case FL_LEAVE:
585                 lyxerr[Debug::WORKAREA] << "Workarea event: LEAVE" << endl;
586                 break;
587         case FL_DBLCLICK:
588                 if (!ev) break;
589                 lyxerr[Debug::WORKAREA] << "Workarea event: DBLCLICK" << endl;
590                 area->workAreaDoubleClick(ev->xbutton.x - ob->x,
591                                           ev->xbutton.y - ob->y,
592                                           x_button_state(ev->xbutton.button));
593                 break;
594         case FL_TRPLCLICK:
595                 if (!ev) break;
596                 lyxerr[Debug::WORKAREA] << "Workarea event: TRPLCLICK" << endl;
597                 area->workAreaTripleClick(ev->xbutton.x - ob->x,
598                                           ev->xbutton.y - ob->y,
599                                           x_button_state(ev->xbutton.button));
600                 break;
601         case FL_OTHER:
602                 if (!ev) break;
603                 lyxerr[Debug::WORKAREA] << "Workarea event: OTHER" << endl;
604                 break;
605         }
606
607         return 1;
608 }
609
610
611 namespace {
612
613 string clipboard_selection;
614 bool clipboard_read = false;
615
616 extern "C" {
617
618         static
619         int request_clipboard_cb(FL_OBJECT * /*ob*/, long /*type*/,
620                                  void const * data, long size)
621         {
622                 clipboard_selection.erase();
623
624                 if (size > 0)
625                         clipboard_selection.reserve(size);
626                 for (int i = 0; i < size; ++i)
627                         clipboard_selection +=
628                                 static_cast<char const *>(data)[i];
629                 clipboard_read = true;
630                 return 0;
631         }
632
633 }
634
635 } // namespace anon
636
637
638 int XWorkArea::event_cb(XEvent * xev)
639 {
640         int ret = 0;
641         switch (xev->type) {
642                 case SelectionRequest:
643                         lyxerr[Debug::GUI] << "X requested selection." << endl;
644                         selectionRequested();
645                         break;
646                 case SelectionClear:
647                         lyxerr[Debug::GUI] << "Lost selection." << endl;
648                         selectionLost();
649                         break;
650         }
651         return ret;
652 }
653
654
655 void XWorkArea::haveSelection(bool yes) const
656 {
657         if (!yes) {
658                 XSetSelectionOwner(fl_get_display(), XA_PRIMARY, None, CurrentTime);
659                 return;
660         }
661
662         XSetSelectionOwner(fl_get_display(), XA_PRIMARY, FL_ObjWin(work_area), CurrentTime);
663 }
664
665
666 string const XWorkArea::getClipboard() const
667 {
668         clipboard_read = false;
669
670         if (fl_request_clipboard(work_area, 0, request_clipboard_cb) == -1)
671                 return string();
672
673         XEvent ev;
674
675         while (!clipboard_read) {
676                 if (fl_check_forms() == FL_EVENT) {
677                         fl_XNextEvent(&ev);
678                         lyxerr << "Received unhandled X11 event" << endl;
679                         lyxerr << "Type: 0x" << hex << ev.xany.type <<
680                                 " Target: 0x" << hex << ev.xany.window << endl;
681                 }
682         }
683         return clipboard_selection;
684 }
685
686
687 void XWorkArea::putClipboard(string const & s) const
688 {
689         static string hold;
690         hold = s;
691
692         fl_stuff_clipboard(work_area, 0, hold.data(), hold.size(), 0);
693 }