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

Move the frame if the mouse gets out of it #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
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
10 changes: 9 additions & 1 deletion server/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,23 @@ void show_help(char *filename) {
}


ExcCode return_cursor() {
ExcCode return_cursor() { //If the cursor goes out of screen of some distance, then it moves client's screen that much distance
int x, y, same_screen;
if (screen_cursor_get_position(&x, &y, &same_screen))
return 0;
const struct WindowContext *context = control_context_get();
int new_x = MAX(x, context->frame_left);
new_x = MIN(new_x, context->frame_left + context->frame_width);
if (new_x != x ) {
move_LR_handler((signed int)x-new_x); //modif reg
screen_cursor_set_position(new_x, y);
return 0;}
int new_y = MAX(y, context->frame_top);
new_y = MIN(new_y, context->frame_top + context->frame_height);
if (new_y != y ) {
move_UD_handler((signed int)y-new_y); //modif reg
screen_cursor_set_position(x, new_y);
return 0;}
if (!same_screen || x != new_x || y != new_y)
screen_cursor_set_position(new_x, new_y);
return 0;
Expand Down