aboutsummaryrefslogtreecommitdiff
path: root/src/Toolbar.cc
diff options
context:
space:
mode:
authorrathnor <rathnor>2003-07-28 15:06:36 (GMT)
committerrathnor <rathnor>2003-07-28 15:06:36 (GMT)
commitd353b688dec41daddeec9696586a4519f58cce45 (patch)
tree322a29e0e31cb15a7725047c10144c4ab3d5e130 /src/Toolbar.cc
parentf9bb208da8e8926281c91f3e386ec1de48f700a2 (diff)
downloadfluxbox-d353b688dec41daddeec9696586a4519f58cce45.zip
fluxbox-d353b688dec41daddeec9696586a4519f58cce45.tar.bz2
update many things to use WinClient instead of FluxboxWindow
Diffstat (limited to 'src/Toolbar.cc')
-rw-r--r--src/Toolbar.cc31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index 409181b..dc8c2b3 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.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: Toolbar.cc,v 1.103 2003/07/25 10:03:55 rathnor Exp $ 25// $Id: Toolbar.cc,v 1.104 2003/07/28 15:06:34 rathnor Exp $
26 26
27#include "Toolbar.hh" 27#include "Toolbar.hh"
28 28
@@ -31,6 +31,7 @@
31#include "fluxbox.hh" 31#include "fluxbox.hh"
32#include "Screen.hh" 32#include "Screen.hh"
33#include "Window.hh" 33#include "Window.hh"
34#include "WinClient.hh"
34#include "Workspace.hh" 35#include "Workspace.hh"
35#include "ImageControl.hh" 36#include "ImageControl.hh"
36#include "ToolbarTheme.hh" 37#include "ToolbarTheme.hh"
@@ -880,21 +881,23 @@ void Toolbar::checkClock(bool redraw, bool date) {
880 881
881 882
882void Toolbar::redrawWindowLabel(bool redraw) { 883void Toolbar::redrawWindowLabel(bool redraw) {
883 if (Fluxbox::instance()->getFocusedWindow()) { 884 WinClient *winclient = Fluxbox::instance()->getFocusedWindow();
885 if (winclient) {
884 if (redraw) 886 if (redraw)
885 frame.window_label.clear(); 887 frame.window_label.clear();
886 888
887 FluxboxWindow *foc = Fluxbox::instance()->getFocusedWindow(); 889 const std::string &title = winclient->getTitle();
890
888 // don't draw focused window if it's not on the same screen 891 // don't draw focused window if it's not on the same screen
889 if (&foc->screen() != &screen() || foc->title().size() == 0) 892 if (&winclient->screen() != &screen() || title.size() == 0)
890 return; 893 return;
891 894
892 unsigned int newlen = foc->title().size(); 895 unsigned int newlen = title.size();
893 int dx = FbTk::doAlignment(frame.window_label_w, frame.bevel_w*2, 896 int dx = FbTk::doAlignment(frame.window_label_w, frame.bevel_w*2,
894 m_theme.justify(), 897 m_theme.justify(),
895 m_theme.font(), 898 m_theme.font(),
896 foc->title().c_str(), 899 title.c_str(),
897 foc->title().size(), newlen); 900 title.size(), newlen);
898 int dy = 1 + m_theme.font().ascent(); 901 int dy = 1 + m_theme.font().ascent();
899 902
900 if (m_theme.font().isRotated()) { 903 if (m_theme.font().isRotated()) {
@@ -907,7 +910,7 @@ void Toolbar::redrawWindowLabel(bool redraw) {
907 m_theme.font().drawText(frame.window_label.window(), 910 m_theme.font().drawText(frame.window_label.window(),
908 screen().screenNumber(), 911 screen().screenNumber(),
909 m_theme.windowTextGC(), 912 m_theme.windowTextGC(),
910 foc->title().c_str(), newlen, 913 title.c_str(), newlen,
911 dx, dy); 914 dx, dy);
912 } else 915 } else
913 frame.window_label.clear(); 916 frame.window_label.clear();
@@ -961,8 +964,9 @@ void Toolbar::edit() {
961 964
962 frame.workspace_label.clear(); 965 frame.workspace_label.clear();
963 Fluxbox * const fluxbox = Fluxbox::instance(); 966 Fluxbox * const fluxbox = Fluxbox::instance();
964 if (fluxbox->getFocusedWindow()) //disable focus on current focused window 967 WinClient *winclient = fluxbox->getFocusedWindow();
965 fluxbox->getFocusedWindow()->setFocusFlag(false); 968 if (winclient && winclient->fbwindow()) //disable focus on current focused window
969 winclient->fbwindow()->setFocusFlag(false);
966 970
967 frame.workspace_label.drawRectangle(screen().winFrameTheme().labelTextFocusGC(), 971 frame.workspace_label.drawRectangle(screen().winFrameTheme().labelTextFocusGC(),
968 frame.workspace_label_w / 2, 0, 1, 972 frame.workspace_label_w / 2, 0, 1,
@@ -1116,10 +1120,9 @@ void Toolbar::keyPressEvent(XKeyEvent &ke) {
1116 Fluxbox * const fluxbox = Fluxbox::instance(); 1120 Fluxbox * const fluxbox = Fluxbox::instance();
1117 1121
1118 if (fluxbox->getFocusedWindow()) { 1122 if (fluxbox->getFocusedWindow()) {
1119 fluxbox->getFocusedWindow()->setInputFocus(); 1123 fluxbox->getFocusedWindow()->focus();
1120 fluxbox->getFocusedWindow()->setFocusFlag(true);
1121 } else 1124 } else
1122 XSetInputFocus(FbTk::App::instance()->display(), PointerRoot, None, CurrentTime); 1125 fluxbox->revertFocus(screen());
1123 1126
1124 if (ks == XK_Return) //change workspace name if keypress = Return 1127 if (ks == XK_Return) //change workspace name if keypress = Return
1125 screen().currentWorkspace()->setName(m_new_workspace_name.c_str()); 1128 screen().currentWorkspace()->setName(m_new_workspace_name.c_str());