diff options
-rw-r--r-- | src/WinClient.cc | 6 | ||||
-rw-r--r-- | src/Window.cc | 40 | ||||
-rw-r--r-- | src/Window.hh | 6 | ||||
-rw-r--r-- | src/fluxbox.cc | 164 | ||||
-rw-r--r-- | src/fluxbox.hh | 41 |
5 files changed, 61 insertions, 196 deletions
diff --git a/src/WinClient.cc b/src/WinClient.cc index 111e51d..2524106 100644 --- a/src/WinClient.cc +++ b/src/WinClient.cc | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: WinClient.cc,v 1.36 2003/12/21 15:24:28 rathnor Exp $ | 22 | // $Id: WinClient.cc,v 1.37 2003/12/30 20:56:41 fluxgen Exp $ |
23 | 23 | ||
24 | #include "WinClient.hh" | 24 | #include "WinClient.hh" |
25 | 25 | ||
@@ -118,10 +118,8 @@ WinClient::~WinClient() { | |||
118 | if (m_blackbox_hint != 0) | 118 | if (m_blackbox_hint != 0) |
119 | XFree(m_blackbox_hint); | 119 | XFree(m_blackbox_hint); |
120 | 120 | ||
121 | if (window()) { | 121 | if (window()) |
122 | fluxbox->removeWindowSearch(window()); | 122 | fluxbox->removeWindowSearch(window()); |
123 | fluxbox->removeRedirectEvent(None, window()); | ||
124 | } | ||
125 | 123 | ||
126 | m_win = 0; | 124 | m_win = 0; |
127 | } | 125 | } |
diff --git a/src/Window.cc b/src/Window.cc index be790ca..6cc3af9 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Window.cc,v 1.257 2003/12/21 23:23:03 fluxgen Exp $ | 25 | // $Id: Window.cc,v 1.258 2003/12/30 20:56:40 fluxgen Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -516,6 +516,8 @@ void FluxboxWindow::init() { | |||
516 | if (!place_window) | 516 | if (!place_window) |
517 | moveResize(frame().x(), frame().y(), frame().width(), frame().height()); | 517 | moveResize(frame().x(), frame().y(), frame().width(), frame().height()); |
518 | 518 | ||
519 | |||
520 | |||
519 | screen().getWorkspace(m_workspace_number)->addWindow(*this, place_window); | 521 | screen().getWorkspace(m_workspace_number)->addWindow(*this, place_window); |
520 | 522 | ||
521 | if (shaded) { // start shaded | 523 | if (shaded) { // start shaded |
@@ -895,14 +897,14 @@ void FluxboxWindow::updateClientLeftWindow() { | |||
895 | } | 897 | } |
896 | } | 898 | } |
897 | 899 | ||
898 | bool FluxboxWindow::setCurrentClient(WinClient &client, bool setinput, long ignore_event) { | 900 | bool FluxboxWindow::setCurrentClient(WinClient &client, bool setinput) { |
899 | // make sure it's in our list | 901 | // make sure it's in our list |
900 | if (client.m_win != this) | 902 | if (client.m_win != this) |
901 | return false; | 903 | return false; |
902 | 904 | ||
903 | m_client = &client; | 905 | m_client = &client; |
904 | m_client->raise(); | 906 | m_client->raise(); |
905 | if (setinput && setInputFocus(ignore_event)) { | 907 | if (setinput && setInputFocus()) { |
906 | frame().setLabelButtonFocus(*m_labelbuttons[m_client]); | 908 | frame().setLabelButtonFocus(*m_labelbuttons[m_client]); |
907 | return true; | 909 | return true; |
908 | } | 910 | } |
@@ -1154,7 +1156,7 @@ void FluxboxWindow::moveResize(int new_x, int new_y, | |||
1154 | // tried. A FocusqIn event should eventually arrive for that | 1156 | // tried. A FocusqIn event should eventually arrive for that |
1155 | // window if it actually got the focus, then setFocusedFlag is called, | 1157 | // window if it actually got the focus, then setFocusedFlag is called, |
1156 | // which updates all the graphics etc | 1158 | // which updates all the graphics etc |
1157 | bool FluxboxWindow::setInputFocus(long ignore_event) { | 1159 | bool FluxboxWindow::setInputFocus() { |
1158 | 1160 | ||
1159 | if (((signed) (frame().x() + frame().width())) < 0) { | 1161 | if (((signed) (frame().x() + frame().width())) < 0) { |
1160 | if (((signed) (frame().y() + frame().height())) < 0) { | 1162 | if (((signed) (frame().y() + frame().height())) < 0) { |
@@ -1215,13 +1217,6 @@ bool FluxboxWindow::setInputFocus(long ignore_event) { | |||
1215 | ret = m_client->sendFocus(); | 1217 | ret = m_client->sendFocus(); |
1216 | } | 1218 | } |
1217 | 1219 | ||
1218 | |||
1219 | // People can ignore an event until the focus comes through | ||
1220 | // this is most likely to be an EnterNotify for sloppy focus | ||
1221 | if (ret && m_client->getFocusMode() != WinClient::F_NOINPUT && ignore_event != None) | ||
1222 | Fluxbox::instance()->addRedirectEvent( | ||
1223 | &screen(), ignore_event, None, | ||
1224 | FocusIn, m_client->window(), None); | ||
1225 | 1220 | ||
1226 | return ret; | 1221 | return ret; |
1227 | } | 1222 | } |
@@ -2656,7 +2651,7 @@ void FluxboxWindow::setDecoration(Decoration decoration) { | |||
2656 | // commit current decoration values to actual displayed things | 2651 | // commit current decoration values to actual displayed things |
2657 | void FluxboxWindow::applyDecorations(bool initial) { | 2652 | void FluxboxWindow::applyDecorations(bool initial) { |
2658 | frame().clientArea().setBorderWidth(0); // client area bordered by other things | 2653 | frame().clientArea().setBorderWidth(0); // client area bordered by other things |
2659 | bool client_move = false; | 2654 | |
2660 | 2655 | ||
2661 | int grav_x=0, grav_y=0; | 2656 | int grav_x=0, grav_y=0; |
2662 | // negate gravity | 2657 | // negate gravity |
@@ -2666,6 +2661,8 @@ void FluxboxWindow::applyDecorations(bool initial) { | |||
2666 | if (decorations.border) | 2661 | if (decorations.border) |
2667 | border_width = frame().theme().border().width(); | 2662 | border_width = frame().theme().border().width(); |
2668 | 2663 | ||
2664 | bool client_move = false; | ||
2665 | |||
2669 | if (initial || frame().window().borderWidth() != border_width) { | 2666 | if (initial || frame().window().borderWidth() != border_width) { |
2670 | client_move = true; | 2667 | client_move = true; |
2671 | frame().setBorderWidth(border_width); | 2668 | frame().setBorderWidth(border_width); |
@@ -2768,16 +2765,7 @@ void FluxboxWindow::startMoving(Window win) { | |||
2768 | if (m_windowmenu.isVisible()) | 2765 | if (m_windowmenu.isVisible()) |
2769 | m_windowmenu.hide(); | 2766 | m_windowmenu.hide(); |
2770 | 2767 | ||
2771 | // The "stop" window and event aren't going to happen (since it's | 2768 | fluxbox->maskWindowEvents(screen().rootWindow().window(), this); |
2772 | // grabbed, so they are just so we can remove it in stopMoving) | ||
2773 | fluxbox->addRedirectEvent(&screen(), | ||
2774 | MotionNotify, screen().rootWindow().window(), | ||
2775 | MotionNotify, fbWindow().window(), | ||
2776 | fbWindow().window()); | ||
2777 | fluxbox->addRedirectEvent(&screen(), | ||
2778 | ButtonRelease, screen().rootWindow().window(), | ||
2779 | ButtonRelease, fbWindow().window(), | ||
2780 | fbWindow().window()); | ||
2781 | 2769 | ||
2782 | m_last_move_x = frame().x(); | 2770 | m_last_move_x = frame().x(); |
2783 | m_last_move_y = frame().y(); | 2771 | m_last_move_y = frame().y(); |
@@ -2795,8 +2783,8 @@ void FluxboxWindow::stopMoving() { | |||
2795 | moving = false; | 2783 | moving = false; |
2796 | Fluxbox *fluxbox = Fluxbox::instance(); | 2784 | Fluxbox *fluxbox = Fluxbox::instance(); |
2797 | 2785 | ||
2798 | fluxbox->removeRedirectEvent(MotionNotify, fbWindow().window()); | 2786 | fluxbox->maskWindowEvents(0, 0); |
2799 | fluxbox->removeRedirectEvent(ButtonRelease, fbWindow().window()); | 2787 | |
2800 | 2788 | ||
2801 | if (! screen().doOpaqueMove()) { | 2789 | if (! screen().doOpaqueMove()) { |
2802 | parent().drawRectangle(screen().rootTheme().opGC(), | 2790 | parent().drawRectangle(screen().rootTheme().opGC(), |
@@ -3026,6 +3014,10 @@ void FluxboxWindow::attachTo(int x, int y) { | |||
3026 | if (client) | 3014 | if (client) |
3027 | attach_to_win = client->fbwindow(); | 3015 | attach_to_win = client->fbwindow(); |
3028 | 3016 | ||
3017 | cerr<<"client = "<<client<<", child = "<<hex<<child<<dec<<", fbwin = "<<attach_to_win<<endl; | ||
3018 | |||
3019 | cerr<<"client = "<<client<<", child = "<<hex<<child<<dec<<", fbwin = "<<attach_to_win<<endl; | ||
3020 | |||
3029 | if (attach_to_win != this && | 3021 | if (attach_to_win != this && |
3030 | attach_to_win != 0) { | 3022 | attach_to_win != 0) { |
3031 | 3023 | ||
diff --git a/src/Window.hh b/src/Window.hh index b555d6b..d61703a 100644 --- a/src/Window.hh +++ b/src/Window.hh | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: Window.hh,v 1.104 2003/12/18 18:03:22 fluxgen Exp $ | 25 | // $Id: Window.hh,v 1.105 2003/12/30 20:56:40 fluxgen Exp $ |
26 | 26 | ||
27 | #ifndef WINDOW_HH | 27 | #ifndef WINDOW_HH |
28 | #define WINDOW_HH | 28 | #define WINDOW_HH |
@@ -168,14 +168,14 @@ public: | |||
168 | /// remove client from client list | 168 | /// remove client from client list |
169 | bool removeClient(WinClient &client); | 169 | bool removeClient(WinClient &client); |
170 | /// set new current client and raise it | 170 | /// set new current client and raise it |
171 | bool setCurrentClient(WinClient &client, bool setinput = true, long ignore_event = 0); | 171 | bool setCurrentClient(WinClient &client, bool setinput = true); |
172 | WinClient *findClient(Window win); | 172 | WinClient *findClient(Window win); |
173 | void nextClient(); | 173 | void nextClient(); |
174 | void prevClient(); | 174 | void prevClient(); |
175 | void moveClientLeft(); | 175 | void moveClientLeft(); |
176 | void moveClientRight(); | 176 | void moveClientRight(); |
177 | 177 | ||
178 | bool setInputFocus(long ignore_event = 0); | 178 | bool setInputFocus(); |
179 | void raiseAndFocus() { raise(); setInputFocus(); } | 179 | void raiseAndFocus() { raise(); setInputFocus(); } |
180 | void setFocusFlag(bool flag); | 180 | void setFocusFlag(bool flag); |
181 | // map this window | 181 | // map this window |
diff --git a/src/fluxbox.cc b/src/fluxbox.cc index 9cad953..439ed8f 100644 --- a/src/fluxbox.cc +++ b/src/fluxbox.cc | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: fluxbox.cc,v 1.214 2003/12/21 22:42:31 fluxgen Exp $ | 25 | // $Id: fluxbox.cc,v 1.215 2003/12/30 20:56:40 fluxgen Exp $ |
26 | 26 | ||
27 | #include "fluxbox.hh" | 27 | #include "fluxbox.hh" |
28 | 28 | ||
@@ -194,13 +194,6 @@ setFromString(const char *strval) { | |||
194 | setDefaultValue(); | 194 | setDefaultValue(); |
195 | } | 195 | } |
196 | 196 | ||
197 | template<> | ||
198 | void FbTk::Resource<long>:: | ||
199 | setFromString(const char *strval) { | ||
200 | if (sscanf(strval, "%ld", &m_value) != 1) | ||
201 | setDefaultValue(); | ||
202 | } | ||
203 | |||
204 | //----------------------------------------------------------------- | 197 | //----------------------------------------------------------------- |
205 | //---- manipulators for int, bool, and some enums with Resource --- | 198 | //---- manipulators for int, bool, and some enums with Resource --- |
206 | //----------------------------------------------------------------- | 199 | //----------------------------------------------------------------- |
@@ -266,14 +259,6 @@ getString() { | |||
266 | } | 259 | } |
267 | 260 | ||
268 | template<> | 261 | template<> |
269 | string FbTk::Resource<long>:: | ||
270 | getString() { | ||
271 | char tmpstr[128]; | ||
272 | sprintf(tmpstr, "%ld", m_value); | ||
273 | return string(tmpstr); | ||
274 | } | ||
275 | |||
276 | template<> | ||
277 | void FbTk::Resource<Fluxbox::Layer>:: | 262 | void FbTk::Resource<Fluxbox::Layer>:: |
278 | setFromString(const char *strval) { | 263 | setFromString(const char *strval) { |
279 | int tempnum = 0; | 264 | int tempnum = 0; |
@@ -322,6 +307,20 @@ getString() { | |||
322 | return string(tmpstr); | 307 | return string(tmpstr); |
323 | } | 308 | } |
324 | } | 309 | } |
310 | template<> | ||
311 | void FbTk::Resource<long>:: | ||
312 | setFromString(const char *strval) { | ||
313 | if (sscanf(strval, "%ld", &m_value) != 1) | ||
314 | setDefaultValue(); | ||
315 | } | ||
316 | |||
317 | |||
318 | string FbTk::Resource<long>:: | ||
319 | getString() { | ||
320 | char tmpstr[128]; | ||
321 | sprintf(tmpstr, "%ld", m_value); | ||
322 | return string(tmpstr); | ||
323 | } | ||
325 | 324 | ||
326 | static Window last_bad_window = None; | 325 | static Window last_bad_window = None; |
327 | namespace { | 326 | namespace { |
@@ -393,11 +392,12 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile | |||
393 | m_rc_cache_life(m_resourcemanager, 5, "session.cacheLife", "Session.CacheLife"), | 392 | m_rc_cache_life(m_resourcemanager, 5, "session.cacheLife", "Session.CacheLife"), |
394 | m_rc_cache_max(m_resourcemanager, 200, "session.cacheMax", "Session.CacheMax"), | 393 | m_rc_cache_max(m_resourcemanager, 200, "session.cacheMax", "Session.CacheMax"), |
395 | m_rc_auto_raise_delay(m_resourcemanager, 250, "session.autoRaiseDelay", "Session.AutoRaiseDelay"), | 394 | m_rc_auto_raise_delay(m_resourcemanager, 250, "session.autoRaiseDelay", "Session.AutoRaiseDelay"), |
396 | m_focused_window(0), | 395 | m_focused_window(0), m_masked_window(0), |
397 | m_mousescreen(0), | 396 | m_mousescreen(0), |
398 | m_keyscreen(0), | 397 | m_keyscreen(0), |
399 | m_watching_screen(0), m_watch_keyrelease(0), | 398 | m_watching_screen(0), m_watch_keyrelease(0), |
400 | m_last_time(0), | 399 | m_last_time(0), |
400 | m_masked(0), | ||
401 | m_rc_file(rcfilename ? rcfilename : ""), | 401 | m_rc_file(rcfilename ? rcfilename : ""), |
402 | m_argv(argv), m_argc(argc), | 402 | m_argv(argv), m_argc(argc), |
403 | m_starting(true), | 403 | m_starting(true), |
@@ -405,9 +405,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile | |||
405 | m_server_grabs(0), | 405 | m_server_grabs(0), |
406 | m_randr_event_type(0), | 406 | m_randr_event_type(0), |
407 | m_RC_PATH("fluxbox"), | 407 | m_RC_PATH("fluxbox"), |
408 | m_RC_INIT_FILE("init"), | 408 | m_RC_INIT_FILE("init") { |
409 | m_focus_revert_screen(0) | ||
410 | { | ||
411 | 409 | ||
412 | 410 | ||
413 | if (s_singleton != 0) | 411 | if (s_singleton != 0) |
@@ -552,7 +550,7 @@ Fluxbox::Fluxbox(int argc, char **argv, const char *dpy_name, const char *rcfile | |||
552 | m_atomhandler[atomh]->initForScreen(*screen); | 550 | m_atomhandler[atomh]->initForScreen(*screen); |
553 | } | 551 | } |
554 | 552 | ||
555 | revertFocus(*screen, false); // make sure focus style is correct | 553 | revertFocus(*screen); // make sure focus style is correct |
556 | 554 | ||
557 | } // end init screens | 555 | } // end init screens |
558 | 556 | ||
@@ -624,10 +622,6 @@ void Fluxbox::eventLoop() { | |||
624 | } else { | 622 | } else { |
625 | last_bad_window = None; | 623 | last_bad_window = None; |
626 | handleEvent(&e); | 624 | handleEvent(&e); |
627 | if (m_focus_revert_screen != 0) { | ||
628 | revertFocus(*m_focus_revert_screen, false); | ||
629 | m_focus_revert_screen = 0; | ||
630 | } | ||
631 | } | 625 | } |
632 | } else { | 626 | } else { |
633 | FbTk::Timer::updateTimers(ConnectionNumber(disp)); //handle all timers | 627 | FbTk::Timer::updateTimers(ConnectionNumber(disp)); //handle all timers |
@@ -718,52 +712,18 @@ void Fluxbox::handleEvent(XEvent * const e) { | |||
718 | m_last_event = *e; | 712 | m_last_event = *e; |
719 | 713 | ||
720 | // it is possible (e.g. during moving) for a window | 714 | // it is possible (e.g. during moving) for a window |
721 | // to mask certain events to go somewhere (e.g. to that window) | 715 | // to mask all events to go to it |
722 | if (!m_redirect_events.empty()) { | 716 | if ((m_masked == e->xany.window) && m_masked_window) { |
723 | 717 | if (e->type == MotionNotify) { | |
724 | bool drop_event = false; | 718 | m_last_time = e->xmotion.time; |
725 | RedirectEvents::iterator it = m_redirect_events.begin(); | 719 | m_masked_window->motionNotifyEvent(e->xmotion); |
726 | RedirectEvents::iterator it_end = m_redirect_events.end(); | ||
727 | RedirectEvent *re = 0; | ||
728 | bool matched = false; | ||
729 | Window orig_win = e->xany.window; | ||
730 | |||
731 | // look through all registered redirects | ||
732 | while (it != it_end) { | ||
733 | matched = false; | ||
734 | re = *it; | ||
735 | // do we affect this event? | ||
736 | if (e->type == re->catch_type && | ||
737 | (re->catch_win == None || | ||
738 | re->catch_win == orig_win)) { | ||
739 | matched = true; | ||
740 | // redirect? | ||
741 | if (re->redirect_win != None) { | ||
742 | e->xany.window = re->redirect_win; | ||
743 | } else { | ||
744 | drop_event = true; | ||
745 | } | ||
746 | } | ||
747 | |||
748 | // does this event stop this redirect? | ||
749 | if (e->type == re->stop_type && | ||
750 | ((re->stop_win == None && matched) || | ||
751 | re->stop_win == orig_win)) { | ||
752 | RedirectEvents::iterator next_it = it; | ||
753 | ++next_it; | ||
754 | delete (*it); | ||
755 | m_redirect_events.erase(it); | ||
756 | it = next_it; | ||
757 | } else | ||
758 | ++it; | ||
759 | } | ||
760 | |||
761 | // if one of the redirects says to drop it, we do | ||
762 | if (drop_event) | ||
763 | return; | 720 | return; |
721 | } else if (e->type == ButtonRelease) { | ||
722 | e->xbutton.window = m_masked_window->fbWindow().window(); | ||
723 | } | ||
724 | |||
764 | } | 725 | } |
765 | 726 | ||
766 | |||
767 | // update key/mouse screen and last time before we enter other eventhandlers | 727 | // update key/mouse screen and last time before we enter other eventhandlers |
768 | if (e->type == KeyPress || | 728 | if (e->type == KeyPress || |
769 | e->type == KeyRelease) { | 729 | e->type == KeyRelease) { |
@@ -1211,7 +1171,7 @@ void Fluxbox::handleKeyEvent(XKeyEvent &ke) { | |||
1211 | if (m_watching_screen && m_watch_keyrelease) { | 1171 | if (m_watching_screen && m_watch_keyrelease) { |
1212 | // mask the mod of the released key out | 1172 | // mask the mod of the released key out |
1213 | // won't mask anything if it isn't a mod | 1173 | // won't mask anything if it isn't a mod |
1214 | ke.state &= ~FbTk::KeyUtil::keycodeToModmask(ke.keycode); | 1174 | ke.state &= ~FbTk::KeyUtil::instance().keycodeToModmask(ke.keycode); |
1215 | 1175 | ||
1216 | if ((m_watch_keyrelease & ke.state) == 0) { | 1176 | if ((m_watch_keyrelease & ke.state) == 0) { |
1217 | 1177 | ||
@@ -1628,6 +1588,7 @@ void Fluxbox::load_rc() { | |||
1628 | else // expand tilde | 1588 | else // expand tilde |
1629 | *m_rc_stylefile = StringUtil::expandFilename(*m_rc_stylefile); | 1589 | *m_rc_stylefile = StringUtil::expandFilename(*m_rc_stylefile); |
1630 | 1590 | ||
1591 | |||
1631 | // expand tilde | 1592 | // expand tilde |
1632 | *m_rc_groupfile = StringUtil::expandFilename(*m_rc_groupfile); | 1593 | *m_rc_groupfile = StringUtil::expandFilename(*m_rc_groupfile); |
1633 | 1594 | ||
@@ -1934,35 +1895,15 @@ void Fluxbox::setFocusedWindow(WinClient *client) { | |||
1934 | * ignore_event means that it ignores the given event until | 1895 | * ignore_event means that it ignores the given event until |
1935 | * it gets a focusIn | 1896 | * it gets a focusIn |
1936 | */ | 1897 | */ |
1937 | void Fluxbox::revertFocus(BScreen &screen, bool wait_for_end) { | 1898 | void Fluxbox::revertFocus(BScreen &screen) { |
1938 | // Relevant resources: | 1899 | // Relevant resources: |
1939 | // resource.focus_last = whether we focus last focused when changing workspace | 1900 | // resource.focus_last = whether we focus last focused when changing workspace |
1940 | // BScreen::FocusModel = sloppy, click, whatever | 1901 | // BScreen::FocusModel = sloppy, click, whatever |
1941 | if (wait_for_end) { | 1902 | WinClient *next_focus = screen.getLastFocusedWindow(screen.currentWorkspaceID()); |
1942 | if (m_focus_revert_screen == 0) { | ||
1943 | m_focus_revert_screen = &screen; | ||
1944 | return; | ||
1945 | } else if (m_focus_revert_screen == &screen) | ||
1946 | return; | ||
1947 | else | ||
1948 | cerr<<"Unexpected screen in revertFocus()"<<endl; | ||
1949 | } | ||
1950 | |||
1951 | WinClient *next_focus = 0; | ||
1952 | long ignore_event = 0; | ||
1953 | if (screen.doFocusLast()) { | ||
1954 | next_focus = screen.getLastFocusedWindow(screen.currentWorkspaceID()); | ||
1955 | |||
1956 | // when doFocusLast is set, we don't do exact sloppy focus - we | ||
1957 | // go to the last focused window, rather than the pointer window | ||
1958 | // i.e. we ignore any EnterNotify events until the focus sending arrives | ||
1959 | if (screen.getFocusModel() != BScreen::CLICKTOFOCUS) | ||
1960 | ignore_event = EnterNotify; | ||
1961 | } | ||
1962 | 1903 | ||
1963 | // if setting focus fails, or isn't possible, fallback correctly | 1904 | // if setting focus fails, or isn't possible, fallback correctly |
1964 | if (!(next_focus && next_focus->fbwindow() && | 1905 | if (!(next_focus && next_focus->fbwindow() && |
1965 | next_focus->fbwindow()->setCurrentClient(*next_focus, true, ignore_event))) { | 1906 | next_focus->fbwindow()->setCurrentClient(*next_focus, true))) { |
1966 | setFocusedWindow(0); // so we don't get dangling m_focused_window pointer | 1907 | setFocusedWindow(0); // so we don't get dangling m_focused_window pointer |
1967 | switch (screen.getFocusModel()) { | 1908 | switch (screen.getFocusModel()) { |
1968 | case BScreen::SLOPPYFOCUS: | 1909 | case BScreen::SLOPPYFOCUS: |
@@ -1990,42 +1931,3 @@ void Fluxbox::watchKeyRelease(BScreen &screen, unsigned int mods) { | |||
1990 | screen.rootWindow().window(), True, | 1931 | screen.rootWindow().window(), True, |
1991 | GrabModeAsync, GrabModeAsync, CurrentTime); | 1932 | GrabModeAsync, GrabModeAsync, CurrentTime); |
1992 | } | 1933 | } |
1993 | |||
1994 | /** | ||
1995 | * Allows people to create special event exclusions/redirects | ||
1996 | * useful for getting around X followup events, or for | ||
1997 | * effectively grabbing things | ||
1998 | * The ignore is automatically removed when it finds the wakeup_win | ||
1999 | * with an event matching the wakeup_mask | ||
2000 | * ignore None means all windows | ||
2001 | */ | ||
2002 | void Fluxbox::addRedirectEvent(BScreen *screen, | ||
2003 | long catch_type, Window catch_win, | ||
2004 | long stop_type, Window stop_win, | ||
2005 | Window redirect_win) { | ||
2006 | RedirectEvent * re = new RedirectEvent(); | ||
2007 | re->screen = screen; | ||
2008 | re->catch_type = catch_type; | ||
2009 | re->catch_win = catch_win; | ||
2010 | re->stop_type = stop_type; | ||
2011 | re->stop_win = stop_win; | ||
2012 | re->redirect_win = redirect_win; | ||
2013 | |||
2014 | m_redirect_events.push_back(re); | ||
2015 | } | ||
2016 | |||
2017 | // So that an object may remove the ignore on its own | ||
2018 | // stop_type of None means remove all redirects for this window | ||
2019 | void Fluxbox::removeRedirectEvent(long stop_type, Window stop_win) { | ||
2020 | RedirectEvents::iterator it = m_redirect_events.begin(); | ||
2021 | RedirectEvents::iterator it_end = m_redirect_events.end(); | ||
2022 | RedirectEvent *re = 0; | ||
2023 | for (; it != it_end; ++it) { | ||
2024 | re = *it; | ||
2025 | if (re->stop_win == stop_win && (stop_type == None || stop_type == re->stop_type)) { | ||
2026 | m_redirect_events.erase(it); | ||
2027 | delete re; | ||
2028 | return; | ||
2029 | } | ||
2030 | } | ||
2031 | } | ||
diff --git a/src/fluxbox.hh b/src/fluxbox.hh index 3056f4c..a02ece0 100644 --- a/src/fluxbox.hh +++ b/src/fluxbox.hh | |||
@@ -22,7 +22,7 @@ | |||
22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 22 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
23 | // DEALINGS IN THE SOFTWARE. | 23 | // DEALINGS IN THE SOFTWARE. |
24 | 24 | ||
25 | // $Id: fluxbox.hh,v 1.79 2003/12/21 23:24:25 fluxgen Exp $ | 25 | // $Id: fluxbox.hh,v 1.80 2003/12/30 20:56:40 fluxgen Exp $ |
26 | 26 | ||
27 | #ifndef FLUXBOX_HH | 27 | #ifndef FLUXBOX_HH |
28 | #define FLUXBOX_HH | 28 | #define FLUXBOX_HH |
@@ -149,11 +149,13 @@ public: | |||
149 | inline unsigned int getCacheLife() const { return *m_rc_cache_life * 60000; } | 149 | inline unsigned int getCacheLife() const { return *m_rc_cache_life * 60000; } |
150 | inline unsigned int getCacheMax() const { return *m_rc_cache_max; } | 150 | inline unsigned int getCacheMax() const { return *m_rc_cache_max; } |
151 | 151 | ||
152 | inline void maskWindowEvents(Window w, FluxboxWindow *bw) | ||
153 | { m_masked = w; m_masked_window = bw; } | ||
154 | |||
152 | void watchKeyRelease(BScreen &screen, unsigned int mods); | 155 | void watchKeyRelease(BScreen &screen, unsigned int mods); |
153 | 156 | ||
154 | void setFocusedWindow(WinClient *w); | 157 | void setFocusedWindow(WinClient *w); |
155 | // focus revert gets delayed until the end of the event handle | 158 | void revertFocus(BScreen &screen); |
156 | void revertFocus(BScreen &screen, bool wait_for_end = true); | ||
157 | void shutdown(); | 159 | void shutdown(); |
158 | void load_rc(BScreen &scr); | 160 | void load_rc(BScreen &scr); |
159 | void loadRootCommand(BScreen &scr); | 161 | void loadRootCommand(BScreen &scr); |
@@ -202,21 +204,6 @@ public: | |||
202 | // screen we are watching for modifier changes | 204 | // screen we are watching for modifier changes |
203 | BScreen *watchingScreen() { return m_watching_screen; } | 205 | BScreen *watchingScreen() { return m_watching_screen; } |
204 | const XEvent &lastEvent() const { return m_last_event; } | 206 | const XEvent &lastEvent() const { return m_last_event; } |
205 | |||
206 | /** | ||
207 | * Allows people to create special event exclusions/redirects | ||
208 | * useful for getting around X followup events, or for | ||
209 | * effectively grabbing things | ||
210 | * The ignore is automatically removed when it finds the stop_win | ||
211 | * with an event matching the stop_type | ||
212 | * ignore None means all windows | ||
213 | */ | ||
214 | void addRedirectEvent(BScreen *screen, long catch_type, Window catch_win, | ||
215 | long stop_type, Window stop_win, Window redirect_win); | ||
216 | |||
217 | // So that an object may remove the ignore on its own | ||
218 | void removeRedirectEvent(long stop_type, Window stop_win); | ||
219 | |||
220 | private: | 207 | private: |
221 | 208 | ||
222 | typedef struct MenuTimestamp { | 209 | typedef struct MenuTimestamp { |
@@ -259,7 +246,6 @@ private: | |||
259 | FbTk::Resource<TitlebarList> m_rc_titlebar_left, m_rc_titlebar_right; | 246 | FbTk::Resource<TitlebarList> m_rc_titlebar_left, m_rc_titlebar_right; |
260 | FbTk::Resource<unsigned int> m_rc_cache_life, m_rc_cache_max; | 247 | FbTk::Resource<unsigned int> m_rc_cache_life, m_rc_cache_max; |
261 | FbTk::Resource<time_t> m_rc_auto_raise_delay; | 248 | FbTk::Resource<time_t> m_rc_auto_raise_delay; |
262 | |||
263 | 249 | ||
264 | std::map<Window, WinClient *> m_window_search; | 250 | std::map<Window, WinClient *> m_window_search; |
265 | std::map<Window, FluxboxWindow *> m_window_search_group; | 251 | std::map<Window, FluxboxWindow *> m_window_search_group; |
@@ -275,19 +261,8 @@ private: | |||
275 | ScreenList m_screen_list; | 261 | ScreenList m_screen_list; |
276 | 262 | ||
277 | WinClient *m_focused_window; | 263 | WinClient *m_focused_window; |
264 | FluxboxWindow *m_masked_window; | ||
278 | 265 | ||
279 | typedef struct RedirectEvent { | ||
280 | BScreen *screen; | ||
281 | long catch_type; | ||
282 | Window catch_win; | ||
283 | long stop_type; | ||
284 | Window stop_win; | ||
285 | Window redirect_win; | ||
286 | } RedirectEvent; | ||
287 | |||
288 | typedef std::list<RedirectEvent *> RedirectEvents; | ||
289 | |||
290 | RedirectEvents m_redirect_events; | ||
291 | BScreen *m_mousescreen, *m_keyscreen; | 266 | BScreen *m_mousescreen, *m_keyscreen; |
292 | BScreen *m_watching_screen; | 267 | BScreen *m_watching_screen; |
293 | unsigned int m_watch_keyrelease; | 268 | unsigned int m_watch_keyrelease; |
@@ -296,6 +271,7 @@ private: | |||
296 | 271 | ||
297 | bool m_reconfigure_wait, m_reread_menu_wait; | 272 | bool m_reconfigure_wait, m_reread_menu_wait; |
298 | Time m_last_time; | 273 | Time m_last_time; |
274 | Window m_masked; | ||
299 | std::string m_rc_file; ///< resource filename | 275 | std::string m_rc_file; ///< resource filename |
300 | char **m_argv; | 276 | char **m_argv; |
301 | int m_argc; | 277 | int m_argc; |
@@ -320,9 +296,6 @@ private: | |||
320 | const char *m_RC_PATH; | 296 | const char *m_RC_PATH; |
321 | const char *m_RC_INIT_FILE; | 297 | const char *m_RC_INIT_FILE; |
322 | Atom m_kwm1_dockwindow, m_kwm2_dockwindow; | 298 | Atom m_kwm1_dockwindow, m_kwm2_dockwindow; |
323 | |||
324 | // each event can only affect one screen (right?) | ||
325 | BScreen *m_focus_revert_screen; | ||
326 | }; | 299 | }; |
327 | 300 | ||
328 | 301 | ||