Commit Graph

1082 Commits

Author SHA1 Message Date
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
yshui e58de49d7a
Merge pull request #10 from psychon/remove-xfixes
Some more trivial Xlib -> XCB conversions
2018-10-02 21:38:28 +01:00
Yuxuan Shui d917ec22a8 Fix a typo in conversion to xcb damage 2018-10-02 21:25:09 +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
Uli Schlachter 91468c3622 Replace BadRegion with XCB_XFIXES_BAD_REGION
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-02 19:51:30 +02:00
Uli Schlachter 7c174cc3b1 Replace XserverRegion with xcb_xfixes_region_t
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-02 19:50:27 +02:00
Yuxuan Shui cb99618eb6 More sanitiziers
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-01 14:54:11 +01:00
Yuxuan Shui 8be2cbf1a5 Update README
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-01 14:30:55 +01:00
Yuxuan Shui 024eea29ec Remove unused cmake files
We might switch to a proper configure system later.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-09-30 21:35:17 +01: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 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
yshui 290cdd2b85
Merge pull request #7 from psychon/more-xcb-conv
More conversion to XCB
2018-09-30 13:47:56 +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
Yuxuan Shui 70fb58bfbd Merge branch 'xfixes' into next
Partially merge #6.

Close #6
2018-09-29 17:08:39 +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
Yuxuan Shui dbb5a6be83 Fix include path in dep generation 2018-09-28 11:33:37 +01:00
yshui 5efa21e22a
Merge pull request #3 from psychon/xcb_conv
Some conversion to XCB
2018-09-28 11:26:00 +01: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