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
 

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 1748 of file SDL2/sdl_freerdp.cpp.

1749 : _context(context), log(WLog_Get(SDL_TAG)), update_complete(true), disp(this), input(this),
1750 primary(nullptr, SDL_FreeSurface), primary_format(nullptr, SDL_FreeFormat),
1751 rdp_thread_running(false)
1752{
1753 WINPR_ASSERT(context);
1754 grab_kbd_enabled = freerdp_settings_get_bool(context->settings, FreeRDP_GrabKeyboard);
1755}
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 1762 of file SDL2/sdl_freerdp.cpp.

1763{
1764 return reinterpret_cast<rdpClientContext*>(_context);
1765}

◆ context()

rdpContext * SdlContext::context ( ) const

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

1758{
1759 return _context;
1760}

◆ cursor()

rdpPointer * SdlContext::cursor ( ) const

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

1806{
1807 return _cursor;
1808}

◆ hasCursor()

bool SdlContext::hasCursor ( ) const

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

1765{
1766 return _cursor_visible;
1767}

◆ isConnected()

bool SdlContext::isConnected ( ) const

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

1785{
1786 return _connected;
1787}

◆ monitorId()

int64_t SdlContext::monitorId ( uint32_t  index) const

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

1825{
1826 if (index >= _monitorIds.size())
1827 {
1828 return -1;
1829 }
1830 return _monitorIds[index];
1831}

◆ monitorIds()

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

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

1820{
1821 return _monitorIds;
1822}

◆ pop()

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

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

1840{
1841 std::unique_lock lock(_queue_mux);
1842 if (_queue.empty())
1843 {
1844 return {};
1845 }
1846 auto val = std::move(_queue.front());
1847 _queue.pop();
1848 return val;
1849}

◆ push()

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

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

1834{
1835 std::unique_lock lock(_queue_mux);
1836 _queue.emplace(std::move(rects));
1837}

◆ redraw()

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

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

1770{
1771 if (!_connected)
1772 return true;
1773
1774 auto gdi = context()->gdi;
1775 WINPR_ASSERT(gdi);
1776 return gdi_send_suppress_output(gdi, suppress);
1777}

◆ setConnected()

void SdlContext::setConnected ( bool  val)

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

1780{
1781 _connected = val;
1782}

◆ setCursor()

void SdlContext::setCursor ( rdpPointer *  cursor)

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

1801{
1802 _cursor = cursor;
1803}

◆ setHasCursor()

void SdlContext::setHasCursor ( bool  val)

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

1760{
1761 this->_cursor_visible = val;
1762}

◆ setMonitorIds()

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

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

1811{
1812 _monitorIds.clear();
1813 for (auto id : ids)
1814 {
1815 _monitorIds.push_back(id);
1816 }
1817}

◆ update_fullscreen() [1/2]

BOOL SdlContext::update_fullscreen ( BOOL  enter)

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

1712{
1713 std::lock_guard<CriticalSection> lock(critical);
1714 for (const auto& window : windows)
1715 {
1716 if (!sdl_push_user_event(SDL_USEREVENT_WINDOW_FULLSCREEN, &window.second, enter))
1717 return FALSE;
1718 }
1719 fullscreen = enter;
1720 return TRUE;
1721}

◆ update_fullscreen() [2/2]

bool SdlContext::update_fullscreen ( bool  enter)

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

1712{
1713 for (const auto& window : windows)
1714 {
1715 if (!sdl_push_user_event(SDL_EVENT_USER_WINDOW_FULLSCREEN, &window.second, enter))
1716 return false;
1717 }
1718 fullscreen = enter;
1719 return true;
1720}

◆ update_minimize()

bool SdlContext::update_minimize ( )

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

1724{
1725 std::lock_guard<CriticalSection> lock(critical);
1726 return sdl_push_user_event(SDL_USEREVENT_WINDOW_MINIMIZE);
1727}

◆ update_resizeable() [1/2]

BOOL SdlContext::update_resizeable ( BOOL  enable)

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

1730{
1731 std::lock_guard<CriticalSection> lock(critical);
1732
1733 const auto settings = context()->settings;
1734 const BOOL dyn = freerdp_settings_get_bool(settings, FreeRDP_DynamicResolutionUpdate);
1735 const BOOL smart = freerdp_settings_get_bool(settings, FreeRDP_SmartSizing);
1736 BOOL use = (dyn && enable) || smart;
1737
1738 for (const auto& window : windows)
1739 {
1740 if (!sdl_push_user_event(SDL_USEREVENT_WINDOW_RESIZEABLE, &window.second, use))
1741 return FALSE;
1742 }
1743 resizeable = use;
1744
1745 return TRUE;
1746}

◆ update_resizeable() [2/2]

bool SdlContext::update_resizeable ( bool  enable)

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

1728{
1729 const auto settings = context()->settings;
1730 const bool dyn = freerdp_settings_get_bool(settings, FreeRDP_DynamicResolutionUpdate);
1731 const bool smart = freerdp_settings_get_bool(settings, FreeRDP_SmartSizing);
1732 bool use = (dyn && enable) || smart;
1733
1734 for (const auto& window : windows)
1735 {
1736 if (!sdl_push_user_event(SDL_EVENT_USER_WINDOW_RESIZEABLE, &window.second, use))
1737 return false;
1738 }
1739 resizeable = use;
1740
1741 return true;
1742}

Field Documentation

◆ clip

sdlClip SdlContext::clip

Definition at line 113 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 120 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 117 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: