Close
Page 4 of 5 FirstFirst ... 2 3 4 5 LastLast
Showing results 31 to 40 of 41
  1. #31

    Default

    Quote Originally Posted by Fursphere View Post
    Makes perfect sense to me. Hard has is it for mojo to actually verify the keystate?
    There isn't anything to verify these key state tables against. They are the only record of what Mojo has broadcast.

    They are doing that correctly. The problem is that Mojo doesn't broadcast the alt-was-released signal. Therefore the alt-was-released signal doesn't get put in the key state tables.

    The reason for the error is that Mojo follows the simple algorithm "broadcast whenever WoW is the focus window."

    But this algorithm is inadequate because when you Alt-tab, WoW stops being the focus window before you release the Alt key.

    I have to change the algorithm. I have to make it more complicated so Mojo will broadcast the alt-was-released signal even though WoW no longer has the focus.
    Last edited by Freddie : 01-18-2010 at 12:20 AM
    �Author of HotkeyNet and Mojo

  2. #32

    Default

    An addition to what I just wrote:

    You're probably thinking that Mojo could look at the physical key state on the local machine to see what the key state "really" is.

    But it can't do that because very soon Mojo will be able to broadcast keystrokes to WoWs that are different from the keystrokes you pressed physically. Once that happens, each target WoW will have its own unique idea of the keyboard state which will be different from the physical state on any machine.

    Mojo has to be able to track those keyboard states accurately. The code is essential so I put it in the program now and it's got to be made to work perfectly.
    �Author of HotkeyNet and Mojo

  3. #33
    Member Fursphere's Avatar
    Join Date
    Mar 2007
    Location
    Northern California
    Posts
    1026

    Default

    Ok, I follow ya. Just don't know how to deal with that.

    So you're basically creating "X" number of virtual keyboards (where "X" = # of active WoWs).

    I can't think of a reason where I'd want to hold the alt key down for very long - although I multibox very differently than a lot of folks out there.
    -Legion of Boom Founder-
    -Retired-

  4. #34

    Default

    Quote Originally Posted by Fursphere View Post
    So you're basically creating "X" number of virtual keyboards (where "X" = # of active WoWs).
    Exactly. I've tried about ten different ways of handling this problem in HotkeyNet. This is a new idea that just occurred to me a few weeks ago. Despite this problem (which is totally solvable) I think this will turn out to be the best way.

    I can't think of a reason where I'd want to hold the alt key down for very long - although I multibox very differently than a lot of folks out there.
    This kind of code is necessary whenever the injected keystrokes are different from physical ones. With FTL for example. It doesn't matter how long the keys are pressed.
    �Author of HotkeyNet and Mojo

  5. #35

    Default

    Quote Originally Posted by Freddie View Post
    I think I know what's wrong but I haven't figured out what to do about it.

    I think it's just that when you Alt Tab, by the time you release the Alt key, WoW is no longer the focus window, so Mojo never broadcasts the release of the Alt key.

    As a result, Mojo's key state tables (the fake ones it maintains for each WoW) show the Alt key down. Then next time you broadcast a key, Mojo translates the key with the screwed up key state tables. This could have odd effects since the operating system has a complicated way of interpreting keystrokes when Alt is down.
    What about marking all keys as released (and sending the relevant key up events) when the focused window changes?

  6. #36

    Default

    Quote Originally Posted by TheFallenOne View Post
    What about marking all keys as released (and sending the relevant key up events) when the focused window changes?
    My first thought was along similar lines. But there are some complications and I'm not sure how to deal with them.

    The first question is, What triggers Mojo to act? You suggest the trigger should be a change in the focus window. But how can Mojo know that the focus window changes? The only way I can think of is for Mojo to install an OS hook of some kind, probably a WH_SHELL hook. This might slow the computer down appreciably. I don't know, it would require testing. If somebody can think of a different way please tell me.

    Second, what action does Mojo take? The suggestion is, tell every broadcast target that modifiers are up. I think there would need to be some conditional restrictions on this because the user might not want that to happen. To take an extreme example, the program is going to allow people to write a hotkey like this:

    Code:
    Hotkey ( F1 )
    {
       SendTo ( WoW1 )
          PressKey ( Alt );
    }
    That basically means, "Make the target program think Alt is pressed and let it keep thinking that until I say so."

    I can't foresee why somebody would write that, but it's legal given the program's syntax so part of my job is to ensure that it works and avoid automatic actions that interfere with the user's intent.
    Last edited by Freddie : 01-18-2010 at 03:40 PM
    �Author of HotkeyNet and Mojo

  7. #37
    Member Fursphere's Avatar
    Join Date
    Mar 2007
    Location
    Northern California
    Posts
    1026

    Default

    Does HotKeyNet have this same problem?
    -Legion of Boom Founder-
    -Retired-

  8. #38

    Default

    Quote Originally Posted by Fursphere View Post
    Does HotKeyNet have this same problem?
    Nope. HotkeyNet is very good at making sure it sends key releases.

    I'm glad you asked this question because it hadn't occurred to me to think about how I handled this in HotkeyNet. The two programs are so different, I didn't think HotkeyNet could help. But actually, it uses a trick that could work in Mojo too.

    Here's how HotkeyNet does it. Every time you press a key that triggers an action, HotkeyNet thinks ahead and figures out what it will do in the future when your finger releases the key. It writes a little note that tells itself what to do at that future time and puts it in a table. Then it performs the action for the key press.

    Later, when you lift your finger, HotkeyNet looks in the table to see what it should do. By that time the local computer's state may have changed -- you may have alt tabbed, you may have closed a window, you may have done all kinds of things -- but that doesn't matter because HotkeyNet already decided, back when the computer was in an earlier state, what to do in this later state.

    Edit: By the way, hotkeys seem to be working now in Mojo. I just wrote the web documentation and I'll probably post a build in a few hours after I test it some more. Also I need to temporarily disable a bunch of new stuff that's half finished so people don't wonder if they should tell me it's half finished.
    Last edited by Freddie : 01-18-2010 at 06:37 PM
    �Author of HotkeyNet and Mojo

  9. #39

    Default

    Quote Originally Posted by Freddie View Post
    Nope. HotkeyNet is very good at making sure it sends key releases.

    I'm glad you asked this question because it hadn't occurred to me to think about how I handled this in HotkeyNet. The two programs are so different, I didn't think HotkeyNet could help. But actually, it uses a trick that could work in Mojo too.

    Here's how HotkeyNet does it. Every time you press a key that triggers an action, HotkeyNet thinks ahead and figures out what it will do in the future when your finger releases the key. It writes a little note that tells itself what to do at that future time and puts it in a table. Then it performs the action for the key press.

    Later, when you lift your finger, HotkeyNet looks in the table to see what it should do. By that time the local computer's state may have changed -- you may have alt tabbed, you may have closed a window, you may have done all kinds of things -- but that doesn't matter because HotkeyNet already decided, back when the computer was in an earlier state, what to do in this later state.
    Good solution.

    The other advantage to this is you could likely (if it was ever found to be needed) pretty easily set Mojo up to allow the action taken on key up change dynamically on key down, based on some script, just have to override the data in the table. Of course, there's always that thin line we want to be careful not to cross, and I'm not entirely sure where I'd draw it in that case, haha.

  10. #40

    Default

    Quote Originally Posted by TheFallenOne View Post
    Good solution.
    Thanks. I think I'm going to reuse it in Mojo.

    The other advantage to this is you could likely (if it was ever found to be needed) pretty easily set Mojo up to allow the action taken on key up change dynamically on key down, based on some script, just have to override the data in the table. Of course, there's always that thin line we want to be careful not to cross, and I'm not entirely sure where I'd draw it in that case, haha.
    That's how HotkeyNet works and that's also how Mojo will work. The data in the table is actually a pointer to a hotkey definition that the user wrote (assuming one was written).

    It's just a hotkey definition like any other hotkey definition that the user writes. I'm not sure why you think a line needs to be drawn.

    Right now we're talking about broadcasting instead of hotkeys, but broadcast is actually a subset of hotkeys where every key is a hotkey that sends itself both when it's pressed and released.
    �Author of HotkeyNet and Mojo

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •