diff options
author | phintuka <phintuka> | 2008-06-13 14:50:37 +0000 |
---|---|---|
committer | phintuka <phintuka> | 2008-06-13 14:50:37 +0000 |
commit | d634653a8f820eaa306ad8248ec99782724c50f2 (patch) | |
tree | f3dca267a13aba0e502e2412f060a7213d15c47b | |
parent | fd17a22eca8760582629400d3ab28a269db9e2e0 (diff) | |
download | xineliboutput-d634653a8f820eaa306ad8248ec99782724c50f2.tar.gz xineliboutput-d634653a8f820eaa306ad8248ec99782724c50f2.tar.bz2 |
Splitting large sxfe_run (XMotionEvent_handler)
-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: { |