summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColomban Wendling <cwendling@hypra.fr>2017-03-15 17:12:04 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-03-21 16:39:46 +0000
commit17307a10537fbd1f04c683c2f93bf880173ce3b4 (patch)
treebebab38644f4f63996bedb087eff0a943c1ab285
parentbdaa13a87744e424d3c210fc7f3f9e4f199d8279 (diff)
tdf#105415 Use the system caret width on GTK
Change-Id: I6b7fc9d06a49613cc6fe247b44c56f36935082fa Reviewed-on: https://gerrit.libreoffice.org/35282 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--vcl/unx/gtk/salnativewidgets-gtk.cxx6
-rw-r--r--vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx6
2 files changed, 12 insertions, 0 deletions
diff --git a/vcl/unx/gtk/salnativewidgets-gtk.cxx b/vcl/unx/gtk/salnativewidgets-gtk.cxx
index e8e8cdd81ef7..162b48535dcb 100644
--- a/vcl/unx/gtk/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/salnativewidgets-gtk.cxx
@@ -4108,6 +4108,12 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
aStyleSet.SetTitleFont( aFont );
aStyleSet.SetFloatTitleFont( aFont );
+ // Cursor width
+ gfloat caretAspectRatio = 0.04f;
+ gtk_widget_style_get( gWidgetData[m_nXScreen].gEditBoxWidget, "cursor-aspect-ratio", &caretAspectRatio, nullptr );
+ // Assume 20px tall for the ratio computation, which should give reasonable results
+ aStyleSet.SetCursorSize( 20 * caretAspectRatio + 1 );
+
// get cursor blink time
gboolean blink = false;
diff --git a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
index 60f2295b5a94..83bd40d9b9d1 100644
--- a/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx
@@ -2564,6 +2564,12 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
// This baby is the default page/paper color
aStyleSet.SetWindowColor( aBackFieldColor );
+ // Cursor width
+ gfloat caretAspectRatio = 0.04f;
+ gtk_style_context_get_style( pCStyle, "cursor-aspect-ratio", &caretAspectRatio, nullptr );
+ // Assume 20px tall for the ratio computation, which should give reasonable results
+ aStyleSet.SetCursorSize( 20 * caretAspectRatio + 1 );
+
// Dark shadow color
style_context_set_state(pCStyle, GTK_STATE_FLAG_INSENSITIVE);
gtk_style_context_get_color(pCStyle, gtk_style_context_get_state(pCStyle), &color);