+2013-05-07 Paul Eggert <eggert@cs.ucla.edu>
+
+ Static checking by GCC 4.8.0.
+ * xfns.c (x_get_net_workarea, struct MonitorInfo, free_monitors)
+ (x_get_monitor_for_frame, x_make_monitor_attribute_list)
+ (x_get_monitor_attributes_fallback)
+ (x_get_monitor_attributes_xinerama)
+ (x_get_monitor_attributes_xrandr, x_get_monitor_attributes):
+ Define only if USE_GTK.
+ (free_monitors): Define only if HAVE_XINERAMA || HAVE_XRANDR.
+ (x_get_monitor_attributes_fallback): Omit unused locals.
+ (x_get_monitor_attributes_xinerama, Fx_display_monitor_attributes_list):
+ Use double, not float, to avoid mixed-mode floating point arithmetic.
+
2013-05-07 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Jan Djärv <jan.h.d@swipnet.se>
Return false if and only if the workarea information cannot be
obtained via the _NET_WORKAREA root window property. */
+#ifndef USE_GTK
+
static bool
x_get_net_workarea (struct x_display_info *dpyinfo, XRectangle *rect)
{
char *name;
};
+#if defined HAVE_XINERAMA || defined HAVE_XRANDR
static void
free_monitors (struct MonitorInfo *monitors, int n_monitors)
{
xfree (monitors[i].name);
xfree (monitors);
}
+#endif /* HAVE_XINERAMA || HAVE_XRANDR */
/* Return monitor number where F is "most" or closest to. */
if (x_intersect_rectangles (&mi->geom, &frect, &res))
{
a = res.width * res.height;
- if (a > area) {
- area = a;
- best_area = i;
- }
+ if (a > area)
+ {
+ area = a;
+ best_area = i;
+ }
}
if (a == 0 && area == 0)
x_get_monitor_attributes_fallback (struct x_display_info *dpyinfo)
{
struct MonitorInfo monitor;
- int width_mm, height_mm;
XRectangle workarea_r;
/* Fallback: treat (possibly) multiple physical monitors as if they
Display *dpy = dpyinfo->display;
XineramaScreenInfo *info = XineramaQueryScreens (dpy, &n_monitors);
struct MonitorInfo *monitors;
- float mm_width_per_pixel, mm_height_per_pixel;
+ double mm_width_per_pixel, mm_height_per_pixel;
if (! info || n_monitors == 0)
{
return attributes_list;
}
- mm_width_per_pixel = ((float) WidthMMOfScreen (dpyinfo->screen)
+ mm_width_per_pixel = ((double) WidthMMOfScreen (dpyinfo->screen)
/ x_display_pixel_width (dpyinfo));
- mm_height_per_pixel = ((float) HeightMMOfScreen (dpyinfo->screen)
+ mm_height_per_pixel = ((double) HeightMMOfScreen (dpyinfo->screen)
/ x_display_pixel_height (dpyinfo));
monitors = (struct MonitorInfo *) xzalloc (n_monitors * sizeof (*monitors));
for (i = 0; i < n_monitors; ++i)
return attributes_list;
}
+#endif /* !USE_GTK */
+
DEFUN ("x-display-monitor-attributes-list", Fx_display_monitor_attributes_list,
Sx_display_monitor_attributes_list,
0, 1, 0,
Lisp_Object attributes_list = Qnil;
#ifdef USE_GTK
- float mm_width_per_pixel, mm_height_per_pixel;
+ double mm_width_per_pixel, mm_height_per_pixel;
GdkDisplay *gdpy;
GdkScreen *gscreen;
gint primary_monitor = 0, n_monitors, i;
static const char *source = "Gdk";
block_input ();
- mm_width_per_pixel = ((float) WidthMMOfScreen (dpyinfo->screen)
+ mm_width_per_pixel = ((double) WidthMMOfScreen (dpyinfo->screen)
/ x_display_pixel_width (dpyinfo));
- mm_height_per_pixel = ((float) HeightMMOfScreen (dpyinfo->screen)
+ mm_height_per_pixel = ((double) HeightMMOfScreen (dpyinfo->screen)
/ x_display_pixel_height (dpyinfo));
gdpy = gdk_x11_lookup_xdisplay (dpyinfo->display);
gscreen = gdk_display_get_default_screen (gdpy);