-
Notifications
You must be signed in to change notification settings - Fork 568
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* x11 shell keyboard mapping * allow deref_nullptr in tests * [CI] install libxkbcommon for Docs * More keys for x11 * More keys for gtk * cache looked up mods names and avoid as *mut i8 * Apply suggestions from code review * Move keycodes to a separate file * allow non_upper_case_globals in keycodes.rs * using cfg(target_os) in build scripts is *wrong* see <rust-lang/cargo#4932> * UnsafeCell is not needed UnsafeCell is used to provide `*mut T` through `&T` but we already have `*mut T` * Update CHANGELOG
- Loading branch information
Showing
11 changed files
with
747 additions
and
279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#[cfg(not(feature = "x11"))] | ||
fn main() {} | ||
|
||
#[cfg(feature = "x11")] | ||
fn main() { | ||
use pkg_config::probe_library; | ||
use std::env; | ||
use std::path::PathBuf; | ||
|
||
if env::var("CARGO_CFG_TARGET_OS").unwrap() != "linux" { | ||
return; | ||
} | ||
|
||
probe_library("xkbcommon").unwrap(); | ||
probe_library("xkbcommon-x11").unwrap(); | ||
|
||
let bindings = bindgen::Builder::default() | ||
// The input header we would like to generate | ||
// bindings for. | ||
.header_contents( | ||
"wrapper.h", | ||
"\ | ||
#include <xkbcommon/xkbcommon-compose.h> | ||
#include <xkbcommon/xkbcommon-names.h> | ||
#include <xkbcommon/xkbcommon-x11.h> | ||
#include <xkbcommon/xkbcommon.h>", | ||
) | ||
// Tell cargo to invalidate the built crate whenever any of the | ||
// included header files changed. | ||
.parse_callbacks(Box::new(bindgen::CargoCallbacks)) | ||
.prepend_enum_name(false) | ||
.size_t_is_usize(true) | ||
.allowlist_function("xkb_.*") | ||
.allowlist_type("xkb_.*") | ||
.allowlist_var("XKB_.*") | ||
.allowlist_type("xcb_connection_t") | ||
// this needs var args | ||
.blocklist_function("xkb_context_set_log_fn") | ||
// we use FILE from libc | ||
.blocklist_type("FILE") | ||
.blocklist_type("va_list") | ||
.blocklist_type("_.*") | ||
.generate() | ||
.expect("Unable to generate bindings"); | ||
|
||
// Write the bindings to the $OUT_DIR/xkbcommon.rs file. | ||
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); | ||
bindings | ||
.write_to_file(out_path.join("xkbcommon_sys.rs")) | ||
.expect("Couldn't write bindings!"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.