Make protocols modular #51
Replies: 4 comments 9 replies
-
https://github.com/CuarzoSoftware/Louvre/blob/2.0.0/src/examples/louvre-views/src/Compositor.cpp The biggest offender is having to implement a copy of each compositor elements, in this example, the need for a custom Example of code I have in mind: Compositor::Compositor() {
register_event(SessionLockManager_stateChanged_event, &onLockStateChanged)
}
extern "C" void onLockStateChanged(LSessionLockManager sessionLockManager) {
const bool locked { state() != Unlocked };
} The It's only one idea in a sea off possible solutions to start fixing/solving this problem, I'm sure there would be better ideas out there. |
Beta Was this translation helpful? Give feedback.
-
Hello, I've been very busy lately, so I haven't had much time to work on Louvre, which is why progress has been slow. Regarding what you mentioned, @Paraworker, the I could group all virtual constructors into a single one and provide an ID of the type of object being requested as an argument, but I think that would be more prone to errors. The protocols used by the compositor can be modified in LCompositor::createGlobalsRequest(). Therefore, if you wish to omit any, you can do so there, or if you wish to implement one that Louvre does not implement. This way, the API to handle them in the classes will still exist, but it simply wouldn't serve any purpose as clients wouldn't be able to use those protocols. Now, this relates to what @Fox2Code said. The reason I don't use the observer pattern and instead use virtual methods (for the user API) is because it forces the developer to have everything grouped/organized by classes and prevents spaghetti code. This, also allows anyone familiar with Louvre to immediately understand the structure of a project. I know it's tedious, but it only needs to be done once per class. For version 2.0.0, I'm trying to solve several problems of this nature, so I appreciate your feedback. Does what I'm saying make sense to you? |
Beta Was this translation helpful? Give feedback.
-
One more thing I forgot to mention is that when a global is deactivated, the API remains unchanged, the compositor will continue to function without crashing. Clients are free to not bind to a global if they wish anyway, so that isn't an issue. The only effect would be that clients wouldn't have access to that functionality. The only global that Louvre implements internally and cannot be deactivated is |
Beta Was this translation helpful? Give feedback.
-
"modules/extensions" looks something similar to what I mentioned. My idea is for For example, in the future, if Louvre needs to support wlr_layer_shell, we would add an
In this way, users don't need to care about |
Beta Was this translation helpful? Give feedback.
-
Currently Louvre supports new protocols by adding interfaces to the LCompositor class, which not only makes the class very large, but also forces users to use all protocols.
The basic idea is that you can design separate classes for each protocol and ‘register’ them in some way, a bit like what smithay did, but with adjustments based on Louvre and C++.
Beta Was this translation helpful? Give feedback.
All reactions