aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32term.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/w32term.c')
-rw-r--r--src/w32term.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/src/w32term.c b/src/w32term.c
index d3174c65bf0..732a4f4bfef 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -143,6 +143,15 @@ BOOL (WINAPI *pfnSetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD);
143#define WS_EX_LAYERED 0x80000 143#define WS_EX_LAYERED 0x80000
144#endif 144#endif
145 145
146/* SM_CXVIRTUALSCREEN and SM_CYVIRTUALSCREEN are not defined on 95 and
147 NT4. */
148#ifndef SM_CXVIRTUALSCREEN
149#define SM_CXVIRTUALSCREEN 78
150#endif
151#ifndef SM_CYVIRTUALSCREEN
152#define SM_CYVIRTUALSCREEN 79
153#endif
154
146/* This is a frame waiting to be autoraised, within w32_read_socket. */ 155/* This is a frame waiting to be autoraised, within w32_read_socket. */
147struct frame *pending_autoraise_frame; 156struct frame *pending_autoraise_frame;
148 157
@@ -519,18 +528,24 @@ x_set_frame_alpha (struct frame *f)
519int 528int
520x_display_pixel_height (struct w32_display_info *dpyinfo) 529x_display_pixel_height (struct w32_display_info *dpyinfo)
521{ 530{
522 HDC dc = GetDC (NULL); 531 int pixels = GetSystemMetrics (SM_CYVIRTUALSCREEN);
523 int pixels = GetDeviceCaps (dc, VERTRES); 532
524 ReleaseDC (NULL, dc); 533 if (pixels == 0)
534 /* Fallback for Windows 95 or NT 4.0. */
535 pixels = GetSystemMetrics (SM_CYSCREEN);
536
525 return pixels; 537 return pixels;
526} 538}
527 539
528int 540int
529x_display_pixel_width (struct w32_display_info *dpyinfo) 541x_display_pixel_width (struct w32_display_info *dpyinfo)
530{ 542{
531 HDC dc = GetDC (NULL); 543 int pixels = GetSystemMetrics (SM_CXVIRTUALSCREEN);
532 int pixels = GetDeviceCaps (dc, HORZRES); 544
533 ReleaseDC (NULL, dc); 545 if (pixels == 0)
546 /* Fallback for Windows 95 or NT 4.0. */
547 pixels = GetSystemMetrics (SM_CXSCREEN);
548
534 return pixels; 549 return pixels;
535} 550}
536 551
@@ -5159,7 +5174,10 @@ x_draw_hollow_cursor (struct window *w, struct glyph_row *row)
5159 the current matrix is invalid or such, give up. */ 5174 the current matrix is invalid or such, give up. */
5160 cursor_glyph = get_phys_cursor_glyph (w); 5175 cursor_glyph = get_phys_cursor_glyph (w);
5161 if (cursor_glyph == NULL) 5176 if (cursor_glyph == NULL)
5162 return; 5177 {
5178 DeleteObject (hb);
5179 return;
5180 }
5163 5181
5164 /* Compute frame-relative coordinates for phys cursor. */ 5182 /* Compute frame-relative coordinates for phys cursor. */
5165 get_phys_cursor_geometry (w, row, cursor_glyph, &left, &top, &h); 5183 get_phys_cursor_geometry (w, row, cursor_glyph, &left, &top, &h);
@@ -6606,7 +6624,7 @@ w32_initialize (void)
6606 } 6624 }
6607 6625
6608#ifdef CYGWIN 6626#ifdef CYGWIN
6609 if ((w32_message_fd = open ("/dev/windows", O_RDWR | O_CLOEXEC)) == -1) 6627 if ((w32_message_fd = emacs_open ("/dev/windows", O_RDWR, 0)) == -1)
6610 fatal ("opening /dev/windows: %s", strerror (errno)); 6628 fatal ("opening /dev/windows: %s", strerror (errno));
6611#endif /* CYGWIN */ 6629#endif /* CYGWIN */
6612 6630