Fixed workspace switch crash

This commit is contained in:
Tom Beckmann 2012-05-29 01:15:49 +02:00
parent ac7ff6f594
commit 783656288f
4 changed files with 78 additions and 51 deletions

View File

@ -41,9 +41,9 @@ ensure_vala_version("0.16.0" MINIMUM)
include(ValaPrecompile)
vala_precompile(VALA_C
src/main.vala
src/gala.vala
src/gala-plugin.vala
src/main.vala
src/Widgets/WorkspaceSwitcher.vala
src/Widgets/WindowSwitcher.vala
${CMAKE_BINARY_DIR}/src/Config.vala
@ -51,6 +51,7 @@ PACKAGES
granite
libmutter
clutter-gtk-1.0
gdk-x11-3.0
OPTIONS
--vapidir=${CMAKE_CURRENT_SOURCE_DIR}/vapi/
)

View File

@ -11,6 +11,7 @@ namespace Gala {
}
public override void start () {
this.get_screen ();
this.elements = Meta.get_stage_for_screen (this.get_screen ());
Meta.get_window_group_for_screen (this.get_screen ()).reparent (elements);
@ -101,6 +102,8 @@ namespace Gala {
case Meta.WindowType.MENU:
case Meta.WindowType.DROPDOWN_MENU:
case Meta.WindowType.POPUP_MENU:
case Meta.WindowType.MODAL_DIALOG:
case Meta.WindowType.DIALOG:
actor.scale_gravity = Clutter.Gravity.NORTH;
actor.scale_x = 1.0f;
actor.scale_y = 0.0f;
@ -130,6 +133,8 @@ namespace Gala {
case Meta.WindowType.MENU:
case Meta.WindowType.DROPDOWN_MENU:
case Meta.WindowType.POPUP_MENU:
case Meta.WindowType.MODAL_DIALOG:
case Meta.WindowType.DIALOG:
actor.scale_gravity = Clutter.Gravity.NORTH;
actor.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 200,
scale_y:0.0f, opacity:0).completed.connect ( () => {
@ -141,6 +146,12 @@ namespace Gala {
break;
}
}
private GLib.List<Clutter.Actor> win;
private GLib.List<Clutter.Actor> par; //class space for kill func
private Clutter.Group in_group;
private Clutter.Group out_group;
public override void switch_workspace (int from, int to, Meta.MotionDirection direction) {
unowned List<Clutter.Actor> windows = Meta.get_window_actors (this.get_screen ());
//FIXME js/ui/windowManager.js line 430
@ -172,8 +183,8 @@ namespace Gala {
group.add_actor (in_group);
group.add_actor (out_group);
var win = new List<Clutter.Actor> ();
var par = new List<Clutter.Actor> ();
win = new List<Clutter.Actor> ();
par = new List<Clutter.Actor> ();
for (var i=0;i<windows.length ();i++) {
var window = windows.nth_data (i);
@ -192,10 +203,19 @@ namespace Gala {
in_group.set_position (-x2, -y2);
in_group.raise_top ();
out_group.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 200,
out_group.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 250,
x:x2, y:y2);
in_group.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 200,
in_group.animate (Clutter.AnimationMode.EASE_OUT_QUAD, 250,
x:0.0f, y:0.0f).completed.connect ( () => {
end_switch_workspace ();
});
}
public override void kill_window_effects (Meta.WindowActor actor){
}
private void end_switch_workspace () {
if (win == null || par == null)
return;
for (var i=0;i<win.length ();i++) {
var window = win.nth_data (i);
@ -207,27 +227,32 @@ namespace Gala {
} else
window.reparent (par.nth_data (i));
}
win = null;
par = null;
if (in_group != null) {
in_group.detach_animation ();
in_group.destroy ();
}
if (out_group != null) {
out_group.detach_animation ();
out_group.destroy ();
}
this.switch_workspace_completed ();
});
}
public override void kill_window_effects (Meta.WindowActor actor){
}
public override void kill_switch_workspace () {
end_switch_workspace ();
}
public override bool xevent_filter (X.Event event) {
/*if (event.xkey.keycode == Clutter.Key.Alt_L ||
if (event.xkey.keycode == Clutter.Key.Alt_L ||
event.xkey.keycode == Clutter.Key.Alt_R) {
if (winswitcher.visible)
winswitcher.visible = false;
if (wswitcher.visible)
wswitcher.visible = false;
}*/
}
return x_handle_event (event) != 0;
}

View File

@ -1,3 +1,4 @@
[CCode (cname="clutter_x11_handle_event")]
public extern int x_handle_event (X.Event xevent);
[CCode (cname="clutter_x11_get_stage_window")]

View File

@ -306,7 +306,7 @@ namespace Meta {
public void map_completed (WindowActor actor);
public void destroy_completed (WindowActor actor);
public Screen get_screen ();
public unowned Screen get_screen ();
public void begin_modal (X.Window grab_window, Cursor cursor, ModalOptions options,
uint32 timestamp);
public void end_modal (uint32 timestamp);