Commit Graph

1167 Commits

Author SHA1 Message Date
Yuxuan Shui 934c269f9b
Update win::reg_ignore_valid when destroying window
When destroying a window, set window->next->reg_ignore_valid to false,
since its reg_ignore is not valid anymore.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 03:00:27 +00:00
Yuxuan Shui 6c71146f1c
Don't call map_win() in add_win()
Only case where you want to map window in add_win() is during compton
startup, when compton is registering existing windows. Otherwise,
add_win() is always called for newly created windows, so there will
always be a MapNotify coming up for that window. If we map newly created
windows in add_win(), we will try to map it a second time when the MapNotify
arrives.

So, just don't call map_win() from add_win(). For compton startup, we
explicitly call map_win() after calling add_win() in session_init.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 02:29:06 +00:00
Yuxuan Shui ff37cf9756
Don't start fading when screen is unredirected
If a window is destroyed and starts to fade out when screen is
unredirected, when the screen become redirected again, we will generate
errors when trying to render that window.

Also make sure the assumption that all window are either MAPPED or
UNMAPPED when screen is unredirected holds.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 02:12:07 +00:00
Yuxuan Shui 9aaf0fc707
Fix a use-after-free
paint_preprocess takes head of the window list as an argument. The
actual head of the window list might be freed and deleted during processing
of fade, but paint_preprocess will keep using the old head of the list,
thus uses freed memory.

Solution is just don't pass the head as an argument. paint_preprocess
will use session_t::list directly.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 01:40:04 +00:00
Yuxuan Shui 64e08cc1e3
Fix memory leaks when using the new backends
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-20 18:21:40 +00:00
Yuxuan Shui c2f274ca8a
Fix some problems in new backend integration
Fix several use of uninitialized/unallocated variables when using
--experimental-backends

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-20 18:17:16 +00:00
Yuxuan Shui 417e12bc62
Don't call init_render when using new backends
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-20 18:04:04 +00:00
yshui 72a921da2c
Merge pull request #109 from yshui/integrate-new-backends
Integrate new backends
2019-02-20 17:55:03 +00:00
Yuxuan Shui b0c5db9f5a
Let old/new backends co-exist
Now both the old and the new backends are compiled in, the user can
choose which one to use with a command line switch.

Lower the barrier for testing.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-20 17:52:24 +00:00
Yuxuan Shui 62d4c0cbdb
Cut fading short if we decide to unredirect the screen
Previously if we unredirect the screen while a fading is in progress, we
will "resume" the fading when we redirect the screen again.

This is usually fine unless the window being faded out is destroyed. we
still tries to fade it out, but since we don't have the pixmap of the
window anymore (freed by unredirect), we will generate lots of errors
until the window is completely "faded out".

Also this change makes it easy to reason about things. Now we know when
the screen is unredirected, all the windows can either be in MAPPED or
UNMAPPED state, nothing else.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-20 17:41:28 +00:00
Yuxuan Shui 9ec298305a
Cache converted blur kernel
After converting from struct conv to xorg format, cache the result to
save CPU time.

And remove an unused function.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-20 16:45:53 +00:00
Yuxuan Shui ed9c7064de
Add helper function for kernel normalization
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-20 01:47:52 +00:00
Yuxuan Shui a5e3837f6d
Fix typo
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-20 01:45:34 +00:00
yshui 57c5fcab91
Merge pull request #117 from yshui/convkern-refactor
Use struct conv for blur kernel as well
2019-02-20 01:44:11 +00:00
Yuxuan Shui 2e2e8e3ce0
Use struct conv for blur kernel as well
Instead of storing them as an array of xfixed.

Might cause some performance overhead for the new backend, because
it is allocating a buffer to do the conversion every frame. Will fix
later.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-20 01:39:43 +00:00
Yuxuan Shui ae9dee8a9a
Remove the remaining users of win::destroying
And remove win::destroying as well.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-20 01:21:58 +00:00
Yuxuan Shui 98d8e84680
Disable spurious GCC -Wmissing-braces
See:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80454

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-20 01:18:19 +00:00
Yuxuan Shui 709065d531
Destroy Input Only window properly
Destruction of Input Only windows is erroneously ignored by commit
cea010a, causing future window with the same window id as the destroyed
Input Only window to be treated by an Input Only window even when they
are not. The end result is that some windows don't show up.

Also improved the comments in win.c.

Fixes #119

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-20 01:11:13 +00:00
Yuxuan Shui 02ddf96fd5
Remove leftover CONFIG_XINERAMAs
Fixes #118

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-19 20:48:31 +00:00
Yuxuan Shui bb8fd08b5b
Fix a compiler complaint
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-18 21:32:49 +00:00
Yuxuan Shui 2a41847aa6
Make xinerama mandatory
Fixes #116

Also tweaks the usage message a bit.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-18 21:05:12 +00:00
Yuxuan Shui b2750b26e0
Rectangle kernels
Replace conv::size with conv::{w,h}.

