hopefully fix strange hang, plus tab drag fixes
This commit is contained in:
parent
1bf2cc30a8
commit
0b8592b203
2 changed files with 43 additions and 51 deletions
|
@ -1,6 +1,10 @@
|
||||||
(Format: Year/Month/Day)
|
(Format: Year/Month/Day)
|
||||||
Changes for 0.9.9:
|
Changes for 0.9.9:
|
||||||
*04/04/14:
|
*04/04/14:
|
||||||
|
* Hopefully fix the "stange" hang on restart (Simon)
|
||||||
|
- remove big sync-ed grab on all Button1 events
|
||||||
|
- Also tidy and fix tab moving
|
||||||
|
Window.cc
|
||||||
* Fixed a menu title bug (Thanks Mathias Gumz)
|
* Fixed a menu title bug (Thanks Mathias Gumz)
|
||||||
Menu.cc
|
Menu.cc
|
||||||
*04/04/12:
|
*04/04/12:
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: Window.cc,v 1.277 2004/04/12 23:03:34 fluxgen Exp $
|
// $Id: Window.cc,v 1.278 2004/04/14 15:17:20 rathnor Exp $
|
||||||
|
|
||||||
#include "Window.hh"
|
#include "Window.hh"
|
||||||
|
|
||||||
|
@ -974,9 +974,6 @@ void FluxboxWindow::associateClientWindow(bool use_attrs, int x, int y, unsigned
|
||||||
|
|
||||||
void FluxboxWindow::grabButtons() {
|
void FluxboxWindow::grabButtons() {
|
||||||
|
|
||||||
XGrabButton(display, Button1, AnyModifier,
|
|
||||||
frame().window().window(), True, ButtonPressMask,
|
|
||||||
GrabModeSync, GrabModeSync, None, None);
|
|
||||||
XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask, frame().window().window());
|
XUngrabButton(display, Button1, Mod1Mask|Mod2Mask|Mod3Mask, frame().window().window());
|
||||||
|
|
||||||
if (Fluxbox::instance()->useMod1()) {
|
if (Fluxbox::instance()->useMod1()) {
|
||||||
|
@ -2387,7 +2384,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
|
||||||
|
|
||||||
if (Fluxbox::instance()->getIgnoreBorder()
|
if (Fluxbox::instance()->getIgnoreBorder()
|
||||||
&& !(me.state & Mod1Mask) // really should check for exact matches
|
&& !(me.state & Mod1Mask) // really should check for exact matches
|
||||||
&& !(isMoving() || isResizing())) {
|
&& !(isMoving() || isResizing() || m_attaching_tab != 0)) {
|
||||||
int borderw = frame().window().borderWidth();
|
int borderw = frame().window().borderWidth();
|
||||||
if (me.x_root < (frame().x() + borderw) ||
|
if (me.x_root < (frame().x() + borderw) ||
|
||||||
me.y_root < (frame().y() + borderw) ||
|
me.y_root < (frame().y() + borderw) ||
|
||||||
|
@ -2416,6 +2413,11 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
|
||||||
|
|
||||||
if (! isMoving()) {
|
if (! isMoving()) {
|
||||||
startMoving(me.window);
|
startMoving(me.window);
|
||||||
|
// save first event point
|
||||||
|
m_last_resize_x = me.x_root;
|
||||||
|
m_last_resize_y = me.y_root;
|
||||||
|
m_button_grab_x = me.x_root - frame().x() - frame().window().borderWidth();
|
||||||
|
m_button_grab_y = me.y_root - frame().y() - frame().window().borderWidth();
|
||||||
} else {
|
} else {
|
||||||
int dx = me.x_root - m_button_grab_x,
|
int dx = me.x_root - m_button_grab_x,
|
||||||
dy = me.y_root - m_button_grab_y;
|
dy = me.y_root - m_button_grab_y;
|
||||||
|
@ -2539,67 +2541,56 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
|
||||||
|
|
||||||
screen().showGeometry(gx, gy);
|
screen().showGeometry(gx, gy);
|
||||||
}
|
}
|
||||||
} else if ((me.state & Button2Mask) && inside_titlebar && client != 0) {
|
} else if ((me.state & Button2Mask) && inside_titlebar && (client != 0 || m_attaching_tab != 0)) {
|
||||||
if (s_num_grabs > 0)
|
|
||||||
return;
|
|
||||||
//
|
//
|
||||||
// drag'n'drop code for tabs
|
// drag'n'drop code for tabs
|
||||||
//
|
//
|
||||||
|
FbTk::TextButton &active_button = *m_labelbuttons[(m_attaching_tab==0)?client:m_attaching_tab];
|
||||||
|
;
|
||||||
if (m_attaching_tab == 0) {
|
if (m_attaching_tab == 0) {
|
||||||
|
if (s_num_grabs > 0)
|
||||||
|
return;
|
||||||
// start drag'n'drop for tab
|
// start drag'n'drop for tab
|
||||||
m_attaching_tab = client;
|
m_attaching_tab = client;
|
||||||
grabPointer(me.window, False, Button2MotionMask |
|
grabPointer(me.window, False, ButtonMotionMask |
|
||||||
ButtonReleaseMask, GrabModeAsync, GrabModeAsync,
|
ButtonReleaseMask, GrabModeAsync, GrabModeAsync,
|
||||||
None, frame().theme().moveCursor(), CurrentTime);
|
None, frame(). theme().moveCursor(), CurrentTime);
|
||||||
m_last_move_x = me.x_root - 1;
|
int borderw = active_button.borderWidth();
|
||||||
m_last_move_y = me.y_root - 1;
|
// relative position on button
|
||||||
|
m_button_grab_x = me.x;
|
||||||
|
m_button_grab_y = me.y;
|
||||||
|
// last known root mouse position
|
||||||
|
m_last_move_x = me.x_root - me.x;
|
||||||
|
m_last_move_y = me.y_root - me.y;
|
||||||
|
// hijack extra vars for initial grab location
|
||||||
|
m_last_resize_x = me.x_root;
|
||||||
|
m_last_resize_y = me.y_root;
|
||||||
|
|
||||||
|
Fluxbox::instance()->grab();
|
||||||
|
|
||||||
parent().drawRectangle(screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme().opGC(),
|
||||||
m_last_move_x, m_last_move_y,
|
m_last_move_x, m_last_move_y,
|
||||||
m_labelbuttons[client]->width(),
|
active_button.width(),
|
||||||
m_labelbuttons[client]->height());
|
active_button.height());
|
||||||
} else {
|
} else {
|
||||||
// we already grabed and started to drag'n'drop tab
|
// we already grabed and started to drag'n'drop tab
|
||||||
// so we update drag'n'drop-rectangle
|
// so we update drag'n'drop-rectangle
|
||||||
int dx = me.x_root - 1, dy = me.y_root - 1;
|
int dx = me.x_root - m_button_grab_x, dy = me.y_root - m_button_grab_y;
|
||||||
|
|
||||||
dx -= frame().window().borderWidth();
|
|
||||||
dy -= frame().window().borderWidth();
|
|
||||||
|
|
||||||
if (screen().getEdgeSnapThreshold()) {
|
|
||||||
int drx = screen().width() - (dx + 1);
|
|
||||||
|
|
||||||
if (dx > 0 && dx < drx && dx < screen().getEdgeSnapThreshold())
|
|
||||||
dx = 0;
|
|
||||||
else if (drx > 0 && drx < screen().getEdgeSnapThreshold())
|
|
||||||
dx = screen().width() - 1;
|
|
||||||
|
|
||||||
int dty, dby;
|
|
||||||
|
|
||||||
dty = dy;
|
|
||||||
dby = -dy - 1;
|
|
||||||
|
|
||||||
if (dy > 0 && dty < screen().getEdgeSnapThreshold())
|
|
||||||
dy = 0;
|
|
||||||
else if (dby > 0 && dby < screen().getEdgeSnapThreshold())
|
|
||||||
dy = - 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//erase rectangle
|
//erase rectangle
|
||||||
parent().drawRectangle(screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme().opGC(),
|
||||||
m_last_move_x, m_last_move_y,
|
m_last_move_x, m_last_move_y,
|
||||||
m_labelbuttons[client]->width(),
|
active_button.width(),
|
||||||
m_labelbuttons[client]->height());
|
active_button.height());
|
||||||
|
|
||||||
|
|
||||||
// redraw rectangle at new pos
|
// redraw rectangle at new pos
|
||||||
m_last_move_x = dx;
|
m_last_move_x = dx;
|
||||||
m_last_move_y = dy;
|
m_last_move_y = dy;
|
||||||
parent().drawRectangle(screen().rootTheme().opGC(),
|
parent().drawRectangle(screen().rootTheme().opGC(),
|
||||||
m_last_move_x, m_last_move_y,
|
m_last_move_x, m_last_move_y,
|
||||||
m_labelbuttons[client]->width(),
|
active_button.width(),
|
||||||
m_labelbuttons[client]->height());
|
active_button.height());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3073,7 +3064,7 @@ void FluxboxWindow::attachTo(int x, int y) {
|
||||||
m_last_move_x, m_last_move_y,
|
m_last_move_x, m_last_move_y,
|
||||||
m_labelbuttons[m_attaching_tab]->width(),
|
m_labelbuttons[m_attaching_tab]->width(),
|
||||||
m_labelbuttons[m_attaching_tab]->height());
|
m_labelbuttons[m_attaching_tab]->height());
|
||||||
|
Fluxbox::instance()->ungrab();
|
||||||
int dest_x = 0, dest_y = 0;
|
int dest_x = 0, dest_y = 0;
|
||||||
Window child = 0;
|
Window child = 0;
|
||||||
|
|
||||||
|
@ -3086,10 +3077,6 @@ void FluxboxWindow::attachTo(int x, int y) {
|
||||||
if (client)
|
if (client)
|
||||||
attach_to_win = client->fbwindow();
|
attach_to_win = client->fbwindow();
|
||||||
|
|
||||||
cerr<<"client = "<<client<<", child = "<<hex<<child<<dec<<", fbwin = "<<attach_to_win<<endl;
|
|
||||||
|
|
||||||
cerr<<"client = "<<client<<", child = "<<hex<<child<<dec<<", fbwin = "<<attach_to_win<<endl;
|
|
||||||
|
|
||||||
if (attach_to_win != this &&
|
if (attach_to_win != this &&
|
||||||
attach_to_win != 0) {
|
attach_to_win != 0) {
|
||||||
|
|
||||||
|
@ -3099,9 +3086,10 @@ void FluxboxWindow::attachTo(int x, int y) {
|
||||||
// disconnect client if we didn't drop on a window
|
// disconnect client if we didn't drop on a window
|
||||||
WinClient &client = *m_attaching_tab;
|
WinClient &client = *m_attaching_tab;
|
||||||
detachClient(*m_attaching_tab);
|
detachClient(*m_attaching_tab);
|
||||||
// move to drop zone
|
// move window by relative amount of mouse movement
|
||||||
|
// since just detached, move relative to old location
|
||||||
if (client.m_win != 0)
|
if (client.m_win != 0)
|
||||||
client.m_win->move(x, y);
|
client.m_win->move(frame().x() - m_last_resize_x + x, frame().y() - m_last_resize_y + y);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue