1

I adopted the code from this answer in order to draw an overlay window, which stays on top of all windows, always. But I find that this window keeps flickering whenever there is a keypress or a button click. I wanted to know if this can be stopped somehow. Increasing the time did not help me, as my terminal was frozen for few seconds when I increased time to 5000000000

The code was tested on Ubuntu 16.04 LTS.

Bms bharadwaj
  • 483
  • 5
  • 18
  • So... you have some code, which opens up a new window, draws to it and then hides the window again (=makes the content below it visible again). Possibly 200 times per second. And you ask why this flickers. Did I understand that correctly? If so, would you accept an answer saying "because you release the overlay window, which means your drawings disappear all the time"? (No, I do not know what this has to do with keypresses or buttonpresses.) – Uli Schlachter Jan 07 '19 at 20:10
  • Sorry for the delay in response. You have understood my question rightly. And as per the comment, I tried removing the `XCompositeReleaseOverlayWindow()` from the loop. But it still flickers. In fact, apart from drawing the overlay, I have another process running within the loop (something that requires a good amount of computation). So is that the reason for this flickering ? – Bms bharadwaj Jan 08 '19 at 18:01
  • Well, I can only guess. My next guess would be that you are using a compositing manager that also uses the overlay window and whenever the compositing manager redraws the screen, your overlay is erased. But these are all guesses. – Uli Schlachter Jan 09 '19 at 20:43

1 Answers1

1

I could not find a solution using the XComposite suite of functions. However, you can easily achieve the same effect with (in my opinion) much more flexibility and pure X11 via CWOverrideRedirect. You can see example usage for it here: https://stackoverflow.com/a/57780772/4204557

Asad-ullah Khan
  • 1,573
  • 18
  • 22
  • 1
    This method was really spot on. I was successfully able to place the X window on to the top and neither Alt+Tab nor clicking on other icons brought other windows over it. Thanks a lot!! – Bms bharadwaj Apr 13 '20 at 11:40