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)
This commit is contained in:
Gregory Hainaut 2014-11-16 13:54:07 +01:00
parent 276e3d9d1b
commit 7964933507
1 changed files with 19 additions and 0 deletions

View File

@ -39,6 +39,11 @@
#endif
#ifdef __WXGTK__
#if wxMAJOR_VERSION < 3
#include <wx/gtk/win_gtk.h> // GTK_PIZZA interface (internal include removed in 3.0)
#endif
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#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);