From 265829dd1a0fb6bd271f3661803645bd42e0ce39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Fri, 16 Sep 2016 11:19:52 +0100 Subject: [PATCH] Resolves: rhbz#1373933 gtk 3.21 emits a lot more "style-set" signals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit also deb#837356 since gtk3 commit of... commit 0f116135f4a5033ce4e9dfa19f10624701fa615c Author: Matthias Clasen Date: Fri May 6 10:12:14 2016 -0400 Avoid emitting ::style-set by name GtkStyle is deprecated, but we still emit ::style-set quite a bit, so lets at least not be slow while doing it. docs say... 'GtkWidget::style-set has been deprecated since version 3.0 and should not be used in newly-written code. Use the “style-updated” signal' and this code just came over from gtk2 without any thought about it at the time, so change it over to the "style-updated" which makes everything happy again Change-Id: I9e920d2fb2d820ff1b1b5a9ecb228484df3d6146 (cherry picked from commit ef7abe81df10cb8a8c04afbb1fbe700f94e73f04) --- vcl/inc/unx/gtk/gtkframe.hxx | 6 +++++- vcl/unx/gtk3/gtk3gtkframe.cxx | 19 +++++-------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx index 2b5dc55..1b48aa3 100644 --- a/vcl/inc/unx/gtk/gtkframe.hxx +++ b/vcl/inc/unx/gtk/gtkframe.hxx @@ -242,7 +242,11 @@ class GtkSalFrame : public SalFrame // signals static gboolean signalButton( GtkWidget*, GdkEventButton*, gpointer ); - static void signalStyleSet( GtkWidget*, GtkStyle* pPrevious, gpointer ); +#if GTK_CHECK_VERSION(3,0,0) + static void signalStyleUpdated(GtkWidget*, gpointer); +#else + static void signalStyleSet(GtkWidget*, GtkStyle* pPrevious, gpointer); +#endif #if GTK_CHECK_VERSION(3,0,0) static gboolean signalDraw( GtkWidget*, cairo_t *cr, gpointer ); static void sizeAllocated(GtkWidget*, GdkRectangle *pAllocation, gpointer frame); diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx index 9ea6237..1eba8e2 100644 --- a/vcl/unx/gtk3/gtk3gtkframe.cxx +++ b/vcl/unx/gtk3/gtk3gtkframe.cxx @@ -993,7 +993,7 @@ 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), "style-updated", G_CALLBACK(signalStyleUpdated), this ); gtk_widget_set_has_tooltip(pEventWidget, true); m_aMouseSignalIds.push_back(g_signal_connect( G_OBJECT(pEventWidget), "query-tooltip", G_CALLBACK(signalTooltipQuery), this )); m_aMouseSignalIds.push_back(g_signal_connect( G_OBJECT(pEventWidget), "button-press-event", G_CALLBACK(signalButton), this )); @@ -3145,22 +3145,13 @@ gboolean GtkSalFrame::signalDelete( GtkWidget*, GdkEvent*, gpointer frame ) return true; } -void GtkSalFrame::signalStyleSet( GtkWidget*, GtkStyle* pPrevious, gpointer frame ) +void GtkSalFrame::signalStyleUpdated(GtkWidget*, gpointer frame) { GtkSalFrame* pThis = static_cast(frame); - // every frame gets an initial style set on creation - // do not post these as the whole application tends to - // redraw itself to adjust to the new style - // where there IS no new style resulting in tremendous unnecessary flickering - if( pPrevious != nullptr ) - { - // signalStyleSet does NOT usually have the gdk lock - // so post user event to safely dispatch the SalEvent::SettingsChanged - // note: settings changed for multiple frames is avoided in winproc.cxx ImplHandleSettings - GtkSalFrame::getDisplay()->SendInternalEvent( pThis, nullptr, SalEvent::SettingsChanged ); - GtkSalFrame::getDisplay()->SendInternalEvent( pThis, nullptr, SalEvent::FontChanged ); - } + // note: settings changed for multiple frames is avoided in winproc.cxx ImplHandleSettings + GtkSalFrame::getDisplay()->SendInternalEvent( pThis, nullptr, SalEvent::SettingsChanged ); + GtkSalFrame::getDisplay()->SendInternalEvent( pThis, nullptr, SalEvent::FontChanged ); } gboolean GtkSalFrame::signalWindowState( GtkWidget*, GdkEvent* pEvent, gpointer frame ) -- 2.7.4