~ubuntu-branches/ubuntu/maverick/unity/maverick

« back to all changes in this revision

Viewing changes to unity-private/launcher/scrollerchild.c

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-09-17 14:02:54 UTC
  • mfrom: (1.1.17 upstream)
  • Revision ID: james.westby@ubuntu.com-20100917140254-6cbue12klia2f07l
Tags: 0.2.40-0ubuntu1
* New upstream release:
  - Fix inactive menus accessible (LP: #604505)
  - Fix some more memory leaks (LP: #604777, #621690, #628144)
  - Fix weird behaviors of quicklist (LP: #617339)
  - Provide an "open this folder" button (LP: #633201)
  - Hidden menu causing gap (LP: #600191)
  - Cannot go fullscreen for flash videos (LP: #631381)
  - Can't access menu items from the keyboard (LP: #636728)
  - Don't register for MDRAGs since they aren't used (LP: #632613)
  - Don't run indicator on special launchers (LP: #627488)
  - Center arrows position in folded launcher tiles (LP: #633084)
  - Launcher icons first appear as white upon login (LP: #601093)
  - Removes jittering when rubber band is in use on the launcher (LP: #632991)
  - Mutter restarts on closing almost any application (LP: #634701)
  - Can't launch apps like synaptic with root privileges from launch bar
    (LP: #599298)
  - Launcher tile dragging shouldn't be masked (LP: #631443)
  - Fix Carousel-ed icons have distorted perspective (LP: #607515)
  - Use no longer sync call (LP: #620011)
* update debian/libunity0.symbols

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
#include <float.h>
33
33
#include <math.h>
34
34
#include <clutk/clutk.h>
 
35
#include <unity.h>
35
36
#include <gdk-pixbuf/gdk-pixdata.h>
36
 
#include <unity.h>
37
37
#include <clutter/clutter.h>
38
38
#include <clutter-gtk/clutter-gtk.h>
39
39
 
88
88
        gboolean do_not_render;
89
89
        UnityLauncherScrollerChildController* controller;
90
90
        float grabbed_push;
 
91
        UnityUnityIcon* processed_icon;
91
92
};
92
93
 
93
94
struct _UnityLauncherScrollerChildClass {
112
113
        gboolean _enable_close_state;
113
114
        UnityLauncherScrollerChildGroupType _group_type;
114
115
        gboolean _is_dragging_state;
115
 
        UnityUnityIcon* processed_icon;
116
116
        UnityThemeImage* close_symbol;
117
117
        UnityThemeImage* active_indicator;
118
118
        UnityThemeImage* running_indicator_notify;
394
394
                g_clear_error (&_inner_error_);
395
395
                return;
396
396
        }
397
 
        self->priv->processed_icon = (_tmp6_ = g_object_ref_sink (unity_unity_icon_new (NULL, NULL)), _g_object_unref0 (self->priv->processed_icon), _tmp6_);
398
 
        clutter_actor_set_size ((ClutterActor*) self->priv->processed_icon, (float) 48, (float) 48);
399
 
        clutter_actor_set_parent ((ClutterActor*) self->priv->processed_icon, (ClutterActor*) self);
 
397
        self->processed_icon = (_tmp6_ = g_object_ref_sink (unity_unity_icon_new (NULL, NULL)), _g_object_unref0 (self->processed_icon), _tmp6_);
 
398
        clutter_actor_set_size ((ClutterActor*) self->processed_icon, (float) 48, (float) 48);
 
399
        clutter_actor_set_parent ((ClutterActor*) self->processed_icon, (ClutterActor*) self);
400
400
        g_signal_connect_object ((GObject*) self, "notify::icon", (GCallback) _unity_launcher_scroller_child_on_icon_changed_g_object_notify, self, 0);
401
401
        g_signal_connect_object ((GObject*) self, "notify::running", (GCallback) _unity_launcher_scroller_child_on_running_changed_g_object_notify, self, 0);
402
402
        g_signal_connect_object ((GObject*) self, "notify::active", (GCallback) _unity_launcher_scroller_child_on_active_changed_g_object_notify, self, 0);
495
495
        if (self->priv->_is_dragging_state) {
496
496
                return;
497
497
        }
498
 
        if (CLUTTER_IS_ANIMATION (clutter_actor_get_animation ((ClutterActor*) self->priv->processed_icon))) {
499
 
                clutter_animation_completed (clutter_actor_get_animation ((ClutterActor*) self->priv->processed_icon));
 
498
        if (CLUTTER_IS_ANIMATION (clutter_actor_get_animation ((ClutterActor*) self->processed_icon))) {
 
499
                clutter_animation_completed (clutter_actor_get_animation ((ClutterActor*) self->processed_icon));
500
500
        }
501
 
        unity_unity_icon_set_rotation (self->priv->processed_icon, degrees);
 
501
        unity_unity_icon_set_rotation (self->processed_icon, degrees);
502
502
        unity_launcher_scroller_child_set_rotation (self, degrees);
503
503
        clutter_actor_queue_redraw ((ClutterActor*) self);
504
504
}
531
531
                        break;
532
532
                }
533
533
        }
534
 
        clutter_actor_queue_redraw ((ClutterActor*) self->priv->processed_icon);
 
534
        clutter_actor_queue_redraw ((ClutterActor*) self->processed_icon);
535
535
}
536
536
 
537
537
 
556
556
        progress = 1.0f - unity_launcher_scroller_child_get_circular_alpha (progress);
557
557
        ctk_effect_set_opacity ((CtkEffect*) self->priv->effect_icon_glow, progress);
558
558
        self->priv->previous_glow_alpha = progress;
559
 
        clutter_actor_queue_redraw ((ClutterActor*) self->priv->processed_icon);
 
559
        clutter_actor_queue_redraw ((ClutterActor*) self->processed_icon);
560
560
}
561
561
 
562
562
 
600
600
                        break;
601
601
                }
602
602
        }
603
 
        clutter_actor_queue_redraw ((ClutterActor*) self->priv->processed_icon);
 
603
        clutter_actor_queue_redraw ((ClutterActor*) self->processed_icon);
604
604
}
605
605
 
606
606
 
607
607
static void unity_launcher_scroller_child_wiggle_anim_rising (UnityLauncherScrollerChild* self, float progress) {
608
608
        g_return_if_fail (self != NULL);
609
609
        progress = unity_launcher_scroller_child_get_ease_out_sine (progress);
610
 
        clutter_actor_set_rotation ((ClutterActor*) self->priv->processed_icon, CLUTTER_Z_AXIS, (double) (progress * UNITY_LAUNCHER_WIGGLE_SIZE), 25.0f, 25.0f, 0.0f);
 
610
        clutter_actor_set_rotation ((ClutterActor*) self->processed_icon, CLUTTER_Z_AXIS, (double) (progress * UNITY_LAUNCHER_WIGGLE_SIZE), 25.0f, 25.0f, 0.0f);
611
611
        self->priv->previous_wiggle_alpha = progress;
612
612
        if (progress >= 1.0) {
613
613
                self->priv->wiggle_state = UNITY_LAUNCHER_ANIM_STATE_LOOPING;
632
632
        frequency = UNITY_LAUNCHER_WIGGLE_FREQUENCY * (UNITY_LAUNCHER_WIGGLE_RUN_LENGTH / 1000);
633
633
        progress = unity_launcher_scroller_child_get_circular_alpha (fmodf (progress * frequency, 1.0f));
634
634
        progress = ((1.0f - progress) * 2.0f) - 1.0f;
635
 
        clutter_actor_set_rotation ((ClutterActor*) self->priv->processed_icon, CLUTTER_Z_AXIS, (double) (progress * UNITY_LAUNCHER_WIGGLE_SIZE), 25.0f, 25.0f, 0.0f);
636
 
        clutter_actor_queue_redraw ((ClutterActor*) self->priv->processed_icon);
 
635
        clutter_actor_set_rotation ((ClutterActor*) self->processed_icon, CLUTTER_Z_AXIS, (double) (progress * UNITY_LAUNCHER_WIGGLE_SIZE), 25.0f, 25.0f, 0.0f);
 
636
        clutter_actor_queue_redraw ((ClutterActor*) self->processed_icon);
637
637
        self->priv->previous_wiggle_alpha = progress;
638
638
}
639
639
 
671
671
        g_return_if_fail (self != NULL);
672
672
        alpha_length = self->priv->previous_wiggle_alpha;
673
673
        angle = alpha_length - (progress * alpha_length);
674
 
        clutter_actor_set_rotation ((ClutterActor*) self->priv->processed_icon, CLUTTER_Z_AXIS, (double) angle, 25.0f, 25.0f, 0.0f);
 
674
        clutter_actor_set_rotation ((ClutterActor*) self->processed_icon, CLUTTER_Z_AXIS, (double) angle, 25.0f, 25.0f, 0.0f);
675
675
        if (progress >= 1.0) {
676
676
                self->priv->wiggle_state = UNITY_LAUNCHER_ANIM_STATE_STOPPED;
677
677
                clutter_timeline_stop (self->priv->wiggle_timeline);
727
727
                pixels[3] = (guchar) 255;
728
728
                tex = _g_object_ref0 (gtk_clutter_texture_new_from_pixbuf (scaled_buf));
729
729
                color = _g_object_ref0 (gtk_clutter_texture_new_from_pixbuf (color_buf));
730
 
                self->priv->processed_icon = (_tmp6_ = g_object_ref_sink (unity_unity_icon_new ((_tmp4_ = tex, CLUTTER_IS_TEXTURE (_tmp4_) ? ((ClutterTexture*) _tmp4_) : NULL), (_tmp5_ = color, CLUTTER_IS_TEXTURE (_tmp5_) ? ((ClutterTexture*) _tmp5_) : NULL))), _g_object_unref0 (self->priv->processed_icon), _tmp6_);
731
 
                clutter_actor_set_parent ((ClutterActor*) self->priv->processed_icon, (ClutterActor*) self);
732
 
                unity_unity_icon_set_rotation (self->priv->processed_icon, self->priv->_rotation);
 
730
                self->processed_icon = (_tmp6_ = g_object_ref_sink (unity_unity_icon_new ((_tmp4_ = tex, CLUTTER_IS_TEXTURE (_tmp4_) ? ((ClutterTexture*) _tmp4_) : NULL), (_tmp5_ = color, CLUTTER_IS_TEXTURE (_tmp5_) ? ((ClutterTexture*) _tmp5_) : NULL))), _g_object_unref0 (self->processed_icon), _tmp6_);
 
731
                clutter_actor_set_parent ((ClutterActor*) self->processed_icon, (ClutterActor*) self);
 
732
                unity_unity_icon_set_rotation (self->processed_icon, self->priv->_rotation);
733
733
                self->priv->effect_drop_shadow = (_tmp7_ = g_object_ref_sink (ctk_effect_drop_shadow_new (5.0f, 0, 2)), _g_object_unref0 (self->priv->effect_drop_shadow), _tmp7_);
734
734
                ctk_effect_set_opacity ((CtkEffect*) self->priv->effect_drop_shadow, 0.4f);
735
735
                ctk_effect_set_margin ((CtkEffect*) self->priv->effect_drop_shadow, 5);
736
 
                ctk_actor_add_effect ((CtkActor*) self->priv->processed_icon, (CtkEffect*) self->priv->effect_drop_shadow);
 
736
                ctk_actor_add_effect ((CtkActor*) self->processed_icon, (CtkEffect*) self->priv->effect_drop_shadow);
 
737
                clutter_actor_set_scale ((ClutterActor*) self->processed_icon, (double) 0.0f, (double) 0.0f);
 
738
                g_object_set ((ClutterActor*) self->processed_icon, "scale-gravity", CLUTTER_GRAVITY_CENTER, NULL);
 
739
                clutter_actor_animate ((ClutterActor*) self->processed_icon, (gulong) CLUTTER_EASE_OUT_CUBIC, (guint) 300, "scale-x", 1.0, "scale-y", 1.0, NULL);
737
740
                clutter_actor_queue_redraw ((ClutterActor*) self);
738
741
                _g_object_unref0 (color);
739
742
                _g_object_unref0 (tex);
760
763
 
761
764
static void unity_launcher_scroller_child_on_active_changed (UnityLauncherScrollerChild* self) {
762
765
        guint target_opacity;
763
 
        ClutterAnimation* _tmp0_;
 
766
        gboolean _tmp0_ = FALSE;
 
767
        ClutterAnimation* _tmp1_;
764
768
        g_return_if_fail (self != NULL);
765
769
        target_opacity = (guint) 0;
766
770
        if (self->priv->_active) {
767
771
                target_opacity = (guint) 255;
 
772
        }
 
773
        if (self->priv->_active) {
 
774
                _tmp0_ = self->priv->_running;
 
775
        } else {
 
776
                _tmp0_ = FALSE;
 
777
        }
 
778
        if (_tmp0_) {
768
779
                clutter_actor_animate ((ClutterActor*) self->priv->running_indicator_notify, (gulong) CLUTTER_EASE_IN_QUAD, (guint) 150, "opacity", 0x00, NULL);
769
780
                clutter_actor_animate ((ClutterActor*) self->priv->running_indicator, (gulong) CLUTTER_EASE_IN_QUAD, (guint) 150, "opacity", 0xff, NULL);
770
781
        }
771
782
        if (CLUTTER_IS_ANIMATION (self->priv->active_indicator_anim)) {
772
783
                clutter_animation_completed (self->priv->active_indicator_anim);
773
784
        }
774
 
        self->priv->active_indicator_anim = (_tmp0_ = _g_object_ref0 (clutter_actor_animate ((ClutterActor*) self->priv->active_indicator, (gulong) CLUTTER_EASE_IN_OUT_SINE, UNITY_LAUNCHER_SHORT_DELAY, "opacity", target_opacity, NULL)), _g_object_unref0 (self->priv->active_indicator_anim), _tmp0_);
 
785
        self->priv->active_indicator_anim = (_tmp1_ = _g_object_ref0 (clutter_actor_animate ((ClutterActor*) self->priv->active_indicator, (gulong) CLUTTER_EASE_IN_OUT_SINE, UNITY_LAUNCHER_SHORT_DELAY, "opacity", target_opacity, NULL)), _g_object_unref0 (self->priv->active_indicator_anim), _tmp1_);
775
786
}
776
787
 
777
788
 
781
792
        if (self->priv->_is_dragging_state) {
782
793
                return;
783
794
        }
784
 
        self->priv->old_rotate_value = unity_unity_icon_get_rotation (self->priv->processed_icon);
785
 
        if (CLUTTER_IS_ANIMATION (clutter_actor_get_animation ((ClutterActor*) self->priv->processed_icon))) {
786
 
                clutter_animation_completed (clutter_actor_get_animation ((ClutterActor*) self->priv->processed_icon));
 
795
        self->priv->old_rotate_value = unity_unity_icon_get_rotation (self->processed_icon);
 
796
        if (CLUTTER_IS_ANIMATION (clutter_actor_get_animation ((ClutterActor*) self->processed_icon))) {
 
797
                clutter_animation_completed (clutter_actor_get_animation ((ClutterActor*) self->processed_icon));
787
798
        }
788
 
        unity_unity_icon_set_rotation (self->priv->processed_icon, self->priv->old_rotate_value);
 
799
        unity_unity_icon_set_rotation (self->processed_icon, self->priv->old_rotate_value);
789
800
        if (self->priv->_rotation <= 1.0) {
790
801
                _tmp0_ = self->priv->_rotation >= 0.0;
791
802
        } else {
792
803
                _tmp0_ = FALSE;
793
804
        }
794
805
        if (_tmp0_) {
795
 
                clutter_actor_animate ((ClutterActor*) self->priv->processed_icon, (gulong) CLUTTER_EASE_IN_OUT_QUAD, (guint) 300, "rotation", self->priv->_rotation, NULL);
 
806
                clutter_actor_animate ((ClutterActor*) self->processed_icon, (gulong) CLUTTER_EASE_IN_OUT_QUAD, (guint) 300, "rotation", self->priv->_rotation, NULL);
796
807
        } else {
797
 
                clutter_actor_animate ((ClutterActor*) self->priv->processed_icon, (gulong) CLUTTER_EASE_OUT_QUINT, (guint) 300, "rotation", self->priv->_rotation, NULL);
 
808
                clutter_actor_animate ((ClutterActor*) self->processed_icon, (gulong) CLUTTER_EASE_OUT_QUINT, (guint) 300, "rotation", self->priv->_rotation, NULL);
798
809
        }
799
810
}
800
811
 
827
838
                        c = (memset (&_tmp3_, 0, sizeof (ClutterColor)), _tmp3_.red = (guint8) 255, _tmp3_.green = (guint8) 255, _tmp3_.blue = (guint8) 255, _tmp3_.alpha = (guint8) 255, _tmp3_);
828
839
                        ctk_effect_glow_set_color (self->priv->effect_icon_glow, &c);
829
840
                        ctk_effect_set_opacity ((CtkEffect*) self->priv->effect_icon_glow, 1.0f);
830
 
                        ctk_actor_add_effect ((CtkActor*) self->priv->processed_icon, (CtkEffect*) self->priv->effect_icon_glow);
 
841
                        ctk_actor_add_effect ((CtkActor*) self->processed_icon, (CtkEffect*) self->priv->effect_icon_glow);
831
842
                        ctk_effect_set_margin ((CtkEffect*) self->priv->effect_icon_glow, 6);
832
843
                        clutter_timeline_set_duration (self->priv->glow_timeline, UNITY_LAUNCHER_SHORT_DELAY);
833
844
                        self->priv->glow_state = UNITY_LAUNCHER_ANIM_STATE_RISING;
876
887
        float nat = 0.0F;
877
888
        float min = 0.0F;
878
889
        self = (UnityLauncherScrollerChild*) base;
879
 
        clutter_actor_get_preferred_width ((ClutterActor*) self->priv->processed_icon, for_height, &min, &nat);
 
890
        clutter_actor_get_preferred_width ((ClutterActor*) self->processed_icon, for_height, &min, &nat);
880
891
        *natural_width = nat;
881
892
        *minimum_width = min;
882
893
        clutter_actor_get_preferred_width ((ClutterActor*) self->priv->running_indicator, for_height, &min, &nat);
899
910
        float x = 0.0F;
900
911
        float y = 0.0F;
901
912
        ClutterActorBox child_box = {0};
 
913
        float midpoint;
902
914
        float width = 0.0F;
903
915
        float height = 0.0F;
904
916
        float n_width = 0.0F;
908
920
        y = (float) 0;
909
921
        CLUTTER_ACTOR_CLASS (unity_launcher_scroller_child_parent_class)->allocate ((ClutterActor*) CTK_ACTOR (self), box, flags);
910
922
        memset (&child_box, 0, sizeof (ClutterActorBox));
 
923
        midpoint = (float) 0;
911
924
        clutter_actor_get_preferred_width ((ClutterActor*) self->priv->running_indicator, (float) 58, &n_width, &width);
912
925
        clutter_actor_get_preferred_height ((ClutterActor*) self->priv->running_indicator, (float) 58, &n_height, &height);
 
926
        midpoint = (self->processed_icon->stored_height - height) / 2.0f;
 
927
        if (self->priv->_rotation > 0) {
 
928
                midpoint = (clutter_actor_box_get_height (box) - midpoint) - self->processed_icon->stored_ymod;
 
929
        }
913
930
        child_box.x1 = (float) 0;
914
 
        child_box.y1 = (clutter_actor_box_get_height (box) - height) / 2.0f;
 
931
        child_box.y1 = midpoint;
915
932
        child_box.x2 = child_box.x1 + width;
916
933
        child_box.y2 = child_box.y1 + height;
917
934
        clutter_actor_allocate ((ClutterActor*) self->priv->running_indicator, &child_box, flags);
918
935
        clutter_actor_allocate ((ClutterActor*) self->priv->running_indicator_notify, &child_box, flags);
919
936
        x = x + clutter_actor_box_get_width (&child_box);
920
 
        clutter_actor_get_preferred_width ((ClutterActor*) self->priv->processed_icon, (float) 48, &width, &n_width);
921
 
        clutter_actor_get_preferred_height ((ClutterActor*) self->priv->processed_icon, (float) 48, &height, &n_height);
 
937
        clutter_actor_get_preferred_width ((ClutterActor*) self->processed_icon, (float) 48, &width, &n_width);
 
938
        clutter_actor_get_preferred_height ((ClutterActor*) self->processed_icon, (float) 48, &height, &n_height);
922
939
        child_box.x1 = self->grabbed_push + ((clutter_actor_box_get_width (box) - width) / 2.0f);
923
 
        child_box.y1 = y;
 
940
        child_box.y1 = (float) 0;
924
941
        child_box.x2 = child_box.x1 + 48;
925
942
        child_box.y2 = child_box.y1 + height;
926
 
        clutter_actor_allocate ((ClutterActor*) self->priv->processed_icon, &child_box, flags);
 
943
        clutter_actor_allocate ((ClutterActor*) self->processed_icon, &child_box, flags);
927
944
        clutter_actor_get_preferred_width ((ClutterActor*) self->priv->active_indicator, (float) 48, &n_width, &width);
928
945
        clutter_actor_get_preferred_height ((ClutterActor*) self->priv->active_indicator, (float) 48, &n_height, &height);
 
946
        midpoint = (self->processed_icon->stored_height - height) / 2.0f;
 
947
        if (self->priv->_rotation > 0) {
 
948
                midpoint = (clutter_actor_box_get_height (box) - midpoint) - self->processed_icon->stored_ymod;
 
949
        }
929
950
        child_box.x1 = clutter_actor_box_get_width (box) - width;
930
 
        child_box.y1 = (clutter_actor_box_get_height (box) - height) / 2.0f;
 
951
        child_box.y1 = midpoint;
931
952
        child_box.x2 = child_box.x1 + width;
932
953
        child_box.y2 = child_box.y1 + height;
933
954
        clutter_actor_allocate ((ClutterActor*) self->priv->active_indicator, &child_box, flags);
954
975
        clutter_actor_paint ((ClutterActor*) self->priv->active_indicator);
955
976
        clutter_actor_paint ((ClutterActor*) self->priv->running_indicator_notify);
956
977
        clutter_actor_paint ((ClutterActor*) self->priv->running_indicator);
957
 
        clutter_actor_paint ((ClutterActor*) self->priv->processed_icon);
 
978
        clutter_actor_paint ((ClutterActor*) self->processed_icon);
958
979
        clutter_actor_paint ((ClutterActor*) self->priv->close_symbol);
959
980
}
960
981
 
967
988
        clutter_actor_map ((ClutterActor*) self->priv->running_indicator);
968
989
        clutter_actor_map ((ClutterActor*) self->priv->active_indicator);
969
990
        clutter_actor_map ((ClutterActor*) self->priv->running_indicator_notify);
970
 
        clutter_actor_map ((ClutterActor*) self->priv->processed_icon);
 
991
        clutter_actor_map ((ClutterActor*) self->processed_icon);
971
992
}
972
993
 
973
994
 
979
1000
        clutter_actor_unmap ((ClutterActor*) self->priv->running_indicator);
980
1001
        clutter_actor_unmap ((ClutterActor*) self->priv->active_indicator);
981
1002
        clutter_actor_unmap ((ClutterActor*) self->priv->running_indicator_notify);
982
 
        clutter_actor_unmap ((ClutterActor*) self->priv->processed_icon);
 
1003
        clutter_actor_unmap ((ClutterActor*) self->processed_icon);
983
1004
}
984
1005
 
985
1006
 
1220
1241
        }
1221
1242
        _g_object_unref0 (self->priv->_icon);
1222
1243
        _g_object_unref0 (self->controller);
1223
 
        _g_object_unref0 (self->priv->processed_icon);
 
1244
        _g_object_unref0 (self->processed_icon);
1224
1245
        _g_object_unref0 (self->priv->close_symbol);
1225
1246
        _g_object_unref0 (self->priv->active_indicator);
1226
1247
        _g_object_unref0 (self->priv->running_indicator_notify);