src/x11/tray_manager.cpp
/**
 * Refresh the bar window by clearing it along with each client window
 */
Refresh the bar window by clearing it along with each client window
Refresh the bar window by clearing it along with each client window
void tray_manager::refresh_window() {
  if (!m_activated || !m_mapped || !m_mtx.try_lock()) {
    return;
  }
  std::lock_guard<mutex> lock(m_mtx, std::adopt_lock);
  m_log.trace("tray: Refreshing window");
  auto width = calculate_w();
  auto height = calculate_h();
  if (m_opts.transparent && !m_context) {
    xcb_rectangle_t rect{0, 0, static_cast<uint16_t>(width), static_cast<uint16_t>(height)};
    m_connection.poly_fill_rectangle(m_pixmap, m_gc, 1, &rect);
  }
  if (m_surface) {
    m_surface->flush();
  }
  m_connection.clear_area(0, m_tray, 0, 0, width, height);
  for (auto&& client : m_clients) {
    try {
      if (client->mapped()) {
        client->clear_window();
      }
    } catch (const std::exception& e) {
      m_log.err("Failed to clear tray client %s '%s' (%s)", m_connection.id(client->window()),
          ewmh_util::get_wm_name(client->window()), e.what());
    }
  }
  m_connection.flush();
  if (!mapped_clients()) {
    m_opts.configured_w = 0;
  } else {
    m_opts.configured_w = width;
  }
}
void tray_manager :: refresh_window ( ) { if ( ! m_activated || ! m_mapped || ! m_mtx . try_lock ( ) ) { return ; } std :: lock_guard < mutex > lock ( m_mtx , std :: adopt_lock ) ; m_log . trace ( " " ) ; auto width = calculate_w ( ) ; auto height = calculate_h ( ) ; if ( m_opts . transparent && ! m_context ) { xcb_rectangle_t rect { 0 , 0 , static_cast < uint16_t > ( width ) , static_cast < uint16_t > ( height ) } ; m_connection . poly_fill_rectangle ( m_pixmap , m_gc , 1 , & rect ) ; } if ( m_surface ) { m_surface -> flush ( ) ; } m_connection . clear_area ( 0 , m_tray , 0 , 0 , width , height ) ; for ( auto && client : m_clients ) { try { if ( client -> mapped ( ) ) { client -> clear_window ( ) ; } } catch ( const std :: exception & e ) { m_log . err ( " " , m_connection . id ( client -> window ( ) ) , ewmh_util :: get_wm_name ( client -> window ( ) ) , e . what ( ) ) ; } } m_connection . flush ( ) ; if ( ! mapped_clients ( ) ) { m_opts . configured_w = 0 ; } else { m_opts . configured_w = width ; } }
Refresh the bar window by clearing it along with each client window
Refresh the bar window by clearing it along with each client window