-
Notifications
You must be signed in to change notification settings - Fork 36
Conversation
I don't know why this was sleeping for 1000ms before. It creates a visibile delay and "feels" laggy. Since I am unsure why it's here, I am reducing it significantly to give it a slightly better feel when closing the tabs.
I made some modifications to DockPanel suite to allow for direct access to the tabs. This allows for the "previous" and "next" action hotkey.
Multiple hotkeys are set now and it is a little more robust than the previous implementation. With the modified DockPanel suite, we have the ability to cycle between the tabs!
Also moved the base.OnHandleDestroyed before our code because that triggers the HandleDestroyed event. We are hooking into this event from PuttyPanel, and we need to make sure that the handle to the putty window is still available.
This is useful because the IDockContent is what allows us to focus the putty window when the tab is selected.
Because I am moving away from RegisterHotkey function. The reason is that RegisterHotKey only allows one key combination globally. This means that any other app wanting to use a similar hotkey is not allowed to do so. As a result, this is preparation for moving towards WH_KEYBOARD_LL to do the hooking of the keyboard. Since someone already wrote something really good for WH_KEYBOARD_LL hooking, it makes no sense for me to rewrite it. As a result, I am upgrading to .NET 4.0 to be able to utilize their class.
This means the GlobalHotkeys now need to be able to keep its own state about the keyboard. A little more work here, but better than to take over the entire global hotkey space.
In certain states, when we are in another window that does not belong to us, any key trigger will lose focus on the the window. Removing hotkey parsing fixes it from the original KeyboardListener code.
We can't rely on Process.MainWindowTitle because it doesn't change. We need to hook into the EVENT_OBJECT_NAMECHANGE event and check if it is the process that we are interested in. This will be used later for mintty process to check when the title changes and update the tab and window accordingly.
When the mintty title changes, the text for the tab gets changed but the window does not. I'm still unsure if I will add the functionality for the window title change because it doesn't seem useful.
This change hooks into a mouse click on the title bar and resize event to keep the children window focused. A further hack needed to be done on the title bar click because we can't intercept the WH_NCLBUTTONUP event, it gets swallowed up for one reason or another. A way around this is to detect MOUSEMOVE after a BUTTONDOWN.
We send the message manually to draw the window as always active. We then short circuit the message by setting the result to true and never calling the base WndProc.
Since it was using a local variable, this could cause the program crash, boo!
At first I tried the WM_ACTIVATE, didn't work because the event does not give enough information (or I misused it) to determine if you are activated from a child or an external window. Then I tried a hook on EVENT_SYSTEM_FOREGROUND, but for some reason, the event gets swallowed randomly. So it would sometimes activate the child and sometimes it wouldn't. The final solution that did work is a SHELLHOOK to detect when a window is activated. Using the trick of determining if the activated window is a child or not and set the focus properly.
This is a visual improvement to increase the viewable area of the children window.
This was an odd bug and I don't know why refresh() fixes it, but it does, so I'm sticking with it :).
This is to easily differentiate between a development SuperPutty and the normal version of SuperPutty that I am using.
There were instances when using Window + <number> where SuperPutty did not activate. This forces it to appear at the top.
This is so that I can have a release version while working on edits for the debug version.
Another hack for my quest to have the putty window properly focused. This deals with when you maximize/restore and minimize & restore. Previously, the putty window will lose focus. Not anymore!
Things were getting a bit messy with winapi functions being set everywhere and constants being set everywhere. This is an initial attempt to refactor out all of that and put it into one place for easier usage in the future.
When there's output in a tab that's not in the foreground, the tab title changes its color to red. This requires a modification in DockPanel Suite to allow for a change in the text color and a way to refresh the content individually when updates were made. This also required a change in mintty to output its content on stdout when passing in "-l -" option in the command line. You can follow the issue at code.google.com/p/mintty/issues/detail?id=337, hopefully the patch gets accepted. Otherwise, I will provide the mintty version with that change along with this application.
So now if the session tree view is opened, there will be a check mark right by the option in View. The same goes for the quick connect toolbar.
Going for the minimal look here. With the new Alt + H hotkey, we can now hide the top menu.
For the null exception, it's when the last tab gets closed and the code tries to focus on ActiveDocument. Since it no longer exists, a null pointer exception is thrown. The second bug is on the creation of the first tab. It needs to be focused after it is created.
This was causing an annoying warning. It also looks like a few lines down that proto is already assigned directly into the SessionData object so this variable is not needed for anything temporary.
We were defining the Finalize method, which the compiler gave us a warning. Not sure how things worked in previous versions of .NET, but a breakpoint inside the Finalize never got hit. Effectively, I am not sure if we ever unhooked the WinEvent. I moved the unhook to the OnHandleDestroyed method, which gets executed when the panel is closed.
This gives a better look/feel on the inner window. At least on Win7, there's no more raised border for the inner child window.
Temporarily remove the old code to see if it causes any problems, I have seen none so far. Now the title of the window and the title of the tab is synchronized with each other.
Not sure what is going on here, reverting back to WS_BORDER instead of using WS_CAPTION. Still need to fix the bug where the line feed gets inserted when minimized and maximized.
This happens when putty closes and then it tries to focus on the current Pane. The pane no longer exists, so we need to put in a check for it.
This only exists in mintty. When the window gets minimized, the width gets set to 0. So the child mintty window's width get set to 0. This somehow caused an "enter key" behavior behavior on the mintty window and the prompt goes down one line. I don't even know how I found this bug, it's mainly luck :).
When we call OnHandleDestroyed after killing off the child window. The event for the HandleDestroyed event inside of ctlPuttyPanel tries to retrieve the child handle and gets 0. As a result, it does not remove the child handle from frmSupperPutty.children mapping. Since we rely on the size of this dictionary for selecting tabs, we are now going off of the end of the tab index. Null pointer :(.
Since a lot of our code depends on a ctlPuttyPanel instance, we've been getting it from Content[1]. However, this will not work if there is a session tree view that is currently being displayed. As a result, we are retrieving the first one from our own mapping, hopefully this should be the last of the wrong type, though very unlikely :(.
First fix: Remove child panel mapping when we are closing out the child window. This was insignificant before, but now that we are relying on the content of this mapping to get a valid ctlPuttyPanel, we need to prune old instances. Otherwise we will be having problems with null references. Second fix: Changing tabs between a putty tab and a mintty tab does not result in the title being changed. It could have been the case between mintty windows as well, but I didn't notice it then. Anyway, this now updates the window's text when the tabs are being changed.
There was never a reset for the hasData private variable. This variable determines if it will have to update the color, and if it does, it will only happen once when unfocused. The problem was that this variable never got reset back to false. So the text color only changed once, ever.
Wow! Seriously, nice job! I left the project alone because I spent days I have to travel to Chicago today for work and will be returning later this This has sparked my interest in coding on this project again. Thank you! :) -Paul On Sun, May 20, 2012 at 4:53 AM, akngo <
|
Oh wow, I was surprised to see this merged so quickly :). I am guessing that In its current state right now, this merge deals with #17 and #18. For the UI I certainly hope that the transition to .NET 4 won't be that bad. But you'll have a Some of the currently opened issues are pretty interesting, I might take a stab |
It's probably unlikely you'll accept the pull request, but it's just a way of letting you know of some of the things I've implemented for SuperPutty that you might want to port back to your official version.
This version requires .NET 4.0, but I think it's very possible to port this back to an older version of .NET. In addition, I made a couple of patches to DockPanel Suite to get a couple of the features working, you might want to grab the .dll. If that does not work for you, I can post up my patched version.
If you have any questions, feel free to ask!
Oh yea, given this huge of a feature change, you can expect a lot of bugs :(.