summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2001-11-03 19:24:22 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2001-11-03 19:24:22 +0000
commit0884e2ba0de126599e212f8a98f06d3a1df7a609 (patch)
tree08d6569b31711561cf4788f830ada150f288d343 /src
parentd3acd6c475de7fb811c4bde93ca735e3526ad82f (diff)
Update all non-text widgets that take keyboard focus to check
Fl::visible_focus() before taking or accepting focus; this allows one to disable the new 1.1 keyboard focus stuff completely (not much sense allowing focus if you can't see it...) git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1679 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl_Adjuster.cxx12
-rw-r--r--src/Fl_Browser_.cxx8
-rw-r--r--src/Fl_Button.cxx12
-rw-r--r--src/Fl_Choice.cxx12
-rw-r--r--src/Fl_Counter.cxx12
-rw-r--r--src/Fl_Menu_Button.cxx8
-rw-r--r--src/Fl_Repeat_Button.cxx6
-rw-r--r--src/Fl_Roller.cxx12
-rw-r--r--src/Fl_Scrollbar.cxx12
-rw-r--r--src/Fl_Slider.cxx12
-rw-r--r--src/Fl_Tabs.cxx12
-rw-r--r--src/Fl_arg.cxx12
12 files changed, 77 insertions, 53 deletions
diff --git a/src/Fl_Adjuster.cxx b/src/Fl_Adjuster.cxx
index 0abc9916f..764a56367 100644
--- a/src/Fl_Adjuster.cxx
+++ b/src/Fl_Adjuster.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Adjuster.cxx,v 1.5.2.3.2.2 2001/10/29 03:44:32 easysw Exp $"
+// "$Id: Fl_Adjuster.cxx,v 1.5.2.3.2.3 2001/11/03 19:24:22 easysw Exp $"
//
// Adjuster widget for the Fast Light Tool Kit (FLTK).
//
@@ -70,7 +70,7 @@ int Fl_Adjuster::handle(int event) {
int mx = Fl::event_x();
switch (event) {
case FL_PUSH:
- take_focus();
+ if (Fl::visible_focus()) take_focus();
ix = mx;
if (w()>=h())
drag = 3*(mx-x())/w() + 1;
@@ -142,8 +142,10 @@ int Fl_Adjuster::handle(int event) {
break;
case FL_FOCUS:
case FL_UNFOCUS:
- redraw();
- return 1;
+ if (Fl::visible_focus()) {
+ redraw();
+ return 1;
+ } else return 0;
}
return 0;
}
@@ -158,5 +160,5 @@ Fl_Adjuster::Fl_Adjuster(int x, int y, int w, int h, const char* l)
}
//
-// End of "$Id: Fl_Adjuster.cxx,v 1.5.2.3.2.2 2001/10/29 03:44:32 easysw Exp $".
+// End of "$Id: Fl_Adjuster.cxx,v 1.5.2.3.2.3 2001/11/03 19:24:22 easysw Exp $".
//
diff --git a/src/Fl_Browser_.cxx b/src/Fl_Browser_.cxx
index 6bb40fab9..f59744f62 100644
--- a/src/Fl_Browser_.cxx
+++ b/src/Fl_Browser_.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.7 2001/10/29 03:44:32 easysw Exp $"
+// "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.8 2001/11/03 19:24:22 easysw Exp $"
//
// Base Browser widget class for the Fast Light Tool Kit (FLTK).
//
@@ -552,7 +552,7 @@ int Fl_Browser_::handle(int event) {
switch (event) {
case FL_PUSH:
if (!Fl::event_inside(X, Y, W, H)) return 0;
- take_focus();
+ if (Fl::visible_focus()) take_focus();
my = py = Fl::event_y();
change = 0;
if (type() == FL_NORMAL_BROWSER || !top_)
@@ -649,7 +649,7 @@ int Fl_Browser_::handle(int event) {
return 1;
case FL_FOCUS:
case FL_UNFOCUS:
- if (type() >= FL_HOLD_BROWSER) {
+ if (type() >= FL_HOLD_BROWSER && Fl::visible_focus()) {
redraw();
return 1;
} else return 0;
@@ -713,5 +713,5 @@ void Fl_Browser_::item_select(void*, int) {}
int Fl_Browser_::item_selected(void* l) const {return l==selection_;}
//
-// End of "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.7 2001/10/29 03:44:32 easysw Exp $".
+// End of "$Id: Fl_Browser_.cxx,v 1.10.2.16.2.8 2001/11/03 19:24:22 easysw Exp $".
//
diff --git a/src/Fl_Button.cxx b/src/Fl_Button.cxx
index c1940b3b5..5a013bfa3 100644
--- a/src/Fl_Button.cxx
+++ b/src/Fl_Button.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Button.cxx,v 1.4.2.6.2.4 2001/08/04 20:17:10 easysw Exp $"
+// "$Id: Fl_Button.cxx,v 1.4.2.6.2.5 2001/11/03 19:24:22 easysw Exp $"
//
// Button widget for the Fast Light Tool Kit (FLTK).
//
@@ -66,7 +66,7 @@ int Fl_Button::handle(int event) {
return 1;
case FL_PUSH:
case FL_DRAG:
- take_focus();
+ if (Fl::visible_focus()) take_focus();
if (Fl::event_inside(this)) {
if (type() == FL_RADIO_BUTTON) newval = 1;
else newval = !oldval;
@@ -107,8 +107,10 @@ int Fl_Button::handle(int event) {
return 1;
case FL_FOCUS :
case FL_UNFOCUS :
- redraw();
- return 1;
+ if (Fl::visible_focus()) {
+ redraw();
+ return 1;
+ } else return 0;
case FL_KEYBOARD :
if (Fl::focus() == this && Fl::event_key() == ' ') {
if (type() == FL_RADIO_BUTTON && !value_) {
@@ -136,5 +138,5 @@ Fl_Button::Fl_Button(int x,int y,int w,int h, const char *l)
}
//
-// End of "$Id: Fl_Button.cxx,v 1.4.2.6.2.4 2001/08/04 20:17:10 easysw Exp $".
+// End of "$Id: Fl_Button.cxx,v 1.4.2.6.2.5 2001/11/03 19:24:22 easysw Exp $".
//
diff --git a/src/Fl_Choice.cxx b/src/Fl_Choice.cxx
index fef598b63..bc79d6f6b 100644
--- a/src/Fl_Choice.cxx
+++ b/src/Fl_Choice.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Choice.cxx,v 1.10.2.5.2.2 2001/09/29 22:59:45 easysw Exp $"
+// "$Id: Fl_Choice.cxx,v 1.10.2.5.2.3 2001/11/03 19:24:22 easysw Exp $"
//
// Choice widget for the Fast Light Tool Kit (FLTK).
//
@@ -89,7 +89,7 @@ int Fl_Choice::handle(int e) {
case FL_KEYBOARD:
if (Fl::event_key() != ' ') return 0;
case FL_PUSH:
- take_focus();
+ if (Fl::visible_focus()) take_focus();
Fl::event_is_click(0);
J1:
v = menu()->pulldown(x(), y(), w(), h(), mvalue(), this);
@@ -106,13 +106,15 @@ int Fl_Choice::handle(int e) {
return 1;
case FL_FOCUS:
case FL_UNFOCUS:
- redraw();
- return 1;
+ if (Fl::visible_focus()) {
+ redraw();
+ return 1;
+ } else return 0;
default:
return 0;
}
}
//
-// End of "$Id: Fl_Choice.cxx,v 1.10.2.5.2.2 2001/09/29 22:59:45 easysw Exp $".
+// End of "$Id: Fl_Choice.cxx,v 1.10.2.5.2.3 2001/11/03 19:24:22 easysw Exp $".
//
diff --git a/src/Fl_Counter.cxx b/src/Fl_Counter.cxx
index 08a40cf24..f850a98b6 100644
--- a/src/Fl_Counter.cxx
+++ b/src/Fl_Counter.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Counter.cxx,v 1.8.2.3.2.3 2001/10/29 03:44:32 easysw Exp $"
+// "$Id: Fl_Counter.cxx,v 1.8.2.3.2.4 2001/11/03 19:24:22 easysw Exp $"
//
// Counter widget for the Fast Light Tool Kit (FLTK).
//
@@ -131,7 +131,7 @@ int Fl_Counter::handle(int event) {
handle_release();
return 1;
case FL_PUSH:
- take_focus();
+ if (Fl::visible_focus()) take_focus();
handle_push();
case FL_DRAG:
i = calc_mouseobj();
@@ -157,8 +157,10 @@ int Fl_Counter::handle(int event) {
break;
case FL_FOCUS :
case FL_UNFOCUS :
- damage(FL_DAMAGE_ALL);
- return 1;
+ if (Fl::visible_focus()) {
+ redraw();
+ return 1;
+ } else return 0;
case FL_ENTER :
case FL_LEAVE :
return 1;
@@ -186,5 +188,5 @@ Fl_Counter::Fl_Counter(int x, int y, int w, int h, const char* l)
}
//
-// End of "$Id: Fl_Counter.cxx,v 1.8.2.3.2.3 2001/10/29 03:44:32 easysw Exp $".
+// End of "$Id: Fl_Counter.cxx,v 1.8.2.3.2.4 2001/11/03 19:24:22 easysw Exp $".
//
diff --git a/src/Fl_Menu_Button.cxx b/src/Fl_Menu_Button.cxx
index 4abb2fe08..1d39416d2 100644
--- a/src/Fl_Menu_Button.cxx
+++ b/src/Fl_Menu_Button.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Menu_Button.cxx,v 1.4.2.3.2.1 2001/08/04 20:17:10 easysw Exp $"
+// "$Id: Fl_Menu_Button.cxx,v 1.4.2.3.2.2 2001/11/03 19:24:22 easysw Exp $"
//
// Menu button widget for the Fast Light Tool Kit (FLTK).
//
@@ -65,7 +65,7 @@ int Fl_Menu_Button::handle(int e) {
} else if (type()) {
if (!(type() & (1 << (Fl::event_button()-1)))) return 0;
}
- take_focus();
+ if (Fl::visible_focus()) take_focus();
popup();
return 1;
case FL_KEYBOARD:
@@ -78,7 +78,7 @@ int Fl_Menu_Button::handle(int e) {
return test_shortcut() != 0;
case FL_FOCUS:
case FL_UNFOCUS:
- if (box()) {
+ if (box() && Fl::visible_focus()) {
redraw();
return 1;
}
@@ -93,5 +93,5 @@ Fl_Menu_Button::Fl_Menu_Button(int X,int Y,int W,int H,const char *l)
}
//
-// End of "$Id: Fl_Menu_Button.cxx,v 1.4.2.3.2.1 2001/08/04 20:17:10 easysw Exp $".
+// End of "$Id: Fl_Menu_Button.cxx,v 1.4.2.3.2.2 2001/11/03 19:24:22 easysw Exp $".
//
diff --git a/src/Fl_Repeat_Button.cxx b/src/Fl_Repeat_Button.cxx
index 88e4f44a9..7513bc85a 100644
--- a/src/Fl_Repeat_Button.cxx
+++ b/src/Fl_Repeat_Button.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Repeat_Button.cxx,v 1.4.2.4.2.1 2001/11/03 05:11:34 easysw Exp $"
+// "$Id: Fl_Repeat_Button.cxx,v 1.4.2.4.2.2 2001/11/03 19:24:22 easysw Exp $"
//
// Repeat button widget for the Fast Light Tool Kit (FLTK).
//
@@ -44,7 +44,7 @@ int Fl_Repeat_Button::handle(int event) {
newval = 0; goto J1;
case FL_PUSH:
case FL_DRAG:
- take_focus();
+ if (Fl::visible_focus()) take_focus();
newval = Fl::event_inside(this);
J1:
if (value(newval)) {
@@ -62,5 +62,5 @@ int Fl_Repeat_Button::handle(int event) {
}
//
-// End of "$Id: Fl_Repeat_Button.cxx,v 1.4.2.4.2.1 2001/11/03 05:11:34 easysw Exp $".
+// End of "$Id: Fl_Repeat_Button.cxx,v 1.4.2.4.2.2 2001/11/03 19:24:22 easysw Exp $".
//
diff --git a/src/Fl_Roller.cxx b/src/Fl_Roller.cxx
index 2ec920337..758b5bc53 100644
--- a/src/Fl_Roller.cxx
+++ b/src/Fl_Roller.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Roller.cxx,v 1.6.2.4.2.1 2001/08/05 14:00:15 easysw Exp $"
+// "$Id: Fl_Roller.cxx,v 1.6.2.4.2.2 2001/11/03 19:24:22 easysw Exp $"
//
// Roller widget for the Fast Light Tool Kit (FLTK).
//
@@ -35,7 +35,7 @@ int Fl_Roller::handle(int event) {
int newpos = horizontal() ? Fl::event_x() : Fl::event_y();
switch (event) {
case FL_PUSH:
- take_focus();
+ if (Fl::visible_focus()) take_focus();
handle_push();
ipos = newpos;
return 1;
@@ -69,8 +69,10 @@ int Fl_Roller::handle(int event) {
break;
case FL_FOCUS :
case FL_UNFOCUS :
- damage(FL_DAMAGE_ALL);
- return 1;
+ if (Fl::visible_focus()) {
+ redraw();
+ return 1;
+ } else return 0;
default:
return 0;
}
@@ -166,5 +168,5 @@ Fl_Roller::Fl_Roller(int X,int Y,int W,int H,const char* L)
}
//
-// End of "$Id: Fl_Roller.cxx,v 1.6.2.4.2.1 2001/08/05 14:00:15 easysw Exp $".
+// End of "$Id: Fl_Roller.cxx,v 1.6.2.4.2.2 2001/11/03 19:24:22 easysw Exp $".
//
diff --git a/src/Fl_Scrollbar.cxx b/src/Fl_Scrollbar.cxx
index 29272853d..d0779cc92 100644
--- a/src/Fl_Scrollbar.cxx
+++ b/src/Fl_Scrollbar.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Scrollbar.cxx,v 1.7.2.14.2.3 2001/10/29 03:44:32 easysw Exp $"
+// "$Id: Fl_Scrollbar.cxx,v 1.7.2.14.2.4 2001/11/03 19:24:22 easysw Exp $"
//
// Scroll bar widget for the Fast Light Tool Kit (FLTK).
//
@@ -109,7 +109,7 @@ int Fl_Scrollbar::handle(int event) {
handle_release();
return 1;
case FL_PUSH:
- take_focus();
+ if (Fl::visible_focus()) take_focus();
if (pushed_) return 1;
if (area != 8) pushed_ = area;
if (pushed_) {
@@ -129,8 +129,10 @@ int Fl_Scrollbar::handle(int event) {
return 1;
case FL_FOCUS :
case FL_UNFOCUS :
- damage(FL_DAMAGE_ALL);
- return 1;
+ if (Fl::visible_focus()) {
+ redraw();
+ return 1;
+ } else return 0;
case FL_SHORTCUT:
case FL_KEYBOARD: {
int v = value();
@@ -244,5 +246,5 @@ Fl_Scrollbar::Fl_Scrollbar(int X, int Y, int W, int H, const char* L)
}
//
-// End of "$Id: Fl_Scrollbar.cxx,v 1.7.2.14.2.3 2001/10/29 03:44:32 easysw Exp $".
+// End of "$Id: Fl_Scrollbar.cxx,v 1.7.2.14.2.4 2001/11/03 19:24:22 easysw Exp $".
//
diff --git a/src/Fl_Slider.cxx b/src/Fl_Slider.cxx
index 07b562661..0ab019279 100644
--- a/src/Fl_Slider.cxx
+++ b/src/Fl_Slider.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Slider.cxx,v 1.8.2.10.2.2 2001/10/18 23:41:04 easysw Exp $"
+// "$Id: Fl_Slider.cxx,v 1.8.2.10.2.3 2001/11/03 19:24:22 easysw Exp $"
//
// Slider widget for the Fast Light Tool Kit (FLTK).
//
@@ -181,7 +181,7 @@ int Fl_Slider::handle(int event, int x, int y, int w, int h) {
switch (event) {
case FL_PUSH:
if (!Fl::event_inside(x, y, w, h)) return 0;
- take_focus();
+ if (Fl::visible_focus()) take_focus();
handle_push();
case FL_DRAG: {
@@ -270,8 +270,10 @@ int Fl_Slider::handle(int event, int x, int y, int w, int h) {
break;
case FL_FOCUS :
case FL_UNFOCUS :
- damage(FL_DAMAGE_ALL);
- return 1;
+ if (Fl::visible_focus()) {
+ redraw();
+ return 1;
+ } else return 0;
case FL_ENTER :
case FL_LEAVE :
return 1;
@@ -289,5 +291,5 @@ int Fl_Slider::handle(int event) {
}
//
-// End of "$Id: Fl_Slider.cxx,v 1.8.2.10.2.2 2001/10/18 23:41:04 easysw Exp $".
+// End of "$Id: Fl_Slider.cxx,v 1.8.2.10.2.3 2001/11/03 19:24:22 easysw Exp $".
//
diff --git a/src/Fl_Tabs.cxx b/src/Fl_Tabs.cxx
index 669bb3fae..3723a13da 100644
--- a/src/Fl_Tabs.cxx
+++ b/src/Fl_Tabs.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_Tabs.cxx,v 1.6.2.10.2.1 2001/08/05 15:34:28 easysw Exp $"
+// "$Id: Fl_Tabs.cxx,v 1.6.2.10.2.2 2001/11/03 19:24:22 easysw Exp $"
//
// Tab widget for the Fast Light Tool Kit (FLTK).
//
@@ -138,7 +138,7 @@ int Fl_Tabs::handle(int event) {
} else {
if (Fl::event_y() < y()+h()+H) goto DEFAULT;
}}
- take_focus();
+ if (Fl::visible_focus()) take_focus();
case FL_DRAG:
case FL_RELEASE:
o = which(Fl::event_x(), Fl::event_y());
@@ -147,8 +147,10 @@ int Fl_Tabs::handle(int event) {
return 1;
case FL_FOCUS:
case FL_UNFOCUS:
- redraw();
- return 1;
+ if (Fl::visible_focus()) {
+ redraw();
+ return 1;
+ } else return 0;
case FL_KEYBOARD:
switch (Fl::event_key()) {
case FL_Left:
@@ -309,5 +311,5 @@ Fl_Tabs::Fl_Tabs(int X,int Y,int W, int H, const char *l) :
}
//
-// End of "$Id: Fl_Tabs.cxx,v 1.6.2.10.2.1 2001/08/05 15:34:28 easysw Exp $".
+// End of "$Id: Fl_Tabs.cxx,v 1.6.2.10.2.2 2001/11/03 19:24:22 easysw Exp $".
//
diff --git a/src/Fl_arg.cxx b/src/Fl_arg.cxx
index f531b575d..5516f8c5b 100644
--- a/src/Fl_arg.cxx
+++ b/src/Fl_arg.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_arg.cxx,v 1.5.2.8 2001/03/20 18:02:52 spitzak Exp $"
+// "$Id: Fl_arg.cxx,v 1.5.2.8.2.1 2001/11/03 19:24:22 easysw Exp $"
//
// Optional argument initialization code for the Fast Light Tool Kit (FLTK).
//
@@ -83,6 +83,14 @@ int Fl::arg(int argc, char **argv, int &i) {
fl_show_iconic = 1;
i++;
return 1;
+ } else if (match(s, "kbd")) {
+ Fl::visible_focus(1);
+ i++;
+ return 1;
+ } else if (match(s, "nokbd")) {
+ Fl::visible_focus(0);
+ i++;
+ return 1;
}
const char *v = argv[i+1];
@@ -357,5 +365,5 @@ int XParseGeometry(const char* string, int* x, int* y,
#endif // ifdef WIN32
//
-// End of "$Id: Fl_arg.cxx,v 1.5.2.8 2001/03/20 18:02:52 spitzak Exp $".
+// End of "$Id: Fl_arg.cxx,v 1.5.2.8.2.1 2001/11/03 19:24:22 easysw Exp $".
//