format and indent qx11embed_x11 source file

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2020-03-31 10:42:38 +00:00
parent 2dbe488dff
commit bab65cc009

View file

@ -1249,7 +1249,7 @@ bool QX11EmbedContainer::eventFilter(QObject *o, QEvent *event)
{
Q_D(QX11EmbedContainer);
switch (event->type()) {
case QEvent::KeyPress:
case QEvent::KeyPress: {
// Forward any keypresses to our client.
if (o == this && d->client) {
lastKeyEvent.window = d->client;
@ -1257,7 +1257,9 @@ bool QX11EmbedContainer::eventFilter(QObject *o, QEvent *event)
return true;
}
break;
case QEvent::KeyRelease:
}
case QEvent::KeyRelease: {
// Forward any keyreleases to our client.
if (o == this && d->client) {
lastKeyEvent.window = d->client;
@ -1265,8 +1267,9 @@ bool QX11EmbedContainer::eventFilter(QObject *o, QEvent *event)
return true;
}
break;
}
case QEvent::WindowActivate:
case QEvent::WindowActivate: {
// When our container window is activated, we pass the
// activation message on to our client. Note that X input
// focus is set to our focus proxy. We want to intercept all
@ -1283,7 +1286,9 @@ bool QX11EmbedContainer::eventFilter(QObject *o, QEvent *event)
d->moveInputToProxy();
}
break;
case QEvent::WindowDeactivate:
}
case QEvent::WindowDeactivate: {
// When our container window is deactivated, we pass the
// deactivation message to our client.
if (o == window() && d->client) {
@ -1293,7 +1298,9 @@ bool QX11EmbedContainer::eventFilter(QObject *o, QEvent *event)
d->checkGrab();
}
break;
case QEvent::FocusIn:
}
case QEvent::FocusIn: {
// When receiving FocusIn events generated by Tab or Backtab,
// we pass focus on to our client. Any mouse activity is sent
// directly to the client, and it will ask us for focus with
@ -1323,8 +1330,9 @@ bool QX11EmbedContainer::eventFilter(QObject *o, QEvent *event)
XSetInputFocus(x11Info().display(), d->client, RevertToParent, x11Time());
}
}
break;
}
case QEvent::FocusOut: {
// When receiving a FocusOut, we ask our client to remove its
// focus.
@ -1343,8 +1351,8 @@ bool QX11EmbedContainer::eventFilter(QObject *o, QEvent *event)
d->checkGrab();
}
}
}
break;
}
case QEvent::Close: {
if (o == this && d->client) {
@ -1374,7 +1382,9 @@ bool QX11EmbedContainer::eventFilter(QObject *o, QEvent *event)
emit clientClosed();
}
break;
}
default:
break;
}
@ -1391,14 +1401,16 @@ bool QX11EmbedContainer::x11Event(XEvent *event)
Q_D(QX11EmbedContainer);
switch (event->type) {
case CreateNotify:
case CreateNotify: {
// The client created an embedded window.
if (d->client)
d->rejectClient(event->xcreatewindow.window);
else
d->acceptClient(event->xcreatewindow.window);
break;
case DestroyNotify:
}
case DestroyNotify: {
if (event->xdestroywindow.window == d->client) {
// The client died.
d->client = 0;
@ -1410,7 +1422,9 @@ bool QX11EmbedContainer::x11Event(XEvent *event)
emit clientClosed();
}
break;
case ReparentNotify:
}
case ReparentNotify: {
// The client sends us this if it reparents itself out of our
// widget.
if (event->xreparent.window == d->client && event->xreparent.parent != internalWinId()) {
@ -1429,6 +1443,8 @@ bool QX11EmbedContainer::x11Event(XEvent *event)
d->acceptClient(event->xreparent.window);
}
break;
}
case ClientMessage: {
if (event->xclient.message_type == ATOM(_XEMBED)) {
// Ignore XEMBED messages not to ourselves
@ -1471,10 +1487,10 @@ bool QX11EmbedContainer::x11Event(XEvent *event)
// originator of the XEMBED_REQUEST_FOCUS message.
sendXEmbedMessage(d->client, x11Info().display(), XEMBED_FOCUS_IN, XEMBED_FOCUS_CURRENT);
}
break;
}
case XEMBED_FOCUS_NEXT:
case XEMBED_FOCUS_NEXT: {
// Client sends this event when it received a tab
// forward and was at the end of its focus chain. If
// we are the only widget in the focus chain, we send
@ -1485,9 +1501,10 @@ bool QX11EmbedContainer::x11Event(XEvent *event)
QFocusEvent event(QEvent::FocusIn, Qt::TabFocusReason);
qApp->sendEvent(this, &event);
}
break;
case XEMBED_FOCUS_PREV:
}
case XEMBED_FOCUS_PREV: {
// Client sends this event when it received a backtab
// and was at the start of its focus chain. If we are
// the only widget in the focus chain, we send
@ -1498,25 +1515,31 @@ bool QX11EmbedContainer::x11Event(XEvent *event)
QFocusEvent event(QEvent::FocusIn, Qt::BacktabFocusReason);
qApp->sendEvent(this, &event);
}
break;
}
default:
break;
}
}
}
break;
case XButtonPress:
}
case XButtonPress: {
if (!d->clientIsXEmbed) {
setFocus(Qt::MouseFocusReason);
XAllowEvents(x11Info().display(), ReplayPointer, CurrentTime);
return true;
}
break;
case XButtonRelease:
}
case XButtonRelease: {
if (!d->clientIsXEmbed)
XAllowEvents(x11Info().display(), SyncPointer, CurrentTime);
break;
}
default:
break;
}