Some patches

Maria Papendieck <[email protected]>
Newsgroups gmane.comp.java.ikvm.devel
Message-ID <[email protected]>
Hello everyone,

first off, thank you for this great project! We are currently working on 
a java code-editor control and use IKVM to cross-compile it to .Net. The 
control works great in .Net. However, we had to do a custom IKVM build 
to fix some issues. Could you please check if the changes can make it 
into an official IKVM release? Note: the attached patches apply to IKVM 
release 7.2.4630.5

We had the following problems:

1. The code editor provides an autocompletion pop-up dialog as in any 
standard IDE. The pop-up is a JWindow with focusableWindowState set to 
false, so that it should never be focused. However, when clicking the 
pop-up in the cross-compiled .Net editor, it gets focused. Therefore, we 
now override the WndProc() method of ikvm.awt.UndecoratedForm and 
explicitly ignore the WM_MOUSEACTIVATE message (see attached 
toolkit.diff for details).

2. In the cross-compiled editor, copy/paste does not work correctly. 
Text copied from another program cannot be pasted to the editor's 
textarea. Inside the editor, copy/paste works fine. The fix is to invoke 
Clipboard.getDataObject() from ikvm.awt.NetToolkit's thread (see 
toolkit.diff).

3. Drawn text looks ugly, because the TextRenderingHint AntiAlias is 
used. We changed this to TextRenderingHint.ClearTypeGridFit (see 
graphics.diff).

Best regards,
Maria

-- 
Maria Papendieck                Phone: (+49) 0391 544569-34
pure-systems GmbH               Fax:   (+49) 0391 544569-90
-- 
pure-systems GmbH
Geschäftsführung: Danilo Beuche, Holger Papajewski
Sitz der Gesellschaft: Magdeburg
Registergericht: Amtsgericht Stendal, HRB 113044

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech

_______________________________________________
Ikvm-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ikvm-developers
toolkit.diff (text/plain, 1.3 KB)
### Eclipse Workspace Patch 1.0
#P IKVM
Index: awt/toolkit-0.95.cs
===================================================================
RCS file: /cvsroot/ikvm/ikvm/awt/toolkit-0.95.cs,v
retrieving revision 1.101
diff -u -r1.101 toolkit-0.95.cs
--- awt/toolkit-0.95.cs	29 Aug 2012 21:19:36 -0000	1.101
+++ awt/toolkit-0.95.cs	2 Jun 2014 12:46:36 -0000
@@ -127,6 +127,19 @@
             }
         }
 
+        private const int WM_MOUSEACTIVATE = 0x0021;
+        private const int MA_NOACTIVATE = 0x0003;
+
+        protected override void WndProc(ref Message m)
+        {
+            if (focusableWindow == false && (m.Msg == WM_MOUSEACTIVATE))
+            {
+                m.Result = (IntPtr)MA_NOACTIVATE;
+                return;
+            }
+            base.WndProc(ref m);
+        }
+
 		protected override void OnPaintBackground(PaintEventArgs e)
 		{
 			NetComponentPeer peer = NetComponentPeer.FromControl(this);
@@ -5237,7 +5250,12 @@
             {
                 return contents;
             }
-            return new NetClipboardTransferable(Clipboard.GetDataObject());
+            IDataObject dataobject = null;
+            NetToolkit.Invoke(delegate
+            {
+                dataobject = Clipboard.GetDataObject();
+            });
+            return new NetClipboardTransferable(dataobject);
         }
     }
graphics.diff (text/plain, 724 B)
### Eclipse Workspace Patch 1.0
#P IKVM
Index: awt/graphics.cs
===================================================================
RCS file: /cvsroot/ikvm/ikvm/awt/graphics.cs,v
retrieving revision 1.62
diff -u -r1.62 graphics.cs
--- awt/graphics.cs	10 Mar 2012 22:26:15 -0000	1.62
+++ awt/graphics.cs	2 Jun 2014 12:46:36 -0000
@@ -1656,7 +1656,7 @@
                 }
                 if (hintValue == java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_ON)
                 {
-                    g.TextRenderingHint = TextRenderingHint.AntiAlias;
+                    g.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
                     textAntialiasHint = hintValue;
                     return;
                 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.