Keyboard event modifiers

Currently, there is no differentiation between left and right modifiers, though the comments have already constants defined for doing so. I would be interested in having the ability to distinguish between left and right, and I think a feature flag might be a practical approach to keep compatibility with existing code.

I would give it a try, but I am new to iced, so if anyone could give me some feedback on the plan:

Change the constants to the names suggested in the comments. Change the existing shift, etc methods to be something like:

#[cfg(feature = "double_sided_modifiers")]
    pub fn shift(self) -> bool {
        self.contains(Self::LSHIFT | Self::RSHIFT)

#[cfg(not(feature = "double_sided_modifiers"))]
    pub fn shift(self) -> bool {

Note the feature flag name is a working name, I am open to take suggestions. I think it is too long to actually be used, but I am terrible at finding names.

Also, with the feature flag added methods for left_shift, right_shift, left_ctrl, etc will be added.

However, the above approach will likely also work without the feature flag. Just modifying the public methods and adding left_shift, etc… will not need a feature flag. Yet, I do not see the implications right now, so the feature flag might be a fallback to use.

Any comments or suggestions are welcome. I’d do the modification if agreed on.

Thanks Johannes

I dug into this a little deeper, and will try to move forward early to 0.29.x of winit, which already has the change. The number of breaking changes is enormous, but this work has IMHO to be done anyway. It will take some time, I have devised a strategy. The difference is 35 commits ahead and 230 behind, which does not look like fun. But iced is precisely the perfect library for what I want to do, so I’ll give it a try.

1 Like