Remove screen realloc argument

Replaced with explicit reset function
This commit is contained in:
patrick96 2022-11-30 13:41:25 +01:00
parent d296d67953
commit aadd4ce1c8
No known key found for this signature in database
GPG Key ID: 521E5E03AEBCA1A7
3 changed files with 10 additions and 6 deletions

View File

@ -108,7 +108,8 @@ class connection : public detail::connection_base<connection&, XPP_EXTENSION_LIS
static void pack_values(uint32_t mask, const void* src, std::array<uint32_t, 32>& dest);
xcb_screen_t* screen(bool realloc = false);
void reset_screen();
xcb_screen_t* screen();
string id(xcb_window_t w) const;

View File

@ -98,7 +98,8 @@ void screen::handle(const evt::randr_screen_change_notify& evt) {
return;
}
auto screen = m_connection.screen(true);
m_connection.reset_screen();
auto screen = m_connection.screen();
auto changed = false;
// We need to reload if the screen size changed as well

View File

@ -79,13 +79,15 @@ string connection::id(xcb_window_t w) const {
return sstream() << "0x" << std::hex << std::setw(7) << std::setfill('0') << w;
}
void connection::reset_screen() {
m_screen = nullptr;
}
/**
* Get pointer to the default xcb screen
*
* TODO remove realloc param. Create explicit realloc function
*/
xcb_screen_t* connection::screen(bool realloc) {
if (m_screen == nullptr || realloc) {
xcb_screen_t* connection::screen() {
if (m_screen == nullptr) {
m_screen = screen_of_display(default_screen());
}
return m_screen;