@@ -124,7 +124,6 @@ static void registry_add_object(void *data, wl_registry *registry, uint32_t name
124124 WayfireStreamChooserApp::getInstance ().set_toplevel_list (list);
125125 ext_foreign_toplevel_list_v1_add_listener (list,
126126 &toplevel_list_v1_impl, NULL );
127- wl_display_flush (WayfireStreamChooserApp::getInstance ().display );
128127 } else if (strcmp (interface, ext_image_copy_capture_manager_v1_interface.name ) == 0 )
129128 {
130129 auto manager = (ext_image_copy_capture_manager_v1*)wl_registry_bind (registry, name,
@@ -282,31 +281,24 @@ void WayfireStreamChooserApp::activate()
282281 wl_display_roundtrip (display);
283282 wl_registry_destroy (registry);
284283
285- bool failed = false ;
286284 if (!has_image_copy_capture)
287285 {
288- failed = true ;
289286 std::cerr << " Compositor has not advertised ext-image-copy-capture-v1" << std::endl;
290287 }
291288
292289 if (!has_foreign_toplevel_list)
293290 {
294- failed = true ;
295291 std::cerr << " Compositor has not advertised ext-foreign-toplevel-list-v1" << std::endl;
296292 }
297293
298294 if (!has_image_capture_source)
299295 {
300- failed = true ;
301296 std::cerr << " Compositor has not advertised ext-image-capture-source-v1" << std::endl;
302297 }
303298
304- if (failed)
305- {
306- window_label.set_sensitive (false );
307- window_label.set_tooltip_text (" This compositor does not currently support sharing individual windows" );
308- notebook.set_current_page (1 );
309- }
299+ window_label.set_sensitive (false );
300+ window_label.set_tooltip_text (" This compositor does not currently support sharing individual windows" );
301+ notebook.set_current_page (1 );
310302
311303 /* Get output list */
312304 auto gtkdisplay = Gdk::Display::get_default ();
@@ -365,6 +357,7 @@ void WayfireStreamChooserApp::activate()
365357 window.present ();
366358}
367359
360+ static bool first_toplevel = true ;
368361void WayfireStreamChooserApp::add_toplevel (ext_foreign_toplevel_handle_v1 *handle)
369362{
370363 toplevels.emplace (handle, new WayfireChooserTopLevel (handle));
@@ -374,6 +367,14 @@ void WayfireStreamChooserApp::add_toplevel(ext_foreign_toplevel_handle_v1 *handl
374367 auto child = window_list.get_child_at_index (0 );
375368 window_list.select_child (*child);
376369 }
370+
371+ window_label.set_sensitive (true );
372+ window_label.set_tooltip_text (" " );
373+ if (first_toplevel)
374+ {
375+ first_toplevel = false ;
376+ notebook.set_current_page (0 );
377+ }
377378}
378379
379380void WayfireStreamChooserApp::remove_toplevel (WayfireChooserTopLevel *toplevel)
@@ -385,6 +386,11 @@ void WayfireStreamChooserApp::remove_toplevel(WayfireChooserTopLevel *toplevel)
385386
386387 window_list.remove (*toplevel);
387388 toplevels.erase (toplevel->handle );
389+ if (toplevels.empty ())
390+ {
391+ window_label.set_sensitive (false );
392+ window_label.set_tooltip_text (" No windows open" );
393+ }
388394}
389395
390396void WayfireStreamChooserApp::add_output (std::shared_ptr<Gdk::Monitor> monitor)
0 commit comments