Commit Graph

803 Commits

Author SHA1 Message Date
Yuxuan Shui 7ac351e5b5
Move some default_* functions to backend_common.c
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-03 18:41:02 +00:00
Yuxuan Shui b061789a84
Add helper function x_get_visual_depth
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-03 16:49:04 +00:00
yshui 386f5fb8c6
Merge pull request #105 from yshui/no-session_t-season1
Most of the x_* functions don't need session_t
2019-02-03 16:03:59 +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 0be3fb5ea2
Remove some unused macros/ifdefs
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-02 22:19:15 +00:00
Yuxuan Shui eadb09ee0d
Remove glx_mark
glx_mark is part of the logging system now, so no need for the old
functions.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-02 22:05:53 +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 8371d6a0b7
Replace glDrawBuffers with glDrawBuffers
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-02 19:30:07 +00:00
Yuxuan Shui 94505bbcf4
Fix compiling on older gcc
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-02 02:12:08 +00:00
Yuxuan Shui 0947148fcc
Fix compiler warnings
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-02 02:00:15 +00:00
Yuxuan Shui 465a968ddd
Parse number locale-independently
Previously we were using glibc's strtod function to parse floating point
numbers. The problem is, strtod is locale dependent. Meaning 7,7 might
be parsed as two numbers (7 and 7) in one locale, and parsed as one
number (7 point 7) in another locale. This is undesirable.

We need to set the locale to a value we know to make number parsing
consistently. We could use setlocale(), but that is not thread-safe. We
can also use uselocale(), which is thread-safe, but doesn't cover strtod
(Yeah, some of the locale-aware functions only acknowledge the global
locale, not the thread local one).

So in frustration, I just wrote a simple floating point number parser
myself. This parser obviously doesn't cover all cases strtod covers, but
is good enough for our needs.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-02 01:28:15 +00:00
Yuxuan Shui 3f5a4d570c
Fix memory leak in glx_init_blur
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-31 22:47:04 +00:00
Yuxuan Shui b76a4234e5
Fix NULL dereference in glx_update_fbconfig
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-31 22:46:12 +00:00
Yuxuan Shui 543bbe6a39
Fix NULL pointer dereference in glx_init_blur
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-31 22:40:17 +00:00
Yuxuan Shui a0739b7d86
Update CONTRIBUTORS
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-30 22:47:02 +00:00
Yuxuan Shui 205427d7da
Exit with exit code 1 when argument parsing failed
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-30 22:19:05 +00:00
Yuxuan Shui 83c32e1dd6
Tweak the wording in man page
Make it clearer how command line options and config file options are related.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-30 20:53:34 +00:00
Yuxuan Shui c11c24b3f2
Improve config file search order
Previously the search order is:

~/.config/compton/compton.conf
/etc/xdg/compton/compton.conf
~/.config/compton.conf
/etc/xdg/compton.conf
...

Now the search order is:

~/.config/compton/compton.conf
~/.config/compton.conf
~/.compton.conf
/etc/xdg/compton/compton.conf
...

In other word, compton will now search all possible user config file
path first before searching for a system config file.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-30 00:27:14 +00:00
Yuxuan Shui f7d4dff099
Use strncpy for string_utils functions
Also removed mstrjoin3 since it's not used.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-30 00:12:12 +00:00
Yuxuan Shui 9d64decf2a
`compton -h` should quit after printing help
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-29 23:36:34 +00:00
Yuxuan Shui 83eff258b7
Remove mentions of dbe from the man page
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-29 23:24:52 +00:00
Yuxuan Shui 1627a91c76
Use glDrawBuffer instead of glDrawBuffers in glx_blur_dst
glDrawBuffers doesn't take GL_BACK, which is what we are passing. And we
are using only one buffer argument anyway, no need to use glDrawBuffers.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-29 23:18:44 +00:00
Yuxuan Shui 4e14eec2ba
Remove a redundant glEnd in glx_dim_dst
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-29 22:27:05 +00:00
yshui 4881de924a
Merge pull request #94 from MisterDA/misspellings
Fix small misspellings
2019-01-28 11:59:09 +00:00
Antonin Décimo 8366310daf Fix small misspellings 2019-01-28 10:58:14 +01:00
Yuxuan Shui 198dcdb987
gl_common: fix coordinate mismatch
Xorg uses top left as origin, OpenGL uses lower left. So we need to flip
the y axis, and make sure we are using the right points as origin of
windows.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-28 01:14:41 +00:00
Yuxuan Shui 3b21365e94
gl_common: fix rendering
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-28 00:48:26 +00:00
Yuxuan Shui 6e454adff1
glx (new backend): Add some missing functions
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-28 00:04:01 +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 5364c8ac9b
Add backend_info_t::max_buffer_age
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-27 19:45:40 +00:00
Yuxuan Shui d92a546beb
Fix includes and typos in new backends 2019-01-27 19:34:26 +00:00
Yuxuan Shui 22f0d10c65
Make backend_info_t::buffer_age optional
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-27 19:32:07 +00:00
Yuxuan Shui b50f15c835
Adapt paint_all_new to new interface
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-27 19:29:02 +00:00
Yuxuan Shui e898526afb
Add glx_backend to backend_list
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-27 19:28:15 +00:00
Yuxuan Shui 99b3c4575f
Fix handling of region == NULL in paint_all_new
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-27 18:21:42 +00:00
yshui 5a1975909a
Merge pull request #93 from yshui/gl-reuse
Reuse some code from the new gl backend
2019-01-27 18:18:51 +00:00
Yuxuan Shui 061dd8e52e
Reuse some code from the new gl backend
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-27 18:16:28 +00:00
Yuxuan Shui 290ec7fb04
Don't pretend that we have glStringMarker
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-27 17:45:38 +00:00
Yuxuan Shui 6c6dd6ad7d
Remove unused session_t argument from gl_has_extension
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-26 23:08:32 +00:00
Yuxuan Shui 031356069a
new glx: Add glx_present
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-26 18:01:24 +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
yshui 377b18a00f
Merge pull request #89 from yshui/fmodules
Even more includes
2019-01-20 22:14:00 +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
yshui 4bdbd48e55
Merge pull request #88 from yshui/fmodules
Improve the header includes, cont'd
2019-01-20 17:12:48 +00:00
Yuxuan Shui 916e23861a
Improve the header includes, cont'd
Also check in the modulemap file, and add a option to build with clang's
-fmodules.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-01-20 17:10:06 +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