summaryrefslogtreecommitdiff
path: root/test/subwindow.cxx
diff options
context:
space:
mode:
authorBill Spitzak <spitzak@gmail.com>1999-07-22 21:37:04 +0000
committerBill Spitzak <spitzak@gmail.com>1999-07-22 21:37:04 +0000
commitdf045b0e36f08c7d6ae4884667744203057d95c8 (patch)
tree1d39351fad12d34bb1c714006492e6c2647d379d /test/subwindow.cxx
parent0bb590c832fb50a6bcf40aecbae2cad918ebee94 (diff)
FL_KEYBOARD events have the correct x/y when sent to child X windows.
Notice that if you worked around this bug by adjusting the x/y yourself you will have to change your code. In addition all events have the correct x/y when sent to the grab() widget. And the code to do all this was simplified a lot. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.0@630 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test/subwindow.cxx')
-rw-r--r--test/subwindow.cxx54
1 files changed, 33 insertions, 21 deletions
diff --git a/test/subwindow.cxx b/test/subwindow.cxx
index 9560dd7d7..209b54e52 100644
--- a/test/subwindow.cxx
+++ b/test/subwindow.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: subwindow.cxx,v 1.5.2.1 1999/04/19 07:01:24 bill Exp $"
+// "$Id: subwindow.cxx,v 1.5.2.2 1999/07/22 21:37:04 bill Exp $"
//
// Nested window test program for the Fast Light Tool Kit (FLTK).
//
@@ -37,23 +37,6 @@
#include <FL/Fl_Box.H>
#include <FL/Fl_Input.H>
-class testwindow : public Fl_Window {
- int handle(int);
- void draw();
-public:
- testwindow(Fl_Boxtype b,int x,int y,const char *l)
- : Fl_Window(x,y,l) {box(b);}
- testwindow(Fl_Boxtype b,int x,int y,int w,int h,const char *l)
- : Fl_Window(x,y,w,h,l) {box(b);}
-};
-
-void testwindow::draw() {
-#ifdef DEBUG
- printf("%s : draw\n",label());
-#endif
- Fl_Window::draw();
-}
-
class EnterExit : public Fl_Box {
int handle(int);
public:
@@ -90,17 +73,46 @@ const char *eventnames[] = {
};
#endif
-Fl_Menu_Button* popup;
+class testwindow : public Fl_Window {
+ int handle(int);
+ void draw();
+ int cx, cy; char key;
+public:
+ testwindow(Fl_Boxtype b,int x,int y,const char *l)
+ : Fl_Window(x,y,l) {box(b); key = 0;}
+ testwindow(Fl_Boxtype b,int x,int y,int w,int h,const char *l)
+ : Fl_Window(x,y,w,h,l) {box(b); key = 0;}
+};
+
+#include <FL/fl_draw.H>
+
+void testwindow::draw() {
+#ifdef DEBUG
+ printf("%s : draw\n",label());
+#endif
+ Fl_Window::draw();
+ if (key) fl_draw(&key, 1, cx, cy);
+}
int testwindow::handle(int e) {
#ifdef DEBUG
if (e != FL_MOVE) printf("%s : %s\n",label(),eventnames[e]);
#endif
if (Fl_Window::handle(e)) return 1;
- // if (e==FL_PUSH) return popup->handle(e);
+ if (e == FL_FOCUS) return 1;
+ if (e == FL_PUSH) {Fl::focus(this); return 1;}
+ if (e == FL_KEYBOARD && Fl::event_text()[0]) {
+ key = Fl::event_text()[0];
+ cx = Fl::event_x();
+ cy = Fl::event_y();
+ redraw();
+ return 1;
+ }
return 0;
}
+Fl_Menu_Button* popup;
+
const char* bigmess =
#if 1
"this|is|only|a test"
@@ -171,5 +183,5 @@ int main(int, char **) {
}
//
-// End of "$Id: subwindow.cxx,v 1.5.2.1 1999/04/19 07:01:24 bill Exp $".
+// End of "$Id: subwindow.cxx,v 1.5.2.2 1999/07/22 21:37:04 bill Exp $".
//