summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-10-14 16:23:16 (GMT)
committerrathnor <rathnor>2003-10-14 16:23:16 (GMT)
commitf89532c0cb3c8a5cc1a78bc11f1c6445edc2d826 (patch)
treeb2b28146930af8749882d814b3e7b95d68881064 /src
parentc583251e18003d4ea2886cf227b96d351d7d32c5 (diff)
downloadfluxbox_lack-f89532c0cb3c8a5cc1a78bc11f1c6445edc2d826.zip
fluxbox_lack-f89532c0cb3c8a5cc1a78bc11f1c6445edc2d826.tar.bz2
fix identification of event targets in event manager
Diffstat (limited to 'src')
-rw-r--r--src/FbTk/EventManager.cc58
-rw-r--r--src/FbTk/EventManager.hh7
-rw-r--r--src/fluxbox.cc16
3 files changed, 73 insertions, 8 deletions
diff --git a/src/FbTk/EventManager.cc b/src/FbTk/EventManager.cc
index ff01794..6c697e6 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.9 2003/10/02 16:14:41 rathnor Exp $ 22// $Id: EventManager.cc,v 1.10 2003/10/14 16:23:16 rathnor Exp $
23 23
24#include "EventManager.hh" 24#include "EventManager.hh"
25#include "FbWindow.hh" 25#include "FbWindow.hh"
@@ -57,6 +57,58 @@ void EventManager::remove(const FbWindow &win) {
57 unregisterEventHandler(win.window()); 57 unregisterEventHandler(win.window());
58} 58}
59 59
60Window EventManager::getEventWindow(XEvent &ev) {
61 // we only have cases for events that differ from xany
62 switch (ev.type) {
63 case CreateNotify:
64 // XCreateWindowEvent
65 return ev.xcreatewindow.window;
66 break;
67 case DestroyNotify:
68 // XDestroyWindowEvent
69 return ev.xdestroywindow.window;
70 break;
71 case UnmapNotify:
72 // XUnmapEvent
73 return ev.xunmap.window;
74 break;
75 case MapNotify:
76 // XMapEvent
77 return ev.xmap.window;
78 break;
79 case MapRequest:
80 // XMapRequestEvent
81 return ev.xmaprequest.window;
82 break;
83 case ReparentNotify:
84 // XReparentEvent
85 return ev.xreparent.window;
86 break;
87 case ConfigureNotify:
88 // XConfigureNotify
89 return ev.xconfigure.window;
90 break;
91 case GravityNotify:
92 // XGravityNotify
93 return ev.xgravity.window;
94 break;
95 case ConfigureRequest:
96 // XConfigureRequestEvent
97 return ev.xconfigurerequest.window;
98 break;
99 case CirculateNotify:
100 // XCirculateEvent
101 return ev.xcirculate.window;
102 break;
103 case CirculateRequest:
104 // XCirculateRequestEvent
105 return ev.xcirculaterequest.window;
106 break;
107 default:
108 return ev.xany.window;
109 }
110}
111
60void EventManager::registerEventHandler(EventHandler &ev, Window win) { 112void EventManager::registerEventHandler(EventHandler &ev, Window win) {
61 if (win != None) 113 if (win != None)
62 m_eventhandlers[win] = &ev; 114 m_eventhandlers[win] = &ev;
@@ -73,8 +125,10 @@ void EventManager::dispatch(Window win, XEvent &ev, bool parent) {
73 EventHandler *evhand = 0; 125 EventHandler *evhand = 0;
74 if (parent) 126 if (parent)
75 evhand = m_parent[win]; 127 evhand = m_parent[win];
76 else 128 else {
129 win = getEventWindow(ev);
77 evhand = m_eventhandlers[win]; 130 evhand = m_eventhandlers[win];
131 }
78 132
79 if (evhand == 0) 133 if (evhand == 0)
80 return; 134 return;
diff --git a/src/FbTk/EventManager.hh b/src/FbTk/EventManager.hh
index 7d1562e..1ad401e 100644
--- a/src/FbTk/EventManager.hh
+++ b/src/FbTk/EventManager.hh
@@ -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.hh,v 1.5 2003/08/23 15:44:06 fluxgen Exp $ 22// $Id: EventManager.hh,v 1.6 2003/10/14 16:23:16 rathnor Exp $
23 23
24#include "EventHandler.hh" 24#include "EventHandler.hh"
25#include <map> 25#include <map>
@@ -42,6 +42,11 @@ public:
42 void remove(const FbWindow &win); 42 void remove(const FbWindow &win);
43 void add(EventHandler &ev, Window win) { registerEventHandler(ev, win); } 43 void add(EventHandler &ev, Window win) { registerEventHandler(ev, win); }
44 void remove(Window win) { unregisterEventHandler(win); } 44 void remove(Window win) { unregisterEventHandler(win); }
45
46 // Some events have the parent window as the xany.window
47 // This function always returns the actual window member of the event structure
48 static Window getEventWindow(XEvent &ev);
49
45 void registerEventHandler(EventHandler &ev, Window win); 50 void registerEventHandler(EventHandler &ev, Window win);
46 void unregisterEventHandler(Window win); 51 void unregisterEventHandler(Window win);
47private: 52private:
diff --git a/src/fluxbox.cc b/src/fluxbox.cc
index 7b089a5..50cb292 100644
--- a/src/fluxbox.cc
+++ b/src/fluxbox.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: fluxbox.cc,v 1.199 2003/10/13 19:31:04 fluxgen Exp $ 25// $Id: fluxbox.cc,v 1.200 2003/10/14 16:23:15 rathnor Exp $
26 26
27#include "fluxbox.hh" 27#include "fluxbox.hh"
28 28
@@ -1091,8 +1091,15 @@ void Fluxbox::handleUnmapNotify(XUnmapEvent &ue) {
1091 */ 1091 */
1092void Fluxbox::handleClientMessage(XClientMessageEvent &ce) { 1092void Fluxbox::handleClientMessage(XClientMessageEvent &ce) {
1093#ifdef DEBUG 1093#ifdef DEBUG
1094 const char * atom = "nothing";
1095 if (ce.message_type)
1096 atom = XGetAtomName(FbTk::App::instance()->display(), ce.message_type);
1097
1094 cerr<<__FILE__<<"("<<__LINE__<<"): ClientMessage. data.l[0]=0x"<<hex<<ce.data.l[0]<< 1098 cerr<<__FILE__<<"("<<__LINE__<<"): ClientMessage. data.l[0]=0x"<<hex<<ce.data.l[0]<<
1095 " message_type=0x"<<ce.message_type<<dec<<endl; 1099 " message_type=0x"<<ce.message_type<<dec<<" = \""<<atom<<"\""<<endl;
1100
1101 if (ce.message_type && atom) XFree((char *) atom);
1102
1096#endif // DEBUG 1103#endif // DEBUG
1097 1104
1098 if (ce.format != 32) 1105 if (ce.format != 32)
@@ -1366,7 +1373,6 @@ void Fluxbox::update(FbTk::Subject *changedsub) {
1366 if (m_focused_window == &client) 1373 if (m_focused_window == &client)
1367 revertFocus(screen); 1374 revertFocus(screen);
1368 1375
1369 removeWindowSearch(client.window());
1370 // failed to revert focus? 1376 // failed to revert focus?
1371 if (m_focused_window == &client) 1377 if (m_focused_window == &client)
1372 m_focused_window = 0; 1378 m_focused_window = 0;
@@ -1423,9 +1429,9 @@ void Fluxbox::removeAtomHandler(AtomHandler *atomh) {
1423 1429
1424WinClient *Fluxbox::searchWindow(Window window) { 1430WinClient *Fluxbox::searchWindow(Window window) {
1425 std::map<Window, WinClient *>::iterator it = m_window_search.find(window); 1431 std::map<Window, WinClient *>::iterator it = m_window_search.find(window);
1426 if (it != m_window_search.end()) 1432 if (it != m_window_search.end())
1427 return it->second; 1433 return it->second;
1428 1434
1429 std::map<Window, FluxboxWindow *>::iterator git = m_window_search_group.find(window); 1435 std::map<Window, FluxboxWindow *>::iterator git = m_window_search_group.find(window);
1430 return git == m_window_search_group.end() ? 0 : &git->second->winClient(); 1436 return git == m_window_search_group.end() ? 0 : &git->second->winClient();
1431} 1437}