Gtk2-Ex-WidgetCursor
view release on metacpan or search on metacpan
lib/Gtk2/Ex/WidgetCursor.pm view on Meta::CPAN
658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707sub
Gtk2::TextView::Gtk2_Ex_WidgetCursor_hack_restore {
my
(
$widget
) =
@_
;
return
$widget
->sensitive && (
$widget
->get_window(
'text'
),
'xterm'
);
}
# GtkEntry's extra subwindow is included here. And when sensitive it should
# be put back to an insertion point. For a bit of safety use list context
# etc to allow for no subwindows, since it's undocumented.
#
# In Gtk 2.14 the SpinButton sub-class has the arrow panel as a subwindow
# too (instead of an overlay in Gtk 2.12 and earlier). So look for the
# smaller height one among multiple subwindows.
#
sub
Gtk2::Entry::Gtk2_Ex_WidgetCursor_windows {
my
(
$widget
) =
@_
;
my
$win
=
$widget
->window ||
return
;
# if unrealized
return
(
$win
,
$win
->get_children);
}
sub
Gtk2::Entry::Gtk2_Ex_WidgetCursor_hack_restore {
my
(
$widget
) =
@_
;
$widget
->sensitive or
return
;
my
$win
=
$widget
->window ||
return
;
# if unrealized
my
@children
=
$win
->get_children;
# by increasing height
@children
=
sort
{(
$a
->get_size)[1] <=> (
$b
->get_size)[1]}
@children
;
return
(
$children
[0],
'xterm'
);
}
# GtkSpinButton's extra "panel" overlay window either as a "sibling" (which
# also finds the main window) for Gtk 2.12 or in the get_children() for Gtk
# 2.13; plus the GtkEntry subwindow as per GtkEntry above. hack_restore()
# inherited from GtkEntry above.
#
sub
Gtk2::SpinButton::Gtk2_Ex_WidgetCursor_windows {
my
(
$widget
) =
@_
;
my
$win
=
$widget
->window ||
return
;
# if unrealized
return
(_widget_sibling_windows (
$widget
),
$win
->get_children);
}
# GtkButton secret input-only "event_window" overlay found as a "sibling".
#
sub
Gtk2::Button::Gtk2_Ex_WidgetCursor_windows {
my
(
$widget
) =
@_
;
return
_widget_sibling_windows (
$widget
);
}
# _widget_sibling_windows() returns a list of the "sibling" windows of
# $widget. This means all the windows which are under $widget's parent and
# have their events directed to $widget. If $widget is a windowed widget
# then this will include its main $widget->window (or should do).
( run in 0.241 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )