summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-11-02 13:38:17 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-11-02 14:04:33 +0000
commit6ca910adfed9906be587cb82284a631377490303 (patch)
tree8fbce4cf5d722ba621f0cd573c6cbc237276c40e /vcl
parentb99bff93a3dd2f76c9c98ff3bc72a60cbd79730a (diff)
gtk3: grabs on floating window inside floating window
under gtk3 with the floating window of the listbox inside the color floating window if the toplevel window is dismissed the focus doesn't remain locked to its parent, but skips to the grandparent so grab and ungrab only once elements in the hierarchy Change-Id: I14b1b8888671634c0c01c6416493f912e4abd2f9
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/unx/gtk/gtkframe.hxx4
-rw-r--r--vcl/unx/gtk3/gtk3gtkframe.cxx23
2 files changed, 23 insertions, 4 deletions
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 4b891b6be4c3..4d675c603e3e 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -351,6 +351,7 @@ public:
#if GTK_CHECK_VERSION(3,0,0)
cairo_surface_t* m_pSurface;
DamageHandler m_aDamageHandler;
+ int m_nGrabLevel;
#endif
GtkSalFrame( SalFrame* pParent, SalFrameStyleFlags nStyle );
GtkSalFrame( SystemParentData* pSysData );
@@ -425,6 +426,9 @@ public:
void closePopup();
+ void addGrabLevel();
+ void removeGrabLevel();
+
#endif
virtual ~GtkSalFrame() override;
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 60e1a1d8bbab..d377f32fdead 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -980,6 +980,7 @@ static void damaged(void *handle,
void GtkSalFrame::InitCommon()
{
m_pSurface = nullptr;
+ m_nGrabLevel = 0;
m_aDamageHandler.handle = this;
m_aDamageHandler.damaged = ::damaged;
@@ -1441,7 +1442,7 @@ void GtkSalFrame::Show( bool bVisible, bool /*bNoActivate*/ )
if (isFloatGrabWindow() && !getDisplay()->GetCaptureFrame())
{
m_pParent->grabPointer(true, true);
- gtk_grab_add(m_pParent->getMouseEventWidget());
+ m_pParent->addGrabLevel();
}
gtk_widget_show(m_pWindow);
@@ -1452,7 +1453,7 @@ void GtkSalFrame::Show( bool bVisible, bool /*bNoActivate*/ )
if (!getDisplay()->GetCaptureFrame())
{
grabPointer(true, true);
- gtk_grab_add(getMouseEventWidget());
+ addGrabLevel();
}
// #i44068# reset parent's IM context
if( m_pParent )
@@ -1466,9 +1467,9 @@ void GtkSalFrame::Show( bool bVisible, bool /*bNoActivate*/ )
m_nFloats--;
if (!getDisplay()->GetCaptureFrame())
{
- gtk_grab_remove(getMouseEventWidget());
+ removeGrabLevel();
grabPointer(false);
- gtk_grab_remove(m_pParent->getMouseEventWidget());
+ m_pParent->removeGrabLevel();
m_pParent->grabPointer(false);
}
}
@@ -2550,6 +2551,20 @@ void GtkSalFrame::StartToolKitMoveBy()
pEvent->button.time);
}
+void GtkSalFrame::addGrabLevel()
+{
+ if (m_nGrabLevel == 0)
+ gtk_grab_add(getMouseEventWidget());
+ ++m_nGrabLevel;
+}
+
+void GtkSalFrame::removeGrabLevel()
+{
+ --m_nGrabLevel;
+ if (m_nGrabLevel == 0)
+ gtk_grab_remove(getMouseEventWidget());
+}
+
void GtkSalFrame::closePopup()
{
if (!m_nFloats)