|
Clipboard |
Trezker
Member #1,739
December 2001
|
Sony blocked that in my country. And yes it's a computer job, software development. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Arthur Kalliokoski said: ClipboardTest.c compiled OK, but Clipboard.c brought up all these errors: I think I've fixed all the errors. I forgot a couple includes and fixed the other typos. Arthur, would you give it another try? Arthur Kalliokoski said: Yes, you can copy and paste images. Which programs allow you to do this? I want to look at their source code so I can figure out what image format other programs are expecting. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Arthur Kalliokoski
Second in Command
February 2005
|
My first try pepsi@fractalcomet:/home/prog/ClipBoardTest4 12:21 AM $ gcc -c -O2 -Wall Clipboard.c Clipboard.c:216:23: error: X11/XAtom.h: No such file or directory Clipboard.c: In function 'SetClipboardString': Clipboard.c:226: error: 'XA_CLIPBOARD' undeclared (first use in this function) Clipboard.c:226: error: (Each undeclared identifier is reported only once Clipboard.c:226: error: for each function it appears in.) Clipboard.c:226: error: 'XA_STRING' undeclared (first use in this function) Clipboard.c: In function 'GetNewClipboardString': Clipboard.c:253: error: 'XA_CLIPBOARD' undeclared (first use in this function) Clipboard.c:255: error: 'XA_STRING' undeclared (first use in this function) pepsi@fractalcomet:/home/prog/ClipBoardTest4 12:22 AM $ locate XAtom.h //"Find" XAtom.h, (case insensitive) not found since no output pepsi@fractalcomet:/home/prog/ClipBoardTest4 12:23 AM $ gcc -c -O2 -Wall ClipboardTest.c pepsi@fractalcomet:/home/prog/ClipBoardTest4 12:23 AM $ Anyway I found Xatom.h (not XAtom.h) is in a Slackware repository and installed it, but I still get Clipboard.c:226: error: 'XA_CLIPBOARD' undeclared (first use in this function) as well as line 253. I copy and paste images from Firefox to kolourpaint all the time to zoom in, as well as to/from most any other program that handles images, even within the same program like a rubber stamp. Hell, I just copied a few lines from Clipboard.c and pasted them into kolourpaint in various places as an image. [EDIT] I found XA_CLIPBOARD in X11/Xmu/Atoms.h and found it needs a parameter for Display, [EDIT2] This is the command to get it to work. [EDIT4] Oops! I didn't notice the bitmap wasn't in this zip, copied it from the last, and it showed a window saying to do this and that, but nothing worked. It left a ClipboardLog.txt that simply said "There are no bytes to read in the requested property." They all watch too much MSNBC... they get ideas. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
I'm working from 12 year old xlib documentation here, so thank you for your patience. This time I tried a roundabout way to get the Atom's using XInternAtom, so maybe this time it will work. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Arthur Kalliokoski
Second in Command
February 2005
|
You missed a couple things, and the doc says char *atom_name, so I put quotes around "CLIPBOARD" and "STRING" and it compiled without warnings or errors. Now the S key says it successfully set the clipboard string to CyberMan, but nothing else works, the log file still says "There are no bytes to read in the requested property." I put the altered file in the paperclip. [EDIT] This says my use of quotes was correct. They all watch too much MSNBC... they get ideas. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Alright, I got rid of the remaining references to XA_CLIPBOARD and XA_STRING and replaced them with the Atoms retrieved by XInternAtom. I also added in a rest(500) in the GetClipboardString function so hopefully events will be processed in time. Try it one more time, please. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Arthur Kalliokoski
Second in Command
February 2005
|
Results were the exact same as last time, excepting it compiled properly. Perhaps I should add that the log file had two lines saying no bytes to read in this and the previous test. They all watch too much MSNBC... they get ideas. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Well then, it's back to the drawing board. Maybe I'm using the wrong target for text data, I don't know. What programs allow you to copy and paste text between them on Linux? I'll look up their source code and see what they do in this scenario. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Arthur Kalliokoski
Second in Command
February 2005
|
Honestly, I can't think of anything that doesn't allow me to copy stuff, the pdf viewers are somewhat dodgy to use since you're trying to select text with a rectangle. I found the file in the paperclip a couple hours ago right after trying your second try, and it works. When executed, it pastes what's in the clipboard onto the console screen before the prompt returns. [EDIT] I just thought of trying it after copying an image from kolourpaint, but nothing was shown. I thought it might paste the binary garbage, but no. They all watch too much MSNBC... they get ideas. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Arthur Kalliokoski said: Honestly, I can't think of anything that doesn't allow me to copy stuff, the pdf viewers are somewhat dodgy to use since you're trying to select text with a rectangle. I need examples though. I can't download the sources because I don't know what programs use copy/paste of text on Linux. Arthur Kalliokoski said: I found the file in the paperclip a couple hours ago right after trying your second try, and it works. When executed, it pastes what's in the clipboard onto the console screen before the prompt returns What file are you referring to? ClipBoardTest1.zip and ClipBoardTest2.zip both use xclip as an intermediary. In the later versions, I was trying to emulate what xclip does by using selections. I suppose I'll look for the xclip source code and see what they do, but that will only get me text selections, not images. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Arthur Kalliokoski
Second in Command
February 2005
|
Edgar Reynaldo said: I need examples though. I can't download the sources because I don't know what programs use copy/paste of text on Linux. Images on clipboard: Kwrite (text copy and paste) Quote: What file are you referring to? http://www.allegro.cc/files/download-attachment/?area=forum%20post&id=899543 It was in the post They all watch too much MSNBC... they get ideas. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Arthur Kalliokoski said: It was in the post. Nevermind, I'm a little dense. I'll take a closer look at it tomorrow. I think one of the problems is that XConvertSelection sends a SelectionRequest event to the owner of the selection asking them to store that information on the client's window. I may be looking at the wrong window with XGetWindowProperty. Thanks for testing my code out. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Arthur Kalliokoski
Second in Command
February 2005
|
I got curious about the kde dev thing and downloaded it myself. The kolourpaint app isn't in there, but something else called klipper was. I think this might be the thing that does the work for all X apps. I uploaded the 110K file to http://ompldr.org/vNzJwOA/klipper.zip [EDIT] No, it's a thing that installs itself to the task bar as a little icon, when clicked it displays the last five text string copies, when you click on one, it's the current item to be pasted. Copying an image doesn't show up in the list. They all watch too much MSNBC... they get ideas. |
bamccaig
Member #7,536
July 2006
|
Wait, is Edgar attempting to write an X implementation without an X server or am I missing something? -- acc.js | al4anim - Allegro 4 Animation library | Allegro 5 VS/NuGet Guide | Allegro.cc Mockup | Allegro.cc <code> Tag | Allegro 4 Timer Example (w/ Semaphores) | Allegro 5 "Winpkg" (MSVC readme) | Bambot | Blog | C++ STL Container Flowchart | Castopulence Software | Check Return Values | Derail? | Is This A Discussion? Flow Chart | Filesystem Hierarchy Standard | Clean Code Talks - Global State and Singletons | How To Use Header Files | GNU/Linux (Debian, Fedora, Gentoo) | rot (rot13, rot47, rotN) | Streaming |
Arthur Kalliokoski
Second in Command
February 2005
|
He's trying to access copy and paste functions for text and images in an Allegro program for X11. They all watch too much MSNBC... they get ideas. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
bamccaig said: Wait, is Edgar attempting to write an X implementation without an X server or am I missing something? No, nothing like that. I am trying to write X copy/paste functions without the use of events though, as using events would mean I would have to hack Allegro to have it send selection events to a callback function in the clipboard library. And since Allegro 4 may never produce any new releases, this would make everyone who wanted to use our library have to download SVN allegro and build it themselves, which is at least a small hassle. Could someone on Linux post the man pages for XConvertSelection and XGetWindowProperty? Maybe the man pages are a little more thorough and up to date than what I am using. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Arthur Kalliokoski
Second in Command
February 2005
|
The XConvertSelection simply pointed to another man page so I included that one as well. They all watch too much MSNBC... they get ideas. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
I don't have a man page viewer, so those are pretty cryptic looking in my text editor. Could you copy the screen contents into a text file please? My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Arthur Kalliokoski
Second in Command
February 2005
|
Now the Format Police are looking for us! They all watch too much MSNBC... they get ideas. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Blame it on bamccaig. He told us to do it. I'm just an innocent CyberMan, trying to take over Earth and turn all humans into fellow CyberMen. Edit : <link removed> Edit 2 : In addition to the logging function, I (hopefully) fixed up the GetNewClipboardString function, so use B to view a string copied from another program. I don't think SetNewClipboardString will work yet, because the program doesn't listen to SelectionRequest events and then place the selection on the event specified window. For that to work, I'll probably have to hack Allegro. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Arthur Kalliokoski
Second in Command
February 2005
|
I had to change line 483 in Clipboard.c to this target_atom_name = XGetAtomName( d,((long*)returned_property)[i]); to get it to compile, otherwise it's doing the same thing. Only the S key item seems to succeed (except for the new L log function). The logfile that results from hitting the key on each line is attached. They all watch too much MSNBC... they get ideas. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Arthur Kalliokoski said: I had to change line 483 in Clipboard.c to this Thanks, I missed that. Arthur Kalliokoski said: The logfile that results from hitting the key on each line is attached. Did you read my last post? The S key will appear to work, but you won't actually be able to paste that string into another program because the program doesn't respond to SelectionRequest events. So don't bother with S for now. First, try copying a string or image from another program and then coming back to my program and press the L key to log the available clipboard targets. I'm trying to determine what format other programs are using. Remember which programs you copied from when you pressed L so I can match that up with the log. After that, try copying a string from another program and see if pressing B in my program shows you the string that you copied. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Arthur Kalliokoski
Second in Command
February 2005
|
Edgar Reynaldo said: Did you read my last post? Sorry, I tend to catch up on these things upon awakening, and I wake up real slow (like now). I didn't think of copying from another program, first I copied your avatar (!), but your program said there was nothing in the clipboard. Then I copied a sentence from the console and your program displayed the start of it until it went off screen. Then I copied about 10 lines out of your source and it displayed those. The entire length of the single sentence and the block of code were both written to the logfile. They all watch too much MSNBC... they get ideas. |
Edgar Reynaldo
Major Reynaldo
May 2007
|
Copy/paste of images won't work on Linux until I figure out what format they're using. That's why I wrote the logging function. What did the logfile say? My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
Arthur Kalliokoski
Second in Command
February 2005
|
The first sentence I pasted was "getcolor DejaVuSans18.tga 32" and the block of code starts at "int main..." on line 8. Logging all available TARGETS : The TARGETS property does not exist on the specified window. Bad window, bad. Success retrieving property. Return type "STRING" , Format=8 , NumItemsReturned=29 Bytes Left=0 , String Returned="getcolor DejaVuSans18.tga 32 "Logging all available TARGETS : The TARGETS property does not exist on the specified window. Bad window, bad. Success retrieving property. Return type "STRING" , Format=8 , NumItemsReturned=441 Bytes Left=0 , String Returned="int main(int argc , char** argv) { int cd; int dw = 800; int dh = 600; BITMAP* cyberman = 0; BITMAP* buffer = 0; BITMAP* fromclipbmp = 0; char* fromclipstr = 0; int redraw = 1; int black = 0; int white = 0; int orange = 0; int ret = 0; if (allegro_init() != 0) {return 0;} if (install_keyboard() != 0) {return 0;} cd = desktop_color_depth(); if (cd == 0) {cd = 32;} set_color_depth(cd);"
They all watch too much MSNBC... they get ideas. |
|
|