All pastes #524404 Raw Edit

Miscellany

public text v1 · immutable
#524404 ·published 2007-05-31 02:13 UTC
rendered paste body
Index: WebBrowser.cs
===================================================================
--- WebBrowser.cs       (revision 78280)
+++ WebBrowser.cs       (working copy)
@@ -11,6 +11,9 @@
                [DllImport ("libX11", EntryPoint="XCreateSimpleWindow")]
                internal extern static IntPtr XCreateSimpleWindow(IntPtr display, IntPtr parent, int x, int y, int width, int height, int border_width, UIntPtr border, UIntPtr background);

+               [DllImport ("libX11", EntryPoint="XMapWindow")]
+               internal extern static IntPtr XMapWindow(IntPtr display, IntPtr win);
+
                //Got to keep an eye on this
                private CallbackBinder callback;
                private GCHandle gcd;
@@ -41,23 +44,20 @@
                        Console.WriteLine("Handle Create {0}", this.Handle);

                        IntPtr DisplayHandle = IntPtr.Zero;
-                       IntPtr RootWindow = IntPtr.Zero;
                        IntPtr parent = IntPtr.Zero;
-                       Type hwnd = Type.GetType("System.Windows.Forms.Hwnd, System.Windows.Forms");
                        IntPtr CreateWin = IntPtr.Zero;
                        Type xplatui = Type.GetType("System.Windows.Forms.XplatUIX11, System.Windows.Forms");
                        if (xplatui != null)
                        {
                                DisplayHandle = (IntPtr)xplatui.GetField("DisplayHandle", System.Reflection.BindingFlags.Static |
                                        System.Reflection.BindingFlags.NonPublic).GetValue(null);
-                               RootWindow = (IntPtr)xplatui.GetField("RootWindow", System.Reflection.BindingFlags.Static |
-                                       System.Reflection.BindingFlags.NonPublic).GetValue(null);
                        }
                        CreateWin = XCreateSimpleWindow(DisplayHandle,this.Handle,0,0,200,200,0,UIntPtr.Zero,UIntPtr.Zero);
+                       XMapWindow (DisplayHandle, CreateWin);
                        Console.WriteLine("DisplayHandle {0:X} ", DisplayHandle.ToInt64());
                        Console.WriteLine("CreateWin {0:X}", CreateWin.ToInt64());
                        MozillaInvoke.mozembed_init(nptr, CreateWin);
-                       MozillaInvoke.mozembed_resize(nptr, 200,200);
+                       MozillaInvoke.mozembed_resize(nptr, (uint)this.Width, (uint)this.Height);
                        MozillaInvoke.mozembed_show(nptr);
                        Console.WriteLine("You should see gecko");
                        base.OnHandleCreated(e);