From bc55f6a72d3bf3eb2096713dde50e4e8d82c3f8f Mon Sep 17 00:00:00 2001 From: Paul Kulchenko Date: Sun, 18 Nov 2012 20:24:19 -0800 Subject: [PATCH] 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 " 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). --- src/editor/singleinstance.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/editor/singleinstance.lua b/src/editor/singleinstance.lua index ee97c01f05..718f2af496 100644 --- a/src/editor/singleinstance.lua +++ b/src/editor/singleinstance.lua @@ -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