mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-20 03:25:47 +00:00
Merge branch 'master' of github.com:dankamongmen/notcurses
This commit is contained in:
commit
b5a72b50ed
@ -29,8 +29,6 @@ libc = { version = "^0.2.80", default-features = false }
|
||||
cty = "^0.2.1"
|
||||
|
||||
[build-dependencies]
|
||||
# https://github.com/rust-lang/rust-bindgen/blob/master/CHANGELOG.md#0551
|
||||
# https://pkgs.org/search/?q=bindgen
|
||||
bindgen = "^0.57"
|
||||
pkg-config = "^0.3.18"
|
||||
|
||||
|
@ -189,7 +189,7 @@ pub use ffi::{
|
||||
ncdirect_dim_y,
|
||||
ncdirect_double_box,
|
||||
ncdirect_flush,
|
||||
ncdirect_getc,
|
||||
ncdirect_get,
|
||||
ncdirect_init,
|
||||
ncdirect_inputready_fd,
|
||||
ncdirect_off_styles,
|
||||
@ -794,7 +794,7 @@ pub use ffi::{
|
||||
notcurses_debug,
|
||||
notcurses_detected_terminal,
|
||||
notcurses_drop_planes,
|
||||
notcurses_getc,
|
||||
notcurses_get,
|
||||
notcurses_init,
|
||||
notcurses_inputready_fd,
|
||||
notcurses_lex_blitter,
|
||||
|
@ -281,7 +281,7 @@ pub const NCALPHA_FG_RGB_MASK: u64 = crate::bindings::ffi::NC_FG_RGB_MASK;
|
||||
///
|
||||
pub type NcChannels = u64;
|
||||
|
||||
#[deprecated]
|
||||
#[deprecated = "use NcChannels instead"]
|
||||
#[doc(hidden)]
|
||||
pub type NcChannelPair = NcChannels;
|
||||
|
||||
|
@ -571,9 +571,7 @@ impl NcDirect {
|
||||
} else {
|
||||
ninput = null_mut();
|
||||
}
|
||||
let c = unsafe {
|
||||
core::char::from_u32_unchecked(crate::ncdirect_getc(self, ntime, null_mut(), ninput))
|
||||
};
|
||||
let c = unsafe { core::char::from_u32_unchecked(crate::ncdirect_get(self, ntime, ninput)) };
|
||||
if c as u32 as i32 == NCRESULT_ERR {
|
||||
return Err(NcError::new());
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
//! `ncdirect_*` reimplemented functions.
|
||||
|
||||
use core::ptr::{null, null_mut};
|
||||
use core::ptr::null;
|
||||
|
||||
use crate::{
|
||||
cstring, NcCapabilities, NcChannels, NcComponent, NcDim, NcDirect, NcInput, NcIntResult, NcRgb,
|
||||
@ -68,7 +68,7 @@ pub fn ncdirect_capabilities(ncd: &NcDirect) -> NcCapabilities {
|
||||
// TODO: use from_u32 & return Option.
|
||||
#[inline]
|
||||
pub fn ncdirect_getc_blocking(ncd: &mut NcDirect, input: &mut NcInput) -> char {
|
||||
unsafe { core::char::from_u32_unchecked(crate::ncdirect_getc(ncd, null(), null_mut(), input)) }
|
||||
unsafe { core::char::from_u32_unchecked(crate::ncdirect_get(ncd, null(), input)) }
|
||||
}
|
||||
|
||||
///
|
||||
@ -81,7 +81,7 @@ pub fn ncdirect_getc_blocking(ncd: &mut NcDirect, input: &mut NcInput) -> char {
|
||||
pub fn ncdirect_getc_nblock(ncd: &mut NcDirect, input: &mut NcInput) -> char {
|
||||
unsafe {
|
||||
let ts = NcTime::new();
|
||||
core::char::from_u32_unchecked(crate::ncdirect_getc(ncd, &ts, null_mut(), input))
|
||||
core::char::from_u32_unchecked(crate::ncdirect_get(ncd, &ts, input))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,13 +15,10 @@ use crate::NcDim;
|
||||
mod keycodes;
|
||||
pub use keycodes::*;
|
||||
|
||||
/// Reads and decodes input events
|
||||
/// Reads and decodes input events.
|
||||
///
|
||||
/// Reads from stdin and decodes the input to stdout,
|
||||
/// including synthesized events and mouse events.
|
||||
///
|
||||
///
|
||||
/// Notcurses provides input from keyboards and mice.
|
||||
/// Reads from stdin and decodes the input to stdout, including synthesized
|
||||
/// events and mouse events. Notcurses provides input from keyboards and mice.
|
||||
/// Single Unicode codepoints are received from the keyboard, directly encoded
|
||||
/// as `u32`.
|
||||
///
|
||||
|
@ -331,9 +331,8 @@ impl Nc {
|
||||
} else {
|
||||
ninput = null_mut();
|
||||
}
|
||||
let c = unsafe {
|
||||
core::char::from_u32_unchecked(crate::notcurses_getc(self, ntime, null_mut(), ninput))
|
||||
};
|
||||
let c =
|
||||
unsafe { core::char::from_u32_unchecked(crate::notcurses_get(self, ntime, ninput)) };
|
||||
if c as u32 as i32 == NCRESULT_ERR {
|
||||
return Err(NcError::new());
|
||||
}
|
||||
|
@ -220,3 +220,28 @@ pub const NCALIGN_CENTER: NcAlign = crate::bindings::ffi::ncalign_e_NCALIGN_CENT
|
||||
|
||||
/// Do not align an [`NcPlane`][crate::NcPlane] or terminal.
|
||||
pub const NCALIGN_UNALIGNED: NcAlign = crate::bindings::ffi::ncalign_e_NCALIGN_UNALIGNED;
|
||||
|
||||
// NcPixelImpl -----------------------------------------------------------------
|
||||
|
||||
/// Pixel blitting implementations. (Informative only).
|
||||
///
|
||||
/// Returned by [`check_pixel_support`][Notcurses#method.check_pixel_support].
|
||||
pub type NcPixelImpl = crate::bindings::ffi::ncpixelimpl_e;
|
||||
|
||||
/// No pixel support.
|
||||
pub const NCPIXEL_NONE: NcPixelImpl = crate::bindings::ffi::ncpixelimpl_e_NCPIXEL_NONE;
|
||||
/// Sixel
|
||||
pub const NCPIXEL_SIXEL: NcPixelImpl = crate::bindings::ffi::ncpixelimpl_e_NCPIXEL_SIXEL;
|
||||
/// Linux framebuffer.
|
||||
pub const NCPIXEL_LINUXFB: NcPixelImpl = crate::bindings::ffi::ncpixelimpl_e_NCPIXEL_LINUXFB;
|
||||
/// iTerm2
|
||||
pub const NCPIXEL_ITERM2: NcPixelImpl = crate::bindings::ffi::ncpixelimpl_e_NCPIXEL_ITERM2;
|
||||
/// Kitty prior to C=1 and animation.
|
||||
pub const NCPIXEL_KITTY_STATIC: NcPixelImpl =
|
||||
crate::bindings::ffi::ncpixelimpl_e_NCPIXEL_KITTY_STATIC;
|
||||
/// Kitty with animation but not reflexive composition.
|
||||
pub const NCPIXEL_KITTY_ANIMATED: NcPixelImpl =
|
||||
crate::bindings::ffi::ncpixelimpl_e_NCPIXEL_KITTY_ANIMATED;
|
||||
/// Kitty with reflexive composition.
|
||||
pub const NCPIXEL_KITTY_SELFREF: NcPixelImpl =
|
||||
crate::bindings::ffi::ncpixelimpl_e_NCPIXEL_KITTY_SELFREF;
|
||||
|
@ -44,7 +44,7 @@ pub fn notcurses_getc_nblock(nc: &mut Nc, input: &mut NcInput) -> char {
|
||||
tv_sec: 0,
|
||||
tv_nsec: 0,
|
||||
};
|
||||
core::char::from_u32_unchecked(crate::notcurses_getc(nc, &ts, null_mut(), input))
|
||||
core::char::from_u32_unchecked(crate::notcurses_get(nc, &ts, input))
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,9 +63,7 @@ pub fn notcurses_getc_blocking(nc: &mut Nc, input: Option<&mut NcInput>) -> char
|
||||
} else {
|
||||
input_ptr = null_mut();
|
||||
}
|
||||
unsafe {
|
||||
core::char::from_u32_unchecked(crate::notcurses_getc(nc, null(), null_mut(), input_ptr))
|
||||
}
|
||||
unsafe { core::char::from_u32_unchecked(crate::notcurses_get(nc, null(), input_ptr)) }
|
||||
}
|
||||
|
||||
/// [notcurses_stdplane()][crate::notcurses_stdplane], plus free bonus
|
||||
|
@ -53,7 +53,6 @@
|
||||
//W ncplane_move_bottom
|
||||
//W ncplane_move_top
|
||||
//W ncplane_move_yx
|
||||
// X ncplane_new // deprecated
|
||||
//W# ncplane_notcurses
|
||||
//W# ncplane_notcurses_const
|
||||
//W ncplane_off_styles
|
||||
@ -110,9 +109,6 @@
|
||||
// ncplane_set_userptr
|
||||
//W ncplane_stain
|
||||
//W ncplane_styles
|
||||
// X ncplane_styles_off // deprecated
|
||||
// X ncplane_styles_on // deprecated
|
||||
// X ncplane_styles_set // deprecated
|
||||
//W ncplane_translate
|
||||
//W ncplane_translate_abs
|
||||
// ncplane_userptr
|
||||
|
@ -235,29 +235,6 @@ pub const NCBLIT_DEFAULT: NcBlitter = crate::bindings::ffi::ncblitter_e_NCBLIT_D
|
||||
/// See [Sixel in Wikipedia](https://en.wikipedia.org/wiki/Sixel).
|
||||
pub const NCBLIT_PIXEL: NcBlitter = crate::bindings::ffi::ncblitter_e_NCBLIT_PIXEL;
|
||||
|
||||
/// Pixel blitting implementations. (Informative only).
|
||||
///
|
||||
/// Returned by [`check_pixel_support`][Notcurses#method.check_pixel_support].
|
||||
pub type NcPixelImpl = crate::bindings::ffi::ncpixelimpl_e;
|
||||
|
||||
/// No pixel support.
|
||||
pub const NCPIXEL_NONE: NcPixelImpl = crate::bindings::ffi::ncpixelimpl_e_NCPIXEL_NONE;
|
||||
/// Sixel
|
||||
pub const NCPIXEL_SIXEL: NcPixelImpl = crate::bindings::ffi::ncpixelimpl_e_NCPIXEL_SIXEL;
|
||||
/// Linux framebuffer.
|
||||
pub const NCPIXEL_LINUXFB: NcPixelImpl = crate::bindings::ffi::ncpixelimpl_e_NCPIXEL_LINUXFB;
|
||||
/// iTerm2
|
||||
pub const NCPIXEL_ITERM2: NcPixelImpl = crate::bindings::ffi::ncpixelimpl_e_NCPIXEL_ITERM2;
|
||||
/// Kitty prior to C=1 and animation.
|
||||
pub const NCPIXEL_KITTY_STATIC: NcPixelImpl =
|
||||
crate::bindings::ffi::ncpixelimpl_e_NCPIXEL_KITTY_STATIC;
|
||||
/// Kitty with animation but not reflexive composition.
|
||||
pub const NCPIXEL_KITTY_ANIMATED: NcPixelImpl =
|
||||
crate::bindings::ffi::ncpixelimpl_e_NCPIXEL_KITTY_ANIMATED;
|
||||
/// Kitty with reflexive composition.
|
||||
pub const NCPIXEL_KITTY_SELFREF: NcPixelImpl =
|
||||
crate::bindings::ffi::ncpixelimpl_e_NCPIXEL_KITTY_SELFREF;
|
||||
|
||||
/// Contains the pixel geometry information as returned by the
|
||||
/// NcPlane.[pixelgeom()][crate::NcPlane#method.pixelgeom] method.
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user