Changeset 5154


Ignore:
Timestamp:
Feb 27, 2008, 8:30:51 PM (14 years ago)
Author:
charles
Message:

(gtk) #738: Clicking tray icon should show minimized main window

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/main.c

    r5143 r5154  
    225225}
    226226
     227static void
     228windowStateChanged( GtkWidget * widget UNUSED, GdkEventWindowState * event, gpointer gdata )
     229{
     230    if( event->changed_mask & GDK_WINDOW_STATE_ICONIFIED )
     231    {
     232        struct cbdata * cbdata = gdata;
     233        cbdata->minimized = ( event->new_window_state & GDK_WINDOW_STATE_ICONIFIED ) ? 1 : 0;
     234    }
     235}
     236
    227237int
    228238main( int argc, char ** argv )
     
    290300        /* create main window now to be a parent to any error dialogs */
    291301        GtkWindow * mainwind = GTK_WINDOW( tr_window_new( myUIManager, cbdata->core ) );
     302        g_signal_connect( mainwind, "window-state-event", G_CALLBACK(windowStateChanged), cbdata );
    292303
    293304        /* set message level here before tr_init() */
     
    441452{
    442453    GtkWindow * window = GTK_WINDOW( cbdata->wind );
    443     const int hide = cbdata->minimized = !cbdata->minimized;
     454    const int hide = !cbdata->minimized;
    444455    static int x=0, y=0;
    445456
Note: See TracChangeset for help on using the changeset viewer.