aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc81
1 files changed, 47 insertions, 34 deletions
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
1268void FluxboxWindow::hide() { 1269// don't hide the frame directly, use this function
1270void 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*/
1377void FluxboxWindow::withdraw() { 1389void 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
2850void FluxboxWindow::stopMoving() { 2857void 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
3051void FluxboxWindow::stopResizing(Window win) { 3060void 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
3069void FluxboxWindow::attachTo(int x, int y) { 3080void 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 }