[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    [PATCH] #83974 - incorrect WM_CLASS in Konsole
From:       Lubos Lunak <l.lunak () suse ! cz>
Date:       2004-07-30 15:33:45
Message-ID: 200407301733.46219.l.lunak () suse ! cz
[Download RAW message or body]

Hello,

 currently command-line arguments parsing, taskbar grouping or kwin's window 
specific settings don't work for Konsole, because of the way the support for 
real transparency is implemented. The attached Konsole patch is a hack fixing 
the WM_CLASS property, but I don't see anything that could be done about 
qAppName() or the arguments parsing other than changing Qt.

 Fredrik, has this been reported to TT, will Qt4 have some support for the 
ARGB visual? The qt_init* code in the Qt4 preview looks the same like in Qt3 
to me.

-- 
Lubos Lunak
KDE developer
---------------------------------------------------------------------
SuSE CR, s.r.o.  e-mail: l.lunak@suse.cz , l.lunak@kde.org
Drahobejlova 27  tel: +420 2 9654 2373
190 00 Praha 9   fax: +420 2 9654 2374
Czech Republic   http://www.suse.cz/

["main.cpp.patch" (text/x-diff)]

--- main.cpp.sav	2004-07-13 16:17:28.000000000 +0200
+++ main.cpp	2004-07-30 17:23:20.658828632 +0200
@@ -146,7 +146,34 @@ public:
     Konsole *konsole;
 };
 
+#ifdef COMPOSITE
+// Hack for #83974. Since Qt gets passed XDisplay* from Konsole, it thinks Qt is \
used +// in a foreign app, doesn't parse command-line arguments, and uses weird \
values +// for qAppName()/qAppClass()/WM_CLASS. This at least fixes the WM_CLASS \
property, +// making e.g. taskbar grouping work.
+class KonsoleApplication : public KApplication {
+    public:
+        KonsoleApplication(Display *display, Qt::HANDLE visual = 0, Qt::HANDLE \
colormap = 0, +               bool allowStyles=true)
+               : KApplication( display, visual, colormap, allowStyles )
+               {}
+        virtual bool notify( QObject*, QEvent* );
+};
 
+bool KonsoleApplication::notify( QObject* receiver, QEvent* event ) {
+    if(( event->type() == QEvent::Show || event->type() == QEvent::Reparent )
+        && receiver->isWidgetType()) {
+        QWidget* w = static_cast< QWidget* >( receiver );
+        if( w->isTopLevel() && !w->testWFlags( WX11BypassWM ) && !w->isPopup() && \
!event->spontaneous()) { +            XClassHint hint;
+            hint.res_class = const_cast< char* >( "Konsole" );
+            hint.res_name = const_cast< char* >( "konsole" );
+            XSetClassHint( qt_xdisplay(), w->winId(), &hint );
+        }
+    }
+    return KApplication::notify( receiver, event );
+}
+#endif
 
 /* --| main |------------------------------------------------------ */
 extern "C" int kdemain(int argc, char* argv[])
@@ -269,7 +296,7 @@ extern "C" int kdemain(int argc, char* a
     }
   }
 
-  KApplication a( dpy, Qt::HANDLE( visual ), Qt::HANDLE( colormap ) );
+  KonsoleApplication a( dpy, Qt::HANDLE( visual ), Qt::HANDLE( colormap ) );
 #else
   KApplication a;
 #endif



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic