00001 /* 00002 * Copyright (C) 2009, Edmundo Albuquerque de Souza e Silva. 00003 * 00004 * This file may be distributed under the terms of the Q Public License 00005 * as defined by Trolltech AS of Norway and appearing in the file 00006 * LICENSE.QPL included in the packaging of this file. 00007 * 00008 * THIS FILE IS PROVIDED AS IS WITH NO WARRANTY OF ANY KIND, INCLUDING 00009 * THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00010 * PURPOSE. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, 00011 * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING 00012 * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 00013 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 00014 * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 00015 * 00016 */ 00017 00018 #ifndef __RIOMOZILLA_H__ 00019 #define __RIOMOZILLA_H__ 00020 00021 #include "RioInterfaceTypes.h" 00022 #include "RioInterface.h" 00023 #include "RioMMSlideShow.h" 00024 00025 #include <pthread.h> 00026 00027 #include <X11/Xlib.h> 00028 #include <X11/Xatom.h> 00029 #include <X11/Xmu/WinUtil.h> /* for XmuClientWindow() */ 00030 00031 #include <qstringlist.h> 00032 00033 #define MOZILLA_VERSION_PROP "_MOZILLA_VERSION" 00034 #define MOZILLA_LOCK_PROP "_MOZILLA_LOCK" 00035 #define MOZILLA_COMMAND_PROP "_MOZILLA_COMMAND" 00036 #define MOZILLA_RESPONSE_PROP "_MOZILLA_RESPONSE" 00037 00038 #ifdef Status 00039 #undef Status 00040 #endif 00041 00042 #ifndef JUMPCMDS 00043 #define JUMPCMDS 5 00044 #endif 00045 00046 class CRioMMBrowser : public CRioMMSlideShow 00047 { 00048 private: 00049 pid_t browser_pid; 00050 char NetscapeID[ 11 ]; 00051 00052 Display *dpy; 00053 Window NetscapeWindow; 00054 Atom XA_MOZILLA_VERSION; 00055 Atom XA_MOZILLA_LOCK; 00056 Atom XA_MOZILLA_COMMAND; 00057 Atom XA_MOZILLA_RESPONSE; 00058 char *lock_data; 00059 QStringList *browserCmdLine; 00060 00061 pthread_t tid; 00062 00063 void SendCommandToNetscape( const char * ); 00064 int OpenNetscapeWindow( void ); 00065 void StartBrowser( void ); 00066 00067 Window mozilla_remote_find_window( void ); 00068 00069 /*** 00070 Return true, if window pointed by 'NetscapeWindow' is a Netscape window, 00071 return false otherwise. 00072 */ 00073 bool mozilla_remote_check_window( void ); 00074 00075 int mozilla_remote_command( bool, const char * ); 00076 void mozilla_remote_obtain_lock( void ); 00077 void mozilla_remote_free_lock( void ); 00078 00079 /*** Code from x-remote.c 00080 This function returns true if window w is a mozilla window. This is done 00081 by checking if window w contains the property _MOZIILA_VERSION. 00082 */ 00083 int isMozillaWindow( Display *, Window ); 00084 00085 public: 00086 CRioMMBrowser( char *, unsigned int, RioBlock , struct timeval RTT_average ); 00087 ~CRioMMBrowser( void ); 00088 00089 int init( void ); 00090 int Cleanup( void ); 00091 void Stop ( void ); 00092 00093 bool ChangeContext( const char *, int ); 00094 void SyncSpecific( void ); 00095 00096 int ProcessSignal( int, void * ); 00097 00098 bool readSettings(); 00099 void writeDefaultSettings(); 00100 }; 00101 00102 #endif