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

nxagent: add keystrokes to switch clipboard mode on the fly #1047

Open
wants to merge 5 commits into
base: 3.6.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions nx-X11/programs/Xserver/hw/nxagent/Keystroke.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ char * nxagentSpecialKeystrokeNames[] = {
"autograb",

"dump_clipboard",
"clipboard_both",
"clipboard_client",
"clipboard_server",
"clipboard_none",

NULL,
};
Expand Down Expand Up @@ -145,6 +149,10 @@ struct nxagentSpecialKeystrokeMap default_map[] = {
{KEYSTROKE_REREAD_KEYSTROKES, ControlMask, True, XK_k},
{KEYSTROKE_AUTOGRAB, ControlMask, True, XK_g},
{KEYSTROKE_DUMP_CLIPBOARD, ControlMask | ShiftMask, True, XK_c},
{KEYSTROKE_SET_CLIPBOARD_BOTH, ControlMask | ShiftMask, True, XK_1},
{KEYSTROKE_SET_CLIPBOARD_CLIENT, ControlMask | ShiftMask, True, XK_2},
{KEYSTROKE_SET_CLIPBOARD_SERVER, ControlMask | ShiftMask, True, XK_3},
{KEYSTROKE_SET_CLIPBOARD_NONE, ControlMask | ShiftMask, True, XK_4},
{KEYSTROKE_END_MARKER, 0, False, NoSymbol},
};
struct nxagentSpecialKeystrokeMap *map = default_map;
Expand Down Expand Up @@ -725,6 +733,12 @@ Bool nxagentCheckSpecialKeystroke(XKeyEvent *X, enum HandleEventResult *result)
case KEYSTROKE_DUMP_CLIPBOARD:
*result = doDumpClipboard;
break;
case KEYSTROKE_SET_CLIPBOARD_BOTH:
case KEYSTROKE_SET_CLIPBOARD_CLIENT:
case KEYSTROKE_SET_CLIPBOARD_SERVER:
case KEYSTROKE_SET_CLIPBOARD_NONE:
*result = doClipboardBoth + stroke - KEYSTROKE_SET_CLIPBOARD_BOTH;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explain calculation (as mentioned above)

break;
case KEYSTROKE_NOTHING: /* do nothing. difference to KEYSTROKE_IGNORE is the return value */
case KEYSTROKE_END_MARKER: /* just to make gcc STFU */
case KEYSTROKE_MAX:
Expand Down
4 changes: 4 additions & 0 deletions nx-X11/programs/Xserver/hw/nxagent/Keystroke.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ enum nxagentSpecialKeystroke {
KEYSTROKE_AUTOGRAB,

KEYSTROKE_DUMP_CLIPBOARD,
KEYSTROKE_SET_CLIPBOARD_BOTH,
KEYSTROKE_SET_CLIPBOARD_CLIENT,
KEYSTROKE_SET_CLIPBOARD_SERVER,
KEYSTROKE_SET_CLIPBOARD_NONE,

/* insert more here and in the string translation */

Expand Down