xephyr: Add -title option.

This commit is contained in:
Adam Jackson 2009-06-10 12:05:09 -04:00
parent 8035223003
commit e3c65cf1df
3 changed files with 39 additions and 10 deletions

View File

@ -110,6 +110,7 @@ ddxUseMsg (void)
#endif
ErrorF("-noxv do not use XV\n");
ErrorF("-name [name] define the name in the WM_CLASS property\n");
ErrorF("-title [title] set the window title in the WM_NAME property\n");
ErrorF("\n");
exit(1);
@ -242,6 +243,19 @@ ddxProcessArgument (int argc, char **argv, int i)
return 0;
}
}
else if (!strcmp (argv[i], "-title"))
{
if (i+1 < argc && argv[i+1][0] != '-')
{
hostx_set_title(argv[i+1]);
return 2;
}
else
{
UseMsg();
return 0;
}
}
else if (argv[i][0] == ':')
{
hostx_set_display_name(argv[i]);

View File

@ -122,6 +122,7 @@ extern int monitorResolution;
char *ephyrResName = NULL;
int ephyrResNameFromCmd = 0;
char *ephyrTitle = NULL;
static void
hostx_set_fullscreen_hint(void);
@ -222,20 +223,25 @@ hostx_set_screen_number(EphyrScreenInfo screen, int number)
void
hostx_set_win_title (EphyrScreenInfo screen, char *extra_text)
{
struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen);
#define BUF_LEN 256
char buf[BUF_LEN+1];
struct EphyrHostScreen *host_screen = host_screen_from_screen_info (screen);
if (!host_screen)
if (!host_screen)
return;
memset (buf, 0, BUF_LEN+1) ;
snprintf (buf, BUF_LEN, "Xephyr on %s.%d %s",
HostX.server_dpy_name,
host_screen->mynum,
(extra_text != NULL) ? extra_text : "");
if (ephyrTitle) {
XStoreName(HostX.dpy, host_screen->win, ephyrTitle);
} else {
#define BUF_LEN 256
char buf[BUF_LEN+1];
XStoreName (HostX.dpy, host_screen->win, buf);
memset (buf, 0, BUF_LEN+1) ;
snprintf (buf, BUF_LEN, "Xephyr on %s.%d %s",
HostX.server_dpy_name,
host_screen->mynum,
(extra_text != NULL) ? extra_text : "");
XStoreName (HostX.dpy, host_screen->win, buf);
}
}
int
@ -319,6 +325,12 @@ hostx_use_resname (char *name, int fromcmd)
ephyrResNameFromCmd = fromcmd;
}
void
hostx_set_title (char *title)
{
ephyrTitle = title;
}
int
hostx_init (void)
{

View File

@ -148,6 +148,9 @@ hostx_use_preexisting_window(unsigned long win_id);
void
hostx_use_resname (char *name, int fromcmd);
void
hostx_set_title(char *name);
void
hostx_handle_signal(int signum);