berylline / compiz

My forked code of Compiz 0.8.8
Other
2 stars 0 forks source link

Refactor X11-specific code into a separate backend #4

Open berylline opened 3 years ago

berylline commented 3 years ago

This would involve refactoring and splitting out much of what's in display.c, screen.c, window.c(and possibly other areas as well) into a separate backend. Although the code seems to have some signposts, I'm not entirely sure how all of it can be done at this point in time, AFAIK. I need to look at the code more to find out how to go about this.

This would also allow the possibility of a Wayland backend(and therefore, Wayland support) to be made for Compiz.

berylline commented 3 years ago

I think #7 would also factor into this in a way since that would swap GLX in for EGL and, as a result of that, would do away with one set of X11-specific code and dependencies.

berylline commented 3 years ago

For a start:

A function like backend_open_display can call XOpenDisplay for XLib or xcb_connect for XCB when factoring out the X11-specific code and turning it into a backend. And then for the Wayland backend, backend_open_display can call wl_display_create.

And then backend_close_display can call XCloseDisplay(XLib) or xcb_disconnect(XCB) for the X11 backend and it can call wl_display_destroy for the Wayland backend.

I was thinking that a backend_display variable would be a good idea for something that I want for the backend-agnostic glue/middle-person code, but I'm not sure if I want to do that or if I would like doing that at all.

Or for an alternative to all of the above:

Incorporate XOpenDisplay or xcb_connect for the X11 backend and wl_display_create for the Wayland backend into a backend_create/backend_init function.

Incorporate XCloseDisplay or xcb_disconnect for the X11 backend and wl_display_destroy for the Wayland backend into a backend_destroy/backend_finish function.

I'm not sure which approach would be better yet, but I think that over time, I'll get to see which approach would be the best for what I want going forward.

And I'm not sure if I want display, screen and window backends or if I would have to refactor some of the code and structs in Compiz along the way to fit what I want for the backend-agnostic glue/middle-person code, but I think that in due time, I'll get to see what I have to do and what I'll ending up doing with the code, the structs and the underlying architecture that makes up Compiz, I think.

berylline commented 7 months ago

See #8.