[Libreoffice-commits] core.git: vcl/unx

Caolán McNamara caolanm at redhat.com
Wed Sep 7 19:19:43 UTC 2016


 vcl/unx/gtk/gtksalframe.cxx          |   47 ++++-------------------------------
 vcl/unx/gtk/salnativewidgets-gtk.cxx |    7 +----
 2 files changed, 8 insertions(+), 46 deletions(-)

New commits:
commit e928e2daa3a8a9ad5d8ee7bf5982b41ec9cc6344
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Sep 7 13:37:06 2016 +0100

    less dlopen, call gtk2 things direct, baseline is newer now
    
    Change-Id: Iff385fe836f8e959fb8b16aa76603b490bc44d9f
    Reviewed-on: https://gerrit.libreoffice.org/28719
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx
index bb55677..9bf46e3 100644
--- a/vcl/unx/gtk/gtksalframe.cxx
+++ b/vcl/unx/gtk/gtksalframe.cxx
@@ -1048,33 +1048,10 @@ void GtkSalFrame::InitCommon()
                                 None );
 }
 
-/*  Sadly gtk_window_set_accept_focus exists only since gtk 2.4
- *  for achieving the same effect we will remove the WM_TAKE_FOCUS
- *  protocol from the window and set the input hint to false.
- *  But gtk_window_set_accept_focus needs to be called before
- *  window realization whereas the removal obviously can only happen
- *  after realization.
- */
-
-extern "C" {
-    typedef void(*setAcceptFn)( GtkWindow*, gboolean );
-    static setAcceptFn p_gtk_window_set_accept_focus = nullptr;
-    static bool bGetAcceptFocusFn = true;
-
-    typedef void(*setUserTimeFn)( GdkWindow*, guint32 );
-    static setUserTimeFn p_gdk_x11_window_set_user_time = nullptr;
-    static bool bGetSetUserTimeFn = true;
-}
-
 static void lcl_set_accept_focus( GtkWindow* pWindow, gboolean bAccept, bool bBeforeRealize )
 {
-    if( bGetAcceptFocusFn )
-    {
-        bGetAcceptFocusFn = false;
-        p_gtk_window_set_accept_focus = reinterpret_cast<setAcceptFn>(osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gtk_window_set_accept_focus" ));
-    }
-    if( p_gtk_window_set_accept_focus && bBeforeRealize )
-        p_gtk_window_set_accept_focus( pWindow, bAccept );
+    if (bBeforeRealize)
+        gtk_window_set_accept_focus( pWindow, bAccept );
     else if( ! bBeforeRealize )
     {
         Display* pDisplay = GetGtkSalData()->GetGtkDisplay()->GetDisplay();
@@ -1130,22 +1107,10 @@ static void lcl_set_accept_focus( GtkWindow* pWindow, gboolean bAccept, bool bBe
 
 static void lcl_set_user_time( GtkWindow* i_pWindow, guint32 i_nTime )
 {
-    if( bGetSetUserTimeFn )
-    {
-        bGetSetUserTimeFn = false;
-        p_gdk_x11_window_set_user_time = reinterpret_cast<setUserTimeFn>(osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "gdk_x11_window_set_user_time" ));
-    }
-    bool bSet = false;
-    if( p_gdk_x11_window_set_user_time )
-    {
-        GdkWindow* pWin = widget_get_window(GTK_WIDGET(i_pWindow));
-        if( pWin ) // only if the window is realized.
-        {
-            p_gdk_x11_window_set_user_time( pWin, i_nTime );
-            bSet = true;
-        }
-    }
-    if( !bSet )
+    GdkWindow* pWin = widget_get_window(GTK_WIDGET(i_pWindow));
+    if (pWin) // only if the window is realized.
+        gdk_x11_window_set_user_time( pWin, i_nTime );
+    else
     {
         Display* pDisplay = GetGtkSalData()->GetGtkDisplay()->GetDisplay();
         Atom nUserTime = XInternAtom( pDisplay, "_NET_WM_USER_TIME", True );
diff --git a/vcl/unx/gtk/salnativewidgets-gtk.cxx b/vcl/unx/gtk/salnativewidgets-gtk.cxx
index b5810a8..813d5a5 100644
--- a/vcl/unx/gtk/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/salnativewidgets-gtk.cxx
@@ -4113,11 +4113,8 @@ void GtkSalGraphics::updateSettings( AllSettings& rSettings )
 #endif
 
     sal_Int32 nDispDPIY = GetDisplay()->GetResolution().B();
-    int nPointHeight = 0;
-    static gboolean(*pAbso)(const PangoFontDescription*) =
-        reinterpret_cast<gboolean(*)(const PangoFontDescription*)>(osl_getAsciiFunctionSymbol( GetSalData()->m_pPlugin, "pango_font_description_get_size_is_absolute" ));
-
-    if( pAbso && pAbso( pStyle->font_desc ) )
+    int nPointHeight;
+    if (pango_font_description_get_size_is_absolute(pStyle->font_desc))
         nPointHeight = (nPangoHeight * 72 + nDispDPIY*PANGO_SCALE/2) / (nDispDPIY * PANGO_SCALE);
     else
         nPointHeight = nPangoHeight/PANGO_SCALE;


More information about the Libreoffice-commits mailing list