DO NOT REPLY TO THIS MESSAGE.  INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.

[STR Pending]

Link: http://www.fltk.org/str.php?L2594
Version: 1.3.0
Fix Version: 1.3.0 (r8530)


Please apply r. 8530. It solves the issue raised by your 
first test program.

The focus was indeed not correctly done after a window was created
because some code present in the Carbon version was not reflected
in the Cocoa version. This code has now been added.

As for the second test program: the
  win->take_focus();
statement does not change the focus to the large window because
there's no focus-accepting widget in this window. Therefore
the focus remains to the small window that gets closed by cmd-W.
I believe its's not a bug that an empty window can't be given
the focus by the take_focus() function.
If you replace win->take_focus() by
  Fl::focus(win);
the expected behavior is observed, because the focus does get
set to the large window.

If you add a focus-accepting widget in the large window, as in the
attached focus3.cxx, the expected behavior is observed, both
with and without the r.8530 Cocoa fix.

Please, post your observations so I know whether to close this STR.


Link: http://www.fltk.org/str.php?L2594
Version: 1.3.0
Fix Version: 1.3.0 (r8530)
// 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 smallt window is closed

#include <stdio.h>
#include <stdlib.h>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Input.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 main(int argc, char **argv)
{
  win = new myWindow(200, 200);
  Fl_Input box(0,0,200,200);
  win->end();
  win->show(argc, argv);
  Fl::focus(&box);
  
  win2 = new myWindow(100, 100);
  win2->show();
  
  win->take_focus();
  
  return Fl::run();
}
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to