diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2026-01-22 14:27:13 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2026-01-22 14:27:13 +0100 |
| commit | 05a3f82a5c385e7f00aa2bb8c1971e1cc99225a3 (patch) | |
| tree | 6d9a37921c572d108b9ff75f5728e9a1654b1306 /src/Fl_x.cxx | |
| parent | 14a5f705c8e3385a637be3377f0800b30c38e589 (diff) | |
Fix "Setting window custom cursor from SVG image crashes" (#1363)
Diffstat (limited to 'src/Fl_x.cxx')
| -rw-r--r-- | src/Fl_x.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index c690e750b..2afa2e9ae 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -3142,11 +3142,13 @@ int Fl_X11_Window_Driver::set_cursor(const Fl_RGB_Image *image, int hotx, int ho if ((hoty < 0) || (hoty >= image->h())) return 0; - cursor = XcursorImageCreate(image->w(), image->h()); + float s = image->as_svg_image() ? Fl::screen_scale(pWindow->screen_num()) : 1; + cursor = XcursorImageCreate(image->w() * s, image->h() * s); if (!cursor) return 0; - image = (Fl_RGB_Image*)image->copy(); + image = (Fl_RGB_Image*)image->copy(image->w() * s, image->h() * s); + ((Fl_RGB_Image*)image)->normalize(); const int extra_data = image->ld() ? (image->ld()-image->w()*image->d()) : 0; const uchar *i = (const uchar*)*image->data(); XcursorPixel *o = cursor->pixels; |
