diff options
| author | Didier Roche <didier.roche@canonical.com> | 2010-06-17 17:32:19 +0200 |
|---|---|---|
| committer | Didier Roche <didier.roche@canonical.com> | 2010-06-17 17:32:19 +0200 |
| commit | c738291c5fb7a0d0991ec5e82ad0cead74617d1f (patch) | |
| tree | 58437defcdfdc57fa93ae07f3f3032dc7836f36a | |
| parent | 164f0749182b27c0e23bb1f499a90f5e33e70311 (diff) | |
| parent | 4d643fbdd30966cd57a5e9d025a67e60a2c0e5ce (diff) | |
Import upstream version 0.2.10upstream-0.2.10
(bzr r55.4.12)
54 files changed, 1951 insertions, 311 deletions
@@ -1,5 +1,109 @@ # Generated by Makefile. Do not edit. +2010-06-17 Mirco Müller <mirco.mueller@ubuntu.com> + + fixed segfault in on_leave for quicklists, removed superfluous calls to queue-redraw + +2010-06-17 Gord Allott <gord.allott@canonical.com> + + enables quicklists + +2010-06-17 Gord Allott <gord.allott@canonical.com> + + re-enable quicklists + +2010-06-17 Gord Allott <gord.allott@canonical.com> + + fixes issue with going into contracted state when not enough launchers + +2010-06-17 Gord Allott <gord.allott@canonical.com> + + quicklists enabled + +2010-06-16 Gord Allott <gord.allott@canonical.com> + + Adds the new contracted launcher behaviour + Also fixes a few bugs + cogl vapi file updated to fix a vapi bug + had to modify mail.c to make the launcher's grabbale size to be one pixel bigger + + modified: + targets/mutter/main.c + tests/unit/test-launcher.vala + unity-private/launcher/launcher-child.vala + unity-private/launcher/scroller-model.vala + unity-private/launcher/scroller-view.vala + unity-private/launcher/scrollerchild-controller.vala + unity-private/launcher/scrollerchild.vala + +2010-06-16 Gord Allott <gord.allott@canonical.com> + + make the tests compile again + +2010-06-16 Gord Allott <gord.allott@canonical.com> + + fixed cogl warnings + +2010-06-16 Gord Allott <gord.allott@canonical.com> + + make sure to grab the pointer so that mutter works correctly + +2010-06-16 Gord Allott <gord.allott@canonical.com> + + fixed dragging + +2010-06-16 Gord Allott <gord.allott@canonical.com> + + fixed dragging + +2010-06-16 Gord Allott <gord.allott@canonical.com> + + finally fixed projection matrix for icons woo! thanks jay + +2010-06-16 Gord Allott <gord.allott@canonical.com> + + latest code + +2010-06-16 Gord Allott <gord.allott@canonical.com> + + latest code + +2010-06-16 Gord Allott <gord.allott@canonical.com> + + latest code + +2010-06-16 Gord Allott <gord.allott@canonical.com> + + new stuff + +2010-06-16 Gord Allott <gord.allott@canonical.com> + + latest launcher code + +2010-06-09 Gord Allott <gord.allott@canonical.com> + + latest unity + +2010-06-14 Jason Smith <jason@hakimaki> + + merge remove background branch + +2010-06-11 Jason Smith <jason@hakimaki> + + remove background object as it is complete unused + +2010-06-11 Jason Smith <jason@hakimaki> + + merge meta-fullscreen-detection branch + +2010-06-10 Jason Smith <jason@hakimaki> + + make fullscreen detection work properly using metacity calls + +2010-06-10 Neil Jagdish Patel <neil.patel@canonical.com> + + New devel release + 2010-06-10 Neil Jagdish Patel <neil.patel@canonical.com> [release] 0.2.8 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.65 for unity 0.2.8. +# Generated by GNU Autoconf 2.65 for unity 0.2.10. # # Report bugs to <https://launchpad.net/unity>. # @@ -763,8 +763,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='unity' PACKAGE_TARNAME='unity' -PACKAGE_VERSION='0.2.8' -PACKAGE_STRING='unity 0.2.8' +PACKAGE_VERSION='0.2.10' +PACKAGE_STRING='unity 0.2.10' PACKAGE_BUGREPORT='https://launchpad.net/unity' PACKAGE_URL='' @@ -1573,7 +1573,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures unity 0.2.8 to adapt to many kinds of systems. +\`configure' configures unity 0.2.10 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1643,7 +1643,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of unity 0.2.8:";; + short | recursive ) echo "Configuration of unity 0.2.10:";; esac cat <<\_ACEOF @@ -1776,7 +1776,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -unity configure 0.2.8 +unity configure 0.2.10 generated by GNU Autoconf 2.65 Copyright (C) 2009 Free Software Foundation, Inc. @@ -2056,7 +2056,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by unity $as_me 0.2.8, which was +It was created by unity $as_me 0.2.10, which was generated by GNU Autoconf 2.65. Invocation command line was $ $0 $@ @@ -2883,7 +2883,7 @@ fi # Define the identity of the package. PACKAGE=unity - VERSION=0.2.8 + VERSION=0.2.10 cat >>confdefs.h <<_ACEOF @@ -2926,8 +2926,8 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' DL_MAJOR_VERSION=0 DL_MINOR_VERSION=2 -DL_MICRO_VERSION=8 -DL_VERSION=0.2.8 +DL_MICRO_VERSION=10 +DL_VERSION=0.2.10 @@ -14461,7 +14461,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by unity $as_me 0.2.8, which was +This file was extended by unity $as_me 0.2.10, which was generated by GNU Autoconf 2.65. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14527,7 +14527,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -unity config.status 0.2.8 +unity config.status 0.2.10 configured by $0, generated by GNU Autoconf 2.65, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 5f4d304af..dc0aab779 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ m4_define([unity_major], [0]) m4_define([unity_minor], [2]) -m4_define([unity_micro], [8]) +m4_define([unity_micro], [10]) m4_define([unity_api], [unity_major.unity_minor]) diff --git a/targets/mutter/expose-manager.c b/targets/mutter/expose-manager.c index 10c61f2fe..74ddf23ff 100644 --- a/targets/mutter/expose-manager.c +++ b/targets/mutter/expose-manager.c @@ -339,12 +339,16 @@ void unity_expose_clone_set_darken (UnityExposeClone* self, guint8 value) { static gboolean _unity_expose_clone_on_mouse_enter_clutter_actor_enter_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_expose_clone_on_mouse_enter (self, event); + gboolean result; + result = unity_expose_clone_on_mouse_enter (self, event); + return result; } static gboolean _unity_expose_clone_on_mouse_leave_clutter_actor_leave_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_expose_clone_on_mouse_leave (self, event); + gboolean result; + result = unity_expose_clone_on_mouse_leave (self, event); + return result; } @@ -510,7 +514,9 @@ static gboolean _lambda4_ (UnityExposeManager* self) { static gboolean __lambda4__clutter_actor_enter_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return _lambda4_ (self); + gboolean result; + result = _lambda4_ (self); + return result; } @@ -534,12 +540,16 @@ static gboolean _lambda5_ (UnityExposeManager* self) { static gboolean __lambda5__clutter_actor_leave_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return _lambda5_ (self); + gboolean result; + result = _lambda5_ (self); + return result; } static gboolean _unity_expose_manager_on_stage_captured_event_clutter_actor_captured_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_expose_manager_on_stage_captured_event (self, event); + gboolean result; + result = unity_expose_manager_on_stage_captured_event (self, event); + return result; } diff --git a/targets/mutter/main.c b/targets/mutter/main.c index 12da45ee1..aa7e0535c 100644 --- a/targets/mutter/main.c +++ b/targets/mutter/main.c @@ -180,7 +180,7 @@ on_restore_input_region (UnityPlugin *plugin, gboolean fullscreen) /* Launcher */ rects[1].x = 0; rects[1].y = rects[0].height; - rects[1].width = unity_plugin_get_launcher_width (plugin); + rects[1].width = unity_plugin_get_launcher_width (plugin) + 1; rects[1].height = height - rects[0].height; /* Update region */ diff --git a/targets/mutter/plugin.c b/targets/mutter/plugin.c index 1cad1dc44..416e49da6 100644 --- a/targets/mutter/plugin.c +++ b/targets/mutter/plugin.c @@ -157,7 +157,6 @@ struct _UnityPluginPrivate { UnityApplication* app; UnityWindowManagement* wm; UnityMaximus* maximus; - UnityTestingBackground* background; UnityExposeManager* expose_manager; UnityLauncherLauncher* launcher; UnityPlacesController* places_controller; @@ -165,6 +164,8 @@ struct _UnityPluginPrivate { UnityPanelView* panel; UnityActorBlur* actor_blur; ClutterRectangle* dark_box; + MetaWindow* focus_window; + MetaDisplay* display; gboolean places_enabled; UnityDragDest* drag_dest; gboolean places_showing; @@ -174,7 +175,6 @@ struct _UnityPluginPrivate { gboolean grab_enabled; DBusGConnection* screensaver_conn; DBusGProxy* screensaver; - MutterWindow* active_window; }; @@ -240,9 +240,12 @@ static void _unity_plugin_relayout_g_object_notify (GObject* _sender, GParamSpec static gboolean _lambda2_ (UnityPlugin* self); static gboolean __lambda2__gsource_func (gpointer self); static gboolean unity_plugin_real_construct (UnityPlugin* self); +static void unity_plugin_check_fullscreen_obstruction (UnityPlugin* self); +static void unity_plugin_on_focus_window_fullscreen_changed (UnityPlugin* self); +static void _unity_plugin_on_focus_window_fullscreen_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); +static void unity_plugin_on_focus_window_changed (UnityPlugin* self); static void unity_plugin_set_fullscreen_obstruction (UnityPlugin* self, gboolean value); static void unity_plugin_got_screensaver_changed (UnityPlugin* self, DBusGProxy* screensaver, gboolean changed); -static void unity_plugin_check_fullscreen_obstruction (UnityPlugin* self); static void unity_plugin_real_add_fullscreen_request (UnityShell* base, GObject* o); static gboolean unity_plugin_real_remove_fullscreen_request (UnityShell* base, GObject* o); static gboolean unity_plugin_get_fullscreen_obstruction (UnityPlugin* self); @@ -268,6 +271,7 @@ void unity_plugin_minimize (UnityPlugin* self, MutterWindow* window); void unity_plugin_maximize (UnityPlugin* self, MutterWindow* window, gint x, gint y, gint width, gint height); void unity_plugin_unmaximize (UnityPlugin* self, MutterWindow* window, gint x, gint y, gint width, gint height); gboolean unity_maximus_process_window (UnityMaximus* self, MutterWindow* window); +static void _unity_plugin_on_focus_window_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); void unity_plugin_map (UnityPlugin* self, MutterWindow* window); void unity_plugin_destroy (UnityPlugin* self, MutterWindow* window); void unity_plugin_switch_workspace (UnityPlugin* self, GList* windows, gint from, gint to, gint direction); @@ -461,7 +465,9 @@ static gboolean _lambda2_ (UnityPlugin* self) { static gboolean __lambda2__gsource_func (gpointer self) { - return _lambda2_ (self); + gboolean result; + result = _lambda2_ (self); + return result; } @@ -484,15 +490,14 @@ static gboolean unity_plugin_real_construct (UnityPlugin* self) { GtkTargetEntry _tmp10_ = {0}; GtkTargetEntry* target_list; ClutterGroup* window_group; - UnityTestingBackground* _tmp13_; - UnityLauncherLauncher* _tmp14_; - ClutterActor* _tmp15_; - UnityExposeManager* _tmp16_; + UnityLauncherLauncher* _tmp13_; + ClutterActor* _tmp14_; + UnityExposeManager* _tmp15_; + ClutterActor* _tmp16_; ClutterActor* _tmp17_; ClutterActor* _tmp18_; - ClutterActor* _tmp19_; - UnityPanelView* _tmp23_; - ClutterActor* _tmp24_; + UnityPanelView* _tmp22_; + ClutterActor* _tmp23_; g_return_val_if_fail (self != NULL, FALSE); START_FUNCTION (); self->priv->wm = (_tmp0_ = unity_window_management_new (self), _g_object_unref0 (self->priv->wm), _tmp0_); @@ -507,44 +512,40 @@ static gboolean unity_plugin_real_construct (UnityPlugin* self) { ctk_dnd_init (GTK_WIDGET (self->priv->drag_dest), target_list, target_list_length1); self->priv->places_enabled = unity_plugin_envvar_is_enabled (self, "UNITY_ENABLE_PLACES"); window_group = _g_object_ref0 (CLUTTER_GROUP (mutter_plugin_get_window_group (unity_plugin_get_plugin (self)))); - self->priv->background = (_tmp13_ = g_object_ref_sink (unity_testing_background_new ()), _g_object_unref0 (self->priv->background), _tmp13_); - clutter_container_add_actor ((ClutterContainer*) self->priv->stage, (ClutterActor*) self->priv->background); - clutter_actor_lower_bottom ((ClutterActor*) self->priv->background); - clutter_actor_show ((ClutterActor*) self->priv->background); - self->priv->launcher = (_tmp14_ = unity_launcher_launcher_new ((UnityShell*) self), _g_object_unref0 (self->priv->launcher), _tmp14_); - clutter_actor_set_opacity (_tmp15_ = unity_launcher_launcher_get_view (self->priv->launcher), (guint8) 0); - _g_object_unref0 (_tmp15_); - self->priv->expose_manager = (_tmp16_ = unity_expose_manager_new (self, self->priv->launcher), _g_object_unref0 (self->priv->expose_manager), _tmp16_); + self->priv->launcher = (_tmp13_ = unity_launcher_launcher_new ((UnityShell*) self), _g_object_unref0 (self->priv->launcher), _tmp13_); + clutter_actor_set_opacity (_tmp14_ = unity_launcher_launcher_get_view (self->priv->launcher), (guint8) 0); + _g_object_unref0 (_tmp14_); + self->priv->expose_manager = (_tmp15_ = unity_expose_manager_new (self, self->priv->launcher), _g_object_unref0 (self->priv->expose_manager), _tmp15_); unity_expose_manager_set_hovered_opacity (self->priv->expose_manager, (guint8) 255); unity_expose_manager_set_unhovered_opacity (self->priv->expose_manager, (guint8) 255); unity_expose_manager_set_darken (self->priv->expose_manager, (guint8) 25); unity_expose_manager_set_right_buffer (self->priv->expose_manager, 10); unity_expose_manager_set_top_buffer (self->priv->expose_manager, (unity_expose_manager_set_bottom_buffer (self->priv->expose_manager, 20), unity_expose_manager_get_bottom_buffer (self->priv->expose_manager))); unity_expose_manager_set_coverflow (self->priv->expose_manager, FALSE); - clutter_container_add_actor ((ClutterContainer*) window_group, _tmp17_ = unity_launcher_launcher_get_view (self->priv->launcher)); + clutter_container_add_actor ((ClutterContainer*) window_group, _tmp16_ = unity_launcher_launcher_get_view (self->priv->launcher)); + _g_object_unref0 (_tmp16_); + clutter_container_raise_child ((ClutterContainer*) window_group, _tmp17_ = unity_launcher_launcher_get_view (self->priv->launcher), mutter_plugin_get_normal_window_group (unity_plugin_get_plugin (self))); _g_object_unref0 (_tmp17_); - clutter_container_raise_child ((ClutterContainer*) window_group, _tmp18_ = unity_launcher_launcher_get_view (self->priv->launcher), mutter_plugin_get_normal_window_group (unity_plugin_get_plugin (self))); + clutter_actor_animate (_tmp18_ = unity_launcher_launcher_get_view (self->priv->launcher), (gulong) CLUTTER_EASE_IN_SINE, (guint) 400, "opacity", 255, NULL); _g_object_unref0 (_tmp18_); - clutter_actor_animate (_tmp19_ = unity_launcher_launcher_get_view (self->priv->launcher), (gulong) CLUTTER_EASE_IN_SINE, (guint) 400, "opacity", 255, NULL); - _g_object_unref0 (_tmp19_); if (self->priv->places_enabled) { - UnityPlacesController* _tmp20_; - UnityPlacesView* _tmp21_; - ClutterActor* _tmp22_; - self->priv->places_controller = (_tmp20_ = unity_places_controller_new ((UnityShell*) self), _g_object_unref0 (self->priv->places_controller), _tmp20_); - self->priv->places = (_tmp21_ = unity_places_controller_get_view (self->priv->places_controller), _g_object_unref0 (self->priv->places), _tmp21_); + UnityPlacesController* _tmp19_; + UnityPlacesView* _tmp20_; + ClutterActor* _tmp21_; + self->priv->places_controller = (_tmp19_ = unity_places_controller_new ((UnityShell*) self), _g_object_unref0 (self->priv->places_controller), _tmp19_); + self->priv->places = (_tmp20_ = unity_places_controller_get_view (self->priv->places_controller), _g_object_unref0 (self->priv->places), _tmp20_); clutter_container_add_actor ((ClutterContainer*) window_group, (ClutterActor*) self->priv->places); - clutter_container_raise_child ((ClutterContainer*) window_group, (ClutterActor*) self->priv->places, _tmp22_ = unity_launcher_launcher_get_view (self->priv->launcher)); - _g_object_unref0 (_tmp22_); + clutter_container_raise_child ((ClutterContainer*) window_group, (ClutterActor*) self->priv->places, _tmp21_ = unity_launcher_launcher_get_view (self->priv->launcher)); + _g_object_unref0 (_tmp21_); clutter_actor_set_opacity ((ClutterActor*) self->priv->places, (guint8) 0); clutter_actor_set_reactive ((ClutterActor*) self->priv->places, FALSE); clutter_actor_hide ((ClutterActor*) self->priv->places); self->priv->places_showing = FALSE; } - self->priv->panel = (_tmp23_ = g_object_ref_sink (unity_panel_view_new ((UnityShell*) self)), _g_object_unref0 (self->priv->panel), _tmp23_); + self->priv->panel = (_tmp22_ = g_object_ref_sink (unity_panel_view_new ((UnityShell*) self)), _g_object_unref0 (self->priv->panel), _tmp22_); clutter_container_add_actor ((ClutterContainer*) window_group, (ClutterActor*) self->priv->panel); - clutter_container_raise_child ((ClutterContainer*) window_group, (ClutterActor*) self->priv->panel, _tmp24_ = unity_launcher_launcher_get_view (self->priv->launcher)); - _g_object_unref0 (_tmp24_); + clutter_container_raise_child ((ClutterContainer*) window_group, (ClutterActor*) self->priv->panel, _tmp23_ = unity_launcher_launcher_get_view (self->priv->launcher)); + _g_object_unref0 (_tmp23_); clutter_actor_show ((ClutterActor*) self->priv->panel); g_signal_connect_object ((GObject*) self->priv->stage, "notify::width", (GCallback) _unity_plugin_relayout_g_object_notify, self, 0); g_signal_connect_object ((GObject*) self->priv->stage, "notify::height", (GCallback) _unity_plugin_relayout_g_object_notify, self, 0); @@ -561,6 +562,32 @@ static gboolean unity_plugin_real_construct (UnityPlugin* self) { } +static void _unity_plugin_on_focus_window_fullscreen_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { + unity_plugin_on_focus_window_fullscreen_changed (self); +} + + +static void unity_plugin_on_focus_window_changed (UnityPlugin* self) { + g_return_if_fail (self != NULL); + unity_plugin_check_fullscreen_obstruction (self); + if (self->priv->focus_window != NULL) { + GQuark _tmp1_; + guint _tmp0_; + g_signal_parse_name ("notify::fullscreen", G_TYPE_OBJECT, &_tmp0_, &_tmp1_, TRUE); + g_signal_handlers_disconnect_matched ((GObject*) self->priv->focus_window, G_SIGNAL_MATCH_ID | G_SIGNAL_MATCH_DETAIL | G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, _tmp0_, _tmp1_, NULL, (GCallback) _unity_plugin_on_focus_window_fullscreen_changed_g_object_notify, self); + } + g_object_get ((GObject*) self->priv->display, "focus-window", &self->priv->focus_window, NULL); + g_signal_connect_object ((GObject*) self->priv->focus_window, "notify::fullscreen", (GCallback) _unity_plugin_on_focus_window_fullscreen_changed_g_object_notify, self, 0); +} + + +static void unity_plugin_on_focus_window_fullscreen_changed (UnityPlugin* self) { + g_return_if_fail (self != NULL); + g_warning ("plugin.vala:306: FOCUS WINDOW FULLSCREEN CHANGED"); + unity_plugin_check_fullscreen_obstruction (self); +} + + static void unity_plugin_got_screensaver_changed (UnityPlugin* self, DBusGProxy* screensaver, gboolean changed) { g_return_if_fail (self != NULL); g_return_if_fail (screensaver != NULL); @@ -589,11 +616,21 @@ static void unity_plugin_got_screensaver_changed (UnityPlugin* self, DBusGProxy* static void unity_plugin_check_fullscreen_obstruction (UnityPlugin* self) { MutterWindow* focus; gboolean fullscreen; + gboolean _tmp0_ = FALSE; GList* mutter_windows; - MetaWindow* _tmp1_; + MetaWindow* _tmp3_; g_return_if_fail (self != NULL); focus = NULL; fullscreen = FALSE; + if (!UNITY_LAUNCHER_IS_LAUNCHER (self->priv->launcher)) { + _tmp0_ = TRUE; + } else { + _tmp0_ = !CLUTTER_IS_ACTOR (self->priv->panel); + } + if (_tmp0_) { + _g_object_unref0 (focus); + return; + } mutter_windows = mutter_plugin_get_windows (unity_plugin_get_plugin (self)); { GList* w_collection; @@ -603,9 +640,19 @@ static void unity_plugin_check_fullscreen_obstruction (UnityPlugin* self) { MutterWindow* w; w = _g_object_ref0 ((MutterWindow*) w_it->data); { - if (meta_window_has_focus (mutter_window_get_meta_window (w))) { - MutterWindow* _tmp0_; - focus = (_tmp0_ = _g_object_ref0 (w), _g_object_unref0 (focus), _tmp0_); + MetaWindow* meta; + gboolean _tmp1_ = FALSE; + meta = mutter_window_get_meta_window (w); + if (meta != NULL) { + _tmp1_ = meta_window_has_focus (mutter_window_get_meta_window (w)); + } else { + _tmp1_ = FALSE; + } + if (_tmp1_) { + MutterWindow* _tmp2_; + focus = (_tmp2_ = _g_object_ref0 (w), _g_object_unref0 (focus), _tmp2_); + _g_object_unref0 (w); + break; } _g_object_unref0 (w); } @@ -615,17 +662,17 @@ static void unity_plugin_check_fullscreen_obstruction (UnityPlugin* self) { _g_object_unref0 (focus); return; } - g_object_get ((_tmp1_ = mutter_window_get_meta_window (focus), G_IS_OBJECT (_tmp1_) ? ((GObject*) _tmp1_) : NULL), "fullscreen", &fullscreen, NULL); + g_object_get ((_tmp3_ = mutter_window_get_meta_window (focus), G_IS_OBJECT (_tmp3_) ? ((GObject*) _tmp3_) : NULL), "fullscreen", &fullscreen, NULL); if (fullscreen) { - ClutterActor* _tmp2_; - clutter_actor_animate (_tmp2_ = unity_launcher_launcher_get_view (self->priv->launcher), (gulong) CLUTTER_EASE_IN_SINE, (guint) 200, "x", -100.f, NULL); - _g_object_unref0 (_tmp2_); + ClutterActor* _tmp4_; + clutter_actor_animate (_tmp4_ = unity_launcher_launcher_get_view (self->priv->launcher), (gulong) CLUTTER_EASE_IN_SINE, (guint) 200, "x", -100.f, NULL); + _g_object_unref0 (_tmp4_); clutter_actor_animate ((ClutterActor*) self->priv->panel, (gulong) CLUTTER_EASE_IN_SINE, (guint) 200, "opacity", 0, NULL); unity_plugin_set_fullscreen_obstruction (self, TRUE); } else { - ClutterActor* _tmp3_; - clutter_actor_animate (_tmp3_ = unity_launcher_launcher_get_view (self->priv->launcher), (gulong) CLUTTER_EASE_IN_SINE, (guint) 200, "x", 0.f, NULL); - _g_object_unref0 (_tmp3_); + ClutterActor* _tmp5_; + clutter_actor_animate (_tmp5_ = unity_launcher_launcher_get_view (self->priv->launcher), (gulong) CLUTTER_EASE_IN_SINE, (guint) 200, "x", 0.f, NULL); + _g_object_unref0 (_tmp5_); clutter_actor_animate ((ClutterActor*) self->priv->panel, (gulong) CLUTTER_EASE_IN_SINE, (guint) 200, "opacity", 255, NULL); unity_plugin_set_fullscreen_obstruction (self, FALSE); } @@ -644,8 +691,6 @@ static void unity_plugin_relayout (UnityPlugin* self) { clutter_actor_get_size ((ClutterActor*) self->priv->stage, &width, &height); gtk_window_resize ((GtkWindow*) self->priv->drag_dest, UNITY_PLUGIN_QUICKLAUNCHER_WIDTH, ((gint) height) - UNITY_PLUGIN_PANEL_HEIGHT); gtk_window_move ((GtkWindow*) self->priv->drag_dest, 0, UNITY_PLUGIN_PANEL_HEIGHT); - clutter_actor_set_size ((ClutterActor*) self->priv->background, width, height); - clutter_actor_set_position ((ClutterActor*) self->priv->background, (float) 0, (float) 0); clutter_actor_set_size (_tmp0_ = unity_launcher_launcher_get_view (self->priv->launcher), (float) UNITY_PLUGIN_QUICKLAUNCHER_WIDTH, height - UNITY_PLUGIN_PANEL_HEIGHT); _g_object_unref0 (_tmp0_); clutter_actor_set_position (_tmp1_ = unity_launcher_launcher_get_view (self->priv->launcher), (float) 0, (float) UNITY_PLUGIN_PANEL_HEIGHT); @@ -1050,11 +1095,20 @@ void unity_plugin_unmaximize (UnityPlugin* self, MutterWindow* window, gint x, g } +static void _unity_plugin_on_focus_window_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { + unity_plugin_on_focus_window_changed (self); +} + + void unity_plugin_map (UnityPlugin* self, MutterWindow* window) { g_return_if_fail (self != NULL); g_return_if_fail (window != NULL); unity_maximus_process_window (self->priv->maximus, window); g_signal_emit_by_name (self, "window-mapped", self, window); + if (self->priv->display == NULL) { + self->priv->display = meta_window_get_display (mutter_window_get_meta_window (window)); + g_signal_connect_object ((GObject*) self->priv->display, "notify::focus-window", (GCallback) _unity_plugin_on_focus_window_changed_g_object_notify, self, 0); + } } @@ -1133,7 +1187,9 @@ MutterPlugin* unity_plugin_get_plugin (UnityPlugin* self) { static gboolean _unity_plugin_real_construct_gsource_func (gpointer self) { - return unity_plugin_real_construct (self); + gboolean result; + result = unity_plugin_real_construct (self); + return result; } @@ -1245,7 +1301,7 @@ static GObject * unity_plugin_constructor (GType type, guint n_construct_propert e = _inner_error_; _inner_error_ = NULL; { - g_warning ("plugin.vala:195: %s", e->message); + g_warning ("plugin.vala:194: %s", e->message); _g_error_free0 (e); } } @@ -1306,10 +1362,11 @@ static void unity_plugin_unity_shell_interface_init (UnityShellIface * iface) { static void unity_plugin_instance_init (UnityPlugin * self) { self->priv = UNITY_PLUGIN_GET_PRIVATE (self); + self->priv->focus_window = NULL; + self->priv->display = NULL; self->priv->places_enabled = FALSE; self->priv->last_input_state = UNITY_INPUT_STATE_NONE; self->priv->grab_enabled = FALSE; - self->priv->active_window = NULL; } @@ -1321,7 +1378,6 @@ static void unity_plugin_finalize (GObject* obj) { _g_object_unref0 (self->priv->app); _g_object_unref0 (self->priv->wm); _g_object_unref0 (self->priv->maximus); - _g_object_unref0 (self->priv->background); _g_object_unref0 (self->priv->expose_manager); _g_object_unref0 (self->priv->launcher); _g_object_unref0 (self->priv->places_controller); diff --git a/targets/mutter/plugin.vala b/targets/mutter/plugin.vala index 24c432dd7..c40a1c3c6 100644 --- a/targets/mutter/plugin.vala +++ b/targets/mutter/plugin.vala @@ -120,7 +120,6 @@ namespace Unity private Maximus maximus; /* Unity Components */ - private Background background; private ExposeManager expose_manager; private Launcher.Launcher launcher; private Places.Controller places_controller; @@ -128,6 +127,8 @@ namespace Unity private Panel.View panel; private ActorBlur actor_blur; private Clutter.Rectangle dark_box; + private unowned Mutter.MetaWindow? focus_window = null; + private unowned Mutter.MetaDisplay? display = null; private bool places_enabled = false; @@ -153,8 +154,6 @@ namespace Unity private DBus.Connection screensaver_conn; private dynamic DBus.Object screensaver; - private unowned Mutter.Window? active_window = null; - construct { Unity.global_shell = this; @@ -233,11 +232,6 @@ namespace Unity Clutter.Group window_group = (Clutter.Group) this.plugin.get_window_group (); - this.background = new Background (); - this.stage.add_actor (background); - this.background.lower_bottom (); - this.background.show (); - this.launcher = new Launcher.Launcher (this); this.launcher.get_view ().opacity = 0; @@ -293,6 +287,25 @@ namespace Unity this.ensure_input_region (); return false; } + + private void on_focus_window_changed () + { + check_fullscreen_obstruction (); + + if (focus_window != null) + { + focus_window.notify["fullscreen"].disconnect (on_focus_window_fullscreen_changed); + } + + display.get ("focus-window", ref focus_window); + focus_window.notify["fullscreen"].connect (on_focus_window_fullscreen_changed); + } + + private void on_focus_window_fullscreen_changed () + { + warning ("FOCUS WINDOW FULLSCREEN CHANGED"); + check_fullscreen_obstruction (); + } private void got_screensaver_changed (dynamic DBus.Object screensaver, bool changed) { @@ -317,12 +330,21 @@ namespace Unity { Mutter.Window focus = null; bool fullscreen = false; - + + // prevent segfault when mutter beats us to the initialization punch + if (!(launcher is Launcher.Launcher) || !(panel is Clutter.Actor)) + return; + unowned GLib.List<Mutter.Window> mutter_windows = plugin.get_windows (); foreach (Mutter.Window w in mutter_windows) { - if (Mutter.MetaWindow.has_focus (w.get_meta_window ())) - focus = w; + unowned Mutter.MetaWindow meta = w.get_meta_window (); + + if (meta != null && Mutter.MetaWindow.has_focus (w.get_meta_window ())) + { + focus = w; + break; + } } if (focus == null) @@ -354,9 +376,6 @@ namespace Unity (int)height - this.PANEL_HEIGHT); this.drag_dest.move (0, this.PANEL_HEIGHT); - this.background.set_size (width, height); - this.background.set_position (0, 0); - this.launcher.get_view ().set_size (this.QUICKLAUNCHER_WIDTH, (height-this.PANEL_HEIGHT)); this.launcher.get_view ().set_position (0, this.PANEL_HEIGHT); @@ -675,6 +694,12 @@ namespace Unity { this.maximus.process_window (window); this.window_mapped (this, window); + + if (display == null) + { + display = Mutter.MetaWindow.get_display (window.get_meta_window ()); + display.notify["focus-window"].connect (on_focus_window_changed); + } } public void destroy (Mutter.Window window) diff --git a/targets/mutter/window-management.c b/targets/mutter/window-management.c index b78314454..095ef9562 100644 --- a/targets/mutter/window-management.c +++ b/targets/mutter/window-management.c @@ -456,7 +456,9 @@ static gboolean unity_window_management_force_activate (UnityWindowManagement* s static gboolean _unity_window_management_force_activate_gsource_func (gpointer self) { - return unity_window_management_force_activate (self); + gboolean result; + result = unity_window_management_force_activate (self); + return result; } diff --git a/targets/unity/main.c b/targets/unity/main.c index 1125ca35f..ad1a5988e 100644 --- a/targets/unity/main.c +++ b/targets/unity/main.c @@ -113,7 +113,9 @@ static gboolean _lambda0_ (void) { static gboolean __lambda0__gsource_func (gpointer self) { - return _lambda0_ (); + gboolean result; + result = _lambda0_ (); + return result; } diff --git a/tests/ui/test-ui.c b/tests/ui/test-ui.c index 8e8b4db7a..809ad92dc 100644 --- a/tests/ui/test-ui.c +++ b/tests/ui/test-ui.c @@ -349,7 +349,9 @@ static gboolean _lambda0_ (void) { static gboolean __lambda0__gsource_func (gpointer self) { - return _lambda0_ (); + gboolean result; + result = _lambda0_ (); + return result; } diff --git a/tests/unit/test-launcher.c b/tests/unit/test-launcher.c index 19fa3d8f9..c527bc09e 100644 --- a/tests/unit/test-launcher.c +++ b/tests/unit/test-launcher.c @@ -30,6 +30,8 @@ #include <stdlib.h> #include <string.h> #include <unity-private.h> +#include <float.h> +#include <math.h> #include <gobject/gvaluecollector.h> @@ -164,6 +166,7 @@ GType unity_tests_unit_launcher_suite_test_scroller_child_get_type (void); enum { UNITY_TESTS_UNIT_LAUNCHER_SUITE_TEST_SCROLLER_CHILD_DUMMY_PROPERTY }; +static void unity_tests_unit_launcher_suite_test_scroller_child_real_force_rotation_jump (UnityLauncherScrollerChild* base, float degrees); static void unity_tests_unit_launcher_suite_finalize (UnityTestsUnitLauncherSuite* obj); static int _vala_strcmp0 (const char * str1, const char * str2); @@ -459,6 +462,12 @@ static void unity_tests_unit_launcher_suite_test_scroller_child_controller (Unit } +static void unity_tests_unit_launcher_suite_test_scroller_child_real_force_rotation_jump (UnityLauncherScrollerChild* base, float degrees) { + UnityTestsUnitLauncherSuiteTestScrollerChild * self; + self = (UnityTestsUnitLauncherSuiteTestScrollerChild*) base; +} + + UnityTestsUnitLauncherSuiteTestScrollerChild* unity_tests_unit_launcher_suite_test_scroller_child_construct (GType object_type) { UnityTestsUnitLauncherSuiteTestScrollerChild * self; self = (UnityTestsUnitLauncherSuiteTestScrollerChild*) unity_launcher_scroller_child_construct (object_type); @@ -473,6 +482,7 @@ UnityTestsUnitLauncherSuiteTestScrollerChild* unity_tests_unit_launcher_suite_te static void unity_tests_unit_launcher_suite_test_scroller_child_class_init (UnityTestsUnitLauncherSuiteTestScrollerChildClass * klass) { unity_tests_unit_launcher_suite_test_scroller_child_parent_class = g_type_class_peek_parent (klass); + UNITY_LAUNCHER_SCROLLER_CHILD_CLASS (klass)->force_rotation_jump = unity_tests_unit_launcher_suite_test_scroller_child_real_force_rotation_jump; } diff --git a/tests/unit/test-launcher.vala b/tests/unit/test-launcher.vala index ff6b138d0..fed007e6b 100644 --- a/tests/unit/test-launcher.vala +++ b/tests/unit/test-launcher.vala @@ -117,6 +117,9 @@ namespace Unity.Tests.Unit public class TestScrollerChild : ScrollerChild { + public override void force_rotation_jump (float degrees) + { + } } // very basic tests for scroller model, makes sure its list interface works diff --git a/unity-private/application.c b/unity-private/application.c index 9f4b26b67..3309c2080 100644 --- a/unity-private/application.c +++ b/unity-private/application.c @@ -297,7 +297,9 @@ void unity_application_set_shell (UnityApplication* self, UnityShell* value) { static UniqueResponse _unity_application_on_message_received_unique_app_message_received (UniqueApp* _sender, gint command, UniqueMessageData* message_data, guint time_, gpointer self) { - return unity_application_on_message_received (self, command, message_data, time_); + UniqueResponse result; + result = unity_application_on_message_received (self, command, message_data, time_); + return result; } diff --git a/unity-private/launcher/application-controller.c b/unity-private/launcher/application-controller.c index 4612bd12e..b0c3b7722 100644 --- a/unity-private/launcher/application-controller.c +++ b/unity-private/launcher/application-controller.c @@ -238,6 +238,7 @@ struct _UnityLauncherScrollerChild { struct _UnityLauncherScrollerChildClass { CtkActorClass parent_class; + void (*force_rotation_jump) (UnityLauncherScrollerChild* self, float degrees); }; struct _Block1Data { @@ -971,7 +972,9 @@ static GeeArrayList* unity_launcher_application_controller_real_get_menu_shortcu static gboolean _unity_launcher_application_controller_on_launch_timeout_gsource_func (gpointer self) { - return unity_launcher_application_controller_on_launch_timeout (self); + gboolean result; + result = unity_launcher_application_controller_on_launch_timeout (self); + return result; } diff --git a/unity-private/launcher/launcher-child.c b/unity-private/launcher/launcher-child.c index f5cef062d..be2eace36 100644 --- a/unity-private/launcher/launcher-child.c +++ b/unity-private/launcher/launcher-child.c @@ -84,6 +84,7 @@ struct _UnityLauncherScrollerChild { struct _UnityLauncherScrollerChildClass { CtkActorClass parent_class; + void (*force_rotation_jump) (UnityLauncherScrollerChild* self, float degrees); }; struct _UnityLauncherLauncherChild { @@ -96,7 +97,7 @@ struct _UnityLauncherLauncherChildClass { }; struct _UnityLauncherLauncherChildPrivate { - CtkActor* processed_icon; + UnityUnityIcon* processed_icon; UnityThemeImage* active_indicator; UnityThemeImage* running_indicator; GdkPixbuf* honeycomb_mask; @@ -104,10 +105,14 @@ struct _UnityLauncherLauncherChildPrivate { CtkEffectGlow* effect_icon_glow; ClutterAnimation* active_indicator_anim; ClutterAnimation* running_indicator_anim; + ClutterAnimation* rotate_anim; ClutterTimeline* wiggle_timeline; ClutterTimeline* glow_timeline; + ClutterTimeline* rotate_timeline; UnityLauncherAnimState glow_state; UnityLauncherAnimState wiggle_state; + UnityLauncherAnimState rotate_state; + float old_rotate_value; float previous_glow_alpha; float previous_wiggle_alpha; }; @@ -139,9 +144,15 @@ static void unity_launcher_launcher_child_on_activating_changed (UnityLauncherLa static void _unity_launcher_launcher_child_on_activating_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); static void unity_launcher_launcher_child_on_needs_attention_changed (UnityLauncherLauncherChild* self); static void _unity_launcher_launcher_child_on_needs_attention_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); +static void unity_launcher_launcher_child_on_rotation_changed (UnityLauncherLauncherChild* self); static void unity_launcher_launcher_child_load_textures (UnityLauncherLauncherChild* self); static float unity_launcher_launcher_child_get_ease_out_sine (float alpha); static float unity_launcher_launcher_child_get_circular_alpha (float alpha); +static void unity_launcher_launcher_child_rotate_anim_rising (UnityLauncherLauncherChild* self, float progress); +static void unity_launcher_launcher_child_on_rotate_timeline_new_frame (UnityLauncherLauncherChild* self); +float unity_launcher_scroller_child_get_rotation (UnityLauncherScrollerChild* self); +void unity_launcher_scroller_child_set_rotation (UnityLauncherScrollerChild* self, float value); +static void unity_launcher_launcher_child_real_force_rotation_jump (UnityLauncherScrollerChild* base, float degrees); static void unity_launcher_launcher_child_glow_anim_rising (UnityLauncherLauncherChild* self, float progress); static void unity_launcher_launcher_child_glow_anim_looping (UnityLauncherLauncherChild* self, float progress); static void unity_launcher_launcher_child_glow_anim_falling (UnityLauncherLauncherChild* self, float progress); @@ -171,6 +182,8 @@ UnityLauncherLauncherChild* unity_launcher_launcher_child_construct (GType objec void unity_launcher_scroller_child_set_position (UnityLauncherScrollerChild* self, float value); static void _unity_launcher_launcher_child_on_glow_timeline_new_frame_clutter_timeline_new_frame (ClutterTimeline* _sender, gint msecs, gpointer self); static void _unity_launcher_launcher_child_on_wiggle_timeline_new_frame_clutter_timeline_new_frame (ClutterTimeline* _sender, gint msecs, gpointer self); +static void _unity_launcher_launcher_child_on_rotate_timeline_new_frame_clutter_timeline_new_frame (ClutterTimeline* _sender, gint msecs, gpointer self); +static void _unity_launcher_launcher_child_on_rotation_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); static GObject * unity_launcher_launcher_child_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void unity_launcher_launcher_child_finalize (GObject* obj); @@ -217,7 +230,7 @@ static void unity_launcher_launcher_child_load_textures (UnityLauncherLauncherCh GError * _inner_error_; UnityThemeImage* _tmp0_; UnityThemeImage* _tmp1_; - CtkActor* _tmp4_; + UnityUnityIcon* _tmp4_; g_return_if_fail (self != NULL); _inner_error_ = NULL; self->priv->active_indicator = (_tmp0_ = g_object_ref_sink (unity_theme_image_new ("application-selected")), _g_object_unref0 (self->priv->active_indicator), _tmp0_); @@ -242,7 +255,7 @@ static void unity_launcher_launcher_child_load_textures (UnityLauncherLauncherCh e = _inner_error_; _inner_error_ = NULL; { - g_warning ("launcher-child.vala:96: Unable to load asset %s: %s", UNITY_LAUNCHER_HONEYCOMB_MASK_FILE, e->message); + g_warning ("launcher-child.vala:105: Unable to load asset %s: %s", UNITY_LAUNCHER_HONEYCOMB_MASK_FILE, e->message); _g_error_free0 (e); } } @@ -252,7 +265,7 @@ static void unity_launcher_launcher_child_load_textures (UnityLauncherLauncherCh g_clear_error (&_inner_error_); return; } - self->priv->processed_icon = (_tmp4_ = (CtkActor*) g_object_ref_sink ((CtkImage*) ctk_image_new ((guint) 48)), _g_object_unref0 (self->priv->processed_icon), _tmp4_); + self->priv->processed_icon = (_tmp4_ = g_object_ref_sink (unity_unity_icon_new (NULL, NULL)), _g_object_unref0 (self->priv->processed_icon), _tmp4_); clutter_actor_set_size ((ClutterActor*) self->priv->processed_icon, (float) 48, (float) 48); clutter_actor_set_parent ((ClutterActor*) self->priv->processed_icon, (ClutterActor*) self); g_signal_connect_object ((GObject*) self, "notify::icon", (GCallback) _unity_launcher_launcher_child_on_icon_changed_g_object_notify, self, 0); @@ -262,6 +275,7 @@ static void unity_launcher_launcher_child_load_textures (UnityLauncherLauncherCh g_signal_connect_object ((GObject*) self, "notify::needs-attention", (GCallback) _unity_launcher_launcher_child_on_needs_attention_changed_g_object_notify, self, 0); unity_launcher_launcher_child_on_running_changed (self); unity_launcher_launcher_child_on_active_changed (self); + unity_launcher_launcher_child_on_rotation_changed (self); } @@ -281,6 +295,52 @@ static float unity_launcher_launcher_child_get_circular_alpha (float alpha) { } +static void unity_launcher_launcher_child_on_rotate_timeline_new_frame (UnityLauncherLauncherChild* self) { + float progress; + g_return_if_fail (self != NULL); + progress = (float) clutter_timeline_get_progress (self->priv->rotate_timeline); + switch (self->priv->rotate_state) { + case UNITY_LAUNCHER_ANIM_STATE_RISING: + { + unity_launcher_launcher_child_rotate_anim_rising (self, progress); + break; + } + case UNITY_LAUNCHER_ANIM_STATE_STOPPED: + { + clutter_timeline_stop (self->priv->rotate_timeline); + break; + } + } + clutter_actor_queue_redraw ((ClutterActor*) self->priv->processed_icon); +} + + +static void unity_launcher_launcher_child_rotate_anim_rising (UnityLauncherLauncherChild* self, float progress) { + float diff; + float rotate_val; + g_return_if_fail (self != NULL); + progress = unity_launcher_launcher_child_get_ease_out_sine (progress); + diff = unity_launcher_scroller_child_get_rotation ((UnityLauncherScrollerChild*) self) - self->priv->old_rotate_value; + rotate_val = self->priv->old_rotate_value + (progress * diff); + self->priv->processed_icon->rotation = rotate_val; + if (progress >= 1.0) { + self->priv->rotate_state = UNITY_LAUNCHER_ANIM_STATE_STOPPED; + clutter_timeline_stop (self->priv->rotate_timeline); + } +} + + +static void unity_launcher_launcher_child_real_force_rotation_jump (UnityLauncherScrollerChild* base, float degrees) { + UnityLauncherLauncherChild * self; + self = (UnityLauncherLauncherChild*) base; + self->priv->processed_icon->rotation = degrees; + unity_launcher_scroller_child_set_rotation ((UnityLauncherScrollerChild*) self, degrees); + self->priv->rotate_state = UNITY_LAUNCHER_ANIM_STATE_STOPPED; + clutter_timeline_stop (self->priv->rotate_timeline); + clutter_actor_queue_redraw ((ClutterActor*) self); +} + + static void unity_launcher_launcher_child_on_glow_timeline_new_frame (UnityLauncherLauncherChild* self) { float progress; g_return_if_fail (self != NULL); @@ -429,7 +489,9 @@ static gboolean unity_launcher_launcher_child_check_continue_wiggle (UnityLaunch static gboolean _unity_launcher_launcher_child_check_continue_wiggle_gsource_func (gpointer self) { - return unity_launcher_launcher_child_check_continue_wiggle (self); + gboolean result; + result = unity_launcher_launcher_child_check_continue_wiggle (self); + return result; } @@ -470,7 +532,7 @@ static void unity_launcher_launcher_child_on_icon_changed (UnityLauncherLauncher guchar* pixels; ClutterActor* tex; ClutterActor* color; - CtkActor* _tmp6_; + UnityUnityIcon* _tmp6_; ClutterActor* _tmp4_; ClutterActor* _tmp5_; CtkEffectDropShadow* _tmp7_; @@ -500,12 +562,13 @@ static void unity_launcher_launcher_child_on_icon_changed (UnityLauncherLauncher pixels[3] = (guchar) 255; tex = _g_object_ref0 (gtk_clutter_texture_new_from_pixbuf (scaled_buf)); color = _g_object_ref0 (gtk_clutter_texture_new_from_pixbuf (color_buf)); - self->priv->processed_icon = (_tmp6_ = (CtkActor*) 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_); + 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_); clutter_actor_set_parent ((ClutterActor*) self->priv->processed_icon, (ClutterActor*) self); + self->priv->processed_icon->rotation = unity_launcher_scroller_child_get_rotation ((UnityLauncherScrollerChild*) self); 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_); ctk_effect_set_opacity ((CtkEffect*) self->priv->effect_drop_shadow, 0.4f); ctk_effect_set_margin ((CtkEffect*) self->priv->effect_drop_shadow, 5); - ctk_actor_add_effect (self->priv->processed_icon, (CtkEffect*) self->priv->effect_drop_shadow); + ctk_actor_add_effect ((CtkActor*) self->priv->processed_icon, (CtkEffect*) self->priv->effect_drop_shadow); clutter_actor_queue_redraw ((ClutterActor*) self); _g_object_unref0 (scaled_buf); _g_object_unref0 (color_buf); @@ -545,6 +608,19 @@ static void unity_launcher_launcher_child_on_active_changed (UnityLauncherLaunch } +static void unity_launcher_launcher_child_on_rotation_changed (UnityLauncherLauncherChild* self) { + g_return_if_fail (self != NULL); + self->priv->old_rotate_value = self->priv->processed_icon->rotation; + if (clutter_timeline_is_playing (self->priv->rotate_timeline)) { + clutter_timeline_stop (self->priv->rotate_timeline); + self->priv->processed_icon->rotation = self->priv->old_rotate_value; + } + clutter_timeline_set_duration (self->priv->rotate_timeline, (guint) 300); + self->priv->rotate_state = UNITY_LAUNCHER_ANIM_STATE_RISING; + clutter_timeline_start (self->priv->rotate_timeline); +} + + static void unity_launcher_launcher_child_on_activating_changed (UnityLauncherLauncherChild* self) { gboolean _tmp0_ = FALSE; g_return_if_fail (self != NULL); @@ -574,7 +650,7 @@ static void unity_launcher_launcher_child_on_activating_changed (UnityLauncherLa ctk_effect_glow_set_background_texture (self->priv->effect_icon_glow, self->priv->honeycomb_mask); ctk_effect_glow_set_color (self->priv->effect_icon_glow, &c); ctk_effect_set_opacity ((CtkEffect*) self->priv->effect_icon_glow, 1.0f); - ctk_actor_add_effect (self->priv->processed_icon, (CtkEffect*) self->priv->effect_icon_glow); + ctk_actor_add_effect ((CtkActor*) self->priv->processed_icon, (CtkEffect*) self->priv->effect_icon_glow); ctk_effect_set_margin ((CtkEffect*) self->priv->effect_icon_glow, 6); clutter_timeline_set_duration (self->priv->glow_timeline, UNITY_LAUNCHER_SHORT_DELAY); self->priv->glow_state = UNITY_LAUNCHER_ANIM_STATE_RISING; @@ -735,6 +811,16 @@ static void _unity_launcher_launcher_child_on_wiggle_timeline_new_frame_clutter_ } +static void _unity_launcher_launcher_child_on_rotate_timeline_new_frame_clutter_timeline_new_frame (ClutterTimeline* _sender, gint msecs, gpointer self) { + unity_launcher_launcher_child_on_rotate_timeline_new_frame (self); +} + + +static void _unity_launcher_launcher_child_on_rotation_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) { + unity_launcher_launcher_child_on_rotation_changed (self); +} + + static GObject * unity_launcher_launcher_child_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { GObject * obj; GObjectClass * parent_class; @@ -745,12 +831,16 @@ static GObject * unity_launcher_launcher_child_constructor (GType type, guint n_ { ClutterTimeline* _tmp0_; ClutterTimeline* _tmp1_; + ClutterTimeline* _tmp2_; unity_launcher_launcher_child_load_textures (self); unity_launcher_scroller_child_set_position ((UnityLauncherScrollerChild*) self, 0.0f); self->priv->glow_timeline = (_tmp0_ = clutter_timeline_new ((guint) 1), _g_object_unref0 (self->priv->glow_timeline), _tmp0_); self->priv->wiggle_timeline = (_tmp1_ = clutter_timeline_new ((guint) 1), _g_object_unref0 (self->priv->wiggle_timeline), _tmp1_); + self->priv->rotate_timeline = (_tmp2_ = clutter_timeline_new ((guint) 1), _g_object_unref0 (self->priv->rotate_timeline), _tmp2_); g_signal_connect_object (self->priv->glow_timeline, "new-frame", (GCallback) _unity_launcher_launcher_child_on_glow_timeline_new_frame_clutter_timeline_new_frame, self, 0); g_signal_connect_object (self->priv->wiggle_timeline, "new-frame", (GCallback) _unity_launcher_launcher_child_on_wiggle_timeline_new_frame_clutter_timeline_new_frame, self, 0); + g_signal_connect_object (self->priv->rotate_timeline, "new-frame", (GCallback) _unity_launcher_launcher_child_on_rotate_timeline_new_frame_clutter_timeline_new_frame, self, 0); + g_signal_connect_object ((GObject*) self, "notify::rotation", (GCallback) _unity_launcher_launcher_child_on_rotation_changed_g_object_notify, self, 0); } return obj; } @@ -759,6 +849,7 @@ static GObject * unity_launcher_launcher_child_constructor (GType type, guint n_ static void unity_launcher_launcher_child_class_init (UnityLauncherLauncherChildClass * klass) { unity_launcher_launcher_child_parent_class = g_type_class_peek_parent (klass); g_type_class_add_private (klass, sizeof (UnityLauncherLauncherChildPrivate)); + UNITY_LAUNCHER_SCROLLER_CHILD_CLASS (klass)->force_rotation_jump = unity_launcher_launcher_child_real_force_rotation_jump; CLUTTER_ACTOR_CLASS (klass)->get_preferred_width = unity_launcher_launcher_child_real_get_preferred_width; CLUTTER_ACTOR_CLASS (klass)->get_preferred_height = unity_launcher_launcher_child_real_get_preferred_height; CLUTTER_ACTOR_CLASS (klass)->allocate = unity_launcher_launcher_child_real_allocate; @@ -773,6 +864,7 @@ static void unity_launcher_launcher_child_class_init (UnityLauncherLauncherChild static void unity_launcher_launcher_child_instance_init (UnityLauncherLauncherChild * self) { self->priv = UNITY_LAUNCHER_LAUNCHER_CHILD_GET_PRIVATE (self); + self->priv->old_rotate_value = 0.0f; self->priv->previous_glow_alpha = 0.0f; self->priv->previous_wiggle_alpha = 0.0f; } @@ -793,8 +885,10 @@ static void unity_launcher_launcher_child_finalize (GObject* obj) { _g_object_unref0 (self->priv->effect_icon_glow); _g_object_unref0 (self->priv->active_indicator_anim); _g_object_unref0 (self->priv->running_indicator_anim); + _g_object_unref0 (self->priv->rotate_anim); _g_object_unref0 (self->priv->wiggle_timeline); _g_object_unref0 (self->priv->glow_timeline); + _g_object_unref0 (self->priv->rotate_timeline); G_OBJECT_CLASS (unity_launcher_launcher_child_parent_class)->finalize (obj); } diff --git a/unity-private/launcher/launcher-child.vala b/unity-private/launcher/launcher-child.vala index 5d3368f4d..f935d1abc 100644 --- a/unity-private/launcher/launcher-child.vala +++ b/unity-private/launcher/launcher-child.vala @@ -40,7 +40,7 @@ namespace Unity.Launcher class LauncherChild : ScrollerChild { - private Ctk.Actor processed_icon; + private UnityIcon processed_icon; private ThemeImage active_indicator; private ThemeImage running_indicator; private Gdk.Pixbuf honeycomb_mask; @@ -52,10 +52,15 @@ namespace Unity.Launcher // animations private Clutter.Animation active_indicator_anim; private Clutter.Animation running_indicator_anim; + private Clutter.Animation rotate_anim; private Clutter.Timeline wiggle_timeline; private Clutter.Timeline glow_timeline; + private Clutter.Timeline rotate_timeline; private AnimState glow_state; private AnimState wiggle_state; + private AnimState rotate_state; + + private float old_rotate_value = 0.0f; construct { @@ -65,9 +70,13 @@ namespace Unity.Launcher //icon glow glow_timeline = new Clutter.Timeline (1); wiggle_timeline = new Clutter.Timeline (1); + rotate_timeline = new Clutter.Timeline (1); glow_timeline.new_frame.connect (on_glow_timeline_new_frame); wiggle_timeline.new_frame.connect (on_wiggle_timeline_new_frame); + rotate_timeline.new_frame.connect (on_rotate_timeline_new_frame); + + notify["rotation"].connect (on_rotation_changed); } ~LauncherChild () @@ -98,7 +107,7 @@ namespace Unity.Launcher e.message); } - processed_icon = new Ctk.Image (48); + processed_icon = new UnityIcon (null, null); processed_icon.set_size (48, 48); processed_icon.set_parent (this); @@ -111,6 +120,7 @@ namespace Unity.Launcher // just trigger some notifications now to set inital state on_running_changed (); on_active_changed (); + on_rotation_changed (); } /* alpha helpers */ @@ -127,6 +137,45 @@ namespace Unity.Launcher } /* animation callbacks */ + private void on_rotate_timeline_new_frame () + { + float progress = (float)rotate_timeline.get_progress (); + switch (rotate_state) + { + case AnimState.RISING: + rotate_anim_rising (progress); + break; + + case AnimState.STOPPED: + rotate_timeline.stop (); + break; + } + processed_icon.do_queue_redraw (); + } + + private void rotate_anim_rising (float progress) + { + progress = get_ease_out_sine (progress); + var diff = rotation - old_rotate_value; + float rotate_val = old_rotate_value + (progress * diff); + + processed_icon.rotation = rotate_val; + if (progress >= 1.0) + { + rotate_state = AnimState.STOPPED; + rotate_timeline.stop (); + } + } + + public override void force_rotation_jump (float degrees) + { + processed_icon.rotation = degrees; + rotation = degrees; + rotate_state = AnimState.STOPPED; + rotate_timeline.stop (); + do_queue_redraw (); + } + private void on_glow_timeline_new_frame () { float progress = (float)glow_timeline.get_progress (); @@ -317,6 +366,7 @@ namespace Unity.Launcher processed_icon = new UnityIcon (tex as Clutter.Texture, color as Clutter.Texture); processed_icon.set_parent (this); + processed_icon.rotation = rotation; this.effect_drop_shadow = new Ctk.EffectDropShadow (5.0f, 0, 2); effect_drop_shadow.set_opacity (0.4f); @@ -354,6 +404,20 @@ namespace Unity.Launcher "opacity", target_opacity); } + private void on_rotation_changed () + { + old_rotate_value = processed_icon.rotation; + if (rotate_timeline.is_playing ()) + { + rotate_timeline.stop (); + processed_icon.rotation = old_rotate_value; + } + + rotate_timeline.set_duration (300); + rotate_state = AnimState.RISING; + rotate_timeline.start (); + } + private void on_activating_changed () { if (glow_timeline.is_playing () && activating == false) diff --git a/unity-private/launcher/quicklist-view.c b/unity-private/launcher/quicklist-view.c index 021a1d67f..18fd4b865 100644 --- a/unity-private/launcher/quicklist-view.c +++ b/unity-private/launcher/quicklist-view.c @@ -452,7 +452,6 @@ static gboolean _unity_launcher_quicklist_menu_item_on_enter (UnityLauncherQuick g_return_val_if_fail (UNITY_LAUNCHER_IS_QUICKLIST_MENU_ITEM (self), FALSE); ctk_layer_set_enabled (ctk_layer_actor_get_layer (self->priv->item_background, (guint) 0), FALSE); ctk_layer_set_enabled (ctk_layer_actor_get_layer (self->priv->item_background, (guint) 1), TRUE); - clutter_actor_queue_redraw ((ClutterActor*) self->priv->item_background); result = FALSE; return result; } @@ -464,7 +463,6 @@ static gboolean _unity_launcher_quicklist_menu_item_on_leave (UnityLauncherQuick g_return_val_if_fail (UNITY_LAUNCHER_IS_QUICKLIST_MENU_ITEM (self), FALSE); ctk_layer_set_enabled (ctk_layer_actor_get_layer (self->priv->item_background, (guint) 0), TRUE); ctk_layer_set_enabled (ctk_layer_actor_get_layer (self->priv->item_background, (guint) 1), FALSE); - clutter_actor_queue_redraw ((ClutterActor*) self->priv->item_background); result = FALSE; return result; } @@ -486,17 +484,23 @@ static void __unity_launcher_quicklist_menu_item_on_label_changed_g_object_notif static gboolean __unity_launcher_quicklist_menu_item_on_enter_clutter_actor_enter_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return _unity_launcher_quicklist_menu_item_on_enter (self, event); + gboolean result; + result = _unity_launcher_quicklist_menu_item_on_enter (self, event); + return result; } static gboolean __unity_launcher_quicklist_menu_item_on_leave_clutter_actor_leave_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return _unity_launcher_quicklist_menu_item_on_leave (self, event); + gboolean result; + result = _unity_launcher_quicklist_menu_item_on_leave (self, event); + return result; } static gboolean __unity_launcher_quicklist_menu_item_on_mouse_down_clutter_actor_button_press_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return _unity_launcher_quicklist_menu_item_on_mouse_down (self, event); + gboolean result; + result = _unity_launcher_quicklist_menu_item_on_mouse_down (self, event); + return result; } diff --git a/unity-private/launcher/quicklist-view.vala b/unity-private/launcher/quicklist-view.vala index e1f049220..b8f6cefc0 100644 --- a/unity-private/launcher/quicklist-view.vala +++ b/unity-private/launcher/quicklist-view.vala @@ -262,7 +262,6 @@ namespace Unity.Launcher { this.item_background.get_layer(0).set_enabled (false); this.item_background.get_layer(1).set_enabled (true); - this.item_background.do_queue_redraw (); return false; } @@ -271,7 +270,6 @@ namespace Unity.Launcher { this.item_background.get_layer(0).set_enabled (true); this.item_background.get_layer(1).set_enabled (false); - this.item_background.do_queue_redraw (); return false; } diff --git a/unity-private/launcher/scroller-controller.c b/unity-private/launcher/scroller-controller.c index c98454fd3..770e8b4b3 100644 --- a/unity-private/launcher/scroller-controller.c +++ b/unity-private/launcher/scroller-controller.c @@ -29,9 +29,9 @@ #include <unity.h> #include <stdlib.h> #include <string.h> -#include <glib/gstdio.h> #include <float.h> #include <math.h> +#include <glib/gstdio.h> #include <clutter/clutter.h> @@ -143,6 +143,7 @@ struct _UnityLauncherScrollerChild { struct _UnityLauncherScrollerChildClass { CtkActorClass parent_class; + void (*force_rotation_jump) (UnityLauncherScrollerChild* self, float degrees); }; @@ -162,8 +163,8 @@ enum { UnityLauncherScrollerController* unity_launcher_scroller_controller_new (UnityLauncherScrollerModel* _model, UnityLauncherScrollerView* _view); UnityLauncherScrollerController* unity_launcher_scroller_controller_construct (GType object_type, UnityLauncherScrollerModel* _model, UnityLauncherScrollerView* _view); static void unity_launcher_scroller_controller_handle_bamf_view_opened (UnityLauncherScrollerController* self, GObject* object); -static void _lambda17_ (BamfView* a, gboolean changed, UnityLauncherScrollerController* self); -static void __lambda17__bamf_view_user_visible_changed (BamfView* _sender, gboolean object, gpointer self); +static void _lambda18_ (BamfView* a, gboolean changed, UnityLauncherScrollerController* self); +static void __lambda18__bamf_view_user_visible_changed (BamfView* _sender, gboolean object, gpointer self); GType unity_launcher_application_controller_get_type (void); static UnityLauncherApplicationController* unity_launcher_scroller_controller_find_controller_by_desktop_file (UnityLauncherScrollerController* self, const char* desktop_file); void unity_launcher_application_controller_attach_application (UnityLauncherApplicationController* self, BamfApplication* application); @@ -227,7 +228,7 @@ static gpointer _g_object_ref0 (gpointer self) { } -static void _lambda17_ (BamfView* a, gboolean changed, UnityLauncherScrollerController* self) { +static void _lambda18_ (BamfView* a, gboolean changed, UnityLauncherScrollerController* self) { g_return_if_fail (a != NULL); if (changed) { BamfView* _tmp0_; @@ -236,8 +237,8 @@ static void _lambda17_ (BamfView* a, gboolean changed, UnityLauncherScrollerCont } -static void __lambda17__bamf_view_user_visible_changed (BamfView* _sender, gboolean object, gpointer self) { - _lambda17_ (_sender, object, self); +static void __lambda18__bamf_view_user_visible_changed (BamfView* _sender, gboolean object, gpointer self) { + _lambda18_ (_sender, object, self); } @@ -259,7 +260,7 @@ static void unity_launcher_scroller_controller_handle_bamf_view_opened (UnityLau _g_object_unref0 (app); return; } - g_signal_connect_object ((BamfView*) app, "user-visible-changed", (GCallback) __lambda17__bamf_view_user_visible_changed, self, 0); + g_signal_connect_object ((BamfView*) app, "user-visible-changed", (GCallback) __lambda18__bamf_view_user_visible_changed, self, 0); if (bamf_view_user_visible ((BamfView*) app)) { char* desktop_file; desktop_file = g_strdup (bamf_application_get_desktop_file (app)); diff --git a/unity-private/launcher/scroller-model.c b/unity-private/launcher/scroller-model.c index 9e20f09ef..42fce3e46 100644 --- a/unity-private/launcher/scroller-model.c +++ b/unity-private/launcher/scroller-model.c @@ -261,7 +261,7 @@ gint unity_launcher_scroller_model_index_of (UnityLauncherScrollerModel* self, U result = gee_abstract_list_index_of ((GeeAbstractList*) self->priv->children, child); return result; } - result = 0; + result = -1; return result; } diff --git a/unity-private/launcher/scroller-model.vala b/unity-private/launcher/scroller-model.vala index e39c8f95d..c838daa16 100644 --- a/unity-private/launcher/scroller-model.vala +++ b/unity-private/launcher/scroller-model.vala @@ -87,8 +87,8 @@ namespace Unity.Launcher return array[iter_index - 1]; } } - - public bool contains(ScrollerChild child) { + public bool contains(ScrollerChild child) + { return child in children; } @@ -132,7 +132,7 @@ namespace Unity.Launcher { return children.index_of (child); } - return 0; + return -1; } public void sort (CompareFunc compare) diff --git a/unity-private/launcher/scroller-view.c b/unity-private/launcher/scroller-view.c index 639f6a189..e496daf71 100644 --- a/unity-private/launcher/scroller-view.c +++ b/unity-private/launcher/scroller-view.c @@ -23,18 +23,33 @@ #include <glib.h> #include <glib-object.h> -#include <clutk/clutk.h> #include <float.h> #include <math.h> +#include <clutk/clutk.h> #include <unity.h> #include <clutter/clutter.h> #include <gee.h> #include <string.h> #include <stdlib.h> +#include <gobject/gvaluecollector.h> #define UNITY_LAUNCHER_TYPE_SCROLLER_PHASE (unity_launcher_scroller_phase_get_type ()) +#define UNITY_LAUNCHER_TYPE_SCROLLER_VIEW_TYPE (unity_launcher_scroller_view_type_get_type ()) + +#define UNITY_LAUNCHER_TYPE_CHILD_TRANSITION (unity_launcher_child_transition_get_type ()) +#define UNITY_LAUNCHER_CHILD_TRANSITION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_LAUNCHER_TYPE_CHILD_TRANSITION, UnityLauncherChildTransition)) +#define UNITY_LAUNCHER_CHILD_TRANSITION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_LAUNCHER_TYPE_CHILD_TRANSITION, UnityLauncherChildTransitionClass)) +#define UNITY_LAUNCHER_IS_CHILD_TRANSITION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_LAUNCHER_TYPE_CHILD_TRANSITION)) +#define UNITY_LAUNCHER_IS_CHILD_TRANSITION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_LAUNCHER_TYPE_CHILD_TRANSITION)) +#define UNITY_LAUNCHER_CHILD_TRANSITION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_LAUNCHER_TYPE_CHILD_TRANSITION, UnityLauncherChildTransitionClass)) + +typedef struct _UnityLauncherChildTransition UnityLauncherChildTransition; +typedef struct _UnityLauncherChildTransitionClass UnityLauncherChildTransitionClass; +typedef struct _UnityLauncherChildTransitionPrivate UnityLauncherChildTransitionPrivate; +typedef struct _UnityLauncherParamSpecChildTransition UnityLauncherParamSpecChildTransition; + #define UNITY_LAUNCHER_TYPE_SCROLLER_VIEW (unity_launcher_scroller_view_get_type ()) #define UNITY_LAUNCHER_SCROLLER_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_LAUNCHER_TYPE_SCROLLER_VIEW, UnityLauncherScrollerView)) #define UNITY_LAUNCHER_SCROLLER_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_LAUNCHER_TYPE_SCROLLER_VIEW, UnityLauncherScrollerViewClass)) @@ -78,6 +93,7 @@ typedef struct _UnityLauncherScrollerModelIterator UnityLauncherScrollerModelIte typedef struct _UnityLauncherScrollerModelIteratorClass UnityLauncherScrollerModelIteratorClass; #define _unity_launcher_scroller_model_iterator_unref0(var) ((var == NULL) ? NULL : (var = (unity_launcher_scroller_model_iterator_unref (var), NULL))) typedef struct _Block2Data Block2Data; +#define _unity_launcher_child_transition_unref0(var) ((var == NULL) ? NULL : (var = (unity_launcher_child_transition_unref (var), NULL))) #define UNITY_LAUNCHER_TYPE_LAUNCHER_CHILD (unity_launcher_launcher_child_get_type ()) #define UNITY_LAUNCHER_LAUNCHER_CHILD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_LAUNCHER_TYPE_LAUNCHER_CHILD, UnityLauncherLauncherChild)) @@ -109,6 +125,28 @@ typedef enum { UNITY_LAUNCHER_SCROLLER_PHASE_NONE } UnityLauncherScrollerPhase; +typedef enum { + UNITY_LAUNCHER_SCROLLER_VIEW_TYPE_EXPANDED, + UNITY_LAUNCHER_SCROLLER_VIEW_TYPE_CONTRACTED +} UnityLauncherScrollerViewType; + +struct _UnityLauncherChildTransition { + GTypeInstance parent_instance; + volatile int ref_count; + UnityLauncherChildTransitionPrivate * priv; + float position; + float rotation; +}; + +struct _UnityLauncherChildTransitionClass { + GTypeClass parent_class; + void (*finalize) (UnityLauncherChildTransition *self); +}; + +struct _UnityLauncherParamSpecChildTransition { + GParamSpec parent_instance; +}; + struct _UnityLauncherScrollerView { CtkActor parent_instance; UnityLauncherScrollerViewPrivate * priv; @@ -126,11 +164,11 @@ struct _UnityLauncherScrollerViewPrivate { UnityLauncherScrollerModel* _model; UnityThemeImage* bgtex; UnityThemeImage* top_shadow; - UnityThemeImage* bottom_fade; gboolean button_down; float total_child_height; UnityLauncherScrollerPhase current_phase; guint last_motion_event_time; + UnityLauncherScrollerViewType view_type; gboolean is_scrolling; float scroll_position; float settle_position; @@ -139,6 +177,10 @@ struct _UnityLauncherScrollerViewPrivate { guint previous_y_time; guint stored_delta; float scroll_speed; + float contract_icon_degrees; + gint focused_launcher; + GeeArrayList* draw_ftb; + GeeArrayList* draw_btf; GeeArrayList* child_refs; }; @@ -149,9 +191,24 @@ struct _Block2Data { }; +static gpointer unity_launcher_child_transition_parent_class = NULL; static gpointer unity_launcher_scroller_view_parent_class = NULL; GType unity_launcher_scroller_phase_get_type (void); +GType unity_launcher_scroller_view_type_get_type (void); +gpointer unity_launcher_child_transition_ref (gpointer instance); +void unity_launcher_child_transition_unref (gpointer instance); +GParamSpec* unity_launcher_param_spec_child_transition (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags); +void unity_launcher_value_set_child_transition (GValue* value, gpointer v_object); +void unity_launcher_value_take_child_transition (GValue* value, gpointer v_object); +gpointer unity_launcher_value_get_child_transition (const GValue* value); +GType unity_launcher_child_transition_get_type (void); +enum { + UNITY_LAUNCHER_CHILD_TRANSITION_DUMMY_PROPERTY +}; +UnityLauncherChildTransition* unity_launcher_child_transition_new (void); +UnityLauncherChildTransition* unity_launcher_child_transition_construct (GType object_type); +static void unity_launcher_child_transition_finalize (UnityLauncherChildTransition* obj); GType unity_launcher_scroller_view_get_type (void); GType unity_launcher_scroller_model_get_type (void); GType unity_launcher_scroller_child_get_type (void); @@ -173,13 +230,14 @@ GType unity_launcher_scroller_model_iterator_get_type (void); UnityLauncherScrollerModelIterator* unity_launcher_scroller_model_iterator (UnityLauncherScrollerModel* self); gboolean unity_launcher_scroller_model_iterator_next (UnityLauncherScrollerModelIterator* self); UnityLauncherScrollerChild* unity_launcher_scroller_model_iterator_get (UnityLauncherScrollerModelIterator* self); +float unity_launcher_scroller_child_get_position (UnityLauncherScrollerChild* self); +gint unity_launcher_scroller_model_get_size (UnityLauncherScrollerModel* self); gint unity_launcher_scroller_view_get_model_index_at_y_pos (UnityLauncherScrollerView* self, float y); static void unity_launcher_scroller_view_load_textures (UnityLauncherScrollerView* self); +static void unity_launcher_scroller_view_order_children (UnityLauncherScrollerView* self, gboolean immediate); static void unity_launcher_scroller_view_move_scroll_position (UnityLauncherScrollerView* self, float pixels); static void unity_launcher_scroller_view_disable_animations_on_children (UnityLauncherScrollerView* self, ClutterEvent* event); gint unity_launcher_scroller_model_index_of (UnityLauncherScrollerModel* self, UnityLauncherScrollerChild* child); -gint unity_launcher_scroller_model_get_size (UnityLauncherScrollerModel* self); -static void unity_launcher_scroller_view_order_children (UnityLauncherScrollerView* self, gboolean immediate); static void _lambda14_ (UnityLauncherScrollerView* self); static void __lambda14__g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self); static void unity_launcher_scroller_view_model_child_added (UnityLauncherScrollerView* self, UnityLauncherScrollerChild* child); @@ -196,14 +254,22 @@ static gboolean unity_launcher_scroller_view_on_button_press_event (UnityLaunche static gboolean unity_launcher_scroller_view_on_motion_event (UnityLauncherScrollerView* self, ClutterEvent* event); static gboolean _unity_launcher_scroller_view_on_motion_event_clutter_actor_motion_event (ClutterActor* _sender, ClutterEvent* event, gpointer self); static float unity_launcher_scroller_view_get_aligned_settle_position (UnityLauncherScrollerView* self); +static float unity_launcher_scroller_view_get_total_children_height (UnityLauncherScrollerView* self); +static float unity_launcher_scroller_view_get_available_height (UnityLauncherScrollerView* self); +UnityLauncherScrollerChild* unity_launcher_scroller_model_get (UnityLauncherScrollerModel* self, gint i); +static gboolean unity_launcher_scroller_view_on_enter_event (UnityLauncherScrollerView* self, ClutterEvent* event); +static gboolean unity_launcher_scroller_view_on_leave_event (UnityLauncherScrollerView* self, ClutterEvent* event); static void unity_launcher_scroller_view_do_anim_settle (UnityLauncherScrollerView* self, ClutterTimeline* timeline, gint msecs); static void unity_launcher_scroller_view_do_anim_fling (UnityLauncherScrollerView* self, ClutterTimeline* timeline, gint msecs); static void unity_launcher_scroller_view_do_anim_bounce (UnityLauncherScrollerView* self, ClutterTimeline* timeline, gint msecs); static void unity_launcher_scroller_view_on_scroller_frame (UnityLauncherScrollerView* self, ClutterTimeline* timeline, gint msecs); static void unity_launcher_scroller_view_real_get_preferred_width (ClutterActor* base, float for_height, float* minimum_width, float* natural_width); static void unity_launcher_scroller_view_real_get_preferred_height (ClutterActor* base, float for_width, float* minimum_height, float* natural_height); -float unity_launcher_scroller_child_get_position (UnityLauncherScrollerChild* self); +static GeeArrayList* unity_launcher_scroller_view_order_children_expanded (UnityLauncherScrollerView* self); +static GeeArrayList* unity_launcher_scroller_view_order_children_contracted (UnityLauncherScrollerView* self); void unity_launcher_scroller_child_set_position (UnityLauncherScrollerChild* self, float value); +void unity_launcher_scroller_child_force_rotation_jump (UnityLauncherScrollerChild* self, float degrees); +void unity_launcher_scroller_child_set_rotation (UnityLauncherScrollerChild* self, float value); static void unity_launcher_scroller_view_real_allocate (ClutterActor* base, const ClutterActorBox* box, ClutterAllocationFlags flags); static void unity_launcher_scroller_view_real_pick (ClutterActor* base, const ClutterColor* color); GType unity_launcher_launcher_child_get_type (void); @@ -224,9 +290,13 @@ static void _unity_launcher_scroller_view_model_child_added_unity_launcher_scrol static void _unity_launcher_scroller_view_model_child_removed_unity_launcher_scroller_model_child_removed (UnityLauncherScrollerModel* _sender, UnityLauncherScrollerChild* child, gpointer self); static void _unity_launcher_scroller_view_model_order_changed_unity_launcher_scroller_model_order_changed (UnityLauncherScrollerModel* _sender, gpointer self); static gboolean _unity_launcher_scroller_view_on_button_press_event_clutter_actor_button_press_event (ClutterActor* _sender, ClutterEvent* event, gpointer self); +static gboolean _unity_launcher_scroller_view_on_enter_event_clutter_actor_enter_event (ClutterActor* _sender, ClutterEvent* event, gpointer self); +static gboolean _unity_launcher_scroller_view_on_leave_event_clutter_actor_leave_event (ClutterActor* _sender, ClutterEvent* event, gpointer self); static void _unity_launcher_scroller_view_on_scroller_frame_clutter_timeline_new_frame (ClutterTimeline* _sender, gint msecs, gpointer self); static void _lambda16_ (UnityLauncherScrollerView* self); static void __lambda16__unity_drag_controller_drag_start (UnityDragController* _sender, UnityDragModel* model, gpointer self); +static gboolean _lambda17_ (UnityLauncherScrollerView* self); +static gboolean __lambda17__gsource_func (gpointer self); static GObject * unity_launcher_scroller_view_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void unity_launcher_scroller_view_finalize (GObject* obj); static void unity_launcher_scroller_view_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); @@ -246,6 +316,189 @@ GType unity_launcher_scroller_phase_get_type (void) { } +GType unity_launcher_scroller_view_type_get_type (void) { + static volatile gsize unity_launcher_scroller_view_type_type_id__volatile = 0; + if (g_once_init_enter (&unity_launcher_scroller_view_type_type_id__volatile)) { + static const GEnumValue values[] = {{UNITY_LAUNCHER_SCROLLER_VIEW_TYPE_EXPANDED, "UNITY_LAUNCHER_SCROLLER_VIEW_TYPE_EXPANDED", "expanded"}, {UNITY_LAUNCHER_SCROLLER_VIEW_TYPE_CONTRACTED, "UNITY_LAUNCHER_SCROLLER_VIEW_TYPE_CONTRACTED", "contracted"}, {0, NULL, NULL}}; + GType unity_launcher_scroller_view_type_type_id; + unity_launcher_scroller_view_type_type_id = g_enum_register_static ("UnityLauncherScrollerViewType", values); + g_once_init_leave (&unity_launcher_scroller_view_type_type_id__volatile, unity_launcher_scroller_view_type_type_id); + } + return unity_launcher_scroller_view_type_type_id__volatile; +} + + +UnityLauncherChildTransition* unity_launcher_child_transition_construct (GType object_type) { + UnityLauncherChildTransition* self; + self = (UnityLauncherChildTransition*) g_type_create_instance (object_type); + return self; +} + + +UnityLauncherChildTransition* unity_launcher_child_transition_new (void) { + return unity_launcher_child_transition_construct (UNITY_LAUNCHER_TYPE_CHILD_TRANSITION); +} + + +static void unity_launcher_value_child_transition_init (GValue* value) { + value->data[0].v_pointer = NULL; +} + + +static void unity_launcher_value_child_transition_free_value (GValue* value) { + if (value->data[0].v_pointer) { + unity_launcher_child_transition_unref (value->data[0].v_pointer); + } +} + + +static void unity_launcher_value_child_transition_copy_value (const GValue* src_value, GValue* dest_value) { + if (src_value->data[0].v_pointer) { + dest_value->data[0].v_pointer = unity_launcher_child_transition_ref (src_value->data[0].v_pointer); + } else { + dest_value->data[0].v_pointer = NULL; + } +} + + +static gpointer unity_launcher_value_child_transition_peek_pointer (const GValue* value) { + return value->data[0].v_pointer; +} + + +static gchar* unity_launcher_value_child_transition_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + if (collect_values[0].v_pointer) { + UnityLauncherChildTransition* object; + object = collect_values[0].v_pointer; + if (object->parent_instance.g_class == NULL) { + return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); + } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) { + return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL); + } + value->data[0].v_pointer = unity_launcher_child_transition_ref (object); + } else { + value->data[0].v_pointer = NULL; + } + return NULL; +} + + +static gchar* unity_launcher_value_child_transition_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) { + UnityLauncherChildTransition** object_p; + object_p = collect_values[0].v_pointer; + if (!object_p) { + return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value)); + } + if (!value->data[0].v_pointer) { + *object_p = NULL; + } else if (collect_flags && G_VALUE_NOCOPY_CONTENTS) { + *object_p = value->data[0].v_pointer; + } else { + *object_p = unity_launcher_child_transition_ref (value->data[0].v_pointer); + } + return NULL; +} + + +GParamSpec* unity_launcher_param_spec_child_transition (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) { + UnityLauncherParamSpecChildTransition* spec; + g_return_val_if_fail (g_type_is_a (object_type, UNITY_LAUNCHER_TYPE_CHILD_TRANSITION), NULL); + spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags); + G_PARAM_SPEC (spec)->value_type = object_type; + return G_PARAM_SPEC (spec); +} + + +gpointer unity_launcher_value_get_child_transition (const GValue* value) { + g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, UNITY_LAUNCHER_TYPE_CHILD_TRANSITION), NULL); + return value->data[0].v_pointer; +} + + +void unity_launcher_value_set_child_transition (GValue* value, gpointer v_object) { + UnityLauncherChildTransition* old; + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, UNITY_LAUNCHER_TYPE_CHILD_TRANSITION)); + old = value->data[0].v_pointer; + if (v_object) { + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, UNITY_LAUNCHER_TYPE_CHILD_TRANSITION)); + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); + value->data[0].v_pointer = v_object; + unity_launcher_child_transition_ref (value->data[0].v_pointer); + } else { + value->data[0].v_pointer = NULL; + } + if (old) { + unity_launcher_child_transition_unref (old); + } +} + + +void unity_launcher_value_take_child_transition (GValue* value, gpointer v_object) { + UnityLauncherChildTransition* old; + g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, UNITY_LAUNCHER_TYPE_CHILD_TRANSITION)); + old = value->data[0].v_pointer; + if (v_object) { + g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, UNITY_LAUNCHER_TYPE_CHILD_TRANSITION)); + g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value))); + value->data[0].v_pointer = v_object; + } else { + value->data[0].v_pointer = NULL; + } + if (old) { + unity_launcher_child_transition_unref (old); + } +} + + +static void unity_launcher_child_transition_class_init (UnityLauncherChildTransitionClass * klass) { + unity_launcher_child_transition_parent_class = g_type_class_peek_parent (klass); + UNITY_LAUNCHER_CHILD_TRANSITION_CLASS (klass)->finalize = unity_launcher_child_transition_finalize; +} + + +static void unity_launcher_child_transition_instance_init (UnityLauncherChildTransition * self) { + self->ref_count = 1; +} + + +static void unity_launcher_child_transition_finalize (UnityLauncherChildTransition* obj) { + UnityLauncherChildTransition * self; + self = UNITY_LAUNCHER_CHILD_TRANSITION (obj); +} + + +GType unity_launcher_child_transition_get_type (void) { + static volatile gsize unity_launcher_child_transition_type_id__volatile = 0; + if (g_once_init_enter (&unity_launcher_child_transition_type_id__volatile)) { + static const GTypeValueTable g_define_type_value_table = { unity_launcher_value_child_transition_init, unity_launcher_value_child_transition_free_value, unity_launcher_value_child_transition_copy_value, unity_launcher_value_child_transition_peek_pointer, "p", unity_launcher_value_child_transition_collect_value, "p", unity_launcher_value_child_transition_lcopy_value }; + static const GTypeInfo g_define_type_info = { sizeof (UnityLauncherChildTransitionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_launcher_child_transition_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityLauncherChildTransition), 0, (GInstanceInitFunc) unity_launcher_child_transition_instance_init, &g_define_type_value_table }; + static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) }; + GType unity_launcher_child_transition_type_id; + unity_launcher_child_transition_type_id = g_type_register_fundamental (g_type_fundamental_next (), "UnityLauncherChildTransition", &g_define_type_info, &g_define_type_fundamental_info, 0); + g_once_init_leave (&unity_launcher_child_transition_type_id__volatile, unity_launcher_child_transition_type_id); + } + return unity_launcher_child_transition_type_id__volatile; +} + + +gpointer unity_launcher_child_transition_ref (gpointer instance) { + UnityLauncherChildTransition* self; + self = instance; + g_atomic_int_inc (&self->ref_count); + return instance; +} + + +void unity_launcher_child_transition_unref (gpointer instance) { + UnityLauncherChildTransition* self; + self = instance; + if (g_atomic_int_dec_and_test (&self->ref_count)) { + UNITY_LAUNCHER_CHILD_TRANSITION_GET_CLASS (self)->finalize (self); + g_type_free_instance ((GTypeInstance *) self); + } +} + + UnityLauncherScrollerView* unity_launcher_scroller_view_construct (GType object_type, UnityLauncherScrollerModel* _model) { UnityLauncherScrollerView * self; g_return_val_if_fail (_model != NULL, NULL); @@ -261,12 +514,12 @@ UnityLauncherScrollerView* unity_launcher_scroller_view_new (UnityLauncherScroll gint unity_launcher_scroller_view_get_model_index_at_y_pos (UnityLauncherScrollerView* self, float y) { gint result = 0; - float h; - float min_height = 0.0F; - float nat_height = 0.0F; + float pos_x = 0.0F; + float pos_y = 0.0F; gint i; g_return_val_if_fail (self != NULL, 0); - h = 0.0f; + clutter_actor_get_position ((ClutterActor*) self, &pos_x, &pos_y); + y = y - pos_y; i = 0; { UnityLauncherScrollerModelIterator* _child_it; @@ -279,21 +532,19 @@ gint unity_launcher_scroller_view_get_model_index_at_y_pos (UnityLauncherScrolle break; } child = unity_launcher_scroller_model_iterator_get (_child_it); - transformed_pos = (h + self->priv->scroll_position) + (ctk_actor_get_padding ((CtkActor*) self, &_tmp0_), _tmp0_.top); + transformed_pos = unity_launcher_scroller_child_get_position (child) + (ctk_actor_get_padding ((CtkActor*) self, &_tmp0_), _tmp0_.top); if (transformed_pos > y) { result = i; _g_object_unref0 (child); _unity_launcher_scroller_model_iterator_unref0 (_child_it); return result; } - clutter_actor_get_preferred_height ((ClutterActor*) child, clutter_actor_get_width ((ClutterActor*) self), &min_height, &nat_height); - h = h + (nat_height + self->spacing); i++; _g_object_unref0 (child); } _unity_launcher_scroller_model_iterator_unref0 (_child_it); } - result = MAX (i, 0); + result = MIN (MAX (i, 0), unity_launcher_scroller_model_get_size (self->priv->_model) - 1); return result; } @@ -301,7 +552,6 @@ gint unity_launcher_scroller_view_get_model_index_at_y_pos (UnityLauncherScrolle static void unity_launcher_scroller_view_load_textures (UnityLauncherScrollerView* self) { UnityThemeImage* _tmp0_; UnityThemeImage* _tmp1_; - UnityThemeImage* _tmp2_; g_return_if_fail (self != NULL); self->priv->bgtex = (_tmp0_ = g_object_ref_sink (unity_theme_image_new ("launcher_background_middle")), _g_object_unref0 (self->priv->bgtex), _tmp0_); clutter_texture_set_repeat ((ClutterTexture*) self->priv->bgtex, TRUE, TRUE); @@ -309,15 +559,13 @@ static void unity_launcher_scroller_view_load_textures (UnityLauncherScrollerVie self->priv->top_shadow = (_tmp1_ = g_object_ref_sink (unity_theme_image_new ("overflow_top")), _g_object_unref0 (self->priv->top_shadow), _tmp1_); clutter_texture_set_repeat ((ClutterTexture*) self->priv->top_shadow, TRUE, FALSE); clutter_actor_set_parent ((ClutterActor*) self->priv->top_shadow, (ClutterActor*) self); - self->priv->bottom_fade = (_tmp2_ = g_object_ref_sink (unity_theme_image_new ("overflow_bottom")), _g_object_unref0 (self->priv->bottom_fade), _tmp2_); - clutter_texture_set_repeat ((ClutterTexture*) self->priv->bottom_fade, TRUE, FALSE); - clutter_actor_set_parent ((ClutterActor*) self->priv->bottom_fade, (ClutterActor*) self); } static void unity_launcher_scroller_view_move_scroll_position (UnityLauncherScrollerView* self, float pixels) { g_return_if_fail (self != NULL); self->priv->scroll_position = self->priv->scroll_position + pixels; + unity_launcher_scroller_view_order_children (self, TRUE); clutter_actor_queue_relayout ((ClutterActor*) self); } @@ -438,7 +686,9 @@ static void unity_launcher_scroller_view_model_order_changed (UnityLauncherScrol static gboolean _unity_launcher_scroller_view_on_button_release_event_clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_launcher_scroller_view_on_button_release_event (self, event); + gboolean result; + result = unity_launcher_scroller_view_on_button_release_event (self, event); + return result; } @@ -459,7 +709,9 @@ static gboolean unity_launcher_scroller_view_on_button_press_event (UnityLaunche static gboolean _unity_launcher_scroller_view_on_motion_event_clutter_actor_motion_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_launcher_scroller_view_on_motion_event (self, event); + gboolean result; + result = unity_launcher_scroller_view_on_motion_event (self, event); + return result; } @@ -508,10 +760,69 @@ static gboolean unity_launcher_scroller_view_on_button_release_event (UnityLaunc } +static gboolean unity_launcher_scroller_view_on_enter_event (UnityLauncherScrollerView* self, ClutterEvent* event) { + gboolean result = FALSE; + g_return_val_if_fail (self != NULL, FALSE); + if (self->priv->view_type == UNITY_LAUNCHER_SCROLLER_VIEW_TYPE_EXPANDED) { + result = FALSE; + return result; + } + self->priv->view_type = UNITY_LAUNCHER_SCROLLER_VIEW_TYPE_EXPANDED; + unity_shell_add_fullscreen_request (unity_global_shell, (GObject*) self); + if (unity_launcher_scroller_view_get_total_children_height (self) > unity_launcher_scroller_view_get_available_height (self)) { + gint index; + float old_scroll_position; + UnityLauncherScrollerChild* _tmp0_; + float _tmp1_; + float child_height; + UnityLauncherScrollerChild* _tmp2_; + float _tmp3_; + float new_scroll_position; + index = unity_launcher_scroller_view_get_model_index_at_y_pos (self, (*event).crossing.y); + old_scroll_position = self->priv->scroll_position; + self->priv->scroll_position = (float) 0; + unity_launcher_scroller_view_order_children (self, TRUE); + child_height = (_tmp1_ = clutter_actor_get_height ((ClutterActor*) (_tmp0_ = unity_launcher_scroller_model_get (self->priv->_model, index))) / 2, _g_object_unref0 (_tmp0_), _tmp1_); + new_scroll_position = (_tmp3_ = (-unity_launcher_scroller_child_get_position (_tmp2_ = unity_launcher_scroller_model_get (self->priv->_model, index))) + (*event).crossing.y, _g_object_unref0 (_tmp2_), _tmp3_); + self->priv->view_type = UNITY_LAUNCHER_SCROLLER_VIEW_TYPE_CONTRACTED; + self->priv->scroll_position = old_scroll_position; + unity_launcher_scroller_view_order_children (self, TRUE); + self->priv->view_type = UNITY_LAUNCHER_SCROLLER_VIEW_TYPE_EXPANDED; + self->priv->scroll_position = new_scroll_position; + unity_launcher_scroller_view_order_children (self, FALSE); + clutter_actor_queue_relayout ((ClutterActor*) self); + } + result = FALSE; + return result; +} + + +static gboolean unity_launcher_scroller_view_on_leave_event (UnityLauncherScrollerView* self, ClutterEvent* event) { + gboolean result = FALSE; + g_return_val_if_fail (self != NULL, FALSE); + if (self->priv->view_type == UNITY_LAUNCHER_SCROLLER_VIEW_TYPE_CONTRACTED) { + result = FALSE; + return result; + } + if ((*event).crossing.x < (clutter_actor_get_width ((ClutterActor*) self) - 1)) { + result = FALSE; + return result; + } + unity_shell_remove_fullscreen_request (unity_global_shell, (GObject*) self); + self->priv->focused_launcher = unity_launcher_scroller_view_get_model_index_at_y_pos (self, (*event).crossing.y); + self->priv->view_type = UNITY_LAUNCHER_SCROLLER_VIEW_TYPE_CONTRACTED; + unity_launcher_scroller_view_order_children (self, FALSE); + clutter_actor_queue_relayout ((ClutterActor*) self); + result = FALSE; + return result; +} + + static gboolean unity_launcher_scroller_view_on_motion_event (UnityLauncherScrollerView* self, ClutterEvent* event) { gboolean result = FALSE; UnityDragController* drag_controller; gboolean _tmp0_ = FALSE; + gboolean _tmp1_ = FALSE; g_return_val_if_fail (self != NULL, FALSE); drag_controller = _g_object_ref0 (unity_drag_controller_get_default ()); if (unity_drag_controller_get_is_dragging (drag_controller)) { @@ -521,7 +832,12 @@ static gboolean unity_launcher_scroller_view_on_motion_event (UnityLauncherScrol } self->priv->last_motion_event_time = (guint) (*event).motion.time; if (self->priv->button_down) { - _tmp0_ = self->priv->is_scrolling == FALSE; + _tmp1_ = self->priv->is_scrolling == FALSE; + } else { + _tmp1_ = FALSE; + } + if (_tmp1_) { + _tmp0_ = self->priv->view_type != UNITY_LAUNCHER_SCROLLER_VIEW_TYPE_CONTRACTED; } else { _tmp0_ = FALSE; } @@ -795,39 +1111,283 @@ static void unity_launcher_scroller_view_real_get_preferred_height (ClutterActor static void unity_launcher_scroller_view_order_children (UnityLauncherScrollerView* self, gboolean immediate) { + GeeArrayList* transitions; + g_return_if_fail (self != NULL); + transitions = NULL; + if (unity_launcher_scroller_view_get_total_children_height (self) < unity_launcher_scroller_view_get_available_height (self)) { + GeeArrayList* _tmp0_; + transitions = (_tmp0_ = unity_launcher_scroller_view_order_children_expanded (self), _g_object_unref0 (transitions), _tmp0_); + } else { + switch (self->priv->view_type) { + case UNITY_LAUNCHER_SCROLLER_VIEW_TYPE_CONTRACTED: + { + GeeArrayList* _tmp1_; + transitions = (_tmp1_ = unity_launcher_scroller_view_order_children_contracted (self), _g_object_unref0 (transitions), _tmp1_); + break; + } + case UNITY_LAUNCHER_SCROLLER_VIEW_TYPE_EXPANDED: + { + GeeArrayList* _tmp2_; + transitions = (_tmp2_ = unity_launcher_scroller_view_order_children_expanded (self), _g_object_unref0 (transitions), _tmp2_); + break; + } + default: + { + g_assert_not_reached (); + } + } + } + { + gint index; + index = 0; + { + gboolean _tmp3_; + _tmp3_ = TRUE; + while (TRUE) { + UnityLauncherScrollerChild* child; + if (!_tmp3_) { + index++; + } + _tmp3_ = FALSE; + if (!(index < unity_launcher_scroller_model_get_size (self->priv->_model))) { + break; + } + child = unity_launcher_scroller_model_get (self->priv->_model, index); + if (immediate) { + UnityLauncherChildTransition* _tmp4_; + UnityLauncherChildTransition* _tmp5_; + unity_launcher_scroller_child_set_position (child, (_tmp4_ = (UnityLauncherChildTransition*) gee_abstract_list_get ((GeeAbstractList*) transitions, index))->position); + _unity_launcher_child_transition_unref0 (_tmp4_); + unity_launcher_scroller_child_force_rotation_jump (child, (_tmp5_ = (UnityLauncherChildTransition*) gee_abstract_list_get ((GeeAbstractList*) transitions, index))->rotation); + _unity_launcher_child_transition_unref0 (_tmp5_); + } else { + UnityLauncherChildTransition* _tmp6_; + UnityLauncherChildTransition* _tmp7_; + if (CLUTTER_IS_ANIMATION (clutter_actor_get_animation ((ClutterActor*) child))) { + float current_pos; + current_pos = unity_launcher_scroller_child_get_position (child); + clutter_animation_completed (clutter_actor_get_animation ((ClutterActor*) child)); + unity_launcher_scroller_child_set_position (child, current_pos); + } + unity_launcher_scroller_child_set_rotation (child, (_tmp6_ = (UnityLauncherChildTransition*) gee_abstract_list_get ((GeeAbstractList*) transitions, index))->rotation); + _unity_launcher_child_transition_unref0 (_tmp6_); + clutter_actor_animate ((ClutterActor*) child, (gulong) CLUTTER_EASE_IN_OUT_QUAD, (guint) 300, "position", (_tmp7_ = (UnityLauncherChildTransition*) gee_abstract_list_get ((GeeAbstractList*) transitions, index))->position, NULL); + _unity_launcher_child_transition_unref0 (_tmp7_); + } + _g_object_unref0 (child); + } + } + } + _g_object_unref0 (transitions); +} + + +static GeeArrayList* unity_launcher_scroller_view_order_children_expanded (UnityLauncherScrollerView* self) { + GeeArrayList* result = NULL; + GeeArrayList* ret_transitions; float h; float min_height = 0.0F; float nat_height = 0.0F; - g_return_if_fail (self != NULL); + GeeArrayList* _tmp1_; + g_return_val_if_fail (self != NULL, NULL); + ret_transitions = gee_array_list_new (UNITY_LAUNCHER_TYPE_CHILD_TRANSITION, (GBoxedCopyFunc) unity_launcher_child_transition_ref, unity_launcher_child_transition_unref, NULL); h = 0.0f; + if (!GEE_IS_ARRAY_LIST (self->priv->draw_ftb)) { + GeeArrayList* _tmp0_; + self->priv->draw_ftb = (_tmp0_ = gee_array_list_new (UNITY_LAUNCHER_TYPE_SCROLLER_CHILD, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL), _g_object_unref0 (self->priv->draw_ftb), _tmp0_); + } + self->priv->draw_btf = (_tmp1_ = gee_array_list_new (UNITY_LAUNCHER_TYPE_SCROLLER_CHILD, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL), _g_object_unref0 (self->priv->draw_btf), _tmp1_); { UnityLauncherScrollerModelIterator* _child_it; _child_it = unity_launcher_scroller_model_iterator (self->priv->_model); while (TRUE) { UnityLauncherScrollerChild* child; + UnityLauncherChildTransition* transition; + gboolean _tmp2_ = FALSE; if (!unity_launcher_scroller_model_iterator_next (_child_it)) { break; } child = unity_launcher_scroller_model_iterator_get (_child_it); clutter_actor_get_preferred_height ((ClutterActor*) child, clutter_actor_get_width ((ClutterActor*) self), &min_height, &nat_height); - if (h != unity_launcher_scroller_child_get_position (child)) { - if (!immediate) { - if (CLUTTER_IS_ANIMATION (clutter_actor_get_animation ((ClutterActor*) child))) { - float current_pos; - current_pos = unity_launcher_scroller_child_get_position (child); - clutter_animation_completed (clutter_actor_get_animation ((ClutterActor*) child)); - unity_launcher_scroller_child_set_position (child, current_pos); + transition = unity_launcher_child_transition_new (); + transition->position = h + self->priv->scroll_position; + transition->rotation = 0.0f; + gee_abstract_collection_add ((GeeAbstractCollection*) ret_transitions, transition); + if (gee_abstract_collection_contains ((GeeAbstractCollection*) self->priv->draw_ftb, child)) { + _tmp2_ = TRUE; + } else { + _tmp2_ = gee_abstract_collection_contains ((GeeAbstractCollection*) self->priv->draw_ftb, child); + } + if (!_tmp2_) { + gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->draw_ftb, child); + } + h = h + (nat_height + self->spacing); + _g_object_unref0 (child); + _unity_launcher_child_transition_unref0 (transition); + } + _unity_launcher_scroller_model_iterator_unref0 (_child_it); + } + result = ret_transitions; + return result; +} + + +static GeeArrayList* unity_launcher_scroller_view_order_children_contracted (UnityLauncherScrollerView* self) { + GeeArrayList* result = NULL; + GeeArrayList* ret_transitions; + float h; + float min_height = 0.0F; + float nat_height = 0.0F; + gint num_launchers; + float total_child_height; + gint num_children_handled; + gint index_start_flat = 0; + gint index_end_flat; + GeeArrayList* _tmp1_; + GeeArrayList* _tmp2_; + g_return_val_if_fail (self != NULL, NULL); + ret_transitions = gee_array_list_new (UNITY_LAUNCHER_TYPE_CHILD_TRANSITION, (GBoxedCopyFunc) unity_launcher_child_transition_ref, unity_launcher_child_transition_unref, NULL); + h = 0.0f; + num_launchers = 0; + total_child_height = unity_launcher_scroller_view_get_total_children_height (self); + if (total_child_height > unity_launcher_scroller_view_get_available_height (self)) { + num_launchers = (gint) floorf ((unity_launcher_scroller_view_get_available_height (self) - (self->spacing * 2)) / (48.0f + self->spacing)); + { + gboolean _tmp0_; + _tmp0_ = TRUE; + while (TRUE) { + float flat_space; + float contracted_space; + if (!_tmp0_) { + num_launchers--; + } + _tmp0_ = FALSE; + if (!(num_launchers >= 1)) { + break; + } + flat_space = num_launchers * (48.0f + self->spacing); + contracted_space = 0.0f; + contracted_space = (float) ((unity_launcher_scroller_model_get_size (self->priv->_model) - num_launchers) * (8 + self->spacing)); + if ((flat_space + contracted_space) < (unity_launcher_scroller_view_get_available_height (self) - (self->spacing * 2))) { + break; + } + } + } + num_launchers = MAX (num_launchers, 1); + } else { + num_launchers = unity_launcher_scroller_model_get_size (self->priv->_model); + } + num_children_handled = 0; + index_end_flat = 0; + if (self->priv->focused_launcher < (unity_launcher_scroller_model_get_size (self->priv->_model) - (num_launchers - (num_launchers / 2)))) { + index_start_flat = MAX (0, self->priv->focused_launcher - (num_launchers / 2)); + index_end_flat = index_start_flat + num_launchers; + } else { + index_end_flat = unity_launcher_scroller_model_get_size (self->priv->_model); + index_start_flat = index_end_flat - num_launchers; + } + self->priv->draw_ftb = (_tmp1_ = gee_array_list_new (UNITY_LAUNCHER_TYPE_SCROLLER_CHILD, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL), _g_object_unref0 (self->priv->draw_ftb), _tmp1_); + self->priv->draw_btf = (_tmp2_ = gee_array_list_new (UNITY_LAUNCHER_TYPE_SCROLLER_CHILD, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL), _g_object_unref0 (self->priv->draw_btf), _tmp2_); + { + gint index; + index = 0; + { + gboolean _tmp3_; + _tmp3_ = TRUE; + while (TRUE) { + UnityLauncherScrollerChild* child; + UnityLauncherChildTransition* transition; + gboolean _tmp4_ = FALSE; + if (!_tmp3_) { + index++; + } + _tmp3_ = FALSE; + if (!(index < unity_launcher_scroller_model_get_size (self->priv->_model))) { + break; + } + child = unity_launcher_scroller_model_get (self->priv->_model, index); + transition = unity_launcher_child_transition_new (); + if (index >= index_start_flat) { + _tmp4_ = index < index_end_flat; + } else { + _tmp4_ = FALSE; + } + if (_tmp4_) { + clutter_actor_get_preferred_height ((ClutterActor*) child, clutter_actor_get_width ((ClutterActor*) self), &min_height, &nat_height); + transition->position = h; + h = h + (nat_height + self->spacing); + num_children_handled++; + transition->rotation = 0.0f; + if (index == index_start_flat) { + gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->draw_ftb, child); + } else { + gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->draw_btf, child); } - clutter_actor_animate ((ClutterActor*) child, (gulong) CLUTTER_EASE_IN_OUT_QUAD, (guint) 170, "position", h, NULL); } else { - unity_launcher_scroller_child_set_position (child, h); + if (index == index_end_flat) { + h = h - ((float) self->spacing); + } + transition->position = h; + h = h + ((float) (8 + self->spacing)); + if (num_children_handled < index_start_flat) { + transition->rotation = -self->priv->contract_icon_degrees; + gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->draw_ftb, child); + } else { + transition->rotation = self->priv->contract_icon_degrees; + gee_abstract_collection_add ((GeeAbstractCollection*) self->priv->draw_btf, child); + } + num_children_handled++; + if ((index + 1) == index_start_flat) { + h = h + ((float) 30); + } } + gee_abstract_collection_add ((GeeAbstractCollection*) ret_transitions, transition); + _g_object_unref0 (child); + _unity_launcher_child_transition_unref0 (transition); + } + } + } + result = ret_transitions; + return result; +} + + +static float unity_launcher_scroller_view_get_total_children_height (UnityLauncherScrollerView* self) { + float result = 0.0F; + float h; + float min_height = 0.0F; + float nat_height = 0.0F; + g_return_val_if_fail (self != NULL, 0.0F); + h = 0.0f; + { + UnityLauncherScrollerModelIterator* _child_it; + _child_it = unity_launcher_scroller_model_iterator (self->priv->_model); + while (TRUE) { + UnityLauncherScrollerChild* child; + if (!unity_launcher_scroller_model_iterator_next (_child_it)) { + break; } + child = unity_launcher_scroller_model_iterator_get (_child_it); + clutter_actor_get_preferred_height ((ClutterActor*) child, clutter_actor_get_width ((ClutterActor*) self), &min_height, &nat_height); h = h + (nat_height + self->spacing); _g_object_unref0 (child); } _unity_launcher_scroller_model_iterator_unref0 (_child_it); } + result = h; + return result; +} + + +static float unity_launcher_scroller_view_get_available_height (UnityLauncherScrollerView* self) { + float result = 0.0F; + ClutterActorBox box = {0}; + CtkPadding _tmp0_ = {0}; + CtkPadding _tmp1_ = {0}; + g_return_val_if_fail (self != NULL, 0.0F); + ctk_actor_get_stored_allocation ((CtkActor*) self, &box); + result = (clutter_actor_box_get_height (&box) - (ctk_actor_get_padding ((CtkActor*) self, &_tmp0_), _tmp0_.top)) - (ctk_actor_get_padding ((CtkActor*) self, &_tmp1_), _tmp1_.bottom); + return result; } @@ -871,7 +1431,7 @@ static void unity_launcher_scroller_view_real_allocate (ClutterActor* base, cons child_height = fmaxf (min, fminf (natural, available_height)); child_box.x1 = current_width; child_box.x2 = clutter_actor_box_get_width (box) - (ctk_actor_get_padding ((CtkActor*) self, &_tmp3_), _tmp3_.right); - child_box.y1 = (unity_launcher_scroller_child_get_position (child) + (ctk_actor_get_padding ((CtkActor*) self, &_tmp4_), _tmp4_.top)) + self->priv->scroll_position; + child_box.y1 = unity_launcher_scroller_child_get_position (child) + (ctk_actor_get_padding ((CtkActor*) self, &_tmp4_), _tmp4_.top); child_box.y2 = child_box.y1 + child_height; clutter_actor_allocate ((ClutterActor*) child, &child_box, flags); self->priv->total_child_height = self->priv->total_child_height + (child_height + self->spacing); @@ -890,10 +1450,6 @@ static void unity_launcher_scroller_view_real_allocate (ClutterActor* base, cons child_box.y1 = (float) (-1); child_box.y2 = (float) (bg_height - 1); clutter_actor_allocate ((ClutterActor*) self->priv->top_shadow, &child_box, flags); - clutter_texture_get_base_size ((ClutterTexture*) self->priv->bottom_fade, &bg_width, &bg_height); - child_box.y1 = clutter_actor_box_get_height (box) - bg_height; - child_box.y2 = clutter_actor_box_get_height (box); - clutter_actor_allocate ((ClutterActor*) self->priv->bottom_fade, &child_box, flags); } @@ -923,27 +1479,57 @@ static void unity_launcher_scroller_view_real_paint (ClutterActor* base) { self = (UnityLauncherScrollerView*) base; clutter_actor_paint ((ClutterActor*) self->priv->bgtex); { - UnityLauncherScrollerModelIterator* _child_it; - _child_it = unity_launcher_scroller_model_iterator (self->priv->_model); + gint index; + index = gee_collection_get_size ((GeeCollection*) self->priv->draw_btf) - 1; + { + gboolean _tmp0_; + _tmp0_ = TRUE; + while (TRUE) { + UnityLauncherScrollerChild* child; + gboolean _tmp1_ = FALSE; + if (!_tmp0_) { + index--; + } + _tmp0_ = FALSE; + if (!(index >= 0)) { + break; + } + child = (UnityLauncherScrollerChild*) gee_abstract_list_get ((GeeAbstractList*) self->priv->draw_btf, index); + if (UNITY_LAUNCHER_IS_LAUNCHER_CHILD (child)) { + _tmp1_ = clutter_actor_get_opacity ((ClutterActor*) child) > 0; + } else { + _tmp1_ = FALSE; + } + if (_tmp1_) { + UnityLauncherScrollerChild* _tmp2_; + clutter_actor_paint ((ClutterActor*) (_tmp2_ = child, UNITY_LAUNCHER_IS_LAUNCHER_CHILD (_tmp2_) ? ((UnityLauncherLauncherChild*) _tmp2_) : NULL)); + } + _g_object_unref0 (child); + } + } + } + { + GeeIterator* _child_it; + _child_it = gee_abstract_collection_iterator ((GeeAbstractCollection*) self->priv->draw_ftb); while (TRUE) { UnityLauncherScrollerChild* child; - gboolean _tmp0_ = FALSE; - if (!unity_launcher_scroller_model_iterator_next (_child_it)) { + gboolean _tmp3_ = FALSE; + if (!gee_iterator_next (_child_it)) { break; } - child = unity_launcher_scroller_model_iterator_get (_child_it); + child = (UnityLauncherScrollerChild*) gee_iterator_get (_child_it); if (UNITY_LAUNCHER_IS_LAUNCHER_CHILD (child)) { - _tmp0_ = clutter_actor_get_opacity ((ClutterActor*) child) > 0; + _tmp3_ = clutter_actor_get_opacity ((ClutterActor*) child) > 0; } else { - _tmp0_ = FALSE; + _tmp3_ = FALSE; } - if (_tmp0_) { - UnityLauncherScrollerChild* _tmp1_; - clutter_actor_paint ((ClutterActor*) (_tmp1_ = child, UNITY_LAUNCHER_IS_LAUNCHER_CHILD (_tmp1_) ? ((UnityLauncherLauncherChild*) _tmp1_) : NULL)); + if (_tmp3_) { + UnityLauncherScrollerChild* _tmp4_; + clutter_actor_paint ((ClutterActor*) (_tmp4_ = child, UNITY_LAUNCHER_IS_LAUNCHER_CHILD (_tmp4_) ? ((UnityLauncherLauncherChild*) _tmp4_) : NULL)); } _g_object_unref0 (child); } - _unity_launcher_scroller_model_iterator_unref0 (_child_it); + _g_object_unref0 (_child_it); } { GeeIterator* _child_it; @@ -960,7 +1546,6 @@ static void unity_launcher_scroller_view_real_paint (ClutterActor* base) { _g_object_unref0 (_child_it); } clutter_actor_paint ((ClutterActor*) self->priv->top_shadow); - clutter_actor_paint ((ClutterActor*) self->priv->bottom_fade); } @@ -970,7 +1555,6 @@ static void unity_launcher_scroller_view_real_map (ClutterActor* base) { CLUTTER_ACTOR_CLASS (unity_launcher_scroller_view_parent_class)->map ((ClutterActor*) CTK_ACTOR (self)); clutter_actor_map ((ClutterActor*) self->priv->bgtex); clutter_actor_map ((ClutterActor*) self->priv->top_shadow); - clutter_actor_map ((ClutterActor*) self->priv->bottom_fade); { UnityLauncherScrollerModelIterator* _child_it; _child_it = unity_launcher_scroller_model_iterator (self->priv->_model); @@ -994,7 +1578,6 @@ static void unity_launcher_scroller_view_real_unmap (ClutterActor* base) { CLUTTER_ACTOR_CLASS (unity_launcher_scroller_view_parent_class)->unmap ((ClutterActor*) CTK_ACTOR (self)); clutter_actor_map ((ClutterActor*) self->priv->bgtex); clutter_actor_map ((ClutterActor*) self->priv->top_shadow); - clutter_actor_map ((ClutterActor*) self->priv->bottom_fade); { UnityLauncherScrollerModelIterator* _child_it; _child_it = unity_launcher_scroller_model_iterator (self->priv->_model); @@ -1044,7 +1627,23 @@ static void _unity_launcher_scroller_view_model_order_changed_unity_launcher_scr static gboolean _unity_launcher_scroller_view_on_button_press_event_clutter_actor_button_press_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_launcher_scroller_view_on_button_press_event (self, event); + gboolean result; + result = unity_launcher_scroller_view_on_button_press_event (self, event); + return result; +} + + +static gboolean _unity_launcher_scroller_view_on_enter_event_clutter_actor_enter_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { + gboolean result; + result = unity_launcher_scroller_view_on_enter_event (self, event); + return result; +} + + +static gboolean _unity_launcher_scroller_view_on_leave_event_clutter_actor_leave_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { + gboolean result; + result = unity_launcher_scroller_view_on_leave_event (self, event); + return result; } @@ -1064,6 +1663,19 @@ static void __lambda16__unity_drag_controller_drag_start (UnityDragController* _ } +static gboolean _lambda17_ (UnityLauncherScrollerView* self) { + gboolean result = FALSE; + unity_launcher_scroller_view_order_children (self, TRUE); +} + + +static gboolean __lambda17__gsource_func (gpointer self) { + gboolean result; + result = _lambda17_ (self); + return result; +} + + static GObject * unity_launcher_scroller_view_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { GObject * obj; GObjectClass * parent_class; @@ -1107,6 +1719,8 @@ static GObject * unity_launcher_scroller_view_constructor (GType type, guint n_c g_signal_connect_object ((ClutterActor*) self, "button-press-event", (GCallback) _unity_launcher_scroller_view_on_button_press_event_clutter_actor_button_press_event, self, 0); g_signal_connect_object ((ClutterActor*) self, "button-release-event", (GCallback) _unity_launcher_scroller_view_on_button_release_event_clutter_actor_button_release_event, self, 0); g_signal_connect_object ((ClutterActor*) self, "motion-event", (GCallback) _unity_launcher_scroller_view_on_motion_event_clutter_actor_motion_event, self, 0); + g_signal_connect_object ((ClutterActor*) self, "enter-event", (GCallback) _unity_launcher_scroller_view_on_enter_event_clutter_actor_enter_event, self, 0); + g_signal_connect_object ((ClutterActor*) self, "leave-event", (GCallback) _unity_launcher_scroller_view_on_leave_event_clutter_actor_leave_event, self, 0); self->priv->fling_timeline = (_tmp2_ = clutter_timeline_new ((guint) 1000), _g_object_unref0 (self->priv->fling_timeline), _tmp2_); clutter_timeline_set_loop (self->priv->fling_timeline, TRUE); g_signal_connect_object (self->priv->fling_timeline, "new-frame", (GCallback) _unity_launcher_scroller_view_on_scroller_frame_clutter_timeline_new_frame, self, 0); @@ -1116,6 +1730,7 @@ static GObject * unity_launcher_scroller_view_constructor (GType type, guint n_c self->priv->child_refs = (_tmp3_ = gee_array_list_new (UNITY_LAUNCHER_TYPE_SCROLLER_CHILD, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL), _g_object_unref0 (self->priv->child_refs), _tmp3_); unity_launcher_scroller_view_order_children (self, TRUE); clutter_actor_queue_relayout ((ClutterActor*) self); + g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, __lambda17__gsource_func, g_object_ref (self), g_object_unref); _g_object_unref0 (drag_controller); } return obj; @@ -1150,6 +1765,7 @@ static void unity_launcher_scroller_view_instance_init (UnityLauncherScrollerVie self->priv->total_child_height = 0.0f; self->priv->current_phase = UNITY_LAUNCHER_SCROLLER_PHASE_NONE; self->priv->last_motion_event_time = (guint) 0; + self->priv->view_type = UNITY_LAUNCHER_SCROLLER_VIEW_TYPE_CONTRACTED; self->priv->is_scrolling = FALSE; self->priv->scroll_position = 0.0f; self->priv->settle_position = 0.0f; @@ -1157,6 +1773,8 @@ static void unity_launcher_scroller_view_instance_init (UnityLauncherScrollerVie self->priv->previous_y_time = (guint) 0; self->priv->stored_delta = (guint) 0; self->priv->scroll_speed = 0.0f; + self->priv->contract_icon_degrees = 30.0f; + self->priv->focused_launcher = 0; } @@ -1166,8 +1784,9 @@ static void unity_launcher_scroller_view_finalize (GObject* obj) { _g_object_unref0 (self->priv->_model); _g_object_unref0 (self->priv->bgtex); _g_object_unref0 (self->priv->top_shadow); - _g_object_unref0 (self->priv->bottom_fade); _g_object_unref0 (self->priv->fling_timeline); + _g_object_unref0 (self->priv->draw_ftb); + _g_object_unref0 (self->priv->draw_btf); _g_object_unref0 (self->priv->child_refs); G_OBJECT_CLASS (unity_launcher_scroller_view_parent_class)->finalize (obj); } diff --git a/unity-private/launcher/scroller-view.vala b/unity-private/launcher/scroller-view.vala index 78b609dad..bd9bb76dd 100644 --- a/unity-private/launcher/scroller-view.vala +++ b/unity-private/launcher/scroller-view.vala @@ -31,6 +31,20 @@ namespace Unity.Launcher NONE } + private enum ScrollerViewType + { + EXPANDED, + CONTRACTED + } + + // sucks that we have to use a class, obviously slower than we need it to be + // but vala doesn't work with structs+gee right now. + private class ChildTransition + { + public float position; + public float rotation; + } + class ScrollerView : Ctk.Actor { // please don't reference this outside of this view, its only public for construct @@ -49,7 +63,6 @@ namespace Unity.Launcher */ private ThemeImage bgtex; private ThemeImage top_shadow; - private ThemeImage bottom_fade; /* * state tracking variables */ @@ -57,7 +70,7 @@ namespace Unity.Launcher private float total_child_height = 0.0f; private ScrollerPhase current_phase = ScrollerPhase.NONE; private uint last_motion_event_time = 0; - + private ScrollerViewType view_type = ScrollerViewType.CONTRACTED; /* * scrolling variables */ @@ -72,6 +85,13 @@ namespace Unity.Launcher private uint stored_delta = 0; private float scroll_speed = 0.0f; // the current speed (pixels/per second) that we are scrolling + private float contract_icon_degrees = 30.0f; + private int focused_launcher = 0; + + /* helps out with draw order */ + private Gee.ArrayList<ScrollerChild> draw_ftb; + private Gee.ArrayList<ScrollerChild> draw_btf; + /* * Refrence holders */ @@ -110,6 +130,8 @@ namespace Unity.Launcher button_press_event.connect (on_button_press_event); button_release_event.connect (on_button_release_event); motion_event.connect (on_motion_event); + enter_event.connect (on_enter_event); + leave_event.connect (on_leave_event); // set a timeline for our fling animation fling_timeline = new Clutter.Timeline (1000); @@ -128,27 +150,29 @@ namespace Unity.Launcher child_refs = new Gee.ArrayList <ScrollerChild> (); order_children (true); queue_relayout (); + Idle.add (() => { + order_children (true); + }); } public int get_model_index_at_y_pos (float y) { // returns the model index at the screenspace position given - // this is slow but we can't use child.position because of animations. - float h = 0.0f; - float min_height, nat_height; + + float pos_x, pos_y; + get_position (out pos_x, out pos_y); + y -= pos_y; int i = 0; foreach (ScrollerChild child in model) { - float transformed_pos = h + scroll_position + padding.top; + float transformed_pos = child.position + padding.top; if (transformed_pos > y) return i; - child.get_preferred_height (get_width (), out min_height, out nat_height); - h += nat_height + spacing; i++; } - return int.max (i, 0); + return int.min (int.max (i, 0), model.size - 1); } /* @@ -163,16 +187,13 @@ namespace Unity.Launcher top_shadow = new ThemeImage ("overflow_top"); top_shadow.set_repeat (true, false); top_shadow.set_parent (this); - - bottom_fade = new ThemeImage ("overflow_bottom"); - bottom_fade.set_repeat (true, false); - bottom_fade.set_parent (this); } // will move the scroller by the given pixels private void move_scroll_position (float pixels) { scroll_position += pixels; + order_children (true); queue_relayout (); } @@ -298,6 +319,60 @@ namespace Unity.Launcher return true; } + private bool on_enter_event (Clutter.Event event) + { + if (view_type == ScrollerViewType.EXPANDED) return false; + view_type = ScrollerViewType.EXPANDED; + + Unity.global_shell.add_fullscreen_request (this); + + // we need to set a new scroll position + // get the index of the icon we are hovering over + if (get_total_children_height () > get_available_height ()) + { + int index = get_model_index_at_y_pos (event.crossing.y); + + // set our state to what we will end up being so we can find the correct + //place to be. + var old_scroll_position = scroll_position; + scroll_position = 0; + order_children (true); + float child_height = model[index].get_height () / 2; + var new_scroll_position = -model[index].position + event.crossing.y; + + //reset our view so that we animate cleanly to the new view + view_type = ScrollerViewType.CONTRACTED; + scroll_position = old_scroll_position; + order_children (true); + + // and finally animate to the new view + view_type = ScrollerViewType.EXPANDED; + + scroll_position = new_scroll_position; + order_children (false); // have to order twice, boo + + queue_relayout (); + } + + return false; + } + + private bool on_leave_event (Clutter.Event event) + { + if (view_type == ScrollerViewType.CONTRACTED) return false; + if (event.crossing.x < get_width ()-1) return false; + + Unity.global_shell.remove_fullscreen_request (this); + + // need to store the focused item + focused_launcher = get_model_index_at_y_pos (event.crossing.y); + + view_type = ScrollerViewType.CONTRACTED; + order_children (false); + queue_relayout (); + return false; + } + private bool on_motion_event (Clutter.Event event) { var drag_controller = Drag.Controller.get_default (); @@ -309,7 +384,7 @@ namespace Unity.Launcher last_motion_event_time = event.motion.time; - if (button_down && is_scrolling == false) + if (button_down && is_scrolling == false && view_type != ScrollerViewType.CONTRACTED) { /* we have a left button down, but we aren't dragging yet, we need to * monitor how far away we have dragged from the original click, once @@ -535,35 +610,195 @@ namespace Unity.Launcher private void order_children (bool immediate) { + Gee.ArrayList<ChildTransition> transitions; + if (get_total_children_height () < get_available_height ()) + { + transitions = order_children_expanded (); + } + else + { + switch (view_type) + { + case ScrollerViewType.CONTRACTED: + transitions = order_children_contracted (); + break; + + case ScrollerViewType.EXPANDED: + transitions = order_children_expanded (); + break; + + default: + assert_not_reached (); + } + } + + for (int index = 0; index < model.size; index++) + { + var child = model[index]; + if (immediate) + { + child.position = transitions[index].position; + child.force_rotation_jump (transitions[index].rotation); + } + else + { + if (child.get_animation () is Clutter.Animation) + { + // disable the current animation before starting a new one + float current_pos = child.position; + child.get_animation ().completed (); + child.position = current_pos; + } + + child.rotation = transitions[index].rotation; + child.animate (Clutter.AnimationMode.EASE_IN_OUT_QUAD, + 300, + "position", transitions[index].position + ); + } + } + } + + private Gee.ArrayList<ChildTransition> order_children_expanded () + { // figures out the position of each child based on its order in the model + Gee.ArrayList<ChildTransition> ret_transitions = new Gee.ArrayList<ChildTransition> (); float h = 0.0f; float min_height, nat_height; + if (!(draw_ftb is Gee.ArrayList)) + draw_ftb = new Gee.ArrayList<ScrollerChild> (); + draw_btf = new Gee.ArrayList<ScrollerChild> (); + foreach (ScrollerChild child in model) { child.get_preferred_height (get_width (), out min_height, out nat_height); - if (h != child.position) + var transition = new ChildTransition (); + transition.position = h + scroll_position; + transition.rotation = 0.0f; + ret_transitions.add (transition); + if (!(child in draw_ftb || child in draw_ftb)) + draw_ftb.add (child); + h += nat_height + spacing; + } + return ret_transitions; + } + + private Gee.ArrayList<ChildTransition> order_children_contracted () + { + Gee.ArrayList<ChildTransition> ret_transitions = new Gee.ArrayList<ChildTransition> (); + float h = 0.0f; + float min_height, nat_height; + int num_launchers = 0; + //get the total size of the children in a flat state + float total_child_height = get_total_children_height (); + + if (total_child_height > get_available_height ()) { - if (!immediate) + // we need to contract some icons + + // we need to calculate how many launchers fit on our launcher + num_launchers = (int)Math.floorf ((get_available_height () - (spacing * 2)) / (48.0f + spacing)); + + for (; num_launchers >= 1; num_launchers--) { - if (child.get_animation () is Clutter.Animation) + //check to see if we can fit everything in + float flat_space = num_launchers * (48.0f + spacing); + float contracted_space = 0.0f; + contracted_space = ((model.size - num_launchers) * (8 + spacing)); + + if (flat_space + contracted_space < (get_available_height () - (spacing * 2))) { - float current_pos = child.position; - child.get_animation ().completed (); - child.position = current_pos; + // everything fits in at this level, woo! + break; } + } + num_launchers = int.max (num_launchers, 1); + // num_launchers now contains how many launchers should be "flat" + } + else + { + num_launchers = model.size; + } - child.animate (Clutter.AnimationMode.EASE_IN_OUT_QUAD, - 170, - "position", h); + int num_children_handled = 0; + int index_start_flat, index_end_flat = 0; + + if (focused_launcher < model.size - (num_launchers -(num_launchers / 2))) + { + index_start_flat = int.max (0, focused_launcher - (num_launchers / 2)); + index_end_flat = index_start_flat + num_launchers; + } + else + { + index_end_flat = model.size; + index_start_flat = index_end_flat - num_launchers; + } + draw_ftb = new Gee.ArrayList<ScrollerChild> (); + draw_btf = new Gee.ArrayList<ScrollerChild> (); + + for (int index = 0; index < model.size; index++) + { + ScrollerChild child = model[index]; + var transition = new ChildTransition (); + if (index >= index_start_flat && index < index_end_flat) + { + + child.get_preferred_height (get_width (), out min_height, out nat_height); + transition.position = h; + h += nat_height + spacing; + num_children_handled++; + transition.rotation = 0.0f; + + if (index == index_start_flat) + draw_ftb.add (child); + else + draw_btf.add (child); } else { - child.position = h; + // contracted launcher + if (index == index_end_flat) h -= spacing; + + transition.position = h; + h += 8 + spacing; + if (num_children_handled < index_start_flat) + { + transition.rotation = -contract_icon_degrees; + draw_ftb.add (child); + } + else + { + transition.rotation = contract_icon_degrees; + draw_btf.add (child); + } + num_children_handled++; + + if (index +1 == index_start_flat) h += 30; } + ret_transitions.add (transition); } - h += nat_height + spacing; - } + return ret_transitions; + } + + + private float get_total_children_height () + { + float h = 0.0f; + float min_height, nat_height; + foreach (ScrollerChild child in model) + { + child.get_preferred_height (get_width (), out min_height, out nat_height); + h += nat_height + spacing; + } + return h; + } + + private float get_available_height () + { + Clutter.ActorBox box; + get_stored_allocation (out box); + return box.get_height () - padding.top - padding.bottom; } public override void allocate (Clutter.ActorBox box, @@ -589,7 +824,7 @@ namespace Unity.Launcher child_box.x1 = current_width; child_box.x2 = box.get_width () - padding.right; - child_box.y1 = child.position + padding.top + scroll_position; + child_box.y1 = child.position + padding.top; child_box.y2 = child_box.y1 + child_height; child.allocate (child_box, flags); @@ -615,11 +850,6 @@ namespace Unity.Launcher child_box.y1 = -1; child_box.y2 = bg_height -1; top_shadow.allocate (child_box, flags); - - bottom_fade.get_base_size (out bg_width, out bg_height); - child_box.y1 = box.get_height() - bg_height; - child_box.y2 = box.get_height(); - bottom_fade.allocate (child_box, flags); } public override void pick (Clutter.Color color) @@ -635,7 +865,16 @@ namespace Unity.Launcher public override void paint () { bgtex.paint (); - foreach (ScrollerChild child in model) + for (int index = draw_btf.size-1; index >= 0; index--) + { + ScrollerChild child = draw_btf[index]; + if (child is LauncherChild && child.opacity > 0) + { + (child as LauncherChild).paint (); + } + } + + foreach (ScrollerChild child in draw_ftb) { if (child is LauncherChild && child.opacity > 0) { @@ -649,7 +888,6 @@ namespace Unity.Launcher } top_shadow.paint (); - bottom_fade.paint (); } public override void map () @@ -657,7 +895,6 @@ namespace Unity.Launcher base.map (); bgtex.map (); top_shadow.map (); - bottom_fade.map (); foreach (ScrollerChild child in model) { child.map (); @@ -669,7 +906,6 @@ namespace Unity.Launcher base.unmap (); bgtex.map (); top_shadow.map (); - bottom_fade.map (); foreach (ScrollerChild child in model) { child.unmap (); diff --git a/unity-private/launcher/scrollerchild-controller.c b/unity-private/launcher/scrollerchild-controller.c index c76e1a041..ba8198ef0 100644 --- a/unity-private/launcher/scrollerchild-controller.c +++ b/unity-private/launcher/scrollerchild-controller.c @@ -464,27 +464,37 @@ static void unity_launcher_scroller_child_controller_set_child (UnityLauncherScr static gboolean _unity_launcher_scroller_child_controller_on_press_event_clutter_actor_button_press_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_launcher_scroller_child_controller_on_press_event (self, event); + gboolean result; + result = unity_launcher_scroller_child_controller_on_press_event (self, event); + return result; } static gboolean _unity_launcher_scroller_child_controller_on_release_event_clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_launcher_scroller_child_controller_on_release_event (self, event); + gboolean result; + result = unity_launcher_scroller_child_controller_on_release_event (self, event); + return result; } static gboolean _unity_launcher_scroller_child_controller_on_enter_event_clutter_actor_enter_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_launcher_scroller_child_controller_on_enter_event (self, event); + gboolean result; + result = unity_launcher_scroller_child_controller_on_enter_event (self, event); + return result; } static gboolean _unity_launcher_scroller_child_controller_on_leave_event_clutter_actor_leave_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_launcher_scroller_child_controller_on_leave_event (self, event); + gboolean result; + result = unity_launcher_scroller_child_controller_on_leave_event (self, event); + return result; } static gboolean _unity_launcher_scroller_child_controller_on_motion_event_clutter_actor_motion_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_launcher_scroller_child_controller_on_motion_event (self, event); + gboolean result; + result = unity_launcher_scroller_child_controller_on_motion_event (self, event); + return result; } diff --git a/unity-private/launcher/scrollerchild.c b/unity-private/launcher/scrollerchild.c index 53ea00746..97968c76e 100644 --- a/unity-private/launcher/scrollerchild.c +++ b/unity-private/launcher/scrollerchild.c @@ -27,9 +27,9 @@ #include <glib.h> #include <glib-object.h> #include <clutk/clutk.h> -#include <gdk-pixbuf/gdk-pixdata.h> #include <float.h> #include <math.h> +#include <gdk-pixbuf/gdk-pixdata.h> #include <stdlib.h> #include <string.h> #include <clutter/clutter.h> @@ -64,6 +64,7 @@ struct _UnityLauncherScrollerChild { struct _UnityLauncherScrollerChildClass { CtkActorClass parent_class; + void (*force_rotation_jump) (UnityLauncherScrollerChild* self, float degrees); }; struct _UnityLauncherScrollerChildPrivate { @@ -73,6 +74,7 @@ struct _UnityLauncherScrollerChildPrivate { gboolean _active; gboolean _needs_attention; gboolean _activating; + float _rotation; }; @@ -88,8 +90,11 @@ enum { UNITY_LAUNCHER_SCROLLER_CHILD_RUNNING, UNITY_LAUNCHER_SCROLLER_CHILD_ACTIVE, UNITY_LAUNCHER_SCROLLER_CHILD_NEEDS_ATTENTION, - UNITY_LAUNCHER_SCROLLER_CHILD_ACTIVATING + UNITY_LAUNCHER_SCROLLER_CHILD_ACTIVATING, + UNITY_LAUNCHER_SCROLLER_CHILD_ROTATION }; +void unity_launcher_scroller_child_force_rotation_jump (UnityLauncherScrollerChild* self, float degrees); +static void unity_launcher_scroller_child_real_force_rotation_jump (UnityLauncherScrollerChild* self, float degrees); gboolean unity_launcher_scroller_child_get_running (UnityLauncherScrollerChild* self); gboolean unity_launcher_scroller_child_get_active (UnityLauncherScrollerChild* self); float unity_launcher_scroller_child_get_position (UnityLauncherScrollerChild* self); @@ -104,6 +109,8 @@ gboolean unity_launcher_scroller_child_get_needs_attention (UnityLauncherScrolle void unity_launcher_scroller_child_set_needs_attention (UnityLauncherScrollerChild* self, gboolean value); gboolean unity_launcher_scroller_child_get_activating (UnityLauncherScrollerChild* self); void unity_launcher_scroller_child_set_activating (UnityLauncherScrollerChild* self, gboolean value); +float unity_launcher_scroller_child_get_rotation (UnityLauncherScrollerChild* self); +void unity_launcher_scroller_child_set_rotation (UnityLauncherScrollerChild* self, float value); static GObject * unity_launcher_scroller_child_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void unity_launcher_scroller_child_finalize (GObject* obj); static void unity_launcher_scroller_child_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); @@ -123,6 +130,18 @@ GType unity_launcher_pin_type_get_type (void) { } +static void unity_launcher_scroller_child_real_force_rotation_jump (UnityLauncherScrollerChild* self, float degrees) { + g_return_if_fail (self != NULL); + g_critical ("Type `%s' does not implement abstract method `unity_launcher_scroller_child_force_rotation_jump'", g_type_name (G_TYPE_FROM_INSTANCE (self))); + return; +} + + +void unity_launcher_scroller_child_force_rotation_jump (UnityLauncherScrollerChild* self, float degrees) { + UNITY_LAUNCHER_SCROLLER_CHILD_GET_CLASS (self)->force_rotation_jump (self, degrees); +} + + char* unity_launcher_scroller_child_to_string (UnityLauncherScrollerChild* self) { char* result = NULL; const char* _tmp0_; @@ -248,6 +267,21 @@ void unity_launcher_scroller_child_set_activating (UnityLauncherScrollerChild* s } +float unity_launcher_scroller_child_get_rotation (UnityLauncherScrollerChild* self) { + float result; + g_return_val_if_fail (self != NULL, 0.0F); + result = self->priv->_rotation; + return result; +} + + +void unity_launcher_scroller_child_set_rotation (UnityLauncherScrollerChild* self, float value) { + g_return_if_fail (self != NULL); + self->priv->_rotation = value; + g_object_notify ((GObject *) self, "rotation"); +} + + static GObject * unity_launcher_scroller_child_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { GObject * obj; GObjectClass * parent_class; @@ -264,6 +298,7 @@ static GObject * unity_launcher_scroller_child_constructor (GType type, guint n_ static void unity_launcher_scroller_child_class_init (UnityLauncherScrollerChildClass * klass) { unity_launcher_scroller_child_parent_class = g_type_class_peek_parent (klass); g_type_class_add_private (klass, sizeof (UnityLauncherScrollerChildPrivate)); + UNITY_LAUNCHER_SCROLLER_CHILD_CLASS (klass)->force_rotation_jump = unity_launcher_scroller_child_real_force_rotation_jump; G_OBJECT_CLASS (klass)->get_property = unity_launcher_scroller_child_get_property; G_OBJECT_CLASS (klass)->set_property = unity_launcher_scroller_child_set_property; G_OBJECT_CLASS (klass)->constructor = unity_launcher_scroller_child_constructor; @@ -274,6 +309,7 @@ static void unity_launcher_scroller_child_class_init (UnityLauncherScrollerChild g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_LAUNCHER_SCROLLER_CHILD_ACTIVE, g_param_spec_boolean ("active", "active", "active", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_LAUNCHER_SCROLLER_CHILD_NEEDS_ATTENTION, g_param_spec_boolean ("needs-attention", "needs-attention", "needs-attention", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_LAUNCHER_SCROLLER_CHILD_ACTIVATING, g_param_spec_boolean ("activating", "activating", "activating", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); + g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_LAUNCHER_SCROLLER_CHILD_ROTATION, g_param_spec_float ("rotation", "rotation", "rotation", -G_MAXFLOAT, G_MAXFLOAT, 0.0F, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE)); } @@ -324,6 +360,9 @@ static void unity_launcher_scroller_child_get_property (GObject * object, guint case UNITY_LAUNCHER_SCROLLER_CHILD_ACTIVATING: g_value_set_boolean (value, unity_launcher_scroller_child_get_activating (self)); break; + case UNITY_LAUNCHER_SCROLLER_CHILD_ROTATION: + g_value_set_float (value, unity_launcher_scroller_child_get_rotation (self)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -353,6 +392,9 @@ static void unity_launcher_scroller_child_set_property (GObject * object, guint case UNITY_LAUNCHER_SCROLLER_CHILD_ACTIVATING: unity_launcher_scroller_child_set_activating (self, g_value_get_boolean (value)); break; + case UNITY_LAUNCHER_SCROLLER_CHILD_ROTATION: + unity_launcher_scroller_child_set_rotation (self, g_value_get_float (value)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; diff --git a/unity-private/launcher/scrollerchild.vala b/unity-private/launcher/scrollerchild.vala index 31896eb21..251fa8150 100644 --- a/unity-private/launcher/scrollerchild.vala +++ b/unity-private/launcher/scrollerchild.vala @@ -44,6 +44,9 @@ namespace Unity.Launcher public bool active {get; set;} public bool needs_attention {get; set;} public bool activating {get; set;} + public float rotation {get; set;} + + public abstract void force_rotation_jump (float degrees); public string to_string () { diff --git a/unity-private/panel/panel-background.c b/unity-private/panel/panel-background.c index d44365c47..8c7ec5c4e 100644 --- a/unity-private/panel/panel-background.c +++ b/unity-private/panel/panel-background.c @@ -94,7 +94,9 @@ UnityPanelBackground* unity_panel_background_new (void) { static gboolean _unity_panel_background_update_background_gsource_func (gpointer self) { - return unity_panel_background_update_background (self); + gboolean result; + result = unity_panel_background_update_background (self); + return result; } diff --git a/unity-private/panel/panel-home-button.c b/unity-private/panel/panel-home-button.c index a720a6ae9..0019e30c7 100644 --- a/unity-private/panel/panel-home-button.c +++ b/unity-private/panel/panel-home-button.c @@ -199,12 +199,16 @@ static void unity_panel_home_button_set_shell (UnityPanelHomeButton* self, Unity static gboolean _unity_panel_home_button_on_button_press_clutter_actor_button_press_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_panel_home_button_on_button_press (self, event); + gboolean result; + result = unity_panel_home_button_on_button_press (self, event); + return result; } static gboolean _unity_panel_home_button_on_button_release_clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_panel_home_button_on_button_release (self, event); + gboolean result; + result = unity_panel_home_button_on_button_release (self, event); + return result; } diff --git a/unity-private/panel/panel-indicator-background.c b/unity-private/panel/panel-indicator-background.c index 064a4cdb4..2407d98a7 100644 --- a/unity-private/panel/panel-indicator-background.c +++ b/unity-private/panel/panel-indicator-background.c @@ -94,7 +94,9 @@ UnityPanelIndicatorBackground* unity_panel_indicator_background_new (void) { static gboolean _unity_panel_indicator_background_update_background_gsource_func (gpointer self) { - return unity_panel_indicator_background_update_background (self); + gboolean result; + result = unity_panel_indicator_background_update_background (self); + return result; } diff --git a/unity-private/panel/panel-indicator-object-entry-view.c b/unity-private/panel/panel-indicator-object-entry-view.c index 8d7f1a97d..8afeb0804 100644 --- a/unity-private/panel/panel-indicator-object-entry-view.c +++ b/unity-private/panel/panel-indicator-object-entry-view.c @@ -308,7 +308,9 @@ void unity_panel_indicators_indicator_object_entry_view_menu_key_moved (UnityPan static gboolean _unity_panel_indicators_indicator_object_entry_view_update_bg_gsource_func (gpointer self) { - return unity_panel_indicators_indicator_object_entry_view_update_bg (self); + gboolean result; + result = unity_panel_indicators_indicator_object_entry_view_update_bg (self); + return result; } @@ -427,17 +429,23 @@ static void unity_panel_indicators_indicator_object_entry_view_set_entry (UnityP static gboolean _unity_panel_indicators_indicator_object_entry_view_on_button_press_event_clutter_actor_button_press_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_panel_indicators_indicator_object_entry_view_on_button_press_event (self, event); + gboolean result; + result = unity_panel_indicators_indicator_object_entry_view_on_button_press_event (self, event); + return result; } static gboolean _unity_panel_indicators_indicator_object_entry_view_on_motion_event_clutter_actor_motion_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_panel_indicators_indicator_object_entry_view_on_motion_event (self, event); + gboolean result; + result = unity_panel_indicators_indicator_object_entry_view_on_motion_event (self, event); + return result; } static gboolean _unity_panel_indicators_indicator_object_entry_view_on_scroll_event_clutter_actor_scroll_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_panel_indicators_indicator_object_entry_view_on_scroll_event (self, event); + gboolean result; + result = unity_panel_indicators_indicator_object_entry_view_on_scroll_event (self, event); + return result; } diff --git a/unity-private/panel/panel-indicators.c b/unity-private/panel/panel-indicators.c index 75a75892b..30bf3224a 100644 --- a/unity-private/panel/panel-indicators.c +++ b/unity-private/panel/panel-indicators.c @@ -692,27 +692,37 @@ static void unity_panel_indicators_view_on_menu_moved (UnityPanelIndicatorsView* static gboolean _unity_panel_indicators_view_on_button_press_event_clutter_actor_button_press_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_panel_indicators_view_on_button_press_event (self, event); + gboolean result; + result = unity_panel_indicators_view_on_button_press_event (self, event); + return result; } static gboolean _unity_panel_indicators_view_on_button_release_event_clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_panel_indicators_view_on_button_release_event (self, event); + gboolean result; + result = unity_panel_indicators_view_on_button_release_event (self, event); + return result; } static gboolean _unity_panel_indicators_view_on_motion_event_clutter_actor_motion_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_panel_indicators_view_on_motion_event (self, event); + gboolean result; + result = unity_panel_indicators_view_on_motion_event (self, event); + return result; } static gboolean _unity_panel_indicators_view_on_scroll_event_clutter_actor_scroll_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_panel_indicators_view_on_scroll_event (self, event); + gboolean result; + result = unity_panel_indicators_view_on_scroll_event (self, event); + return result; } static gboolean _unity_panel_indicators_view_load_indicators_gsource_func (gpointer self) { - return unity_panel_indicators_view_load_indicators (self); + gboolean result; + result = unity_panel_indicators_view_load_indicators (self); + return result; } diff --git a/unity-private/panel/panel-tray.c b/unity-private/panel/panel-tray.c index 0e3239b3a..56c98e67a 100644 --- a/unity-private/panel/panel-tray.c +++ b/unity-private/panel/panel-tray.c @@ -124,7 +124,9 @@ static gpointer _g_object_ref0 (gpointer self) { static gboolean _unity_panel_system_tray_manage_tray_idle_gsource_func (gpointer self) { - return unity_panel_system_tray_manage_tray_idle (self); + gboolean result; + result = unity_panel_system_tray_manage_tray_idle (self); + return result; } @@ -173,7 +175,7 @@ static gint unity_panel_system_tray_order_icons (ClutterActor* a, ClutterActor* } else { _tmp1_ = ""; } - result = strcmp (_tmp0_, _tmp1_); + result = g_strcmp0 (_tmp0_, _tmp1_); return result; } diff --git a/unity-private/places/application-place.c b/unity-private/places/application-place.c index 61d6c7dad..cc89e984b 100644 --- a/unity-private/places/application-place.c +++ b/unity-private/places/application-place.c @@ -587,12 +587,16 @@ static void unity_places_application_application_group_real_get_preferred_height static gboolean _unity_places_application_application_group_on_maximize_clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_places_application_application_group_on_maximize (self, event); + gboolean result; + result = unity_places_application_application_group_on_maximize (self, event); + return result; } static gboolean _unity_places_application_application_group_on_minimize_clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_places_application_application_group_on_minimize (self, event); + gboolean result; + result = unity_places_application_application_group_on_minimize (self, event); + return result; } diff --git a/unity-private/places/bar-view.c b/unity-private/places/bar-view.c index 724632c16..97bac07a9 100644 --- a/unity-private/places/bar-view.c +++ b/unity-private/places/bar-view.c @@ -205,7 +205,9 @@ static void _unity_places_bar_view_on_place_added_unity_places_model_place_added static gboolean _unity_places_bar_view_on_button_release_clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_places_bar_view_on_button_release (self, event); + gboolean result; + result = unity_places_bar_view_on_button_release (self, event); + return result; } diff --git a/unity-private/places/default-view.c b/unity-private/places/default-view.c index 2bc450352..0a81752cc 100644 --- a/unity-private/places/default-view.c +++ b/unity-private/places/default-view.c @@ -144,12 +144,16 @@ static void unity_places_default_view_finalize (GObject* obj); static gboolean _unity_places_default_activity_widget_on_enter_clutter_actor_enter_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_places_default_activity_widget_on_enter (self); + gboolean result; + result = unity_places_default_activity_widget_on_enter (self); + return result; } static gboolean _unity_places_default_activity_widget_on_leave_clutter_actor_leave_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_places_default_activity_widget_on_leave (self); + gboolean result; + result = unity_places_default_activity_widget_on_leave (self); + return result; } diff --git a/unity-private/places/file-place.c b/unity-private/places/file-place.c index d40826154..0aca9905f 100644 --- a/unity-private/places/file-place.c +++ b/unity-private/places/file-place.c @@ -482,12 +482,16 @@ static void unity_places_file_file_group_real_get_preferred_height (ClutterActor static gboolean _unity_places_file_file_group_on_maximize_clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_places_file_file_group_on_maximize (self, event); + gboolean result; + result = unity_places_file_file_group_on_maximize (self, event); + return result; } static gboolean _unity_places_file_file_group_on_minimize_clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_places_file_file_group_on_minimize (self, event); + gboolean result; + result = unity_places_file_file_group_on_minimize (self, event); + return result; } diff --git a/unity-private/places/places-controller.c b/unity-private/places/places-controller.c index caf21b77e..6fca83999 100644 --- a/unity-private/places/places-controller.c +++ b/unity-private/places/places-controller.c @@ -484,7 +484,9 @@ static void unity_places_controller_set_shell (UnityPlacesController* self, Unit static gboolean _unity_places_controller_load_places_gsource_func (gpointer self) { - return unity_places_controller_load_places (self); + gboolean result; + result = unity_places_controller_load_places (self); + return result; } diff --git a/unity-private/places/search-field.c b/unity-private/places/search-field.c index b425f7329..422c7e0e0 100644 --- a/unity-private/places/search-field.c +++ b/unity-private/places/search-field.c @@ -146,7 +146,9 @@ static gboolean _lambda8_ (ClutterEvent* e, UnityPlacesSearchFieldView* self) { static gboolean __lambda8__clutter_actor_button_press_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return _lambda8_ (event, self); + gboolean result; + result = _lambda8_ (event, self); + return result; } diff --git a/unity-private/testing/test-director.c b/unity-private/testing/test-director.c index 26748905d..c33efdc3f 100644 --- a/unity-private/testing/test-director.c +++ b/unity-private/testing/test-director.c @@ -68,8 +68,8 @@ UnityTestingDirector* unity_testing_director_new (ClutterStage* stage); UnityTestingDirector* unity_testing_director_construct (GType object_type, ClutterStage* stage); static void unity_testing_director_do_event (UnityTestingDirector* self, ClutterActor* actor, ClutterEvent* event, gboolean capture_phase); void unity_testing_director_do_wait_for_animation (UnityTestingDirector* self, ClutterActor* actor); -static gboolean _lambda18_ (UnityTestingDirector* self); -static gboolean __lambda18__gsource_func (gpointer self); +static gboolean _lambda19_ (UnityTestingDirector* self); +static gboolean __lambda19__gsource_func (gpointer self); void unity_testing_director_do_wait_for_timeout (UnityTestingDirector* self, guint32 msecs); void unity_testing_director_button_press (UnityTestingDirector* self, ClutterActor* actor, guint32 button, gboolean autorelease, float relative_x, float relative_y, gboolean wait_for_animation); void unity_testing_director_button_release (UnityTestingDirector* self, ClutterActor* actor, guint32 button, float relative_x, float relative_y); @@ -137,7 +137,7 @@ void unity_testing_director_do_wait_for_animation (UnityTestingDirector* self, C } -static gboolean _lambda18_ (UnityTestingDirector* self) { +static gboolean _lambda19_ (UnityTestingDirector* self) { gboolean result = FALSE; self->priv->break_loop = TRUE; result = FALSE; @@ -145,15 +145,17 @@ static gboolean _lambda18_ (UnityTestingDirector* self) { } -static gboolean __lambda18__gsource_func (gpointer self) { - return _lambda18_ (self); +static gboolean __lambda19__gsource_func (gpointer self) { + gboolean result; + result = _lambda19_ (self); + return result; } void unity_testing_director_do_wait_for_timeout (UnityTestingDirector* self, guint32 msecs) { g_return_if_fail (self != NULL); self->priv->break_loop = FALSE; - g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) msecs, __lambda18__gsource_func, g_object_ref (self), g_object_unref); + g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) msecs, __lambda19__gsource_func, g_object_ref (self), g_object_unref); while (TRUE) { if (!(self->priv->break_loop != TRUE)) { break; diff --git a/unity-private/testing/test-utils.c b/unity-private/testing/test-utils.c index 455f2baf4..caea7b544 100644 --- a/unity-private/testing/test-utils.c +++ b/unity-private/testing/test-utils.c @@ -366,7 +366,9 @@ gboolean unity_testing_logging_fatal_handler (const char* log_domain, GLogLevelF static gboolean _unity_testing_logging_fatal_handler_gtest_log_log_fatal_func (const char* log_domain, GLogLevelFlags flags, const char* message, gpointer self) { - return unity_testing_logging_fatal_handler (log_domain, flags, message); + gboolean result; + result = unity_testing_logging_fatal_handler (log_domain, flags, message); + return result; } diff --git a/unity-private/testing/test-window.c b/unity-private/testing/test-window.c index f649b1d64..f8082df26 100644 --- a/unity-private/testing/test-window.c +++ b/unity-private/testing/test-window.c @@ -223,14 +223,14 @@ static void unity_testing_window_set_popup_height (UnityTestingWindow* self, gin UnityTestingWorkarea* unity_testing_workarea_new (void); UnityTestingWorkarea* unity_testing_workarea_construct (GType object_type); void unity_testing_workarea_update_net_workarea (UnityTestingWorkarea* self); -static gboolean _lambda19_ (UnityTestingWindow* self); -static gboolean __lambda19__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self); static gboolean _lambda20_ (UnityTestingWindow* self); static gboolean __lambda20__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self); -static void _lambda21_ (GdkScreen* s, UnityTestingWindow* self); -static void __lambda21__gdk_screen_size_changed (GdkScreen* _sender, gpointer self); +static gboolean _lambda21_ (UnityTestingWindow* self); +static gboolean __lambda21__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self); static void _lambda22_ (GdkScreen* s, UnityTestingWindow* self); -static void __lambda22__gdk_screen_monitors_changed (GdkScreen* _sender, gpointer self); +static void __lambda22__gdk_screen_size_changed (GdkScreen* _sender, gpointer self); +static void _lambda23_ (GdkScreen* s, UnityTestingWindow* self); +static void __lambda23__gdk_screen_monitors_changed (GdkScreen* _sender, gpointer self); static gboolean _unity_testing_window_on_stage_button_press_clutter_actor_button_press_event (ClutterActor* _sender, ClutterEvent* event, gpointer self); UnityTestingBackground* unity_testing_background_new (void); UnityTestingBackground* unity_testing_background_construct (GType object_type); @@ -600,7 +600,7 @@ static void unity_testing_window_set_popup_height (UnityTestingWindow* self, gin } -static gboolean _lambda19_ (UnityTestingWindow* self) { +static gboolean _lambda20_ (UnityTestingWindow* self) { gboolean result = FALSE; gtk_main_quit (); result = FALSE; @@ -608,47 +608,53 @@ static gboolean _lambda19_ (UnityTestingWindow* self) { } -static gboolean __lambda19__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self) { - return _lambda19_ (self); +static gboolean __lambda20__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self) { + gboolean result; + result = _lambda20_ (self); + return result; } -static gboolean _lambda20_ (UnityTestingWindow* self) { +static gboolean _lambda21_ (UnityTestingWindow* self) { gboolean result = FALSE; result = TRUE; return result; } -static gboolean __lambda20__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self) { - return _lambda20_ (self); +static gboolean __lambda21__gtk_widget_delete_event (GtkWidget* _sender, GdkEvent* event, gpointer self) { + gboolean result; + result = _lambda21_ (self); + return result; } -static void _lambda21_ (GdkScreen* s, UnityTestingWindow* self) { +static void _lambda22_ (GdkScreen* s, UnityTestingWindow* self) { g_return_if_fail (s != NULL); unity_testing_window_relayout (self); } -static void __lambda21__gdk_screen_size_changed (GdkScreen* _sender, gpointer self) { - _lambda21_ (_sender, self); +static void __lambda22__gdk_screen_size_changed (GdkScreen* _sender, gpointer self) { + _lambda22_ (_sender, self); } -static void _lambda22_ (GdkScreen* s, UnityTestingWindow* self) { +static void _lambda23_ (GdkScreen* s, UnityTestingWindow* self) { g_return_if_fail (s != NULL); unity_testing_window_relayout (self); } -static void __lambda22__gdk_screen_monitors_changed (GdkScreen* _sender, gpointer self) { - _lambda22_ (_sender, self); +static void __lambda23__gdk_screen_monitors_changed (GdkScreen* _sender, gpointer self) { + _lambda23_ (_sender, self); } static gboolean _unity_testing_window_on_stage_button_press_clutter_actor_button_press_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_testing_window_on_stage_button_press (self, event); + gboolean result; + result = unity_testing_window_on_stage_button_press (self, event); + return result; } @@ -697,7 +703,7 @@ static GObject * unity_testing_window_constructor (GType type, guint n_construct gtk_window_set_decorated ((GtkWindow*) self, TRUE); gtk_window_set_skip_taskbar_hint ((GtkWindow*) self, FALSE); gtk_window_set_skip_pager_hint ((GtkWindow*) self, FALSE); - g_signal_connect_object ((GtkWidget*) self, "delete-event", (GCallback) __lambda19__gtk_widget_delete_event, self, 0); + g_signal_connect_object ((GtkWidget*) self, "delete-event", (GCallback) __lambda20__gtk_widget_delete_event, self, 0); } else { gtk_window_set_type_hint ((GtkWindow*) self, GDK_WINDOW_TYPE_HINT_DESKTOP); gtk_window_set_keep_below ((GtkWindow*) self, TRUE); @@ -706,9 +712,9 @@ static GObject * unity_testing_window_constructor (GType type, guint n_construct gtk_window_set_skip_pager_hint ((GtkWindow*) self, TRUE); gtk_window_set_accept_focus ((GtkWindow*) self, FALSE); g_object_set ((GtkWidget*) self, "can-focus", FALSE, NULL); - g_signal_connect_object ((GtkWidget*) self, "delete-event", (GCallback) __lambda20__gtk_widget_delete_event, self, 0); - g_signal_connect_object (gtk_window_get_screen ((GtkWindow*) self), "size-changed", (GCallback) __lambda21__gdk_screen_size_changed, self, 0); - g_signal_connect_object (gtk_window_get_screen ((GtkWindow*) self), "monitors-changed", (GCallback) __lambda22__gdk_screen_monitors_changed, self, 0); + g_signal_connect_object ((GtkWidget*) self, "delete-event", (GCallback) __lambda21__gtk_widget_delete_event, self, 0); + g_signal_connect_object (gtk_window_get_screen ((GtkWindow*) self), "size-changed", (GCallback) __lambda22__gdk_screen_size_changed, self, 0); + g_signal_connect_object (gtk_window_get_screen ((GtkWindow*) self), "monitors-changed", (GCallback) __lambda23__gdk_screen_monitors_changed, self, 0); } gtk_window_set_title ((GtkWindow*) self, "Unity"); gtk_window_set_icon_name ((GtkWindow*) self, "distributor-logo"); diff --git a/unity-private/unity-private.h b/unity-private/unity-private.h index 155aa592e..23d31e1ad 100644 --- a/unity-private/unity-private.h +++ b/unity-private/unity-private.h @@ -1298,6 +1298,7 @@ struct _UnityLauncherScrollerChild { struct _UnityLauncherScrollerChildClass { CtkActorClass parent_class; + void (*force_rotation_jump) (UnityLauncherScrollerChild* self, float degrees); }; struct _UnityLauncherScrollerModel { @@ -1704,6 +1705,7 @@ GeeArrayList* unity_launcher_scroller_child_controller_get_menu_shortcut_actions void unity_launcher_scroller_child_controller_activate (UnityLauncherScrollerChildController* self); UnityLauncherScrollerChild* unity_launcher_scroller_child_controller_get_child (UnityLauncherScrollerChildController* self); GType unity_launcher_pin_type_get_type (void); +void unity_launcher_scroller_child_force_rotation_jump (UnityLauncherScrollerChild* self, float degrees); char* unity_launcher_scroller_child_to_string (UnityLauncherScrollerChild* self); UnityLauncherScrollerChild* unity_launcher_scroller_child_construct (GType object_type); GdkPixbuf* unity_launcher_scroller_child_get_icon (UnityLauncherScrollerChild* self); @@ -1718,6 +1720,8 @@ gboolean unity_launcher_scroller_child_get_needs_attention (UnityLauncherScrolle void unity_launcher_scroller_child_set_needs_attention (UnityLauncherScrollerChild* self, gboolean value); gboolean unity_launcher_scroller_child_get_activating (UnityLauncherScrollerChild* self); void unity_launcher_scroller_child_set_activating (UnityLauncherScrollerChild* self, gboolean value); +float unity_launcher_scroller_child_get_rotation (UnityLauncherScrollerChild* self); +void unity_launcher_scroller_child_set_rotation (UnityLauncherScrollerChild* self, float value); GType unity_launcher_scroller_model_get_type (void); UnityLauncherScrollerModel* unity_launcher_scroller_model_new (void); UnityLauncherScrollerModel* unity_launcher_scroller_model_construct (GType object_type); diff --git a/unity-private/unity-private.vapi b/unity-private/unity-private.vapi index 611be0392..78ee0bafd 100644 --- a/unity-private/unity-private.vapi +++ b/unity-private/unity-private.vapi @@ -78,12 +78,14 @@ namespace Unity { public abstract class ScrollerChild : Ctk.Actor { public Unity.Launcher.PinType pin_type; public ScrollerChild (); + public abstract void force_rotation_jump (float degrees); public string to_string (); public bool activating { get; set; } public bool active { get; set; } public Gdk.Pixbuf icon { get; set; } public bool needs_attention { get; set; } public float position { get; set; } + public float rotation { get; set; } public bool running { get; set; } } [CCode (cheader_filename = "unity-private.h")] diff --git a/unity/drag-view.c b/unity/drag-view.c index 52caf3af2..70a353052 100644 --- a/unity/drag-view.c +++ b/unity/drag-view.c @@ -98,7 +98,9 @@ UnityDragView* unity_drag_view_new (ClutterStage* stage) { static gboolean _unity_drag_view_captured_event_clutter_actor_captured_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_drag_view_captured_event (self, event); + gboolean result; + result = unity_drag_view_captured_event (self, event); + return result; } @@ -146,7 +148,9 @@ static gboolean unity_drag_view_captured_event (UnityDragView* self, ClutterEven static gboolean _unity_drag_view_on_motion_event_clutter_actor_motion_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_drag_view_on_motion_event (self, event); + gboolean result; + result = unity_drag_view_on_motion_event (self, event); + return result; } @@ -182,7 +186,9 @@ static gboolean unity_drag_view_on_motion_event (UnityDragView* self, ClutterEve static gboolean _unity_drag_view_on_release_event_clutter_actor_button_release_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_drag_view_on_release_event (self, event); + gboolean result; + result = unity_drag_view_on_release_event (self, event); + return result; } diff --git a/unity/entry.c b/unity/entry.c index d0f1244af..7208cf21f 100644 --- a/unity/entry.c +++ b/unity/entry.c @@ -171,7 +171,9 @@ static void unity_entry_on_activate (UnityEntry* self) { static gboolean _unity_entry_on_stage_captured_event_clutter_actor_captured_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_entry_on_stage_captured_event (self, event); + gboolean result; + result = unity_entry_on_stage_captured_event (self, event); + return result; } @@ -244,7 +246,9 @@ static void _unity_entry_on_key_focus_out_clutter_actor_key_focus_out (ClutterAc static gboolean _unity_entry_on_button_press_event_clutter_actor_button_press_event (ClutterActor* _sender, ClutterEvent* event, gpointer self) { - return unity_entry_on_button_press_event (self, event); + gboolean result; + result = unity_entry_on_button_press_event (self, event); + return result; } diff --git a/unity/icon-postprocessor.c b/unity/icon-postprocessor.c index 9e68893c8..0995c972b 100644 --- a/unity/icon-postprocessor.c +++ b/unity/icon-postprocessor.c @@ -58,6 +58,7 @@ typedef struct _UnityThemeImageClass UnityThemeImageClass; struct _UnityUnityIcon { CtkActor parent_instance; UnityUnityIconPrivate * priv; + float rotation; }; struct _UnityUnityIconClass { @@ -585,12 +586,75 @@ static gpointer _g_object_ref0 (gpointer self) { void unity_unity_icon_paint_real (ClutterActor* actor) { ClutterActor* _tmp0_; UnityUnityIcon* _self_; + float p1_x = 0.0F; + float p1_y = 0.0F; + float p2_x = 0.0F; + float p2_y = 0.0F; + float p3_x = 0.0F; + float p3_y = 0.0F; + float p4_x = 0.0F; + float p4_y = 0.0F; + float z = 0.0F; + float w = 0.0F; ClutterActorBox box = {0}; + CoglMatrix modelview = {0}; + CoglMatrix projection = {0}; + CoglMatrix viewmatrix = {0}; + CoglTextureVertex* _tmp10_; + gint _points_size_; + gint points_length1; + CoglTextureVertex* _tmp9_ = NULL; + CoglColor _tmp1_ = {0}; + CoglTextureVertex _tmp2_ = {0}; + CoglColor _tmp3_ = {0}; + CoglTextureVertex _tmp4_ = {0}; + CoglColor _tmp5_ = {0}; + CoglTextureVertex _tmp6_ = {0}; + CoglColor _tmp7_ = {0}; + CoglTextureVertex _tmp8_ = {0}; + CoglTextureVertex* points; guchar opacity; g_return_if_fail (actor != NULL); _self_ = _g_object_ref0 ((_tmp0_ = actor, UNITY_IS_UNITY_ICON (_tmp0_) ? ((UnityUnityIcon*) _tmp0_) : NULL)); memset (&box, 0, sizeof (ClutterActorBox)); ctk_actor_get_stored_allocation ((CtkActor*) _self_, &box); + cogl_matrix_init_identity (&modelview); + cogl_matrix_init_identity (&projection); + cogl_matrix_perspective (&projection, 60.0f, 1.0f, 0.1f, 100.0f); + cogl_matrix_translate (&modelview, 0.0f, 0.0f, (-44.0f) - (fabsf (_self_->rotation / 360.0f) * 100)); + cogl_matrix_rotate (&modelview, _self_->rotation, 1.0f, 0.0f, 0.0f); + cogl_matrix_multiply (&viewmatrix, &projection, &modelview); + p1_x = -25.0f; + p1_y = -25.0f; + p2_x = 25.0f; + p2_y = -25.0f; + p3_x = 25.0f; + p3_y = 25.0f; + p4_x = -25.0f; + p4_y = 25.0f; + z = 0.0f; + w = 1.0f; + cogl_matrix_transform_point (&viewmatrix, &p1_x, &p1_y, &z, &w); + p1_x = p1_x / w; + p1_y = p1_y / w; + z = 0.0f; + w = 1.0f; + cogl_matrix_transform_point (&viewmatrix, &p2_x, &p2_y, &z, &w); + p2_x = p2_x / w; + p2_y = p2_y / w; + z = 0.0f; + w = 1.0f; + cogl_matrix_transform_point (&viewmatrix, &p3_x, &p3_y, &z, &w); + p3_x = p3_x / w; + p3_y = p3_y / w; + z = 0.0f; + w = 1.0f; + cogl_matrix_transform_point (&viewmatrix, &p4_x, &p4_y, &z, &w); + p4_x = p4_x / w; + p4_y = p4_y / w; + z = 0.0f; + w = 1.0f; + points = (_tmp10_ = (_tmp9_ = g_new0 (CoglTextureVertex, 4), _tmp9_[0] = (memset (&_tmp2_, 0, sizeof (CoglTextureVertex)), _tmp2_.x = (50 * (p1_x + 1)) / 2, _tmp2_.y = 48 + ((50 * (p1_y - 1)) / 2), _tmp2_.z = 0.0f, _tmp2_.tx = 0.0f, _tmp2_.ty = 0.0f, _tmp2_.color = (memset (&_tmp1_, 0, sizeof (CoglColor)), _tmp1_.red = (guchar) 0xff, _tmp1_.green = (guchar) 0xff, _tmp1_.blue = (guchar) 0xff, _tmp1_.alpha = (guchar) 0xff, _tmp1_), _tmp2_), _tmp9_[1] = (memset (&_tmp4_, 0, sizeof (CoglTextureVertex)), _tmp4_.x = (50 * (p2_x + 1)) / 2, _tmp4_.y = 48 + ((50 * (p2_y - 1)) / 2), _tmp4_.z = 0.0f, _tmp4_.tx = 1.0f, _tmp4_.ty = 0.0f, _tmp4_.color = (memset (&_tmp3_, 0, sizeof (CoglColor)), _tmp3_.red = (guchar) 0xff, _tmp3_.green = (guchar) 0xff, _tmp3_.blue = (guchar) 0xff, _tmp3_.alpha = (guchar) 0xff, _tmp3_), _tmp4_), _tmp9_[2] = (memset (&_tmp6_, 0, sizeof (CoglTextureVertex)), _tmp6_.x = (50 * (p3_x + 1)) / 2, _tmp6_.y = 48 + ((50 * (p3_y - 1)) / 2), _tmp6_.z = 0.0f, _tmp6_.tx = 1.0f, _tmp6_.ty = 1.0f, _tmp6_.color = (memset (&_tmp5_, 0, sizeof (CoglColor)), _tmp5_.red = (guchar) 0xff, _tmp5_.green = (guchar) 0xff, _tmp5_.blue = (guchar) 0xff, _tmp5_.alpha = (guchar) 0xff, _tmp5_), _tmp6_), _tmp9_[3] = (memset (&_tmp8_, 0, sizeof (CoglTextureVertex)), _tmp8_.x = (50 * (p4_x + 1)) / 2, _tmp8_.y = 48 + ((50 * (p4_y - 1)) / 2), _tmp8_.z = 0.0f, _tmp8_.tx = 0.0f, _tmp8_.ty = 1.0f, _tmp8_.color = (memset (&_tmp7_, 0, sizeof (CoglColor)), _tmp7_.red = (guchar) 0xff, _tmp7_.green = (guchar) 0xff, _tmp7_.blue = (guchar) 0xff, _tmp7_.alpha = (guchar) 0xff, _tmp7_), _tmp8_), _tmp9_), points_length1 = 4, _points_size_ = points_length1, _tmp10_); opacity = (guchar) clutter_actor_get_paint_opacity ((ClutterActor*) _self_); cogl_material_set_color4ub (_self_->priv->bg_mat, opacity, opacity, opacity, opacity); cogl_material_set_color4ub (_self_->priv->bgcol_material, opacity, opacity, opacity, opacity); @@ -598,25 +662,76 @@ void unity_unity_icon_paint_real (ClutterActor* actor) { cogl_material_set_color4ub (_self_->priv->fg_mat, opacity, opacity, opacity, opacity); if (CLUTTER_IS_TEXTURE (_self_->priv->_bg_color)) { cogl_set_source (_self_->priv->bgcol_material); - cogl_rectangle (box.x1, box.y1, box.x2, box.y2); + cogl_polygon (points, points_length1, TRUE); } else { cogl_set_source (_self_->priv->bg_mat); - cogl_rectangle (box.x1, box.y1, box.x2, box.y2); + cogl_polygon (points, points_length1, TRUE); } if (CLUTTER_IS_TEXTURE (_self_->priv->_icon)) { - gint width = 0; - gint height = 0; + gint base_width = 0; + gint base_height = 0; float xpad = 0.0F; float ypad = 0.0F; + CoglTextureVertex* _tmp20_; + gint _icon_points_size_; + gint icon_points_length1; + CoglTextureVertex* _tmp19_ = NULL; + CoglColor _tmp11_ = {0}; + CoglTextureVertex _tmp12_ = {0}; + CoglColor _tmp13_ = {0}; + CoglTextureVertex _tmp14_ = {0}; + CoglColor _tmp15_ = {0}; + CoglTextureVertex _tmp16_ = {0}; + CoglColor _tmp17_ = {0}; + CoglTextureVertex _tmp18_ = {0}; + CoglTextureVertex* icon_points; + gint width = 0; + gint height = 0; + clutter_texture_get_base_size (_self_->priv->_icon, &base_width, &base_height); + xpad = 1 + ((clutter_actor_box_get_width (&box) - base_width) / 2.0f); + ypad = ((clutter_actor_box_get_height (&box) - base_height) / 2.0f) - 1; + p1_x = -25.0f; + p1_y = -25.0f; + p2_x = 25.0f; + p2_y = -25.0f; + p3_x = 25.0f; + p3_y = 25.0f; + p4_x = -25.0f; + p4_y = 25.0f; + z = 0.0f; + w = 1.0f; + cogl_matrix_transform_point (&viewmatrix, &p1_x, &p1_y, &z, &w); + p1_x = p1_x / w; + p1_y = p1_y / w; + z = 0.0f; + w = 1.0f; + cogl_matrix_transform_point (&viewmatrix, &p2_x, &p2_y, &z, &w); + p2_x = p2_x / w; + p2_y = p2_y / w; + z = 0.0f; + w = 1.0f; + cogl_matrix_transform_point (&viewmatrix, &p3_x, &p3_y, &z, &w); + p3_x = p3_x / w; + p3_y = p3_y / w; + z = 0.0f; + w = 1.0f; + cogl_matrix_transform_point (&viewmatrix, &p4_x, &p4_y, &z, &w); + p4_x = p4_x / w; + p4_y = p4_y / w; + z = 0.0f; + w = 1.0f; + icon_points = (_tmp20_ = (_tmp19_ = g_new0 (CoglTextureVertex, 4), _tmp19_[0] = (memset (&_tmp12_, 0, sizeof (CoglTextureVertex)), _tmp12_.x = xpad + ((base_width * (p1_x + 1)) / 2), _tmp12_.y = (48 - ypad) + ((base_height * (p1_y - 1)) / 2), _tmp12_.z = 0.0f, _tmp12_.tx = 0.0f, _tmp12_.ty = 0.0f, _tmp12_.color = (memset (&_tmp11_, 0, sizeof (CoglColor)), _tmp11_.red = (guchar) 0xff, _tmp11_.green = (guchar) 0xff, _tmp11_.blue = (guchar) 0xff, _tmp11_.alpha = (guchar) 0xff, _tmp11_), _tmp12_), _tmp19_[1] = (memset (&_tmp14_, 0, sizeof (CoglTextureVertex)), _tmp14_.x = xpad + ((base_width * (p2_x + 1)) / 2), _tmp14_.y = (48 - ypad) + ((base_height * (p2_y - 1)) / 2), _tmp14_.z = 0.0f, _tmp14_.tx = 1.0f, _tmp14_.ty = 0.0f, _tmp14_.color = (memset (&_tmp13_, 0, sizeof (CoglColor)), _tmp13_.red = (guchar) 0xff, _tmp13_.green = (guchar) 0xff, _tmp13_.blue = (guchar) 0xff, _tmp13_.alpha = (guchar) 0xff, _tmp13_), _tmp14_), _tmp19_[2] = (memset (&_tmp16_, 0, sizeof (CoglTextureVertex)), _tmp16_.x = xpad + ((base_width * (p3_x + 1)) / 2), _tmp16_.y = (48 - ypad) + ((base_height * (p3_y - 1)) / 2), _tmp16_.z = 0.0f, _tmp16_.tx = 1.0f, _tmp16_.ty = 1.0f, _tmp16_.color = (memset (&_tmp15_, 0, sizeof (CoglColor)), _tmp15_.red = (guchar) 0xff, _tmp15_.green = (guchar) 0xff, _tmp15_.blue = (guchar) 0xff, _tmp15_.alpha = (guchar) 0xff, _tmp15_), _tmp16_), _tmp19_[3] = (memset (&_tmp18_, 0, sizeof (CoglTextureVertex)), _tmp18_.x = xpad + ((base_width * (p4_x + 1)) / 2), _tmp18_.y = (48 - ypad) + ((base_height * (p4_y - 1)) / 2), _tmp18_.z = 0.0f, _tmp18_.tx = 0.0f, _tmp18_.ty = 1.0f, _tmp18_.color = (memset (&_tmp17_, 0, sizeof (CoglColor)), _tmp17_.red = (guchar) 0xff, _tmp17_.green = (guchar) 0xff, _tmp17_.blue = (guchar) 0xff, _tmp17_.alpha = (guchar) 0xff, _tmp17_), _tmp18_), _tmp19_), icon_points_length1 = 4, _icon_points_size_ = icon_points_length1, _tmp20_); clutter_texture_get_base_size (_self_->priv->_icon, &width, &height); xpad = (clutter_actor_box_get_width (&box) - width) / 2.0f; ypad = (clutter_actor_box_get_height (&box) - height) / 2.0f; cogl_set_source (_self_->priv->icon_material); - cogl_rectangle (xpad, ypad, box.x2 - xpad, box.y2 - ypad); + cogl_polygon (icon_points, icon_points_length1, TRUE); + icon_points = (g_free (icon_points), NULL); } cogl_set_source (_self_->priv->fg_mat); - cogl_rectangle (box.x1, box.y1, box.x2, box.y2); + cogl_polygon (points, points_length1, TRUE); _g_object_unref0 (_self_); + points = (g_free (points), NULL); } @@ -734,42 +849,46 @@ static GObject * unity_unity_icon_constructor (GType type, guint n_construct_pro obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = UNITY_UNITY_ICON (obj); { + CoglHandle* _tmp0_; + CoglHandle* _tmp1_; CoglHandle* mat; CoglHandle* tex; - CoglHandle* _tmp5_; - CoglHandle* _tmp6_; CoglHandle* _tmp7_; CoglHandle* _tmp8_; + CoglHandle* _tmp9_; + CoglHandle* _tmp10_; + self->priv->icon_material = (_tmp0_ = cogl_material_new (), _cogl_handle_unref0 (self->priv->icon_material), _tmp0_); + self->priv->bgcol_material = (_tmp1_ = cogl_material_new (), _cogl_handle_unref0 (self->priv->bgcol_material), _tmp1_); if (!CLUTTER_IS_TEXTURE (unity_unity_icon_bg_layer)) { - ClutterTexture* _tmp0_; - ClutterTexture* _tmp1_; ClutterTexture* _tmp2_; - unity_unity_icon_bg_layer = (_tmp0_ = (ClutterTexture*) g_object_ref_sink (unity_theme_image_new ("prism_icon_background")), _g_object_unref0 (unity_unity_icon_bg_layer), _tmp0_); - unity_unity_icon_fg_layer = (_tmp1_ = (ClutterTexture*) g_object_ref_sink (unity_theme_image_new ("prism_icon_foreground")), _g_object_unref0 (unity_unity_icon_fg_layer), _tmp1_); - unity_unity_icon_mk_layer = (_tmp2_ = (ClutterTexture*) g_object_ref_sink (unity_theme_image_new ("prism_icon_mask")), _g_object_unref0 (unity_unity_icon_mk_layer), _tmp2_); + ClutterTexture* _tmp3_; + ClutterTexture* _tmp4_; + unity_unity_icon_bg_layer = (_tmp2_ = (ClutterTexture*) g_object_ref_sink (unity_theme_image_new ("prism_icon_background")), _g_object_unref0 (unity_unity_icon_bg_layer), _tmp2_); + unity_unity_icon_fg_layer = (_tmp3_ = (ClutterTexture*) g_object_ref_sink (unity_theme_image_new ("prism_icon_foreground")), _g_object_unref0 (unity_unity_icon_fg_layer), _tmp3_); + unity_unity_icon_mk_layer = (_tmp4_ = (ClutterTexture*) g_object_ref_sink (unity_theme_image_new ("prism_icon_mask")), _g_object_unref0 (unity_unity_icon_mk_layer), _tmp4_); } if (CLUTTER_IS_TEXTURE (self->priv->_icon)) { CoglHandle* icon_mat; CoglHandle* icon_tex; CoglHandle* mask_tex; - CoglHandle* _tmp3_; + CoglHandle* _tmp5_; clutter_actor_set_parent ((ClutterActor*) self->priv->_icon, (ClutterActor*) self); icon_mat = cogl_material_new (); icon_tex = (CoglHandle*) clutter_texture_get_cogl_texture (self->priv->_icon); mask_tex = (CoglHandle*) clutter_texture_get_cogl_texture (unity_unity_icon_mk_layer); cogl_material_set_layer (icon_mat, 0, icon_tex); cogl_material_set_layer (icon_mat, 1, mask_tex); - self->priv->icon_material = (_tmp3_ = _cogl_handle_ref0 (icon_mat), _cogl_handle_unref0 (self->priv->icon_material), _tmp3_); + self->priv->icon_material = (_tmp5_ = _cogl_handle_ref0 (icon_mat), _cogl_handle_unref0 (self->priv->icon_material), _tmp5_); _cogl_handle_unref0 (icon_mat); _cogl_handle_unref0 (icon_tex); _cogl_handle_unref0 (mask_tex); } if (CLUTTER_IS_TEXTURE (self->priv->_bg_color)) { - CoglHandle* _tmp4_; + CoglHandle* _tmp6_; CoglHandle* color; CoglHandle* mask_tex; clutter_actor_set_parent ((ClutterActor*) self->priv->_bg_color, (ClutterActor*) self); - self->priv->bgcol_material = (_tmp4_ = cogl_material_new (), _cogl_handle_unref0 (self->priv->bgcol_material), _tmp4_); + self->priv->bgcol_material = (_tmp6_ = cogl_material_new (), _cogl_handle_unref0 (self->priv->bgcol_material), _tmp6_); color = (CoglHandle*) clutter_texture_get_cogl_texture (self->priv->_bg_color); mask_tex = (CoglHandle*) clutter_texture_get_cogl_texture (unity_unity_icon_mk_layer); cogl_material_set_layer (self->priv->bgcol_material, 0, color); @@ -781,11 +900,11 @@ static GObject * unity_unity_icon_constructor (GType type, guint n_construct_pro mat = cogl_material_new (); tex = (CoglHandle*) clutter_texture_get_cogl_texture (unity_unity_icon_bg_layer); cogl_material_set_layer (mat, 0, tex); - self->priv->bg_mat = (_tmp5_ = _cogl_handle_ref0 (mat), _cogl_handle_unref0 (self->priv->bg_mat), _tmp5_); - mat = (_tmp6_ = cogl_material_new (), _cogl_handle_unref0 (mat), _tmp6_); - tex = (_tmp7_ = (CoglHandle*) clutter_texture_get_cogl_texture (unity_unity_icon_fg_layer), _cogl_handle_unref0 (tex), _tmp7_); + self->priv->bg_mat = (_tmp7_ = _cogl_handle_ref0 (mat), _cogl_handle_unref0 (self->priv->bg_mat), _tmp7_); + mat = (_tmp8_ = cogl_material_new (), _cogl_handle_unref0 (mat), _tmp8_); + tex = (_tmp9_ = (CoglHandle*) clutter_texture_get_cogl_texture (unity_unity_icon_fg_layer), _cogl_handle_unref0 (tex), _tmp9_); cogl_material_set_layer (mat, 0, tex); - self->priv->fg_mat = (_tmp8_ = _cogl_handle_ref0 (mat), _cogl_handle_unref0 (self->priv->fg_mat), _tmp8_); + self->priv->fg_mat = (_tmp10_ = _cogl_handle_ref0 (mat), _cogl_handle_unref0 (self->priv->fg_mat), _tmp10_); _cogl_handle_unref0 (mat); _cogl_handle_unref0 (tex); } @@ -814,6 +933,7 @@ static void unity_unity_icon_class_init (UnityUnityIconClass * klass) { static void unity_unity_icon_instance_init (UnityUnityIcon * self) { self->priv = UNITY_UNITY_ICON_GET_PRIVATE (self); + self->rotation = 0.0f; } diff --git a/unity/icon-postprocessor.vala b/unity/icon-postprocessor.vala index 661d65190..13e96967d 100644 --- a/unity/icon-postprocessor.vala +++ b/unity/icon-postprocessor.vala @@ -291,6 +291,8 @@ namespace Unity private Cogl.Material icon_material; private Cogl.Material bgcol_material; + public float rotation = 0.0f; + public UnityIcon (Clutter.Texture? icon, Clutter.Texture? bg_tex) { @@ -299,6 +301,9 @@ namespace Unity construct { + icon_material = new Cogl.Material (); + bgcol_material = new Cogl.Material (); + if (!(unity_icon_bg_layer is Clutter.Texture)) { unity_icon_bg_layer = new ThemeImage ("prism_icon_background"); @@ -377,13 +382,90 @@ namespace Unity public static void paint_real (Clutter.Actor actor) { UnityIcon self = actor as UnityIcon; + float p1_x, p1_y; + float p2_x, p2_y; + float p3_x, p3_y; + float p4_x, p4_y; + float z, w; Clutter.ActorBox box = Clutter.ActorBox (); self.get_stored_allocation (out box); - /* we draw everything with cogl because Clutter.Texture seems to be made - * of dumb. also it likes to double allocate everything - */ + Cogl.Matrix modelview = Cogl.Matrix.identity (); //model view matrix + Cogl.Matrix projection = Cogl.Matrix.identity (); // projection matrix + projection.perspective (60.0f, 1.0f, 0.1f, 100.0f); + modelview.translate (0.0f, 0.0f, -44.0f - Math.fabsf (self.rotation / 360.0f) * 100); + modelview.rotate (self.rotation, 1.0f, 0.0f, 0.0f); + + Cogl.Matrix viewmatrix = Cogl.Matrix.multiply (projection, modelview); + + p1_x = -25.0f; p1_y = -25.0f; + p2_x = 25.0f; p2_y = -25.0f; + p3_x = 25.0f; p3_y = 25.0f; + p4_x = -25.0f; p4_y = 25.0f; + z = 0.0f; + w = 1.0f; + + viewmatrix.transform_point (out p1_x, out p1_y, out z, out w); p1_x /= w; p1_y /= w; z = 0.0f; w = 1.0f; + viewmatrix.transform_point (out p2_x, out p2_y, out z, out w); p2_x /= w; p2_y /= w; z = 0.0f; w = 1.0f; + viewmatrix.transform_point (out p3_x, out p3_y, out z, out w); p3_x /= w; p3_y /= w; z = 0.0f; w = 1.0f; + viewmatrix.transform_point (out p4_x, out p4_y, out z, out w); p4_x /= w; p4_y /= w; z = 0.0f; w = 1.0f; + + Cogl.TextureVertex[4] points = { + Cogl.TextureVertex () { + x = (50 * (p1_x + 1) / 2), + y = 48 + (50 * (p1_y - 1) / 2), + z = 0.0f, + tx = 0.0f, + ty = 0.0f, + color = Cogl.Color () { + red = 0xff, + green = 0xff, + blue = 0xff, + alpha = 0xff + } + }, + Cogl.TextureVertex () { + x = (50 * (p2_x + 1) / 2), + y = 48 + (50 * (p2_y - 1) / 2), + z = 0.0f, + tx = 1.0f, + ty = 0.0f, + color = Cogl.Color () { + red = 0xff, + green = 0xff, + blue = 0xff, + alpha = 0xff + } + }, + Cogl.TextureVertex () { + x = (50 * (p3_x + 1) / 2), + y = 48 + (50 * (p3_y - 1) / 2), + z = 0.0f, + tx = 1.0f, + ty = 1.0f, + color = Cogl.Color () { + red = 0xff, + green = 0xff, + blue = 0xff, + alpha = 0xff + } + }, + Cogl.TextureVertex () { + x = (50 * (p4_x + 1) / 2), + y = 48 + (50 * (p4_y - 1) / 2), + z = 0.0f, + tx = 0.0f, + ty = 1.0f, + color = Cogl.Color () { + red = 0xff, + green = 0xff, + blue = 0xff, + alpha = 0xff + } + } + }; + uchar opacity = self.get_paint_opacity (); self.bg_mat.set_color4ub (opacity, opacity, opacity, opacity); @@ -394,28 +476,100 @@ namespace Unity if (self.bg_color is Clutter.Texture) { Cogl.set_source (self.bgcol_material); - Cogl.rectangle (box.x1, box.y1, box.x2, box.y2); + Cogl.polygon (points, true); } else { Cogl.set_source (self.bg_mat); - Cogl.rectangle (box.x1, box.y1, box.x2, box.y2); + Cogl.polygon (points, true); } if (self.icon is Clutter.Texture) { - int width, height; + // we also need to transform the smaller (potentially) icon + int base_width, base_height; float xpad, ypad; + self.icon.get_base_size (out base_width, out base_height); + xpad = 1 + (box.get_width () - base_width) / 2.0f; + ypad = ((box.get_height () - base_height) / 2.0f) - 1; + + p1_x = -25.0f; p1_y = -25.0f; + p2_x = 25.0f; p2_y = -25.0f; + p3_x = 25.0f; p3_y = 25.0f; + p4_x = -25.0f; p4_y = 25.0f; + z = 0.0f; + w = 1.0f; + + viewmatrix.transform_point (out p1_x, out p1_y, out z, out w); p1_x /= w; p1_y /= w; z = 0.0f; w = 1.0f; + viewmatrix.transform_point (out p2_x, out p2_y, out z, out w); p2_x /= w; p2_y /= w; z = 0.0f; w = 1.0f; + viewmatrix.transform_point (out p3_x, out p3_y, out z, out w); p3_x /= w; p3_y /= w; z = 0.0f; w = 1.0f; + viewmatrix.transform_point (out p4_x, out p4_y, out z, out w); p4_x /= w; p4_y /= w; z = 0.0f; w = 1.0f; + Cogl.TextureVertex[4] icon_points = { + Cogl.TextureVertex () { + x = xpad +(base_width * (p1_x + 1) / 2), + y = (48 - ypad) + (base_height * (p1_y - 1) / 2), + z = 0.0f, + tx = 0.0f, + ty = 0.0f, + color = Cogl.Color () { + red = 0xff, + green = 0xff, + blue = 0xff, + alpha = 0xff + } + }, + Cogl.TextureVertex () { + x = xpad + (base_width * (p2_x + 1) / 2), + y = (48 - ypad) + (base_height * (p2_y - 1) / 2), + z = 0.0f, + tx = 1.0f, + ty = 0.0f, + color = Cogl.Color () { + red = 0xff, + green = 0xff, + blue = 0xff, + alpha = 0xff + } + }, + Cogl.TextureVertex () { + x = xpad + (base_width * (p3_x + 1) / 2), + y = (48 - ypad) + (base_height * (p3_y - 1) / 2), + z = 0.0f, + tx = 1.0f, + ty = 1.0f, + color = Cogl.Color () { + red = 0xff, + green = 0xff, + blue = 0xff, + alpha = 0xff + } + }, + Cogl.TextureVertex () { + x = xpad +(base_width * (p4_x + 1) / 2), + y = (48 - ypad) + (base_height * (p4_y - 1) / 2), + z = 0.0f, + tx = 0.0f, + ty = 1.0f, + color = Cogl.Color () { + red = 0xff, + green = 0xff, + blue = 0xff, + alpha = 0xff + } + } + }; + + int width, height; self.icon.get_base_size (out width, out height); xpad = (box.get_width () - width) / 2.0f; ypad = (box.get_height () - height) / 2.0f; Cogl.set_source (self.icon_material); - Cogl.rectangle (xpad, ypad, box.x2 - xpad, box.y2 - ypad); + Cogl.polygon (icon_points, true); } Cogl.set_source (self.fg_mat); - Cogl.rectangle (box.x1, box.y1, box.x2, box.y2); + Cogl.polygon (points, true); } public override void paint () diff --git a/unity/theme.c b/unity/theme.c index 22cf9c371..e88786513 100644 --- a/unity/theme.c +++ b/unity/theme.c @@ -302,7 +302,9 @@ static void unity_theme_file_path_path_from_theme_ready (GObject* source_object, static gboolean _unity_theme_file_path_path_from_theme_co_gsource_func (gpointer self) { - return unity_theme_file_path_path_from_theme_co (self); + gboolean result; + result = unity_theme_file_path_path_from_theme_co (self); + return result; } diff --git a/unity/unity-place.c b/unity/unity-place.c index 8a22c0af1..5998ff189 100644 --- a/unity/unity-place.c +++ b/unity/unity-place.c @@ -406,6 +406,7 @@ static GObject * unity_place_entry_info_constructor (GType type, guint n_constru static void unity_place_entry_info_finalize (GObject* obj); static void unity_place_entry_info_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); static void unity_place_entry_info_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +UnityPlaceService* unity_place_service_dbus_proxy_new (DBusGConnection* connection, const char* name, const char* path); GType unity_place_service_get_type (void); UnityPlace_EntryInfo* unity_place_service_get_entries (UnityPlaceService* self, int* result_length1, GError** error); void unity_place_service_dbus_register_object (DBusConnection* connection, const char* path, void* object); @@ -418,7 +419,6 @@ static DBusHandlerResult _dbus_unity_place_service_get_entries (UnityPlaceServic static void _dbus_unity_place_service_entry_added (GObject* _sender, UnityPlace_EntryInfo* entry, DBusConnection* _connection); static void _dbus_unity_place_service_entry_removed (GObject* _sender, const char* entry_dbus_path, DBusConnection* _connection); GType unity_place_service_dbus_proxy_get_type (void); -UnityPlaceService* unity_place_service_dbus_proxy_new (DBusGConnection* connection, const char* name, const char* path); static void _dbus_handle_unity_place_service_entry_added (UnityPlaceService* self, DBusConnection* connection, DBusMessage* message); static void _dbus_handle_unity_place_service_entry_removed (UnityPlaceService* self, DBusConnection* connection, DBusMessage* message); DBusHandlerResult unity_place_service_dbus_proxy_filter (DBusConnection* connection, DBusMessage* message, void* user_data); @@ -429,6 +429,7 @@ static UnityPlace_EntryInfo* unity_place_service_dbus_proxy_get_entries (UnityPl static void unity_place_service_dbus_proxy_unity_place_service__interface_init (UnityPlaceServiceIface* iface); static void unity_place_service_dbus_proxy_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec); static void unity_place_service_dbus_proxy_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec); +UnityPlaceEntryService* unity_place_entry_service_dbus_proxy_new (DBusGConnection* connection, const char* name, const char* path); GType unity_place_entry_service_get_type (void); guint unity_place_entry_service_set_global_search (UnityPlaceEntryService* self, const char* search, GHashTable* hints, GError** error); guint unity_place_entry_service_set_search (UnityPlaceEntryService* self, const char* search, GHashTable* hints, GError** error); @@ -445,7 +446,6 @@ static DBusHandlerResult _dbus_unity_place_entry_service_set_active (UnityPlaceE static DBusHandlerResult _dbus_unity_place_entry_service_set_active_section (UnityPlaceEntryService* self, DBusConnection* connection, DBusMessage* message); static void _dbus_unity_place_entry_service_renderer_info_changed (GObject* _sender, UnityPlace_RendererInfo* renderer_info, DBusConnection* _connection); GType unity_place_entry_service_dbus_proxy_get_type (void); -UnityPlaceEntryService* unity_place_entry_service_dbus_proxy_new (DBusGConnection* connection, const char* name, const char* path); static void _dbus_handle_unity_place_entry_service_renderer_info_changed (UnityPlaceEntryService* self, DBusConnection* connection, DBusMessage* message); DBusHandlerResult unity_place_entry_service_dbus_proxy_filter (DBusConnection* connection, DBusMessage* message, void* user_data); enum { @@ -1284,15 +1284,15 @@ static GObject * unity_place_entry_info_constructor (GType type, guint n_constru char* _tmp8_; self->priv->info.sections_model = (_tmp8_ = g_strdup (""), _g_free0 (self->priv->info.sections_model), _tmp8_); } - self->priv->info.hints = (_tmp9_ = g_hash_table_new (g_str_hash, g_str_equal), _g_hash_table_unref0 (self->priv->info.hints), _tmp9_); + self->priv->info.hints = (_tmp9_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free), _g_hash_table_unref0 (self->priv->info.hints), _tmp9_); self->priv->info.entry_renderer_info.default_renderer = (_tmp10_ = g_strdup (""), _g_free0 (self->priv->info.entry_renderer_info.default_renderer), _tmp10_); self->priv->info.entry_renderer_info.groups_model = (_tmp11_ = g_strdup (""), _g_free0 (self->priv->info.entry_renderer_info.groups_model), _tmp11_); self->priv->info.entry_renderer_info.results_model = (_tmp12_ = g_strdup (""), _g_free0 (self->priv->info.entry_renderer_info.results_model), _tmp12_); - self->priv->info.entry_renderer_info.hints = (_tmp13_ = g_hash_table_new (g_str_hash, g_str_equal), _g_hash_table_unref0 (self->priv->info.entry_renderer_info.hints), _tmp13_); + self->priv->info.entry_renderer_info.hints = (_tmp13_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free), _g_hash_table_unref0 (self->priv->info.entry_renderer_info.hints), _tmp13_); self->priv->info.global_renderer_info.default_renderer = (_tmp14_ = g_strdup (""), _g_free0 (self->priv->info.global_renderer_info.default_renderer), _tmp14_); self->priv->info.global_renderer_info.groups_model = (_tmp15_ = g_strdup (""), _g_free0 (self->priv->info.global_renderer_info.groups_model), _tmp15_); self->priv->info.global_renderer_info.results_model = (_tmp16_ = g_strdup (""), _g_free0 (self->priv->info.global_renderer_info.results_model), _tmp16_); - self->priv->info.global_renderer_info.hints = (_tmp17_ = g_hash_table_new (g_str_hash, g_str_equal), _g_hash_table_unref0 (self->priv->info.global_renderer_info.hints), _tmp17_); + self->priv->info.global_renderer_info.hints = (_tmp17_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free), _g_hash_table_unref0 (self->priv->info.global_renderer_info.hints), _tmp17_); self->priv->_entry_renderer_info = (_tmp18_ = unity_place_renderer_info_new (&self->priv->info.entry_renderer_info), _g_object_unref0 (self->priv->_entry_renderer_info), _tmp18_); self->priv->_global_renderer_info = (_tmp19_ = unity_place_renderer_info_new (&self->priv->info.global_renderer_info), _g_object_unref0 (self->priv->_global_renderer_info), _tmp19_); } @@ -4248,7 +4248,7 @@ static GObject * unity_place_service_impl_constructor (GType type, guint n_const self = UNITY_PLACE_SERVICE_IMPL (obj); { GHashTable* _tmp243_; - self->priv->entries = (_tmp243_ = g_hash_table_new (g_str_hash, g_str_equal), _g_hash_table_unref0 (self->priv->entries), _tmp243_); + self->priv->entries = (_tmp243_ = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref), _g_hash_table_unref0 (self->priv->entries), _tmp243_); } return obj; } diff --git a/unity/unity.h b/unity/unity.h index 884e3cbe5..b34a14247 100644 --- a/unity/unity.h +++ b/unity/unity.h @@ -280,6 +280,7 @@ struct _UnityEntryClass { struct _UnityUnityIcon { CtkActor parent_instance; UnityUnityIconPrivate * priv; + float rotation; }; struct _UnityUnityIconClass { diff --git a/unity/unity.vapi b/unity/unity.vapi index e6ebb0443..0cce6626d 100644 --- a/unity/unity.vapi +++ b/unity/unity.vapi @@ -210,6 +210,7 @@ namespace Unity { } [CCode (cheader_filename = "unity.h")] public class UnityIcon : Ctk.Actor { + public float rotation; public UnityIcon (Clutter.Texture? icon, Clutter.Texture? bg_tex); public override void allocate (Clutter.ActorBox box, Clutter.AllocationFlags flags); public override void get_preferred_height (float for_width, out float minimum_height, out float natural_height); diff --git a/unity/webapp-fetcher.c b/unity/webapp-fetcher.c index 990180012..7c949aaf3 100644 --- a/unity/webapp-fetcher.c +++ b/unity/webapp-fetcher.c @@ -937,7 +937,9 @@ static gboolean _lambda3_ (UnityWebappWebiconFetcher* self) { static gboolean __lambda3__gsource_func (gpointer self) { - return _lambda3_ (self); + gboolean result; + result = _lambda3_ (self); + return result; } diff --git a/vapi/cogl-1.0.vapi b/vapi/cogl-1.0.vapi index 578db3746..6ed9fa40c 100644 --- a/vapi/cogl-1.0.vapi +++ b/vapi/cogl-1.0.vapi @@ -173,8 +173,6 @@ namespace Cogl { public uint32 padding0; public uint32 padding1; public uint32 padding2; - [CCode (cname = "cogl_color_new", has_construct_function = false)] - public Color (); public Cogl.Color copy (); public static bool equal (void* v1, void* v2); public float get_alpha (); @@ -236,7 +234,7 @@ namespace Cogl { public void perspective (float fov_y, float aspect, float z_near, float z_far); public void rotate (float angle, float x, float y, float z); public void scale (float sx, float sy, float sz); - public void transform_point (float x, float y, float z, float w); + public void transform_point (out float x, out float y, out float z, out float w); public void translate (float x, float y, float z); } [CCode (type_id = "COGL_TYPE_TEXTURE_VERTEX", cheader_filename = "cogl/cogl.h")] diff --git a/vapi/mutter-2.28.vapi b/vapi/mutter-2.28.vapi index 025614c71..6aec95270 100644 --- a/vapi/mutter-2.28.vapi +++ b/vapi/mutter-2.28.vapi @@ -85,7 +85,7 @@ namespace Mutter { } [Compact] [CCode (cheader_filename = "mutter-plugins.h", cname = "MetaDisplay")] - public class MetaDisplay { + public class MetaDisplay : GLib.Object { [CCode (cname = "meta_display_begin_grab_op")] public static bool begin_grab_op (Mutter.MetaDisplay display, Mutter.MetaScreen screen, Mutter.MetaWindow window, Mutter.MetaGrabOp op, bool pointer_already_grabbed, bool frame_action, int button, ulong modmask, uint32 timestamp, int root_x, int root_y); [CCode (cname = "meta_display_end_grab_op")] @@ -675,7 +675,7 @@ namespace Mutter { } [Compact] [CCode (cheader_filename = "mutter-plugins.h", cname = "MetaWindow")] - public class MetaWindow { + public class MetaWindow : GLib.Object { [CCode (cname = "meta_window_activate")] public static void activate (Mutter.MetaWindow window, uint32 current_time); [CCode (cname = "meta_window_activate_with_workspace")] |
