diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-07-24 12:22:14 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-07-24 12:28:22 +0100 |
commit | 298c089df77d9afe2cf86bb7a6a8544a0151e8c5 (patch) | |
tree | 177f69ce920698d2fcb813a67e9f95cf4e66b7ed /vcl | |
parent | dcf94ab56d9e5e9864965f56d27045e67b093fa4 (diff) |
gtk3: draw/paint to the fixed container
which fills the toplevel window, rather than directly to the toplevel window.
It makes no difference for X, but for wayland the window decorations are part
of the toplevel window, dropping down a level means we don't draw out menu bar
under the window decoration space
Change-Id: Icec400efacd16b5d901107c13b6fa90c59cad0e6
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/unx/gtk/gtkframe.hxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk/window/gtksalframe.cxx | 35 |
2 files changed, 19 insertions, 18 deletions
diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx index 86cc04f6792c..2e1a5e9be68b 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; + GtkFixed* m_pFixedContainer; GdkWindow* m_pForeignParent; GdkNativeWindow m_aForeignParentWindow; GdkWindow* m_pForeignTopLevel; @@ -180,7 +181,6 @@ class GtkSalFrame : public SalFrame, public X11WindowProvider Pixmap m_hBackgroundPixmap; sal_uLong m_nStyle; SalExtStyle m_nExtStyle; - GtkFixed* m_pFixedContainer; GtkSalFrame* m_pParent; std::list< GtkSalFrame* > m_aChildren; GdkWindowState m_nState; diff --git a/vcl/unx/gtk/window/gtksalframe.cxx b/vcl/unx/gtk/window/gtksalframe.cxx index 6280d3758a99..cf9abac7c8a5 100644 --- a/vcl/unx/gtk/window/gtksalframe.cxx +++ b/vcl/unx/gtk/window/gtksalframe.cxx @@ -415,7 +415,7 @@ void GtkSalFrame::doKeyCallback( guint state, if (keyval == GDK_0) { fprintf( stderr, "force widget_queue_draw\n"); - gtk_widget_queue_draw (m_pWindow); + gtk_widget_queue_draw (m_pFixedContainer); return; } else if (keyval == GDK_1) @@ -1034,12 +1034,25 @@ void GtkSalFrame::updateScreenNumber() void GtkSalFrame::InitCommon() { + // 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) ); + + gtk_widget_set_app_paintable(GTK_WIDGET(m_pFixedContainer), true); + /*non-X11 displays won't show anything at all without double-buffering + enabled*/ + if (GDK_IS_X11_DISPLAY(getGdkDisplay())) + gtk_widget_set_double_buffered(GTK_WIDGET(m_pFixedContainer), false); + gtk_widget_set_redraw_on_allocate(GTK_WIDGET(m_pFixedContainer), false); + + // 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 ); #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_pFixedContainer), "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); @@ -1055,7 +1068,7 @@ void GtkSalFrame::InitCommon() #endif #else - g_signal_connect( G_OBJECT(m_pWindow), "expose-event", G_CALLBACK(signalExpose), this ); + g_signal_connect( G_OBJECT(m_pFixedContainer), "expose-event", G_CALLBACK(signalExpose), this ); #endif g_signal_connect( G_OBJECT(m_pWindow), "focus-in-event", G_CALLBACK(signalFocus), this ); g_signal_connect( G_OBJECT(m_pWindow), "focus-out-event", G_CALLBACK(signalFocus), this ); @@ -1097,24 +1110,12 @@ void GtkSalFrame::InitCommon() m_nAppActionGroupExportId = 0; m_nHudAwarenessId = 0; - gtk_widget_set_app_paintable( m_pWindow, TRUE ); - /*non-X11 displays won't show anything at all without double-buffering - enabled*/ - if (GDK_IS_X11_DISPLAY(getGdkDisplay())) - gtk_widget_set_double_buffered( m_pWindow, FALSE ); - gtk_widget_set_redraw_on_allocate( m_pWindow, FALSE ); - gtk_widget_add_events( m_pWindow, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_VISIBILITY_NOTIFY_MASK | GDK_SCROLL_MASK ); - // 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) ); - // show the widgets gtk_widget_show( GTK_WIDGET(m_pFixedContainer) ); @@ -3646,7 +3647,7 @@ void GtkSalFrame::damaged (const basegfx::B2IBox& rDamageRect) cairo_destroy(cr); } - gtk_widget_queue_draw_area(m_pWindow, + gtk_widget_queue_draw_area(GTK_WIDGET(m_pFixedContainer), rDamageRect.getMinX(), rDamageRect.getMinY(), rDamageRect.getWidth(), @@ -3709,7 +3710,7 @@ void GtkSalFrame::TriggerPaintEvent() SAL_INFO("vcl.gtk3", "force painting" << 0 << "," << 0 << " " << maGeometry.nWidth << "x" << maGeometry.nHeight); SalPaintEvent aPaintEvt(0, 0, maGeometry.nWidth, maGeometry.nHeight, true); CallCallback(SALEVENT_PAINT, &aPaintEvt); - gtk_widget_queue_draw(m_pWindow); + gtk_widget_queue_draw(GTK_WIDGET(m_pFixedContainer)); #endif } |