summaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
authorJim Ramsay <i.am@jimramsay.com>2009-10-14 01:05:49 (GMT)
committerJim Ramsay <i.am@jimramsay.com>2009-10-14 01:05:49 (GMT)
commit839ea523164caecd8c779e60539b78c2a748a81f (patch)
tree0019d04f27a1a258bc7a900e3cf77b916dca6493 /src/Window.cc
parent4d3aa646c1d1d1de4fdb31f938f6ea62fd5dd21e (diff)
parent8def80cec337a986b762cdbb5e2555c6da809353 (diff)
downloadfluxbox_lack-testing/argb.zip
fluxbox_lack-testing/argb.tar.bz2
Merge branch 'master' into argbtesting/argbargb
Conflicts: src/FbTk/FbWindow.cc
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc83
1 files changed, 47 insertions, 36 deletions
diff --git a/src/Window.cc b/src/Window.cc
index edc2b8e..34b92e1 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -113,7 +113,7 @@ typedef struct scanargs {
113} scanargs; 113} scanargs;
114 114
115// look for valid enter or leave events (that may invalidate the earlier one we are interested in) 115// look for valid enter or leave events (that may invalidate the earlier one we are interested in)
116static Bool queueScanner(Display *, XEvent *e, char *args) { 116extern "C" int queueScanner(Display *, XEvent *e, char *args) {
117 if (e->type == LeaveNotify && 117 if (e->type == LeaveNotify &&
118 e->xcrossing.window == ((scanargs *) args)->w && 118 e->xcrossing.window == ((scanargs *) args)->w &&
119 e->xcrossing.mode == NotifyNormal) { 119 e->xcrossing.mode == NotifyNormal) {
@@ -187,8 +187,9 @@ void lowerFluxboxWindow(FluxboxWindow &win) {
187 win.screen().layerManager().lock(); 187 win.screen().layerManager().lock();
188 188
189 // lower the windows from the top down, so they don't change stacking order 189 // lower the windows from the top down, so they don't change stacking order
190 WinClient::TransientList::const_reverse_iterator it = win.winClient().transientList().rbegin(); 190 const WinClient::TransientList& transients = win.winClient().transientList();
191 WinClient::TransientList::const_reverse_iterator it_end = win.winClient().transientList().rend(); 191 WinClient::TransientList::const_reverse_iterator it = transients.rbegin();
192 WinClient::TransientList::const_reverse_iterator it_end = transients.rend();
192 for (; it != it_end; ++it) { 193 for (; it != it_end; ++it) {
193 if ((*it)->fbwindow() && !(*it)->fbwindow()->isIconic()) 194 if ((*it)->fbwindow() && !(*it)->fbwindow()->isIconic())
194 // TODO: should we also check if it is the active client? 195 // TODO: should we also check if it is the active client?
@@ -259,7 +260,7 @@ private:
259 int m_mode; 260 int m_mode;
260}; 261};
261 262
262}; 263}
263 264
264 265
265int FluxboxWindow::s_num_grabs = 0; 266int FluxboxWindow::s_num_grabs = 0;
@@ -1107,11 +1108,11 @@ void FluxboxWindow::updateMWMHintsFromClient(WinClient &client) {
1107 if (hint->decorations & MwmDecorAll) { 1108 if (hint->decorations & MwmDecorAll) {
1108 decorations.titlebar = decorations.handle = decorations.border = 1109 decorations.titlebar = decorations.handle = decorations.border =
1109 decorations.iconify = decorations.maximize = 1110 decorations.iconify = decorations.maximize =
1110 decorations.close = decorations.menu = true; 1111 decorations.menu = true;
1111 } else { 1112 } else {
1112 decorations.titlebar = decorations.handle = decorations.border = 1113 decorations.titlebar = decorations.handle = decorations.border =
1113 decorations.iconify = decorations.maximize = 1114 decorations.iconify = decorations.maximize =
1114 decorations.close = decorations.tab = false; 1115 decorations.tab = false;
1115 decorations.menu = true; 1116 decorations.menu = true;
1116 if (hint->decorations & MwmDecorBorder) 1117 if (hint->decorations & MwmDecorBorder)
1117 decorations.border = true; 1118 decorations.border = true;
@@ -1213,6 +1214,9 @@ void FluxboxWindow::moveResize(int new_x, int new_y,
1213 if (!moving) { 1214 if (!moving) {
1214 m_last_resize_x = new_x; 1215 m_last_resize_x = new_x;
1215 m_last_resize_y = new_y; 1216 m_last_resize_y = new_y;
1217
1218 /* Ignore all EnterNotify events until the pointer actually moves */
1219 screen().focusControl().ignoreAtPointer();
1216 } 1220 }
1217 1221
1218} 1222}
@@ -1670,6 +1674,10 @@ void FluxboxWindow::lower() {
1670#ifdef DEBUG 1674#ifdef DEBUG
1671 cerr<<"FluxboxWindow("<<title()<<")::lower()"<<endl; 1675 cerr<<"FluxboxWindow("<<title()<<")::lower()"<<endl;
1672#endif // DEBUG 1676#endif // DEBUG
1677
1678 /* Ignore all EnterNotify events until the pointer actually moves */
1679 screen().focusControl().ignoreAtPointer();
1680
1673 // get root window 1681 // get root window
1674 WinClient *client = getRootTransientFor(m_client); 1682 WinClient *client = getRootTransientFor(m_client);
1675 1683
@@ -1690,15 +1698,10 @@ void FluxboxWindow::tempRaise() {
1690} 1698}
1691 1699
1692 1700
1693void FluxboxWindow::raiseLayer() { 1701void FluxboxWindow::changeLayer(int diff) {
1694 moveToLayer(m_state.layernum-1); 1702 moveToLayer(m_state.layernum+diff);
1695} 1703}
1696 1704
1697void FluxboxWindow::lowerLayer() {
1698 moveToLayer(m_state.layernum+1);
1699}
1700
1701
1702void FluxboxWindow::moveToLayer(int layernum, bool force) { 1705void FluxboxWindow::moveToLayer(int layernum, bool force) {
1703#ifdef DEBUG 1706#ifdef DEBUG
1704 cerr<<"FluxboxWindow("<<title()<<")::moveToLayer("<<layernum<<")"<<endl; 1707 cerr<<"FluxboxWindow("<<title()<<")::moveToLayer("<<layernum<<")"<<endl;
@@ -2401,10 +2404,9 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) {
2401 } else if (frame().handle() == be.window) 2404 } else if (frame().handle() == be.window)
2402 raise(); 2405 raise();
2403 2406
2407 FbTk::Menu::hideShownMenu();
2404 if (!m_focused && acceptsFocus() && m_click_focus) //check focus 2408 if (!m_focused && acceptsFocus() && m_click_focus) //check focus
2405 focus(); 2409 focus();
2406
2407 menu().hide();
2408 } 2410 }
2409} 2411}
2410 2412
@@ -2684,13 +2686,17 @@ void FluxboxWindow::enterNotifyEvent(XCrossingEvent &ev) {
2684 sa.enter = sa.leave = False; 2686 sa.enter = sa.leave = False;
2685 XCheckIfEvent(display, &dummy, queueScanner, (char *) &sa); 2687 XCheckIfEvent(display, &dummy, queueScanner, (char *) &sa);
2686 2688
2687 if ((!sa.leave || sa.inferior) && !screen().focusControl().isCycling() ) { 2689 if ((!sa.leave || sa.inferior) &&
2690 !screen().focusControl().isCycling() &&
2691 !screen().focusControl().isIgnored(ev.x_root, ev.y_root) ) {
2688 focus(); 2692 focus();
2689 } 2693 }
2690 } 2694 }
2691 } 2695 }
2692 2696
2693 if (screen().focusControl().isMouseTabFocus() && client && client != m_client) { 2697 if (screen().focusControl().isMouseTabFocus() &&
2698 client && client != m_client &&
2699 !screen().focusControl().isIgnored(ev.x_root, ev.y_root) ) {
2694 setCurrentClient(*client, isFocused()); 2700 setCurrentClient(*client, isFocused());
2695 } 2701 }
2696 2702
@@ -2805,6 +2811,7 @@ void FluxboxWindow::setDecorationMask(unsigned int mask, bool apply) {
2805 decorations.shade = mask & WindowState::DECORM_SHADE; 2811 decorations.shade = mask & WindowState::DECORM_SHADE;
2806 decorations.tab = mask & WindowState::DECORM_TAB; 2812 decorations.tab = mask & WindowState::DECORM_TAB;
2807 decorations.enabled = mask & WindowState::DECORM_ENABLED; 2813 decorations.enabled = mask & WindowState::DECORM_ENABLED;
2814
2808 // we don't want to do this during initialization 2815 // we don't want to do this during initialization
2809 if (apply) 2816 if (apply)
2810 applyDecorations(); 2817 applyDecorations();
@@ -3569,7 +3576,7 @@ void FluxboxWindow::updateButtons() {
3569 3576
3570 switch (dir[i]) { 3577 switch (dir[i]) {
3571 case WinButton::MINIMIZE: 3578 case WinButton::MINIMIZE:
3572 if (isIconifiable()) { 3579 if (isIconifiable() && (m_state.deco_mask & WindowState::DECORM_ICONIFY)) {
3573 winbtn = new WinButton(*this, m_button_theme, 3580 winbtn = new WinButton(*this, m_button_theme,
3574 screen().pressedWinButtonTheme(), 3581 screen().pressedWinButtonTheme(),
3575 WinButton::MINIMIZE, 3582 WinButton::MINIMIZE,
@@ -3579,7 +3586,7 @@ void FluxboxWindow::updateButtons() {
3579 } 3586 }
3580 break; 3587 break;
3581 case WinButton::MAXIMIZE: 3588 case WinButton::MAXIMIZE:
3582 if (isMaximizable()) { 3589 if (isMaximizable() && (m_state.deco_mask & WindowState::DECORM_MAXIMIZE) ) {
3583 winbtn = new WinButton(*this, m_button_theme, 3590 winbtn = new WinButton(*this, m_button_theme,
3584 screen().pressedWinButtonTheme(), 3591 screen().pressedWinButtonTheme(),
3585 dir[i], 3592 dir[i],
@@ -3592,7 +3599,7 @@ void FluxboxWindow::updateButtons() {
3592 } 3599 }
3593 break; 3600 break;
3594 case WinButton::CLOSE: 3601 case WinButton::CLOSE:
3595 if (m_client->isClosable()) { 3602 if (m_client->isClosable() && (m_state.deco_mask & WindowState::DECORM_CLOSE)) {
3596 winbtn = new WinButton(*this, m_button_theme, 3603 winbtn = new WinButton(*this, m_button_theme,
3597 screen().pressedWinButtonTheme(), 3604 screen().pressedWinButtonTheme(),
3598 dir[i], 3605 dir[i],
@@ -3604,23 +3611,27 @@ void FluxboxWindow::updateButtons() {
3604 } 3611 }
3605 break; 3612 break;
3606 case WinButton::STICK: 3613 case WinButton::STICK:
3607 winbtn = new WinButton(*this, m_button_theme, 3614 if (m_state.deco_mask & WindowState::DECORM_STICKY) {
3608 screen().pressedWinButtonTheme(), 3615 winbtn = new WinButton(*this, m_button_theme,
3609 dir[i], 3616 screen().pressedWinButtonTheme(),
3610 frame().titlebar(), 3617 dir[i],
3611 0, 0, 10, 10); 3618 frame().titlebar(),
3612 3619 0, 0, 10, 10);
3613 stateSig().attach(winbtn); 3620
3614 winbtn->setOnClick(stick_cmd); 3621 stateSig().attach(winbtn);
3622 winbtn->setOnClick(stick_cmd);
3623 }
3615 break; 3624 break;
3616 case WinButton::SHADE: 3625 case WinButton::SHADE:
3617 winbtn = new WinButton(*this, m_button_theme, 3626 if (m_state.deco_mask & WindowState::DECORM_SHADE) {
3618 screen().pressedWinButtonTheme(), 3627 winbtn = new WinButton(*this, m_button_theme,
3619 dir[i], 3628 screen().pressedWinButtonTheme(),
3620 frame().titlebar(), 3629 dir[i],
3621 0, 0, 10, 10); 3630 frame().titlebar(),
3622 stateSig().attach(winbtn); 3631 0, 0, 10, 10);
3623 winbtn->setOnClick(shade_cmd); 3632 stateSig().attach(winbtn);
3633 winbtn->setOnClick(shade_cmd);
3634 }
3624 break; 3635 break;
3625 case WinButton::MENUICON: 3636 case WinButton::MENUICON:
3626 winbtn = new WinButton(*this, m_button_theme, 3637 winbtn = new WinButton(*this, m_button_theme,
@@ -3718,7 +3729,7 @@ FluxboxWindow::ReferenceCorner FluxboxWindow::getCorner(string str) {
3718 return RIGHT; 3729 return RIGHT;
3719 if (str == "leftbottom" || str == "bottomleft" || str == "lowerleft") 3730 if (str == "leftbottom" || str == "bottomleft" || str == "lowerleft")
3720 return LEFTBOTTOM; 3731 return LEFTBOTTOM;
3721 if (str == "bottom" || str == "bottomcenter") 3732 if (str == "bottom" || str == "lower" || str == "bottomcenter")
3722 return BOTTOM; 3733 return BOTTOM;
3723 if (str == "rightbottom" || str == "bottomright" || str == "lowerright") 3734 if (str == "rightbottom" || str == "bottomright" || str == "lowerright")
3724 return RIGHTBOTTOM; 3735 return RIGHTBOTTOM;