Automatically deactivate disconnected display devices

Notify user on display add/remove/change
Add advanced display configuration option to krandr menu
Add option to autohide kicker panels on inactive Xinerama screens and enable by default
Update hwmanager treeview on device change
pull/2/head
Timothy Pearson 11 years ago
parent 477e956a04
commit e88baf8334

@ -447,7 +447,7 @@ void KDisplayConfig::updateDraggableMonitorInformationInternal (int monitor_id,
}
TQString rotationDesired = *screendata->rotations.at(screendata->current_rotation_index);
bool isvisiblyrotated = ((rotationDesired == "Rotate 90 degrees") || (rotationDesired == "Rotate 270 degrees"));
bool isvisiblyrotated = ((rotationDesired == ROTATION_90_DEGREES_STRING) || (rotationDesired == ROTATION_270_DEGREES_STRING));
if (screendata->is_extended) {
moved_monitor->show();
@ -742,6 +742,8 @@ void KDisplayConfig::setRealResolutionSliderValue(int index) {
KDisplayConfig::KDisplayConfig(TQWidget *parent, const char *name, const TQStringList &)
: KCModule(KDisplayCFactory::instance(), parent, name), iccTab(0), m_randrsimple(0), m_gammaApplyTimer(0)
{
TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices();
connect(hwdevices, TQT_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQT_SLOT(deviceChanged(TDEGenericDevice*)));
m_randrsimple = new KRandrSimpleAPI();
@ -773,9 +775,18 @@ KDisplayConfig::KDisplayConfig(TQWidget *parent, const char *name, const TQStrin
base->systemEnableSupport->setText(i18n("&Enable local display control for this session"));
}
setRootOnlyMsg(i18n("<b>The global display configuration is a system wide setting, and requires administrator access</b><br>To alter the system's global display configuration, click on the \"Administrator Mode\" button below.<br>Otherwise, you may change your session-specific display configuration below."));
// setRootOnlyMsg(i18n("<b>The global display configuration is a system wide setting, and requires administrator access</b><br>To alter the system's global display configuration, click on the \"Administrator Mode\" button below.<br>Otherwise, you may change your session-specific display configuration below."));
// setUseRootOnlyMsg(true); // Setting this hides the Apply button!
base->nonRootWarningLabel->setFrameShape(TQFrame::Box);
base->nonRootWarningLabel->setFrameShadow(TQFrame::Raised);
if (getuid() != 0) {
base->nonRootWarningLabel->setText(i18n("<b>The global display configuration is a system wide setting, and requires administrator access</b><br>To alter the system's global display configuration, click on the \"Administrator Mode\" button below.<br>Otherwise, you may change your session-specific display configuration below."));
}
else {
base->nonRootWarningLabel->hide();
}
connect(base->systemEnableSupport, TQT_SIGNAL(clicked()), TQT_SLOT(changed()));
connect(base->systemEnableSupport, TQT_SIGNAL(clicked()), TQT_SLOT(processLockoutControls()));
connect(base->monitorDisplaySelectDD, TQT_SIGNAL(activated(int)), TQT_SLOT(changed()));
@ -833,6 +844,16 @@ KDisplayConfig::~KDisplayConfig()
}
}
void KDisplayConfig::deviceChanged (TDEGenericDevice* device) {
if (device->type() == TDEGenericDeviceType::Monitor) {
if (base->rescanHardware->isEnabled()) {
base->rescanHardware->setEnabled(false);
rescanHardware();
base->rescanHardware->setEnabled(true);
}
}
}
void KDisplayConfig::updateExtendedMonitorInformation () {
SingleScreenData *screendata;
@ -987,7 +1008,7 @@ void KDisplayConfig::updateDisplayedInformation () {
base->orientationVFlip->setChecked(screendata->has_y_flip);
}
else {
base->rotationSelectDD->insertItem("Normal", 0);
base->rotationSelectDD->insertItem(ROTATION_0_DEGREES_STRING, 0);
base->rotationSelectDD->setCurrentItem(0);
base->orientationHFlip->hide();
base->orientationVFlip->hide();
@ -1097,7 +1118,7 @@ void KDisplayConfig::updateDragDropDisplay() {
screendata = m_screenInfoArray.at(i);
if (((j==0) && (screendata->is_primary==true)) || ((j==1) && (screendata->is_primary==false))) { // This ensures that the primary monitor is always the first one created and placed on the configuration widget
TQString rotationDesired = *screendata->rotations.at(screendata->current_rotation_index);
bool isvisiblyrotated = ((rotationDesired == "Rotate 90 degrees") || (rotationDesired == "Rotate 270 degrees"));
bool isvisiblyrotated = ((rotationDesired == ROTATION_90_DEGREES_STRING) || (rotationDesired == ROTATION_270_DEGREES_STRING));
DraggableMonitor *m = new DraggableMonitor( base->monitorPhyArrange, 0, WStyle_Customize | WDestructiveClose | WStyle_NoBorder | WX11BypassWM );
connect(m, TQT_SIGNAL(workspaceRelayoutNeeded()), this, TQT_SLOT(layoutDragDropDisplay()));
connect(m, TQT_SIGNAL(monitorSelected(int)), this, TQT_SLOT(selectScreen(int)));

@ -35,6 +35,7 @@
#include <dcopobject.h>
#include <libkrandr/libkrandr.h>
#include <tdehardwaredevices.h>
#include "monitorworkspace.h"
#include "displayconfigbase.h"
@ -128,6 +129,7 @@ private slots:
void gammaTargetChanged (int slotNumber);
void dpmsChanged (void);
void processDPMSControls (void);
void deviceChanged (TDEGenericDevice*);
};
#endif

@ -26,7 +26,12 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQGroupBox" row="0" column="0">
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>nonRootWarningLabel</cstring>
</property>
</widget>
<widget class="TQGroupBox" row="1" column="0">
<property name="name">
<cstring>groupSystemSettings</cstring>
</property>
@ -47,7 +52,7 @@
</widget>
</grid>
</widget>
<spacer row="1" column="0">
<spacer row="2" column="0">
<property name="name" stdset="0">
<cstring>Spacer4</cstring>
</property>
@ -225,7 +230,15 @@
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="KComboBox" row="0" column="0" colspan="1">
<widget class="TQLabel" row="0" column="0" colspan="1">
<property name="name">
<cstring>textLabel7_9</cstring>
</property>
<property name="text">
<string>Rotate screen by:</string>
</property>
</widget>
<widget class="KComboBox" row="1" column="0" colspan="1">
<property name="name">
<cstring>rotationSelectDD</cstring>
</property>
@ -265,36 +278,46 @@
</property>
</widget>
<widget class="KPushButton" row="8" column="0" colspan="1">
<property name="name">
<cstring>rescanHardware</cstring>
</property>
<property name="text">
<string>&amp;Rescan Displays</string>
</property>
<property name="name">
<cstring>rescanHardware</cstring>
</property>
<property name="text">
<string>&amp;Rescan Displays</string>
</property>
</widget>
<widget class="KPushButton" row="8" column="1" colspan="1">
<property name="name">
<cstring>loadExistingProfile</cstring>
</property>
<property name="text">
<string>Load &amp;Existing Profile</string>
</property>
<property name="name">
<cstring>loadExistingProfile</cstring>
</property>
<property name="text">
<string>Load &amp;Existing Profile</string>
</property>
</widget>
<widget class="KPushButton" row="8" column="2" colspan="1">
<widget class="TQLayoutWidget" row="8" column="3" colspan="1">
<property name="name">
<cstring>previewConfiguration</cstring>
</property>
<property name="text">
<string>&amp;Test Settings</string>
</property>
</widget>
<widget class="KPushButton" row="8" column="3" colspan="1">
<property name="name">
<cstring>identifyMonitors</cstring>
</property>
<property name="text">
<string>&amp;Identify</string>
<cstring>layout7</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="KPushButton" row="8" column="0" colspan="1">
<property name="name">
<cstring>previewConfiguration</cstring>
</property>
<property name="text">
<string>&amp;Test Settings</string>
</property>
</widget>
<widget class="KPushButton" row="8" column="1" colspan="1">
<property name="name">
<cstring>identifyMonitors</cstring>
</property>
<property name="text">
<string>&amp;Identify</string>
</property>
</widget>
</hbox>
</widget>
</grid>
</widget>

@ -90,7 +90,7 @@ TDEHWManager::TDEHWManager(TQWidget *parent, const char *name, const TQStringLis
connect(hwdevices, TQT_SIGNAL(hardwareAdded(TDEGenericDevice*)), this, TQT_SLOT(populateTreeView()));
connect(hwdevices, TQT_SIGNAL(hardwareRemoved(TDEGenericDevice*)), this, TQT_SLOT(populateTreeView()));
// connect(hwdevices, TQT_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQT_SLOT(populateTreeView()));
connect(hwdevices, TQT_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQT_SLOT(deviceChanged(TDEGenericDevice*)));
load();
@ -188,6 +188,24 @@ void TDEHWManager::populateTreeViewLeaf(DeviceIconItem *parent, bool show_by_con
}
}
void TDEHWManager::deviceChanged(TDEGenericDevice* device) {
TQListViewItemIterator it(base->deviceTree);
while (it.current()) {
DeviceIconItem* item = dynamic_cast<DeviceIconItem*>(it.current());
if (item) {
TDEGenericDevice* candidate = item->device();
if (candidate) {
if (candidate->systemPath() == device->systemPath()) {
if (item->text(0) != device->friendlyName()) {
item->setText(0, device->friendlyName());
}
}
}
}
++it;
}
}
TQString TDEHWManager::quickHelp() const
{
return i18n("<h1>TDE Hardware Device Manager</h1> This module allows you to configure hardware devices on your system");

@ -60,6 +60,7 @@ k_dcop:
private slots:
void populateTreeView();
void populateTreeViewLeaf(DeviceIconItem *parent, bool show_by_connection, TQString selected_syspath);
void deviceChanged(TDEGenericDevice*);
private:
TDEHWManagerBase *base;

@ -124,21 +124,22 @@ void ExtensionInfo::load()
KConfig c(_configFile);
c.setGroup("General");
_position = c.readNumEntry ("Position", _position);
_alignment = c.readNumEntry ("Alignment", _alignment);
_xineramaScreen = c.readNumEntry ("XineramaScreen", _xineramaScreen);
_showLeftHB = c.readBoolEntry("ShowLeftHideButton", _showLeftHB);
_showRightHB = c.readBoolEntry("ShowRightHideButton", _showRightHB);
_hideButtonSize = c.readNumEntry ("HideButtonSize", _hideButtonSize);
_autohidePanel = c.readBoolEntry("AutoHidePanel", _autohidePanel);
_backgroundHide = c.readBoolEntry("BackgroundHide", _backgroundHide);
_autoHideSwitch = c.readBoolEntry("AutoHideSwitch", _autoHideSwitch);
_autoHideDelay = c.readNumEntry ("AutoHideDelay", _autoHideDelay);
_hideAnim = c.readBoolEntry("HideAnimation", _hideAnim);
_hideAnimSpeed = c.readNumEntry ("HideAnimationSpeed", _hideAnimSpeed);
_unhideLocation = c.readNumEntry ("UnhideLocation", _unhideLocation);
_sizePercentage = c.readNumEntry ("SizePercentage", _sizePercentage);
_expandSize = c.readBoolEntry("ExpandSize", _expandSize);
_position = c.readNumEntry ("Position", _position);
_alignment = c.readNumEntry ("Alignment", _alignment);
_xineramaScreen = c.readNumEntry ("XineramaScreen", _xineramaScreen);
_showLeftHB = c.readBoolEntry("ShowLeftHideButton", _showLeftHB);
_showRightHB = c.readBoolEntry("ShowRightHideButton", _showRightHB);
_hideButtonSize = c.readNumEntry ("HideButtonSize", _hideButtonSize);
_autohidePanel = c.readBoolEntry("AutoHidePanel", _autohidePanel);
_backgroundHide = c.readBoolEntry("BackgroundHide", _backgroundHide);
_autoHideSwitch = c.readBoolEntry("AutoHideSwitch", _autoHideSwitch);
_xineramaHideSwitch = c.readBoolEntry("XineramaHideSwitch", _xineramaHideSwitch);
_autoHideDelay = c.readNumEntry ("AutoHideDelay", _autoHideDelay);
_hideAnim = c.readBoolEntry("HideAnimation", _hideAnim);
_hideAnimSpeed = c.readNumEntry ("HideAnimationSpeed", _hideAnimSpeed);
_unhideLocation = c.readNumEntry ("UnhideLocation", _unhideLocation);
_sizePercentage = c.readNumEntry ("SizePercentage", _sizePercentage);
_expandSize = c.readBoolEntry("ExpandSize", _expandSize);
if (_resizeable)
{
@ -196,27 +197,28 @@ void ExtensionInfo::configChanged()
void ExtensionInfo::setDefaults()
{
// defaults
_position = 3;
_alignment = TQApplication::reverseLayout() ? 2 : 0;
_xineramaScreen = TQApplication::desktop()->primaryScreen();
_size = 2;
_showLeftHB = false;
_showRightHB = true;
_hideButtonSize = 14;
_autohidePanel = false;
_backgroundHide = false;
_autoHideSwitch = false;
_autoHideDelay = 3;
_hideAnim = true;
_hideAnimSpeed = 40;
_unhideLocation = 0;
_sizePercentage = 100;
_expandSize = true;
_customSize = 0;
_resizeable = false;
_useStdSizes = false;
_customSizeMin = 0;
_customSizeMax = 0;
_position = 3;
_alignment = TQApplication::reverseLayout() ? 2 : 0;
_xineramaScreen = TQApplication::desktop()->primaryScreen();
_size = 2;
_showLeftHB = false;
_showRightHB = true;
_hideButtonSize = 14;
_autohidePanel = false;
_backgroundHide = false;
_autoHideSwitch = false;
_xineramaHideSwitch = true;
_autoHideDelay = 3;
_hideAnim = true;
_hideAnimSpeed = 40;
_unhideLocation = 0;
_sizePercentage = 100;
_expandSize = true;
_customSize = 0;
_resizeable = false;
_useStdSizes = false;
_customSizeMin = 0;
_customSizeMax = 0;
}
void ExtensionInfo::save()
@ -232,6 +234,7 @@ void ExtensionInfo::save()
c.writeEntry("AutoHidePanel", _autohidePanel);
c.writeEntry("BackgroundHide", _backgroundHide);
c.writeEntry("AutoHideSwitch", _autoHideSwitch);
c.writeEntry("XineramaHideSwitch", _xineramaHideSwitch);
c.writeEntry("AutoHideDelay", _autoHideDelay);
c.writeEntry("HideAnimation", _hideAnim);
c.writeEntry("HideAnimationSpeed", _hideAnimSpeed);

@ -57,6 +57,7 @@ class ExtensionInfo
bool _autohidePanel;
bool _backgroundHide;
bool _autoHideSwitch;
bool _xineramaHideSwitch;
int _autoHideDelay;
bool _hideAnim;
int _hideAnimSpeed;

@ -308,6 +308,20 @@
</spacer>
</hbox>
</widget>
<widget class="TQCheckBox" row="7" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>m_xineramaHide</cstring>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>&amp;Hide panel when configured screen is not available</string>
</property>
<property name="whatsThis" stdset="0">
<string>When this option is selected, this panel will be hidden if its Xinerama screen is not available. This panel will be automatically restored when the configured Xinerama screen is reenabked.</string>
</property>
</widget>
<widget class="TQCheckBox" row="5" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>m_autoHideSwitch</cstring>

@ -41,8 +41,9 @@ HidingTab::HidingTab(TQWidget *parent, const char* name)
connect(m_manual,TQT_SIGNAL(toggled(bool)), TQT_SIGNAL(changed()));
connect(m_automatic, TQT_SIGNAL(toggled(bool)), TQT_SIGNAL(changed()));
connect(m_automatic, TQT_SIGNAL(toggled(bool)), TQT_SLOT(backgroundModeClicked()));
connect(m_background,TQT_SIGNAL(toggled(bool)), TQT_SIGNAL(changed()));
connect(m_background, TQT_SIGNAL(toggled(bool)), TQT_SIGNAL(changed()));
connect(m_background, TQT_SIGNAL(toggled(bool)), TQT_SLOT(backgroundModeClicked()));
connect(m_xineramaHide, TQT_SIGNAL(toggled(bool)), TQT_SIGNAL(changed()));
connect(m_hideSlider, TQT_SIGNAL(valueChanged(int)), TQT_SIGNAL(changed()));
connect(m_delaySpinBox, TQT_SIGNAL(valueChanged(int)), TQT_SIGNAL(changed()));
connect(m_animateHiding, TQT_SIGNAL(toggled(bool)), TQT_SIGNAL(changed()));
@ -141,6 +142,8 @@ void HidingTab::switchPanel(int panelItem)
m_manual->setChecked(true);
}
m_xineramaHide->setChecked(m_panelInfo->_xineramaHideSwitch);
m_delaySpinBox->setValue(m_panelInfo->_autoHideDelay);
m_autoHideSwitch->setChecked(m_panelInfo->_autoHideSwitch);
@ -190,6 +193,8 @@ void HidingTab::storeInfo()
m_panelInfo->_autoHideDelay = m_delaySpinBox->value();
m_panelInfo->_autoHideSwitch = m_autoHideSwitch->isChecked();
m_panelInfo->_xineramaHideSwitch = m_xineramaHide->isChecked();
m_panelInfo->_unhideLocation = m_backgroundRaise->isChecked() ?
triggerComboToConfig(m_backgroundPos->currentItem()) : 0;
}
@ -199,6 +204,7 @@ void HidingTab::defaults()
m_manual->setChecked( true );
m_delaySpinBox->setValue( 3 );
m_autoHideSwitch->setChecked( false );
m_xineramaHide->setChecked( true );
m_lHB->setChecked( false );
m_rHB->setChecked( true );
m_animateHiding->setChecked( true );

@ -88,6 +88,9 @@ KRandRSystemTray::KRandRSystemTray(TQWidget* parent, const char *name)
if (cur_profile != "") {
applyIccConfiguration(cur_profile, NULL);
}
TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices();
connect(hwdevices, TQT_SIGNAL(hardwareUpdated(TDEGenericDevice*)), this, TQT_SLOT(deviceChanged(TDEGenericDevice*)));
}
/*!
@ -133,27 +136,73 @@ void KRandRSystemTray::mousePressEvent(TQMouseEvent* e)
KSystemTray::mousePressEvent(e);
}
void KRandRSystemTray::contextMenuAboutToShow(KPopupMenu* menu)
void KRandRSystemTray::reloadDisplayConfiguration()
{
//int lastIndex = 0;
// Reload the randr configuration...
XRROutputInfo *output_info;
char *output_name;
RROutput output_id;
int i;
int lastIndex = 0;
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++) {
output_info = randr_screen_info->outputs[i]->info;
// 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++) {
output_info = randr_screen_info->outputs[i]->info;
// 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++) {
output_info = randr_screen_info->outputs[i]->info;
// 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;
}
@ -176,19 +225,17 @@ void KRandRSystemTray::contextMenuAboutToShow(KPopupMenu* menu)
findPrimaryDisplay();
refresh();
// HACK
// This is needed because Qt does not properly generate screen
// resize events when switching screens, so KDE gets stuck in the old resolution
// This only seems to happen with more than one screen, so check for that condition...
if (kapp->desktop()->numScreens() > 1) {
currentScreen()->proposeSize(GetHackResolutionParameter());
currentScreen()->applyProposed();
}
currentScreen()->proposeSize(GetDefaultResolutionParameter());
currentScreen()->applyProposed();
}
}
}
void KRandRSystemTray::contextMenuAboutToShow(KPopupMenu* menu)
{
int lastIndex = 0;
reloadDisplayConfiguration();
menu->clear();
menu->setCheckable(true);
@ -236,8 +283,8 @@ void KRandRSystemTray::contextMenuAboutToShow(KPopupMenu* menu)
menu->insertTitle(SmallIcon("randr"), i18n("Global Configuation"));
KAction *actColors = new KAction( i18n( "Configure Color Profiles..." ),
SmallIconSet( "configure" ), KShortcut(), TQT_TQOBJECT(this), TQT_SLOT( slotColorConfig() ),
KAction *actColors = new KAction( i18n( "Configure Displays..." ),
SmallIconSet( "configure" ), KShortcut(), TQT_TQOBJECT(this), TQT_SLOT( slotDisplayConfig() ),
actionCollection() );
actColors->plug( menu );
@ -469,12 +516,12 @@ void KRandRSystemTray::slotPrefs()
kcm->exec();
}
void KRandRSystemTray::slotColorConfig()
void KRandRSystemTray::slotDisplayConfig()
{
KCMultiDialog *kcm = new KCMultiDialog( KDialogBase::Plain, i18n( "Configure" ), this );
kcm->addModule( "iccconfig" );
kcm->setPlainCaption( i18n( "Configure Display Color Profiles" ) );
kcm->addModule( "displayconfig" );
kcm->setPlainCaption( i18n( "Configure Displays" ) );
kcm->exec();
}
@ -596,6 +643,9 @@ void KRandRSystemTray::slotCycleDisplays()
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) {
@ -635,16 +685,6 @@ void KRandRSystemTray::slotCycleDisplays()
findPrimaryDisplay();
refresh();
// HACK
// This is needed because Qt does not properly generate screen
// resize events when switching screens, so KDE gets stuck in the old resolution
// This only seems to happen with more than one screen, so check for that condition...
if (kapp->desktop()->numScreens() > 1) {
// currentScreen()->proposeSize(GetHackResolutionParameter());
// currentScreen()->applyProposed();
kapp->desktop()->emitResizedSignal(currentScreenIndex());
}
currentScreen()->proposeSize(GetDefaultResolutionParameter());
currentScreen()->applyProposed();
}
@ -781,9 +821,7 @@ void KRandRSystemTray::slotOutputChanged(int parameter)
{
XRROutputInfo *output_info;
char *output_name;
RROutput output_id;
int i;
Status s;
int num_outputs_on;
num_outputs_on = 0;
@ -825,15 +863,6 @@ void KRandRSystemTray::slotOutputChanged(int parameter)
findPrimaryDisplay();
refresh();
// HACK
// This is needed because Qt does not properly generate screen
// resize events when switching screens, so KDE gets stuck in the old resolution
// This only seems to happen with more than one screen, so check for that condition...
if (kapp->desktop()->numScreens() > 1) {
currentScreen()->proposeSize(GetHackResolutionParameter());
currentScreen()->applyProposed();
}
currentScreen()->proposeSize(GetDefaultResolutionParameter());
currentScreen()->applyProposed();
}
@ -842,3 +871,14 @@ void KRandRSystemTray::slotOutputChanged(int parameter)
}
}
}
void KRandRSystemTray::deviceChanged (TDEGenericDevice* device) {
if (device->type() == TDEGenericDeviceType::Monitor) {
KRandrPassivePopup::message(
i18n("New display output options are available!"),
i18n("A screen has been added, removed, or changed"), SmallIcon("window_fullscreen"),
this, "ScreenChangeNotification");
reloadDisplayConfiguration();
}
}

@ -25,6 +25,7 @@
#include <kglobalaccel.h>
#include <libkrandr/libkrandr.h>
#include <tdehardwaredevices.h>
class KHelpMenu;
class KPopupMenu;
@ -50,7 +51,7 @@ protected slots:
void slotOrientationChanged(int parameter);
void slotRefreshRateChanged(int parameter);
void slotPrefs();
void slotColorConfig();
void slotDisplayConfig();
void slotSKeys();
void slotSettingsChanged(int category);
void slotCycleDisplays();
@ -67,6 +68,7 @@ private:
int GetDefaultResolutionParameter();
int GetHackResolutionParameter();
void findPrimaryDisplay();
void reloadDisplayConfiguration();
bool m_popupUp;
KHelpMenu* m_help;
@ -85,6 +87,7 @@ private:
private slots:
void _quit();
void deviceChanged (TDEGenericDevice*);
};
#endif

@ -212,6 +212,10 @@ TaskbarConfig::TaskbarConfig(TQWidget *parent, const char* name, const TQStringL
{
m_widget->showAllScreens->hide();
}
else
{
m_widget->showAllScreens->show();
}
connect( m_widget->showAllScreens, TQT_SIGNAL( stateChanged( int )), TQT_SLOT( changed()));
KAboutData *about = new KAboutData(I18N_NOOP("kcmtaskbar"),

@ -71,7 +71,7 @@ By default this option is selected.</string>
By default, this option is selected and all windows are shown.</string>
</property>
</widget>
<widget class="TQCheckBox" row="6" column="0" rowspan="1" colspan="3">
<widget class="TQCheckBox" row="7" column="0" rowspan="1" colspan="3">
<property name="name">
<cstring>kcfg_ShowWindowListBtn</cstring>
</property>
@ -85,7 +85,7 @@ By default, this option is selected and all windows are shown.</string>
<string>Selecting this option causes the taskbar to display a button that, when clicked, shows a list of all windows in a popup menu.</string>
</property>
</widget>
<widget class="TQComboBox" row="7" column="2">
<widget class="TQComboBox" row="8" column="2">
<property name="name">
<cstring>kcfg_GroupTasks</cstring>
</property>
@ -105,9 +105,9 @@ You can set the taskbar to &lt;strong&gt;Never&lt;/strong&gt; group windows, to
By default the taskbar groups windows when it is full.</string>
</property>
</widget>
<widget class="TQLabel" row="7" column="0" rowspan="1" colspan="2">
<widget class="TQLabel" row="8" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>showTaskStatesLabel</cstring>
<cstring>groupTasksLabel</cstring>
</property>
<property name="text">
<string>&amp;Group similar tasks:</string>
@ -116,7 +116,7 @@ By default the taskbar groups windows when it is full.</string>
<cstring>kcfg_ShowTaskStates</cstring>
</property>
</widget>
<widget class="TQComboBox" row="8" column="2">
<widget class="TQComboBox" row="9" column="2">
<property name="name">
<cstring>kcfg_ShowTaskStates</cstring>
</property>
@ -132,9 +132,9 @@ By default the taskbar groups windows when it is full.</string>
<string>The taskbar can show and/or hide tasks based on their current process state. Select &lt;em&gt;Any&lt;/em&gt; to show all tasks regardless of current state.</string>
</property>
</widget>
<widget class="TQLabel" row="8" column="0" rowspan="1" colspan="2">
<widget class="TQLabel" row="9" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>groupTasksLabel</cstring>
<cstring>showTaskStatesLabel</cstring>
</property>
<property name="text">
<string>&amp;Show tasks with state:</string>
@ -143,7 +143,7 @@ By default the taskbar groups windows when it is full.</string>
<cstring>kcfg_ShowTaskStates</cstring>
</property>
</widget>
<widget class="TQCheckBox" row="4" column="0" rowspan="1" colspan="3">
<widget class="TQCheckBox" row="5" column="0" rowspan="1" colspan="3">
<property name="name">
<cstring>kcfg_ShowOnlyIconified</cstring>
</property>
@ -156,7 +156,7 @@ By default the taskbar groups windows when it is full.</string>
By default, this option is not selected and the taskbar will show all windows.</string>
</property>
</widget>
<widget class="TQCheckBox" row="5" column="0" rowspan="1" colspan="3">
<widget class="TQCheckBox" row="6" column="0" rowspan="1" colspan="3">
<property name="name">
<cstring>kcfg_ShowIcon</cstring>
</property>
@ -172,7 +172,7 @@ By default, this option is not selected and the taskbar will show all windows.</
By default this option is selected.</string>
</property>
</widget>
<widget class="TQCheckBox" row="3" column="0" rowspan="1" colspan="3">
<widget class="TQCheckBox" row="2" column="0" rowspan="1" colspan="3">
<property name="name">
<cstring>showAllScreens</cstring>
</property>
@ -188,12 +188,12 @@ By default this option is selected.</string>
By default, this option is selected and all windows are shown.</string>
</property>
</widget>
<widget class="TQComboBox" row="9" column="2">
<widget class="TQComboBox" row="10" column="2">
<property name="name">
<cstring>appearance</cstring>
</property>
</widget>
<widget class="TQLabel" row="9" column="0" rowspan="1" colspan="2">
<widget class="TQLabel" row="10" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>textLabel1</cstring>
</property>
@ -204,7 +204,7 @@ By default, this option is selected and all windows are shown.</string>
<cstring>appearance</cstring>
</property>
</widget>
<widget class="TQCheckBox" row="10" column="0" rowspan="1" colspan="2">
<widget class="TQCheckBox" row="11" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>kcfg_UseCustomColors</cstring>
</property>
@ -218,7 +218,7 @@ By default, this option is selected and all windows are shown.</string>
<bool>true</bool>
</property>
</widget>
<widget class="TQLayoutWidget" row="11" column="0" rowspan="1" colspan="3">
<widget class="TQLayoutWidget" row="12" column="0" rowspan="1" colspan="3">
<property name="name">
<cstring>layout9</cstring>
</property>
@ -353,7 +353,7 @@ By default, this option is selected and all windows are shown.</string>
</size>
</property>
</spacer>
<widget class="TQCheckBox" row="2" column="0" rowspan="1" colspan="3">
<widget class="TQCheckBox" row="3" column="0" rowspan="1" colspan="3">
<property name="name">
<cstring>kcfg_SortByApp</cstring>
</property>
@ -364,7 +364,7 @@ By default, this option is selected and all windows are shown.</string>
<bool>true</bool>
</property>
</widget>
<widget class="TQCheckBox" row="3" column="0" rowspan="1" colspan="3">
<widget class="TQCheckBox" row="4" column="0" rowspan="1" colspan="3">
<property name="name">
<cstring>kcfg_CycleWheel</cstring>
</property>

@ -476,6 +476,12 @@ void ExtensionContainer::removeSessionConfigFile()
void ExtensionContainer::moveMe()
{
int screen = xineramaScreen();
if (screen == -3)
{
// we aren't on any screen? um. ok.
return;
}
if (screen < 0)
{
screen = kapp->desktop()->screenNumber(this);
@ -1980,7 +1986,7 @@ int ExtensionContainer::xineramaScreen() const
// sanitize at runtime only, since many Xinerama users
// turn it on and off and don't want kicker to lose their configs
/* -2 means all screens, -1 primary screens, the rest are valid screen numbers */
/* -3 means no screens, -2 means all screens, -1 primary screens, the rest are valid screen numbers */
if (XineramaAllScreens <= m_settings.xineramaScreen() &&
m_settings.xineramaScreen() < TQApplication::desktop()->numScreens())
{
@ -1988,8 +1994,15 @@ int ExtensionContainer::xineramaScreen() const
}
else
{
/* force invalid screen locations onto the primary screen */
return TQApplication::desktop()->primaryScreen();
if (m_settings.xineramaHideSwitch())
{
return -3;
}
else
{
/* force invalid screen locations onto the primary screen */
return TQApplication::desktop()->primaryScreen();
}
}
}

@ -60,6 +60,11 @@
<default>false</default>
</entry>
<entry name="XineramaHideSwitch" type="Bool" >
<label>Auto hide when Xinerama screen is not available</label>
<default>true</default>
</entry>
<entry name="AutoHideDelay" type="Int" >
<label>Delay before auto hide</label>
<default>3</default>

Loading…
Cancel
Save