int candidate = NOT_USED;
int candidate_distance_x = INT_MAX;
int candidate_distance_y = INT_MAX;
+ int startpos_identical = FALSE;
int otherside_candidate = NOT_USED;
layout = context->get_popup_layout(window);
}
}
+
if (windows && cache && context &&
sclres_layout_key_coordinate_pointer_frame && scl_check_arrindex(layout, MAX_SCL_LAYOUT)) {
for (sclint loop = 0;loop < MAX_KEY; loop++) {
if (temp_distance_y <= candidate_distance_y && temp_distance_y < 0) {
/* If the button is closer in Y axis, consider this to be the closer regardless of X */
if (temp_distance_y < candidate_distance_y) {
- candidate_distance_x = INT_MAX;
+ /* Only if the ypos were not the same */
+ if (!startpos_identical) {
+ candidate_distance_x = INT_MAX;
+ }
}
/* Save for otherside */
otherside_candidate = loop;
candidate = loop;
candidate_distance_x = temp_distance_x;
candidate_distance_y = temp_distance_y;
+ startpos_identical = (btn.y == cur.y);
}
}
}
if (temp_distance_y <= candidate_distance_y && temp_distance_y < 0) {
/* If the button is closer in Y axis, consider this to be the closer regardless of X */
if (temp_distance_y < candidate_distance_y) {
- candidate_distance_x = INT_MAX;
+ /* Only if the ypos were not the same */
+ if (!startpos_identical) {
+ candidate_distance_x = INT_MAX;
+ }
}
/* Save for otherside */
if (otherside_candidate == NOT_USED) {
candidate = loop;
candidate_distance_x = temp_distance_x;
candidate_distance_y = temp_distance_y;
+ startpos_identical = (btn.y == cur.y);
}
}
}
if (temp_distance_x <= candidate_distance_x) {
/* If the button is closer in X axis, consider this to be the closer regardless of Y */
if (temp_distance_x < candidate_distance_x) {
- candidate_distance_y = INT_MAX;
+ /* Only if the xpos were not the same */
+ if (!startpos_identical) {
+ candidate_distance_y = INT_MAX;
+ }
}
temp_distance_y = calculate_distance(btn.y, btn.y + btn.height, cur.y, cur.y + cur.height);
if (temp_distance_y < candidate_distance_y) {
candidate = loop;
candidate_distance_x = temp_distance_x;
candidate_distance_y = temp_distance_y;
+ startpos_identical = (btn.x == cur.x);
}
}
}
if (temp_distance_x <= candidate_distance_x) {
/* If the button is closer in X axis, consider this to be the closer regardless of Y */
if (temp_distance_x < candidate_distance_x) {
- candidate_distance_y = INT_MAX;
+ /* Only if the xpos were not the same */
+ if (!startpos_identical) {
+ candidate_distance_y = INT_MAX;
+ }
}
temp_distance_y = calculate_distance(btn.y, btn.y + btn.height, cur.y, cur.y + cur.height);
if (temp_distance_y < candidate_distance_y) {
candidate = loop;
candidate_distance_x = temp_distance_x;
candidate_distance_y = temp_distance_y;
+ startpos_identical = (btn.x == cur.x);
}
}
}