Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

editor: windows: fix double click when app already open #2029

Merged

Conversation

llloret
Copy link
Member

@llloret llloret commented May 5, 2016

When you double click on an scd file, and scide was already opened,
scide was ignoring that. The issue is that the IPC mechanism to
communicate with the running instance was using a socket that was not
there yet. I have moved the allocation of the socket to the point where
the connection is made, and it is working ok now.

When you double click on an scd file, and scide was already opened,
scide was ignoring that. The issue is that the IPC mechanism to
communicate with the running instance was using a socket that was not
there yet. I have moved the allocation of the socket to the point where
the connection is made, and it is working ok now.
@@ -131,6 +131,7 @@ int main( int argc, char *argv[] )
void SingleInstanceGuard::onNewIpcConnection()
{
mIpcSocket = mIpcServer->nextPendingConnection();
mIpcChannel->setSocket(mIpcSocket);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use 4 spaces for indentations in the ide to keep the codebase clean.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, let me fix that.

Copy link
Member Author

@llloret llloret May 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I was using another computer than the one I usually use, and it was misconfigured.

@llloret
Copy link
Member Author

llloret commented May 5, 2016

@bagong, this fixes issue 2 of #2022. I am not sure if this same mechanism that I fixed is used in Mac and Linux, but it should be checked.

Basically, to connect the new instance to the running one, it was assigning a socket before the connection was made. I have moved the allocation to the point of connection.

If we are in time, I would try to put this into the test build (after you have tested it a bit, if you can)

Luis


// socket is NULL here in Windows, so we pass it in onNewIpcConnection()
QTcpSocket *socket = mIpcServer->nextPendingConnection();
mIpcChannel = new ScIpcChannel(socket, QString("SingleInstanceGuard"), this);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is no functional change here, is this intended?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this was to expose the fact that socket is NULL at this point. Might be useful while debugging. I can undo it if you want.

@timblechmann
Copy link
Contributor

i'm not exactly sure if this is the right way to go, as it uses QTcpServer while the original code used QLocalServer. maybe first try to revert to the code of SingleInstanceGuard in the master branch.

@llloret
Copy link
Member Author

llloret commented May 5, 2016

Yes, I agree. I think that we should do that when we start merging the stuff from the win3.7 branch into master.

For now, I would say, let´s leave it like that so that Windows people can open files from the Explorer. For example, it would have been very useful for @bagong to test the sc3-plugins.

As far as I can see merging into the master is going to take some effort, so I would not block this enhancement if possible while we do that...

Once we have a 3.7.2 in Windows that can get people back to SC in that platform we can start merging.

Just my thoughts, of course! I am pretty new to SC devel, so I might be missing something here.

@timblechmann
Copy link
Contributor

@llloret well, i have a strong opinion against using QTcpServer instead of QLocalServer. i had suggested to file a qt bug report with a simplified reproducer, but the person who wrote that code refused to do it. i had also pointed to a preprocessor flag in the qt sources which seemed to be related to winrt and suggested to have a closer look into that.

i had backported the good win32-specific fixes to master, except for the cmake changes which were obviously wrong and the localsocket stuff, which i considered as ugly hack, where the actual issue should be addressed differently. so personally i'm not a big fan of merging this, but would prefer finding a solution using local sockets.

@llloret
Copy link
Member Author

llloret commented May 6, 2016

@timblechmann, that's fine, but would it be ok to look into that once we have released 3.7.2, so that users can start moving to the 3.7 series ASAP?

BTW, just so that I start to understand more about SC, could you elaborate on why you feel so strong about using QLocalServer instead of QTcpServer, and why you think the latter is an ugly hack? I trust your opinion on this, but I would like to understand more, so that I can help more.

@bagong
Copy link
Contributor

bagong commented May 6, 2016

Works!!!!! Even with single click ;) Thaaanks! Will go back to sc3-plugins testing ;) No, midi!

@timblechmann
Copy link
Contributor

@llloret

  • the intended semantics is local IPC, not networking.
  • platform-specific workarounds harm long-term maintenance. if there is a problem with QLocalServer on windows, it should be addressed upstream.
  • QT_LOCALSOCKET_TCP should be evaluated, as it seems to provide the required workaround without any changes to the IDE.
  • on unix local sockets will outperform tcp due to the tcp overhead. so they should be preferred on linux platforms.

apart from that the implementation does some changes, which is unrelated like changing SCIpcClient to ScIpcClient or doing some whitespace changes. i'm definitely not against those changes per se, but they shouldn't be mixed with a functional change, as it will end up as 'all-or-nothing' commit. and new files don't match the coding style of the ide.

@bagong
Copy link
Contributor

bagong commented May 19, 2016

@timblechmann This is a commit for the 3.7.2 release. It will be reevaluated when we think about how to go on for master... I think @llloret already has an idea...

@bagong bagong merged commit 9c7b6d7 into supercollider:3.7win May 19, 2016
@llloret llloret deleted the double_click_open_multiple_tabs branch May 20, 2016 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants