Commit Graph

1570 Commits

Author SHA1 Message Date
Yuxuan Shui
d61fa6eb0c x: restrict the scope of arguments taken by x_get_prop*
They only need a xcb_connection_t, don't need to pass the whole
session_t.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-26 07:39:21 +00:00
Yuxuan Shui
e3d4ce6612 cache: add cache_set for testing
Also add documentation for the cache functions.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-26 07:25:34 +00:00
Yuxuan Shui
1df3360989 diagnostic: warn the user if they are using a software GL renderer
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-23 03:11:25 +00:00
Yuxuan Shui
b66e5fd422 win: sanitize _NET_FRAME_EXTENTS values
Shouldn't crash picom for window manager bugs.

Related: https://github.com/yshui/picom/issues/270#issuecomment-748210643

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-18 23:45:11 +00:00
Bernd Busse
cce531a5ed opengl: fix warning about unused variable 2020-12-17 23:19:53 +01:00
Bernd Busse
a335eed0b5 c2: Fix scope of predefined target in leaf-matching
Keeping pointers to variables with smaller scope is unsafe as the
compiler might choose to optimize them out.
2020-12-17 11:37:19 +01:00
yshui
2e2b1eeeb1 Update README.md 2020-12-17 00:25:57 +00:00
Yuxuan Shui
896c1a7702 render: restrict painting region of glx_round_corners_dst
Mistake during rebase.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-16 23:34:53 +00:00
Yuxuan Shui
06c58d0b8e render: avoid left shifting negative values
It's undefined behavior.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-16 22:55:33 +00:00
yshui
79f1d4e79d Merge pull request #558 from yshui/rounded-corners-legacy-glx2
Rounded corners for legacy glx backend
2020-12-16 21:22:15 +00:00
Yuxuan Shui
0f5f013b96 Rounded corners for legacy glx backend
Authored-by: bhagwan <bhagwan@disroot.org>
Authored-by: Samuel Hand <samuel.d.hand@gmail.com>
2020-12-16 18:10:36 +00:00
Bernd Busse
8802057ff3 Merge pull request #550 from tryone144/property-array-matching
c2: Perform matching against "all" property values with special index `[*]`
2020-12-15 22:52:45 +01:00
Bernd Busse
5989477b9f c2: Support matching against "all" property values with special index [*]
When matching against custom window properties or atoms perform the
matching against all available values using logical OR if the special index
`[*]` is specified. If no index is specified, we fall-back to the first
value.

This should help when an atom has multiple values and you only want to
check against any of these — e.g. hiding windows with state `hidden`:
`--opacity-rule "0:_NET_WM_STATE@[*]:32a *= 'HIDDEN'"` — without having to
explicitly specify each index separately or when the index is not known
in advance.

Updated the manpage with examples for hidden and sticky windows.
2020-12-15 22:32:07 +01:00
yshui
22948417b3 Merge pull request #568 from SebastienWae/nodisplay
Hide picom from application menus
2020-12-15 17:34:59 +00:00
yshui
8d2a06afb4 Update README.md
Fixes #566
2020-12-15 14:55:59 +00:00
Sebastien Waegeneire
84cc31450d set .desktop files to NoDisplay=true 2020-12-14 14:54:33 +01:00
Yuxuan Shui
af99101757 win: update screen after win_on_win_size_change
win_update_screen needs w->widthb/heightb, which is only updated in
win_on_win_size_change

Related: #554

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-05 23:01:16 +00:00
Yuxuan Shui
3c38b36f04 win: move win_update_screen from fill_win into win_process_update_flags
fill_win only sets the pending geometry (aka the shadow geometry) of the
window, we have to wait for it to propagate to the real geometry before
we can update the screen.

Related: #554

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-05 11:11:16 +00:00
Yuxuan Shui
ef9f09b68a core: don't add damage in handle_new_windows
Since commit 95a64acf5a, fill_win doesn't
set the window geometry anymore, so we can't use it in
handle_new_windows.

However, we don't need to add damage in handle_new_windows anyway,
damage will be added later when the MAPPED flag is handled.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-05 11:04:55 +00:00
Yuxuan Shui
80b35806f1 win: add debug logging to win_update_screen
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-05 11:03:55 +00:00
Yuxuan Shui
8be379db4d win: fix fading always skipped by unmap_win_start
Fading skip needs to be based on the original value of w->ever_damaged.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-04 04:22:48 +00:00
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
Bernd Busse
d96abca075 x: split out function to get property info (type, format, size in bytes) 2020-11-30 16:15:25 +01: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