From 09cc0bf6afa51466fd863b1e2f32ad5f5dd84bae Mon Sep 17 00:00:00 2001
From: markt <markt>
Date: Sat, 13 Jan 2007 18:59:49 +0000
Subject: little cleanup

---
 src/CurrentWindowCmd.cc |  2 +-
 src/FocusControl.cc     | 10 ++--------
 src/FocusControl.hh     |  3 +--
 src/Window.cc           |  8 ++------
 src/Window.hh           |  4 ----
 5 files changed, 6 insertions(+), 21 deletions(-)

diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc
index e4de9a4..a975bdd 100644
--- a/src/CurrentWindowCmd.cc
+++ b/src/CurrentWindowCmd.cc
@@ -93,7 +93,7 @@ void GoToTabCmd::real_execute() {
 
     while (--num > 0) ++it;
 
-    fbwindow().setCurrentClient(**it, true);
+    (*it)->focus();
 }
 
 void WindowHelperCmd::execute() {
diff --git a/src/FocusControl.cc b/src/FocusControl.cc
index e0bb886..c5441dd 100644
--- a/src/FocusControl.cc
+++ b/src/FocusControl.cc
@@ -50,9 +50,6 @@ FocusControl::FocusControl(BScreen &screen):
                       CLICKTABFOCUS, 
                       screen.name()+".tabFocusModel", 
                       screen.altName()+".TabFocusModel"),
-    m_focus_last(screen.resourceManager(), true, 
-                 screen.name()+".focusLastWindow", 
-                 screen.altName()+".FocusLastWindow"),
     m_focus_new(screen.resourceManager(), true, 
                 screen.name()+".focusNewWindows", 
                 screen.altName()+".FocusNewWindows"),
@@ -398,15 +395,12 @@ void FocusControl::revertFocus(BScreen &screen) {
 
     if (screen.focusControl().isCycling())
         return;
-    // Relevant resources:
-    // resource.focus_last = whether we focus last focused when changing workspace
-    // BScreen::FocusModel = sloppy, click, whatever
+
     WinClient *next_focus = 
         screen.focusControl().lastFocusedWindow(screen.currentWorkspaceID());
 
     // if setting focus fails, or isn't possible, fallback correctly
-    if (!(next_focus && next_focus->fbwindow() &&
-          next_focus->fbwindow()->setCurrentClient(*next_focus, true))) {
+    if (!(next_focus && next_focus->focus())) {
         setFocusedWindow(0); // so we don't get dangling m_focused_window pointer
         switch (screen.focusControl().focusModel()) {
         case FocusControl::MOUSEFOCUS:
diff --git a/src/FocusControl.hh b/src/FocusControl.hh
index df7922b..708b960 100644
--- a/src/FocusControl.hh
+++ b/src/FocusControl.hh
@@ -89,7 +89,6 @@ public:
 
     FocusModel focusModel() const { return *m_focus_model; }
     TabFocusModel tabFocusModel() const { return *m_tab_focus_model; }
-    bool focusLast() const { return *m_focus_last; }
     bool focusNew() const { return *m_focus_new; }
 
     WinClient *lastFocusedWindow(int workspace);
@@ -114,7 +113,7 @@ private:
 
     FbTk::Resource<FocusModel> m_focus_model;    
     FbTk::Resource<TabFocusModel> m_tab_focus_model;
-    FbTk::Resource<bool> m_focus_last, m_focus_new;
+    FbTk::Resource<bool> m_focus_new;
 
     // This list keeps the order of window focusing for this screen
     // Screen global so it works for sticky windows too.
diff --git a/src/Window.cc b/src/Window.cc
index fe4cf4a..ff005c3 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -284,8 +284,7 @@ public:
     explicit SetClientCmd(WinClient &client):m_client(client) {
     }
     void execute() {
-        if (m_client.fbwindow() != 0)
-            m_client.fbwindow()->setCurrentClient(m_client);
+        m_client.focus();
     }
 private:
     WinClient &m_client;
@@ -440,8 +439,6 @@ void FluxboxWindow::init() {
 
     frame().resize(m_client->width(), m_client->height());
 
-    m_last_focus_time.tv_sec = m_last_focus_time.tv_usec = 0;
-
     m_blackbox_attrib.workspace = m_workspace_number = m_screen.currentWorkspaceID();
 
     m_blackbox_attrib.flags = m_blackbox_attrib.attrib = m_blackbox_attrib.stack = 0;
@@ -1453,7 +1450,7 @@ bool FluxboxWindow::setInputFocus() {
             cerr<<__FUNCTION__<<": transient 0x"<<(*it)<<endl;
 #endif // DEBUG
             if ((*it)->isModal())
-                return (*it)->fbwindow()->setCurrentClient(**it, true);
+                return (*it)->focus();
         }
     }
 
@@ -2129,7 +2126,6 @@ void FluxboxWindow::setFocusFlag(bool focus) {
 #endif // DEBUG
     // Record focus timestamp for window cycling enhancements
     if (focused) {
-        gettimeofday(&m_last_focus_time, 0);
         screen().focusControl().setScreenFocusedWindow(*m_client);
     }
 
diff --git a/src/Window.hh b/src/Window.hh
index 429747f..50f756d 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -426,8 +426,6 @@ public:
 
     void reconfigTheme();
 
-    const timeval &lastFocusTime() const { return m_last_focus_time;}
-
     //@}
 
     class WinSubject: public FbTk::Subject {
@@ -521,8 +519,6 @@ private:
     Display *display; /// display connection
     BlackboxAttributes m_blackbox_attrib;
 
-    timeval m_last_focus_time;
-
     int m_button_grab_x, m_button_grab_y; // handles last button press event for move
     int m_last_resize_x, m_last_resize_y; // handles last button press event for resize
     int m_last_move_x, m_last_move_y; // handles last pos for non opaque moving
-- 
cgit v0.11.2