Skip to content

Commit

Permalink
Fix some issues found by sonarcloud (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
hluk committed Apr 6, 2024
1 parent c74282e commit f48787a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion plugins/itemfakevim/fakevim/fakevimhandler.cpp
Expand Up @@ -7802,7 +7802,7 @@ void FakeVimHandler::Private::surroundCurrentRange(const Input &input, const QSt
newBack += "\n";
else
newBack = "\n" + newBack;
} else if (input.is('(') || input.is('{') || input.is('[') || input.is('[')) {
} else if (input.is('(') || input.is('{') || input.is('[')) {
// Opening characters add an extra space
newFront = newFront + " ";
newBack = " " + newBack;
Expand Down
12 changes: 6 additions & 6 deletions src/platform/x11/x11platformclipboard.cpp
Expand Up @@ -41,14 +41,14 @@ bool isSelectionIncomplete()
return false;

// If mouse button or shift is pressed then assume that user is selecting text.
XEvent event{};
XButtonEvent event{};
XQueryPointer(display, DefaultRootWindow(display),
&event.xbutton.root, &event.xbutton.window,
&event.xbutton.x_root, &event.xbutton.y_root,
&event.xbutton.x, &event.xbutton.y,
&event.xbutton.state);
&event.root, &event.window,
&event.x_root, &event.y_root,
&event.x, &event.y,
&event.state);

return event.xbutton.state & (Button1Mask | ShiftMask);
return event.state & (Button1Mask | ShiftMask);
#else
return true;
#endif
Expand Down
22 changes: 11 additions & 11 deletions src/platform/x11/x11platformwindow.cpp
Expand Up @@ -236,26 +236,26 @@ void X11PlatformWindow::raise()

COPYQ_LOG( QString("Raising window \"%1\"").arg(getTitle()) );

XEvent e{};
XClientMessageEvent e{};
memset(&e, 0, sizeof(e));
e.type = ClientMessage;
e.xclient.display = display;
e.xclient.window = m_window;
e.xclient.message_type = XInternAtom(display, "_NET_ACTIVE_WINDOW", False);
e.xclient.format = 32;
e.xclient.data.l[0] = 2;
e.xclient.data.l[1] = CurrentTime;
e.xclient.data.l[2] = 0;
e.xclient.data.l[3] = 0;
e.xclient.data.l[4] = 0;
e.display = display;
e.window = m_window;
e.message_type = XInternAtom(display, "_NET_ACTIVE_WINDOW", False);
e.format = 32;
e.data.l[0] = 2;
e.data.l[1] = CurrentTime;
e.data.l[2] = 0;
e.data.l[3] = 0;
e.data.l[4] = 0;

XWindowAttributes wattr{};
XGetWindowAttributes(display, m_window, &wattr);

if (wattr.map_state == IsViewable) {
XSendEvent(display, wattr.screen->root, False,
SubstructureNotifyMask | SubstructureRedirectMask,
&e);
reinterpret_cast<XEvent*>(&e));
XSync(display, False);
XRaiseWindow(display, m_window);
XSetInputFocus(display, m_window, RevertToPointerRoot, CurrentTime);
Expand Down

0 comments on commit f48787a

Please sign in to comment.