diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-07-24 16:34:41 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-07-24 18:27:28 +0100 |
commit | 2796d7f1723d5b45177fe6da7a6e66cb914ae6d2 (patch) | |
tree | 8435428970c165714968e570bf4037675fe316e8 /vcl | |
parent | f790fbfb3e422b50fdb3cb607048939faef98149 (diff) |
gtk3: insert an event box between toplevel and contents
Change-Id: Ic78aa62baaa4260645a80ffb6704103440339595
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/unx/gtk/gtkframe.hxx | 1 | ||||
-rw-r--r-- | vcl/unx/gtk/a11y/atkfactory.cxx | 21 | ||||
-rw-r--r-- | vcl/unx/gtk/window/gtksalframe.cxx | 22 |
3 files changed, 39 insertions, 5 deletions
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx index 2e1a5e9be68b..703cfab1d957 100644 --- a/vcl/inc/unx/gtk/gtkframe.hxx +++ b/vcl/inc/unx/gtk/gtkframe.hxx @@ -173,6 +173,7 @@ class GtkSalFrame : public SalFrame, public X11WindowProvider SalX11Screen m_nXScreen; GtkWidget* m_pWindow; + GtkEventBox* m_pEventBox; GtkFixed* m_pFixedContainer; GdkWindow* m_pForeignParent; GdkNativeWindow m_aForeignParentWindow; diff --git a/vcl/unx/gtk/a11y/atkfactory.cxx b/vcl/unx/gtk/a11y/atkfactory.cxx index b6beda5a29ad..63b33c904117 100644 --- a/vcl/unx/gtk/a11y/atkfactory.cxx +++ b/vcl/unx/gtk/a11y/atkfactory.cxx @@ -101,14 +101,27 @@ wrapper_factory_get_accessible_type() static AtkObject* wrapper_factory_create_accessible( GObject *obj ) { - GtkWidget* parent_widget = gtk_widget_get_parent( GTK_WIDGET( obj ) ); +#if GTK_CHECK_VERSION(3,0,0) + GtkWidget* pEventBox = gtk_widget_get_parent(GTK_WIDGET(obj)); // gail_container_real_remove_gtk tries to re-instanciate an accessible // for a widget that is about to vanish .. - if( ! parent_widget ) + if (!pEventBox) return atk_noop_object_wrapper_new(); - GtkSalFrame* pFrame = GtkSalFrame::getFromWindow( GTK_WINDOW( parent_widget ) ); + GtkWidget* pTopLevel = gtk_widget_get_parent(pEventBox); + if (!pTopLevel) + return atk_noop_object_wrapper_new(); +#else + GtkWidget* pTopLevel = gtk_widget_get_parent(GTK_WIDGET(obj)); + + // gail_container_real_remove_gtk tries to re-instanciate an accessible + // for a widget that is about to vanish .. + if (!pTopLevel) + return atk_noop_object_wrapper_new(); +#endif + + GtkSalFrame* pFrame = GtkSalFrame::getFromWindow(GTK_WINDOW(pTopLevel)); g_return_val_if_fail( pFrame != NULL, NULL ); vcl::Window* pFrameWindow = pFrame->GetWindow(); @@ -130,7 +143,7 @@ wrapper_factory_create_accessible( GObject *obj ) if( accessible ) g_object_ref( G_OBJECT(accessible) ); else - accessible = atk_object_wrapper_new( xAccessible, gtk_widget_get_accessible(parent_widget) ); + accessible = atk_object_wrapper_new( xAccessible, gtk_widget_get_accessible(pTopLevel) ); return accessible; } diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx index cf9abac7c8a5..5006c6105c1f 100644 --- a/vcl/unx/gtk/window/gtksalframe.cxx +++ b/vcl/unx/gtk/window/gtksalframe.cxx @@ -1034,10 +1034,23 @@ void GtkSalFrame::updateScreenNumber() void GtkSalFrame::InitCommon() { +#if GTK_CHECK_VERSION(3,0,0) + m_pEventBox = GTK_EVENT_BOX(gtk_event_box_new()); + gtk_widget_add_events( GTK_WIDGET(m_pEventBox), + GDK_ALL_EVENTS_MASK ); + gtk_container_add( GTK_CONTAINER(m_pWindow), GTK_WIDGET(m_pEventBox) ); + + // add the fixed container child, + // fixed is needed since we have to position plugin windows + m_pFixedContainer = GTK_FIXED(g_object_new( ooo_fixed_get_type(), NULL )); + gtk_container_add( GTK_CONTAINER(m_pEventBox), GTK_WIDGET(m_pFixedContainer) ); +#else + m_pEventBox = 0; // add the fixed container child, // fixed is needed since we have to position plugin windows m_pFixedContainer = GTK_FIXED(g_object_new( ooo_fixed_get_type(), NULL )); gtk_container_add( GTK_CONTAINER(m_pWindow), GTK_WIDGET(m_pFixedContainer) ); +#endif gtk_widget_set_app_paintable(GTK_WIDGET(m_pFixedContainer), true); /*non-X11 displays won't show anything at all without double-buffering @@ -1117,7 +1130,11 @@ void GtkSalFrame::InitCommon() ); // show the widgets - gtk_widget_show( GTK_WIDGET(m_pFixedContainer) ); +#if GTK_CHECK_VERSION(3,0,0) + gtk_widget_show_all( GTK_WIDGET(m_pEventBox) ); +#else + gtk_widget_show_all( GTK_WIDGET(m_pFixedContainer) ); +#endif // realize the window, we need an XWindow id gtk_widget_realize( m_pWindow ); @@ -3187,6 +3204,8 @@ void GtkSalFrame::createNewWindow( ::Window aNewParent, bool bXEmbed, SalX11Scre } if( m_pFixedContainer ) gtk_widget_destroy( GTK_WIDGET(m_pFixedContainer) ); + if( m_pEventBox ) + gtk_widget_destroy( GTK_WIDGET(m_pEventBox) ); if( m_pWindow ) gtk_widget_destroy( m_pWindow ); if( m_pForeignParent ) @@ -4135,6 +4154,7 @@ void GtkSalFrame::signalDestroy( GtkWidget* pObj, gpointer frame ) if( pObj == pThis->m_pWindow ) { pThis->m_pFixedContainer = NULL; + pThis->m_pEventBox = NULL; pThis->m_pWindow = NULL; pThis->InvalidateGraphics(); } |