From ff0467588335c91ec6c2dac3b417c9b1665d6c22 Mon Sep 17 00:00:00 2001 From: rjb330 <122177540+rjb330@users.noreply.github.com> Date: Wed, 30 Oct 2024 19:56:55 -0700 Subject: [PATCH] Unref imggc and add separate CDE checks Signed-off-by: rjb330 <122177540+rjb330@users.noreply.github.com> --- src/qt_qt_wrapper.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/qt_qt_wrapper.cpp b/src/qt_qt_wrapper.cpp index 618e6f5..26ec275 100644 --- a/src/qt_qt_wrapper.cpp +++ b/src/qt_qt_wrapper.cpp @@ -70,6 +70,7 @@ TQWidget* meepWidget = 0; TQWidget* meepWidgetP = 0; TQSlider* meepSlider = 0; TQTabBar* meepTabBar = 0; +GdkGC* windowGC = 0; GdkGC* altBackGC = 0; TQWidget* smw = 0; @@ -98,6 +99,7 @@ int isAlloy; int isDomino; int isPolyester; int isMotif; +int isCDE; int eclipseFix; int openOfficeFix; int mozillaFix; @@ -445,8 +447,8 @@ void createTQApp() isAlloy = (TQString(tqApp->style().name()).lower() == "alloy"); isDomino = (TQString(tqApp->style().name()).lower() == "domino"); isPolyester = (TQString(tqApp->style().name()).lower() == "polyester"); - isMotif = (TQString(tqApp->style().name()).lower() == "motif" || - TQString(tqApp->style().name()).lower() == "cde"); + isMotif = (TQString(tqApp->style().name()).lower() == "motif"); + isCDE = (TQString(tqApp->style().name()).lower() == "cde"); if (isDomino) { @@ -508,6 +510,8 @@ void destroyTQApp() delete tqApp; tqApp = 0; } + if (windowGC != 0) + gtk_gc_release(windowGC); if (altBackGC != 0) 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) { - static GdkGC* imggc = gdk_gc_new(window); GdkPixmap* pix; // 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; gdk_drawable_get_size(window, &width, &height); 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()); gdk_draw_drawable(window, gc, pix, 0, 0, x, y, w, h); 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, // 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); pix = gdk_pixmap_foreign_new(gpixmap.handle()); 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); 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), button.colorGroup(), sflags); - if (!isBaghira && !isMotif) { + if (!isBaghira && !isMotif && !isCDE) { TQBitmap bitmap(w, h, TRUE); TQPainter bpainter(&bitmap); 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, TQRect(0,0,w,h), button.palette().active(), sflags); - if (!isBaghira && !isMotif) { + if (!isBaghira && !isMotif && !isCDE) { TQBitmap bitmap(w, h, TRUE); TQPainter bpainter(&bitmap); bpainter.setBrush(TQt::color1);