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