summaryrefslogtreecommitdiffstats
path: root/chromeos/display
diff options
context:
space:
mode:
authormiletus@chromium.org <miletus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-16 05:56:42 +0000
committermiletus@chromium.org <miletus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-16 05:56:42 +0000
commita11e5d787655f1f27595917ced4e90699cc3cbc7 (patch)
tree6fce71c7a7182efe24931028f2f83194be42ccb8 /chromeos/display
parent283b85bc9521dc73580e44ebdbdba9c5fb3c4bba (diff)
downloadchromium_src-a11e5d787655f1f27595917ced4e90699cc3cbc7.zip
chromium_src-a11e5d787655f1f27595917ced4e90699cc3cbc7.tar.gz
chromium_src-a11e5d787655f1f27595917ced4e90699cc3cbc7.tar.bz2
Arbitrarily matching a screen to a touchscreen if event range/resolution match fails
Sometimes a touchmonitor's touch event reporting range has no correlation with the touchmonitor's resolution, e.g. Acer T232HL has a native resolution of 1920x1080 but reports touch event range at 32767x32767. In this case using the touch event range to match the touchmonitor's resolution will fail. This CL adds that if there are unmatched touchscreens after using event range/resolution information, match them to arbitrary unmatched screens. This mostly helps the case of Pixel with external touchmonitor. Since Pixel's internal screen is always matched to its internal touchscreen, if we ever have an external touchsrceen that can't be matched, it will be forced to match to external screen. BUG=266106 TEST=Extended mode on Pixel with Acer T232HL works. Review URL: https://chromiumcodereview.appspot.com/23256002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@217953 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/display')
-rw-r--r--chromeos/display/real_output_configurator_delegate.cc34
1 files changed, 29 insertions, 5 deletions
diff --git a/chromeos/display/real_output_configurator_delegate.cc b/chromeos/display/real_output_configurator_delegate.cc
index 47fbd58..5b2d3c7 100644
--- a/chromeos/display/real_output_configurator_delegate.cc
+++ b/chromeos/display/real_output_configurator_delegate.cc
@@ -12,6 +12,7 @@
#include <X11/extensions/Xrandr.h>
#include <cmath>
+#include <set>
#include "base/logging.h"
#include "base/message_loop/message_pump_aurax11.h"
@@ -510,6 +511,7 @@ void RealOutputConfiguratorDelegate::GetTouchscreens(
if (valuator_x == None || valuator_y == None)
return;
+ std::set<int> no_match_touchscreen;
XIDeviceInfo* info = XIQueryDevice(display_, XIAllDevices, &ndevices);
for (int i = 0; i < ndevices; i++) {
if (!info[i].enabled || info[i].use != XIFloatingSlave)
@@ -579,11 +581,33 @@ void RealOutputConfiguratorDelegate::GetTouchscreens(
}
}
- VLOG_IF(2, k == outputs->size())
- << "No matching output - ignoring touchscreen"
- << " id " << info[i].deviceid
- << " width " << width
- << " height " << height;
+ if (k == outputs->size()) {
+ no_match_touchscreen.insert(info[i].deviceid);
+ VLOG(2) << "No matching output for touchscreen"
+ << " id " << info[i].deviceid
+ << " width " << width
+ << " height " << height;
+ }
+
+ }
+ }
+
+ // Sometimes we can't find a matching screen for the touchscreen, e.g.
+ // due to the touchscreen's reporting range having no correlation with the
+ // screen's resolution. In this case, we arbitrarily assign unmatched
+ // touchscreens to unmatched screens.
+ for (std::set<int>::iterator it = no_match_touchscreen.begin();
+ it != no_match_touchscreen.end();
+ it++) {
+ for (size_t i = 0; i < outputs->size(); i++) {
+ if ((*outputs)[i].is_internal == false &&
+ (*outputs)[i].native_mode != None &&
+ (*outputs)[i].touch_device_id == None ) {
+ (*outputs)[i].touch_device_id = *it;
+ VLOG(2) << "Arbitrarily matching touchscreen "
+ << (*outputs)[i].touch_device_id << " to output #" << i;
+ break;
+ }
}
}