More Qt3/Qt4 fixes

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/dependencies/tqtinterface@1162835 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 14 years ago
parent 8bb16c1590
commit 08af9dd219

@ -29,7 +29,7 @@ Boston, MA 02110-1301, USA.
// Reimplement the QUComExtra_P class // Reimplement the QUComExtra_P class
// For Qt3, no changes are needed // For Qt3, no changes are needed
#include <tqucomextra_p.h> #include <private/qucomextra_p.h>
#endif // USE_QT3 #endif // USE_QT3

@ -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

@ -673,8 +673,10 @@ class QUObject;
#define TQNoBrush Qt::NoBrush #define TQNoBrush Qt::NoBrush
#define QMetaData QMetaMethod #define QMetaData QMetaMethod
#define qt_xdisplay QX11Info::display #define qt_xdisplay QPaintDevice::x11Display
#define qt_xrootwin QPaintDevice::x11AppRootWindow #define qt_xrootwin QPaintDevice::x11AppRootWindow
#define qt_xscreen QPaintDevice::x11Screen
#define qt_xget_temp_gc QPaintDevice::qt_xget_temp_gc
#define TickSetting TickPosition #define TickSetting TickPosition
#define ButtonState Qt::ButtonState #define ButtonState Qt::ButtonState

@ -95,6 +95,7 @@ public:
#elif defined(Q_WS_X11) #elif defined(Q_WS_X11)
virtual Qt::HANDLE handle() const; virtual Qt::HANDLE handle() const;
virtual Qt::HANDLE x11RenderHandle() const; virtual Qt::HANDLE x11RenderHandle() const;
GC qt_xget_temp_gc( int scrn, bool monochrome );
#elif defined(Q_WS_MAC) #elif defined(Q_WS_MAC)
virtual Qt::HANDLE handle() const; virtual Qt::HANDLE handle() const;
#elif defined(Q_WS_QWS) #elif defined(Q_WS_QWS)

Loading…
Cancel
Save