Bug 148481 - Wrong mouse pointer shown for hyperlinks when pressing Ctrl
Summary: Wrong mouse pointer shown for hyperlinks when pressing Ctrl
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.3.2.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.4.0 target:7.3.3
Keywords:
: 133552 (view as bug list)
Depends on:
Blocks: GTK3 Qt5
  Show dependency treegraph
 
Reported: 2022-04-09 14:39 UTC by Rafael Lima
Modified: 2022-05-04 19:20 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Video showing the bug (710.04 KB, video/mp4)
2022-04-09 14:39 UTC, Rafael Lima
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Rafael Lima 2022-04-09 14:39:24 UTC
Created attachment 179428 [details]
Video showing the bug

When the user hovers the mouse over links in the table of contents of a Writer document, it is possible to press Ctrl and click the link, which will take to where the link is targeted.

However, when the user presses Ctrl the mouse pointer presented is a "full open hand" which is not the pointer used for links. The correct pointer should be a hand with a single raised finger.

See the attached video for more information. In the left I have the Writer document. Notice the mouse pointer when Ctrl is pressed. In the right I have Firefox and notice the mouse pointer used for links. I believe it would make more sense if the mouse pointer used for links in Firefox were the one used for links in Writer as well.

System information:
Version: 7.3.2.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 16; OS: Linux 5.13; UI render: default; VCL: kf5 (cairo+xcb)
Locale: pt-BR (pt_BR.UTF-8); UI: en-US
Ubuntu package version: 1:7.3.2~rc2-0ubuntu0.21.10.1~lo1
Calc: threaded
Comment 1 Heiko Tietze 2022-04-11 13:57:37 UTC
The issue applies to all kind of hyperlinks.

VCL = gen shows nicely the "refhand" (pointer finger up). Looking into the code it seems to be mistakenly assigned to the closed hand pointer, at least for gtk and qt. Wonder if there is a reason... And I haven't checked other OS.

vcl/unx/gtk/app/gtkdata.cxx
            MAP_BUILTIN( PointerStyle::RefHand, GDK_HAND2, "grab" );
            MAP_BUILTIN( PointerStyle::Hand, GDK_HAND2, "grab" );
vcl/Qt5/QtData.cxx
            MAP_BUILTIN(PointerStyle::RefHand, Qt::OpenHandCursor);
            MAP_BUILTIN(PointerStyle::Hand, Qt::OpenHandCursor);
Comment 2 Caolán McNamara 2022-04-11 14:22:21 UTC
this seems to date back to...

commit cbbaf4fb45979785385932e4c5fa3523228eab69
Author: Kurosawa Takeshi <taken.spc@gmail.com>
Date:   Fri Feb 11 20:08:38 2011 +0900

    Use GDK_HAND2 mouse cursor instead of GDK_HAND1
    
    LibreOffice uses GDK_HAND1 for POINTER_REFHAND and GDK_HAND2 for POINTER_HAND.
    However there is not much difference between GDK_HAND1 and GDK_HAND2.
    GDK_HAND1 means "a right-pointing hand" and GDK_HAND2 means "a left-pointing hand".
    
    Since GDK_HAND2 is much more popular and some cursor themes don't contain cursor file for GDK_HAND1, we should use GDK_HAND2 for both POINTER_REFHAND and POINTER_HAND.
Comment 3 Jan-Marek Glogowski 2022-04-11 15:13:25 UTC
vcl/osx/salframe.cxx:
    case PointerStyle::Hand: pCursor = [NSCursor openHandCursor];
    case PointerStyle::RefHand: pCursor = [NSCursor pointingHandCursor];

vcl/win/window/salframe.cxx:
    { nullptr, IDC_HAND, 0 },                                   // POINTER_HAND
    { nullptr, IDC_HAND, 0 },                                   // POINTER_REFHAND

Both GDK_HAND and GDK_HAND2 are pointing hands per default: https://www.geany.org/manual/gtk/gdk/gdk-Cursors.html

Qt has open, closed and pointing hand cursors: https://doc.qt.io/qt-5/qt.html#CursorShape-enum cursors.

It makes sense to map PointerStyle::RefHand to Qt::PointingHandCursor. Not sure about PointerStyle::Hand.

FWIW there is also bug 144302, which is a little bit more work.

Gerrit pending CI: https://gerrit.libreoffice.org/c/core/+/132833
Comment 4 Commit Notification 2022-04-11 18:31:49 UTC
Jan-Marek Glogowski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/9ae398054833120df36bf51738cc4cfd7efb3fdc

tdf#148481 Map RefHand cursor to Qt::PointingHand

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Commit Notification 2022-04-12 05:49:27 UTC
Jan-Marek Glogowski committed a patch related to this issue.
It has been pushed to "libreoffice-7-3":

https://git.libreoffice.org/core/commit/8a62db9759696cd3e5ba980f687c9be91490b4a5

tdf#148481 Map RefHand cursor to Qt::PointingHand

It will be available in 7.3.3.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Caolán McNamara 2022-04-12 09:53:24 UTC
seeing as it doesn't seem to make a difference under GTK3 (I see the same pointer for firefox and LibreOffice there) and the kf5 issue is now resolved I think we can call this fixed.
Comment 7 Rafael Lima 2022-05-04 19:20:00 UTC
*** Bug 133552 has been marked as a duplicate of this bug. ***