mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-02 23:23:55 +00:00
Fix linux ShowAlert process
This commit is contained in:
parent
dee7d7f7f9
commit
3c6d9b4fd9
2
doc.md
2
doc.md
@ -56,7 +56,7 @@
|
|||||||
##[Window](#Window)
|
##[Window](#Window)
|
||||||
This is a work in progress.
|
This is a work in progress.
|
||||||
|
|
||||||
#####[ShowAlert(support linux as soon as possible)](#ShowAlert)
|
#####[ShowAlert](#ShowAlert)
|
||||||
#####[CloseWindow](#CloseWindow)
|
#####[CloseWindow](#CloseWindow)
|
||||||
#####[IsValid](#IsValid)
|
#####[IsValid](#IsValid)
|
||||||
#####[SetActive](#SetActive)
|
#####[SetActive](#SetActive)
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
##[窗口](#Window)
|
##[窗口](#Window)
|
||||||
This is a work in progress.
|
This is a work in progress.
|
||||||
|
|
||||||
#####[ShowAlert(support linux as soon as possible)](#ShowAlert)
|
#####[ShowAlert](#ShowAlert)
|
||||||
#####[CloseWindow](#CloseWindow)
|
#####[CloseWindow](#CloseWindow)
|
||||||
#####[IsValid](#IsValid)
|
#####[IsValid](#IsValid)
|
||||||
#####[SetActive](#SetActive)
|
#####[SetActive](#SetActive)
|
||||||
|
@ -39,7 +39,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
version string = "v0.41.1.202,fate!"
|
version string = "v0.41.1.204,fate!"
|
||||||
)
|
)
|
||||||
|
|
||||||
//GetVersion get version
|
//GetVersion get version
|
||||||
|
@ -123,8 +123,9 @@ static int runTask(const char *taskname, char * const argv[], int *exit_status);
|
|||||||
|
|
||||||
static int xmessage(char *argv[], int *exit_status)
|
static int xmessage(char *argv[], int *exit_status)
|
||||||
{
|
{
|
||||||
static const char * const MSG_PROGS[] = {"gmessage", "gxmessage",
|
// static const char * const MSG_PROGS[] = {"gmessage", "gxmessage",
|
||||||
"kmessage", "xmessage"};
|
// "kmessage", "xmessage"};
|
||||||
|
static const char * const MSG_PROGS[] = {"xmessage"};
|
||||||
static int PREV_MSG_INDEX = -1;
|
static int PREV_MSG_INDEX = -1;
|
||||||
#define MSG_PROGS_LEN (sizeof(MSG_PROGS) / sizeof(MSG_PROGS[0]))
|
#define MSG_PROGS_LEN (sizeof(MSG_PROGS) / sizeof(MSG_PROGS[0]))
|
||||||
|
|
||||||
@ -155,15 +156,18 @@ static int xmessage(char *argv[], int *exit_status)
|
|||||||
|
|
||||||
static int runTask(const char *taskname, char * const argv[], int *exit_status)
|
static int runTask(const char *taskname, char * const argv[], int *exit_status)
|
||||||
{
|
{
|
||||||
pid_t pid;
|
pid_t pid = fork();
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
switch (pid = fork()) {
|
switch (pid) {
|
||||||
case -1: /* Failed to fork */
|
case -1: /* Failed to fork */
|
||||||
perror("fork");
|
perror("fork");
|
||||||
return FORK_FAILED; /* Failed to fork. */
|
return FORK_FAILED; /* Failed to fork. */
|
||||||
case 0: /* Child process */
|
case 0: /* Child process */
|
||||||
execvp(taskname, argv);
|
if (strcmp(argv[0],"xmessage") == 0){
|
||||||
|
execvp(taskname, argv);
|
||||||
|
perror("execvp failed");
|
||||||
|
}
|
||||||
exit(42); /* Failed to run task. */
|
exit(42); /* Failed to run task. */
|
||||||
default: /* Parent process */
|
default: /* Parent process */
|
||||||
wait(&status); /* Block execution until finished. */
|
wait(&status); /* Block execution until finished. */
|
||||||
|
Loading…
Reference in New Issue
Block a user