summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2010-12-09 23:43:26 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2010-12-09 23:43:26 +0800
commitdd424f2ee3df4da3c364c76b3eea7ffffd3668ec (patch)
tree508e104dc2c723e353a26d9a1ff6b6b91e063a42 /src
parent843a4b2be86ccc8aa5f0d71c4cc3a8d9ae81bbfd (diff)
downloadunity-window-decorator-dd424f2ee3df4da3c364c76b3eea7ffffd3668ec.tar.gz
unity-window-decorator-dd424f2ee3df4da3c364c76b3eea7ffffd3668ec.tar.bz2
Testing branch for active/inactive shadows
Diffstat (limited to 'src')
-rw-r--r--src/cairo.c17
-rw-r--r--src/decorator.c56
-rw-r--r--src/gtk-window-decorator.c16
-rw-r--r--src/gtk-window-decorator.h6
-rw-r--r--src/metacity.c24
-rw-r--r--src/wnck.c88
6 files changed, 175 insertions, 32 deletions
diff --git a/src/cairo.c b/src/cairo.c
index ffd8388..b2277a9 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -740,7 +740,10 @@ calc_decoration_size (decor_t *d,
if (w < top_width)
top_width = MAX (ICON_SPACE + d->button_width, w);
- decor_get_default_layout (&window_context, top_width, 1, &layout);
+ if (d->active)
+ decor_get_default_layout (&window_active_context, top_width, 1, &layout);
+ else
+ decor_get_default_layout (&window_inactive_context, top_width, 1, &layout);
if (!d->context || memcmp (&layout, &d->border_layout, sizeof (layout)))
{
@@ -748,8 +751,16 @@ calc_decoration_size (decor_t *d,
*height = layout.height;
d->border_layout = layout;
- d->context = &window_context;
- d->shadow = border_active_shadow;
+ if (d->active)
+ {
+ d->context = &window_active_context;
+ d->shadow = border_active_shadow;
+ }
+ else
+ {
+ d->context = &window_inactive_context;
+ d->shadow = border_inactive_shadow;
+ }
return TRUE;
}
diff --git a/src/decorator.c b/src/decorator.c
index 79dbee3..ce6b523 100644
--- a/src/decorator.c
+++ b/src/decorator.c
@@ -468,19 +468,20 @@ draw_border_shape (Display *xdisplay,
int
update_shadow (void)
{
- decor_shadow_options_t opt_shadow;
+ decor_shadow_options_t opt_active_shadow;
+ decor_shadow_options_t opt_inactive_shadow;
decor_shadow_options_t opt_no_shadow;
Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
GdkDisplay *display = gdk_display_get_default ();
GdkScreen *screen = gdk_display_get_default_screen (display);
- opt_shadow.shadow_radius = shadow_radius;
- opt_shadow.shadow_opacity = shadow_opacity;
+ opt_active_shadow.shadow_radius = shadow_radius;
+ opt_active_shadow.shadow_opacity = shadow_opacity;
- memcpy (opt_shadow.shadow_color, shadow_color, sizeof (shadow_color));
+ memcpy (opt_active_shadow.shadow_color, shadow_color, sizeof (shadow_color));
- opt_shadow.shadow_offset_x = shadow_offset_x;
- opt_shadow.shadow_offset_y = shadow_offset_y;
+ opt_active_shadow.shadow_offset_x = shadow_offset_x;
+ opt_active_shadow.shadow_offset_y = shadow_offset_y;
opt_no_shadow.shadow_radius = 0;
opt_no_shadow.shadow_opacity = 0;
@@ -488,6 +489,14 @@ update_shadow (void)
opt_no_shadow.shadow_offset_x = 0;
opt_no_shadow.shadow_offset_y = 0;
+ opt_inactive_shadow.shadow_radius = 8.0;
+ opt_inactive_shadow.shadow_opacity = 0.5;
+
+ opt_inactive_shadow.shadow_offset_x = 0;
+ opt_inactive_shadow.shadow_offset_y = 0;
+
+ memcpy (opt_inactive_shadow.shadow_color, shadow_color, sizeof (shadow_color));
+
if (no_border_shadow)
{
decor_shadow_destroy (xdisplay, no_border_shadow);
@@ -502,7 +511,7 @@ update_shadow (void)
0,
0,
0, 0, 0, 0,
- &opt_shadow,
+ &opt_active_shadow,
&shadow_context,
decor_draw_simple,
0);
@@ -528,8 +537,8 @@ update_shadow (void)
TRANSLUCENT_CORNER_SIZE,
_win_extents.bottom -
TRANSLUCENT_CORNER_SIZE,
- &opt_shadow,
- &window_context,
+ &opt_active_shadow,
+ &window_active_context,
draw_border_shape,
0);
@@ -554,8 +563,8 @@ update_shadow (void)
TRANSLUCENT_CORNER_SIZE,
_win_extents.bottom -
TRANSLUCENT_CORNER_SIZE,
- &opt_shadow,
- &window_context,
+ &opt_inactive_shadow,
+ &window_inactive_context,
draw_border_shape,
0);
@@ -585,8 +594,6 @@ update_shadow (void)
draw_border_shape,
0);
- decor_context_t *context = &window_context_no_shadow;
-
if (max_border_active_shadow)
{
@@ -607,8 +614,8 @@ update_shadow (void)
_max_win_extents.top + max_titlebar_height -
TRANSLUCENT_CORNER_SIZE,
_max_win_extents.bottom - TRANSLUCENT_CORNER_SIZE,
- &opt_shadow,
- &max_window_context,
+ &opt_active_shadow,
+ &max_window_active_context,
draw_border_shape,
(void *) 1);
@@ -631,8 +638,8 @@ update_shadow (void)
_max_win_extents.top + max_titlebar_height -
TRANSLUCENT_CORNER_SIZE,
_max_win_extents.bottom - TRANSLUCENT_CORNER_SIZE,
- &opt_shadow,
- &max_window_context,
+ &opt_inactive_shadow,
+ &max_window_inactive_context,
draw_border_shape,
(void *) 1);
@@ -681,7 +688,7 @@ update_shadow (void)
TRANSLUCENT_CORNER_SIZE,
_switcher_extents.bottom -
TRANSLUCENT_CORNER_SIZE,
- &opt_shadow,
+ &opt_active_shadow,
&switcher_context,
decor_draw_simple,
0);
@@ -836,8 +843,17 @@ update_default_decorations (GdkScreen *screen)
memset (&d, 0, sizeof (d));
- d.context = &window_context;
- d.shadow = border_active_shadow;
+ if (d.active)
+ {
+ d.context = &window_active_context;
+ d.shadow = border_active_shadow;
+ }
+ else
+ {
+ d.context = &window_inactive_context;
+ d.shadow = border_inactive_shadow;
+ }
+
d.layout = pango_layout_new (pango_context);
decor_get_default_layout (d.context, 1, 1, &d.border_layout);
diff --git a/src/gtk-window-decorator.c b/src/gtk-window-decorator.c
index 070b99d..8cb4dc8 100644
--- a/src/gtk-window-decorator.c
+++ b/src/gtk-window-decorator.c
@@ -36,13 +36,25 @@ decor_extents_t _switcher_extents = { 6, 6, 6, 6 + SWITCHER_SPACE };
int titlebar_height = 17;
int max_titlebar_height = 17;
-decor_context_t window_context = {
+decor_context_t window_active_context = {
{ 0, 0, 0, 0 },
6, 6, 4, 6,
0, 0, 0, 0
};
-decor_context_t max_window_context = {
+decor_context_t max_window_active_context = {
+ { 0, 0, 0, 0 },
+ 6, 6, 4, 6,
+ 0, 0, 0, 0
+};
+
+decor_context_t window_inactive_context = {
+ { 0, 0, 0, 0 },
+ 6, 6, 4, 6,
+ 0, 0, 0, 0
+};
+
+decor_context_t max_window_inactive_context = {
{ 0, 0, 0, 0 },
6, 6, 4, 6,
0, 0, 0, 0
diff --git a/src/gtk-window-decorator.h b/src/gtk-window-decorator.h
index da5ef5d..2dd534a 100644
--- a/src/gtk-window-decorator.h
+++ b/src/gtk-window-decorator.h
@@ -238,9 +238,11 @@ extern decor_extents_t _switcher_extents;
extern int titlebar_height;
extern int max_titlebar_height;
-extern decor_context_t window_context;
+extern decor_context_t window_active_context;
+extern decor_context_t window_inactive_context;
extern decor_context_t window_context_no_shadow;
-extern decor_context_t max_window_context;
+extern decor_context_t max_window_active_context;
+extern decor_context_t max_window_inactive_context;
extern decor_context_t max_window_context_no_shadow;
extern decor_context_t switcher_context;
extern decor_context_t shadow_context;
diff --git a/src/metacity.c b/src/metacity.c
index 851379e..ff4693f 100644
--- a/src/metacity.c
+++ b/src/metacity.c
@@ -1080,8 +1080,16 @@ meta_calc_decoration_size (decor_t *d,
{
if (!d->frame_window)
{
- context = &max_window_context;
- shadow = max_border_active_shadow;
+ if (d->active)
+ {
+ context = &max_window_active_context;
+ shadow = max_border_active_shadow;
+ }
+ else
+ {
+ context = &max_window_inactive_context;
+ shadow = max_border_inactive_shadow;
+ }
}
else
{
@@ -1093,8 +1101,16 @@ meta_calc_decoration_size (decor_t *d,
{
if (!d->frame_window)
{
- context = &window_context;
- shadow = border_active_shadow;
+ if (d->active)
+ {
+ context = &window_active_context;
+ shadow = border_active_shadow;
+ }
+ else
+ {
+ context = &window_inactive_context;
+ shadow = border_inactive_shadow;
+ }
}
else
{
diff --git a/src/wnck.c b/src/wnck.c
index a4794e5..0b4d8ef 100644
--- a/src/wnck.c
+++ b/src/wnck.c
@@ -471,7 +471,50 @@ active_window_changed (WnckScreen *screen)
if (d && d->pixmap)
{
d->active = wnck_window_is_active (win);
- queue_decor_draw (d);
+
+ if ((d->state & META_MAXIMIZED) == META_MAXIMIZED)
+ {
+ if (!d->frame_window)
+ {
+ if (d->active)
+ {
+ d->context = &max_window_active_context;
+ d->shadow = max_border_active_shadow;
+ }
+ else
+ {
+ d->context = &max_window_inactive_context;
+ d->shadow = max_border_inactive_shadow;
+ }
+ }
+ else
+ {
+ d->shadow = max_border_no_shadow;
+ }
+ }
+ else
+ {
+ if (!d->frame_window)
+ {
+ if (d->active)
+ {
+ d->context = &window_active_context;
+ d->shadow = border_active_shadow;
+ }
+ else
+ {
+ d->context = &window_inactive_context;
+ d->shadow = border_inactive_shadow;
+ }
+ }
+ else
+ {
+ d->shadow = border_no_shadow;
+ }
+ }
+
+
+ update_window_decoration_size (d->win);
}
}
@@ -484,6 +527,49 @@ active_window_changed (WnckScreen *screen)
d->active = wnck_window_is_active (win);
queue_decor_draw (d);
}
+
+ if ((d->state & META_MAXIMIZED) == META_MAXIMIZED)
+ {
+ if (!d->frame_window)
+ {
+ if (d->active)
+ {
+ d->context = &max_window_active_context;
+ d->shadow = max_border_active_shadow;
+ }
+ else
+ {
+ d->context = &max_window_inactive_context;
+ d->shadow = max_border_inactive_shadow;
+ }
+ }
+ else
+ {
+ d->shadow = max_border_no_shadow;
+ }
+ }
+ else
+ {
+ if (!d->frame_window)
+ {
+ if (d->active)
+ {
+ d->context = &window_active_context;
+ d->shadow = border_active_shadow;
+ }
+ else
+ {
+ d->context = &window_inactive_context;
+ d->shadow = border_inactive_shadow;
+ }
+ }
+ else
+ {
+ d->shadow = border_no_shadow;
+ }
+ }
+
+ update_window_decoration_size (d->win);
}
}