diff options
-rw-r--r-- | kcmshell/main.cpp | 4 | ||||
-rw-r--r-- | krandr/libkrandr.cc | 130 | ||||
-rw-r--r-- | krandr/randr.cpp | 39 | ||||
-rw-r--r-- | krandr/randr.h | 77 |
4 files changed, 160 insertions, 90 deletions
diff --git a/kcmshell/main.cpp b/kcmshell/main.cpp index 778c3b9a9..22e42fda3 100644 --- a/kcmshell/main.cpp +++ b/kcmshell/main.cpp @@ -282,7 +282,9 @@ extern "C" KDE_EXPORT int kdemain(int _argc, char *_argv[]) return 0; } - KDialogBase::DialogType dtype = KDialogBase::Plain; + //KDialogBase::DialogType dtype = KDialogBase::Plain; // FIXME + KDialogBase::DialogType dtype = KDialogBase::IconList; // Work around a bug whereby several kcontrol modules (such as displayconfig) use an incorrect size when loaded with kcmshell in the Plain mode + // This bug is possibly related to kcmultidialog.cpp:266 [( new TQHBoxLayout( page ) )->setAutoAdd( true );] if ( modules.count() < 1 ) return 0; diff --git a/krandr/libkrandr.cc b/krandr/libkrandr.cc index f9f60471e..0ac816b48 100644 --- a/krandr/libkrandr.cc +++ b/krandr/libkrandr.cc @@ -180,16 +180,20 @@ TQString KRandrSimpleAPI::applyIccFile(TQString screenName, TQString fileName) { printf("Xcalib pipe error\n\r"); } else { - fgets(xcalib_result, 2048, pipe_xcalib); - pclose(pipe_xcalib); - for (i=1;i<2048;i++) { - if (xcalib_result[i] == 0) { - xcalib_result[i-1]=0; - i=2048; + if (fgets(xcalib_result, 2048, pipe_xcalib)) { + pclose(pipe_xcalib); + for (i=1;i<2048;i++) { + if (xcalib_result[i] == 0) { + xcalib_result[i-1]=0; + i=2048; + } + } + if (strlen(xcalib_result) > 2) { + return xcalib_result; } } - if (strlen(xcalib_result) > 2) { - return xcalib_result; + else { + printf("Xcalib pipe error\n\r"); } } } @@ -245,16 +249,20 @@ TQString KRandrSimpleAPI::applyIccFile(TQString screenName, TQString fileName) { printf("Xcalib pipe error\n\r"); } else { - fgets(xcalib_result, 2048, pipe_xcalib); - pclose(pipe_xcalib); - for (i=1;i<2048;i++) { - if (xcalib_result[i] == 0) { - xcalib_result[i-1]=0; - i=2048; + if (fgets(xcalib_result, 2048, pipe_xcalib)) { + pclose(pipe_xcalib); + for (i=1;i<2048;i++) { + if (xcalib_result[i] == 0) { + xcalib_result[i-1]=0; + i=2048; + } + } + if (strlen(xcalib_result) > 2) { + return xcalib_result; } } - if (strlen(xcalib_result) > 2) { - return xcalib_result; + else { + printf("Xcalib pipe error\n\r"); } } } @@ -396,16 +404,20 @@ TQString KRandrSimpleAPI::applySystemWideIccConfiguration(TQString kde_confdir) printf("Xcalib pipe error\n\r"); } else { - fgets(xcalib_result, 2048, pipe_xcalib); - pclose(pipe_xcalib); - for (i=1;i<2048;i++) { - if (xcalib_result[i] == 0) { - xcalib_result[i-1]=0; - i=2048; + if (fgets(xcalib_result, 2048, pipe_xcalib)) { + pclose(pipe_xcalib); + for (i=1;i<2048;i++) { + if (xcalib_result[i] == 0) { + xcalib_result[i-1]=0; + i=2048; + } + } + if (strlen(xcalib_result) > 2) { + return xcalib_result; } } - if (strlen(xcalib_result) > 2) { - return xcalib_result; + else { + printf("Xcalib pipe error\n\r"); } } return ""; @@ -1109,28 +1121,36 @@ TQPtrList<SingleScreenData> KRandrSimpleAPI::readCurrentDisplayConfiguration() { screendata->rotations.append(i18n("Rotate 90 degrees")); screendata->rotations.append(i18n("Rotate 180 degrees")); screendata->rotations.append(i18n("Rotate 270 degrees")); - screendata->current_orientation_mask = cur_screen->proposedRotation(); - switch (screendata->current_orientation_mask & RandRScreen::RotateMask) { - case RandRScreen::Rotate0: - screendata->current_rotation_index = 0; - break; - case RandRScreen::Rotate90: - screendata->current_rotation_index = 1; - break; - case RandRScreen::Rotate180: - screendata->current_rotation_index = 2; - break; - case RandRScreen::Rotate270: - screendata->current_rotation_index = 3; - break; - default: - // Shouldn't hit this one - Q_ASSERT(screendata->current_orientation_mask & RandRScreen::RotateMask); - break; - } - screendata->has_x_flip = (screendata->current_orientation_mask & RandRScreen::ReflectX); - screendata->has_y_flip = (screendata->current_orientation_mask & RandRScreen::ReflectY); screendata->supports_transformations = (cur_screen->rotations() != RandRScreen::Rotate0); + if (screendata->supports_transformations) { + screendata->current_orientation_mask = cur_screen->proposedRotation(); + switch (screendata->current_orientation_mask & RandRScreen::RotateMask) { + case RandRScreen::Rotate0: + screendata->current_rotation_index = 0; + break; + case RandRScreen::Rotate90: + screendata->current_rotation_index = 1; + break; + case RandRScreen::Rotate180: + screendata->current_rotation_index = 2; + break; + case RandRScreen::Rotate270: + screendata->current_rotation_index = 3; + break; + default: + // Shouldn't hit this one + Q_ASSERT(screendata->current_orientation_mask & RandRScreen::RotateMask); + screendata->current_rotation_index = 0; + break; + } + screendata->has_x_flip = (screendata->current_orientation_mask & RandRScreen::ReflectX); + screendata->has_y_flip = (screendata->current_orientation_mask & RandRScreen::ReflectY); + } + else { + screendata->has_x_flip = false; + screendata->has_y_flip = false; + screendata->current_rotation_index = 0; + } // Determine if this display is primary and/or extended RROutput primaryoutput = XRRGetOutputPrimary(tqt_xdisplay(), DefaultRootWindow(tqt_xdisplay())); @@ -1279,16 +1299,20 @@ TQString KRandrSimpleAPI::clearIccConfiguration() { printf("Xcalib pipe error\n\r"); } else { - fgets(xcalib_result, 2048, pipe_xcalib); - pclose(pipe_xcalib); - for (i=1;i<2048;i++) { - if (xcalib_result[i] == 0) { - xcalib_result[i-1]=0; - i=2048; + if (fgets(xcalib_result, 2048, pipe_xcalib)) { + pclose(pipe_xcalib); + for (i=1;i<2048;i++) { + if (xcalib_result[i] == 0) { + xcalib_result[i-1]=0; + i=2048; + } + } + if (strlen(xcalib_result) > 2) { + return xcalib_result; } } - if (strlen(xcalib_result) > 2) { - return xcalib_result; + else { + printf("Xcalib pipe error\n\r"); } } return ""; diff --git a/krandr/randr.cpp b/krandr/randr.cpp index 3a8e77169..2da9b4520 100644 --- a/krandr/randr.cpp +++ b/krandr/randr.cpp @@ -40,6 +40,45 @@ #undef INT32 #include <X11/extensions/Xrandr.h> +SingleScreenData::SingleScreenData() +{ +TQString screenFriendlyName; + generic_screen_detected = false; + screen_connected = false; + + current_resolution_index = 0; + current_refresh_rate_index = 0; + current_color_depth_index = 0; + + gamma_red = 0.0; + gamma_green = 0.0; + gamma_blue = 0.0; + + current_rotation_index = 0; + current_orientation_mask = 0; + has_x_flip = false; + has_y_flip = false; + supports_transformations = false; + + is_primary = false; + is_extended = false; + absolute_x_position = 0; + absolute_y_position = 0; + current_x_pixel_count = 0; + current_y_pixel_count = 0; + + has_dpms = false; + enable_dpms = false; + dpms_standby_delay = 0; + dpms_suspend_delay = 0; + dpms_off_delay = 0; +} + +SingleScreenData::~SingleScreenData() +{ + // +} + class RandRScreenPrivate { public: diff --git a/krandr/randr.h b/krandr/randr.h index 5e77016f2..b2832ef60 100644 --- a/krandr/randr.h +++ b/krandr/randr.h @@ -29,42 +29,47 @@ class KTimerDialog; class RandRScreenPrivate; -struct SingleScreenData { - TQString screenFriendlyName; - bool generic_screen_detected; - bool screen_connected; - - TQStringList resolutions; - TQStringList refresh_rates; - TQStringList color_depths; - TQStringList rotations; - - int current_resolution_index; - int current_refresh_rate_index; - int current_color_depth_index; - - float gamma_red; - float gamma_green; - float gamma_blue; - - int current_rotation_index; - int current_orientation_mask; - bool has_x_flip; - bool has_y_flip; - bool supports_transformations; - - bool is_primary; - bool is_extended; - int absolute_x_position; - int absolute_y_position; - int current_x_pixel_count; - int current_y_pixel_count; - - bool has_dpms; - bool enable_dpms; - unsigned int dpms_standby_delay; - unsigned int dpms_suspend_delay; - unsigned int dpms_off_delay; +class SingleScreenData { + public: + SingleScreenData(); + virtual ~SingleScreenData(); + + public: + TQString screenFriendlyName; + bool generic_screen_detected; + bool screen_connected; + + TQStringList resolutions; + TQStringList refresh_rates; + TQStringList color_depths; + TQStringList rotations; + + int current_resolution_index; + int current_refresh_rate_index; + int current_color_depth_index; + + float gamma_red; + float gamma_green; + float gamma_blue; + + int current_rotation_index; + int current_orientation_mask; + bool has_x_flip; + bool has_y_flip; + bool supports_transformations; + + bool is_primary; + bool is_extended; + int absolute_x_position; + int absolute_y_position; + int current_x_pixel_count; + int current_y_pixel_count; + + bool has_dpms; + bool enable_dpms; + unsigned int dpms_standby_delay; + unsigned int dpms_suspend_delay; + unsigned int dpms_off_delay; }; class RandRScreen : public TQObject |