Merge lp:~didrocks/unity/launcher-fix-of-the-week-04-04-11 into lp:unity

Proposed by Didier Roche-Tolomelli
Status: Merged
Merged at revision: 1075
Proposed branch: lp:~didrocks/unity/launcher-fix-of-the-week-04-04-11
Merge into: lp:unity
Diff against target: 731 lines (+225/-84)
13 files modified
src/BamfLauncherIcon.cpp (+1/-6)
src/DeviceLauncherSection.cpp (+6/-1)
src/DeviceLauncherSection.h (+1/-0)
src/Launcher.cpp (+144/-46)
src/Launcher.h (+17/-2)
src/LauncherHideMachine.cpp (+30/-4)
src/LauncherHideMachine.h (+4/-1)
src/LauncherHoverMachine.cpp (+11/-11)
src/LauncherHoverMachine.h (+2/-2)
src/PanelTray.cpp (+4/-9)
src/PanelTray.h (+0/-2)
src/PlacesController.cpp (+3/-0)
src/PlacesResultsController.cpp (+2/-0)
To merge this branch: bzr merge lp:~didrocks/unity/launcher-fix-of-the-week-04-04-11
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Review via email: mp+56415@code.launchpad.net

Description of the change

This branch:
- fix an issue with repeated key (LP: #750535)
- reduce shortcuts label size and change some super behaviour (LP: #747812)
- additional cleanage (signals and code)
- prevents false positive "bring the dash" positive even when we are in scale
  mode (not directly handled by unity) (LP: #751102)
- Avoid spamming the launcher with state change when the state is finally the
  same. (Launcher and Hover machine). That will hopefully fix the "click
  through" bug when the Launcher wrongly stay visible (half of bug LP: #744325)
- move the position of the icon on timeout drag. Fix a potential crasher as well
  (LP: #751196)

To post a comment you must log in.
Revision history for this message
Jason Smith (jassmith) wrote :

+1 approve

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/BamfLauncherIcon.cpp'
--- src/BamfLauncherIcon.cpp 2011-04-02 08:36:07 +0000
+++ src/BamfLauncherIcon.cpp 2011-04-05 17:30:38 +0000
@@ -692,12 +692,7 @@
692692
693 if (sticky)693 if (sticky)
694 {694 {
695 bamf_view_set_sticky (view, false);695 self->UnStick ();
696 if (bamf_view_is_closed (view))
697 self->Remove ();
698
699 if (desktop_file && strlen (desktop_file) > 0)
700 FavoriteStore::GetDefault ()->RemoveFavorite (desktop_file);
701 }696 }
702 else697 else
703 {698 {
704699
=== modified file 'src/DeviceLauncherSection.cpp'
--- src/DeviceLauncherSection.cpp 2011-03-29 14:36:45 +0000
+++ src/DeviceLauncherSection.cpp 2011-04-05 17:30:38 +0000
@@ -41,7 +41,7 @@
41 G_CALLBACK (&DeviceLauncherSection::OnMountAdded),41 G_CALLBACK (&DeviceLauncherSection::OnMountAdded),
42 this);42 this);
4343
44 g_idle_add ((GSourceFunc)&DeviceLauncherSection::PopulateEntries, this);44 _on_device_populate_entry_id = g_idle_add ((GSourceFunc)&DeviceLauncherSection::PopulateEntries, this);
45}45}
4646
47DeviceLauncherSection::~DeviceLauncherSection ()47DeviceLauncherSection::~DeviceLauncherSection ()
@@ -58,6 +58,9 @@
58 g_signal_handler_disconnect ((gpointer) _monitor,58 g_signal_handler_disconnect ((gpointer) _monitor,
59 _on_mount_added_handler_id);59 _on_mount_added_handler_id);
6060
61 if (_on_device_populate_entry_id)
62 g_source_remove (_on_device_populate_entry_id);
63
61 g_object_unref (_monitor);64 g_object_unref (_monitor);
62 g_hash_table_unref (_ht);65 g_hash_table_unref (_ht);
63}66}
@@ -81,6 +84,8 @@
81 }84 }
8285
83 g_list_free (volumes);86 g_list_free (volumes);
87
88 self->_on_device_populate_entry_id = 0;
8489
85 return false;90 return false;
86}91}
8792
=== modified file 'src/DeviceLauncherSection.h'
--- src/DeviceLauncherSection.h 2011-03-29 14:36:45 +0000
+++ src/DeviceLauncherSection.h 2011-04-05 17:30:38 +0000
@@ -56,6 +56,7 @@
56 gulong _on_volume_added_handler_id;56 gulong _on_volume_added_handler_id;
57 gulong _on_volume_removed_handler_id;57 gulong _on_volume_removed_handler_id;
58 gulong _on_mount_added_handler_id;58 gulong _on_mount_added_handler_id;
59 gulong _on_device_populate_entry_id;
59};60};
6061
61#endif // _DEVICE_LAUNCHER_SECTION_H_62#endif // _DEVICE_LAUNCHER_SECTION_H_
6263
=== modified file 'src/Launcher.cpp'
--- src/Launcher.cpp 2011-04-03 06:20:39 +0000
+++ src/Launcher.cpp 2011-04-05 17:30:38 +0000
@@ -357,11 +357,19 @@
357 _launcher_drag_delta = 0;357 _launcher_drag_delta = 0;
358 _dnd_delta_y = 0;358 _dnd_delta_y = 0;
359 _dnd_delta_x = 0;359 _dnd_delta_x = 0;
360 _autoscroll_handle = 0;360
361 _redraw_handle = 0;361 _autoscroll_handle = 0;
362 _start_dragicon_handle = 0;362 _super_show_launcher_handle = 0;
363 _focus_keynav_handle = 0;363 _super_hide_launcher_handle = 0;
364 _dnd_check_handle = 0;364 _super_show_shortcuts_handle = 0;
365 _start_dragicon_handle = 0;
366 _focus_keynav_handle = 0;
367 _dnd_check_handle = 0;
368 _ignore_repeat_shortcut_handle = 0;
369
370 _latest_shortcut = 0;
371 _super_pressed = false;
372 _shortcuts_shown = false;
365 _floating = false;373 _floating = false;
366 _hovered = false;374 _hovered = false;
367 _hidden = false;375 _hidden = false;
@@ -431,10 +439,23 @@
431 g_bus_unown_name (_dbus_owner);439 g_bus_unown_name (_dbus_owner);
432 440
433 if (_dnd_check_handle)441 if (_dnd_check_handle)
434 {
435 g_source_remove (_dnd_check_handle);442 g_source_remove (_dnd_check_handle);
436 _dnd_check_handle = 0;443 if (_autoscroll_handle)
437 }444 g_source_remove (_autoscroll_handle);
445 if (_focus_keynav_handle)
446 g_source_remove (_focus_keynav_handle);
447 if (_super_show_launcher_handle)
448 g_source_remove (_super_show_launcher_handle);
449 if (_super_show_shortcuts_handle)
450 g_source_remove (_super_show_shortcuts_handle);
451 if (_start_dragicon_handle)
452 g_source_remove (_start_dragicon_handle);
453 if (_ignore_repeat_shortcut_handle)
454 g_source_remove (_ignore_repeat_shortcut_handle);
455 if (_super_show_launcher_handle)
456 g_source_remove (_super_show_launcher_handle);
457 if (_super_hide_launcher_handle)
458 g_source_remove (_super_hide_launcher_handle);
438459
439 // disconnect the huge number of signal-slot callbacks460 // disconnect the huge number of signal-slot callbacks
440 if (_set_hidden_connection.connected ())461 if (_set_hidden_connection.connected ())
@@ -502,6 +523,7 @@
502 523
503 if (_on_drag_finish_connection.connected ())524 if (_on_drag_finish_connection.connected ())
504 _on_drag_finish_connection.disconnect ();525 _on_drag_finish_connection.disconnect ();
526
505}527}
506528
507/* Introspection */529/* Introspection */
@@ -526,6 +548,7 @@
526 gchar* fontName = NULL;548 gchar* fontName = NULL;
527549
528 double label_pos = double(_icon_size / 3.0f);550 double label_pos = double(_icon_size / 3.0f);
551 double text_size = double(_icon_size / 4.0f);
529 double label_x = label_pos;552 double label_x = label_pos;
530 double label_y = label_pos;553 double label_y = label_pos;
531 double label_w = label_pos;554 double label_w = label_pos;
@@ -543,7 +566,7 @@
543 layout = pango_cairo_create_layout (cr);566 layout = pango_cairo_create_layout (cr);
544 g_object_get (settings, "gtk-font-name", &fontName, NULL);567 g_object_get (settings, "gtk-font-name", &fontName, NULL);
545 desc = pango_font_description_from_string (fontName);568 desc = pango_font_description_from_string (fontName);
546 pango_font_description_set_absolute_size (desc, label_pos * PANGO_SCALE);569 pango_font_description_set_absolute_size (desc, text_size * PANGO_SCALE);
547 pango_layout_set_font_description (layout, desc);570 pango_layout_set_font_description (layout, desc);
548 pango_layout_set_text (layout, &label, 1);571 pango_layout_set_text (layout, &label, 1);
549 pangoCtx = pango_layout_get_context (layout); // is not ref'ed572 pangoCtx = pango_layout_get_context (layout); // is not ref'ed
@@ -652,6 +675,7 @@
652 NULL);675 NULL);
653676
654 self->selection_change.emit ();677 self->selection_change.emit ();
678 self->_focus_keynav_handle = 0;
655679
656 return false;680 return false;
657}681}
@@ -1479,44 +1503,89 @@
1479gboolean Launcher::TapOnSuper ()1503gboolean Launcher::TapOnSuper ()
1480{1504{
1481 struct timespec current;1505 struct timespec current;
1482 bool tap_on_super;
1483 bool shortcuts_shown = false;
1484 clock_gettime (CLOCK_MONOTONIC, &current);1506 clock_gettime (CLOCK_MONOTONIC, &current);
1485 1507
1486 tap_on_super = (TimeDelta (&current, &_times[TIME_TAP_SUPER]) < SUPER_TAP_DURATION);1508 return (TimeDelta (&current, &_times[TIME_TAP_SUPER]) < SUPER_TAP_DURATION);
1487
1488 if (_hide_machine->GetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN))
1489 shortcuts_shown = !tap_on_super;
1490
1491 _hover_machine->SetQuirk (LauncherHoverMachine::SHOTCUT_KEYS_VISIBLE, shortcuts_shown);
1492
1493 return tap_on_super;
1494
1495}1509}
14961510
1497/* Launcher Show/Hide logic */1511/* Launcher Show/Hide logic */
14981512
1499void Launcher::StartKeyShowLauncher ()1513void Launcher::StartKeyShowLauncher ()
1500{1514{
1501 _hide_machine->SetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN, true);1515 _super_pressed = true;
1502 _hide_machine->SetQuirk (LauncherHideMachine::LAST_ACTION_ACTIVATE, false);1516 _hide_machine->SetQuirk (LauncherHideMachine::LAST_ACTION_ACTIVATE, false);
1503 QueueDraw ();1517
1504 SetTimeStruct (&_times[TIME_TAP_SUPER], NULL, SUPER_TAP_DURATION);1518 SetTimeStruct (&_times[TIME_TAP_SUPER]);
1505 if (_redraw_handle > 0)1519 SetTimeStruct (&_times[TIME_SUPER_PRESSED]);
1506 g_source_remove (_redraw_handle);1520
1507 _redraw_handle = g_timeout_add (SUPER_TAP_DURATION, &Launcher::DrawLauncherTimeout, this);1521 if (_super_show_launcher_handle > 0)
1522 g_source_remove (_super_show_launcher_handle);
1523 _super_show_launcher_handle = g_timeout_add (SUPER_TAP_DURATION, &Launcher::SuperShowLauncherTimeout, this);
1524
1525 if (_super_show_shortcuts_handle > 0)
1526 g_source_remove (_super_show_shortcuts_handle);
1527 _super_show_shortcuts_handle = g_timeout_add (SHORTCUTS_SHOWN_DELAY, &Launcher::SuperShowShortcutsTimeout, this);
1508}1528}
15091529
1510void Launcher::EndKeyShowLauncher ()1530void Launcher::EndKeyShowLauncher ()
1511{1531{
1512 1532 int remaining_time_before_hide;
1513 _hide_machine->SetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN, false);1533 struct timespec current;
1514 _hover_machine->SetQuirk (LauncherHoverMachine::SHOTCUT_KEYS_VISIBLE, false);1534 clock_gettime (CLOCK_MONOTONIC, &current);
1535
1536 _hover_machine->SetQuirk (LauncherHoverMachine::SHORTCUT_KEYS_VISIBLE, false);
1537 _super_pressed = false;
1538 _shortcuts_shown = false;
1515 QueueDraw ();1539 QueueDraw ();
15161540
1517 // it's a tap on super1541 // remove further show launcher (which can happen when we close the dash with super)
1518 if (TapOnSuper ())1542 if (_super_show_launcher_handle > 0)
1519 ubus_server_send_message (ubus_server_get_default (), UBUS_DASH_EXTERNAL_ACTIVATION, NULL); 1543 g_source_remove (_super_show_launcher_handle);
1544 if (_super_show_shortcuts_handle > 0)
1545 g_source_remove (_super_show_shortcuts_handle);
1546
1547 // it's a tap on super and we didn't use any shortcuts
1548 if (TapOnSuper () && !_latest_shortcut)
1549 ubus_server_send_message (ubus_server_get_default (), UBUS_DASH_EXTERNAL_ACTIVATION, NULL);
1550
1551 remaining_time_before_hide = BEFORE_HIDE_LAUNCHER_ON_SUPER_DURATION - CLAMP ((int) (TimeDelta (&current, &_times[TIME_SUPER_PRESSED])), 0, BEFORE_HIDE_LAUNCHER_ON_SUPER_DURATION);
1552
1553 if (_super_hide_launcher_handle > 0)
1554 g_source_remove (_super_hide_launcher_handle);
1555 _super_hide_launcher_handle = g_timeout_add (remaining_time_before_hide, &Launcher::SuperHideLauncherTimeout, this);
1556}
1557
1558gboolean Launcher::SuperHideLauncherTimeout (gpointer data)
1559{
1560 Launcher *self = (Launcher*) data;
1561
1562 self->_hide_machine->SetQuirk (LauncherHideMachine::TRIGGER_BUTTON_SHOW, false);
1563
1564 self->_super_hide_launcher_handle = 0;
1565 return false;
1566}
1567
1568gboolean Launcher::SuperShowLauncherTimeout (gpointer data)
1569{
1570 Launcher *self = (Launcher*) data;
1571
1572 self->_hide_machine->SetQuirk (LauncherHideMachine::TRIGGER_BUTTON_SHOW, true);
1573
1574 self->_super_show_launcher_handle = 0;
1575 return false;
1576}
1577
1578gboolean Launcher::SuperShowShortcutsTimeout (gpointer data)
1579{
1580 Launcher *self = (Launcher*) data;
1581
1582 self->_shortcuts_shown = true;
1583 self->_hover_machine->SetQuirk (LauncherHoverMachine::SHORTCUT_KEYS_VISIBLE, true);
1584
1585 self->QueueDraw ();
1586
1587 self->_super_show_shortcuts_handle = 0;
1588 return false;
1520}1589}
15211590
1522void Launcher::OnPlaceViewShown (GVariant *data, void *val)1591void Launcher::OnPlaceViewShown (GVariant *data, void *val)
@@ -1647,14 +1716,6 @@
1647 return _mouse_position.y;1716 return _mouse_position.y;
1648}1717}
16491718
1650gboolean Launcher::DrawLauncherTimeout (gpointer data)
1651{
1652 Launcher *self = (Launcher*) data;
1653
1654 self->QueueDraw ();
1655 return false;
1656}
1657
1658bool1719bool
1659Launcher::CheckIntersectWindow (CompWindow *window)1720Launcher::CheckIntersectWindow (CompWindow *window)
1660{1721{
@@ -1975,6 +2036,7 @@
1975 }2036 }
1976 2037
1977 self->EnsureAnimation ();2038 self->EnsureAnimation ();
2039 self->_autoscroll_handle = 0;
1978 2040
1979 return TRUE;2041 return TRUE;
1980}2042}
@@ -2514,7 +2576,7 @@
2514 geo);2576 geo);
25152577
2516 /* draw superkey-shortcut label */ 2578 /* draw superkey-shortcut label */
2517 if (_hide_machine->GetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN) && !TapOnSuper ())2579 if (_shortcuts_shown)
2518 {2580 {
2519 guint64 shortcut = arg.icon->GetShortcut ();2581 guint64 shortcut = arg.icon->GetShortcut ();
25202582
@@ -2680,8 +2742,16 @@
2680 Launcher *self = (Launcher*) data;2742 Launcher *self = (Launcher*) data;
2681 2743
2682 // if we are still waiting…2744 // if we are still waiting…
2683 if (self->GetActionState () == ACTION_NONE)2745 if (self->GetActionState () == ACTION_NONE) {
2746 if (self->_icon_under_mouse)
2747 {
2748 self->_icon_under_mouse->MouseLeave.emit ();
2749 self->_icon_under_mouse->_mouse_inside = false;
2750 self->_icon_under_mouse = 0;
2751 }
2684 self->StartIconDragRequest (self->GetMouseX (), self->GetMouseY ());2752 self->StartIconDragRequest (self->GetMouseX (), self->GetMouseY ());
2753 }
2754 self->_start_dragicon_handle = 0;
2685 return false; 2755 return false;
2686}2756}
26872757
@@ -2696,6 +2766,7 @@
2696 StartIconDrag (drag_icon);2766 StartIconDrag (drag_icon);
2697 SetActionState (ACTION_DRAG_ICON);2767 SetActionState (ACTION_DRAG_ICON);
2698 UpdateDragWindowPosition (x, y);2768 UpdateDragWindowPosition (x, y);
2769 EnsureAnimation ();
2699 } 2770 }
2700}2771}
27012772
@@ -2917,26 +2988,53 @@
2917 EnsureAnimation ();2988 EnsureAnimation ();
2918}2989}
29192990
2991
2992gboolean
2993Launcher::ResetRepeatShorcutTimeout (gpointer data)
2994{
2995 Launcher *self = (Launcher*) data;
2996
2997 self->_latest_shortcut = 0;
2998
2999 self->_ignore_repeat_shortcut_handle = 0;
3000 return false;
3001}
3002
2920gboolean3003gboolean
2921Launcher::CheckSuperShortcutPressed (unsigned int key_sym,3004Launcher::CheckSuperShortcutPressed (unsigned int key_sym,
2922 unsigned long key_code,3005 unsigned long key_code,
2923 unsigned long key_state)3006 unsigned long key_state)
2924{3007{
2925 if (!_hide_machine->GetQuirk (LauncherHideMachine::TRIGGER_BUTTON_DOWN))3008 if (!_super_pressed)
2926 return false;3009 return false;
29273010
2928 LauncherModel::iterator it;3011 LauncherModel::iterator it;
2929 int i;
2930 3012
2931 // Shortcut to start launcher icons. Only relies on Keycode, ignore modifier3013 // Shortcut to start launcher icons. Only relies on Keycode, ignore modifier
2932 for (it = _model->begin (), i = 0; it != _model->end (); it++, i++)3014 for (it = _model->begin (); it != _model->end (); it++)
2933 {3015 {
2934 if (XKeysymToKeycode (screen->dpy (), (*it)->GetShortcut ()) == key_code)3016 if (XKeysymToKeycode (screen->dpy (), (*it)->GetShortcut ()) == key_code)
2935 {3017 {
3018 /*
3019 * start a timeout while repressing the same shortcut will be ignored.
3020 * This is because the keypress repeat is handled by Xorg and we have no
3021 * way to know if a press is an actual press or just an automated repetition
3022 * because the button is hold down. (key release events are sent in both cases)
3023 */
3024 if (_ignore_repeat_shortcut_handle > 0)
3025 g_source_remove (_ignore_repeat_shortcut_handle);
3026 _ignore_repeat_shortcut_handle = g_timeout_add (IGNORE_REPEAT_SHORTCUT_DURATION, &Launcher::ResetRepeatShorcutTimeout, this);
3027
3028 if (_latest_shortcut == (*it)->GetShortcut ())
3029 return true;
3030
2936 if (g_ascii_isdigit ((gchar) (*it)->GetShortcut ()) && (key_state & ShiftMask))3031 if (g_ascii_isdigit ((gchar) (*it)->GetShortcut ()) && (key_state & ShiftMask))
2937 (*it)->OpenInstance ();3032 (*it)->OpenInstance ();
2938 else3033 else
2939 (*it)->Activate ();3034 (*it)->Activate ();
3035
3036 _latest_shortcut = (*it)->GetShortcut ();
3037
2940 // disable the "tap on super" check3038 // disable the "tap on super" check
2941 _times[TIME_TAP_SUPER].tv_sec = 0;3039 _times[TIME_TAP_SUPER].tv_sec = 0;
2942 _times[TIME_TAP_SUPER].tv_nsec = 0;3040 _times[TIME_TAP_SUPER].tv_nsec = 0;
29433041
=== modified file 'src/Launcher.h'
--- src/Launcher.h 2011-04-03 06:20:39 +0000
+++ src/Launcher.h 2011-04-05 17:30:38 +0000
@@ -42,7 +42,11 @@
42#define ANIM_DURATION_LONG 35042#define ANIM_DURATION_LONG 350
4343
44#define SUPER_TAP_DURATION 25044#define SUPER_TAP_DURATION 250
45#define SHORTCUTS_SHOWN_DELAY 750
45#define START_DRAGICON_DURATION 50046#define START_DRAGICON_DURATION 500
47#define BEFORE_HIDE_LAUNCHER_ON_SUPER_DURATION 1000
48
49#define IGNORE_REPEAT_SHORTCUT_DURATION 250
4650
47#define MAX_SUPERKEY_LABELS 1051#define MAX_SUPERKEY_LABELS 10
4852
@@ -197,6 +201,7 @@
197 TIME_DRAG_EDGE_TOUCH,201 TIME_DRAG_EDGE_TOUCH,
198 TIME_DRAG_OUT,202 TIME_DRAG_OUT,
199 TIME_TAP_SUPER,203 TIME_TAP_SUPER,
204 TIME_SUPER_PRESSED,
200 205
201 TIME_LAST206 TIME_LAST
202 } LauncherActionTimes;207 } LauncherActionTimes;
@@ -237,10 +242,13 @@
237 void OnPluginStateChanged ();242 void OnPluginStateChanged ();
238 243
239 static gboolean AnimationTimeout (gpointer data);244 static gboolean AnimationTimeout (gpointer data);
240 static gboolean DrawLauncherTimeout (gpointer data);245 static gboolean SuperShowLauncherTimeout (gpointer data);
246 static gboolean SuperHideLauncherTimeout (gpointer data);
247 static gboolean SuperShowShortcutsTimeout (gpointer data);
241 static gboolean StrutHack (gpointer data);248 static gboolean StrutHack (gpointer data);
242 static gboolean MoveFocusToKeyNavModeTimeout (gpointer data);249 static gboolean MoveFocusToKeyNavModeTimeout (gpointer data);
243 static gboolean StartIconDragTimeout (gpointer data);250 static gboolean StartIconDragTimeout (gpointer data);
251 static gboolean ResetRepeatShorcutTimeout (gpointer data);
244252
245 void SetMousePosition (int x, int y);253 void SetMousePosition (int x, int y);
246 254
@@ -406,6 +414,10 @@
406 bool _render_drag_window;414 bool _render_drag_window;
407 bool _check_window_over_launcher;415 bool _check_window_over_launcher;
408 416
417 bool _shortcuts_shown;
418 bool _super_pressed;
419 guint64 _latest_shortcut;
420
409 BacklightMode _backlight_mode;421 BacklightMode _backlight_mode;
410422
411 float _folded_angle;423 float _folded_angle;
@@ -461,9 +473,12 @@
461473
462 guint _autoscroll_handle;474 guint _autoscroll_handle;
463 guint _focus_keynav_handle;475 guint _focus_keynav_handle;
464 guint _redraw_handle;476 guint _super_show_launcher_handle;
477 guint _super_hide_launcher_handle;
478 guint _super_show_shortcuts_handle;
465 guint _start_dragicon_handle;479 guint _start_dragicon_handle;
466 guint _dnd_check_handle;480 guint _dnd_check_handle;
481 guint _ignore_repeat_shortcut_handle;
467482
468 nux::Point2 _mouse_position;483 nux::Point2 _mouse_position;
469 nux::Point2 _bfb_mouse_position;484 nux::Point2 _bfb_mouse_position;
470485
=== modified file 'src/LauncherHideMachine.cpp'
--- src/LauncherHideMachine.cpp 2011-03-30 10:16:11 +0000
+++ src/LauncherHideMachine.cpp 2011-04-05 17:30:38 +0000
@@ -25,6 +25,9 @@
25 _quirks = DEFAULT;25 _quirks = DEFAULT;
26 _should_hide = false;26 _should_hide = false;
27 27
28 _latest_emit_should_hide = false;
29 _hide_changed_emit_handle = 0;
30
28 _hide_delay_handle = 0;31 _hide_delay_handle = 0;
29 _hide_delay_timeout_length = 750;32 _hide_delay_timeout_length = 750;
30}33}
@@ -36,6 +39,11 @@
36 g_source_remove (_hide_delay_handle);39 g_source_remove (_hide_delay_handle);
37 _hide_delay_handle = 0;40 _hide_delay_handle = 0;
38 }41 }
42 if (_hide_changed_emit_handle)
43 {
44 g_source_remove (_hide_changed_emit_handle);
45 _hide_changed_emit_handle = 0;
46 }
39}47}
4048
41void49void
@@ -54,7 +62,10 @@
54 else62 else
55 {63 {
56 _should_hide = value;64 _should_hide = value;
57 should_hide_changed.emit (value);65
66 if (_hide_changed_emit_handle)
67 g_source_remove (_hide_changed_emit_handle);
68 _hide_changed_emit_handle = g_timeout_add (0, &EmitShouldHideChanged, this);
58 }69 }
59}70}
6071
@@ -66,7 +77,7 @@
66 QUICKLIST_OPEN = 1 << 4, 16 #VISIBLE_REQUIRED77 QUICKLIST_OPEN = 1 << 4, 16 #VISIBLE_REQUIRED
67 EXTERNAL_DND_ACTIVE = 1 << 5, 32 #VISIBLE_REQUIRED78 EXTERNAL_DND_ACTIVE = 1 << 5, 32 #VISIBLE_REQUIRED
68 INTERNAL_DND_ACTIVE = 1 << 6, 64 #VISIBLE_REQUIRED79 INTERNAL_DND_ACTIVE = 1 << 6, 64 #VISIBLE_REQUIRED
69 TRIGGER_BUTTON_DOWN = 1 << 7, 128 #VISIBLE_REQUIRED80 TRIGGER_BUTTON_SHOW = 1 << 7, 128 #VISIBLE_REQUIRED
70 ANY_WINDOW_UNDER = 1 << 8, 25681 ANY_WINDOW_UNDER = 1 << 8, 256
71 ACTIVE_WINDOW_UNDER = 1 << 9, 51282 ACTIVE_WINDOW_UNDER = 1 << 9, 512
72 DND_PUSHED_OFF = 1 << 10, 102483 DND_PUSHED_OFF = 1 << 10, 1024
@@ -81,7 +92,7 @@
81*/92*/
8293
83#define VISIBLE_REQUIRED (QUICKLIST_OPEN | EXTERNAL_DND_ACTIVE | \94#define VISIBLE_REQUIRED (QUICKLIST_OPEN | EXTERNAL_DND_ACTIVE | \
84INTERNAL_DND_ACTIVE | TRIGGER_BUTTON_DOWN | VERTICAL_SLIDE_ACTIVE |\95INTERNAL_DND_ACTIVE | TRIGGER_BUTTON_SHOW | VERTICAL_SLIDE_ACTIVE |\
85KEY_NAV_ACTIVE | PLACES_VISIBLE | SCALE_ACTIVE | EXPO_ACTIVE |\96KEY_NAV_ACTIVE | PLACES_VISIBLE | SCALE_ACTIVE | EXPO_ACTIVE |\
86MT_DRAG_OUT)97MT_DRAG_OUT)
8798
@@ -160,7 +171,7 @@
160}171}
161172
162#define SKIP_DELAY_QUIRK (EXTERNAL_DND_ACTIVE | DND_PUSHED_OFF | ACTIVE_WINDOW_UNDER | \173#define SKIP_DELAY_QUIRK (EXTERNAL_DND_ACTIVE | DND_PUSHED_OFF | ACTIVE_WINDOW_UNDER | \
163ANY_WINDOW_UNDER | EXPO_ACTIVE | SCALE_ACTIVE | MT_DRAG_OUT)174ANY_WINDOW_UNDER | EXPO_ACTIVE | SCALE_ACTIVE | MT_DRAG_OUT | TRIGGER_BUTTON_SHOW)
164175
165void176void
166LauncherHideMachine::SetQuirk (LauncherHideMachine::HideQuirk quirk, bool active)177LauncherHideMachine::SetQuirk (LauncherHideMachine::HideQuirk quirk, bool active)
@@ -207,6 +218,21 @@
207 return false;218 return false;
208}219}
209220
221gboolean
222LauncherHideMachine::EmitShouldHideChanged (gpointer data)
223{
224 LauncherHideMachine *self = static_cast<LauncherHideMachine *> (data);
225
226 self->_hide_changed_emit_handle = 0;
227 if (self->_should_hide == self->_latest_emit_should_hide)
228 return false;
229
230 self->_latest_emit_should_hide = self->_should_hide;
231 self->should_hide_changed.emit (self->_should_hide);
232
233 return false;
234}
235
210char*236char*
211LauncherHideMachine::DebugHideQuirks ()237LauncherHideMachine::DebugHideQuirks ()
212{238{
213239
=== modified file 'src/LauncherHideMachine.h'
--- src/LauncherHideMachine.h 2011-03-30 10:16:11 +0000
+++ src/LauncherHideMachine.h 2011-04-05 17:30:38 +0000
@@ -44,7 +44,7 @@
44 QUICKLIST_OPEN = 1 << 4, 44 QUICKLIST_OPEN = 1 << 4,
45 EXTERNAL_DND_ACTIVE = 1 << 5, 45 EXTERNAL_DND_ACTIVE = 1 << 5,
46 INTERNAL_DND_ACTIVE = 1 << 6, 46 INTERNAL_DND_ACTIVE = 1 << 6,
47 TRIGGER_BUTTON_DOWN = 1 << 7, 47 TRIGGER_BUTTON_SHOW = 1 << 7,
48 ANY_WINDOW_UNDER = 1 << 8, 48 ANY_WINDOW_UNDER = 1 << 8,
49 ACTIVE_WINDOW_UNDER = 1 << 9,49 ACTIVE_WINDOW_UNDER = 1 << 9,
50 DND_PUSHED_OFF = 1 << 10,50 DND_PUSHED_OFF = 1 << 10,
@@ -78,13 +78,16 @@
78 void SetShouldHide (bool value, bool skip_delay);78 void SetShouldHide (bool value, bool skip_delay);
7979
80 static gboolean OnHideDelayTimeout (gpointer data);80 static gboolean OnHideDelayTimeout (gpointer data);
81 static gboolean EmitShouldHideChanged (gpointer data);
81 82
82 bool _should_hide;83 bool _should_hide;
84 bool _latest_emit_should_hide;
83 HideQuirk _quirks;85 HideQuirk _quirks;
84 HideMode _mode;86 HideMode _mode;
85 unsigned int _hide_delay_timeout_length;87 unsigned int _hide_delay_timeout_length;
86 88
87 guint _hide_delay_handle;89 guint _hide_delay_handle;
90 guint _hide_changed_emit_handle;
88};91};
8992
90#endif93#endif
9194
=== modified file 'src/LauncherHoverMachine.cpp'
--- src/LauncherHoverMachine.cpp 2011-03-30 10:16:11 +0000
+++ src/LauncherHoverMachine.cpp 2011-04-05 17:30:38 +0000
@@ -23,7 +23,7 @@
23{23{
24 _quirks = DEFAULT;24 _quirks = DEFAULT;
25 _should_hover = false;25 _should_hover = false;
26 _pending_should_hover = false; // avoid building a struct in the callback26 _latest_emit_should_hover = false;
27 _hover_changed_emit_handle = 0;27 _hover_changed_emit_handle = 0;
28 28
29}29}
@@ -42,7 +42,7 @@
42 LAUNCHER_HIDDEN = 1 << 0, 142 LAUNCHER_HIDDEN = 1 << 0, 1
43 MOUSE_OVER_LAUNCHER = 1 << 1, 243 MOUSE_OVER_LAUNCHER = 1 << 1, 2
44 MOUSE_OVER_BFB = 1 << 2, 444 MOUSE_OVER_BFB = 1 << 2, 4
45 SHOTCUT_KEYS_VISIBLE = 1 << 3, 845 SHORTCUT_KEYS_VISIBLE = 1 << 3, 8
46 QUICKLIST_OPEN = 1 << 4, 1646 QUICKLIST_OPEN = 1 << 4, 16
47 KEY_NAV_ACTIVE = 1 << 5, 3247 KEY_NAV_ACTIVE = 1 << 5, 32
48 LAUNCHER_IN_ACTION = 1 << 6, 6448 LAUNCHER_IN_ACTION = 1 << 6, 64
@@ -60,7 +60,7 @@
60 }60 }
61 61
62 if (GetQuirk ((HoverQuirk) (MOUSE_OVER_LAUNCHER | MOUSE_OVER_BFB |62 if (GetQuirk ((HoverQuirk) (MOUSE_OVER_LAUNCHER | MOUSE_OVER_BFB |
63 SHOTCUT_KEYS_VISIBLE | KEY_NAV_ACTIVE |63 SHORTCUT_KEYS_VISIBLE | KEY_NAV_ACTIVE |
64 QUICKLIST_OPEN | LAUNCHER_IN_ACTION)))64 QUICKLIST_OPEN | LAUNCHER_IN_ACTION)))
65 should_hover = true;65 should_hover = true;
66 else66 else
@@ -72,11 +72,11 @@
7272
73void73void
74LauncherHoverMachine::SetShouldHover (bool value)74LauncherHoverMachine::SetShouldHover (bool value)
75{75{
76 _should_hover = value;
77
76 if (_hover_changed_emit_handle)78 if (_hover_changed_emit_handle)
77 g_source_remove (_hover_changed_emit_handle);79 g_source_remove (_hover_changed_emit_handle);
78
79 _pending_should_hover = value;
80 _hover_changed_emit_handle = g_timeout_add (0, &EmitShouldHoverChanged, this); 80 _hover_changed_emit_handle = g_timeout_add (0, &EmitShouldHoverChanged, this);
81}81}
8282
@@ -84,14 +84,14 @@
84LauncherHoverMachine::EmitShouldHoverChanged (gpointer data)84LauncherHoverMachine::EmitShouldHoverChanged (gpointer data)
85{85{
86 LauncherHoverMachine *self = static_cast<LauncherHoverMachine *> (data);86 LauncherHoverMachine *self = static_cast<LauncherHoverMachine *> (data);
87 87
88 if (self->_should_hover == self->_pending_should_hover)88 self->_hover_changed_emit_handle = 0;
89 if (self->_should_hover == self->_latest_emit_should_hover)
89 return false;90 return false;
90
91 self->_should_hover = self->_pending_should_hover;
92 self->_hover_changed_emit_handle = 0;
93 91
92 self->_latest_emit_should_hover = self->_should_hover;
94 self->should_hover_changed.emit (self->_should_hover);93 self->should_hover_changed.emit (self->_should_hover);
94
95 return false;95 return false;
96}96}
9797
9898
=== modified file 'src/LauncherHoverMachine.h'
--- src/LauncherHoverMachine.h 2011-03-30 10:16:11 +0000
+++ src/LauncherHoverMachine.h 2011-04-05 17:30:38 +0000
@@ -33,7 +33,7 @@
33 LAUNCHER_HIDDEN = 1 << 0, 33 LAUNCHER_HIDDEN = 1 << 0,
34 MOUSE_OVER_LAUNCHER = 1 << 1, 34 MOUSE_OVER_LAUNCHER = 1 << 1,
35 MOUSE_OVER_BFB = 1 << 2, 35 MOUSE_OVER_BFB = 1 << 2,
36 SHOTCUT_KEYS_VISIBLE = 1 << 3, 36 SHORTCUT_KEYS_VISIBLE = 1 << 3,
37 QUICKLIST_OPEN = 1 << 4, 37 QUICKLIST_OPEN = 1 << 4,
38 KEY_NAV_ACTIVE = 1 << 5, 38 KEY_NAV_ACTIVE = 1 << 5,
39 LAUNCHER_IN_ACTION = 1 << 6, 39 LAUNCHER_IN_ACTION = 1 << 6,
@@ -56,7 +56,7 @@
56 static gboolean EmitShouldHoverChanged (gpointer data);56 static gboolean EmitShouldHoverChanged (gpointer data);
57 57
58 bool _should_hover;58 bool _should_hover;
59 bool _pending_should_hover;59 bool _latest_emit_should_hover;
60 HoverQuirk _quirks;60 HoverQuirk _quirks;
61 61
62 guint _hover_changed_emit_handle;62 guint _hover_changed_emit_handle;
6363
=== modified file 'src/PanelTray.cpp'
--- src/PanelTray.cpp 2011-03-29 12:23:52 +0000
+++ src/PanelTray.cpp 2011-04-05 17:30:38 +0000
@@ -24,9 +24,7 @@
24PanelTray::PanelTray ()24PanelTray::PanelTray ()
25: _n_children (0),25: _n_children (0),
26 _last_x (0),26 _last_x (0),
27 _last_y (0),27 _last_y (0)
28 _idle_add_sync_handler (0),
29 _idle_remove_sync_handler (0)
30{28{
31 _settings = g_settings_new (SETTINGS_NAME);29 _settings = g_settings_new (SETTINGS_NAME);
32 _whitelist = g_settings_get_strv (_settings, "systray-whitelist");30 _whitelist = g_settings_get_strv (_settings, "systray-whitelist");
@@ -66,10 +64,7 @@
66{64{
67 if (_tray_expose_id)65 if (_tray_expose_id)
68 g_signal_handler_disconnect (_window, _tray_expose_id);66 g_signal_handler_disconnect (_window, _tray_expose_id);
69 if (_idle_remove_sync_handler)67 g_idle_remove_by_data (this);
70 g_source_remove (_idle_remove_sync_handler);
71 if (_idle_add_sync_handler)
72 g_source_remove (_idle_add_sync_handler);
73 68
74 g_strfreev (_whitelist);69 g_strfreev (_whitelist);
75 g_object_unref (_settings);70 g_object_unref (_settings);
@@ -145,7 +140,7 @@
145 na_tray_child_set_composited (icon, TRUE);140 na_tray_child_set_composited (icon, TRUE);
146141
147 self->_n_children++;142 self->_n_children++;
148 self->_idle_add_sync_handler = g_idle_add ((GSourceFunc)IdleSync, self);143 g_idle_add ((GSourceFunc)IdleSync, self);
149 }144 }
150145
151 g_debug ("TrayChild %s: %s %s %s",146 g_debug ("TrayChild %s: %s %s %s",
@@ -164,7 +159,7 @@
164void159void
165PanelTray::OnTrayIconRemoved (NaTrayManager *manager, NaTrayChild *child, PanelTray *self)160PanelTray::OnTrayIconRemoved (NaTrayManager *manager, NaTrayChild *child, PanelTray *self)
166{161{
167 self->_idle_remove_sync_handler = g_idle_add ((GSourceFunc)IdleSync, self);162 g_idle_add ((GSourceFunc)IdleSync, self);
168 self->_n_children--;163 self->_n_children--;
169}164}
170165
171166
=== modified file 'src/PanelTray.h'
--- src/PanelTray.h 2011-03-29 12:23:52 +0000
+++ src/PanelTray.h 2011-04-05 17:30:38 +0000
@@ -71,7 +71,5 @@
71 int _last_y;71 int _last_y;
72 72
73 gulong _tray_expose_id;73 gulong _tray_expose_id;
74 guint _idle_add_sync_handler;
75 guint _idle_remove_sync_handler;
76};74};
77#endif75#endif
7876
=== modified file 'src/PlacesController.cpp'
--- src/PlacesController.cpp 2011-03-24 00:35:26 +0000
+++ src/PlacesController.cpp 2011-04-05 17:30:38 +0000
@@ -123,6 +123,9 @@
123{123{
124 if (_visible)124 if (_visible)
125 return;125 return;
126
127 if (PluginAdapter::Default ()->IsExpoActive () || PluginAdapter::Default ()->IsScaleActive ())
128 return;
126 129
127 if (PluginAdapter::Default ()->IsScreenGrabbed ())130 if (PluginAdapter::Default ()->IsScreenGrabbed ())
128 {131 {
129132
=== modified file 'src/PlacesResultsController.cpp'
--- src/PlacesResultsController.cpp 2011-03-13 21:50:20 +0000
+++ src/PlacesResultsController.cpp 2011-04-05 17:30:38 +0000
@@ -36,6 +36,8 @@
3636
37PlacesResultsController::~PlacesResultsController ()37PlacesResultsController::~PlacesResultsController ()
38{38{
39 if (_make_things_look_nice_id)
40 g_source_remove (_make_things_look_nice_id);
39 _results_view->UnReference ();41 _results_view->UnReference ();
40}42}
4143