Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(linux): Use c_ulong for ffi calls instead of u64 #106

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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