sarge Chris | 1 Oct 2002 03:35
Picon
Favicon

Help me in the relationship between Xlib's windowID and GTK widget

Hi experts,

Here I met a problem:

Suppose there are two GTK apps A and B,

A can get B's window ID by XQueryTree, but how can A get the GtkWidget of B by its Xlib's WindowID?

Is it possible? If so, pls give me a hand!

Thanks a lot!


Post your free ad now! Yahoo! Canada Personals
James Henstridge | 1 Oct 2002 03:55
Picon

Re: Help me in the relationship between Xlib's windowID and GTK widget


sarge Chris wrote:

> Hi experts,
>
> Here I met a problem:
>
> Suppose there are two GTK apps A and B,
>
> A can get B's window ID by XQueryTree, but how can A get the GtkWidget 
> of B by its Xlib's WindowID?
>
> Is it possible? If so, pls give me a hand!
>
> Thanks a lot!
>
X windows are a server resources, which is why one app can see the 
windows of another.  However, the GtkWidget structures are client side, 
so you can't access them, so what you ask isn't really possible.

Without knowing what you are trying to do, it is a bit difficult to 
recommend an alternative.  For some problems, Bonobo might be the answer.

James.

--

-- 
Email: james <at> daa.com.au              | Linux.conf.au   http://linux.conf.au/
WWW:   http://www.daa.com.au/~james/ | Jan 22-25   Perth, Western Australia. 
Krzysztof Garus | 1 Oct 2002 13:46
Picon

libZVT and threads


hello,

I have problem with ZvtTerm and pthreads. These are some situations:

0. start a program
1. zvt_term_forkpty
it works.

0. start a program
1. pthread_create
2. zvt_term_forkpty (hangs)

0. start a program
1. zvt_term_forkpty
2. pthread_create
3. zvt_term_forkpty
4. (child) execv (hangs)

I compile my program with _REENTRANT defined and I do not use any
mutexes.

why it doesn't work?
--

-- 
Krzysztof Garus <kgarus <at> bigfoot.com>               Linux User 171721
http://www.bigfoot.com/~kgarus
sarge Chris | 1 Oct 2002 16:01
Picon
Favicon

Re: Help me in the relationship between Xlib's windowID and GTK widget

Thank your reply. Actually I want to implement one GTK application can simulate user input for other application, for example, my application can "fill" the editbox of B window, then "press" the OK button of B window, such actions are implemented by sending GTK event to them from my application, just like the user input to B.

I've tried many ways to get the GtkWidget of editbox and button but no result, can I use gnome API or windows manager(such as sawfish) to do it, Or other method? I use C/C++.

Thanks again!

  James Henstridge <james <at> daa.com.au> wrote:

sarge Chris wrote:

> Hi experts,
>
> Here I met a problem:
>
> Suppose there are two GTK apps A and B,
>
> A can get B's window ID by XQueryTree, but how can A get the GtkWidget
> of B by its Xlib's WindowID?
>
> Is it possible? If so, pls give me a hand!
>
> Thanks a lot!
>
X windows are a server resources, which is why one app can see the
windows of another. However, the GtkWidget structures are client side,
so you can't access them, so what you ask isn't really possible.

Without knowing what you are trying to do, it is a bit difficult to
recommend an alternative. For some problems, Bonobo might be the answer.

James.

--
Email: james <at> daa.com.au | Linux.conf.au http://linux.conf.au/
WWW: http://www.daa.com.au/~~james/ | Jan 22-25 Perth, Western Australia.



Post your free ad now! Yahoo! Canada Personals
James Henstridge | 1 Oct 2002 16:06
Picon

Re: Help me in the relationship between Xlib's windowID and GTK widget


sarge Chris wrote:

> Thank your reply. Actually I want to implement one GTK application can 
> simulate user input for other application, for example, my application 
> can "fill" the editbox of B window, then "press" the OK button of B 
> window, such actions are implemented by sending GTK event to them from 
> my application, just like the user input to B.
>
> I've tried many ways to get the GtkWidget of editbox and button but no 
> result, can I use gnome API or windows manager(such as sawfish) to do 
> it, Or other method? I use C/C++.
>
You might want to investigate the at-spi APIs.  This API is designed for 
out of process accessibility tools to inspect the user interface of an 
application, and activate the various actions made available by various 
UI components.

It should provide the support necessary to do the sort of remote control 
you are after (even though you aren't doing an accessibility specific app).

James.

--

-- 
Email: james <at> daa.com.au              | Linux.conf.au   http://linux.conf.au/
WWW:   http://www.daa.com.au/~james/ | Jan 22-25   Perth, Western Australia. 
Clancy, Shane W. | 1 Oct 2002 16:03

RE: Help me in the relationship between Xlib's windowID and GTK w idget


this is ugly, i know -- but if you know the name (title) of app B, you can
pipe a call to xwininfo to get the X windows ID number for it.

shane

-----Original Message-----
From: James Henstridge [mailto:james <at> daa.com.au]
Sent: Monday, September 30, 2002 9:55 PM
To: sarge Chris
Cc: gnome-devel-list <at> gnome.org
Subject: Re: Help me in the relationship between Xlib's windowID and GTK
widget

sarge Chris wrote:

> Hi experts,
>
> Here I met a problem:
>
> Suppose there are two GTK apps A and B,
>
> A can get B's window ID by XQueryTree, but how can A get the GtkWidget 
> of B by its Xlib's WindowID?
>
> Is it possible? If so, pls give me a hand!
>
> Thanks a lot!
>
X windows are a server resources, which is why one app can see the 
windows of another.  However, the GtkWidget structures are client side, 
so you can't access them, so what you ask isn't really possible.

Without knowing what you are trying to do, it is a bit difficult to 
recommend an alternative.  For some problems, Bonobo might be the answer.

James.

--

-- 
Email: james <at> daa.com.au              | Linux.conf.au   http://linux.conf.au/
WWW:   http://www.daa.com.au/~james/ | Jan 22-25   Perth, Western Australia.

_______________________________________________
gnome-devel-list mailing list
gnome-devel-list <at> gnome.org
http://mail.gnome.org/mailman/listinfo/gnome-devel-list
sarge Chris | 1 Oct 2002 16:43
Picon
Favicon

Re: Help me in the relationship between Xlib's windowID and GTK widget

Thank you all, I've know the window ID of B by XQueryTree and XFetchname, but the things is I can't send GTK event when I only know Xlib's window ID, the GtkWidget of the B application is needed.

I'm reading AT-SPI, it should be helpful. But it's designed for GNOME, if I want to port my application to KDE, how can I do? Does it have a universal interface?

Cheers!

  James Henstridge <james <at> daa.com.au> wrote:

sarge Chris wrote:

> Thank your reply. Actually I want to implement one GTK application can
> simulate user input for other application, for example, my application
> can "fill" the editbox of B window, then "press" the OK button of B
> window, such actions are implemented by sending GTK event to them from
> my application, just like the user input to B.
>
> I've tried many ways to get the GtkWidget of editbox and button but no
> result, can I use gnome API or windows manager(such as sawfish) to do
> it, Or other method? I use C/C++.
>
You might want to investigate the at-spi APIs. This API is designed for
out of process accessibility tools to inspect the user interface of an
application, and activate the various actions made available by various
UI components.

It should provide the support necessar y to do the sort of remote control
you are after (even though you aren't doing an accessibility specific app).

James.

--
Email: james <at> daa.com.au | Linux.conf.au http://linux.conf.au/
WWW: http://www.daa.com.au/~~james/ | Jan 22-25 Perth, Western Australia.




Post your free ad now! Yahoo! Canada Personals
M G Berberich | 2 Oct 2002 19:20
Picon
Favicon

multiload-applet-2 bug

Hello,

have you ever realised that the multiload-applets graphs are off by 3
pixels in the time-axis? This bug existed in gnome 1.4 and still is in
gnome 2.

This is because

a) the frame around the graphs is 2 pixels wide -- on both sides.
   so we have to subtract 4 instead of 2.

b) there is a simple "off-by-one" error in the drawing loop.

patch against gnome-applets-2.0.3 is attached. Any chance to get it
into gnome?

	MfG
	bmg

-- 
"Des is völlig wurscht, was heut beschlos- | M G Berberich
 sen wird: I bin sowieso dagegn!"          | berberic <at> fmi.uni-passau.de
(SPD-Stadtrat Kurt Schindler; Regensburg)  |
diff -Naur gnome-applets-2.0.3-orig/multiload/load-graph.c gnome-applets-2.0.3-bmg/multiload/load-graph.c
--- gnome-applets-2.0.3-orig/multiload/load-graph.c	Fri Sep 13 21:59:22 2002
+++ gnome-applets-2.0.3-bmg/multiload/load-graph.c	Wed Oct  2 19:04:40 2002
 <at>  <at>  -65,8 +65,8  <at>  <at> 

 		for (i = 0; i < g->draw_width; i++) {
 	 	   gdk_draw_line (g->pixmap, g->gc,
-				  g->draw_width - i, g->pos[i],
-			 	  g->draw_width - i, g->pos[i] - g->data[i][j]);
+				  g->draw_width - i - 1, g->pos[i],
+			 	  g->draw_width - i - 1, g->pos[i] - g->data[i][j]);

 		    g->pos [i] -= g->data [i][j];
 		}
 <at>  <at>  -172,12 +172,12  <at>  <at> 
     load_graph_unalloc (c);

     if (c->orient) {
-    	c->draw_width = c->pixel_size - 2;
-    	c->draw_height = c->size - 2;
+    	c->draw_width = c->pixel_size - 4;
+    	c->draw_height = c->size - 4;
     }
     else {
-    	c->draw_width = c->size - 2;
-    	c->draw_height = c->pixel_size - 2;
+    	c->draw_width = c->size - 4;
+    	c->draw_height = c->pixel_size - 4;
     }

     load_graph_alloc (c);
 <at>  <at>  -301,12 +301,12  <at>  <at> 
     }

     if (g->orient) {
-    	g->draw_width = g->pixel_size - 2;
-    	g->draw_height = g->size - 2;
+    	g->draw_width = g->pixel_size - 4;
+    	g->draw_height = g->size - 4;
     }
     else {
-    	g->draw_width = g->size - 2;
-    	g->draw_height = g->pixel_size - 2;
+    	g->draw_width = g->size - 4;
+    	g->draw_height = g->pixel_size - 4;
     }

     load_graph_alloc (g);	
Malcolm Tredinnick | 2 Oct 2002 23:30
Picon
Favicon

Re: multiload-applet-2 bug


On Wed, Oct 02, 2002 at 07:20:46PM +0200, M G Berberich wrote:
> Hello,
> 
> have you ever realised that the multiload-applets graphs are off by 3
> pixels in the time-axis? This bug existed in gnome 1.4 and still is in
> gnome 2.
> 
> This is because
> 
> a) the frame around the graphs is 2 pixels wide -- on both sides.
>    so we have to subtract 4 instead of 2.
> 
> b) there is a simple "off-by-one" error in the drawing loop.
> 
> patch against gnome-applets-2.0.3 is attached. Any chance to get it
> into gnome?

Hmm. Nice work. The chances of this being applied are larger if you put
it into bugzilla. That way the maintainer will be notified explicitly
and he can track down all pending patches easily.

(Note: I am not the maintainer or in any way qualified to comment on the
patch.  This is just your standard "bug reports go in bugzilla"
announcement. :-) )

Cheers,
Malcolm
Sergey V. Udaltsov | 3 Oct 2002 00:10
Picon

Re: Help in the relationship between Xlib windowID and GTK widget


> There are two application A and B written by GTK,
            ^^^^^^^^^^^^^^^
> but how can I get the corresponding GtkWidget* pointer of B window so that I 
                                      ^^^^^^^^^^^^^^^^^^

There are 2 apps. 2 address spaces. What pointer are you talking
about??? You can only deal with GtkWidget* in your address space. So:
use CORBA/Bonobo/signals/pipes/GConf:) - any IPC way of communicating
with another Gtk object. But! If you just want send X messages - do it
using X API (I do not remember exactly, are there any GTK wrappers
around X message sending). Anyway, forget about GtkWidget* from another
application.

Cheers,

Sergey

Gmane