From 360136d0b90ff6f9439c2f3c8c2df4b2e98735ce Mon Sep 17 00:00:00 2001 From: L0Wigh Date: Thu, 11 Sep 2025 15:13:48 +0200 Subject: cleaning the code to respect the guideline --- src/sxwm.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'src/sxwm.c') diff --git a/src/sxwm.c b/src/sxwm.c index 6cb5007..702313e 100644 --- a/src/sxwm.c +++ b/src/sxwm.c @@ -310,23 +310,6 @@ void centre_window(void) XMoveWindow(dpy, focused->win, x, y); } -pid_t get_parent_process(pid_t c) -{ - unsigned int v = 0; - FILE *f; - char buf[256]; - - snprintf(buf, sizeof(buf) - 1, "/proc/%u/stat", (unsigned)c); - if (!(f = fopen(buf, "r"))) { - return 0; - } - - int no_error = fscanf(f, "%*u %*s %*c %u", &v); - (void)no_error; - fclose(f); - return (pid_t)v; -} - void change_workspace(int ws) { if (ws >= NUM_WORKSPACES || ws == current_ws) { @@ -685,6 +668,24 @@ int get_monitor_for(Client *c) return 0; } +pid_t get_parent_process(pid_t c) +{ + unsigned int v = 0; + FILE *f; + char buf[256]; + + snprintf(buf, sizeof(buf) - 1, "/proc/%u/stat", (unsigned)c); + if (!(f = fopen(buf, "r"))) { + return 0; + } + + int no_error = fscanf(f, "%*u %*s %*c %u", &v); + (void)no_error; + fclose(f); + return (pid_t)v; +} + + pid_t get_pid(Window w) { pid_t pid = 0; -- cgit v1.2.3