Commit Graph

928 Commits

Author SHA1 Message Date
Yuxuan Shui 8d639f41e9
Make sure only MAPPED state can transition to FADING
win_update_focused transition window into FADING without checking their
current state, resulting into unmapping windows being brought into
FADING state and stops unmapping.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-23 00:11:29 +00:00
Yuxuan Shui 9cce1efe3f
Call glxext_init from glx_init
Make sure we query the extensions.

Also don't start glx string marker logger for new backends yet.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 23:25:31 +00:00
Yuxuan Shui 23ee4c6cbe
Add missing check for experimental_backends
Fixes #121

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 22:32:49 +00:00
Yuxuan Shui 6487047526
Add install instructions to README
Closes #120

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 18:24:46 +00:00
Yuxuan Shui f120f9b754
Make sure map_win initialize win::win_data
Previously it is initialized by win_update_bounding_shape, so
configure_win is called when win_data == NULL and state ==
WSTATE_MAPPING, which is an invalid state for a `win` to be in.

Now map_win explicitly calls backend->prepare_win. This is not very
efficient since win_update_bounding_shape will reinit it.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 14:53:41 +00:00
Yuxuan Shui e82bc0ca23
Silence a warning in release build
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 14:15:25 +00:00
Yuxuan Shui 350933a054
Cleanups
* Make some functions in win.c pure
* Remove unused code
* Fix misuse of attr_const, const functions shouldn't exam data pointed
  to by its pointer arguments.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 14:08:08 +00:00
Yuxuan Shui 69826a0844
Add some TODOs
reg_ignore is a bit complicated.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 04:11:58 +00:00
Yuxuan Shui d145808e69
Fix new backend related crash
Use of invalid backend_info_t.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 03:51:26 +00:00
Yuxuan Shui a7f373dec3
Starting the deprecation process for --sw-opti
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 03:42:03 +00:00
Yuxuan Shui 6909597ee3
Use monotonic clock for time
Remove handling of the so-called "time disorders".

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-21 03:36:51 +00:00
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