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>
This commit is contained in:
Colomban Wendling
2017-03-15 17:12:04 +01:00
committed by Caolán McNamara
parent bdaa13a877
commit 17307a1053
2 changed files with 12 additions and 0 deletions

View File

@@ -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;

View File

@@ -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);