aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/EventManager.cc
diff options
context:
space:
mode:
authorrathnor <rathnor>2002-12-01 13:42:15 (GMT)
committerrathnor <rathnor>2002-12-01 13:42:15 (GMT)
commit28b5c604490094e187494dcc566bd3d7a05a2c25 (patch)
tree8f78f5714a5cd055c10b067a2656fe7b2338e71a /src/FbTk/EventManager.cc
parentb9134162f9633784d9097df18769a699a62650fe (diff)
downloadfluxbox-28b5c604490094e187494dcc566bd3d7a05a2c25.zip
fluxbox-28b5c604490094e187494dcc566bd3d7a05a2c25.tar.bz2
Indenting from tabs to emacs 4-space
Diffstat (limited to 'src/FbTk/EventManager.cc')
-rw-r--r--src/FbTk/EventManager.cc74
1 files changed, 37 insertions, 37 deletions
diff --git a/src/FbTk/EventManager.cc b/src/FbTk/EventManager.cc
index 223b004..05d95c4 100644
--- a/src/FbTk/EventManager.cc
+++ b/src/FbTk/EventManager.cc
@@ -19,7 +19,7 @@
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE. 20// DEALINGS IN THE SOFTWARE.
21 21
22// $Id: EventManager.cc,v 1.1 2002/11/27 21:41:13 fluxgen Exp $ 22// $Id: EventManager.cc,v 1.2 2002/12/01 13:42:14 rathnor Exp $
23 23
24#include "EventManager.hh" 24#include "EventManager.hh"
25 25
@@ -29,64 +29,64 @@ using namespace std;
29namespace FbTk { 29namespace FbTk {
30 30
31EventManager *EventManager::instance() { 31EventManager *EventManager::instance() {
32 static EventManager ev; 32 static EventManager ev;
33 return &ev; 33 return &ev;
34} 34}
35 35
36EventManager::~EventManager() { 36EventManager::~EventManager() {
37 if (m_eventhandlers.size() != 0) 37 if (m_eventhandlers.size() != 0)
38 cerr<<"FbTk::EventManager: Warning: unregistered eventhandlers!"<<endl; 38 cerr<<"FbTk::EventManager: Warning: unregistered eventhandlers!"<<endl;
39} 39}
40 40
41void EventManager::handleEvent(XEvent &ev) { 41void EventManager::handleEvent(XEvent &ev) {
42 // find eventhandler for event window 42 // find eventhandler for event window
43 if (m_eventhandlers.find(ev.xany.window) == m_eventhandlers.end()) { 43 if (m_eventhandlers.find(ev.xany.window) == m_eventhandlers.end()) {
44 cerr<<"Can't find window="<<ev.xany.window<<endl; 44 cerr<<"Can't find window="<<ev.xany.window<<endl;
45 return; 45 return;
46 } 46 }
47 EventHandler *evhand = m_eventhandlers[ev.xany.window]; 47 EventHandler *evhand = m_eventhandlers[ev.xany.window];
48 if (evhand == 0) { 48 if (evhand == 0) {
49 cerr<<"FbTk::EventManager: Warning: evhand == 0!"<<endl; 49 cerr<<"FbTk::EventManager: Warning: evhand == 0!"<<endl;
50 return; 50 return;
51 } 51 }
52 52
53 switch (ev.xany.type) { 53 switch (ev.xany.type) {
54 case KeyPress: 54 case KeyPress:
55 evhand->keyPressEvent(ev.xkey); 55 evhand->keyPressEvent(ev.xkey);
56 break; 56 break;
57 case KeyRelease: 57 case KeyRelease:
58 evhand->keyReleaseEvent(ev.xkey); 58 evhand->keyReleaseEvent(ev.xkey);
59 break; 59 break;
60 case ButtonPress: 60 case ButtonPress:
61 evhand->buttonPressEvent(ev.xbutton); 61 evhand->buttonPressEvent(ev.xbutton);
62 break; 62 break;
63 case ButtonRelease: 63 case ButtonRelease:
64 evhand->buttonReleaseEvent(ev.xbutton); 64 evhand->buttonReleaseEvent(ev.xbutton);
65 break; 65 break;
66 case MotionNotify: 66 case MotionNotify:
67 evhand->motionNotifyEvent(ev.xmotion); 67 evhand->motionNotifyEvent(ev.xmotion);
68 break; 68 break;
69 case Expose: 69 case Expose:
70 evhand->exposeEvent(ev.xexpose); 70 evhand->exposeEvent(ev.xexpose);
71 break; 71 break;
72 case EnterNotify: 72 case EnterNotify:
73 evhand->enterNotifyEvent(ev.xcrossing); 73 evhand->enterNotifyEvent(ev.xcrossing);
74 break; 74 break;
75 case LeaveNotify: 75 case LeaveNotify:
76 evhand->leaveNotifyEvent(ev.xcrossing); 76 evhand->leaveNotifyEvent(ev.xcrossing);
77 break; 77 break;
78 default: 78 default:
79 evhand->handleEvent(ev); 79 evhand->handleEvent(ev);
80 break; 80 break;
81 }; 81 };
82} 82}
83 83
84void EventManager::registerEventHandler(EventHandler &ev, Window win) { 84void EventManager::registerEventHandler(EventHandler &ev, Window win) {
85 m_eventhandlers[win] = &ev; 85 m_eventhandlers[win] = &ev;
86} 86}
87 87
88void EventManager::unregisterEventHandler(Window win) { 88void EventManager::unregisterEventHandler(Window win) {
89 m_eventhandlers.erase(win); 89 m_eventhandlers.erase(win);
90} 90}
91 91
92}; 92};