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.
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.
Bugs:
* There seems to be a noticeable frame loss when window
is being opened/closed. But the same problem also exists
in master/next, so this is not a regression.
* Using --sw-opti and --benchmark at the same time causing
compton to draw more frequently than permitted by the
arguments. That is because the sleep interval calculation
is flawed. Not really a regression either.
Verified still working:
* Usual painting
* Fade
* Benchmark mode
* --sw-opti (with or without benchmark mode)
* DBus
* Unredir delay
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
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>
Change `win *` to `win **`, because a window could be freed by the
callback, so we can set `*w` to NULL to communicate that.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Also remove some debug function calls (there are better tools for opengl
debugging now). Also remove copysubbuffermesa
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
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>
The existing mechanism with set_ignore_next() is (IMHO) ugly and also
does not work with XCB requests. This commit adds a new function
set_ignore_cookie() and fixes callers that were converted to XCB to use
this new function instead.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Note that this adds an include for Xfixes.h, because that header is
still needed and was previously included through Xcomposite.h.
Signed-off-by: Uli Schlachter <psychon@znc.in>
No functional changes intended. The new xcb_damage_query_version() was
previously done by XDamageQueryExtension() internally.
Signed-off-by: Uli Schlachter <psychon@znc.in>
If an X event is received at a very specific point in time, it can trigger
a race condition in Xlib. Said event will be read, but Xlib will
nonetheless be completely unaware of the event.
This cause compton to sometimes block on select() while there are events
ready to be processed. If the event is a damage report, screen freeze
will happen until some other event is received.
The proper fix is to switch to xcb for event handling, thus avoid this
problem entirely.
* 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
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.
- Remove the const function attribute from get_time_*(), since the
functions they call that actually get the time probably access global
variables or have other behaviors unacceptable for const functions.
- Change the const function attribute on win_has_frame() to pure, as it
accesses memory its parameter points to, which is invalid for a const
function.
- Add margin_t, a structure that represents margins around a rectangle.
- Store frame extents of a window with margin_t, replacing the 4
fields ({left,right,top,bottom}_width) in struct _win.
- Add two helper macros, cmemzero() and cmemzero_one(), that zero out a
block of memory.
- Add glx_take_screenshot() for taking a screenshot. With ImageMagick
the output data could be viewed in this way:
display -size [SCREEN-WIDTH]x[SCREEN-HEIGHT] -depth 8 -flip
rgb:[PATH]
(#204)
- Add D-Bus command `opts_get string:paint_on_overlay_id` to get X
Composite overlay window ID. (#204)
- Code cleanup.
- Separate GLX parts from session_t into glx_session_t.
- Add --rererdir-on-root-change and --glx-reinit-on-root-change, as
possible solutions for #217. Thanks to jlindgren90 for reporting.