| [ Return to Bugs & Features | Roadmap 2.0 | Post Text | Post File ]
STR #2427
Application: | FLTK Library |
Status: | 5 - New |
Priority: | 3 - Moderate, e.g. unable to compile the software |
Scope: | 2 - Specific to an operating system |
Subsystem: | Unassigned |
Summary: | Strange cursor behavior in child GlWindow |
Version: | 2.0-current |
Created By: | don_dempsey |
Assigned To: | Unassigned |
Fix Version: | Unassigned |
Update Notification: | |
Trouble Report Files:
[ Post File ]No files
Trouble Report Comments:
[ Post Text ]
|
#1 | don_dempsey 21:35 Oct 07, 2010 |
| Inside the handle() method of a GlWindow that is a child of a Window, my code changes the cursor's display type based on the event parameter that was provided. I handle the events fltk::ENTER and fltk::MOVE by attempting to change the cursor to CURSOR_CROSS and I handle fltk::LEAVE by changing the cursor back to CURSOR_DEFAULT. The cursor changes as expected upon an fltk::ENTER event but immediately changes back to CURSOR_DEFAULT when the next event is handled (usually fltk::MOVE).
Note that if the left mouse button is down while the mouse enters the child GlWindow, the cursor behaves correctly (remaining CURSOR_CROSS until fltk::LEAVE is handled and it returns to CURSOR_DEFAULT).
Also note that this only appears to occur in Windows (tested on XP and Windows 7).
The following test code can be used to reproduce the error:
/*-----------------------------------------------------------*/ // Compiled on my ubuntu and msys boxes with fltk2-config // --use-gl --configure text.cxx // linked against ws2_32.lib, fltk2.lib, fltk2_gl.lib, // glu32.lib and opengl32.lib under msvs
#include <fltk/GlWindow.h> #include <fltk/events.h> #include <fltk/Cursor.h> #include <fltk/run.h> #include <fltk/gl.h> #include <cstdio>
using namespace fltk;
class RR_GlWindow : public GlWindow { void draw() { if (!valid()) { valid(1); glLoadIdentity(); glViewport(0,0,w(),h()); glOrtho(-w(),w(),-h(),h(),-1,1); } glClearColor(1.0, 1.0, 1.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); // Draw white 'X' glColor3f(0.0, 0.0, 0.0); glBegin(GL_LINE_STRIP); glVertex2i(w(), h()); glVertex2i(-w(),-h()); glEnd(); glBegin(GL_LINE_STRIP); glVertex2i(w(),-h()); glVertex2i(-w(), h()); glEnd(); } public: RR_GlWindow(int x, int y, int w, int h, const char* label=0) : GlWindow(x,y,w,h,label) {}; int handle(int e) { int ret = GlWindow::handle(e); switch(e) { case fltk::ENTER: this->cursor(CURSOR_CROSS); return 1; default: return ret; } } };
int main(){ Window win(10, 10, 1000, 800, ""); win.begin(); RR_GlWindow mygl(10, 10, 400, 400); win.end(); win.show(); return run(); }
/*-----------------------------------------------------------*/
Note that fltk::MOVE and fltk::LEAVE are not handled in the code example (as described above) but these are not required in order to demonstrate the incorrect cursor behavior. | |
[ Return to Bugs & Features | Post Text | Post File ]
|
| |