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: Thu, 21 Mar 2013 08:28:33 +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 18:05:10 +0400, Dmitry Gutov <address@hidden> said:

>> What happens if you replace `CreateDC ("DISPLAY", NULL, NULL,
>> NULL)' in the patch with `CreateDC (TEXT ("DISPLAY"), NULL, NULL,
>> NULL)' ?

> That doesn't seem to change anything, either.

Hmm, what about the following one?

And could someone who is familiar with the W32 (or NS) port help us
make these functions consistent with the X11 version?  Otherwise elisp
programs that use these common functions (unconsciously) relying on
platform-specific behavior will not work as intended on other
platforms.

(Actually, some users have sent me "bug reports" that the behavior of
display-pixel-width/height on the Mac port is "wrong" for the reason
that they do not return the same values as the NS port, whereas those
in the Mac port behave consistently with those in X11.)

                                     YAMAMOTO Mitsuharu
                                address@hidden

=== modified file 'src/w32fns.c'
--- src/w32fns.c        2013-03-20 11:29:37 +0000
+++ src/w32fns.c        2013-03-20 23:19:20 +0000
@@ -4733,11 +4733,11 @@
   HDC hdc;
   int cap;
 
-  hdc = GetDC (dpyinfo->root_window);
+  hdc = GUI_FN (CreateDC) (GUISTR ("DISPLAY"), NULL, NULL, NULL);
 
   cap = GetDeviceCaps (hdc, VERTSIZE);
 
-  ReleaseDC (dpyinfo->root_window, hdc);
+  DeleteDC (hdc);
 
   return make_number (cap);
 }
@@ -4754,11 +4754,11 @@
   HDC hdc;
   int cap;
 
-  hdc = GetDC (dpyinfo->root_window);
+  hdc = GUI_FN (CreateDC) (GUISTR ("DISPLAY"), NULL, NULL, NULL);
 
   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-20 23:10:16 +0000
@@ -515,18 +515,18 @@
 int
 x_display_pixel_height (struct w32_display_info *dpyinfo)
 {
-  HDC dc = GetDC (NULL);
+  HDC dc = GUI_FN (CreateDC) (GUISTR ("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 = GUI_FN (CreateDC) (GUISTR ("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]