Kevin Ryde > Glib-Ex-ConnectProperties > Glib::Ex::ConnectProperties::Element::screen_size



Annotate this POD


View/Report Bugs
Module Version: 19   Source  


Glib::Ex::ConnectProperties::Element::screen_size -- screen size in pixels or millimetres


 Glib::Ex::ConnectProperties->new([$screen, 'screen-size#width'],
                                  [$another, 'something']);


This element class implements ConnectProperties access to the size of a a Gtk2::Gdk::Screen, either in pixels or millimetres.

    screen-size#width        integer pixels, read-only
    screen-size#height       integer pixels, read-only
    screen-size#width-mm     integer millimetres, read-only
    screen-size#height-mm    integer millimetres, read-only

These are $screen->get_width() etc.

screen-size#width and screen-size#height changes are noticed with the size-changed signal. In Gtk 2.14 screen-size#width-mm and screen-size#height-mm changes are noticed with the monitors-changed signal. Before Gtk 2.14 the millimetres don't change.

The size in pixels can change with the video mode. The size in millimetres can change from a RANDR or Xinerama rearrangement of output monitors. In all cases the sizes are read-only since Gtk2::Gdk::Screen doesn't have anything to perform video mode or monitor changes.

For example to display the width in a label,

    my $toplevel = Gtk2::Window->new('toplevel');
    my $screen = $toplevel->get_screen;

    # to display the size in some label widget
      ([$screen, 'screen-size#width'],
       [$label,  'label']);

For reference, under X the way Gtk2::Gdk::Window implements fullscreen() probably requires the window manager to notice screen size changes and keep the window full screen on a screen size change. Hopefully an application doesn't have to link screen-size# to the window size to keep full screen.


Glib::Ex::ConnectProperties, Glib::Ex::ConnectProperties::Element::widget_allocation, Gtk2::Gdk::Screen



Copyright 2010, 2011, 2012 Kevin Ryde

Glib-Ex-ConnectProperties is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

Glib-Ex-ConnectProperties is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Glib-Ex-ConnectProperties. If not, see

syntax highlighting: