Roman Kantor wrote:
Nope, your example shows for me also more FL_LEAVE events than FL_ENTER ones. It also gets FL_LEAVE events when dragging cursor within the opengl window so in such a case the cursor is wrongly changed from "hand" to "normal". I will try to investigate it little bit more...

Using VC2005 on WinXP, vanilla fltk-1.1.9.

I can confirm what Ian wrote: it works for me with gcc (cygwin -mno-cygwin) on WinXP with FLTK 1.3 as well as 1.1.9 without problems, compiled with

fltk-config --use-gl --compile fl_leave.cxx

(see attached file fl_leave.cxx). I added a counter ("in"), and I get values of 0 and 1 only, even if I drag the mouse.

Is there any chance that another application steals the focus (this can maybe generate FL_LEAVE events). Do you have "point-to-focus" enabled? (Yes, it is possible in WinXP, I know someone who uses it).

Albrecht
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/gl.h>
#include <FL/names.h>
#include <FL/Fl_Gl_Window.H>
#include <stdio.h>

Fl_Window *main_win = 0;

class gl_win_test : public Fl_Gl_Window{
public :
    gl_win_test(int X,int Y,int W,int H,const char*L=0);
    int handle(int ev);
private:
   void draw();
};

gl_win_test::gl_win_test(int X,int Y,int W,int H,const char*L) :
Fl_Gl_Window(X,Y,W,H,L){}

void gl_win_test::draw() {
  glClear(GL_COLOR_BUFFER_BIT);
  glColor3f(1.0, 1.0, 1.0);
  glBegin(GL_LINE_STRIP);
  glVertex2f(w(), h());
  glVertex2f(-w(),-h());
  glEnd();
}

int gl_win_test::handle(int ev) {
  int res = Fl_Gl_Window::handle(ev);
  static int in = 0;

  if (ev == FL_ENTER) {
    cursor(FL_CURSOR_HAND);
    res = 1;
    in++;
  }
  else if (ev == FL_LEAVE) {
    cursor(FL_CURSOR_DEFAULT);
    res = 1;
    in--;
  }
  //  if (ev != FL_MOVE)
    printf ("event: %-12s res: %d, in:%2d\n",fl_eventnames[ev],res,in);
  return res;
}

int main(int argc, char **argv)
{
  setvbuf( stdout, NULL, _IONBF, 0 );
  main_win = new Fl_Window(700, 500, "GL test");
  main_win->begin();
  gl_win_test *engine = new gl_win_test (10, 10, 500, 350);
  main_win->end();
  main_win->show(argc, argv);
  return Fl::run();
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to