aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-05-17 16:35:58 (GMT)
committerfluxgen <fluxgen>2002-05-17 16:35:58 (GMT)
commit63f6204c78f3d905bd0d9be700fafa64d4d636a4 (patch)
treebc3c4349073c75eb2f2afbfa36678ac88c770404 /src/Window.cc
parent6d706bbccb102cef07b65b10cf994c06583f7fd8 (diff)
downloadfluxbox-63f6204c78f3d905bd0d9be700fafa64d4d636a4.zip
fluxbox-63f6204c78f3d905bd0d9be700fafa64d4d636a4.tar.bz2
moved creation of titlebar and handle into functions and other minor cleaning
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc226
1 files changed, 141 insertions, 85 deletions
diff --git a/src/Window.cc b/src/Window.cc
index 7499378..47dc808 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.51 2002/05/17 13:27:20 fluxgen Exp $ 25// $Id: Window.cc,v 1.52 2002/05/17 16:35:58 fluxgen Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -302,13 +302,6 @@ tab(0)
302 } else 302 } else
303 place_window = false; 303 place_window = false;
304 304
305/* if ((fluxbox->isStartup()) ||
306 (frame.x >= 0 &&
307 (signed) (frame.y + frame.y_border) >= 0 &&
308 frame.x <= (signed) screen->getWidth() &&
309 frame.y <= (signed) screen->getHeight()))
310 place_window = false; */
311
312 } 305 }
313 306
314 frame.window = createToplevelWindow(frame.x, frame.y, frame.width, 307 frame.window = createToplevelWindow(frame.x, frame.y, frame.width,
@@ -320,27 +313,9 @@ tab(0)
320 frame.plate = createChildWindow(frame.window); //Create plate window 313 frame.plate = createChildWindow(frame.window); //Create plate window
321 fluxbox->saveWindowSearch(frame.plate, this); //save plate window 314 fluxbox->saveWindowSearch(frame.plate, this); //save plate window
322 315
323 frame.title = createChildWindow(frame.window); //create titlebar win 316 createTitlebar();
324 if (decorations.titlebar) { //have titlebar decorations? 317 createHandle();
325 fluxbox->saveWindowSearch(frame.title, this); //save titlebar win 318
326 frame.label = createChildWindow(frame.title); //create label win in titlebar
327 fluxbox->saveWindowSearch(frame.label, this); //save label win
328 }
329
330 if (decorations.handle) { //have handle decorations ?
331 frame.handle = createChildWindow(frame.window); //create handle win
332 fluxbox->saveWindowSearch(frame.handle, this); //save handle win
333
334 frame.left_grip = // create left handle
335 createChildWindow(frame.handle, fluxbox->getLowerLeftAngleCursor());
336 fluxbox->saveWindowSearch(frame.left_grip, this); //save left handle
337
338 frame.right_grip = // create right handle
339 createChildWindow(frame.handle, fluxbox->getLowerRightAngleCursor());
340 fluxbox->saveWindowSearch(frame.right_grip, this); //save right handle
341 }
342
343
344 associateClientWindow(); 319 associateClientWindow();
345 320
346 grabButtons(); 321 grabButtons();
@@ -377,7 +352,6 @@ tab(0)
377 if (maximized && functions.maximize) { 352 if (maximized && functions.maximize) {
378 int m = maximized; 353 int m = maximized;
379 maximized = false; 354 maximized = false;
380
381 maximize(m); 355 maximize(m);
382 } 356 }
383 357
@@ -398,9 +372,9 @@ tab(0)
398FluxboxWindow::~FluxboxWindow(void) { 372FluxboxWindow::~FluxboxWindow(void) {
399 if (screen==0) //the window wasn't created 373 if (screen==0) //the window wasn't created
400 return; 374 return;
401 375
402 Fluxbox *fluxbox = Fluxbox::instance(); 376 Fluxbox *fluxbox = Fluxbox::instance();
403 377
404 if (moving || resizing) { 378 if (moving || resizing) {
405 screen->hideGeometry(); 379 screen->hideGeometry();
406 XUngrabPointer(display, CurrentTime); 380 XUngrabPointer(display, CurrentTime);
@@ -418,7 +392,7 @@ FluxboxWindow::~FluxboxWindow(void) {
418 windowmenu = 0; 392 windowmenu = 0;
419 } 393 }
420 394
421 if (tab!=0) { 395 if (tab != 0) {
422 delete tab; 396 delete tab;
423 tab = 0; 397 tab = 0;
424 } 398 }
@@ -427,6 +401,7 @@ FluxboxWindow::~FluxboxWindow(void) {
427 XFree(client.mwm_hint); 401 XFree(client.mwm_hint);
428 client.mwm_hint = 0; 402 client.mwm_hint = 0;
429 } 403 }
404
430 if (client.blackbox_hint!=0) { 405 if (client.blackbox_hint!=0) {
431 XFree(client.blackbox_hint); 406 XFree(client.blackbox_hint);
432 client.blackbox_hint = 0; 407 client.blackbox_hint = 0;
@@ -445,82 +420,49 @@ FluxboxWindow::~FluxboxWindow(void) {
445 fluxbox->setFocusedWindow(client.transient_for); 420 fluxbox->setFocusedWindow(client.transient_for);
446 } 421 }
447 422
448 if (client.window_group) 423 if (client.window_group) {
449 fluxbox->removeGroupSearch(client.window_group); 424 fluxbox->removeGroupSearch(client.window_group);
425 client.window_group = 0;
426 }
450 427
451 if (transient && client.transient_for) 428 if (transient && client.transient_for)
452 client.transient_for->client.transient = client.transient; 429 client.transient_for->client.transient = client.transient;
453 if (client.transient) 430 if (client.transient)
454 client.transient->client.transient_for = client.transient_for; 431 client.transient->client.transient_for = client.transient_for;
455
456 while ( !buttonlist.empty()) { //destroy all buttons on titlebar
457 fluxbox->removeWindowSearch(buttonlist.back().win);
458 XDestroyWindow(display, buttonlist.back().win);
459 buttonlist.pop_back();
460 }
461
462 if (frame.title) {
463 if (frame.ftitle)
464 image_ctrl->removeImage(frame.ftitle);
465
466 if (frame.utitle)
467 image_ctrl->removeImage(frame.utitle);
468
469 if (frame.flabel)
470 image_ctrl->removeImage(frame.flabel);
471
472 if( frame.ulabel)
473 image_ctrl->removeImage(frame.ulabel);
474
475 fluxbox->removeWindowSearch(frame.label);
476 fluxbox->removeWindowSearch(frame.title);
477 XDestroyWindow(display, frame.label);
478 XDestroyWindow(display, frame.title);
479 }
480
481 if (frame.handle) {
482 if (frame.fhandle)
483 image_ctrl->removeImage(frame.fhandle);
484
485 if (frame.uhandle)
486 image_ctrl->removeImage(frame.uhandle);
487
488 if (frame.fgrip)
489 image_ctrl->removeImage(frame.fgrip);
490
491 if (frame.ugrip)
492 image_ctrl->removeImage(frame.ugrip);
493
494 fluxbox->removeWindowSearch(frame.right_grip);
495 fluxbox->removeWindowSearch(frame.left_grip);
496 fluxbox->removeWindowSearch(frame.handle);
497 432
498 XDestroyWindow(display, frame.right_grip); 433 destroyTitlebar();
499 XDestroyWindow(display, frame.left_grip);
500 XDestroyWindow(display, frame.handle);
501 }
502 434
503 if (frame.fbutton) 435 destroyHandle();
436
437 if (frame.fbutton) {
504 image_ctrl->removeImage(frame.fbutton); 438 image_ctrl->removeImage(frame.fbutton);
439 frame.fbutton = 0;
440 }
505 441
506 if (frame.ubutton) 442 if (frame.ubutton) {
507 image_ctrl->removeImage(frame.ubutton); 443 image_ctrl->removeImage(frame.ubutton);
444 frame.ubutton = 0;
445 }
508 446
509 if (frame.pbutton) 447 if (frame.pbutton) {
510 image_ctrl->removeImage(frame.pbutton); 448 image_ctrl->removeImage(frame.pbutton);
449 frame.pbutton = 0;
450 }
511 451
512 452
513 if (frame.plate) { //NOTE 453 if (frame.plate) {
514 fluxbox->removeWindowSearch(frame.plate); 454 fluxbox->removeWindowSearch(frame.plate);
515 XDestroyWindow(display, frame.plate); 455 XDestroyWindow(display, frame.plate);
456 frame.plate = 0;
516 } 457 }
517 458
518 if (frame.window) { 459 if (frame.window) {
519 fluxbox->removeWindowSearch(frame.window); 460 fluxbox->removeWindowSearch(frame.window);
520 XDestroyWindow(display, frame.window); 461 XDestroyWindow(display, frame.window);
462 frame.window = 0;
521 } 463 }
522 464
523 if (managed) { 465 if (client.window) {
524 fluxbox->removeWindowSearch(client.window); 466 fluxbox->removeWindowSearch(client.window);
525 screen->removeNetizen(client.window); 467 screen->removeNetizen(client.window);
526 } 468 }
@@ -3669,6 +3611,120 @@ void FluxboxWindow::updateIcon() {
3669 } 3611 }
3670} 3612}
3671 3613
3614void FluxboxWindow::createTitlebar() {
3615
3616 frame.title = createChildWindow(frame.window); //create titlebar win
3617 if (decorations.titlebar) { //have titlebar decorations?
3618 Fluxbox *fb = Fluxbox::instance();
3619 fb->saveWindowSearch(frame.title, this); //save titlebar win
3620 frame.label = createChildWindow(frame.title); //create label win in titlebar
3621 fb->saveWindowSearch(frame.label, this); //save label win
3622 }
3623}
3624
3625void FluxboxWindow::destroyTitlebar() {
3626 Fluxbox *fb = Fluxbox::instance();
3627
3628 while ( !buttonlist.empty()) { //destroy all buttons on titlebar
3629 fb->removeWindowSearch(buttonlist.back().win);
3630 XDestroyWindow(display, buttonlist.back().win);
3631 buttonlist.pop_back();
3632 }
3633
3634 if (frame.title) {
3635 if (frame.ftitle) {
3636 image_ctrl->removeImage(frame.ftitle);
3637 frame.ftitle = 0;
3638 }
3639
3640 if (frame.utitle) {
3641 image_ctrl->removeImage(frame.utitle);
3642 frame.utitle = 0;
3643 }
3644
3645 if (frame.flabel) {
3646 image_ctrl->removeImage(frame.flabel);
3647 frame.flabel = 0;
3648 }
3649
3650 if( frame.ulabel) {
3651 image_ctrl->removeImage(frame.ulabel);
3652 frame.ulabel = 0;
3653 }
3654
3655 fb->removeWindowSearch(frame.label);
3656 fb->removeWindowSearch(frame.title);
3657
3658 XDestroyWindow(display, frame.label);
3659 frame.label = 0;
3660 XDestroyWindow(display, frame.title);
3661 frame.title = 0;
3662 }
3663
3664
3665}
3666
3667void FluxboxWindow::createHandle() {
3668
3669 if (!decorations.handle)
3670 return;
3671
3672 Fluxbox *fluxbox = Fluxbox::instance();
3673 frame.handle = createChildWindow(frame.window); //create handle win
3674 fluxbox->saveWindowSearch(frame.handle, this); //save handle win
3675
3676 frame.left_grip = // create left handle
3677 createChildWindow(frame.handle, fluxbox->getLowerLeftAngleCursor());
3678 fluxbox->saveWindowSearch(frame.left_grip, this); //save left handle
3679
3680 frame.right_grip = // create right handle
3681 createChildWindow(frame.handle, fluxbox->getLowerRightAngleCursor());
3682 fluxbox->saveWindowSearch(frame.right_grip, this); //save right handle
3683
3684}
3685
3686void FluxboxWindow::destroyHandle() {
3687 if (frame.fhandle) {
3688 image_ctrl->removeImage(frame.fhandle);
3689 frame.fhandle = 0;
3690 }
3691
3692 if (frame.uhandle) {
3693 image_ctrl->removeImage(frame.uhandle);
3694 frame.uhandle = 0;
3695 }
3696
3697 if (frame.fgrip) {
3698 image_ctrl->removeImage(frame.fgrip);
3699 frame.fgrip = 0;
3700 }
3701
3702 if (frame.ugrip) {
3703 image_ctrl->removeImage(frame.ugrip);
3704 frame.ugrip = 0;
3705 }
3706 Fluxbox *fluxbox = Fluxbox::instance();
3707
3708 if (frame.right_grip != 0) {
3709 fluxbox->removeWindowSearch(frame.right_grip);
3710 XDestroyWindow(display, frame.right_grip);
3711 frame.right_grip = 0;
3712 }
3713
3714 if (frame.left_grip != 0) {
3715 fluxbox->removeWindowSearch(frame.left_grip);
3716 XDestroyWindow(display, frame.left_grip);
3717 frame.left_grip = 0;
3718 }
3719
3720 if (frame.handle != 0) {
3721 fluxbox->removeWindowSearch(frame.handle);
3722 XDestroyWindow(display, frame.handle);
3723 frame.handle = 0;
3724 }
3725
3726}
3727
3672void FluxboxWindow::restore(void) { 3728void FluxboxWindow::restore(void) {
3673 XChangeSaveSet(display, client.window, SetModeDelete); 3729 XChangeSaveSet(display, client.window, SetModeDelete);
3674 XSelectInput(display, client.window, NoEventMask); 3730 XSelectInput(display, client.window, NoEventMask);