diff options
author | fluxgen <fluxgen> | 2003-09-06 14:13:06 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-09-06 14:13:06 (GMT) |
commit | 6e9130b2ad2fcbca102d2baffff05a8c8d7b7d5a (patch) | |
tree | b5c060b59a12742d0585df8545ab7d15009688a1 | |
parent | 12532042f5d6f1245ba308d7db024c8970c57df8 (diff) | |
download | fluxbox-6e9130b2ad2fcbca102d2baffff05a8c8d7b7d5a.zip fluxbox-6e9130b2ad2fcbca102d2baffff05a8c8d7b7d5a.tar.bz2 |
show root menu and workspace menu under mouse
-rw-r--r-- | src/FbCommands.cc | 52 | ||||
-rw-r--r-- | src/FbCommands.hh | 7 |
2 files changed, 54 insertions, 5 deletions
diff --git a/src/FbCommands.cc b/src/FbCommands.cc index 61b9e3e..3affe06 100644 --- a/src/FbCommands.cc +++ b/src/FbCommands.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: FbCommands.cc,v 1.15 2003/08/30 11:59:29 fluxgen Exp $ | 22 | // $Id: FbCommands.cc,v 1.16 2003/09/06 14:13:06 fluxgen Exp $ |
23 | 23 | ||
24 | #include "FbCommands.hh" | 24 | #include "FbCommands.hh" |
25 | #include "fluxbox.hh" | 25 | #include "fluxbox.hh" |
@@ -52,7 +52,7 @@ void ExecuteCmd::execute() { | |||
52 | screen_num = 0; | 52 | screen_num = 0; |
53 | else | 53 | else |
54 | screen_num = Fluxbox::instance()->mouseScreen()->screenNumber(); | 54 | screen_num = Fluxbox::instance()->mouseScreen()->screenNumber(); |
55 | } | 55 | } |
56 | 56 | ||
57 | sprintf(intbuff, "%d", screen_num); | 57 | sprintf(intbuff, "%d", screen_num); |
58 | 58 | ||
@@ -109,8 +109,52 @@ void ShowRootMenuCmd::execute() { | |||
109 | return; | 109 | return; |
110 | 110 | ||
111 | if (screen->getRootmenu()) { | 111 | if (screen->getRootmenu()) { |
112 | screen->getRootmenu()->show(); | 112 | |
113 | screen->getRootmenu()->grabInputFocus(); | 113 | Window root_ret; |
114 | Window window_ret; | ||
115 | |||
116 | int rx, ry; | ||
117 | int wx, wy; | ||
118 | unsigned int mask; | ||
119 | |||
120 | if ( XQueryPointer(FbTk::App::instance()->display(), | ||
121 | screen->rootWindow().window(), &root_ret, &window_ret, | ||
122 | &rx, &ry, &wx, &wy, &mask) ) { | ||
123 | |||
124 | if ( rx - (screen->getRootmenu()->width()/2) > 0 ) | ||
125 | rx-= screen->getRootmenu()->width()/2; | ||
126 | screen->getRootmenu()->move(rx, ry); | ||
127 | } | ||
128 | |||
129 | screen->getRootmenu()->show(); | ||
130 | screen->getRootmenu()->grabInputFocus(); | ||
131 | } | ||
132 | } | ||
133 | |||
134 | void ShowWorkspaceMenuCmd::execute() { | ||
135 | BScreen *screen = Fluxbox::instance()->mouseScreen(); | ||
136 | if (screen == 0) | ||
137 | return; | ||
138 | |||
139 | if (screen->getWorkspacemenu()) { | ||
140 | |||
141 | Window root_ret; | ||
142 | Window window_ret; | ||
143 | |||
144 | int rx, ry; | ||
145 | int wx, wy; | ||
146 | unsigned int mask; | ||
147 | |||
148 | if ( XQueryPointer(FbTk::App::instance()->display(), | ||
149 | screen->rootWindow().window(), &root_ret, &window_ret, | ||
150 | &rx, &ry, &wx, &wy, &mask) ) { | ||
151 | |||
152 | if ( rx - (screen->getWorkspacemenu()->width()/2) > 0 ) | ||
153 | rx-= screen->getWorkspacemenu()->width()/2; | ||
154 | screen->getWorkspacemenu()->move(rx, ry); | ||
155 | } | ||
156 | screen->getWorkspacemenu()->show(); | ||
157 | screen->getWorkspacemenu()->grabInputFocus(); | ||
114 | } | 158 | } |
115 | } | 159 | } |
116 | 160 | ||
diff --git a/src/FbCommands.hh b/src/FbCommands.hh index 83fe0f9..e2c8482 100644 --- a/src/FbCommands.hh +++ b/src/FbCommands.hh | |||
@@ -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: FbCommands.hh,v 1.10 2003/08/30 11:59:29 fluxgen Exp $ | 22 | // $Id: FbCommands.hh,v 1.11 2003/09/06 14:13:06 fluxgen Exp $ |
23 | 23 | ||
24 | // \file contains basic commands to restart, reconfigure, execute command and exit fluxbox | 24 | // \file contains basic commands to restart, reconfigure, execute command and exit fluxbox |
25 | 25 | ||
@@ -88,6 +88,11 @@ public: | |||
88 | void execute(); | 88 | void execute(); |
89 | }; | 89 | }; |
90 | 90 | ||
91 | class ShowWorkspaceMenuCmd: public FbTk::Command { | ||
92 | public: | ||
93 | void execute(); | ||
94 | }; | ||
95 | |||
91 | class SetWorkspaceNameCmd: public FbTk::Command { | 96 | class SetWorkspaceNameCmd: public FbTk::Command { |
92 | public: | 97 | public: |
93 | void execute(); | 98 | void execute(); |