mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 23:01:30 +11:00
Merge branch 'master' into x11_window_size_constraints
This commit is contained in:
commit
7a5e47c446
37
Cargo.toml
37
Cargo.toml
|
@ -16,33 +16,32 @@ libc = "0.2"
|
||||||
shared_library = "0.1.0"
|
shared_library = "0.1.0"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
gl_generator = "0.4"
|
gl_generator = "0.5"
|
||||||
khronos_api = "1.0"
|
|
||||||
|
|
||||||
[target.arm-linux-androideabi.dependencies.android_glue]
|
[target.arm-linux-androideabi.dependencies.android_glue]
|
||||||
version = "0.1"
|
version = "0.1"
|
||||||
|
|
||||||
[target.i386-apple-ios.dependencies]
|
[target.i386-apple-ios.dependencies]
|
||||||
objc = "0.1.8"
|
objc = "0.2"
|
||||||
|
|
||||||
[target.x86_64-apple-ios.dependencies]
|
[target.x86_64-apple-ios.dependencies]
|
||||||
objc = "0.1.8"
|
objc = "0.2"
|
||||||
|
|
||||||
[target.aarch64-apple-ios.dependencies]
|
[target.aarch64-apple-ios.dependencies]
|
||||||
objc = "0.1.8"
|
objc = "0.2"
|
||||||
|
|
||||||
[target.armv7s-apple-ios.dependencies]
|
[target.armv7s-apple-ios.dependencies]
|
||||||
objc = "0.1.8"
|
objc = "0.2"
|
||||||
|
|
||||||
[target.armv7-apple-ios.dependencies]
|
[target.armv7-apple-ios.dependencies]
|
||||||
objc = "0.1.8"
|
objc = "0.2"
|
||||||
|
|
||||||
[target.x86_64-apple-darwin.dependencies]
|
[target.x86_64-apple-darwin.dependencies]
|
||||||
objc = "0.1.8"
|
objc = "0.2"
|
||||||
cgl = "0.1"
|
cgl = "0.1"
|
||||||
cocoa = "0.2.4"
|
cocoa = "0.3"
|
||||||
core-foundation = "0"
|
core-foundation = "0"
|
||||||
core-graphics = "0"
|
core-graphics = "0.3"
|
||||||
|
|
||||||
[target.i686-pc-windows-gnu.dependencies]
|
[target.i686-pc-windows-gnu.dependencies]
|
||||||
winapi = "0.2"
|
winapi = "0.2"
|
||||||
|
@ -81,60 +80,60 @@ osmesa-sys = "0.0.5"
|
||||||
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
|
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
|
||||||
wayland-kbd = "0.3.3"
|
wayland-kbd = "0.3.3"
|
||||||
wayland-window = "0.2.2"
|
wayland-window = "0.2.2"
|
||||||
x11-dl = "~2.3"
|
x11-dl = "~2.4"
|
||||||
|
|
||||||
[target.i586-unknown-linux-gnu.dependencies]
|
[target.i586-unknown-linux-gnu.dependencies]
|
||||||
osmesa-sys = "0.0.5"
|
osmesa-sys = "0.0.5"
|
||||||
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
|
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
|
||||||
wayland-kbd = "0.3.3"
|
wayland-kbd = "0.3.3"
|
||||||
wayland-window = "0.2.2"
|
wayland-window = "0.2.2"
|
||||||
x11-dl = "~2.3"
|
x11-dl = "~2.4"
|
||||||
|
|
||||||
[target.x86_64-unknown-linux-gnu.dependencies]
|
[target.x86_64-unknown-linux-gnu.dependencies]
|
||||||
osmesa-sys = "0.0.5"
|
osmesa-sys = "0.0.5"
|
||||||
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
|
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
|
||||||
wayland-kbd = "0.3.3"
|
wayland-kbd = "0.3.3"
|
||||||
wayland-window = "0.2.2"
|
wayland-window = "0.2.2"
|
||||||
x11-dl = "~2.3"
|
x11-dl = "~2.4"
|
||||||
|
|
||||||
[target.arm-unknown-linux-gnueabihf.dependencies]
|
[target.arm-unknown-linux-gnueabihf.dependencies]
|
||||||
osmesa-sys = "0.0.5"
|
osmesa-sys = "0.0.5"
|
||||||
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
|
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
|
||||||
wayland-kbd = "0.3.3"
|
wayland-kbd = "0.3.3"
|
||||||
wayland-window = "0.2.2"
|
wayland-window = "0.2.2"
|
||||||
x11-dl = "~2.3"
|
x11-dl = "~2.4"
|
||||||
|
|
||||||
[target.armv7-unknown-linux-gnueabihf.dependencies]
|
[target.armv7-unknown-linux-gnueabihf.dependencies]
|
||||||
osmesa-sys = "0.0.5"
|
osmesa-sys = "0.0.5"
|
||||||
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
|
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
|
||||||
wayland-kbd = "0.3.3"
|
wayland-kbd = "0.3.3"
|
||||||
wayland-window = "0.2.2"
|
wayland-window = "0.2.2"
|
||||||
x11-dl = "~2.3"
|
x11-dl = "~2.4"
|
||||||
|
|
||||||
[target.aarch64-unknown-linux-gnu.dependencies]
|
[target.aarch64-unknown-linux-gnu.dependencies]
|
||||||
osmesa-sys = "0.0.5"
|
osmesa-sys = "0.0.5"
|
||||||
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
|
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
|
||||||
wayland-kbd = "0.3.3"
|
wayland-kbd = "0.3.3"
|
||||||
wayland-window = "0.2.2"
|
wayland-window = "0.2.2"
|
||||||
x11-dl = "~2.3"
|
x11-dl = "~2.4"
|
||||||
|
|
||||||
[target.x86_64-unknown-dragonfly.dependencies]
|
[target.x86_64-unknown-dragonfly.dependencies]
|
||||||
osmesa-sys = "0.0.5"
|
osmesa-sys = "0.0.5"
|
||||||
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
|
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
|
||||||
wayland-kbd = "0.3.3"
|
wayland-kbd = "0.3.3"
|
||||||
wayland-window = "0.2.2"
|
wayland-window = "0.2.2"
|
||||||
x11-dl = "~2.3"
|
x11-dl = "~2.4"
|
||||||
|
|
||||||
[target.x86_64-unknown-freebsd.dependencies]
|
[target.x86_64-unknown-freebsd.dependencies]
|
||||||
osmesa-sys = "0.0.5"
|
osmesa-sys = "0.0.5"
|
||||||
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
|
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
|
||||||
wayland-kbd = "0.3.3"
|
wayland-kbd = "0.3.3"
|
||||||
wayland-window = "0.2.2"
|
wayland-window = "0.2.2"
|
||||||
x11-dl = "~2.3"
|
x11-dl = "~2.4"
|
||||||
|
|
||||||
[target.x86_64-unknown-openbsd.dependencies]
|
[target.x86_64-unknown-openbsd.dependencies]
|
||||||
osmesa-sys = "0.0.5"
|
osmesa-sys = "0.0.5"
|
||||||
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
|
wayland-client = { version = "0.5.4", features = ["egl", "dlopen"] }
|
||||||
wayland-kbd = "0.3.3"
|
wayland-kbd = "0.3.3"
|
||||||
wayland-window = "0.2.2"
|
wayland-window = "0.2.2"
|
||||||
x11-dl = "~2.3"
|
x11-dl = "~2.4"
|
||||||
|
|
242
build.rs
242
build.rs
|
@ -1,6 +1,6 @@
|
||||||
extern crate gl_generator;
|
extern crate gl_generator;
|
||||||
extern crate khronos_api;
|
|
||||||
|
|
||||||
|
use gl_generator::{Registry, Api, Profile, Fallbacks};
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
@ -13,175 +13,135 @@ fn main() {
|
||||||
|
|
||||||
if target.contains("windows") {
|
if target.contains("windows") {
|
||||||
let mut file = File::create(&dest.join("wgl_bindings.rs")).unwrap();
|
let mut file = File::create(&dest.join("wgl_bindings.rs")).unwrap();
|
||||||
gl_generator::generate_bindings(gl_generator::StaticGenerator,
|
Registry::new(Api::Wgl, (1, 0), Profile::Core, Fallbacks::All, [])
|
||||||
gl_generator::registry::Ns::Wgl,
|
.write_bindings(gl_generator::StaticGenerator, &mut file)
|
||||||
gl_generator::Fallbacks::All,
|
.unwrap();
|
||||||
khronos_api::WGL_XML, vec![],
|
|
||||||
"1.0", "core", &mut file).unwrap();
|
|
||||||
|
|
||||||
let mut file = File::create(&dest.join("wgl_extra_bindings.rs")).unwrap();
|
let mut file = File::create(&dest.join("wgl_extra_bindings.rs")).unwrap();
|
||||||
gl_generator::generate_bindings(gl_generator::StructGenerator,
|
Registry::new(Api::Wgl, (1, 0), Profile::Core, Fallbacks::All, [
|
||||||
gl_generator::registry::Ns::Wgl,
|
"WGL_ARB_create_context",
|
||||||
gl_generator::Fallbacks::All,
|
"WGL_ARB_create_context_profile",
|
||||||
khronos_api::WGL_XML,
|
"WGL_ARB_create_context_robustness",
|
||||||
vec![
|
"WGL_ARB_context_flush_control",
|
||||||
"WGL_ARB_create_context".to_string(),
|
"WGL_ARB_extensions_string",
|
||||||
"WGL_ARB_create_context_profile".to_string(),
|
"WGL_ARB_framebuffer_sRGB",
|
||||||
"WGL_ARB_create_context_robustness".to_string(),
|
"WGL_ARB_multisample",
|
||||||
"WGL_ARB_context_flush_control".to_string(),
|
"WGL_ARB_pixel_format",
|
||||||
"WGL_ARB_extensions_string".to_string(),
|
"WGL_ARB_pixel_format_float",
|
||||||
"WGL_ARB_framebuffer_sRGB".to_string(),
|
"WGL_EXT_create_context_es2_profile",
|
||||||
"WGL_ARB_multisample".to_string(),
|
"WGL_EXT_extensions_string",
|
||||||
"WGL_ARB_pixel_format".to_string(),
|
"WGL_EXT_framebuffer_sRGB",
|
||||||
"WGL_ARB_pixel_format_float".to_string(),
|
"WGL_EXT_swap_control",
|
||||||
"WGL_EXT_create_context_es2_profile".to_string(),
|
])
|
||||||
"WGL_EXT_extensions_string".to_string(),
|
.write_bindings(gl_generator::StructGenerator, &mut file).unwrap();
|
||||||
"WGL_EXT_framebuffer_sRGB".to_string(),
|
|
||||||
"WGL_EXT_swap_control".to_string(),
|
|
||||||
],
|
|
||||||
"1.0", "core", &mut file).unwrap();
|
|
||||||
|
|
||||||
let mut file = File::create(&dest.join("egl_bindings.rs")).unwrap();
|
let mut file = File::create(&dest.join("egl_bindings.rs")).unwrap();
|
||||||
gl_generator::generate_bindings(gl_generator::StructGenerator,
|
Registry::new(Api::Egl, (1, 5), Profile::Core, Fallbacks::All, [
|
||||||
gl_generator::registry::Ns::Egl,
|
"EGL_KHR_create_context",
|
||||||
gl_generator::Fallbacks::All,
|
"EGL_EXT_create_context_robustness",
|
||||||
khronos_api::EGL_XML,
|
"EGL_KHR_create_context_no_error",
|
||||||
vec![
|
"EGL_KHR_platform_x11",
|
||||||
"EGL_KHR_create_context".to_string(),
|
"EGL_KHR_platform_android",
|
||||||
"EGL_EXT_create_context_robustness".to_string(),
|
"EGL_KHR_platform_wayland",
|
||||||
"EGL_KHR_create_context_no_error".to_string(),
|
"EGL_KHR_platform_gbm",
|
||||||
"EGL_KHR_platform_x11".to_string(),
|
"EGL_EXT_platform_base",
|
||||||
"EGL_KHR_platform_android".to_string(),
|
"EGL_EXT_platform_x11",
|
||||||
"EGL_KHR_platform_wayland".to_string(),
|
"EGL_MESA_platform_gbm",
|
||||||
"EGL_KHR_platform_gbm".to_string(),
|
"EGL_EXT_platform_wayland",
|
||||||
"EGL_EXT_platform_base".to_string(),
|
"EGL_EXT_platform_device",
|
||||||
"EGL_EXT_platform_x11".to_string(),
|
])
|
||||||
"EGL_MESA_platform_gbm".to_string(),
|
.write_bindings(gl_generator::StructGenerator, &mut file).unwrap();
|
||||||
"EGL_EXT_platform_wayland".to_string(),
|
|
||||||
"EGL_EXT_platform_device".to_string(),
|
|
||||||
],
|
|
||||||
"1.5", "core", &mut file).unwrap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if target.contains("linux") || target.contains("dragonfly") || target.contains("freebsd") || target.contains("openbsd") {
|
if target.contains("linux") || target.contains("dragonfly") || target.contains("freebsd") || target.contains("openbsd") {
|
||||||
let mut file = File::create(&dest.join("glx_bindings.rs")).unwrap();
|
let mut file = File::create(&dest.join("glx_bindings.rs")).unwrap();
|
||||||
gl_generator::generate_bindings(gl_generator::StructGenerator,
|
Registry::new(Api::Glx, (1, 4), Profile::Core, Fallbacks::All, [])
|
||||||
gl_generator::registry::Ns::Glx,
|
.write_bindings(gl_generator::StructGenerator, &mut file).unwrap();
|
||||||
gl_generator::Fallbacks::All,
|
|
||||||
khronos_api::GLX_XML, vec![],
|
|
||||||
"1.4", "core", &mut file).unwrap();
|
|
||||||
|
|
||||||
let mut file = File::create(&dest.join("glx_extra_bindings.rs")).unwrap();
|
let mut file = File::create(&dest.join("glx_extra_bindings.rs")).unwrap();
|
||||||
gl_generator::generate_bindings(gl_generator::StructGenerator,
|
Registry::new(Api::Glx, (1, 4), Profile::Core, Fallbacks::All, [
|
||||||
gl_generator::registry::Ns::Glx,
|
"GLX_ARB_create_context",
|
||||||
gl_generator::Fallbacks::All,
|
"GLX_ARB_create_context_profile",
|
||||||
khronos_api::GLX_XML,
|
"GLX_ARB_create_context_robustness",
|
||||||
vec![
|
"GLX_ARB_context_flush_control",
|
||||||
"GLX_ARB_create_context".to_string(),
|
"GLX_ARB_fbconfig_float",
|
||||||
"GLX_ARB_create_context_profile".to_string(),
|
"GLX_ARB_framebuffer_sRGB",
|
||||||
"GLX_ARB_create_context_robustness".to_string(),
|
"GLX_EXT_framebuffer_sRGB",
|
||||||
"GLX_ARB_context_flush_control".to_string(),
|
"GLX_ARB_multisample",
|
||||||
"GLX_ARB_fbconfig_float".to_string(),
|
"GLX_EXT_swap_control",
|
||||||
"GLX_ARB_framebuffer_sRGB".to_string(),
|
"GLX_SGI_swap_control"
|
||||||
"GLX_EXT_framebuffer_sRGB".to_string(),
|
])
|
||||||
"GLX_ARB_multisample".to_string(),
|
.write_bindings(gl_generator::StructGenerator, &mut file).unwrap();
|
||||||
"GLX_EXT_swap_control".to_string(),
|
|
||||||
"GLX_SGI_swap_control".to_string()
|
|
||||||
],
|
|
||||||
"1.4", "core", &mut file).unwrap();
|
|
||||||
|
|
||||||
let mut file = File::create(&dest.join("egl_bindings.rs")).unwrap();
|
let mut file = File::create(&dest.join("egl_bindings.rs")).unwrap();
|
||||||
gl_generator::generate_bindings(gl_generator::StructGenerator,
|
Registry::new(Api::Egl, (1, 5), Profile::Core, Fallbacks::All, [
|
||||||
gl_generator::registry::Ns::Egl,
|
"EGL_KHR_create_context",
|
||||||
gl_generator::Fallbacks::All,
|
"EGL_EXT_create_context_robustness",
|
||||||
khronos_api::EGL_XML,
|
"EGL_KHR_create_context_no_error",
|
||||||
vec![
|
"EGL_KHR_platform_x11",
|
||||||
"EGL_KHR_create_context".to_string(),
|
"EGL_KHR_platform_android",
|
||||||
"EGL_EXT_create_context_robustness".to_string(),
|
"EGL_KHR_platform_wayland",
|
||||||
"EGL_KHR_create_context_no_error".to_string(),
|
"EGL_KHR_platform_gbm",
|
||||||
"EGL_KHR_platform_x11".to_string(),
|
"EGL_EXT_platform_base",
|
||||||
"EGL_KHR_platform_android".to_string(),
|
"EGL_EXT_platform_x11",
|
||||||
"EGL_KHR_platform_wayland".to_string(),
|
"EGL_MESA_platform_gbm",
|
||||||
"EGL_KHR_platform_gbm".to_string(),
|
"EGL_EXT_platform_wayland",
|
||||||
"EGL_EXT_platform_base".to_string(),
|
"EGL_EXT_platform_device",
|
||||||
"EGL_EXT_platform_x11".to_string(),
|
])
|
||||||
"EGL_MESA_platform_gbm".to_string(),
|
.write_bindings(gl_generator::StructGenerator, &mut file).unwrap();
|
||||||
"EGL_EXT_platform_wayland".to_string(),
|
|
||||||
"EGL_EXT_platform_device".to_string(),
|
|
||||||
],
|
|
||||||
"1.5", "core", &mut file).unwrap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if target.contains("android") {
|
if target.contains("android") {
|
||||||
let mut file = File::create(&dest.join("egl_bindings.rs")).unwrap();
|
let mut file = File::create(&dest.join("egl_bindings.rs")).unwrap();
|
||||||
gl_generator::generate_bindings(gl_generator::StaticStructGenerator,
|
Registry::new(Api::Egl, (1, 5), Profile::Core, Fallbacks::All, [
|
||||||
gl_generator::registry::Ns::Egl,
|
"EGL_KHR_create_context",
|
||||||
gl_generator::Fallbacks::All,
|
"EGL_EXT_create_context_robustness",
|
||||||
khronos_api::EGL_XML,
|
"EGL_KHR_create_context_no_error",
|
||||||
vec![
|
"EGL_KHR_platform_x11",
|
||||||
"EGL_KHR_create_context".to_string(),
|
"EGL_KHR_platform_android",
|
||||||
"EGL_EXT_create_context_robustness".to_string(),
|
"EGL_KHR_platform_wayland",
|
||||||
"EGL_KHR_create_context_no_error".to_string(),
|
"EGL_KHR_platform_gbm",
|
||||||
"EGL_KHR_platform_x11".to_string(),
|
"EGL_EXT_platform_base",
|
||||||
"EGL_KHR_platform_android".to_string(),
|
"EGL_EXT_platform_x11",
|
||||||
"EGL_KHR_platform_wayland".to_string(),
|
"EGL_MESA_platform_gbm",
|
||||||
"EGL_KHR_platform_gbm".to_string(),
|
"EGL_EXT_platform_wayland",
|
||||||
"EGL_EXT_platform_base".to_string(),
|
"EGL_EXT_platform_device",
|
||||||
"EGL_EXT_platform_x11".to_string(),
|
])
|
||||||
"EGL_MESA_platform_gbm".to_string(),
|
.write_bindings(gl_generator::StaticStructGenerator, &mut file).unwrap();
|
||||||
"EGL_EXT_platform_wayland".to_string(),
|
|
||||||
"EGL_EXT_platform_device".to_string(),
|
|
||||||
],
|
|
||||||
"1.5", "core", &mut file).unwrap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if target.contains("ios") {
|
if target.contains("ios") {
|
||||||
let mut file = File::create(&dest.join("egl_bindings.rs")).unwrap();
|
let mut file = File::create(&dest.join("egl_bindings.rs")).unwrap();
|
||||||
gl_generator::generate_bindings(gl_generator::StaticStructGenerator,
|
Registry::new(Api::Egl, (1, 5), Profile::Core, Fallbacks::All, [
|
||||||
gl_generator::registry::Ns::Egl,
|
"EGL_KHR_create_context",
|
||||||
gl_generator::Fallbacks::All,
|
"EGL_EXT_create_context_robustness",
|
||||||
khronos_api::EGL_XML,
|
"EGL_KHR_create_context_no_error",
|
||||||
vec![
|
"EGL_KHR_platform_x11",
|
||||||
"EGL_KHR_create_context".to_string(),
|
"EGL_KHR_platform_android",
|
||||||
"EGL_EXT_create_context_robustness".to_string(),
|
"EGL_KHR_platform_wayland",
|
||||||
"EGL_KHR_create_context_no_error".to_string(),
|
"EGL_KHR_platform_gbm",
|
||||||
"EGL_KHR_platform_x11".to_string(),
|
"EGL_EXT_platform_base",
|
||||||
"EGL_KHR_platform_android".to_string(),
|
"EGL_EXT_platform_x11",
|
||||||
"EGL_KHR_platform_wayland".to_string(),
|
"EGL_MESA_platform_gbm",
|
||||||
"EGL_KHR_platform_gbm".to_string(),
|
"EGL_EXT_platform_wayland",
|
||||||
"EGL_EXT_platform_base".to_string(),
|
"EGL_EXT_platform_device",
|
||||||
"EGL_EXT_platform_x11".to_string(),
|
])
|
||||||
"EGL_MESA_platform_gbm".to_string(),
|
.write_bindings(gl_generator::StaticStructGenerator, &mut file).unwrap();
|
||||||
"EGL_EXT_platform_wayland".to_string(),
|
|
||||||
"EGL_EXT_platform_device".to_string(),
|
|
||||||
],
|
|
||||||
"1.5", "core", &mut file).unwrap();
|
|
||||||
|
|
||||||
let mut file = File::create(&dest.join("gles2_bindings.rs")).unwrap();
|
let mut file = File::create(&dest.join("gles2_bindings.rs")).unwrap();
|
||||||
gl_generator::generate_bindings(gl_generator::StaticStructGenerator,
|
Registry::new(Api::Gles2, (2, 0), Profile::Core, Fallbacks::None, [])
|
||||||
gl_generator::registry::Ns::Gles2,
|
.write_bindings(gl_generator::StaticStructGenerator, &mut file).unwrap();
|
||||||
gl_generator::Fallbacks::None,
|
|
||||||
khronos_api::GL_XML,
|
|
||||||
vec![],
|
|
||||||
"2.0", "core", &mut file).unwrap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if target.contains("darwin") {
|
if target.contains("darwin") {
|
||||||
let mut file = File::create(&dest.join("gl_bindings.rs")).unwrap();
|
let mut file = File::create(&dest.join("gl_bindings.rs")).unwrap();
|
||||||
gl_generator::generate_bindings(gl_generator::GlobalGenerator,
|
Registry::new(Api::Gl, (3, 2), Profile::Core, Fallbacks::All, ["GL_EXT_framebuffer_object"])
|
||||||
gl_generator::registry::Ns::Gl,
|
.write_bindings(gl_generator::GlobalGenerator, &mut file).unwrap();
|
||||||
gl_generator::Fallbacks::All,
|
|
||||||
khronos_api::GL_XML,
|
|
||||||
vec!["GL_EXT_framebuffer_object".to_string()],
|
|
||||||
"3.2", "core", &mut file).unwrap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: only build the bindings below if we run tests/examples
|
// TODO: only build the bindings below if we run tests/examples
|
||||||
|
|
||||||
let mut file = File::create(&dest.join("test_gl_bindings.rs")).unwrap();
|
let mut file = File::create(&dest.join("test_gl_bindings.rs")).unwrap();
|
||||||
gl_generator::generate_bindings(gl_generator::StructGenerator,
|
Registry::new(Api::Gles2, (3, 0), Profile::Core, Fallbacks::All, [])
|
||||||
gl_generator::registry::Ns::Gles2,
|
.write_bindings(gl_generator::StructGenerator, &mut file).unwrap();
|
||||||
gl_generator::Fallbacks::All,
|
|
||||||
khronos_api::GL_XML, vec![],
|
|
||||||
"3.0", "core", &mut file).unwrap();
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,11 +79,12 @@ struct WindowDelegate {
|
||||||
impl WindowDelegate {
|
impl WindowDelegate {
|
||||||
/// Get the delegate class, initiailizing it neccessary
|
/// Get the delegate class, initiailizing it neccessary
|
||||||
fn class() -> *const Class {
|
fn class() -> *const Class {
|
||||||
|
use std::os::raw::c_void;
|
||||||
use std::sync::{Once, ONCE_INIT};
|
use std::sync::{Once, ONCE_INIT};
|
||||||
|
|
||||||
extern fn window_should_close(this: &Object, _: Sel, _: id) -> BOOL {
|
extern fn window_should_close(this: &Object, _: Sel, _: id) -> BOOL {
|
||||||
unsafe {
|
unsafe {
|
||||||
let state: *mut libc::c_void = *this.get_ivar("glutinState");
|
let state: *mut c_void = *this.get_ivar("glutinState");
|
||||||
let state = state as *mut DelegateState;
|
let state = state as *mut DelegateState;
|
||||||
(*state).pending_events.lock().unwrap().push_back(Closed);
|
(*state).pending_events.lock().unwrap().push_back(Closed);
|
||||||
}
|
}
|
||||||
|
@ -92,7 +93,7 @@ impl WindowDelegate {
|
||||||
|
|
||||||
extern fn window_did_resize(this: &Object, _: Sel, _: id) {
|
extern fn window_did_resize(this: &Object, _: Sel, _: id) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let state: *mut libc::c_void = *this.get_ivar("glutinState");
|
let state: *mut c_void = *this.get_ivar("glutinState");
|
||||||
let state = &mut *(state as *mut DelegateState);
|
let state = &mut *(state as *mut DelegateState);
|
||||||
|
|
||||||
let _: () = msg_send![*state.context, update];
|
let _: () = msg_send![*state.context, update];
|
||||||
|
@ -111,7 +112,7 @@ impl WindowDelegate {
|
||||||
// TODO: center the cursor if the window had mouse grab when it
|
// TODO: center the cursor if the window had mouse grab when it
|
||||||
// lost focus
|
// lost focus
|
||||||
|
|
||||||
let state: *mut libc::c_void = *this.get_ivar("glutinState");
|
let state: *mut c_void = *this.get_ivar("glutinState");
|
||||||
let state = state as *mut DelegateState;
|
let state = state as *mut DelegateState;
|
||||||
(*state).pending_events.lock().unwrap().push_back(Focused(true));
|
(*state).pending_events.lock().unwrap().push_back(Focused(true));
|
||||||
}
|
}
|
||||||
|
@ -119,7 +120,7 @@ impl WindowDelegate {
|
||||||
|
|
||||||
extern fn window_did_resign_key(this: &Object, _: Sel, _: id) {
|
extern fn window_did_resign_key(this: &Object, _: Sel, _: id) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let state: *mut libc::c_void = *this.get_ivar("glutinState");
|
let state: *mut c_void = *this.get_ivar("glutinState");
|
||||||
let state = state as *mut DelegateState;
|
let state = state as *mut DelegateState;
|
||||||
(*state).pending_events.lock().unwrap().push_back(Focused(false));
|
(*state).pending_events.lock().unwrap().push_back(Focused(false));
|
||||||
}
|
}
|
||||||
|
@ -131,7 +132,7 @@ impl WindowDelegate {
|
||||||
INIT.call_once(|| unsafe {
|
INIT.call_once(|| unsafe {
|
||||||
// Create new NSWindowDelegate
|
// Create new NSWindowDelegate
|
||||||
let superclass = Class::get("NSObject").unwrap();
|
let superclass = Class::get("NSObject").unwrap();
|
||||||
let mut decl = ClassDecl::new(superclass, "GlutinWindowDelegate").unwrap();
|
let mut decl = ClassDecl::new("GlutinWindowDelegate", superclass).unwrap();
|
||||||
|
|
||||||
// Add callback methods
|
// Add callback methods
|
||||||
decl.add_method(sel!(windowShouldClose:),
|
decl.add_method(sel!(windowShouldClose:),
|
||||||
|
@ -145,7 +146,7 @@ impl WindowDelegate {
|
||||||
window_did_resign_key as extern fn(&Object, Sel, id));
|
window_did_resign_key as extern fn(&Object, Sel, id));
|
||||||
|
|
||||||
// Store internal state as user data
|
// Store internal state as user data
|
||||||
decl.add_ivar::<*mut libc::c_void>("glutinState");
|
decl.add_ivar::<*mut c_void>("glutinState");
|
||||||
|
|
||||||
delegate_class = decl.register();
|
delegate_class = decl.register();
|
||||||
});
|
});
|
||||||
|
@ -162,7 +163,7 @@ impl WindowDelegate {
|
||||||
unsafe {
|
unsafe {
|
||||||
let delegate = IdRef::new(msg_send![WindowDelegate::class(), new]);
|
let delegate = IdRef::new(msg_send![WindowDelegate::class(), new]);
|
||||||
|
|
||||||
(&mut **delegate).set_ivar("glutinState", state_ptr as *mut libc::c_void);
|
(&mut **delegate).set_ivar("glutinState", state_ptr as *mut ::std::os::raw::c_void);
|
||||||
let _: () = msg_send![*state.window, setDelegate:*delegate];
|
let _: () = msg_send![*state.window, setDelegate:*delegate];
|
||||||
|
|
||||||
WindowDelegate { state: state, _this: delegate }
|
WindowDelegate { state: state, _this: delegate }
|
||||||
|
@ -224,12 +225,16 @@ impl<'a> Iterator for PollEventsIterator<'a> {
|
||||||
|
|
||||||
let event: Option<Event>;
|
let event: Option<Event>;
|
||||||
unsafe {
|
unsafe {
|
||||||
|
let pool = NSAutoreleasePool::new(nil);
|
||||||
|
|
||||||
let nsevent = NSApp().nextEventMatchingMask_untilDate_inMode_dequeue_(
|
let nsevent = NSApp().nextEventMatchingMask_untilDate_inMode_dequeue_(
|
||||||
NSAnyEventMask.bits() | NSEventMaskPressure.bits(),
|
NSAnyEventMask.bits() | NSEventMaskPressure.bits(),
|
||||||
NSDate::distantPast(nil),
|
NSDate::distantPast(nil),
|
||||||
NSDefaultRunLoopMode,
|
NSDefaultRunLoopMode,
|
||||||
YES);
|
YES);
|
||||||
event = NSEventToEvent(self.window, nsevent);
|
event = NSEventToEvent(self.window, nsevent);
|
||||||
|
|
||||||
|
let _: () = msg_send![pool, release];
|
||||||
}
|
}
|
||||||
event
|
event
|
||||||
}
|
}
|
||||||
|
@ -249,12 +254,16 @@ impl<'a> Iterator for WaitEventsIterator<'a> {
|
||||||
|
|
||||||
let event: Option<Event>;
|
let event: Option<Event>;
|
||||||
unsafe {
|
unsafe {
|
||||||
|
let pool = NSAutoreleasePool::new(nil);
|
||||||
|
|
||||||
let nsevent = NSApp().nextEventMatchingMask_untilDate_inMode_dequeue_(
|
let nsevent = NSApp().nextEventMatchingMask_untilDate_inMode_dequeue_(
|
||||||
NSAnyEventMask.bits() | NSEventMaskPressure.bits(),
|
NSAnyEventMask.bits() | NSEventMaskPressure.bits(),
|
||||||
NSDate::distantFuture(nil),
|
NSDate::distantFuture(nil),
|
||||||
NSDefaultRunLoopMode,
|
NSDefaultRunLoopMode,
|
||||||
YES);
|
YES);
|
||||||
event = NSEventToEvent(self.window, nsevent);
|
event = NSEventToEvent(self.window, nsevent);
|
||||||
|
|
||||||
|
let _: () = msg_send![pool, release];
|
||||||
}
|
}
|
||||||
|
|
||||||
if event.is_none() {
|
if event.is_none() {
|
||||||
|
@ -404,7 +413,9 @@ impl Window {
|
||||||
|
|
||||||
let masks = if screen.is_some() || attrs.transparent {
|
let masks = if screen.is_some() || attrs.transparent {
|
||||||
// Fullscreen or transparent window
|
// Fullscreen or transparent window
|
||||||
NSBorderlessWindowMask as NSUInteger
|
NSBorderlessWindowMask as NSUInteger |
|
||||||
|
NSResizableWindowMask as NSUInteger |
|
||||||
|
NSTitledWindowMask as NSUInteger
|
||||||
} else if attrs.decorations {
|
} else if attrs.decorations {
|
||||||
// Classic opaque window with titlebar
|
// Classic opaque window with titlebar
|
||||||
NSClosableWindowMask as NSUInteger |
|
NSClosableWindowMask as NSUInteger |
|
||||||
|
@ -663,8 +674,8 @@ impl Window {
|
||||||
let sel = Sel::register(cursor_name);
|
let sel = Sel::register(cursor_name);
|
||||||
let cls = Class::get("NSCursor").unwrap();
|
let cls = Class::get("NSCursor").unwrap();
|
||||||
unsafe {
|
unsafe {
|
||||||
use objc::MessageArguments;
|
use objc::Message;
|
||||||
let cursor: id = ().send(cls as *const _ as id, sel);
|
let cursor: id = cls.send_message(sel, ()).unwrap();
|
||||||
let _: () = msg_send![cursor, set];
|
let _: () = msg_send![cursor, set];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -747,7 +758,11 @@ impl GlContext for Window {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn swap_buffers(&self) -> Result<(), ContextError> {
|
fn swap_buffers(&self) -> Result<(), ContextError> {
|
||||||
unsafe { self.context.flushBuffer(); }
|
unsafe {
|
||||||
|
let pool = NSAutoreleasePool::new(nil);
|
||||||
|
self.context.flushBuffer();
|
||||||
|
let _: () = msg_send![pool, release];
|
||||||
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ pub fn vkeycode_to_element(wparam: winapi::WPARAM, lparam: winapi::LPARAM) -> (S
|
||||||
winapi::VK_KANJI => Some(VirtualKeyCode::Kanji),
|
winapi::VK_KANJI => Some(VirtualKeyCode::Kanji),
|
||||||
winapi::VK_ESCAPE => Some(VirtualKeyCode::Escape),
|
winapi::VK_ESCAPE => Some(VirtualKeyCode::Escape),
|
||||||
winapi::VK_CONVERT => Some(VirtualKeyCode::Convert),
|
winapi::VK_CONVERT => Some(VirtualKeyCode::Convert),
|
||||||
//winapi::VK_NONCONVERT => Some(VirtualKeyCode::Nonconvert),
|
winapi::VK_NONCONVERT => Some(VirtualKeyCode::NoConvert),
|
||||||
//winapi::VK_ACCEPT => Some(VirtualKeyCode::Accept),
|
//winapi::VK_ACCEPT => Some(VirtualKeyCode::Accept),
|
||||||
//winapi::VK_MODECHANGE => Some(VirtualKeyCode::Modechange),
|
//winapi::VK_MODECHANGE => Some(VirtualKeyCode::Modechange),
|
||||||
winapi::VK_SPACE => Some(VirtualKeyCode::Space),
|
winapi::VK_SPACE => Some(VirtualKeyCode::Space),
|
||||||
|
@ -143,44 +143,38 @@ pub fn vkeycode_to_element(wparam: winapi::WPARAM, lparam: winapi::LPARAM) -> (S
|
||||||
winapi::VK_F24 => Some(VirtualKeyCode::F24),*/
|
winapi::VK_F24 => Some(VirtualKeyCode::F24),*/
|
||||||
winapi::VK_NUMLOCK => Some(VirtualKeyCode::Numlock),
|
winapi::VK_NUMLOCK => Some(VirtualKeyCode::Numlock),
|
||||||
winapi::VK_SCROLL => Some(VirtualKeyCode::Scroll),
|
winapi::VK_SCROLL => Some(VirtualKeyCode::Scroll),
|
||||||
/*winapi::VK_LSHIFT => Some(VirtualKeyCode::Lshift),
|
winapi::VK_BROWSER_BACK => Some(VirtualKeyCode::NavigateBackward),
|
||||||
winapi::VK_RSHIFT => Some(VirtualKeyCode::Rshift),
|
winapi::VK_BROWSER_FORWARD => Some(VirtualKeyCode::NavigateForward),
|
||||||
winapi::VK_LCONTROL => Some(VirtualKeyCode::Lcontrol),
|
winapi::VK_BROWSER_REFRESH => Some(VirtualKeyCode::WebRefresh),
|
||||||
winapi::VK_RCONTROL => Some(VirtualKeyCode::Rcontrol),
|
winapi::VK_BROWSER_STOP => Some(VirtualKeyCode::WebStop),
|
||||||
winapi::VK_LMENU => Some(VirtualKeyCode::Lmenu),
|
winapi::VK_BROWSER_SEARCH => Some(VirtualKeyCode::WebSearch),
|
||||||
winapi::VK_RMENU => Some(VirtualKeyCode::Rmenu),
|
winapi::VK_BROWSER_FAVORITES => Some(VirtualKeyCode::WebFavorites),
|
||||||
winapi::VK_BROWSER_BACK => Some(VirtualKeyCode::Browser_back),
|
winapi::VK_BROWSER_HOME => Some(VirtualKeyCode::WebHome),
|
||||||
winapi::VK_BROWSER_FORWARD => Some(VirtualKeyCode::Browser_forward),
|
winapi::VK_VOLUME_MUTE => Some(VirtualKeyCode::Mute),
|
||||||
winapi::VK_BROWSER_REFRESH => Some(VirtualKeyCode::Browser_refresh),
|
winapi::VK_VOLUME_DOWN => Some(VirtualKeyCode::VolumeDown),
|
||||||
winapi::VK_BROWSER_STOP => Some(VirtualKeyCode::Browser_stop),
|
winapi::VK_VOLUME_UP => Some(VirtualKeyCode::VolumeUp),
|
||||||
winapi::VK_BROWSER_SEARCH => Some(VirtualKeyCode::Browser_search),
|
winapi::VK_MEDIA_NEXT_TRACK => Some(VirtualKeyCode::NextTrack),
|
||||||
winapi::VK_BROWSER_FAVORITES => Some(VirtualKeyCode::Browser_favorites),
|
winapi::VK_MEDIA_PREV_TRACK => Some(VirtualKeyCode::PrevTrack),
|
||||||
winapi::VK_BROWSER_HOME => Some(VirtualKeyCode::Browser_home),
|
winapi::VK_MEDIA_STOP => Some(VirtualKeyCode::MediaStop),
|
||||||
winapi::VK_VOLUME_MUTE => Some(VirtualKeyCode::Volume_mute),
|
winapi::VK_MEDIA_PLAY_PAUSE => Some(VirtualKeyCode::PlayPause),
|
||||||
winapi::VK_VOLUME_DOWN => Some(VirtualKeyCode::Volume_down),
|
winapi::VK_LAUNCH_MAIL => Some(VirtualKeyCode::Mail),
|
||||||
winapi::VK_VOLUME_UP => Some(VirtualKeyCode::Volume_up),
|
winapi::VK_LAUNCH_MEDIA_SELECT => Some(VirtualKeyCode::MediaSelect),
|
||||||
winapi::VK_MEDIA_NEXT_TRACK => Some(VirtualKeyCode::Media_next_track),
|
/*winapi::VK_LAUNCH_APP1 => Some(VirtualKeyCode::Launch_app1),
|
||||||
winapi::VK_MEDIA_PREV_TRACK => Some(VirtualKeyCode::Media_prev_track),
|
winapi::VK_LAUNCH_APP2 => Some(VirtualKeyCode::Launch_app2),*/
|
||||||
winapi::VK_MEDIA_STOP => Some(VirtualKeyCode::Media_stop),
|
winapi::VK_OEM_PLUS => Some(VirtualKeyCode::Equals),
|
||||||
winapi::VK_MEDIA_PLAY_PAUSE => Some(VirtualKeyCode::Media_play_pause),
|
winapi::VK_OEM_COMMA => Some(VirtualKeyCode::Comma),
|
||||||
winapi::VK_LAUNCH_MAIL => Some(VirtualKeyCode::Launch_mail),
|
winapi::VK_OEM_MINUS => Some(VirtualKeyCode::Minus),
|
||||||
winapi::VK_LAUNCH_MEDIA_SELECT => Some(VirtualKeyCode::Launch_media_select),
|
winapi::VK_OEM_PERIOD => Some(VirtualKeyCode::Period),
|
||||||
winapi::VK_LAUNCH_APP1 => Some(VirtualKeyCode::Launch_app1),
|
/*winapi::VK_OEM_1 => Some(VirtualKeyCode::Oem_1),
|
||||||
winapi::VK_LAUNCH_APP2 => Some(VirtualKeyCode::Launch_app2),
|
|
||||||
winapi::VK_OEM_1 => Some(VirtualKeyCode::Oem_1),
|
|
||||||
winapi::VK_OEM_PLUS => Some(VirtualKeyCode::Oem_plus),
|
|
||||||
winapi::VK_OEM_COMMA => Some(VirtualKeyCode::Oem_comma),
|
|
||||||
winapi::VK_OEM_MINUS => Some(VirtualKeyCode::Oem_minus),
|
|
||||||
winapi::VK_OEM_PERIOD => Some(VirtualKeyCode::Oem_period),
|
|
||||||
winapi::VK_OEM_2 => Some(VirtualKeyCode::Oem_2),
|
winapi::VK_OEM_2 => Some(VirtualKeyCode::Oem_2),
|
||||||
winapi::VK_OEM_3 => Some(VirtualKeyCode::Oem_3),
|
winapi::VK_OEM_3 => Some(VirtualKeyCode::Oem_3),
|
||||||
winapi::VK_OEM_4 => Some(VirtualKeyCode::Oem_4),
|
winapi::VK_OEM_4 => Some(VirtualKeyCode::Oem_4),
|
||||||
winapi::VK_OEM_5 => Some(VirtualKeyCode::Oem_5),
|
winapi::VK_OEM_5 => Some(VirtualKeyCode::Oem_5),
|
||||||
winapi::VK_OEM_6 => Some(VirtualKeyCode::Oem_6),
|
winapi::VK_OEM_6 => Some(VirtualKeyCode::Oem_6),
|
||||||
winapi::VK_OEM_7 => Some(VirtualKeyCode::Oem_7),
|
winapi::VK_OEM_7 => Some(VirtualKeyCode::Oem_7),
|
||||||
winapi::VK_OEM_8 => Some(VirtualKeyCode::Oem_8),
|
winapi::VK_OEM_8 => Some(VirtualKeyCode::Oem_8), */
|
||||||
winapi::VK_OEM_102 => Some(VirtualKeyCode::Oem_102),
|
winapi::VK_OEM_102 => Some(VirtualKeyCode::OEM102),
|
||||||
winapi::VK_PROCESSKEY => Some(VirtualKeyCode::Processkey),
|
/*winapi::VK_PROCESSKEY => Some(VirtualKeyCode::Processkey),
|
||||||
winapi::VK_PACKET => Some(VirtualKeyCode::Packet),
|
winapi::VK_PACKET => Some(VirtualKeyCode::Packet),
|
||||||
winapi::VK_ATTN => Some(VirtualKeyCode::Attn),
|
winapi::VK_ATTN => Some(VirtualKeyCode::Attn),
|
||||||
winapi::VK_CRSEL => Some(VirtualKeyCode::Crsel),
|
winapi::VK_CRSEL => Some(VirtualKeyCode::Crsel),
|
||||||
|
|
|
@ -997,6 +997,8 @@ pub fn keycode_to_element(scancode: libc::c_uint) -> Option<VirtualKeyCode> {
|
||||||
//ffi::XK_hebrew_taw => events::VirtualKeyCode::Hebrew_taw,
|
//ffi::XK_hebrew_taw => events::VirtualKeyCode::Hebrew_taw,
|
||||||
//ffi::XK_hebrew_taf => events::VirtualKeyCode::Hebrew_taf,
|
//ffi::XK_hebrew_taf => events::VirtualKeyCode::Hebrew_taf,
|
||||||
//ffi::XK_Hebrew_switch => events::VirtualKeyCode::Hebrew_switch,
|
//ffi::XK_Hebrew_switch => events::VirtualKeyCode::Hebrew_switch,
|
||||||
|
ffi::XF86XK_Back => VirtualKeyCode::NavigateBackward,
|
||||||
|
ffi::XF86XK_Forward => VirtualKeyCode::NavigateForward,
|
||||||
_ => return None
|
_ => return None
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -867,29 +867,61 @@ impl Window {
|
||||||
self.x.display.check_errors().expect("Failed to call XcursorLibraryLoadCursor");
|
self.x.display.check_errors().expect("Failed to call XcursorLibraryLoadCursor");
|
||||||
(self.x.display.xlib.XDefineCursor)(self.x.display.display, self.x.window, xcursor);
|
(self.x.display.xlib.XDefineCursor)(self.x.display.display, self.x.window, xcursor);
|
||||||
(self.x.display.xlib.XFlush)(self.x.display.display);
|
(self.x.display.xlib.XFlush)(self.x.display.display);
|
||||||
|
(self.x.display.xlib.XFreeCursor)(self.x.display.display, xcursor);
|
||||||
self.x.display.check_errors().expect("Failed to call XDefineCursor");
|
self.x.display.check_errors().expect("Failed to call XDefineCursor");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_cursor_state(&self, state: CursorState) -> Result<(), String> {
|
pub fn set_cursor_state(&self, state: CursorState) -> Result<(), String> {
|
||||||
use CursorState::{ Grab, Normal };
|
use CursorState::{ Grab, Normal, Hide };
|
||||||
|
|
||||||
let mut cursor_state = self.cursor_state.lock().unwrap();
|
let mut cursor_state = self.cursor_state.lock().unwrap();
|
||||||
|
|
||||||
match (state, *cursor_state) {
|
match (state, *cursor_state) {
|
||||||
(Normal, Grab) => {
|
(Normal, Normal) | (Hide, Hide) | (Grab, Grab) => return Ok(()),
|
||||||
|
_ => {},
|
||||||
|
}
|
||||||
|
|
||||||
|
match *cursor_state {
|
||||||
|
Grab => {
|
||||||
unsafe {
|
unsafe {
|
||||||
(self.x.display.xlib.XUngrabPointer)(self.x.display.display, ffi::CurrentTime);
|
(self.x.display.xlib.XUngrabPointer)(self.x.display.display, ffi::CurrentTime);
|
||||||
self.x.display.check_errors().expect("Failed to call XUngrabPointer");
|
self.x.display.check_errors().expect("Failed to call XUngrabPointer");
|
||||||
*cursor_state = Normal;
|
|
||||||
Ok(())
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Normal => {},
|
||||||
(Grab, Normal) => {
|
Hide => {
|
||||||
unsafe {
|
unsafe {
|
||||||
*cursor_state = Grab;
|
let xcursor = (self.x.display.xlib.XCreateFontCursor)(self.x.display.display, 68/*XC_left_ptr*/);
|
||||||
|
self.x.display.check_errors().expect("Failed to call XCreateFontCursor");
|
||||||
|
(self.x.display.xlib.XDefineCursor)(self.x.display.display, self.x.window, xcursor);
|
||||||
|
self.x.display.check_errors().expect("Failed to call XDefineCursor");
|
||||||
|
(self.x.display.xlib.XFlush)(self.x.display.display);
|
||||||
|
(self.x.display.xlib.XFreeCursor)(self.x.display.display, xcursor);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
*cursor_state = state;
|
||||||
|
match state {
|
||||||
|
Normal => Ok(()),
|
||||||
|
Hide => {
|
||||||
|
let data = &[0, 0, 0, 0, 0, 0, 0, 0];
|
||||||
|
unsafe {
|
||||||
|
let mut black = ffi::XColor {
|
||||||
|
red: 0, green: 0, blue: 0,
|
||||||
|
pad: 0, pixel: 0, flags: 0,
|
||||||
|
};
|
||||||
|
let bitmap = (self.x.display.xlib.XCreateBitmapFromData)(self.x.display.display, self.x.window, data.as_ptr(), 8, 8);
|
||||||
|
let cursor = (self.x.display.xlib.XCreatePixmapCursor)(self.x.display.display, bitmap, bitmap, &mut black, &mut black, 0, 0);
|
||||||
|
(self.x.display.xlib.XDefineCursor)(self.x.display.display, self.x.window, cursor);
|
||||||
|
self.x.display.check_errors().expect("Failed to call XDefineCursor");
|
||||||
|
(self.x.display.xlib.XFreeCursor)(self.x.display.display, cursor);
|
||||||
|
(self.x.display.xlib.XFreePixmap)(self.x.display.display, bitmap);
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
},
|
||||||
|
Grab => {
|
||||||
|
unsafe {
|
||||||
match (self.x.display.xlib.XGrabPointer)(
|
match (self.x.display.xlib.XGrabPointer)(
|
||||||
self.x.display.display, self.x.window, ffi::False,
|
self.x.display.display, self.x.window, ffi::False,
|
||||||
(ffi::ButtonPressMask | ffi::ButtonReleaseMask | ffi::EnterWindowMask |
|
(ffi::ButtonPressMask | ffi::ButtonReleaseMask | ffi::EnterWindowMask |
|
||||||
|
@ -908,11 +940,6 @@ impl Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// Nothing needs to change
|
|
||||||
(Grab, Grab) | (Normal, Normal) => Ok(()),
|
|
||||||
|
|
||||||
_ => unimplemented!(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -264,6 +264,8 @@ pub enum VirtualKeyCode {
|
||||||
Multiply,
|
Multiply,
|
||||||
Mute,
|
Mute,
|
||||||
MyComputer,
|
MyComputer,
|
||||||
|
NavigateForward, // also called "Prior"
|
||||||
|
NavigateBackward, // also called "Next"
|
||||||
NextTrack,
|
NextTrack,
|
||||||
NoConvert,
|
NoConvert,
|
||||||
NumpadComma,
|
NumpadComma,
|
||||||
|
|
Loading…
Reference in a new issue