Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions src/ui/theme.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,10 @@ meta_frame_layout_draw_with_style (MetaFrameLayout *layout,
icon_name = "window-minimize-symbolic";
break;
case META_BUTTON_TYPE_MENU:
icon_name = "open-menu-symbolic";
if (mini_icon)
surface = cairo_surface_reference (mini_icon);
else
icon_name = "open-menu-symbolic";
break;
default:
icon_name = NULL;
Expand Down Expand Up @@ -903,11 +906,21 @@ meta_frame_layout_draw_with_style (MetaFrameLayout *layout,

if (surface)
{
double x, y;
x = button_rect.x + (button_rect.width - layout->icon_size) / 2.0;
y = button_rect.y + (button_rect.height - layout->icon_size) / 2.0;
float width, height;
int x, y;

width = cairo_image_surface_get_width (surface) / scale;
height = cairo_image_surface_get_height (surface) / scale;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only thought about this because I ran into different surface types somewhere else...

mini_icon can potentially be a cairo_xlib_surface (though it's very unlikely), but we should probably use cairo_surface_get_type() and use the the correct get_width/get_height functions.

See https://github.com/linuxmint/muffin/blob/master/src/x11/iconcache.c#L340-L365 (if !mask)

x = button_rect.x + (button_rect.width - layout->icon_size) / 2;
y = button_rect.y + (button_rect.height - layout->icon_size) / 2;

cairo_translate (cr, x, y);
cairo_scale (cr,
layout->icon_size / width,
layout->icon_size / height);
cairo_set_source_surface (cr, surface, 0, 0);
cairo_paint (cr);

gtk_render_icon_surface (style, cr, surface, x, y);
cairo_surface_destroy (surface);
}
}
Expand Down
Loading