Previously, root ConfigureNotify is handled immediately, by resetting
the backend, which in turn releases all the window images. This puts all
the windows into a state where they don't have images attached, which
they really should be in when the screen is redirected.
(To expand a little, a window without images should only exist if:
* It's an unmanaged window.
* Screen is unredirected.)
Normally, this kind of window could be fine, as the next render phase
will re-acquire images for them. However, if a window in this state is
destroyed with fading enabled, then the render phase won't try to
acquire images for it, causing it to go into the main rendering function
without images attached, and trigger an assertion.
This commit delays the handling of root ConfigureNotify until the render
phase. This way, the images will be immediately re-acquired after they
are released, thus prevent this problem from happening.
Also adds a testcase for this.
Fixes#357
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
x_print_error aborts the program when it sees a redirect_subwindow
failure. A function called x_print_error really shouldn't cause the
program to terminate.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
In configure_root, the root pixmap is freed by destroy_backend, and is
never acquired again.
Usually this doesn't seem to cause any problems, maybe because we
immediately receives a root damage notification. But under rare
circumstances we ended up not showing the wallpaper.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Frame extents are only updated when the window has frame_opacity < 1.
However, window frames can have inherent transparency, and not having
the frame extents information for those windows breaks blur-background-frame.
Fixes#345
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
The focused state is a derivative state of the raw focused state (i.e.
whether the window is actually focused), with focus rules applied.
Here, we consolidate the calculation of the focused state into the
win_on_factor_change function, and replaced all calls to
win_update_focused with win_on_factor_change.
Also, the opacity update in win_update_focused is moved to
win_on_factor_change, as there could be opacity rules depending on the
focused state, so opacity must only be updated after
win_update_opacity_rule is called.
Related: #266#317
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Always refresh derivative window states in win_on_factor_change, without
checking if there are rules set.
c2_match is a no-op when there is no rules set. And we want to
consolidate derivative window state updates to one place,
win_on_factor_change is a good choice for that.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
The geometry returned by xcb_get_geometry doesn't include the window
border, so we have to include that when calculating the frame.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
In gl_image_apply_alpha, the call to _gl_fill uses 0 as the target
framebuffer, so the alpha is not applied to the target texture.
Fix that by using the correct framebuffer.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Previously some fiedls of gl_texture allocated in gl_image_decouple are
not initialized.
This commit replaces cmalloc with ccalloc to make sure the allocated
gl_texture is zero initialized.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Don't set win::flags to 0 in paint_preprocess, as that can break
assertions in other places. And there is also no need to do so as
win::flags are properly tracked regardless of the backend used.
Fixes#270
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Previously, when frame_opacity is < 1, we consider windows with frames to be
WIN_FRAME_TRANS immediately, without even checking if the body of the window
is transparent. The result is a transparent window is seen as a opaque window
with only a transparent frame, causing its background to not be blurred.
Fixes#211
Currently picom fails at register_cm(), which is before
print_diagnostics(), so we don't see anything.
This commit makes sure we keep going when there is another compositor
already running. However, in this case we need to be careful to not take
the overlay window, otherwise a poorly implemented compositor (for
example, picom) will stop working.
Also restructured the target window initialization logic and added some
comments explaining the logic.
Fixes#333
GLX context is released when it's no longer current in any threads, so
we have to release the context before destroy it.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Prevent a useless error message from glGetUniformLocationChecked, as
"opacity" is not used by the dummy shader, we will fail to get its
location.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
If the user is using custom shaders, picom will naturally fail to get
some uniform locations if the given uniform is not used in the shader.
So we really shouldn't report error for it.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
"notify" is the only wintype that has a name inconsistent with its Xorg
name. So fix that.
Compatibility code is added as well, so the old "notify" wintype name
still works.
Fixes#323
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
xdgh in xdg_config_home is not always allocated. This commit makes sure
it's always a valid pointer to free by strdup it.
With helps from @dtzWill
Fixes#326Closes#327
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
According to the XDG Base Directory Specification, relative paths in
XDG_CONFIG_DIRS are invalid, so eliminate them if found.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Fixed 2 problems:
1. Made sure the returned list is NULL terminated.
2. Allocate the duplicated string and the return list together, so the
duplicated string will be freed as we free the list. Fixed a memory
leak.
Fixes#324
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
While /dev/null is always empty, it still generates inotify events. So
using /dev/null as config file will cause the compositor to reset itself
frequently.
Not entire sure if only allowing regular files is sufficient, but we
will be doing this until an issue comes up.
Fixes#320
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Currently if the shadow image fails to bind, the entire window is marked
as having image errors. So nothing of that window will render, even if
the window image itself is fine.
The commit cause shadow to be disabled when shadow image fails, instead
of marking the window.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
For big windows, their shadow images might exceed the maximum request
length limit of Xorg. libxcb will shutdown the connection to X server if
we try to send that image. So we have to break the image apart and send
it piecemeal.
In the future we probably should migrate to MIT-SHM.
Fixes#255#274
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Unredirect the screen when some window sets _NET_WM_BYPASS_COMPOSITOR
to 1, but ignore the case where some window requests the screen to be
redirected by setting _NET_WM_BYPASS_COMPOSITOR to 2.
Closes#267
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
In file included from ../src/log.h:8,
from ../src/backend/gl/glx.h:18,
from ../src/common.h:45,
from ../src/picom.c:32:
../src/compiler.h:98:11: fatal error: threads.h: No such file or directory
98 | # include <threads.h>
| ^~~~~~~~~~~
Transparent windows usually blends on top of other windows, this commit
adds an option to make transparent windows clip other windows like
non-transparent windows do.
Closes#265
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Previously win_set_shadow tries to release the shadow image when turning
off shadow for a window. When shadow is turned off _immediately_ after
it's turned on, picom won't have a chance to handle the delayed creation
of the shadow before win_set_shadow tries to release the shadow image,
causing a assertion failure because win_set_shadow tried to release a
non-existing image.
This commit makes releasing the shadow image delayed as well.
In theory, we could check the STALE flag in win_set_shadow before
release the image, but that duplicates the logic that is already in
win_process_flags.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
The assertion check for condition that are too board.
If we get multiple root config event in a row, then we might find
ourselves trying to release a image that was released in a previous
backend destruction and is yet to be bound (IOW, the window will have
IMAGES_NONE _and_ IMAGES_STALE set), causing the assertion to fail.
This commit relax the check, so we don't check if STALE is set when NONE
is set.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
deinit then init the logging system after resets, because otherwise
duplicated log handlers will be added by session_init, and we will
see duplicated logs.
Doing this also enables us to add log handlers for early logging.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Automatically reset picom and reload the configuration when a change in
the configuration file is detected.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Unsupported backends were rejected when we try to initialize them, now
we reject them in the option parsing phase.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Instead of allocating new textures everytime gl_average_texture_color is
called, we keep two textures per gl_image and reuse those.
Doing this significantly improves CPU usage on AMDGPU driver for some
reason. But in general, less texture allocation is always better.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
leftovers:
1) config file path. Has to implement compatibility functionalities before
we can change it.
2) links in man pages. Has to migrate the repo first.
3) _COMPTON_SHADOW, it has become a defacto standard, so we have to keep
supporting it.
4) dbus names, undecided whether we should/could change it.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
A quick search on GitHub showing the _COMPTON_SHADOW is actively being
used (most noteably, by polybar). It is not a difficult thing to support,
and it doesn't have that much runtime overhead. So remove the option
that guards this feature, make it enabled by default.
(Side note, I saw lots of people putting this option in their config
files, but this is actually a command line only option.)
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Firstly, this breaks the assumption that when we redirect the screen,
all window is either mapped or unmapped, causing a assertion failure.
Secondly, if transition window into fading when the screen is not
redirected, the fading will not progress until the screen is redirected,
probably not the desired result.
Fixes#246
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Since user reports indicate it has real performance benefits.
Also add a command line flag for turning use-damage off.
Fixes#242
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Because first frame no window has their pixmap bound, which doesn't
happen in frames after the first. If a window is unmapped in that frame,
the compositor will try to render a window with no pixmap bound if
fading is enabled.
Now we keep track if we are in the first frame, and if that's the case
we skip fading in unmap/destroy.
Fixes#239, bug number 2
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>