Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mono winforms app fullscreen in Ubuntu?

Just wondering if there's a known way of getting a Mono System.Windows.Forms application to go fullscreen on Ubuntu/Gnome.

Mono is 2.4.2.3 Ubuntu is 9.10

Doing it on Windows requires a pinvoke, clearly not going to work here.

This is what I get setting window border to none, window position to centre, and state to maximised:

alt text http://dl.dropbox.com/u/116092/misc/permalink/joggler/screenshot01.png

Update.

Have also tried:

  • this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
    this.WindowState = System.Windows.Forms.FormWindowState.Maximized;

  • CTRL-F11

  • Text = string.Empty; // No caption
    MaximizeBox = false;
    MinimizeBox = false;
    ControlBox = false;
    FormBorderStyle = None;
    WindowState = Maximized;

  • FormBorderStyle = FormBorderStyle.None;
    Location = new Point(0, 0);
    Size = Screen.PrimaryScreen.Bounds.Size;

All of which I end up with the same result.

I have come across a lead which involves a pinvoke involving _NET_WM_STATE_FULLSCREEN but that's as far as I've got with it. Any pointers on that would be appreciated.

like image 921
tomfanning Avatar asked May 12 '10 22:05

tomfanning


3 Answers

_NET_WM_STATE_FULLSCREEN will just get rid of the borders. The GNOME panel will still appear.

According to the following post, the secret is to get rid of the minimum/maximum sizes so that the window manager does the resizing itself:

http://linux.derkeiler.com/Mailing-Lists/GNOME/2010-01/msg00035.html

Here is some documentation on the native spec:

http://standards.freedesktop.org/wm-spec/wm-spec-latest.html

http://www.x.org/docs/ICCCM/icccm.pdf

To talk directly to the X Window System you have to pinvoke into XLib. In order to send something like _NET_WM_STATE_FULLSCREEN you have to have a pointer to the window and also to the display.

I am not sure how to find the display but I can help with a pointer to the window. When running on X, the property Form.Handle should be a pointer to the X window.

like image 128
Justin Avatar answered Oct 11 '22 22:10

Justin


Not sure what you mean by "Full Screen" - but I've written several Windows.Forms applications that take over the screen, and without a single PInvoke.

Here's how I configure my main form ...

Text = string.Empty; // No caption
MaximizeBox = false;
MinimizeBox = false;
ControlBox = false;
FormBorderStyle = None;
WindowState = Maximized;

Optionally,

TopMost = true;

Hope this helps.

like image 24
Bevan Avatar answered Oct 11 '22 23:10

Bevan


You need to disable visual effects in ubuntu.

edit: And make sure your form size is at least screen resolution without borders. If borders are on design time and you are removing them in code you will need something like 1030x796 for a 1024x768 display.

like image 33
lars Avatar answered Oct 11 '22 23:10

lars