From c44001b64c939e39868993b713ec3b5240b4df85 Mon Sep 17 00:00:00 2001 From: Daniel Hedlund Date: Sat, 14 Dec 2013 16:08:58 -0800 Subject: [PATCH] Add glfw window_refresh_callback, windows now redraw on linux Fixes #941. --- src/components/main/compositing/run.rs | 5 +++++ src/components/main/platform/common/glfw_windowing.rs | 4 ++++ src/components/main/windowing.rs | 2 ++ 3 files changed, 11 insertions(+) diff --git a/src/components/main/compositing/run.rs b/src/components/main/compositing/run.rs index b8125665543..3f48199c268 100644 --- a/src/components/main/compositing/run.rs +++ b/src/components/main/compositing/run.rs @@ -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; @@ -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 { diff --git a/src/components/main/platform/common/glfw_windowing.rs b/src/components/main/platform/common/glfw_windowing.rs index 023b816f892..5b99f5c243b 100644 --- a/src/components/main/platform/common/glfw_windowing.rs +++ b/src/components/main/platform/common/glfw_windowing.rs @@ -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}; @@ -92,6 +93,9 @@ impl WindowMethods 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) diff --git a/src/components/main/windowing.rs b/src/components/main/windowing.rs index dcf94615831..85e8d63f16c 100644 --- a/src/components/main/windowing.rs +++ b/src/components/main/windowing.rs @@ -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.