Re: how to make a GTK widget get fully focus and how to get its window state ?



On 9 February 2011 22:56, Aaron Lewis <the warl0ck 1989 gmail com> 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:
>
>        // BEGIN CODE , it's for libunique , and gpAppFrame->window is an
>        // pointer for a GTKWidget
>
>        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");
>                }
>
>                gtk_widget_show ( gpAppFrame->window );

If this is the first time the widget is shown then it won't have any
of those states above because its not realised.

>        }
>
>        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.

You can't force it.
You can try grabbing focus on the top level window, but the window
manager doesn't *have* to take any notice so be sure you can live with
it failing.


Cheers
Lex

>
>        Many thanks for answering my stupid question if they really are ;-)
>
> --
> Best Regards,
> Aaron Lewis - PGP: 0xDFE6C29E ( http://http://pgp.mit.edu/ )
> Finger Print: 9482 448F C7C3 896C 1DFE 7DD3 2492 A7D0 DFE6 C29E
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]