workspace menu and root menu inside visible area
This commit is contained in:
parent
93ffd19686
commit
323f5188fd
1 changed files with 71 additions and 72 deletions
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: FbCommands.cc,v 1.26 2004/08/30 12:19:52 akir Exp $
|
// $Id: FbCommands.cc,v 1.27 2004/09/11 20:28:35 fluxgen Exp $
|
||||||
|
|
||||||
#include "FbCommands.hh"
|
#include "FbCommands.hh"
|
||||||
#include "fluxbox.hh"
|
#include "fluxbox.hh"
|
||||||
|
@ -48,6 +48,45 @@
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
void showMenu(const BScreen &screen, FbTk::Menu &menu) {
|
||||||
|
Window root_ret; // not used
|
||||||
|
Window window_ret; // not used
|
||||||
|
|
||||||
|
int rx = 0, ry = 0;
|
||||||
|
int wx, wy; // not used
|
||||||
|
unsigned int mask; // not used
|
||||||
|
|
||||||
|
XQueryPointer(menu.fbwindow().display(),
|
||||||
|
screen.rootWindow().window(), &root_ret, &window_ret,
|
||||||
|
&rx, &ry, &wx, &wy, &mask);
|
||||||
|
|
||||||
|
int borderw = menu.fbwindow().borderWidth();
|
||||||
|
int head = screen.getHead(rx, ry);
|
||||||
|
|
||||||
|
pair<int, int> m =
|
||||||
|
screen.clampToHead(head,
|
||||||
|
rx - menu.width() / 2,
|
||||||
|
ry - menu.titleWindow().height() / 2,
|
||||||
|
menu.width() + 2*borderw,
|
||||||
|
menu.height() + 2*borderw);
|
||||||
|
|
||||||
|
menu.move(m.first, m.second);
|
||||||
|
menu.setScreen(screen.getHeadX(head),
|
||||||
|
screen.getHeadY(head),
|
||||||
|
screen.getHeadWidth(head),
|
||||||
|
screen.getHeadHeight(head));
|
||||||
|
// special case for root menu
|
||||||
|
if (&menu == &screen.getRootmenu())
|
||||||
|
Fluxbox::instance()->checkMenu();
|
||||||
|
|
||||||
|
menu.show();
|
||||||
|
menu.grabInputFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
namespace FbCommands {
|
namespace FbCommands {
|
||||||
|
|
||||||
ExecuteCmd::ExecuteCmd(const std::string &cmd, int screen_num):m_cmd(cmd), m_screen_num(screen_num) {
|
ExecuteCmd::ExecuteCmd(const std::string &cmd, int screen_num):m_cmd(cmd), m_screen_num(screen_num) {
|
||||||
|
@ -123,59 +162,19 @@ void SetStyleCmd::execute() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowRootMenuCmd::execute() {
|
void ShowRootMenuCmd::execute() {
|
||||||
Fluxbox *fb = Fluxbox::instance();
|
BScreen *screen = Fluxbox::instance()->mouseScreen();
|
||||||
BScreen *screen = fb->mouseScreen();
|
|
||||||
if (screen == 0)
|
if (screen == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Window root_ret;
|
::showMenu(*screen, screen->getRootmenu());
|
||||||
Window window_ret;
|
|
||||||
|
|
||||||
int rx, ry;
|
|
||||||
int wx, wy;
|
|
||||||
unsigned int mask;
|
|
||||||
|
|
||||||
if (XQueryPointer(fb->display(),
|
|
||||||
screen->rootWindow().window(), &root_ret, &window_ret,
|
|
||||||
&rx, &ry, &wx, &wy, &mask) ) {
|
|
||||||
|
|
||||||
if ( rx - (screen->getRootmenu().width()/2) > 0 )
|
|
||||||
rx-= screen->getRootmenu().width()/2;
|
|
||||||
screen->getRootmenu().move(rx, ry);
|
|
||||||
}
|
|
||||||
fb->checkMenu();
|
|
||||||
screen->getRootmenu().show();
|
|
||||||
screen->getRootmenu().grabInputFocus();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShowWorkspaceMenuCmd::execute() {
|
void ShowWorkspaceMenuCmd::execute() {
|
||||||
|
BScreen *screen = Fluxbox::instance()->mouseScreen();
|
||||||
Fluxbox *fb = Fluxbox::instance();
|
|
||||||
BScreen *screen = fb->mouseScreen();
|
|
||||||
if (screen == 0)
|
if (screen == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
::showMenu(*screen, screen->getWorkspacemenu());
|
||||||
Window root_ret;
|
|
||||||
Window window_ret;
|
|
||||||
|
|
||||||
int rx, ry;
|
|
||||||
int wx, wy;
|
|
||||||
unsigned int mask;
|
|
||||||
|
|
||||||
if ( XQueryPointer(fb->display(),
|
|
||||||
screen->rootWindow().window(), &root_ret, &window_ret,
|
|
||||||
&rx, &ry, &wx, &wy, &mask) ) {
|
|
||||||
|
|
||||||
if ( rx - (screen->getWorkspacemenu().width()/2) > 0 )
|
|
||||||
rx-= screen->getWorkspacemenu().width()/2;
|
|
||||||
screen->getWorkspacemenu().move(rx, ry);
|
|
||||||
}
|
|
||||||
fb->checkMenu();
|
|
||||||
screen->getWorkspacemenu().show();
|
|
||||||
screen->getWorkspacemenu().grabInputFocus();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue