FLTK logo

[fltk.general] Re: Weird set_cursor() bug mixing FLTK and SDL

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Weird set_cursor() bug mixing FLTK and SDL Rodolfo Borges Sep 10, 2020  
 
Forgot to mention that this was on Linux.

I just tested it on a Mac, and there was no bug.
On Thursday, September 10, 2020 at 3:53:22 PM UTC-3 Rodolfo Borges wrote:
First, the overall situation:

My program main screen uses SDL+OpenGL.
There is a FLTK window at the start that shows a project list, where you can select a project and open the main window. But you can bypass this screen and open the main window directly if you pass the project name on the command line.
Once in the main window, it can eventually call some dialogs that are FLTK windows.

And here's where it gets weird:

The moment I put an Fl_Input widget on one of those dialogs that are called from the SDL window, the program crashes the moment the cursor gets inside the Fl_Input widget.
gdb tells me that it crashes on the FLTK function that changes the cursor.

I'm using FLTK 1.4 master branch, but I tested it with 1.3.5 too, with the same results.

After fighting this bug for two days, I noticed that if I introduce an Fl_Input widget on the first screen *before* the SDL window opens, then it works, and the FLTK dialog that opens after the SDL window works too.
And this led me to the following workaround:

static void ugly_HACK_workaround_fltk_setcursor_bug()
{
    Fl_Window w(10, 10, 20, 20);
    w.show();
    w.cursor (FL_CURSOR_INSERT);
    w.hide();
}

I just call this function at the very start of the program, and the bug is fixed.

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/3a0ec1e1-6fc9-46b4-97d0-cb02fa58e14an%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.