+void Panel::button_press(int x, int y, unsigned btn)
+{
+ if(pointer_grab>0)
+ pointer_focus->button_press(x-geom.x, y-geom.y, btn);
+ else if(geom.is_inside(x, y))
+ {
+ if(Widget *wdg=get_child_at(x, y))
+ {
+ wdg->button_press(x-geom.x, y-geom.y, btn);
+ pointer_grab=btn;
+ set_input_focus(wdg);
+ }
+ }
+}
+
+void Panel::button_release(int x, int y, unsigned btn)
+{
+ if(pointer_grab>0)
+ {
+ pointer_focus->button_release(x-geom.x, y-geom.y, btn);
+
+ if(btn==pointer_grab)
+ {
+ pointer_grab=0;
+
+ set_pointer_focus(get_child_at(x, y));
+ }
+ }
+ else if(geom.is_inside(x, y))
+ {
+ if(Widget *wdg=get_child_at(x, y))
+ wdg->button_release(x-geom.x, y-geom.y, btn);
+ }
+}
+
+void Panel::pointer_motion(int x, int y)
+{
+ if(pointer_grab>0)
+ pointer_focus->pointer_motion(x-geom.x, y-geom.y);
+ else if(geom.is_inside(x, y))
+ {
+ Widget *wdg=get_child_at(x, y);
+ set_pointer_focus(wdg);
+ if(wdg)
+ wdg->pointer_motion(x-geom.x, y-geom.y);
+ }
+}
+
+void Panel::key_press(unsigned key, unsigned mod, wchar_t ch)
+{
+ if(input_focus)
+ input_focus->key_press(key, mod, ch);
+}
+
+void Panel::key_release(unsigned key, unsigned mod)
+{
+ if(input_focus)
+ input_focus->key_release(key, mod);
+}
+
+void Panel::focus_out()
+{
+ set_input_focus(0);
+}
+