mirror of
https://github.com/elementary/gala.git
synced 2024-11-25 03:06:14 +01:00
Fix crash on old vala version
This commit is contained in:
parent
87c6a2f873
commit
b362f1a9f1
@ -4,10 +4,18 @@
|
||||
*/
|
||||
|
||||
public class Gala.CanvasActor : Clutter.Actor {
|
||||
#if HAS_MUTTER46
|
||||
private Gala.Drawing.Canvas canvas;
|
||||
#else
|
||||
private Clutter.Canvas canvas;
|
||||
#endif
|
||||
|
||||
construct {
|
||||
#if HAS_MUTTER46
|
||||
canvas = new Gala.Drawing.Canvas ();
|
||||
#else
|
||||
canvas = new Clutter.Canvas ();
|
||||
#endif
|
||||
content = canvas;
|
||||
canvas.draw.connect ((ctx, width, height) => {
|
||||
draw (ctx, width, height);
|
||||
|
@ -120,44 +120,4 @@ public class Gala.Drawing.Canvas : GLib.Object, Clutter.Content {
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
public class Gala.Drawing.Canvas : GLib.Object, Clutter.Content {
|
||||
public Clutter.Canvas canvas;
|
||||
|
||||
construct {
|
||||
canvas = new Clutter.Canvas ();
|
||||
canvas.draw.connect (on_draw);
|
||||
}
|
||||
|
||||
public signal void draw (Cairo.Context cr, int width, int height);
|
||||
|
||||
public bool get_preferred_size (out float out_width, out float out_height) {
|
||||
return canvas.get_preferred_size (out out_width, out out_height);
|
||||
}
|
||||
|
||||
public void invalidate () {
|
||||
canvas.invalidate ();
|
||||
}
|
||||
|
||||
public void invalidate_size () {
|
||||
canvas.invalidate_size ();
|
||||
}
|
||||
|
||||
public void paint_content (Clutter.Actor actor, Clutter.PaintNode root, Clutter.PaintContext paint_context) {
|
||||
canvas.paint_content (actor, root, paint_context);
|
||||
}
|
||||
|
||||
public void set_size (int new_width, int new_height) requires (new_width >= -1 && new_height >= -1) {
|
||||
canvas.set_size (new_width, new_height);
|
||||
}
|
||||
|
||||
public void set_scale_factor (float new_scale_factor) requires (new_scale_factor > 0.0f) {
|
||||
canvas.set_scale_factor (new_scale_factor);
|
||||
}
|
||||
|
||||
private bool on_draw (Cairo.Context cr, int width, int height) {
|
||||
draw (cr, width, height);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user