Commit Graph

871 Commits

Author SHA1 Message Date
Yuxuan Shui a2f816acb1
rename: fix the name of the modulemap file
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-24 19:41:35 +01:00
Yuxuan Shui 35db48b68a
core: fix reg_ignore calculation for window with transparent frame
Previously window with transparent frame is mistakenly treated like a
completely transparent window.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-24 19:36:19 +01:00
Yuxuan Shui a0712274ff
win: fix transparency detection for windows without a WM frame
Ping #233

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-24 19:30:11 +01:00
Yuxuan Shui ed0e686f37
rename: update config file paths
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-23 20:24:25 +01:00
Yuxuan Shui 8ddbebb5d1
rename: replace "compton" in the codebase
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>
2019-10-23 20:24:20 +01:00
Yuxuan Shui ed6a96dae9
options: add --no-vsync command line option
Otherwise there is no way to override the settings in the config file.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-23 20:23:21 +01:00
Yuxuan Shui 2d28ab6032
options: remove --respect-prop-shadow
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>
2019-10-22 20:45:21 +01:00
Yuxuan Shui 583cf35bed
Fix compiler warnings in release builds
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-12 15:12:17 +01:00
Jan Beich bd5a5fb568 Unbreak -Dopengl=false clean build
In file included from ../src/x.c:17:
../src/backend/gl/glx.h:10:10: fatal error: 'GL/glx.h' file not found
 #include <GL/glx.h>
         ^~~~~~~~~~
2019-10-12 13:29:10 +00:00
Yuxuan Shui 945dc179f5
meson.build: make sure xcb packages are recent enough
Fixes #248

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-10-11 18:11:45 +01:00
Yuxuan Shui 1ca01ec456
Make sure window cannot enter fading when unredirected
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>
2019-10-11 18:01:13 +01:00
Yuxuan Shui 93f0d80572
options: enable use-damage by default
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>
2019-09-29 00:52:07 +01:00
Yuxuan Shui a69ed89114
Treat first frame after redirection differently
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>
2019-09-29 00:40:09 +01:00
Yuxuan Shui f493447b33
win: clear PIXMAP_STALE in {unmap,destroy}_win_start
Also make sure unmapped/destroyed windows don't have PIXMAP_STALE flag
set.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-29 00:09:40 +01:00
Yuxuan Shui 0fc6f9aee2
core: bind shadow immediate in initialize_backend
This simplifies the logic a bit since we know a shadow is always bound
(if needed) when the screen is redirected.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-29 00:04:09 +01:00
Yuxuan Shui d5e8cf655c
core: rename some functions for clarity
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-28 23:43:36 +01:00
Yuxuan Shui 0c7a19fda6
backend: glx: add support for setting vsync
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-25 23:20:48 +01:00
Jerónimo Navarro 94c8927d7b win_defs.h: fix #240 2019-09-25 09:47:36 -03:00
Yuxuan Shui 33a106e254
win: don't ignore SHADOW_STALE flag on unmapped windows
Previously all image stale flags are ignored when processing an unmapped
window. If a window gains a shadow during its fading out transition, the
shadow flag will be set, but shadow won't actually be generated, causing
a NULL pointer dereference during render.

Fixes #239

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-23 21:52:26 +01:00
Yuxuan Shui c85c9ef1cc
win: set session::pending_updates in win_set_shadow
Otherwise shadow won't get generated in next critical section, causing
NULL pointer dereference or assertion failure in next render.

Partially fixes #239

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-23 21:52:11 +01:00
Yuxuan Shui 8628e498c5
win: rename win_get_name to win_update_name
Make explicit the fact that it modifies the win struct.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-23 21:22:17 +01:00
Yuxuan Shui 1a1540a5a6
events: don't call win_get_name for logging
win_get_name _updates_ the name of the window by querying the X server,
thus potentially changes the behaviour of the compositor when logging is
turned on (e.g. we could fail to detect window name changes, because the
name was blindly updated in a logging call without handling the name change).

We shouldn't do that.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-23 21:21:07 +01:00
Yuxuan Shui 73ea5d2bfb
backend: dummy: add more sanity checks
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-09-23 21:19:28 +01:00
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