MCPcopy Create free account
hub / github.com/bk138/multivnc / thread_send_pointer_event

Method thread_send_pointer_event

src/VNCConn.cpp:588–637  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

586
587
588bool VNCConn::thread_send_pointer_event(pointerEvent &event)
589{
590 // first, handle cuttext sending, if any
591 if(event.entering && !cuttext.IsEmpty())
592 {
593 wxCriticalSectionLocker lock(mutex_cuttext); // since cuttext can be set from the main thread
594
595 // first, try sending UTF-8
596 if(SendClientCutTextUTF8(cl, const_cast<char*>(cuttext.utf8_str().data()), strlen(cuttext.utf8_str().data()))) {
597 wxLogDebug(wxT("VNCConn %p: sent UTF-8 cuttext: '%s'"), this, cuttext.utf8_str());
598 } else {
599 // server does not support Extended Clipboard, try Latin-1.
600 // if encoding fails, length() returns 0
601 if(cuttext.mb_str(wxCSConv("iso-8859-1")).length())
602 {
603 char* encoded_text = strdup(cuttext.mb_str(wxCSConv(wxT("iso-8859-1"))));
604 SendClientCutText(cl, encoded_text, strlen(encoded_text));
605 wxLogDebug(wxT("VNCConn %p: sent Latin-1 cuttext: '%s'"), this, encoded_text);
606 free(encoded_text);
607 }
608 else
609 wxLogDebug(wxT("VNCConn %p: sending Latin-1 cuttext FAILED, could not convert '%s' to ISO-8859-1"), this, cuttext.c_str());
610 }
611 }
612
613
614 // record here
615 {
616 wxCriticalSectionLocker lock(mutex_recordreplay);
617
618 if(recording)
619 {
620 wxString ui_now;
621 ui_now += (wxString() << (int)recordreplay_stopwatch.Time());
622 ui_now += wxT(",");
623 ui_now += wxT("p"); // is pointer event
624 ui_now += wxT(",");
625 ui_now += (wxString() << event.x);
626 ui_now += wxT(",");
627 ui_now += (wxString() << event.y);
628 ui_now += wxT(",");
629 ui_now += (wxString() << event.buttonmask);
630
631 userinput.Add(ui_now);
632 }
633 }
634
635 wxLogDebug(wxT("VNCConn %p: sending pointer event at (%d,%d), buttonmask %d"), this, event.x, event.y, event.buttonmask);
636 return SendPointerEvent(cl, event.x, event.y, event.buttonmask);
637}
638
639
640

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected