MCPcopy Create free account
hub / github.com/SFML/SFML / getStringImpl

Method getStringImpl

src/SFML/Window/Unix/ClipboardImpl.cpp:119–154  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

117
118////////////////////////////////////////////////////////////
119String ClipboardImpl::getStringImpl()
120{
121 // Check if anybody owns the current selection
122 if (XGetSelectionOwner(m_display.get(), m_clipboard) == None)
123 {
124 m_clipboardContents.clear();
125
126 return m_clipboardContents;
127 }
128
129 // Process any already pending events
130 processEvents();
131
132 m_requestResponded = false;
133
134 // Request the current selection to be converted to UTF-8 (or STRING
135 // if UTF-8 is not available) and written to our window property
136 XConvertSelection(m_display.get(),
137 m_clipboard,
138 (m_utf8String != None) ? m_utf8String : XA_STRING,
139 m_targetProperty,
140 m_window,
141 CurrentTime);
142
143 const Clock clock;
144
145 // Wait for a response for up to 1 second
146 while (!m_requestResponded && (clock.getElapsedTime() < sf::seconds(1)))
147 processEvents();
148
149 // If no response was received within the time period, clear our clipboard contents
150 if (!m_requestResponded)
151 m_clipboardContents.clear();
152
153 return m_clipboardContents;
154}
155
156
157////////////////////////////////////////////////////////////

Callers 1

getStringMethod · 0.80

Calls 3

getMethod · 0.80
getElapsedTimeMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected