VOGONS

Common searches


Mouse copy/paste support

Topic actions

Reply 60 of 151, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

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.

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 62 of 151, by emendelson

User metadata
Rank Oldbie
Rank
Oldbie

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.

Reply 64 of 151, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

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

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: PDCurses for SDL <- maybe the lib path needs to be in front of $LIBS

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 65 of 151, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

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)

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 66 of 151, by truth_deleted

User metadata

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:

-     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: PDCurses for SDL]

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:

#define HAVE_CLIPBOARD 1

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

test.PNG
Filename
test.PNG
File size
20.45 KiB
Views
1221 views
File comment
Image of testcurs program
File license
Fair use/fair dealing exception

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:

#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:

# define PDCEX extern

Reply 67 of 151, by emendelson

User metadata
Rank Oldbie
Rank
Oldbie

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.

Reply 68 of 151, by truth_deleted

User metadata

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.

Reply 69 of 151, by emendelson

User metadata
Rank Oldbie
Rank
Oldbie
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.

Reply 70 of 151, by Wengier

User metadata
Rank Member
Rank
Member

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?

Reply 71 of 151, by emendelson

User metadata
Rank Oldbie
Rank
Oldbie
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.

Reply 72 of 151, by Wengier

User metadata
Rank Member
Rank
Member
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 i […]
Show full quote

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.

Reply 73 of 151, by truth_deleted

User metadata
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.

Reply 74 of 151, by emendelson

User metadata
Rank Oldbie
Rank
Oldbie

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.

Attachments

  • Testcurs.png
    Filename
    Testcurs.png
    File size
    24.14 KiB
    Views
    1190 views
    File license
    Fair use/fair dealing exception

Reply 75 of 151, by Wengier

User metadata
Rank Member
Rank
Member

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:

Filename
dosboxinosx.png
File size
239.66 KiB
Downloads
No downloads
File license
Fair use/fair dealing exception

And another screenshot showing the marker during mouse selection in DOSBox in OS X:

Filename
Screen Shot 2014-10-29 at 6.38.33 PM.png
File size
230.85 KiB
Downloads
No downloads
File license
Fair use/fair dealing exception

I can post DOSBox OS X binary too if requested.

Last edited by Wengier on 2014-10-30, 01:55. Edited 6 times in total.

Reply 77 of 151, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

And this worked without changes for you?

Windows 3.1x guide for DOSBox
60 seconds guide to DOSBox
DOSBox SVN snapshot for macOS (10.4-11.x ppc/intel 32/64bit) notarized for gatekeeper

Reply 78 of 151, by Wengier

User metadata
Rank Member
Rank
Member
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:

g++  --g -O2 -o dosbox dosbox.o cpu/libcpu.a ...

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

g++  --g -O2 -o dosbox dosbox.o ./libpdcurses.a cpu/libcpu.a ...

This is the method I used when compiling in Linux too.

Reply 79 of 151, by emendelson

User metadata
Rank Oldbie
Rank
Oldbie

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?

Attachments

  • Filename
    dbDOSpaste.zip
    File size
    53.82 KiB
    Downloads
    56 downloads
    File license
    Fair use/fair dealing exception