Commit Graph

238 Commits

Author SHA1 Message Date
Yuxuan Shui 7af815a0aa Proper fix for screen freeze
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.
2018-09-22 23:57:51 +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 2adfdfa897 Clear prototypes 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
Yuxuan Shui 0d6b1627f2 Make gcc happy 2018-09-10 13:46:24 +01:00
Yuxuan Shui 571a6cf15f Enable everything OpenGL when using OpenGL
Remove finer grained macro definitions, just enable everything OpenGL
when we are using OpenGL.
2018-09-10 13:46:24 +01:00
Yuxuan Shui 3ce59930a4 More compiler warning flags 2018-09-10 13:46:22 +01:00
Yuxuan Shui 4940a93f03 c2.h cleanup
Move most of the static functions into c2.c itself, and
only keep the public functions in c2.h
2018-09-10 13:46:05 +01:00
Yuxuan Shui fcef5e706d Some cleanup work
* Remove NO_C2 option
* Split configuration related functions into their own file
* Drop support for libconfig < 1.4
* Fix dependencies in Makefile
2018-09-10 13:46:05 +01:00
Yuxuan Shui ba780659be Add repo info to usage string 2018-09-10 12:08:45 +01:00
Yuxuan Shui c8bfbd6b11 Allow setting active/inactive opacity to 0 2018-08-14 11:05:28 +01:00
Yuxuan Shui 15e3c525e3 Expose opacity_is_set, has_opacity_prop over dbus 2018-08-14 11:05:28 +01:00
Yuxuan Shui bfead72d37 Honor opacity explicitly set by rules 2018-08-14 11:05:28 +01:00
Yuxuan Shui 58a0b9ec39 Honor wintype opacity if set explicitly
Also normalize wintype opacity value to [0, 1]
2018-08-14 11:05:28 +01:00
Yuxuan Shui 66785aae99 Honor opacity prop if set
If opacity prop is explicitly set on the window, active/inactive opacity
shouldn't kick in.
2018-08-14 11:05:28 +01:00
Yuxuan Shui 91ca387723 Unify opacity_prop and opacity_prop_client
Also keep track of whether opacity prop is present on the window
2018-08-14 11:05:28 +01:00
Yuxuan Shui a1afb76c44 Warn about fallthrough
And fix some fallthroughs
2018-08-14 10:59:09 +01:00
Yuxuan Shui 27fc4a2af4 Clear compiler warnings
Thanks to chjj/compton#445
2018-05-17 12:50:22 +01:00
Yuxuan Shui af8a08e655 Remove blur limit
Thanks chjj/compton#414
2018-05-17 12:37:13 +01:00
Yuxuan Shui bf29b2dd37 Avoid using 10bit FBConfigs
Fix weird color issue with Mesa 18.0
2018-04-16 10:13:55 -04:00
Uli Schlachter 1125389910 Exit when compton loses the _NET_WM_CM_Sn selection
Again, this behaviour is required by ICCCM.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-04-16 10:13:55 -04:00
Uli Schlachter f8ea3e8668 Don't steal the _NET_WM_CM_Sn selection (#301)
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>
2018-04-16 10:13:55 -04:00
Yuxuan Shui cfdb946992 Avoid using window id as identifier in finish_destroy_win
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.
2018-04-16 10:13:55 -04:00
Yuxuan Shui f4f39d1989 Avoid changing fade_callback when window is destroyed
Fix assertion at src/compton.c:1261
2018-04-16 10:13:55 -04:00
Richard Grenville 2343e4bbd2 Misc #308: Close config file after using it
Misc #308: Close the config file after using it, instead of leaving it
open forever. Thanks to SyedAmerGilani for the report.
2015-09-22 08:34:28 +08:00
Richard Grenville 20e996494b Misc: Modify function attributes
- 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.
2015-09-06 22:34:02 +08:00
Richard Grenville c156abb0e8 Bug fix #302: Use more EWMH-compliant way to determine frame extents
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.
2015-09-06 22:19:19 +08:00
Richard Grenville 7d4d87d683 Misc: Add margin_t & Store frame extents with it & Misc
- 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.
2015-09-06 20:53:07 +08:00
Kevin Kelley 0e0b35a361 Plug XserverRegion leak. 2015-05-12 13:17:35 -07:00
Richard Grenville 663e1a1a04 Bug fix: --active-opacity state does not change correctly on `--focus-exclude`-ed windows
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).
2015-02-24 21:08:29 +08:00
Richard Grenville 3b17fe15f0 Bug fix #263: Always redirect std{out,err} if --logpath is specified
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)
2015-01-26 21:28:48 +08:00
Richard Grenville e4ff1a5130 Misc: Update disabled-at-compile-time notes in the usage text
- 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.
2015-01-11 16:24:54 +08:00
Richard Grenville 03ebae4c33 Bug fix: Compilation failure with NO_VSYNC_OPENGL=1
Fix compilation failure with NO_VSYNC_OPENGL=1, caused by one
incorrectly placed "#endif" in "src/common.h".
2015-01-11 10:47:19 +08:00
Richard Grenville 65e655e3bc Bug fix: --no-fading-openclose doesn't work when fading out
- 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.
2014-11-30 15:39:07 +08:00
Richard Grenville 6d8fde457a Bug fix #244: Build failure with -DDEBUG_EVENTS
Fix build failure with -DDEBUG_EVENTS, caused by incorrect references to
X Sync macros. Thanks to blueyed for reporting. (#244)
2014-11-24 22:31:54 +08:00
Richard Grenville 5910dbae8a Misc #215: Reformat usage text & update docs
- 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.
2014-11-24 22:03:07 +08:00
Richard Grenville 651a66131f Bug fix #224: Flush after XUngrabServer()
Fix #224 by XFlush() after XUngrabServer(). Thanks to rathsky and smlx
for reporting.
2014-10-06 11:36:47 +08:00
Richard Grenville 8c88b4d6f1 Misc #204: Add glx_take_screenshot() & 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.
2014-09-07 18:58:09 +08:00
Richard Grenville c5f45c8e3c Merge branch 'richardgv-dev' of github.com:chjj/compton into richardgv-dev 2014-09-07 16:07:26 +08:00
Richard Grenville 094b75eef7 Misc: Add --no-name-pixmap
Add --no-name-pixmap to disable the usage of
XCompositeNameWindowPixmap(), for debugging.
2014-09-07 16:05:14 +08:00
mæp 72301f9177 fix crash caused by free of uninitialized pointer 2014-08-06 20:42:57 +02:00
Richard Grenville 4f9050f53f Misc: Fix spelling mistakes
Still, "Guassian" -> "Gaussian". (#221)
2014-08-06 07:32:53 +08:00
Richard Grenville a801118c04 Bug fix: Fix X pixmap leakage in shadow_paint
- Fix X pixmap leakage in shadow_paint.

- Add the skeleton of a X resource leakage checker.
2014-08-03 19:40:40 +08:00
Richard Grenville 3cfbaac955 Misc: Fix compilation with NO_VSYNC_OPENGL_GLSL / NO_C2
Fix compilation with NO_VSYNC_OPENGL_GLSL / NO_C2.
2014-07-29 09:29:26 +08:00
Richard Grenville 4724c1f21a Misc #218: Warn about using --glx-no-rebind-pixmap on intel driver
Warn about using --glx-no-rebind-pixmap on xf86-video-intel. Thanks to
aktau for the info. (#218)
2014-07-28 16:54:02 +08:00
Richard Grenville 234e3e8cda Improvement: Separate GLX parts from session_t & Attempt to fix #217
- 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.
2014-07-28 12:50:15 +08:00
Richard Grenville 4e8ccea252 Misc: Add --version & --no-x-selection
- Add --version. (#206)

- Add --no-x-selection for debugging. (#207)
2014-07-13 09:34:38 +08:00