Commit Graph

1130 Commits

Author SHA1 Message Date
Yuxuan Shui
d397b307dd backend: set corner radius property
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-10-23 12:53:17 +01:00
Yuxuan Shui
6d72bf2974 options: don't disable rounded corner for new backends
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-10-23 12:53:12 +01:00
Yuxuan Shui
1fec938740 backend: gl_common: handle corner radius property
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-10-23 12:22:29 +01:00
Yuxuan Shui
de31cd4096 backend: add new image property: corner radius
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-10-23 12:21:52 +01:00
Yuxuan Shui
ad18d129cc docs: explain the detect-client-leader option better
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-09-22 15:44:33 +01:00
Istvan Petres
de959f910b Fixed ugly dark shadows in case of smaller window than shadow radius. (#695) 2021-09-21 18:01:18 +02:00
Bernd Busse
1dbffec3ae backend: gl: do not use larger-than-screen textures for blur buffers
Blur-texture sampling has been changed to `CLAMP_TO_EDGE` in commit
4b0ff37b36 and to using the buffer
textures at screen position instead of texture origin in commit
89c18afac6.

When using the above approach, expanding the buffer textures by the same
amount as the damage region is not needed anymore, as we cannot render
more than the screen region anyways. Having larger-than-screen buffer
textures might lead to a slight darkening at the upper and right edges
since we don't necessarily trigger the `CLAMP_TO_EDGE` condition in the
intermediate steps. This becomes apparent when using dual-kawase at large
blur-strengths with light backgrounds.

These changes do not affect the general approach of rendering a
larger-than-window region with the blur to accommodate the necessary
increase in damage region.

Related: 6d646b543f
2021-08-16 17:34:19 +02:00
Bernd Busse
78e8666498 core: fix rare double-free when xinerama update fails
Explicitly set `xinerama_scr_regs` to `NULL` after calling free() to
avoid freeing them again.

Under normal operation we free the old xinerama screen region list on
root screen changes and allocate a new one with the updated regions.
On rare occasions — mainly reproducable by changing monitors while DPMS
is in standby — updating the region list might fail as for whatever
reason the xinerama extension is marked as inactive. This would leave
us with an invalid pointer to the already freed region list we would
then attempt to free again on the next root screen change.
2021-08-04 17:32:44 +02: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
yshui
98fe8998c7 Merge pull request #657 from yshui/backend-improvements
Backend improvements
2021-07-14 10:46:52 +01:00
Yuxuan Shui
73c35c20f3 backend: remove unnecessary clone_image calls
No need to clone image to set_image_property, they are only needed for
image_op.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-07-13 22:14:30 +01:00
Daniel Kwan
976d0740fd Partially revert commit 0efdb6c; use glFinish only for non-NVIDIA 2021-07-10 18:14:20 -04:00
Daniel Kwan
e8147e0658 Set GL_MaxFramesAllowed=1 instead of GL_YIELD=usleep 2021-07-10 18:14:20 -04:00
Yuxuan Shui
d9836a6751 backend: fix NULL dereference when rendering inverted windows
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-07-09 19:15:16 +01:00
Yuxuan Shui
f44d6cd7c1 backend: remove a redundant if
set_image_property is a cheap operation.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-07-09 19:01:31 +01:00
Bernd Busse
b5ce81aa47 event: never ignore changed frame extents
Changes to frame extents were only tracked if the frame was visible, but
we have to keep this information current even for invisible frames to
(not) render the correct area.
2021-07-09 19:27:42 +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
Bernd Busse
c2aea1803e core: do not try to ignore xerrors before session is initialized
If the user has no access to the GPU, initialization of the GLX context
fails. In the legacy backend, this occurs BEFORE the session has been
successfully initialized.
At this point we cannot meaningfully filter xerrors as the session
hasn't been initialized yet. So we don't try to.
2021-07-06 16:26:37 +02:00
yshui
049d347f52 Merge pull request #648 from tryone144/fix-pixmap-texture-nvidia
nvidia driver does not support attaching pixmap texture to fbo
2021-07-06 12:44:20 +01:00
Bernd Busse
0c7e237a75 backend: xrender: Force 32-bit ARGB visual for alpha target pixmaps
Force a 32-bit ARGB visual when cloning pixmaps for
`IMAGE_OP_APPLY_ALPHA`.
Fixes non-transparent frames for 24-bit windows (without alpha-channel)
even when using `frame-opacity != 1`.

fixes: #342
2021-06-24 21:49:38 +02:00
Bernd Busse
bf79653fa2 backend: gl_common: Copy texture by explict rendering to framebuffer
At least on nvidia, binding the textures from a glx pixmap to a
framebuffer results in `GL_FRAMEBUFFER_UNSUPPORTED`. Instead of using
binding the source texture to a framebuffer and using `glCopyTexImage2D()`
to copy into a new texture, explicitly render the source texture to the
new texture attached to a framebuffer.

Fixes black/invisible windows on nvidia with `frame-opacity != 1`.

see: #647

related: 2a60836a9b
2021-06-24 18:59:34 +02:00
Bernd Busse
f11710a885 backend: gl_common: Add descriptive checks for framebuffer-completeness
Added more descriptive checks for framebuffer-completeness after adding
attaching textures (for the first time).
Also check for GL errors after `IMAGE_OP_APPLY_ALPHA`.
2021-06-24 18:59:24 +02:00
Bernd Busse
e09679c7cf backend: glx: Fix texture access in max-brightness calculation
Correctly unpack the inner `gl_texture` from the backend image.

related: 2a60836a9b
2021-06-22 22:00:23 +02:00
Yuxuan Shui
710e5fd7a0 backend: remove image operation BAKE
It's not used.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-06-20 06:59:55 +01:00
Yuxuan Shui
2a60836a9b backend: split image_op into image_op and set_image_property
Currently there is some inconsistency in how image_op is implemented
across backends. The glx backend applies some of the image operations
lazily, and not always in the order the operations were made; while the
xrender backend applies the operations eagerly. This can lead to
different render result in some cases.

Instead of trying to preserving the order of operations, which would be
unnecessary, we re-model the API to better reflect the implementation.
We make it clear that setting the property doesn't change the image
data, and properties are only applied during composition and in a
specific order.

This makes sure the render result looks consistent across backends.
Should also improve the performance of the xrender backend, even if only
slightly.

Also distill out the property management code so they can be shared.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-06-20 06:49:38 +01:00
Yuxuan Shui
21dfe20794 backend: rename copy -> clone_image
This feels more appropriate as this operation doesn't necessarily copy
data.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-06-14 01:58:30 +01:00
Yuxuan Shui
d9c9742132 backend: xrender: implement read_pixel
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-06-09 01:51:33 +01:00
Yuxuan Shui
1ada765436 backend: xrender: make backend functions static
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-06-09 01:36:09 +01:00
Yuxuan Shui
7ba87598c1 backend: gl_common: implement read_pixel
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-04-13 14:58:48 +01:00
Yuxuan Shui
6faafa95bf backend: add new API: read_pixel
Potential use: to read the border color of a window, so we could draw
rounded border when we round the corners of the window.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-04-13 14:53:57 +01:00
Yuxuan Shui
b2f9f80a28 legacy glx: store tex_scr location for round corner shader
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2021-04-12 01:54:07 +01: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
d974367a04 backend: xrender: remove root_pict from _xrender_data
It's unused in the backend.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-12-26 07:53:03 +00: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
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
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
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