Dual/multi monitor support?

View: New views
3 Messages — Rating Filter:   Alert me  

Dual/multi monitor support?

by markdarb :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Is it possible to see/change which screen a window is displayed on in multi-monitor setups? I'd like to be able to do this for both fullscreen and normal windows.

The functions gtk_window_set_screen() and gtk_window_get_screen() listed at http://library.gnome.org/devel/gtk/unstable/GtkWindow.html are the sort of thing I'm looking for, but I haven't been able to find anything along those lines implemented in Gtk#.

Many thanks,
Mark.

Re: Dual/multi monitor support?

by Stephane Delcroix :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If by *screen* you mean *monitor* and you hav a single *sceen* splitted
on 2 *monitors*, you can do this:

//This will tell you on which monitor your window is on
Gdk.Screen screen = this.Screen;
int monitor = screen.GetMonitorAtWindow (parent.GdkWindow);

//Now, you can move it at will using Move (x, y), and it's easy to get
one monitor Bounds with:
Gdk.Rectangle bounds = screen.GetMonitorGeometry (monitor);

More info on
http://www.go-mono.com/docs/index.aspx?link=T%3aGdk.Screen%2f*

hot it helps

s



On Mon, 2009-09-07 at 01:15 -0700, markdarb wrote:

> Hi,
>
> Is it possible to see/change which screen a window is displayed on in
> multi-monitor setups? I'd like to be able to do this for both fullscreen and
> normal windows.
>
> The functions gtk_window_set_screen() and gtk_window_get_screen() listed at
> http://library.gnome.org/devel/gtk/unstable/GtkWindow.html are the sort of
> thing I'm looking for, but I haven't been able to find anything along those
> lines implemented in Gtk#.
>
> Many thanks,
> Mark.

_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@...
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Parent Message unknown Re: Dual/multi monitor support?

by markdarb :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Thanks for your helpful replies. They've set me on the right track
nicely (and of course reminded me of the difference between a screen
and a monitor).

Mark.

2009/9/7 Stephane Delcroix <stephane@...>

>
> If by *screen* you mean *monitor* and you hav a single *sceen* splitted
> on 2 *monitors*, you can do this:
>
> //This will tell you on which monitor your window is on
> Gdk.Screen screen = this.Screen;
> int monitor = screen.GetMonitorAtWindow (parent.GdkWindow);
>
> //Now, you can move it at will using Move (x, y), and it's easy to get
> one monitor Bounds with:
> Gdk.Rectangle bounds = screen.GetMonitorGeometry (monitor);
>
> More info on
> http://www.go-mono.com/docs/index.aspx?link=T%3aGdk.Screen%2f*
>
> hot it helps
>
> s


2009/9/7 Jason Smith <jassmith@...>

>
> Monitor != Screen;
>
> Those functions are mapped as Gtk.Window.Screen. But you know, as
> instance methods. To figure out what physical monitor a window is on
> (sounds like what you want). You do something like;
>
> Gdk.Rectangle geo;
> window.GetPosition (out geo.X, out geo.Y);
> window.GetSize (out geo.Width, out geo.Height);
>
> for (int i=0; i < window.Screen.NMonitors; i++) {
>        if (geo.IntersectsWith (window.Screen.GetMonitorGeometry (i)) {
>                Console.WriteLine ("Window on monitor " + i);
>                break;
>        }
> }
>
> I am doing this from memory, so the method names may not be exact, but
> thats the idea.
_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@...
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list