Re: Creating a non-focused window



Tom Machinski wrote:
On Fri, May 23, 2008 at 9:52 AM, Brian J. Tarricone <bjt23 cornell edu>
wrote:

Well, it works here, using straight C.  I don't really know Python, so I
can't really say why it wouldn't work there.


Thanks a lot Brian. Could you perchance paste the code you used?  If this is
a bug in PyGTK, it would help to have a reference working implementation.

Hmm, when I write basically the same thing as your Python implementation in C, I get the same result as you -- the window grabs focus when it's shown.

However, another (much larger) piece of code I've written, xfdesktop (Xfce's desktop manager), works fine. Maybe that has something to do with the fact that the window has a GTK_WINDOW_TYPE_HINT_DESKTOP set rather than just being a normal window... not sure. Gtk bug, maybe?

The docs
(http://library.gnome.org/devel/gtk/stable/GtkWindow.html#gtk-window-set-focus-on-map)
seem to indicate it should work as we'd like it to, though of course the WM is free to ignore the hint. I'd be surprised if they did, though.

Checking xprop output for both my focus-stealing window and my non-focus-stealing desktop, they look pretty much the same (aside from the window type hint). Odd.

-----
#include <gtk/gtk.h>

int main(int argc, char **argv)
{
    GtkWidget *win;

    gtk_init(&argc, &argv);

    win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_focus_on_map(GTK_WINDOW(win), FALSE);
    gtk_widget_set_size_request(win, 300, 300);
    gtk_widget_show(win);

    gtk_main();

    return 0;
}
-----

        -brian




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