Mercurial > dwindows
comparison mac/dw.m @ 1513:def1ca619ba2
Use the screen of the window when possible on Mac instead of the main screen.
This should help with multi-monitor configurations.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Thu, 29 Dec 2011 01:53:59 +0000 |
parents | dc41efe8a53f |
children | 6506f29dfefc |
comparison
equal
deleted
inserted
replaced
1512:50d972da558e | 1513:def1ca619ba2 |
---|---|
8525 /* Convert the coordinates based on gravity */ | 8525 /* Convert the coordinates based on gravity */ |
8526 void _handle_gravity(HWND handle, long *x, long *y, unsigned long width, unsigned long height) | 8526 void _handle_gravity(HWND handle, long *x, long *y, unsigned long width, unsigned long height) |
8527 { | 8527 { |
8528 int horz = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_grav_horz")); | 8528 int horz = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_grav_horz")); |
8529 int vert = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_grav_vert")); | 8529 int vert = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_grav_vert")); |
8530 id object = handle; | |
8530 | 8531 |
8531 /* Do any gravity calculations */ | 8532 /* Do any gravity calculations */ |
8532 if(horz || (vert & 0xf) != DW_GRAV_BOTTOM) | 8533 if(horz || (vert & 0xf) != DW_GRAV_BOTTOM) |
8533 { | 8534 { |
8534 long newx = *x, newy = *y; | 8535 long newx = *x, newy = *y; |
8550 *y = newy; | 8551 *y = newy; |
8551 } | 8552 } |
8552 /* Adjust the values to avoid Dock/Menubar if requested */ | 8553 /* Adjust the values to avoid Dock/Menubar if requested */ |
8553 if((horz | vert) & DW_GRAV_OBSTACLES) | 8554 if((horz | vert) & DW_GRAV_OBSTACLES) |
8554 { | 8555 { |
8555 NSRect visiblerect = [[NSScreen mainScreen] visibleFrame]; | 8556 NSRect visiblerect = [[object screen] visibleFrame]; |
8556 NSRect totalrect = [[NSScreen mainScreen] frame]; | 8557 NSRect totalrect = [[object screen] frame]; |
8557 | 8558 |
8558 if(horz & DW_GRAV_OBSTACLES) | 8559 if(horz & DW_GRAV_OBSTACLES) |
8559 { | 8560 { |
8560 if((horz & 0xf) == DW_GRAV_LEFT) | 8561 if((horz & 0xf) == DW_GRAV_LEFT) |
8561 *x += visiblerect.origin.x; | 8562 *x += visiblerect.origin.x; |
8644 NSWindow *window = handle; | 8645 NSWindow *window = handle; |
8645 NSRect rect = [window frame]; | 8646 NSRect rect = [window frame]; |
8646 if(x) | 8647 if(x) |
8647 *x = rect.origin.x; | 8648 *x = rect.origin.x; |
8648 if(y) | 8649 if(y) |
8649 *y = [[NSScreen mainScreen] frame].size.height - rect.origin.y - rect.size.height; | 8650 *y = [[window screen] frame].size.height - rect.origin.y - rect.size.height; |
8650 if(width) | 8651 if(width) |
8651 *width = rect.size.width; | 8652 *width = rect.size.width; |
8652 if(height) | 8653 if(height) |
8653 *height = rect.size.height; | 8654 *height = rect.size.height; |
8654 return; | 8655 return; |