max-mapper / screencat

:cat2: webrtc screensharing electron app for mac os (Alpha)
http://maxogden.github.io/screencat
BSD 2-Clause "Simplified" License
3.01k stars 383 forks source link

Improvements #1

Closed zz85 closed 9 years ago

zz85 commented 9 years ago

:)

max-mapper commented 9 years ago

@zz85 OMG THE LOCALSTORAGE THING IS SO COOL!!!! also me and @feross are still trying to figure out how to synth the keypress events....

timoxley commented 9 years ago

@maxogden it's possible keypress vs keydown is the issue https://github.com/timoxley/keycode/wiki/wtf%3F-keydown,-keyup-vs-keypress

timoxley commented 9 years ago

Actually, probably not. no.

Now I'm thinking, it's probably just that the <input> doesn't listen for keyboard events and respond appropriately, because it's usually the element that's actually generating the events? Maybe?

timoxley commented 9 years ago

looks like it was something like that: http://stackoverflow.com/a/4176116/62851

timoxley commented 9 years ago

@maxogden Got it: https://github.com/eventualbuddha/keysim.js Buffer up the keys on the remote, then:

keyboard.dispatchEventsForInput(remoteKeys, document.currentElement);
zz85 commented 9 years ago

thanks for the lead @timoxley :) are @maxogden @feross on the flight out or enjoying the :cat: cafe?

zz85 commented 9 years ago

hmm. looks like keysim sends on key events (useful for checking key handlers) but doesn't change input values.

Note that none of the methods provided by keysim will trigger the browser's default behavior, such as inserting text or moving the cursor. It only allows you to test your event handling code by sending the correct DOM events.

something which would works would be more similar to the approach in http://bililite.com/blog/2011/01/23/improved-sendkeys/ (somehow I just remembered doing something similar ages ago)

zz85 commented 9 years ago

got some crude form of keypresses to work... however to handle text selection, might need https://github.com/component/textarea-caret-position or https://github.com/mizzao/meteor-autocomplete

screenscreen-keypress

but this is starting to look like it might require all the hackery it takes to build codemirror.

max-mapper commented 9 years ago

i got bored on the plane and wrote https://github.com/maxogden/screenshare/blob/master/synthkeys.js, but it sucks that reimplementing browser behavior in js seems to be the only way to do it

zz85 commented 9 years ago

@maxogden looks good. to support emoji / unicode characters, try the codemirror approach - use an invisible input field to capture characters and send it across to the actual textfield. hope you've reached safely :)

zz85 commented 9 years ago

the references in codemirror