diff options
| author | L0Wigh <mathiotthomas@gmail.com> | 2025-09-11 15:13:48 +0200 |
|---|---|---|
| committer | L0Wigh <mathiotthomas@gmail.com> | 2025-09-11 15:13:48 +0200 |
| commit | 360136d0b90ff6f9439c2f3c8c2df4b2e98735ce (patch) | |
| tree | e0a2af538104669491c78e8d6cc9df105234d9be | |
| parent | faba2d069e4b7bcbfaf70866dc7302ec10db0da5 (diff) | |
cleaning the code to respect the guideline
| -rw-r--r-- | src/sxwm.c | 35 |
1 files changed, 18 insertions, 17 deletions
@@ -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; |
