FreeRDP
Loading...
Searching...
No Matches
SdlWebClipOffers Class Reference

#include <sdl_web_clip_offers.hpp>

Public Member Functions

bool offer (const std::string &text, const BYTE *image, size_t imageSize)
void serverAnnounced ()
void serverSentText (const std::string &text)
void serverSentImage ()

Detailed Description

FreeRDP: A Remote Desktop Protocol Implementation SDL Client browser clipboard: which offers of the page are announced

Copyright 2026 Gilad Chen gilad.nosp@m..che.nosp@m.n@isl.nosp@m.and..nosp@m.io

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition at line 32 of file sdl_web_clip_offers.hpp.

Member Function Documentation

◆ offer()

bool SdlWebClipOffers::offer ( const std::string & text,
const BYTE * image,
size_t imageSize )
inlinenodiscard

Definition at line 36 of file sdl_web_clip_offers.hpp.

37 {
38 const size_t textHash = hash(text);
39 const size_t offerHash = textHash ^ (hash(image, imageSize) << 1);
40 const bool isLastOffer = (offerHash == _offered);
41 const bool isServerText = !imageSize && !text.empty() && (textHash == _received);
42 if (_serverOwns && (isLastOffer || isServerText))
43 return false;
44 _serverOwns = false;
45 _offered = offerHash;
46 return true;
47 }

◆ serverAnnounced()

void SdlWebClipOffers::serverAnnounced ( )
inline

Definition at line 49 of file sdl_web_clip_offers.hpp.

50 {
51 _serverOwns = true;
52 }

◆ serverSentImage()

void SdlWebClipOffers::serverSentImage ( )
inline

Definition at line 61 of file sdl_web_clip_offers.hpp.

62 {
63 _offered.reset();
64 }

◆ serverSentText()

void SdlWebClipOffers::serverSentText ( const std::string & text)
inline

Definition at line 55 of file sdl_web_clip_offers.hpp.

56 {
57 _offered.reset();
58 _received = hash(text);
59 }

The documentation for this class was generated from the following file: