From a0a9818d896bd01aa2eba5fddeb5fcf1ff3b98cc Mon Sep 17 00:00:00 2001
From: J-P Nurmi <jpnurmi@gmail.com>
Date: Thu, 1 Aug 2013 21:54:47 +0200
Subject: [PATCH] Simplify the event types

Dedicated classes for parameterless event types and pimpl in
event classes is overkill. Following the QEvent conventions,
some "int/void* reserved" can be added if felt necessary.

Change-Id: Ie5536dd8c68333be07ebae13ac5c74129236e9df
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
---
 .../winextras/qquickwindwmfeatures.cpp        |  7 +-
 .../qwincolorizationcolorchangeevent.cpp      | 88 -------------------
 .../qwincolorizationcolorchangeevent_p.h      | 63 -------------
 .../qwincompositionstatechangeevent.cpp       | 80 -----------------
 .../qwincompositionstatechangeevent.h         | 69 ---------------
 .../qwincompositionstatechangeevent_p.h       | 62 -------------
 ...arbuttoncreatedevent.cpp => qwinevent.cpp} | 32 ++++---
 ...rizationcolorchangeevent.h => qwinevent.h} | 50 +++++++----
 src/winextras/qwineventfilter.cpp             | 16 ++--
 src/winextras/qwintaskbarbutton.cpp           |  4 +-
 src/winextras/qwintaskbarbuttoncreatedevent.h | 68 --------------
 .../qwintaskbarbuttoncreatedevent_p.h         | 60 -------------
 src/winextras/qwinthemechangeevent.cpp        | 67 --------------
 src/winextras/qwinthemechangeevent.h          | 69 ---------------
 src/winextras/qwinthemechangeevent_p.h        | 56 ------------
 src/winextras/qwinthumbnailtoolbar.cpp        |  4 +-
 src/winextras/winextras.pro                   | 18 +---
 17 files changed, 72 insertions(+), 741 deletions(-)
 delete mode 100644 src/winextras/qwincolorizationcolorchangeevent.cpp
 delete mode 100644 src/winextras/qwincolorizationcolorchangeevent_p.h
 delete mode 100644 src/winextras/qwincompositionstatechangeevent.cpp
 delete mode 100644 src/winextras/qwincompositionstatechangeevent.h
 delete mode 100644 src/winextras/qwincompositionstatechangeevent_p.h
 rename src/winextras/{qwintaskbarbuttoncreatedevent.cpp => qwinevent.cpp} (70%)
 rename src/winextras/{qwincolorizationcolorchangeevent.h => qwinevent.h} (67%)
 delete mode 100644 src/winextras/qwintaskbarbuttoncreatedevent.h
 delete mode 100644 src/winextras/qwintaskbarbuttoncreatedevent_p.h
 delete mode 100644 src/winextras/qwinthemechangeevent.cpp
 delete mode 100644 src/winextras/qwinthemechangeevent.h
 delete mode 100644 src/winextras/qwinthemechangeevent_p.h

diff --git a/src/imports/winextras/qquickwindwmfeatures.cpp b/src/imports/winextras/qquickwindwmfeatures.cpp
index c0dd00d..90f13a2 100644
--- a/src/imports/winextras/qquickwindwmfeatures.cpp
+++ b/src/imports/winextras/qquickwindwmfeatures.cpp
@@ -43,8 +43,7 @@
 #include "qquickwindwmfeatures_p.h"
 
 #include <QtWinExtras/private/qwineventfilter_p.h>
-#include <QWinColorizationColorChangeEvent>
-#include <QWinCompositionStateChangeEvent>
+#include <QWinEvent>
 #include <QQuickWindow>
 
 QT_BEGIN_NAMESPACE
