Commit Graph

653 Commits

Author SHA1 Message Date
Uli Schlachter 6c6156932f Convert find_client_win() to XCB
This function was the only caller of wid_get_children() which called
XQueryTree().

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-10 10:50:00 +01:00
Uli Schlachter b2bfbcdfb0 Convert XGetAtomName to XCB
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-10 10:49:52 +01:00
Uli Schlachter ca148c8f15 Fix printf format with DEBUG_EVENTS
Xlib uses unsigned long for XIDs, but xcb always uses uint32_t. Thus,
this needs the format string for uint32_t now.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-10 10:46:39 +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
Uli Schlachter 2da0ecdf66 Convert XSelectInput() to XCB
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-10 10:42:12 +01:00
Uli Schlachter 1b1b3456bc Convert XGetSelectionOwner to XCB
This also fixes a memory leak: buf was not freed if another composite
manager was already running.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-10 10:41:40 +01:00
Uli Schlachter 2dc90e7d4d Convert XGetInputFocus to XCB
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-10 10:41:40 +01:00
Uli Schlachter 8db6473d32 Convert property management to XCB
I removed the error checking in compton.c because it was dead code.
XChangeProperty() always returns 1.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-10 10:41:40 +01:00
Uli Schlachter a192bfb130 Replace XSetSelectionOwner with XCB
Note that the argument order is different between Xlib and XCB.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-10 10:41:40 +01:00
Uli Schlachter 0cae42faaa Replace XDestroyWindow with xcb_destroy_window
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-10 10:41:40 +01:00
Uli Schlachter e30ff25dd3 Replace XClearArea with xcb_clear_area
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-10 10:41:40 +01:00
Uli Schlachter 28e9488e25 XCBify XCreateGC and XFreeGC
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-10 10:41:40 +01:00
Uli Schlachter b86190452c XCBify X{Ung,G}abServer
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-10 10:41:40 +01:00
Uli Schlachter 3c5d7555a4 XCBify X{Unm,M}apWindow
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-10-10 10:41:40 +01:00
Yuxuan Shui 6a8df0ada7 Fix a leak of XFIXES regions 2018-10-09 22:24:00 +01:00
Yuxuan Shui 9654d0bb64 More license stuff... 2018-10-04 11:18:09 +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 9e1422dc90 Fix parsing of shadow-exclude-reg
Closes #13

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-10-03 18:20:40 +01:00
Yuxuan Shui f1872c4033 Allocation for xinerama_scr_regs used wrong size
Should be sizeof(region_t). Rebasing is hard :(
2018-10-03 16:19:48 +01:00
Yuxuan Shui ff5a0cc0b7 Update README 2018-10-03 01:09:37 +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
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