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

[STR New]

Link: http://www.fltk.org/str.php?L2079
Version: 1.1.9
Fix Version: 1.1.9


Under Windows (observed on XP) with VC2005 compiler (and probably all
non-gcc ones) the Fl_Gl_Window gets extra FL_LEAVE events in its handle()
method even if the cursor does not really leave the widget. The workaround
is to undefine USE_TRACK_MOUSE (Fl_win32.c, line 79) but it should be fixed
properly (thanks to Ian and Albrecht for pointing to that). In following
example wrong extra events are sent to the OpenGL window - ie when
dragging the pushed mouse within the window.

// Example code - from Albrecht Schlosser post

#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();
}


Link: http://www.fltk.org/str.php?L2079
Version: 1.1.9
Fix Version: 1.1.9

_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs

Reply via email to