VOGONS

Common searches


Mouse copy/paste support

Topic actions

Reply 80 of 151, by Wengier

User metadata
Rank Member
Rank
Member

emendelson:

I was not able to compile these source files by replacing them into the dosbox sources. Some files are apparently missing. By looking at the sources themselves, it seems that it does not support copy/paste by mouse, and also the related code is Win32 only. It uses pasteBuffer.push for each character in the text, but this alone obviously is not a substitute for the BIOS_AddKeyToBuffer function. Perhaps it uses a complete different structure which may not be present in the files you have attached (for example, the KEYBOARD_BufferSpaceAvail function is defined nowhere in the sources).

For the character limit, it is indeed a limit of the BIOS keyboard buffer itself, which can be expanded pretty easily by using the 256KEYS program in DOSBox for example, as mentioned earlier in this thread (so that I don't consider it a limit any more). You can just place it in the [autoexec] section of dosbox.conf if you want to enable this by default.

Last edited by Wengier on 2014-10-30, 14:00. Edited 1 time in total.

Reply 81 of 151, by emendelson

User metadata
Rank Oldbie
Rank
Oldbie

Wengier,

You are right that the dbDOS method is keyboard only and win32-only. If anyone is interested, the complete source code is here:

http://www.dbase.com/downloads/dbDOS_Pro_2_engine_source.zip

There's a later version that adds a few files and seems to make things more complicated:

http://www.dbase.com/downloads/dbDOS_Pro_3_engine_source.zip

One reason I use this code as the basis for one of my projects (Win32 only) is that the programmer has added things to the system menu, and I've adapted the 2.0 code so that Clipboard Paste is available from the system menu, not just from a keystroke.

Reply 82 of 151, by Wengier

User metadata
Rank Member
Rank
Member

I have checked dbDOS's source code a bit, not only its paste function is Win32 only, but the keycode parsing function is also Win32 only, so it will not be cross-platform at all. I don't really wish to break the compatibility with other operating systems by adding such Win32-specific function calls (e.g. MapVirtualKey), which in any case are no longer very useful for our purposes any more, given that the BIOS keyboard buffer is indeed easily expandable.

Last edited by Wengier on 2014-10-30, 16:11. Edited 3 times in total.

Reply 84 of 151, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

I'm stumpedey stumped. I cannot make it to work... I have no idea what is failing me.

Especially since the text selecting is failing me in the first part already and that shouldn't.
I made sure that C_Clipboard is defined...

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 85 of 151, by Wengier

User metadata
Rank Member
Rank
Member
Dominus wrote:

I'm stumpedey stumped. I cannot make it to work... I have no idea what is failing me.

Especially since the text selecting is failing me in the first part already and that shouldn't.
I made sure that C_Clipboard is defined...

OK, since it was a MacOS X 10.10 VMware image, I will try to explain step by step on what I have done after getting OS X to boot into the desktop in VMware.

1. Download and install SDL 1.2.15. It is the usual configure+make+make install. Since GCC was not pre-installed, OS X asked me whether I wanted to install GCC, and I answer yes so that it was automatically installed (it took a few minutes). Everything went fine except that I needed to change the SDL_QuartzVideo.h file a little in order to get it to compile under OS X 10.10 (see this URL for more info about the patch: https://bitbucket.org/gennady/ja2-stracciatel … ile-on-os-x-109) and EDIT: also disable X11 support.

2. Download and install pdcurses. I ran make in the sdl1 directory, and it generated libpdcurses.a (along with other files, which are not necessary for our purpose though).

3. Mount and enter into the dosbox directory. This is the directory of the source code of DOSBox with LFN and mouse copy/paste support. I mounted the directory in the host machine from inside the VMware virtual machine so that OS X can access the directory in the host machine directly. Copy the libpdcureses.a file generated just now to the src directory.

4. The usual configure+make. Everything should work fine except that the compiler would eventually report about undefined symbols such as _PDC_getclipboard if the makefile does not contain link to libpdcureses.a. If this is the case, copy that command starting with "g++ -g -O2 -o dosbox dosbox.o cpu/libcpu.a ..." and add "./libpdcurses.a" manually after "dosbox.o". Go to the src directory and execute the modified command. Now it should generate the binary "dosbox" correctly.

5. Run the DOSBox binary with ./dosbox, and everything will be set.

(EDIT: Make sure all source files are the latest version, as attached in this thread)

Last edited by Wengier on 2014-10-30, 23:41. Edited 3 times in total.

Reply 86 of 151, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

just to make sure, which source was used for this? (if it's already attached here, just point me at it)
I'll try to find the culprit

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 87 of 151, by Wengier

User metadata
Rank Member
Rank
Member
Dominus wrote:

just to make sure, which source was used for this? (if it's already attached here, just point me at it)
I'll try to find the culprit

For the mouse copy/paste feature alone, how about try these source files in the attachment (this version enables C_CLIPBOARD explicitly in the source file).

Attachments

  • Filename
    srcchgs.zip
    File size
    41.17 KiB
    Downloads
    57 downloads
    File license
    Fair use/fair dealing exception

Reply 88 of 151, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

hmmm, still not working.
Followed the above as close as I could and used the above changed files.
AFAICT the only difference was that I needed to add "--disable-video-x11 --without-x" to SDL's configure (as OS X no longer ships with X11 and the Xquartz download didn't exactly work for building SDL for me). If you didn't need those to build SDL then this is the only difference that might matter.
Can you attach your working binary? Maybe I can figure things out the other way.

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 89 of 151, by Wengier

User metadata
Rank Member
Rank
Member
Dominus wrote:
hmmm, still not working. Followed the above as close as I could and used the above changed files. AFAICT the only difference wa […]
Show full quote

hmmm, still not working.
Followed the above as close as I could and used the above changed files.
AFAICT the only difference was that I needed to add "--disable-video-x11 --without-x" to SDL's configure (as OS X no longer ships with X11 and the Xquartz download didn't exactly work for building SDL for me). If you didn't need those to build SDL then this is the only difference that might matter.
Can you attach your working binary? Maybe I can figure things out the other way.

Regarding X11, you are right, I disabled X11 support in SDL's configure too. I forgot to mention this sub-step in my earlier post and now added it as well.

Anyway, I have attached the working DOSBox OS X binary with LFN and mouse copy/paste support.

(Also make sure you have not disabled mouse copy/paste support in dosbox.conf)

Attachments

  • Filename
    dosboxosxbin.zip
    File size
    987.69 KiB
    Downloads
    50 downloads
    File license
    Fair use/fair dealing exception

Reply 90 of 151, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

aaaaaaaaaaarrrrrrrrrgggggghhhhhhhhhhhhhhhhhhhhhhh!!!!!!!

I'm gonna shoot myself now for wasting that much valuable time of me and you!!!!!

Somewhere along the trying to make it work, I forgot that the right button is also being used for the copy part not only the pasting.... Of course your build wouldn't mark with the left button as well, and that was impossible unless I have either something set wrong or doing it wrong... then I realized... 😀

So, my build did indeed work as well. Thanks a lot 😀

Only problem, as you also found out examining emendelsons problems:
The copy/paste only works inside of dosbox, the clipboard of the system is not being used or affected. Same with your build.

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 91 of 151, by Wengier

User metadata
Rank Member
Rank
Member

I am SO GLAD that you have confirmed that it works on your OS X system too!

On Windows systems, the copy/paste feature of course uses the system clipboard so that it will not only work inside of dosbox, but also outside dosbox. As I am still new to OS X, I do not know exactly how many "clipboards" there are in OS X (in Linux/X11 there are at least two for example), or whether pdcurses-SDL is actually using its own clipboard in OS X now. If this is the case, is it possible to find some setting in pdcurses-SDL to change the clipboard that it is using?

Reply 92 of 151, by truth_deleted

User metadata

It should be possible to build pdcurses, instead of pdcurses-sdl, against the X11 library in OSX. This would presumably allow the additional functionality with minimal patch modification. In addition, I believe SDL2 has system clipboard functionality, so that avenue will open the additional functionality for the non-X11 case (given verification of the above posts).

Past posts have indicated that SDL1 and SDL2 may co-exist in the same build, so someone could always submit a separate and future patch to enable this capability in dosbox (there is a SDL2 patch for dosbox already available in some form).

Edit: source code examples for SDL1, https://www.assembla.com/code/SDL_Clipboard/mercurial/nodes.

Reply 93 of 151, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

On OS X there is no transparent other clipboard, but obviously the X11 clipboard is separate from the system clipboard (when you install xquartz you can see references about this in the preferences).
But the x11 clipboard and whatever pdcurses-sdl is using is also not the same from simple tests.

Using X11 for clipboarding is probably not going to be the best option as OS X doesn't provide X11 stuff anymore, you will need to install xquartz. And building SDL 1.x with X11 support seems to be not that straightforward anymore as well (though I think mercurial of SDL 1.x branch has a fix for that or something similar).

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 94 of 151, by truth_deleted

User metadata

The SDL examples above should not require X11, and the SDL1 example above has code to access the system clipboard for OSX. In fact, that code provides a guide to modify the existing patch.

I presume SDL2 can target xquartz. However, it requires further development on the OSX platform. It doesn't seem right that the patch author is running osx in a vmware session with little help.

OSX users could also submit a feature request to (mainline) pdcurses for the functionality present in X11 and Windows.

Reply 95 of 151, by Dominus

User metadata
Rank DOSBox Moderator
Rank
DOSBox Moderator

If I'd be better in actually coding I'd gladly help wrangler with it. As it stands now I'm good with getting stuff to compile (when I'm not dumb enough to not read which button to press 😀) but not much help with any coding.

AFAICT pdcurses is no longer developed for years now. Getting upstream to help is probably fruitless. The example for SDL are probably the best way...

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 96 of 151, by truth_deleted

User metadata

Then perhaps the above SDL1 code example will provide a port for OSX system clipboard functions, but the configure file should detect OSX (I think it finds the word "darwin" during the build process). It would also remove the pdcurses library in the OSX build.

There's a file in that example, SDL_Clipboard_MacOSX.m, with functions such as Internal_PasteFromClipboard:

NSPasteboard* paste_board;
paste_board = [NSPasteboard generalPasteboard];
..
NSString* pasteboard_string;
pasteboard_string = [paste_board stringForType: NSStringPboardType];

I think this is a partial snippet for copying to it:

[paste_board declareTypes:[NSArray arrayWithObject:internal_format] owner:nil];
[paste_board setString:[NSString stringWithUTF8String:src_data] forType:NSStringPboardType];

Another way is to use the above SDL1 code directly in a patched SDL1.2 library, but my guess is it may be simpler to extract the magical recipe to communicate with the osx system clipboard.

Reply 97 of 151, by Wengier

User metadata
Rank Member
Rank
Member

Thanks for your research. The most obvious problem for the code above (which I found it too) is that the code is written in Objective-C (which I have no experience with) instead of C/C++ (which is the programming language used in the DOSBox source code). I wonder if there is a C/C++ version of code that communicates with the OS X system clipboard. If no, is there an easy way to integrate Objective-C code into the C/C++ project?

Reply 98 of 151, by truth_deleted

User metadata

I didn't know that. It explains why some cross-platform libraries excluded the OS. 😀

Perhaps this example is a poor choice for a C/C++ implementation: http://www.alecjacobson.com/weblog/?p=2376.

Edit: alternatively, could someone try to compile the SDL library in OSX with the SDL_Clipboard patch? The patch is here: https://www.assembla.com/code/SDL_Clipboard/mercurial/nodes. I see now that the .m file must be in objective-C, but there is a cmake system that may work out-of-the-box.

Last edited by truth_deleted on 2014-11-01, 03:56. Edited 1 time in total.

Reply 99 of 151, by Wengier

User metadata
Rank Member
Rank
Member
truth5678 wrote:

I didn't know that. It explains why some cross-platform libraries excluded the OS. 😀

Perhaps this example is a poor choice for a C/C++ implementation: http://www.alecjacobson.com/weblog/?p=2376.

Thanks for the link. Indeed, this C/C++ example "implemented" clipboard copy/paste by calling shell commands (pbcopy and pbpaste) directly. I really don't know whether the DOSBox devs will be fine with it if I go with this approach.