Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/panel/widgets/window-list/toplevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
86 changes: 5 additions & 81 deletions src/panel/widgets/window-list/window-list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<WayfireWindowListOutput>();
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)
{
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -229,23 +170,6 @@ static struct wl_registry_listener registry_listener =
&registry_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;
Expand Down Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -329,7 +255,7 @@ void WayfireWindowList::init(Gtk::Box *container)
wl_registry_add_listener(registry, &registry_listener, this);
wl_display_roundtrip(display);

this->registry = registry;
wl_registry_destroy(registry);

if (!this->manager)
{
Expand Down Expand Up @@ -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);
Expand All @@ -513,5 +438,4 @@ WayfireWindowList::~WayfireWindowList()
}

#endif
wl_registry_destroy(this->registry);
}
10 changes: 0 additions & 10 deletions src/panel/widgets/window-list/window-list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@
#include <gbm.h>
#endif // HAVE_DMABUF

class WayfireWindowListOutput
{
public:
wl_output *output;
std::string name;
};

class WayfireToplevel;

class WayfireWindowList : public Gtk::Box, public WayfireWidget, public IIPCSubscriber
Expand All @@ -30,7 +23,6 @@ class WayfireWindowList : public Gtk::Box, public WayfireWidget, public IIPCSubs
std::unique_ptr<WayfireToplevel>> 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;
Expand Down Expand Up @@ -82,8 +74,6 @@ class WayfireWindowList : public Gtk::Box, public WayfireWidget, public IIPCSubs

WfOption<bool> 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<WayfireWindowListOutput> window_list_live_preview_output = nullptr;
void on_event(wf::json_t data) override;
std::shared_ptr<IPCClient> ipc_client;
bool live_window_preview_tooltips = false;
Expand Down