diff options
| author | Neil Jagdish Patel <neil.patel@canonical.com> | 2010-09-16 23:38:51 +0100 |
|---|---|---|
| committer | Neil Jagdish Patel <neil.patel@canonical.com> | 2010-09-16 23:38:51 +0100 |
| commit | b451141f34dc675db2b1a498bb3a574d636abb7e (patch) | |
| tree | 058439d5f67d880f189671cca23df198aaf38bb3 | |
| parent | ee470811ee04d0bf2a047f6b7fac44da3cc81100 (diff) | |
| parent | 50769766bfe48c2dffd11918819869637621a4f2 (diff) | |
Merge gords launcher fixes branches
(bzr r515)
| -rw-r--r-- | unity-private/launcher/quicklist-controller.vala | 7 | ||||
| -rw-r--r-- | unity-private/launcher/quicklist-menu-item.vala | 3 | ||||
| -rw-r--r-- | unity-private/launcher/scroller-model.vala | 1 | ||||
| -rw-r--r-- | unity-private/launcher/scroller-view.vala | 91 | ||||
| -rw-r--r-- | unity-private/launcher/scrollerchild-controller.vala | 2 | ||||
| -rw-r--r-- | unity-private/launcher/scrollerchild.vala | 73 | ||||
| -rw-r--r-- | unity/icon-postprocessor.vala | 2 |
7 files changed, 131 insertions, 48 deletions
diff --git a/unity-private/launcher/quicklist-controller.vala b/unity-private/launcher/quicklist-controller.vala index a2f23de11..15ef188a7 100644 --- a/unity-private/launcher/quicklist-controller.vala +++ b/unity-private/launcher/quicklist-controller.vala @@ -161,11 +161,13 @@ namespace Unity.Launcher if (Unity.global_shell is Unity.Shell) Unity.global_shell.remove_fullscreen_request (this); - if (state == QuicklistControllerState.CLOSED) return; + if (state == QuicklistControllerState.CLOSED) + { + return; + } if (menu == null) { new_menu (); - warning ("state change called on menu when menu does not exist"); } if (state == QuicklistControllerState.LABEL) @@ -190,6 +192,7 @@ namespace Unity.Launcher menu.compute_style_textures (); menu.set_expansion_size_factor (0.0f); menu.set_anchor_position (x + w - 4, y + h/2.0f, 0); + } else if (state == QuicklistControllerState.MENU) { diff --git a/unity-private/launcher/quicklist-menu-item.vala b/unity-private/launcher/quicklist-menu-item.vala index 5f8cb6ffa..e761543c0 100644 --- a/unity-private/launcher/quicklist-menu-item.vala +++ b/unity-private/launcher/quicklist-menu-item.vala @@ -84,7 +84,8 @@ namespace Unity.Launcher last_width = new_width; last_height = new_height; - Timeout.add (0, _update_item_background); + _update_item_background (); // removed the timeout because it was causing a frame of lag + //Timeout.add (0, _update_item_background); } private bool diff --git a/unity-private/launcher/scroller-model.vala b/unity-private/launcher/scroller-model.vala index 178d4c6d8..82f36686d 100644 --- a/unity-private/launcher/scroller-model.vala +++ b/unity-private/launcher/scroller-model.vala @@ -155,7 +155,6 @@ namespace Unity.Launcher children.remove (child); child_removed (tempchild); - order_changed (); } public void insert (ScrollerChild child, int i) diff --git a/unity-private/launcher/scroller-view.vala b/unity-private/launcher/scroller-view.vala index 942babf30..89e1a6dff 100644 --- a/unity-private/launcher/scroller-view.vala +++ b/unity-private/launcher/scroller-view.vala @@ -84,6 +84,9 @@ namespace Unity.Launcher private float last_known_pointer_x = 0.0f; private bool can_scroll = false; + private float last_known_x = 0; + private float last_known_y = 0; + /* * scrolling variables */ @@ -264,6 +267,8 @@ namespace Unity.Launcher float x, y; event.get_coords (out x, out y); + last_known_x = x; + last_known_y = y; if (assume_on_launcher) x = 25; @@ -299,6 +304,7 @@ namespace Unity.Launcher { // if picked_actor is null, then we want to send a leave event on the // previous actor + Clutter.Event crossing_event = { 0 }; crossing_event.type = Clutter.EventType.LEAVE; crossing_event.crossing.x = x; @@ -325,6 +331,7 @@ namespace Unity.Launcher { get_stage ().motion_event.disconnect (on_motion_event); } + Clutter.Actor picked_actor = handle_event (event, is_scrolling); if (picked_actor is Clutter.Actor) @@ -711,6 +718,7 @@ namespace Unity.Launcher */ private void disable_animations_on_children (Clutter.Event event) { +/* disable_child_events = true; Clutter.Event e = { 0 }; @@ -729,6 +737,7 @@ namespace Unity.Launcher child.do_event (e, false); } } +*/ } @@ -795,10 +804,30 @@ namespace Unity.Launcher child.set_parent (this); // we only animate if the added child is not at the end - if (model.index_of (child) == model.size -1) - order_children (true); - else - order_children (false); + float[] prev_positions = {};//new float [model.size]; + float[] prev_rotations = {};//new float [model.size]; + + foreach (ScrollerChild modelchild in model) + { + prev_positions += modelchild.position; + prev_rotations += modelchild.rotation; + } + order_children (true); + + int index = 0; + foreach (ScrollerChild modelchild in model) + { + if (child != modelchild) + { + change_child_position_rotation (modelchild, + prev_positions[index], + prev_rotations[index], + true); + } + index++; + } + + order_children (false); queue_relayout (); child.notify["position"].connect (() => { queue_relayout (); @@ -809,17 +838,30 @@ namespace Unity.Launcher private void model_child_removed (ScrollerChild child) { - child_refs.add (child); // we need to keep a reference on it for now - var anim = child.animate (Clutter.AnimationMode.EASE_OUT_QUAD, - SHORT_DELAY, - "opacity", 0); - anim.completed.connect (() => { - child.unparent (); - child_refs.remove (child); - }); - - order_children (false); - queue_relayout (); + var drag_controller = Drag.Controller.get_default (); + if (drag_controller.is_dragging) + { + order_children (false); + queue_relayout (); + } + else + { + child_refs.add (child); // we need to keep a reference on it for now + var anim = child.animate (Clutter.AnimationMode.EASE_OUT_QUAD, + SHORT_DELAY, + "opacity", 0); + + var icon_scale_anim = child.processed_icon.animate (Clutter.AnimationMode.EASE_OUT_QUAD, + SHORT_DELAY, + "scale-x", 0.0, + "scale-y", 0.0); + anim.completed.connect (() => { + child.unparent (); + child_refs.remove (child); + order_children (false); + queue_relayout (); + }); + } } private void model_order_changed () @@ -839,6 +881,15 @@ namespace Unity.Launcher speed *= autoscroll_direction; move_scroll_position (speed, true); autoscroll_anim_active = is_autoscrolling; + + Clutter.Event motion_event = { 0 }; + motion_event.type = Clutter.EventType.MOTION; + motion_event.motion.x = last_known_x; + motion_event.motion.y = last_known_y; + motion_event.motion.stage = get_stage () as Clutter.Stage; + motion_event.motion.flags = Clutter.EventFlags.FLAG_SYNTHETIC; + passthrough_motion_event (motion_event); + return is_autoscrolling; }); } @@ -1166,6 +1217,14 @@ namespace Unity.Launcher else cache.invalidate_texture_cache (); + Clutter.Event motion_event = { 0 }; + motion_event.type = Clutter.EventType.MOTION; + motion_event.motion.x = last_known_x; + motion_event.motion.y = last_known_y; + motion_event.motion.stage = get_stage () as Clutter.Stage; + motion_event.motion.flags = Clutter.EventFlags.FLAG_SYNTHETIC; + passthrough_motion_event (motion_event); + stored_delta = delta; } @@ -1476,7 +1535,7 @@ namespace Unity.Launcher if (index >= index_start_flat && index < index_end_flat) { change_child_position_rotation (child, h, 0.0f, immediate); - h += nat_height + spacing; + h += 48 + spacing; num_children_handled++; if (index == index_start_flat) diff --git a/unity-private/launcher/scrollerchild-controller.vala b/unity-private/launcher/scrollerchild-controller.vala index f43c1f748..803d0c4f2 100644 --- a/unity-private/launcher/scrollerchild-controller.vala +++ b/unity-private/launcher/scrollerchild-controller.vala @@ -59,7 +59,7 @@ namespace Unity.Launcher construct { theme_file_path = new Unity.ThemeFilePath (); - name = "Bug Found, You Defeated Unity, +20 exp"; + name = "Bug Found, You Defeated Unity, +20,000 exp"; child.controller = this; child.button_press_event.connect (on_press_event); child.button_release_event.connect (on_release_event); diff --git a/unity-private/launcher/scrollerchild.vala b/unity-private/launcher/scrollerchild.vala index 8278c64ad..41a8613d3 100644 --- a/unity-private/launcher/scrollerchild.vala +++ b/unity-private/launcher/scrollerchild.vala @@ -85,7 +85,7 @@ namespace Unity.Launcher opacity); } - private UnityIcon processed_icon; + public UnityIcon processed_icon; private ThemeImage close_symbol; private ThemeImage active_indicator; private ThemeImage running_indicator_notify; @@ -221,27 +221,27 @@ namespace Unity.Launcher } } - private bool previous_close_state = false; - private void on_enable_close_state_changed () - { - if (enable_close_state == true && previous_close_state == false) - { - close_symbol.animate (Clutter.AnimationMode.EASE_OUT_CUBIC, - 300, - "opacity", 0xff, - "scale-x", 1.0, - "scale-y", 1.0); - } - else if (enable_close_state == false && previous_close_state == true) - { - close_symbol.animate (Clutter.AnimationMode.EASE_OUT_CUBIC, - 300, - "opacity", 0x00, - "scale-x", 0.0, - "scale-y", 0.0); - } - previous_close_state = enable_close_state; - } + private bool previous_close_state = false; + private void on_enable_close_state_changed () + { + if (enable_close_state == true && previous_close_state == false) + { + close_symbol.animate (Clutter.AnimationMode.EASE_OUT_CUBIC, + 300, + "opacity", 0xff, + "scale-x", 1.0, + "scale-y", 1.0); + } + else if (enable_close_state == false && previous_close_state == true) + { + close_symbol.animate (Clutter.AnimationMode.EASE_OUT_CUBIC, + 300, + "opacity", 0x00, + "scale-x", 0.0, + "scale-y", 0.0); + } + previous_close_state = enable_close_state; + } /* alpha helpers */ private static float get_ease_out_sine (float alpha) @@ -465,7 +465,12 @@ namespace Unity.Launcher effect_drop_shadow.set_opacity (0.4f); this.effect_drop_shadow.set_margin (5); this.processed_icon.add_effect (effect_drop_shadow); - + this.processed_icon.set_scale (0.0f, 0.0f); + this.processed_icon.scale_gravity = Clutter.Gravity.CENTER; + this.processed_icon.animate (Clutter.AnimationMode.EASE_OUT_CUBIC, + 300, + "scale-x", 1.0, + "scale-y", 1.0); do_queue_redraw (); } } @@ -488,8 +493,10 @@ namespace Unity.Launcher { uint target_opacity = 0; if (active) + target_opacity = 255; + + if (active && running) { - target_opacity = 255; running_indicator_notify.animate (Clutter.AnimationMode.EASE_IN_QUAD, 150, "opacity", 0x00); @@ -620,12 +627,20 @@ namespace Unity.Launcher Clutter.ActorBox child_box = Clutter.ActorBox (); + // if we are rotated negatively, we need to work 'backwards' + float midpoint = 0; + //allocate the running indicator first float width, height, n_width, n_height; running_indicator.get_preferred_width (58, out n_width, out width); running_indicator.get_preferred_height (58, out n_height, out height); + midpoint = (processed_icon.stored_height - height) / 2.0f; + if (rotation > 0) + midpoint = box.get_height () - midpoint - processed_icon.stored_ymod; + child_box.x1 = 0; - child_box.y1 = (box.get_height () - height) / 2.0f; + child_box.y1 = midpoint; + //child_box.y1 = (box.get_height () - height) / 2.0f; child_box.x2 = child_box.x1 + width; child_box.y2 = child_box.y1 + height; running_indicator.allocate (child_box, flags); @@ -636,7 +651,7 @@ namespace Unity.Launcher processed_icon.get_preferred_width (48, out width, out n_width); processed_icon.get_preferred_height (48, out height, out n_height); child_box.x1 = grabbed_push + (box.get_width () - width) / 2.0f; - child_box.y1 = y; + child_box.y1 = 0; child_box.x2 = child_box.x1 + 48; child_box.y2 = child_box.y1 + height; processed_icon.allocate (child_box, flags); @@ -644,8 +659,12 @@ namespace Unity.Launcher //allocate the active indicator active_indicator.get_preferred_width (48, out n_width, out width); active_indicator.get_preferred_height (48, out n_height, out height); + midpoint = (processed_icon.stored_height - height) / 2.0f; + if (rotation > 0) + midpoint = box.get_height () - midpoint - processed_icon.stored_ymod; + child_box.x1 = box.get_width () - width; - child_box.y1 = (box.get_height () - height) / 2.0f; + child_box.y1 = midpoint; child_box.x2 = child_box.x1 + width; child_box.y2 = child_box.y1 + height; active_indicator.allocate (child_box, flags); diff --git a/unity/icon-postprocessor.vala b/unity/icon-postprocessor.vala index 2d211c1c5..f4c21f58d 100644 --- a/unity/icon-postprocessor.vala +++ b/unity/icon-postprocessor.vala @@ -391,6 +391,8 @@ namespace Unity public static void paint_real (Clutter.Actor actor) { UnityIcon self = actor as UnityIcon; + if (self.icon is Clutter.Texture == false) + return; float p1_x, p1_y; float p2_x, p2_y; float p3_x, p3_y; |
