39
41
#include <Carbon/Carbon.h>
42
43
/* To avoid killing small end comps, we want to allow
43
blender to start maximised if all the followings are true :
44
- Renderer is OpenGL capable
45
- Hardware acceleration
44
* blender to start maximised if all the followings are true :
45
* - Renderer is OpenGL capable
46
* - Hardware acceleration
49
* We will bail out if VRAM is less than 8Mo
48
We will bail out if VRAM is less than 8Mo
50
52
/* bad global, used in wm_window.c to open windows */
51
53
int macPrefState = 0;
61
63
long maxvram = 0; /* we get always more than 1 renderer, check one, at least, has 8 Mo */
63
display_mask = CGDisplayIDToOpenGLDisplayMask (CGMainDisplayID() );
65
display_mask = CGDisplayIDToOpenGLDisplayMask(CGMainDisplayID() );
65
theErr = CGLQueryRendererInfo( display_mask, &rend, &nrend);
67
theErr = CGLQueryRendererInfo(display_mask, &rend, &nrend);
67
theErr = CGLDescribeRenderer (rend, 0, kCGLRPRendererCount, &nrend);
69
theErr = CGLDescribeRenderer(rend, 0, kCGLRPRendererCount, &nrend);
69
71
for (j = 0; j < nrend; j++) {
70
theErr = CGLDescribeRenderer (rend, j, kCGLRPVideoMemory, &value);
72
theErr = CGLDescribeRenderer(rend, j, kCGLRPVideoMemory, &value);
71
73
if (value > maxvram)
73
75
if ((theErr == 0) && (value >= 20000000)) {
74
theErr = CGLDescribeRenderer (rend, j, kCGLRPAccelerated, &value);
76
theErr = CGLDescribeRenderer(rend, j, kCGLRPAccelerated, &value);
75
77
if ((theErr == 0) && (value != 0)) {
76
theErr = CGLDescribeRenderer (rend, j, kCGLRPCompliant, &value);
78
theErr = CGLDescribeRenderer(rend, j, kCGLRPCompliant, &value);
77
79
if ((theErr == 0) && (value != 0)) {
78
80
/*fprintf(stderr,"make it big\n");*/
79
CGLDestroyRendererInfo (rend);
81
CGLDestroyRendererInfo(rend);
88
if (maxvram < 7500000 ) { /* put a standard alert and quit*/
90
if (maxvram < 7500000) { /* put a standard alert and quit*/
90
char inError[] = "* Not enough VRAM ";
91
char inText[] = "* blender needs at least 8Mb ";
92
char inError[] = "* Not enough VRAM ";
93
char inText[] = "* blender needs at least 8Mb ";
95
97
fprintf(stderr, " vram is %li . not enough, aborting\n", maxvram);
96
StandardAlert ( kAlertStopAlert, (ConstStr255Param) &inError, (ConstStr255Param)&inText,NULL,&junkHit);
98
StandardAlert(kAlertStopAlert, (ConstStr255Param) & inError, (ConstStr255Param) & inText, NULL, &junkHit);
99
CGLDestroyRendererInfo (rend);
101
CGLDestroyRendererInfo(rend);
103
105
static void getMacAvailableBounds(short *top, short *left, short *bottom, short *right)
105
107
Rect outAvailableRect;
107
GetAvailableWindowPositioningBounds ( GetMainDevice(), &outAvailableRect);
109
GetAvailableWindowPositioningBounds(GetMainDevice(), &outAvailableRect);
109
111
*top = outAvailableRect.top;
110
112
*left = outAvailableRect.left;
122
124
short top, left, bottom, right;
124
126
getMacAvailableBounds(&top, &left, &bottom, &right);
125
WM_setprefsize(left +10,scr_y - bottom +10,right-left -20,bottom - 64);
127
WM_setprefsize(left + 10, scr_y - bottom + 10, right - left - 20, bottom - 64);
130
133
/* 40 + 684 + (headers) 22 + 22 = 768, the powerbook screen height */
131
134
WM_setprefsize(120, 40, 850, 684);
137
#endif /* __APPLE__ */