@@ -120,22 +120,19 @@ static void registry_add_object(void *data, wl_registry *registry, uint32_t name
120120 wl_registry_bind (registry, name,
121121 &ext_foreign_toplevel_list_v1_interface,
122122 version);
123- WayfireStreamChooserApp::getInstance ().has_foreign_toplevel_list = true ;
124123 WayfireStreamChooserApp::getInstance ().set_toplevel_list (list);
125124 ext_foreign_toplevel_list_v1_add_listener (list,
126125 &toplevel_list_v1_impl, NULL );
127126 } else if (strcmp (interface, ext_image_copy_capture_manager_v1_interface.name ) == 0 )
128127 {
129128 auto manager = (ext_image_copy_capture_manager_v1*)wl_registry_bind (registry, name,
130129 &ext_image_copy_capture_manager_v1_interface, version);
131- WayfireStreamChooserApp::getInstance ().has_image_copy_capture = true ;
132130 WayfireStreamChooserApp::getInstance ().set_copy_capture_manager (manager);
133131 } else if (strcmp (interface, ext_foreign_toplevel_image_capture_source_manager_v1_interface.name ) == 0 )
134132 {
135133 auto toplevel_capture_manager =
136134 (ext_foreign_toplevel_image_capture_source_manager_v1*)wl_registry_bind (registry, name,
137135 &ext_foreign_toplevel_image_capture_source_manager_v1_interface, version);
138- WayfireStreamChooserApp::getInstance ().has_image_capture_source = true ;
139136 WayfireStreamChooserApp::getInstance ().set_toplevel_capture_manager (toplevel_capture_manager);
140137 } else if (strcmp (interface, ext_output_image_capture_source_manager_v1_interface.name ) == 0 )
141138 {
@@ -281,24 +278,45 @@ void WayfireStreamChooserApp::activate()
281278 wl_display_roundtrip (display);
282279 wl_registry_destroy (registry);
283280
284- if (!has_image_copy_capture)
281+ bool toplevel_capture = true ;
282+ bool output_capture = true ;
283+ if (!this ->manager )
285284 {
286285 std::cerr << " Compositor has not advertised ext-image-copy-capture-v1" << std::endl;
286+ toplevel_capture = false ;
287287 }
288288
289- if (!has_foreign_toplevel_list )
289+ if (!this -> list )
290290 {
291291 std::cerr << " Compositor has not advertised ext-foreign-toplevel-list-v1" << std::endl;
292+ toplevel_capture = false ;
292293 }
293294
294- if (!has_image_capture_source )
295+ if (!this -> output_capture_manager )
295296 {
296297 std::cerr << " Compositor has not advertised ext-image-capture-source-v1" << std::endl;
298+ output_capture = false ;
297299 }
298300
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 );
301+ if (!this ->toplevel_capture_manager )
302+ {
303+ std::cerr << " Compositor has not advertised ext-foreign-toplevel-image-capture-source-v1" <<
304+ std::endl;
305+ toplevel_capture = false ;
306+ }
307+
308+ if (!toplevel_capture)
309+ {
310+ if (!output_capture)
311+ {
312+ std::cerr << " No capture protocols supported, nothing to do." << std::endl;
313+ exit (EXIT_FAILURE );
314+ }
315+
316+ window_label.set_sensitive (false );
317+ window_label.set_tooltip_text (" This compositor does not currently support sharing individual windows" );
318+ notebook.set_current_page (1 );
319+ }
302320
303321 /* Get output list */
304322 auto gtkdisplay = Gdk::Display::get_default ();
@@ -357,7 +375,6 @@ void WayfireStreamChooserApp::activate()
357375 window.present ();
358376}
359377
360- static bool first_toplevel = true ;
361378void WayfireStreamChooserApp::add_toplevel (ext_foreign_toplevel_handle_v1 *handle)
362379{
363380 toplevels.emplace (handle, new WayfireChooserTopLevel (handle));
@@ -367,14 +384,6 @@ void WayfireStreamChooserApp::add_toplevel(ext_foreign_toplevel_handle_v1 *handl
367384 auto child = window_list.get_child_at_index (0 );
368385 window_list.select_child (*child);
369386 }
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- }
378387}
379388
380389void WayfireStreamChooserApp::remove_toplevel (WayfireChooserTopLevel *toplevel)
0 commit comments