Cheers, much appreciated! Of course mouse copy/paste has existed for decades, it's hardly my innovation ;)
By the way, I saw you were looking at implementing the clipboard for X11 (and you're right, that is a complicated mess) - perhaps it helps to have a look at the Pygame.scrap source code; it's C and permissively licensed so you may be able to just lift bits of the code out for DOSBox. Though you could probably find some small clipboard library or utility as well.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2014-11-02
Great! I will look at the Pygame.scrap source code. I had tried to find some small cross-platform clipboard library for C/C++, but I hardly found any except pdcurses, which has its own problem too. Thanks for the suggestion!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hope it's useful. Note that there's a bug in the Linux code for the "PRIMARY selection" (that's the mouse clipboard, which on X is separate from the usual clipboard) - I sent a patch to the devs but I don't think they've picked it up yet. So if you do end up using it you may as well incorporate the patch:
--- src/scrap_x11.c 2014-09-12 10:18:01.231530141 +0100+++ src/scrap_x11.c 2014-09-12 10:24:16.285389923 +0100@@ -765,13 +765,13 @@
{
timestamp = ev.xproperty.time;
- if (cliptype == XA_PRIMARY)+ if (clip == XA_PRIMARY)
_selectiontime = timestamp;
else
_cliptime = timestamp;
}
else
- timestamp = (cliptype == XA_PRIMARY) ? _selectiontime : _cliptime;+ timestamp = (clip == XA_PRIMARY) ? _selectiontime : _cliptime;
SETSELECTIONOWNER:
/* Set the selection owner to the own window. */
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2014-11-02
I see. Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2014-11-02
By the way, why isn't the clipboard feature in PC-BASIC available for MacOS X? From the Pygame scrap.c file I see there are MacOS X related code.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I can't get it to work on the VM I use for OSX. There's a strange bug triggered when you include pygame.scrap, that produces insane python error messages further on before crashing. So to make it usable I've manually excluded pygame.scrap. I haven't spent the time finding out more about the bug, partly because the OSX VM I use is a pain to use.
If you can get it to work properly from the python code, let me know how.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2014-11-04
I have managed to get the PC-BASIC clipboard copy/paste to work in OS X in my VM (VMware Workstation 10.0.4). In video_pygame.py I imported mac_scrap directly and use that when the system platform is OSX (the mac_scrap lib requires PyObjC I think). I changed some code in the copy & paste functions accordingly too, but I am not sure if this is the best way since I am not very experienced in Python. The version of OS X I use is 10.10 and the mouse copy/paste function in PC-BASIC works fine with it now (I also confirmed that the Python code still works with Windows). I have attached the video_pygame.py and mac_scrap.py files I used.
Your fix works, thanks for that! I ended up implementing a different fix for OSX clipboard functionality because PyInstaller can't seem to handle the AppKit and Foundation dependency in mac_scrap.py. Fortunately OSX comes standard with a couple of command-line clipboard tools that can do the job, as it turns out. Check it out in release 14.10.1!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Cheers, much appreciated! Of course mouse copy/paste has existed for decades, it's hardly my innovation ;)
By the way, I saw you were looking at implementing the clipboard for X11 (and you're right, that is a complicated mess) - perhaps it helps to have a look at the Pygame.scrap source code; it's C and permissively licensed so you may be able to just lift bits of the code out for DOSBox. Though you could probably find some small clipboard library or utility as well.
Great! I will look at the Pygame.scrap source code. I had tried to find some small cross-platform clipboard library for C/C++, but I hardly found any except pdcurses, which has its own problem too. Thanks for the suggestion!
Hope it's useful. Note that there's a bug in the Linux code for the "PRIMARY selection" (that's the mouse clipboard, which on X is separate from the usual clipboard) - I sent a patch to the devs but I don't think they've picked it up yet. So if you do end up using it you may as well incorporate the patch:
I see. Thanks!
By the way, why isn't the clipboard feature in PC-BASIC available for MacOS X? From the Pygame scrap.c file I see there are MacOS X related code.
I can't get it to work on the VM I use for OSX. There's a strange bug triggered when you include pygame.scrap, that produces insane python error messages further on before crashing. So to make it usable I've manually excluded pygame.scrap. I haven't spent the time finding out more about the bug, partly because the OSX VM I use is a pain to use.
If you can get it to work properly from the python code, let me know how.
I have managed to get the PC-BASIC clipboard copy/paste to work in OS X in my VM (VMware Workstation 10.0.4). In video_pygame.py I imported mac_scrap directly and use that when the system platform is OSX (the mac_scrap lib requires PyObjC I think). I changed some code in the copy & paste functions accordingly too, but I am not sure if this is the best way since I am not very experienced in Python. The version of OS X I use is 10.10 and the mouse copy/paste function in PC-BASIC works fine with it now (I also confirmed that the Python code still works with Windows). I have attached the video_pygame.py and mac_scrap.py files I used.
Hey, thanks! I'll try that.
Your fix works, thanks for that! I ended up implementing a different fix for OSX clipboard functionality because PyInstaller can't seem to handle the AppKit and Foundation dependency in
mac_scrap.py
. Fortunately OSX comes standard with a couple of command-line clipboard tools that can do the job, as it turns out. Check it out in release 14.10.1!