~ubuntu-branches/ubuntu/raring/frame/raring

« back to all changes in this revision

Viewing changes to src/x11/device_x11.h

  • Committer: Package Import Robot
  • Author(s): Francis Ginther
  • Date: 2012-07-27 10:36:59 UTC
  • Revision ID: package-import@ubuntu.com-20120727103659-lzgo2n21df0g4udi
Tags: upstream-2.2.4
ImportĀ upstreamĀ versionĀ 2.2.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************
 
2
 *
 
3
 * frame - Touch Frame Library
 
4
 *
 
5
 * Copyright (C) 2011-2012 Canonical Ltd.
 
6
 *
 
7
 * This library is free software: you can redistribute it and/or modify it 
 
8
 * under the terms of the GNU Lesser General Public License version 3
 
9
 * as published by the Free Software Foundation.
 
10
 *
 
11
 * This library is distributed in the hope that it will be useful, but 
 
12
 * WITHOUT ANY WARRANTY; without even the implied warranties of 
 
13
 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR 
 
14
 * PURPOSE.  See the GNU Lesser General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU Lesser General Public License
 
17
 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
 
18
 *
 
19
 ****************************************************************************/
 
20
 
 
21
#ifndef FRAME_DEVICE_X11_H_
 
22
#define FRAME_DEVICE_X11_H_
 
23
 
 
24
#include <map>
 
25
 
 
26
#include <X11/Xlib.h>
 
27
#include <X11/extensions/XInput2.h>
 
28
 
 
29
#include "oif/frame.h"
 
30
#include "device.h"
 
31
#include "typedefs.h"
 
32
 
 
33
namespace oif {
 
34
namespace frame {
 
35
 
 
36
class UFDeviceX11
 
37
    : public UFDevice,
 
38
      public std::enable_shared_from_this<UFDeviceX11> {
 
39
 public:
 
40
  UFDeviceX11(Display* display, const XIDeviceInfo& info);
 
41
 
 
42
  int master_id() const { return master_id_; }
 
43
  const std::map<int, UFAxisType>& axis_map() const { return axis_map_; }
 
44
 
 
45
  bool HandleDeviceEvent(const XIDeviceEvent* event, SharedUFFrame* frame);
 
46
  bool HandleOwnershipEvent(const XITouchOwnershipEvent* event,
 
47
                            SharedUFFrame* frame);
 
48
  UFStatus AcceptTouch(::Window window_id, UFTouchId touch_id) const;
 
49
  UFStatus RejectTouch(::Window window_id, UFTouchId touch_id) const;
 
50
  void ReleaseFrames();
 
51
 
 
52
  UFDeviceX11(const UFDeviceX11&) = delete;
 
53
  UFDeviceX11& operator=(const UFDeviceX11&) = delete;
 
54
 
 
55
 private:
 
56
  Display* display_;
 
57
  int master_id_;
 
58
  std::map<int, UFAxisType> axis_map_;
 
59
  std::map< ::Window, SharedWindow> windows_;
 
60
};
 
61
 
 
62
} // namespace frame
 
63
} // namespace oif
 
64
 
 
65
#endif // FRAME_DEVICE_X11_H_