DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
Link: http://www.fltk.org/str.php?L2594
Version: 1.3-current
Attached are two small examples showing unexpected focus behaviour with the
new Cocoa Mac version.
* First test program (focus.cxx)
1) launch program; the first window is shown
2) press 's' key; this shows the second window
3) press 'Command-w':
- expected behaviour: the second window should be closed
- observed behaviour: the first window is closed
* Second test program (focus2.cxx)
1) launch program; two windows are shown
2) press 'Command-w':
- expected behaviour: the large window should be closed
(thanks to the take_focus() call in main())
- observed behaviour: the small window is closed
Link: http://www.fltk.org/str.php?L2594
Version: 1.3-current// 1) launch program; the first window is shown
// 2) press 's' key; this shows the second window
// 3) press 'Command-w':
// - expected behaviour: the second window should be closed
// - observed behaviour: the first window is closed
// Note that if the second window is shown in main() instead of due to
// the 's' shortcut, the program behaves as expected
#include <stdio.h>
#include <stdlib.h>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
class myWindow : public Fl_Window {
private:
int handle(int event)
{
switch (event) {
case FL_SHORTCUT:
case FL_KEYBOARD:
if(Fl::test_shortcut(FL_META+'w')){
do_callback();
return 1;
}
break;
}
return Fl_Window::handle(event);
}
public:
myWindow(int w, int h, const char *l=0)
: Fl_Window(w, h, l) {}
};
myWindow *win, *win2;
int shortcuts(int event)
{
if(Fl::test_shortcut('s'))
win2->show();
return 1;
}
int main(int argc, char **argv)
{
win = new myWindow(200, 200);
win->show(argc, argv);
win2 = new myWindow(100, 100);
//win2->show(); // with this the code works as expected
Fl::add_handler(shortcuts);
return Fl::run();
}
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs