Don't use idle fence. There is no reliable & portable way to obtain a
fence Present will like. Intel driver wants a DRI3 fence, NVIDIA driver
doesn't support DRI3, and wants a XSync fence (I am not even sure, since
Present doesn't really work with the NVIDIA driver. And using the fence
on NVIDIA driver causes compton to use 100% CPU).
Just don't bother.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Window size change cause window resource to be released and re-acquired,
so it cannot work on unmapped windows.
Previously we make sure of that by skipping fading and change if the
window is mapped. Now we just make sure that functino is never called
with an unmapped window.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
If a window is being faded out because of unmapping, don't handle its
configuration notify. Avoid freeing pixmap of a window that is being
faded out, because that will cause paint to fail.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
win_update_focused transition window into FADING without checking their
current state, resulting into unmapping windows being brought into
FADING state and stops unmapping.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Previously it is initialized by win_update_bounding_shape, so
configure_win is called when win_data == NULL and state ==
WSTATE_MAPPING, which is an invalid state for a `win` to be in.
Now map_win explicitly calls backend->prepare_win. This is not very
efficient since win_update_bounding_shape will reinit it.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
* Make some functions in win.c pure
* Remove unused code
* Fix misuse of attr_const, const functions shouldn't exam data pointed
to by its pointer arguments.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
When destroying a window, set window->next->reg_ignore_valid to false,
since its reg_ignore is not valid anymore.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Only case where you want to map window in add_win() is during compton
startup, when compton is registering existing windows. Otherwise,
add_win() is always called for newly created windows, so there will
always be a MapNotify coming up for that window. If we map newly created
windows in add_win(), we will try to map it a second time when the MapNotify
arrives.
So, just don't call map_win() from add_win(). For compton startup, we
explicitly call map_win() after calling add_win() in session_init.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
If a window is destroyed and starts to fade out when screen is
unredirected, when the screen become redirected again, we will generate
errors when trying to render that window.
Also make sure the assumption that all window are either MAPPED or
UNMAPPED when screen is unredirected holds.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
paint_preprocess takes head of the window list as an argument. The
actual head of the window list might be freed and deleted during processing
of fade, but paint_preprocess will keep using the old head of the list,
thus uses freed memory.
Solution is just don't pass the head as an argument. paint_preprocess
will use session_t::list directly.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Now both the old and the new backends are compiled in, the user can
choose which one to use with a command line switch.
Lower the barrier for testing.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
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>