Merge lp:~didrocks/unity/launcher-fixes into lp:unity

Proposed by Didier Roche-Tolomelli
Status: Merged
Approved by: Mirco Müller
Approved revision: no longer in the source branch.
Merged at revision: 959
Proposed branch: lp:~didrocks/unity/launcher-fixes
Merge into: lp:unity
Diff against target: 651 lines (+228/-141)
7 files modified
com.canonical.Unity.gschema.xml (+1/-1)
src/Launcher.cpp (+178/-129)
src/Launcher.h (+24/-7)
src/LauncherController.cpp (+4/-3)
src/LauncherController.h (+1/-1)
src/unityshell.cpp (+17/-0)
src/unityshell.h (+3/-0)
To merge this branch: bzr merge lp:~didrocks/unity/launcher-fixes
Reviewer Review Type Date Requested Status
Mirco Müller (community) Approve
Review via email: mp+53588@code.launchpad.net

Description of the change

This branch:
* Fix some false-positive when the check call isn't refresh on ws change (LP:
#730679)
* enable adding a new desktop file with the dbus call (LP: #670403)
* add another drag icon action: pressing for 500ms on a launcher icon would
decouple it from the Launcher. Clean some other code as well (LP: #727922)
* do some cleanup on the launcher code as well

To post a comment you must log in.
Revision history for this message
Mirco Müller (macslow) wrote :

This branch disables the Press&Hold activation for the Quicklist.

review: Needs Fixing
Revision history for this message
Didier Roche-Tolomelli (didrocks) wrote :

As discussed on IRC, the Press&Hold should only happen with the touch framework, not the mouse one and it's not implemented yet.

Revision history for this message
Mirco Müller (macslow) wrote :

Ok, approved then. I only wish we would have not wasted time on this before.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'com.canonical.Unity.gschema.xml'
--- com.canonical.Unity.gschema.xml 2011-03-07 15:25:13 +0000
+++ com.canonical.Unity.gschema.xml 2011-03-16 10:54:46 +0000
@@ -14,7 +14,7 @@
14 </schema>14 </schema>
15 <schema path="/desktop/unity/launcher/" id="com.canonical.Unity.Launcher" gettext-domain="unity">15 <schema path="/desktop/unity/launcher/" id="com.canonical.Unity.Launcher" gettext-domain="unity">
16 <key type="as" name="favorites">16 <key type="as" name="favorites">
17 <default>[ 'ubiquity-gtkui.desktop', 'nautilus-home.desktop', 'firefox.desktop', 'ubuntuone-control-panel-gtk.desktop', 'tomboy.desktop' ]</default>17 <default>[ 'ubiquity-gtkui.desktop', 'nautilus-home.desktop', 'firefox.desktop', 'libreoffice-writer.desktop', 'libreoffice-calc.desktop', 'libreoffice-impress.desktop', 'ubuntu-software-center.desktop', 'ubuntuone-control-panel-gtk.desktop' ]</default>
18 <summary>List of desktop file ids for favorites on the launcher.</summary>18 <summary>List of desktop file ids for favorites on the launcher.</summary>
19 <description>These applications are shown in the Launcher by default.</description>19 <description>These applications are shown in the Launcher by default.</description>
20 </key>20 </key>
2121
=== modified file 'src/Launcher.cpp'
--- src/Launcher.cpp 2011-03-11 16:59:00 +0000
+++ src/Launcher.cpp 2011-03-16 10:54:46 +0000
@@ -51,6 +51,10 @@
5151
52#define BACKLIGHT_STRENGTH 0.9f52#define BACKLIGHT_STRENGTH 0.9f
5353
54#define S_DBUS_NAME "com.canonical.Unity.Launcher"
55#define S_DBUS_PATH "/com/canonical/Unity/Launcher"
56#define S_DBUS_IFACE "com.canonical.Unity.Launcher"
57
54NUX_IMPLEMENT_OBJECT_TYPE (Launcher);58NUX_IMPLEMENT_OBJECT_TYPE (Launcher);
5559
56int60int
@@ -72,6 +76,30 @@
72 timeref->tv_nsec -= remove * 1000000;76 timeref->tv_nsec -= remove * 1000000;
73}77}
7478
79const gchar Launcher::introspection_xml[] =
80 "<node>"
81 " <interface name='com.canonical.Unity.Launcher'>"
82 ""
83 " <method name='AddLauncherItemFromPosition'>"
84 " <arg type='s' name='icon' direction='in'/>"
85 " <arg type='s' name='title' direction='in'/>"
86 " <arg type='i' name='icon_x' direction='in'/>"
87 " <arg type='i' name='icon_y' direction='in'/>"
88 " <arg type='i' name='icon_size' direction='in'/>"
89 " <arg type='s' name='desktop_file' direction='in'/>"
90 " <arg type='s' name='aptdaemon_task' direction='in'/>"
91 " </method>"
92 ""
93 " </interface>"
94 "</node>";
95
96GDBusInterfaceVTable Launcher::interface_vtable =
97{
98 Launcher::handle_dbus_method_call,
99 NULL,
100 NULL
101};
102
75103
76/*104/*
77 Use this shader to pass vertices in screen coordinates in the C++ code and compute use105 Use this shader to pass vertices in screen coordinates in the C++ code and compute use
@@ -303,9 +331,8 @@
303 _autohide_handle = 0;331 _autohide_handle = 0;
304 _autoscroll_handle = 0;332 _autoscroll_handle = 0;
305 _redraw_handle = 0;333 _redraw_handle = 0;
334 _start_dragicon_handle = 0;
306 _focus_keynav_handle = 0;335 _focus_keynav_handle = 0;
307 _single_finger_hold_handle = 0;
308 _single_finger_hold_timer = NULL;
309 _floating = false;336 _floating = false;
310 _hovered = false;337 _hovered = false;
311 _hidden = false;338 _hidden = false;
@@ -355,6 +382,15 @@
355 ubus_server_register_interest (ubus, UBUS_LAUNCHER_ACTION_DONE,382 ubus_server_register_interest (ubus, UBUS_LAUNCHER_ACTION_DONE,
356 (UBusCallback)&Launcher::OnActionDone,383 (UBusCallback)&Launcher::OnActionDone,
357 this);384 this);
385
386 _dbus_owner = g_bus_own_name (G_BUS_TYPE_SESSION,
387 S_DBUS_NAME,
388 (GBusNameOwnerFlags) (G_BUS_NAME_OWNER_FLAGS_REPLACE | G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT),
389 OnBusAcquired,
390 OnNameAcquired,
391 OnNameLost,
392 this,
393 NULL);
358394
359 SetDndEnabled (false, true);395 SetDndEnabled (false, true);
360}396}
@@ -366,6 +402,7 @@
366 if (_superkey_labels[i])402 if (_superkey_labels[i])
367 _superkey_labels[i]->UnReference ();403 _superkey_labels[i]->UnReference ();
368 }404 }
405 g_bus_unown_name (_dbus_owner);
369}406}
370407
371/* Introspection */408/* Introspection */
@@ -608,11 +645,6 @@
608 return pow (1.0f - CLAMP ((float) (TimeDelta (&current, &_times[TIME_DRAG_END])) / (float) ANIM_DURATION_LONG, 0.0f, 1.0f), 2);645 return pow (1.0f - CLAMP ((float) (TimeDelta (&current, &_times[TIME_DRAG_END])) / (float) ANIM_DURATION_LONG, 0.0f, 1.0f), 2);
609}646}
610647
611float Launcher::DnDStartProgress (struct timespec const &current)
612{
613 return CLAMP ((float) (TimeDelta (&current, &_times[TIME_DRAG_START])) / (float) ANIM_DURATION, 0.0f, 1.0f);
614}
615
616float Launcher::AutohideProgress (struct timespec const &current)648float Launcher::AutohideProgress (struct timespec const &current)
617{649{
618 650
@@ -624,7 +656,7 @@
624 return 0.0f;656 return 0.0f;
625 657
626 // "dead" zone658 // "dead" zone
627 if ((_trigger_mouse_position.x < 2) && (_trigger_mouse_position.y < 2))659 if ((_trigger_mouse_position.x < 3) && (_trigger_mouse_position.y < 3))
628 return GetAutohidePositionMin ();660 return GetAutohidePositionMin ();
629 661
630 /* 662 /*
@@ -749,10 +781,6 @@
749 // hover out animation781 // hover out animation
750 if (TimeDelta (&current, &_times[TIME_LEAVE]) < ANIM_DURATION)782 if (TimeDelta (&current, &_times[TIME_LEAVE]) < ANIM_DURATION)
751 return true;783 return true;
752
753 // drag start animation
754 if (TimeDelta (&current, &_times[TIME_DRAG_START]) < ANIM_DURATION)
755 return true;
756 784
757 // drag end animation785 // drag end animation
758 if (TimeDelta (&current, &_times[TIME_DRAG_END]) < ANIM_DURATION_LONG)786 if (TimeDelta (&current, &_times[TIME_DRAG_END]) < ANIM_DURATION_LONG)
@@ -1442,7 +1470,7 @@
1442{1470{
1443 if (hidden == _hidden)1471 if (hidden == _hidden)
1444 return;1472 return;
1445 1473
1446 // auto lock/unlock the launcher depending on the state switch1474 // auto lock/unlock the launcher depending on the state switch
1447 if (hidden)1475 if (hidden)
1448 {1476 {
@@ -1487,21 +1515,6 @@
1487 return _mouse_position.y;1515 return _mouse_position.y;
1488}1516}
14891517
1490gboolean
1491Launcher::SingleFingerHoldTimeout (gpointer data)
1492{
1493 Launcher* self = NULL;
1494 LauncherIcon* launcher_icon = NULL;
1495
1496 self = (Launcher*) data;
1497 launcher_icon = self->MouseIconIntersection (self->GetMouseX (),
1498 self->GetMouseY ());
1499 if (launcher_icon)
1500 launcher_icon->OpenQuicklist ();
1501
1502 return false;
1503}
1504
1505gboolean Launcher::DrawLauncherTimeout (gpointer data)1518gboolean Launcher::DrawLauncherTimeout (gpointer data)
1506{1519{
1507 Launcher *self = (Launcher*) data;1520 Launcher *self = (Launcher*) data;
@@ -1542,7 +1555,7 @@
1542 if (!window || !(window->type () & intersect_types) || !window->isMapped () || !window->isViewable ())1555 if (!window || !(window->type () & intersect_types) || !window->isMapped () || !window->isViewable ())
1543 return false;1556 return false;
15441557
1545 if (CompRegion (window->serverInputRect ()).intersects (CompRect (geo.x, geo.y, geo.width, geo.height)))1558 if (CompRegion (window->inputRect ()).intersects (CompRect (geo.x, geo.y, geo.width, geo.height)))
1546 return true;1559 return true;
15471560
1548 return false;1561 return false;
@@ -2337,42 +2350,31 @@
2337 guint64 shortcut = arg.icon->GetShortcut ();2350 guint64 shortcut = arg.icon->GetShortcut ();
23382351
2339 /* deal with dynamic labels for places, which can be set via the locale */2352 /* deal with dynamic labels for places, which can be set via the locale */
2340 if (shortcut != 0 && !g_ascii_isdigit ((gchar) shortcut))2353 if (shortcut != 0)
2341 {2354 {
2342 RenderIcon (GfxContext,2355 if (!g_ascii_isdigit ((gchar) shortcut))
2343 arg,
2344 arg.icon->GetSuperkeyLabel ()->GetDeviceTexture (),
2345 nux::Color (0xFFFFFFFF),
2346 arg.alpha,
2347 arg.icon->_xform_coords["Tile"]);
2348 }
2349 else
2350 {
2351 /* deal with the hardcoded labels used for the first 10 icons on the launcher */
2352 gchar key = (gchar) shortcut;
2353 int index = -1;
2354
2355 switch (key)
2356 {2356 {
2357 case '1': index = 0; break;2357 RenderIcon (GfxContext,
2358 case '2': index = 1; break;2358 arg,
2359 case '3': index = 2; break;2359 arg.icon->GetSuperkeyLabel ()->GetDeviceTexture (),
2360 case '4': index = 3; break;2360 nux::Color (0xFFFFFFFF),
2361 case '5': index = 4; break;2361 arg.alpha,
2362 case '6': index = 5; break;2362 arg.icon->_xform_coords["Tile"]);
2363 case '7': index = 6; break;
2364 case '8': index = 7; break;
2365 case '9': index = 8; break;
2366 case '0': index = 9; break;
2367 }2363 }
23682364 else
2369 if (index != -1)2365 {
2366 /* deal with the hardcoded labels used for the first 10 icons on the launcher */
2367 gchar *shortcut_str = g_strdup_printf ("%c", (gchar)shortcut);
2368 int index = (atoi (shortcut_str) + 9) % 10; // Not -1 as -1 % 10 = -1…
2369 g_free (shortcut_str);
2370
2370 RenderIcon (GfxContext,2371 RenderIcon (GfxContext,
2371 arg,2372 arg,
2372 _superkey_labels[index]->GetDeviceTexture (),2373 _superkey_labels[index]->GetDeviceTexture (),
2373 nux::Color (0xFFFFFFFF),2374 nux::Color (0xFFFFFFFF),
2374 arg.alpha,2375 arg.alpha,
2375 arg.icon->_xform_coords["Tile"]);2376 arg.icon->_xform_coords["Tile"]);
2377 }
2376 }2378 }
2377 }2379 }
2378}2380}
@@ -2499,6 +2501,31 @@
2499 EnsureAnimation ();2501 EnsureAnimation ();
2500}2502}
25012503
2504
2505gboolean Launcher::StartIconDragTimeout (gpointer data)
2506{
2507 Launcher *self = (Launcher*) data;
2508
2509 // if we are still waiting…
2510 if (self->GetActionState () == ACTION_NONE)
2511 self->StartIconDragRequest (self->GetMouseX (), self->GetMouseY ());
2512 return false;
2513}
2514
2515void Launcher::StartIconDragRequest (int x, int y)
2516{
2517 LauncherIcon *drag_icon = MouseIconIntersection ((int) (GetGeometry ().x / 2.0f), y);
2518
2519 // FIXME: nux doesn't give nux::GetEventButton (button_flags) there, relying
2520 // on an internal Launcher property then
2521 if (drag_icon && (_last_button_press == 1) && _model->IconHasSister (drag_icon))
2522 {
2523 StartIconDrag (drag_icon);
2524 SetActionState (ACTION_DRAG_ICON);
2525 UpdateDragWindowPosition (x, y);
2526 }
2527}
2528
2502void Launcher::StartIconDrag (LauncherIcon *icon)2529void Launcher::StartIconDrag (LauncherIcon *icon)
2503{2530{
2504 if (!icon)2531 if (!icon)
@@ -2612,8 +2639,6 @@
26122639
2613 if (GetActionState () == ACTION_NONE)2640 if (GetActionState () == ACTION_NONE)
2614 {2641 {
2615 SetTimeStruct (&_times[TIME_DRAG_START]);
2616
2617 if (nux::Abs (_dnd_delta_y) >= nux::Abs (_dnd_delta_x))2642 if (nux::Abs (_dnd_delta_y) >= nux::Abs (_dnd_delta_x))
2618 {2643 {
2619 _launcher_drag_delta += _dnd_delta_y;2644 _launcher_drag_delta += _dnd_delta_y;
@@ -2621,17 +2646,7 @@
2621 }2646 }
2622 else2647 else
2623 {2648 {
2624 LauncherIcon *drag_icon = MouseIconIntersection ((int) (GetGeometry ().x / 2.0f), y);2649 StartIconDragRequest (x, y);
2625
2626 // FIXME: nux doesn't give nux::GetEventButton (button_flags) there, relying
2627 // on an internal Launcher property then
2628 if (drag_icon && (_last_button_press == 1) && _model->IconHasSister (drag_icon))
2629 {
2630 StartIconDrag (drag_icon);
2631 SetActionState (ACTION_DRAG_ICON);
2632 UpdateDragWindowPosition (x, y);
2633 }
2634
2635 }2650 }
2636 }2651 }
2637 else if (GetActionState () == ACTION_DRAG_LAUNCHER)2652 else if (GetActionState () == ACTION_DRAG_LAUNCHER)
@@ -2883,21 +2898,14 @@
2883 LauncherIcon* launcher_icon = 0;2898 LauncherIcon* launcher_icon = 0;
2884 launcher_icon = MouseIconIntersection (_mouse_position.x, _mouse_position.y);2899 launcher_icon = MouseIconIntersection (_mouse_position.x, _mouse_position.y);
28852900
2886 // this takes care of the one-finger-hold "event" on a launcher-icon
2887 if (_single_finger_hold_handle == 0)
2888 {
2889 _single_finger_hold_handle = g_timeout_add (SINGLE_FINGER_HOLD_DURATION,
2890 &Launcher::SingleFingerHoldTimeout,
2891 this);
2892 if (_single_finger_hold_timer)
2893 g_timer_destroy (_single_finger_hold_timer);
2894
2895 _single_finger_hold_timer = g_timer_new ();
2896 }
2897
2898 if (launcher_icon)2901 if (launcher_icon)
2899 {2902 {
2900 _icon_mouse_down = launcher_icon;2903 _icon_mouse_down = launcher_icon;
2904 // if MouseUp after the time ended -> it's an icon drag, otherwise, it's starting an app
2905 if (_start_dragicon_handle > 0)
2906 g_source_remove (_start_dragicon_handle);
2907 _start_dragicon_handle = g_timeout_add (START_DRAGICON_DURATION, &Launcher::StartIconDragTimeout, this);
2908
2901 launcher_icon->MouseDown.emit (nux::GetEventButton (button_flags));2909 launcher_icon->MouseDown.emit (nux::GetEventButton (button_flags));
2902 }2910 }
2903}2911}
@@ -2905,59 +2913,20 @@
2905void Launcher::MouseUpLogic (int x, int y, unsigned long button_flags, unsigned long key_flags)2913void Launcher::MouseUpLogic (int x, int y, unsigned long button_flags, unsigned long key_flags)
2906{2914{
2907 LauncherIcon* launcher_icon = 0;2915 LauncherIcon* launcher_icon = 0;
2916
2908 launcher_icon = MouseIconIntersection (_mouse_position.x, _mouse_position.y);2917 launcher_icon = MouseIconIntersection (_mouse_position.x, _mouse_position.y);
29092918
2910 // this takes care of the one-finger-hold "event" on a launcher-icon2919 if (_start_dragicon_handle > 0)
2911 if (_single_finger_hold_timer)2920 g_source_remove (_start_dragicon_handle);
2912 {2921 _start_dragicon_handle = 0;
2913 // user "released" before single-finger-hold threshold
2914 if (g_timer_elapsed (_single_finger_hold_timer, NULL) < (float) SINGLE_FINGER_HOLD_DURATION / 1000.0)
2915 {
2916
2917 // remove callback
2918 if (_single_finger_hold_handle > 0)
2919 {
2920 g_source_remove (_single_finger_hold_handle);
2921 _single_finger_hold_handle = 0;
2922 }
2923 }
2924 // user "released" after single-finger-hold threshold...
2925 else
2926 {
2927 // remove timer
2928 g_timer_destroy (_single_finger_hold_timer);
2929 _single_finger_hold_timer = NULL;
2930
2931 // remove callback
2932 if (_single_finger_hold_handle > 0)
2933 {
2934 g_source_remove (_single_finger_hold_handle);
2935 _single_finger_hold_handle = 0;
2936 }
2937
2938 // ... don't start app, just return
2939 _icon_mouse_down = 0;
2940 return;
2941 }
2942
2943 // remove timer
2944 g_timer_destroy (_single_finger_hold_timer);
2945 _single_finger_hold_timer = NULL;
2946
2947 // remove callback
2948 if (_single_finger_hold_handle > 0)
2949 {
2950 g_source_remove (_single_finger_hold_handle);
2951 _single_finger_hold_handle = 0;
2952 }
2953 }
29542922
2955 if (_icon_mouse_down && (_icon_mouse_down == launcher_icon))2923 if (_icon_mouse_down && (_icon_mouse_down == launcher_icon))
2956 {2924 {
2957 _icon_mouse_down->MouseUp.emit (nux::GetEventButton (button_flags));2925 _icon_mouse_down->MouseUp.emit (nux::GetEventButton (button_flags));
29582926
2959 if (GetActionState () == ACTION_NONE)2927 if (GetActionState () == ACTION_NONE) {
2960 _icon_mouse_down->MouseClick.emit (nux::GetEventButton (button_flags));2928 _icon_mouse_down->MouseClick.emit (nux::GetEventButton (button_flags));
2929 }
2961 }2930 }
29622931
2963 if (launcher_icon && (_icon_mouse_down != launcher_icon))2932 if (launcher_icon && (_icon_mouse_down != launcher_icon))
@@ -3658,7 +3627,7 @@
3658 3627
3659 if (path)3628 if (path)
3660 {3629 {
3661 launcher_dropped.emit (path, _dnd_hovered_icon);3630 launcher_addrequest.emit (path, _dnd_hovered_icon);
3662 g_free (path);3631 g_free (path);
3663 }3632 }
3664 }3633 }
@@ -3696,3 +3665,83 @@
3696 else3665 else
3697 return NULL;3666 return NULL;
3698}3667}
3668
3669/* dbus handlers */
3670
3671void
3672Launcher::handle_dbus_method_call (GDBusConnection *connection,
3673 const gchar *sender,
3674 const gchar *object_path,
3675 const gchar *interface_name,
3676 const gchar *method_name,
3677 GVariant *parameters,
3678 GDBusMethodInvocation *invocation,
3679 gpointer user_data)
3680{
3681
3682 if (g_strcmp0 (method_name, "AddLauncherItemFromPosition") == 0)
3683 {
3684 gchar *icon;
3685 gchar *title;
3686 gint32 icon_x;
3687 gint32 icon_y;
3688 gint32 icon_size;
3689 gchar *desktop_file;
3690 gchar *aptdaemon_task;
3691
3692 g_variant_get (parameters, "(ssiiiss)", &icon, &title, &icon_x, &icon_y, &icon_size, &desktop_file, &aptdaemon_task, NULL);
3693
3694 Launcher *self = (Launcher*)user_data;
3695 self->launcher_addrequest.emit (desktop_file, NULL);
3696
3697 g_dbus_method_invocation_return_value (invocation, NULL);
3698 g_free (icon);
3699 g_free (title);
3700 g_free (desktop_file);
3701 g_free (aptdaemon_task);
3702 }
3703
3704}
3705
3706void
3707Launcher::OnBusAcquired (GDBusConnection *connection,
3708 const gchar *name,
3709 gpointer user_data)
3710{
3711 GDBusNodeInfo *introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL);
3712 guint registration_id;
3713
3714 if (!introspection_data) {
3715 g_warning ("No introspection data loaded. Won't get dynamic launcher addition.");
3716 return;
3717 }
3718
3719
3720
3721 registration_id = g_dbus_connection_register_object (connection,
3722 S_DBUS_PATH,
3723 introspection_data->interfaces[0],
3724 &interface_vtable,
3725 user_data,
3726 NULL,
3727 NULL);
3728 if (!registration_id)
3729 g_warning ("Object registration failed. Won't get dynamic launcher addition.");
3730
3731}
3732
3733void
3734Launcher::OnNameAcquired (GDBusConnection *connection,
3735 const gchar *name,
3736 gpointer user_data)
3737{
3738 g_debug ("Acquired the name %s on the session bus\n", name);
3739}
3740
3741void
3742Launcher::OnNameLost (GDBusConnection *connection,
3743 const gchar *name,
3744 gpointer user_data)
3745{
3746 g_debug ("Lost the name %s on the session bus\n", name);
3747}
36993748
=== modified file 'src/Launcher.h'
--- src/Launcher.h 2011-03-07 17:02:59 +0000
+++ src/Launcher.h 2011-03-16 10:54:46 +0000
@@ -39,7 +39,7 @@
39#define ANIM_DURATION_LONG 35039#define ANIM_DURATION_LONG 350
4040
41#define SUPER_TAP_DURATION 25041#define SUPER_TAP_DURATION 250
42#define SINGLE_FINGER_HOLD_DURATION 100042#define START_DRAGICON_DURATION 500
4343
44#define MAX_SUPERKEY_LABELS 1044#define MAX_SUPERKEY_LABELS 10
4545
@@ -154,8 +154,10 @@
154154
155 int GetMouseX ();155 int GetMouseX ();
156 int GetMouseY ();156 int GetMouseY ();
157
158 void CheckWindowOverLauncher ();
157159
158 sigc::signal<void, char *, LauncherIcon *> launcher_dropped;160 sigc::signal<void, char *, LauncherIcon *> launcher_addrequest;
159 sigc::signal<void> selection_change;161 sigc::signal<void> selection_change;
160protected:162protected:
161 // Introspectable methods163 // Introspectable methods
@@ -179,7 +181,6 @@
179 {181 {
180 TIME_ENTER,182 TIME_ENTER,
181 TIME_LEAVE,183 TIME_LEAVE,
182 TIME_DRAG_START,
183 TIME_DRAG_END,184 TIME_DRAG_END,
184 TIME_DRAG_THRESHOLD,185 TIME_DRAG_THRESHOLD,
185 TIME_AUTOHIDE,186 TIME_AUTOHIDE,
@@ -223,7 +224,7 @@
223 static gboolean DrawLauncherTimeout (gpointer data);224 static gboolean DrawLauncherTimeout (gpointer data);
224 static gboolean StrutHack (gpointer data);225 static gboolean StrutHack (gpointer data);
225 static gboolean MoveFocusToKeyNavModeTimeout (gpointer data);226 static gboolean MoveFocusToKeyNavModeTimeout (gpointer data);
226 static gboolean SingleFingerHoldTimeout (gpointer data);227 static gboolean StartIconDragTimeout (gpointer data);
227228
228 void SetMousePosition (int x, int y);229 void SetMousePosition (int x, int y);
229 230
@@ -252,7 +253,6 @@
252 static gboolean OnScrollTimeout (gpointer data);253 static gboolean OnScrollTimeout (gpointer data);
253 static gboolean OnUpdateDragManagerTimeout (gpointer data);254 static gboolean OnUpdateDragManagerTimeout (gpointer data);
254255
255 void CheckWindowOverLauncher ();
256 bool CheckIntersectWindow (CompWindow *window);256 bool CheckIntersectWindow (CompWindow *window);
257257
258 float DnDStartProgress (struct timespec const &current);258 float DnDStartProgress (struct timespec const &current);
@@ -343,6 +343,7 @@
343 void MouseDownLogic (int x, int y, unsigned long button_flags, unsigned long key_flags);343 void MouseDownLogic (int x, int y, unsigned long button_flags, unsigned long key_flags);
344 void MouseUpLogic (int x, int y, unsigned long button_flags, unsigned long key_flags);344 void MouseUpLogic (int x, int y, unsigned long button_flags, unsigned long key_flags);
345 345
346 void StartIconDragRequest (int x, int y);
346 void StartIconDrag (LauncherIcon *icon);347 void StartIconDrag (LauncherIcon *icon);
347 void EndIconDrag ();348 void EndIconDrag ();
348 void UpdateDragWindowPosition (int x, int y);349 void UpdateDragWindowPosition (int x, int y);
@@ -461,8 +462,7 @@
461 guint _autoscroll_handle;462 guint _autoscroll_handle;
462 guint _focus_keynav_handle;463 guint _focus_keynav_handle;
463 guint _redraw_handle;464 guint _redraw_handle;
464 guint _single_finger_hold_handle;465 guint _start_dragicon_handle;
465 GTimer* _single_finger_hold_timer;
466466
467 nux::Point2 _mouse_position;467 nux::Point2 _mouse_position;
468 nux::Point2 _trigger_mouse_position;468 nux::Point2 _trigger_mouse_position;
@@ -483,6 +483,23 @@
483 LauncherIcon *_dnd_hovered_icon;483 LauncherIcon *_dnd_hovered_icon;
484 484
485 Atom _selection_atom;485 Atom _selection_atom;
486
487 /* gdbus */
488 guint _dbus_owner;
489 static const gchar introspection_xml[];
490 static GDBusInterfaceVTable interface_vtable;
491
492 static void OnBusAcquired (GDBusConnection *connection, const gchar *name, gpointer user_data);
493 static void OnNameAcquired (GDBusConnection *connection, const gchar *name, gpointer user_data);
494 static void OnNameLost (GDBusConnection *connection, const gchar *name, gpointer user_data);
495 static void handle_dbus_method_call (GDBusConnection *connection,
496 const gchar *sender,
497 const gchar *object_path,
498 const gchar *interface_name,
499 const gchar *method_name,
500 GVariant *parameters,
501 GDBusMethodInvocation *invocation,
502 gpointer user_data);
486 503
487 struct timespec _times[TIME_LAST];504 struct timespec _times[TIME_LAST];
488};505};
489506
=== modified file 'src/LauncherController.cpp'
--- src/LauncherController.cpp 2011-02-28 15:51:59 +0000
+++ src/LauncherController.cpp 2011-03-16 10:54:46 +0000
@@ -38,7 +38,7 @@
38 _sort_priority = 0;38 _sort_priority = 0;
39 39
40 _launcher->SetModel (_model);40 _launcher->SetModel (_model);
41 _launcher->launcher_dropped.connect (sigc::mem_fun (this, &LauncherController::OnLauncherDropped));41 _launcher->launcher_addrequest.connect (sigc::mem_fun (this, &LauncherController::OnLauncherAddRequest));
42 _favorite_store = FavoriteStore::GetDefault ();42 _favorite_store = FavoriteStore::GetDefault ();
4343
44 _place_section = new PlaceLauncherSection (_launcher);44 _place_section = new PlaceLauncherSection (_launcher);
@@ -69,7 +69,7 @@
69}69}
7070
71void71void
72LauncherController::OnLauncherDropped (char *path, LauncherIcon *before)72LauncherController::OnLauncherAddRequest (char *path, LauncherIcon *before)
73{73{
74 std::list<BamfLauncherIcon *> launchers;74 std::list<BamfLauncherIcon *> launchers;
75 std::list<BamfLauncherIcon *>::iterator it;75 std::list<BamfLauncherIcon *>::iterator it;
@@ -85,7 +85,8 @@
85 if (result)85 if (result)
86 {86 {
87 RegisterIcon (result);87 RegisterIcon (result);
88 _model->ReorderBefore (result, before, false);88 if (before)
89 _model->ReorderBefore (result, before, false);
89 }90 }
90}91}
9192
9293
=== modified file 'src/LauncherController.h'
--- src/LauncherController.h 2011-02-15 22:51:36 +0000
+++ src/LauncherController.h 2011-03-16 10:54:46 +0000
@@ -69,7 +69,7 @@
6969
70 void OnIconAdded (LauncherIcon *icon);70 void OnIconAdded (LauncherIcon *icon);
71 71
72 void OnLauncherDropped (char *path, LauncherIcon *before);72 void OnLauncherAddRequest (char *path, LauncherIcon *before);
7373
74 void OnLauncerEntryRemoteAdded (LauncherEntryRemote *entry);74 void OnLauncerEntryRemoteAdded (LauncherEntryRemote *entry);
75 void OnLauncerEntryRemoteRemoved (LauncherEntryRemote *entry);75 void OnLauncerEntryRemoteRemoved (LauncherEntryRemote *entry);
7676
=== modified file 'src/unityshell.cpp'
--- src/unityshell.cpp 2011-03-10 15:39:00 +0000
+++ src/unityshell.cpp 2011-03-16 10:54:46 +0000
@@ -210,6 +210,23 @@
210 }210 }
211}211}
212212
213void
214UnityScreen::handleCompizEvent (const char *plugin,
215 const char *event,
216 CompOption::Vector &option)
217{
218 if (strcmp (event, "end_viewport_switch") == 0)
219 {
220 // compute again the list of all window on the new viewport
221 // to decide if we should or not hide the launcher
222 launcher->CheckWindowOverLauncher ();
223 }
224
225
226 screen->handleCompizEvent (plugin, event, option);
227
228}
229
213bool230bool
214UnityScreen::showLauncherKeyInitiate (CompAction *action,231UnityScreen::showLauncherKeyInitiate (CompAction *action,
215 CompAction::State state,232 CompAction::State state,
216233
=== modified file 'src/unityshell.h'
--- src/unityshell.h 2011-03-09 19:12:37 +0000
+++ src/unityshell.h 2011-03-16 10:54:46 +0000
@@ -95,6 +95,9 @@
9595
96 /* handle X11 events */96 /* handle X11 events */
97 void handleEvent (XEvent *);97 void handleEvent (XEvent *);
98 void handleCompizEvent (const char *plugin,
99 const char *event,
100 CompOption::Vector &option);
98 101
99 bool102 bool
100 showLauncherKeyInitiate (CompAction *action, CompAction::State state,103 showLauncherKeyInitiate (CompAction *action, CompAction::State state,