Hello community, here is the log from the commit of package kdebase4-workspace checked in at Sat Sep 13 10:20:23 CEST 2008. -------- --- KDE/kdebase4-workspace/kdebase4-wallpapers.changes 2008-09-05 23:18:15.000000000 +0200 +++ /mounts/work_src_done/STABLE/kdebase4-workspace/kdebase4-wallpapers.changes 2008-09-13 10:19:12.164884000 +0200 @@ -1,0 +2,26 @@ +Fri Sep 12 14:53:44 CEST 2008 - llunak@suse.cz + +- support for Display key (fate#4147) + +------------------------------------------------------------------- +Thu Sep 11 18:43:41 CEST 2008 - llunak@suse.cz + +- update kwin branch (e.g. bnc#422532) + +------------------------------------------------------------------- +Thu Sep 11 15:18:29 CEST 2008 - llunak@suse.cz + +- disable the patch setting 2 virtual desktops by default + +------------------------------------------------------------------- +Thu Sep 11 13:09:09 CEST 2008 - llunak@suse.cz + +- kcontrol/randr branch for randr12 features and fixes + (e.g. fate#304764) + +------------------------------------------------------------------- +Mon Sep 8 11:50:28 CEST 2008 - stbinner@suse.de + +- update branch diff + +------------------------------------------------------------------- kdebase4-workspace.changes: same change Old: ---- kwin-two-desktops.diff New: ---- randr12.diff ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kdebase4-wallpapers.spec ++++++ --- /var/tmp/diff_new_pack.n18999/_old 2008-09-13 10:20:02.000000000 +0200 +++ /var/tmp/diff_new_pack.n18999/_new 2008-09-13 10:20:02.000000000 +0200 @@ -29,7 +29,7 @@ Summary: KDE 4 Wallpapers Url: http://www.kde.org/ Version: 4.1.1 -Release: 7 +Release: 13 Source0: kdebase-workspace-%version.tar.bz2 BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArch: noarch @@ -66,6 +66,17 @@ /usr/share/wallpapers %changelog +* Fri Sep 12 2008 llunak@suse.cz +- support for Display key (fate#4147) +* Thu Sep 11 2008 llunak@suse.cz +- update kwin branch (e.g. bnc#422532) +* Thu Sep 11 2008 llunak@suse.cz +- disable the patch setting 2 virtual desktops by default +* Thu Sep 11 2008 llunak@suse.cz +- kcontrol/randr branch for randr12 features and fixes + (e.g. fate#304764) +* Mon Sep 08 2008 stbinner@suse.de +- update branch diff * Thu Sep 04 2008 llunak@suse.cz - temporarily disable kwin self-check until the problem is found (bnc#422532) ++++++ kdebase4-workspace.spec ++++++ --- /var/tmp/diff_new_pack.n18999/_old 2008-09-13 10:20:02.000000000 +0200 +++ /var/tmp/diff_new_pack.n18999/_new 2008-09-13 10:20:02.000000000 +0200 @@ -34,7 +34,7 @@ Summary: The KDE Workspace Components Url: http://www.kde.org/ Version: 4.1.1 -Release: 7 +Release: 13 Source0: kdebase-workspace-%version.tar.bz2 Source2: titlebar_decor.png Source3: kwin-cubecap.png @@ -44,7 +44,7 @@ Patch0: 4_1_BRANCH.diff Patch1: plasma.diff Patch8: kwin-suse.diff -Patch10: kwin-two-desktops.diff +#Patch10: kwin-two-desktops.diff Patch18: startkde.diff Patch60: kdm-audit-log.diff Patch61: kdm-consolekit.diff @@ -70,10 +70,14 @@ # https://svn.kde.org/home/kde/branches/work/~seli/kwin11.1 # | sed 's#^--- #--- kwin/#' | sed 's#^+++ #+++ kwin/#' Patch91: kwin.diff +# svn diff https://svn.kde.org/home/kde/branches/KDE/4.1/kdebase/workspace/kcontrol/ran... +# https://svn.kde.org/home/kde/branches/work/~seli/randr +# | sed 's#^--- #--- kcontrol/randr/#' | sed 's#^+++ #+++ kcontrol/randr/#' +Patch92: randr12.diff %kde4_runtime_requires Conflicts: yast2-theme-NLD %if %suse_version > 1030 -Requires: %name-branding = 11.0.42 +Requires: %name-branding = 11.1 %endif Recommends: kdebase4-SuSE Recommends: kde4-kwin @@ -102,7 +106,7 @@ %patch %patch1 %patch8 -%patch10 +#%patch10 %patch18 %patch60 %if %suse_version > 1020 @@ -127,6 +131,7 @@ %patch89 %patch90 %patch91 +%patch92 cp %{SOURCE3} kwin/effects/data/cubecap.png %build @@ -197,8 +202,8 @@ Group: System/GUI/KDE %if %suse_version > 1030 #BRAND: FIXME -Provides: %{name}-branding = 11.0.42 -Supplements: branding-upstream = 11.0.42 +Provides: %{name}-branding = 11.1 +Supplements: branding-upstream = 11.1 %endif %description branding-upstream @@ -223,8 +228,8 @@ Group: System/GUI/KDE %if %suse_version > 1030 #BRAND: FIXME -Provides: %{name}-branding = 11.0.42 -Supplements: branding-upstream = 11.0.42 +Provides: %{name}-branding = 11.1 +Supplements: branding-upstream = 11.1 %endif %description -n kde4-kdm-branding-upstream @@ -278,7 +283,7 @@ Summary: KDE Window Manager %kde4_runtime_requires %if %suse_version >1030 -Requires: %{name}-branding = 11.0.42 +Requires: %{name}-branding = 11.1 %endif %description -n kde4-kwin @@ -731,8 +736,21 @@ /usr/share/icons/Oxygen_Zion_Big /usr/%_lib/kconf_update_bin/plasma-add-shortcut-to-menu /usr/share/kde4/apps/kconf_update/plasma-add-shortcut-to-menu.upd +%_libdir/kde4/kded_randrmonitor.so +%_kde_share_dir/services/kded/randrmonitor.desktop %changelog +* Fri Sep 12 2008 llunak@suse.cz +- support for Display key (fate#4147) +* Thu Sep 11 2008 llunak@suse.cz +- update kwin branch (e.g. bnc#422532) +* Thu Sep 11 2008 llunak@suse.cz +- disable the patch setting 2 virtual desktops by default +* Thu Sep 11 2008 llunak@suse.cz +- kcontrol/randr branch for randr12 features and fixes + (e.g. fate#304764) +* Mon Sep 08 2008 stbinner@suse.de +- update branch diff * Thu Sep 04 2008 llunak@suse.cz - temporarily disable kwin self-check until the problem is found (bnc#422532) ++++++ 4_1_BRANCH.diff ++++++ ++++ 1256 lines (skipped) ++++ between KDE/kdebase4-workspace/4_1_BRANCH.diff ++++ and /mounts/work_src_done/STABLE/kdebase4-workspace/4_1_BRANCH.diff ++++++ kwin.diff ++++++ ++++ 1989 lines (skipped) ++++ between KDE/kdebase4-workspace/kwin.diff ++++ and /mounts/work_src_done/STABLE/kdebase4-workspace/kwin.diff ++++++ randr12.diff ++++++ Index: randrconfig.h =================================================================== --- kcontrol/randr/randrconfig.h (.../KDE/4.1/kdebase/workspace/kcontrol/randr) (revision 860259) +++ kcontrol/randr/randrconfig.h (.../work/~seli/randr) (revision 860259) @@ -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); @@ -70,6 +73,8 @@ QList<CollapsibleWidget*> m_outputList; QGraphicsScene *m_scene; LayoutManager *m_layoutManager; + QList<QWidget*> m_indicators; + QTimer identifyTimer; }; Index: krandrtray.cpp =================================================================== --- kcontrol/randr/krandrtray.cpp (.../KDE/4.1/kdebase/workspace/kcontrol/randr) (revision 860259) +++ kcontrol/randr/krandrtray.cpp (.../work/~seli/randr) (revision 860259) @@ -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 860259) +++ kcontrol/randr/randrconfigbase.ui (.../work/~seli/randr) (revision 860259) @@ -12,22 +12,33 @@ <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="MinimumExpanding" > + <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" /> Index: CMakeLists.txt =================================================================== --- kcontrol/randr/CMakeLists.txt (.../KDE/4.1/kdebase/workspace/kcontrol/randr) (revision 860259) +++ kcontrol/randr/CMakeLists.txt (.../work/~seli/randr) (revision 860259) @@ -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 860259) +++ kcontrol/randr/randrconfig.cpp (.../work/~seli/randr) (revision 860259) @@ -28,6 +28,8 @@ #include "randrdisplay.h" #include "randrscreen.h" +#include <kglobalsettings.h> + RandRConfig::RandRConfig(QWidget *parent, RandRDisplay *display) : QWidget(parent), Ui::RandRConfigBase() { @@ -44,6 +46,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 +68,7 @@ RandRConfig::~RandRConfig() { + clearIndicators(); } void RandRConfig::load(void) @@ -219,5 +226,48 @@ 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(); +} + #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 860259) @@ -0,0 +1,163 @@ +/******************************************************************** + +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> + +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 ); + // HACK: see poll() + QTimer* timer = new QTimer( this ); + timer->start( 10000 ); // 10 s + connect( timer, SIGNAL( timeout()), this, SLOT( poll())); + 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->setShortcut( 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() + { + // TODO + } + +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 860259) @@ -0,0 +1,74 @@ +/******************************************************************** + +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 <qwidget.h> + +#include <X11/Xlib.h> +#include <X11/extensions/Xrandr.h> +#include <fixx11h.h> + +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; + 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 860259) @@ -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 860259) @@ -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 860259) @@ -0,0 +1,13 @@ +########### next target ############### + +set(kded_randrmonitor_PART_SRCS randrmonitor.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 860259) @@ -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 ); + } ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Remember to have fun... --------------------------------------------------------------------- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org