Mouse copy/paste support (Windows)

Here you can discuss the development of patches.

Re: Mouse copy/paste support

Postby Dominus » 2014-10-28 @ 20:17

Emendelson, keep it simple.
Only build dosbox with the patch once, without running sed on the makefile. You need to make sure it works before trying to make the static stuff.
User avatar
Dominus
DOSBox Moderator
 
Posts: 7578
Joined: 2002-10-03 @ 09:54
Location: Vienna or Ludwigsburg

Re: Mouse copy/paste support

Postby emendelson » 2014-10-28 @ 20:50

Will try that as soon as I can. Thanks!
emendelson
Oldbie
 
Posts: 744
Joined: 2010-2-14 @ 02:00

Re: Mouse copy/paste support

Postby emendelson » 2014-10-28 @ 21:40

Following Dominus's advice, I tried to keep it simple. I did this:

I added the patch from an earlier post to configure.ac. I ran configure with --enable-clipboard.

I simply don't know how to tell the linker to find pdcurses, so when I run configure --enable-clipboard I get this error:

checking for initscr in -lpdcurses... no
configure: error: Can't find pdcurses, which is required for clipboard mode

Presumably, anyone at kindergarten level knows how to fix this.
emendelson
Oldbie
 
Posts: 744
Joined: 2010-2-14 @ 02:00

Re: Mouse copy/paste support

Postby truth_deleted » 2014-10-28 @ 22:10

*
truth_deleted
 

Re: Mouse copy/paste support

Postby Dominus » 2014-10-28 @ 22:24

emendelson: several things

1. rebuild the pdcurses-sdl. You have built it for 64bit. make sure you use the same exports as in the script
Code: Select all
OPT=' -arch i386 -m32 -O2 -msse -msse2 -force_cpusubtype_ALL '
SDK=' -mmacosx-version-min=10.6 '
export MACOSX_DEPLOYMENT_TARGET=10.6
export PATH=/opt/local/bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
export CC="/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -arch i386"
export CXX="/Applications/Xcode.app/Contents/Developer/usr/bin/g++ -arch i386"
export CPPFLAGS='-I/opt/local/include '$SDK
export CFLAGS='-I/opt/local/include '$SDK' '$OPT
export CXXFLAGS='-I/opt/local/include '$SDK' '$OPT
export LDFLAGS='-L/opt/local/lib '$SDK' '$OPT  # <- comment out if not using libpng
export PKG_CONFIG_PATH="/opt/local/lib/pkgconfig"

you are building Dosbox in 32bit and so should all the libs be in 32bit or they won't get used

2. in truth5678's diff for configure.ac change
LIBS="$LIBS -lpdcurses" to LIBS="$LIBS /opt/local/lib/libpdcurses.a"
Since pdcurses-SDL only builds a static lib you need to give the path to the static lib


That should be it, haven't gotten clipboarding to work, though. But I need to look closer at the instructions :)

Edit: viewtopic.php?t=32230 <- maybe the lib path needs to be in front of $LIBS
User avatar
Dominus
DOSBox Moderator
 
Posts: 7578
Joined: 2002-10-03 @ 09:54
Location: Vienna or Ludwigsburg

Re: Mouse copy/paste support

Postby Dominus » 2014-10-28 @ 23:21

hmm, definitely not working on OS X.
I *suspect* that one needs to include sdl1/pdcsdl.h from the pdcurses sources. I tried to include it in sdlmain.cpp after the curses.h include but that failed at first on undefined PDCEX. That I solved by using an original curses.h file (curses.h that was created by the diff was tripped exactly off this define).
But still not working:
I cannot see a marker when holding the right mouse button on anything in Dosbox (I tried the Windows binary and saw that there is a marker).
But at least it seems to do something as the right click on the prompt does move the cursor by spaces. Kind of similar to when you mark a couple of rows in the Windows binary and then paste them via right click.

(this is happening no matter whether I included pdcsdl.h in sdlmain.cpp)
User avatar
Dominus
DOSBox Moderator
 
Posts: 7578
Joined: 2002-10-03 @ 09:54
Location: Vienna or Ludwigsburg

Re: Mouse copy/paste support

Postby truth_deleted » 2014-10-29 @ 01:26

My fault that I didn't realize pdcurses-sdl was static library only (libpdcurses.a). :) Using mingw and building pdcurses-sdl by its makefile for mingw, I built a working dosbox with the clipboard patch. It required the following change to configure.ac posted earlier in this thread:
Code: Select all
-     LIBS="$LIBS -lpdcurses"
+     LIBS="-Wl,-Bstatic -lpdcurses -Wl,-Bdynamic $LIBS"

This enforced a mingw built dosbox with a static pdcurses-sdl library; confirmed that the binary is functioning and linked to a static library. [library order from above hint: viewtopic.php?t=32230]

Apparently, the OSX environment does not support the above -Bstatic switch in configure, so Dominus has implemented another method to link with the static library in OSX.

I confirmed that pdcurses-sdl potentially works with dosbox, so it may be a specific issue with the pdcurses-sdl for OSX. Fortunately, there are several binaries built in pdcurses-sdl which test the pdcurses function: firework, ptest, sdltest, tuidemo, xmas, newdemo, rain, testcurs, worm. Many should have the SDL library dependency, but they produce test results, so we can verify the functioning of the OSX build of the pdcurses-sdl library. The clipboard function should be tested by the testcurs binary after modifying a line of its source code in /sdl1:
Code: Select all
#define HAVE_CLIPBOARD 1

The clipboard functions are in /sdl1/pdcclip.c and the testcurs binary tests those functions:
test.PNG

Verify that curses.h includes the clipboard functions, such as PDC_clearclipboard. If the curses.h isn't from pdcurses, then most likely these functions are missing. I would use the curses.h that is in the patch, but if it fails on OSX then replace these lines in curses.h:
Code: Select all
#ifdef PDC_DLL_BUILD
# ifdef CURSES_LIBRARY
#  define PDCEX __declspec(dllexport) extern
# else
#  define PDCEX __declspec(dllimport)
# endif
#else
# define PDCEX extern
#endif

with this:
Code: Select all
# define PDCEX extern
You do not have the required permissions to view the files attached to this post.
truth_deleted
 

Re: Mouse copy/paste support

Postby emendelson » 2014-10-29 @ 03:16

Under OS X, I built curses (in the sdl1 folder) with #define HAVE_CLIPBOARD 1, and the clipboard test fails - nothing goes in or out.

The curses.h in the PDCurses folder is of course the pdcurses version. I found the ncurses version in usr/include/curses.h but haven't tried replacing it with the pdcurses version. I'll try this tomorrow unless anyone warns me against it.
emendelson
Oldbie
 
Posts: 744
Joined: 2010-2-14 @ 02:00

Re: Mouse copy/paste support

Postby truth_deleted » 2014-10-29 @ 03:34

Pdcurses-sdl must use the pdcurses curses.h file, not another; one reason is that the clipboard functions are not expected in other libraries, but moreso because it will break pdcurses. The /include directory must have header files which match to the linked libraries, especially on OSX.

If running the clipboard test, show the results because they are not easy to interpret (specifically show the final screen that appears from that test). There is no such error I read in source code which outputs "nothing goes in or out" or prints lines that the user copies to the system clipboard. Also, run other tests to verify whether any of the other pdcurses-sdl functions are working.

Report the name of the file modified with: #define HAVE_CLIPBOARD 1.

In addition, if there are any future errors about undefined PDCEX, ensure that this line appears in the pdcurses version of curses.h and it is "seen" by the compiler:
# define PDCEX extern

The above definition line is necessary to define global variables, otherwise pdcurses-sdl will break. This issue doesn't apply to other operating systems and is specific to pdcurses-sdl on OSX.
truth_deleted
 

Re: Mouse copy/paste support

Postby emendelson » 2014-10-29 @ 11:52

truth5678 wrote:If running the clipboard test, show the results because they are not easy to interpret (specifically show the final screen that appears from that test). There is no such error I read in source code which outputs "nothing goes in or out" or prints lines that the user copies to the system clipboard. Also, run other tests to verify whether any of the other pdcurses-sdl functions are working.

