summaryrefslogtreecommitdiffstats
path: root/lib/Xconfig/test.pm
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2016-11-08 03:54:57 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2016-11-08 09:55:44 +0100
commit83a4d365863c4c096c541fe252e0678a622ac59f (patch)
tree927e8e4c55b761a3dd908f3bb8baea21e10bb594 /lib/Xconfig/test.pm
parenta6d3b8586989777db095b51a26b3cf2241b92e8e (diff)
downloaddrakx-kbd-mouse-x11-83a4d365863c4c096c541fe252e0678a622ac59f.tar
drakx-kbd-mouse-x11-83a4d365863c4c096c541fe252e0678a622ac59f.tar.gz
drakx-kbd-mouse-x11-83a4d365863c4c096c541fe252e0678a622ac59f.tar.bz2
drakx-kbd-mouse-x11-83a4d365863c4c096c541fe252e0678a622ac59f.tar.xz
drakx-kbd-mouse-x11-83a4d365863c4c096c541fe252e0678a622ac59f.zip
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
Diffstat (limited to 'lib/Xconfig/test.pm')
-rw-r--r--lib/Xconfig/test.pm23
1 files changed, 12 insertions, 11 deletions
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);