LibreOffice - Change the mouse cursor icon when hovering the spreadsheet

Nuno Ferreira nuno360 at gmail.com
Wed Feb 8 20:11:16 UTC 2017


Thanks Tomaž, yep I missed the GDK_CROSS on the gtk3 reference page
https://developer.gnome.org/gdk3/stable/gdk3-Cursors.html

I am implementing *PointerStyle::FatCross* to be used to diplay a 'fat
cross' mouse cursor when hovering the spreadsheet grid. Up to this point, I
am only concerned with the GTK3 backend. So far I have done:

1. Expanded the *enum class PointerStyle *to include *FatCross           =
96, *in file /libreoffice/include/vcl/ptrstyle.hxx;

2. Changed line 53 of 'fudraw.cxx' from    *aNewPointer (
PointerStyle::Arrow ),* to

*aNewPointer ( PointerStyle::FatCross ), *
3. Added line *MAP_BUILTIN( PointerStyle::FatCross, GDK_CROSS );* to *GdkCursor
*GtkSalDisplay::getCursor( PointerStyle ePointerStyle )* on files
*gtkdata.cxx* and *gtk3gtkdata.cxx. *This should do the mapping of
*FatCross* from vcl to gtk3.

This changes will compile successfully. However, when I start LO-Calc and
hover over the cell grid area, the program crashes and displays an
'unexpected error'. My guess is that the *FatCross           = 96, *member
of *enum class PointerStyle* is not defined correctly. Any idea on what is
needed to define *FatCross*? How can I make the *FatCross* work in GTK3?

ps: As I said in the email I set earlier:

Basically the idea is to change the 'arrow' mouse icon into a 'fat cross'
when hovering over calc spreadsheet cell grid.

Preliminar investigation reveals that this behaviour can be well
approximated if line 53 of file fudraw.cxx is changed from
"   aNewPointer ( PointerStyle::Arrow )," change into "    aNewPointer (
PointerStyle::Cross ),"

However, the resulting cross looks a litle bit too thin and cannot be used
because it is the same mouse cursor used to drag equations around. This is
why I created a new PointerStyle::FatCross, so it is different from
PointerStyle::Cross, which is currently used to drag equations.


2017-02-06 9:42 GMT+00:00 Tomaž Vajngerl <quikee at gmail.com>:

> Hi,
>
> On Fri, Feb 3, 2017 at 10:12 AM, Nuno Ferreira <nuno360 at gmail.com> wrote:
> > Another issue is the fact that GTK3+ does not seem to offer the fat cross
> > anymore, only the crosshair....
> > https://developer.gnome.org/gdk3/stable/gdk3-Cursors.html. If this is
> true
> > maybe we could use the crosshair when hovering over the grid of the
> > spreadsheet? Send a request to GTK team to include a fat cross on their
> icon
> > set?
>
> There is still GDK_CROSS and GDK_CROSSHAIR in the GdkCursorType enum
> (on that same gtk3 reference page). Maybe you missed that? I guess you
> can't create the cursor with gdk_cursor_new_from_name and have to use
> gdk_cursor_new which accepts a GdkCursorType enum.
>
> Anyway gtk3 is only one of the back-ends :)
>
> > Thanks,
> > Nuno
>
> Regards, Tomaž
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20170208/0a5005f9/attachment.html>


More information about the LibreOffice mailing list