Report the name of the file modified with: #define HAVE_CLIPBOARD 1.


I may have misinterpreted the results of the clipboard test. When I first run the clipboard test (in other words, when I launch testcurs and immediately run the clipboard test it reports "there was no text in the clipboard" though in fact I had placed text into the OS X clipboard.

Then in the next screen it puts it says it will place the following string, etc., in the clipboard, and the string is "This string placed etc."

If I then run the test a second time (without exiting testcurs, it tells me Clipboard contents: This string placed [etc.].

However if I try to use Cmd-V in any other application, that sample string is NOT in the OS X clipboard; the clipboard contains the same text that was there before I launched testcurs. But evidently it was in whatever clipboard testcurs was using, because it found that string when I ran the test the second time (as described in the preceding paragraph).

The file that I modified with #define HAVE_CLIPBOARD 1 is testcurs.c. Before I modified that file, the clipboard test did not appear in testcurs.
emendelson
Oldbie
 
Posts: 744
Joined: 2010-2-14 @ 02:00

Re: Mouse copy/paste support

Postby Wengier » 2014-10-29 @ 15:32

emendelson: Maybe there are also two different kinds of "clipboards" in Mac OS X, similar to the differences between PRIMARY and CLIPBOARD selections under Linux/X11?

Anyway, I have tested DOSBox with Long file Name (LFN) and mouse copy/paste support under Linux (Fedora 20), and CONFIRMED both the LFN and mouse copy/paste features will work under Linux with pdcurses-SDL. Are you using the same libpdcurses.a file in DOSBox as in testcurs?
Wengier
Member
 
Posts: 110
Joined: 2014-9-03 @ 19:56

Re: Mouse copy/paste support

Postby emendelson » 2014-10-29 @ 15:37

Wengier wrote:emendelson: Maybe there are also two different kinds of "clipboards" in Mac OS X, similar to the differences between PRIMARY and CLIPBOARD selections under Linux/X11?

Anyway, I have tested DOSBox with Long file Name (LFN) and mouse copy/paste support under Linux (Fedora 20), and CONFIRMED both the LFN and mouse copy/paste features will work under Linux with pdcurses-SDL. Are you using the same libpdcurses.a file in DOSBox as in testcurs?


Wengier, I think you must be right about the two different clipboards in OS X, but this is the first time I experienced it. I'll look into it further.

I will continue to work on this, but I may not be able to report results until next week, and I will be on the road until Tuesday. Thank you again.
emendelson
Oldbie
 
Posts: 744
Joined: 2010-2-14 @ 02:00

Re: Mouse copy/paste support

Postby Wengier » 2014-10-29 @ 15:41

Dominus wrote:hmm, definitely not working on OS X.
I *suspect* that one needs to include sdl1/pdcsdl.h from the pdcurses sources. I tried to include it in sdlmain.cpp after the curses.h include but that failed at first on undefined PDCEX. That I solved by using an original curses.h file (curses.h that was created by the diff was tripped exactly off this define).
But still not working:
I cannot see a marker when holding the right mouse button on anything in Dosbox (I tried the Windows binary and saw that there is a marker).
But at least it seems to do something as the right click on the prompt does move the cursor by spaces. Kind of similar to when you mark a couple of rows in the Windows binary and then paste them via right click.

(this is happening no matter whether I included pdcsdl.h in sdlmain.cpp)


If there is no marker at all, then it is not a problem with the clipboard copy/paste function, since the mouse selection alone will NOT call the copy/paste library functions. Have you enabled C_CLIPBOARD preprocessor directive?

Since I have confirmed that the mouse copy/paste feature-enabled DOSBox will work correctly in Linux with pdcurses-SDL, in theory it should work fine in OS X too, unless there is a bug or something in the OS X port of pdcurses-SDL.
Wengier
Member
 
Posts: 110
Joined: 2014-9-03 @ 19:56

Re: Mouse copy/paste support

Postby truth_deleted » 2014-10-29 @ 19:06

emendelson wrote:When I first run the clipboard test (in other words, when I launch testcurs and immediately run the clipboard test it reports "there was no text in the clipboard" though in fact I had placed text into the OS X clipboard.

Then in the next screen it puts it says it will place the following string, etc., in the clipboard, and the string is "This string placed etc."

The last screen of the clipboard test (testcurs) is still not shown, therefore the final outcome of the test is unknown. However, the above report is consistent with the clipboard functions working in OSX pdcurses-sdl.

Also, the Cmd-V operation is not part of this clipboard test and does not substitute for the final screen of the above clipboard test.
truth_deleted
 

Re: Mouse copy/paste support

Postby emendelson » 2014-10-30 @ 00:12

Apologies for neglecting the screen shot. I think this is what you're asking for. If not, let me know and I'll post another one.
You do not have the required permissions to view the files attached to this post.
emendelson
Oldbie
 
Posts: 744
Joined: 2010-2-14 @ 02:00

Re: Mouse copy/paste support

Postby Wengier » 2014-10-30 @ 00:48

GREAT NEWS!! Today I have downloaded MacOS X 10.10 VMware image and tried it in VMware 10.0.3 myself, and now CONFIRMED that both the Long File Name (LFN) and mouse copy/paste features WORK in OS X with pdcurses-SDL! You should link to the libpdcurses.a file created in the sdl1 directory, and the compiling process is actually very similar to when you do it in Linux. So both the LFN and the mouse copy/paste support are truly cross-platform now!

EDIT: I have attached a screenshot showing LFN and mouse copy/paste enabled-DOSBox running in OS X:
dosboxinosx.png


And another screenshot showing the marker during mouse selection in DOSBox in OS X:
Screen Shot 2014-10-29 at 6.38.33 PM.png


I can post DOSBox OS X binary too if requested.
You do not have the required permissions to view the files attached to this post.
Last edited by Wengier on 2014-10-30 @ 01:55, edited 6 times in total.
Wengier
Member
 
Posts: 110
Joined: 2014-9-03 @ 19:56

Re: Mouse copy/paste support

Postby truth_deleted » 2014-10-30 @ 00:50

Wonderful work! That's definitely good news!
truth_deleted
 

Re: Mouse copy/paste support

Postby Dominus » 2014-10-30 @ 04:18

And this worked without changes for you?
User avatar
Dominus
DOSBox Moderator
 
Posts: 7578
Joined: 2002-10-03 @ 09:54
Location: Vienna or Ludwigsburg

Re: Mouse copy/paste support

Postby Wengier » 2014-10-30 @ 12:28

Dominus wrote:And this worked without changes for you?


No source changes beyond those already attached are really needed (the preprocessor directive need to be enabled of course). The real change I made is the addition of the path to the libpdcurses.a file (generated in the sdl1 directory) to the compiler (g++) command line. For example, the following command line:

Code: Select all
g++  --g -O2 -o dosbox dosbox.o cpu/libcpu.a ...


will look like (assuming libpdcurses.a is already in the current directory):

Code: Select all
g++  --g -O2 -o dosbox dosbox.o ./libpdcurses.a cpu/libcpu.a ...


This is the method I used when compiling in Linux too.
Wengier
Member
 
Posts: 110
Joined: 2014-9-03 @ 19:56

Re: Mouse copy/paste support

Postby emendelson » 2014-10-30 @ 13:00

An alternate method for clipboard paste:

Unless I misunderstand everything, Wengier's excellent CopyPaste patch seems to be limited (by default) to 16 characters pasted into DOSBox. For a project of mine, I've been using the method in a DOSBox variant called dbDOS (dbDOS.com) by a programmer who seems to be named Olivier Hamel. This doesn't limit the paste to 16 characters. I've attached the files that include his changes to the source code; I think all the relevant ones are here.

Would it be possible to combine Wengier's copy function with a paste feature that uses a technique like the dbDOS paste?
You do not have the required permissions to view the files attached to this post.
emendelson
Oldbie
 
Posts: 744
Joined: 2010-2-14 @ 02:00

PreviousNext

Return to DOSBox Patches

Who is online

Users browsing this forum: No registered users and 2 guests