summaryrefslogtreecommitdiff
path: root/gtk/window-decorator
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2011-02-16 22:22:32 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2011-02-16 22:22:32 +0800
commit9132e17449bfc1ee6deba68cc9563bcf75a76228 (patch)
tree3990df7617b47609e7a4f4e8bec31d71aac64afd /gtk/window-decorator
parent9f53aca056afaf08ceeb25ccb61af843811bb7eb (diff)
downloadcompiz-with-glib-mainloop-9132e17449bfc1ee6deba68cc9563bcf75a76228.tar.gz
compiz-with-glib-mainloop-9132e17449bfc1ee6deba68cc9563bcf75a76228.tar.bz2
Generalize switcher into another decoration frame type
Diffstat (limited to 'gtk/window-decorator')
-rw-r--r--gtk/window-decorator/decorator.c281
-rw-r--r--gtk/window-decorator/decorprops.c16
-rw-r--r--gtk/window-decorator/gtk-window-decorator.c51
-rw-r--r--gtk/window-decorator/gtk-window-decorator.h36
-rw-r--r--gtk/window-decorator/switcher.c90
5 files changed, 273 insertions, 201 deletions
diff --git a/gtk/window-decorator/decorator.c b/gtk/window-decorator/decorator.c
index a33d1c0..f3c3c36 100644
--- a/gtk/window-decorator/decorator.c
+++ b/gtk/window-decorator/decorator.c
@@ -1,10 +1,10 @@
#include "gtk-window-decorator.h"
-typedef struct _decor_shadow_info
+struct _decor_shadow_info
{
decor_frame_t *frame;
unsigned int state;
-} decor_shadow_info_t;
+};
static const PangoFontDescription *
get_titlebar_font (decor_frame_t *frame)
@@ -483,6 +483,152 @@ draw_border_shape (Display *xdisplay,
g_object_unref (G_OBJECT (d.pixmap));
}
+void
+switcher_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,
+ frame->win_extents.left,
+ frame->win_extents.right,
+ frame->win_extents.top,
+ frame->win_extents.bottom,
+ frame->win_extents.left -
+ TRANSLUCENT_CORNER_SIZE,
+ frame->win_extents.right -
+ TRANSLUCENT_CORNER_SIZE,
+ frame->win_extents.top -
+ TRANSLUCENT_CORNER_SIZE,
+ frame->win_extents.bottom -
+ TRANSLUCENT_CORNER_SIZE,
+ opt_shadow,
+ &frame->window_context,
+ decor_draw_simple,
+ NULL);
+}
+
+void
+decor_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,
+ frame->win_extents.left,
+ frame->win_extents.right,
+ frame->win_extents.top + frame->titlebar_height,
+ frame->win_extents.bottom,
+ frame->win_extents.left -
+ TRANSLUCENT_CORNER_SIZE,
+ frame->win_extents.right -
+ TRANSLUCENT_CORNER_SIZE,
+ frame->win_extents.top + frame->titlebar_height -
+ TRANSLUCENT_CORNER_SIZE,
+ frame->win_extents.bottom -
+ TRANSLUCENT_CORNER_SIZE,
+ opt_shadow,
+ &frame->window_context,
+ draw_border_shape,
+ (void *) info);
+ if (frame->border_no_shadow)
+ {
+ decor_shadow_destroy (xdisplay, frame->border_no_shadow);
+ frame->border_no_shadow = NULL;
+ }
+
+ frame->border_no_shadow = decor_shadow_create (xdisplay,
+ screen,
+ 1, 1,
+ frame->win_extents.left,
+ frame->win_extents.right,
+ frame->win_extents.top + frame->titlebar_height,
+ frame->win_extents.bottom,
+ frame->win_extents.left -
+ TRANSLUCENT_CORNER_SIZE,
+ frame->win_extents.right -
+ TRANSLUCENT_CORNER_SIZE,
+ frame->win_extents.top + frame->titlebar_height -
+ TRANSLUCENT_CORNER_SIZE,
+ frame->win_extents.bottom -
+ TRANSLUCENT_CORNER_SIZE,
+ opt_no_shadow,
+ &frame->window_context_no_shadow,
+ draw_border_shape,
+ (void *) info);
+
+ if (frame->max_border_shadow)
+ {
+ decor_shadow_destroy (xdisplay, frame->max_border_shadow);
+ frame->max_border_shadow = NULL;
+ }
+
+ info->state = (WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY |
+ WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY);
+
+ frame->max_border_shadow =
+ decor_shadow_create (xdisplay,
+ screen,
+ 1, 1,
+ frame->max_win_extents.left,
+ frame->max_win_extents.right,
+ frame->max_win_extents.top + frame->max_titlebar_height,
+ frame->max_win_extents.bottom,
+ frame->max_win_extents.left - TRANSLUCENT_CORNER_SIZE,
+ frame->max_win_extents.right - TRANSLUCENT_CORNER_SIZE,
+ frame->max_win_extents.top + frame->max_titlebar_height -
+ TRANSLUCENT_CORNER_SIZE,
+ frame->max_win_extents.bottom - TRANSLUCENT_CORNER_SIZE,
+ opt_shadow,
+ &frame->max_window_context,
+ draw_border_shape,
+ (void *) info);
+
+ if (frame->max_border_no_shadow)
+ {
+ decor_shadow_destroy (xdisplay, frame->max_border_shadow);
+ frame->max_border_shadow = NULL;
+ }
+
+ frame->max_border_no_shadow =
+ decor_shadow_create (xdisplay,
+ screen,
+ 1, 1,
+ frame->max_win_extents.left,
+ frame->max_win_extents.right,
+ frame->max_win_extents.top + frame->max_titlebar_height,
+ frame->max_win_extents.bottom,
+ frame->max_win_extents.left - TRANSLUCENT_CORNER_SIZE,
+ frame->max_win_extents.right - TRANSLUCENT_CORNER_SIZE,
+ frame->max_win_extents.top + frame->max_titlebar_height -
+ TRANSLUCENT_CORNER_SIZE,
+ frame->max_win_extents.bottom - TRANSLUCENT_CORNER_SIZE,
+ opt_no_shadow,
+ &frame->max_window_context_no_shadow,
+ draw_border_shape,
+ (void *) info);
+}
+
int
update_shadow (void)
{
@@ -532,143 +678,18 @@ update_shadow (void)
decor_shadow_info_t *info = malloc (sizeof (decor_shadow_info_t));
if (!info)
- return;
+ return 0;
info->frame = frame;
info->state = 0;
- if (frame->border_shadow)
- {
- decor_shadow_destroy (xdisplay, frame->border_shadow);
- frame->border_shadow = NULL;
- }
-
- frame->border_shadow = decor_shadow_create (xdisplay,
- gdk_x11_screen_get_xscreen (screen),
- 1, 1,
- frame->win_extents.left,
- frame->win_extents.right,
- frame->win_extents.top + frame->titlebar_height,
- frame->win_extents.bottom,
- frame->win_extents.left -
- TRANSLUCENT_CORNER_SIZE,
- frame->win_extents.right -
- TRANSLUCENT_CORNER_SIZE,
- frame->win_extents.top + frame->titlebar_height -
- TRANSLUCENT_CORNER_SIZE,
- frame->win_extents.bottom -
- TRANSLUCENT_CORNER_SIZE,
- &opt_shadow,
- &frame->window_context,
- draw_border_shape,
- (void *) info);
- if (frame->border_no_shadow)
- {
- decor_shadow_destroy (xdisplay, frame->border_no_shadow);
- frame->border_no_shadow = NULL;
- }
-
- frame->border_no_shadow = decor_shadow_create (xdisplay,
- gdk_x11_screen_get_xscreen (screen),
- 1, 1,
- frame->win_extents.left,
- frame->win_extents.right,
- frame->win_extents.top + frame->titlebar_height,
- frame->win_extents.bottom,
- frame->win_extents.left -
- TRANSLUCENT_CORNER_SIZE,
- frame->win_extents.right -
- TRANSLUCENT_CORNER_SIZE,
- frame->win_extents.top + frame->titlebar_height -
- TRANSLUCENT_CORNER_SIZE,
- frame->win_extents.bottom -
- TRANSLUCENT_CORNER_SIZE,
- &opt_no_shadow,
- &frame->window_context_no_shadow,
- draw_border_shape,
- (void *) info);
-
- if (frame->max_border_shadow)
- {
- decor_shadow_destroy (xdisplay, frame->max_border_shadow);
- frame->max_border_shadow = NULL;
- }
-
- info->state = (WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY |
- WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY);
-
- frame->max_border_shadow =
- decor_shadow_create (xdisplay,
- gdk_x11_screen_get_xscreen (screen),
- 1, 1,
- frame->max_win_extents.left,
- frame->max_win_extents.right,
- frame->max_win_extents.top + frame->max_titlebar_height,
- frame->max_win_extents.bottom,
- frame->max_win_extents.left - TRANSLUCENT_CORNER_SIZE,
- frame->max_win_extents.right - TRANSLUCENT_CORNER_SIZE,
- frame->max_win_extents.top + frame->max_titlebar_height -
- TRANSLUCENT_CORNER_SIZE,
- frame->max_win_extents.bottom - TRANSLUCENT_CORNER_SIZE,
- &opt_shadow,
- &frame->max_window_context,
- draw_border_shape,
- (void *) info);
-
- if (frame->max_border_no_shadow)
- {
- decor_shadow_destroy (xdisplay, frame->max_border_shadow);
- frame->max_border_shadow = NULL;
- }
-
- frame->max_border_no_shadow =
- decor_shadow_create (xdisplay,
- gdk_x11_screen_get_xscreen (screen),
- 1, 1,
- frame->max_win_extents.left,
- frame->max_win_extents.right,
- frame->max_win_extents.top + frame->max_titlebar_height,
- frame->max_win_extents.bottom,
- frame->max_win_extents.left - TRANSLUCENT_CORNER_SIZE,
- frame->max_win_extents.right - TRANSLUCENT_CORNER_SIZE,
- frame->max_win_extents.top + frame->max_titlebar_height -
- TRANSLUCENT_CORNER_SIZE,
- frame->max_win_extents.bottom - TRANSLUCENT_CORNER_SIZE,
- &opt_no_shadow,
- &frame->max_window_context_no_shadow,
- draw_border_shape,
- (void *) info);
+ (*frame->update_shadow) (xdisplay, gdk_x11_screen_get_xscreen (screen),
+ frame, info, &opt_shadow, &opt_no_shadow);
free (info);
info = NULL;
}
- if (switcher_shadow)
- {
- decor_shadow_destroy (xdisplay, switcher_shadow);
- switcher_shadow = NULL;
- }
-
- switcher_shadow = decor_shadow_create (xdisplay,
- gdk_x11_screen_get_xscreen (screen),
- 1, 1,
- _switcher_extents.left,
- _switcher_extents.right,
- _switcher_extents.top,
- _switcher_extents.bottom,
- _switcher_extents.left -
- TRANSLUCENT_CORNER_SIZE,
- _switcher_extents.right -
- TRANSLUCENT_CORNER_SIZE,
- _switcher_extents.top -
- TRANSLUCENT_CORNER_SIZE,
- _switcher_extents.bottom -
- TRANSLUCENT_CORNER_SIZE,
- &opt_shadow,
- &switcher_context,
- decor_draw_simple,
- NULL);
-
return 1;
}
diff --git a/gtk/window-decorator/decorprops.c b/gtk/window-decorator/decorprops.c
index a72290c..aed5380 100644
--- a/gtk/window-decorator/decorprops.c
+++ b/gtk/window-decorator/decorprops.c
@@ -96,6 +96,12 @@ decor_update_window_property (decor_t *d)
void
decor_update_switcher_property (decor_t *d)
{
+ decor_extents_t _switcher_extents = { 6, 6, 6, 6 + SWITCHER_SPACE };
+ decor_context_t switcher_context = {
+ { 0, 0, 0, 0 },
+ 6, 6, 6, 6 + SWITCHER_SPACE,
+ 0, 0, 0, 0
+ };
long data[256];
Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
gint nQuad;
@@ -103,17 +109,17 @@ decor_update_switcher_property (decor_t *d)
GtkStyle *style;
long fgColor[4];
- nQuad = decor_set_lSrStSbX_window_quads (quads, &switcher_context,
+ nQuad = decor_set_lSrStSbX_window_quads (quads, &d->frame->window_context,
&d->border_layout,
d->border_layout.top.x2 -
d->border_layout.top.x1 -
- switcher_context.extents.left -
- switcher_context.extents.right -
+ d->frame->window_context.extents.left -
+ d->frame->window_context.extents.right -
32);
decor_quads_to_property (data, GDK_PIXMAP_XID (d->pixmap),
- &_switcher_extents, &_switcher_extents,
- &_switcher_extents, &_switcher_extents,
+ &d->frame->win_extents, &d->frame->win_extents,
+ &d->frame->win_extents, &d->frame->win_extents,
0, 0, quads, nQuad);
style = gtk_widget_get_style (d->frame->style_window_rgba);
diff --git a/gtk/window-decorator/gtk-window-decorator.c b/gtk/window-decorator/gtk-window-decorator.c
index d38999d..298df4c 100644
--- a/gtk/window-decorator/gtk-window-decorator.c
+++ b/gtk/window-decorator/gtk-window-decorator.c
@@ -32,17 +32,9 @@ decor_frame_t decor_frames[DECOR_FRAMES_NUM];
decor_extents_t _shadow_extents = { 0, 0, 0, 0 };
decor_extents_t _default_win_extents = { 6, 6, 6, 6 };
-decor_extents_t _switcher_extents = { 6, 6, 6, 6 + SWITCHER_SPACE };
-decor_shadow_t *switcher_shadow = NULL;
decor_shadow_t *no_border_shadow = NULL;
-decor_context_t switcher_context = {
- { 0, 0, 0, 0 },
- 6, 6, 6, 6 + SWITCHER_SPACE,
- 0, 0, 0, 0
-};
-
decor_context_t shadow_context = {
{ 0, 0, 0, 0 },
0, 0, 0, 0,
@@ -135,10 +127,6 @@ gboolean use_system_font = FALSE;
gint blur_type = BLUR_TYPE_NONE;
-GdkPixmap *switcher_pixmap = NULL;
-GdkPixmap *switcher_buffer_pixmap = NULL;
-gint switcher_width;
-gint switcher_height;
Window switcher_selected_window = None;
decor_t *switcher_window = NULL;
@@ -152,6 +140,7 @@ initialize_decorations ()
GdkColormap *colormap;
decor_extents_t _win_extents = { 6, 6, 6, 6 };
decor_extents_t _max_win_extents = { 6, 6, 4, 6 };
+ decor_extents_t _switcher_extents = { 6, 6, 6, 6 + SWITCHER_SPACE };
decor_context_t _window_context = {
{ 0, 0, 0, 0 },
6, 6, 4, 6,
@@ -176,18 +165,44 @@ initialize_decorations ()
0, 0, 0, 0
};
+ decor_context_t _switcher_context = {
+ { 0, 0, 0, 0 },
+ 6, 6, 6, 6 + SWITCHER_SPACE,
+ 0, 0, 0, 0
+ };
+
unsigned int i;
for (i = 0; i < NUM_DECOR_FRAMES; i++)
{
- decor_frames[i].win_extents = _win_extents;
- decor_frames[i].max_win_extents = _max_win_extents;
+ if (i == DECOR_FRAME_TYPE_SWITCHER)
+ {
+ decor_frames[i].win_extents = _switcher_extents;
+ decor_frames[i].max_win_extents = _switcher_extents;
+ decor_frames[i].win_extents = _switcher_extents;
+ decor_frames[i].window_context = _switcher_context;
+ decor_frames[i].window_context_no_shadow = _switcher_context;
+ decor_frames[i].max_window_context = _switcher_context;
+ decor_frames[i].max_window_context_no_shadow = _switcher_context;
+ decor_frames[i].update_shadow = switcher_frame_update_shadow;
+
+ decor_context_t *c = &decor_frames[i].window_context;
+
+ 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
+ {
+ decor_frames[i].win_extents = _win_extents;
+ decor_frames[i].max_win_extents = _max_win_extents;
+ decor_frames[i].update_shadow = decor_frame_update_shadow;
+ decor_frames[i].window_context = _window_context;
+ decor_frames[i].window_context_no_shadow = _window_context_no_shadow;
+ decor_frames[i].max_window_context = _max_window_context;
+ decor_frames[i].max_window_context_no_shadow = _max_window_context_no_shadow;
+ }
+
decor_frames[i].titlebar_height = 17;
decor_frames[i].max_titlebar_height = 17;
- decor_frames[i].window_context = _window_context;
- decor_frames[i].window_context_no_shadow = _window_context_no_shadow;
- decor_frames[i].max_window_context = _max_window_context;
- decor_frames[i].max_window_context_no_shadow = _max_window_context_no_shadow;
decor_frames[i].border_shadow = NULL;
decor_frames[i].border_no_shadow = NULL;
decor_frames[i].max_border_no_shadow = NULL;
diff --git a/gtk/window-decorator/gtk-window-decorator.h b/gtk/window-decorator/gtk-window-decorator.h
index ed792e1..5d06c4f 100644
--- a/gtk/window-decorator/gtk-window-decorator.h
+++ b/gtk/window-decorator/gtk-window-decorator.h
@@ -226,9 +226,6 @@ extern double decoration_alpha;
#define SWITCHER_SPACE 40
extern decor_extents_t _shadow_extents;
-extern decor_extents_t _switcher_extents;
-
-extern decor_context_t switcher_context;
extern decor_context_t shadow_context;
extern gdouble shadow_radius;
@@ -250,7 +247,6 @@ extern MetaButtonLayout meta_button_layout;
extern guint cmdline_options;
extern decor_shadow_t *no_border_shadow;
-extern decor_shadow_t *switcher_shadow;
extern GdkPixmap *decor_normal_pixmap;
extern GdkPixmap *decor_active_pixmap;
@@ -347,7 +343,33 @@ typedef enum _decor_frame_type {
DECOR_FRAME_TYPE_DEFAULT = 6
} decor_frame_type;
-typedef struct _decor_frame {
+typedef struct _decor_frame decor_frame_t;
+typedef struct _decor_shadow_info decor_shadow_info_t;
+
+void
+switcher_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,
+ decor_shadow_info_t *info,
+ decor_shadow_options_t *opt_shadow,
+ decor_shadow_options_t *opt_no_shadow);
+
+typedef void (*frame_update_shadow_proc) (Display *display,
+ Screen *screen,
+ decor_frame_t *frame,
+ decor_shadow_info_t *info,
+ decor_shadow_options_t *opt_shadow,
+ decor_shadow_options_t *opt_no_shadow);
+
+struct _decor_frame {
decor_extents_t win_extents;
decor_extents_t max_win_extents;
int titlebar_height;
@@ -366,7 +388,9 @@ typedef struct _decor_frame {
GtkWidget *style_window_rgb;
gint text_height;
decor_frame_type type;
-} decor_frame_t;
+
+ frame_update_shadow_proc update_shadow;
+};
typedef struct _decor {
WnckWindow *win;
diff --git a/gtk/window-decorator/switcher.c b/gtk/window-decorator/switcher.c
index b6ec0ff..d73d048 100644
--- a/gtk/window-decorator/switcher.c
+++ b/gtk/window-decorator/switcher.c
@@ -26,44 +26,44 @@ draw_switcher_background (decor_t *d)
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- top = _switcher_extents.top;
+ top = d->frame->win_extents.top;
- x1 = switcher_context.left_space - _switcher_extents.left;
- y1 = switcher_context.top_space - _switcher_extents.top;
- x2 = d->width - switcher_context.right_space + _switcher_extents.right;
- y2 = d->height - switcher_context.bottom_space + _switcher_extents.bottom;
+ x1 = d->frame->window_context.left_space - d->frame->win_extents.left;
+ y1 = d->frame->window_context.top_space - d->frame->win_extents.top;
+ x2 = d->width - d->frame->window_context.right_space + d->frame->win_extents.right;
+ y2 = d->height - d->frame->window_context.bottom_space + d->frame->win_extents.bottom;
- h = y2 - y1 - _switcher_extents.top - _switcher_extents.top;
+ h = y2 - y1 - d->frame->win_extents.top - d->frame->win_extents.top;
cairo_set_line_width (cr, 1.0);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- draw_shadow_background (d, cr, switcher_shadow, &switcher_context);
+ draw_shadow_background (d, cr, d->frame->border_shadow, &d->frame->window_context);
fill_rounded_rectangle (cr,
x1 + 0.5,
y1 + 0.5,
- _switcher_extents.left - 0.5,
+ d->frame->win_extents.left - 0.5,
top - 0.5,
5.0, CORNER_TOPLEFT,
&color, alpha, &color, alpha * 0.75,
SHADE_TOP | SHADE_LEFT);
fill_rounded_rectangle (cr,
- x1 + _switcher_extents.left,
+ x1 + d->frame->win_extents.left,
y1 + 0.5,
- x2 - x1 - _switcher_extents.left -
- _switcher_extents.right,
+ x2 - x1 - d->frame->win_extents.left -
+ d->frame->win_extents.right,
top - 0.5,
5.0, 0,
&color, alpha, &color, alpha * 0.75,
SHADE_TOP);
fill_rounded_rectangle (cr,
- x2 - _switcher_extents.right,
+ x2 - d->frame->win_extents.right,
y1 + 0.5,
- _switcher_extents.right - 0.5,
+ d->frame->win_extents.right - 0.5,
top - 0.5,
5.0, CORNER_TOPRIGHT,
&color, alpha, &color, alpha * 0.75,
@@ -72,16 +72,16 @@ draw_switcher_background (decor_t *d)
fill_rounded_rectangle (cr,
x1 + 0.5,
y1 + top,
- _switcher_extents.left - 0.5,
+ d->frame->win_extents.left - 0.5,
h,
5.0, 0,
&color, alpha, &color, alpha * 0.75,
SHADE_LEFT);
fill_rounded_rectangle (cr,
- x2 - _switcher_extents.right,
+ x2 - d->frame->win_extents.right,
y1 + top,
- _switcher_extents.right - 0.5,
+ d->frame->win_extents.right - 0.5,
h,
5.0, 0,
&color, alpha, &color, alpha * 0.75,
@@ -89,35 +89,35 @@ draw_switcher_background (decor_t *d)
fill_rounded_rectangle (cr,
x1 + 0.5,
- y2 - _switcher_extents.top,
- _switcher_extents.left - 0.5,
- _switcher_extents.top - 0.5,
+ y2 - d->frame->win_extents.top,
+ d->frame->win_extents.left - 0.5,
+ d->frame->win_extents.top - 0.5,
5.0, CORNER_BOTTOMLEFT,
&color, alpha, &color, alpha * 0.75,
SHADE_BOTTOM | SHADE_LEFT);
fill_rounded_rectangle (cr,
- x1 + _switcher_extents.left,
- y2 - _switcher_extents.top,
- x2 - x1 - _switcher_extents.left -
- _switcher_extents.right,
- _switcher_extents.top - 0.5,
+ x1 + d->frame->win_extents.left,
+ y2 - d->frame->win_extents.top,
+ x2 - x1 - d->frame->win_extents.left -
+ d->frame->win_extents.right,
+ d->frame->win_extents.top - 0.5,
5.0, 0,
&color, alpha, &color, alpha * 0.75,
SHADE_BOTTOM);
fill_rounded_rectangle (cr,
- x2 - _switcher_extents.right,
- y2 - _switcher_extents.top,
- _switcher_extents.right - 0.5,
- _switcher_extents.top - 0.5,
+ x2 - d->frame->win_extents.right,
+ y2 - d->frame->win_extents.top,
+ d->frame->win_extents.right - 0.5,
+ d->frame->win_extents.top - 0.5,
5.0, CORNER_BOTTOMRIGHT,
&color, alpha, &color, alpha * 0.75,
SHADE_BOTTOM | SHADE_RIGHT);
- cairo_rectangle (cr, x1 + _switcher_extents.left,
+ cairo_rectangle (cr, x1 + d->frame->win_extents.left,
y1 + top,
- x2 - x1 - _switcher_extents.left - _switcher_extents.right,
+ x2 - x1 - d->frame->win_extents.left - d->frame->win_extents.right,
h);
gdk_cairo_set_source_color_alpha (cr,
&style->bg[GTK_STATE_NORMAL],
@@ -178,6 +178,10 @@ draw_switcher_background (decor_t *d)
cairo_destroy (cr);
+ GdkPixbuf *buf = gdk_pixbuf_get_from_drawable (NULL, d->buffer_pixmap, NULL, 0, 0, 0, 0, d->width, d->height);
+
+ gdk_pixbuf_save (buf, "/home/smspillaz/rendered_switcher.png", "png", NULL, NULL);
+
copy_to_front_buffer (d);
pixel = ((((a * style->bg[GTK_STATE_NORMAL].blue ) >> 24) & 0x0000ff) |
@@ -213,10 +217,10 @@ draw_switcher_foreground (decor_t *d)
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- cairo_rectangle (cr, switcher_context.left_space,
- d->height - switcher_context.bottom_space,
- d->width - switcher_context.left_space -
- switcher_context.right_space,
+ cairo_rectangle (cr, d->frame->window_context.left_space,
+ d->height - d->frame->window_context.bottom_space,
+ d->width - d->frame->window_context.left_space -
+ d->frame->window_context.right_space,
SWITCHER_SPACE);
gdk_cairo_set_source_color_alpha (cr,
@@ -237,7 +241,7 @@ draw_switcher_foreground (decor_t *d)
pango_layout_get_pixel_size (d->layout, &w, NULL);
cairo_move_to (cr, d->width / 2 - w / 2,
- d->height - switcher_context.bottom_space +
+ d->height - d->frame->window_context.bottom_space +
SWITCHER_SPACE / 2 - d->frame->text_height / 2);
pango_cairo_show_layout (cr, d->layout);
@@ -301,15 +305,17 @@ update_switcher_window (Window popup,
XGetGeometry (gdk_x11_get_default_xdisplay (), popup, &root_return,
&x, &y, &width, &height, &border, &depth);
- decor_get_default_layout (&switcher_context, width, 1, &d->border_layout);
-
- width = d->border_layout.width;
- height = d->border_layout.height;
-
d->decorated = FALSE;
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;
+ height = d->border_layout.height;
+
selected_win = wnck_window_get (selected);
if (selected_win)
{
@@ -337,8 +343,8 @@ update_switcher_window (Window popup,
{
int tw;
- tw = width - switcher_context.left_space -
- switcher_context.right_space - 64;
+ tw = width - d->frame->window_context.left_space -
+ d->frame->window_context.right_space - 64;
pango_layout_set_auto_dir (d->layout, FALSE);
pango_layout_set_width (d->layout, tw * PANGO_SCALE);
pango_layout_set_text (d->layout, name, name_length);