diff options
author | rathnor <rathnor> | 2004-05-13 01:48:18 (GMT) |
---|---|---|
committer | rathnor <rathnor> | 2004-05-13 01:48:18 (GMT) |
commit | 9069ae0d80c278fcba837d50f75a49f18ea44c15 (patch) | |
tree | e7ebc3a06eb456fc7e8e138e0797591fc25c3a20 | |
parent | 7ed9104ea85e3f7d23e0a523c71ad8dbe7c281c2 (diff) | |
download | fluxbox_pavel-9069ae0d80c278fcba837d50f75a49f18ea44c15.zip fluxbox_pavel-9069ae0d80c278fcba837d50f75a49f18ea44c15.tar.bz2 |
fix up a number of things for when a window hides while moving,
including a crash bug
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/Screen.cc | 6 | ||||
-rw-r--r-- | src/Window.cc | 81 | ||||
-rw-r--r-- | src/Window.hh | 13 | ||||
-rw-r--r-- | src/Workspace.cc | 6 | ||||
-rw-r--r-- | src/Workspace.hh | 2 |
6 files changed, 66 insertions, 47 deletions
@@ -1,5 +1,10 @@ | |||
1 | (Format: Year/Month/Day) | 1 | (Format: Year/Month/Day) |
2 | Changes for 0.9.10: | 2 | Changes for 0.9.10: |
3 | *04/05/13: | ||
4 | * Fix a crash when a window closes while [opaque] moving (Simon) | ||
5 | - also tidy up several related things when a window hides | ||
6 | - don't call frame().hide() explicitly, use FBW.hide(bool) | ||
7 | Window.hh/cc Workspace.hh/cc Screen.cc | ||
3 | *04/05/04: | 8 | *04/05/04: |
4 | * Fix EventManager bug/memory leak (possibly caused crash) (Simon) | 9 | * Fix EventManager bug/memory leak (possibly caused crash) (Simon) |
5 | EventManager.hh/cc | 10 | EventManager.hh/cc |
diff --git a/src/Screen.cc b/src/Screen.cc index 19f7d3a..3497f7d 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.277 2004/05/02 21:12:22 fluxgen Exp $ | 25 | // $Id: Screen.cc,v 1.278 2004/05/13 01:48:17 rathnor Exp $ |
26 | 26 | ||
27 | 27 | ||
28 | #include "Screen.hh" | 28 | #include "Screen.hh" |
@@ -851,7 +851,7 @@ void BScreen::changeWorkspaceID(unsigned int id) { | |||
851 | } | 851 | } |
852 | } | 852 | } |
853 | 853 | ||
854 | currentWorkspace()->hideAll(); | 854 | currentWorkspace()->hideAll(false); |
855 | 855 | ||
856 | // set new workspace | 856 | // set new workspace |
857 | m_current_workspace = getWorkspace(id); | 857 | m_current_workspace = getWorkspace(id); |
@@ -903,7 +903,7 @@ void BScreen::sendToWorkspace(unsigned int id, FluxboxWindow *win, bool changeWS | |||
903 | 903 | ||
904 | // if the window isn't on current workspace, hide it | 904 | // if the window isn't on current workspace, hide it |
905 | if (id != currentWorkspace()->workspaceID()) | 905 | if (id != currentWorkspace()->workspaceID()) |
906 | win->withdraw(); | 906 | win->withdraw(true); |
907 | 907 | ||
908 | reassociateWindow(win, id, true); | 908 | reassociateWindow(win, id, true); |
909 | 909 | ||
diff --git a/src/Window.cc b/src/Window.cc index e8cdf32..9299653 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.286 2004/05/03 13:45:23 rathnor Exp $ | 25 | // $Id: Window.cc,v 1.287 2004/05/13 01:48:18 rathnor Exp $ |
26 | 26 | ||
27 | #include "Window.hh" | 27 | #include "Window.hh" |
28 | 28 | ||
@@ -302,11 +302,12 @@ FluxboxWindow::~FluxboxWindow() { | |||
302 | cerr<<__FILE__<<"("<<__LINE__<<"): m_labelbuttons.size = "<<m_labelbuttons.size()<<endl; | 302 | cerr<<__FILE__<<"("<<__LINE__<<"): m_labelbuttons.size = "<<m_labelbuttons.size()<<endl; |
303 | #endif // DEBUG | 303 | #endif // DEBUG |
304 | 304 | ||
305 | if (moving || resizing || m_attaching_tab) { | 305 | if (moving) |
306 | screen().hideGeometry(); | 306 | stopMoving(true); |
307 | screen().hidePosition(); | 307 | if (resizing) |
308 | ungrabPointer(CurrentTime); | 308 | stopResizing(true); |
309 | } | 309 | if (m_attaching_tab) |
310 | attachTo(0, 0, true); | ||
310 | 311 | ||
311 | // no longer a valid window to do stuff with | 312 | // no longer a valid window to do stuff with |
312 | Fluxbox::instance()->removeWindowSearchGroup(frame().window().window()); | 313 | Fluxbox::instance()->removeWindowSearchGroup(frame().window().window()); |
@@ -1265,10 +1266,22 @@ bool FluxboxWindow::setInputFocus() { | |||
1265 | return ret; | 1266 | return ret; |
1266 | } | 1267 | } |
1267 | 1268 | ||
1268 | void FluxboxWindow::hide() { | 1269 | // don't hide the frame directly, use this function |
1270 | void FluxboxWindow::hide(bool interrupt_moving) { | ||
1269 | #ifdef DEBUG | 1271 | #ifdef DEBUG |
1270 | cerr<<__FILE__<<"("<<__FUNCTION__<<")["<<this<<"]"<<endl; | 1272 | cerr<<__FILE__<<"("<<__FUNCTION__<<")["<<this<<"]"<<endl; |
1271 | #endif // DEBUG | 1273 | #endif // DEBUG |
1274 | // resizing always stops on hides | ||
1275 | if (resizing) | ||
1276 | stopResizing(true); | ||
1277 | |||
1278 | if (interrupt_moving) { | ||
1279 | if (moving) | ||
1280 | stopMoving(true); | ||
1281 | if (m_attaching_tab) | ||
1282 | attachTo(0, 0, true); | ||
1283 | } | ||
1284 | |||
1272 | menu().hide(); | 1285 | menu().hide(); |
1273 | frame().hide(); | 1286 | frame().hide(); |
1274 | } | 1287 | } |
@@ -1284,12 +1297,11 @@ void FluxboxWindow::iconify() { | |||
1284 | if (isIconic()) // no need to iconify if we're already | 1297 | if (isIconic()) // no need to iconify if we're already |
1285 | return; | 1298 | return; |
1286 | 1299 | ||
1287 | menu().hide(); | ||
1288 | iconic = true; | 1300 | iconic = true; |
1289 | 1301 | ||
1290 | setState(IconicState); | 1302 | setState(IconicState); |
1291 | 1303 | ||
1292 | frame().hide(); | 1304 | hide(true); |
1293 | 1305 | ||
1294 | ClientList::iterator client_it = m_clientlist.begin(); | 1306 | ClientList::iterator client_it = m_clientlist.begin(); |
1295 | const ClientList::iterator client_it_end = m_clientlist.end(); | 1307 | const ClientList::iterator client_it_end = m_clientlist.end(); |
@@ -1374,15 +1386,10 @@ void FluxboxWindow::deiconify(bool reassoc, bool do_raise) { | |||
1374 | /** | 1386 | /** |
1375 | Set window in withdrawn state | 1387 | Set window in withdrawn state |
1376 | */ | 1388 | */ |
1377 | void FluxboxWindow::withdraw() { | 1389 | void FluxboxWindow::withdraw(bool interrupt_moving) { |
1378 | iconic = false; | 1390 | iconic = false; |
1379 | 1391 | ||
1380 | if (isResizing()) | 1392 | hide(interrupt_moving); |
1381 | stopResizing(); | ||
1382 | |||
1383 | frame().hide(); | ||
1384 | |||
1385 | menu().hide(); | ||
1386 | } | 1393 | } |
1387 | 1394 | ||
1388 | /** | 1395 | /** |
@@ -2083,7 +2090,7 @@ void FluxboxWindow::mapRequestEvent(XMapRequestEvent &re) { | |||
2083 | break; | 2090 | break; |
2084 | 2091 | ||
2085 | case WithdrawnState: | 2092 | case WithdrawnState: |
2086 | withdraw(); | 2093 | withdraw(true); |
2087 | break; | 2094 | break; |
2088 | 2095 | ||
2089 | case NormalState: { | 2096 | case NormalState: { |
@@ -2176,7 +2183,7 @@ void FluxboxWindow::destroyNotifyEvent(XDestroyWindowEvent &de) { | |||
2176 | cerr<<__FILE__<<"("<<__LINE__<<"): DestroyNotifyEvent this="<<this<<endl; | 2183 | cerr<<__FILE__<<"("<<__LINE__<<"): DestroyNotifyEvent this="<<this<<endl; |
2177 | #endif // DEBUG | 2184 | #endif // DEBUG |
2178 | if (numClients() == 1) | 2185 | if (numClients() == 1) |
2179 | frame().hide(); | 2186 | hide(); |
2180 | } | 2187 | } |
2181 | 2188 | ||
2182 | } | 2189 | } |
@@ -2847,7 +2854,7 @@ void FluxboxWindow::startMoving(Window win) { | |||
2847 | } | 2854 | } |
2848 | } | 2855 | } |
2849 | 2856 | ||
2850 | void FluxboxWindow::stopMoving() { | 2857 | void FluxboxWindow::stopMoving(bool interrupted) { |
2851 | moving = false; | 2858 | moving = false; |
2852 | Fluxbox *fluxbox = Fluxbox::instance(); | 2859 | Fluxbox *fluxbox = Fluxbox::instance(); |
2853 | 2860 | ||
@@ -2859,13 +2866,15 @@ void FluxboxWindow::stopMoving() { | |||
2859 | m_last_move_x, m_last_move_y, | 2866 | m_last_move_x, m_last_move_y, |
2860 | frame().width() + 2*frame().window().borderWidth()-1, | 2867 | frame().width() + 2*frame().window().borderWidth()-1, |
2861 | frame().height() + 2*frame().window().borderWidth()-1); | 2868 | frame().height() + 2*frame().window().borderWidth()-1); |
2862 | moveResize(m_last_move_x, m_last_move_y, frame().width(), frame().height()); | 2869 | if (!interrupted) { |
2863 | if (m_workspace_number != screen().currentWorkspaceID()) { | 2870 | moveResize(m_last_move_x, m_last_move_y, frame().width(), frame().height()); |
2864 | screen().reassociateWindow(this, screen().currentWorkspaceID(), true); | 2871 | if (m_workspace_number != screen().currentWorkspaceID()) { |
2865 | frame().show(); | 2872 | screen().reassociateWindow(this, screen().currentWorkspaceID(), true); |
2873 | frame().show(); | ||
2874 | } | ||
2866 | } | 2875 | } |
2867 | fluxbox->ungrab(); | 2876 | fluxbox->ungrab(); |
2868 | } else { | 2877 | } else if (!interrupted) { |
2869 | moveResize(frame().x(), frame().y(), frame().width(), frame().height()); | 2878 | moveResize(frame().x(), frame().y(), frame().width(), frame().height()); |
2870 | sendConfigureNotify(); | 2879 | sendConfigureNotify(); |
2871 | } | 2880 | } |
@@ -2873,7 +2882,7 @@ void FluxboxWindow::stopMoving() { | |||
2873 | 2882 | ||
2874 | screen().hidePosition(); | 2883 | screen().hidePosition(); |
2875 | ungrabPointer(CurrentTime); | 2884 | ungrabPointer(CurrentTime); |
2876 | 2885 | ||
2877 | FbTk::App::instance()->sync(false); //make sure the redraw is made before we continue | 2886 | FbTk::App::instance()->sync(false); //make sure the redraw is made before we continue |
2878 | } | 2887 | } |
2879 | 2888 | ||
@@ -3048,7 +3057,7 @@ void FluxboxWindow::startResizing(Window win, int x, int y) { | |||
3048 | m_last_resize_h - 1 + 2 * frame().window().borderWidth()); | 3057 | m_last_resize_h - 1 + 2 * frame().window().borderWidth()); |
3049 | } | 3058 | } |
3050 | 3059 | ||
3051 | void FluxboxWindow::stopResizing(Window win) { | 3060 | void FluxboxWindow::stopResizing(bool interrupted) { |
3052 | resizing = false; | 3061 | resizing = false; |
3053 | 3062 | ||
3054 | parent().drawRectangle(screen().rootTheme().opGC(), | 3063 | parent().drawRectangle(screen().rootTheme().opGC(), |
@@ -3058,26 +3067,31 @@ void FluxboxWindow::stopResizing(Window win) { | |||
3058 | 3067 | ||
3059 | screen().hideGeometry(); | 3068 | screen().hideGeometry(); |
3060 | 3069 | ||
3061 | fixsize(); | 3070 | if (!interrupted) { |
3062 | 3071 | fixsize(); | |
3063 | moveResize(m_last_resize_x, m_last_resize_y, | 3072 | |
3073 | moveResize(m_last_resize_x, m_last_resize_y, | ||
3064 | m_last_resize_w, m_last_resize_h); | 3074 | m_last_resize_w, m_last_resize_h); |
3075 | } | ||
3065 | 3076 | ||
3066 | ungrabPointer(CurrentTime); | 3077 | ungrabPointer(CurrentTime); |
3067 | } | 3078 | } |
3068 | 3079 | ||
3069 | void FluxboxWindow::attachTo(int x, int y) { | 3080 | void FluxboxWindow::attachTo(int x, int y, bool interrupted) { |
3070 | if (m_attaching_tab == 0) | 3081 | if (m_attaching_tab == 0) |
3071 | return; | 3082 | return; |
3072 | 3083 | ||
3073 | ungrabPointer(CurrentTime); | 3084 | ungrabPointer(CurrentTime); |
3074 | 3085 | ||
3075 | |||
3076 | parent().drawRectangle(screen().rootTheme().opGC(), | 3086 | parent().drawRectangle(screen().rootTheme().opGC(), |
3077 | m_last_move_x, m_last_move_y, | 3087 | m_last_move_x, m_last_move_y, |
3078 | m_labelbuttons[m_attaching_tab]->width(), | 3088 | m_labelbuttons[m_attaching_tab]->width(), |
3079 | m_labelbuttons[m_attaching_tab]->height()); | 3089 | m_labelbuttons[m_attaching_tab]->height()); |
3080 | Fluxbox::instance()->ungrab(); | 3090 | Fluxbox::instance()->ungrab(); |
3091 | |||
3092 | if (interrupted) | ||
3093 | return; | ||
3094 | |||
3081 | int dest_x = 0, dest_y = 0; | 3095 | int dest_x = 0, dest_y = 0; |
3082 | Window child = 0; | 3096 | Window child = 0; |
3083 | 3097 | ||
@@ -3160,8 +3174,7 @@ void FluxboxWindow::restore(WinClient *client, bool remap) { | |||
3160 | cerr<<__FILE__<<"("<<__FUNCTION__<<"): numClients() = "<<numClients()<<endl; | 3174 | cerr<<__FILE__<<"("<<__FUNCTION__<<"): numClients() = "<<numClients()<<endl; |
3161 | #endif // DEBUG | 3175 | #endif // DEBUG |
3162 | if (numClients() == 0) { | 3176 | if (numClients() == 0) { |
3163 | 3177 | hide(true); | |
3164 | frame().hide(); | ||
3165 | } | 3178 | } |
3166 | 3179 | ||
3167 | } | 3180 | } |
@@ -3260,7 +3273,7 @@ void FluxboxWindow::changeBlackboxHints(const BlackboxHints &net) { | |||
3260 | screen().reassociateWindow(this, net.workspace, true); | 3273 | screen().reassociateWindow(this, net.workspace, true); |
3261 | 3274 | ||
3262 | if (screen().currentWorkspaceID() != net.workspace) | 3275 | if (screen().currentWorkspaceID() != net.workspace) |
3263 | withdraw(); | 3276 | withdraw(true); |
3264 | else | 3277 | else |
3265 | deiconify(); | 3278 | deiconify(); |
3266 | } | 3279 | } |
diff --git a/src/Window.hh b/src/Window.hh index a8c6a6b..c67ce63 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.113 2004/05/02 21:06:27 fluxgen Exp $ | 25 | // $Id: Window.hh,v 1.114 2004/05/13 01:48:18 rathnor Exp $ |
26 | 26 | ||
27 | #ifndef WINDOW_HH | 27 | #ifndef WINDOW_HH |
28 | #define WINDOW_HH | 28 | #define WINDOW_HH |
@@ -184,13 +184,14 @@ public: | |||
184 | // map this window | 184 | // map this window |
185 | void show(); | 185 | void show(); |
186 | // unmap this window | 186 | // unmap this window |
187 | void hide(); | 187 | void hide() { hide(true); } |
188 | void hide(bool interrupt_moving); | ||
188 | void iconify(); | 189 | void iconify(); |
189 | void deiconify(bool reassoc = true, bool do_raise = true); | 190 | void deiconify(bool reassoc = true, bool do_raise = true); |
190 | /// close current client | 191 | /// close current client |
191 | void close(); | 192 | void close(); |
192 | /// set the window in withdrawn state | 193 | /// set the window in withdrawn state |
193 | void withdraw(); | 194 | void withdraw(bool interrupt_moving); |
194 | /// toggle maximize | 195 | /// toggle maximize |
195 | void maximize(int type = MAX_FULL); | 196 | void maximize(int type = MAX_FULL); |
196 | /// maximizes the window horizontal | 197 | /// maximizes the window horizontal |
@@ -384,11 +385,11 @@ private: | |||
384 | void grabButtons(); | 385 | void grabButtons(); |
385 | 386 | ||
386 | void startMoving(Window win); | 387 | void startMoving(Window win); |
387 | void stopMoving(); | 388 | void stopMoving(bool interrupted = false); |
388 | void startResizing(Window win, int x, int y); | 389 | void startResizing(Window win, int x, int y); |
389 | void stopResizing(Window win=0); | 390 | void stopResizing(bool interrupted = false); |
390 | /// try to attach current attaching client to a window at pos x, y | 391 | /// try to attach current attaching client to a window at pos x, y |
391 | void attachTo(int x, int y); | 392 | void attachTo(int x, int y, bool interrupted = false); |
392 | 393 | ||
393 | bool getState(); | 394 | bool getState(); |
394 | /// gets title string from client window and updates frame's title | 395 | /// gets title string from client window and updates frame's title |
diff --git a/src/Workspace.cc b/src/Workspace.cc index da6d9c1..87c32c4 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.95 2004/03/21 09:00:25 rathnor Exp $ | 25 | // $Id: Workspace.cc,v 1.96 2004/05/13 01:48:18 rathnor Exp $ |
26 | 26 | ||
27 | #include "Workspace.hh" | 27 | #include "Workspace.hh" |
28 | 28 | ||
@@ -218,12 +218,12 @@ void Workspace::showAll() { | |||
218 | } | 218 | } |
219 | 219 | ||
220 | 220 | ||
221 | void Workspace::hideAll() { | 221 | void Workspace::hideAll(bool interrupt_moving) { |
222 | Windows::reverse_iterator it = m_windowlist.rbegin(); | 222 | Windows::reverse_iterator it = m_windowlist.rbegin(); |
223 | Windows::reverse_iterator it_end = m_windowlist.rend(); | 223 | Windows::reverse_iterator it_end = m_windowlist.rend(); |
224 | for (; it != it_end; ++it) { | 224 | for (; it != it_end; ++it) { |
225 | if (! (*it)->isStuck()) | 225 | if (! (*it)->isStuck()) |
226 | (*it)->withdraw(); | 226 | (*it)->withdraw(interrupt_moving); |
227 | } | 227 | } |
228 | } | 228 | } |
229 | 229 | ||
diff --git a/src/Workspace.hh b/src/Workspace.hh index c2b02f3..90c57d0 100644 --- a/src/Workspace.hh +++ b/src/Workspace.hh | |||
@@ -57,7 +57,7 @@ public: | |||
57 | /// Set workspace name | 57 | /// Set workspace name |
58 | void setName(const std::string &name); | 58 | void setName(const std::string &name); |
59 | void showAll(); | 59 | void showAll(); |
60 | void hideAll(); | 60 | void hideAll(bool interrupt_moving); |
61 | void removeAll(); | 61 | void removeAll(); |
62 | void reconfigure(); | 62 | void reconfigure(); |
63 | void shutdown(); | 63 | void shutdown(); |