File randr12.diff of Package kdebase4-workspace

Index: randrconfig.h
===================================================================
--- kcontrol/randr/randrconfig.h	(.../KDE/4.1/kdebase/workspace/kcontrol/randr)	(revision 879729)
+++ kcontrol/randr/randrconfig.h	(.../work/~seli/randr)	(revision 879729)
@@ -24,6 +24,7 @@
 #include "randr.h"
 
 #include <QWidget>
+#include <QTimer>
 
 class QGraphicsScene;
 class SettingsContainer;
@@ -54,6 +55,8 @@
 protected slots:
 	void slotChanged(void);
 	void slotAdjustOutput(OutputGraphicsItem *o);
+	void identifyOutputs();
+	void clearIndicators();
 
 signals:
 	void changed(bool change);
@@ -62,6 +65,7 @@
 	virtual void resizeEvent(QResizeEvent *event);
 	
 private:
+        void insufficientVirtualSize();
 	RandRDisplay *m_display;
 	bool m_changed;
 	bool m_firstLoad;
@@ -70,6 +74,8 @@
 	QList<CollapsibleWidget*> m_outputList;
 	QGraphicsScene *m_scene;
 	LayoutManager *m_layoutManager;
+	QList<QWidget*> m_indicators;
+	QTimer identifyTimer;
 };
 
 
Index: layoutmanager.cpp
===================================================================
--- kcontrol/randr/layoutmanager.cpp	(.../KDE/4.1/kdebase/workspace/kcontrol/randr)	(revision 879729)
+++ kcontrol/randr/layoutmanager.cpp	(.../work/~seli/randr)	(revision 879729)
@@ -148,3 +148,13 @@
 	}
 	
 }
+
+GraphicsView::GraphicsView( QWidget* parent )
+    : QGraphicsView( parent )
+    {
+    }
+
+QSize GraphicsView::sizeHint() const
+    {
+    return QSize( 200, 200 );
+    }
Index: krandrtray.cpp
===================================================================
--- kcontrol/randr/krandrtray.cpp	(.../KDE/4.1/kdebase/workspace/kcontrol/randr)	(revision 879729)
+++ kcontrol/randr/krandrtray.cpp	(.../work/~seli/randr)	(revision 879729)
@@ -468,4 +468,5 @@
 	kcm->setPlainCaption( i18n( "Configure Display" ) );
 	kcm->addModule( "display" );
 	kcm->exec();
+	delete kcm;
 }
Index: randrconfigbase.ui
===================================================================
--- kcontrol/randr/randrconfigbase.ui	(.../KDE/4.1/kdebase/workspace/kcontrol/randr)	(revision 879729)
+++ kcontrol/randr/randrconfigbase.ui	(.../work/~seli/randr)	(revision 879729)
@@ -12,28 +12,46 @@
   <property name="windowTitle" >
    <string>Display Configuration (X11 Resize, Rotate and Reflect)</string>
   </property>
-  <layout class="QHBoxLayout" >
+  <layout class="QHBoxLayout" name="horizontalLayout" >
    <item>
-    <widget class="QWidget" native="1" name="outputList" >
-     <property name="sizePolicy" >
-      <sizepolicy vsizetype="Expanding" hsizetype="MinimumExpanding" >
-       <horstretch>0</horstretch>
-       <verstretch>0</verstretch>
-      </sizepolicy>
-     </property>
-     <property name="minimumSize" >
-      <size>
-       <width>150</width>
-       <height>0</height>
-      </size>
-     </property>
-    </widget>
+    <layout class="QVBoxLayout" name="verticalLayout" >
+     <item>
+      <widget class="QWidget" native="1" name="outputList" >
+       <property name="sizePolicy" >
+        <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="minimumSize" >
+        <size>
+         <width>150</width>
+         <height>0</height>
+        </size>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="identifyOutputsButton" >
+       <property name="text" >
+        <string>Identify Outputs</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
    </item>
    <item>
-    <widget class="QGraphicsView" name="screenView" />
+    <widget class="GraphicsView" name="screenView" />
    </item>
   </layout>
  </widget>
+ <customwidgets>
+  <customwidget>
+   <class>GraphicsView</class>
+   <extends>QGraphicsView</extends>
+   <header>layoutmanager.h</header>
+  </customwidget>
+ </customwidgets>
  <resources/>
  <connections/>
 </ui>
