on xenial help sign in
Fix crash in "make xvfbtestDragHandle"
commit75d2e73e607d44167d0928f7e269d876baa7da70 authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateWed 16 Dec 2015, 16:28 (11 years ago) parentb3ddc2d
1 file changed+8−2
plugins/Ubuntu/Gestures/DirectionalDragArea.cpp+8−2
plugins/Ubuntu/Gestures/DirectionalDragArea.cpp+8−2
@@ -715,8 +715,14 @@ void DirectionalDragArea::itemChange(ItemChange change, const ItemChangeData &va
715715 value.window->installEventFilter(TouchRegistry::instance());
716716
717717 // TODO: Handle window->screen() changes (ie window changing screens)
718− qreal pixelsPerMm = value.window->screen()->physicalDotsPerInch() / 25.4;
719− d->setPixelsPerMm(pixelsPerMm);
718+
719+ qreal pixelsPerInch = value.window->screen()->physicalDotsPerInch();
720+ if (pixelsPerInch < 0) {
721+ // It can return garbage when run in a XVFB server (Virtual Framebuffer 'fake' X server)
722+ pixelsPerInch = 72;
723+ }
724+
725+ d->setPixelsPerMm(pixelsPerInch / 25.4);
720726 }
721727 }
722728}