[gnome-flashback/gnome-3-18] common: fix GfPopupWindow style



commit 1fcde3a5035105f9b16f9ce58254f939d426f690
Author: Sebastian Geiger <sbastig gmx net>
Date:   Fri Jan 22 20:21:30 2016 +0100

    common: fix GfPopupWindow style
    
    Backported from commit: 0172949aa66fb74821f98da4316764ea1aa1442b

 gnome-flashback/Adwaita.css                 |    8 ++++-
 gnome-flashback/HighContrast.css            |    8 ++++-
 gnome-flashback/libcommon/gf-popup-window.c |   41 +++++++++++++++++++++++++-
 3 files changed, 53 insertions(+), 4 deletions(-)
---
diff --git a/gnome-flashback/Adwaita.css b/gnome-flashback/Adwaita.css
index 794e263..0f33634 100644
--- a/gnome-flashback/Adwaita.css
+++ b/gnome-flashback/Adwaita.css
@@ -1,7 +1,13 @@
 GfPopupWindow
 {
-  border-radius: 20px;
+  background-color: #e8e8e7;
   border: 1px solid rgba(0, 0, 0, 0.23);
+  border-radius: 10px;
+}
+
+GfPopupWindow.solid {
+    border: 1px solid #a5a5a1;
+    border-radius: 0;
 }
 
 GfInputSourcePopup #input-source
diff --git a/gnome-flashback/HighContrast.css b/gnome-flashback/HighContrast.css
index 794e263..74383ab 100644
--- a/gnome-flashback/HighContrast.css
+++ b/gnome-flashback/HighContrast.css
@@ -1,7 +1,13 @@
 GfPopupWindow
 {
-  border-radius: 20px;
+  background-color: #ffffff;
   border: 1px solid rgba(0, 0, 0, 0.23);
+  border-radius: 10px;
+}
+
+GfPopupWindow.solid {
+    border: 1px solid #8d8d8d;
+    border-radius: 0px;
 }
 
 GfInputSourcePopup #input-source
diff --git a/gnome-flashback/libcommon/gf-popup-window.c b/gnome-flashback/libcommon/gf-popup-window.c
index 14384ac..0683585 100644
--- a/gnome-flashback/libcommon/gf-popup-window.c
+++ b/gnome-flashback/libcommon/gf-popup-window.c
@@ -21,7 +21,8 @@
 typedef struct _GfPopupWindowPrivate GfPopupWindowPrivate;
 struct _GfPopupWindowPrivate
 {
-  guint fade_id;
+  gboolean composited;
+  guint    fade_id;
 };
 
 enum
@@ -49,7 +50,7 @@ fade_out_cb (gpointer user_data)
   opacity = gtk_widget_get_opacity (widget);
 
   opacity -= 0.04;
-  if (opacity < 0.00)
+  if (!priv->composited || opacity < 0.00)
     {
       gtk_widget_set_opacity (widget, 1.0);
 
@@ -128,6 +129,27 @@ get_background_surface (GtkWidget *widget,
   return surface;
 }
 
+static void
+gf_popup_window_composited_changed (GtkWidget *widget)
+{
+  GfPopupWindow *window;
+  GfPopupWindowPrivate *priv;
+  GdkScreen *screen;
+  GtkStyleContext *context;
+
+  window = GF_POPUP_WINDOW (widget);
+  priv = gf_popup_window_get_instance_private (window);
+
+  screen = gtk_widget_get_screen (widget);
+  context = gtk_widget_get_style_context (widget);
+  priv->composited = gdk_screen_is_composited (screen);
+
+  if (priv->composited)
+    gtk_style_context_remove_class (context, "solid");
+  else
+    gtk_style_context_add_class (context, "solid");
+}
+
 static gboolean
 gf_popup_window_draw (GtkWidget *widget,
                       cairo_t   *cr)
@@ -158,12 +180,26 @@ gf_popup_window_draw (GtkWidget *widget,
 static void
 gf_popup_window_realize (GtkWidget *widget)
 {
+  GfPopupWindow *window;
+  GfPopupWindowPrivate *priv;
   GdkScreen *screen;
+  GtkStyleContext *context;
   GdkVisual *visual;
 
+  window = GF_POPUP_WINDOW (widget);
+  priv = gf_popup_window_get_instance_private (window);
+
   screen = gtk_widget_get_screen (widget);
+  context = gtk_widget_get_style_context (widget);
+
+  priv->composited = gdk_screen_is_composited (screen);
   visual = gdk_screen_get_rgba_visual (screen);
 
+  if (priv->composited)
+      gtk_style_context_remove_class (context, "solid");
+  else
+      gtk_style_context_add_class (context, "solid");
+
   if (visual == NULL)
     visual = gdk_screen_get_system_visual (screen);
 
@@ -183,6 +219,7 @@ gf_popup_window_class_init (GfPopupWindowClass *window_class)
 
   object_class->finalize = gf_popup_window_finalize;
 
+  widget_class->composited_changed = gf_popup_window_composited_changed;
   widget_class->draw = gf_popup_window_draw;
   widget_class->realize = gf_popup_window_realize;
 


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