mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 14:07:46 +08:00
Revert Ctrl+Tab and Ctrl+Shift+Tab related commits.
This commit is contained in:
@@ -98,22 +98,6 @@ Namespace App
|
||||
<DllImport("user32")> _
|
||||
Public Shared Function PostMessage(ByVal hWnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Long
|
||||
End Function
|
||||
|
||||
<DllImport("user32")> _
|
||||
Public Shared Function RegisterHotKey(ByVal Handle As IntPtr, ByVal ID As Integer, ByVal Modifier As Integer, ByVal Key As Integer) As Integer
|
||||
End Function
|
||||
|
||||
<DllImport("user32")> _
|
||||
Public Shared Function UnregisterHotKey(ByVal Handle As IntPtr, ByVal ID As Integer) As Integer
|
||||
End Function
|
||||
|
||||
<DllImport("kernel32")> _
|
||||
Public Shared Function GlobalAddAtom(ByVal lpString As String) As Integer
|
||||
End Function
|
||||
|
||||
<DllImport("kernel32")> _
|
||||
Public Shared Function GlobalDeleteAtom(ByVal nAtom As Integer) As Integer
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
#Region "Constants"
|
||||
|
||||
@@ -3,12 +3,10 @@ Imports System.IO
|
||||
Imports Crownwood
|
||||
Imports System.Threading
|
||||
Imports System.Xml
|
||||
Imports mRemoteNG.App.Native
|
||||
Imports System.Environment
|
||||
|
||||
Namespace App
|
||||
Public Class Runtime
|
||||
|
||||
#Region "Public Declarations"
|
||||
Public Shared sL As Config.Settings.Load
|
||||
Public Shared sS As Config.Settings.Save
|
||||
@@ -41,43 +39,8 @@ Namespace App
|
||||
Public Shared DefaultInheritance As mRemoteNG.Connection.Info.Inheritance
|
||||
|
||||
Public Shared ExtApps As New ArrayList()
|
||||
|
||||
'HotKeys
|
||||
Public Shared HotKey_CtrlTab As clsHotKeyRegister
|
||||
Public Shared HotKey_ShiftTab As clsHotKeyRegister
|
||||
#End Region
|
||||
|
||||
Public NotInheritable Class clsHotKeyRegister : Inherits NativeWindow
|
||||
Private atomID As Integer
|
||||
|
||||
Event Pressed(ByVal ID As Integer)
|
||||
|
||||
Sub New(ByVal Modifier As ModifierKey, ByVal Key As Keys)
|
||||
CreateHandle(New CreateParams)
|
||||
atomID = GlobalAddAtom(GetHashCode())
|
||||
RegisterHotKey(Handle, atomID, Modifier, Key)
|
||||
End Sub
|
||||
|
||||
Sub Unregister()
|
||||
UnregisterHotKey(Handle, atomID)
|
||||
End Sub
|
||||
|
||||
Protected Overrides Sub WndProc(ByRef M As Message)
|
||||
If M.Msg = 786 Then 'W_HOTKEY
|
||||
If ForegroundWindowRealtedToAppInstance() Then
|
||||
RaiseEvent Pressed(M.WParam.ToInt32)
|
||||
End If
|
||||
End If
|
||||
MyBase.WndProc(M)
|
||||
End Sub
|
||||
|
||||
Public Enum ModifierKey
|
||||
'None = 0 'Not a good idea to use, commenting out
|
||||
Alt = 1
|
||||
Ctrl = 2
|
||||
Shift = 4
|
||||
End Enum
|
||||
End Class
|
||||
Public Class Windows
|
||||
Public Shared treeForm As UI.Window.Tree
|
||||
Public Shared treePanel As New DockContent
|
||||
@@ -288,15 +251,6 @@ Namespace App
|
||||
log = log4net.LogManager.GetLogger("mRemoteNG.Log")
|
||||
End Sub
|
||||
|
||||
Public Shared Sub RegisterHotKeys()
|
||||
' This causes Ctrl-Tab and Ctrl-Shift-Tab to not work in any other applications. Not good. Disabled for now.
|
||||
' 'Register HotKey
|
||||
' 'Ctrl-Tab | Advance one tab
|
||||
' HotKey_CtrlTab = New clsHotKeyRegister(clsHotKeyRegister.ModifierKey.Ctrl, Keys.Tab)
|
||||
' 'Shift-Tab | Reverse one tab
|
||||
' HotKey_ShiftTab = New clsHotKeyRegister(clsHotKeyRegister.ModifierKey.Ctrl + clsHotKeyRegister.ModifierKey.Shift, Keys.Tab)
|
||||
End Sub
|
||||
|
||||
Public Shared Sub UpdateCheck()
|
||||
If My.Settings.CheckForUpdatesAsked And My.Settings.CheckForUpdatesOnStartup Then
|
||||
If My.Settings.UpdatePending Or My.Settings.CheckForUpdatesLastCheck < Date.Now.Subtract(TimeSpan.FromDays(My.Settings.CheckForUpdatesFrequencyDays)) Then
|
||||
@@ -460,11 +414,7 @@ Namespace App
|
||||
' ToDo: Change Report.log location
|
||||
File.Delete(My.Application.Info.DirectoryPath & "\Report.log")
|
||||
End If
|
||||
|
||||
End If
|
||||
' 'Unregister Hotkeys
|
||||
' HotKey_CtrlTab.Unregister()
|
||||
' HotKey_ShiftTab.Unregister()
|
||||
|
||||
sS.Save()
|
||||
Catch ex As Exception
|
||||
@@ -1715,45 +1665,6 @@ Namespace App
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
'Determine if the Foreground window is current instance of mRemoteNG, Contained Putty instance or Contained External App instance
|
||||
Public Shared Function ForegroundWindowRealtedToAppInstance() As Boolean
|
||||
If GetForegroundWindow() = frmMain.Handle Then
|
||||
Return True
|
||||
End If
|
||||
|
||||
For Each conns As Connection.Info In cL
|
||||
For Each openCon As Connection.Protocol.Base In conns.OpenConnections
|
||||
Select Case openCon.InterfaceControl.Info.Protocol
|
||||
Case Connection.Protocol.Protocols.SSH1
|
||||
If TryCast(openCon.InterfaceControl.Protocol, Connection.Protocol.PuttyBase).PuttyHandle = GetForegroundWindow() Then
|
||||
Return True
|
||||
End If
|
||||
Case Connection.Protocol.Protocols.SSH2
|
||||
If TryCast(openCon.InterfaceControl.Protocol, Connection.Protocol.PuttyBase).PuttyHandle = GetForegroundWindow() Then
|
||||
Return True
|
||||
End If
|
||||
Case Connection.Protocol.Protocols.RAW
|
||||
If TryCast(openCon.InterfaceControl.Protocol, Connection.Protocol.PuttyBase).PuttyHandle = GetForegroundWindow() Then
|
||||
Return True
|
||||
End If
|
||||
Case Connection.Protocol.Protocols.Rlogin
|
||||
If TryCast(openCon.InterfaceControl.Protocol, Connection.Protocol.PuttyBase).PuttyHandle = GetForegroundWindow() Then
|
||||
Return True
|
||||
End If
|
||||
Case Connection.Protocol.Protocols.Telnet
|
||||
If TryCast(openCon.InterfaceControl.Protocol, Connection.Protocol.PuttyBase).PuttyHandle = GetForegroundWindow() Then
|
||||
Return True
|
||||
End If
|
||||
Case Connection.Protocol.Protocols.IntApp
|
||||
If TryCast(openCon.InterfaceControl.Protocol, Connection.Protocol.IntApp).IntAppHandle = GetForegroundWindow() Then
|
||||
Return True
|
||||
End If
|
||||
End Select
|
||||
Next
|
||||
Next
|
||||
Return False
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
#Region "SQL Watcher"
|
||||
|
||||
@@ -28,8 +28,6 @@ Public Class frmMain
|
||||
|
||||
Startup.CreateLogger()
|
||||
|
||||
Startup.RegisterHotKeys()
|
||||
|
||||
' Load GUI Configuration
|
||||
sL.Load()
|
||||
|
||||
|
||||
@@ -226,37 +226,8 @@ Namespace UI
|
||||
Me.InitializeComponent()
|
||||
Me.Text = FormText
|
||||
Me.TabText = FormText
|
||||
|
||||
'AddHandler mRemoteNG.App.Runtime.HotKey_CtrlTab.Pressed, AddressOf CtrlTabHK_Press
|
||||
'AddHandler mRemoteNG.App.Runtime.HotKey_ShiftTab.Pressed, AddressOf ShiftTabHK_Press
|
||||
End Sub
|
||||
|
||||
Protected Sub CtrlTabHK_Press(ByVal sender As Integer)
|
||||
With Me.TabController
|
||||
If .TabPages.Count > 1 And Me.Visible Then
|
||||
If .TabPages.Count = .SelectedIndex + 1 Then
|
||||
.SelectedIndex = 0
|
||||
Else
|
||||
.SelectedIndex = .SelectedIndex + 1
|
||||
End If
|
||||
FocusIC()
|
||||
RefreshIC()
|
||||
End If
|
||||
End With
|
||||
End Sub
|
||||
Protected Sub ShiftTabHK_Press(ByVal sender As Integer)
|
||||
With Me.TabController
|
||||
If .TabPages.Count > 1 And Me.Visible Then
|
||||
If .SelectedIndex = 0 Then
|
||||
.SelectedIndex = .TabPages.Count - 1
|
||||
Else
|
||||
.SelectedIndex = .SelectedIndex - 1
|
||||
End If
|
||||
FocusIC()
|
||||
RefreshIC()
|
||||
End If
|
||||
End With
|
||||
End Sub
|
||||
Public Function AddConnectionTab(ByVal conI As mRemoteNG.Connection.Info) As Magic.Controls.TabPage
|
||||
Try
|
||||
Dim nTab As New Magic.Controls.TabPage
|
||||
|
||||
Reference in New Issue
Block a user