Previously if we unredirect the screen while a fading is in progress, we
will "resume" the fading when we redirect the screen again.
This is usually fine unless the window being faded out is destroyed. we
still tries to fade it out, but since we don't have the pixmap of the
window anymore (freed by unredirect), we will generate lots of errors
until the window is completely "faded out".
Also this change makes it easy to reason about things. Now we know when
the screen is unredirected, all the windows can either be in MAPPED or
UNMAPPED state, nothing else.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
After converting from struct conv to xorg format, cache the result to
save CPU time.
And remove an unused function.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Instead of storing them as an array of xfixed.
Might cause some performance overhead for the new backend, because
it is allocating a buffer to do the conversion every frame. Will fix
later.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Destruction of Input Only windows is erroneously ignored by commit
cea010a, causing future window with the same window id as the destroyed
Input Only window to be treated by an Input Only window even when they
are not. The end result is that some windows don't show up.
Also improved the comments in win.c.
Fixes#119
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
A side effect of this is that some window properties are allowed to
change during fade-in/out. (e.g. window background can become blurred
during window fade out if window properties changed so blur is requirired).
But it is unclear what is the expected behaviour in this case anyway, so we
choose the one that is simpler to implement.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Window state tracking is basically the back bond of window fading. We
add a new enum field to the win struct to track the state of the window,
instead of using a set of boolean variables. We also remove the fading
callbacks, since it is only used for fading, so the potential of code
reuse is lost. And it makes the code slightly harder to understand.
Also fixed a problem that --no-fading-openclose is not behaving as
advertised (from my observation, enabling this flag disables fading
entirely, instead of just diabling it for open/close).
Also uses double for opacity everywhere internally. Use opacity_t only
when setting X opacity prop.
TODO: Remove win::*_last
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Handle SIGINT using libev's ev_signal handler, instead of using
sigaction().
Fixes#64. But compton might miss signals when it's not in the main loop
(e.g. when compton is reset), and thus not exit "clearly". It should
cause any real problem though, so we don't care.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Put them all into one function, and move the function pointers out of
glx_session_t, making them global variables (because them don't change
after initialized). Remove the function pointer typedefs and replace
them with the ones in glxext.h
We also only lookup the functions once per a lifetime of compton.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
In X, background pixmap is tiled (meaning they are repeated to filled
the window) by default. So, in the glx backend, we mimic this behavior
by binding the background pixmap of the root window (aka, the wallpaper)
to texture that repeats.
Fixes#107
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
If fork is requested, we fork as early as possible, way before anything
is initialized. This way, we don't need to do the gymnastics to make
OpenGL work properly across fork.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Replace most of XFlush with xcb_flush.
Also, in a lot of places, XFlush is used as if it is XSync. Replace
those cases by using xcb's _checked version of functions and
xcb_request_check.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>