00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "./KWinInterface.h"
00010
00011 #include <kdatastream.h>
00012 #include <qasciidict.h>
00013
00014
00015 static const int KWinInterface_fhash = 23;
00016 static const char* const KWinInterface_ftable[20][3] = {
00017 { "ASYNC", "cascadeDesktop()", "cascadeDesktop()" },
00018 { "ASYNC", "unclutterDesktop()", "unclutterDesktop()" },
00019 { "ASYNC", "reconfigure()", "reconfigure()" },
00020 { "ASYNC", "killWindow()", "killWindow()" },
00021 { "void", "refresh()", "refresh()" },
00022 { "void", "doNotManage(QString)", "doNotManage(QString)" },
00023 { "void", "showWindowMenuAt(unsigned long int,int,int)", "showWindowMenuAt(unsigned long int winId,int x,int y)" },
00024 { "void", "setDesktopLayout(int,int,int)", "setDesktopLayout(int orientation,int x,int y)" },
00025 { "bool", "setCurrentDesktop(int)", "setCurrentDesktop(int)" },
00026 { "int", "currentDesktop()", "currentDesktop()" },
00027 { "void", "nextDesktop()", "nextDesktop()" },
00028 { "void", "previousDesktop()", "previousDesktop()" },
00029 { "void", "circulateDesktopApplications()", "circulateDesktopApplications()" },
00030 { "void", "startKompmgr()", "startKompmgr()" },
00031 { "void", "stopKompmgr()", "stopKompmgr()" },
00032 { "bool", "kompmgrIsRunning()", "kompmgrIsRunning()" },
00033 { "void", "setOpacity(unsigned long int,unsigned int)", "setOpacity(unsigned long int winId,unsigned int opacityPercent)" },
00034 { "void", "setShadowSize(unsigned long int,unsigned int)", "setShadowSize(unsigned long int winId,unsigned int shadowSizePercent)" },
00035 { "void", "setUnshadowed(unsigned long int)", "setUnshadowed(unsigned long int winId)" },
00036 { 0, 0, 0 }
00037 };
00038 static const int KWinInterface_ftable_hiddens[19] = {
00039 0,
00040 0,
00041 0,
00042 0,
00043 0,
00044 0,
00045 0,
00046 0,
00047 0,
00048 0,
00049 0,
00050 0,
00051 0,
00052 0,
00053 0,
00054 0,
00055 0,
00056 0,
00057 0,
00058 };
00059
00060 bool KWinInterface::process(const QCString &fun, const QByteArray &data, QCString& replyType, QByteArray &replyData)
00061 {
00062 static QAsciiDict<int>* fdict = 0;
00063 if ( !fdict ) {
00064 fdict = new QAsciiDict<int>( KWinInterface_fhash, true, false );
00065 for ( int i = 0; KWinInterface_ftable[i][1]; i++ )
00066 fdict->insert( KWinInterface_ftable[i][1], new int( i ) );
00067 }
00068 int* fp = fdict->find( fun );
00069 switch ( fp?*fp:-1) {
00070 case 0: {
00071 replyType = KWinInterface_ftable[0][0];
00072 cascadeDesktop( );
00073 } break;
00074 case 1: {
00075 replyType = KWinInterface_ftable[1][0];
00076 unclutterDesktop( );
00077 } break;
00078 case 2: {
00079 replyType = KWinInterface_ftable[2][0];
00080 reconfigure( );
00081 } break;
00082 case 3: {
00083 replyType = KWinInterface_ftable[3][0];
00084 killWindow( );
00085 } break;
00086 case 4: {
00087 replyType = KWinInterface_ftable[4][0];
00088 refresh( );
00089 } break;
00090 case 5: {
00091 QString arg0;
00092 QDataStream arg( data, IO_ReadOnly );
00093 if (arg.atEnd()) return false;
00094 arg >> arg0;
00095 replyType = KWinInterface_ftable[5][0];
00096 doNotManage(arg0 );
00097 } break;
00098 case 6: {
00099 unsigned long int arg0;
00100 int arg1;
00101 int arg2;
00102 QDataStream arg( data, IO_ReadOnly );
00103 if (arg.atEnd()) return false;
00104 arg >> arg0;
00105 if (arg.atEnd()) return false;
00106 arg >> arg1;
00107 if (arg.atEnd()) return false;
00108 arg >> arg2;
00109 replyType = KWinInterface_ftable[6][0];
00110 showWindowMenuAt(arg0, arg1, arg2 );
00111 } break;
00112 case 7: {
00113 int arg0;
00114 int arg1;
00115 int arg2;
00116 QDataStream arg( data, IO_ReadOnly );
00117 if (arg.atEnd()) return false;
00118 arg >> arg0;
00119 if (arg.atEnd()) return false;
00120 arg >> arg1;
00121 if (arg.atEnd()) return false;
00122 arg >> arg2;
00123 replyType = KWinInterface_ftable[7][0];
00124 setDesktopLayout(arg0, arg1, arg2 );
00125 } break;
00126 case 8: {
00127 int arg0;
00128 QDataStream arg( data, IO_ReadOnly );
00129 if (arg.atEnd()) return false;
00130 arg >> arg0;
00131 replyType = KWinInterface_ftable[8][0];
00132 QDataStream _replyStream( replyData, IO_WriteOnly );
00133 _replyStream << setCurrentDesktop(arg0 );
00134 } break;
00135 case 9: {
00136 replyType = KWinInterface_ftable[9][0];
00137 QDataStream _replyStream( replyData, IO_WriteOnly );
00138 _replyStream << currentDesktop( );
00139 } break;
00140 case 10: {
00141 replyType = KWinInterface_ftable[10][0];
00142 nextDesktop( );
00143 } break;
00144 case 11: {
00145 replyType = KWinInterface_ftable[11][0];
00146 previousDesktop( );
00147 } break;
00148 case 12: {
00149 replyType = KWinInterface_ftable[12][0];
00150 circulateDesktopApplications( );
00151 } break;
00152 case 13: {
00153 replyType = KWinInterface_ftable[13][0];
00154 startKompmgr( );
00155 } break;
00156 case 14: {
00157 replyType = KWinInterface_ftable[14][0];
00158 stopKompmgr( );
00159 } break;
00160 case 15: {
00161 replyType = KWinInterface_ftable[15][0];
00162 QDataStream _replyStream( replyData, IO_WriteOnly );
00163 _replyStream << kompmgrIsRunning( );
00164 } break;
00165 case 16: {
00166 unsigned long int arg0;
00167 unsigned int arg1;
00168 QDataStream arg( data, IO_ReadOnly );
00169 if (arg.atEnd()) return false;
00170 arg >> arg0;
00171 if (arg.atEnd()) return false;
00172 arg >> arg1;
00173 replyType = KWinInterface_ftable[16][0];
00174 setOpacity(arg0, arg1 );
00175 } break;
00176 case 17: {
00177 unsigned long int arg0;
00178 unsigned int arg1;
00179 QDataStream arg( data, IO_ReadOnly );
00180 if (arg.atEnd()) return false;
00181 arg >> arg0;
00182 if (arg.atEnd()) return false;
00183 arg >> arg1;
00184 replyType = KWinInterface_ftable[17][0];
00185 setShadowSize(arg0, arg1 );
00186 } break;
00187 case 18: {
00188 unsigned long int arg0;
00189 QDataStream arg( data, IO_ReadOnly );
00190 if (arg.atEnd()) return false;
00191 arg >> arg0;
00192 replyType = KWinInterface_ftable[18][0];
00193 setUnshadowed(arg0 );
00194 } break;
00195 default:
00196 return DCOPObject::process( fun, data, replyType, replyData );
00197 }
00198 return true;
00199 }
00200
00201 QCStringList KWinInterface::interfaces()
00202 {
00203 QCStringList ifaces = DCOPObject::interfaces();
00204 ifaces += "KWinInterface";
00205 return ifaces;
00206 }
00207
00208 QCStringList KWinInterface::functions()
00209 {
00210 QCStringList funcs = DCOPObject::functions();
00211 for ( int i = 0; KWinInterface_ftable[i][2]; i++ ) {
00212 if (KWinInterface_ftable_hiddens[i])
00213 continue;
00214 QCString func = KWinInterface_ftable[i][0];
00215 func += ' ';
00216 func += KWinInterface_ftable[i][2];
00217 funcs << func;
00218 }
00219 return funcs;
00220 }
00221
00222 void KWinInterface::kompmgrStarted()
00223 {
00224 QByteArray data;
00225 emitDCOPSignal( "kompmgrStarted()", data );
00226 }
00227
00228 void KWinInterface::kompmgrStopped()
00229 {
00230 QByteArray data;
00231 emitDCOPSignal( "kompmgrStopped()", data );
00232 }
00233
00234 void KWinInterface::dcopResetAllClients()
00235 {
00236 QByteArray data;
00237 emitDCOPSignal( "dcopResetAllClients()", data );
00238 }
00239
00240