Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for resizing panes with mouse #16895

Open
wants to merge 127 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 110 commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
f353323
I wanted to do this in one shot but _zelda_
zadjii-msft May 12, 2023
4e14442
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl/non-te…
zadjii-msft Jul 17, 2023
ef6bb8a
hey look, it builds now
zadjii-msft Jul 17, 2023
5b3aa54
move GetNewTerminalArgs into IPaneContent
zadjii-msft Jul 17, 2023
84df819
close event
zadjii-msft Jul 17, 2023
7c9ffb0
snapping now uses an interface, so that it's not TermControl-specific
zadjii-msft Jul 18, 2023
a1da6c1
huge shuffling so that pane content can raise events instead of relyi…
zadjii-msft Jul 18, 2023
049c043
some last cleanups
zadjii-msft Jul 18, 2023
2dd8f40
[TO PARENT] dead code
zadjii-msft Jul 18, 2023
1b39db7
Single commit that adds the whole scratchpad and action
zadjii-msft Jul 18, 2023
63ba8e1
[PARENT] You know what, I just went for it.
zadjii-msft Jul 18, 2023
262d95a
[PARENT] try to use GetActiveTerminalControl less in TerminalTab
zadjii-msft Jul 18, 2023
2d40306
Let's just make it experimental
zadjii-msft Jul 18, 2023
e6dc314
Merge commit 'b4042ea' into dev/migrie/fhl/non-terminal-panes-2023
zadjii-msft Jul 19, 2023
e31202b
Merge commit '6a10ea5' into dev/migrie/fhl/non-terminal-panes-2023
zadjii-msft Jul 20, 2023
11126f9
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl/non-te…
zadjii-msft Jul 20, 2023
5f9add4
Merge branch 'dev/migrie/fhl/non-terminal-panes-2023' into dev/migrie…
zadjii-msft Jul 20, 2023
a23c1a2
keybindings too
zadjii-msft Jul 20, 2023
5582e1b
[PARENT] You know what, I just went for it.
zadjii-msft Jul 18, 2023
f89368c
[PARENT] try to use GetActiveTerminalControl less in TerminalTab
zadjii-msft Jul 18, 2023
e0b003a
Merge branch 'main' into dev/migrie/fhl/non-terminal-panes-2023
zadjii-msft Jul 24, 2023
86914bd
Merge branch 'dev/migrie/fhl/non-terminal-panes-2023' into dev/migrie…
zadjii-msft Jul 25, 2023
1cc9835
feature flags too
zadjii-msft Jul 27, 2023
cbd61b0
POC: yea, this works
zadjii-msft Jul 27, 2023
29d0d57
this works better than it has any right to
zadjii-msft Jul 27, 2023
fb7c809
derp
zadjii-msft Aug 1, 2023
842326d
icons for non-terminal pane content
zadjii-msft Aug 3, 2023
521e301
update settings should work now
zadjii-msft Aug 3, 2023
9531069
background brush, done
zadjii-msft Aug 7, 2023
c869b47
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl/non-te…
zadjii-msft Sep 11, 2023
46469aa
Merge branch 'dev/migrie/fhl/non-terminal-panes-2023' into dev/migrie…
zadjii-msft Sep 11, 2023
6107c3e
Merge branch 'dev/migrie/fhl/scratchpad-pane' into dev/migrie/f/sui-p…
zadjii-msft Sep 11, 2023
2086e0f
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl/non-te…
zadjii-msft Oct 13, 2023
b49997b
Merge branch 'dev/migrie/fhl/non-terminal-panes-2023' into dev/migrie…
zadjii-msft Oct 13, 2023
57e1f26
Merge branch 'dev/migrie/fhl/scratchpad-pane' into dev/migrie/f/sui-p…
zadjii-msft Oct 13, 2023
d726165
terrible, but it works
zadjii-msft Oct 13, 2023
e82c627
dead code removal
zadjii-msft Oct 13, 2023
81889a6
derp
zadjii-msft Oct 13, 2023
5f4087f
finish exorcising SettingsTab
zadjii-msft Oct 13, 2023
fb74fc8
dead code
zadjii-msft Oct 13, 2023
fd06409
annoying build break
zadjii-msft Oct 13, 2023
8df9523
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl/non-te…
zadjii-msft Oct 25, 2023
58e8f3c
mostly nits
zadjii-msft Oct 25, 2023
e9e04d4
Merge branch 'dev/migrie/fhl/non-terminal-panes-2023' into dev/migrie…
zadjii-msft Oct 25, 2023
7bc1457
nits and such
zadjii-msft Oct 25, 2023
dd8606f
Merge branch 'dev/migrie/fhl/scratchpad-pane' into dev/migrie/f/sui-p…
zadjii-msft Oct 25, 2023
389ba20
spel
zadjii-msft Oct 25, 2023
cf920e7
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl/non-te…
zadjii-msft Nov 2, 2023
4cec7e9
try to remove a few of these but ultimately, eh
zadjii-msft Nov 6, 2023
f622d80
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl/non-te…
zadjii-msft Nov 8, 2023
6bc711d
maybe I'm not that good at coding
zadjii-msft Nov 8, 2023
0d528f8
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl/non-te…
zadjii-msft Jan 19, 2024
3982358
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl/non-te…
zadjii-msft Feb 8, 2024
c244633
Merge branch 'dev/migrie/fhl/non-terminal-panes-2023' into dev/migrie…
zadjii-msft Feb 8, 2024
092b355
Merge branch 'dev/migrie/fhl/scratchpad-pane' into dev/migrie/f/sui-p…
zadjii-msft Feb 8, 2024
de5f7af
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl/non-te…
zadjii-msft Feb 28, 2024
25a8851
Merge branch 'dev/migrie/fhl/non-terminal-panes-2023' into dev/migrie…
zadjii-msft Feb 28, 2024
17075d6
Merge branch 'dev/migrie/fhl/scratchpad-pane' into dev/migrie/f/sui-p…
zadjii-msft Feb 28, 2024
0a11643
sanely pass around a cache instead of... whatever that was.
zadjii-msft Mar 4, 2024
4d47cd5
cleanup
zadjii-msft Mar 4, 2024
254f3ee
this does resize panes but as noted, DPI is wack
zadjii-msft Mar 5, 2024
38f30c3
horizontal <---> resizing works great
zadjii-msft Mar 5, 2024
04870c9
this totally works, except for the parent pane
zadjii-msft Mar 5, 2024
7a27354
this double-notifies the parent again, but again, not the end of the …
zadjii-msft Mar 5, 2024
112cdf5
this seems to work, but only on the right/bottom edges of a pane. Nev…
zadjii-msft Mar 5, 2024
67c1128
commenting out a lot of failed ideas
zadjii-msft Mar 5, 2024
93a789c
This almost works right
zadjii-msft Mar 5, 2024
18bd6a8
OMG this is so close. the _Resize instead of ResizePane is LOAD-BEARING
zadjii-msft Mar 7, 2024
91a0d0e
GREAT-GRANDPARENT: This fixes a crash in parent pane selection
zadjii-msft Mar 7, 2024
47b06e0
GAH this is SO close.
zadjii-msft Mar 7, 2024
8f89dd4
Again, even closer, but now the middle bottom left pane doesn't resiz…
zadjii-msft Mar 7, 2024
921c94b
cleanup before I blow it all up
zadjii-msft Mar 7, 2024
63ad45a
endless joy. This is so much more elegant
zadjii-msft Mar 7, 2024
ba5fab4
beautiful elegance
zadjii-msft Mar 7, 2024
5e5e13e
VERY IMPORTANT
zadjii-msft Mar 7, 2024
032d15f
Trying to figure out why the drag starting in the control continues i…
zadjii-msft Mar 7, 2024
6ba704d
a thought
zadjii-msft Mar 7, 2024
b6254f8
GREAT-GRANDPARENT: This fixes a crash in parent pane selection
zadjii-msft Mar 7, 2024
a3fbc64
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl/non-te…
zadjii-msft Mar 8, 2024
35651bc
Merge branch 'dev/migrie/fhl/non-terminal-panes-2023' into dev/migrie…
zadjii-msft Mar 8, 2024
978fd6e
Merge branch 'dev/migrie/fhl/scratchpad-pane' into dev/migrie/f/sui-p…
zadjii-msft Mar 8, 2024
ef775a8
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl/non-te…
zadjii-msft Mar 18, 2024
524d658
GREAT-GREAT-GRANDPARENT: Hey when a pane wants to get closed, we shou…
zadjii-msft Mar 15, 2024
1951f30
Merge branch 'dev/migrie/fhl/non-terminal-panes-2023' into dev/migrie…
zadjii-msft Mar 18, 2024
863840e
Merge branch 'dev/migrie/fhl/scratchpad-pane' into dev/migrie/f/sui-p…
zadjii-msft Mar 18, 2024
dde4d0d
AHAHAHA IT WORKS
zadjii-msft Mar 18, 2024
36cefec
comments, comments, comments
zadjii-msft Mar 18, 2024
77d56e0
dead code
zadjii-msft Mar 18, 2024
6bf09df
Merge branch 'dev/migrie/f/sui-panes' into dev/migrie/f/992-redux-redux
zadjii-msft Mar 19, 2024
6789ec0
some of the easier nits
zadjii-msft Mar 19, 2024
fd8b083
get rid of this file
zadjii-msft Mar 19, 2024
052dc78
more nits
zadjii-msft Mar 19, 2024
a7533fa
eh these events are from pane content anyways!
zadjii-msft Mar 19, 2024
826fc08
hey there buddy, did you get lost?
zadjii-msft Mar 19, 2024
52970ef
RegisterBigTimeEncapsulationViolatingTerminalPaneContentEvents
zadjii-msft Mar 19, 2024
2357653
Merge branch 'dev/migrie/fhl/non-terminal-panes-2023' into dev/migrie…
zadjii-msft Mar 20, 2024
c8d0c0a
Merge branch 'dev/migrie/fhl/scratchpad-pane' into dev/migrie/f/sui-p…
zadjii-msft Mar 20, 2024
0946a43
Merge branch 'dev/migrie/f/sui-panes' into dev/migrie/f/992-redux-redux
zadjii-msft Mar 20, 2024
e0bb840
Fix scratch pane for merge
zadjii-msft Mar 20, 2024
352e0a2
fix settings pane for merge
zadjii-msft Mar 20, 2024
bcceb85
Merge branch 'dev/migrie/fhl/scratchpad-pane' into dev/migrie/f/sui-p…
zadjii-msft Mar 20, 2024
7300b5b
Merge branch 'dev/migrie/f/sui-panes' into dev/migrie/f/992-redux-redux
zadjii-msft Mar 20, 2024
2083b2f
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl/non-te…
zadjii-msft Mar 21, 2024
f1ab16e
Merge branch 'dev/migrie/fhl/non-terminal-panes-2023' into dev/migrie…
zadjii-msft Mar 21, 2024
77022e9
Merge branch 'dev/migrie/fhl/scratchpad-pane' into dev/migrie/f/sui-p…
zadjii-msft Mar 21, 2024
4f77204
Merge branch 'dev/migrie/f/sui-panes' into dev/migrie/f/992-redux-redux
zadjii-msft Mar 21, 2024
df73d75
derp
zadjii-msft Mar 21, 2024
d417934
Merge branch 'dev/migrie/fhl/non-terminal-panes-2023' into dev/migrie…
zadjii-msft Mar 21, 2024
216cc3f
Merge branch 'dev/migrie/fhl/scratchpad-pane' into dev/migrie/f/sui-p…
zadjii-msft Mar 21, 2024
a0d62ab
Merge branch 'dev/migrie/f/sui-panes' into dev/migrie/f/992-redux-redux
zadjii-msft Mar 21, 2024
61e952c
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl/non-te…
zadjii-msft Mar 26, 2024
0979cd6
Merge branch 'dev/migrie/fhl/non-terminal-panes-2023' into dev/migrie…
zadjii-msft Mar 26, 2024
b6e4b62
Doesn't really need to be projected
zadjii-msft Mar 26, 2024
1d20599
un fix this file
zadjii-msft Mar 26, 2024
ddc88c8
Merge branch 'dev/migrie/fhl/scratchpad-pane' into dev/migrie/f/sui-p…
zadjii-msft Mar 26, 2024
10e1e46
ALSO doesn't really need to be projected
zadjii-msft Mar 26, 2024
7243d22
Merge remote-tracking branch 'origin/main' into dev/migrie/fhl/scratc…
zadjii-msft Mar 26, 2024
ef560bf
Merge branch 'dev/migrie/fhl/scratchpad-pane' into dev/migrie/f/sui-p…
zadjii-msft Mar 26, 2024
e05b2bb
Merge branch 'main' into dev/migrie/f/sui-panes
zadjii-msft Mar 29, 2024
a0e014f
Merge remote-tracking branch 'origin/main' into dev/migrie/f/sui-panes
zadjii-msft Apr 3, 2024
7c4dfff
Merge remote-tracking branch 'origin/main' into dev/migrie/f/sui-panes
zadjii-msft Apr 3, 2024
96c6a44
Merge branch 'dev/migrie/f/sui-panes' into dev/migrie/f/992-redux-redux
zadjii-msft Apr 3, 2024
194f37e
well, definitely this
zadjii-msft Apr 3, 2024
aa6f9bc
derp;
zadjii-msft Apr 4, 2024
26a1ed5
Merge branch 'main' into dev/migrie/f/992-redux-redux
zadjii-msft Jun 3, 2024
6f9ec76
Merge remote-tracking branch 'origin/main' into dev/migrie/f/992-redu…
zadjii-msft Jun 10, 2024
4684e18
Merge remote-tracking branch 'origin/main' into dev/migrie/f/992-redu…
zadjii-msft Jun 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/cascadia/LocalTests_TerminalApp/TabTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@ namespace TerminalAppLocalTests
const auto& controlSettings = activeControl.Settings();
VERIFY_IS_NOT_NULL(controlSettings);

VERIFY_ARE_EQUAL(til::color{ 0xff0c0c0c }, controlSettings.DefaultBackground());
VERIFY_ARE_EQUAL(til::color{ 0xff0c0c0c }, til::color{ controlSettings.DefaultBackground() });
});

TestOnUIThread([&page]() {
Expand All @@ -1344,7 +1344,7 @@ namespace TerminalAppLocalTests
VERIFY_IS_NOT_NULL(controlSettings);

Log::Comment(L"Color should be changed to the preview");
VERIFY_ARE_EQUAL(til::color{ 0xff000000 }, controlSettings.DefaultBackground());
VERIFY_ARE_EQUAL(til::color{ 0xff000000 }, til::color{ controlSettings.DefaultBackground() });

// And we should have stored a function to revert the change.
VERIFY_ARE_EQUAL(1u, page->_restorePreviewFuncs.size());
Expand All @@ -1366,7 +1366,7 @@ namespace TerminalAppLocalTests
VERIFY_IS_NOT_NULL(controlSettings);

Log::Comment(L"Color should be changed");
VERIFY_ARE_EQUAL(til::color{ 0xff000000 }, controlSettings.DefaultBackground());
VERIFY_ARE_EQUAL(til::color{ 0xff000000 }, til::color{ controlSettings.DefaultBackground() });

// After preview there should be no more restore functions to execute.
VERIFY_ARE_EQUAL(0u, page->_restorePreviewFuncs.size());
Expand Down Expand Up @@ -1394,7 +1394,7 @@ namespace TerminalAppLocalTests
const auto& controlSettings = activeControl.Settings();
VERIFY_IS_NOT_NULL(controlSettings);

VERIFY_ARE_EQUAL(til::color{ 0xff0c0c0c }, controlSettings.DefaultBackground());
VERIFY_ARE_EQUAL(til::color{ 0xff0c0c0c }, til::color{ controlSettings.DefaultBackground() });
});

TestOnUIThread([&page]() {
Expand All @@ -1412,7 +1412,7 @@ namespace TerminalAppLocalTests
VERIFY_IS_NOT_NULL(controlSettings);

Log::Comment(L"Color should be changed to the preview");
VERIFY_ARE_EQUAL(til::color{ 0xff000000 }, controlSettings.DefaultBackground());
VERIFY_ARE_EQUAL(til::color{ 0xff000000 }, til::color{ controlSettings.DefaultBackground() });
});

TestOnUIThread([&page]() {
Expand All @@ -1428,7 +1428,7 @@ namespace TerminalAppLocalTests
VERIFY_IS_NOT_NULL(controlSettings);

Log::Comment(L"Color should be the same as it originally was");
VERIFY_ARE_EQUAL(til::color{ 0xff0c0c0c }, controlSettings.DefaultBackground());
VERIFY_ARE_EQUAL(til::color{ 0xff0c0c0c }, til::color{ controlSettings.DefaultBackground() });
});
Log::Comment(L"Sleep to let events propagate");
Sleep(250);
Expand All @@ -1450,7 +1450,7 @@ namespace TerminalAppLocalTests
const auto& controlSettings = activeControl.Settings();
VERIFY_IS_NOT_NULL(controlSettings);

VERIFY_ARE_EQUAL(til::color{ 0xff0c0c0c }, controlSettings.DefaultBackground());
VERIFY_ARE_EQUAL(til::color{ 0xff0c0c0c }, til::color{ controlSettings.DefaultBackground() });
});

TestOnUIThread([&page]() {
Expand All @@ -1467,7 +1467,7 @@ namespace TerminalAppLocalTests
VERIFY_IS_NOT_NULL(controlSettings);

Log::Comment(L"Color should be changed to the preview");
VERIFY_ARE_EQUAL(til::color{ 0xff000000 }, controlSettings.DefaultBackground());
VERIFY_ARE_EQUAL(til::color{ 0xff000000 }, til::color{ controlSettings.DefaultBackground() });
});

TestOnUIThread([&page]() {
Expand All @@ -1484,7 +1484,7 @@ namespace TerminalAppLocalTests
VERIFY_IS_NOT_NULL(controlSettings);

Log::Comment(L"Color should be changed to the preview");
VERIFY_ARE_EQUAL(til::color{ 0xffFAFAFA }, controlSettings.DefaultBackground());
VERIFY_ARE_EQUAL(til::color{ 0xffFAFAFA }, til::color{ controlSettings.DefaultBackground() });
});

TestOnUIThread([&page]() {
Expand All @@ -1503,7 +1503,7 @@ namespace TerminalAppLocalTests
VERIFY_IS_NOT_NULL(controlSettings);

Log::Comment(L"Color should be changed");
VERIFY_ARE_EQUAL(til::color{ 0xffFAFAFA }, controlSettings.DefaultBackground());
VERIFY_ARE_EQUAL(til::color{ 0xffFAFAFA }, til::color{ controlSettings.DefaultBackground() });
});
Log::Comment(L"Sleep to let events propagate");
Sleep(250);
Expand Down
2 changes: 2 additions & 0 deletions src/cascadia/LocalTests_TerminalApp/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ Author(s):
#include <winrt/windows.applicationmodel.core.h>

#include <winrt/Microsoft.Terminal.TerminalConnection.h>
#include <winrt/Microsoft.Terminal.Core.h>
#include <winrt/Microsoft.Terminal.Control.h>
#include <winrt/Microsoft.Terminal.Settings.Model.h>

#include <winrt/Microsoft.UI.Xaml.Controls.h>
Expand Down
22 changes: 21 additions & 1 deletion src/cascadia/TerminalApp/AppActionHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "App.h"

#include "TerminalPage.h"
#include "ScratchpadContent.h"
#include "../WinRTUtils/inc/WtExeUtils.h"
#include "../../types/inc/utils.hpp"
#include "Utils.h"
Expand Down Expand Up @@ -1401,7 +1402,7 @@ namespace winrt::TerminalApp::implementation
{
if (const auto activePane{ activeTab->GetActivePane() })
{
_restartPaneConnection(activePane);
_restartPaneConnection(activePane->GetContent().try_as<TerminalApp::TerminalPaneContent>(), nullptr);
}
}
args.Handled(true);
Expand All @@ -1416,6 +1417,25 @@ namespace winrt::TerminalApp::implementation
}
args.Handled(true);
}

void TerminalPage::_HandleOpenScratchpad(const IInspectable& sender,
const ActionEventArgs& args)
{
if (Feature_ScratchpadPane::IsEnabled())
{
const auto& scratchPane{ winrt::make_self<ScratchpadContent>() };

// This is maybe a little wacky - add our key event handler to the pane
// we made. So that we can get actions for keys that the content didn't
// handle.
scratchPane->GetRoot().KeyDown({ this, &TerminalPage::_KeyDownHandler });

const auto resultPane = std::make_shared<Pane>(*scratchPane);
_SplitPane(_senderOrFocusedTab(sender), SplitDirection::Automatic, 0.5f, resultPane);
args.Handled(true);
}
}

