Unref imggc and add separate CDE checks

Signed-off-by: rjb330 <122177540+rjb330@users.noreply.github.com>
pull/24/head
rjb330 3 weeks ago
parent d055f3b3ad
commit ff04675883

@ -70,6 +70,7 @@ TQWidget* meepWidget = 0;
TQWidget* meepWidgetP = 0; TQWidget* meepWidgetP = 0;
TQSlider* meepSlider = 0; TQSlider* meepSlider = 0;
TQTabBar* meepTabBar = 0; TQTabBar* meepTabBar = 0;
GdkGC* windowGC = 0;
GdkGC* altBackGC = 0; GdkGC* altBackGC = 0;
TQWidget* smw = 0; TQWidget* smw = 0;
@ -98,6 +99,7 @@ int isAlloy;
int isDomino; int isDomino;
int isPolyester; int isPolyester;
int isMotif; int isMotif;
int isCDE;
int eclipseFix; int eclipseFix;
int openOfficeFix; int openOfficeFix;
int mozillaFix; int mozillaFix;
@ -445,8 +447,8 @@ void createTQApp()
isAlloy = (TQString(tqApp->style().name()).lower() == "alloy"); isAlloy = (TQString(tqApp->style().name()).lower() == "alloy");
isDomino = (TQString(tqApp->style().name()).lower() == "domino"); isDomino = (TQString(tqApp->style().name()).lower() == "domino");
isPolyester = (TQString(tqApp->style().name()).lower() == "polyester"); isPolyester = (TQString(tqApp->style().name()).lower() == "polyester");
isMotif = (TQString(tqApp->style().name()).lower() == "motif" || isMotif = (TQString(tqApp->style().name()).lower() == "motif");
TQString(tqApp->style().name()).lower() == "cde"); isCDE = (TQString(tqApp->style().name()).lower() == "cde");
if (isDomino) if (isDomino)
{ {
@ -508,6 +510,8 @@ void destroyTQApp()
delete tqApp; delete tqApp;
tqApp = 0; tqApp = 0;
} }
if (windowGC != 0)
gtk_gc_release(windowGC);
if (altBackGC != 0) if (altBackGC != 0)
gtk_gc_release(altBackGC); gtk_gc_release(altBackGC);
@ -657,7 +661,6 @@ TQColor gdkColorToTQColor(GdkColor* c)
void drawTQPixmapToWindow(GdkWindow* window, GdkGC* gc, TQPixmap* pixmap, int x, int y, int w, int h) void drawTQPixmapToWindow(GdkWindow* window, GdkGC* gc, TQPixmap* pixmap, int x, int y, int w, int h)
{ {
static GdkGC* imggc = gdk_gc_new(window);
GdkPixmap* pix; GdkPixmap* pix;
// gdk_drawable_get_image crashes if requested region is outside of the window. // gdk_drawable_get_image crashes if requested region is outside of the window.
@ -665,7 +668,7 @@ void drawTQPixmapToWindow(GdkWindow* window, GdkGC* gc, TQPixmap* pixmap, int x,
int width, height; int width, height;
gdk_drawable_get_size(window, &width, &height); gdk_drawable_get_size(window, &width, &height);
if (!pixmap->hasAlpha() || isDomino || isBaghira || if (!pixmap->hasAlpha() || isDomino || isBaghira ||
(width < x + w) || (height < y + h)) { (width < x + w) || (height < y + h) || (0 > x) || (0 > y)) {
pix = gdk_pixmap_foreign_new(pixmap->handle()); pix = gdk_pixmap_foreign_new(pixmap->handle());
gdk_draw_drawable(window, gc, pix, 0, 0, x, y, w, h); gdk_draw_drawable(window, gc, pix, 0, 0, x, y, w, h);
g_object_unref(pix); g_object_unref(pix);
@ -674,10 +677,12 @@ void drawTQPixmapToWindow(GdkWindow* window, GdkGC* gc, TQPixmap* pixmap, int x,
// Gdk isn't aware of the TQPixmap mask, // Gdk isn't aware of the TQPixmap mask,
// so instead we create a new pixmap from the window region and bitBlt over it. // so instead we create a new pixmap from the window region and bitBlt over it.
if (windowGC == 0)
windowGC = gdk_gc_new(window);
TQPixmap gpixmap(w, h); TQPixmap gpixmap(w, h);
pix = gdk_pixmap_foreign_new(gpixmap.handle()); pix = gdk_pixmap_foreign_new(gpixmap.handle());
GdkImage* img = gdk_drawable_get_image(window, x, y, w, h); GdkImage* img = gdk_drawable_get_image(window, x, y, w, h);
gdk_draw_image(pix, imggc, img, 0, 0, 0, 0, w, h); gdk_draw_image(pix, windowGC, img, 0, 0, 0, 0, w, h);
bitBlt(&gpixmap, 0, 0, pixmap, 0, 0, w, h, TQt::CopyROP); bitBlt(&gpixmap, 0, 0, pixmap, 0, 0, w, h, TQt::CopyROP);
gdk_draw_drawable(window, gc, pix, 0, 0, x, y, w, h); gdk_draw_drawable(window, gc, pix, 0, 0, x, y, w, h);
@ -794,7 +799,7 @@ void drawButton(GdkWindow* window, GtkStyle* style, GtkStateType state, int defa
tqApp->style().subRect(TQStyle::SR_PushButtonContents, &button), tqApp->style().subRect(TQStyle::SR_PushButtonContents, &button),
button.colorGroup(), sflags); button.colorGroup(), sflags);
if (!isBaghira && !isMotif) { if (!isBaghira && !isMotif && !isCDE) {
TQBitmap bitmap(w, h, TRUE); TQBitmap bitmap(w, h, TRUE);
TQPainter bpainter(&bitmap); TQPainter bpainter(&bitmap);
bpainter.setBrush(TQt::color1); bpainter.setBrush(TQt::color1);
@ -824,7 +829,7 @@ void drawButton(GdkWindow* window, GtkStyle* style, GtkStateType state, int defa
tqApp->style().drawControl(TQStyle::CE_PushButton, &painter, &button, tqApp->style().drawControl(TQStyle::CE_PushButton, &painter, &button,
TQRect(0,0,w,h), button.palette().active(), sflags); TQRect(0,0,w,h), button.palette().active(), sflags);
if (!isBaghira && !isMotif) { if (!isBaghira && !isMotif && !isCDE) {
TQBitmap bitmap(w, h, TRUE); TQBitmap bitmap(w, h, TRUE);
TQPainter bpainter(&bitmap); TQPainter bpainter(&bitmap);
bpainter.setBrush(TQt::color1); bpainter.setBrush(TQt::color1);

Loading…
Cancel
Save