mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Add glfw window_refresh_callback, windows now redraw on linux
Fixes #941.
This commit is contained in:
parent
c5d81f13c1
commit
c44001b64c
3 changed files with 11 additions and 0 deletions
|
@ -9,6 +9,7 @@ use windowing::{ApplicationMethods, WindowEvent, WindowMethods};
|
||||||
use windowing::{IdleWindowEvent, ResizeWindowEvent, LoadUrlWindowEvent, MouseWindowEventClass};
|
use windowing::{IdleWindowEvent, ResizeWindowEvent, LoadUrlWindowEvent, MouseWindowEventClass};
|
||||||
use windowing::{ScrollWindowEvent, ZoomWindowEvent, NavigationWindowEvent, FinishedWindowEvent};
|
use windowing::{ScrollWindowEvent, ZoomWindowEvent, NavigationWindowEvent, FinishedWindowEvent};
|
||||||
use windowing::{QuitWindowEvent, MouseWindowClickEvent, MouseWindowMouseDownEvent, MouseWindowMouseUpEvent};
|
use windowing::{QuitWindowEvent, MouseWindowClickEvent, MouseWindowMouseDownEvent, MouseWindowMouseUpEvent};
|
||||||
|
use windowing::RefreshWindowEvent;
|
||||||
|
|
||||||
use azure::azure_hl::SourceSurfaceMethods;
|
use azure::azure_hl::SourceSurfaceMethods;
|
||||||
use azure::azure_hl;
|
use azure::azure_hl;
|
||||||
|
@ -241,6 +242,10 @@ pub fn run_compositor(compositor: &CompositorTask) {
|
||||||
match event {
|
match event {
|
||||||
IdleWindowEvent => {}
|
IdleWindowEvent => {}
|
||||||
|
|
||||||
|
RefreshWindowEvent => {
|
||||||
|
recomposite = true;
|
||||||
|
}
|
||||||
|
|
||||||
ResizeWindowEvent(width, height) => {
|
ResizeWindowEvent(width, height) => {
|
||||||
let new_size = Size2D(width, height);
|
let new_size = Size2D(width, height);
|
||||||
if window_size != new_size {
|
if window_size != new_size {
|
||||||
|
|
|
@ -8,6 +8,7 @@ use windowing::{ApplicationMethods, WindowEvent, WindowMethods};
|
||||||
use windowing::{IdleWindowEvent, ResizeWindowEvent, LoadUrlWindowEvent, MouseWindowEventClass};
|
use windowing::{IdleWindowEvent, ResizeWindowEvent, LoadUrlWindowEvent, MouseWindowEventClass};
|
||||||
use windowing::{ScrollWindowEvent, ZoomWindowEvent, NavigationWindowEvent, FinishedWindowEvent};
|
use windowing::{ScrollWindowEvent, ZoomWindowEvent, NavigationWindowEvent, FinishedWindowEvent};
|
||||||
use windowing::{QuitWindowEvent, MouseWindowClickEvent, MouseWindowMouseDownEvent, MouseWindowMouseUpEvent};
|
use windowing::{QuitWindowEvent, MouseWindowClickEvent, MouseWindowMouseDownEvent, MouseWindowMouseUpEvent};
|
||||||
|
use windowing::RefreshWindowEvent;
|
||||||
use windowing::{Forward, Back};
|
use windowing::{Forward, Back};
|
||||||
|
|
||||||
use alert::{Alert, AlertMethods};
|
use alert::{Alert, AlertMethods};
|
||||||
|
@ -92,6 +93,9 @@ impl WindowMethods<Application> for Window {
|
||||||
do window.glfw_window.set_framebuffer_size_callback |_win, width, height| {
|
do window.glfw_window.set_framebuffer_size_callback |_win, width, height| {
|
||||||
local_window().event_queue.push(ResizeWindowEvent(width as uint, height as uint))
|
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| {
|
do window.glfw_window.set_key_callback |_win, key, _scancode, action, mods| {
|
||||||
if action == glfw::Press {
|
if action == glfw::Press {
|
||||||
local_window().handle_key(key, mods)
|
local_window().handle_key(key, mods)
|
||||||
|
|
|
@ -26,6 +26,8 @@ pub enum WindowEvent {
|
||||||
/// FIXME: This is a bogus event and is only used because we don't have the new
|
/// FIXME: This is a bogus event and is only used because we don't have the new
|
||||||
/// scheduler integrated with the platform event loop.
|
/// scheduler integrated with the platform event loop.
|
||||||
IdleWindowEvent,
|
IdleWindowEvent,
|
||||||
|
/// Sent when part of the window is marked dirty and needs to be redrawn.
|
||||||
|
RefreshWindowEvent,
|
||||||
/// Sent when the window is resized.
|
/// Sent when the window is resized.
|
||||||
ResizeWindowEvent(uint, uint),
|
ResizeWindowEvent(uint, uint),
|
||||||
/// Sent when a new URL is to be loaded.
|
/// Sent when a new URL is to be loaded.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue