Skip to content

Commit

Permalink
Restore ABI compatibility broken by the previous commit
Browse files Browse the repository at this point in the history
And fix a potentional memory leak.
  • Loading branch information
XRevan86 committed Mar 18, 2016
1 parent be31466 commit 8f8e6ec
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
6 changes: 5 additions & 1 deletion include/compiz-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -2639,7 +2639,8 @@ struct _CompWindow {

CompWindowExtents input;
CompWindowExtents output;
CompWindowExtents clientFrame;
/* was placed below for ABI compat reasons */
/* CompWindowExtents clientFrame; */

CompStruts *struts;

Expand Down Expand Up @@ -2688,6 +2689,9 @@ struct _CompWindow {
/* must be set by addWindowGeometry */
DrawWindowGeometryProc drawWindowGeometry;

/* was placed here and not above for ABI compat reasons */
CompWindowExtents clientFrame;

void *reserved;
};

Expand Down
24 changes: 11 additions & 13 deletions src/window.c
Original file line number Diff line number Diff line change
Expand Up @@ -460,32 +460,30 @@ updateClientFrame (CompWindow *w)
unsigned long n, left;
unsigned char *data;

w->clientFrame.left = 0;
w->clientFrame.right = 0;
w->clientFrame.top = 0;
w->clientFrame.bottom = 0;

result = XGetWindowProperty (w->screen->display->display, w->id,
w->screen->display->frameGtkExtentsAtom,
0L, 65536, False, XA_CARDINAL,
0L, 65536L, False, XA_CARDINAL,
&actual, &format, &n, &left, &data);

if (result == Success && actual == XA_CARDINAL && data)
if (result == Success && data)
{
if (n == 4)
if (n == 4 && actual == XA_CARDINAL)
{
unsigned long *extents = *(unsigned long **) &data;

w->clientFrame.left = extents[0];
w->clientFrame.right = extents[1];
w->clientFrame.top = extents[2];
w->clientFrame.left = extents[0];
w->clientFrame.right = extents[1];
w->clientFrame.top = extents[2];
w->clientFrame.bottom = extents[3];
}

XFree (data);
}
else
{
w->clientFrame.left = 0;
w->clientFrame.right = 0;
w->clientFrame.top = 0;
w->clientFrame.bottom = 0;
}
}

static Window
Expand Down

0 comments on commit 8f8e6ec

Please sign in to comment.