Commit Graph

378 Commits

Author SHA1 Message Date
Yuxuan Shui cb4bab1cf6 Print deprecation warning for removed OpenGL options
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 21:07:29 +01:00
Yuxuan Shui 03f33ed45c Move a couple X related functions to x.c
Also replace remaining Pixmap with xcb_pixmap_t

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 20:57:42 +01:00
Yuxuan Shui ddab20176b Fix building with ENABLE_XRESCHECK=1 2018-09-30 20:43:34 +01:00
Yuxuan Shui 18022181ee Make sure to clear the rectangles 2018-09-30 20:41:30 +01:00
Yuxuan Shui 6a41bebfa5 Just clear shadow anyways
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 20:12:06 +01:00
Yuxuan Shui 97cd3421b0 Remove last bits of Xfixes
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 15:54:12 +01:00
Yuxuan Shui e0bc6f5f7c Add helper macros for calling xcb function and wait for reply
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 15:54:12 +01:00
Yuxuan Shui ff27ca4072 Move xerror_common to x.c
Also rename it to x_print_error

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 15:54:12 +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 82e63593ae region.h: helper functions for converting rect types
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 15:54:12 +01:00
Yuxuan Shui a7d50ffdb2 Remove unused function rect_crop
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 56f7dd36f6 x: Add region related helper functions
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 14:18:33 +01:00
Yuxuan Shui 3f4c05720d utils.h: Some utility functions and macros
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 14:18:33 +01:00
Yuxuan Shui ab12467c3f Change fade callback function parameter
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>
2018-09-30 14:18:33 +01:00
Yuxuan Shui 417744df14 Move opengl related function prototype to opengl.h
And aggregate some of the OPENGL ifdefs

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 14:18:01 +01:00
Yuxuan Shui c01ad5bf04 Move OpenGL functions around
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>
2018-09-30 13:49:45 +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 8848676540 Add a function that allocates a pixmap and checks success
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-09-30 09:31:22 +02:00
yshui 6ec951763e
Merge branch 'next' into more-xcb-conv 2018-09-30 04:53:34 +01:00
Uli Schlachter aedea014a9 Replace XFixes initialisation with xcb
XFixesQueryExtension() does an XFixes QueryVersion request internally,
so one was added here.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-09-29 17:02:44 +01:00
Uli Schlachter 529306e65f Convert usage of XCreatePixmap to xcb
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-09-29 12:00:18 +02:00
Uli Schlachter ea9942b87e Replace use of XFreePixmap with XCB
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-09-29 11:53:30 +02:00
Uli Schlachter 9dff55540f Convert Xinerama usage to xcb
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-09-29 11:48:58 +02: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 aa8cb217c8 Fix xcb error ignoring
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>
2018-09-29 11:48:58 +02:00
Uli Schlachter 00ae9718ee Handle asyncronous X11 errors
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>
2018-09-29 11:48:58 +02:00
Uli Schlachter 3ed73b1f8e Replace last definitions from Xcomposite.h with xcb
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>
2018-09-29 11:48:57 +02:00
Uli Schlachter 2f49f6f03d Switch XComposite initialisation to XCB
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-09-29 11:48:57 +02:00
Uli Schlachter 8064eaaa37 Replace more usage of XComposite with xcb
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-09-29 10:38:25 +02:00
Uli Schlachter 79089b0652 Port XCompositeUnredirect{Subw,W}indows to xcb
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-09-29 10:37:53 +02:00
Uli Schlachter 11204e7a44 Port usage of XCompositeNameWindowPixmap to xcb
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-09-29 10:37:29 +02:00
Uli Schlachter 7719dc7325 RENDER: Fix check for convolution filter
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>
2018-09-28 10:45:16 +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 6d54d6b055 Port from xrandr to xcb-randr
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-09-27 17:38:24 +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
Uli Schlachter 0a98ef79ef Fix build with NO_LIBCONFIG=1
This got broken in commit fcef5e706d.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-09-27 17:10:43 +02:00
Yuxuan Shui 4da626639f Update comments about clear-shadow 2018-09-24 00:20:28 +01:00
Yuxuan Shui 6f59367c00 Remove the clear-shadow option
Shadows attached to ARGB/transparent windows are always cleared now.
2018-09-23 23:58:17 +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 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
Michael Reed a29b7958cf whitespace cleanup 2014-07-04 06:27:13 -04:00
Richard Grenville 3a3e1387ac Misc #205: Add 2 long options & Update documentation
- Add two long variants of short options.

- Update documentation.
2014-06-15 11:51:59 +08:00
Richard Grenville 81c677f28b Feature: #183 custom window shader & #193 --no-fading-destroyed-argb
- Add --glx-fshader-win, which specifies a custom fragment shader for
  painting windows. compton-default-fshader-win.glsl is the shader with
  default behavior, and compton-fake-transparency-fshader-win.glsl
  provides a template of fake transparency. (#183)

- Add --force-win-blend to force all windows to be painted with
  blending.

- Add --no-fading-destroyed-argb, as a workaround of bugs in some WMs.
  (#193)
2014-05-16 15:18:17 +08:00
Richard Grenville bb55706c05 Bug fix #195: Pointer incompatibility with libconfig-1.3*
Fix pointer incompatibility with libconfig-1.3*. Thanks to
sstewartgallus for reporting. (#195)
2014-05-10 12:21:23 +08:00
Richard Grenville 349af129b8 Bug fix #194: Fix assertion failure in some cases
Fix assertion failure when evaluating --unredir-if-possible-exclude or
--paint-exclude on unmapped windows. Thanks to ppuryear for reporting.
(#194)
2014-04-28 21:21:16 +08:00
Richard Grenville ef58e4e417 Bug fix #191: Add rounded-corners detection to --unredir-if-possible
Add `bounding_shape` and `rounded_corners` as condition match target.
Deprecate --shadow-ignore-shaped. Add rounded-corners detection to
win_is_fullscreen(). Slightly modify win_rounded_corners() logic. Thanks
to tdryer for reporting. (#191)
2014-04-21 22:45:27 +08:00
Richard Grenville 15cd6aad38 Misc: Fix a possible assert() failure 2014-04-21 07:49:29 +08:00
Richard Grenville b7b043c3cc Bug fix #190: Copy shadow/fade state from last paint on unmapped wins
Copy shadow/fade/color-inversion/background-blur state from last paint
on unmapped windows. I hope it doesn't have unexpected side effects.
(#190)
2014-04-19 21:52:20 +08:00
Richard Grenville 9a99e7a0dd Misc: Try to avoid evaluating conditions after window unmap & others
- Try to avoid evaluating conditions after window unmap/destruction.
  Unfortunately, frequently this doesn't work due to the asynchronous
  nature of X.

- Add _GTK_FRAME_EXTENTS exclusion rules to compton.sample.conf. Thanks
  to memeplex, hexchain, and others for info. (#189)

- Add debugging option --show-all-xerrors, and other debugging changes.
  Doc update.
2014-04-19 19:41:26 +08:00
Richard Grenville 360da12d86 Misc: Add --xrender-sync{,-fence} as configuration file option
- Add --xrender-sync{,-fence} as configuration file option.

- Quit on encountering invalid opacity rule.

- Other small changes.
2014-03-26 22:27:25 +08:00
Richard Grenville e4f3a2d77a Bug fix #181: Add --xrender-sync{,-fence}
- Add --xrender-sync{,-fence} to deal with redraw lag issue on GLX
  backend. --xrender-sync-fence requires a sufficiently new xorg-server
  and libXext. NO_XSYNC=1 may be used to disable it at compile time.
  Thanks to tchebb for reporting and everybody else for testing. (#181)

- A bit code clean-up. Replace a few XSync() with XFlush() to minimize
  the latency.
2014-03-17 23:25:34 +08:00
Richard Grenville 9950d08ab7 Misc: xr-glx-hybrid alias & minor fixes
- Add "xr-glx-hybrid" as an alias of "xr_glx_hybrid". (#163)

- Clear damage history in expose_root() and when root window size
  changes. Unfortunately this doesn't fix #181.
2014-03-11 07:22:23 +08:00
Richard Grenville 8a5becf617 Bug fix: Fix -S
Fix the broken -S.
2014-02-27 22:08:30 +08:00
Richard Grenville aeda1482ce Bug fix: Fix access to freed memory due to invalid w->prev_trans
- Fix a bug that w->prev_trans sometimes points to freed memory.
  Probably related to #165.

- Add some more debugging printf()-s under DEBUG_EVENTS.
2014-01-21 22:13:06 +08:00
Richard Grenville f1f7b050af Bug fix #163: xr_glx_hybrid: Flickering issue
xr_glx_hybrid backend: Attempt to fix flickering issue. Thanks to cju
for testing.
2014-01-19 08:04:14 +08:00
Richard Grenville 3e783f3e1e Misc #163: Make usage of glFinish() optional
Make usage of glFinish() optional to avoid high CPU usage. (#163)
2013-12-26 20:43:06 +08:00
Richard Grenville 9e053910f2 Misc #152: Fix a spelling mistake
Fix a spelling mistake (xr_glx_hybird -> xr_glx_hybrid). Thanks to cju
for reporting.
2013-12-24 07:46:48 +08:00
Richard Grenville fbd70e146c Feature: Add XRender-GLX hybird backend
- Add new backend "xr_glx_hybird", which uses X Render for all
  compositing but GLX on the last step of rendering to screen.  This
  makes GLX-backend-specific VSync methods usable while may avoid
  certain bugs with GLX backend. The idea comes from ali1234.
  Experimental.

- GLX backend: Stop using or rendering to depth buffer.

- Use glFinish() instead of glFlush() before VSync. It probably uses
  more CPU but could be more reliable than glFlush().
2013-12-10 22:06:02 +08:00
Richard Grenville c02a867e6f Misc: Add properties to the registration window
Add WM_CLASS, COMPTON_VERSION, and _NET_WM_PID properties to the
registration window, to ease the development of pcman's compton-conf.
2013-11-10 10:13:18 +08:00
Richard Grenville 46e6abdd2a Misc: --write-pid-path & small changes
- Add --write-pid-path to write process ID to a file, to help
  determining compton's process ID when -b is used.

- Add a few extra targets to query through D-Bus opts_get (version, pid,
  etc.) and through win_get, primarily for debugging.

- Add helper macros likely(), unlikely(), cmalloc(), ccalloc(),
  crealloc().

- Change w->opacity_set to opacity_t. Determine display_repr in
  session_init(), etc.
2013-11-09 21:38:31 +08:00
Richard Grenville d8977408fd Bug fix #153: Possible fix for a rare timing issue
Possible fix for a very rare timing issue in focus detection. Compton
may fail to detect the currently focused window, when a window newly
mapped gets focused, we failed to listen to events and get FocusIn from
it in time, and a series of focus change events before it happens stay
in the event queue and puzzled compton. My choice is to force focus
recheck on all focus-related events. More roundtrips to X, but not
necessarily worse performance, due to the high cost of focus flipping
especially when there's a lot of conditions. Thanks to SlackBox for
reporting.  (#153)
2013-10-21 22:17:01 +08:00
Richard Grenville 796e2c6fec Bug fix #149: --opacity-rule misbehaves on 32-bit systems & others
- Fix a bug that --opacity-rule misbehaves with a value higher than 50%
  on 32-bit systems. Thanks to mrinx for reporting. (#149)

- Fix a bug that opacity-rule in configuration file does not work.
2013-10-01 23:20:22 +08:00
Richard Grenville fc8ec8851f Misc: Typo in vsync_opengl_init()
I typed ps->glXGetVideoSyncSGI as ps->glXWaitVideoSyncSGI...
2013-09-26 07:41:11 +08:00
Richard Grenville f202223572 Misc: Add cfg file options for --unredir-if-possible-*
Add configuration file options for
--unredir-if-possible-{delay,exclude}. (#140)
2013-09-24 20:41:50 +08:00
Richard Grenville 4bd3db2bc7 Bug fix #99: Rewrite focus detection logic
- Rewrite focus detection logic. Remove w->focused_real and use
  ps->active_win to identify focused window uniformly. Use a more
  expensive way to filter FocusIn/Out events to improve reliability.
  Only limited tests are done, and bugs are likely to be introduced.
  (#99)

- Known issue: Under fvwm, compton sometimes does not consistently
  report the window input gets sent to. But there's something wrong in
  that case: XGetInputFocus() shows the root window is focused but
  another window is receiving input.
2013-09-18 22:41:40 +08:00
Richard Grenville 747ffaef0f Bug fix #144: Workaround for insane window type changes
Dynamically detect window type as a workaround to insane applications.
Thanks to Feltzer for reporting. (#144)
2013-09-15 11:07:49 +08:00
Richard Grenville 926ae379ba Bug fix #143: GLSL shader error on European locales
Set LC_NUMERIC=C when generating GLSL shader strings to avoid decimal
point issues on European locales. Thanks to hiciu for reporting.
2013-09-15 08:56:53 +08:00
Richard Grenville 5da802634a Bug fix #143: Move setlocale(LC_NUMERIC, "C")
Move setlocale(LC_NUMERIC, "C") to a better place, in hope to fix #143.
Thanks to hiciu for reporting!
2013-09-14 10:04:38 +08:00
Richard Grenville e9d187f03e Bug fix #140: Possible fix for CPU usage with --unredir-possible-delay
- Possible fix for high CPU usage with a low --unredir-possible-delay.
  Thanks to Feltzer for reporting. (#140)

- Rewrite some parts to (hopefully) increase performance, especially
  with --unredir-if-possible.

- Known issue: With GTX 670 and x11-drivers/nvidia-drivers-325.15, and
  compton --unredir-if-possible --config /dev/null, if you send a
  SIGUSR1 to compton when a full-screen solid window is there, in which
  case compton either redirects then immediately unredirects the screen,
  or just don't redirect it altogether, X freezes after compton
  unredirects the screen. Requests sent by other X clients are not
  responded until compton is killed, which indicates the possibility of
  a bug in X.  Attaching to X process shows X is on ./os/waitFor.c.
  Backend does not matter. --paint-on-overlay fixes the issue somehow.
  compton-git-v0.1_beta1-5-g4600f43-2013-08-28 doesn't exhibit the
  issue, but it's probably timing-related.
2013-09-12 21:23:20 +08:00
Richard Grenville 4acbd56722 Improvement: --unredir-if-possible-exclude & --unredir-if-possible-delay
- Add --unredir-if-possible-exclude, to exclude certain windows when
  evaluating --unredir-if-possible. (#140)

- Add --unredir-if-possible-delay, to add some delay before
  unredirecting screen. (#138, #140)

- Code clean-up.
2013-09-04 22:00:51 +08:00
Richard Grenville 5350127b72 Misc: GLX: Avoid using multi-sampling visuals
Avoid using multi-sampled visuals, like the cogl patch:
http://people.freedesktop.org/~glisse/0001-glx-do-not-use-multisample-visual-config-for-front-o.patch
2013-09-03 21:14:40 +08:00
Richard Grenville 4600f435dd Bug fix #137: Auto-detect screen changes
Attempt to auto-detect screen changes to address the issue reported by
Feltzer.
2013-08-28 21:54:04 +08:00
Richard Grenville 5d4ed8f43f Misc: Add missing configuration file options and switches
- Add "xinerama_shadow_crop" configuration option.

- Add long commandline switches corresponding to the short ones.

- Documentation update.
2013-08-26 22:00:53 +08:00
Richard Grenville 3e71f8fa25 Improvement #137: --xinerama-shadow-crop
Add --xinerama-shadow-crop to crop shadow to current Xinerama screen.
Thanks to Feltzer for suggestion.
2013-08-22 21:44:15 +08:00
Richard Grenville 7417f0deee Misc: stoppaint_force & Documentation update
- Add stoppaint_force option, controlled via D-Bus, to stop painting
  completely, which may look better than unredirecting the screen,
  sometimes. (#41)

- Add x2, y2 matching targets.

- Update documentation.
2013-07-30 22:24:11 +08:00
Richard Grenville b46deb5162 Improvement #41: Enable/disable redirection through D-Bus
- Add "redirected_force" to D-Bus opts_get to forcefully
  redirect/unredirect windows.

- Add D-Bus method "repaint", to, namely, repaint the screen.
2013-07-26 13:02:06 +08:00
Richard Grenville b1e0ef8ecd Bug fix #124: GLX: Missing check on FBConfig X visual depth
- Check FBConfig X visual depth, like Compiz, to fix issues with
  nvidia-drivers-325.08 . Thanks to guotsuan for reporting.
2013-07-05 23:22:58 +08:00
Richard Grenville b26bbc0099 Misc: OpenGL 3.0 compatibility & misc
- Fix OpenGL 3.0 compatibility by changing glFramebufferTexture() to
  glFramebufferTexture2D(). Thanks to danfe for suggestion!

- Add notification about DocBook toolchina dependencies. Thanks to
  danfe. (#121)
2013-06-25 23:08:41 +08:00
Richard Grenville c02b3fadf0 Misc: --paint-exclude & #119
- Add --paint-exclude to prevent certain windows from being painted, for
  debugging purposes.

- Add predefined matching target "x", "y", "width", "height", "widthb",
  "heightb", "border_width", and "fullscreen".

- Fix bug #119, wrong man page install dir in CMake configuration.
  Thanks to sstewartgallus for reporting.
2013-06-19 19:36:48 +08:00
Richard Grenville 044a5c991c Feature #116: Shadow exclusion region
- Add --shadow-exclude-reg, which excludes certain regions on the screen
  to have shadows painted in. (#116)

- Adjust session initialization order. Now X root and screen info and
  basic X extensions are available in configuration parsing step.
2013-06-09 17:09:28 +08:00
Richard Grenville 75ebd56f74 Feature #113: Set opacity based on conditions
- Add --opacity-rule, which sets opacity based on conditions, as
  requested by zabbal. (#113)

- Add a data field for each condition.

- Correct the FAQ link in README.md. Silly me.

- Code clean-up.
2013-05-21 09:26:18 +08:00
Richard Grenville 07bc7485c3 Imp: Multi-pass blur & D-Bus fading control
- Add multipass blur support. Note GLX Framebuffer support is required.
  My benchmark shows multipass blur brings 5% performance boost for X
  Render backend (3x3box). On GLX backend it brings 10% performance
  boost for 5x5box but negatively affects performance for 3x3box. Thanks
  to jrfonseca for advice. (#107)

- GLX backend: Cache blur texture for each window, for a 12% performance
  boost.

- Add D-Bus fading control. Thanks to yulan6248 for testing. (#112)

- Fix FAQ link in README.md. Thanks to lorenzos for report. (#111)

- Correctly deinitialize VSync on on-the-fly VSync method switch.

- X Render backend: Normalize blur kernel.

- Code clean-up.

- Known issue: Linear corruption on border of a window may appear with X
  Render multi-pass blur. Possible to fix but probably not worthwhile.
2013-05-20 18:16:27 +08:00
Richard Grenville 57d8b940e7 Misc: Add DEBUG_GLX_MARK & Misc
- GLX backend: Add DEBUG_GLX_MARK, to add GL marks around functions with
  glStringMarkerGREMEDY(), and mark frame termination with
  glFrameTerminatorGREMEDY().

- Print output of `compton -h` to stdout. (#110)

- GLX backend: Strip out elements with factor 0 in GLSL blur code.
  Thanks to jrfonseca for guides. (#107)
2013-05-12 18:21:16 +08:00
Richard Grenville 90099d371d Bug fix: Compilation failure with NO_LIBCONFIG / NO_C2
- Fix compilation failure with NO_LIBCONFIG or NO_C2. Thanks to
  Spaulding for reporting.
2013-05-09 21:47:09 +08:00
Richard Grenville 48fb54dfae Misc: Add DEBUG_GLX_PAINTREG
- GLX: Add DEBUG_GLX_PAINTREG, for debugging painting region issues, for
  p4ddy's problem.
2013-05-09 09:43:40 +08:00
Richard Grenville 1c66237f99 Imp: Fix GL_TEXTURE_RECTANGLE & Enhance --glx-copy-from-front
- Fix GL_TEXTURE_RECTANGLE support. Thanks to amonakov for guides.
  (#107)

- Enhance --glx-copy-from-front to improve performance and make it work
  with --glx-swap-method, copied from kwin patch. Thanks to bwat47 for
  info. (#107)

- Add texture2Doffset() support in blur GLSL shader. Thanks to amonakov
  for advice. No visible benefit here, though. (#107)

- Only limited tests are done and I'm super sleepy. Bugs expected
2013-05-08 22:50:02 +08:00
Richard Grenville 7a4f5920d8 Misc: Validate wallpaper pixmap & Documentation update
- Split Pixmap validation out to validate_pixmap(). Validate wallpaper
  Pixmap as well.

- Update README.md and man page.
2013-05-01 22:08:43 +08:00
Richard Grenville a3f6f4442b Improvement: Add predefined blur kernels
- Add a few predefined blur kernels, requested by jerri in #104.

- Add compton-convgen.py to generate blur kernels.
2013-04-29 22:42:46 +08:00
Richard Grenville abd559c512 Bug fix: Fix a BadRegion error with --glx-use-copysubbuffermesa
Just a small and mostly harmless issue. Sorry, didn't test throughly.
2013-04-27 20:43:39 +08:00
Richard Grenville 3f00b3622c Bug fix: Fix --resize-damage
- Fix --resize-damage. I forgot to shrink the painting region back when
  actually copying to destination.

- Include extra pixels around the blur texture to avoid some possible
  small issues, if --resize-damage is positive.

- Known issue: Line artifacts may still appear with --dbe (X Render
  backend) or --glx-swap-method (GLX backend). I doubt if there's way to
  fix this without very inefficient mechanisms.
2013-04-27 17:44:10 +08:00
Richard Grenville 8113e4e3b4 Improvement: --resize-damage
- Add --resize-damage to enlarge/shrink repaint region by a specific
  number of pixels, used for solving the line corruption issue with
  blur. Thanks to Nuck and jerri in #104 for reporting.

- Fix the memory leak of blur shader string.
2013-04-27 11:43:11 +08:00
Richard Grenville c93d8830ff Misc: Fix gcc error
Fix gcc compilation error about "initializer element is not constant".
2013-04-26 16:14:37 +08:00
Richard Grenville 5d654e6877 Improvement: Enhance --glx-swap-method
- Enhance --glx-swap-method to support longer buffers ages (3-6), and
  automatic buffer age detection via GLX_EXT_buffer_age.
2013-04-26 14:01:20 +08:00
Richard Grenville 2e6fb0203d Improvement: --blur-kern
- Add blur convolution kernel customization, --blur-kern. The format is
  a bit tricky so be sure to read the description in `compton -h`. Not
  much tests received.

- GLX backend: Tolerate missing GLSL uniforms for strangely shaped
  convolution kernel.

- Fix a memory leak that blur-background blacklist is not freed.
2013-04-25 22:23:35 +08:00
Richard Grenville 4a4f857cc2 Misc: Fix wrong description & DEBUG_GLX_ERR
- Fix description of "opengl" VSync.

- Add DEBUG_GLX_ERR to check for OpenGL errors.

- Update man page.
2013-04-25 09:27:14 +08:00
Richard Grenville 85e7d18803 Improvement: --glx-swap-method & --fade-exclude
- GLX backend: Add --glx-swap-method, to reduce painting region if the
  driver uses exchange or copy buffer swaps. Untested.

- Add --fade-exclude, to disable fading on specific windows based on
  some conditions. Untested.

- Expose GLX backend options through configuration file. Add fetching of
  GLX backend options through D-Bus.

- Use NULL pointer instead of element count to delimit string arrays in
  parse_vsync()/parse_backend()/parse_glx_swap_method().

- Add documentation about "wintypes" section in configuration file.
2013-04-21 22:30:22 +08:00
Richard Grenville a053c0ac64 Bug fix: GLX: Fix dim and blur with --glx-no-stencil
- GLX backend: Fix broken dim and blur with --glx-no-stencil when
  dealing with shaped windows.

- GLX backend: Cache region contents and do a local region intersection
  instead of using XFixesIntersectRegion(). Drastic reduction in CPU
  usage for --glx-no-stencil. Now --glx-no-stencil substantially
  outperforms (~15%) normal mode.

- Use macros to reuse paint-in-region code in opengl.c . Add new type
  "reg_data_t" to store XserverRegion cache.
2013-04-06 20:21:38 +08:00
Richard Grenville e3a15d5f94 Improvement: GLX: Cache region contents & --glx-no-rebind-pixmap
- Cache region contents in is_region_empty(), mostly useful only for GLX
  backend to save one roundtrip to X.

- GLX backend: Add --glx-no-rebind-pixmap, which prevents rebinding of
  GLX texture to pixmap on content change. It doesn't work on some
  drivers, but it saves some CPU on those where it does.

- Wrap XFree() with a new function cxfree() since its man page claims
  NULL pointers are not acceptable (although in fact it does...).

- Use macro to save some code in get_cfg(). Code clean-up.
2013-04-05 21:05:19 +08:00
Richard Grenville 6ef23e066f Misc: Workaround for some missing definitions
- Add workarounds for missing GL_TEXTURE_RECTANGLE and PictOpDifference
  definitions in broken GL headers / old X Composite headers.
2013-04-03 10:53:04 +08:00
Richard Grenville dfd4dd1122 Feature #4: Default active window opacity
- Add default active window opacity (--active-opacity). (#4)

- Add win_focusin and win_focusout D-Bus signals.
2013-03-30 12:27:27 +08:00