|
|
@ -938,6 +938,7 @@ void LockProcess::createSaverWindow()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Visual* visual = CopyFromParent;
|
|
|
|
Visual* visual = CopyFromParent;
|
|
|
|
XSetWindowAttributes attrs;
|
|
|
|
XSetWindowAttributes attrs;
|
|
|
|
|
|
|
|
XVisualInfo* info = NULL;
|
|
|
|
int flags = trinity_desktop_lock_use_system_modal_dialogs?0:CWOverrideRedirect;
|
|
|
|
int flags = trinity_desktop_lock_use_system_modal_dialogs?0:CWOverrideRedirect;
|
|
|
|
#ifdef HAVE_GLXCHOOSEVISUAL
|
|
|
|
#ifdef HAVE_GLXCHOOSEVISUAL
|
|
|
|
if( mOpenGLVisual )
|
|
|
|
if( mOpenGLVisual )
|
|
|
@ -963,23 +964,41 @@ void LockProcess::createSaverWindow()
|
|
|
|
#undef G
|
|
|
|
#undef G
|
|
|
|
#undef B
|
|
|
|
#undef B
|
|
|
|
};
|
|
|
|
};
|
|
|
|
for( unsigned int i = 0;
|
|
|
|
for( unsigned int i = 0; i < sizeof( attribs ) / sizeof( attribs[ 0 ] ); ++i ) {
|
|
|
|
i < sizeof( attribs ) / sizeof( attribs[ 0 ] );
|
|
|
|
int n_glxfb_configs;
|
|
|
|
++i )
|
|
|
|
GLXFBConfig *fbc = glXChooseFBConfig( x11Display(), x11Screen(), attribs[ i ], &n_glxfb_configs);
|
|
|
|
{
|
|
|
|
if (!fbc) {
|
|
|
|
if( XVisualInfo* info = glXChooseVisual( x11Display(), x11Screen(), attribs[ i ] ))
|
|
|
|
n_glxfb_configs = 0;
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
for( int j = 0; j < n_glxfb_configs; j++ ) {
|
|
|
|
|
|
|
|
info = glXGetVisualFromFBConfig(x11Display(), fbc[j]);
|
|
|
|
|
|
|
|
if( info ) {
|
|
|
|
|
|
|
|
if (argb_visual) {
|
|
|
|
|
|
|
|
if (info->depth < 32) {
|
|
|
|
|
|
|
|
XFree( info );
|
|
|
|
|
|
|
|
info = NULL;
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
visual = info->visual;
|
|
|
|
visual = info->visual;
|
|
|
|
static Colormap colormap = 0;
|
|
|
|
static Colormap colormap = 0;
|
|
|
|
if( colormap != 0 )
|
|
|
|
if( colormap != 0 ) {
|
|
|
|
XFreeColormap( x11Display(), colormap );
|
|
|
|
XFreeColormap( x11Display(), colormap );
|
|
|
|
|
|
|
|
}
|
|
|
|
colormap = XCreateColormap( x11Display(), RootWindow( x11Display(), x11Screen()), visual, AllocNone );
|
|
|
|
colormap = XCreateColormap( x11Display(), RootWindow( x11Display(), x11Screen()), visual, AllocNone );
|
|
|
|
attrs.colormap = colormap;
|
|
|
|
attrs.colormap = colormap;
|
|
|
|
flags |= CWColormap;
|
|
|
|
flags |= CWColormap;
|
|
|
|
XFree( info );
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flags & CWColormap) {
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !info )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
printf("[WARNING] Unable to locate matching X11 GLX Visual; this OpenGL application may not function correctly!\n");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
@ -987,22 +1006,38 @@ void LockProcess::createSaverWindow()
|
|
|
|
hide();
|
|
|
|
hide();
|
|
|
|
|
|
|
|
|
|
|
|
if (argb_visual) {
|
|
|
|
if (argb_visual) {
|
|
|
|
|
|
|
|
// The GL visual selection can return a visual with invalid depth
|
|
|
|
|
|
|
|
// Check for this and use a fallback visual if needed
|
|
|
|
|
|
|
|
if (info && (info->depth < 32)) {
|
|
|
|
|
|
|
|
printf("[WARNING] Unable to locate matching X11 GLX Visual; this OpenGL application may not function correctly!\n");
|
|
|
|
|
|
|
|
XFree( info );
|
|
|
|
|
|
|
|
info = NULL;
|
|
|
|
|
|
|
|
flags &= ~CWColormap;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
attrs.background_pixel = 0;
|
|
|
|
attrs.background_pixel = 0;
|
|
|
|
attrs.border_pixel = 0;
|
|
|
|
attrs.border_pixel = 0;
|
|
|
|
flags |= CWBackPixel;
|
|
|
|
flags |= CWBackPixel;
|
|
|
|
flags |= CWBorderPixel;
|
|
|
|
flags |= CWBorderPixel;
|
|
|
|
if (!(flags & CWColormap)) {
|
|
|
|
if (!(flags & CWColormap)) {
|
|
|
|
XVisualInfo vinfo;
|
|
|
|
if (!info) {
|
|
|
|
if (!XMatchVisualInfo( x11Display(), x11Screen(), 32, TrueColor, &vinfo )) {
|
|
|
|
info = new XVisualInfo;
|
|
|
|
printf("[ERROR] Unable to locate matching X11 Visual; this application will not function correctly!\n\r");
|
|
|
|
if (!XMatchVisualInfo( x11Display(), x11Screen(), 32, TrueColor, info )) {
|
|
|
|
|
|
|
|
printf("[ERROR] Unable to locate matching X11 Visual; this application will not function correctly!\n");
|
|
|
|
|
|
|
|
free(info);
|
|
|
|
|
|
|
|
info = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
}
|
|
|
|
visual = vinfo.visual;
|
|
|
|
if (info) {
|
|
|
|
|
|
|
|
visual = info->visual;
|
|
|
|
attrs.colormap = XCreateColormap( x11Display(), RootWindow( x11Display(), x11Screen()), visual, AllocNone );
|
|
|
|
attrs.colormap = XCreateColormap( x11Display(), RootWindow( x11Display(), x11Screen()), visual, AllocNone );
|
|
|
|
flags |= CWColormap;
|
|
|
|
flags |= CWColormap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (info) {
|
|
|
|
|
|
|
|
XFree( info );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Window w = XCreateWindow( x11Display(), RootWindow( x11Display(), x11Screen()), x(), y(), width(), height(), 0, x11Depth(), InputOutput, visual, flags, &attrs );
|
|
|
|
Window w = XCreateWindow( x11Display(), RootWindow( x11Display(), x11Screen()), x(), y(), width(), height(), 0, x11Depth(), InputOutput, visual, flags, &attrs );
|
|
|
|
create( w );
|
|
|
|
create( w );
|
|
|
|