summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-07-07 08:34:40 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-07-07 12:16:20 +0100
commit1190e7385291fb0e6cd3505e88e589c80b02db00 (patch)
tree5804f341ce0fd28d3e0974af554599a617e35441
parenta71de3f2b42b8251f4d86ac38c4161df28f47a25 (diff)
gtk3: if a popup is withdrawn close the popup
we don't always get the click that causes the popup to be withdrawn when the mouse is clicked outside the application during a grab Change-Id: I2dbef23813972ebd75c8899711a2d1309110f968
-rw-r--r--vcl/inc/unx/gtk/gtkframe.hxx4
-rw-r--r--vcl/unx/gtk3/gtk3gtkframe.cxx39
2 files changed, 34 insertions, 9 deletions
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 6c24df85b818..4e13318215df 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -422,6 +422,10 @@ public:
void startDrag(gint nButton, gint nDragOriginX, gint nDragOriginY,
GdkDragAction sourceActions, GtkTargetList* pTargetList);
+ void WithDrawn();
+
+ static void closePopup(bool bWithDrawn);
+
#endif
virtual ~GtkSalFrame();
diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx
index 52f5aee8fa7b..79b0e11d6a76 100644
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
@@ -2550,6 +2550,26 @@ void GtkSalFrame::StartToolKitMoveBy()
pEvent->button.time);
}
+void GtkSalFrame::WithDrawn()
+{
+ if (isFloatGrabWindow())
+ closePopup(true);
+}
+
+void GtkSalFrame::closePopup(bool bWithDrawn)
+{
+ if (!m_nFloats)
+ return;
+ ImplSVData* pSVData = ImplGetSVData();
+ if (!pSVData->maWinData.mpFirstFloat)
+ return;
+ bool bClosePopup = bWithDrawn;
+ if (!bClosePopup)
+ bClosePopup = !(pSVData->maWinData.mpFirstFloat->GetPopupModeFlags() & FloatWinPopupFlags::NoAppFocusClose);
+ if (bClosePopup)
+ pSVData->maWinData.mpFirstFloat->EndPopupMode(FloatWinPopupEndFlags::Cancel | FloatWinPopupEndFlags::CloseAll);
+}
+
gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer frame )
{
UpdateLastInputEventTime(pEvent->time);
@@ -2611,13 +2631,7 @@ gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer
{
if( bClosePopups )
{
- ImplSVData* pSVData = ImplGetSVData();
- if ( pSVData->maWinData.mpFirstFloat )
- {
- static const char* pEnv = getenv( "SAL_FLOATWIN_NOAPPFOCUSCLOSE" );
- if ( !(pSVData->maWinData.mpFirstFloat->GetPopupModeFlags() & FloatWinPopupFlags::NoAppFocusClose) && !(pEnv && *pEnv) )
- pSVData->maWinData.mpFirstFloat->EndPopupMode( FloatWinPopupEndFlags::Cancel | FloatWinPopupEndFlags::CloseAll );
- }
+ closePopup(false);
}
if( ! aDel.isDeleted() )
@@ -3142,11 +3156,18 @@ gboolean GtkSalFrame::signalWindowState( GtkWidget*, GdkEvent* pEvent, gpointer
pThis->TriggerPaintEvent();
}
- if( (pEvent->window_state.new_window_state & GDK_WINDOW_STATE_MAXIMIZED) &&
- ! (pThis->m_nState & GDK_WINDOW_STATE_MAXIMIZED) )
+ if ((pEvent->window_state.new_window_state & GDK_WINDOW_STATE_MAXIMIZED) &&
+ !(pThis->m_nState & GDK_WINDOW_STATE_MAXIMIZED))
{
pThis->m_aRestorePosSize = GetPosAndSize(GTK_WINDOW(pThis->m_pWindow));
}
+
+ if ((pEvent->window_state.new_window_state & GDK_WINDOW_STATE_WITHDRAWN) &&
+ !(pThis->m_nState & GDK_WINDOW_STATE_WITHDRAWN))
+ {
+ pThis->WithDrawn();
+ }
+
pThis->m_nState = pEvent->window_state.new_window_state;
#if OSL_DEBUG_LEVEL > 1