aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Ewmh.cc107
-rw-r--r--src/Ewmh.hh27
-rw-r--r--src/Window.cc65
-rw-r--r--src/Window.hh46
4 files changed, 196 insertions, 49 deletions
diff --git a/src/Ewmh.cc b/src/Ewmh.cc
index b6c5b24..78ea63e 100644
--- a/src/Ewmh.cc
+++ b/src/Ewmh.cc
@@ -60,10 +60,28 @@ Ewmh::~Ewmh() {
60void Ewmh::initForScreen(BScreen &screen) { 60void Ewmh::initForScreen(BScreen &screen) {
61 Display *disp = FbTk::App::instance()->display(); 61 Display *disp = FbTk::App::instance()->display();
62 62
63 /* From Extended Window Manager Hints, draft 1.3:
64 *
65 * _NET_SUPPORTING_WM_CHECK
66 *
67 * The Window Manager MUST set this property on the root window
68 * to be the ID of a child window created by himself, to indicate
69 * that a compliant window manager is active. The child window
70 * MUST also have the _NET_SUPPORTING_WM_CHECK property set to
71 * the ID of the child window. The child window MUST also have
72 * the _NET_WM_NAME property set to the name of the Window Manager.
73 *
74 * Rationale: The child window is used to distinguish an active
75 * Window Manager from a stale _NET_SUPPORTING_WM_CHECK property
76 * that happens to point to another window. If the
77 * _NET_SUPPORTING_WM_CHECK window on the client window is missing
78 * or not properly set, clients SHOULD assume that no conforming
79 * Window Manager is present.
80 */
63 81
64 Window wincheck = XCreateSimpleWindow(disp, 82 Window wincheck = XCreateSimpleWindow(disp,
65 screen.rootWindow().window(), 83 screen.rootWindow().window(),
66 0, 0, 5, 5, 0, 0, 0); 84 -10, -10, 5, 5, 0, 0, 0);
67 85
68 if (wincheck != None) { 86 if (wincheck != None) {
69 // store the window so we can delete it later 87 // store the window so we can delete it later
@@ -72,10 +90,10 @@ void Ewmh::initForScreen(BScreen &screen) {
72 screen.rootWindow().changeProperty(m_net_supporting_wm_check, XA_WINDOW, 32, 90 screen.rootWindow().changeProperty(m_net_supporting_wm_check, XA_WINDOW, 32,
73 PropModeReplace, (unsigned char *) &wincheck, 1); 91 PropModeReplace, (unsigned char *) &wincheck, 1);
74 XChangeProperty(disp, wincheck, m_net_supporting_wm_check, XA_WINDOW, 32, 92 XChangeProperty(disp, wincheck, m_net_supporting_wm_check, XA_WINDOW, 32,
75 PropModeReplace, (unsigned char *) &wincheck, 1); 93 PropModeReplace, (unsigned char *) &wincheck, 1);
76 94
77 XChangeProperty(disp, wincheck, m_net_wm_name, XA_STRING, 8, 95 XChangeProperty(disp, wincheck, m_net_wm_name, XA_STRING, 8,
78 PropModeReplace, (unsigned char *) "Fluxbox", strlen("Fluxbox")); 96 PropModeReplace, (unsigned char *) "Fluxbox", strlen("Fluxbox"));
79 } 97 }
80 98
81 //set supported atoms 99 //set supported atoms
@@ -86,9 +104,9 @@ void Ewmh::initForScreen(BScreen &screen) {
86 // states that we support: 104 // states that we support:
87 m_net_wm_state_sticky, 105 m_net_wm_state_sticky,
88 m_net_wm_state_shaded, 106 m_net_wm_state_shaded,
89 m_net_wm_state_maximized_horz, 107 m_net_wm_state_maximized_horz,
90 m_net_wm_state_maximized_vert, 108 m_net_wm_state_maximized_vert,
91 m_net_wm_state_fullscreen, 109 m_net_wm_state_fullscreen,
92 m_net_wm_state_hidden, 110 m_net_wm_state_hidden,
93 m_net_wm_state_skip_taskbar, 111 m_net_wm_state_skip_taskbar,
94 112
@@ -170,6 +188,7 @@ void Ewmh::setupFrame(FluxboxWindow &win) {
170 * Managers that do not recognize the extensions. 188 * Managers that do not recognize the extensions.
171 * 189 *
172 */ 190 */
191
173 win.winClient().property(m_net_wm_window_type, 0, 0x7fffffff, False, XA_ATOM, 192 win.winClient().property(m_net_wm_window_type, 0, 0x7fffffff, False, XA_ATOM,
174 &ret_type, &fmt, &nitems, &bytes_after, 193 &ret_type, &fmt, &nitems, &bytes_after,
175 &data); 194 &data);
@@ -501,7 +520,39 @@ void Ewmh::updateWorkarea(BScreen &screen) {
501} 520}
502 521
503void Ewmh::updateState(FluxboxWindow &win) { 522void Ewmh::updateState(FluxboxWindow &win) {
504 //!! TODO 523
524 // TODO: should we update the _NET_WM_ALLOWED_ACTIONS
525 // here too?
526
527 std::vector<unsigned int> state;
528
529 if (win.isStuck())
530 state.push_back(m_net_wm_state_sticky);
531 if (win.isShaded())
532 state.push_back(m_net_wm_state_shaded);
533 if (win.layerNum() == Fluxbox::instance()->getBottomLayer())
534 state.push_back(m_net_wm_state_below);
535 if (win.layerNum() == Fluxbox::instance()->getAboveDockLayer())
536 state.push_back(m_net_wm_state_above);
537 if (win.isFocusHidden()) {
538 state.push_back(m_net_wm_state_hidden);
539 state.push_back(m_net_wm_state_skip_taskbar);
540 }
541 if (win.isFullscreen()) {
542 state.push_back(m_net_wm_state_fullscreen);
543 }
544
545 FluxboxWindow::ClientList::iterator it = win.clientList().begin();
546 FluxboxWindow::ClientList::iterator it_end = win.clientList().end();
547
548 it = win.clientList().begin();
549 for (; it != it_end; ++it) {
550 if (!state.empty())
551 (*it)->changeProperty(m_net_wm_state, XA_ATOM, 32, PropModeReplace,
552 reinterpret_cast<unsigned char*>(&state.front()), state.size());
553 else
554 (*it)->deleteProperty(m_net_wm_state);
555 }
505} 556}
506 557
507void Ewmh::updateLayer(FluxboxWindow &win) { 558void Ewmh::updateLayer(FluxboxWindow &win) {
@@ -537,6 +588,7 @@ void Ewmh::updateWorkspace(FluxboxWindow &win) {
537// return true if we did handle the atom here 588// return true if we did handle the atom here
538bool Ewmh::checkClientMessage(const XClientMessageEvent &ce, 589bool Ewmh::checkClientMessage(const XClientMessageEvent &ce,
539 BScreen * screen, WinClient * const winclient) { 590 BScreen * screen, WinClient * const winclient) {
591
540 if (ce.message_type == m_net_wm_desktop) { 592 if (ce.message_type == m_net_wm_desktop) {
541 // ce.data.l[0] = workspace number 593 // ce.data.l[0] = workspace number
542 // valid window 594 // valid window
@@ -581,7 +633,6 @@ bool Ewmh::checkClientMessage(const XClientMessageEvent &ce,
581 toggleState(win, ce.data.l[1]); 633 toggleState(win, ce.data.l[1]);
582 toggleState(win, ce.data.l[2]); 634 toggleState(win, ce.data.l[2]);
583 } 635 }
584
585 return true; 636 return true;
586 } else if (ce.message_type == m_net_number_of_desktops) { 637 } else if (ce.message_type == m_net_number_of_desktops) {
587 if (screen == 0) 638 if (screen == 0)
@@ -676,7 +727,7 @@ bool Ewmh::propertyNotify(WinClient &winclient, Atom the_property) {
676#endif // DEBUG 727#endif // DEBUG
677 updateStrut(winclient); 728 updateStrut(winclient);
678 return true; 729 return true;
679 } 730 }
680 731
681 return false; 732 return false;
682} 733}
@@ -725,6 +776,18 @@ void Ewmh::createAtoms() {
725 m_net_wm_state_above = XInternAtom(disp, "_NET_WM_STATE_ABOVE", False); 776 m_net_wm_state_above = XInternAtom(disp, "_NET_WM_STATE_ABOVE", False);
726 m_net_wm_state_below = XInternAtom(disp, "_NET_WM_STATE_BELOW", False); 777 m_net_wm_state_below = XInternAtom(disp, "_NET_WM_STATE_BELOW", False);
727 778
779 // allowed actions
780 m_net_wm_allowed_actions = XInternAtom(disp, "_NET_WM_ALLOWED_ACTIONS", False);
781 m_net_wm_action_move = XInternAtom(disp, "_NET_WM_ACTIONS_MOVE", False);
782 m_net_wm_action_resize = XInternAtom(disp, "_NET_WM_ACTIONS_RESIZE", False);
783 m_net_wm_action_minimize = XInternAtom(disp, "_NET_WM_ACTIONS_MINIMIZE", False);
784 m_net_wm_action_shade = XInternAtom(disp, "_NET_WM_ACTIONS_SHADE", False);
785 m_net_wm_action_stick = XInternAtom(disp, "_NET_WM_ACTIONS_STICK", False);
786 m_net_wm_action_maximize_horz = XInternAtom(disp, "_NET_WM_ACTIONS_MAXIMIZE_HORZ", False);
787 m_net_wm_action_maximize_vert = XInternAtom(disp, "_NET_WM_ACTIONS_MAXIMIZE_VERT", False);
788 m_net_wm_action_fullscreen = XInternAtom(disp, "_NET_WM_ACTIONS_FULLSCREEN", False);
789 m_net_wm_action_change_desktop = XInternAtom(disp, "_NET_WM_ACTIONS_CHANGE_DESKTOP", False);
790 m_net_wm_action_close = XInternAtom(disp, "_NET_WM_ACTIONS_CLOSE", False);
728 791
729 m_net_wm_strut = XInternAtom(disp, "_NET_WM_STRUT", False); 792 m_net_wm_strut = XInternAtom(disp, "_NET_WM_STRUT", False);
730 m_net_wm_icon_geometry = XInternAtom(disp, "_NET_WM_ICON_GEOMETRY", False); 793 m_net_wm_icon_geometry = XInternAtom(disp, "_NET_WM_ICON_GEOMETRY", False);
@@ -739,6 +802,12 @@ void Ewmh::createAtoms() {
739void Ewmh::setFullscreen(FluxboxWindow &win, bool value) { 802void Ewmh::setFullscreen(FluxboxWindow &win, bool value) {
740 // fullscreen implies maximised, above dock layer, 803 // fullscreen implies maximised, above dock layer,
741 // and no decorations (or decorations offscreen) 804 // and no decorations (or decorations offscreen)
805 //
806 // TODO: do we need the WindowState etc here anymore?
807 // FluxboxWindow::setFullscreen() remembering old values
808 // already and set them...
809 // only reason i can see is that the user manually
810 // moved the (fullscreened) window
742 WindowState *saved_state = getState(win); 811 WindowState *saved_state = getState(win);
743 if (value) { 812 if (value) {
744 // fullscreen on 813 // fullscreen on
@@ -746,25 +815,17 @@ void Ewmh::setFullscreen(FluxboxWindow &win, bool value) {
746 saved_state = new WindowState(win.x(), win.y(), win.width(), 815 saved_state = new WindowState(win.x(), win.y(), win.width(),
747 win.height(), win.layerNum(), win.decorationMask()); 816 win.height(), win.layerNum(), win.decorationMask());
748 saveState(win, saved_state); 817 saveState(win, saved_state);
749 818 win.setFullscreen(true);
750 // actually make it fullscreen
751
752 // clear decorations
753 win.setDecorationMask(0);
754
755 // be xinerama aware
756 BScreen &screen = win.screen();
757 int head = screen.getHead(win.fbWindow());
758 win.moveResize(screen.getHeadX(head), screen.getHeadY(head),
759 screen.getHeadWidth(head), screen.getHeadHeight(head));
760 win.moveToLayer(Fluxbox::instance()->getAboveDockLayer());
761 } 819 }
762 } else { // turn off fullscreen 820 } else { // turn off fullscreen
763 if (saved_state) { // no saved state, can't restore it 821 if (saved_state) { // no saved state, can't restore it
822 win.setFullscreen(false);
823 /*
764 win.setDecorationMask(saved_state->decor); 824 win.setDecorationMask(saved_state->decor);
765 win.moveResize(saved_state->x, saved_state->y, 825 win.moveResize(saved_state->x, saved_state->y,
766 saved_state->width, saved_state->height); 826 saved_state->width, saved_state->height);
767 win.moveToLayer(saved_state->layer); 827 win.moveToLayer(saved_state->layer);
828 */
768 clearState(win); 829 clearState(win);
769 saved_state = 0; 830 saved_state = 0;
770 } 831 }
@@ -791,11 +852,13 @@ void Ewmh::setState(FluxboxWindow &win, Atom state, bool value) {
791 (!value && win.isMaximized())) 852 (!value && win.isMaximized()))
792 win.maximizeVertical(); 853 win.maximizeVertical();
793 } else if (state == m_net_wm_state_fullscreen) { // fullscreen 854 } else if (state == m_net_wm_state_fullscreen) { // fullscreen
855 if ((value && !win.isFullscreen()) ||
856 (!value && win.isFullscreen()))
794 setFullscreen(win, value); 857 setFullscreen(win, value);
795 } else if (state == m_net_wm_state_hidden || 858 } else if (state == m_net_wm_state_hidden ||
796 state == m_net_wm_state_skip_taskbar) { 859 state == m_net_wm_state_skip_taskbar) {
797 win.setFocusHidden(value); 860 win.setFocusHidden(value);
798 win.setIconHidden(win.isFocusHidden()); 861 win.setIconHidden(value);
799 } else if (state == m_net_wm_state_below) { // bottom layer 862 } else if (state == m_net_wm_state_below) { // bottom layer
800 if (value) 863 if (value)
801 win.moveToLayer(Fluxbox::instance()->getBottomLayer()); 864 win.moveToLayer(Fluxbox::instance()->getBottomLayer());
diff --git a/src/Ewmh.hh b/src/Ewmh.hh
index b3f1593..ebd6350 100644
--- a/src/Ewmh.hh
+++ b/src/Ewmh.hh
@@ -36,7 +36,7 @@ public:
36 void initForScreen(BScreen &screen); 36 void initForScreen(BScreen &screen);
37 void setupFrame(FluxboxWindow &win); 37 void setupFrame(FluxboxWindow &win);
38 void setupClient(WinClient &winclient); 38 void setupClient(WinClient &winclient);
39 39
40 void updateFocusedWindow(BScreen &screen, Window win); 40 void updateFocusedWindow(BScreen &screen, Window win);
41 void updateClientList(BScreen &screen); 41 void updateClientList(BScreen &screen);
42 void updateWorkspaceNames(BScreen &screen); 42 void updateWorkspaceNames(BScreen &screen);
@@ -51,7 +51,7 @@ public:
51 void updateHints(FluxboxWindow &win); 51 void updateHints(FluxboxWindow &win);
52 void updateWorkspace(FluxboxWindow &win); 52 void updateWorkspace(FluxboxWindow &win);
53 53
54 bool checkClientMessage(const XClientMessageEvent &ce, 54 bool checkClientMessage(const XClientMessageEvent &ce,
55 BScreen * screen, WinClient * const winclient); 55 BScreen * screen, WinClient * const winclient);
56 56
57 bool propertyNotify(WinClient &winclient, Atom the_property); 57 bool propertyNotify(WinClient &winclient, Atom the_property);
@@ -63,9 +63,10 @@ public:
63 void setFullscreen(FluxboxWindow &win, bool value); 63 void setFullscreen(FluxboxWindow &win, bool value);
64 64
65private: 65private:
66 66
67 typedef struct WindowState { 67 typedef struct WindowState {
68 WindowState(int x, int y, unsigned int width, unsigned int height, int layer, unsigned int decor); 68 WindowState(int x, int y, unsigned int width, unsigned int height,
69 int layer, unsigned int decor);
69 int x, y, layer; 70 int x, y, layer;
70 unsigned int width, height, decor; 71 unsigned int width, height, decor;
71 } WindowState; 72 } WindowState;
@@ -88,7 +89,7 @@ private:
88 Atom m_net_close_window, m_net_wm_moveresize; 89 Atom m_net_close_window, m_net_wm_moveresize;
89 90
90 // application window properties 91 // application window properties
91 Atom m_net_properties, m_net_wm_name, m_net_wm_desktop, 92 Atom m_net_properties, m_net_wm_name, m_net_wm_desktop,
92 // types 93 // types
93 m_net_wm_window_type, 94 m_net_wm_window_type,
94 m_net_wm_window_type_dock, 95 m_net_wm_window_type_dock,
@@ -96,16 +97,28 @@ private:
96 97
97 // states 98 // states
98 m_net_wm_state, m_net_wm_state_sticky, m_net_wm_state_shaded, 99 m_net_wm_state, m_net_wm_state_sticky, m_net_wm_state_shaded,
99 m_net_wm_state_maximized_horz, m_net_wm_state_maximized_vert, 100 m_net_wm_state_maximized_horz, m_net_wm_state_maximized_vert,
100 m_net_wm_state_fullscreen, 101 m_net_wm_state_fullscreen,
101 m_net_wm_state_hidden, 102 m_net_wm_state_hidden,
102 m_net_wm_state_skip_taskbar, 103 m_net_wm_state_skip_taskbar,
103 m_net_wm_state_below, 104 m_net_wm_state_below,
104 m_net_wm_state_above, 105 m_net_wm_state_above,
105 106
107 // allowed actions
108 m_net_wm_allowed_actions,
109 m_net_wm_action_move,
110 m_net_wm_action_resize,
111 m_net_wm_action_minimize,
112 m_net_wm_action_shade,
113 m_net_wm_action_stick,
114 m_net_wm_action_maximize_horz, m_net_wm_action_maximize_vert,
115 m_net_wm_action_fullscreen,
116 m_net_wm_action_change_desktop,
117 m_net_wm_action_close,
118
106 m_net_wm_strut, m_net_wm_icon_geometry, m_net_wm_icon, m_net_wm_pid, 119 m_net_wm_strut, m_net_wm_icon_geometry, m_net_wm_icon, m_net_wm_pid,
107 m_net_wm_handled_icons; 120 m_net_wm_handled_icons;
108 121
109 // application protocols 122 // application protocols
110 Atom m_net_wm_ping; 123 Atom m_net_wm_ping;
111 124
diff --git a/src/Window.cc b/src/Window.cc
index 83f8771..f1cef6d 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -280,7 +280,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbWinFrameTheme &tm,
280 m_themelistener(*this), 280 m_themelistener(*this),
281 moving(false), resizing(false), shaded(false), 281 moving(false), resizing(false), shaded(false),
282 iconic(false), focused(false), 282 iconic(false), focused(false),
283 stuck(false), m_managed(false), 283 stuck(false), m_managed(false), fullscreen(false),
284 maximized(MAX_NONE), 284 maximized(MAX_NONE),
285 m_attaching_tab(0), 285 m_attaching_tab(0),
286 m_screen(client.screen()), 286 m_screen(client.screen()),
@@ -292,6 +292,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbWinFrameTheme &tm,
292 m_workspace_number(0), 292 m_workspace_number(0),
293 m_current_state(0), 293 m_current_state(0),
294 m_old_decoration(DECOR_NORMAL), 294 m_old_decoration(DECOR_NORMAL),
295 m_old_decoration_mask(0),
295 m_client(&client), 296 m_client(&client),
296 m_toggled_decos(false), 297 m_toggled_decos(false),
297 m_shaped(false), 298 m_shaped(false),
@@ -302,6 +303,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbWinFrameTheme &tm,
302 m_frame(tm, client.screen().imageControl(), 0, 0, 100, 100), 303 m_frame(tm, client.screen().imageControl(), 0, 0, 100, 100),
303 m_layeritem(m_frame.window(), layer), 304 m_layeritem(m_frame.window(), layer),
304 m_layernum(layer.getLayerNum()), 305 m_layernum(layer.getLayerNum()),
306 m_old_layernum(0),
305 m_parent(client.screen().rootWindow()), 307 m_parent(client.screen().rootWindow()),
306 m_resize_corner(RIGHTBOTTOM) { 308 m_resize_corner(RIGHTBOTTOM) {
307 309
@@ -603,6 +605,7 @@ void FluxboxWindow::init() {
603void FluxboxWindow::shape() { 605void FluxboxWindow::shape() {
604#ifdef SHAPE 606#ifdef SHAPE
605 if (m_shaped) { 607 if (m_shaped) {
608 if (isFullscreen())
606 XShapeCombineShape(display, 609 XShapeCombineShape(display,
607 frame().window().window(), ShapeBounding, 610 frame().window().window(), ShapeBounding,
608 0, frame().clientArea().y(), // xOff, yOff 611 0, frame().clientArea().y(), // xOff, yOff
@@ -1579,10 +1582,70 @@ void FluxboxWindow::withdraw(bool interrupt_moving) {
1579 hide(interrupt_moving); 1582 hide(interrupt_moving);
1580} 1583}
1581 1584
1585/** setFullscreen mode:
1586
1587 - maximize as big as the screen is, dont care about slit / toolbar
1588 - raise to toplayer
1589*/
1590void FluxboxWindow::setFullscreen(bool flag) {
1591
1592 const int head = screen().getHead(fbWindow());
1593 Fluxbox* fb = Fluxbox::instance();
1594
1595 if (flag && !isFullscreen()) {
1596
1597 if (isIconic())
1598 deiconify();
1599
1600 if (isShaded())
1601 shade();
1602
1603 frame().setUseShape(false);
1604
1605 m_old_decoration_mask = decorationMask();
1606 m_old_layernum =layerNum();
1607 m_old_pos_x = frame().x();
1608 m_old_pos_y = frame().y();
1609 m_old_width = frame().width();
1610 m_old_height = frame().height();
1611
1612 // clear decorations
1613 setDecorationMask(0);
1614
1615 // be xinerama aware
1616 moveResize(screen().getHeadX(head), screen().getHeadY(head),
1617 screen().getHeadWidth(head), screen().getHeadHeight(head));
1618 moveToLayer(Fluxbox::instance()->getAboveDockLayer());
1619
1620 fullscreen = true;
1621
1622 stateSig().notify();
1623
1624 } else if (!flag && isFullscreen()) {
1625
1626 fullscreen = false;
1627
1628 setDecorationMask(m_old_decoration_mask);
1629 frame().setUseShape(!m_shaped);
1630
1631 moveResize(m_old_pos_x, m_old_pos_y, m_old_width, m_old_height);
1632 moveToLayer(m_old_layernum);
1633
1634 m_old_decoration_mask = 0;
1635 m_old_layernum = Fluxbox::instance()->getNormalLayer();
1636
1637 stateSig().notify();
1638 }
1639}
1640
1582/** 1641/**
1583 Maximize window both horizontal and vertical 1642 Maximize window both horizontal and vertical
1584*/ 1643*/
1585void FluxboxWindow::maximize(int type) { 1644void FluxboxWindow::maximize(int type) {
1645
1646 if (isFullscreen())
1647 return;
1648
1586 if (isIconic()) 1649 if (isIconic())
1587 deiconify(); 1650 deiconify();
1588 1651
diff --git a/src/Window.hh b/src/Window.hh
index c20f8a9..aa6de85 100644
--- a/src/Window.hh
+++ b/src/Window.hh
@@ -71,12 +71,12 @@ public:
71 MwmHintsFunctions = (1l << 0), ///< use motif wm functions 71 MwmHintsFunctions = (1l << 0), ///< use motif wm functions
72 MwmHintsDecorations = (1l << 1) ///< use motif wm decorations 72 MwmHintsDecorations = (1l << 1) ///< use motif wm decorations
73 }; 73 };
74 74
75 /// Motif wm functions 75 /// Motif wm functions
76 enum MwmFunc{ 76 enum MwmFunc{
77 MwmFuncAll = (1l << 0), ///< all motif wm functions 77 MwmFuncAll = (1l << 0), ///< all motif wm functions
78 MwmFuncResize = (1l << 1), ///< resize 78 MwmFuncResize = (1l << 1), ///< resize
79 MwmFuncMove = (1l << 2), ///< move 79 MwmFuncMove = (1l << 2), ///< move
80 MwmFuncIconify = (1l << 3), ///< iconify 80 MwmFuncIconify = (1l << 3), ///< iconify
81 MwmFuncMaximize = (1l << 4), ///< maximize 81 MwmFuncMaximize = (1l << 4), ///< maximize
82 MwmFuncClose = (1l << 5) ///< close 82 MwmFuncClose = (1l << 5) ///< close
@@ -100,10 +100,10 @@ public:
100 ATTRIB_MAXVERT = 0x04, 100 ATTRIB_MAXVERT = 0x04,
101 ATTRIB_OMNIPRESENT = 0x08, 101 ATTRIB_OMNIPRESENT = 0x08,
102 ATTRIB_WORKSPACE = 0x10, 102 ATTRIB_WORKSPACE = 0x10,
103 ATTRIB_STACK = 0x20, 103 ATTRIB_STACK = 0x20,
104 ATTRIB_DECORATION = 0x40, 104 ATTRIB_DECORATION = 0x40,
105 ATTRIB_HIDDEN = 0x80, 105 ATTRIB_HIDDEN = 0x80,
106 }; 106 };
107 107
108 /** 108 /**
109 * Types of maximization 109 * Types of maximization
@@ -114,8 +114,8 @@ public:
114 MAX_VERT = 2, ///< maximize vertical 114 MAX_VERT = 2, ///< maximize vertical
115 MAX_FULL = 3 ///< maximize full 115 MAX_FULL = 3 ///< maximize full
116 }; 116 };
117 /** 117 /**
118 This enumeration represents individual decoration 118 This enumeration represents individual decoration
119 attributes, they can be OR-d together to get a mask. 119 attributes, they can be OR-d together to get a mask.
120 Useful for saving. 120 Useful for saving.
121 */ 121 */
@@ -165,7 +165,7 @@ public:
165 165
166 /// attach client to our client list and remove it from old window 166 /// attach client to our client list and remove it from old window
167 void attachClient(WinClient &client, int x=-1, int y=-1); 167 void attachClient(WinClient &client, int x=-1, int y=-1);
168 /// detach client (remove it from list) and create a new window for it 168 /// detach client (remove it from list) and create a new window for it
169 bool detachClient(WinClient &client); 169 bool detachClient(WinClient &client);
170 /// detach current working client if we have more than one 170 /// detach current working client if we have more than one
171 void detachCurrentClient(); 171 void detachCurrentClient();
@@ -199,6 +199,8 @@ public:
199 void kill(); 199 void kill();
200 /// set the window in withdrawn state 200 /// set the window in withdrawn state
201 void withdraw(bool interrupt_moving); 201 void withdraw(bool interrupt_moving);
202 /// set fullscreen
203 void setFullscreen(bool flag);
202 /// toggle maximize 204 /// toggle maximize
203 void maximize(int type = MAX_FULL); 205 void maximize(int type = MAX_FULL);
204 /// maximizes the window horizontal 206 /// maximizes the window horizontal
@@ -210,7 +212,7 @@ public:
210 /// toggles shade 212 /// toggles shade
211 void shade(); 213 void shade();
212 /// toggles sticky 214 /// toggles sticky
213 void stick(); 215 void stick();
214 void raise(); 216 void raise();
215 void lower(); 217 void lower();
216 void tempRaise(); 218 void tempRaise();
@@ -269,10 +271,13 @@ public:
269 void setDecorationMask(unsigned int mask); 271 void setDecorationMask(unsigned int mask);
270 272
271 /** 273 /**
272 @name accessors 274 @name accessors
273 */ 275 */
274 //@{ 276 //@{
275 // whether this window can be tabbed with other windows, 277
278 // @return NormalState | IconicState | WithdrawnState
279 unsigned int getWmState() const { return m_current_state; }
280 // whether this window can be tabbed with other windows,
276 // and others tabbed with it 281 // and others tabbed with it
277 inline void setTabable(bool tabable) { functions.tabable = tabable; } 282 inline void setTabable(bool tabable) { functions.tabable = tabable; }
278 inline bool isTabable() { return functions.tabable; } 283 inline bool isTabable() { return functions.tabable; }
@@ -280,12 +285,13 @@ public:
280 inline void setResizable(bool resizable) { functions.resize = resizable; } 285 inline void setResizable(bool resizable) { functions.resize = resizable; }
281 286
282 inline bool isFocusHidden() const { return (m_blackbox_attrib.flags & ATTRIB_HIDDEN); } 287 inline bool isFocusHidden() const { return (m_blackbox_attrib.flags & ATTRIB_HIDDEN); }
283 inline bool isIconHidden() const { return m_icon_hidden; } 288 inline bool isIconHidden() const { return m_icon_hidden; }
284 inline bool isManaged() const { return m_managed; } 289 inline bool isManaged() const { return m_managed; }
285 inline bool isFocused() const { return focused; } 290 inline bool isFocused() const { return focused; }
286 bool isVisible() const; 291 bool isVisible() const;
287 inline bool isIconic() const { return iconic; } 292 inline bool isIconic() const { return iconic; }
288 inline bool isShaded() const { return shaded; } 293 inline bool isShaded() const { return shaded; }
294 inline bool isFullscreen() const { return fullscreen; }
289 inline bool isMaximized() const { return maximized == MAX_FULL; } 295 inline bool isMaximized() const { return maximized == MAX_FULL; }
290 inline bool isIconifiable() const { return functions.iconify; } 296 inline bool isIconifiable() const { return functions.iconify; }
291 inline bool isMaximizable() const { return functions.maximize; } 297 inline bool isMaximizable() const { return functions.maximize; }
@@ -318,8 +324,8 @@ public:
318 const FbTk::Menu &menu() const { return *m_windowmenu.get(); } 324 const FbTk::Menu &menu() const { return *m_windowmenu.get(); }
319 325
320 326
321 // for extras to add menus. 327 // for extras to add menus.
322 // These menus will be marked internal, 328 // These menus will be marked internal,
323 // and deleted when the window dies (as opposed to Screen 329 // and deleted when the window dies (as opposed to Screen
324 void addExtraMenu(const char *label, FbTk::Menu *menu); 330 void addExtraMenu(const char *label, FbTk::Menu *menu);
325 void removeExtraMenu(FbTk::Menu *menu); 331 void removeExtraMenu(FbTk::Menu *menu);
@@ -341,7 +347,7 @@ public:
341 347
342 int layerNum() const { return m_layernum; } 348 int layerNum() const { return m_layernum; }
343 void setLayerNum(int layernum); 349 void setLayerNum(int layernum);
344 350
345 351
346 unsigned int titlebarHeight() const; 352 unsigned int titlebarHeight() const;
347 353
@@ -453,7 +459,7 @@ private:
453 459
454 // Window states 460 // Window states
455 bool moving, resizing, shaded, iconic, 461 bool moving, resizing, shaded, iconic,
456 focused, stuck, m_managed; 462 focused, stuck, m_managed, fullscreen;
457 463
458 int maximized; 464 int maximized;
459 465
@@ -474,9 +480,10 @@ private:
474 unsigned int m_last_resize_h, m_last_resize_w; // handles height/width for resize "window" 480 unsigned int m_last_resize_h, m_last_resize_w; // handles height/width for resize "window"
475 481
476 unsigned int m_workspace_number; 482 unsigned int m_workspace_number;
477 unsigned long m_current_state; 483 unsigned long m_current_state; // NormalState | IconicState | Withdrawn
478 484
479 Decoration m_old_decoration; 485 Decoration m_old_decoration;
486 unsigned int m_old_decoration_mask;
480 487
481 ClientList m_clientlist; 488 ClientList m_clientlist;
482 WinClient *m_client; ///< current client 489 WinClient *m_client; ///< current client
@@ -491,14 +498,14 @@ private:
491 maximize, close, menu, sticky, shade, tab, enabled; 498 maximize, close, menu, sticky, shade, tab, enabled;
492 } decorations; 499 } decorations;
493 500
494 bool m_toggled_decos; 501 bool m_toggled_decos;
495 502
496 struct _functions { 503 struct _functions {
497 bool resize, move, iconify, maximize, close, tabable; 504 bool resize, move, iconify, maximize, close, tabable;
498 } functions; 505 } functions;
499 506
500 bool m_shaped; ///< if the window is shaped with a mask 507 bool m_shaped; ///< if the window is shaped with a mask
501 bool m_icon_hidden; ///< if the window is in the iconbar 508 bool m_icon_hidden; ///< if the window is in the iconbar
502 int m_old_pos_x, m_old_pos_y; ///< old position so we can restore from maximized 509 int m_old_pos_x, m_old_pos_y; ///< old position so we can restore from maximized
503 unsigned int m_old_width, m_old_height; ///< old size so we can restore from maximized state 510 unsigned int m_old_width, m_old_height; ///< old size so we can restore from maximized state
504 int m_last_button_x, ///< last known x position of the mouse button 511 int m_last_button_x, ///< last known x position of the mouse button
@@ -507,6 +514,7 @@ private:
507 514
508 FbTk::XLayerItem m_layeritem; 515 FbTk::XLayerItem m_layeritem;
509 int m_layernum; 516 int m_layernum;
517 int m_old_layernum;
510 518
511 FbTk::FbWindow &m_parent; ///< window on which we draw move/resize rectangle (the "root window") 519 FbTk::FbWindow &m_parent; ///< window on which we draw move/resize rectangle (the "root window")
512 520