[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.3/kdepim/kalarm
From: David Jarvie <djarvie () kde ! org>
Date: 2009-10-29 23:53:28
Message-ID: 1256860408.286084.27885.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1042513 by djarvie:
Bug 211696: in a dual screen system, show alarm window in other screen if the
active window is full screen.
M +2 -1 Changelog
M +44 -7 messagewin.cpp
M +3 -1 messagewin.h
--- branches/KDE/4.3/kdepim/kalarm/Changelog #1042512:1042513
@@ -1,6 +1,6 @@
KAlarm Change Log
-=== Version 2.2.9 --- 27 October 2009 ===
+=== Version 2.2.9 (KDE 4.3.3) --- 29 October 2009 ===
- Fix recurring date-only alarm triggering repeatedly and eating up CPU, if the
start-of-day time is after midnight and the alarm is due, but current UTC time
of day is earlier than the start-of-day time of day in the alarm's time zone.
@@ -11,6 +11,7 @@
- Interpret '~' properly in entered file names.
- Prevent sound file configuration dialogue closing after showing error message.
- Fix crash if calendar formats are updated at login, during session restoration.
+- If dual screens, show alarm in other screen if active window is full screen.
=== Version 2.2.8 (KDE 4.3.2) --- 28 September 2009 ===
- Use KDE system settings to determine default working days in the week.
--- branches/KDE/4.3/kdepim/kalarm/messagewin.cpp #1042512:1042513
@@ -95,8 +95,6 @@
static const int proximityButtonDelay = 1000; // (milliseconds)
static const int proximityMultiple = 10; // multiple of button height \
distance from cursor for proximity
-static bool wantModal();
-
// A text label widget which can be scrolled and copied with the mouse
class MessageText : public KTextEdit
{
@@ -158,7 +156,7 @@
* displayed.
*/
MessageWin::MessageWin(const KAEvent* event, const KAAlarm& alarm, int flags)
- : MainWindowBase(0, static_cast<Qt::WFlags>(WFLAGS | WFLAGS2 | (wantModal() ? 0 : \
Qt::X11BypassWindowManagerHint))), + : MainWindowBase(0, \
static_cast<Qt::WFlags>(WFLAGS | WFLAGS2 | (getWorkAreaAndModal() ? 0 : \
Qt::X11BypassWindowManagerHint))), mMessage(event->cleanText()),
mFont(event->font()),
mBgColour(event->bgColour()),
@@ -292,6 +290,7 @@
setAttribute(static_cast<Qt::WidgetAttribute>(WidgetFlags));
setWindowModality(Qt::WindowModal);
setObjectName("ErrorWin"); // used by LikeBack
+ getWorkAreaAndModal();
initView();
mWindowList.append(this);
}
@@ -321,6 +320,7 @@
setAttribute(WidgetFlags);
setWindowModality(Qt::WindowModal);
setObjectName("RestoredMsgWin"); // used by LikeBack
+ getWorkAreaAndModal();
mWindowList.append(this);
}
@@ -508,7 +508,7 @@
topLayout->addSpacing(vspace);
topLayout->addStretch();
// Don't include any horizontal margins if message is 2/3 screen width
- if (text->sizeHint().width() >= KAlarm::desktopWorkArea().width()*2/3)
+ if (text->sizeHint().width() >= mDesktopArea.width()*2/3)
topLayout->addWidget(text, 1, Qt::AlignHCenter);
else
{
@@ -1952,14 +1952,51 @@
* window displayed, on X11 the message window has to bypass the window manager
* in order to display on top of it (which has the side effect that it will have
* no window decoration).
+*
+* Also find the usable area of the desktop (excluding panel etc.), on the
+* appropriate screen if there are multiple screens.
*/
-bool wantModal()
+bool MessageWin::getWorkAreaAndModal()
{
+ mDesktopArea = KAlarm::desktopWorkArea();
bool modal = Preferences::modalMessages();
if (modal)
{
- KWindowInfo wi = KWindowSystem::windowInfo(KWindowSystem::activeWindow(), \
NET::WMState);
- modal = !(wi.valid() && wi.hasState(NET::FullScreen));
+ WId activeId = KWindowSystem::activeWindow();
+ KWindowInfo wi = KWindowSystem::windowInfo(activeId, NET::WMState);
+ if (wi.valid() && wi.hasState(NET::FullScreen))
+ {
+ // There is a full screen window.
+ // Check whether it only covers one screen in a multi-screen setup.
+ modal = false;
+ QDesktopWidget* desktop = qApp->desktop();
+ int numScreens = desktop->numScreens();
+ if (numScreens > 1)
+ {
+ // There are multiple screens
+ QRect winRect = wi.frameGeometry();
+ int screen = desktop->screenNumber(MainWindow::mainMainWindow()); // KAlarm's \
screen + if (!winRect.intersects(desktop->screenGeometry(screen)))
+ modal = true; // full screen window isn't on KAlarm's screen
+ else
+ {
+ for (int s = 0; s < numScreens; ++s)
+ {
+ if (s != screen
+ && !winRect.intersects(desktop->screenGeometry(s)))
+ {
+ // The full screen window isn't on this screen
+ screen = s;
+ modal = true;
+ break;
+ }
+ }
+ if (!modal)
+ return modal;
+ }
+ mDesktopArea = desktop->availableGeometry(screen);
+ }
+ }
}
return modal;
}
--- branches/KDE/4.3/kdepim/kalarm/messagewin.h #1042512:1042513
@@ -107,6 +107,7 @@
const QString& dontShowAgain);
void initView();
void displayComplete();
+ bool getWorkAreaAndModal();
void playAudio();
void setDeferralLimit(const KAEvent&);
void alarmShowing(KAEvent&, const KCal::Event* = 0);
@@ -159,7 +160,8 @@
QCheckBox* mDontShowAgainCheck;
DeferAlarmDlg* mDeferDlg;
QDateTime mDeferLimit; // last time to which the message can \
currently be deferred
- int mFlags;
+ QRect mDesktopArea; // usable area of desktop (excluding panel \
etc.) + int mFlags; // event flags
int mLateCancel;
int mButtonDelay; // delay (ms) after window is shown before \
buttons are enabled bool mErrorWindow; // the window is simply an \
error message
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic