[Xfce4-commits] [xfce/xfwm4] 21/32: Fix remaining deprecations

noreply at xfce.org noreply at xfce.org
Tue Dec 5 09:22:07 CET 2017


This is an automated email from the git hooks/post-receive script.

o   l   i   v   i   e   r       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfwm4.

commit 09caed9efba94d1eeb898350b6ccca9e0860f38a
Author: Viktor Odintsev <zakhams at gmail.com>
Date:   Tue Jul 4 02:03:46 2017 +0300

    Fix remaining deprecations
---
 src/frame.c     |  1 +
 src/hints.c     |  5 +++--
 src/menu.c      |  6 +++++-
 src/placement.c |  3 ---
 src/screen.c    | 22 ++++++++++++++++++++--
 src/screen.h    |  4 +++-
 src/settings.c  | 17 ++++++++---------
 7 files changed, 40 insertions(+), 18 deletions(-)

diff --git a/src/frame.c b/src/frame.c
index 19e5712..b5a917f 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -443,6 +443,7 @@ frameCreateTitlePixmap (Client * c, int state, int left, int right, xfwmPixmap *
     }
 
     layout = gtk_widget_create_pango_layout (myScreenGetGtkWidget (screen_info), c->name);
+    pango_layout_set_font_description (layout, myScreenGetFontDescription (screen_info));
     pango_layout_set_auto_dir (layout, FALSE);
     pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
 
diff --git a/src/hints.c b/src/hints.c
index 1dce39c..c86e28c 100644
--- a/src/hints.c
+++ b/src/hints.c
@@ -652,8 +652,9 @@ text_property_to_utf8 (DisplayInfo *display_info, const XTextProperty * prop)
     TRACE ("entering text_property_to_utf8");
 
     list = NULL;
-    count = gdk_text_property_to_utf8_list (gdk_x11_xatom_to_atom (prop->encoding),
-                                            prop->format, prop->value, prop->nitems, &list);
+    count = gdk_text_property_to_utf8_list_for_display (display_info->gdisplay,
+                                                        gdk_x11_xatom_to_atom (prop->encoding),
+                                                        prop->format, prop->value, prop->nitems, &list);
     if (count == 0)
     {
         TRACE ("gdk_text_property_to_utf8_list returned 0");
diff --git a/src/menu.c b/src/menu.c
index 04f20b4..c31d564 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -112,7 +112,7 @@ popup_position_func (GtkMenu * menu, gint * x, gint * y, gboolean * push_in,
 
     pos = user_data;
 
-    gtk_widget_size_request (GTK_WIDGET (menu), &req);
+    gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL, &req);
 
     xfwm_get_screen_dimensions (&width, &height);
 
@@ -291,12 +291,16 @@ menu_default (GdkScreen *gscr, Window xid, MenuOp ops, MenuOp insensitive, MenuF
                 default:
                     if (menuitems[i].image_name)
                     {
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
                         menuitem = gtk_image_menu_item_new_with_mnemonic (label);
+G_GNUC_END_IGNORE_DEPRECATIONS
                         image =
                             gtk_image_new_from_icon_name (menuitems[i].image_name,
                             GTK_ICON_SIZE_MENU);
                         gtk_widget_show (image);
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
                         gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menuitem), image);
+G_GNUC_END_IGNORE_DEPRECATIONS
                     }
                     else
                     {
diff --git a/src/placement.c b/src/placement.c
index d679bf8..a265229 100644
--- a/src/placement.c
+++ b/src/placement.c
@@ -473,7 +473,6 @@ clientConstrainPos (Client * c, gboolean show_full)
 static void
 clientKeepVisible (Client * c, gint n_monitors, GdkRectangle *monitor_rect)
 {
-    ScreenInfo *screen_info;
     gboolean centered;
     int diff_x, diff_y;
 
@@ -481,8 +480,6 @@ clientKeepVisible (Client * c, gint n_monitors, GdkRectangle *monitor_rect)
     TRACE ("entering clientKeepVisible");
     TRACE ("client \"%s\" (0x%lx)", c->name, c->window);
 
-    screen_info = c->screen_info;
-
     centered = FALSE;
     /* We only center dialogs */
     if (c->type & (WINDOW_TYPE_DIALOG))
diff --git a/src/screen.c b/src/screen.c
index 9077260..02ce61d 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -305,6 +305,7 @@ myScreenInit (DisplayInfo *display_info, GdkScreen *gscr, unsigned long event_ma
 #endif
 
     screen_info->font_height = 0;
+    screen_info->font_desc = NULL;
     screen_info->box_gc = None;
 
     for (i = 0; i < SIDE_COUNT; i++)
@@ -842,6 +843,23 @@ myScreenGetXineramaMonitorGeometry (ScreenInfo *screen_info, gint monitor_num, G
     XFree (infos);
 }
 
+PangoFontDescription *
+myScreenGetFontDescription (ScreenInfo *screen_info)
+{
+    GtkWidget *widget;
+
+    g_return_val_if_fail (screen_info != NULL, FALSE);
+    TRACE ("entering myScreenGetFontDescription");
+
+    if (screen_info->font_desc != NULL)
+    {
+        return screen_info->font_desc;
+    }
+
+    widget = myScreenGetGtkWidget (screen_info);
+    return getUIPangoFontDesc (widget);
+}
+
 gboolean
 myScreenUpdateFontHeight (ScreenInfo *screen_info)
 {
@@ -854,10 +872,10 @@ myScreenUpdateFontHeight (ScreenInfo *screen_info)
     TRACE ("entering myScreenUpdateFontHeight");
 
     widget = myScreenGetGtkWidget (screen_info);
+    desc = myScreenGetFontDescription (screen_info);
     context = getUIPangoContext (widget);
-    desc = getUIPangoFontDesc (widget);
 
-    if (desc && context)
+    if (desc != NULL && context != NULL)
     {
         metrics = pango_context_get_metrics (context, desc, NULL);
         screen_info->font_height =
diff --git a/src/screen.h b/src/screen.h
index 87256d4..5bb7905 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -97,8 +97,9 @@ struct _ScreenInfo
     /* Per screen graphic contexts */
     GC box_gc;
 
-    /* Title font height */
+    /* Title font */
     gint font_height;
+    PangoFontDescription *font_desc;
 
     /* Screen data */
     Colormap cmap;
@@ -268,6 +269,7 @@ void                     myScreenFindMonitorAtPoint             (ScreenInfo *,
                                                                  gint,
                                                                  gint,
                                                                  GdkRectangle *);
+PangoFontDescription *   myScreenGetFontDescription             (ScreenInfo *);
 gboolean                 myScreenUpdateFontHeight               (ScreenInfo *);
 void                     myScreenGetXineramaMonitorGeometry     (ScreenInfo *,
                                                                  gint,
diff --git a/src/settings.c b/src/settings.c
index 5b1be4c..e028427 100644
--- a/src/settings.c
+++ b/src/settings.c
@@ -367,13 +367,11 @@ loadTheme (ScreenInfo *screen_info, Settings *rc)
     GtkWidget *widget;
     gchar *theme;
     const gchar *font;
-    PangoFontDescription *desc;
     guint i, j;
 
     widget = myScreenGetGtkWidget (screen_info);
     display_info = screen_info->display_info;
 
-    desc = NULL;
     i = 0;
 
     /* Load gtk theme colors first */
@@ -451,14 +449,9 @@ loadTheme (ScreenInfo *screen_info, Settings *rc)
     font = getStringValue ("title_font", rc);
     if (font && strlen (font))
     {
-        desc = pango_font_description_from_string (font);
-        if (desc)
-        {
-            gtk_widget_modify_font (widget, desc);
-            pango_font_description_free (desc);
-            myScreenUpdateFontHeight (screen_info);
-        }
+        screen_info->font_desc = pango_font_description_from_string (font);
     }
+    myScreenUpdateFontHeight (screen_info);
 
     gdk_rgba_parse (&screen_info->title_colors[ACTIVE], getStringValue ("active_text_color", rc));
     gdk_rgba_parse (&screen_info->title_colors[INACTIVE], getStringValue ("inactive_text_color", rc));
@@ -895,6 +888,12 @@ unloadTheme (ScreenInfo *screen_info)
 
     TRACE ("entering unloadTheme");
 
+    if (screen_info->font_desc != NULL)
+    {
+        pango_font_description_free (screen_info->font_desc);
+        screen_info->font_desc = NULL;
+    }
+
     for (i = 0; i < SIDE_COUNT; i++)
     {
         xfwmPixmapFree (&screen_info->sides[i][ACTIVE]);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list