mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Change Seat's get_char_cell_size to get_window_pixel_size.
That's more directly useful in uxpty.c (which is currently the only actual client of the function), and also matches the data that SSH clients send in "pty-req". Also, it makes that method behave more like the GUI query function get_window_pixels used by terminal.c (with the sole exception that unlike g_w_p it's allowed to return failure), so it becomes even more trivial to implement in the GUI front ends.
This commit is contained in:
parent
c95b277798
commit
99c215e761
2
misc.c
2
misc.c
@ -1414,5 +1414,5 @@ int nullseat_is_always_utf8(Seat *seat) { return TRUE; }
|
||||
void nullseat_echoedit_update(Seat *seat, int echoing, int editing) {}
|
||||
const char *nullseat_get_x_display(Seat *seat) { return NULL; }
|
||||
int nullseat_get_windowid(Seat *seat, long *id_out) { return FALSE; }
|
||||
int nullseat_get_char_cell_size(
|
||||
int nullseat_get_window_pixel_size(
|
||||
Seat *seat, int *width, int *height) { return FALSE; }
|
||||
|
2
pscp.c
2
pscp.c
@ -80,7 +80,7 @@ static const SeatVtable pscp_seat_vt = {
|
||||
nullseat_echoedit_update,
|
||||
nullseat_get_x_display,
|
||||
nullseat_get_windowid,
|
||||
nullseat_get_char_cell_size,
|
||||
nullseat_get_window_pixel_size,
|
||||
};
|
||||
static Seat pscp_seat[1] = {{ &pscp_seat_vt }};
|
||||
|
||||
|
2
psftp.c
2
psftp.c
@ -61,7 +61,7 @@ static const SeatVtable psftp_seat_vt = {
|
||||
nullseat_echoedit_update,
|
||||
nullseat_get_x_display,
|
||||
nullseat_get_windowid,
|
||||
nullseat_get_char_cell_size,
|
||||
nullseat_get_window_pixel_size,
|
||||
};
|
||||
static Seat psftp_seat[1] = {{ &psftp_seat_vt }};
|
||||
|
||||
|
10
putty.h
10
putty.h
@ -903,12 +903,12 @@ struct SeatVtable {
|
||||
int (*get_windowid)(Seat *seat, long *id_out);
|
||||
|
||||
/*
|
||||
* Return the pixel size of a terminal character cell. If the
|
||||
* Return the size of the terminal window in pixels. If the
|
||||
* concept is meaningless or the information is unavailable,
|
||||
* return FALSE; otherwise fill in the output pointers and return
|
||||
* TRUE.
|
||||
*/
|
||||
int (*get_char_cell_size)(Seat *seat, int *width, int *height);
|
||||
int (*get_window_pixel_size)(Seat *seat, int *width, int *height);
|
||||
};
|
||||
|
||||
#define seat_output(seat, is_stderr, data, len) \
|
||||
@ -939,8 +939,8 @@ struct SeatVtable {
|
||||
((seat)->vt->get_x_display(seat))
|
||||
#define seat_get_windowid(seat, out) \
|
||||
((seat)->vt->get_windowid(seat, out))
|
||||
#define seat_get_char_cell_size(seat, width, height) \
|
||||
((seat)->vt->get_char_cell_size(seat, width, height))
|
||||
#define seat_get_window_pixel_size(seat, width, height) \
|
||||
((seat)->vt->get_window_pixel_size(seat, width, height))
|
||||
|
||||
/* Unlike the seat's actual method, the public entry point
|
||||
* seat_connection_fatal is a wrapper function with a printf-like API,
|
||||
@ -983,7 +983,7 @@ int nullseat_is_always_utf8(Seat *seat);
|
||||
void nullseat_echoedit_update(Seat *seat, int echoing, int editing);
|
||||
const char *nullseat_get_x_display(Seat *seat);
|
||||
int nullseat_get_windowid(Seat *seat, long *id_out);
|
||||
int nullseat_get_char_cell_size(Seat *seat, int *width, int *height);
|
||||
int nullseat_get_window_pixel_size(Seat *seat, int *width, int *height);
|
||||
|
||||
/*
|
||||
* Seat functions provided by the platform's console-application
|
||||
|
@ -340,11 +340,10 @@ static int gtk_seat_is_utf8(Seat *seat)
|
||||
return frontend_is_utf8(inst);
|
||||
}
|
||||
|
||||
static int gtk_seat_get_char_cell_size(Seat *seat, int *w, int *h)
|
||||
static int gtk_seat_get_window_pixel_size(Seat *seat, int *w, int *h)
|
||||
{
|
||||
Frontend *inst = container_of(seat, Frontend, seat);
|
||||
*w = inst->font_width;
|
||||
*h = inst->font_height;
|
||||
get_window_pixels(inst, w, h);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -376,7 +375,7 @@ static const SeatVtable gtk_seat_vt = {
|
||||
#else
|
||||
gtk_seat_get_windowid,
|
||||
#endif
|
||||
gtk_seat_get_char_cell_size,
|
||||
gtk_seat_get_window_pixel_size,
|
||||
};
|
||||
|
||||
static void gtk_eventlog(LogPolicy *lp, const char *string)
|
||||
|
@ -394,7 +394,7 @@ static const SeatVtable plink_seat_vt = {
|
||||
plink_echoedit_update,
|
||||
nullseat_get_x_display,
|
||||
nullseat_get_windowid,
|
||||
nullseat_get_char_cell_size,
|
||||
nullseat_get_window_pixel_size,
|
||||
};
|
||||
static Seat plink_seat[1] = {{ &plink_seat_vt }};
|
||||
|
||||
|
@ -1155,12 +1155,12 @@ static void pty_size(Backend *be, int width, int height)
|
||||
pty->term_width = width;
|
||||
pty->term_height = height;
|
||||
|
||||
seat_get_char_cell_size(pty->seat, &xpixel, &ypixel);
|
||||
seat_get_window_pixel_size(pty->seat, &xpixel, &ypixel);
|
||||
|
||||
size.ws_row = (unsigned short)pty->term_height;
|
||||
size.ws_col = (unsigned short)pty->term_width;
|
||||
size.ws_xpixel = (unsigned short)pty->term_width * xpixel;
|
||||
size.ws_ypixel = (unsigned short)pty->term_height * ypixel;
|
||||
size.ws_xpixel = (unsigned short)xpixel;
|
||||
size.ws_ypixel = (unsigned short)ypixel;
|
||||
ioctl(pty->master_fd, TIOCSWINSZ, (void *)&size);
|
||||
return;
|
||||
}
|
||||
|
@ -245,10 +245,9 @@ char *win_seat_get_ttymode(Seat *seat, const char *mode)
|
||||
return term_get_ttymode(term, mode);
|
||||
}
|
||||
|
||||
int win_seat_get_char_cell_size(Seat *seat, int *x, int *y)
|
||||
int win_seat_get_window_pixel_size(Seat *seat, int *x, int *y)
|
||||
{
|
||||
*x = font_width;
|
||||
*y = font_height;
|
||||
get_window_pixels(NULL, x, y);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -277,7 +276,7 @@ static const SeatVtable win_seat_vt = {
|
||||
nullseat_echoedit_update,
|
||||
nullseat_get_x_display,
|
||||
nullseat_get_windowid,
|
||||
win_seat_get_char_cell_size,
|
||||
win_seat_get_window_pixel_size,
|
||||
};
|
||||
Seat win_seat[1] = {{ &win_seat_vt }};
|
||||
|
||||
|
@ -103,7 +103,7 @@ static const SeatVtable plink_seat_vt = {
|
||||
plink_echoedit_update,
|
||||
nullseat_get_x_display,
|
||||
nullseat_get_windowid,
|
||||
nullseat_get_char_cell_size,
|
||||
nullseat_get_window_pixel_size,
|
||||
};
|
||||
static Seat plink_seat[1] = {{ &plink_seat_vt }};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user