glGetIntegerv(GL_NUM_EXTENSIONS) is only available since GL4.
(However glGetStringi(GL_EXTENSIONS) is available since GL3)
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
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>
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>
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>
Window flags can be set whichever backend we use, we will ignore then in
paint_preprocess. free_paint can be called whichever backend we use,
they just do nothing if we use experimental backends.
Others should rather just check if backend_data is NULL.
Making the code slightly more understandable, also making the eventual
removal of these checks easier.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Damage could have already happened at the time we call fill_win on a new
window. It's too difficult, or impossible, for us the find out if that
happened. So just blindly mark window as damaged.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
Make sure X grab server is finished before calling x_discard_events in
session_init. Otherwise x_discard_events won't be able to discard all of
the events that were sent before we grab the server.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
A window might be mapped before we had the chance to start managing it.
So check to see if we should map a window after we call fill_win on it.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
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>
Also, during session_init, discard old events after we grab the server.
If we don't do that, old, out dated CreateNotify will cause us to add
the window with the same id multiple times. Here is an explanation of
how that could happen:
1. compton connects to X
2. a new window created by someone else, X send us a CreateNotify
3. compton is initializing, so it didn't handle the event.
4. compton pulls a list of all windows from X. This will include that
window created in (2)
5. compton starts to handle event. it will handle the CreateNotify sent
in (2), thus adds the same window twice.
Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>