Mageia Bugzilla – Attachment 9179 Details for
Bug 19827
drakconf crashed (undefined value for mandatory argument 'x' encountered at /usr/libexec/drakconf line 1262)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
use Gtk+ animations instead of manually doing it
0001-use-Gtk-animations-instead-of-manually-doing-it.patch (text/plain), 4.99 KB, created by
Thierry Vignaud
on 2017-04-03 10:44:31 CEST
(
hide
)
Description:
use Gtk+ animations instead of manually doing it
Filename:
MIME Type:
Creator:
Thierry Vignaud
Created:
2017-04-03 10:44:31 CEST
Size:
4.99 KB
patch
obsolete
>From 2d04e5e85693cff90fe45ce6f2b79f30c310ece8 Mon Sep 17 00:00:00 2001 >From: Thierry Vignaud <thierry.vignaud@gmail.com> >Date: Mon, 3 Apr 2017 09:48:03 +0200 >Subject: [PATCH] use Gtk+ animations instead of manually doing it > >This simplifies our code. >This should also prevent delayed action to happen before first draw >signal (mga#19827). >--- > control-center | 53 +++++++++++++++++------------------------------------ > 1 file changed, 17 insertions(+), 36 deletions(-) > >diff --git a/control-center b/control-center >index 64e2e5f..50672e6 100755 >--- a/drakconf >+++ b/drakconf >@@ -50,11 +50,6 @@ use Gtk3::WebKit2; > > use MDV::Control_Center; > >-Glib::Object::Introspection->setup( >- basename => 'PangoCairo', >- version => '1.0', >- package => 'Pango::Cairo'); >- > my (%tool_pids, %tool_feedback, $gurpmi_pid); > > my ($conffile, $class_install) = ('/etc/mcc.conf', '/etc/sysconfig/system'); >@@ -733,7 +728,13 @@ gtkadd($window_global, > ], right_child => gtknew('ScrolledWindow', child => gtkset_border_width($view, 5), > no_shadow => 1, h_policy => 'never')), > 1, gtkpack(my $emb_box = Gtk3::VBox->new(0, 0), >- my $wait_darea = gtkset_size_request(Gtk3::DrawingArea->new, -1, -1), >+ my $wait_darea = gtkset_size_request( >+ gtkpack_(Gtk3::VBox->new, >+ 1, gtknew('VBox'), >+ 0, my $wait_img = Gtk3::Image->new, >+ 0, Gtk3::Label->new(N("Loading... Please wait")), >+ 1, gtknew('VBox') >+ ), -1, -1), > ), > ), > 0, Gtk3::HSeparator->new, >@@ -1058,29 +1059,6 @@ sub stop_wait_area() { > undef %run_pixbufs; > } > >-$wait_darea->signal_connect(draw => sub { >- my ($w, $cr) = @_; >- return if !$wait_darea->get_realized; >- return unless $run_pixbuf; # some people got an expose event before we start an embedded tool >- $wait_darea->{layout} ||= $wait_darea->create_pango_layout(N("Loading... Please wait")); >- my $pixbuf = $run_pixbufs{$run_counter} ||= mygtk3::_pixbuf_render_alpha($run_pixbuf, $run_counter); >- my $size = $wait_darea->get_allocation; >- my ($d_width, $d_height) = ($size->{width}, $size->{height}); >- ($w->{pix_width}, $w->{pix_height}) = ($pixbuf->get_width, $pixbuf->get_height); >- my ($txt_width, $txt_height) = $wait_darea->{layout}->get_pixel_size; >- $w->{pix_yy} = ($d_width - $w->{pix_width})/2; >- $w->{pix_xx} = ($d_height - $w->{pix_height} - $txt_height)/2; >- $w->{text_yy} = $w->{pix_yy} + ($w->{pix_width} - $txt_width)/2; >- $w->{text_xx} = $w->{pix_xx} + $w->{pix_height} + 5; >- Gtk3::Gdk::cairo_set_source_pixbuf($cr, $pixbuf, $w->{pix_yy}, $w->{pix_xx}); #0, 0); >- $cr->paint; >- $cr->set_source_rgb(0, 0, 0); >- $cr->move_to($w->{text_yy}, $w->{text_xx}); >- Pango::Cairo::show_layout($cr, $w->{layout}); >- $run_counter += $run_counter_add; >- $run_counter_add = -$run_counter_add if $run_counter < 100 || 255-$run_counter_add < $run_counter; >-}); >- > gtkflush(); > > # display first page (we use a timeout so that Y position of widgets is know): >@@ -1205,7 +1183,7 @@ sub fork_ { > $o_pid_table ||= \@pid_launched; > my $pid = fork(); > if (defined $pid) { >- !$pid and do { exec($prog) or POSIX::_exit(1) }; # immediate exit, else forked gtk+ object destructors will badly catch up parent mcc >+ !$pid and do { sleep(15); exec($prog) or POSIX::_exit(1) }; # immediate exit, else forked gtk+ object destructors will badly catch up parent mcc > push @$o_pid_table, $pid; > return $pid; > } else { >@@ -1256,17 +1234,20 @@ sub run_tool { > if ($gtkplug > 0) { > $buttons->show; > $exec .= " --embedded " . $emb_socket->get_id; >- $wait_darea->show; >+ $wait_darea->show_all; > $cancel->show; > $run_pixbuf = eval { gtkcreate_pixbuf($icon . "_128") }; > $run_counter = 255; > $run_counter_add = -5; >- $timeout = Glib::Timeout->add(35, sub { >- my $w = $wait_darea; >- $w->queue_draw_area($w->{pix_yy}, $w->{pix_xx}, $w->{pix_width}, $w->{pix_height}); >- 1; >- }); > $left_locked = 1; >+ my $anim = Gtk3::Gdk::PixbufSimpleAnim->new(128,128, 1000/35); # should be 1000/35 instead of 10 >+ for (my $x = 0; $x <= 256; $x+=5) { >+ $run_counter += $run_counter_add; >+ $run_counter_add = -$run_counter_add if $run_counter < 100 || 255-$run_counter_add < $run_counter; >+ $anim->add_frame(mygtk3::_pixbuf_render_alpha($run_pixbuf, $run_counter)); >+ } >+ $anim->set_loop(1); >+ $wait_img->set_from_animation($anim); > $buttons->show; > $tool_pids{$label} = fork_($exec); > } >-- >2.10.2 >
From 2d04e5e85693cff90fe45ce6f2b79f30c310ece8 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud <thierry.vignaud@gmail.com> Date: Mon, 3 Apr 2017 09:48:03 +0200 Subject: [PATCH] use Gtk+ animations instead of manually doing it This simplifies our code. This should also prevent delayed action to happen before first draw signal (mga#19827). --- control-center | 53 +++++++++++++++++------------------------------------ 1 file changed, 17 insertions(+), 36 deletions(-) diff --git a/control-center b/control-center index 64e2e5f..50672e6 100755 --- a/drakconf +++ b/drakconf @@ -50,11 +50,6 @@ use Gtk3::WebKit2; use MDV::Control_Center; -Glib::Object::Introspection->setup( - basename => 'PangoCairo', - version => '1.0', - package => 'Pango::Cairo'); - my (%tool_pids, %tool_feedback, $gurpmi_pid); my ($conffile, $class_install) = ('/etc/mcc.conf', '/etc/sysconfig/system'); @@ -733,7 +728,13 @@ gtkadd($window_global, ], right_child => gtknew('ScrolledWindow', child => gtkset_border_width($view, 5), no_shadow => 1, h_policy => 'never')), 1, gtkpack(my $emb_box = Gtk3::VBox->new(0, 0), - my $wait_darea = gtkset_size_request(Gtk3::DrawingArea->new, -1, -1), + my $wait_darea = gtkset_size_request( + gtkpack_(Gtk3::VBox->new, + 1, gtknew('VBox'), + 0, my $wait_img = Gtk3::Image->new, + 0, Gtk3::Label->new(N("Loading... Please wait")), + 1, gtknew('VBox') + ), -1, -1), ), ), 0, Gtk3::HSeparator->new, @@ -1058,29 +1059,6 @@ sub stop_wait_area() { undef %run_pixbufs; } -$wait_darea->signal_connect(draw => sub { - my ($w, $cr) = @_; - return if !$wait_darea->get_realized; - return unless $run_pixbuf; # some people got an expose event before we start an embedded tool - $wait_darea->{layout} ||= $wait_darea->create_pango_layout(N("Loading... Please wait")); - my $pixbuf = $run_pixbufs{$run_counter} ||= mygtk3::_pixbuf_render_alpha($run_pixbuf, $run_counter); - my $size = $wait_darea->get_allocation; - my ($d_width, $d_height) = ($size->{width}, $size->{height}); - ($w->{pix_width}, $w->{pix_height}) = ($pixbuf->get_width, $pixbuf->get_height); - my ($txt_width, $txt_height) = $wait_darea->{layout}->get_pixel_size; - $w->{pix_yy} = ($d_width - $w->{pix_width})/2; - $w->{pix_xx} = ($d_height - $w->{pix_height} - $txt_height)/2; - $w->{text_yy} = $w->{pix_yy} + ($w->{pix_width} - $txt_width)/2; - $w->{text_xx} = $w->{pix_xx} + $w->{pix_height} + 5; - Gtk3::Gdk::cairo_set_source_pixbuf($cr, $pixbuf, $w->{pix_yy}, $w->{pix_xx}); #0, 0); - $cr->paint; - $cr->set_source_rgb(0, 0, 0); - $cr->move_to($w->{text_yy}, $w->{text_xx}); - Pango::Cairo::show_layout($cr, $w->{layout}); - $run_counter += $run_counter_add; - $run_counter_add = -$run_counter_add if $run_counter < 100 || 255-$run_counter_add < $run_counter; -}); - gtkflush(); # display first page (we use a timeout so that Y position of widgets is know): @@ -1205,7 +1183,7 @@ sub fork_ { $o_pid_table ||= \@pid_launched; my $pid = fork(); if (defined $pid) { - !$pid and do { exec($prog) or POSIX::_exit(1) }; # immediate exit, else forked gtk+ object destructors will badly catch up parent mcc + !$pid and do { sleep(15); exec($prog) or POSIX::_exit(1) }; # immediate exit, else forked gtk+ object destructors will badly catch up parent mcc push @$o_pid_table, $pid; return $pid; } else { @@ -1256,17 +1234,20 @@ sub run_tool { if ($gtkplug > 0) { $buttons->show; $exec .= " --embedded " . $emb_socket->get_id; - $wait_darea->show; + $wait_darea->show_all; $cancel->show; $run_pixbuf = eval { gtkcreate_pixbuf($icon . "_128") }; $run_counter = 255; $run_counter_add = -5; - $timeout = Glib::Timeout->add(35, sub { - my $w = $wait_darea; - $w->queue_draw_area($w->{pix_yy}, $w->{pix_xx}, $w->{pix_width}, $w->{pix_height}); - 1; - }); $left_locked = 1; + my $anim = Gtk3::Gdk::PixbufSimpleAnim->new(128,128, 1000/35); # should be 1000/35 instead of 10 + for (my $x = 0; $x <= 256; $x+=5) { + $run_counter += $run_counter_add; + $run_counter_add = -$run_counter_add if $run_counter < 100 || 255-$run_counter_add < $run_counter; + $anim->add_frame(mygtk3::_pixbuf_render_alpha($run_pixbuf, $run_counter)); + } + $anim->set_loop(1); + $wait_img->set_from_animation($anim); $buttons->show; $tool_pids{$label} = fork_($exec); } -- 2.10.2
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 19827
:
9156
|
9179
|
9180