aboutsummaryrefslogtreecommitdiffstats
path: root/src/api
diff options
context:
space:
mode:
authorPierre Krieger <pierre.krieger1708@gmail.com>2015-09-21 09:15:53 +0200
committerPierre Krieger <pierre.krieger1708@gmail.com>2015-09-21 12:03:55 +0200
commit48fe9b26442662517b1590cb98ab81d79b059953 (patch)
treee2043b1941d340090fa7c7e9590bf2f3e7c81b47 /src/api
parentc244f8c033f100a6e0f3e0b2b408f6ddc1006d47 (diff)
downloadglutin-48fe9b26442662517b1590cb98ab81d79b059953.tar.gz
glutin-48fe9b26442662517b1590cb98ab81d79b059953.zip
Extract WindowAttributes from the BuilderAttribs
Diffstat (limited to 'src/api')
-rw-r--r--src/api/cocoa/headless.rs2
-rw-r--r--src/api/cocoa/mod.rs12
-rw-r--r--src/api/egl/mod.rs2
-rw-r--r--src/api/ios/mod.rs2
-rw-r--r--src/api/osmesa/mod.rs2
-rw-r--r--src/api/wayland/mod.rs6
-rw-r--r--src/api/win32/init.rs22
-rw-r--r--src/api/x11/window.rs18
8 files changed, 33 insertions, 33 deletions
diff --git a/src/api/cocoa/headless.rs b/src/api/cocoa/headless.rs
index 7cd0f88..ad1a464 100644
--- a/src/api/cocoa/headless.rs
+++ b/src/api/cocoa/headless.rs
@@ -28,7 +28,7 @@ pub struct HeadlessContext {
impl HeadlessContext {
pub fn new(builder: BuilderAttribs) -> Result<HeadlessContext, CreationError> {
- let (width, height) = builder.dimensions.unwrap_or((1024, 768));
+ let (width, height) = builder.window.dimensions.unwrap_or((1024, 768));
let context = unsafe {
let attributes = [
NSOpenGLPFAAccelerated as u32,
diff --git a/src/api/cocoa/mod.rs b/src/api/cocoa/mod.rs
index e259f39..e3feda2 100644
--- a/src/api/cocoa/mod.rs
+++ b/src/api/cocoa/mod.rs
@@ -301,7 +301,7 @@ impl Window {
};
unsafe {
- if builder.transparent {
+ if builder.window.transparent {
let clear_col = {
let cls = Class::get("NSColor").unwrap();
@@ -317,7 +317,7 @@ impl Window {
}
app.activateIgnoringOtherApps_(YES);
- if builder.visible {
+ if builder.window.visible {
window.makeKeyAndOrderFront_(nil);
} else {
window.makeKeyWindow();
@@ -358,7 +358,7 @@ impl Window {
fn create_window(builder: &BuilderAttribs) -> Option<IdRef> {
unsafe {
- let screen = match builder.monitor {
+ let screen = match builder.window.monitor {
Some(ref monitor_id) => {
let native_id = match monitor_id.get_native_identifier() {
NativeMonitorId::Numeric(num) => num,
@@ -390,12 +390,12 @@ impl Window {
let frame = match screen {
Some(screen) => NSScreen::frame(screen),
None => {
- let (width, height) = builder.dimensions.unwrap_or((800, 600));
+ let (width, height) = builder.window.dimensions.unwrap_or((800, 600));
NSRect::new(NSPoint::new(0., 0.), NSSize::new(width as f64, height as f64))
}
};
- let masks = if screen.is_some() || !builder.decorations {
+ let masks = if screen.is_some() || !builder.window.decorations {
NSBorderlessWindowMask as NSUInteger |
NSResizableWindowMask as NSUInteger
} else {
@@ -412,7 +412,7 @@ impl Window {
NO,
));
window.non_nil().map(|window| {
- let title = IdRef::new(NSString::alloc(nil).init_str(&builder.title));
+ let title = IdRef::new(NSString::alloc(nil).init_str(&builder.window.title));
window.setTitle_(*title);
window.setAcceptsMouseMovedEvents_(YES);
if screen.is_some() {
diff --git a/src/api/egl/mod.rs b/src/api/egl/mod.rs
index c06c8ef..32ab71e 100644
--- a/src/api/egl/mod.rs
+++ b/src/api/egl/mod.rs
@@ -367,7 +367,7 @@ impl<'a> ContextPrototype<'a> {
}
pub fn finish_pbuffer(self) -> Result<Context, CreationError> {
- let dimensions = self.builder.dimensions.unwrap_or((800, 600));
+ let dimensions = self.builder.window.dimensions.unwrap_or((800, 600));
let attrs = &[
ffi::egl::WIDTH as libc::c_int, dimensions.0 as libc::c_int,
diff --git a/src/api/ios/mod.rs b/src/api/ios/mod.rs
index 9d1b527..0163f45 100644
--- a/src/api/ios/mod.rs
+++ b/src/api/ios/mod.rs
@@ -219,7 +219,7 @@ impl Window {
let state = &mut *self.delegate_state;
- if builder.multitouch {
+ if builder.window.multitouch {
let _: () = msg_send![state.view, setMultipleTouchEnabled:YES];
}
diff --git a/src/api/osmesa/mod.rs b/src/api/osmesa/mod.rs
index 2bfc8f5..2debc7e 100644
--- a/src/api/osmesa/mod.rs
+++ b/src/api/osmesa/mod.rs
@@ -37,7 +37,7 @@ impl OsMesaContext {
return Err(OsMesaCreationError::NotSupported);
}
- let dimensions = builder.dimensions.unwrap();
+ let dimensions = builder.window.dimensions.unwrap();
match builder.opengl.robustness {
Robustness::RobustNoResetNotification | Robustness::RobustLoseContextOnReset => {
diff --git a/src/api/wayland/mod.rs b/src/api/wayland/mod.rs
index b46e2d1..7bc5798 100644
--- a/src/api/wayland/mod.rs
+++ b/src/api/wayland/mod.rs
@@ -251,7 +251,7 @@ impl Window {
if !is_egl_available() { return Err(CreationError::NotSupported) }
- let (w, h) = builder.dimensions.unwrap_or((800, 600));
+ let (w, h) = builder.window.dimensions.unwrap_or((800, 600));
let surface = EGLSurface::new(
wayland_context.compositor.create_surface(),
@@ -259,12 +259,12 @@ impl Window {
h as i32
);
- let mut shell_window = if let Some(PlatformMonitorID::Wayland(ref monitor)) = builder.monitor {
+ let mut shell_window = if let Some(PlatformMonitorID::Wayland(ref monitor)) = builder.window.monitor {
let shell_surface = wayland_context.shell.get_shell_surface(surface);
shell_surface.set_fullscreen(ShellFullscreenMethod::Default, Some(&monitor.output));
ShellWindow::Plain(shell_surface)
} else {
- if builder.decorations {
+ if builder.window.decorations {
ShellWindow::Decorated(match DecoratedSurface::new(
surface,
w as i32,
diff --git a/src/api/win32/init.rs b/src/api/win32/init.rs
index daa6b5a..8c2d86c 100644
--- a/src/api/win32/init.rs
+++ b/src/api/win32/init.rs
@@ -47,7 +47,7 @@ pub fn new_window(builder: BuilderAttribs<'static>, builder_sharelists: Option<R
// initializing variables to be sent to the task
- let title = OsStr::new(&builder.title).encode_wide().chain(Some(0).into_iter())
+ let title = OsStr::new(&builder.window.title).encode_wide().chain(Some(0).into_iter())
.collect::<Vec<_>>();
let (tx, rx) = channel();
@@ -92,20 +92,20 @@ unsafe fn init(title: Vec<u16>, builder: BuilderAttribs<'static>,
// building a RECT object with coordinates
let mut rect = winapi::RECT {
- left: 0, right: builder.dimensions.unwrap_or((1024, 768)).0 as winapi::LONG,
- top: 0, bottom: builder.dimensions.unwrap_or((1024, 768)).1 as winapi::LONG,
+ left: 0, right: builder.window.dimensions.unwrap_or((1024, 768)).0 as winapi::LONG,
+ top: 0, bottom: builder.window.dimensions.unwrap_or((1024, 768)).1 as winapi::LONG,
};
// switching to fullscreen if necessary
// this means adjusting the window's position so that it overlaps the right monitor,
// and change the monitor's resolution if necessary
- if builder.monitor.is_some() {
- let monitor = builder.monitor.as_ref().unwrap();
+ if builder.window.monitor.is_some() {
+ let monitor = builder.window.monitor.as_ref().unwrap();
try!(switch_to_fullscreen(&mut rect, monitor));
}
// computing the style and extended style of the window
- let (ex_style, style) = if builder.monitor.is_some() || builder.decorations == false {
+ let (ex_style, style) = if builder.window.monitor.is_some() || builder.window.decorations == false {
(winapi::WS_EX_APPWINDOW, winapi::WS_POPUP | winapi::WS_CLIPSIBLINGS | winapi::WS_CLIPCHILDREN)
} else {
(winapi::WS_EX_APPWINDOW | winapi::WS_EX_WINDOWEDGE,
@@ -117,19 +117,19 @@ unsafe fn init(title: Vec<u16>, builder: BuilderAttribs<'static>,
// creating the real window this time, by using the functions in `extra_functions`
let real_window = {
- let (width, height) = if builder.monitor.is_some() || builder.dimensions.is_some() {
+ let (width, height) = if builder.window.monitor.is_some() || builder.window.dimensions.is_some() {
(Some(rect.right - rect.left), Some(rect.bottom - rect.top))
} else {
(None, None)
};
- let (x, y) = if builder.monitor.is_some() {
+ let (x, y) = if builder.window.monitor.is_some() {
(Some(rect.left), Some(rect.top))
} else {
(None, None)
};
- let style = if !builder.visible || builder.headless {
+ let style = if !builder.window.visible || builder.headless {
style
} else {
style | winapi::WS_VISIBLE
@@ -203,7 +203,7 @@ unsafe fn init(title: Vec<u16>, builder: BuilderAttribs<'static>,
};
// making the window transparent
- if builder.transparent {
+ if builder.window.transparent {
let bb = winapi::DWM_BLURBEHIND {
dwFlags: 0x1, // FIXME: DWM_BB_ENABLE;
fEnable: 1,
@@ -215,7 +215,7 @@ unsafe fn init(title: Vec<u16>, builder: BuilderAttribs<'static>,
}
// calling SetForegroundWindow if fullscreen
- if builder.monitor.is_some() {
+ if builder.window.monitor.is_some() {
user32::SetForegroundWindow(real_window.0);
}
diff --git a/src/api/x11/window.rs b/src/api/x11/window.rs
index 8e2bdb5..d39e701 100644
--- a/src/api/x11/window.rs
+++ b/src/api/x11/window.rs
@@ -296,9 +296,9 @@ pub struct Window {
impl Window {
pub fn new(display: &Arc<XConnection>, builder: BuilderAttribs) -> Result<Window, CreationError> {
- let dimensions = builder.dimensions.unwrap_or((800, 600));
+ let dimensions = builder.window.dimensions.unwrap_or((800, 600));
- let screen_id = match builder.monitor {
+ let screen_id = match builder.window.monitor {
Some(PlatformMonitorID::X(MonitorID(_, monitor))) => monitor as i32,
_ => unsafe { (display.xlib.XDefaultScreen)(display.display) },
};
@@ -316,7 +316,7 @@ impl Window {
// FIXME: `XF86VidModeModeInfo` is missing its `hskew` field. Therefore we point to
// `vsyncstart` instead of `vdisplay` as a temporary hack.
- let mode_to_switch_to = if builder.monitor.is_some() {
+ let mode_to_switch_to = if builder.window.monitor.is_some() {
let matching_mode = (0 .. mode_num).map(|i| {
let m: ffi::XF86VidModeModeInfo = ptr::read(*modes.offset(i as isize) as *const _); m
}).find(|m| m.hdisplay == dimensions.0 as u16 && m.vsyncstart == dimensions.1 as u16);
@@ -415,7 +415,7 @@ impl Window {
ffi::KeyReleaseMask | ffi::ButtonPressMask |
ffi::ButtonReleaseMask | ffi::KeymapStateMask;
swa.border_pixel = 0;
- if builder.transparent {
+ if builder.window.transparent {
swa.background_pixel = 0;
}
swa.override_redirect = 0;
@@ -424,7 +424,7 @@ impl Window {
let mut window_attributes = ffi::CWBorderPixel | ffi::CWColormap | ffi::CWEventMask;
- if builder.transparent {
+ if builder.window.transparent {
window_attributes |= ffi::CWBackPixel;
}
@@ -448,7 +448,7 @@ impl Window {
};
// set visibility
- if builder.visible {
+ if builder.window.visible {
unsafe {
(display.xlib.XMapRaised)(display.display, window);
(display.xlib.XFlush)(display.display);
@@ -461,7 +461,7 @@ impl Window {
(display.xlib.XInternAtom)(display.display, delete_window, 0)
);
(display.xlib.XSetWMProtocols)(display.display, window, &mut wm_delete_window, 1);
- with_c_str(&*builder.title, |title| {;
+ with_c_str(&*builder.window.title, |title| {;
(display.xlib.XStoreName)(display.display, window, title);
});
(display.xlib.XFlush)(display.display);
@@ -509,7 +509,7 @@ impl Window {
// Set ICCCM WM_CLASS property based on initial window title
unsafe {
- with_c_str(&*builder.title, |c_name| {
+ with_c_str(&*builder.window.title, |c_name| {
let hint = (display.xlib.XAllocClassHint)();
(*hint).res_name = c_name as *mut libc::c_char;
(*hint).res_class = c_name as *mut libc::c_char;
@@ -518,7 +518,7 @@ impl Window {
});
}
- let is_fullscreen = builder.monitor.is_some();
+ let is_fullscreen = builder.window.monitor.is_some();
// finish creating the OpenGL context
let context = match context {