diff --git a/src/panel/widgets/window-list/toplevel.cpp b/src/panel/widgets/window-list/toplevel.cpp index 1fb1eebe..cc9c8ab9 100644 --- a/src/panel/widgets/window-list/toplevel.cpp +++ b/src/panel/widgets/window-list/toplevel.cpp @@ -322,17 +322,16 @@ bool TooltipMedia::request_next_frame() if (this->frame) { zwlr_screencopy_frame_v1_destroy(this->frame); - this->frame = NULL; + this->frame = nullptr; } - if (!this->window_list->window_list_live_preview_output || - !this->window_list->window_list_live_preview_output->output) + if (!WayfireShellApp::get().live_preview_output) { return false; } this->frame = zwlr_screencopy_manager_v1_capture_output(this->window_list->screencopy_manager, 0, - this->window_list->window_list_live_preview_output->output); + WayfireShellApp::get().live_preview_output); zwlr_screencopy_frame_v1_add_listener(this->frame, &screencopy_frame_listener, this); return true; diff --git a/src/panel/widgets/window-list/window-list.cpp b/src/panel/widgets/window-list/window-list.cpp index 93be8c59..3fa0b958 100644 --- a/src/panel/widgets/window-list/window-list.cpp +++ b/src/panel/widgets/window-list/window-list.cpp @@ -28,61 +28,6 @@ zwlr_foreign_toplevel_manager_v1_listener toplevel_manager_v1_impl = { .finished = handle_manager_finished, }; -void handle_output_geometry(void*, - struct wl_output*, - int32_t, - int32_t, - int32_t, - int32_t, - int32_t, - const char*, - const char*, - int32_t) -{} - -void handle_output_mode(void*, - struct wl_output*, - uint32_t, - int32_t, - int32_t, - int32_t) -{} - -void handle_output_done(void *data, struct wl_output*) -{} - -void handle_output_scale(void*, struct wl_output*, int32_t) -{} - -void handle_output_name(void *data, - struct wl_output *output, - const char *name) -{ - std::string live_preview_output_name = WayfireShellApp::get().live_preview_output_name; - WayfireWindowList *window_list = (WayfireWindowList*)data; - std::string output_name = name; - - if (output_name == live_preview_output_name) - { - window_list->window_list_live_preview_output = std::make_unique(); - window_list->window_list_live_preview_output->output = output; - window_list->window_list_live_preview_output->name = output_name; - } -} - -void handle_output_description(void*, struct wl_output*, const char*) -{} - -static struct wl_output_listener output_listener = -{ - handle_output_geometry, - handle_output_mode, - handle_output_done, - handle_output_scale, - handle_output_name, - handle_output_description, -}; - #ifdef HAVE_DMABUF static void dmabuf_feedback_done(void *data, struct zwp_linux_dmabuf_feedback_v1 *feedback) { @@ -181,11 +126,7 @@ static void registry_add_object(void *data, wl_registry *registry, uint32_t name { WayfireWindowList *window_list = (WayfireWindowList*)data; - if (strcmp(interface, wl_output_interface.name) == 0) - { - wl_output *output = (wl_output*)wl_registry_bind(registry, name, &wl_output_interface, version); - window_list->handle_new_wl_output(output); - } else if (strcmp(interface, wl_shm_interface.name) == 0) + if (strcmp(interface, wl_shm_interface.name) == 0) { window_list->shm = (wl_shm*)wl_registry_bind(registry, name, &wl_shm_interface, version); } else if (strcmp(interface, zwlr_foreign_toplevel_manager_v1_interface.name) == 0) @@ -229,23 +170,6 @@ static struct wl_registry_listener registry_listener = ®istry_remove_object }; -void WayfireWindowList::destroy_window_list_live_preview_output() -{ - if (this->window_list_live_preview_output) - { - wl_output_destroy(this->window_list_live_preview_output->output); - this->window_list_live_preview_output.reset(); - this->window_list_live_preview_output = nullptr; - } -} - -void WayfireWindowList::handle_new_wl_output(wl_output *output) -{ - std::string live_preview_output_name = WayfireShellApp::get().live_preview_output_name; - - wl_output_add_listener(output, &output_listener, this); -} - void WayfireWindowList::live_window_previews_plugin_check() { wf::json_t ipc_methods_request; @@ -277,7 +201,9 @@ void WayfireWindowList::live_window_previews_plugin_check() } else { std::cout << "Enabling live window preview tooltips using " << - std::string(live_previews_dmabuf ? "dmabuf" : "shm") << " transfers." << std::endl; + std::string(live_previews_dmabuf ? "dmabuf" : "shm") << + " transfers on output " << this->output->monitor->get_connector() << + std::endl; this->enable_normal_tooltips_flag(false); } } @@ -329,7 +255,7 @@ void WayfireWindowList::init(Gtk::Box *container) wl_registry_add_listener(registry, ®istry_listener, this); wl_display_roundtrip(display); - this->registry = registry; + wl_registry_destroy(registry); if (!this->manager) { @@ -492,7 +418,6 @@ WayfireWindowList::~WayfireWindowList() * when the window-list widget is unloaded. */ toplevels.clear(); - destroy_window_list_live_preview_output(); wl_shm_destroy(this->shm); zwlr_foreign_toplevel_manager_v1_destroy(this->manager); zwlr_screencopy_manager_v1_destroy(this->screencopy_manager); @@ -513,5 +438,4 @@ WayfireWindowList::~WayfireWindowList() } #endif - wl_registry_destroy(this->registry); } diff --git a/src/panel/widgets/window-list/window-list.hpp b/src/panel/widgets/window-list/window-list.hpp index bb3f14eb..5958bc34 100644 --- a/src/panel/widgets/window-list/window-list.hpp +++ b/src/panel/widgets/window-list/window-list.hpp @@ -11,13 +11,6 @@ #include #endif // HAVE_DMABUF -class WayfireWindowListOutput -{ - public: - wl_output *output; - std::string name; -}; - class WayfireToplevel; class WayfireWindowList : public Gtk::Box, public WayfireWidget, public IIPCSubscriber @@ -30,7 +23,6 @@ class WayfireWindowList : public Gtk::Box, public WayfireWidget, public IIPCSubs std::unique_ptr> toplevels; wl_display *display; - wl_registry *registry; wl_shm *shm = nullptr; zwlr_foreign_toplevel_manager_v1 *manager = nullptr; zwlr_screencopy_manager_v1 *screencopy_manager = nullptr; @@ -82,8 +74,6 @@ class WayfireWindowList : public Gtk::Box, public WayfireWidget, public IIPCSubs WfOption live_window_previews_opt{"panel/live_window_previews"}; void handle_new_wl_output(wl_output *output); - void destroy_window_list_live_preview_output(); - std::unique_ptr window_list_live_preview_output = nullptr; void on_event(wf::json_t data) override; std::shared_ptr ipc_client; bool live_window_preview_tooltips = false;