NAME

Gtk2::Ex::WidgetBits - miscellaneous Gtk widget helpers

SYNOPSIS

use Gtk2::Ex::WidgetBits;

FUNCTIONS

($x,$y) = Gtk2::Ex::WidgetBits::get_root_position ($widget)

Return the position of the top left corner of $widget in root window coordinates. If $widget is unrealized the return is an empty list ().

This uses Gtk2::Ex::GdkBits::window_get_root_position so takes the most recently recorded window positions rather than making an X server round-trip.

Gtk2::Ex::WidgetBits::warp_pointer ($widget, $x, $y)

Warp, ie. forcibly move, the mouse pointer to $x,$y in $widget coordinates (ie. relative to the widget's top-left corner). $widget must be realized, since otherwise it doesn't have a screen position.

See Gtk2::Gdk::Display for the basic warp_pointer which operates in root window coordinates. The code here converts using get_root_position above, so there's no server round-trip. Warping is available in Gtk 2.2 up.

(The underlying XWarpPointer operates relative to any window, not just the root, but Gdk doesn't make that feature available.)

$mm = Gtk2::Ex::WidgetBits::xy_distance_mm ($widget, $x1,$y1, $x2,$y2)

Return the distance in millimetres between pixel points $x1,$y1 and $x2,$y2 in $widget.

Pixels are converted to millimetres using the screen size from Gtk2::Gdk::Screen. $widget must have been added into a toplevel widget hierarchy (eg. Gtk2::Window), since the toplevel widget determines the screen.

SEE ALSO

Gtk2::Ex::EntryBits, Gtk2::Ex::GdkBits, Gtk2::Ex::MenuBits, Gtk2::Ex::TextBufferBits, Gtk2::Ex::TreeModelBits, Gtk2::Ex::TreeModel::ImplBits, Gtk2::Ex::TreeViewBits, Gtk2::Ex::Units

Gtk2::Ex::ActionTooltips, Gtk2::Ex::KeySnooper, Gtk2::Ex::SyncCall, Gtk2::Ex::Statusbar::MessageUntilKey, Gtk2::Ex::TreeModelFilter::Change, Test::Weaken::Gtk2

Gtk2::Widget, Gtk2::Ex::WidgetCursor.

HOME PAGE

http://user42.tuxfamily.org/gtk2-ex-widgetbits/index.html

LICENSE

Copyright 2008, 2009, 2010 Kevin Ryde

Gtk2-Ex-WidgetBits 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.

Gtk2-Ex-WidgetBits 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 Gtk2-Ex-WidgetBits. If not, see http://www.gnu.org/licenses/.