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>
Errors for requests sent via Xlib that expect a reply are handled via
XSetErrorHandler(), which sets up a callback function that Xlib calls.
Errors for requests that do not expect a reply or for errors caused via
unchecked XCB requests show up as events of type 0 in the event handling
function.
Before this commit, errors were ignored here. This commit changes the
code so that the errors are printed 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>
The X11 server's answer is not \0-terminated, so xcb_str_name() also
does not provide a \0-terminated pointer.
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.
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.
* 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.
Before becoming the selection owner for _NET_WM_CM_Sn, compton will now check if
that selection is already owned (which means that another composite manager is
already running). If this check fails, startup will be refused. This behaviour
is required by EWMH / ICCCM.
Because this should catch all composite managers, the error message that was
used before when another manager is already running is reworded to mention that
the other manager does not follow EWMH.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Under extreme race conditions (window A close at the same time as window
B create), there can be multiple windows with same id in compton's window
list. If at this point window B closes itself as well, finish_destroy_win
might destroy a different window as what's passed to destroy_callback.
This can be a problem because someone can still hold a reference to that
window (e.g. 't' in paint_preprocess), and there's no way to clear that
reference. If finish_destroy_win always destroy the same window passed
to destroy_callback, this will not be a problem.
- 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.
Bug fix: Select the larger of the X window border width and
_NET_FRAME_EXTENTS, instead of adding them together, when determining
the frame extents. (Supposedly) more EWMH compliant, as EWMH
_NET_FRAME_EXTENTS should include the X window border width already. We
did not choose to completely rely on _NET_FRAME_EXTENTS to remove the
need to keep track of whether there is a _NET_FRAME_EXTENTS, and
(hopefully) take care of some cases when it is wrong. The commit should
fix awesomeWM/awesome#425. Thanks to psychon for the information. (#302)
The commit fixes the bug in win_get_region_noframe() that the X window
border width is not considered when determining the width/height of the
window without frame, as well.
- 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.
Fix the bug that --active-opacity state does not change
on `--focus-exclude`-ed windows correctly, since win_update_focused()
enables the WFLAG_OPCT_CHANGE flag on a window only if w->focused
changes, while --active-opacity depends on the output of
win_is_focused_real() instead of w->focused, which could be changed even
if w->focused does not change (e.g. when the window is
`--focus-exclude`-ed).
Always redirect std{out,err} if --logpath is specified, instead of only
redirect after fork, to correct the inconsistent behavior of --logpath
when getppid() returns 1. (#263)
- Add disabled-at-compile-time note in usage text with NO_LIBCONFIG.
- Fix the incorrect disabled-at-compile-time note for --backend.
- Move position of the disabled-at-compile-time note of --dbus
slightly.
- Fix the bug that --no-fading-openclose doesn not work when fading out
by writing w->fade_last as well in win_determine_fade().
- Write w->fade_last for applying w->fade_force, as well.
- Reformat usage text by adding a blank line between descriptions of
two switches. (#215)
- Update documentation for a bit. Correct some wrong statements and
clarify some others.
- 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.