summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2011-02-17 00:10:07 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2011-02-17 00:10:07 +0800
commitaf4e7bc36f27b8908a150dd497752e85a8281b20 (patch)
tree49ff638346db0adc0af3ac7066c854df669ec9eb
parent8dde9e6e5f4bf9084e195a05fd4e4499b71a7aa0 (diff)
downloadcompiz-with-glib-mainloop-af4e7bc36f27b8908a150dd497752e85a8281b20.tar.gz
compiz-with-glib-mainloop-af4e7bc36f27b8908a150dd497752e85a8281b20.tar.bz2
Generalize shadow_only decoration into window decorations list
Remove debug message
-rw-r--r--gtk/window-decorator/decorator.c59
-rw-r--r--gtk/window-decorator/gtk-window-decorator.c29
-rw-r--r--gtk/window-decorator/gtk-window-decorator.h13
-rw-r--r--gtk/window-decorator/switcher.c2
4 files changed, 65 insertions, 38 deletions
diff --git a/gtk/window-decorator/decorator.c b/gtk/window-decorator/decorator.c
index f3c3c36..9c3070f 100644
--- a/gtk/window-decorator/decorator.c
+++ b/gtk/window-decorator/decorator.c
@@ -484,6 +484,34 @@ draw_border_shape (Display *xdisplay,
}
void
+bare_frame_update_shadow (Display *xdisplay,
+ Screen *screen,
+ decor_frame_t *frame,
+ decor_shadow_info_t *info,
+ decor_shadow_options_t *opt_shadow,
+ decor_shadow_options_t *opt_no_shadow)
+{
+ if (frame->border_shadow)
+ {
+ decor_shadow_destroy (xdisplay, frame->border_shadow);
+ frame->border_shadow = NULL;
+ }
+
+ frame->border_shadow = decor_shadow_create (xdisplay,
+ screen,
+ 1, 1,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0, 0, 0, 0,
+ opt_shadow,
+ &frame->window_context,
+ decor_draw_simple,
+ NULL);
+}
+
+void
switcher_frame_update_shadow (Display *xdisplay,
Screen *screen,
decor_frame_t *frame,
@@ -653,25 +681,6 @@ update_shadow (void)
opt_no_shadow.shadow_offset_x = 0;
opt_no_shadow.shadow_offset_y = 0;
- if (no_border_shadow)
- {
- decor_shadow_destroy (xdisplay, no_border_shadow);
- no_border_shadow = NULL;
- }
-
- no_border_shadow = decor_shadow_create (xdisplay,
- gdk_x11_screen_get_xscreen (screen),
- 1, 1,
- 0,
- 0,
- 0,
- 0,
- 0, 0, 0, 0,
- &opt_shadow,
- &shadow_context,
- decor_draw_simple,
- NULL);
-
for (i = 0; i < NUM_DECOR_FRAMES; i++)
{
decor_frame_t *frame = &decor_frames[i];
@@ -776,18 +785,18 @@ update_default_decorations (GdkScreen *screen)
normalAtom = XInternAtom (xdisplay, DECOR_NORMAL_ATOM_NAME, FALSE);
activeAtom = XInternAtom (xdisplay, DECOR_ACTIVE_ATOM_NAME, FALSE);
- if (no_border_shadow)
+ if (decor_frames[DECOR_FRAME_TYPE_BARE].border_shadow)
{
decor_layout_t layout;
- decor_get_default_layout (&shadow_context, 1, 1, &layout);
+ decor_get_default_layout (&decor_frames[DECOR_FRAME_TYPE_BARE].window_context, 1, 1, &layout);
- nQuad = decor_set_lSrStSbS_window_quads (quads, &shadow_context,
+ nQuad = decor_set_lSrStSbS_window_quads (quads, &decor_frames[DECOR_FRAME_TYPE_BARE].window_context,
&layout);
- decor_quads_to_property (data, no_border_shadow->pixmap,
- &_shadow_extents, &_shadow_extents,
- &_shadow_extents, &_shadow_extents,
+ decor_quads_to_property (data, decor_frames[DECOR_FRAME_TYPE_BARE].border_shadow->pixmap,
+ &decor_frames[DECOR_FRAME_TYPE_BARE].win_extents, &decor_frames[DECOR_FRAME_TYPE_BARE].win_extents,
+ &decor_frames[DECOR_FRAME_TYPE_BARE].win_extents, &decor_frames[DECOR_FRAME_TYPE_BARE].win_extents,
0, 0, quads, nQuad);
XChangeProperty (xdisplay, xroot,
diff --git a/gtk/window-decorator/gtk-window-decorator.c b/gtk/window-decorator/gtk-window-decorator.c
index 1d9406a..e39253c 100644
--- a/gtk/window-decorator/gtk-window-decorator.c
+++ b/gtk/window-decorator/gtk-window-decorator.c
@@ -26,18 +26,10 @@ gboolean minimal = FALSE;
double decoration_alpha = 0.5;
#define SWITCHER_SPACE 40
-#define DECOR_FRAMES_NUM 7
-decor_frame_t decor_frames[DECOR_FRAMES_NUM];
+decor_frame_t decor_frames[NUM_DECOR_FRAMES];
-decor_extents_t _shadow_extents = { 0, 0, 0, 0 };
-decor_shadow_t *no_border_shadow = NULL;
-decor_context_t shadow_context = {
- { 0, 0, 0, 0 },
- 0, 0, 0, 0,
- 0, 0, 0, 0,
-};
gdouble shadow_radius = SHADOW_RADIUS;
gdouble shadow_opacity = SHADOW_OPACITY;
@@ -169,6 +161,14 @@ initialize_decorations ()
0, 0, 0, 0
};
+ decor_context_t _shadow_context = {
+ { 0, 0, 0, 0 },
+ 0, 0, 0, 0,
+ 0, 0, 0, 0,
+ };
+
+ decor_extents_t _shadow_extents = { 0, 0, 0, 0 };
+
unsigned int i;
for (i = 0; i < NUM_DECOR_FRAMES; i++)
@@ -188,6 +188,17 @@ initialize_decorations ()
fprintf (stderr, "init decor get default layout, context is space %i %i %i %i c space %i %i %i %i extents %i %i %i %i\n", c->left_space, c->right_space, c->top_space, c->bottom_space, c->left_corner_space, c->right_corner_space, c->top_corner_space, c->bottom_corner_space, c->extents.left, c->extents.right, c->extents.bottom, c->extents.top);
}
+ else if (i == DECOR_FRAME_TYPE_BARE)
+ {
+ decor_frames[i].win_extents = _shadow_extents;
+ decor_frames[i].max_win_extents = _shadow_extents;
+ decor_frames[i].win_extents = _shadow_extents;
+ decor_frames[i].window_context = _shadow_context;
+ decor_frames[i].window_context_no_shadow = _shadow_context;
+ decor_frames[i].max_window_context = _shadow_context;
+ decor_frames[i].max_window_context_no_shadow = _shadow_context;
+ decor_frames[i].update_shadow = bare_frame_update_shadow;
+ }
else
{
decor_frames[i].win_extents = _win_extents;
diff --git a/gtk/window-decorator/gtk-window-decorator.h b/gtk/window-decorator/gtk-window-decorator.h
index 5d06c4f..0c23c38 100644
--- a/gtk/window-decorator/gtk-window-decorator.h
+++ b/gtk/window-decorator/gtk-window-decorator.h
@@ -340,7 +340,8 @@ typedef enum _decor_frame_type {
DECOR_FRAME_TYPE_UTILITY = 3,
DECOR_FRAME_TYPE_SWITCHER = 4,
DECOR_FRAME_TYPE_UNDECORATED = 5,
- DECOR_FRAME_TYPE_DEFAULT = 6
+ DECOR_FRAME_TYPE_DEFAULT = 6,
+ DECOR_FRAME_TYPE_BARE = 7
} decor_frame_type;
typedef struct _decor_frame decor_frame_t;
@@ -355,6 +356,14 @@ switcher_frame_update_shadow (Display *xdisplay,
decor_shadow_options_t *opt_no_shadow);
void
+bare_frame_update_shadow (Display *xdisplay,
+ Screen *screen,
+ decor_frame_t *frame,
+ decor_shadow_info_t *info,
+ decor_shadow_options_t *opt_shadow,
+ decor_shadow_options_t *opt_no_shadow);
+
+void
decor_frame_update_shadow (Display *xdisplay,
Screen *screen,
decor_frame_t *frame,
@@ -491,7 +500,7 @@ extern XRenderPictFormat *xformat_rgb;
extern Atom compiz_shadow_info_atom;
extern Atom compiz_shadow_color_atom;
-#define NUM_DECOR_FRAMES 7
+#define NUM_DECOR_FRAMES 8
extern decor_frame_t decor_frames[NUM_DECOR_FRAMES];
diff --git a/gtk/window-decorator/switcher.c b/gtk/window-decorator/switcher.c
index d73d048..e8d44d9 100644
--- a/gtk/window-decorator/switcher.c
+++ b/gtk/window-decorator/switcher.c
@@ -309,8 +309,6 @@ update_switcher_window (Window popup,
d->draw = draw_switcher_decoration;
d->frame = &decor_frames[DECOR_FRAME_TYPE_SWITCHER];
- fprintf (stderr, "Getting switcher default layout\n");
-
decor_get_default_layout (&d->frame->window_context, width, 1, &d->border_layout);
width = d->border_layout.width;