~bilalakhtar/unity/unhide-launcher-sc-fix-1002440

« back to all changes in this revision

Viewing changes to panel/PanelView.cpp

  • Committer: Bilal Akhtar
  • Date: 2012-06-13 23:40:32 UTC
  • mfrom: (2396.1.11 unity)
  • Revision ID: bilalakhtar@ubuntu.com-20120613234032-ssk1014fm27tadny
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
102
102
  // request the latest colour from bghash
103
103
  _ubus_manager.SendMessage(UBUS_BACKGROUND_REQUEST_COLOUR_EMIT);
104
104
 
105
 
  _track_menu_pointer_id = 0;
106
105
  _bg_effect_helper.owner = this;
107
106
 
108
107
  //FIXME (gord)- replace with async loading
121
120
 
122
121
PanelView::~PanelView()
123
122
{
124
 
  if (_track_menu_pointer_id)
125
 
    g_source_remove(_track_menu_pointer_id);
126
 
 
127
123
  for (auto conn : _on_indicator_updated_connections)
128
124
    conn.disconnect();
129
125
 
538
534
  if (!ret) _indicators->ActivateEntry(entry_id, 0);
539
535
}
540
536
 
541
 
void PanelView::TrackMenuPointer()
 
537
bool PanelView::TrackMenuPointer()
542
538
{
543
539
  auto mouse = nux::GetGraphicsDisplay()->GetMouseScreenCoord();
544
540
  if (_tracked_pointer_pos != mouse)
546
542
    OnMenuPointerMoved(mouse.x, mouse.y);
547
543
    _tracked_pointer_pos = mouse;
548
544
  }
 
545
 
 
546
  return true;
549
547
}
550
548
 
551
549
void PanelView::OnEntryActivated(std::string const& entry_id, nux::Rect const& geo)
552
550
{
553
551
  bool active = (entry_id.size() > 0);
554
 
  if (active && !_track_menu_pointer_id)
 
552
  if (active && !_track_menu_pointer_timeout)
555
553
  {
556
554
    //
557
555
    // Track menus being scrubbed at 60Hz (about every 16 millisec)
563
561
    // process. All the motion events will go to unity-panel-service while
564
562
    // scrubbing because the active panel menu has (needs) the pointer grab.
565
563
    //
566
 
    _track_menu_pointer_id = g_timeout_add(16, [] (gpointer data) -> gboolean {
567
 
                                            auto self = static_cast<PanelView*>(data);
568
 
                                            self->TrackMenuPointer();
569
 
                                            return TRUE;
570
 
                                          }, this);
 
564
    _track_menu_pointer_timeout.reset(new glib::Timeout(16));
 
565
    _track_menu_pointer_timeout->Run(sigc::mem_fun(this, &PanelView::TrackMenuPointer));
571
566
  }
572
567
  else if (!active)
573
568
  {
574
 
    if (_track_menu_pointer_id)
575
 
    {
576
 
      g_source_remove(_track_menu_pointer_id);
577
 
      _track_menu_pointer_id = 0;
578
 
    }
 
569
    _track_menu_pointer_timeout.reset();
579
570
    _menu_view->NotifyAllMenusClosed();
580
571
    _tracked_pointer_pos = {-1, -1};
581
572
  }