From 2c56327e902fac7d700897e5e8bcc7d6d5e78411 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 7 Jun 2012 18:59:06 +0100 Subject: [PATCH] wip --- cprogs/xacpi-simple.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cprogs/xacpi-simple.c b/cprogs/xacpi-simple.c index 2a392b5..73bea7f 100644 --- a/cprogs/xacpi-simple.c +++ b/cprogs/xacpi-simple.c @@ -485,6 +485,7 @@ static void initacquire(void) { static XrmDatabase xrm; static Display *disp; static int screen; +static const char *parentwindow; static const char defaultresources[]= #define GC(g) @@ -501,6 +502,9 @@ static const XrmOptionDescRec optiontable[]= { { S("-warningTime"), S("*warningTime"), XrmoptionSepArg }, { S("-display"), S("*display"), XrmoptionSepArg }, { S("-geometry"), S("*geometry"), XrmoptionSepArg }, + { S("-into"), S("*parentWindow"), XrmoptionSepArg }, + { S("-icon"), S("*icon"), XrmoptionIsArg }, + { S("-withdrawn"), S("*withdrawn"), XrmoptionIsArg }, #define GC(g) #define C(c,u) \ { S("-" #u "Color"), S("*" #u "Color"), XrmoptionSepArg }, \ @@ -574,6 +578,8 @@ static void parseargs(int argc, char **argv) { const char *alarmlevel_string= getresource("alarmLevel"); alarmlevel = alarmlevel_string ? atoi(alarmlevel_string) : 300; + parentwindow = getresource("parentWindow"); + disp= XOpenDisplay(getresource("display")); if (!disp) fail("could not open display"); @@ -742,7 +748,13 @@ static void initgraphics(int argc, char **argv) { &width, &height, &gravity); - win= XCreateSimpleWindow(disp,DefaultRootWindow(disp), + unsigned long parentwindowid; + if (parentwindow) + parentwindowid = strtoul(parentwindow,0,0); + else + parentwindowid = DefaultRootWindow(disp); + + win= XCreateSimpleWindow(disp,parentwindowid, pos_x,pos_y,width,height,0,0,0); cmap= DefaultColormap(disp,screen); @@ -767,6 +779,9 @@ static void initgraphics(int argc, char **argv) { wm_hints->flags= InputHint; wm_hints->input= False; + wm_hints->initial_state= (getresource("withdrawn") ? WithdrawnState : + getresource("icon") ? IconicState + : NormalState); class_hint->res_name= program_name_silly; class_hint->res_class= program_name_silly; -- 2.30.2