summaryrefslogtreecommitdiff
path: root/gtk/window-decorator
diff options
context:
space:
mode:
authorSam Spilsbury <sam.spilsbury@canonical.com>2011-02-14 18:31:31 +0800
committerSam Spilsbury <sam.spilsbury@canonical.com>2011-02-14 18:31:31 +0800
commit552af63a1a5b2be7d3eb599ca95aa5ef58ed6d68 (patch)
treedee1fd1d05121bfa3a9d215f059092ed979569d9 /gtk/window-decorator
parente636a949d482d95dcdfb024e7e697d47ea96ea2c (diff)
downloadcompiz-with-glib-mainloop-552af63a1a5b2be7d3eb599ca95aa5ef58ed6d68.tar.gz
compiz-with-glib-mainloop-552af63a1a5b2be7d3eb599ca95aa5ef58ed6d68.tar.bz2
Add frame management system
There are different types of frames that we will need to support - like the GIMP's utility toolbox windows - we need to have stored separate frames in order to support them
Diffstat (limited to 'gtk/window-decorator')
-rw-r--r--gtk/window-decorator/actionmenu.c4
-rw-r--r--gtk/window-decorator/cairo.c133
-rw-r--r--gtk/window-decorator/decorator.c205
-rw-r--r--gtk/window-decorator/decorprops.c26
-rw-r--r--gtk/window-decorator/gtk-window-decorator.c108
-rw-r--r--gtk/window-decorator/gtk-window-decorator.h47
-rw-r--r--gtk/window-decorator/metacity.c186
-rw-r--r--gtk/window-decorator/wnck.c27
8 files changed, 432 insertions, 304 deletions
diff --git a/gtk/window-decorator/actionmenu.c b/gtk/window-decorator/actionmenu.c
index 27c9821..9d651d9 100644
--- a/gtk/window-decorator/actionmenu.c
+++ b/gtk/window-decorator/actionmenu.c
@@ -14,6 +14,8 @@ position_action_menu (GtkMenu *menu,
gpointer user_data)
{
WnckWindow *win = (WnckWindow *) user_data;
+ WnckWindowType win_type = wnck_window_get_window_type (win);
+ decor_frame_t *frame = &decor_frames[get_frame_type (win_type)];
decor_t *d = g_object_get_data (G_OBJECT (win), "decor");
gint bx, by, width, height;
@@ -21,7 +23,7 @@ position_action_menu (GtkMenu *menu,
if ((*theme_get_button_position) (d, BUTTON_MENU, width, height,
&bx, &by, &width, &height))
- *x = *x - _win_extents.left + bx;
+ *x = *x - frame->win_extents.left + bx;
if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_RTL)
{
diff --git a/gtk/window-decorator/cairo.c b/gtk/window-decorator/cairo.c
index a9b8f42..48b7c36 100644
--- a/gtk/window-decorator/cairo.c
+++ b/gtk/window-decorator/cairo.c
@@ -271,6 +271,8 @@ draw_window_decoration (decor_t *d)
GtkStyle *style;
GdkDrawable *drawable;
decor_color_t color;
+ WnckWindowType win_type = wnck_window_get_window_type (d->win);
+ decor_frame_t *frame = &decor_frames[get_frame_type (win_type)];
double alpha;
double x1, y1, x2, y2, x, y, h;
int corners = SHADE_LEFT | SHADE_RIGHT | SHADE_TOP | SHADE_BOTTOM;
@@ -310,12 +312,12 @@ draw_window_decoration (decor_t *d)
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- top = _win_extents.top + titlebar_height;
+ top = frame->win_extents.top + frame->titlebar_height;
- x1 = d->context->left_space - _win_extents.left;
- y1 = d->context->top_space - _win_extents.top - titlebar_height;
- x2 = d->width - d->context->right_space + _win_extents.right;
- y2 = d->height - d->context->bottom_space + _win_extents.bottom;
+ x1 = d->context->left_space - frame->win_extents.left;
+ y1 = d->context->top_space - frame->win_extents.top - frame->titlebar_height;
+ x2 = d->width - d->context->right_space + frame->win_extents.right;
+ y2 = d->height - d->context->bottom_space + frame->win_extents.bottom;
h = d->height - d->context->top_space - d->context->bottom_space;
@@ -333,26 +335,26 @@ draw_window_decoration (decor_t *d)
fill_rounded_rectangle (cr,
x1 + 0.5,
y1 + 0.5,
- _win_extents.left - 0.5,
+ frame->win_extents.left - 0.5,
top - 0.5,
5.0, CORNER_TOPLEFT & corners,
&title_color[0], 1.0, &title_color[1], alpha,
SHADE_TOP | SHADE_LEFT);
fill_rounded_rectangle (cr,
- x1 + _win_extents.left,
+ x1 + frame->win_extents.left,
y1 + 0.5,
- x2 - x1 - _win_extents.left -
- _win_extents.right,
+ x2 - x1 - frame->win_extents.left -
+ frame->win_extents.right,
top - 0.5,
5.0, 0,
&title_color[0], 1.0, &title_color[1], alpha,
SHADE_TOP);
fill_rounded_rectangle (cr,
- x2 - _win_extents.right,
+ x2 - frame->win_extents.right,
y1 + 0.5,
- _win_extents.right - 0.5,
+ frame->win_extents.right - 0.5,
top - 0.5,
5.0, CORNER_TOPRIGHT & corners,
&title_color[0], 1.0, &title_color[1], alpha,
@@ -365,26 +367,26 @@ draw_window_decoration (decor_t *d)
fill_rounded_rectangle (cr,
x1 + 0.5,
y1 + 0.5,
- _win_extents.left - 0.5,
+ frame->win_extents.left - 0.5,
top - 0.5,
5.0, CORNER_TOPLEFT & corners,
&color, 1.0, &color, alpha,
SHADE_TOP | SHADE_LEFT);
fill_rounded_rectangle (cr,
- x1 + _win_extents.left,
+ x1 + frame->win_extents.left,
y1 + 0.5,
- x2 - x1 - _win_extents.left -
- _win_extents.right,
+ x2 - x1 - frame->win_extents.left -
+ frame->win_extents.right,
top - 0.5,
5.0, 0,
&color, 1.0, &color, alpha,
SHADE_TOP);
fill_rounded_rectangle (cr,
- x2 - _win_extents.right,
+ x2 - frame->win_extents.right,
y1 + 0.5,
- _win_extents.right - 0.5,
+ frame->win_extents.right - 0.5,
top - 0.5,
5.0, CORNER_TOPRIGHT & corners,
&color, 1.0, &color, alpha,
@@ -394,16 +396,16 @@ draw_window_decoration (decor_t *d)
fill_rounded_rectangle (cr,
x1 + 0.5,
y1 + top,
- _win_extents.left - 0.5,
+ frame->win_extents.left - 0.5,
h,
5.0, 0,
&color, 1.0, &color, alpha,
SHADE_LEFT);
fill_rounded_rectangle (cr,
- x2 - _win_extents.right,
+ x2 - frame->win_extents.right,
y1 + top,
- _win_extents.right - 0.5,
+ frame->win_extents.right - 0.5,
h,
5.0, 0,
&color, 1.0, &color, alpha,
@@ -412,28 +414,28 @@ draw_window_decoration (decor_t *d)
fill_rounded_rectangle (cr,
x1 + 0.5,
- y2 - _win_extents.bottom,
- _win_extents.left - 0.5,
- _win_extents.bottom - 0.5,
+ y2 - frame->win_extents.bottom,
+ frame->win_extents.left - 0.5,
+ frame->win_extents.bottom - 0.5,
5.0, CORNER_BOTTOMLEFT & corners,
&color, 1.0, &color, alpha,
SHADE_BOTTOM | SHADE_LEFT);
fill_rounded_rectangle (cr,
- x1 + _win_extents.left,
- y2 - _win_extents.bottom,
- x2 - x1 - _win_extents.left -
- _win_extents.right,
- _win_extents.bottom - 0.5,
+ x1 + frame->win_extents.left,
+ y2 - frame->win_extents.bottom,
+ x2 - x1 - frame->win_extents.left -
+ frame->win_extents.right,
+ frame->win_extents.bottom - 0.5,
5.0, 0,
&color, 1.0, &color, alpha,
SHADE_BOTTOM);
fill_rounded_rectangle (cr,
- x2 - _win_extents.right,
- y2 - _win_extents.bottom,
- _win_extents.right - 0.5,
- _win_extents.bottom - 0.5,
+ x2 - frame->win_extents.right,
+ y2 - frame->win_extents.bottom,
+ frame->win_extents.right - 0.5,
+ frame->win_extents.bottom - 0.5,
5.0, CORNER_BOTTOMRIGHT & corners,
&color, 1.0, &color, alpha,
SHADE_BOTTOM | SHADE_RIGHT);
@@ -520,7 +522,7 @@ draw_window_decoration (decor_t *d)
if (d->actions & WNCK_WINDOW_ACTION_CLOSE)
{
button_state_offsets (button_x,
- y1 - 3.0 + titlebar_height / 2,
+ y1 - 3.0 + frame->titlebar_height / 2,
d->button_states[BUTTON_CLOSE], &x, &y);
button_x -= 17;
@@ -547,7 +549,7 @@ draw_window_decoration (decor_t *d)
if (d->actions & WNCK_WINDOW_ACTION_MAXIMIZE)
{
button_state_offsets (button_x,
- y1 - 3.0 + titlebar_height / 2,
+ y1 - 3.0 + frame->titlebar_height / 2,
d->button_states[BUTTON_MAX], &x, &y);
button_x -= 17;
@@ -592,7 +594,7 @@ draw_window_decoration (decor_t *d)
if (d->actions & WNCK_WINDOW_ACTION_MINIMIZE)
{
button_state_offsets (button_x,
- y1 - 3.0 + titlebar_height / 2,
+ y1 - 3.0 + frame->titlebar_height / 2,
d->button_states[BUTTON_MIN], &x, &y);
button_x -= 17;
@@ -627,7 +629,7 @@ draw_window_decoration (decor_t *d)
{
cairo_move_to (cr,
d->context->left_space + 21.0,
- y1 + 2.0 + (titlebar_height - text_height) / 2.0);
+ y1 + 2.0 + (frame->titlebar_height - text_height) / 2.0);
gdk_cairo_set_source_color_alpha (cr,
&style->fg[GTK_STATE_NORMAL],
@@ -647,7 +649,7 @@ draw_window_decoration (decor_t *d)
cairo_move_to (cr,
d->context->left_space + 21.0,
- y1 + 2.0 + (titlebar_height - text_height) / 2.0);
+ y1 + 2.0 + (frame->titlebar_height - text_height) / 2.0);
pango_cairo_show_layout (cr, d->layout);
}
@@ -655,7 +657,7 @@ draw_window_decoration (decor_t *d)
if (d->icon)
{
cairo_translate (cr, d->context->left_space + 1,
- y1 - 5.0 + titlebar_height / 2);
+ y1 - 5.0 + frame->titlebar_height / 2);
cairo_set_source (cr, d->icon);
cairo_rectangle (cr, 0.0, 0.0, 16.0, 16.0);
cairo_clip (cr);
@@ -722,6 +724,8 @@ calc_decoration_size (decor_t *d,
gint *height)
{
decor_layout_t layout;
+ WnckWindowType win_type = wnck_window_get_window_type (d->win);
+ decor_frame_t *frame = &decor_frames[get_frame_type (win_type)];
int top_width;
/* To avoid wasting texture memory, we only calculate the minimal
@@ -740,7 +744,7 @@ 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);
+ decor_get_default_layout (&frame->window_context, top_width, 1, &layout);
if (!d->context || memcmp (&layout, &d->border_layout, sizeof (layout)))
{
@@ -748,8 +752,8 @@ calc_decoration_size (decor_t *d,
*height = layout.height;
d->border_layout = layout;
- d->context = &window_context;
- d->shadow = border_shadow;
+ d->context = &frame->window_context;
+ d->shadow = frame->border_shadow;
return TRUE;
}
@@ -764,15 +768,15 @@ 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_no_shadow,
+ decor_get_default_layout (&frame->window_context_no_shadow,
d->client_width, d->client_height, &layout);
*width = layout.width;
*height = layout.height;
d->border_layout = layout;
- d->context = &window_context_no_shadow;
- d->shadow = border_no_shadow;
+ d->context = &frame->window_context_no_shadow;
+ d->shadow = frame->border_no_shadow;
return TRUE;
}
@@ -790,25 +794,28 @@ get_button_position (decor_t *d,
gint *w,
gint *h)
{
+ WnckWindowType win_type = wnck_window_get_window_type (d->win);
+ decor_frame_t *frame = &decor_frames[get_frame_type (win_type)];
+
if (i > BUTTON_MENU)
return FALSE;
if (d->frame_window)
{
- *x = bpos[i].x + bpos[i].xw * width + _win_extents.left + 4;
+ *x = bpos[i].x + bpos[i].xw * width + frame->win_extents.left + 4;
*y = bpos[i].y + bpos[i].yh * height + bpos[i].yth *
- (titlebar_height - 17) + _win_extents.top + 2;
+ (frame->titlebar_height - 17) + frame->win_extents.top + 2;
}
else
{
*x = bpos[i].x + bpos[i].xw * width;
*y = bpos[i].y + bpos[i].yh * height + bpos[i].yth *
- (titlebar_height - 17);
+ (frame->titlebar_height - 17);
}
*w = bpos[i].w + bpos[i].ww * width;
*h = bpos[i].h + bpos[i].hh * height + bpos[i].hth +
- (titlebar_height - 17);
+ (frame->titlebar_height - 17);
/* hack to position multiple buttons on the right */
if (i != BUTTON_MENU)
@@ -828,20 +835,23 @@ get_event_window_position (decor_t *d,
gint *w,
gint *h)
{
+ WnckWindowType win_type = wnck_window_get_window_type (d->win);
+ decor_frame_t *frame = &decor_frames[get_frame_type (win_type)];
+
if (d->frame_window)
{
- *x = pos[i][j].x + pos[i][j].xw * width + _win_extents.left;
- *y = pos[i][j].y + _win_extents.top +
- pos[i][j].yh * height + pos[i][j].yth * (titlebar_height - 17);
+ *x = pos[i][j].x + pos[i][j].xw * width + frame->win_extents.left;
+ *y = pos[i][j].y + frame->win_extents.top +
+ pos[i][j].yh * height + pos[i][j].yth * (frame->titlebar_height - 17);
if (i == 0 && (j == 0 || j == 2))
- *y -= titlebar_height;
+ *y -= frame->titlebar_height;
}
else
{
*x = pos[i][j].x + pos[i][j].xw * width;
*y = pos[i][j].y +
- pos[i][j].yh * height + pos[i][j].yth * (titlebar_height - 17);
+ pos[i][j].yh * height + pos[i][j].yth * (frame->titlebar_height - 17);
}
if ((d->state & WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY) &&
@@ -862,15 +872,22 @@ get_event_window_position (decor_t *d,
else
{
*h = pos[i][j].h +
- pos[i][j].hh * height + pos[i][j].hth * (titlebar_height - 17);
+ pos[i][j].hh * height + pos[i][j].hth * (frame->titlebar_height - 17);
}
}
void
update_border_extents (gint text_height)
{
- _win_extents = _default_win_extents;
- _max_win_extents = _default_win_extents;
- max_titlebar_height = titlebar_height =
- (text_height < 17) ? 17 : text_height;
+ unsigned int i;
+
+ for (i = 0; i < DECOR_FRAME_TYPE_UNDECORATED; i++)
+ {
+ decor_frame_t *frame = &decor_frames[i];
+
+ frame->win_extents = _default_decoration.win_extents;
+ frame->max_win_extents = _default_decoration.win_extents;
+ frame->titlebar_height = frame->max_titlebar_height =
+ (text_height < 17) ? 17 : text_height;
+ }
}
diff --git a/gtk/window-decorator/decorator.c b/gtk/window-decorator/decorator.c
index b4fe58b..64f4fa5 100644
--- a/gtk/window-decorator/decorator.c
+++ b/gtk/window-decorator/decorator.c
@@ -473,6 +473,7 @@ update_shadow (void)
Display *xdisplay = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
GdkDisplay *display = gdk_display_get_default ();
GdkScreen *screen = gdk_display_get_default_screen (display);
+ unsigned int i;
opt_shadow.shadow_radius = shadow_radius;
opt_shadow.shadow_opacity = shadow_opacity;
@@ -507,108 +508,110 @@ update_shadow (void)
decor_draw_simple,
0);
- if (border_shadow)
+ for (i = 0; i < 5; i++)
{
- decor_shadow_destroy (xdisplay, border_shadow);
- border_shadow = NULL;
- }
+ decor_frame_t *frame = &decor_frames[i];
- border_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_shadow,
- &window_context,
- draw_border_shape,
- 0);
-
- if (border_no_shadow)
- {
- decor_shadow_destroy (xdisplay, border_no_shadow);
- border_no_shadow = NULL;
- }
+ if (frame->border_shadow)
+ {
+ decor_shadow_destroy (xdisplay, frame->border_shadow);
+ frame->border_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);
- max_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,
+ 0);
+
+ if (frame->border_no_shadow)
+ {
+ decor_shadow_destroy (xdisplay, frame->border_no_shadow);
+ frame->border_no_shadow = NULL;
+ }
- max_border_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_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;
- }
+ 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,
+ 0);
+
+ if (frame->max_border_shadow)
+ {
+ decor_shadow_destroy (xdisplay, frame->max_border_shadow);
+ frame->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);
+ 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 *) 1);
+
+ 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 *) 1);
+ }
if (switcher_shadow)
{
@@ -714,7 +717,7 @@ update_default_decorations (GdkScreen *screen)
decor_t d;
gint nQuad;
decor_quad_t quads[N_QUADS_MAX];
- decor_extents_t extents = _win_extents;
+ decor_extents_t extents = _default_decoration.win_extents;
xroot = RootWindowOfScreen (gdk_x11_screen_get_xscreen (screen));
@@ -772,8 +775,8 @@ update_default_decorations (GdkScreen *screen)
memset (&d, 0, sizeof (d));
- d.context = &window_context;
- d.shadow = border_shadow;
+ d.context = &_default_decoration.window_context;
+ d.shadow = _default_decoration.border_shadow;
d.layout = pango_layout_new (pango_context);
decor_get_default_layout (d.context, 1, 1, &d.border_layout);
@@ -781,7 +784,7 @@ update_default_decorations (GdkScreen *screen)
d.width = d.border_layout.width;
d.height = d.border_layout.height;
- extents.top += titlebar_height;
+ extents.top += _default_decoration.titlebar_height;
d.draw = theme_draw_window_decoration;
diff --git a/gtk/window-decorator/decorprops.c b/gtk/window-decorator/decorprops.c
index b6b3820..2b161a2 100644
--- a/gtk/window-decorator/decorprops.c
+++ b/gtk/window-decorator/decorprops.c
@@ -6,7 +6,8 @@ decor_update_window_property (decor_t *d)
long data[256];
Display *xdisplay =
GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
- decor_extents_t extents = _win_extents;
+ WnckWindowType win_type = wnck_window_get_window_type (d->win);
+ decor_frame_t frame = decor_frames[get_frame_type (win_type)];
gint nQuad;
decor_quad_t quads[N_QUADS_MAX];
int w, h;
@@ -27,16 +28,17 @@ decor_update_window_property (decor_t *d)
&d->border_layout,
stretch_offset);
- extents.top += titlebar_height;
+ frame.win_extents.top += frame.titlebar_height;
if (d->frame_window)
{
- decor_gen_window_property (data, &extents, &extents, 20, 20);
+ decor_gen_window_property (data, &frame.win_extents, &frame.win_extents, 20, 20);
}
else
{
decor_quads_to_property (data, GDK_PIXMAP_XID (d->pixmap),
- &extents, &extents, &extents, &extents,
+ &frame.win_extents, &frame.win_extents,
+ &frame.win_extents, &frame.win_extents,
ICON_SPACE + d->button_width,
0,
quads, nQuad);
@@ -54,23 +56,23 @@ decor_update_window_property (decor_t *d)
top.rects = &top.extents;
top.numRects = top.size = 1;
- top.extents.x1 = -extents.left;
- top.extents.y1 = -extents.top;
- top.extents.x2 = w + extents.right;
+ top.extents.x1 = -frame.win_extents.left;
+ top.extents.y1 = -frame.win_extents.top;
+ top.extents.x2 = w + frame.win_extents.right;
top.extents.y2 = 0;
bottom.rects = &bottom.extents;
bottom.numRects = bottom.size = 1;
- bottom.extents.x1 = -extents.left;
+ bottom.extents.x1 = -frame.win_extents.left;
bottom.extents.y1 = 0;
- bottom.extents.x2 = w + extents.right;
- bottom.extents.y2 = extents.bottom;
+ bottom.extents.x2 = w + frame.win_extents.right;
+ bottom.extents.y2 = frame.win_extents.bottom;
left.rects = &left.extents;
left.numRects = left.size = 1;
- left.extents.x1 = -extents.left;
+ left.extents.x1 = -frame.win_extents.left;
left.extents.y1 = 0;
left.extents.x2 = 0;
left.extents.y2 = h;
@@ -80,7 +82,7 @@ decor_update_window_property (decor_t *d)
right.extents.x1 = 0;
right.extents.y1 = 0;
- right.extents.x2 = extents.right;
+ right.extents.x2 = frame.win_extents.right;
right.extents.y2 = h;
decor_update_blur_property (d,
diff --git a/gtk/window-decorator/gtk-window-decorator.c b/gtk/window-decorator/gtk-window-decorator.c
index 93e38db..05f53cb 100644
--- a/gtk/window-decorator/gtk-window-decorator.c
+++ b/gtk/window-decorator/gtk-window-decorator.c
@@ -27,38 +27,15 @@ double decoration_alpha = 0.5;
#define SWITCHER_SPACE 40
+decor_frame_t decor_frames[5];
+decor_frame_t _default_decoration;
+
decor_extents_t _shadow_extents = { 0, 0, 0, 0 };
-decor_extents_t _win_extents = { 6, 6, 6, 6 };
-decor_extents_t _max_win_extents = { 6, 6, 4, 6 };
decor_extents_t _default_win_extents = { 6, 6, 6, 6 };
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 = {
- { 0, 0, 0, 0 },
- 6, 6, 4, 6,
- 0, 0, 0, 0
-};
-
-decor_context_t max_window_context = {
- { 0, 0, 0, 0 },
- 6, 6, 4, 6,
- 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_shadow_t *switcher_shadow = NULL;
+decor_shadow_t *no_border_shadow = NULL;
decor_context_t switcher_context = {
{ 0, 0, 0, 0 },
@@ -84,13 +61,6 @@ gint shadow_offset_y = SHADOW_OFFSET_Y;
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;
GdkPixmap *decor_active_pixmap = NULL;
@@ -177,6 +147,72 @@ decor_t *switcher_window = NULL;
XRenderPictFormat *xformat_rgba;
XRenderPictFormat *xformat_rgb;
+void
+initialize_decorations ()
+{
+ decor_extents_t _win_extents = { 6, 6, 6, 6 };
+ decor_extents_t _max_win_extents = { 6, 6, 4, 6 };
+ decor_context_t _window_context = {
+ { 0, 0, 0, 0 },
+ 6, 6, 4, 6,
+ 0, 0, 0, 0
+ };
+
+ decor_context_t _max_window_context = {
+ { 0, 0, 0, 0 },
+ 6, 6, 4, 6,
+ 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
+ };
+ WnckWindowType win_types[] = {
+ WNCK_WINDOW_NORMAL, WNCK_WINDOW_DIALOG, WNCK_WINDOW_MENU,
+ WNCK_WINDOW_UTILITY, WNCK_WINDOW_SPLASHSCREEN
+ };
+
+ unsigned int i;
+
+ for (i = 0; i < 5; i++)
+ {
+ fprintf (stderr, "i is %i\n", i);
+ decor_frames[i].win_extents = _win_extents;
+ decor_frames[i].max_win_extents = _max_win_extents;
+ 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;
+ decor_frames[i].max_border_shadow = NULL;
+ }
+
+ _default_decoration.win_extents = _win_extents;
+ _default_decoration.max_win_extents = _max_win_extents;
+ _default_decoration.titlebar_height = 17;
+ _default_decoration.max_titlebar_height = 17;
+ _default_decoration.window_context = _window_context;
+ _default_decoration.window_context_no_shadow = _window_context_no_shadow;
+ _default_decoration.max_window_context = _max_window_context;
+ _default_decoration.max_window_context_no_shadow = _max_window_context_no_shadow;
+ _default_decoration.border_shadow = NULL;
+ _default_decoration.border_no_shadow = NULL;
+ _default_decoration.max_border_no_shadow = NULL;
+ _default_decoration.max_border_shadow = NULL;
+}
+
int
main (int argc, char *argv[])
{
@@ -418,6 +454,8 @@ main (int argc, char *argv[])
connect_screen (screen);
}
+ initialize_decorations ();
+
if (!init_settings (screen))
{
fprintf (stderr, "%s: Failed to get necessary gtk settings\n", argv[0]);
diff --git a/gtk/window-decorator/gtk-window-decorator.h b/gtk/window-decorator/gtk-window-decorator.h
index 0074184..bde48b7 100644
--- a/gtk/window-decorator/gtk-window-decorator.h
+++ b/gtk/window-decorator/gtk-window-decorator.h
@@ -226,18 +226,8 @@ extern double decoration_alpha;
#define SWITCHER_SPACE 40
extern decor_extents_t _shadow_extents;
-extern decor_extents_t _win_extents;
-extern decor_extents_t _max_win_extents;
-extern decor_extents_t _default_win_extents;
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_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;
@@ -260,10 +250,6 @@ extern MetaButtonLayout meta_button_layout;
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;
@@ -351,6 +337,29 @@ typedef struct {
event_callback callback;
} event_window;
+typedef enum _decor_frame_type {
+ DECOR_FRAME_TYPE_NORMAL,
+ DECOR_FRAME_TYPE_DIALOG,
+ DECOR_FRAME_TYPE_MENU,
+ DECOR_FRAME_TYPE_UTILITY,
+ DECOR_FRAME_TYPE_UNDECORATED
+} decor_frame_type;
+
+typedef struct _decor_frame {
+ decor_extents_t win_extents;
+ decor_extents_t max_win_extents;
+ int titlebar_height;
+ int max_titlebar_height;
+ decor_shadow_t *border_shadow;
+ decor_shadow_t *border_no_shadow;
+ decor_shadow_t *max_border_shadow;
+ decor_shadow_t *max_border_no_shadow;
+ decor_context_t window_context;
+ decor_context_t window_context_no_shadow;
+ decor_context_t max_window_context;
+ decor_context_t max_window_context_no_shadow;
+} decor_frame_t;
+
typedef struct _decor {
WnckWindow *win;
event_window event_windows[3][3];
@@ -458,6 +467,9 @@ extern XRenderPictFormat *xformat_rgb;
extern Atom compiz_shadow_info_atom;
extern Atom compiz_shadow_color_atom;
+extern decor_frame_t decor_frames[5];
+extern decor_frame_t _default_decoration;
+
/* gtk-window-decorator.c */
double
@@ -511,10 +523,11 @@ queue_decor_draw (decor_t *d);
void
copy_to_front_buffer (decor_t *d);
-
-
/* wnck.c*/
+decor_frame_type
+get_frame_type (WnckWindowType type);
+
void
decorations_changed (WnckScreen *screen);
@@ -664,7 +677,7 @@ pixmap_new_from_pixbuf (GdkPixbuf *pixbuf, int depth);
#ifdef USE_METACITY
MetaFrameType
-meta_get_frame_type_for_win_type (WnckWindow *win);
+meta_get_frame_type_for_decor_type (decor_frame_type frame_type);
void
meta_draw_window_decoration (decor_t *d);
diff --git a/gtk/window-decorator/metacity.c b/gtk/window-decorator/metacity.c
index 33c8648..8d9cd22 100644
--- a/gtk/window-decorator/metacity.c
+++ b/gtk/window-decorator/metacity.c
@@ -23,7 +23,10 @@ decor_update_meta_window_property (decor_t *d,
Display *xdisplay =
GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
gint nQuad;
- decor_extents_t extents, max_extents;
+ WnckWindowType win_type = wnck_window_get_window_type (d->win);
+ decor_frame_t *frame = &decor_frames[get_frame_type (win_type)];
+ decor_extents_t win_extents = frame->win_extents;
+ decor_extents_t max_win_extents = frame->max_win_extents;
decor_quad_t quads[N_QUADS_MAX];
gint w, lh, rh;
gint top_stretch_offset;
@@ -59,18 +62,15 @@ decor_update_meta_window_property (decor_t *d,
top_stretch_offset,
bottom_stretch_offset);
- extents = _win_extents;
- max_extents = _max_win_extents;
-
- extents.top += titlebar_height;
- max_extents.top += max_titlebar_height;
+ win_extents.top += frame->titlebar_height;
+ max_win_extents.top += frame->max_titlebar_height;
if (d->frame_window)
- decor_gen_window_property (data, &extents, &max_extents, 20, 20);
+ decor_gen_window_property (data, &win_extents, &max_win_extents, 20, 20);
else
decor_quads_to_property (data, GDK_PIXMAP_XID (d->pixmap),
- &extents, &extents,
- &max_extents, &max_extents,
+ &win_extents, &win_extents,
+ &max_win_extents, &max_win_extents,
ICON_SPACE + d->button_width,
0,
quads, nQuad);
@@ -517,22 +517,22 @@ meta_get_decoration_geometry (decor_t *d,
}
MetaFrameType
-meta_get_frame_type_for_win_type (WnckWindow *win)
+meta_get_frame_type_for_decor_type (decor_frame_type frame_type)
{
MetaFrameType type;
- switch (wnck_window_get_window_type (win))
+ switch (frame_type)
{
- case WNCK_WINDOW_NORMAL:
+ case DECOR_FRAME_TYPE_NORMAL:
type = META_FRAME_TYPE_NORMAL;
break;
- case WNCK_WINDOW_DIALOG:
+ case DECOR_FRAME_TYPE_DIALOG:
type = META_FRAME_TYPE_DIALOG;
break;
- case WNCK_WINDOW_MENU:
+ case DECOR_FRAME_TYPE_MENU:
type = META_FRAME_TYPE_MENU;
break;
- case WNCK_WINDOW_UTILITY:
+ case DECOR_FRAME_TYPE_UTILITY:
type = META_FRAME_TYPE_UTILITY;
break;
default:
@@ -554,6 +554,7 @@ meta_draw_window_decoration (decor_t *d)
MetaButtonLayout button_layout;
MetaFrameGeometry fgeom;
MetaFrameFlags flags;
+ WnckWindowType win_type;
MetaFrameType frame_type;
MetaTheme *theme;
GtkStyle *style;
@@ -606,7 +607,13 @@ meta_draw_window_decoration (decor_t *d)
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
theme = meta_theme_get_current ();
- frame_type = meta_get_frame_type_for_win_type (d->win);
+ if (d->win)
+ {
+ win_type = wnck_window_get_window_type (d->win);
+ frame_type = meta_get_frame_type_for_decor_type (get_frame_type (win_type));
+ }
+ else
+ frame_type = META_FRAME_TYPE_NORMAL;
meta_get_decoration_geometry (d, theme, &flags, &fgeom, &button_layout,
frame_type, &clip);
@@ -878,20 +885,6 @@ meta_draw_window_decoration (decor_t *d)
if (d->frame_window)
{
GdkWindow *gdk_frame_window = gtk_widget_get_window (d->decor_window);
- decor_extents_t extents;
-
- if (d->state & (WNCK_WINDOW_STATE_MAXIMIZED_HORIZONTALLY |
- WNCK_WINDOW_STATE_MAXIMIZED_VERTICALLY))
- {
- extents.left = 0;
- extents.right = 0;
- extents.top = 10;
- extents.bottom = 0;
- }
- else
- {
- extents = _win_extents;
- }
/*
* FIXME: What is '4' supposed to be for here...
@@ -977,6 +970,7 @@ meta_get_button_position (decor_t *d,
MetaButtonLayout button_layout;
MetaFrameGeometry fgeom;
MetaFrameFlags flags;
+ decor_frame_type d_frame_type;
MetaFrameType frame_type;
MetaTheme *theme;
GdkRectangle clip;
@@ -994,7 +988,8 @@ meta_get_button_position (decor_t *d,
}
theme = meta_theme_get_current ();
- frame_type = meta_get_frame_type_for_win_type (d->win);
+ d_frame_type = get_frame_type (wnck_window_get_window_type (d->win));
+ frame_type = meta_get_frame_type_for_decor_type (d_frame_type);
meta_get_decoration_geometry (d, theme, &flags, &fgeom, &button_layout,
frame_type, &clip);
@@ -1090,8 +1085,9 @@ meta_get_button_position (decor_t *d,
if (d->frame_window)
{
- *x += _win_extents.left + 4;
- *y += _win_extents.top + 2;
+ decor_frame_t *frame = &decor_frames[d_frame_type];
+ *x += frame.win_extents.left + 4;
+ *y += frame.win_extents.top + 2;
}
return TRUE;
@@ -1106,33 +1102,38 @@ meta_calc_decoration_size (decor_t *d,
gint *height)
{
decor_layout_t layout;
+ decor_frame_t *frame;
decor_context_t *context;
decor_shadow_t *shadow;
+ WnckWindowType win_type;
+
+ win_type = wnck_window_get_window_type (d->win);
+ frame = &decor_frames[get_frame_type (win_type)];
if ((d->state & META_MAXIMIZED) == META_MAXIMIZED)
{
if (!d->frame_window)
{
- context = &max_window_context;
- shadow = max_border_shadow;
+ context = &frame->max_window_context;
+ shadow = frame->max_border_shadow;
}
else
{
- context = &max_window_context_no_shadow;
- shadow = max_border_no_shadow;
+ context = &frame->max_window_context_no_shadow;
+ shadow = frame->max_border_no_shadow;
}
}
else
{
if (!d->frame_window)
{
- context = &window_context;
- shadow = border_shadow;
+ context = &frame->window_context;
+ shadow = frame->border_shadow;
}
else
{
- context = &window_context_no_shadow;
- shadow = border_no_shadow;
+ context = &frame->window_context_no_shadow;
+ shadow = frame->border_no_shadow;
}
}
@@ -1159,7 +1160,7 @@ meta_calc_decoration_size (decor_t *d,
{
if ((d->state & META_MAXIMIZED) == META_MAXIMIZED)
decor_get_default_layout (context, d->client_width,
- d->client_height - titlebar_height,
+ d->client_height - frame->titlebar_height,
&layout);
else
decor_get_default_layout (context, d->client_width,
@@ -1169,7 +1170,7 @@ meta_calc_decoration_size (decor_t *d,
*height = layout.height;
d->border_layout = layout;
- d->shadow = no_border_shadow;
+ d->shadow = shadow;
d->context = context;
meta_calc_button_size (d);
@@ -1216,11 +1217,17 @@ meta_get_event_window_position (decor_t *d,
MetaFrameFlags flags;
MetaTheme *theme;
MetaFrameType frame_type;
+ decor_frame_type d_frame_type;
+ decor_frame_t *frame;
+ WnckWindowType win_type;
GdkRectangle clip;
theme = meta_theme_get_current ();
- frame_type = meta_get_frame_type_for_win_type (d->win);
+ win_type = wnck_window_get_window_type (d->win);
+ d_frame_type = get_frame_type (win_type);
+ frame_type = meta_get_frame_type_for_decor_type (d_frame_type);
+ frame = &decor_frames[frame_type];
meta_get_decoration_geometry (d, theme, &flags, &fgeom, &button_layout,
frame_type, &clip);
@@ -1234,9 +1241,9 @@ meta_get_event_window_position (decor_t *d,
if (d->frame_window)
{
*x = width - fgeom.right_width - RESIZE_EXTENDS +
- _win_extents.left + 2;
+ frame->win_extents.left + 2;
*y = height - fgeom.bottom_height - RESIZE_EXTENDS +
- _win_extents.top + 2;
+ frame->win_extents.top + 2;
}
else
{
@@ -1250,7 +1257,7 @@ meta_get_event_window_position (decor_t *d,
*x = fgeom.left_width + RESIZE_EXTENDS;
*y = height - fgeom.bottom_height;
if (d->frame_window)
- *y += _win_extents.top + 2;
+ *y += frame->win_extents.top + 2;
*w = width - fgeom.left_width - fgeom.right_width -
(2 * RESIZE_EXTENDS);
*h = fgeom.bottom_height;
@@ -1261,8 +1268,8 @@ meta_get_event_window_position (decor_t *d,
*y = height - fgeom.bottom_height - RESIZE_EXTENDS;
if (d->frame_window)
{
- *x += _win_extents.left + 4;
- *y += _win_extents.bottom + 2;
+ *x += frame->win_extents.left + 4;
+ *y += frame->win_extents.bottom + 2;
}
*w = fgeom.left_width + RESIZE_EXTENDS;
*h = fgeom.bottom_height + RESIZE_EXTENDS;
@@ -1274,7 +1281,7 @@ meta_get_event_window_position (decor_t *d,
case 2: /* right */
*x = width - fgeom.right_width;
if (d->frame_window)
- *x += _win_extents.left + 2;
+ *x += frame->win_extents.left + 2;
*w = fgeom.right_width;
*h = height - fgeom.top_height - fgeom.bottom_height -
(2 * RESIZE_EXTENDS);
@@ -1289,7 +1296,7 @@ meta_get_event_window_position (decor_t *d,
default:
*x = 0;
if (d->frame_window)
- *x += _win_extents.left + 4;
+ *x += frame->win_extents.left + 4;
*y = fgeom.top_height + RESIZE_EXTENDS;
*w = fgeom.left_width;
*h = height - fgeom.top_height - fgeom.bottom_height -
@@ -1305,8 +1312,8 @@ meta_get_event_window_position (decor_t *d,
*y = 0;
if (d->frame_window)
{
- *x += _win_extents.left + 2;
- *y += _win_extents.top + 2 - fgeom.title_rect.height;
+ *x += frame->win_extents.left + 2;
+ *y += frame->win_extents.top + 2 - fgeom.title_rect.height;
}
*w = fgeom.right_width + RESIZE_EXTENDS;
*h = fgeom.top_height + RESIZE_EXTENDS;
@@ -1315,7 +1322,7 @@ meta_get_event_window_position (decor_t *d,
*x = fgeom.left_width + RESIZE_EXTENDS;
*y = 0;
if (d->frame_window)
- *y += _win_extents.top + 2;
+ *y += frame->win_extents.top + 2;
*w = width - fgeom.left_width - fgeom.right_width -
(2 * RESIZE_EXTENDS);
*h = fgeom.title_rect.y + TOP_RESIZE_HEIGHT;
@@ -1326,8 +1333,8 @@ meta_get_event_window_position (decor_t *d,
*y = 0;
if (d->frame_window)
{
- *x += _win_extents.left + 4;
- *y += _win_extents.top + 2 - fgeom.title_rect.height;
+ *x += frame->win_extents.left + 4;
+ *y += frame->win_extents.top + 2 - fgeom.title_rect.height;
}
*w = fgeom.left_width + RESIZE_EXTENDS;
*h = fgeom.top_height + RESIZE_EXTENDS;
@@ -1588,39 +1595,58 @@ void
meta_update_border_extents (gint text_height)
{
MetaTheme *theme;
+ MetaFrameType frame_type;
+ decor_frame_type d_frame_type;
+
+ WnckWindowType win_types[] = { WNCK_WINDOW_NORMAL, WNCK_WINDOW_DIALOG,
+ WNCK_WINDOW_MENU, WNCK_WINDOW_UTILITY,
+ WNCK_WINDOW_SPLASHSCREEN };
+
gint top_height, bottom_height, left_width, right_width;
+ unsigned int i;
theme = meta_theme_get_current ();
- meta_theme_get_frame_borders (theme,
- META_FRAME_TYPE_NORMAL,
- text_height, 0,
- &top_height,
- &bottom_height,
- &left_width,
- &right_width);
+ for (i = 0; i < 5; i++)
+ {
+ d_frame_type = get_frame_type (win_types[i]);
- _win_extents.top = _default_win_extents.top;
- _win_extents.bottom = bottom_height;
- _win_extents.left = left_width;
- _win_extents.right = right_width;
+ if (d_frame_type == DECOR_FRAME_TYPE_UNDECORATED)
+ continue;
- titlebar_height = top_height - _win_extents.top;
+ frame_type = meta_get_frame_type_for_decor_type (d_frame_type);
- meta_theme_get_frame_borders (theme,
- META_FRAME_TYPE_NORMAL,
- text_height, META_FRAME_MAXIMIZED,
- &top_height,
- &bottom_height,
- &left_width,
- &right_width);
+ meta_theme_get_frame_borders (theme,
+ frame_type,
+ text_height, 0,
+ &top_height,
+ &bottom_height,
+ &left_width,
+ &right_width);
+
+ decor_frames[d_frame_type].win_extents.top = _default_decoration.win_extents.top;
+ decor_frames[d_frame_type].win_extents.bottom = bottom_height;
+ decor_frames[d_frame_type].win_extents.left = left_width;
+ decor_frames[d_frame_type].win_extents.right = right_width;
+
+ decor_frames[d_frame_type].titlebar_height = top_height - decor_frames[d_frame_type].win_extents.top;
- _max_win_extents.top = _default_win_extents.top;
- _max_win_extents.bottom = bottom_height;
- _max_win_extents.left = left_width;
- _max_win_extents.right = right_width;
+ meta_theme_get_frame_borders (theme,
+ frame_type,
+ text_height, META_FRAME_MAXIMIZED,
+ &top_height,
+ &bottom_height,
+ &left_width,
+ &right_width);
- max_titlebar_height = top_height - _max_win_extents.top;
+ decor_frames[d_frame_type].max_win_extents.top = _default_decoration.win_extents.top;
+ decor_frames[d_frame_type].max_win_extents.bottom = bottom_height;
+ decor_frames[d_frame_type].max_win_extents.left = left_width;
+ decor_frames[d_frame_type].max_win_extents.right = right_width;
+
+ decor_frames[d_frame_type].max_titlebar_height = top_height - decor_frames[d_frame_type].max_win_extents.top;
+
+ }
}
#endif
diff --git a/gtk/window-decorator/wnck.c b/gtk/window-decorator/wnck.c
index fc5fd14..87b2c13 100644
--- a/gtk/window-decorator/wnck.c
+++ b/gtk/window-decorator/wnck.c
@@ -1,5 +1,32 @@
#include "gtk-window-decorator.h"
+decor_frame_type
+get_frame_type (WnckWindowType wnck_type)
+{
+ decor_frame_type frame_type;
+
+ switch (wnck_type)
+ {
+ case WNCK_WINDOW_NORMAL:
+ frame_type = DECOR_FRAME_TYPE_NORMAL;
+ break;
+ case WNCK_WINDOW_DIALOG:
+ frame_type = DECOR_FRAME_TYPE_DIALOG;
+ break;
+ case WNCK_WINDOW_MENU:
+ frame_type = DECOR_FRAME_TYPE_MENU;
+ break;
+ case WNCK_WINDOW_UTILITY:
+ frame_type = DECOR_FRAME_TYPE_UTILITY;
+ break;
+ default:
+ frame_type = DECOR_FRAME_TYPE_UNDECORATED;
+ break;
+ }
+
+ return frame_type;
+}
+
static void
window_name_changed (WnckWindow *win)
{