Re: Window Visibility Signal

2005-07-25 Thread Tristan Van Berkom

Kevin DeKorte wrote:

What Signal is issued when a window becomes visible or invisible.

Say I have a window and other window covers it up, is there signal that is 
emitted or if a window is uncovered?


You'll recieve expose-event whenever X needs to redraw a widget,
I think that in cases where the window is actualy presented
(like with `gtk_window_present()') you'll recieve focus-in-event
on the toplevel.

Cheers,
 -Tristan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Window Visibility Signal

2005-07-25 Thread Kevin DeKorte
On Monday 25 July 2005 12:22 pm, Tristan Van Berkom wrote:
 Kevin DeKorte wrote:
  What Signal is issued when a window becomes visible or invisible.
 
  Say I have a window and other window covers it up, is there signal that
  is emitted or if a window is uncovered?

 You'll recieve expose-event whenever X needs to redraw a widget,
 I think that in cases where the window is actualy presented
 (like with `gtk_window_present()') you'll recieve focus-in-event
 on the toplevel.


Tristan,

Expose is no problem, but what about when it is hid? basically I want 
to know 
when the window is hid, so I don't draw to it.

Kevin
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Window Visibility Signal

2005-07-25 Thread Zeeshan Ali
Hello,

 Expose is no problem, but what about when it is hid? basically I want 
 to know
 when the window is hid, so I don't draw to it.

   If you only want to check if a widget is visible or not at a
particular time, you'll need to check for the 'visible' property of
the widget. Moreover, 'expose' signal is called for both the cases
(show and hide). If you choose to go the 'expose' way then connect
your handler using g_signal_connect_after().

-- 
Regards,

Zeeshan Ali
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Window Visibility Signal

2005-07-25 Thread Kevin DeKorte
On Monday 25 July 2005 12:38 pm, Zeeshan Ali wrote:
 Hello,

  Expose is no problem, but what about when it is hid? basically I
  want to know when the window is hid, so I don't draw to it.

If you only want to check if a widget is visible or not at a
 particular time, you'll need to check for the 'visible' property of
 the widget. Moreover, 'expose' signal is called for both the cases
 (show and hide). If you choose to go the 'expose' way then connect
 your handler using g_signal_connect_after().

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.

The code is doing the following...

Runs an external process in a thread and what I want is that when the 
window 
is covered up, I want to pause the external process (I can do this via a 
pipe). When the window is revealed I want the external process to continue 
on. Which I then can send it another signal via the pipe. So the code is not 
a loop while it is paused. So I can't check at a regular interval to wake it 
up.

I was hoping I could get signals to tell me when the window was revealed or 
not so that I could pause for example when a screen saver is kicked off. Or 
someone switches to another window because something more important came up.

Kevin
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Window Visibility Signal

2005-07-25 Thread Zeeshan Ali
Hello,

 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.

Try visibility-notify-event and try all the other (likely)
signals of GtkWidget documented in the gtk+ reference manual please if
this doens't work either.

Regards,

Zeeshan Ali
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Window Visibility Signal

2005-07-25 Thread David Necas (Yeti)
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;
}
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Window Visibility Signal

2005-07-25 Thread Tristan Van Berkom

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 found what your looking for :)

http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#GtkWidget-visibility-notify-event
http://developer.gnome.org/doc/API/2.0/gdk/gdk-Event-Structures.html#GdkEventVisibility
http://developer.gnome.org/doc/API/2.0/gdk/gdk-Event-Structures.html#GdkVisibilityState

Cheers,
 -Tristan
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Window Visibility Signal

2005-07-25 Thread Kevin DeKorte
On Monday 25 July 2005 02:11 pm, David Necas (Yeti) wrote:
 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.


Ah! sample code is good... had been trying the visibility-notify-event, but it 
didn't work then I saw the add_events call and I went ... doh! Added that 
and it works almost how I want it, is there another event I should be looking 
for as well? Switching desktops and minimizing does not seem to pop the 
event, but this is pretty close. Covering up the window does work..

Kevin


___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list