+ static FunctionFlags saved_func;
+ static DecorationFlags saved_decor;
+ static otk::Rect saved_area;
+ static otk::Point saved_logical_size;
+
+ if (!(_functions & Func_Fullscreen) || // can't
+ _fullscreen == fs) return; // already done
+
+ _fullscreen = fs;
+ changeState(); // change the state hints on the client
+
+ if (fs) {
+ // save the functions and remove them
+ saved_func = _functions;
+ _functions = _functions & (Func_Close | Func_Fullscreen | Func_Iconify);
+ // save the decorations and remove them
+ saved_decor = _decorations;
+ _decorations = 0;
+ // save the area and adjust it (we don't call internal resize here for
+ // constraints on the size, etc, we just make it fullscreen).
+ saved_area = _area;
+ const otk::ScreenInfo *info = otk::display->screenInfo(_screen);
+ _area.setRect(0, 0, info->width(), info->height());
+ saved_logical_size = _logical_size;
+ _logical_size.setPoint((info->width() - _base_size.x()) / _size_inc.x(),
+ (info->height() - _base_size.y()) / _size_inc.y());
+ } else {
+ _functions = saved_func;
+ _decorations = saved_decor;
+ _area = saved_area;
+ _logical_size = saved_logical_size;
+ }
+
+ changeAllowedActions(); // based on the new _functions
+
+ frame->adjustSize(); // drop/replace the decor's and resize
+ frame->adjustPosition(); // get (back) in position!
+
+ // raise (back) into our stacking layer
+ openbox->screen(_screen)->raiseWindow(this);
+
+ // try focus us when we go into fullscreen mode
+ if (fs) focus();
+}
+
+
+bool Client::focus() const
+{
+ // won't try focus if the client doesn't want it, or if the window isn't
+ // visible on the screen
+ if (!(frame->isVisible() && (_can_focus || _focus_notify))) return false;
+