Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorDiego Borghetti <bdiego@gmail.com>2009-01-31 00:01:18 +0300
committerDiego Borghetti <bdiego@gmail.com>2009-01-31 00:01:18 +0300
commitc63fcd27994875e31878619875ad3324232bf90d (patch)
tree4b6f1259b72364a99a46a5485e59cadaa464e45c /intern
parent0409977aa8b91a88095a74f4fbfcc40fab0cbad7 (diff)
Fix revision: 18690, bug #17850
The problem was that Qt convert the text to the type STRING or UTF8, that is why Blender can't get the text, now should be work fine.
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp45
1 files changed, 35 insertions, 10 deletions
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index 9950ef88879..02dfdc2e25c 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -981,11 +981,11 @@ getClipboard(int flag
) const {
//Flag
//0 = Regular clipboard 1 = selection
- static Atom Primary_atom, clip_String, compound_text;
+ static Atom Primary_atom, clip_String, compound_text, a_text, a_string;
Atom rtype;
Window m_window, owner;
unsigned char *data, *tmp_data;
- int bits;
+ int bits, count;
unsigned long len, bytes;
XEvent xevent;
@@ -996,6 +996,8 @@ getClipboard(int flag
clip_String = XInternAtom(m_display, "_BLENDER_STRING", False);
compound_text = XInternAtom(m_display, "COMPOUND_TEXT", False);
+ a_text= XInternAtom(m_display, "TEXT", False);
+ a_string= XInternAtom(m_display, "STRING", False);
//lets check the owner and if it is us then return the static buffer
if(flag == 0) {
@@ -1029,23 +1031,46 @@ getClipboard(int flag
XFlush(m_display);
//This needs to change so we do not wait for ever or check owner first
+ count= 1;
while(1) {
XNextEvent(m_display, &xevent);
- if(xevent.type == SelectionNotify) {
- if (xevent.xselection.property ) { /* eric4 on linux gives zero Atom xevent.xselection.property value, closes blender instantly */
+ if(xevent.type == SelectionNotify) {
+ if (xevent.xselection.property == None) {
+ /* Ok, the client can't convert the property
+ * to some that we can handle, try other types..
+ */
+ if (count == 1) {
+ XConvertSelection(m_display, Primary_atom, a_text, clip_String, m_window, CurrentTime);
+ count++;
+ }
+ else if (count == 2) {
+ XConvertSelection(m_display, Primary_atom, a_string, clip_String, m_window, CurrentTime);
+ count++;
+ }
+ else {
+ /* Ok, the owner of the selection can't
+ * convert the data to something that we can
+ * handle.
+ */
+ return(NULL);
+ }
+ }
+ else {
if(XGetWindowProperty(m_display, m_window, xevent.xselection.property , 0L, 4096L, False, AnyPropertyType, &rtype, &bits, &len, &bytes, &data) == Success) {
if (data) {
- tmp_data = (unsigned char*) malloc(strlen((char*)data)+1);
- strcpy((char*)tmp_data, (char*)data);
+ if (bits == 8 && (rtype == compound_text || rtype == a_text || rtype == a_string)) {
+ tmp_data = (unsigned char*) malloc(strlen((char*)data)+1);
+ strcpy((char*)tmp_data, (char*)data);
+ }
+ else
+ tmp_data= NULL;
+
XFree(data);
return (GHOST_TUns8*)tmp_data;
}
}
+ return(NULL);
}
- else {
- fprintf(stderr, "error: cut buffer had a zero xevent.xselection.property, FIXME\n"); // XXX fix this problem!
- }
- return NULL;
}
}
}