Index: CMakeLists.txt
===================================================================
--- kcontrol/randr/CMakeLists.txt	(.../KDE/4.1/kdebase/workspace/kcontrol/randr)	(revision 879729)
+++ kcontrol/randr/CMakeLists.txt	(.../work/~seli/randr)	(revision 879729)
@@ -1,5 +1,9 @@
 include_directories( ${X11_Xrandr_INCLUDE_PATH}  )
 
+if( XRANDR_1_2_FOUND )
+    macro_optional_add_subdirectory(module)
+endif( XRANDR_1_2_FOUND )
+
 configure_file (config-randr.h.cmake
 ${CMAKE_CURRENT_BINARY_DIR}/config-randr.h )
 
Index: randrconfig.cpp
===================================================================
--- kcontrol/randr/randrconfig.cpp	(.../KDE/4.1/kdebase/workspace/kcontrol/randr)	(revision 879729)
+++ kcontrol/randr/randrconfig.cpp	(.../work/~seli/randr)	(revision 879729)
@@ -28,6 +28,10 @@
 #include "randrdisplay.h"
 #include "randrscreen.h"
 
+#include <kglobalsettings.h>
+#include <kmessagebox.h>
+#include <kprocess.h>
+
 RandRConfig::RandRConfig(QWidget *parent, RandRDisplay *display)
 	: QWidget(parent), Ui::RandRConfigBase()
 {
@@ -44,6 +48,10 @@
 
 	setupUi(this);
 
+	connect( identifyOutputsButton, SIGNAL( clicked()), SLOT( identifyOutputs()));
+	connect( &identifyTimer, SIGNAL( timeout()), SLOT( clearIndicators()));
+	identifyTimer.setSingleShot( true );
+
 	// create the container for the settings widget
 	QHBoxLayout *layout = new QHBoxLayout(outputList);
 	layout->setSpacing(0);
@@ -62,6 +70,7 @@
 
 RandRConfig::~RandRConfig()
 {
+	clearIndicators();
 }
 
 void RandRConfig::load(void)
@@ -219,5 +228,66 @@
 	screenView->setSceneRect(r);
 }
 
+uint qHash( const QPoint& p )
+{
+	return p.x() * 10000 + p.y();
+}
+
+void RandRConfig::identifyOutputs()
+{
+	identifyTimer.stop();
+	clearIndicators();
+	QHash< QPoint, QStringList > ids; // outputs at centers of screens (can be more in case of clone mode)
+	OutputMap outputs = m_display->currentScreen()->outputs();
+	foreach(RandROutput *output, outputs)
+	{
+		if( !output->isConnected() || output->rect().isEmpty())
+			continue;
+		ids[ output->rect().center() ].append( output->name());
+	}
+	for( QHash< QPoint, QStringList >::ConstIterator it = ids.begin();
+	     it != ids.end();
+	     ++it )
+	{
+		QLabel *si = new QLabel(it->join("\n"), NULL, Qt::X11BypassWindowManagerHint);
+		QFont fnt = KGlobalSettings::generalFont();
+		fnt.setPixelSize(100);
+		si->setFont(fnt);
+		si->setFrameStyle(QFrame::Panel);
+		si->setFrameShadow(QFrame::Plain);
+		si->setAlignment(Qt::AlignCenter);
+		QRect targetGeometry(QPoint(0,0), si->sizeHint());
+	        targetGeometry.moveCenter(it.key());
+		si->setGeometry(targetGeometry);
+		si->show();
+	        m_indicators.append( si );
+	}
+	identifyTimer.start( 1500 );
+}
+
+void RandRConfig::clearIndicators()
+{
+	qDeleteAll( m_indicators );
+	m_indicators.clear();
+}
+
+void RandRConfig::insufficientVirtualSize()
+{
+    if( KMessageBox::questionYesNo( this,
+        i18n( "Insufficient virtual size for the total screen size.\n"
+              "The configured virtual size of your X server is insufficient for this setup. "
+              "This configuration needs to be adjusted.\n"
+              "Do you wish to run a tool to adjust the configuration?" )) == KMessageBox::Yes )
+        {
+        KProcess proc;
+        // TODO
+        if( proc.execute() == 0 )
+            KMessageBox::information( this, i18n( "Configuration has been adjusted. Please restart "
+                "your session for this change to take effect." ));
+        else
+            KMessageBox::sorry( this, i18n( "Changing configuration failed. Please adjust your xorg.conf manually." ));
+        }
+}
+
 #include "randrconfig.moc"
 
