summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.h.in3
-rw-r--r--configure.in29
-rw-r--r--configure.in.in28
-rw-r--r--src/Makefile.am6
-rw-r--r--src/kmplayer.h6
-rw-r--r--src/kmplayerapp.cpp45
-rw-r--r--src/kmplayerpartbase.cpp5
-rw-r--r--src/kmplayerpartbase.h1
-rw-r--r--src/kmplayerview.cpp15
-rw-r--r--src/kmplayerview.h1
-rw-r--r--src/main.cpp1
11 files changed, 121 insertions, 19 deletions
diff --git a/config.h.in b/config.h.in
index e3687cd..874e18e 100644
--- a/config.h.in
+++ b/config.h.in
@@ -105,6 +105,9 @@
/* Define to 1 if you have the `vsnprintf' function. */
#undef HAVE_VSNPRINTF
+/* XTest extension available */
+#undef HAVE_XTEST
+
/* If we have libxine installed */
#undef HAVE_XINE
diff --git a/configure.in b/configure.in
index 5911553..102c19a 100644
--- a/configure.in
+++ b/configure.in
@@ -123,6 +123,35 @@ if test x$have_expat = xyes -a x$want_expat = xyes; then
AC_SUBST(LIB_EXPAT)
fi
+dnl -------------------------
+dnl check for XTest extension
+dnl -------------------------
+
+AC_ARG_WITH([xtest], [AS_HELP_STRING([--without-xtest], [build without XTest support])],,
+ [with_xtest=yes])
+
+CFLAGS_XTEST=""
+LIB_XTEST=""
+
+if test "$with_xtest" != "no" ; then
+ AC_MSG_CHECKING([for XTest extension])
+
+ if "$PKG_CONFIG" --exists xtst ; then
+ with_xtest=yes
+ CFLAGS_XTEST=`"$PKG_CONFIG" --cflags xtst`
+ LIB_XTEST=`"$PKG_CONFIG" --libs xtst`
+ AC_DEFINE([HAVE_XTEST],,[XTest extension available])
+ AC_MSG_RESULT([yes])
+ else
+ with_xtest=no
+ AC_MSG_RESULT([no])
+ fi
+fi
+
+AC_SUBST([CFLAGS_XTEST])
+AC_SUBST([LIB_XTEST])
+
+
KDE_CHECK_HEADER(xine.h,
have_xine=yes,
have_xine=no)
diff --git a/configure.in.in b/configure.in.in
index 96921cf..a2f6d68 100644
--- a/configure.in.in
+++ b/configure.in.in
@@ -58,6 +58,34 @@ if test x$have_expat = xyes -a x$want_expat = xyes; then
AC_SUBST(LIB_EXPAT)
fi
+dnl -------------------------
+dnl check for XTest extension
+dnl -------------------------
+
+AC_ARG_WITH([xtest], [AS_HELP_STRING([--without-xtest], [build without XTest support])],,
+ [with_xtest=yes])
+
+CFLAGS_XTEST=""
+LIB_XTEST=""
+
+if test "$with_xtest" != "no" ; then
+ AC_MSG_CHECKING([for XTest extension])
+
+ if "$PKG_CONFIG" --exists xtst ; then
+ with_xtest=yes
+ CFLAGS_XTEST=`"$PKG_CONFIG" --cflags xtst`
+ LIB_XTEST=`"$PKG_CONFIG" --libs xtst`
+ AC_DEFINE([HAVE_XTEST],,[XTest extension available])
+ AC_MSG_RESULT([yes])
+ else
+ with_xtest=no
+ AC_MSG_RESULT([no])
+ fi
+fi
+
+AC_SUBST([CFLAGS_XTEST])
+AC_SUBST([LIB_XTEST])
+
KDE_CHECK_HEADER(xine.h,
have_xine=yes,
have_xine=no)
diff --git a/src/Makefile.am b/src/Makefile.am
index 5ebff92..3dd1ef0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,8 +5,8 @@ METASOURCES= AUTO
lib_LTLIBRARIES= libkmplayercommon.la
libkmplayercommon_la_SOURCES = viewarea.cpp kmplayerview.cpp playlistview.cpp kmplayercontrolpanel.cpp kmplayerconfig.cpp pref.cpp kmplayerprocess.cpp kmplayer_callback.skel kmplayer_backend.stub kmplayerpartbase.cpp kmplayerplaylist.cpp kmplayer_asx.cpp kmplayer_smil.cpp kmplayer_rp.cpp kmplayer_rss.cpp kmplayer_atom.cpp kmplayer_xspf.cpp triestring.cpp kmplayerpartbase.skel
-libkmplayercommon_la_LDFLAGS = -avoid-version $(all_libraries)
-libkmplayercommon_la_LIBADD = -lkmediaplayer $(LIB_KPARTS) $(LIB_KUTILS) $(LIB_EXPAT) -lm $(LIBCAIRO_LIBS) $(LIBQTDBUS)
+libkmplayercommon_la_LDFLAGS = -avoid-version $(all_libraries) $(CFLAGS_XTEST)
+libkmplayercommon_la_LIBADD = -lkmediaplayer $(LIB_KPARTS) $(LIB_KUTILS) $(LIB_EXPAT) -lm $(LIBCAIRO_LIBS) $(LIBQTDBUS) $(LIB_XTEST)
if include_koffice_support
kofficeplugin_lib= libkmplayerkofficepart.la
@@ -25,7 +25,7 @@ libkmplayerkofficepart_la_LIBADD= libkmplayercommon.la $(LIB_KOFFICE)
tdeinit_LTLIBRARIES=kmplayer.la
kmplayer_la_SOURCES= main.cpp kmplayerapp.cpp kmplayertvsource.cpp kmplayerbroadcast.cpp kmplayervdr.cpp
-kmplayer_la_LIBADD= libkmplayercommon.la
+kmplayer_la_LIBADD= libkmplayercommon.la $(LIB_XTEST)
kmplayer_la_LDFLAGS= -module $(KDE_PLUGIN) $(LIB_QT)
EXTRA_PROGRAMS = kxineplayer kxvplayer kgstplayer
diff --git a/src/kmplayer.h b/src/kmplayer.h
index ba2bf87..9c9b6d2 100644
--- a/src/kmplayer.h
+++ b/src/kmplayer.h
@@ -137,6 +137,7 @@ private slots:
void menuMoveUpNode ();
void menuMoveDownNode ();
void preparePlaylistMenu (KMPlayer::PlayListItem *, TQPopupMenu *);
+ void slotFakeKeyEvent();
private:
void menuItemClicked (TQPopupMenu * menu, int id);
@@ -192,6 +193,11 @@ private:
bool m_played_exit;
bool m_minimal_mode;
bool m_auto_resize;
+
+ TQTimer m_screensaverTimer;
+ bool m_haveKWin;
+ bool haveXTest;
+ int fakeKeycode;
};
class KMPLAYER_NO_EXPORT FileDocument : public KMPlayer::Document {
diff --git a/src/kmplayerapp.cpp b/src/kmplayerapp.cpp
index bdeac91..fe8995a 100644
--- a/src/kmplayerapp.cpp
+++ b/src/kmplayerapp.cpp
@@ -73,6 +73,12 @@
#include "kmplayervdr.h"
#include "kmplayerconfig.h"
+#include <X11/Xlib.h>
+#ifdef HAVE_XTEST
+#include <X11/keysym.h>
+#include <X11/extensions/XTest.h>
+#endif
+
static const int DVDNav_start = 1;
static const int DVDNav_previous = 2;
static const int DVDNav_next = 3;
@@ -533,6 +539,24 @@ KDE_NO_CDTOR_EXPORT KMPlayerApp::KMPlayerApp(TQWidget* , const char* name)
initActions();
initView();
+ haveXTest = false;
+#ifdef HAVE_XTEST
+ int dummy_event, dummy_error, dummy_major, dummy_minor;
+ if (XTestQueryExtension(x11Display(), &dummy_event, &dummy_error, &dummy_major, &dummy_minor)) {
+ fakeKeycode = XKeysymToKeycode(x11Display(), XK_Shift_L);
+ if (fakeKeycode != 0)
+ haveXTest = true;
+ }
+#endif
+ /** TWin are you there? **/
+ m_haveKWin = KApplication::dcopClient()->isApplicationRegistered("twin");
+ if (m_haveKWin)
+ kdDebug() << "Window manager: TWin found" << endl;
+ else
+ kdDebug() << "Window manager: not TWin - using save fullscreen mode" << endl;
+ connect(&m_screensaverTimer, TQT_SIGNAL(timeout()), TQT_TQOBJECT(this), TQT_SLOT(slotFakeKeyEvent()));
+ m_screensaverTimer.start( 55000 );
+
//setAutoSaveSettings();
playlist = new Playlist (this, lstsrc);
playlist_id = m_view->playList ()->addTree (playlist, "listssource", "player_playlist", KMPlayer::PlayListView::AllowDrag | KMPlayer::PlayListView::AllowDrops | KMPlayer::PlayListView::TreeEdit | KMPlayer::PlayListView::Moveable | KMPlayer::PlayListView::Deleteable);
@@ -685,6 +709,27 @@ KDE_NO_EXPORT void KMPlayerApp::initView () {
setAcceptDrops (true);
}
+void KMPlayerApp::slotFakeKeyEvent()
+{
+ if ( m_player && m_player->isPlaying() && !m_player->isPaused())
+ if (m_haveKWin) {
+ // use a better method if we're in a tde environment
+ kdDebug() << "KMPlayer: Fake mouse movement\n";
+ XWarpPointer(x11Display(), None, None, 0, 0, 0, 0, 0, 0);
+ XFlush(x11Display());
+ } else {
+ if(haveXTest) {
+#ifdef HAVE_XTEST
+ kdDebug() << "KMPlayer: Fake key press\n";
+ XTestFakeKeyEvent(x11Display(), fakeKeycode, true, 0);
+ XTestFakeKeyEvent(x11Display(), fakeKeycode, false, 0);
+ XFlush(x11Display());
+#endif
+ }
+ }
+}
+
+
KDE_NO_EXPORT void KMPlayerApp::loadingProgress (int perc) {
if (perc < 100)
statusBar ()->changeItem (TQString ("%1%").arg (perc), id_status_timer);
diff --git a/src/kmplayerpartbase.cpp b/src/kmplayerpartbase.cpp
index 6a6f84c..32ead14 100644
--- a/src/kmplayerpartbase.cpp
+++ b/src/kmplayerpartbase.cpp
@@ -874,6 +874,11 @@ KDE_NO_EXPORT bool PartBase::isPlaying () {
return playing ();
}
+KDE_NO_EXPORT bool PartBase::isPaused () {
+ NodePtr doc = m_source ? m_source->document () : 0L;
+ return doc && doc->state == Node::state_deferred;
+}
+
KAboutData* PartBase::createAboutData () {
KMessageBox::error(0L, "createAboutData", "KMPlayer");
return 0;
diff --git a/src/kmplayerpartbase.h b/src/kmplayerpartbase.h
index 2ff4dbd..f21ba4f 100644
--- a/src/kmplayerpartbase.h
+++ b/src/kmplayerpartbase.h
@@ -192,6 +192,7 @@ public:
k_dcop:
void toggleFullScreen ();
bool isPlaying ();
+ bool isPaused ();
signals:
void sourceChanged (KMPlayer::Source * old, KMPlayer::Source * nw);
void sourceDimensionChanged ();
diff --git a/src/kmplayerview.cpp b/src/kmplayerview.cpp
index 0696826..61b5dfa 100644
--- a/src/kmplayerview.cpp
+++ b/src/kmplayerview.cpp
@@ -599,27 +599,12 @@ bool View::isFullScreen () const {
void View::fullScreen () {
if (!m_view_area->isFullScreen()) {
- m_sreensaver_disabled = false;
- TQByteArray data, replydata;
- TQCString replyType;
- if (kapp->dcopClient ()->call ("kdesktop", "KScreensaverIface",
- "isEnabled()", data, replyType, replydata)) {
- bool enabled;
- TQDataStream replystream (replydata, IO_ReadOnly);
- replystream >> enabled;
- if (enabled)
- m_sreensaver_disabled = kapp->dcopClient()->send
- ("kdesktop", "KScreensaverIface", "enable(bool)", TQString("false"));
- }
//if (m_keepsizeratio && m_viewer->aspect () < 0.01)
// m_viewer->setAspect (1.0 * m_viewer->width() / m_viewer->height());
m_view_area->fullScreen();
m_control_panel->popupMenu ()->setItemVisible (ControlPanel::menu_zoom, false);
m_widgetstack->visibleWidget ()->setFocus ();
} else {
- if (m_sreensaver_disabled)
- m_sreensaver_disabled = !kapp->dcopClient()->send
- ("kdesktop", "KScreensaverIface", "enable(bool)", TQString("true"));
m_view_area->fullScreen();
m_control_panel->popupMenu ()->setItemVisible (ControlPanel::menu_zoom, true);
}
diff --git a/src/kmplayerview.h b/src/kmplayerview.h
index 06ca60e..253b7c0 100644
--- a/src/kmplayerview.h
+++ b/src/kmplayerview.h
@@ -198,7 +198,6 @@ private:
bool m_playing;
bool m_mixer_init;
bool m_inVolumeUpdate;
- bool m_sreensaver_disabled;
bool m_tmplog_needs_eol;
bool m_revert_fullscreen;
bool m_no_info;
diff --git a/src/main.cpp b/src/main.cpp
index 3cf6a1d..03874e3 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -25,6 +25,7 @@ email :
#include <tqguardedptr.h>
#include <tqfileinfo.h>
+#include <tqtimer.h>
#include "kmplayer.h"