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.
This commit is contained in:
Jean-Luc Peurière 2004-08-01 22:28:56 +00:00
parent c11bb5b7ad
commit 4b495e5e7b
5 changed files with 52 additions and 22 deletions

@ -899,15 +899,17 @@ 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;

@ -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) {

@ -1218,13 +1218,19 @@ void setprefsize(int stax, int stay, int sizx, int sizy)
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");

@ -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

@ -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;