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

GUACAMOLE-192: Double and triple click function #406

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Saiyeux
Copy link

@Saiyeux Saiyeux commented Dec 21, 2022

Two files added to /src/protocols/ssh and small changes to input.c. Now we can double click a character and select the whole word. Also triple to the whole line.

Copy link
Contributor

@mike-jumper mike-jumper left a comment

Choose a reason for hiding this comment

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

Thanks - please take a look over this initial review and apply the feedback broadly. I have not yet read through the full internals of these proposed changes, however it looks like there is some major restructuring needed first. There are a few points with respect to style, documentation, etc. which I've made in individual locations but which apply elsewhere here. For the sake of brevity, I've only made those comments once.

@@ -58,7 +174,7 @@ int guac_ssh_user_key_handler(guac_user* user, int keysym, int pressed) {

/* Report key state within recording */
if (ssh_client->recording != NULL)
guac_recording_report_key(ssh_client->recording,
guac_common_recording_report_key(ssh_client->recording,
Copy link
Contributor

Choose a reason for hiding this comment

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

This should remain guac_recording_report_key(). There is no guac_common_recording_report_key() function.

Comment on lines 91 to 207
guac_terminal_get_columns(terminal),
guac_terminal_get_rows(terminal));
terminal->term_width, terminal->term_height);
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't change to terminal->term_width, etc. which are now internal members of the terminal struct. The getter functions are the public interface.

Comment on lines 44 to 48
long long getSystemTime() {
struct timeb t;
ftime(&t);
return 1000 * t.time + t.millitm;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

You do not need to declare your own function for this - libguac provides guac_timestamp_current().

Comment on lines 40 to 42
int state = 0;
long long start_1, start_2, start_3 = 0;
long long end_1, end_2, end_3 = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Global state should be avoided where possible. This would make more sense within the state representation of the internal terminal struct, and needs to be documented.

Comment on lines 28 to 51
typedef struct guac_click {

int select_row;

int select_col;

int select_head;

int select_tail;

guac_terminal* term;

guac_client* client;

guac_socket* socket;

guac_layer* select_layer;

} guac_click;

/* Display selection effect */
void guac_click_draw_select(guac_click* click);

void guac_click_draw_blank(guac_click* click);
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. All functions, parameters, return values, structures, and members need to be documented.
  2. This would make more sense as part of the terminal, rather than being SSH-specific. In that case, each of these functions and structures should be renamed to be within the guac_terminal_ namespace.


}

/* Marks */
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here - what do you mean by "marks"?

Comment on lines 299 to 300
/* Reset flag */
flag = sentinel;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please rephrase to capture the intent of what's happening here, rather than the literal English equivalent of the relevant statement.

int sentinel = term->display->operations[row * term->display->width + col].character.value;
int flag = sentinel;

/* Get head */
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you mean by "head"?

Comment on lines 270 to 271
printf("Head: %d\n", head);
printf("Tail: %d\n", tail);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please do not include debug printf() calls.

Comment on lines 53 to 56
guac_protocol_send_rect(click->socket, click->select_layer, 0, 0, 1, 1);

guac_protocol_send_cfill(click->socket, GUAC_COMP_SRC, click->select_layer,
0x00, 0x00, 0x00, 0x00);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why does the double/triple click behavior need its own dedicated selection redraw code, its own dedicated select layer, etc.? Can the existing terminal selection code not be used as-is?

@Saiyeux
Copy link
Author

Saiyeux commented Dec 21, 2022

Thanks for these replies, I will read each suggestions and make reasonable changes.

@Saiyeux
Copy link
Author

Saiyeux commented Dec 26, 2022

The newest commit with SHA of 9ae48ae should meet these needs mentioned above. I tried to resolve these problems by adding members to terminal structure. If this request is still available for GUACAMOLE-192, please let me know other potential hazards or format problems. Thanks for replying. @mike-jumper

@necouchman
Copy link
Contributor

@Saiyeux : Actual code changes aside, you have a couple of issues with your pull request:

  • You have a merge commit that should not be present. You'll need to rebase off the current master and get rid of that.
  • You have have merge conflicts that need to be resolved with the current master before these changes will commit.
  • All of your commit messages are exactly the same, and do not provide good descriptions of the nature of the commit. You'll need to update the commit messages, and possibly squash commits together where it makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants