News for hackers. Stuff that matters.
Re:Overlay.NET: An easy-to-use overlay library written in C# by Someone on Sunday November 13, 2016 @05:53PM (#12946211)
"I've done this before for similar input purposes and the only caveat is that some applications are able to 'push' topmost windows to the bottom - there are some workarounds, though"

Are there? I would think that is a weapons race you cannot win. If you can force your window to the top of all other windows, including those of other applications, so can others.

The only way out of that is if the OS has a notion of "this is the one and only topmost full screen window".

Re:Overlay.NET: An easy-to-use overlay library written in C# by kevingadd on Sunday November 13, 2016 @06:13PM (#12946327)
Right, that's why in this case you just periodically push yourself to the top of the stack. If you're not capturing input (and the user opted into it) it's relatively sensible.

Exclusive mode fullscreen applications will crush you anyway since the compositor turns off, but otherwise it seemed to work OK.

Re:Overlay.NET: An easy-to-use overlay library written in C# by snarfy on Sunday November 13, 2016 @10:21PM (#12947297)
> Are there? I would think that is a weapons race you cannot win.

You can win. One implementation is to have a separate thread whose sole purpose is to send set topmost messages in a tight loop (I've done this).

You win, or hang the UI up in a topmost live-lock.

Re:Overlay.NET: An easy-to-use overlay library written in C# by Someone on Monday November 14, 2016 @01:28PM (#12952019)
At best, I would call that "You win or you lose". Yes, there are all kinds of hacks that might give you a better chance, and you may be able to make it very likely you will get what you want, but to do so you have to be very naughty.

For example, another hack involves removing the real screen from the OS and creating a virtual screen of the same dimensions and bit depth, intercepting calls to the virtual screen, and essentially writing one's own compositor in the video memory of the real screen. If my program does that, your messages to move your window to the top will never work. Your window may end up on top on the virtual screen, but that's not what the user looks at. If you counteract by using the same trick, how do you know that want you think is the real screen isn't already a virtual one created by a program that ran earlier, of that a program running later doesn't enumerate the hardware and figures out where the real memory lies?

I also could try and patch your program when I detect it, patch it in memory to send fewer or no such messages, intercept its messages, or even crash it when I see it, etc.

It remains competition for a scarce resource; because of that, I don't see how two identical copies of such a program could both win, let alone if I run ten of them.