Shadow kernels are still squares, though.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-17 21:58:43 +00:00
Yuxuan Shui cea010afec
Ignore the map/unmap of input only windows
Fixes some misleading warning messages.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-17 18:27:19 +00:00
Yuxuan Shui 635351c820
Remove win::*_last
A side effect of this is that some window properties are allowed to
change during fade-in/out. (e.g. window background can become blurred
during window fade out if window properties changed so blur is requirired).
But it is unclear what is the expected behaviour in this case anyway, so we
choose the one that is simpler to implement.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-17 18:12:41 +00:00
Yuxuan Shui ed4202b52f
Fix memory leaks
Restrict the use of ps_g to xerror() and main().

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-17 16:59:22 +00:00
yshui ecb3050eaa
Merge pull request #111 from yshui/winstate-refactor
Window state tracking refactor
2019-02-17 16:56:27 +00:00
Yuxuan Shui e0d394595b
Remove session_t::fade_running
It is used more as a out variable for paint_preprocess, so make it that.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-17 16:48:41 +00:00
Yuxuan Shui a826e0ce79
Window state tracking refactor
Window state tracking is basically the back bond of window fading. We
add a new enum field to the win struct to track the state of the window,
instead of using a set of boolean variables. We also remove the fading
callbacks, since it is only used for fading, so the potential of code
reuse is lost. And it makes the code slightly harder to understand.

Also fixed a problem that --no-fading-openclose is not behaving as
advertised (from my observation, enabling this flag disables fading
entirely, instead of just diabling it for open/close).

Also uses double for opacity everywhere internally. Use opacity_t only
when setting X opacity prop.

TODO: Remove win::*_last

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-17 16:37:28 +00:00
Yuxuan Shui e109bee380
Fix some clang-analyzer complains
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-13 04:23:54 +00:00
Yuxuan Shui 7cdc0aedee
log.h needs to export compiler.h
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-13 04:18:32 +00:00
Yuxuan Shui bb7466fc68
trace/debug logs are unlikely
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-13 04:11:41 +00:00
Yuxuan Shui 2d56b77853
Update man page to reflect changes in command line flags
Fixes #112

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-13 02:11:41 +00:00
Yuxuan Shui 60aa36b7af
Failure of config file parsing is a hard failure
compton will now quit if it fails to parse the config file.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-13 02:05:01 +00:00
Yuxuan Shui 7a21cef9a4
Handle SIGINT through libev
Handle SIGINT using libev's ev_signal handler, instead of using
sigaction().

Fixes #64. But compton might miss signals when it's not in the main loop
(e.g. when compton is reset), and thus not exit "clearly". It should
cause any real problem though, so we don't care.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-11 23:13:39 +00:00
Yuxuan Shui df69749804
Don't remove stderr logger if it fail to create
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-11 22:58:16 +00:00
Yuxuan Shui fc2353d186
Tolerant logger creation failure
Fix resetting a background compton

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-09 02:49:16 +00:00
Yuxuan Shui 39faac0f83
Blacklist more glx.h prototypes just in case
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-09 00:52:45 +00:00
Yuxuan Shui 136ce7c9e8
Prevent GL/glx.h from defining prototypes
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-09 00:43:31 +00:00
Yuxuan Shui 4c99ecfde4
Fix compile without opengl
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-09 00:16:47 +00:00
Yuxuan Shui 7e9d1c6442
Condense GLX extension lookup
Put them all into one function, and move the function pointers out of
glx_session_t, making them global variables (because them don't change
after initialized). Remove the function pointer typedefs and replace
them with the ones in glxext.h

We also only lookup the functions once per a lifetime of compton.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-09 00:14:32 +00:00
Yuxuan Shui 1a327b06ab
Fix abort because we used log too early
Can't use log in get_early_config.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-08 22:46:28 +00:00
Yuxuan Shui 343140f845
Reuse glx_has_extension for old backend
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-08 22:34:53 +00:00
Yuxuan Shui edb8b38eef
Tile root pixmap in the glx backend
In X, background pixmap is tiled (meaning they are repeated to filled
the window) by default. So, in the glx backend, we mimic this behavior
by binding the background pixmap of the root window (aka, the wallpaper)
to texture that repeats.

Fixes #107

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-08 21:48:39 +00:00
Yuxuan Shui 5fffb6f3f6
Fork as early as possible
If fork is requested, we fork as early as possible, way before anything
is initialized. This way, we don't need to do the gymnastics to make
OpenGL work properly across fork.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-08 01:33:42 +00:00
Yuxuan Shui fec43acfaa
Add missing headers
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-07 22:47:42 +00:00
Yuxuan Shui 33c1cd439b
Fix memory leak of dbus service names
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-07 22:47:32 +00:00
Yuxuan Shui a019ff453b
Make get_early_config even earlier
Also improve the management of X Display and session_t.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-07 22:45:44 +00:00
Yuxuan Shui 2867ac7a1c
Remove unused screenshot code
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-07 22:16:32 +00:00
Yuxuan Shui 68c77cd7d8
Add log_remove_target
Don't need to deinit+init struct log any more just to switch log target
:)

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-07 21:50:20 +00:00
Yuxuan Shui 049cc94e7a
Coding style change
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-07 21:37:13 +00:00