fltk  1.3.5-source
About: FLTK (Fast Light Tool Kit) is a cross-platform C++ GUI toolkit for UNIX/Linux (X11), Microsoft Windows, and MacOS X.
  Fossies Dox: fltk-1.3.5-source.tar.bz2  ("inofficial" and yet experimental doxygen-generated source code documentation)  

Fl.cxx
Go to the documentation of this file.
1 //
2 // "$Id$"
3 //
4 // Main event handling code for the Fast Light Tool Kit (FLTK).
5 //
6 // Copyright 1998-2018 by Bill Spitzak and others.
7 //
8 // This library is free software. Distribution and use rights are outlined in
9 // the file "COPYING" which should have been included with this file. If this
10 // file is missing or damaged, see the license at:
11 //
12 // http://www.fltk.org/COPYING.php
13 //
14 // Please report all bugs and problems on the following page:
15 //
16 // http://www.fltk.org/str.php
17 //
18 
19 
20 // warning: the Apple Quartz version still uses some Quickdraw calls,
21 // mostly to get around the single active context in QD and
22 // to implement clipping. This should be changed into pure
23 // Quartz calls in the near future.
24 #include <config.h>
25 
26 /* We require Windows 2000 features (e.g. VK definitions) */
27 #if defined(WIN32)
28 # if !defined(WINVER) || (WINVER < 0x0500)
29 # ifdef WINVER
30 # undef WINVER
31 # endif
32 # define WINVER 0x0500
33 # endif
34 # if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)
35 # ifdef _WIN32_WINNT
36 # undef _WIN32_WINNT
37 # endif
38 # define _WIN32_WINNT 0x0500
39 # endif
40 #endif
41 
42 
43 // STR #3454: We must #define FD_ISSET before we #include winsock2.h
44 // to fix an undefined reference (__FD_ISSET). (AlbrechtS Feb 2018)
45 // Other portions of the fix for STR #3454 are in src/Fl_win32.cxx.
46 // This fix is only necessary for MinGW.
47 
48 #ifdef __MINGW32__
49 static void * get_wsock_mod();
50 typedef int(__stdcall *fl_wsk_fd_is_set_f)(unsigned int, void *);
52 
53 #define FD_ISSET(S,SET) \
54  (get_wsock_mod() ? fl_wsk_fd_is_set(S, SET) : 0)
55 #endif // __MINGW32__
56 
57 // recent versions of MinGW warn: "Please include winsock2.h before windows.h",
58 // hence we must include winsock2.h before FL/Fl.H (A.S. Dec. 2010, IMM May 2011)
59 
60 #if defined(WIN32) && !defined(__CYGWIN__)
61 # include <winsock2.h>
62 #endif
63 
64 #include <FL/Fl.H>
65 #include <FL/Fl_Window.H>
66 #include <FL/Fl_Tooltip.H>
67 #include <FL/x.H>
68 
69 #include <ctype.h>
70 #include <stdlib.h>
71 #include "flstring.h"
72 
73 #if defined(DEBUG) || defined(DEBUG_WATCH)
74 # include <stdio.h>
75 #endif // DEBUG || DEBUG_WATCH
76 
77 #ifdef WIN32
78 # include <ole2.h>
79 void fl_free_fonts(void);
80 HBRUSH fl_brush_action(int action);
81 void fl_cleanup_pens(void);
82 void fl_release_dc(HWND,HDC);
83 void fl_cleanup_dc_list(void);
84 #elif defined(__APPLE__)
85 extern double fl_mac_flush_and_wait(double time_to_wait);
86 #endif // WIN32
87 
88 //
89 // Globals...
90 //
91 
92 // Pointers you can use to change FLTK to a foreign language.
93 // Note: Similar pointers are defined in FL/fl_ask.H and src/fl_ask.cxx
94 #if !defined(__APPLE__) || defined(FL_DOXYGEN)
95  const char* fl_local_alt = "Alt";
96  const char* fl_local_ctrl = "Ctrl";
97  const char* fl_local_meta = "Meta";
98  const char* fl_local_shift = "Shift";
99 #else
100  const char* fl_local_alt = "\xe2\x8c\xa5\\"; // U+2325 (option key)
101  const char* fl_local_ctrl = "\xe2\x8c\x83\\"; // U+2303 (up arrowhead)
102  const char* fl_local_meta = "\xe2\x8c\x98\\"; // U+2318 (place of interest sign)
103  const char* fl_local_shift = "\xe2\x87\xa7\\"; // U+21E7 (upwards white arrow)
104 #endif
105 
106 // Apple App Menu
107 #if defined(__APPLE__) || defined(FL_DOXYGEN)
108 const char *Fl_Mac_App_Menu::about = "About %@";
109 const char *Fl_Mac_App_Menu::print = "Print Front Window";
110 const char *Fl_Mac_App_Menu::services = "Services";
111 const char *Fl_Mac_App_Menu::hide = "Hide %@";
112 const char *Fl_Mac_App_Menu::hide_others = "Hide Others";
113 const char *Fl_Mac_App_Menu::show = "Show All";
114 const char *Fl_Mac_App_Menu::quit = "Quit %@";
115 #endif // __APPLE__
116 
117 #ifndef FL_DOXYGEN
119  *Fl::pushed_,
120  *Fl::focus_,
122 int Fl::damage_,
123  Fl::e_number,
124  Fl::e_x,
125  Fl::e_y,
126  Fl::e_x_root,
127  Fl::e_y_root,
128  Fl::e_dx,
129  Fl::e_dy,
130  Fl::e_state,
131  Fl::e_clicks,
133  Fl::e_keysym,
135  Fl::scrollbar_size_ = 16;
136 
137 char *Fl::e_text = (char *)"";
138 int Fl::e_length;
139 const char* Fl::e_clipboard_type = "";
140 void * Fl::e_clipboard_data = NULL;
141 
143 
144 unsigned char Fl::options_[] = { 0, 0 };
145 unsigned char Fl::options_read_ = 0;
146 
147 
148 Fl_Window *fl_xfocus = NULL; // which window X thinks has focus
149 Fl_Window *fl_xmousewin;// which window X thinks has FL_ENTER
150 Fl_Window *Fl::grab_; // most recent Fl::grab()
151 Fl_Window *Fl::modal_; // topmost modal() window
152 
153 #endif // FL_DOXYGEN
154 
155 char const * const Fl::clipboard_plain_text = "text/plain";
156 char const * const Fl::clipboard_image = "image";
157 
158 //
159 // 'Fl::version()' - Return the API version number...
160 //
161 
168 double Fl::version() {
169  return FL_VERSION;
170 }
171 
177  return FL_API_VERSION;
178 }
179 
185  return FL_ABI_VERSION;
186 }
187 
197  return scrollbar_size_;
198 }
199 
208 void Fl::scrollbar_size(int W) {
209  scrollbar_size_ = W;
210 }
211 
212 
227 int Fl::event_inside(int xx,int yy,int ww,int hh) /*const*/ {
228  int mx = e_x - xx;
229  int my = e_y - yy;
230  return (mx >= 0 && mx < ww && my >= 0 && my < hh);
231 }
232 
260 int Fl::event_inside(const Fl_Widget *o) /*const*/ {
261  int mx = e_x - o->x();
262  int my = e_y - o->y();
263  return (mx >= 0 && mx < o->w() && my >= 0 && my < o->h());
264 }
265 
266 //
267 //
268 // timer support
269 //
270 
271 #ifdef WIN32
272 
273 // implementation in Fl_win32.cxx
274 
275 #elif defined(__APPLE__)
276 
277 // implementation in Fl_cocoa.mm (was Fl_mac.cxx)
278 
279 #else
280 
281 //
282 // X11 timers
283 //
284 
285 
287 // Timeouts are stored in a sorted list (*first_timeout), so only the
288 // first one needs to be checked to see if any should be called.
289 // Allocated, but unused (free) Timeout structs are stored in another
290 // linked list (*free_timeout).
291 
292 struct Timeout {
293  double time;
294  void (*cb)(void*);
295  void* arg;
297 };
299 
300 #include <sys/time.h>
301 
302 // I avoid the overhead of getting the current time when we have no
303 // timeouts by setting this flag instead of getting the time.
304 // In this case calling elapse_timeouts() does nothing, but records
305 // the current time, and the next call will actually elapse time.
306 static char reset_clock = 1;
307 
308 static void elapse_timeouts() {
309  static struct timeval prevclock;
310  struct timeval newclock;
311  gettimeofday(&newclock, NULL);
312  double elapsed = newclock.tv_sec - prevclock.tv_sec +
313  (newclock.tv_usec - prevclock.tv_usec)/1000000.0;
314  prevclock.tv_sec = newclock.tv_sec;
315  prevclock.tv_usec = newclock.tv_usec;
316  if (reset_clock) {
317  reset_clock = 0;
318  } else if (elapsed > 0) {
319  for (Timeout* t = first_timeout; t; t = t->next) t->time -= elapsed;
320  }
321 }
322 
323 // Continuously-adjusted error value, this is a number <= 0 for how late
324 // we were at calling the last timeout. This appears to make repeat_timeout
325 // very accurate even when processing takes a significant portion of the
326 // time interval:
327 static double missed_timeout_by;
328 
329 void Fl::add_timeout(double time, Fl_Timeout_Handler cb, void *argp) {
330  elapse_timeouts();
331  repeat_timeout(time, cb, argp);
332 }
333 
334 void Fl::repeat_timeout(double time, Fl_Timeout_Handler cb, void *argp) {
335  time += missed_timeout_by; if (time < -.05) time = 0;
336  Timeout* t = free_timeout;
337  if (t) {
338  free_timeout = t->next;
339  } else {
340  t = new Timeout;
341  }
342  t->time = time;
343  t->cb = cb;
344  t->arg = argp;
345  // insert-sort the new timeout:
346  Timeout** p = &first_timeout;
347  while (*p && (*p)->time <= time) p = &((*p)->next);
348  t->next = *p;
349  *p = t;
350 }
351 
356  for (Timeout* t = first_timeout; t; t = t->next)
357  if (t->cb == cb && t->arg == argp) return 1;
358  return 0;
359 }
360 
369  for (Timeout** p = &first_timeout; *p;) {
370  Timeout* t = *p;
371  if (t->cb == cb && (t->arg == argp || !argp)) {
372  *p = t->next;
373  t->next = free_timeout;
374  free_timeout = t;
375  } else {
376  p = &(t->next);
377  }
378  }
379 }
380 
381 #endif
382 
384 // Checks are just stored in a list. They are called in the reverse
385 // order that they were added (this may change in the future).
386 // This is a bit messy because I want to allow checks to be added,
387 // removed, and have wait() called from inside them. To do this
388 // next_check points at the next unprocessed one for the outermost
389 // call to Fl::wait().
390 
391 struct Check {
392  void (*cb)(void*);
393  void* arg;
395 };
397 
430  Check* t = free_check;
431  if (t) free_check = t->next;
432  else t = new Check;
433  t->cb = cb;
434  t->arg = argp;
435  t->next = first_check;
436  if (next_check == first_check) next_check = t;
437  first_check = t;
438 }
439 
445  for (Check** p = &first_check; *p;) {
446  Check* t = *p;
447  if (t->cb == cb && t->arg == argp) {
448  if (next_check == t) next_check = t->next;
449  *p = t->next;
450  t->next = free_check;
451  free_check = t;
452  } else {
453  p = &(t->next);
454  }
455  }
456 }
457 
462  for (Check** p = &first_check; *p;) {
463  Check* t = *p;
464  if (t->cb == cb && t->arg == argp) {
465  return 1;
466  } else {
467  p = &(t->next);
468  }
469  }
470  return 0;
471 }
472 
473 static void run_checks()
474 {
475  // checks are a bit messy so that add/remove and wait may be called
476  // from inside them without causing an infinite loop:
477  if (next_check == first_check) {
478  while (next_check) {
479  Check* checkp = next_check;
480  next_check = checkp->next;
481  (checkp->cb)(checkp->arg);
482  }
484  }
485 }
486 
487 #if !defined(WIN32) && !defined(__APPLE__)
488 static char in_idle;
489 #endif
490 
492 // Clipboard notifications
493 
496  void *data;
498 };
499 
501 
502 extern void fl_clipboard_notify_change(); // in Fl_<platform>.cxx
503 
505  struct Clipboard_Notify *node;
506 
508 
509  node = new Clipboard_Notify;
510 
511  node->handler = h;
512  node->data = data;
513  node->next = clip_notify_list;
514 
515  clip_notify_list = node;
516 
518 }
519 
521  struct Clipboard_Notify *node, **prev;
522 
523  node = clip_notify_list;
524  prev = &clip_notify_list;
525  while (node != NULL) {
526  if (node->handler == h) {
527  *prev = node->next;
528  delete node;
529 
531 
532  return;
533  }
534 
535  prev = &node->next;
536  node = node->next;
537  }
538 }
539 
541  return clip_notify_list == NULL;
542 }
543 
544 void fl_trigger_clipboard_notify(int source) {
545  struct Clipboard_Notify *node, *next;
546 
547  node = clip_notify_list;
548  while (node != NULL) {
549  next = node->next;
550  node->handler(source, node->data);
551  node = next;
552  }
553 }
554 
556 // wait/run/check/ready:
557 
558 void (*Fl::idle)(); // see Fl::add_idle.cxx for the add/remove functions
559 
560 extern int fl_ready(); // in Fl_<platform>.cxx
561 extern int fl_wait(double time); // in Fl_<platform>.cxx
562 
566 double Fl::wait(double time_to_wait) {
567  // delete all widgets that were listed during callbacks
569 
570 #ifdef WIN32
571 
572  return fl_wait(time_to_wait);
573 
574 #elif defined(__APPLE__)
575 
576  run_checks();
577  return fl_mac_flush_and_wait(time_to_wait);
578 
579 #else
580 
581  if (first_timeout) {
582  elapse_timeouts();
583  Timeout *t;
584  while ((t = first_timeout)) {
585  if (t->time > 0) break;
586  // The first timeout in the array has expired.
587  missed_timeout_by = t->time;
588  // We must remove timeout from array before doing the callback:
589  void (*cb)(void*) = t->cb;
590  void *argp = t->arg;
591  first_timeout = t->next;
592  t->next = free_timeout;
593  free_timeout = t;
594  // Now it is safe for the callback to do add_timeout:
595  cb(argp);
596  }
597  } else {
598  reset_clock = 1; // we are not going to check the clock
599  }
600  run_checks();
601 // if (idle && !fl_ready()) {
602  if (idle) {
603  if (!in_idle) {
604  in_idle = 1;
605  idle();
606  in_idle = 0;
607  }
608  // the idle function may turn off idle, we can then wait:
609  if (idle) time_to_wait = 0.0;
610  }
611  if (first_timeout && first_timeout->time < time_to_wait)
612  time_to_wait = first_timeout->time;
613  if (time_to_wait <= 0.0) {
614  // do flush second so that the results of events are visible:
615  int ret = fl_wait(0.0);
616  flush();
617  return ret;
618  } else {
619  // do flush first so that user sees the display:
620  flush();
621  if (idle && !in_idle) // 'idle' may have been set within flush()
622  time_to_wait = 0.0;
623  return fl_wait(time_to_wait);
624  }
625 #endif
626 }
627 
628 #define FOREVER 1e20
629 
637 int Fl::run() {
638  while (Fl_X::first) wait(FOREVER);
639  return 0;
640 }
641 
666 int Fl::wait() {
667  if (!Fl_X::first) return 0;
668  wait(FOREVER);
669  return Fl_X::first != 0; // return true if there is a window
670 }
671 
688 int Fl::check() {
689  wait(0.0);
690  return Fl_X::first != 0; // return true if there is a window
691 }
692 
711 int Fl::ready() {
712 #if ! defined( WIN32 ) && ! defined(__APPLE__)
713  if (first_timeout) {
714  elapse_timeouts();
715  if (first_timeout->time <= 0) return 1;
716  } else {
717  reset_clock = 1;
718  }
719 #endif
720  return fl_ready();
721 }
722 
724 // Window list management:
725 
726 #ifndef FL_DOXYGEN
727 Fl_X* Fl_X::first;
728 #endif
729 
731  Fl_X *window;
732  for (Fl_X **pp = &Fl_X::first; (window = *pp); pp = &window->next)
733  if (window->xid == xid) {
734  if (window != Fl_X::first && !Fl::modal()) {
735  // make this window be first to speed up searches
736  // this is not done if modal is true to avoid messing up modal stack
737  *pp = window->next;
738  window->next = Fl_X::first;
740  }
741  return window->w;
742  }
743  return 0;
744 }
745 
752  Fl_X* i = Fl_X::first;
753  return i ? i->w : 0;
754 }
755 
762  Fl_X* i = Fl_X::i(window)->next;
763  return i ? i->w : 0;
764 }
765 
775  if (!window || !window->shown()) return;
776  fl_find( Fl_X::i(window)->xid );
777 }
778 
782 void Fl::redraw() {
783  for (Fl_X* i = Fl_X::first; i; i = i->next) i->w->redraw();
784 }
785 
797 void Fl::flush() {
798  if (damage()) {
799  damage_ = 0;
800  for (Fl_X* i = Fl_X::first; i; i = i->next) {
801  if (i->wait_for_expose) {damage_ = 1; continue;}
802  Fl_Window* wi = i->w;
803  if (!wi->visible_r()) continue;
804  if (wi->damage()) {i->flush(); wi->clear_damage();}
805  // destroy damage regions for windows that don't use them:
806  if (i->region) {XDestroyRegion(i->region); i->region = 0;}
807  }
808  }
809 #if defined(USE_X11)
810  if (fl_display) XFlush(fl_display);
811 #elif defined(WIN32)
812  GdiFlush();
813 #elif defined (__APPLE_QUARTZ__)
814  if (fl_gc)
816 #else
817 # error unsupported platform
818 #endif
819 }
820 
821 
823 // Event handlers:
824 
825 
826 struct handler_link {
827  int (*handle)(int);
829 };
830 
831 
832 static handler_link *handlers = 0;
833 
834 
859  handler_link *l = new handler_link;
860  l->handle = ha;
861  l->next = handlers;
862  handlers = l;
863 }
864 
865 
871  handler_link *l, *p;
872 
873  // Search for the handler in the list...
874  for (l = handlers, p = 0; l && l->handle != ha; p = l, l = l->next) {/*empty*/}
875 
876  if (l) {
877  // Found it, so remove it from the list...
878  if (p) p->next = l->next;
879  else handlers = l->next;
880 
881  // And free the record...
882  delete l;
883  }
884 }
885 
886 int (*fl_local_grab)(int); // used by fl_dnd.cxx
887 
888 static int send_handlers(int e) {
889  for (const handler_link *hl = handlers; hl; hl = hl->next)
890  if (hl->handle(e)) return 1;
891  return 0;
892 }
893 
894 
896 // System event handlers:
897 
898 
901  void *data;
903 };
904 
905 
907 
908 
932  l->handle = ha;
933  l->data = data;
934  l->next = sys_handlers;
935  sys_handlers = l;
936 }
937 
938 
947  system_handler_link *l, *p;
948 
949  // Search for the handler in the list...
950  for (l = sys_handlers, p = 0; l && l->handle != ha; p = l, l = l->next);
951 
952  if (l) {
953  // Found it, so remove it from the list...
954  if (p) p->next = l->next;
955  else sys_handlers = l->next;
956 
957  // And free the record...
958  delete l;
959  }
960 }
961 
963  for (const system_handler_link *hl = sys_handlers; hl; hl = hl->next) {
964  if (hl->handle(e, hl->data))
965  return 1;
966  }
967  return 0;
968 }
969 
970 
972 
973 Fl_Widget* fl_oldfocus; // kludge for Fl_Group...
974 
988  if (o && !o->visible_focus()) return;
989  if (grab()) return; // don't do anything while grab is on
990  Fl_Widget *p = focus_;
991  if (o != p) {
993  focus_ = o;
994  // make sure that fl_xfocus is set to the top level window
995  // of this widget, or fl_fix_focus will clear our focus again
996  if (o) {
997  Fl_Window *win = 0, *w1 = o->as_window();
998  if (!w1) w1 = o->window();
999  while (w1) { win=w1; w1=win->window(); }
1000  if (win) {
1001 #ifdef __APPLE__
1002  if (fl_xfocus != win) {
1003  Fl_X *x = Fl_X::i(win);
1004  if (x) x->set_key_window();
1005  }
1006 #elif defined(USE_X11)
1007  if (fl_xfocus != win) {
1008  Fl_X *x = Fl_X::i(win);
1009  if (!Fl_X::ewmh_supported())
1010  win->show(); // Old WMs, XMapRaised
1011  else if (x) // New WMs use the NETWM attribute:
1012  Fl_X::activate_window(x->xid);
1013  }
1014 #endif
1015  fl_xfocus = win;
1016  }
1017  }
1018  // take focus from the old focused window
1019  fl_oldfocus = 0;
1020  int old_event = e_number;
1021  e_number = FL_UNFOCUS;
1022  for (; p; p = p->parent()) {
1023  p->handle(FL_UNFOCUS);
1024  fl_oldfocus = p;
1025  }
1026  e_number = old_event;
1027  }
1028 }
1029 
1030 static char dnd_flag = 0; // make 'belowmouse' send DND_LEAVE instead of LEAVE
1031 
1047  if (grab()) return; // don't do anything while grab is on
1048  Fl_Widget *p = belowmouse_;
1049  if (o != p) {
1050  belowmouse_ = o;
1051  int old_event = e_number;
1053  for (; p && !p->contains(o); p = p->parent()) {
1054  p->handle(e_number);
1055  }
1056  e_number = old_event;
1057  }
1058 }
1059 
1073  pushed_ = o;
1074 }
1075 
1076 static void nothing(Fl_Widget *) {}
1077 void (*Fl_Tooltip::enter)(Fl_Widget *) = nothing;
1078 void (*Fl_Tooltip::exit)(Fl_Widget *) = nothing;
1079 
1080 // Update modal(), focus() and other state according to system state,
1081 // and send FL_ENTER, FL_LEAVE, FL_FOCUS, and/or FL_UNFOCUS events.
1082 // This is the only function that produces these events in response
1083 // to system activity.
1084 // This is called whenever a window is added or hidden, and whenever
1085 // X says the focus or mouse window have changed.
1086 
1088 #ifdef DEBUG
1089  puts("fl_fix_focus();");
1090 #endif // DEBUG
1091 
1092  if (Fl::grab()) return; // don't do anything while grab is on.
1093 
1094  // set focus based on Fl::modal() and fl_xfocus
1095  Fl_Widget* w = fl_xfocus;
1096  if (w) {
1097  int saved = Fl::e_keysym;
1098  if (Fl::e_keysym < (FL_Button + FL_LEFT_MOUSE) ||
1100  Fl::e_keysym = 0; // make sure widgets don't think a keystroke moved focus
1101  while (w->parent()) w = w->parent();
1102  if (Fl::modal()) w = Fl::modal();
1103  if (!w->contains(Fl::focus()))
1104  if (!w->take_focus()) Fl::focus(w);
1105  Fl::e_keysym = saved;
1106  } else
1107  Fl::focus(0);
1108 
1109 // MRS: Originally we checked the button state, but a user reported that it
1110 // broke click-to-focus in FLWM?!?
1111 // if (!(Fl::event_state() & 0x7f00000 /*FL_BUTTONS*/)) {
1112  if (!Fl::pushed()) {
1113  // set belowmouse based on Fl::modal() and fl_xmousewin:
1114  w = fl_xmousewin;
1115  if (w) {
1116  if (Fl::modal()) w = Fl::modal();
1117  if (!w->contains(Fl::belowmouse())) {
1118  int old_event = Fl::e_number;
1120  Fl::e_number = old_event;
1121  if (!w->contains(Fl::belowmouse())) Fl::belowmouse(w);
1122  } else {
1123  // send a FL_MOVE event so the enter/leave state is up to date
1126  int old_event = Fl::e_number;
1127  w->handle(Fl::e_number = FL_MOVE);
1128  Fl::e_number = old_event;
1129  }
1130  } else {
1131  Fl::belowmouse(0);
1132  Fl_Tooltip::enter(0);
1133  }
1134  }
1135 }
1136 
1137 #if !(defined(WIN32) || defined(__APPLE__))
1138 extern Fl_Widget *fl_selection_requestor; // from Fl_x.cxx
1139 #endif
1140 
1141 // This function is called by ~Fl_Widget() and by Fl_Widget::deactivate()
1142 // and by Fl_Widget::hide(). It indicates that the widget does not want
1143 // to receive any more events, and also removes all global variables that
1144 // point at the widget.
1145 // I changed this from the 1.0.1 behavior, the older version could send
1146 // FL_LEAVE or FL_UNFOCUS events to the widget. This appears to not be
1147 // desirable behavior and caused flwm to crash.
1148 
1150 #ifdef DEBUG
1151  printf("fl_throw_focus(o=%p)\n", o);
1152 #endif // DEBUG
1153 
1154  if (o->contains(Fl::pushed())) Fl::pushed_ = 0;
1155 #if !(defined(WIN32) || defined(__APPLE__))
1157 #endif
1158  if (o->contains(Fl::belowmouse())) Fl::belowmouse_ = 0;
1159  if (o->contains(Fl::focus())) Fl::focus_ = 0;
1160  if (o == fl_xfocus) fl_xfocus = 0;
1162  if (o == fl_xmousewin) fl_xmousewin = 0;
1163  Fl_Tooltip::exit(o);
1164  fl_fix_focus();
1165 }
1166 
1168 
1169 // Find the first active_r() widget, starting at the widget wi and
1170 // walking up the widget hierarchy to the top level window.
1171 //
1172 // In other words: find_active() returns an active group that contains
1173 // the inactive widget and all inactive parent groups.
1174 //
1175 // This is used to send FL_SHORTCUT events to the Fl::belowmouse() widget
1176 // in case the target widget itself is inactive_r(). In this case the event
1177 // is sent to the first active_r() parent.
1178 //
1179 // This prevents sending events to inactive widgets that might get the
1180 // input focus otherwise. The search is fast and light and avoids calling
1181 // inactive_r() multiple times.
1182 // See STR #3216.
1183 //
1184 // Returns: first active_r() widget "above" the widget wi or NULL if
1185 // no widget is active. May return the top level window.
1186 
1188  Fl_Widget *found = 0;
1189  for (; wi; wi = wi->parent()) {
1190  if (wi->active()) {
1191  if (!found) found = wi;
1192  }
1193  else found = 0;
1194  }
1195  return found;
1196 }
1197 
1199 
1200 // Call to->handle(), but first replace the mouse x/y with the correct
1201 // values to account for nested windows. 'window' is the outermost
1202 // window the event was posted to by the system:
1203 static int send_event(int event, Fl_Widget* to, Fl_Window* window) {
1204  int dx, dy;
1205  int old_event = Fl::e_number;
1206  if (window) {
1207  dx = window->x();
1208  dy = window->y();
1209  } else {
1210  dx = dy = 0;
1211  }
1212  for (const Fl_Widget* w = to; w; w = w->parent())
1213  if (w->type()>=FL_WINDOW) {dx -= w->x(); dy -= w->y();}
1214  int save_x = Fl::e_x; Fl::e_x += dx;
1215  int save_y = Fl::e_y; Fl::e_y += dy;
1216  int ret = to->handle(Fl::e_number = event);
1217  Fl::e_number = old_event;
1218  Fl::e_y = save_y;
1219  Fl::e_x = save_x;
1220  return ret;
1221 }
1222 
1223 
1261 {
1262  e_dispatch = d;
1263 }
1264 
1265 
1270 {
1271  return e_dispatch;
1272 }
1273 
1274 
1292 {
1293  if (e_dispatch) {
1294  return e_dispatch(e, window);
1295  } else {
1296  return handle_(e, window);
1297  }
1298 }
1299 
1300 
1315 {
1316  e_number = e;
1317  if (fl_local_grab) return fl_local_grab(e);
1318 
1319  Fl_Widget* wi = window;
1320 
1321  switch (e) {
1322 
1323  case FL_CLOSE:
1324  if ( grab() || (modal() && window != modal()) ) return 0;
1325  wi->do_callback();
1326  return 1;
1327 
1328  case FL_SHOW:
1329  wi->Fl_Widget::show(); // this calls Fl_Widget::show(), not Fl_Window::show()
1330  return 1;
1331 
1332  case FL_HIDE:
1333  wi->Fl_Widget::hide(); // this calls Fl_Widget::hide(), not Fl_Window::hide()
1334  return 1;
1335 
1336  case FL_PUSH:
1337 #ifdef DEBUG
1338  printf("Fl::handle(e=%d, window=%p);\n", e, window);
1339 #endif // DEBUG
1340 
1341  if (grab()) wi = grab();
1342  else if (modal() && wi != modal()) return 0;
1343  pushed_ = wi;
1344  Fl_Tooltip::current(wi);
1345  if (send_event(e, wi, window)) return 1;
1346  // raise windows that are clicked on:
1347  window->show();
1348  return 1;
1349 
1350  case FL_DND_ENTER:
1351  case FL_DND_DRAG:
1352  dnd_flag = 1;
1353  break;
1354 
1355  case FL_DND_LEAVE:
1356  dnd_flag = 1;
1357  belowmouse(0);
1358  dnd_flag = 0;
1359  return 1;
1360 
1361  case FL_DND_RELEASE:
1362  wi = belowmouse();
1363  break;
1364 
1365  case FL_MOVE:
1366  case FL_DRAG:
1367  fl_xmousewin = window; // this should already be set, but just in case.
1368  if (pushed()) {
1369  wi = pushed();
1370  if (grab()) wi = grab();
1371  e_number = e = FL_DRAG;
1372  break;
1373  }
1374  if (modal() && wi != modal()) wi = 0;
1375  if (grab()) wi = grab();
1376  { int ret;
1377  Fl_Widget* pbm = belowmouse();
1378 #ifdef __APPLE__
1379  if (fl_mac_os_version < 100500) {
1380  // before 10.5, mouse moved events aren't sent to borderless windows such as tooltips
1381  Fl_Window *tooltip = Fl_Tooltip::current_window();
1382  int inside = 0;
1383  if (tooltip && tooltip->shown() ) { // check if a tooltip window is currently opened
1384  // check if mouse is inside the tooltip
1385  inside = (Fl::event_x_root() >= tooltip->x() && Fl::event_x_root() < tooltip->x() + tooltip->w() &&
1386  Fl::event_y_root() >= tooltip->y() && Fl::event_y_root() < tooltip->y() + tooltip->h() );
1387  }
1388  // if inside, send event to tooltip window instead of background window
1389  if (inside) ret = send_event(e, tooltip, window);
1390  else ret = (wi && send_event(e, wi, window));
1391  } else
1392 #endif
1393  ret = (wi && send_event(e, wi, window));
1394  if (pbm != belowmouse()) {
1395 #ifdef DEBUG
1396  printf("Fl::handle(e=%d, window=%p);\n", e, window);
1397 #endif // DEBUG
1399  }
1400  return ret;}
1401 
1402  case FL_RELEASE: {
1403 // printf("FL_RELEASE: window=%p, pushed() = %p, grab() = %p, modal() = %p\n",
1404 // window, pushed(), grab(), modal());
1405 
1406  if (grab()) {
1407  wi = grab();
1408  pushed_ = 0; // must be zero before callback is done!
1409  } else if (pushed()) {
1410  wi = pushed();
1411  pushed_ = 0; // must be zero before callback is done!
1412  } else if (modal() && wi != modal()) return 0;
1413  int r = send_event(e, wi, window);
1414  fl_fix_focus();
1415  return r;}
1416 
1417  case FL_UNFOCUS:
1418  window = 0;
1419  case FL_FOCUS:
1420  fl_xfocus = window;
1421  fl_fix_focus();
1422  return 1;
1423 
1424  case FL_KEYUP:
1425  // Send the key-up to the current focus widget. This is not
1426  // always the same widget that received the corresponding
1427  // FL_KEYBOARD event because focus may have changed.
1428  // Sending the KEYUP to the right KEYDOWN is possible, but
1429  // would require that we track the KEYDOWN for every possible
1430  // key stroke (users may hold down multiple keys!) and then
1431  // make sure that the widget still exists before sending
1432  // a KEYUP there. I believe that the current solution is
1433  // "close enough".
1434  for (wi = grab() ? grab() : focus(); wi; wi = wi->parent())
1435  if (send_event(FL_KEYUP, wi, window)) return 1;
1436  return 0;
1437 
1438  case FL_KEYBOARD:
1439 #ifdef DEBUG
1440  printf("Fl::handle(e=%d, window=%p);\n", e, window);
1441 #endif // DEBUG
1442 
1444 
1445  fl_xfocus = window; // this should not happen! But maybe it does:
1446 
1447  // Try it as keystroke, sending it to focus and all parents:
1448  for (wi = grab() ? grab() : focus(); wi; wi = wi->parent())
1449  if (send_event(FL_KEYBOARD, wi, window)) return 1;
1450 
1451  // recursive call to try shortcut:
1452  if (handle(FL_SHORTCUT, window)) return 1;
1453 
1454  // and then try a shortcut with the case of the text swapped, by
1455  // changing the text and falling through to FL_SHORTCUT case:
1456  {unsigned char* c = (unsigned char*)event_text(); // cast away const
1457  if (!isalpha(*c)) return 0;
1458  *c = isupper(*c) ? tolower(*c) : toupper(*c);}
1459  e_number = e = FL_SHORTCUT;
1460 
1461  case FL_SHORTCUT:
1462  if (grab()) {wi = grab(); break;} // send it to grab window
1463 
1464  // Try it as shortcut, sending to mouse widget and all parents:
1465  wi = find_active(belowmouse()); // STR #3216
1466  if (!wi) {
1467  wi = modal();
1468  if (!wi) wi = window;
1469  } else if (wi->window() != first_window()) {
1470  if (send_event(FL_SHORTCUT, first_window(), first_window())) return 1;
1471  }
1472 
1473  for (; wi; wi = wi->parent()) {
1474  if (send_event(FL_SHORTCUT, wi, wi->window())) return 1;
1475  }
1476 
1477  // try using add_handle() functions:
1478  if (send_handlers(FL_SHORTCUT)) return 1;
1479 
1480  // make Escape key close windows:
1481  if (event_key()==FL_Escape) {
1482  wi = modal(); if (!wi) wi = window;
1483  wi->do_callback();
1484  return 1;
1485  }
1486 
1487  return 0;
1488 
1489  case FL_ENTER:
1490 #ifdef DEBUG
1491  printf("Fl::handle(e=%d, window=%p);\n", e, window);
1492 #endif // DEBUG
1493 
1494  fl_xmousewin = window;
1495  fl_fix_focus();
1497  return 1;
1498 
1499  case FL_LEAVE:
1500 #ifdef DEBUG
1501  printf("Fl::handle(e=%d, window=%p);\n", e, window);
1502 #endif // DEBUG
1503 
1504  if (!pushed_) {
1505  belowmouse(0);
1506  Fl_Tooltip::enter(0);
1507  }
1508  if (window == fl_xmousewin) {fl_xmousewin = 0; fl_fix_focus();}
1509  return 1;
1510 
1511  case FL_MOUSEWHEEL:
1512  fl_xfocus = window; // this should not happen! But maybe it does:
1513 
1514  // Try sending it to the "grab" first
1515  if (grab() && grab()!=modal() && grab()!=window) {
1516  if (send_event(FL_MOUSEWHEEL, grab(), window)) return 1;
1517  }
1518  // Now try sending it to the "modal" window
1519  if (modal()) {
1521  return 1;
1522  }
1523  // Finally try sending it to the window, the event occured in
1524  if (send_event(FL_MOUSEWHEEL, window, window)) return 1;
1525  default:
1526  break;
1527  }
1528  if (wi && send_event(e, wi, window)) {
1529  dnd_flag = 0;
1530  return 1;
1531  }
1532  dnd_flag = 0;
1533  return send_handlers(e);
1534 }
1535 
1537 // hide() destroys the X window, it does not do unmap!
1538 
1539 #if defined(WIN32)
1540 extern void fl_clipboard_notify_retarget(HWND wnd);
1541 extern void fl_update_clipboard(void);
1542 #elif USE_XFT
1543 extern void fl_destroy_xft_draw(Window);
1544 #endif
1545 
1547 #ifdef WIN32
1548  // STR#3079: if there remains a window and a non-modal window, and the window is deleted,
1549  // the app remains running without any apparent window.
1550  // Bug mechanism: hiding an owner window unmaps the owned (non-modal) window(s)
1551  // but does not delete it(them) in FLTK.
1552  // Fix for it:
1553  // when hiding a window, build list of windows it owns, and do hide/show on them.
1554  int count = 0;
1555  Fl_Window *win, **doit = NULL;
1556  for (win = Fl::first_window(); win && i; win = Fl::next_window(win)) {
1557  if (win->non_modal() && GetWindow(fl_xid(win), GW_OWNER) == i->xid) {
1558  count++;
1559  }
1560  }
1561  if (count) {
1562  doit = new Fl_Window*[count];
1563  count = 0;
1564  for (win = Fl::first_window(); win && i; win = Fl::next_window(win)) {
1565  if (win->non_modal() && GetWindow(fl_xid(win), GW_OWNER) == i->xid) {
1566  doit[count++] = win;
1567  }
1568  }
1569  }
1570 #endif
1571  clear_visible();
1572 
1573  if (!shown()) return;
1574 
1575  // remove from the list of windows:
1576  Fl_X* ip = i;
1577  Fl_X** pp = &Fl_X::first;
1578  for (; *pp != ip; pp = &(*pp)->next) if (!*pp) return;
1579  *pp = ip->next;
1580 #ifdef __APPLE__
1581  // MacOS X manages a single pointer per application. Make sure that hiding
1582  // a toplevel window will not leave us with some random pointer shape, or
1583  // worst case, an invisible pointer
1584  if (!parent()) cursor(FL_CURSOR_DEFAULT);
1585 #endif
1586  i = 0;
1587 
1588  // recursively remove any subwindows:
1589  for (Fl_X *wi = Fl_X::first; wi;) {
1590  Fl_Window* W = wi->w;
1591  if (W->window() == this) {
1592  W->hide();
1593  W->set_visible();
1594  wi = Fl_X::first;
1595  } else wi = wi->next;
1596  }
1597 
1598  if (this == Fl::modal_) { // we are closing the modal window, find next one:
1599  Fl_Window* W;
1600  for (W = Fl::first_window(); W; W = Fl::next_window(W))
1601  if (W->modal()) break;
1602  Fl::modal_ = W;
1603  }
1604 
1605  // Make sure no events are sent to this window:
1606  fl_throw_focus(this);
1607  handle(FL_HIDE);
1608 
1609 #if defined(WIN32)
1610  // make sure any custom icons get freed
1611  icons(NULL, 0);
1612  // this little trick keeps the current clipboard alive, even if we are about
1613  // to destroy the window that owns the selection.
1614  if (GetClipboardOwner()==ip->xid)
1616  // Make sure we unlink this window from the clipboard chain
1618  // Send a message to myself so that I'll get out of the event loop...
1619  PostMessage(ip->xid, WM_APP, 0, 0);
1620  if (ip->private_dc) fl_release_dc(ip->xid, ip->private_dc);
1621  if (ip->xid == fl_window && fl_gc) {
1623  fl_window = (HWND)-1;
1624  fl_gc = 0;
1625 # ifdef FLTK_USE_CAIRO
1626  if (Fl::cairo_autolink_context()) Fl::cairo_make_current((Fl_Window*) 0);
1627 # endif
1628  }
1629 #elif defined(__APPLE_QUARTZ__)
1630  Fl_X::q_release_context(ip);
1631  if ( ip->xid == fl_window )
1632  fl_window = 0;
1633 #endif
1634 
1635  if (ip->region) XDestroyRegion(ip->region);
1636 
1637 #if defined(USE_X11)
1638 # if USE_XFT
1639  fl_destroy_xft_draw(ip->xid);
1640 # endif
1641  // this test makes sure ip->xid has not been destroyed already
1642  if (ip->xid) XDestroyWindow(fl_display, ip->xid);
1643 #elif defined(WIN32)
1644  // this little trickery seems to avoid the popup window stacking problem
1645  HWND p = GetForegroundWindow();
1646  if (p==GetParent(ip->xid)) {
1647  ShowWindow(ip->xid, SW_HIDE);
1648  ShowWindow(p, SW_SHOWNA);
1649  }
1650  XDestroyWindow(fl_display, ip->xid);
1651  // end of fix for STR#3079
1652  if (count) {
1653  int ii;
1654  for (ii = 0; ii < count; ii++) doit[ii]->hide();
1655  for (ii = 0; ii < count; ii++) {
1656  if (ii != 0) doit[0]->show(); // Fix for STR#3165
1657  doit[ii]->show();
1658  }
1659  delete[] doit;
1660  }
1661 #elif defined(__APPLE_QUARTZ__)
1662  ip->destroy();
1663 #else
1664 # error unsupported platform
1665 #endif
1666 
1667 #ifdef WIN32
1668  // Try to stop the annoying "raise another program" behavior
1669  if (non_modal() && Fl::first_window() && Fl::first_window()->shown())
1670  Fl::first_window()->show();
1671 #endif
1672  delete ip;
1673 }
1674 
1675 
1676 // FL_SHOW and FL_HIDE are called whenever the visibility of this widget
1677 // or any parent changes. We must correctly map/unmap the system's window.
1678 
1679 // For top-level windows it is assumed the window has already been
1680 // mapped or unmapped!!! This is because this should only happen when
1681 // Fl_Window::show() or Fl_Window::hide() is called, or in response to
1682 // iconize/deiconize events from the system.
1683 
1685 {
1686  if (parent()) {
1687  switch (ev) {
1688  case FL_SHOW:
1689  if (!shown()) show();
1690  else {
1691 #if defined(USE_X11) || defined(WIN32)
1692  XMapWindow(fl_display, fl_xid(this)); // extra map calls are harmless
1693 #elif defined(__APPLE_QUARTZ__)
1694  i->map();
1695 #else
1696 # error unsupported platform
1697 #endif // __APPLE__
1698  }
1699  break;
1700  case FL_HIDE:
1701  if (shown()) {
1702  // Find what really turned invisible, if it was a parent window
1703  // we do nothing. We need to avoid unnecessary unmap calls
1704  // because they cause the display to blink when the parent is
1705  // remapped. However if this or any intermediate non-window
1706  // widget has really had hide() called directly on it, we must
1707  // unmap because when the parent window is remapped we don't
1708  // want to reappear.
1709  if (visible()) {
1710  Fl_Widget* p = parent(); for (;p->visible();p = p->parent()) {}
1711  if (p->type() >= FL_WINDOW) break; // don't do the unmap
1712  }
1713 #if defined(USE_X11) || defined(WIN32)
1714  XUnmapWindow(fl_display, fl_xid(this));
1715 #elif defined(__APPLE_QUARTZ__)
1716  i->unmap();
1717 #else
1718 # error platform unsupported
1719 #endif
1720  }
1721  break;
1722  }
1723 // } else if (ev == FL_FOCUS || ev == FL_UNFOCUS) {
1724 // Fl_Tooltip::exit(Fl_Tooltip::current());
1725  }
1726 
1727  return Fl_Group::handle(ev);
1728 }
1729 
1731 // Back compatibility cut & paste functions for fltk 1.1 only:
1732 
1746 
1754 void Fl::selection(Fl_Widget &owner, const char* text, int len) {
1755  selection_owner_ = &owner;
1756  Fl::copy(text, len, 0);
1757 }
1758 
1763 void Fl::paste(Fl_Widget &receiver) {
1764  Fl::paste(receiver, 0);
1765 }
1766 #if FLTK_ABI_VERSION >= 10303
1767 #elif !defined(FL_DOXYGEN)
1768 void Fl::paste(Fl_Widget &receiver, int source)
1769 {
1770  Fl::paste(receiver, source, Fl::clipboard_plain_text);
1771 }
1772 
1773 void Fl::copy(const char* stuff, int len, int destination) {
1774  Fl::copy(stuff, len, destination, Fl::clipboard_plain_text);
1775 }
1776 
1777 #endif
1778 
1780 #include <FL/fl_draw.H>
1781 
1784 }
1785 
1787  if (window()) {
1788  if (box() == FL_NO_BOX) {
1789  // Widgets with the FL_NO_BOX boxtype need a parent to
1790  // redraw, since it is responsible for redrawing the
1791  // background...
1792  int X = x() > 0 ? x() - 1 : 0;
1793  int Y = y() > 0 ? y() - 1 : 0;
1794  window()->damage(FL_DAMAGE_ALL, X, Y, w() + 2, h() + 2);
1795  }
1796 
1797  if (align() && !(align() & FL_ALIGN_INSIDE) && window()->shown()) {
1798  // If the label is not inside the widget, compute the location of
1799  // the label and redraw the window within that bounding box...
1800  int W = 0, H = 0;
1801  label_.measure(W, H);
1802  W += 5; // Add a little to the size of the label to cover overflow
1803  H += 5;
1804 
1805  // FIXME:
1806  // This assumes that measure() returns the correct outline, which it does
1807  // not in all possible cases of alignment combinedwith image and symbols.
1808  switch (align() & 0x0f) {
1809  case FL_ALIGN_TOP_LEFT:
1810  window()->damage(FL_DAMAGE_EXPOSE, x(), y()-H, W, H); break;
1811  case FL_ALIGN_TOP:
1812  window()->damage(FL_DAMAGE_EXPOSE, x()+(w()-W)/2, y()-H, W, H); break;
1813  case FL_ALIGN_TOP_RIGHT:
1814  window()->damage(FL_DAMAGE_EXPOSE, x()+w()-W, y()-H, W, H); break;
1815  case FL_ALIGN_LEFT_TOP:
1816  window()->damage(FL_DAMAGE_EXPOSE, x()-W, y(), W, H); break;
1817  case FL_ALIGN_RIGHT_TOP:
1818  window()->damage(FL_DAMAGE_EXPOSE, x()+w(), y(), W, H); break;
1819  case FL_ALIGN_LEFT:
1820  window()->damage(FL_DAMAGE_EXPOSE, x()-W, y()+(h()-H)/2, W, H); break;
1821  case FL_ALIGN_RIGHT:
1822  window()->damage(FL_DAMAGE_EXPOSE, x()+w(), y()+(h()-H)/2, W, H); break;
1823  case FL_ALIGN_LEFT_BOTTOM:
1824  window()->damage(FL_DAMAGE_EXPOSE, x()-W, y()+h()-H, W, H); break;
1825  case FL_ALIGN_RIGHT_BOTTOM:
1826  window()->damage(FL_DAMAGE_EXPOSE, x()+w(), y()+h()-H, W, H); break;
1827  case FL_ALIGN_BOTTOM_LEFT:
1828  window()->damage(FL_DAMAGE_EXPOSE, x(), y()+h(), W, H); break;
1829  case FL_ALIGN_BOTTOM:
1830  window()->damage(FL_DAMAGE_EXPOSE, x()+(w()-W)/2, y()+h(), W, H); break;
1831  case FL_ALIGN_BOTTOM_RIGHT:
1832  window()->damage(FL_DAMAGE_EXPOSE, x()+w()-W, y()+h(), W, H); break;
1833  default:
1834  window()->damage(FL_DAMAGE_ALL); break;
1835  }
1836  } else {
1837  // The label is inside the widget, so just redraw the widget itself...
1839  }
1840  }
1841 }
1842 
1844  if (type() < FL_WINDOW) {
1845  // damage only the rectangle covered by a child widget:
1846  damage(fl, x(), y(), w(), h());
1847  } else {
1848  // damage entire window by deleting the region:
1849  Fl_X* i = Fl_X::i((Fl_Window*)this);
1850  if (!i) return; // window not mapped, so ignore it
1851  if (i->region) {XDestroyRegion(i->region); i->region = 0;}
1852  damage_ |= fl;
1854  }
1855 }
1856 
1857 void Fl_Widget::damage(uchar fl, int X, int Y, int W, int H) {
1858  Fl_Widget* wi = this;
1859  // mark all parent widgets between this and window with FL_DAMAGE_CHILD:
1860  while (wi->type() < FL_WINDOW) {
1861  wi->damage_ |= fl;
1862  wi = wi->parent();
1863  if (!wi) return;
1864  fl = FL_DAMAGE_CHILD;
1865  }
1866  Fl_X* i = Fl_X::i((Fl_Window*)wi);
1867  if (!i) return; // window not mapped, so ignore it
1868 
1869  // clip the damage to the window and quit if none:
1870  if (X < 0) {W += X; X = 0;}
1871  if (Y < 0) {H += Y; Y = 0;}
1872  if (W > wi->w()-X) W = wi->w()-X;
1873  if (H > wi->h()-Y) H = wi->h()-Y;
1874  if (W <= 0 || H <= 0) return;
1875 
1876  if (!X && !Y && W==wi->w() && H==wi->h()) {
1877  // if damage covers entire window delete region:
1878  wi->damage(fl);
1879  return;
1880  }
1881 
1882  if (wi->damage()) {
1883  // if we already have damage we must merge with existing region:
1884  if (i->region) {
1885 #if defined(USE_X11)
1886  XRectangle R;
1887  R.x = X; R.y = Y; R.width = W; R.height = H;
1888  XUnionRectWithRegion(&R, i->region, i->region);
1889 #elif defined(WIN32)
1890  Fl_Region R = XRectangleRegion(X, Y, W, H);
1891  CombineRgn(i->region, i->region, R, RGN_OR);
1892  XDestroyRegion(R);
1893 #elif defined(__APPLE_QUARTZ__)
1894  CGRect arg = fl_cgrectmake_cocoa(X, Y, W, H);
1895  int j; // don't add a rectangle totally inside the Fl_Region
1896  for(j = 0; j < i->region->count; j++) {
1897  if(CGRectContainsRect(i->region->rects[j], arg)) break;
1898  }
1899  if( j >= i->region->count) {
1900  i->region->rects = (CGRect*)realloc(i->region->rects, (++(i->region->count)) * sizeof(CGRect));
1901  i->region->rects[i->region->count - 1] = arg;
1902  }
1903 #else
1904 # error unsupported platform
1905 #endif
1906  }
1907  wi->damage_ |= fl;
1908  } else {
1909  // create a new region:
1910  if (i->region) XDestroyRegion(i->region);
1911  i->region = XRectangleRegion(X,Y,W,H);
1912  wi->damage_ = fl;
1913  }
1915 }
1917  if (!shown()) return;
1918  make_current();
1919 //if (damage() == FL_DAMAGE_EXPOSE && can_boxcheat(box())) fl_boxcheat = this;
1920  fl_clip_region(i->region); i->region = 0;
1921  draw();
1922 }
1923 
1924 #ifdef WIN32
1925 # include "Fl_win32.cxx"
1926 //#elif defined(__APPLE__)
1927 #endif
1928 
1929 
1930 //
1931 // The following methods allow callbacks to schedule the deletion of
1932 // widgets at "safe" times.
1933 //
1934 
1935 
1936 static int num_dwidgets = 0, alloc_dwidgets = 0;
1937 static Fl_Widget **dwidgets = 0;
1938 
1939 
1967  if (!wi) return;
1968 
1969  // if the widget is shown(), hide() it (FLTK 1.3.4)
1970  if (wi->visible_r()) wi->hide();
1971  Fl_Window *win = wi->as_window();
1972  if (win && win->shown()) win->hide(); // case of iconified window
1973 
1974  // don't add the same widget twice to the widget delete list
1975  for (int i = 0; i < num_dwidgets; i++) {
1976  if (dwidgets[i]==wi) return;
1977  }
1978 
1979  if (num_dwidgets >= alloc_dwidgets) {
1980  Fl_Widget **temp;
1981 
1982  temp = new Fl_Widget *[alloc_dwidgets + 10];
1983  if (alloc_dwidgets) {
1984  memcpy(temp, dwidgets, alloc_dwidgets * sizeof(Fl_Widget *));
1985  delete[] dwidgets;
1986  }
1987 
1988  dwidgets = temp;
1989  alloc_dwidgets += 10;
1990  }
1991 
1992  dwidgets[num_dwidgets] = wi;
1993  num_dwidgets ++;
1994 }
1995 
1996 
2009  if (!num_dwidgets) return;
2010 
2011  for (int i = 0; i < num_dwidgets; i ++)
2012  delete dwidgets[i];
2013 
2014  num_dwidgets = 0;
2015 }
2016 
2017 
2018 static Fl_Widget ***widget_watch = 0;
2019 static int num_widget_watch = 0;
2020 static int max_widget_watch = 0;
2021 
2022 
2069 {
2070  Fl_Widget **wp = &w;
2071  int i;
2072  for (i=0; i<num_widget_watch; ++i) {
2073  if (widget_watch[i]==wp) return;
2074  }
2076  max_widget_watch += 8;
2077  widget_watch = (Fl_Widget***)realloc(widget_watch, sizeof(Fl_Widget**)*max_widget_watch);
2078  }
2080 #ifdef DEBUG_WATCH
2081  printf ("\nwatch_widget_pointer: (%d/%d) %8p => %8p\n",
2083  fflush(stdout);
2084 #endif // DEBUG_WATCH
2085 }
2086 
2087 
2099 {
2100  Fl_Widget **wp = &w;
2101  int i,j=0;
2102  for (i=0; i<num_widget_watch; ++i) {
2103  if (widget_watch[i]!=wp) {
2104  if (j<i) widget_watch[j] = widget_watch[i]; // fill gap
2105  j++;
2106  }
2107 #ifdef DEBUG_WATCH
2108  else { // found widget pointer
2109  printf ("release_widget_pointer: (%d/%d) %8p => %8p\n",
2110  i+1,num_widget_watch,wp,*wp);
2111  }
2112 #endif //DEBUG_WATCH
2113  }
2114  num_widget_watch = j;
2115 #ifdef DEBUG_WATCH
2116  printf (" num_widget_watch = %d\n\n",num_widget_watch);
2117  fflush(stdout);
2118 #endif // DEBUG_WATCH
2119  return;
2120 }
2121 
2122 
2140 {
2141  if (w==0L) return;
2142  int i;
2143  for (i=0; i<num_widget_watch; ++i) {
2144  if (widget_watch[i] && *widget_watch[i]==w) {
2145  *widget_watch[i] = 0L;
2146  }
2147  }
2148 }
2149 
2150 
2183 {
2184  if (!options_read_) {
2185  int tmp;
2186  { // first, read the system wide preferences
2187  Fl_Preferences prefs(Fl_Preferences::SYSTEM, "fltk.org", "fltk");
2188  Fl_Preferences opt_prefs(prefs, "options");
2189  opt_prefs.get("ArrowFocus", tmp, 0); // default: off
2191  //opt_prefs.get("NativeFilechooser", tmp, 1); // default: on
2192  //options_[OPTION_NATIVE_FILECHOOSER] = tmp;
2193  //opt_prefs.get("FilechooserPreview", tmp, 1); // default: on
2194  //options_[OPTION_FILECHOOSER_PREVIEW] = tmp;
2195  opt_prefs.get("VisibleFocus", tmp, 1); // default: on
2197  opt_prefs.get("DNDText", tmp, 1); // default: on
2198  options_[OPTION_DND_TEXT] = tmp;
2199  opt_prefs.get("ShowTooltips", tmp, 1); // default: on
2201  opt_prefs.get("FNFCUsesGTK", tmp, 1); // default: on
2203  }
2204  { // next, check the user preferences
2205  // override system options only, if the option is set ( >= 0 )
2206  Fl_Preferences prefs(Fl_Preferences::USER, "fltk.org", "fltk");
2207  Fl_Preferences opt_prefs(prefs, "options");
2208  opt_prefs.get("ArrowFocus", tmp, -1);
2209  if (tmp >= 0) options_[OPTION_ARROW_FOCUS] = tmp;
2210  //opt_prefs.get("NativeFilechooser", tmp, -1);
2211  //if (tmp >= 0) options_[OPTION_NATIVE_FILECHOOSER] = tmp;
2212  //opt_prefs.get("FilechooserPreview", tmp, -1);
2213  //if (tmp >= 0) options_[OPTION_FILECHOOSER_PREVIEW] = tmp;
2214  opt_prefs.get("VisibleFocus", tmp, -1);
2215  if (tmp >= 0) options_[OPTION_VISIBLE_FOCUS] = tmp;
2216  opt_prefs.get("DNDText", tmp, -1);
2217  if (tmp >= 0) options_[OPTION_DND_TEXT] = tmp;
2218  opt_prefs.get("ShowTooltips", tmp, -1);
2219  if (tmp >= 0) options_[OPTION_SHOW_TOOLTIPS] = tmp;
2220  opt_prefs.get("FNFCUsesGTK", tmp, -1);
2221  if (tmp >= 0) options_[OPTION_FNFC_USES_GTK] = tmp;
2222  }
2223  { // now, if the developer has registered this app, we could as for per-application preferences
2224  }
2225  options_read_ = 1;
2226  }
2227  if (opt<0 || opt>=OPTION_LAST)
2228  return false;
2229  return (bool)(options_[opt]!=0);
2230 }
2231 
2248 void Fl::option(Fl_Option opt, bool val)
2249 {
2250  if (opt<0 || opt>=OPTION_LAST)
2251  return;
2252  if (!options_read_) {
2253  // first read this option, so we don't override our setting later
2254  option(opt);
2255  }
2256  options_[opt] = val;
2257 }
2258 
2259 
2260 // Helper class Fl_Widget_Tracker
2261 
2266 {
2267  wp_ = wi;
2268  Fl::watch_widget_pointer(wp_); // add pointer to watch list
2269 }
2270 
2275 {
2276  Fl::release_widget_pointer(wp_); // remove pointer from watch list
2277 }
2278 
2279 int Fl::use_high_res_GL_ = 0;
2280 //
2281 // End of "$Id$".
2282 //
fl_xfocus
Fl_Window * fl_xfocus
Definition: Fl.cxx:148
FL_ALIGN_LEFT
const Fl_Align FL_ALIGN_LEFT
Definition: Enumerations.H:839
Fl_Widget::y
int y() const
Definition: Fl_Widget.H:289
Fl_Widget::visible_focus
void visible_focus(int v)
Definition: Fl_Widget.H:832
FL_DAMAGE_ALL
Definition: Enumerations.H:1112
Fl.H
Fl::modal
static Fl_Window * modal()
Definition: Fl.H:549
Fl::e_y
static int e_y
Definition: Fl.H:145
Fl_Event_Handler
int(* Fl_Event_Handler)(int event)
Definition: Fl.H:107
Fl_Widget::align
Fl_Align align() const
Definition: Fl_Widget.H:348
Fl_Mac_App_Menu::services
static const char * services
Definition: mac.H:315
FL_CLOSE
Definition: Enumerations.H:327
Fl_Window::show
virtual void show()
Definition: Fl_win32.cxx:2542
FL_HIDE
Definition: Enumerations.H:369
FL_DND_ENTER
Definition: Enumerations.H:401
FL_KEYUP
Definition: Enumerations.H:320
dwidgets
static Fl_Widget ** dwidgets
Definition: Fl.cxx:1937
Fl_Window::modal
unsigned int modal() const
Definition: Fl_Window.H:291
Fl_Widget::redraw_label
void redraw_label()
Definition: Fl.cxx:1786
Fl_Mac_App_Menu::about
static const char * about
Definition: mac.H:308
Fl::OPTION_VISIBLE_FOCUS
Definition: Fl.H:212
idle_cb::next
idle_cb * next
Definition: Fl_add_idle.cxx:27
fl_clipboard_notify_change
void fl_clipboard_notify_change()
Definition: Fl_win32.cxx:907
FL_UNFOCUS
Definition: Enumerations.H:288
FL_DND_RELEASE
Definition: Enumerations.H:417
find_active
static Fl_Widget * find_active(Fl_Widget *wi)
Definition: Fl.cxx:1187
get_wsock_mod
static HMODULE get_wsock_mod()
Definition: Fl_win32.cxx:124
Fl::add_check
static void add_check(Fl_Timeout_Handler, void *=0)
Definition: Fl.cxx:429
Fl::e_state
static int e_state
Definition: Fl.H:150
send_event
static int send_event(int event, Fl_Widget *to, Fl_Window *window)
Definition: Fl.cxx:1203
Fl::e_clipboard_data
static void * e_clipboard_data
Definition: Fl.H:156
FL_CURSOR_DEFAULT
Definition: Enumerations.H:1049
Fl_Preferences::USER
Preferences apply only to the current user.
Definition: Fl_Preferences.H:68
next_check
static Check * next_check
Definition: Fl.cxx:396
Fl::pushed_
static Fl_Widget * pushed_
Definition: Fl.H:160
Fl::e_is_click
static int e_is_click
Definition: Fl.H:152
Fl_Widget::window
Fl_Window * window() const
Definition: Fl_Window.cxx:118
Check::cb
void(* cb)(void *)
Definition: Fl.cxx:392
Fl_Clipboard_Notify_Handler
void(* Fl_Clipboard_Notify_Handler)(int source, void *data)
Definition: Fl.H:126
Fl::e_text
static char * e_text
Definition: Fl.H:154
FL_DRAG
Definition: Enumerations.H:268
Fl::belowmouse_
static Fl_Widget * belowmouse_
Definition: Fl.H:159
Fl::idle
static void(* idle)()
Definition: Fl.H:253
x.H
missed_timeout_by
static double missed_timeout_by
Definition: Fl.cxx:327
Fl::e_y_root
static int e_y_root
Definition: Fl.H:147
Fl::event_text
static const char * event_text()
Definition: Fl.H:792
Check::next
Check * next
Definition: Fl.cxx:394
fl_xmousewin
Fl_Window * fl_xmousewin
Definition: Fl.cxx:149
H
static int H
Definition: Fl_Tooltip.cxx:76
Clipboard_Notify::data
void * data
Definition: Fl.cxx:496
Fl::has_timeout
static int has_timeout(Fl_Timeout_Handler, void *=0)
Definition: Fl.cxx:355
Fl::modal_
static Fl_Window * modal_
Definition: Fl.H:164
Fl::paste
static void paste(Fl_Widget &receiver, int source, const char *type)
Definition: Fl_win32.cxx:704
max_widget_watch
static int max_widget_watch
Definition: Fl.cxx:2020
fl_local_grab
int(* fl_local_grab)(int)
Definition: Fl.cxx:886
Fl::compose_reset
static void compose_reset()
Definition: Fl_compose.cxx:141
handlers
static handler_link * handlers
Definition: Fl.cxx:832
Fl_Widget::x
int x() const
Definition: Fl_Widget.H:284
NULL
#define NULL
Definition: forms.H:34
Fl_Widget::set_visible
void set_visible()
Definition: Fl_Widget.H:696
window
static Fl_TooltipBox * window
Definition: Fl_Tooltip.cxx:75
Fl::e_number
static int e_number
Definition: Fl.H:143
fl_local_alt
const char * fl_local_alt
string pointer used in shortcuts, you can change it to another language
Definition: Fl.cxx:95
Fl_Widget_Tracker::wp_
Fl_Widget * wp_
Definition: Fl.H:1373
Fl_Event_Dispatch
int(* Fl_Event_Dispatch)(int event, Fl_Window *w)
Definition: Fl.H:123
Fl_Widget::do_callback
void do_callback()
Definition: Fl_Widget.H:861
FL_API_VERSION
#define FL_API_VERSION
Definition: Enumerations.H:123
Fl::clipboard_plain_text
static const char *const clipboard_plain_text
Definition: Fl.H:956
Fl::redraw
static void redraw()
Definition: Fl.cxx:782
FL_WINDOW
#define FL_WINDOW
window type id all subclasses have type() >= this
Definition: Fl_Window.H:33
FL_LEAVE
Definition: Enumerations.H:259
Fl::event_key
static int event_key()
Definition: Fl.H:723
Clipboard_Notify::next
struct Clipboard_Notify * next
Definition: Fl.cxx:497
num_widget_watch
static int num_widget_watch
Definition: Fl.cxx:2019
fl_cleanup_pens
void fl_cleanup_pens(void)
Definition: fl_color_win32.cxx:46
FL_RIGHT_MOUSE
#define FL_RIGHT_MOUSE
The right mouse button.
Definition: Enumerations.H:542
Fl::OPTION_ARROW_FOCUS
Definition: Fl.H:197
Fl::e_x_root
static int e_x_root
Definition: Fl.H:146
FL_ALIGN_BOTTOM_LEFT
const Fl_Align FL_ALIGN_BOTTOM_LEFT
Definition: Enumerations.H:860
fl_clipboard_notify_retarget
void fl_clipboard_notify_retarget(HWND wnd)
Definition: Fl_win32.cxx:894
Fl::OPTION_SHOW_TOOLTIPS
Definition: Fl.H:220
CGContextFlush
#define CGContextFlush(a)
Definition: cgdebug.h:175
fl_local_shift
const char * fl_local_shift
string pointer used in shortcuts, you can change it to another language
Definition: Fl.cxx:98
Fl_Widget::label_
Fl_Label label_
Definition: Fl_Widget.H:108
Timeout
Definition: Fl.cxx:292
Fl::h
static int h()
Definition: Fl_win32.cxx:571
Fl_Widget::as_window
virtual Fl_Window * as_window()
Definition: Fl_Widget.H:1000
Fl_Widget::w
int w() const
Definition: Fl_Widget.H:294
Fl::e_clipboard_type
static const char * e_clipboard_type
Definition: Fl.H:157
FL_ALIGN_INSIDE
const Fl_Align FL_ALIGN_INSIDE
Definition: Enumerations.H:843
Fl::first_window
static Fl_Window * first_window()
Definition: Fl.cxx:751
Fl::belowmouse
static Fl_Widget * belowmouse()
Definition: Fl.H:833
Fl::e_clicks
static int e_clicks
Definition: Fl.H:151
free_timeout
static Timeout * free_timeout
Definition: Fl.cxx:298
FL_ALIGN_LEFT_BOTTOM
const Fl_Align FL_ALIGN_LEFT_BOTTOM
Definition: Enumerations.H:864
Fl_Window.H
Fl_Widget::clear_visible
void clear_visible()
Definition: Fl_Widget.H:702
Fl_Window::make_current
void make_current()
Definition: Fl_win32.cxx:2590
FL_DND_LEAVE
Definition: Enumerations.H:411
Fl::OPTION_DND_TEXT
Definition: Fl.H:216
Fl::check
static int check()
Definition: Fl.cxx:688
Fl::damage_
static int damage_
Definition: Fl.H:162
num_dwidgets
static int num_dwidgets
Definition: Fl.cxx:1936
FL_DND_DRAG
Definition: Enumerations.H:407
p
static menustate * p
Definition: Fl_Menu.cxx:606
Fl_Widget::w
void w(int v)
Definition: Fl_Widget.H:143
Fl::options_
static unsigned char options_[OPTION_LAST]
Definition: Fl.H:231
Fl_Widget::x
void x(int v)
Definition: Fl_Widget.H:139
send_handlers
static int send_handlers(int e)
Definition: Fl.cxx:888
Fl::do_widget_deletion
static void do_widget_deletion()
Definition: Fl.cxx:2008
Fl_Mac_App_Menu::hide_others
static const char * hide_others
Definition: mac.H:319
FL_MOVE
Definition: Enumerations.H:335
FL_MOUSEWHEEL
Definition: Enumerations.H:395
FL_ALIGN_TOP_LEFT
const Fl_Align FL_ALIGN_TOP_LEFT
Definition: Enumerations.H:858
Timeout::arg
void * arg
Definition: Fl.cxx:295
fl_draw.H
utility header to pull drawing functions together
Fl::option
static bool option(Fl_Option opt)
FLTK library options management.
Definition: Fl.cxx:2182
Fl_Mac_App_Menu::print
static const char * print
Definition: mac.H:313
arg
static int arg(int argc, char **argv, int &i)
Definition: fluid.cxx:1723
Fl::event_y_root
static int event_y_root()
Definition: Fl.H:617
Fl_Window::non_modal
unsigned int non_modal() const
Definition: Fl_Window.H:300
Fl::e_keysym
static int e_keysym
Definition: Fl.H:153
Fl::clipboard_image
static const char *const clipboard_image
Definition: Fl.H:959
first_check
static Check * first_check
Definition: Fl.cxx:396
fl_free_fonts
void fl_free_fonts(void)
Definition: Fl_win32.cxx:2611
Fl::next_window
static Fl_Window * next_window(const Fl_Window *)
Definition: Fl.cxx:761
alloc_dwidgets
static int alloc_dwidgets
Definition: Fl.cxx:1936
FL_FOCUS
Definition: Enumerations.H:283
Fl_Preferences::get
char get(const char *entry, int &value, int defaultValue)
Definition: Fl_Preferences.cxx:509
Fl_Window::flush
virtual void flush()
Definition: Fl.cxx:1916
Fl::e_dy
static int e_dy
Definition: Fl.H:149
Fl_Widget::visible
unsigned int visible() const
Definition: Fl_Widget.H:660
Fl_Window
Definition: Fl_Window.H:57
Fl_Widget::hide
virtual void hide()
Definition: Fl_Widget.cxx:283
in_idle
static char in_idle
Definition: Fl.cxx:488
Fl::selection
static void selection(Fl_Widget &owner, const char *, int len)
Definition: Fl.cxx:1754
elapse_timeouts
static void elapse_timeouts()
Definition: Fl.cxx:308
Fl::release_widget_pointer
static void release_widget_pointer(Fl_Widget *&w)
Definition: Fl.cxx:2098
clip_notify_list
static struct Clipboard_Notify * clip_notify_list
Definition: Fl.cxx:500
fl_selection_requestor
Fl_Widget * fl_selection_requestor
Definition: Fl_x.cxx:853
FL_PUSH
Definition: Enumerations.H:236
Fl::remove_check
static void remove_check(Fl_Timeout_Handler, void *=0)
Definition: Fl.cxx:444
Fl::event_dispatch
static Fl_Event_Dispatch event_dispatch()
Return the current event dispatch function.
Definition: Fl.cxx:1269
Fl::remove_clipboard_notify
static void remove_clipboard_notify(Fl_Clipboard_Notify_Handler h)
Definition: Fl.cxx:520
Fl_Widget::damage
uchar damage() const
Definition: Fl_Widget.H:917
sys_handlers
static system_handler_link * sys_handlers
Definition: Fl.cxx:906
Fl::add_clipboard_notify
static void add_clipboard_notify(Fl_Clipboard_Notify_Handler h, void *data=0)
Definition: Fl.cxx:504
cb
static void cb(Fl_Widget *, void *v)
Definition: factory.cxx:937
Fl::remove_timeout
static void remove_timeout(Fl_Timeout_Handler, void *=0)
Definition: Fl.cxx:368
Fl_Mac_App_Menu::show
static const char * show
Definition: mac.H:321
fl_display
FL_EXPORT HINSTANCE fl_display
END TIMERS.
Definition: Fl_win32.cxx:2147
Fl_Window::icons
void icons(const Fl_RGB_Image *[], int)
Definition: Fl_win32.cxx:2441
FL_ABI_VERSION
#define FL_ABI_VERSION
Definition: Enumerations.H:156
fl_brush_action
FL_EXPORT HBRUSH fl_brush_action(int)
Definition: fl_color_win32.cxx:126
Fl::repeat_timeout
static void repeat_timeout(double t, Fl_Timeout_Handler, void *=0)
Definition: Fl.cxx:334
Timeout::next
Timeout * next
Definition: Fl.cxx:296
Fl::OPTION_FNFC_USES_GTK
Definition: Fl.H:224
Clipboard_Notify::handler
Fl_Clipboard_Notify_Handler handler
Definition: Fl.cxx:495
Fl::version
static double version()
Definition: Fl.cxx:168
Fl_Mac_App_Menu::quit
static const char * quit
Definition: mac.H:323
Fl_Region
struct flCocoaRegion * Fl_Region
Definition: mac.H:38
Fl_Preferences::SYSTEM
Preferences are used system-wide.
Definition: Fl_Preferences.H:67
dnd_flag
static char dnd_flag
Definition: Fl.cxx:1030
Fl::x
static int x()
Definition: Fl_win32.cxx:555
Fl_Widget::redraw
void redraw()
Definition: Fl.cxx:1782
Fl_Widget_Tracker::Fl_Widget_Tracker
Fl_Widget_Tracker(Fl_Widget *wi)
Definition: Fl.cxx:2265
first
static idle_cb * first
Definition: Fl_add_idle.cxx:33
FOREVER
#define FOREVER
Definition: Fl.cxx:628
Fl_Widget
Definition: Fl_Widget.H:101
fl_wait
int fl_wait(double time)
Definition: Fl_win32.cxx:379
Fl_Tooltip::current
static Fl_Widget * current()
Definition: Fl_Tooltip.H:62
FL_Button
#define FL_Button
A mouse button; use Fl_Button + n for mouse button n.
Definition: Enumerations.H:467
FL_NO_BOX
nothing is drawn at all, this box is invisible
Definition: Enumerations.H:605
fl_wsk_fd_is_set_f
int(WINAPI * fl_wsk_fd_is_set_f)(SOCKET, fd_set *)
Definition: Fl_win32.cxx:112
Fl::focus
static Fl_Widget * focus()
Definition: Fl.H:840
FL_ALIGN_BOTTOM
const Fl_Align FL_ALIGN_BOTTOM
Definition: Enumerations.H:835
Fl_Widget::box
Fl_Boxtype box() const
Definition: Fl_Widget.H:363
Fl::use_high_res_GL_
static int use_high_res_GL_
Definition: Fl.H:136
Fl_Widget::h
int h() const
Definition: Fl_Widget.H:299
Fl_Window::shown
int shown()
Definition: Fl_Window.H:485
XRectangleRegion
Fl_Region XRectangleRegion(int x, int y, int w, int h)
Definition: fl_rect.cxx:532
fl_local_meta
const char * fl_local_meta
string pointer used in shortcuts, you can change it to another language
Definition: Fl.cxx:97
FL_KEYBOARD
Definition: Enumerations.H:315
Fl::pushed
static Fl_Widget * pushed()
Definition: Fl.H:837
Fl::copy
static void copy(const char *stuff, int len, int destination, const char *type)
Definition: Fl_win32.cxx:680
run_checks
static void run_checks()
Definition: Fl.cxx:473
Fl_Window::hide
virtual void hide()
Definition: Fl.cxx:1546
Fl::event_x_root
static int event_x_root()
Definition: Fl.H:610
Fl::e_dx
static int e_dx
Definition: Fl.H:148
Fl_Widget::h
void h(int v)
Definition: Fl_Widget.H:145
Fl::has_check
static int has_check(Fl_Timeout_Handler, void *=0)
Definition: Fl.cxx:461
Fl_Tooltip.H
nothing
static void nothing(Fl_Widget *)
Definition: Fl.cxx:1076
Fl_Label::measure
void measure(int &w, int &h) const
Definition: fl_labeltype.cxx:86
fl_update_clipboard
void fl_update_clipboard(void)
Definition: Fl_win32.cxx:648
Fl_Tooltip::enter
static void(* enter)(Fl_Widget *w)
Definition: Fl_Tooltip.H:58
FL_ALIGN_RIGHT_TOP
const Fl_Align FL_ALIGN_RIGHT_TOP
Definition: Enumerations.H:863
Fl_Widget::y
void y(int v)
Definition: Fl_Widget.H:141
FL_SHOW
Definition: Enumerations.H:377
Clipboard_Notify
Definition: Fl.cxx:494
Fl_Window::handle
virtual int handle(int)
Definition: Fl.cxx:1684
Fl::run
static int run()
Definition: Fl.cxx:637
fl_cleanup_dc_list
void fl_cleanup_dc_list(void)
Definition: Fl_win32.cxx:2691
Fl::scrollbar_size
static int scrollbar_size()
Definition: Fl.cxx:196
Fl_TooltipBox::show
void show()
Definition: Fl_Tooltip.cxx:59
reset_clock
static char reset_clock
Definition: Fl.cxx:306
Fl_Widget::handle
virtual int handle(int event)
Definition: Fl_Widget.cxx:112
fl_clip_region
void fl_clip_region(Fl_Region r)
Definition: fl_draw.H:136
fl_ready
int fl_ready()
Definition: Fl_win32.cxx:485
Fl::ready
static int ready()
Definition: Fl.cxx:711
Fl_Group::handle
int handle(int)
Definition: Fl_Group.cxx:147
fl_release_dc
void fl_release_dc(HWND w, HDC dc)
Definition: Fl_win32.cxx:2669
Fl_Window::cursor
void cursor(Fl_Cursor)
Definition: fl_cursor.cxx:111
Fl_win32.cxx
Fl_Widget::active
unsigned int active() const
Definition: Fl_Widget.H:708
FL_ALIGN_RIGHT_BOTTOM
const Fl_Align FL_ALIGN_RIGHT_BOTTOM
Definition: Enumerations.H:865
Fl_Widget::visible_r
int visible_r() const
Definition: Fl_Widget.cxx:295
Fl_Widget::damage_
uchar damage_
Definition: Fl_Widget.H:113
FL_DAMAGE_EXPOSE
Definition: Enumerations.H:1107
Fl::wait
static int wait()
Definition: Fl.cxx:666
widget_watch
static Fl_Widget *** widget_watch
Definition: Fl.cxx:2018
Fl::flush
static void flush()
Definition: Fl.cxx:797
Fl_Widget::clear_damage
void clear_damage(uchar c=0)
Definition: Fl_Widget.H:931
FL_ALIGN_TOP
const Fl_Align FL_ALIGN_TOP
Definition: Enumerations.H:833
Fl_Tooltip::exit
static void(* exit)(Fl_Widget *w)
Definition: Fl_Tooltip.H:60
Fl::add_timeout
static void add_timeout(double t, Fl_Timeout_Handler, void *=0)
Definition: Fl.cxx:329
fl_throw_focus
void fl_throw_focus(Fl_Widget *o)
Definition: Fl.cxx:1149
FL_SHORTCUT
Definition: Enumerations.H:349
dy
uchar dy
Definition: fl_boxtype.cxx:286
opt
static int opt[10][2]
Definition: alignment_panel.cxx:545
fl_gc
CGContextRef fl_gc
Definition: Fl_win32.cxx:2568
first_timeout
static Timeout * first_timeout
Definition: Fl.cxx:298
Fl::grab_
static Fl_Window * grab_
Definition: Fl.H:165
Fl_Window::draw
virtual void draw()
Definition: Fl_Window_shape.cxx:340
fl_wsk_fd_is_set
static fl_wsk_fd_is_set_f fl_wsk_fd_is_set
Definition: Fl_win32.cxx:113
Fl::options_read_
static unsigned char options_read_
Definition: Fl.H:232
Fl::handle
static int handle(int, Fl_Window *)
Handle events from the window system.
Definition: Fl.cxx:1291
Fl_Preferences
Fl_Preferences provides methods to store user settings between application starts.
Definition: Fl_Preferences.H:60
Fl::e_dispatch
static Fl_Event_Dispatch e_dispatch
Definition: Fl.H:158
Fl_Widget::contains
int contains(const Fl_Widget *w) const
Definition: Fl_Widget.cxx:303
Fl_Widget_Tracker::~Fl_Widget_Tracker
~Fl_Widget_Tracker()
Definition: Fl.cxx:2274
Fl::focus_
static Fl_Widget * focus_
Definition: Fl.H:161
Fl::e_x
static int e_x
Definition: Fl.H:144
Fl_Widget::type
uchar type() const
Definition: Fl_Widget.H:274
Fl::abi_version
static int abi_version()
Definition: Fl.cxx:184
Fl::watch_widget_pointer
static void watch_widget_pointer(Fl_Widget *&w)
Definition: Fl.cxx:2068
FL_ALIGN_TOP_RIGHT
const Fl_Align FL_ALIGN_TOP_RIGHT
Definition: Enumerations.H:859
Fl::clear_widget_pointer
static void clear_widget_pointer(Fl_Widget const *w)
Definition: Fl.cxx:2139
Fl_Widget::parent
Fl_Group * parent() const
Definition: Fl_Widget.H:254
Fl::e_length
static int e_length
Definition: Fl.H:155
Fl_Timeout_Handler
void(* Fl_Timeout_Handler)(void *data)
Definition: Fl.H:92
Y
static int Y
Definition: Fl_Tooltip.cxx:76
flstring.h
Fl::Fl_Option
Fl_Option
Definition: Fl.H:187
fl_oldfocus
Fl_Widget * fl_oldfocus
Definition: Fl.cxx:973
fl_find
Fl_Window * fl_find(Window xid)
Definition: Fl.cxx:730
Fl_Window::i
Fl_X * i
Definition: Fl_Window.H:97
fl_fix_focus
void fl_fix_focus()
Definition: Fl.cxx:1087
Fl::scrollbar_size_
static int scrollbar_size_
Definition: Fl.H:265
Timeout::time
double time
Definition: Fl.cxx:293
Fl::selection_owner
static Fl_Widget * selection_owner()
Definition: Fl.H:975
free_check
static Check * free_check
Definition: Fl.cxx:396
Fl_Mac_App_Menu::hide
static const char * hide
Definition: mac.H:317
fl_destroy_xft_draw
void fl_destroy_xft_draw(Window id)
Definition: fl_font_xft.cxx:571
Fl::add_handler
static void add_handler(Fl_Event_Handler h)
Definition: Fl.cxx:858
fl_mac_os_version
int fl_mac_os_version
The version number of the running Mac OS X (e.g., 100604 for 10.6.4)
fl_trigger_clipboard_notify
void fl_trigger_clipboard_notify(int source)
Definition: Fl.cxx:544
Fl_System_Handler
int(* Fl_System_Handler)(void *event, void *data)
Definition: Fl.H:110
Fl::w
static int w()
Definition: Fl_win32.cxx:579
FL_VERSION
#define FL_VERSION
Definition: Enumerations.H:101
FL_ALIGN_RIGHT
const Fl_Align FL_ALIGN_RIGHT
Definition: Enumerations.H:841
FL_LEFT_MOUSE
#define FL_LEFT_MOUSE
The left mouse button.
Definition: Enumerations.H:540
Fl::delete_widget
static void delete_widget(Fl_Widget *w)
Definition: Fl.cxx:1966
Fl::damage
static int damage()
Definition: Fl.H:475
FL_RELEASE
Definition: Enumerations.H:244
Fl_Widget::take_focus
int take_focus()
Definition: Fl_Widget.cxx:162
Check::arg
void * arg
Definition: Fl.cxx:393
Fl::OPTION_LAST
For internal use only.
Definition: Fl.H:227
uchar
unsigned char uchar
Definition: fl_types.h:30
Check
Definition: Fl.cxx:391
fl_window
FL_EXPORT Window fl_window
Definition: Fl_win32.cxx:2571
Fl::selection_owner_
static Fl_Widget * selection_owner_
Definition: Fl.H:163
Fl::add_system_handler
static void add_system_handler(Fl_System_Handler h, void *data)
Install a function to intercept system events.
Definition: Fl.cxx:930
Window
class FLWindow * Window
Definition: mac.H:32
Fl::handle_
static int handle_(int, Fl_Window *)
Handle events from the window system.
Definition: Fl.cxx:1314
Fl::grab
static Fl_Window * grab()
Definition: Fl.H:555
FL_ALIGN_LEFT_TOP
const Fl_Align FL_ALIGN_LEFT_TOP
Definition: Enumerations.H:862
FL_DAMAGE_CHILD
Definition: Enumerations.H:1106
FL_ENTER
Definition: Enumerations.H:253
dx
uchar dx
Definition: fl_boxtype.cxx:286
FL_Escape
#define FL_Escape
The escape key.
Definition: Enumerations.H:474
Timeout::cb
void(* cb)(void *)
Definition: Fl.cxx:294
fl_local_ctrl
const char * fl_local_ctrl
string pointer used in shortcuts, you can change it to another language
Definition: Fl.cxx:96
fl_clipboard_notify_empty
bool fl_clipboard_notify_empty(void)
Definition: Fl.cxx:540
Fl_Window::Fl_X
friend class Fl_X
Definition: Fl_Window.H:96
Fl::remove_handler
static void remove_handler(Fl_Event_Handler h)
Definition: Fl.cxx:870
fl_xid
Window fl_xid(const Fl_Window *)
Fl::e_original_keysym
static int e_original_keysym
Definition: Fl.H:264
Fl::event_inside
static int event_inside(int, int, int, int)
Definition: Fl.cxx:227
Fl::api_version
static int api_version()
Definition: Fl.cxx:176
fl_send_system_handlers
int fl_send_system_handlers(void *e)
Definition: Fl.cxx:962
FL_ALIGN_BOTTOM_RIGHT
const Fl_Align FL_ALIGN_BOTTOM_RIGHT
Definition: Enumerations.H:861
Fl::remove_system_handler
static void remove_system_handler(Fl_System_Handler h)
Definition: Fl.cxx:946