Skip to content

Commit 0082e04

Browse files
committed
Revert "#124 Troubleshoot IntelliSense arguments tooltip not appearing issue by re-enabling LOCATIONCHANGE event but only when fired for the caret"
This reverts commit 62d1811.
1 parent 2255592 commit 0082e04

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

Source/ExcelDna.IntelliSense/UIMonitor/WinEvents.cs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,7 @@ void HandleWinEvent(IntPtr hWinEventHook, WinEvent eventType, IntPtr hWnd,
190190
if (_hWndFilterOrZero != IntPtr.Zero && hWnd != _hWndFilterOrZero)
191191
return;
192192

193-
if (!IsSupportedWinEvent(eventType, idObject)
194-
|| idObject == WinEventObjectId.OBJID_CURSOR
195-
|| hWnd == IntPtr.Zero)
193+
if (!IsSupportedWinEvent(eventType) || idObject == WinEventObjectId.OBJID_CURSOR || hWnd == IntPtr.Zero)
196194
return;
197195

198196
// Moving the GetClassName call here where the main thread is running.
@@ -211,7 +209,7 @@ void HandleWinEvent(IntPtr hWinEventHook, WinEvent eventType, IntPtr hWnd,
211209
}
212210

213211
// A quick filter that runs on the Excel main thread (or other thread handling the WinEvent)
214-
bool IsSupportedWinEvent(WinEvent winEvent, WinEventObjectId idObject)
212+
bool IsSupportedWinEvent(WinEvent winEvent)
215213
{
216214
return winEvent == WinEvent.EVENT_OBJECT_CREATE ||
217215
// winEvent == WinEvent.EVENT_OBJECT_DESTROY || // Stopped watching for this, because we can't route using the ClassName and don't really need anymore
@@ -221,10 +219,6 @@ bool IsSupportedWinEvent(WinEvent winEvent, WinEventObjectId idObject)
221219
winEvent == WinEvent.EVENT_SYSTEM_MOVESIZESTART || // Only for the on-demand hook
222220
winEvent == WinEvent.EVENT_SYSTEM_MOVESIZEEND || // Only for the on-demand hook
223221
winEvent == WinEvent.EVENT_OBJECT_SELECTION || // Only for the PopupList
224-
// NB: Including the next event 'EVENT_OBJECT_LOCATIONCHANGE (0x800B = 32779)' without the check for 'OBJID_CARET'
225-
// will cause the Excel main window to lag when dragging.
226-
// This drag issue seems to have been introduced with an Office update around November 2022.
227-
(winEvent == WinEvent.EVENT_OBJECT_LOCATIONCHANGE && idObject == WinEventObjectId.OBJID_CARET) ||
228222
winEvent == WinEvent.EVENT_SYSTEM_CAPTURESTART;
229223
}
230224

Source/ExcelDna.IntelliSense/UIMonitor/WindowWatcher.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ internal WindowChangedEventArgs(IntPtr windowHandle, WinEventHook.WinEvent winEv
6969
case WinEventHook.WinEvent.EVENT_OBJECT_FOCUS:
7070
Type = ChangeType.Focus;
7171
break;
72-
case WinEventHook.WinEvent.EVENT_OBJECT_LOCATIONCHANGE:
7372
case WinEventHook.WinEvent.EVENT_SYSTEM_MOVESIZEEND:
7473
Type = ChangeType.LocationChange;
7574
break;
@@ -152,7 +151,9 @@ public WindowWatcher(SynchronizationContext syncContextAuto, SynchronizationCont
152151
// EVENT_OBJECT_SELECTIONREMOVE
153152
// EVENT_OBJECT_SELECTIONWITHIN
154153
// EVENT_OBJECT_STATECHANGE (0x800A = 32778)
155-
_windowStateChangeHooks.Add(new WinEventHook(WinEventHook.WinEvent.EVENT_OBJECT_CREATE, WinEventHook.WinEvent.EVENT_OBJECT_LOCATIONCHANGE, syncContextAuto, syncContextMain, IntPtr.Zero));
154+
// NB: Including the next event 'EVENT_OBJECT_LOCATIONCHANGE (0x800B = 32779)' will cause the Excel main window to lag when dragging.
155+
// This drag issue seems to have been introduced with an Office update around November 2022.
156+
_windowStateChangeHooks.Add(new WinEventHook(WinEventHook.WinEvent.EVENT_OBJECT_CREATE, WinEventHook.WinEvent.EVENT_OBJECT_STATECHANGE, syncContextAuto, syncContextMain, IntPtr.Zero));
156157
_windowStateChangeHooks.Add(new WinEventHook(WinEventHook.WinEvent.EVENT_SYSTEM_CAPTURESTART, WinEventHook.WinEvent.EVENT_SYSTEM_CAPTURESTART, syncContextAuto, syncContextMain, IntPtr.Zero));
157158

158159
foreach (var windowStateChangeHook in _windowStateChangeHooks)

0 commit comments

Comments
 (0)