Let it take a command to run in its DISPLAY after "--".
This commit is contained in:
parent
90fa0770e8
commit
7b2220003c
3 changed files with 37 additions and 1 deletions
13
src/main.cpp
13
src/main.cpp
|
@ -32,6 +32,8 @@ bool g_bFilterGameWindow = true;
|
||||||
|
|
||||||
bool g_bBorderlessOutputWindow = false;
|
bool g_bBorderlessOutputWindow = false;
|
||||||
|
|
||||||
|
uint32_t g_nSubCommandArg = 0;
|
||||||
|
|
||||||
int BIsNested()
|
int BIsNested()
|
||||||
{
|
{
|
||||||
return g_bIsNested == true;
|
return g_bIsNested == true;
|
||||||
|
@ -39,6 +41,17 @@ int BIsNested()
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
// Grab the starting position of a potential command that follows "--" in argv
|
||||||
|
// Do it before getopt can reorder anything, for use later
|
||||||
|
for ( int i = 0; i < argc; i++ )
|
||||||
|
{
|
||||||
|
if ( strcmp( "--", argv[ i ] ) == 0 && i + 1 < argc )
|
||||||
|
{
|
||||||
|
g_nSubCommandArg = i + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int o;
|
int o;
|
||||||
ac = argc;
|
ac = argc;
|
||||||
av = argv;
|
av = argv;
|
||||||
|
|
|
@ -33,6 +33,8 @@ extern uint32_t g_nOutputHeight;
|
||||||
|
|
||||||
extern bool g_bFilterGameWindow;
|
extern bool g_bFilterGameWindow;
|
||||||
|
|
||||||
|
extern uint32_t g_nSubCommandArg;
|
||||||
|
|
||||||
int BIsNested( void );
|
int BIsNested( void );
|
||||||
|
|
||||||
#ifndef C_SIDE
|
#ifndef C_SIDE
|
||||||
|
|
|
@ -41,6 +41,9 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
|
#include <spawn.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
|
@ -60,6 +63,8 @@
|
||||||
#define GPUVIS_TRACE_IMPLEMENTATION
|
#define GPUVIS_TRACE_IMPLEMENTATION
|
||||||
#include "gpuvis_trace_utils.h"
|
#include "gpuvis_trace_utils.h"
|
||||||
|
|
||||||
|
extern char **environ;
|
||||||
|
|
||||||
typedef struct _ignore {
|
typedef struct _ignore {
|
||||||
struct _ignore *next;
|
struct _ignore *next;
|
||||||
unsigned long sequence;
|
unsigned long sequence;
|
||||||
|
@ -1702,7 +1707,7 @@ steamcompmgr_main (int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dpy = XOpenDisplay (wlserver.wlr.xwayland->display_name);
|
dpy = XOpenDisplay (wlserver.wlr.xwayland->display_name);
|
||||||
if (!dpy)
|
if (!dpy)
|
||||||
{
|
{
|
||||||
|
@ -1832,6 +1837,22 @@ steamcompmgr_main (int argc, char **argv)
|
||||||
readyPipeFD = -1;
|
readyPipeFD = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( g_nSubCommandArg != 0 )
|
||||||
|
{
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
|
sigset_t fullset;
|
||||||
|
sigfillset( &fullset );
|
||||||
|
|
||||||
|
posix_spawnattr_t attr;
|
||||||
|
|
||||||
|
posix_spawnattr_init( &attr );
|
||||||
|
posix_spawnattr_setflags( &attr, POSIX_SPAWN_SETSIGDEF );
|
||||||
|
posix_spawnattr_setsigdefault( &attr, &fullset );
|
||||||
|
|
||||||
|
posix_spawnp( &pid, argv[ g_nSubCommandArg ], NULL, &attr, &argv[ g_nSubCommandArg ], environ );
|
||||||
|
}
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
focusDirty = False;
|
focusDirty = False;
|
||||||
|
|
Loading…
Reference in a new issue