Переглянути джерело

Add vncviewer option to use large cursor instead of dot

This commit adds a large cursor bitmap to both versions of vncviewer
(Java and native) which can be used instead of the previously used dot
cursor, as well as the options and parameters to be able to enable or
disable its use at runtime.
pull/1491/head
Krystof Pistek 1 рік тому
джерело
коміт
06ea8efb04
Аккаунт користувача з таким Email не знайдено

+ 13
- 2
java/com/tigervnc/vncviewer/OptionsDialog.java Переглянути файл

@@ -152,6 +152,7 @@ class OptionsDialog extends Dialog {
/* Misc. */
JCheckBox sharedCheckbox;
JCheckBox dotWhenNoCursorCheckbox;
JCheckBox largeCursorInsteadOfDotCheckbox;
JCheckBox acceptBellCheckbox;

/* SSH */
@@ -449,6 +450,7 @@ class OptionsDialog extends Dialog {
/* Misc. */
sharedCheckbox.setSelected(shared.getValue());
dotWhenNoCursorCheckbox.setSelected(dotWhenNoCursor.getValue());
largeCursorInsteadOfDotCheckbox.setSelected(largeCursorInsteadOfDot.getValue());
acceptBellCheckbox.setSelected(acceptBell.getValue());

/* SSH */
@@ -593,6 +595,7 @@ class OptionsDialog extends Dialog {
/* Misc. */
shared.setParam(sharedCheckbox.isSelected());
dotWhenNoCursor.setParam(dotWhenNoCursorCheckbox.isSelected());
largeCursorInsteadOfDot.setParam(largeCursorInsteadOfDotCheckbox.isSelected());
acceptBell.setParam(acceptBellCheckbox.isSelected());

/* SSH */
@@ -1140,6 +1143,7 @@ class OptionsDialog extends Dialog {
sharedCheckbox =
new JCheckBox("Shared (don't disconnect other viewers)");
dotWhenNoCursorCheckbox = new JCheckBox("Show dot when no cursor");
largeCursorInsteadOfDotCheckbox = new JCheckBox("Use large cursor instead of dot");
acceptBellCheckbox = new JCheckBox("Beep when requested by the server");
MiscPanel.add(sharedCheckbox,
new GridBagConstraints(0, 0,
@@ -1155,15 +1159,22 @@ class OptionsDialog extends Dialog {
LINE_START, NONE,
new Insets(0, 0, 4, 0),
NONE, NONE));
MiscPanel.add(acceptBellCheckbox,
MiscPanel.add(largeCursorInsteadOfDotCheckbox,
new GridBagConstraints(0, 2,
1, 1,
LIGHT, LIGHT,
LINE_START, NONE,
new Insets(0, 0, 4, 0),
NONE, NONE));
MiscPanel.add(Box.createRigidArea(new Dimension(5, 0)),
MiscPanel.add(acceptBellCheckbox,
new GridBagConstraints(0, 3,
1, 1,
LIGHT, LIGHT,
LINE_START, NONE,
new Insets(0, 0, 4, 0),
NONE, NONE));
MiscPanel.add(Box.createRigidArea(new Dimension(5, 0)),
new GridBagConstraints(0, 4,
REMAINDER, REMAINDER,
HEAVY, HEAVY,
LINE_START, BOTH,

+ 6
- 0
java/com/tigervnc/vncviewer/Parameters.java Переглянути файл

@@ -43,6 +43,11 @@ public class Parameters {
"Show the dot cursor when the server sends an invisible cursor",
false);

public static BoolParameter largeCursorInsteadOfDot
= new BoolParameter("LargeCursorInsteadOfDot",
"Use a large cursor bitmap instead of a dot when using the dot cursor",
false);

public static BoolParameter sendLocalUsername
= new BoolParameter("SendLocalUsername",
"Send the local username for SecurityTypes "+
@@ -283,6 +288,7 @@ public class Parameters {
CSecurityTLS.X509CRL,
SecurityClient.secTypes,
dotWhenNoCursor,
largeCursorInsteadOfDot,
autoSelect,
fullColor,
lowColorLevel,

+ 45
- 3
java/com/tigervnc/vncviewer/Viewport.java Переглянути файл

@@ -156,6 +156,41 @@ class Viewport extends JPanel implements ActionListener {
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
};

static final int[] largecursor_xpm = {
0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xffffffff, 0xffffffff, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000,
0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000,
0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000,
0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000,
0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
0xffffffff, 0xffffffff, 0xff000000, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000
};

public void setCursor(int width, int height, Point hotspot,
byte[] data)
{
@@ -169,9 +204,16 @@ class Viewport extends JPanel implements ActionListener {

if ((i == width*height) && dotWhenNoCursor.getValue()) {
vlog.debug("cursor is empty - using dot");
cursor = new BufferedImage(5, 5, BufferedImage.TYPE_INT_ARGB_PRE);
cursor.setRGB(0, 0, 5, 5, dotcursor_xpm, 0, 5);
cursorHotspot.x = cursorHotspot.y = 3;
if (largeCursorInsteadOfDot.getValue()) {
cursor = new BufferedImage(18, 32, BufferedImage.TYPE_INT_ARGB_PRE);
cursor.setRGB(0, 0, 18, 32, largecursor_xpm, 0, 18);
cursorHotspot.x = cursorHotspot.y = 3;
} else {
cursor = new BufferedImage(5, 5, BufferedImage.TYPE_INT_ARGB_PRE);
cursor.setRGB(0, 0, 5, 5, dotcursor_xpm, 0, 5);
cursorHotspot.x = cursorHotspot.y = 3;
}

} else {
if ((width == 0) || (height == 0)) {
cursor = new BufferedImage(tk.getBestCursorSize(0, 0).width,

+ 9
- 0
vncviewer/OptionsDialog.cxx Переглянути файл

@@ -318,6 +318,7 @@ void OptionsDialog::loadOptions(void)
sharedCheckbox->value(shared);
reconnectCheckbox->value(reconnectOnError);
dotCursorCheckbox->value(dotWhenNoCursor);
largeCursorInsteadOfDotCheckbox->value(largeCursorInsteadOfDot);
}


@@ -432,6 +433,7 @@ void OptionsDialog::storeOptions(void)
shared.setParam(sharedCheckbox->value());
reconnectOnError.setParam(reconnectCheckbox->value());
dotWhenNoCursor.setParam(dotCursorCheckbox->value());
largeCursorInsteadOfDot.setParam(largeCursorInsteadOfDotCheckbox->value());

std::map<OptionsCallback*, void*>::const_iterator iter;

@@ -760,6 +762,13 @@ void OptionsDialog::createInputPage(int tx, int ty, int tw, int th)
CHECK_MIN_WIDTH,
CHECK_HEIGHT,
_("Show dot when no cursor")));

ty += CHECK_HEIGHT + TIGHT_MARGIN;

largeCursorInsteadOfDotCheckbox = new Fl_Check_Button(LBLRIGHT(tx, ty,
CHECK_MIN_WIDTH,
CHECK_HEIGHT,
_("Use large cursor instead of dot")));
ty += CHECK_HEIGHT + TIGHT_MARGIN;
}
ty += GROUP_MARGIN - TIGHT_MARGIN;

+ 1
- 0
vncviewer/OptionsDialog.h Переглянути файл

@@ -114,6 +114,7 @@ protected:
Fl_Group *mouseGroup;
Fl_Check_Button *emulateMBCheckbox;
Fl_Check_Button *dotCursorCheckbox;
Fl_Check_Button *largeCursorInsteadOfDotCheckbox;
Fl_Group *keyboardGroup;
Fl_Check_Button *systemKeysCheckbox;
Fl_Choice *menuKeyChoice;

+ 45
- 2
vncviewer/Viewport.cxx Переглянути файл

@@ -243,6 +243,44 @@ static const char * dotcursor_xpm[] = {
" ... ",
" "};

static const char * largecursor_xpm[] = {
"18 32 3 1",
". c #000000",
" c #FFFFFF",
", c None",
" ,,,,,,,,,,,,,,,,",
" ,,,,,,,,,,,,,,,",
" ,,,,,,,,,,,,,,",
" ,,,,,,,,,,,,,",
" . ,,,,,,,,,,,,",
" .. ,,,,,,,,,,,",
" ... ,,,,,,,,,,",
" .... ,,,,,,,,,",
" ..... ,,,,,,,,",
" ...... ,,,,,,,",
" ....... ,,,,,,",
" ........ ,,,,,",
" ......... ,,,,",
" .......... ,,,",
" ........... ,,",
" ............ ,",
" ............ ,",
" ......... ,,",
" .... ... ,,,,",
" ... ... ,,,,",
" .. ... ,,,",
" . ,, ... ,,,",
" ,,, ... ,,,",
",,,,,,, ... ,,,",
",,,,,,,, ... ,,,",
",,,,,,,,, ... ,,,",
",,,,,,,,, ,,,,",
",,,,,,,,,, ,,,,,",
",,,,,,,,,,,,,,,,,,",
",,,,,,,,,,,,,,,,,,",
",,,,,,,,,,,,,,,,,,",
",,,,,,,,,,,,,,,,,,"};

void Viewport::setCursor(int width, int height, const Point& hotspot,
const rdr::U8* data)
{
@@ -260,8 +298,13 @@ void Viewport::setCursor(int width, int height, const Point& hotspot,
if ((i == width*height) && dotWhenNoCursor) {
vlog.debug("cursor is empty - using dot");

Fl_Pixmap pxm(dotcursor_xpm);
cursor = new Fl_RGB_Image(&pxm);
Fl_Pixmap dotCursor(dotcursor_xpm);
Fl_Pixmap largeCursor(largecursor_xpm);
if (largeCursorInsteadOfDot) {
cursor = new Fl_RGB_Image(&largeCursor);
} else {
cursor = new Fl_RGB_Image(&dotCursor);
}
cursorHotspot.x = cursorHotspot.y = 2;
} else {
if ((width == 0) || (height == 0)) {

+ 4
- 0
vncviewer/parameters.cxx Переглянути файл

@@ -64,6 +64,9 @@ BoolParameter emulateMiddleButton("EmulateMiddleButton",
BoolParameter dotWhenNoCursor("DotWhenNoCursor",
"Show the dot cursor when the server sends an "
"invisible cursor", false);
BoolParameter largeCursorInsteadOfDot("LargeCursorInsteadOfDot",
"Use a large cursor bitmap instead of a dot "
"when using the dot cursor", false);

BoolParameter alertOnFatalError("AlertOnFatalError",
"Give a dialog on connection problems rather "
@@ -200,6 +203,7 @@ static VoidParameter* parameterArray[] = {
&viewOnly,
&emulateMiddleButton,
&dotWhenNoCursor,
&largeCursorInsteadOfDot,
&acceptClipboard,
&sendClipboard,
#if !defined(WIN32) && !defined(__APPLE__)

+ 1
- 0
vncviewer/parameters.h Переглянути файл

@@ -34,6 +34,7 @@
extern rfb::IntParameter pointerEventInterval;
extern rfb::BoolParameter emulateMiddleButton;
extern rfb::BoolParameter dotWhenNoCursor;
extern rfb::BoolParameter largeCursorInsteadOfDot;

extern rfb::StringParameter passwordFile;


+ 4
- 0
vncviewer/vncviewer.man Переглянути файл

@@ -285,6 +285,10 @@ Use custom compression level. Default if \fBCompressLevel\fP is specified.
Show the dot cursor when the server sends an invisible cursor. Default is off.
.
.TP
.B \-LargeCursorInsteadOfDot
Show a large cursor instead of a dot cursor (if enabled). Default is off.
.
.TP
.B \-PointerEventInterval \fItime\fP
Time in milliseconds to rate-limit successive pointer events. Default is
17 ms (60 Hz).

Завантаження…
Відмінити
Зберегти