+
+void
+TearOff::set_state (const XMLNode& node)
+{
+ Glib::RefPtr<Gdk::Window> win;
+ XMLProperty const * prop;
+
+ if ((prop = node.property (X_("tornoff"))) == 0) {
+ return;
+ }
+
+ if (prop->value() == "yes") {
+ tear_it_off ();
+ } else {
+ put_it_back ();
+ }
+
+ if ((prop = node.property (X_("width"))) != 0) {
+ sscanf (prop->value().c_str(), "%d", &own_window_width);
+ }
+ if ((prop = node.property (X_("height"))) != 0) {
+ sscanf (prop->value().c_str(), "%d", &own_window_height);
+ }
+ if ((prop = node.property (X_("xpos"))) != 0) {
+ sscanf (prop->value().c_str(), "%d", &own_window_xpos);
+ }
+ if ((prop = node.property (X_("ypos"))) != 0) {
+ sscanf (prop->value().c_str(), "%d", &own_window_ypos);
+ }
+
+ if (own_window.is_realized()) {
+ own_window.set_default_size (own_window_width, own_window_height);
+ own_window.move (own_window_xpos, own_window_ypos);
+ }
+ /* otherwise do it once the window is realized, see below */
+}
+
+void
+TearOff::own_window_realized ()
+{
+ own_window.get_window()->set_decorations (WMDecoration (DECOR_BORDER|DECOR_RESIZEH));
+
+ if (own_window_width > 0) {
+ own_window.set_default_size (own_window_width, own_window_height);
+ own_window.move (own_window_xpos, own_window_ypos);
+ }
+}
+
+bool
+TearOff::own_window_configured (GdkEventConfigure*)
+{
+ Glib::RefPtr<const Gdk::Window> win;
+
+ win = own_window.get_window ();
+
+ if (win) {
+ win->get_size (own_window_width, own_window_height);
+ win->get_position (own_window_xpos, own_window_ypos);
+ }
+
+ return false;
+}
+
+void
+TearOff::hide_visible ()
+{
+ if (torn_off()) {
+ own_window.hide ();
+ }
+
+ hide ();
+}
+
+