Xlib: DisplayWidth / DisplayHeight
Vladimir Dergachev
volodya at mindspring.com
Tue Sep 12 10:41:36 UTC 2023
On Fri, 8 Sep 2023, Zbigniew wrote:
>> If you are doing this for open source project, you should change your code
>> to:
>>
>> [..]
>
> The code you've pasted doesn't work properly; it returns the size of
> virtual screen — so you added 3x as much lines to get, in effect, the
> same (incorrect) result as the few lines I pasted.
>
>> Oh, and no I don't actually know what you mean, because it depends on what
>> application you are writing.
>
> Whatever it could be — an useful tool, or a silly game, open-source,
> or commercial — it needs to find out the exact physical screen's
> dimensions (in pixels), to learn how big is the working area.
Oh, I see. I suggest you try writing some concrete code - learning this in
abstract can be tricky. Don't be afraid to rewrite it from scratch a few
times. There is existing source code from X examples and tools, as well as
other libraries, such as gtk and Qt.
best
Vladimir Dergachev
>
>> If you do teleconferencing, you might want to capture either the entire
>> screen, or some window.
>>
>> If you want to record a movie of a game playing fullscreen, than you
>> probably need the position and dimensions of the game window, because
>> games often change video mode while keeping original virtual screen
>> intact.
>>
>> If you want to make a better Xvnc, you probably need the code above and
>> you might not need xrandr.
>>
>> If you are doing something else - who knows what you mean ?
>
> So now you see (I hope that you see): „if… if… if… if… else…” etc. A
> whole lot of checks and decisions that could be avoided, _IF_ the two
> macros were working properly
> --
> best,
> Teenager
>
More information about the xorg
mailing list