Commit Graph

1548 Commits

Author SHA1 Message Date
Yuxuan Shui
f5ee0e12e1 win: fix window not being rendered when it's mapped and damged while fading out
Consider these 2 cases:

* A window is mapped while fading out
* A window is mapped and damaged while fading out

From the perspective of map_win_start, these 2 cases look the same. The
window will has ever_damage = true in both cases. However, map_win_start
has to distinguish between these 2 cases, because at the end of
map_win_start, window in the first case cannot have ever_damage = true,
while window in the second case should have ever_damage = true.

Currently, map_win_start always clears ever_damage in both cases
(indirectly through win_skip_fading), which causes windows in the second
case to not be rendered when they should be.

This commit move clearing of ever_damage from unmap_win_finish to
unmap_win_start, so when map_win_start sees ever_damage = true, it's
always to second case. And to make sure windows which are fading out are
still rendered, we relax the ever_damage check in paint_preprocess to
also accept windows that are fading out. (see code comment for
explanation why this is fine)

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-04 03:46:49 +00:00
Yuxuan Shui
e66a452a27 win: skip fading out for window which aren't ever damaged
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-04 02:58:02 +00:00
Yuxuan Shui
1985360632 core: add trace log about why a window is/isn't painted
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-04 02:53:43 +00:00
Yuxuan Shui
c50e44a8f4 win: downgrade a debug log to trace log
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-04 01:52:19 +00:00
Yuxuan Shui
84ab55d730 win: fix win_is_real_visible
Forgot to negate the expression.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-04 01:07:44 +00:00
Yuxuan Shui
a7be1dc1ad [general]: add more debug logs
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-04 01:07:14 +00:00
Yuxuan Shui
2f2b0319d5 log: strip newlines for gl string marker
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-04 01:06:20 +00:00
Yuxuan Shui
95a64acf5a event, win: fix damage when window is moved while fading out
When a window is moved during fade-out, configure_win won't add the old
window extent to damage (because it's unmapping), but the new window
extent will be added to damage when the window is rendered. And the
window will be rendered in its new location. Thus the damage for the old
window extent is missing.

We could fix this by adding damage in configure_win for unmapping window
too. But in general we don't want to move a window while it's fading
out. So we shadow the window geometry. The shadow geometry is updated in
configure_win, and the update will only propagate to real geometry in
win_process_update_flags.

This also fix the case where a window is unmapped, moved, then mapped
all in the same render cycle. map_win_start is supposed to add the old
window extent to damage in that case, but the old window extent is
already overwritten when we reach map_win_start. The shadow geometry
fixes that.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-03 23:53:10 +00:00
Yuxuan Shui
e1bed6a84b config_libconfig: drop unnecessary warning
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-03 06:09:02 +00:00
yshui
bb54da0039 Merge pull request #544 from niacat/ctype
Cast argument to ctype functions to unsigned char

Fix `-Wchar-subscripts` warnings on NetBSD
2020-11-30 22:42:46 +00:00
yshui
c634641c20 Merge pull request #551 from yshui/rounded-corners-legacy-xrender
Rounded corners for legacy xrender backend
2020-11-30 01:08:49 +00:00
Yuxuan Shui
cb41ea9644 sample config: add corner-radius and rounded-corners-exclude
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-11-30 00:35:43 +00:00
Yuxuan Shui
0e7b972830 man: add note about rounded corners and transparent clipping
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-11-30 00:35:41 +00:00
Yuxuan Shui
69d4199daa Add rounded-corners-exclude configuration option
Allows the user to selectively disable rounded corners.

Authored-by: Samuel Hand <samuel.d.hand@gmail.com>
2020-11-30 00:35:40 +00:00
Yuxuan Shui
430be62b63 Rounded corners for legacy xrender backend
Authored-by: Samuel Hand <samuel.d.hand@gmail.com>
2020-11-30 00:35:34 +00:00
Samuel Hand
e20b187912 options: add corner-radius
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-11-30 00:31:52 +00:00
yshui
fb38bf021e Merge pull request #546 from yshui/window-state-update
win: rework how events for unmapped windows are handled
2020-11-29 00:20:25 +00:00
Yuxuan Shui
0f975616d6 core: ensure stale flags aren't set in destroy_backend
After 60f733d17c, we can be sure stale
flags won't be seen in destroy_backend.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-11-29 00:14:02 +00:00
Yuxuan Shui
60f733d17c core: don't call map_win_start in handle_new_windows
Set WIN_FLAGS_MAPPED instead, it will be handled later. Previously, we
call map_win_start because we need the geometry of the window, which is
updated in map_win_start. Now, we get the geometry in fill_win, so
map_win_start is not needed anymore.

Eliminate a case where destroy_backend could see IMAGES_STALE flags set
on windows.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-11-28 22:49:18 +00:00
Yuxuan Shui
e49ef2ccd8 core: always clear stale flags in destroy_backend
Reference: https://github.com/yshui/picom/pull/546#discussion_r532054960

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-11-28 20:29:36 +00:00
Yuxuan Shui
862d96d609 testcases: add a test case for #525
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-11-28 20:29:35 +00:00
Yuxuan Shui
1b4dacf2c2 win: add assertion ensuring flags of unmapped windows aren't processed
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-11-28 20:29:34 +00:00
Yuxuan Shui
2d54942295 testcase: add redirect_when_unmapped_window_has_shadow
While working on this PR, I introduced a bug where shadow images for
unmapped windows aren't properly recreated after unredirect/redirect.

The shadow image is freed during unredirect, OTOH redirect only set
IMAGE_STALE flags for mapped window, thus the shadow images for unmapped
windows will be missing.

This bug is already fixed in the previous commit. But the testcase is
good to keep nonetheless.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-11-28 20:29:31 +00:00
Yuxuan Shui
a56d66b4f3 win: rework how events for unmapped windows are handled
Make unmapped window events work mostly like a mapped window, except
flags set on unmapped windows aren't processed until the window is
mapped.

Hopefully this unifies some of the code paths and reduce corner cases.

Should fix #525

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-11-28 20:29:25 +00:00
Yuxuan Shui
bf5a9ca154 tests: don't call .check() in set_window_size
So we can bundle this request together with other requests, making
reproducing time critical bugs easier.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-11-28 19:49:15 +00:00
Yuxuan Shui
fb35feb54e tests: make trigger_root_configure into a 2-step process
This is to allow us sending the root configure request together with
other requests. Making it easier to reproduce timing critical bugs.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-11-28 19:43:17 +00:00
nia
b14e85a6bc Cast argument to ctype functions to unsigned char
Per POSIX, "The c argument is an int, the value of which the application
shall ensure is a character representable as an unsigned char or equal
to the value of the macro EOF. If the argument has any other value, the
behavior is undefined."

https://pubs.opengroup.org/onlinepubs/009604499/functions/isspace.html

Signed-off-by: Nia Alarie <nia@NetBSD.org>
2020-11-19 12:19:35 +01:00
Yuxuan Shui
248bffede7 Fix non-opengl build
Oops

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-11-03 19:03:07 +00:00
Yuxuan Shui
c9f75a53d9 core: fix leak of argb_fbconfig
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-11-02 18:43:12 +00:00
Yuxuan Shui
e3582cd996 legacy backend: render: fix leak of fbconfig
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-11-02 18:23:38 +00:00
Yuxuan Shui
685e5a9aac config_libconfig: allow overrides if supported
Related: #530

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-10-29 09:38:05 +00:00
yshui
8b3e70b40b Merge pull request #531 from omar-polo/next
silencing some compiler warnings
2020-10-28 23:27:38 +00:00
Omar Polo
7eddf79ed2 wrap subobject initialization with braces to silence a warning 2020-10-28 20:27:01 +01:00
Omar Polo
eeaba75a62 use the correct format control for uint64_t 2020-10-28 20:07:14 +01:00
Bernd Busse
3d358a06f2 event: Add missing check if window is managed before setting flags 2020-10-25 12:36:09 +01:00
Yuxuan Shui
9c7f852031 ci: freebsd: add missing dependency
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-10-25 07:03:29 +00:00
Yuxuan Shui
6b3a1e4e14 ci: build test for FreeBSD
Make sure picom builds on FreeBSD

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-10-25 05:23:53 +00:00
Yuxuan Shui
27d59dbb30 picom: get max hostname length with sysconf()
For FreeBSD compatibility, which doesn't define HOST_NAME_MAX.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-10-25 03:13:03 +00:00
Yuxuan Shui
02daff8bc8 README: fix typo
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-10-25 02:57:34 +00:00
Yuxuan Shui
ae62269eb7 Merge remote-tracking branch 'fix/clear-shadow-stale-on-unmap' into next 2020-10-23 17:27:40 +01:00
Yuxuan Shui
dfe4a362e2 win: clear more stale flags when destroying a window
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-10-23 17:22:15 +01:00
yshui
1ce8012519 Merge pull request #522 from tryone144/clang-analyzer-errors
Fix/silence memory errors reported by `scan-build`.
2020-10-23 17:06:27 +01:00
Yuxuan Shui
f5370a1ec0 tests: fix comments
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-10-23 17:02:54 +01:00
Yuxuan Shui
be91b443a8 tests: add testcase for 22162cb7e2
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-10-23 16:54:46 +01:00
Yuxuan Shui
22162cb7e2 win: don't add damage when changing shadow setting while unredirected
When the screen is unredirected, no window have a shadow image. So the
assertions in win_set_shadow don't hold. But in that case, we don't want
to add damages anyway. So we put them behind a check of whether the screen
is redirected.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-10-23 16:44:21 +01:00
Bernd Busse
337831e094 Fix memory errors reported by scan-build.
- Fix non-critical memory-leak in `picom.c` and `options.c` where we
don't free all allocated memory before dieing.

- Explicitly allocate new branch in `c2.c` to silence false-positive
memory-leak.
2020-10-23 17:20:59 +02:00
Yuxuan Shui
3576a92da3 x: wid_get_text_prop shouldn't return 0 strings
Downstream code expect wid_get_text_prop to return at least 1 string.
However wid_get_text_prop would return 0 strings when the property is
set to an empty string.

Fixes: dc37370a66

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-10-23 15:16:11 +01:00
Bernd Busse
1a720edbad win: clear SHADOW_STALE in destroy_win_start
Clear both STALE flags (`IMAGES_STALE = PIXMAP_STALE | SHADOW_STALE`)
when destroying windows (see f493447b33).

Clearing `SHADOW_STALE` as well should eliminate the recreation of a shadow
image for a window currently being destroyed which will cause the
rendering to fail because we can't properly update the flags anymore.

Should fix: #394
2020-10-23 15:46:37 +02:00
Bernd Busse
f53fbdccca Add testcase for #394 2020-10-23 15:46:37 +02:00
yshui
6c6b1afeb3 Merge pull request #516 from yshui/no-xlib
x: remove the last bit of Xlib dependency
2020-10-23 14:19:00 +01:00