[Libreoffice-commits] core.git: vcl/unx
Colomban Wendling
cwendling at hypra.fr
Tue Mar 21 16:40:13 UTC 2017
vcl/unx/gtk/salnativewidgets-gtk.cxx | 6 ++++++
vcl/unx/gtk3/gtk3salnativewidgets-gtk.cxx | 6 ++++++
2 files changed, 12 insertions(+)
New commits:
commit 17307a10537fbd1f04c683c2f93bf880173ce3b4
Author: Colomban Wendling <cwendling at hypra.fr>
Date: Wed Mar 15 17:12:04 2017 +0100
tdf#105415 Use the system caret width on GTK
Change-Id: I6b7fc9d06a49613cc6fe247b44c56f36935082fa
Reviewed-on: https://gerrit.libreoffice.org/35282
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
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);
More information about the Libreoffice-commits
mailing list