~siretart/ubuntu/utopic/blender/libav10

« back to all changes in this revision

Viewing changes to source/blender/windowmanager/intern/wm_apple.c

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2012-07-23 08:54:18 UTC
  • mfrom: (14.2.16 sid)
  • mto: (14.2.19 sid)
  • mto: This revision was merged to the branch mainline in revision 42.
  • Revision ID: package-import@ubuntu.com-20120723085418-9foz30v6afaf5ffs
Tags: 2.63a-2
* debian/: Cycles support added (Closes: #658075)
  For now, this top feature has been enabled only
  on [any-amd64 any-i386] architectures because
  of OpenImageIO failing on all others
* debian/: scripts installation path changed
  from /usr/lib to /usr/share:
  + debian/patches/: patchset re-worked for path changing
  + debian/control: "Breaks" field added on yafaray-exporter

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/**
2
 
 * $Id: wm_apple.c 27655 2010-03-22 09:30:00Z campbellbarton $
3
 
 *
 
1
/*
4
2
 * ***** BEGIN GPL LICENSE BLOCK *****
5
3
 *
6
4
 * This program is free software; you can redistribute it and/or
26
24
 * ***** END GPL LICENSE BLOCK *****
27
25
 */
28
26
 
29
 
#ifdef __APPLE__
 
27
/** \file blender/windowmanager/intern/wm_apple.c
 
28
 *  \ingroup wm
 
29
 */
 
30
 
 
31
/* note, this file builds on apple-carbon only! */
30
32
 
31
33
#include "BKE_context.h"
32
34
#include "BKE_global.h"
38
40
#define ID ID_
39
41
#include <Carbon/Carbon.h>
40
42
 
41
 
 
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
46
 
- VRAM > 16 Mo
 
44
 * blender to start maximised if all the followings are true :
 
45
 * - Renderer is OpenGL capable
 
46
 * - Hardware acceleration
 
47
 * - VRAM > 16 Mo
 
48
 *
 
49
 * We will bail out if VRAM is less than 8Mo
 
50
 */
47
51
 
48
 
        We will bail out if VRAM is less than 8Mo
49
 
        */
50
52
/* bad global, used in wm_window.c to open windows */
51
53
int macPrefState = 0;
52
54
 
60
62
        long value;
61
63
        long maxvram = 0;   /* we get always more than 1 renderer, check one, at least, has 8 Mo */
62
64
        
63
 
        display_mask = CGDisplayIDToOpenGLDisplayMask (CGMainDisplayID() );     
 
65
        display_mask = CGDisplayIDToOpenGLDisplayMask(CGMainDisplayID() );
64
66
        
65
 
        theErr = CGLQueryRendererInfo( display_mask, &rend, &nrend);
 
67
        theErr = CGLQueryRendererInfo(display_mask, &rend, &nrend);
66
68
        if (theErr == 0) {
67
 
                theErr = CGLDescribeRenderer (rend, 0, kCGLRPRendererCount, &nrend);
 
69
                theErr = CGLDescribeRenderer(rend, 0, kCGLRPRendererCount, &nrend);
68
70
                if (theErr == 0) {
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)
72
74
                                        maxvram = value;
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);
80
82
                                                        macPrefState = 8;
81
83
                                                        return 1;
82
84
                                                }
85
87
                        }
86
88
                }
87
89
        }
88
 
        if (maxvram < 7500000 ) {       /* put a standard alert and quit*/ 
 
90
        if (maxvram < 7500000) {        /* put a standard alert and quit*/
89
91
                SInt16 junkHit;
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    ";
92
94
                inError[0] = 16;
93
95
                inText[0] = 28;
94
96
                
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);
97
99
                abort();
98
100
        }
99
 
CGLDestroyRendererInfo (rend);
100
 
return 0;
 
101
        CGLDestroyRendererInfo(rend);
 
102
        return 0;
101
103
}
102
104
 
103
105
static void getMacAvailableBounds(short *top, short *left, short *bottom, short *right) 
104
106
{
105
107
        Rect outAvailableRect;
106
108
        
107
 
        GetAvailableWindowPositioningBounds ( GetMainDevice(), &outAvailableRect);
 
109
        GetAvailableWindowPositioningBounds(GetMainDevice(), &outAvailableRect);
108
110
        
109
111
        *top = outAvailableRect.top;  
110
112
        *left = outAvailableRect.left;
122
124
                short top, left, bottom, right;
123
125
                
124
126
                getMacAvailableBounds(&top, &left, &bottom, &right);
125
 
                WM_setprefsize(left +10,scr_y - bottom +10,right-left -20,bottom - 64);
126
 
                G.windowstate= 0;
 
127
                WM_setprefsize(left + 10, scr_y - bottom + 10, right - left - 20, bottom - 64);
 
128
                G.windowstate = 0;
127
129
                
128
 
        } else {
 
130
        }
 
131
        else {
129
132
                
130
133
                /* 40 + 684 + (headers) 22 + 22 = 768, the powerbook screen height */
131
134
                WM_setprefsize(120, 40, 850, 684);
132
 
                G.windowstate= 0;
 
135
                G.windowstate = 0;
133
136
        }
134
137
}
135
 
 
136
 
 
137
 
#endif /* __APPLE__ */
138
 
 
139