Back to index

unity  6.0.0
Public Member Functions | Private Member Functions | Private Attributes
GestureEngine Class Reference

#include <GestureEngine.h>

Inheritance diagram for GestureEngine:
Inheritance graph
[legend]
Collaboration diagram for GestureEngine:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 GestureEngine (CompScreen *screen)
virtual ~GestureEngine ()
void OnTap (GeisAdapter::GeisTapData *data)
void OnDragStart (GeisAdapter::GeisDragData *data)
void OnDragUpdate (GeisAdapter::GeisDragData *data)
void OnDragFinish (GeisAdapter::GeisDragData *data)
void OnRotateStart (GeisAdapter::GeisRotateData *data)
void OnRotateUpdate (GeisAdapter::GeisRotateData *data)
void OnRotateFinish (GeisAdapter::GeisRotateData *data)
void OnPinchStart (GeisAdapter::GeisPinchData *data)
void OnPinchUpdate (GeisAdapter::GeisPinchData *data)
void OnPinchFinish (GeisAdapter::GeisPinchData *data)
void OnTouchStart (GeisAdapter::GeisTouchData *data)
void OnTouchUpdate (GeisAdapter::GeisTouchData *data)
void OnTouchFinish (GeisAdapter::GeisTouchData *data)
void EndDrag ()

Private Member Functions

CompWindow * FindCompWindowAtPos (float pos_x, float pos_y)

Private Attributes

CompScreen * _screen
CompWindow * _drag_window
CompWindow * _pinch_window
CompWindow * _touch_window
CompScreen::GrabHandle _drag_grab
CompScreen::GrabHandle _pinch_grab
int _drag_id
int _pinch_id
int _touch_id
Cursor _fleur_cursor

Detailed Description

Definition at line 28 of file GestureEngine.h.


Constructor & Destructor Documentation

GestureEngine::GestureEngine ( CompScreen *  screen)

Definition at line 30 of file GestureEngine.cpp.

{
  _screen = screen;

  _drag_id = 0;
  _drag_window = 0;
  _pinch_id = 0;
  _touch_id = 0;
  _drag_grab = 0;
  _pinch_grab = 0;
  _fleur_cursor = XCreateFontCursor (screen->dpy (), XC_fleur);

  GeisAdapter& adapter = GeisAdapter::Instance();

  adapter.tap.connect(sigc::mem_fun(this, &GestureEngine::OnTap));

  adapter.drag_start.connect(sigc::mem_fun(this, &GestureEngine::OnDragStart));
  adapter.drag_update.connect(sigc::mem_fun(this, &GestureEngine::OnDragUpdate));
  adapter.drag_finish.connect(sigc::mem_fun(this, &GestureEngine::OnDragFinish));

  adapter.rotate_start.connect(sigc::mem_fun(this, &GestureEngine::OnRotateStart));
  adapter.rotate_update.connect(sigc::mem_fun(this, &GestureEngine::OnRotateUpdate));
  adapter.rotate_finish.connect(sigc::mem_fun(this, &GestureEngine::OnRotateFinish));

  adapter.pinch_start.connect(sigc::mem_fun(this, &GestureEngine::OnPinchStart));
  adapter.pinch_update.connect(sigc::mem_fun(this, &GestureEngine::OnPinchUpdate));
  adapter.pinch_finish.connect(sigc::mem_fun(this, &GestureEngine::OnPinchFinish));

  adapter.touch_start.connect(sigc::mem_fun(this, &GestureEngine::OnTouchStart));
  adapter.touch_update.connect(sigc::mem_fun(this, &GestureEngine::OnTouchUpdate));
  adapter.touch_finish.connect(sigc::mem_fun(this, &GestureEngine::OnTouchFinish));
}

Here is the call graph for this function:

Definition at line 63 of file GestureEngine.cpp.

{
              if (_fleur_cursor)
       XFreeCursor (screen->dpy (), _fleur_cursor);
}

Member Function Documentation

Definition at line 176 of file GestureEngine.cpp.

{
  if (_drag_window)
  {
    _screen->removeGrab(_drag_grab, NULL);
    _drag_grab = 0;
    _drag_window = 0;
    _drag_id = 0;
  }
}

Here is the caller graph for this function:

CompWindow * GestureEngine::FindCompWindowAtPos ( float  pos_x,
float  pos_y 
) [private]

Definition at line 79 of file GestureEngine.cpp.

{
  const CompWindowVector& client_list_stacking = _screen->clientList(true);

  int pos_x = fpos_x;
  int pos_y = fpos_y;

  for (auto iter = client_list_stacking.rbegin(),
       end = client_list_stacking.rend();
       iter != end; ++iter)
  {
    CompWindow* window = *iter;

    if (pos_x >= window->x() && pos_x <= (window->width() + window->x())
        &&
        pos_y >= window->y() && pos_y <= (window->height() + window->y()))
      return window;
  }

  return nullptr;
}

Here is the caller graph for this function:

Definition at line 165 of file GestureEngine.cpp.

