+ if (!(_functions & Func_Fullscreen) || // can't
+ _fullscreen == fs) return; // already done
+
+ _fullscreen = fs;
+ changeState(); // change the state hints on the client
+
+ int x = _area.x(), y = _area.y(), w = _area.width(), h = _area.height();
+
+ 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;
+ if (savearea) {
+ long dimensions[4];
+ dimensions[0] = _area.x();
+ dimensions[1] = _area.y();
+ dimensions[2] = _area.width();
+ dimensions[3] = _area.height();
+ otk::Property::set(_window, otk::Property::atoms.openbox_premax,
+ otk::Property::atoms.cardinal,
+ (long unsigned*)dimensions, 4);
+ }
+ const otk::ScreenInfo *info = otk::display->screenInfo(_screen);
+ x = 0;
+ y = 0;
+ w = info->size().width();
+ h = info->size().height();
+ } else {
+ _functions = saved_func;
+ _decorations = saved_decor;
+
+ long *dimensions;
+ long unsigned n = 4;
+
+ if (otk::Property::get(_window, otk::Property::atoms.openbox_premax,
+ otk::Property::atoms.cardinal, &n,
+ (long unsigned**) &dimensions)) {
+ if (n >= 4) {
+ x = dimensions[0];
+ y = dimensions[1];
+ w = dimensions[2];
+ h = dimensions[3];
+ }
+ delete dimensions;
+ } else {
+ // pick some fallbacks...
+ const otk::Rect &a = openbox->screen(_screen)->area(_desktop);
+ x = a.x() + a.width() / 4;
+ y = a.y() + a.height() / 4;
+ w = a.width() / 2;
+ h = a.height() / 2;
+ }
+ }
+
+ changeAllowedActions(); // based on the new _functions
+
+ // when fullscreening, don't obey things like increments, fill the screen
+ internal_resize(TopLeft, w, h, !fs, x, y);
+
+ // raise (back) into our stacking layer
+ openbox->screen(_screen)->raiseWindow(this);
+
+ // try focus us when we go into fullscreen mode
+ if (fs) focus();
+}
+
+void Client::iconify(bool iconic, bool curdesk)
+{
+ if (_iconic == iconic) return; // nothing to do
+
+#ifdef DEBUG
+ printf("%sconifying window: 0x%lx\n", (iconic ? "I" : "Uni"), _window);
+#endif
+
+ _iconic = iconic;
+
+ if (_iconic) {
+ _wmstate = IconicState;
+ ignore_unmaps++;
+ // we unmap the client itself so that we can get MapRequest events, and
+ // because the ICCCM tells us to!
+ XUnmapWindow(**otk::display, _window);
+ } else {
+ if (curdesk)
+ setDesktop(openbox->screen(_screen)->desktop());
+ _wmstate = NormalState;
+ XMapWindow(**otk::display, _window);
+ }
+ changeState();
+ showhide();
+ openbox->screen(_screen)->updateStruts();
+}
+
+void Client::disableDecorations(DecorationFlags flags)
+{
+ _disabled_decorations = flags;
+ setupDecorAndFunctions();
+}
+
+void Client::installColormap(bool install) const
+{
+ XWindowAttributes wa;
+ if (XGetWindowAttributes(**otk::display, _window, &wa)) {
+ if (install)
+ XInstallColormap(**otk::display, wa.colormap);
+ else
+ XUninstallColormap(**otk::display, wa.colormap);
+ }