Merge lp:~noskcaj/ubuntu/trusty/xfce4-xkb-plugin/lp-733563 into lp:ubuntu/trusty/xfce4-xkb-plugin
- Trusty (14.04)
- lp-733563
- Merge into trusty
Status: | Work in progress | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~noskcaj/ubuntu/trusty/xfce4-xkb-plugin/lp-733563 | ||||
Merge into: | lp:ubuntu/trusty/xfce4-xkb-plugin | ||||
Diff against target: |
339 lines (+316/-0) 4 files modified
debian/changelog (+7/-0) debian/patches/font_selection.patch (+286/-0) debian/patches/git-fix-crash.patch (+21/-0) debian/patches/series (+2/-0) |
||||
To merge this branch: | bzr merge lp:~noskcaj/ubuntu/trusty/xfce4-xkb-plugin/lp-733563 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Logan Rosen | Pending | ||
Review via email: mp+214365@code.launchpad.net |
This proposal supersedes a proposal from 2014-02-24.
Commit message
Description of the change
Make xkb-plugin able to change font.
Iain Lane (laney) wrote : Posted in a previous version of this proposal | # |
Iain Lane (laney) wrote : Posted in a previous version of this proposal | # |
Oops, I commented on the wrong one.
What happens when the user has set `display_textsize' before? It looks like that setting will be lost - is that right and intended?
Iain Lane (laney) : Posted in a previous version of this proposal | # |
Jackson Doak (noskcaj) wrote : Posted in a previous version of this proposal | # |
As far as i know, it's intentional.
On Fri, Mar 7, 2014 at 12:00 AM, Iain Lane <email address hidden> wrote:
> Review: Needs Information
>
>
> --
>
> https:/
> You are the owner of lp:~noskcaj/ubuntu/trusty/xfce4-xkb-plugin/lp-733563.
>
- 38. By Jackson Doak
-
Add git-fix-
crash.patch. LP: #978230 - 39. By Jackson Doak
-
Add the patch
Jackson Doak (noskcaj) wrote : | # |
Just a warning, i haven't been able to test the patches myself. they should be stable though
Pasi Lallinaho (knome) wrote : | # |
As you told other people have tested the patches, please either make them leave a comment saying the patches are fine or ask that somebody else does the testing.
Timo Jyrinki (timo-jyrinki) wrote : | # |
Testable from ppa:timo-
Dmitry Shachnev (mitya57) wrote : | # |
Font_selection.
Git-fix-crash.patch uploaded.
Unmerged revisions
- 39. By Jackson Doak
-
Add the patch
- 38. By Jackson Doak
-
Add git-fix-
crash.patch. LP: #978230 - 37. By Jackson Doak
-
Add font_selection.
patch, thanks Ivan Frederiks. LP: #733563
Preview Diff
1 | === removed file '.pc/applied-patches' |
2 | === modified file 'debian/changelog' |
3 | --- debian/changelog 2014-02-07 19:39:52 +0000 |
4 | +++ debian/changelog 2014-04-05 02:29:21 +0000 |
5 | @@ -1,3 +1,10 @@ |
6 | +xfce4-xkb-plugin (1:0.7.0-0ubuntu2) trusty; urgency=medium |
7 | + |
8 | + * Add font_selection.patch, thanks Ivan Frederiks. LP: #733563 |
9 | + * Add git-fix-crash.patch. LP: #978230 |
10 | + |
11 | + -- Jackson Doak <noskcaj@ubuntu.com> Sat, 05 Apr 2014 13:26:23 +1100 |
12 | + |
13 | xfce4-xkb-plugin (1:0.7.0-0ubuntu1) trusty; urgency=medium |
14 | |
15 | * debian/watch: Use all versions |
16 | |
17 | === added file 'debian/patches/font_selection.patch' |
18 | --- debian/patches/font_selection.patch 1970-01-01 00:00:00 +0000 |
19 | +++ debian/patches/font_selection.patch 2014-04-05 02:29:21 +0000 |
20 | @@ -0,0 +1,286 @@ |
21 | +Author: Ivan Frederiks <idfred@gmail.com> |
22 | +Date: Thu, 26 Sep 2013 14:49:02 +0400 |
23 | +Description: Changed text size selection to full-featured font selection |
24 | + Makes the xkb plugin change font with the rest of the system |
25 | +Bug: https://bugzilla.xfce.org/show_bug.cgi?id=8446 |
26 | +Bug-Debian: http://bugs.debian.org/576072 |
27 | +Bug-Ubuntu: https://launchpad.net/bugs/733563 |
28 | + |
29 | +--- |
30 | + panel-plugin/xfce4-xkb-plugin.c | 7 +++-- |
31 | + panel-plugin/xfce4-xkb-plugin.h | 9 +------ |
32 | + panel-plugin/xkb-cairo.c | 33 ++++--------------------- |
33 | + panel-plugin/xkb-cairo.h | 4 +-- |
34 | + panel-plugin/xkb-callbacks.c | 4 +-- |
35 | + panel-plugin/xkb-settings-dialog.c | 47 +++++++++++++++++++++++++------------ |
36 | + 6 files changed, 48 insertions(+), 56 deletions(-) |
37 | + |
38 | +--- a/panel-plugin/xfce4-xkb-plugin.c |
39 | ++++ b/panel-plugin/xfce4-xkb-plugin.c |
40 | +@@ -262,6 +262,7 @@ xkb_free (t_xkb *xkb) |
41 | + gtk_widget_destroy (xkb->layout_image); |
42 | + gtk_widget_destroy (xkb->btn); |
43 | + xkb_destroy_popup_menu (xkb); |
44 | ++ g_free (xkb->display_font); |
45 | + |
46 | + panel_slice_free (t_xkb, xkb); |
47 | + } |
48 | +@@ -288,7 +289,7 @@ xfce_xkb_save_config (XfcePanelPlugin *p |
49 | + xfce_rc_set_group (rcfile, NULL); |
50 | + |
51 | + xfce_rc_write_int_entry (rcfile, "display_type", xkb->display_type); |
52 | +- xfce_rc_write_int_entry (rcfile, "display_textsize", xkb->display_textsize); |
53 | ++ xfce_rc_write_entry (rcfile, "display_font", xkb->display_font); |
54 | + xfce_rc_write_int_entry (rcfile, "group_policy", xkb->group_policy); |
55 | + |
56 | + xfce_rc_close (rcfile); |
57 | +@@ -304,7 +305,7 @@ xkb_load_config (t_xkb *xkb, const gchar |
58 | + xfce_rc_set_group (rcfile, NULL); |
59 | + |
60 | + xkb->display_type = xfce_rc_read_int_entry (rcfile, "display_type", DISPLAY_TYPE_IMAGE); |
61 | +- xkb->display_textsize = xfce_rc_read_int_entry (rcfile, "display_textsize", DISPLAY_TEXTSIZE_LARGE); |
62 | ++ xkb->display_font = g_strdup(xfce_rc_read_entry (rcfile, "display_font", XKB_PREFERRED_FONT)); |
63 | + xkb->group_policy = xfce_rc_read_int_entry (rcfile, "group_policy", GROUP_POLICY_PER_APPLICATION); |
64 | + |
65 | + xfce_rc_close (rcfile); |
66 | +@@ -319,7 +320,7 @@ static void |
67 | + xkb_load_default (t_xkb *xkb) |
68 | + { |
69 | + xkb->display_type = DISPLAY_TYPE_IMAGE; |
70 | +- xkb->display_textsize = DISPLAY_TEXTSIZE_LARGE; |
71 | ++ xkb->display_font = g_strdup(XKB_PREFERRED_FONT); |
72 | + xkb->group_policy = GROUP_POLICY_PER_APPLICATION; |
73 | + } |
74 | + |
75 | +--- a/panel-plugin/xfce4-xkb-plugin.h |
76 | ++++ b/panel-plugin/xfce4-xkb-plugin.h |
77 | +@@ -42,12 +42,7 @@ typedef enum |
78 | + DISPLAY_TYPE_TEXT = 1 |
79 | + } t_display_type; |
80 | + |
81 | +-typedef enum |
82 | +-{ |
83 | +- DISPLAY_TEXTSIZE_SMALL = 0, |
84 | +- DISPLAY_TEXTSIZE_MEDIUM = 1, |
85 | +- DISPLAY_TEXTSIZE_LARGE = 2 |
86 | +-} t_display_textsize; |
87 | ++#define XKB_PREFERRED_FONT "Monospace Bold 16" |
88 | + |
89 | + typedef struct |
90 | + { |
91 | +@@ -60,7 +55,7 @@ typedef struct |
92 | + gint button_vsize; /* read allocated button size - see below */ |
93 | + |
94 | + t_display_type display_type; /* display layout as image ot text */ |
95 | +- t_display_textsize display_textsize; /* text size for text layout */ |
96 | ++ gchar *display_font; /* font for text layout */ |
97 | + t_group_policy group_policy; /* per-app/window/global policy */ |
98 | + |
99 | + gint button_state; /* gtk state of the button */ |
100 | +--- a/panel-plugin/xkb-cairo.c |
101 | ++++ b/panel-plugin/xkb-cairo.c |
102 | +@@ -31,8 +31,6 @@ |
103 | + #include <librsvg/rsvg-cairo.h> |
104 | + #endif |
105 | + |
106 | +-#define XKB_PREFERRED_FONT "Courier New, Courier 10 Pitch, Monospace Bold" |
107 | +- |
108 | + #define xkb_cairo_arc_for_flag(cr, x, y, r, a1, a2) \ |
109 | + xx = layoutx + width - 12 + x; \ |
110 | + yy = layouty + height - 12 + y; \ |
111 | +@@ -59,7 +57,7 @@ xkb_cairo_draw_flag (cairo_t *cr, |
112 | + gint width, |
113 | + gint height, |
114 | + gint variant_markers_count, |
115 | +- gint textsize, |
116 | ++ const gchar *font_str, |
117 | + GdkColor fgcolor) |
118 | + { |
119 | + gchar *filename; |
120 | +@@ -86,7 +84,7 @@ xkb_cairo_draw_flag (cairo_t *cr, |
121 | + actual_width, actual_height, |
122 | + width, height, |
123 | + variant_markers_count, |
124 | +- textsize, |
125 | ++ font_str, |
126 | + fgcolor); |
127 | + return; |
128 | + } |
129 | +@@ -136,7 +134,7 @@ xkb_cairo_draw_label (cairo_t *cr, |
130 | + const gint width, |
131 | + const gint height, |
132 | + const gint variant_markers_count, |
133 | +- const gint textsize, |
134 | ++ const gchar *font_str, |
135 | + const GdkColor fgcolor) |
136 | + { |
137 | + gchar *normalized_group_name; |
138 | +@@ -168,7 +166,7 @@ xkb_cairo_draw_label (cairo_t *cr, |
139 | + |
140 | + pango_layout_set_text (layout, normalized_group_name, -1); |
141 | + |
142 | +- desc = pango_font_description_from_string ( XKB_PREFERRED_FONT ); |
143 | ++ desc = pango_font_description_from_string ( font_str ); |
144 | + pango_layout_set_font_description (layout, desc); |
145 | + pango_font_description_free (desc); |
146 | + |
147 | +@@ -176,35 +174,16 @@ xkb_cairo_draw_label (cairo_t *cr, |
148 | + pango_layout_get_pixel_size (layout, &pango_width, &pango_height); |
149 | + DBG ("pango_width/height: %d/%d", pango_width, pango_height); |
150 | + |
151 | +- switch (textsize){ |
152 | +- case DISPLAY_TEXTSIZE_SMALL: |
153 | +- default: /* catch misconfiguration */ |
154 | +- scalex = scaley = 0.475; |
155 | +- break; |
156 | +- case DISPLAY_TEXTSIZE_MEDIUM: |
157 | +- scalex = scaley = 0.7; |
158 | +- break; |
159 | +- case DISPLAY_TEXTSIZE_LARGE: |
160 | +- scalex = scaley = 1; |
161 | +- break; |
162 | +- } |
163 | +- |
164 | +- DBG ("txt size scale x/y: %.2f/%.2f", scalex, scaley); |
165 | +- |
166 | +- text_height = actual_height * scaley; |
167 | ++ text_height = actual_height; |
168 | + scaley = text_height / pango_height; |
169 | + radius = (text_height < 32) ? 1.2 : 2.5; |
170 | + diameter = 2 * radius; |
171 | + |
172 | +- text_width = actual_width * scalex; |
173 | ++ text_width = actual_width; |
174 | + if (actual_width - text_width < 3 + variant_markers_count * diameter) |
175 | + { |
176 | + text_width = actual_width - 3 - (variant_markers_count) * diameter; |
177 | + } |
178 | +- else if (textsize == DISPLAY_TEXTSIZE_LARGE) |
179 | +- { |
180 | +- text_width -= 3; |
181 | +- } |
182 | + |
183 | + scalex = text_width/pango_width; |
184 | + |
185 | +--- a/panel-plugin/xkb-cairo.h |
186 | ++++ b/panel-plugin/xkb-cairo.h |
187 | +@@ -41,7 +41,7 @@ void xkb_cairo_draw_flag (cai |
188 | + gint width, |
189 | + gint height, |
190 | + gint variant_markers_count, |
191 | +- gint textsize, |
192 | ++ const gchar *font_str, |
193 | + GdkColor fgcolor); |
194 | + |
195 | + void xkb_cairo_draw_label (cairo_t *cr, |
196 | +@@ -52,7 +52,7 @@ void xkb_cairo_draw_label (cai |
197 | + const gint width, |
198 | + const gint height, |
199 | + const gint variant_markers_count, |
200 | +- const gint textsize, |
201 | ++ const gchar *font_str, |
202 | + const GdkColor fgcolor); |
203 | + |
204 | + #endif |
205 | +--- a/panel-plugin/xkb-callbacks.c |
206 | ++++ b/panel-plugin/xkb-callbacks.c |
207 | +@@ -137,7 +137,7 @@ xkb_plugin_layout_image_exposed (GtkWidg |
208 | + actual_hsize, actual_vsize, |
209 | + xkb->hsize, vsize, |
210 | + xkb_config_variant_index_for_group (-1), |
211 | +- xkb->display_textsize, |
212 | ++ xkb->display_font, |
213 | + fgcolor |
214 | + ); |
215 | + } |
216 | +@@ -148,7 +148,7 @@ xkb_plugin_layout_image_exposed (GtkWidg |
217 | + actual_hsize, actual_vsize, |
218 | + xkb->hsize, vsize, |
219 | + xkb_config_variant_index_for_group (-1), |
220 | +- xkb->display_textsize, |
221 | ++ xkb->display_font, |
222 | + fgcolor |
223 | + ); |
224 | + } |
225 | +--- a/panel-plugin/xkb-settings-dialog.c |
226 | ++++ b/panel-plugin/xkb-settings-dialog.c |
227 | +@@ -86,9 +86,30 @@ on_display_type_changed (GtkComboBox *cb |
228 | + } |
229 | + |
230 | + static void |
231 | +-on_display_textsize_changed (GtkComboBox *cb, t_xkb *xkb) |
232 | ++on_font_selection(GtkWidget *widget, t_xkb *xkb) |
233 | + { |
234 | +- xkb->display_textsize = gtk_combo_box_get_active (cb); |
235 | ++ GtkWidget *dialog; |
236 | ++ const gchar *group_name, *previewtext; |
237 | ++ gint result; |
238 | ++ |
239 | ++ group_name = xkb_config_get_group_name (-1); |
240 | ++ previewtext = xkb_util_normalize_group_name (group_name); |
241 | ++ |
242 | ++ dialog = gtk_font_selection_dialog_new(_("Select font")); |
243 | ++ gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(dialog), |
244 | ++ xkb->display_font); |
245 | ++ gtk_font_selection_dialog_set_preview_text(GTK_FONT_SELECTION_DIALOG(dialog), |
246 | ++ previewtext); |
247 | ++ |
248 | ++ result = gtk_dialog_run(GTK_DIALOG(dialog)); |
249 | ++ if (result == GTK_RESPONSE_OK || result == GTK_RESPONSE_ACCEPT) |
250 | ++ { |
251 | ++ g_free(xkb->display_font); |
252 | ++ xkb->display_font = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(dialog)); |
253 | ++ gtk_button_set_label(GTK_BUTTON(widget), xkb->display_font); |
254 | ++ } |
255 | ++ gtk_widget_destroy(dialog); |
256 | ++ |
257 | + xkb_refresh_gui (xkb); |
258 | + } |
259 | + |
260 | +@@ -105,7 +126,7 @@ xfce_xkb_configure (XfcePanelPlugin *plu |
261 | + { |
262 | + GtkWidget *display_type_optmenu, *group_policy_combo; |
263 | + GtkWidget *vbox, *display_type_frame, *group_policy_frame, *bin; |
264 | +- GtkWidget *display_textsize_frame, *display_textsize_optmenu; |
265 | ++ GtkWidget *display_font_frame, *display_font_button; |
266 | + |
267 | + xfce_panel_plugin_block_menu (plugin); |
268 | + |
269 | +@@ -130,16 +151,13 @@ xfce_xkb_configure (XfcePanelPlugin *plu |
270 | + gtk_container_add (GTK_CONTAINER (bin), display_type_optmenu); |
271 | + |
272 | + /* text size option */ |
273 | +- display_textsize_frame = xfce_gtk_frame_box_new (_("Text size:"), &bin); |
274 | +- gtk_widget_show (display_textsize_frame); |
275 | +- gtk_box_pack_start (GTK_BOX (vbox), display_textsize_frame, TRUE, TRUE, 2); |
276 | +- |
277 | +- display_textsize_optmenu = gtk_combo_box_new_text (); |
278 | +- gtk_combo_box_append_text (GTK_COMBO_BOX (display_textsize_optmenu), _("small")); |
279 | +- gtk_combo_box_append_text (GTK_COMBO_BOX (display_textsize_optmenu), _("medium")); |
280 | +- gtk_combo_box_append_text (GTK_COMBO_BOX (display_textsize_optmenu), _("large")); |
281 | +- gtk_widget_set_size_request (display_textsize_optmenu, 230, -1); |
282 | +- gtk_container_add (GTK_CONTAINER (bin), display_textsize_optmenu); |
283 | ++ display_font_frame = xfce_gtk_frame_box_new (_("Text font:"), &bin); |
284 | ++ gtk_widget_show (display_font_frame); |
285 | ++ gtk_box_pack_start (GTK_BOX (vbox), display_font_frame, TRUE, TRUE, 2); |
286 | ++ |
287 | ++ display_font_button = gtk_button_new_with_label (xkb->display_font); |
288 | ++ gtk_widget_set_size_request (display_font_button, 230, -1); |
289 | ++ gtk_container_add (GTK_CONTAINER (bin), display_font_button); |
290 | + |
291 | + group_policy_frame = xfce_gtk_frame_box_new (_("Manage layout:"), &bin); |
292 | + gtk_widget_show (group_policy_frame); |
293 | +@@ -159,12 +177,11 @@ xfce_xkb_configure (XfcePanelPlugin *plu |
294 | + G_CALLBACK (on_settings_close), xkb); |
295 | + |
296 | + gtk_combo_box_set_active (GTK_COMBO_BOX (display_type_optmenu), xkb->display_type); |
297 | +- gtk_combo_box_set_active (GTK_COMBO_BOX (display_textsize_optmenu), xkb->display_textsize); |
298 | + gtk_combo_box_set_active (GTK_COMBO_BOX (group_policy_combo), xkb->group_policy); |
299 | + |
300 | + g_signal_connect (display_type_optmenu, "changed", G_CALLBACK (on_display_type_changed), xkb); |
301 | + g_signal_connect (group_policy_combo, "changed", G_CALLBACK (on_group_policy_changed), xkb); |
302 | +- g_signal_connect (display_textsize_optmenu, "changed", G_CALLBACK (on_display_textsize_changed), xkb); |
303 | ++ g_signal_connect (display_font_button, "clicked", G_CALLBACK(on_font_selection), xkb); |
304 | + |
305 | + gtk_widget_show (settings_dialog); |
306 | + } |
307 | |
308 | === added file 'debian/patches/git-fix-crash.patch' |
309 | --- debian/patches/git-fix-crash.patch 1970-01-01 00:00:00 +0000 |
310 | +++ debian/patches/git-fix-crash.patch 2014-04-05 02:29:21 +0000 |
311 | @@ -0,0 +1,21 @@ |
312 | +Origin: http://git.xfce.org/panel-plugins/xfce4-xkb-plugin/commit/?id=afc0c84257d33e712b06cc3e5de7b0fe63480ebd |
313 | +Author: Igor Slepchin <igor.slepchin@gmail.com> |
314 | +Description: Fix crash in xkb_util_normalize_group_name |
315 | + Correctly compute offset of the first separator char in group name. |
316 | +Bug-Ubuntu: https://launchpad.net/bugs/978230 |
317 | + |
318 | +--- |
319 | + panel-plugin/xkb-util.c | 2 +- |
320 | + 1 file changed, 1 insertion(+), 1 deletion(-) |
321 | + |
322 | +--- a/panel-plugin/xkb-util.c |
323 | ++++ b/panel-plugin/xkb-util.c |
324 | +@@ -81,7 +81,7 @@ xkb_util_normalize_group_name (const gch |
325 | + { |
326 | + if (!((*c >= 'a' && *c <= 'z') || (*c >= 'A' && *c <= 'Z'))) |
327 | + { |
328 | +- index_of_na = group_name - c; |
329 | ++ index_of_na = c - group_name; |
330 | + break; |
331 | + } |
332 | + } |
333 | |
334 | === added file 'debian/patches/series' |
335 | --- debian/patches/series 1970-01-01 00:00:00 +0000 |
336 | +++ debian/patches/series 2014-04-05 02:29:21 +0000 |
337 | @@ -0,0 +1,2 @@ |
338 | +font_selection.patch |
339 | +git-fix-crash.patch |
thanks