(file) Return to xf86Cursor.c CVS log (file) (dir) Up to [XFree86 CVS] / xc / programs / Xserver / hw / xfree86 / common

Diff for /xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c between version 3.13 and 3.13.4.7

version 3.13, 1996/12/23 06:43:22 version 3.13.4.7, 1997/07/21 18:02:32
Line 1 
Line 1 
 /* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c,v 3.12 1996/08/23 11:03:15 dawes Exp $ */  /* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c,v 3.13.4.6 1997/07/18 09:20:44 dawes Exp $ */
 /* /*
  * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.  * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
  *  *
Line 35 
Line 35 
  
 #include "xf86.h" #include "xf86.h"
 #include "xf86Procs.h" #include "xf86Procs.h"
   
 #ifdef XFreeXDGA #ifdef XFreeXDGA
 #include "Xproto.h" #include "Xproto.h"
 #include "extnsionst.h" #include "extnsionst.h"
 #include "scrnintstr.h" #include "scrnintstr.h"
 #include "servermd.h" #include "servermd.h"
   
 #define _XF86DGA_SERVER_ #define _XF86DGA_SERVER_
 #include "extensions/xf86dgastr.h" #include "extensions/xf86dgastr.h"
 #endif #endif
  
 #ifdef XINPUT #ifdef XINPUT
 #include "xf86_Config.h"  
 #include "XIproto.h" #include "XIproto.h"
 #include "xf86Xinput.h" #include "xf86Xinput.h"
 #endif #endif
  
 /* #include "atKeynames.h" -hv- dont need that include here */  typedef struct {
       short       left, right, up, down;
   } xf86ScreenLayoutRec, *xf86ScreenLayoutPtr;
 static Bool   xf86CursorOffScreen(  
 #if NeedFunctionPrototypes  static Bool xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y);
      ScreenPtr   *pScreen,  static void xf86CrossScreen(ScreenPtr pScreen, Bool entering);
      int         *x,  static void   xf86WrapCursor(ScreenPtr pScreen, int x, int y);
      int         *y  
 #endif  
 );  
 static void   xf86CrossScreen(  
 #if NeedFunctionPrototypes  
      ScreenPtr   pScreen,  
      Bool        entering  
 #endif  
 );  
 static void   xf86WrapCursor(  
 #if NeedFunctionPrototypes  
      ScreenPtr   pScreen,  
      int         x,  
      int         y  
 #endif  
 );  
  
 miPointerScreenFuncRec xf86PointerScreenFuncs = {  static miPointerScreenFuncRec xf86PointerScreenFuncs = {
   xf86CursorOffScreen,   xf86CursorOffScreen,
   xf86CrossScreen,   xf86CrossScreen,
   xf86WrapCursor,   xf86WrapCursor,
 #ifdef XINPUT #ifdef XINPUT
   xf86eqEnqueue,   xf86eqEnqueue,
     xf86eqSwitchScreen
   #else
     /* let miPointerInitialize take care of these */
     NULL,
     NULL
 #endif #endif
 }; };
  
   static xf86ScreenLayoutRec xf86ScreenLayout[MAXSCREENS];
   static Bool haveScreenLayout;
  
 /* /*
  * xf86InitViewport --  * xf86InitViewport --
  *      Initialize paning & zooming parameters, so that a driver must only  *      Initialize paning & zooming parameters, so that a driver must only
  *      check what resolutions are possible and whether the virtual area  *      check what resolutions are possible and whether the virtual area
  *      is valid if specifyed.   *      is valid if specified.
  */  */
  
 void void
 xf86InitViewport(pScr)  xf86InitViewport(ScrnInfoPtr pScr)
      ScrnInfoPtr pScr;  
 { {
   
     /* Set a default layout if none has been specified directly */
     if (!haveScreenLayout) {
       int left, right;
   
       left = pScr->scrnIndex ? pScr->scrnIndex - 1 : xf86NumScreens - 1;
       right = (pScr->scrnIndex + 1) % xf86NumScreens;
   
       xf86SetScreenLayout(pScr->scrnIndex, left, right, -1, -1);
     }
   
   /*   /*
    * Compute the initial Viewport if necessary    * Compute the initial Viewport if necessary
    */    */
Line 131 
Line 130 
  */  */
  
 void void
 xf86SetViewport(pScreen, x, y)  xf86SetViewport(ScreenPtr pScreen, int x, int y)
      ScreenPtr   pScreen;  
      int         x, y;  
 { {
   Bool          frameChanged = FALSE;   Bool          frameChanged = FALSE;
   ScrnInfoPtr   pScr = XF86SCRNINFO(pScreen);   ScrnInfoPtr   pScr = XF86SCRNINFO(pScreen);
Line 144 
Line 141 
    */    */
   if ( pScr->frameX0 > x) {   if ( pScr->frameX0 > x) {
     pScr->frameX0 = x;     pScr->frameX0 = x;
     pScr->frameX1 = x + pScr->modes->HDisplay - 1;      pScr->frameX1 = x + pScr->currentMode->HDisplay - 1;
     frameChanged = TRUE ;     frameChanged = TRUE ;
   }   }
  
   if ( pScr->frameX1 < x) {   if ( pScr->frameX1 < x) {
     pScr->frameX1 = x + 1;     pScr->frameX1 = x + 1;
     pScr->frameX0 = x - pScr->modes->HDisplay + 1;      pScr->frameX0 = x - pScr->currentMode->HDisplay + 1;
     frameChanged = TRUE ;     frameChanged = TRUE ;
   }   }
  
   if ( pScr->frameY0 > y) {   if ( pScr->frameY0 > y) {
     pScr->frameY0 = y;     pScr->frameY0 = y;
     pScr->frameY1 = y + pScr->modes->VDisplay - 1;      pScr->frameY1 = y + pScr->currentMode->VDisplay - 1;
     frameChanged = TRUE;     frameChanged = TRUE;
   }   }
  
   if ( pScr->frameY1 < y) {   if ( pScr->frameY1 < y) {
     pScr->frameY1 = y;     pScr->frameY1 = y;
     pScr->frameY0 = y - pScr->modes->VDisplay + 1;      pScr->frameY0 = y - pScr->currentMode->VDisplay + 1;
     frameChanged = TRUE;     frameChanged = TRUE;
   }   }
  
   if (frameChanged) (pScr->AdjustFrame)(pScr->frameX0, pScr->frameY0);    if (frameChanged && pScr->AdjustFrame != NULL)
       pScr->AdjustFrame(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0);
 } }
  
  
 static Bool xf86ZoomLocked = FALSE;  
   
 /* /*
  * xf86LockZoom --  * xf86LockZoom --
  *      Enable/disable ZoomViewport  *      Enable/disable ZoomViewport
  */  */
  
 void void
 xf86LockZoom (pScreen, lock)  xf86LockZoom(ScreenPtr pScreen, Bool lock)
      ScreenPtr  pScreen;  
      Bool       lock;  
 { {
   /*    XF86SCRNINFO(pScreen)->zoomLocked = lock;
    * pScreen is currently ignored, but may be used later to enable locking  }
    * of individual screens.  
    */  
  
   xf86ZoomLocked = lock;  Bool
   xf86ZoomLocked(ScreenPtr pScreen)
   {
     if (xf86Info.dontZoom || XF86SCRNINFO(pScreen)->zoomLocked)
       return TRUE;
     else
       return FALSE;
 } }
  
 /* /*
  * xf86ZoomViewport --  * xf86ZoomViewport --
  *      Reinitialize the visual part of the screen for another modes->   *      Reinitialize the visual part of the screen for another mode.
  */  */
  
 void void
 xf86ZoomViewport (pScreen, zoom)  xf86ZoomViewport (ScreenPtr pScreen, int zoom)
      ScreenPtr   pScreen;  
      int        zoom;  
 { {
   ScrnInfoPtr   pScr = XF86SCRNINFO(pScreen);   ScrnInfoPtr   pScr = XF86SCRNINFO(pScreen);
  
   if (xf86ZoomLocked)    if (pScr->zoomLocked)
     return;     return;
  
 #ifdef XFreeXDGA #ifdef XFreeXDGA
Line 210 
Line 206 
    * We should really send the mode change request to the DGA client and let    * We should really send the mode change request to the DGA client and let
    * it decide what to do. For now just bin the request    * it decide what to do. For now just bin the request
    */    */
    if (((ScrnInfoPtr)(xf86Info.currentScreen->devPrivates[xf86ScreenIndex].ptr))->directMode&XF86DGADirectGraphics)    if (pScr->DGAActive)
    return;    return;
 #endif #endif
  
   if (pScr->modes != pScr->modes->next)    if (pScr->SwitchMode != NULL &&
   {        pScr->currentMode != pScr->currentMode->next) {
     pScr->modes = zoom > 0 ? pScr->modes->next : pScr->modes->prev;      pScr->currentMode = zoom > 0 ? pScr->currentMode->next
                                    : pScr->currentMode->prev;
  
     if ((pScr->SwitchMode)(pScr->modes))      if (pScr->SwitchMode(pScr->scrnIndex, pScr->currentMode, 0)) {
     {  
       /*       /*
        * adjust new frame for the displaysize        * adjust new frame for the displaysize
        */        */
       pScr->frameX0 = (pScr->frameX1 + pScr->frameX0 -pScr->modes->HDisplay)/2;        pScr->frameX0 = (pScr->frameX1 + pScr->frameX0 -
       pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1;                         pScr->currentMode->HDisplay) / 2;
         pScr->frameX1 = pScr->frameX0 + pScr->currentMode->HDisplay - 1;
  
       if (pScr->frameX0 < 0)        if (pScr->frameX0 < 0) {
         {  
           pScr->frameX0 = 0;           pScr->frameX0 = 0;
           pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1;            pScr->frameX1 = pScr->frameX0 + pScr->currentMode->HDisplay - 1;
         }        } else if (pScr->frameX1 >= pScr->virtualX) {
       else if (pScr->frameX1 >= pScr->virtualX)            pScr->frameX0 = pScr->virtualX - pScr->currentMode->HDisplay;
         {            pScr->frameX1 = pScr->frameX0 + pScr->currentMode->HDisplay - 1;
           pScr->frameX0 = pScr->virtualX - pScr->modes->HDisplay;  
           pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1;  
         }         }
  
       pScr->frameY0 = (pScr->frameY1 + pScr->frameY0 - pScr->modes->VDisplay)/2;        pScr->frameY0 = (pScr->frameY1 + pScr->frameY0 -
       pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1;                         pScr->currentMode->VDisplay) / 2;
         pScr->frameY1 = pScr->frameY0 + pScr->currentMode->VDisplay - 1;
  
       if (pScr->frameY0 < 0)        if (pScr->frameY0 < 0) {
         {  
           pScr->frameY0 = 0;           pScr->frameY0 = 0;
           pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1;            pScr->frameY1 = pScr->frameY0 + pScr->currentMode->VDisplay - 1;
         }        } else if (pScr->frameY1 >= pScr->virtualY) {
       else if (pScr->frameY1 >= pScr->virtualY)            pScr->frameY0 = pScr->virtualY - pScr->currentMode->VDisplay;
         {            pScr->frameY1 = pScr->frameY0 + pScr->currentMode->VDisplay - 1;
           pScr->frameY0 = pScr->virtualY - pScr->modes->VDisplay;  
           pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1;  
         }         }
     }     }
     else /* switch failed, so go back to old mode */     else /* switch failed, so go back to old mode */
       pScr->modes = zoom > 0 ? pScr->modes->prev : pScr->modes->next;        pScr->currentMode = zoom > 0 ? pScr->currentMode->prev
                                      : pScr->currentMode->next;
   }   }
  
   (pScr->AdjustFrame)(pScr->frameX0, pScr->frameY0);    if (pScr->AdjustFrame != NULL)
       (pScr->AdjustFrame)(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0);
 } }
  
  
Line 265 
Line 259 
  *      Check whether it is necessary to switch to another screen  *      Check whether it is necessary to switch to another screen
  */  */
  
 /* ARGSUSED */  
 static Bool static Bool
 xf86CursorOffScreen (pScreen, x, y)  xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y)
      ScreenPtr   *pScreen;  {
      int         *x, *y;      int newX, newY;
 {      int newScreen = -1;
   int           i;      ScreenPtr oldScreen = *pScreen;
       xf86ScreenLayoutPtr layout = &(xf86ScreenLayout[(*pScreen)->myNum]);
   if ((screenInfo.numScreens > 1) && ((*x < 0) || ((*pScreen)->width <= *x))) {  
     i = (*pScreen)->myNum;      /* This is a trivial case but it is not checked anywhere else. */
     if (*x < 0) {      if (screenInfo.numScreens == 1)
       i = (i ? i : screenInfo.numScreens) -1;          return FALSE;
       *pScreen = screenInfo.screens[i];  
       *x += (*pScreen)->width;      newX = *x;
     }      newY = *y;
     else {  
       *x -= (*pScreen)->width;      /* Find the new screen number from the screen layout array. */
       i = (i+1) % screenInfo.numScreens;      if (*y < 0) {
       *pScreen = screenInfo.screens[i];          newScreen = layout->up;
     }      } else if (*y >= (*pScreen)->height) {
     return(TRUE);          newScreen = layout->down;
       } else if (*x < 0) {
           newScreen = layout->left;
       } else if (*x >= (*pScreen)->width) {
           newScreen = layout->right;
       }
   
       if (newScreen < 0 || newScreen >= screenInfo.numScreens)
           return FALSE;
   
       /* Set pScreen, adjust x and y, set x and y. */
       *pScreen = screenInfo.screens[newScreen];
   
       if (*y < 0) {
           newY += (*pScreen)->height;
       } else if (*y >= oldScreen->height) {
           newY -= oldScreen->height;
       } else if (*x < 0) {
           newX += (*pScreen)->width;
       } else if (*x >= oldScreen->width) {
           newX -= oldScreen->width;
   }   }
   return(FALSE);  
       *x = newX;
       *y = newY;
   
       return TRUE;
 } }
  
  
Line 297 
Line 314 
  *      Switch to another screen  *      Switch to another screen
  */  */
  
   /* NEED TO CHECK THIS */
 /* ARGSUSED */ /* ARGSUSED */
 static void static void
 xf86CrossScreen (pScreen, entering)  xf86CrossScreen (ScreenPtr pScreen, Bool entering)
      ScreenPtr   pScreen;  
      Bool        entering;  
 { {
   #if 0
   if (xf86Info.sharedMonitor)   if (xf86Info.sharedMonitor)
     (XF86SCRNINFO(pScreen)->EnterLeaveMonitor)(entering);     (XF86SCRNINFO(pScreen)->EnterLeaveMonitor)(entering);
   (XF86SCRNINFO(pScreen)->EnterLeaveCursor)(entering);   (XF86SCRNINFO(pScreen)->EnterLeaveCursor)(entering);
   #endif
 } }
  
  
Line 316 
Line 334 
  
 /* ARGSUSED */ /* ARGSUSED */
 static void static void
 xf86WrapCursor (pScreen, x, y)  xf86WrapCursor (ScreenPtr pScreen, int x, int y)
      ScreenPtr   pScreen;  
      int         x,y;  
 { {
   miPointerWarpCursor(pScreen,x,y);   miPointerWarpCursor(pScreen,x,y);
  
   xf86Info.currentScreen = pScreen;   xf86Info.currentScreen = pScreen;
 } }
   
   void
   xf86SetScreenLayout(int num, int left, int right, int up, int down)
   {
   #ifdef DEBUG
       ErrorF("xf86SetScreenLayout: %d %d %d %d %d\n", num, left,right,up,down);
   #endif
       if (num >= MAXSCREENS) {
           ErrorF("xf86SetScreenLayout: Screen number %d >= MAXSCREENS\n", num);
           return;
       }
   
       xf86ScreenLayout[num].left  = left;
       xf86ScreenLayout[num].right = right;
       xf86ScreenLayout[num].up    = up;
       xf86ScreenLayout[num].down  = down;
   }
   


Legend:
Removed from v.3.13  
changed lines
  Added in v.3.13.4.7

Powered by
ViewCVS 0.9.2