class waylandDisplay { public: static waylandDisplay & getInstance(); bool…
- User
class waylandDisplay {
public:
codestatic waylandDisplay & getInstance(); bool displayInit_Wayland(); void registry_global_remove_handler(void * data, struct wl_registry * registry, uint32_t name); void registry_global_handler(void * data, struct wl_registry * registry, uint32_t name, const char * interface, uint32_t version); // Getter functions for EGL values EGLDisplay getEGLDisplay() const { return egldisplay; } EGLSurface getEGLSurface() const { return eglsurface; } EGLContext getEGLContext() const { return eglcontext; }private:
codewaylandDisplay(); waylandDisplay(const waylandDisplay &) = delete; waylandDisplay & operator=(const waylandDisplay &) = delete; EGLDisplay egldisplay; EGLConfig config; EGLSurface eglsurface; EGLContext eglcontext; struct wl_compositor * compositor; struct wl_subcompositor * subcompositor; struct wl_shm * shm; struct wl_shell * shell; struct wl_surface * parent_surface; struct wl_surface * child_surface; struct wl_display * display; EGLNativeDisplayType eglNativeDisplayType; EGLNativeWindowType native_window; EGLint numConfigs; EGLint majorVersion; EGLint minorVersion; EGLBoolean eRetStatus; EGLint contextAttribs[3]; EGLint attribList[13]; - Assistant
One way to share the
wl_surfacepointers from thewaylandDisplaysingleton class to other classes is by providing getter functions for these pointers in thewaylandDisplayclass. Here is a possible implementation:cppclass waylandDisplay { public: // other member functions and variables... // Getter functions for wl_surface pointers wl_surface* getParentSurface() const { return parent_surface; } wl_surface* getChildSurface() const { return child_surface; } private: // other member variables... };You can then use these getter functions in other classes where you need access to the
wl_surfacepointers:cpp - User
how we get this values
- Assistant
To access the
wl_surfacepointers from thewaylandDisplaysingleton class, you first need to get an instance of thewaylandDisplayclass using thegetInstance()static member function. Once you have the instance, you can call the getter functions to retrieve thewl_surfacepointers.Here's an example of how you can get the
wl_surfacepointers:cpp// Get the instance of waylandDisplay waylandDisplay& display = waylandDisplay::getInstance(); // Get parent surface pointer wl_surface* parentSurface = display.getParentSurface(); // Get child surface pointer wl_surface* childSurface = display.getChildSurface(); if (parentSurface != nullptr) { // Do something with parentSurface } if (childSurface != nullptr) { // Do something with childSurface }