From 79649335074df082c71bb796665ebfe91dace577 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Sun, 16 Nov 2014 13:54:07 +0100 Subject: [PATCH] wx: use wx_pizza on wx2.8 The new method creates a strange gray box for some users. Unknown status on wx3.0 (which soon will be the default) --- pcsx2/gui/AppMain.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pcsx2/gui/AppMain.cpp b/pcsx2/gui/AppMain.cpp index 751cd423c6..286bbc92f7 100644 --- a/pcsx2/gui/AppMain.cpp +++ b/pcsx2/gui/AppMain.cpp @@ -39,6 +39,11 @@ #endif #ifdef __WXGTK__ + +#if wxMAJOR_VERSION < 3 +#include // GTK_PIZZA interface (internal include removed in 3.0) +#endif + #include #include #endif @@ -878,12 +883,26 @@ void Pcsx2App::OpenGsPanel() // Unfortunately there is a race condition between gui and gs threads when you called the // GDK_WINDOW_* macro. To be safe I think it is best to do here. It only cost a slight // extension (fully compatible) of the plugins API. -- Gregory + + // GTK_PIZZA is an internal interface of wx, therefore they decide to + // remove it on wx 3. I tryed to replace it with gtk_widget_get_window but + // unfortunately it creates a gray box in the middle of the window on some + // users. + +#if wxMAJOR_VERSION < 3 + GtkWidget *child_window = gtk_bin_get_child(GTK_BIN(gsFrame->GetViewport()->GetHandle())); +#else GtkWidget *child_window = (GtkWidget*)GTK_BIN(gsFrame->GetViewport()->GetHandle()); +#endif gtk_widget_realize(child_window); // create the widget to allow to use GDK_WINDOW_* macro gtk_widget_set_double_buffered(child_window, false); // Disable the widget double buffer, you will use the opengl one +#if wxMAJOR_VERSION < 3 + GdkWindow* draw_window = GTK_PIZZA(child_window)->bin_window; +#else GdkWindow* draw_window = gtk_widget_get_window(child_window); +#endif Window Xwindow = GDK_WINDOW_XWINDOW(draw_window); Display* XDisplay = GDK_WINDOW_XDISPLAY(draw_window);