LibVncClient get operation system info - c++

I use the libvncclient, to build a viewer, in which i try to integrate a specific hotkeys which do a bit of scripting, that are done as menu options, such as enable taskmanager,'run cmd' for window, and 'open terminal,'update repos' etc. I need to detect the operating system info, but i don't see anything to get this info from in rfb proto
rfbClient *client = new client();
if(!ConnectToRFBServer(client,client->serverHost,client->serverPort))
return FALSE;
if (!InitialiseRFBConnection(client))
return FALSE;
I looked trough the rfbclient.h and rfbClient structure doesn't hold any callback/or field that stores this info, as well as there is no apis for that it seems. But in rfc there is this thing https://www.rfc-editor.org/rfc/rfc6143#section-7.3.2
After receiving the ClientInit message, the server sends a ServerInit
message. This tells the client the width and height of the server's
framebuffer, its pixel format, and the name associated with the
desktop:
Richardson & Levine Informational [Page 11]
RFC 6143 The Remote Framebuffer Protocol March 2011
+--------------+--------------+------------------------------+
| No. of bytes | Type [Value] | Description |
+--------------+--------------+------------------------------+
| 2 | U16 | framebuffer-width in pixels |
| 2 | U16 | framebuffer-height in pixels |
| 16 | PIXEL_FORMAT | server-pixel-format |
| 4 | U32 | name-length |
| name-length | U8 array | name-string |
+--------------+--------------+------------------------------+
But it seems that libvnc doesn't handle that, is there any way that this info could be taken?

Related

How to retrieve the "Regional Format" in Windows 10

I'm trying to find out how the "regional format" setting on Windows 10 can be retrieved (see picture below).
I tried GetLocaleInfoEx, with virtually all combinations of parameters, but this one showed up nowhere.
On the other hand this setting has an influence on what's returned by GetThreadLocale:
Some examples with expected return values from GetThreadLocale as per this Microsoft documentation, C++ code at the end of the question.
+--------------------------+-----------------------------------+
| Regional format | Value returned by GetThreadLocale |
+--------------------------+-----------------------------------+
| French (Switzerland) | 0x100c |
| French (France) | 0x040c |
| German (Germany) | 0x0407 |
| English (United states) | 0x0409 |
| English (United Kingdom) | 0x0809 |
+--------------------------+-----------------------------------+
Some examples with unexpected (and undocumented) return values from GetThreadLocale:
+-----------------------+-----------------------------------+
| Regional format | Value returned by GetThreadLocale |
+-----------------------+-----------------------------------+
| English (Switzerland) | 0x0c00 |
| English (Germany) | 0x0c00 |
| German (Italy) | 0x0c00 |
+-----------------------+-----------------------------------+
I really wonder what this 0x0c00 value returned by GetThreadLocale is?
C++ code
#include <windows.h>
#include <stdio.h>
int main()
{
printf("GetThreadLocale: %08x\n", GetThreadLocale());
}

Cascading actions with bookmarks in PowerBI

The problem is the following:
Let's consider 2 sets of images embedded in a PowerBI file .pbix:
Set 1: Img1, Img2
Set 2: Img3, Img4, Img5, Img6
For each combination of 2 images between the two sets, we want to set an action (to a bookmark) to display a corresponding visual.
So here, we have these combinations:
(Img1, Img3) -> display Viz1.3
(Img1, Img4) -> display Viz1.4
(Img1, Img5) -> display Viz1.5
(Img1, Img6) -> display Viz1.6
(Img2, Img3) -> display Viz2.3
(Img2, Img4) -> display Viz2.4
(Img2, Img5) -> display Viz2.5
(Img2, Img6) -> display Viz2.6
Let's suppose that we have selected (Img1, Img3) and then we select (click) Img2.
How can we keep the selection on Img3 in order to display Viz2.3 ?
Marco
Each image can, I'm pretty sure, only trigger one bookmark. If I'm reading right, I think you need to duplicate the images and hide/show according to the state of the display.
For example in the example above, if the display is Viz1.3 and you click image 2, the updates would be to the viz and to the images in set 2:
Viz1.3 -> Viz2.3
Img3.1 -> Img3.2
Img4.1 -> Img4.2
Img5.1 -> Img5.2
Img6.1 -> Img6.2
And if you updated from there by clicking Img4 to get to Viz2.4, you'd have to update the images in set one
Viz2.3 -> Viz2.4
Img1.3 -> Img1.4
Img2.3 -> Img2.4
So, ultimately, you'd need four version of each image in set one (one for each in set two) and two of each in set two (to match set one). And though you're only showing 6 at any given time, that's 16 which is twice as many as you have visuals. But if you have to have it that way for UX, then I can't think of another way to do it.
| Image | Bookmark |
|-----------|--------------|
| Img1.3 | Viz1.3 |
| Img1.4 | Viz1.4 |
| Img1.5 | Viz1.5 |
| Img1.6 | Viz1.6 |
| Img2.3 | Viz2.3 |
| Img2.4 | Viz2.4 |
| Img2.5 | Viz2.5 |
| Img2.6 | Viz2.6 |
| Img3.1 | Viz1.3 |
| Img3.2 | Viz2.3 |
| Img4.1 | Viz1.4 |
| Img4.2 | Viz2.4 |
| Img5.1 | Viz1.5 |
| Img5.2 | Viz2.5 |
| Img6.1 | Viz1.6 |
| Img6.2 | Viz2.6 |
Showing or hiding bookmarks by screen state

websocket fin bit in c++

im' having lately a little problem with websockets fin bit and my c++ server. Whenever i try to use FIN = 0, host drops connection with no reason. Here is part of my code to calculate FIN:
string ret
ret += (unsigned char)((fin & 1) << 7) | (opcode & 63);
When i use FIN = 1, my first byte in frame is 129, which is correct and user gets correct answear. With FIN =0 first byte is 1 which also seems to be good and then after sending connection drops. Tried to send the same packets of data with both flags and only FIN =0 fails;
Why i try to use FIN = 0? well i'm trying to make a little three.js + websocket game, i'd like a server to send all the models through the websocket for every player, so i expect a heavy load which i'd like to control.
I'd be happy to provide any additional informations.
Thanks in advance.
I have no idea about C++, but I know a bit about WebSockets.
Which value do you have in the other byte? When you send a FIN=0 frame, you still need to send the frame options in it. Subsequent frames must be of the option "Continuation", and nothing else. As far as I remember, continuation frames cannot even have the RSV bits different than 0.
If you send a frame with FIN=0 without type (text or binary), it will probably fail. If you send a FIN=1 with a type different that "Continuation" after a FIN=0 will fail.
So the key is, what are you sending in the second byte? Also, it would be great if you try with Google Chrome and check in the console why is the connection being shut down.
OPCODE:
|Opcode | Meaning | |
-+--------+-------------------------------------+-----------|
| 0 | Continuation Frame | |
-+--------+-------------------------------------+-----------|
| 1 | Text Frame | |
-+--------+-------------------------------------+-----------|
| 2 | Binary Frame | |
-+--------+-------------------------------------+-----------|
| 8 | Connection Close Frame | |
-+--------+-------------------------------------+-----------|
| 9 | Ping Frame | |
-+--------+-------------------------------------+-----------|
| 10 | Pong Frame | |
-+--------+-------------------------------------+-----------|

How should I implement sub-windows in my OpenGL viewport?

How should I implement sub-windows in my OpenGL viewport? Inside my viewport, I want to reserve some space on the left for labels, and some space around the edges as a border. I've got all the coordinates figured out and everything is displaying properly. My problem is clipping the things in one subwindow that are spilling over into the others. I can't seem to figure out what the OpenGL 3.3, core context way of doing things is. Is it to
use per-vertex clipping?
a scissor test?
a stencil test?
associate a framebuffer with different parts of my window?
Which commands should I be looking at?
Before I spend time writing a full answer, I would like you to confirm that this is what you were describing in your original question:
*---------------------------------------*
| ------------------------------------- |
| | | | |
| | | | |
| | | | |
|C| A | B |C|
| | | | |
| | | | |
| |___|_______________________________| |
*---------------------------------------*
A = Labels
B = Main Window
C = Border

"Attachment layout" of action is simply ignored! Why?

I publish an OG action/object but the attachment layout of the action (which has been set to "Item") is simply ignored. On my timeline, I click on the date/time link to see the action in full details (along with the attachment)... but all I see is a box with object image in the center and the object title at the bottom:
------------------
| |
| |
| Image |
| |
| |
------------------
| Object Title |
------------------
Instead I expect to see a smaller image at the left side along with the title and other captions on the right side (like what "Item" layout preview is showing):
-----------------------------------------
| | Object Title |
| | Caption 1 |
| Image | Caption 2 |
| | Caption 3 |
| | Caption 4 |
-----------------------------------------
And the OG tags of my object page, hosted on my website, are correct (at least the Facebook OG Debugger says so!).
Does anyone know what I'm missing here?
Thank you,