On Thu, Apr 17, 2014 at 1:59 AM, Alexis López Zubieta
<azubi...@estudiantes.uci.cu> wrote:
> Hello:
> I'm trying to port the taskbar and systray plugins of the lxqt-panel to
> QT5.2. Before going to KWindowsSystem I would like to let a working qt5
> version of the panel.
>
> But I'm having a weird trouble with the XLib headers, when those are
> used in a class that inherits from QObject and implements some slots or
> signals it breaks rest of the code. But if the class doesn't have any of
> those (slot or signal) it works well.
>
> I suspect that the Qt headers get corrupted by the macros declared in
> Xlib.h while moc is running. Any idea?
>
> Best
> Alexis López Zubieta
> Nova Light Development Team
> University of Informatics Sciences, Cuba

One thing you should definitely avoid is "including Xlib headers in
our public header files".
There are name clashes between Qt and Xlib, so it's general practice
not to pollute the namespace with X stuff.
Including Xlib headers in our *.cpp implementation files is OK, but
the order of inclusion matters.
Most of the Qt headers need to be put before the Xlib headers.
Some macros defined by Xlib are used by Qt in function and variable names.
So if you put X headers before Qt ones, you'll get "interesting
results" that drives you crazy.
To overcome this problem, the KDE team created a hack called fixx11.h
(is this the correct name?).
You can find file that in kwindowsystem code base.
It's a hack using proper #define, #undef, and other tricks to
workaround the naming clashes.
I had used that file in other projects in the past and it works well.
Please try it.

A better method of porting to Qt5, IMO, is gradually shifting to xcb
rather than staying with Xlib.
Xcb is designed in a way that Xcb and xlib can be safely mixed in the
same program.
Only one of them can pump the event queue of X, but both of them can
access the remaining parts of X.

Cheers!

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Lxde-list mailing list
Lxde-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxde-list

Reply via email to