initial version
[synfig.git] / synfig-studio / trunk / src / gtkmm / devicetracker.cpp
1 /* === S I N F G =========================================================== */
2 /*!     \file devicetracker.cpp
3 **      \brief Template File
4 **
5 **      $Id: devicetracker.cpp,v 1.1.1.1 2005/01/07 03:34:36 darco Exp $
6 **
7 **      \legal
8 **      Copyright (c) 2002 Robert B. Quattlebaum Jr.
9 **
10 **      This software and associated documentation
11 **      are CONFIDENTIAL and PROPRIETARY property of
12 **      the above-mentioned copyright holder.
13 **
14 **      You may not copy, print, publish, or in any
15 **      other way distribute this software without
16 **      a prior written agreement with
17 **      the copyright holder.
18 **      \endlegal
19 */
20 /* ========================================================================= */
21
22 /* === H E A D E R S ======================================================= */
23
24 #ifdef USING_PCH
25 #       include "pch.h"
26 #else
27 #ifdef HAVE_CONFIG_H
28 #       include <config.h>
29 #endif
30
31 #include "devicetracker.h"
32 #include <gdkmm/device.h>
33 #include <sinfgapp/main.h>
34
35 #endif
36
37 /* === U S I N G =========================================================== */
38
39 using namespace std;
40 using namespace etl;
41 using namespace sinfg;
42 using namespace studio;
43
44 /* === M A C R O S ========================================================= */
45
46 /* === G L O B A L S ======================================================= */
47
48 /* === P R O C E D U R E S ================================================= */
49
50 /* === M E T H O D S ======================================================= */
51
52 DeviceTracker::DeviceTracker()
53 {
54         // By default, set the input mode on devices to
55         // GDK_MODE_SCREEN.
56         {
57                 GList*  device_list;
58                 GList*  iter;
59                 device_list=gdk_devices_list();
60                 
61                 for(iter=device_list;iter;iter=g_list_next(iter))
62                 {
63                         GdkDevice* device=reinterpret_cast<GdkDevice*>(iter->data);
64                         gdk_device_set_mode(device,GDK_MODE_SCREEN);
65                         
66                         sinfgapp::InputDevice::Handle input_device;
67                         input_device=sinfgapp::Main::add_input_device(device->name,sinfgapp::InputDevice::Type(device->source));
68                         if(input_device->get_type()==sinfgapp::InputDevice::TYPE_MOUSE)
69                                 sinfgapp::Main::select_input_device(input_device);
70                 }               
71         }
72 }
73
74 DeviceTracker::~DeviceTracker()
75 {
76 }