Index: module/randrmonitor.cpp
===================================================================
--- kcontrol/randr/module/randrmonitor.cpp	(.../KDE/4.1/kdebase/workspace/kcontrol/randr)	(revision 0)
+++ kcontrol/randr/module/randrmonitor.cpp	(.../work/~seli/randr)	(revision 879729)
@@ -0,0 +1,210 @@
+/********************************************************************
+
+Copyright (C) 2008 Lubos Lunak <l.lunak@suse.cz>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*********************************************************************/
+
+#include "randrmonitor.h"
+
+#include <kaction.h>
+#include <kactioncollection.h>
+#include <kapplication.h>
+#include <kdebug.h>
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kpluginfactory.h>
+#include <kpluginloader.h>
+#include <ktoolinvocation.h>
+
+#include <qdbusconnection.h>
+#include <qdbusconnectioninterface.h>
+#include <qtimer.h>
+#include <qx11info_x11.h>
+
+#include <randrdisplay.h>
+#include <randrscreen.h>
+#include <randroutput.h>
+
+K_PLUGIN_FACTORY(RandrMonitorModuleFactory,
+                 registerPlugin<RandrMonitorModule>();
+    )
+K_EXPORT_PLUGIN(RandrMonitorModuleFactory("randrmonitor"))
+
+RandrMonitorModule::RandrMonitorModule( QObject* parent, const QList<QVariant>& )
+    : KDEDModule( parent )
+    , have_randr( false )
+    {
+    setModuleName( "randrmonitor" );
+    initRandr();
+    }
+
+RandrMonitorModule::~RandrMonitorModule()
+    {
+    if( have_randr )
+        {
+        Display* dpy = QX11Info::display();
+        XDestroyWindow( dpy, window );
+        delete helper;
+        delete dialog;
+        have_randr = false;
+        }
+    }
+
+void RandrMonitorModule::initRandr()
+    {
+    Display* dpy = QX11Info::display();
+    if( !XRRQueryExtension( dpy, &randr_base, &randr_error ))
+        return;
+    int major = 1;
+    int minor = 2;
+    if( !XRRQueryVersion( dpy, &major, &minor ) || major < 1 || (major == 1 && minor < 2 ))
+        return;
+    have_randr = true;
+    // It looks like we need a separate window for getting the events, so that we don't
+    // change e.g. Qt's event mask.
+    window = XCreateSimpleWindow( dpy, DefaultRootWindow( dpy ), 0, 0, 1, 1, 0, 0, 0 );
+    XRRSelectInput( dpy, window, RROutputChangeNotifyMask );
+#if 0 // xrandr apparently can't detect hw changes and on some systems polling freezes X :(
+    // HACK: see poll()
+    QTimer* timer = new QTimer( this );
+    timer->start( 10000 ); // 10 s
+    connect( timer, SIGNAL( timeout()), this, SLOT( poll()));
+#endif
+    helper = new RandrMonitorHelper( this );
+    kapp->installX11EventFilter( helper );
+    dialog = NULL;
+    currentMonitors = connectedMonitors();
+    KActionCollection* coll = new KActionCollection( this );
+    KAction* act = coll->addAction( "display" );
+    act->setText( i18n( "Switch Display" ));
+    act->setGlobalShortcut( KShortcut( Qt::Key_Display ));
+    connect( act, SIGNAL( triggered( bool )), SLOT( switchDisplay()));
+    }
+
+void RandrMonitorModule::poll()
+    {
+    // HACK: It seems that RRNotify/RRNotify_OutputChange event (i.e. detecting a newly
+    // plugged or unplugged monitor) does not work without polling some randr functionality.
+    int dummy;
+    XRRGetScreenSizeRange( QX11Info::display(), window, &dummy, &dummy, &dummy, &dummy );
+    }
+
+void RandrMonitorModule::processX11Event( XEvent* e )
+    {
+    if( e->xany.type == randr_base + RRNotify )
+        {
+        XRRNotifyEvent* e2 = reinterpret_cast< XRRNotifyEvent* >( e );
+        if( e2->subtype == RRNotify_OutputChange ) // TODO && e2->window == window )
+            {
+            kDebug() << "Monitor change detected";
+            QStringList newMonitors = connectedMonitors();
+            if( newMonitors == currentMonitors )
+                return;
+            if( QDBusConnection::sessionBus().interface()->isServiceRegistered(
+                "org.kde.internal.KSettingsWidget-kcm_display" ))
+                { // already running
+                return;
+                }
+            kapp->updateUserTimestamp(); // well, let's say plugging in a monitor is a user activity
+#warning Modal dialog, stupid, fix.
+            QString change;
+            QString question =
+                ( newMonitors.count() < currentMonitors.count()
+                    ? i18n( "A monitor output has been disconnected." )
+                    : i18n( "A new monitor output has been connected." ))
+                + "\n\n" + i18n( "Do you wish to run a configuration tool to adjust the monitor setup?" );
+            currentMonitors = newMonitors;
+            if( KMessageBox::questionYesNo( NULL, question, i18n( "Monitor setup has changed" ),
+                    KGuiItem( "Con&figure" ), KGuiItem( "&Ignore" ), "randrmonitorchange" )
+                == KMessageBox::Yes )
+                {
+                KToolInvocation::kdeinitExec( "kcmshell4", QStringList() << "display" );
+                }
+            }
+        }
+    }
+
+QStringList RandrMonitorModule::connectedMonitors() const
+    {
+    QStringList ret;
+    Display* dpy = QX11Info::display();
+    XRRScreenResources* resources = XRRGetScreenResources( dpy, window );
+    for( int i = 0;
+         i < resources->noutput;
+         ++i )
+        {
+        XRROutputInfo* info = XRRGetOutputInfo( dpy, resources, resources->outputs[ i ] );
+        QString name = QString::fromUtf8( info->name );
+        if( info->connection == RR_Connected )
+            ret.append( name );
+        XRRFreeOutputInfo( info );
+        }
+    XRRFreeScreenResources( resources );
+    return ret;
+    }
+
+void RandrMonitorModule::switchDisplay()
+    {
+    QList< RandROutput* > outputs;
+    RandRDisplay display;
+    for( int scr = 0;
+         scr < display.numScreens();
+         ++scr )
+        {
+        foreach( RandROutput* output, display.screen( scr )->outputs())
+            {
+            if( !output->isConnected())
+                continue;
+            if( !outputs.contains( output ))
+                outputs.append( output );
+            }
+        }
+    if( outputs.count() <= 1 ) // just one, do nothing
+        return;
+    if( outputs.count() == 2 ) // alternative between one, second, both
+        {
+        if( outputs[ 0 ]->isActive() && !outputs[ 1 ]->isActive())
+            {
+            enableOutput( outputs[ 1 ], true );
+            enableOutput( outputs[ 0 ], false );
+            }
+        else if( !outputs[ 0 ]->isActive() && outputs[ 1 ]->isActive())
+            {
+            enableOutput( outputs[ 1 ], true );
+            enableOutput( outputs[ 0 ], true );
+            }
+        else
+            {
+            enableOutput( outputs[ 0 ], true );
+            enableOutput( outputs[ 1 ], false );
+            }
+        return;
+        }
+    // no idea what to do here
+    KToolInvocation::kdeinitExec( "kcmshell4", QStringList() << "display" );
+    }
+
+void RandrMonitorModule::enableOutput( RandROutput* output, bool enable )
+    { // a bit lame, but I don't know how to do this easily with this codebase :-/
+    KProcess::execute( QStringList() << "xrandr" << "--output" << output->name() << ( enable ? "--auto" : "--off" ));
+    }
+
+bool RandrMonitorHelper::x11Event( XEvent* e )
+    {
+    module->processX11Event( e );
+    return QWidget::x11Event( e );
+    }
+
+#include "randrmonitor.moc"
Index: module/randrmonitor.h
===================================================================
--- kcontrol/randr/module/randrmonitor.h	(.../KDE/4.1/kdebase/workspace/kcontrol/randr)	(revision 0)
+++ kcontrol/randr/module/randrmonitor.h	(.../work/~seli/randr)	(revision 879729)
@@ -0,0 +1,78 @@
+/********************************************************************
+
+Copyright (C) 2008 Lubos Lunak <l.lunak@suse.cz>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*********************************************************************/
+
+#ifndef RANDRMONITOR_H
+#define RANDRMONITOR_H
+
+#include <kdedmodule.h>
+#include <kprocess.h>
+#include <qwidget.h>
+
+#include <X11/Xlib.h>
+#include <X11/extensions/Xrandr.h>
+#include <fixx11h.h>
+
+class RandROutput;
+
+class RandrMonitorHelper;
+
+class RandrMonitorModule
+    : public KDEDModule
+    {
+    Q_OBJECT
+    public:
+        RandrMonitorModule(QObject* parent, const QList<QVariant>&);
+        virtual ~RandrMonitorModule();
+        void processX11Event( XEvent* e );
+    private slots:
+        void poll();
+        void switchDisplay();
+    private:
+        void initRandr();
+        void getRandrInfo( XRROutputChangeNotifyEvent* e, QString* change, QRect* rect );
+        QStringList connectedMonitors() const;
+        void enableOutput( RandROutput* output, bool enable );
+        bool have_randr;
+        int randr_base;
+        int randr_error;
+        Window window;
+        QStringList currentMonitors;
+        RandrMonitorHelper* helper;
+        QDialog* dialog;
+    };
+
+class RandrMonitorHelper
+    : public QWidget
+    {
+    Q_OBJECT
+    public:
+        RandrMonitorHelper( RandrMonitorModule* module );
+    protected:
+        virtual bool x11Event( XEvent* e );
+    private:
+        RandrMonitorModule* module;
+    };
+
+
+inline
+RandrMonitorHelper::RandrMonitorHelper( RandrMonitorModule* m )
+    : module( m )
+    {
+    }
+
+#endif
Index: module/TODO
===================================================================
--- kcontrol/randr/module/TODO	(.../KDE/4.1/kdebase/workspace/kcontrol/randr)	(revision 0)
+++ kcontrol/randr/module/TODO	(.../work/~seli/randr)	(revision 879729)
@@ -0,0 +1,7 @@
+- zrusit ten modalni dialog
+- zkontrolovat, ze tohle opravdu nerusi randr eventmask pro Qt
+    - plus zkontrolovat, jak se tedy pouziva to window pro events
+- musi se dialog zobrazit na spravnem monitoru (tj. ne na vypnutem)
+- Hidden[$e]= v .desktop nefunguje
+- kdyz se detekuje zmena, kcm sam o sobe nic(?) neudela, takze musi byt nejake 'suggest'?
+- zkontrolovat nastaveni po startu KDE
Index: module/randrmonitor.desktop
===================================================================
--- kcontrol/randr/module/randrmonitor.desktop	(.../KDE/4.1/kdebase/workspace/kcontrol/randr)	(revision 0)
+++ kcontrol/randr/module/randrmonitor.desktop	(.../work/~seli/randr)	(revision 879729)
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Name=Detecting RANDR (monitor) changes
+Type=Service
+X-KDE-ServiceTypes=KDEDModule
+X-KDE-Library=randrmonitor
+X-KDE-DBus-ModuleName=randrmonitor
+X-KDE-Kded-autoload=true
+OnlyShowIn=KDE;
Index: module/CMakeLists.txt
===================================================================
--- kcontrol/randr/module/CMakeLists.txt	(.../KDE/4.1/kdebase/workspace/kcontrol/randr)	(revision 0)
+++ kcontrol/randr/module/CMakeLists.txt	(.../work/~seli/randr)	(revision 879729)
@@ -0,0 +1,25 @@
+include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR}/.. )
+
+########### next target ###############
+
+set(kded_randrmonitor_PART_SRCS
+    randrmonitor.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/../randrdisplay.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/../randrscreen.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/../randroutput.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/../randrcrtc.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/../randrmode.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/../randr.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/../legacyrandrscreen.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/../ktimerdialog.cpp
+    )
+
+kde4_add_plugin(kded_randrmonitor ${kded_randrmonitor_PART_SRCS})
+
+target_link_libraries(kded_randrmonitor ${KDE4_KDEUI_LIBS} ${X11_Xrandr_LIB} ${X11_LIBRARIES})
+
+install(TARGETS kded_randrmonitor  DESTINATION ${PLUGIN_INSTALL_DIR} )
+
+########### install files ###############
+
+install( FILES randrmonitor.desktop  DESTINATION  ${SERVICES_INSTALL_DIR}/kded )
Index: module/randrpolltest.cpp
===================================================================
--- kcontrol/randr/module/randrpolltest.cpp	(.../KDE/4.1/kdebase/workspace/kcontrol/randr)	(revision 0)
+++ kcontrol/randr/module/randrpolltest.cpp	(.../work/~seli/randr)	(revision 879729)
@@ -0,0 +1,63 @@
+#include <X11/Xlib.h>
+#include <X11/extensions/Xrandr.h>
+#include <stdio.h>
+#include <unistd.h>
+
+int main( int argc, char* argv[] )
+    {
+    Display* dpy = XOpenDisplay( NULL );
+    XSetWindowAttributes attrs;
+    Window w = XCreateWindow( dpy, DefaultRootWindow( dpy ), 0, 0, 100, 100, 0, CopyFromParent, CopyFromParent,
+        CopyFromParent, 0, &attrs );
+//    XMapWindow( dpy, w );
+    int base, error;
+    if( !XRRQueryExtension( dpy, &base, &error ))
+        return 1;
+    int major = 1;
+    int minor = 2;
+    if( !XRRQueryVersion( dpy, &major, &minor ) || major < 1 || (major == 1 && minor < 2 ))
+        return 2;
+    XRRSelectInput( dpy, w,
+        RRScreenChangeNotifyMask | RRCrtcChangeNotifyMask | RROutputChangeNotifyMask | RROutputPropertyNotifyMask );
+    for(;;)
+        {
+        XEvent ev;
+        int a, b, c, d;
+        static int cnt = 0;
+        if( ++cnt % 30 == 0 )
+            {
+//            XRRFreeScreenResources(XRRGetScreenResources( dpy, w ));
+            XRRGetScreenSizeRange( dpy, w, &a, &b, &c, &d );
+//            XSync( dpy, False );
+            printf( "Poll\n" );
+            }
+        sleep( 1 );
+        if( !XPending( dpy ))
+            continue;
+        XNextEvent( dpy, &ev );
+        if( ev.xany.type == base + RRScreenChangeNotify )
+            {
+            printf( "Screen Change\n" );
+            }
+        if( ev.xany.type == base + RRNotify )
+            {
+            XRRNotifyEvent* e = reinterpret_cast< XRRNotifyEvent* >( &ev );
+            switch( e->subtype )
+                {
+                case RRNotify_CrtcChange:
+                    printf( "Crtc Change\n" );
+                    break;
+                case RRNotify_OutputChange:
+                    printf( "Output Change\n" );
+                    break;
+                case RRNotify_OutputProperty:
+                    printf( "Output Property Change\n" );
+                    break;
+                default:
+                    printf( "Unknown Notify\n" );
+                    break;
+                }
+            }
+        }
+    XCloseDisplay( dpy );
+    }
Index: randrscreen.cpp
===================================================================
--- kcontrol/randr/randrscreen.cpp	(.../KDE/4.1/kdebase/workspace/kcontrol/randr)	(revision 879729)
+++ kcontrol/randr/randrscreen.cpp	(.../work/~seli/randr)	(revision 879729)
@@ -389,7 +389,7 @@
 	m_unifiedRect = group.readEntry("UnifiedRect", QRect());
 	m_unifiedRotation = group.readEntry("UnifiedRotation", (int) RandR::Rotate0);
 
-	slotUnifyOutputs(m_outputsUnified);
+//	slotUnifyOutputs(m_outputsUnified);
 
 	foreach(RandROutput *output, m_outputs)
 	{
Index: BRANCH
===================================================================
--- kcontrol/randr/BRANCH	(.../KDE/4.1/kdebase/workspace/kcontrol/randr)	(revision 0)
+++ kcontrol/randr/BRANCH	(.../work/~seli/randr)	(revision 879729)
@@ -0,0 +1 @@
+last sync: r878939
Index: layoutmanager.h
===================================================================
--- kcontrol/randr/layoutmanager.h	(.../KDE/4.1/kdebase/workspace/kcontrol/randr)	(revision 879729)
+++ kcontrol/randr/layoutmanager.h	(.../work/~seli/randr)	(revision 879729)
@@ -21,6 +21,7 @@
 
 #include <QObject>
 #include "randr.h"
+#include <qgraphicsview.h>
 
 class RandRScreen;
 class QGraphicsScene;
@@ -45,4 +46,12 @@
 
 };
 
+class GraphicsView : public QGraphicsView
+{
+    Q_OBJECT
+public:
+    GraphicsView( QWidget* parent );
+    virtual QSize sizeHint() const;
+};
+
 #endif
openSUSE Build Service is sponsored by