Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue #106, to make it work on a real DEC VT320 #107

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

sblendorio
Copy link

@sblendorio sblendorio commented Feb 2, 2022

Fix issue #106

  • Using A_REVERSE attribute (a reversed space), now the digit are visible also on a real hardware DEC VT320
  • The blinking cursor is hidden at the start, and is re-enabled at the end of the execution. I used printf() with ANSI code because ncurses "curs_set" function did not work on the real hardware
  • The small "glitches" of the date's window are now fixed throw 2 "box-drawing characters" (ACS_TTEE)
    image

@sblendorio sblendorio changed the title Fix issue #106 Fix issue https://github.com/xorg62/tty-clock/issues/106 Feb 2, 2022
@sblendorio sblendorio changed the title Fix issue https://github.com/xorg62/tty-clock/issues/106 Fix issue #106, to make it work on a real DEC VT320 Feb 2, 2022
@anarcat
Copy link
Collaborator

anarcat commented Feb 2, 2022

would be nice to have comments inline in the code to explain where that magic come from.

also please provide a screenshot of what it will look like in modern terminal emulators, e.g. like xterm and gnome-terminal. i know it's backwards but most people will use ttyclock there...

@sblendorio
Copy link
Author

Added comments to clarify "magic strings" and simplified some expression. Tomorrow I will test it on both real VT320 and "normal" Terminal window on Xwindow screen and will post screenshot here

@sblendorio
Copy link
Author

sblendorio commented Feb 3, 2022

Just tested it on both real DEC VT320 and terminal emulator under Xwindows after yesterday's commit.

These are the results:
image

image

image

image

image

It seems to be O.K.

ttyclock.c Outdated
@@ -218,6 +218,8 @@ void
draw_number(int n, int x, int y)
{
int i, sy = y;
unsigned int on = COLOR_PAIR(2) | A_REVERSE;
unsigned int off = COLOR_PAIR(0) | A_NORMAL;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

those seem a little ... terse. what is "on"? color? expand the variable.

why isn't this a #define too?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'm going to use more significant names for "on/off", for example "pixel_on" and "pixel_off".
I've not used a #define because the aim is to calculate the value at the beginning of the function and use it immedialy in the inner for cycle. Since the #define is just a text replacement, it does not implement precalculated values.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anarcat would you use different names than "pixel_on" / "pixel_off"? Can you suggest me? For example:

  • colored_reverse
  • transparent_normal

would be more descriptive?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i frankly have no idea what's going on here, so i'll trust your judgement blindly.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will explain:

pixel_on is a bitmask made by:

pixel_off is anothter bitmask made by:

  • COLOR_PAIR(0) which means "not visible"
  • A_NORMAL is "not reverse" attribute

so I use "pixel_on" to draw the "block characters" which are reversed spaces, supported by both xterm and DECterm, and "pixel_off" to draw the "empty space".

is it good to merge it? ;)

@anarcat
Copy link
Collaborator

anarcat commented Feb 3, 2022

Just tested it on both real DEC VT320 and terminal emulator under Xwindows after yesterday's commit.

These are the results: image

image

image

image

image

It seems to be O.K.

awesome, thanks, looks good.

@anarcat
Copy link
Collaborator

anarcat commented Feb 8, 2022 via email

@sblendorio
Copy link
Author

@anarcat just added the comment for "pixel_on" and "pixel_off"

Copy link
Collaborator

@anarcat anarcat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome, LGTM.

@sblendorio
Copy link
Author

awesome, LGTM.

no merge?

@anarcat
Copy link
Collaborator

anarcat commented Feb 11, 2022 via email

@dirtslayer
Copy link

dirtslayer commented Apr 11, 2022

i ended up having to comment out the lines 70, 71
// init_pair(0 ...
// init_pair(1,
so that i can use gnome-terminal profiles to pick the colors.
seems like a command line option to disable colors and use terminal profile might be handy
Screenshot_2022-04-10_19-36-18

@anarcat
Copy link
Collaborator

anarcat commented Apr 11, 2022

hmm... why do we mess with colors here at all then?

@dirtslayer
Copy link

to support backward compatibility we could leave the current color options, but adding an additional command line option, perhaps --no-color or -nc could disable the color setting and use the terminals 3 colors ( background, text, highlight) whatever they are called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants