summaryrefslogtreecommitdiff
path: root/src/compositor
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2019-10-19 22:26:24 +0300
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2019-10-19 22:26:24 +0300
commitf18e07052f25d01d7b10a64d72c486ffd9f92a08 (patch)
tree74cbc7f13430c0d64edd2ffc90398fbf3047dff1 /src/compositor
parent3efbf74517be31bc08df3178a9a0caafb9edc12d (diff)
downloadmetacity-f18e07052f25d01d7b10a64d72c486ffd9f92a08.tar.gz
surface: add meta_surface_has_shadow
Diffstat (limited to 'src/compositor')
-rw-r--r--src/compositor/meta-surface.c50
-rw-r--r--src/compositor/meta-surface.h2
2 files changed, 52 insertions, 0 deletions
diff --git a/src/compositor/meta-surface.c b/src/compositor/meta-surface.c
index d3ead157..52d9114b 100644
--- a/src/compositor/meta-surface.c
+++ b/src/compositor/meta-surface.c
@@ -25,6 +25,7 @@
#include "errors.h"
#include "frame.h"
#include "meta-compositor-private.h"
+#include "prefs.h"
#include "window-private.h"
typedef struct
@@ -625,6 +626,55 @@ meta_surface_get_image (MetaSurface *self)
}
gboolean
+meta_surface_has_shadow (MetaSurface *self)
+{
+ MetaSurfacePrivate *priv;
+
+ priv = meta_surface_get_instance_private (self);
+
+ /* Do not add shadows to fullscreen windows */
+ if (meta_window_is_fullscreen (priv->window))
+ return FALSE;
+
+ /* Do not add shadows to maximized windows */
+ if (meta_window_is_maximized (priv->window))
+ return FALSE;
+
+ /* Add shadows to windows with frame */
+ if (meta_window_get_frame (priv->window) != NULL)
+ {
+ /* Do not add shadows if GTK+ theme is used */
+ if (meta_prefs_get_theme_type () == META_THEME_TYPE_GTK)
+ return FALSE;
+
+ return TRUE;
+ }
+
+ /* Do not add shadows to non-opaque windows */
+ if (!meta_surface_is_opaque (self))
+ return FALSE;
+
+ /* Do not add shadows to client side decorated windows */
+ if (meta_window_is_client_decorated (priv->window))
+ return FALSE;
+
+ /* Never put a shadow around shaped windows */
+ if (priv->window->shape_region != None)
+ return FALSE;
+
+ /* Don't put shadow around DND icon windows */
+ if (priv->window->type == META_WINDOW_DND)
+ return FALSE;
+
+ /* Don't put shadow around desktop windows */
+ if (priv->window->type == META_WINDOW_DESKTOP)
+ return FALSE;
+
+ /* Add shadows to all other windows */
+ return TRUE;
+}
+
+gboolean
meta_surface_is_opaque (MetaSurface *self)
{
MetaSurfacePrivate *priv;
diff --git a/src/compositor/meta-surface.h b/src/compositor/meta-surface.h
index 9fc74ed8..60d9824b 100644
--- a/src/compositor/meta-surface.h
+++ b/src/compositor/meta-surface.h
@@ -47,6 +47,8 @@ XserverRegion meta_surface_get_shape_region (MetaSurface *self);
cairo_surface_t *meta_surface_get_image (MetaSurface *self);
+gboolean meta_surface_has_shadow (MetaSurface *self);
+
gboolean meta_surface_is_opaque (MetaSurface *self);
gboolean meta_surface_is_visible (MetaSurface *self);