[gtk+] win32 theme: Make tooltips look right



commit 6c0270bbcb3864800334999b335f4c73d9941fc7
Author: Benjamin Otte <otte redhat com>
Date:   Mon Feb 22 04:16:36 2016 +0100

    win32 theme: Make tooltips look right
    
    Includes adding fallback support

 gtk/gtkwin32draw.c                 |   20 ++++++++++++++++++++
 gtk/theme/win32/gtk-win32-base.css |   12 ++++--------
 2 files changed, 24 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkwin32draw.c b/gtk/gtkwin32draw.c
index 6caaa77..0483723 100644
--- a/gtk/gtkwin32draw.c
+++ b/gtk/gtkwin32draw.c
@@ -234,6 +234,25 @@ draw_window_button (cairo_t *cr,
   mask_icon (cr, icon, 1, 1, width - 2, height - 2);
 }
 
+static void
+draw_tooltip (cairo_t *cr,
+              int      part,
+              int      state,
+              int      width,
+              int      height)
+{
+  int xborder = gtk_win32_get_sys_metric (GTK_WIN32_SYS_METRIC_CXDLGFRAME) -
+                gtk_win32_get_sys_metric (GTK_WIN32_SYS_METRIC_CXEDGE);
+  int yborder = gtk_win32_get_sys_metric (GTK_WIN32_SYS_METRIC_CYDLGFRAME) -
+                gtk_win32_get_sys_metric (GTK_WIN32_SYS_METRIC_CYEDGE);
+
+  cairo_rectangle (cr, 0, 0, width, height);
+  cairo_rectangle (cr, width - xborder, yborder,
+                   - (width - 2 * xborder), height - 2 * yborder);
+  gtk_cairo_set_source_sys_color (cr, GTK_WIN32_SYS_COLOR_WINDOWFRAME);
+  cairo_fill (cr);
+}
+
 typedef struct _GtkWin32ThemePart GtkWin32ThemePart;
 struct _GtkWin32ThemePart {
   const char *class_name;
@@ -251,6 +270,7 @@ static GtkWin32ThemePart theme_parts[] = {
   { "button",  1,  0, { 3, 3, 3, 3 }, draw_button },
   { "button",  2, 13, { 0, 0, 0, 0 }, draw_radio },
   { "button",  3, 13, { 0, 0, 0, 0 }, draw_check },
+  { "tooltip", 1,  0, { 0, 0, 0, 0 }, draw_tooltip },
   { "window",  1,  0, { 0, 0, 0, 0 }, draw_window },
   { "window", 15,  0, { 0, 0, 0, 0 }, draw_window_button },
   { "window", 17,  0, { 0, 0, 0, 0 }, draw_window_button },
diff --git a/gtk/theme/win32/gtk-win32-base.css b/gtk/theme/win32/gtk-win32-base.css
index 1795d71..1c5026f 100644
--- a/gtk/theme/win32/gtk-win32-base.css
+++ b/gtk/theme/win32/gtk-win32-base.css
@@ -117,15 +117,11 @@ scrolledwindow.frame {
   color: @selected_fg_color;
 }
 
-tooltip {
-    background-color: transparent;
-    background-image: -gtk-win32-theme-part(tooltip, 3, 1);
-    color: -gtk-win32-color(button, infotext);
-    border-width: 0px;
-}
-
-tooltip * {
+tooltip, tooltip.background {
+    background-color: -gtk-win32-color(tooltip, infobk);
+    background-image: -gtk-win32-theme-part(tooltip, 1, 1);
     color: -gtk-win32-color(button, infotext);
+    padding: 2px;
 }
 
 assistant .sidebar .highlight {


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