diff options
-rw-r--r-- | src/Screen.cc | 99 |
1 files changed, 46 insertions, 53 deletions
diff --git a/src/Screen.cc b/src/Screen.cc index b3925c9..e9c1846 100644 --- a/src/Screen.cc +++ b/src/Screen.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: Screen.cc,v 1.85 2002/11/27 13:01:28 fluxgen Exp $ | 25 | // $Id: Screen.cc,v 1.86 2002/11/27 21:55:36 fluxgen Exp $ |
26 | 26 | ||
27 | 27 | ||
28 | #include "Screen.hh" | 28 | #include "Screen.hh" |
@@ -82,6 +82,17 @@ | |||
82 | #include <stdarg.h> | 82 | #include <stdarg.h> |
83 | #endif // HAVE_STDARG_H | 83 | #endif // HAVE_STDARG_H |
84 | 84 | ||
85 | #ifdef TIME_WITH_SYS_TIME | ||
86 | #include <sys/time.h> | ||
87 | #include <time.h> | ||
88 | #else // !TIME_WITH_SYS_TIME | ||
89 | #ifdef HAVE_SYS_TIME_H | ||
90 | #include <sys/time.h> | ||
91 | #else // !HAVE_SYS_TIME_H | ||
92 | #include <time.h> | ||
93 | #endif // HAVE_SYS_TIME_H | ||
94 | #endif // TIME_WITH_SYS_TIME | ||
95 | |||
85 | #ifndef MAXPATHLEN | 96 | #ifndef MAXPATHLEN |
86 | #define MAXPATHLEN 255 | 97 | #define MAXPATHLEN 255 |
87 | #endif // MAXPATHLEN | 98 | #endif // MAXPATHLEN |
@@ -215,9 +226,7 @@ tab_width(rm, 64, scrname+".tab.width", altscrname+".Tab.Width"), | |||
215 | tab_height(rm, 16, scrname+".tab.height", altscrname+".Tab.Height"), | 226 | tab_height(rm, 16, scrname+".tab.height", altscrname+".Tab.Height"), |
216 | tab_placement(rm, Tab::PTOP, scrname+".tab.placement", altscrname+".Tab.Placement"), | 227 | tab_placement(rm, Tab::PTOP, scrname+".tab.placement", altscrname+".Tab.Placement"), |
217 | tab_alignment(rm, Tab::ALEFT, scrname+".tab.alignment", altscrname+".Tab.Alignment"), | 228 | tab_alignment(rm, Tab::ALEFT, scrname+".tab.alignment", altscrname+".Tab.Alignment"), |
218 | #ifdef XINERAMA | ||
219 | toolbar_on_head(rm, 0, scrname+".toolbar.onhead", altscrname+".Toolbar.onHead"), | 229 | toolbar_on_head(rm, 0, scrname+".toolbar.onhead", altscrname+".Toolbar.onHead"), |
220 | #endif // XINERAMA | ||
221 | toolbar_placement(rm, Toolbar::BOTTOMCENTER, scrname+".toolbar.placement", altscrname+".Toolbar.Placement") | 230 | toolbar_placement(rm, Toolbar::BOTTOMCENTER, scrname+".toolbar.placement", altscrname+".Toolbar.Placement") |
222 | { | 231 | { |
223 | 232 | ||
@@ -326,7 +335,7 @@ resource(rm, screenname, altscreenname) | |||
326 | theme->getWindowStyle().t_focus.color().pixel()); | 335 | theme->getWindowStyle().t_focus.color().pixel()); |
327 | } else { | 336 | } else { |
328 | geom_pixmap = image_control->renderImage(geom_w, geom_h, | 337 | geom_pixmap = image_control->renderImage(geom_w, geom_h, |
329 | &theme->getWindowStyle().t_focus); | 338 | theme->getWindowStyle().t_focus); |
330 | XSetWindowBackgroundPixmap(disp, geom_window, geom_pixmap); | 339 | XSetWindowBackgroundPixmap(disp, geom_window, geom_pixmap); |
331 | } | 340 | } |
332 | } else { | 341 | } else { |
@@ -337,7 +346,7 @@ resource(rm, screenname, altscreenname) | |||
337 | theme->getWindowStyle().l_focus.color().pixel()); | 346 | theme->getWindowStyle().l_focus.color().pixel()); |
338 | } else { | 347 | } else { |
339 | geom_pixmap = image_control->renderImage(geom_w, geom_h, | 348 | geom_pixmap = image_control->renderImage(geom_w, geom_h, |
340 | &theme->getWindowStyle().l_focus); | 349 | theme->getWindowStyle().l_focus); |
341 | XSetWindowBackgroundPixmap(disp, geom_window, geom_pixmap); | 350 | XSetWindowBackgroundPixmap(disp, geom_window, geom_pixmap); |
342 | } | 351 | } |
343 | } | 352 | } |
@@ -381,9 +390,10 @@ resource(rm, screenname, altscreenname) | |||
381 | 390 | ||
382 | //update menus | 391 | //update menus |
383 | rootmenu->update(); | 392 | rootmenu->update(); |
384 | #ifdef SLIT | 393 | |
385 | m_slit->reconfigure(); | 394 | if (m_slit.get()) |
386 | #endif // SLIT | 395 | m_slit->reconfigure(); |
396 | |||
387 | 397 | ||
388 | // start with workspace 0 | 398 | // start with workspace 0 |
389 | changeWorkspaceID(0); | 399 | changeWorkspaceID(0); |
@@ -541,7 +551,7 @@ void BScreen::reconfigure() { | |||
541 | theme->getWindowStyle().t_focus.color().pixel()); | 551 | theme->getWindowStyle().t_focus.color().pixel()); |
542 | } else { | 552 | } else { |
543 | geom_pixmap = image_control->renderImage(geom_w, geom_h, | 553 | geom_pixmap = image_control->renderImage(geom_w, geom_h, |
544 | &theme->getWindowStyle().t_focus); | 554 | theme->getWindowStyle().t_focus); |
545 | XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(), | 555 | XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(), |
546 | geom_window, geom_pixmap); | 556 | geom_window, geom_pixmap); |
547 | } | 557 | } |
@@ -553,7 +563,7 @@ void BScreen::reconfigure() { | |||
553 | theme->getWindowStyle().l_focus.color().pixel()); | 563 | theme->getWindowStyle().l_focus.color().pixel()); |
554 | } else { | 564 | } else { |
555 | geom_pixmap = image_control->renderImage(geom_w, geom_h, | 565 | geom_pixmap = image_control->renderImage(geom_w, geom_h, |
556 | &theme->getWindowStyle().l_focus); | 566 | theme->getWindowStyle().l_focus); |
557 | XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(), | 567 | XSetWindowBackgroundPixmap(getBaseDisplay()->getXDisplay(), |
558 | geom_window, geom_pixmap); | 568 | geom_window, geom_pixmap); |
559 | } | 569 | } |
@@ -582,9 +592,9 @@ void BScreen::reconfigure() { | |||
582 | 592 | ||
583 | m_toolbar->reconfigure(); | 593 | m_toolbar->reconfigure(); |
584 | 594 | ||
585 | #ifdef SLIT | 595 | |
586 | m_slit->reconfigure(); | 596 | if (m_slit.get()) |
587 | #endif // SLIT | 597 | m_slit->reconfigure(); |
588 | 598 | ||
589 | //reconfigure workspaces | 599 | //reconfigure workspaces |
590 | Workspaces::iterator wit = workspacesList.begin(); | 600 | Workspaces::iterator wit = workspacesList.begin(); |
@@ -974,7 +984,7 @@ void BScreen::raiseWindows(const Workspace::Stack &workspace_stack) { | |||
974 | session_stack[i++] = configmenu->tabmenu().windowID(); | 984 | session_stack[i++] = configmenu->tabmenu().windowID(); |
975 | session_stack[i++] = configmenu->windowID(); | 985 | session_stack[i++] = configmenu->windowID(); |
976 | 986 | ||
977 | #ifdef SLIT | 987 | #ifdef SLIT |
978 | session_stack[i++] = m_slit->menu().getDirectionmenu().windowID(); | 988 | session_stack[i++] = m_slit->menu().getDirectionmenu().windowID(); |
979 | session_stack[i++] = m_slit->menu().getPlacementmenu().windowID(); | 989 | session_stack[i++] = m_slit->menu().getPlacementmenu().windowID(); |
980 | #ifdef XINERAMA | 990 | #ifdef XINERAMA |
@@ -1019,12 +1029,10 @@ void BScreen::raiseWindows(const Workspace::Stack &workspace_stack) { | |||
1019 | 1029 | ||
1020 | } | 1030 | } |
1021 | 1031 | ||
1022 | #ifdef HAVE_STRFTIME | ||
1023 | void BScreen::saveStrftimeFormat(const char *format) { | 1032 | void BScreen::saveStrftimeFormat(const char *format) { |
1024 | //make sure std::string don't get 0 string | 1033 | //make sure std::string don't get 0 string |
1025 | resource.strftime_format = (format ? format : ""); | 1034 | resource.strftime_format = (format ? format : ""); |
1026 | } | 1035 | } |
1027 | #endif // HAVE_STRFTIME | ||
1028 | 1036 | ||
1029 | 1037 | ||
1030 | void BScreen::addWorkspaceName(const char *name) { | 1038 | void BScreen::addWorkspaceName(const char *name) { |
@@ -1556,9 +1564,8 @@ void BScreen::shutdown() { | |||
1556 | } | 1564 | } |
1557 | } | 1565 | } |
1558 | 1566 | ||
1559 | #ifdef SLIT | 1567 | if (m_slit.get()) |
1560 | m_slit->shutdown(); | 1568 | m_slit->shutdown(); |
1561 | #endif // SLIT | ||
1562 | 1569 | ||
1563 | } | 1570 | } |
1564 | 1571 | ||
@@ -1630,21 +1637,8 @@ void BScreen::showGeometry(unsigned int gx, unsigned int gy) { | |||
1630 | "W: %4d x H: %4d"), gx, gy); | 1637 | "W: %4d x H: %4d"), gx, gy); |
1631 | 1638 | ||
1632 | XClearWindow(getBaseDisplay()->getXDisplay(), geom_window); | 1639 | XClearWindow(getBaseDisplay()->getXDisplay(), geom_window); |
1633 | /* | 1640 | |
1634 | if (I18n::instance()->multibyte()) | 1641 | //TODO: geom window again?! repeated |
1635 | XmbDrawString(getBaseDisplay()->getXDisplay(), geom_window, | ||
1636 | theme->getWindowStyle().font.set, theme->getWindowStyle().l_text_focus_gc, | ||
1637 | theme->getBevelWidth(), theme->getBevelWidth() - | ||
1638 | theme->getWindowStyle().font.set_extents->max_ink_extent.y, | ||
1639 | label, strlen(label)); | ||
1640 | else | ||
1641 | XDrawString(getBaseDisplay()->getXDisplay(), geom_window, | ||
1642 | theme->getWindowStyle().l_text_focus_gc, | ||
1643 | theme->getBevelWidth(), | ||
1644 | theme->getWindowStyle().font.fontstruct->ascent + | ||
1645 | theme->getBevelWidth(), label, strlen(label)); | ||
1646 | */ | ||
1647 | //TODO: geom window again?! repeat | ||
1648 | theme->getWindowStyle().font.drawText( | 1642 | theme->getWindowStyle().font.drawText( |
1649 | geom_window, | 1643 | geom_window, |
1650 | getScreenNumber(), | 1644 | getScreenNumber(), |
@@ -1662,49 +1656,48 @@ void BScreen::hideGeometry() { | |||
1662 | } | 1656 | } |
1663 | } | 1657 | } |
1664 | 1658 | ||
1665 | //-------------- nextWorkspace --------------- | 1659 | /** |
1666 | // Goes to the workspace "right" of the current | 1660 | Goes to the workspace "right" of the current |
1667 | //-------------------------------------------- | 1661 | */ |
1668 | void BScreen::nextWorkspace(const int delta) { | 1662 | void BScreen::nextWorkspace(const int delta) { |
1669 | changeWorkspaceID( (getCurrentWorkspaceID()+delta) % getCount()); | 1663 | changeWorkspaceID( (getCurrentWorkspaceID()+delta) % getCount()); |
1670 | } | 1664 | } |
1671 | 1665 | ||
1672 | //------------- prevWorkspace ---------------- | 1666 | /** |
1673 | // Goes to the workspace "left" of the current | 1667 | Goes to the workspace "left" of the current |
1674 | //-------------------------------------------- | 1668 | */ |
1675 | void BScreen::prevWorkspace(const int delta) { | 1669 | void BScreen::prevWorkspace(const int delta) { |
1676 | changeWorkspaceID( (getCurrentWorkspaceID()-delta+getCount()) % getCount()); | 1670 | changeWorkspaceID( (getCurrentWorkspaceID()-delta+getCount()) % getCount()); |
1677 | } | 1671 | } |
1678 | 1672 | ||
1679 | //-------------- rightWorkspace --------------- | 1673 | /** |
1680 | // Goes to the workspace "right" of the current | 1674 | Goes to the workspace "right" of the current |
1681 | //-------------------------------------------- | 1675 | */ |
1682 | void BScreen::rightWorkspace(const int delta) { | 1676 | void BScreen::rightWorkspace(const int delta) { |
1683 | if (getCurrentWorkspaceID()+delta < getCount()) | 1677 | if (getCurrentWorkspaceID()+delta < getCount()) |
1684 | changeWorkspaceID(getCurrentWorkspaceID()+delta); | 1678 | changeWorkspaceID(getCurrentWorkspaceID()+delta); |
1685 | } | 1679 | } |
1686 | 1680 | ||
1687 | //------------- leftWorkspace ---------------- | 1681 | /** |
1688 | // Goes to the workspace "left" of the current | 1682 | Goes to the workspace "left" of the current |
1689 | //-------------------------------------------- | 1683 | */ |
1690 | void BScreen::leftWorkspace(const int delta) { | 1684 | void BScreen::leftWorkspace(const int delta) { |
1691 | if (getCurrentWorkspaceID() >= static_cast<unsigned int>(delta)) | 1685 | if (getCurrentWorkspaceID() >= static_cast<unsigned int>(delta)) |
1692 | changeWorkspaceID(getCurrentWorkspaceID()-delta); | 1686 | changeWorkspaceID(getCurrentWorkspaceID()-delta); |
1693 | } | 1687 | } |
1694 | 1688 | ||
1695 | //-------- doSkipWindow | 1689 | /** |
1696 | // Returns true if the windows should be skiped | 1690 | @return true if the windows should be skiped else false |
1697 | // else false | 1691 | */ |
1698 | //---------- | ||
1699 | bool BScreen::doSkipWindow(const FluxboxWindow *w, int opts) { | 1692 | bool BScreen::doSkipWindow(const FluxboxWindow *w, int opts) { |
1700 | return ((opts & CYCLESKIPSTUCK) != 0 && w->isStuck() || // skip if stuck | 1693 | return ((opts & CYCLESKIPSTUCK) != 0 && w->isStuck() || // skip if stuck |
1701 | (opts & CYCLESKIPLOWERTABS) != 0 && w->isLowerTab() || // skip if lower tab | 1694 | (opts & CYCLESKIPLOWERTABS) != 0 && w->isLowerTab() || // skip if lower tab |
1702 | (opts & CYCLESKIPSHADED) != 0 && w->isShaded()); // skip if shaded | 1695 | (opts & CYCLESKIPSHADED) != 0 && w->isShaded()); // skip if shaded |
1703 | } | 1696 | } |
1704 | 1697 | ||
1705 | //----------- useAutoGroupWindow ------------- | 1698 | /** |
1706 | // Access and clear the auto-group window | 1699 | Access and clear the auto-group window |
1707 | //-------------------------------------------- | 1700 | */ |
1708 | FluxboxWindow* BScreen::useAutoGroupWindow() { | 1701 | FluxboxWindow* BScreen::useAutoGroupWindow() { |
1709 | Window w = auto_group_window; | 1702 | Window w = auto_group_window; |
1710 | auto_group_window = 0; | 1703 | auto_group_window = 0; |