Re: Maemomm Gdk::Window problem



On Friday 25 January 2008 09:15:37 Murray Cumming wrote:
> On Thu, 2008-01-24 at 18:20 +0200, Lassi Väätämöinen wrote:
> > The code below works fine when compiled on Linux platform (Ubuntu):
> >
> > class MyDrawingArea : public Gtk::DrawingArea {
> >   public:
> >     int getXWinID();
> > };
> >
> >
> > int MyDrawingArea::getXWinID()
> > {
> > 	int xWindowId;
> > 	Glib::RefPtr<Gdk::Window> gwindow = get_window();
> >
> > 	if (gwindow)
> > 	{
> > 		xWindowId = GDK_WINDOW_XID(Glib::unwrap(get_window()));
> > 		std::cout<< "DrawingArea Xwin id: "<< xWindowId <<"\n";
> > 	}
> >
> > 	return xWindowId;
> > }
> >
> >
> > getXWinID() returns the window ID correctly. However, when built and run
> > on Maemo -platform (scratchbox & N800), xWindowId == 0, because the if
> > -branch is not taken, i.e. gwindow == NULL.
>
> When are you calling this? I believe that get_window() only returns a
> window after the widget has been realized. So you should probably be
> doing it in an on_realize() or a signal_realize handler.
>

I call this on_realize(). And as I mentioned, it works on PC platform. 
However, maemomm does not emit the signal_realize() (or something similar) so 
I do not know what I should connect on_realize() to. I tried connecting to 
signal_realize() but that does not work. 

This is not a problem, though -  I can call the function otherwise. BUT on 
maemo it does not work even when calling myWidget.getXWinID() after 
instantiating MyDrawingArea object.

-Lassi 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]