Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-design the nxagent dialog callbacks #387

Open
wants to merge 7 commits into
base: 3.6.x
Choose a base branch
from
6 changes: 6 additions & 0 deletions bin/nxagent.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@

NX_LIBDIR=@@NXLIBDIR@@

# [[ -v varname ]] requires bash 4.2
if [ ! -v NX_CALLBACKS_DISPATCHER ] && \
[ -x "${NX_LIBDIR}/bin/nxagent-callbacks-dispatcher" ]; then
export NX_CALLBACKS_DISPATCHER="${NX_LIBDIR}/bin/nxagent-callbacks-dispatcher"
fi

# make sure nxagent starts properly with pam_tmpdir.so being in use
NX_TEMP=${NX_TEMP:-/tmp}
export NX_TEMP
Expand Down
7 changes: 2 additions & 5 deletions nx-X11/programs/Xserver/Imakefile
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ NXAGENTOBJS = hw/nxagent/miinitext.o \
XPMLIB = -lXpm
XMLLIB = `pkg-config --libs libxml-2.0`
PIXMANLIB = `pkg-config --libs pixman-1`
ZLIB = `pkg-config --libs zlib`
ZLIB = `pkg-config --libs-only-l zlib`
PNGLIB = `pkg-config --libs libpng`
JPEGLIB = -ljpeg

Expand All @@ -308,7 +308,6 @@ $(NXAGENTOBJS) $(NXAGENTLIBS) $(NXAGENTSYSLIBS):: $(NXAGENTDIRS)
#if defined(SunArchitecture)
NXAGENTNXLIBS = -L/usr/sfw/lib \
-L../../../nxcomp \
-L../../../nx-X11/exports/lib \
-L../../../nxcompshad \
-lrt \
-lXcomp \
Expand All @@ -317,15 +316,13 @@ NXAGENTNXLIBS = -L/usr/sfw/lib \
-lNX_X11 -lXext
#elif defined(cygwinArchitecture)
NXAGENTNXLIBS = -L../../../nxcomp \
-L../../../nx-X11/exports/lib \
-L../../../nxcompshad \
-lXcomp \
-lXcompshad \
-lXrender -lXfixes -lXfont -lXcomposite -lXdmcp \
-lNX_X11 -lXext
#else
NXAGENTNXLIBS = -L../../../nxcomp \
-L../../../nx-X11/exports/lib \
-L../../../nxcompshad \
-lXcomp \
-lXcompshad \
Expand All @@ -341,7 +338,7 @@ NX_XSHADOWLIBNAME = libXcompshad.so
#endif

ServerTarget(nxagent,$(NXAGENTDIRS),$(NXAGENTOBJS), \
$(LIBCWRAPPER) $(NXCOMPEXT) $(NXAGENTLIBS) $(LOADABLEEXTS),$(NXCOMPEXTSYSLIBS) $(NXAGENTSYSLIBS) $(NXAGENTNXLIBS))
$(LIBCWRAPPER) $(NXCOMPEXT) $(NXAGENTLIBS) $(LOADABLEEXTS),$(NXAGENTNXLIBS) $(NXAGENTSYSLIBS) $(NXCOMPEXTSYSLIBS))

