Handle termination properly
* Tell the manager to close the display before terminating; * Log about quit request and process termination.
This commit is contained in:
@@ -22,6 +22,11 @@ module Uh
|
||||
@events.emit :connected, args: @display
|
||||
end
|
||||
|
||||
def disconnect
|
||||
@display.close
|
||||
@events.emit :disconnected
|
||||
end
|
||||
|
||||
def grab_key keysym, mod = nil
|
||||
mod_mask = KEY_MODIFIERS[@modifier]
|
||||
mod_mask |= KEY_MODIFIERS[mod] if mod
|
||||
|
@@ -8,6 +8,7 @@ module Uh
|
||||
runner.register_event_hooks
|
||||
runner.connect_manager
|
||||
runner.run_until { runner.stopped? }
|
||||
runner.terminate
|
||||
end
|
||||
end
|
||||
|
||||
@@ -57,6 +58,11 @@ module Uh
|
||||
manager.handle_pending_events until block.call
|
||||
end
|
||||
|
||||
def terminate
|
||||
@env.log "Terminating..."
|
||||
manager.disconnect
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
@@ -71,6 +77,7 @@ module Uh
|
||||
@events.on :connected do |display|
|
||||
@env.log "Connected to X server on `#{display}'"
|
||||
end
|
||||
@events.on(:disconnected) { @env.log "Disconnected from X server" }
|
||||
end
|
||||
|
||||
def register_layout_hooks
|
||||
|
Reference in New Issue
Block a user