forked from enlightenment/enlightenment
make it a single property - have to parse it now tho.
SVN revision: 15116
This commit is contained in:
parent
7a7f286d44
commit
6468e0cef0
|
@ -1,6 +1,23 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "e_hack.h"
|
#include "e_hack.h"
|
||||||
|
|
||||||
|
/* FIXME:
|
||||||
|
* * gnome-terminal does this funky thing where a new gnome-temrinal process
|
||||||
|
* tries to message an existing one asking it to create a new terminal. this
|
||||||
|
* means none of these properties ever end up on a new term window - in fact
|
||||||
|
* only the ones that are on the first term process. we need a way of knowing
|
||||||
|
* this, OR making sure no new iwndows other than the first appear with these
|
||||||
|
* properties. this also leads to handling splash windows - we might want then
|
||||||
|
* the first 2 or 3 windows with it.
|
||||||
|
*
|
||||||
|
* we need to discuss this... it's an interesting hack that solves a LOT of
|
||||||
|
* things (and that we can maybe in future expand to hacking away at gtk and
|
||||||
|
* qt directly)
|
||||||
|
*
|
||||||
|
* anyway - for now this is fairly harmless and just adds a property to all
|
||||||
|
* top-level app windows
|
||||||
|
*/
|
||||||
|
|
||||||
/* prototypes */
|
/* prototypes */
|
||||||
static void __e_hack_set_properties(Display *display, Window window);
|
static void __e_hack_set_properties(Display *display, Window window);
|
||||||
|
|
||||||
|
@ -11,65 +28,62 @@ static void *lib_xlib = NULL;
|
||||||
static void
|
static void
|
||||||
__e_hack_set_properties(Display *display, Window window)
|
__e_hack_set_properties(Display *display, Window window)
|
||||||
{
|
{
|
||||||
static Atom a_launch_id = 0;
|
static Atom a_hack = 0;
|
||||||
static Atom a_user_id = 0;
|
|
||||||
static Atom a_process_id = 0;
|
|
||||||
static Atom a_p_process_id = 0;
|
|
||||||
static Atom a_machine_name = 0;
|
|
||||||
static Atom a_user_name = 0;
|
|
||||||
static Atom a_desk = 0;
|
|
||||||
static Atom a_zone = 0;
|
|
||||||
static Atom a_container = 0;
|
|
||||||
static Atom a_manager = 0;
|
|
||||||
char *env = NULL;
|
char *env = NULL;
|
||||||
|
char buf[4096];
|
||||||
|
char buf2[4096];
|
||||||
|
uid_t uid;
|
||||||
|
pid_t pid, ppid;
|
||||||
|
struct utsname ubuf;
|
||||||
|
|
||||||
if (!a_launch_id) a_launch_id = XInternAtom(display, "_E_HACK_LAUNCH_ID", False);
|
if (!a_hack) a_hack = XInternAtom(display, "__E_HACK", False);
|
||||||
if (!a_user_id) a_user_id = XInternAtom(display, "_E_HACK_USER_ID", False);
|
buf[0] = 0;
|
||||||
if (!a_process_id) a_process_id = XInternAtom(display, "_E_HACK_PROCESS_ID", False);
|
buf[sizeof(buf) - 1] = 0;
|
||||||
if (!a_p_process_id) a_p_process_id = XInternAtom(display, "_E_HACK_PARENT_PROCESS_ID", False);
|
uid = getuid();
|
||||||
if (!a_machine_name) a_machine_name = XInternAtom(display, "_E_HACK_MACHINE_NAME", False);
|
snprintf(buf2, sizeof(buf2), "uid: %i\n", uid);
|
||||||
if (!a_user_name) a_user_name = XInternAtom(display, "_E_HACK_USER_NAME", False);
|
strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1);
|
||||||
if (!a_desk) a_desk = XInternAtom(display, "_E_HACK_DESK", False);
|
pid = getpid();
|
||||||
if (!a_zone) a_zone = XInternAtom(display, "_E_HACK_ZONE", False);
|
snprintf(buf2, sizeof(buf2), "pid: %i\n", pid);
|
||||||
if (!a_container) a_container = XInternAtom(display, "_E_HACK_CONTAINER", False);
|
strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1);
|
||||||
if (!a_manager) a_manager = XInternAtom(display, "_E_HACK_MANAGER", False);
|
ppid = getppid();
|
||||||
|
snprintf(buf2, sizeof(buf2), "ppid: %i\n", ppid);
|
||||||
if ((env = getenv("E_LAUNCH_ID")))
|
strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1);
|
||||||
XChangeProperty(display, window, a_launch_id, XA_STRING, 8, PropModeReplace, (unsigned char *)env, strlen(env));
|
if (!uname(&ubuf))
|
||||||
{
|
{
|
||||||
uid_t uid;
|
snprintf(buf2, sizeof(buf2), "machine_name: %s\n", ubuf.nodename);
|
||||||
pid_t pid, ppid;
|
strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1);
|
||||||
struct utsname ubuf;
|
}
|
||||||
char buf[4096];
|
if ((env = getenv("E_LAUNCH_ID")))
|
||||||
|
{
|
||||||
uid = getuid();
|
snprintf(buf2, sizeof(buf2), "launch_id: %s\n", env);
|
||||||
pid = getpid();
|
strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1);
|
||||||
ppid = getppid();
|
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%i", uid);
|
|
||||||
XChangeProperty(display, window, a_user_id, XA_STRING, 8, PropModeReplace, (unsigned char *)buf, strlen(buf));
|
|
||||||
snprintf(buf, sizeof(buf), "%i", pid);
|
|
||||||
XChangeProperty(display, window, a_process_id, XA_STRING, 8, PropModeReplace, (unsigned char *)buf, strlen(buf));
|
|
||||||
snprintf(buf, sizeof(buf), "%i", ppid);
|
|
||||||
XChangeProperty(display, window, a_p_process_id, XA_STRING, 8, PropModeReplace, (unsigned char *)buf, strlen(buf));
|
|
||||||
if (!uname(&ubuf))
|
|
||||||
{
|
|
||||||
snprintf(buf, sizeof(buf), "%s", ubuf.nodename);
|
|
||||||
XChangeProperty(display, window, a_machine_name, XA_STRING, 8, PropModeReplace, (unsigned char *)buf, strlen(buf));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
XChangeProperty(display, window, a_machine_name, XA_STRING, 8, PropModeReplace, (unsigned char *)" ", 1);
|
|
||||||
}
|
}
|
||||||
if ((env = getenv("USER")))
|
if ((env = getenv("USER")))
|
||||||
XChangeProperty(display, window, a_user_name, XA_STRING, 8, PropModeReplace, (unsigned char *)env, strlen(env));
|
{
|
||||||
|
snprintf(buf2, sizeof(buf2), "username: %s\n", env);
|
||||||
|
strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1);
|
||||||
|
}
|
||||||
if ((env = getenv("E_DESK")))
|
if ((env = getenv("E_DESK")))
|
||||||
XChangeProperty(display, window, a_desk, XA_STRING, 8, PropModeReplace, (unsigned char *)env, strlen(env));
|
{
|
||||||
|
snprintf(buf2, sizeof(buf2), "e_desk: %s\n", env);
|
||||||
|
strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1);
|
||||||
|
}
|
||||||
if ((env = getenv("E_ZONE")))
|
if ((env = getenv("E_ZONE")))
|
||||||
XChangeProperty(display, window, a_zone, XA_STRING, 8, PropModeReplace, (unsigned char *)env, strlen(env));
|
{
|
||||||
|
snprintf(buf2, sizeof(buf2), "e_zone: %s\n", env);
|
||||||
|
strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1);
|
||||||
|
}
|
||||||
if ((env = getenv("E_CONTAINER")))
|
if ((env = getenv("E_CONTAINER")))
|
||||||
XChangeProperty(display, window, a_container, XA_STRING, 8, PropModeReplace, (unsigned char *)env, strlen(env));
|
{
|
||||||
|
snprintf(buf2, sizeof(buf2), "e_container: %s\n", env);
|
||||||
|
strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1);
|
||||||
|
}
|
||||||
if ((env = getenv("E_MANAGER")))
|
if ((env = getenv("E_MANAGER")))
|
||||||
XChangeProperty(display, window, a_manager, XA_STRING, 8, PropModeReplace, (unsigned char *)env, strlen(env));
|
{
|
||||||
|
snprintf(buf2, sizeof(buf2), "e_manager: %s\n", env);
|
||||||
|
strncat(buf, buf2, sizeof(buf) - strlen(buf) - 1);
|
||||||
|
}
|
||||||
|
XChangeProperty(display, window, a_hack, XA_STRING, 8, PropModeReplace, (unsigned char *)buf, strlen(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XCreateWindow intercept hack */
|
/* XCreateWindow intercept hack */
|
||||||
|
|
Loading…
Reference in New Issue