[Gtk-sharp-list] event for window movement

John Luke jluke@users.sourceforge.net
Sun, 14 Mar 2004 13:55:23 -0500


--=-T3K3iMLIZnNiVIEkhphC
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Sun, 2004-03-14 at 13:31 -0500, John Luke wrote:

> On Sun, 2004-03-14 at 10:05 -0800, Ofer Achler wrote:
> 
> > Hello,
> > 
> > I'm trying to attach to an event that happens when a window is moved
> > (preferably when a widget is moved)
> > 
> > Configure_event doesn't do it, it seems to get called when a resize event
> > occurs or other things of that nature, but not when a window is moved.
> > 
> > My question is does such an event exist?
> > 
> > Thanks =)
> 
> I think configure_event is right for this:
> http://mail.gnome.org/archives/gtk-list/2003-April/msg00121.html
> 
> but it doesn't seem to ever be fired in Gtk#, so I think it is a bug.
> Attached is a small test.

mmarker let me know that this is apparently one of the situations where
Gdk is trapping the events and you need to use Gdk.EventMask.  However,
I added that and it still doesn't work.  Perhaps there is another
EventMask that I need or it is window manager dependent.  I'll leave it
up to others to decide.

new test attached

--=-T3K3iMLIZnNiVIEkhphC
Content-Disposition: attachment; filename=T.cs
Content-Type: text/x-csharp; name=T.cs; charset=utf-8
Content-Transfer-Encoding: 7bit

using System;
using Gtk;

class T
{
	static void Main ()
	{
		Application.Init ();
		Window win = new Window ("test");
		win.DeleteEvent += new DeleteEventHandler (OnDelete);
		win.ConfigureEvent += new ConfigureEventHandler (OnConfigure);

		win.AddEvents ((int) Gdk.EventMask.ExposureMask | (int) Gdk.EventMask.VisibilityNotifyMask | (int) Gdk.EventMask.AllEventsMask);

		win.ShowAll ();
		Application.Run ();
	}

	static void OnConfigure (object o, ConfigureEventArgs args)
	{
		Console.WriteLine ("moved?");
	}

	static void OnDelete (object o, DeleteEventArgs args)
	{
		Application.Quit ();
	}
}


--=-T3K3iMLIZnNiVIEkhphC--