Reverted previous changes and added a hopeful solution for lack of window realization

master
Zachary Lund 2014-01-07 19:47:40 -06:00
parent 13fc0b536c
commit 350c34881a
2 changed files with 14 additions and 4 deletions

View File

@ -19,6 +19,7 @@
#include <wx/msgdlg.h> #include <wx/msgdlg.h>
#include <obs.h> #include <obs.h>
#include "wx-wrappers.hpp" #include "wx-wrappers.hpp"
#include <wx/utils.h>
#ifdef __linux__ #ifdef __linux__
#include <gdk/gdkx.h> #include <gdk/gdkx.h>
@ -28,16 +29,25 @@
#include <memory> #include <memory>
using namespace std; using namespace std;
gs_window WxToGSWindow(const wxWindow *wxwin) gs_window WxToGSWindow(wxWindow *wxwin)
{ {
gs_window window; gs_window window;
#ifdef __APPLE__ #ifdef __APPLE__
window.view = (id)wxwin->GetHandle(); window.view = (id)wxwin->GetHandle();
#elif _WIN32 #elif _WIN32
window.hwnd = wxwin->GetHandle(); window.hwnd = wxwin->GetHandle();
#else #else
window.id = gdk_x11_drawable_get_xid(gtk_widget_get_window( GtkWidget* hndl = wxwin->GetHandle();
wxwin->GetHandle())); gtk_widget_realize(hndl);
GdkWindow* gdkwin = gtk_widget_get_window(hndl);
if (gdkwin)
window.id = GDK_DRAWABLE_XID(gdkwin);
else {
window.id = 0;
blog(LOG_ERROR, "Window is not realized...?");
}
#endif #endif
return window; return window;
} }

View File

@ -27,7 +27,7 @@
struct gs_window; struct gs_window;
gs_window WxToGSWindow(const wxWindow *window); gs_window WxToGSWindow(wxWindow *window);
void OBSErrorBox(wxWindow *parent, const char *message, ...); void OBSErrorBox(wxWindow *parent, const char *message, ...);
/* returns actual ID of menu item clicked rather than be forced to use /* returns actual ID of menu item clicked rather than be forced to use