Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:Backports:SLE-15-SP5
oyranos
0001-Fix-compile-errors-due-to-None-redefinitio...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Fix-compile-errors-due-to-None-redefinition-by-X11-X.patch of Package oyranos
From 1b9acc64f4dab266a44ac2bbf5bf6ad6010bb500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de> Date: Thu, 6 Feb 2020 18:15:46 +0100 Subject: [PATCH] Fix compile errors due to None redefinition by X11/X.h X has a #define None 0L, which leads to compile errors when None is used as an identifier, e.g. enum foo { None, ... }; Move the Xcm.h include to the end so the definition does not affect any other included headers. Also move the Qcmse class to the implementation file, so no X11 headers are needed in qcmsevents.h. --- src/tools/qcmsevents/qcmsevents.cpp | 40 ++++++++++++++- src/tools/qcmsevents/qcmsevents.h | 77 ----------------------------- 2 files changed, 38 insertions(+), 79 deletions(-) diff --git a/src/tools/qcmsevents/qcmsevents.cpp b/src/tools/qcmsevents/qcmsevents.cpp index 74c75b0..75e9519 100644 --- a/src/tools/qcmsevents/qcmsevents.cpp +++ b/src/tools/qcmsevents/qcmsevents.cpp @@ -18,13 +18,15 @@ #include "oyProfile_s.h" #include "oyObject_s.h" -#include <X11/Xcm/Xcm.h> - #include <QAction> #include <QActionGroup> #include <QVBoxLayout> #include <QMenu> +#include <QtX11Extras/QX11Info> +#include <X11/Xcm/XcmEvents.h> +#include <X11/Xcm/Xcm.h> + QcmseDialog * dialog = NULL; QcmseDialog::QcmseDialog() @@ -374,6 +376,40 @@ char * getName ( const void * data, } } +class Qcmse : public QApplication, QAbstractNativeEventFilter +{ + XcmeContext_s * c; + public: + Qcmse(int & argc, char ** argv) : QApplication(argc,argv) + { + c = NULL; + QCoreApplication::eventDispatcher()->installNativeEventFilter( this ); + }; + ~Qcmse() + { + XcmeContext_Release( &c ); + }; + void setup() + { + const char * display_name = getenv("DISPLAY"); + if(QX11Info::isPlatformX11()) + c = XcmeContext_Create( display_name ); + }; + // ask Qt for new arriving events + virtual bool nativeEventFilter(const QByteArray &, void *, long *) Q_DECL_OVERRIDE + { + // use Xlib for Xcm's stand alone X11 context + while(XPending(XcmeContext_DisplayGet( c ))) + { + XEvent event; + XNextEvent( XcmeContext_DisplayGet( c ), &event); + XcmeContext_InLoop( c, &event ); + } + + return false; + }; +}; + int main(int argc, char *argv[]) { Q_INIT_RESOURCE(qcmsevents); diff --git a/src/tools/qcmsevents/qcmsevents.h b/src/tools/qcmsevents/qcmsevents.h index d9c2f4b..9e601ad 100644 --- a/src/tools/qcmsevents/qcmsevents.h +++ b/src/tools/qcmsevents/qcmsevents.h @@ -18,17 +18,9 @@ #include <QWidget> #include <QListWidget> #include <QComboBox> -#if QT_VERSION >= 0x050000 -#include <QtX11Extras/QX11Info> -#else -#include <QtGui/QX11Info> -#endif #include <cstdlib> #include <cstring> -#include <X11/Xcm/XcmEvents.h> -#include <X11/Xcm/Xcm.h> - class QcmseDialog : public QDialog { Q_OBJECT @@ -66,74 +58,5 @@ private slots: extern QcmseDialog * dialog; - - -#if QT_VERSION >= 0x050000 -class Qcmse : public QApplication, QAbstractNativeEventFilter -{ - XcmeContext_s * c; - public: - Qcmse(int & argc, char ** argv) : QApplication(argc,argv) - { - c = NULL; - QCoreApplication::eventDispatcher()->installNativeEventFilter( this ); - }; - ~Qcmse() - { - XcmeContext_Release( &c ); - }; - void setup() - { - const char * display_name = getenv("DISPLAY"); - if(QX11Info::isPlatformX11()) - c = XcmeContext_Create( display_name ); - }; - // ask Qt for new arriving events - virtual bool nativeEventFilter(const QByteArray &, void *, long *) Q_DECL_OVERRIDE - { - // use Xlib for Xcm's stand alone X11 context - while(XPending(XcmeContext_DisplayGet( c ))) - { - XEvent event; - XNextEvent( XcmeContext_DisplayGet( c ), &event); - XcmeContext_InLoop( c, &event ); - } - - return false; - }; -}; -#else /* QT_VERSION >= 0x050000 */ -class Qcmse : public QApplication -{ - XcmeContext_s * c; - public: - Qcmse(int & argc, char ** argv) : QApplication(argc,argv) - { - c = XcmeContext_New( ); - }; - ~Qcmse() - { - XcmeContext_Release( &c ); - }; - void setup() - { - const char * display_name = getenv("DISPLAY"); - QDesktopWidget * d = this->desktop(); - QX11Info i = d->x11Info(); - XcmeContext_DisplaySet( c, i.display() ); - XcmeContext_WindowSet( c, dialog->winId() ); - XcmeContext_Setup( c, display_name ); - }; - bool x11EventFilter( XEvent * event ) - { - /* set the actual X11 Display, Qt seems to change the old pointer. */ - XcmeContext_DisplaySet( c, event->xany.display ); - /* process the X event */ - XcmeContext_InLoop( c, event ); - return false; - }; -}; -#endif /* QT_VERSION >= 0x050000 */ - #endif /* QCMSEVENTS_H */ -- 2.25.0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor