Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLi Keqing <auroracloud4096@gmail.com>2017-12-18 13:52:42 +0300
committerMarek Safar <marek.safar@gmail.com>2017-12-19 20:22:03 +0300
commitc0e6ecb6c2ced241811e5569bfd483acd9cf6d94 (patch)
tree67fe8348882399a868149a05a5ec74b527f2271c /mcs/class/System.Windows.Forms
parente0b1d6651915c395eca637ed172399354ee0fa17 (diff)
[System.Windows.Forms] Fix CJK Encoding on Window Title
Diffstat (limited to 'mcs/class/System.Windows.Forms')
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms.CarbonInternal/Enums.cs17
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUICarbon.cs10
2 files changed, 23 insertions, 4 deletions
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.CarbonInternal/Enums.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.CarbonInternal/Enums.cs
index ab13b9a6046..30d58a30144 100644
--- a/mcs/class/System.Windows.Forms/System.Windows.Forms.CarbonInternal/Enums.cs
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.CarbonInternal/Enums.cs
@@ -105,4 +105,21 @@ namespace System.Windows.Forms.CarbonInternal {
kMouseTrackingTimedOut = 8,
kMouseTrackingMouseMoved = 9
}
+
+ internal enum CFStringEncoding : uint {
+ kCFStringEncodingMacRoman = 0,
+ kCFStringEncodingWindowsLatin1 = 0x0500,
+ kCFStringEncodingISOLatin1 = 0x0201,
+ kCFStringEncodingNextStepLatin = 0x0B01,
+ kCFStringEncodingASCII = 0x0600,
+ kCFStringEncodingUnicode = 0x0100,
+ kCFStringEncodingUTF8 = 0x08000100,
+ kCFStringEncodingNonLossyASCII = 0x0BFF,
+ kCFStringEncodingUTF16 = 0x0100,
+ kCFStringEncodingUTF16BE = 0x10000100,
+ kCFStringEncodingUTF16LE = 0x14000100,
+ kCFStringEncodingUTF32 = 0x0c000100,
+ kCFStringEncodingUTF32BE = 0x18000100,
+ kCFStringEncodingUTF32LE = 0x1c000100
+ }
}
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUICarbon.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUICarbon.cs
index e1937a1fc52..346b24afd3c 100644
--- a/mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUICarbon.cs
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUICarbon.cs
@@ -2085,10 +2085,10 @@ namespace System.Windows.Forms {
internal override bool Text(IntPtr handle, string text) {
Hwnd hwnd = Hwnd.ObjectFromHandle (handle);
if (WindowMapping [hwnd.Handle] != null) {
- SetWindowTitleWithCFString ((IntPtr)(WindowMapping [hwnd.Handle]), __CFStringMakeConstantString (text));
+ SetWindowTitleWithCFString ((IntPtr)(WindowMapping [hwnd.Handle]), CFStringCreateWithCString (IntPtr.Zero, text, Carbon.CFStringEncoding.kCFStringEncodingUTF8));
}
- SetControlTitleWithCFString (hwnd.whole_window, __CFStringMakeConstantString (text));
- SetControlTitleWithCFString (hwnd.client_window, __CFStringMakeConstantString (text));
+ SetControlTitleWithCFString (hwnd.whole_window, CFStringCreateWithCString (IntPtr.Zero, text, Carbon.CFStringEncoding.kCFStringEncodingUTF8));
+ SetControlTitleWithCFString (hwnd.client_window, CFStringCreateWithCString (IntPtr.Zero, text, Carbon.CFStringEncoding.kCFStringEncodingUTF8));
return true;
}
@@ -2382,7 +2382,9 @@ namespace System.Windows.Forms {
extern static int SetWindowTitleWithCFString (IntPtr hWnd, IntPtr titleCFStr);
[DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
internal extern static IntPtr __CFStringMakeConstantString (string cString);
-
+ [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
+ extern static IntPtr CFStringCreateWithCString (IntPtr allocator, string cString, Carbon.CFStringEncoding encoding);
+
[DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]
internal extern static int CFRelease (IntPtr wHnd);
[DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")]