No more stylet on Windows 7 (touchscreen)


#1

Hello

I have recently updated JUCE to the latest GIT (i have stayed with the same version for more than a year before that) --> I’ve lost all mouseDown, MouseDrags, etc on Windows7 / Touchscreen.

I have also compiled JuceDemo to check , and i have the same issue with the demo.

The problem might come from the MouseInputSources management… because everything works fine with the Finger and the Mouse… but the stylet can’t be seen.
i 've also checked with an old JuceDemo (more than 1 year old) and that one worked with the 3 kind of inputs (so this proves it’s not a limitation from my WINDOWS settings).

Can you help ?
Thanks in advance


#2

I don’t even know what a stylet is! (assuming it’s a type of pen for the touchscreen…?)

I’ve obviously not removed any code that was designed to handle any “stylet” events! So I guess that whatever is happening must be a result of the fact that the windows are now capable of handling touches… Perhaps when a window can receive touch events, Windows stops sending it any stylet events?


#3

by stylet , i mean “pen for touchscreen” (i think it’s called this way - but i’m French so i’m not sure)

I agree with you regarding WIndows now handling touches… but this does not explain why the old JuceDemo responds better than the new one.
By the way, i did the big jump (From JUCE 1.51 to JUCE 2.0.12)

Is there a way to handle all possible “mouse” inputs the same (meaning mouse, finger and pen)


#4

Yes, it does explain it. The old version didn’t accept touch events, and the new one does, so Windows is clearly behaving differently depending on whether a window accepts touches or not.

Since I’ve absolutely no idea what policy Windows is using, I really don’t know what I could do. If you want to try an experiment, have a search in juce_win32_Windowing.cpp for the registerTouchWindow() call - by commenting that out, you’ll stop the windows accepting touch events, and I assume that’ll make your stylus thing work again.


#5

[quote] If you want to try an experiment, have a search in juce_win32_Windowing.cpp for the registerTouchWindow() call - by commenting that out, you’ll stop the windows accepting touch events, and I assume that’ll make your stylus thing work again.
[/quote]

Thanks for the info

if i comment this line in juce_win32_Windowing.cpp

//registerTouchWindow = (RegisterTouchWindowFunc) GetProcAddress (user32Mod, "RegisterTouchWindow");

then i have no more possible actions using either a finger nor a pen. Only the mouse would work.


#6

…well no, if you comment that out, then it should behave exactly like the old version did. Like I said, try it and see what happens, to prove whether or not it really is the touch support that’s causing your problem.


#7

sorry my english seems to be bad. 'only the mouse would work" meant "only the mouse worked"
in fact, i tried it and only the mouse worked, not the pen and not the finger anymore.

i’m looking more into all options here
http://msdn.microsoft.com/en-us/library/windows/desktop/dd317326(v=vs.85).aspx

and maybe we should have a look there :
http://msdn.microsoft.com/en-us/library/windows/desktop/ms704849(v=VS.85).aspx


#8

Sorry, those links don’t seem to work…?


#9

they were cut
please try
http://msdn.microsoft.com/en-us/library/windows/desktop/dd317326

and
http://msdn.microsoft.com/en-us/library/windows/desktop/ms704849


#10

Well yeah, obviously I’ve seen the documentation, those are the functions I’ve used! They say nothing about a stylus, and I’m assuming a stylus would just be treated like either a touch or a mouse-click. I’m pretty sure there’s nothing special that an application is supposed to do to use a stylus, so I really don’t know what to suggest.


#11

yes, of course you’re using these functions. I was more thinking about special flags to set to make it work for any input… i don’t know.

too bad i can’t find what’s happening here. but the problem also appears when compiling the latest JuceDemo

Any dependencies i didn’t see ?


#12

Sorry, I really can’t think of anything I’ve changed that could be relevant apart from the multi-touch stuff.


#13

i’m installing Visual 2010 express on the tablet PC also and will put some breakpoints and check what happens
I’ll let you know if i find something


#14

Thanks, any clues you find would be useful.


#15

OK. I found it. The problem comes from this function in juce_win32_Windowing.cpp :

    static bool isCurrentEventFromTouchScreen() noexcept
    {
        return (GetMessageExtraInfo() & 0xffffff00 /* SIGNATURE_MASK */) == 0xff515700; /* MI_WP_SIGNATURE */
    }

this function returns false if i click with the mouse , true if i click with my finger or “tablet pen”

if i change the function to :

    static bool isCurrentEventFromTouchScreen() noexcept
    {
        return false;
    }

then i go back to the behaviour i wanted (meaning any input works)
it seems that the tablet pen would mean other signature mask, etc.
my application is mono touch , so i think this would be maybe interesting to have a global option in Juce to have all the mouse / finger / pen distinction available only when needed.


#16

Ah! Thanks… (I love the way MS has almost completely failed to document this!)

How about this:

static bool isCurrentEventFromTouchScreen() noexcept { const LPARAM flags = GetMessageExtraInfo(); return (flags & 0xffffff00 /* SIGNATURE_MASK */) == 0xff515700 /* MI_WP_SIGNATURE */ && (flags & 0xff) != 0; // (low 8 bits are the touch index, or 0 for pen events) }


#17

Thanks for the proposal, but sorry this fix does not work. I’ll test tomorrow what’s the problem… i’d need to take time to look at it (i need to focus on something else today)


#18

Actually, I did that wrong… try this:

static bool isCurrentEventFromTouchScreen() noexcept { const LPARAM flags = GetMessageExtraInfo(); return (flags & 0xffffff00 /* SIGNATURE_MASK */) == 0xff515700 /* MI_WP_SIGNATURE */ && (flags & 0x80) != 0; // (bit 7 = 0 for pen events, 1 for touch) }

The best description I could find of how those flags work is here:
http://msdn.microsoft.com/en-us/site/ms703320


#19

[quote]Actually, I did that wrong… try this:

static bool isCurrentEventFromTouchScreen() noexcept
{
    const LPARAM flags = GetMessageExtraInfo();
    return (flags & 0xffffff00 /* SIGNATURE_MASK */) == 0xff515700 /* MI_WP_SIGNATURE */
            && (flags & 0x80) != 0; // (bit 7 = 0 for pen events, 1 for touch)
}

[/quote]

i’ve just tested it and it works very well.
Thanks !