hw/xwin: Add controls for enabling/disabling monitoring of PRIMARY selection
xwinclip: Add -noprimary option Xwin: Add -primary and -noprimary options and tray-menu control v2: Use Bool type for fPrimarySelection Add -noprimary to usage message Fix indentation in hw/xwin/winwndproc.c Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
parent
851b504199
commit
c03f9e23c2
|
@ -793,6 +793,10 @@ winUseMsg(void)
|
||||||
#ifdef XWIN_CLIPBOARD
|
#ifdef XWIN_CLIPBOARD
|
||||||
ErrorF("-nounicodeclipboard\n"
|
ErrorF("-nounicodeclipboard\n"
|
||||||
"\tDo not use Unicode clipboard even if on a NT-based platform.\n");
|
"\tDo not use Unicode clipboard even if on a NT-based platform.\n");
|
||||||
|
|
||||||
|
ErrorF("-[no]primary\n"
|
||||||
|
"\tWhen clipboard integration is enabled, map the X11 PRIMARY selection\n"
|
||||||
|
"\tto the Windows clipboard. Default is enabled.\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ErrorF("-refresh rate_in_Hz\n"
|
ErrorF("-refresh rate_in_Hz\n"
|
||||||
|
|
|
@ -93,6 +93,7 @@ BEGIN
|
||||||
POPUP "TRAYICON_MENU"
|
POPUP "TRAYICON_MENU"
|
||||||
BEGIN
|
BEGIN
|
||||||
MENUITEM "&Hide Root Window", ID_APP_HIDE_ROOT
|
MENUITEM "&Hide Root Window", ID_APP_HIDE_ROOT
|
||||||
|
MENUITEM "Clipboard may use &PRIMARY selection", ID_APP_MONITOR_PRIMARY
|
||||||
MENUITEM "&About...", ID_APP_ABOUT
|
MENUITEM "&About...", ID_APP_ABOUT
|
||||||
MENUITEM SEPARATOR
|
MENUITEM SEPARATOR
|
||||||
MENUITEM "E&xit...", ID_APP_EXIT
|
MENUITEM "E&xit...", ID_APP_EXIT
|
||||||
|
|
|
@ -174,7 +174,7 @@ on remote hosts, when that information is available and it's useful to do so.
|
||||||
.SH OPTIONS CONTROLLING WINDOWS INTEGRATION
|
.SH OPTIONS CONTROLLING WINDOWS INTEGRATION
|
||||||
.TP 8
|
.TP 8
|
||||||
.B \-[no]clipboard
|
.B \-[no]clipboard
|
||||||
Enables [disables] the integration between the Cygwin/X clipboard and
|
Enables [disables] the integration between the X11 clipboard and
|
||||||
\fIWindows\fP clipboard. The default is enabled.
|
\fIWindows\fP clipboard. The default is enabled.
|
||||||
.TP 8
|
.TP 8
|
||||||
.B "\-emulate3buttons [\fItimeout\fP]"
|
.B "\-emulate3buttons [\fItimeout\fP]"
|
||||||
|
@ -200,6 +200,10 @@ prevents the \fIWindows\fP mouse cursor from being drawn on top of the X
|
||||||
cursor.
|
cursor.
|
||||||
This parameter has no effect unless \fB-swcursor\fP is also specified.
|
This parameter has no effect unless \fB-swcursor\fP is also specified.
|
||||||
.TP 8
|
.TP 8
|
||||||
|
.B \-[no]primary
|
||||||
|
Clipboard integration may [will not] use the PRIMARY selection.
|
||||||
|
The default is enabled.
|
||||||
|
.TP 8
|
||||||
.B \-swcursor
|
.B \-swcursor
|
||||||
Disable the usage of the \fIWindows\fP cursor and use the X11 software cursor instead.
|
Disable the usage of the \fIWindows\fP cursor and use the X11 software cursor instead.
|
||||||
.TP 8
|
.TP 8
|
||||||
|
|
|
@ -33,4 +33,6 @@ void winFixClipboardChain(void);
|
||||||
|
|
||||||
void winClipboardWindowDestroy(void);
|
void winClipboardWindowDestroy(void);
|
||||||
|
|
||||||
|
extern Bool fPrimarySelection;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -44,11 +44,13 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include "internal.h"
|
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <X11/extensions/Xfixes.h>
|
#include <X11/extensions/Xfixes.h>
|
||||||
|
|
||||||
|
#include "winclipboard.h"
|
||||||
|
#include "internal.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Constants
|
* Constants
|
||||||
*/
|
*/
|
||||||
|
@ -63,6 +65,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int xfixes_event_base;
|
extern int xfixes_event_base;
|
||||||
|
Bool fPrimarySelection = TRUE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Local variables
|
* Local variables
|
||||||
|
@ -793,7 +796,7 @@ winClipboardFlushXEvents(HWND hwnd,
|
||||||
winDebug("winClipboardFlushXEvents - XFixesSetSelectionOwnerNotify\n");
|
winDebug("winClipboardFlushXEvents - XFixesSetSelectionOwnerNotify\n");
|
||||||
|
|
||||||
/* Save selection owners for monitored selections, ignore other selections */
|
/* Save selection owners for monitored selections, ignore other selections */
|
||||||
if (e->selection == XA_PRIMARY) {
|
if ((e->selection == XA_PRIMARY) && fPrimarySelection) {
|
||||||
MonitorSelection(e, CLIP_OWN_PRIMARY);
|
MonitorSelection(e, CLIP_OWN_PRIMARY);
|
||||||
}
|
}
|
||||||
else if (e->selection == atomClipboard) {
|
else if (e->selection == atomClipboard) {
|
||||||
|
|
|
@ -92,6 +92,13 @@ main (int argc, char *argv[])
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Look for -noprimary */
|
||||||
|
if (!strcmp (argv[i], "-noprimary"))
|
||||||
|
{
|
||||||
|
fPrimarySelection = False;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* Yack when we find a parameter that we don't know about */
|
/* Yack when we find a parameter that we don't know about */
|
||||||
printf ("Unknown parameter: %s\nExiting.\n", argv[i]);
|
printf ("Unknown parameter: %s\nExiting.\n", argv[i]);
|
||||||
exit (1);
|
exit (1);
|
||||||
|
|
|
@ -29,6 +29,9 @@ Specifies the X server display to connect to.
|
||||||
.TP 8
|
.TP 8
|
||||||
.B \-nounicodeclipboard
|
.B \-nounicodeclipboard
|
||||||
Do not use unicode text on the clipboard.
|
Do not use unicode text on the clipboard.
|
||||||
|
.TP 8
|
||||||
|
.B \-noprimary
|
||||||
|
Do not monitor the PRIMARY selection.
|
||||||
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
XWin(1)
|
XWin(1)
|
||||||
|
|
|
@ -37,6 +37,10 @@ from The Open Group.
|
||||||
#include "winmsg.h"
|
#include "winmsg.h"
|
||||||
#include "winmonitors.h"
|
#include "winmonitors.h"
|
||||||
|
|
||||||
|
#ifdef XWIN_CLIPBOARD
|
||||||
|
#include "winclipboard/winclipboard.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Function prototypes
|
* Function prototypes
|
||||||
*/
|
*/
|
||||||
|
@ -707,6 +711,26 @@ ddxProcessArgument(int argc, char *argv[], int i)
|
||||||
/* Indicate that we have processed this argument */
|
/* Indicate that we have processed this argument */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Look for the '-primary' argument
|
||||||
|
*/
|
||||||
|
if (IS_OPTION("-primary")) {
|
||||||
|
fPrimarySelection = TRUE;
|
||||||
|
|
||||||
|
/* Indicate that we have processed this argument */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Look for the '-noprimary' argument
|
||||||
|
*/
|
||||||
|
if (IS_OPTION("-noprimary")) {
|
||||||
|
fPrimarySelection = FALSE;
|
||||||
|
|
||||||
|
/* Indicate that we have processed this argument */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#define ID_APP_HIDE_ROOT 201
|
#define ID_APP_HIDE_ROOT 201
|
||||||
#define ID_APP_ALWAYS_ON_TOP 202
|
#define ID_APP_ALWAYS_ON_TOP 202
|
||||||
#define ID_APP_ABOUT 203
|
#define ID_APP_ABOUT 203
|
||||||
|
#define ID_APP_MONITOR_PRIMARY 204
|
||||||
|
|
||||||
#define ID_ABOUT_WEBSITE 303
|
#define ID_ABOUT_WEBSITE 303
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,13 @@
|
||||||
#ifdef HAVE_XWIN_CONFIG_H
|
#ifdef HAVE_XWIN_CONFIG_H
|
||||||
#include <xwin-config.h>
|
#include <xwin-config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "win.h"
|
#include "win.h"
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#include "winprefs.h"
|
#include "winprefs.h"
|
||||||
|
#ifdef XWIN_CLIPBOARD
|
||||||
|
#include "winclipboard/winclipboard.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the tray icon
|
* Initialize the tray icon
|
||||||
|
@ -170,6 +174,21 @@ winHandleIconMessage(HWND hwnd, UINT message,
|
||||||
RemoveMenu(hmenuTray, ID_APP_HIDE_ROOT, MF_BYCOMMAND);
|
RemoveMenu(hmenuTray, ID_APP_HIDE_ROOT, MF_BYCOMMAND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef XWIN_CLIPBOARD
|
||||||
|
if (g_fClipboard) {
|
||||||
|
/* Set menu state to indicate if 'Monitor Primary' is enabled or not */
|
||||||
|
MENUITEMINFO mii = { 0 };
|
||||||
|
mii.cbSize = sizeof(MENUITEMINFO);
|
||||||
|
mii.fMask = MIIM_STATE;
|
||||||
|
mii.fState = fPrimarySelection ? MFS_CHECKED : MFS_UNCHECKED;
|
||||||
|
SetMenuItemInfo(hmenuTray, ID_APP_MONITOR_PRIMARY, FALSE, &mii);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* Remove 'Monitor Primary' menu item */
|
||||||
|
RemoveMenu(hmenuTray, ID_APP_MONITOR_PRIMARY, MF_BYCOMMAND);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
SetupRootMenu(hmenuTray);
|
SetupRootMenu(hmenuTray);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1218,6 +1218,12 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef XWIN_CLIPBOARD
|
||||||
|
case ID_APP_MONITOR_PRIMARY:
|
||||||
|
fPrimarySelection = !fPrimarySelection;
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
case ID_APP_ABOUT:
|
case ID_APP_ABOUT:
|
||||||
/* Display the About box */
|
/* Display the About box */
|
||||||
winDisplayAboutDialog(s_pScreenPriv);
|
winDisplayAboutDialog(s_pScreenPriv);
|
||||||
|
|
Loading…
Reference in New Issue