diff options
author | Richard Hult <richard@imendio.com> | 2008-08-07 08:14:12 +0000 |
---|---|---|
committer | Richard Hult <rhult@src.gnome.org> | 2008-08-07 08:14:12 +0000 |
commit | e7d1152a8e82011c6be675ada25cb3581684c742 (patch) | |
tree | ea137041bfee60ce60106f1ef781070b29a48633 /gdk | |
parent | 66459b25028f9e879f8bda15f9a9a51f41f27b75 (diff) | |
download | gdk-pixbuf-e7d1152a8e82011c6be675ada25cb3581684c742.tar.gz |
Implement those, fixes loading python bindings.
2008-08-07 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkscreen-quartz.c: (gdk_screen_get_monitor_plug_name)
(gdk_screen_get_monitor_height_mm, gdk_screen_get_monitor_width_mm):
Implement those, fixes loading python bindings.
svn path=/trunk/; revision=21029
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/quartz/gdkscreen-quartz.c | 68 |
1 files changed, 59 insertions, 9 deletions
diff --git a/gdk/quartz/gdkscreen-quartz.c b/gdk/quartz/gdkscreen-quartz.c index b2205bd58..050267cc9 100644 --- a/gdk/quartz/gdkscreen-quartz.c +++ b/gdk/quartz/gdkscreen-quartz.c @@ -212,30 +212,80 @@ gdk_screen_get_n_monitors (GdkScreen *screen) return n; } -void -gdk_screen_get_monitor_geometry (GdkScreen *screen, - gint monitor_num, - GdkRectangle *dest) +static void +screen_get_monitor_geometry (GdkScreen *screen, + gint monitor_num, + GdkRectangle *dest, + gboolean in_mm) { NSArray *array; + NSScreen *nsscreen; NSRect rect; - g_return_if_fail (GDK_IS_SCREEN (screen)); - g_return_if_fail (monitor_num < gdk_screen_get_n_monitors (screen)); - g_return_if_fail (monitor_num >= 0); - GDK_QUARTZ_ALLOC_POOL; + array = [NSScreen screens]; - rect = [[array objectAtIndex:monitor_num] frame]; + nsscreen = [array objectAtIndex:monitor_num]; + rect = [nsscreen frame]; dest->x = rect.origin.x; dest->y = rect.origin.y; dest->width = rect.size.width; dest->height = rect.size.height; + if (in_mm) + { + dest->x = get_mm_from_pixels (nsscreen, dest->x); + dest->y = get_mm_from_pixels (nsscreen, dest->y); + dest->width = get_mm_from_pixels (nsscreen, dest->width); + dest->height = get_mm_from_pixels (nsscreen, dest->height); + } + GDK_QUARTZ_RELEASE_POOL; } +gint +gdk_screen_get_monitor_width_mm (GdkScreen *screen, + gint monitor_num) +{ + GdkRectangle rect; + + screen_get_monitor_geometry (screen, monitor_num, &rect, TRUE); + + return rect.width; +} + +gint +gdk_screen_get_monitor_height_mm (GdkScreen *screen, + gint monitor_num) +{ + GdkRectangle rect; + + screen_get_monitor_geometry (screen, monitor_num, &rect, TRUE); + + return rect.height; +} + +gchar * +gdk_screen_get_monitor_plug_name (GdkScreen *screen, + gint monitor_num) +{ + /* FIXME: Is there some useful name we could use here? */ + return NULL; +} + +void +gdk_screen_get_monitor_geometry (GdkScreen *screen, + gint monitor_num, + GdkRectangle *dest) +{ + g_return_if_fail (GDK_IS_SCREEN (screen)); + g_return_if_fail (monitor_num < gdk_screen_get_n_monitors (screen)); + g_return_if_fail (monitor_num >= 0); + + screen_get_monitor_geometry (screen, monitor_num, dest, FALSE); +} + gchar * gdk_screen_make_display_name (GdkScreen *screen) { |