Hello all,

I'm trying to accomplish the apparently simple task of creating a GTK window that's the size I want it to be, and not the size the desktop environment wants it to be.

I'm working with the Perl-GTK bindings on an Ubuntu box, but I'm really looking for solutions that will work on a range of different OSs.

Can anyone point me in the right direction with the following problems?

1. How can I get the actual available size of the desktop? The following code gives the maximum resolution, but the size of the desktop actually available to my GTK windows is somewhat less (it is reduced by one taskbar in Windows; by two in Ubuntu.)

my $screen = $windowHandle->get_screen; my $width = $screen->get_width; my $height = $screen->get_height;

2. The following code creates a window and resizes it. However, the specified size seems to be applied only to the window's client area, not the whole window. (Example: ff the client area is 300x200, the actual size of the window is likely to be something like 300x215.)

my $windowHandle = Gtk2::Window->new('toplevel'); $windowHandle->signal_connect('delete_event' => sub { exit; }); windowHandle->resize($self->currentWidth, $self->currentHeight);

My question is, how can I resize the window, so that it is actually 300x200?

3. I've found that GTK windows like to resize themselves whenever they feel the need. One particularly annoying example is a window containing a scrollwindow, which contains a textview. Word wrapping is turned on, but as soon as the first text is written, the width of the window increases by about 4 pixels.

Is there a general (meaning, 'elegant') way to discourage GTK windows from resizing themselves?


In reply to gtk window sizes by ronlewis

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.