emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: x-display-pixel-width/height inconsistency


From: YAMAMOTO Mitsuharu
Subject: Re: x-display-pixel-width/height inconsistency
Date: Wed, 20 Mar 2013 09:20:21 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shij┼Ź) APEL/10.6 Emacs/22.3 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

>>>>> On Wed, 20 Mar 2013 04:12:58 +0400, Dmitry Gutov <address@hidden> said:

>> Thanks for checking.  Does the following patch give dimensions of
>> all physical monitors as in X11?  Do display-mm-height/width return
>> meaningful values?

> Sorry, can't apply the patch, `bzr patch' says

> bzr: ERROR: Error invoking patch: Invalid argument

> If you resend it in unified format, I can try to apply it manually.

You can convert the format from context diff to unified diff using C-c
C-u in diff-mode.  Anyway, I resend the patch.

> Without the patch, display-mm-height/width return some values, same
> on both monitors, but I can't tell how they relate to x-display-*
> functions.

Please also try display-mm-height/width after applying the patch.

                                     YAMAMOTO Mitsuharu
                                address@hidden

=== modified file 'src/w32fns.c'
--- src/w32fns.c        2013-03-10 22:55:25 +0000
+++ src/w32fns.c        2013-03-19 23:47:14 +0000
@@ -4732,15 +4732,10 @@
 If omitted or nil, that stands for the selected frame's display.  */)
   (Lisp_Object display)
 {
-  struct w32_display_info *dpyinfo = check_x_display_info (display);
-  HDC hdc;
-  int cap;
-
-  hdc = GetDC (dpyinfo->root_window);
+  HDC hdc = CreateDC ("DISPLAY", NULL, NULL, NULL);
+  int cap = GetDeviceCaps (hdc, VERTSIZE);
 
-  cap = GetDeviceCaps (hdc, VERTSIZE);
-
-  ReleaseDC (dpyinfo->root_window, hdc);
+  DeleteDC (hdc);
 
   return make_number (cap);
 }
@@ -4752,16 +4747,10 @@
 If omitted or nil, that stands for the selected frame's display.  */)
   (Lisp_Object display)
 {
-  struct w32_display_info *dpyinfo = check_x_display_info (display);
-
-  HDC hdc;
-  int cap;
-
-  hdc = GetDC (dpyinfo->root_window);
-
-  cap = GetDeviceCaps (hdc, HORZSIZE);
+  HDC hdc = CreateDC ("DISPLAY", NULL, NULL, NULL);
+  int cap = GetDeviceCaps (hdc, HORZSIZE);
 
-  ReleaseDC (dpyinfo->root_window, hdc);
+  DeleteDC (hdc);
 
   return make_number (cap);
 }

=== modified file 'src/w32term.c'
--- src/w32term.c       2013-03-15 10:07:29 +0000
+++ src/w32term.c       2013-03-19 23:47:25 +0000
@@ -515,18 +515,18 @@
 int
 x_display_pixel_height (struct w32_display_info *dpyinfo)
 {
-  HDC dc = GetDC (NULL);
+  HDC dc = CreateDC ("DISPLAY", NULL, NULL, NULL);
   int pixels = GetDeviceCaps (dc, VERTRES);
-  ReleaseDC (NULL, dc);
+  DeleteDC (dc);
   return pixels;
 }
 
 int
 x_display_pixel_width (struct w32_display_info *dpyinfo)
 {
-  HDC dc = GetDC (NULL);
+  HDC dc = CreateDC ("DISPLAY", NULL, NULL, NULL);
   int pixels = GetDeviceCaps (dc, HORZRES);
-  ReleaseDC (NULL, dc);
+  DeleteDC (dc);
   return pixels;
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]