Re: Window Visibility Signal



On Mon, Jul 25, 2005 at 01:57:02PM -0600, Kevin DeKorte wrote:

Nice tip, but unfortunately the expose event does not signal when the object 
is covered up. Only when revealed. I even hooked "event" and "event-after" 
and nothing was emitted when I covered up the window. Only events were 
triggered when I moved the mouse into the window and out of it and clicks.

I'm not following this thread closely, so I'm sorry if
I missed something, but have you tried "visibility-notify-event"
signal?  See attached example.

Yeti


--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?


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

static gboolean
visibility(GtkWidget *widget,
           GdkEventVisibility *event)
{
    static const gchar *visibility_names[] = {
        "Fully visible", "Partially obscured", "Fully obscured",
    };

    g_printerr("%s (%p) visibility state: %s\n",
               g_type_name(G_TYPE_FROM_INSTANCE(widget)), widget,
               visibility_names[event->state]);
    return FALSE;
}

int
main(int argc, char *argv[])
{
    GtkWidget *window;

    gtk_init(&argc, &argv);
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_widget_add_events(window, GDK_VISIBILITY_NOTIFY_MASK);
    g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
    g_signal_connect(window, "visibility-notify-event",
                     G_CALLBACK(visibility), NULL);
    gtk_window_set_default_size(GTK_WINDOW(window), 320, 240);
    gtk_widget_show_all(window);
    gtk_main();

    return 0;
}



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