diff options
author | Timothy Pearson <[email protected]> | 2012-11-20 21:08:42 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-11-20 21:08:42 -0600 |
commit | 38b854c89cd8e8f9763b420bdd03908d8e8f4cfc (patch) | |
tree | 8a4801c083731f0cea6ac884bd47e7436a38d2d8 /tdegtk | |
parent | 7bd0369aafb78cfd24e2a33049a21bbc164681e7 (diff) | |
download | gtk3-tqt-engine-38b854c89cd8e8f9763b420bdd03908d8e8f4cfc.tar.gz gtk3-tqt-engine-38b854c89cd8e8f9763b420bdd03908d8e8f4cfc.zip |
Regenerate theme control file if new version of theme engine is installed
Fix scrollbars
Diffstat (limited to 'tdegtk')
-rw-r--r-- | tdegtk/tdegtk-theme.cpp | 72 | ||||
-rw-r--r-- | tdegtk/tqtcairopainter.cpp | 11 |
2 files changed, 42 insertions, 41 deletions
diff --git a/tdegtk/tdegtk-theme.cpp b/tdegtk/tdegtk-theme.cpp index e18e30d..924f7ef 100644 --- a/tdegtk/tdegtk-theme.cpp +++ b/tdegtk/tdegtk-theme.cpp @@ -630,6 +630,39 @@ void writeGtkThemeControlFile(int forceRecreate) { gtk_icon_factory_add_default(factory); } + TQScrollBar sbar(NULL); + sbar.setOrientation(TQt::Horizontal); + sbar.setValue(1); + sbar.resize(200,25); + + // The following code determines how many buttons are on a scrollbar + // It works by looking at each pixel of the scrollbar's area not taken up by the groove, + // and asking the style which subcontrol is at that location. + TQRect rect = tqApp->style().querySubControlMetrics(TQStyle::CC_ScrollBar, &sbar, TQStyle::SC_ScrollBarGroove); + + TQStyle::SubControl sc = TQStyle::SC_None; + for (TQPoint pos(0,7) ; pos.x()<rect.x() ; pos.setX(pos.x()+1)) + { + TQStyle::SubControl sc2 = tqApp->style().querySubControl(TQStyle::CC_ScrollBar, &sbar, pos); + if (sc != sc2) + { + if (sc2 == TQStyle::SC_ScrollBarAddLine) m_scrollbarForward1 = true; + if (sc2 == TQStyle::SC_ScrollBarSubLine) m_scrollbarBack1 = true; + sc = sc2; + } + } + sc = TQStyle::SC_None; + for (TQPoint pos(rect.x()+rect.width(),7) ; pos.x()<200 ; pos.setX(pos.x()+1)) + { + TQStyle::SubControl sc2 = tqApp->style().querySubControl(TQStyle::CC_ScrollBar, &sbar, pos); + if (sc != sc2) + { + if (sc2 == TQStyle::SC_ScrollBarAddLine) m_scrollbarForward2 = true; + if (sc2 == TQStyle::SC_ScrollBarSubLine) m_scrollbarBack2 = true; + sc = sc2; + } + } + // This function takes quite a long time to execute, and is run at the start of every app. // In order to speed it up, we can store the results in a file, along with the name of icon // theme and style. This file can then be regenerated when the icon theme or style change. @@ -664,7 +697,7 @@ void writeGtkThemeControlFile(int forceRecreate) { themeFile.open(IO_ReadOnly); stream.setDevice(TQT_TQIODEVICE(&themeFile)); - if (stream.readLine() == "/* " + iconTheme + ", " + tqApp->style().name() + ", " + RC_CACHE_VERSION + " */") { + if (stream.readLine() == "/* " + iconTheme + ", " + tqApp->style().name() + ", " + RC_CACHE_VERSION + ", " + __DATE__ + ", " + __TIME__ + " */") { // This cache matches the current icon theme and style themeFile.close(); @@ -683,43 +716,10 @@ void writeGtkThemeControlFile(int forceRecreate) { themeFile.open(IO_WriteOnly | IO_Truncate); stream.setDevice(TQT_TQIODEVICE(&themeFile)); - - stream << "/* " << iconTheme << ", " << tqApp->style().name() << ", " << RC_CACHE_VERSION << " */\n\n"; + + stream << "/* " << iconTheme << ", " << tqApp->style().name() << ", " << RC_CACHE_VERSION << ", " << __DATE__ << ", " << __TIME__ << " */\n\n"; stream << "/* This file was generated by the Gtk TQt Theme Engine */\n"; stream << "/* It will be recreated when you change your TDE icon theme or widget style */\n\n"; - - TQScrollBar sbar(NULL); - sbar.setOrientation(TQt::Horizontal); - sbar.setValue(1); - sbar.resize(200,25); - - // The following code determines how many buttons are on a scrollbar - // It works by looking at each pixel of the scrollbar's area not taken up by the groove, - // and asking the style which subcontrol is at that location. - TQRect rect = tqApp->style().querySubControlMetrics(TQStyle::CC_ScrollBar, &sbar, TQStyle::SC_ScrollBarGroove); - - TQStyle::SubControl sc = TQStyle::SC_None; - for (TQPoint pos(0,7) ; pos.x()<rect.x() ; pos.setX(pos.x()+1)) - { - TQStyle::SubControl sc2 = tqApp->style().querySubControl(TQStyle::CC_ScrollBar, &sbar, pos); - if (sc != sc2) - { - if (sc2 == TQStyle::SC_ScrollBarAddLine) m_scrollbarForward1 = true; - if (sc2 == TQStyle::SC_ScrollBarSubLine) m_scrollbarBack1 = true; - sc = sc2; - } - } - sc = TQStyle::SC_None; - for (TQPoint pos(rect.x()+rect.width(),7) ; pos.x()<200 ; pos.setX(pos.x()+1)) - { - TQStyle::SubControl sc2 = tqApp->style().querySubControl(TQStyle::CC_ScrollBar, &sbar, pos); - if (sc != sc2) - { - if (sc2 == TQStyle::SC_ScrollBarAddLine) m_scrollbarForward2 = true; - if (sc2 == TQStyle::SC_ScrollBarSubLine) m_scrollbarBack2 = true; - sc = sc2; - } - } // FIXME // The items in a GTK3 combobox cannot be styled, either to draw them in a custom manner or to change their height diff --git a/tdegtk/tqtcairopainter.cpp b/tdegtk/tqtcairopainter.cpp index 677d9c7..25024ee 100644 --- a/tdegtk/tqtcairopainter.cpp +++ b/tdegtk/tqtcairopainter.cpp @@ -381,11 +381,12 @@ void TQt3CairoPaintDevice::transferIntermediateSurface() { } // Clear intermediate surface - cairo_save(m_painter); - cairo_set_operator(m_painter, CAIRO_OPERATOR_SOURCE); - cairo_set_source_rgba(m_painter, 0.0, 0.0, 0.0, 0.0); - cairo_paint(m_painter); - cairo_restore(m_painter); + cairo_t *clearPainter = cairo_create(m_intermediateSurface); + cairo_set_operator(clearPainter, CAIRO_OPERATOR_SOURCE); + cairo_set_source_rgba(clearPainter, 0.0, 0.0, 0.0, 0.0); + cairo_paint(clearPainter); + cairo_surface_flush(m_intermediateSurface); + cairo_destroy(clearPainter); m_transferNeeded = false; } |