Author: miguel
Date: 2007-06-19 11:47:13 -0400 (Tue, 19 Jun 2007)
New Revision: 80182

Modified:
   trunk/olive/class/agclr/Mono/Events.cs
   trunk/olive/class/agclr/Mono/NativeMethods.cs
   trunk/olive/class/agclr/System.Windows.Interop/BrowserHost.cs
Log:
Add support for some BrowserHost properties: H, W, and resize event

Modified: trunk/olive/class/agclr/Mono/Events.cs
===================================================================
--- trunk/olive/class/agclr/Mono/Events.cs      2007-06-19 15:42:04 UTC (rev 
80181)
+++ trunk/olive/class/agclr/Mono/Events.cs      2007-06-19 15:47:13 UTC (rev 
80182)
@@ -27,6 +27,7 @@
 using System;
 using System.Windows;
 using System.Windows.Input;
+using System.Windows.Interop;
 
 namespace Mono {
 
@@ -47,6 +48,7 @@
                static PlainEvent lost_focus  = new PlainEvent 
(lost_focus_callback);
                static PlainEvent loaded      = new PlainEvent 
(loaded_callback);
                static PlainEvent mouse_leave = new PlainEvent 
(mouse_leave_callback);
+               static PlainEvent surface_resized = new PlainEvent 
(surface_resized_callback);
 
                static UIElement ElementFromPtr (IntPtr target)
                {
@@ -83,6 +85,13 @@
                        e.InvokeMouseLeave ();
                }
 
+               static void surface_resized_callback (IntPtr target)
+               {
+                       // Parameter ignored
+
+                       BrowserHost.InvokeResize ();
+               }
+               
                static bool keyup_callback (IntPtr target, int state, int 
platformcode, int key)
                {
                        UIElement e = ElementFromPtr (target);
@@ -148,7 +157,7 @@
                        NativeMethods.surface_register_events (
                                surface,
                                mouse_motion, mouse_button_down, 
mouse_button_up, mouse_enter,
-                               got_focus, lost_focus, loaded, mouse_leave,
+                               got_focus, lost_focus, loaded, mouse_leave, 
surface_resized,
                                keydown, keyup);
                }
 

Modified: trunk/olive/class/agclr/Mono/NativeMethods.cs
===================================================================
--- trunk/olive/class/agclr/Mono/NativeMethods.cs       2007-06-19 15:42:04 UTC 
(rev 80181)
+++ trunk/olive/class/agclr/Mono/NativeMethods.cs       2007-06-19 15:47:13 UTC 
(rev 80182)
@@ -52,6 +52,7 @@
                        PlainEvent lost_focus,
                        PlainEvent loaded,
                        PlainEvent mouse_leave,
+                       PlainEvent surface_resized,
                        KeyboardEvent keydown,
                        KeyboardEvent keyup);
        
@@ -446,5 +447,13 @@
                internal extern static void 
dependency_object_remove_event_handler (IntPtr handle, string eventName, 
UnmanagedEventHandler handler, IntPtr closure);
 #endregion
 
+#region plugin
+               [DllImport("moonplugin")]
+               internal extern static int plugin_instance_get_actual_height 
(IntPtr plugin_handle);
+
+               [DllImport("moonplugin")]
+               internal extern static int plugin_instance_get_actual_width 
(IntPtr plugin_handle);
+               
+#endregion
        }
 }

Modified: trunk/olive/class/agclr/System.Windows.Interop/BrowserHost.cs
===================================================================
--- trunk/olive/class/agclr/System.Windows.Interop/BrowserHost.cs       
2007-06-19 15:42:04 UTC (rev 80181)
+++ trunk/olive/class/agclr/System.Windows.Interop/BrowserHost.cs       
2007-06-19 15:47:13 UTC (rev 80182)
@@ -27,6 +27,7 @@
 //
 using System;
 using System.Runtime.InteropServices;
+using Mono;
 
 namespace System.Windows.Interop {
 
@@ -38,11 +39,14 @@
                        Console.WriteLine ("The Plugin Handle has been set to 
{0}", value);
                        plugin_handle = value;
                }
-                       
+
+               // Why are ActualHeight and ActualWidth uints?
+               
                public static uint ActualHeight {
                        get {
                                if (plugin_handle != IntPtr.Zero){
-                                       return 768;
+                                       int n = 
NativeMethods.plugin_instance_get_actual_height (plugin_handle);
+                                       return n >= 0 ? (uint) n : 0;
                                } else
                                        return 768;
                        }
@@ -51,7 +55,8 @@
                public static uint ActualWidth {
                        get {
                                if (plugin_handle != IntPtr.Zero){
-                                       return 768;
+                                       int n = 
NativeMethods.plugin_instance_get_actual_width (plugin_handle);
+                                       return n >= 0 ? (uint) n : 0;
                                } else
                                        return 1024;
                        }
@@ -72,6 +77,14 @@
 
                public static event EventHandler FullScreenChange;
 
-               public static event System.EventHandler Resize;
+               internal static void InvokeResize ()
+               {
+                       EventHandler h = Resize;
+
+                       if (h != null)
+                               h (null, EventArgs.Empty);
+               }
+               
+               public static event EventHandler Resize;
        }
 }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to