From 69d32725d2ac6e65db142cd132cfcf26125c707c Mon Sep 17 00:00:00 2001 From: Zachary Lund Date: Thu, 9 Jan 2014 19:51:51 -0600 Subject: [PATCH] Cleaned up a bit, reverted API back to normal --- obs/window-basic-main.cpp | 10 ++++++++++ obs/wx-wrappers.cpp | 11 +++-------- obs/wx-wrappers.hpp | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/obs/window-basic-main.cpp b/obs/window-basic-main.cpp index 8a47d4823..f063c314c 100644 --- a/obs/window-basic-main.cpp +++ b/obs/window-basic-main.cpp @@ -25,6 +25,10 @@ #include "window-basic-main.hpp" #include "window-namedialog.hpp" +#ifdef __WXGTK__ + #include +#endif + using namespace std; obs_scene_t OBSBasic::GetCurrentScene() @@ -235,6 +239,12 @@ bool OBSBasic::InitGraphics() "Video", "OutputCY"); ovi.output_format = VIDEO_FORMAT_RGBA; ovi.adapter = 0; + +#ifdef __WXGTK__ + /* Ugly hack for GTK, I'm hoping this can be avoided eventually... */ + gtk_widget_realize(previewPanel->GetHandle()); +#endif + ovi.window = WxToGSWindow(previewPanel); //required to make opengl display stuff on osx(?) diff --git a/obs/wx-wrappers.cpp b/obs/wx-wrappers.cpp index 94c1f9c66..c07c79bd4 100644 --- a/obs/wx-wrappers.cpp +++ b/obs/wx-wrappers.cpp @@ -21,7 +21,7 @@ #include "wx-wrappers.hpp" #include -#ifdef __linux__ +#ifdef __WXGTK__ #include #include #endif @@ -29,7 +29,7 @@ #include using namespace std; -gs_window WxToGSWindow(wxWindow *wxwin) +gs_window WxToGSWindow(const wxWindow *wxwin) { gs_window window; @@ -38,12 +38,7 @@ gs_window WxToGSWindow(wxWindow *wxwin) #elif _WIN32 window.hwnd = wxwin->GetHandle(); #else - GtkWidget* hndl = wxwin->GetHandle(); - - /* I don't really understand why wxWidgets doesn't do this during Show() */ - gtk_widget_realize(hndl); - - GdkWindow* gdkwin = gtk_widget_get_window(hndl); + GdkWindow* gdkwin = gtk_widget_get_window(wxwin->GetHandle()); window.id = GDK_DRAWABLE_XID(gdkwin); window.display = GDK_DRAWABLE_XDISPLAY(gdkwin); #endif diff --git a/obs/wx-wrappers.hpp b/obs/wx-wrappers.hpp index aadaa7a4f..c952d1d96 100644 --- a/obs/wx-wrappers.hpp +++ b/obs/wx-wrappers.hpp @@ -27,7 +27,7 @@ struct gs_window; -gs_window WxToGSWindow(wxWindow *window); +gs_window WxToGSWindow(const wxWindow *window); void OBSErrorBox(wxWindow *parent, const char *message, ...); /* returns actual ID of menu item clicked rather than be forced to use