Re: how to get handle of active window

2005-09-08 Thread Karthik Ramamoorthy
On 9/6/05, Karthik Ramamoorthy [EMAIL PROTECTED] wrote:
On 9/6/05, Josip Deanovic 
[EMAIL PROTECTED] wrote:
You can use XQueryTree to get all the windows and then chose only
those you are interested in.

I tried with XQueryTree, but its not giving the proper
window id of the kids. I had opened one shell Terminal window and
Mozilla. I wote the program as below
static char *window_id_format = 0x%lx;
int main(void)
{
 unsigned int numkids, i,mapped,scrn;
 Window r, p, *kids;
 XWindowAttributes attr;
 Window root;
 Display *dipsy;
 char *win_name;
 dipsy = XOpenDisplay(0);
 scrn = DefaultScreen(dipsy);
 root = RootWindow(dipsy, scrn);

 mapped = 0;
 XQueryTree(dipsy, root, r, p, kids, numkids);


 for (i = 0; i  numkids; ++i)
 {
  XGetWindowAttributes(dipsy, kids[i], attr);
  if (attr.map_state == IsViewable) {
   ++mapped;
   printf(window_id_format, kids[i]);
   if
(!XFetchName(dipsy, kids[i], win_name)) { /* Get window name if
any */
printf( (has no name)\n);
printf( \n);
   } else if (win_name) {
printf( %s , win_name);
XFree(win_name);
   }
  }
 } 


Its printing some other window id not that of shell and Mozilla(i
checked it using xwininfo), and also its printing 'no name' instead of
Mozilla or shell Terminal. 


So Josip can u tell me whats wrong with XQueryTree, is it not the
proper function or what. Please guide me regarding this problem

Karthik 

Hi,

 By making some change in the above
code i am able to find all the windows of my root window(by
adding some for loops). Is there any particular class of windows or
code for particular windows like Video players , Audio playes, Browsers
etc.
In windows Video window, Rendering window etc has some particular class or code for them.


 So is there similar
class/code for Video, Audio, Browser window in Xlib/Xserver. If not how
is it possible to identify that this particular window is for Video or
Audio(other than window name comparison because this can change) .

 If somebody can guide me regarding
how to identify particlar windows it will be great help for me.

Karthik

--Josip Deanovic___Devel mailing list
Devel@XFree86.Org
http://XFree86.Org/mailman/listinfo/devel




Re: how to get handle of active window

2005-09-06 Thread Josip Deanovic
Karthik Ramamoorthy [EMAIL PROTECTED] writes:

 Hi All,

 Can anybody tell me how to get handle of the currently active window in 
 Desktop let it be kde or Gnome. Is there any Xlib function to get the 
 handle. One xwininfo command is there, but for it mouse click is required to 
 get the window property. So is there any other command or API through which 
 we can get the various property of the active window in the desktop.

You can use XQueryTree to get all the windows and then chose only
those you are interested in.

 Also through process table or descriptor can we identify what all windows 
 are there?

No.

-- 
Josip Deanovic
___
Devel mailing list
Devel@XFree86.Org
http://XFree86.Org/mailman/listinfo/devel


Re: how to get handle of active window

2005-09-06 Thread Karthik Ramamoorthy
On 9/6/05, Josip Deanovic [EMAIL PROTECTED] wrote:
You can use XQueryTree to get all the windows and then chose onlythose you are interested in.

I tried with XQueryTree, but its not giving the proper
window id of the kids. I had opened one shell Terminal window and
Mozilla. I wote the program as below
static char *window_id_format = 0x%lx;
int main(void)
{
 unsigned int numkids, i,mapped,scrn;
 Window r, p, *kids;
 XWindowAttributes attr;
 Window root;
 Display *dipsy;
 char *win_name;
 dipsy = XOpenDisplay(0);
 scrn = DefaultScreen(dipsy);
 root = RootWindow(dipsy, scrn);

 mapped = 0;
 XQueryTree(dipsy, root, r, p, kids, numkids);


 for (i = 0; i  numkids; ++i)
 {
  XGetWindowAttributes(dipsy, kids[i], attr);
  if (attr.map_state == IsViewable) {
   ++mapped;
   printf(window_id_format, kids[i]);
   if
(!XFetchName(dipsy, kids[i], win_name)) { /* Get window name if
any */
printf( (has no name)\n);
printf( \n);
   } else if (win_name) {
printf( %s , win_name);
XFree(win_name);
   }
  }
 } 


Its printing some other window id not that of shell and Mozilla(i
checked it using xwininfo), and also its printing 'no name' instead of
Mozilla or shell Terminal. 


So Josip can u tell me whats wrong with XQueryTree, is it not the
proper function or what. Please guide me regarding this problem

Karthik   
--Josip Deanovic___Devel mailing list
Devel@XFree86.Orghttp://XFree86.Org/mailman/listinfo/devel