[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34251] branches/merwin-tablet/intern/ ghost/intern/GHOST_SystemX11.cpp: removed old X11 tablet code, now handled by TabletManager
Mike Erwin
significant.bit at gmail.com
Tue Jan 11 09:25:35 CET 2011
Revision: 34251
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=34251
Author: merwin
Date: 2011-01-11 08:25:34 +0000 (Tue, 11 Jan 2011)
Log Message:
-----------
removed old X11 tablet code, now handled by TabletManager
Modified Paths:
--------------
branches/merwin-tablet/intern/ghost/intern/GHOST_SystemX11.cpp
Modified: branches/merwin-tablet/intern/ghost/intern/GHOST_SystemX11.cpp
===================================================================
--- branches/merwin-tablet/intern/ghost/intern/GHOST_SystemX11.cpp 2011-01-11 07:40:31 UTC (rev 34250)
+++ branches/merwin-tablet/intern/ghost/intern/GHOST_SystemX11.cpp 2011-01-11 08:25:34 UTC (rev 34251)
@@ -179,6 +179,7 @@
if (success) {
m_displayManager = new GHOST_DisplayManagerX11(this);
m_tabletManager = new GHOST_TabletManagerX11(this);
+
if (m_displayManager) {
return GHOST_kSuccess;
}
@@ -802,32 +803,6 @@
m_tabletManager->pickupTool(xe);
else if (xe->type == GHOST_TabletManagerX11::ProxOutEvent)
m_tabletManager->dropTool();
-
-#if 0
- if (xe->type == TabletManagerX11::MotionEvent)
- {
- XDeviceMotionEvent* data = (XDeviceMotionEvent*)xe;
- window->GetXTablet().CommonData.Pressure=
- data->axis_data[2]/((float)window->GetXTablet().PressureLevels);
-
- /* the (short) cast and the &0xffff is bizarre and unexplained anywhere,
- * but I got garbage data without it. Found it in the xidump.c source --matt */
- window->GetXTablet().CommonData.Xtilt=
- (short)(data->axis_data[3]&0xffff)/((float)window->GetXTablet().XtiltLevels);
- window->GetXTablet().CommonData.Ytilt=
- (short)(data->axis_data[4]&0xffff)/((float)window->GetXTablet().YtiltLevels);
- }
- else if (xe->type == TabletManagerX11::ProxInEvent)
- {
- XProximityNotifyEvent* data = (XProximityNotifyEvent*)xe;
- if(data->deviceid == window->GetXTablet().StylusID)
- window->GetXTablet().CommonData.Active= GHOST_kTabletModeStylus;
- else if(data->deviceid == window->GetXTablet().EraserID)
- window->GetXTablet().CommonData.Active= GHOST_kTabletModeEraser;
- }
- else if (xe->type == TabletManagerX11::ProxOutEvent)
- window->GetXTablet().CommonData.Active= GHOST_kTabletModeNone;
-#endif
}
if (g_event) {
@@ -1492,99 +1467,3 @@
fprintf(stderr, "failed to own primary\n");
}
}
-
-#if 0
-void GHOST_SystemX11::initXInputDevices()
-{
- static XErrorHandler old_handler = (XErrorHandler) 0 ;
- XExtensionVersion *version = XGetExtensionVersion(m_display, INAME);
-
- if(version && (version != (XExtensionVersion*)NoSuchExtension)) {
- if(version->present) {
- int device_count;
- XDeviceInfo* device_info = XListInputDevices(m_display, &device_count);
- m_xtablet.StylusDevice = NULL;
- m_xtablet.EraserDevice = NULL;
- m_xtablet.CommonData.Active= GHOST_kTabletModeNone;
-
- /* Install our error handler to override Xlib's termination behavior */
- old_handler = XSetErrorHandler(ApplicationErrorHandler) ;
-
- for(int i=0; i<device_count; ++i) {
- char *device_type = device_info[i].type ? XGetAtomName(m_display, device_info[i].type) : NULL;
-
- printf("Tablet type:'%s', name:'%s', index:%d\n", device_type, device_info[i].name, i);
-
-
- if(m_xtablet.StylusDevice==NULL && is_stylus(device_info[i].name, device_type)) {
- printf("\tfound stylus\n");
- m_xtablet.StylusID= device_info[i].id;
- m_xtablet.StylusDevice = XOpenDevice(m_display, m_xtablet.StylusID);
-
- if (m_xtablet.StylusDevice != NULL) {
- /* Find how many pressure levels tablet has */
- XAnyClassPtr ici = device_info[i].inputclassinfo;
- for(int j=0; j<m_xtablet.StylusDevice->num_classes; ++j) {
- if(ici->c_class==ValuatorClass) {
- printf("\t\tfound ValuatorClass\n");
- XValuatorInfo* xvi = (XValuatorInfo*)ici;
- m_xtablet.PressureLevels = xvi->axes[2].max_value;
-
- /* this is assuming that the tablet has the same tilt resolution in both
- * positive and negative directions. It would be rather weird if it didn't.. */
- m_xtablet.XtiltLevels = xvi->axes[3].max_value;
- m_xtablet.YtiltLevels = xvi->axes[4].max_value;
- break;
- }
-
- ici = (XAnyClassPtr)(((char *)ici) + ici->length);
- }
- } else {
- m_xtablet.StylusID= 0;
- }
- }
- else if(m_xtablet.EraserDevice==NULL && is_eraser(device_info[i].name, device_type)) {
- printf("\tfound eraser\n");
- m_xtablet.EraserID= device_info[i].id;
- m_xtablet.EraserDevice = XOpenDevice(m_display, m_xtablet.EraserID);
- if (m_xtablet.EraserDevice == NULL) m_xtablet.EraserID= 0;
- }
-
- if(device_type) {
- XFree((void*)device_type);
- }
- }
-
- /* Restore handler */
- (void) XSetErrorHandler(old_handler) ;
-
- XFreeDeviceList(device_info);
-
-
- XEventClass xevents[10], ev;
- int dcount = 0;
-
- if(m_xtablet.StylusDevice) {
- DeviceMotionNotify(m_xtablet.StylusDevice, m_xtablet.MotionEvent, ev);
- if(ev) xevents[dcount++] = ev;
- ProximityIn(m_xtablet.StylusDevice, m_xtablet.ProxInEvent, ev);
- if(ev) xevents[dcount++] = ev;
- ProximityOut(m_xtablet.StylusDevice, m_xtablet.ProxOutEvent, ev);
- if(ev) xevents[dcount++] = ev;
- }
- if(m_xtablet.EraserDevice) {
- DeviceMotionNotify(m_xtablet.EraserDevice, m_xtablet.MotionEvent, ev);
- if(ev) xevents[dcount++] = ev;
- ProximityIn(m_xtablet.EraserDevice, m_xtablet.ProxInEvent, ev);
- if(ev) xevents[dcount++] = ev;
- ProximityOut(m_xtablet.EraserDevice, m_xtablet.ProxOutEvent, ev);
- if(ev) xevents[dcount++] = ev;
- }
-
- XSelectExtensionEvent(m_display, m_window, xevents, dcount);
- }
- XFree(version);
- }
-}
-#endif
-
More information about the Bf-blender-cvs
mailing list