[Libreoffice-commits] core.git: vcl/inc vcl/unx
Caolán McNamara
caolanm at redhat.com
Tue Jun 30 00:59:29 PDT 2015
vcl/inc/unx/gtk/gtkframe.hxx | 3 ++-
vcl/unx/gtk/window/gtksalframe.cxx | 23 +++++++++++++++++++++--
2 files changed, 23 insertions(+), 3 deletions(-)
New commits:
commit 02b1e14743fa48b365f80e76ecb713877c990c34
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jun 30 08:58:04 2015 +0100
gtk3: listen to state-flags-changed and disable toplevels when in backdrop
Change-Id: I173618b2e6a2ad69918da8b85ec0eef7099f1d3d
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx
index 5086d14..86cc04f 100644
--- a/vcl/inc/unx/gtk/gtkframe.hxx
+++ b/vcl/inc/unx/gtk/gtkframe.hxx
@@ -238,6 +238,7 @@ class GtkSalFrame : public SalFrame, public X11WindowProvider
static void signalStyleSet( GtkWidget*, GtkStyle* pPrevious, gpointer );
#if GTK_CHECK_VERSION(3,0,0)
static gboolean signalDraw( GtkWidget*, cairo_t *cr, gpointer );
+ static void signalFlagsChanged( GtkWidget*, GtkStateFlags, gpointer );
#if GTK_CHECK_VERSION(3,14,0)
static void gestureSwipe(GtkGestureSwipe* gesture, gdouble velocity_x, gdouble velocity_y, gpointer frame);
static void gestureLongPress(GtkGestureLongPress* gesture, gpointer frame);
@@ -252,7 +253,7 @@ class GtkSalFrame : public SalFrame, public X11WindowProvider
static gboolean signalMotion( GtkWidget*, GdkEventMotion*, gpointer );
static gboolean signalKey( GtkWidget*, GdkEventKey*, gpointer );
static gboolean signalDelete( GtkWidget*, GdkEvent*, gpointer );
- static gboolean signalState( GtkWidget*, GdkEvent*, gpointer );
+ static gboolean signalWindowState( GtkWidget*, GdkEvent*, gpointer );
static gboolean signalScroll( GtkWidget*, GdkEvent*, gpointer );
static gboolean signalCrossing( GtkWidget*, GdkEventCrossing*, gpointer );
static gboolean signalVisibility( GtkWidget*, GdkEventVisibility*, gpointer );
diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx
index d9d57af..f6ef61a 100644
--- a/vcl/unx/gtk/window/gtksalframe.cxx
+++ b/vcl/unx/gtk/window/gtksalframe.cxx
@@ -1035,6 +1035,7 @@ void GtkSalFrame::InitCommon()
g_signal_connect( G_OBJECT(m_pWindow), "button-release-event", G_CALLBACK(signalButton), this );
#if GTK_CHECK_VERSION(3,0,0)
g_signal_connect( G_OBJECT(m_pWindow), "draw", G_CALLBACK(signalDraw), this );
+ g_signal_connect( G_OBJECT(m_pWindow), "state-flags-changed", G_CALLBACK(signalFlagsChanged), this );
#if GTK_CHECK_VERSION(3,14,0)
GtkGesture *pSwipe = gtk_gesture_swipe_new(m_pWindow);
g_signal_connect(pSwipe, "swipe", G_CALLBACK(gestureSwipe), this);
@@ -1060,7 +1061,7 @@ void GtkSalFrame::InitCommon()
g_signal_connect( G_OBJECT(m_pWindow), "key-press-event", G_CALLBACK(signalKey), this );
g_signal_connect( G_OBJECT(m_pWindow), "key-release-event", G_CALLBACK(signalKey), this );
g_signal_connect( G_OBJECT(m_pWindow), "delete-event", G_CALLBACK(signalDelete), this );
- g_signal_connect( G_OBJECT(m_pWindow), "window-state-event", G_CALLBACK(signalState), this );
+ g_signal_connect( G_OBJECT(m_pWindow), "window-state-event", G_CALLBACK(signalWindowState), this );
g_signal_connect( G_OBJECT(m_pWindow), "scroll-event", G_CALLBACK(signalScroll), this );
g_signal_connect( G_OBJECT(m_pWindow), "leave-notify-event", G_CALLBACK(signalCrossing), this );
g_signal_connect( G_OBJECT(m_pWindow), "enter-notify-event", G_CALLBACK(signalCrossing), this );
@@ -3442,6 +3443,24 @@ gboolean GtkSalFrame::signalButton( GtkWidget*, GdkEventButton* pEvent, gpointer
return true;
}
+#if GTK_CHECK_VERSION(3,0,0)
+void GtkSalFrame::signalFlagsChanged( GtkWidget* , GtkStateFlags state, gpointer frame )
+{
+ GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
+
+ bool bOldBackDrop = state & GTK_STATE_FLAG_BACKDROP;
+ bool bNewBackDrop = (gtk_widget_get_state_flags(GTK_WIDGET(pThis->m_pWindow)) & GTK_STATE_FLAG_BACKDROP);
+ if (bNewBackDrop && !bOldBackDrop)
+ {
+ pThis->GetWindow()->Disable();
+ }
+ else if (bOldBackDrop && !bNewBackDrop)
+ {
+ pThis->GetWindow()->Enable();
+ }
+}
+#endif
+
gboolean GtkSalFrame::signalScroll( GtkWidget*, GdkEvent* pEvent, gpointer frame )
{
GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
@@ -4047,7 +4066,7 @@ void GtkSalFrame::signalStyleSet( GtkWidget*, GtkStyle* pPrevious, gpointer fram
#endif
}
-gboolean GtkSalFrame::signalState( GtkWidget*, GdkEvent* pEvent, gpointer frame )
+gboolean GtkSalFrame::signalWindowState( GtkWidget*, GdkEvent* pEvent, gpointer frame )
{
GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame);
if( (pThis->m_nState & GDK_WINDOW_STATE_ICONIFIED) != (pEvent->window_state.new_window_state & GDK_WINDOW_STATE_ICONIFIED ) )
More information about the Libreoffice-commits
mailing list