Move program title to "src/main.c"

This commit is contained in:
Alex Kotov 2021-11-22 03:57:22 +05:00
parent 9f1b2ef0da
commit 69e0c4185c
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
4 changed files with 13 additions and 8 deletions

View File

@ -1,7 +1,5 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
static const char wm_name[] = "PolytreeWM";
/* appearance */ /* appearance */
static const char *fonts[] = { "monospace:size=10" }; static const char *fonts[] = { "monospace:size=10" };

View File

@ -229,6 +229,8 @@ static void zoom(const Arg *arg);
* variables * * variables *
*************/ *************/
static const char *program_title = NULL;
static struct Screen screen = { static struct Screen screen = {
.sizes = { 0, 0 }, .sizes = { 0, 0 },
.x_screen = 0, .x_screen = 0,
@ -280,8 +282,12 @@ static void (*handler[LASTEvent])(XEvent*) = {
* Public function implementations * * Public function implementations *
***********************************/ ***********************************/
int dwm_main() int dwm_main(const char *const new_program_title)
{ {
if (!(program_title = new_program_title)) {
fatal("no program title is given");
}
if (!XSupportsLocale()) { if (!XSupportsLocale()) {
warning("no locale support in X"); warning("no locale support in X");
} }
@ -2195,8 +2201,8 @@ void wmcheckwin_create()
8, 8,
PropModeReplace, PropModeReplace,
(unsigned char*) (unsigned char*)
wm_name, program_title,
strlen(wm_name) strlen(program_title)
); );
XChangeProperty( XChangeProperty(
dpy, dpy,

View File

@ -1,6 +1,6 @@
#ifndef _DWM_H #ifndef _DWM_H
#define _DWM_H #define _DWM_H
int dwm_main(); int dwm_main(const char *program_title);
#endif // _DWM_H #endif // _DWM_H

View File

@ -12,7 +12,8 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
#define PROGRAM_NAME "polytreewm" #define PROGRAM_TITLE "PolytreeWM"
#define PROGRAM_NAME "polytreewm"
static char *program_exe = NULL; static char *program_exe = NULL;
@ -57,7 +58,7 @@ int main(int argc, char *argv[])
} }
} }
exit(dwm_main(argc, argv)); exit(dwm_main(PROGRAM_TITLE));
} }
void signal_callback(const int signo) void signal_callback(const int signo)