mirror of
https://github.com/swaywm/sway.git
synced 2025-10-29 05:40:18 -04:00
Simplify swaybar/swaynag scaling code
Use `cairo_scale` to set the scale factor, removing redundant multiplications by `output->scale`.
This commit is contained in:
parent
30c28ff8f7
commit
57ae751655
3 changed files with 124 additions and 128 deletions
|
|
@ -142,13 +142,11 @@ static bool check_bindings(struct swaybar *bar, uint32_t button,
|
|||
|
||||
static bool process_hotspots(struct swaybar_output *output,
|
||||
double x, double y, uint32_t button) {
|
||||
double px = x * output->scale;
|
||||
double py = y * output->scale;
|
||||
struct swaybar_hotspot *hotspot;
|
||||
wl_list_for_each(hotspot, &output->hotspots, link) {
|
||||
if (px >= hotspot->x && py >= hotspot->y
|
||||
&& px < hotspot->x + hotspot->width
|
||||
&& py < hotspot->y + hotspot->height) {
|
||||
if (x >= hotspot->x && y >= hotspot->y
|
||||
&& x < hotspot->x + hotspot->width
|
||||
&& y < hotspot->y + hotspot->height) {
|
||||
if (HOTSPOT_IGNORE == hotspot->callback(output, hotspot, x, y,
|
||||
button, hotspot->data)) {
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue