Kaydet (Commit) 671b1d26 authored tarafından Cosimo Cecchi's avatar Cosimo Cecchi

gtk3: always set the wmclass using the X helper

The helper provided by GTK is only meant to be used before the toplevel
is realized, so it's not useful for this case. Instead, always call the
X helper.
This also gets rid of some GTK warnings we get on the terminal.
üst 56d28787
...@@ -1944,24 +1944,28 @@ void GtkSalFrame::updateWMClass() ...@@ -1944,24 +1944,28 @@ void GtkSalFrame::updateWMClass()
rtl::OString aResClass = rtl::OUStringToOString(m_sWMClass, RTL_TEXTENCODING_ASCII_US); rtl::OString aResClass = rtl::OUStringToOString(m_sWMClass, RTL_TEXTENCODING_ASCII_US);
const char *pResClass = aResClass.getLength() ? aResClass.getStr() : const char *pResClass = aResClass.getLength() ? aResClass.getStr() :
SalGenericSystem::getFrameClassName(); SalGenericSystem::getFrameClassName();
Display *display;
if (!getDisplay()->IsX11Display())
return;
#if GTK_CHECK_VERSION(3,0,0)
display = GDK_DISPLAY_XDISPLAY(getGdkDisplay());
#else
display = getDisplay()->GetDisplay();
#endif
#if !GTK_CHECK_VERSION(3,0,0)
if( IS_WIDGET_REALIZED( m_pWindow ) ) if( IS_WIDGET_REALIZED( m_pWindow ) )
{ {
XClassHint* pClass = XAllocClassHint(); XClassHint* pClass = XAllocClassHint();
rtl::OString aResName = SalGenericSystem::getFrameResName( m_nExtStyle ); rtl::OString aResName = SalGenericSystem::getFrameResName( m_nExtStyle );
pClass->res_name = const_cast<char*>(aResName.getStr()); pClass->res_name = const_cast<char*>(aResName.getStr());
pClass->res_class = const_cast<char*>(pResClass); pClass->res_class = const_cast<char*>(pResClass);
XSetClassHint( getDisplay()->GetDisplay(), XSetClassHint( display,
GDK_WINDOW_XWINDOW(widget_get_window(m_pWindow)), widget_get_xid(m_pWindow),
pClass ); pClass );
XFree( pClass ); XFree( pClass );
} }
else
#endif
gtk_window_set_wmclass( GTK_WINDOW(m_pWindow),
SalGenericSystem::getFrameResName( m_nExtStyle ).getStr(),
pResClass );
} }
void GtkSalFrame::SetApplicationID( const rtl::OUString &rWMClass ) void GtkSalFrame::SetApplicationID( const rtl::OUString &rWMClass )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment