Commit Graph

101 Commits

Author SHA1 Message Date
Yuxuan Shui 0686300013 Move some common functions to utils.h
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-25 23:32:10 +01:00
Yuxuan Shui e13bc7fc51 Move common types to types.h
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-25 23:32:10 +01:00
Yuxuan Shui 4094d8b9c4 Add initial meson build scripts 2018-10-15 00:38:21 +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 bbb73fe64e Fix integer overflow
`x + wid` will convert x to unsigned first, if x < 0, integer overflow
could occur.
2018-10-12 23:17:12 +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 7e71f46401 Convert XInternAtom to XCB
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-10 10:46:34 +01:00
Yuxuan Shui 7b755a3cf0 Fix typo in CONTRIBUTORS, move licenses around
Having a LICENSE file makes github happy
2018-10-03 22:24:12 +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
Yuxuan Shui 2a4fed50f4 Use libev for inputs and timeouts
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>
2018-10-03 01:05:32 +01:00
Uli Schlachter 385ba2cdf6 Remove unused definition
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-02 19:56:47 +02:00
Uli Schlachter cad786c025 Remove include of X11/Xutil.h
It doesn't seem to cause any problems. Perhaps its uses were already
converted to XCB?

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-02 19:54:20 +02: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
Uli Schlachter b2d947a19a Remove include of Xfixes.h
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-02 19:51:37 +02:00
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 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 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
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 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 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 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
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 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 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 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 bfead72d37 Honor opacity explicitly set by rules 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 27fc4a2af4 Clear compiler warnings
Thanks to chjj/compton#445
2018-05-17 12:50:22 +01: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 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
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 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 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
Richard Grenville 4f9050f53f Misc: Fix spelling mistakes
Still, "Guassian" -> "Gaussian". (#221)
2014-08-06 07:32:53 +08:00