Re: How do I get the screen resolution?

2022-04-28 Thread Alexander Zhirov via Digitalmars-d-learn
On Thursday, 28 April 2022 at 22:51:02 UTC, Christopher Katko 
wrote:



Are you sure about that?


Well, if we're talking about programming, then most likely I need 
to work with something like this :)


https://en.wikipedia.org/wiki/Display_Data_Channel

And how to do it - I can't find.


Re: T... args!

2022-04-28 Thread Salih Dincer via Digitalmars-d-learn
On Thursday, 9 December 2021 at 14:34:58 UTC, Steven 
Schveighoffer wrote:


You may want to post what you want to achieve with your code, 
instead of examples of what you tried, and it may allow us to 
make things clearer. You are likely using the wrong construct 
to achieve your goals.


-Steve


Hi, sorry to bring up an old topic again, but I'm not a zombie.  
It's true I'm a dinosaur. 


What I want to do is: What is supported in many programming 
languages ​​but not in modern D programming language: String 
Interpolation


I believe this will be done using the template. What is this D 
template called as the special syntax called?


SDB@79


Re: How do I get the screen resolution?

2022-04-28 Thread Christopher Katko via Digitalmars-d-learn
On Thursday, 28 April 2022 at 11:22:15 UTC, Alexander Zhirov 
wrote:

Are there any methods to get the screen resolution?
On C/C++ from under X11, it is not possible to do this on the 
command line via SSH, since the display is not defined. And is 
it possible to do this somehow by means of D, pulling out the 
system resolution of the installed display?


Are you sure about that?

https://askubuntu.com/questions/1077581/from-a-remote-ssh-session-how-can-i-get-the-screen-resolution-of-the-physically



Re: Problem with GC - linking C++ & D (with gdc)

2022-04-28 Thread Ali Çehreli via Digitalmars-d-learn

On 4/26/22 3:32 AM, Claude wrote:
> On Tuesday, 26 April 2022 at 10:29:39 UTC, Iain Buclaw wrote:

>> you haven't initialized the D run-time in your program.

> I should have suspected something like this.

I've just discovered[1] that I had a DConf 2020 presentation which is 
somewhat related to this thread. Initializing the D runtime appears at 
this point:


  https://youtu.be/FNL-CPX4EuM?t=2585

Ali

[1] I am not kidding! I've just stumbled upon a directory named 
'dconf_online_2020/capi' on my computer, curious, looked inside, and 
couldn't believe that I did prepare such a presentation! Year 2020 must 
really have happened after all. :)




Re: CTFE and BetterC compatibility

2022-04-28 Thread bauss via Digitalmars-d-learn

On Thursday, 28 April 2022 at 12:36:56 UTC, Dennis wrote:

On Thursday, 28 April 2022 at 12:10:44 UTC, bauss wrote:
On Wednesday, 27 April 2022 at 15:40:49 UTC, Adam D Ruppe 
wrote:

but this got killed due to internal D politics. A pity.


A tale as old as time itself


In this case, it was actually a trailing whitespace in the 
changelog entry making the test suite fail, but the PR author 
ceased activity before fixing it and now it has merge conflicts.


https://github.com/dlang/dmd/pull/11014#discussion_r427108067


The fact a trailing white-space has any impact is almost 
laughable.


Re: CTFE and BetterC compatibility

2022-04-28 Thread Adam D Ruppe via Digitalmars-d-learn

On Thursday, 28 April 2022 at 12:36:56 UTC, Dennis wrote:
In this case, it was actually a trailing whitespace in the 
changelog entry making the test suite fail, but the PR author


Stefan's own `assert(__ctfe);` approach was better anyway...


Re: CTFE and BetterC compatibility

2022-04-28 Thread Dennis via Digitalmars-d-learn

On Thursday, 28 April 2022 at 12:10:44 UTC, bauss wrote:

On Wednesday, 27 April 2022 at 15:40:49 UTC, Adam D Ruppe wrote:

but this got killed due to internal D politics. A pity.


A tale as old as time itself


In this case, it was actually a trailing whitespace in the 
changelog entry making the test suite fail, but the PR author 
ceased activity before fixing it and now it has merge conflicts.


https://github.com/dlang/dmd/pull/11014#discussion_r427108067



Re: CTFE and BetterC compatibility

2022-04-28 Thread bauss via Digitalmars-d-learn

On Wednesday, 27 April 2022 at 15:40:49 UTC, Adam D Ruppe wrote:

but this got killed due to internal D politics. A pity.


A tale as old as time itself


Re: How do I get the screen resolution?

2022-04-28 Thread Adam D Ruppe via Digitalmars-d-learn
On Thursday, 28 April 2022 at 11:22:15 UTC, Alexander Zhirov 
wrote:

Are there any methods to get the screen resolution?


Call DisplayWidth/DisplayHeight on the X connection... my 
simpledisplay.d provides bindings (though not a high level helper 
function since both X and Windows calls are trivial)


On C/C++ from under X11, it is not possible to do this on the 
command line via SSH, since the display is not defined.


Just defined the display, that's easy.


import std.process;
enviornment["DISPLAY"] = ":0";

that can work with any lib, then connect.


OR, with my lib, it is all included:

---
import arsd.simpledisplay;

