blob: e57c7cd43506f2c5d9db7b445da139ec54fd0f63 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
#include "../lib/io/io.h"
#include "../lib/tctl/tctl.h"
#include "../lib/arg/arg.h"
#include "../lib/cstr/cstr.h"
window_size_t size;
void set_height(const char *h)
{
size.height = cstr_to_u64(h);
}
void set_width(const char *h)
{
size.width = cstr_to_u64(h);
}
int main(int argc, const char **argv)
{
size.width = 0;
size.height = 0;
arg_register_arg("-w", &set_width);
arg_register_arg("-h", &set_height);
arg_parse_arg(argc, argv);
if (size.width == 0 && size.height == 0) {
size = tctl_get_window_size();
wstdf("width: %u, height: %u\n", size.width, size.height);
} else {
window_size_t new_size = tctl_get_window_size();
if (size.width != 0)
new_size.width = size.width;
if (size.height != 0)
new_size.height = size.height;
tctl_set_window_size(new_size);
}
return 0;
}
|