Skip to content
Snippets Groups Projects
Commit ae008449 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Have get_term_win_size() optionally return size in pixels as well

parent 19545587
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #3470 passed
......@@ -391,7 +391,7 @@ int pty_connect(struct bbslist *bbs)
struct winsize ws;
struct termios ts;
char *termcap;
int cols, rows;
int cols, rows, pixelc, pixelr;
int cp;
ts.c_iflag = TTYDEF_IFLAG;
......@@ -401,9 +401,11 @@ int pty_connect(struct bbslist *bbs)
memcpy(ts.c_cc,ttydefchars,sizeof(ts.c_cc));
cfsetspeed(&ts, 115200);
get_term_win_size(&cols, &rows, &bbs->nostatus);
get_term_win_size(&cols, &rows, &pixelc, &pixelr, &bbs->nostatus);
ws.ws_col = cols;
ws.ws_row = rows;
ws.ws_xpixel = pixelc;
ws.ws_ypixel = pixelr;
cp = getcodepage();
child_pid = forkpty(&master, NULL, &ts, &ws);
......
......@@ -9797,7 +9797,7 @@ reinit_screen(uint8_t *font, int fx, int fy)
pthread_mutex_unlock(&vstatlock);
// Initialize it...
clrscr();
get_term_win_size(&term.width, &term.height, &term.nostatus);
get_term_win_size(&term.width, &term.height, NULL, NULL, &term.nostatus);
term.width = cols;
cterm = cterm_init(rows + (term.nostatus ? 0 : -1), cols, oldcterm.x, oldcterm.y, oldcterm.backlines, oldcterm.backwidth, oldcterm.scrollback, oldcterm.emulation);
cterm->apc_handler = oldcterm.apc_handler;
......
......@@ -277,7 +277,7 @@ int ssh_connect(struct bbslist *bbs)
term = get_emulation_str(get_emulation(bbs));
status=cl.SetAttributeString(ssh_session, CRYPT_SESSINFO_SSH_TERMINAL, term, strlen(term));
get_term_win_size(&cols, &rows, &bbs->nostatus);
get_term_win_size(&cols, &rows, NULL, NULL, &bbs->nostatus);
if (!bbs->hidepopups) {
uifc.pop(NULL);
......
......@@ -63,7 +63,7 @@ void get_cterm_size(int* cols, int* rows, int ns)
*rows = cterm->height;
}
else {
get_term_win_size(cols, rows, &ns);
get_term_win_size(cols, rows, NULL, NULL, &ns);
}
}
......
......@@ -8,7 +8,7 @@
#include "syncterm.h"
void
get_term_win_size(int *width, int *height, int *nostatus)
get_term_win_size(int *width, int *height, int *pixelw, int *pixelh, int *nostatus)
{
struct text_info txtinfo;
int vmode = find_vmode(fake_mode);
......@@ -39,6 +39,19 @@ get_term_win_size(int *width, int *height, int *nostatus)
*height=24;
*nostatus=1;
}
if (vmode == -1) {
if (pixelw)
*pixelw = *width * 8;
if (pixelh)
*pixelh = *height * 16;
}
else {
if (pixelw)
*pixelw = *width * vparams[vmode].charwidth;
if (pixelh)
*pixelh = *height * vparams[vmode].charheight;
}
}
int drawwin(void)
......@@ -53,7 +66,7 @@ int drawwin(void)
strcpy(str," ");
get_term_win_size(&term.width, &term.height, &term.nostatus);
get_term_win_size(&term.width, &term.height, NULL, NULL, &term.nostatus);
if (settings.left_just)
term.x = 2;
......
......@@ -3,7 +3,7 @@
#ifndef _WINDOW_H_
#define _WINDOW_H_
void get_term_win_size(int *width, int *height, int *nostatus);
void get_term_win_size(int *width, int *height, int *pixelw, int *pixelh, int *nostatus);
int drawwin(void);
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment