From: morty Date: Wed, 17 Nov 2010 10:46:15 +0000 (+0100) Subject: Hide on minimize X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/snom-frontend/commitdiff_plain/4a90cf98b35fa475c9098709bf49023764ee8e9d?ds=sidebyside;hp=2b127e29cae4de25b8fb79f05e0ef3d29df2538c Hide on minimize --- diff --git a/snom.pl b/snom.pl old mode 100755 new mode 100644 index 608e62f..bc0cdac --- a/snom.pl +++ b/snom.pl @@ -113,6 +113,8 @@ my $window = Gtk2::Window->new('toplevel'); $window->set_title("snom"); $window->signal_connect(delete_event => \&CloseAppWindow); $window->signal_connect(destroy => sub { Gtk2->main_quit; }); + + my $kphandler = $window->signal_connect(key_press_event => \&KBDInput); $window->set_border_width(15); $window->set_resizable(FALSE); @@ -234,6 +236,15 @@ sub activate_icon_cb { } } +sub minimize_to_try{ + my ($w, $event) = @_; + if ($event->changed_mask & [ 'iconified', ]){ + $window->hide(); + # Needs to be deiconified after hiding, otherwise show will not behave as expected. + $window->deiconify(); + } +} + my $status_icon = Gtk2::StatusIcon->new_from_file($Bin.'/snom.ico'); my $menu = Gtk2::Menu->new(); @@ -245,6 +256,9 @@ $status_icon->set_tooltip('Snom Tray'); $status_icon->signal_connect('activate', \&activate_icon_cb); $status_icon->signal_connect('popup-menu', \&popup_menu_cb, $menu); $status_icon->set_visible(1); + +$window->signal_connect('window-state-event',\&minimize_to_try); + ########################################################################333 $window->add($mainbox);