summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-20 20:43:38 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-20 20:43:38 +0000
commit42dfcbcc0fe6019d32cd5680a86e2831fe9b6974 (patch)
tree81f15764d81efcdcb0ec9edeeaf534ce2ecc0d48
parente7c20618e624eb27aa17abcdc471f3711e94b914 (diff)
downloadtdelibs-42dfcbcc0fe6019d32cd5680a86e2831fe9b6974.tar.gz
tdelibs-42dfcbcc0fe6019d32cd5680a86e2831fe9b6974.zip
KRandRTray fixes; minor compilation repairs
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdelibs@1152360 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
-rw-r--r--kdeui/kdialog.h5
-rw-r--r--kdeui/kpanelapplet.h6
-rw-r--r--kdeui/kpanelextension.h7
-rw-r--r--kio/kio/thumbcreator.h4
-rw-r--r--kjs/ustring.h1
-rw-r--r--krandr/libkrandr.cc9
-rw-r--r--krandr/lowlevel_randr.c4
-rw-r--r--krandr/randr.cpp14
8 files changed, 39 insertions, 11 deletions
diff --git a/kdeui/kdialog.h b/kdeui/kdialog.h
index c012a7266..78e26187d 100644
--- a/kdeui/kdialog.h
+++ b/kdeui/kdialog.h
@@ -21,12 +21,11 @@
#ifndef _KDIALOG_H_
#define _KDIALOG_H_
-class QLayoutItem;
-
#include <qdialog.h>
-
#include <kdelibs_export.h>
+class QLayoutItem;
+
/**
* Dialog with extended non-modal support and methods for %KDE standard
* compliance.
diff --git a/kdeui/kpanelapplet.h b/kdeui/kpanelapplet.h
index fa0d3adbb..a43e598f2 100644
--- a/kdeui/kpanelapplet.h
+++ b/kdeui/kpanelapplet.h
@@ -24,12 +24,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef __kpanelapplet_h__
#define __kpanelapplet_h__
-class KConfig;
-class QPopupMenu;
-
#include <qframe.h>
#include <kconfig.h>
+class KConfig;
+class QPopupMenu;
+
/**
* @short %KDE Panel Applet class
*
diff --git a/kdeui/kpanelextension.h b/kdeui/kpanelextension.h
index 2ff1a5133..59a9e0aef 100644
--- a/kdeui/kpanelextension.h
+++ b/kdeui/kpanelextension.h
@@ -24,14 +24,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef __kpanelextension_h__
#define __kpanelextension_h__
+#include <qframe.h>
+#include <kdelibs_export.h>
+
class QPopupMenu;
class KConfig;
class KPanelExtensionPrivate;
-#include <qframe.h>
-
-#include <kdelibs_export.h>
-
/**
* @short %KDE Panel Extension class
*
diff --git a/kio/kio/thumbcreator.h b/kio/kio/thumbcreator.h
index ca8e92f83..4612a0916 100644
--- a/kio/kio/thumbcreator.h
+++ b/kio/kio/thumbcreator.h
@@ -20,10 +20,12 @@
#ifndef _THUMBCREATOR_H_
#define _THUMBCREATOR_H_
+#include <qstring.h>
+
class QString;
class QImage;
/**
- * This is the baseclass for "thumbnail-plugins" in KDE. Using the class
+ * This is the baseclass for "thumbnail-plugins" in KDE. Using the class
* KIO::PreviewJob allows you to generate small images (thumbnails)
* for any kind of file, where a "ThumbCreator" is available. Have a look
* at kdebase/kioslave/thumbnail/ for existing ThumbCreators.
diff --git a/kjs/ustring.h b/kjs/ustring.h
index 2cdd2db78..34ab975e3 100644
--- a/kjs/ustring.h
+++ b/kjs/ustring.h
@@ -24,6 +24,7 @@
#ifndef _KJS_USTRING_H_
#define _KJS_USTRING_H_
+#include <qstring.h>
#include "global.h"
/**
diff --git a/krandr/libkrandr.cc b/krandr/libkrandr.cc
index db40743a4..f2080f287 100644
--- a/krandr/libkrandr.cc
+++ b/krandr/libkrandr.cc
@@ -90,6 +90,9 @@ QString KRandrSimpleAPI::applyIccFile(QString screenName, QString fileName) {
screenNumber = -1;
randr_display = XOpenDisplay(NULL);
randr_screen_info = read_screen_info(randr_display);
+ if (randr_screen_info == NULL) {
+ return "";
+ }
j=0;
for (i = 0; i < randr_screen_info->n_output; i++) {
output_info = randr_screen_info->outputs[i]->info;
@@ -151,6 +154,9 @@ QString KRandrSimpleAPI::applyIccFile(QString screenName, QString fileName) {
screenNumber = -1;
randr_display = XOpenDisplay(NULL);
randr_screen_info = read_screen_info(randr_display);
+ if (randr_screen_info == NULL) {
+ return "";
+ }
j=0;
for (i = 0; i < randr_screen_info->n_output; i++) {
output_info = randr_screen_info->outputs[i]->info;
@@ -216,6 +222,9 @@ QString KRandrSimpleAPI::applyIccConfiguration(QString profileName, QString kde_
if (isValid() == true) {
randr_display = XOpenDisplay(NULL);
randr_screen_info = read_screen_info(randr_display);
+ if (randr_screen_info == NULL) {
+ return "";
+ }
for (i = 0; i < randr_screen_info->n_output; i++) {
output_info = randr_screen_info->outputs[i]->info;
errorstr = applyIccFile(output_info->name, getIccFileName(profileName, output_info->name, kde_confdir));
diff --git a/krandr/lowlevel_randr.c b/krandr/lowlevel_randr.c
index 5326f0334..251d3bef5 100644
--- a/krandr/lowlevel_randr.c
+++ b/krandr/lowlevel_randr.c
@@ -384,6 +384,10 @@ struct ScreenInfo* internal_read_screen_info (Display *display)
sr = XRRGetScreenResources (display, root_window);
+ if (sr == NULL) {
+ return NULL;
+ }
+
screen_info = malloc (sizeof (struct ScreenInfo));
screen_info->dpy = display;
screen_info->window = root_window;
diff --git a/krandr/randr.cpp b/krandr/randr.cpp
index 63c5c0450..d56b37481 100644
--- a/krandr/randr.cpp
+++ b/krandr/randr.cpp
@@ -562,6 +562,20 @@ RandRDisplay::RandRDisplay()
return;
}
+ // Sometimes the extension is available but does not return any screens (!)
+ // Check for that case
+ Display *randr_display = XOpenDisplay(NULL);
+ int screen_num;
+ Window root_window;
+
+ screen_num = DefaultScreen (randr_display);
+ root_window = RootWindow (randr_display, screen_num);
+ if (XRRGetScreenResources (randr_display, root_window) == NULL) {
+ m_errorCode = i18n("No screens detected");
+ m_valid = false;
+ return;
+ }
+
int major_version, minor_version;
XRRQueryVersion(qt_xdisplay(), &major_version, &minor_version);