Commit Graph

417 Commits

Author SHA1 Message Date
Yuxuan Shui 22bc79369e
Review the use of XFlush and xcb_flush
Replace most of XFlush with xcb_flush.

Also, in a lot of places, XFlush is used as if it is XSync. Replace
those cases by using xcb's _checked version of functions and
xcb_request_check.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-07 01:11:13 +00:00
Yuxuan Shui 856ad4b230
Wrap root window background prop check
It might be reused by the backends.

Depends on what the backend API ends up look like.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-07 00:34:48 +00:00
Yuxuan Shui 17c8517abc
Most of the x_* functions don't need session_t
Replace session_t parameter with xcb_connection_t if that's the only
thing needed.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-03 15:59:31 +00:00
Yuxuan Shui ad3dc5d233
Move session_t::pictfmts into x.c
As a global variable, since they shouldn't change during the period
compton is running. Also limit the scope of the variable to x.c.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-03 15:14:18 +00:00
Yuxuan Shui 7d10db6531
Move deallocation of damage_ring to deinit_render
Fix a memory leak when compton is reset.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-02 22:05:43 +00:00
Yuxuan Shui 6eff9ebf8b
Variable name change
win::destroyed to win::destroying, because it make slightly more sense.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-02 19:43:42 +00:00
Yuxuan Shui 8c71f3fcbe
Move some macros around
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-27 23:57:43 +00:00
Yuxuan Shui d92a546beb
Fix includes and typos in new backends 2019-01-27 19:34:26 +00:00
yshui 4bc2870ddf
Merge pull request #86 from yshui/damage-ring
Make buffer age not glx specific
2019-01-26 15:11:13 +00:00
Yuxuan Shui e80ff8530e
Make buffer age not glx specific
Buffer age is not a glx specific concept. xrender backend can have
buffer age too, if double buffering is used (required if we want to use
Present). So, make buffer age a generic concept in compton is required
for further backend improvements.

Moved buffer age based damage aggragation out of glx as well.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-26 15:07:09 +00:00
Yuxuan Shui 5e49ab0861
Make sure draw_idle is stopped in all cases
Previously, compton fails to stop draw_idle in some cases when sw_opti
is enabled.

sw_opti is a feature that limits the draw frequence to vblank frequence.
It adds a delay to drawing when the screen is updated more frequently
than the vblank frequence. However when the delay is not used (i.e. the
screen is updated infrequent enough), compton will start drawing the
frame directly without using the delay. And specically in this case,
compton will fail to stop the draw_idle, causing a callback to be called
once per loop of the mainloop, resulting in high CPU usage.

Fixes #92

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-25 00:35:24 +00:00
Yuxuan Shui f649a949e2
Even more includes
Expand the modulemap to cover some of the system headers too.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-20 22:09:22 +00:00
Yuxuan Shui 1e0deea57f
Improve the include situation
Slightly clean up header inclusion with the help of clang's module system.
It's better for files to include the things you need directly.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-18 23:30:44 +00:00
Yuxuan Shui c93789f5e9
Enable the glStringMarker logger when available
glStringMarker is usually only available when running under some
kind of GL debugger, and can be used to insert strings into the
GL command string. Writing logs using it can be useful, since it
lets us correspond GL calls with what happens in compton.

More info about the extension can be found here:

https://www.khronos.org/registry/OpenGL/extensions/GREMEDY/GREMEDY_string_marker.txt

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-09 21:58:16 +00:00
Yuxuan Shui 34eb14fb0f Tweak the default shadow-radius
We need to make the radius 1.5x bigger to achieve the same effect.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-02 11:14:27 +00:00
Yuxuan Shui 6d3ea3564b
Implement vsync for the new xrender backend
We use the Present extension for that, since it is the best option we
have.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-01 14:59:56 +00:00
Yuxuan Shui 6413ccbd71
Improve XSync extension detection
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-01 14:09:55 +00:00
Yuxuan Shui 428c24a6fa
Speed up shadow generation for small windows
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-01 11:35:59 +00:00
Yuxuan Shui 4aeffa36b8
Refactor shadow generation
Trying to make the code easier to understand. The logic is unchanged.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-01 10:54:21 +00:00
Yuxuan Shui 14f357ea2b
Clean up ps->sync_fence after error
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-30 08:05:16 +00:00
Yuxuan Shui 4bfed7f7e3
Use one global XSync fence
And only sync once per frame.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-30 07:43:24 +00:00
Yuxuan Shui 80847dd3fa
Refactor the XSync fence code
Use a temporary fence everytime. Convert the Xlib XSync functions to use
xcb_sync_*.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-30 07:06:47 +00:00
Yuxuan Shui 51d03132bf
A bit more xcb conversion
None -> XCB_NONE
Window -> xcb_window_t
Atom -> xcb_atom_t

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-27 20:45:38 +00:00
Yuxuan Shui 0c4b690b2b
First step of split backend into modules
This commit introduced a new, modular backend interface. The interface
is not very good, since I don't think I fully understand all the
requirements writing a backend have. But this is a good first step.

This commit also includes an initial xrender backend written using the
new interface, and some opengl backend related helper functions, which
are taken from the old opengl backend.

However, there is not integration with the core compton yet. compton
will still use the old backend code. This commit is here so we can get
the automated build test.

What is implemented in the new xrender backend:

* Windows with transparency
* Shadow
* Opacity
* Wallpaper (getting the root pixmap)
* Blur

Known problem with the xrender backend:

* It is slower

Things that still need to be figured out:

* What is the better way to add vsync to the new backends

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-22 00:50:25 +00:00
Yuxuan Shui 7915ade1be
Make --logpath work again
Also add a new option "log-file" to config file and command line, it
doesn the same thing as --logpath.

--logpath was never documented, and "log-file" is more consistent with
the naming of options.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-21 22:59:21 +00:00
Yuxuan Shui cb7d852b0f
Clean up options/config file parsing
* Pass a options_t, not session_t
* Slightly improve error handling when setting vsync method via dbus

The goal here is to limit the scope of what a given function can access.
And session_t contains basically everything, so don't pass it around.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-21 17:21:52 +00:00
Yuxuan Shui ee2be09958
Rename argparse.* to options.*
Seems to be a more appropriate name.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-21 13:10:49 +00:00
Yuxuan Shui 2a2958b68d
Split the first and second pass of get_cfg
They are not separate functions

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-20 23:58:47 +00:00
Yuxuan Shui 9b121447b9
Remove a couple of unwanted options
* -d: because the standard way is to use $DISPLAY
* no-name-pixmap: undocumented debugging option
* -S: debugging option, not very useful

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-20 23:44:38 +00:00
Yuxuan Shui 9880245200
Move get_cfg and usage out of compton.c
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-20 23:12:38 +00:00
Yuxuan Shui 4ff9e810ff
Sort out the dbus function prototypes
* Moved dbus prototypes from common.h to dbus.h
* Removed private function prototypes from dbus.h
* Removed private macros from dbus.h
* Hide dbus types from common.h

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-20 23:12:27 +00:00
Yuxuan Shui b5b0f4af7f
Convert printf_errf/dbgf in several files
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-20 16:54:51 +00:00
Yuxuan Shui 3966491846
Convert printf_errf/dbgf in opengl.c
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-20 16:50:11 +00:00
Yuxuan Shui 2af0b48c7b
Convert printf_errf in common.h
And remove some unused functions.

And improve some error messages.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-20 03:56:37 +00:00
Yuxuan Shui 833eb966f1
Convert print_errf/dbgf in win.c and compton.c
And improve some of the log messages. Like, when compton exits because
of unsupported options, explain which options are causing compton to
quit.

Convert some debugging messages that are guarded behind ifdef's to log_trace,
so user don't need to re-compile to enabled them.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-20 03:56:31 +00:00
Yuxuan Shui d9409ae2c9
Add command line and config file option log-level
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-20 01:26:04 +00:00
Yuxuan Shui 1bcd7f2f7a
Add a simple logging framework
It's not very pretty now, but it will get better.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-20 01:02:56 +00:00
Yuxuan Shui e58cbf8add
Convert non-mandatory attributes to macros
They're shorter and more portable.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-19 20:50:02 +00:00
Yuxuan Shui eabe2b5bb8
Explicitly cast X sequence number
Fix an undefined behavior.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-17 00:51:27 +00:00
Yuxuan Shui 50ea3617ef
Move some deinitialization to render.c
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-16 03:00:56 +00:00
Yuxuan Shui 404a6b47ad
Move presum_gaussian to render.c
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-16 02:49:41 +00:00
Yuxuan Shui 9ce1387f52
Move a few more functions into render.c
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-16 00:53:54 +00:00
Yuxuan Shui baeb4572ff
Move rendering related functions out of compton.c
Moved:
* Blur kernel related functions to kernel.c
* Vsync related functions to vsync.c
* paint related functions to render.c

This will make the `split-backend` branch easier to rebase.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-16 00:50:46 +00:00
Yuxuan Shui 85c5d34ce1
Add missing CONFIG_OPENGL check
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-15 20:09:49 +00:00
Yuxuan Shui b73dce1d6d
Replace mstrcpy, mstrncpy with strdup, strndup
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-15 19:07:14 +00:00
Yuxuan Shui b8912fa749
Use checked allocation everywhere
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-15 18:57:46 +00:00
Yuxuan Shui acb81bc9a9
Add log.h to files that need it
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-15 17:53:17 +00:00
Yuxuan Shui 0cebbc370a
Function movements
* string functions mstr*() are moved to string_utils.c
* allocation wrappers are moved to utils.h
* printf_* functions are moved to log.h

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-15 17:43:36 +00:00
Dan Elkouby 6195422c66 Swap control only works with OpenGL 2018-12-15 11:22:38 +02:00
Dan Elkouby e2182bb00b Work around mesa's default-on swap control 2018-12-14 19:25:05 +02:00
Dan Elkouby de1cce21ba Merge opengl-{,m}swc vsync methods
Both methods are redundant. Prefer Mesa's own extension when available,
fall back to the old SGI extension otherwise (NVIDIA drivers for the
most part).
2018-12-14 19:24:03 +02:00
Yuxuan Shui 0899a9689e
Remove unused variable in paint_preprocess
And fix a memory leak caused by it.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-09 21:00:32 +00:00
Yuxuan Shui dffde065b1
Make the shadow actually gaussian
The old shadow kernel formula is not "wrong" per se, as the only judge
is if it looks good. However, the formula used is not really gaussian.
Also, the kernel size calculation doesn't really make sense to me.

This commit change the kernel formula to actually use a gaussian
distribution. As far as I can tell, there is no perceivable difference.
Except now the effective shadow radius is smaller for the same config.

Also, made that part of code a bit more mordern.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-09 02:07:08 +00:00
Yuxuan Shui da3df75a8c
Make sure the vsync methods are really available
libglvnd seems to return a pointer to a function that does NOTHING
for things the backing driver doesn't support.

So we check if the extension is actually advertised before using it.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-08 18:22:59 +00:00
Yuxuan Shui f83eb79c05
Add wintype option `redir-ignore`.
This cause certain window types to be ignored in deciding whether the
screen should be redirected after being unredirected.

Fixes #58

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-04 16:36:49 +00:00
Yuxuan Shui f97cf48865
Clean up the wintype option logic
I just realized wintype option shadow and fade never worked. If you set
the global shadow option to true, wintype shadow option will have no effect.

Now the wintype options will properly override the global ones.

Also remove deprecated options from compton.sample.conf.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-04 15:13:08 +00:00
Yuxuan Shui a3f753105f Don't allocate libev struct separately
Elimiate some annoying types.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-27 00:32:08 +00:00
Yuxuan Shui 531aafabb5 Fix SIGUSR1 handling
Calling ev_break() in a signal handler doesn't work. Instead, we setup a
libev ev_signal handler for this.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-26 23:57:55 +00:00
Yuxuan Shui b89dadec40 Fix a wrong type
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-26 23:57:55 +00:00
Yuxuan Shui 2827a020a4 Handle SIGINT
Exit gracefully so sanitizer can do their jobs.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-26 23:57:55 +00:00
Yuxuan Shui 90a4b201bd Re-word some of the comments
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-26 23:57:55 +00:00
Yuxuan Shui 010a0c34ca Don't delay update when refresh rate is not available
Fix a divide by zero in delay time calculation.

Fixes #56
2018-11-26 16:53:57 +00:00
Yuxuan Shui 0a6f48dba2 Support all alpha values
Remove alpha_step, and support all 256 alpha values.

1 pixel pictures don't really use that many resources.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-19 12:43:46 +00:00
yshui c389a1335d
Merge pull request #46 from yshui/full-shadow
Add per window type option full-shadow
2018-11-19 12:31:11 +00:00
Yuxuan Shui f834cf20ae Print deprecation message for --glx-fshader-win
No functionality is removed in this commit.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-11 19:38:58 +00:00
Yuxuan Shui bcab5d1518 Workaround the incompatibility between DRI2 and xcb
When using DRI2, Mesa uses XESetWireToEvent to hook into Xlib's event
handling loop, so it can get notified when certain DRI2 event happens,
which is crucial to the normal functioning of GLX.

When xcb is owning the event queue (meaning libxcb is doing all the
event handling), those functions registered by Mesa will never be
called, thus GLX will malfunction, leading to screen flickers or visual
artifacts.

This commit uses a hack from Qt to manually call those functions in
compton.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-10 22:25:41 +00:00
Yuxuan Shui 683cda0b91 Set clip region on the target picture
Setting it on the target buffer picture has no effect. Fix performance
problem when using xrender with virtual box.

Fixes #40

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-10 12:55:08 +00:00
Yuxuan Shui 46d162cec9 Print useful message when clear-shadow is used
Points the user to the full-shadow per window type option.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-09 21:04:22 +00:00
Yuxuan Shui 0dcb0e0dc6 Add per window type option full-shadow
When this option is enabled for a window type, shadow will be drawn in
areas that are obscure by the shape of the window.

Useful when the given window type has parts of the window transparent,
and you want to have shadows in those areas.

Fixes #45

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-09 19:56:05 +00:00
Yuxuan Shui b18d46bcbd Revert "Remove xrender-sync and xrender-sync-fence"
This reverts commit 50e2259404.

Temporarily revert the removal until we have more information about this whole
thing.

Turns out a couple of drivers don't work properly without the sync fence,
including intel, llvmpipe and NVIDIA.

Although sync fence is needed, from the information I have gathered (looking
at old bug reports, protocol specifications, look at other compositors' code),
compton's usage of it is not proper. So we need to rewrite it in the future,
after we get more information from driver developers.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-08 18:07:18 +00:00
Yuxuan Shui 2b0b7435df Convert some Xlib constants to xcb
And remove some Xlib headers

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-04 18:58:05 +00:00
Yuxuan Shui 796b0e0448 Move private functions from compton.h to compton.c
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-03 22:38:33 +00:00
Yuxuan Shui 332a873729 Add --diagnostics option
It will cause compton to print out some rudimentary diagnostics.

Also small improvements of the meson.build.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-03 22:37:18 +00:00
Yuxuan Shui e142993bb5 Enable paint-on-overlay whenever possible
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-03 22:36:52 +00:00
Yuxuan Shui be09a9a835 Workaround compiling with -ffast-math
And add a compiler warning.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-02 13:57:42 +00:00
Yuxuan Shui 45e9530bcb Update bounding shape when a window is mapped
Fixes #35

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-01 21:06:40 +00:00
Yuxuan Shui 4f4201976d Fix signedness of x properties
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-01 11:12:46 +00:00
Yuxuan Shui c0d7f9d915 Add damage when restacking windows
Interesting this problem only surface when using GTK applications on
KDE. Maybe on other WMs there are some other events after window
restacking that triggers repaint of the window.

Fixes #28

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-29 17:16:56 +00:00
Yuxuan Shui a312dcb3da Remove a debug message
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-29 13:36:48 +00:00
Yuxuan Shui 50e2259404 Remove xrender-sync and xrender-sync-fence
This was a dubious "fix" for a Nvidia driver problem. The problem was
never fully understood, and the then developers took a shotgun approach
and implemented xsync fences as a fix. Which somehow fixed the problem.
Again, I don't see any indication that the developers understood why
this "fix" worked.

(for details, see chjj/compton#152 and chjj/compton#181)

The driver problem should have been fixed almost 5 years ago. So this
shouldn't be needed anymore. In addition the way compton uses xsync fences
is apparently wrong according to the xsync spec (fences are attached to
screen, but compton uses them as if they were attached to drawables).

So, I will try removing it and see if anyone will complain. If there are
real concrete reasons why fences are needed, it will be brought back.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-28 23:36:55 +00:00
Yuxuan Shui 309a4cec79 Make monitor_repaint an option
This is a potentially useful feature for debugging the xrender backend,
so make it a commandline option rather than an obscure compiler flag.

Also this is only usable with xrender, for glx there are better tools
for debugging.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-25 23:32:10 +01:00
Yuxuan Shui 551d487836 Remove some unused parameters
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-25 23:32:10 +01:00
Yuxuan Shui f519ee53c1 Remove support of Xdbe
--dbe does not seem to have an effect on tearing, as noted in the old
manpage, and confirmed by my own testing.

So remove it, since it complicates the logic of painting.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-25 23:32:10 +01:00
Yuxuan Shui 3ffc0c77ed Replace get_alpha_pict with get_alpha_step
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-25 23:32:10 +01:00
Yuxuan Shui df63cab39a Print messages about removed options
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-24 11:10:35 +01:00
Yuxuan Shui db700f9be1 Fix OOB when the number of screens change 2018-10-22 15:38:45 +01:00
Yuxuan Shui 0b866fb17f Hot fix: trail when moving windows around
Call win_on_factor_change when window is moved. This does some
duplicate work, but fix the problem for now.
2018-10-16 17:16:18 +01:00
Yuxuan Shui aa2098eefd Move w->bounding_shape to local coordinates
This way we don't need to update the bounding region after window moves.

Also add some comments about the coordinate systems in compton.
Also change a few function that takes a `bool global` parameter to
always return region in local coordinates.
2018-10-13 01:24:52 +01:00
Uli Schlachter 9bb3327549 Die when the X11 connection breaks
With libX11, the library calls an I/O error handler if the connection to
the server breaks. The default I/O error handler prints an error message
and calls exit(). This can be seen when running a "pre-xcb" compton
against Xephyr and then closing the Xephyr window:

XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":1"
      after 241 requests (241 known processed) with 0 events remaining.

The current compton would just continue running. After this commit, it
instead exits with this message:

handle_queued_x_events(): X11 server connection broke (error 1)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-10 10:54:05 +01:00
Uli Schlachter 1c1adc96c8 Change event masks to XCB defines
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-10 10:54:05 +01:00
Uli Schlachter 37ef9c5b8a Add the xcb_connection_t to session_t
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-10 10:54:00 +01:00
Uli Schlachter 54807342f4 Convert XQueryTree to XCB
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-10 10:50:00 +01:00
Uli Schlachter 6c6156932f Convert find_client_win() to XCB
This function was the only caller of wid_get_children() which called
XQueryTree().

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-10 10:50:00 +01:00
Uli Schlachter b2bfbcdfb0 Convert XGetAtomName to XCB
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-10 10:49:52 +01:00
Uli Schlachter ca148c8f15 Fix printf format with DEBUG_EVENTS
Xlib uses unsigned long for XIDs, but xcb always uses uint32_t. Thus,
this needs the format string for uint32_t now.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-10 10:46:39 +01:00
Uli Schlachter 2da0ecdf66 Convert XSelectInput() to XCB
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-10 10:42:12 +01:00
Uli Schlachter 1b1b3456bc Convert XGetSelectionOwner to XCB
This also fixes a memory leak: buf was not freed if another composite
manager was already running.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-10 10:41:40 +01:00
Uli Schlachter 2dc90e7d4d Convert XGetInputFocus to XCB
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-10 10:41:40 +01:00
Uli Schlachter 8db6473d32 Convert property management to XCB
I removed the error checking in compton.c because it was dead code.
XChangeProperty() always returns 1.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-10 10:41:40 +01:00
Uli Schlachter a192bfb130 Replace XSetSelectionOwner with XCB
Note that the argument order is different between Xlib and XCB.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-10 10:41:40 +01:00