/*
* Hard coded target to build a static nxagent server.
Expand Down
36 changes: 9 additions & 27 deletions nx-X11/programs/Xserver/hw/nxagent/Dialog.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ int nxagentEnableRandRModeDialogPid = 0;
int nxagentDisableRandRModeDialogPid = 0;
int nxagentEnableDeferModePid = 0;
int nxagentDisableDeferModePid = 0;
int nxagentDisableXkbPid = 0;

static int nxagentFailedReconnectionDialogPid = 0;

Expand Down Expand Up @@ -159,15 +158,6 @@ void nxagentResetDialog(int pid)

nxagentDisableDeferModePid = 0;
}
else if (pid == nxagentDisableXkbPid)
{
#ifdef TEST
fprintf(stderr, "nxagentResetDialog: Resetting disable XKB dialog pid [%d].\n",
nxagentDisableXkbPid);
#endif

nxagentDisableXkbPid = 0;
}
}

void nxagentLaunchDialog(DialogType dialogType)
Expand All @@ -180,6 +170,8 @@ void nxagentLaunchDialog(DialogType dialogType)
int local;
const char *window = NULL;

char *cbDispatcherCmd;

switch (dialogType)
{
case DIALOG_KILL_SESSION:
Expand Down Expand Up @@ -273,15 +265,6 @@ void nxagentLaunchDialog(DialogType dialogType)

break;
}
case DIALOG_DISABLE_XKB:
{
message = DIALOG_DISABLE_XKB_MESSAGE;
type = DIALOG_DISABLE_XKB_TYPE;
local = DIALOG_DISABLE_XKB_LOCAL;
pid = &nxagentDisableXkbPid;

break;
}
default:
{
#ifdef WARNING
Expand Down Expand Up @@ -319,9 +302,14 @@ void nxagentLaunchDialog(DialogType dialogType)

sigprocmask(SIG_BLOCK, &set, &oldSet);

*pid = NXTransDialog(nxagentDialogName, message, window,
type, local, dialogDisplay);
cbDispatcherCmd = getenv("NX_CALLBACKS_DISPATCHER");

if (cbDispatcherCmd == NULL)
*pid = NXTransDialog(nxagentDialogName, message, window,
type, local, dialogDisplay);
else
*pid = NXTransCallbacksDispatcher(nxagentDialogName, message, window,
type, local, dialogDisplay);
#ifdef TEST
fprintf(stderr, "nxagentLaunchDialog: Launched dialog %s with pid [%d] on display %s.\n",
DECODE_DIALOG_TYPE(dialogType), *pid, dialogDisplay);
Expand Down Expand Up @@ -521,12 +509,6 @@ void nxagentTerminateDialog(DialogType type)

break;
}
case DIALOG_DISABLE_XKB:
{
pid = nxagentDisableXkbPid;

break;
}
default:
{
#ifdef WARNING
Expand Down
17 changes: 1 addition & 16 deletions nx-X11/programs/Xserver/hw/nxagent/Dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ typedef enum
DIALOG_FAILED_RECONNECTION,
DIALOG_ENABLE_DEFER_MODE,
DIALOG_DISABLE_DEFER_MODE,
DIALOG_DISABLE_XKB,
DIALOG_LAST_TAG

} DialogType;
Expand All @@ -55,7 +54,6 @@ extern int nxagentEnableRandRModeDialogPid;
extern int nxagentDisableRandRModeDialogPid;
extern int nxagentEnableDeferModePid;
extern int nxagentDisableDeferModePid;
extern int nxagentDisableXkbPid;

extern char nxagentFailedReconnectionMessage[];

Expand All @@ -74,8 +72,7 @@ extern void nxagentTerminateDialogs(void);
nxagentEnableRandRModeDialogPid == 0 && \
nxagentDisableRandRModeDialogPid == 0 && \
nxagentEnableDeferModePid == 0 && \
nxagentDisableDeferModePid == 0 && \
nxagentDisableXkbPid == 0)
nxagentDisableDeferModePid == 0)

#define DECODE_DIALOG_TYPE(type) \
((type) == DIALOG_KILL_SESSION ? "DIALOG_KILL_SESSION" : \
Expand All @@ -88,7 +85,6 @@ extern void nxagentTerminateDialogs(void);
(type) == DIALOG_FAILED_RECONNECTION ? "DIALOG_FAILED_RECONNECTION" : \
(type) == DIALOG_ENABLE_DEFER_MODE ? "DIALOG_ENABLE_DEFER_MODE" : \
(type) == DIALOG_DISABLE_DEFER_MODE ? "DIALOG_DISABLE_DEFER_MODE" : \
(type) == DIALOG_DISABLE_XKB ? "DIALOG_DISABLE_XKB" : \
"UNKNOWN_DIALOG")

/*
Expand Down Expand Up @@ -216,16 +212,5 @@ Ctrl+Alt+E to enable it again.\

#define DIALOG_DISABLE_DEFER_MODE_LOCAL 0


#define DIALOG_DISABLE_XKB_MESSAGE \
\
"\
Changing layout is not allowed with your current display.\
"

#define DIALOG_DISABLE_XKB_TYPE "ok"

#define DIALOG_DISABLE_XKB_LOCAL 0

#endif /* __Dialog_H__ */

Loading