xwayland: refactor class member vars (#10312)

* xwayland: refactor class member vars

* xwayland: fix pure wayland build
This commit is contained in:
davc0n 2025-05-07 15:21:44 +02:00 committed by GitHub
parent f8bbe5124c
commit e5df8cdc62
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 657 additions and 670 deletions

View file

@ -63,45 +63,45 @@ struct SXSelection {
class CXCBConnection {
public:
CXCBConnection(int fd) : connection{xcb_connect_to_fd(fd, nullptr)} {
CXCBConnection(int fd) : m_connection{xcb_connect_to_fd(fd, nullptr)} {
;
}
~CXCBConnection() {
if (connection)
xcb_disconnect(connection);
if (m_connection)
xcb_disconnect(m_connection);
}
bool hasError() const {
return xcb_connection_has_error(connection);
return xcb_connection_has_error(m_connection);
}
operator xcb_connection_t*() const {
return connection;
return m_connection;
}
private:
xcb_connection_t* connection = nullptr;
xcb_connection_t* m_connection = nullptr;
};
class CXCBErrorContext {
public:
explicit CXCBErrorContext(xcb_connection_t* connection) {
if (xcb_errors_context_new(connection, &errors) != 0)
errors = nullptr;
if (xcb_errors_context_new(connection, &m_errors) != 0)
m_errors = nullptr;
}
~CXCBErrorContext() {
if (errors)
xcb_errors_context_free(errors);
if (m_errors)
xcb_errors_context_free(m_errors);
}
bool isValid() const {
return errors != nullptr;
return m_errors != nullptr;
}
private:
xcb_errors_context_t* errors = nullptr;
xcb_errors_context_t* m_errors = nullptr;
};
class CXWM {
@ -174,42 +174,42 @@ class CXWM {
SXSelection* getSelection(xcb_atom_t atom);
//
CXCBConnection connection;
xcb_errors_context_t* errors = nullptr;
xcb_screen_t* screen = nullptr;
CXCBConnection m_connection;
xcb_errors_context_t* m_errors = nullptr;
xcb_screen_t* m_screen = nullptr;
xcb_window_t wmWindow;
xcb_window_t m_wmWindow;
wl_event_source* eventSource = nullptr;
wl_event_source* m_eventSource = nullptr;
const xcb_query_extension_reply_t* xfixes = nullptr;
const xcb_query_extension_reply_t* xres = nullptr;
int xfixesMajor = 0;
const xcb_query_extension_reply_t* m_xfixes = nullptr;
const xcb_query_extension_reply_t* m_xres = nullptr;
int m_xfixesMajor = 0;
xcb_visualid_t visual_id;
xcb_colormap_t colormap;
uint32_t cursorXID = 0;
xcb_visualid_t m_visualID;
xcb_colormap_t m_colormap;
uint32_t m_cursorXID = 0;
xcb_render_pictformat_t render_format_id;
xcb_render_pictformat_t m_renderFormatID;
std::vector<WP<CXWaylandSurfaceResource>> shellResources;
std::vector<SP<CXWaylandSurface>> surfaces;
std::vector<WP<CXWaylandSurface>> mappedSurfaces; // ordered by map time
std::vector<WP<CXWaylandSurface>> mappedSurfacesStacking; // ordered by stacking
std::vector<WP<CXWaylandSurfaceResource>> m_shellResources;
std::vector<SP<CXWaylandSurface>> m_surfaces;
std::vector<WP<CXWaylandSurface>> m_mappedSurfaces; // ordered by map time
std::vector<WP<CXWaylandSurface>> m_mappedSurfacesStacking; // ordered by stacking
WP<CXWaylandSurface> focusedSurface;
uint64_t lastFocusSeq = 0;
WP<CXWaylandSurface> m_focusedSurface;
uint64_t m_lastFocusSeq = 0;
SXSelection clipboard;
SXSelection primarySelection;
SXSelection dndSelection;
SP<CX11DataDevice> dndDataDevice = makeShared<CX11DataDevice>();
std::vector<SP<CX11DataOffer>> dndDataOffers;
SXSelection m_clipboard;
SXSelection m_primarySelection;
SXSelection m_dndSelection;
SP<CX11DataDevice> m_dndDataDevice = makeShared<CX11DataDevice>();
std::vector<SP<CX11DataOffer>> m_dndDataOffers;
struct {
CHyprSignalListener newWLSurface;
CHyprSignalListener newXShellSurface;
} listeners;
} m_listeners;
friend class CXWaylandSurface;
friend class CXWayland;