Commit 4b705d23 authored by Anders Carlsson's avatar Anders Carlsson Committed by Anders Carlsson

Implement these functions. (#327228, Thomas Broyer).

2006-01-18  Anders Carlsson  <andersca@imendio.com>

        * gdk/quartz/gdkevents-quartz.c:
        (get_mm_from_pixels):
        (gdk_screen_get_width_mm):
        (gdk_screen_get_height_mm):
        Implement these functions.
        (#327228, Thomas Broyer).
parent 580d76a4
2006-01-18 Anders Carlsson <andersca@imendio.com>
* gdk/quartz/gdkevents-quartz.c:
(get_mm_from_pixels):
(gdk_screen_get_width_mm):
(gdk_screen_get_height_mm):
Implement these functions.
(#327228, Thomas Broyer).
2006-01-18 Anders Carlsson <andersca@imendio.com>
* gdk/quartz/gdkdrawable-quartz.c:
......
2006-01-18 Anders Carlsson <andersca@imendio.com>
* gdk/quartz/gdkevents-quartz.c:
(get_mm_from_pixels):
(gdk_screen_get_width_mm):
(gdk_screen_get_height_mm):
Implement these functions.
(#327228, Thomas Broyer).
2006-01-18 Anders Carlsson <andersca@imendio.com>
* gdk/quartz/gdkdrawable-quartz.c:
......
......@@ -132,22 +132,67 @@ gdk_screen_get_height (GdkScreen *screen)
return height;
}
static gint
get_mm_from_pixels (NSScreen *screen, int pixels)
{
/* userSpaceScaleFactor is in "pixels per point",
* 72 is the number of points per inch,
* and 25.4 is the number of millimeters per inch.
*/
return ((pixels / [screen userSpaceScaleFactor]) / 72) * 25.4;
}
gint
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);
/* FIXME: Implement */
return 0;
pool = [[NSAutoreleasePool alloc] init];
array = [NSScreen screens];
width = 0;
for (i = 0; i < [array count]; i++)
{
NSScreen *screen = [array objectAtIndex:i];
NSRect rect = [screen frame];
width += get_mm_from_pixels (screen, rect.size.width);
}
[pool release];
return width;
}
gint
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);
/* FIXME: Implement */
return 0;
pool = [[NSAutoreleasePool alloc] init];
array = [NSScreen screens];
height = 0;
for (i = 0; i < [array count]; i++)
{
NSScreen *screen = [array objectAtIndex:i];
NSRect rect = [screen frame];
gint h = get_mm_from_pixels (screen, rect.size.height);
height = MAX (height, h);
}
[pool release];
return height;
}
int
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment