Permalink
Browse files

fix handling "real" keyboard events

  • Loading branch information...
1 parent 621306c commit b73770584862c3c4f36970bd29783d89bd5c6615 @stbuehler stbuehler committed Feb 8, 2012
Showing with 24 additions and 10 deletions.
  1. +23 −4 src/enyo/plugin.js
  2. +1 −6 src/enyo/wterm_app.js
View
@@ -26,6 +26,29 @@ enyo.kind({
this.pluginStatusChangedCallback('ready')
},
+ create: function() {
+ this.inherited(arguments);
+ this.dispatchFilter = this.dispatchFilter.bind(this);
+ enyo.dispatcher.features.push(this.dispatchFilter);
+ },
+
+ destroy: function() {
+ var l = enyo.dispatcher.features;
+ for (var i = 0; i < l.length; ++i) {
+ if (l[i] == this.dispatchFilter) {
+ l.splice(i, 1);
+ break;
+ }
+ }
+ },
+
+ dispatchFilter: function(e) {
+ if (enyo.getPopupLayer() == e.dispatchTarget && ('keydown' == e.type || 'keyup' == e.type)) {
+ this.node.dispatchEvent(e);
+ return true;
+ }
+ },
+
rendered: function() {
this.pluginReady = false;
if (this.hasNode()) {
@@ -228,10 +251,6 @@ enyo.kind({
this.callPluginMethodDeferred(null, 'setKey', i, this.decodeEscape(this.currentKeys[i]))
},
- dispatch: function(inEvent) {
- if (this.focus()) this.node.dispatchEvent(inEvent)
- },
-
_prepend: function(inSender, inEvent) {
this.log(inSender, inEvent)
}
View
@@ -157,8 +157,7 @@ enyo.kind({
this.createComponent({
kind: "ApplicationEvents",
onWindowActivated: 'windowActivated',
- onWindowDeactivated: 'windowDeactivated',
- onKeydown: 'dispatchKeypress',
+ onWindowDeactivated: 'windowDeactivated'
})
},
@@ -275,10 +274,6 @@ enyo.kind({
this.render()
},
- dispatchKeypress: function(inSender, inEvent) {
- this.$.terminal.dispatch(inEvent)
- },
-
doPaste: function () {
enyo.dom.getClipboard(enyo.bind(this, this.handleClipboard))
},

0 comments on commit b737705

Please sign in to comment.