Commit Graph

14 Commits

Author SHA1 Message Date
Yuxuan Shui 16ea51bbc1
common.h: more clean up
Remove more unused stuff.

Also removed session::xinerama_scrs, since all the information we need
is covered by xinerama_scr_regs. Convert uses of xinerama_scrs to use
xinerama_scr_regs.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:34 +01:00
Yuxuan Shui c6a4928a45
atom: cache result of get_atom
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:33 +01:00
Yuxuan Shui a40fdb86e1
core: unmap overlay window when we first acquire it
It used to be unmap when we receive its MapNotify, but now since we discard
events received before we grab X server, that event it lost. But it
turns out we can just unmap it when it's first created, no need to wait
for the MapNotify.

Partially fix #160

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:32 +01:00
Yuxuan Shui ad8211e341
event: handle reparent to the same parent
When a window is reparented to the same parent again, we should just
move it to the top of the stack, instead of add it again.

Also a slight refactor restack_win.

Fixes #164

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:32 +01:00
Yuxuan Shui 3d2217a112
event: promote several logs to log level debug 2019-05-21 20:15:30 +01:00
Yuxuan Shui 58944f36ce
Delay window managing
Create a "critical section" in draw_callback by grabbing the X server.
Delay the managing of newly created windows until we enter the cricial section.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:30 +01:00
Yuxuan Shui 927cdd8652
win: handle destruction of unmanaged window
Previous destructions of unmanaged window are silently ignored, causing
windows with duplicated IDs.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:30 +01:00
Yuxuan Shui bd4c242015
win: split struct win
Currently compton handles window creation event by immediately query all
the information it needs and create a window struct with that
information. However, this is prone to race conditions.

In the future, we want to react to window creation event by creating a
placeholder in the window stack, and only query window information in a
critical section where the X server is grabbed by us.

This commit split struct win into two struct, one as placeholder, the
other for holding actual window information.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:29 +01:00
Yuxuan Shui abeeb36bb2
x: wrap xcb_generate_id to check for errors
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:28 +01:00
Yuxuan Shui 0037b7e5fb
Eliminate implicit conversions
Use explicit conversions everywhere. Adding bounds check assertions when
necessary.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-05-21 20:15:25 +01:00
Yuxuan Shui e8f2298159
event: lazify screen update
Set root screen change flag in event handler, and update in
draw_callback.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-23 14:35:23 +00:00
Yuxuan Shui e414fee91f
event: use log levels, not ifdefs
And some general clean up.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-23 14:35:23 +00:00
Yuxuan Shui 17c96eb9ba
core: general clean up
Also move some remaing event functions to event.c

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-23 14:35:22 +00:00
Yuxuan Shui 472185e885
core: split out event code
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
2019-03-23 14:35:22 +00:00