aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2009-12-18 07:05:07 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2009-12-18 07:05:07 (GMT)
commit46261a8284730a16d664fa89423fc5728ed284b4 (patch)
treec81d7962fe924f5bfca44dc0254304cb537544b9 /src/Window.cc
parent79859c94482e4602eb22c35b988027ab199734a6 (diff)
downloadfluxbox-46261a8284730a16d664fa89423fc5728ed284b4.zip
fluxbox-46261a8284730a16d664fa89423fc5728ed284b4.tar.bz2
implemented 'MoveN' and 'ClickN' support in keys file.
the hardcoded 'OnTitlebar Mouse1 :Raise' (see Window.cc, FluxboxWindow::buttonPressEvent()) is disabled for now, should be added to fluxbox-update_configs
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc43
1 files changed, 36 insertions, 7 deletions
diff --git a/src/Window.cc b/src/Window.cc
index c03447c..0fb674c 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -280,6 +280,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client):
280 m_button_grab_x(0), m_button_grab_y(0), 280 m_button_grab_x(0), m_button_grab_y(0),
281 m_last_move_x(0), m_last_move_y(0), 281 m_last_move_x(0), m_last_move_y(0),
282 m_last_resize_h(1), m_last_resize_w(1), 282 m_last_resize_h(1), m_last_resize_w(1),
283 m_last_pressed_button(0),
283 m_workspace_number(0), 284 m_workspace_number(0),
284 m_current_state(0), 285 m_current_state(0),
285 m_old_decoration_mask(0), 286 m_old_decoration_mask(0),
@@ -1073,7 +1074,6 @@ void FluxboxWindow::grabButtons() {
1073 GrabModeSync, GrabModeSync, None, None); 1074 GrabModeSync, GrabModeSync, None, None);
1074 XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask, 1075 XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask,
1075 frame().window().window()); 1076 frame().window().window());
1076
1077} 1077}
1078 1078
1079 1079
@@ -1478,7 +1478,7 @@ void FluxboxWindow::setFullscreenLayer() {
1478 FluxboxWindow *foc = FocusControl::focusedFbWindow(); 1478 FluxboxWindow *foc = FocusControl::focusedFbWindow();
1479 // if another window on the same head is focused, make sure we can see it 1479 // if another window on the same head is focused, make sure we can see it
1480 if (isFocused() || !foc || &foc->screen() != &screen() || 1480 if (isFocused() || !foc || &foc->screen() != &screen() ||
1481 getOnHead() != foc->getOnHead() || 1481 getOnHead() != foc->getOnHead() ||
1482 (foc->winClient().isTransient() && 1482 (foc->winClient().isTransient() &&
1483 foc->winClient().transientFor()->fbwindow() == this)) { 1483 foc->winClient().transientFor()->fbwindow() == this)) {
1484 moveToLayer(::Layer::ABOVE_DOCK); 1484 moveToLayer(::Layer::ABOVE_DOCK);
@@ -2370,13 +2370,16 @@ bool FluxboxWindow::isTyping() const {
2370void FluxboxWindow::buttonPressEvent(XButtonEvent &be) { 2370void FluxboxWindow::buttonPressEvent(XButtonEvent &be) {
2371 m_last_button_x = be.x_root; 2371 m_last_button_x = be.x_root;
2372 m_last_button_y = be.y_root; 2372 m_last_button_y = be.y_root;
2373 m_last_pressed_button = be.button;
2373 2374
2374 bool onTitlebar = 2375 bool onTitlebar =
2375 frame().insideTitlebar( be.window ) && 2376 frame().insideTitlebar( be.window ) &&
2376 frame().handle().window() != be.window; 2377 frame().handle().window() != be.window;
2377 2378
2379#if 0 // disabled
2378 if (onTitlebar && be.button == 1) 2380 if (onTitlebar && be.button == 1)
2379 raise(); 2381 raise();
2382#endif
2380 2383
2381 // check keys file first 2384 // check keys file first
2382 Keys *k = Fluxbox::instance()->keys(); 2385 Keys *k = Fluxbox::instance()->keys();
@@ -2412,19 +2415,27 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) {
2412 2415
2413void FluxboxWindow::buttonReleaseEvent(XButtonEvent &re) { 2416void FluxboxWindow::buttonReleaseEvent(XButtonEvent &re) {
2414 2417
2418 if (m_last_pressed_button == re.button) {
2419 m_last_pressed_button = 0;
2420 }
2421
2415 if (isMoving()) 2422 if (isMoving())
2416 stopMoving(); 2423 stopMoving();
2417 else if (isResizing()) 2424 else if (isResizing())
2418 stopResizing(); 2425 stopResizing();
2419 else if (m_attaching_tab) 2426 else if (m_attaching_tab)
2420 attachTo(re.x_root, re.y_root); 2427 attachTo(re.x_root, re.y_root);
2421 else 2428 else if (!frame().tabcontainer().tryButtonReleaseEvent(re)) {
2422 frame().tabcontainer().tryButtonReleaseEvent(re);
2423 2429
2430 if (m_last_button_x == re.x_root && m_last_button_y == re.y_root) {
2431 Fluxbox::instance()->keys()->doAction(re.type, re.state, re.button, Keys::ON_WINDOW, &winClient(), re.time);
2432 }
2433 }
2424} 2434}
2425 2435
2426 2436
2427void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) { 2437void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2438
2428 if (isMoving() && me.window == parent()) { 2439 if (isMoving() && me.window == parent()) {
2429 me.window = frame().window().window(); 2440 me.window = frame().window().window();
2430 } 2441 }
@@ -2452,6 +2463,13 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2452 } 2463 }
2453 } 2464 }
2454 2465
2466
2467 // in case someone put MoveX :StartMoving etc into keys, we have
2468 // to activate it before doing the actual motionNotify code
2469 Fluxbox::instance()->keys()->doAction(me.type, me.state, m_last_pressed_button,
2470 inside_titlebar ? Keys::ON_TITLEBAR : Keys::ON_WINDOW,
2471 &winClient(), me.time);
2472
2455 if (moving || ((me.state & Button1Mask) && functions.move && 2473 if (moving || ((me.state & Button1Mask) && functions.move &&
2456 inside_titlebar && !isResizing() && m_attaching_tab == 0)) { 2474 inside_titlebar && !isResizing() && m_attaching_tab == 0)) {
2457 2475
@@ -2818,8 +2836,14 @@ void FluxboxWindow::setDecorationMask(unsigned int mask, bool apply) {
2818} 2836}
2819 2837
2820void FluxboxWindow::startMoving(int x, int y) { 2838void FluxboxWindow::startMoving(int x, int y) {
2821 if (s_num_grabs > 0) 2839
2840 if (isMoving()) {
2841 return;
2842 }
2843
2844 if (s_num_grabs > 0) {
2822 return; 2845 return;
2846 }
2823 2847
2824 if (isMaximized() && screen().getMaxDisableMove()) 2848 if (isMaximized() && screen().getMaxDisableMove())
2825 return; 2849 return;
@@ -3062,6 +3086,7 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) {
3062 3086
3063FluxboxWindow::ReferenceCorner FluxboxWindow::getResizeDirection(int x, int y, 3087FluxboxWindow::ReferenceCorner FluxboxWindow::getResizeDirection(int x, int y,
3064 ResizeModel model) const { 3088 ResizeModel model) const {
3089
3065 int cx = frame().width() / 2; 3090 int cx = frame().width() / 2;
3066 int cy = frame().height() / 2; 3091 int cy = frame().height() / 2;
3067 if (model == CENTERRESIZE) 3092 if (model == CENTERRESIZE)
@@ -3088,6 +3113,9 @@ FluxboxWindow::ReferenceCorner FluxboxWindow::getResizeDirection(int x, int y,
3088 3113
3089void FluxboxWindow::startResizing(int x, int y, ReferenceCorner dir) { 3114void FluxboxWindow::startResizing(int x, int y, ReferenceCorner dir) {
3090 3115
3116 if (isResizing())
3117 return;
3118
3091 if (s_num_grabs > 0 || isShaded() || isIconic() ) 3119 if (s_num_grabs > 0 || isShaded() || isIconic() )
3092 return; 3120 return;
3093 3121
@@ -3550,7 +3578,7 @@ void FluxboxWindow::updateButtons() {
3550 need_update = true; 3578 need_update = true;
3551 } 3579 }
3552 } 3580 }
3553 3581
3554 } 3582 }
3555 3583
3556 if (!need_update) 3584 if (!need_update)
@@ -3680,6 +3708,7 @@ void FluxboxWindow::grabPointer(Window grab_window,
3680 Window confine_to, 3708 Window confine_to,
3681 Cursor cursor, 3709 Cursor cursor,
3682 Time time) { 3710 Time time) {
3711
3683 XGrabPointer(FbTk::App::instance()->display(), 3712 XGrabPointer(FbTk::App::instance()->display(),
3684 grab_window, 3713 grab_window,
3685 owner_events, 3714 owner_events,
@@ -3870,7 +3899,7 @@ void FluxboxWindow::setWindowType(WindowState::WindowType type) {
3870 */ 3899 */
3871} 3900}
3872 3901
3873void FluxboxWindow::focusedWindowChanged(BScreen &screen, 3902void FluxboxWindow::focusedWindowChanged(BScreen &screen,
3874 FluxboxWindow *focused_win, WinClient* client) { 3903 FluxboxWindow *focused_win, WinClient* client) {
3875 if (focused_win) { 3904 if (focused_win) {
3876 setFullscreenLayer(); 3905 setFullscreenLayer();