shoes3 icon indicating copy to clipboard operation
shoes3 copied to clipboard

Event enhancements in Shoes

Open IanTrudel opened this issue 7 years ago • 6 comments

Some enhancements have been suggested in #383 to improve Shoes and empower Shoes users. Let's make a list of desirable events. Add your own suggestion here.

  • Loading and closing App #383 / @ccoupe
  • Manipulating window (resizing, minimize, maximize and such) #372, #370 / @dredknight
Shoes.app do
   resize do
      para "user has resized the window.\n"
      # rescale the app accordingly
   end
end
  • keypress doesn't handle non-modifier combination keys #47

IanTrudel avatar Nov 09 '17 22:11 IanTrudel

We might consider the global event manager would handle keypress multiple keys and modifiers problem #47. Perhaps keypress block would pass an array containing all the key pressed at once, e.g. [control, alt, a], [control, shift, alt, w], [up, down], etc. This may require to ensure a consistent order to allow easy comparisons. Or we might consider updating the current keypress to handle multiple keys at the same time, such as up_left, down_right, etc.

irb(main):002:0> [:control, :shift, :alt, :w].join("_") => "control_shift_alt_w"

IanTrudel avatar Nov 17 '17 12:11 IanTrudel

Going to need some help with OSX: deprecated. I'm starting to really hate that word. https://developer.apple.com/documentation/appkit/nsevent/modifier_flags?language=objc

ccoupe avatar Nov 18 '17 02:11 ccoupe

The good news is that it is not a priority and we might get away with updating the current keypress event. We might want to come up with a use case or stress test because it seems keypress on FreeBSD is working better than on Windows, e.g. some modifier combinations may not be handled on Windows.

IanTrudel avatar Nov 18 '17 10:11 IanTrudel

I suspect it's the apple manual entry thats being deprecated. On osx you get 5 modifiers. Internally I'll map to a Shoes C enum and expand shoes_app_click, shoes_app_motion and shoes_app_release with an extra parameter for the enum.

For shoes_app_keypress() , osx maps to the 3 that gtk uses. See KEY_STATE macro in config.h. Perhaps, there is an existing way the cmd,ctl,alt or an easy way.

ccoupe avatar Nov 19 '17 02:11 ccoupe

We might consider the global event manager would handle keypress multiple keys and modifiers problem #47 ...

Very unlikely. Huge platform and hardware dependencies. Secondly what you think the global event manager does, should it exist, is different from mine.

ccoupe avatar Nov 20 '17 06:11 ccoupe

Updating suggested code for resize event. A similar event could be available for when a window is moved around (with left and top parameters).

Shoes.app do
   resize do |width, height|
      para "user has resized the window with new size #{width}@#{height}.\n"
      # rescale the app accordingly
   end
end

IanTrudel avatar Dec 04 '17 04:12 IanTrudel