Skip to content

Commit 61fb29f

Browse files
committed
Merge commit 'refs/pull/777/head' of github.com:shutter-project/shutter into tao
2 parents 9c1e855 + 414a391 commit 61fb29f

File tree

5 files changed

+32
-34
lines changed

5 files changed

+32
-34
lines changed

bin/shutter

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ BEGIN {
5555
version => '3.0',
5656
package => 'Gtk3::GdkX11',
5757
);
58+
Glib::Object::Introspection->setup(
59+
basename => 'PangoCairo',
60+
version => '1.0',
61+
package => 'Pango::Cairo',
62+
);
5863
}
5964

6065
package Shutter::App;
@@ -67,7 +72,6 @@ use File::stat;
6772
use Number::Bytes::Human;
6873

6974
#Glib
70-
use Pango;
7175
use Glib qw/TRUE FALSE/;
7276
use Gtk3 '-init';
7377
use Glib::Object::Subclass qw/Gtk3::Application/;

share/shutter/resources/modules/Shutter/App/ShutterNotification.pm

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ use warnings;
3131
#Glib
3232
use Glib qw/TRUE FALSE/;
3333

34-
#Gtk3 and Pango
34+
#Gtk3
3535
use Gtk3;
36-
use Pango;
3736

3837
#--------------------------------------
3938

@@ -98,26 +97,18 @@ sub new {
9897
my $style = $self->{_sc}->get_mainwindow->get_style_context;
9998
my $sel_bg = Gtk3::Gdk::RGBA::parse('#131313');
10099
my $font_fam = $style->get_font('normal')->get_family;
101-
my $font_size = $style->get_font('normal')->get_size / Pango->scale;
100+
my $font_size = $style->get_font('normal')->get_size / Pango::SCALE;
102101

103102
#create cairo context
104103
my $cr = $_[1];
105104

106105
#pango layout
107106
my $layout = Pango::Cairo::create_layout($cr);
108-
$layout->set_width(($w - 30) * Pango->scale);
107+
$layout->set_width(($w - 30) * Pango::SCALE);
109108

110-
if (Pango->CHECK_VERSION(1, 20, 0)) {
111-
$layout->set_height(($h - 20) * Pango->scale);
112-
} else {
113-
warn "WARNING: \$layout->set_height is not available - outdated Pango version\n";
114-
}
109+
$layout->set_height(($h - 20) * Pango::SCALE);
115110

116-
if (Pango->CHECK_VERSION(1, 6, 0)) {
117-
$layout->set_ellipsize('middle');
118-
} else {
119-
warn "WARNING: \$layout->set_ellipsize is not available - outdated Pango version\n";
120-
}
111+
$layout->set_ellipsize('middle');
121112

122113
$layout->set_alignment('left');
123114
$layout->set_wrap('word-char');

share/shutter/resources/modules/Shutter/Draw/DrawingTool.pm

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ sub setup_bottom_hbox {
632632

633633
$self->{_font_btn_wh} = $self->{_font_btn_w}->signal_connect(
634634
'font-set' => sub {
635-
my $font_descr = Pango::FontDescription->from_string($self->{_font_btn_w}->get_font_name);
635+
my $font_descr = Pango::FontDescription::from_string($self->{_font_btn_w}->get_font_name);
636636
$self->{_font} = $self->{_font_btn_w}->get_font_name;
637637

638638
if ($self->{_current_item}) {
@@ -3190,8 +3190,9 @@ sub set_and_save_drawing_properties {
31903190
if (exists($self->{_items}{$key}{text})) {
31913191

31923192
#determine font description from string
3193-
my ($attr_list, $text_raw, $accel_char) = Pango->parse_markup($self->{_items}{$key}{text}->get('text'));
3194-
my $font_desc = $attr_list->get_iterator->get_font;
3193+
my ($ret, $attr_list, $text_raw, $accel_char) = Pango::parse_markup($self->{_items}{$key}{text}->get('text'), -1, 0);
3194+
my $font_desc = Pango::FontDescription->new();
3195+
$attr_list->get_iterator->get_font($font_desc);
31953196

31963197
#apply current font settings to button
31973198
$self->{_font_btn_w}->set_font_name($font_desc ? $font_desc->to_string : $self->{_font});
@@ -3202,8 +3203,9 @@ sub set_and_save_drawing_properties {
32023203
} elsif ($item->isa('GooCanvas2::CanvasText')) {
32033204

32043205
#determine font description from string
3205-
my ($attr_list, $text_raw, $accel_char) = Pango->parse_markup($item->get('text'));
3206-
my $font_desc = $attr_list->get_iterator->get_font;
3206+
my ($ret, $attr_list, $text_raw, $accel_char) = Pango::parse_markup($item->get('text'), -1, 0);
3207+
my $font_desc = Pango::FontDescription->new();
3208+
$attr_list->get_iterator->get_font($font_desc);
32073209

32083210
#font color
32093211
$self->{_stroke_color_w}->set_rgba($self->{_items}{$key}{stroke_color});
@@ -3217,7 +3219,7 @@ sub set_and_save_drawing_properties {
32173219
$self->{_line_width} = $self->{_line_spin_w}->get_value;
32183220
$self->{_stroke_color} = $self->{_stroke_color_w}->get_rgba;
32193221
$self->{_fill_color} = $self->{_fill_color_w}->get_rgba;
3220-
my $font_descr = Pango::FontDescription->from_string($self->{_font_btn_w}->get_font_name);
3222+
my $font_descr = Pango::FontDescription::from_string($self->{_font_btn_w}->get_font_name);
32213223
$self->{_font} = $self->{_font_btn_w}->get_font_name;
32223224

32233225
#unblock 'value-change' handlers for widgets
@@ -3298,7 +3300,7 @@ sub restore_drawing_properties {
32983300
$self->{_line_width} = $self->{_line_spin_w}->get_value;
32993301
$self->{_stroke_color} = $self->{_stroke_color_w}->get_rgba;
33003302
$self->{_fill_color} = $self->{_fill_color_w}->get_rgba;
3301-
my $font_descr = Pango::FontDescription->from_string($self->{_font_btn_w}->get_font_name);
3303+
my $font_descr = Pango::FontDescription::from_string($self->{_font_btn_w}->get_font_name);
33023304
$self->{_font} = $self->{_font_btn_w}->get_font_name;
33033305

33043306
#unblock 'value-change' handlers for widgets
@@ -4098,8 +4100,9 @@ sub show_item_properties {
40984100
$font_btn = Gtk3::FontButton->new();
40994101

41004102
#determine font description from string
4101-
my ($attr_list, $text_raw, $accel_char) = Pango->parse_markup($self->{_items}{$key}{text}->get('text'));
4102-
my ($font_desc) = $attr_list->get_iterator->get_font;
4103+
my ($ret, $attr_list, $text_raw, $accel_char) = Pango::parse_markup($self->{_items}{$key}{text}->get('text'), -1, 0);
4104+
my $font_desc = Pango::FontDescription->new();
4105+
$attr_list->get_iterator->get_font($font_desc);
41034106

41044107
#apply current font settings to button
41054108
$font_btn->set_font_name($font_desc ? $font_desc->to_string : $self->{_font});
@@ -4208,8 +4211,8 @@ sub show_item_properties {
42084211
$font_btn = Gtk3::FontButton->new();
42094212

42104213
#determine font description from string
4211-
my ($attr_list, $text_raw, $accel_char) = Pango->parse_markup($item->get('text'));
4212-
my ($font_desc) = Pango::FontDescription->from_string($self->{_font});
4214+
my ($ret, $attr_list, $text_raw, $accel_char) = Pango::parse_markup($item->get('text'), -1, 0);
4215+
my ($font_desc) = Pango::FontDescription::from_string($self->{_font});
42134216

42144217
$font_hbox->pack_start($font_label, FALSE, TRUE, 12);
42154218
$font_hbox->pack_start($font_btn, TRUE, TRUE, 0);
@@ -4564,7 +4567,7 @@ sub apply_properties {
45644567
$fill_color = $stroke_color->get_rgba;
45654568
}
45664569

4567-
my $font_descr = Pango::FontDescription->from_string($font_btn->get_font_name);
4570+
my $font_descr = Pango::FontDescription::from_string($font_btn->get_font_name);
45684571
$self->{_items}{$key}{text}->set(
45694572
'text' => "<span font_desc=' " . $font_btn->get_font_name . " ' >" . $digit . "</span>",
45704573
'fill-color-gdk-rgba' => $fill_color,
@@ -4657,7 +4660,7 @@ sub apply_properties {
46574660

46584661
#apply text options
46594662
if ($item->isa('GooCanvas2::CanvasText')) {
4660-
my $font_descr = Pango::FontDescription->from_string($font_btn->get_font_name);
4663+
my $font_descr = Pango::FontDescription::from_string($font_btn->get_font_name);
46614664

46624665
my $new_text = undef;
46634666
if ($textview) {
@@ -4666,7 +4669,7 @@ sub apply_properties {
46664669
} else {
46674670

46684671
#determine font description and text from string
4669-
my ($attr_list, $text_raw, $accel_char) = Pango->parse_markup($item->get('text'));
4672+
my ($ret, $attr_list, $text_raw, $accel_char) = Pango::parse_markup($item->get('text'), -1, 0);
46704673
$new_text = $text_raw;
46714674
}
46724675

@@ -4703,7 +4706,7 @@ sub modify_text_in_properties {
47034706
my $use_font = shift;
47044707
my $use_font_color = shift;
47054708

4706-
my $font_descr = Pango::FontDescription->from_string($font_btn->get_font_name);
4709+
my $font_descr = Pango::FontDescription::from_string($font_btn->get_font_name);
47074710
my $texttag = Gtk3::TextTag->new;
47084711

47094712
if ($use_font->get_active && $use_font_color->get_active) {

share/shutter/resources/modules/Shutter/Screenshot/SelectorAdvanced.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ sub select_advanced {
129129
my $style = $self->{_sc}->get_mainwindow->get_style_context;
130130
my $sel_bg = Gtk3::Gdk::RGBA::parse('#131313');
131131
my $font_fam = $style->get_font('normal')->get_family;
132-
my $font_size = $style->get_font('normal')->get_size * $self->{_dpi_scale} / Pango->scale;
132+
my $font_size = $style->get_font('normal')->get_size * $self->{_dpi_scale} / Pango::SCALE;
133133

134134
#create cairo context und layout
135135
my $surface = Cairo::ImageSurface->create('argb32', $self->{_root}->{w}*$self->{_dpi_scale}, $self->{_root}->{h}*$self->{_dpi_scale});
@@ -140,7 +140,7 @@ sub select_advanced {
140140
$cr->paint;
141141

142142
my $layout = Pango::Cairo::create_layout($cr);
143-
$layout->set_width(int($mon1->{width} * $self->{_dpi_scale} / 2) * Pango->scale);
143+
$layout->set_width(int($mon1->{width} * $self->{_dpi_scale} / 2) * Pango::SCALE);
144144
$layout->set_alignment('left');
145145
$layout->set_wrap('word');
146146

share/shutter/resources/modules/Shutter/Screenshot/Window.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ sub new {
9797
my $style = $self->{_main_gtk_window}->get_style_context;
9898
my $sel_bg = $style->get_background_color('selected');
9999
my $font_fam = $style->get_font('normal')->get_family;
100-
my $font_size = $style->get_font('normal')->get_size / Pango->scale;
100+
my $font_size = $style->get_font('normal')->get_size / Pango::SCALE;
101101

102102
#get current monitor
103103
my $mon = $self->get_current_monitor;
@@ -128,7 +128,7 @@ sub new {
128128

129129
#pango layout
130130
my $layout = Pango::Cairo::create_layout($cr);
131-
$layout->set_width(($w - $icon->get_width - $font_size * 3) * Pango->scale);
131+
$layout->set_width(($w - $icon->get_width - $font_size * 3) * Pango::SCALE);
132132
$layout->set_alignment('left');
133133
$layout->set_wrap('char');
134134

0 commit comments

Comments
 (0)