improv(app-list): only send screencopy requests as needed
This commit is contained in:
parent
2f1b20e1c7
commit
769af3d944
3 changed files with 11 additions and 5 deletions
|
|
@ -658,6 +658,12 @@ impl cosmic::Application for CosmicAppList {
|
||||||
.chain(self.favorite_list.iter())
|
.chain(self.favorite_list.iter())
|
||||||
.find(|t| t.desktop_info.id == id)
|
.find(|t| t.desktop_info.id == id)
|
||||||
{
|
{
|
||||||
|
for (ref handle, _, _) in &toplevel_group.toplevels {
|
||||||
|
if let Some(tx) = self.wayland_sender.as_ref() {
|
||||||
|
let _ = tx.send(WaylandRequest::Screencopy(handle.clone()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let rectangle = match self.rectangles.get(&toplevel_group.id) {
|
let rectangle = match self.rectangles.get(&toplevel_group.id) {
|
||||||
Some(r) => r,
|
Some(r) => r,
|
||||||
None => return Command::none(),
|
None => return Command::none(),
|
||||||
|
|
|
||||||
|
|
@ -220,15 +220,13 @@ impl ToplevelInfoHandler for AppData {
|
||||||
toplevel: &zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1,
|
toplevel: &zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1,
|
||||||
) {
|
) {
|
||||||
if let Some(info) = self.toplevel_info_state.info(toplevel) {
|
if let Some(info) = self.toplevel_info_state.info(toplevel) {
|
||||||
// spawn thread for sending the image
|
|
||||||
self.send_image(toplevel.clone());
|
|
||||||
|
|
||||||
let _ = self
|
let _ = self
|
||||||
.tx
|
.tx
|
||||||
.unbounded_send(WaylandUpdate::Toplevel(ToplevelUpdate::Add(
|
.unbounded_send(WaylandUpdate::Toplevel(ToplevelUpdate::Add(
|
||||||
toplevel.clone(),
|
toplevel.clone(),
|
||||||
info.clone(),
|
info.clone(),
|
||||||
)));
|
)));
|
||||||
|
self.send_image(toplevel.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -239,8 +237,6 @@ impl ToplevelInfoHandler for AppData {
|
||||||
toplevel: &zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1,
|
toplevel: &zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1,
|
||||||
) {
|
) {
|
||||||
if let Some(info) = self.toplevel_info_state.info(toplevel) {
|
if let Some(info) = self.toplevel_info_state.info(toplevel) {
|
||||||
// spawn thread for sending the image
|
|
||||||
self.send_image(toplevel.clone());
|
|
||||||
let _ = self
|
let _ = self
|
||||||
.tx
|
.tx
|
||||||
.unbounded_send(WaylandUpdate::Toplevel(ToplevelUpdate::Update(
|
.unbounded_send(WaylandUpdate::Toplevel(ToplevelUpdate::Update(
|
||||||
|
|
@ -615,6 +611,9 @@ pub(crate) fn wayland_handler(
|
||||||
if handle
|
if handle
|
||||||
.insert_source(rx, |event, _, state| match event {
|
.insert_source(rx, |event, _, state| match event {
|
||||||
calloop::channel::Event::Msg(req) => match req {
|
calloop::channel::Event::Msg(req) => match req {
|
||||||
|
WaylandRequest::Screencopy(handle) => {
|
||||||
|
state.send_image(handle.clone());
|
||||||
|
}
|
||||||
WaylandRequest::Toplevel(req) => match req {
|
WaylandRequest::Toplevel(req) => match req {
|
||||||
ToplevelRequest::Activate(handle) => {
|
ToplevelRequest::Activate(handle) => {
|
||||||
if let Some(seat) = state.seat_state.seats().next() {
|
if let Some(seat) = state.seat_state.seats().next() {
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,7 @@ pub enum WaylandRequest {
|
||||||
exec: String,
|
exec: String,
|
||||||
gpu_idx: Option<usize>,
|
gpu_idx: Option<usize>,
|
||||||
},
|
},
|
||||||
|
Screencopy(ZcosmicToplevelHandleV1),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue