From 83a4d365863c4c096c541fe252e0678a622ac59f Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 8 Nov 2016 03:54:57 +0100 Subject: fix test background It was broken since switching to gtk+3... Fixed & simplified by switching to using CSS on a top maximized window instead of playing with root GdkWindow We always want the image to be there now. This also enables to rip broken code from mygtk3 --- lib/Xconfig/test.pm | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/Xconfig/test.pm b/lib/Xconfig/test.pm index c2f16cd..a09e48e 100644 --- a/lib/Xconfig/test.pm +++ b/lib/Xconfig/test.pm @@ -101,7 +101,6 @@ sub test { $ENV{DISPLAY} = ":9"; Gtk3->init; - gtkset_background(200 * 257, 210 * 257, 210 * 257); my $text = Gtk3::Label->new; my $time = 12; Glib::Timeout->add(1000, sub { @@ -110,16 +109,18 @@ sub test { 1; }); - eval { #- eval it so that missing pixmap will not break the test completely - my $root = gtkroot(); - my $gc = Gtk3::Gdk::GC->new($root); - my $pixbuf = Gtk3::Gdk::Pixbuf->new_from_file("$::prefix/usr/share/mga/xfdrake/xfdrake-test-card.png"); - my ($w, $h) = ($pixbuf->get_allocated_width, $pixbuf->get_allocated_height); - my $pixmap = Gtk3::Gdk::Pixmap->new($root, $w, $h, $root->get_depth); - $pixbuf->render_to_drawable($pixmap, $gc, 0, 0, 0, 0, $w, $h, 'none', 0, 0); - $root->set_back_pixmap($pixmap, 0); - $root->clear; - }; + my $root_w = Gtk3::Window->new; + $root_w->set_name("back"); + my $pl = Gtk3::CssProvider->new; + $pl->load_from_data("#back { +background-image: url('$::prefix/usr/share/mga/xfdrake/xfdrake-test-card.png'); +background-repeat: repeat; +}"); + Gtk3::StyleContext::add_provider_for_screen(Gtk3::Gdk::Screen::get_default(), $pl, Gtk3::STYLE_PROVIDER_PRIORITY_APPLICATION); + + # maximize: + $root_w->set_default_size(Gtk3::Gdk::Screen::width, Gtk3::Gdk::Screen::height); + $root_w->show_all; my $in = interactive::gtk->new; $in->exit($in->ask_yesorno('', [ translate("%s"), $text ], 0) ? 0 : 222); -- cgit v1.2.1