mirror of
https://github.com/lutris/lutris
synced 2024-09-04 23:13:35 +00:00
Enable the 'break' keystroke to stop a running game.
GTK calls it break, but it's ctrl-pause on my keyboard. This is useful when a game won't go of the mouse, but the keyboard can be used. Deus Ex: Human Revolution does this; this keystroke will let me kill it and get control again.
This commit is contained in:
parent
66f58f2770
commit
80719ab5a7
|
@ -40,6 +40,10 @@ class GameActions:
|
|||
def is_game_running(self):
|
||||
return self.game and self.game.is_db_stored and bool(self.application.get_running_game_by_id(self.game.id))
|
||||
|
||||
@property
|
||||
def is_game_removable(self):
|
||||
return self.game and (self.game.is_installed or self.game.is_db_stored)
|
||||
|
||||
def on_game_state_changed(self, game):
|
||||
"""Handler called when the game has changed state"""
|
||||
if self.game and game.id == self.game.get_safe_id():
|
||||
|
@ -129,7 +133,7 @@ class GameActions:
|
|||
and steam_shortcut.shortcut_exists(self.game)
|
||||
and not steam_shortcut.is_steam_game(self.game)
|
||||
),
|
||||
"remove": self.game.is_installed or self.game.is_db_stored,
|
||||
"remove": self.is_game_removable,
|
||||
"view": True,
|
||||
"hide": self.game.is_installed and not self.game.is_hidden,
|
||||
"unhide": self.game.is_hidden,
|
||||
|
@ -149,7 +153,7 @@ class GameActions:
|
|||
|
||||
return None
|
||||
|
||||
def on_game_stop(self, _caller):
|
||||
def on_game_stop(self, *_args):
|
||||
"""Stops the game"""
|
||||
game = self.get_running_game()
|
||||
if game:
|
||||
|
|
|
@ -79,5 +79,11 @@ class GameView:
|
|||
game_id = self.get_selected_game_id()
|
||||
if game_id:
|
||||
game_actions = self.get_game_actions(game_id)
|
||||
if game_actions:
|
||||
if game_actions and game_actions.is_game_removable:
|
||||
game_actions.on_remove_game(self)
|
||||
elif key == Gdk.KEY_Break:
|
||||
game_id = self.get_selected_game_id()
|
||||
if game_id:
|
||||
game_actions = self.get_game_actions(game_id)
|
||||
if game_actions and game_actions.is_game_running:
|
||||
game_actions.on_game_stop(self)
|
||||
|
|
Loading…
Reference in a new issue