X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fclient.cc;h=8f6549085f772e2bf43f85bf01a9e70b3de781d4;hb=f92804ec20cb51d8656887ea9a78d68a06b1f02a;hp=4637307767b3aa7bb8b2810f72c8216ee229db54;hpb=98f05a5c962c1f0a4d418d30f45f219ef4d9c200;p=chaz%2Fopenbox diff --git a/src/client.cc b/src/client.cc index 46373077..8f654908 100644 --- a/src/client.cc +++ b/src/client.cc @@ -66,12 +66,14 @@ Client::Client(int screen, Window window) updateProtocols(); - // got the type, the mwmhints, and the protocols, so we're ready to set up + getGravity(); // get the attribute gravity + updateNormalHints(); // this may override the attribute gravity + + // got the type, the mwmhints, the protocols, and the normal hints (min/max + // sizes), so we're ready to set up // the decorations/functions setupDecorAndFunctions(); - getGravity(); // get the attribute gravity - updateNormalHints(); // this may override the attribute gravity // also get the initial_state and set _iconic if we aren't "starting" // when we're "starting" that means we should use whatever state was already // on the window over the initial map state, because it was already mapped @@ -220,8 +222,8 @@ void Client::setupDecorAndFunctions() _functions |= Func_Close; } - if (_min_size.x() > _max_size.x() || _min_size.y() > _max_size.y()) { - _decorations &= ~Decor_Maximize; + if (!(_min_size.x() < _max_size.x() || _min_size.y() < _max_size.y())) { + _decorations &= ~(Decor_Maximize | Decor_Handle); _functions &= ~(Func_Resize | Func_Maximize); } @@ -230,6 +232,7 @@ void Client::setupDecorAndFunctions() // normal windows retain all of the possible decorations and // functionality, and are the only windows that you can fullscreen _functions |= Func_Fullscreen; + break; case Type_Dialog: // dialogs cannot be maximized @@ -307,6 +310,10 @@ void Client::setupDecorAndFunctions() if (_disabled_decorations & Decor_Close) _decorations &= ~Decor_Close; + // You can't shade without a titlebar + if (!(_decorations & Decor_Titlebar)) + _functions &= ~Func_Shade; + changeAllowedActions(); if (frame) { @@ -887,6 +894,7 @@ void Client::setState(StateAction action, long data1, long data2) if (shadestate != _shaded) shade(shadestate); calcLayer(); + changeState(); // change the hint to relect these changes } @@ -897,7 +905,8 @@ void Client::toggleClientBorder(bool addborder) // different position. // when re-adding the border to the client, the same operation needs to be // reversed. - int x = _area.x(), y = _area.y(); + int oldx = _area.x(), oldy = _area.y(); + int x = oldx, y = oldy; switch(_gravity) { default: case NorthWestGravity: @@ -946,7 +955,8 @@ void Client::toggleClientBorder(bool addborder) XSetWindowBorderWidth(**otk::display, _window, _border_width); // move the client so it is back it the right spot _with_ its border! - XMoveWindow(**otk::display, _window, x, y); + if (x != oldx || y != oldy) + XMoveWindow(**otk::display, _window, x, y); } else XSetWindowBorderWidth(**otk::display, _window, 0); } @@ -1140,15 +1150,23 @@ void Client::internal_move(int x, int y) event.xconfigure.display = **otk::display; event.xconfigure.event = _window; event.xconfigure.window = _window; - event.xconfigure.x = x; - event.xconfigure.y = y; + + // root window coords with border in mind + event.xconfigure.x = x - _border_width + frame->size().left; + event.xconfigure.y = y - _border_width + frame->size().top; + event.xconfigure.width = _area.width(); event.xconfigure.height = _area.height(); event.xconfigure.border_width = _border_width; - event.xconfigure.above = frame->window(); + event.xconfigure.above = frame->plate(); event.xconfigure.override_redirect = False; XSendEvent(event.xconfigure.display, event.xconfigure.window, False, StructureNotifyMask, &event); +#if 0//def DEBUG + printf("Sent synthetic ConfigureNotify %d,%d %d,%d to 0x%lx\n", + event.xconfigure.x, event.xconfigure.y, event.xconfigure.width, + event.xconfigure.height, event.xconfigure.window); +#endif } } @@ -1186,7 +1204,7 @@ void Client::changeState() state[1] = None; otk::Property::set(_window, otk::Property::atoms.wm_state, otk::Property::atoms.wm_state, state, 2); - + Atom netstate[10]; int num = 0; if (_modal)