mirror of
https://github.com/ReactionQuake3/reaction.git
synced 2025-03-02 23:31:53 +00:00
IOQ3 commit 2092
This commit is contained in:
parent
316af3c76a
commit
ab4afce653
1 changed files with 22 additions and 21 deletions
|
@ -555,10 +555,10 @@ void Sys_ErrorDialog( const char *error )
|
||||||
Sys_ZenityCommand
|
Sys_ZenityCommand
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
static int Sys_ZenityCommand( dialogType_t type, const char *message, const char *title )
|
static void Sys_ZenityCommand( dialogType_t type, const char *message, const char *title,
|
||||||
|
char *command, size_t commandSize )
|
||||||
{
|
{
|
||||||
const char *options = "";
|
const char *options = "";
|
||||||
char command[ 1024 ];
|
|
||||||
|
|
||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
|
@ -570,10 +570,8 @@ static int Sys_ZenityCommand( dialogType_t type, const char *message, const char
|
||||||
case DT_OK_CANCEL: options = "--question --ok-label=\"OK\" --cancel-label=\"Cancel\""; break;
|
case DT_OK_CANCEL: options = "--question --ok-label=\"OK\" --cancel-label=\"Cancel\""; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Com_sprintf( command, sizeof( command ), "zenity %s --text=\"%s\" --title=\"%s\"",
|
Com_sprintf( command, commandSize, "zenity %s --text=\"%s\" --title=\"%s\" >/dev/null 2>/dev/null",
|
||||||
options, message, title );
|
options, message, title );
|
||||||
|
|
||||||
return system( command );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -581,10 +579,10 @@ static int Sys_ZenityCommand( dialogType_t type, const char *message, const char
|
||||||
Sys_KdialogCommand
|
Sys_KdialogCommand
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
static int Sys_KdialogCommand( dialogType_t type, const char *message, const char *title )
|
static void Sys_KdialogCommand( dialogType_t type, const char *message, const char *title,
|
||||||
|
char *command, size_t commandSize )
|
||||||
{
|
{
|
||||||
const char *options = "";
|
const char *options = "";
|
||||||
char command[ 1024 ];
|
|
||||||
|
|
||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
|
@ -596,10 +594,8 @@ static int Sys_KdialogCommand( dialogType_t type, const char *message, const cha
|
||||||
case DT_OK_CANCEL: options = "--warningcontinuecancel"; break;
|
case DT_OK_CANCEL: options = "--warningcontinuecancel"; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Com_sprintf( command, sizeof( command ), "kdialog %s \"%s\" --title \"%s\"",
|
Com_sprintf( command, commandSize, "kdialog %s \"%s\" --title \"%s\" >/dev/null 2>/dev/null",
|
||||||
options, message, title );
|
options, message, title );
|
||||||
|
|
||||||
return system( command );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -607,10 +603,10 @@ static int Sys_KdialogCommand( dialogType_t type, const char *message, const cha
|
||||||
Sys_XmessageCommand
|
Sys_XmessageCommand
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
static int Sys_XmessageCommand( dialogType_t type, const char *message, const char *title )
|
static void Sys_XmessageCommand( dialogType_t type, const char *message, const char *title,
|
||||||
|
char *command, size_t commandSize )
|
||||||
{
|
{
|
||||||
const char *options = "";
|
const char *options = "";
|
||||||
char command[ 1024 ];
|
|
||||||
|
|
||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
|
@ -619,10 +615,8 @@ static int Sys_XmessageCommand( dialogType_t type, const char *message, const ch
|
||||||
case DT_OK_CANCEL: options = "-buttons OK:0,Cancel:1"; break;
|
case DT_OK_CANCEL: options = "-buttons OK:0,Cancel:1"; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Com_sprintf( command, sizeof( command ), "xmessage -center %s \"%s\"",
|
Com_sprintf( command, commandSize, "xmessage -center %s \"%s\" >/dev/null 2>/dev/null",
|
||||||
options, message );
|
options, message );
|
||||||
|
|
||||||
return system( command );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -642,7 +636,7 @@ dialogResult_t Sys_Dialog( dialogType_t type, const char *message, const char *t
|
||||||
XMESSAGE,
|
XMESSAGE,
|
||||||
NUM_DIALOG_PROGRAMS
|
NUM_DIALOG_PROGRAMS
|
||||||
} dialogCommandType_t;
|
} dialogCommandType_t;
|
||||||
typedef int (*dialogCommandBuilder_t)( dialogType_t, const char *, const char * );
|
typedef void (*dialogCommandBuilder_t)( dialogType_t, const char *, const char *, char *, size_t );
|
||||||
|
|
||||||
const char *session = getenv( "DESKTOP_SESSION" );
|
const char *session = getenv( "DESKTOP_SESSION" );
|
||||||
qboolean tried[ NUM_DIALOG_PROGRAMS ] = { qfalse };
|
qboolean tried[ NUM_DIALOG_PROGRAMS ] = { qfalse };
|
||||||
|
@ -662,7 +656,6 @@ dialogResult_t Sys_Dialog( dialogType_t type, const char *message, const char *t
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int exitCode;
|
|
||||||
|
|
||||||
for( i = NONE + 1; i < NUM_DIALOG_PROGRAMS; i++ )
|
for( i = NONE + 1; i < NUM_DIALOG_PROGRAMS; i++ )
|
||||||
{
|
{
|
||||||
|
@ -671,14 +664,22 @@ dialogResult_t Sys_Dialog( dialogType_t type, const char *message, const char *t
|
||||||
|
|
||||||
if( !tried[ i ] )
|
if( !tried[ i ] )
|
||||||
{
|
{
|
||||||
exitCode = commands[ i ]( type, message, title );
|
int exitCode;
|
||||||
|
int childSignal;
|
||||||
|
int childCode;
|
||||||
|
char command[ 1024 ];
|
||||||
|
|
||||||
if( exitCode >= 0 )
|
commands[ i ]( type, message, title, command, sizeof( command ) );
|
||||||
|
exitCode = system( command );
|
||||||
|
childSignal = exitCode & 127;
|
||||||
|
childCode = exitCode >> 8;
|
||||||
|
|
||||||
|
if( exitCode != -1 && childSignal == 0 && childCode != 126 && childCode != 127 )
|
||||||
{
|
{
|
||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
case DT_YES_NO: return exitCode ? DR_NO : DR_YES;
|
case DT_YES_NO: return childCode ? DR_NO : DR_YES;
|
||||||
case DT_OK_CANCEL: return exitCode ? DR_CANCEL : DR_OK;
|
case DT_OK_CANCEL: return childCode ? DR_CANCEL : DR_OK;
|
||||||
default: return DR_OK;
|
default: return DR_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue