mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:42:44 +00:00 
			
		
		
		
	 de184d0999
			
		
	
	
		de184d0999
		
	
	
	
	
		
			
			This was pretty straightforward thanks to the work I did separating out LibCore from LibGUI already. :^) - WSMessageLoop now inherits from CEventLoop. - WSMessage now inherits from CEvent. - WSMessageReceiver goes away. Now there is only one event loop in Serenity. Very nice!
		
			
				
	
	
		
			44 lines
		
	
	
	
		
			816 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
	
		
			816 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include <WindowServer/WSClipboard.h>
 | |
| 
 | |
| WSClipboard& WSClipboard::the()
 | |
| {
 | |
|     static WSClipboard* s_the;
 | |
|     if (!s_the)
 | |
|         s_the = new WSClipboard;
 | |
|     return *s_the;
 | |
| }
 | |
| 
 | |
| WSClipboard::WSClipboard()
 | |
| {
 | |
| }
 | |
| 
 | |
| WSClipboard::~WSClipboard()
 | |
| {
 | |
| }
 | |
| 
 | |
| const byte* WSClipboard::data() const
 | |
| {
 | |
|     if (!m_shared_buffer)
 | |
|         return nullptr;
 | |
|     return (const byte*)m_shared_buffer->data();
 | |
| }
 | |
| 
 | |
| int WSClipboard::size() const
 | |
| {
 | |
|     if (!m_shared_buffer)
 | |
|         return 0;
 | |
|     return m_contents_size;
 | |
| }
 | |
| 
 | |
| void WSClipboard::clear()
 | |
| {
 | |
|     m_shared_buffer = nullptr;
 | |
|     m_contents_size = 0;
 | |
| }
 | |
| 
 | |
| void WSClipboard::set_data(Retained<SharedBuffer>&& data, int contents_size)
 | |
| {
 | |
|     dbgprintf("WSClipboard::set_data <- %p (%u bytes)\n", data->data(), contents_size);
 | |
|     m_shared_buffer = move(data);
 | |
|     m_contents_size = contents_size;
 | |
| }
 |