Bug #10016: Implement WM_CLASS hints in Xephyr.
This commit is contained in:
parent
862ff9ac92
commit
f028e245a7
|
@ -28,6 +28,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
#include <libgen.h>
|
||||||
|
|
||||||
#include "os.h" /* for OsSignal() */
|
#include "os.h" /* for OsSignal() */
|
||||||
#include "kdrive.h"
|
#include "kdrive.h"
|
||||||
|
|
|
@ -109,6 +109,7 @@ ddxUseMsg (void)
|
||||||
ErrorF("-nodri do not use DRI\n");
|
ErrorF("-nodri do not use DRI\n");
|
||||||
#endif
|
#endif
|
||||||
ErrorF("-noxv do not use XV\n");
|
ErrorF("-noxv do not use XV\n");
|
||||||
|
ErrorF("-name [name] define the name in the WM_CLASS property\n");
|
||||||
ErrorF("\n");
|
ErrorF("\n");
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -148,6 +149,11 @@ ddxProcessArgument (int argc, char **argv, int i)
|
||||||
{
|
{
|
||||||
EPHYR_DBG("mark argv[%d]='%s'", i, argv[i] );
|
EPHYR_DBG("mark argv[%d]='%s'", i, argv[i] );
|
||||||
|
|
||||||
|
if (i == 1)
|
||||||
|
{
|
||||||
|
hostx_use_resname(basename(argv[0]), 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (!strcmp (argv[i], "-parent"))
|
if (!strcmp (argv[i], "-parent"))
|
||||||
{
|
{
|
||||||
if(i+1 < argc)
|
if(i+1 < argc)
|
||||||
|
@ -223,6 +229,19 @@ ddxProcessArgument (int argc, char **argv, int i)
|
||||||
EPHYR_LOG ("no XVideo enabled\n") ;
|
EPHYR_LOG ("no XVideo enabled\n") ;
|
||||||
return 1 ;
|
return 1 ;
|
||||||
}
|
}
|
||||||
|
else if (!strcmp (argv[i], "-name"))
|
||||||
|
{
|
||||||
|
if (i+1 < argc && argv[i+1][0] != '-')
|
||||||
|
{
|
||||||
|
hostx_use_resname(argv[i+1], 1);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UseMsg();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (argv[i][0] == ':')
|
else if (argv[i][0] == ':')
|
||||||
{
|
{
|
||||||
hostx_set_display_name(argv[i]);
|
hostx_set_display_name(argv[i]);
|
||||||
|
|
|
@ -107,6 +107,9 @@ extern EphyrKeySyms ephyrKeySyms;
|
||||||
|
|
||||||
extern int monitorResolution;
|
extern int monitorResolution;
|
||||||
|
|
||||||
|
char *ephyrResName = NULL;
|
||||||
|
int ephyrResNameFromCmd = 0;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
hostx_set_fullscreen_hint(void);
|
hostx_set_fullscreen_hint(void);
|
||||||
|
|
||||||
|
@ -296,6 +299,13 @@ hostx_handle_signal (int signum)
|
||||||
HostXWantDamageDebug);
|
HostXWantDamageDebug);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
hostx_use_resname (char *name, int fromcmd)
|
||||||
|
{
|
||||||
|
ephyrResName = name;
|
||||||
|
ephyrResNameFromCmd = fromcmd;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
hostx_init (void)
|
hostx_init (void)
|
||||||
{
|
{
|
||||||
|
@ -304,6 +314,8 @@ hostx_init (void)
|
||||||
Pixmap cursor_pxm;
|
Pixmap cursor_pxm;
|
||||||
XColor col;
|
XColor col;
|
||||||
int index;
|
int index;
|
||||||
|
char *tmpstr;
|
||||||
|
XClassHint *class_hint;
|
||||||
|
|
||||||
attr.event_mask =
|
attr.event_mask =
|
||||||
ButtonPressMask
|
ButtonPressMask
|
||||||
|
@ -327,6 +339,8 @@ hostx_init (void)
|
||||||
HostX.depth = DefaultDepth(HostX.dpy, HostX.screen);
|
HostX.depth = DefaultDepth(HostX.dpy, HostX.screen);
|
||||||
HostX.visual = DefaultVisual(HostX.dpy, HostX.screen);
|
HostX.visual = DefaultVisual(HostX.dpy, HostX.screen);
|
||||||
|
|
||||||
|
class_hint = XAllocClassHint();
|
||||||
|
|
||||||
for (index = 0 ; index < HostX.n_screens ; index++)
|
for (index = 0 ; index < HostX.n_screens ; index++)
|
||||||
{
|
{
|
||||||
struct EphyrHostScreen *host_screen = &HostX.screens[index];
|
struct EphyrHostScreen *host_screen = &HostX.screens[index];
|
||||||
|
@ -389,9 +403,23 @@ hostx_init (void)
|
||||||
|
|
||||||
hostx_set_fullscreen_hint();
|
hostx_set_fullscreen_hint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (class_hint)
|
||||||
|
{
|
||||||
|
tmpstr = getenv("RESOURCE_NAME");
|
||||||
|
if (tmpstr && (!ephyrResNameFromCmd))
|
||||||
|
ephyrResName = tmpstr;
|
||||||
|
class_hint->res_name = ephyrResName;
|
||||||
|
class_hint->res_class = "Xephyr";
|
||||||
|
XSetClassHint(hostx_get_display(), host_screen->win, class_hint);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (class_hint)
|
||||||
|
XFree(class_hint);
|
||||||
|
|
||||||
XParseColor (HostX.dpy, DefaultColormap (HostX.dpy,HostX.screen),
|
XParseColor (HostX.dpy, DefaultColormap (HostX.dpy,HostX.screen),
|
||||||
"red", &col);
|
"red", &col);
|
||||||
|
|
|
@ -145,6 +145,9 @@ hostx_want_preexisting_window(EphyrScreenInfo screen);
|
||||||
void
|
void
|
||||||
hostx_use_preexisting_window(unsigned long win_id);
|
hostx_use_preexisting_window(unsigned long win_id);
|
||||||
|
|
||||||
|
void
|
||||||
|
hostx_use_resname (char *name, int fromcmd);
|
||||||
|
|
||||||
void
|
void
|
||||||
hostx_handle_signal(int signum);
|
hostx_handle_signal(int signum);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue