Commit Graph

233 Commits

Author SHA1 Message Date
Arda Atci
97d9c960e0 animations added, picom upstreamed yshui/next 2023-01-23 07:36:50 +03:00
Arda Atci
3b1930d2c6 fixed open window type anim, closes #12 2023-01-23 07:34:35 +03:00
Maxim Solovyov
7846b17c54 use _checked functions with xcb_request_check 2023-01-23 07:34:35 +03:00
Evgeniy Baskov
ad5a042803 win: consider border when creating the mask image
With rounded corners, X11 native border and blur enabled, left and
bottom 2*border_width pixels were not blurred, since mask did not
include border_width, only content width and height.

Create mask image with dimensions that include border width.

Signed-off-by: Evgeniy Baskov <j-basevgser@yandex.ru>
2023-01-23 07:34:35 +03:00
Yuxuan Shui
89690c9843 win: fix leaking of the mask image
destroy_win_finish doesn't call win_release_images to free the images,
so we need to add a release_mask call there.

Related: #892

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-01-23 07:34:35 +03:00
Yuxuan Shui
1434881567 win: assert we won't clobber existing mask
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-01-23 07:34:35 +03:00
Alp
f7596fd43a rounded corner delay fix 2023-01-23 07:34:35 +03:00
Stefan Radziuk
1e5de4067b picom upto date sync with yshui, full anim support 2023-01-23 07:34:35 +03:00
Yuxuan Shui
04b80760d8 win: fix leak in win_bind_mask
Related: #905

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2023-01-23 07:33:56 +03:00
Arda Atci
f6b0b04f5b picom upto date sync with yshui, full anim support 2022-10-04 00:24:05 +03:00
Yuxuan Shui
9ac046c2ba backend, win: create shadows with shadow_from_mask
Do this for shaped, and rounded windows.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2022-08-26 05:43:19 +01:00
Yuxuan Shui
84407099a9 backend: give backends more flexibility regarding shadow creation
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2022-08-26 05:42:51 +01:00
Yuxuan Shui
9b419504e8 backend: add the make_mask interface
This is used to create image masks that can be used to mask out
`compose` regions. For example, this can be used to mask out window body
so shadow won't be painted on them.

This could be more efficient than using rectangular regions for masking,
when there are a large number of rectangles; or more flexible, in the
case of window with rounded corners.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2022-08-24 08:39:21 +01:00
Yuxuan Shui
7e607bfe81 Make experimental backends the new default
Experimental no longer.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2022-08-21 06:09:27 +01:00
Bernd Busse
5577363aaf win: keep track of window specific shader in managed_win 2022-08-11 04:29:47 +01:00
ktprograms
4dfb979c52 Fix segfaults on 32bit arch with --log-level=debug
There were a few improper uses of %ld for 64 bit numbers, as well as
some other 32 bit related warnings that I've fixed.

Signed-off-by: ktprograms <ktprograms@gmail.com>
2021-11-25 10:52:31 +00:00
Bernd Busse
4b5cc050d5 Add clip-shadow-above configuration and wintype option
Added the new `clip-shadow-above` configuration and wintype option.
These allow the user to select windows to clip from the shadow region of
other windows, i.e. don't paint shadows on top of them.

This should provide a more useful and userfriendly alternative to the
deprecated `shadow-exclude-reg` option — especially for docks and bars.
2021-07-14 14:43:28 +02:00
Bernd Busse
83c19491b8 win: use correct geometry in calculation of window frame region
Use window geometry (width, height) including border-width as the base
for frame region calculation with `_NET_FRAME_EXTENTS`, instead of
including the extents themselves.
Fixes issues where the frame would get incorrectly blurred *outside* the
window area.

fixes: #413 #590

related: fb3305fb9b
2021-07-09 19:27:37 +02:00
bhagwan
d9bfd0192d legacy glx: extend the border into the corners when they are rounded
Authored-By: bhagwan <bhagwan@disroot.org>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-04-12 01:54:00 +01:00
Yuxuan Shui
f5fb2648fd x: remove more of session_t parameters
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-26 07:51:03 +00:00
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
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
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
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
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
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
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
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
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
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
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
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
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
Yuxuan Shui
dc37370a66 x: remove the last bit of Xlib dependency
Of course, we still use GLX, so we can't completely remove Xlib yet. But
this removes all Xlib uses outside of the backends.

This drops support for COMPOUND_TEXT Xorg strings, so people how wants
multilingual support has to use UTF8, which should be fine since most of
the applications support that.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-10-23 07:58:01 +01:00
Yuxuan Shui
e53ac7a6f9 event, win: delayed handling of shape notify
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-10-23 04:37:38 +01:00
Yuxuan Shui
f476a78ad1 event: don't eagerly add damage for configure notify
If a window receives multiple configure notifies in between 2 frames, we
add all the in between positions into damage, when we really just need
the starting and the end position.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-10-23 04:27:35 +01:00
Yuxuan Shui
35b4e82085 win: cache the result of fade-exclude rules
So we don't need to call c2_match every frame something is fading. Also
saves us from some out-of-critical-section X server queries.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-10-23 02:08:34 +01:00
Yuxuan Shui
21e9aab6b6 event: set WIN_FLAGS_FACTOR_CHANGED on tracked property change
Previously, when some explicitly checked property (e.g.
_NET_WM_WINDOW_OPACITY) changed, it won't trigger a
win_on_factor_change, and the rules will not be re-evaluated. Because
that property stale flag will be cleared after we explicitly check the
property, so it won't be detected as a tracked property change.

Here, we instead set WIN_FLAGS_FACTOR_CHANGED directly when a tracked
property changed.

Fixes: f3ff7eff8c

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-10-23 01:58:12 +01:00
Yuxuan Shui
a099678664 win: delayed handling of configure notify
Part of the configure notify handling which requires querying the X
server, has been moved into the X critical section.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-10-23 01:36:04 +01:00