mirror of
https://github.com/vidarh/ruby-x11
synced 2024-11-16 07:48:12 +01:00
remove whitespace
This commit is contained in:
parent
4d243c1644
commit
88152ffee6
2 changed files with 15 additions and 15 deletions
|
@ -6,7 +6,7 @@
|
|||
|
||||
module X11
|
||||
class Auth
|
||||
|
||||
|
||||
FAILED = 0
|
||||
AUTHENTICATE = 1
|
||||
SUCCESS = 2
|
||||
|
@ -23,22 +23,22 @@ module X11
|
|||
}
|
||||
|
||||
AuthInfo = Struct.new :family, :address, :display, :auth_name, :auth_data
|
||||
|
||||
# Open an authority file, and create an object to handle it.
|
||||
# The filename will be taken from the XAUTHORITY environment variable,
|
||||
# if present, or '.Xauthority' in the user's home directory, or it may be overridden
|
||||
# by an argument.
|
||||
|
||||
# Open an authority file, and create an object to handle it.
|
||||
# The filename will be taken from the XAUTHORITY environment variable,
|
||||
# if present, or '.Xauthority' in the user's home directory, or it may be overridden
|
||||
# by an argument.
|
||||
def initialize(path = ENV['XAUTHORITY'] || ENV['HOME'] + "/Xauthority")
|
||||
@file = File.open(path)
|
||||
end
|
||||
|
||||
# Get authentication data for a connection of type family to display display_id on host.
|
||||
# If family is 'Internet', the host will be translated into an appropriate address by gethostbyname().
|
||||
# Get authentication data for a connection of type family to display display_id on host.
|
||||
# If family is 'Internet', the host will be translated into an appropriate address by gethostbyname().
|
||||
# If no data is found, returns nil
|
||||
def get_by_hostname(host, family, display_id)
|
||||
host = `hostname`.chomp if host == 'localhost' or host == '127.0.0.1'
|
||||
address = TCPSocket.gethostbyname(host) if family == :Internet # this line does nothing for now
|
||||
|
||||
|
||||
auth_data = nil
|
||||
|
||||
# with each entry from XAuthority file
|
||||
|
@ -48,9 +48,9 @@ module X11
|
|||
end
|
||||
|
||||
reset
|
||||
return auth_data
|
||||
return auth_data
|
||||
end
|
||||
|
||||
|
||||
# returns one entry from Xauthority file
|
||||
def read
|
||||
auth_info = []
|
||||
|
|
|
@ -5,7 +5,7 @@ module X11
|
|||
def initialize(target = ENV['DISPLAY'])
|
||||
target =~ /^([\w.-]*):(\d+)(?:.(\d+))?$/
|
||||
host, display_id, screen_id = $1, $2, $3
|
||||
family = nil
|
||||
family = nil
|
||||
|
||||
if host.empty?
|
||||
@socket = UNIXSocket.new("/tmp/.X11-unix/X#{display_id}")
|
||||
|
@ -13,7 +13,7 @@ module X11
|
|||
host = nil
|
||||
else
|
||||
@socket = TCPSocket.new(host,6000+display_id)
|
||||
family = :Internet
|
||||
family = :Internet
|
||||
end
|
||||
|
||||
authorize(host, family, display_id)
|
||||
|
@ -33,7 +33,7 @@ private
|
|||
auth_name, auth_data = auth_info.address, auth_info.auth_data
|
||||
puts auth_name
|
||||
puts auth_data
|
||||
|
||||
|
||||
@socket.write([
|
||||
Protocol::BYTE_ORDER,
|
||||
Protocol::MAJOR,
|
||||
|
@ -53,7 +53,7 @@ private
|
|||
when X11::Auth::AUTHENTICATE
|
||||
raise "Connection requires authentication"
|
||||
when X11::Auth::SUCCESS
|
||||
raise "fix me"
|
||||
raise "fix me"
|
||||
else
|
||||
raise "received unknown opcode #{type}"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue