Commit Graph

3152 Commits

Author SHA1 Message Date
Marek Habersack
a29bfe9c42 [C++] Deal with widgets grabbing full ownership of Panel
Fixes: https://github.com/dankamongmen/notcurses/issues/1009

Whenever a widget is created with its `*_create` function it currently
claims full ownership of the passed panel, including its destruction.
However, the C++ wrapper around the panel is not aware of this and will
attempt to destroy the native panel in the destructor, leading to
segfaults.

Fix this by introduction of a `Widget` class which contains the logic to
properly modify the `Panel` instance to not double-destroy the native
panel.  The solution is a bit fragile since the `Panel` instance is left
intact (we can't free it for the user) in a state that's safe for the
C++ wrapper, but calling any C function via the wrapper **will** pass a
`NULL` pointer in the panel argument - therefore the C functions MUST be
proofed against this.  The proofing belongs in the C backend code since
this protects also C and other language binding users from such abuse.

The Widget class will first verify that the passed `Plane` instance
hasn't already been "disowned" and will throw an exception to the effect
if it was.  Next, it will proceed to take over ownership of the native
panel instance and mark the passed `Panel` as "invalid" (i.e. not owning
any native panel instance anymore)

The above changes require modification of `Panel` instances and so all
the widget constructors taking `const*` or `const&` have been removed
from widget classes.
2020-10-03 13:19:49 -04:00
nick black
7241e0a5e1
demo tabletfxn: cliptop __attribute__ ((unused)) 2020-10-03 02:43:18 -04:00
nick black
8cbc9e1b3b
add 1.7.0 to history section 2020-10-01 12:08:22 -04:00
nick black
aa7acc0e7a
quick wording change to FAQs 2020-10-01 12:03:23 -04:00
nick black
c2c4811053
reel: cap return lines at max size, warn on excess 2020-09-30 04:23:21 -04:00
nick black
bf40e163c8
reel poc: cap return at true size 2020-09-30 03:43:41 -04:00
nick black
20a49d053d
v1.7.5 2020-09-29 13:12:17 -04:00
nick black
afa65f640f update notcurses_plane.3 and USAGE.md for new styles API 2020-09-29 13:09:44 -04:00
nick black
683217ef07 normalize style setters #1034 2020-09-29 13:09:44 -04:00
nick black
174a00b56c
add deprecated nctablet_ncplane() for old binaries 2020-09-29 11:59:33 -04:00
nick black
6ddf105746
uninline ncplane_new() so older binaries continue to link 2020-09-29 11:52:48 -04:00
nick black
8d347d14bb
move ncreel to PoCs, don't install #1033 2020-09-28 07:20:16 -04:00
nick black
f15dc9ba80 ncreel: properly size tablets in all border conditions #1031 2020-09-28 07:08:17 -04:00
nick black
c236b65266 name standard plane 'std' 2020-09-28 07:08:17 -04:00
nick black
a591e11c96 retain nctablet_ncplane() as deprecated alias 2020-09-28 07:08:17 -04:00
nick black
8b5e3f5000 add four unit test for reel tablet sizes 2020-09-28 07:08:17 -04:00
nick black
315df85b2b
note that python bindings are quite incomplete 2020-09-28 02:03:52 -04:00
nick black
afd444cea3
kill stray decl ncdirect_getc_nonblocking() #1028 2020-09-28 01:28:46 -04:00
nick black
20bf1ae2d4
nctablet_ncplane() -> nctablet_plane() 2020-09-27 16:46:39 -04:00
nick black
ec85dd1c3b
ncreel_destroy: return void 2020-09-27 15:57:03 -04:00
Marek Habersack
943e23535f [C++] API sync
Fixes: https://github.com/dankamongmen/notcurses/issues/1025

Added:
  * Direct: flush (`ncdirect_flush`)
  * Direct: getc (`ncdirect_getc_blocking` and `ncdirect_getc_nblock`)
  * Direct: getc (`ncdirect_getc`)
  * Direct: get_inputready_fd (`ncdirect_inputready_fd`)
  * NotCurses: align (`notcurses_align`)
  * NotCurses: ucs32_to_utf8 (`notcurses_ucs32_to_utf8`)
  * NotCurses: get_bottom (`notcurses_bottom`)
  * Plane: resize_realign (`ncplane_resize_realign`)
  * Plane: get_x (`ncplane_x`)
  * Plane: get_y (`ncplane_y`)
  * Plane: mergedown (`ncplane_mergedown`)
  * Plane: putwc_stained (`ncplane_putwc_stained`)
  * Plane: putstr_stained (`ncplane_putstr_stained`)
  * Plane: set_fchannel (`ncplane_set_fchannel`)
  * Plane: set_bchannel (`ncplane_set_bchannel`)
  * Plane: get_styles (`ncplane_styles`)
  * Plane: get_above (`ncplane_above`)
  * Reader: move_left (`ncreader_move_left`)
  * Reader: move_right (`ncreader_move_right`)
  * Reader: move_up (`ncreader_move_up`)
  * Reader: move_down (`ncreader_move_down`)
  * Reader: write_egc (`ncreader_write_egc`)
  * Visual: get_default_blitter (`ncvisual_default_blitter`)

Fixed:
  * NotCurses: `cursor_{enable,disable}` must use `NOEXCEPT_MAYBE`
  * Plane: renamed `putcw` to `putwc`
2020-09-27 15:32:25 -04:00
nick black
7089f31456 NCBLIT_BRAILLE: invert horizontal layout, fixes plots #1026 2020-09-23 07:48:04 -04:00
nick black
364cf61004
drone: ubuntu builer 2020-09-22a 2020-09-22 23:59:11 -04:00
joseLuís
38314d5e76 update function-summary.sh stats 2020-09-22 14:08:32 +02:00
joseLuís
bcc5481899 rust: update example
- use ncdirect_flush function for flushing
2020-09-22 13:34:10 +02:00
joseLuís
5be9edd6f4 rust: convert all rgb calls & new plane functions #1024
- add (TBD) ncplane_putchar, ncplane_putchar_yx
- delete ncplane_bound, ncplane_new, ncplane_pusimple & ncplane_putsimple_yx
- rename `.*_[bf]g.*_rgb` → .`*_[bf]g.*_rgb8`
- rename `.*_[bf]g` → .`*_[bf]g.*_rgb`
2020-09-22 13:33:13 +02:00
joseLuís
a09ed747ca rust: update example direct-cursor 2020-09-21 20:03:18 +02:00
nick black
f02263e977
v1.7.4 2020-09-20 17:30:46 -04:00
nick black
21b8a50da0
rust: s/NCCHANNEL_ALPHA_MASK/CHANNEL_ALPHA_MASK/g 2020-09-20 16:16:40 -04:00
nick black
11a2861e8d
FPS graph ought be recentered on resized #1023 2020-09-20 11:48:15 -04:00
nick black
2f26f06386
alignment: add NCALIGN_UNALIGNED, preserve align type #364 2020-09-20 11:46:49 -04:00
nick black
2d9598b913
introduce ncplane_resize_realign #364 2020-09-20 10:14:05 -04:00
nick black
bfdf801a12 depth-first corecursion, not breadth-first 2020-09-20 08:54:56 -04:00
nick black
a685cc18f3 recursively cascade resizes using resizecb #869 2020-09-20 08:54:56 -04:00
nick black
bc639b528e adapt ncplane_new_internal() callers 2020-09-20 08:54:56 -04:00
nick black
7f2aeedba3 ncplane_new_internal() using ncplane_options 2020-09-20 08:54:56 -04:00
nick black
7b51bab79a add resizecb to ncplane_options struct #869 2020-09-20 08:54:56 -04:00
nick black
73f9973a2c Plane.hh: fix up indentation #1020 2020-09-20 05:52:27 -04:00
nick black
97dc50db1a kill stray entry in NEWS 2020-09-20 05:52:27 -04:00
nick black
36aed3c521 add ncplane_create() + ncplane_options #1020 2020-09-20 05:52:27 -04:00
nick black
607c03edc4
rename _rgb_clipped functions rgb8_clipped 2020-09-19 21:55:01 -04:00
nick black
4459efa216
v1.7.3 2020-09-19 21:21:52 -04:00
nick black
2d2e4df2e2 reader: properly place the text plane offscreen #985 2020-09-18 17:46:57 -04:00
nick black
a4367fcfb5 rip out ncplane_ creation functions #985 2020-09-18 17:46:57 -04:00
nick black
e42dbdfd60 _stainable() -> _stained() #985 2020-09-18 02:02:08 -04:00
nick black
c5c608b22e add ncplane_putwc_stainable, ncplane_putwstr_stainable #985 2020-09-18 02:02:08 -04:00
nick black
d8cdc3996c python: update for RGB name changes #985 2020-09-18 01:39:21 -04:00
nick black
c85ac831c6 man pages: update for rgb name changes #985 2020-09-18 01:39:21 -04:00
nick black
b7a57eaab7 convert all channel rgb calls #985 2020-09-18 01:39:21 -04:00
nick black
0e34bec3fb start converting rgb->rgb8 #985 2020-09-18 01:39:21 -04:00