Commit Graph

1375 Commits

Author SHA1 Message Date
Yuxuan Shui cf3e95f0a4
gl_common: make viewport stateless
Also call glViewport before a draw call.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-03-17 18:02:53 +00:00
Yuxuan Shui d9b407c6b4
win: fix assertion failures in old backends
These asserts only hold when using the experimental backends.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-03-17 17:31:19 +00:00
Yuxuan Shui 36e9ccd5be
tmp 2020-03-15 20:24:30 +00:00
Yuxuan Shui 7de9494766
gl_common: apply alpha to the right target
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>
2020-03-15 20:08:27 +00:00
Yuxuan Shui b3590f934f
gl_common: reduce some code duplication
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-03-15 20:05:01 +00:00
Yuxuan Shui 0eca07d400
gl_common: zero initialize new image data in gl_image_decouple
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>
2020-03-15 19:55:16 +00:00
Yuxuan Shui 5d7ff7101e
picom: win::flags are properly updated in old backends too
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>
2020-03-12 18:18:26 +00:00
Yuxuan Shui 93f89b8603
win: fix transparency detection
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
2020-03-11 21:00:47 +00:00
Yuxuan Shui d757d45d1e
picom: make sure --diagnostics works when another picom is running
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
2020-03-11 19:15:26 +00:00
Ben Friesen 9547d7af70
Add time uniform to old glx glsl shaders (#330) 2020-03-10 07:29:38 +00:00
Yuxuan Shui def63f9a56
glx: make sure the context is really destroyed
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>
2020-03-07 20:06:25 +00:00
Yuxuan Shui c2938ad4d9
gl_common: no need to get "opacity" uniform for dummy shader
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>
2020-03-07 17:31:46 +00:00
Yuxuan Shui 4247d4cf78
gl_common: demote uniform location get failure log
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>
2020-03-07 17:24:42 +00:00
Yuxuan Shui 7817f52cb1
Rename wintype "notify" to "notification"
"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>
2020-03-07 12:15:14 +00:00
Yuxuan Shui c59b0bca22 github: add PR template
Signed-off-by: shui <shui@pop-os.localdomain>
2020-03-06 09:19:14 +00:00
Yuxuan Shui 7eb9ee70a1
config_libconfig: fix freeing of invalid pointer
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 #326
Closes #327

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-03-06 05:45:20 +00:00
Yuxuan Shui 2f0b7cd992
config_libconfig: rename xdg* functions
To fit our naming convention.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-03-01 13:48:04 +00:00
Yuxuan Shui 7161296872
config_libconfig: add unit tests for xdgConfigDirectories
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-03-01 13:46:06 +00:00
Yuxuan Shui 529edce2b9
config_libconfig: eliminate relative paths from XDG_CONFIG_DIRS
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>
2020-03-01 13:35:50 +00:00
Yuxuan Shui 6b9eddae49
config_libconfig: fix xdgConfigDirectories
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>
2020-03-01 13:15:36 +00:00
Yuxuan Shui a8e8b747fe
file_watch: don't watch special files
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>
2020-02-26 21:11:55 +00:00
Yuxuan Shui 630d6f3a26
log: add log_error_errno
Prints error message with strerror(errno) attached, for convenience.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-02-26 20:16:55 +00:00
yshui 49d620de4f
Merge pull request #322 from dylanaraps/next
picom: Drop libxdg-basedir
2020-02-26 11:05:07 +00:00
Dylan Araps 20226f4574 picom: Drop libxdg-basedir 2020-02-25 18:18:19 +02:00
yshui fe766b1ad4
Merge pull request #311 from avivace/patch-1
Add libx11-xcb-dev as required dependency on Debian
2020-02-15 15:31:37 +00:00
Antonio Vivace a645313daf
Add libx11-xcb-dev as required dependency on Debian 2020-02-14 22:20:58 +01:00
Yuxuan Shui 499b49eb03
Fix build on clang
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-02-08 19:15:10 +00:00
Yuxuan Shui 51034249cc
win: handle shadow image errors more gracefully
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>
2020-02-07 21:35:34 +00:00
Yuxuan Shui 69b3eee76b
backend_common: fix handling of large shadow images
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>
2020-02-07 21:27:01 +00:00
Yuxuan Shui b026708026
Partially handle _NET_WM_BYPASS_COMPOSITOR
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>
2020-01-18 18:02:41 +00:00
Yuxuan Shui c9417bf367
x: trivial function renames
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2020-01-18 17:26:53 +00:00
yshui 463bf09d0a
Merge pull request #286 from tryone144/fix/blur-method_options
Parse `--blur-*` options as documented in manpage
2020-01-17 16:35:26 +00:00
Bernd Busse df1a852442 Add support for documented `--blur-*` options
Handle parsing of `--blur-method`, `--blur-size` and `--blur-deviation`
in config file and as command line options as documented in the manpage.
2020-01-17 16:25:02 +01:00
Bernd Busse d8d9fdf11f Make manpage formatting more consistent 2020-01-17 16:25:02 +01:00
yshui 3ae94de7b7
Merge pull request #288 from jbeich/dragonfly
Try to unbreak build on DragonFly
2020-01-17 14:37:04 +00:00
yshui 6d60e1774b
Merge pull request #292 from asparagii/next
Escape percentages in help strings
2020-01-17 14:36:00 +00:00
Michele Lambertucci 99fadd9487 Escape percentages in help strings 2020-01-02 19:26:36 +01:00
Jan Beich e54058fcc7 compiler.h: also check threads.h exists
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>
      |           ^~~~~~~~~~~
2019-12-24 12:04:04 +00:00
yshui e1d9e9535e
Merge pull request #280 from quequotion/patch-2
Remove duplicated quequotion entry in CONTRIBUTORS
2019-12-13 16:10:35 +00:00
yshui 7bc83e1d7f
Merge pull request #281 from quequotion/patch-3
inverter.sh: pgrep picom
2019-12-13 16:09:47 +00:00
Que Quotion a9d3002c3b
reduce quequotions
That other quequotion is also me; I prefer the "full name" and bugmenot address.
2019-12-10 23:36:01 +09:00
yshui 37532e5235
Merge pull request #279 from quequotion/patch-2
Create picom-dbus.desktop
2019-12-10 10:41:45 +00:00
Que Quotion 4ac7c1a20e
inverter.sh: pgrep picom
Additional rebranding to be done here, but first of all make this work.
2019-12-10 18:38:29 +09:00
Que Quotion 96b2e8d3b7
Create picom-dbus.desktop
This is mostly for use by session managers that want to start picom with dbus enabled at login.
2019-12-10 17:52:26 +09:00
Yuxuan Shui 6a3d1354be
backend: allow transparent windows to clip other windows
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>
2019-11-30 21:29:07 +00:00
Yuxuan Shui 7040579a38
backend: clarify comments about reg_paint
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-30 21:23:22 +00:00
Yuxuan Shui d4e76b271a
win: delayed release of shadow image
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>
2019-11-18 22:34:05 +00:00
Yuxuan Shui 8b37fcb1d8
backend: xrender: fix array size off-by-one
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-18 21:07:02 +00:00
Yuxuan Shui 896fe20098
win: release shadow image when shadow is turned off
fix a assertion error when the shadow is turned back on after being
turned off.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-18 21:00:40 +00:00
Yuxuan Shui db2c9ff0be
tests: add testcase for another case of #239
The compositor crashes when a window does:
has shadow -> no shadow -> has shadow

This is because when the shadow is turned off, the shadow image is not
freed, and this is catched by a later assertion.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-11-18 20:53:49 +00:00