mirror of
https://github.com/Genymobile/scrcpy.git
synced 2025-08-03 14:49:29 +00:00
winsize
This commit is contained in:
parent
e98122c110
commit
315f467cc7
1 changed files with 12 additions and 1 deletions
|
@ -11,6 +11,9 @@
|
||||||
#include "util/strbuf.h"
|
#include "util/strbuf.h"
|
||||||
#include "util/str_util.h"
|
#include "util/str_util.h"
|
||||||
|
|
||||||
|
#include <termios.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
#define STR_IMPL_(x) #x
|
#define STR_IMPL_(x) #x
|
||||||
#define STR(x) STR_IMPL_(x)
|
#define STR(x) STR_IMPL_(x)
|
||||||
|
|
||||||
|
@ -740,7 +743,15 @@ print_shortcut(const struct sc_shortcut *shortcut, unsigned cols) {
|
||||||
|
|
||||||
void
|
void
|
||||||
scrcpy_print_usage(const char *arg0) {
|
scrcpy_print_usage(const char *arg0) {
|
||||||
const unsigned cols = 80; // For now, use an hardcoded value
|
unsigned cols = 80;
|
||||||
|
|
||||||
|
struct winsize ws;
|
||||||
|
if (ioctl(STDIN_FILENO, TIOCGWINSZ, &ws) != -1) {
|
||||||
|
cols = ws.ws_col;
|
||||||
|
if (cols < 20) {
|
||||||
|
cols = 20;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fprintf(stderr, "Usage: %s [options]\n\n"
|
fprintf(stderr, "Usage: %s [options]\n\n"
|
||||||
"Options:\n", arg0);
|
"Options:\n", arg0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue