Bug 105415 - System (theme) caret color and size not taken into account
Summary: System (theme) caret color and size not taken into account
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
(earliest affected)
Inherited From OOo
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
Whiteboard: target:5.4.0
Keywords: accessibility, skillDesign, topicUI
Depends on:
Blocks: a11y-Linux UI-Theming
  Show dependency treegraph
Reported: 2017-01-18 15:02 UTC by cwendling
Modified: 2017-03-22 10:36 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:

Use the system caret width on GTK (2.06 KB, patch)
2017-03-15 16:55 UTC, cwendling

Note You need to log in before you can comment on or make changes to this bug.
Description cwendling 2017-01-18 15:02:28 UTC
All UI components in LO have a custom caret (insertion point), not following the system theme's size and color for it (irrespective of options under LO/Accessibility).  This applies to Writer's text area, Calc's cells, or any text entries like the search box or some preferences.

It is problematic for accessibility purposes where some users want a larger/differently colored caret to help spot it more easily.

GTK2 theme options for that are:

* GtkWidget::cursor_color (color: https://developer.gnome.org/gtk2/stable/GtkWidget.html#GtkWidget--s-cursor-color)
* GtkWidget::secondary_cursor_color (color for secondary caret at RTL/LTR bounds: https://developer.gnome.org/gtk2/stable/GtkWidget.html#GtkWidget--s-secondary-cursor-color)
* GtkWidget::cursor_aspect_ratio (size: https://developer.gnome.org/gtk2/stable/GtkWidget.html#GtkWidget--s-cursor-aspect-ratio)

Some themes (like HighContrast) set those on specific widgets instead, like GtkTextView, GtkEntry and EelEditableLabel instead of GtkWidget directly.

This applies at least from 4.2 to, but probably also on older versions.  Using the GTK2 backend, but the GTK3 one is likely affected.

Steps to reproduce:

1. Alter the caret color and size on your theme.  For example, drop the following snippet in ~/.gtkrc-2.0:

# --8<--
style "caret"
  GtkWidget::cursor_color = "#FF0000"
  GtkWidget::cursor_aspect_ratio = 0.2
  GtkTextView::cursor_color = "#00FF00"
  GtkTextView::cursor_aspect_ratio = 0.2
  GtkEntry::cursor_color = "#0000FF"
  GtkEntry::cursor_aspect_ratio = 0.2
class "GtkWidget" style "caret"
# --8<--

2. Open any GTK2 app proposing text entries, and see the caret is larger and of a different color (depending on the type of input field with my example).

3. Open LO, and see no changes to the caret.
Comment 1 cwendling 2017-03-15 16:55:55 UTC
Created attachment 131908 [details]
Use the system caret width on GTK

Patch to use the system (GTK theme) caret width on GTK2 and GTK3.
Comment 2 Samuel Mehrbrodt (allotropia) 2017-03-16 10:40:36 UTC
Could you please try submitting the patch to gerrit? https://wiki.documentfoundation.org/Development/gerrit
Comment 3 cwendling 2017-03-16 15:57:55 UTC
(In reply to Samuel Mehrbrodt (CIB) from comment #2)
> Could you please try submitting the patch to gerrit?
> https://wiki.documentfoundation.org/Development/gerrit

Sure, done: https://gerrit.libreoffice.org/#/c/35282/
Comment 4 Commit Notification 2017-03-21 16:40:44 UTC
Colomban Wendling committed a patch related to this issue.
It has been pushed to "master":


tdf#105415 Use the system caret width on GTK

It will be available in 5.4.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 5 Alex ARNAUD 2017-03-22 10:36:25 UTC
Dear all,

On Debian 8.7 with the new daily build of LibreOfficeDev 5.4 it works.

Best regards.