@@ -18,7 +18,7 @@ use context;
18
18
use backend;
19
19
use backend:: Context ;
20
20
use backend:: Backend ;
21
- use glutin:: GlContext ;
21
+ use backend :: glutin:: glutin :: ContextTrait ;
22
22
use std;
23
23
use std:: cell:: { Cell , RefCell , Ref } ;
24
24
use std:: error:: Error ;
@@ -37,15 +37,15 @@ pub struct Display {
37
37
// contains everything related to the current context and its state
38
38
context : Rc < context:: Context > ,
39
39
// The glutin Window alongside its associated GL Context.
40
- gl_window : Rc < RefCell < glutin:: GlWindow > > ,
40
+ gl_window : Rc < RefCell < glutin:: WindowedContext > > ,
41
41
// Used to check whether the framebuffer dimensions have changed between frames. If they have,
42
42
// the glutin context must be resized accordingly.
43
43
last_framebuffer_dimensions : Cell < ( u32 , u32 ) > ,
44
44
}
45
45
46
46
/// An implementation of the `Backend` trait for glutin.
47
47
#[ derive( Clone ) ]
48
- pub struct GlutinBackend ( Rc < RefCell < glutin:: GlWindow > > ) ;
48
+ pub struct GlutinBackend ( Rc < RefCell < glutin:: WindowedContext > > ) ;
49
49
50
50
/// Error that can happen while creating a glium display.
51
51
#[ derive( Debug ) ]
@@ -67,44 +67,44 @@ impl Display {
67
67
events_loop : & glutin:: EventsLoop ,
68
68
) -> Result < Self , DisplayCreationError >
69
69
{
70
- let gl_window = try! ( glutin:: GlWindow :: new ( window_builder, context_builder, events_loop) ) ;
70
+ let gl_window = glutin:: WindowedContext :: new_windowed ( window_builder, context_builder, events_loop) ? ;
71
71
Self :: from_gl_window ( gl_window) . map_err ( From :: from)
72
72
}
73
73
74
74
/// Create a new glium `Display`.
75
75
///
76
76
/// Performs a compatibility check to make sure that all core elements of glium are supported
77
77
/// by the implementation.
78
- pub fn from_gl_window ( gl_window : glutin:: GlWindow ) -> Result < Self , IncompatibleOpenGl > {
78
+ pub fn from_gl_window ( gl_window : glutin:: WindowedContext ) -> Result < Self , IncompatibleOpenGl > {
79
79
Self :: with_debug ( gl_window, Default :: default ( ) )
80
80
}
81
81
82
82
/// Create a new glium `Display`.
83
83
///
84
84
/// This function does the same as `build_glium`, except that the resulting context
85
85
/// will assume that the current OpenGL context will never change.
86
- pub unsafe fn unchecked ( gl_window : glutin:: GlWindow ) -> Result < Self , IncompatibleOpenGl > {
86
+ pub unsafe fn unchecked ( gl_window : glutin:: WindowedContext ) -> Result < Self , IncompatibleOpenGl > {
87
87
Self :: unchecked_with_debug ( gl_window, Default :: default ( ) )
88
88
}
89
89
90
90
/// The same as the `new` constructor, but allows for specifying debug callback behaviour.
91
- pub fn with_debug ( gl_window : glutin:: GlWindow , debug : debug:: DebugCallbackBehavior )
91
+ pub fn with_debug ( gl_window : glutin:: WindowedContext , debug : debug:: DebugCallbackBehavior )
92
92
-> Result < Self , IncompatibleOpenGl >
93
93
{
94
94
Self :: new_inner ( gl_window, debug, true )
95
95
}
96
96
97
97
/// The same as the `unchecked` constructor, but allows for specifying debug callback behaviour.
98
98
pub unsafe fn unchecked_with_debug (
99
- gl_window : glutin:: GlWindow ,
99
+ gl_window : glutin:: WindowedContext ,
100
100
debug : debug:: DebugCallbackBehavior ,
101
101
) -> Result < Self , IncompatibleOpenGl >
102
102
{
103
103
Self :: new_inner ( gl_window, debug, false )
104
104
}
105
105
106
106
fn new_inner (
107
- gl_window : glutin:: GlWindow ,
107
+ gl_window : glutin:: WindowedContext ,
108
108
debug : debug:: DebugCallbackBehavior ,
109
109
checked : bool ,
110
110
) -> Result < Self , IncompatibleOpenGl >
@@ -120,10 +120,10 @@ impl Display {
120
120
} )
121
121
}
122
122
123
- /// Rebuilds the Display's `GlWindow ` with the given window and context builders.
123
+ /// Rebuilds the Display's `WindowedContext ` with the given window and context builders.
124
124
///
125
- /// This method ensures that the new `GlWindow `'s `Context` will share the display lists of the
126
- /// original `GlWindow `'s `Context`.
125
+ /// This method ensures that the new `WindowedContext `'s `Context` will share the display lists of the
126
+ /// original `WindowedContext `'s `Context`.
127
127
pub fn rebuild (
128
128
& self ,
129
129
window_builder : glutin:: WindowBuilder ,
@@ -135,11 +135,11 @@ impl Display {
135
135
let new_gl_window = {
136
136
let gl_window = self . gl_window . borrow ( ) ;
137
137
let context_builder = context_builder. with_shared_lists ( gl_window. context ( ) ) ;
138
- try! ( glutin:: GlWindow :: new ( window_builder, context_builder, events_loop) )
138
+ glutin:: WindowedContext :: new_windowed ( window_builder, context_builder, events_loop) ?
139
139
} ;
140
140
141
141
{
142
- // Replace the stored GlWindow with the new one.
142
+ // Replace the stored WindowedContext with the new one.
143
143
let mut gl_window = self . gl_window . borrow_mut ( ) ;
144
144
std:: mem:: replace ( & mut ( * gl_window) , new_gl_window) ;
145
145
}
@@ -151,9 +151,9 @@ impl Display {
151
151
Ok ( ( ) )
152
152
}
153
153
154
- /// Borrow the inner glutin GlWindow .
154
+ /// Borrow the inner glutin WindowedContext .
155
155
#[ inline]
156
- pub fn gl_window ( & self ) -> Ref < glutin:: GlWindow > {
156
+ pub fn gl_window ( & self ) -> Ref < glutin:: WindowedContext > {
157
157
self . gl_window . borrow ( )
158
158
}
159
159
@@ -234,9 +234,9 @@ impl backend::Facade for Display {
234
234
}
235
235
236
236
impl Deref for GlutinBackend {
237
- type Target = Rc < RefCell < glutin:: GlWindow > > ;
237
+ type Target = Rc < RefCell < glutin:: WindowedContext > > ;
238
238
#[ inline]
239
- fn deref ( & self ) -> & Rc < RefCell < glutin:: GlWindow > > {
239
+ fn deref ( & self ) -> & Rc < RefCell < glutin:: WindowedContext > > {
240
240
& self . 0
241
241
}
242
242
}
0 commit comments