diff --git a/main.pas b/main.pas
index 9d1bd85d..8eb4f400 100644
--- a/main.pas
+++ b/main.pas
@@ -713,8 +713,6 @@ TMainForm = class(TBaseForm)
{$ifdef windows}
FFileManagerDefault: string;
FFileManagerDefaultParam: string;
- FGlobalHotkey: string;
- fGlobalHotkeyMod: string;
FUserDefinedMenuEx: string;
FUserDefinedMenuParam: string;
{$endif windows}
@@ -811,6 +809,9 @@ TMainForm = class(TBaseForm)
function SelectRemoteFolder(const CurFolder, DialogTitle: string): string;
procedure ConnectionSettingsChanged(const ActiveConnection: string; ForceReconnect: boolean);
procedure StatusBarSizes;
+{$ifdef windows}
+ procedure SetUpWindowsHotKey;
+{$endif windows}
private
procedure _onException(Sender: TObject; E: Exception);
end;
@@ -1007,6 +1008,19 @@ function WndCallback(Ahwnd: HWND; uMsg: UINT; wParam: WParam; lParam: LParam):LR
result:=CallWindowProc(PrevWndProc,Ahwnd, uMsg, WParam, LParam);
end;
+procedure TMainForm.SetUpWindowsHotKey;
+var
+ VKKey, VKModifier: word;
+begin
+ VKKey:=VKStringToWord(Ini.ReadString('Interface','GlobalHotkey',''));
+ VKModifier:=VKStringToWord(Ini.ReadString('Interface','GlobalHotkeyMod',''));
+ if VKKey <> 0 then begin
+ HotKeyID:=GlobalAddAtom('TransGUIHotkey');
+ PrevWndProc:=windows.WNDPROC(SetWindowLongPtr(Self.Handle,GWL_WNDPROC,PtrInt(@WndCallback)));
+ RegisterHotKey(Self.Handle,HotKeyID, VKModifier, VKKey);
+ end;
+end;
+
{$endif windows}
function IsHash(Hash: String): boolean;
@@ -1822,11 +1836,8 @@ procedure TMainForm.FormCreate(Sender: TObject);
{$ifdef windows}
FFileManagerDefault:=Ini.ReadString('Interface','FileManagerDefault','explorer.exe');
FFileManagerDefaultParam:=Ini.ReadString('Interface', 'FileManagerDefaultParam', '/select,"%s"');
- FGlobalHotkey:=Ini.ReadString('Interface','GlobalHotkey','');
- FGlobalHotkeyMod:=Ini.ReadString('Interface','GlobalHotkeyMod','0');
- HotKeyID := GlobalAddAtom('TransGUIHotkey');
- PrevWndProc:=windows.WNDPROC(SetWindowLongPtr(Self.Handle,GWL_WNDPROC,PtrInt(@WndCallback)));
- RegisterHotKey(Self.Handle,HotKeyID, VKStringToWord(FGlobalHotkeyMod), VKStringToWord(FGlobalHotkey));
+ SetUpWindowsHotKey;
+
// Create UserMenus if any in [UserMenu]
j:= 1;
repeat
diff --git a/transgui.lpi b/transgui.lpi
index b5e290fa..b381e71a 100644
--- a/transgui.lpi
+++ b/transgui.lpi
@@ -296,6 +296,11 @@
+
+
+
+
+
@@ -504,6 +509,7 @@
+
diff --git a/transgui.lpr b/transgui.lpr
index 1ac91716..011b16c2 100644
--- a/transgui.lpr
+++ b/transgui.lpr
@@ -22,10 +22,6 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*************************************************************************************}
-{$ifdef windows}
-{$apptype gui}
-{$endif windows}
-
program transgui;
{$mode objfpc}{$H+}
@@ -39,20 +35,14 @@
clocale,
{$endif}
{$endif}
- Interfaces, // this includes the LCL widgetset
- Forms
- { you can add units after this }, BaseForm, Main, rpc, AddTorrent,
+ Interfaces, Forms, BaseForm, Main, rpc, AddTorrent,
ConnOptions, varlist, TorrProps, DaemonOptions, About, IpResolver, download,
ColSetup, utils, ResTranslator, AddLink, MoveTorrent, AddTracker, Options,
passwcon;
-//{$ifdef windows}
{$R *.res}
-//{$endif}
begin
-//Application.Scaled:=True; //travis doesnt compile
-
if not CheckAppParams then exit;
Application.Initialize;