|
|
@ -40,4 +40,60 @@ Qt::HANDLE QPaintDevice::x11RenderHandle() const
|
|
|
|
// #endif // QT_NO_XFTFREETYPE
|
|
|
|
// #endif // QT_NO_XFTFREETYPE
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static GC* app_gc_tmp = 0; // temporary GC
|
|
|
|
|
|
|
|
static GC* app_gc_tmp_m = 0; // temporary GC (monochrome)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static GC create_gc( int scrn, bool monochrome )
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
GC gc;
|
|
|
|
|
|
|
|
if ( monochrome ) {
|
|
|
|
|
|
|
|
Pixmap pm = XCreatePixmap( appDpy, RootWindow( appDpy, scrn ), 8, 8, 1 );
|
|
|
|
|
|
|
|
gc = XCreateGC( appDpy, pm, 0, 0 );
|
|
|
|
|
|
|
|
XFreePixmap( appDpy, pm );
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if ( QPaintDevice::x11AppDefaultVisual( scrn ) ) {
|
|
|
|
|
|
|
|
gc = XCreateGC( appDpy, RootWindow( appDpy, scrn ), 0, 0 );
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Window w;
|
|
|
|
|
|
|
|
XSetWindowAttributes a;
|
|
|
|
|
|
|
|
a.background_pixel = Qt::black.pixel( scrn );
|
|
|
|
|
|
|
|
a.border_pixel = Qt::black.pixel( scrn );
|
|
|
|
|
|
|
|
a.colormap = QPaintDevice::x11AppColormap( scrn );
|
|
|
|
|
|
|
|
w = XCreateWindow( appDpy, RootWindow( appDpy, scrn ), 0, 0, 100, 100,
|
|
|
|
|
|
|
|
0, QPaintDevice::x11AppDepth( scrn ), InputOutput,
|
|
|
|
|
|
|
|
(Visual*)QPaintDevice::x11AppVisual( scrn ),
|
|
|
|
|
|
|
|
CWBackPixel|CWBorderPixel|CWColormap, &a );
|
|
|
|
|
|
|
|
gc = XCreateGC( appDpy, w, 0, 0 );
|
|
|
|
|
|
|
|
XDestroyWindow( appDpy, w );
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
XSetGraphicsExposures( appDpy, gc, False );
|
|
|
|
|
|
|
|
return gc;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GC qt_xget_temp_gc( int scrn, bool monochrome ) // get temporary GC
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int appScreenCount = QApplication::desktop()->numScreens();
|
|
|
|
|
|
|
|
if ( scrn < 0 || scrn >= appScreenCount ) {
|
|
|
|
|
|
|
|
qDebug("invalid screen (tmp) %d %d", scrn, appScreenCount );
|
|
|
|
|
|
|
|
QWidget* bla = 0;
|
|
|
|
|
|
|
|
bla->setName("hello");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
GC gc;
|
|
|
|
|
|
|
|
if ( monochrome ) {
|
|
|
|
|
|
|
|
if ( !app_gc_tmp_m ) // create GC for bitmap
|
|
|
|
|
|
|
|
memset( (app_gc_tmp_m = new GC[appScreenCount]), 0, appScreenCount * sizeof( GC ) );
|
|
|
|
|
|
|
|
if ( !app_gc_tmp_m[scrn] )
|
|
|
|
|
|
|
|
app_gc_tmp_m[scrn] = create_gc( scrn, TRUE );
|
|
|
|
|
|
|
|
gc = app_gc_tmp_m[scrn];
|
|
|
|
|
|
|
|
} else { // create standard GC
|
|
|
|
|
|
|
|
if ( !app_gc_tmp )
|
|
|
|
|
|
|
|
memset( (app_gc_tmp = new GC[appScreenCount]), 0, appScreenCount * sizeof( GC ) );
|
|
|
|
|
|
|
|
if ( !app_gc_tmp[scrn] )
|
|
|
|
|
|
|
|
app_gc_tmp[scrn] = create_gc( scrn, FALSE );
|
|
|
|
|
|
|
|
gc = app_gc_tmp[scrn];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return gc;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif // USE_QT4
|
|
|
|
#endif // USE_QT4
|