{
  if (_drag_id == data->id && _drag_window)
  {
    _drag_window->ungrabNotify ();
    _drag_window->syncPosition();
    EndDrag();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 102 of file GestureEngine.cpp.

{
  if (data->touches == 3)
  {
    _drag_window = FindCompWindowAtPos(data->focus_x, data->focus_y);


    if (!_drag_window)
      return;

    if (!(_drag_window->actions() & CompWindowActionMoveMask))
    {
      _drag_window = 0;
      return;
    }

    /* Don't allow windows to be dragged if completely maximized */
    if ((_drag_window->state() & MAXIMIZE_STATE) == MAXIMIZE_STATE)
    {
      _drag_window = 0;
      return;
    }

    if (_drag_grab)
      _screen->removeGrab(_drag_grab, NULL);
    _drag_id = data->id;
    _drag_grab = _screen->pushGrab(_fleur_cursor, "unity");
    _drag_window->grabNotify (_drag_window->serverGeometry ().x (),
                              _drag_window->serverGeometry ().y (),
                              0, CompWindowGrabMoveMask | CompWindowGrabButtonMask);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 139 of file GestureEngine.cpp.

{
  if (_drag_id == data->id && _drag_window)
  {
    unsigned int px = std::max (std::min (pointerX + static_cast <int> (data->delta_x), screen->width ()), 0);
    unsigned int py = std::max (std::min (pointerY + static_cast <int> (data->delta_y), screen->height ()), 0);

    if (_drag_window->state () & CompWindowStateMaximizedVertMask)
      py = pointerY;
    if (_drag_window->state () & CompWindowStateMaximizedHorzMask)
      px = pointerX;

    XWarpPointer(screen->dpy (),
     None, screen->root (),
     0, 0, 0, 0,
     px, py);

    XSync(screen->dpy (), false);
    _drag_window->move(px - pointerX, py - pointerY, false);

    pointerX = px;
    pointerY = py;
  }
}

Here is the caller graph for this function:

Definition at line 272 of file GestureEngine.cpp.

{
  if (_pinch_id == data->id && _pinch_window)
  {
    _screen->removeGrab(_pinch_grab, NULL);
    _pinch_grab = 0;
    _pinch_id = 0;
  }
}

Here is the caller graph for this function:

Definition at line 238 of file GestureEngine.cpp.

{
  if (data->touches == 3)
  {
    _pinch_window = FindCompWindowAtPos(data->focus_x, data->focus_y);

    if (!_pinch_window)
      return;

    _pinch_id = data->id;

    if (_pinch_grab)
      _screen->removeGrab(_pinch_grab, NULL);
    _pinch_grab = _screen->pushGrab(_screen->invisibleCursor(), "unity");
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 255 of file GestureEngine.cpp.

{
  if (data->id != _pinch_id)
    return;

  if (data->radius > 1.25)
  {
    _pinch_window->maximize(MAXIMIZE_STATE);
    EndDrag();
  }
  else if (data->radius < 0.8)
  {
    _pinch_window->maximize(0);
    EndDrag();
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 198 of file GestureEngine.cpp.

{

}

Here is the caller graph for this function:

Definition at line 188 of file GestureEngine.cpp.

{

}

Here is the caller graph for this function:

Definition at line 193 of file GestureEngine.cpp.

{

}

Here is the caller graph for this function:

Definition at line 70 of file GestureEngine.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 226 of file GestureEngine.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 204 of file GestureEngine.cpp.

{
  if (data->touches == 3 && data->window != 0)
  {
    CompWindow* result = FindCompWindowAtPos(data->focus_x, data->focus_y);

    if (result)
    {
      PluginAdapter::Default()->ShowGrabHandles(result, false);
      _touch_id = data->id;
      _touch_window = result;
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 220 of file GestureEngine.cpp.

{

}

Here is the caller graph for this function:


Member Data Documentation

CompScreen::GrabHandle GestureEngine::_drag_grab [private]

Definition at line 60 of file GestureEngine.h.

int GestureEngine::_drag_id [private]

Definition at line 63 of file GestureEngine.h.

CompWindow* GestureEngine::_drag_window [private]

Definition at line 57 of file GestureEngine.h.

Cursor GestureEngine::_fleur_cursor [private]

Definition at line 67 of file GestureEngine.h.

CompScreen::GrabHandle GestureEngine::_pinch_grab [private]

Definition at line 61 of file GestureEngine.h.

int GestureEngine::_pinch_id [private]

Definition at line 64 of file GestureEngine.h.

CompWindow* GestureEngine::_pinch_window [private]

Definition at line 58 of file GestureEngine.h.

CompScreen* GestureEngine::_screen [private]

Definition at line 56 of file GestureEngine.h.

int GestureEngine::_touch_id [private]

Definition at line 65 of file GestureEngine.h.

CompWindow* GestureEngine::_touch_window [private]

Definition at line 59 of file GestureEngine.h.


The documentation for this class was generated from the following files: