Commit Graph

1272 Commits

Author SHA1 Message Date
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
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 7d00b89364
x_get_pictform_for_visual should return const *
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-07 00:22:16 +00:00
Yuxuan Shui aa9c439cc6
Improve the interface of glx_find_fbconfig
Remove the dependence of xcb_render types in glx.h

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-07 00:04:43 +00:00
Will Dietz 345009c677 meson.build: bump project version 2019-02-04 09:28:31 +00:00
Yuxuan Shui f19766f15a
Fix FBConfig cost calculation
Double buffering only doubles the color buffer, not the depth and
stencil.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-03 19:33:31 +00:00
Yuxuan Shui 2263bab2ff
Consider buffer size and double buffering as well
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-03 19:15:30 +00:00
Yuxuan Shui 519bf8500b
Prefer FBConfig with smaller depth + stencil buffer
Reduce GPU memory usage to what it was before fix-fbconfig.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-03 19:06:33 +00:00
Yuxuan Shui 39b612a8a4
Delete irrelevant comments
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-03 18:53:28 +00:00
Yuxuan Shui b1d8687b31
Add copyright notice to backend/**
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-03 18:47:36 +00:00
yshui 6a5ad609ba
Merge pull request #104 from yshui/fix-fbconfig
Fix fbconfig lookup
2019-02-03 18:43:58 +00:00
Yuxuan Shui 388a7f3ad4
Fix leaking of root_tile FBConfig
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-03 18:41:47 +00:00
Yuxuan Shui 24370f44e6
Cache FBConfig used for shadows
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-02-03 18:41:47 +00:00
Yuxuan Shui 8922312e42
Refactor FBConfig lookup
Background: To bind a Xorg window content to a OpenGL FBConfig, which
has to match the color format the Xorg window is using.

Previously, compton just find a FBConfig that has the same depth. This
led to chjj/compton#477, which has been fixed by a ugly hack.

The commit refactor the lookup mechanism to take as much into
consideration as we reasonably can. Hopefully preventing similar
breakages in the future.

Also, some code sharing between the old and new glx backend.

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