1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef CLIPBOARDX11_H 17 #define CLIPBOARDX11_H 18 19 #include <string> 20 #include <X11/Xlib.h> 21 22 class ClipboardX11 { 23 public: 24 void SetClipboardData(const std::string& str); 25 const std::string GetClipboardData(); 26 void SetCopyData(const Atom& selection, const std::string& text, const int size); 27 std::string GetPasteType(const Atom& atom); 28 private: 29 Display* display; 30 Window window; 31 Atom targets_atom, text_atom, UTF8, XA_ATOM = 4, XA_STRING = 31; 32 const int nFormateProp32 = 32; 33 const int nFormateProp8 = 8; 34 const int nEvenNumber = 2; 35 }; 36 37 #endif