Get rid of some unused shit
This commit is contained in:
@@ -99,7 +99,7 @@ namespace EveOPreview.Services
|
||||
// Setup toggle tracking hotkey (Ctrl+T)
|
||||
var mainHandle = this._processMonitor.GetMainProcess().Handle;
|
||||
System.Diagnostics.Debug.WriteLine($"Registering hotkey with main window handle: {mainHandle}");
|
||||
this._toggleTrackingHotkey = new HotkeyHandler(mainHandle, Keys.Control | Keys.F16);
|
||||
this._toggleTrackingHotkey = new HotkeyHandler(mainHandle, Keys.Alt | Keys.F16);
|
||||
this._toggleTrackingHotkey.Pressed += (object s, HandledEventArgs e) =>
|
||||
{
|
||||
var foregroundHandle = this._windowManager.GetForegroundWindowHandle();
|
||||
@@ -996,94 +996,6 @@ namespace EveOPreview.Services
|
||||
&& (width > ThumbnailManager.WINDOW_SIZE_THRESHOLD) && (height > ThumbnailManager.WINDOW_SIZE_THRESHOLD);
|
||||
}
|
||||
|
||||
private bool IsTrackedProcess(int processId)
|
||||
{
|
||||
return _thumbnailViews.Any(x => Process.GetProcessById(processId)?.MainWindowHandle == x.Key);
|
||||
}
|
||||
|
||||
private void TrackProcess(System.Diagnostics.Process process)
|
||||
{
|
||||
if (process == null || IsTrackedProcess(process.Id))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
System.Diagnostics.Debug.WriteLine($"Tracking process {process.ProcessName} (PID: {process.Id})");
|
||||
|
||||
// Get all windows belonging to this process
|
||||
var windows = new List<IntPtr>();
|
||||
EnumWindows((IntPtr hWnd, IntPtr lParam) =>
|
||||
{
|
||||
uint processId;
|
||||
GetWindowThreadProcessId(hWnd, out processId);
|
||||
if (processId == process.Id && IsWindow(hWnd) && IsWindowVisible(hWnd))
|
||||
{
|
||||
windows.Add(hWnd);
|
||||
}
|
||||
return true;
|
||||
}, IntPtr.Zero);
|
||||
|
||||
foreach (var windowHandle in windows)
|
||||
{
|
||||
if (_thumbnailViews.ContainsKey(windowHandle))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
System.Diagnostics.Debug.WriteLine($"Creating thumbnail for window handle: {windowHandle}");
|
||||
|
||||
Size initialSize = this._configuration.ThumbnailSize;
|
||||
string windowTitle = GetWindowTitle(windowHandle);
|
||||
string title = $"{windowTitle} (PID: {process.Id})";
|
||||
|
||||
IThumbnailView view = this._thumbnailViewFactory.Create(windowHandle, title, initialSize);
|
||||
view.IsOverlayEnabled = this._configuration.ShowThumbnailOverlays;
|
||||
view.SetFrames(this._configuration.ShowThumbnailFrames);
|
||||
view.SetSizeLimitations(this._configuration.ThumbnailMinimumSize, this._configuration.ThumbnailMaximumSize);
|
||||
view.SetTopMost(this._configuration.ShowThumbnailsAlwaysOnTop);
|
||||
|
||||
view.ThumbnailLocation = this._configuration.GetThumbnailLocation(view.Title, this._activeClient.Title, view.ThumbnailLocation);
|
||||
|
||||
this._thumbnailViews.Add(view.Id, view);
|
||||
|
||||
view.ThumbnailResized = this.ThumbnailViewResized;
|
||||
view.ThumbnailMoved = this.ThumbnailViewMoved;
|
||||
view.ThumbnailFocused = this.ThumbnailViewFocused;
|
||||
view.ThumbnailLostFocus = this.ThumbnailViewLostFocus;
|
||||
view.ThumbnailActivated = this.ThumbnailActivated;
|
||||
view.ThumbnailDeactivated = this.ThumbnailDeactivated;
|
||||
|
||||
view.RegisterHotkey(this._configuration.GetClientHotkey(view.Title));
|
||||
this.ApplyClientLayout(view);
|
||||
}
|
||||
}
|
||||
|
||||
private void UntrackProcess(int processId)
|
||||
{
|
||||
var windowsToRemove = _thumbnailViews
|
||||
.Where(x => {
|
||||
uint windowProcessId;
|
||||
GetWindowThreadProcessId(x.Key, out windowProcessId);
|
||||
return windowProcessId == processId;
|
||||
})
|
||||
.ToList();
|
||||
|
||||
foreach (var entry in windowsToRemove)
|
||||
{
|
||||
IThumbnailView view = entry.Value;
|
||||
this._thumbnailViews.Remove(entry.Key);
|
||||
|
||||
view.UnregisterHotkey();
|
||||
view.ThumbnailResized = null;
|
||||
view.ThumbnailMoved = null;
|
||||
view.ThumbnailFocused = null;
|
||||
view.ThumbnailLostFocus = null;
|
||||
view.ThumbnailActivated = null;
|
||||
view.ThumbnailDeactivated = null;
|
||||
|
||||
view.Close();
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
private static extern bool EnumWindows(EnumWindowsProc enumProc, IntPtr lParam);
|
||||
@@ -1101,12 +1013,5 @@ namespace EveOPreview.Services
|
||||
private static extern int GetWindowText(IntPtr hWnd, StringBuilder strText, int maxCount);
|
||||
|
||||
private delegate bool EnumWindowsProc(IntPtr hWnd, IntPtr lParam);
|
||||
|
||||
private static string GetWindowTitle(IntPtr hWnd)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder(256);
|
||||
GetWindowText(hWnd, sb, 256);
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user