Removed deprecation warnings.

This commit is contained in:
Corentin Noël 2015-10-18 23:56:40 +02:00
parent c7bc6df28f
commit 28b34f62c4

View File

@ -89,16 +89,24 @@ namespace Gala.Plugins.Zoom
float mx, my;
var client_pointer = Gdk.Display.get_default ().get_device_manager ().get_client_pointer ();
client_pointer.get_position (null, out mx, out my);
wins.scale_center_x = mx;
wins.scale_center_y = my;
var pivot = wins.pivot_point;
pivot.x = mx/wins.width;
pivot.y = my/wins.height;
wins.pivot_point = pivot;
mouse_poll_timer = Timeout.add (MOUSE_POLL_TIME, () => {
client_pointer.get_position (null, out mx, out my);
if (wins.scale_center_x == mx && wins.scale_center_y == my)
if (wins.pivot_point.x == mx/wins.width && wins.pivot_point.y == my/wins.height)
return true;
wins.animate (Clutter.AnimationMode.LINEAR, MOUSE_POLL_TIME, scale_center_x : mx, scale_center_y : my);
wins.save_easing_state ();
wins.set_easing_mode (Clutter.AnimationMode.LINEAR);
wins.set_easing_duration (MOUSE_POLL_TIME);
pivot = wins.pivot_point;
pivot.x = mx/wins.width;
pivot.y = my/wins.height;
wins.pivot_point = pivot;
wins.restore_easing_state ();
return true;
});
}
@ -111,16 +119,30 @@ namespace Gala.Plugins.Zoom
if (mouse_poll_timer > 0)
Source.remove (mouse_poll_timer);
mouse_poll_timer = 0;
wins.animate (Clutter.AnimationMode.EASE_OUT_CUBIC, 300, scale_x : 1.0f, scale_y : 1.0f).completed.connect (() => {
wins.scale_center_x = 0.0f;
wins.scale_center_y = 0.0f;
wins.save_easing_state ();
wins.set_easing_mode (Clutter.AnimationMode.EASE_OUT_CUBIC);
wins.set_easing_duration (300);
wins.scale_x = 1.0f;
wins.scale_y = 1.0f;
wins.restore_easing_state ();
ulong sid = 0;
sid = wins.transitions_completed.connect (() => {
wins.disconnect (sid);
var pivot = wins.pivot_point;
pivot.x = 0.0f;
pivot.y = 0.0f;
wins.pivot_point = pivot;
});
return;
}
wins.animate (Clutter.AnimationMode.EASE_OUT_CUBIC, 300, scale_x : current_zoom, scale_y : current_zoom);
wins.save_easing_state ();
wins.set_easing_mode (Clutter.AnimationMode.EASE_OUT_CUBIC);
wins.set_easing_duration (300);
wins.scale_x = current_zoom;
wins.scale_y = current_zoom;
wins.restore_easing_state ();
}
}
}