News:

Simutrans Chat Room
Where cool people of Simutrans can meet up.

Bug: Broken clipboard support on Windows.

Started by DrSuperGood, May 01, 2018, 11:45:08 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

DrSuperGood

One cannot use the clipboard properly with Simutrans Extended on Windows. It will fail to copy text inside Simutrans Extended to the outside or paste text from outside into Simutrans Extended.

The solution should be as simple as to merge clipboard_w32.cc in from standard.

jamespetts

Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

DrSuperGood

Checked nightly and still not fixed. This means that some other issue is the cause.

Make sure that the Windows build is linking to clipboard_w32.cc and not clipboard_internal.cc. The clipboard_internal.cc is a pseudo clipboard implementation that only works inside Simutrans intended for operating systems which have no global clipboard state. The clipboard_w32.cc implementation is intended only for Microsoft Windows which does maintain a global clipboard state.

jamespetts

Are you sure that you have the latest version? The time that you posted might have been shortly before the update. The file date for the executable needs to be to-day, the 2nd of May. I have tested, and the clipboard works for me with the updated version, whereas it did not before.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

DrSuperGood

The version I tested was built...
02 ‎May ‎2018, ‏‎05:15:37
No newer updates are available acording to my updater tool.

With this version I can confirm that clipboard only works within Simutrans Extended for Simutrans-Extended-64.exe and Simutrans-Extended.exe. In both cases it does not work for interacting outside Simutrans-Extended, not seeing text copied to clipboard in Windows or allowing windows to paste text copied from inside Simutrans Extended. I can also confirm this is not a problem for both the release and my own builds of Simutrans Standard.

jamespetts

That is very odd - it works in a Visual Studio compiled debug build, but not in the cross-compiled release build. Have you any insight into what might cause this inconsistency?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

DrSuperGood

QuoteHave you any insight into what might cause this inconsistency?
Make sure it is building using clipboard_w32.cc and not clipboard_internal.cc.

jamespetts

The relevant part of the makefile is:


ifeq ($(OSTYPE),mingw32 mingw64)
  SOURCES += clipboard_w32.cc
else
  SOURCES += clipboard_internal.cc
endif


I think that this is correct?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

DrSuperGood

#8
I am unfamiliar with the exact syntax of makefile, however it is raising alarm bells as the possible cause.

In standard the following is used...
ifeq ($(OSTYPE),mingw)
  SOURCES += clipboard_w32.cc
else
  SOURCES += clipboard_internal.cc
endif

Now standard only supports x86 builds and not x86-64.

What I suspect is happening is it is checking if OSTYPE is "mingw32 mingw64" which it never will be.

For the lack of a more elegant solution I can only recommend trying this for now...
ifeq ($(OSTYPE),mingw64)
  SOURCES += clipboard_w32.cc
else
  ifeq ($(OSTYPE),mingw32)
    SOURCES += clipboard_w32.cc
  else
    SOURCES += clipboard_internal.cc
  endif
endif

Ugly I know, but honestly I have little knowledge of the syntax of makefile.

Phystam

I confirmed that the issue has been fixed in Japanese environment.
Thank you for solving it!

jamespetts

Splendid, thank you for confirming. My apologies for forgetting to post a reply noting that I had adopted Dr. Supergood's suggested fix.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

TurfIt

findstring is what you're looking for to avoid the ugly... and, make syntax is whitespace sensitive - get the tabs outta there. Except the one that belongs.

DrSuperGood

Quotefindstring is what you're looking for to avoid the ugly... and, make syntax is whitespace sensitive - get the tabs outta there. Except the one that belongs.
Please post the solution rather than hinting it. I just made that nonsense because that is kind of how Simutrans standard makefile looks.

In a Language like Java I would use a Set of String and then check if it contains the given String. I did read that in makefiles one could do something similar with findstring but seeing how the conditional tests need 2 arguments rather than taking a logical boolean I had no idea if the syntax would be right.