[gtk+] W32: Fix double-arrowed combobox button



commit 2b36054a5d311cbf8dbffe2cf01df3d43c6209bd
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date:   Tue Mar 25 17:25:47 2014 +0000

    W32: Fix double-arrowed combobox button
    
    The arrow is part of the background image drawn by the theme, don't draw
    GTK's own arrow. This also applies to non-entry comboboxes.
    
    On XP the arrow-and-nothing-else part does not exist (W32 XP theme draws a
    white rectangle) and has to be subtituted for a simple dropdown button even
    for non-entry comboboxes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727035

 gtk/resources/theme/gtk-win32-base.css |   35 ++++++++++++++++++++++++++++++++
 gtk/resources/theme/gtk-win32-xp.css   |   10 +++++++++
 2 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/gtk/resources/theme/gtk-win32-base.css b/gtk/resources/theme/gtk-win32-base.css
index a845769..a76c994 100644
--- a/gtk/resources/theme/gtk-win32-base.css
+++ b/gtk/resources/theme/gtk-win32-base.css
@@ -744,6 +744,41 @@ GtkComboBox .separator {
     -GtkWidget-vertical-separator: 0;
 }
 
+/* Draw "arrow" for non-entry comboboxes. Select the box, since selecting
+   the arrow itself does not seem to work as intended. */
+GtkComboBox GtkBox {
+    color: rgba(255, 0, 0, 0);
+    background-image: -gtk-win32-theme-part(combobox, 6 1);
+}
+GtkComboBox GtkBox:insensitive {
+    color: rgba(255, 0, 0, 0);
+    background-image: -gtk-win32-theme-part(combobox, 6 4);
+}
+/* Make sure the style above does not touch comboboxes with entries by
+   disabling background image for the box again */
+GtkComboBox.combobox-entry GtkBox {
+    color: rgba(255, 0, 0, 0);
+    background-image: none;
+}
+GtkComboBox.combobox-entry GtkBox:insensitive {
+    color: rgba(255, 0, 0, 0);
+    background-image: none;
+}
+/* The arrow is part of the background image drawn by the theme, don't draw GTK's own arrow */
+GtkComboBox.combobox-entry GtkArrow {
+    color: rgba(255, 0, 0, 0);
+}
+GtkComboBox.combobox-entry GtkArrow:insensitive {
+    color: rgba(255, 0, 0, 0);
+}
+GtkComboBox GtkArrow {
+    color: rgba(255, 0, 0, 0);
+}
+GtkComboBox GtkArrow:insensitive {
+    color: rgba(255, 0, 0, 0);
+}
+
+
 /* Notebook */
 
 .notebook {
diff --git a/gtk/resources/theme/gtk-win32-xp.css b/gtk/resources/theme/gtk-win32-xp.css
index 70ee862..c1788a2 100644
--- a/gtk/resources/theme/gtk-win32-xp.css
+++ b/gtk/resources/theme/gtk-win32-xp.css
@@ -1,5 +1,15 @@
 @import url("gtk-win32-base.css");
 
+/* Override non-entry combobox arrow parts from the base theme,
+   since XP draws an empty white rectangle for parts 6 1 and 6 4.
+   Draw parts 1 1 and 1 4 instead */
+GtkComboBox GtkBox {
+    background-image: -gtk-win32-theme-part(combobox, 1 1, margins (1 0 1 0));
+}
+GtkComboBox GtkBox:insensitive {
+    background-image: -gtk-win32-theme-part(combobox, 1 4, margins (1 0 1 0));
+}
+
 .menubar {
     background-color: #f7f7f7;
     /*background-color: -gtk-win32-color(button, 30);*/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]