Skip to content

Commit

Permalink
fix(linux): Use c_ulong for ffi calls instead of u64 (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianLars authored Sep 11, 2024
1 parent c9913a9 commit 2c7397b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-linux-32bit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
global-hotkey: patch
---

Fixed an issue causing compilation to fail for 32-bit targets.
8 changes: 4 additions & 4 deletions src/platform_impl/x11/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

use std::{collections::BTreeMap, ptr};
use std::{collections::BTreeMap, ffi::c_ulong, ptr};

use crossbeam_channel::{unbounded, Receiver, Sender};
use keyboard_types::{Code, Modifiers};
Expand Down Expand Up @@ -105,7 +105,7 @@ const IGNORED_MODS: [u32; 4] = [
fn register_hotkey(
xlib: &Xlib,
display: *mut _XDisplay,
root: u64,
root: c_ulong,
hotkeys: &mut BTreeMap<u32, Vec<(u32, u32, bool)>>,
hotkey: HotKey,
) -> crate::Result<()> {
Expand Down Expand Up @@ -159,7 +159,7 @@ fn register_hotkey(
fn unregister_hotkey(
xlib: &Xlib,
display: *mut _XDisplay,
root: u64,
root: c_ulong,
hotkeys: &mut BTreeMap<u32, Vec<(u32, u32, bool)>>,
hotkey: HotKey,
) -> crate::Result<()> {
Expand Down Expand Up @@ -189,7 +189,7 @@ fn events_processor(thread_rx: Receiver<ThreadMessage>) {
if let Ok(xlib) = xlib::Xlib::open() {
unsafe {
let display = (xlib.XOpenDisplay)(ptr::null());
let root = (xlib.XDefaultRootWindow)(display);
let root: c_ulong = (xlib.XDefaultRootWindow)(display);

// Only trigger key release at end of repeated keys
let mut supported_rtrn: i32 = 0;
Expand Down

0 comments on commit 2c7397b

Please sign in to comment.