From 594456a9c3aeccce98a66615e67226ba2a766c91 Mon Sep 17 00:00:00 2001 From: sidorares Date: Fri, 15 Jul 2011 10:29:37 +1000 Subject: [PATCH] more efficient event dispatching in Window object --- test/wndwrap.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/test/wndwrap.js b/test/wndwrap.js index 7f35ed3..04bd867 100644 --- a/test/wndwrap.js +++ b/test/wndwrap.js @@ -33,7 +33,7 @@ function Window(parent, x, y, w, h, bg) this.id, this.parent.id, this.x, this.y, this.w, this.h, 1, 1, 0, { backgroundPixel: this.bg, eventMask: 0x00000040 } ); this.map(); - // very ineffitient this way! :) + // very ineffitient this way!!! var wnd = this; this.xclient.on('event', function(ev) { @@ -42,6 +42,20 @@ function Window(parent, x, y, w, h, bg) wnd.emit('mousemove', ev); } }); + /* + // TODO: right way to handle events + // need to modify xcore to dispatch events to event_consumers + // + eventType2eventName = { + 6: 'mousemove' + }; + + this.xclient.event_consumers[wnd.id] = function( ev ) + { + wnd.emit(eventType2eventName, ev); // convert to mousemove? (ev already event-spacific) + }; + + */ } util.inherits(Window, EventEmitter);