If a window is unmapped, then mapped to a different position on screen
before fade out is completed (when fading is not enabled, it has to be
mapped again in the same frame), the old window content is left on screen.
This is because when this happens, we didn't add the unmapping window to
damage.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Looks like an empty argument is now the same as no argument. And
circleci complains about argument missing.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Using opacity_t for opacity_old resulting in opacity being rounded to 0.
This is fine until the opacity reaches 0, where the opacity != opacity_old
check fails and the damage is not added.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
If window is closed when fading is not enabled, the window might be destroyed
before we can add the window extent to damage.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
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>
Make sure before the mapping operation begins, the window is always in
UNUNMAPPED state. This makes it easier to reason about things, such as
resource availability, etc.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Previously we try to keep the image data until the rebind succeeds. This
way even if the rebind fails, we still have something to display.
But that triggers a NVIDIA driver bug. Basically you cannot have more
than one names (XIDs) of a window pixmap. NVIDIA driver doesn't like
that, and binding the pixmap with its aliases will fail. This can
sometimes happen if we name the new pixmap before freeing the old one during
rebind, and the pixmap doesn't actually change (i.e. the rebind is
unnecessary, could happen because of X event handling complications).
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Clear the STALE_IMAGE flag set by win_update_bounding_shape to avoid an
unnecessary image data invalidation.
Mainly to workaround a NVIDIA bug. For more detailed explanation, see
commit 8f67c6190c281955846589d8769385f30e7c5d23
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>
Setting glx-swap-method to value other than "undefined" and "buffer-age"
could potentially cause rendering problems. So remove them, the meaning
of the remaining options can be more precisely captured by "use-damage",
so create a new option under that name.
--glx-swap-method is deprecated in favor of the new option --use-damage.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
struct _glx_image_data needs to be freed even when refcount is not 0.
Also fixed a typo in glx_bind_pixmap.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Rectangle textures was used as a fallback when the driver doesn't
support non-power-of-two (NPOT) textures. Since we are using OpenGL 3.0 now,
which includes support for NPOT textures, we don't need this fallback
anymore.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>