reg_ignore_valid marks the validity of the reg_ignore of the windows
BENEATH the current window. That is, set `w->reg_ignore_valid = false`
doesn't invalidate `w->reg_ignore`.
When destroying window `w`, we need to invalidate all reg_ignore beneath
`w`. So it is not enough to just set `w->next->reg_ignore_valid =
false`, we also need to invalidate `w->next->reg_ignore`.
Yes, this variable name is confusing. Will be changed in the future.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
When the screen is not redirected, don't update the root image because
the backend is not initialized in this case.
Fixes a crash.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
paint_preprocess calls redir_start if it decides to redirect the screen.
redir_start might change the state of the windows. For example, when the
image of the window fails to bind, redir_start sets the error flag. And
those state changes might exclude the window from being rendered. Thus,
paint_preprocess should be re-run to make sure the new states are
honoured.
Fixes a crash when window images fail to bind after redirecting.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Previously, when the backend doesn't implement root_change(), we will
deinit, and then init the backend again. However, we didn't free all the
images previously returned by the backend. There is no guarantee that
these images will be valid across deinit/init.
So, make sure they are freed.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Instead queue up configure notification while the window is unmapped,
just update the window geometry when the window is mapped.
Simplify the logic a little bit.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Use a flag to mark whether the image needs update, and only update once
per frame.
Also refactor some common code into functions, and handle image errors
properly.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Choose the best vsync method for the user, instead of asking them to
frustratingly try every one of the options to see what works.
With this commit, the `vsync` option will take only a boolean value.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Refine the API of fill_rectangle and rename it to fill.
Extras:
Keep GL_BLEND enabled; Fixed some texture/fbo leaks
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Rational: current workaround for Composite < 0.2 doesn't work with the
GLX backend, it also doesn't handle window border properly. Plus,
Composite 0.2 came out more than a decade ago, it's safe to assume
everyone has it.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Handle backend initialization failure.
Also actually disable vsync when it's not supported in the new xrender
backend.
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>
* 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>
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>
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>