Review Request 116787: Always create NETEventFilter (a QWidget subclass) in the main application thread

Thomas Lübking thomas.luebking at gmail.com
Fri Mar 14 22:44:28 UTC 2014



> On March 13, 2014, 10:40 p.m., Thomas Lübking wrote:
> > You'll need a drawable, clients will require XInitThreads if that is accessed from a different than the GUI thread, but it might be possible to use an internal Window and move the QObject to the GUI thread on construction.
> 
> Martin Gräßlin wrote:
>     > clients will require XInitThreads
>     
>     Qt does that
> 
> Thomas Lübking wrote:
>     My Qt broken?
>     
>     // gcc -fPIC -o qapplication `pkg-config --libs --cflags Qt5Widgets` -lstdc++ qapplication.cpp
>     
>     #include <QApplication>
>     #include <QWidget>
>     #include <QtDebug>
>     
>     class Widget : public QWidget {
>     public:
>         Widget() : QWidget() {}
>     protected:
>         virtual void showEvent(QShowEvent *ev) {
>             qDebug() << QCoreApplication::testAttribute(Qt::AA_X11InitThreads);
>             QWidget::showEvent(ev);
>         }
>     };
>     
>     int main(int argc, char **argv)
>     {
>         QApplication a(argc, argv);
>         Widget w;
>         w.show();
>         return a.exec();
>     }
>     
>     --------
>     Prints false (as i frankly expected ...)
> 
> Martin Gräßlin wrote:
>     might be the attribute is broken. Look at https://qt.gitorious.org/qt/qtbase/source/45f264b682e0b2ad7a162bd75b702837fe04c06a:src/plugins/platforms/xcb/qxcbintegration.cpp#L131 - it's clearly called

Seems to be Qt4 stuff only (and not marked deprecated in the API doc...  tss) - at least according to lxr.kde.org it's only in the namespace header of Qt5, but it's clearly invoked as condition in qapplication_x11.cpp on Qt4

So yes - as long as xcb has xlib support (;-) XInitThreads is called for every Qt5 application.


- Thomas


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/116787/#review52915
-----------------------------------------------------------


On March 14, 2014, 10:36 a.m., Aaron J. Seigo wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/116787/
> -----------------------------------------------------------
> 
> (Updated March 14, 2014, 10:36 a.m.)
> 
> 
> Review request for KDE Frameworks, kwin and Martin Gräßlin.
> 
> 
> Repository: kwindowsystem
> 
> 
> Description
> -------
> 
> When using KWindowInfo from a thread other than the main application thread, the application fails on an assert triggered by creating a QWidget in another thread. This is due to NETEventFilter being a QWidget. This patch addresses the issue by using a QObject to create the NETEventFilter, which is itself first moved to the main application thread. 
> 
> 
> Diffs
> -----
> 
>   src/kwindowsystem.cpp 4c17baa 
>   src/kwindowsystem_p_x11.h 75f3028 
>   src/kwindowsystem_x11.cpp 95c396b 
> 
> Diff: https://git.reviewboard.kde.org/r/116787/diff/
> 
> 
> Testing
> -------
> 
> Used in the Sprinter Windows plugin and works lovely to find desktops, windows, etc.
> 
> 
> Thanks,
> 
> Aaron J. Seigo
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20140314/1240d47e/attachment-0001.html>


More information about the Kde-frameworks-devel mailing list