aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrathnor <rathnor>2004-04-14 15:17:20 (GMT)
committerrathnor <rathnor>2004-04-14 15:17:20 (GMT)
commit0b8592b203c5da0fee069801e8413a5cc7c2eb64 (patch)
treeda5b60f62a28c202b03c1e58b287d9fbc86e8534
parent1bf2cc30a8f624d2bd81e898b74c3342fcbf8273 (diff)
downloadfluxbox_paul-0b8592b203c5da0fee069801e8413a5cc7c2eb64.zip
fluxbox_paul-0b8592b203c5da0fee069801e8413a5cc7c2eb64.tar.bz2
hopefully fix strange hang, plus tab drag fixes
-rw-r--r--ChangeLog4
-rw-r--r--src/Window.cc90
2 files changed, 43 insertions, 51 deletions
diff --git a/ChangeLog b/ChangeLog
index b9055ac..3e8e1b5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
1(Format: Year/Month/Day) 1(Format: Year/Month/Day)
2Changes for 0.9.9: 2Changes for 0.9.9:
3*04/04/14: 3*04/04/14:
4 * Hopefully fix the "stange" hang on restart (Simon)
5 - remove big sync-ed grab on all Button1 events
6 - Also tidy and fix tab moving
7 Window.cc
4 * Fixed a menu title bug (Thanks Mathias Gumz) 8 * Fixed a menu title bug (Thanks Mathias Gumz)
5 Menu.cc 9 Menu.cc
6*04/04/12: 10*04/04/12:
diff --git a/src/Window.cc b/src/Window.cc
index faeec93..b7913c1 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.277 2004/04/12 23:03:34 fluxgen Exp $ 25// $Id: Window.cc,v 1.278 2004/04/14 15:17:20 rathnor Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -974,9 +974,6 @@ void FluxboxWindow::associateClientWindow(bool use_attrs, int x, int y, unsigned
974 974
975void FluxboxWindow::grabButtons() { 975void FluxboxWindow::grabButtons() {
976 976
977 XGrabButton(display, Button1, AnyModifier,
978 frame().window().window(), True, ButtonPressMask,
979 GrabModeSync, GrabModeSync, None, None);
980 XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask, frame().window().window()); 977 XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask, frame().window().window());
981 978
982 if (Fluxbox::instance()->useMod1()) { 979 if (Fluxbox::instance()->useMod1()) {
@@ -2387,7 +2384,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2387 2384
2388 if (Fluxbox::instance()->getIgnoreBorder() 2385 if (Fluxbox::instance()->getIgnoreBorder()
2389 && !(me.state & Mod1Mask) // really should check for exact matches 2386 && !(me.state & Mod1Mask) // really should check for exact matches
2390 && !(isMoving() || isResizing())) { 2387 && !(isMoving() || isResizing() || m_attaching_tab != 0)) {
2391 int borderw = frame().window().borderWidth(); 2388 int borderw = frame().window().borderWidth();
2392 if (me.x_root < (frame().x() + borderw) || 2389 if (me.x_root < (frame().x() + borderw) ||
2393 me.y_root < (frame().y() + borderw) || 2390 me.y_root < (frame().y() + borderw) ||
@@ -2416,6 +2413,11 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2416 2413
2417 if (! isMoving()) { 2414 if (! isMoving()) {
2418 startMoving(me.window); 2415 startMoving(me.window);
2416 // save first event point
2417 m_last_resize_x = me.x_root;
2418 m_last_resize_y = me.y_root;
2419 m_button_grab_x = me.x_root - frame().x() - frame().window().borderWidth();
2420 m_button_grab_y = me.y_root - frame().y() - frame().window().borderWidth();
2419 } else { 2421 } else {
2420 int dx = me.x_root - m_button_grab_x, 2422 int dx = me.x_root - m_button_grab_x,
2421 dy = me.y_root - m_button_grab_y; 2423 dy = me.y_root - m_button_grab_y;
@@ -2539,67 +2541,56 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2539 2541
2540 screen().showGeometry(gx, gy); 2542 screen().showGeometry(gx, gy);
2541 } 2543 }
2542 } else if ((me.state & Button2Mask) && inside_titlebar && client != 0) { 2544 } else if ((me.state & Button2Mask) && inside_titlebar && (client != 0 || m_attaching_tab != 0)) {
2543 if (s_num_grabs > 0)
2544 return;
2545 // 2545 //
2546 // drag'n'drop code for tabs 2546 // drag'n'drop code for tabs
2547 // 2547 //
2548 FbTk::TextButton &active_button = *m_labelbuttons[(m_attaching_tab==0)?client:m_attaching_tab];
2549;
2548 if (m_attaching_tab == 0) { 2550 if (m_attaching_tab == 0) {
2551 if (s_num_grabs > 0)
2552 return;
2549 // start drag'n'drop for tab 2553 // start drag'n'drop for tab
2550 m_attaching_tab = client; 2554 m_attaching_tab = client;
2551 grabPointer(me.window, False, Button2MotionMask | 2555 grabPointer(me.window, False, ButtonMotionMask |
2552 ButtonReleaseMask, GrabModeAsync, GrabModeAsync, 2556 ButtonReleaseMask, GrabModeAsync, GrabModeAsync,
2553 None, frame().theme().moveCursor(), CurrentTime); 2557 None, frame(). theme().moveCursor(), CurrentTime);
2554 m_last_move_x = me.x_root - 1; 2558 int borderw = active_button.borderWidth();
2555 m_last_move_y = me.y_root - 1; 2559 // relative position on button
2556 2560 m_button_grab_x = me.x;
2561 m_button_grab_y = me.y;
2562 // last known root mouse position
2563 m_last_move_x = me.x_root - me.x;
2564 m_last_move_y = me.y_root - me.y;
2565 // hijack extra vars for initial grab location
2566 m_last_resize_x = me.x_root;
2567 m_last_resize_y = me.y_root;
2568
2569 Fluxbox::instance()->grab();
2570
2557 parent().drawRectangle(screen().rootTheme().opGC(), 2571 parent().drawRectangle(screen().rootTheme().opGC(),
2558 m_last_move_x, m_last_move_y, 2572 m_last_move_x, m_last_move_y,
2559 m_labelbuttons[client]->width(), 2573 active_button.width(),
2560 m_labelbuttons[client]->height()); 2574 active_button.height());
2561 } else { 2575 } else {
2562 // we already grabed and started to drag'n'drop tab 2576 // we already grabed and started to drag'n'drop tab
2563 // so we update drag'n'drop-rectangle 2577 // so we update drag'n'drop-rectangle
2564 int dx = me.x_root - 1, dy = me.y_root - 1; 2578 int dx = me.x_root - m_button_grab_x, dy = me.y_root - m_button_grab_y;
2565
2566 dx -= frame().window().borderWidth();
2567 dy -= frame().window().borderWidth();
2568 2579
2569 if (screen().getEdgeSnapThreshold()) {
2570 int drx = screen().width() - (dx + 1);
2571
2572 if (dx > 0 && dx < drx && dx < screen().getEdgeSnapThreshold())
2573 dx = 0;
2574 else if (drx > 0 && drx < screen().getEdgeSnapThreshold())
2575 dx = screen().width() - 1;
2576
2577 int dty, dby;
2578
2579 dty = dy;
2580 dby = -dy - 1;
2581
2582 if (dy > 0 && dty < screen().getEdgeSnapThreshold())
2583 dy = 0;
2584 else if (dby > 0 && dby < screen().getEdgeSnapThreshold())
2585 dy = - 1;
2586
2587 }
2588
2589 //erase rectangle 2580 //erase rectangle
2590 parent().drawRectangle(screen().rootTheme().opGC(), 2581 parent().drawRectangle(screen().rootTheme().opGC(),
2591 m_last_move_x, m_last_move_y, 2582 m_last_move_x, m_last_move_y,
2592 m_labelbuttons[client]->width(), 2583 active_button.width(),
2593 m_labelbuttons[client]->height()); 2584 active_button.height());
2594 2585
2595 2586
2596 // redraw rectangle at new pos 2587 // redraw rectangle at new pos
2597 m_last_move_x = dx; 2588 m_last_move_x = dx;
2598 m_last_move_y = dy; 2589 m_last_move_y = dy;
2599 parent().drawRectangle(screen().rootTheme().opGC(), 2590 parent().drawRectangle(screen().rootTheme().opGC(),
2600 m_last_move_x, m_last_move_y, 2591 m_last_move_x, m_last_move_y,
2601 m_labelbuttons[client]->width(), 2592 active_button.width(),
2602 m_labelbuttons[client]->height()); 2593 active_button.height());
2603 2594
2604 2595
2605 } 2596 }
@@ -3073,7 +3064,7 @@ void FluxboxWindow::attachTo(int x, int y) {
3073 m_last_move_x, m_last_move_y, 3064 m_last_move_x, m_last_move_y,
3074 m_labelbuttons[m_attaching_tab]->width(), 3065 m_labelbuttons[m_attaching_tab]->width(),
3075 m_labelbuttons[m_attaching_tab]->height()); 3066 m_labelbuttons[m_attaching_tab]->height());
3076 3067 Fluxbox::instance()->ungrab();
3077 int dest_x = 0, dest_y = 0; 3068 int dest_x = 0, dest_y = 0;
3078 Window child = 0; 3069 Window child = 0;
3079 3070
@@ -3086,10 +3077,6 @@ void FluxboxWindow::attachTo(int x, int y) {
3086 if (client) 3077 if (client)
3087 attach_to_win = client->fbwindow(); 3078 attach_to_win = client->fbwindow();
3088 3079
3089 cerr<<"client = "<<client<<", child = "<<hex<<child<<dec<<", fbwin = "<<attach_to_win<<endl;
3090
3091 cerr<<"client = "<<client<<", child = "<<hex<<child<<dec<<", fbwin = "<<attach_to_win<<endl;
3092
3093 if (attach_to_win != this && 3080 if (attach_to_win != this &&
3094 attach_to_win != 0) { 3081 attach_to_win != 0) {
3095 3082
@@ -3099,9 +3086,10 @@ void FluxboxWindow::attachTo(int x, int y) {
3099 // disconnect client if we didn't drop on a window 3086 // disconnect client if we didn't drop on a window
3100 WinClient &client = *m_attaching_tab; 3087 WinClient &client = *m_attaching_tab;
3101 detachClient(*m_attaching_tab); 3088 detachClient(*m_attaching_tab);
3102 // move to drop zone 3089 // move window by relative amount of mouse movement
3090 // since just detached, move relative to old location
3103 if (client.m_win != 0) 3091 if (client.m_win != 0)
3104 client.m_win->move(x, y); 3092 client.m_win->move(frame().x() - m_last_resize_x + x, frame().y() - m_last_resize_y + y);
3105 3093
3106 } 3094 }
3107 3095