Toolkit improvements
Daniel Zatonyi <[email protected]> Thu, 16 Apr 2015 15:03:47 +0200
| Newsgroups | gmane.comp.java.ikvm.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi, I added two little improvements to toolkit-0.95.cs -- at least so I hope. - handling the high contrast desktop property on Windows - trying to handle more text sources for clipboard copy by using an appropriate Reader for the source data If anyone considers commiting these changes, well, thanks. Regards, Daniel ------------------------------------------------------------------------------ BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF _______________________________________________ Ikvm-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ikvm-developers
toolkit.patch
(text/plain, 2 KB)
Index: toolkit-0.95.cs
===================================================================
RCS file: /cvsroot/ikvm/ikvm/awt/toolkit-0.95.cs,v
retrieving revision 1.110
diff -u -r1.110 toolkit-0.95.cs
--- toolkit-0.95.cs 17 Nov 2014 16:47:17 -0000 1.110
+++ toolkit-0.95.cs 16 Apr 2015 12:44:48 -0000
@@ -782,6 +782,10 @@
Font font = Control.DefaultFont;
return C2J.ConvertFont(font);
}
+ if ("win.highContrast.on".Equals(name))
+ {
+ return java.lang.Boolean.valueOf(SystemInformation.HighContrast);
+ }
return null;
}
@@ -5536,8 +5540,28 @@
}
else if (flavor.isFlavorTextType())
{
- if (contents is string)
+ if (contents is string)
+ {
obj.SetText((string) transferable.getTransferData(flavor));
+ }
+ else
+ {
+ try
+ {
+ java.io.Reader reader = flavor.getReaderForText(transferable);
+ java.io.StringWriter writer = new java.io.StringWriter();
+ char[] buffer = new char[1024];
+ int n;
+ while ((n = reader.read(buffer)) != -1)
+ {
+ writer.write(buffer, 0, n);
+ }
+ obj.SetText(writer.toString());
+ }
+ catch (Exception)
+ {
+ }
+ }
}
else if (java.awt.datatransfer.DataFlavor.imageFlavor.equals(flavor))
{