From e8071ea7c92f6a1996da77fe4d7d8ab8360ebf54 Mon Sep 17 00:00:00 2001 From: Richard Hult Date: Mon, 21 May 2007 19:40:43 +0000 Subject: [PATCH] Set the resolution. 2007-05-21 Richard Hult * gdk/quartz/gdkdisplay-quartz.c: (gdk_display_open): Set the resolution. * gdk/quartz/gdkscreen-quartz.c: Use the autorelease pool macros. svn path=/trunk/; revision=17887 --- ChangeLog | 7 +++++++ gdk/quartz/gdkdisplay-quartz.c | 8 ++++++-- gdk/quartz/gdkscreen-quartz.c | 26 +++++++++++--------------- 3 files changed, 24 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7c373f80a4..3924b49723 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-05-21 Richard Hult + + * gdk/quartz/gdkdisplay-quartz.c: (gdk_display_open): Set the + resolution. + + * gdk/quartz/gdkscreen-quartz.c: Use the autorelease pool macros. + 2007-05-21 Michael Natterer * gtk/gtkcombobox.c (gtk_combo_box_set_model): revert last change. diff --git a/gdk/quartz/gdkdisplay-quartz.c b/gdk/quartz/gdkdisplay-quartz.c index 47f261dd1f..b34567eaf7 100644 --- a/gdk/quartz/gdkdisplay-quartz.c +++ b/gdk/quartz/gdkdisplay-quartz.c @@ -45,11 +45,15 @@ gdk_display_open (const gchar *display_name) if (_gdk_display != NULL) return NULL; + /* Initialize application */ + [NSApplication sharedApplication]; + _gdk_display = g_object_new (GDK_TYPE_DISPLAY, NULL); _gdk_screen = g_object_new (GDK_TYPE_SCREEN, NULL); - /* Initialize application */ - [NSApplication sharedApplication]; + NSScreen *nsscreen; + nsscreen = [[NSScreen screens] objectAtIndex:0]; + gdk_screen_set_resolution (_gdk_screen, 72.0 * [nsscreen userSpaceScaleFactor]); _gdk_visual_init (); gdk_screen_set_default_colormap (_gdk_screen, diff --git a/gdk/quartz/gdkscreen-quartz.c b/gdk/quartz/gdkscreen-quartz.c index 98165c348c..e966d0ad5c 100644 --- a/gdk/quartz/gdkscreen-quartz.c +++ b/gdk/quartz/gdkscreen-quartz.c @@ -88,11 +88,10 @@ gdk_screen_get_width (GdkScreen *screen) int i; int width; NSArray *array; - NSAutoreleasePool *pool; g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); - pool = [[NSAutoreleasePool alloc] init]; + GDK_QUARTZ_ALLOC_POOL; array = [NSScreen screens]; width = 0; @@ -102,7 +101,7 @@ gdk_screen_get_width (GdkScreen *screen) width += rect.size.width; } - [pool release]; + GDK_QUARTZ_RELEASE_POOL; return width; } @@ -113,11 +112,10 @@ gdk_screen_get_height (GdkScreen *screen) int i; int height; NSArray *array; - NSAutoreleasePool *pool; g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); - pool = [[NSAutoreleasePool alloc] init]; + GDK_QUARTZ_ALLOC_POOL; array = [NSScreen screens]; height = 0; @@ -127,7 +125,7 @@ gdk_screen_get_height (GdkScreen *screen) height = MAX (height, rect.size.height); } - [pool release]; + GDK_QUARTZ_RELEASE_POOL; return height; } @@ -154,11 +152,10 @@ gdk_screen_get_width_mm (GdkScreen *screen) int i; gint width; NSArray *array; - NSAutoreleasePool *pool; g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); - pool = [[NSAutoreleasePool alloc] init]; + GDK_QUARTZ_ALLOC_POOL; array = [NSScreen screens]; width = 0; @@ -169,7 +166,7 @@ gdk_screen_get_width_mm (GdkScreen *screen) width += get_mm_from_pixels (screen, rect.size.width); } - [pool release]; + GDK_QUARTZ_RELEASE_POOL; return width; } @@ -180,11 +177,10 @@ gdk_screen_get_height_mm (GdkScreen *screen) int i; gint height; NSArray *array; - NSAutoreleasePool *pool; g_return_val_if_fail (GDK_IS_SCREEN (screen), 0); - pool = [[NSAutoreleasePool alloc] init]; + GDK_QUARTZ_ALLOC_POOL; array = [NSScreen screens]; height = 0; @@ -196,7 +192,7 @@ gdk_screen_get_height_mm (GdkScreen *screen) height = MAX (height, h); } - [pool release]; + GDK_QUARTZ_RELEASE_POOL; return height; } @@ -205,6 +201,7 @@ int gdk_screen_get_n_monitors (GdkScreen *screen) { int n; + GDK_QUARTZ_ALLOC_POOL; NSArray *array = [NSScreen screens]; @@ -222,13 +219,12 @@ gdk_screen_get_monitor_geometry (GdkScreen *screen, { NSArray *array; NSRect rect; - NSAutoreleasePool *pool; 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); - pool = [[NSAutoreleasePool alloc] init]; + GDK_QUARTZ_ALLOC_POOL; array = [NSScreen screens]; rect = [[array objectAtIndex:monitor_num] frame]; @@ -237,7 +233,7 @@ gdk_screen_get_monitor_geometry (GdkScreen *screen, dest->width = rect.size.width; dest->height = rect.size.height; - [pool release]; + GDK_QUARTZ_RELEASE_POOL; } gchar *