~unity-team/unity/trunk

« back to all changes in this revision

Viewing changes to hud/HudController.cpp

  • Committer: Daniel van Vugt
  • Date: 2012-09-13 10:56:42 UTC
  • mfrom: (2684 unity)
  • mto: This revision was merged to the branch mainline in revision 2698.
  • Revision ID: daniel.van.vugt@canonical.com-20120913105642-9on2ald55h54j1zn
Merge latest lp:unity and fix conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
122
122
  AddChild(view_);
123
123
}
124
124
 
125
 
int Controller::GetTargetMonitor()
 
125
int Controller::GetIdealMonitor()
126
126
{
127
 
  return UScreen::GetDefault()->GetMonitorWithMouse();
 
127
  int ideal_monitor;
 
128
  if (window_->IsVisible())
 
129
    ideal_monitor = monitor_index_;
 
130
  else
 
131
    ideal_monitor = UScreen::GetDefault()->GetMonitorWithMouse();
 
132
  return ideal_monitor;
128
133
}
129
134
 
130
135
bool Controller::IsLockedToLauncher(int monitor)
181
186
 
182
187
nux::Geometry Controller::GetIdealWindowGeometry()
183
188
{
184
 
  int target_monitor = GetTargetMonitor();
185
 
  auto monitor_geo = UScreen::GetDefault()->GetMonitorGeometry(target_monitor);
 
189
  int ideal_monitor = GetIdealMonitor();
 
190
  auto monitor_geo = UScreen::GetDefault()->GetMonitorGeometry(ideal_monitor);
186
191
 
187
192
  // We want to cover as much of the screen as possible to grab any mouse events
188
193
  // outside of our window
192
197
                    monitor_geo.width,
193
198
                    monitor_geo.height - panel_style.panel_height);
194
199
 
195
 
  if (IsLockedToLauncher(target_monitor))
 
200
  if (IsLockedToLauncher(ideal_monitor))
196
201
  {
197
202
    geo.x += launcher_width;
198
203
    geo.width -= launcher_width;
273
278
    return;
274
279
  }
275
280
 
276
 
  unsigned int target_monitor = GetTargetMonitor();
 
281
  unsigned int ideal_monitor = GetIdealMonitor();
277
282
 
278
 
  if (target_monitor != monitor_index_)
 
283
  if (ideal_monitor != monitor_index_)
279
284
  {
280
285
    Relayout();
281
 
    monitor_index_ = target_monitor;
 
286
    monitor_index_ = ideal_monitor;
282
287
  }
283
288
 
284
289
  view_->ShowEmbeddedIcon(!IsLockedToLauncher(monitor_index_));
487
492
{
488
493
  variant::BuilderWrapper(builder)
489
494
    .add(window_ ? window_->GetGeometry() : nux::Geometry())
 
495
    .add("ideal_monitor", GetIdealMonitor())
490
496
    .add("visible", visible_)
491
497
    .add("hud_monitor", monitor_index_)
492
498
    .add("locked_to_launcher", IsLockedToLauncher(monitor_index_));