diff options
-rw-r--r-- | src/Slit.cc | 290 | ||||
-rw-r--r-- | src/Slit.hh | 25 |
2 files changed, 159 insertions, 156 deletions
diff --git a/src/Slit.cc b/src/Slit.cc index 1f4e4cc..843efaf 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.48 2003/05/10 22:53:57 fluxgen Exp $ | 25 | // $Id: Slit.cc,v 1.49 2003/05/11 17:42:51 fluxgen Exp $ |
26 | 26 | ||
27 | #include "Slit.hh" | 27 | #include "Slit.hh" |
28 | 28 | ||
@@ -259,37 +259,43 @@ private: | |||
259 | }; | 259 | }; |
260 | 260 | ||
261 | Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename) | 261 | Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename) |
262 | : m_screen(scr), timer(this), | 262 | : m_screen(scr), m_timer(this), |
263 | slitmenu(*scr.menuTheme(), | 263 | m_slitmenu(*scr.menuTheme(), |
264 | scr.getScreenNumber(), | 264 | scr.getScreenNumber(), |
265 | *scr.getImageControl(), | 265 | *scr.getImageControl(), |
266 | *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), | 266 | *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), |
267 | placement_menu(*scr.menuTheme(), | 267 | m_placement_menu(*scr.menuTheme(), |
268 | scr.getScreenNumber(), | 268 | scr.getScreenNumber(), |
269 | *scr.getImageControl(), | 269 | *scr.getImageControl(), |
270 | *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), | 270 | *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), |
271 | clientlist_menu(*scr.menuTheme(), | 271 | m_clientlist_menu(*scr.menuTheme(), |
272 | scr.getScreenNumber(), | 272 | scr.getScreenNumber(), |
273 | *scr.getImageControl(), | 273 | *scr.getImageControl(), |
274 | *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), | 274 | *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer())), |
275 | m_slit_layermenu(new LayerMenu<Slit>(*scr.menuTheme(), | 275 | m_layermenu(new LayerMenu<Slit>(*scr.menuTheme(), |
276 | scr.getScreenNumber(), | 276 | scr.getScreenNumber(), |
277 | *scr.getImageControl(), | 277 | *scr.getImageControl(), |
278 | *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), | 278 | *scr.layerManager().getLayer(Fluxbox::instance()->getMenuLayer()), |
279 | this, | 279 | this, |
280 | true)), | 280 | true)), |
281 | //For KDE dock applets | ||
282 | m_kwm1_dockwindow(XInternAtom(FbTk::App::instance()->display(), | ||
283 | "KWM_DOCKWINDOW", False)), //KDE v1.x | ||
284 | m_kwm2_dockwindow(XInternAtom(FbTk::App::instance()->display(), | ||
285 | "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", False)), //KDE v2.x | ||
286 | |||
281 | m_layeritem(0), | 287 | m_layeritem(0), |
282 | m_slit_theme(new SlitTheme(*this)) { | 288 | m_slit_theme(new SlitTheme(*this)) { |
283 | 289 | ||
284 | // default placement and direction | 290 | // default placement and direction |
285 | m_direction = screen().getSlitDirection(); | 291 | m_direction = screen().getSlitDirection(); |
286 | m_placement = screen().getSlitPlacement(); | 292 | m_placement = screen().getSlitPlacement(); |
287 | hidden = do_auto_hide = screen().doSlitAutoHide(); | 293 | m_hidden = m_do_auto_hide = screen().doSlitAutoHide(); |
288 | 294 | ||
289 | frame.pixmap = None; | 295 | frame.pixmap = None; |
290 | 296 | ||
291 | timer.setTimeout(200); // default timeout | 297 | m_timer.setTimeout(200); // default timeout |
292 | timer.fireOnce(true); | 298 | m_timer.fireOnce(true); |
293 | 299 | ||
294 | XSetWindowAttributes attrib; | 300 | XSetWindowAttributes attrib; |
295 | unsigned long create_mask = CWBackPixmap | CWBackPixel | CWBorderPixel | | 301 | unsigned long create_mask = CWBackPixmap | CWBackPixel | CWBorderPixel | |
@@ -315,10 +321,6 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename) | |||
315 | 321 | ||
316 | m_layeritem.reset(new FbTk::XLayerItem(frame.window, layer)); | 322 | m_layeritem.reset(new FbTk::XLayerItem(frame.window, layer)); |
317 | 323 | ||
318 | //For KDE dock applets | ||
319 | kwm1_dockwindow = XInternAtom(disp, "KWM_DOCKWINDOW", False); //KDE v1.x | ||
320 | kwm2_dockwindow = XInternAtom(disp, "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", False); //KDE v2.x | ||
321 | |||
322 | // Get client list for sorting purposes | 324 | // Get client list for sorting purposes |
323 | loadClientList(filename); | 325 | loadClientList(filename); |
324 | 326 | ||
@@ -331,7 +333,6 @@ Slit::Slit(BScreen &scr, FbTk::XLayer &layer, const char *filename) | |||
331 | Slit::~Slit() { | 333 | Slit::~Slit() { |
332 | if (frame.pixmap != 0) | 334 | if (frame.pixmap != 0) |
333 | screen().getImageControl()->removeImage(frame.pixmap); | 335 | screen().getImageControl()->removeImage(frame.pixmap); |
334 | |||
335 | } | 336 | } |
336 | 337 | ||
337 | 338 | ||
@@ -339,7 +340,7 @@ void Slit::addClient(Window w) { | |||
339 | #ifdef DEBUG | 340 | #ifdef DEBUG |
340 | cerr<<__FILE__": addClient(w = 0x"<<hex<<w<<dec<<")"<<endl; | 341 | cerr<<__FILE__": addClient(w = 0x"<<hex<<w<<dec<<")"<<endl; |
341 | #endif // DEBUG | 342 | #endif // DEBUG |
342 | //Can't add non existent window | 343 | // Can't add non existent window |
343 | if (w == None) | 344 | if (w == None) |
344 | return; | 345 | return; |
345 | 346 | ||
@@ -347,8 +348,8 @@ void Slit::addClient(Window w) { | |||
347 | SlitClient *client = 0; | 348 | SlitClient *client = 0; |
348 | std::string match_name; | 349 | std::string match_name; |
349 | ::getWMName(&screen(), w, match_name); | 350 | ::getWMName(&screen(), w, match_name); |
350 | SlitClients::iterator it = clientList.begin(); | 351 | SlitClients::iterator it = m_client_list.begin(); |
351 | SlitClients::iterator it_end = clientList.end(); | 352 | SlitClients::iterator it_end = m_client_list.end(); |
352 | bool found_match = false; | 353 | bool found_match = false; |
353 | for (; it != it_end; ++it) { | 354 | for (; it != it_end; ++it) { |
354 | // If the name matches... | 355 | // If the name matches... |
@@ -365,14 +366,14 @@ void Slit::addClient(Window w) { | |||
365 | } else if (found_match) { | 366 | } else if (found_match) { |
366 | // Insert before first non-match after a previously found match? | 367 | // Insert before first non-match after a previously found match? |
367 | client = new SlitClient(&screen(), w); | 368 | client = new SlitClient(&screen(), w); |
368 | clientList.insert(it, client); | 369 | m_client_list.insert(it, client); |
369 | break; | 370 | break; |
370 | } | 371 | } |
371 | } | 372 | } |
372 | // Append to client list? | 373 | // Append to client list? |
373 | if (client == 0) { | 374 | if (client == 0) { |
374 | client = new SlitClient(&screen(), w); | 375 | client = new SlitClient(&screen(), w); |
375 | clientList.push_back(client); | 376 | m_client_list.push_back(client); |
376 | } | 377 | } |
377 | 378 | ||
378 | Display *disp = FbTk::App::instance()->display(); | 379 | Display *disp = FbTk::App::instance()->display(); |
@@ -410,8 +411,8 @@ void Slit::addClient(Window w) { | |||
410 | 411 | ||
411 | // Check if KDE v2.x dock applet | 412 | // Check if KDE v2.x dock applet |
412 | if (XGetWindowProperty(disp, w, | 413 | if (XGetWindowProperty(disp, w, |
413 | kwm2_dockwindow, 0l, 1l, False, | 414 | m_kwm2_dockwindow, 0l, 1l, False, |
414 | kwm2_dockwindow, | 415 | m_kwm2_dockwindow, |
415 | &ajunk, &ijunk, &uljunk, &uljunk, | 416 | &ajunk, &ijunk, &uljunk, &uljunk, |
416 | (unsigned char **) &data) == Success) { | 417 | (unsigned char **) &data) == Success) { |
417 | iskdedockapp = (data && data[0] != 0); | 418 | iskdedockapp = (data && data[0] != 0); |
@@ -421,8 +422,8 @@ void Slit::addClient(Window w) { | |||
421 | // Check if KDE v1.x dock applet | 422 | // Check if KDE v1.x dock applet |
422 | if (!iskdedockapp) { | 423 | if (!iskdedockapp) { |
423 | if (XGetWindowProperty(disp, w, | 424 | if (XGetWindowProperty(disp, w, |
424 | kwm1_dockwindow, 0l, 1l, False, | 425 | m_kwm1_dockwindow, 0l, 1l, False, |
425 | kwm1_dockwindow, | 426 | m_kwm1_dockwindow, |
426 | &ajunk, &ijunk, &uljunk, &uljunk, | 427 | &ajunk, &ijunk, &uljunk, &uljunk, |
427 | (unsigned char **) &data) == Success) { | 428 | (unsigned char **) &data) == Success) { |
428 | iskdedockapp = (data && data[0] != 0); | 429 | iskdedockapp = (data && data[0] != 0); |
@@ -503,7 +504,7 @@ void Slit::removeClient(SlitClient *client, bool remap, bool destroy) { | |||
503 | 504 | ||
504 | // Destructive removal? | 505 | // Destructive removal? |
505 | if (destroy) | 506 | if (destroy) |
506 | clientList.remove(client); | 507 | m_client_list.remove(client); |
507 | else // Clear the window info, but keep around to help future sorting? | 508 | else // Clear the window info, but keep around to help future sorting? |
508 | client->initialize(); | 509 | client->initialize(); |
509 | 510 | ||
@@ -539,8 +540,8 @@ void Slit::removeClient(Window w, bool remap) { | |||
539 | 540 | ||
540 | bool reconf = false; | 541 | bool reconf = false; |
541 | 542 | ||
542 | SlitClients::iterator it = clientList.begin(); | 543 | SlitClients::iterator it = m_client_list.begin(); |
543 | SlitClients::iterator it_end = clientList.end(); | 544 | SlitClients::iterator it_end = m_client_list.end(); |
544 | for (; it != it_end; ++it) { | 545 | for (; it != it_end; ++it) { |
545 | if ((*it)->window == w) { | 546 | if ((*it)->window == w) { |
546 | removeClient((*it), remap, false); | 547 | removeClient((*it), remap, false); |
@@ -560,7 +561,7 @@ void Slit::reconfigure() { | |||
560 | frame.height = 0; | 561 | frame.height = 0; |
561 | 562 | ||
562 | // be sure to sync slit auto hide up with the screen's menu resource | 563 | // be sure to sync slit auto hide up with the screen's menu resource |
563 | do_auto_hide = screen().doSlitAutoHide(); | 564 | m_do_auto_hide = screen().doSlitAutoHide(); |
564 | 565 | ||
565 | // Need to count windows because not all client list entries | 566 | // Need to count windows because not all client list entries |
566 | // actually correspond to mapped windows. | 567 | // actually correspond to mapped windows. |
@@ -568,15 +569,14 @@ void Slit::reconfigure() { | |||
568 | const int bevel_width = screen().rootTheme().bevelWidth(); | 569 | const int bevel_width = screen().rootTheme().bevelWidth(); |
569 | switch (direction()) { | 570 | switch (direction()) { |
570 | case VERTICAL: { | 571 | case VERTICAL: { |
571 | SlitClients::iterator it = clientList.begin(); | 572 | SlitClients::iterator it = m_client_list.begin(); |
572 | SlitClients::iterator it_end = clientList.end(); | 573 | SlitClients::iterator it_end = m_client_list.end(); |
573 | for (; it != it_end; ++it) { | 574 | for (; it != it_end; ++it) { |
574 | //client created window? | 575 | // client created window? |
575 | if ((*it)->window != None && (*it)->visible) { | 576 | if ((*it)->window != None && (*it)->visible) { |
576 | num_windows++; | 577 | num_windows++; |
577 | frame.height += (*it)->height + bevel_width; | 578 | frame.height += (*it)->height + bevel_width; |
578 | 579 | ||
579 | //frame width < client window? | ||
580 | if (frame.width < (*it)->width) | 580 | if (frame.width < (*it)->width) |
581 | frame.width = (*it)->width; | 581 | frame.width = (*it)->width; |
582 | } | 582 | } |
@@ -596,8 +596,8 @@ void Slit::reconfigure() { | |||
596 | break; | 596 | break; |
597 | 597 | ||
598 | case HORIZONTAL: { | 598 | case HORIZONTAL: { |
599 | SlitClients::iterator it = clientList.begin(); | 599 | SlitClients::iterator it = m_client_list.begin(); |
600 | SlitClients::iterator it_end = clientList.end(); | 600 | SlitClients::iterator it_end = m_client_list.end(); |
601 | for (; it != it_end; ++it) { | 601 | for (; it != it_end; ++it) { |
602 | //client created window? | 602 | //client created window? |
603 | if ((*it)->window != None && (*it)->visible) { | 603 | if ((*it)->window != None && (*it)->visible) { |
@@ -629,7 +629,7 @@ void Slit::reconfigure() { | |||
629 | 629 | ||
630 | frame.window.setBorderWidth(screen().rootTheme().borderWidth()); | 630 | frame.window.setBorderWidth(screen().rootTheme().borderWidth()); |
631 | frame.window.setBorderColor(screen().rootTheme().borderColor()); | 631 | frame.window.setBorderColor(screen().rootTheme().borderColor()); |
632 | //did we actually use slit slots | 632 | // did we actually use slit slots |
633 | if (num_windows == 0) | 633 | if (num_windows == 0) |
634 | frame.window.hide(); | 634 | frame.window.hide(); |
635 | else | 635 | else |
@@ -660,8 +660,8 @@ void Slit::reconfigure() { | |||
660 | y = bevel_width; | 660 | y = bevel_width; |
661 | 661 | ||
662 | { | 662 | { |
663 | SlitClients::iterator it = clientList.begin(); | 663 | SlitClients::iterator it = m_client_list.begin(); |
664 | SlitClients::iterator it_end = clientList.end(); | 664 | SlitClients::iterator it_end = m_client_list.end(); |
665 | for (; it != it_end; ++it) { | 665 | for (; it != it_end; ++it) { |
666 | if ((*it)->window == None) | 666 | if ((*it)->window == None) |
667 | continue; | 667 | continue; |
@@ -713,8 +713,8 @@ void Slit::reconfigure() { | |||
713 | y = 0; | 713 | y = 0; |
714 | 714 | ||
715 | { | 715 | { |
716 | SlitClients::iterator it = clientList.begin(); | 716 | SlitClients::iterator it = m_client_list.begin(); |
717 | SlitClients::iterator it_end = clientList.end(); | 717 | SlitClients::iterator it_end = m_client_list.end(); |
718 | for (; it != it_end; ++it) { | 718 | for (; it != it_end; ++it) { |
719 | //client created window? | 719 | //client created window? |
720 | if ((*it)->window == None) | 720 | if ((*it)->window == None) |
@@ -766,10 +766,10 @@ void Slit::reconfigure() { | |||
766 | break; | 766 | break; |
767 | } | 767 | } |
768 | 768 | ||
769 | if (do_auto_hide && !hidden && !timer.isTiming()) | 769 | if (doAutoHide() && !isHidden() && !m_timer.isTiming()) |
770 | timer.start(); | 770 | m_timer.start(); |
771 | 771 | ||
772 | slitmenu.reconfigure(); | 772 | m_slitmenu.reconfigure(); |
773 | updateClientmenu(); | 773 | updateClientmenu(); |
774 | } | 774 | } |
775 | 775 | ||
@@ -877,7 +877,7 @@ void Slit::reposition() { | |||
877 | break; | 877 | break; |
878 | } | 878 | } |
879 | 879 | ||
880 | if (hidden) { | 880 | if (isHidden()) { |
881 | frame.window.moveResize(frame.x_hidden, | 881 | frame.window.moveResize(frame.x_hidden, |
882 | frame.y_hidden, frame.width, frame.height); | 882 | frame.y_hidden, frame.width, frame.height); |
883 | } else { | 883 | } else { |
@@ -889,30 +889,30 @@ void Slit::reposition() { | |||
889 | 889 | ||
890 | void Slit::shutdown() { | 890 | void Slit::shutdown() { |
891 | saveClientList(); | 891 | saveClientList(); |
892 | while (!clientList.empty()) | 892 | while (!m_client_list.empty()) |
893 | removeClient(clientList.front(), true, true); | 893 | removeClient(m_client_list.front(), true, true); |
894 | } | 894 | } |
895 | 895 | ||
896 | void Slit::cycleClientsUp() { | 896 | void Slit::cycleClientsUp() { |
897 | if (clientList.size() < 2) | 897 | if (m_client_list.size() < 2) |
898 | return; | 898 | return; |
899 | 899 | ||
900 | // rotate client list up, ie the first goes last | 900 | // rotate client list up, ie the first goes last |
901 | SlitClients::iterator it = clientList.begin(); | 901 | SlitClients::iterator it = m_client_list.begin(); |
902 | SlitClient *client = *it; | 902 | SlitClient *client = *it; |
903 | clientList.erase(it); | 903 | m_client_list.erase(it); |
904 | clientList.push_back(client); | 904 | m_client_list.push_back(client); |
905 | reconfigure(); | 905 | reconfigure(); |
906 | } | 906 | } |
907 | 907 | ||
908 | void Slit::cycleClientsDown() { | 908 | void Slit::cycleClientsDown() { |
909 | if (clientList.size() < 2) | 909 | if (m_client_list.size() < 2) |
910 | return; | 910 | return; |
911 | 911 | ||
912 | // rotate client list down, ie the last goes first | 912 | // rotate client list down, ie the last goes first |
913 | SlitClient *client = clientList.back(); | 913 | SlitClient *client = m_client_list.back(); |
914 | clientList.remove(client); | 914 | m_client_list.remove(client); |
915 | clientList.push_front(client); | 915 | m_client_list.push_front(client); |
916 | reconfigure(); | 916 | reconfigure(); |
917 | } | 917 | } |
918 | 918 | ||
@@ -969,55 +969,55 @@ void Slit::buttonPressEvent(XButtonEvent &e) { | |||
969 | return; | 969 | return; |
970 | 970 | ||
971 | if (e.button == Button3) { | 971 | if (e.button == Button3) { |
972 | if (! slitmenu.isVisible()) { | 972 | if (! m_slitmenu.isVisible()) { |
973 | int x = e.x_root - (slitmenu.width() / 2), | 973 | int x = e.x_root - (m_slitmenu.width() / 2), |
974 | y = e.y_root - (slitmenu.height() / 2); | 974 | y = e.y_root - (m_slitmenu.height() / 2); |
975 | 975 | ||
976 | if (x < 0) | 976 | if (x < 0) |
977 | x = 0; | 977 | x = 0; |
978 | else if (x + slitmenu.width() > screen().getWidth()) | 978 | else if (x + m_slitmenu.width() > screen().getWidth()) |
979 | x = screen().getWidth() - slitmenu.width(); | 979 | x = screen().getWidth() - m_slitmenu.width(); |
980 | 980 | ||
981 | if (y < 0) | 981 | if (y < 0) |
982 | y = 0; | 982 | y = 0; |
983 | else if (y + slitmenu.height() > screen().getHeight()) | 983 | else if (y + m_slitmenu.height() > screen().getHeight()) |
984 | y = screen().getHeight() - slitmenu.height(); | 984 | y = screen().getHeight() - m_slitmenu.height(); |
985 | 985 | ||
986 | slitmenu.move(x, y); | 986 | m_slitmenu.move(x, y); |
987 | slitmenu.show(); | 987 | m_slitmenu.show(); |
988 | } else | 988 | } else |
989 | slitmenu.hide(); | 989 | m_slitmenu.hide(); |
990 | } | 990 | } |
991 | } | 991 | } |
992 | 992 | ||
993 | 993 | ||
994 | void Slit::enterNotifyEvent(XCrossingEvent &) { | 994 | void Slit::enterNotifyEvent(XCrossingEvent &) { |
995 | if (! do_auto_hide) | 995 | if (! doAutoHide()) |
996 | return; | 996 | return; |
997 | 997 | ||
998 | if (hidden) { | 998 | if (isHidden()) { |
999 | if (! timer.isTiming()) | 999 | if (! m_timer.isTiming()) |
1000 | timer.start(); | 1000 | m_timer.start(); |
1001 | } else { | 1001 | } else { |
1002 | if (timer.isTiming()) | 1002 | if (m_timer.isTiming()) |
1003 | timer.stop(); | 1003 | m_timer.stop(); |
1004 | } | 1004 | } |
1005 | } | 1005 | } |
1006 | 1006 | ||
1007 | 1007 | ||
1008 | void Slit::leaveNotifyEvent(XCrossingEvent &ev) { | 1008 | void Slit::leaveNotifyEvent(XCrossingEvent &ev) { |
1009 | if (! do_auto_hide) | 1009 | if (! doAutoHide()) |
1010 | return; | 1010 | return; |
1011 | 1011 | ||
1012 | if (hidden) { | 1012 | if (isHidden()) { |
1013 | if (timer.isTiming()) | 1013 | if (m_timer.isTiming()) |
1014 | timer.stop(); | 1014 | m_timer.stop(); |
1015 | } else { | 1015 | } else { |
1016 | if (! timer.isTiming()) { | 1016 | if (! m_timer.isTiming()) { |
1017 | // the menu is open, keep it firing until it closes | 1017 | // the menu is open, keep it firing until it closes |
1018 | if (slitmenu.isVisible()) | 1018 | if (m_slitmenu.isVisible()) |
1019 | timer.fireOnce(false); | 1019 | m_timer.fireOnce(false); |
1020 | timer.start(); | 1020 | m_timer.start(); |
1021 | } | 1021 | } |
1022 | } | 1022 | } |
1023 | 1023 | ||
@@ -1039,8 +1039,8 @@ void Slit::configureRequestEvent(XConfigureRequestEvent &event) { | |||
1039 | XConfigureWindow(FbTk::App::instance()->display(), | 1039 | XConfigureWindow(FbTk::App::instance()->display(), |
1040 | event.window, event.value_mask, &xwc); | 1040 | event.window, event.value_mask, &xwc); |
1041 | 1041 | ||
1042 | SlitClients::iterator it = clientList.begin(); | 1042 | SlitClients::iterator it = m_client_list.begin(); |
1043 | SlitClients::iterator it_end = clientList.end(); | 1043 | SlitClients::iterator it_end = m_client_list.end(); |
1044 | for (; it != it_end; ++it) { | 1044 | for (; it != it_end; ++it) { |
1045 | if ((*it)->window == event.window) { | 1045 | if ((*it)->window == event.window) { |
1046 | if ((*it)->width != ((unsigned) event.width) || | 1046 | if ((*it)->width != ((unsigned) event.width) || |
@@ -1064,16 +1064,16 @@ void Slit::exposeEvent(XExposeEvent &event) { | |||
1064 | } | 1064 | } |
1065 | 1065 | ||
1066 | void Slit::timeout() { | 1066 | void Slit::timeout() { |
1067 | if (do_auto_hide) { | 1067 | if (doAutoHide()) { |
1068 | if (!slitmenu.isVisible()) { | 1068 | if (!m_slitmenu.isVisible()) { |
1069 | timer.fireOnce(true); | 1069 | m_timer.fireOnce(true); |
1070 | } else | 1070 | } else |
1071 | return; | 1071 | return; |
1072 | } else | 1072 | } else |
1073 | if (!hidden) return; | 1073 | if (!isHidden()) return; |
1074 | 1074 | ||
1075 | hidden = ! hidden; // toggle hidden state | 1075 | m_hidden = ! m_hidden; // toggle hidden state |
1076 | if (hidden) | 1076 | if (isHidden()) |
1077 | frame.window.move(frame.x_hidden, frame.y_hidden); | 1077 | frame.window.move(frame.x_hidden, frame.y_hidden); |
1078 | else | 1078 | else |
1079 | frame.window.move(frame.x, frame.y); | 1079 | frame.window.move(frame.x, frame.y); |
@@ -1094,7 +1094,7 @@ void Slit::loadClientList(const char *filename) { | |||
1094 | std::getline(file, name); // get the entire line | 1094 | std::getline(file, name); // get the entire line |
1095 | if (name.size() > 0) { // don't add client unless we have a valid line | 1095 | if (name.size() > 0) { // don't add client unless we have a valid line |
1096 | SlitClient *client = new SlitClient(name.c_str()); | 1096 | SlitClient *client = new SlitClient(name.c_str()); |
1097 | clientList.push_back(client); | 1097 | m_client_list.push_back(client); |
1098 | } | 1098 | } |
1099 | } | 1099 | } |
1100 | } | 1100 | } |
@@ -1102,30 +1102,33 @@ void Slit::loadClientList(const char *filename) { | |||
1102 | 1102 | ||
1103 | void Slit::updateClientmenu() { | 1103 | void Slit::updateClientmenu() { |
1104 | // clear old items | 1104 | // clear old items |
1105 | clientlist_menu.removeAll(); | 1105 | m_clientlist_menu.removeAll(); |
1106 | clientlist_menu.setLabel("Clients"); | 1106 | m_clientlist_menu.setLabel("Clients"); |
1107 | |||
1107 | FbTk::RefCount<FbTk::Command> cycle_up(new FbTk::SimpleCommand<Slit>(*this, &Slit::cycleClientsUp)); | 1108 | FbTk::RefCount<FbTk::Command> cycle_up(new FbTk::SimpleCommand<Slit>(*this, &Slit::cycleClientsUp)); |
1108 | FbTk::RefCount<FbTk::Command> cycle_down(new FbTk::SimpleCommand<Slit>(*this, &Slit::cycleClientsDown)); | 1109 | FbTk::RefCount<FbTk::Command> cycle_down(new FbTk::SimpleCommand<Slit>(*this, &Slit::cycleClientsDown)); |
1109 | clientlist_menu.insert("Cycle Up", cycle_up); | 1110 | m_clientlist_menu.insert("Cycle Up", cycle_up); |
1110 | clientlist_menu.insert("Cycle Down", cycle_down); | 1111 | m_clientlist_menu.insert("Cycle Down", cycle_down); |
1112 | |||
1111 | FbTk::MenuItem *separator = new FbTk::MenuItem("-------"); | 1113 | FbTk::MenuItem *separator = new FbTk::MenuItem("-------"); |
1112 | separator->setEnabled(false); | 1114 | separator->setEnabled(false); |
1113 | clientlist_menu.insert(separator); | 1115 | m_clientlist_menu.insert(separator); |
1116 | |||
1114 | FbTk::RefCount<FbTk::Command> reconfig(new FbTk::SimpleCommand<Slit>(*this, &Slit::reconfigure)); | 1117 | FbTk::RefCount<FbTk::Command> reconfig(new FbTk::SimpleCommand<Slit>(*this, &Slit::reconfigure)); |
1115 | SlitClients::iterator it = clientList.begin(); | 1118 | SlitClients::iterator it = m_client_list.begin(); |
1116 | for (; it != clientList.end(); ++it) { | 1119 | for (; it != m_client_list.end(); ++it) { |
1117 | if ((*it) != 0 && (*it)->window != 0) | 1120 | if ((*it) != 0 && (*it)->window != 0) |
1118 | clientlist_menu.insert(new SlitClientMenuItem(*(*it), reconfig)); | 1121 | m_clientlist_menu.insert(new SlitClientMenuItem(*(*it), reconfig)); |
1119 | } | 1122 | } |
1120 | 1123 | ||
1121 | clientlist_menu.update(); | 1124 | m_clientlist_menu.update(); |
1122 | } | 1125 | } |
1123 | 1126 | ||
1124 | void Slit::saveClientList() { | 1127 | void Slit::saveClientList() { |
1125 | 1128 | ||
1126 | std::ofstream file(m_filename.c_str()); | 1129 | std::ofstream file(m_filename.c_str()); |
1127 | SlitClients::iterator it = clientList.begin(); | 1130 | SlitClients::iterator it = m_client_list.begin(); |
1128 | SlitClients::iterator it_end = clientList.end(); | 1131 | SlitClients::iterator it_end = m_client_list.end(); |
1129 | std::string prevName; | 1132 | std::string prevName; |
1130 | std::string name; | 1133 | std::string name; |
1131 | for (; it != it_end; ++it) { | 1134 | for (; it != it_end; ++it) { |
@@ -1138,14 +1141,15 @@ void Slit::saveClientList() { | |||
1138 | } | 1141 | } |
1139 | 1142 | ||
1140 | void Slit::setAutoHide(bool val) { | 1143 | void Slit::setAutoHide(bool val) { |
1141 | do_auto_hide = val; | 1144 | m_do_auto_hide = val; |
1142 | screen().saveSlitAutoHide(val); | 1145 | screen().saveSlitAutoHide(val); |
1143 | if (do_auto_hide) | 1146 | if (doAutoHide()) { |
1144 | if (! timer.isTiming()) { | 1147 | if (! m_timer.isTiming()) { |
1145 | if (slitmenu.isVisible()) | 1148 | if (m_slitmenu.isVisible()) |
1146 | timer.fireOnce(false); | 1149 | m_timer.fireOnce(false); |
1147 | timer.start(); | 1150 | m_timer.start(); |
1148 | } | 1151 | } |
1152 | } | ||
1149 | } | 1153 | } |
1150 | 1154 | ||
1151 | void Slit::setupMenu() { | 1155 | void Slit::setupMenu() { |
@@ -1162,36 +1166,34 @@ void Slit::setupMenu() { | |||
1162 | FbTk::RefCount<FbTk::Command> save_and_reconfigure(s_a_reconf_macro); | 1166 | FbTk::RefCount<FbTk::Command> save_and_reconfigure(s_a_reconf_macro); |
1163 | 1167 | ||
1164 | // setup base menu | 1168 | // setup base menu |
1165 | slitmenu.setLabel("Slit"); | 1169 | m_slitmenu.setLabel("Slit"); |
1166 | slitmenu.insert(i18n->getMessage( | 1170 | m_slitmenu.insert(i18n->getMessage( |
1167 | CommonSet, CommonPlacementTitle, | 1171 | CommonSet, CommonPlacementTitle, |
1168 | "Placement"), | 1172 | "Placement"), |
1169 | &placement_menu); | 1173 | &m_placement_menu); |
1170 | 1174 | ||
1171 | slitmenu.insert("Layer...", m_slit_layermenu.get()); | 1175 | m_slitmenu.insert("Layer...", m_layermenu.get()); |
1172 | 1176 | ||
1173 | slitmenu.insert(new BoolMenuItem(i18n->getMessage( | 1177 | m_slitmenu.insert(new BoolMenuItem(i18n->getMessage( |
1174 | CommonSet, CommonAutoHide, | 1178 | CommonSet, CommonAutoHide, |
1175 | "Auto hide"), | 1179 | "Auto hide"), |
1176 | screen().doSlitAutoHide(), | 1180 | screen().doSlitAutoHide(), |
1177 | save_and_reconfigure)); | 1181 | save_and_reconfigure)); |
1178 | 1182 | ||
1179 | slitmenu.insert(new SlitDirMenuItem(i18n->getMessage( | 1183 | m_slitmenu.insert(new SlitDirMenuItem(i18n->getMessage( |
1180 | SlitSet, SlitSlitDirection, | 1184 | SlitSet, SlitSlitDirection, |
1181 | "Slit Direction"), | 1185 | "Slit Direction"), |
1182 | *this, | 1186 | *this, |
1183 | save_and_reconfigure)); | 1187 | save_and_reconfigure)); |
1184 | slitmenu.insert("Clients", &clientlist_menu); | 1188 | m_slitmenu.insert("Clients", &m_clientlist_menu); |
1185 | slitmenu.update(); | 1189 | m_slitmenu.update(); |
1186 | 1190 | ||
1187 | // setup sub menu | 1191 | // setup sub menu |
1188 | 1192 | m_placement_menu.setLabel(i18n->getMessage( | |
1189 | |||
1190 | placement_menu.setLabel(i18n->getMessage( | ||
1191 | SlitSet, SlitSlitPlacement, | 1193 | SlitSet, SlitSlitPlacement, |
1192 | "Slit Placement")); | 1194 | "Slit Placement")); |
1193 | placement_menu.setMinimumSublevels(3); | 1195 | m_placement_menu.setMinimumSublevels(3); |
1194 | placement_menu.setInternalMenu(); | 1196 | m_placement_menu.setInternalMenu(); |
1195 | 1197 | ||
1196 | 1198 | ||
1197 | // setup items in sub menu | 1199 | // setup items in sub menu |
@@ -1214,18 +1216,18 @@ void Slit::setupMenu() { | |||
1214 | // create items in sub menu | 1216 | // create items in sub menu |
1215 | for (size_t i=0; i<9; ++i) { | 1217 | for (size_t i=0; i<9; ++i) { |
1216 | if (place_menu[i].default_str == 0) { | 1218 | if (place_menu[i].default_str == 0) { |
1217 | placement_menu.insert(""); | 1219 | m_placement_menu.insert(""); |
1218 | } else { | 1220 | } else { |
1219 | const char *i18n_str = i18n->getMessage(place_menu[i].set, | 1221 | const char *i18n_str = i18n->getMessage(place_menu[i].set, |
1220 | place_menu[i].base, | 1222 | place_menu[i].base, |
1221 | place_menu[i].default_str); | 1223 | place_menu[i].default_str); |
1222 | placement_menu.insert(new PlaceSlitMenuItem(i18n_str, *this, | 1224 | m_placement_menu.insert(new PlaceSlitMenuItem(i18n_str, *this, |
1223 | place_menu[i].slit_placement, | 1225 | place_menu[i].slit_placement, |
1224 | save_and_reconfigure)); | 1226 | save_and_reconfigure)); |
1225 | } | 1227 | } |
1226 | } | 1228 | } |
1227 | // finaly update sub menu | 1229 | // finaly update sub menu |
1228 | placement_menu.update(); | 1230 | m_placement_menu.update(); |
1229 | } | 1231 | } |
1230 | 1232 | ||
1231 | void Slit::moveToLayer(int layernum) { | 1233 | void Slit::moveToLayer(int layernum) { |
diff --git a/src/Slit.hh b/src/Slit.hh index a9c3322..f2e74bb 100644 --- a/src/Slit.hh +++ b/src/Slit.hh | |||
@@ -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.hh,v 1.26 2003/05/07 22:53:21 fluxgen Exp $ | 25 | /// $Id: Slit.hh,v 1.27 2003/05/11 17:42:51 fluxgen Exp $ |
26 | 26 | ||
27 | #ifndef SLIT_HH | 27 | #ifndef SLIT_HH |
28 | #define SLIT_HH | 28 | #define SLIT_HH |
@@ -61,16 +61,16 @@ public: | |||
61 | Slit(BScreen &screen, FbTk::XLayer &layer, const char *filename = 0); | 61 | Slit(BScreen &screen, FbTk::XLayer &layer, const char *filename = 0); |
62 | virtual ~Slit(); | 62 | virtual ~Slit(); |
63 | 63 | ||
64 | inline bool isHidden() const { return hidden; } | 64 | inline bool isHidden() const { return m_hidden; } |
65 | inline bool doAutoHide() const { return do_auto_hide; } | 65 | inline bool doAutoHide() const { return m_do_auto_hide; } |
66 | inline Direction direction() const { return m_direction; } | 66 | inline Direction direction() const { return m_direction; } |
67 | inline Placement placement() const { return m_placement; } | 67 | inline Placement placement() const { return m_placement; } |
68 | FbTk::Menu &menu() { return slitmenu; } | 68 | FbTk::Menu &menu() { return m_slitmenu; } |
69 | 69 | ||
70 | inline const FbTk::FbWindow &window() const { return frame.window; } | 70 | inline const FbTk::FbWindow &window() const { return frame.window; } |
71 | 71 | ||
72 | inline int x() const { return ((hidden) ? frame.x_hidden : frame.x); } | 72 | inline int x() const { return (m_hidden ? frame.x_hidden : frame.x); } |
73 | inline int y() const { return ((hidden) ? frame.y_hidden : frame.y); } | 73 | inline int y() const { return (m_hidden ? frame.y_hidden : frame.y); } |
74 | 74 | ||
75 | inline unsigned int width() const { return frame.width; } | 75 | inline unsigned int width() const { return frame.width; } |
76 | inline unsigned int height() const { return frame.height; } | 76 | inline unsigned int height() const { return frame.height; } |
@@ -117,18 +117,18 @@ private: | |||
117 | void loadClientList(const char *filename); | 117 | void loadClientList(const char *filename); |
118 | void updateClientmenu(); | 118 | void updateClientmenu(); |
119 | 119 | ||
120 | bool hidden, do_auto_hide; | 120 | bool m_hidden, m_do_auto_hide; |
121 | Direction m_direction; | 121 | Direction m_direction; |
122 | Placement m_placement; | 122 | Placement m_placement; |
123 | 123 | ||
124 | BScreen &m_screen; | 124 | BScreen &m_screen; |
125 | FbTk::Timer timer; | 125 | FbTk::Timer m_timer; |
126 | 126 | ||
127 | typedef std::list<SlitClient *> SlitClients; | 127 | typedef std::list<SlitClient *> SlitClients; |
128 | 128 | ||
129 | SlitClients clientList; | 129 | SlitClients m_client_list; |
130 | FbMenu slitmenu, placement_menu, clientlist_menu; | 130 | FbMenu m_slitmenu, m_placement_menu, m_clientlist_menu; |
131 | std::auto_ptr<LayerMenu<Slit> > m_slit_layermenu; | 131 | std::auto_ptr<LayerMenu<Slit> > m_layermenu; |
132 | std::string m_filename; | 132 | std::string m_filename; |
133 | 133 | ||
134 | struct frame { | 134 | struct frame { |
@@ -138,8 +138,9 @@ private: | |||
138 | int x, y, x_hidden, y_hidden; | 138 | int x, y, x_hidden, y_hidden; |
139 | unsigned int width, height; | 139 | unsigned int width, height; |
140 | } frame; | 140 | } frame; |
141 | |||
141 | // for KDE | 142 | // for KDE |
142 | Atom kwm1_dockwindow, kwm2_dockwindow; | 143 | Atom m_kwm1_dockwindow, m_kwm2_dockwindow; |
143 | 144 | ||
144 | std::auto_ptr<FbTk::XLayerItem> m_layeritem; | 145 | std::auto_ptr<FbTk::XLayerItem> m_layeritem; |
145 | std::auto_ptr<SlitTheme> m_slit_theme; | 146 | std::auto_ptr<SlitTheme> m_slit_theme; |