Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Touchscreen: adjust how bar padding is handled

The old way of padding out bars was to just create a bigger touch
region, the intent being to make it easier to touch the end of a
bar. Unfortunately, this didn't even accomplish that, and caused
an annoying offset between the bar graphics and the touch point.

New method is to account for padding explicitly and clamp touches
in the padding region so they are within the proper touch region.

Change-Id: Id39e571fc1b033a4da94f0eb1143a2fc276bab03

+28 -11
+14 -11
apps/gui/skin_engine/skin_parser.c
··· 1148 1148 { 1149 1149 struct touchregion *region = skin_buffer_alloc(sizeof(*region)); 1150 1150 struct skin_token_list *item; 1151 - int wpad, hpad; 1152 1151 1153 1152 if (!region) 1154 1153 return 0; ··· 1163 1162 /* try to add some extra space on either end to make pressing the 1164 1163 * full bar easier. ~5% on either side 1165 1164 */ 1166 - wpad = pb->width * 5 / 100; 1167 - if (wpad > 10) 1168 - wpad = 10; 1169 - hpad = pb->height * 5 / 100; 1170 - if (hpad > 10) 1171 - hpad = 10; 1165 + region->wpad = pb->width * 5 / 100; 1166 + if (region->wpad > 10) 1167 + region->wpad = 10; 1168 + region->hpad = pb->height * 5 / 100; 1169 + if (region->hpad > 10) 1170 + region->hpad = 10; 1172 1171 1173 - region->x = pb->x - wpad; 1172 + region->x = pb->x; 1174 1173 if (region->x < 0) 1175 1174 region->x = 0; 1176 - region->width = pb->width + 2 * wpad; 1175 + region->width = pb->width; 1177 1176 if (region->x + region->width > curr_vp->vp.x + curr_vp->vp.width) 1178 1177 region->width = curr_vp->vp.x + curr_vp->vp.width - region->x; 1179 1178 1180 - region->y = pb->y - hpad; 1179 + region->y = pb->y; 1181 1180 if (region->y < 0) 1182 1181 region->y = 0; 1183 - region->height = pb->height + 2 * hpad; 1182 + region->height = pb->height; 1184 1183 if (region->y + region->height > curr_vp->vp.y + curr_vp->vp.height) 1185 1184 region->height = curr_vp->vp.y + curr_vp->vp.height - region->y; 1186 1185 ··· 1540 1539 1541 1540 /* should probably do some bounds checking here with the viewport... but later */ 1542 1541 region->action = ACTION_NONE; 1542 + 1543 + /* padding is only for bars, user defined regions have no need of it */ 1544 + region->wpad = 0; 1545 + region->hpad = 0; 1543 1546 1544 1547 if (get_param(element, 0)->type == STRING) 1545 1548 {
+12
apps/gui/skin_engine/skin_touchsupport.c
··· 92 92 * are relative to a preceding viewport */ 93 93 vx = x - wvp->vp.x; 94 94 vy = y - wvp->vp.y; 95 + 96 + /* project touches in the padding region so they clamp to the 97 + * edge of the region instead */ 98 + if(r->x - r->wpad <= vx && vx < r->x) 99 + vx = r->x; 100 + else if(r->x + r->width <= vx && vx < r->x + r->width + r->wpad) 101 + vx = r->x + r->width - 1; 102 + if(r->y - r->hpad <= vy && vy < r->y) 103 + vy = r->y; 104 + else if(r->y + r->height <= vy && vy < r->y + r->height + r->hpad) 105 + vy = r->y + r->height - 1; 106 + 95 107 /* now see if the point is inside this region */ 96 108 if (vx >= r->x && vx < r->x+r->width && 97 109 vy >= r->y && vy < r->y+r->height)
+2
apps/gui/skin_engine/wps_internals.h
··· 201 201 short int y; /* y-pos */ 202 202 short int width; /* width */ 203 203 short int height; /* height */ 204 + short int wpad; /* padding to width */ 205 + short int hpad; /* padding to height */ 204 206 bool reverse_bar; /* if true 0% is the left or top */ 205 207 bool allow_while_locked; 206 208 enum {