Skip to content

Commit

Permalink
Removing unnecessary constant window title update
Browse files Browse the repository at this point in the history
update_window_title() is called constantly in the compositor loop. This function
always changes the title to "Servo" when in idle state so it is spamming the X
server with constant changes. But this isn't necessary because updating the
title is taken care of when the Rendering or Ready state are changed in
set_ready_state() and set_render_state().

Fixes #830

Happy Software Freedom Day
  • Loading branch information
luisbg committed Sep 22, 2013
1 parent 4f8b20e commit 5a95a30
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/components/main/platform/common/glfw_windowing.rs
Expand Up @@ -136,7 +136,7 @@ impl WindowMethods<Application> for Window {
}
glfw::poll_events();
self.throbber_frame = (self.throbber_frame + 1) % (THROBBER.len() as u8);
self.update_window_title();
self.update_window_title(false);
if self.glfw_window.should_close() {
QuitWindowEvent
} else if !self.event_queue.is_empty() {
Expand All @@ -149,7 +149,7 @@ impl WindowMethods<Application> for Window {
/// Sets the ready state.
fn set_ready_state(@mut self, ready_state: ReadyState) {
self.ready_state = ready_state;
self.update_window_title()
self.update_window_title(true)
}

/// Sets the render state.
Expand All @@ -162,7 +162,7 @@ impl WindowMethods<Application> for Window {
}

self.render_state = render_state;
self.update_window_title()
self.update_window_title(true)
}

fn hidpi_factor(@mut self) -> f32 {
Expand All @@ -174,11 +174,11 @@ impl WindowMethods<Application> for Window {

impl Window {
/// Helper function to set the window title in accordance with the ready state.
fn update_window_title(&self) {
fn update_window_title(&self, state_change: bool) {
let throbber = THROBBER[self.throbber_frame];
match self.ready_state {
Blank => {
self.glfw_window.set_title(fmt!("blank — Servo"));
if state_change { self.glfw_window.set_title(fmt!("blank — Servo")) }
}
Loading => {
self.glfw_window.set_title(fmt!("%c Loading — Servo", throbber))
Expand All @@ -191,7 +191,9 @@ impl Window {
RenderingRenderState => {
self.glfw_window.set_title(fmt!("%c Rendering — Servo", throbber))
}
IdleRenderState => self.glfw_window.set_title("Servo"),
IdleRenderState => {
if state_change { self.glfw_window.set_title("Servo") }
}
}
}
}
Expand Down

5 comments on commit 5a95a30

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

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

saw approval from larsbergstrom
at luisbg@5a95a30

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

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

merging luisbg/servo/master = 5a95a30 into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

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

luisbg/servo/master = 5a95a30 merged ok, testing candidate = 0096d11

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

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

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

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

fast-forwarding master to auto = 0096d11

Please sign in to comment.