After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 749053 - Adwaita-icon-theme cursors have bad non-X11 compatibility
Adwaita-icon-theme cursors have bad non-X11 compatibility
Status: RESOLVED FIXED
Product: adwaita-icon-theme
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: adwaita-icon-theme maintainer(s)
adwaita-icon-theme maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-05-07 07:20 UTC by LRN
Modified: 2015-05-13 17:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Name all the shadows (40.68 KB, patch)
2015-05-07 07:20 UTC, LRN
none Details | Review
Add a hotspots layer (47.55 KB, patch)
2015-05-07 07:20 UTC, LRN
none Details | Review
Major renderpngs modifications (19.10 KB, patch)
2015-05-07 07:20 UTC, LRN
none Details | Review
Add a hotspots layer (49.51 KB, patch)
2015-05-08 04:02 UTC, LRN
none Details | Review
Move all shadows to a separate layer (239.00 KB, patch)
2015-05-08 04:05 UTC, LRN
committed Details | Review
Major renderpngs modifications (21.55 KB, patch)
2015-05-08 04:07 UTC, LRN
none Details | Review
Add a hotspots layer (49.51 KB, patch)
2015-05-13 14:26 UTC, LRN
committed Details | Review
Add InvertFilter (1.13 KB, patch)
2015-05-13 14:27 UTC, LRN
none Details | Review
Major renderpngs modifications (23.46 KB, patch)
2015-05-13 14:30 UTC, LRN
none Details | Review
Add anicursorgen.py (8.85 KB, patch)
2015-05-13 14:31 UTC, LRN
none Details | Review
add InvertFilter (1.13 KB, patch)
2015-05-13 16:46 UTC, LRN
committed Details | Review
Major renderpngs modifications (23.35 KB, patch)
2015-05-13 16:47 UTC, LRN
committed Details | Review
Add anicursorgen.py (8.87 KB, patch)
2015-05-13 16:51 UTC, LRN
committed Details | Review

Description LRN 2015-05-07 07:20:22 UTC
I've looked for a way to use Adwaita cursors on non-X11 backends (W32, to be specific; with GTK), and found the cursor generator lacking.
First, i need to be able to get cursors without shadows (W32 WM can draw shadows, if user switches the appropriate option on).
Also, i need it to be able to generate smaller cursors in bigger canvases (because of the way cursor size is controlled on W32).
That meant that hotspots hardcoded into xcursorgen input files can no longer be relied upon (scaling moves the hotspots), so they must be generated somehow.
And scaled cursors should probably be aligned somewhere (to the center or to a corner).
And forking an Inkscape process 2000 times isn't fun on W32 either.
Comment 1 LRN 2015-05-07 07:20:29 UTC
Created attachment 303007 [details] [review]
Name all the shadows
Comment 2 LRN 2015-05-07 07:20:34 UTC
Created attachment 303008 [details] [review]
Add a hotspots layer
Comment 3 LRN 2015-05-07 07:20:39 UTC
Created attachment 303009 [details] [review]
Major renderpngs modifications

* Depends on Python Pillow library now
* Add the --remove-shadows option. Renders cursors without shadows.
  This depends on the shadows having appropriate names in adwaita.svg
* Add the --hotspots option. Renders hotspots into separate pngs,
  then finds its coordinates and writes out the xcursorgen input file
  accordingly.
  This depends on hotspots layer being present in the adwaita.svg.
* Add the --scales option. Makes all cursor canvases one size higher than they
  normally are (24->32, 32->48 etc). Renders extra cursor variants that
  are 125% and 150% larger than the nominal size (hence the canvas size increase
  - otherwise scaled up versions won't fit at all).
* Add the --min-canvas-size option. Makes all cursor canvases at least this
  big (padding smaller cursors when necessary).
* Add the --fps option. Used to adjust the frame duration written into xcursorgen
  input files.
* Add the --anicursorgen option. Changes the format of the files into something
  that anicursorgen understands better (changes frame duration from milliseconds
  to jiffies).
* Add the --corner-align option. Aligns cursors to the top-left corner instead
  of centering them on the canvas.
* Inkscape is now being run in shell mode (one instance, fed with commands via
  stdin).
Comment 4 LRN 2015-05-07 07:26:11 UTC
After thinking a bit more about the way X draws the cursor, i've realized that on X the L and XL cursors will actually be S and XS: nominal cursor size is set by the system; using a theme that has smaller cursors on canvas of the same size will make them look smaller. This acts as L and XL on W32 only because W32 uses the small-cursor-on-larger-canvas by default, so bigger cursors on the same canvas just look bigger.

That's going to confuse the hell out of cursor theme maintainers, but the end users will only see what the maintainers will show them, and that would be "S" and "XS" for the X11 versions of the "L" and "XL" themes.

Still, maybe more neutral (S1 and S2?) names should be chosen instead.
Comment 5 Jakub Steiner 2015-05-07 09:39:01 UTC
Thanks for all this work. even ifmotivated by Windows cursors a lot of this is useful for X. Before I even test this I'd like to point out things I like about this

- there is one script to get the final output
- things just work by default, parameters sort out special needs.
- metadata like click coordicantes/hotspots are defined visually, on canvas

The thing I don't quite grok/like is why do all the work to name shadows? I would expect separating them out onto a new layer and toggle its visibility like abetter approach (with --remove-shadows). Anything that removes manual work from the maintainer gets extra points...
Comment 6 LRN 2015-05-08 04:02:19 UTC
Created attachment 303056 [details] [review]
Add a hotspots layer

v2:
* Expanded the patch to cover the recently-added extra icons
Comment 7 LRN 2015-05-08 04:05:01 UTC
Created attachment 303057 [details] [review]
Move all shadows to a separate layer

Also remove some duplicate objects
Comment 8 LRN 2015-05-08 04:07:02 UTC
Created attachment 303058 [details] [review]
Major renderpngs modifications

v2:
* Filters out shadows by removing the 'shadows' layer, not by ignoring specially-named objects
* Hotspots and shadows filtering is merged in a single class
* Renamed --negate to --invert
* Add the --number-of-renderers option. Allows multiple Inkscape instances to
  be run in parallel for rendering speed increase on multicore systems.
* Misc logic fixes and refactoring
Comment 9 LRN 2015-05-13 14:26:00 UTC
Created attachment 303316 [details] [review]
Add a hotspots layer

v3:
* Align hotspots to 24x24 pixels a bit better
Comment 10 LRN 2015-05-13 14:27:27 UTC
Created attachment 303317 [details] [review]
Add InvertFilter

This filter is used in new in-SVG color inversion
Comment 11 LRN 2015-05-13 14:30:58 UTC
Created attachment 303318 [details] [review]
Major renderpngs modifications

v3:
* Filter SVG files from memory to avoid leaking a file descriptor
* Make slices and hotspots normally invisible
* New inversion code (inverts in SVG, not in rendered PNG).
  Quality is somewhat worse than it was with previous version,
  but at least it doesn't invert shadows.
Comment 12 LRN 2015-05-13 14:31:24 UTC
Created attachment 303319 [details] [review]
Add anicursorgen.py

Like xcursorgen, but written in Python and generates Windows cursors.
Comment 13 LRN 2015-05-13 16:46:17 UTC
Created attachment 303324 [details] [review]
add InvertFilter

v2:
Change the filter parameters to affect transparency differently.
These are not suitable for cursors (destroys outlines), but work
just fine for shadows.
Comment 14 LRN 2015-05-13 16:47:06 UTC
Created attachment 303325 [details] [review]
Major renderpngs modifications

v4:
* Change the behaviour of the inverter. Now it combines inverting the shadow in SVG
  and inverting the resulting PNG image.
Comment 15 LRN 2015-05-13 16:51:47 UTC
Created attachment 303326 [details] [review]
Add anicursorgen.py

v2:
* Add utf-8 markings to the source
Comment 16 Jakub Steiner 2015-05-13 17:26:23 UTC
Attachment 303057 [details] pushed as b7723b0 - Move all shadows to a separate layer
Attachment 303316 [details] pushed as 595c0b0 - Add a hotspots layer
Attachment 303324 [details] pushed as e60a5be - add InvertFilter
Attachment 303325 [details] pushed as 778e229 - Major renderpngs modifications
Attachment 303326 [details] pushed as 315db6b - Add anicursorgen.py