Skip to content

Commit

Permalink
Fix Position not equal operator, add missing cstdint include
Browse files Browse the repository at this point in the history
This fixes cases where one element doesn't match (0, 1) != (0, 0) fails
and thinks it's equal. This notably affected Wayland scrolling, due to
scrolling mostly being vertical and the backend was checking if the axis
wasn't (0, 0)

Change-Id: I44d52ab683a82900c189e07e62c71cd73c7f8a5c
Reviewed-on: https://codereview.kdab.com/c/kdab/kdutils/+/133341
Tested-by: Continuous Integration <build@kdab.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
  • Loading branch information
redstrate committed Nov 8, 2023
1 parent 752d653 commit 83ba0f9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/KDGui/position.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

#pragma once

#include <cstdint>

#include <KDGui/kdgui_global.h>

namespace KDGui {
Expand All @@ -25,7 +27,7 @@ class KDGUI_API Position
: x(_x), y(_y) { }

bool operator==(const Position &other) const { return x == other.x && y == other.y; }
bool operator!=(const Position &other) const { return x != other.x && y != other.y; }
bool operator!=(const Position &other) const { return !(*this == other); }
Position &operator+=(const Position &other)
{
x += other.x;
Expand Down

0 comments on commit 83ba0f9

Please sign in to comment.