Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
Bump winapi to 0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Eijebong committed Jan 2, 2018
1 parent e7f900a commit 1887503
Show file tree
Hide file tree
Showing 11 changed files with 457 additions and 426 deletions.
7 changes: 1 addition & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,7 @@ core-foundation = "0.4"
core-graphics = "0.12.1"

[target.'cfg(target_os = "windows")'.dependencies]
winapi = "0.2"
shell32-sys = "0.1"
gdi32-sys = "0.2"
user32-sys = "0.2"
kernel32-sys = "0.2"
dwmapi-sys = "0.1"
winapi = { version = "0.3", features = ["winuser", "winnt", "wingdi", "dwmapi", "shellapi", "windowsx", "libloaderapi", "processthreadsapi"] }

[target.'cfg(any(target_os = "linux", target_os = "freebsd", target_os="dragonfly", target_os="openbsd"))'.dependencies]
image = { version = "0.17", optional = true }
Expand Down
2 changes: 1 addition & 1 deletion src/api/egl/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub type EGLNativeDisplayType = *const libc::c_void;
pub type EGLNativePixmapType = *const libc::c_void; // FIXME: egl_native_pixmap_t instead

#[cfg(target_os = "windows")]
pub type EGLNativeWindowType = winapi::HWND;
pub type EGLNativeWindowType = winapi::shared::windef::HWND;
#[cfg(target_os = "linux")]
pub type EGLNativeWindowType = *const libc::c_void;
#[cfg(target_os = "android")]
Expand Down
12 changes: 6 additions & 6 deletions src/api/wgl/make_current_guard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@ use std::marker::PhantomData;
use std::os::raw::c_void;
use std::io;

use winapi;
use winapi::shared::windef::{HDC, HGLRC};
use CreationError;

use super::gl;
/// A guard for when you want to make the context current. Destroying the guard restores the
/// previously-current context.
pub struct CurrentContextGuard<'a, 'b> {
previous_hdc: winapi::HDC,
previous_hglrc: winapi::HGLRC,
previous_hdc: HDC,
previous_hglrc: HGLRC,
marker1: PhantomData<&'a ()>,
marker2: PhantomData<&'b ()>,
}

impl<'a, 'b> CurrentContextGuard<'a, 'b> {
pub unsafe fn make_current(hdc: winapi::HDC, context: winapi::HGLRC)
pub unsafe fn make_current(hdc: HDC, context: HGLRC)
-> Result<CurrentContextGuard<'a, 'b>, CreationError>
{
let previous_hdc = gl::wgl::GetCurrentDC() as winapi::HDC;
let previous_hglrc = gl::wgl::GetCurrentContext() as winapi::HGLRC;
let previous_hdc = gl::wgl::GetCurrentDC() as HDC;
let previous_hglrc = gl::wgl::GetCurrentContext() as HGLRC;

let result = gl::wgl::MakeCurrent(hdc as *const _, context as *const _);
if result == 0 {
Expand Down
Loading

0 comments on commit 1887503

Please sign in to comment.