aboutsummaryrefslogtreecommitdiffstats
path: root/wm.c
diff options
context:
space:
mode:
authorverdant <im@verdant.ee>2026-07-28 14:52:30 +0800
committerverdant <im@verdant.ee>2026-07-28 14:52:30 +0800
commit7e6d61fa74cf5ad2ba922d7970a0f1325ecc2253 (patch)
tree2f3541b689a44cd2f3fb2c9c69153cdc040a48f3 /wm.c
parentc791137a0c5412d62aa9b3c60b08b3f17bbef954 (diff)
downloadsf-7e6d61fa74cf5ad2ba922d7970a0f1325ecc2253.tar.gz
sf-7e6d61fa74cf5ad2ba922d7970a0f1325ecc2253.zip
Fix function argument order and reformat
Diffstat (limited to 'wm.c')
-rw-r--r--wm.c99
1 files changed, 52 insertions, 47 deletions
diff --git a/wm.c b/wm.c
index 00bd0e0..f25c6ba 100644
--- a/wm.c
+++ b/wm.c
@@ -8,66 +8,71 @@
#include "mem.h"
window *wm_create_new_w(terminal *t, const char *name, int height, int width,
- int start_y, int start_x) {
- if (t->w_count >= WINDOWS_MAX) {
- die("Windows count has arrived max");
- }
+ int start_y, int start_x)
+{
+ if (t->w_count >= WINDOWS_MAX) {
+ die("Windows count has arrived max");
+ }
- WINDOW *win;
- win = derwin(t->windows[0]->win, height, width, start_y, start_x);
+ WINDOW *win;
+ win = derwin(t->windows[0]->win, height, width, start_y, start_x);
- int current_idx = t->w_count;
+ int current_idx = t->w_count;
- strncpy(t->windows[current_idx]->name, name, 31);
- t->windows[current_idx]->win = win;
- t->windows[current_idx]->start_y = start_y;
- t->windows[current_idx]->start_x = start_x;
- t->windows[current_idx]->width = width;
- t->windows[current_idx]->height = height;
+ strncpy(t->windows[current_idx]->name, name, 31);
+ t->windows[current_idx]->win = win;
+ t->windows[current_idx]->start_y = start_y;
+ t->windows[current_idx]->start_x = start_x;
+ t->windows[current_idx]->width = width;
+ t->windows[current_idx]->height = height;
- t->w_count++;
+ t->w_count++;
- return t->windows[current_idx];
+ return t->windows[current_idx];
}
-terminal *wm_init(void) {
- terminal *t = xmalloc(sizeof(terminal));
- t->windows = xmalloc(sizeof(window *) * WINDOWS_MAX);
- for (int i = 0; i < WINDOWS_MAX; i++) {
- t->windows[i] = xmalloc(sizeof(window));
- }
- t->w_count = 0;
- getmaxyx(stdscr, t->maxy, t->maxx);
- t->windows[0]->win = newwin(t->maxy, t->maxx, 0, 0);
- t->windows[t->w_count]->start_y = 0;
- t->windows[t->w_count]->start_x = 0;
- t->windows[t->w_count]->height = t->maxy;
- t->windows[t->w_count]->width = t->maxx;
- t->w_count++;
+terminal *wm_init(void)
+{
+ terminal *t = xmalloc(sizeof(terminal));
+ t->windows = xmalloc(sizeof(window *) * WINDOWS_MAX);
+ for (int i = 0; i < WINDOWS_MAX; i++) {
+ t->windows[i] = xmalloc(sizeof(window));
+ }
+ t->w_count = 0;
+ getmaxyx(stdscr, t->maxy, t->maxx);
+ t->windows[0]->win = newwin(t->maxy, t->maxx, 0, 0);
+ t->windows[t->w_count]->start_y = 0;
+ t->windows[t->w_count]->start_x = 0;
+ t->windows[t->w_count]->height = t->maxy;
+ t->windows[t->w_count]->width = t->maxx;
+ t->w_count++;
- return t;
+ return t;
}
-int wm_fd_w_by_name(terminal *t, const char *name) {
- log_write(LOG_INFO, "w_count = %d", t->w_count);
- for (int i = 0; i < t->w_count; i++) {
- if (strcmp(t->windows[i]->name, name) != 0) continue;
- return i;
- }
+int wm_fd_w_by_name(terminal *t, const char *name)
+{
+ log_write(LOG_INFO, "w_count = %d", t->w_count);
+ for (int i = 0; i < t->w_count; i++) {
+ if (strcmp(t->windows[i]->name, name) != 0)
+ continue;
+ return i;
+ }
- return -1;
+ return -1;
}
-void wm_refresh_all(terminal *t) {
- if (t->windows[0] && t->windows[0]->win) {
- touchwin(t->windows[0]->win);
- }
+void wm_refresh_all(terminal *t)
+{
+ if (t->windows[0] && t->windows[0]->win) {
+ touchwin(t->windows[0]->win);
+ }
- for (int i = 1; i < t->w_count; i++) {
- if (t->windows[i] && t->windows[i]->win) {
- wnoutrefresh(t->windows[i]->win);
- }
- }
+ for (int i = 1; i < t->w_count; i++) {
+ if (t->windows[i] && t->windows[i]->win) {
+ wnoutrefresh(t->windows[i]->win);
+ }
+ }
- doupdate();
+ doupdate();
}