Browse Source

Cleaned up a bit, reverted API back to normal

Zachary Lund 11 years ago
parent
commit
69d32725d2
3 changed files with 14 additions and 9 deletions
  1. 10 0
      obs/window-basic-main.cpp
  2. 3 8
      obs/wx-wrappers.cpp
  3. 1 1
      obs/wx-wrappers.hpp

+ 10 - 0
obs/window-basic-main.cpp

@@ -25,6 +25,10 @@
 #include "window-basic-main.hpp"
 #include "window-namedialog.hpp"
 
+#ifdef __WXGTK__
+    #include <gtk/gtk.h>
+#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(?)

+ 3 - 8
obs/wx-wrappers.cpp

@@ -21,7 +21,7 @@
 #include "wx-wrappers.hpp"
 #include <wx/utils.h>
 
-#ifdef __linux__
+#ifdef __WXGTK__
 #include <gdk/gdkx.h>
 #include <gtk/gtk.h>
 #endif
@@ -29,7 +29,7 @@
 #include <memory>
 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

+ 1 - 1
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