+ if (frame.maximize_button == re->window) {
+ if ((re->x < 0 || re->x >= static_cast<signed>(frame.button_w)) ||
+ (re->y < 0 || re->y >= static_cast<signed>(frame.button_w)) ||
+ ! input->doAction(this, re->button, state,
+ BInput::MaximizeButtonClick))
+ redrawMaximizeButton(flags.maximized);
+ } else if (frame.iconify_button == re->window) {
+ if ((re->x < 0 || re->x >= static_cast<signed>(frame.button_w)) ||
+ (re->y < 0 || re->y >= static_cast<signed>(frame.button_w)) ||
+ ! input->doAction(this, re->button, state,
+ BInput::IconifyButtonClick))
+ redrawIconifyButton(False);
+ } else if (frame.close_button == re->window) {
+ if ((re->x < 0 || re->x >= static_cast<signed>(frame.button_w)) ||
+ (re->y < 0 || re->y >= static_cast<signed>(frame.button_w)))
+ input->doAction(this, re->button, state, BInput::CloseButtonClick);
+ redrawCloseButton(False);
+ } else if (flags.moving) {
+ endMove();
+ } else if (flags.resizing) {
+ endResize();
+ }
+}
+
+
+void BlackboxWindow::motionNotifyEvent(const XMotionEvent *me) {
+ // get the button that is being used
+ // get the proper state, without the button that is being used
+ unsigned int button;
+ unsigned int state;
+ if (me->state & Button1Mask) {
+ button = Button1;
+ state = me->state & ~Button1Mask;
+ } else if (me->state & Button2Mask) {
+ button = Button2;
+ state = me->state & ~Button2Mask;
+ } else if (me->state & Button3Mask) {
+ button = Button3;
+ state = me->state & ~Button3Mask;
+ } else if (me->state & Button4Mask) {
+ button = Button4;
+ state = me->state & ~Button4Mask;
+ } else if (me->state & Button5Mask) {
+ button = Button5;
+ state = me->state & ~Button5Mask;
+ } else {
+ return;
+ }
+
+ if (flags.moving) {
+ doMove(me->x_root, me->y_root);
+ } else if (flags.resizing) {
+ doResize(me->x_root, me->y_root);
+ } else {
+ if (frame.title == me->window || frame.label == me->window)
+ input->doAction(this, button, state, BInput::WindowTitleDrag);
+ else if (frame.handle == me->window)
+ input->doAction(this, button, state, BInput::WindowHandleDrag);
+ else if (frame.left_grip == me->window)
+ input->doAction(this, button, state, BInput::WindowLeftGripDrag);
+ else if (frame.right_grip == me->window)
+ input->doAction(this, button, state, BInput::WindowRightGripDrag);
+ else if (frame.window == me->window)
+ input->doAction(this, button, state, BInput::WindowDrag);
+ }
+}