Commit Graph

898 Commits

Author SHA1 Message Date
Yuxuan Shui a0bb392d8c
core: process window updates before recheck_focus
recheck_focus rejects focus of unmapped windows, so we have to make sure
pending maps of windows are processed before we call recheck_focus.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-21 05:11:28 +01:00
Yuxuan Shui 3e17f11d6d
options: remove deprecation message about --glx-fshader
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-21 01:37:31 +01:00
yshui 0063738754
Merge pull request #236 from liskin/memleaks
fix a few memory leaks reported by valgrind
2019-09-20 14:52:17 +00:00
Tomas Janousek 23421b2ff8 win: fix memory leak in fill_win
Fixes the following memory leak reported by valgrind:

    1,056 bytes in 24 blocks are definitely lost in loss record 83 of 111
       at 0x483577F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
       by 0x49DB0DD: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49D8FB4: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA63E: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA751: xcb_wait_for_reply (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x11FD5B: fill_win (win.c:1165)
       by 0x117CE6: handle_new_windows (compton.c:1266)
       by 0x118065: _draw_callback (compton.c:1333)
       by 0x1184D0: draw_callback (compton.c:1426)
       by 0x49BF292: ev_invoke_pending (in /usr/lib/x86_64-linux-gnu/libev.so.4.0.0)
       by 0x49C3344: ev_run (in /usr/lib/x86_64-linux-gnu/libev.so.4.0.0)
       by 0x11AD65: session_run (compton.c:2226)

This one out of multiple code paths forgot to free the structure. Yeah,
manual memory management is hard. :-)
2019-09-20 10:15:59 +02:00
Tomas Janousek fcec9fcd39 core: fix memory leak in _draw_callback
Fixes the following memory leak reported by valgrind:

    992 bytes in 31 blocks are definitely lost in loss record 81 of 111
       at 0x483577F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
       by 0x49DB0DD: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49D8FB4: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA63E: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA751: xcb_wait_for_reply (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x118094: _draw_callback (compton.c:1335)
       by 0x1184D0: draw_callback (compton.c:1426)
       by 0x49BF292: ev_invoke_pending (in /usr/lib/x86_64-linux-gnu/libev.so.4.0.0)
       by 0x49C3344: ev_run (in /usr/lib/x86_64-linux-gnu/libev.so.4.0.0)
       by 0x11AD65: session_run (compton.c:2226)
       by 0x11B005: main (compton.c:2308)

To prevent accidentaly reusing the freed structure, wrap it in a lexical
scope.
2019-09-20 10:15:59 +02:00
Tomas Janousek a7170cef81 backend: driver: fix memory leak (r2 not freed)
Fixes the following memory leaks reported by valgrind:

    96 bytes in 1 blocks are definitely lost in loss record 54 of 111
       at 0x483577F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
       by 0x49DB0DD: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49D8FB4: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA63E: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA751: xcb_wait_for_reply (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x14B266: detect_driver (driver.c:34)
       by 0x119949: session_init (compton.c:1879)
       by 0x11AEF0: main (compton.c:2285)

    96 bytes in 1 blocks are definitely lost in loss record 55 of 111
       at 0x483577F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
       by 0x49DB0DD: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49D8FB4: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA63E: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA751: xcb_wait_for_reply (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x14B266: detect_driver (driver.c:34)
       by 0x11795E: redir_start (compton.c:1202)
       by 0x115C76: paint_preprocess (compton.c:629)
       by 0x1182BD: _draw_callback (compton.c:1380)
       by 0x1184D0: draw_callback (compton.c:1426)
       by 0x49BF292: ev_invoke_pending (in /usr/lib/x86_64-linux-gnu/libev.so.4.0.0)
       by 0x49C3344: ev_run (in /usr/lib/x86_64-linux-gnu/libev.so.4.0.0)
2019-09-20 10:15:59 +02:00
Tomas Janousek bd122c738d backend: driver: fix memory leak (randr_version not freed)
Fixes the following memory leaks reported by valgrind:

    32 bytes in 1 blocks are definitely lost in loss record 15 of 111
       at 0x483577F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
       by 0x49DB0DD: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49D8FB4: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA63E: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA751: xcb_wait_for_reply (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x14B16F: detect_driver (driver.c:20)
       by 0x119949: session_init (compton.c:1879)
       by 0x11AEF0: main (compton.c:2285)

    32 bytes in 1 blocks are definitely lost in loss record 16 of 111
       at 0x483577F: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
       by 0x49DB0DD: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49D8FB4: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA63E: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x49DA751: xcb_wait_for_reply (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
       by 0x14B16F: detect_driver (driver.c:20)
       by 0x11795E: redir_start (compton.c:1202)
       by 0x115C76: paint_preprocess (compton.c:629)
       by 0x1182BD: _draw_callback (compton.c:1380)
       by 0x1184D0: draw_callback (compton.c:1426)
       by 0x49BF292: ev_invoke_pending (in /usr/lib/x86_64-linux-gnu/libev.so.4.0.0)
       by 0x49C3344: ev_run (in /usr/lib/x86_64-linux-gnu/libev.so.4.0.0)

Also, free(randr_version) in the error path as well.
2019-09-20 10:15:59 +02:00
Yuxuan Shui 3766aa2c79
win: make sure delayed image update is always used
Convert several places where the window image is bound/unbound directly
to use image flags. Make sure window image updates only happen in one
place.

Remove win_bind_image function since its no longer used after this.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-20 02:22:48 +01:00
Yuxuan Shui 39a609acb0
event: do delayed window mapping
This remove the only case where map_win_start is called outside of the
X critical section.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-20 02:22:48 +01:00
Yuxuan Shui 9f3d3f2fba
win: add functions for delayed window updates
And a window update flag for mapping the window.

Also make sure related functions consider the case where the given window
has pending updates.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-20 02:22:46 +01:00
Yuxuan Shui 16bff8ff41
win: add managed_win_internal
Which includes the pending update flags for the window.

Using an internal struct makes sure the window update flags are opaque outside
of win.c

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-20 02:22:15 +01:00
Yuxuan Shui b9bf4fed60
win: rename some functions
rename map_win, unmap_win, destroy_win to map_win_start,
unmap_win_start, destroy_win_start respectively. To clarify their
intended functions. Also rename the corresponding finish_* functions to
*_finish so they are consistent.

Also some very minor code clean ups.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-20 02:22:15 +01:00
Yuxuan Shui fd570e1b78
win: split unmap_win into unmap and destroy
Instead of doing both unmapping and destroying in the same function,
since that complicates the logic.

Also since now destroy_win handles both the managed and unmanaged cases,
remove destroy_unmanage_win function.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-20 02:22:11 +01:00
Yuxuan Shui eecee130b8
win: split WIN_FLAGS_IMAGE_STALE
Split it into PIXMAP_STALE and SHADOW_STALE, this allows us to update
pixmaps and shadow images separately.

Also added PIXMAP_NONE and SHADOW_NONE, as redundancy to detect logic
errors.

Convenient constants and functions are provided for updating pixmap and
shadow together.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-20 01:25:07 +01:00
Yuxuan Shui 1549997811
win: remove map_win_by_id
Since it has only one user.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-20 01:24:57 +01:00
Yuxuan Shui 5787c17ebe
Promote some log_trace to log_debug
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-19 17:23:48 +01:00
Yuxuan Shui ebb52567c0
core: move the X critical section into a function
Also move handle_root_flags into the critical section.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-19 17:20:52 +01:00
Yuxuan Shui 7df9245c81
win: move image update code into a function
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-19 16:59:36 +01:00
Yuxuan Shui de5d5ca9bb
event.c: run clang-format
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-16 23:28:16 +01:00
Yuxuan Shui 48687b985d
Make potentially window destroying functions take simple pointers
Instead of pointer to pointer. The two level of pointers were used to
inform the caller the window has been destroyed (pointer set to NULL).

Now, destruction of windows are now signaled by the return value, which
is marked `must_use`.

Problem with taking pointer to pointer is that they tends to pollute the
function signatures a little bit. And we are not using it well anyways.
A lot of the callers passes pointers to local variables to those
functions, so the information about window destruction doesn't actually
bubble up. So, we switch to use just one level of pointers instead.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-16 23:14:03 +01:00
Yuxuan Shui 127b1ac3a4
win: remove some unreachable code
finish_destroy_win has unreachable code after a return statement

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-16 22:46:25 +01:00
Yuxuan Shui 1780f63914
backend/driver.h: add comments about NVIDIA quirks
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-16 22:44:09 +01:00
Yuxuan Shui b2ff4eb2c9
compiler.h: add popcount 2019-09-07 19:11:04 +01:00
Yuxuan Shui 4e915837a4
core: track whether server is grabbed 2019-09-07 19:10:58 +01:00
Yuxuan Shui 02139b7c9f
Fix type in log message
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-08-27 22:15:36 +01:00
Yuxuan Shui 04520368f6
glx: clarify a comment
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-08-11 03:24:02 +01:00
Yuxuan Shui 0771234ee2
More header fixes
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-08-10 15:31:23 +01:00
Yuxuan Shui 2fbb45dcd7
win: remove unused member of struct win
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-08-10 01:47:05 +01:00
Yuxuan Shui 306f5e8b75
win.h: remove unused prototypes
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-08-10 01:44:27 +01:00
Yuxuan Shui dd21806662
core: shrink the critical section in session_init
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-08-10 01:23:11 +01:00
Yuxuan Shui 0ba7761bd5
Untangle headers
Thanks, clang -fmodules.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-08-10 00:56:26 +01:00
Yuxuan Shui fae30d46e7
core: don't initialize dbus in critical section
grabbing X server stops the dbus daemon in some cases, causing compton to
hang in dbus initialization.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-08-09 23:34:37 +01:00
Yuxuan Shui c719804fb1
backend: dummy: initialize backend_base properly
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-08-09 23:33:01 +01:00
Yuxuan Shui 4dc5a04735
core: fix background not blurred under transparent windows
When a window has 0 opacity, it's rendering is skipped completely. Thus
its background isn't blurred.

This commit fixes that.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-08-04 23:15:10 +01:00
Yuxuan Shui 9b419ce37d
core: fix assertion failure when blur context failed to initialize
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-08-04 17:55:39 +01:00
Yuxuan Shui 8eb9d07fa8
Add dummy backend
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-08-04 17:52:45 +01:00
Yuxuan Shui d702fc9365
Preparation for dummy backends
Dummy backends are backends that doesn't render anything on to the
screen or the target window. But they are still be useful for debug
purposes, and can be useful for other things too.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-08-04 16:46:09 +01:00
Yuxuan Shui 8168c38d4f
core: no need to unredirect the registration window
This window is invisible anyway, whether it's redirected should be
inconsequential.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-08-04 16:41:28 +01:00
Yuxuan Shui ddde118c69
core: check if a chosen backend is available
Error out instead of segfaulting when the chosen backend is not
available.

Fixes #210

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-08-01 21:23:56 +01:00
Yuxuan Shui 1f80c8dc16
render: don't free blur_kerns_cache when it's not used
blur_kernel_count could be none zero when user set a blur kernel but
didn't enable blur. In that case deinit_render will try to free
elements of blur_kerns_cache, causing a segfault because
blur_kerns_cache is never allocated.

Fixes #209

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-31 23:52:31 +01:00
Yuxuan Shui 6cb5f9711e
core: deregister xerror handler in session_destroy
xerror handler might be called during XCloseDisplay, at which point
session_t is already destroyed, causing a segfault.

Ping #209

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-30 06:40:24 +01:00
Yuxuan Shui d7415fcf2e
new backends: blur background before rendering shadow
Otherwise the blurred background will have a darker edge because the
shadow is blended in.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-29 21:19:06 +01:00
Yuxuan Shui 5da71e6bfd
core: add a TODO
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-27 17:08:47 +00:00
Yuxuan Shui 6ac50626ef
win: don't create shadow image when not requested
win_set_shadow tries to create shadow image even when shadow_new is false, this
is incorrect.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-27 00:02:44 +01:00
Yuxuan Shui a229f34eaa
new backend: fix background blur of window with opacity set
Only render blur with transparency when window is fading in/out.
Otherwise, a window with a set opacity will always have a completely
blurred background.

Fixes #198

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-26 23:43:28 +01:00
Yuxuan Shui 79fc36b3e3
win: don't change window OPACITY property
Don't override the OPACITY property set by the user on the window.

Fixes #134

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-26 22:29:42 +01:00
Yuxuan Shui 3434ea25f4
new xrender: fix nothing gets rendered without vsync
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-26 20:25:17 +01:00
Yuxuan Shui c7bb6b0fe3
Clarify some of the backend interface functions
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-26 18:32:39 +01:00
Yuxuan Shui e3b93a4f84
Additional blur artifact fix
There were still some artifacts left when multiple semi-transparent
windows are stacked on top of each other.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-26 18:28:22 +01:00
Yuxuan Shui 0109fe181e
gl_common: fix memory leak in _gl_fill
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-26 03:53:24 +01:00
Yuxuan Shui 4772103334
Remove some unused members of session_t
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-26 03:39:01 +01:00
Yuxuan Shui 357968c815
options: remove a spurious warning
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-26 02:44:42 +01:00
Yuxuan Shui d37a4136ee
new xrender: implement partial updates
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-26 02:31:45 +01:00
Yuxuan Shui 5a861d5d6a
gl_common, new glx: implement partial updates
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-26 02:22:05 +01:00
Yuxuan Shui 06dba4b196
backend: do partial updates
Although the functionality is not implemented by any backends yet.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-26 02:05:06 +01:00
Yuxuan Shui f86d6b7cbd
backend: update present interface for partial updates
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-26 02:05:00 +01:00
Yuxuan Shui bc3ca92e04
gl common: render into a texture
Instead of rendering into the back buffer, render into a intermediate
texture.

This is a preparation for partial screen updating, which is necessary to
eliminate artifacts visible when using blur and use-damage together.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-26 01:20:11 +01:00
Yuxuan Shui 3d84f3f92a
gl_common: fix type mismatch when calling glVertexAttribPointer
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-26 01:19:55 +01:00
Yuxuan Shui 8dae86a8cf
dbus: log resets
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-25 21:32:59 +01:00
Yuxuan Shui 159a45b9e9
core: root_image freeing shouldn't be in a loop 2019-07-25 21:25:43 +01:00
Yuxuan Shui 80d77b4ee8
core: don't reuse X connection across resets
In theory, it should be fine. But it causes mesa to stuck in
xcb_wait_for_special_event, indicating X connection setup issues.

Instead of investigating what went wrong in mesa, I choose to apply this
simple fix.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-25 21:15:47 +01:00
Yuxuan Shui f9703cdc04
dbus: fix resetting
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-25 21:01:40 +01:00
Yuxuan Shui 79b135dccc
Fix warnings when opengl is disabled
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-25 02:52:37 +01:00
Yuxuan Shui 72cedea5a3
config: fix warning when config_file is disabled
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-25 02:46:46 +01:00
Yuxuan Shui 9194506696
core: destroy debug window in session_destroy
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-25 02:38:03 +01:00
Yuxuan Shui 5094400ab7
core: don't deinit tls logger in session_destroy
tls logger is initialized by main(), so only main() could deinit it.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-25 02:37:43 +01:00
Yuxuan Shui bb756b2238
Fix compiler warning about unused parameters
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-25 02:27:02 +01:00
Yuxuan Shui 62878d7c57
gl_common: use a dummy pass to unify blur code paths
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-25 00:36:42 +01:00
Yuxuan Shui 4c9ded837f
new backend: add interface for query blur size
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-24 23:27:51 +01:00
Tasos Sahanidis 93642e537f
Add --no-ewmh-fullscreen
This arg reverts to the old behaviour of checking for fullscreen
windows.
2019-07-19 14:13:41 +03:00
Tasos Sahanidis 10d5c9b2f9
Use XCB to check if an application is fullscreen 2019-07-19 14:11:15 +03:00
Yuxuan Shui ad30b4f826
gl_common: use texelFetch
This relieves us from the need to normalize texture coordinates.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-14 16:21:22 +01:00
Yuxuan Shui 8a794e0ce1
Improve the compatibility of gl_has_extension
Fix infinite loop when running under RenderDoc

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-13 19:30:26 +01:00
Yuxuan Shui 372f4f816e
new backend: ignore window tranparency info from the backend
Doing this forces compton to blur every windows' background.

However, doing this can be beneficial, we will figure out a way
to do this properly in the future.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-13 12:44:41 +01:00
Yuxuan Shui 426043baa7
Improve transparency detection for blur
Previously, only the WM windows (window manager usually reparents the
application windows under its own window so it can manage them) are
checked for alpha channels. Some of the window managers (e.g. awesome)
acquire alpha channels for all of the WM windows, whether the underlying
application windows have alpha channel or not.

With this change, the application windows are also checked for alpha
channels. If a WM window has alpha but its child doesn't, only the WM
frame will be considered to be semi-transparent. Thus preventing some
unnecessary blurring.

Closes #191

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-13 12:37:28 +01:00
Yuxuan Shui 7d28309a47
Stop debug mode from being used without the new backends
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-07 19:55:34 +01:00
Yuxuan Shui 722b01ca6a
Fix creation of X convolution kernel
During normalization of the kernel, the center element is added to the
sum twice, causing the resulting elements to be smaller than they should
be.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-07 19:51:42 +01:00
Yuxuan Shui 4c460a7bd5
new xrender: fix black border around blurred area
Similar fix to 6d646b54.

Also ping #50

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-07 19:49:23 +01:00
Yuxuan Shui e62971a0c3
gl common: fix memory leak
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-07 19:09:15 +01:00
Yuxuan Shui 182a207afd
new xrender: fix offset when using multi-pass blur
Also makes the code a bit more readable by replacing stateful variables.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-07 18:55:20 +01:00
Yuxuan Shui 6d646b543f
new glx: fix black border around blurred areas
This is done by extending the blur area internally when process
blurring.

Ping: #50, cause this fixes that problem but only when using the
experiemental backends.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-07 18:39:46 +01:00
Yuxuan Shui 4a0092c808
Don't register as compositor manager in debug mode
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-07 17:25:26 +01:00
Yuxuan Shui d31e9dae20
Don't render the debug window
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-07 16:20:08 +01:00
Yuxuan Shui 0b0d896ffe
Add debug mode
When enabled, the result will be redirected to a window, and compton
won't take over the screen.

Makes debugging easier.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-07 16:20:00 +01:00
Yuxuan Shui 640b4b1c99
Move resize_region to region.h
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-07-06 13:26:25 +01:00
Yuxuan Shui a52f95acd7
gl_common: fix misunderstanding of VAO
GL_ARRAY_BUFFER is not part of VAO state.

This shouldn't affect compton's behaviour at all, though.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-06-24 01:51:50 +01:00
Yuxuan Shui 85abdef765
gl_common: use explicit vertex attrib loction
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-06-24 01:34:12 +01:00
Yuxuan Shui 5a034ea169
Fix root change handling when screen is unredirected
If screen is not redirected, we don't need to reinitialize the backend
when we got a root change event.

Fixes #189

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-06-15 23:04:49 +01:00
Yuxuan Shui 863e2c82ec
new backends: don't destroy blur context when there's none
Fixes #190

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-06-13 08:14:14 +01:00
Yuxuan Shui 67f0ec773a
new backends: blur interface update
To prepare for different blur methods, the blur interface of backends
has been splitted into two parts.

Now to use blur, a blur context must be created first; then, the blur
method should be called with the blur context created.

Updated the existing backends to the new interface. Also implemented
handling of the new blur options.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-06-09 19:26:41 +01:00
Yuxuan Shui 1eba43f888
Rename blur kernel parameter types
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-06-09 12:57:23 +01:00
Yuxuan Shui c1b2ce1fce
Update generate_blur_kernel to use abstract parameter type
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-06-09 12:44:32 +01:00
Yuxuan Shui e16e592302
Move enum blur_method to backend.h
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-06-09 12:43:51 +01:00
Yuxuan Shui 8e0b467138
Warn when using new blur methods on old backends
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-06-09 01:09:54 +01:00
Yuxuan Shui 1da726047a
new backend: don't assume center of blur kernel is 1
Also fill the center of parsed kernel with 1. This shouldn't change the
behavior of the old backends since they will modify the center of the
kernels.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-06-09 01:03:37 +01:00
Yuxuan Shui f64ac97a91
Return kernel count from kernel generation functions
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-06-09 00:45:06 +01:00
Yuxuan Shui 2239181551
Properly implement gaussian blur kernel
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-06-08 23:56:47 +01:00
Yuxuan Shui fa8faaf91d
Remember the number of blur kernels
Don't count the number of blur kernels everytime.

Fixes #188

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-06-07 22:21:06 +01:00
Yuxuan Shui abb089e605
Lift the MAX_BLUR_PASS limit
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-06-07 07:04:50 +01:00
Yuxuan Shui cbb859ba3c
Fix non-OpenGL build
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-06-06 07:40:32 +01:00