summaryrefslogtreecommitdiff
path: root/src/client.cc
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-01-17 07:45:07 +0000
committerDana Jansens <danakj@orodu.net>2003-01-17 07:45:07 +0000
commit105e3524a3f6b526d54ecc761a6e6c91b04f3949 (patch)
treea50371d361db488363606d721cd696a56e33bc4f /src/client.cc
parent8be4541461ba04f41eb5c40852be351f35fa18ee (diff)
add internal_move/resize and wrap them with move() and resize() which are for user use, and make sure that the window is allowed to be moved/resized.
add the allowed actions hint setting.
Diffstat (limited to 'src/client.cc')
-rw-r--r--src/client.cc50
1 files changed, 44 insertions, 6 deletions
diff --git a/src/client.cc b/src/client.cc
index 1c411adb..e8a6b84b 100644
--- a/src/client.cc
+++ b/src/client.cc
@@ -234,7 +234,7 @@ void Client::setupDecorAndFunctions()
}
}
- // XXX: changeAllowedActions();
+ changeAllowedActions();
}
@@ -901,7 +901,14 @@ void Client::shapeHandler(const XShapeEvent &e)
#endif
-void Client::resize(Corner anchor, int w, int h, int x, int y)
+void Client::resize(Corner anchor, int w, int h)
+{
+ if (!(_functions & Func_Resize)) return;
+ internal_resize(anchor, w, h);
+}
+
+
+void Client::internal_resize(Corner anchor, int w, int h, int x, int y)
{
w -= _base_size.x();
h -= _base_size.y();
@@ -963,12 +970,19 @@ void Client::resize(Corner anchor, int w, int h, int x, int y)
// resize the frame to match the request
frame->adjustSize();
- move(x, y);
+ internal_move(x, y);
}
void Client::move(int x, int y)
{
+ if (!(_functions & Func_Move)) return;
+ internal_move(x, y);
+}
+
+
+void Client::internal_move(int x, int y)
+{
_area.setPos(x, y);
// move the frame to be in the requested position
@@ -1058,6 +1072,30 @@ void Client::changeState()
}
+void Client::changeAllowedActions(void)
+{
+ Atom actions[7];
+ int num = 0;
+
+ actions[num++] = otk::Property::atoms.net_wm_action_shade;
+ actions[num++] = otk::Property::atoms.net_wm_action_change_desktop;
+
+ if (_functions & Func_Close)
+ actions[num++] = otk::Property::atoms.net_wm_action_close;
+ if (_functions & Func_Move)
+ actions[num++] = otk::Property::atoms.net_wm_action_move;
+ if (_functions & Func_Resize)
+ actions[num++] = otk::Property::atoms.net_wm_action_resize;
+ if (_functions & Func_Maximize) {
+ actions[num++] = otk::Property::atoms.net_wm_action_maximize_horz;
+ actions[num++] = otk::Property::atoms.net_wm_action_maximize_vert;
+ }
+
+ otk::Property::set(_window, otk::Property::atoms.net_wm_allowed_actions,
+ otk::Property::atoms.atom, actions, num);
+}
+
+
void Client::shade(bool shade)
{
if (shade == _shaded) return; // already done
@@ -1179,13 +1217,13 @@ void Client::configureRequestHandler(const XConfigureRequestEvent &e)
if (e.value_mask & (CWX | CWY)) {
int x = (e.value_mask & CWX) ? e.x : _area.x();
int y = (e.value_mask & CWY) ? e.y : _area.y();
- resize(corner, w, h, x, y);
+ internal_resize(corner, w, h, x, y);
} else // if JUST resizing...
- resize(corner, w, h);
+ internal_resize(corner, w, h);
} else if (e.value_mask & (CWX | CWY)) { // if JUST moving...
int x = (e.value_mask & CWX) ? e.x : _area.x();
int y = (e.value_mask & CWY) ? e.y : _area.y();
- move(x, y);
+ internal_move(x, y);
}
if (e.value_mask & CWStackMode) {