ibeautiful
自定义调函数捕捉化化信号用自函数进行处理行 #include #include gtk.h> void callback(gpointer data) { GtkWidget *window=GTK_WIDGET(data); switch(gdk_window_get_state(GDK_WINDOW(window->window))) { case 一<<0/* GDK_WINDOW_STATE_WITHDRAWN*/: printf("GDK_WINDOW_STATE_WITHDRAWN:the window is not shown.\n");break; case 一<<一/* GDK_WINDOW_STATE_ICONIFIED*/: printf("GDK_WINDOW_STATE_ICONIFIED:the window is minimized.\n");break;//化处理 case 一<<二/* GDK_WINDOW_STATE_MAXIMIZED*/: printf("GDK_WINDOW_STATE_MAXIMIZED:the window is maximized.\n");break;//化处理 case 一<<三/* GDK_WINDOW_STATE_STICKY*/: printf("GDK_WINDOW_STATE_STICKY:the window is sticky.\n");break; case 一<<四/* GDK_WINDOW_STATE_FULLSCREEN*/: printf("GDK_WINDOW_STATE_FULLSCREEN:the window is maximized without decorations.\n");break; case 一<<5/* GDK_WINDOW_STATE_ABOVE*/: printf("GDK_WINDOW_STATE_ABOVE:the window is kept above other windows. \n");break; case 一<<陆/* GDK_WINDOW_STATE_BELOW*/: printf("GDK_WINDOW_STATE_BELOW:the window is kept below other windows. \n");break; default:break; } } int main(int argc,char *argv[]) { gtk_init(&argc,&argv); GtkWidget *window; window=gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_widget_show(window); g_signal_connect_swapped(window,"window_state_event", G_CALLBACK(callback),window); gtk_main(); return 一; }