PDCurses icon indicating copy to clipboard operation
PDCurses copied to clipboard

Curses window properties

Open uhlin opened this issue 4 years ago • 7 comments

Added the following functions:

  • is_cleared()
  • is_immedok()
  • is_nodelay()
  • is_scrollok()
  • is_syncok()

uhlin avatar Dec 12 '20 21:12 uhlin

Note : these are extensions found in ncurses to enable the WINDOW structure to be opaque. We'd need a few more of those functions (is_idcok(), is_idlok(), is_keypad(), is_leaveok()... see above link) to actually get opacity. But quite aside from that, it might be nice to have the added ncurses compatibility.

Bill-Gray avatar Dec 12 '20 23:12 Bill-Gray

I think your info is pretty bogus. idcok(), idlok() are no-ops (aka no operations) in pdcurses. so therefore is_idcok() and is_idlok() are pointless. and the is_keypad() and is_leaveok() functions are already part of pdcurses 3.9.

uhlin avatar Dec 13 '20 00:12 uhlin

is_idcok() and is_idlok() are not pointless if you'd like to compile the same code with both ncurses and PDCurses. Which, as the documentation points out, is why idcok() and idlok() are present, as no-ops : they, too, are "pointless", but are provided "for compatibility with other Curses implementations." to aid portability. By your reasoning, they'd be absent, too.

It looks to me as if

#define is_idcok( win)  FALSE
#define is_idlok( win)  FALSE

would do the job (i.e., we never have hardware control going on).

Fair point about is_keypad() and is_leaveok() being already present in PDCurses, though. (Also, is_pad().) Those appear to be the only three "opacity" functions already present; my point that most of them are missing stands. (I had grepped for a couple of them in the code, didn't find them, and leapt to the conclusion that we were missing all of them.)

Bill-Gray avatar Dec 13 '20 02:12 Bill-Gray

:+1: you are right

uhlin avatar Dec 13 '20 11:12 uhlin

Decided to not make them #define's, good or bad I don't know ...

uhlin avatar Dec 14 '20 23:12 uhlin

The PDCurses code does not appear to take a strong "macros are always evil" stance. But it does lean to function use, so you probably made the right choice.

I note you added some code to suppress warnings about unused parameters. PDCurses is loaded with unused parameters. (Compile with -Wextra in GCC and see them all pop out.) I would not mind seeing (void)unused_param in all such cases, and then turning on the relevant compiler warnings. I like running with maximum warnings, so quite a bit of my code has something like

#define UNUSED_PARAMETER( param) ((void)(param))
...

   UNUSED_PARAMETER( ignored_param);

But that's probably for a different push request, and I don't know if William would be at all interested.

Bill-Gray avatar Dec 15 '20 02:12 Bill-Gray

Yeah

uhlin avatar Dec 15 '20 10:12 uhlin

@Bill-Gray: Do you plan to integrate any of these? Which if any functions are missing to reach a reasonable well support here?

GitMensch avatar Nov 04 '22 23:11 GitMensch

If submitted, I'd pull this into PDCursesMod. Looking at the ncurses opaque window functions, I see we'd be missing is_notimeout(), is_subwin(), wgetdelay(), wgetscrreg(), and wgetparent(). I'd see nothing wrong with adding those five functions as well. And it can be convenient to be able to use the ncurses test code and to be able to build programs for both PDCurses* and ncurses with minimal changes.

Bill-Gray avatar Nov 05 '22 02:11 Bill-Gray

Ok, lets see if I can add those as well. Maybe I do it tonight.

uhlin avatar Nov 16 '22 16:11 uhlin

That's fine. Do what you think is the best choice.

Would've been fun if William made a 4.0 release in the future. Some time has passed since 3.9 was released. :+1:

uhlin avatar Nov 17 '22 17:11 uhlin

Else he can do it himself if he like...

uhlin avatar Nov 17 '22 17:11 uhlin

Added these functions, with minor changes for the slightly different styles between PDCurses and PDCursesMod. Thank you!

Bill-Gray avatar Nov 18 '22 16:11 Bill-Gray