mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kdeui: remove redundant KGlobalSettings::desktopGeometry() methods
QDesktopWidget is Xinerama aware and it can be disabled because I implemented option for that, see the following commit in the Katie repo: b7e4bae65f0cae7f3029b98980f638c077ecfc22 Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
a2101eec56
commit
be9d8967f7
7 changed files with 39 additions and 113 deletions
|
@ -18,6 +18,17 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "kmessagebox.h"
|
#include "kmessagebox.h"
|
||||||
|
#include "kapplication.h"
|
||||||
|
#include "kconfig.h"
|
||||||
|
#include "kdialog.h"
|
||||||
|
#include "kdialogqueue_p.h"
|
||||||
|
#include "klocale.h"
|
||||||
|
#include "knotification.h"
|
||||||
|
#include "kiconloader.h"
|
||||||
|
#include "kconfiggroup.h"
|
||||||
|
#include "ktextedit.h"
|
||||||
|
#include "ksqueezedtextlabel.h"
|
||||||
|
#include "kwindowsystem.h"
|
||||||
|
|
||||||
#include <QtCore/QPointer>
|
#include <QtCore/QPointer>
|
||||||
#include <QtGui/QCheckBox>
|
#include <QtGui/QCheckBox>
|
||||||
|
@ -28,19 +39,7 @@
|
||||||
#include <QtGui/QScrollArea>
|
#include <QtGui/QScrollArea>
|
||||||
#include <QtGui/QScrollBar>
|
#include <QtGui/QScrollBar>
|
||||||
#include <QtGui/QTextDocumentFragment>
|
#include <QtGui/QTextDocumentFragment>
|
||||||
|
#include <QtGui/QDesktopWidget>
|
||||||
#include <kapplication.h>
|
|
||||||
#include <kconfig.h>
|
|
||||||
#include <kdialog.h>
|
|
||||||
#include <kdialogqueue_p.h>
|
|
||||||
#include <kglobalsettings.h>
|
|
||||||
#include <klocale.h>
|
|
||||||
#include <knotification.h>
|
|
||||||
#include <kiconloader.h>
|
|
||||||
#include <kconfiggroup.h>
|
|
||||||
#include <ktextedit.h>
|
|
||||||
#include <ksqueezedtextlabel.h>
|
|
||||||
#include <kwindowsystem.h>
|
|
||||||
|
|
||||||
// Some i18n filters, that standard button texts are piped through
|
// Some i18n filters, that standard button texts are piped through
|
||||||
// (the new KGuiItem object with filtered text is created from the old one).
|
// (the new KGuiItem object with filtered text is created from the old one).
|
||||||
|
@ -199,7 +198,7 @@ int KMessageBox::createKMessageBox(KDialog *dialog, const QIcon &icon,
|
||||||
}
|
}
|
||||||
messageLabel->setTextInteractionFlags(flags);
|
messageLabel->setTextInteractionFlags(flags);
|
||||||
|
|
||||||
QRect desktop = KGlobalSettings::desktopGeometry(dialog);
|
QRect desktop = QApplication::desktop()->screenGeometry(dialog);
|
||||||
bool usingSqueezedTextLabel = false;
|
bool usingSqueezedTextLabel = false;
|
||||||
if (messageLabel->sizeHint().width() > desktop.width() * 0.5) {
|
if (messageLabel->sizeHint().width() > desktop.width() * 0.5) {
|
||||||
// enable automatic wrapping of messages which are longer than 50% of screen width
|
// enable automatic wrapping of messages which are longer than 50% of screen width
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <QLayout>
|
#include <QLayout>
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QDesktopWidget>
|
||||||
|
|
||||||
#include <kcombobox.h>
|
#include <kcombobox.h>
|
||||||
#include <kconfig.h>
|
#include <kconfig.h>
|
||||||
|
@ -127,7 +128,7 @@ void KPasswordDialog::KPasswordDialogPrivate::init()
|
||||||
|
|
||||||
updateFields();
|
updateFields();
|
||||||
|
|
||||||
QRect desktop = KGlobalSettings::desktopGeometry(q->window());
|
QRect desktop = QApplication::desktop()->screenGeometry(q->window());
|
||||||
q->setMinimumWidth(qMin(1000, qMax(q->sizeHint().width(), desktop.width() / 4)));
|
q->setMinimumWidth(qMin(1000, qMax(q->sizeHint().width(), desktop.width() / 4)));
|
||||||
q->setPixmap(KIcon("dialog-password").pixmap(KIconLoader::SizeHuge));
|
q->setPixmap(KIcon("dialog-password").pixmap(KIconLoader::SizeHuge));
|
||||||
}
|
}
|
||||||
|
|
|
@ -391,49 +391,7 @@ bool KGlobalSettings::wheelMouseZooms()
|
||||||
QRect KGlobalSettings::splashScreenDesktopGeometry()
|
QRect KGlobalSettings::splashScreenDesktopGeometry()
|
||||||
{
|
{
|
||||||
QDesktopWidget *dw = QApplication::desktop();
|
QDesktopWidget *dw = QApplication::desktop();
|
||||||
|
return dw->screenGeometry(dw->screenNumber(QCursor::pos()));
|
||||||
if (dw->isVirtualDesktop()) {
|
|
||||||
KConfigGroup group(KGlobal::config(), "Windows");
|
|
||||||
int scr = group.readEntry("Unmanaged", -3);
|
|
||||||
if (group.readEntry("XineramaEnabled", true) && scr != -2) {
|
|
||||||
if (scr == -3) {
|
|
||||||
scr = dw->screenNumber(QCursor::pos());
|
|
||||||
}
|
|
||||||
return dw->screenGeometry(scr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return dw->geometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
QRect KGlobalSettings::desktopGeometry(const QPoint& point)
|
|
||||||
{
|
|
||||||
QDesktopWidget *dw = QApplication::desktop();
|
|
||||||
|
|
||||||
if (dw->isVirtualDesktop()) {
|
|
||||||
KConfigGroup group(KGlobal::config(), "Windows");
|
|
||||||
if (group.readEntry("XineramaEnabled", true) &&
|
|
||||||
group.readEntry("XineramaPlacementEnabled", true)) {
|
|
||||||
return dw->screenGeometry(dw->screenNumber(point));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return dw->geometry();
|
|
||||||
}
|
|
||||||
|
|
||||||
QRect KGlobalSettings::desktopGeometry(const QWidget* w)
|
|
||||||
{
|
|
||||||
QDesktopWidget *dw = QApplication::desktop();
|
|
||||||
|
|
||||||
if (dw->isVirtualDesktop()) {
|
|
||||||
KConfigGroup group(KGlobal::config(), "Windows");
|
|
||||||
if (group.readEntry("XineramaEnabled", true) &&
|
|
||||||
group.readEntry("XineramaPlacementEnabled", true)) {
|
|
||||||
if (w) {
|
|
||||||
return dw->screenGeometry(dw->screenNumber(w));
|
|
||||||
}
|
|
||||||
return dw->screenGeometry(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return dw->geometry();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool KGlobalSettings::showIconsOnPushButtons()
|
bool KGlobalSettings::showIconsOnPushButtons()
|
||||||
|
|
|
@ -371,37 +371,6 @@ public:
|
||||||
*/
|
*/
|
||||||
static QRect splashScreenDesktopGeometry();
|
static QRect splashScreenDesktopGeometry();
|
||||||
|
|
||||||
/**
|
|
||||||
* This function returns the desktop geometry for an application that needs
|
|
||||||
* to set the geometry of a widget on the screen manually. It takes into
|
|
||||||
* account the user's display settings (number of screens, Xinerama, etc),
|
|
||||||
* and the user's preferences (if KDE should be Xinerama aware).
|
|
||||||
*
|
|
||||||
* Note that this can break in multi-head (not Xinerama) mode because this
|
|
||||||
* point could be on multiple screens. Use with care.
|
|
||||||
*
|
|
||||||
* @param point a reference point for the widget, for instance one that the
|
|
||||||
* widget should be adjacent or on top of.
|
|
||||||
*
|
|
||||||
* @return the geometry to use for the desktop. Note that it might not
|
|
||||||
* start at (0,0).
|
|
||||||
*/
|
|
||||||
static QRect desktopGeometry(const QPoint& point);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This function returns the desktop geometry for an application that needs
|
|
||||||
* to set the geometry of a widget on the screen manually. It takes into
|
|
||||||
* account the user's display settings (number of screens, Xinerama, etc),
|
|
||||||
* and the user's preferences (if KDE should be Xinerama aware).
|
|
||||||
*
|
|
||||||
* @param w the widget in question. This is used to determine which screen
|
|
||||||
* to use in Xinerama or multi-head mode.
|
|
||||||
*
|
|
||||||
* @return the geometry to use for the desktop. Note that it might not
|
|
||||||
* start at (0,0).
|
|
||||||
*/
|
|
||||||
static QRect desktopGeometry(const QWidget* w);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function determines if the user wishes to see icons on the
|
* This function determines if the user wishes to see icons on the
|
||||||
* push buttons.
|
* push buttons.
|
||||||
|
|
|
@ -17,8 +17,13 @@
|
||||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include "kpassivepopup.h"
|
#include "kpassivepopup.h"
|
||||||
#include "moc_kpassivepopup.cpp"
|
#include "kvbox.h"
|
||||||
|
#include "kdialog.h"
|
||||||
|
#include "kconfig.h"
|
||||||
|
#include "kdebug.h"
|
||||||
|
#include "netwm.h"
|
||||||
|
|
||||||
// Qt
|
// Qt
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
@ -32,17 +37,9 @@
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QToolTip>
|
#include <QToolTip>
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
|
#include <QDesktopWidget>
|
||||||
#include <QX11Info>
|
#include <QX11Info>
|
||||||
|
|
||||||
#include <kvbox.h>
|
|
||||||
#include <kdebug.h>
|
|
||||||
#include <kdialog.h>
|
|
||||||
#include <kglobalsettings.h>
|
|
||||||
#include <kconfig.h>
|
|
||||||
#include <netwm.h>
|
|
||||||
|
|
||||||
#include <config.h>
|
|
||||||
|
|
||||||
static const int DEFAULT_POPUP_TYPE = KPassivePopup::Boxed;
|
static const int DEFAULT_POPUP_TYPE = KPassivePopup::Boxed;
|
||||||
static const int DEFAULT_POPUP_TIME = 6*1000;
|
static const int DEFAULT_POPUP_TIME = 6*1000;
|
||||||
static const Qt::WindowFlags POPUP_FLAGS = Qt::Tool | Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint;
|
static const Qt::WindowFlags POPUP_FLAGS = Qt::Tool | Qt::X11BypassWindowManagerHint | Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint;
|
||||||
|
@ -353,7 +350,7 @@ QPoint KPassivePopup::calculateNearbyPoint(const QRect &target)
|
||||||
int w = minimumSizeHint().width();
|
int w = minimumSizeHint().width();
|
||||||
int h = minimumSizeHint().height();
|
int h = minimumSizeHint().height();
|
||||||
|
|
||||||
QRect r = KGlobalSettings::desktopGeometry(QPoint(x + w / 2,y + h / 2));
|
QRect r = QApplication::desktop()->screenGeometry(QPoint(x + w / 2,y + h / 2));
|
||||||
|
|
||||||
if (d->popupStyle == KPassivePopup::Balloon) {
|
if (d->popupStyle == KPassivePopup::Balloon) {
|
||||||
// find a point to anchor to
|
// find a point to anchor to
|
||||||
|
@ -417,7 +414,7 @@ void KPassivePopup::updateMask()
|
||||||
{
|
{
|
||||||
// get screen-geometry for screen our anchor is on
|
// get screen-geometry for screen our anchor is on
|
||||||
// (geometry can differ from screen to screen!
|
// (geometry can differ from screen to screen!
|
||||||
QRect deskRect = KGlobalSettings::desktopGeometry(d->anchor);
|
QRect deskRect = QApplication::desktop()->screenGeometry(d->anchor);
|
||||||
|
|
||||||
int xh = 70, xl = 40;
|
int xh = 70, xl = 40;
|
||||||
if (width() < 80) {
|
if (width() < 80) {
|
||||||
|
@ -602,3 +599,5 @@ KPassivePopup *KPassivePopup::message(int popupStyle, const QString &caption, co
|
||||||
{
|
{
|
||||||
return message(popupStyle, caption, text, QPixmap(), parent);
|
return message(popupStyle, caption, text, QPixmap(), parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "moc_kpassivepopup.cpp"
|
||||||
|
|
|
@ -23,17 +23,16 @@
|
||||||
|
|
||||||
#include "kcompletionbox.h"
|
#include "kcompletionbox.h"
|
||||||
#include "klineedit.h"
|
#include "klineedit.h"
|
||||||
|
#include "kconfig.h"
|
||||||
|
#include "kdebug.h"
|
||||||
|
|
||||||
#include <QtCore/QEvent>
|
#include <QtCore/QEvent>
|
||||||
#include <QtGui/QApplication>
|
#include <QtGui/QApplication>
|
||||||
#include <QtGui/QComboBox>
|
#include <QtGui/QComboBox>
|
||||||
#include <QtGui/QStyle>
|
#include <QtGui/QStyle>
|
||||||
#include <QtGui/QScrollBar>
|
#include <QtGui/QScrollBar>
|
||||||
#include <QtGui/qevent.h>
|
#include <QtGui/QDesktopWidget>
|
||||||
|
#include <QtGui/QKeyEvent>
|
||||||
#include <kdebug.h>
|
|
||||||
#include <kconfig.h>
|
|
||||||
#include <kglobalsettings.h>
|
|
||||||
|
|
||||||
class KCompletionBox::KCompletionBoxPrivate
|
class KCompletionBox::KCompletionBoxPrivate
|
||||||
{
|
{
|
||||||
|
@ -283,7 +282,7 @@ void KCompletionBox::sizeAndPosition()
|
||||||
if ( d->m_parent ) {
|
if ( d->m_parent ) {
|
||||||
if ( !isVisible() ) {
|
if ( !isVisible() ) {
|
||||||
QPoint orig = globalPositionHint();
|
QPoint orig = globalPositionHint();
|
||||||
QRect screenSize = KGlobalSettings::desktopGeometry(orig);
|
QRect screenSize = QApplication::desktop()->screenGeometry(orig);
|
||||||
|
|
||||||
x = orig.x() + geom.x();
|
x = orig.x() + geom.x();
|
||||||
y = orig.y() + geom.y();
|
y = orig.y() + geom.y();
|
||||||
|
|
|
@ -17,16 +17,17 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ksqueezedtextlabel.h"
|
#include "ksqueezedtextlabel.h"
|
||||||
#include <kdebug.h>
|
#include "kaction.h"
|
||||||
#include <klocale.h>
|
#include "klocale.h"
|
||||||
#include <QtGui/qevent.h>
|
#include "kdebug.h"
|
||||||
#include <kaction.h>
|
|
||||||
|
#include <QResizeEvent>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
#include <kglobalsettings.h>
|
#include <QDesktopWidget>
|
||||||
|
|
||||||
class KSqueezedTextLabelPrivate
|
class KSqueezedTextLabelPrivate
|
||||||
{
|
{
|
||||||
|
@ -77,7 +78,7 @@ QSize KSqueezedTextLabel::minimumSizeHint() const
|
||||||
|
|
||||||
QSize KSqueezedTextLabel::sizeHint() const
|
QSize KSqueezedTextLabel::sizeHint() const
|
||||||
{
|
{
|
||||||
int maxWidth = KGlobalSettings::desktopGeometry(this).width() * 3 / 4;
|
int maxWidth = QApplication::desktop()->screenGeometry(this).width() * 3 / 4;
|
||||||
QFontMetrics fm(fontMetrics());
|
QFontMetrics fm(fontMetrics());
|
||||||
int textWidth = fm.width(d->fullText);
|
int textWidth = fm.width(d->fullText);
|
||||||
if (textWidth > maxWidth) {
|
if (textWidth > maxWidth) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue