Skip to content

Commit 74a8256

Browse files
soreautrigg
authored andcommitted
window-list: Require ext-toplevel and wf-copy-capture plugins to enable live preview tooltips
1 parent 7627d5f commit 74a8256

3 files changed

Lines changed: 25 additions & 9 deletions

File tree

src/panel/widgets/window-list/toplevel.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,8 @@ class WayfireToplevel::impl
516516

517517
void set_tooltip_media()
518518
{
519-
if (this->tooltip_media || !this->ext_handle || !(bool)window_list->live_window_previews)
519+
if (this->tooltip_media || !this->window_list->toplevel_capture_manager ||
520+
!(bool)window_list->live_window_previews || !this->ext_handle)
520521
{
521522
return;
522523
}
@@ -714,8 +715,8 @@ class WayfireToplevel::impl
714715
return false;
715716
}
716717

717-
if (this->window_list->list_toplevels.empty() || !this->ext_handle ||
718-
!(bool)window_list->live_window_previews)
718+
if (this->window_list->list_toplevels.empty() || !this->window_list->toplevel_capture_manager ||
719+
!(bool)window_list->live_window_previews || !this->ext_handle)
719720
{
720721
tooltip->set_text(title);
721722
}

src/panel/widgets/window-list/window-list.cpp

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,20 +314,32 @@ void WayfireWindowList::init(Gtk::Box *container)
314314

315315
this->display = display;
316316

317-
wl_registry *registry = wl_display_get_registry(display);
317+
registry = wl_display_get_registry(display);
318318
wl_registry_add_listener(registry, &registry_listener, this);
319319
wl_display_roundtrip(display);
320320

321-
wl_registry_destroy(registry);
322-
323-
if (!this->copy_capture_manager)
321+
if (!this->manager)
324322
{
325323
std::cerr << "Compositor doesn't support" <<
326-
" ext-image-copy-capture." <<
324+
" ext-image-copy-capture-v1." <<
327325
"The window-list widget will not be initialized." << std::endl;
328326
return;
329327
}
330328

329+
if (!this->foreign_toplevel_list)
330+
{
331+
std::cerr << "Compositor doesn't support" <<
332+
" ext-foreign-toplevel-list-v1." <<
333+
"Live window previews cannot be enabled." << std::endl;
334+
}
335+
336+
if (!this->toplevel_capture_manager)
337+
{
338+
std::cerr << "Compositor doesn't support" <<
339+
" ext-foreign-toplevel-image-copy-capture-v1." <<
340+
"Live window previews cannot be enabled." << std::endl;
341+
}
342+
331343
scrolled_window.add_css_class("window-list");
332344

333345
scrolled_window.set_hexpand(true);
@@ -478,6 +490,8 @@ WayfireWindowList::~WayfireWindowList()
478490

479491
list_toplevels.clear();
480492

493+
wl_registry_destroy(registry);
494+
481495
if (this->manager)
482496
{
483497
zwlr_foreign_toplevel_manager_v1_destroy(this->manager);

src/panel/widgets/window-list/window-list.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ class WayfireToplevel;
2121

2222
class WayfireWindowList : public Gtk::Box, public WayfireWidget
2323
{
24+
wl_display *display;
25+
wl_registry *registry;
2426
WfOption<int> user_size{"panel/window_list_size"};
2527
std::shared_ptr<WayfireWindowListLayout> layout;
2628

@@ -30,7 +32,6 @@ class WayfireWindowList : public Gtk::Box, public WayfireWidget
3032
std::map<ext_foreign_toplevel_handle_v1*,
3133
std::unique_ptr<WayfireListToplevel>> list_toplevels;
3234

33-
wl_display *display;
3435
zwlr_foreign_toplevel_manager_v1 *manager = NULL;
3536
ext_foreign_toplevel_list_v1 *foreign_toplevel_list = NULL;
3637
ext_image_copy_capture_manager_v1 *copy_capture_manager = NULL;

0 commit comments

Comments
 (0)