FreeRDP
Loading...
Searching...
No Matches
SdlContext Class Reference
Collaboration diagram for SdlContext:

Public Member Functions

 SdlContext (rdpContext *context)
 
 SdlContext (const SdlContext &other)=delete
 
 SdlContext (SdlContext &&other)=delete
 
SdlContextoperator= (const SdlContext &other)=delete
 
SdlContextoperator= (SdlContext &&other)=delete
 
BOOL update_resizeable (BOOL enable)
 
BOOL update_fullscreen (BOOL enter)
 
BOOL update_minimize ()
 
rdpContext * context () const
 
rdpClientContext * common () const
 
 SdlContext (rdpContext *context)
 
 SdlContext (const SdlContext &other)=delete
 
 SdlContext (SdlContext &&other)=delete
 
SdlContextoperator= (const SdlContext &other)=delete
 
SdlContextoperator= (SdlContext &&other)=delete
 
bool redraw (bool suppress=false) const
 
void setConnected (bool val)
 
bool isConnected () const
 
bool update_resizeable (bool enable)
 
bool update_fullscreen (bool enter)
 
bool update_minimize ()
 
rdpContext * context () const
 
rdpClientContext * common () const
 
void setCursor (rdpPointer *cursor)
 
rdpPointer * cursor () const
 
void setMonitorIds (const std::vector< SDL_DisplayID > &ids)
 
const std::vector< SDL_DisplayID > & monitorIds () const
 
int64_t monitorId (uint32_t index) const
 
void push (std::vector< SDL_Rect > &&rects)
 
std::vector< SDL_Rect > pop ()
 
void setHasCursor (bool val)
 
bool hasCursor () const
 
void setMetadata ()
 

Data Fields

wLog * log
 
bool fullscreen = false
 
bool resizeable = false
 
bool grab_mouse = false
 
bool grab_kbd = false
 
bool grab_kbd_enabled = true
 
std::map< Uint32, SdlWindowwindows
 
CriticalSection critical
 
std::thread thread
 
WinPREvent initialize
 
WinPREvent initialized
 
WinPREvent update_complete
 
WinPREvent windows_created
 
int exit_code = -1
 
sdlDispContext disp
 
sdlInput input
 
SDLSurfacePtr primary
 
SDLPixelFormatPtr primary_format
 
Uint32 sdl_pixel_format = 0
 
std::unique_ptr< SDLConnectionDialogconnection_dialog
 
std::atomic< bool > rdp_thread_running
 
sdlClip clip
 
SDL_PixelFormat sdl_pixel_format = SDL_PIXELFORMAT_UNKNOWN
 
SdlConnectionDialogWrapper dialog
 

Detailed Description

Definition at line 46 of file SDL2/sdl_freerdp.hpp.

Constructor & Destructor Documentation

◆ SdlContext()

SdlContext::SdlContext ( rdpContext *  context)
explicit

Definition at line 1761 of file SDL2/sdl_freerdp.cpp.

1762 : _context(context), log(WLog_Get(SDL_TAG)), update_complete(true), disp(this), input(this),
1763 primary(nullptr, SDL_FreeSurface), primary_format(nullptr, SDL_FreeFormat),
1764 rdp_thread_running(false)
1765{
1766 WINPR_ASSERT(context);
1767 grab_kbd_enabled = freerdp_settings_get_bool(context->settings, FreeRDP_GrabKeyboard);
1768}
FREERDP_API BOOL freerdp_settings_get_bool(const rdpSettings *settings, FreeRDP_Settings_Keys_Bool id)
Returns a boolean settings value.

Member Function Documentation

◆ common()

rdpClientContext * SdlContext::common ( ) const

Definition at line 1775 of file SDL2/sdl_freerdp.cpp.

1776{
1777 return reinterpret_cast<rdpClientContext*>(_context);
1778}

◆ context()

rdpContext * SdlContext::context ( ) const

Definition at line 1770 of file SDL2/sdl_freerdp.cpp.

1771{
1772 return _context;
1773}

◆ cursor()

rdpPointer * SdlContext::cursor ( ) const

Definition at line 1864 of file SDL3/sdl_freerdp.cpp.

1865{
1866 return _cursor;
1867}

◆ hasCursor()

bool SdlContext::hasCursor ( ) const

Definition at line 1808 of file SDL3/sdl_freerdp.cpp.

1809{
1810 return _cursor_visible;
1811}

◆ isConnected()

bool SdlContext::isConnected ( ) const

Definition at line 1843 of file SDL3/sdl_freerdp.cpp.

1844{
1845 return _connected;
1846}

◆ monitorId()

int64_t SdlContext::monitorId ( uint32_t  index) const

Definition at line 1883 of file SDL3/sdl_freerdp.cpp.

1884{
1885 if (index >= _monitorIds.size())
1886 {
1887 return -1;
1888 }
1889 return _monitorIds[index];
1890}

◆ monitorIds()

const std::vector< SDL_DisplayID > & SdlContext::monitorIds ( ) const

Definition at line 1878 of file SDL3/sdl_freerdp.cpp.

1879{
1880 return _monitorIds;
1881}

◆ pop()

std::vector< SDL_Rect > SdlContext::pop ( )

Definition at line 1898 of file SDL3/sdl_freerdp.cpp.

1899{
1900 std::unique_lock lock(_queue_mux);
1901 if (_queue.empty())
1902 {
1903 return {};
1904 }
1905 auto val = std::move(_queue.front());
1906 _queue.pop();
1907 return val;
1908}

◆ push()

void SdlContext::push ( std::vector< SDL_Rect > &&  rects)

Definition at line 1892 of file SDL3/sdl_freerdp.cpp.

1893{
1894 std::unique_lock lock(_queue_mux);
1895 _queue.emplace(std::move(rects));
1896}

◆ redraw()

bool SdlContext::redraw ( bool  suppress = false) const

Definition at line 1828 of file SDL3/sdl_freerdp.cpp.

1829{
1830 if (!_connected)
1831 return true;
1832
1833 auto gdi = context()->gdi;
1834 WINPR_ASSERT(gdi);
1835 return gdi_send_suppress_output(gdi, suppress);
1836}

◆ setConnected()

void SdlContext::setConnected ( bool  val)

Definition at line 1838 of file SDL3/sdl_freerdp.cpp.

1839{
1840 _connected = val;
1841}

◆ setCursor()

void SdlContext::setCursor ( rdpPointer *  cursor)

Definition at line 1859 of file SDL3/sdl_freerdp.cpp.

1860{
1861 _cursor = cursor;
1862}

◆ setHasCursor()

void SdlContext::setHasCursor ( bool  val)

Definition at line 1803 of file SDL3/sdl_freerdp.cpp.

1804{
1805 this->_cursor_visible = val;
1806}

◆ setMetadata()

void SdlContext::setMetadata ( )

Definition at line 1813 of file SDL3/sdl_freerdp.cpp.

1814{
1815 auto wmclass = freerdp_settings_get_string(_context->settings, FreeRDP_WmClass);
1816 if (!wmclass || (strlen(wmclass) == 0))
1817 wmclass = SDL_CLIENT_UUID;
1818
1819 SDL_SetAppMetadataProperty(SDL_PROP_APP_METADATA_IDENTIFIER_STRING, wmclass);
1820 SDL_SetAppMetadataProperty(SDL_PROP_APP_METADATA_NAME_STRING, SDL_CLIENT_NAME);
1821 SDL_SetAppMetadataProperty(SDL_PROP_APP_METADATA_VERSION_STRING, SDL_CLIENT_VERSION);
1822 SDL_SetAppMetadataProperty(SDL_PROP_APP_METADATA_CREATOR_STRING, SDL_CLIENT_VENDOR);
1823 SDL_SetAppMetadataProperty(SDL_PROP_APP_METADATA_COPYRIGHT_STRING, SDL_CLIENT_COPYRIGHT);
1824 SDL_SetAppMetadataProperty(SDL_PROP_APP_METADATA_URL_STRING, SDL_CLIENT_URL);
1825 SDL_SetAppMetadataProperty(SDL_PROP_APP_METADATA_TYPE_STRING, SDL_CLIENT_TYPE);
1826}
FREERDP_API const char * freerdp_settings_get_string(const rdpSettings *settings, FreeRDP_Settings_Keys_String id)
Returns a immutable string settings value.

◆ setMonitorIds()

void SdlContext::setMonitorIds ( const std::vector< SDL_DisplayID > &  ids)

Definition at line 1869 of file SDL3/sdl_freerdp.cpp.

1870{
1871 _monitorIds.clear();
1872 for (auto id : ids)
1873 {
1874 _monitorIds.push_back(id);
1875 }
1876}

◆ update_fullscreen() [1/2]

BOOL SdlContext::update_fullscreen ( BOOL  enter)

Definition at line 1724 of file SDL2/sdl_freerdp.cpp.

1725{
1726 std::lock_guard<CriticalSection> lock(critical);
1727 for (const auto& window : windows)
1728 {
1729 if (!sdl_push_user_event(SDL_USEREVENT_WINDOW_FULLSCREEN, &window.second, enter))
1730 return FALSE;
1731 }
1732 fullscreen = enter;
1733 return TRUE;
1734}

◆ update_fullscreen() [2/2]

bool SdlContext::update_fullscreen ( bool  enter)

Definition at line 1762 of file SDL3/sdl_freerdp.cpp.

1763{
1764 for (const auto& window : windows)
1765 {
1766 if (!sdl_push_user_event(SDL_EVENT_USER_WINDOW_FULLSCREEN, &window.second, enter))
1767 return false;
1768 }
1769 fullscreen = enter;
1770 return true;
1771}

◆ update_minimize()

bool SdlContext::update_minimize ( )

Definition at line 1736 of file SDL2/sdl_freerdp.cpp.

1737{
1738 std::lock_guard<CriticalSection> lock(critical);
1739 return sdl_push_user_event(SDL_USEREVENT_WINDOW_MINIMIZE);
1740}

◆ update_resizeable() [1/2]

BOOL SdlContext::update_resizeable ( BOOL  enable)

Definition at line 1742 of file SDL2/sdl_freerdp.cpp.

1743{
1744 std::lock_guard<CriticalSection> lock(critical);
1745
1746 const auto settings = context()->settings;
1747 const BOOL dyn = freerdp_settings_get_bool(settings, FreeRDP_DynamicResolutionUpdate);
1748 const BOOL smart = freerdp_settings_get_bool(settings, FreeRDP_SmartSizing);
1749 BOOL use = (dyn && enable) || smart;
1750
1751 for (const auto& window : windows)
1752 {
1753 if (!sdl_push_user_event(SDL_USEREVENT_WINDOW_RESIZEABLE, &window.second, use))
1754 return FALSE;
1755 }
1756 resizeable = use;
1757
1758 return TRUE;
1759}

◆ update_resizeable() [2/2]

bool SdlContext::update_resizeable ( bool  enable)

Definition at line 1778 of file SDL3/sdl_freerdp.cpp.

1779{
1780 const auto settings = context()->settings;
1781 const bool dyn = freerdp_settings_get_bool(settings, FreeRDP_DynamicResolutionUpdate);
1782 const bool smart = freerdp_settings_get_bool(settings, FreeRDP_SmartSizing);
1783 bool use = (dyn && enable) || smart;
1784
1785 for (const auto& window : windows)
1786 {
1787 if (!sdl_push_user_event(SDL_EVENT_USER_WINDOW_RESIZEABLE, &window.second, use))
1788 return false;
1789 }
1790 resizeable = use;
1791
1792 return true;
1793}

Field Documentation

◆ clip

sdlClip SdlContext::clip

Definition at line 115 of file SDL3/sdl_freerdp.hpp.

◆ connection_dialog

std::unique_ptr<SDLConnectionDialog> SdlContext::connection_dialog

Definition at line 88 of file SDL2/sdl_freerdp.hpp.

◆ critical

CriticalSection SdlContext::critical

Definition at line 72 of file SDL2/sdl_freerdp.hpp.

◆ dialog

SdlConnectionDialogWrapper SdlContext::dialog

Definition at line 122 of file SDL3/sdl_freerdp.hpp.

◆ disp

sdlDispContext SdlContext::disp

Definition at line 80 of file SDL2/sdl_freerdp.hpp.

◆ exit_code

int SdlContext::exit_code = -1

Definition at line 78 of file SDL2/sdl_freerdp.hpp.

◆ fullscreen

bool SdlContext::fullscreen = false

Definition at line 64 of file SDL2/sdl_freerdp.hpp.

◆ grab_kbd

bool SdlContext::grab_kbd = false

Definition at line 67 of file SDL2/sdl_freerdp.hpp.

◆ grab_kbd_enabled

bool SdlContext::grab_kbd_enabled = true

Definition at line 68 of file SDL2/sdl_freerdp.hpp.

◆ grab_mouse

bool SdlContext::grab_mouse = false

Definition at line 66 of file SDL2/sdl_freerdp.hpp.

◆ initialize

WinPREvent SdlContext::initialize

Definition at line 74 of file SDL2/sdl_freerdp.hpp.

◆ initialized

WinPREvent SdlContext::initialized

Definition at line 75 of file SDL2/sdl_freerdp.hpp.

◆ input

sdlInput SdlContext::input

Definition at line 81 of file SDL2/sdl_freerdp.hpp.

◆ log

wLog * SdlContext::log

Definition at line 61 of file SDL2/sdl_freerdp.hpp.

◆ primary

SDLSurfacePtr SdlContext::primary

Definition at line 83 of file SDL2/sdl_freerdp.hpp.

◆ primary_format

SDLPixelFormatPtr SdlContext::primary_format

Definition at line 84 of file SDL2/sdl_freerdp.hpp.

◆ rdp_thread_running

std::atomic< bool > SdlContext::rdp_thread_running

Definition at line 90 of file SDL2/sdl_freerdp.hpp.

◆ resizeable

bool SdlContext::resizeable = false

Definition at line 65 of file SDL2/sdl_freerdp.hpp.

◆ sdl_pixel_format [1/2]

Uint32 SdlContext::sdl_pixel_format = 0

Definition at line 86 of file SDL2/sdl_freerdp.hpp.

◆ sdl_pixel_format [2/2]

SDL_PixelFormat SdlContext::sdl_pixel_format = SDL_PIXELFORMAT_UNKNOWN

Definition at line 119 of file SDL3/sdl_freerdp.hpp.

◆ thread

std::thread SdlContext::thread

Definition at line 73 of file SDL2/sdl_freerdp.hpp.

◆ update_complete

WinPREvent SdlContext::update_complete

Definition at line 76 of file SDL2/sdl_freerdp.hpp.

◆ windows

std::map< Uint32, SdlWindow > SdlContext::windows

Definition at line 70 of file SDL2/sdl_freerdp.hpp.

◆ windows_created

WinPREvent SdlContext::windows_created

Definition at line 77 of file SDL2/sdl_freerdp.hpp.


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