Skip to content

Instantly share code, notes, and snippets.

@bobmagicii
Created August 19, 2012 00:21
Show Gist options
  • Save bobmagicii/3390511 to your computer and use it in GitHub Desktop.
Save bobmagicii/3390511 to your computer and use it in GitHub Desktop.
<?php
class BobWindow extends GtkWindow {
public function __construct() {
parent::__construct();
$this->set_size_request(256,256);
$this->set_title('BobWindow');
$this->set_position(Gtk::WIN_POS_CENTER);
$this->connect_simple('delete-event',function(){
Gtk::main_quit();
return;
});
$this->connect_simple('configure-event',function(){
// this is where the problem is.
while(Gtk::events_pending() || Gdk::events_pending())
Gtk::main_iteration();
// with this.
list($w,$h) = $this->get_size();
list($x,$y) = $this->get_position();
echo "{$w}x{$h} @ {$x},{$y}", PHP_EOL;
return;
});
$this->show_all();
return;
}
}
$w = new BobWindow;
Gtk::main();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment