Thanks, I finally figured it out, boy is it a weird and hostile api, in
Java I have straightforward window iconify/deiconify events, I don't have
to know/figure out to decrypt old and new event states.
Here:
bool
Window::stateEvent(GdkEventWindowState *pEvent) {
const int state = pEvent->new_window_state;
const int changed = pEvent->changed_mask;
if(changed & GDK_WINDOW_STATE_ICONIFIED) {
if(state & GDK_WINDOW_STATE_ICONIFIED) {
printf("iconified\n");
} else {
printf("deiconified\n");
}
}
return false;
}
On Sun, Dec 23, 2012 at 5:38 PM, Kjell Ahlstedt <[email protected]
> wrote:
> 2012-12-23 10:02, Jiergir Ogoerg skrev:
>
> Hi,
>> There are methods for iconify()ing (minimizing) and deiconify()ing a
>> window, but there are no obvious signals to get these events.
>> I found here[1] how to get the iconify event, but how do I get the
>> deiconify event?
>>
>> I need 4 events (window hide/show/iconified/**deiconified events), to
>> make my app smart enough to not bother repainting if it's not visible.
>>
>> Hide/show detects when the window goes to/from the system tray or when it
>> initially appears.
>>
>> Iconify/deiconify (on Ubuntu) happen when the app goes to/from the left
>> vertical bar by clicking the minimize window button and respectively by
>> clicking its icon in the left vertical bar.
>>
>>
>> [1]
>> http://cubicarch.wordpress.**com/2012/06/11/hide-minimized-**
>> window-cgtkmm/<http://cubicarch.wordpress.com/2012/06/11/hide-minimized-window-cgtkmm/>
>>
>>
>> I think Gtk::Widget::signal_hide(), Gtk::Widget::signal_show() and
> Gtk::Widget::signal_window_**state_event() is all you need. A handler of
> signal_window_state_event() takes a GdkEventWindowState* argument, and that
> structure contains 'changed_mask' and 'new_window_state' which show what
> has changed, and how it has changed. I haven't used this signal myself, but
> the documentation says it's emitted both when the window is iconified and
> when it's deiconified. See the documentation of Gtk::Window::iconify() and
> Gtk::Window::deiconify() at
> http://developer.gnome.org/**gtkmm/stable/classGtk_1_**1Window.html<http://developer.gnome.org/gtkmm/stable/classGtk_1_1Window.html>
>
> The test
> if (event->new_window_state==GDK_**WINDOW_STATE_ICONIFIED)
> in the page you link to, seems unsafe. new_window_state contains bit
> flags, and I suppose more than one flag can be set.
> If you want to test one of the flags, this is better:
> if (event->new_window_state & GDK_WINDOW_STATE_ICONIFIED)
>
> Possibly you need only signal_window_state_event().
> GdkEventWindowState::new_**window_state can also contain the flag
> GDK_WINDOW_STATE_WITHDRAWN, which means "the window is not shown." Probably
> that means it's hidden.
>
> Kjell
>
>
_______________________________________________
gtkmm-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gtkmm-list