[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kde-workspace] kwin: [kwin] Drop handling for mouse motion event compression
From:       Martin_Gräßlin <mgraesslin () kde ! org>
Date:       2014-02-01 8:39:22
Message-ID: E1W9W6k-0006oF-CX () scm ! kde ! org
[Download RAW message or body]

Git commit 5d339f9d9edebcce0f6f53d4f5451e2b4814af16 by Martin Gräßlin.
Committed on 01/02/2014 at 08:34.
Pushed by graesslin into branch 'master'.

[kwin] Drop handling for mouse motion event compression

Not needed as Qt does it for us in the xcb plugin - see
QXcbConnection::processXcbEvents().

M  +14   -24   kwin/events.cpp
M  +0    -24   kwin/workspace.cpp
M  +0    -23   kwin/workspace.h

http://commits.kde.org/kde-workspace/5d339f9d9edebcce0f6f53d4f5451e2b4814af16

diff --git a/kwin/events.cpp b/kwin/events.cpp
index a1f348c..6380784 100644
--- a/kwin/events.cpp
+++ b/kwin/events.cpp
@@ -177,7 +177,6 @@ bool Workspace::workspaceEvent(xcb_generic_event_t *e)
         break;
     }
     case XCB_MOTION_NOTIFY: {
-        m_mouseMotionTimer->cancel();
         auto *mouseEvent = reinterpret_cast<xcb_motion_notify_event_t*>(e);
         const QPoint rootPos(mouseEvent->root_x, mouseEvent->root_y);
 #ifdef KWIN_BUILD_TABBOX
@@ -1301,30 +1300,21 @@ bool Client::motionNotifyEvent(xcb_window_t w, int state, int \
x, int y, int x_ro  x = this->x(); // translate from grab window to local coords
         y = this->y();
     }
-    // mouse motion event compression: the event queue might have multiple motion \
                events
-    // in that case we are only interested in the last event to not cause too much \
                overhead
-    // by useless move/resize operations.
-    // The compression is done using a singleshot QTimer of 0 msec to just move the \
                processing
-    // to the end of the event queue. In case there is another motion event in the \
                queue it will
-    // be processed before the timer fires and the processing of the newer motion \
                event cancels
-    // the running timer. Eventually this code path will be reached again and the \
                timer is
-    // started again
-    workspace()->scheduleMouseMotionCompression([this, x, y, x_root, y_root]() {
-        const QRect oldGeo = geometry();
-        handleMoveResize(x, y, x_root, y_root);
-        if (!isFullScreen() && isMove()) {
-            if (quick_tile_mode != QuickTileNone && oldGeo != geometry()) {
-                GeometryUpdatesBlocker blocker(this);
-                setQuickTileMode(QuickTileNone);
-                moveOffset = QPoint(double(moveOffset.x()) / double(oldGeo.width()) \
                * double(geom_restore.width()),
-                                    double(moveOffset.y()) / double(oldGeo.height()) \
                * double(geom_restore.height()));
-                moveResizeGeom = geom_restore;
-                handleMoveResize(x, y, x_root, y_root); // fix position
-            } else if (quick_tile_mode == QuickTileNone && isResizable()) {
-                checkQuickTilingMaximizationZones(x_root, y_root);
-            }
+
+    const QRect oldGeo = geometry();
+    handleMoveResize(x, y, x_root, y_root);
+    if (!isFullScreen() && isMove()) {
+        if (quick_tile_mode != QuickTileNone && oldGeo != geometry()) {
+            GeometryUpdatesBlocker blocker(this);
+            setQuickTileMode(QuickTileNone);
+            moveOffset = QPoint(double(moveOffset.x()) / double(oldGeo.width()) * \
double(geom_restore.width()), +                                double(moveOffset.y()) \
/ double(oldGeo.height()) * double(geom_restore.height())); +            \
moveResizeGeom = geom_restore; +            handleMoveResize(x, y, x_root, y_root); \
// fix position +        } else if (quick_tile_mode == QuickTileNone && \
isResizable()) { +            checkQuickTilingMaximizationZones(x_root, y_root);
         }
-    });
+    }
     return true;
 }
 
diff --git a/kwin/workspace.cpp b/kwin/workspace.cpp
index 36e5dd9..13830b9 100644
--- a/kwin/workspace.cpp
+++ b/kwin/workspace.cpp
@@ -105,29 +105,6 @@ void ColorMapper::update()
     }
 }
 
-MouseMotionCompressionTimer::MouseMotionCompressionTimer(QObject *parent)
-    : QTimer(parent)
-{
-    setSingleShot(true);
-    setInterval(0);
-}
-
-MouseMotionCompressionTimer::~MouseMotionCompressionTimer()
-{
-}
-
-void MouseMotionCompressionTimer::cancel()
-{
-    disconnect(m_connection);
-}
-
-void MouseMotionCompressionTimer::schedule(const std::function< void () > &functor)
-{
-    cancel();
-    m_connection = connect(this, &MouseMotionCompressionTimer::timeout, functor);
-    start();
-}
-
 Workspace* Workspace::_self = 0;
 
 Workspace::Workspace(bool restore)
@@ -158,7 +135,6 @@ Workspace::Workspace(bool restore)
     , set_active_client_recursion(0)
     , block_stacking_updates(0)
     , forced_global_mouse_grab(false)
-    , m_mouseMotionTimer(new MouseMotionCompressionTimer(this))
 {
     // If KWin was already running it saved its configuration after loosing the \
                selection -> Reread
     QFuture<void> reparseConfigFuture = QtConcurrent::run(options, \
                &Options::reparseConfiguration);
diff --git a/kwin/workspace.h b/kwin/workspace.h
index 81e0a83..759119b 100644
--- a/kwin/workspace.h
+++ b/kwin/workspace.h
@@ -55,7 +55,6 @@ class KillWindow;
 class ShortcutDialog;
 class UserActionsMenu;
 class Compositor;
-class MouseMotionCompressionTimer;
 
 class Workspace : public QObject, public KDecorationDefines
 {
@@ -70,7 +69,6 @@ public:
 
     bool workspaceEvent(xcb_generic_event_t*);
     bool workspaceEvent(QEvent*);
-    void scheduleMouseMotionCompression(const std::function<void ()> &functor);
 
     bool hasClient(const Client*);
 
@@ -532,9 +530,6 @@ private:
 
     QScopedPointer<KillWindow> m_windowKiller;
 
-    // compression of mouse motion events
-    MouseMotionCompressionTimer *m_mouseMotionTimer;
-
 private:
     friend bool performTransiencyCheck();
     friend Workspace *workspace();
@@ -571,18 +566,6 @@ private:
     xcb_colormap_t m_installed;
 };
 
-class MouseMotionCompressionTimer : public QTimer
-{
-    Q_OBJECT
-public:
-    explicit MouseMotionCompressionTimer(QObject *parent = 0);
-    virtual ~MouseMotionCompressionTimer();
-    void schedule(const std::function<void ()> &functor);
-    void cancel();
-private:
-    QMetaObject::Connection m_connection;
-};
-
 //---------------------------------------------------------
 // Unsorted
 
@@ -736,12 +719,6 @@ inline bool Workspace::hasClient(const Client* c)
     return findClient(ClientMatchPredicate(c));
 }
 
-inline
-void Workspace::scheduleMouseMotionCompression(const std::function< void () > \
                &functor)
-{
-    m_mouseMotionTimer->schedule(functor);
-}
-
 inline Workspace *workspace()
 {
     return Workspace::_self;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic