Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2012-12-20 15:14:52 +0400
committerTon Roosendaal <ton@blender.org>2012-12-20 15:14:52 +0400
commit4e2bc939c1da6dcabe8efd62266b8e0f47f6cc0f (patch)
treeee1c30c0b18bad45b5bd0fb70d13cf77e24a684a /source
parent0d7e4f3229f9a61a236de484db1a9a91039353b1 (diff)
Mac Retina fix:
Mouse coordinates were not mapped correctly for code that allows to use multiple windows efficiently (mouse over not-active windows). Apple's high-density display mode works a bit strange, requiring some hacks :/ - Desktop coordinate system (mouse pos and for windows) is as usual (set by display resolution settings) - However, the available pixels in a window is always on 'retina' level. (full screen - 2880 wide, but window can be 1440 or 1920 wide) In order to get this to work for opengl and Blender, we use internally the coordinates on pixel level. That means that window positions and sizes have to mappend in our code. Once all issues for retinas have been tackled, I'll check on clean API for it, so you can also use it in future for other high density screens.
Diffstat (limited to 'source')
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index d8dd0ac04c4..e462e21d9f4 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -2689,8 +2689,10 @@ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *wi
if (wm->windows.first == wm->windows.last)
return NULL;
- /* top window bar... */
- if (mx < 0 || my < 0 || mx > win->sizex || my > win->sizey + 30) {
+ /* in order to use window size and mouse position (pixels), we have to use a WM function */
+
+ /* check if outside, include top window bar... */
+ if (mx < 0 || my < 0 || mx > WM_window_pixels_x(win) || my > WM_window_pixels_y(win) + 30) {
wmWindow *owin;
wmEventHandler *handler;
@@ -2701,18 +2703,21 @@ static wmWindow *wm_event_cursor_other_windows(wmWindowManager *wm, wmWindow *wi
return NULL;
/* to desktop space */
- mx += (int)win->posx;
- my += (int)win->posy;
+ mx += (int) (U.pixelsize * win->posx);
+ my += (int) (U.pixelsize * win->posy);
/* check other windows to see if it has mouse inside */
for (owin = wm->windows.first; owin; owin = owin->next) {
if (owin != win) {
- if (mx - owin->posx >= 0 && my - owin->posy >= 0 &&
- mx - owin->posx <= owin->sizex && my - owin->posy <= owin->sizey)
+ int posx = (int) (U.pixelsize * owin->posx);
+ int posy = (int) (U.pixelsize * owin->posy);
+
+ if (mx - posx >= 0 && owin->posy >= 0 &&
+ mx - posx <= WM_window_pixels_x(owin) && my - posy <= WM_window_pixels_y(owin))
{
- evt->x = mx - (int)owin->posx;
- evt->y = my - (int)owin->posy;
+ evt->x = mx - (int)(U.pixelsize * owin->posx);
+ evt->y = my - (int)(U.pixelsize * owin->posy);
return owin;
}