I am on Ubuntu 14.04 platform, I am trying to make a rubberband for my screencasting project. I found rubberbanding examples which used xlib but I got flickering and partially missing rectangle while dragging mouse. I wonder if it's specific to my system or xlib library deprecated? Is there a workaround to fix it?
I also noticed that imagemagic's screen location grabbing command import window.miff
flickers the same way.
Here are the codes that I tried
It just looks like the terminal in the background is repainting itself. You could always be selfish, and do an XGrabServer()
, which WMs that use rectangles when moving/resizing windows do. Nothing else on the screen (clocks, load monitors) will update until you release the grab.
Server grabs should be avoided. You may want to add a --grab/--nograb
option to let the user decide whether they prefer avoiding visual artifacts or let other applications (movie players, load monitors, clocks, ...) update the screen during the rubberbanding.
Another option would be to use a translucent window instead of an outlined rectangle, similar to how modern window managers tend to move/resize windows using real windows instead of rubberbands (even when that probably means repainting the window a lot of times before the operation is finished, for remote X move/resize with rubberbands is definitely better behaved).
Examples of XGrabServer()
being obnoxious:
XGrabServer()
while resizing windows freezing video playing on other windows, and playing havoc with streaming network connections.XGrabServer()
.