summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/unx/gtk/window/gtkframe.cxx38
-rw-r--r--vcl/unx/inc/plugins/gtk/gtkframe.hxx1
2 files changed, 18 insertions, 21 deletions
diff --git a/vcl/unx/gtk/window/gtkframe.cxx b/vcl/unx/gtk/window/gtkframe.cxx
index 16e478c22f6e..3d11ce8a37ea 100644
--- a/vcl/unx/gtk/window/gtkframe.cxx
+++ b/vcl/unx/gtk/window/gtkframe.cxx
@@ -566,6 +566,7 @@ void GtkSalFrame::InitCommon()
m_nExtStyle = 0;
m_pRegion = NULL;
m_ePointerStyle = 0xffff;
+ m_bSetFocusOnMap = false;
gtk_widget_set_app_paintable( m_pWindow, TRUE );
gtk_widget_set_double_buffered( m_pWindow, FALSE );
@@ -803,18 +804,6 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle )
( ! (nStyle & SAL_FRAME_STYLE_FLOAT) ||
(nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION|SAL_FRAME_STYLE_FLOAT_FOCUSABLE) ) );
- /* #i100116# metacity has a peculiar behavior regarding WM_HINT accept focus and _NET_WM_USER_TIME
- at some point that may be fixed in metacity and we will have to revisit this
- */
-
- // MT/PL 2010/02: #i102694# and #i102803# have been introduced by this hack
- // Nowadays the original issue referenced above doesn't seem to exist anymore, tested different szenarious described in the issues
- // If some older versions of MetaCity are still in use somewhere, they need to be updated, instead of using strange hacks in OOo.
- // As a work around for such old systems, people might consider to not use the GTK plugin.
-
- bool bMetaCityToolWindowHack = false;
- // bMetaCityToolWindowHack = getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity") && (nStyle & SAL_FRAME_STYLE_TOOLWINDOW );
-
if( bDecoHandling )
{
bool bNoDecor = ! (nStyle & (SAL_FRAME_STYLE_MOVEABLE | SAL_FRAME_STYLE_SIZEABLE | SAL_FRAME_STYLE_CLOSEABLE ) );
@@ -830,8 +819,6 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle )
{
eType = GDK_WINDOW_TYPE_HINT_UTILITY;
gtk_window_set_skip_taskbar_hint( GTK_WINDOW(m_pWindow), true );
- if( bMetaCityToolWindowHack )
- lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, true );
}
else if( (nStyle & SAL_FRAME_STYLE_OWNERDRAWDECORATION) )
{
@@ -882,7 +869,7 @@ void GtkSalFrame::Init( SalFrame* pParent, ULONG nStyle )
if( bDecoHandling )
{
gtk_window_set_resizable( GTK_WINDOW(m_pWindow), (nStyle & SAL_FRAME_STYLE_SIZEABLE) ? TRUE : FALSE );
- if( ( (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION)) ) || bMetaCityToolWindowHack )
+ if( ( (nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION)) ) )
lcl_set_accept_focus( GTK_WINDOW(m_pWindow), FALSE, false );
}
@@ -1366,9 +1353,9 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate )
//
// i.e. having a time < that of the toplevel frame means that the toplevel frame gets unfocused.
// awesome.
+ bool bMetaCity = getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity");
if( nUserTime == 0 &&
- (
- getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("Metacity") ||
+ ( bMetaCity ||
(
getDisplay()->getWMAdaptor()->getWindowManagerName().EqualsAscii("compiz") &&
(m_nStyle & (SAL_FRAME_STYLE_OWNERDRAWDECORATION))
@@ -1380,9 +1367,11 @@ void GtkSalFrame::Show( BOOL bVisible, BOOL bNoActivate )
nUserTime= getDisplay()->GetLastUserEventTime( true );
//nUserTime = gdk_x11_get_server_time(GTK_WIDGET (m_pWindow)->window);
}
-
lcl_set_user_time( GTK_WIDGET(m_pWindow)->window, nUserTime );
+ if( bMetaCity && ! bNoActivate && (m_nStyle & SAL_FRAME_STYLE_TOOLWINDOW) )
+ m_bSetFocusOnMap = true;
+
gtk_widget_show( m_pWindow );
if( isFloatGrabWindow() )
@@ -2870,6 +2859,8 @@ gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame )
GTK_YIELD_GRAB();
+ bool bSetFocus = pThis->m_bSetFocusOnMap;
+ pThis->m_bSetFocusOnMap = false;
if( ImplGetSVData()->mbIsTestTool )
{
/* #i76541# testtool needs the focus to be in a new document
@@ -2879,9 +2870,14 @@ gboolean GtkSalFrame::signalMap( GtkWidget*, GdkEvent*, gpointer frame )
* so this is done when running in testtool only
*/
if( ! pThis->m_pParent && (pThis->m_nStyle & SAL_FRAME_STYLE_MOVEABLE) != 0 )
- XSetInputFocus( pThis->getDisplay()->GetDisplay(),
- GDK_WINDOW_XWINDOW( GTK_WIDGET(pThis->m_pWindow)->window),
- RevertToParent, CurrentTime );
+ bSetFocus = true;
+ }
+
+ if( bSetFocus )
+ {
+ XSetInputFocus( pThis->getDisplay()->GetDisplay(),
+ GDK_WINDOW_XWINDOW( GTK_WIDGET(pThis->m_pWindow)->window),
+ RevertToParent, CurrentTime );
}
pThis->CallCallback( SALEVENT_RESIZE, NULL );
diff --git a/vcl/unx/inc/plugins/gtk/gtkframe.hxx b/vcl/unx/inc/plugins/gtk/gtkframe.hxx
index 0a91d99fd839..88a26b401eed 100644
--- a/vcl/unx/inc/plugins/gtk/gtkframe.hxx
+++ b/vcl/unx/inc/plugins/gtk/gtkframe.hxx
@@ -185,6 +185,7 @@ class GtkSalFrame : public SalFrame
bool m_bDefaultSize;
bool m_bSendModChangeOnRelease;
bool m_bWindowIsGtkPlug;
+ bool m_bSetFocusOnMap;
String m_aTitle;
IMHandler* m_pIMHandler;