vcl/inc/unx/gtk/gtkframe.hxx | 3 ++ vcl/unx/gtk/a11y/atkfactory.cxx | 21 ++++++++++++--- vcl/unx/gtk/window/gtksalframe.cxx | 50 +++++++++++++++++++++++++++++++++---- 3 files changed, 65 insertions(+), 9 deletions(-)
New commits: commit 10d2467c2532178efe3d672405839bc1d0aab1e5 Author: Caolán McNamara <caol...@redhat.com> Date: Fri Jul 24 16:53:20 2015 +0100 gtk3: connect to the eventbox and not toplevel for mouse events this leaves whatever magic gtk3 under wayland is doing on the toplevel alone so the window can be resized and the title bar responds to clicks as expected Change-Id: I9952cb719f3148660e17951b4f66a2525e11a6df diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx index 703cfab..411207b 100644 --- a/vcl/inc/unx/gtk/gtkframe.hxx +++ b/vcl/inc/unx/gtk/gtkframe.hxx @@ -335,6 +335,7 @@ public: guint m_nActionGroupExportId; guint m_nAppActionGroupExportId; guint m_nHudAwarenessId; + std::vector<gulong> m_aMouseSignalIds; // dispatches an event, returns true if dispatched // and false else; if true was returned the event should @@ -347,6 +348,7 @@ public: static GdkDisplay* getGdkDisplay(); GtkWidget* getWindow() const { return m_pWindow; } GtkFixed* getFixedContainer() const { return m_pFixedContainer; } + GtkWidget* getMouseEventWidget() const; GdkWindow* getForeignParent() const { return m_pForeignParent; } GdkNativeWindow getForeignParentWindow() const { return m_aForeignParentWindow; } GdkWindow* getForeignTopLevel() const { return m_pForeignTopLevel; } diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx index 5006c61..2439d45 100644 --- a/vcl/unx/gtk/window/gtksalframe.cxx +++ b/vcl/unx/gtk/window/gtksalframe.cxx @@ -894,8 +894,13 @@ GtkSalFrame::~GtkSalFrame() delete m_pIMHandler; + GtkWidget *pEventWidget = getMouseEventWidget(); + for (auto handler_id : m_aMouseSignalIds) + g_signal_handler_disconnect(G_OBJECT(pEventWidget), handler_id); if( m_pFixedContainer ) gtk_widget_destroy( GTK_WIDGET( m_pFixedContainer ) ); + if( m_pEventBox ) + gtk_widget_destroy( GTK_WIDGET(m_pEventBox) ); { SolarMutexGuard aGuard; #if defined ENABLE_GMENU_INTEGRATION @@ -1032,6 +1037,15 @@ void GtkSalFrame::updateScreenNumber() maGeometry.nDisplayScreenNumber = nScreen; } +GtkWidget *GtkSalFrame::getMouseEventWidget() const +{ +#if GTK_CHECK_VERSION(3,0,0) + return GTK_WIDGET(m_pEventBox); +#else + return m_pWindow; +#endif +} + void GtkSalFrame::InitCommon() { #if GTK_CHECK_VERSION(3,0,0) @@ -1052,6 +1066,8 @@ void GtkSalFrame::InitCommon() gtk_container_add( GTK_CONTAINER(m_pWindow), GTK_WIDGET(m_pFixedContainer) ); #endif + GtkWidget *pEventWidget = getMouseEventWidget(); + gtk_widget_set_app_paintable(GTK_WIDGET(m_pFixedContainer), true); /*non-X11 displays won't show anything at all without double-buffering enabled*/ @@ -1062,8 +1078,9 @@ void GtkSalFrame::InitCommon() // connect signals g_signal_connect( G_OBJECT(m_pWindow), "style-set", G_CALLBACK(signalStyleSet), this ); - g_signal_connect( G_OBJECT(m_pWindow), "button-press-event", G_CALLBACK(signalButton), this ); - g_signal_connect( G_OBJECT(m_pWindow), "button-release-event", G_CALLBACK(signalButton), this ); + m_aMouseSignalIds.push_back(g_signal_connect( G_OBJECT(pEventWidget), "button-press-event", G_CALLBACK(signalButton), this )); + m_aMouseSignalIds.push_back(g_signal_connect( G_OBJECT(pEventWidget), "motion-notify-event", G_CALLBACK(signalMotion), this )); + m_aMouseSignalIds.push_back(g_signal_connect( G_OBJECT(pEventWidget), "button-release-event", G_CALLBACK(signalButton), this )); #if GTK_CHECK_VERSION(3,0,0) g_signal_connect( G_OBJECT(m_pFixedContainer), "draw", G_CALLBACK(signalDraw), this ); // g_signal_connect( G_OBJECT(m_pWindow), "state-flags-changed", G_CALLBACK(signalFlagsChanged), this ); @@ -1088,7 +1105,6 @@ void GtkSalFrame::InitCommon() g_signal_connect( G_OBJECT(m_pWindow), "map-event", G_CALLBACK(signalMap), this ); g_signal_connect( G_OBJECT(m_pWindow), "unmap-event", G_CALLBACK(signalUnmap), this ); g_signal_connect( G_OBJECT(m_pWindow), "configure-event", G_CALLBACK(signalConfigure), this ); - g_signal_connect( G_OBJECT(m_pWindow), "motion-notify-event", G_CALLBACK(signalMotion), this ); 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 ); @@ -2789,7 +2805,7 @@ void GtkSalFrame::grabPointer( bool bGrab, bool bOwnerEvents ) GdkDeviceManager* pDeviceManager = gdk_display_get_device_manager(getGdkDisplay()); GdkDevice* pPointer = gdk_device_manager_get_client_pointer(pDeviceManager); if (bGrab) - gdk_device_grab(pPointer, widget_get_window(m_pWindow), GDK_OWNERSHIP_NONE, bOwnerEvents, (GdkEventMask) nMask, m_pCurrentCursor, GDK_CURRENT_TIME); + gdk_device_grab(pPointer, widget_get_window(getMouseEventWidget()), GDK_OWNERSHIP_NONE, bOwnerEvents, (GdkEventMask) nMask, m_pCurrentCursor, GDK_CURRENT_TIME); else gdk_device_ungrab(pPointer, GDK_CURRENT_TIME); #else @@ -3202,6 +3218,10 @@ void GtkSalFrame::createNewWindow( ::Window aNewParent, bool bXEmbed, SalX11Scre { gdk_region_destroy( m_pRegion ); } + + GtkWidget *pEventWidget = getMouseEventWidget(); + for (auto handler_id : m_aMouseSignalIds) + g_signal_handler_disconnect(G_OBJECT(pEventWidget), handler_id); if( m_pFixedContainer ) gtk_widget_destroy( GTK_WIDGET(m_pFixedContainer) ); if( m_pEventBox ) commit 2796d7f1723d5b45177fe6da7a6e66cb914ae6d2 Author: Caolán McNamara <caol...@redhat.com> Date: Fri Jul 24 16:34:41 2015 +0100 gtk3: insert an event box between toplevel and contents Change-Id: Ic78aa62baaa4260645a80ffb6704103440339595 diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx index 2e1a5e9..703cfab 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 b6beda5..63b33c9 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 cf9abac..5006c61 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(); }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits