Changeset 7086 in vbox
- Timestamp:
- Feb 21, 2008 8:06:06 PM (17 years ago)
- Location:
- trunk/src/VBox/Additions/x11
- Files:
-
- 2 edited
- 2 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/x11/xgraphics/Makefile.kmk
r6756 r7086 97 97 vboxvideo_drv_SOURCES = \ 98 98 vboxvideo_68.c \ 99 vboxutils -new.c99 vboxutils_68.c 100 100 endif # target linux, l4 101 101 -
trunk/src/VBox/Additions/x11/xgraphics/vboxutils_68.c
r7076 r7086 31 31 #endif 32 32 33 #include "vboxvideo .h"33 #include "vboxvideo_68.h" 34 34 35 35 #define VBOX_MAX_CURSOR_WIDTH 64 -
trunk/src/VBox/Additions/x11/xgraphics/vboxvideo_68.h
r7076 r7086 75 75 /* VBE/DDC support */ 76 76 #include "vbe.h" 77 #ifdef XORG_7X78 #include "vbeModes.h"79 #endif80 77 #include "xf86DDC.h" 81 78 … … 118 115 #include "afb.h" 119 116 #include "mfb.h" 120 #ifndef XORG_7X121 #include "cfb24_32.h"122 #endif123 117 124 118 #define VBOX_VERSION 4000 … … 137 131 PCITAG pciTag; 138 132 CARD16 maxBytesPerScanline; 139 #ifdef XORG_7X140 unsigned long mapPhys, mapOff;141 int mapSize; /* video memory */142 #else143 133 int mapPhys, mapOff, mapSize; /* video memory */ 144 #endif145 134 void *base, *VGAbase; 146 135 CARD8 *state, *pstate; /* SVGA state */ … … 153 142 CloseScreenProcPtr CloseScreen; 154 143 OptionInfoPtr Options; 155 #ifdef XORG_7X156 IOADDRESS ioBase;157 #endif /* XORG_7X defined */158 #if 0159 144 int vbox_fd; 160 #endif161 145 VMMDevReqMousePointer *reqp; 162 146 xf86CursorInfoPtr pCurs; … … 166 150 Bool pointerOffscreen; 167 151 Bool useVbva; 168 #if 0169 152 VMMDevVideoAccelFlush *reqf; 170 153 VMMDevVideoAccelEnable *reqe; 171 #endif172 154 VMMDevMemory *pVMMDevMemory; 173 155 VBVAMEMORY *pVbvaMemory; 174 156 } VBOXRec, *VBOXPtr; 175 157 176 #ifndef XORG_7X177 158 typedef struct _ModeInfoData 178 159 { … … 181 162 VbeCRTCInfoBlock *block; 182 163 } ModeInfoData; 183 #endif184 164 185 165 Bool vbox_cursor_init (ScreenPtr pScreen); -
trunk/src/VBox/Additions/x11/xmouse/Makefile.kmk
r6756 r7086 50 50 mouse.c \ 51 51 pnp.c \ 52 VBoxUtils .c52 VBoxUtils_68.c 53 53 endif 54 54 -
trunk/src/VBox/Additions/x11/xmouse/VBoxUtils_68.c
r7076 r7086 25 25 #include "compiler.h" 26 26 27 #ifndef RT_OS_SOLARIS 28 #include <asm/ioctl.h> 29 #endif 30 31 #ifdef RT_OS_SOLARIS /** @todo later Linux should also use R3 lib for this */ 27 32 int VBoxMouseInit(void) 28 33 { … … 72 77 return rc; 73 78 } 79 #else 80 /* the vboxadd module file handle */ 81 static int g_vboxaddHandle = -1; 82 /* the request structure */ 83 static VMMDevReqMouseStatus *g_vmmreqMouseStatus = NULL; 84 85 /** 86 * Initialise mouse integration. Returns 0 on success and 1 on failure 87 * (for example, if the VBox kernel module is not loaded). 88 */ 89 int VBoxMouseInit(void) 90 { 91 VMMDevReqMouseStatus req; 92 93 /* return immediately if already initialized */ 94 if (g_vboxaddHandle != -1) 95 return 0; 96 97 /* open the driver */ 98 g_vboxaddHandle = open(VBOXGUEST_DEVICE_NAME, O_RDWR, 0); 99 if (g_vboxaddHandle < 0) 100 { 101 ErrorF("Unable to open the virtual machine device: %s\n", 102 strerror(errno)); 103 return 1; 104 } 105 106 /* prepare the request structure */ 107 g_vmmreqMouseStatus = malloc(vmmdevGetRequestSize(VMMDevReq_GetMouseStatus)); 108 if (!g_vmmreqMouseStatus) 109 { 110 ErrorF("Ran out of memory while querying the virtual machine for the mouse capabilities.\n"); 111 return 1; 112 } 113 vmmdevInitRequest((VMMDevRequestHeader*)g_vmmreqMouseStatus, VMMDevReq_GetMouseStatus); 114 115 /* tell the host that we want absolute coordinates */ 116 vmmdevInitRequest((VMMDevRequestHeader*)&req, VMMDevReq_SetMouseStatus); 117 req.mouseFeatures = VBOXGUEST_MOUSE_GUEST_CAN_ABSOLUTE | VBOXGUEST_MOUSE_GUEST_NEEDS_HOST_CURSOR; 118 req.pointerXPos = 0; 119 req.pointerYPos = 0; 120 if (ioctl(g_vboxaddHandle, IOCTL_VBOXGUEST_VMMREQUEST, (void*)&req) < 0) 121 { 122 ErrorF("Error sending mouse pointer capabilities to VMM! rc = %d (%s)\n", 123 errno, strerror(errno)); 124 return 1; 125 } 126 /* everything is fine, put out some branding */ 127 xf86Msg(X_INFO, "VirtualBox mouse pointer integration available.\n"); 128 return 0; 129 } 130 131 /** 132 * Queries the absolute mouse position from the host. 133 * 134 * Returns 0 on success. 135 * Returns 1 when the host doesn't want absolute coordinates (no coordinates returned) 136 * Otherwise > 1 which means unsuccessful. 137 */ 138 int VBoxMouseQueryPosition(unsigned int *abs_x, unsigned int *abs_y) 139 { 140 /* If we failed to initialise, say that we don't want absolute co-ordinates. */ 141 if (g_vboxaddHandle < 0) 142 return 1; 143 /* perform VMM request */ 144 if (ioctl(g_vboxaddHandle, IOCTL_VBOXGUEST_VMMREQUEST, (void*)g_vmmreqMouseStatus) >= 0) 145 { 146 if (VBOX_SUCCESS(g_vmmreqMouseStatus->header.rc)) 147 { 148 /* does the host want absolute coordinates? */ 149 if (g_vmmreqMouseStatus->mouseFeatures & VBOXGUEST_MOUSE_HOST_CAN_ABSOLUTE) 150 { 151 *abs_x = g_vmmreqMouseStatus->pointerXPos; 152 *abs_y = g_vmmreqMouseStatus->pointerYPos; 153 return 0; 154 } 155 else 156 return 1; 157 } 158 else 159 { 160 ErrorF("Error querying host mouse position! header.rc = %d\n", g_vmmreqMouseStatus->header.rc); 161 } 162 } 163 else 164 { 165 ErrorF("Error performing VMM request! errno = %d (%s)\n", 166 errno, strerror(errno)); 167 } 168 /* error! */ 169 return 2; 170 } 171 172 int VBoxMouseFini(void) 173 { 174 VMMDevReqMouseStatus req; 175 /* If we are not initialised, there is nothing to do */ 176 if (g_vboxaddHandle < 0) 177 return 0; 178 /* tell VMM that we no longer support absolute mouse handling */ 179 vmmdevInitRequest((VMMDevRequestHeader*)&req, VMMDevReq_SetMouseStatus); 180 req.mouseFeatures = 0; 181 req.pointerXPos = 0; 182 req.pointerYPos = 0; 183 if (ioctl(g_vboxaddHandle, IOCTL_VBOXGUEST_VMMREQUEST, (void*)&req) < 0) 184 { 185 ErrorF("ioctl to vboxadd module failed, rc = %d (%s)\n", 186 errno, strerror(errno)); 187 } 188 189 free(g_vmmreqMouseStatus); 190 g_vmmreqMouseStatus = NULL; 191 close(g_vboxaddHandle); 192 g_vboxaddHandle = -1; 193 return 0; 194 } 195 #endif /* !RT_OS_SOLARIS */ 196
Note:
See TracChangeset
for help on using the changeset viewer.