]> git.eshelyaron.com Git - emacs.git/commitdiff
(x_display_pixel_height, x_display_pixel_width):
authorJason Rumney <jasonr@gnu.org>
Thu, 12 Feb 2009 14:39:17 +0000 (14:39 +0000)
committerJason Rumney <jasonr@gnu.org>
Thu, 12 Feb 2009 14:39:17 +0000 (14:39 +0000)
Release DC when finished.  Use NULL window to refer to desktop.
(w32_term_init): Use NULL window to refer to desktop. (Bug#460)

src/ChangeLog
src/w32term.c

index bcbf87f16834a90f201cb849608e800a50362000..5b6f0a6016acd20cab8132c601c135dcb5245e66 100644 (file)
@@ -1,5 +1,9 @@
 2009-02-12  Jason Rumney  <jasonr@gnu.org>
 
+       * w32term.c (x_display_pixel_height, x_display_pixel_width):
+       Release DC when finished.  Use NULL window to refer to desktop.
+       (w32_term_init): Use NULL window to refer to desktop. (Bug#460)
+
        * w32font.c (add_font_entity_to_list): Fix check for substituted
        raster fonts. (Bug#2219)
 
index 7ad7778feaaed4de882b14f2ac107c235ed727e2..34fc450217f76945499a705923c2741c885d83a5 100644 (file)
@@ -464,14 +464,20 @@ int
 x_display_pixel_height (dpyinfo)
      struct w32_display_info *dpyinfo;
 {
-  return GetDeviceCaps (GetDC (GetDesktopWindow ()), VERTRES);
+  HDC dc = GetDC (NULL);
+  int pixels = GetDeviceCaps (dc, VERTRES);
+  ReleaseDC (NULL, dc);
+  return pixels;
 }
 
 int
 x_display_pixel_width (dpyinfo)
      struct w32_display_info *dpyinfo;
 {
-  return GetDeviceCaps (GetDC (GetDesktopWindow ()), HORZRES);
+  HDC dc = GetDC (NULL);
+  int pixels = GetDeviceCaps (dc, HORZRES);
+  ReleaseDC (NULL, dc);
+  return pixels;
 }
 
 \f
@@ -6216,7 +6222,7 @@ w32_term_init (display_name, xrm_option, resource_name)
   dpyinfo->next = x_display_list;
   x_display_list = dpyinfo;
 
-  hdc = GetDC (GetDesktopWindow ());
+  hdc = GetDC (NULL);
 
   dpyinfo->root_window = GetDesktopWindow ();
   dpyinfo->n_planes = GetDeviceCaps (hdc, PLANES);
@@ -6224,7 +6230,7 @@ w32_term_init (display_name, xrm_option, resource_name)
   dpyinfo->resx = GetDeviceCaps (hdc, LOGPIXELSX);
   dpyinfo->resy = GetDeviceCaps (hdc, LOGPIXELSY);
   dpyinfo->has_palette = GetDeviceCaps (hdc, RASTERCAPS) & RC_PALETTE;
-  ReleaseDC (GetDesktopWindow (), hdc);
+  ReleaseDC (NULL, hdc);
 
   /* initialise palette with white and black */
   {