Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

output: pending_xdg is written but never read #327

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 1 addition & 25 deletions src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,8 @@ impl OutputState {
let name = pending_info.id;

let version = wl_output.version();
let pending_xdg = self.xdg.get().is_ok();

let xdg_output = if pending_xdg {
let xdg = self.xdg.get().unwrap();

Some(xdg.get_xdg_output(&wl_output, qh, data))
} else {
None
};
let xdg_output = self.xdg.get().ok().map(|xdg| xdg.get_xdg_output(&wl_output, qh, data));

let inner = OutputInner {
name,
Expand All @@ -225,7 +218,6 @@ impl OutputState {

pending_info,
pending_wl: true,
pending_xdg,
};

self.outputs.push(inner);
Expand Down Expand Up @@ -495,16 +487,6 @@ where
inner.current_info = Some(info.clone());
inner.pending_wl = false;

if inner
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this will still be needed for version 3 of xdg-output. Although our current interpretation of xdg-output might be wrong.

xdg_output::done states the following:

This event is sent after all other properties of an xdg_output have been sent.

Now this doesn't talk about the properties of wl_output AND xdg_output, but only xdg_output. Don't worry about the technical issue I mentioned, that probably needs to be addressed elsewhere.

.xdg_output
.as_ref()
.map(Proxy::version)
.map(|v| v > 3) // version 3 of xdg_output deprecates xdg_output::done
.unwrap_or(false)
{
inner.pending_xdg = false;
}

// Set the user data, see if we need to run scale callbacks
let run_callbacks = data.set(info);

Expand Down Expand Up @@ -568,32 +550,27 @@ where
match event {
zxdg_output_v1::Event::LogicalPosition { x, y } => {
inner.pending_info.logical_position = Some((x, y));
inner.pending_xdg = true;
}
zxdg_output_v1::Event::LogicalSize { width, height } => {
inner.pending_info.logical_size = Some((width, height));
inner.pending_xdg = true;
}
zxdg_output_v1::Event::Name { name } => {
if inner.wl_output.version() < 4 {
inner.pending_info.name = Some(name);
}
inner.pending_xdg = true;
}

zxdg_output_v1::Event::Description { description } => {
if inner.wl_output.version() < 4 {
inner.pending_info.description = Some(description);
}
inner.pending_xdg = true;
}

zxdg_output_v1::Event::Done => {
// This event is deprecated starting in version 3, wl_output::done should be sent instead.
if output.version() < 3 {
let info = inner.pending_info.clone();
inner.current_info = Some(info.clone());
inner.pending_xdg = false;

// Set the user data
data.set(info);
Expand Down Expand Up @@ -718,5 +695,4 @@ struct OutputInner {
current_info: Option<OutputInfo>,
pending_info: OutputInfo,
pending_wl: bool,
pending_xdg: bool,
}