[Mono-winforms-list] Initial MacOS/Quartz patches
kangaroo
grompf@sublimeintervention.com
Tue, 7 Dec 2004 21:40:11 -0500
--Apple-Mail-3--387639638
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
Heres the first in the patchset for MacOS/Quartz support;
this set is relatively simple; we add a FromHwndWithSize call to
graphics (we need to pass width and height for quartz) for mac only
calls; we check for an environment variable
(MONO_MWF_USE_QUARTZ_BACKEND) to see if we're going to use
XplatUIOSX.cs (this will be fine going forward cause we can set that in
the bundlemaker script)
umm; and it adds the call into the libgdiplus land
libgdiplus patches to follow soon; they're a little more difficult due
to X11/Quartz conflicting definitions (Point/Rect/Etc); I should be
able to make them play nice tho by just avoiding some of the explicity
casting in quartz that isn't really needed.
Ok to commit?
--Apple-Mail-3--387639638
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream;
x-unix-mode=0644;
name="mwf.diff"
Content-Disposition: attachment;
filename=mwf.diff
Index: System.Drawing/System.Drawing/gdipFunctions.cs
===================================================================
--- System.Drawing/System.Drawing/gdipFunctions.cs (revision 37350)
+++ System.Drawing/System.Drawing/gdipFunctions.cs (working copy)
@@ -1601,6 +1601,10 @@
}
+ /* Mac only function calls */
+ [DllImport("gdiplus.dll")]
+ internal static extern Status GdipCreateFromQuartz_macosx (IntPtr cgref, int width, int height, out IntPtr graphics);
+
/* Linux only function calls*/
[DllImport("gdiplus.dll")]
internal static extern Status GdipSetVisibleClip_linux (IntPtr graphics, ref Rectangle rect);
Index: System.Drawing/System.Drawing/Graphics.cs
===================================================================
--- System.Drawing/System.Drawing/Graphics.cs (revision 37350)
+++ System.Drawing/System.Drawing/Graphics.cs (working copy)
@@ -1253,6 +1253,13 @@
return null;
}
+ public static Graphics FromHwndWithSize (IntPtr hwnd, int width, int height) {
+ IntPtr graphics;
+ Status s = GDIPlus.GdipCreateFromQuartz_macosx (hwnd, width, height, out graphics);
+ GDIPlus.CheckStatus (s);
+ return new Graphics (graphics);
+ }
+
[EditorBrowsable (EditorBrowsableState.Advanced)]
public static Graphics FromHwnd (IntPtr hwnd)
{
@@ -1264,6 +1271,7 @@
}
return FromXDrawable (hwnd, display);
+
}
Status status = GDIPlus.GdipCreateFromHWND (hwnd, out graphics);
Index: Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs
===================================================================
--- Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs (revision 37359)
+++ Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs (working copy)
@@ -183,7 +183,10 @@
default_class_name="SWFClass";
if (Environment.OSVersion.Platform == (PlatformID)128) {
- driver=XplatUIX11.GetInstance();
+ if (Environment.GetEnvironmentVariable ("MONO_MWF_USE_QUARTZ_BACKEND") != null)
+ driver=XplatUIOSX.GetInstance();
+ else
+ driver=XplatUIX11.GetInstance();
} else {
driver=XplatUIWin32.GetInstance();
}
Index: Managed.Windows.Forms/System.Windows.Forms.dll.sources
===================================================================
--- Managed.Windows.Forms/System.Windows.Forms.dll.sources (revision 37350)
+++ Managed.Windows.Forms/System.Windows.Forms.dll.sources (working copy)
@@ -233,3 +233,4 @@
System.Windows.Forms/XplatUIStructs.cs
System.Windows.Forms/XplatUIWin32.cs
System.Windows.Forms/XplatUIX11.cs
+System.Windows.Forms/XplatUIOSX.cs
--Apple-Mail-3--387639638
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=US-ASCII;
format=flowed
-kangaroo
--Apple-Mail-3--387639638--