Commit cf13177e authored by YAMAMOTO Mitsuharu's avatar YAMAMOTO Mitsuharu

Add multi-monitor support on W32.

parent 46e4f821
......@@ -125,6 +125,14 @@ used to conveniently prepend/append new face attributes to text.
`frame-monitor-attributes' can be used to obtain information about
each physical monitor on multi-monitor setups.
*** The functions `display-pixel-width' and `display-pixel-height' now
behave consistently among the platforms: they return the pixel width
or height for all physical monitors associated with the given display
as just they were on X11. To get information for each physical
monitor, use the new functions above. Similar notes also apply to
`x-display-pixel-width', `x-display-pixel-height', `display-mm-width',
`display-mm-height', `x-display-mm-width', and `x-display-mm-height'.
* Editing Changes in Emacs 24.4
......
2013-07-04 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
* frame.el (display-pixel-height, display-pixel-width)
(display-mm-height, display-mm-width): Mention behavior on
multi-monitor setups in docstrings.
(w32-display-monitor-attributes-list): Declare function.
(display-monitor-attributes-list): Use it.
2013-07-04 Michael Albinus <michael.albinus@gmx.de>
* filenotify.el: New package.
......
......@@ -1365,7 +1365,11 @@ frame's display)."
(defun display-pixel-height (&optional display)
"Return the height of DISPLAY's screen in pixels.
For character terminals, each character counts as a single pixel."
For character terminals, each character counts as a single pixel.
For graphical terminals, note that on \"multi-monitor\" setups this
refers to the pixel height for all physical monitors associated
with DISPLAY. To get information for each physical monitor, use
`display-monitor-attributes-list'."
(let ((frame-type (framep-on-display display)))
(cond
((memq frame-type '(x w32 ns))
......@@ -1377,7 +1381,11 @@ For character terminals, each character counts as a single pixel."
(defun display-pixel-width (&optional display)
"Return the width of DISPLAY's screen in pixels.
For character terminals, each character counts as a single pixel."
For character terminals, each character counts as a single pixel.
For graphical terminals, note that on \"multi-monitor\" setups this
refers to the pixel width for all physical monitors associated
with DISPLAY. To get information for each physical monitor, use
`display-monitor-attributes-list'."
(let ((frame-type (framep-on-display display)))
(cond
((memq frame-type '(x w32 ns))
......@@ -1408,7 +1416,11 @@ displays not explicitly specified."
(defun display-mm-height (&optional display)
"Return the height of DISPLAY's screen in millimeters.
System values can be overridden by `display-mm-dimensions-alist'.
If the information is unavailable, value is nil."
If the information is unavailable, value is nil.
For graphical terminals, note that on \"multi-monitor\" setups this
refers to the height in millimeters for all physical monitors
associated with DISPLAY. To get information for each physical
monitor, use `display-monitor-attributes-list'."
(and (memq (framep-on-display display) '(x w32 ns))
(or (cddr (assoc (or display (frame-parameter nil 'display))
display-mm-dimensions-alist))
......@@ -1420,7 +1432,11 @@ If the information is unavailable, value is nil."
(defun display-mm-width (&optional display)
"Return the width of DISPLAY's screen in millimeters.
System values can be overridden by `display-mm-dimensions-alist'.
If the information is unavailable, value is nil."
If the information is unavailable, value is nil.
For graphical terminals, note that on \"multi-monitor\" setups this
refers to the width in millimeters for all physical monitors
associated with DISPLAY. To get information for each physical
monitor, use `display-monitor-attributes-list'."
(and (memq (framep-on-display display) '(x w32 ns))
(or (cadr (assoc (or display (frame-parameter nil 'display))
display-mm-dimensions-alist))
......@@ -1495,6 +1511,8 @@ The value is one of the symbols `static-gray', `gray-scale',
(declare-function x-display-monitor-attributes-list "xfns.c"
(&optional terminal))
(declare-function w32-display-monitor-attributes-list "w32fns.c"
(&optional display))
(declare-function ns-display-monitor-attributes-list "nsfns.m"
(&optional terminal))
......@@ -1530,6 +1548,8 @@ monitors."
(cond
((eq frame-type 'x)
(x-display-monitor-attributes-list display))
((eq frame-type 'w32)
(w32-display-monitor-attributes-list display))
((eq frame-type 'ns)
(ns-display-monitor-attributes-list display))
(t
......
2013-07-04 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
* w32fns.c (Qgeometry, Qworkarea, Qmm_size, Qframes): New variables.
(syms_of_w32fns): DEFSYM them.
(MONITORINFOF_PRIMARY, SM_XVIRTUALSCREEN, SM_YVIRTUALSCREEN)
(CCHDEVICENAME): Define macros if not defined.
(struct MONITOR_INFO_EX): New struct.
(MonitorEnum_Proc, EnumDisplayMonitors_Proc): New prototypes.
(enum_display_monitors_fn): New variable.
(globals_of_w32fns): Initialize it.
(Fx_display_pixel_width, Fx_display_pixel_height)
(Fx_display_mm_height, Fx_display_mm_width): Mention behavior on
multi-monitor setups in docstrings.
(Fx_display_mm_height, Fx_display_mm_width): Approximate whole
screen size by primary monitor's millimeter per pixel.
(w32_monitor_enum, w32_display_monitor_attributes_list)
(w32_display_monitor_attributes_list_fallback)
(Fw32_display_monitor_attributes_list): New functions.
(syms_of_w32fns): Defsubr Sw32_display_monitor_attributes_list.
* w32term.c (SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN): Define macros
if not defined.
(x_display_pixel_height, x_display_pixel_width): Use GetSystemMetrics.
2013-07-04 Michael Albinus <michael.albinus@gmx.de>
* fileio.c (Qfile_notify_error): New error symbol.
......
This diff is collapsed.
......@@ -143,6 +143,15 @@ BOOL (WINAPI *pfnSetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD);
#define WS_EX_LAYERED 0x80000
#endif
/* SM_CXVIRTUALSCREEN and SM_CYVIRTUALSCREEN are not defined on 95 and
NT4. */
#ifndef SM_CXVIRTUALSCREEN
#define SM_CXVIRTUALSCREEN 78
#endif
#ifndef SM_CYVIRTUALSCREEN
#define SM_CYVIRTUALSCREEN 79
#endif
/* This is a frame waiting to be autoraised, within w32_read_socket. */
struct frame *pending_autoraise_frame;
......@@ -519,18 +528,24 @@ x_set_frame_alpha (struct frame *f)
int
x_display_pixel_height (struct w32_display_info *dpyinfo)
{
HDC dc = GetDC (NULL);
int pixels = GetDeviceCaps (dc, VERTRES);
ReleaseDC (NULL, dc);
int pixels = GetSystemMetrics (SM_CYVIRTUALSCREEN);
if (pixels == 0)
/* Fallback for Windows 95 or NT 4.0. */
pixels = GetSystemMetrics (SM_CYSCREEN);
return pixels;
}
int
x_display_pixel_width (struct w32_display_info *dpyinfo)
{
HDC dc = GetDC (NULL);
int pixels = GetDeviceCaps (dc, HORZRES);
ReleaseDC (NULL, dc);
int pixels = GetSystemMetrics (SM_CXVIRTUALSCREEN);
if (pixels == 0)
/* Fallback for Windows 95 or NT 4.0. */
pixels = GetSystemMetrics (SM_CXSCREEN);
return pixels;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment