aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc96
1 files changed, 15 insertions, 81 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 5634f8f..bb271c3 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -104,57 +104,6 @@ using std::hex;
104 104
105namespace { 105namespace {
106 106
107void grabButton(unsigned int button,
108 Window window, Cursor cursor) {
109
110 static Display *display = App::instance()->display();
111
112 const int numlock = KeyUtil::instance().numlock();
113 const int capslock = KeyUtil::instance().capslock();
114 const int scrolllock = KeyUtil::instance().scrolllock();
115
116 // Grab with modkey and with all lock modifiers
117 // (num, scroll and caps)
118
119 unsigned int modkey = Fluxbox::instance()->getModKey();
120
121 //numlock
122 XGrabButton(display, button, modkey|numlock, window, True,
123 ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
124 GrabModeAsync, None, cursor);
125 //scrolllock
126 XGrabButton(display, button, modkey|scrolllock, window, True,
127 ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
128 GrabModeAsync, None, cursor);
129
130 //capslock
131 XGrabButton(display, button, modkey|capslock, window, True,
132 ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
133 GrabModeAsync, None, cursor);
134
135 //capslock+numlock
136 XGrabButton(display, Button1, modkey|capslock|numlock, window, True,
137 ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
138 GrabModeAsync, None, cursor);
139
140 //capslock+scrolllock
141 XGrabButton(display, button, modkey|capslock|scrolllock, window, True,
142 ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
143 GrabModeAsync, None, cursor);
144
145 //capslock+numlock+scrolllock
146 XGrabButton(display, button, modkey|capslock|numlock|scrolllock, window,
147 True,
148 ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
149 GrabModeAsync, None, cursor);
150
151 //numlock+scrollLock
152 XGrabButton(display, button, modkey|numlock|scrolllock, window, True,
153 ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
154 GrabModeAsync, None, cursor);
155
156}
157
158// X event scanner for enter/leave notifies - adapted from twm 107// X event scanner for enter/leave notifies - adapted from twm
159typedef struct scanargs { 108typedef struct scanargs {
160 Window w; 109 Window w;
@@ -402,8 +351,7 @@ void FluxboxWindow::init() {
402 351
403 assert(m_client); 352 assert(m_client);
404 m_client->setFluxboxWindow(this); 353 m_client->setFluxboxWindow(this);
405 if (!m_client->hasGroupLeftWindow()) 354 m_client->setGroupLeftWindow(None); // nothing to the left.
406 m_client->setGroupLeftWindow(None); // nothing to the left.
407 355
408 // check for shape extension and whether the window is shaped 356 // check for shape extension and whether the window is shaped
409 m_shaped = false; 357 m_shaped = false;
@@ -702,10 +650,10 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
702 frame().clientArea().width(), 650 frame().clientArea().width(),
703 frame().clientArea().height()); 651 frame().clientArea().height());
704 652
705 if (&client == FocusControl::focusedWindow()) { 653 // right now, this block only happens with new windows or on restart
706 was_focused = true; 654 if (screen().focusControl().focusNew() ||
655 Fluxbox::instance()->isStartup())
707 focused_win = &client; 656 focused_win = &client;
708 }
709 657
710 client.saveBlackboxAttribs(m_blackbox_attrib); 658 client.saveBlackboxAttribs(m_blackbox_attrib);
711 m_clientlist.push_back(&client); 659 m_clientlist.push_back(&client);
@@ -718,16 +666,15 @@ void FluxboxWindow::attachClient(WinClient &client, int x, int y) {
718 m_workspacesig.notify(); 666 m_workspacesig.notify();
719 m_layersig.notify(); 667 m_layersig.notify();
720 668
721 if (was_focused) 669 if (was_focused) {
722 // already has focus, we're just assuming the state of the old window 670 // don't ask me why, but client doesn't seem to keep focus in new window
671 // and we don't seem to get a FocusIn event from setInputFocus
672 setCurrentClient(client);
723 FocusControl::setFocusedWindow(&client); 673 FocusControl::setFocusedWindow(&client);
674 } else if (focused_win)
675 setCurrentClient(*focused_win, false);
724 676
725 frame().reconfigure(); 677 frame().reconfigure();
726
727 // keep the current window on top
728 if (focused_win)
729 m_client = focused_win;
730 m_client->raise();
731} 678}
732 679
733 680
@@ -748,11 +695,7 @@ bool FluxboxWindow::detachClient(WinClient &client) {
748 (*client_it_after)->setGroupLeftWindow(leftwin); 695 (*client_it_after)->setGroupLeftWindow(leftwin);
749 696
750 removeClient(client); 697 removeClient(client);
751 698 screen().createWindow(client);
752 // m_client must be valid as there should be at least one other window
753 // otherwise this wouldn't be here (refer numClients() <= 1 return)
754 client.setFluxboxWindow(screen().createWindow(client));
755 client.setGroupLeftWindow(None);
756 return true; 699 return true;
757} 700}
758 701
@@ -1123,22 +1066,16 @@ void FluxboxWindow::grabButtons() {
1123 unsigned int modkey = Fluxbox::instance()->getModKey(); 1066 unsigned int modkey = Fluxbox::instance()->getModKey();
1124 1067
1125 if (modkey) { 1068 if (modkey) {
1126 XGrabButton(display, Button1, modkey, frame().window().window(), True,
1127 ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
1128 GrabModeAsync, None, frame().theme().moveCursor());
1129
1130 //----grab with "all" modifiers 1069 //----grab with "all" modifiers
1131 grabButton(Button1, frame().window().window(), frame().theme().moveCursor()); 1070 FbTk::KeyUtil::grabButton(Button1, modkey, frame().window().window(),
1071 ButtonReleaseMask | ButtonMotionMask, frame().theme().moveCursor());
1132 1072
1133 XGrabButton(display, Button2, modkey, frame().window().window(), True, 1073 XGrabButton(display, Button2, modkey, frame().window().window(), True,
1134 ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None); 1074 ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None);
1135 1075
1136 XGrabButton(display, Button3, modkey, frame().window().window(), True,
1137 ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
1138 GrabModeAsync, None, None);
1139
1140 //---grab with "all" modifiers 1076 //---grab with "all" modifiers
1141 grabButton(Button3, frame().window().window(), None); 1077 FbTk::KeyUtil::grabButton(Button3, modkey, frame().window().window(),
1078 ButtonReleaseMask | ButtonMotionMask);
1142 } 1079 }
1143} 1080}
1144 1081
@@ -3641,9 +3578,6 @@ void FluxboxWindow::attachTo(int x, int y, bool interrupted) {
3641 // since just detached, move relative to old location 3578 // since just detached, move relative to old location
3642 if (client.fbwindow() != 0) { 3579 if (client.fbwindow() != 0) {
3643 client.fbwindow()->move(frame().x() - m_last_resize_x + x, frame().y() - m_last_resize_y + y); 3580 client.fbwindow()->move(frame().x() - m_last_resize_x + x, frame().y() - m_last_resize_y + y);
3644 client.fbwindow()->show();
3645 FocusControl::setFocusedWindow(&client);
3646 client.fbwindow()->setInputFocus();
3647 } 3581 }
3648 } else if( attach_to_win == this && attach_to_win->isTabable()) { 3582 } else if( attach_to_win == this && attach_to_win->isTabable()) {
3649 //reording of tabs within a frame 3583 //reording of tabs within a frame