diff options
Diffstat (limited to 'xine_sxfe_frontend.c')
-rw-r--r-- | xine_sxfe_frontend.c | 54 |
1 files changed, 28 insertions, 26 deletions
diff --git a/xine_sxfe_frontend.c b/xine_sxfe_frontend.c index 36f699bf..10cd8b51 100644 --- a/xine_sxfe_frontend.c +++ b/xine_sxfe_frontend.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: xine_sxfe_frontend.c,v 1.50 2008-06-13 14:46:20 phintuka Exp $ + * $Id: xine_sxfe_frontend.c,v 1.51 2008-06-13 14:50:37 phintuka Exp $ * */ @@ -1247,6 +1247,32 @@ static void sxfe_interrupt(frontend_t *this_gen) XFlush(this->display); } +static void XMotionEvent_handler(sxfe_t *this, XMotionEvent *mev) +{ + if(this->dragging && !this->fullscreen) { + Window tmp_win; + int xpos, ypos; + + XLockDisplay(this->display); + + while(XCheckMaskEvent(this->display, ButtonMotionMask, (XEvent*)mev)); + + XTranslateCoordinates(this->display, this->window[0], + DefaultRootWindow(this->display), + 0, 0, &xpos, &ypos, &tmp_win); + + this->xpos = (xpos += mev->x_root - this->dragging_x); + this->ypos = (ypos += mev->y_root - this->dragging_y); + this->dragging_x = mev->x_root; + this->dragging_y = mev->y_root; + + XMoveWindow(this->display, this->window[0], xpos, ypos); + LOGDBG("MotionNotify: XMoveWindow called with x=%d and y=%d", xpos, ypos); + + XUnlockDisplay(this->display); + } +} + static int sxfe_run(frontend_t *this_gen) { sxfe_t *this = (sxfe_t*)this_gen; @@ -1365,32 +1391,8 @@ static int sxfe_run(frontend_t *this_gen) } case MotionNotify: - { - if(this->dragging && !this->fullscreen) { - XMotionEvent *mev = (XMotionEvent *) &event; - Window tmp_win; - int xpos, ypos; - - XLockDisplay(this->display); - - while(XCheckMaskEvent(this->display, ButtonMotionMask, &event)); - - XTranslateCoordinates(this->display, this->window[0], - DefaultRootWindow(this->display), - 0, 0, &xpos, &ypos, &tmp_win); - - this->xpos = (xpos += mev->x_root - this->dragging_x); - this->ypos = (ypos += mev->y_root - this->dragging_y); - this->dragging_x = mev->x_root; - this->dragging_y = mev->y_root; - - XMoveWindow(this->display, this->window[0], xpos, ypos); - LOGDBG("MotionNotify: XMoveWindow called with x=%d and y=%d", xpos, ypos); - - XUnlockDisplay(this->display); - } + XMotionEvent_handler(this, (XMotionEvent *) &event); break; - } case ButtonPress: { |