diff options
| author | Mikael Magnusson <mikachu@gmail.com> | 2009-07-05 14:24:14 +0200 |
|---|---|---|
| committer | Mikael Magnusson <mikachu@gmail.com> | 2009-07-05 14:24:14 +0200 |
| commit | 7351d86443539fd60267baed129601d923e88269 (patch) | |
| tree | 72218e326dd74a33e80ae00897e6c1c1ce8f78fc /openbox | |
| parent | 923a11ea3092a5f7b94beadaa5ffaa6af7ce2a87 (diff) | |
Don't trust xinerama not to return NULL
We check that xinerama is active already, but someone got a NULL here.
Diffstat (limited to 'openbox')
| -rw-r--r-- | openbox/extensions.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/openbox/extensions.c b/openbox/extensions.c index cd188dd0..23d3e0c8 100644 --- a/openbox/extensions.c +++ b/openbox/extensions.c @@ -85,7 +85,11 @@ void extensions_query_all(void) void extensions_xinerama_screens(Rect **xin_areas, guint *nxin) { guint i; - gint l, r, t, b; + gint n, l, r, t, b; +#ifdef XINERAMA + XineramaScreenInfo *info; +#endif + if (ob_debug_xinerama) { gint w = WidthOfScreen(ScreenOfDisplay(ob_display, ob_screen)); gint h = HeightOfScreen(ScreenOfDisplay(ob_display, ob_screen)); @@ -94,12 +98,9 @@ void extensions_xinerama_screens(Rect **xin_areas, guint *nxin) RECT_SET((*xin_areas)[0], 0, 0, w/2, h); RECT_SET((*xin_areas)[1], w/2, 0, w-(w/2), h); } - else #ifdef XINERAMA - if (extensions_xinerama) { - guint i; - gint n; - XineramaScreenInfo *info = XineramaQueryScreens(ob_display, &n); + else if (extensions_xinerama && + (info = XineramaQueryScreens(ob_display, &n))) { *nxin = n; *xin_areas = g_new(Rect, *nxin + 1); for (i = 0; i < *nxin; ++i) @@ -107,8 +108,8 @@ void extensions_xinerama_screens(Rect **xin_areas, guint *nxin) info[i].width, info[i].height); XFree(info); } - else #endif + else { *nxin = 1; *xin_areas = g_new(Rect, *nxin + 1); |
