aboutsummaryrefslogtreecommitdiff
path: root/src/Slit.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Slit.cc')
-rw-r--r--src/Slit.cc57
1 files changed, 26 insertions, 31 deletions
diff --git a/src/Slit.cc b/src/Slit.cc
index 79ebb62..d4a6837 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.58 2003/05/24 13:13:22 rathnor Exp $ 25// $Id: Slit.cc,v 1.59 2003/06/05 11:30:06 fluxgen Exp $
26 26
27#include "Slit.hh" 27#include "Slit.hh"
28 28
@@ -261,6 +261,9 @@ private:
261 FbTk::ThemeItem<FbTk::Texture> m_texture; 261 FbTk::ThemeItem<FbTk::Texture> m_texture;
262}; 262};
263 263
264unsigned int Slit::s_eventmask = SubstructureRedirectMask | ButtonPressMask |
265 EnterWindowMask | LeaveWindowMask | ExposureMask;
266
264Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename) 267Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
265 : m_screen(scr), m_timer(this), 268 : m_screen(scr), m_timer(this),
266 m_slitmenu(*scr.menuTheme(), 269 m_slitmenu(*scr.menuTheme(),
@@ -308,8 +311,7 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
308 screen().rootTheme().borderColor().pixel(); 311 screen().rootTheme().borderColor().pixel();
309 attrib.colormap = screen().rootWindow().colormap(); 312 attrib.colormap = screen().rootWindow().colormap();
310 attrib.override_redirect = True; 313 attrib.override_redirect = True;
311 attrib.event_mask = SubstructureRedirectMask | ButtonPressMask | 314 attrib.event_mask = s_eventmask;
312 EnterWindowMask | LeaveWindowMask | ExposureMask;
313 315
314 frame.x = frame.y = 0; 316 frame.x = frame.y = 0;
315 frame.width = frame.height = 1; 317 frame.width = frame.height = 1;
@@ -335,9 +337,7 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename)
335 reconfigure(); 337 reconfigure();
336} 338}
337 339
338unsigned int Slit::s_eventmask = StructureNotifyMask | SubstructureNotifyMask | 340
339 SubstructureRedirectMask | ButtonPressMask |
340 EnterWindowMask | LeaveWindowMask | ExposureMask;
341Slit::~Slit() { 341Slit::~Slit() {
342 if (frame.pixmap != 0) 342 if (frame.pixmap != 0)
343 screen().imageControl().removeImage(frame.pixmap); 343 screen().imageControl().removeImage(frame.pixmap);
@@ -459,16 +459,16 @@ void Slit::addClient(Window w) {
459 // disable events to frame.window 459 // disable events to frame.window
460 frame.window.setEventMask(NoEventMask); 460 frame.window.setEventMask(NoEventMask);
461 client->disableEvents(); 461 client->disableEvents();
462
462 463
463 XReparentWindow(disp, client->window, frame.window.window(), 0, 0); 464 XReparentWindow(disp, client->window, frame.window.window(), 0, 0);
464 XMapRaised(disp, client->window); 465 XMapRaised(disp, client->window);
465 XChangeSaveSet(disp, client->window, SetModeInsert); 466 XChangeSaveSet(disp, client->window, SetModeInsert);
466
467 // reactivate events for frame.window 467 // reactivate events for frame.window
468 frame.window.setEventMask(s_eventmask); 468 frame.window.setEventMask(s_eventmask);
469
470 // setup event for slit client window 469 // setup event for slit client window
471 client->enableEvents(); 470 client->enableEvents();
471
472 // flush events 472 // flush events
473 XFlush(disp); 473 XFlush(disp);
474 474
@@ -543,6 +543,11 @@ void Slit::removeClient(SlitClient *client, bool remap, bool destroy) {
543 543
544 544
545void Slit::removeClient(Window w, bool remap) { 545void Slit::removeClient(Window w, bool remap) {
546#ifdef DEBUG
547 cerr<<"Slit::removeClient(Window w = 0x"<<hex<<w<<dec<<", remap = "<<remap<<")"<<endl;
548#endif // DEBUG
549 if (w == frame.window)
550 return;
546 551
547 bool reconf = false; 552 bool reconf = false;
548 553
@@ -575,6 +580,7 @@ void Slit::reconfigure() {
575 // actually correspond to mapped windows. 580 // actually correspond to mapped windows.
576 int num_windows = 0; 581 int num_windows = 0;
577 const int bevel_width = screen().rootTheme().bevelWidth(); 582 const int bevel_width = screen().rootTheme().bevelWidth();
583
578 switch (direction()) { 584 switch (direction()) {
579 case VERTICAL: { 585 case VERTICAL: {
580 SlitClients::iterator it = m_client_list.begin(); 586 SlitClients::iterator it = m_client_list.begin();
@@ -591,16 +597,6 @@ void Slit::reconfigure() {
591 } 597 }
592 } 598 }
593 599
594 if (frame.width < 1)
595 frame.width = 1;
596 else
597 frame.width += (bevel_width * 2);
598
599 if (frame.height < 1)
600 frame.height = 1;
601 else
602 frame.height += bevel_width;
603
604 break; 600 break;
605 601
606 case HORIZONTAL: { 602 case HORIZONTAL: {
@@ -616,21 +612,20 @@ void Slit::reconfigure() {
616 frame.height = (*it)->height; 612 frame.height = (*it)->height;
617 } 613 }
618 } 614 }
619 break; 615
620 } 616 }
617 break;
618 } // end switch
621 619
622 if (frame.width < 1) 620 if (frame.width < 1)
623 frame.width = 1; 621 frame.width = 1;
624 else 622 else
625 frame.width += bevel_width; 623 frame.width += bevel_width;
626
627 if (frame.height < 1)
628 frame.height = 1;
629 else
630 frame.height += bevel_width*2;
631 624
632 break; 625 if (frame.height < 1)
633 } 626 frame.height = 1;
627 else
628 frame.height += bevel_width*2;
634 629
635 reposition(); 630 reposition();
636 Display *disp = FbTk::App::instance()->display(); 631 Display *disp = FbTk::App::instance()->display();
@@ -942,7 +937,7 @@ void Slit::handleEvent(XEvent &event) {
942 } else if (event.type == DestroyNotify) { 937 } else if (event.type == DestroyNotify) {
943 removeClient(event.xdestroywindow.window, false); 938 removeClient(event.xdestroywindow.window, false);
944 } else if (event.type == UnmapNotify) { 939 } else if (event.type == UnmapNotify) {
945 removeClient(event.xany.window); 940 removeClient(event.xunmap.window);
946 } else if (event.type == MapRequest) { 941 } else if (event.type == MapRequest) {
947#ifdef KDE 942#ifdef KDE
948 //Check and see if client is KDE dock applet. 943 //Check and see if client is KDE dock applet.