void TerminalPage::_HandleOpenAbout(const IInspectable& /*sender*/,
const ActionEventArgs& args)
{
Expand Down
56 changes: 56 additions & 0 deletions src/cascadia/TerminalApp/IPaneContent.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

namespace TerminalApp
{

runtimeclass BellEventArgs
{
Boolean FlashTaskbar { get; };
};

interface IPaneContent
{
Windows.UI.Xaml.FrameworkElement GetRoot();
void UpdateSettings(Microsoft.Terminal.Settings.Model.CascadiaSettings settings);

Windows.Foundation.Size MinimumSize { get; };

String Title { get; };
UInt64 TaskbarState { get; };
UInt64 TaskbarProgress { get; };
Boolean ReadOnly { get; };
String Icon { get; };
Windows.Foundation.IReference<Windows.UI.Color> TabColor { get; };
Windows.UI.Xaml.Media.Brush BackgroundBrush { get; };

Microsoft.Terminal.Settings.Model.NewTerminalArgs GetNewTerminalArgs(Boolean asContent);

void Focus(Windows.UI.Xaml.FocusState reason);

void Close();

event Windows.Foundation.TypedEventHandler<IPaneContent, Object> CloseRequested;

event Windows.Foundation.TypedEventHandler<Object, Object> ConnectionStateChanged;
event Windows.Foundation.TypedEventHandler<IPaneContent, BellEventArgs> BellRequested;
event Windows.Foundation.TypedEventHandler<IPaneContent, Object> TitleChanged;
event Windows.Foundation.TypedEventHandler<IPaneContent, Object> TabColorChanged;
event Windows.Foundation.TypedEventHandler<IPaneContent, Object> TaskbarProgressChanged;
event Windows.Foundation.TypedEventHandler<IPaneContent, Object> ReadOnlyChanged;
event Windows.Foundation.TypedEventHandler<IPaneContent, Object> FocusRequested;
};


enum PaneSnapDirection
{
Width,
Height
};

interface ISnappable
{
Single SnapDownToGrid(PaneSnapDirection direction, Single sizeToSnap);
Windows.Foundation.Size GridUnitSize { get; };
};
}
Loading
Loading