[Pkg-xfce-commits] r8400 - in /goodies/branches/experimental/xfce4-xkb-plugin/debian: changelog patches/01-font_selection.patch patches/series

Jackson Doak noskcaj-guest at moszumanska.debian.org
Wed Apr 9 22:10:18 UTC 2014


Author: noskcaj-guest
Date: Wed Apr  9 22:10:18 2014
New Revision: 8400

URL: http://svn.debian.org/wsvn/pkg-xfce/?sc=1&rev=8400
Log:
* debian/patches/:
  - Add 01-font-selection.patch. Closes: #576072 LP: #733563
    + Makes the xkb plugin change font with the rest of the system

Added:
    goodies/branches/experimental/xfce4-xkb-plugin/debian/patches/01-font_selection.patch
    goodies/branches/experimental/xfce4-xkb-plugin/debian/patches/series
Modified:
    goodies/branches/experimental/xfce4-xkb-plugin/debian/changelog

Modified: goodies/branches/experimental/xfce4-xkb-plugin/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-xfce/goodies/branches/experimental/xfce4-xkb-plugin/debian/changelog?rev=8400&op=diff
==============================================================================
--- goodies/branches/experimental/xfce4-xkb-plugin/debian/changelog	(original)
+++ goodies/branches/experimental/xfce4-xkb-plugin/debian/changelog	Wed Apr  9 22:10:18 2014
@@ -6,6 +6,9 @@
   [ Jackson Doak ]
   * New upstream release
   * debian/watch: Track all versions
+  * debian/patches/:
+    - Add 01-font-selection.patch. Closes: #576072 LP: #733563
+      + Makes the xkb plugin change font with the rest of the system
 
  -- Jackson Doak <noskcaj at ubuntu.com>  Thu, 10 Apr 2014 07:57:58 +1000
 

Added: goodies/branches/experimental/xfce4-xkb-plugin/debian/patches/01-font_selection.patch
URL: http://svn.debian.org/wsvn/pkg-xfce/goodies/branches/experimental/xfce4-xkb-plugin/debian/patches/01-font_selection.patch?rev=8400&op=file
==============================================================================
--- goodies/branches/experimental/xfce4-xkb-plugin/debian/patches/01-font_selection.patch	(added)
+++ goodies/branches/experimental/xfce4-xkb-plugin/debian/patches/01-font_selection.patch	Wed Apr  9 22:10:18 2014
@@ -0,0 +1,286 @@
+Author: Ivan Frederiks <idfred at gmail.com>
+Date: Thu, 26 Sep 2013 14:49:02 +0400
+Description: Changed text size selection to full-featured font selection
+ Makes the xkb plugin change font with the rest of the system
+Bug: https://bugzilla.xfce.org/show_bug.cgi?id=8446
+Bug-Debian: http://bugs.debian.org/576072
+Bug-Ubuntu: https://launchpad.net/bugs/733563
+
+---
+ panel-plugin/xfce4-xkb-plugin.c    |    7 +++--
+ panel-plugin/xfce4-xkb-plugin.h    |    9 +------
+ panel-plugin/xkb-cairo.c           |   33 ++++---------------------
+ panel-plugin/xkb-cairo.h           |    4 +--
+ panel-plugin/xkb-callbacks.c       |    4 +--
+ panel-plugin/xkb-settings-dialog.c |   47 +++++++++++++++++++++++++------------
+ 6 files changed, 48 insertions(+), 56 deletions(-)
+
+--- a/panel-plugin/xfce4-xkb-plugin.c
++++ b/panel-plugin/xfce4-xkb-plugin.c
+@@ -262,6 +262,7 @@ xkb_free (t_xkb *xkb)
+     gtk_widget_destroy (xkb->layout_image);
+     gtk_widget_destroy (xkb->btn);
+     xkb_destroy_popup_menu (xkb);
++    g_free (xkb->display_font);
+ 
+     panel_slice_free (t_xkb, xkb);
+ }
+@@ -288,7 +289,7 @@ xfce_xkb_save_config (XfcePanelPlugin *p
+     xfce_rc_set_group (rcfile, NULL);
+ 
+     xfce_rc_write_int_entry (rcfile, "display_type", xkb->display_type);
+-    xfce_rc_write_int_entry (rcfile, "display_textsize", xkb->display_textsize);
++    xfce_rc_write_entry (rcfile, "display_font", xkb->display_font);
+     xfce_rc_write_int_entry (rcfile, "group_policy", xkb->group_policy);
+ 
+     xfce_rc_close (rcfile);
+@@ -304,7 +305,7 @@ xkb_load_config (t_xkb *xkb, const gchar
+         xfce_rc_set_group (rcfile, NULL);
+ 
+         xkb->display_type = xfce_rc_read_int_entry (rcfile, "display_type", DISPLAY_TYPE_IMAGE);
+-        xkb->display_textsize = xfce_rc_read_int_entry (rcfile, "display_textsize", DISPLAY_TEXTSIZE_LARGE);
++        xkb->display_font = g_strdup(xfce_rc_read_entry (rcfile, "display_font", XKB_PREFERRED_FONT));
+         xkb->group_policy = xfce_rc_read_int_entry (rcfile, "group_policy", GROUP_POLICY_PER_APPLICATION);
+ 
+         xfce_rc_close (rcfile);
+@@ -319,7 +320,7 @@ static void
+ xkb_load_default (t_xkb *xkb)
+ {
+     xkb->display_type = DISPLAY_TYPE_IMAGE;
+-    xkb->display_textsize = DISPLAY_TEXTSIZE_LARGE;
++    xkb->display_font = g_strdup(XKB_PREFERRED_FONT);
+     xkb->group_policy = GROUP_POLICY_PER_APPLICATION;
+ }
+ 
+--- a/panel-plugin/xfce4-xkb-plugin.h
++++ b/panel-plugin/xfce4-xkb-plugin.h
+@@ -42,12 +42,7 @@ typedef enum
+     DISPLAY_TYPE_TEXT = 1
+ } t_display_type;
+ 
+-typedef enum
+-{
+-    DISPLAY_TEXTSIZE_SMALL = 0,
+-    DISPLAY_TEXTSIZE_MEDIUM = 1,
+-    DISPLAY_TEXTSIZE_LARGE = 2
+-} t_display_textsize;
++#define XKB_PREFERRED_FONT "Monospace Bold 16"
+ 
+ typedef struct
+ {
+@@ -60,7 +55,7 @@ typedef struct
+     gint button_vsize;            /* read allocated button size - see below */
+ 
+     t_display_type display_type;  /* display layout as image ot text */
+-    t_display_textsize display_textsize; /* text size for text layout */
++    gchar *display_font;          /* font for text layout */
+     t_group_policy group_policy;     /* per-app/window/global policy */
+ 
+     gint button_state;            /* gtk state of the button */
+--- a/panel-plugin/xkb-cairo.c
++++ b/panel-plugin/xkb-cairo.c
+@@ -31,8 +31,6 @@
+ #include <librsvg/rsvg-cairo.h>
+ #endif
+ 
+-#define XKB_PREFERRED_FONT "Courier New, Courier 10 Pitch, Monospace Bold"
+-
+ #define xkb_cairo_arc_for_flag(cr, x, y, r, a1, a2) \
+     xx = layoutx + width - 12 + x; \
+     yy = layouty + height - 12 + y; \
+@@ -59,7 +57,7 @@ xkb_cairo_draw_flag (cairo_t *cr,
+                      gint width,
+                      gint height,
+                      gint variant_markers_count,
+-                     gint textsize,
++                     const gchar *font_str,
+                      GdkColor fgcolor)
+ {
+     gchar *filename;
+@@ -86,7 +84,7 @@ xkb_cairo_draw_flag (cairo_t *cr,
+                 actual_width, actual_height,
+                 width, height,
+                 variant_markers_count,
+-                textsize,
++                font_str,
+                 fgcolor);
+         return;
+     }
+@@ -136,7 +134,7 @@ xkb_cairo_draw_label (cairo_t *cr,
+                       const gint width,
+                       const gint height,
+                       const gint variant_markers_count,
+-                      const gint textsize,
++                      const gchar *font_str,
+                       const GdkColor fgcolor)
+ {
+     gchar *normalized_group_name;
+@@ -168,7 +166,7 @@ xkb_cairo_draw_label (cairo_t *cr,
+ 
+     pango_layout_set_text (layout, normalized_group_name, -1);
+ 
+-    desc = pango_font_description_from_string ( XKB_PREFERRED_FONT );
++    desc = pango_font_description_from_string ( font_str );
+     pango_layout_set_font_description (layout, desc);
+     pango_font_description_free (desc);
+ 
+@@ -176,35 +174,16 @@ xkb_cairo_draw_label (cairo_t *cr,
+     pango_layout_get_pixel_size (layout, &pango_width, &pango_height);
+     DBG ("pango_width/height: %d/%d", pango_width, pango_height);
+ 
+-    switch (textsize){
+-        case DISPLAY_TEXTSIZE_SMALL:
+-        default:    /* catch misconfiguration */
+-            scalex = scaley = 0.475;
+-            break;
+-        case DISPLAY_TEXTSIZE_MEDIUM:
+-            scalex = scaley = 0.7;
+-            break;
+-        case DISPLAY_TEXTSIZE_LARGE:
+-            scalex = scaley = 1;
+-            break;
+-    }
+-
+-    DBG ("txt size scale x/y: %.2f/%.2f", scalex, scaley);
+-
+-    text_height = actual_height * scaley;
++    text_height = actual_height;
+     scaley = text_height / pango_height;
+     radius = (text_height < 32) ? 1.2 : 2.5;
+     diameter = 2 * radius;
+ 
+-    text_width  = actual_width * scalex;
++    text_width  = actual_width;
+     if (actual_width - text_width < 3 + variant_markers_count * diameter)
+     {
+         text_width = actual_width - 3 - (variant_markers_count) * diameter;
+     }
+-    else if (textsize == DISPLAY_TEXTSIZE_LARGE)
+-    {
+-        text_width -= 3;
+-    }
+ 
+     scalex =  text_width/pango_width;
+ 
+--- a/panel-plugin/xkb-cairo.h
++++ b/panel-plugin/xkb-cairo.h
+@@ -41,7 +41,7 @@ void        xkb_cairo_draw_flag     (cai
+                                      gint width,
+                                      gint height,
+                                      gint variant_markers_count,
+-                                     gint textsize,
++                                     const gchar *font_str,
+                                      GdkColor fgcolor);
+ 
+ void        xkb_cairo_draw_label    (cairo_t *cr,
+@@ -52,7 +52,7 @@ void        xkb_cairo_draw_label    (cai
+                                      const gint width,
+                                      const gint height,
+                                      const gint variant_markers_count,
+-                                     const gint textsize,
++                                     const gchar *font_str,
+                                      const GdkColor fgcolor);
+ 
+ #endif
+--- a/panel-plugin/xkb-callbacks.c
++++ b/panel-plugin/xkb-callbacks.c
+@@ -137,7 +137,7 @@ xkb_plugin_layout_image_exposed (GtkWidg
+                 actual_hsize, actual_vsize,
+                 xkb->hsize, vsize,
+                 xkb_config_variant_index_for_group (-1),
+-                xkb->display_textsize,
++                xkb->display_font,
+                 fgcolor
+         );
+     }
+@@ -148,7 +148,7 @@ xkb_plugin_layout_image_exposed (GtkWidg
+                 actual_hsize, actual_vsize,
+                 xkb->hsize, vsize,
+                 xkb_config_variant_index_for_group (-1),
+-                xkb->display_textsize,
++                xkb->display_font,
+                 fgcolor
+         );
+     }
+--- a/panel-plugin/xkb-settings-dialog.c
++++ b/panel-plugin/xkb-settings-dialog.c
+@@ -86,9 +86,30 @@ on_display_type_changed (GtkComboBox *cb
+ }
+ 
+ static void
+-on_display_textsize_changed (GtkComboBox *cb, t_xkb *xkb)
++on_font_selection(GtkWidget *widget, t_xkb *xkb)
+ {
+-    xkb->display_textsize = gtk_combo_box_get_active (cb);
++    GtkWidget *dialog;
++    const gchar *group_name, *previewtext;
++    gint result;
++
++    group_name = xkb_config_get_group_name (-1);
++    previewtext = xkb_util_normalize_group_name (group_name);
++
++    dialog = gtk_font_selection_dialog_new(_("Select font"));
++    gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(dialog),
++                                          xkb->display_font);
++    gtk_font_selection_dialog_set_preview_text(GTK_FONT_SELECTION_DIALOG(dialog),
++                                             previewtext);
++
++    result = gtk_dialog_run(GTK_DIALOG(dialog));
++    if (result == GTK_RESPONSE_OK || result == GTK_RESPONSE_ACCEPT)
++    {
++        g_free(xkb->display_font);
++        xkb->display_font = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(dialog));
++        gtk_button_set_label(GTK_BUTTON(widget), xkb->display_font);
++    }
++    gtk_widget_destroy(dialog);
++
+     xkb_refresh_gui (xkb);
+ }
+ 
+@@ -105,7 +126,7 @@ xfce_xkb_configure (XfcePanelPlugin *plu
+ {
+     GtkWidget *display_type_optmenu, *group_policy_combo;
+     GtkWidget *vbox, *display_type_frame, *group_policy_frame, *bin;
+-    GtkWidget *display_textsize_frame, *display_textsize_optmenu;
++    GtkWidget *display_font_frame, *display_font_button;
+ 
+     xfce_panel_plugin_block_menu (plugin);
+ 
+@@ -130,16 +151,13 @@ xfce_xkb_configure (XfcePanelPlugin *plu
+     gtk_container_add (GTK_CONTAINER (bin), display_type_optmenu);
+ 
+     /* text size option */
+-    display_textsize_frame = xfce_gtk_frame_box_new (_("Text size:"), &bin);
+-    gtk_widget_show (display_textsize_frame);
+-    gtk_box_pack_start (GTK_BOX (vbox), display_textsize_frame, TRUE, TRUE, 2);
+-
+-    display_textsize_optmenu = gtk_combo_box_new_text ();
+-    gtk_combo_box_append_text (GTK_COMBO_BOX (display_textsize_optmenu), _("small"));
+-    gtk_combo_box_append_text (GTK_COMBO_BOX (display_textsize_optmenu), _("medium"));
+-    gtk_combo_box_append_text (GTK_COMBO_BOX (display_textsize_optmenu), _("large"));
+-    gtk_widget_set_size_request (display_textsize_optmenu, 230, -1);
+-    gtk_container_add (GTK_CONTAINER (bin), display_textsize_optmenu);
++    display_font_frame = xfce_gtk_frame_box_new (_("Text font:"), &bin);
++    gtk_widget_show (display_font_frame);
++    gtk_box_pack_start (GTK_BOX (vbox), display_font_frame, TRUE, TRUE, 2);
++
++    display_font_button = gtk_button_new_with_label (xkb->display_font);
++    gtk_widget_set_size_request (display_font_button, 230, -1);
++    gtk_container_add (GTK_CONTAINER (bin), display_font_button);
+ 
+     group_policy_frame = xfce_gtk_frame_box_new (_("Manage layout:"), &bin);
+     gtk_widget_show (group_policy_frame);
+@@ -159,12 +177,11 @@ xfce_xkb_configure (XfcePanelPlugin *plu
+             G_CALLBACK (on_settings_close), xkb);
+ 
+     gtk_combo_box_set_active (GTK_COMBO_BOX (display_type_optmenu), xkb->display_type);
+-    gtk_combo_box_set_active (GTK_COMBO_BOX (display_textsize_optmenu), xkb->display_textsize);
+     gtk_combo_box_set_active (GTK_COMBO_BOX (group_policy_combo), xkb->group_policy);
+ 
+     g_signal_connect (display_type_optmenu, "changed", G_CALLBACK (on_display_type_changed), xkb);
+     g_signal_connect (group_policy_combo, "changed", G_CALLBACK (on_group_policy_changed), xkb);
+-    g_signal_connect (display_textsize_optmenu, "changed", G_CALLBACK (on_display_textsize_changed), xkb);
++    g_signal_connect (display_font_button, "clicked", G_CALLBACK(on_font_selection), xkb);
+ 
+     gtk_widget_show (settings_dialog);
+ }

Added: goodies/branches/experimental/xfce4-xkb-plugin/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-xfce/goodies/branches/experimental/xfce4-xkb-plugin/debian/patches/series?rev=8400&op=file
==============================================================================
--- goodies/branches/experimental/xfce4-xkb-plugin/debian/patches/series	(added)
+++ goodies/branches/experimental/xfce4-xkb-plugin/debian/patches/series	Wed Apr  9 22:10:18 2014
@@ -0,0 +1 @@
+01-font_selection.patch




More information about the Pkg-xfce-commits mailing list