[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.5/kdepim
From:       David Jarvie <software () astrojar ! org ! uk>
Date:       2009-01-21 19:19:35
Message-ID: 1232565575.807083.13125.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 914790 by djarvie:

Cancel screensaver when an alarm is displayed.


 M  +6 -0      configure.in.in  
 M  +2 -1      kalarm/Changelog  
 M  +1 -1      kalarm/Makefile.am  
 M  +37 -1     kalarm/functions.cpp  
 M  +2 -1      kalarm/functions.h  
 M  +3 -1      kalarm/kalarmapp.cpp  


--- branches/KDE/3.5/kdepim/configure.in.in #914789:914790
@@ -11,6 +11,12 @@
 if test "$x_includes" != "NONE"; then
   AC_DEFINE(HAVE_X11_HEADERS,1,Define if you have X11 header files)
 fi
+AC_CHECK_LIB(Xtst, XTestFakeKeyEvent, [LIBXTST=-lXtst],, -lX11)
+AC_SUBST(LIBXTST)
+if test "$LIBXTST" != ""; then
+  AC_CHECK_HEADER([X11/extensions/XTest.h],
+                  [AC_DEFINE(HAVE_XTEST, 1, [Define if you have X11 Xtest header files])])
+fi
 
 KDE_INIT_DOXYGEN([KDE PIM API Reference], [Version $VERSION])
 
--- branches/KDE/3.5/kdepim/kalarm/Changelog #914789:914790
@@ -1,6 +1,6 @@
 KAlarm Change Log
 
-=== Version 1.5.5 --- 9 January 2009 ===
+=== Version 1.5.5 --- 21 January 2009 ===
 - Require a real double click to accept the selected template in pick list.
 - Make mouse wheel work, and fix highlighting, for left-hand time spinbox
   buttons in Plastik style.
@@ -15,6 +15,7 @@
 - Ignore events in calendar without usable alarms, which prevents them getting
   stuck in the alarm list).
 - Prevent defer dialogue date being set outside the allowed range.
+- Cancel screensaver when an alarm is displayed.
 
 === Version 1.5.4 (KDE 3.5.10) --- 18 August 2008 ===
 - Show background colour selector for file display alarms.
--- branches/KDE/3.5/kdepim/kalarm/Makefile.am #914789:914790
@@ -33,7 +33,7 @@
 	$(top_builddir)/kalarm/kalarmd/libkalarmd.la \
 	$(top_builddir)/libkdepim/libkdepim.la \
 	$(top_builddir)/libkpimidentities/libkpimidentities.la \
-	-lkabc -lkutils $(LIB_KDEUI) $(ARTSLIB)
+	-lkabc -lkutils $(LIB_KDEUI) $(ARTSLIB) $(LIBXTST)
 noinst_HEADERS = alarmcalendar.h alarmevent.h alarmlistview.h alarmtext.h \
 	alarmtimewidget.h birthdaydlg.h daemon.h dcophandler.h deferdlg.h \
 	editdlg.h editdlgprivate.h emailidcombo.h eventlistviewbase.h find.h \
--- branches/KDE/3.5/kdepim/kalarm/functions.cpp #914789:914790
@@ -1,7 +1,7 @@
 /*
  *  functions.cpp  -  miscellaneous functions
  *  Program:  kalarm
- *  Copyright  © 2001-2008 by David Jarvie <djarvie@kde.org>
+ *  Copyright  © 2001-2009 by David Jarvie <djarvie@kde.org>
  *
  *  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
@@ -71,6 +71,9 @@
 bool deleteFromKOrganizer(const QString& eventID);
 bool runKOrganizer();
 }
+#ifdef HAVE_XTEST
+void x11_cancelScreenSaver();
+#endif
 
 
 namespace KAlarm
@@ -928,6 +931,17 @@
 	return out;
 }
 
+/******************************************************************************
+* Cancel the screen saver, in case it is active.
+* Only implemented if the X11 XTest extension is installed.
+*/
+void cancelScreenSaver()
+{
+#ifdef HAVE_XTEST
+	x11_cancelScreenSaver();
+#endif // HAVE_XTEST
+}
+
 } // namespace KAlarm
 
 
@@ -1061,3 +1075,25 @@
 }
 
 } // namespace
+
+#ifdef HAVE_XTEST
+#include <X11/keysym.h>
+#include <X11/extensions/XTest.h>
+#include <qwindowdefs.h>
+
+/******************************************************************************
+* Cancel the screen saver, in case it is active.
+* Only implemented if the X11 XTest extension is installed.
+*/
+void x11_cancelScreenSaver()
+{
+	kdDebug(5950) << "KAlarm::cancelScreenSaver()" << endl;
+	Display* display = qt_xdisplay();
+	static int XTestKeyCode = 0;
+	if (!XTestKeyCode)
+		XTestKeyCode = XKeysymToKeycode(display, XK_Shift_L);
+	XTestFakeKeyEvent(display, XTestKeyCode, true, CurrentTime);
+	XTestFakeKeyEvent(display, XTestKeyCode, false, CurrentTime);
+	XSync(display, false);
+}
+#endif // HAVE_XTEST
--- branches/KDE/3.5/kdepim/kalarm/functions.h #914789:914790
@@ -1,7 +1,7 @@
 /*
  *  functions.h  -  miscellaneous functions
  *  Program:  kalarm
- *  Copyright  © 2004-2006 by David Jarvie <software@astrojar.org.uk>
+ *  Copyright  © 2004-2006,2009 by David Jarvie <djarvie@kde.org>
  *
  *  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
@@ -108,6 +108,7 @@
 void                displayUpdateError(QWidget* parent, UpdateStatus, UpdateError, int nAlarms);
 void                displayKOrgUpdateError(QWidget* parent, KOrgUpdateError, int nAlarms);
 
+void                cancelScreenSaver();
 QString             stripAccel(const QString&);
 
 int                 localeFirstDayOfWeek();
--- branches/KDE/3.5/kdepim/kalarm/kalarmapp.cpp #914789:914790
@@ -1,7 +1,7 @@
 /*
  *  kalarmapp.cpp  -  the KAlarm application object
  *  Program:  kalarm
- *  Copyright  © 2001-2008 by David Jarvie <djarvie@kde.org>
+ *  Copyright  © 2001-2009 by David Jarvie <djarvie@kde.org>
  *
  *  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
@@ -1631,11 +1631,13 @@
 				if (win)
 					win->setRecreating();    // prevent post-alarm actions
 				delete win;
+				KAlarm::cancelScreenSaver();
 				(new MessageWin(event, alarm, reschedule, allowDefer))->show();
 			}
 			else
 			{
 				// Raise the existing message window and replay any sound
+				KAlarm::cancelScreenSaver();
 				win->repeat(alarm);    // N.B. this reschedules the alarm
 			}
 			break;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic