儲存庫 vbox 的更動 12290
- 時間撮記:
- 2008-9-9 下午12:56:56 (16 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Additions/x11/xmouse/xorg15/vboxmouse.c
r12282 r12290 44 44 * 45 45 * Authors: 46 * 47 * 46 * Kristian Høgsberg ([email protected]) 47 * Adam Jackson ([email protected]) 48 48 */ 49 49 … … 62 62 #include <fcntl.h> 63 63 64 #ifdef DEBUG_michael65 # define DEBUG_MOUSE 166 #endif67 68 #ifdef DEBUG_MOUSE69 70 #define TRACE \71 do { \72 xf86Msg(X_INFO, __PRETTY_FUNCTION__); \73 xf86Msg(X_INFO, ": entering\n"); \74 } while(0)75 #define TRACE2 \76 do { \77 xf86Msg(X_INFO, __PRETTY_FUNCTION__); \78 xf86Msg(X_INFO, ": leaving\n"); \79 } while(0)80 #define TRACE3(...) \81 do { \82 xf86Msg(X_INFO, __PRETTY_FUNCTION__); \83 xf86Msg(X_INFO, __VA_ARGS__); \84 } while(0)85 86 #else /* DEBUG_MOUSE not defined */87 88 #define TRACE do { } while(0)89 #define TRACE2 do { } while(0)90 #define TRACE3(...) do { } while(0)91 92 #endif /* DEBUG_MOUSE not defined */93 94 #define BOOL_STR(a) ((a) ? "TRUE" : "FALSE")95 96 typedef struct {97 int screen;98 } VBoxRec, *VBoxPtr;99 100 static const char *vboxDefaults[] = {101 NULL102 };103 104 105 64 static void 106 65 VBoxReadInput(InputInfoPtr pInfo) 107 66 { 108 67 uint32_t cx, cy, fFeatures; 109 TRACE;110 VBoxPtr pVBox = pInfo->private;111 int screenWidth = screenInfo.screens[pVBox->screen]->width;112 int screenHeight = screenInfo.screens[pVBox->screen]->height;113 68 114 69 if (RT_SUCCESS(VbglR3GetMouseStatus(&fFeatures, &cx, &cy))) 115 {116 /* convert to screen resolution */117 int x, y;118 // x = (cx * screenWidth) / 65535;119 // y = (cy * screenHeight) / 65535;120 70 /* send absolute movement */ 121 // xf86PostMotionEvent(pInfo->dev, 1, 0, 2, x, y);122 71 xf86PostMotionEvent(pInfo->dev, 1, 0, 2, cx, cy); 123 }124 }125 126 static void127 VBoxPtrCtrlProc(DeviceIntPtr device, PtrCtrl *ctrl)128 {129 /* Nothing to do, dix handles all settings */130 72 } 131 73 … … 134 76 { 135 77 InputInfoPtr pInfo; 136 VBoxPtr pVBox;137 78 int xrc; 138 79 139 80 pInfo = device->public.devicePrivate; 140 pVBox = pInfo->private;141 81 142 82 if (!InitValuatorClassDeviceStruct(device, 2, GetMotionHistory, … … 147 87 } 148 88 149 /* X valuator*/89 /* Tell the server about the range of axis values we report */ 150 90 xf86InitValuatorAxisStruct(device, 0, 0 /* min X */, 65536 /* max X */, 151 91 10000, 0, 10000); 152 92 xf86InitValuatorDefaults(device, 0); 153 93 154 /* Y valuator */155 94 xf86InitValuatorAxisStruct(device, 1, 0 /* min Y */, 65536 /* max Y */, 156 95 10000, 0, 10000); … … 158 97 xf86MotionHistoryAllocate(pInfo); 159 98 160 if (!InitPtrFeedbackClassDeviceStruct(device, VBoxPtrCtrlProc)) {161 xf86Msg(X_ERROR, "%s: InitPtrFeedbackClassDeviceStruct failed\n",162 pInfo->name);163 return BadAlloc;164 }165 166 99 return Success; 167 100 } … … 171 104 { 172 105 InputInfoPtr pInfo; 173 VBoxPtr pVBox;174 106 int rc, xrc; 175 107 176 108 pInfo = device->public.devicePrivate; 177 pVBox = pInfo->private;178 109 179 110 switch (what) … … 186 117 } 187 118 xf86Msg(X_CONFIG, "%s: Mouse Integration associated with screen %d\n", 188 pInfo->name, pVBox->screen); 119 pInfo->name, 120 xf86SetIntOption(pInfo->options, "ScreenNumber", 0)); 189 121 break; 190 122 … … 202 134 203 135 xf86AddEnabledDevice(pInfo); 204 205 206 136 device->public.on = TRUE; 137 break; 138 207 139 case DEVICE_OFF: 208 140 xf86Msg(X_INFO, "%s: Off.\n", pInfo->name); 209 141 VbglR3SetMouseStatus(0); 210 142 xf86RemoveEnabledDevice(pInfo); 211 212 143 device->public.on = FALSE; 144 break; 213 145 214 146 case DEVICE_CLOSE: 215 147 VbglR3Term(); 216 217 148 xf86Msg(X_INFO, "%s: Close\n", pInfo->name); 149 break; 218 150 } 219 151 … … 239 171 InputInfoPtr pInfo; 240 172 const char *device; 241 VBoxPtr pVBox;242 173 243 174 if (!(pInfo = xf86AllocateInput(drv, 0))) 244 175 return NULL; 245 176 246 177 /* Initialise the InputInfoRec. */ … … 254 185 XI86_ALWAYS_CORE | XI86_OPEN_ON_INIT; 255 186 256 if (!(pVBox = xcalloc(sizeof(*pVBox), 1))) 257 return pInfo; 258 pInfo->private = pVBox; 259 260 xf86CollectInputOptions(pInfo, vboxDefaults, NULL); 187 xf86CollectInputOptions(pInfo, NULL, NULL); 261 188 xf86ProcessCommonOptions(pInfo, pInfo->options); 262 189 263 pVBox->screen = xf86SetIntOption(pInfo->options, "ScreenNumber", 0); 264 265 device = xf86CheckStrOption(dev->commonOptions, "Path", "/dev/vboxadd"); 266 if (!device) 267 device = xf86CheckStrOption(dev->commonOptions, "Device", 268 "/dev/vboxadd"); 269 if (!device) { 270 xf86Msg(X_ERROR, "%s: No device specified.\n", pInfo->name); 271 xf86DeleteInput(pInfo, 0); 272 return NULL; 273 } 274 190 device = xf86CheckStrOption(dev->commonOptions, "Device", 191 "/dev/vboxadd"); 192 275 193 xf86Msg(X_CONFIG, "%s: Device: \"%s\"\n", pInfo->name, device); 276 194 do { … … 281 199 if (pInfo->fd < 0) { 282 200 xf86Msg(X_ERROR, "Unable to open VirtualBox device \"%s\".\n", device); 283 201 xf86DeleteInput(pInfo, 0); 284 202 return NULL; 285 203 } 286 204 287 205 if (VBoxProbe(pInfo) != Success) { 288 206 xf86DeleteInput(pInfo, 0); 289 207 return NULL; 290 208 } 291 209 292 210 pInfo->flags |= XI86_CONFIGURED; 293 pInfo->flags |= XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS |294 XI86_ALWAYS_CORE | XI86_OPEN_ON_INIT | XI86_CONFIGURED;295 211 return pInfo; 296 212 } … … 306 222 }; 307 223 308 static void309 VBoxUnplug(pointer p)310 {311 }312 313 224 static pointer 314 VBoxPlug(pointer 315 pointer 316 int 317 int 225 VBoxPlug(pointer module, 226 pointer options, 227 int *errmaj, 228 int *errmin) 318 229 { 319 230 xf86AddInputDriver(&VBOXMOUSE, module, 0); … … 339 250 &VBoxVersionRec, 340 251 VBoxPlug, 341 VBoxUnplug252 NULL 342 253 };
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器