remouseable icon indicating copy to clipboard operation
remouseable copied to clipboard

Support manual selection for multiple displays

Open slartibart70 opened this issue 3 years ago • 1 comments

Hi, i'm using a 2 monitor setup, one 2560x1440 and the other 3840x2160. I can use remousable without problem on the first monitor, so scaling is correct (circles remain circles). But, i cannot do the same on the second screen, giving 6400x2160 in screen-height/width distorts the whole drawing. Just giving 3840x2160 would be fine, but i can only use a fraction of the second screen. So, scaling seems ok if i restrict myself to screen 1 or 2, but ... we need an offset. In my case this would be screen1: --screen-height=1440 --screen-width=2560 screen2: --screen-height=2160 --screen-width=2560+3840 ## 2560 being the offset

I think, depending on your monitor setup (left-right or on top of each other) - such an offset on both axis would come handy

Could you try implementing this feature, please?

slartibart70 avatar Jun 19 '21 22:06 slartibart70

This is similar in nature to https://github.com/kevinconway/remouseable/issues/11 where I outline the work required to implement true multi-monitor support. However, your suggestion of using a static offset could be an easier/quicker way to implement the feature.

This project defines an interface for mapping tablet coordinates to screen coordinates called a PositionScaler . The code swaps out which scaling policy to use based on which tablet orientation you select via the flags (or right-oriented by default). Currently, the basic policies compute based on the difference between the tablet resolution and the configured screen resolution. Multi-display setups on linux and windows, at least, skew by default because the system reports the combined screen resolution as a single screen which causes the output to appear off because the tool is scaling based on incorrect measurements.

With your idea, there could be an implementation of PositionScaler that wraps any other PositionScaler and adds a static value to the X, Y, or both coordinates. That would create the effect you're looking for. The tool could have --screen-heigh-offset and --screen-width-offset flags that default to zero for backwards compatibility and are used to populate the static offset values of the new PositionScaler wrapper.

I don't, personally, have a use for this feature so I'm unlikely to code it myself but I think this is fairly straightforward for someone willing to make the PRs. The outline of the work is:

  1. Create a new PositionScaler here that adds the static offsets. Something like:
type OffsetPositionScaler struct {
  Wrapped PositionScaler
  OffsetX int
  OffsetY int
}
func (s *OffsetPositionScaler)  ScalePosition(x int, y int) (int, int) {
  x, y = s.Wrapped.ScalePosition(x, y)
  return x+s.OffsetX, y+s.OffsetY
}
  1. Add some tests for the new policy here in the same style as the other tests.
  2. Define new flags for the new options somewhere around here.
  3. Create the policy and wrap the orientation based scaling policy before the policy is installed here.
  4. Add some usage docs to the README, likely in a new section, that outline how to use the offset flags to account for various mulit-screen position setups.

kevinconway avatar Jun 20 '21 02:06 kevinconway