Added setting focus on the window when a file is loaded in the existing

instance.

Unfortunately doesn't work consistenly across platforms: (1) Linux works
best activating and raising the application window. (2) OSX checks for the
application running and doesn't even get to the "single instance" check;
when started with "bin/lua src/main.lua zbstudio <file>" it correctly
loads the file, but doesn't switch to the app. (3) Windows doesn't
activate the app window all the time (it activates it the first time, but
not subsequent times).
This commit is contained in:
Paul Kulchenko
2012-11-18 20:24:19 -08:00
parent 5af9d4d487
commit bc55f6a72d

View File

@@ -50,8 +50,13 @@ if success then -- ok, server was started, we are solo
svr:sendto(protocol.server.answerok,ip,port)
local filename = msg:match(protocol.client.requestloading:gsub("%%s","(.+)$"))
if filename then
if LoadFile(filename, nil, true)
then ide.frame:RequestUserAttention() -- let's let the user know we want his attention
if LoadFile(filename, nil, true) then
local frame = ide.frame
frame:Iconize(false)
frame:Raise()
frame:Show(true)
frame:SetFocus()
frame:RequestUserAttention()
else DisplayOutput("Can't open requested file '"..filename.."'.\n") end
end
end