Drawing on top of every windows on X11 - ruby

I am trying to make an arcade machine. The user will purchase credits, which will allow him to play for X minutes. I want to write "9:42 minutes left" at the left corner of the screen, even if he's playing a full screen game (UrbanTerror, for example).
I would really like if I could do this with Ruby, but any other language is OK. Any ideas?
Thanks in advance.

A good example of such an application is XOSD.
Problem is, that will probably fail over any GLX context, which is what fullscreen games like Urban Terror work with. Even if it would draw, the game will overdraw it almost instantly, so the best thing you would get is heavy flicker.
Probably you are better off with a cheap hardware solution, like a small secondary display (there are some USB 7" displays out there) or a LCD device. I would even claim that's good for usability.
Perhaps this is of help for you, but I don't know whether it works for several applications and fullscreen mode applications:
http://doc.trolltech.com/3.3/opengl-x11-overlays.html
The idea is to use a special overlay capability of the graphics card, which is typically used for popup windows. Perhaps you can create such an overlay at the topmost level and it will also work in fullscreen -- perhaps not.

Related

Changing how windows displays using Win API?

While I have some experience with the WinAPI I do not have a ton, so I have a question for people who do have much experience in it. My question concerns what the limit of our power is. Can we change how windows fundamentally displays?
For example, can I cause windows to render a screen size bigger than the display and pan across it, kind of like workspaces but without separation? Can I apply distortion to the top and bottom of the screen? If distortion is not possible can I have an application mirror what windows is displaying with very little delay?
The biggest question I have is the first one, because if I can make windows render virtual workspaces and pan seamlessly between them then I figure it is possible to make a separate application which handles the distortion on a mirrored image of the desktop. Again, apologies for the vague questions, but I really want to know if we are able to do this stuff, at least in theory, before I dive deep into learning more on the API. If the WinAPI does not allow it is there another way to do this kind of stuff in Windows?
EDIT: Some clarification. What I want to do is basically extend the desktop to a very large size (not sure on exact size yet), both vertically and horizontally. Section the large desktop into workspaces of a specific size which can seamlessly be transitioned across and windows moved across. It would transition workspaces based on a head tracking device and/or mouse movement. Note that when I say workspaces this could be achieved by zomming in and then panning the zoom as well. I also need to be able to distort the screen, such as curving the edges, and render the screen twice. That is the bare minimum of what I am wanting to do.
Yes, you can. The most feasible way I come up with is using a virtual graphics driver (like what Windows Remote Desktop does, which creates a virtual graphics card and a virtual display). Sadly you will lose the ability to run some programs needing advanced graphics API (such as 3D games, 3D modelling tools or so).
There're some examples:
http://virtualmonitor.github.io/
https://superuser.com/questions/62051/is-there-a-way-to-fake-a-dual-second-monitor
And remember Windows has a limit on display resolution (for each and for altogether). I don't remember the exact number but it should be less than 32768*32768.

Similar web UI experience as we see on Windows Phone 7

I like Windows Phone 7's interface experience. I find it very innovative compared to other interfaces (be it mobile, desktop or web). Yet it's still no less usable. All in all a very good shift from the usual in the right direction.
Some of the effects could be used in web interfaces to enhance the experience without sacrificing usability and intuitiveness.
Effects I'm talking about:
perspective animation when you click on a particular hub on the home screen)
elements executing animation in different times (hub being clicked moves last)
horizontal slide with different slide amounts (titles and background images move less than screen width which gives it a feeling of depth dimension)
etc.
2 questions
Do you know of any public website that uses at least one of the aforementioned effects and does that without the use of plugins (like Flash or Silverlight)?
Is there any JavaScript library that would provide such effects (at least the different delay and different amount sliding technique)?
Extremely simplified example
I've taken some time to put up a simplified example of transition effect that could be adopted on mobile devices and simulates at least a bit of the fine Windows Phone 7.x transitions.
Just click on any tile and see others zoom out and slide to left.
Let me know what you think about this example.
Something came out just these days
Take a look at this HTML demo written by Microsoft (or one of its partners). Blew my mind away as being the closest to WP7 experience! Amazing!
The delay and sliding should be easily handled by jQuery, but I am not aware of someone who has alredy bundled up something to directly emulate the WP7 interface. Sounds like a fun project.

Performance issues with the TransitioningContentControl in Windows Phone 7

When using the TransitioningContentControl and a Panorama, I cannot seem to get any good performance when I am navigating from one page to another.
I have been implementing a basic Flip animation, where the current content gets flipped out and the new one is flipped in, but the apps FPS drops to less than 20FPS which means you never get to see the first half of the animation, which is a real pain...
How can I ensure that the animations runs so that the phone can handle the transition?
I dont think its my panorama, its not that full of stuff...
Is this on the emulator or on an actual device? From what i've heard, depending on your hardware, the CPU performance is better on the emulator, but the graphics performance can be much better on an actual device.
Are you transitioning to to the panorama or from the panorama? If you're transitioning to it, can you "delay load" the content of the panorama items' lists?

Why doesn't OS X have the same flickering problems that Windows does?

I was reading Larry Osterman's latest blog post about debugging a flickering problem in the Windows Vista/7 volume control, and I suddenly realized that I can't recall ever seeing an application flicker on my OS X laptop. Even applications that otherwise seem to be poorly written avoid the flicker problem in my experience. Without this turning into an Apple vs Windows debate (please), why do OS X applications not seem to have the same flickering problem?
I have trouble believing that Apple developers are simply amazing at programming flicker-free GUIs, while Windows programmers suck, so what's the reason? Does the OS X API require all GUIs to implement double-buffering? While some apps have the slightly sluggish double-buffered resize behavior, many don't, and they still avoid flickering. Is the OS X repaint flow somehow fundamentally different from Windows, avoiding the WM_ERASEBKGRND problem entirely? Or is there some other possibility that I'm not seeing?
Update: Thank you for your answers. I wish I could select both ken and cb160's answers, because they are both helpful.
Mac OS X has double buffered windows.
You don't have to do anything to make it happen. It's behind the scenes.
You (almost always) don't explicitly draw to a window in Cocoa when something changes, you invalidate a region of the window. The framework will later descend the hierarchy of views and draw the dirty regions of the window into a secondary buffer. Then it swaps the buffers.
You can optionally make some promises that allow the framework to take shortcuts when redrawing, but they're all opt-in. Only savvy views are affected.
If your subclass of NSView implements the isOpaque method to return YES, then the framework will never clear anything behind your view or draw any of the views under it.
Implementing preservesContentDuringLiveResize to return YES gives you some extra responsibilities, but can improve performance during window resizing.
10.6 added another two new APIs of this sort, layerContentsRedrawPolicy and layerContentsPlacement.
Last, custom drawing is less common than on Windows. The majority of views you see are framework-supplied and not subclassed. Framework-supplied means optimized-by-apple.
Both Windows Vista/7 and OSX use compositing engines to draw rasterised bitmaps on the screen. These compositing engines are responsible for processing output from all windows and drawing the final screen image. This compositing approach is how OSX is able to use the genie effect when minimizing to the dock and how aero draws the translucent borders. They also prevent flickering as if the bitmap to fill a particular area of the screen is not available, it will use the image it has already rather than drawing a blank region.
OSX has had a compositing engine since it first shipped. At the time, lots of people though this was a crazy appraoch as all the video cards shipping at the time wer optimized to draw bitmaps (ie, windows buttons and borders) and not composited images. In later versions of OSX, the compositing was pushed off to the GPU (in Quartz Extreme)and so took significant load off of the CPU and made more effects possible.
Because the Windows compositer was only added in windows Vista and then only when there was a GPU available and you had the right version of the OS, it is not as pervassive as the Quartz Compositer in OSX. Because the compositer is not always used in Windows, flickering will occur when a region is blanked and the application responsible for drawing is not able to redraw the region qucikly enough.
Yup, it's all double buffered automagically. Of course, if you are running
legacy code from mac os 9, or code ported from windoze, that mean's you're
probably triple buffering without knowing it. Hey, cycles are cheap!

Is it possible to create full screen color overlay effects in windows?

I remember my old Radeon graphics drivers which had a number of overlay effects or color filters (whatever they are called) that would render the screen in e.g. sepia tones or negative colors. My current NVIDIA card does not seem to have such a function so I wondered if it is possible to make my own for Vista.
I don't know if there is some way to hook into window's rendering engine or, alternatively, into NVIDIA's drivers to achieve this effect. While it would be cool to just be able to modify the color, it would be even better to modify the color based on its screen coordinates or perform other more varied functions. An example would be colors which are more desaturated the longer they are from the center of the screen.
I don't have a specific use scenario so I cannot provide much more information. Basically, I'm just curious if there is anything to work with in this area.
You could have a full-screen layered window on top of everything and passing through click events.. However that's hacky and slow compared to what could be done by getting a hook in the WDM renderer's DirectX context. However, so far it's not possible, as Microsoft does not provide any public interface into this.
The Flip 3D utility does this, though, but even there that functionality is not in the program, it's in the WDM DLL, called by ordinal (hidden/undocumented function, obviously, since it doesn't serve any other purpose). So pretty much another dead end, from where I haven't bothered to dig deeper.
On that front, the best we can do is wait for some kind of official API.

Resources