mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-20 21:08:08 +01:00
XShapeEvent strict aliasing violation
C99 defines new strict aliasing rules to allow compilers to make certain optimizations. These rules prohibit converting an XEvent to an event struct (e.g. XShapeEvent) that is not already in the XEvent union using pointer type punning (e.g. "(XShapeEvent *)&ev"), and vice versa. The canonical fix seems to be to create a union between XEvent and the extension event struct to make the aliasing explicit, so do that.
This commit is contained in:
committed by
Carlos R. Mafra
parent
3be81b0243
commit
bbf3635590
17
src/event.c
17
src/event.c
@@ -1159,16 +1159,17 @@ static void handleShapeNotify(XEvent * event)
|
||||
{
|
||||
XShapeEvent *shev = (XShapeEvent *) event;
|
||||
WWindow *wwin;
|
||||
XEvent ev;
|
||||
union {
|
||||
XEvent xevent;
|
||||
XShapeEvent xshape;
|
||||
} ev;
|
||||
|
||||
while (XCheckTypedWindowEvent(dpy, shev->window, event->type, &ev)) {
|
||||
XShapeEvent *sev = (XShapeEvent *) & ev;
|
||||
|
||||
if (sev->kind == ShapeBounding) {
|
||||
if (sev->shaped == shev->shaped) {
|
||||
*shev = *sev;
|
||||
while (XCheckTypedWindowEvent(dpy, shev->window, event->type, &ev.xevent)) {
|
||||
if (ev.xshape.kind == ShapeBounding) {
|
||||
if (ev.xshape.shaped == shev->shaped) {
|
||||
*shev = ev.xshape;
|
||||
} else {
|
||||
XPutBackEvent(dpy, &ev);
|
||||
XPutBackEvent(dpy, &ev.xevent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user