From 4b495e5e7bb19e55a610bba9a15811b4a5d03e68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Luc=20Peuri=C3=A8re?= Date: Sun, 1 Aug 2004 22:28:56 +0000 Subject: OS X fix: those who work with visible dock where experimenting slowdown of UI when blender window was overlapping dock. now : - check available space excluding dock - create window with a 10 pixels border - maximised mode is only 1 click away This code is fixing only. Will review that when consensus will be found about how we should create the window. --- intern/ghost/intern/GHOST_SystemCarbon.cpp | 18 ++++++++++-------- intern/ghost/intern/GHOST_WindowCarbon.cpp | 11 ++++++++--- source/blender/src/editscreen.c | 18 ++++++++++++------ source/blender/src/ghostwinlay.c | 12 +++++++++++- source/creator/creator.c | 15 +++++++++++---- 5 files changed, 52 insertions(+), 22 deletions(-) diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp index 88bc859be6e..e7f087a86bc 100644 --- a/intern/ghost/intern/GHOST_SystemCarbon.cpp +++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp @@ -899,16 +899,18 @@ bool GHOST_SystemCarbon::handleMouseDown(EventRef event) if (macState == 2) { // always ok ::ZoomWindow(window, part, true); ghostWindow->setMac_windowState(1); - } else { // need to force size again - GHOST_TUns32 scr_x,scr_y; + } else { // need to force size again + GHOST_TUns32 scr_x,scr_y; + Rect outAvailableRect; - ghostWindow->setMac_windowState(2); + ghostWindow->setMac_windowState(2); + ::GetAvailableWindowPositioningBounds ( GetMainDevice(), &outAvailableRect); - this->getMainDisplayDimensions(scr_x,scr_y); - ::SizeWindow (window, scr_x,scr_y-22,false); - ::MoveWindow (window, 1,22,true); - } - + //this->getMainDisplayDimensions(scr_x,scr_y); + ::SizeWindow (window, outAvailableRect.right-outAvailableRect.left,outAvailableRect.bottom-outAvailableRect.top-1,false); + ::MoveWindow (window, outAvailableRect.left, outAvailableRect.top,true); + } + } break; diff --git a/intern/ghost/intern/GHOST_WindowCarbon.cpp b/intern/ghost/intern/GHOST_WindowCarbon.cpp index 0c68a571a68..c1d6e8ee49f 100644 --- a/intern/ghost/intern/GHOST_WindowCarbon.cpp +++ b/intern/ghost/intern/GHOST_WindowCarbon.cpp @@ -113,9 +113,11 @@ GHOST_WindowCarbon::GHOST_WindowCarbon( Str255 title255; OSStatus err; + //fprintf(stderr," main screen top %i left %i height %i width %i\n", top, left, height, width); + if (state >= 8 ) { state = state - 8; - setMac_windowState(2); + setMac_windowState(1); } else setMac_windowState(0); @@ -128,10 +130,10 @@ GHOST_WindowCarbon::GHOST_WindowCarbon( kWindowStandardDocumentAttributes+kWindowLiveResizeAttribute, &bnds, &m_windowRef); + if ( err != noErr) { fprintf(stderr," error creating window %i \n",err); } else { - //void *handler = &GHOST_WindowCarbon::myWEventHandlerProc; ::SetWRefCon(m_windowRef,(SInt32)this); setTitle(title); @@ -139,7 +141,10 @@ GHOST_WindowCarbon::GHOST_WindowCarbon( if ( err != noErr) { fprintf(stderr," error creating handler %i \n",err); } else { - ::TransitionWindow (m_windowRef,kWindowZoomTransitionEffect,kWindowShowTransitionAction,NULL); + // ::TransitionWindow (m_windowRef,kWindowZoomTransitionEffect,kWindowShowTransitionAction,NULL); + ::ShowWindow(m_windowRef); + ::MoveWindow (m_windowRef, left, top,true); + } } if (m_windowRef) { diff --git a/source/blender/src/editscreen.c b/source/blender/src/editscreen.c index 9cf11275f73..b8f26bddbef 100644 --- a/source/blender/src/editscreen.c +++ b/source/blender/src/editscreen.c @@ -1212,19 +1212,25 @@ void setprefsize(int stax, int stay, int sizx, int sizy) int scrwidth, scrheight; winlay_get_screensize(&scrwidth, &scrheight); - + if(stax<0) stax= 0; if(stay<0) stay= 0; if(sizx<320) sizx= 320; if(sizy<256) sizy= 256; - if(stax+sizx>scrwidth) sizx= scrwidth-stax; + if(stax+sizx>scrwidth) { + fprintf(stderr," width prob \n"); + sizx= scrwidth-stax; + } - if(stay+sizy>scrheight) sizy= scrheight-stay; + if(stay+sizy>scrheight) { + fprintf(stderr," height prob \n"); + sizy= scrheight-stay; + } -#ifdef __APPLE__ - if(stay+sizy>scrheight-22) sizy= scrheight-22-stay; // 22 = topbar -#endif +/* #ifdef __APPLE__ */ +/* if(stay+sizy>scrheight-22) sizy= scrheight-22-stay; // 22 = topbar */ +/* #endif*/ if(sizx<320 || sizy<256) { printf("ERROR: illegal prefsize\n"); diff --git a/source/blender/src/ghostwinlay.c b/source/blender/src/ghostwinlay.c index 954388b3db7..85571995b87 100644 --- a/source/blender/src/ghostwinlay.c +++ b/source/blender/src/ghostwinlay.c @@ -118,7 +118,6 @@ int checkAppleVideoCard() { long value; long maxvram = 0; /* we get always more than 1 renderer, check one, at least, has 8 Mo */ - display_mask = CGDisplayIDToOpenGLDisplayMask (CGMainDisplayID() ); theErr = CGLQueryRendererInfo( display_mask, &rend, &nrend); @@ -159,6 +158,17 @@ int checkAppleVideoCard() { return 0; } +void getMacAvailableBounds(short *top, short *left, short *bottom, short *right) { + Rect outAvailableRect; + + GetAvailableWindowPositioningBounds ( GetMainDevice(), &outAvailableRect); + + *top = outAvailableRect.top; + *left = outAvailableRect.left; + *bottom = outAvailableRect.bottom; + *right = outAvailableRect.right; +} + #endif diff --git a/source/creator/creator.c b/source/creator/creator.c index eb3cf302fed..baf18468b12 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -113,6 +113,7 @@ static void print_version(); /* defined is ghostwinlay , we can't include carbon here, conflict with DNA */ #ifdef __APPLE extern int checkAppleVideoCard(); +extern void getMacAvailableBounds(short *top, short *left, short *bottom, short *right); #endif @@ -200,6 +201,7 @@ static void print_help(void) double PIL_check_seconds_timer(void); extern void winlay_get_screensize(int *width_r, int *height_r); + int main(int argc, char **argv) { int a, i, stax, stay, sizx, sizy; @@ -225,16 +227,21 @@ int main(int argc, char **argv) /* first let us check if we are hardware accelerated and with VRAM >= 16 Mo */ if (checkAppleVideoCard()) { - winlay_get_screensize(&scr_x, &scr_y); - /* let sneak under topbar */ - setprefsize(1, 1, scr_x-2, scr_y-24); + short top, left, bottom, right; + + winlay_get_screensize(&scr_x, &scr_y); + /* let sneak under topbar + setprefsize(1, 1, scr_x-2, scr_y-24);*/ + getMacAvailableBounds(&top, &left, &bottom, &right); + setprefsize(left +10,scr_y - bottom +10,right-left -20,bottom - 64); } else { + winlay_get_screensize(&scr_x, &scr_y); + /* 40 + 684 + (headers) 22 + 22 = 768, the powerbook screen height */ setprefsize(120, 40, 850, 684); } - winlay_get_screensize(&scr_x, &scr_y); winlay_process_events(0); if (GHOST_HACK_getFirstFile(firstfilebuf)) { argc= 2; -- cgit v1.2.3