| [ Return to Bugs & Features | Roadmap 1.3 | SVN ⇄ GIT ]
STR #2660
Application: | FLTK Library |
Status: | 1 - Closed w/Resolution |
Priority: | 1 - Request for Enhancement, e.g. asking for a feature |
Scope: | 3 - Applies to all machines and operating systems |
Subsystem: | Core Library |
Summary: | support for custom (image) cursors |
Version: | 1.3-feature |
Created By: | ossman |
Assigned To: | ossman |
Fix Version: | 1.3-current (SVN: v10196) |
Update Notification: | |
Trouble Report Files:
Trouble Report Comments:
|
#1 | ossman 09:22 Jun 08, 2011 |
| Sometimes you just want to set your completely own cursor and not one of the predefined ones. This patch allows you to do just that.
Also cleans up the fallback cursor handling in a nice, platform independent way.
PS. Meant to set this as 1.4-feature, but that option is gone. | |
|
#2 | AlbrechtS 09:32 Jun 08, 2011 |
| Moved to 1.4-feature as requested. | |
|
#3 | ossman 09:36 Jun 08, 2011 |
| Forgot to mention that this patch relies on STR #2659 as well. | |
|
#4 | greg.ercolano 12:04 Jun 08, 2011 |
| Just browsing these patches..
To keep things 'light', the XPMs could perhaps be optimized a bit; eg the black+white hour glass colormap could be 8 instead of 16 without suffering the image quality; would save some memory weight (since xpms inline in the executables as strings).
As an example, I loaded hourglass xpm in gimp, set Image>Mode>Indexed to 8, disable dither, re-save. Size 857 instead of 1295.. smaller by 33%. Every little bit helps ;) | |
|
#5 | AlbrechtS 00:29 Jun 09, 2011 |
| I just noticed that the configure.in patch uses "xdbe" instead of "xcursor" - this must be fixed. I didn't check nor test anything else yet. | |
|
#6 | ossman 02:04 Jun 09, 2011 |
| > Just browsing these patches.. > > To keep things 'light', the XPMs could perhaps be optimized a bit;
Sounds like a very good improvement. I just threw together something so that there wouldn't be a regression compared to existing code. The hourglass might be a bit bigger than necessary as well.
> I just noticed that the configure.in patch uses "xdbe" instead of > "xcursor" - this must be fixed. I didn't check nor test anything else > yet.
Oops. Copy-paste error. Should be easy enough to fix manually when applying though. | |
|
#7 | ossman 00:51 Jun 14, 2011 |
| Found another issue. Windows images are bottom up by default, so we need to specify a negative height to get the normal top down behaviour. Not sure how I managed to miss this during the initial testing...
Updated patch with this fixed as well as the configure option. Haven't done anything with the built-in cursors at this point. | |
|
#8 | hean01 01:09 Sep 16, 2011 |
| New update to the cursor patch:
Better error and resource management of cursors on Windows. | |
|
#9 | astrand 05:36 Jun 19, 2012 |
| Updated patch for latest trunk. Nominating for 1.3.x. | |
|
#10 | ossman 05:08 Jan 31, 2013 |
| The previous patch had an ABI breakage. It also had incorrect CMake changes. Updated patch should be better. | |
|
#11 | ianmacarthur 05:23 Jan 31, 2013 |
| ... though note that ABI breakage can be "allowed" if you guard it using the FLTK_ABI_VERSION guards, to allow the code to build to the 1.3.0 ABI by default, whilst allowing a uset to select the "new" ABI by defining the guard appropriatley....
though in this case... not necessary? The new version of the patch gives the "default" 1.3.0 ABI anyway? | |
|
#12 | ossman 05:40 Jan 31, 2013 |
| It is not necessary here, no. I thought it was safe in the original patch, but it turned out to only be API safe, not ABI. The new version should be backwards compatible in both regards. | |
|
#13 | rdieter 07:14 Jun 07, 2013 |
| Trying the latest patch posted here against fltk-1.3.2 doesn't build for me (on fedora 19, gcc-4.8.1):
fl_cursor.cxx: In function 'void fallback_cursor(Fl_Window*, Fl_Cursor)': fl_cursor.cxx:105:26: error: no matching function for call to 'Fl_RGB_Image::Fl_RGB_Image(Fl_Pixmap*)' Fl_RGB_Image image(&pxm); ^ fl_cursor.cxx:105:26: note: candidates are: In file included from ../FL/Fl_Pixmap.H:24:0, from fl_cursor.cxx:27: ../FL/Fl_Image.H:204:3: note: Fl_RGB_Image::Fl_RGB_Image(const uchar*, int, int, int, int) Fl_RGB_Image(const uchar *bits, int W, int H, int D=3, int LD=0) : ^ ../FL/Fl_Image.H:204:3: note: candidate expects 5 arguments, 1 provided In file included from ../FL/Fl_Pixmap.H:24:0, from fl_cursor.cxx:27: ../FL/Fl_Image.H:167:7: note: Fl_RGB_Image::Fl_RGB_Image(const Fl_RGB_Image&) class FL_EXPORT Fl_RGB_Image : public Fl_Image { ^ ../FL/Fl_Image.H:167:7: note: no known conversion for argument 1 from 'Fl_Pixmap*' to 'const Fl_RGB_Image&' | |
|
#14 | ossman 00:41 Jun 10, 2013 |
| STR #2659 is required as well, and from the error it looks like that is missing in your build. | |
|
#15 | ossman 04:19 Jun 16, 2014 |
| Fixed in Subversion repository. | |
|
#16 | manolo 08:11 Jun 16, 2014 |
| That support for custom cursors is a great addition! The new Fl_Image_Surface class fits nicely with that allowing to draw into an image to be used as a cursor.
In the Mac OS support, I wonder whether line 3358 of file Fl_cocoa.mm should not be instead if ( !(image->d() & 1) ) { because the even (2 and 4) values of image->d() denote alpha presence. | |
|
#17 | ossman 04:15 Jun 17, 2014 |
| Quite right. Apparently it did not have enough effect on the end result for me to notice. Fixed in r10199. | |
[ Return to Bugs & Features ]
|
| |