<?php //GtkIconView toggle_cursor_item problem demo if ($argc > 1 && $argv[1] == 'run') { $wnd = new GtkWindow(); $wnd->connect_simple('destroy', array('gtk', 'main_quit')); $wnd->set_default_size(200, 200); $iv = new GtkIconView(); $iv->set_selection_mode(Gtk::SELECTION_MULTIPLE); $model = new GtkListStore(Gtk::TYPE_STRING); $iv->set_model($model); $model->set($model->append(), 0, 'test'); $iv->set_text_column(0); //make it scrollable $scrollwin = new GtkScrolledWindow(); $scrollwin->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); $scrollwin->add($iv); $wnd->add($scrollwin); $wnd->show_all(); /** * The problem place: * Press Ctrl+ Right arrow * Press Ctrl+space * See the error */ function toggle_cursor_item() { //var_dump('toggle-cursor-item'); } $iv->connect_simple('toggle-cursor-item', 'toggle_cursor_item'); //let it show while(Gtk::events_pending()) { Gtk::main_iteration(); } //send the keys require_once('helper/EventGenerator.php'); $eg = EventGenerator::createGenerator(); //select the first item $eg->sendKey('Right'); $eg->sendKeyPress('ctrl'); $eg->sendKey(' '); $eg->sendKeyRelease('ctrl'); while(Gtk::events_pending()) { Gtk::main_iteration(); } // Gtk::main(); } else { //prepare the test require_once(dirname(__FILE__) . '/bugconfig.php'); $handle = popen(PHP_EXECUTABLE . ' ' . __FILE__ . ' run 2>&1', 'r'); $lines = ''; while (!feof($handle)) { $lines .= fgets($handle, 4096); } pclose($handle); if (strlen($lines) == 0) { echo 'ok' . "\r\n"; } else if (strpos($lines, 'PHP Warning') !== false) { echo 'error' . "\r\n"; } else { echo 'unknown' . "\r\n"; } if ($argc > 1 && $argv[1] == 'debug') { var_dump($lines); } } ?>