chore: define only one variable per line

This commit is contained in:
sithlord48
2025-05-19 22:14:18 -04:00
committed by Nick Bolton
parent 0ff72441e6
commit 635962618f
21 changed files with 217 additions and 85 deletions

View File

@ -540,7 +540,8 @@ void ArchMultithreadPosix::startSignalHandler()
{
// set signal mask. the main thread blocks these signals and
// the signal handler thread will listen for them.
sigset_t sigset, oldsigset;
sigset_t sigset;
sigset_t oldsigset;
setSignalSet(&sigset);
pthread_sigmask(SIG_BLOCK, &sigset, &oldsigset);

View File

@ -182,7 +182,8 @@ ServerProxy::EResult ServerProxy::parseHandshakeMessage(const uint8_t *code)
}
else if (memcmp(code, kMsgEIncompatible, 4) == 0) {
int32_t major, minor;
int32_t major;
int32_t minor;
ProtocolUtil::readf(m_stream, kMsgEIncompatible + 4, &major, &minor);
LOG((CLOG_ERR "server has incompatible version %d.%d", major, minor));
m_client->refuseConnection("server has incompatible version");
@ -498,7 +499,8 @@ KeyModifierMask ServerProxy::translateModifierMask(KeyModifierMask mask) const
void ServerProxy::enter()
{
// parse
int16_t x, y;
int16_t x;
int16_t y;
uint16_t mask;
uint32_t seqNum;
ProtocolUtil::readf(m_stream, kMsgCEnter + 4, &x, &y, &seqNum, &mask);
@ -592,7 +594,10 @@ void ServerProxy::keyRepeat()
flushCompressedMouse();
// parse
uint16_t id, mask, count, button;
uint16_t id;
uint16_t mask;
uint16_t count;
uint16_t button;
std::string lang;
ProtocolUtil::readf(m_stream, kMsgDKeyRepeat + 4, &id, &mask, &count, &button, &lang);
LOG(
@ -617,7 +622,9 @@ void ServerProxy::keyUp()
flushCompressedMouse();
// parse
uint16_t id, mask, button;
uint16_t id;
uint16_t mask;
uint16_t button;
ProtocolUtil::readf(m_stream, kMsgDKeyUp + 4, &id, &mask, &button);
LOG((CLOG_DEBUG1 "recv key up id=0x%08x, mask=0x%04x, button=0x%04x", id, mask, button));
@ -663,7 +670,8 @@ void ServerProxy::mouseMove()
{
// parse
bool ignore;
int16_t x, y;
int16_t x;
int16_t y;
ProtocolUtil::readf(m_stream, kMsgDMouseMove + 4, &x, &y);
// note if we should ignore the move
@ -695,7 +703,8 @@ void ServerProxy::mouseRelativeMove()
{
// parse
bool ignore;
int16_t dx, dy;
int16_t dx;
int16_t dy;
ProtocolUtil::readf(m_stream, kMsgDMouseRelMove + 4, &dx, &dy);
// note if we should ignore the move
@ -726,7 +735,8 @@ void ServerProxy::mouseWheel()
flushCompressedMouse();
// parse
int16_t xDelta, yDelta;
int16_t xDelta;
int16_t yDelta;
ProtocolUtil::readf(m_stream, kMsgDMouseWheel + 4, &xDelta, &yDelta);
LOG((CLOG_DEBUG2 "recv mouse wheel %+d,%+d", xDelta, yDelta));

View File

@ -112,8 +112,10 @@ private:
bool m_compressMouse;
bool m_compressMouseRelative;
int32_t m_xMouse, m_yMouse;
int32_t m_dxMouse, m_dyMouse;
int32_t m_xMouse;
int32_t m_yMouse;
int32_t m_dxMouse;
int32_t m_dyMouse;
bool m_ignoreMouse;

View File

@ -774,7 +774,8 @@ bool KeyMap::keysToRestoreModifiers(
ModifierToKeys oldModifiers = activeModifiers;
// get the pressed modifier buttons before and after
ButtonToKeyMap oldKeys, newKeys;
ButtonToKeyMap oldKeys;
ButtonToKeyMap newKeys;
collectButtons(oldModifiers, oldKeys);
collectButtons(desiredModifiers, newKeys);

View File

@ -1097,7 +1097,8 @@ void KeyState::updateModifierKeyState(
)
{
// get the pressed modifier buttons before and after
deskflow::KeyMap::ButtonToKeyMap oldKeys, newKeys;
deskflow::KeyMap::ButtonToKeyMap oldKeys;
deskflow::KeyMap::ButtonToKeyMap newKeys;
for (auto i = oldModifiers.begin(); i != oldModifiers.end(); ++i) {
oldKeys.insert(std::make_pair(i->second.m_button, &i->second));
}
@ -1106,7 +1107,8 @@ void KeyState::updateModifierKeyState(
}
// get the modifier buttons that were pressed or released
deskflow::KeyMap::ButtonToKeyMap pressed, released;
deskflow::KeyMap::ButtonToKeyMap pressed;
deskflow::KeyMap::ButtonToKeyMap released;
std::set_difference(
oldKeys.begin(), oldKeys.end(), newKeys.begin(), newKeys.end(), std::inserter(released, released.end()),
ButtonToKeyLess()

View File

@ -353,13 +353,15 @@ public:
The position of the upper-left corner of the screen. This is
typically 0,0.
*/
int32_t m_x, m_y;
int32_t m_x;
int32_t m_y;
//! Screen size
/*!
The size of the screen in pixels.
*/
int32_t m_w, m_h;
int32_t m_w;
int32_t m_h;
//! Obsolete (jump zone size)
int32_t obsolete1;
@ -368,5 +370,6 @@ public:
/*!
The current location of the mouse cursor.
*/
int32_t m_mx, m_my;
int32_t m_mx;
int32_t m_my;
};

View File

@ -41,7 +41,8 @@ private:
ei *ei_;
IEventQueue *events_;
std::queue<std::pair<bool, uint32_t>> queue_;
int pipe_w_, pipe_r_;
int pipe_w_;
int pipe_r_;
mutable std::mutex mutex_;
};

View File

@ -30,9 +30,11 @@
#include <unistd.h>
#include <vector>
// Values are in pixels
struct ScrollRemainder
{
double x, y; // scroll remainder in pixels
double x;
double y;
};
namespace deskflow {
@ -624,7 +626,8 @@ void EiScreen::on_pointer_scroll_event(ei_event *event)
dx += remainder->x;
dy += remainder->y;
double x, y;
double x;
double y;
double rx = modf(dx, &x);
double ry = modf(dy, &y);

View File

@ -174,7 +174,10 @@ void PortalInputCapture::cb_set_pointer_barriers(GObject *object, GAsyncResult *
for (auto elem = barriers_.begin(); elem != barriers_.end(); elem++) {
if (*elem == it->data) {
int x1, x2, y1, y2;
int x1;
int x2;
int y1;
int y2;
g_object_get(G_OBJECT(*elem), "x1", &x1, "x2", &x2, "y1", &y1, "y2", &y2, nullptr);
@ -271,7 +274,8 @@ void PortalInputCapture::cb_activated(XdpInputCaptureSession *session, std::uint
LOG_DEBUG("portal cb activated, id=%d", activation_id);
if (options) {
gdouble x, y;
gdouble x;
gdouble y;
if (g_variant_lookup(options, "cursor_position", "(dd)", &x, &y)) {
screen_->warpCursor((int)x, (int)y);
} else {
@ -298,13 +302,18 @@ void PortalInputCapture::cb_zones_changed(XdpInputCaptureSession *session, GVari
auto zones = xdp_input_capture_session_get_zones(session);
while (zones != nullptr) {
guint w, h;
gint x, y;
guint w;
guint h;
gint x;
gint y;
g_object_get(zones->data, "width", &w, "height", &h, "x", &x, "y", &y, nullptr);
LOG_DEBUG("input capture zone, %dx%d@%d,%d", w, h, x, y);
int x1, x2, y1, y2;
int x1;
int x2;
int y1;
int y2;
// Hardcoded behaviour: our pointer barriers are always at the edges of
// all zones. Since the implementation is supposed to reject the ones in

View File

@ -119,7 +119,9 @@ std::string XWindowsClipboardAnyBitmapConverter::fromIClipboard(const std::strin
std::string XWindowsClipboardAnyBitmapConverter::toIClipboard(const std::string &image) const
{
// convert to raw BMP data
uint32_t w, h, depth;
uint32_t w;
uint32_t h;
uint32_t depth;
std::string rawBMP = doToIClipboard(image, w, h, depth);
if (rawBMP.empty() || w == 0 || h == 0 || (depth != 24 && depth != 32)) {
return std::string();

View File

@ -156,8 +156,12 @@ bool XWindowsKeyState::fakeCtrlAltDel()
KeyModifierMask XWindowsKeyState::pollActiveModifiers() const
{
Window root = DefaultRootWindow(m_display), window;
int xRoot, yRoot, xWindow, yWindow;
Window root = DefaultRootWindow(m_display);
Window window;
int xRoot;
int yRoot;
int xWindow;
int yWindow;
unsigned int state = 0;
if (XQueryPointer(m_display, root, &root, &window, &xRoot, &yRoot, &xWindow, &yWindow, &state) == False) {
state = 0;
@ -351,7 +355,8 @@ void XWindowsKeyState::updateKeysymMap(deskflow::KeyMap &keyMap)
m_keyCodeFromKey.clear();
// get the number of keycodes
int minKeycode, maxKeycode;
int minKeycode;
int maxKeycode;
XDisplayKeycodes(m_display, &minKeycode, &maxKeycode);
int numKeycodes = maxKeycode - minKeycode + 1;
@ -437,7 +442,8 @@ void XWindowsKeyState::updateKeysymMap(deskflow::KeyMap &keyMap)
// provide one keysym for keys sensitive to caps-lock. if we
// find that then fill in the missing keysym.
if (keysyms[0] != NoSymbol && keysyms[1] == NoSymbol && keysyms[2] == NoSymbol && keysyms[3] == NoSymbol) {
KeySym lKeysym, uKeysym;
KeySym lKeysym;
KeySym uKeysym;
XConvertCase(keysyms[0], &lKeysym, &uKeysym);
if (lKeysym != uKeysym) {
keysyms[0] = lKeysym;
@ -445,7 +451,8 @@ void XWindowsKeyState::updateKeysymMap(deskflow::KeyMap &keyMap)
item.m_sensitive |= KeyModifierCapsLock;
}
} else if (keysyms[0] != NoSymbol && keysyms[1] != NoSymbol) {
KeySym lKeysym, uKeysym;
KeySym lKeysym;
KeySym uKeysym;
XConvertCase(keysyms[0], &lKeysym, &uKeysym);
if (lKeysym != uKeysym && lKeysym == keysyms[0] && uKeysym == keysyms[1]) {
item.m_sensitive |= KeyModifierCapsLock;
@ -527,7 +534,8 @@ void XWindowsKeyState::updateKeysymMap(deskflow::KeyMap &keyMap)
// add other ways to synthesize the key
if ((j & 1) != 0) {
// add capslock version of key is sensitive to capslock
KeySym lKeysym, uKeysym;
KeySym lKeysym;
KeySym uKeysym;
XConvertCase(keysyms[j], &lKeysym, &uKeysym);
if (lKeysym != uKeysym && lKeysym == keysyms[j - 1] && uKeysym == keysyms[j]) {
item.m_required &= ~KeyModifierShift;
@ -726,7 +734,8 @@ void XWindowsKeyState::updateKeysymMapXKB(deskflow::KeyMap &keyMap)
if (type->num_levels == 1) {
// if there are upper- and lowercase versions of the
// keysym then add both.
KeySym lKeysym, uKeysym;
KeySym lKeysym;
KeySym uKeysym;
XConvertCase(keysym, &lKeysym, &uKeysym);
if (lKeysym != uKeysym) {
if (j != -1) {

View File

@ -496,8 +496,12 @@ void XWindowsScreen::getShape(int32_t &x, int32_t &y, int32_t &w, int32_t &h) co
void XWindowsScreen::getCursorPos(int32_t &x, int32_t &y) const
{
Window root, window;
int mx, my, xWindow, yWindow;
Window root;
Window window;
int mx;
int my;
int xWindow;
int yWindow;
unsigned int mask;
if (XQueryPointer(m_display, m_root, &root, &window, &mx, &my, &xWindow, &yWindow, &mask)) {
x = mx;
@ -765,8 +769,12 @@ int32_t XWindowsScreen::getJumpZoneSize() const
bool XWindowsScreen::isAnyMouseButtonDown(uint32_t &buttonID) const
{
// query the pointer to get the button state
Window root, window;
int xRoot, yRoot, xWindow, yWindow;
Window root;
Window window;
int xRoot;
int yRoot;
int xWindow;
int yWindow;
if (unsigned int state;
XQueryPointer(m_display, m_root, &root, &window, &xRoot, &yRoot, &xWindow, &yWindow, &state)) {
return ((state & (Button1Mask | Button2Mask | Button3Mask | Button4Mask | Button5Mask)) != 0);
@ -871,7 +879,9 @@ Display *XWindowsScreen::openDisplay(const char *displayName)
// verify the availability of the XTest extension
if (!m_isPrimary) {
int majorOpcode, firstEvent, firstError;
int majorOpcode;
int firstEvent;
int firstError;
if (!XQueryExtension(display, XTestExtensionName, &majorOpcode, &firstEvent, &firstError)) {
LOG((CLOG_ERR "the XTest extension is not available"));
XCloseDisplay(display);
@ -882,9 +892,11 @@ Display *XWindowsScreen::openDisplay(const char *displayName)
#if HAVE_XKB_EXTENSION
{
m_xkb = false;
int major = XkbMajorVersion, minor = XkbMinorVersion;
int major = XkbMajorVersion;
int minor = XkbMinorVersion;
if (XkbLibraryVersion(&major, &minor)) {
int opcode, firstError;
int opcode;
int firstError;
if (XkbQueryExtension(display, &opcode, &m_xkbEventBase, &firstError, &major, &minor)) {
m_xkb = true;
XkbSelectEvents(display, XkbUseCoreKbd, XkbMapNotifyMask, XkbMapNotifyMask);
@ -1222,7 +1234,8 @@ void XWindowsScreen::handleSystemEvent(const Event &event, void *)
if (XGetEventData(m_display, cookie) && cookie->type == GenericEvent && cookie->extension == xi_opcode) {
if (cookie->evtype == XI_RawMotion) {
// Get current pointer's position
Window root, child;
Window root;
Window child;
XMotionEvent xmotion;
xmotion.type = MotionNotify;
xmotion.send_event = False; // Raw motion
@ -1564,8 +1577,9 @@ void XWindowsScreen::onMouseMove(const XMotionEvent &xmotion)
// pixel) but the latter is a PITA. to work around
// it we only warp when the mouse has moved more
// than s_size pixels from the center.
if (static const int32_t s_size = 32; xmotion.x_root - m_xCenter < -s_size || xmotion.x_root - m_xCenter > s_size ||
xmotion.y_root - m_yCenter < -s_size || xmotion.y_root - m_yCenter > s_size) {
static const int32_t s_size = 32;
if (xmotion.x_root - m_xCenter < -s_size || xmotion.x_root - m_xCenter > s_size ||
xmotion.y_root - m_yCenter < -s_size || xmotion.y_root - m_yCenter > s_size) {
warpCursorNoFlush(m_xCenter, m_yCenter);
}
@ -1586,7 +1600,8 @@ Cursor XWindowsScreen::createBlankCursor() const
// this seems just a bit more complicated than really necessary
// get the closet cursor size to 1x1
unsigned int w = 0, h = 0;
unsigned int w = 0;
unsigned int h = 0;
XQueryBestCursor(m_display, m_root, 1, 1, &w, &h);
w = std::max(1u, w);
h = std::max(1u, h);
@ -1724,7 +1739,9 @@ void XWindowsScreen::doSelectEvents(Window w) const
XSelectInput(m_display, w, mask);
// recurse on child windows
Window rw, pw, *cw;
Window rw;
Window pw;
Window *cw;
unsigned int nc;
if (XQueryTree(m_display, w, &rw, &pw, &cw, &nc)) {
for (unsigned int i = 0; i < nc; ++i) {
@ -1980,7 +1997,8 @@ bool XWindowsScreen::HotKeyItem::operator<(const HotKeyItem &x) const
bool XWindowsScreen::detectXI2()
{
int event, error;
int event;
int error;
return XQueryExtension(m_display, "XInputExtension", &xi_opcode, &event, &error);
}

View File

@ -180,12 +180,16 @@ private:
bool m_isOnScreen;
// screen shape stuff
int32_t m_x, m_y;
int32_t m_w, m_h;
int32_t m_xCenter, m_yCenter;
int32_t m_x;
int32_t m_y;
int32_t m_w;
int32_t m_h;
int32_t m_xCenter;
int32_t m_yCenter;
// last mouse position
int32_t m_xCursor, m_yCursor;
int32_t m_xCursor;
int32_t m_yCursor;
// keyboard stuff
XWindowsKeyState *m_keyState;

View File

@ -70,7 +70,8 @@ XWindowsScreenSaver::XWindowsScreenSaver(Display *display, Window window, void *
// check for DPMS extension. this is an alternative screen saver
// that powers down the display.
#if HAVE_X11_EXTENSIONS_DPMS_H
int eventBase, errorBase;
int eventBase;
int errorBase;
if (DPMSQueryExtension(m_display, &eventBase, &errorBase)) {
if (DPMSCapable(m_display)) {
// we have DPMS
@ -295,7 +296,9 @@ bool XWindowsScreenSaver::findXScreenSaver()
if (m_xscreensaver == None) {
// find top-level window xscreensaver window
Window root = DefaultRootWindow(m_display);
Window rw, pw, *cw;
Window rw;
Window pw;
Window *cw;
unsigned int nc;
if (XQueryTree(m_display, root, &rw, &pw, &cw, &nc)) {
for (unsigned int i = 0; i < nc; ++i) {
@ -405,7 +408,9 @@ void XWindowsScreenSaver::watchForXScreenSaver()
// add every child of the root to the list of windows to watch
Window root = DefaultRootWindow(m_display);
Window rw, pw, *cw;
Window rw;
Window pw;
Window *cw;
if (unsigned int nc; XQueryTree(m_display, root, &rw, &pw, &cw, &nc)) {
for (unsigned int i = 0; i < nc; ++i) {

View File

@ -85,5 +85,6 @@ public:
private:
std::string m_name;
int32_t m_x, m_y;
int32_t m_x;
int32_t m_y;
};

View File

@ -379,7 +379,13 @@ void ClientProxy1_0::setOptions(const OptionsList &options)
bool ClientProxy1_0::recvInfo()
{
// parse the message
int16_t x, y, w, h, dummy1, mx, my;
int16_t x;
int16_t y;
int16_t w;
int16_t h;
int16_t dummy1;
int16_t mx;
int16_t my;
if (!ProtocolUtil::readf(getStream(), kMsgDInfo + 4, &x, &y, &w, &h, &dummy1, &mx, &my)) {
return false;
}

View File

@ -219,7 +219,8 @@ void ClientProxyUnknown::handleData(const Event &, void *)
}
// parse the reply to hello
int16_t major, minor;
int16_t major;
int16_t minor;
if (std::string protocolName; !ProtocolUtil::readf(m_stream, kMsgHelloBack, &protocolName, &major, &minor, &name)) {
throw XBadClient();
}

View File

@ -421,7 +421,8 @@ Config::getNeighbor(const std::string &srcName, EDirection srcSide, float positi
}
// find edge
const CellEdge *srcEdge, *dstEdge;
const CellEdge *srcEdge;
const CellEdge *dstEdge;
if (!index->second.getLink(srcSide, position, srcEdge, dstEdge)) {
// no neighbor
return "";
@ -639,8 +640,10 @@ void Config::readSectionOptions(ConfigReadContext &s)
// values := valueAndArgs[,valueAndArgs]...
// valueAndArgs := <value>[(arg[,...])]
std::string::size_type i = 0;
std::string name, value;
ConfigReadContext::ArgList nameArgs, valueArgs;
std::string name;
std::string value;
ConfigReadContext::ArgList nameArgs;
ConfigReadContext::ArgList valueArgs;
s.parseNameWithArgs("name", line, "=", i, name, nameArgs);
++i;
s.parseNameWithArgs("value", line, ",;\n", i, value, valueArgs);
@ -843,8 +846,12 @@ void Config::readSectionLinks(ConfigReadContext &s)
// in the range [0,100] and start < end. if not given the
// interval is taken to be (0,100).
std::string::size_type i = 0;
std::string side, dstScreen, srcArgString, dstArgString;
ConfigReadContext::ArgList srcArgs, dstArgs;
std::string side;
std::string dstScreen;
std::string srcArgString;
std::string dstArgString;
ConfigReadContext::ArgList srcArgs;
ConfigReadContext::ArgList dstArgs;
s.parseNameWithArgs("link", line, "=", i, side, srcArgs);
++i;
s.parseNameWithArgs("screen", line, "", i, dstScreen, dstArgs);

View File

@ -870,7 +870,8 @@ bool InputFilter::operator==(const InputFilter &x) const
// compare rule lists. the easiest way to do that is to format each
// rule into a string, sort the strings, then compare the results.
std::vector<std::string> aList, bList;
std::vector<std::string> aList;
std::vector<std::string> bList;
for (auto i = m_ruleList.begin(); i != m_ruleList.end(); ++i) {
aList.push_back(i->format());
}

View File

@ -399,7 +399,10 @@ void Server::switchScreen(BaseClientProxy *dst, int32_t x, int32_t y, bool forSc
{
assert(dst != nullptr);
int32_t dx, dy, dw, dh;
int32_t dx;
int32_t dy;
int32_t dw;
int32_t dh;
dst->getShape(dx, dy, dw, dh);
// any of these conditions seem to trigger when the portal permission dialog
@ -515,7 +518,8 @@ void Server::jumpToScreen(BaseClientProxy *newScreen)
m_active->setJumpCursorPos(m_x, m_y);
// get the last cursor position on the target screen
int32_t x, y;
int32_t x;
int32_t y;
newScreen->getJumpCursorPos(x, y);
switchScreen(newScreen, x, y, false);
@ -523,7 +527,10 @@ void Server::jumpToScreen(BaseClientProxy *newScreen)
float Server::mapToFraction(BaseClientProxy *client, EDirection dir, int32_t x, int32_t y) const
{
int32_t sx, sy, sw, sh;
int32_t sx;
int32_t sy;
int32_t sw;
int32_t sh;
client->getShape(sx, sy, sw, sh);
switch (dir) {
case kLeft:
@ -543,7 +550,10 @@ float Server::mapToFraction(BaseClientProxy *client, EDirection dir, int32_t x,
void Server::mapToPixel(BaseClientProxy *client, EDirection dir, float f, int32_t &x, int32_t &y) const
{
int32_t sx, sy, sw, sh;
int32_t sx;
int32_t sy;
int32_t sw;
int32_t sh;
client->getShape(sx, sy, sw, sh);
switch (dir) {
case kLeft:
@ -627,7 +637,10 @@ BaseClientProxy *Server::mapToNeighbor(BaseClientProxy *src, EDirection srcSide,
}
// get the source screen's size
int32_t dx, dy, dw, dh;
int32_t dx;
int32_t dy;
int32_t dw;
int32_t dh;
BaseClientProxy *lastGoodScreen = src;
lastGoodScreen->getShape(dx, dy, dw, dh);
@ -727,7 +740,10 @@ void Server::avoidJumpZone(BaseClientProxy *dst, EDirection dir, int32_t &x, int
}
const std::string dstName(getName(dst));
int32_t dx, dy, dw, dh;
int32_t dx;
int32_t dy;
int32_t dw;
int32_t dh;
dst->getShape(dx, dy, dw, dh);
float t = mapToFraction(dst, dir, x, y);
int32_t z = getJumpZoneSize(dst);
@ -887,7 +903,10 @@ void Server::armSwitchTwoTap(int32_t x, int32_t y)
} else if (!m_switchTwoTapArmed) {
// still time for a double tap. see if we left the tap
// zone and, if so, arm the two tap.
int32_t ax, ay, aw, ah;
int32_t ax;
int32_t ay;
int32_t aw;
int32_t ah;
m_active->getShape(ax, ay, aw, ah);
int32_t tapZone = m_primaryClient->getJumpZoneSize();
if (tapZone < m_switchTwoTapZone) {
@ -967,7 +986,10 @@ uint32_t Server::getCorner(BaseClientProxy *client, int32_t x, int32_t y, int32_
assert(client != nullptr);
// get client screen shape
int32_t ax, ay, aw, ah;
int32_t ax;
int32_t ay;
int32_t aw;
int32_t ah;
client->getShape(ax, ay, aw, ah);
// check for x,y on the left or right
@ -1015,7 +1037,10 @@ void Server::stopRelativeMoves()
{
if (m_relativeMoves && m_active != m_primaryClient) {
// warp to the center of the active client so we know where we are
int32_t ax, ay, aw, ah;
int32_t ax;
int32_t ay;
int32_t aw;
int32_t ah;
m_active->getShape(ax, ay, aw, ah);
m_x = ax + (aw >> 1);
m_y = ay + (ah >> 1);
@ -1138,7 +1163,8 @@ void Server::handleShapeChanged(const Event &, void *vclient)
LOG((CLOG_DEBUG "screen \"%s\" shape changed", getName(client).c_str()));
// update jump coordinate
int32_t x, y;
int32_t x;
int32_t y;
client->getCursorPos(x, y);
client->setJumpCursorPos(x, y);
@ -1336,7 +1362,8 @@ void Server::handleSwitchInDirectionEvent(const Event &event, void *)
auto *info = static_cast<SwitchInDirectionInfo *>(event.getData());
// jump to screen in chosen direction from center of this screen
int32_t x = m_x, y = m_y;
int32_t x = m_x;
int32_t y = m_y;
BaseClientProxy *newScreen = getNeighbor(m_active, info->m_direction, x, y);
if (newScreen == nullptr) {
LOG((CLOG_DEBUG1 "no neighbor %s", Config::dirName(info->m_direction)));
@ -1488,7 +1515,10 @@ void Server::onScreensaver(bool activated)
if (m_activeSaver != nullptr && m_activeSaver != m_primaryClient) {
// check position
BaseClientProxy *screen = m_activeSaver;
int32_t x, y, w, h;
int32_t x;
int32_t y;
int32_t w;
int32_t h;
screen->getShape(x, y, w, h);
int32_t zoneSize = getJumpZoneSize(screen);
if (m_xSaver < x + zoneSize) {
@ -1616,12 +1646,16 @@ bool Server::onMouseMovePrimary(int32_t x, int32_t y)
m_y = y;
// get screen shape
int32_t ax, ay, aw, ah;
int32_t ax;
int32_t ay;
int32_t aw;
int32_t ah;
m_active->getShape(ax, ay, aw, ah);
int32_t zoneSize = getJumpZoneSize(m_active);
// clamp position to screen
int32_t xc = x, yc = y;
int32_t xc = x;
int32_t yc = y;
if (xc < ax + zoneSize) {
xc = ax;
} else if (xc >= ax + aw - zoneSize) {
@ -1637,7 +1671,8 @@ bool Server::onMouseMovePrimary(int32_t x, int32_t y)
// when the cursor is in a corner, there may be a screen either
// horizontally or vertically. check both directions.
EDirection dirh = kNoDirection, dirv = kNoDirection;
int32_t xh = x, yv = y;
int32_t xh = x;
int32_t yv = y;
if (x < ax + zoneSize) {
xh -= zoneSize;
dirh = kLeft;
@ -1660,7 +1695,8 @@ bool Server::onMouseMovePrimary(int32_t x, int32_t y)
// check both horizontally and vertically
EDirection dirs[] = {dirh, dirv};
int32_t xs[] = {xh, x}, ys[] = {y, yv};
int32_t xs[] = {xh, x};
int32_t ys[] = {y, yv};
for (int i = 0; i < 2; ++i) {
EDirection dir = dirs[i];
if (dir == kNoDirection) {
@ -1737,7 +1773,10 @@ void Server::onMouseMoveSecondary(int32_t dx, int32_t dy)
m_y += dy;
// get screen shape
int32_t ax, ay, aw, ah;
int32_t ax;
int32_t ay;
int32_t aw;
int32_t ah;
m_active->getShape(ax, ay, aw, ah);
// find direction of neighbor and get the neighbor
@ -1745,7 +1784,8 @@ void Server::onMouseMoveSecondary(int32_t dx, int32_t dy)
BaseClientProxy *newScreen;
do {
// clamp position to screen
int32_t xc = m_x, yc = m_y;
int32_t xc = m_x;
int32_t yc = m_y;
if (xc < ax) {
xc = ax;
} else if (xc >= ax + aw) {
@ -1886,7 +1926,8 @@ bool Server::addClient(BaseClientProxy *client)
m_clients.insert(std::make_pair(name, client));
// initialize client data
int32_t x, y;
int32_t x;
int32_t y;
client->getCursorPos(x, y);
client->setJumpCursorPos(x, y);

View File

@ -383,14 +383,17 @@ private:
// current mouse position (in absolute screen coordinates) on
// whichever screen is active
int32_t m_x, m_y;
int32_t m_x;
int32_t m_y;
// last mouse deltas. this is needed to smooth out double tap
// on win32 which reports bogus mouse motion at the edge of
// the screen when using low level hooks, synthesizing motion
// in the opposite direction the mouse actually moved.
int32_t m_xDelta, m_yDelta;
int32_t m_xDelta2, m_yDelta2;
int32_t m_xDelta;
int32_t m_yDelta;
int32_t m_xDelta2;
int32_t m_yDelta2;
// current configuration
ServerConfig *m_config;
@ -403,7 +406,8 @@ private:
// state saved when screen saver activates
BaseClientProxy *m_activeSaver;
int32_t m_xSaver, m_ySaver;
int32_t m_xSaver;
int32_t m_ySaver;
// common state for screen switch tests. all tests are always
// trying to reach the same screen in the same direction.
@ -413,7 +417,8 @@ private:
// state for delayed screen switching
double m_switchWaitDelay;
EventQueueTimer *m_switchWaitTimer;
int32_t m_switchWaitX, m_switchWaitY;
int32_t m_switchWaitX;
int32_t m_switchWaitY;
// state for double-tap screen switching
double m_switchTwoTapDelay;