Skip to content

Commit

Permalink
Add glfw window_refresh_callback, windows now redraw on linux
Browse files Browse the repository at this point in the history
Fixes #941.
  • Loading branch information
dhedlund committed Dec 15, 2013
1 parent c5d81f1 commit c44001b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/main/compositing/run.rs
Expand Up @@ -9,6 +9,7 @@ use windowing::{ApplicationMethods, WindowEvent, WindowMethods};
use windowing::{IdleWindowEvent, ResizeWindowEvent, LoadUrlWindowEvent, MouseWindowEventClass};
use windowing::{ScrollWindowEvent, ZoomWindowEvent, NavigationWindowEvent, FinishedWindowEvent};
use windowing::{QuitWindowEvent, MouseWindowClickEvent, MouseWindowMouseDownEvent, MouseWindowMouseUpEvent};
use windowing::RefreshWindowEvent;

use azure::azure_hl::SourceSurfaceMethods;
use azure::azure_hl;
Expand Down Expand Up @@ -241,6 +242,10 @@ pub fn run_compositor(compositor: &CompositorTask) {
match event {
IdleWindowEvent => {}

RefreshWindowEvent => {
recomposite = true;
}

ResizeWindowEvent(width, height) => {
let new_size = Size2D(width, height);
if window_size != new_size {
Expand Down
4 changes: 4 additions & 0 deletions src/components/main/platform/common/glfw_windowing.rs
Expand Up @@ -8,6 +8,7 @@ use windowing::{ApplicationMethods, WindowEvent, WindowMethods};
use windowing::{IdleWindowEvent, ResizeWindowEvent, LoadUrlWindowEvent, MouseWindowEventClass};
use windowing::{ScrollWindowEvent, ZoomWindowEvent, NavigationWindowEvent, FinishedWindowEvent};
use windowing::{QuitWindowEvent, MouseWindowClickEvent, MouseWindowMouseDownEvent, MouseWindowMouseUpEvent};
use windowing::RefreshWindowEvent;
use windowing::{Forward, Back};

use alert::{Alert, AlertMethods};
Expand Down Expand Up @@ -92,6 +93,9 @@ impl WindowMethods<Application> for Window {
do window.glfw_window.set_framebuffer_size_callback |_win, width, height| {
local_window().event_queue.push(ResizeWindowEvent(width as uint, height as uint))
}
do window.glfw_window.set_refresh_callback |_win| {
local_window().event_queue.push(RefreshWindowEvent)
}
do window.glfw_window.set_key_callback |_win, key, _scancode, action, mods| {
if action == glfw::Press {
local_window().handle_key(key, mods)
Expand Down
2 changes: 2 additions & 0 deletions src/components/main/windowing.rs
Expand Up @@ -26,6 +26,8 @@ pub enum WindowEvent {
/// FIXME: This is a bogus event and is only used because we don't have the new
/// scheduler integrated with the platform event loop.
IdleWindowEvent,
/// Sent when part of the window is marked dirty and needs to be redrawn.
RefreshWindowEvent,
/// Sent when the window is resized.
ResizeWindowEvent(uint, uint),
/// Sent when a new URL is to be loaded.
Expand Down

5 comments on commit c44001b

@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 dhedlund@c44001b

@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 dhedlund/servo/issue_941 = c44001b 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.

dhedlund/servo/issue_941 = c44001b merged ok, testing candidate = 8c3c547

@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 = 8c3c547

Please sign in to comment.