summaryrefslogtreecommitdiffstats
path: root/kcontrol/randr
diff options
context:
space:
mode:
Diffstat (limited to 'kcontrol/randr')
-rw-r--r--kcontrol/randr/CMakeLists.txt47
-rw-r--r--kcontrol/randr/Makefile.am36
-rw-r--r--kcontrol/randr/TODO14
-rw-r--r--kcontrol/randr/configdialog.cpp87
-rw-r--r--kcontrol/randr/configdialog.h88
-rw-r--r--kcontrol/randr/configure.in.in18
-rw-r--r--kcontrol/randr/ktimerdialog.cpp205
-rw-r--r--kcontrol/randr/ktimerdialog.h170
-rw-r--r--kcontrol/randr/main.cpp52
-rw-r--r--kcontrol/randr/randr.desktop216
-rw-r--r--kcontrol/randr/tderandrapp.cpp47
-rw-r--r--kcontrol/randr/tderandrapp.h44
-rw-r--r--kcontrol/randr/tderandrbindings.cpp34
-rw-r--r--kcontrol/randr/tderandrinithack.cpp1
-rw-r--r--kcontrol/randr/tderandrmodule.cpp365
-rw-r--r--kcontrol/randr/tderandrmodule.h68
-rw-r--r--kcontrol/randr/tderandrpassivepopup.cpp118
-rw-r--r--kcontrol/randr/tderandrpassivepopup.h47
-rw-r--r--kcontrol/randr/tderandrtray-autostart.desktop144
-rw-r--r--kcontrol/randr/tderandrtray.cpp908
-rw-r--r--kcontrol/randr/tderandrtray.desktop142
-rw-r--r--kcontrol/randr/tderandrtray.h101
22 files changed, 2952 insertions, 0 deletions
diff --git a/kcontrol/randr/CMakeLists.txt b/kcontrol/randr/CMakeLists.txt
new file mode 100644
index 000000000..d1f31af8c
--- /dev/null
+++ b/kcontrol/randr/CMakeLists.txt
@@ -0,0 +1,47 @@
+#################################################
+#
+# (C) 2010-2011 Serghei Amelian
+# serghei (DOT) amelian (AT) gmail.com
+#
+# Improvements and feedback are welcome
+#
+# This file is released under GPL >= 2
+#
+#################################################
+
+include_directories(
+ ${CMAKE_CURRENT_BINARY_DIR}
+ ${TDE_INCLUDE_DIR}
+ ${TQT_INCLUDE_DIRS}
+)
+
+link_directories(
+ ${TQT_LIBRARY_DIRS}
+)
+
+
+##### other data ################################
+
+install( FILES tderandrtray.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
+install( FILES randr.desktop DESTINATION ${APPS_INSTALL_DIR}/.hidden )
+install( FILES tderandrtray-autostart.desktop DESTINATION ${AUTOSTART_INSTALL_DIR} )
+
+
+##### kcm_randr (module) ########################
+
+tde_add_kpart( kcm_randr AUTOMOC
+ SOURCES tderandrmodule.cpp
+ LINK tdeui-shared tderandr-shared
+ DESTINATION ${PLUGIN_INSTALL_DIR}
+)
+
+
+##### tderandrtray (executable) ###################
+
+tde_add_executable( tderandrtray AUTOMOC
+ SOURCES
+ main.cpp tderandrtray.cpp tderandrapp.cpp
+ tderandrpassivepopup.cpp configdialog.cpp
+ LINK tdeutils-shared tderandr-shared
+ DESTINATION ${BIN_INSTALL_DIR}
+)
diff --git a/kcontrol/randr/Makefile.am b/kcontrol/randr/Makefile.am
new file mode 100644
index 000000000..cb28fd1c2
--- /dev/null
+++ b/kcontrol/randr/Makefile.am
@@ -0,0 +1,36 @@
+AM_CPPFLAGS = $(all_includes)
+
+lib_LTLIBRARIES =
+kde_module_LTLIBRARIES = kcm_randr.la
+
+METASOURCES = AUTO
+
+kcm_randr_la_SOURCES = tderandrmodule.cpp
+kcm_randr_la_LDFLAGS = -module -avoid-version $(all_libraries) -no-undefined
+kcm_randr_la_LIBADD = $(LIB_TDEUI) $(LIB_XRANDR)
+
+noinst_HEADERS = tderandrmodule.h tderandrtray.h tderandrapp.h \
+ tderandrpassivepopup.h configdialog.h
+
+xdg_apps_DATA = tderandrtray.desktop
+
+tderandr_data_DATA = randr.desktop
+tderandr_datadir = $(kde_appsdir)/.hidden
+
+# Autostart
+autostartdir = $(prefix)/share/autostart
+autostart_DATA = tderandrtray-autostart.desktop
+
+#install-data-local: uninstall.desktop
+# $(mkinstalldirs) $(DESTDIR)$(kde_appsdir)/Settings/Desktop
+# $(INSTALL_DATA) $(srcdir)/uninstall.desktop
+# $(DESTDIR)$(kde_appsdir)/Settings/Desktop/tderandrmodule.desktop
+
+bin_PROGRAMS = tderandrtray
+
+tderandrtray_SOURCES = main.cpp tderandrtray.cpp tderandrapp.cpp tderandrpassivepopup.cpp configdialog.cpp
+tderandrtray_LDFLAGS = $(all_libraries) $(KDE_RPATH) -ltderandr
+tderandrtray_LDADD = $(LIB_TDEFILE) $(LIB_TDEUTILS) $(LIB_XRANDR)
+
+messages: rc.cpp
+ $(XGETTEXT) *.cpp -o $(podir)/tderandr.pot
diff --git a/kcontrol/randr/TODO b/kcontrol/randr/TODO
new file mode 100644
index 000000000..1b7e03c3b
--- /dev/null
+++ b/kcontrol/randr/TODO
@@ -0,0 +1,14 @@
+Remaining known issues
+
+General
+ Not tested with multiple screens (but should support them)
+
+Qt
+ Font sizes on newly started apps after a resolution change are incorrect
+ This doesn't appear to happen with non-Xft font rendering, Xft/Qt interaction?
+
+Kwin
+ Support different sized virtual desktops
+
+RandR programs
+ Support configuring different sized virtual desktops
diff --git a/kcontrol/randr/configdialog.cpp b/kcontrol/randr/configdialog.cpp
new file mode 100644
index 000000000..5ed71aa6d
--- /dev/null
+++ b/kcontrol/randr/configdialog.cpp
@@ -0,0 +1,87 @@
+// -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*-
+/* This file is part of the KDE project
+ Copyright (C) 2000 by Carsten Pfeiffer <[email protected]>
+
+ 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; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqlistview.h>
+#include <tqpushbutton.h>
+#include <tqtooltip.h>
+#include <tqwhatsthis.h>
+#include <tqvbuttongroup.h>
+#include <assert.h>
+
+#include <kiconloader.h>
+#include <tdelocale.h>
+#include <tdepopupmenu.h>
+#include <twinmodule.h>
+#include <kregexpeditorinterface.h>
+#include <tdeparts/componentfactory.h>
+
+#include "configdialog.h"
+
+ConfigDialog::ConfigDialog(TDEGlobalAccel *accel,
+ bool isApplet )
+ : KDialogBase( Tabbed, i18n("Configure"),
+ Ok | Cancel | Help,
+ Ok, 0L, "config dialog" )
+{
+ if ( isApplet )
+ setHelp( TQString::null, "tderandrtray" );
+
+ TQFrame *w = 0L; // the parent for the widgets
+
+ w = addVBoxPage( i18n("Global &Shortcuts") );
+ keysWidget = new KKeyChooser( accel, w );
+}
+
+
+ConfigDialog::~ConfigDialog()
+{
+}
+
+// prevent huge size due to long regexps in the action-widget
+void ConfigDialog::show()
+{
+ if ( !isVisible() ) {
+ KWinModule module(0, KWinModule::INFO_DESKTOP);
+ TQSize s1 = sizeHint();
+ TQSize s2 = module.workArea().size();
+ int w = s1.width();
+ int h = s1.height();
+
+ if ( s1.width() >= s2.width() )
+ w = s2.width();
+ if ( s1.height() >= s2.height() )
+ h = s2.height();
+
+ resize( w, h );
+ }
+
+ KDialogBase::show();
+}
+
+void ConfigDialog::commitShortcuts()
+{
+ keysWidget->commitChanges();
+}
+
+/////////////////////////////////////////
+////
+
+#include "configdialog.moc"
diff --git a/kcontrol/randr/configdialog.h b/kcontrol/randr/configdialog.h
new file mode 100644
index 000000000..0728146ee
--- /dev/null
+++ b/kcontrol/randr/configdialog.h
@@ -0,0 +1,88 @@
+// -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*-
+/* This file is part of the KDE project
+ Copyright (C) 2000 by Carsten Pfeiffer <[email protected]>
+
+ 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; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+#ifndef CONFIGDIALOG_H
+#define CONFIGDIALOG_H
+
+#include <tqcheckbox.h>
+#include <tqevent.h>
+#include <tqgroupbox.h>
+#include <tqheader.h>
+#include <tqradiobutton.h>
+#include <tqvbox.h>
+
+#include <kdialogbase.h>
+#include <keditlistbox.h>
+#include <kkeydialog.h>
+#include <tdelistview.h>
+#include <knuminput.h>
+
+class TDEGlobalAccel;
+class KKeyChooser;
+class TDEListView;
+class TQPushButton;
+class TQDialog;
+class ConfigDialog;
+
+class ConfigDialog : public KDialogBase
+{
+ Q_OBJECT
+
+public:
+ ConfigDialog(TDEGlobalAccel *accel, bool isApplet );
+ ~ConfigDialog();
+
+ virtual void show();
+ void commitShortcuts();
+
+private:
+ KKeyChooser *keysWidget;
+
+};
+
+class ListView : public TDEListView
+{
+public:
+ ListView( ConfigDialog* configWidget, TQWidget *parent, const char *name )
+ : TDEListView( parent, name ), _configWidget( configWidget ),
+ _regExpEditor(0L) {}
+ // TQListView has a weird idea of a sizeHint...
+ virtual TQSize sizeHint () const {
+ int w = minimumSizeHint().width();
+ int h = header()->height();
+ h += viewport()->sizeHint().height();
+ h += horizontalScrollBar()->height();
+
+ TQListViewItem *item = firstChild();
+ while ( item ) {
+ h += item->totalHeight();
+ item = item->nextSibling();
+ }
+
+ return TQSize( w, h );
+ }
+
+protected:
+ virtual void rename( TQListViewItem* item, int c );
+private:
+ ConfigDialog* _configWidget;
+ TQDialog* _regExpEditor;
+};
+
+#endif // CONFIGDIALOG_H
diff --git a/kcontrol/randr/configure.in.in b/kcontrol/randr/configure.in.in
new file mode 100644
index 000000000..24a978198
--- /dev/null
+++ b/kcontrol/randr/configure.in.in
@@ -0,0 +1,18 @@
+dnl -----------------------------------------------------
+dnl X Resize and Rotate extension library check
+dnl -----------------------------------------------------
+
+KDE_CHECK_HEADERS(X11/extensions/Xrandr.h, [xrandr_h=yes], [xrandr_h=no], [#include <X11/Xlib.h>])
+if test "$xrandr_h" = yes; then
+ KDE_CHECK_LIB(Xrandr, XRRSetScreenConfigAndRate, [
+ LIB_XRANDR=-lXrandr
+ AC_DEFINE_UNQUOTED(XRANDR_SUPPORT, 1, [Defined if your system has XRandR support])
+ RANDR_SUBDIR="randr"
+ ], [
+ RANDR_SUBDIR=""
+ ], -lXrender -lXext $X_EXTRA_LIBS)
+else
+ LIB_XRANDR=
+fi
+AC_SUBST(LIB_XRANDR)
+AM_CONDITIONAL(include_kcontrol_randr, test -n "$RANDR_SUBDIR")
diff --git a/kcontrol/randr/ktimerdialog.cpp b/kcontrol/randr/ktimerdialog.cpp
new file mode 100644
index 000000000..1aa0f58df
--- /dev/null
+++ b/kcontrol/randr/ktimerdialog.cpp
@@ -0,0 +1,205 @@
+/*
+ * This file is part of the KDE Libraries
+ * Copyright (C) 2002 Hamish Rodda <[email protected]>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include <qhbox.h>
+#include <qlayout.h>
+#include <qvbox.h>
+#include <qtimer.h>
+#include <qprogressbar.h>
+#include <qlabel.h>
+
+#include <twin.h>
+#include <kiconloader.h>
+
+#include <tdelocale.h>
+#include <kdebug.h>
+
+#include "ktimerdialog.h"
+#include "ktimerdialog.moc"
+
+KTimerDialog::KTimerDialog( int msec, TimerStyle style, QWidget *parent,
+ const char *name, bool modal,
+ const QString &caption,
+ int buttonMask, ButtonCode defaultButton,
+ bool separator,
+ const KGuiItem &user1,
+ const KGuiItem &user2,
+ const KGuiItem &user3 )
+ : KDialogBase(parent, name, modal, caption, buttonMask, defaultButton,
+ separator, user1, user2, user3 )
+{
+ totalTimer = new QTimer( this );
+ updateTimer = new QTimer( this );
+ msecTotal = msecRemaining = msec;
+ updateInterval = 1000;
+ tStyle = style;
+ KWin::setIcons( winId(), DesktopIcon("randr"), SmallIcon("randr") );
+ // default to cancelling the dialog on timeout
+ if ( buttonMask & Cancel )
+ buttonOnTimeout = Cancel;
+
+ connect( totalTimer, TQT_SIGNAL( timeout() ), TQT_SLOT( slotInternalTimeout() ) );
+ connect( updateTimer, TQT_SIGNAL( timeout() ), TQT_SLOT( slotUpdateTime() ) );
+
+ // create the widgets
+ mainWidget = new QVBox( this, "mainWidget" );
+ timerWidget = new QHBox( mainWidget, "timerWidget" );
+ timerLabel = new QLabel( timerWidget );
+ timerProgress = new QProgressBar( timerWidget );
+ timerProgress->setTotalSteps( msecTotal );
+ timerProgress->setPercentageVisible( false );
+
+ KDialogBase::setMainWidget( mainWidget );
+
+ slotUpdateTime( false );
+}
+
+KTimerDialog::~KTimerDialog()
+{
+}
+
+void KTimerDialog::show()
+{
+ KDialogBase::show();
+ totalTimer->start( msecTotal, true );
+ updateTimer->start( updateInterval, false );
+}
+
+int KTimerDialog::exec()
+{
+ totalTimer->start( msecTotal, true );
+ updateTimer->start( updateInterval, false );
+ return KDialogBase::exec();
+}
+
+void KTimerDialog::setMainWidget( QWidget *widget )
+{
+ // yuck, here goes.
+ QVBox *newWidget = new QVBox( this );
+
+ if ( widget->parentWidget() != mainWidget ) {
+ widget->reparent( newWidget, 0, QPoint(0,0) );
+ } else {
+ newWidget->insertChild( widget );
+ }
+
+ timerWidget->reparent( newWidget, 0, QPoint(0, 0) );
+
+ delete mainWidget;
+ mainWidget = newWidget;
+ KDialogBase::setMainWidget( mainWidget );
+}
+
+void KTimerDialog::setRefreshInterval( int msec )
+{
+ updateInterval = msec;
+ if ( updateTimer->isActive() )
+ updateTimer->changeInterval( updateInterval );
+}
+
+int KTimerDialog::timeoutButton() const
+{
+ return buttonOnTimeout;
+}
+
+void KTimerDialog::setTimeoutButton( const ButtonCode newButton )
+{
+ buttonOnTimeout = newButton;
+}
+
+int KTimerDialog::timerStyle() const
+{
+ return tStyle;
+}
+
+void KTimerDialog::setTimerStyle( const TimerStyle newStyle )
+{
+ tStyle = newStyle;
+}
+
+void KTimerDialog::slotUpdateTime( bool update )
+{
+ if ( update )
+ switch ( tStyle ) {
+ case CountDown:
+ msecRemaining -= updateInterval;
+ break;
+ case CountUp:
+ msecRemaining += updateInterval;
+ break;
+ case Manual:
+ break;
+ }
+
+ timerProgress->setProgress( msecRemaining );
+
+ timerLabel->setText( i18n("1 second remaining:","%n seconds remaining:",msecRemaining/1000) );
+}
+
+void KTimerDialog::slotInternalTimeout()
+{
+ emit timerTimeout();
+ switch ( buttonOnTimeout ) {
+ case Help:
+ slotHelp();
+ break;
+ case Default:
+ slotDefault();
+ break;
+ case Ok:
+ slotOk();
+ break;
+ case Apply:
+ applyPressed();
+ break;
+ case Try:
+ slotTry();
+ break;
+ case Cancel:
+ slotCancel();
+ break;
+ case Close:
+ slotClose();
+ break;
+ /*case User1:
+ slotUser1();
+ break;
+ case User2:
+ slotUser2();
+ break;*/
+ case User3:
+ slotUser3();
+ break;
+ case No:
+ slotNo();
+ break;
+ case Yes:
+ slotCancel();
+ break;
+ case Details:
+ slotDetails();
+ break;
+ case Filler:
+ case Stretch:
+ kdDebug() << "Cannot execute button code " << buttonOnTimeout << endl;
+ break;
+ }
+}
diff --git a/kcontrol/randr/ktimerdialog.h b/kcontrol/randr/ktimerdialog.h
new file mode 100644
index 000000000..23b4a92b0
--- /dev/null
+++ b/kcontrol/randr/ktimerdialog.h
@@ -0,0 +1,170 @@
+/*
+ * This file is part of the KDE Libraries
+ * Copyright (C) 2002 Hamish Rodda <[email protected]>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+#ifndef _KTIMERDIALOG_H_
+#define _KTIMERDIALOG_H_
+
+#include <kdialogbase.h>
+
+class QTimer;
+class QHBox;
+class QProgressBar;
+class QLabel;
+
+/**
+ * Provides a dialog that is only available for a specified amount
+ * of time, and reports the time remaining to the user.
+ *
+ * The timer is capable of counting up or down, for any number of milliseconds.
+ *
+ * The button which is activated upon timeout can be specified, as can the
+ * update interval for the dialog box.
+ *
+ * In addition, this class retains all of the functionality of @see KDialogBase .
+ *
+ * @short A dialog with a time limit and corresponding UI features.
+ * @author Hamish Rodda <[email protected]>
+ */
+class KTimerDialog : public KDialogBase
+{
+ Q_OBJECT
+
+ public:
+
+ /**
+ * @li @p CountDown - The timer counts downwards from the seconds given.
+ * @li @p CountUp - The timer counts up to the number of seconds given.
+ * @li @p Manual - The timer is not invoked; the caller must update the
+ * progress.
+ */
+ enum TimerStyle
+ {
+ CountDown,
+ CountUp,
+ Manual
+ };
+
+ /**
+ * Constructor for the standard mode where you must specify the main
+ * widget with @ref setMainWidget() . See @see KDialogBase for further details.
+ *
+ * For the rest of the arguments, See @see KDialogBase .
+ */
+ KTimerDialog( int msec, TimerStyle style=CountDown, QWidget *parent=0,
+ const char *name=0, bool modal=true,
+ const QString &caption=QString::null,
+ int buttonMask=Ok|Apply|Cancel, ButtonCode defaultButton=Ok,
+ bool separator=false,
+ const KGuiItem &user1=KGuiItem(),
+ const KGuiItem &user2=KGuiItem(),
+ const KGuiItem &user3=KGuiItem() );
+
+ /**
+ * Destructor.
+ */
+ ~KTimerDialog();
+
+ /**
+ * Execute the dialog modelessly - see @see QDialog .
+ */
+ virtual void show();
+
+ /**
+ * Set the refresh interval for the timer progress. Defaults to one second.
+ */
+ void setRefreshInterval( int msec );
+
+ /**
+ * Retrieves the @ref ButtonCode which will be activated once the timer
+ * times out. @see setTimeoutButton
+ */
+ int timeoutButton() const;
+
+ /**
+ * Sets the @ref ButtonCode to determine which button will be activated
+ * once the timer times out. @see timeoutButton
+ */
+ void setTimeoutButton( ButtonCode newButton );
+
+ /**
+ * Retrieves the current @ref TimerStyle. @see setTimerStyle
+ */
+ int timerStyle() const;
+
+ /**
+ * Sets the @ref TimerStyle. @see timerStyle
+ */
+ void setTimerStyle( TimerStyle newStyle );
+
+ /**
+ * Overridden function which is used to set the main widget of the dialog.
+ * @see KDialogBase::setMainWidget.
+ */
+ void setMainWidget( QWidget *widget );
+
+ signals:
+ /**
+ * Signal which is emitted once the timer has timed out.
+ */
+ void timerTimeout();
+
+ public slots:
+ /**
+ * Execute the dialog modally - see @see QDialog .
+ */
+ int exec();
+
+ private slots:
+ /**
+ * Updates the dialog with the current progress levels.
+ */
+ void slotUpdateTime( bool update = true );
+
+ /**
+ * The internal
+ */
+ void slotInternalTimeout();
+
+ private:
+ /**
+ * Prepares the layout that manages the widgets of the dialog
+ */
+ void setupLayout();
+
+ QTimer *totalTimer;
+ QTimer *updateTimer;
+ int msecRemaining, updateInterval, msecTotal;
+
+ ButtonCode buttonOnTimeout;
+ TimerStyle tStyle;
+
+ QHBox *timerWidget;
+ QProgressBar *timerProgress;
+ QLabel *timerLabel;
+ QVBox *mainWidget;
+
+ class KTimerDialogPrivate;
+ KTimerDialogPrivate *d;
+};
+
+#endif
+
+
+
diff --git a/kcontrol/randr/main.cpp b/kcontrol/randr/main.cpp
new file mode 100644
index 000000000..af2e8b270
--- /dev/null
+++ b/kcontrol/randr/main.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2002,2003 Hamish Rodda <[email protected]>
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <stdlib.h>
+#include <kdebug.h>
+
+#include <tdelocale.h>
+#include <tdecmdlineargs.h>
+#include <tdeaboutdata.h>
+#include <tdeglobal.h>
+
+#include "tderandrapp.h"
+
+static const char tderandrtrayVersion[] = "0.5";
+static const TDECmdLineOptions options[] =
+{
+ { "login", I18N_NOOP("Application is being auto-started at TDE session start"), 0L },
+ TDECmdLineLastOption
+};
+
+int main(int argc, char **argv)
+{
+ TDEAboutData aboutData("randr", I18N_NOOP("Resize and Rotate"), tderandrtrayVersion, I18N_NOOP("Resize and Rotate System Tray App"), TDEAboutData::License_GPL, "(c) 2009,2010 Timothy Pearson", 0L, "");
+ aboutData.addAuthor("Timothy Pearson",I18N_NOOP("Developer and maintainer"), "[email protected]");
+ aboutData.addAuthor("Hamish Rodda",I18N_NOOP("Original developer and maintainer"), "[email protected]");
+ aboutData.addCredit("Lubos Lunak",I18N_NOOP("Many fixes"), "[email protected]");
+ aboutData.setProductName("tderandr/tderandrtray");
+ TDEGlobal::locale()->setMainCatalogue("tderandr");
+
+ TDECmdLineArgs::init(argc,argv,&aboutData);
+ TDECmdLineArgs::addCmdLineOptions(options);
+ TDEApplication::addCmdLineOptions();
+
+ KRandRApp app;
+
+ return app.exec();
+}
diff --git a/kcontrol/randr/randr.desktop b/kcontrol/randr/randr.desktop
new file mode 100644
index 000000000..bb7b27ea6
--- /dev/null
+++ b/kcontrol/randr/randr.desktop
@@ -0,0 +1,216 @@
+[Desktop Entry]
+Icon=randr
+Type=Application
+Exec=tdecmshell randr
+X-TDE-Library=randr
+#X-TDE-Init=randr
+X-TDE-Test-Module=true
+
+Name=Size & Orientation
+Name[af]=Grootte & Ooriëntasie
+Name[ar]=القياس و الإتجاه
+Name[be]=Памеры і арыентацыя
+Name[bg]=Размер и ротация на екрана
+Name[bn]=আকৃতি এবং দিশা
+Name[br]=Ment ha reteradur
+Name[bs]=Veličina i orijentacija
+Name[ca]=Mida i orientació
+Name[cs]=Velikost a orientace
+Name[csb]=Miara ë pòłóżenié
+Name[cy]=Maint & Cyfeiriad
+Name[da]=Størrelse & Orientering
+Name[de]=Größe & Orientierung
+Name[el]=Μέγεθος & Προσανατολισμός
+Name[eo]=Grandeco kaj direkto
+Name[es]=Tamaño y orientación
+Name[et]=Suurus ja orientatsioon
+Name[eu]=Tamaina eta orientazioa
+Name[fa]=اندازه و جهت
+Name[fi]=Koko ja suunta
+Name[fr]=Taille et orientation
+Name[fy]=Grutte en oriïntaasje
+Name[ga]=Méid agus Treoshuíomh
+Name[gl]=Tamaño e Orientación
+Name[he]=גודל וכיוון
+Name[hi]=आकार व दिशा निर्धारण
+Name[hr]=Veličina i orijentacija
+Name[hu]=Képernyőfelbontás
+Name[is]=Stærð og snúningur
+Name[it]=Dimensione e orientazione
+Name[ja]=サイズと配置
+Name[ka]=ზომა და ორიენტაცია
+Name[kk]=Өлшем және бағыт
+Name[km]=ទំហំ & ទិស
+Name[ko]=해상도와 회전
+Name[lt]=Dydis ir orientacija
+Name[lv]=Izmērs un orientācija
+Name[mk]=Големина и ориентација
+Name[mn]=Хэмжээ & Чиглэл
+Name[ms]=Saiz & Orientasi
+Name[mt]=Daqs u Orjentazzjoni
+Name[nb]=Størrelse og retning
+Name[nds]=Grött & Utrichten
+Name[ne]=साइज र अभिमुखीकरण
+Name[nl]=Grootte en oriëntatie
+Name[nn]=Storleik og retning
+Name[pa]=ਆਕਾਰ ਅਤੇ ਸਥਿਤੀ
+Name[pl]=Rozmiar i orientacja
+Name[pt]=Tamanho e Orientação
+Name[pt_BR]=Tamanho & Orientação
+Name[ro]=Mărime și orientare
+Name[ru]=Размер и ориентация
+Name[rw]=Ingano & Icyerekezo
+Name[se]=Sturrodat ja joraheapmi
+Name[sk]=Veľkosť a orientácia
+Name[sl]=Velikost in orientacija
+Name[sr]=Величина и оријентација
+Name[sr@Latn]=Veličina i orijentacija
+Name[sv]=Storlek och orientering
+Name[ta]=அளவும் திசையும்
+Name[tg]=Андоза ва шиносоӣ
+Name[th]=ขนาดและการวางแนว
+Name[tr]=Konum ve Boyut
+Name[tt]=Ülçäm belän Yünälü
+Name[uk]=Розмір та орієнтація
+Name[uz]=Oʻlchami va joylashishi
+Name[uz@cyrillic]=Ўлчами ва жойлашиши
+Name[vi]=Cỡ & Hướng
+Name[wa]=Grandeu eyet oryintåcion
+Name[zh_CN]=大小和方向
+Name[zh_TW]=尺寸及定位
+
+Comment=Resize and Rotate your display
+Comment[af]=Hervergroot en Roteer jou skerm
+Comment[ar]=غيّر القياس و دوران شاشتك
+Comment[be]=Змяняе памеры і перагортвае ваш экран
+Comment[bg]=Настройване на размера и завъртането на екрана
+Comment[bn]=আপনার ডিসপ্লের আকৃতি এবং দিশা পরিবর্তন করুন
+Comment[br]=Adventañ ha treiñ ho skramm
+Comment[bs]=Podesite veličinu i rotirajte vaš ekran
+Comment[ca]=Amida i gira la vostra pantalla
+Comment[cs]=Změna velikosti a rotace obrazovky
+Comment[csb]=Zjinaka miarë ë pòłożenia ekranu
+Comment[cy]=Newid Maint a Cylchdroi eich dangosydd
+Comment[da]=Ændrer størrelse og roterer din visning
+Comment[de]=Die Größe und Ausrichtung der Anzeige ändern
+Comment[el]=Αλλαγή μεγέθους και Περιστροφή της οθόνης σας
+Comment[eo]=Grandigi kaj turni vian ekranblokon
+Comment[es]=Ajustar el tamaño y rotar la pantalla
+Comment[et]=Oma vaate suuruse muutmine ja pööramine
+Comment[eu]=Aldatu tamaina eta biratu zure pantaila
+Comment[fa]=تغییر اندازه و چرخش صفحه نمایش شما
+Comment[fi]=Resoluution muuttaminen ja ruudun kääntäminen
+Comment[fr]=Redimensionner et Tourner votre affichage
+Comment[fy]=Wizigje it skermgrutte en rotearje dizze
+Comment[gl]=Redimensionar e rotar a sua pantalla
+Comment[he]=שנה את גודלה של התצוגה שלך וסובב אותה
+Comment[hi]=अपने शक्ल-सूरत(डिस्प्ले) का आकार बदलें तथा घुमाएँ
+Comment[hr]=Promijena veličine i orijentacije zaslona
+Comment[hu]=A képernyő átméretezése, elforgatása
+Comment[is]=Breyta stærð skjásins og snúa honum
+Comment[it]=Ridimensiona e ruota il tuo display
+Comment[ja]=ディスプレイのリサイズと回転
+Comment[ka]=ეკრანის ზომის და ორიენტაციის შეცვლა
+Comment[kk]=Дисплейдің өлшемін және бағытын өзгерту
+Comment[km]=ប្ដូរ​ទំហំ និង​បង្វិល​ការ​បង្ហាញ​របស់​អ្នក
+Comment[ko]=디스플레이의 크기와 방향 조정
+Comment[lt]=Keisti ekrano dydį ir orientaciją
+Comment[lv]=Maina izmēru un rotē Jūsu ekrānu
+Comment[mk]=Сменете ја големината и ротацијата на вашиот екран
+Comment[mn]=Дэлгэцийнхээ хэмжээг өөрчилөх ба эргүүлэх
+Comment[ms]=Saiz Semula dan Putar paparan anda
+Comment[mt]=Ibdel id-daqs jew dawwar l-iskrin
+Comment[nb]=Endre størrelsen på og rotere skjermbildet
+Comment[nds]=Grött un Utrichten vun den Schirm ännern
+Comment[ne]=तपाईँको प्रदर्शन रिसाइज गर्नुहोस् र घुमाउनुहोस्
+Comment[nl]=Wijzig de schermgrootte en roteer deze
+Comment[nn]=Endra storleiken på og roter skjermbiletet
+Comment[pa]=ਆਪਣੀ ਝਲਕ ਨੂੰ ਮੁੜ-ਆਕਾਰ ਕਰੋ ਤੇ ਘੁੰਮਾਓ
+Comment[pl]=Zmiana rozmiaru i orientacji ekranu
+Comment[pt]=Dimensione e rode o seu ecrã
+Comment[pt_BR]=Redimensiona e Rotaciona a sua tela
+Comment[ro]=Redimensionează și rotește ecranul dumneavoastră
+Comment[ru]=Изменение размера и ориентации экрана
+Comment[rw]=Guhindura ingano no Kuzengurutsa iyerekana ryawe
+Comment[se]=Rievdat šearpma sturrodaga ja joraheami
+Comment[sk]=Zmení veľkosť a otočí váš displej
+Comment[sl]=Spremenite velikost in obrnite zaslon
+Comment[sr]=Промените величину и оријентацију вашег екрана
+Comment[sr@Latn]=Promenite veličinu i orijentaciju vašeg ekrana
+Comment[sv]=Storleksändring och rotation av skärmen
+Comment[ta]=தங்கள் காட்சியை அளவு மாற்று மற்றும் சுழற்று
+Comment[tg]=Андозаи намоиши худро дигаргун созед ва чаппа кунед
+Comment[th]=ปรับแต่งการแสดงผลของคุณ
+Comment[tr]=Ekranı boyutlandır ve çevir
+Comment[tt]=Kürägeñneñ Ülçäme belän Borılışı
+Comment[uk]=Зміна розміру та обертання дисплею
+Comment[uz]=Ekraning oʻlchamini oʻzgartirish va burish
+Comment[uz@cyrillic]=Экранинг ўлчамини ўзгартириш ва буриш
+Comment[vi]=Đổi cỡ và Quay màn hình của bạn
+Comment[wa]=Candjî l' grandeu eyet tourner li håynaedje
+Comment[zh_CN]=更改显示大小和旋转显示
+Comment[zh_TW]=調整大小及旋轉你的螢幕
+
+Keywords=resize;rotate;display;color;depth;size;horizontal;vertical;
+Keywords[ar]=تغيير حجم، تدوير، لف، عرض، لون، عمق، حجم، أفقي، عمودي;
+Keywords[be]=Змена памеру;Перагортванне;Дысплей;Экран;Колер;Глыбіня;Памер;Гарызантальны;Вертыкальны;resize;rotate;display;color;depth;size;horizontal;vertical;
+Keywords[bg]=ротация; завъртане; екран; размер; промяна; resize; rotate; display; color; depth; size; horizontal; vertical;
+Keywords[bs]=resize;rotate;display;color;depth;size;horizontal;vertical;veličina;rotacija;ekran;boja;dubina;uspravno;vodoravno;
+Keywords[ca]=amida;gira;pantalla;color;profunditat;mida;horitzontal;vertical;
+Keywords[cs]=velikost;rotace;obrazovka;barva;hloubka;horizontální;vertikální;
+Keywords[csb]=zjinaka miarë;òbrócenié;pòłożenié;miara;ekran;farwa;farwë;głãbòkòsc farwów;wielëna farwów;knôdno;hòrizontalno;
+Keywords[cy]=newid maint;cylchdroi;dangos;lliw;dyfnder;maint;llorweddol;fertigol;
+Keywords[da]=ændr;rotér;visning;farve;dybde;størrelse;vandret;lodret;
+Keywords[de]=Größe ändern;rotieren;anzeigen;Farbe;Tiefe;Größe;horizontal;vertikal;waagrecht;senkrecht;
+Keywords[el]=αλλαγή μεγέθους;περιστροφή;οθόνη;χρώμα;βάθος;μέγεθος;οριζόντια;κατακόρυφα;
+Keywords[en_GB]=resize;rotate;display;colour;depth;size;horizontal;vertical;
+Keywords[eo]=grandigi;turni;direkto;ekrano;ekranbloko;grandeco;koloro;horizontala;vertikala;
+Keywords[es]=redimensionar;rotar;mostrar;color;colores;tamaño;horizontal;vertical;
+Keywords[et]=suuruse muutmine;pööramine;monitor;ekraan;värv;sügavus;suurus;horisontaalne;vertikaalne;
+Keywords[eu]=tamaina aldatu;biratu;pantaila;kolorea;sakonera;tamaina;horizontala; bertikala;
+Keywords[fa]=تغییر اندازه، چرخش، نمایش، رنگ، عمق، اندازه، افقی، عمودی;
+Keywords[fi]=vaihda kokoa;käännä;näyttö;väri;syvyys;koko;vaakasuora;pystysuora;
+Keywords[fr]=redimensionner;rotation;affichage;couleur;profondeur;taille; horizontal;vertical;
+Keywords[fy]=grutte wizigje;rotearje;draaie;display;byldskerm;skerm;monitor;djipte;grutte;horizontaal;vertikaal;
+Keywords[ga]=athraigh méid;rothlaigh;scáileán;dath;doimhneacht;méid;cothrománach;ingearach;
+Keywords[gl]=redimensionar;rotar;pantalla;cor;resolución;tamaño;horizontal;vertical;
+Keywords[he]=שנה גודל;סובב;תצוגה;צבע;עומק;גודל;אופקי;אנכי; resize;rotate;display;color;depth;size;horizontal;vertical;
+Keywords[hi]=नया-आकार;घुमाएँ;प्रकटन;रंग;गहराई;आकार;आड़ा;खड़ा;
+Keywords[hr]=resize;rotate;display;color;depth;size;horizontal;vertical;promjena;veličina;rotacija;zaslon;boja;dubina;vodoravno;uspravno;
+Keywords[hu]=átméretezés;elforgatás;képernyő;szín;színmélység;vízszintes;függőleges;
+Keywords[is]=resize;rotate;display;color;depth;size;horizontal;vertical;stækka;minnka;snúa;
+Keywords[it]=ridimensiona;ruota;schermo;colori;profondità di colore;dimensione;orizzontale;verticale;
+Keywords[ja]=リサイズ;回転;ディスプレイ;色;深度;サイズ;水平;垂直;
+Keywords[km]=ប្ដូរ​ទំហំ;បង្វិល;បង្ហាញ;ពណ៌;ជម្រៅ;ទំហំ;ផ្ដេក;បញ្ឈរ;
+Keywords[lt]=resize;rotate;display;color;depth;size;horizontal;vertical;keisti dydį;pasukti;sukti;ekranas;spalva;gylis;dydis;horizontalus;vertikalus;
+Keywords[lv]=mainīt izmēru;rotēt;ekrāns;krāsa;dziļums;izmērs;horizontāls;vertikāls;
+Keywords[mk]=resize;rotate;display;color;depth;size;horizontal;vertical;смени големина;ротира;прикажи;екран;боја;длабочина;големина;хоризонтално;вертикално;
+Keywords[mn]=хэмжээ өөрчилөх;эргүүлэх;дэлгэц;өнгө;гүн;хэмжээ;хэвтээ;босоо;
+Keywords[nb]=størrelse;rotere;skjerm;farge;dybde;vannrett;loddrett;
+Keywords[nds]=Grött ännern;dreihen;display;Dorstellen;Klöör;Deep;Grött;waagrecht;pielliek;
+Keywords[ne]=रिसाइज; घुमाउनुहोस्; प्रदर्शन; गहिराइ; साइज; तेर्सो; ठाडो;
+Keywords[nl]=grootte wijzigen;roteren;draaien;display;beeldscherm;scherm;monitor;diepte;grootte;horizontaal;verticaal;
+Keywords[nn]=storleik;rotera;skjerm;farge;djupn;vassrett;loddrett;
+Keywords[pa]=ਮੁੜ-ਅਕਾਰ;ਘੁੰਮਾਉ;ਝਲਕ;ਰੰਗ;ਡੂੰਘਾਈ;ਅਕਾਰ;ਖਿਤਿਜੀ;ਲੰਬਕਾਰੀ;
+Keywords[pl]=zmiana rozmiaru;obrót;orientacja;rozmiar;ekran;kolor;kolory;głębokość kolorów;liczba kolorów;pionowo;poziomo;
+Keywords[pt]=redimensionar;rodar;ecrã;cor;profundidade;tamanho;horizontal;vertical;
+Keywords[pt_BR]=redimensionar;rotacionar;display;cor;produndidade;tamanho;horizontal;vertical;
+Keywords[ro]=redimensionare;rotire;ecran;monitor;culoare;adîncime;mărime;orizontal;vertical;
+Keywords[ru]=resize;rotate;display;color;depth;size;horizontal;vertical;экран;
+Keywords[rw]=guhindura ingano;kuzengurutsa;kwerekana;ibara;ubujyakuzimu;ingano;bitambitse;bihagaritse;
+Keywords[se]=sturrodat;jorahit;šearbma;ivdni;čikŋodat;láskut;ceaggut;
+Keywords[sk]=zmena veľkosti;rotácia;displej;farba;hĺbka;veľkosť;horizontálne;vertikálne;
+Keywords[sl]=spremeni;velikost;zavrti;zaslon;barva;globina;navpičn;vodoravn;
+Keywords[sr]=resize;rotate;display;color;depth;size;horizontal;vertical;промена;величина;ротација;екран;боја;дубина;водоравно;усправно;
+Keywords[sr@Latn]=resize;rotate;display;color;depth;size;horizontal;vertical;promena;veličina;rotacija;ekran;boja;dubina;vodoravno;uspravno;
+Keywords[sv]=ändra storlek;rotera;skärm;färg;djup;storlek;horisontell;vertikal;
+Keywords[ta]=அளவுமாற்று; சுழற்று; காட்டு;வண்ணம்; ஆழம்;அளவு;இடவலம்;மேலிருந்து கீழ்;
+Keywords[th]=ปรับขนาด;หมุน;จอภาพ;สี;ความลึก;ขนาด;แนวราบ;แนวดิ่ง;
+Keywords[tr]=boyutlandır;çevir;görünüm;renk;derinlik;boyut;dikey;yatay;
+Keywords[uk]=зміна розміру;розмір;обертання;дисплей;колір;глибина;горизонтальний;вертикальний;
+Keywords[uz]=oʻlchamini oʻzgartirish;burish;ekran;rang;chuqurlik;oʻlcham;gorizantal;vertikal;
+Keywords[uz@cyrillic]=ўлчамини ўзгартириш;буриш;экран;ранг;чуқурлик;ўлчам;горизантал;вертикал;
+Keywords[vi]=đổi cỡ;quay;hiển thị;màu;độ sâu;cỡ;ngang;dọc;
+Keywords[wa]=candjî l' grandeu;tourner;håynaedje;coleur;parfondeu;grandeu;di coûtchî;d' astampé;
+Keywords[zh_CN]=resize;rotate;display;color;depth;size;horizontal;vertical;更改大小;旋转;显示;颜色;深度;大小;垂直;水平;
+Keywords[zh_TW]=resize;rotate;display;color;depth;size;horizontal;vertical;調整大小;旋轉;螢幕;顏色;深度;尺寸;垂直;水平;
diff --git a/kcontrol/randr/tderandrapp.cpp b/kcontrol/randr/tderandrapp.cpp
new file mode 100644
index 000000000..e2a4b46f2
--- /dev/null
+++ b/kcontrol/randr/tderandrapp.cpp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2002,2003 Hamish Rodda <[email protected]>
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <kdebug.h>
+
+#include "tderandrapp.h"
+#include "tderandrapp.moc"
+
+#include "tderandrtray.h"
+
+#include <X11/Xlib.h>
+
+KRandRApp::KRandRApp()
+ : m_tray(new KRandRSystemTray(0L, "RANDRTray"))
+{
+ connect(&m_eventMergingTimer, TQT_SIGNAL(timeout()), this, TQT_SLOT(handleX11ConfigChangeEvent()));
+ m_tray->show();
+}
+
+void KRandRApp::handleX11ConfigChangeEvent()
+{
+ m_eventMergingTimer.stop();
+ m_tray->configChanged();
+}
+
+bool KRandRApp::x11EventFilter(XEvent* e)
+{
+ if (e->type == m_tray->screenChangeNotifyEvent()) {
+ m_eventMergingTimer.start(1000, TRUE);
+ }
+ return TDEApplication::x11EventFilter( e );
+}
diff --git a/kcontrol/randr/tderandrapp.h b/kcontrol/randr/tderandrapp.h
new file mode 100644
index 000000000..004da6294
--- /dev/null
+++ b/kcontrol/randr/tderandrapp.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2002 Hamish Rodda <[email protected]>
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TDERANDRAPP_H
+#define TDERANDRAPP_H
+
+#include <tqtimer.h>
+#include <kuniqueapplication.h>
+
+class KRandRSystemTray;
+
+class KRandRApp : public KUniqueApplication
+{
+ Q_OBJECT
+
+public:
+ KRandRApp();
+
+ virtual bool x11EventFilter(XEvent * e);
+
+private slots:
+ void handleX11ConfigChangeEvent();
+
+private:
+ KRandRSystemTray* m_tray;
+ TQTimer m_eventMergingTimer;
+};
+
+#endif
diff --git a/kcontrol/randr/tderandrbindings.cpp b/kcontrol/randr/tderandrbindings.cpp
new file mode 100644
index 000000000..07702633b
--- /dev/null
+++ b/kcontrol/randr/tderandrbindings.cpp
@@ -0,0 +1,34 @@
+// -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*-
+/* This file is part of the KDE project
+ Copyright (C) by Andrew Stanley-Jones
+
+ 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; see the file COPYING. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+#ifndef NOSLOTS
+# define DEF( name, key3, key4, fnSlot ) \
+ keys->insert( name, i18n(name), TQString(), key3, key4, TQT_TQOBJECT(this), TQT_SLOT(fnSlot) )
+#else
+# define DEF( name, key3, key4, fnSlot ) \
+ keys->insert( name, i18n(name), TQString(), key3, key4 )
+#endif
+#define WIN KKey::QtWIN
+
+ keys->insert( "Program:tderandrtray", i18n("Display Control") );
+
+ DEF( I18N_NOOP("Switch Displays"), TDEShortcut(TQString("XF86Display")), TDEShortcut(TQString("XF86Display")), slotCycleDisplays() );
+
+#undef DEF
+#undef WIN
diff --git a/kcontrol/randr/tderandrinithack.cpp b/kcontrol/randr/tderandrinithack.cpp
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/kcontrol/randr/tderandrinithack.cpp
@@ -0,0 +1 @@
+
diff --git a/kcontrol/randr/tderandrmodule.cpp b/kcontrol/randr/tderandrmodule.cpp
new file mode 100644
index 000000000..11263bbf4
--- /dev/null
+++ b/kcontrol/randr/tderandrmodule.cpp
@@ -0,0 +1,365 @@
+/*
+ * Copyright (c) 2002,2003 Hamish Rodda <[email protected]>
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <tqapplication.h>
+#include <tqbuttongroup.h>
+#include <tqcheckbox.h>
+#include <tqdesktopwidget.h>
+#include <tqhbox.h>
+#include <tqlabel.h>
+#include <tqlayout.h>
+#include <tqradiobutton.h>
+#include <tqvbox.h>
+#include <tqvbuttongroup.h>
+#include <tqwhatsthis.h>
+
+#include <tdecmodule.h>
+#include <kcombobox.h>
+#include <kdebug.h>
+#include <kdialog.h>
+#include <kgenericfactory.h>
+#include <tdeglobal.h>
+#include <tdelocale.h>
+
+#include "tderandrmodule.h"
+#include "tderandrmodule.moc"
+
+#include <X11/Xlib.h>
+#include <X11/extensions/Xrandr.h>
+
+// DLL Interface for kcontrol
+typedef KGenericFactory<KRandRModule, TQWidget > KSSFactory;
+K_EXPORT_COMPONENT_FACTORY (kcm_randr, KSSFactory("tderandr") )
+extern "C"
+
+{
+ KDE_EXPORT void init_randr()
+ {
+ KRandRModule::performApplyOnStartup();
+ }
+
+ KDE_EXPORT bool test_randr()
+ {
+ int eventBase, errorBase;
+ if( XRRQueryExtension(tqt_xdisplay(), &eventBase, &errorBase ) )
+ return true;
+ return false;
+ }
+}
+
+void KRandRModule::performApplyOnStartup()
+{
+ TDEConfig config("kcmrandrrc", true);
+ if (RandRDisplay::applyOnStartup(config))
+ {
+ // Load settings and apply appropriate config
+ RandRDisplay display;
+ if (display.isValid() && display.loadDisplay(config))
+ display.applyProposed(false);
+ }
+}
+
+KRandRModule::KRandRModule(TQWidget *parent, const char *name, const TQStringList&)
+ : TDECModule(parent, name)
+ , m_changed(false)
+{
+ if (!isValid()) {
+ TQVBoxLayout *topLayout = new TQVBoxLayout(this);
+ topLayout->addWidget(new TQLabel(i18n("<qt>Your X server does not support resizing and rotating the display. Please update to version 4.3 or greater. You need the X Resize And Rotate extension (RANDR) version 1.1 or greater to use this feature.</qt>"), this));
+ kdWarning() << "Error: " << errorCode() << endl;
+ return;
+ }
+
+ TQVBoxLayout* topLayout = new TQVBoxLayout(this, 0, KDialog::spacingHint());
+
+ TQHBox* screenBox = new TQHBox(this);
+ topLayout->addWidget(screenBox);
+ TQLabel *screenLabel = new TQLabel(i18n("Settings for screen:"), screenBox);
+ m_screenSelector = new KComboBox(screenBox);
+
+ for (int s = 0; s < numScreens(); s++) {
+ m_screenSelector->insertItem(i18n("Screen %1").arg(s+1));
+ }
+
+ m_screenSelector->setCurrentItem(currentScreenIndex());
+ screenLabel->setBuddy( m_screenSelector );
+ TQWhatsThis::add(m_screenSelector, i18n("The screen whose settings you would like to change can be selected using this drop-down list."));
+
+ connect(m_screenSelector, TQT_SIGNAL(activated(int)), TQT_SLOT(slotScreenChanged(int)));
+
+ if (numScreens() <= 1)
+ m_screenSelector->setEnabled(false);
+
+ TQHBox* sizeBox = new TQHBox(this);
+ topLayout->addWidget(sizeBox);
+ TQLabel *sizeLabel = new TQLabel(i18n("Screen size:"), sizeBox);
+ m_sizeCombo = new KComboBox(sizeBox);
+ TQWhatsThis::add(m_sizeCombo, i18n("The size, otherwise known as the resolution, of your screen can be selected from this drop-down list."));
+ connect(m_sizeCombo, TQT_SIGNAL(activated(int)), TQT_SLOT(slotSizeChanged(int)));
+ sizeLabel->setBuddy( m_sizeCombo );
+
+ TQHBox* refreshBox = new TQHBox(this);
+ topLayout->addWidget(refreshBox);
+ TQLabel *rateLabel = new TQLabel(i18n("Refresh rate:"), refreshBox);
+ m_refreshRates = new KComboBox(refreshBox);
+ TQWhatsThis::add(m_refreshRates, i18n("The refresh rate of your screen can be selected from this drop-down list."));
+ connect(m_refreshRates, TQT_SIGNAL(activated(int)), TQT_SLOT(slotRefreshChanged(int)));
+ rateLabel->setBuddy( m_refreshRates );
+
+ m_rotationGroup = new TQButtonGroup(2, Qt::Horizontal, i18n("Orientation (degrees counterclockwise)"), this);
+ topLayout->addWidget(m_rotationGroup);
+ m_rotationGroup->setRadioButtonExclusive(true);
+ TQWhatsThis::add(m_rotationGroup, i18n("The options in this section allow you to change the rotation of your screen."));
+
+ m_applyOnStartup = new TQCheckBox(i18n("Apply settings on TDE startup"), this);
+ topLayout->addWidget(m_applyOnStartup);
+ TQWhatsThis::add(m_applyOnStartup, i18n("If this option is enabled the size and orientation settings will be used when TDE starts."));
+ connect(m_applyOnStartup, TQT_SIGNAL(clicked()), TQT_SLOT(setChanged()));
+
+ TQHBox* syncBox = new TQHBox(this);
+ syncBox->layout()->addItem(new TQSpacerItem(20, 1, TQSizePolicy::Maximum));
+ m_syncTrayApp = new TQCheckBox(i18n("Allow tray application to change startup settings"), syncBox);
+ topLayout->addWidget(syncBox);
+ TQWhatsThis::add(m_syncTrayApp, i18n("If this option is enabled, options set by the system tray applet will be saved and loaded when TDE starts instead of being temporary."));
+ connect(m_syncTrayApp, TQT_SIGNAL(clicked()), TQT_SLOT(setChanged()));
+
+ topLayout->addStretch(1);
+
+ // just set the "apply settings on startup" box
+ load();
+ m_syncTrayApp->setEnabled(m_applyOnStartup->isChecked());
+
+ slotScreenChanged(TQApplication::desktop()->primaryScreen());
+
+ setButtons(TDECModule::Apply);
+}
+
+void KRandRModule::addRotationButton(int thisRotation, bool checkbox)
+{
+ Q_ASSERT(m_rotationGroup);
+ if (!checkbox) {
+ TQRadioButton* thisButton = new TQRadioButton(RandRScreen::rotationName(thisRotation), m_rotationGroup);
+ thisButton->setEnabled(thisRotation & currentScreen()->rotations());
+ connect(thisButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotRotationChanged()));
+ } else {
+ TQCheckBox* thisButton = new TQCheckBox(RandRScreen::rotationName(thisRotation), m_rotationGroup);
+ thisButton->setEnabled(thisRotation & currentScreen()->rotations());
+ connect(thisButton, TQT_SIGNAL(clicked()), TQT_SLOT(slotRotationChanged()));
+ }
+}
+
+void KRandRModule::slotScreenChanged(int screen)
+{
+ setCurrentScreen(screen);
+
+ // Clear resolutions
+ m_sizeCombo->clear();
+
+ // Add new resolutions
+ for (int i = 0; i < currentScreen()->numSizes(); i++) {
+ m_sizeCombo->insertItem(i18n("%1 x %2").arg(currentScreen()->pixelSize(i).width()).arg(currentScreen()->pixelSize(i).height()));
+
+ // Aspect ratio
+ /* , aspect ratio %5)*/
+ /*.arg((double)currentScreen()->size(i).mwidth / (double)currentScreen()->size(i).mheight))*/
+ }
+
+ // Clear rotations
+ for (int i = m_rotationGroup->count() - 1; i >= 0; i--)
+ m_rotationGroup->remove(m_rotationGroup->find(i));
+
+ // Create rotations
+ for (int i = 0; i < RandRScreen::OrientationCount; i++)
+ addRotationButton(1 << i, i > RandRScreen::RotationCount - 1);
+
+ populateRefreshRates();
+
+ update();
+
+ setChanged();
+}
+
+void KRandRModule::slotRotationChanged()
+{
+ if (m_rotationGroup->find(0)->isOn())
+ currentScreen()->proposeRotation(RandRScreen::Rotate0);
+ else if (m_rotationGroup->find(1)->isOn())
+ currentScreen()->proposeRotation(RandRScreen::Rotate90);
+ else if (m_rotationGroup->find(2)->isOn())
+ currentScreen()->proposeRotation(RandRScreen::Rotate180);
+ else {
+ Q_ASSERT(m_rotationGroup->find(3)->isOn());
+ currentScreen()->proposeRotation(RandRScreen::Rotate270);
+ }
+
+ if (m_rotationGroup->find(4)->isOn())
+ currentScreen()->proposeRotation(currentScreen()->proposedRotation() ^ RandRScreen::ReflectX);
+
+ if (m_rotationGroup->find(5)->isOn())
+ currentScreen()->proposeRotation(currentScreen()->proposedRotation() ^ RandRScreen::ReflectY);
+
+ setChanged();
+}
+
+void KRandRModule::slotSizeChanged(int index)
+{
+ int oldProposed = currentScreen()->proposedSize();
+
+ currentScreen()->proposeSize(index);
+
+ if (currentScreen()->proposedSize() != oldProposed) {
+ currentScreen()->proposeRefreshRate(0);
+
+ populateRefreshRates();
+
+ // Item with index zero is already selected
+ }
+
+ setChanged();
+}
+
+void KRandRModule::slotRefreshChanged(int index)
+{
+ currentScreen()->proposeRefreshRate(index);
+
+ setChanged();
+}
+
+void KRandRModule::populateRefreshRates()
+{
+ m_refreshRates->clear();
+
+ TQStringList rr = currentScreen()->refreshRates(currentScreen()->proposedSize());
+
+ m_refreshRates->setEnabled(rr.count());
+
+ for (TQStringList::Iterator it = rr.begin(); it != rr.end(); ++it)
+ m_refreshRates->insertItem(*it);
+}
+
+
+void KRandRModule::defaults()
+{
+ load( true );
+}
+
+void KRandRModule::load()
+{
+ load( false );
+}
+
+void KRandRModule::load( bool useDefaults )
+{
+ if (!isValid())
+ return;
+
+ // Don't load screen configurations:
+ // It will be correct already if they wanted to retain their settings over TDE restarts,
+ // and if it isn't correct they have changed a) their X configuration, b) the screen
+ // with another program, or c) their hardware.
+ TDEConfig config("kcmrandrrc", true);
+
+ config.setReadDefaults( useDefaults );
+
+ m_oldApply = loadDisplay(config, false);
+ m_oldSyncTrayApp = syncTrayApp(config);
+
+ m_applyOnStartup->setChecked(m_oldApply);
+ m_syncTrayApp->setChecked(m_oldSyncTrayApp);
+
+ emit changed( useDefaults );
+}
+
+void KRandRModule::save()
+{
+ if (!isValid())
+ return;
+
+ apply();
+
+ m_oldApply = m_applyOnStartup->isChecked();
+ m_oldSyncTrayApp = m_syncTrayApp->isChecked();
+ TDEConfig config("kcmrandrrc");
+ saveDisplay(config, m_oldApply, m_oldSyncTrayApp);
+
+ setChanged();
+}
+
+void KRandRModule::setChanged()
+{
+ bool isChanged = (m_oldApply != m_applyOnStartup->isChecked()) || (m_oldSyncTrayApp != m_syncTrayApp->isChecked());
+ m_syncTrayApp->setEnabled(m_applyOnStartup->isChecked());
+
+ if (!isChanged)
+ for (int screenIndex = 0; screenIndex < numScreens(); screenIndex++) {
+ if (screen(screenIndex)->proposedChanged()) {
+ isChanged = true;
+ break;
+ }
+ }
+
+ if (isChanged != m_changed) {
+ m_changed = isChanged;
+ emit changed(m_changed);
+ }
+}
+
+void KRandRModule::apply()
+{
+ if (m_changed) {
+ applyProposed();
+
+ update();
+ }
+}
+
+
+void KRandRModule::update()
+{
+ m_sizeCombo->blockSignals(true);
+ m_sizeCombo->setCurrentItem(currentScreen()->proposedSize());
+ m_sizeCombo->blockSignals(false);
+
+ m_rotationGroup->blockSignals(true);
+ switch (currentScreen()->proposedRotation() & RandRScreen::RotateMask) {
+ case RandRScreen::Rotate0:
+ m_rotationGroup->setButton(0);
+ break;
+ case RandRScreen::Rotate90:
+ m_rotationGroup->setButton(1);
+ break;
+ case RandRScreen::Rotate180:
+ m_rotationGroup->setButton(2);
+ break;
+ case RandRScreen::Rotate270:
+ m_rotationGroup->setButton(3);
+ break;
+ default:
+ // Shouldn't hit this one
+ Q_ASSERT(currentScreen()->proposedRotation() & RandRScreen::RotateMask);
+ break;
+ }
+ m_rotationGroup->find(4)->setDown(currentScreen()->proposedRotation() & RandRScreen::ReflectX);
+ m_rotationGroup->find(5)->setDown(currentScreen()->proposedRotation() & RandRScreen::ReflectY);
+ m_rotationGroup->blockSignals(false);
+
+ m_refreshRates->blockSignals(true);
+ m_refreshRates->setCurrentItem(currentScreen()->proposedRefreshRate());
+ m_refreshRates->blockSignals(false);
+}
+
diff --git a/kcontrol/randr/tderandrmodule.h b/kcontrol/randr/tderandrmodule.h
new file mode 100644
index 000000000..65131ee26
--- /dev/null
+++ b/kcontrol/randr/tderandrmodule.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2002 Hamish Rodda <[email protected]>
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TDERANDRMODULE_H
+#define TDERANDRMODULE_H
+
+#include <libtderandr/libtderandr.h>
+
+class TQButtonGroup;
+class KComboBox;
+class TQCheckBox;
+
+class KRandRModule : public TDECModule, public KRandrSimpleAPI
+{
+ Q_OBJECT
+
+public:
+ KRandRModule(TQWidget *parent, const char *name, const TQStringList& _args);
+
+ virtual void load();
+ virtual void load(bool useDefaults);
+ virtual void save();
+ virtual void defaults();
+
+ static void performApplyOnStartup();
+
+protected slots:
+ void slotScreenChanged(int screen);
+ void slotRotationChanged();
+ void slotSizeChanged(int index);
+ void slotRefreshChanged(int index);
+ void setChanged();
+
+protected:
+ void apply();
+ void update();
+
+ void addRotationButton(int thisRotation, bool checkbox);
+ void populateRefreshRates();
+
+ KComboBox* m_screenSelector;
+ KComboBox* m_sizeCombo;
+ TQButtonGroup* m_rotationGroup;
+ KComboBox* m_refreshRates;
+ TQCheckBox* m_applyOnStartup;
+ TQCheckBox* m_syncTrayApp;
+ bool m_oldApply;
+ bool m_oldSyncTrayApp;
+
+ bool m_changed;
+};
+
+#endif
diff --git a/kcontrol/randr/tderandrpassivepopup.cpp b/kcontrol/randr/tderandrpassivepopup.cpp
new file mode 100644
index 000000000..5d2010f94
--- /dev/null
+++ b/kcontrol/randr/tderandrpassivepopup.cpp
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2003 Lubos Lunak <[email protected]>
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "tderandrpassivepopup.h"
+
+#include <tdeapplication.h>
+
+// this class is just like KPassivePopup, but it keeps track of the widget
+// it's supposed to be positioned next to, and adjust its position if that
+// widgets moves (needed because after a resolution switch Kicker will
+// reposition itself, causing normal KPassivePopup to stay at weird places)
+
+KRandrPassivePopup::KRandrPassivePopup( TQWidget *parent, const char *name, WFlags f )
+ : KPassivePopup( parent, name, f )
+ {
+ connect( &update_timer, TQT_SIGNAL( timeout()), TQT_SLOT( slotPositionSelf()));
+ }
+
+KRandrPassivePopup* KRandrPassivePopup::message( const TQString &caption, const TQString &text,
+ const TQPixmap &icon, TQWidget *parent, const char *name, int timeout )
+ {
+ KRandrPassivePopup *pop = new KRandrPassivePopup( parent, name );
+ pop->setAutoDelete( true );
+ pop->setView( caption, text, icon );
+ pop->setTimeout( timeout );
+ pop->show();
+ pop->startWatchingWidget( parent );
+ return pop;
+ }
+
+void KRandrPassivePopup::startWatchingWidget( TQWidget* widget_P )
+ {
+ static Atom wm_state = XInternAtom( tqt_xdisplay() , "WM_STATE", False );
+ Window win = widget_P->winId();
+ bool x11_events = false;
+ for(;;)
+ {
+ Window root, parent;
+ Window* children;
+ unsigned int nchildren;
+ XQueryTree( tqt_xdisplay(), win, &root, &parent, &children, &nchildren );
+ if( children != NULL )
+ XFree( children );
+ if( win == root ) // huh?
+ break;
+ win = parent;
+
+ TQWidget* widget = TQWidget::find( win );
+ if( widget != NULL )
+ {
+ widget->installEventFilter( this );
+ watched_widgets.append( widget );
+ }
+ else
+ {
+ XWindowAttributes attrs;
+ XGetWindowAttributes( tqt_xdisplay(), win, &attrs );
+ XSelectInput( tqt_xdisplay(), win, attrs.your_event_mask | StructureNotifyMask );
+ watched_windows.append( win );
+ x11_events = true;
+ }
+ Atom type;
+ int format;
+ unsigned long nitems, after;
+ unsigned char* data;
+ if( XGetWindowProperty( tqt_xdisplay(), win, wm_state, 0, 0, False, AnyPropertyType,
+ &type, &format, &nitems, &after, &data ) == Success )
+ {
+ if( data != NULL )
+ XFree( data );
+ if( type != None ) // toplevel window
+ break;
+ }
+ }
+ if( x11_events )
+ kapp->installX11EventFilter( this );
+ }
+
+bool KRandrPassivePopup::eventFilter( TQObject* o, TQEvent* e )
+ {
+ if( e->type() == TQEvent::Move && o->isWidgetType()
+ && watched_widgets.contains( TQT_TQWIDGET( o )))
+ TQTimer::singleShot( 0, this, TQT_SLOT( slotPositionSelf()));
+ return false;
+ }
+
+bool KRandrPassivePopup::x11Event( XEvent* e )
+ {
+ if( e->type == ConfigureNotify && watched_windows.contains( e->xconfigure.window ))
+ {
+ if( !update_timer.isActive())
+ update_timer.start( 10, true );
+ return false;
+ }
+ return KPassivePopup::x11Event( e );
+ }
+
+void KRandrPassivePopup::slotPositionSelf()
+ {
+ positionSelf();
+ }
+
+#include "tderandrpassivepopup.moc"
diff --git a/kcontrol/randr/tderandrpassivepopup.h b/kcontrol/randr/tderandrpassivepopup.h
new file mode 100644
index 000000000..3b1d4b4f6
--- /dev/null
+++ b/kcontrol/randr/tderandrpassivepopup.h
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2003 Lubos Lunak <[email protected]>
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __RANDRPASSIVEPOPUP_H__
+#define __RANDRPASSIVEPOPUP_H__
+
+#include <kpassivepopup.h>
+#include <tqvaluelist.h>
+#include <tqtimer.h>
+#include <X11/Xlib.h>
+
+class KRandrPassivePopup
+ : public KPassivePopup
+ {
+ Q_OBJECT
+ public:
+ static KRandrPassivePopup *message( const TQString &caption, const TQString &text,
+ const TQPixmap &icon, TQWidget *parent, const char *name=0, int timeout = -1 );
+ protected:
+ virtual bool eventFilter( TQObject* o, TQEvent* e );
+ virtual bool x11Event( XEvent* e );
+ private slots:
+ void slotPositionSelf();
+ private:
+ KRandrPassivePopup( TQWidget *parent=0, const char *name=0, WFlags f=0 );
+ void startWatchingWidget( TQWidget* w );
+ TQValueList< TQWidget* > watched_widgets;
+ TQValueList< Window > watched_windows;
+ TQTimer update_timer;
+ };
+
+#endif
diff --git a/kcontrol/randr/tderandrtray-autostart.desktop b/kcontrol/randr/tderandrtray-autostart.desktop
new file mode 100644
index 000000000..3a2f774bc
--- /dev/null
+++ b/kcontrol/randr/tderandrtray-autostart.desktop
@@ -0,0 +1,144 @@
+[Desktop Entry]
+Name=TDERandRTray
+Name[be]=Змена параметраў манітора
+Name[hu]=TDEépernyőfelbontás
+Name[ne]=TDERandR ट्रे
+Name[pt_BR]=Ícone do TDERandR
+Name[sv]=TDErandrtray
+Name[vi]=TDE KRandR
+GenericName=Screen Resize & Rotate
+GenericName[af]=Skerm Hervergroot & Roteer
+GenericName[be]=Змена памераў экрана і перагортванне
+GenericName[bg]=Размер и ротация на екрана
+GenericName[bn]=পর্দা মাপবদল ও আবর্তন
+GenericName[br]=Adventañ ha treiñ ar skramm
+GenericName[bs]=Veličina i rotacija ekrana
+GenericName[ca]=Amida i gira la pantalla
+GenericName[cs]=Změna velikosti a rotace obrazovky
+GenericName[csb]=Òbrócenié ë zjinaka miarë ekranu
+GenericName[cy]=Newid Maint a Cylchdroi'r Sgrîn
+GenericName[da]=Ændr størrelse på skærm & Rotér
+GenericName[de]=Bildschirmgröße & -ausrichtung ändern
+GenericName[el]=Αλλαγή μεγέθους & Περιστροφή οθόνης
+GenericName[eo]=Regrandigi kaj Turni Ekranon
+GenericName[es]=Redimensionar y rotar pantalla
+GenericName[et]=Ekraani suuruse muutmine ja pööramine
+GenericName[eu]=Pantailaren tamaina aldaketa eta biraketa
+GenericName[fa]=تغییر اندازه و چرخش پرده
+GenericName[fi]=Näytön kuvan koon muuttaminen ja kuvan kääntäminen
+GenericName[fr]=Redimensionnement et rotation de l'écran
+GenericName[fy]=Skerm rotearje en grutte wizigje
+GenericName[gl]=Rotación e Redimensionamento da Pantallla
+GenericName[he]=שינוי גודל המסך וסיבובו
+GenericName[hr]=Veličine i orijentacija zaslona
+GenericName[hu]=Képernyőbeállító
+GenericName[is]=Stærð og snúningur skjáa
+GenericName[it]=Ruota e ridimensiona lo schermo
+GenericName[ja]=スクリーンのリサイズと回転
+GenericName[ka]=ეკრანის ზომა და ორიენტაცია
+GenericName[kk]=Экранды өзгерту және бұрау
+GenericName[km]=ប្ដូរ​ទំហំ & បង្វិល​អេក្រង់
+GenericName[ko]=화면 크기 조정 및 회전
+GenericName[lt]=Ekrano dydžio keitimas ir pasukimas
+GenericName[mk]=Големина и ротација на екранот
+GenericName[ms]=Saiz Semula Skrin & Putar
+GenericName[nb]=Endre størrelsen på og rotere skjermbildet
+GenericName[nds]=Schirmgrött un -utrichten ännern
+GenericName[ne]=पर्दा रिसाइज र परिक्रमण
+GenericName[nl]=Scherm roteren en grootte wijzigen
+GenericName[nn]=Endra storleiken på og roter skjermbiletet
+GenericName[pa]=ਪਰਦਾ ਮੁੜ ਆਕਾਰ ਤੇ ਘੁੰਮਾਓ
+GenericName[pl]=Obrót i zmiana rozmiaru ekranu
+GenericName[pt]=Mudar o Tamanho e Rodar o Ecrã
+GenericName[pt_BR]=Redimensionar Tela & Rotacionar
+GenericName[ro]=Redimensionare și rotire ecran
+GenericName[ru]=Изменение размера и ориентации экрана
+GenericName[rw]=Kuhindura ingano & Kuzengurutsa Mugaragaza
+GenericName[se]=Rievdat šearbmagova sturrodaga ja jorat dan
+GenericName[sk]=Zmena veľkosti a otočenia obrazovky
+GenericName[sl]=Spreminjanje velikosti in obračanje zaslona
+GenericName[sr]=Промена величине и ротација екрана
+GenericName[sr@Latn]=Promena veličine i rotacija ekrana
+GenericName[sv]=Ändra skärmstorlek och rotera
+GenericName[ta]=திரை அளவு மாற்று & சுழற்று
+GenericName[tg]=Ивази андоза ва мавқеи экран
+GenericName[th]=ปรับขนาดและหมุนหน้าจอ
+GenericName[tr]=Ekran Boyutlandır ve Döndür
+GenericName[tt]=Küräk Ülçäme & Borılışı
+GenericName[uk]=Зміна розміру та обертання екрана
+GenericName[uz]=Ekraning oʻlchamini oʻzgartirish va burish
+GenericName[uz@cyrillic]=Экранинг ўлчамини ўзгартириш ва буриш
+GenericName[vi]=Thay đổi cỡ màn hình & Quay
+GenericName[wa]=Candjî l' grandeu del waitroûle eyet l' tourner
+GenericName[zh_CN]=屏幕大小和旋转
+GenericName[zh_TW]=螢幕調整大小及旋轉
+Comment=Resize and rotate X screens.
+Comment[af]=Hervergroot en roteer X skerms.
+Comment[ar]=غيير القياس و الدوران للشاشات X.
+Comment[be]=Змена памераў і перагортванне экранаў X.
+Comment[bg]=Размер и ротация на екрана.
+Comment[bn]=আপনার এক্স-স্ক্রীণ-এর আকৃতি এবং দিশা পরিবর্তন করুন
+Comment[br]=Adventañ ha treiñ ho diskweloù X.
+Comment[bs]=Podesite veličinu i rotirajte vaš ekran.
+Comment[ca]=Gira i amida les pantalles X.
+Comment[cs]=Změna velikosti a rotace obrazovky.
+Comment[csb]=Zjinaka miarë ë pòłożenia ekranów.
+Comment[da]=Ændrer størrelse og roterer X-skærme
+Comment[de]=Die Größe und Ausrichtung der Anzeige ändern
+Comment[el]=Αλλαγή μεγέθους και περιστροφή της οθόνης.
+Comment[eo]=Regrandigi kaj turni X ekranojn.
+Comment[es]=Ajustar el tamaño y rotar las pantallas X.
+Comment[et]=X'i ekraani muutmine ja pööramine
+Comment[eu]=Aldatu tamaina eta biratu zure X pantailak.
+Comment[fa]=تغییر‌ اندازه و چرخش پرده‌های X.
+Comment[fi]=Näytön kuvan koon muuttaminen ja kuvan kääntäminen
+Comment[fr]=Redimensionner et retourner votre affichage.
+Comment[fy]=Skermgrutte wizigje en rotearje X skermen
+Comment[ga]=Athraigh an méid agus rothlaigh scáileáin X.
+Comment[gl]=Redimensionar e rotar pantallas
+Comment[he]=שנה את גודלה של התצוגה שלך וסובב אותה.
+Comment[hr]=Promjena veličine i orijentacije X zaslona
+Comment[hu]=A képernyő átméretezése, elforgatása
+Comment[is]=Breyta stærð skjásins og snúa honum.
+Comment[it]=Ridimensiona e ruota gli schermi di X.
+Comment[ja]=X スクリーンのリサイズと回転。
+Comment[ka]=ეკრანის ზომის და ორიენტაციის შეცვლა
+Comment[kk]=Экранның өлшемін және бағытын өзгерту
+Comment[km]=ប្ដូរ​ទំហំ និង​បង្វិល​អេក្រង់ X ។
+Comment[lt]=Keisti X ekrano dydį ir orientaciją.
+Comment[mk]=Сменете ја големината и ротацијата на вашиот екран
+Comment[nb]=Endrer størrelsen på og roterer X-skjermbildet
+Comment[nds]=Grött un Utrichten vun den X-Schirm ännern
+Comment[ne]=X पर्दा रिसाइज गर्नुहोस् र घुमाउनुहोस्
+Comment[nl]=Scherm roteren en van grootte veranderen
+Comment[nn]=Endra storleiken på og roter X-skjermbiletet.
+Comment[pa]=X ਸਕਰੀਨ ਨੂੰ ਮੁੜ-ਅਕਾਰ ਅਤੇ ਘੁੰਮਾਓ।
+Comment[pl]=Zmiana rozmiaru i orientacji ekranów.
+Comment[pt]=Mudar o tamanho e rodar os ecrãs do X.
+Comment[pt_BR]=Redimensiona e rotaciona as tela do X.
+Comment[ro]=Redimensionează și rotește ecranele X.
+Comment[ru]=Изменение размера и ориентации экранов X.
+Comment[se]=Rievdat X-šearpmaid sturrodaga ja joraheami.
+Comment[sk]=Zmení veľkosť a otočí obrazovky
+Comment[sl]=Spremenite velikost in obrnite zaslon.
+Comment[sr]=Промените величину и оријентацију екрана
+Comment[sr@Latn]=Promenite veličinu i orijentaciju ekrana
+Comment[sv]=Storleksändring och rotation av X-skärmar.
+Comment[tg]=Ивази андоза ва мавқеи экранҳои Х.
+Comment[th]=ปรับแต่งการแสดงผลของ X
+Comment[tr]=Ekranı boyutlandır ve çevir.
+Comment[uk]=Зміна розміру та обертання екранів X.
+Comment[uz]=Ekraning oʻlchamini oʻzgartirish va burish
+Comment[uz@cyrillic]=Экранинг ўлчамини ўзгартириш ва буриш
+Comment[vi]=Đổi cỡ và quay màn hình X.
+Comment[wa]=Candjî l' grandeu eyet tourner les waitroûles X.
+Comment[zh_CN]=更改 X 屏幕的大小和旋转。
+Comment[zh_TW]=調整大小及旋轉 X 螢幕。
+Exec=tderandrtray
+Icon=randr
+X-TDE-autostart-after=panel
+X-TDE-StartupNotify=false
+X-TDE-UniqueApplet=true
+X-TDE-autostart-condition=tderandrtrayrc:General:Autostart:true
+Categories=System;Applet;
+
diff --git a/kcontrol/randr/tderandrtray.cpp b/kcontrol/randr/tderandrtray.cpp
new file mode 100644
index 000000000..a443c3781
--- /dev/null
+++ b/kcontrol/randr/tderandrtray.cpp
@@ -0,0 +1,908 @@
+/*
+ * Copyright (c) 2002,2003 Hamish Rodda <[email protected]>
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include <tqtimer.h>
+#include <tqimage.h>
+#include <tqtooltip.h>
+
+#include <tdeaction.h>
+#include <tdeapplication.h>
+#include <kcmultidialog.h>
+#include <kdebug.h>
+#include <khelpmenu.h>
+#include <kiconloader.h>
+#include <tdelocale.h>
+#include <tdepopupmenu.h>
+#include <kstdaction.h>
+#include <kstdguiitem.h>
+#include <tdeglobal.h>
+#include <tdemessagebox.h>
+#include <kstandarddirs.h>
+
+#include <cstdlib>
+#include <unistd.h>
+
+#include "configdialog.h"
+
+#include "tderandrtray.h"
+#include "tderandrpassivepopup.h"
+#include "tderandrtray.moc"
+
+#define OUTPUT_CONNECTED (1 << 0)
+#define OUTPUT_UNKNOWN (1 << 1)
+#define OUTPUT_DISCONNECTED (1 << 2)
+#define OUTPUT_ON (1 << 3)
+#define OUTPUT_ALL (0xf)
+
+KRandRSystemTray::KRandRSystemTray(TQWidget* parent, const char *name)
+ : KSystemTray(parent, name)
+ , m_popupUp(false)
+ , m_help(new KHelpMenu(this, TDEGlobal::instance()->aboutData(), false, actionCollection()))
+{
+ TDEPopupMenu *help = m_help->menu();
+ help->connectItem(KHelpMenu::menuHelpContents, this, TQT_SLOT(slotHelpContents()));
+ setPixmap(KSystemTray::loadIcon("randr"));
+ setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
+ connect(this, TQT_SIGNAL(quitSelected()), this, TQT_SLOT(_quit()));
+ TQToolTip::add(this, i18n("Screen resize & rotate"));
+ my_parent = parent;
+
+ //printf("Reading configuration...\n");
+ globalKeys = new TDEGlobalAccel(TQT_TQOBJECT(this));
+ TDEGlobalAccel* keys = globalKeys;
+#include "tderandrbindings.cpp"
+ // the keys need to be read from kdeglobals, not kickerrc
+ globalKeys->readSettings();
+ globalKeys->setEnabled(true);
+ globalKeys->updateConnections();
+
+ connect(kapp, TQT_SIGNAL(settingsChanged(int)), TQT_SLOT(slotSettingsChanged(int)));
+
+#if (TQT_VERSION-0 >= 0x030200) // XRANDR support
+// connect(this, TQT_SIGNAL(screenSizeChanged(int, int)), kapp->desktop(), TQT_SLOT( desktopResized()));
+#endif
+
+ randr_display = XOpenDisplay(NULL);
+
+ if (isValid() == true) {
+ last_known_x = currentScreen()->currentPixelWidth();
+ last_known_y = currentScreen()->currentPixelHeight();
+ }
+
+ t_config = new KSimpleConfig("kiccconfigrc");
+
+ TQString cur_profile;
+ cur_profile = getCurrentProfile();
+ if (cur_profile != "") {
+ applyIccConfiguration(cur_profile, NULL);
+ }
+
+#ifdef __TDE_HAVE_TDEHWLIB
+ TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices();
+ connect(hwdevices, TQT_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQT_SLOT(deviceChanged(TDEGenericDevice*)));
+#endif
+}
+
+/*!
+ * \b TQT_SLOT which called if tderandrtray is exited by the user. In this case the user
+ * is asked through a yes/no box if "KRandRTray should start automatically on log in" and the
+ * result is written to the KDE configfile.
+ */
+void KRandRSystemTray::_quit (){
+ r_config = new KSimpleConfig("tderandrtrayrc");
+
+ TQString tmp1 = i18n ("Start KRandRTray automatically when you log in?");
+ int tmp2 = KMessageBox::questionYesNo ( 0, tmp1, i18n("Question"), i18n("Start Automatically"), i18n("Do Not Start"));
+ r_config->setGroup("General");
+ r_config->writeEntry ("Autostart", tmp2 == KMessageBox::Yes);
+ r_config->sync ();
+
+ exit(0);
+}
+
+void KRandRSystemTray::resizeTrayIcon ()
+{
+ // Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
+ TQPixmap origpixmap;
+ TQPixmap scaledpixmap;
+ TQImage newIcon;
+ origpixmap = KSystemTray::loadSizedIcon( "randr", width() );
+ newIcon = origpixmap;
+ newIcon = newIcon.smoothScale(width(), height());
+ scaledpixmap = newIcon;
+ setPixmap(scaledpixmap);
+}
+
+void KRandRSystemTray::resizeEvent ( TQResizeEvent * )
+{
+ // Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
+ resizeTrayIcon();
+}
+
+void KRandRSystemTray::showEvent ( TQShowEvent * )
+{
+ // Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
+ resizeTrayIcon();
+}
+
+void KRandRSystemTray::mousePressEvent(TQMouseEvent* e)
+{
+ // Popup the context menu with left-click
+ if (e->button() == Qt::LeftButton) {
+ contextMenuAboutToShow(contextMenu());
+ contextMenu()->popup(e->globalPos());
+ e->accept();
+ return;
+ }
+
+ KSystemTray::mousePressEvent(e);
+}
+
+void KRandRSystemTray::reloadDisplayConfiguration()
+{
+ // Reload the randr configuration...
+ int i;
+ int activeOutputs = 0;
+ int screenDeactivated = 0;
+
+ if (isValid() == true) {
+ randr_screen_info = read_screen_info(randr_display);
+
+ // Count outputs in the active state
+ activeOutputs = 0;
+ for (i = 0; i < randr_screen_info->n_output; i++) {
+ // Look for ON outputs
+ if (!randr_screen_info->outputs[i]->cur_crtc) {
+ continue;
+ }
+ // Look for CONNECTED outputs
+ if (RR_Disconnected == randr_screen_info->outputs[i]->info->connection) {
+ continue;
+ }
+
+ activeOutputs++;
+ }
+
+ if (activeOutputs < 1) {
+ // Houston, we have a problem!
+ // There are no active displays!
+ // Activate the first connected display we come across...
+ for (i = 0; i < randr_screen_info->n_output; i++) {
+ // Look for OFF outputs
+ if (randr_screen_info->outputs[i]->cur_crtc) {
+ continue;
+ }
+ // Look for CONNECTED outputs
+ if (RR_Disconnected == randr_screen_info->outputs[i]->info->connection) {
+ continue;
+ }
+
+ // Activate this output
+ randr_screen_info->cur_crtc = randr_screen_info->outputs[i]->cur_crtc;
+ randr_screen_info->cur_output = randr_screen_info->outputs[i];
+ randr_screen_info->cur_output->auto_set = 1;
+ randr_screen_info->cur_output->off_set = 0;
+ output_auto (randr_screen_info, randr_screen_info->cur_output);
+ i=main_low_apply(randr_screen_info);
+
+ if (randr_screen_info->outputs[i]->cur_crtc) {
+ // Output successfully activated!
+ set_primary_output(randr_screen_info, randr_screen_info->cur_output->id);
+ break;
+ }
+ }
+ }
+
+ for (i = 0; i < randr_screen_info->n_output; i++) {
+ // Look for ON outputs
+ if (!randr_screen_info->outputs[i]->cur_crtc) {
+ continue;
+ }
+ // Look for DISCONNECTED outputs
+ if (RR_Disconnected != randr_screen_info->outputs[i]->info->connection) {
+ continue;
+ }
+
+ // Deactivate this display to avoid a crash!
+ randr_screen_info->cur_crtc = randr_screen_info->outputs[i]->cur_crtc;
+ randr_screen_info->cur_output = randr_screen_info->outputs[i];
+ randr_screen_info->cur_output->auto_set = 0;
+ randr_screen_info->cur_output->off_set = 1;
+ output_off(randr_screen_info, randr_screen_info->cur_output);
+ main_low_apply(randr_screen_info);
+
+ screenDeactivated = 1;
+ }
+
+ if (screenDeactivated == 1) {
+ findPrimaryDisplay();
+ refresh();
+
+ currentScreen()->proposeSize(GetDefaultResolutionParameter());
+ currentScreen()->applyProposed();
+ }
+ }
+}
+
+void KRandRSystemTray::contextMenuAboutToShow(TDEPopupMenu* menu)
+{
+ int lastIndex = 0;
+
+ reloadDisplayConfiguration();
+
+ menu->clear();
+ menu->setCheckable(true);
+
+ bool valid = isValid();
+
+ if (!valid) {
+ lastIndex = menu->insertItem(i18n("Required X Extension Not Available"));
+ menu->setItemEnabled(lastIndex, false);
+
+ }
+ else {
+ m_screenPopups.clear();
+ for (int s = 0; s < numScreens() /*&& numScreens() > 1 */; s++) {
+ setCurrentScreen(s);
+ if (s == screenIndexOfWidget(this)) {
+ /*lastIndex = menu->insertItem(i18n("Screen %1").arg(s+1));
+ menu->setItemEnabled(lastIndex, false);*/
+ } else {
+ TDEPopupMenu* subMenu = new TDEPopupMenu(menu, TQString("screen%1").arg(s+1).latin1());
+ m_screenPopups.append(subMenu);
+ populateMenu(subMenu);
+ lastIndex = menu->insertItem(i18n("Screen %1").arg(s+1), subMenu);
+ connect(subMenu, TQT_SIGNAL(activated(int)), TQT_SLOT(slotScreenActivated()));
+ }
+ }
+
+ setCurrentScreen(screenIndexOfWidget(this));
+ populateMenu(menu);
+ }
+
+ addOutputMenu(menu);
+
+ // Find any user ICC profiles
+ TQStringList cfgProfiles;
+ cfgProfiles = t_config->groupList();
+ if (cfgProfiles.isEmpty() == false) {
+ menu->insertTitle(SmallIcon("kcoloredit"), i18n("Color Profile"));
+ }
+ for (TQStringList::Iterator t(cfgProfiles.begin()); t != cfgProfiles.end(); ++t) {
+ lastIndex = menu->insertItem(*t);
+ if (t_config->readEntry("CurrentProfile") == (*t)) {
+ menu->setItemChecked(lastIndex, true);
+ }
+ menu->setItemEnabled(lastIndex, t_config->readBoolEntry("EnableICC", false));
+ menu->connectItem(lastIndex, this, TQT_SLOT(slotColorProfileChanged(int)));
+ }
+
+ if (valid) {
+ // Find any display profiles
+ TQStringList displayProfiles;
+ displayProfiles = getDisplayConfigurationProfiles(locateLocal("config", "/", true));
+ if (!displayProfiles.isEmpty()) {
+ menu->insertTitle(SmallIcon("background"), i18n("Display Profiles"));
+ lastIndex = menu->insertItem(SmallIcon("bookmark"), "<default>");
+ menu->connectItem(lastIndex, this, TQT_SLOT(slotDisplayProfileChanged(int)));
+ for (TQStringList::Iterator t(displayProfiles.begin()); t != displayProfiles.end(); ++t) {
+ lastIndex = menu->insertItem(SmallIcon("bookmark"), *t);
+ menu->connectItem(lastIndex, this, TQT_SLOT(slotDisplayProfileChanged(int)));
+ }
+ }
+ }
+
+ menu->insertTitle(SmallIcon("randr"), i18n("Global Configuration"));
+
+ TDEAction *actColors = new TDEAction( i18n( "Configure Displays..." ),
+ SmallIconSet( "configure" ), TDEShortcut(), TQT_TQOBJECT(this), TQT_SLOT( slotDisplayConfig() ),
+ actionCollection() );
+ actColors->plug( menu );
+
+// TDEAction *actPrefs = new TDEAction( i18n( "Configure Display..." ),
+// SmallIconSet( "configure" ), TDEShortcut(), this, TQT_SLOT( slotPrefs() ),
+// actionCollection() );
+// actPrefs->plug( menu );
+
+ TDEAction *actSKeys = new TDEAction( i18n( "Configure Shortcut Keys..." ),
+ SmallIconSet( "configure" ), TDEShortcut(), TQT_TQOBJECT(this), TQT_SLOT( slotSKeys() ),
+ actionCollection() );
+ actSKeys->plug( menu );
+
+ menu->insertItem(SmallIcon("help"),KStdGuiItem::help().text(), m_help->menu());
+ TDEAction *quitAction = actionCollection()->action(KStdAction::name(KStdAction::Quit));
+ quitAction->plug(menu);
+
+ m_menu = menu;
+}
+
+void KRandRSystemTray::slotScreenActivated()
+{
+ setCurrentScreen(m_screenPopups.find(static_cast<const TDEPopupMenu*>(sender())));
+}
+
+void KRandRSystemTray::configChanged()
+{
+ refresh();
+
+ static bool first = true;
+
+ if ((last_known_x == currentScreen()->currentPixelWidth()) && \
+ (last_known_y == currentScreen()->currentPixelHeight())) {
+ first = true;
+ }
+
+ last_known_x = currentScreen()->currentPixelWidth();
+ last_known_y = currentScreen()->currentPixelHeight();
+
+ if (!first) {
+ emit (screenSizeChanged(currentScreen()->currentPixelWidth(), currentScreen()->currentPixelHeight()));
+
+ KRandrPassivePopup::message(
+ i18n("Screen configuration has changed"),
+ currentScreen()->changedMessage(), SmallIcon("view-fullscreen"),
+ this, "ScreenChangeNotification");
+ }
+
+ first = false;
+
+ TQString cur_profile;
+ cur_profile = getCurrentProfile();
+ if (cur_profile != "") {
+ applyIccConfiguration(cur_profile, NULL);
+ }
+}
+
+int KRandRSystemTray::GetDefaultResolutionParameter()
+{
+ int returnIndex = 0;
+
+ int numSizes = currentScreen()->numSizes();
+ int* sizeSort = new int[numSizes];
+
+ for (int i = 0; i < numSizes; i++) {
+ sizeSort[i] = currentScreen()->pixelCount(i);
+ }
+
+ int highest = -1, highestIndex = -1;
+
+ for (int i = 0; i < numSizes; i++) {
+ if (sizeSort[i] && sizeSort[i] > highest) {
+ highest = sizeSort[i];
+ highestIndex = i;
+ }
+ }
+ sizeSort[highestIndex] = -1;
+ Q_ASSERT(highestIndex != -1);
+
+ returnIndex = highestIndex;
+
+ delete [] sizeSort;
+ sizeSort = 0L;
+
+ return returnIndex;
+}
+
+int KRandRSystemTray::GetHackResolutionParameter() {
+ int resparm;
+
+ resparm = GetDefaultResolutionParameter();
+ resparm++;
+
+ return resparm;
+}
+
+void KRandRSystemTray::populateMenu(TDEPopupMenu* menu)
+{
+ int lastIndex = 0;
+
+ menu->insertTitle(SmallIcon("view-fullscreen"), i18n("Screen Size"));
+
+ int numSizes = currentScreen()->numSizes();
+ int* sizeSort = new int[numSizes];
+
+ for (int i = 0; i < numSizes; i++) {
+ sizeSort[i] = currentScreen()->pixelCount(i);
+ }
+
+ for (int j = 0; j < numSizes; j++) {
+ int highest = -1, highestIndex = -1;
+
+ for (int i = 0; i < numSizes; i++) {
+ if (sizeSort[i] && sizeSort[i] > highest) {
+ highest = sizeSort[i];
+ highestIndex = i;
+ }
+ }
+ sizeSort[highestIndex] = -1;
+ Q_ASSERT(highestIndex != -1);
+
+ lastIndex = menu->insertItem(i18n("%1 x %2").arg(currentScreen()->pixelSize(highestIndex).width()).arg(currentScreen()->pixelSize(highestIndex).height()));
+
+ if (currentScreen()->proposedSize() == highestIndex)
+ menu->setItemChecked(lastIndex, true);
+
+ menu->setItemParameter(lastIndex, highestIndex);
+ menu->connectItem(lastIndex, this, TQT_SLOT(slotResolutionChanged(int)));
+ }
+ delete [] sizeSort;
+ sizeSort = 0L;
+
+ // Don't display the rotation options if there is no point (ie. none are supported)
+ // XFree86 4.3 does not include rotation support.
+ if (currentScreen()->rotations() != RandRScreen::Rotate0) {
+ menu->insertTitle(SmallIcon("reload"), i18n("Orientation"));
+
+ for (int i = 0; i < 6; i++) {
+ if ((1 << i) & currentScreen()->rotations()) {
+ lastIndex = menu->insertItem(currentScreen()->rotationIcon(1 << i), RandRScreen::rotationName(1 << i));
+
+ if (currentScreen()->proposedRotation() & (1 << i))
+ menu->setItemChecked(lastIndex, true);
+
+ menu->setItemParameter(lastIndex, 1 << i);
+ menu->connectItem(lastIndex, this, TQT_SLOT(slotOrientationChanged(int)));
+ }
+ }
+ }
+
+ TQStringList rr = currentScreen()->refreshRates(currentScreen()->proposedSize());
+
+ if (rr.count())
+ menu->insertTitle(SmallIcon("clock"), i18n("Refresh Rate"));
+
+ int i = 0;
+ for (TQStringList::Iterator it = rr.begin(); it != rr.end(); ++it, i++) {
+ lastIndex = menu->insertItem(*it);
+
+ if (currentScreen()->proposedRefreshRate() == i)
+ menu->setItemChecked(lastIndex, true);
+
+ menu->setItemParameter(lastIndex, i);
+ menu->connectItem(lastIndex, this, TQT_SLOT(slotRefreshRateChanged(int)));
+ }
+}
+
+void KRandRSystemTray::slotResolutionChanged(int parameter)
+{
+ if (currentScreen()->currentSize() == parameter) {
+ //printf("This resolution is already in use; applying again...\n");
+ currentScreen()->proposeSize(parameter);
+ currentScreen()->applyProposed();
+ return;
+ }
+
+ currentScreen()->proposeSize(parameter);
+
+ currentScreen()->proposeRefreshRate(-1);
+
+ if (currentScreen()->applyProposedAndConfirm()) {
+ TDEConfig config("kcmrandrrc");
+ if (syncTrayApp(config))
+ currentScreen()->save(config);
+ }
+}
+
+void KRandRSystemTray::slotOrientationChanged(int parameter)
+{
+ int propose = currentScreen()->currentRotation();
+
+ if (parameter & RandRScreen::RotateMask)
+ propose &= RandRScreen::ReflectMask;
+
+ propose ^= parameter;
+
+ if (currentScreen()->currentRotation() == propose)
+ return;
+
+ currentScreen()->proposeRotation(propose);
+
+ if (currentScreen()->applyProposedAndConfirm()) {
+ TDEConfig config("kcmrandrrc");
+ if (syncTrayApp(config))
+ currentScreen()->save(config);
+ }
+}
+
+void KRandRSystemTray::slotRefreshRateChanged(int parameter)
+{
+ if (currentScreen()->currentRefreshRate() == parameter)
+ return;
+
+ currentScreen()->proposeRefreshRate(parameter);
+
+ if (currentScreen()->applyProposedAndConfirm()) {
+ TDEConfig config("kcmrandrrc");
+ if (syncTrayApp(config))
+ currentScreen()->save(config);
+ }
+}
+
+void KRandRSystemTray::slotPrefs()
+{
+ KCMultiDialog *kcm = new KCMultiDialog( KDialogBase::Plain, i18n( "Configure" ), this );
+
+ kcm->addModule( "displayconfig" );
+ kcm->setPlainCaption( i18n( "Configure Display" ) );
+ kcm->exec();
+}
+
+void KRandRSystemTray::slotDisplayConfig()
+{
+ KCMultiDialog *kcm = new KCMultiDialog( KDialogBase::Plain, i18n( "Configure" ), this );
+
+ kcm->addModule( "displayconfig" );
+ kcm->setPlainCaption( i18n( "Configure Displays" ) );
+ kcm->exec();
+}
+
+void KRandRSystemTray::slotSettingsChanged(int category)
+{
+ if ( category == (int) TDEApplication::SETTINGS_SHORTCUTS ) {
+ globalKeys->readSettings();
+ globalKeys->updateConnections();
+ }
+}
+
+void KRandRSystemTray::slotSKeys()
+{
+ ConfigDialog *dlg = new ConfigDialog(globalKeys, true);
+
+ if ( dlg->exec() == TQDialog::Accepted ) {
+ dlg->commitShortcuts();
+ globalKeys->writeSettings(0, true);
+ globalKeys->updateConnections();
+ }
+
+ delete dlg;
+}
+
+void KRandRSystemTray::slotCycleDisplays()
+{
+ XRROutputInfo *output_info;
+ char *output_name;
+ int i;
+ int current_on_index = -1;
+ int max_index = -1;
+ int prev_on_index;
+
+ randr_screen_info = read_screen_info(randr_display);
+
+ for (i = 0; i < randr_screen_info->n_output; i++) {
+ output_info = randr_screen_info->outputs[i]->info;
+ // Look for ON outputs...
+ if (!randr_screen_info->outputs[i]->cur_crtc) {
+ continue;
+ }
+ // ...that are connected
+ if (RR_Disconnected == randr_screen_info->outputs[i]->info->connection) {
+ continue;
+ }
+
+ output_name = output_info->name;
+ current_on_index = i;
+ if (i > max_index) {
+ max_index = i;
+ }
+ }
+
+ for (i = 0; i < randr_screen_info->n_output; i++) {
+ output_info = randr_screen_info->outputs[i]->info;
+ // Look for CONNECTED outputs....
+ if (RR_Disconnected == randr_screen_info->outputs[i]->info->connection) {
+ continue;
+ }
+ // ...that are not ON
+ if (randr_screen_info->outputs[i]->cur_crtc) {
+ continue;
+ }
+
+ output_name = output_info->name;
+ if (i > max_index) {
+ max_index = i;
+ }
+ }
+
+ for (i = 0; i < randr_screen_info->n_output; i++) {
+ output_info = randr_screen_info->outputs[i]->info;
+ // Look for ALL outputs that are not connected....
+ if (RR_Disconnected != randr_screen_info->outputs[i]->info->connection) {
+ continue;
+ }
+ // ...or ON
+ if (randr_screen_info->outputs[i]->cur_crtc) {
+ continue;
+ }
+
+ output_name = output_info->name;
+ if (i > max_index) {
+ max_index = i;
+ }
+ }
+
+ //printf("Active: %d\n", current_on_index);
+ //printf("Max: %d\n", max_index);
+
+ if ((current_on_index == -1) && (max_index == -1)) {
+ // There is no connected display available! ABORT
+ return;
+ }
+
+ prev_on_index = current_on_index;
+ current_on_index = current_on_index + 1;
+ if (current_on_index > max_index) {
+ current_on_index = 0;
+ }
+ while (RR_Disconnected == randr_screen_info->outputs[current_on_index]->info->connection) {
+ current_on_index = current_on_index + 1;
+ if (current_on_index > max_index) {
+ current_on_index = 0;
+ }
+ }
+ if (prev_on_index != current_on_index) {
+ randr_screen_info->cur_crtc = randr_screen_info->outputs[current_on_index]->cur_crtc;
+ randr_screen_info->cur_output = randr_screen_info->outputs[current_on_index];
+ randr_screen_info->cur_output->auto_set = 1;
+ randr_screen_info->cur_output->off_set = 0;
+ output_auto (randr_screen_info, randr_screen_info->cur_output);
+ i=main_low_apply(randr_screen_info);
+
+ if (randr_screen_info->outputs[current_on_index]->cur_crtc) {
+ // Output successfully activated!
+ set_primary_output(randr_screen_info, randr_screen_info->cur_output->id);
+
+ if (prev_on_index != -1) {
+ if (randr_screen_info->outputs[prev_on_index]->cur_crtc != NULL) {
+ if (RR_Disconnected != randr_screen_info->outputs[prev_on_index]->info->connection) {
+ randr_screen_info->cur_crtc = randr_screen_info->outputs[prev_on_index]->cur_crtc;
+ randr_screen_info->cur_output = randr_screen_info->outputs[prev_on_index];
+ randr_screen_info->cur_output->auto_set = 0;
+ randr_screen_info->cur_output->off_set = 1;
+ output_off(randr_screen_info, randr_screen_info->cur_output);
+ i=main_low_apply(randr_screen_info);
+ }
+ }
+ }
+
+ // Do something about the disconnected outputs
+ for (i = 0; i < randr_screen_info->n_output; i++) {
+ output_info = randr_screen_info->outputs[i]->info;
+ // Look for ON outputs
+ if (!randr_screen_info->outputs[i]->cur_crtc) {
+ continue;
+ }
+ if (RR_Disconnected != randr_screen_info->outputs[i]->info->connection) {
+ continue;
+ }
+
+ output_name = output_info->name;
+
+ // Deactivate this display to avoid a crash!
+ randr_screen_info->cur_crtc = randr_screen_info->outputs[i]->cur_crtc;
+ randr_screen_info->cur_output = randr_screen_info->outputs[i];
+ randr_screen_info->cur_output->auto_set = 0;
+ randr_screen_info->cur_output->off_set = 1;
+ output_off(randr_screen_info, randr_screen_info->cur_output);
+ main_low_apply(randr_screen_info);
+ }
+
+ findPrimaryDisplay();
+ refresh();
+
+ currentScreen()->proposeSize(GetDefaultResolutionParameter());
+ currentScreen()->applyProposed();
+ }
+ else {
+ output_name = randr_screen_info->outputs[current_on_index]->info->name;
+ KMessageBox::sorry(my_parent, i18n("<b>Unable to activate output %1</b><p>Either the output is not connected to a display,<br>or the display configuration is not detectable").arg(output_name), i18n("Output Unavailable"));
+ }
+ }
+}
+
+void KRandRSystemTray::findPrimaryDisplay()
+{
+ int i;
+
+ for (i = 0; i < randr_screen_info->n_output; i++) {
+ // Look for ON outputs...
+ if (!randr_screen_info->outputs[i]->cur_crtc) {
+ continue;
+ }
+
+ // ...that are connected
+ if (RR_Disconnected == randr_screen_info->outputs[i]->info->connection) {
+ continue;
+ }
+
+ randr_screen_info->cur_crtc = randr_screen_info->outputs[i]->cur_crtc;
+ randr_screen_info->cur_output = randr_screen_info->outputs[i];
+ }
+}
+
+void KRandRSystemTray::addOutputMenu(TDEPopupMenu* menu)
+{
+ XRROutputInfo *output_info;
+ char *output_name;
+ int i;
+ int lastIndex = 0;
+ int connected_displays = 0;
+
+ if (isValid() == true) {
+ menu->insertTitle(SmallIcon("kcmkwm"), i18n("Output Port"));
+
+ for (i = 0; i < randr_screen_info->n_output; i++) {
+ output_info = randr_screen_info->outputs[i]->info;
+ // Look for ON outputs
+ if (!randr_screen_info->outputs[i]->cur_crtc) {
+ continue;
+ }
+ if (RR_Disconnected == randr_screen_info->outputs[i]->info->connection) {
+ continue;
+ }
+
+ output_name = output_info->name;
+ //printf("ON: Found output %s\n", output_name);
+
+ lastIndex = menu->insertItem(i18n("%1 (Active)").arg(output_name));
+ menu->setItemChecked(lastIndex, true);
+ menu->connectItem(lastIndex, this, TQT_SLOT(slotOutputChanged(int)));
+ menu->setItemParameter(lastIndex, i);
+
+ connected_displays++;
+ }
+
+ for (i = 0; i < randr_screen_info->n_output; i++) {
+ output_info = randr_screen_info->outputs[i]->info;
+ // Look for CONNECTED outputs....
+ if (RR_Disconnected == randr_screen_info->outputs[i]->info->connection) {
+ continue;
+ }
+ // ...that are not ON
+ if (randr_screen_info->outputs[i]->cur_crtc) {
+ continue;
+ }
+
+ output_name = output_info->name;
+ //printf("CONNECTED, NOT ON: Found output %s\n", output_name);
+
+ lastIndex = menu->insertItem(i18n("%1 (Connected, Inactive)").arg(output_name));
+ menu->setItemChecked(lastIndex, false);
+ menu->connectItem(lastIndex, this, TQT_SLOT(slotOutputChanged(int)));
+ menu->setItemParameter(lastIndex, i);
+
+ connected_displays++;
+ }
+
+ for (i = 0; i < randr_screen_info->n_output; i++) {
+ output_info = randr_screen_info->outputs[i]->info;
+ // Look for ALL outputs that are not connected....
+ if (RR_Disconnected != randr_screen_info->outputs[i]->info->connection) {
+ continue;
+ }
+ // ...or ON
+ if (randr_screen_info->outputs[i]->cur_crtc) {
+ continue;
+ }
+
+ output_name = output_info->name;
+ //printf("DISCONNECTED, NOT ON: Found output %s\n", output_name);
+
+ lastIndex = menu->insertItem(i18n("%1 (Disconnected, Inactive)").arg(output_name));
+ menu->setItemChecked(lastIndex, false);
+ menu->setItemEnabled(lastIndex, false);
+ menu->connectItem(lastIndex, this, TQT_SLOT(slotOutputChanged(int)));
+ menu->setItemParameter(lastIndex, i);
+ }
+
+ lastIndex = menu->insertItem(SmallIcon("forward"), i18n("Next available output"));
+ if (connected_displays < 2) {
+ menu->setItemEnabled(lastIndex, false);
+ }
+ menu->connectItem(lastIndex, this, TQT_SLOT(slotCycleDisplays()));
+ }
+}
+
+void KRandRSystemTray::slotColorProfileChanged(int parameter)
+{
+ t_config->writeEntry("CurrentProfile", m_menu->text(parameter));
+ applyIccConfiguration(m_menu->text(parameter), NULL);
+}
+
+void KRandRSystemTray::slotDisplayProfileChanged(int parameter)
+{
+ TQString profileName = m_menu->text(parameter);
+ if (profileName == "<default>") {
+ profileName = "";
+ }
+ TQPtrList<SingleScreenData> profileData = loadDisplayConfiguration(profileName, locateLocal("config", "/", true));
+ applyDisplayConfiguration(profileData, TRUE, locateLocal("config", "/", true));
+ destroyScreenInformationObject(profileData);
+}
+
+void KRandRSystemTray::slotOutputChanged(int parameter)
+{
+ char *output_name;
+ int i;
+ int num_outputs_on;
+
+ num_outputs_on = 0;
+ for (i = 0; i < randr_screen_info->n_output; i++) {
+ // Look for ON outputs
+ if (!randr_screen_info->outputs[i]->cur_crtc) {
+ continue;
+ }
+
+ num_outputs_on++;
+ }
+
+ if (!randr_screen_info->outputs[parameter]->cur_crtc) {
+ //printf("Screen was off, turning it on...\n");
+
+ randr_screen_info->cur_crtc = randr_screen_info->outputs[parameter]->cur_crtc;
+ randr_screen_info->cur_output = randr_screen_info->outputs[parameter];
+ randr_screen_info->cur_output->auto_set = 1;
+ randr_screen_info->cur_output->off_set = 0;
+ output_auto (randr_screen_info, randr_screen_info->cur_output);
+ i=main_low_apply(randr_screen_info);
+
+ if (!randr_screen_info->outputs[parameter]->cur_crtc) {
+ output_name = randr_screen_info->outputs[parameter]->info->name;
+ KMessageBox::sorry(my_parent, i18n("<b>Unable to activate output %1</b><p>Either the output is not connected to a display,<br>or the display configuration is not detectable").arg(output_name), i18n("Output Unavailable"));
+ }
+ }
+ else {
+ if (num_outputs_on > 1) {
+ //printf("Screen was on, turning it off...\n");
+ randr_screen_info->cur_crtc = randr_screen_info->outputs[parameter]->cur_crtc;
+ randr_screen_info->cur_output = randr_screen_info->outputs[parameter];
+ randr_screen_info->cur_output->auto_set = 0;
+ randr_screen_info->cur_output->off_set = 1;
+ output_off(randr_screen_info, randr_screen_info->cur_output);
+ i=main_low_apply(randr_screen_info);
+
+ findPrimaryDisplay();
+ refresh();
+
+ currentScreen()->proposeSize(GetDefaultResolutionParameter());
+ currentScreen()->applyProposed();
+ }
+ else {
+ KMessageBox::sorry(my_parent, i18n("<b>You are attempting to deactivate the only active output</b><p>You must keep at least one display output active at all times!"), i18n("Invalid Operation Requested"));
+ }
+ }
+}
+
+void KRandRSystemTray::deviceChanged (TDEGenericDevice* device) {
+#ifdef __TDE_HAVE_TDEHWLIB
+ if (device->type() == TDEGenericDeviceType::Monitor) {
+ KRandrPassivePopup::message(
+ i18n("New display output options are available!"),
+ i18n("A screen has been added, removed, or changed"), SmallIcon("view-fullscreen"),
+ this, "ScreenChangeNotification");
+
+ reloadDisplayConfiguration();
+ applyHotplugRules(locateLocal("config", "/", true));
+ }
+#endif
+}
+
+void KRandRSystemTray::slotHelpContents()
+{
+ kapp->invokeHelp(TQString::null, "tderandrtray");
+}
+
diff --git a/kcontrol/randr/tderandrtray.desktop b/kcontrol/randr/tderandrtray.desktop
new file mode 100644
index 000000000..3e6248598
--- /dev/null
+++ b/kcontrol/randr/tderandrtray.desktop
@@ -0,0 +1,142 @@
+[Desktop Entry]
+Name=TDERandRTray
+Name[be]=Змена параметраў манітора
+Name[hu]=TDEépernyőfelbontás
+Name[ne]=TDERandR ट्रे
+Name[pt_BR]=Ícone do TDERandR
+Name[sv]=TDErandrtray
+Name[vi]=TDE KRandR
+GenericName=Screen Resize & Rotate
+GenericName[af]=Skerm Hervergroot & Roteer
+GenericName[be]=Змена памераў экрана і перагортванне
+GenericName[bg]=Размер и ротация на екрана
+GenericName[bn]=পর্দা মাপবদল ও আবর্তন
+GenericName[br]=Adventañ ha treiñ ar skramm
+GenericName[bs]=Veličina i rotacija ekrana
+GenericName[ca]=Amida i gira la pantalla
+GenericName[cs]=Změna velikosti a rotace obrazovky
+GenericName[csb]=Òbrócenié ë zjinaka miarë ekranu
+GenericName[cy]=Newid Maint a Cylchdroi'r Sgrîn
+GenericName[da]=Ændr størrelse på skærm & Rotér
+GenericName[de]=Bildschirmgröße & -ausrichtung ändern
+GenericName[el]=Αλλαγή μεγέθους & Περιστροφή οθόνης
+GenericName[eo]=Regrandigi kaj Turni Ekranon
+GenericName[es]=Redimensionar y rotar pantalla
+GenericName[et]=Ekraani suuruse muutmine ja pööramine
+GenericName[eu]=Pantailaren tamaina aldaketa eta biraketa
+GenericName[fa]=تغییر اندازه و چرخش پرده
+GenericName[fi]=Näytön kuvan koon muuttaminen ja kuvan kääntäminen
+GenericName[fr]=Redimensionnement et rotation de l'écran
+GenericName[fy]=Skerm rotearje en grutte wizigje
+GenericName[gl]=Rotación e Redimensionamento da Pantallla
+GenericName[he]=שינוי גודל המסך וסיבובו
+GenericName[hr]=Veličine i orijentacija zaslona
+GenericName[hu]=Képernyőbeállító
+GenericName[is]=Stærð og snúningur skjáa
+GenericName[it]=Ruota e ridimensiona lo schermo
+GenericName[ja]=スクリーンのリサイズと回転
+GenericName[ka]=ეკრანის ზომა და ორიენტაცია
+GenericName[kk]=Экранды өзгерту және бұрау
+GenericName[km]=ប្ដូរ​ទំហំ & បង្វិល​អេក្រង់
+GenericName[ko]=화면 크기 조정 및 회전
+GenericName[lt]=Ekrano dydžio keitimas ir pasukimas
+GenericName[mk]=Големина и ротација на екранот
+GenericName[ms]=Saiz Semula Skrin & Putar
+GenericName[nb]=Endre størrelsen på og rotere skjermbildet
+GenericName[nds]=Schirmgrött un -utrichten ännern
+GenericName[ne]=पर्दा रिसाइज र परिक्रमण
+GenericName[nl]=Scherm roteren en grootte wijzigen
+GenericName[nn]=Endra storleiken på og roter skjermbiletet
+GenericName[pa]=ਪਰਦਾ ਮੁੜ ਆਕਾਰ ਤੇ ਘੁੰਮਾਓ
+GenericName[pl]=Obrót i zmiana rozmiaru ekranu
+GenericName[pt]=Mudar o Tamanho e Rodar o Ecrã
+GenericName[pt_BR]=Redimensionar Tela & Rotacionar
+GenericName[ro]=Redimensionare și rotire ecran
+GenericName[ru]=Изменение размера и ориентации экрана
+GenericName[rw]=Kuhindura ingano & Kuzengurutsa Mugaragaza
+GenericName[se]=Rievdat šearbmagova sturrodaga ja jorat dan
+GenericName[sk]=Zmena veľkosti a otočenia obrazovky
+GenericName[sl]=Spreminjanje velikosti in obračanje zaslona
+GenericName[sr]=Промена величине и ротација екрана
+GenericName[sr@Latn]=Promena veličine i rotacija ekrana
+GenericName[sv]=Ändra skärmstorlek och rotera
+GenericName[ta]=திரை அளவு மாற்று & சுழற்று
+GenericName[tg]=Ивази андоза ва мавқеи экран
+GenericName[th]=ปรับขนาดและหมุนหน้าจอ
+GenericName[tr]=Ekran Boyutlandır ve Döndür
+GenericName[tt]=Küräk Ülçäme & Borılışı
+GenericName[uk]=Зміна розміру та обертання екрана
+GenericName[uz]=Ekraning oʻlchamini oʻzgartirish va burish
+GenericName[uz@cyrillic]=Экранинг ўлчамини ўзгартириш ва буриш
+GenericName[vi]=Thay đổi cỡ màn hình & Quay
+GenericName[wa]=Candjî l' grandeu del waitroûle eyet l' tourner
+GenericName[zh_CN]=屏幕大小和旋转
+GenericName[zh_TW]=螢幕調整大小及旋轉
+Comment=Resize and rotate X screens.
+Comment[af]=Hervergroot en roteer X skerms.
+Comment[ar]=غيير القياس و الدوران للشاشات X.
+Comment[be]=Змена памераў і перагортванне экранаў X.
+Comment[bg]=Размер и ротация на екрана.
+Comment[bn]=আপনার এক্স-স্ক্রীণ-এর আকৃতি এবং দিশা পরিবর্তন করুন
+Comment[br]=Adventañ ha treiñ ho diskweloù X.
+Comment[bs]=Podesite veličinu i rotirajte vaš ekran.
+Comment[ca]=Gira i amida les pantalles X.
+Comment[cs]=Změna velikosti a rotace obrazovky.
+Comment[csb]=Zjinaka miarë ë pòłożenia ekranów.
+Comment[da]=Ændrer størrelse og roterer X-skærme
+Comment[de]=Die Größe und Ausrichtung der Anzeige ändern
+Comment[el]=Αλλαγή μεγέθους και περιστροφή της οθόνης.
+Comment[eo]=Regrandigi kaj turni X ekranojn.
+Comment[es]=Ajustar el tamaño y rotar las pantallas X.
+Comment[et]=X'i ekraani muutmine ja pööramine
+Comment[eu]=Aldatu tamaina eta biratu zure X pantailak.
+Comment[fa]=تغییر‌ اندازه و چرخش پرده‌های X.
+Comment[fi]=Näytön kuvan koon muuttaminen ja kuvan kääntäminen
+Comment[fr]=Redimensionner et retourner votre affichage.
+Comment[fy]=Skermgrutte wizigje en rotearje X skermen
+Comment[ga]=Athraigh an méid agus rothlaigh scáileáin X.
+Comment[gl]=Redimensionar e rotar pantallas
+Comment[he]=שנה את גודלה של התצוגה שלך וסובב אותה.
+Comment[hr]=Promjena veličine i orijentacije X zaslona
+Comment[hu]=A képernyő átméretezése, elforgatása
+Comment[is]=Breyta stærð skjásins og snúa honum.
+Comment[it]=Ridimensiona e ruota gli schermi di X.
+Comment[ja]=X スクリーンのリサイズと回転。
+Comment[ka]=ეკრანის ზომის და ორიენტაციის შეცვლა
+Comment[kk]=Экранның өлшемін және бағытын өзгерту
+Comment[km]=ប្ដូរ​ទំហំ និង​បង្វិល​អេក្រង់ X ។
+Comment[lt]=Keisti X ekrano dydį ir orientaciją.
+Comment[mk]=Сменете ја големината и ротацијата на вашиот екран
+Comment[nb]=Endrer størrelsen på og roterer X-skjermbildet
+Comment[nds]=Grött un Utrichten vun den X-Schirm ännern
+Comment[ne]=X पर्दा रिसाइज गर्नुहोस् र घुमाउनुहोस्
+Comment[nl]=Scherm roteren en van grootte veranderen
+Comment[nn]=Endra storleiken på og roter X-skjermbiletet.
+Comment[pa]=X ਸਕਰੀਨ ਨੂੰ ਮੁੜ-ਅਕਾਰ ਅਤੇ ਘੁੰਮਾਓ।
+Comment[pl]=Zmiana rozmiaru i orientacji ekranów.
+Comment[pt]=Mudar o tamanho e rodar os ecrãs do X.
+Comment[pt_BR]=Redimensiona e rotaciona as tela do X.
+Comment[ro]=Redimensionează și rotește ecranele X.
+Comment[ru]=Изменение размера и ориентации экранов X.
+Comment[se]=Rievdat X-šearpmaid sturrodaga ja joraheami.
+Comment[sk]=Zmení veľkosť a otočí obrazovky
+Comment[sl]=Spremenite velikost in obrnite zaslon.
+Comment[sr]=Промените величину и оријентацију екрана
+Comment[sr@Latn]=Promenite veličinu i orijentaciju ekrana
+Comment[sv]=Storleksändring och rotation av X-skärmar.
+Comment[tg]=Ивази андоза ва мавқеи экранҳои Х.
+Comment[th]=ปรับแต่งการแสดงผลของ X
+Comment[tr]=Ekranı boyutlandır ve çevir.
+Comment[uk]=Зміна розміру та обертання екранів X.
+Comment[uz]=Ekraning oʻlchamini oʻzgartirish va burish
+Comment[uz@cyrillic]=Экранинг ўлчамини ўзгартириш ва буриш
+Comment[vi]=Đổi cỡ và quay màn hình X.
+Comment[wa]=Candjî l' grandeu eyet tourner les waitroûles X.
+Comment[zh_CN]=更改 X 屏幕的大小和旋转。
+Comment[zh_TW]=調整大小及旋轉 X 螢幕。
+Exec=tderandrtray
+Icon=randr
+Type=Application
+OnlyShowIn=TDE;
+Categories=Qt;TDE;System;
+X-DocPath=tderandrtray/index.html
diff --git a/kcontrol/randr/tderandrtray.h b/kcontrol/randr/tderandrtray.h
new file mode 100644
index 000000000..8f382922f
--- /dev/null
+++ b/kcontrol/randr/tderandrtray.h
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2002 Hamish Rodda <[email protected]>
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef TDERANDRTRAY_H
+#define TDERANDRTRAY_H
+
+#include <tqptrlist.h>
+
+#include <ksystemtray.h>
+#include <kglobalaccel.h>
+
+#include <libtderandr/libtderandr.h>
+#ifdef __TDE_HAVE_TDEHWLIB
+#include <tdehardwaredevices.h>
+#else
+#define TDEGenericDevice void
+#endif
+
+class KHelpMenu;
+class TDEPopupMenu;
+
+class KRandRSystemTray : public KSystemTray, public KRandrSimpleAPI
+{
+ Q_OBJECT
+
+public:
+ KRandRSystemTray(TQWidget* parent = 0, const char *name = 0);
+ TDEGlobalAccel *globalKeys;
+
+ virtual void contextMenuAboutToShow(TDEPopupMenu* menu);
+
+ void configChanged();
+
+signals:
+ void screenSizeChanged(int x, int y);
+
+protected slots:
+ void slotScreenActivated();
+ void slotResolutionChanged(int parameter);
+ void slotOrientationChanged(int parameter);
+ void slotRefreshRateChanged(int parameter);
+ void slotPrefs();
+ void slotDisplayConfig();
+ void slotSKeys();
+ void slotSettingsChanged(int category);
+ void slotCycleDisplays();
+ void slotOutputChanged(int parameter);
+ void slotColorProfileChanged(int parameter);
+ void slotDisplayProfileChanged(int parameter);
+ void slotHelpContents();
+
+protected:
+ void mousePressEvent( TQMouseEvent *e );
+ void resizeEvent ( TQResizeEvent * );
+ void showEvent ( TQShowEvent * );
+
+private:
+ void populateMenu(TDEPopupMenu* menu);
+ void addOutputMenu(TDEPopupMenu* menu);
+ int GetDefaultResolutionParameter();
+ int GetHackResolutionParameter();
+ void findPrimaryDisplay();
+ void reloadDisplayConfiguration();
+ void resizeTrayIcon();
+
+ bool m_popupUp;
+ KHelpMenu* m_help;
+ TQPtrList<TDEPopupMenu> m_screenPopups;
+
+ Display *randr_display;
+ ScreenInfo *randr_screen_info;
+ TQWidget* my_parent;
+
+ int last_known_x;
+ int last_known_y;
+
+ TDEPopupMenu* m_menu;
+ KSimpleConfig *r_config;
+ KSimpleConfig *t_config;
+
+private slots:
+ void _quit();
+ void deviceChanged (TDEGenericDevice*);
+};
+
+#endif