summaryrefslogtreecommitdiff
path: root/gtk/window-decorator
diff options
context:
space:
mode:
authorSam Spilsbury <smspillaz@gmail.com>2010-11-01 11:06:24 +0800
committerSam Spilsbury <smspillaz@gmail.com>2010-11-01 11:06:24 +0800
commitbd5b81f749a59939fdcf7659e5650abcbb1eef8b (patch)
tree2561dee257af2beddd4c0956efcfd6721a5f0052 /gtk/window-decorator
parente4bfb81028012e25af98fee0e73fff70d21f702c (diff)
downloadcompiz-with-glib-mainloop-bd5b81f749a59939fdcf7659e5650abcbb1eef8b.tar.gz
compiz-with-glib-mainloop-bd5b81f749a59939fdcf7659e5650abcbb1eef8b.tar.bz2
Don't create window with shadow size in 2D Mode
Diffstat (limited to 'gtk/window-decorator')
-rw-r--r--gtk/window-decorator/cairo.c3
-rw-r--r--gtk/window-decorator/decorator.c80
-rw-r--r--gtk/window-decorator/gtk-window-decorator.c14
-rw-r--r--gtk/window-decorator/gtk-window-decorator.h7
-rw-r--r--gtk/window-decorator/metacity.c30
5 files changed, 113 insertions, 21 deletions
diff --git a/gtk/window-decorator/cairo.c b/gtk/window-decorator/cairo.c
index 6dd4404..d2fa6d3 100644
--- a/gtk/window-decorator/cairo.c
+++ b/gtk/window-decorator/cairo.c
@@ -676,8 +676,9 @@ draw_window_decoration (decor_t *d)
gtk_image_set_from_pixmap (GTK_IMAGE (d->decor_image), d->pixmap, NULL);
gtk_window_resize (GTK_WINDOW (d->decor_window), d->width, d->height);
+ //gdk_window_move (gdk_frame_window, 0, 0);
gdk_window_move (gdk_frame_window, -(d->context->left_space - _win_extents.left),
- -(d->context->top_space - d->context->bottom_space) - shadow_offset_y - 1);
+ -(d->context->top_space - d->context->bottom_space) - shadow_offset_y);
gdk_window_lower (gdk_frame_window);
}
diff --git a/gtk/window-decorator/decorator.c b/gtk/window-decorator/decorator.c
index 96dbd17..68eb22f 100644
--- a/gtk/window-decorator/decorator.c
+++ b/gtk/window-decorator/decorator.c
@@ -468,18 +468,25 @@ draw_border_shape (Display *xdisplay,
int
update_shadow (void)
{
- decor_shadow_options_t opt;
+ decor_shadow_options_t opt_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_radius = shadow_radius;
- opt.shadow_opacity = shadow_opacity;
+ opt_shadow.shadow_radius = shadow_radius;
+ opt_shadow.shadow_opacity = shadow_opacity;
- memcpy (opt.shadow_color, shadow_color, sizeof (shadow_color));
+ memcpy (opt_shadow.shadow_color, shadow_color, sizeof (shadow_color));
- opt.shadow_offset_x = shadow_offset_x;
- opt.shadow_offset_y = shadow_offset_y;
+ opt_shadow.shadow_offset_x = shadow_offset_x;
+ opt_shadow.shadow_offset_y = shadow_offset_y;
+
+ opt_no_shadow.shadow_radius = 0;
+ opt_no_shadow.shadow_opacity = 0;
+
+ opt_no_shadow.shadow_offset_x = 0;
+ opt_no_shadow.shadow_offset_y = 0;
if (no_border_shadow)
{
@@ -495,7 +502,7 @@ update_shadow (void)
0,
0,
0, 0, 0, 0,
- &opt,
+ &opt_shadow,
&shadow_context,
decor_draw_simple,
0);
@@ -521,11 +528,40 @@ update_shadow (void)
TRANSLUCENT_CORNER_SIZE,
_win_extents.bottom -
TRANSLUCENT_CORNER_SIZE,
- &opt,
+ &opt_shadow,
&window_context,
draw_border_shape,
0);
+ if (border_no_shadow)
+ {
+ decor_shadow_destroy (xdisplay, border_no_shadow);
+ border_no_shadow = NULL;
+ }
+
+ border_no_shadow = decor_shadow_create (xdisplay,
+ gdk_x11_screen_get_xscreen (screen),
+ 1, 1,
+ _win_extents.left,
+ _win_extents.right,
+ _win_extents.top + titlebar_height,
+ _win_extents.bottom,
+ _win_extents.left -
+ TRANSLUCENT_CORNER_SIZE,
+ _win_extents.right -
+ TRANSLUCENT_CORNER_SIZE,
+ _win_extents.top + titlebar_height -
+ TRANSLUCENT_CORNER_SIZE,
+ _win_extents.bottom -
+ TRANSLUCENT_CORNER_SIZE,
+ &opt_no_shadow,
+ &window_context_no_shadow,
+ draw_border_shape,
+ 0);
+
+ decor_context_t *context = &window_context_no_shadow;
+
+
if (max_border_shadow)
{
decor_shadow_destroy (xdisplay, max_border_shadow);
@@ -545,11 +581,35 @@ update_shadow (void)
_max_win_extents.top + max_titlebar_height -
TRANSLUCENT_CORNER_SIZE,
_max_win_extents.bottom - TRANSLUCENT_CORNER_SIZE,
- &opt,
+ &opt_shadow,
&max_window_context,
draw_border_shape,
(void *) 1);
+ if (max_border_no_shadow)
+ {
+ decor_shadow_destroy (xdisplay, max_border_shadow);
+ max_border_shadow = NULL;
+ }
+
+ max_border_no_shadow =
+ decor_shadow_create (xdisplay,
+ gdk_x11_screen_get_xscreen (screen),
+ 1, 1,
+ _max_win_extents.left,
+ _max_win_extents.right,
+ _max_win_extents.top + max_titlebar_height,
+ _max_win_extents.bottom,
+ _max_win_extents.left - TRANSLUCENT_CORNER_SIZE,
+ _max_win_extents.right - TRANSLUCENT_CORNER_SIZE,
+ _max_win_extents.top + max_titlebar_height -
+ TRANSLUCENT_CORNER_SIZE,
+ _max_win_extents.bottom - TRANSLUCENT_CORNER_SIZE,
+ &opt_no_shadow,
+ &max_window_context_no_shadow,
+ draw_border_shape,
+ (void *) 1);
+
if (switcher_shadow)
{
decor_shadow_destroy (xdisplay, switcher_shadow);
@@ -571,7 +631,7 @@ update_shadow (void)
TRANSLUCENT_CORNER_SIZE,
_switcher_extents.bottom -
TRANSLUCENT_CORNER_SIZE,
- &opt,
+ &opt_shadow,
&switcher_context,
decor_draw_simple,
0);
diff --git a/gtk/window-decorator/gtk-window-decorator.c b/gtk/window-decorator/gtk-window-decorator.c
index 101e1d9..bde881a 100644
--- a/gtk/window-decorator/gtk-window-decorator.c
+++ b/gtk/window-decorator/gtk-window-decorator.c
@@ -48,6 +48,18 @@ decor_context_t max_window_context = {
0, 0, 0, 0
};
+decor_context_t window_context_no_shadow = {
+ { 0, 0, 0, 0 },
+ 6, 6, 4, 6,
+ 0, 0, 0, 0
+};
+
+decor_context_t max_window_context_no_shadow = {
+ { 0, 0, 0, 0 },
+ 6, 6, 4, 6,
+ 0, 0, 0, 0
+};
+
decor_context_t switcher_context = {
{ 0, 0, 0, 0 },
6, 6, 6, 6 + SWITCHER_SPACE,
@@ -75,6 +87,8 @@ guint cmdline_options = 0;
decor_shadow_t *no_border_shadow = NULL;
decor_shadow_t *border_shadow = NULL;
decor_shadow_t *max_border_shadow = NULL;
+decor_shadow_t *border_no_shadow = NULL;
+decor_shadow_t *max_border_no_shadow = NULL;
decor_shadow_t *switcher_shadow = NULL;
GdkPixmap *decor_normal_pixmap = NULL;
diff --git a/gtk/window-decorator/gtk-window-decorator.h b/gtk/window-decorator/gtk-window-decorator.h
index 0f418fe..37fe299 100644
--- a/gtk/window-decorator/gtk-window-decorator.h
+++ b/gtk/window-decorator/gtk-window-decorator.h
@@ -234,11 +234,10 @@ extern int titlebar_height;
extern int max_titlebar_height;
extern decor_context_t window_context;
-
+extern decor_context_t window_context_no_shadow;
extern decor_context_t max_window_context;
-
+extern decor_context_t max_window_context_no_shadow;
extern decor_context_t switcher_context;
-
extern decor_context_t shadow_context;
extern gdouble shadow_radius;
@@ -261,7 +260,9 @@ extern guint cmdline_options;
extern decor_shadow_t *no_border_shadow;
extern decor_shadow_t *border_shadow;
+extern decor_shadow_t *border_no_shadow;
extern decor_shadow_t *max_border_shadow;
+extern decor_shadow_t *max_border_no_shadow;
extern decor_shadow_t *switcher_shadow;
extern GdkPixmap *decor_normal_pixmap;
diff --git a/gtk/window-decorator/metacity.c b/gtk/window-decorator/metacity.c
index 0c61164..2249f08 100644
--- a/gtk/window-decorator/metacity.c
+++ b/gtk/window-decorator/metacity.c
@@ -868,8 +868,8 @@ meta_draw_window_decoration (decor_t *d)
gtk_image_set_from_pixmap (GTK_IMAGE (d->decor_image), d->pixmap, NULL);
gtk_window_resize (GTK_WINDOW (d->decor_window), d->width, d->height);
- gdk_window_move (gdk_frame_window, -(d->context->left_space - extents.left),
- -(d->context->top_space - d->context->bottom_space) - shadow_offset_y);
+ gdk_window_move (gdk_frame_window, -(fgeom.left_width),
+ -(fgeom.bottom_height));
gdk_window_lower (gdk_frame_window);
}
@@ -1077,13 +1077,29 @@ meta_calc_decoration_size (decor_t *d,
if ((d->state & META_MAXIMIZED) == META_MAXIMIZED)
{
- context = &max_window_context;
- shadow = max_border_shadow;
+ if (!d->frame_window)
+ {
+ context = &max_window_context;
+ shadow = max_border_shadow;
+ }
+ else
+ {
+ context = &max_window_context_no_shadow;
+ shadow = max_border_no_shadow;
+ }
}
else
{
- context = &window_context;
- shadow = border_shadow;
+ if (!d->frame_window)
+ {
+ context = &window_context;
+ shadow = border_shadow;
+ }
+ else
+ {
+ context = &window_context_no_shadow;
+ shadow = border_no_shadow;
+ }
}
if (!d->frame_window)
@@ -1119,7 +1135,7 @@ meta_calc_decoration_size (decor_t *d,
*height = layout.height;
d->border_layout = layout;
- d->shadow = NULL;
+ d->shadow = no_border_shadow;
d->context = context;
meta_calc_button_size (d);