I'm using ubuntu hardy with wxWidgets 2.8. I need to get XID from a window for image stream display, so I used the following:
wxWindow* window_;
...
GtkWidget* widget = window_->GetHandle();
XID xid = GDK_WINDOW_XWINDOW(widget->window);
This does not give any error, but no image gets shown. I tried using paint event to draw the images, and it worked. So I wonder, for the XID approach to work, is there some specific settings that I missed, or procedures to be taken for creating a window? And is wxWindow the right class?
The example codes I have (to use the XID) was in gtk, and it worked fine:
GtkWidget* drawing_area = gtk_drawing_area_new ();
...
XID xid = GDK_WINDOW_XWINDOW(drawing_area->window);
So I got another question that is there a way to get a GtkWidget pointer equivilant to the result of gtk_drawing_area_new(), out of either wxWindow or any other wxWidget class?
Thanks
GtkWindow from wxWindow GetHandle Topic is solved
Hi!
I had the same problems when trying to tell VLC to use a wxWidgets control for video output.
Here's how I managed that for 2.8:
For 2.9 I had to use a different way, as the internal window handling changed:
In both cases "output" is the widget (in my case a panel) I use for displaying the video output.
I'm pretty sure that the 2.9 could be simplified, but I was tired of digging deeper into that, as this already took me some time to find out.
Hope this helps!
I had the same problems when trying to tell VLC to use a wxWidgets control for video output.
Here's how I managed that for 2.8:
Code: Select all
GdkWindow* win = GTK_PIZZA(output->m_wxwindow)->bin_window;
vlc_media_player_set_xwindow (m_media_player_inst,GDK_WINDOW_XID(win));
Code: Select all
GtkWidget* widget = output->GetHandle();
gtk_widget_realize( widget ); // Mandatory. Otherwise it segfaults.
Display* display = GDK_WINDOW_XDISPLAY( widget->window );
Window wid = GDK_WINDOW_XWINDOW( widget->window ); // Window is a typedef for XID, which is a typedef for unsigned int
vlc_media_player_set_xwindow (m_media_player_inst, wid);
I'm pretty sure that the 2.9 could be simplified, but I was tired of digging deeper into that, as this already took me some time to find out.
Hope this helps!
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4
"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4
"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda