On Wed, Feb 09, 2011 at 07:56:24PM +0800, Aaron Lewis wrote:
> Hi,
> I got two questions relating a GTK widget:
>
> 1. How can i get a window state ? i mean , a GTkWidget , i tried
> these code and didn't got a reply:
>
> void message_received_cb () {
> // I got this printed on screen
> g_print ( "Message Received , Starting up GUI" );
>
> switch ( gdk_window_get_state ( GDK_WINDOW(gpAppFrame->window)
> ) ) {
> case GDK_WINDOW_STATE_WITHDRAWN: g_print
> ("GDK_WINDOW_STATE_WITHDRAWN");
> case GDK_WINDOW_STATE_ICONIFIED: g_print
> ("GDK_WINDOW_STATE_ICONIFIED");
> case GDK_WINDOW_STATE_MAXIMIZED: g_print
> ("GDK_WINDOW_STATE_MAXIMIZED");
> case GDK_WINDOW_STATE_STICKY: g_print
> ("GDK_WINDOW_STATE_STICKY");
> case GDK_WINDOW_STATE_FULLSCREEN: g_print
> ("GDK_WINDOW_STATE_FULLSCREEN");
> case GDK_WINDOW_STATE_ABOVE: g_print
> ("GDK_WINDOW_STATE_ABOVE");
> case GDK_WINDOW_STATE_BELOW: g_print
> ("GDK_WINDOW_STATE_BELOW");
> }
This won't work because GdkWindowState is a set of *flags* so multiple
can be set at once (though some combinations are unlikely). You have to
test (state & GDK_WINDOW_STATE_ICONIFIED) for the iconified state, for
instance.
> 2. How can i force a program to be the "current" program , namely ,
> it didn't get the focus of user , and i want it to get the focus ,
> and make all other programs below it.
Probably you mean gtk_window_present().
Yeti
_______________________________________________
gtk-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-list