|
@@ -11,7 +11,6 @@ slop::SlopWindow::SlopWindow() {
|
11
|
11
|
GLX_GREEN_SIZE, 1,
|
12
|
12
|
GLX_BLUE_SIZE, 1,
|
13
|
13
|
GLX_ALPHA_SIZE, 1,
|
14
|
|
- GLX_DEPTH_SIZE, 1,
|
15
|
14
|
None };
|
16
|
15
|
int nelements;
|
17
|
16
|
int render_event_base, render_error_base;
|
|
@@ -31,15 +30,21 @@ slop::SlopWindow::SlopWindow() {
|
31
|
30
|
vi = glXGetVisualFromFBConfig(x11->display, fbc[i]);
|
32
|
31
|
if (!vi) { continue; }
|
33
|
32
|
pictFormat = XRenderFindVisualFormat(x11->display, vi->visual);
|
34
|
|
- if (!pictFormat) { continue; }
|
|
33
|
+ if (!pictFormat) {
|
|
34
|
+ XFree( vi );
|
|
35
|
+ continue;
|
|
36
|
+ }
|
35
|
37
|
if(pictFormat->direct.alphaMask > 0) {
|
36
|
38
|
fbconfig = fbc[i];
|
37
|
39
|
break;
|
|
40
|
+ } else {
|
|
41
|
+ XFree( vi );
|
38
|
42
|
}
|
39
|
43
|
}
|
40
|
44
|
if (i == nelements ) {
|
41
|
45
|
throw new std::runtime_error( "No matching visuals available" );
|
42
|
46
|
}
|
|
47
|
+ XFree( fbc );
|
43
|
48
|
|
44
|
49
|
XSetWindowAttributes attributes;
|
45
|
50
|
attributes.colormap = XCreateColormap(x11->display, RootWindow(x11->display, vi->screen), vi->visual, AllocNone);
|
|
@@ -56,6 +61,7 @@ slop::SlopWindow::SlopWindow() {
|
56
|
61
|
window = XCreateWindow( x11->display, x11->root, 0, 0, WidthOfScreen( x11->screen ), HeightOfScreen( x11->screen ),
|
57
|
62
|
0, vi->depth, InputOutput,
|
58
|
63
|
vi->visual, valueMask, &attributes );
|
|
64
|
+ XFree( vi );
|
59
|
65
|
|
60
|
66
|
if ( !window ) {
|
61
|
67
|
throw new std::runtime_error( "Couldn't create a GL window!" );
|
|
@@ -120,6 +126,7 @@ slop::SlopWindow::~SlopWindow() {
|
120
|
126
|
glXDestroyContext( x11->display, context );
|
121
|
127
|
XUnmapWindow( x11->display, window );
|
122
|
128
|
XDestroyWindow( x11->display, window );
|
|
129
|
+ glXMakeCurrent( x11->display, None, NULL );
|
123
|
130
|
}
|
124
|
131
|
|
125
|
132
|
void slop::SlopWindow::display() {
|
|
@@ -128,5 +135,5 @@ void slop::SlopWindow::display() {
|
128
|
135
|
}
|
129
|
136
|
|
130
|
137
|
void slop::SlopWindow::setCurrent() {
|
131
|
|
- glXMakeCurrent( x11->display, window, context ) ;
|
|
138
|
+ glXMakeCurrent( x11->display, window, context );
|
132
|
139
|
}
|