Skip to content

Commit

Permalink
winit 0.30
Browse files Browse the repository at this point in the history
  • Loading branch information
d-e-s-o committed Oct 4, 2024
1 parent cb826aa commit 033d54e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,6 @@ glutin = {version = "0.31", default-features = false, features = ["glx", "x11"]}
image = {version = "0.24", default-features = false, features = ["png"]}
raw-window-handle = {version = "0.5.2", default-features = false}
serde = {version = "1.0.182", default-features = false, features = ["derive", "std"]}
winit = {version = "0.29.2", default-features = false, features = ["rwh_05", "x11"]}
winit = {version = "0.30", default-features = false, features = ["rwh_05", "x11"]}
x11-dl = {version = "2.21.0", default-features = false}
toml = {version = "0.7.6", default-features = false, features = ["display", "parse"]}
17 changes: 8 additions & 9 deletions src/opengl/window.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2023 Daniel Mueller <deso@posteo.net>
// Copyright (C) 2023-2024 Daniel Mueller <deso@posteo.net>
// SPDX-License-Identifier: GPL-3.0-or-later

use std::num::NonZeroU32;
Expand Down Expand Up @@ -31,9 +31,8 @@ use raw_window_handle::XlibWindowHandle;

use winit::event_loop::EventLoop;
use winit::platform::x11::register_xlib_error_hook;
use winit::platform::x11::WindowBuilderExtX11 as _;
use winit::platform::x11::WindowAttributesExtX11 as _;
use winit::window::Window as WinitWindow;
use winit::window::WindowBuilder;


fn window_size(window: &WinitWindow) -> (NonZeroU32, NonZeroU32) {
Expand Down Expand Up @@ -112,14 +111,14 @@ impl Window {
let visual = window_handle
.map(|handle| handle.visual_id)
.or_else(|| config.x11_visual().map(|visual| visual.visual_id()));
let window = WindowBuilder::new().with_transparent(false);
let window = if let Some(x11_visual) = visual {
window.with_x11_visual(x11_visual as _)
let attributes = WinitWindow::default_attributes().with_transparent(false);
let attributes = if let Some(x11_visual) = visual {
attributes.with_x11_visual(x11_visual as _)
} else {
window
attributes
};
let window = window
.build(event_loop)
let window = event_loop
.create_window(attributes)
.context("failed to build window object")?;

let raw_window_handle = window_handle
Expand Down
2 changes: 1 addition & 1 deletion xlock/mode/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ crate-type = ["cdylib"]
xlock = {package = "tetromino-xlock-bindings", path = "../bindings"}
tetromino = {path = "../.."}
raw-window-handle = {version = "0.5.2", default-features = false}
winit = {version = "0.29.2", default-features = false, features = ["x11"]}
winit = {version = "0.30", default-features = false, features = ["x11"]}
8 changes: 2 additions & 6 deletions xlock/mode/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2023 Daniel Mueller <deso@posteo.net>
// Copyright (C) 2023-2024 Daniel Mueller <deso@posteo.net>
// SPDX-License-Identifier: GPL-3.0-or-later

#![allow(clippy::let_unit_value)]
Expand All @@ -14,7 +14,6 @@ use raw_window_handle::XlibDisplayHandle;
use raw_window_handle::XlibWindowHandle;

use winit::event_loop::EventLoop;
use winit::event_loop::EventLoopBuilder;
use winit::platform::x11::EventLoopBuilderExtX11 as _;

use tetromino_impl::Change;
Expand Down Expand Up @@ -75,10 +74,7 @@ extern "C" fn init_tetromino(mode_info: *const xlock::ModeInfo) {
let lock_struct = unsafe { &mut *mode_info.lockstruct };

if lock_struct.userdata.is_null() {
let event_loop = EventLoopBuilder::new()
.with_any_thread(true)
.build()
.unwrap();
let event_loop = EventLoop::builder().with_any_thread(true).build().unwrap();

let state = State {
event_loop,
Expand Down

0 comments on commit 033d54e

Please sign in to comment.