g_object_unref (old_colormap);
}
+/* FIXME: note on the get_width() and the get_height() methods. For
+ * now we only support screen layouts where the screens are laid out
+ * horizontally. Mac OS X also supports laying out the screens vertically
+ * and the screens having "non-standard" offsets from eachother. In the
+ * future we need a much more sophiscated algorithm to translate these
+ * layouts to GDK coordinate space and GDK screen layout.
+ */
gint
gdk_screen_get_width (GdkScreen *screen)
{
NSArray *array;
NSScreen *nsscreen;
NSRect rect;
+ NSRect largest_rect;
+ int i;
GDK_QUARTZ_ALLOC_POOL;
rect = [nsscreen frame];
dest->x = rect.origin.x;
- dest->y = rect.origin.y;
dest->width = rect.size.width;
dest->height = rect.size.height;
+ /* FIXME: as stated above the get_width() and get_height() functions
+ * in this file, we only support horizontal screen layouts for now.
+ */
+
+ /* Find the monitor with the largest height. All monitors should be
+ * offset to this one in the GDK screen space instead of offset to
+ * the screen with the menu bar.
+ */
+ largest_rect = [[array objectAtIndex:0] frame];
+ for (i = 1; i < [array count]; i++)
+ {
+ NSRect rect = [[array objectAtIndex:i] frame];
+
+ if (rect.size.height > largest_rect.size.height)
+ largest_rect = [[array objectAtIndex:i] frame];
+ }
+
+ if (largest_rect.size.height - rect.size.height == 0)
+ dest->y = 0;
+ else
+ dest->y = largest_rect.size.height - rect.size.height + largest_rect.origin.y;
+
if (in_mm)
{
dest->x = get_mm_from_pixels (nsscreen, dest->x);
gint
_gdk_quartz_window_get_inverted_screen_y (gint y)
{
- NSRect rect = [[NSScreen mainScreen] frame];
+ int index;
+ GdkRectangle gdk_rect;
+ NSScreen *main_screen = [NSScreen mainScreen];
+ NSRect rect = [main_screen frame];
- return rect.size.height - y;
+ index = [[NSScreen screens] indexOfObject:main_screen];
+
+ gdk_screen_get_monitor_geometry (_gdk_screen, index, &gdk_rect);
+
+ return gdk_rect.height - y + rect.origin.y + gdk_rect.y;
}
static GdkWindow *