remove v4l/lml/buz, add symbolic folders, more xlat update, yuyv fixes, v4l2 upgrades
[goodguy/history.git] / cinelerra-5.1 / guicast / bcclipboard.C
index 704372187fa62eb3db165f82ca512fe84764b088..ba33171a71b6fd7588f9796363dd19b725546e91 100644 (file)
@@ -90,7 +90,7 @@ int BC_Clipboard::stop_clipboard()
 #endif
 // Must use a different display handle to send events.
        Display *display = BC_WindowBase::init_display(display_name);
-       XEvent event;
+       XEvent event;  memset(&event, 0, sizeof(event));
        XClientMessageEvent *ptr = (XClientMessageEvent*)&event;
 
        event.type = ClientMessage;
@@ -175,7 +175,7 @@ void BC_Clipboard::handle_selectionrequest(XSelectionRequestEvent *request)
        else if (request->target == targets_atom)
                success = handle_request_targets(request);
 
-       XEvent reply;
+       XEvent reply;  memset(&reply, 0, sizeof(reply));
 // 'None' tells the client that the request was denied
        reply.xselection.property  = success ? request->property : None;
        reply.xselection.type      = SelectionNotify;
@@ -240,7 +240,7 @@ int BC_Clipboard::to_clipboard(const char *data, long len, int clipboard_num)
 #endif
 
 // Store in local buffer
-       if(this->data[clipboard_num] && length[clipboard_num] != len + 1)
+       if(this->data[clipboard_num] && length[clipboard_num] != len)
        {
                delete [] this->data[clipboard_num];
                this->data[clipboard_num] = 0;
@@ -250,10 +250,11 @@ int BC_Clipboard::to_clipboard(const char *data, long len, int clipboard_num)
        {
                length[clipboard_num] = len;
                this->data[clipboard_num] = new char[len + 1];
-               memcpy(this->data[clipboard_num], data, len);
-               this->data[clipboard_num][len] = 0;
        }
 
+       memcpy(this->data[clipboard_num], data, len);
+       this->data[clipboard_num][len] = 0;
+
        if(clipboard_num == PRIMARY_SELECTION)
        {
                XSetSelectionOwner(out_display, 
@@ -370,7 +371,8 @@ int BC_Clipboard::from_clipboard(char *data, long maxlen, int clipboard_num)
 #else
        XUnlockDisplay(in_display);
 #endif
-
+//int len = strlen(data);
+//printf("BC_Clipboard::from_clipboard %d: %d '%*.*s'\n",clipboard_num,len,len,len,data);
        return 0;
 }