~azzar1/unity/lp-1226116

« back to all changes in this revision

Viewing changes to plugins/unityshell/src/UScreen.cpp

  • Committer: Daniel van Vugt
  • Date: 2012-03-14 06:24:18 UTC
  • mfrom: (2108 unity)
  • mto: This revision was merged to the branch mainline in revision 2146.
  • Revision ID: daniel.van.vugt@canonical.com-20120314062418-nprucpbr0m7qky5e
MergedĀ latestĀ lp:unity

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
}
55
55
 
56
56
int
 
57
UScreen::GetMonitorWithMouse()
 
58
{
 
59
  GdkScreen* screen;
 
60
  GdkDevice* device;
 
61
  GdkDisplay *display;
 
62
  int x;
 
63
  int y;
 
64
 
 
65
  screen = gdk_screen_get_default();
 
66
  display = gdk_display_get_default();
 
67
  device = gdk_device_manager_get_client_pointer(gdk_display_get_device_manager(display));
 
68
 
 
69
  gdk_device_get_position(device, NULL, &x, &y);
 
70
 
 
71
  return gdk_screen_get_monitor_at_point(screen, x, y);
 
72
}
 
73
 
 
74
int
57
75
UScreen::GetPrimaryMonitor()
58
76
{
59
77
  return primary_;
101
119
 
102
120
  g_print("\nScreen geometry changed:\n");
103
121
 
104
 
  int lowest_x = std::numeric_limits<int>::max();
105
 
  int highest_y = std::numeric_limits<int>::min();
 
122
  primary_ = gdk_screen_get_primary_monitor(screen);
106
123
  for (int i = 0; i < gdk_screen_get_n_monitors(screen); i++)
107
124
  {
108
125
    GdkRectangle rect = { 0 };
118
135
 
119
136
    _monitors.push_back(geo);
120
137
 
121
 
    if (geo.x < lowest_x || (geo.x == lowest_x && geo.y > highest_y))
122
 
    {
123
 
      lowest_x = geo.x;
124
 
      highest_y = geo.y;
125
 
      primary_ = i;
126
 
    }
127
 
 
128
138
    g_print("   %dx%dx%dx%d\n", geo.x, geo.y, geo.width, geo.height);
129
139
  }
130
140