Avoid rounding on X11 configure events

As per the comment this is in kwin logical space not X11 space,
therefore results should be floating.
This commit is contained in:
David Edmundson 2022-08-08 13:42:15 +01:00 committed by Vlad Zahorodnii
parent c214801a23
commit 2854d59da4
3 changed files with 16 additions and 16 deletions

View file

@ -448,7 +448,7 @@ bool X11Window::windowEvent(xcb_generic_event_t *e)
motionNotifyEvent(event->event, event->state,
x, y, root_x, root_y);
workspace()->updateFocusMousePosition(QPoint(root_x, root_y));
workspace()->updateFocusMousePosition(QPointF(root_x, root_y));
break;
}
case XCB_ENTER_NOTIFY: {
@ -466,7 +466,7 @@ bool X11Window::windowEvent(xcb_generic_event_t *e)
motionNotifyEvent(event->event, event->state,
x, y, root_x, root_y);
workspace()->updateFocusMousePosition(QPoint(root_x, root_y));
workspace()->updateFocusMousePosition(QPointF(root_x, root_y));
break;
}
case XCB_LEAVE_NOTIFY: {
@ -1176,14 +1176,14 @@ void X11Window::focusOutEvent(xcb_focus_out_event_t *e)
}
// performs _NET_WM_MOVERESIZE
void X11Window::NETMoveResize(int x_root, int y_root, NET::Direction direction)
void X11Window::NETMoveResize(qreal x_root, qreal y_root, NET::Direction direction)
{
if (direction == NET::Move) {
// move cursor to the provided position to prevent the window jumping there on first movement
// the expectation is that the cursor is already at the provided position,
// thus it's more a safety measurement
Cursors::self()->mouse()->setPos(QPoint(x_root, y_root));
performMouseCommand(Options::MouseMove, QPoint(x_root, y_root));
Cursors::self()->mouse()->setPos(QPointF(x_root, y_root));
performMouseCommand(Options::MouseMove, QPointF(x_root, y_root));
} else if (isInteractiveMoveResize() && direction == NET::MoveResizeCancel) {
finishInteractiveMoveResize(true);
setInteractiveMoveResizePointerButtonDown(false);
@ -1205,7 +1205,7 @@ void X11Window::NETMoveResize(int x_root, int y_root, NET::Direction direction)
finishInteractiveMoveResize(false);
}
setInteractiveMoveResizePointerButtonDown(true);
setInteractiveMoveOffset(QPoint(x_root - x(), y_root - y())); // map from global
setInteractiveMoveOffset(QPointF(x_root - x(), y_root - y())); // map from global
setInvertedInteractiveMoveOffset(rect().bottomRight() - interactiveMoveOffset());
setUnrestrictedInteractiveMoveResize(false);
setInteractiveMoveResizeGravity(convert[direction]);

View file

@ -3859,7 +3859,7 @@ const QPointF X11Window::calculateGravitation(bool invert) const
}
// co-ordinate are in kwin logical
void X11Window::configureRequest(int value_mask, int rx, int ry, int rw, int rh, int gravity, bool from_tool)
void X11Window::configureRequest(int value_mask, qreal rx, qreal ry, qreal rw, qreal rh, int gravity, bool from_tool)
{
const int configurePositionMask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y;
const int configureSizeMask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
@ -3966,8 +3966,8 @@ void X11Window::configureRequest(int value_mask, int rx, int ry, int rw, int rh,
}
if (value_mask & configureSizeMask && !(value_mask & configurePositionMask)) { // pure resize
int nw = clientSize().width();
int nh = clientSize().height();
qreal nw = clientSize().width();
qreal nh = clientSize().height();
if (value_mask & XCB_CONFIG_WINDOW_WIDTH) {
nw = rw;
}
@ -3975,7 +3975,7 @@ void X11Window::configureRequest(int value_mask, int rx, int ry, int rw, int rh,
nh = rh;
}
const QSizeF requestedClientSize = constrainClientSize(QSize(nw, nh));
const QSizeF requestedClientSize = constrainClientSize(QSizeF(nw, nh));
QSizeF requestedFrameSize = clientSizeToFrameSize(requestedClientSize);
requestedFrameSize = rules()->checkSize(requestedFrameSize);
@ -4067,7 +4067,7 @@ void X11Window::resizeWithChecks(qreal w, qreal h, xcb_gravity_t gravity)
// _NET_MOVERESIZE_WINDOW
// note co-ordinates are kwin logical
void X11Window::NETMoveResizeWindow(int flags, int x, int y, int width, int height)
void X11Window::NETMoveResizeWindow(int flags, qreal x, qreal y, qreal width, qreal height)
{
int gravity = flags & 0xff;
int value_mask = 0;
@ -4087,7 +4087,7 @@ void X11Window::NETMoveResizeWindow(int flags, int x, int y, int width, int heig
}
// _GTK_SHOW_WINDOW_MENU
void X11Window::GTKShowWindowMenu(int x_root, int y_root)
void X11Window::GTKShowWindowMenu(qreal x_root, qreal y_root)
{
QPoint globalPos(x_root, y_root);
workspace()->showWindowMenu(QRect(globalPos, globalPos), this);

View file

@ -235,9 +235,9 @@ public:
QPointF gravityAdjustment(xcb_gravity_t gravity) const;
const QPointF calculateGravitation(bool invert) const;
void NETMoveResize(int x_root, int y_root, NET::Direction direction);
void NETMoveResizeWindow(int flags, int x, int y, int width, int height);
void GTKShowWindowMenu(int x_root, int y_root);
void NETMoveResize(qreal x_root, qreal y_root, NET::Direction direction);
void NETMoveResizeWindow(int flags, qreal x, qreal y, qreal width, qreal height);
void GTKShowWindowMenu(qreal x_root, qreal y_root);
void restackWindow(xcb_window_t above, int detail, NET::RequestSource source, xcb_timestamp_t timestamp,
bool send_event = false);
@ -402,7 +402,7 @@ private:
bool hasTransientInternal(const X11Window *c, bool indirect, QList<const X11Window *> &set) const;
void setShortcutInternal() override;
void configureRequest(int value_mask, int rx, int ry, int rw, int rh, int gravity, bool from_tool);
void configureRequest(int value_mask, qreal rx, qreal ry, qreal rw, qreal rh, int gravity, bool from_tool);
NETExtendedStrut strut() const;
int checkShadeGeometry(int w, int h);
void getSyncCounter();