Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-11-10 03:12:52 +0300
committerCampbell Barton <campbell@blender.org>2022-11-10 03:12:52 +0300
commit7e4e8cca7dd864b1a1d23ada6dd27c27de5535ac (patch)
tree628562156d1918fa9c069676240a48e28d67d8a6
parent79dae1a43f10590be913d42a9c6c2e3e66ca6302 (diff)
GHOST/Wayland: add wl_display_listener for debugging
Currently only used for logging to help with debugging.
-rw-r--r--intern/ghost/intern/GHOST_SystemWayland.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp
index a2028de6f53..42da4a3ebbf 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -4985,6 +4985,42 @@ static const struct wl_registry_listener registry_listener = {
/** \} */
/* -------------------------------------------------------------------- */
+/** \name Listener (Display), #wl_display_listener
+ * \{ */
+
+static CLG_LogRef LOG_WL_DISPLAY = {"ghost.wl.handle.display"};
+#define LOG (&LOG_WL_DISPLAY)
+
+static void display_handle_error(
+ void *data, struct wl_display *wl_display, void *object_id, uint32_t code, const char *message)
+{
+ GWL_Display *display = static_cast<GWL_Display *>(data);
+ GHOST_ASSERT(display->wl_display == wl_display, "Invalid internal state");
+ (void)display;
+
+ /* NOTE: code is #wl_display_error, there isn't a convenient way to convert to an ID. */
+ CLOG_INFO(LOG, 2, "error (code=%u, object_id=%p, message=%s)", code, object_id, message);
+}
+
+static void display_handle_delete_id(void *data, struct wl_display *wl_display, uint32_t id)
+{
+ GWL_Display *display = static_cast<GWL_Display *>(data);
+ GHOST_ASSERT(display->wl_display == wl_display, "Invalid internal state");
+ (void)display;
+
+ CLOG_INFO(LOG, 2, "delete_id (id=%u)", id);
+}
+
+static const struct wl_display_listener display_listener = {
+ display_handle_error,
+ display_handle_delete_id,
+};
+
+#undef LOG
+
+/** \} */
+
+/* -------------------------------------------------------------------- */
/** \name GHOST Implementation
*
* WAYLAND specific implementation of the #GHOST_System interface.
@@ -5006,6 +5042,8 @@ GHOST_SystemWayland::GHOST_SystemWayland(bool background)
/* This may be removed later if decorations are required, needed as part of registration. */
display_->xdg_decor = new GWL_XDG_Decor_System;
+ wl_display_add_listener(display_->wl_display, &display_listener, display_);
+
/* Register interfaces. */
{
display_->registry_skip_update_all = true;