Commit Graph

37 Commits

Author SHA1 Message Date
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 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
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 345bacf3b3
Convert wid_get_prop to xcb
This should give us sane item size, i.e. the item has the same number of
bits their format says they have.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-09 20:54:16 +00:00
Yuxuan Shui 733d5dcf54
Fix pointer types of winprop_t
Foolish of me to assume the returned window property items have the same
number of bits their format says they have.

Apparently, format = 32 means the return items are 64 bits long (on
64-bit machines).

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-12-09 20:19:13 +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 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 471f6f90ff Remove some unnecessary macros
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-04 18:54:37 +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 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 4f4201976d Fix signedness of x properties
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-11-01 11:12:46 +00:00
Yuxuan Shui 32e0b45255 Sanitize opacity data get from window props
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-31 23:18:10 +00: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 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
Yuxuan Shui 4f071ffc30 Fix infinite recursive calls
win_rounded_corners is called by win_updated_bounding_shape, so there is
no need for the former to call the later.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-12 23:37:02 +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 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 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
Yuxuan Shui ee318582f5 Sort out license problems
IANAL, but I think I am allowed to add missing copyright notices for
someone else. And I did my best job using git history to figure out who
wrote which functions. So I hope everything is fine.
2018-10-03 22:14:51 +01:00
Uli Schlachter bc7767e086 Replace Xlib atom constants with XCB ones
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-02 19:53:28 +02:00
Yuxuan Shui 18022181ee Make sure to clear the rectangles 2018-09-30 20:41:30 +01:00
Yuxuan Shui 915839c3d3 Convert XFixesCreateRegionFromWindow to use Shape directly
Fetch the rectangles directly use the Shape extension.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 15:54:12 +01:00
Yuxuan Shui 28a2cc62fa Convert XfixesRegion to pixman region
Re-did the painting logic, and document it.

It is unclear to me what is the previous painting logic. But the current
one is basically this:

1. Go through all windows top to bottom, and put visible windows (not
   unmapped, opacity > 0, etc) into a linked list, from bottom to top
2. Accumulate a region of ignore on each window, which is basically the
   region of screen that is obscured by all the windows above current
   one.
3. Paint all the visible windows from bottom to top. Subtract the region
   of ignore from the painting region. If we need to paint shadow, we
   subtract the body of the window from the shadow painting region too,
   because we don't want shadow behind the window.
4. region of ignore is invalidated when window stack change, an
   window on top moved or changed shape, when window changed between
   opaque and transparent, etc.

Notes:

It is unclear whether all the different shapes of a window (extents,
noframe, border, bounding shape, etc) are calculated correctly or not.

It is unclear if window shape related events are handled correctly or
not. Need more testing.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 14:18:33 +01:00
Yuxuan Shui 90b6aa16ad Remove ARGB as a window mode
Instead use win_has_alpha to check for alpha channel, window mode is
reserved for determine if the window is possibly transparent.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 13:49:45 +01:00
Uli Schlachter 83a4853419 Convert use of SHAPE extension to XCB
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-09-29 11:48:58 +02:00
Uli Schlachter 539d62ca93 Port from xrender to xcb-render
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-09-27 18:14:44 +02:00
Uli Schlachter 62b847323c Port from xdamage to xcb-damage
No functional changes intended. The new xcb_damage_query_version() was
previously done by XDamageQueryExtension() internally.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-09-27 17:29:51 +02:00
Yuxuan Shui 4da626639f Update comments about clear-shadow 2018-09-24 00:20:28 +01:00
Yuxuan Shui 209b751b25 Port more stuff to xcb
To avoid interoperability issues between xcb and xlib.
2018-09-23 22:58:49 +01:00
Yuxuan Shui 43f3744fea Revert "Workaround for what seems to be a race in Xserver"
This reverts commit 967d9f32ea.
2018-09-22 19:46:50 +01:00
Yuxuan Shui 967d9f32ea Workaround for what seems to be a race in Xserver
There seems to be a race between DamageAdd (what the client uses
to report damage to Xserver) and DamageSubtract (what compton uses
to clear the reported damage, so it can receive new ones). I am not
sure how to confirm this. But this (terrible) workaround seems to
solve this problem.
2018-09-10 13:46:24 +01:00
Yuxuan Shui 72231098d1 Refactoring
* Move code around
* Remove unneeded forward declaration
* Rename win->damaged to win->ever_damaged, to be less confusing
* Expose debug functions even when DEBUG is not enabled. Compiler
  would remove the dead code for us anyway.
* Some code cleanup
2018-09-10 13:46:24 +01:00
Yuxuan Shui d2b85dd6af Fix some null pointer problems 2018-09-10 13:46:24 +01:00
Yuxuan Shui 2e39fc5618 Split out win related functions to win.c
Also move static function prototypes out of compton.h. Seems like the
previous developers didn't know what header files are for.

Seems to have bugs after the split.
2018-09-10 13:46:24 +01:00