diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Fl.cxx | 7 | ||||
| -rw-r--r-- | src/Fl_Input.cxx | 36 | ||||
| -rw-r--r-- | src/Fl_arg.cxx | 38 | ||||
| -rw-r--r-- | src/Fl_get_system_colors.cxx | 19 |
4 files changed, 72 insertions, 28 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx index 860582473..b64d81ff5 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl.cxx,v 1.24.2.41.2.25 2002/04/10 18:51:22 easysw Exp $" +// "$Id: Fl.cxx,v 1.24.2.41.2.26 2002/04/13 22:17:46 easysw Exp $" // // Main event handling code for the Fast Light Tool Kit (FLTK). // @@ -54,7 +54,8 @@ int Fl::damage_, Fl::e_keysym; char *Fl::e_text = (char *)""; int Fl::e_length; -int Fl::visible_focus_ = 1; +int Fl::visible_focus_ = 1, + Fl::dnd_text_ops_ = 1; // @@ -889,5 +890,5 @@ void Fl_Window::flush() { } // -// End of "$Id: Fl.cxx,v 1.24.2.41.2.25 2002/04/10 18:51:22 easysw Exp $". +// End of "$Id: Fl.cxx,v 1.24.2.41.2.26 2002/04/13 22:17:46 easysw Exp $". // diff --git a/src/Fl_Input.cxx b/src/Fl_Input.cxx index d59555787..edd79a2c4 100644 --- a/src/Fl_Input.cxx +++ b/src/Fl_Input.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Input.cxx,v 1.10.2.15.2.8 2002/04/11 11:52:41 easysw Exp $" +// "$Id: Fl_Input.cxx,v 1.10.2.15.2.9 2002/04/13 22:17:46 easysw Exp $" // // Input widget for the Fast Light Tool Kit (FLTK). // @@ -36,7 +36,6 @@ #include "flstring.h" #include <stdio.h> -#define DND_OUT 1 void Fl_Input::draw() { if (input_type() == FL_HIDDEN_INPUT) return; @@ -290,8 +289,7 @@ int Fl_Input::handle(int event) { } else return handle_key(); case FL_PUSH: -#if DND_OUT - { + if (Fl::dnd_text_ops()) { int oldpos = position(), oldmark = mark(); Fl_Boxtype b = box(); Fl_Input_::handle_mouse( @@ -302,13 +300,13 @@ int Fl_Input::handle(int event) { if (Fl::focus()==this && !Fl::event_state(FL_SHIFT) && input_type()!=FL_SECRET_INPUT && (newpos >= mark() && newpos < position() || newpos >= position() && newpos < mark())) { - // user clicked int the selection, may be trying to drag + // user clicked in the selection, may be trying to drag drag_start = newpos; return 1; } drag_start = -1; } -#endif + if (Fl::focus() != this) { Fl::focus(this); handle(FL_FOCUS); @@ -316,17 +314,17 @@ int Fl_Input::handle(int event) { break; case FL_DRAG: -#if DND_OUT - if (drag_start >= 0) { - if (Fl::event_is_click()) return 1; // debounce the mouse - // save the position because sometimes we don't get DND_ENTER: - dnd_save_position = position(); - dnd_save_mark = mark(); - // drag the data: - copy(0); Fl::dnd(); - return 1; + if (Fl::dnd_text_ops()) { + if (drag_start >= 0) { + if (Fl::event_is_click()) return 1; // debounce the mouse + // save the position because sometimes we don't get DND_ENTER: + dnd_save_position = position(); + dnd_save_mark = mark(); + // drag the data: + copy(0); Fl::dnd(); + return 1; + } } -#endif break; case FL_RELEASE: @@ -336,6 +334,10 @@ int Fl_Input::handle(int event) { } else if (!Fl::event_is_click()) { // copy drag-selected text to the clipboard. copy(0); + } else if (Fl::event_is_click() && drag_start >= 0) { + // user clicked in the field and wants to reset the cursor position... + position(drag_start, drag_start); + drag_start = -1; } return 1; @@ -393,5 +395,5 @@ Fl_Input::Fl_Input(int x, int y, int w, int h, const char *l) } // -// End of "$Id: Fl_Input.cxx,v 1.10.2.15.2.8 2002/04/11 11:52:41 easysw Exp $". +// End of "$Id: Fl_Input.cxx,v 1.10.2.15.2.9 2002/04/13 22:17:46 easysw Exp $". // diff --git a/src/Fl_arg.cxx b/src/Fl_arg.cxx index 97e9900a6..b0bb3ecd3 100644 --- a/src/Fl_arg.cxx +++ b/src/Fl_arg.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_arg.cxx,v 1.5.2.8.2.8 2002/04/11 11:52:42 easysw Exp $" +// "$Id: Fl_arg.cxx,v 1.5.2.8.2.9 2002/04/13 22:17:46 easysw Exp $" // // Optional argument initialization code for the Fast Light Tool Kit (FLTK). // @@ -91,6 +91,14 @@ int Fl::arg(int argc, char **argv, int &i) { Fl::visible_focus(0); i++; return 1; + } else if (match(s, "dnd")) { + Fl::dnd_text_ops(1); + i++; + return 1; + } else if (match(s, "nodnd", 3)) { + Fl::dnd_text_ops(0); + i++; + return 1; } const char *v = argv[i+1]; @@ -153,7 +161,29 @@ int Fl::args(int argc, char** argv, int& i, int (*cb)(int,char**,int&)) { // show a main window, use any parsed arguments void Fl_Window::show(int argc, char **argv) { if (!argc) {show(); return;} - if (!arg_called) Fl::args(argc,argv); + if (!arg_called) { +#if !defined(WIN32) && !defined(__APPLE__) + // Get defaults for drag-n-drop and focus... + const char *key = 0, *val; + + fl_open_display(); + + if (Fl::first_window()) key = Fl::first_window()->xclass(); + if (!key) key = "fltk"; + + val = XGetDefault(fl_display, key, "dndTextOps"); + if (val) Fl::dnd_text_ops(strcasecmp(val, "true") == 0 || + strcasecmp(val, "on") == 0 || + strcasecmp(val, "yes") == 0); + + val = XGetDefault(fl_display, key, "visibleFocus"); + if (val) Fl::visible_focus(strcasecmp(val, "true") == 0 || + strcasecmp(val, "on") == 0 || + strcasecmp(val, "yes") == 0); +#endif // !WIN32 && !__APPLE__ + + Fl::args(argc,argv); + } // set colors first, so background_pixel is correct: static char beenhere; @@ -200,7 +230,7 @@ void Fl_Window::show(int argc, char **argv) { XChangeProperty(fl_display, fl_xid(this), XA_WM_COMMAND, XA_STRING, 8, 0, (unsigned char *)buffer, p-buffer-1); delete[] buffer; -#endif +#endif // !WIN32 && !__APPLE__ } // Calls useful for simple demo programs, with automatic help message: @@ -364,5 +394,5 @@ int XParseGeometry(const char* string, int* x, int* y, #endif // ifdef WIN32 // -// End of "$Id: Fl_arg.cxx,v 1.5.2.8.2.8 2002/04/11 11:52:42 easysw Exp $". +// End of "$Id: Fl_arg.cxx,v 1.5.2.8.2.9 2002/04/13 22:17:46 easysw Exp $". // diff --git a/src/Fl_get_system_colors.cxx b/src/Fl_get_system_colors.cxx index 8f216af88..7a4176ddd 100644 --- a/src/Fl_get_system_colors.cxx +++ b/src/Fl_get_system_colors.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.7 2002/04/11 10:46:19 easysw Exp $" +// "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.8 2002/04/13 22:17:46 easysw Exp $" // // System color support for the Fast Light Tool Kit (FLTK). // @@ -163,7 +163,7 @@ static void getsyscolor(const char *key1, const char* key2, const char *arg, const char *defarg, void (*func)(uchar,uchar,uchar)) { if (!arg) { - arg = XGetDefault (fl_display, key1, key2); + arg = XGetDefault(fl_display, key1, key2); if (!arg) arg = defarg; } XColor x; @@ -210,7 +210,18 @@ Fl_Image *Fl::scheme_bg_ = (Fl_Image *)0; static Fl_Pixmap tile(tile_xpm); int Fl::scheme(const char *s) { - if (!s) s = getenv("FLTK_SCHEME"); + if (!s) { + if ((s = getenv("FLTK_SCHEME")) == NULL) { +#if !defined(WIN32) && !defined(__APPLE__) + const char* key = 0; + if (Fl::first_window()) key = Fl::first_window()->xclass(); + if (!key) key = "fltk"; + fl_open_display(); + s = XGetDefault(fl_display, key, "scheme"); +#endif // !WIN32 && !__APPLE__ + } + } + if (s) { if (!strcasecmp(s, "none") || !*s) s = 0; else s = strdup(s); @@ -305,5 +316,5 @@ int Fl::reload_scheme() { // -// End of "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.7 2002/04/11 10:46:19 easysw Exp $". +// End of "$Id: Fl_get_system_colors.cxx,v 1.6.2.7.2.8 2002/04/13 22:17:46 easysw Exp $". // |
