mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-27 19:42:22 -05:00
Simba: Further clean up keybinding code.
This commit is contained in:
parent
c353870a84
commit
dfe97bf3a8
@ -576,10 +576,16 @@ begin
|
|||||||
mDebugLn('Unable to register Ctrl + Alt + S as global hotkey');
|
mDebugLn('Unable to register Ctrl + Alt + S as global hotkey');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure Unbind_Windows_Keys;
|
||||||
|
begin
|
||||||
|
if not UnRegisterHotkey(Self.Handle,0) then
|
||||||
|
mDebugLn('Unable to unregister ctrl + alt + s as global hotkey');
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
{$IFDEF LINUX_HOTKEYS}
|
{$IFDEF LINUX_HOTKEYS}
|
||||||
{$WARNING This will probably not work if people don't have libkeybinder installed. Perhaps ship it with Simba? }
|
{$WARNING This will probably not work if people don't have libkeybinder installed. Perhaps ship it with Simba? }
|
||||||
|
|
||||||
{ Used for global callbacks on LINUX }
|
{ Used for global callbacks on LINUX }
|
||||||
procedure keybinder_callback(keystring: PChar; user_data: PtrUInt); cdecl;
|
procedure keybinder_callback(keystring: PChar; user_data: PtrUInt); cdecl;
|
||||||
@ -596,6 +602,11 @@ begin
|
|||||||
if not keybinder_bind(PChar(shortcut_StopScript), @keybinder_callback, PtrUInt(0)) then
|
if not keybinder_bind(PChar(shortcut_StopScript), @keybinder_callback, PtrUInt(0)) then
|
||||||
mDebugLn('Unable to register Ctrl + Alt + S as global hotkey');
|
mDebugLn('Unable to register Ctrl + Alt + S as global hotkey');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure Unbind_Linux_Keys;
|
||||||
|
begin
|
||||||
|
keybinder_unbind(PChar(shortcut_StopScript), @keybinder_callback, PtrUInt(0));
|
||||||
|
end;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -2441,10 +2452,11 @@ begin
|
|||||||
ParamHint.Free;
|
ParamHint.Free;
|
||||||
|
|
||||||
{$ifdef MSWindows}
|
{$ifdef MSWindows}
|
||||||
if not UnRegisterHotkey(Self.Handle,0) then
|
Unbind_Windows_Keys;
|
||||||
mDebugLn('Unable to unregister ctrl + alt + s as global hotkey');
|
|
||||||
{$else}
|
{$else}
|
||||||
keybinder_unbind(PChar(shortcut_StopScript), @keybinder_callback, PtrUInt(0));
|
{$IFDEF LINUX_HOTKEYS}
|
||||||
|
Unbind_Linux_Keys;
|
||||||
|
{$ENDIF}
|
||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user