summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2012-11-30 13:14:41 -0600
committerTimothy Pearson <[email protected]>2012-11-30 13:14:41 -0600
commitbeb8adf263fc48b76da0eccba506daa657a16fe3 (patch)
tree1b3e041f71a7950f09ccb67a2d59a3447e22081a
parent791f39d38c9adba16dbe88528b4ad19c217ffb8c (diff)
downloadgtk3-tqt-engine-beb8adf263fc48b76da0eccba506daa657a16fe3.tar.gz
gtk3-tqt-engine-beb8adf263fc48b76da0eccba506daa657a16fe3.zip
Set GTK event passthrough on startup
Fix menu item text highlight color
-rw-r--r--tdegtk/tdegtk-draw.cpp30
-rw-r--r--tdegtk/tdegtk-theme.cpp20
2 files changed, 49 insertions, 1 deletions
diff --git a/tdegtk/tdegtk-draw.cpp b/tdegtk/tdegtk-draw.cpp
index 9d4e8e2..1829289 100644
--- a/tdegtk/tdegtk-draw.cpp
+++ b/tdegtk/tdegtk-draw.cpp
@@ -114,6 +114,20 @@ static TQPalette::ColorGroup gtkToTQPaletteColorGroup(GtkThemingEngine* engine,
return cg;
}
+// Keep this in sync with gtkToTQtColorGroup() above
+static TQColorGroup gtkToTQColorGroup(GtkThemingEngine* engine, GtkStateFlags state, TQPalette &basePalette) {
+ TQColorGroup cg = basePalette.active();
+
+ if (state & GTK_STATE_FLAG_INSENSITIVE) {
+ cg = basePalette.disabled();
+ }
+ else {
+ cg = basePalette.active();
+ }
+
+ return cg;
+}
+
static TQStyle::SFlags gtkToTQtStyleFlags(GtkThemingEngine* engine, GtkStateFlags state, TQt3WidgetType wt, GtkWidget* widget) {
TQStyle::SFlags sflags = TQStyle::Style_Default;
@@ -1141,7 +1155,21 @@ tdegtk_draw_arrow (GtkThemingEngine *engine,
else {
pe = TQStyle::PE_ArrowRight;
}
- tqApp->style().drawPrimitive(pe, p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget));
+
+ TQt3WidgetType tqt3WidgetType = TQT3WT_NONE;
+ TQStringList objectTypes;
+ objectTypes.append(TQWIDGET_OBJECT_NAME_STRING);
+ if ((gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENU)) || (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUITEM))) {
+ GtkWidget* parent(widget?gtk_widget_get_parent(widget):0L);
+ if (!GTK_IS_MENU_BAR(parent)) {
+ objectTypes.clear();
+ objectTypes.append(TQPOPUPMENU_OBJECT_NAME_STRING);
+ tqt3WidgetType = TQT3WT_TQMenuItem;
+ }
+ }
+ TQPalette objectPalette = tqApp->palette(objectTypes);
+
+ tqApp->style().drawPrimitive(pe, p, boundingRect, gtkToTQColorGroup(engine, state, objectPalette), gtkToTQtStyleFlags(engine, state, tqt3WidgetType, widget));
}
if (p) {
diff --git a/tdegtk/tdegtk-theme.cpp b/tdegtk/tdegtk-theme.cpp
index d46fe07..422aa15 100644
--- a/tdegtk/tdegtk-theme.cpp
+++ b/tdegtk/tdegtk-theme.cpp
@@ -86,6 +86,7 @@ extern "C" {
#include <tqregexp.h>
#include <tqfont.h>
#include <tqpopupmenu.h>
+#include <tqeventloop.h>
#include <kapplication.h>
#include <kcmdlineargs.h>
@@ -129,6 +130,14 @@ G_MODULE_EXPORT GtkThemingEngine* create_engine(void) {
KApplication::disableAutoDcopRegistration();
new KApplication(gdk_x11_get_default_xdisplay(), true, 0, 0, true);
+ // Propagate glib events to GTK as needed
+ if (tqApp) {
+ TQEventLoop* loop = tqApp->eventLoop();
+ if (loop) {
+ loop->setSingleToolkitEventHandling(false);
+ }
+ }
+
initTDESettings();
// initialize icon sizes
@@ -481,6 +490,17 @@ void writeGtkThemeControlFile(int forceRecreate) {
// setColour("text", "insensitive", tqApp->palette().disabled().text());
// setColour("base", "insensitive", tqApp->palette().disabled().background());
+ // Menu items
+ {
+ TQStringList objectTypes;
+ objectTypes.append(TQPOPUPMENU_OBJECT_NAME_STRING);
+ TQPalette objectPalette = tqApp->palette(objectTypes);
+ setColour("color", "hover:insensitive", objectPalette.color(TQPalette::Disabled, TQColorGroup::Text), "GtkMenu>GtkMenuItem");
+// setColour("color", "hover:normal", objectPalette.color(TQPalette::Active, TQColorGroup::HighlightedText), "GtkMenu>GtkMenuItem");
+ setColour("color", "hover:active", objectPalette.color(TQPalette::Active, TQColorGroup::HighlightedText), "GtkMenu>GtkMenuItem");
+ setColour("color", "hover", objectPalette.color(TQPalette::Active, TQColorGroup::HighlightedText), "GtkMenu>GtkMenuItem *");
+ }
+
TQString iconSettingsString;
iconSettingsString.append(TQString("gtk-menu=%1,%2").arg(IconSize(KIcon::Small)).arg(IconSize(KIcon::Small)));
iconSettingsString.append(TQString(":gtk-button=%1,%2").arg(IconSize(KIcon::Small)).arg(IconSize(KIcon::Small)));