• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

A generic touchscreen calibration program for X.Org


Commit MetaInfo

修订版0aabb155d351656bbb804619279dd497b06c48b0 (tree)
时间2012-06-19 19:45:52
作者Plamen Kolev <multyrealm@gmai...>
CommiterPlamen Kolev

Log Message

take rotation into account when calculating display size

changed GuiCalibratorX11::redraw() to fall back to X if xrandr is not available

更改概述

差异

--- a/src/gui/x11.cpp
+++ b/src/gui/x11.cpp
@@ -95,7 +95,12 @@ GuiCalibratorX11::GuiCalibratorX11(Calibrator* calibrator0)
9595 int nsizes;
9696 XRRScreenSize* randrsize = XRRSizes(display, screen_num, &nsizes);
9797 if (nsizes != 0) {
98- set_display_size(randrsize->width, randrsize->height);
98+ Rotation current = 0;
99+ XRRRotations(display, screen_num, &current);
100+ bool rot = current & RR_Rotate_90 || current & RR_Rotate_270;
101+ int width = rot ? randrsize->height : randrsize->width;
102+ int height = rot ? randrsize->width : randrsize->height;
103+ set_display_size(width, height);
99104 } else {
100105 set_display_size(DisplayWidth(display, screen_num),
101106 DisplayHeight(display, screen_num));
@@ -183,17 +188,31 @@ void GuiCalibratorX11::set_display_size(int width, int height) {
183188
184189 void GuiCalibratorX11::redraw()
185190 {
186-#ifdef HAVE_X11_XRANDR
187191 if (calibrator->get_geometry() == NULL) {
192+ int width;
193+ int height;
194+#ifdef HAVE_X11_XRANDR
188195 // check that screensize did not change
189196 int nsizes;
190197 XRRScreenSize* randrsize = XRRSizes(display, screen_num, &nsizes);
191- if (nsizes != 0 && (display_width != randrsize->width ||
192- display_height != randrsize->height)) {
193- set_display_size(randrsize->width, randrsize->height);
198+ if (nsizes != 0) {
199+ Rotation current = 0;
200+ XRRRotations(display, screen_num, &current);
201+ bool rot = current & RR_Rotate_90 || current & RR_Rotate_270;
202+ width = rot ? randrsize->height : randrsize->width;
203+ height = rot ? randrsize->width : randrsize->height;
204+ } else {
205+ width = DisplayWidth(display, screen_num);
206+ height = DisplayHeight(display, screen_num);
194207 }
195- }
208+#else
209+ width = DisplayWidth(display, screen_num);
210+ height = DisplayHeight(display, screen_num);
196211 #endif
212+ if (display_width != width || display_height != height) {
213+ set_display_size(width, height);
214+ }
215+ }
197216
198217 // Print the text
199218 int text_height = font_info->ascent + font_info->descent;