[Libreoffice-commits] core.git: 3 commits - vcl/inc vcl/unx
Caolán McNamara
caolanm at redhat.com
Wed Nov 2 14:06:11 UTC 2016
vcl/inc/unx/gtk/gtkframe.hxx | 6 +++++-
vcl/unx/gtk3/gtk3gtkframe.cxx | 35 ++++++++++++++++++++++++++---------
2 files changed, 31 insertions(+), 10 deletions(-)
New commits:
commit 6ca910adfed9906be587cb82284a631377490303
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Nov 2 13:38:17 2016 +0000
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
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 4b891b6..4d675c6 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 60e1a1d..d377f32 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)
commit b99bff93a3dd2f76c9c98ff3bc72a60cbd79730a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Nov 1 20:32:57 2016 +0000
gtk3: allow float grab inside float grab
this is so that the floating window belonging to the listbox inside the
floating window color popup will track the mouse as it moves up and down over
the menu.
Change-Id: If108b5b3866fdbc04513c48c8d859bedd3867379
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 704e4ce..60e1a1d 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -1438,7 +1438,7 @@ void GtkSalFrame::Show( bool bVisible, bool /*bNoActivate*/ )
SetDefaultSize();
setMinMaxSize();
- if (isFloatGrabWindow() && !getDisplay()->GetCaptureFrame() && m_nFloats == 0)
+ if (isFloatGrabWindow() && !getDisplay()->GetCaptureFrame())
{
m_pParent->grabPointer(true, true);
gtk_grab_add(m_pParent->getMouseEventWidget());
@@ -1449,7 +1449,7 @@ void GtkSalFrame::Show( bool bVisible, bool /*bNoActivate*/ )
if( isFloatGrabWindow() )
{
m_nFloats++;
- if( ! getDisplay()->GetCaptureFrame() && m_nFloats == 1 )
+ if (!getDisplay()->GetCaptureFrame())
{
grabPointer(true, true);
gtk_grab_add(getMouseEventWidget());
@@ -1464,7 +1464,7 @@ void GtkSalFrame::Show( bool bVisible, bool /*bNoActivate*/ )
if( isFloatGrabWindow() )
{
m_nFloats--;
- if( ! getDisplay()->GetCaptureFrame() && m_nFloats == 0)
+ if (!getDisplay()->GetCaptureFrame())
{
gtk_grab_remove(getMouseEventWidget());
grabPointer(false);
commit 38e7f38b82e121120739034b4119e7d95c8b33fd
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Nov 2 10:14:57 2016 +0000
gtk3: just close the toplevel float if it corresponds to the event frame
Change-Id: I489acc288fb1c9564f208e024dd5aa3ae9660a49
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index c6d7743..4b891b6 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -423,7 +423,7 @@ public:
void startDrag(gint nButton, gint nDragOriginX, gint nDragOriginY,
GdkDragAction sourceActions, GtkTargetList* pTargetList);
- static void closePopup();
+ void closePopup();
#endif
virtual ~GtkSalFrame() override;
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index f274a78..704e4ce 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -2557,6 +2557,8 @@ void GtkSalFrame::closePopup()
ImplSVData* pSVData = ImplGetSVData();
if (!pSVData->maWinData.mpFirstFloat)
return;
+ if (pSVData->maWinData.mpFirstFloat->ImplGetFrame() != this)
+ return;
pSVData->maWinData.mpFirstFloat->EndPopupMode(FloatWinPopupEndFlags::Cancel | FloatWinPopupEndFlags::CloseAll);
}
@@ -2597,7 +2599,7 @@ gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer
{
bool bClosePopups = (pEvent->window != widget_get_window(pThis->getMouseEventWidget()));
if (bClosePopups)
- closePopup();
+ pThis->closePopup();
}
// --- RTL --- (mirror mouse pos)
@@ -3143,7 +3145,7 @@ gboolean GtkSalFrame::signalWindowState( GtkWidget*, GdkEvent* pEvent, gpointer
!(pThis->m_nState & GDK_WINDOW_STATE_WITHDRAWN))
{
if (pThis->isFloatGrabWindow())
- closePopup();
+ pThis->closePopup();
}
pThis->m_nState = pEvent->window_state.new_window_state;
More information about the Libreoffice-commits
mailing list