From 5ff68036688bab5caa77e6ad0075c3a821f51e91 Mon Sep 17 00:00:00 2001 From: Jason Kasper Date: Tue, 6 Jan 2004 04:38:01 +0000 Subject: [PATCH] small positioning fixes --- src/KeyClient.cpp | 2 +- src/WindowlistMenu.cpp | 31 ++++++++++++++++++++----------- src/WindowlistMenu.h | 2 +- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/KeyClient.cpp b/src/KeyClient.cpp index c96ebde..e2677e9 100644 --- a/src/KeyClient.cpp +++ b/src/KeyClient.cpp @@ -365,7 +365,7 @@ bool KeyClient::process_signal(int sig) { case SIGFPE: case SIGINT: case SIGTERM: - setRunState( bt::Application::SHUTDOWN ); + bt::Application::shutdown(); default: return False; diff --git a/src/WindowlistMenu.cpp b/src/WindowlistMenu.cpp index 1b7b356..aa1b2e5 100644 --- a/src/WindowlistMenu.cpp +++ b/src/WindowlistMenu.cpp @@ -34,8 +34,7 @@ WindowlistMenu::WindowlistMenu (ScreenHandler * s) : _display = s->getKeyClient().XDisplay(); _config = s->getKeyClient().getConfig(); _debug = _config->getBoolValue("debug", false); -} -WindowlistMenu::~WindowlistMenu () { + _screen_info = & s->getScreenInfo(); } void WindowlistMenu::keyPressEvent (const XKeyEvent * const e) { @@ -70,13 +69,16 @@ void WindowlistMenu::keyPressEvent (const XKeyEvent * const e) { void WindowlistMenu::keyReleaseEvent (const XKeyEvent * const e) { - bt::Menu::keyReleaseEvent(e); + if (_debug) + std::cout << "WindowlistMenu: got keyReleaseEvent!" << std::endl; if (_screen->nothingIsPressed() ){ bt::Menu::hide(); _screen->keyReleaseEvent(e); } + bt::Menu::keyReleaseEvent(e); + } void WindowlistMenu::showCycleMenu( WindowList theList ) { @@ -90,19 +92,29 @@ void WindowlistMenu::showCycleMenu( WindowList theList ) { WindowList::const_iterator it = theList.begin(); const WindowList::const_iterator end = theList.end(); - unsigned int x = 0; + unsigned int i = 0; for (; it != end; it++) { - bt::Menu::insertItem( (*it)->title(), x++ ); + bt::Menu::insertItem( (*it)->title(), i++ ); } + // this is our current window, before cycling. set it checked as a + // visual indicator bt::Menu::setItemChecked(0, true); - bt::Menu::popup(50, 50); + int x = _config->getNumberValue("cyclemenux", 20); + int y = _config->getNumberValue("cyclemenuy", 20); + + // now show the menu + bt::Menu::popup(x, y, false); + bt::Menu::move(x,y); // reset our marker as we will increment it in selectNext... _current_index = -1; + // we don't have anything selected initially, so we need to set the + // selection to the second one (the first one is the + // currently-selected window selectNext(); selectNext(); @@ -131,7 +143,7 @@ void WindowlistMenu::selectNext() { neo.keycode = keyCode; // keep track of where we are... - if (++_current_index >= _windowList.size() ) + if (static_cast(++_current_index) >= _windowList.size() ) _current_index = 0; XWindow * win = getSelectedWindow(); @@ -164,14 +176,11 @@ XWindow * WindowlistMenu::getSelectedWindow() { WindowList::const_iterator it = _windowList.begin(); const WindowList::const_iterator end = _windowList.end(); - if (_debug) - std::cout << "WindowlistMenu: getSelectedWindow: current index is: [" - << _current_index << "]\n"; XWindow * win = 0; unsigned int x = 0; for (; it != end; it++) { - if ( _current_index == x++ ) { + if ( static_cast(_current_index) == x++ ) { win = dynamic_cast(*it); } } diff --git a/src/WindowlistMenu.h b/src/WindowlistMenu.h index ac14c20..8a1fc85 100644 --- a/src/WindowlistMenu.h +++ b/src/WindowlistMenu.h @@ -45,7 +45,6 @@ class WindowlistMenu : public bt::Menu public: WindowlistMenu (ScreenHandler * s); - ~WindowlistMenu (void) ; void showCycleMenu (WindowList theList ) ; void itemClicked(unsigned int id, unsigned int button); @@ -59,6 +58,7 @@ private: keytree * _keybindings; Display * _display; Config * _config; + const bt::ScreenInfo * _screen_info; bool _debug; int _current_index; -- 2.11.4.GIT