[shutter] 67/73: fix decoding of name returned by Gnome2::Wnck

ChangZhuo Chen czchen at moszumanska.debian.org
Thu Mar 2 01:29:14 UTC 2017


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

czchen pushed a commit to branch master
in repository shutter.

commit 26565c490b0917e238e3e1d8c1055c180ce12f56
Author: Dominique Dumont <dod at debian.org>
Date:   Wed Dec 21 11:36:21 2016 +0100

    fix decoding of name returned by Gnome2::Wnck
    
    See #847051 for details
---
 ...e-utf8-for-retrieved-window-name-from-Gtk2.patch | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/debian/patches/0002-Force-utf8-for-retrieved-window-name-from-Gtk2.patch b/debian/patches/0002-Force-utf8-for-retrieved-window-name-from-Gtk2.patch
index ff90048..2d20365 100644
--- a/debian/patches/0002-Force-utf8-for-retrieved-window-name-from-Gtk2.patch
+++ b/debian/patches/0002-Force-utf8-for-retrieved-window-name-from-Gtk2.patch
@@ -12,28 +12,33 @@ would be used and cause mess.
  bin/shutter | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
 
-diff --git a/bin/shutter b/bin/shutter
-index a0495d4..38eeedd 100755
 --- a/bin/shutter
 +++ b/bin/shutter
-@@ -30,6 +30,9 @@ use utf8;
+@@ -30,6 +30,11 @@
  use strict;
  use warnings;
  
 +#Deal with encoding problem
-+use Encode;
++use 5.12.0;
++use Encode qw/is_utf8 decode/;
++use Encode::X11;
 +
  #Gnome2 libraries
  use Gnome2;
  use Gnome2::Wnck;
-@@ -8624,7 +8627,9 @@ else {
+@@ -8624,7 +8629,14 @@
          #add all windows to menu to capture it directly
          foreach my $win ( $wnck_screen->get_windows_stacked ) {
              if ( $active_workspace && $win->is_on_workspace($active_workspace) ) {
 -                my $window_item = Gtk2::ImageMenuItem->new_with_label( $win->get_name );
-+                my $win_name = $win->get_name;
-+                Encode::_utf8_on( $win_name );
-+                my $window_item = Gtk2::ImageMenuItem->new_with_label( $win_name );
++                my $raw_name = $win->get_name;
++                my $name;
++                eval { $name = decode( 'UTF-8' , $raw_name, 1); };
++                # fallback if utf-8 decoding fails.
++                # See https://mail.gnome.org/archives/gtk-perl-list/2016-December/msg00004.html
++                $name = decode( 'x11-compound-text', $raw_name ) if $@;
++
++                my $window_item = Gtk2::ImageMenuItem->new_with_label( $name );
                  foreach my $child ( $window_item->get_children ) {
                      if ( $child =~ /Gtk2::AccelLabel/ ) {
                          $child->set_width_chars(50);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/shutter.git



More information about the Pkg-perl-cvs-commits mailing list