Skip to content

Commit 8396773

Browse files
soreautrigg
authored andcommitted
stream-chooser: Stream selection without pause timeout
1 parent b6d5899 commit 8396773

2 files changed

Lines changed: 31 additions & 3 deletions

File tree

src/stream-chooser/stream-chooser.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@ class WayfireStreamChooserApp : public Gtk::Application
1616
{
1717
private:
1818
Gtk::Window window;
19-
Gtk::Notebook notebook;
2019

2120
Gtk::Box main, buttons;
2221

2322
Gtk::Label window_label, screen_label, header;
2423

25-
Gtk::FlowBox window_list, screen_list;
2624
Gtk::Button done, cancel;
2725
Gtk::ScrolledWindow scroll_window, scroll_screen;
2826

@@ -34,7 +32,8 @@ class WayfireStreamChooserApp : public Gtk::Application
3432

3533
public:
3634
wl_display *display;
37-
bool is_in_use = false;
35+
Gtk::Notebook notebook;
36+
Gtk::FlowBox window_list, screen_list;
3837
bool has_foreign_toplevel_list = false;
3938
bool has_image_copy_capture = false;
4039
bool has_image_capture_source = false;

src/stream-chooser/toplevelwidget.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,29 @@ WayfireChooserTopLevel::WayfireChooserTopLevel(ext_foreign_toplevel_handle_v1 *h
380380
return G_SOURCE_REMOVE;
381381
}, 2000);
382382

383+
signals.push_back(
384+
WayfireStreamChooserApp::getInstance().window_list.signal_selected_children_changed().connect(
385+
[=] ()
386+
{
387+
if (WayfireStreamChooserApp::getInstance().window_list.get_selected_children()[0]->get_children()[0]
388+
==
389+
this)
390+
{
391+
this->initial_timeout.disconnect();
392+
this->pause_timeout.disconnect();
393+
this->stream();
394+
return;
395+
}
396+
397+
this->pause_timeout.disconnect();
398+
this->pause_timeout = Glib::signal_timeout().connect(
399+
[this] ()
400+
{
401+
this->pause();
402+
return G_SOURCE_REMOVE;
403+
}, 2000);
404+
}));
405+
383406
auto motion_controller = Gtk::EventControllerMotion::create();
384407
signals.push_back(motion_controller->signal_enter().connect(
385408
[this] (double, double)
@@ -398,6 +421,12 @@ WayfireChooserTopLevel::WayfireChooserTopLevel(ext_foreign_toplevel_handle_v1 *h
398421
this->pause_timeout = Glib::signal_timeout().connect(
399422
[this] ()
400423
{
424+
if (WayfireStreamChooserApp::getInstance().window_list.get_selected_children()[0]->get_children()[
425+
0] == this)
426+
{
427+
return G_SOURCE_REMOVE;
428+
}
429+
401430
this->pause();
402431
return G_SOURCE_REMOVE;
403432
}, 2000);

0 commit comments

Comments
 (0)