aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Slit.cc168
1 files changed, 91 insertions, 77 deletions
diff --git a/src/Slit.cc b/src/Slit.cc
index 65e1b63..7e5e7b8 100644
--- a/src/Slit.cc
+++ b/src/Slit.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: Slit.cc,v 1.35 2003/02/18 15:11:08 rathnor Exp $ 25// $Id: Slit.cc,v 1.36 2003/02/20 16:41:22 fluxgen Exp $
26 26
27#include "Slit.hh" 27#include "Slit.hh"
28 28
@@ -146,10 +146,14 @@ public:
146 visible = true; 146 visible = true;
147 } 147 }
148 void disableEvents() { 148 void disableEvents() {
149 if (window == 0)
150 return;
149 Display *disp = FbTk::App::instance()->display(); 151 Display *disp = FbTk::App::instance()->display();
150 XSelectInput(disp, window, NoEventMask); 152 XSelectInput(disp, window, NoEventMask);
151 } 153 }
152 void enableEvents() { 154 void enableEvents() {
155 if (window == 0)
156 return;
153 Display *disp = FbTk::App::instance()->display(); 157 Display *disp = FbTk::App::instance()->display();
154 XSelectInput(disp, window, StructureNotifyMask | 158 XSelectInput(disp, window, StructureNotifyMask |
155 SubstructureNotifyMask | EnterWindowMask); 159 SubstructureNotifyMask | EnterWindowMask);
@@ -231,7 +235,7 @@ private:
231}; // End anonymous namespace 235}; // End anonymous namespace
232 236
233Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename) 237Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
234 : m_screen(&scr), timer(this), 238 : m_screen(scr), timer(this),
235 slitmenu(*scr.menuTheme(), 239 slitmenu(*scr.menuTheme(),
236 scr.getScreenNumber(), 240 scr.getScreenNumber(),
237 *scr.getImageControl()), 241 *scr.getImageControl()),
@@ -245,11 +249,11 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
245 m_layeritem(0) 249 m_layeritem(0)
246{ 250{
247 251
248 slit_layermenu = new LayerMenu<Slit>(*scr.menuTheme(), 252 slit_layermenu.reset(new LayerMenu<Slit>(*scr.menuTheme(),
249 scr.getScreenNumber(), 253 scr.getScreenNumber(),
250 *scr.getImageControl(), 254 *scr.getImageControl(),
251 *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), 255 *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()),
252 this); 256 this));
253 257
254 // default placement and direction 258 // default placement and direction
255 m_direction = HORIZONTAL; 259 m_direction = HORIZONTAL;
@@ -266,8 +270,8 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
266 CWColormap | CWOverrideRedirect | CWEventMask; 270 CWColormap | CWOverrideRedirect | CWEventMask;
267 attrib.background_pixmap = None; 271 attrib.background_pixmap = None;
268 attrib.background_pixel = attrib.border_pixel = 272 attrib.background_pixel = attrib.border_pixel =
269 screen()->getBorderColor()->pixel(); 273 screen().getBorderColor()->pixel();
270 attrib.colormap = screen()->colormap(); 274 attrib.colormap = screen().colormap();
271 attrib.override_redirect = True; 275 attrib.override_redirect = True;
272 attrib.event_mask = SubstructureRedirectMask | ButtonPressMask | 276 attrib.event_mask = SubstructureRedirectMask | ButtonPressMask |
273 EnterWindowMask | LeaveWindowMask; 277 EnterWindowMask | LeaveWindowMask;
@@ -276,13 +280,14 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
276 frame.width = frame.height = 1; 280 frame.width = frame.height = 1;
277 Display *disp = FbTk::App::instance()->display(); 281 Display *disp = FbTk::App::instance()->display();
278 frame.window = 282 frame.window =
279 XCreateWindow(disp, screen()->getRootWindow(), frame.x, frame.y, 283 XCreateWindow(disp, screen().getRootWindow(), frame.x, frame.y,
280 frame.width, frame.height, screen()->getBorderWidth(), 284 frame.width, frame.height, screen().getBorderWidth(),
281 screen()->getDepth(), InputOutput, screen()->getVisual(), 285 screen().getDepth(), InputOutput, screen().getVisual(),
282 create_mask, &attrib); 286 create_mask, &attrib);
283 287
284 FbTk::EventManager::instance()->add(*this, frame.window); 288 FbTk::EventManager::instance()->add(*this, frame.window);
285 m_layeritem = new FbTk::XLayerItem(frame.window, layer); 289
290 m_layeritem.reset(new FbTk::XLayerItem(frame.window, layer));
286 291
287 //For KDE dock applets 292 //For KDE dock applets
288 kwm1_dockwindow = XInternAtom(disp, "KWM_DOCKWINDOW", False); //KDE v1.x 293 kwm1_dockwindow = XInternAtom(disp, "KWM_DOCKWINDOW", False); //KDE v1.x
@@ -299,15 +304,14 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
299 304
300Slit::~Slit() { 305Slit::~Slit() {
301 if (frame.pixmap != 0) 306 if (frame.pixmap != 0)
302 screen()->getImageControl()->removeImage(frame.pixmap); 307 screen().getImageControl()->removeImage(frame.pixmap);
303 if (m_layeritem) delete m_layeritem; 308
304 if (slit_layermenu) delete slit_layermenu;
305} 309}
306 310
307 311
308void Slit::addClient(Window w) { 312void Slit::addClient(Window w) {
309#ifdef DEBUG 313#ifdef DEBUG
310 cerr<<"Slit::addClient()"<<endl; 314 cerr<<__FILE__": addClient(w = 0x"<<hex<<w<<dec<<")"<<endl;
311#endif // DEBUG 315#endif // DEBUG
312 //Can't add non existent window 316 //Can't add non existent window
313 if (w == None) 317 if (w == None)
@@ -316,7 +320,7 @@ void Slit::addClient(Window w) {
316 // Look for slot in client list by name 320 // Look for slot in client list by name
317 SlitClient *client = 0; 321 SlitClient *client = 0;
318 std::string match_name; 322 std::string match_name;
319 ::getWMName(screen(), w, match_name); 323 ::getWMName(&screen(), w, match_name);
320 SlitClients::iterator it = clientList.begin(); 324 SlitClients::iterator it = clientList.begin();
321 SlitClients::iterator it_end = clientList.end(); 325 SlitClients::iterator it_end = clientList.end();
322 bool found_match = false; 326 bool found_match = false;
@@ -326,7 +330,7 @@ void Slit::addClient(Window w) {
326 // Use the slot if no window is assigned 330 // Use the slot if no window is assigned
327 if ((*it)->window == None) { 331 if ((*it)->window == None) {
328 client = (*it); 332 client = (*it);
329 client->initialize(screen(), w); 333 client->initialize(&screen(), w);
330 break; 334 break;
331 } 335 }
332 // Otherwise keep looking for an unused match or a non-match 336 // Otherwise keep looking for an unused match or a non-match
@@ -334,14 +338,14 @@ void Slit::addClient(Window w) {
334 338
335 } else if (found_match) { 339 } else if (found_match) {
336 // Insert before first non-match after a previously found match? 340 // Insert before first non-match after a previously found match?
337 client = new SlitClient(screen(), w); 341 client = new SlitClient(&screen(), w);
338 clientList.insert(it, client); 342 clientList.insert(it, client);
339 break; 343 break;
340 } 344 }
341 } 345 }
342 // Append to client list? 346 // Append to client list?
343 if (client == 0) { 347 if (client == 0) {
344 client = new SlitClient(screen(), w); 348 client = new SlitClient(&screen(), w);
345 clientList.push_back(client); 349 clientList.push_back(client);
346 } 350 }
347 351
@@ -351,8 +355,8 @@ void Slit::addClient(Window w) {
351 if (wmhints != 0) { 355 if (wmhints != 0) {
352 if ((wmhints->flags & IconWindowHint) && 356 if ((wmhints->flags & IconWindowHint) &&
353 (wmhints->icon_window != None)) { 357 (wmhints->icon_window != None)) {
354 XMoveWindow(disp, client->client_window, screen()->getWidth() + 10, 358 XMoveWindow(disp, client->client_window, screen().getWidth() + 10,
355 screen()->getHeight() + 10); 359 screen().getHeight() + 10);
356 XMapWindow(disp, client->client_window); 360 XMapWindow(disp, client->client_window);
357 client->icon_window = wmhints->icon_window; 361 client->icon_window = wmhints->icon_window;
358 client->window = client->icon_window; 362 client->window = client->icon_window;
@@ -373,10 +377,10 @@ void Slit::addClient(Window w) {
373 377
374 //Check and see if new client is a KDE dock applet 378 //Check and see if new client is a KDE dock applet
375 //If so force reasonable size 379 //If so force reasonable size
376 bool iskdedockapp=false; 380 bool iskdedockapp = false;
377 Atom ajunk; 381 Atom ajunk;
378 int ijunk; 382 int ijunk;
379 unsigned long *data = (unsigned long *) 0, uljunk; 383 unsigned long *data = 0, uljunk;
380 384
381 // Check if KDE v2.x dock applet 385 // Check if KDE v2.x dock applet
382 if (XGetWindowProperty(disp, w, 386 if (XGetWindowProperty(disp, w,
@@ -424,13 +428,16 @@ void Slit::addClient(Window w) {
424 XReparentWindow(disp, client->window, frame.window.window(), 0, 0); 428 XReparentWindow(disp, client->window, frame.window.window(), 0, 0);
425 XMapRaised(disp, client->window); 429 XMapRaised(disp, client->window);
426 XChangeSaveSet(disp, client->window, SetModeInsert); 430 XChangeSaveSet(disp, client->window, SetModeInsert);
431
427 // reactivate events for frame.window 432 // reactivate events for frame.window
428 frame.window.setEventMask(SubstructureRedirectMask | 433 frame.window.setEventMask(SubstructureRedirectMask |
429 ButtonPressMask | EnterWindowMask | LeaveWindowMask); 434 ButtonPressMask | EnterWindowMask | LeaveWindowMask);
435
430 // setup event for slit client window 436 // setup event for slit client window
431 client->enableEvents(); 437 client->enableEvents();
432 // flush events 438 // flush events
433 XFlush(disp); 439 XFlush(disp);
440
434 // add slit client to eventmanager 441 // add slit client to eventmanager
435 FbTk::EventManager::instance()->add(*this, client->client_window); 442 FbTk::EventManager::instance()->add(*this, client->client_window);
436 FbTk::EventManager::instance()->add(*this, client->icon_window); 443 FbTk::EventManager::instance()->add(*this, client->icon_window);
@@ -457,11 +464,14 @@ void Slit::setPlacement(Placement place) {
457 464
458void Slit::removeClient(SlitClient *client, bool remap, bool destroy) { 465void Slit::removeClient(SlitClient *client, bool remap, bool destroy) {
459#ifdef DEBUG 466#ifdef DEBUG
460 cerr<<"Slit::removeClient()"<<endl; 467 cerr<<"Slit::removeClient( client->client_window = 0x"<<hex<<client->client_window<<
468 ", client->icon_window)"<<endl;
461#endif // DEBUG 469#endif // DEBUG
462 // remove from event manager 470 // remove from event manager
463 FbTk::EventManager::instance()->remove(client->client_window); 471 if (client->client_window != 0)
464 FbTk::EventManager::instance()->remove(client->icon_window); 472 FbTk::EventManager::instance()->remove(client->client_window);
473 if (client->icon_window != 0)
474 FbTk::EventManager::instance()->remove(client->icon_window);
465 475
466 // Destructive removal? 476 // Destructive removal?
467 if (destroy) 477 if (destroy)
@@ -469,16 +479,18 @@ void Slit::removeClient(SlitClient *client, bool remap, bool destroy) {
469 else // Clear the window info, but keep around to help future sorting? 479 else // Clear the window info, but keep around to help future sorting?
470 client->initialize(); 480 client->initialize();
471 481
472 screen()->removeNetizen(client->window); 482 screen().removeNetizen(client->window);
473 483
474 if (remap) { 484 if (remap && client->window != 0) {
475 Display *disp = FbTk::App::instance()->display(); 485 Display *disp = FbTk::App::instance()->display();
486
476 if (!client->visible) 487 if (!client->visible)
477 XMapWindow(disp, client->window); 488 XMapWindow(disp, client->window);
489
478 client->disableEvents(); 490 client->disableEvents();
479 // stop events to frame.window temporarly 491 // stop events to frame.window temporarly
480 frame.window.setEventMask(NoEventMask); 492 frame.window.setEventMask(NoEventMask);
481 XReparentWindow(disp, client->window, screen()->getRootWindow(), 493 XReparentWindow(disp, client->window, screen().getRootWindow(),
482 client->x, client->y); 494 client->x, client->y);
483 XChangeSaveSet(disp, client->window, SetModeDelete); 495 XChangeSaveSet(disp, client->window, SetModeDelete);
484 // reactivate events to frame.window 496 // reactivate events to frame.window
@@ -532,7 +544,7 @@ void Slit::reconfigure() {
532 //client created window? 544 //client created window?
533 if ((*it)->window != None && (*it)->visible) { 545 if ((*it)->window != None && (*it)->visible) {
534 num_windows++; 546 num_windows++;
535 frame.height += (*it)->height + screen()->getBevelWidth(); 547 frame.height += (*it)->height + screen().getBevelWidth();
536 548
537 //frame width < client window? 549 //frame width < client window?
538 if (frame.width < (*it)->width) 550 if (frame.width < (*it)->width)
@@ -544,12 +556,12 @@ void Slit::reconfigure() {
544 if (frame.width < 1) 556 if (frame.width < 1)
545 frame.width = 1; 557 frame.width = 1;
546 else 558 else
547 frame.width += (screen()->getBevelWidth() * 2); 559 frame.width += (screen().getBevelWidth() * 2);
548 560
549 if (frame.height < 1) 561 if (frame.height < 1)
550 frame.height = 1; 562 frame.height = 1;
551 else 563 else
552 frame.height += screen()->getBevelWidth(); 564 frame.height += screen().getBevelWidth();
553 565
554 break; 566 break;
555 567
@@ -561,7 +573,7 @@ void Slit::reconfigure() {
561 //client created window? 573 //client created window?
562 if ((*it)->window != None && (*it)->visible) { 574 if ((*it)->window != None && (*it)->visible) {
563 num_windows++; 575 num_windows++;
564 frame.width += (*it)->width + screen()->getBevelWidth(); 576 frame.width += (*it)->width + screen().getBevelWidth();
565 //frame height < client height? 577 //frame height < client height?
566 if (frame.height < (*it)->height) 578 if (frame.height < (*it)->height)
567 frame.height = (*it)->height; 579 frame.height = (*it)->height;
@@ -572,12 +584,12 @@ void Slit::reconfigure() {
572 if (frame.width < 1) 584 if (frame.width < 1)
573 frame.width = 1; 585 frame.width = 1;
574 else 586 else
575 frame.width += screen()->getBevelWidth(); 587 frame.width += screen().getBevelWidth();
576 588
577 if (frame.height < 1) 589 if (frame.height < 1)
578 frame.height = 1; 590 frame.height = 1;
579 else 591 else
580 frame.height += (screen()->getBevelWidth() * 2); 592 frame.height += (screen().getBevelWidth() * 2);
581 593
582 break; 594 break;
583 } 595 }
@@ -585,8 +597,8 @@ void Slit::reconfigure() {
585 reposition(); 597 reposition();
586 Display *disp = FbTk::App::instance()->display(); 598 Display *disp = FbTk::App::instance()->display();
587 599
588 frame.window.setBorderWidth(screen()->getBorderWidth()); 600 frame.window.setBorderWidth(screen().getBorderWidth());
589 frame.window.setBorderColor(*screen()->getBorderColor()); 601 frame.window.setBorderColor(*screen().getBorderColor());
590 //did we actually use slit slots 602 //did we actually use slit slots
591 if (num_windows == 0) 603 if (num_windows == 0)
592 frame.window.hide(); 604 frame.window.hide();
@@ -594,8 +606,8 @@ void Slit::reconfigure() {
594 frame.window.show(); 606 frame.window.show();
595 607
596 Pixmap tmp = frame.pixmap; 608 Pixmap tmp = frame.pixmap;
597 FbTk::ImageControl *image_ctrl = screen()->getImageControl(); 609 FbTk::ImageControl *image_ctrl = screen().getImageControl();
598 const FbTk::Texture &texture = screen()->getTheme()->getSlitTexture(); 610 const FbTk::Texture &texture = screen().getTheme()->getSlitTexture();
599 if (texture.type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) { 611 if (texture.type() == (FbTk::Texture::FLAT | FbTk::Texture::SOLID)) {
600 frame.pixmap = None; 612 frame.pixmap = None;
601 frame.window.setBackgroundColor(texture.color()); 613 frame.window.setBackgroundColor(texture.color());
@@ -615,7 +627,7 @@ void Slit::reconfigure() {
615 switch (direction()) { 627 switch (direction()) {
616 case VERTICAL: 628 case VERTICAL:
617 x = 0; 629 x = 0;
618 y = screen()->getBevelWidth(); 630 y = screen().getBevelWidth();
619 631
620 { 632 {
621 SlitClients::iterator it = clientList.begin(); 633 SlitClients::iterator it = clientList.begin();
@@ -660,14 +672,14 @@ void Slit::reconfigure() {
660 XSendEvent(disp, (*it)->window, False, StructureNotifyMask, 672 XSendEvent(disp, (*it)->window, False, StructureNotifyMask,
661 &event); 673 &event);
662 674
663 y += (*it)->height + screen()->getBevelWidth(); 675 y += (*it)->height + screen().getBevelWidth();
664 } 676 }
665 } 677 }
666 678
667 break; 679 break;
668 680
669 case HORIZONTAL: 681 case HORIZONTAL:
670 x = screen()->getBevelWidth(); 682 x = screen().getBevelWidth();
671 y = 0; 683 y = 0;
672 684
673 { 685 {
@@ -706,8 +718,8 @@ void Slit::reconfigure() {
706 event.xconfigure.display = disp; 718 event.xconfigure.display = disp;
707 event.xconfigure.event = (*it)->window; 719 event.xconfigure.event = (*it)->window;
708 event.xconfigure.window = (*it)->window; 720 event.xconfigure.window = (*it)->window;
709 event.xconfigure.x = frame.x + x + screen()->getBorderWidth(); 721 event.xconfigure.x = frame.x + x + screen().getBorderWidth();
710 event.xconfigure.y = frame.y + y + screen()->getBorderWidth(); 722 event.xconfigure.y = frame.y + y + screen().getBorderWidth();
711 event.xconfigure.width = (*it)->width; 723 event.xconfigure.width = (*it)->width;
712 event.xconfigure.height = (*it)->height; 724 event.xconfigure.height = (*it)->height;
713 event.xconfigure.border_width = 0; 725 event.xconfigure.border_width = 0;
@@ -717,7 +729,7 @@ void Slit::reconfigure() {
717 XSendEvent(disp, (*it)->window, False, StructureNotifyMask, 729 XSendEvent(disp, (*it)->window, False, StructureNotifyMask,
718 &event); 730 &event);
719 731
720 x += (*it)->width + screen()->getBevelWidth(); 732 x += (*it)->width + screen().getBevelWidth();
721 } 733 }
722 } 734 }
723 735
@@ -735,8 +747,8 @@ void Slit::reposition() {
735 head_w, 747 head_w,
736 head_h; 748 head_h;
737 749
738 head_w = screen()->getWidth(); 750 head_w = screen().getWidth();
739 head_h = screen()->getHeight(); 751 head_h = screen().getHeight();
740 752
741 // place the slit in the appropriate place 753 // place the slit in the appropriate place
742 switch (placement()) { 754 switch (placement()) {
@@ -744,35 +756,35 @@ void Slit::reposition() {
744 frame.x = head_x; 756 frame.x = head_x;
745 frame.y = head_y; 757 frame.y = head_y;
746 if (direction() == VERTICAL) { 758 if (direction() == VERTICAL) {
747 frame.x_hidden = screen()->getBevelWidth() - 759 frame.x_hidden = screen().getBevelWidth() -
748 screen()->getBorderWidth() - frame.width; 760 screen().getBorderWidth() - frame.width;
749 frame.y_hidden = head_y; 761 frame.y_hidden = head_y;
750 } else { 762 } else {
751 frame.x_hidden = head_x; 763 frame.x_hidden = head_x;
752 frame.y_hidden = screen()->getBevelWidth() - 764 frame.y_hidden = screen().getBevelWidth() -
753 screen()->getBorderWidth() - frame.height; 765 screen().getBorderWidth() - frame.height;
754 } 766 }
755 break; 767 break;
756 768
757 case CENTERLEFT: 769 case CENTERLEFT:
758 frame.x = head_x; 770 frame.x = head_x;
759 frame.y = head_y + (head_h - frame.height) / 2; 771 frame.y = head_y + (head_h - frame.height) / 2;
760 frame.x_hidden = head_x + screen()->getBevelWidth() - 772 frame.x_hidden = head_x + screen().getBevelWidth() -
761 screen()->getBorderWidth() - frame.width; 773 screen().getBorderWidth() - frame.width;
762 frame.y_hidden = frame.y; 774 frame.y_hidden = frame.y;
763 break; 775 break;
764 776
765 case BOTTOMLEFT: 777 case BOTTOMLEFT:
766 frame.x = head_x; 778 frame.x = head_x;
767 frame.y = head_h - frame.height - screen()->getBorderWidth2x(); 779 frame.y = head_h - frame.height - screen().getBorderWidth2x();
768 if (direction() == VERTICAL) { 780 if (direction() == VERTICAL) {
769 frame.x_hidden = head_x + screen()->getBevelWidth() - 781 frame.x_hidden = head_x + screen().getBevelWidth() -
770 screen()->getBorderWidth() - frame.width; 782 screen().getBorderWidth() - frame.width;
771 frame.y_hidden = frame.y; 783 frame.y_hidden = frame.y;
772 } else { 784 } else {
773 frame.x_hidden = head_x; 785 frame.x_hidden = head_x;
774 frame.y_hidden = head_y + head_h - 786 frame.y_hidden = head_y + head_h -
775 screen()->getBevelWidth() - screen()->getBorderWidth(); 787 screen().getBevelWidth() - screen().getBorderWidth();
776 } 788 }
777 break; 789 break;
778 790
@@ -780,52 +792,52 @@ void Slit::reposition() {
780 frame.x = head_x + ((head_w - frame.width) / 2); 792 frame.x = head_x + ((head_w - frame.width) / 2);
781 frame.y = head_y; 793 frame.y = head_y;
782 frame.x_hidden = frame.x; 794 frame.x_hidden = frame.x;
783 frame.y_hidden = head_y + screen()->getBevelWidth() - 795 frame.y_hidden = head_y + screen().getBevelWidth() -
784 screen()->getBorderWidth() - frame.height; 796 screen().getBorderWidth() - frame.height;
785 break; 797 break;
786 798
787 case BOTTOMCENTER: 799 case BOTTOMCENTER:
788 frame.x = head_x + ((head_w - frame.width) / 2); 800 frame.x = head_x + ((head_w - frame.width) / 2);
789 frame.y = head_y + head_h - frame.height - screen()->getBorderWidth2x(); 801 frame.y = head_y + head_h - frame.height - screen().getBorderWidth2x();
790 frame.x_hidden = frame.x; 802 frame.x_hidden = frame.x;
791 frame.y_hidden = head_y + head_h - 803 frame.y_hidden = head_y + head_h -
792 screen()->getBevelWidth() - screen()->getBorderWidth(); 804 screen().getBevelWidth() - screen().getBorderWidth();
793 break; 805 break;
794 806
795 case TOPRIGHT: 807 case TOPRIGHT:
796 frame.x = head_x + head_w - frame.width - screen()->getBorderWidth2x(); 808 frame.x = head_x + head_w - frame.width - screen().getBorderWidth2x();
797 frame.y = head_y; 809 frame.y = head_y;
798 if (direction() == VERTICAL) { 810 if (direction() == VERTICAL) {
799 frame.x_hidden = head_x + head_w - 811 frame.x_hidden = head_x + head_w -
800 screen()->getBevelWidth() - screen()->getBorderWidth(); 812 screen().getBevelWidth() - screen().getBorderWidth();
801 frame.y_hidden = head_y; 813 frame.y_hidden = head_y;
802 } else { 814 } else {
803 frame.x_hidden = frame.x; 815 frame.x_hidden = frame.x;
804 frame.y_hidden = head_y + screen()->getBevelWidth() - 816 frame.y_hidden = head_y + screen().getBevelWidth() -
805 screen()->getBorderWidth() - frame.height; 817 screen().getBorderWidth() - frame.height;
806 } 818 }
807 break; 819 break;
808 820
809 case CENTERRIGHT: 821 case CENTERRIGHT:
810 default: 822 default:
811 frame.x = head_x + head_w - frame.width - screen()->getBorderWidth2x(); 823 frame.x = head_x + head_w - frame.width - screen().getBorderWidth2x();
812 frame.y = head_y + ((head_h - frame.height) / 2); 824 frame.y = head_y + ((head_h - frame.height) / 2);
813 frame.x_hidden = head_x + head_w - 825 frame.x_hidden = head_x + head_w -
814 screen()->getBevelWidth() - screen()->getBorderWidth(); 826 screen().getBevelWidth() - screen().getBorderWidth();
815 frame.y_hidden = frame.y; 827 frame.y_hidden = frame.y;
816 break; 828 break;
817 829
818 case BOTTOMRIGHT: 830 case BOTTOMRIGHT:
819 frame.x = head_x + head_w - frame.width - screen()->getBorderWidth2x(); 831 frame.x = head_x + head_w - frame.width - screen().getBorderWidth2x();
820 frame.y = head_y + head_h - frame.height - screen()->getBorderWidth2x(); 832 frame.y = head_y + head_h - frame.height - screen().getBorderWidth2x();
821 if (direction() == VERTICAL) { 833 if (direction() == VERTICAL) {
822 frame.x_hidden = head_x + head_w - 834 frame.x_hidden = head_x + head_w -
823 screen()->getBevelWidth() - screen()->getBorderWidth(); 835 screen().getBevelWidth() - screen().getBorderWidth();
824 frame.y_hidden = frame.y; 836 frame.y_hidden = frame.y;
825 } else { 837 } else {
826 frame.x_hidden = frame.x; 838 frame.x_hidden = frame.x;
827 frame.y_hidden = head_y + head_h - 839 frame.y_hidden = head_y + head_h -
828 screen()->getBevelWidth() - screen()->getBorderWidth(); 840 screen().getBevelWidth() - screen().getBorderWidth();
829 } 841 }
830 break; 842 break;
831 } 843 }
@@ -870,7 +882,9 @@ void Slit::cycleClientsDown() {
870} 882}
871 883
872void Slit::handleEvent(XEvent &event) { 884void Slit::handleEvent(XEvent &event) {
873 if (event.type == DestroyNotify) { 885 if (event.type == ConfigureRequest) {
886 configureRequestEvent(event.xconfigurerequest);
887 } else if (event.type == DestroyNotify) {
874 removeClient(event.xdestroywindow.window, false); 888 removeClient(event.xdestroywindow.window, false);
875 } else if (event.type == UnmapNotify) { 889 } else if (event.type == UnmapNotify) {
876 removeClient(event.xany.window); 890 removeClient(event.xany.window);
@@ -926,13 +940,13 @@ void Slit::buttonPressEvent(XButtonEvent &e) {
926 940
927 if (x < 0) 941 if (x < 0)
928 x = 0; 942 x = 0;
929 else if (x + slitmenu.width() > screen()->getWidth()) 943 else if (x + slitmenu.width() > screen().getWidth())
930 x = screen()->getWidth() - slitmenu.width(); 944 x = screen().getWidth() - slitmenu.width();
931 945
932 if (y < 0) 946 if (y < 0)
933 y = 0; 947 y = 0;
934 else if (y + slitmenu.height() > screen()->getHeight()) 948 else if (y + slitmenu.height() > screen().getHeight())
935 y = screen()->getHeight() - slitmenu.height(); 949 y = screen().getHeight() - slitmenu.height();
936 950
937 slitmenu.move(x, y); 951 slitmenu.move(x, y);
938 slitmenu.show(); 952 slitmenu.show();
@@ -1054,7 +1068,7 @@ void Slit::updateClientmenu() {
1054 FbTk::RefCount<FbTk::Command> reconfig(new FbTk::SimpleCommand<Slit>(*this, &Slit::reconfigure)); 1068 FbTk::RefCount<FbTk::Command> reconfig(new FbTk::SimpleCommand<Slit>(*this, &Slit::reconfigure));
1055 SlitClients::iterator it = clientList.begin(); 1069 SlitClients::iterator it = clientList.begin();
1056 for (; it != clientList.end(); ++it) { 1070 for (; it != clientList.end(); ++it) {
1057 if ((*it) != 0) 1071 if ((*it) != 0 && (*it)->window != 0)
1058 clientlist_menu.insert(new SlitClientMenuItem(*(*it), reconfig)); 1072 clientlist_menu.insert(new SlitClientMenuItem(*(*it), reconfig));
1059 } 1073 }
1060 1074
@@ -1094,7 +1108,7 @@ void Slit::setupMenu() {
1094 "Placement"), 1108 "Placement"),
1095 &placement_menu); 1109 &placement_menu);
1096 1110
1097 slitmenu.insert("Layer...", slit_layermenu); 1111 slitmenu.insert("Layer...", slit_layermenu.get());
1098 1112
1099 slitmenu.insert(new BoolMenuItem(i18n->getMessage( 1113 slitmenu.insert(new BoolMenuItem(i18n->getMessage(
1100 CommonSet, CommonAutoHide, 1114 CommonSet, CommonAutoHide,