Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
leonMSFT committed May 25, 2021
1 parent 7964b5a commit eee447c
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 37 deletions.
1 change: 1 addition & 0 deletions src/cascadia/TerminalApp/AppLogic.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ namespace winrt::TerminalApp::implementation
FORWARDED_TYPED_EVENT(IdentifyWindowsRequested, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, IdentifyWindowsRequested);
FORWARDED_TYPED_EVENT(RenameWindowRequested, Windows::Foundation::IInspectable, winrt::TerminalApp::RenameWindowRequestedArgs, _root, RenameWindowRequested);
FORWARDED_TYPED_EVENT(IsQuakeWindowChanged, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, IsQuakeWindowChanged);

#ifdef UNIT_TESTING
friend class TerminalAppLocalTests::CommandlineTest;
#endif
Expand Down
11 changes: 0 additions & 11 deletions src/cascadia/TerminalApp/TerminalPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,9 @@ namespace winrt::TerminalApp::implementation
HRESULT TerminalPage::Initialize(HWND hwnd)
{
_hostingHwnd = hwnd;

TestNotifyIconFunction();

return S_OK;
}

void TerminalPage::TestNotifyIconFunction()
{
if (_hostingHwnd)
{

}
}

// Function Description:
// - Recursively check our commands to see if there's a keybinding for
// exactly their action. If there is, label that command with the text
Expand Down
2 changes: 0 additions & 2 deletions src/cascadia/TerminalApp/TerminalPage.h
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,6 @@ namespace winrt::TerminalApp::implementation

void _SetFocusMode(const bool inFocusMode);

void TestNotifyIconFunction();

#pragma region ActionHandlers
// These are all defined in AppActionHandlers.cpp
#define ON_ALL_ACTIONS(action) DECLARE_ACTION_HANDLER(action);
Expand Down
35 changes: 19 additions & 16 deletions src/cascadia/WindowsTerminal/AppHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ AppHost::AppHost() noexcept :
AppHost::~AppHost()
{
// destruction order is important for proper teardown here

_window = nullptr;
_app.Close();
_app = nullptr;
Expand Down Expand Up @@ -921,6 +920,25 @@ void AppHost::_IsQuakeWindowChanged(const winrt::Windows::Foundation::IInspectab
_window->IsQuakeWindow(_logic.IsQuakeWindow());
}

void AppHost::_HandleTrayIconPressed()
{
// TODO:
// Scoping "minimize to tray" to only the quake window, and so
// we can just summon ourselves. When we allow any window to be
// minimized, this could bring up the quake or MRU or all windows.
_window->SummonWindow({});
}

void AppHost::_HandleWindowMinimized()
{
// TODO:
// Scoping "minimize to tray" to only the quake window.
if (_logic.IsQuakeWindow())
{
_UpdateTrayIcon();
}
}

void AppHost::_UpdateTrayIcon()
{
NOTIFYICONDATA nid{};
Expand All @@ -940,18 +958,3 @@ void AppHost::_UpdateTrayIcon()
nid.uVersion = NOTIFYICON_VERSION_4;
Shell_NotifyIcon(NIM_SETVERSION, &nid);
}

void AppHost::_HandleTrayIconPressed()
{
_window->SummonWindow({});
}

void AppHost::_HandleWindowMinimized()
{
// Scoping "minimize to tray" to just the quake window.
// Broader support will come in later.
if (_logic.IsQuakeWindow())
{
_UpdateTrayIcon();
}
}
9 changes: 1 addition & 8 deletions src/cascadia/WindowsTerminal/IslandWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,6 @@ long IslandWindow::_calculateTotalSize(const bool isWidth, const long clientSize
case WM_THEMECHANGED:
UpdateWindowIconForActiveMetrics(_window.get());
return 0;
// TODO: Give this a better name, something like WT_NOTIFYICON
// WM_APP to 0xBFFF is available for use for apps apparently.
case WM_APP + 1:
{
switch (LOWORD(lparam))
Expand All @@ -517,12 +515,7 @@ long IslandWindow::_calculateTotalSize(const bool isWidth, const long clientSize
case NIN_KEYSELECT:
{
_NotifyTrayIconPressedHandlers();
break;
}
case WM_CONTEXTMENU:
{
// TODO: show the context menu - buncho options to open specific windows?
break;
return 0;
}
}
break;
Expand Down

1 comment on commit eee447c

@github-actions

This comment was marked as resolved.

Please sign in to comment.