Skip to content

Commit

Permalink
libmetacity: switch from .ssd to .csd
Browse files Browse the repository at this point in the history
  • Loading branch information
muktupavels committed Aug 31, 2016
1 parent 86cf1df commit d7f2445
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 9 deletions.
2 changes: 1 addition & 1 deletion libmetacity/meta-style-info.c
Expand Up @@ -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] =
Expand Down
69 changes: 61 additions & 8 deletions src/compositor/compositor-xrender.c
Expand Up @@ -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"
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -2995,6 +3012,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)
Expand Down Expand Up @@ -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
Expand All @@ -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 */
Expand Down
6 changes: 6 additions & 0 deletions src/core/window.c
Expand Up @@ -8667,6 +8667,12 @@ meta_window_get_transient_for (MetaWindow *window)
return NULL;
}

gboolean
meta_window_is_fullscreen (MetaWindow *window)
{
return window->fullscreen;
}

gboolean
meta_window_is_maximized (MetaWindow *window)
{
Expand Down
1 change: 1 addition & 0 deletions src/include/window.h
Expand Up @@ -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);
Expand Down

0 comments on commit d7f2445

Please sign in to comment.