bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#986: x-display-pixel-width does NOT return current display width cor


From: Baoqiu Cui
Subject: bug#986: x-display-pixel-width does NOT return current display width correctly
Date: Tue, 16 Sep 2008 10:03:23 -0700
User-agent: Gnus/5.1100000000000003 (Gnus v5.11) Emacs/22.2 (cygwin)

Chris McMahan <first_initiallastname@one.dot.net> writes:

> Baoqiu Cui <cbaoqiu@yahoo.com> writes:
>
>> Hi,
>>
>> I wrote some functions a long time ago to automatically adjust the frame
>> size based on display resolution, and they worked well in XEmacs but not
>> in Emacs.  The reason is that function x-display-pixel-width behaves a
>> little differently in Emacs.
>>
>> In XEmacs, (x-display-pixel-width) can recognize the display resolution
>> changes after XEmacs is started.  For example, if the display resolution
>> was originally set to 1400x1050 when XEmacs was started,
>> (x-display-pixel-width) would 1400; then, if the display resolution is
>> changed to 1280x1024 while XEmacs is still running,
>> (x-display-pixel-width) would return 1280.
>>
>> However, (x-display-pixel-width) on Emacs is NOT able to recognize such
>> physical display resolution change (from 1400x1050 to 1280x1024) and
>> will still return 1400.
>>
>> Does anyone know if there is any function in Emacs that works as XEmacs'
>> x-display-pixel-width?
>>
>> Thanks,
>> Baoqiu
>
> I don't know of any function to do this after the resolution changes. I
> would almost consider it a bug that x-display-pixel-width does not
> reflect the new resolution.

Thanks for your reply, Chris.  Yes, this seems to be a bug in Emacs
(unless the author claims that it is a feature :-).

For now, I am using the following piece of code as a workaround (it
works pretty well on Linux boxes, but is terribly slow on Cygwin):

    (with-temp-buffer
      (call-process "xdpyinfo" nil t)
      (goto-char (point-min))
      (if (re-search-forward "^  dimensions: +\\([0-9]+\\)x" nil t)
          (string-to-number (match-string 1))
        ;; Use 1024 as the default resolution
        1024))

> I'd be interested in seeing your frame functions. I have similar
> functions that I've built to move the frame from my left monitor to my
> right monitor, resize to fit each monitor, and shrink and enlarge each
> frame.

I did not do many fancy stuffs.  All I did was to have different frame
configurations for different display resolutions (1024x768, 1280x1024,
..., 1920x1200), and have some key binding(s) to resize the frame in the
way I want.  The key binding that I use the most is the one that toggles
between the normal (default) frame configuration and the "maximized"
configuration.

Thanks,
Baoqiu

>
> - Chris
>
> -- 
>      (.   .)
>   =ooO=(_)=Ooo=====================================
>   Chris McMahan | first_initiallastname@one.dot.net
>   =================================================







reply via email to

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