STR #3424

GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Bugs & Features ]

STR #3424

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:2 - Low, e.g. a documentation error or undocumented side-effect
Scope:2 - Specific to an operating system
Subsystem:X11
Summary:X11: Fl_Window::default_cursor(FL_CURSOR_NONE) iterates
Version:1.4.0
Created By:chris
Assigned To:manolo
Fix Version:1.4.0
Fix Commit:a47c907fca7b055f1f9428344d2dfefc36a9c9df
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:


Name/Time/Date Filename/Size top right image
 
#1 chris
23:41 May 25, 2020
STR-3424.diff
3k
 
bottom left image   bottom right image

Trouble Report Comments:


Name/Time/Date Text top right image
 
#1 chris
10:13 Nov 02, 2017
Discovered with a fresh build on a new X11 system with XCursor Library (libxcursor-dev) *not* installed and running some old code (for a touch screen system) that uses Fl_Window::default_cursor(FL_CURSOR_NONE) to hide the mouse cursor. The call runs into an endless loop and the application will be terminated after a while.

Can be tested with the cursor test program by e.g. adding a statement after line 33 in choice_cb:

   cursor_slider->window()->default_cursor(cursor);

and selecting FL_CURSOR_NONE.

(Before: compile FLTK with HAVE_XCURSOR 0 in config.h)


As fix I could find nothing better than (the program flow in fl_cursor.cxx is really hard to follow):

Index: src/fl_cursor.cxx
===================================================================
--- src/fl_cursor.cxx (Revision 12537)
+++ src/fl_cursor.cxx (Arbeitskopie)
@@ -172,7 +172,8 @@
   if (ret)
     return;
 
-  cursor(FL_CURSOR_DEFAULT);
+  if (cursor_default != FL_CURSOR_NONE)
+    cursor(FL_CURSOR_DEFAULT);
 }

 /**
 
 
#2 chris
04:50 May 06, 2020
It still happens with latest GIT version...
Seems an regression from FLTK 1.3, as it doesn't happen with the same code.

Is someone able to reproduce?
 
 
#3 chris
23:36 May 10, 2020
This is a regression from STR 2660:
https://www.fltk.org/str.php?L2660

Since then it is not possible to compile without using the xcursor library (HAVE_XCURSOR=0) and setting a window's default cursor to FL_CURSOR_NONE. Doing so will result in an endless loop and following stack overflow.
 
 
#4 chris
08:05 May 20, 2020
Some more analysis:

The code before the change did not use the XCursor library to define cursors, but used XCreatePixmapCursor or XCreateFontCursor.

The code after the change uses XcursorImageLoadCursor and as fallback if the XCursor library is not used (HAVE_CURSOR=0) it implements only the XCreateFontCursor method. But when the cursor type is not supported by XCreateFontCursor (e.g. FL_CURSOR_NONE, FL_CURSOR_NWSE,..) it comes to an endless loop. This is due the fact, that a failure of fallback_cursor() is not handled properly in fl_cursor.cxx.

The code to create a cursor from a Pixmap that was present in the original code has been removed completely, so there is no way to have that when not using the XCursor library.
 
 
#5 chris
23:40 May 25, 2020
I have re-added support for FL_CURSOR_NONE without dependeny on XCursor library, by using the relevant code parts that were removed by this commit:

https://github.com/fltk/fltk/commit/332dc1b7acfedbf80b71cc6f538a14f24d435df3#diff-928abed4504862c3667175e78ea4a7f6

Patch is attached.
 
 
#6 manolo
01:18 Nov 22, 2020
Fixed in Git repository.  
bottom left image   bottom right image

Return to Bugs & Features ]

 
 

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