~tiagosh/unity-2d/fix-dash-cursor

« back to all changes in this revision

Viewing changes to libunity-2d-private/src/gesturehandler.cpp

  • Committer: Tarmac
  • Author(s): Albert Astals, Ugo Riboni, Michał Sawicz, Florian Boucault, LDS
  • Date: 2012-02-10 17:32:14 UTC
  • mfrom: (771.3.235 unity-2d-shell_trunk)
  • Revision ID: tarmac-20120210173214-eekg5uiqdb7gjza6
Merge launcher and dash into a common new QML scene: the shell.
 - Created a shell folder that holds both launcher and dash QML code, the C++ code for the single binary and a common folder with shared QML files
 - The shell occupies the whole screen but is shaped for input where it is transparent in order not to interfere with the rest of the windows
 - The shell binary, unity-2d-shell, has a -rootqml option that lets the user specify the QML file to load
 - Implement visibility behaviours in QML instead of C++
 - Do not use D-Bus anymore to communicate between the launcher and the dash
 - Remove the homebutton panel plugin
 - Make the strut setting reusable outside of Unity2dPanel
 - Make LauncherDropItem a FocusScope
 - Implement gesture handling in QML instead of C++

Known issues:
 - In non composited mode there is a 1px wide rectangle on the edge of the screen where the launcher is hidden. This is acceptable for the moment since XFixes barriers to show the launcher are in the plan and will get rid of this problem
 - HomeShortcuts.qml has a transparent Rectangle to fix alignment in RTL mode that causes QML warnings. This is acceptable since the Home lens is going away. Fixes: . Approved by .

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
 
26
26
#include <debug_p.h>
27
27
 
28
 
GestureHandler::GestureHandler(Unity2dPanel* launcher, QObject *parent)
 
28
GestureHandler::GestureHandler(QObject *parent)
29
29
: QObject(parent)
30
30
, m_geisInstance(NULL)
31
 
, m_launcher(launcher)
 
31
, m_isDragging(false)
32
32
{
33
33
    if (geisInitialize() != GEIS_STATUS_SUCCESS) {
34
34
        UQ_WARNING << "GEIS initialization failed: multitouch support disabled";
218
218
        /* 4 fingers drag reveals the launcher progressively; if the drag goes far
219
219
           enough, the launcher is then locked in place and does not autohide anymore */
220
220
        /* FIXME: only supports the launcher positioned on the left edge of the screen */
221
 
        m_launcher->setManualSliding(true);
222
 
        m_dragDelta = m_launcher->delta() + attributes[GEIS_GESTURE_ATTRIBUTE_DELTA_X].float_val;
223
 
        m_launcher->setDelta(m_dragDelta);
 
221
        m_isDragging = true;
 
222
        Q_EMIT isDraggingChanged();
 
223
        m_dragDelta = attributes[GEIS_GESTURE_ATTRIBUTE_DELTA_X].float_val;
 
224
        Q_EMIT dragDeltaChanged();
224
225
    }
225
226
}
226
227
 
262
263
            m_pinchPreviousTimestamp = timestamp;
263
264
        }
264
265
    } else if (gestureName == GEIS_GESTURE_TYPE_DRAG4) {
265
 
        /* FIXME: only supports the launcher positioned on the left edge of the screen */
266
266
        m_dragDelta += attributes[GEIS_GESTURE_ATTRIBUTE_DELTA_X].float_val;
267
 
        m_launcher->setDelta(m_dragDelta);
268
 
        /* If the drag goes sufficiently above than the maximum delta then
269
 
           lock the launcher in place by reserving the area so that no windows
270
 
           overlap it.
271
 
         */
272
 
        if (m_dragDelta - m_launcher->delta() > 240) {
273
 
            m_launcher->setUseStrut(true);
274
 
        } else {
275
 
            m_launcher->setUseStrut(false);
276
 
        }
 
267
        Q_EMIT dragDeltaChanged();
277
268
    }
278
269
}
279
270
 
284
275
 
285
276
    if (gestureName == GEIS_GESTURE_TYPE_DRAG4) {
286
277
        m_dragDelta += attributes[GEIS_GESTURE_ATTRIBUTE_DELTA_X].float_val;
287
 
        m_launcher->setDelta(m_dragDelta);
288
 
        m_launcher->setManualSliding(false);
 
278
        Q_EMIT dragDeltaChanged();
 
279
        m_isDragging = false;
 
280
        Q_EMIT isDraggingChanged();
289
281
    }
290
282
}
291
283
 
 
284
double GestureHandler::dragDelta() const
 
285
{
 
286
    return m_dragDelta;
 
287
}
 
288
 
 
289
bool GestureHandler::isDragging() const
 
290
{
 
291
    return m_isDragging;
 
292
}
 
293
 
 
294
#include "gesturehandler.moc"