Hello community,

here is the log from the commit of package libkscreen for openSUSE:Factory 
checked in at 2013-09-16 16:12:18
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libkscreen (Old)
 and      /work/SRC/openSUSE:Factory/.libkscreen.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "libkscreen"

Changes:
--------
--- /work/SRC/openSUSE:Factory/libkscreen/libkscreen.changes    2013-08-02 
15:24:25.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.libkscreen.new/libkscreen.changes       
2013-09-16 16:12:19.000000000 +0200
@@ -1,0 +2,6 @@
+Sun Sep 15 19:54:44 UTC 2013 - [email protected]
+
+- refresh-modes-when-currentModeId-points-to-unknown-mode.patch:
+  Refresh modes when currentModeId points to unknown mode (bnc#840446)
+
+-------------------------------------------------------------------

New:
----
  refresh-modes-when-currentModeId-points-to-unknown-mode.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ libkscreen.spec ++++++
--- /var/tmp/diff_new_pack.Mo5csm/_old  2013-09-16 16:12:21.000000000 +0200
+++ /var/tmp/diff_new_pack.Mo5csm/_new  2013-09-16 16:12:21.000000000 +0200
@@ -26,6 +26,8 @@
 Group:          System/GUI/KDE
 Url:            http://www.kde.org
 Source:         
http://download.kde.org/stable/%{name}/%{name}-%{version}.tar.bz2
+# PATCH-FIX-UPSTREAM 
refresh-modes-when-currentModeId-points-to-unknown-mode.patch bnc#840446 
kde#324625
+Patch0:         refresh-modes-when-currentModeId-points-to-unknown-mode.patch
 BuildRequires:  libkde4-devel >= 4.7.0
 BuildRequires:  libqjson-devel >= 0.8.1
 BuildRequires:  pkgconfig(xcb)
@@ -55,6 +57,7 @@
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
   %cmake_kde4 -d build

++++++ refresh-modes-when-currentModeId-points-to-unknown-mode.patch ++++++
commit 1d9ac012e857036bb8814cc84c9cf10bb57ca40c
Author: Dan Vrátil <[email protected]>
Date:   Mon Sep 9 18:43:56 2013 +0200
References: bnc#840446

    Refresh modes when currentModeId points to unknown mode
    
    Sometimes drivers insert or remove modes, so when currentModeId points to a 
mode
    that we don't have cached, we must refresh the local cache.
    
    This also fixes a crash that occured when currentModeId would be pointing 
to a
    mode that we don't have (even after refreshing modes)
    
    REVIEW: 112604
    BUG: 323107
    BUG: 324625
    FIXED-IN: 1.0.2

diff --git a/backends/xrandr/xrandrconfig.cpp b/backends/xrandr/xrandrconfig.cpp
index ff20c79..52beac6 100644
--- a/backends/xrandr/xrandrconfig.cpp
+++ b/backends/xrandr/xrandrconfig.cpp
@@ -163,31 +163,54 @@ void XRandRConfig::applyKScreenConfig(KScreen::Config 
*config)
         }
 
         XRandRMode* currentMode = currentOutput->currentMode();
-        Q_ASSERT_X(currentMode, "applyKScreenConfig", "currentOutput has 
returned a null XRandRMode*");
 
-        QSize size = currentMode->size();
+        // Current output mode can be unlisted - when output size changes to a
+        // resolution that is not listed by xrandr, in some cases the driver 
will
+        // dynamically create a new mode, so we just need to update the list
+        // of modes and try to get a mode matching currentModeId again.
+        // In some cases however re-reading modes from xrandr won't help - in 
that
+        // case we fallback to doing nothing
+        if (!currentMode) {
+            XRROutputInfo *outputInfo = XRandR::XRROutput(currentOutput->id());
+            currentOutput->updateModes(outputInfo);
+            XRRFreeOutputInfo(outputInfo);
+            currentMode = currentOutput->currentMode();
+        }
 
-        int x, y;
+        if (currentMode) {
+            const QSize size = currentMode->size();
+            int x, y;
 
-        //TODO: Move this code within libkscreen
-        y = currentOutput->position().y();
-        if (currentOutput->isHorizontal()) {
-            y += size.height();
-        } else {
-            y += size.width();
-        }
+            //TODO: Move this code within libkscreen
+            y = currentOutput->position().y();
+            if (currentOutput->isHorizontal()) {
+                y += size.height();
+            } else {
+                y += size.width();
+            }
 
-        x = currentOutput->position().x();
-        if (currentOutput->isHorizontal()) {
-            x += size.width();
-        } else {
-            x += size.height();
-        }
+            x = currentOutput->position().x();
+            if (currentOutput->isHorizontal()) {
+                x += size.width();
+            } else {
+                x += size.height();
+            }
 
-        if (x > newSize.width() || y > newSize.height()) {
-            if (!toDisable.contains(output->id())) {
-                kDebug(dXndr()) << "Output doesn't fit: " << x << "x" << y << 
newSize;
-                toDisable.insert(output->id(), output);
+            if (x > newSize.width() || y > newSize.height()) {
+                if (!toDisable.contains(output->id())) {
+                    kDebug(dXndr()) << "Output doesn't fit: " << x << "x" << y 
<< newSize;
+                    toDisable.insert(output->id(), output);
+                }
+            }
+        } else {
+            // Don't update the output
+            toChange.remove(currentOutput->id());
+
+            kWarning() << "Output" << currentOutput->id() << ": Failed to get 
currentMode";
+            kDebug(dXndr()) << "CurrentModeId:" << 
currentOutput->currentModeId();
+            kDebug(dXndr()) << "Available modes:";
+            Q_FOREACH (XRandRMode *mode, currentOutput->modes()) {
+                kDebug(dXndr()) << "\t" << mode->id() << mode->size() << 
mode->refreshRate() << mode->name();
             }
         }
     }//Q_FOREACH(KScreen::Output *output, outputs)
diff --git a/backends/xrandr/xrandrmode.cpp b/backends/xrandr/xrandrmode.cpp
index 0f465ab..bbf6cfe 100644
--- a/backends/xrandr/xrandrmode.cpp
+++ b/backends/xrandr/xrandrmode.cpp
@@ -48,9 +48,24 @@ KScreen::Mode *XRandRMode::toKScreenMode(KScreen::Output 
*parent)
     return kscreenMode;
 }
 
+int XRandRMode::id() const
+{
+    return m_id;
+}
+
 QSize XRandRMode::size() const
 {
     return m_size;
 }
 
+float XRandRMode::refreshRate() const
+{
+    return m_refreshRate;
+}
+
+QString XRandRMode::name() const
+{
+    return m_name;
+}
+
 #include "xrandrmode.moc"
diff --git a/backends/xrandr/xrandrmode.h b/backends/xrandr/xrandrmode.h
index 005db6b..383ef36 100644
--- a/backends/xrandr/xrandrmode.h
+++ b/backends/xrandr/xrandrmode.h
@@ -45,7 +45,11 @@ public:
 
     KScreen::Mode* toKScreenMode(KScreen::Output *parent);
 
+    int id() const;
     QSize size() const;
+    float refreshRate() const;
+    QString name() const;
+
 private:
     int m_id;
     QString m_name;
diff --git a/backends/xrandr/xrandroutput.cpp b/backends/xrandr/xrandroutput.cpp
index 2750385..fdeb2fd 100644
--- a/backends/xrandr/xrandroutput.cpp
+++ b/backends/xrandr/xrandroutput.cpp
@@ -84,6 +84,11 @@ QPoint XRandROutput::position() const
     return m_position;
 }
 
+XRandRMode::Map XRandROutput::modes() const
+{
+    return m_modes;
+}
+
 QString XRandROutput::currentModeId() const
 {
     return m_currentMode;
diff --git a/backends/xrandr/xrandroutput.h b/backends/xrandr/xrandroutput.h
index f50e3e2..3df369c 100644
--- a/backends/xrandr/xrandroutput.h
+++ b/backends/xrandr/xrandroutput.h
@@ -81,6 +81,7 @@ public:
     bool isPrimary() const;
     QPoint position() const;
     QString currentModeId() const;
+    XRandRMode::Map modes() const;
     XRandRMode* currentMode() const;
     KScreen::Output::Rotation rotation() const;
     inline bool isHorizontal() const { return ((m_rotation == 
KScreen::Output::None) || (m_rotation == KScreen::Output::Inverted)); }
@@ -88,9 +89,10 @@ public:
 
     KScreen::Output* toKScreenOutput(KScreen::Config *parent) const;
     void updateKScreenOutput(KScreen::Output *output) const;
+
+    void updateModes(const XRROutputInfo *outputInfo);
 private:
     void updateOutput(const XRROutputInfo *outputInfo);
-    void updateModes(const XRROutputInfo *outputInfo);
     void fetchType();
     KScreen::Output::Type typeFromName();
     QByteArray typeFromProperty() const;
-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to