-
Notifications
You must be signed in to change notification settings - Fork 662
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
Conversation
There was a problem hiding this 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.
src/protocols/ssh/input.c
Outdated
@@ -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, |
There was a problem hiding this comment.
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.
src/protocols/ssh/input.c
Outdated
guac_terminal_get_columns(terminal), | ||
guac_terminal_get_rows(terminal)); | ||
terminal->term_width, terminal->term_height); |
There was a problem hiding this comment.
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.
src/protocols/ssh/input.c
Outdated
long long getSystemTime() { | ||
struct timeb t; | ||
ftime(&t); | ||
return 1000 * t.time + t.millitm; | ||
} |
There was a problem hiding this comment.
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()
.
src/protocols/ssh/input.c
Outdated
int state = 0; | ||
long long start_1, start_2, start_3 = 0; | ||
long long end_1, end_2, end_3 = 0; |
There was a problem hiding this comment.
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.
src/protocols/ssh/click.h
Outdated
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- All functions, parameters, return values, structures, and members need to be documented.
- 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.
src/protocols/ssh/click.c
Outdated
|
||
} | ||
|
||
/* Marks */ |
There was a problem hiding this comment.
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"?
src/protocols/ssh/click.c
Outdated
/* Reset flag */ | ||
flag = sentinel; |
There was a problem hiding this comment.
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.
src/protocols/ssh/click.c
Outdated
int sentinel = term->display->operations[row * term->display->width + col].character.value; | ||
int flag = sentinel; | ||
|
||
/* Get head */ |
There was a problem hiding this comment.
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"?
src/protocols/ssh/click.c
Outdated
printf("Head: %d\n", head); | ||
printf("Tail: %d\n", tail); |
There was a problem hiding this comment.
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.
src/protocols/ssh/click.c
Outdated
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); |
There was a problem hiding this comment.
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?
Thanks for these replies, I will read each suggestions and make reasonable changes. |
Tried out another way without adding other files to realize the function.
Formatting changes.
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 |
Debug output deleted.
@Saiyeux : Actual code changes aside, you have a couple of issues with your pull request:
|
Closing as these changes are more or less covered by the recently-merged #504 . |
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.