From 671b1d26d0e8a1aad97b672172298d3c70e277f1 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Wed, 2 Nov 2011 18:48:50 -0400 Subject: 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. --- vcl/unx/gtk/window/gtkframe.cxx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'vcl') diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx index 10fdbfdb7dce..a80e0be0846f 100644 --- a/vcl/unx/gtk/window/gtkframe.cxx +++ b/vcl/unx/gtk/window/gtkframe.cxx @@ -1944,24 +1944,28 @@ void GtkSalFrame::updateWMClass() rtl::OString aResClass = rtl::OUStringToOString(m_sWMClass, RTL_TEXTENCODING_ASCII_US); const char *pResClass = aResClass.getLength() ? aResClass.getStr() : 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 ) ) { XClassHint* pClass = XAllocClassHint(); rtl::OString aResName = SalGenericSystem::getFrameResName( m_nExtStyle ); pClass->res_name = const_cast(aResName.getStr()); pClass->res_class = const_cast(pResClass); - XSetClassHint( getDisplay()->GetDisplay(), - GDK_WINDOW_XWINDOW(widget_get_window(m_pWindow)), + XSetClassHint( display, + widget_get_xid(m_pWindow), 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 ) -- cgit