diff options
author | Nikita Nemkin | 2018-02-18 17:03:53 +0000 |
---|---|---|
committer | Lars Vogel | 2018-04-05 17:46:44 +0000 |
commit | b33183ce0dec18efde020735ad580baed707c824 (patch) | |
tree | 933633de6c9092954ae271397e3b7996fb2053ff /bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt | |
parent | 1462f91af5e84d5f520979d0b4b9b048f3f3841b (diff) | |
download | eclipse.platform.swt-b33183ce0dec18efde020735ad580baed707c824.tar.gz eclipse.platform.swt-b33183ce0dec18efde020735ad580baed707c824.tar.xz eclipse.platform.swt-b33183ce0dec18efde020735ad580baed707c824.zip |
Bug 531097 - [Win32] Remove unnecessary string manipulation
Given a module handle, ActivateActCtx() can load manifest from a dll
already present in memory. Since SWT dll is already present and its
handle is readily available, constructing the path to SWT dll is
unnecesary.
Some controls re-register their window class locally to adjust class
style bits. Since the class name doesn't change, there's no need to set
it explicitly after the call to GetClassInfo().
Change-Id: Ic5ed78ddfef6e1ac9e2bf694cdbe216efc570569
Signed-off-by: Nikita Nemkin <nikita@nemkin.ru>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt')
4 files changed, 5 insertions, 40 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DateTime.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DateTime.java index 6d53fd8f0b..5b61b7a51f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DateTime.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/DateTime.java @@ -81,17 +81,10 @@ public class DateTime extends Composite { * code, other than SWT, could create a control with * this class name, and fail unexpectedly. */ - long /*int*/ hInstance = OS.GetModuleHandle (null); - long /*int*/ hHeap = OS.GetProcessHeap (); - lpWndClass.hInstance = hInstance; + lpWndClass.hInstance = OS.GetModuleHandle (null); lpWndClass.style &= ~OS.CS_GLOBALCLASS; lpWndClass.style |= OS.CS_DBLCLKS; - int byteCount = DateTimeClass.length () * TCHAR.sizeof; - long /*int*/ lpszClassName = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); - OS.MoveMemory (lpszClassName, DateTimeClass, byteCount); - lpWndClass.lpszClassName = lpszClassName; OS.RegisterClass (lpWndClass); - OS.HeapFree (hHeap, 0, lpszClassName); } static { WNDCLASS lpWndClass = new WNDCLASS (); @@ -114,17 +107,10 @@ public class DateTime extends Composite { * code, other than SWT, could create a control with * this class name, and fail unexpectedly. */ - long /*int*/ hInstance = OS.GetModuleHandle (null); - long /*int*/ hHeap = OS.GetProcessHeap (); - lpWndClass.hInstance = hInstance; + lpWndClass.hInstance = OS.GetModuleHandle (null); lpWndClass.style &= ~OS.CS_GLOBALCLASS; lpWndClass.style |= OS.CS_DBLCLKS; - int byteCount = CalendarClass.length () * TCHAR.sizeof; - long /*int*/ lpszClassName = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); - OS.MoveMemory (lpszClassName, CalendarClass, byteCount); - lpWndClass.lpszClassName = lpszClassName; OS.RegisterClass (lpWndClass); - OS.HeapFree (hHeap, 0, lpszClassName); } static final char SINGLE_QUOTE = '\''; //$NON-NLS-1$ short date format may include quoted text static final char DAY_FORMAT_CONSTANT = 'd'; //$NON-NLS-1$ 1-4 lowercase 'd's represent day diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java index 215a624b31..8c26ac846f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Link.java @@ -75,17 +75,10 @@ public class Link extends Control { * code, other than SWT, could create a control with * this class name, and fail unexpectedly. */ - long /*int*/ hInstance = OS.GetModuleHandle (null); - long /*int*/ hHeap = OS.GetProcessHeap (); - lpWndClass.hInstance = hInstance; + lpWndClass.hInstance = OS.GetModuleHandle (null); lpWndClass.style &= ~OS.CS_GLOBALCLASS; lpWndClass.style |= OS.CS_DBLCLKS; - int byteCount = LinkClass.length () * TCHAR.sizeof; - long /*int*/ lpszClassName = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); - OS.MoveMemory (lpszClassName, LinkClass, byteCount); - lpWndClass.lpszClassName = lpszClassName; OS.RegisterClass (lpWndClass); - OS.HeapFree (hHeap, 0, lpszClassName); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java index 9504cae0e0..8d489e2c10 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ProgressBar.java @@ -61,17 +61,10 @@ public class ProgressBar extends Control { * code, other than SWT, could create a control with * this class name, and fail unexpectedly. */ - long /*int*/ hInstance = OS.GetModuleHandle (null); - long /*int*/ hHeap = OS.GetProcessHeap (); - lpWndClass.hInstance = hInstance; + lpWndClass.hInstance = OS.GetModuleHandle (null); lpWndClass.style &= ~OS.CS_GLOBALCLASS; lpWndClass.style |= OS.CS_DBLCLKS; - int byteCount = ProgressBarClass.length () * TCHAR.sizeof; - long /*int*/ lpszClassName = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); - OS.MoveMemory (lpszClassName, ProgressBarClass, byteCount); - lpWndClass.lpszClassName = lpszClassName; OS.RegisterClass (lpWndClass); - OS.HeapFree (hHeap, 0, lpszClassName); } /** diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java index 3ed4e60b9b..c7f0fcad5f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Scale.java @@ -64,17 +64,10 @@ public class Scale extends Control { * code, other than SWT, could create a control with * this class name, and fail unexpectedly. */ - long /*int*/ hInstance = OS.GetModuleHandle (null); - long /*int*/ hHeap = OS.GetProcessHeap (); - lpWndClass.hInstance = hInstance; + lpWndClass.hInstance = OS.GetModuleHandle (null); lpWndClass.style &= ~OS.CS_GLOBALCLASS; lpWndClass.style |= OS.CS_DBLCLKS; - int byteCount = TrackBarClass.length () * TCHAR.sizeof; - long /*int*/ lpszClassName = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount); - OS.MoveMemory (lpszClassName, TrackBarClass, byteCount); - lpWndClass.lpszClassName = lpszClassName; OS.RegisterClass (lpWndClass); - OS.HeapFree (hHeap, 0, lpszClassName); } /** |