@@ -248,10 +247,10 @@ bool QQuickWinDwmFeatures::eventFilter(QObject *object, QEvent *event)
 {
     bool filterOut = false;
     if (object == window()) {
-        if (event->type() == QWinCompositionStateChangeEvent::eventType()) {
+        if (event->type() == QWinEvent::CompositionChange) {
             emit isCompositionEnabledChanged();
             filterOut = true;
-        } else if (event->type() == QWinColorizationColorChangeEvent::eventType()) {
+        } else if (event->type() == QWinEvent::ColorizationChange) {
             emit colorizationColorChanged();
             emit realColorizationColorChanged();
             emit colorizationOpaqueBlendChanged();
diff --git a/src/winextras/qwincolorizationcolorchangeevent.cpp b/src/winextras/qwincolorizationcolorchangeevent.cpp
deleted file mode 100644
index a958b3d..0000000
--- a/src/winextras/qwincolorizationcolorchangeevent.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2013 Ivan Vizir <define-true-false@yandex.com>
- ** Contact: http://www.qt-project.org/legal
- **
- ** This file is part of QtWinExtras in the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:LGPL$
- ** Commercial License Usage
- ** Licensees holding valid commercial Qt licenses may use this file in
- ** accordance with the commercial license agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.  For licensing terms and
- ** conditions see http://qt.digia.com/licensing.  For further information
- ** use the contact form at http://qt.digia.com/contact-us.
- **
- ** GNU Lesser General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file.  Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
- **
- ** In addition, as a special exception, Digia gives you certain additional
- ** rights.  These rights are described in the Digia Qt LGPL Exception
- ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
- **
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file.  Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#include "qwincolorizationcolorchangeevent.h"
-#include "qwincolorizationcolorchangeevent_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QWinColorizationColorChangeEvent::QWinColorizationColorChangeEvent(QRgb color, bool opaque) :
-    QEvent(QWinColorizationColorChangeEventPrivate::eventType()),
-    d_ptr(new QWinColorizationColorChangeEventPrivate)
-{
-    Q_D(QWinColorizationColorChangeEvent);
-    d->color = color;
-    d->opaqueBlend = opaque;
-}
-
-QWinColorizationColorChangeEvent::~QWinColorizationColorChangeEvent()
-{
-}
-
-bool QWinColorizationColorChangeEvent::opaqueBlend() const
-{
-    Q_D(const QWinColorizationColorChangeEvent);
-    return d->opaqueBlend;
-}
-
-QRgb QWinColorizationColorChangeEvent::color() const
-{
-    Q_D(const QWinColorizationColorChangeEvent);
-    return d->color;
-}
-
-QEvent::Type QWinColorizationColorChangeEvent::eventType()
-{
-    return QWinColorizationColorChangeEventPrivate::eventType();
-}
-
-
-
-int QWinColorizationColorChangeEventPrivate::eventTypeId = 0;
-
-QEvent::Type QWinColorizationColorChangeEventPrivate::eventType()
-{
-    if (!eventTypeId)
-        eventTypeId = QEvent::registerEventType();
-    return static_cast<QEvent::Type>(eventTypeId);
-}
-
-QT_END_NAMESPACE
diff --git a/src/winextras/qwincolorizationcolorchangeevent_p.h b/src/winextras/qwincolorizationcolorchangeevent_p.h
deleted file mode 100644
index df85ad7..0000000
--- a/src/winextras/qwincolorizationcolorchangeevent_p.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2013 Ivan Vizir <define-true-false@yandex.com>
- ** Contact: http://www.qt-project.org/legal
- **
- ** This file is part of QtWinExtras in the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:LGPL$
- ** Commercial License Usage
- ** Licensees holding valid commercial Qt licenses may use this file in
- ** accordance with the commercial license agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.  For licensing terms and
- ** conditions see http://qt.digia.com/licensing.  For further information
- ** use the contact form at http://qt.digia.com/contact-us.
- **
- ** GNU Lesser General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file.  Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
- **
- ** In addition, as a special exception, Digia gives you certain additional
- ** rights.  These rights are described in the Digia Qt LGPL Exception
- ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
- **
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file.  Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#ifndef QWINCOLORIZATIONCOLORCHANGEEVENT_P_H
-#define QWINCOLORIZATIONCOLORCHANGEEVENT_P_H
-
-#include "qwincolorizationcolorchangeevent.h"
-
-QT_BEGIN_NAMESPACE
-
-class QWinColorizationColorChangeEventPrivate
-{
-public:
-    static QEvent::Type eventType();
-
-    bool opaqueBlend;
-    QRgb color;
-
-private:
-    static int eventTypeId;
-};
-
-QT_END_NAMESPACE
-
-#endif // QWINCOLORIZATIONCOLORCHANGEEVENT_P_H
diff --git a/src/winextras/qwincompositionstatechangeevent.cpp b/src/winextras/qwincompositionstatechangeevent.cpp
deleted file mode 100644
index 4eec606..0000000
--- a/src/winextras/qwincompositionstatechangeevent.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2013 Ivan Vizir <define-true-false@yandex.com>
- ** Contact: http://www.qt-project.org/legal
- **
- ** This file is part of QtWinExtras in the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:LGPL$
- ** Commercial License Usage
- ** Licensees holding valid commercial Qt licenses may use this file in
- ** accordance with the commercial license agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.  For licensing terms and
- ** conditions see http://qt.digia.com/licensing.  For further information
- ** use the contact form at http://qt.digia.com/contact-us.
- **
- ** GNU Lesser General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file.  Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
- **
- ** In addition, as a special exception, Digia gives you certain additional
- ** rights.  These rights are described in the Digia Qt LGPL Exception
- ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
- **
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file.  Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#include "qwincompositionstatechangeevent.h"
-#include "qwincompositionstatechangeevent_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QWinCompositionStateChangeEvent::QWinCompositionStateChangeEvent(bool enabled) :
-    QEvent(QWinCompositionStateChangeEventPrivate::eventType()), d_ptr(new QWinCompositionStateChangeEventPrivate)
-{
-    Q_D(QWinCompositionStateChangeEvent);
-    d->enabled = enabled;
-}
-
-QWinCompositionStateChangeEvent::~QWinCompositionStateChangeEvent()
-{
-}
-
-bool QWinCompositionStateChangeEvent::isCompositionEnabled() const
-{
-    Q_D(const QWinCompositionStateChangeEvent);
-    return d->enabled;
-}
-
-QEvent::Type QWinCompositionStateChangeEvent::eventType()
-{
-    return QWinCompositionStateChangeEventPrivate::eventType();
-}
-
-
-
-int QWinCompositionStateChangeEventPrivate::eventTypeId = 0;
-
-QEvent::Type QWinCompositionStateChangeEventPrivate::eventType()
-{
-    if (!eventTypeId)
-        eventTypeId = QEvent::registerEventType();
-    return static_cast<QEvent::Type>(eventTypeId);
-}
-
-QT_END_NAMESPACE
diff --git a/src/winextras/qwincompositionstatechangeevent.h b/src/winextras/qwincompositionstatechangeevent.h
deleted file mode 100644
index 43c0cf4..0000000
--- a/src/winextras/qwincompositionstatechangeevent.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2013 Ivan Vizir <define-true-false@yandex.com>
- ** Contact: http://www.qt-project.org/legal
- **
- ** This file is part of QtWinExtras in the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:LGPL$
- ** Commercial License Usage
- ** Licensees holding valid commercial Qt licenses may use this file in
- ** accordance with the commercial license agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.  For licensing terms and
- ** conditions see http://qt.digia.com/licensing.  For further information
- ** use the contact form at http://qt.digia.com/contact-us.
- **
- ** GNU Lesser General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file.  Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
- **
- ** In addition, as a special exception, Digia gives you certain additional
- ** rights.  These rights are described in the Digia Qt LGPL Exception
- ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
- **
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file.  Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#ifndef QWINCOMPOSITIONSTATECHANGEEVENT_H
-#define QWINCOMPOSITIONSTATECHANGEEVENT_H
-
-#include <QtWinExtras/qwinextrasglobal.h>
-#include <QEvent>
-#include <QScopedPointer>
-
-QT_BEGIN_NAMESPACE
-
-class QWinCompositionStateChangeEventPrivate;
-
-class Q_WINEXTRAS_EXPORT QWinCompositionStateChangeEvent : public QEvent
-{
-public:
-    explicit QWinCompositionStateChangeEvent(bool isCompositionEnabled);
-    ~QWinCompositionStateChangeEvent();
-    bool isCompositionEnabled() const;
-
-    static QEvent::Type eventType();
-
-private:
-    QScopedPointer<QWinCompositionStateChangeEventPrivate> d_ptr;
-    Q_DECLARE_PRIVATE(QWinCompositionStateChangeEvent)
-};
-
-QT_END_NAMESPACE
-
-#endif // QWINCOMPOSITIONSTATECHANGEEVENT_H
diff --git a/src/winextras/qwincompositionstatechangeevent_p.h b/src/winextras/qwincompositionstatechangeevent_p.h
deleted file mode 100644
index c8b1d6f..0000000
--- a/src/winextras/qwincompositionstatechangeevent_p.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2013 Ivan Vizir <define-true-false@yandex.com>
- ** Contact: http://www.qt-project.org/legal
- **
- ** This file is part of QtWinExtras in the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:LGPL$
- ** Commercial License Usage
- ** Licensees holding valid commercial Qt licenses may use this file in
- ** accordance with the commercial license agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.  For licensing terms and
- ** conditions see http://qt.digia.com/licensing.  For further information
- ** use the contact form at http://qt.digia.com/contact-us.
- **
- ** GNU Lesser General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file.  Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
- **
- ** In addition, as a special exception, Digia gives you certain additional
- ** rights.  These rights are described in the Digia Qt LGPL Exception
- ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
- **
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file.  Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#ifndef QWINCOMPOSITIONSTATECHANGEEVENTPRIVATE_H
-#define QWINCOMPOSITIONSTATECHANGEEVENTPRIVATE_H
-
-#include "qwincolorizationcolorchangeevent.h"
-
-QT_BEGIN_NAMESPACE
-
-class QWinCompositionStateChangeEventPrivate
-{
-public:
-    static QEvent::Type eventType();
-
-    bool enabled;
-
-private:
-    static int eventTypeId;
-};
-
-QT_END_NAMESPACE
-
-#endif // QWINCOMPOSITIONSTATECHANGEEVENTPRIVATE_H
diff --git a/src/winextras/qwintaskbarbuttoncreatedevent.cpp b/src/winextras/qwinevent.cpp
similarity index 70%
rename from src/winextras/qwintaskbarbuttoncreatedevent.cpp
rename to src/winextras/qwinevent.cpp
index 5ea9a62..50cd1cd 100644
--- a/src/winextras/qwintaskbarbuttoncreatedevent.cpp
+++ b/src/winextras/qwinevent.cpp
@@ -1,6 +1,7 @@
 /****************************************************************************
  **
  ** Copyright (C) 2013 Ivan Vizir <define-true-false@yandex.com>
+ ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
  ** Contact: http://www.qt-project.org/legal
  **
  ** This file is part of QtWinExtras in the Qt Toolkit.
@@ -39,28 +40,35 @@
  **
  ****************************************************************************/
 
-#include "qwintaskbarbuttoncreatedevent.h"
-#include "qwintaskbarbuttoncreatedevent_p.h"
+#include "qwinevent.h"
 
-QWinTaskbarButtonCreatedEvent::QWinTaskbarButtonCreatedEvent() :
-    QEvent(QWinTaskbarButtonCreatedEventPrivate::eventType())
+const int QWinEvent::ColorizationChange = QEvent::registerEventType();
+const int QWinEvent::CompositionChange = QEvent::registerEventType();
+const int QWinEvent::TaskbarButtonCreated = QEvent::registerEventType();
+const int QWinEvent::ThemeChange = QEvent::registerEventType();
+
+QWinEvent::QWinEvent(int type) : QEvent(static_cast<QEvent::Type>(type))
+{
+}
+
+QWinEvent::~QWinEvent()
 {
 }
 
-QWinTaskbarButtonCreatedEvent::~QWinTaskbarButtonCreatedEvent()
+QWinColorizationChangeEvent::QWinColorizationChangeEvent(QRgb color, bool opaque)
+    : QWinEvent(ColorizationChange), rgb(color), opaque(opaque)
 {
 }
 
-QEvent::Type QWinTaskbarButtonCreatedEvent::eventType()
+QWinColorizationChangeEvent::~QWinColorizationChangeEvent()
 {
-    return QWinTaskbarButtonCreatedEventPrivate::eventType();
 }
 
-int QWinTaskbarButtonCreatedEventPrivate::eventTypeId = 0;
+QWinCompositionChangeEvent::QWinCompositionChangeEvent(bool enabled)
+    : QWinEvent(CompositionChange), enabled(enabled)
+{
+}
 
-QEvent::Type QWinTaskbarButtonCreatedEventPrivate::eventType()
+QWinCompositionChangeEvent::~QWinCompositionChangeEvent()
 {
-    if (!eventTypeId)
-        eventTypeId = QEvent::registerEventType();
-    return static_cast<QEvent::Type>(eventTypeId);
 }
diff --git a/src/winextras/qwincolorizationcolorchangeevent.h b/src/winextras/qwinevent.h
similarity index 67%
rename from src/winextras/qwincolorizationcolorchangeevent.h
rename to src/winextras/qwinevent.h
index a018591..9fc529d 100644
--- a/src/winextras/qwincolorizationcolorchangeevent.h
+++ b/src/winextras/qwinevent.h
@@ -1,6 +1,7 @@
 /****************************************************************************
  **
  ** Copyright (C) 2013 Ivan Vizir <define-true-false@yandex.com>
+ ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
  ** Contact: http://www.qt-project.org/legal
  **
  ** This file is part of QtWinExtras in the Qt Toolkit.
@@ -39,34 +40,53 @@
  **
  ****************************************************************************/
 
-#ifndef QWINCOLORIZATIONCOLORCHANGEEVENT_H
-#define QWINCOLORIZATIONCOLORCHANGEEVENT_H
+#ifndef QWINEVENT_H
+#define QWINEVENT_H
 
+#include <QtGui/qrgb.h>
+#include <QtCore/qcoreevent.h>
 #include <QtWinExtras/qwinextrasglobal.h>
-#include <QEvent>
-#include <QScopedPointer>
-#include <QRgb>
 
 QT_BEGIN_NAMESPACE
 
-class QWinColorizationColorChangeEventPrivate;
+class Q_WINEXTRAS_EXPORT QWinEvent : public QEvent
+{
+public:
+    static const int ColorizationChange;
+    static const int CompositionChange;
+    static const int TaskbarButtonCreated;
+    static const int ThemeChange;
 
-class Q_WINEXTRAS_EXPORT QWinColorizationColorChangeEvent : public QEvent
+    explicit QWinEvent(int type);
+    ~QWinEvent();
+};
+
+class Q_WINEXTRAS_EXPORT QWinColorizationChangeEvent : public QWinEvent
 {
 public:
-    QWinColorizationColorChangeEvent(QRgb color, bool opaque);
-    ~QWinColorizationColorChangeEvent();
-    bool opaqueBlend() const;
-    QRgb color() const;
+    QWinColorizationChangeEvent(QRgb color, bool opaque);
+    ~QWinColorizationChangeEvent();
 
-    static QEvent::Type eventType();
+    inline QRgb color() const { return rgb; }
+    inline bool opaqueBlend() const { return opaque; }
 
 private:
-    QScopedPointer<QWinColorizationColorChangeEventPrivate> d_ptr;
+    QRgb rgb;
+    bool opaque;
+};
 
-    Q_DECLARE_PRIVATE(QWinColorizationColorChangeEvent)
+class Q_WINEXTRAS_EXPORT QWinCompositionChangeEvent : public QWinEvent
+{
+public:
+    explicit QWinCompositionChangeEvent(bool enabled);
+    ~QWinCompositionChangeEvent();
+
+    inline bool isCompositionEnabled() const { return enabled; }
+
+private:
+    bool enabled;
 };
 
 QT_END_NAMESPACE
 
-#endif // QWINCOLORIZATIONCOLORCHANGEEVENT_H
+#endif // QWINEVENT_H
diff --git a/src/winextras/qwineventfilter.cpp b/src/winextras/qwineventfilter.cpp
index 20c4c35..992ba9d 100644
--- a/src/winextras/qwineventfilter.cpp
+++ b/src/winextras/qwineventfilter.cpp
@@ -40,11 +40,8 @@
  ****************************************************************************/
 
 #include "qwineventfilter_p.h"
-#include "qwincolorizationcolorchangeevent.h"
-#include "qwincompositionstatechangeevent.h"
-#include "qwinthemechangeevent.h"
-#include "qwintaskbarbuttoncreatedevent.h"
 #include "qwinfunctions.h"
+#include "qwinevent.h"
 #include <QGuiApplication>
 #include <QWindow>
 
@@ -77,17 +74,17 @@ bool QWinEventFilter::nativeEventFilter(const QByteArray &, void *message, long
     QWindow *window = 0;
     switch (msg->message) {
     case WM_DWMCOLORIZATIONCOLORCHANGED :
-        event = new QWinColorizationColorChangeEvent(msg->wParam, msg->lParam);
+        event = new QWinColorizationChangeEvent(msg->wParam, msg->lParam);
         break;
     case WM_DWMCOMPOSITIONCHANGED :
-        event = new QWinCompositionStateChangeEvent(QWinExtras::isCompositionEnabled());
+        event = new QWinCompositionChangeEvent(QWinExtras::isCompositionEnabled());
         break;
     case WM_THEMECHANGED :
-        event = new QWinThemeChangeEvent();
+        event = new QWinEvent(QWinEvent::ThemeChange);
         break;
     default :
         if (tbButtonCreatedMsgId == msg->message) {
-            event = new QWinTaskbarButtonCreatedEvent;
+            event = new QWinEvent(QWinEvent::TaskbarButtonCreated);
             filterOut = true;
         }
         break;
@@ -97,8 +94,7 @@ bool QWinEventFilter::nativeEventFilter(const QByteArray &, void *message, long
         window = findWindow(msg->hwnd);
         if (window)
             qApp->sendEvent(window, event);
-        else
-            delete event;
+        delete event;
     }
 
     if (filterOut && result) {
diff --git a/src/winextras/qwintaskbarbutton.cpp b/src/winextras/qwintaskbarbutton.cpp
index 651a0ec..50786f5 100644
--- a/src/winextras/qwintaskbarbutton.cpp
+++ b/src/winextras/qwintaskbarbutton.cpp
@@ -43,7 +43,7 @@
 #include "qwintaskbarbutton_p.h"
 #include "qwinfunctions.h"
 #include "qwineventfilter_p.h"
-#include "qwintaskbarbuttoncreatedevent.h"
+#include "qwinevent.h"
 
 #include <QWindow>
 #include <QIcon>
@@ -186,7 +186,7 @@ int QWinTaskbarButton::progressMaximum() const
 bool QWinTaskbarButton::eventFilter(QObject *object, QEvent *event)
 {
     Q_D(QWinTaskbarButton);
-    if (object == d->window && event->type() == QWinTaskbarButtonCreatedEvent::eventType()) {
+    if (object == d->window && event->type() == QWinEvent::TaskbarButtonCreated) {
         d->pTbList->SetProgressState(d->handle(), QWinTaskbarButtonPrivate::nativeProgressState(d->progressState));
         d->updateProgressValue();
         d->updateOverlayIcon();
diff --git a/src/winextras/qwintaskbarbuttoncreatedevent.h b/src/winextras/qwintaskbarbuttoncreatedevent.h
deleted file mode 100644
index 17965c9..0000000
--- a/src/winextras/qwintaskbarbuttoncreatedevent.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2013 Ivan Vizir <define-true-false@yandex.com>
- ** Contact: http://www.qt-project.org/legal
- **
- ** This file is part of QtWinExtras in the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:LGPL$
- ** Commercial License Usage
- ** Licensees holding valid commercial Qt licenses may use this file in
- ** accordance with the commercial license agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.  For licensing terms and
- ** conditions see http://qt.digia.com/licensing.  For further information
- ** use the contact form at http://qt.digia.com/contact-us.
- **
- ** GNU Lesser General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file.  Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
- **
- ** In addition, as a special exception, Digia gives you certain additional
- ** rights.  These rights are described in the Digia Qt LGPL Exception
- ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
- **
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file.  Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#ifndef QWINTASKBARBUTTONCREATEDEVENT_H
-#define QWINTASKBARBUTTONCREATEDEVENT_H
-
-#include <QEvent>
-#include <QScopedPointer>
-
-QT_BEGIN_NAMESPACE
-
-class QWinTaskbarButtonCreatedEventPrivate;
-
-class QWinTaskbarButtonCreatedEvent : public QEvent
-{
-public:
-    QWinTaskbarButtonCreatedEvent();
-    ~QWinTaskbarButtonCreatedEvent();
-
-    static QEvent::Type eventType();
-
-private:
-    QScopedPointer<QWinTaskbarButtonCreatedEventPrivate> d_ptr;
-
-    Q_DECLARE_PRIVATE(QWinTaskbarButtonCreatedEvent)
-};
-
-QT_END_NAMESPACE
-
-#endif // QWINTASKBARBUTTONCREATEDEVENT_H
diff --git a/src/winextras/qwintaskbarbuttoncreatedevent_p.h b/src/winextras/qwintaskbarbuttoncreatedevent_p.h
deleted file mode 100644
index 54ea4e9..0000000
--- a/src/winextras/qwintaskbarbuttoncreatedevent_p.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2013 Ivan Vizir <define-true-false@yandex.com>
- ** Contact: http://www.qt-project.org/legal
- **
- ** This file is part of QtWinExtras in the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:LGPL$
- ** Commercial License Usage
- ** Licensees holding valid commercial Qt licenses may use this file in
- ** accordance with the commercial license agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.  For licensing terms and
- ** conditions see http://qt.digia.com/licensing.  For further information
- ** use the contact form at http://qt.digia.com/contact-us.
- **
- ** GNU Lesser General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file.  Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
- **
- ** In addition, as a special exception, Digia gives you certain additional
- ** rights.  These rights are described in the Digia Qt LGPL Exception
- ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
- **
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file.  Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#ifndef QWINTASKBARBUTTONCREATEDEVENT_P_H
-#define QWINTASKBARBUTTONCREATEDEVENT_P_H
-
-#include "qwintaskbarbuttoncreatedevent.h"
-
-QT_BEGIN_NAMESPACE
-
-class QWinTaskbarButtonCreatedEventPrivate
-{
-public:
-    static QEvent::Type eventType();
-
-private:
-    static int eventTypeId;
-};
-
-QT_END_NAMESPACE
-
-#endif // QWINTASKBARBUTTONCREATEDEVENT_P_H
diff --git a/src/winextras/qwinthemechangeevent.cpp b/src/winextras/qwinthemechangeevent.cpp
deleted file mode 100644
index e9eeb63..0000000
--- a/src/winextras/qwinthemechangeevent.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2013 Ivan Vizir <define-true-false@yandex.com>
- ** Contact: http://www.qt-project.org/legal
- **
- ** This file is part of QtWinExtras in the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:LGPL$
- ** Commercial License Usage
- ** Licensees holding valid commercial Qt licenses may use this file in
- ** accordance with the commercial license agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.  For licensing terms and
- ** conditions see http://qt.digia.com/licensing.  For further information
- ** use the contact form at http://qt.digia.com/contact-us.
- **
- ** GNU Lesser General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file.  Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
- **
- ** In addition, as a special exception, Digia gives you certain additional
- ** rights.  These rights are described in the Digia Qt LGPL Exception
- ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
- **
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file.  Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#include "qwinthemechangeevent.h"
-#include "qwinthemechangeevent_p.h"
-
-QWinThemeChangeEvent::QWinThemeChangeEvent() :
-    QEvent(eventType())
-{
-}
-
-QWinThemeChangeEvent::~QWinThemeChangeEvent()
-{
-}
-
-QEvent::Type QWinThemeChangeEvent::eventType()
-{
-    return QWinThemeChangeEventPrivate::eventType();
-}
-
-
-int QWinThemeChangeEventPrivate::eventTypeId = 0;
-
-QEvent::Type QWinThemeChangeEventPrivate::eventType()
-{
-    if (!eventTypeId)
-        eventTypeId = QEvent::registerEventType();
-    return static_cast<QEvent::Type>(eventTypeId);
-}
diff --git a/src/winextras/qwinthemechangeevent.h b/src/winextras/qwinthemechangeevent.h
deleted file mode 100644
index 63c6c38..0000000
--- a/src/winextras/qwinthemechangeevent.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2013 Ivan Vizir <define-true-false@yandex.com>
- ** Contact: http://www.qt-project.org/legal
- **
- ** This file is part of QtWinExtras in the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:LGPL$
- ** Commercial License Usage
- ** Licensees holding valid commercial Qt licenses may use this file in
- ** accordance with the commercial license agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.  For licensing terms and
- ** conditions see http://qt.digia.com/licensing.  For further information
- ** use the contact form at http://qt.digia.com/contact-us.
- **
- ** GNU Lesser General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file.  Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
- **
- ** In addition, as a special exception, Digia gives you certain additional
- ** rights.  These rights are described in the Digia Qt LGPL Exception
- ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
- **
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file.  Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#ifndef QWINTHEMECHANGEEVENT_H
-#define QWINTHEMECHANGEEVENT_H
-
-#include <QtWinExtras/qwinextrasglobal.h>
-#include <QEvent>
-#include <QScopedPointer>
-
-QT_BEGIN_NAMESPACE
-
-class QWinThemeChangeEventPrivate;
-
-class Q_WINEXTRAS_EXPORT QWinThemeChangeEvent : public QEvent
-{
-public:
-    QWinThemeChangeEvent();
-    ~QWinThemeChangeEvent();
-
-    static QEvent::Type eventType();
-
-private:
-    QScopedPointer<QWinThemeChangeEventPrivate> d_ptr;
-
-    Q_DECLARE_PRIVATE(QWinThemeChangeEvent)
-};
-
-QT_END_NAMESPACE
-
-#endif // QWINTHEMECHANGEEVENT_H
diff --git a/src/winextras/qwinthemechangeevent_p.h b/src/winextras/qwinthemechangeevent_p.h
deleted file mode 100644
index 62ada0a..0000000
--- a/src/winextras/qwinthemechangeevent_p.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/****************************************************************************
- **
- ** Copyright (C) 2013 Ivan Vizir <define-true-false@yandex.com>
- ** Contact: http://www.qt-project.org/legal
- **
- ** This file is part of QtWinExtras in the Qt Toolkit.
- **
- ** $QT_BEGIN_LICENSE:LGPL$
- ** Commercial License Usage
- ** Licensees holding valid commercial Qt licenses may use this file in
- ** accordance with the commercial license agreement provided with the
- ** Software or, alternatively, in accordance with the terms contained in
- ** a written agreement between you and Digia.  For licensing terms and
- ** conditions see http://qt.digia.com/licensing.  For further information
- ** use the contact form at http://qt.digia.com/contact-us.
- **
- ** GNU Lesser General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU Lesser
- ** General Public License version 2.1 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.LGPL included in the
- ** packaging of this file.  Please review the following information to
- ** ensure the GNU Lesser General Public License version 2.1 requirements
- ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
- **
- ** In addition, as a special exception, Digia gives you certain additional
- ** rights.  These rights are described in the Digia Qt LGPL Exception
- ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
- **
- ** GNU General Public License Usage
- ** Alternatively, this file may be used under the terms of the GNU
- ** General Public License version 3.0 as published by the Free Software
- ** Foundation and appearing in the file LICENSE.GPL included in the
- ** packaging of this file.  Please review the following information to
- ** ensure the GNU General Public License version 3.0 requirements will be
- ** met: http://www.gnu.org/copyleft/gpl.html.
- **
- **
- ** $QT_END_LICENSE$
- **
- ****************************************************************************/
-
-#ifndef QWINTHEMECHANGEEVENT_P_H
-#define QWINTHEMECHANGEEVENT_P_H
-
-#include "qwinthemechangeevent.h"
-
-class QWinThemeChangeEventPrivate
-{
-public:
-    static QEvent::Type eventType();
-
-private:
-    static int eventTypeId;
-};
-
-#endif // QWINTHEMECHANGEEVENT_P_H
diff --git a/src/winextras/qwinthumbnailtoolbar.cpp b/src/winextras/qwinthumbnailtoolbar.cpp
index 6021241..cf8c0d0 100644
--- a/src/winextras/qwinthumbnailtoolbar.cpp
+++ b/src/winextras/qwinthumbnailtoolbar.cpp
@@ -49,7 +49,7 @@
 #include <QTimer>
 #include <QDebug>
 
-#include "qwintaskbarbuttoncreatedevent.h"
+#include "qwinevent.h"
 #include "qwinfunctions.h"
 #include "qwineventfilter_p.h"
 
@@ -294,7 +294,7 @@ void QWinThumbnailToolBarPrivate::_q_scheduleUpdate()
 
 bool QWinThumbnailToolBarPrivate::eventFilter(QObject *object, QEvent *event)
 {
-    if (object == window && event->type() == QWinTaskbarButtonCreatedEvent::eventType()) {
+    if (object == window && event->type() == QWinEvent::TaskbarButtonCreated) {
         initToolbar();
         _q_scheduleUpdate();
     }
diff --git a/src/winextras/winextras.pro b/src/winextras/winextras.pro
index fc1f494..7e830aa 100644
--- a/src/winextras/winextras.pro
+++ b/src/winextras/winextras.pro
@@ -8,13 +8,10 @@ SOURCES += \
     qwintaskbarbutton.cpp \
     windowsguidsdefs.cpp \
     qjumplist.cpp \
-    qwincolorizationcolorchangeevent.cpp \
-    qwincompositionstatechangeevent.cpp \
     qwineventfilter.cpp \
-    qwintaskbarbuttoncreatedevent.cpp \
-    qwinthemechangeevent.cpp \
     qwinthumbnailtoolbar.cpp \
-    qwinthumbnailtoolbutton.cpp
+    qwinthumbnailtoolbutton.cpp \
+    qwinevent.cpp
 
 HEADERS += \
     qwinfunctions.h \
@@ -23,21 +20,14 @@ HEADERS += \
     qwintaskbarbutton_p.h \
     qwintaskbarbutton.h \
     qjumplist.h \
-    qwincolorizationcolorchangeevent.h \
-    qwincolorizationcolorchangeevent_p.h \
-    qwincompositionstatechangeevent.h \
-    qwincompositionstatechangeevent_p.h \
-    qwintaskbarbuttoncreatedevent.h \
-    qwintaskbarbuttoncreatedevent_p.h \
     winshobjidl_p.h \
     winpropkey_p.h \
     qwineventfilter_p.h \
-    qwinthemechangeevent.h \
-    qwinthemechangeevent_p.h \
     qwinthumbnailtoolbar.h \
     qwinthumbnailtoolbar_p.h \
     qwinthumbnailtoolbutton.h \
-    qwinthumbnailtoolbutton_p.h
+    qwinthumbnailtoolbutton_p.h \
+    qwinevent.h
 
 QMAKE_DOCS = $$PWD/doc/qtwinextras.qdocconf
 
-- 
GitLab