aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc58
1 files changed, 5 insertions, 53 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 2cf776e..1195127 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -2324,14 +2324,10 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) {
2324 m_last_button_y = be.y_root; 2324 m_last_button_y = be.y_root;
2325 m_last_pressed_button = be.button; 2325 m_last_pressed_button = be.button;
2326 2326
2327 bool onTitlebar =
2328 frame().insideTitlebar( be.window ) &&
2329 frame().handle().window() != be.window;
2330
2331 Keys *k = Fluxbox::instance()->keys(); 2327 Keys *k = Fluxbox::instance()->keys();
2332 if ((onTitlebar && k->doAction(be.type, be.state, be.button, Keys::ON_TITLEBAR, &winClient(), be.time)) || 2328 int context = frame().getContext(be.window);
2333 k->doAction(be.type, be.state, be.button, Keys::ON_WINDOW, &winClient(), be.time)) { 2329 if (k->doAction(be.type, be.state, be.button,
2334 2330 context, &winClient(), be.time)) {
2335 return; 2331 return;
2336 } 2332 }
2337 2333
@@ -2382,60 +2378,16 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2382 me.window = frame().window().window(); 2378 me.window = frame().window().window();
2383 } 2379 }
2384 2380
2385 bool inside_titlebar = frame().insideTitlebar( me.window ); 2381 int context = frame().getContext(me.window, me.x_root, me.y_root, m_last_button_x, m_last_button_y, true);
2386 bool inside_grips = (me.window == frame().gripRight() || me.window == frame().gripLeft());
2387 bool inside_border = false;
2388
2389 if (!inside_grips)
2390 {
2391 using RectangleUtil::insideBorder;
2392 int borderw = frame().window().borderWidth();
2393
2394
2395 //!! TODO(tabs): the below test ought to be in FbWinFrame
2396
2397 inside_border =
2398
2399 // if mouse is currently on the window border, ignore it
2400 (
2401 ! insideBorder(frame(), me.x_root, me.y_root, borderw)
2402 && ( !frame().externalTabMode()
2403 || ! insideBorder(frame().tabcontainer(), me.x_root, me.y_root, borderw) )
2404
2405 )
2406
2407 || // or if mouse was on border when it was last clicked
2408
2409 (
2410 ! insideBorder(frame(), m_last_button_x, m_last_button_y, borderw)
2411 &&
2412 ( ! frame().externalTabMode()
2413 || ! insideBorder(frame().tabcontainer(), m_last_button_x, m_last_button_y, borderw )
2414 )
2415 );
2416 }
2417 2382
2418 if (Fluxbox::instance()->getIgnoreBorder() && m_attaching_tab == 0 2383 if (Fluxbox::instance()->getIgnoreBorder() && m_attaching_tab == 0
2419 && !(isMoving() || isResizing())) { 2384 && !(isMoving() || isResizing())) {
2420 2385
2421 if (inside_border) { 2386 if (context & Keys::ON_WINDOWBORDER) {
2422 return; 2387 return;
2423 } 2388 }
2424 } 2389 }
2425 2390
2426
2427 int context = Keys::ON_WINDOW;
2428 if (inside_titlebar) {
2429 context = Keys::ON_TITLEBAR;
2430 } else if (inside_border) {
2431 context = Keys::ON_WINDOWBORDER;
2432 } else if (me.window == frame().gripRight()) {
2433 context = Keys::ON_RIGHTGRIP;
2434 } else if (me.window == frame().gripLeft()) {
2435 context = Keys::ON_LEFTGRIP;
2436 }
2437
2438
2439 // in case someone put MoveX :StartMoving etc into keys, we have 2391 // in case someone put MoveX :StartMoving etc into keys, we have
2440 // to activate it before doing the actual motionNotify code 2392 // to activate it before doing the actual motionNotify code
2441 Fluxbox::instance()->keys()->doAction(me.type, me.state, m_last_pressed_button, context, &winClient(), me.time); 2393 Fluxbox::instance()->keys()->doAction(me.type, me.state, m_last_pressed_button, context, &winClient(), me.time);