XDisplayConnection.setDisplayName(":0"); // set the local name 
regardless of what is set on ssh

auto connection = XDisplayConnection.get(); // connection

import std.stdio;
writeln(DisplayWidth(connection, 0), " x ", 
DisplayHeight(connection, 0)); // the 0 is the screen number

---


Though note with a multiple monitor system, this will give the 
*full* size of the virtual screen, not individual screens.


simpledisplay has methods for this. but I marked it `private` 
and it only loads the data when a window is created... you COULD 
hack past this anyway but prolly not worth the hassle. Maybe I 
will make it public officially in the next release.


But if you are desperate for the info now, here's how you can 
bypass private and get at it anyway:


---
// use reflection to bypass `private`
alias MonitorInfo = __traits(getMember, 
arsd.simpledisplay.SimpleWindow, "MonitorInfo");


// make a temporary window just to get the info
auto window = new SimpleWindow(1, 1, null, OpenGlOptions.no, 
Resizability.fixedSize, WindowTypes.eventOnly);


// this is the function that actually loads the monitor info
window.actualDpi();

// make sure none waiting in a buffer
flushGui();

// and now get the data out
foreach(monitor; MonitorInfo.info) {
writeln(monitor.position.size);
}

window.close();
---


But since you're bypassing private and poking internals, if/when 
I do decide to make this public instead of private, I'll probably 
break this approach (when it is public though you can just simply 
loop over the info).


Re: How do I get the screen resolution?

2022-04-28 Thread Mike Parker via Digitalmars-d-learn

On Thursday, 28 April 2022 at 11:35:46 UTC, Mike Parker wrote:

go through the same system APIs. For example, on Windows you 
can use two calls to `GetSystemMetrics` (one for the width, one 
for the height). 
(https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getsystemmetrics)


Been a while since I've done any Win32 stuff directly. In this 
age of multiple monitors, it's probably better to use 
`EnumDisplaySettings' on Windows.


https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-enumdisplaysettingsa

But the best option is like I said above: see how other libraries 
do it.


Re: How do I get the screen resolution?

2022-04-28 Thread Dennis via Digitalmars-d-learn
On Thursday, 28 April 2022 at 11:22:15 UTC, Alexander Zhirov 
wrote:

Are there any methods to get the screen resolution?


Example with GLFW:

https://github.com/dkorpel/glfw-d/blob/7a1eec60d427617c098d0e54a26cba796956a976/examples/empty-window/app.d#L118

Note that there can be multiple monitors, but you can use 
`glfwGetPrimaryMonitor()` to find the main one.





Re: How do I get the screen resolution?

2022-04-28 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 28 April 2022 at 11:22:15 UTC, Alexander Zhirov 
wrote:

Are there any methods to get the screen resolution?
On C/C++ from under X11, it is not possible to do this on the 
command line via SSH, since the display is not defined. And is 
it possible to do this somehow by means of D, pulling out the 
system resolution of the installed display?


Like C++, the D standard library doesn't have anything for this. 
It's platform specific. There are several open source libraries 
out there that include that functionality, so you could just look 
at one of them (GLFW, SDL, SFML, etc.) and do what they do for 
the platforms you care about. They all have to go through the 
same system APIs. For example, on Windows you can use two calls 
to `GetSystemMetrics` (one for the width, one for the height). 
(https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getsystemmetrics)




How do I get the screen resolution?

2022-04-28 Thread Alexander Zhirov via Digitalmars-d-learn

Are there any methods to get the screen resolution?
On C/C++ from under X11, it is not possible to do this on the 
command line via SSH, since the display is not defined. And is it 
possible to do this somehow by means of D, pulling out the system 
resolution of the installed display?


Re: QtE56: QFormBuilder: Error: undefined identifier `QFormBuilder`

2022-04-28 Thread Marcone via Digitalmars-d-learn

On Thursday, 28 April 2022 at 07:02:14 UTC, MGW wrote:

Probably did not compile
QtE5-master/build/QtE56/qte56core.pro
QtE5-master/build/QtE56/qte56widgets.pro
Use QMAKE to build a DLL/SO

More details by mail: m...@yandex.ru


I sent you an email. Could you answer me and send me these dlls 
for Windows x64? Thanks.





Re: QtE56: QFormBuilder: Error: undefined identifier `QFormBuilder`

2022-04-28 Thread Marcone via Digitalmars-d-learn

On Thursday, 28 April 2022 at 07:02:14 UTC, MGW wrote:

Probably did not compile
QtE5-master/build/QtE56/qte56core.pro
QtE5-master/build/QtE56/qte56widgets.pro
Use QMAKE to build a DLL/SO

More details by mail: m...@yandex.ru


Hi, I didn't compile it as Qt is too big for me to download just 
to use qmake to create these dlls. Could you please help all of 
us by making these dlls compiled for Windows x64 available? Thank 
you very much.


Re: QtE56: QFormBuilder: Error: undefined identifier `QFormBuilder`

2022-04-28 Thread MGW via Digitalmars-d-learn

Probably did not compile
QtE5-master/build/QtE56/qte56core.pro
QtE5-master/build/QtE56/qte56widgets.pro
Use QMAKE to build a DLL/SO

More details by mail: m...@yandex.ru