The International Simutrans Forum

Simutrans Extended => Simutrans-Extended bug reports => Simutrans-Extended development => Simutrans-Extended closed bug reports => Topic started by: DrSuperGood on May 01, 2018, 11:45:08 PM

Title: Bug: Broken clipboard support on Windows.
Post by: DrSuperGood on May 01, 2018, 11:45:08 PM
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.
Title: Re: Bug: Broken clipboard support on Windows.
Post by: jamespetts on May 01, 2018, 11:55:21 PM
Thank you - now incorporated.
Title: Re: Bug: Broken clipboard support on Windows.
Post by: DrSuperGood on May 02, 2018, 05:12:25 AM
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.
Title: Re: Bug: Broken clipboard support on Windows.
Post by: jamespetts on May 02, 2018, 12:08:37 PM
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.
Title: Re: Bug: Broken clipboard support on Windows.
Post by: DrSuperGood on May 02, 2018, 04:32:19 PM
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.
Title: Re: Bug: Broken clipboard support on Windows.
Post by: jamespetts on May 02, 2018, 05:49:18 PM
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?
Title: Re: Bug: Broken clipboard support on Windows.
Post by: DrSuperGood on May 02, 2018, 07:15:08 PM
QuoteHave you any insight into what might cause this inconsistency?
Make sure it is building using clipboard_w32.cc and not clipboard_internal.cc.
Title: Re: Bug: Broken clipboard support on Windows.
Post by: jamespetts on May 02, 2018, 07:48:06 PM
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?
Title: Re: Bug: Broken clipboard support on Windows.
Post by: DrSuperGood on May 02, 2018, 08:53:42 PM
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.
Title: Re: Bug: Broken clipboard support on Windows.
Post by: Phystam on May 03, 2018, 05:49:31 AM
I confirmed that the issue has been fixed in Japanese environment.
Thank you for solving it!
Title: Re: Bug: Broken clipboard support on Windows.
Post by: jamespetts on May 03, 2018, 08:40:14 AM
Splendid, thank you for confirming. My apologies for forgetting to post a reply noting that I had adopted Dr. Supergood's suggested fix.
Title: Re: Bug: Broken clipboard support on Windows.
Post by: TurfIt on May 03, 2018, 07:37:15 PM
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.
Title: Re: Bug: Broken clipboard support on Windows.
Post by: DrSuperGood on May 03, 2018, 10:38:46 PM
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.