OSDN Git Service

various cleanups
authorIvailo Monev <xakepa10@gmail.com>
Thu, 21 Jul 2016 13:50:52 +0000 (13:50 +0000)
committerIvailo Monev <xakepa10@gmail.com>
Thu, 21 Jul 2016 13:50:52 +0000 (13:50 +0000)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
13 files changed:
src/core/kernel/qcoreevent.cpp
src/gui/CMakeLists.txt
src/gui/dialogs/qdialog.cpp
src/gui/graphicsview/qgraphicsproxywidget.cpp
src/gui/kernel/qapplication_win.cpp
src/gui/kernel/qapplication_x11.cpp
src/gui/kernel/qcocoawindowdelegate_mac.mm
src/gui/kernel/qmime.h
src/gui/kernel/qwidget.cpp
src/gui/kernel/qwidget.h
src/gui/kernel/qwidget_mac.mm
src/gui/kernel/qwidget_x11.cpp
src/gui/painting/qwindowsurface_p.h

index fc733d6..a498544 100644 (file)
@@ -503,53 +503,6 @@ QChildEvent::~QChildEvent()
 */
 
 /*!
-    \class QCustomEvent
-    \brief The QCustomEvent class provides support for custom events.
-
-    \compat
-
-    QCustomEvent has a \c{void *} that can be used to store custom
-    data.
-
-    In Qt 3, QObject::customEvent() took a QCustomEvent pointer. We
-    found out that this approach was unsatisfactory, because
-    there was often no safe way of deleting the data held in the
-    \c{void *}.
-
-    In Qt 4, QObject::customEvent() takes a plain QEvent pointer.
-    You can add custom data by subclassing.
-
-    \sa QObject::customEvent(), QCoreApplication::notify()
-*/
-
-/*!
-    \fn QCustomEvent::QCustomEvent(int type, void *data)
-
-    Constructs a custom event object with the event \a type and a
-    pointer to \a data. The value of \a type must be at least as
-    large as QEvent::User. By default, the data pointer is set to 0.
-*/
-/*!
-    \fn void QCustomEvent::setData(void *data)
-
-    \compat
-
-    Sets the generic data pointer to \a data.
-
-    \sa data()
-*/
-
-/*!
-    \fn void *QCustomEvent::data() const
-
-    \compat
-
-    Returns a pointer to the generic event data.
-
-    \sa setData()
-*/
-
-/*!
     \fn bool QChildEvent::inserted() const
 
     \compat
index cc55bff..aca09cd 100644 (file)
@@ -199,8 +199,6 @@ set(GUI_PUBLIC_HEADERS
     QPlatformIntegrationPlugin
     QPlatformNativeInterface
     QPlatformScreen
-    QPlatformWindow
-    QPlatformWindowFormat
     QPolygon
     QPoolEntry
     QPrintDialog
index f6494b4..9957954 100644 (file)
@@ -1085,7 +1085,6 @@ void QDialog::setSizeGripEnabled(bool enabled)
 }
 
 
-
 /*! \reimp */
 void QDialog::resizeEvent(QResizeEvent *)
 {
index 0de8987..83c7171 100644 (file)
@@ -1252,7 +1252,6 @@ void QGraphicsProxyWidget::wheelEvent(QGraphicsSceneWheelEvent *event)
     QWheelEvent wheelEvent(pos.toPoint(), event->screenPos(), event->delta(),
                            event->buttons(), event->modifiers(), event->orientation());
     QPointer<QWidget> focusWidget = d->widget->focusWidget();
-    extern bool qt_sendSpontaneousEvent(QObject *, QEvent *);
     qt_sendSpontaneousEvent(receiver, &wheelEvent);
     event->setAccepted(wheelEvent.isAccepted());
 
index a12e428..2d1cb25 100644 (file)
@@ -487,7 +487,7 @@ public:
     void        repolishStyle(QStyle &style);
     inline void showChildren(bool spontaneous) { d_func()->showChildren(spontaneous); }
     inline void hideChildren(bool spontaneous) { d_func()->hideChildren(spontaneous); }
-    inline uint testWindowState(uint teststate){ return dataPtr()->window_state & teststate; }
+    inline Qt::WindowStates testWindowState(Qt::WindowStates teststate){ return dataPtr()->window_state & teststate; }
     inline void setWindowTitle_helper(const QString &title) { d_func()->setWindowTitle_helper(title); }
     inline void forceUpdate() {
         QTLWExtra *tlwExtra = window()->d_func()->maybeTopData();
@@ -1915,7 +1915,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa
         case WM_SYSCOMMAND: {
 #ifndef Q_WS_WINCE
             bool window_state_change = false;
-            Qt::WindowStates oldstate = Qt::WindowStates(widget->dataPtr()->window_state);
+            Qt::WindowStates oldstate = widget->dataPtr()->window_state;
             // MSDN:In WM_SYSCOMMAND messages, the four low-order bits of the wParam parameter are
             // used internally by the system. To obtain the correct result when testing the value of
             // wParam, an application must combine the value 0xFFF0 with the wParam value by using
@@ -3865,7 +3865,7 @@ bool QETWidget::translateConfigEvent(const MSG &msg)
                 }
             } else if (msg.wParam != SIZE_MINIMIZED) {
                 bool window_state_changed = false;
-                Qt::WindowStates oldstate = Qt::WindowStates(dataPtr()->window_state);
+                Qt::WindowStates oldstate = dataPtr()->window_state;
                 if (isMinimized()) {
 #ifndef Q_WS_WINCE
                     const QString title = windowTitle();
index 38ef077..15aec81 100644 (file)
@@ -4902,7 +4902,7 @@ bool QETWidget::translatePropertyEvent(const XEvent *event)
     } else if (event->xproperty.atom == ATOM(_NET_WM_STATE)) {
         bool max = false;
         bool full = false;
-        Qt::WindowStates oldState = Qt::WindowStates(this->data->window_state);
+        Qt::WindowStates oldState = this->data->window_state;
 
         if (event->xproperty.state == PropertyNewValue) {
             // using length of 1024 should be safe for all current and
@@ -5025,7 +5025,7 @@ bool QETWidget::translatePropertyEvent(const XEvent *event)
                     if (!isMinimized()) {
                         // window was minimized
                         this->data->window_state = this->data->window_state | Qt::WindowMinimized;
-                        QWindowStateChangeEvent e(Qt::WindowStates(this->data->window_state & ~Qt::WindowMinimized));
+                        QWindowStateChangeEvent e(this->data->window_state & ~Qt::WindowMinimized);
                         QApplication::sendSpontaneousEvent(this, &e);
                     }
                     break;
@@ -5035,7 +5035,7 @@ bool QETWidget::translatePropertyEvent(const XEvent *event)
                     if (isMinimized()) {
                         // window was un-minimized
                         this->data->window_state &= ~Qt::WindowMinimized;
-                        QWindowStateChangeEvent e(Qt::WindowStates(this->data->window_state | Qt::WindowMinimized));
+                        QWindowStateChangeEvent e(this->data->window_state | Qt::WindowMinimized);
                         QApplication::sendSpontaneousEvent(this, &e);
                     }
                     break;
@@ -5286,7 +5286,7 @@ bool QETWidget::translateConfigEvent(const XEvent *event)
             cr.setSize(newSize);
             data->crect = cr;
 
-            uint old_state = data->window_state;
+            Qt::WindowStates old_state = data->window_state;
             if (!X11->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_VERT))
                 && !X11->isSupportedByWM(ATOM(_NET_WM_STATE_MAXIMIZED_HORZ)))
                 data->window_state &= ~Qt::WindowMaximized;
index 29b6a2e..af34669 100644 (file)
@@ -188,7 +188,7 @@ static void cleanupCocoaWindowDelegate()
     if (!qwidget->isMinimized()) {
         QWidgetData *widgetData = qt_qwidget_data(qwidget);
         widgetData->window_state = widgetData->window_state | Qt::WindowMinimized;
-        QWindowStateChangeEvent e(Qt::WindowStates(widgetData->window_state & ~Qt::WindowMinimized));
+        QWindowStateChangeEvent e(widgetData->window_state & ~Qt::WindowMinimized);
         qt_sendSpontaneousEvent(qwidget, &e);
     }
     // Send hide to match Qt on X11 and Windows
@@ -203,13 +203,11 @@ static void cleanupCocoaWindowDelegate()
     QWidgetData *widgetData = qt_qwidget_data(qwidget);
     if (!(qwidget->windowState() & (Qt::WindowMaximized | Qt::WindowFullScreen)) && [window isZoomed]) {
         widgetData->window_state = widgetData->window_state | Qt::WindowMaximized;
-        QWindowStateChangeEvent e(Qt::WindowStates(widgetData->window_state
-                                                   & ~Qt::WindowMaximized));
+        QWindowStateChangeEvent e(widgetData->window_state & ~Qt::WindowMaximized);
         qt_sendSpontaneousEvent(qwidget, &e);
     } else {
         widgetData->window_state = widgetData->window_state & ~Qt::WindowMaximized;
-        QWindowStateChangeEvent e(Qt::WindowStates(widgetData->window_state
-                                                   | Qt::WindowMaximized));
+        QWindowStateChangeEvent e(widgetData->window_state | Qt::WindowMaximized);
         qt_sendSpontaneousEvent(qwidget, &e);
     }
     NSRect rect = [[window contentView] frame];
@@ -277,7 +275,7 @@ static void cleanupCocoaWindowDelegate()
 {
     QWidget *qwidget = m_windowHash->value([notification object]);
     QWidgetData *widgetData = qt_qwidget_data(qwidget);
-    Qt::WindowStates currState = Qt::WindowStates(widgetData->window_state);
+    Qt::WindowStates currState = widgetData->window_state;
     Qt::WindowStates newState = currState;
     if (currState & Qt::WindowMinimized)
         newState &= ~Qt::WindowMinimized;
index 1ac2ddf..6793012 100644 (file)
@@ -104,10 +104,9 @@ private:
 */
 
 class Q_GUI_EXPORT QMacMime { //Obsolete
-    char type;
 public:
     enum QMacMimeType { MIME_DND=0x01, MIME_CLIP=0x02, MIME_QT_CONVERTOR=0x04, MIME_ALL=MIME_DND|MIME_CLIP };
-    explicit QMacMime(char) { Q_UNUSED(type); }
+    explicit QMacMime(char) { }
     virtual ~QMacMime() { }
 
     static void initialize() { }
@@ -127,7 +126,6 @@ public:
 };
 
 class Q_GUI_EXPORT QMacPasteboardMime {
-    char type;
 public:
     enum QMacPasteboardMimeType { MIME_DND=0x01,
                                   MIME_CLIP=0x02,
index fcfd465..8484563 100644 (file)
@@ -153,7 +153,6 @@ static inline bool hasBackingStoreSupport()
 #  define QT_NO_PAINT_DEBUG
 #endif
 
-extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); // qapplication.cpp
 extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp
 
 /*!
@@ -1266,14 +1265,12 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f)
     data.widget_attributes = 0;
     data.window_flags = f;
     data.window_state = 0;
-    data.focus_policy = 0;
+    data.focus_policy = Qt::NoFocus;
     data.context_menu_policy = Qt::DefaultContextMenu;
     data.window_modality = Qt::NonModal;
 
-    data.sizehint_forced = 0;
     data.is_closing = 0;
     data.in_show = 0;
-    data.in_set_window_state = 0;
     data.in_destructor = false;
 
     // Widgets with Qt::MSWindowsOwnDC (typically QGLWidget) must have a window handle.
@@ -2740,7 +2737,7 @@ void QWidgetPrivate::inheritStyle()
 
 Qt::WindowModality QWidget::windowModality() const
 {
-    return static_cast<Qt::WindowModality>(data->window_modality);
+    return data->window_modality;
 }
 
 void QWidget::setWindowModality(Qt::WindowModality windowModality)
@@ -2827,7 +2824,7 @@ bool QWidget::isMaximized() const
  */
 Qt::WindowStates QWidget::windowState() const
 {
-    return Qt::WindowStates(data->window_state);
+    return data->window_state;
 }
 
 /*!\internal
@@ -2839,7 +2836,7 @@ Qt::WindowStates QWidget::windowState() const
  */
 void QWidget::overrideWindowState(Qt::WindowStates newstate)
 {
-    QWindowStateChangeEvent e(Qt::WindowStates(data->window_state), true);
+    QWindowStateChangeEvent e(data->window_state, true);
     data->window_state  = newstate;
     QApplication::sendEvent(this, &e);
 }
@@ -6941,12 +6938,12 @@ QRect QWidget::contentsRect() const
 
 Qt::ContextMenuPolicy QWidget::contextMenuPolicy() const
 {
-    return (Qt::ContextMenuPolicy)data->context_menu_policy;
+    return data->context_menu_policy;
 }
 
 void QWidget::setContextMenuPolicy(Qt::ContextMenuPolicy policy)
 {
-    data->context_menu_policy = (uint) policy;
+    data->context_menu_policy = policy;
 }
 
 /*!
@@ -6973,12 +6970,12 @@ void QWidget::setContextMenuPolicy(Qt::ContextMenuPolicy policy)
 
 Qt::FocusPolicy QWidget::focusPolicy() const
 {
-    return (Qt::FocusPolicy)data->focus_policy;
+    return data->focus_policy;
 }
 
 void QWidget::setFocusPolicy(Qt::FocusPolicy policy)
 {
-    data->focus_policy = (uint) policy;
+    data->focus_policy = policy;
     Q_D(QWidget);
     if (d->extra && d->extra->focus_proxy)
         d->extra->focus_proxy->setFocusPolicy(policy);
index e545946..5521d6f 100644 (file)
@@ -63,7 +63,6 @@ QT_BEGIN_NAMESPACE
 
 
 class QLayout;
-class QWSRegionManager;
 class QStyle;
 class QAction;
 class QVariant;
@@ -92,7 +91,6 @@ class QInputContext;
 #endif
 class QIcon;
 class QWindowSurface;
-class QPlatformWindow;
 class QLocale;
 class QGraphicsProxyWidget;
 class QGraphicsEffect;
@@ -106,19 +104,17 @@ class QWidgetData
 {
 public:
     WId winid;
-    uint widget_attributes;
     Qt::WindowFlags window_flags;
-    uint window_state : 4;
-    uint focus_policy : 4;
-    uint sizehint_forced :1;
+    Qt::WindowModality window_modality;
+    Qt::WindowStates window_state;
+    Qt::FocusPolicy focus_policy;
+    Qt::ContextMenuPolicy context_menu_policy;
+    uint widget_attributes;
     uint is_closing :1;
     uint in_show : 1;
-    uint in_set_window_state : 1;
     mutable uint fstrut_dirty : 1;
-    uint context_menu_policy : 3;
-    uint window_modality : 2;
     uint in_destructor : 1;
-    uint unused : 13;
+
     QRect crect;
     mutable QPalette pal;
     QFont fnt;
index 6460772..6e36afd 100644 (file)
@@ -883,7 +883,7 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event,
             if (transitionAction == kWindowHideTransitionAction)
                 widget->hide();
         } else if(ekind == kEventWindowExpanded) {
-            Qt::WindowStates currState = Qt::WindowStates(widget->data->window_state);
+            Qt::WindowStates currState = widget->data->window_state;
             Qt::WindowStates newState = currState;
             if (currState & Qt::WindowMinimized)
                 newState &= ~Qt::WindowMinimized;
@@ -910,19 +910,18 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event,
             if(windowPart == inZoomIn && widget->isMaximized()) {
 
                 widget->data->window_state = widget->data->window_state & ~Qt::WindowMaximized;
-                QWindowStateChangeEvent e(Qt::WindowStates(widget->data->window_state | Qt::WindowMaximized));
+                QWindowStateChangeEvent e(widget->data->window_state | Qt::WindowMaximized);
                 QApplication::sendSpontaneousEvent(widget, &e);
             } else if(windowPart == inZoomOut && !widget->isMaximized()) {
                 widget->data->window_state = widget->data->window_state | Qt::WindowMaximized;
-                QWindowStateChangeEvent e(Qt::WindowStates(widget->data->window_state
-                                                           & ~Qt::WindowMaximized));
+                QWindowStateChangeEvent e(widget->data->window_state & ~Qt::WindowMaximized);
                 QApplication::sendSpontaneousEvent(widget, &e);
             }
             qt_button_down = 0;
         } else if(ekind == kEventWindowCollapsed) {
             if (!widget->isMinimized()) {
                 widget->data->window_state = widget->data->window_state | Qt::WindowMinimized;
-                QWindowStateChangeEvent e(Qt::WindowStates(widget->data->window_state & ~Qt::WindowMinimized));
+                QWindowStateChangeEvent e(widget->data->window_state & ~Qt::WindowMinimized);
                 QApplication::sendSpontaneousEvent(widget, &e);
             }
 
@@ -1013,8 +1012,7 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event,
                 if((widget->data->window_state & Qt::WindowMaximized) &&
                    IsWindowInStandardState(wid, 0, 0)) {
                     widget->data->window_state &= ~Qt::WindowMaximized;
-                    QWindowStateChangeEvent e(Qt::WindowStates(widget->data->window_state
-                                                | Qt::WindowMaximized));
+                    QWindowStateChangeEvent e(widget->data->window_state | Qt::WindowMaximized);
                     QApplication::sendSpontaneousEvent(widget, &e);
 
                 }
index d6e1882..1d695fe 100644 (file)
@@ -60,8 +60,6 @@
 #include "qbackingstore_p.h"
 #include "qwindowsurface_x11_p.h"
 
-//extern bool qt_sendSpontaneousEvent(QObject *, QEvent *); //qapplication_x11.cpp
-
 #include <qpixmap_x11_p.h>
 #include <qpaintengine_x11_p.h>
 #include "qt_x11_p.h"
@@ -2515,7 +2513,7 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
         if (QTLWExtra *topData = maybeTopData())
             topData->normalGeometry = QRect(0,0,-1,-1);
     } else {
-        uint s = data.window_state;
+        Qt::WindowStates s = data.window_state;
         s &= ~(Qt::WindowMaximized | Qt::WindowFullScreen);
         data.window_state = s;
     }
index 2a366f5..a271ac1 100644 (file)
@@ -63,7 +63,6 @@ class QRect;
 class QPoint;
 class QImage;
 class QWindowSurfacePrivate;
-class QPlatformWindow;
 
 class Q_GUI_EXPORT QWindowSurface
 {