[PATCH xf86-input-mouse] Make absolute input reporting in Solaris aware of resolution changes

2014-04-24 Thread Michael Thayer
Currently on Solaris absolute input reporting only takes resolution changes
into account when the video driver is using the pre-RandR 1.2 APIs, and
there it uses the physical resolution, not the virtual.  This patch fixes
those two things.

Signed-off-by: Michael Thayer michael.tha...@oracle.com
---
This builds against master but actual testing was done against 1.7.2.  I think
that the two are close enough for this to be safe though.

 src/sun_mouse.c |   42 +-
 1 file changed, 33 insertions(+), 9 deletions(-)

diff --git a/src/sun_mouse.c b/src/sun_mouse.c
index 16434e6..90a0c23 100644
--- a/src/sun_mouse.c
+++ b/src/sun_mouse.c
@@ -57,6 +57,7 @@
 #include mouse.h
 #include xisb.h
 #include mipointer.h
+#include xf86Crtc.h
 #include sys/stropts.h
 #include sys/vuid_event.h
 #include sys/msio.h
@@ -405,14 +406,11 @@ static void vuidMouseSendScreenSize(ScreenPtr pScreen, 
VuidMsePtr pVuidMse)
 ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
 int result;
 
-if (!pScr-currentMode)
-return;
-
-if ((pVuidMse-absres.width != pScr-currentMode-HDisplay) ||
-(pVuidMse-absres.height != pScr-currentMode-VDisplay))
+if ((pVuidMse-absres.width != pScr-virtualX) ||
+(pVuidMse-absres.height != pScr-virtualY))
 {
-pVuidMse-absres.width = pScr-currentMode-HDisplay;
-pVuidMse-absres.height = pScr-currentMode-VDisplay;
+pVuidMse-absres.width = pScr-virtualX;
+pVuidMse-absres.height = pScr-virtualY;
 
 do {
 result = ioctl(pInfo-fd, MSIOSRESOLUTION, (pVuidMse-absres));
@@ -457,6 +455,24 @@ static void vuidMouseAdjustFrame(ADJUST_FRAME_ARGS_DECL)
   }
   }
 }
+
+static void vuidMouseCrtcNotify(ScreenPtr pScreen)
+{
+xf86_crtc_notify_proc_ptr wrappedCrtcNotify
+= (xf86_crtc_notify_proc_ptr) vuidMouseGetScreenPrivate(pScreen);
+VuidMsePtr   m;
+ScreenPtrptrCurScreen;
+
+if(wrappedCrtcNotify)
+wrappedCrtcNotify(pScreen);
+
+for (m = vuidMouseList; m != NULL ; m = m-next) {
+ptrCurScreen = miPointerGetScreen(m-pInfo-dev);
+if (ptrCurScreen == pScreen) {
+vuidMouseSendScreenSize(pScreen, m);
+}
+}
+}
 #endif /* HAVE_ABSOLUTE_MOUSE_SCALING */
 
 
@@ -492,8 +508,16 @@ vuidMouseProc(DeviceIntPtr pPointer, int what)
 for (i = 0; i  screenInfo.numScreens; i++) {
 ScreenPtr pScreen = screenInfo.screens[i];
 ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
-vuidMouseSetScreenPrivate(pScreen, pScrn-AdjustFrame);
-pScrn-AdjustFrame = vuidMouseAdjustFrame;
+if (xf86CrtcConfigPrivateIndex != -1) {
+xf86_crtc_notify_proc_ptr pCrtcNotify
+= xf86_wrap_crtc_notify(pScreen,
+vuidMouseCrtcNotify);
+vuidMouseSetScreenPrivate(pScreen, pCrtcNotify);
+} else {
+vuidMouseSetScreenPrivate(pScreen,
+  pScrn-AdjustFrame);
+pScrn-AdjustFrame = vuidMouseAdjustFrame;
+}
 }
 vuidMouseGeneration = serverGeneration;
 }
-- 
ORACLE Deutschland B.V.  Co. KG   Michael Thayer
Werkstrasse 24 VirtualBox engineering
71384 Weinstadt, Germany   mailto:michael.tha...@oracle.com

Hauptverwaltung: Riesstr. 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603

Geschäftsführer: Jürgen Kunz 
Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer: Alexander van der Ven, Astrid Kepper, Val Maher

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xf86-input-mouse] Make absolute input reporting in Solaris aware of resolution changes

2014-04-23 Thread Michael Thayer

On 19/04/14 08:13, Alan Coopersmith wrote:

This doesn't apply to current git at all.   The git index of ad38ba4
suggests
it's based on xf86-input-mouse 1.7.2, not the current 1.9.0 release or
git master.


Sorry about that - I was doing my testing using that version as I was 
having trouble getting the latest versions of everything building in my 
Solaris VM, though I thought I had submitted my forward-port to master. 
 I will check that tomorrow and re-submit.


Regards,

Michael


On 04/10/14 11:21 AM, Michael Thayer wrote:

Currently on Solaris absolute input reporting only takes resolution
changes
into account when the video driver is using the pre-RandR 1.2 APIs, and
there it uses the physical resolution, not the virtual.  This patch fixes
those two things.

Signed-off-by: Michael Thayer michael.tha...@oracle.com
---
  src/sun_mouse.c |   42 +-
  1 file changed, 33 insertions(+), 9 deletions(-)

diff --git a/src/sun_mouse.c b/src/sun_mouse.c
index ad38ba4..9ffd590 100644
--- a/src/sun_mouse.c
+++ b/src/sun_mouse.c
@@ -57,6 +57,7 @@
  #include mouse.h
  #include xisb.h
  #include mipointer.h
+#include xf86Crtc.h
  #include sys/stropts.h
  #include sys/vuid_event.h
  #include sys/msio.h
@@ -401,14 +402,11 @@ static void vuidMouseSendScreenSize(ScreenPtr
pScreen, VuidMsePtr pVuidMse)
  ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
  int result;

-if (!pScr-currentMode)
-return;
-
-if ((pVuidMse-absres.width != pScr-currentMode-HDisplay) ||
-(pVuidMse-absres.height != pScr-currentMode-VDisplay))
+if ((pVuidMse-absres.width != pScr-virtualX) ||
+(pVuidMse-absres.height != pScr-virtualY))
  {
-pVuidMse-absres.width = pScr-currentMode-HDisplay;
-pVuidMse-absres.height = pScr-currentMode-VDisplay;
+pVuidMse-absres.width = pScr-virtualX;
+pVuidMse-absres.height = pScr-virtualY;

  do {
  result = ioctl(pInfo-fd, MSIOSRESOLUTION,
(pVuidMse-absres));
@@ -452,6 +450,24 @@ static void vuidMouseAdjustFrame(int index, int
x, int y, int flags)
}
}
  }
+
+static void vuidMouseCrtcNotify(ScreenPtr pScreen)
+{
+  xf86_crtc_notify_proc_ptr wrappedCrtcNotify
+  = (xf86_crtc_notify_proc_ptr) vuidMouseGetScreenPrivate(pScreen);
+  VuidMsePtrm;
+  ScreenPtr ptrCurScreen;
+
+  if(wrappedCrtcNotify)
+ wrappedCrtcNotify(pScreen);
+
+  for (m = vuidMouseList; m != NULL ; m = m-next) {
+  ptrCurScreen = miPointerGetScreen(m-pInfo-dev);
+  if (ptrCurScreen == pScreen) {
+  vuidMouseSendScreenSize(pScreen, m);
+  }
+  }
+}
  #endif /* HAVE_ABSOLUTE_MOUSE_SCALING */


@@ -487,8 +503,16 @@ vuidMouseProc(DeviceIntPtr pPointer, int what)
  for (i = 0; i  screenInfo.numScreens; i++) {
  ScreenPtr pScreen = screenInfo.screens[i];
  ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
-vuidMouseSetScreenPrivate(pScreen, pScrn-AdjustFrame);
-pScrn-AdjustFrame = vuidMouseAdjustFrame;
+if (xf86CrtcConfigPrivateIndex != -1) {
+xf86_crtc_notify_proc_ptr pCrtcNotify
+= xf86_wrap_crtc_notify(pScreen,
+vuidMouseCrtcNotify);
+vuidMouseSetScreenPrivate(pScreen, pCrtcNotify);
+} else {
+vuidMouseSetScreenPrivate(pScreen,
+  pScrn-AdjustFrame);
+pScrn-AdjustFrame = vuidMouseAdjustFrame;
+}
  }
  vuidMouseGeneration = serverGeneration;
  }







--
ORACLE Deutschland B.V.  Co. KG   Michael Thayer
Werkstrasse 24 VirtualBox engineering
71384 Weinstadt, Germany   mailto:michael.tha...@oracle.com

Hauptverwaltung: Riesstr. 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603
Geschäftsführer: Jürgen Kunz

Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer: Alexander van der Ven, Astrid Kepper, Val Maher
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xf86-input-mouse] Make absolute input reporting in Solaris aware of resolution changes

2014-04-19 Thread Alan Coopersmith

This doesn't apply to current git at all.   The git index of ad38ba4 suggests
it's based on xf86-input-mouse 1.7.2, not the current 1.9.0 release or git 
master.

-alan-

On 04/10/14 11:21 AM, Michael Thayer wrote:

Currently on Solaris absolute input reporting only takes resolution changes
into account when the video driver is using the pre-RandR 1.2 APIs, and
there it uses the physical resolution, not the virtual.  This patch fixes
those two things.

Signed-off-by: Michael Thayer michael.tha...@oracle.com
---
  src/sun_mouse.c |   42 +-
  1 file changed, 33 insertions(+), 9 deletions(-)

diff --git a/src/sun_mouse.c b/src/sun_mouse.c
index ad38ba4..9ffd590 100644
--- a/src/sun_mouse.c
+++ b/src/sun_mouse.c
@@ -57,6 +57,7 @@
  #include mouse.h
  #include xisb.h
  #include mipointer.h
+#include xf86Crtc.h
  #include sys/stropts.h
  #include sys/vuid_event.h
  #include sys/msio.h
@@ -401,14 +402,11 @@ static void vuidMouseSendScreenSize(ScreenPtr pScreen, 
VuidMsePtr pVuidMse)
  ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
  int result;

-if (!pScr-currentMode)
-   return;
-
-if ((pVuidMse-absres.width != pScr-currentMode-HDisplay) ||
-   (pVuidMse-absres.height != pScr-currentMode-VDisplay))
+if ((pVuidMse-absres.width != pScr-virtualX) ||
+   (pVuidMse-absres.height != pScr-virtualY))
  {
-   pVuidMse-absres.width = pScr-currentMode-HDisplay;
-   pVuidMse-absres.height = pScr-currentMode-VDisplay;
+   pVuidMse-absres.width = pScr-virtualX;
+   pVuidMse-absres.height = pScr-virtualY;

do {
result = ioctl(pInfo-fd, MSIOSRESOLUTION, (pVuidMse-absres));
@@ -452,6 +450,24 @@ static void vuidMouseAdjustFrame(int index, int x, int y, 
int flags)
  }
}
  }
+
+static void vuidMouseCrtcNotify(ScreenPtr pScreen)
+{
+  xf86_crtc_notify_proc_ptr wrappedCrtcNotify
+ = (xf86_crtc_notify_proc_ptr) vuidMouseGetScreenPrivate(pScreen);
+  VuidMsePtr   m;
+  ScreenPtrptrCurScreen;
+
+  if(wrappedCrtcNotify)
+wrappedCrtcNotify(pScreen);
+
+  for (m = vuidMouseList; m != NULL ; m = m-next) {
+ ptrCurScreen = miPointerGetScreen(m-pInfo-dev);
+ if (ptrCurScreen == pScreen) {
+ vuidMouseSendScreenSize(pScreen, m);
+ }
+  }
+}
  #endif /* HAVE_ABSOLUTE_MOUSE_SCALING */


@@ -487,8 +503,16 @@ vuidMouseProc(DeviceIntPtr pPointer, int what)
for (i = 0; i  screenInfo.numScreens; i++) {
ScreenPtr pScreen = screenInfo.screens[i];
ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
-   vuidMouseSetScreenPrivate(pScreen, pScrn-AdjustFrame);
-   pScrn-AdjustFrame = vuidMouseAdjustFrame;
+   if (xf86CrtcConfigPrivateIndex != -1) {
+   xf86_crtc_notify_proc_ptr pCrtcNotify
+   = xf86_wrap_crtc_notify(pScreen,
+   vuidMouseCrtcNotify);
+   vuidMouseSetScreenPrivate(pScreen, pCrtcNotify);
+   } else {
+   vuidMouseSetScreenPrivate(pScreen,
+ pScrn-AdjustFrame);
+   pScrn-AdjustFrame = vuidMouseAdjustFrame;
+   }
}
vuidMouseGeneration = serverGeneration;
}




--
-Alan Coopersmith-  alan.coopersm...@oracle.com
 Oracle Solaris Engineering - http://blogs.oracle.com/alanc
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel


[PATCH xf86-input-mouse] Make absolute input reporting in Solaris aware of resolution changes

2014-04-10 Thread Michael Thayer
Currently on Solaris absolute input reporting only takes resolution changes
into account when the video driver is using the pre-RandR 1.2 APIs, and
there it uses the physical resolution, not the virtual.  This patch fixes
those two things.

Signed-off-by: Michael Thayer michael.tha...@oracle.com
---
 src/sun_mouse.c |   42 +-
 1 file changed, 33 insertions(+), 9 deletions(-)

diff --git a/src/sun_mouse.c b/src/sun_mouse.c
index ad38ba4..9ffd590 100644
--- a/src/sun_mouse.c
+++ b/src/sun_mouse.c
@@ -57,6 +57,7 @@
 #include mouse.h
 #include xisb.h
 #include mipointer.h
+#include xf86Crtc.h
 #include sys/stropts.h
 #include sys/vuid_event.h
 #include sys/msio.h
@@ -401,14 +402,11 @@ static void vuidMouseSendScreenSize(ScreenPtr pScreen, 
VuidMsePtr pVuidMse)
 ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
 int result;
 
-if (!pScr-currentMode)
-   return;
-
-if ((pVuidMse-absres.width != pScr-currentMode-HDisplay) || 
-   (pVuidMse-absres.height != pScr-currentMode-VDisplay))
+if ((pVuidMse-absres.width != pScr-virtualX) || 
+   (pVuidMse-absres.height != pScr-virtualY))
 {
-   pVuidMse-absres.width = pScr-currentMode-HDisplay;
-   pVuidMse-absres.height = pScr-currentMode-VDisplay;
+   pVuidMse-absres.width = pScr-virtualX;
+   pVuidMse-absres.height = pScr-virtualY;
 
do {
result = ioctl(pInfo-fd, MSIOSRESOLUTION, (pVuidMse-absres));
@@ -452,6 +450,24 @@ static void vuidMouseAdjustFrame(int index, int x, int y, 
int flags)
  }
   }
 }
+
+static void vuidMouseCrtcNotify(ScreenPtr pScreen)
+{
+  xf86_crtc_notify_proc_ptr wrappedCrtcNotify
+ = (xf86_crtc_notify_proc_ptr) vuidMouseGetScreenPrivate(pScreen);
+  VuidMsePtr   m;
+  ScreenPtrptrCurScreen;
+
+  if(wrappedCrtcNotify)
+wrappedCrtcNotify(pScreen);
+
+  for (m = vuidMouseList; m != NULL ; m = m-next) {
+ ptrCurScreen = miPointerGetScreen(m-pInfo-dev);
+ if (ptrCurScreen == pScreen) {
+ vuidMouseSendScreenSize(pScreen, m);
+ }
+  }
+}
 #endif /* HAVE_ABSOLUTE_MOUSE_SCALING */
 
 
@@ -487,8 +503,16 @@ vuidMouseProc(DeviceIntPtr pPointer, int what)
for (i = 0; i  screenInfo.numScreens; i++) {
ScreenPtr pScreen = screenInfo.screens[i];
ScrnInfoPtr pScrn = XF86SCRNINFO(pScreen);
-   vuidMouseSetScreenPrivate(pScreen, pScrn-AdjustFrame);
-   pScrn-AdjustFrame = vuidMouseAdjustFrame;
+   if (xf86CrtcConfigPrivateIndex != -1) {
+   xf86_crtc_notify_proc_ptr pCrtcNotify
+   = xf86_wrap_crtc_notify(pScreen,
+   vuidMouseCrtcNotify);
+   vuidMouseSetScreenPrivate(pScreen, pCrtcNotify);
+   } else {
+   vuidMouseSetScreenPrivate(pScreen,
+ pScrn-AdjustFrame);
+   pScrn-AdjustFrame = vuidMouseAdjustFrame;
+   }
}
vuidMouseGeneration = serverGeneration;
}
-- 
ORACLE Deutschland B.V.  Co. KG   Michael Thayer
Werkstrasse 24 VirtualBox engineering
71384 Weinstadt, Germany   mailto:michael.tha...@oracle.com

Hauptverwaltung: Riesstr. 25, D-80992 München
Registergericht: Amtsgericht München, HRA 95603

Geschäftsführer: Jürgen Kunz 
Komplementärin: ORACLE Deutschland Verwaltung B.V.
Hertogswetering 163/167, 3543 AS Utrecht, Niederlande
Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
Geschäftsführer: Alexander van der Ven, Astrid Kepper, Val Maher

___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel