Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(regression) Document keyDownActions: discrepancy between global and instance #1512

Closed
jamshark70 opened this issue May 30, 2015 · 4 comments
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. env: SCIDE good first issue indicates issue tickets that are suitable for a new contributor
Milestone

Comments

@jamshark70
Copy link
Contributor

(
Document.current.keyDownAction = { |doc, char, mods|
    mods.debug("instance keyDownAction");
};

Document.globalKeyDownAction = { |doc, char, mods|
    mods.debug("global keyDownAction");
};
)

// when done:
Document.current.keyDownAction = nil;
Document.globalKeyDownAction = nil;

SHIFT:
global keyDownAction: 131072
instance keyDownAction: 33554432

CTRL:
global keyDownAction: 262144
instance keyDownAction: 67108864

ALT:
global keyDownAction: 524288
instance keyDownAction: 134217728

I am 100% certain that ctrl used to come into the globalKeyDownAction as 67108864 before, but it's changed since my last pull (today). I'm now on alpha1 plus a few post-alpha1 commits.

I don't have an opinion which is correct -- but these used to be consistent, and now they aren't. That's a regression that must be fixed before release.

@jamshark70 jamshark70 added bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. env: SCIDE good first issue indicates issue tickets that are suitable for a new contributor labels May 30, 2015
@jamshark70 jamshark70 added this to the 3.7 milestone May 30, 2015
@telephon
Copy link
Member

It should conform to the following methods in Integer:

    isCaps { ^this.bitAnd(65536) == 65536}
    isShift { ^this.bitAnd(131072) == 131072 }
    isCtrl { ^this.bitAnd(262144) == 262144 }
    isAlt { ^this.bitAnd(524288) == 524288 }
    isCmd { ^this.bitAnd(1048576) == 1048576 }
    isNumPad { ^this.bitAnd(2097152) == 2097152 }
    isHelp { ^this.bitAnd(4194304) == 4194304 }
    isFun { ^this.bitAnd(8388608) == 8388608 }

@scztt
Copy link
Contributor

scztt commented May 30, 2015

Are these correct for View?

@jamshark70
Copy link
Contributor Author

v = TextView(nil, Rect(800, 100, 400, 300)).front;

v.keyDownAction = { |view, char, modifiers|
    modifiers.debug("mods");
};

In Linux, shift, ctrl and alt are all correct with the above test code. On this machine, I can't get cmd, numpad, help or a function modifier, nor does caps-lock trigger a modifier. So I don't know about them. But in Linux at least, 1513 has fixed the issue.

@telephon
Copy link
Member

telephon commented Jun 2, 2015

On OS X, this fixes the issue for TextView.

Here is the test, in case it is useful:

v = TextView(nil, Rect(800, 100, 400, 300)).front;

v.keyDownAction = { |view, char, modifiers|
    case
    { modifiers.isAlt } { \alt }
    { modifiers.isCtrl } { \ctrl }
    { modifiers.isCmd } { \cmd }
    { modifiers.isShift } { \shift }
    { modifiers.isFun } { \fun }
    .postln
};

@telephon telephon closed this as completed Jun 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that relate to unexpected/unwanted behavior. Don't use for PRs. env: SCIDE good first issue indicates issue tickets that are suitable for a new contributor
Projects
None yet
Development

No branches or pull requests

3 participants