diff options
| author | Alexander Kurtakov | 2016-11-07 11:57:17 +0000 |
|---|---|---|
| committer | Alexander Kurtakov | 2016-11-07 11:57:17 +0000 |
| commit | fcd70171fda1e7ba762d7de5322e8306283ccc2a (patch) | |
| tree | 72330c12eea80491a470b0ffb036144ce33899ea | |
| parent | aeb20b56bf83b7d1b51105a82e6a461cc86c597b (diff) | |
| download | eclipse.platform.swt-fcd70171fda1e7ba762d7de5322e8306283ccc2a.tar.gz eclipse.platform.swt-fcd70171fda1e7ba762d7de5322e8306283ccc2a.tar.xz eclipse.platform.swt-fcd70171fda1e7ba762d7de5322e8306283ccc2a.zip | |
Bug 491319 - [GTK3] Implement proper SWT.BORDER support for
DateTime/Spinner/Text
GtkEntry without frame will have a blank background color. So let's set
border via css and override the background in this case to be
COLOR_LIST_BACKGROUND instead of keeping the entry which causes double
border drawn in Forms.
Change-Id: I6a75f1585fccaf3a774143fe297e650a998b9978
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
| -rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java index 52c6c0f584..4db9674ac6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java @@ -208,11 +208,19 @@ void createHandle (int index) { OS.gtk_container_add (fixedHandle, handle); OS.gtk_editable_set_editable (handle, (style & SWT.READ_ONLY) == 0); /* - * We need to handle borders differently in GTK3.20+. See bug 491319. - * Leaving this call enabled on 3.20 causes an SWT.SINGLE Text widget - * to have a blank background color. + * We need to handle borders differently in GTK3.20+. GtkEntry without frame will have a blank background color. + * So let's set border via css and override the background in this case to be COLOR_LIST_BACKGROUND. */ - if (OS.GTK_VERSION < OS.VERSION(3, 20, 0)) { + if (OS.GTK_VERSION >= OS.VERSION(3, 20, 0)) { + if ((style & SWT.BORDER) == 0) { + OS.gtk_entry_set_has_frame(handle, false); + long /*int*/ context = OS.gtk_widget_get_style_context(handle); + String background = display.gtk_rgba_to_css_string( + display.toGdkRGBA(display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).handle)); + gtk_css_provider_load_from_css(context, "entry {border: solid; background: " + background + ";}"); + OS.gtk_style_context_invalidate(context); + } + } else { OS.gtk_entry_set_has_frame (handle, (style & SWT.BORDER) != 0); } OS.gtk_entry_set_visibility (handle, (style & SWT.PASSWORD) == 0); |
