~3v1n0/unity/scale-window-cast-protection

2898.4.4 by Andrea Azzarone
Add XdndManager* + tests.
1
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
2
/*
3
* Copyright (C) 2012 Canonical Ltd
4
*
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 3 as
7
* published by the Free Software Foundation.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
*
17
* Authored by: Andrea Azzarone <andrea.azzarone@canonical.com>
18
*/
19
20
#ifndef UNITYSHELL_XDND_MANAGER_IMP_H
21
#define UNITYSHELL_XDND_MANAGER_IMP_H
22
23
#include <sigc++/trackable.h>
24
25
#include "XdndManager.h"
26
27
#include "XdndCollectionWindow.h"
28
#include "XdndStartStopNotifier.h"
29
#include "UnityCore/GLibSource.h"
30
31
namespace unity {
32
3566.3.21 by Marco Trevisan (Treviño)
XdndManagerImp: use Collection Window's GetData method to fetch dnd data
33
class XdndManagerImp : public XdndManager, public sigc::trackable
34
{
2898.4.4 by Andrea Azzarone
Add XdndManager* + tests.
35
public:
2898.4.14 by Andrea Azzarone
Some fixes suggested by Marco.
36
  XdndManagerImp(XdndStartStopNotifier::Ptr const&, XdndCollectionWindow::Ptr const&);
2898.4.4 by Andrea Azzarone
Add XdndManager* + tests.
37
3566.3.14 by Marco Trevisan (Treviño)
XdndManager: Emit the old monitor on monitor_changed signal, add Monitor getter
38
  virtual int Monitor() const;
39
2898.4.4 by Andrea Azzarone
Add XdndManager* + tests.
40
private:
41
  void OnDndStarted();
42
  void OnDndFinished();
43
  void OnDndDataCollected(std::vector<std::string> const& mimes);
44
  bool IsAValidDnd(std::vector<std::string> const& mimes);
45
  bool CheckMousePosition();
46
47
  XdndStartStopNotifier::Ptr xdnd_start_stop_notifier_;
48
  XdndCollectionWindow::Ptr xdnd_collection_window_;
49
  int last_monitor_;
3566.3.7 by Marco Trevisan (Treviño)
XdndManager: keep track of the dnd data, emit it on monitor-changed
50
  std::string dnd_data_;
2898.4.4 by Andrea Azzarone
Add XdndManager* + tests.
51
52
  glib::Source::UniquePtr mouse_poller_timeout_;
53
};
54
55
}
56
57
#endif