diff options
author | rathnor <rathnor> | 2003-05-07 16:21:26 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2003-05-07 16:21:26 (GMT) |
commit | d63bf127ad6391f3e8408ddfd0ba79c4841a1ecf (patch) | |
tree | 5888bcda58581a3c8f94bc4bac4197d585c0b459 | |
parent | de68c88ed8ff8c7a887495a74de004f9da7f56df (diff) | |
download | fluxbox_pavel-d63bf127ad6391f3e8408ddfd0ba79c4841a1ecf.zip fluxbox_pavel-d63bf127ad6391f3e8408ddfd0ba79c4841a1ecf.tar.bz2 |
transient fixes by making them WinClients
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/Screen.cc | 12 | ||||
-rw-r--r-- | src/WinClient.cc | 82 | ||||
-rw-r--r-- | src/WinClient.hh | 16 | ||||
-rw-r--r-- | src/Window.cc | 366 | ||||
-rw-r--r-- | src/Window.hh | 18 | ||||
-rw-r--r-- | src/Workspace.cc | 70 |
7 files changed, 251 insertions, 315 deletions
@@ -1,6 +1,8 @@ | |||
1 | (Format: Year/Month/Day) | 1 | (Format: Year/Month/Day) |
2 | Changes for 0.9.2: | 2 | Changes for 0.9.2: |
3 | *03/05/07: | 3 | *03/05/07: |
4 | * Fixed transient grouping issues (transients now WinClients) (Simon) | ||
5 | WinClient.hh/cc Window.hh/cc Workspace.cc Screen.cc | ||
4 | * Fixed screen problem with redrawing menus (Henrik) | 6 | * Fixed screen problem with redrawing menus (Henrik) |
5 | The m_screen_num wasn't set in X Window assignment operator | 7 | The m_screen_num wasn't set in X Window assignment operator |
6 | FbTk/FbWindow.cc | 8 | FbTk/FbWindow.cc |
diff --git a/src/Screen.cc b/src/Screen.cc index 4c5f85e..93d1ddd 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.146 2003/05/07 13:50:41 rathnor Exp $ | 25 | // $Id: Screen.cc,v 1.147 2003/05/07 16:21:25 rathnor Exp $ |
26 | 26 | ||
27 | 27 | ||
28 | #include "Screen.hh" | 28 | #include "Screen.hh" |
@@ -973,8 +973,14 @@ void BScreen::removeClient(WinClient &client) { | |||
973 | focused_list.remove(&client); | 973 | focused_list.remove(&client); |
974 | if (cyc == &client) { | 974 | if (cyc == &client) { |
975 | cycling_window = focused_list.end(); | 975 | cycling_window = focused_list.end(); |
976 | } else if (focused && &focused->winClient() == &client) | 976 | } else if (focused && &focused->winClient() == &client) { |
977 | Fluxbox::instance()->revertFocus(&focused->getScreen()); | 977 | // if we are focused, then give our focus to our transient parent |
978 | // or revert normally | ||
979 | if (client.transientFor() && client.transientFor()->fbwindow()) | ||
980 | client.transientFor()->fbwindow()->setInputFocus(); | ||
981 | else | ||
982 | Fluxbox::instance()->revertFocus(&focused->getScreen()); | ||
983 | } | ||
978 | } | 984 | } |
979 | 985 | ||
980 | FluxboxWindow *BScreen::getIcon(unsigned int index) { | 986 | FluxboxWindow *BScreen::getIcon(unsigned int index) { |
diff --git a/src/WinClient.cc b/src/WinClient.cc index ac84c91..1b468d1 100644 --- a/src/WinClient.cc +++ b/src/WinClient.cc | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: WinClient.cc,v 1.6 2003/05/04 23:38:06 rathnor Exp $ | 22 | // $Id: WinClient.cc,v 1.7 2003/05/07 16:21:26 rathnor Exp $ |
23 | 23 | ||
24 | #include "WinClient.hh" | 24 | #include "WinClient.hh" |
25 | 25 | ||
@@ -54,6 +54,7 @@ WinClient::WinClient(Window win, FluxboxWindow &fbwin):FbTk::FbWindow(win), | |||
54 | mwm_hint(0), | 54 | mwm_hint(0), |
55 | blackbox_hint(0), | 55 | blackbox_hint(0), |
56 | m_win(&fbwin), | 56 | m_win(&fbwin), |
57 | modal(false), | ||
57 | m_title(""), m_icon_title(""), | 58 | m_title(""), m_icon_title(""), |
58 | m_diesig(*this) { } | 59 | m_diesig(*this) { } |
59 | 60 | ||
@@ -62,42 +63,22 @@ WinClient::~WinClient() { | |||
62 | cerr<<__FILE__<<"(~"<<__FUNCTION__<<")[this="<<this<<"]"<<endl; | 63 | cerr<<__FILE__<<"(~"<<__FUNCTION__<<")[this="<<this<<"]"<<endl; |
63 | #endif // DEBUG | 64 | #endif // DEBUG |
64 | 65 | ||
66 | // this takes care of any focus issues | ||
65 | m_diesig.notify(); | 67 | m_diesig.notify(); |
66 | 68 | ||
67 | Fluxbox *fluxbox = Fluxbox::instance(); | 69 | Fluxbox *fluxbox = Fluxbox::instance(); |
68 | 70 | ||
69 | if (transient_for != 0) { | 71 | if (transient_for != 0) { |
70 | if (transientFor() == m_win) { | 72 | assert(transient_for != this); |
71 | transient_for = 0; | 73 | transient_for->transientList().remove(this); |
72 | } | 74 | transient_for = 0; |
73 | |||
74 | if (transient_for != 0) { | ||
75 | FluxboxWindow::ClientList::iterator client_it = | ||
76 | transientFor()->clientList().begin(); | ||
77 | FluxboxWindow::ClientList::iterator client_it_end = | ||
78 | transientFor()->clientList().end(); | ||
79 | for (; client_it != client_it_end; ++client_it) { | ||
80 | (*client_it)->transientList().remove(m_win); | ||
81 | } | ||
82 | |||
83 | transient_for->setInputFocus(); | ||
84 | transient_for = 0; | ||
85 | } | ||
86 | } | 75 | } |
87 | |||
88 | while (!transients.empty()) { | ||
89 | FluxboxWindow::ClientList::iterator it = | ||
90 | transients.back()->clientList().begin(); | ||
91 | FluxboxWindow::ClientList::iterator it_end = | ||
92 | transients.back()->clientList().end(); | ||
93 | for (; it != it_end; ++it) { | ||
94 | if ((*it)->transientFor() == m_win) | ||
95 | (*it)->transient_for = 0; | ||
96 | } | ||
97 | 76 | ||
77 | while (!transients.empty()) { | ||
78 | transients.back()->transient_for = 0; | ||
98 | transients.pop_back(); | 79 | transients.pop_back(); |
99 | } | 80 | } |
100 | 81 | ||
101 | if (window_group != 0) { | 82 | if (window_group != 0) { |
102 | fluxbox->removeGroupSearch(window_group); | 83 | fluxbox->removeGroupSearch(window_group); |
103 | window_group = 0; | 84 | window_group = 0; |
@@ -199,17 +180,7 @@ void WinClient::updateTransientInfo() { | |||
199 | return; | 180 | return; |
200 | // remove us from parent | 181 | // remove us from parent |
201 | if (transientFor() != 0) { | 182 | if (transientFor() != 0) { |
202 | //!! TODO | 183 | transientFor()->transientList().remove(this); |
203 | // since we don't know which client in transientFor() | ||
204 | // that we're transient for then we just remove us | ||
205 | // from every client in transientFor() clientlist | ||
206 | FluxboxWindow::ClientList::iterator client_it = | ||
207 | transientFor()->clientList().begin(); | ||
208 | FluxboxWindow::ClientList::iterator client_it_end = | ||
209 | transientFor()->clientList().end(); | ||
210 | for (; client_it != client_it_end; ++client_it) { | ||
211 | (*client_it)->transientList().remove(m_win); | ||
212 | } | ||
213 | } | 184 | } |
214 | 185 | ||
215 | transient_for = 0; | 186 | transient_for = 0; |
@@ -223,21 +194,19 @@ void WinClient::updateTransientInfo() { | |||
223 | if (win == window()) | 194 | if (win == window()) |
224 | return; | 195 | return; |
225 | 196 | ||
226 | if (win != 0 && m_win->getScreen().getRootWindow() == win) { | 197 | if (win != None && m_win->getScreen().getRootWindow() == win) { |
227 | m_win->modal = true; | 198 | modal = true; |
228 | return; | 199 | return; // transient for root window... |
229 | } | 200 | } |
230 | 201 | ||
231 | transient_for = Fluxbox::instance()->searchWindow(win); | 202 | FluxboxWindow *transient_win = Fluxbox::instance()->searchWindow(win); |
232 | if (transient_for != 0 && | 203 | if (transient_win) |
233 | window_group != None && win == window_group) { | 204 | transient_for = transient_win->findClient(win); |
234 | transient_for = Fluxbox::instance()->searchGroup(win, m_win); | 205 | |
235 | } | ||
236 | |||
237 | // make sure we don't have deadlock loop in transient chain | 206 | // make sure we don't have deadlock loop in transient chain |
238 | for (FluxboxWindow *w = m_win; w != 0; w = w->m_client->transient_for) { | 207 | for (WinClient *w = this; w != 0; w = w->transient_for) { |
239 | if (w == w->m_client->transient_for) { | 208 | if (w == w->transient_for) { |
240 | w->m_client->transient_for = 0; | 209 | w->transient_for = 0; |
241 | break; | 210 | break; |
242 | } | 211 | } |
243 | } | 212 | } |
@@ -245,13 +214,10 @@ void WinClient::updateTransientInfo() { | |||
245 | if (transientFor() != 0) { | 214 | if (transientFor() != 0) { |
246 | // we need to add ourself to the right client in | 215 | // we need to add ourself to the right client in |
247 | // the transientFor() window so we search client | 216 | // the transientFor() window so we search client |
248 | WinClient *client = transientFor()->findClient(win); | 217 | transient_for->transientList().push_back(this); |
249 | assert(client != 0); | 218 | |
250 | client->transientList().push_back(m_win); | 219 | if (transientFor()->fbwindow() && transientFor()->fbwindow()->isStuck()) |
251 | // make sure we only have on instance of this | 220 | m_win->stick(); |
252 | client->transientList().unique(); | ||
253 | if (transientFor()->isStuck()) | ||
254 | m_win->stick(); | ||
255 | } | 221 | } |
256 | } | 222 | } |
257 | 223 | ||
diff --git a/src/WinClient.hh b/src/WinClient.hh index 6cd14dd..466f456 100644 --- a/src/WinClient.hh +++ b/src/WinClient.hh | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: WinClient.hh,v 1.2 2003/04/14 12:08:21 fluxgen Exp $ | 22 | // $Id: WinClient.hh,v 1.3 2003/05/07 16:21:26 rathnor Exp $ |
23 | 23 | ||
24 | #ifndef WINCLIENT_HH | 24 | #ifndef WINCLIENT_HH |
25 | #define WINCLIENT_HH | 25 | #define WINCLIENT_HH |
@@ -36,7 +36,7 @@ class FluxboxWindow; | |||
36 | /// Holds client window info | 36 | /// Holds client window info |
37 | class WinClient:public FbTk::FbWindow { | 37 | class WinClient:public FbTk::FbWindow { |
38 | public: | 38 | public: |
39 | typedef std::list<FluxboxWindow *> TransientList; | 39 | typedef std::list<WinClient *> TransientList; |
40 | 40 | ||
41 | WinClient(Window win, FluxboxWindow &fbwin); | 41 | WinClient(Window win, FluxboxWindow &fbwin); |
42 | 42 | ||
@@ -56,10 +56,13 @@ public: | |||
56 | 56 | ||
57 | /// updates transient window information | 57 | /// updates transient window information |
58 | void updateTransientInfo(); | 58 | void updateTransientInfo(); |
59 | FluxboxWindow *transientFor() { return transient_for; } | 59 | WinClient *transientFor() { return transient_for; } |
60 | const FluxboxWindow *transientFor() const { return transient_for; } | 60 | const WinClient *transientFor() const { return transient_for; } |
61 | TransientList &transientList() { return transients; } | 61 | TransientList &transientList() { return transients; } |
62 | const TransientList &transientList() const { return transients; } | 62 | const TransientList &transientList() const { return transients; } |
63 | bool isTransient() const { return transient_for != 0; } | ||
64 | bool isModal() const { return modal; } | ||
65 | |||
63 | bool operator == (const FluxboxWindow &win) const { | 66 | bool operator == (const FluxboxWindow &win) const { |
64 | return (m_win == &win); | 67 | return (m_win == &win); |
65 | } | 68 | } |
@@ -73,8 +76,8 @@ public: | |||
73 | remove or move these to private | 76 | remove or move these to private |
74 | */ | 77 | */ |
75 | 78 | ||
76 | FluxboxWindow *transient_for; // which window are we a transient for? | 79 | WinClient *transient_for; // which window are we a transient for? |
77 | std::list<FluxboxWindow *> transients; // which windows are our transients? | 80 | std::list<WinClient *> transients; // which windows are our transients? |
78 | Window window_group; | 81 | Window window_group; |
79 | 82 | ||
80 | 83 | ||
@@ -105,6 +108,7 @@ public: | |||
105 | }; | 108 | }; |
106 | 109 | ||
107 | private: | 110 | private: |
111 | bool modal; | ||
108 | std::string m_title, m_icon_title; | 112 | std::string m_title, m_icon_title; |
109 | WinClientSubj m_diesig; | 113 | WinClientSubj m_diesig; |
110 | }; | 114 | }; |
diff --git a/src/Window.cc b/src/Window.cc index 1364254..dfcc7a9 100644 --- a/src/Window.cc +++ b/src/Window.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: Window.cc,v 1.159 2003/05/07 11:33:56 fluxgen Exp $ | 25 | // $Id: Window.cc,v 1.160 2003/05/07 16:21:26 rathnor Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -121,8 +121,20 @@ static Bool queueScanner(Display *, XEvent *e, char *args) { | |||
121 | return false; | 121 | return false; |
122 | } | 122 | } |
123 | 123 | ||
124 | /// raise window and do the same for each transient it holds | 124 | /// returns the deepest transientFor, asserting against a close loop |
125 | WinClient *getRootTransientFor(WinClient *client) { | ||
126 | while (client->transientFor()) { | ||
127 | assert(client != client->transientFor()); | ||
128 | client = client->transientFor(); | ||
129 | } | ||
130 | return client; | ||
131 | } | ||
132 | |||
133 | |||
134 | /// raise window and do the same for each transient of the current window | ||
125 | void raiseFluxboxWindow(FluxboxWindow &win) { | 135 | void raiseFluxboxWindow(FluxboxWindow &win) { |
136 | if (win.oplock) return; | ||
137 | win.oplock = true; | ||
126 | 138 | ||
127 | if (!win.isIconic()) { | 139 | if (!win.isIconic()) { |
128 | win.getScreen().updateNetizenWindowRaise(win.getClientWindow()); | 140 | win.getScreen().updateNetizenWindowRaise(win.getClientWindow()); |
@@ -130,33 +142,40 @@ void raiseFluxboxWindow(FluxboxWindow &win) { | |||
130 | } | 142 | } |
131 | 143 | ||
132 | // for each transient do raise | 144 | // for each transient do raise |
133 | std::list<FluxboxWindow *>::const_iterator it = win.getTransients().begin(); | 145 | WinClient::TransientList::const_iterator it = win.winClient().transientList().begin(); |
134 | std::list<FluxboxWindow *>::const_iterator it_end = win.getTransients().end(); | 146 | WinClient::TransientList::const_iterator it_end = win.winClient().transientList().end(); |
135 | for (; it != it_end; ++it) { | 147 | for (; it != it_end; ++it) { |
136 | if (!(*it)->isIconic()) | 148 | if ((*it)->fbwindow() && !(*it)->fbwindow()->isIconic()) |
137 | raiseFluxboxWindow(*(*it)); | 149 | // TODO: should we also check if it is the active client? |
150 | raiseFluxboxWindow(*(*it)->fbwindow()); | ||
138 | } | 151 | } |
152 | win.oplock = false; | ||
139 | } | 153 | } |
140 | 154 | ||
141 | /// lower window and do the same for each transient it holds | 155 | /// lower window and do the same for each transient it holds |
142 | void lowerFluxboxWindow(FluxboxWindow &win) { | 156 | void lowerFluxboxWindow(FluxboxWindow &win) { |
157 | if (win.oplock) return; | ||
158 | win.oplock = true; | ||
143 | 159 | ||
144 | if (!win.isIconic()) { | 160 | if (!win.isIconic()) { |
145 | win.getScreen().updateNetizenWindowLower(win.getClientWindow()); | 161 | win.getScreen().updateNetizenWindowLower(win.getClientWindow()); |
146 | win.getLayerItem().lower(); | 162 | win.getLayerItem().lower(); |
147 | } | 163 | } |
148 | 164 | ||
149 | // for each transient do lower | 165 | WinClient::TransientList::const_iterator it = win.winClient().transientList().begin(); |
150 | std::list<FluxboxWindow *>::const_iterator it = win.getTransients().begin(); | 166 | WinClient::TransientList::const_iterator it_end = win.winClient().transientList().end(); |
151 | std::list<FluxboxWindow *>::const_iterator it_end = win.getTransients().end(); | ||
152 | for (; it != it_end; ++it) { | 167 | for (; it != it_end; ++it) { |
153 | if (!(*it)->isIconic()) | 168 | if ((*it)->fbwindow() && !(*it)->fbwindow()->isIconic()) |
154 | lowerFluxboxWindow(*(*it)); | 169 | // TODO: should we also check if it is the active client? |
170 | lowerFluxboxWindow(*(*it)->fbwindow()); | ||
155 | } | 171 | } |
172 | win.oplock = false; | ||
156 | } | 173 | } |
157 | 174 | ||
158 | /// raise window and do the same for each transient it holds | 175 | /// raise window and do the same for each transient it holds |
159 | void tempRaiseFluxboxWindow(FluxboxWindow &win) { | 176 | void tempRaiseFluxboxWindow(FluxboxWindow &win) { |
177 | if (win.oplock) return; | ||
178 | win.oplock = true; | ||
160 | 179 | ||
161 | if (!win.isIconic()) { | 180 | if (!win.isIconic()) { |
162 | // don't update netizen, as it is only temporary | 181 | // don't update netizen, as it is only temporary |
@@ -164,12 +183,14 @@ void tempRaiseFluxboxWindow(FluxboxWindow &win) { | |||
164 | } | 183 | } |
165 | 184 | ||
166 | // for each transient do raise | 185 | // for each transient do raise |
167 | std::list<FluxboxWindow *>::const_iterator it = win.getTransients().begin(); | 186 | WinClient::TransientList::const_iterator it = win.winClient().transientList().begin(); |
168 | std::list<FluxboxWindow *>::const_iterator it_end = win.getTransients().end(); | 187 | WinClient::TransientList::const_iterator it_end = win.winClient().transientList().end(); |
169 | for (; it != it_end; ++it) { | 188 | for (; it != it_end; ++it) { |
170 | if (!(*it)->isIconic()) | 189 | if ((*it)->fbwindow() && !(*it)->fbwindow()->isIconic()) |
171 | tempRaiseFluxboxWindow(*(*it)); | 190 | // TODO: should we also check if it is the active client? |
191 | tempRaiseFluxboxWindow(*(*it)->fbwindow()); | ||
172 | } | 192 | } |
193 | win.oplock = false; | ||
173 | } | 194 | } |
174 | 195 | ||
175 | class SetClientCmd:public FbTk::Command { | 196 | class SetClientCmd:public FbTk::Command { |
@@ -195,14 +216,15 @@ void LayerMenuItem<FluxboxWindow>::click(int button, int time) { | |||
195 | FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &tm, | 216 | FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &tm, |
196 | FbTk::MenuTheme &menutheme, | 217 | FbTk::MenuTheme &menutheme, |
197 | FbTk::XLayer &layer): | 218 | FbTk::XLayer &layer): |
219 | oplock(false), | ||
198 | m_hintsig(*this), | 220 | m_hintsig(*this), |
199 | m_statesig(*this), | 221 | m_statesig(*this), |
200 | m_layersig(*this), | 222 | m_layersig(*this), |
201 | m_workspacesig(*this), | 223 | m_workspacesig(*this), |
202 | m_diesig(*this), | 224 | m_diesig(*this), |
203 | moving(false), resizing(false), shaded(false), maximized(false), | 225 | moving(false), resizing(false), shaded(false), maximized(false), |
204 | iconic(false), transient(false), focused(false), | 226 | iconic(false), focused(false), |
205 | stuck(false), modal(false), send_focus_message(false), m_managed(false), | 227 | stuck(false), send_focus_message(false), m_managed(false), |
206 | screen(scr), | 228 | screen(scr), |
207 | timer(this), | 229 | timer(this), |
208 | display(0), | 230 | display(0), |
@@ -227,14 +249,15 @@ FluxboxWindow::FluxboxWindow(WinClient &client, BScreen &scr, FbWinFrameTheme &t | |||
227 | FluxboxWindow::FluxboxWindow(Window w, BScreen &scr, FbWinFrameTheme &tm, | 249 | FluxboxWindow::FluxboxWindow(Window w, BScreen &scr, FbWinFrameTheme &tm, |
228 | FbTk::MenuTheme &menutheme, | 250 | FbTk::MenuTheme &menutheme, |
229 | FbTk::XLayer &layer): | 251 | FbTk::XLayer &layer): |
252 | oplock(false), | ||
230 | m_hintsig(*this), | 253 | m_hintsig(*this), |
231 | m_statesig(*this), | 254 | m_statesig(*this), |
232 | m_layersig(*this), | 255 | m_layersig(*this), |
233 | m_workspacesig(*this), | 256 | m_workspacesig(*this), |
234 | m_diesig(*this), | 257 | m_diesig(*this), |
235 | moving(false), resizing(false), shaded(false), maximized(false), | 258 | moving(false), resizing(false), shaded(false), maximized(false), |
236 | iconic(false), transient(false), focused(false), | 259 | iconic(false), focused(false), |
237 | stuck(false), modal(false), send_focus_message(false), m_managed(false), | 260 | stuck(false), send_focus_message(false), m_managed(false), |
238 | screen(scr), | 261 | screen(scr), |
239 | timer(this), | 262 | timer(this), |
240 | display(0), | 263 | display(0), |
@@ -399,10 +422,10 @@ void FluxboxWindow::init() { | |||
399 | m_managed = true; //this window is managed | 422 | m_managed = true; //this window is managed |
400 | 423 | ||
401 | // update transient infomation | 424 | // update transient infomation |
402 | updateTransientInfo(); | 425 | m_client->updateTransientInfo(); |
403 | 426 | ||
404 | // adjust the window decorations based on transience and window sizes | 427 | // adjust the window decorations based on transience and window sizes |
405 | if (transient) { | 428 | if (m_client->isTransient()) { |
406 | decorations.maximize = functions.maximize = false; | 429 | decorations.maximize = functions.maximize = false; |
407 | decorations.handle = decorations.border = false; | 430 | decorations.handle = decorations.border = false; |
408 | } | 431 | } |
@@ -419,7 +442,7 @@ void FluxboxWindow::init() { | |||
419 | upsize(); | 442 | upsize(); |
420 | 443 | ||
421 | bool place_window = true; | 444 | bool place_window = true; |
422 | if (fluxbox->isStartup() || transient || | 445 | if (fluxbox->isStartup() || m_client->isTransient() || |
423 | m_client->normal_hint_flags & (PPosition|USPosition)) { | 446 | m_client->normal_hint_flags & (PPosition|USPosition)) { |
424 | setGravityOffsets(); | 447 | setGravityOffsets(); |
425 | 448 | ||
@@ -454,8 +477,10 @@ void FluxboxWindow::init() { | |||
454 | m_frame.resizeForClient(wattrib.width, wattrib.height); | 477 | m_frame.resizeForClient(wattrib.width, wattrib.height); |
455 | 478 | ||
456 | // if we're a transient then we should be on the same layer as our parent | 479 | // if we're a transient then we should be on the same layer as our parent |
457 | if (isTransient()) | 480 | if (m_client->isTransient() && |
458 | getLayerItem().setLayer(getTransientFor()->getLayerItem().getLayer()); | 481 | m_client->transientFor()->fbwindow() && |
482 | m_client->transientFor()->fbwindow() != this) | ||
483 | getLayerItem().setLayer(m_client->transientFor()->fbwindow()->getLayerItem().getLayer()); | ||
459 | else // if no parent then set default layer | 484 | else // if no parent then set default layer |
460 | moveToLayer(m_layernum); | 485 | moveToLayer(m_layernum); |
461 | 486 | ||
@@ -535,14 +560,6 @@ void FluxboxWindow::attachClient(WinClient &client) { | |||
535 | btn->setOnClick(set_client_cmd); | 560 | btn->setOnClick(set_client_cmd); |
536 | evm.add(*this, btn->window()); // we take care of button events for this | 561 | evm.add(*this, btn->window()); // we take care of button events for this |
537 | 562 | ||
538 | // update transients in client to have this as transient_for | ||
539 | WinClient::TransientList::iterator trans_it = | ||
540 | (*client_it)->transientList().begin(); | ||
541 | WinClient::TransientList::iterator trans_it_end = | ||
542 | (*client_it)->transientList().end(); | ||
543 | for (; trans_it != trans_it_end; ++trans_it) { | ||
544 | (*trans_it)->m_client->transient_for = this; | ||
545 | } | ||
546 | } | 563 | } |
547 | 564 | ||
548 | // add client and move over all attached clients | 565 | // add client and move over all attached clients |
@@ -571,14 +588,6 @@ void FluxboxWindow::attachClient(WinClient &client) { | |||
571 | evm.add(*this, btn->window()); // we take care of button events for this | 588 | evm.add(*this, btn->window()); // we take care of button events for this |
572 | 589 | ||
573 | client.m_win = this; | 590 | client.m_win = this; |
574 | // update transients in client to have this as transient_for | ||
575 | WinClient::TransientList::iterator trans_it = | ||
576 | client.transientList().begin(); | ||
577 | WinClient::TransientList::iterator trans_it_end = | ||
578 | client.transientList().end(); | ||
579 | for (; trans_it != trans_it_end; ++trans_it) { | ||
580 | (*trans_it)->m_client->transient_for = this; | ||
581 | } | ||
582 | 591 | ||
583 | Fluxbox::instance()->saveWindowSearch(client.window(), this); | 592 | Fluxbox::instance()->saveWindowSearch(client.window(), this); |
584 | } | 593 | } |
@@ -632,7 +641,7 @@ bool FluxboxWindow::removeClient(WinClient &client) { | |||
632 | client.m_win = 0; | 641 | client.m_win = 0; |
633 | m_clientlist.remove(&client); | 642 | m_clientlist.remove(&client); |
634 | 643 | ||
635 | if (m_client == &client && m_clientlist.size() == 0) | 644 | if (m_client == &client && m_clientlist.empty()) |
636 | m_client = 0; | 645 | m_client = 0; |
637 | 646 | ||
638 | FbTk::EventManager &evm = *FbTk::EventManager::instance(); | 647 | FbTk::EventManager &evm = *FbTk::EventManager::instance(); |
@@ -719,7 +728,7 @@ bool FluxboxWindow::setCurrentClient(WinClient &client, bool setinput) { | |||
719 | } | 728 | } |
720 | 729 | ||
721 | bool FluxboxWindow::isGroupable() const { | 730 | bool FluxboxWindow::isGroupable() const { |
722 | if (isResizable() && isMaximizable() && !isTransient()) | 731 | if (isResizable() && isMaximizable() && !winClient().isTransient()) |
723 | return true; | 732 | return true; |
724 | return false; | 733 | return false; |
725 | } | 734 | } |
@@ -1136,12 +1145,12 @@ bool FluxboxWindow::setInputFocus() { | |||
1136 | 1145 | ||
1137 | bool ret = false; | 1146 | bool ret = false; |
1138 | 1147 | ||
1139 | if (m_client->transients.size() && modal) { | 1148 | if (!m_client->transients.empty() && m_client->isModal()) { |
1140 | std::list<FluxboxWindow *>::iterator it = m_client->transients.begin(); | 1149 | WinClient::TransientList::iterator it = m_client->transients.begin(); |
1141 | std::list<FluxboxWindow *>::iterator it_end = m_client->transients.end(); | 1150 | WinClient::TransientList::iterator it_end = m_client->transients.end(); |
1142 | for (; it != it_end; ++it) { | 1151 | for (; it != it_end; ++it) { |
1143 | if ((*it)->modal) | 1152 | if ((*it)->isModal()) |
1144 | return (*it)->setInputFocus(); | 1153 | return (*it)->fbwindow()->setCurrentClient(**it,true); |
1145 | } | 1154 | } |
1146 | } else { | 1155 | } else { |
1147 | if (focus_mode == F_LOCALLYACTIVE || focus_mode == F_PASSIVE) { | 1156 | if (focus_mode == F_LOCALLYACTIVE || focus_mode == F_PASSIVE) { |
@@ -1184,7 +1193,6 @@ void FluxboxWindow::show() { | |||
1184 | Unmaps the window and removes it from workspace list | 1193 | Unmaps the window and removes it from workspace list |
1185 | */ | 1194 | */ |
1186 | void FluxboxWindow::iconify() { | 1195 | void FluxboxWindow::iconify() { |
1187 | |||
1188 | if (isIconic()) // no need to iconify if we're already | 1196 | if (isIconic()) // no need to iconify if we're already |
1189 | return; | 1197 | return; |
1190 | 1198 | ||
@@ -1202,22 +1210,28 @@ void FluxboxWindow::iconify() { | |||
1202 | client.setEventMask(NoEventMask); | 1210 | client.setEventMask(NoEventMask); |
1203 | client.hide(); | 1211 | client.hide(); |
1204 | client.setEventMask(PropertyChangeMask | StructureNotifyMask | FocusChangeMask); | 1212 | client.setEventMask(PropertyChangeMask | StructureNotifyMask | FocusChangeMask); |
1205 | if (client.transientFor()) { | 1213 | if (client.transientFor() && |
1206 | if (! client.transientFor()->isIconic()) { | 1214 | client.transientFor()->fbwindow()) { |
1207 | client.transientFor()->iconify(); | 1215 | if (!client.transientFor()->fbwindow()->isIconic()) { |
1208 | } | 1216 | client.transientFor()->fbwindow()->iconify(); |
1217 | } | ||
1209 | } | 1218 | } |
1210 | 1219 | ||
1211 | if (client.transientList().size()) { | 1220 | if (!client.transientList().empty()) { |
1212 | for_each(client.transientList().begin(), | 1221 | WinClient::TransientList::iterator it = client.transientList().begin(); |
1213 | client.transientList().end(), | 1222 | WinClient::TransientList::iterator it_end = client.transientList().end(); |
1214 | mem_fun(&FluxboxWindow::iconify)); | 1223 | for (; it != it_end; it++) |
1224 | if ((*it)->fbwindow()) | ||
1225 | (*it)->fbwindow()->iconify(); | ||
1215 | } | 1226 | } |
1216 | } | 1227 | } |
1217 | 1228 | ||
1218 | } | 1229 | } |
1219 | 1230 | ||
1220 | void FluxboxWindow::deiconify(bool reassoc, bool do_raise) { | 1231 | void FluxboxWindow::deiconify(bool reassoc, bool do_raise) { |
1232 | if (oplock) return; | ||
1233 | oplock = true; | ||
1234 | |||
1221 | if (iconic || reassoc) { | 1235 | if (iconic || reassoc) { |
1222 | screen.reassociateWindow(this, screen.getCurrentWorkspace()->workspaceID(), false); | 1236 | screen.reassociateWindow(this, screen.getCurrentWorkspace()->workspaceID(), false); |
1223 | } else if (moving || workspace_number != screen.getCurrentWorkspace()->workspaceID()) | 1237 | } else if (moving || workspace_number != screen.getCurrentWorkspace()->workspaceID()) |
@@ -1245,22 +1259,22 @@ void FluxboxWindow::deiconify(bool reassoc, bool do_raise) { | |||
1245 | m_frame.setFocus(focused); | 1259 | m_frame.setFocus(focused); |
1246 | 1260 | ||
1247 | 1261 | ||
1248 | if (reassoc && m_client->transients.size()) { | 1262 | if (reassoc && !m_client->transients.empty()) { |
1249 | // deiconify all transients | 1263 | // deiconify all transients |
1250 | client_it = clientList().begin(); | 1264 | client_it = clientList().begin(); |
1251 | for (; client_it != client_it_end; ++client_it) { | 1265 | for (; client_it != client_it_end; ++client_it) { |
1252 | 1266 | //TODO: Can this get stuck in a loop? | |
1253 | std::list<FluxboxWindow *>::iterator trans_it = | 1267 | WinClient::TransientList::iterator trans_it = |
1254 | (*client_it)->transientList().begin(); | 1268 | (*client_it)->transientList().begin(); |
1255 | std::list<FluxboxWindow *>::iterator trans_it_end = | 1269 | WinClient::TransientList::iterator trans_it_end = |
1256 | (*client_it)->transientList().end(); | 1270 | (*client_it)->transientList().end(); |
1257 | for (; trans_it != trans_it_end; ++trans_it) { | 1271 | for (; trans_it != trans_it_end; ++trans_it) { |
1258 | (*trans_it)->deiconify(true, false); | 1272 | if ((*trans_it)->fbwindow()) |
1259 | } | 1273 | (*trans_it)->fbwindow()->deiconify(true, false); |
1274 | } | ||
1260 | } | 1275 | } |
1261 | |||
1262 | } | 1276 | } |
1263 | 1277 | oplock = false; | |
1264 | if (do_raise) | 1278 | if (do_raise) |
1265 | raise(); | 1279 | raise(); |
1266 | } | 1280 | } |
@@ -1412,34 +1426,30 @@ void FluxboxWindow::raise() { | |||
1412 | deiconify(); | 1426 | deiconify(); |
1413 | 1427 | ||
1414 | // get root window | 1428 | // get root window |
1415 | FluxboxWindow *win = this; | 1429 | WinClient *client = getRootTransientFor(m_client); |
1416 | while (win->getTransientFor()) { | 1430 | |
1417 | win = win->getTransientFor(); | ||
1418 | assert(win != win->getTransientFor()); | ||
1419 | } | ||
1420 | // if we don't have any root window use this as root | 1431 | // if we don't have any root window use this as root |
1421 | if (win == 0) | 1432 | if (client == 0) |
1422 | win = this; | 1433 | client = m_client; |
1423 | 1434 | ||
1424 | // raise this window and every transient in it | 1435 | // raise this window and every transient in it |
1425 | raiseFluxboxWindow(*win); | 1436 | if (client->fbwindow()) |
1437 | raiseFluxboxWindow(*client->fbwindow()); | ||
1426 | } | 1438 | } |
1427 | 1439 | ||
1428 | void FluxboxWindow::lower() { | 1440 | void FluxboxWindow::lower() { |
1429 | if (isIconic()) | 1441 | if (isIconic()) |
1430 | deiconify(); | 1442 | deiconify(); |
1431 | 1443 | ||
1432 | // get root window (i.e the bottom window) | 1444 | // get root window |
1433 | FluxboxWindow *bottom = this; | 1445 | WinClient *client = getRootTransientFor(m_client); |
1434 | while (bottom->getTransientFor()) { | ||
1435 | bottom = bottom->getTransientFor(); | ||
1436 | assert(bottom != bottom->getTransientFor()); | ||
1437 | } | ||
1438 | 1446 | ||
1439 | if (bottom == 0) | 1447 | // if we don't have any root window use this as root |
1440 | bottom = this; | 1448 | if (client == 0) |
1449 | client = m_client; | ||
1441 | 1450 | ||
1442 | lowerFluxboxWindow(*bottom); | 1451 | if (client->fbwindow()) |
1452 | lowerFluxboxWindow(*client->fbwindow()); | ||
1443 | } | 1453 | } |
1444 | 1454 | ||
1445 | void FluxboxWindow::tempRaise() { | 1455 | void FluxboxWindow::tempRaise() { |
@@ -1447,17 +1457,14 @@ void FluxboxWindow::tempRaise() { | |||
1447 | deiconify(); | 1457 | deiconify(); |
1448 | 1458 | ||
1449 | // get root window | 1459 | // get root window |
1450 | FluxboxWindow *win = this; | 1460 | WinClient *client = getRootTransientFor(m_client); |
1451 | while (win->getTransientFor()) { | 1461 | |
1452 | win = win->getTransientFor(); | ||
1453 | assert(win != win->getTransientFor()); | ||
1454 | } | ||
1455 | // if we don't have any root window use this as root | 1462 | // if we don't have any root window use this as root |
1456 | if (win == 0) | 1463 | if (client == 0) |
1457 | win = this; | 1464 | client = m_client; |
1458 | 1465 | ||
1459 | // raise this window and every transient in it | 1466 | if (client->fbwindow()) |
1460 | tempRaiseFluxboxWindow(*win); | 1467 | tempRaiseFluxboxWindow(*client->fbwindow()); |
1461 | } | 1468 | } |
1462 | 1469 | ||
1463 | 1470 | ||
@@ -1466,84 +1473,103 @@ void FluxboxWindow::raiseLayer() { | |||
1466 | if (getLayerNum() == (Fluxbox::instance()->getMenuLayer()+1)) | 1473 | if (getLayerNum() == (Fluxbox::instance()->getMenuLayer()+1)) |
1467 | return; | 1474 | return; |
1468 | 1475 | ||
1469 | FluxboxWindow *win = this; | 1476 | // get root window |
1470 | 1477 | WinClient *client = getRootTransientFor(m_client); | |
1471 | while (win->getTransientFor()) { | 1478 | |
1472 | win = win->getTransientFor(); | 1479 | // if we don't have any root window use this as root |
1473 | assert(win != win->getTransientFor()); | 1480 | if (client == 0) |
1474 | } | 1481 | client = m_client; |
1475 | 1482 | ||
1476 | if (!win->isIconic()) { | 1483 | FluxboxWindow *win = client->fbwindow(); |
1477 | screen.updateNetizenWindowRaise(win->getClientWindow()); | 1484 | if (!win) return; |
1478 | win->getLayerItem().raiseLayer(); | 1485 | |
1479 | win->setLayerNum(win->getLayerItem().getLayerNum()); | 1486 | if (!win->isIconic()) |
1480 | } | 1487 | screen.updateNetizenWindowRaise(client->window()); |
1488 | |||
1489 | win->getLayerItem().raiseLayer(); | ||
1490 | |||
1491 | // remember number just in case a transient happens to revisit this window | ||
1492 | int layer_num = win->getLayerItem().getLayerNum(); | ||
1493 | win->setLayerNum(layer_num); | ||
1481 | 1494 | ||
1482 | std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin(); | 1495 | WinClient::TransientList::const_iterator it = client->transientList().begin(); |
1483 | std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end(); | 1496 | WinClient::TransientList::const_iterator it_end = client->transientList().end(); |
1484 | for (; it != it_end; ++it) { | 1497 | for (; it != it_end; ++it) { |
1485 | if (!(*it)->isIconic()) { | 1498 | win = (*it)->fbwindow(); |
1486 | screen.updateNetizenWindowRaise((*it)->getClientWindow()); | 1499 | if (win && !win->isIconic()) { |
1487 | (*it)->getLayerItem().raiseLayer(); | 1500 | screen.updateNetizenWindowRaise((*it)->window()); |
1488 | (*it)->setLayerNum((*it)->getLayerItem().getLayerNum()); | 1501 | win->getLayerItem().moveToLayer(layer_num); |
1502 | win->setLayerNum(layer_num); | ||
1489 | } | 1503 | } |
1490 | } | 1504 | } |
1491 | } | 1505 | } |
1492 | 1506 | ||
1493 | void FluxboxWindow::lowerLayer() { | 1507 | void FluxboxWindow::lowerLayer() { |
1494 | FluxboxWindow *win = (FluxboxWindow *) 0, *bottom = this; | 1508 | // get root window |
1495 | 1509 | WinClient *client = getRootTransientFor(m_client); | |
1496 | while (bottom->getTransientFor()) { | ||
1497 | bottom = bottom->getTransientFor(); | ||
1498 | assert(bottom != bottom->getTransientFor()); | ||
1499 | } | ||
1500 | |||
1501 | win = bottom; | ||
1502 | 1510 | ||
1511 | // if we don't have any root window use this as root | ||
1512 | if (client == 0) | ||
1513 | client = m_client; | ||
1514 | |||
1515 | FluxboxWindow *win = client->fbwindow(); | ||
1516 | if (!win) return; | ||
1517 | |||
1503 | if (!win->isIconic()) { | 1518 | if (!win->isIconic()) { |
1504 | screen.updateNetizenWindowLower(win->getClientWindow()); | 1519 | screen.updateNetizenWindowLower(client->window()); |
1505 | win->getLayerItem().lowerLayer(); | ||
1506 | win->setLayerNum(win->getLayerItem().getLayerNum()); | ||
1507 | } | 1520 | } |
1508 | std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin(); | 1521 | win->getLayerItem().lowerLayer(); |
1509 | std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end(); | 1522 | // remember number just in case a transient happens to revisit this window |
1523 | int layer_num = win->getLayerItem().getLayerNum(); | ||
1524 | win->setLayerNum(layer_num); | ||
1525 | |||
1526 | WinClient::TransientList::const_iterator it = client->transientList().begin(); | ||
1527 | WinClient::TransientList::const_iterator it_end = client->transientList().end(); | ||
1510 | for (; it != it_end; ++it) { | 1528 | for (; it != it_end; ++it) { |
1511 | if (!(*it)->isIconic()) { | 1529 | win = (*it)->fbwindow(); |
1512 | screen.updateNetizenWindowLower((*it)->getClientWindow()); | 1530 | if (win && !win->isIconic()) { |
1513 | (*it)->getLayerItem().lowerLayer(); | 1531 | screen.updateNetizenWindowLower((*it)->window()); |
1514 | (*it)->setLayerNum((*it)->getLayerItem().getLayerNum()); | 1532 | win->getLayerItem().moveToLayer(layer_num); |
1533 | win->setLayerNum(layer_num); | ||
1515 | } | 1534 | } |
1516 | } | 1535 | } |
1517 | |||
1518 | } | 1536 | } |
1519 | 1537 | ||
1538 | |||
1520 | void FluxboxWindow::moveToLayer(int layernum) { | 1539 | void FluxboxWindow::moveToLayer(int layernum) { |
1521 | Fluxbox * fluxbox = Fluxbox::instance(); | 1540 | Fluxbox * fluxbox = Fluxbox::instance(); |
1522 | 1541 | ||
1523 | FluxboxWindow *win = this; | ||
1524 | |||
1525 | // don't let it set its layer into menu area | 1542 | // don't let it set its layer into menu area |
1526 | if (layernum <= fluxbox->getMenuLayer()) { | 1543 | if (layernum <= fluxbox->getMenuLayer()) { |
1527 | layernum = fluxbox->getMenuLayer() + 1; | 1544 | layernum = fluxbox->getMenuLayer() + 1; |
1528 | } | 1545 | } |
1529 | 1546 | ||
1530 | while (win->getTransientFor()) { | 1547 | // get root window |
1531 | win = win->getTransientFor(); | 1548 | WinClient *client = getRootTransientFor(m_client); |
1532 | assert(win != win->getTransientFor()); | 1549 | |
1533 | } | 1550 | // if we don't have any root window use this as root |
1551 | if (client == 0) | ||
1552 | client = m_client; | ||
1553 | |||
1554 | FluxboxWindow *win = client->fbwindow(); | ||
1555 | if (!win) return; | ||
1534 | 1556 | ||
1535 | if (!win->isIconic()) { | 1557 | if (!win->isIconic()) { |
1536 | screen.updateNetizenWindowRaise(win->getClientWindow()); | 1558 | screen.updateNetizenWindowRaise(client->window()); |
1537 | win->getLayerItem().moveToLayer(layernum); | ||
1538 | win->setLayerNum(win->getLayerItem().getLayerNum()); | ||
1539 | } | 1559 | } |
1540 | std::list<FluxboxWindow *>::const_iterator it = win->getTransients().begin(); | 1560 | win->getLayerItem().lowerLayer(); |
1541 | std::list<FluxboxWindow *>::const_iterator it_end = win->getTransients().end(); | 1561 | // remember number just in case a transient happens to revisit this window |
1562 | layernum = win->getLayerItem().getLayerNum(); | ||
1563 | win->setLayerNum(layernum); | ||
1564 | |||
1565 | WinClient::TransientList::const_iterator it = client->transientList().begin(); | ||
1566 | WinClient::TransientList::const_iterator it_end = client->transientList().end(); | ||
1542 | for (; it != it_end; ++it) { | 1567 | for (; it != it_end; ++it) { |
1543 | if (!(*it)->isIconic()) { | 1568 | win = (*it)->fbwindow(); |
1544 | screen.updateNetizenWindowRaise((*it)->getClientWindow()); | 1569 | if (win && !win->isIconic()) { |
1545 | (*it)->getLayerItem().moveToLayer(layernum); | 1570 | screen.updateNetizenWindowRaise((*it)->window()); |
1546 | (*it)->setLayerNum((*it)->getLayerItem().getLayerNum()); | 1571 | win->getLayerItem().moveToLayer(layernum); |
1572 | win->setLayerNum(layernum); | ||
1547 | } | 1573 | } |
1548 | } | 1574 | } |
1549 | } | 1575 | } |
@@ -1992,7 +2018,7 @@ void FluxboxWindow::mapNotifyEvent(XMapEvent &ne) { | |||
1992 | 2018 | ||
1993 | setState(NormalState); | 2019 | setState(NormalState); |
1994 | 2020 | ||
1995 | if (transient || screen.doFocusNew()) | 2021 | if (client->isTransient() || screen.doFocusNew()) |
1996 | setInputFocus(); | 2022 | setInputFocus(); |
1997 | else | 2023 | else |
1998 | setFocusFlag(false); | 2024 | setFocusFlag(false); |
@@ -2003,7 +2029,7 @@ void FluxboxWindow::mapNotifyEvent(XMapEvent &ne) { | |||
2003 | iconic = false; | 2029 | iconic = false; |
2004 | 2030 | ||
2005 | // Auto-group from tab? | 2031 | // Auto-group from tab? |
2006 | if (!transient) { | 2032 | if (!client->isTransient()) { |
2007 | cerr<<__FILE__<<"("<<__FUNCTION__<<") TODO check grouping here"<<endl; | 2033 | cerr<<__FILE__<<"("<<__FUNCTION__<<") TODO check grouping here"<<endl; |
2008 | } | 2034 | } |
2009 | 2035 | ||
@@ -2055,12 +2081,18 @@ void FluxboxWindow::propertyNotifyEvent(Atom atom) { | |||
2055 | break; | 2081 | break; |
2056 | 2082 | ||
2057 | case XA_WM_TRANSIENT_FOR: { | 2083 | case XA_WM_TRANSIENT_FOR: { |
2058 | bool was_transient = isTransient(); | 2084 | // TODO: this property notify should be handled by winclient |
2059 | updateTransientInfo(); | 2085 | // but for now we'll justhave to update all transient info |
2086 | //bool was_transient = isTransient(); | ||
2087 | ClientList::iterator it = clientList().begin(); | ||
2088 | ClientList::iterator it_end = clientList().end(); | ||
2089 | for (; it != it_end; it++) | ||
2090 | (*it)->updateTransientInfo(); | ||
2060 | reconfigure(); | 2091 | reconfigure(); |
2092 | // TODO: this is broken whilst we don't know which client | ||
2061 | // update our layer to be the same layer as our transient for | 2093 | // update our layer to be the same layer as our transient for |
2062 | if (isTransient() && isTransient() != was_transient) | 2094 | //if (isTransient() && isTransient() != was_transient) |
2063 | getLayerItem().setLayer(getTransientFor()->getLayerItem().getLayer()); | 2095 | // getLayerItem().setLayer(getTransientFor()->getLayerItem().getLayer()); |
2064 | 2096 | ||
2065 | } break; | 2097 | } break; |
2066 | 2098 | ||
@@ -2097,7 +2129,8 @@ void FluxboxWindow::propertyNotifyEvent(Atom atom) { | |||
2097 | functions.resize=false; | 2129 | functions.resize=false; |
2098 | functions.maximize=false; | 2130 | functions.maximize=false; |
2099 | } else { | 2131 | } else { |
2100 | if (! isTransient()) { | 2132 | // TODO: is broken while handled by FbW, needs to be in WinClient |
2133 | if (! winClient().isTransient()) { | ||
2101 | decorations.maximize = true; | 2134 | decorations.maximize = true; |
2102 | decorations.handle = true; | 2135 | decorations.handle = true; |
2103 | functions.maximize = true; | 2136 | functions.maximize = true; |
@@ -2929,12 +2962,6 @@ void FluxboxWindow::updateIcon() { | |||
2929 | } | 2962 | } |
2930 | } | 2963 | } |
2931 | 2964 | ||
2932 | void FluxboxWindow::updateTransientInfo() { | ||
2933 | for_each(clientList().begin(), | ||
2934 | clientList().end(), | ||
2935 | mem_fun(&WinClient::updateTransientInfo)); | ||
2936 | } | ||
2937 | |||
2938 | void FluxboxWindow::restore(WinClient *client, bool remap) { | 2965 | void FluxboxWindow::restore(WinClient *client, bool remap) { |
2939 | if (client->m_win != this) | 2966 | if (client->m_win != this) |
2940 | return; | 2967 | return; |
@@ -2989,39 +3016,6 @@ void FluxboxWindow::timeout() { | |||
2989 | raise(); | 3016 | raise(); |
2990 | } | 3017 | } |
2991 | 3018 | ||
2992 | bool FluxboxWindow::isTransient() const { | ||
2993 | if (m_client == 0) | ||
2994 | return false; | ||
2995 | |||
2996 | return (m_client->transientFor() ? true : false); | ||
2997 | } | ||
2998 | |||
2999 | bool FluxboxWindow::hasTransient() const { | ||
3000 | if (m_client == 0) | ||
3001 | return false; | ||
3002 | return (m_client->transients.size() ? true : false); | ||
3003 | } | ||
3004 | |||
3005 | const std::list<FluxboxWindow *> &FluxboxWindow::getTransients() const { | ||
3006 | return m_client->transients; | ||
3007 | } | ||
3008 | |||
3009 | std::list<FluxboxWindow *> &FluxboxWindow::getTransients() { | ||
3010 | return m_client->transients; | ||
3011 | } | ||
3012 | |||
3013 | const FluxboxWindow *FluxboxWindow::getTransientFor() const { | ||
3014 | if (m_client == 0) | ||
3015 | return 0; | ||
3016 | return m_client->transient_for; | ||
3017 | } | ||
3018 | |||
3019 | FluxboxWindow *FluxboxWindow::getTransientFor() { | ||
3020 | if (m_client == 0) | ||
3021 | return 0; | ||
3022 | return m_client->transient_for; | ||
3023 | } | ||
3024 | |||
3025 | Window FluxboxWindow::getClientWindow() const { | 3019 | Window FluxboxWindow::getClientWindow() const { |
3026 | if (m_client == 0) | 3020 | if (m_client == 0) |
3027 | return 0; | 3021 | return 0; |
diff --git a/src/Window.hh b/src/Window.hh index 426196d..cc7eff9 100644 --- a/src/Window.hh +++ b/src/Window.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: Window.hh,v 1.66 2003/05/01 13:19:36 rathnor Exp $ | 25 | // $Id: Window.hh,v 1.67 2003/05/07 16:21:26 rathnor Exp $ |
26 | 26 | ||
27 | #ifndef WINDOW_HH | 27 | #ifndef WINDOW_HH |
28 | #define WINDOW_HH | 28 | #define WINDOW_HH |
@@ -238,8 +238,6 @@ public: | |||
238 | @name accessors | 238 | @name accessors |
239 | */ | 239 | */ |
240 | //@{ | 240 | //@{ |
241 | bool isTransient() const; | ||
242 | bool hasTransient() const; | ||
243 | inline bool isManaged() const { return m_managed; } | 241 | inline bool isManaged() const { return m_managed; } |
244 | inline bool isFocused() const { return focused; } | 242 | inline bool isFocused() const { return focused; } |
245 | inline bool isVisible() const { return m_frame.isVisible(); } | 243 | inline bool isVisible() const { return m_frame.isVisible(); } |
@@ -267,11 +265,6 @@ public: | |||
267 | inline const FbTk::XLayerItem &getLayerItem() const { return m_layeritem; } | 265 | inline const FbTk::XLayerItem &getLayerItem() const { return m_layeritem; } |
268 | inline FbTk::XLayerItem &getLayerItem() { return m_layeritem; } | 266 | inline FbTk::XLayerItem &getLayerItem() { return m_layeritem; } |
269 | 267 | ||
270 | const std::list<FluxboxWindow *> &getTransients() const; | ||
271 | std::list<FluxboxWindow *> &getTransients(); | ||
272 | const FluxboxWindow *getTransientFor() const; | ||
273 | FluxboxWindow *getTransientFor(); | ||
274 | |||
275 | Window getClientWindow() const; | 268 | Window getClientWindow() const; |
276 | 269 | ||
277 | FbTk::FbWindow &getFbWindow() { return m_frame.window(); } | 270 | FbTk::FbWindow &getFbWindow() { return m_frame.window(); } |
@@ -335,6 +328,9 @@ public: | |||
335 | FluxboxWindow &m_win; | 328 | FluxboxWindow &m_win; |
336 | }; | 329 | }; |
337 | 330 | ||
331 | bool oplock; // Used to help stop transient loops occurring by locking a window | ||
332 | // during certain operations | ||
333 | |||
338 | private: | 334 | private: |
339 | void init(); | 335 | void init(); |
340 | 336 | ||
@@ -348,8 +344,6 @@ private: | |||
348 | /// try to attach current attaching client to a window at pos x, y | 344 | /// try to attach current attaching client to a window at pos x, y |
349 | void attachTo(int x, int y); | 345 | void attachTo(int x, int y); |
350 | 346 | ||
351 | void updateTransientInfo(); | ||
352 | |||
353 | bool getState(); | 347 | bool getState(); |
354 | /// gets title string from client window and updates frame's title | 348 | /// gets title string from client window and updates frame's title |
355 | void updateTitleFromClient(); | 349 | void updateTitleFromClient(); |
@@ -387,8 +381,8 @@ private: | |||
387 | std::string m_class_name; /// class name from WM_CLASS | 381 | std::string m_class_name; /// class name from WM_CLASS |
388 | 382 | ||
389 | //Window state | 383 | //Window state |
390 | bool moving, resizing, shaded, maximized, iconic, transient, | 384 | bool moving, resizing, shaded, maximized, iconic, |
391 | focused, stuck, modal, send_focus_message, m_managed; | 385 | focused, stuck, send_focus_message, m_managed; |
392 | WinClient *m_attaching_tab; | 386 | WinClient *m_attaching_tab; |
393 | 387 | ||
394 | BScreen &screen; /// screen on which this window exist | 388 | BScreen &screen; /// screen on which this window exist |
diff --git a/src/Workspace.cc b/src/Workspace.cc index ae986ad..f7bcb83 100644 --- a/src/Workspace.cc +++ b/src/Workspace.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: Workspace.cc,v 1.58 2003/05/04 23:38:06 rathnor Exp $ | 25 | // $Id: Workspace.cc,v 1.59 2003/05/07 16:21:26 rathnor Exp $ |
26 | 26 | ||
27 | #include "Workspace.hh" | 27 | #include "Workspace.hh" |
28 | 28 | ||
@@ -57,13 +57,13 @@ using namespace std; | |||
57 | 57 | ||
58 | namespace { // anonymous | 58 | namespace { // anonymous |
59 | 59 | ||
60 | int countTransients(const FluxboxWindow &win) { | 60 | int countTransients(const WinClient &client) { |
61 | if (win.getTransients().size() == 0) | 61 | if (client.transientList().empty()) |
62 | return 0; | 62 | return 0; |
63 | // now go throu the entire tree and count transients | 63 | // now go throu the entire tree and count transients |
64 | size_t ret = win.getTransients().size(); | 64 | size_t ret = client.transientList().size(); |
65 | std::list<FluxboxWindow *>::const_iterator it = win.getTransients().begin(); | 65 | WinClient::TransientList::const_iterator it = client.transientList().begin(); |
66 | std::list<FluxboxWindow *>::const_iterator it_end = win.getTransients().end(); | 66 | WinClient::TransientList::const_iterator it_end = client.transientList().end(); |
67 | for (; it != it_end; ++it) | 67 | for (; it != it_end; ++it) |
68 | ret += countTransients(*(*it)); | 68 | ret += countTransients(*(*it)); |
69 | 69 | ||
@@ -219,52 +219,22 @@ int Workspace::removeWindow(FluxboxWindow *w) { | |||
219 | if (w->isFocused()) { | 219 | if (w->isFocused()) { |
220 | if (screen.isSloppyFocus()) { | 220 | if (screen.isSloppyFocus()) { |
221 | Fluxbox::instance()->revertFocus(&screen); | 221 | Fluxbox::instance()->revertFocus(&screen); |
222 | } else if (w->isTransient() && w->getTransientFor() && | ||
223 | w->getTransientFor()->isVisible()) { | ||
224 | w->getTransientFor()->setInputFocus(); | ||
225 | } else { | 222 | } else { |
226 | FluxboxWindow *top = 0; | 223 | // go up the transient tree looking for a focusable window |
227 | 224 | WinClient *client = 0; | |
228 | // this bit is pretty dodgy at present | 225 | if (w->numClients() > 0) { |
229 | // it gets the next item down, then scans through our windowlist to see if it is | 226 | client = w->winClient().transientFor(); |
230 | // in this workspace. If not, goes down more | 227 | while (client) { |
231 | /* //!! TODO! FbTk::XLayerItem *item = 0, *lastitem = w->getLayerItem(); | 228 | if (client->fbwindow() && |
232 | do { | 229 | client->fbwindow() != w && // can't be this window |
233 | item = m_layermanager.getItemBelow(*lastitem); | 230 | client->fbwindow()->isVisible() && |
234 | Windows::iterator it = m_windowlist.begin(); | 231 | client->fbwindow()->setCurrentClient(*client, true)) |
235 | Windows::iterator it_end = m_windowlist.end(); | 232 | break; |
236 | for (; it != it_end; ++it) { | 233 | client = client->transientFor(); |
237 | if ((*it)->getLayerItem() == item) { | 234 | } |
238 | // found one! | ||
239 | top = *it; | ||
240 | } | ||
241 | } | ||
242 | |||
243 | lastitem = item; | ||
244 | |||
245 | } while (item && !top); | ||
246 | |||
247 | if (!top) { | ||
248 | // look upwards | ||
249 | lastitem = w->getLayerItem(); | ||
250 | do { | ||
251 | item = m_layermanager.getItemAbove(*lastitem); | ||
252 | Windows::iterator it = m_windowlist.begin(); | ||
253 | Windows::iterator it_end = m_windowlist.end(); | ||
254 | for (; it != it_end; ++it) { | ||
255 | if ((*it)->getLayerItem() == item) { | ||
256 | // found one! | ||
257 | top = *it; | ||
258 | } | ||
259 | } | ||
260 | lastitem = item; | ||
261 | } while (item && !top); | ||
262 | |||
263 | } | ||
264 | */ | ||
265 | if (top == 0|| !top->setInputFocus()) { | ||
266 | Fluxbox::instance()->revertFocus(&screen); | ||
267 | } | 235 | } |
236 | if (client == 0) // we were unsuccessful | ||
237 | Fluxbox::instance()->revertFocus(&screen); | ||
268 | } | 238 | } |
269 | } | 239 | } |
270 | 240 | ||