IconGroup: Refactor the canvas resize logic

Move the code to resize the IconGroup canvas to a funtion to be able to
reuse it.

Refactor, no functional changes.
This commit is contained in:
José Expósito 2021-06-04 17:37:28 +02:00 committed by Daniel Foré
parent dce79fdf2e
commit ab351ea321

View File

@ -96,17 +96,12 @@ namespace Gala {
}
construct {
var scale = InternalUtils.get_ui_scaling_factor ();
var size = SIZE * scale;
width = size;
height = size;
reactive = true;
var canvas = new Canvas ();
canvas.set_size (size, size);
canvas.draw.connect (draw);
content = canvas;
resize_canvas ();
dummy_material = new Cogl.Material ();
@ -202,6 +197,16 @@ namespace Gala {
close_button.visible = false;
}
bool resize_canvas () {
var scale = InternalUtils.get_ui_scaling_factor ();
var size = SIZE * scale;
width = size;
height = size;
return ((Canvas) content).set_size (size, size);
}
/**
* Override the paint handler to draw our backdrop if necessary
*/