diff options
Diffstat (limited to 'src/Window.cc')
-rw-r--r-- | src/Window.cc | 94 |
1 files changed, 40 insertions, 54 deletions
diff --git a/src/Window.cc b/src/Window.cc index 5adc484..edf88fc 100644 --- a/src/Window.cc +++ b/src/Window.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: Window.cc,v 1.253 2003/12/14 01:06:22 fluxgen Exp $ | 25 | // $Id: Window.cc,v 1.254 2003/12/18 18:03:21 fluxgen Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -248,7 +248,7 @@ void LayerMenuItem<FluxboxWindow>::click(int button, int time) { | |||
248 | m_object->moveToLayer(m_layernum); | 248 | m_object->moveToLayer(m_layernum); |
249 | } | 249 | } |
250 | 250 | ||
251 | FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &tm, | 251 | FluxboxWindow::FluxboxWindow(WinClient &client, FbWinFrameTheme &tm, |
252 | FbTk::XLayer &layer): | 252 | FbTk::XLayer &layer): |
253 | oplock(false), | 253 | oplock(false), |
254 | m_hintsig(*this), | 254 | m_hintsig(*this), |
@@ -262,16 +262,16 @@ FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &t | |||
262 | iconic(false), focused(false), | 262 | iconic(false), focused(false), |
263 | stuck(false), m_managed(false), | 263 | stuck(false), m_managed(false), |
264 | maximized(MAX_NONE), | 264 | maximized(MAX_NONE), |
265 | m_screen(scr), | 265 | m_screen(client.screen()), |
266 | display(FbTk::App::instance()->display()), | 266 | display(FbTk::App::instance()->display()), |
267 | m_windowmenu(*scr.menuTheme(), scr.imageControl(), | 267 | m_windowmenu(client.screen().menuTheme(), client.screen().imageControl(), |
268 | *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), | 268 | *client.screen().layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), |
269 | m_old_decoration(DECOR_NORMAL), | 269 | m_old_decoration(DECOR_NORMAL), |
270 | m_client(&client), | 270 | m_client(&client), |
271 | m_frame(new FbWinFrame(tm, scr.imageControl(), scr.screenNumber(), 0, 0, 100, 100)), | 271 | m_frame(tm, client.screen().imageControl(), 0, 0, 100, 100), |
272 | m_layeritem(m_frame->window(), layer), | 272 | m_layeritem(m_frame.window(), layer), |
273 | m_layernum(layer.getLayerNum()), | 273 | m_layernum(layer.getLayerNum()), |
274 | m_parent(scr.rootWindow()), | 274 | m_parent(client.screen().rootWindow()), |
275 | m_resize_corner(RIGHTBOTTOM) { | 275 | m_resize_corner(RIGHTBOTTOM) { |
276 | 276 | ||
277 | init(); | 277 | init(); |
@@ -539,12 +539,15 @@ void FluxboxWindow::init() { | |||
539 | 539 | ||
540 | setState(m_current_state); | 540 | setState(m_current_state); |
541 | 541 | ||
542 | // add extra menus | ||
543 | addExtraMenu("Send To...", new SendToMenu(*this)); | ||
542 | addExtraMenu("Layer...", | 544 | addExtraMenu("Layer...", |
543 | new LayerMenu<FluxboxWindow>(*screen().menuTheme(), | 545 | new LayerMenu<FluxboxWindow>(screen().menuTheme(), |
544 | screen().imageControl(), | 546 | screen().imageControl(), |
545 | *screen().layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), | 547 | *screen().layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), |
546 | this, | 548 | this, |
547 | false)); | 549 | false)); |
550 | |||
548 | // the layermenu will get deleted as an extra menu | 551 | // the layermenu will get deleted as an extra menu |
549 | // don't call setupWindow here as the addExtraMenu call should | 552 | // don't call setupWindow here as the addExtraMenu call should |
550 | 553 | ||
@@ -3093,22 +3096,6 @@ const FbTk::FbWindow &FluxboxWindow::fbWindow() const { | |||
3093 | return frame().window(); | 3096 | return frame().window(); |
3094 | } | 3097 | } |
3095 | 3098 | ||
3096 | int FluxboxWindow::x() const { | ||
3097 | return frame().x(); | ||
3098 | } | ||
3099 | |||
3100 | int FluxboxWindow::y() const { | ||
3101 | return frame().y(); | ||
3102 | } | ||
3103 | |||
3104 | unsigned int FluxboxWindow::width() const { | ||
3105 | return frame().width(); | ||
3106 | } | ||
3107 | |||
3108 | unsigned int FluxboxWindow::height() const { | ||
3109 | return frame().height(); | ||
3110 | } | ||
3111 | |||
3112 | unsigned int FluxboxWindow::titlebarHeight() const { | 3099 | unsigned int FluxboxWindow::titlebarHeight() const { |
3113 | return frame().titlebarHeight(); | 3100 | return frame().titlebarHeight(); |
3114 | } | 3101 | } |
@@ -3321,7 +3308,6 @@ void FluxboxWindow::setupWindow() { | |||
3321 | // sets up our window | 3308 | // sets up our window |
3322 | // we allow both to be done at once to share the commands | 3309 | // we allow both to be done at once to share the commands |
3323 | 3310 | ||
3324 | FbWinFrame &frame = *m_frame.get(); | ||
3325 | WinButtonTheme &winbutton_theme = screen().winButtonTheme(); | 3311 | WinButtonTheme &winbutton_theme = screen().winButtonTheme(); |
3326 | 3312 | ||
3327 | typedef FbTk::RefCount<FbTk::Command> CommandRef; | 3313 | typedef FbTk::RefCount<FbTk::Command> CommandRef; |
@@ -3343,7 +3329,7 @@ void FluxboxWindow::setupWindow() { | |||
3343 | CommandRef show_menu_cmd(new WindowCmd(*this, &FluxboxWindow::popupMenu)); | 3329 | CommandRef show_menu_cmd(new WindowCmd(*this, &FluxboxWindow::popupMenu)); |
3344 | 3330 | ||
3345 | // clear old buttons from frame | 3331 | // clear old buttons from frame |
3346 | frame.removeAllButtons(); | 3332 | frame().removeAllButtons(); |
3347 | //!! TODO: fix this ugly hack | 3333 | //!! TODO: fix this ugly hack |
3348 | // get titlebar configuration | 3334 | // get titlebar configuration |
3349 | const vector<Fluxbox::Titlebar> *dir = &Fluxbox::instance()->getTitlebarLeft(); | 3335 | const vector<Fluxbox::Titlebar> *dir = &Fluxbox::instance()->getTitlebarLeft(); |
@@ -3354,14 +3340,14 @@ void FluxboxWindow::setupWindow() { | |||
3354 | if (isIconifiable() && (*dir)[i] == Fluxbox::MINIMIZE) { | 3340 | if (isIconifiable() && (*dir)[i] == Fluxbox::MINIMIZE) { |
3355 | newbutton = new WinButton(*this, winbutton_theme, | 3341 | newbutton = new WinButton(*this, winbutton_theme, |
3356 | WinButton::MINIMIZE, | 3342 | WinButton::MINIMIZE, |
3357 | frame.titlebar(), | 3343 | frame().titlebar(), |
3358 | 0, 0, 10, 10); | 3344 | 0, 0, 10, 10); |
3359 | newbutton->setOnClick(iconify_cmd); | 3345 | newbutton->setOnClick(iconify_cmd); |
3360 | 3346 | ||
3361 | } else if (isMaximizable() && (*dir)[i] == Fluxbox::MAXIMIZE) { | 3347 | } else if (isMaximizable() && (*dir)[i] == Fluxbox::MAXIMIZE) { |
3362 | newbutton = new WinButton(*this, winbutton_theme, | 3348 | newbutton = new WinButton(*this, winbutton_theme, |
3363 | WinButton::MAXIMIZE, | 3349 | WinButton::MAXIMIZE, |
3364 | frame.titlebar(), | 3350 | frame().titlebar(), |
3365 | 0, 0, 10, 10); | 3351 | 0, 0, 10, 10); |
3366 | 3352 | ||
3367 | newbutton->setOnClick(maximize_cmd, 1); | 3353 | newbutton->setOnClick(maximize_cmd, 1); |
@@ -3371,7 +3357,7 @@ void FluxboxWindow::setupWindow() { | |||
3371 | } else if (m_client->isClosable() && (*dir)[i] == Fluxbox::CLOSE) { | 3357 | } else if (m_client->isClosable() && (*dir)[i] == Fluxbox::CLOSE) { |
3372 | newbutton = new WinButton(*this, winbutton_theme, | 3358 | newbutton = new WinButton(*this, winbutton_theme, |
3373 | WinButton::CLOSE, | 3359 | WinButton::CLOSE, |
3374 | frame.titlebar(), | 3360 | frame().titlebar(), |
3375 | 0, 0, 10, 10); | 3361 | 0, 0, 10, 10); |
3376 | 3362 | ||
3377 | newbutton->setOnClick(close_cmd); | 3363 | newbutton->setOnClick(close_cmd); |
@@ -3379,7 +3365,7 @@ void FluxboxWindow::setupWindow() { | |||
3379 | } else if ((*dir)[i] == Fluxbox::STICK) { | 3365 | } else if ((*dir)[i] == Fluxbox::STICK) { |
3380 | WinButton *winbtn = new WinButton(*this, winbutton_theme, | 3366 | WinButton *winbtn = new WinButton(*this, winbutton_theme, |
3381 | WinButton::STICK, | 3367 | WinButton::STICK, |
3382 | frame.titlebar(), | 3368 | frame().titlebar(), |
3383 | 0, 0, 10, 10); | 3369 | 0, 0, 10, 10); |
3384 | stateSig().attach(winbtn); | 3370 | stateSig().attach(winbtn); |
3385 | winbtn->setOnClick(stick_cmd); | 3371 | winbtn->setOnClick(stick_cmd); |
@@ -3387,7 +3373,7 @@ void FluxboxWindow::setupWindow() { | |||
3387 | } else if ((*dir)[i] == Fluxbox::SHADE) { | 3373 | } else if ((*dir)[i] == Fluxbox::SHADE) { |
3388 | WinButton *winbtn = new WinButton(*this, winbutton_theme, | 3374 | WinButton *winbtn = new WinButton(*this, winbutton_theme, |
3389 | WinButton::SHADE, | 3375 | WinButton::SHADE, |
3390 | frame.titlebar(), | 3376 | frame().titlebar(), |
3391 | 0, 0, 10, 10); | 3377 | 0, 0, 10, 10); |
3392 | winbtn->setOnClick(shade_cmd); | 3378 | winbtn->setOnClick(shade_cmd); |
3393 | } | 3379 | } |
@@ -3395,33 +3381,33 @@ void FluxboxWindow::setupWindow() { | |||
3395 | if (newbutton != 0) { | 3381 | if (newbutton != 0) { |
3396 | newbutton->show(); | 3382 | newbutton->show(); |
3397 | if (c == 0) | 3383 | if (c == 0) |
3398 | frame.addLeftButton(newbutton); | 3384 | frame().addLeftButton(newbutton); |
3399 | else | 3385 | else |
3400 | frame.addRightButton(newbutton); | 3386 | frame().addRightButton(newbutton); |
3401 | } | 3387 | } |
3402 | } //end for i | 3388 | } //end for i |
3403 | dir = &Fluxbox::instance()->getTitlebarRight(); | 3389 | dir = &Fluxbox::instance()->getTitlebarRight(); |
3404 | } // end for c | 3390 | } // end for c |
3405 | 3391 | ||
3406 | frame.reconfigure(); | 3392 | frame().reconfigure(); |
3407 | 3393 | ||
3408 | // setup titlebar | 3394 | // setup titlebar |
3409 | frame.setOnClickTitlebar(raise_and_focus_cmd, 1, false, true); // on press with button 1 | 3395 | frame().setOnClickTitlebar(raise_and_focus_cmd, 1, false, true); // on press with button 1 |
3410 | frame.setOnClickTitlebar(shade_cmd, 1, true); // doubleclick with button 1 | 3396 | frame().setOnClickTitlebar(shade_cmd, 1, true); // doubleclick with button 1 |
3411 | frame.setOnClickTitlebar(show_menu_cmd, 3); // on release with button 3 | 3397 | frame().setOnClickTitlebar(show_menu_cmd, 3); // on release with button 3 |
3412 | frame.setOnClickTitlebar(lower_cmd, 2); // on release with button 2 | 3398 | frame().setOnClickTitlebar(lower_cmd, 2); // on release with button 2 |
3413 | frame.setDoubleClickTime(Fluxbox::instance()->getDoubleClickInterval()); | 3399 | frame().setDoubleClickTime(Fluxbox::instance()->getDoubleClickInterval()); |
3414 | 3400 | ||
3415 | // end setup frame | 3401 | // end setup frame |
3416 | 3402 | ||
3417 | // setup menu | 3403 | // setup menu |
3418 | FbTk::Menu &menu = m_windowmenu; | 3404 | |
3419 | menu.removeAll(); // clear old items | 3405 | menu().removeAll(); // clear old items |
3420 | menu.disableTitle(); // not titlebar | 3406 | menu().disableTitle(); // not titlebar |
3421 | 3407 | ||
3422 | // set new menu items | 3408 | // set new menu items |
3423 | menu.insert("Shade", shade_cmd); | 3409 | menu().insert("Shade", shade_cmd); |
3424 | menu.insert("Stick", stick_cmd); | 3410 | menu().insert("Stick", stick_cmd); |
3425 | // create maximize item with: | 3411 | // create maximize item with: |
3426 | // button1: Maximize normal | 3412 | // button1: Maximize normal |
3427 | // button2: Maximize Vertical | 3413 | // button2: Maximize Vertical |
@@ -3430,23 +3416,23 @@ void FluxboxWindow::setupWindow() { | |||
3430 | maximize_item->setCommand(1, maximize_cmd); | 3416 | maximize_item->setCommand(1, maximize_cmd); |
3431 | maximize_item->setCommand(2, maximize_vert_cmd); | 3417 | maximize_item->setCommand(2, maximize_vert_cmd); |
3432 | maximize_item->setCommand(3, maximize_horiz_cmd); | 3418 | maximize_item->setCommand(3, maximize_horiz_cmd); |
3433 | menu.insert(maximize_item); | 3419 | menu().insert(maximize_item); |
3434 | menu.insert("Iconify", iconify_cmd); | 3420 | menu().insert("Iconify", iconify_cmd); |
3435 | menu.insert("Raise", raise_cmd); | 3421 | menu().insert("Raise", raise_cmd); |
3436 | menu.insert("Lower", lower_cmd); | 3422 | menu().insert("Lower", lower_cmd); |
3423 | |||
3437 | 3424 | ||
3438 | menu.insert("Send To...", new SendToMenu(*this)); | ||
3439 | 3425 | ||
3440 | ExtraMenus::iterator it = m_extramenus.begin(); | 3426 | ExtraMenus::iterator it = m_extramenus.begin(); |
3441 | ExtraMenus::iterator it_end = m_extramenus.end(); | 3427 | ExtraMenus::iterator it_end = m_extramenus.end(); |
3442 | for (; it != it_end; ++it) { | 3428 | for (; it != it_end; ++it) { |
3443 | it->second->disableTitle(); // be sure there is no title | 3429 | it->second->disableTitle(); // be sure there is no title |
3444 | menu.insert(it->first, it->second); | 3430 | menu().insert(it->first, it->second); |
3445 | } | 3431 | } |
3446 | 3432 | ||
3447 | 3433 | ||
3448 | menu.insert("---"); | 3434 | menu().insert("---"); |
3449 | menu.insert("Close", close_cmd); | 3435 | menu().insert("Close", close_cmd); |
3450 | 3436 | ||
3451 | menu.reconfigure(); // update graphics | 3437 | menu().reconfigure(); // update graphics |
3452 | } | 3438 | } |