[metacity] libmetacity: switch from .ssd to .csd



commit d7f2445ec7e70274c7501586a537c699f6628335
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Wed Aug 31 17:55:14 2016 +0300

    libmetacity: switch from .ssd to .csd

 libmetacity/meta-style-info.c       |    2 +-
 src/compositor/compositor-xrender.c |   69 +++++++++++++++++++++++++++++++----
 src/core/window.c                   |    6 +++
 src/include/window.h                |    1 +
 4 files changed, 69 insertions(+), 9 deletions(-)
---
diff --git a/libmetacity/meta-style-info.c b/libmetacity/meta-style-info.c
index 30ab687..f155890 100644
--- a/libmetacity/meta-style-info.c
+++ b/libmetacity/meta-style-info.c
@@ -164,7 +164,7 @@ meta_style_info_constructed (GObject *object)
                           NULL,
                           "window",
                           GTK_STYLE_CLASS_BACKGROUND,
-                          style_info->composited == TRUE ? "ssd" : "solid-csd",
+                          style_info->composited == TRUE ? "csd" : "solid-csd",
                           NULL);
 
   style_info->styles[META_STYLE_ELEMENT_DECORATION] =
diff --git a/src/compositor/compositor-xrender.c b/src/compositor/compositor-xrender.c
index 11a1ca9..963aa1f 100644
--- a/src/compositor/compositor-xrender.c
+++ b/src/compositor/compositor-xrender.c
@@ -38,6 +38,7 @@
 #include "screen.h"
 #include "frame.h"
 #include "errors.h"
+#include "prefs.h"
 #include "window.h"
 #include "compositor-private.h"
 #include "compositor-xrender.h"
@@ -1037,22 +1038,38 @@ window_has_shadow (MetaCompWindow *cw)
   if (info == NULL || info->have_shadows == FALSE)
     return FALSE;
 
-  /* Always put a shadow around windows with a frame - This should override
-     the restriction about not putting a shadow around shaped windows
-     as the frame might be the reason the window is shaped */
+  /* Always put a shadow around windows with a frame. This should override
+   * the restriction about not putting a shadow around shaped windows as the
+   * frame might be the reason the window is shaped.
+   */
   if (cw->window)
     {
-      /* Do not add shadows for maximized windows */
+      /* Do not add shadows to fullscreen windows */
+      if (meta_window_is_fullscreen (cw->window))
+        {
+          meta_verbose ("Window has no shadow because it is fullscreen\n");
+          return FALSE;
+        }
+
+      /* Do not add shadows to maximized windows */
       if (meta_window_is_maximized (cw->window))
         {
           meta_verbose ("Window has no shadow because it is maximized\n");
           return FALSE;
         }
 
-      if (meta_window_get_frame (cw->window)) {
-        meta_verbose ("Window has shadow because it has a frame\n");
-        return TRUE;
-      }
+      /* Do not add shadows if GTK+ theme is used */
+      if (meta_prefs_get_theme_type () == META_THEME_TYPE_GTK)
+        {
+          meta_verbose ("Window has shadow from GTK+ theme\n");
+          return FALSE;
+        }
+
+      if (meta_window_get_frame (cw->window))
+        {
+          meta_verbose ("Window has shadow because it has a frame\n");
+          return TRUE;
+        }
     }
 
   /* Do not add shadows to ARGB windows */
@@ -2996,6 +3013,38 @@ xrender_remove_window (MetaCompositor *compositor,
 }
 
 static void
+update_shadows (MetaPreference pref,
+                gpointer       data)
+{
+  MetaCompScreen *info;
+  MetaDisplay *display;
+  Display *xdisplay;
+  GList *index;
+
+  if (pref != META_PREF_THEME_TYPE)
+    return;
+
+  info = (MetaCompScreen *) data;
+  display = meta_screen_get_display (info->screen);
+  xdisplay = meta_display_get_xdisplay (display);
+
+  for (index = info->windows; index; index = index->next)
+    {
+      MetaCompWindow *cw;
+
+      cw = (MetaCompWindow *) index->data;
+
+      if (cw->window && cw->shadow)
+        {
+          XRenderFreePicture (xdisplay, cw->shadow);
+          cw->shadow = None;
+        }
+
+      cw->needs_shadow = window_has_shadow (cw);
+    }
+}
+
+static void
 show_overlay_window (MetaScreen *screen,
                      Window      cow)
 {
@@ -3123,6 +3172,8 @@ xrender_manage_screen (MetaCompositor *compositor,
 
   /* Now we're up and running we can show the output if needed */
   show_overlay_window (screen, info->output);
+
+  meta_prefs_add_listener (update_shadows, info);
 }
 
 static void
@@ -3141,6 +3192,8 @@ xrender_unmanage_screen (MetaCompositor *compositor,
   if (info == NULL)
     return;
 
+  meta_prefs_remove_listener (update_shadows, info);
+
   hide_overlay_window (screen, info->output);
 
   /* Destroy the windows */
diff --git a/src/core/window.c b/src/core/window.c
index d6d3d41..499e362 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -8668,6 +8668,12 @@ meta_window_get_transient_for (MetaWindow *window)
 }
 
 gboolean
+meta_window_is_fullscreen (MetaWindow *window)
+{
+  return window->fullscreen;
+}
+
+gboolean
 meta_window_is_maximized (MetaWindow *window)
 {
   return META_WINDOW_MAXIMIZED (window);
diff --git a/src/include/window.h b/src/include/window.h
index 6e81829..f82c444 100644
--- a/src/include/window.h
+++ b/src/include/window.h
@@ -34,6 +34,7 @@ MetaScreen *meta_window_get_screen (MetaWindow *window);
 MetaDisplay *meta_window_get_display (MetaWindow *window);
 Window meta_window_get_xwindow (MetaWindow *window);
 MetaWindow *meta_window_get_transient_for (MetaWindow *window);
+gboolean meta_window_is_fullscreen (MetaWindow *window);
 gboolean meta_window_is_maximized (MetaWindow *window);
 
 cairo_region_t *meta_window_get_frame_bounds (MetaWindow *window);


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