Move func "constraints_border_width" to Rust
This commit is contained in:
parent
2664eca633
commit
bd4b49c5e1
2 changed files with 9 additions and 11 deletions
|
@ -1,7 +1,5 @@
|
||||||
#include "constraints.h"
|
#include "constraints.h"
|
||||||
|
|
||||||
#define MIN_BORDER_WIDTH 0
|
|
||||||
#define MAX_BORDER_WIDTH 10000
|
|
||||||
#define MIN_DEFAULT_CLIENTS_IN_MASTER 1
|
#define MIN_DEFAULT_CLIENTS_IN_MASTER 1
|
||||||
#define MAX_DEFAULT_CLIENTS_IN_MASTER 10000
|
#define MAX_DEFAULT_CLIENTS_IN_MASTER 10000
|
||||||
#define MIN_DEFAULT_MASTER_AREA_FACTOR 0.05
|
#define MIN_DEFAULT_MASTER_AREA_FACTOR 0.05
|
||||||
|
@ -15,13 +13,6 @@
|
||||||
#define MIN_SNAP_DISTANCE 1
|
#define MIN_SNAP_DISTANCE 1
|
||||||
#define MAX_SNAP_DISTANCE 10000
|
#define MAX_SNAP_DISTANCE 10000
|
||||||
|
|
||||||
int constraints_border_width(const int border_width)
|
|
||||||
{
|
|
||||||
if (border_width < MIN_BORDER_WIDTH) return MIN_BORDER_WIDTH;
|
|
||||||
if (border_width > MAX_BORDER_WIDTH) return MAX_BORDER_WIDTH;
|
|
||||||
return border_width;
|
|
||||||
}
|
|
||||||
|
|
||||||
int constraints_default_clients_in_master(const int default_clients_in_master)
|
int constraints_default_clients_in_master(const int default_clients_in_master)
|
||||||
{
|
{
|
||||||
if (default_clients_in_master < MIN_DEFAULT_CLIENTS_IN_MASTER) return MIN_DEFAULT_CLIENTS_IN_MASTER;
|
if (default_clients_in_master < MIN_DEFAULT_CLIENTS_IN_MASTER) return MIN_DEFAULT_CLIENTS_IN_MASTER;
|
||||||
|
|
11
src/lib.rs
11
src/lib.rs
|
@ -1,4 +1,11 @@
|
||||||
|
use std::os::raw::*;
|
||||||
|
|
||||||
|
const MIN_BORDER_WIDTH: c_int = 0;
|
||||||
|
const MAX_BORDER_WIDTH: c_int = 10000;
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn foo() -> u32 {
|
pub extern "C" fn constraints_border_width(border_width: c_int) -> c_int {
|
||||||
123
|
if border_width < MIN_BORDER_WIDTH { return MIN_BORDER_WIDTH }
|
||||||
|
if border_width > MAX_BORDER_WIDTH { return MAX_BORDER_WIDTH }
|
||||||
|
border_width
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue