aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2013-05-25 13:14:38 +0200
committerJan Djärv2013-05-25 13:14:38 +0200
commit6799bb2634354c06b863be027971eac0cdb04283 (patch)
treeea4ab4079d962da9fdd6006bee949b043c728242 /src
parentc80de4562df771ff3f35db7ad9026604d0830114 (diff)
downloademacs-6799bb2634354c06b863be027971eac0cdb04283.tar.gz
emacs-6799bb2634354c06b863be027971eac0cdb04283.zip
Factor out common code for multimonitors, for Gtk+, non-Gtk+ X11 and NS.
* frame.c (Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource): New Lisp_Object:s. (free_monitors, make_monitor_attribute_list): New functions. (syms_of_frame): DEFSYM Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource. * frame.h (Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource): Declare. (struct MonitorInfo): New struct. (free_monitors, make_monitor_attribute_list): Declare. * nsfns.m (Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource): Remove. (struct MonitorInfo, free_monitors): Remove. (ns_screen_name): Make static. (ns_make_monitor_attribute_list): Call make_monitor_attribute_list. (syms_of_nsfns): Remove DEFSYM for Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource. * xfns.c (Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource): Remove. (struct MonitorInfo, free_monitors): Remove. (x_make_monitor_attribute_list): Call make_monitor_attribute_list. (Fx_display_monitor_attributes_list): Call make_monitor_attribute_list. (syms_of_xfns): Remove DEFSYM for Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog26
-rw-r--r--src/frame.c76
-rw-r--r--src/frame.h24
-rw-r--r--src/nsfns.m63
-rw-r--r--src/xfns.c137
5 files changed, 163 insertions, 163 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index acbbfb0a50c..5bcdb7ed068 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,29 @@
12013-05-25 Jan Djärv <jan.h.d@swipnet.se>
2
3 * xfns.c (Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource): Remove.
4 (struct MonitorInfo, free_monitors): Remove.
5 (x_make_monitor_attribute_list): Call make_monitor_attribute_list.
6 (Fx_display_monitor_attributes_list): Call make_monitor_attribute_list.
7 (syms_of_xfns): Remove DEFSYM for Qgeometry, Qworkarea, Qmm_size,
8 Qframes, Qsource.
9
10 * nsfns.m (Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource): Remove.
11 (struct MonitorInfo, free_monitors): Remove.
12 (ns_screen_name): Make static.
13 (ns_make_monitor_attribute_list): Call make_monitor_attribute_list.
14 (syms_of_nsfns): Remove DEFSYM for Qgeometry, Qworkarea, Qmm_size,
15 Qframes, Qsource.
16
17 * frame.h (Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource): Declare.
18 (struct MonitorInfo): New struct.
19 (free_monitors, make_monitor_attribute_list): Declare.
20
21 * frame.c (Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource): New
22 Lisp_Object:s.
23 (free_monitors, make_monitor_attribute_list): New functions.
24 (syms_of_frame): DEFSYM Qgeometry, Qworkarea, Qmm_size, Qframes,
25 Qsource.
26
12013-05-25 Xue Fuqiao <xfq.free@gmail.com> 272013-05-25 Xue Fuqiao <xfq.free@gmail.com>
2 28
3 * callproc.c (call_process): Refine the doc string. (Bug#14045) 29 * callproc.c (call_process): Refine the doc string. (Bug#14045)
diff --git a/src/frame.c b/src/frame.c
index ccd50122f50..e88432b9802 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -76,7 +76,6 @@ Lisp_Object Qterminal_live_p;
76Lisp_Object Qauto_raise, Qauto_lower; 76Lisp_Object Qauto_raise, Qauto_lower;
77Lisp_Object Qborder_color, Qborder_width; 77Lisp_Object Qborder_color, Qborder_width;
78Lisp_Object Qcursor_color, Qcursor_type; 78Lisp_Object Qcursor_color, Qcursor_type;
79static Lisp_Object Qgeometry; /* Not used */
80Lisp_Object Qheight, Qwidth; 79Lisp_Object Qheight, Qwidth;
81Lisp_Object Qleft, Qright; 80Lisp_Object Qleft, Qright;
82Lisp_Object Qicon_left, Qicon_top, Qicon_type, Qicon_name; 81Lisp_Object Qicon_left, Qicon_top, Qicon_type, Qicon_name;
@@ -115,6 +114,8 @@ Lisp_Object Qface_set_after_frame_default;
115 114
116static Lisp_Object Qdelete_frame_functions; 115static Lisp_Object Qdelete_frame_functions;
117 116
117Lisp_Object Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource;
118
118#ifdef HAVE_WINDOW_SYSTEM 119#ifdef HAVE_WINDOW_SYSTEM
119static void x_report_frame_params (struct frame *, Lisp_Object *); 120static void x_report_frame_params (struct frame *, Lisp_Object *);
120#endif 121#endif
@@ -4129,6 +4130,73 @@ selected frame. This is useful when `make-pointer-invisible' is set. */)
4129 return decode_any_frame (frame)->pointer_invisible ? Qnil : Qt; 4130 return decode_any_frame (frame)->pointer_invisible ? Qnil : Qt;
4130} 4131}
4131 4132
4133
4134
4135/***********************************************************************
4136 Multimonitor data
4137 ***********************************************************************/
4138
4139#ifdef HAVE_WINDOW_SYSTEM
4140
4141void
4142free_monitors (struct MonitorInfo *monitors, int n_monitors)
4143{
4144 int i;
4145 for (i = 0; i < n_monitors; ++i)
4146 xfree (monitors[i].name);
4147 xfree (monitors);
4148}
4149
4150Lisp_Object
4151make_monitor_attribute_list (struct MonitorInfo *monitors,
4152 int n_monitors,
4153 int primary_monitor,
4154 Lisp_Object monitor_frames,
4155 const char *source)
4156{
4157 Lisp_Object attributes_list = Qnil;
4158 Lisp_Object primary_monitor_attributes = Qnil;
4159 int i;
4160
4161 for (i = 0; i < n_monitors; ++i)
4162 {
4163 Lisp_Object geometry, workarea, attributes = Qnil;
4164 struct MonitorInfo *mi = &monitors[i];
4165
4166 if (mi->geom.width == 0) continue;
4167
4168 workarea = list4i (mi->work.x, mi->work.y,
4169 mi->work.width, mi->work.height);
4170 geometry = list4i (mi->geom.x, mi->geom.y,
4171 mi->geom.width, mi->geom.height);
4172 attributes = Fcons (Fcons (Qsource,
4173 make_string (source, strlen (source))),
4174 attributes);
4175 attributes = Fcons (Fcons (Qframes, AREF (monitor_frames, i)),
4176 attributes);
4177 attributes = Fcons (Fcons (Qmm_size,
4178 list2i (mi->mm_width, mi->mm_height)),
4179 attributes);
4180 attributes = Fcons (Fcons (Qworkarea, workarea), attributes);
4181 attributes = Fcons (Fcons (Qgeometry, geometry), attributes);
4182 if (mi->name)
4183 attributes = Fcons (Fcons (Qname, make_string (mi->name,
4184 strlen (mi->name))),
4185 attributes);
4186
4187 if (i == primary_monitor)
4188 primary_monitor_attributes = attributes;
4189 else
4190 attributes_list = Fcons (attributes, attributes_list);
4191 }
4192
4193 if (!NILP (primary_monitor_attributes))
4194 attributes_list = Fcons (primary_monitor_attributes, attributes_list);
4195 return attributes_list;
4196}
4197
4198#endif /* HAVE_WINDOW_SYSTEM */
4199
4132 4200
4133/*********************************************************************** 4201/***********************************************************************
4134 Initialization 4202 Initialization
@@ -4187,6 +4255,12 @@ syms_of_frame (void)
4187 DEFSYM (Qterminal, "terminal"); 4255 DEFSYM (Qterminal, "terminal");
4188 DEFSYM (Qterminal_live_p, "terminal-live-p"); 4256 DEFSYM (Qterminal_live_p, "terminal-live-p");
4189 4257
4258 DEFSYM (Qgeometry, "geometry");
4259 DEFSYM (Qworkarea, "workarea");
4260 DEFSYM (Qmm_size, "mm-size");
4261 DEFSYM (Qframes, "frames");
4262 DEFSYM (Qsource, "source");
4263
4190#ifdef HAVE_NS 4264#ifdef HAVE_NS
4191 DEFSYM (Qns_parse_geometry, "ns-parse-geometry"); 4265 DEFSYM (Qns_parse_geometry, "ns-parse-geometry");
4192#endif 4266#endif
diff --git a/src/frame.h b/src/frame.h
index fc0a1dc828b..12aa48b2d92 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -1198,6 +1198,8 @@ extern Lisp_Object Qdisplay;
1198 1198
1199extern Lisp_Object Qrun_hook_with_args; 1199extern Lisp_Object Qrun_hook_with_args;
1200 1200
1201extern Lisp_Object Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource;
1202
1201#ifdef HAVE_WINDOW_SYSTEM 1203#ifdef HAVE_WINDOW_SYSTEM
1202 1204
1203/* The class of this X application. */ 1205/* The class of this X application. */
@@ -1288,6 +1290,28 @@ extern void x_query_colors (struct frame *f, XColor *, int);
1288extern void x_query_color (struct frame *f, XColor *); 1290extern void x_query_color (struct frame *f, XColor *);
1289 1291
1290#endif /* HAVE_WINDOW_SYSTEM */ 1292#endif /* HAVE_WINDOW_SYSTEM */
1293
1294/***********************************************************************
1295 Multimonitor data
1296 ***********************************************************************/
1297
1298#ifdef HAVE_WINDOW_SYSTEM
1299
1300struct MonitorInfo {
1301 XRectangle geom, work;
1302 int mm_width, mm_height;
1303 char *name;
1304};
1305
1306extern void free_monitors (struct MonitorInfo *monitors, int n_monitors);
1307extern Lisp_Object make_monitor_attribute_list (struct MonitorInfo *monitors,
1308 int n_monitors,
1309 int primary_monitor,
1310 Lisp_Object monitor_frames,
1311 const char *source);
1312
1313#endif /* HAVE_WINDOW_SYSTEM */
1314
1291 1315
1292INLINE_HEADER_END 1316INLINE_HEADER_END
1293 1317
diff --git a/src/nsfns.m b/src/nsfns.m
index 7643c8b6e1d..1170472573e 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -105,7 +105,6 @@ static int as_status;
105static ptrdiff_t image_cache_refcount; 105static ptrdiff_t image_cache_refcount;
106#endif 106#endif
107 107
108static Lisp_Object Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource;
109 108
110/* ========================================================================== 109/* ==========================================================================
111 110
@@ -2328,27 +2327,12 @@ each physical monitor, use `display-monitor-attributes-list'. */)
2328 return make_number (x_display_pixel_height (dpyinfo)); 2327 return make_number (x_display_pixel_height (dpyinfo));
2329} 2328}
2330 2329
2331struct MonitorInfo {
2332 XRectangle geom, work;
2333 int mm_width, mm_height;
2334 char *name;
2335};
2336
2337static void
2338free_monitors (struct MonitorInfo *monitors, int n_monitors)
2339{
2340 int i;
2341 for (i = 0; i < n_monitors; ++i)
2342 xfree (monitors[i].name);
2343 xfree (monitors);
2344}
2345
2346#ifdef NS_IMPL_COCOA 2330#ifdef NS_IMPL_COCOA
2347/* Returns the name for the screen that DICT came from, or NULL. 2331/* Returns the name for the screen that DICT came from, or NULL.
2348 Caller must free return value. 2332 Caller must free return value.
2349*/ 2333*/
2350 2334
2351char * 2335static char *
2352ns_screen_name (CGDirectDisplayID did) 2336ns_screen_name (CGDirectDisplayID did)
2353{ 2337{
2354 char *name = NULL; 2338 char *name = NULL;
@@ -2377,8 +2361,7 @@ ns_make_monitor_attribute_list (struct MonitorInfo *monitors,
2377 const char *source) 2361 const char *source)
2378{ 2362{
2379 Lisp_Object monitor_frames = Fmake_vector (make_number (n_monitors), Qnil); 2363 Lisp_Object monitor_frames = Fmake_vector (make_number (n_monitors), Qnil);
2380 Lisp_Object frame, rest, attributes_list = Qnil; 2364 Lisp_Object frame, rest;
2381 Lisp_Object primary_monitor_attributes = Qnil;
2382 NSArray *screens = [NSScreen screens]; 2365 NSArray *screens = [NSScreen screens];
2383 int i; 2366 int i;
2384 2367
@@ -2404,41 +2387,8 @@ ns_make_monitor_attribute_list (struct MonitorInfo *monitors,
2404 } 2387 }
2405 } 2388 }
2406 2389
2407 for (i = 0; i < n_monitors; ++i) 2390 return make_monitor_attribute_list (monitors, n_monitors, primary_monitor,
2408 { 2391 monitor_frames, source);
2409 Lisp_Object geometry, workarea, attributes = Qnil;
2410 struct MonitorInfo *mi = &monitors[i];
2411
2412 if (mi->geom.width == 0) continue;
2413
2414 workarea = list4i (mi->work.x, mi->work.y,
2415 mi->work.width, mi->work.height);
2416 geometry = list4i (mi->geom.x, mi->geom.y,
2417 mi->geom.width, mi->geom.height);
2418 attributes = Fcons (Fcons (Qsource,
2419 make_string (source, strlen (source))),
2420 attributes);
2421 attributes = Fcons (Fcons (Qframes, AREF (monitor_frames, i)),
2422 attributes);
2423 attributes = Fcons (Fcons (Qmm_size,
2424 list2i (mi->mm_width, mi->mm_height)),
2425 attributes);
2426 attributes = Fcons (Fcons (Qworkarea, workarea), attributes);
2427 attributes = Fcons (Fcons (Qgeometry, geometry), attributes);
2428 if (mi->name)
2429 attributes = Fcons (Fcons (Qname, make_string (mi->name,
2430 strlen (mi->name))),
2431 attributes);
2432
2433 if (i == primary_monitor)
2434 primary_monitor_attributes = attributes;
2435 else
2436 attributes_list = Fcons (attributes, attributes_list);
2437 }
2438
2439 if (!NILP (primary_monitor_attributes))
2440 attributes_list = Fcons (primary_monitor_attributes, attributes_list);
2441 return attributes_list;
2442} 2392}
2443 2393
2444DEFUN ("ns-display-monitor-attributes-list", 2394DEFUN ("ns-display-monitor-attributes-list",
@@ -2922,11 +2872,6 @@ handlePanelKeys (NSSavePanel *panel, NSEvent *theEvent)
2922void 2872void
2923syms_of_nsfns (void) 2873syms_of_nsfns (void)
2924{ 2874{
2925 DEFSYM (Qgeometry, "geometry");
2926 DEFSYM (Qworkarea, "workarea");
2927 DEFSYM (Qmm_size, "mm-size");
2928 DEFSYM (Qframes, "frames");
2929 DEFSYM (Qsource, "source");
2930 Qfontsize = intern_c_string ("fontsize"); 2875 Qfontsize = intern_c_string ("fontsize");
2931 staticpro (&Qfontsize); 2876 staticpro (&Qfontsize);
2932 2877
diff --git a/src/xfns.c b/src/xfns.c
index af29c5bdc3f..a1c709a6c26 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -133,7 +133,6 @@ extern LWLIB_ID widget_id_tick;
133static Lisp_Object Qsuppress_icon; 133static Lisp_Object Qsuppress_icon;
134static Lisp_Object Qundefined_color; 134static Lisp_Object Qundefined_color;
135static Lisp_Object Qcompound_text, Qcancel_timer; 135static Lisp_Object Qcompound_text, Qcancel_timer;
136static Lisp_Object Qgeometry, Qworkarea, Qmm_size, Qframes, Qsource;
137Lisp_Object Qfont_param; 136Lisp_Object Qfont_param;
138 137
139#ifdef GLYPH_DEBUG 138#ifdef GLYPH_DEBUG
@@ -3882,24 +3881,6 @@ x_get_net_workarea (struct x_display_info *dpyinfo, XRectangle *rect)
3882 3881
3883#ifndef USE_GTK 3882#ifndef USE_GTK
3884 3883
3885struct MonitorInfo {
3886 XRectangle geom, work;
3887 int mm_width, mm_height;
3888 char *name;
3889};
3890
3891#if defined HAVE_XINERAMA || defined HAVE_XRANDR
3892static void
3893free_monitors (struct MonitorInfo *monitors, int n_monitors)
3894{
3895 int i;
3896 for (i = 0; i < n_monitors; ++i)
3897 xfree (monitors[i].name);
3898 xfree (monitors);
3899}
3900#endif /* HAVE_XINERAMA || HAVE_XRANDR */
3901
3902
3903/* Return monitor number where F is "most" or closest to. */ 3884/* Return monitor number where F is "most" or closest to. */
3904static int 3885static int
3905x_get_monitor_for_frame (struct frame *f, 3886x_get_monitor_for_frame (struct frame *f,
@@ -3971,9 +3952,7 @@ x_make_monitor_attribute_list (struct MonitorInfo *monitors,
3971 const char *source) 3952 const char *source)
3972{ 3953{
3973 Lisp_Object monitor_frames = Fmake_vector (make_number (n_monitors), Qnil); 3954 Lisp_Object monitor_frames = Fmake_vector (make_number (n_monitors), Qnil);
3974 Lisp_Object frame, rest, attributes_list = Qnil; 3955 Lisp_Object frame, rest;
3975 Lisp_Object primary_monitor_attributes = Qnil;
3976 int i;
3977 3956
3978 FOR_EACH_FRAME (rest, frame) 3957 FOR_EACH_FRAME (rest, frame)
3979 { 3958 {
@@ -3982,46 +3961,13 @@ x_make_monitor_attribute_list (struct MonitorInfo *monitors,
3982 if (FRAME_X_P (f) && FRAME_X_DISPLAY_INFO (f) == dpyinfo 3961 if (FRAME_X_P (f) && FRAME_X_DISPLAY_INFO (f) == dpyinfo
3983 && !EQ (frame, tip_frame)) 3962 && !EQ (frame, tip_frame))
3984 { 3963 {
3985 i = x_get_monitor_for_frame (f, monitors, n_monitors); 3964 int i = x_get_monitor_for_frame (f, monitors, n_monitors);
3986 ASET (monitor_frames, i, Fcons (frame, AREF (monitor_frames, i))); 3965 ASET (monitor_frames, i, Fcons (frame, AREF (monitor_frames, i)));
3987 } 3966 }
3988 } 3967 }
3989 3968
3990 for (i = 0; i < n_monitors; ++i) 3969 return make_monitor_attribute_list (monitors, n_monitors, primary_monitor,
3991 { 3970 monitor_frames, source);
3992 Lisp_Object geometry, workarea, attributes = Qnil;
3993 struct MonitorInfo *mi = &monitors[i];
3994
3995 if (mi->geom.width == 0) continue;
3996
3997 workarea = list4i (mi->work.x, mi->work.y,
3998 mi->work.width, mi->work.height);
3999 geometry = list4i (mi->geom.x, mi->geom.y,
4000 mi->geom.width, mi->geom.height);
4001 attributes = Fcons (Fcons (Qsource,
4002 make_string (source, strlen (source))),
4003 attributes);
4004 attributes = Fcons (Fcons (Qframes, AREF (monitor_frames, i)),
4005 attributes);
4006 attributes = Fcons (Fcons (Qmm_size,
4007 list2i (mi->mm_width, mi->mm_height)),
4008 attributes);
4009 attributes = Fcons (Fcons (Qworkarea, workarea), attributes);
4010 attributes = Fcons (Fcons (Qgeometry, geometry), attributes);
4011 if (mi->name)
4012 attributes = Fcons (Fcons (Qname, make_string (mi->name,
4013 strlen (mi->name))),
4014 attributes);
4015
4016 if (i == primary_monitor)
4017 primary_monitor_attributes = attributes;
4018 else
4019 attributes_list = Fcons (attributes, attributes_list);
4020 }
4021
4022 if (!NILP (primary_monitor_attributes))
4023 attributes_list = Fcons (primary_monitor_attributes, attributes_list);
4024 return attributes_list;
4025} 3971}
4026 3972
4027static Lisp_Object 3973static Lisp_Object
@@ -4270,9 +4216,9 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
4270 GdkDisplay *gdpy; 4216 GdkDisplay *gdpy;
4271 GdkScreen *gscreen; 4217 GdkScreen *gscreen;
4272 gint primary_monitor = 0, n_monitors, i; 4218 gint primary_monitor = 0, n_monitors, i;
4273 Lisp_Object primary_monitor_attributes = Qnil;
4274 Lisp_Object monitor_frames, rest, frame; 4219 Lisp_Object monitor_frames, rest, frame;
4275 static const char *source = "Gdk"; 4220 static const char *source = "Gdk";
4221 struct MonitorInfo *monitors;
4276 4222
4277 block_input (); 4223 block_input ();
4278 mm_width_per_pixel = ((double) WidthMMOfScreen (dpyinfo->screen) 4224 mm_width_per_pixel = ((double) WidthMMOfScreen (dpyinfo->screen)
@@ -4286,6 +4232,8 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
4286#endif 4232#endif
4287 n_monitors = gdk_screen_get_n_monitors (gscreen); 4233 n_monitors = gdk_screen_get_n_monitors (gscreen);
4288 monitor_frames = Fmake_vector (make_number (n_monitors), Qnil); 4234 monitor_frames = Fmake_vector (make_number (n_monitors), Qnil);
4235 monitors = (struct MonitorInfo *) xzalloc (n_monitors * sizeof (*monitors));
4236
4289 FOR_EACH_FRAME (rest, frame) 4237 FOR_EACH_FRAME (rest, frame)
4290 { 4238 {
4291 struct frame *f = XFRAME (frame); 4239 struct frame *f = XFRAME (frame);
@@ -4300,21 +4248,13 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
4300 } 4248 }
4301 } 4249 }
4302 4250
4303 i = n_monitors; 4251 for (i = 0; i < n_monitors; ++i)
4304 while (i-- > 0)
4305 { 4252 {
4306 Lisp_Object geometry, workarea, attributes = Qnil;
4307 gint width_mm = -1, height_mm = -1; 4253 gint width_mm = -1, height_mm = -1;
4308 GdkRectangle rec; 4254 GdkRectangle rec, work;
4309 4255 struct MonitorInfo *mi = &monitors[i];
4310 attributes = Fcons (Fcons (Qsource,
4311 make_string (source, strlen (source))),
4312 attributes);
4313 attributes = Fcons (Fcons (Qframes, AREF (monitor_frames, i)),
4314 attributes);
4315 4256
4316 gdk_screen_get_monitor_geometry (gscreen, i, &rec); 4257 gdk_screen_get_monitor_geometry (gscreen, i, &rec);
4317 geometry = list4i (rec.x, rec.y, rec.width, rec.height);
4318 4258
4319#if GTK_CHECK_VERSION (2, 14, 0) 4259#if GTK_CHECK_VERSION (2, 14, 0)
4320 width_mm = gdk_screen_get_monitor_width_mm (gscreen, i); 4260 width_mm = gdk_screen_get_monitor_width_mm (gscreen, i);
@@ -4324,54 +4264,50 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
4324 width_mm = rec.width * mm_width_per_pixel + 0.5; 4264 width_mm = rec.width * mm_width_per_pixel + 0.5;
4325 if (height_mm < 0) 4265 if (height_mm < 0)
4326 height_mm = rec.height * mm_height_per_pixel + 0.5; 4266 height_mm = rec.height * mm_height_per_pixel + 0.5;
4327 attributes = Fcons (Fcons (Qmm_size,
4328 list2i (width_mm, height_mm)),
4329 attributes);
4330 4267
4331#if GTK_CHECK_VERSION (3, 4, 0) 4268#if GTK_CHECK_VERSION (3, 4, 0)
4332 gdk_screen_get_monitor_workarea (gscreen, i, &rec); 4269 gdk_screen_get_monitor_workarea (gscreen, i, &work);
4333 workarea = list4i (rec.x, rec.y, rec.width, rec.height);
4334#else 4270#else
4335 /* Emulate the behavior of GTK+ 3.4. */ 4271 /* Emulate the behavior of GTK+ 3.4. */
4336 { 4272 {
4337 XRectangle workarea_r; 4273 XRectangle workarea_r;
4338 4274
4339 workarea = Qnil;
4340 if (i == primary_monitor && x_get_net_workarea (dpyinfo, &workarea_r)) 4275 if (i == primary_monitor && x_get_net_workarea (dpyinfo, &workarea_r))
4341 { 4276 {
4342 GdkRectangle work;
4343
4344 work.x = workarea_r.x; 4277 work.x = workarea_r.x;
4345 work.y = workarea_r.y; 4278 work.y = workarea_r.y;
4346 work.width = workarea_r.width; 4279 work.width = workarea_r.width;
4347 work.height = workarea_r.height; 4280 work.height = workarea_r.height;
4348 if (gdk_rectangle_intersect (&rec, &work, &work)) 4281 if (! gdk_rectangle_intersect (&rec, &work, &work))
4349 workarea = list4i (work.x, work.y, work.width, work.height); 4282 work = rec;
4350 } 4283 }
4351 if (NILP (workarea)) 4284 else
4352 workarea = geometry; 4285 work = rec;
4353 } 4286 }
4354#endif 4287#endif
4355 attributes = Fcons (Fcons (Qworkarea, workarea), attributes);
4356 4288
4357 attributes = Fcons (Fcons (Qgeometry, geometry), attributes); 4289
4290 mi->geom.x = rec.x;
4291 mi->geom.y = rec.y;
4292 mi->geom.width = rec.width;
4293 mi->geom.height = rec.height;
4294 mi->work.x = work.x;
4295 mi->work.y = work.y;
4296 mi->work.width = work.width;
4297 mi->work.height = work.height;
4298 mi->mm_width = width_mm;
4299 mi->mm_height = height_mm;
4300
4358#if GTK_CHECK_VERSION (2, 14, 0) 4301#if GTK_CHECK_VERSION (2, 14, 0)
4359 { 4302 mi->name = gdk_screen_get_monitor_plug_name (gscreen, i);
4360 char *name = gdk_screen_get_monitor_plug_name (gscreen, i);
4361 if (name)
4362 attributes = Fcons (Fcons (Qname, make_string (name, strlen (name))),
4363 attributes);
4364 }
4365#endif 4303#endif
4366
4367 if (i == primary_monitor)
4368 primary_monitor_attributes = attributes;
4369 else
4370 attributes_list = Fcons (attributes, attributes_list);
4371 } 4304 }
4372 4305
4373 if (!NILP (primary_monitor_attributes)) 4306 attributes_list = make_monitor_attribute_list (monitors,
4374 attributes_list = Fcons (primary_monitor_attributes, attributes_list); 4307 n_monitors,
4308 primary_monitor,
4309 monitor_frames,
4310 source);
4375 unblock_input (); 4311 unblock_input ();
4376#else /* not USE_GTK */ 4312#else /* not USE_GTK */
4377 4313
@@ -6294,11 +6230,6 @@ syms_of_xfns (void)
6294 DEFSYM (Qundefined_color, "undefined-color"); 6230 DEFSYM (Qundefined_color, "undefined-color");
6295 DEFSYM (Qcompound_text, "compound-text"); 6231 DEFSYM (Qcompound_text, "compound-text");
6296 DEFSYM (Qcancel_timer, "cancel-timer"); 6232 DEFSYM (Qcancel_timer, "cancel-timer");
6297 DEFSYM (Qgeometry, "geometry");
6298 DEFSYM (Qworkarea, "workarea");
6299 DEFSYM (Qmm_size, "mm-size");
6300 DEFSYM (Qframes, "frames");
6301 DEFSYM (Qsource, "source");
6302 DEFSYM (Qfont_param, "font-parameter"); 6233 DEFSYM (Qfont_param, "font-parameter");
6303 /* This is the end of symbol initialization. */ 6234 /* This is the end of symbol initialization. */
6304 6235